@handsontable/react 0.0.0-next-e2b07e5-20231213 → 0.0.0-next-d26e81f-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/Test.d.ts +2 -0
- package/commonjs/react-handsontable.js +113 -121
- package/dist/react-handsontable.js +114 -122
- 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 +114 -122
- package/helpers.d.ts +7 -1
- package/hotColumn.d.ts +15 -40
- package/hotTable.d.ts +1 -1
- package/package.json +10 -10
- package/types.d.ts +0 -14
|
@@ -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-d26e81f-20231213 (built at Wed Dec 13 2023 13:42:44 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,6 +39,33 @@ 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
|
+
}
|
|
42
69
|
function ownKeys(e, r) {
|
|
43
70
|
var t = Object.keys(e);
|
|
44
71
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -60,6 +87,20 @@ function _objectSpread2(e) {
|
|
|
60
87
|
}
|
|
61
88
|
return e;
|
|
62
89
|
}
|
|
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
|
+
}
|
|
63
104
|
function _typeof(o) {
|
|
64
105
|
"@babel/helpers - typeof";
|
|
65
106
|
|
|
@@ -173,12 +214,18 @@ function _createSuper(Derived) {
|
|
|
173
214
|
return _possibleConstructorReturn(this, result);
|
|
174
215
|
};
|
|
175
216
|
}
|
|
217
|
+
function _slicedToArray(arr, i) {
|
|
218
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
219
|
+
}
|
|
176
220
|
function _toConsumableArray(arr) {
|
|
177
221
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
178
222
|
}
|
|
179
223
|
function _arrayWithoutHoles(arr) {
|
|
180
224
|
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
181
225
|
}
|
|
226
|
+
function _arrayWithHoles(arr) {
|
|
227
|
+
if (Array.isArray(arr)) return arr;
|
|
228
|
+
}
|
|
182
229
|
function _iterableToArray(iter) {
|
|
183
230
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
184
231
|
}
|
|
@@ -198,22 +245,12 @@ function _arrayLikeToArray(arr, len) {
|
|
|
198
245
|
function _nonIterableSpread() {
|
|
199
246
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
200
247
|
}
|
|
201
|
-
function
|
|
202
|
-
|
|
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);
|
|
248
|
+
function _nonIterableRest() {
|
|
249
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
214
250
|
}
|
|
215
251
|
|
|
216
252
|
var bulkComponentContainer = null;
|
|
253
|
+
var hasIdWarningBeenPrinted = false;
|
|
217
254
|
/**
|
|
218
255
|
* Warning message for the `autoRowSize`/`autoColumnSize` compatibility check.
|
|
219
256
|
*/
|
|
@@ -278,14 +315,12 @@ function getOriginalEditorClass(editorElement) {
|
|
|
278
315
|
/**
|
|
279
316
|
* Create an editor portal.
|
|
280
317
|
*
|
|
281
|
-
* @param {Document}
|
|
318
|
+
* @param {Document} doc Document to be used.
|
|
282
319
|
* @param {React.ReactElement} editorElement Editor's element.
|
|
283
320
|
* @returns {React.ReactPortal} The portal for the editor.
|
|
284
321
|
*/
|
|
285
|
-
function createEditorPortal() {
|
|
286
|
-
|
|
287
|
-
var editorElement = arguments.length > 1 ? arguments[1] : undefined;
|
|
288
|
-
if (editorElement === null) {
|
|
322
|
+
function createEditorPortal(doc, editorElement) {
|
|
323
|
+
if (typeof doc === 'undefined' || editorElement === null) {
|
|
289
324
|
return null;
|
|
290
325
|
}
|
|
291
326
|
var containerProps = getContainerAttributesProps(editorElement.props, false);
|
|
@@ -357,12 +392,47 @@ function createPortal(rElement, props) {
|
|
|
357
392
|
*/
|
|
358
393
|
function getContainerAttributesProps(props) {
|
|
359
394
|
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
|
+
}
|
|
360
399
|
return {
|
|
361
400
|
id: props.id || (randomizeId ? 'hot-' + Math.random().toString(36).substring(5) : void 0),
|
|
362
401
|
className: props.className || '',
|
|
363
402
|
style: props.style || {}
|
|
364
403
|
};
|
|
365
404
|
}
|
|
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
|
+
};
|
|
366
436
|
|
|
367
437
|
var SettingsMapper = /*#__PURE__*/function () {
|
|
368
438
|
function SettingsMapper() {
|
|
@@ -398,105 +468,6 @@ var SettingsMapper = /*#__PURE__*/function () {
|
|
|
398
468
|
return SettingsMapper;
|
|
399
469
|
}();
|
|
400
470
|
|
|
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
|
-
|
|
500
471
|
/**
|
|
501
472
|
* Component class used to manage the renderer component portals.
|
|
502
473
|
*/
|
|
@@ -521,7 +492,7 @@ var RenderersPortalManager = /*#__PURE__*/function (_React$Component) {
|
|
|
521
492
|
return RenderersPortalManager;
|
|
522
493
|
}(React__default["default"].Component);
|
|
523
494
|
|
|
524
|
-
var version="0.0.0-next-
|
|
495
|
+
var version="0.0.0-next-d26e81f-20231213";
|
|
525
496
|
|
|
526
497
|
function createCommonjsModule(fn, module) {
|
|
527
498
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
@@ -864,6 +835,13 @@ var propTypes = createCommonjsModule(function (module) {
|
|
|
864
835
|
});
|
|
865
836
|
var PropTypes = propTypes;
|
|
866
837
|
|
|
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
|
+
|
|
867
845
|
/**
|
|
868
846
|
* A Handsontable-ReactJS wrapper.
|
|
869
847
|
*
|
|
@@ -1016,7 +994,10 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
1016
994
|
}, {
|
|
1017
995
|
key: "getOwnerDocument",
|
|
1018
996
|
value: function getOwnerDocument() {
|
|
1019
|
-
|
|
997
|
+
if (isCSR()) {
|
|
998
|
+
return this.hotElementRef ? this.hotElementRef.ownerDocument : document;
|
|
999
|
+
}
|
|
1000
|
+
return null;
|
|
1020
1001
|
}
|
|
1021
1002
|
/**
|
|
1022
1003
|
* Set the reference to the main Handsontable DOM element.
|
|
@@ -1303,7 +1284,6 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
1303
1284
|
key: "render",
|
|
1304
1285
|
value: function render() {
|
|
1305
1286
|
var _this5 = this;
|
|
1306
|
-
var containerProps = getContainerAttributesProps(this.props);
|
|
1307
1287
|
var isHotColumn = function isHotColumn(childNode) {
|
|
1308
1288
|
return childNode.type === HotColumn;
|
|
1309
1289
|
};
|
|
@@ -1312,6 +1292,17 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
1312
1292
|
var hotColumnClones = children.filter(function (childNode) {
|
|
1313
1293
|
return isHotColumn(childNode);
|
|
1314
1294
|
}).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
|
+
});
|
|
1315
1306
|
return React__default["default"].cloneElement(childNode, {
|
|
1316
1307
|
_componentRendererColumns: _this5.componentRendererColumns,
|
|
1317
1308
|
_emitColumnSettings: _this5.setHotColumnSettings.bind(_this5),
|
|
@@ -1324,12 +1315,13 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
1324
1315
|
children: childNode.props.children
|
|
1325
1316
|
});
|
|
1326
1317
|
});
|
|
1318
|
+
var containerProps = getContainerAttributesProps(this.props);
|
|
1327
1319
|
var editorPortal = createEditorPortal(this.getOwnerDocument(), this.getGlobalEditorElement());
|
|
1328
1320
|
return React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement("div", Object.assign({
|
|
1329
1321
|
ref: this.setHotElementRef.bind(this)
|
|
1330
1322
|
}, containerProps), hotColumnClones), React__default["default"].createElement(RenderersPortalManager, {
|
|
1331
1323
|
ref: this.setRenderersPortalManagerRef.bind(this)
|
|
1332
|
-
}), editorPortal);
|
|
1324
|
+
}), editorPortal, React__default["default"].createElement(Test, null));
|
|
1333
1325
|
}
|
|
1334
1326
|
}], [{
|
|
1335
1327
|
key: "version",
|