@handsontable/react 0.0.0-next-fb8f40a-20240221 → 0.0.0-next-d4816a9-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 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 Zwycięstwa 96-98, registered by the District Court in Gdansk under number
4
+ Gdynia, Poland, at Aleja Zwyciestwa 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 – depending on whether your use for commercial purposes, meaning intended for or
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
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import Handsontable from 'handsontable/base';
3
- import { HotEditorProps } from './types';
3
+ import { EditorScopeIdentifier, HotEditorProps } from './types';
4
4
  interface BaseEditorProps extends HotEditorProps {
5
- editorColumnScope: number;
6
- emitEditorInstance?: (editor: BaseEditorComponent, column: number) => void;
5
+ editorColumnScope?: EditorScopeIdentifier;
6
+ emitEditorInstance?: (editor: BaseEditorComponent, column: EditorScopeIdentifier) => 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,6 +5,8 @@ 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');
8
10
 
9
11
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
12
 
@@ -12,35 +14,60 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
12
14
  var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
13
15
  var Handsontable__default = /*#__PURE__*/_interopDefaultLegacy(Handsontable);
14
16
 
15
- function ownKeys(object, enumerableOnly) {
16
- var keys = Object.keys(object);
17
+ function _callSuper(t, o, e) {
18
+ return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
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);
17
30
  if (Object.getOwnPropertySymbols) {
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);
31
+ var o = Object.getOwnPropertySymbols(e);
32
+ r && (o = o.filter(function (r) {
33
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
34
+ })), t.push.apply(t, o);
22
35
  }
23
- return keys;
36
+ return t;
24
37
  }
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));
38
+ function _objectSpread2(e) {
39
+ for (var r = 1; r < arguments.length; r++) {
40
+ var t = null != arguments[r] ? arguments[r] : {};
41
+ r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
42
+ _defineProperty(e, r, t[r]);
43
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
44
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
32
45
  });
33
46
  }
34
- return target;
47
+ return e;
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);
35
58
  }
36
- function _typeof(obj) {
59
+ function _toPropertyKey(t) {
60
+ var i = _toPrimitive(t, "string");
61
+ return "symbol" == typeof i ? i : String(i);
62
+ }
63
+ function _typeof(o) {
37
64
  "@babel/helpers - typeof";
38
65
 
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);
66
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
67
+ return typeof o;
68
+ } : function (o) {
69
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
70
+ }, _typeof(o);
44
71
  }
45
72
  function _classCallCheck(instance, Constructor) {
46
73
  if (!(instance instanceof Constructor)) {
@@ -107,16 +134,32 @@ function _setPrototypeOf(o, p) {
107
134
  };
108
135
  return _setPrototypeOf(o, p);
109
136
  }
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;
137
+ function _objectWithoutPropertiesLoose(source, excluded) {
138
+ if (source == null) return {};
139
+ var target = {};
140
+ var sourceKeys = Object.keys(source);
141
+ var key, i;
142
+ for (i = 0; i < sourceKeys.length; i++) {
143
+ key = sourceKeys[i];
144
+ if (excluded.indexOf(key) >= 0) continue;
145
+ target[key] = source[key];
119
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
+ }
161
+ }
162
+ return target;
120
163
  }
121
164
  function _assertThisInitialized(self) {
122
165
  if (self === void 0) {
@@ -132,20 +175,6 @@ function _possibleConstructorReturn(self, call) {
132
175
  }
133
176
  return _assertThisInitialized(self);
134
177
  }
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
- }
149
178
  function _toConsumableArray(arr) {
150
179
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
151
180
  }
@@ -171,20 +200,6 @@ function _arrayLikeToArray(arr, len) {
171
200
  function _nonIterableSpread() {
172
201
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
173
202
  }
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
- }
188
203
 
189
204
  var bulkComponentContainer = null;
