@handsontable/react 0.0.0-next-d26e81f-20231213 → 0.0.0-next-ae2e00f-20231213
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commonjs/react-handsontable.js +121 -113
- package/dist/react-handsontable.js +122 -114
- package/dist/react-handsontable.js.map +1 -1
- package/dist/react-handsontable.min.js +2 -2
- package/dist/react-handsontable.min.js.map +1 -1
- package/es/react-handsontable.mjs +122 -114
- package/helpers.d.ts +1 -7
- package/hotColumn.d.ts +40 -15
- package/hotTable.d.ts +1 -1
- package/package.json +10 -10
- package/types.d.ts +14 -0
- package/Test.d.ts +0 -2
|
@@ -12,33 +12,6 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
12
12
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
13
13
|
var Handsontable__default = /*#__PURE__*/_interopDefaultLegacy(Handsontable);
|
|
14
14
|
|
|
15
|
-
function _iterableToArrayLimit(r, l) {
|
|
16
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
17
|
-
if (null != t) {
|
|
18
|
-
var e,
|
|
19
|
-
n,
|
|
20
|
-
i,
|
|
21
|
-
u,
|
|
22
|
-
a = [],
|
|
23
|
-
f = !0,
|
|
24
|
-
o = !1;
|
|
25
|
-
try {
|
|
26
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
27
|
-
if (Object(t) !== t) return;
|
|
28
|
-
f = !1;
|
|
29
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
30
|
-
} catch (r) {
|
|
31
|
-
o = !0, n = r;
|
|
32
|
-
} finally {
|
|
33
|
-
try {
|
|
34
|
-
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
35
|
-
} finally {
|
|
36
|
-
if (o) throw n;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return a;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
15
|
function ownKeys(e, r) {
|
|
43
16
|
var t = Object.keys(e);
|
|
44
17
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -60,20 +33,6 @@ function _objectSpread2(e) {
|
|
|
60
33
|
}
|
|
61
34
|
return e;
|
|
62
35
|
}
|
|
63
|
-
function _toPrimitive(t, r) {
|
|
64
|
-
if ("object" != typeof t || !t) return t;
|
|
65
|
-
var e = t[Symbol.toPrimitive];
|
|
66
|
-
if (void 0 !== e) {
|
|
67
|
-
var i = e.call(t, r || "default");
|
|
68
|
-
if ("object" != typeof i) return i;
|
|
69
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
70
|
-
}
|
|
71
|
-
return ("string" === r ? String : Number)(t);
|
|
72
|
-
}
|
|
73
|
-
function _toPropertyKey(t) {
|
|
74
|
-
var i = _toPrimitive(t, "string");
|
|
75
|
-
return "symbol" == typeof i ? i : String(i);
|
|
76
|
-
}
|
|
77
36
|
function _typeof(o) {
|
|
78
37
|
"@babel/helpers - typeof";
|
|
79
38
|
|
|
@@ -187,18 +146,12 @@ function _createSuper(Derived) {
|
|
|
187
146
|
return _possibleConstructorReturn(this, result);
|
|
188
147
|
};
|
|
189
148
|
}
|
|
190
|
-
function _slicedToArray(arr, i) {
|
|
191
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
192
|
-
}
|
|
193
149
|
function _toConsumableArray(arr) {
|
|
194
150
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
195
151
|
}
|
|
196
152
|
function _arrayWithoutHoles(arr) {
|
|
197
153
|
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
198
154
|
}
|
|
199
|
-
function _arrayWithHoles(arr) {
|
|
200
|
-
if (Array.isArray(arr)) return arr;
|
|
201
|
-
}
|
|
202
155
|
function _iterableToArray(iter) {
|
|
203
156
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
204
157
|
}
|
|
@@ -218,12 +171,22 @@ function _arrayLikeToArray(arr, len) {
|
|
|
218
171
|
function _nonIterableSpread() {
|
|
219
172
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
220
173
|
}
|
|
221
|
-
function
|
|
222
|
-
|
|
174
|
+
function _toPrimitive(input, hint) {
|
|
175
|
+
if (typeof input !== "object" || input === null) return input;
|
|
176
|
+
var prim = input[Symbol.toPrimitive];
|
|
177
|
+
if (prim !== undefined) {
|
|
178
|
+
var res = prim.call(input, hint || "default");
|
|
179
|
+
if (typeof res !== "object") return res;
|
|
180
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
181
|
+
}
|
|
182
|
+
return (hint === "string" ? String : Number)(input);
|
|
183
|
+
}
|
|
184
|
+
function _toPropertyKey(arg) {
|
|
185
|
+
var key = _toPrimitive(arg, "string");
|
|
186
|
+
return typeof key === "symbol" ? key : String(key);
|
|
223
187
|
}
|
|
224
188
|
|
|
225
189
|
var bulkComponentContainer = null;
|
|
226
|
-
var hasIdWarningBeenPrinted = false;
|
|
227
190
|
/**
|
|
228
191
|
* Warning message for the `autoRowSize`/`autoColumnSize` compatibility check.
|
|
229
192
|
*/
|
|
@@ -288,12 +251,14 @@ function getOriginalEditorClass(editorElement) {
|
|
|
288
251
|
/**
|
|
289
252
|
* Create an editor portal.
|
|
290
253
|
*
|
|
291
|
-
* @param {Document} doc Document to be used.
|
|
254
|
+
* @param {Document} [doc] Document to be used.
|
|
292
255
|
* @param {React.ReactElement} editorElement Editor's element.
|
|
293
256
|
* @returns {React.ReactPortal} The portal for the editor.
|
|
294
257
|
*/
|
|
295
|
-
function createEditorPortal(
|
|
296
|
-
|
|
258
|
+
function createEditorPortal() {
|
|
259
|
+
var doc = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
|
260
|
+
var editorElement = arguments.length > 1 ? arguments[1] : undefined;
|
|
261
|
+
if (editorElement === null) {
|
|
297
262
|
return null;
|
|
298
263
|
}
|
|
299
264
|
var containerProps = getContainerAttributesProps(editorElement.props, false);
|
|
@@ -365,47 +330,12 @@ function createPortal(rElement, props) {
|
|
|
365
330
|
*/
|
|
366
331
|
function getContainerAttributesProps(props) {
|
|
367
332
|
var randomizeId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
368
|
-
if (!hasIdWarningBeenPrinted && !props.id && randomizeId) {
|
|
369
|
-
hasIdWarningBeenPrinted = true;
|
|
370
|
-
warn('You have to provide an `id` property for the `HotTable` component.');
|
|
371
|
-
}
|
|
372
333
|
return {
|
|
373
334
|
id: props.id || (randomizeId ? 'hot-' + Math.random().toString(36).substring(5) : void 0),
|
|
374
335
|
className: props.className || '',
|
|
375
336
|
style: props.style || {}
|
|
376
337
|
};
|
|
377
338
|
}
|
|
378
|
-
/**
|
|
379
|
-
* Checks if the environment that the code runs in is a browser.
|
|
380
|
-
*
|
|
381
|
-
* @returns {boolean}
|
|
382
|
-
*/
|
|
383
|
-
function isCSR() {
|
|
384
|
-
return typeof window !== 'undefined';
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
var HotColumn = function HotColumn(props) {
|
|
388
|
-
var _useState = React.useState(getExtendedEditorElement(props.children, props.getEditorCache(), props.columnIndex)),
|
|
389
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
390
|
-
editorElement = _useState2[0],
|
|
391
|
-
setEditorElement = _useState2[1];
|
|
392
|
-
React.useEffect(function () {
|
|
393
|
-
var rendererElement = props.getChildElementByType(props.children, "hot-renderer");
|
|
394
|
-
setEditorElement(getExtendedEditorElement(props.children, props.getEditorCache(), props.columnIndex));
|
|
395
|
-
var columnSettings = {};
|
|
396
|
-
if (rendererElement !== null) {
|
|
397
|
-
columnSettings.renderer = props.getRendererWrapper(rendererElement);
|
|
398
|
-
props.componentRendererColumns.set(props.columnIndex, true);
|
|
399
|
-
}
|
|
400
|
-
if (editorElement !== null) {
|
|
401
|
-
columnSettings.editor = props.getEditorClass(editorElement, props.columnIndex);
|
|
402
|
-
}
|
|
403
|
-
props.onColumnSettingsChange(columnSettings, props.columnIndex);
|
|
404
|
-
}, [props.getChildElementByType, props.children, props.columnIndex, props.getRendererWrapper, props.componentRendererColumns, props.getEditorCache]);
|
|
405
|
-
var ownerDocument = props.getOwnerDocument();
|
|
406
|
-
var editorPortal = createEditorPortal(ownerDocument, editorElement);
|
|
407
|
-
return React__default["default"].createElement(React__default["default"].Fragment, null, editorPortal);
|
|
408
|
-
};
|
|
409
339
|
|
|
410
340
|
var SettingsMapper = /*#__PURE__*/function () {
|
|
411
341
|
function SettingsMapper() {
|
|
@@ -441,6 +371,105 @@ var SettingsMapper = /*#__PURE__*/function () {
|
|
|
441
371
|
return SettingsMapper;
|
|
442
372
|
}();
|
|
443
373
|
|
|
374
|
+
var HotColumn = /*#__PURE__*/function (_React$Component) {
|
|
375
|
+
_inherits(HotColumn, _React$Component);
|
|
376
|
+
var _super = _createSuper(HotColumn);
|
|
377
|
+
function HotColumn() {
|
|
378
|
+
_classCallCheck(this, HotColumn);
|
|
379
|
+
return _super.apply(this, arguments);
|
|
380
|
+
}
|
|
381
|
+
_createClass(HotColumn, [{
|
|
382
|
+
key: "getSettingsProps",
|
|
383
|
+
value:
|
|
384
|
+
/**
|
|
385
|
+
* Filter out all the internal properties and return an object with just the Handsontable-related props.
|
|
386
|
+
*
|
|
387
|
+
* @returns {Object}
|
|
388
|
+
*/
|
|
389
|
+
function getSettingsProps() {
|
|
390
|
+
var _this = this;
|
|
391
|
+
this.internalProps = ['_componentRendererColumns', '_emitColumnSettings', '_columnIndex', '_getChildElementByType', '_getRendererWrapper', '_getEditorClass', '_getEditorCache', '_getOwnerDocument', 'hot-renderer', 'hot-editor', 'children'];
|
|
392
|
+
return Object.keys(this.props).filter(function (key) {
|
|
393
|
+
return !_this.internalProps.includes(key);
|
|
394
|
+
}).reduce(function (obj, key) {
|
|
395
|
+
obj[key] = _this.props[key];
|
|
396
|
+
return obj;
|
|
397
|
+
}, {});
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Get the editor element for the current column.
|
|
401
|
+
*
|
|
402
|
+
* @returns {React.ReactElement} React editor component element.
|
|
403
|
+
*/
|
|
404
|
+
}, {
|
|
405
|
+
key: "getLocalEditorElement",
|
|
406
|
+
value: function getLocalEditorElement() {
|
|
407
|
+
return getExtendedEditorElement(this.props.children, this.props._getEditorCache(), this.props._columnIndex);
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Create the column settings based on the data provided to the `HotColumn` component and it's child components.
|
|
411
|
+
*/
|
|
412
|
+
}, {
|
|
413
|
+
key: "createColumnSettings",
|
|
414
|
+
value: function createColumnSettings() {
|
|
415
|
+
var rendererElement = this.props._getChildElementByType(this.props.children, 'hot-renderer');
|
|
416
|
+
var editorElement = this.getLocalEditorElement();
|
|
417
|
+
this.columnSettings = SettingsMapper.getSettings(this.getSettingsProps());
|
|
418
|
+
if (rendererElement !== null) {
|
|
419
|
+
this.columnSettings.renderer = this.props._getRendererWrapper(rendererElement);
|
|
420
|
+
this.props._componentRendererColumns.set(this.props._columnIndex, true);
|
|
421
|
+
}
|
|
422
|
+
if (editorElement !== null) {
|
|
423
|
+
this.columnSettings.editor = this.props._getEditorClass(editorElement, this.props._columnIndex);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Emit the column settings to the parent using a prop passed from the parent.
|
|
428
|
+
*/
|
|
429
|
+
}, {
|
|
430
|
+
key: "emitColumnSettings",
|
|
431
|
+
value: function emitColumnSettings() {
|
|
432
|
+
this.props._emitColumnSettings(this.columnSettings, this.props._columnIndex);
|
|
433
|
+
}
|
|
434
|
+
/*
|
|
435
|
+
---------------------------------------
|
|
436
|
+
------- React lifecycle methods -------
|
|
437
|
+
---------------------------------------
|
|
438
|
+
*/
|
|
439
|
+
/**
|
|
440
|
+
* Logic performed after the mounting of the HotColumn component.
|
|
441
|
+
*/
|
|
442
|
+
}, {
|
|
443
|
+
key: "componentDidMount",
|
|
444
|
+
value: function componentDidMount() {
|
|
445
|
+
this.createColumnSettings();
|
|
446
|
+
this.emitColumnSettings();
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Logic performed after the updating of the HotColumn component.
|
|
450
|
+
*/
|
|
451
|
+
}, {
|
|
452
|
+
key: "componentDidUpdate",
|
|
453
|
+
value: function componentDidUpdate() {
|
|
454
|
+
this.createColumnSettings();
|
|
455
|
+
this.emitColumnSettings();
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Render the portals of the editors, if there are any.
|
|
459
|
+
*
|
|
460
|
+
* @returns {React.ReactElement}
|
|
461
|
+
*/
|
|
462
|
+
}, {
|
|
463
|
+
key: "render",
|
|
464
|
+
value: function render() {
|
|
465
|
+
var ownerDocument = this.props._getOwnerDocument();
|
|
466
|
+
var editorPortal = createEditorPortal(ownerDocument, this.getLocalEditorElement());
|
|
467
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null, editorPortal);
|
|
468
|
+
}
|
|
469
|
+
}]);
|
|
470
|
+
return HotColumn;
|
|
471
|
+
}(React__default["default"].Component);
|
|
472
|
+
|
|
444
473
|
/**
|
|
445
474
|
* Component class used to manage the renderer component portals.
|
|
446
475
|
*/
|
|
@@ -465,7 +494,7 @@ var RenderersPortalManager = /*#__PURE__*/function (_React$Component) {
|
|
|
465
494
|
return RenderersPortalManager;
|
|
466
495
|
}(React__default["default"].Component);
|
|
467
496
|
|
|
468
|
-
var version="0.0.0-next-
|
|
497
|
+
var version="0.0.0-next-ae2e00f-20231213";
|
|
469
498
|
|
|
470
499
|
function createCommonjsModule(fn, module) {
|
|
471
500
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
@@ -1586,13 +1615,6 @@ var propTypes = createCommonjsModule(function (module) {
|
|
|
1586
1615
|
});
|
|
1587
1616
|
var PropTypes = propTypes;
|
|
1588
1617
|
|
|
1589
|
-
var Test = function Test() {
|
|
1590
|
-
React.useEffect(function () {
|
|
1591
|
-
console.log("hello world");
|
|
1592
|
-
}, []);
|
|
1593
|
-
return React__default["default"].createElement("div", null);
|
|
1594
|
-
};
|
|
1595
|
-
|
|
1596
1618
|
/**
|
|
1597
1619
|
* A Handsontable-ReactJS wrapper.
|
|
1598
1620
|
*
|
|
@@ -1745,10 +1767,7 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
1745
1767
|
}, {
|
|
1746
1768
|
key: "getOwnerDocument",
|
|
1747
1769
|
value: function getOwnerDocument() {
|
|
1748
|
-
|
|
1749
|
-
return this.hotElementRef ? this.hotElementRef.ownerDocument : document;
|
|
1750
|
-
}
|
|
1751
|
-
return null;
|
|
1770
|
+
return this.hotElementRef ? this.hotElementRef.ownerDocument : document;
|
|
1752
1771
|
}
|
|
1753
1772
|
/**
|
|
1754
1773
|
* Set the reference to the main Handsontable DOM element.
|
|
@@ -2035,6 +2054,7 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
2035
2054
|
key: "render",
|
|
2036
2055
|
value: function render() {
|
|
2037
2056
|
var _this5 = this;
|
|
2057
|
+
var containerProps = getContainerAttributesProps(this.props);
|
|
2038
2058
|
var isHotColumn = function isHotColumn(childNode) {
|
|
2039
2059
|
return childNode.type === HotColumn;
|
|
2040
2060
|
};
|
|
@@ -2043,17 +2063,6 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
2043
2063
|
var hotColumnClones = children.filter(function (childNode) {
|
|
2044
2064
|
return isHotColumn(childNode);
|
|
2045
2065
|
}).map(function (childNode, columnIndex) {
|
|
2046
|
-
({
|
|
2047
|
-
columnIndex: columnIndex,
|
|
2048
|
-
children: childNode.props.children,
|
|
2049
|
-
onColumnSettingsChange: _this5.setHotColumnSettings.bind(_this5),
|
|
2050
|
-
componentRendererColumns: _this5.componentRendererColumns,
|
|
2051
|
-
getChildElementByType: getChildElementByType.bind(_this5),
|
|
2052
|
-
getRendererWrapper: _this5.getEditorClass.bind(_this5),
|
|
2053
|
-
getEditorClass: _this5.getEditorClass.bind(_this5),
|
|
2054
|
-
getEditorCache: _this5.getEditorCache.bind(_this5),
|
|
2055
|
-
getOwnerDocument: _this5.getOwnerDocument.bind(_this5)
|
|
2056
|
-
});
|
|
2057
2066
|
return React__default["default"].cloneElement(childNode, {
|
|
2058
2067
|
_componentRendererColumns: _this5.componentRendererColumns,
|
|
2059
2068
|
_emitColumnSettings: _this5.setHotColumnSettings.bind(_this5),
|
|
@@ -2066,13 +2075,12 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
2066
2075
|
children: childNode.props.children
|
|
2067
2076
|
});
|
|
2068
2077
|
});
|
|
2069
|
-
var containerProps = getContainerAttributesProps(this.props);
|
|
2070
2078
|
var editorPortal = createEditorPortal(this.getOwnerDocument(), this.getGlobalEditorElement());
|
|
2071
2079
|
return React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement("div", Object.assign({
|
|
2072
2080
|
ref: this.setHotElementRef.bind(this)
|
|
2073
2081
|
}, containerProps), hotColumnClones), React__default["default"].createElement(RenderersPortalManager, {
|
|
2074
2082
|
ref: this.setRenderersPortalManagerRef.bind(this)
|
|
2075
|
-
}), editorPortal
|
|
2083
|
+
}), editorPortal);
|
|
2076
2084
|
}
|
|
2077
2085
|
}], [{
|
|
2078
2086
|
key: "version",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING FROM
|
|
26
26
|
* USE OR INABILITY TO USE THIS SOFTWARE.
|
|
27
27
|
*
|
|
28
|
-
* Version: 0.0.0-next-
|
|
28
|
+
* Version: 0.0.0-next-ae2e00f-20231213 (built at Wed Dec 13 2023 14:07:04 GMT+0000 (Coordinated Universal Time))
|
|
29
29
|
*/
|
|
30
30
|
(function (global, factory) {
|
|
31
31
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-dom'), require('handsontable/base')) :
|
|
@@ -39,33 +39,6 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
39
39
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
40
40
|
var Handsontable__default = /*#__PURE__*/_interopDefaultLegacy(Handsontable);
|
|
41
41
|
|
|
42
|
-
function _iterableToArrayLimit(r, l) {
|
|
43
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
44
|
-
if (null != t) {
|
|
45
|
-
var e,
|
|
46
|
-
n,
|
|
47
|
-
i,
|
|
48
|
-
u,
|
|
49
|
-
a = [],
|
|
50
|
-
f = !0,
|
|
51
|
-
o = !1;
|
|
52
|
-
try {
|
|
53
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
54
|
-
if (Object(t) !== t) return;
|
|
55
|
-
f = !1;
|
|
56
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
57
|
-
} catch (r) {
|
|
58
|
-
o = !0, n = r;
|
|
59
|
-
} finally {
|
|
60
|
-
try {
|
|
61
|
-
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
62
|
-
} finally {
|
|
63
|
-
if (o) throw n;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return a;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
42
|
function ownKeys(e, r) {
|
|
70
43
|
var t = Object.keys(e);
|
|
71
44
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -87,20 +60,6 @@ function _objectSpread2(e) {
|
|
|
87
60
|
}
|
|
88
61
|
return e;
|
|
89
62
|
}
|
|
90
|
-
function _toPrimitive(t, r) {
|
|
91
|
-
if ("object" != typeof t || !t) return t;
|
|
92
|
-
var e = t[Symbol.toPrimitive];
|
|
93
|
-
if (void 0 !== e) {
|
|
94
|
-
var i = e.call(t, r || "default");
|
|
95
|
-
if ("object" != typeof i) return i;
|
|
96
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
97
|
-
}
|
|
98
|
-
return ("string" === r ? String : Number)(t);
|
|
99
|
-
}
|
|
100
|
-
function _toPropertyKey(t) {
|
|
101
|
-
var i = _toPrimitive(t, "string");
|
|
102
|
-
return "symbol" == typeof i ? i : String(i);
|
|
103
|
-
}
|
|
104
63
|
function _typeof(o) {
|
|
105
64
|
"@babel/helpers - typeof";
|
|
106
65
|
|
|
@@ -214,18 +173,12 @@ function _createSuper(Derived) {
|
|
|
214
173
|
return _possibleConstructorReturn(this, result);
|
|
215
174
|
};
|
|
216
175
|
}
|
|
217
|
-
function _slicedToArray(arr, i) {
|
|
218
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
219
|
-
}
|
|
220
176
|
function _toConsumableArray(arr) {
|
|
221
177
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
222
178
|
}
|
|
223
179
|
function _arrayWithoutHoles(arr) {
|
|
224
180
|
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
225
181
|
}
|
|
226
|
-
function _arrayWithHoles(arr) {
|
|
227
|
-
if (Array.isArray(arr)) return arr;
|
|
228
|
-
}
|
|
229
182
|
function _iterableToArray(iter) {
|
|
230
183
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
231
184
|
}
|
|
@@ -245,12 +198,22 @@ function _arrayLikeToArray(arr, len) {
|
|
|
245
198
|
function _nonIterableSpread() {
|
|
246
199
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
247
200
|
}
|
|
248
|
-
function
|
|
249
|
-
|
|
201
|
+
function _toPrimitive(input, hint) {
|
|
202
|
+
if (typeof input !== "object" || input === null) return input;
|
|
203
|
+
var prim = input[Symbol.toPrimitive];
|
|
204
|
+
if (prim !== undefined) {
|
|
205
|
+
var res = prim.call(input, hint || "default");
|
|
206
|
+
if (typeof res !== "object") return res;
|
|
207
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
208
|
+
}
|
|
209
|
+
return (hint === "string" ? String : Number)(input);
|
|
210
|
+
}
|
|
211
|
+
function _toPropertyKey(arg) {
|
|
212
|
+
var key = _toPrimitive(arg, "string");
|
|
213
|
+
return typeof key === "symbol" ? key : String(key);
|
|
250
214
|
}
|
|
251
215
|
|
|
252
216
|
var bulkComponentContainer = null;
|
|
253
|
-
var hasIdWarningBeenPrinted = false;
|
|
254
217
|
/**
|
|
255
218
|
* Warning message for the `autoRowSize`/`autoColumnSize` compatibility check.
|
|
256
219
|
*/
|
|
@@ -315,12 +278,14 @@ function getOriginalEditorClass(editorElement) {
|
|
|
315
278
|
/**
|
|
316
279
|
* Create an editor portal.
|
|
317
280
|
*
|
|
318
|
-
* @param {Document} doc Document to be used.
|
|
281
|
+
* @param {Document} [doc] Document to be used.
|
|
319
282
|
* @param {React.ReactElement} editorElement Editor's element.
|
|
320
283
|
* @returns {React.ReactPortal} The portal for the editor.
|
|
321
284
|
*/
|
|
322
|
-
function createEditorPortal(
|
|
323
|
-
|
|
285
|
+
function createEditorPortal() {
|
|
286
|
+
var doc = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
|
287
|
+
var editorElement = arguments.length > 1 ? arguments[1] : undefined;
|
|
288
|
+
if (editorElement === null) {
|
|
324
289
|
return null;
|
|
325
290
|
}
|
|
326
291
|
var containerProps = getContainerAttributesProps(editorElement.props, false);
|
|
@@ -392,47 +357,12 @@ function createPortal(rElement, props) {
|
|
|
392
357
|
*/
|
|
393
358
|
function getContainerAttributesProps(props) {
|
|
394
359
|
var randomizeId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
395
|
-
if (!hasIdWarningBeenPrinted && !props.id && randomizeId) {
|
|
396
|
-
hasIdWarningBeenPrinted = true;
|
|
397
|
-
warn('You have to provide an `id` property for the `HotTable` component.');
|
|
398
|
-
}
|
|
399
360
|
return {
|
|
400
361
|
id: props.id || (randomizeId ? 'hot-' + Math.random().toString(36).substring(5) : void 0),
|
|
401
362
|
className: props.className || '',
|
|
402
363
|
style: props.style || {}
|
|
403
364
|
};
|
|
404
365
|
}
|
|
405
|
-
/**
|
|
406
|
-
* Checks if the environment that the code runs in is a browser.
|
|
407
|
-
*
|
|
408
|
-
* @returns {boolean}
|
|
409
|
-
*/
|
|
410
|
-
function isCSR() {
|
|
411
|
-
return typeof window !== 'undefined';
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
var HotColumn = function HotColumn(props) {
|
|
415
|
-
var _useState = React.useState(getExtendedEditorElement(props.children, props.getEditorCache(), props.columnIndex)),
|
|
416
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
417
|
-
editorElement = _useState2[0],
|
|
418
|
-
setEditorElement = _useState2[1];
|
|
419
|
-
React.useEffect(function () {
|
|
420
|
-
var rendererElement = props.getChildElementByType(props.children, "hot-renderer");
|
|
421
|
-
setEditorElement(getExtendedEditorElement(props.children, props.getEditorCache(), props.columnIndex));
|
|
422
|
-
var columnSettings = {};
|
|
423
|
-
if (rendererElement !== null) {
|
|
424
|
-
columnSettings.renderer = props.getRendererWrapper(rendererElement);
|
|
425
|
-
props.componentRendererColumns.set(props.columnIndex, true);
|
|
426
|
-
}
|
|
427
|
-
if (editorElement !== null) {
|
|
428
|
-
columnSettings.editor = props.getEditorClass(editorElement, props.columnIndex);
|
|
429
|
-
}
|
|
430
|
-
props.onColumnSettingsChange(columnSettings, props.columnIndex);
|
|
431
|
-
}, [props.getChildElementByType, props.children, props.columnIndex, props.getRendererWrapper, props.componentRendererColumns, props.getEditorCache]);
|
|
432
|
-
var ownerDocument = props.getOwnerDocument();
|
|
433
|
-
var editorPortal = createEditorPortal(ownerDocument, editorElement);
|
|
434
|
-
return React__default["default"].createElement(React__default["default"].Fragment, null, editorPortal);
|
|
435
|
-
};
|
|
436
366
|
|
|
437
367
|
var SettingsMapper = /*#__PURE__*/function () {
|
|
438
368
|
function SettingsMapper() {
|
|
@@ -468,6 +398,105 @@ var SettingsMapper = /*#__PURE__*/function () {
|
|
|
468
398
|
return SettingsMapper;
|
|
469
399
|
}();
|
|
470
400
|
|
|
401
|
+
var HotColumn = /*#__PURE__*/function (_React$Component) {
|
|
402
|
+
_inherits(HotColumn, _React$Component);
|
|
403
|
+
var _super = _createSuper(HotColumn);
|
|
404
|
+
function HotColumn() {
|
|
405
|
+
_classCallCheck(this, HotColumn);
|
|
406
|
+
return _super.apply(this, arguments);
|
|
407
|
+
}
|
|
408
|
+
_createClass(HotColumn, [{
|
|
409
|
+
key: "getSettingsProps",
|
|
410
|
+
value:
|
|
411
|
+
/**
|
|
412
|
+
* Filter out all the internal properties and return an object with just the Handsontable-related props.
|
|
413
|
+
*
|
|
414
|
+
* @returns {Object}
|
|
415
|
+
*/
|
|
416
|
+
function getSettingsProps() {
|
|
417
|
+
var _this = this;
|
|
418
|
+
this.internalProps = ['_componentRendererColumns', '_emitColumnSettings', '_columnIndex', '_getChildElementByType', '_getRendererWrapper', '_getEditorClass', '_getEditorCache', '_getOwnerDocument', 'hot-renderer', 'hot-editor', 'children'];
|
|
419
|
+
return Object.keys(this.props).filter(function (key) {
|
|
420
|
+
return !_this.internalProps.includes(key);
|
|
421
|
+
}).reduce(function (obj, key) {
|
|
422
|
+
obj[key] = _this.props[key];
|
|
423
|
+
return obj;
|
|
424
|
+
}, {});
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Get the editor element for the current column.
|
|
428
|
+
*
|
|
429
|
+
* @returns {React.ReactElement} React editor component element.
|
|
430
|
+
*/
|
|
431
|
+
}, {
|
|
432
|
+
key: "getLocalEditorElement",
|
|
433
|
+
value: function getLocalEditorElement() {
|
|
434
|
+
return getExtendedEditorElement(this.props.children, this.props._getEditorCache(), this.props._columnIndex);
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Create the column settings based on the data provided to the `HotColumn` component and it's child components.
|
|
438
|
+
*/
|
|
439
|
+
}, {
|
|
440
|
+
key: "createColumnSettings",
|
|
441
|
+
value: function createColumnSettings() {
|
|
442
|
+
var rendererElement = this.props._getChildElementByType(this.props.children, 'hot-renderer');
|
|
443
|
+
var editorElement = this.getLocalEditorElement();
|
|
444
|
+
this.columnSettings = SettingsMapper.getSettings(this.getSettingsProps());
|
|
445
|
+
if (rendererElement !== null) {
|
|
446
|
+
this.columnSettings.renderer = this.props._getRendererWrapper(rendererElement);
|
|
447
|
+
this.props._componentRendererColumns.set(this.props._columnIndex, true);
|
|
448
|
+
}
|
|
449
|
+
if (editorElement !== null) {
|
|
450
|
+
this.columnSettings.editor = this.props._getEditorClass(editorElement, this.props._columnIndex);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Emit the column settings to the parent using a prop passed from the parent.
|
|
455
|
+
*/
|
|
456
|
+
}, {
|
|
457
|
+
key: "emitColumnSettings",
|
|
458
|
+
value: function emitColumnSettings() {
|
|
459
|
+
this.props._emitColumnSettings(this.columnSettings, this.props._columnIndex);
|
|
460
|
+
}
|
|
461
|
+
/*
|
|
462
|
+
---------------------------------------
|
|
463
|
+
------- React lifecycle methods -------
|
|
464
|
+
---------------------------------------
|
|
465
|
+
*/
|
|
466
|
+
/**
|
|
467
|
+
* Logic performed after the mounting of the HotColumn component.
|
|
468
|
+
*/
|
|
469
|
+
}, {
|
|
470
|
+
key: "componentDidMount",
|
|
471
|
+
value: function componentDidMount() {
|
|
472
|
+
this.createColumnSettings();
|
|
473
|
+
this.emitColumnSettings();
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Logic performed after the updating of the HotColumn component.
|
|
477
|
+
*/
|
|
478
|
+
}, {
|
|
479
|
+
key: "componentDidUpdate",
|
|
480
|
+
value: function componentDidUpdate() {
|
|
481
|
+
this.createColumnSettings();
|
|
482
|
+
this.emitColumnSettings();
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Render the portals of the editors, if there are any.
|
|
486
|
+
*
|
|
487
|
+
* @returns {React.ReactElement}
|
|
488
|
+
*/
|
|
489
|
+
}, {
|
|
490
|
+
key: "render",
|
|
491
|
+
value: function render() {
|
|
492
|
+
var ownerDocument = this.props._getOwnerDocument();
|
|
493
|
+
var editorPortal = createEditorPortal(ownerDocument, this.getLocalEditorElement());
|
|
494
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null, editorPortal);
|
|
495
|
+
}
|
|
496
|
+
}]);
|
|
497
|
+
return HotColumn;
|
|
498
|
+
}(React__default["default"].Component);
|
|
499
|
+
|
|
471
500
|
/**
|
|
472
501
|
* Component class used to manage the renderer component portals.
|
|
473
502
|
*/
|
|
@@ -492,7 +521,7 @@ var RenderersPortalManager = /*#__PURE__*/function (_React$Component) {
|
|
|
492
521
|
return RenderersPortalManager;
|
|
493
522
|
}(React__default["default"].Component);
|
|
494
523
|
|
|
495
|
-
var version="0.0.0-next-
|
|
524
|
+
var version="0.0.0-next-ae2e00f-20231213";
|
|
496
525
|
|
|
497
526
|
function createCommonjsModule(fn, module) {
|
|
498
527
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
@@ -835,13 +864,6 @@ var propTypes = createCommonjsModule(function (module) {
|
|
|
835
864
|
});
|
|
836
865
|
var PropTypes = propTypes;
|
|
837
866
|
|
|
838
|
-
var Test = function Test() {
|
|
839
|
-
React.useEffect(function () {
|
|
840
|
-
console.log("hello world");
|
|
841
|
-
}, []);
|
|
842
|
-
return React__default["default"].createElement("div", null);
|
|
843
|
-
};
|
|
844
|
-
|
|
845
867
|
/**
|
|
846
868
|
* A Handsontable-ReactJS wrapper.
|
|
847
869
|
*
|
|
@@ -994,10 +1016,7 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
994
1016
|
}, {
|
|
995
1017
|
key: "getOwnerDocument",
|
|
996
1018
|
value: function getOwnerDocument() {
|
|
997
|
-
|
|
998
|
-
return this.hotElementRef ? this.hotElementRef.ownerDocument : document;
|
|
999
|
-
}
|
|
1000
|
-
return null;
|
|
1019
|
+
return this.hotElementRef ? this.hotElementRef.ownerDocument : document;
|
|
1001
1020
|
}
|
|
1002
1021
|
/**
|
|
1003
1022
|
* Set the reference to the main Handsontable DOM element.
|
|
@@ -1284,6 +1303,7 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
1284
1303
|
key: "render",
|
|
1285
1304
|
value: function render() {
|
|
1286
1305
|
var _this5 = this;
|
|
1306
|
+
var containerProps = getContainerAttributesProps(this.props);
|
|
1287
1307
|
var isHotColumn = function isHotColumn(childNode) {
|
|
1288
1308
|
return childNode.type === HotColumn;
|
|
1289
1309
|
};
|
|
@@ -1292,17 +1312,6 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
1292
1312
|
var hotColumnClones = children.filter(function (childNode) {
|
|
1293
1313
|
return isHotColumn(childNode);
|
|
1294
1314
|
}).map(function (childNode, columnIndex) {
|
|
1295
|
-
({
|
|
1296
|
-
columnIndex: columnIndex,
|
|
1297
|
-
children: childNode.props.children,
|
|
1298
|
-
onColumnSettingsChange: _this5.setHotColumnSettings.bind(_this5),
|
|
1299
|
-
componentRendererColumns: _this5.componentRendererColumns,
|
|
1300
|
-
getChildElementByType: getChildElementByType.bind(_this5),
|
|
1301
|
-
getRendererWrapper: _this5.getEditorClass.bind(_this5),
|
|
1302
|
-
getEditorClass: _this5.getEditorClass.bind(_this5),
|
|
1303
|
-
getEditorCache: _this5.getEditorCache.bind(_this5),
|
|
1304
|
-
getOwnerDocument: _this5.getOwnerDocument.bind(_this5)
|
|
1305
|
-
});
|
|
1306
1315
|
return React__default["default"].cloneElement(childNode, {
|
|
1307
1316
|
_componentRendererColumns: _this5.componentRendererColumns,
|
|
1308
1317
|
_emitColumnSettings: _this5.setHotColumnSettings.bind(_this5),
|
|
@@ -1315,13 +1324,12 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
1315
1324
|
children: childNode.props.children
|
|
1316
1325
|
});
|
|
1317
1326
|
});
|
|
1318
|
-
var containerProps = getContainerAttributesProps(this.props);
|
|
1319
1327
|
var editorPortal = createEditorPortal(this.getOwnerDocument(), this.getGlobalEditorElement());
|
|
1320
1328
|
return React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement("div", Object.assign({
|
|
1321
1329
|
ref: this.setHotElementRef.bind(this)
|
|
1322
1330
|
}, containerProps), hotColumnClones), React__default["default"].createElement(RenderersPortalManager, {
|
|
1323
1331
|
ref: this.setRenderersPortalManagerRef.bind(this)
|
|
1324
|
-
}), editorPortal
|
|
1332
|
+
}), editorPortal);
|
|
1325
1333
|
}
|
|
1326
1334
|
}], [{
|
|
1327
1335
|
key: "version",
|