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