@handsontable/react 12.3.2 → 12.3.3-next-018f495-20230327
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 +71 -154
- package/dist/react-handsontable.js +72 -155
- 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 +71 -154
- package/hotColumn.d.ts +0 -18
- package/hotTable.d.ts +0 -18
- package/package.json +3 -3
- package/editorsPortalManager.d.ts +0 -12
|
@@ -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: 12.3.
|
|
28
|
+
* Version: 12.3.3-next-018f495-20230327 (built at Mon Mar 27 2023 11:53:26 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')) :
|
|
@@ -173,6 +173,31 @@ function _createSuper(Derived) {
|
|
|
173
173
|
return _possibleConstructorReturn(this, result);
|
|
174
174
|
};
|
|
175
175
|
}
|
|
176
|
+
function _toConsumableArray(arr) {
|
|
177
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
178
|
+
}
|
|
179
|
+
function _arrayWithoutHoles(arr) {
|
|
180
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
181
|
+
}
|
|
182
|
+
function _iterableToArray(iter) {
|
|
183
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
184
|
+
}
|
|
185
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
186
|
+
if (!o) return;
|
|
187
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
188
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
189
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
190
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
191
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
192
|
+
}
|
|
193
|
+
function _arrayLikeToArray(arr, len) {
|
|
194
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
195
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
196
|
+
return arr2;
|
|
197
|
+
}
|
|
198
|
+
function _nonIterableSpread() {
|
|
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.");
|
|
200
|
+
}
|
|
176
201
|
function _toPrimitive(input, hint) {
|
|
177
202
|
if (typeof input !== "object" || input === null) return input;
|
|
178
203
|
var prim = input[Symbol.toPrimitive];
|
|
@@ -373,69 +398,28 @@ var SettingsMapper = /*#__PURE__*/function () {
|
|
|
373
398
|
return SettingsMapper;
|
|
374
399
|
}();
|
|
375
400
|
|
|
376
|
-
/**
|
|
377
|
-
* Component class used to manage the editor component portals.
|
|
378
|
-
*/
|
|
379
|
-
var EditorsPortalManager = /*#__PURE__*/function (_React$Component) {
|
|
380
|
-
_inherits(EditorsPortalManager, _React$Component);
|
|
381
|
-
var _super = _createSuper(EditorsPortalManager);
|
|
382
|
-
function EditorsPortalManager() {
|
|
383
|
-
var _this;
|
|
384
|
-
_classCallCheck(this, EditorsPortalManager);
|
|
385
|
-
_this = _super.apply(this, arguments);
|
|
386
|
-
_this.state = {
|
|
387
|
-
portals: []
|
|
388
|
-
};
|
|
389
|
-
return _this;
|
|
390
|
-
}
|
|
391
|
-
_createClass(EditorsPortalManager, [{
|
|
392
|
-
key: "render",
|
|
393
|
-
value: function render() {
|
|
394
|
-
return React__default["default"].createElement(React__default["default"].Fragment, null, this.state.portals);
|
|
395
|
-
}
|
|
396
|
-
}]);
|
|
397
|
-
return EditorsPortalManager;
|
|
398
|
-
}(React__default["default"].Component);
|
|
399
|
-
|
|
400
401
|
var HotColumn = /*#__PURE__*/function (_React$Component) {
|
|
401
402
|
_inherits(HotColumn, _React$Component);
|
|
402
403
|
var _super = _createSuper(HotColumn);
|
|
403
404
|
function HotColumn() {
|
|
404
|
-
var _this;
|
|
405
405
|
_classCallCheck(this, HotColumn);
|
|
406
|
-
|
|
407
|
-
/**
|
|
408
|
-
* Component used to manage the editor portals.
|
|
409
|
-
*
|
|
410
|
-
* @type {React.Component}
|
|
411
|
-
*/
|
|
412
|
-
_this.editorsPortalManager = null;
|
|
413
|
-
return _this;
|
|
406
|
+
return _super.apply(this, arguments);
|
|
414
407
|
}
|
|
415
|
-
/**
|
|
416
|
-
* Set the editors portal manager ref.
|
|
417
|
-
*
|
|
418
|
-
* @param {React.ReactComponent} pmComponent The PortalManager component.
|
|
419
|
-
*/
|
|
420
408
|
_createClass(HotColumn, [{
|
|
421
|
-
key: "
|
|
422
|
-
value:
|
|
423
|
-
this.editorsPortalManager = pmComponent;
|
|
424
|
-
}
|
|
409
|
+
key: "getSettingsProps",
|
|
410
|
+
value:
|
|
425
411
|
/**
|
|
426
412
|
* Filter out all the internal properties and return an object with just the Handsontable-related props.
|
|
427
413
|
*
|
|
428
414
|
* @returns {Object}
|
|
429
415
|
*/
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
value: function getSettingsProps() {
|
|
433
|
-
var _this2 = this;
|
|
416
|
+
function getSettingsProps() {
|
|
417
|
+
var _this = this;
|
|
434
418
|
this.internalProps = ['_componentRendererColumns', '_emitColumnSettings', '_columnIndex', '_getChildElementByType', '_getRendererWrapper', '_getEditorClass', '_getEditorCache', '_getOwnerDocument', 'hot-renderer', 'hot-editor', 'children'];
|
|
435
419
|
return Object.keys(this.props).filter(function (key) {
|
|
436
|
-
return !
|
|
420
|
+
return !_this.internalProps.includes(key);
|
|
437
421
|
}).reduce(function (obj, key) {
|
|
438
|
-
obj[key] =
|
|
422
|
+
obj[key] = _this.props[key];
|
|
439
423
|
return obj;
|
|
440
424
|
}, {});
|
|
441
425
|
}
|
|
@@ -466,21 +450,6 @@ var HotColumn = /*#__PURE__*/function (_React$Component) {
|
|
|
466
450
|
this.columnSettings.editor = this.props._getEditorClass(editorElement, this.props._columnIndex);
|
|
467
451
|
}
|
|
468
452
|
}
|
|
469
|
-
/**
|
|
470
|
-
* Creates the local editor portal and renders it within the editors portal manager component.
|
|
471
|
-
*
|
|
472
|
-
* @param {Function} callback Callback to call which is triggered after the editors portal is rendered.
|
|
473
|
-
*/
|
|
474
|
-
}, {
|
|
475
|
-
key: "renderLocalEditorPortal",
|
|
476
|
-
value: function renderLocalEditorPortal(callback) {
|
|
477
|
-
var editorCache = this.props._getEditorCache();
|
|
478
|
-
var localEditorElement = getExtendedEditorElement(this.props.children, editorCache, this.props._columnIndex);
|
|
479
|
-
var editorPortal = createEditorPortal(this.props._getOwnerDocument(), localEditorElement);
|
|
480
|
-
this.editorsPortalManager.setState({
|
|
481
|
-
portals: [editorPortal]
|
|
482
|
-
}, callback);
|
|
483
|
-
}
|
|
484
453
|
/**
|
|
485
454
|
* Emit the column settings to the parent using a prop passed from the parent.
|
|
486
455
|
*/
|
|
@@ -500,11 +469,8 @@ var HotColumn = /*#__PURE__*/function (_React$Component) {
|
|
|
500
469
|
}, {
|
|
501
470
|
key: "componentDidMount",
|
|
502
471
|
value: function componentDidMount() {
|
|
503
|
-
|
|
504
|
-
this.
|
|
505
|
-
_this3.createColumnSettings();
|
|
506
|
-
_this3.emitColumnSettings();
|
|
507
|
-
});
|
|
472
|
+
this.createColumnSettings();
|
|
473
|
+
this.emitColumnSettings();
|
|
508
474
|
}
|
|
509
475
|
/**
|
|
510
476
|
* Logic performed after the updating of the HotColumn component.
|
|
@@ -512,11 +478,8 @@ var HotColumn = /*#__PURE__*/function (_React$Component) {
|
|
|
512
478
|
}, {
|
|
513
479
|
key: "componentDidUpdate",
|
|
514
480
|
value: function componentDidUpdate() {
|
|
515
|
-
|
|
516
|
-
this.
|
|
517
|
-
_this4.createColumnSettings();
|
|
518
|
-
_this4.emitColumnSettings();
|
|
519
|
-
});
|
|
481
|
+
this.createColumnSettings();
|
|
482
|
+
this.emitColumnSettings();
|
|
520
483
|
}
|
|
521
484
|
/**
|
|
522
485
|
* Render the portals of the editors, if there are any.
|
|
@@ -526,9 +489,9 @@ var HotColumn = /*#__PURE__*/function (_React$Component) {
|
|
|
526
489
|
}, {
|
|
527
490
|
key: "render",
|
|
528
491
|
value: function render() {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
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);
|
|
532
495
|
}
|
|
533
496
|
}]);
|
|
534
497
|
return HotColumn;
|
|
@@ -558,7 +521,7 @@ var RenderersPortalManager = /*#__PURE__*/function (_React$Component) {
|
|
|
558
521
|
return RenderersPortalManager;
|
|
559
522
|
}(React__default["default"].Component);
|
|
560
523
|
|
|
561
|
-
var version="12.3.
|
|
524
|
+
var version="12.3.3-next-018f495-20230327";
|
|
562
525
|
|
|
563
526
|
function createCommonjsModule(fn, module) {
|
|
564
527
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
@@ -961,12 +924,6 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
961
924
|
* @type {React.Component}
|
|
962
925
|
*/
|
|
963
926
|
_this.renderersPortalManager = null;
|
|
964
|
-
/**
|
|
965
|
-
* Component used to manage the editor portals.
|
|
966
|
-
*
|
|
967
|
-
* @type {React.Component}
|
|
968
|
-
*/
|
|
969
|
-
_this.editorsPortalManager = null;
|
|
970
927
|
/**
|
|
971
928
|
* Array containing the portals cashed to be rendered in bulk after Handsontable's render cycle.
|
|
972
929
|
*/
|
|
@@ -1048,7 +1005,6 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
1048
1005
|
}, {
|
|
1049
1006
|
key: "clearCache",
|
|
1050
1007
|
value: function clearCache() {
|
|
1051
|
-
this.getEditorCache().clear();
|
|
1052
1008
|
this.getRenderedCellCache().clear();
|
|
1053
1009
|
this.componentRendererColumns.clear();
|
|
1054
1010
|
}
|
|
@@ -1200,20 +1156,6 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
1200
1156
|
value: function getGlobalEditorElement() {
|
|
1201
1157
|
return getExtendedEditorElement(this.props.children, this.getEditorCache());
|
|
1202
1158
|
}
|
|
1203
|
-
/**
|
|
1204
|
-
* Creates the global editor portal and renders it within the editors portal manager component.
|
|
1205
|
-
*
|
|
1206
|
-
* @param {Function} callback Callback to call which is triggered after the editors portal is rendered.
|
|
1207
|
-
*/
|
|
1208
|
-
}, {
|
|
1209
|
-
key: "renderGlobalEditorPortal",
|
|
1210
|
-
value: function renderGlobalEditorPortal(callback) {
|
|
1211
|
-
var globalEditorElement = this.getGlobalEditorElement();
|
|
1212
|
-
var editorPortal = createEditorPortal(this.getOwnerDocument(), globalEditorElement);
|
|
1213
|
-
this.editorsPortalManager.setState({
|
|
1214
|
-
portals: [editorPortal]
|
|
1215
|
-
}, callback);
|
|
1216
|
-
}
|
|
1217
1159
|
/**
|
|
1218
1160
|
* Create a new settings object containing the column settings and global editors and renderers.
|
|
1219
1161
|
*
|
|
@@ -1280,12 +1222,10 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
1280
1222
|
key: "handsontableAfterViewRender",
|
|
1281
1223
|
value: function handsontableAfterViewRender() {
|
|
1282
1224
|
var _this3 = this;
|
|
1283
|
-
this.renderersPortalManager.setState(
|
|
1284
|
-
|
|
1285
|
-
portals: _this3.portalCacheArray
|
|
1286
|
-
});
|
|
1225
|
+
this.renderersPortalManager.setState({
|
|
1226
|
+
portals: _toConsumableArray(this.portalCacheArray)
|
|
1287
1227
|
}, function () {
|
|
1288
|
-
_this3.portalCacheArray
|
|
1228
|
+
_this3.portalCacheArray = [];
|
|
1289
1229
|
});
|
|
1290
1230
|
}
|
|
1291
1231
|
/**
|
|
@@ -1310,16 +1250,6 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
1310
1250
|
value: function setRenderersPortalManagerRef(pmComponent) {
|
|
1311
1251
|
this.renderersPortalManager = pmComponent;
|
|
1312
1252
|
}
|
|
1313
|
-
/**
|
|
1314
|
-
* Set the editors portal manager ref.
|
|
1315
|
-
*
|
|
1316
|
-
* @param {React.ReactComponent} pmComponent The PortalManager component.
|
|
1317
|
-
*/
|
|
1318
|
-
}, {
|
|
1319
|
-
key: "setEditorsPortalManagerRef",
|
|
1320
|
-
value: function setEditorsPortalManagerRef(pmComponent) {
|
|
1321
|
-
this.editorsPortalManager = pmComponent;
|
|
1322
|
-
}
|
|
1323
1253
|
/*
|
|
1324
1254
|
---------------------------------------
|
|
1325
1255
|
------- React lifecycle methods -------
|
|
@@ -1332,25 +1262,17 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
1332
1262
|
key: "componentDidMount",
|
|
1333
1263
|
value: function componentDidMount() {
|
|
1334
1264
|
var _this4 = this;
|
|
1335
|
-
this.
|
|
1336
|
-
this.
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
var newGlobalSettings = _this4.createNewGlobalSettings();
|
|
1343
|
-
_this4.hotInstance = new Handsontable__default["default"].Core(_this4.hotElementRef, newGlobalSettings);
|
|
1344
|
-
_this4.hotInstance.addHook('beforeViewRender', function () {
|
|
1345
|
-
return _this4.handsontableBeforeViewRender();
|
|
1346
|
-
});
|
|
1347
|
-
_this4.hotInstance.addHook('afterViewRender', function () {
|
|
1348
|
-
return _this4.handsontableAfterViewRender();
|
|
1349
|
-
});
|
|
1350
|
-
// `init` missing in Handsontable's type definitions.
|
|
1351
|
-
_this4.hotInstance.init();
|
|
1352
|
-
_this4.displayAutoSizeWarning(newGlobalSettings);
|
|
1265
|
+
var newGlobalSettings = this.createNewGlobalSettings();
|
|
1266
|
+
this.hotInstance = new Handsontable__default["default"].Core(this.hotElementRef, newGlobalSettings);
|
|
1267
|
+
this.hotInstance.addHook('beforeViewRender', function () {
|
|
1268
|
+
return _this4.handsontableBeforeViewRender();
|
|
1269
|
+
});
|
|
1270
|
+
this.hotInstance.addHook('afterViewRender', function () {
|
|
1271
|
+
return _this4.handsontableAfterViewRender();
|
|
1353
1272
|
});
|
|
1273
|
+
// `init` missing in Handsontable's type definitions.
|
|
1274
|
+
this.hotInstance.init();
|
|
1275
|
+
this.displayAutoSizeWarning(newGlobalSettings);
|
|
1354
1276
|
}
|
|
1355
1277
|
/**
|
|
1356
1278
|
* Logic performed after the component update.
|
|
@@ -1358,13 +1280,10 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
1358
1280
|
}, {
|
|
1359
1281
|
key: "componentDidUpdate",
|
|
1360
1282
|
value: function componentDidUpdate() {
|
|
1361
|
-
var _this5 = this;
|
|
1362
1283
|
this.clearCache();
|
|
1363
|
-
this.
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
_this5.displayAutoSizeWarning(newGlobalSettings);
|
|
1367
|
-
});
|
|
1284
|
+
var newGlobalSettings = this.createNewGlobalSettings();
|
|
1285
|
+
this.updateHot(newGlobalSettings);
|
|
1286
|
+
this.displayAutoSizeWarning(newGlobalSettings);
|
|
1368
1287
|
}
|
|
1369
1288
|
/**
|
|
1370
1289
|
* Destroy the Handsontable instance when the parent component unmounts.
|
|
@@ -1372,6 +1291,7 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
1372
1291
|
}, {
|
|
1373
1292
|
key: "componentWillUnmount",
|
|
1374
1293
|
value: function componentWillUnmount() {
|
|
1294
|
+
this.clearCache();
|
|
1375
1295
|
if (this.hotInstance) {
|
|
1376
1296
|
this.hotInstance.destroy();
|
|
1377
1297
|
}
|
|
@@ -1382,37 +1302,34 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
1382
1302
|
}, {
|
|
1383
1303
|
key: "render",
|
|
1384
1304
|
value: function render() {
|
|
1385
|
-
var
|
|
1305
|
+
var _this5 = this;
|
|
1386
1306
|
var containerProps = getContainerAttributesProps(this.props);
|
|
1387
1307
|
var isHotColumn = function isHotColumn(childNode) {
|
|
1388
1308
|
return childNode.type === HotColumn;
|
|
1389
1309
|
};
|
|
1390
1310
|
var children = React__default["default"].Children.toArray(this.props.children);
|
|
1391
|
-
// filter out anything that's not a HotColumn
|
|
1392
|
-
children = children.filter(function (childNode) {
|
|
1393
|
-
return isHotColumn(childNode);
|
|
1394
|
-
});
|
|
1395
1311
|
// clone the HotColumn nodes and extend them with the callbacks
|
|
1396
|
-
var
|
|
1312
|
+
var hotColumnClones = children.filter(function (childNode) {
|
|
1313
|
+
return isHotColumn(childNode);
|
|
1314
|
+
}).map(function (childNode, columnIndex) {
|
|
1397
1315
|
return React__default["default"].cloneElement(childNode, {
|
|
1398
|
-
_componentRendererColumns:
|
|
1399
|
-
_emitColumnSettings:
|
|
1316
|
+
_componentRendererColumns: _this5.componentRendererColumns,
|
|
1317
|
+
_emitColumnSettings: _this5.setHotColumnSettings.bind(_this5),
|
|
1400
1318
|
_columnIndex: columnIndex,
|
|
1401
|
-
_getChildElementByType: getChildElementByType.bind(
|
|
1402
|
-
_getRendererWrapper:
|
|
1403
|
-
_getEditorClass:
|
|
1404
|
-
_getOwnerDocument:
|
|
1405
|
-
_getEditorCache:
|
|
1319
|
+
_getChildElementByType: getChildElementByType.bind(_this5),
|
|
1320
|
+
_getRendererWrapper: _this5.getRendererWrapper.bind(_this5),
|
|
1321
|
+
_getEditorClass: _this5.getEditorClass.bind(_this5),
|
|
1322
|
+
_getOwnerDocument: _this5.getOwnerDocument.bind(_this5),
|
|
1323
|
+
_getEditorCache: _this5.getEditorCache.bind(_this5),
|
|
1406
1324
|
children: childNode.props.children
|
|
1407
1325
|
});
|
|
1408
1326
|
});
|
|
1327
|
+
var editorPortal = createEditorPortal(this.getOwnerDocument(), this.getGlobalEditorElement());
|
|
1409
1328
|
return React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement("div", Object.assign({
|
|
1410
1329
|
ref: this.setHotElementRef.bind(this)
|
|
1411
|
-
}, containerProps),
|
|
1330
|
+
}, containerProps), hotColumnClones), React__default["default"].createElement(RenderersPortalManager, {
|
|
1412
1331
|
ref: this.setRenderersPortalManagerRef.bind(this)
|
|
1413
|
-
}),
|
|
1414
|
-
ref: this.setEditorsPortalManagerRef.bind(this)
|
|
1415
|
-
}));
|
|
1332
|
+
}), editorPortal);
|
|
1416
1333
|
}
|
|
1417
1334
|
}], [{
|
|
1418
1335
|
key: "version",
|