@handsontable/react 0.0.0-next-b0410df-20240415 → 0.0.0-next-c99a89d-20240418
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 +50 -9
- package/dist/react-handsontable.js +51 -10
- 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 +50 -9
- package/hotTableClass.d.ts +11 -2
- package/package.json +5 -5
- package/settingsMapper.d.ts +8 -1
|
@@ -373,20 +373,37 @@ var SettingsMapper = /*#__PURE__*/function () {
|
|
|
373
373
|
* Parse component settings into Handosntable-compatible settings.
|
|
374
374
|
*
|
|
375
375
|
* @param {Object} properties Object containing properties from the HotTable object.
|
|
376
|
+
* @param {Object} additionalSettings Additional settings.
|
|
377
|
+
* @param {boolean} additionalSettings.isInit Flag determining whether the settings are being set during initialization.
|
|
378
|
+
* @param {string[]} additionalSettings.initOnlySettingKeys Array of keys that can be set only during initialization.
|
|
376
379
|
* @returns {Object} Handsontable-compatible settings object.
|
|
377
380
|
*/
|
|
378
381
|
function getSettings(properties) {
|
|
382
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
383
|
+
_ref$prevProps = _ref.prevProps,
|
|
384
|
+
prevProps = _ref$prevProps === void 0 ? {} : _ref$prevProps,
|
|
385
|
+
_ref$isInit = _ref.isInit,
|
|
386
|
+
isInit = _ref$isInit === void 0 ? false : _ref$isInit,
|
|
387
|
+
_ref$initOnlySettingK = _ref.initOnlySettingKeys,
|
|
388
|
+
initOnlySettingKeys = _ref$initOnlySettingK === void 0 ? [] : _ref$initOnlySettingK;
|
|
389
|
+
var shouldSkipProp = function shouldSkipProp(key) {
|
|
390
|
+
// Omit settings that can be set only during initialization and are intentionally modified.
|
|
391
|
+
if (!isInit && initOnlySettingKeys.includes(key)) {
|
|
392
|
+
return prevProps[key] === properties[key];
|
|
393
|
+
}
|
|
394
|
+
return false;
|
|
395
|
+
};
|
|
379
396
|
var newSettings = {};
|
|
380
397
|
if (properties.settings) {
|
|
381
398
|
var settings = properties.settings;
|
|
382
399
|
for (var key in settings) {
|
|
383
|
-
if (settings.hasOwnProperty(key)) {
|
|
400
|
+
if (settings.hasOwnProperty(key) && !shouldSkipProp(key)) {
|
|
384
401
|
newSettings[key] = settings[key];
|
|
385
402
|
}
|
|
386
403
|
}
|
|
387
404
|
}
|
|
388
405
|
for (var _key in properties) {
|
|
389
|
-
if (_key !== 'settings' && _key !== 'children' && properties.hasOwnProperty(_key)) {
|
|
406
|
+
if (_key !== 'settings' && _key !== 'children' && !shouldSkipProp(_key) && properties.hasOwnProperty(_key)) {
|
|
390
407
|
newSettings[_key] = properties[_key];
|
|
391
408
|
}
|
|
392
409
|
}
|
|
@@ -514,7 +531,7 @@ var RenderersPortalManager = /*#__PURE__*/function (_React$Component) {
|
|
|
514
531
|
}]);
|
|
515
532
|
}(React__default["default"].Component);
|
|
516
533
|
|
|
517
|
-
var version="0.0.0-next-
|
|
534
|
+
var version="0.0.0-next-c99a89d-20240418";
|
|
518
535
|
|
|
519
536
|
function createCommonjsModule(fn, module) {
|
|
520
537
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
@@ -1752,11 +1769,18 @@ var HotTableClass = /*#__PURE__*/function (_React$Component) {
|
|
|
1752
1769
|
return null;
|
|
1753
1770
|
}
|
|
1754
1771
|
}
|
|
1772
|
+
/**
|
|
1773
|
+
* Returns `true` if the `hotInstance` exists, but was destroyed.
|
|
1774
|
+
*
|
|
1775
|
+
* @private
|
|
1776
|
+
* @returns {boolean}
|
|
1777
|
+
*/,
|
|
1778
|
+
set:
|
|
1755
1779
|
/**
|
|
1756
1780
|
* Setter for the property storing the Handsontable instance.
|
|
1757
1781
|
* @param {Handsontable} hotInstance The Handsontable instance.
|
|
1758
|
-
|
|
1759
|
-
|
|
1782
|
+
*/
|
|
1783
|
+
function set(hotInstance) {
|
|
1760
1784
|
this.__hotInstance = hotInstance;
|
|
1761
1785
|
}
|
|
1762
1786
|
/**
|
|
@@ -1764,6 +1788,11 @@ var HotTableClass = /*#__PURE__*/function (_React$Component) {
|
|
|
1764
1788
|
*
|
|
1765
1789
|
* @returns {Map}
|
|
1766
1790
|
*/
|
|
1791
|
+
}, {
|
|
1792
|
+
key: "_isHotInstanceDestroyed",
|
|
1793
|
+
value: function _isHotInstanceDestroyed() {
|
|
1794
|
+
return this.__hotInstance && this.__hotInstance.isDestroyed;
|
|
1795
|
+
}
|
|
1767
1796
|
}, {
|
|
1768
1797
|
key: "getPortalContainerCache",
|
|
1769
1798
|
value: function getPortalContainerCache() {
|
|
@@ -1964,12 +1993,24 @@ var HotTableClass = /*#__PURE__*/function (_React$Component) {
|
|
|
1964
1993
|
/**
|
|
1965
1994
|
* Create a new settings object containing the column settings and global editors and renderers.
|
|
1966
1995
|
*
|
|
1996
|
+
* @param {boolean} [init=false] `true` if called on Handsontable initialization.
|
|
1997
|
+
* @param {HotTableProps} [prevProps] The previous properties object.
|
|
1967
1998
|
* @returns {Handsontable.GridSettings} New global set of settings for Handsontable.
|
|
1968
1999
|
*/
|
|
1969
2000
|
}, {
|
|
1970
2001
|
key: "createNewGlobalSettings",
|
|
1971
2002
|
value: function createNewGlobalSettings() {
|
|
1972
|
-
var
|
|
2003
|
+
var _this$hotInstance;
|
|
2004
|
+
var init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
2005
|
+
var prevProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2006
|
+
var initOnlySettingKeys = !this._isHotInstanceDestroyed() ?
|
|
2007
|
+
// Needed for React's double-rendering.
|
|
2008
|
+
((_this$hotInstance = this.hotInstance) === null || _this$hotInstance === void 0 || (_this$hotInstance = _this$hotInstance.getSettings()) === null || _this$hotInstance === void 0 ? void 0 : _this$hotInstance._initOnlySettings) || [] : [];
|
|
2009
|
+
var newSettings = SettingsMapper.getSettings(this.props, {
|
|
2010
|
+
prevProps: prevProps,
|
|
2011
|
+
isInit: init,
|
|
2012
|
+
initOnlySettingKeys: initOnlySettingKeys
|
|
2013
|
+
});
|
|
1973
2014
|
var globalRendererNode = this.getGlobalRendererElement();
|
|
1974
2015
|
var globalEditorNode = this.getGlobalEditorElement();
|
|
1975
2016
|
newSettings.columns = this.columnSettings.length ? this.columnSettings : newSettings.columns;
|
|
@@ -2075,7 +2116,7 @@ var HotTableClass = /*#__PURE__*/function (_React$Component) {
|
|
|
2075
2116
|
key: "componentDidMount",
|
|
2076
2117
|
value: function componentDidMount() {
|
|
2077
2118
|
var _this3 = this;
|
|
2078
|
-
var newGlobalSettings = this.createNewGlobalSettings();
|
|
2119
|
+
var newGlobalSettings = this.createNewGlobalSettings(true);
|
|
2079
2120
|
this.hotInstance = new Handsontable__default["default"].Core(this.hotElementRef, newGlobalSettings);
|
|
2080
2121
|
this.hotInstance.addHook('beforeViewRender', function () {
|
|
2081
2122
|
return _this3.handsontableBeforeViewRender();
|
|
@@ -2092,9 +2133,9 @@ var HotTableClass = /*#__PURE__*/function (_React$Component) {
|
|
|
2092
2133
|
*/
|
|
2093
2134
|
}, {
|
|
2094
2135
|
key: "componentDidUpdate",
|
|
2095
|
-
value: function componentDidUpdate() {
|
|
2136
|
+
value: function componentDidUpdate(prevProps) {
|
|
2096
2137
|
this.clearCache();
|
|
2097
|
-
var newGlobalSettings = this.createNewGlobalSettings();
|
|
2138
|
+
var newGlobalSettings = this.createNewGlobalSettings(false, prevProps);
|
|
2098
2139
|
this.updateHot(newGlobalSettings);
|
|
2099
2140
|
this.displayAutoSizeWarning(newGlobalSettings);
|
|
2100
2141
|
}
|
|
@@ -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-c99a89d-20240418 (built at Thu Apr 18 2024 11:01:15 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'), require('handsontable/renderers/registry'), require('handsontable/editors/registry')) :
|
|
@@ -398,20 +398,37 @@ var SettingsMapper = /*#__PURE__*/function () {
|
|
|
398
398
|
* Parse component settings into Handosntable-compatible settings.
|
|
399
399
|
*
|
|
400
400
|
* @param {Object} properties Object containing properties from the HotTable object.
|
|
401
|
+
* @param {Object} additionalSettings Additional settings.
|
|
402
|
+
* @param {boolean} additionalSettings.isInit Flag determining whether the settings are being set during initialization.
|
|
403
|
+
* @param {string[]} additionalSettings.initOnlySettingKeys Array of keys that can be set only during initialization.
|
|
401
404
|
* @returns {Object} Handsontable-compatible settings object.
|
|
402
405
|
*/
|
|
403
406
|
function getSettings(properties) {
|
|
407
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
408
|
+
_ref$prevProps = _ref.prevProps,
|
|
409
|
+
prevProps = _ref$prevProps === void 0 ? {} : _ref$prevProps,
|
|
410
|
+
_ref$isInit = _ref.isInit,
|
|
411
|
+
isInit = _ref$isInit === void 0 ? false : _ref$isInit,
|
|
412
|
+
_ref$initOnlySettingK = _ref.initOnlySettingKeys,
|
|
413
|
+
initOnlySettingKeys = _ref$initOnlySettingK === void 0 ? [] : _ref$initOnlySettingK;
|
|
414
|
+
var shouldSkipProp = function shouldSkipProp(key) {
|
|
415
|
+
// Omit settings that can be set only during initialization and are intentionally modified.
|
|
416
|
+
if (!isInit && initOnlySettingKeys.includes(key)) {
|
|
417
|
+
return prevProps[key] === properties[key];
|
|
418
|
+
}
|
|
419
|
+
return false;
|
|
420
|
+
};
|
|
404
421
|
var newSettings = {};
|
|
405
422
|
if (properties.settings) {
|
|
406
423
|
var settings = properties.settings;
|
|
407
424
|
for (var key in settings) {
|
|
408
|
-
if (settings.hasOwnProperty(key)) {
|
|
425
|
+
if (settings.hasOwnProperty(key) && !shouldSkipProp(key)) {
|
|
409
426
|
newSettings[key] = settings[key];
|
|
410
427
|
}
|
|
411
428
|
}
|
|
412
429
|
}
|
|
413
430
|
for (var _key in properties) {
|
|
414
|
-
if (_key !== 'settings' && _key !== 'children' && properties.hasOwnProperty(_key)) {
|
|
431
|
+
if (_key !== 'settings' && _key !== 'children' && !shouldSkipProp(_key) && properties.hasOwnProperty(_key)) {
|
|
415
432
|
newSettings[_key] = properties[_key];
|
|
416
433
|
}
|
|
417
434
|
}
|
|
@@ -539,7 +556,7 @@ var RenderersPortalManager = /*#__PURE__*/function (_React$Component) {
|
|
|
539
556
|
}]);
|
|
540
557
|
}(React__default["default"].Component);
|
|
541
558
|
|
|
542
|
-
var version="0.0.0-next-
|
|
559
|
+
var version="0.0.0-next-c99a89d-20240418";
|
|
543
560
|
|
|
544
561
|
function createCommonjsModule(fn, module) {
|
|
545
562
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
@@ -999,11 +1016,18 @@ var HotTableClass = /*#__PURE__*/function (_React$Component) {
|
|
|
999
1016
|
return null;
|
|
1000
1017
|
}
|
|
1001
1018
|
}
|
|
1019
|
+
/**
|
|
1020
|
+
* Returns `true` if the `hotInstance` exists, but was destroyed.
|
|
1021
|
+
*
|
|
1022
|
+
* @private
|
|
1023
|
+
* @returns {boolean}
|
|
1024
|
+
*/,
|
|
1025
|
+
set:
|
|
1002
1026
|
/**
|
|
1003
1027
|
* Setter for the property storing the Handsontable instance.
|
|
1004
1028
|
* @param {Handsontable} hotInstance The Handsontable instance.
|
|
1005
|
-
|
|
1006
|
-
|
|
1029
|
+
*/
|
|
1030
|
+
function set(hotInstance) {
|
|
1007
1031
|
this.__hotInstance = hotInstance;
|
|
1008
1032
|
}
|
|
1009
1033
|
/**
|
|
@@ -1011,6 +1035,11 @@ var HotTableClass = /*#__PURE__*/function (_React$Component) {
|
|
|
1011
1035
|
*
|
|
1012
1036
|
* @returns {Map}
|
|
1013
1037
|
*/
|
|
1038
|
+
}, {
|
|
1039
|
+
key: "_isHotInstanceDestroyed",
|
|
1040
|
+
value: function _isHotInstanceDestroyed() {
|
|
1041
|
+
return this.__hotInstance && this.__hotInstance.isDestroyed;
|
|
1042
|
+
}
|
|
1014
1043
|
}, {
|
|
1015
1044
|
key: "getPortalContainerCache",
|
|
1016
1045
|
value: function getPortalContainerCache() {
|
|
@@ -1211,12 +1240,24 @@ var HotTableClass = /*#__PURE__*/function (_React$Component) {
|
|
|
1211
1240
|
/**
|
|
1212
1241
|
* Create a new settings object containing the column settings and global editors and renderers.
|
|
1213
1242
|
*
|
|
1243
|
+
* @param {boolean} [init=false] `true` if called on Handsontable initialization.
|
|
1244
|
+
* @param {HotTableProps} [prevProps] The previous properties object.
|
|
1214
1245
|
* @returns {Handsontable.GridSettings} New global set of settings for Handsontable.
|
|
1215
1246
|
*/
|
|
1216
1247
|
}, {
|
|
1217
1248
|
key: "createNewGlobalSettings",
|
|
1218
1249
|
value: function createNewGlobalSettings() {
|
|
1219
|
-
var
|
|
1250
|
+
var _this$hotInstance;
|
|
1251
|
+
var init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
1252
|
+
var prevProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1253
|
+
var initOnlySettingKeys = !this._isHotInstanceDestroyed() ?
|
|
1254
|
+
// Needed for React's double-rendering.
|
|
1255
|
+
((_this$hotInstance = this.hotInstance) === null || _this$hotInstance === void 0 || (_this$hotInstance = _this$hotInstance.getSettings()) === null || _this$hotInstance === void 0 ? void 0 : _this$hotInstance._initOnlySettings) || [] : [];
|
|
1256
|
+
var newSettings = SettingsMapper.getSettings(this.props, {
|
|
1257
|
+
prevProps: prevProps,
|
|
1258
|
+
isInit: init,
|
|
1259
|
+
initOnlySettingKeys: initOnlySettingKeys
|
|
1260
|
+
});
|
|
1220
1261
|
var globalRendererNode = this.getGlobalRendererElement();
|
|
1221
1262
|
var globalEditorNode = this.getGlobalEditorElement();
|
|
1222
1263
|
newSettings.columns = this.columnSettings.length ? this.columnSettings : newSettings.columns;
|
|
@@ -1322,7 +1363,7 @@ var HotTableClass = /*#__PURE__*/function (_React$Component) {
|
|
|
1322
1363
|
key: "componentDidMount",
|
|
1323
1364
|
value: function componentDidMount() {
|
|
1324
1365
|
var _this3 = this;
|
|
1325
|
-
var newGlobalSettings = this.createNewGlobalSettings();
|
|
1366
|
+
var newGlobalSettings = this.createNewGlobalSettings(true);
|
|
1326
1367
|
this.hotInstance = new Handsontable__default["default"].Core(this.hotElementRef, newGlobalSettings);
|
|
1327
1368
|
this.hotInstance.addHook('beforeViewRender', function () {
|
|
1328
1369
|
return _this3.handsontableBeforeViewRender();
|
|
@@ -1339,9 +1380,9 @@ var HotTableClass = /*#__PURE__*/function (_React$Component) {
|
|
|
1339
1380
|
*/
|
|
1340
1381
|
}, {
|
|
1341
1382
|
key: "componentDidUpdate",
|
|
1342
|
-
value: function componentDidUpdate() {
|
|
1383
|
+
value: function componentDidUpdate(prevProps) {
|
|
1343
1384
|
this.clearCache();
|
|
1344
|
-
var newGlobalSettings = this.createNewGlobalSettings();
|
|
1385
|
+
var newGlobalSettings = this.createNewGlobalSettings(false, prevProps);
|
|
1345
1386
|
this.updateHot(newGlobalSettings);
|
|
1346
1387
|
this.displayAutoSizeWarning(newGlobalSettings);
|
|
1347
1388
|
}
|