@handsontable/react 9.0.2 → 11.1.0
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/LICENSE.txt +19 -22
- package/README.md +11 -10
- package/baseEditorComponent.d.ts +2 -2
- package/commonjs/react-handsontable.js +152 -118
- package/dist/react-handsontable.js +139 -129
- package/dist/react-handsontable.js.map +1 -1
- package/dist/react-handsontable.min.js +21 -24
- package/dist/react-handsontable.min.js.map +1 -1
- package/es/react-handsontable.js +108 -75
- package/handsontable-non-commercial-license.pdf +0 -0
- package/helpers.d.ts +9 -3
- package/hotColumn.d.ts +1 -1
- package/hotTable.d.ts +11 -9
- package/package.json +5 -5
- package/settingsMapper.d.ts +1 -1
- package/types.d.ts +12 -4
- package/handsontable-general-terms.pdf +0 -0
package/es/react-handsontable.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ReactDOM from 'react-dom';
|
|
3
|
-
import Handsontable from 'handsontable';
|
|
3
|
+
import Handsontable from 'handsontable/base';
|
|
4
4
|
|
|
5
5
|
function ownKeys(object, enumerableOnly) {
|
|
6
6
|
var keys = Object.keys(object);
|
|
7
7
|
|
|
8
8
|
if (Object.getOwnPropertySymbols) {
|
|
9
9
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
keys.push.apply(keys, symbols);
|
|
10
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
11
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
12
|
+
})), keys.push.apply(keys, symbols);
|
|
18
13
|
}
|
|
19
14
|
|
|
20
15
|
return keys;
|
|
@@ -22,19 +17,12 @@ function ownKeys(object, enumerableOnly) {
|
|
|
22
17
|
|
|
23
18
|
function _objectSpread2(target) {
|
|
24
19
|
for (var i = 1; i < arguments.length; i++) {
|
|
25
|
-
var source = arguments[i]
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
32
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
33
|
-
} else {
|
|
34
|
-
ownKeys(Object(source)).forEach(function (key) {
|
|
35
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
36
|
-
});
|
|
37
|
-
}
|
|
20
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
21
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
22
|
+
_defineProperty(target, key, source[key]);
|
|
23
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
24
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
25
|
+
});
|
|
38
26
|
}
|
|
39
27
|
|
|
40
28
|
return target;
|
|
@@ -43,17 +31,11 @@ function _objectSpread2(target) {
|
|
|
43
31
|
function _typeof(obj) {
|
|
44
32
|
"@babel/helpers - typeof";
|
|
45
33
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
_typeof = function (obj) {
|
|
52
|
-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return _typeof(obj);
|
|
34
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
35
|
+
return typeof obj;
|
|
36
|
+
} : function (obj) {
|
|
37
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
38
|
+
}, _typeof(obj);
|
|
57
39
|
}
|
|
58
40
|
|
|
59
41
|
function _classCallCheck(instance, Constructor) {
|
|
@@ -75,6 +57,9 @@ function _defineProperties(target, props) {
|
|
|
75
57
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
76
58
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
77
59
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
60
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
61
|
+
writable: false
|
|
62
|
+
});
|
|
78
63
|
return Constructor;
|
|
79
64
|
}
|
|
80
65
|
|
|
@@ -105,6 +90,9 @@ function _inherits(subClass, superClass) {
|
|
|
105
90
|
configurable: true
|
|
106
91
|
}
|
|
107
92
|
});
|
|
93
|
+
Object.defineProperty(subClass, "prototype", {
|
|
94
|
+
writable: false
|
|
95
|
+
});
|
|
108
96
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
109
97
|
}
|
|
110
98
|
|
|
@@ -148,6 +136,8 @@ function _assertThisInitialized(self) {
|
|
|
148
136
|
function _possibleConstructorReturn(self, call) {
|
|
149
137
|
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
150
138
|
return call;
|
|
139
|
+
} else if (call !== void 0) {
|
|
140
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
151
141
|
}
|
|
152
142
|
|
|
153
143
|
return _assertThisInitialized(self);
|
|
@@ -183,6 +173,11 @@ var AUTOSIZE_WARNING = 'Your `HotTable` configuration includes `autoRowSize`/`au
|
|
|
183
173
|
*/
|
|
184
174
|
|
|
185
175
|
var HOT_DESTROYED_WARNING = 'The Handsontable instance bound to this component was destroyed and cannot be' + ' used properly.';
|
|
176
|
+
/**
|
|
177
|
+
* String identifier for the global-scoped editor components.
|
|
178
|
+
*/
|
|
179
|
+
|
|
180
|
+
var GLOBAL_EDITOR_SCOPE = 'global';
|
|
186
181
|
/**
|
|
187
182
|
* Default classname given to the wrapper container.
|
|
188
183
|
*/
|
|
@@ -297,10 +292,13 @@ function createEditorPortal() {
|
|
|
297
292
|
*
|
|
298
293
|
* @param {React.ReactNode} children Component children.
|
|
299
294
|
* @param {Map} editorCache Component's editor cache.
|
|
295
|
+
* @param {string|number} [editorColumnScope] The editor scope (column index or a 'global' string). Defaults to
|
|
296
|
+
* 'global'.
|
|
300
297
|
* @returns {React.ReactElement} An editor element containing the additional methods.
|
|
301
298
|
*/
|
|
302
299
|
|
|
303
300
|
function getExtendedEditorElement(children, editorCache) {
|
|
301
|
+
var editorColumnScope = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : GLOBAL_EDITOR_SCOPE;
|
|
304
302
|
var editorElement = getChildElementByType(children, 'hot-editor');
|
|
305
303
|
var editorClass = getOriginalEditorClass(editorElement);
|
|
306
304
|
|
|
@@ -309,9 +307,15 @@ function getExtendedEditorElement(children, editorCache) {
|
|
|
309
307
|
}
|
|
310
308
|
|
|
311
309
|
return React.cloneElement(editorElement, {
|
|
312
|
-
emitEditorInstance: function emitEditorInstance(editorInstance) {
|
|
313
|
-
editorCache.
|
|
310
|
+
emitEditorInstance: function emitEditorInstance(editorInstance, editorColumnScope) {
|
|
311
|
+
if (!editorCache.get(editorClass)) {
|
|
312
|
+
editorCache.set(editorClass, new Map());
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
var cacheEntry = editorCache.get(editorClass);
|
|
316
|
+
cacheEntry.set(editorColumnScope !== null && editorColumnScope !== void 0 ? editorColumnScope : GLOBAL_EDITOR_SCOPE, editorInstance);
|
|
314
317
|
},
|
|
318
|
+
editorColumnScope: editorColumnScope,
|
|
315
319
|
isEditor: true
|
|
316
320
|
});
|
|
317
321
|
}
|
|
@@ -515,7 +519,7 @@ var HotColumn = /*#__PURE__*/function (_React$Component) {
|
|
|
515
519
|
}, {
|
|
516
520
|
key: "getLocalEditorElement",
|
|
517
521
|
value: function getLocalEditorElement() {
|
|
518
|
-
return getExtendedEditorElement(this.props.children, this.props._getEditorCache());
|
|
522
|
+
return getExtendedEditorElement(this.props.children, this.props._getEditorCache(), this.props._columnIndex);
|
|
519
523
|
}
|
|
520
524
|
/**
|
|
521
525
|
* Create the column settings based on the data provided to the `HotColumn` component and it's child components.
|
|
@@ -540,7 +544,7 @@ var HotColumn = /*#__PURE__*/function (_React$Component) {
|
|
|
540
544
|
}
|
|
541
545
|
|
|
542
546
|
if (editorElement !== null) {
|
|
543
|
-
this.columnSettings.editor = this.props._getEditorClass(editorElement);
|
|
547
|
+
this.columnSettings.editor = this.props._getEditorClass(editorElement, this.props._columnIndex);
|
|
544
548
|
} else if (this.hasProp('editor')) {
|
|
545
549
|
this.columnSettings.editor = this.props.editor;
|
|
546
550
|
} else {
|
|
@@ -560,7 +564,7 @@ var HotColumn = /*#__PURE__*/function (_React$Component) {
|
|
|
560
564
|
|
|
561
565
|
var editorCache = this.props._getEditorCache();
|
|
562
566
|
|
|
563
|
-
var localEditorElement = getExtendedEditorElement(children, editorCache);
|
|
567
|
+
var localEditorElement = getExtendedEditorElement(children, editorCache, this.props._columnIndex);
|
|
564
568
|
|
|
565
569
|
if (localEditorElement) {
|
|
566
570
|
this.setLocalEditorPortal(createEditorPortal(this.props._getOwnerDocument(), localEditorElement, editorCache));
|
|
@@ -666,7 +670,7 @@ var PortalManager = /*#__PURE__*/function (_React$Component) {
|
|
|
666
670
|
return PortalManager;
|
|
667
671
|
}(React.Component);
|
|
668
672
|
|
|
669
|
-
var version="
|
|
673
|
+
var version="11.1.0";
|
|
670
674
|
|
|
671
675
|
function createCommonjsModule(fn, module) {
|
|
672
676
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
@@ -1164,12 +1168,14 @@ var objectAssign = shouldUseNative() ? Object.assign : function (target, source)
|
|
|
1164
1168
|
var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
1165
1169
|
var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
1166
1170
|
|
|
1171
|
+
var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
1172
|
+
|
|
1167
1173
|
var printWarning$1 = function printWarning() {};
|
|
1168
1174
|
|
|
1169
1175
|
if (process.env.NODE_ENV !== 'production') {
|
|
1170
1176
|
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
1171
1177
|
var loggedTypeFailures = {};
|
|
1172
|
-
var has
|
|
1178
|
+
var has = has$1;
|
|
1173
1179
|
|
|
1174
1180
|
printWarning$1 = function printWarning(text) {
|
|
1175
1181
|
var message = 'Warning: ' + text;
|
|
@@ -1183,7 +1189,9 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
1183
1189
|
// This error was thrown as a convenience so that you can use this stack
|
|
1184
1190
|
// to find the callsite that caused this warning to fire.
|
|
1185
1191
|
throw new Error(message);
|
|
1186
|
-
} catch (x) {
|
|
1192
|
+
} catch (x) {
|
|
1193
|
+
/**/
|
|
1194
|
+
}
|
|
1187
1195
|
};
|
|
1188
1196
|
}
|
|
1189
1197
|
/**
|
|
@@ -1202,7 +1210,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
1202
1210
|
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
1203
1211
|
if (process.env.NODE_ENV !== 'production') {
|
|
1204
1212
|
for (var typeSpecName in typeSpecs) {
|
|
1205
|
-
if (has
|
|
1213
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
1206
1214
|
var error; // Prop type validation may throw. In case they do, we don't want to
|
|
1207
1215
|
// fail the render phase where it didn't fail before. So we log it.
|
|
1208
1216
|
// After these have been cleaned up, we'll let them throw.
|
|
@@ -1211,7 +1219,7 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
|
1211
1219
|
// This is intentionally an invariant that gets caught. It's the same
|
|
1212
1220
|
// behavior as without this statement except with a better message.
|
|
1213
1221
|
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
1214
|
-
var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + _typeof(typeSpecs[typeSpecName]) + '`.');
|
|
1222
|
+
var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + _typeof(typeSpecs[typeSpecName]) + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
|
|
1215
1223
|
err.name = 'Invariant Violation';
|
|
1216
1224
|
throw err;
|
|
1217
1225
|
}
|
|
@@ -1251,8 +1259,6 @@ checkPropTypes.resetWarningCache = function () {
|
|
|
1251
1259
|
|
|
1252
1260
|
var checkPropTypes_1 = checkPropTypes;
|
|
1253
1261
|
|
|
1254
|
-
var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
1255
|
-
|
|
1256
1262
|
var printWarning = function printWarning() {};
|
|
1257
1263
|
|
|
1258
1264
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -1356,6 +1362,7 @@ var factoryWithTypeCheckers = function factoryWithTypeCheckers(isValidElement, t
|
|
|
1356
1362
|
|
|
1357
1363
|
var ReactPropTypes = {
|
|
1358
1364
|
array: createPrimitiveTypeChecker('array'),
|
|
1365
|
+
bigint: createPrimitiveTypeChecker('bigint'),
|
|
1359
1366
|
bool: createPrimitiveTypeChecker('boolean'),
|
|
1360
1367
|
func: createPrimitiveTypeChecker('function'),
|
|
1361
1368
|
number: createPrimitiveTypeChecker('number'),
|
|
@@ -1403,8 +1410,9 @@ var factoryWithTypeCheckers = function factoryWithTypeCheckers(isValidElement, t
|
|
|
1403
1410
|
*/
|
|
1404
1411
|
|
|
1405
1412
|
|
|
1406
|
-
function PropTypeError(message) {
|
|
1413
|
+
function PropTypeError(message, data) {
|
|
1407
1414
|
this.message = message;
|
|
1415
|
+
this.data = data && _typeof(data) === 'object' ? data : {};
|
|
1408
1416
|
this.stack = '';
|
|
1409
1417
|
} // Make `instanceof Error` still work for returned errors.
|
|
1410
1418
|
|
|
@@ -1470,7 +1478,9 @@ var factoryWithTypeCheckers = function factoryWithTypeCheckers(isValidElement, t
|
|
|
1470
1478
|
// check, but we can offer a more precise error message here rather than
|
|
1471
1479
|
// 'of type `object`'.
|
|
1472
1480
|
var preciseType = getPreciseType(propValue);
|
|
1473
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')
|
|
1481
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'), {
|
|
1482
|
+
expectedType: expectedType
|
|
1483
|
+
});
|
|
1474
1484
|
}
|
|
1475
1485
|
|
|
1476
1486
|
return null;
|
|
@@ -1605,7 +1615,7 @@ var factoryWithTypeCheckers = function factoryWithTypeCheckers(isValidElement, t
|
|
|
1605
1615
|
}
|
|
1606
1616
|
|
|
1607
1617
|
for (var key in propValue) {
|
|
1608
|
-
if (has(propValue, key)) {
|
|
1618
|
+
if (has$1(propValue, key)) {
|
|
1609
1619
|
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
1610
1620
|
|
|
1611
1621
|
if (error instanceof Error) {
|
|
@@ -1636,15 +1646,23 @@ var factoryWithTypeCheckers = function factoryWithTypeCheckers(isValidElement, t
|
|
|
1636
1646
|
}
|
|
1637
1647
|
|
|
1638
1648
|
function validate(props, propName, componentName, location, propFullName) {
|
|
1649
|
+
var expectedTypes = [];
|
|
1650
|
+
|
|
1639
1651
|
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
1640
1652
|
var checker = arrayOfTypeCheckers[i];
|
|
1653
|
+
var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1);
|
|
1641
1654
|
|
|
1642
|
-
if (
|
|
1655
|
+
if (checkerResult == null) {
|
|
1643
1656
|
return null;
|
|
1644
1657
|
}
|
|
1658
|
+
|
|
1659
|
+
if (checkerResult.data && has$1(checkerResult.data, 'expectedType')) {
|
|
1660
|
+
expectedTypes.push(checkerResult.data.expectedType);
|
|
1661
|
+
}
|
|
1645
1662
|
}
|
|
1646
1663
|
|
|
1647
|
-
|
|
1664
|
+
var expectedTypesMessage = expectedTypes.length > 0 ? ', expected one of type [' + expectedTypes.join(', ') + ']' : '';
|
|
1665
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
|
|
1648
1666
|
}
|
|
1649
1667
|
|
|
1650
1668
|
return createChainableTypeChecker(validate);
|
|
@@ -1662,6 +1680,10 @@ var factoryWithTypeCheckers = function factoryWithTypeCheckers(isValidElement, t
|
|
|
1662
1680
|
return createChainableTypeChecker(validate);
|
|
1663
1681
|
}
|
|
1664
1682
|
|
|
1683
|
+
function invalidValidatorError(componentName, location, propFullName, key, type) {
|
|
1684
|
+
return new PropTypeError((componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.');
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1665
1687
|
function createShapeTypeChecker(shapeTypes) {
|
|
1666
1688
|
function validate(props, propName, componentName, location, propFullName) {
|
|
1667
1689
|
var propValue = props[propName];
|
|
@@ -1674,8 +1696,8 @@ var factoryWithTypeCheckers = function factoryWithTypeCheckers(isValidElement, t
|
|
|
1674
1696
|
for (var key in shapeTypes) {
|
|
1675
1697
|
var checker = shapeTypes[key];
|
|
1676
1698
|
|
|
1677
|
-
if (
|
|
1678
|
-
|
|
1699
|
+
if (typeof checker !== 'function') {
|
|
1700
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
1679
1701
|
}
|
|
1680
1702
|
|
|
1681
1703
|
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
@@ -1698,8 +1720,7 @@ var factoryWithTypeCheckers = function factoryWithTypeCheckers(isValidElement, t
|
|
|
1698
1720
|
|
|
1699
1721
|
if (propType !== 'object') {
|
|
1700
1722
|
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
1701
|
-
} // We need to check all keys in case some are required but missing from
|
|
1702
|
-
// props.
|
|
1723
|
+
} // We need to check all keys in case some are required but missing from props.
|
|
1703
1724
|
|
|
1704
1725
|
|
|
1705
1726
|
var allKeys = objectAssign({}, props[propName], shapeTypes);
|
|
@@ -1707,6 +1728,10 @@ var factoryWithTypeCheckers = function factoryWithTypeCheckers(isValidElement, t
|
|
|
1707
1728
|
for (var key in allKeys) {
|
|
1708
1729
|
var checker = shapeTypes[key];
|
|
1709
1730
|
|
|
1731
|
+
if (has$1(shapeTypes, key) && typeof checker !== 'function') {
|
|
1732
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1710
1735
|
if (!checker) {
|
|
1711
1736
|
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' '));
|
|
1712
1737
|
}
|
|
@@ -1905,6 +1930,7 @@ var factoryWithThrowingShims = function factoryWithThrowingShims() {
|
|
|
1905
1930
|
|
|
1906
1931
|
var ReactPropTypes = {
|
|
1907
1932
|
array: shim,
|
|
1933
|
+
bigint: shim,
|
|
1908
1934
|
bool: shim,
|
|
1909
1935
|
func: shim,
|
|
1910
1936
|
number: shim,
|
|
@@ -1948,6 +1974,7 @@ var propTypes = createCommonjsModule(function (module) {
|
|
|
1948
1974
|
module.exports = factoryWithThrowingShims();
|
|
1949
1975
|
}
|
|
1950
1976
|
});
|
|
1977
|
+
var PropTypes = propTypes;
|
|
1951
1978
|
|
|
1952
1979
|
/**
|
|
1953
1980
|
* A Handsontable-ReactJS wrapper.
|
|
@@ -2223,15 +2250,20 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
2223
2250
|
* Create a fresh class to be used as an editor, based on the provided editor React element.
|
|
2224
2251
|
*
|
|
2225
2252
|
* @param {React.ReactElement} editorElement React editor component.
|
|
2253
|
+
* @param {string|number} [editorColumnScope] The editor scope (column index or a 'global' string). Defaults to
|
|
2254
|
+
* 'global'.
|
|
2226
2255
|
* @returns {Function} A class to be passed to the Handsontable editor settings.
|
|
2227
2256
|
*/
|
|
2228
2257
|
|
|
2229
2258
|
}, {
|
|
2230
2259
|
key: "getEditorClass",
|
|
2231
2260
|
value: function getEditorClass(editorElement) {
|
|
2261
|
+
var _editorCache$get;
|
|
2262
|
+
|
|
2263
|
+
var editorColumnScope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : GLOBAL_EDITOR_SCOPE;
|
|
2232
2264
|
var editorClass = getOriginalEditorClass(editorElement);
|
|
2233
2265
|
var editorCache = this.getEditorCache();
|
|
2234
|
-
var cachedComponent = editorCache.get(editorClass);
|
|
2266
|
+
var cachedComponent = (_editorCache$get = editorCache.get(editorClass)) === null || _editorCache$get === void 0 ? void 0 : _editorCache$get.get(editorColumnScope);
|
|
2235
2267
|
return this.makeEditorClass(cachedComponent);
|
|
2236
2268
|
}
|
|
2237
2269
|
/**
|
|
@@ -2249,12 +2281,12 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
2249
2281
|
|
|
2250
2282
|
var _super2 = _createSuper(CustomEditor);
|
|
2251
2283
|
|
|
2252
|
-
function CustomEditor(hotInstance
|
|
2284
|
+
function CustomEditor(hotInstance) {
|
|
2253
2285
|
var _this2;
|
|
2254
2286
|
|
|
2255
2287
|
_classCallCheck(this, CustomEditor);
|
|
2256
2288
|
|
|
2257
|
-
_this2 = _super2.call(this, hotInstance
|
|
2289
|
+
_this2 = _super2.call(this, hotInstance);
|
|
2258
2290
|
editorComponent.hotCustomEditorInstance = _assertThisInitialized(_this2);
|
|
2259
2291
|
_this2.editorComponent = editorComponent;
|
|
2260
2292
|
return _this2;
|
|
@@ -2354,7 +2386,7 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
2354
2386
|
newSettings.columns = this.columnSettings.length ? this.columnSettings : newSettings.columns;
|
|
2355
2387
|
|
|
2356
2388
|
if (globalEditorNode) {
|
|
2357
|
-
newSettings.editor = this.getEditorClass(globalEditorNode);
|
|
2389
|
+
newSettings.editor = this.getEditorClass(globalEditorNode, GLOBAL_EDITOR_SCOPE);
|
|
2358
2390
|
} else {
|
|
2359
2391
|
newSettings.editor = this.props.editor || (this.props.settings ? this.props.settings.editor : void 0);
|
|
2360
2392
|
}
|
|
@@ -2377,7 +2409,9 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
2377
2409
|
}, {
|
|
2378
2410
|
key: "displayAutoSizeWarning",
|
|
2379
2411
|
value: function displayAutoSizeWarning(newGlobalSettings) {
|
|
2380
|
-
|
|
2412
|
+
var _this$hotInstance$get, _this$hotInstance$get2;
|
|
2413
|
+
|
|
2414
|
+
if (this.hotInstance && ((_this$hotInstance$get = this.hotInstance.getPlugin('autoRowSize')) !== null && _this$hotInstance$get !== void 0 && _this$hotInstance$get.enabled || (_this$hotInstance$get2 = this.hotInstance.getPlugin('autoColumnSize')) !== null && _this$hotInstance$get2 !== void 0 && _this$hotInstance$get2.enabled)) {
|
|
2381
2415
|
if (this.componentRendererColumns.size > 0) {
|
|
2382
2416
|
warn(AUTOSIZE_WARNING);
|
|
2383
2417
|
}
|
|
@@ -2396,21 +2430,21 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
2396
2430
|
this.columnSettings[columnIndex] = columnSettings;
|
|
2397
2431
|
}
|
|
2398
2432
|
/**
|
|
2399
|
-
* Handsontable's `
|
|
2433
|
+
* Handsontable's `beforeViewRender` hook callback.
|
|
2400
2434
|
*/
|
|
2401
2435
|
|
|
2402
2436
|
}, {
|
|
2403
|
-
key: "
|
|
2404
|
-
value: function
|
|
2437
|
+
key: "handsontableBeforeViewRender",
|
|
2438
|
+
value: function handsontableBeforeViewRender() {
|
|
2405
2439
|
this.getRenderedCellCache().clear();
|
|
2406
2440
|
}
|
|
2407
2441
|
/**
|
|
2408
|
-
* Handsontable's `
|
|
2442
|
+
* Handsontable's `afterViewRender` hook callback.
|
|
2409
2443
|
*/
|
|
2410
2444
|
|
|
2411
2445
|
}, {
|
|
2412
|
-
key: "
|
|
2413
|
-
value: function
|
|
2446
|
+
key: "handsontableAfterViewRender",
|
|
2447
|
+
value: function handsontableAfterViewRender() {
|
|
2414
2448
|
var _this3 = this;
|
|
2415
2449
|
|
|
2416
2450
|
this.portalManager.setState(function () {
|
|
@@ -2471,11 +2505,11 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
2471
2505
|
var hotTableComponent = this;
|
|
2472
2506
|
var newGlobalSettings = this.createNewGlobalSettings();
|
|
2473
2507
|
this.hotInstance = new Handsontable.Core(this.hotElementRef, newGlobalSettings);
|
|
2474
|
-
this.hotInstance.addHook('
|
|
2475
|
-
hotTableComponent.
|
|
2508
|
+
this.hotInstance.addHook('beforeViewRender', function (isForced) {
|
|
2509
|
+
hotTableComponent.handsontableBeforeViewRender();
|
|
2476
2510
|
});
|
|
2477
|
-
this.hotInstance.addHook('
|
|
2478
|
-
hotTableComponent.
|
|
2511
|
+
this.hotInstance.addHook('afterViewRender', function () {
|
|
2512
|
+
hotTableComponent.handsontableAfterViewRender();
|
|
2479
2513
|
}); // `init` missing in Handsontable's type definitions.
|
|
2480
2514
|
|
|
2481
2515
|
this.hotInstance.init();
|
|
@@ -2579,9 +2613,9 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
|
2579
2613
|
|
|
2580
2614
|
|
|
2581
2615
|
HotTable.propTypes = {
|
|
2582
|
-
style:
|
|
2583
|
-
id:
|
|
2584
|
-
className:
|
|
2616
|
+
style: PropTypes.object,
|
|
2617
|
+
id: PropTypes.string,
|
|
2618
|
+
className: PropTypes.string
|
|
2585
2619
|
};
|
|
2586
2620
|
|
|
2587
2621
|
var BaseEditorComponent = /*#__PURE__*/function (_React$Component) {
|
|
@@ -2609,7 +2643,7 @@ var BaseEditorComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
2609
2643
|
_this.hot = null;
|
|
2610
2644
|
|
|
2611
2645
|
if (props.emitEditorInstance) {
|
|
2612
|
-
props.emitEditorInstance(_assertThisInitialized(_this));
|
|
2646
|
+
props.emitEditorInstance(_assertThisInitialized(_this), props.editorColumnScope);
|
|
2613
2647
|
}
|
|
2614
2648
|
|
|
2615
2649
|
return _this;
|
|
@@ -2886,5 +2920,4 @@ var BaseEditorComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
2886
2920
|
return BaseEditorComponent;
|
|
2887
2921
|
}(React.Component);
|
|
2888
2922
|
|
|
2889
|
-
export default
|
|
2890
|
-
export { BaseEditorComponent, HotColumn, HotTable };
|
|
2923
|
+
export { BaseEditorComponent, HotColumn, HotTable, HotTable as default };
|
|
Binary file
|
package/helpers.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { HotEditorElement } from './types';
|
|
2
|
+
import { HotEditorCache, HotEditorElement } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Warning message for the `autoRowSize`/`autoColumnSize` compatibility check.
|
|
5
5
|
*/
|
|
@@ -8,6 +8,10 @@ export declare const AUTOSIZE_WARNING: string;
|
|
|
8
8
|
* Message for the warning thrown if the Handsontable instance has been destroyed.
|
|
9
9
|
*/
|
|
10
10
|
export declare const HOT_DESTROYED_WARNING: string;
|
|
11
|
+
/**
|
|
12
|
+
* String identifier for the global-scoped editor components.
|
|
13
|
+
*/
|
|
14
|
+
export declare const GLOBAL_EDITOR_SCOPE = "global";
|
|
11
15
|
/**
|
|
12
16
|
* Logs warn to the console if the `console` object is exposed.
|
|
13
17
|
*
|
|
@@ -44,15 +48,17 @@ export declare function removeEditorContainers(doc?: Document): void;
|
|
|
44
48
|
* @param {Map} editorCache The editor cache reference.
|
|
45
49
|
* @returns {React.ReactPortal} The portal for the editor.
|
|
46
50
|
*/
|
|
47
|
-
export declare function createEditorPortal(doc: Document, editorElement: HotEditorElement, editorCache:
|
|
51
|
+
export declare function createEditorPortal(doc: Document, editorElement: HotEditorElement, editorCache: HotEditorCache): React.ReactPortal;
|
|
48
52
|
/**
|
|
49
53
|
* Get an editor element extended with a instance-emitting method.
|
|
50
54
|
*
|
|
51
55
|
* @param {React.ReactNode} children Component children.
|
|
52
56
|
* @param {Map} editorCache Component's editor cache.
|
|
57
|
+
* @param {string|number} [editorColumnScope] The editor scope (column index or a 'global' string). Defaults to
|
|
58
|
+
* 'global'.
|
|
53
59
|
* @returns {React.ReactElement} An editor element containing the additional methods.
|
|
54
60
|
*/
|
|
55
|
-
export declare function getExtendedEditorElement(children: React.ReactNode, editorCache:
|
|
61
|
+
export declare function getExtendedEditorElement(children: React.ReactNode, editorCache: HotEditorCache, editorColumnScope?: string | number): React.ReactElement | null;
|
|
56
62
|
/**
|
|
57
63
|
* Create a react component and render it to an external DOM done.
|
|
58
64
|
*
|
package/hotColumn.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactPortal } from 'react';
|
|
2
2
|
import { HotTableProps, HotColumnProps } from './types';
|
|
3
|
-
import Handsontable from 'handsontable';
|
|
3
|
+
import Handsontable from 'handsontable/base';
|
|
4
4
|
declare class HotColumn extends React.Component<HotColumnProps, {}> {
|
|
5
5
|
internalProps: string[];
|
|
6
6
|
columnSettings: Handsontable.ColumnSettings;
|
package/hotTable.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import Handsontable from 'handsontable';
|
|
2
|
+
import Handsontable from 'handsontable/base';
|
|
3
3
|
import { PortalManager } from './portalManager';
|
|
4
|
-
import { HotTableProps, HotEditorElement } from './types';
|
|
4
|
+
import { HotTableProps, HotEditorElement, HotEditorCache, EditorScopeIdentifier } from './types';
|
|
5
5
|
/**
|
|
6
6
|
* A Handsontable-ReactJS wrapper.
|
|
7
7
|
*
|
|
@@ -138,7 +138,7 @@ declare class HotTable extends React.Component<HotTableProps, {}> {
|
|
|
138
138
|
*
|
|
139
139
|
* @returns {Map}
|
|
140
140
|
*/
|
|
141
|
-
getEditorCache():
|
|
141
|
+
getEditorCache(): HotEditorCache;
|
|
142
142
|
/**
|
|
143
143
|
* Get the global editor portal property.
|
|
144
144
|
*
|
|
@@ -173,14 +173,16 @@ declare class HotTable extends React.Component<HotTableProps, {}> {
|
|
|
173
173
|
* @param {React.ReactElement} rendererElement React renderer component.
|
|
174
174
|
* @returns {Handsontable.renderers.Base} The Handsontable rendering function.
|
|
175
175
|
*/
|
|
176
|
-
getRendererWrapper(rendererElement: React.ReactElement): Handsontable.renderers.
|
|
176
|
+
getRendererWrapper(rendererElement: React.ReactElement): typeof Handsontable.renderers.BaseRenderer | any;
|
|
177
177
|
/**
|
|
178
178
|
* Create a fresh class to be used as an editor, based on the provided editor React element.
|
|
179
179
|
*
|
|
180
180
|
* @param {React.ReactElement} editorElement React editor component.
|
|
181
|
+
* @param {string|number} [editorColumnScope] The editor scope (column index or a 'global' string). Defaults to
|
|
182
|
+
* 'global'.
|
|
181
183
|
* @returns {Function} A class to be passed to the Handsontable editor settings.
|
|
182
184
|
*/
|
|
183
|
-
getEditorClass(editorElement: HotEditorElement): typeof Handsontable.editors.BaseEditor;
|
|
185
|
+
getEditorClass(editorElement: HotEditorElement, editorColumnScope?: EditorScopeIdentifier): typeof Handsontable.editors.BaseEditor;
|
|
184
186
|
/**
|
|
185
187
|
* Create a class to be passed to the Handsontable's settings.
|
|
186
188
|
*
|
|
@@ -227,13 +229,13 @@ declare class HotTable extends React.Component<HotTableProps, {}> {
|
|
|
227
229
|
*/
|
|
228
230
|
setHotColumnSettings(columnSettings: Handsontable.ColumnSettings, columnIndex: number): void;
|
|
229
231
|
/**
|
|
230
|
-
* Handsontable's `
|
|
232
|
+
* Handsontable's `beforeViewRender` hook callback.
|
|
231
233
|
*/
|
|
232
|
-
|
|
234
|
+
handsontableBeforeViewRender(): void;
|
|
233
235
|
/**
|
|
234
|
-
* Handsontable's `
|
|
236
|
+
* Handsontable's `afterViewRender` hook callback.
|
|
235
237
|
*/
|
|
236
|
-
|
|
238
|
+
handsontableAfterViewRender(): void;
|
|
237
239
|
/**
|
|
238
240
|
* Call the `updateSettings` method for the Handsontable instance.
|
|
239
241
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@handsontable/react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.1.0",
|
|
4
4
|
"description": "Best Data Grid for React with Spreadsheet Look and Feel.",
|
|
5
5
|
"author": "Handsoncode <hello@handsoncode.net> (https://handsoncode.net)",
|
|
6
6
|
"homepage": "https://handsontable.com",
|
|
@@ -64,27 +64,27 @@
|
|
|
64
64
|
"enzyme": "^3.10.0",
|
|
65
65
|
"enzyme-adapter-react-16": "^1.14.0",
|
|
66
66
|
"enzyme-to-json": "^3.4.0",
|
|
67
|
-
"handsontable": "^
|
|
67
|
+
"handsontable": "^11.0.0",
|
|
68
68
|
"jest": "^25.1.0",
|
|
69
69
|
"prop-types": "^15.7.2",
|
|
70
70
|
"react": "^16.10.2",
|
|
71
71
|
"react-dom": "^16.10.2",
|
|
72
72
|
"react-redux": "^7.1.1",
|
|
73
73
|
"redux": "^4.0.4",
|
|
74
|
-
"rollup": "^2.
|
|
74
|
+
"rollup": "^2.58.0",
|
|
75
75
|
"rollup-plugin-alias": "^1.5.2",
|
|
76
76
|
"rollup-plugin-babel": "^4.3.3",
|
|
77
77
|
"rollup-plugin-commonjs": "^10.0.1",
|
|
78
78
|
"rollup-plugin-json": "^4.0.0",
|
|
79
79
|
"rollup-plugin-node-resolve": "^5.2.0",
|
|
80
80
|
"rollup-plugin-replace": "^2.2.0",
|
|
81
|
-
"rollup-plugin-typescript2": "^0.22.1",
|
|
82
81
|
"rollup-plugin-terser": "^7.0.2",
|
|
82
|
+
"rollup-plugin-typescript2": "^0.22.1",
|
|
83
83
|
"typescript": "3.8.2",
|
|
84
84
|
"uglify-js": "^3.4.9"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
|
-
"handsontable": ">=
|
|
87
|
+
"handsontable": ">=11.0.0"
|
|
88
88
|
},
|
|
89
89
|
"scripts": {
|
|
90
90
|
"build": "npm run clean && npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:min",
|
package/settingsMapper.d.ts
CHANGED
package/types.d.ts
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import Handsontable from 'handsontable';
|
|
1
|
+
import Handsontable from 'handsontable/base';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ConnectedComponent } from 'react-redux';
|
|
4
4
|
/**
|
|
5
5
|
* Type of the editor component's ReactElement.
|
|
6
6
|
*/
|
|
7
7
|
export declare type HotEditorElement = React.ReactElement<{}, ConnectedComponent<React.FunctionComponent, any> | any>;
|
|
8
|
+
/**
|
|
9
|
+
* Type of the identifier under which the cached editor components are stored.
|
|
10
|
+
*/
|
|
11
|
+
export declare type EditorScopeIdentifier = 'global' | number;
|
|
12
|
+
/**
|
|
13
|
+
* Type of the cache map for the Handsontable editor components.
|
|
14
|
+
*/
|
|
15
|
+
export declare type HotEditorCache = Map<Function, Map<EditorScopeIdentifier, React.Component>>;
|
|
8
16
|
/**
|
|
9
17
|
* Interface for the `prop` of the HotTable component - extending the default Handsontable settings with additional,
|
|
10
18
|
* component-related properties.
|
|
@@ -33,9 +41,9 @@ export interface HotColumnProps extends Handsontable.ColumnSettings {
|
|
|
33
41
|
_emitColumnSettings?: (columnSettings: Handsontable.ColumnSettings, columnIndex: number) => void;
|
|
34
42
|
_columnIndex?: number;
|
|
35
43
|
_getChildElementByType?: (children: React.ReactNode, type: string) => React.ReactElement;
|
|
36
|
-
_getRendererWrapper?: (rendererNode: React.ReactElement) => Handsontable.renderers.
|
|
37
|
-
_getEditorClass?: (editorElement: React.ReactElement) => typeof Handsontable.editors.BaseEditor;
|
|
38
|
-
_getEditorCache?: () =>
|
|
44
|
+
_getRendererWrapper?: (rendererNode: React.ReactElement) => typeof Handsontable.renderers.BaseRenderer;
|
|
45
|
+
_getEditorClass?: (editorElement: React.ReactElement, editorColumnScope: EditorScopeIdentifier) => typeof Handsontable.editors.BaseEditor;
|
|
46
|
+
_getEditorCache?: () => HotEditorCache;
|
|
39
47
|
_getOwnerDocument?: () => Document;
|
|
40
48
|
children?: React.ReactNode;
|
|
41
49
|
}
|