dx-react-grid-grommet
Advanced tools
Comparing version 1.0.16 to 1.0.17
@@ -211,2 +211,14 @@ 'use strict'; | ||
var _tableInlineCellEditing = require('./table-inline-cell-editing'); | ||
Object.keys(_tableInlineCellEditing).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function get() { | ||
return _tableInlineCellEditing[key]; | ||
} | ||
}); | ||
}); | ||
var _tableRowDetail = require('./table-row-detail'); | ||
@@ -213,0 +225,0 @@ |
@@ -50,4 +50,15 @@ 'use strict'; | ||
editingEnabled = _ref.editingEnabled, | ||
restProps = _objectWithoutProperties(_ref, ['column', 'value', 'onValueChange', 'style', 'children', 'row', 'tableRow', 'tableColumn', 'editingEnabled']); | ||
autoFocus = _ref.autoFocus, | ||
onBlur = _ref.onBlur, | ||
onFocus = _ref.onFocus, | ||
onKeyDown = _ref.onKeyDown, | ||
restProps = _objectWithoutProperties(_ref, ['column', 'value', 'onValueChange', 'style', 'children', 'row', 'tableRow', 'tableColumn', 'editingEnabled', 'autoFocus', 'onBlur', 'onFocus', 'onKeyDown']); | ||
var patchedChildren = children ? _react2.default.cloneElement(children, { | ||
autoFocus: autoFocus, | ||
onBlur: onBlur, | ||
onFocus: onFocus, | ||
onKeyDown: onKeyDown | ||
}) : children; | ||
return _react2.default.createElement( | ||
@@ -60,10 +71,14 @@ _TableCell.TableCell, | ||
}, restProps), | ||
children || _react2.default.createElement(_grommet.TextInput, { | ||
patchedChildren || _react2.default.createElement(_grommet.TextInput, { | ||
plain: true, | ||
focusIndicator: true, | ||
value: value || '', | ||
value: value === undefined || value === null ? '' : value, | ||
disabled: !editingEnabled, | ||
onChange: function onChange(e) { | ||
return onValueChange(e.target.value); | ||
} | ||
}, | ||
autoFocus: autoFocus, | ||
onBlur: onBlur, | ||
onFocus: onFocus, | ||
onKeyDown: onKeyDown | ||
}) | ||
@@ -83,3 +98,7 @@ ); | ||
editingEnabled: _propTypes2.default.bool, | ||
children: _propTypes2.default.node | ||
children: _propTypes2.default.node, | ||
autoFocus: _propTypes2.default.bool, | ||
onBlur: _propTypes2.default.func, | ||
onFocus: _propTypes2.default.func, | ||
onKeyDown: _propTypes2.default.func | ||
}; | ||
@@ -95,3 +114,7 @@ | ||
children: undefined, | ||
editingEnabled: true | ||
editingEnabled: true, | ||
autoFocus: false, | ||
onBlur: function onBlur() {}, | ||
onFocus: function onFocus() {}, | ||
onKeyDown: function onKeyDown() {} | ||
}; |
@@ -10,2 +10,4 @@ 'use strict'; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _react = require('react'); | ||
@@ -27,48 +29,76 @@ | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } /* | ||
Copyright 2019 Atanas Stoyanov | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
var TableEditRow = function TableEditRow(_ref) { | ||
var children = _ref.children, | ||
row = _ref.row, | ||
tableRow = _ref.tableRow, | ||
rest = _objectWithoutProperties(_ref, ['children', 'row', 'tableRow']); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
return _react2.default.createElement( | ||
_TableRow.TableRow, | ||
_extends({ | ||
tableContext: 'row-edit', | ||
ref: function ref(_ref2) { | ||
if (_ref2) { | ||
var items = (0, _reactDom.findDOMNode)(_ref2).getElementsByTagName('*'); | ||
items = (0, _DOM.filterByFocusable)(items); | ||
var focusables = items.filter(function (item) { | ||
return ['button', 'a'].indexOf(item.localName) === -1 && !item.disabled; | ||
}); | ||
if (focusables.length > 0) { | ||
setTimeout(function () { | ||
focusables[0].focus(); | ||
}, 0); | ||
} | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* | ||
Copyright 2019 Atanas Stoyanov | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
var TableEditRow = exports.TableEditRow = function (_React$Component) { | ||
_inherits(TableEditRow, _React$Component); | ||
function TableEditRow(props) { | ||
_classCallCheck(this, TableEditRow); | ||
var _this = _possibleConstructorReturn(this, (TableEditRow.__proto__ || Object.getPrototypeOf(TableEditRow)).call(this, props)); | ||
_this.textInput = null; | ||
_this.focusFirstCell = function (element) { | ||
// Focus the text input using the raw DOM API | ||
if (element && _this.textInput === null) { | ||
_this.textInput = element; | ||
var items = (0, _reactDom.findDOMNode)(element).getElementsByTagName('*'); | ||
items = (0, _DOM.filterByFocusable)(items); | ||
var focusables = items.filter(function (item) { | ||
return ['button', 'a'].indexOf(item.localName) === -1 && !item.disabled; | ||
}); | ||
if (focusables.length > 0) { | ||
setTimeout(function () { | ||
focusables[0].focus(); | ||
}, 0); | ||
} | ||
} | ||
}, rest), | ||
children | ||
); | ||
}; | ||
}; | ||
return _this; | ||
} | ||
exports.TableEditRow = TableEditRow; | ||
_createClass(TableEditRow, [{ | ||
key: 'render', | ||
value: function render() { | ||
var _props = this.props, | ||
children = _props.children, | ||
row = _props.row, | ||
tableRow = _props.tableRow, | ||
rest = _objectWithoutProperties(_props, ['children', 'row', 'tableRow']); | ||
return _react2.default.createElement( | ||
_TableRow.TableRow, | ||
_extends({ | ||
tableContext: 'row-edit', | ||
ref: this.focusFirstCell | ||
}, rest), | ||
children | ||
); | ||
} | ||
}]); | ||
return TableEditRow; | ||
}(_react2.default.Component); | ||
TableEditRow.propTypes = { | ||
@@ -75,0 +105,0 @@ children: _propTypes2.default.node, |
{ | ||
"name": "dx-react-grid-grommet", | ||
"version": "1.0.16", | ||
"version": "1.0.17", | ||
"main": "index.js", | ||
@@ -33,3 +33,3 @@ "module": "es6/index.js", | ||
"check": "./node_modules/.bin/eslint .", | ||
"pub": "pushd ./ && npm run build && cd dist && npm publish && popd" | ||
"pub": "cd ./ && npm run build && cd dist && npm publish && cd .." | ||
}, | ||
@@ -36,0 +36,0 @@ "peerDependencies": { |
@@ -211,2 +211,14 @@ 'use strict'; | ||
var _tableInlineCellEditing = require('./table-inline-cell-editing'); | ||
Object.keys(_tableInlineCellEditing).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function get() { | ||
return _tableInlineCellEditing[key]; | ||
} | ||
}); | ||
}); | ||
var _tableRowDetail = require('./table-row-detail'); | ||
@@ -213,0 +225,0 @@ |
@@ -50,4 +50,15 @@ 'use strict'; | ||
editingEnabled = _ref.editingEnabled, | ||
restProps = _objectWithoutProperties(_ref, ['column', 'value', 'onValueChange', 'style', 'children', 'row', 'tableRow', 'tableColumn', 'editingEnabled']); | ||
autoFocus = _ref.autoFocus, | ||
onBlur = _ref.onBlur, | ||
onFocus = _ref.onFocus, | ||
onKeyDown = _ref.onKeyDown, | ||
restProps = _objectWithoutProperties(_ref, ['column', 'value', 'onValueChange', 'style', 'children', 'row', 'tableRow', 'tableColumn', 'editingEnabled', 'autoFocus', 'onBlur', 'onFocus', 'onKeyDown']); | ||
var patchedChildren = children ? _react2.default.cloneElement(children, { | ||
autoFocus: autoFocus, | ||
onBlur: onBlur, | ||
onFocus: onFocus, | ||
onKeyDown: onKeyDown | ||
}) : children; | ||
return _react2.default.createElement( | ||
@@ -60,10 +71,14 @@ _TableCell.TableCell, | ||
}, restProps), | ||
children || _react2.default.createElement(_grommet.TextInput, { | ||
patchedChildren || _react2.default.createElement(_grommet.TextInput, { | ||
plain: true, | ||
focusIndicator: true, | ||
value: value || '', | ||
value: value === undefined || value === null ? '' : value, | ||
disabled: !editingEnabled, | ||
onChange: function onChange(e) { | ||
return onValueChange(e.target.value); | ||
} | ||
}, | ||
autoFocus: autoFocus, | ||
onBlur: onBlur, | ||
onFocus: onFocus, | ||
onKeyDown: onKeyDown | ||
}) | ||
@@ -83,3 +98,7 @@ ); | ||
editingEnabled: _propTypes2.default.bool, | ||
children: _propTypes2.default.node | ||
children: _propTypes2.default.node, | ||
autoFocus: _propTypes2.default.bool, | ||
onBlur: _propTypes2.default.func, | ||
onFocus: _propTypes2.default.func, | ||
onKeyDown: _propTypes2.default.func | ||
}; | ||
@@ -95,3 +114,7 @@ | ||
children: undefined, | ||
editingEnabled: true | ||
editingEnabled: true, | ||
autoFocus: false, | ||
onBlur: function onBlur() {}, | ||
onFocus: function onFocus() {}, | ||
onKeyDown: function onKeyDown() {} | ||
}; |
@@ -10,2 +10,4 @@ 'use strict'; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _react = require('react'); | ||
@@ -27,48 +29,76 @@ | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } /* | ||
Copyright 2019 Atanas Stoyanov | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
var TableEditRow = function TableEditRow(_ref) { | ||
var children = _ref.children, | ||
row = _ref.row, | ||
tableRow = _ref.tableRow, | ||
rest = _objectWithoutProperties(_ref, ['children', 'row', 'tableRow']); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
return _react2.default.createElement( | ||
_TableRow.TableRow, | ||
_extends({ | ||
tableContext: 'row-edit', | ||
ref: function ref(_ref2) { | ||
if (_ref2) { | ||
var items = (0, _reactDom.findDOMNode)(_ref2).getElementsByTagName('*'); | ||
items = (0, _DOM.filterByFocusable)(items); | ||
var focusables = items.filter(function (item) { | ||
return ['button', 'a'].indexOf(item.localName) === -1 && !item.disabled; | ||
}); | ||
if (focusables.length > 0) { | ||
setTimeout(function () { | ||
focusables[0].focus(); | ||
}, 0); | ||
} | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* | ||
Copyright 2019 Atanas Stoyanov | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
var TableEditRow = exports.TableEditRow = function (_React$Component) { | ||
_inherits(TableEditRow, _React$Component); | ||
function TableEditRow(props) { | ||
_classCallCheck(this, TableEditRow); | ||
var _this = _possibleConstructorReturn(this, (TableEditRow.__proto__ || Object.getPrototypeOf(TableEditRow)).call(this, props)); | ||
_this.textInput = null; | ||
_this.focusFirstCell = function (element) { | ||
// Focus the text input using the raw DOM API | ||
if (element && _this.textInput === null) { | ||
_this.textInput = element; | ||
var items = (0, _reactDom.findDOMNode)(element).getElementsByTagName('*'); | ||
items = (0, _DOM.filterByFocusable)(items); | ||
var focusables = items.filter(function (item) { | ||
return ['button', 'a'].indexOf(item.localName) === -1 && !item.disabled; | ||
}); | ||
if (focusables.length > 0) { | ||
setTimeout(function () { | ||
focusables[0].focus(); | ||
}, 0); | ||
} | ||
} | ||
}, rest), | ||
children | ||
); | ||
}; | ||
}; | ||
return _this; | ||
} | ||
exports.TableEditRow = TableEditRow; | ||
_createClass(TableEditRow, [{ | ||
key: 'render', | ||
value: function render() { | ||
var _props = this.props, | ||
children = _props.children, | ||
row = _props.row, | ||
tableRow = _props.tableRow, | ||
rest = _objectWithoutProperties(_props, ['children', 'row', 'tableRow']); | ||
return _react2.default.createElement( | ||
_TableRow.TableRow, | ||
_extends({ | ||
tableContext: 'row-edit', | ||
ref: this.focusFirstCell | ||
}, rest), | ||
children | ||
); | ||
} | ||
}]); | ||
return TableEditRow; | ||
}(_react2.default.Component); | ||
TableEditRow.propTypes = { | ||
@@ -75,0 +105,0 @@ children: _propTypes2.default.node, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
5616740
208
15336
1