@handsontable/react 0.0.0-next-d96e9b5-20240220 → 0.0.0-next-fb8f40a-20240221
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 +2 -2
- package/baseEditorComponent.d.ts +3 -3
- package/commonjs/react-handsontable.js +125 -205
- package/dist/react-handsontable.js +132 -210
- package/dist/react-handsontable.js.map +1 -1
- package/dist/react-handsontable.min.js +4 -4
- package/dist/react-handsontable.min.js.map +1 -1
- package/es/react-handsontable.mjs +126 -205
- package/helpers.d.ts +6 -14
- package/hotTable.d.ts +234 -7
- package/index.d.ts +0 -1
- package/package.json +10 -13
- package/types.d.ts +0 -1
- package/hotTableClass.d.ts +0 -251
package/LICENSE.txt
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Copyright (c) HANDSONCODE sp. z o. o.
|
|
2
2
|
|
|
3
3
|
HANDSONTABLE is a software distributed by HANDSONCODE sp. z o. o., a Polish corporation based in
|
|
4
|
-
Gdynia, Poland, at Aleja
|
|
4
|
+
Gdynia, Poland, at Aleja Zwycięstwa 96-98, registered by the District Court in Gdansk under number
|
|
5
5
|
538651, EU tax ID number: PL5862294002, share capital: PLN 62,800.00.
|
|
6
6
|
|
|
7
7
|
This software is protected by applicable copyright laws, including international treaties, and dual-
|
|
8
|
-
licensed
|
|
8
|
+
licensed – depending on whether your use for commercial purposes, meaning intended for or
|
|
9
9
|
resulting in commercial advantage or monetary compensation, or not.
|
|
10
10
|
|
|
11
11
|
If your use is strictly personal or solely for evaluation purposes, meaning for the purposes of testing
|
package/baseEditorComponent.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Handsontable from 'handsontable/base';
|
|
3
|
-
import {
|
|
3
|
+
import { HotEditorProps } from './types';
|
|
4
4
|
interface BaseEditorProps extends HotEditorProps {
|
|
5
|
-
editorColumnScope
|
|
6
|
-
emitEditorInstance?: (editor: BaseEditorComponent, column:
|
|
5
|
+
editorColumnScope: number;
|
|
6
|
+
emitEditorInstance?: (editor: BaseEditorComponent, column: number) => void;
|
|
7
7
|
}
|
|
8
8
|
declare class BaseEditorComponent<P = {}, S = {}, SS = any> extends React.Component<P & BaseEditorProps, S, SS> implements Handsontable.editors.BaseEditor {
|
|
9
9
|
name: string;
|
|
@@ -5,8 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var ReactDOM = require('react-dom');
|
|
7
7
|
var Handsontable = require('handsontable/base');
|
|
8
|
-
var registry$1 = require('handsontable/renderers/registry');
|
|
9
|
-
var registry = require('handsontable/editors/registry');
|
|
10
8
|
|
|
11
9
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
10
|
|
|
@@ -14,60 +12,35 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
14
12
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
15
13
|
var Handsontable__default = /*#__PURE__*/_interopDefaultLegacy(Handsontable);
|
|
16
14
|
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
function _isNativeReflectConstruct() {
|
|
21
|
-
try {
|
|
22
|
-
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
23
|
-
} catch (t) {}
|
|
24
|
-
return (_isNativeReflectConstruct = function () {
|
|
25
|
-
return !!t;
|
|
26
|
-
})();
|
|
27
|
-
}
|
|
28
|
-
function ownKeys(e, r) {
|
|
29
|
-
var t = Object.keys(e);
|
|
15
|
+
function ownKeys(object, enumerableOnly) {
|
|
16
|
+
var keys = Object.keys(object);
|
|
30
17
|
if (Object.getOwnPropertySymbols) {
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
return Object.getOwnPropertyDescriptor(
|
|
34
|
-
})),
|
|
18
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
19
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
20
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
21
|
+
})), keys.push.apply(keys, symbols);
|
|
35
22
|
}
|
|
36
|
-
return
|
|
23
|
+
return keys;
|
|
37
24
|
}
|
|
38
|
-
function _objectSpread2(
|
|
39
|
-
for (var
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
_defineProperty(
|
|
43
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(
|
|
44
|
-
Object.defineProperty(
|
|
25
|
+
function _objectSpread2(target) {
|
|
26
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
27
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
28
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
29
|
+
_defineProperty(target, key, source[key]);
|
|
30
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
31
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
45
32
|
});
|
|
46
33
|
}
|
|
47
|
-
return
|
|
48
|
-
}
|
|
49
|
-
function _toPrimitive(t, r) {
|
|
50
|
-
if ("object" != typeof t || !t) return t;
|
|
51
|
-
var e = t[Symbol.toPrimitive];
|
|
52
|
-
if (void 0 !== e) {
|
|
53
|
-
var i = e.call(t, r || "default");
|
|
54
|
-
if ("object" != typeof i) return i;
|
|
55
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
56
|
-
}
|
|
57
|
-
return ("string" === r ? String : Number)(t);
|
|
58
|
-
}
|
|
59
|
-
function _toPropertyKey(t) {
|
|
60
|
-
var i = _toPrimitive(t, "string");
|
|
61
|
-
return "symbol" == typeof i ? i : String(i);
|
|
34
|
+
return target;
|
|
62
35
|
}
|
|
63
|
-
function _typeof(
|
|
36
|
+
function _typeof(obj) {
|
|
64
37
|
"@babel/helpers - typeof";
|
|
65
38
|
|
|
66
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (
|
|
67
|
-
return typeof
|
|
68
|
-
} : function (
|
|
69
|
-
return
|
|
70
|
-
}, _typeof(
|
|
39
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
40
|
+
return typeof obj;
|
|
41
|
+
} : function (obj) {
|
|
42
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
43
|
+
}, _typeof(obj);
|
|
71
44
|
}
|
|
72
45
|
function _classCallCheck(instance, Constructor) {
|
|
73
46
|
if (!(instance instanceof Constructor)) {
|
|
@@ -134,32 +107,16 @@ function _setPrototypeOf(o, p) {
|
|
|
134
107
|
};
|
|
135
108
|
return _setPrototypeOf(o, p);
|
|
136
109
|
}
|
|
137
|
-
function
|
|
138
|
-
if (
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
return target;
|
|
148
|
-
}
|
|
149
|
-
function _objectWithoutProperties(source, excluded) {
|
|
150
|
-
if (source == null) return {};
|
|
151
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
152
|
-
var key, i;
|
|
153
|
-
if (Object.getOwnPropertySymbols) {
|
|
154
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
155
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
156
|
-
key = sourceSymbolKeys[i];
|
|
157
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
158
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
159
|
-
target[key] = source[key];
|
|
160
|
-
}
|
|
110
|
+
function _isNativeReflectConstruct() {
|
|
111
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
112
|
+
if (Reflect.construct.sham) return false;
|
|
113
|
+
if (typeof Proxy === "function") return true;
|
|
114
|
+
try {
|
|
115
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
116
|
+
return true;
|
|
117
|
+
} catch (e) {
|
|
118
|
+
return false;
|
|
161
119
|
}
|
|
162
|
-
return target;
|
|
163
120
|
}
|
|
164
121
|
function _assertThisInitialized(self) {
|
|
165
122
|
if (self === void 0) {
|
|
@@ -175,6 +132,20 @@ function _possibleConstructorReturn(self, call) {
|
|
|
175
132
|
}
|
|
176
133
|
return _assertThisInitialized(self);
|
|
177
134
|
}
|
|
135
|
+
function _createSuper(Derived) {
|
|
136
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
137
|
+
return function _createSuperInternal() {
|
|
138
|
+
var Super = _getPrototypeOf(Derived),
|
|
139
|
+
result;
|
|
140
|
+
if (hasNativeReflectConstruct) {
|
|
141
|
+
var NewTarget = _getPrototypeOf(this).constructor;
|
|
142
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
143
|
+
} else {
|
|
144
|
+
result = Super.apply(this, arguments);
|
|
145
|
+
}
|
|
146
|
+
return _possibleConstructorReturn(this, result);
|
|
147
|
+
};
|
|
148
|
+
}
|
|
178
149
|
function _toConsumableArray(arr) {
|
|
179
150
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
180
151
|
}
|
|
@@ -200,6 +171,20 @@ function _arrayLikeToArray(arr, len) {
|
|
|
200
171
|
function _nonIterableSpread() {
|
|
201
172
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
202
173
|
}
|
|
174
|
+
function _toPrimitive(input, hint) {
|
|
175
|
+
if (typeof input !== "object" || input === null) return input;
|
|
176
|
+
var prim = input[Symbol.toPrimitive];
|
|
177
|
+
if (prim !== undefined) {
|
|
178
|
+
var res = prim.call(input, hint || "default");
|
|
179
|
+
if (typeof res !== "object") return res;
|
|
180
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
181
|
+
}
|
|
182
|
+
return (hint === "string" ? String : Number)(input);
|
|
183
|
+
}
|
|
184
|
+
function _toPropertyKey(arg) {
|
|
185
|
+
var key = _toPrimitive(arg, "string");
|
|
186
|
+
return typeof key === "symbol" ? key : String(key);
|
|
187
|
+
}
|
|
203
188
|
|
|
204
189
|
var bulkComponentContainer = null;
|
|
205
190
|
/**
|
|
@@ -266,12 +251,14 @@ function getOriginalEditorClass(editorElement) {
|
|
|
266
251
|
/**
|
|
267
252
|
* Create an editor portal.
|
|
268
253
|
*
|
|
269
|
-
* @param {Document} doc Document to be used.
|
|
254
|
+
* @param {Document} [doc] Document to be used.
|
|
270
255
|
* @param {React.ReactElement} editorElement Editor's element.
|
|
271
256
|
* @returns {React.ReactPortal} The portal for the editor.
|
|
272
257
|
*/
|
|
273
|
-
function createEditorPortal(
|
|
274
|
-
|
|
258
|
+
function createEditorPortal() {
|
|
259
|
+
var doc = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
|
260
|
+
var editorElement = arguments.length > 1 ? arguments[1] : undefined;
|
|
261
|
+
if (editorElement === null) {
|
|
275
262
|
return null;
|
|
276
263
|
}
|
|
277
264
|
var containerProps = getContainerAttributesProps(editorElement.props, false);
|
|
@@ -279,11 +266,11 @@ function createEditorPortal(doc, editorElement) {
|
|
|
279
266
|
return ReactDOM__default["default"].createPortal(React__default["default"].createElement("div", Object.assign({}, containerProps), editorElement), doc.body);
|
|
280
267
|
}
|
|
281
268
|
/**
|
|
282
|
-
* Get an editor element extended with
|
|
269
|
+
* Get an editor element extended with a instance-emitting method.
|
|
283
270
|
*
|
|
284
271
|
* @param {React.ReactNode} children Component children.
|
|
285
272
|
* @param {Map} editorCache Component's editor cache.
|
|
286
|
-
* @param {
|
|
273
|
+
* @param {string|number} [editorColumnScope] The editor scope (column index or a 'global' string). Defaults to
|
|
287
274
|
* 'global'.
|
|
288
275
|
* @returns {React.ReactElement} An editor element containing the additional methods.
|
|
289
276
|
*/
|
|
@@ -312,27 +299,23 @@ function getExtendedEditorElement(children, editorCache) {
|
|
|
312
299
|
* @param {React.ReactElement} rElement React element to be used as a base for the component.
|
|
313
300
|
* @param {Object} props Props to be passed to the cloned element.
|
|
314
301
|
* @param {Document} [ownerDocument] The owner document to set the portal up into.
|
|
315
|
-
* @param {String} portalKey The key to be used for the portal.
|
|
316
|
-
* @param {HTMLElement} [cachedContainer] The cached container to be used for the portal.
|
|
317
302
|
* @returns {{portal: React.ReactPortal, portalContainer: HTMLElement}} An object containing the portal and its container.
|
|
318
303
|
*/
|
|
319
304
|
function createPortal(rElement, props) {
|
|
320
305
|
var ownerDocument = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document;
|
|
321
|
-
var portalKey = arguments.length > 3 ? arguments[3] : undefined;
|
|
322
|
-
var cachedContainer = arguments.length > 4 ? arguments[4] : undefined;
|
|
323
306
|
if (!ownerDocument) {
|
|
324
307
|
ownerDocument = document;
|
|
325
308
|
}
|
|
326
309
|
if (!bulkComponentContainer) {
|
|
327
310
|
bulkComponentContainer = ownerDocument.createDocumentFragment();
|
|
328
311
|
}
|
|
329
|
-
var portalContainer =
|
|
312
|
+
var portalContainer = ownerDocument.createElement('DIV');
|
|
330
313
|
bulkComponentContainer.appendChild(portalContainer);
|
|
331
314
|
var extendedRendererElement = React__default["default"].cloneElement(rElement, _objectSpread2({
|
|
332
315
|
key: "".concat(props.row, "-").concat(props.col)
|
|
333
316
|
}, props));
|
|
334
317
|
return {
|
|
335
|
-
portal: ReactDOM__default["default"].createPortal(extendedRendererElement, portalContainer,
|
|
318
|
+
portal: ReactDOM__default["default"].createPortal(extendedRendererElement, portalContainer, "".concat(props.row, "-").concat(props.col, "-").concat(Math.random())),
|
|
336
319
|
portalContainer: portalContainer
|
|
337
320
|
};
|
|
338
321
|
}
|
|
@@ -348,19 +331,11 @@ function createPortal(rElement, props) {
|
|
|
348
331
|
function getContainerAttributesProps(props) {
|
|
349
332
|
var randomizeId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
350
333
|
return {
|
|
351
|
-
id: props.id || (randomizeId ? 'hot-' + Math.random().toString(36).substring(5) :
|
|
334
|
+
id: props.id || (randomizeId ? 'hot-' + Math.random().toString(36).substring(5) : void 0),
|
|
352
335
|
className: props.className || '',
|
|
353
336
|
style: props.style || {}
|
|
354
337
|
};
|
|
355
338
|
}
|
|
356
|
-
/**
|
|
357
|
-
* Checks if the environment that the code runs in is a browser.
|
|
358
|
-
*
|
|
359
|
-
* @returns {boolean}
|
|
360
|
-
*/
|
|
361
|
-
function isCSR() {
|
|
362
|
-
return typeof window !== 'undefined';
|
|
363
|
-
}
|
|
364
339
|
|
|
365
340
|
var SettingsMapper = /*#__PURE__*/function () {
|
|
366
341
|
function SettingsMapper() {
|
|
@@ -398,9 +373,10 @@ var SettingsMapper = /*#__PURE__*/function () {
|
|
|
398
373
|
|
|
399
374
|
var HotColumn = /*#__PURE__*/function (_React$Component) {
|
|
400
375
|
_inherits(HotColumn, _React$Component);
|
|
376
|
+
var _super = _createSuper(HotColumn);
|
|
401
377
|
function HotColumn() {
|
|
402
378
|
_classCallCheck(this, HotColumn);
|
|
403
|
-
return
|
|
379
|
+
return _super.apply(this, arguments);
|
|
404
380
|
}
|
|
405
381
|
_createClass(HotColumn, [{
|
|
406
382
|
key: "getSettingsProps",
|
|
@@ -499,10 +475,11 @@ var HotColumn = /*#__PURE__*/function (_React$Component) {
|
|
|
499
475
|
*/
|
|
500
476
|
var RenderersPortalManager = /*#__PURE__*/function (_React$Component) {
|
|
501
477
|
_inherits(RenderersPortalManager, _React$Component);
|
|
478
|
+
var _super = _createSuper(RenderersPortalManager);
|
|
502
479
|
function RenderersPortalManager() {
|
|
503
480
|
var _this;
|
|
504
481
|
_classCallCheck(this, RenderersPortalManager);
|
|
505
|
-
_this =
|
|
482
|
+
_this = _super.apply(this, arguments);
|
|
506
483
|
_this.state = {
|
|
507
484
|
portals: []
|
|
508
485
|
};
|
|
@@ -517,7 +494,7 @@ var RenderersPortalManager = /*#__PURE__*/function (_React$Component) {
|
|
|
517
494
|
return RenderersPortalManager;
|
|
518
495
|
}(React__default["default"].Component);
|
|
519
496
|
|
|
520
|
-
var version="0.0.0-next-
|
|
497
|
+
var version="0.0.0-next-fb8f40a-20240221";
|
|
521
498
|
|
|
522
499
|
function createCommonjsModule(fn, module) {
|
|
523
500
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
@@ -1658,14 +1635,15 @@ var PropTypes = propTypes;
|
|
|
1658
1635
|
*
|
|
1659
1636
|
* ```
|
|
1660
1637
|
*
|
|
1661
|
-
* @class
|
|
1638
|
+
* @class HotTable
|
|
1662
1639
|
*/
|
|
1663
|
-
var
|
|
1664
|
-
_inherits(
|
|
1665
|
-
|
|
1640
|
+
var HotTable = /*#__PURE__*/function (_React$Component) {
|
|
1641
|
+
_inherits(HotTable, _React$Component);
|
|
1642
|
+
var _super = _createSuper(HotTable);
|
|
1643
|
+
function HotTable() {
|
|
1666
1644
|
var _this;
|
|
1667
|
-
_classCallCheck(this,
|
|
1668
|
-
_this =
|
|
1645
|
+
_classCallCheck(this, HotTable);
|
|
1646
|
+
_this = _super.apply(this, arguments);
|
|
1669
1647
|
/**
|
|
1670
1648
|
* The `id` of the main Handsontable DOM element.
|
|
1671
1649
|
*
|
|
@@ -1698,17 +1676,9 @@ var HotTableClass = /*#__PURE__*/function (_React$Component) {
|
|
|
1698
1676
|
*/
|
|
1699
1677
|
_this.renderersPortalManager = null;
|
|
1700
1678
|
/**
|
|
1701
|
-
*
|
|
1702
|
-
* @type {Map<string, React.ReactPortal>}
|
|
1703
|
-
*/
|
|
1704
|
-
_this.portalCache = new Map();
|
|
1705
|
-
/**
|
|
1706
|
-
* Portal Container Cache
|
|
1707
|
-
*
|
|
1708
|
-
* @private
|
|
1709
|
-
* @type {Map}
|
|
1679
|
+
* Array containing the portals cashed to be rendered in bulk after Handsontable's render cycle.
|
|
1710
1680
|
*/
|
|
1711
|
-
_this.
|
|
1681
|
+
_this.portalCacheArray = [];
|
|
1712
1682
|
/**
|
|
1713
1683
|
* The rendered cells cache.
|
|
1714
1684
|
*
|
|
@@ -1738,7 +1708,7 @@ var HotTableClass = /*#__PURE__*/function (_React$Component) {
|
|
|
1738
1708
|
*
|
|
1739
1709
|
* @returns The version number of the package.
|
|
1740
1710
|
*/
|
|
1741
|
-
_createClass(
|
|
1711
|
+
_createClass(HotTable, [{
|
|
1742
1712
|
key: "hotInstance",
|
|
1743
1713
|
get:
|
|
1744
1714
|
/**
|
|
@@ -1760,16 +1730,6 @@ var HotTableClass = /*#__PURE__*/function (_React$Component) {
|
|
|
1760
1730
|
set: function set(hotInstance) {
|
|
1761
1731
|
this.__hotInstance = hotInstance;
|
|
1762
1732
|
}
|
|
1763
|
-
/**
|
|
1764
|
-
* Get Portal Container Cache
|
|
1765
|
-
*
|
|
1766
|
-
* @returns {Map}
|
|
1767
|
-
*/
|
|
1768
|
-
}, {
|
|
1769
|
-
key: "getPortalContainerCache",
|
|
1770
|
-
value: function getPortalContainerCache() {
|
|
1771
|
-
return this.portalContainerCache;
|
|
1772
|
-
}
|
|
1773
1733
|
/**
|
|
1774
1734
|
* Get the rendered table cell cache.
|
|
1775
1735
|
*
|
|
@@ -1807,10 +1767,7 @@ var HotTableClass = /*#__PURE__*/function (_React$Component) {
|
|
|
1807
1767
|
}, {
|
|
1808
1768
|
key: "getOwnerDocument",
|
|
1809
1769
|
value: function getOwnerDocument() {
|
|
1810
|
-
|
|
1811
|
-
return this.hotElementRef ? this.hotElementRef.ownerDocument : document;
|
|
1812
|
-
}
|
|
1813
|
-
return null;
|
|
1770
|
+
return this.hotElementRef ? this.hotElementRef.ownerDocument : document;
|
|
1814
1771
|
}
|
|
1815
1772
|
/**
|
|
1816
1773
|
* Set the reference to the main Handsontable DOM element.
|
|
@@ -1832,44 +1789,30 @@ var HotTableClass = /*#__PURE__*/function (_React$Component) {
|
|
|
1832
1789
|
key: "getRendererWrapper",
|
|
1833
1790
|
value: function getRendererWrapper(rendererElement) {
|
|
1834
1791
|
var hotTableComponent = this;
|
|
1835
|
-
return function
|
|
1792
|
+
return function (instance, TD, row, col, prop, value, cellProperties) {
|
|
1836
1793
|
var renderedCellCache = hotTableComponent.getRenderedCellCache();
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
// Handsontable.Core type is missing guid
|
|
1840
|
-
var instanceGuid = instance.guid;
|
|
1841
|
-
var portalContainerKey = "".concat(instanceGuid, "-").concat(key);
|
|
1842
|
-
var portalKey = "".concat(key, "-").concat(instanceGuid);
|
|
1843
|
-
if (renderedCellCache.has(key)) {
|
|
1844
|
-
TD.innerHTML = renderedCellCache.get(key).innerHTML;
|
|
1794
|
+
if (renderedCellCache.has("".concat(row, "-").concat(col))) {
|
|
1795
|
+
TD.innerHTML = renderedCellCache.get("".concat(row, "-").concat(col)).innerHTML;
|
|
1845
1796
|
}
|
|
1846
1797
|
if (TD && !TD.getAttribute('ghost-table')) {
|
|
1847
|
-
var
|
|
1848
|
-
|
|
1798
|
+
var _createPortal = createPortal(rendererElement, {
|
|
1799
|
+
TD: TD,
|
|
1800
|
+
row: row,
|
|
1801
|
+
col: col,
|
|
1802
|
+
prop: prop,
|
|
1803
|
+
value: value,
|
|
1804
|
+
cellProperties: cellProperties,
|
|
1805
|
+
isRenderer: true
|
|
1806
|
+
}, TD.ownerDocument),
|
|
1807
|
+
portal = _createPortal.portal,
|
|
1808
|
+
portalContainer = _createPortal.portalContainer;
|
|
1849
1809
|
while (TD.firstChild) {
|
|
1850
1810
|
TD.removeChild(TD.firstChild);
|
|
1851
1811
|
}
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
TD.appendChild(cachedPortalContainer);
|
|
1855
|
-
} else {
|
|
1856
|
-
var _createPortal = createPortal(rendererElement, {
|
|
1857
|
-
TD: TD,
|
|
1858
|
-
row: row,
|
|
1859
|
-
col: col,
|
|
1860
|
-
prop: prop,
|
|
1861
|
-
value: value,
|
|
1862
|
-
cellProperties: cellProperties,
|
|
1863
|
-
isRenderer: true
|
|
1864
|
-
}, TD.ownerDocument, portalKey, cachedPortalContainer),
|
|
1865
|
-
portal = _createPortal.portal,
|
|
1866
|
-
portalContainer = _createPortal.portalContainer;
|
|
1867
|
-
portalContainerCache.set(portalContainerKey, portalContainer);
|
|
1868
|
-
TD.appendChild(portalContainer);
|
|
1869
|
-
hotTableComponent.portalCache.set(portalKey, portal);
|
|
1870
|
-
}
|
|
1812
|
+
TD.appendChild(portalContainer);
|
|
1813
|
+
hotTableComponent.portalCacheArray.push(portal);
|
|
1871
1814
|
}
|
|
1872
|
-
renderedCellCache.set(
|
|
1815
|
+
renderedCellCache.set("".concat(row, "-").concat(col), TD);
|
|
1873
1816
|
return TD;
|
|
1874
1817
|
};
|
|
1875
1818
|
}
|
|
@@ -1901,10 +1844,11 @@ var HotTableClass = /*#__PURE__*/function (_React$Component) {
|
|
|
1901
1844
|
value: function makeEditorClass(editorComponent) {
|
|
1902
1845
|
var customEditorClass = /*#__PURE__*/function (_Handsontable$editors) {
|
|
1903
1846
|
_inherits(CustomEditor, _Handsontable$editors);
|
|
1847
|
+
var _super2 = _createSuper(CustomEditor);
|
|
1904
1848
|
function CustomEditor(hotInstance) {
|
|
1905
1849
|
var _this2;
|
|
1906
1850
|
_classCallCheck(this, CustomEditor);
|
|
1907
|
-
_this2 =
|
|
1851
|
+
_this2 = _super2.call(this, hotInstance);
|
|
1908
1852
|
editorComponent.hotCustomEditorInstance = _assertThisInitialized(_this2);
|
|
1909
1853
|
_this2.editorComponent = editorComponent;
|
|
1910
1854
|
return _this2;
|
|
@@ -1978,23 +1922,13 @@ var HotTableClass = /*#__PURE__*/function (_React$Component) {
|
|
|
1978
1922
|
if (globalEditorNode) {
|
|
1979
1923
|
newSettings.editor = this.getEditorClass(globalEditorNode, GLOBAL_EDITOR_SCOPE);
|
|
1980
1924
|
} else {
|
|
1981
|
-
|
|
1982
|
-
if (this.props.editor || (_this$props$settings = this.props.settings) !== null && _this$props$settings !== void 0 && _this$props$settings.editor) {
|
|
1983
|
-
newSettings.editor = this.props.editor || this.props.settings.editor;
|
|
1984
|
-
} else {
|
|
1985
|
-
newSettings.editor = registry.getEditor('text');
|
|
1986
|
-
}
|
|
1925
|
+
newSettings.editor = this.props.editor || (this.props.settings ? this.props.settings.editor : void 0);
|
|
1987
1926
|
}
|
|
1988
1927
|
if (globalRendererNode) {
|
|
1989
1928
|
newSettings.renderer = this.getRendererWrapper(globalRendererNode);
|
|
1990
1929
|
this.componentRendererColumns.set('global', true);
|
|
1991
1930
|
} else {
|
|
1992
|
-
|
|
1993
|
-
if (this.props.renderer || (_this$props$settings2 = this.props.settings) !== null && _this$props$settings2 !== void 0 && _this$props$settings2.renderer) {
|
|
1994
|
-
newSettings.renderer = this.props.renderer || this.props.settings.renderer;
|
|
1995
|
-
} else {
|
|
1996
|
-
newSettings.renderer = registry$1.getRenderer('text');
|
|
1997
|
-
}
|
|
1931
|
+
newSettings.renderer = this.props.renderer || (this.props.settings ? this.props.settings.renderer : void 0);
|
|
1998
1932
|
}
|
|
1999
1933
|
return newSettings;
|
|
2000
1934
|
}
|
|
@@ -2030,7 +1964,6 @@ var HotTableClass = /*#__PURE__*/function (_React$Component) {
|
|
|
2030
1964
|
}, {
|
|
2031
1965
|
key: "handsontableBeforeViewRender",
|
|
2032
1966
|
value: function handsontableBeforeViewRender() {
|
|
2033
|
-
this.portalCache.clear();
|
|
2034
1967
|
this.getRenderedCellCache().clear();
|
|
2035
1968
|
}
|
|
2036
1969
|
/**
|
|
@@ -2039,8 +1972,11 @@ var HotTableClass = /*#__PURE__*/function (_React$Component) {
|
|
|
2039
1972
|
}, {
|
|
2040
1973
|
key: "handsontableAfterViewRender",
|
|
2041
1974
|
value: function handsontableAfterViewRender() {
|
|
1975
|
+
var _this3 = this;
|
|
2042
1976
|
this.renderersPortalManager.setState({
|
|
2043
|
-
portals: _toConsumableArray(this.
|
|
1977
|
+
portals: _toConsumableArray(this.portalCacheArray)
|
|
1978
|
+
}, function () {
|
|
1979
|
+
_this3.portalCacheArray = [];
|
|
2044
1980
|
});
|
|
2045
1981
|
}
|
|
2046
1982
|
/**
|
|
@@ -2076,14 +2012,14 @@ var HotTableClass = /*#__PURE__*/function (_React$Component) {
|
|
|
2076
2012
|
}, {
|
|
2077
2013
|
key: "componentDidMount",
|
|
2078
2014
|
value: function componentDidMount() {
|
|
2079
|
-
var
|
|
2015
|
+
var _this4 = this;
|
|
2080
2016
|
var newGlobalSettings = this.createNewGlobalSettings();
|
|
2081
2017
|
this.hotInstance = new Handsontable__default["default"].Core(this.hotElementRef, newGlobalSettings);
|
|
2082
2018
|
this.hotInstance.addHook('beforeViewRender', function () {
|
|
2083
|
-
return
|
|
2019
|
+
return _this4.handsontableBeforeViewRender();
|
|
2084
2020
|
});
|
|
2085
2021
|
this.hotInstance.addHook('afterViewRender', function () {
|
|
2086
|
-
return
|
|
2022
|
+
return _this4.handsontableAfterViewRender();
|
|
2087
2023
|
});
|
|
2088
2024
|
// `init` missing in Handsontable's type definitions.
|
|
2089
2025
|
this.hotInstance.init();
|
|
@@ -2117,7 +2053,8 @@ var HotTableClass = /*#__PURE__*/function (_React$Component) {
|
|
|
2117
2053
|
}, {
|
|
2118
2054
|
key: "render",
|
|
2119
2055
|
value: function render() {
|
|
2120
|
-
var
|
|
2056
|
+
var _this5 = this;
|
|
2057
|
+
var containerProps = getContainerAttributesProps(this.props);
|
|
2121
2058
|
var isHotColumn = function isHotColumn(childNode) {
|
|
2122
2059
|
return childNode.type === HotColumn;
|
|
2123
2060
|
};
|
|
@@ -2127,18 +2064,17 @@ var HotTableClass = /*#__PURE__*/function (_React$Component) {
|
|
|
2127
2064
|
return isHotColumn(childNode);
|
|
2128
2065
|
}).map(function (childNode, columnIndex) {
|
|
2129
2066
|
return React__default["default"].cloneElement(childNode, {
|
|
2130
|
-
_componentRendererColumns:
|
|
2131
|
-
_emitColumnSettings:
|
|
2067
|
+
_componentRendererColumns: _this5.componentRendererColumns,
|
|
2068
|
+
_emitColumnSettings: _this5.setHotColumnSettings.bind(_this5),
|
|
2132
2069
|
_columnIndex: columnIndex,
|
|
2133
|
-
_getChildElementByType: getChildElementByType.bind(
|
|
2134
|
-
_getRendererWrapper:
|
|
2135
|
-
_getEditorClass:
|
|
2136
|
-
_getOwnerDocument:
|
|
2137
|
-
_getEditorCache:
|
|
2070
|
+
_getChildElementByType: getChildElementByType.bind(_this5),
|
|
2071
|
+
_getRendererWrapper: _this5.getRendererWrapper.bind(_this5),
|
|
2072
|
+
_getEditorClass: _this5.getEditorClass.bind(_this5),
|
|
2073
|
+
_getOwnerDocument: _this5.getOwnerDocument.bind(_this5),
|
|
2074
|
+
_getEditorCache: _this5.getEditorCache.bind(_this5),
|
|
2138
2075
|
children: childNode.props.children
|
|
2139
2076
|
});
|
|
2140
2077
|
});
|
|
2141
|
-
var containerProps = getContainerAttributesProps(this.props);
|
|
2142
2078
|
var editorPortal = createEditorPortal(this.getOwnerDocument(), this.getGlobalEditorElement());
|
|
2143
2079
|
return React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement("div", Object.assign({
|
|
2144
2080
|
ref: this.setHotElementRef.bind(this)
|
|
@@ -2152,39 +2088,24 @@ var HotTableClass = /*#__PURE__*/function (_React$Component) {
|
|
|
2152
2088
|
return version;
|
|
2153
2089
|
}
|
|
2154
2090
|
}]);
|
|
2155
|
-
return
|
|
2091
|
+
return HotTable;
|
|
2156
2092
|
}(React__default["default"].Component);
|
|
2157
2093
|
/**
|
|
2158
2094
|
* Prop types to be checked at runtime.
|
|
2159
2095
|
*/
|
|
2160
|
-
|
|
2096
|
+
HotTable.propTypes = {
|
|
2161
2097
|
style: PropTypes.object,
|
|
2162
2098
|
id: PropTypes.string,
|
|
2163
2099
|
className: PropTypes.string
|
|
2164
2100
|
};
|
|
2165
2101
|
|
|
2166
|
-
var _excluded = ["children"];
|
|
2167
|
-
// Use global React variable for `forwardRef` access (React 16 support)
|
|
2168
|
-
var HotTable = React__default["default"].forwardRef(function (_ref, ref) {
|
|
2169
|
-
var _props$id;
|
|
2170
|
-
var children = _ref.children,
|
|
2171
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
2172
|
-
var generatedId = typeof React__default["default"].useId === 'function' ? React__default["default"].useId() : undefined;
|
|
2173
|
-
var componentId = (_props$id = props.id) !== null && _props$id !== void 0 ? _props$id : generatedId;
|
|
2174
|
-
return React__default["default"].createElement(HotTableClass, Object.assign({
|
|
2175
|
-
id: componentId
|
|
2176
|
-
}, props, {
|
|
2177
|
-
ref: ref
|
|
2178
|
-
}), children);
|
|
2179
|
-
});
|
|
2180
|
-
HotTable.version = HotTableClass.version;
|
|
2181
|
-
|
|
2182
2102
|
var BaseEditorComponent = /*#__PURE__*/function (_React$Component) {
|
|
2183
2103
|
_inherits(BaseEditorComponent, _React$Component);
|
|
2104
|
+
var _super = _createSuper(BaseEditorComponent);
|
|
2184
2105
|
function BaseEditorComponent() {
|
|
2185
2106
|
var _this;
|
|
2186
2107
|
_classCallCheck(this, BaseEditorComponent);
|
|
2187
|
-
_this =
|
|
2108
|
+
_this = _super.apply(this, arguments);
|
|
2188
2109
|
_this.name = 'BaseEditorComponent';
|
|
2189
2110
|
_this.instance = null;
|
|
2190
2111
|
_this.row = null;
|
|
@@ -2449,5 +2370,4 @@ var BaseEditorComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
2449
2370
|
exports.BaseEditorComponent = BaseEditorComponent;
|
|
2450
2371
|
exports.HotColumn = HotColumn;
|
|
2451
2372
|
exports.HotTable = HotTable;
|
|
2452
|
-
exports.HotTableClass = HotTableClass;
|
|
2453
2373
|
exports["default"] = HotTable;
|