190
205
  /**
@@ -251,14 +266,12 @@ function getOriginalEditorClass(editorElement) {
251
266
  /**
252
267
  * Create an editor portal.
253
268
  *
254
- * @param {Document} [doc] Document to be used.
269
+ * @param {Document} doc Document to be used.
255
270
  * @param {React.ReactElement} editorElement Editor's element.
256
271
  * @returns {React.ReactPortal} The portal for the editor.
257
272
  */
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) {
273
+ function createEditorPortal(doc, editorElement) {
274
+ if (typeof doc === 'undefined' || editorElement === null) {
262
275
  return null;
263
276
  }
264
277
  var containerProps = getContainerAttributesProps(editorElement.props, false);
@@ -266,11 +279,11 @@ function createEditorPortal() {
266
279
  return ReactDOM__default["default"].createPortal(React__default["default"].createElement("div", Object.assign({}, containerProps), editorElement), doc.body);
267
280
  }
268
281
  /**
269
- * Get an editor element extended with a instance-emitting method.
282
+ * Get an editor element extended with an instance-emitting method.
270
283
  *
271
284
  * @param {React.ReactNode} children Component children.
272
285
  * @param {Map} editorCache Component's editor cache.
273
- * @param {string|number} [editorColumnScope] The editor scope (column index or a 'global' string). Defaults to
286
+ * @param {EditorScopeIdentifier} [editorColumnScope] The editor scope (column index or a 'global' string). Defaults to
274
287
  * 'global'.
275
288
  * @returns {React.ReactElement} An editor element containing the additional methods.
276
289
  */
@@ -299,23 +312,27 @@ function getExtendedEditorElement(children, editorCache) {
299
312
  * @param {React.ReactElement} rElement React element to be used as a base for the component.
300
313
  * @param {Object} props Props to be passed to the cloned element.
301
314
  * @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.
302
317
  * @returns {{portal: React.ReactPortal, portalContainer: HTMLElement}} An object containing the portal and its container.
303
318
  */
304
319
  function createPortal(rElement, props) {
305
320
  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;
306
323
  if (!ownerDocument) {
307
324
  ownerDocument = document;
308
325
  }
309
326
  if (!bulkComponentContainer) {
310
327
  bulkComponentContainer = ownerDocument.createDocumentFragment();
311
328
  }
312
- var portalContainer = ownerDocument.createElement('DIV');
329
+ var portalContainer = cachedContainer !== null && cachedContainer !== void 0 ? cachedContainer : ownerDocument.createElement('DIV');
313
330
  bulkComponentContainer.appendChild(portalContainer);
314
331
  var extendedRendererElement = React__default["default"].cloneElement(rElement, _objectSpread2({
315
332
  key: "".concat(props.row, "-").concat(props.col)
316
333
  }, props));
317
334
  return {
318
- portal: ReactDOM__default["default"].createPortal(extendedRendererElement, portalContainer, "".concat(props.row, "-").concat(props.col, "-").concat(Math.random())),
335
+ portal: ReactDOM__default["default"].createPortal(extendedRendererElement, portalContainer, portalKey),
319
336
  portalContainer: portalContainer
320
337
  };
321
338
  }
@@ -331,11 +348,19 @@ function createPortal(rElement, props) {
331
348
  function getContainerAttributesProps(props) {
332
349
  var randomizeId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
333
350
  return {
334
- id: props.id || (randomizeId ? 'hot-' + Math.random().toString(36).substring(5) : void 0),
351
+ id: props.id || (randomizeId ? 'hot-' + Math.random().toString(36).substring(5) : undefined),
335
352
  className: props.className || '',
336
353
  style: props.style || {}
337
354
  };
338
355
  }
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
+ }
339
364
 
340
365
  var SettingsMapper = /*#__PURE__*/function () {
341
366
  function SettingsMapper() {
@@ -373,10 +398,9 @@ var SettingsMapper = /*#__PURE__*/function () {
373
398
 
374
399
  var HotColumn = /*#__PURE__*/function (_React$Component) {
375
400
  _inherits(HotColumn, _React$Component);
376
- var _super = _createSuper(HotColumn);
377
401
  function HotColumn() {
378
402
  _classCallCheck(this, HotColumn);
379
- return _super.apply(this, arguments);
403
+ return _callSuper(this, HotColumn, arguments);
380
404
  }
381
405
  _createClass(HotColumn, [{
382
406
  key: "getSettingsProps",
@@ -475,11 +499,10 @@ var HotColumn = /*#__PURE__*/function (_React$Component) {
475
499
  */
476
500
  var RenderersPortalManager = /*#__PURE__*/function (_React$Component) {
477
501
  _inherits(RenderersPortalManager, _React$Component);
478
- var _super = _createSuper(RenderersPortalManager);
479
502
  function RenderersPortalManager() {
480
503
  var _this;
481
504
  _classCallCheck(this, RenderersPortalManager);
482
- _this = _super.apply(this, arguments);
505
+ _this = _callSuper(this, RenderersPortalManager, arguments);
483
506
  _this.state = {
484
507
  portals: []
485
508
  };
@@ -494,7 +517,7 @@ var RenderersPortalManager = /*#__PURE__*/function (_React$Component) {
494
517
  return RenderersPortalManager;
495
518
  }(React__default["default"].Component);
496
519
 
497
- var version="0.0.0-next-fb8f40a-20240221";
520
+ var version="0.0.0-next-d4816a9-20240221";
498
521
 
499
522
  function createCommonjsModule(fn, module) {
500
523
  return module = { exports: {} }, fn(module, module.exports), module.exports;
@@ -1635,15 +1658,14 @@ var PropTypes = propTypes;
1635
1658
  *
1636
1659
  * ```
1637
1660
  *
1638
- * @class HotTable
1661
+ * @class HotTableCB
1639
1662
  */
1640
- var HotTable = /*#__PURE__*/function (_React$Component) {
1641
- _inherits(HotTable, _React$Component);
1642
- var _super = _createSuper(HotTable);
1643
- function HotTable() {
1663
+ var HotTableClass = /*#__PURE__*/function (_React$Component) {
1664
+ _inherits(HotTableClass, _React$Component);
1665
+ function HotTableClass() {
1644
1666
  var _this;
1645
- _classCallCheck(this, HotTable);
1646
- _this = _super.apply(this, arguments);
1667
+ _classCallCheck(this, HotTableClass);
1668
+ _this = _callSuper(this, HotTableClass, arguments);
1647
1669
  /**
1648
1670
  * The `id` of the main Handsontable DOM element.
1649
1671
  *
@@ -1676,9 +1698,17 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
1676
1698
  */
1677
1699
  _this.renderersPortalManager = null;
1678
1700
  /**
1679
- * Array containing the portals cashed to be rendered in bulk after Handsontable's render cycle.
1701
+ * Map that stores React portals.
1702
+ * @type {Map<string, React.ReactPortal>}
1703
+ */
1704
+ _this.portalCache = new Map();
1705
+ /**
1706
+ * Portal Container Cache
1707
+ *
1708
+ * @private
1709
+ * @type {Map}
1680
1710
  */
1681
- _this.portalCacheArray = [];
1711
+ _this.portalContainerCache = new Map();
1682
1712
  /**
1683
1713
  * The rendered cells cache.
1684
1714
  *
@@ -1708,7 +1738,7 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
1708
1738
  *
1709
1739
  * @returns The version number of the package.
1710
1740
  */
1711
- _createClass(HotTable, [{
1741
+ _createClass(HotTableClass, [{
1712
1742
  key: "hotInstance",
1713
1743
  get:
1714
1744
  /**
@@ -1730,6 +1760,16 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
1730
1760
  set: function set(hotInstance) {
1731
1761
  this.__hotInstance = hotInstance;
1732
1762
  }
1763
+ /**
1764
+ * Get Portal Container Cache
1765
+ *
1766
+ * @returns {Map}
1767
+ */
1768
+ }, {
1769
+ key: "getPortalContainerCache",
1770
+ value: function getPortalContainerCache() {
1771
+ return this.portalContainerCache;
1772
+ }
1733
1773
  /**
1734
1774
  * Get the rendered table cell cache.
1735
1775
  *
@@ -1767,7 +1807,10 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
1767
1807
  }, {
1768
1808
  key: "getOwnerDocument",
1769
1809
  value: function getOwnerDocument() {
1770
- return this.hotElementRef ? this.hotElementRef.ownerDocument : document;
1810
+ if (isCSR()) {
1811
+ return this.hotElementRef ? this.hotElementRef.ownerDocument : document;
1812
+ }
1813
+ return null;
1771
1814
  }
1772
1815
  /**
1773
1816
  * Set the reference to the main Handsontable DOM element.
@@ -1789,30 +1832,44 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
1789
1832
  key: "getRendererWrapper",
1790
1833
  value: function getRendererWrapper(rendererElement) {
1791
1834
  var hotTableComponent = this;
1792
- return function (instance, TD, row, col, prop, value, cellProperties) {
1835
+ return function __internalRenderer(instance, TD, row, col, prop, value, cellProperties) {
1793
1836
  var renderedCellCache = hotTableComponent.getRenderedCellCache();
1794
- if (renderedCellCache.has("".concat(row, "-").concat(col))) {
1795
- TD.innerHTML = renderedCellCache.get("".concat(row, "-").concat(col)).innerHTML;
1837
+ var portalContainerCache = hotTableComponent.getPortalContainerCache();
1838
+ var key = "".concat(row, "-").concat(col);
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;
1796
1845
  }
1797
1846
  if (TD && !TD.getAttribute('ghost-table')) {
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;
1847
+ var cachedPortal = hotTableComponent.portalCache.get(portalKey);
1848
+ var cachedPortalContainer = portalContainerCache.get(portalContainerKey);
1809
1849
  while (TD.firstChild) {
1810
1850
  TD.removeChild(TD.firstChild);
1811
1851
  }
1812
- TD.appendChild(portalContainer);
1813
- hotTableComponent.portalCacheArray.push(portal);
1852
+ // if portal already exists, do not recreate
1853
+ if (cachedPortal && cachedPortalContainer) {
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
+ }
1814
1871
  }
1815
- renderedCellCache.set("".concat(row, "-").concat(col), TD);
1872
+ renderedCellCache.set(key, TD);
1816
1873
  return TD;
1817
1874
  };
1818
1875
  }
@@ -1844,11 +1901,10 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
1844
1901
  value: function makeEditorClass(editorComponent) {
1845
1902
  var customEditorClass = /*#__PURE__*/function (_Handsontable$editors) {
1846
1903
  _inherits(CustomEditor, _Handsontable$editors);
1847
- var _super2 = _createSuper(CustomEditor);
1848
1904
  function CustomEditor(hotInstance) {
1849
1905
  var _this2;
1850
1906
  _classCallCheck(this, CustomEditor);
1851
- _this2 = _super2.call(this, hotInstance);
1907
+ _this2 = _callSuper(this, CustomEditor, [hotInstance]);
1852
1908
  editorComponent.hotCustomEditorInstance = _assertThisInitialized(_this2);
1853
1909
  _this2.editorComponent = editorComponent;
1854
1910
  return _this2;
@@ -1922,13 +1978,23 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
1922
1978
  if (globalEditorNode) {
1923
1979
  newSettings.editor = this.getEditorClass(globalEditorNode, GLOBAL_EDITOR_SCOPE);
1924
1980
  } else {
1925
- newSettings.editor = this.props.editor || (this.props.settings ? this.props.settings.editor : void 0);
1981
+ var _this$props$settings;
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
+ }
1926
1987
  }
1927
1988
  if (globalRendererNode) {
1928
1989
  newSettings.renderer = this.getRendererWrapper(globalRendererNode);
1929
1990
  this.componentRendererColumns.set('global', true);
1930
1991
  } else {
1931
- newSettings.renderer = this.props.renderer || (this.props.settings ? this.props.settings.renderer : void 0);
1992
+ var _this$props$settings2;
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
+ }
1932
1998
  }
1933
1999
  return newSettings;
1934
2000
  }
@@ -1964,6 +2030,7 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
1964
2030
  }, {
1965
2031
  key: "handsontableBeforeViewRender",
1966
2032
  value: function handsontableBeforeViewRender() {
2033
+ this.portalCache.clear();
1967
2034
  this.getRenderedCellCache().clear();
1968
2035
  }
1969
2036
  /**
@@ -1972,11 +2039,8 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
1972
2039
  }, {
1973
2040
  key: "handsontableAfterViewRender",
1974
2041
  value: function handsontableAfterViewRender() {
1975
- var _this3 = this;
1976
2042
  this.renderersPortalManager.setState({
1977
- portals: _toConsumableArray(this.portalCacheArray)
1978
- }, function () {
1979
- _this3.portalCacheArray = [];
2043
+ portals: _toConsumableArray(this.portalCache.values())
1980
2044
  });
1981
2045
  }
1982
2046
  /**
@@ -2012,14 +2076,14 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
2012
2076
  }, {
2013
2077
  key: "componentDidMount",
2014
2078
  value: function componentDidMount() {
2015
- var _this4 = this;
2079
+ var _this3 = this;
2016
2080
  var newGlobalSettings = this.createNewGlobalSettings();
2017
2081
  this.hotInstance = new Handsontable__default["default"].Core(this.hotElementRef, newGlobalSettings);
2018
2082
  this.hotInstance.addHook('beforeViewRender', function () {
2019
- return _this4.handsontableBeforeViewRender();
2083
+ return _this3.handsontableBeforeViewRender();
2020
2084
  });
2021
2085
  this.hotInstance.addHook('afterViewRender', function () {
2022
- return _this4.handsontableAfterViewRender();
2086
+ return _this3.handsontableAfterViewRender();
2023
2087
  });
2024
2088
  // `init` missing in Handsontable's type definitions.
2025
2089
  this.hotInstance.init();
@@ -2053,8 +2117,7 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
2053
2117
  }, {
2054
2118
  key: "render",
2055
2119
  value: function render() {
2056
- var _this5 = this;
2057
- var containerProps = getContainerAttributesProps(this.props);
2120
+ var _this4 = this;
2058
2121
  var isHotColumn = function isHotColumn(childNode) {
2059
2122
  return childNode.type === HotColumn;
2060
2123
  };
@@ -2064,17 +2127,18 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
2064
2127
  return isHotColumn(childNode);
2065
2128
  }).map(function (childNode, columnIndex) {
2066
2129
  return React__default["default"].cloneElement(childNode, {
2067
- _componentRendererColumns: _this5.componentRendererColumns,
2068
- _emitColumnSettings: _this5.setHotColumnSettings.bind(_this5),
2130
+ _componentRendererColumns: _this4.componentRendererColumns,
2131
+ _emitColumnSettings: _this4.setHotColumnSettings.bind(_this4),
2069
2132
  _columnIndex: columnIndex,
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),
2133
+ _getChildElementByType: getChildElementByType.bind(_this4),
2134
+ _getRendererWrapper: _this4.getRendererWrapper.bind(_this4),
2135
+ _getEditorClass: _this4.getEditorClass.bind(_this4),
2136
+ _getOwnerDocument: _this4.getOwnerDocument.bind(_this4),
2137
+ _getEditorCache: _this4.getEditorCache.bind(_this4),
2075
2138
  children: childNode.props.children
2076
2139
  });
2077
2140
  });
2141
+ var containerProps = getContainerAttributesProps(this.props);
2078
2142
  var editorPortal = createEditorPortal(this.getOwnerDocument(), this.getGlobalEditorElement());
2079
2143
  return React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement("div", Object.assign({
2080
2144
  ref: this.setHotElementRef.bind(this)
@@ -2088,24 +2152,39 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
2088
2152
  return version;
2089
2153
  }
2090
2154
  }]);
2091
- return HotTable;
2155
+ return HotTableClass;
2092
2156
  }(React__default["default"].Component);
2093
2157
  /**
2094
2158
  * Prop types to be checked at runtime.
2095
2159
  */
2096
- HotTable.propTypes = {
2160
+ HotTableClass.propTypes = {
2097
2161
  style: PropTypes.object,
2098
2162
  id: PropTypes.string,
2099
2163
  className: PropTypes.string
2100
2164
  };
2101
2165
 
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
+
2102
2182
  var BaseEditorComponent = /*#__PURE__*/function (_React$Component) {
2103
2183
  _inherits(BaseEditorComponent, _React$Component);
2104
- var _super = _createSuper(BaseEditorComponent);
2105
2184
  function BaseEditorComponent() {
2106
2185
  var _this;
2107
2186
  _classCallCheck(this, BaseEditorComponent);
2108
- _this = _super.apply(this, arguments);
2187
+ _this = _callSuper(this, BaseEditorComponent, arguments);
2109
2188
  _this.name = 'BaseEditorComponent';
2110
2189
  _this.instance = null;
2111
2190
  _this.row = null;
@@ -2370,4 +2449,5 @@ var BaseEditorComponent = /*#__PURE__*/function (_React$Component) {
2370
2449
  exports.BaseEditorComponent = BaseEditorComponent;
2371
2450
  exports.HotColumn = HotColumn;
2372
2451
  exports.HotTable = HotTable;
2452
+ exports.HotTableClass = HotTableClass;
2373
2453
  exports["default"] = HotTable;