@handsontable/react 0.0.0-next-460cf29-20230220 → 0.0.0-next-bbc9650-20230220
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 +245 -54
- package/dist/react-handsontable.js +246 -55
- 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 +245 -54
- package/helpers.d.ts +29 -5
- package/hotColumn.d.ts +41 -1
- package/hotTable.d.ts +42 -1
- package/package.json +3 -3
- package/portalManager.d.ts +1 -3
- package/editorHolder.d.ts +0 -8
|
@@ -223,6 +223,49 @@ function getOriginalEditorClass(editorElement) {
|
|
|
223
223
|
}
|
|
224
224
|
return editorElement.type.WrappedComponent ? editorElement.type.WrappedComponent : editorElement.type;
|
|
225
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* Remove editor containers from DOM.
|
|
228
|
+
*
|
|
229
|
+
* @param {Document} [doc] Document to be used.
|
|
230
|
+
* @param {Map} editorCache The editor cache reference.
|
|
231
|
+
*/
|
|
232
|
+
function removeEditorContainers() {
|
|
233
|
+
var doc = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
|
234
|
+
doc.querySelectorAll("[class^=\"".concat(DEFAULT_CLASSNAME, "\"]")).forEach(function (domNode) {
|
|
235
|
+
if (domNode.parentNode) {
|
|
236
|
+
domNode.parentNode.removeChild(domNode);
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Create an editor portal.
|
|
242
|
+
*
|
|
243
|
+
* @param {Document} [doc] Document to be used.
|
|
244
|
+
* @param {React.ReactElement} editorElement Editor's element.
|
|
245
|
+
* @param {Map} editorCache The editor cache reference.
|
|
246
|
+
* @returns {React.ReactPortal} The portal for the editor.
|
|
247
|
+
*/
|
|
248
|
+
function createEditorPortal() {
|
|
249
|
+
var doc = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
|
250
|
+
var editorElement = arguments.length > 1 ? arguments[1] : undefined;
|
|
251
|
+
if (editorElement === null) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
var editorContainer = doc.createElement('DIV');
|
|
255
|
+
var _getContainerAttribut = getContainerAttributesProps(editorElement.props, false),
|
|
256
|
+
id = _getContainerAttribut.id,
|
|
257
|
+
className = _getContainerAttribut.className,
|
|
258
|
+
style = _getContainerAttribut.style;
|
|
259
|
+
if (id) {
|
|
260
|
+
editorContainer.id = id;
|
|
261
|
+
}
|
|
262
|
+
editorContainer.className = [DEFAULT_CLASSNAME, className].join(' ');
|
|
263
|
+
if (style) {
|
|
264
|
+
Object.assign(editorContainer.style, style);
|
|
265
|
+
}
|
|
266
|
+
doc.body.appendChild(editorContainer);
|
|
267
|
+
return ReactDOM__default["default"].createPortal(editorElement, editorContainer);
|
|
268
|
+
}
|
|
226
269
|
/**
|
|
227
270
|
* Get an editor element extended with a instance-emitting method.
|
|
228
271
|
*
|
|
@@ -256,11 +299,12 @@ function getExtendedEditorElement(children, editorCache) {
|
|
|
256
299
|
*
|
|
257
300
|
* @param {React.ReactElement} rElement React element to be used as a base for the component.
|
|
258
301
|
* @param {Object} props Props to be passed to the cloned element.
|
|
302
|
+
* @param {Function} callback Callback to be called after the component has been mounted.
|
|
259
303
|
* @param {Document} [ownerDocument] The owner document to set the portal up into.
|
|
260
304
|
* @returns {{portal: React.ReactPortal, portalContainer: HTMLElement}} An object containing the portal and its container.
|
|
261
305
|
*/
|
|
262
|
-
function createPortal(rElement, props) {
|
|
263
|
-
var ownerDocument = arguments.length >
|
|
306
|
+
function createPortal(rElement, props, callback) {
|
|
307
|
+
var ownerDocument = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : document;
|
|
264
308
|
if (!ownerDocument) {
|
|
265
309
|
ownerDocument = document;
|
|
266
310
|
}
|
|
@@ -294,6 +338,23 @@ function getContainerAttributesProps(props) {
|
|
|
294
338
|
style: props.style || {}
|
|
295
339
|
};
|
|
296
340
|
}
|
|
341
|
+
/**
|
|
342
|
+
* Add the `UNSAFE_` prefixes to the deprecated lifecycle methods for React >= 16.3.
|
|
343
|
+
*
|
|
344
|
+
* @param {Object} instance Instance to have the methods renamed.
|
|
345
|
+
*/
|
|
346
|
+
function addUnsafePrefixes(instance) {
|
|
347
|
+
var reactSemverArray = React__default["default"].version.split('.').map(function (v) {
|
|
348
|
+
return parseInt(v);
|
|
349
|
+
});
|
|
350
|
+
var shouldPrefix = reactSemverArray[0] >= 16 && reactSemverArray[1] >= 3 || reactSemverArray[0] >= 17;
|
|
351
|
+
if (shouldPrefix) {
|
|
352
|
+
instance.UNSAFE_componentWillUpdate = instance.componentWillUpdate;
|
|
353
|
+
instance.componentWillUpdate = void 0;
|
|
354
|
+
instance.UNSAFE_componentWillMount = instance.componentWillMount;
|
|
355
|
+
instance.componentWillMount = void 0;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
297
358
|
|
|
298
359
|
var SettingsMapper = /*#__PURE__*/function () {
|
|
299
360
|
function SettingsMapper() {
|
|
@@ -329,41 +390,63 @@ var SettingsMapper = /*#__PURE__*/function () {
|
|
|
329
390
|
return SettingsMapper;
|
|
330
391
|
}();
|
|
331
392
|
|
|
332
|
-
/**
|
|
333
|
-
* Component provides an editor container for custom editors.
|
|
334
|
-
*/
|
|
335
|
-
function EditorHolder(_ref) {
|
|
336
|
-
var editorElement = _ref.editorElement;
|
|
337
|
-
if (editorElement === null) {
|
|
338
|
-
return null;
|
|
339
|
-
}
|
|
340
|
-
var containerProps = getContainerAttributesProps(editorElement.props, false);
|
|
341
|
-
containerProps.className = [DEFAULT_CLASSNAME, containerProps.className].join(' ');
|
|
342
|
-
return React__default["default"].createElement("div", Object.assign({}, containerProps), editorElement);
|
|
343
|
-
}
|
|
344
|
-
|
|
345
393
|
var HotColumn = /*#__PURE__*/function (_React$Component) {
|
|
346
394
|
_inherits(HotColumn, _React$Component);
|
|
347
395
|
var _super = _createSuper(HotColumn);
|
|
348
|
-
|
|
396
|
+
/**
|
|
397
|
+
* HotColumn class constructor.
|
|
398
|
+
*
|
|
399
|
+
* @param {HotColumnProps} props Component props.
|
|
400
|
+
* @param {*} [context] Component context.
|
|
401
|
+
*/
|
|
402
|
+
function HotColumn(props, context) {
|
|
403
|
+
var _this;
|
|
349
404
|
_classCallCheck(this, HotColumn);
|
|
350
|
-
|
|
405
|
+
_this = _super.call(this, props, context);
|
|
406
|
+
/**
|
|
407
|
+
* Local editor portal cache.
|
|
408
|
+
*
|
|
409
|
+
* @private
|
|
410
|
+
* @type {ReactPortal}
|
|
411
|
+
*/
|
|
412
|
+
_this.localEditorPortal = null;
|
|
413
|
+
addUnsafePrefixes(_assertThisInitialized(_this));
|
|
414
|
+
return _this;
|
|
351
415
|
}
|
|
416
|
+
/**
|
|
417
|
+
* Get the local editor portal cache property.
|
|
418
|
+
*
|
|
419
|
+
* @return {ReactPortal} Local editor portal.
|
|
420
|
+
*/
|
|
352
421
|
_createClass(HotColumn, [{
|
|
353
|
-
key: "
|
|
354
|
-
value:
|
|
422
|
+
key: "getLocalEditorPortal",
|
|
423
|
+
value: function getLocalEditorPortal() {
|
|
424
|
+
return this.localEditorPortal;
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Set the local editor portal cache property.
|
|
428
|
+
*
|
|
429
|
+
* @param {ReactPortal} portal Local editor portal.
|
|
430
|
+
*/
|
|
431
|
+
}, {
|
|
432
|
+
key: "setLocalEditorPortal",
|
|
433
|
+
value: function setLocalEditorPortal(portal) {
|
|
434
|
+
this.localEditorPortal = portal;
|
|
435
|
+
}
|
|
355
436
|
/**
|
|
356
437
|
* Filter out all the internal properties and return an object with just the Handsontable-related props.
|
|
357
438
|
*
|
|
358
439
|
* @returns {Object}
|
|
359
440
|
*/
|
|
360
|
-
|
|
361
|
-
|
|
441
|
+
}, {
|
|
442
|
+
key: "getSettingsProps",
|
|
443
|
+
value: function getSettingsProps() {
|
|
444
|
+
var _this2 = this;
|
|
362
445
|
this.internalProps = ['__componentRendererColumns', '_emitColumnSettings', '_columnIndex', '_getChildElementByType', '_getRendererWrapper', '_getEditorClass', '_getEditorCache', '_getOwnerDocument', 'hot-renderer', 'hot-editor', 'children'];
|
|
363
446
|
return Object.keys(this.props).filter(function (key) {
|
|
364
|
-
return !
|
|
447
|
+
return !_this2.internalProps.includes(key);
|
|
365
448
|
}).reduce(function (obj, key) {
|
|
366
|
-
obj[key] =
|
|
449
|
+
obj[key] = _this2.props[key];
|
|
367
450
|
return obj;
|
|
368
451
|
}, {});
|
|
369
452
|
}
|
|
@@ -394,6 +477,21 @@ var HotColumn = /*#__PURE__*/function (_React$Component) {
|
|
|
394
477
|
this.columnSettings.editor = this.props._getEditorClass(editorElement, this.props._columnIndex);
|
|
395
478
|
}
|
|
396
479
|
}
|
|
480
|
+
/**
|
|
481
|
+
* Create the local editor portal and its destination HTML element if needed.
|
|
482
|
+
*
|
|
483
|
+
* @param {React.ReactNode} [children] Children of the HotTable instance. Defaults to `this.props.children`.
|
|
484
|
+
*/
|
|
485
|
+
}, {
|
|
486
|
+
key: "createLocalEditorPortal",
|
|
487
|
+
value: function createLocalEditorPortal() {
|
|
488
|
+
var children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props.children;
|
|
489
|
+
var editorCache = this.props._getEditorCache();
|
|
490
|
+
var localEditorElement = getExtendedEditorElement(children, editorCache, this.props._columnIndex);
|
|
491
|
+
if (localEditorElement) {
|
|
492
|
+
this.setLocalEditorPortal(createEditorPortal(this.props._getOwnerDocument(), localEditorElement, editorCache));
|
|
493
|
+
}
|
|
494
|
+
}
|
|
397
495
|
/**
|
|
398
496
|
* Emit the column settings to the parent using a prop passed from the parent.
|
|
399
497
|
*/
|
|
@@ -407,6 +505,14 @@ var HotColumn = /*#__PURE__*/function (_React$Component) {
|
|
|
407
505
|
------- React lifecycle methods -------
|
|
408
506
|
---------------------------------------
|
|
409
507
|
*/
|
|
508
|
+
/**
|
|
509
|
+
* Logic performed before the mounting of the HotColumn component.
|
|
510
|
+
*/
|
|
511
|
+
}, {
|
|
512
|
+
key: "componentWillMount",
|
|
513
|
+
value: function componentWillMount() {
|
|
514
|
+
this.createLocalEditorPortal();
|
|
515
|
+
}
|
|
410
516
|
/**
|
|
411
517
|
* Logic performed after the mounting of the HotColumn component.
|
|
412
518
|
*/
|
|
@@ -416,6 +522,14 @@ var HotColumn = /*#__PURE__*/function (_React$Component) {
|
|
|
416
522
|
this.createColumnSettings();
|
|
417
523
|
this.emitColumnSettings();
|
|
418
524
|
}
|
|
525
|
+
/**
|
|
526
|
+
* Logic performed before the updating of the HotColumn component.
|
|
527
|
+
*/
|
|
528
|
+
}, {
|
|
529
|
+
key: "componentWillUpdate",
|
|
530
|
+
value: function componentWillUpdate(nextProps, nextState, nextContext) {
|
|
531
|
+
this.createLocalEditorPortal(nextProps.children);
|
|
532
|
+
}
|
|
419
533
|
/**
|
|
420
534
|
* Logic performed after the updating of the HotColumn component.
|
|
421
535
|
*/
|
|
@@ -433,9 +547,7 @@ var HotColumn = /*#__PURE__*/function (_React$Component) {
|
|
|
433
547
|
}, {
|
|
434
548
|
key: "render",
|
|
435
549
|
value: function render() {
|
|
436
|
-
return React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
437
|
-
editorElement: this.getLocalEditorElement()
|
|
438
|
-
}));
|
|
550
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null, this.getLocalEditorPortal());
|
|
439
551
|
}
|
|
440
552
|
}]);
|
|
441
553
|
return HotColumn;
|
|
@@ -447,10 +559,10 @@ var HotColumn = /*#__PURE__*/function (_React$Component) {
|
|
|
447
559
|
var PortalManager = /*#__PURE__*/function (_React$Component) {
|
|
448
560
|
_inherits(PortalManager, _React$Component);
|
|
449
561
|
var _super = _createSuper(PortalManager);
|
|
450
|
-
function PortalManager() {
|
|
562
|
+
function PortalManager(props) {
|
|
451
563
|
var _this;
|
|
452
564
|
_classCallCheck(this, PortalManager);
|
|
453
|
-
_this = _super.
|
|
565
|
+
_this = _super.call(this, props);
|
|
454
566
|
_this.state = {
|
|
455
567
|
portals: []
|
|
456
568
|
};
|
|
@@ -465,7 +577,7 @@ var PortalManager = /*#__PURE__*/function (_React$Component) {
|
|
|
465
577
|
return PortalManager;
|
|
466
578
|
}(React__default["default"].Component);
|
|
467
579
|
|
|
468
|
-
var version="0.0.0-next-
|
|
580
|
+
var version="0.0.0-next-bbc9650-20230220";
|
|
469
581
|
|
|
470
582
|
function createCommonjsModule(fn, module) {
|
|
471
583
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
@@ -1611,10 +1723,16 @@ var PropTypes = propTypes;
|
|
|
1611
1723
|
var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
1612
1724
|
_inherits(HotTable, _React$Component);
|
|
1613
1725
|
var _super = _createSuper(HotTable);
|
|
1614
|
-
|
|
1726
|
+
/**
|
|
1727
|
+
* HotTable class constructor.
|
|
1728
|
+
*
|
|
1729
|
+
* @param {HotTableProps} props Component props.
|
|
1730
|
+
* @param {*} [context] Component context.
|
|
1731
|
+
*/
|
|
1732
|
+
function HotTable(props, context) {
|
|
1615
1733
|
var _this;
|
|
1616
1734
|
_classCallCheck(this, HotTable);
|
|
1617
|
-
_this = _super.
|
|
1735
|
+
_this = _super.call(this, props, context);
|
|
1618
1736
|
/**
|
|
1619
1737
|
* The `id` of the main Handsontable DOM element.
|
|
1620
1738
|
*
|
|
@@ -1650,6 +1768,13 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
1650
1768
|
* Array containing the portals cashed to be rendered in bulk after Handsontable's render cycle.
|
|
1651
1769
|
*/
|
|
1652
1770
|
_this.portalCacheArray = [];
|
|
1771
|
+
/**
|
|
1772
|
+
* Global editor portal cache.
|
|
1773
|
+
*
|
|
1774
|
+
* @private
|
|
1775
|
+
* @type {React.ReactPortal}
|
|
1776
|
+
*/
|
|
1777
|
+
_this.globalEditorPortal = null;
|
|
1653
1778
|
/**
|
|
1654
1779
|
* The rendered cells cache.
|
|
1655
1780
|
*
|
|
@@ -1672,6 +1797,7 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
1672
1797
|
* @type {Map}
|
|
1673
1798
|
*/
|
|
1674
1799
|
_this.componentRendererColumns = new Map();
|
|
1800
|
+
addUnsafePrefixes(_assertThisInitialized(_this));
|
|
1675
1801
|
return _this;
|
|
1676
1802
|
}
|
|
1677
1803
|
/**
|
|
@@ -1721,14 +1847,37 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
1721
1847
|
value: function getEditorCache() {
|
|
1722
1848
|
return this.editorCache;
|
|
1723
1849
|
}
|
|
1850
|
+
/**
|
|
1851
|
+
* Get the global editor portal property.
|
|
1852
|
+
*
|
|
1853
|
+
* @return {React.ReactPortal} The global editor portal.
|
|
1854
|
+
*/
|
|
1855
|
+
}, {
|
|
1856
|
+
key: "getGlobalEditorPortal",
|
|
1857
|
+
value: function getGlobalEditorPortal() {
|
|
1858
|
+
return this.globalEditorPortal;
|
|
1859
|
+
}
|
|
1860
|
+
/**
|
|
1861
|
+
* Set the private editor portal cache property.
|
|
1862
|
+
*
|
|
1863
|
+
* @param {React.ReactPortal} portal Global editor portal.
|
|
1864
|
+
*/
|
|
1865
|
+
}, {
|
|
1866
|
+
key: "setGlobalEditorPortal",
|
|
1867
|
+
value: function setGlobalEditorPortal(portal) {
|
|
1868
|
+
this.globalEditorPortal = portal;
|
|
1869
|
+
}
|
|
1724
1870
|
/**
|
|
1725
1871
|
* Clear both the editor and the renderer cache.
|
|
1726
1872
|
*/
|
|
1727
1873
|
}, {
|
|
1728
1874
|
key: "clearCache",
|
|
1729
1875
|
value: function clearCache() {
|
|
1876
|
+
var renderedCellCache = this.getRenderedCellCache();
|
|
1877
|
+
this.setGlobalEditorPortal(null);
|
|
1878
|
+
removeEditorContainers(this.getOwnerDocument());
|
|
1730
1879
|
this.getEditorCache().clear();
|
|
1731
|
-
|
|
1880
|
+
renderedCellCache.clear();
|
|
1732
1881
|
this.componentRendererColumns.clear();
|
|
1733
1882
|
}
|
|
1734
1883
|
/**
|
|
@@ -1775,7 +1924,7 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
1775
1924
|
value: value,
|
|
1776
1925
|
cellProperties: cellProperties,
|
|
1777
1926
|
isRenderer: true
|
|
1778
|
-
}, TD.ownerDocument),
|
|
1927
|
+
}, function () {}, TD.ownerDocument),
|
|
1779
1928
|
portal = _createPortal.portal,
|
|
1780
1929
|
portalContainer = _createPortal.portalContainer;
|
|
1781
1930
|
while (TD.firstChild) {
|
|
@@ -1867,17 +2016,34 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
1867
2016
|
}, {
|
|
1868
2017
|
key: "getGlobalRendererElement",
|
|
1869
2018
|
value: function getGlobalRendererElement() {
|
|
1870
|
-
|
|
2019
|
+
var hotTableSlots = this.props.children;
|
|
2020
|
+
return getChildElementByType(hotTableSlots, 'hot-renderer');
|
|
1871
2021
|
}
|
|
1872
2022
|
/**
|
|
1873
2023
|
* Get the editor element for the entire HotTable instance.
|
|
1874
2024
|
*
|
|
2025
|
+
* @param {React.ReactNode} [children] Children of the HotTable instance. Defaults to `this.props.children`.
|
|
1875
2026
|
* @returns {React.ReactElement} React editor component element.
|
|
1876
2027
|
*/
|
|
1877
2028
|
}, {
|
|
1878
2029
|
key: "getGlobalEditorElement",
|
|
1879
2030
|
value: function getGlobalEditorElement() {
|
|
1880
|
-
|
|
2031
|
+
var children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props.children;
|
|
2032
|
+
return getExtendedEditorElement(children, this.getEditorCache());
|
|
2033
|
+
}
|
|
2034
|
+
/**
|
|
2035
|
+
* Create the global editor portal and its destination HTML element if needed.
|
|
2036
|
+
*
|
|
2037
|
+
* @param {React.ReactNode} [children] Children of the HotTable instance. Defaults to `this.props.children`.
|
|
2038
|
+
*/
|
|
2039
|
+
}, {
|
|
2040
|
+
key: "createGlobalEditorPortal",
|
|
2041
|
+
value: function createGlobalEditorPortal() {
|
|
2042
|
+
var children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props.children;
|
|
2043
|
+
var globalEditorElement = this.getGlobalEditorElement(children);
|
|
2044
|
+
if (globalEditorElement) {
|
|
2045
|
+
this.setGlobalEditorPortal(createEditorPortal(this.getOwnerDocument(), globalEditorElement, this.getEditorCache()));
|
|
2046
|
+
}
|
|
1881
2047
|
}
|
|
1882
2048
|
/**
|
|
1883
2049
|
* Create a new settings object containing the column settings and global editors and renderers.
|
|
@@ -1980,25 +2146,44 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
1980
2146
|
------- React lifecycle methods -------
|
|
1981
2147
|
---------------------------------------
|
|
1982
2148
|
*/
|
|
2149
|
+
/**
|
|
2150
|
+
* Logic performed before the mounting of the component.
|
|
2151
|
+
*/
|
|
2152
|
+
}, {
|
|
2153
|
+
key: "componentWillMount",
|
|
2154
|
+
value: function componentWillMount() {
|
|
2155
|
+
this.clearCache();
|
|
2156
|
+
this.createGlobalEditorPortal();
|
|
2157
|
+
}
|
|
1983
2158
|
/**
|
|
1984
2159
|
* Initialize Handsontable after the component has mounted.
|
|
1985
2160
|
*/
|
|
1986
2161
|
}, {
|
|
1987
2162
|
key: "componentDidMount",
|
|
1988
2163
|
value: function componentDidMount() {
|
|
1989
|
-
var
|
|
2164
|
+
var hotTableComponent = this;
|
|
1990
2165
|
var newGlobalSettings = this.createNewGlobalSettings();
|
|
1991
2166
|
this.hotInstance = new Handsontable__default["default"].Core(this.hotElementRef, newGlobalSettings);
|
|
1992
|
-
this.hotInstance.addHook('beforeViewRender', function () {
|
|
1993
|
-
|
|
2167
|
+
this.hotInstance.addHook('beforeViewRender', function (isForced) {
|
|
2168
|
+
hotTableComponent.handsontableBeforeViewRender();
|
|
1994
2169
|
});
|
|
1995
2170
|
this.hotInstance.addHook('afterViewRender', function () {
|
|
1996
|
-
|
|
2171
|
+
hotTableComponent.handsontableAfterViewRender();
|
|
1997
2172
|
});
|
|
1998
2173
|
// `init` missing in Handsontable's type definitions.
|
|
1999
2174
|
this.hotInstance.init();
|
|
2000
2175
|
this.displayAutoSizeWarning(newGlobalSettings);
|
|
2001
2176
|
}
|
|
2177
|
+
/**
|
|
2178
|
+
* Logic performed before the component update.
|
|
2179
|
+
*/
|
|
2180
|
+
}, {
|
|
2181
|
+
key: "componentWillUpdate",
|
|
2182
|
+
value: function componentWillUpdate(nextProps, nextState, nextContext) {
|
|
2183
|
+
this.clearCache();
|
|
2184
|
+
removeEditorContainers(this.getOwnerDocument());
|
|
2185
|
+
this.createGlobalEditorPortal(nextProps.children);
|
|
2186
|
+
}
|
|
2002
2187
|
/**
|
|
2003
2188
|
* Logic performed after the component update.
|
|
2004
2189
|
*/
|
|
@@ -2015,10 +2200,10 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
2015
2200
|
}, {
|
|
2016
2201
|
key: "componentWillUnmount",
|
|
2017
2202
|
value: function componentWillUnmount() {
|
|
2018
|
-
this.clearCache();
|
|
2019
2203
|
if (this.hotInstance) {
|
|
2020
2204
|
this.hotInstance.destroy();
|
|
2021
2205
|
}
|
|
2206
|
+
removeEditorContainers(this.getOwnerDocument());
|
|
2022
2207
|
}
|
|
2023
2208
|
/**
|
|
2024
2209
|
* Render the component.
|
|
@@ -2026,8 +2211,11 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
2026
2211
|
}, {
|
|
2027
2212
|
key: "render",
|
|
2028
2213
|
value: function render() {
|
|
2029
|
-
var
|
|
2030
|
-
var
|
|
2214
|
+
var _this4 = this;
|
|
2215
|
+
var _getContainerAttribut = getContainerAttributesProps(this.props),
|
|
2216
|
+
id = _getContainerAttribut.id,
|
|
2217
|
+
className = _getContainerAttribut.className,
|
|
2218
|
+
style = _getContainerAttribut.style;
|
|
2031
2219
|
var isHotColumn = function isHotColumn(childNode) {
|
|
2032
2220
|
return childNode.type === HotColumn;
|
|
2033
2221
|
};
|
|
@@ -2039,22 +2227,25 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
2039
2227
|
// clone the HotColumn nodes and extend them with the callbacks
|
|
2040
2228
|
var childClones = children.map(function (childNode, columnIndex) {
|
|
2041
2229
|
return React__default["default"].cloneElement(childNode, {
|
|
2042
|
-
_componentRendererColumns:
|
|
2043
|
-
_emitColumnSettings:
|
|
2230
|
+
_componentRendererColumns: _this4.componentRendererColumns,
|
|
2231
|
+
_emitColumnSettings: _this4.setHotColumnSettings.bind(_this4),
|
|
2044
2232
|
_columnIndex: columnIndex,
|
|
2045
|
-
_getChildElementByType: getChildElementByType.bind(
|
|
2046
|
-
_getRendererWrapper:
|
|
2047
|
-
_getEditorClass:
|
|
2048
|
-
_getOwnerDocument:
|
|
2049
|
-
_getEditorCache:
|
|
2233
|
+
_getChildElementByType: getChildElementByType.bind(_this4),
|
|
2234
|
+
_getRendererWrapper: _this4.getRendererWrapper.bind(_this4),
|
|
2235
|
+
_getEditorClass: _this4.getEditorClass.bind(_this4),
|
|
2236
|
+
_getOwnerDocument: _this4.getOwnerDocument.bind(_this4),
|
|
2237
|
+
_getEditorCache: _this4.getEditorCache.bind(_this4),
|
|
2050
2238
|
children: childNode.props.children
|
|
2051
2239
|
});
|
|
2052
2240
|
});
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2241
|
+
// add the global editor to the list of children
|
|
2242
|
+
childClones.push(this.getGlobalEditorPortal());
|
|
2243
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement("div", {
|
|
2244
|
+
ref: this.setHotElementRef.bind(this),
|
|
2245
|
+
id: id,
|
|
2246
|
+
className: className,
|
|
2247
|
+
style: style
|
|
2248
|
+
}, childClones), React__default["default"].createElement(PortalManager, {
|
|
2058
2249
|
ref: this.setPortalManagerRef.bind(this)
|
|
2059
2250
|
}));
|
|
2060
2251
|
}
|