@handsontable/react-wrapper 0.0.0-next-bba5213-20260401 → 0.0.0-next-e3f6190-20260401
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 +230 -293
- package/dist/react-handsontable.js +231 -294
- 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 +231 -294
- package/helpers.d.ts +105 -105
- package/hotColumn.d.ts +5 -5
- package/hotColumnContext.d.ts +16 -16
- package/hotEditor.d.ts +73 -73
- package/hotTable.d.ts +29 -29
- package/hotTableContext.d.ts +55 -55
- package/hotTableInner.d.ts +5 -5
- package/index.d.ts +5 -5
- package/package.json +4 -4
- package/renderersPortalManager.d.ts +6 -6
- package/settingsMapper.d.ts +18 -18
- package/types.d.ts +78 -78
|
@@ -15,46 +15,38 @@ var ReactDOM__default = /*#__PURE__*/_interopDefaultCompat(ReactDOM);
|
|
|
15
15
|
var Handsontable__default = /*#__PURE__*/_interopDefaultCompat(Handsontable);
|
|
16
16
|
|
|
17
17
|
var bulkComponentContainer = null;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
* Warning message for the `autoRowSize`/`autoColumnSize` compatibility check.
|
|
18
|
+
/**
|
|
19
|
+
* Warning message for the `autoRowSize`/`autoColumnSize` compatibility check.
|
|
21
20
|
*/
|
|
22
21
|
var AUTOSIZE_WARNING = 'Your `HotTable` configuration includes `autoRowSize`/`autoColumnSize` options, which are not compatible with ' + ' the component-based renderers`. Disable `autoRowSize` and `autoColumnSize` to prevent row and column misalignment.';
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* Warning message for the `hot-renderer` obsolete renderer passing method.
|
|
22
|
+
/**
|
|
23
|
+
* Warning message for the `hot-renderer` obsolete renderer passing method.
|
|
26
24
|
*/
|
|
27
25
|
var OBSOLETE_HOTRENDERER_WARNING = 'Providing a component-based renderer using `hot-renderer`-annotated component is no longer supported. ' + 'Pass your component using `renderer` prop of the `HotTable` or `HotColumn` component instead.';
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
* Warning message for the `hot-editor` obsolete editor passing method.
|
|
26
|
+
/**
|
|
27
|
+
* Warning message for the `hot-editor` obsolete editor passing method.
|
|
31
28
|
*/
|
|
32
29
|
var OBSOLETE_HOTEDITOR_WARNING = 'Providing a component-based editor using `hot-editor`-annotated component is no longer supported. ' + 'Pass your component using `editor` prop of the `HotTable` or `HotColumn` component instead.';
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
* Warning message for the unexpected children of HotTable component.
|
|
30
|
+
/**
|
|
31
|
+
* Warning message for the unexpected children of HotTable component.
|
|
36
32
|
*/
|
|
37
33
|
var UNEXPECTED_HOTTABLE_CHILDREN_WARNING = 'Unexpected children nodes found in HotTable component. ' + 'Only HotColumn components are allowed.';
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
* Warning message for the unexpected children of HotColumn component.
|
|
34
|
+
/**
|
|
35
|
+
* Warning message for the unexpected children of HotColumn component.
|
|
41
36
|
*/
|
|
42
37
|
var UNEXPECTED_HOTCOLUMN_CHILDREN_WARNING = 'Unexpected children nodes found in HotColumn component. ' + 'HotColumn components do not support any children.';
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
* Message for the warning thrown if the Handsontable instance has been destroyed.
|
|
38
|
+
/**
|
|
39
|
+
* Message for the warning thrown if the Handsontable instance has been destroyed.
|
|
46
40
|
*/
|
|
47
41
|
var HOT_DESTROYED_WARNING = 'The Handsontable instance bound to this component was destroyed and cannot be' + ' used properly.';
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
* Default classname given to the wrapper container.
|
|
42
|
+
/**
|
|
43
|
+
* Default classname given to the wrapper container.
|
|
51
44
|
*/
|
|
52
45
|
var DEFAULT_CLASSNAME = 'hot-wrapper-editor-container';
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* @param {...*} args Values which will be logged.
|
|
46
|
+
/**
|
|
47
|
+
* Logs warn to the console if the `console` object is exposed.
|
|
48
|
+
*
|
|
49
|
+
* @param {...*} args Values which will be logged.
|
|
58
50
|
*/
|
|
59
51
|
function warn() {
|
|
60
52
|
if (typeof console !== 'undefined') {
|
|
@@ -62,11 +54,10 @@ function warn() {
|
|
|
62
54
|
(_console = console).warn.apply(_console, arguments);
|
|
63
55
|
}
|
|
64
56
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* @returns {boolean} 'true' if the warning was issued
|
|
57
|
+
/**
|
|
58
|
+
* Detect if `hot-renderer` or `hot-editor` is defined, and if so, throw an incompatibility warning.
|
|
59
|
+
*
|
|
60
|
+
* @returns {boolean} 'true' if the warning was issued
|
|
70
61
|
*/
|
|
71
62
|
function displayObsoleteRenderersEditorsWarning(children) {
|
|
72
63
|
if (hasChildElementOfType(children, 'hot-renderer')) {
|
|
@@ -79,13 +70,12 @@ function displayObsoleteRenderersEditorsWarning(children) {
|
|
|
79
70
|
}
|
|
80
71
|
return false;
|
|
81
72
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* @param {
|
|
87
|
-
* @
|
|
88
|
-
* @returns {boolean} 'true' if the warning was issued
|
|
73
|
+
/**
|
|
74
|
+
* Detect if children of specified type are defined, and if so, throw an incompatibility warning.
|
|
75
|
+
*
|
|
76
|
+
* @param {ReactNode} children Component children nodes
|
|
77
|
+
* @param {ComponentType} Component Component type to check
|
|
78
|
+
* @returns {boolean} 'true' if the warning was issued
|
|
89
79
|
*/
|
|
90
80
|
function displayChildrenOfTypeWarning(children, Component) {
|
|
91
81
|
var childrenArray = React__default["default"].Children.toArray(children);
|
|
@@ -97,12 +87,11 @@ function displayChildrenOfTypeWarning(children, Component) {
|
|
|
97
87
|
}
|
|
98
88
|
return false;
|
|
99
89
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* @
|
|
105
|
-
* @returns {boolean} 'true' if the warning was issued
|
|
90
|
+
/**
|
|
91
|
+
* Detect if children is defined, and if so, throw an incompatibility warning.
|
|
92
|
+
*
|
|
93
|
+
* @param {ReactNode} children Component children nodes
|
|
94
|
+
* @returns {boolean} 'true' if the warning was issued
|
|
106
95
|
*/
|
|
107
96
|
function displayAnyChildrenWarning(children) {
|
|
108
97
|
var childrenArray = React__default["default"].Children.toArray(children);
|
|
@@ -112,13 +101,12 @@ function displayAnyChildrenWarning(children) {
|
|
|
112
101
|
}
|
|
113
102
|
return false;
|
|
114
103
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
* @param {
|
|
120
|
-
* @
|
|
121
|
-
* @returns {boolean} `true` if the child of that type was found, `false` otherwise.
|
|
104
|
+
/**
|
|
105
|
+
* Check the existence of elements of the provided `type` from the `HotColumn` component's children.
|
|
106
|
+
*
|
|
107
|
+
* @param {ReactNode} children HotTable children array.
|
|
108
|
+
* @param {String} type Either `'hot-renderer'` or `'hot-editor'`.
|
|
109
|
+
* @returns {boolean} `true` if the child of that type was found, `false` otherwise.
|
|
122
110
|
*/
|
|
123
111
|
function hasChildElementOfType(children, type) {
|
|
124
112
|
var childrenArray = React__default["default"].Children.toArray(children);
|
|
@@ -126,32 +114,30 @@ function hasChildElementOfType(children, type) {
|
|
|
126
114
|
return child.props[type] !== void 0;
|
|
127
115
|
});
|
|
128
116
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* @param {
|
|
134
|
-
* @
|
|
135
|
-
* @returns {ReactPortal} The portal for the editor.
|
|
117
|
+
/**
|
|
118
|
+
* Create an editor portal.
|
|
119
|
+
*
|
|
120
|
+
* @param {Document} doc Document to be used.
|
|
121
|
+
* @param {ComponentType} Editor Editor component or render function.
|
|
122
|
+
* @returns {ReactPortal} The portal for the editor.
|
|
136
123
|
*/
|
|
137
124
|
function createEditorPortal(doc, Editor) {
|
|
138
125
|
if (!doc || !Editor || typeof Editor === 'boolean') {
|
|
139
126
|
return null;
|
|
140
127
|
}
|
|
141
|
-
var editorElement =
|
|
128
|
+
var editorElement = React__default["default"].createElement(Editor, null);
|
|
142
129
|
var containerProps = getContainerAttributesProps({}, false);
|
|
143
130
|
containerProps.className = "".concat(DEFAULT_CLASSNAME, " ").concat(containerProps.className);
|
|
144
|
-
return
|
|
131
|
+
return ReactDOM__default["default"].createPortal(React__default["default"].createElement("div", Object.assign({}, containerProps), editorElement), doc.body);
|
|
145
132
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
* @param {
|
|
151
|
-
* @param {
|
|
152
|
-
* @param {
|
|
153
|
-
* @
|
|
154
|
-
* @returns {{portal: ReactPortal, portalContainer: HTMLElement}} An object containing the portal and its container.
|
|
133
|
+
/**
|
|
134
|
+
* Render a cell component to an external DOM node.
|
|
135
|
+
*
|
|
136
|
+
* @param {React.ReactElement} rElement React element to be used as a base for the component.
|
|
137
|
+
* @param {Document} [ownerDocument] The owner document to set the portal up into.
|
|
138
|
+
* @param {String} portalKey The key to be used for the portal.
|
|
139
|
+
* @param {HTMLElement} [cachedContainer] The cached container to be used for the portal.
|
|
140
|
+
* @returns {{portal: ReactPortal, portalContainer: HTMLElement}} An object containing the portal and its container.
|
|
155
141
|
*/
|
|
156
142
|
function createPortal(rElement) {
|
|
157
143
|
var ownerDocument = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;
|
|
@@ -166,19 +152,18 @@ function createPortal(rElement) {
|
|
|
166
152
|
var portalContainer = cachedContainer !== null && cachedContainer !== void 0 ? cachedContainer : ownerDocument.createElement('DIV');
|
|
167
153
|
bulkComponentContainer.appendChild(portalContainer);
|
|
168
154
|
return {
|
|
169
|
-
portal:
|
|
155
|
+
portal: ReactDOM__default["default"].createPortal(rElement, portalContainer, portalKey),
|
|
170
156
|
portalContainer: portalContainer
|
|
171
157
|
};
|
|
172
158
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
* @param {
|
|
179
|
-
* @
|
|
180
|
-
*
|
|
181
|
-
* component.
|
|
159
|
+
/**
|
|
160
|
+
* Get an object containing the `id`, `className` and `style` keys, representing the corresponding props passed to the
|
|
161
|
+
* component.
|
|
162
|
+
*
|
|
163
|
+
* @param {HotTableProps} props Object containing the React element props.
|
|
164
|
+
* @param {Boolean} randomizeId If set to `true`, the function will randomize the `id` property when no `id` was present in the `prop` object.
|
|
165
|
+
* @returns An object containing the `id`, `className` and `style` keys, representing the corresponding props passed to the
|
|
166
|
+
* component.
|
|
182
167
|
*/
|
|
183
168
|
function getContainerAttributesProps(props) {
|
|
184
169
|
var randomizeId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
@@ -188,21 +173,19 @@ function getContainerAttributesProps(props) {
|
|
|
188
173
|
style: props.style || {}
|
|
189
174
|
};
|
|
190
175
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
* @returns {boolean}
|
|
176
|
+
/**
|
|
177
|
+
* Checks if the environment that the code runs in is a browser.
|
|
178
|
+
*
|
|
179
|
+
* @returns {boolean}
|
|
196
180
|
*/
|
|
197
181
|
function isCSR() {
|
|
198
182
|
return typeof window !== 'undefined';
|
|
199
183
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
* @param
|
|
205
|
-
* @param deps Effect dependencies
|
|
184
|
+
/**
|
|
185
|
+
* A variant of useEffect hook that does not trigger on initial mount, only updates
|
|
186
|
+
*
|
|
187
|
+
* @param effect Effect function
|
|
188
|
+
* @param deps Effect dependencies
|
|
206
189
|
*/
|
|
207
190
|
function useUpdateEffect(effect, deps) {
|
|
208
191
|
var notInitialRender = React__default["default"].useRef(false);
|
|
@@ -255,15 +238,6 @@ function _defineProperty(e, r, t) {
|
|
|
255
238
|
writable: true
|
|
256
239
|
}) : e[r] = t, e;
|
|
257
240
|
}
|
|
258
|
-
function _extends() {
|
|
259
|
-
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
260
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
261
|
-
var t = arguments[e];
|
|
262
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
263
|
-
}
|
|
264
|
-
return n;
|
|
265
|
-
}, _extends.apply(null, arguments);
|
|
266
|
-
}
|
|
267
241
|
function _getPrototypeOf(t) {
|
|
268
242
|
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
|
269
243
|
return t.__proto__ || Object.getPrototypeOf(t);
|
|
@@ -417,14 +391,14 @@ var SettingsMapper = /*#__PURE__*/function () {
|
|
|
417
391
|
return _createClass(SettingsMapper, null, [{
|
|
418
392
|
key: "getSettings",
|
|
419
393
|
value:
|
|
420
|
-
/**
|
|
421
|
-
* Parse component settings into Handsontable-compatible settings.
|
|
422
|
-
*
|
|
423
|
-
* @param {Object} properties Object containing properties from the HotTable object.
|
|
424
|
-
* @param {Object} additionalSettings Additional settings.
|
|
425
|
-
* @param {boolean} additionalSettings.isInit Flag determining whether the settings are being set during initialization.
|
|
426
|
-
* @param {string[]} additionalSettings.initOnlySettingKeys Array of keys that can be set only during initialization.
|
|
427
|
-
* @returns {Object} Handsontable-compatible settings object.
|
|
394
|
+
/**
|
|
395
|
+
* Parse component settings into Handsontable-compatible settings.
|
|
396
|
+
*
|
|
397
|
+
* @param {Object} properties Object containing properties from the HotTable object.
|
|
398
|
+
* @param {Object} additionalSettings Additional settings.
|
|
399
|
+
* @param {boolean} additionalSettings.isInit Flag determining whether the settings are being set during initialization.
|
|
400
|
+
* @param {string[]} additionalSettings.initOnlySettingKeys Array of keys that can be set only during initialization.
|
|
401
|
+
* @returns {Object} Handsontable-compatible settings object.
|
|
428
402
|
*/
|
|
429
403
|
function getSettings(properties) {
|
|
430
404
|
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
@@ -452,7 +426,7 @@ var SettingsMapper = /*#__PURE__*/function () {
|
|
|
452
426
|
}]);
|
|
453
427
|
}();
|
|
454
428
|
|
|
455
|
-
var HotTableContext =
|
|
429
|
+
var HotTableContext = React.createContext(undefined);
|
|
456
430
|
var HotTableContextProvider = function HotTableContextProvider(_ref) {
|
|
457
431
|
var children = _ref.children;
|
|
458
432
|
var columnsSettings = React.useRef([]);
|
|
@@ -472,7 +446,6 @@ var HotTableContextProvider = function HotTableContextProvider(_ref) {
|
|
|
472
446
|
var getRendererWrapper = React.useCallback(function (Renderer) {
|
|
473
447
|
return function __internalRenderer(instance, TD, row, col, prop, value, cellProperties) {
|
|
474
448
|
var key = "".concat(row, "-").concat(col);
|
|
475
|
-
|
|
476
449
|
// Handsontable.Core type is missing guid
|
|
477
450
|
var instanceGuid = instance.guid;
|
|
478
451
|
var portalContainerKey = "".concat(instanceGuid, "-").concat(key);
|
|
@@ -486,12 +459,11 @@ var HotTableContextProvider = function HotTableContextProvider(_ref) {
|
|
|
486
459
|
while (TD.firstChild) {
|
|
487
460
|
TD.removeChild(TD.firstChild);
|
|
488
461
|
}
|
|
489
|
-
|
|
490
462
|
// if portal already exists, do not recreate
|
|
491
463
|
if (cachedPortal && cachedPortalContainer) {
|
|
492
464
|
TD.appendChild(cachedPortalContainer);
|
|
493
465
|
} else {
|
|
494
|
-
var rendererElement =
|
|
466
|
+
var rendererElement = React__default["default"].createElement(Renderer, {
|
|
495
467
|
instance: instance,
|
|
496
468
|
TD: TD,
|
|
497
469
|
row: row,
|
|
@@ -533,21 +505,20 @@ var HotTableContextProvider = function HotTableContextProvider(_ref) {
|
|
|
533
505
|
pushCellPortalsIntoPortalManager: pushCellPortalsIntoPortalManager
|
|
534
506
|
};
|
|
535
507
|
}, [setHotColumnSettings, getRendererWrapper, clearRenderedCellCache, setRenderersPortalManagerRef, pushCellPortalsIntoPortalManager]);
|
|
536
|
-
return
|
|
508
|
+
return React__default["default"].createElement(HotTableContext.Provider, {
|
|
537
509
|
value: contextImpl
|
|
538
510
|
}, children);
|
|
539
511
|
};
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
*
|
|
543
|
-
*
|
|
544
|
-
* @returns HotTableContext
|
|
512
|
+
/**
|
|
513
|
+
* Exposes the table context object to components
|
|
514
|
+
*
|
|
515
|
+
* @returns HotTableContext
|
|
545
516
|
*/
|
|
546
517
|
function useHotTableContext() {
|
|
547
518
|
return React.useContext(HotTableContext);
|
|
548
519
|
}
|
|
549
520
|
|
|
550
|
-
var HotColumnContext =
|
|
521
|
+
var HotColumnContext = React.createContext(undefined);
|
|
551
522
|
var HotColumnContextProvider = function HotColumnContextProvider(_ref) {
|
|
552
523
|
var columnIndex = _ref.columnIndex,
|
|
553
524
|
getOwnerDocument = _ref.getOwnerDocument,
|
|
@@ -558,7 +529,7 @@ var HotColumnContextProvider = function HotColumnContextProvider(_ref) {
|
|
|
558
529
|
getOwnerDocument: getOwnerDocument
|
|
559
530
|
};
|
|
560
531
|
}, [columnIndex, getOwnerDocument]);
|
|
561
|
-
return
|
|
532
|
+
return React__default["default"].createElement(HotColumnContext.Provider, {
|
|
562
533
|
value: contextImpl
|
|
563
534
|
}, children);
|
|
564
535
|
};
|
|
@@ -574,13 +545,12 @@ var MethodsMap = {
|
|
|
574
545
|
prepare: 'onPrepare',
|
|
575
546
|
focus: 'onFocus'
|
|
576
547
|
};
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
*
|
|
580
|
-
*
|
|
581
|
-
* @param {RefObject
|
|
582
|
-
* @
|
|
583
|
-
* @returns {Function} A class to be passed to the Handsontable editor settings.
|
|
548
|
+
/**
|
|
549
|
+
* Create a class to be passed to the Handsontable's settings.
|
|
550
|
+
*
|
|
551
|
+
* @param {RefObject<HotEditorHooks>} hooksRef Reference to component-based editor overridden hooks object.
|
|
552
|
+
* @param {RefObject} instanceRef Reference to Handsontable-native custom editor class instance.
|
|
553
|
+
* @returns {Function} A class to be passed to the Handsontable editor settings.
|
|
584
554
|
*/
|
|
585
555
|
function makeEditorClass(hooksRef, instanceRef) {
|
|
586
556
|
return /*#__PURE__*/function (_Handsontable$editors) {
|
|
@@ -604,8 +574,8 @@ function makeEditorClass(hooksRef, instanceRef) {
|
|
|
604
574
|
result = baseMethod.call.apply(baseMethod, [this].concat(args)); // call super
|
|
605
575
|
}
|
|
606
576
|
if (MethodsMap[propName] && (_hooksRef$current = hooksRef.current) !== null && _hooksRef$current !== void 0 && _hooksRef$current[MethodsMap[propName]]) {
|
|
607
|
-
var
|
|
608
|
-
result = (
|
|
577
|
+
var _hooksRef$current$Met;
|
|
578
|
+
result = (_hooksRef$current$Met = hooksRef.current[MethodsMap[propName]]).call.apply(_hooksRef$current$Met, [this].concat(args));
|
|
609
579
|
}
|
|
610
580
|
return result;
|
|
611
581
|
}.bind(_this);
|
|
@@ -635,31 +605,31 @@ function makeEditorClass(hooksRef, instanceRef) {
|
|
|
635
605
|
}]);
|
|
636
606
|
}(Handsontable__default["default"].editors.BaseEditor);
|
|
637
607
|
}
|
|
638
|
-
/**
|
|
639
|
-
* Context to provide Handsontable-native custom editor class instance to overridden hooks object.
|
|
608
|
+
/**
|
|
609
|
+
* Context to provide Handsontable-native custom editor class instance to overridden hooks object.
|
|
640
610
|
*/
|
|
641
|
-
var EditorContext =
|
|
642
|
-
/**
|
|
643
|
-
* Provider of the context that exposes Handsontable-native editor instance and passes hooks object
|
|
644
|
-
* for custom editor components.
|
|
645
|
-
*
|
|
646
|
-
* @param {Ref} hooksRef Reference for component-based editor overridden hooks object.
|
|
647
|
-
* @param {RefObject} hotCustomEditorInstanceRef Reference to Handsontable-native editor instance.
|
|
611
|
+
var EditorContext = React.createContext(undefined);
|
|
612
|
+
/**
|
|
613
|
+
* Provider of the context that exposes Handsontable-native editor instance and passes hooks object
|
|
614
|
+
* for custom editor components.
|
|
615
|
+
*
|
|
616
|
+
* @param {Ref} hooksRef Reference for component-based editor overridden hooks object.
|
|
617
|
+
* @param {RefObject} hotCustomEditorInstanceRef Reference to Handsontable-native editor instance.
|
|
648
618
|
*/
|
|
649
|
-
var EditorContextProvider = function EditorContextProvider(
|
|
650
|
-
var hooksRef =
|
|
651
|
-
hotCustomEditorInstanceRef =
|
|
652
|
-
children =
|
|
653
|
-
return
|
|
619
|
+
var EditorContextProvider = function EditorContextProvider(_ref) {
|
|
620
|
+
var hooksRef = _ref.hooksRef,
|
|
621
|
+
hotCustomEditorInstanceRef = _ref.hotCustomEditorInstanceRef,
|
|
622
|
+
children = _ref.children;
|
|
623
|
+
return React__default["default"].createElement(EditorContext.Provider, {
|
|
654
624
|
value: {
|
|
655
625
|
hooksRef: hooksRef,
|
|
656
626
|
hotCustomEditorInstanceRef: hotCustomEditorInstanceRef
|
|
657
627
|
}
|
|
658
628
|
}, children);
|
|
659
629
|
};
|
|
660
|
-
/**
|
|
661
|
-
* Applies editor overlay position/dimensions to an element.
|
|
662
|
-
* @returns true if position was applied, false if editor should close (e.g. cell no longer available).
|
|
630
|
+
/**
|
|
631
|
+
* Applies editor overlay position/dimensions to an element.
|
|
632
|
+
* @returns true if position was applied, false if editor should close (e.g. cell no longer available).
|
|
663
633
|
*/
|
|
664
634
|
function applyEditorPosition(el, editor, hot, td) {
|
|
665
635
|
var _rootWindow$pageXOffs, _rootWindow$pageYOffs;
|
|
@@ -709,18 +679,17 @@ function applyEditorPosition(el, editor, hot, td) {
|
|
|
709
679
|
}
|
|
710
680
|
return false;
|
|
711
681
|
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
*
|
|
715
|
-
*
|
|
716
|
-
* @param {
|
|
717
|
-
* @
|
|
718
|
-
* @returns {UseHotEditorImpl} Editor API methods
|
|
682
|
+
/**
|
|
683
|
+
* Hook that allows encapsulating custom behaviours of component-based editor by customizing passed ref with overridden hooks object.
|
|
684
|
+
*
|
|
685
|
+
* @param {HotEditorHooks} overriddenHooks Overrides specific for the custom editor.
|
|
686
|
+
* @param {DependencyList} deps Overridden hooks object React dependency list.
|
|
687
|
+
* @returns {UseHotEditorImpl} Editor API methods
|
|
719
688
|
*/
|
|
720
689
|
function useHotEditor(overriddenHooks, deps) {
|
|
721
|
-
var
|
|
722
|
-
hooksRef =
|
|
723
|
-
hotCustomEditorInstanceRef =
|
|
690
|
+
var _useContext = React.useContext(EditorContext),
|
|
691
|
+
hooksRef = _useContext.hooksRef,
|
|
692
|
+
hotCustomEditorInstanceRef = _useContext.hotCustomEditorInstanceRef;
|
|
724
693
|
var _useState = React.useState(0),
|
|
725
694
|
_useState2 = _slicedToArray(_useState, 2),
|
|
726
695
|
rerenderTrigger = _useState2[0],
|
|
@@ -729,7 +698,6 @@ function useHotEditor(overriddenHooks, deps) {
|
|
|
729
698
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
730
699
|
editorValue = _useState4[0],
|
|
731
700
|
setEditorValue = _useState4[1];
|
|
732
|
-
|
|
733
701
|
// return a deferred value that allows for optimizing performance by delaying the update of a value until the next render.
|
|
734
702
|
var deferredValue = React.useDeferredValue(editorValue);
|
|
735
703
|
React.useImperativeHandle(hooksRef, function () {
|
|
@@ -773,28 +741,23 @@ function useHotEditor(overriddenHooks, deps) {
|
|
|
773
741
|
};
|
|
774
742
|
}, [rerenderTrigger, hotCustomEditorInstanceRef, deferredValue]);
|
|
775
743
|
}
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
_onFocus = _ref4.onFocus,
|
|
786
|
-
children = _ref4.children,
|
|
787
|
-
_ref4$shortcutsGroup = _ref4.shortcutsGroup,
|
|
788
|
-
shortcutsGroup = _ref4$shortcutsGroup === void 0 ? "custom-editor" : _ref4$shortcutsGroup,
|
|
789
|
-
shortcuts = _ref4.shortcuts;
|
|
744
|
+
function EditorComponent(_ref2) {
|
|
745
|
+
var _onPrepare = _ref2.onPrepare,
|
|
746
|
+
_onClose = _ref2.onClose,
|
|
747
|
+
_onOpen = _ref2.onOpen,
|
|
748
|
+
_onFocus = _ref2.onFocus,
|
|
749
|
+
children = _ref2.children,
|
|
750
|
+
_ref2$shortcutsGroup = _ref2.shortcutsGroup,
|
|
751
|
+
shortcutsGroup = _ref2$shortcutsGroup === void 0 ? "custom-editor" : _ref2$shortcutsGroup,
|
|
752
|
+
shortcuts = _ref2.shortcuts;
|
|
790
753
|
var mainElementRef = React.useRef(null);
|
|
791
754
|
var currentValue = React.useRef(undefined);
|
|
792
755
|
var _useState5 = React.useState(),
|
|
793
756
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
794
757
|
themeClassName = _useState6[0],
|
|
795
758
|
setThemeClassName = _useState6[1];
|
|
796
|
-
var
|
|
797
|
-
hotCustomEditorInstanceRef =
|
|
759
|
+
var _useContext2 = React.useContext(EditorContext),
|
|
760
|
+
hotCustomEditorInstanceRef = _useContext2.hotCustomEditorInstanceRef;
|
|
798
761
|
var registerShortcuts = React.useCallback(function () {
|
|
799
762
|
var _hotCustomEditorInsta8, _hotCustomEditorInsta9, _hotCustomEditorInsta0;
|
|
800
763
|
if (!((_hotCustomEditorInsta8 = hotCustomEditorInstanceRef.current) !== null && _hotCustomEditorInsta8 !== void 0 && _hotCustomEditorInsta8.hot)) return;
|
|
@@ -897,7 +860,7 @@ function EditorComponent(_ref4) {
|
|
|
897
860
|
var stopMousedownPropagation = function stopMousedownPropagation(e) {
|
|
898
861
|
e.stopPropagation();
|
|
899
862
|
};
|
|
900
|
-
return
|
|
863
|
+
return React__default["default"].createElement("div", {
|
|
901
864
|
ref: mainElementRef,
|
|
902
865
|
className: themeClassName,
|
|
903
866
|
style: {
|
|
@@ -932,25 +895,22 @@ var HotColumn = function HotColumn(props) {
|
|
|
932
895
|
var _useHotColumnContext = useHotColumnContext(),
|
|
933
896
|
columnIndex = _useHotColumnContext.columnIndex,
|
|
934
897
|
getOwnerDocument = _useHotColumnContext.getOwnerDocument;
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
* Reference to component-based editor overridden hooks object.
|
|
898
|
+
/**
|
|
899
|
+
* Reference to component-based editor overridden hooks object.
|
|
938
900
|
*/
|
|
939
901
|
var localEditorHooksRef = React.useRef(null);
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
* Reference to HOT-native custom editor class instance.
|
|
902
|
+
/**
|
|
903
|
+
* Reference to HOT-native custom editor class instance.
|
|
943
904
|
*/
|
|
944
905
|
var localEditorClassInstance = React.useRef(null);
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
* Logic performed after mounting & updating of the HotColumn component.
|
|
906
|
+
/**
|
|
907
|
+
* Logic performed after mounting & updating of the HotColumn component.
|
|
948
908
|
*/
|
|
949
909
|
React.useEffect(function () {
|
|
950
|
-
/**
|
|
951
|
-
* Filter out all the internal properties and return an object with just the Handsontable-related props.
|
|
952
|
-
*
|
|
953
|
-
* @returns {Object}
|
|
910
|
+
/**
|
|
911
|
+
* Filter out all the internal properties and return an object with just the Handsontable-related props.
|
|
912
|
+
*
|
|
913
|
+
* @returns {Object}
|
|
954
914
|
*/
|
|
955
915
|
var getSettingsProps = function getSettingsProps() {
|
|
956
916
|
return Object.keys(props).filter(function (key) {
|
|
@@ -960,9 +920,8 @@ var HotColumn = function HotColumn(props) {
|
|
|
960
920
|
return obj;
|
|
961
921
|
}, {});
|
|
962
922
|
};
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
* Create the column settings based on the data provided to the `HotColumn` component and its child components.
|
|
923
|
+
/**
|
|
924
|
+
* Create the column settings based on the data provided to the `HotColumn` component and its child components.
|
|
966
925
|
*/
|
|
967
926
|
var createColumnSettings = function createColumnSettings() {
|
|
968
927
|
var columnSettings = SettingsMapper.getSettings(getSettingsProps());
|
|
@@ -986,24 +945,23 @@ var HotColumn = function HotColumn(props) {
|
|
|
986
945
|
}
|
|
987
946
|
});
|
|
988
947
|
var editorPortal = createEditorPortal(getOwnerDocument(), props.editor);
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
*
|
|
992
|
-
*
|
|
993
|
-
* @returns {ReactElement}
|
|
948
|
+
/**
|
|
949
|
+
* Render the portals of the editors, if there are any.
|
|
950
|
+
*
|
|
951
|
+
* @returns {ReactElement}
|
|
994
952
|
*/
|
|
995
|
-
return
|
|
953
|
+
return React__default["default"].createElement(EditorContextProvider, {
|
|
996
954
|
hooksRef: localEditorHooksRef,
|
|
997
955
|
hotCustomEditorInstanceRef: localEditorClassInstance
|
|
998
956
|
}, editorPortal);
|
|
999
957
|
};
|
|
1000
958
|
|
|
1001
|
-
var version="0.0.0-next-
|
|
959
|
+
var version="0.0.0-next-e3f6190-20260401";
|
|
1002
960
|
|
|
1003
|
-
/**
|
|
1004
|
-
* Component used to manage the renderer component portals.
|
|
961
|
+
/**
|
|
962
|
+
* Component used to manage the renderer component portals.
|
|
1005
963
|
*/
|
|
1006
|
-
var RenderersPortalManager =
|
|
964
|
+
var RenderersPortalManager = React.forwardRef(function (_, ref) {
|
|
1007
965
|
var _useState = React.useState([]),
|
|
1008
966
|
_useState2 = _slicedToArray(_useState, 2),
|
|
1009
967
|
portals = _useState2[0],
|
|
@@ -1011,7 +969,7 @@ var RenderersPortalManager = /*#__PURE__*/React.forwardRef(function (_, ref) {
|
|
|
1011
969
|
React.useImperativeHandle(ref, function () {
|
|
1012
970
|
return setPortals;
|
|
1013
971
|
});
|
|
1014
|
-
return
|
|
972
|
+
return React__default["default"].createElement(React.Fragment, null, portals);
|
|
1015
973
|
});
|
|
1016
974
|
|
|
1017
975
|
function getDefaultExportFromCjs (x) {
|
|
@@ -2137,39 +2095,33 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
2137
2095
|
var propTypesExports = propTypes.exports;
|
|
2138
2096
|
var PropTypes = /*@__PURE__*/getDefaultExportFromCjs(propTypesExports);
|
|
2139
2097
|
|
|
2140
|
-
var HotTableInner =
|
|
2141
|
-
/**
|
|
2142
|
-
* Reference to the Handsontable instance.
|
|
2098
|
+
var HotTableInner = React.forwardRef(function (props, ref) {
|
|
2099
|
+
/**
|
|
2100
|
+
* Reference to the Handsontable instance.
|
|
2143
2101
|
*/
|
|
2144
2102
|
var __hotInstance = React.useRef(null);
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
* Reference to the main Handsontable DOM element.
|
|
2103
|
+
/**
|
|
2104
|
+
* Reference to the main Handsontable DOM element.
|
|
2148
2105
|
*/
|
|
2149
2106
|
var hotElementRef = React.useRef(null);
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
* Reference to component-based editor overridden hooks object.
|
|
2107
|
+
/**
|
|
2108
|
+
* Reference to component-based editor overridden hooks object.
|
|
2153
2109
|
*/
|
|
2154
2110
|
var globalEditorHooksRef = React.useRef(null);
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
* Reference to HOT-native custom editor class instance.
|
|
2111
|
+
/**
|
|
2112
|
+
* Reference to HOT-native custom editor class instance.
|
|
2158
2113
|
*/
|
|
2159
2114
|
var globalEditorClassInstance = React.useRef(null);
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
* Reference to the previous props object.
|
|
2115
|
+
/**
|
|
2116
|
+
* Reference to the previous props object.
|
|
2163
2117
|
*/
|
|
2164
2118
|
var prevProps = React.useRef();
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
* HotTable context exposing helper functions.
|
|
2119
|
+
/**
|
|
2120
|
+
* HotTable context exposing helper functions.
|
|
2168
2121
|
*/
|
|
2169
2122
|
var context = useHotTableContext();
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
* Getter for the property storing the Handsontable instance.
|
|
2123
|
+
/**
|
|
2124
|
+
* Getter for the property storing the Handsontable instance.
|
|
2173
2125
|
*/
|
|
2174
2126
|
var getHotInstance = React.useCallback(function () {
|
|
2175
2127
|
if (!__hotInstance.current || !__hotInstance.current.isDestroyed) {
|
|
@@ -2183,19 +2135,17 @@ var HotTableInner = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
2183
2135
|
var isHotInstanceDestroyed = React.useCallback(function () {
|
|
2184
2136
|
return !__hotInstance.current || __hotInstance.current.isDestroyed;
|
|
2185
2137
|
}, [__hotInstance]);
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
* Clear both the editor and the renderer cache.
|
|
2138
|
+
/**
|
|
2139
|
+
* Clear both the editor and the renderer cache.
|
|
2189
2140
|
*/
|
|
2190
2141
|
var clearCache = React.useCallback(function () {
|
|
2191
2142
|
context.clearRenderedCellCache();
|
|
2192
2143
|
context.componentRendererColumns.clear();
|
|
2193
2144
|
}, [context]);
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
*
|
|
2197
|
-
*
|
|
2198
|
-
* @returns The `Document` object used by the component.
|
|
2145
|
+
/**
|
|
2146
|
+
* Get the `Document` object corresponding to the main component element.
|
|
2147
|
+
*
|
|
2148
|
+
* @returns The `Document` object used by the component.
|
|
2199
2149
|
*/
|
|
2200
2150
|
var getOwnerDocument = React.useCallback(function () {
|
|
2201
2151
|
if (isCSR()) {
|
|
@@ -2203,11 +2153,10 @@ var HotTableInner = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
2203
2153
|
}
|
|
2204
2154
|
return null;
|
|
2205
2155
|
}, [hotElementRef]);
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
*
|
|
2209
|
-
*
|
|
2210
|
-
* @returns {Handsontable.GridSettings} New global set of settings for Handsontable.
|
|
2156
|
+
/**
|
|
2157
|
+
* Create a new settings object containing the column settings and global editors and renderers.
|
|
2158
|
+
*
|
|
2159
|
+
* @returns {Handsontable.GridSettings} New global set of settings for Handsontable.
|
|
2211
2160
|
*/
|
|
2212
2161
|
var createNewGlobalSettings = function createNewGlobalSettings() {
|
|
2213
2162
|
var _getHotInstance;
|
|
@@ -2237,9 +2186,8 @@ var HotTableInner = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
2237
2186
|
}
|
|
2238
2187
|
return newSettings;
|
|
2239
2188
|
};
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
* Detect if `autoRowSize` or `autoColumnSize` is defined, and if so, throw an incompatibility warning.
|
|
2189
|
+
/**
|
|
2190
|
+
* Detect if `autoRowSize` or `autoColumnSize` is defined, and if so, throw an incompatibility warning.
|
|
2243
2191
|
*/
|
|
2244
2192
|
var displayAutoSizeWarning = function displayAutoSizeWarning(hotInstance) {
|
|
2245
2193
|
var _hotInstance$getPlugi, _hotInstance$getPlugi2;
|
|
@@ -2249,27 +2197,23 @@ var HotTableInner = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
2249
2197
|
}
|
|
2250
2198
|
}
|
|
2251
2199
|
};
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
* Initialize Handsontable after the component has mounted.
|
|
2200
|
+
/**
|
|
2201
|
+
* Initialize Handsontable after the component has mounted.
|
|
2255
2202
|
*/
|
|
2256
2203
|
React.useEffect(function () {
|
|
2257
2204
|
var newGlobalSettings = createNewGlobalSettings(true);
|
|
2258
|
-
|
|
2259
2205
|
// Update prevProps with the current props
|
|
2260
2206
|
prevProps.current = props;
|
|
2261
2207
|
__hotInstance.current = new Handsontable__default["default"].Core(hotElementRef.current, newGlobalSettings);
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
* Handsontable's `beforeViewRender` hook callback.
|
|
2208
|
+
/**
|
|
2209
|
+
* Handsontable's `beforeViewRender` hook callback.
|
|
2265
2210
|
*/
|
|
2266
2211
|
__hotInstance.current.addHook('beforeViewRender', function () {
|
|
2267
2212
|
context.clearPortalCache();
|
|
2268
2213
|
context.clearRenderedCellCache();
|
|
2269
2214
|
});
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
* Handsontable's `afterViewRender` hook callback.
|
|
2215
|
+
/**
|
|
2216
|
+
* Handsontable's `afterViewRender` hook callback.
|
|
2273
2217
|
*/
|
|
2274
2218
|
__hotInstance.current.addHook('afterViewRender', function () {
|
|
2275
2219
|
context.pushCellPortalsIntoPortalManager();
|
|
@@ -2279,9 +2223,8 @@ var HotTableInner = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
2279
2223
|
if (!displayObsoleteRenderersEditorsWarning(props.children)) {
|
|
2280
2224
|
displayChildrenOfTypeWarning(props.children, HotColumn);
|
|
2281
2225
|
}
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
* Destroy the Handsontable instance when the parent component unmounts.
|
|
2226
|
+
/**
|
|
2227
|
+
* Destroy the Handsontable instance when the parent component unmounts.
|
|
2285
2228
|
*/
|
|
2286
2229
|
return function () {
|
|
2287
2230
|
var _getHotInstance2;
|
|
@@ -2289,24 +2232,21 @@ var HotTableInner = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
2289
2232
|
(_getHotInstance2 = getHotInstance()) === null || _getHotInstance2 === void 0 || _getHotInstance2.destroy();
|
|
2290
2233
|
};
|
|
2291
2234
|
}, []);
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
* Logic performed after the component update.
|
|
2235
|
+
/**
|
|
2236
|
+
* Logic performed after the component update.
|
|
2295
2237
|
*/
|
|
2296
2238
|
useUpdateEffect(function () {
|
|
2297
2239
|
clearCache();
|
|
2298
2240
|
var hotInstance = getHotInstance();
|
|
2299
2241
|
var newGlobalSettings = createNewGlobalSettings(false, prevProps.current);
|
|
2300
|
-
|
|
2301
2242
|
// Update prevProps with the current props
|
|
2302
2243
|
prevProps.current = props;
|
|
2303
2244
|
hotInstance === null || hotInstance === void 0 || hotInstance.updateSettings(newGlobalSettings, false);
|
|
2304
2245
|
displayAutoSizeWarning(hotInstance);
|
|
2305
2246
|
displayObsoleteRenderersEditorsWarning(props.children);
|
|
2306
2247
|
});
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
* Interface exposed to parent components by HotTable instance via React ref
|
|
2248
|
+
/**
|
|
2249
|
+
* Interface exposed to parent components by HotTable instance via React ref
|
|
2310
2250
|
*/
|
|
2311
2251
|
React.useImperativeHandle(ref, function () {
|
|
2312
2252
|
return {
|
|
@@ -2318,12 +2258,11 @@ var HotTableInner = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
2318
2258
|
}
|
|
2319
2259
|
};
|
|
2320
2260
|
});
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
* Render the component.
|
|
2261
|
+
/**
|
|
2262
|
+
* Render the component.
|
|
2324
2263
|
*/
|
|
2325
2264
|
var hotColumnWrapped = React.Children.toArray(props.children).filter(isHotColumn).map(function (childNode, columnIndex) {
|
|
2326
|
-
return
|
|
2265
|
+
return React__default["default"].createElement(HotColumnContextProvider, {
|
|
2327
2266
|
columnIndex: columnIndex,
|
|
2328
2267
|
getOwnerDocument: getOwnerDocument,
|
|
2329
2268
|
key: columnIndex
|
|
@@ -2331,18 +2270,17 @@ var HotTableInner = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
2331
2270
|
});
|
|
2332
2271
|
var containerProps = getContainerAttributesProps(props);
|
|
2333
2272
|
var editorPortal = createEditorPortal(getOwnerDocument(), props.editor);
|
|
2334
|
-
return
|
|
2273
|
+
return React__default["default"].createElement(React.Fragment, null, React__default["default"].createElement("div", Object.assign({
|
|
2335
2274
|
ref: hotElementRef
|
|
2336
|
-
}, containerProps), hotColumnWrapped),
|
|
2275
|
+
}, containerProps), hotColumnWrapped), React__default["default"].createElement(RenderersPortalManager, {
|
|
2337
2276
|
ref: context.setRenderersPortalManagerRef
|
|
2338
|
-
}),
|
|
2277
|
+
}), React__default["default"].createElement(EditorContextProvider, {
|
|
2339
2278
|
hooksRef: globalEditorHooksRef,
|
|
2340
2279
|
hotCustomEditorInstanceRef: globalEditorClassInstance
|
|
2341
2280
|
}, editorPortal));
|
|
2342
2281
|
});
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
* Prop types to be checked at runtime.
|
|
2282
|
+
/**
|
|
2283
|
+
* Prop types to be checked at runtime.
|
|
2346
2284
|
*/
|
|
2347
2285
|
HotTableInner.propTypes = {
|
|
2348
2286
|
style: PropTypes.object,
|
|
@@ -2351,42 +2289,41 @@ HotTableInner.propTypes = {
|
|
|
2351
2289
|
};
|
|
2352
2290
|
|
|
2353
2291
|
var _excluded = ["children"];
|
|
2354
|
-
/**
|
|
2355
|
-
* A Handsontable-ReactJS wrapper.
|
|
2356
|
-
*
|
|
2357
|
-
* To implement, use the `HotTable` tag with properties corresponding to Handsontable options.
|
|
2358
|
-
* For example:
|
|
2359
|
-
*
|
|
2360
|
-
* ```js
|
|
2361
|
-
* <HotTable id="hot" data={dataObject} contextMenu={true} colHeaders={true} width={600} height={300} stretchH="all" />
|
|
2362
|
-
*
|
|
2363
|
-
* // is analogous to
|
|
2364
|
-
* let hot = new Handsontable(document.getElementById('hot'), {
|
|
2365
|
-
* data: dataObject,
|
|
2366
|
-
* contextMenu: true,
|
|
2367
|
-
* colHeaders: true,
|
|
2368
|
-
* width: 600
|
|
2369
|
-
* height: 300
|
|
2370
|
-
* });
|
|
2371
|
-
*
|
|
2372
|
-
* ```
|
|
2292
|
+
/**
|
|
2293
|
+
* A Handsontable-ReactJS wrapper.
|
|
2294
|
+
*
|
|
2295
|
+
* To implement, use the `HotTable` tag with properties corresponding to Handsontable options.
|
|
2296
|
+
* For example:
|
|
2297
|
+
*
|
|
2298
|
+
* ```js
|
|
2299
|
+
* <HotTable id="hot" data={dataObject} contextMenu={true} colHeaders={true} width={600} height={300} stretchH="all" />
|
|
2300
|
+
*
|
|
2301
|
+
* // is analogous to
|
|
2302
|
+
* let hot = new Handsontable(document.getElementById('hot'), {
|
|
2303
|
+
* data: dataObject,
|
|
2304
|
+
* contextMenu: true,
|
|
2305
|
+
* colHeaders: true,
|
|
2306
|
+
* width: 600
|
|
2307
|
+
* height: 300
|
|
2308
|
+
* });
|
|
2309
|
+
*
|
|
2310
|
+
* ```
|
|
2373
2311
|
*/
|
|
2374
|
-
var HotTable =
|
|
2312
|
+
var HotTable = React.forwardRef(function (_ref, ref) {
|
|
2375
2313
|
var _props$id;
|
|
2376
2314
|
var children = _ref.children,
|
|
2377
2315
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
2378
2316
|
var componentId = (_props$id = props.id) !== null && _props$id !== void 0 ? _props$id : React.useId();
|
|
2379
|
-
return
|
|
2317
|
+
return React__default["default"].createElement(HotTableContextProvider, null, React__default["default"].createElement(HotTableInner, Object.assign({
|
|
2380
2318
|
id: componentId
|
|
2381
2319
|
}, props, {
|
|
2382
2320
|
ref: ref
|
|
2383
2321
|
}), children));
|
|
2384
2322
|
});
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
*
|
|
2388
|
-
*
|
|
2389
|
-
* @returns The version number of the package.
|
|
2323
|
+
/**
|
|
2324
|
+
* Package version.
|
|
2325
|
+
*
|
|
2326
|
+
* @returns The version number of the package.
|
|
2390
2327
|
*/
|
|
2391
2328
|
HotTable.version = version;
|
|
2392
2329
|
|