@handsontable/react 0.0.0-next-d4cfa31-20231228 → 0.0.0-next-3388fcb-20240102

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.
@@ -33,6 +33,20 @@ function _objectSpread2(e) {
33
33
  }
34
34
  return e;
35
35
  }
36
+ function _toPrimitive(t, r) {
37
+ if ("object" != typeof t || !t) return t;
38
+ var e = t[Symbol.toPrimitive];
39
+ if (void 0 !== e) {
40
+ var i = e.call(t, r || "default");
41
+ if ("object" != typeof i) return i;
42
+ throw new TypeError("@@toPrimitive must return a primitive value.");
43
+ }
44
+ return ("string" === r ? String : Number)(t);
45
+ }
46
+ function _toPropertyKey(t) {
47
+ var i = _toPrimitive(t, "string");
48
+ return "symbol" == typeof i ? i : String(i);
49
+ }
36
50
  function _typeof(o) {
37
51
  "@babel/helpers - typeof";
38
52
 
@@ -118,6 +132,33 @@ function _isNativeReflectConstruct() {
118
132
  return false;
119
133
  }
120
134
  }
135
+ function _objectWithoutPropertiesLoose(source, excluded) {
136
+ if (source == null) return {};
137
+ var target = {};
138
+ var sourceKeys = Object.keys(source);
139
+ var key, i;
140
+ for (i = 0; i < sourceKeys.length; i++) {
141
+ key = sourceKeys[i];
142
+ if (excluded.indexOf(key) >= 0) continue;
143
+ target[key] = source[key];
144
+ }
145
+ return target;
146
+ }
147
+ function _objectWithoutProperties(source, excluded) {
148
+ if (source == null) return {};
149
+ var target = _objectWithoutPropertiesLoose(source, excluded);
150
+ var key, i;
151
+ if (Object.getOwnPropertySymbols) {
152
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
153
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
154
+ key = sourceSymbolKeys[i];
155
+ if (excluded.indexOf(key) >= 0) continue;
156
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
157
+ target[key] = source[key];
158
+ }
159
+ }
160
+ return target;
161
+ }
121
162
  function _assertThisInitialized(self) {
122
163
  if (self === void 0) {
123
164
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
@@ -171,20 +212,6 @@ function _arrayLikeToArray(arr, len) {
171
212
  function _nonIterableSpread() {
172
213
  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
214
  }
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
215
 
189
216
  var bulkComponentContainer = null;
190
217
  /**
@@ -251,14 +278,12 @@ function getOriginalEditorClass(editorElement) {
251
278
  /**
252
279
  * Create an editor portal.
253
280
  *
254
- * @param {Document} [doc] Document to be used.
281
+ * @param {Document} doc Document to be used.
255
282
  * @param {React.ReactElement} editorElement Editor's element.
256
283
  * @returns {React.ReactPortal} The portal for the editor.
257
284
  */
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) {
285
+ function createEditorPortal(doc, editorElement) {
286
+ if (typeof doc === 'undefined' || editorElement === null) {
262
287
  return null;
263
288
  }
264
289
  var containerProps = getContainerAttributesProps(editorElement.props, false);
@@ -331,11 +356,19 @@ function createPortal(rElement, props) {
331
356
  function getContainerAttributesProps(props) {
332
357
  var randomizeId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
333
358
  return {
334
- id: props.id || (randomizeId ? 'hot-' + Math.random().toString(36).substring(5) : void 0),
359
+ id: props.id || (randomizeId ? 'hot-' + Math.random().toString(36).substring(5) : undefined),
335
360
  className: props.className || '',
336
361
  style: props.style || {}
337
362
  };
338
363
  }
364
+ /**
365
+ * Checks if the environment that the code runs in is a browser.
366
+ *
367
+ * @returns {boolean}
368
+ */
369
+ function isCSR() {
370
+ return typeof window !== 'undefined';
371
+ }
339
372
 
340
373
  var SettingsMapper = /*#__PURE__*/function () {
341
374
  function SettingsMapper() {
@@ -494,7 +527,7 @@ var RenderersPortalManager = /*#__PURE__*/function (_React$Component) {
494
527
  return RenderersPortalManager;
495
528
  }(React__default["default"].Component);
496
529
 
497
- var version="0.0.0-next-d4cfa31-20231228";
530
+ var version="0.0.0-next-3388fcb-20240102";
498
531
 
499
532
  function createCommonjsModule(fn, module) {
500
533
  return module = { exports: {} }, fn(module, module.exports), module.exports;
@@ -1635,14 +1668,14 @@ var PropTypes = propTypes;
1635
1668
  *
1636
1669
  * ```
1637
1670
  *
1638
- * @class HotTable
1671
+ * @class HotTableCB
1639
1672
  */
1640
- var HotTable = /*#__PURE__*/function (_React$Component) {
1641
- _inherits(HotTable, _React$Component);
1642
- var _super = _createSuper(HotTable);
1643
- function HotTable() {
1673
+ var HotTableClass = /*#__PURE__*/function (_React$Component) {
1674
+ _inherits(HotTableClass, _React$Component);
1675
+ var _super = _createSuper(HotTableClass);
1676
+ function HotTableClass() {
1644
1677
  var _this;
1645
- _classCallCheck(this, HotTable);
1678
+ _classCallCheck(this, HotTableClass);
1646
1679
  _this = _super.apply(this, arguments);
1647
1680
  /**
1648
1681
  * The `id` of the main Handsontable DOM element.
@@ -1708,7 +1741,7 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
1708
1741
  *
1709
1742
  * @returns The version number of the package.
1710
1743
  */
1711
- _createClass(HotTable, [{
1744
+ _createClass(HotTableClass, [{
1712
1745
  key: "hotInstance",
1713
1746
  get:
1714
1747
  /**
@@ -1767,7 +1800,10 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
1767
1800
  }, {
1768
1801
  key: "getOwnerDocument",
1769
1802
  value: function getOwnerDocument() {
1770
- return this.hotElementRef ? this.hotElementRef.ownerDocument : document;
1803
+ if (isCSR()) {
1804
+ return this.hotElementRef ? this.hotElementRef.ownerDocument : document;
1805
+ }
1806
+ return null;
1771
1807
  }
1772
1808
  /**
1773
1809
  * Set the reference to the main Handsontable DOM element.
@@ -2054,7 +2090,6 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
2054
2090
  key: "render",
2055
2091
  value: function render() {
2056
2092
  var _this5 = this;
2057
- var containerProps = getContainerAttributesProps(this.props);
2058
2093
  var isHotColumn = function isHotColumn(childNode) {
2059
2094
  return childNode.type === HotColumn;
2060
2095
  };
@@ -2075,6 +2110,7 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
2075
2110
  children: childNode.props.children
2076
2111
  });
2077
2112
  });
2113
+ var containerProps = getContainerAttributesProps(this.props);
2078
2114
  var editorPortal = createEditorPortal(this.getOwnerDocument(), this.getGlobalEditorElement());
2079
2115
  return React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement("div", Object.assign({
2080
2116
  ref: this.setHotElementRef.bind(this)
@@ -2088,17 +2124,33 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
2088
2124
  return version;
2089
2125
  }
2090
2126
  }]);
2091
- return HotTable;
2127
+ return HotTableClass;
2092
2128
  }(React__default["default"].Component);
2093
2129
  /**
2094
2130
  * Prop types to be checked at runtime.
2095
2131
  */
2096
- HotTable.propTypes = {
2132
+ HotTableClass.propTypes = {
2097
2133
  style: PropTypes.object,
2098
2134
  id: PropTypes.string,
2099
2135
  className: PropTypes.string
2100
2136
  };
2101
2137
 
2138
+ var _excluded = ["children"];
2139
+ // Use global React variable for `forwardRef` access (React 16 support)
2140
+ var HotTable = React__default["default"].forwardRef(function (_ref, ref) {
2141
+ var _props$id;
2142
+ var children = _ref.children,
2143
+ props = _objectWithoutProperties(_ref, _excluded);
2144
+ var generatedId = typeof React__default["default"].useId === 'function' ? React__default["default"].useId() : undefined;
2145
+ var componentId = (_props$id = props.id) !== null && _props$id !== void 0 ? _props$id : generatedId;
2146
+ return React__default["default"].createElement(HotTableClass, Object.assign({
2147
+ id: componentId
2148
+ }, props, {
2149
+ ref: ref
2150
+ }), children);
2151
+ });
2152
+ HotTable.version = HotTableClass.version;
2153
+
2102
2154
  var BaseEditorComponent = /*#__PURE__*/function (_React$Component) {
2103
2155
  _inherits(BaseEditorComponent, _React$Component);
2104
2156
  var _super = _createSuper(BaseEditorComponent);
@@ -25,7 +25,7 @@
25
25
  * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING FROM
26
26
  * USE OR INABILITY TO USE THIS SOFTWARE.
27
27
  *
28
- * Version: 0.0.0-next-d4cfa31-20231228 (built at Thu Dec 28 2023 09:34:02 GMT+0000 (Coordinated Universal Time))
28
+ * Version: 0.0.0-next-3388fcb-20240102 (built at Tue Jan 02 2024 09:17:19 GMT+0000 (Coordinated Universal Time))
29
29
  */
30
30
  (function (global, factory) {
31
31
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-dom'), require('handsontable/base')) :
@@ -60,6 +60,20 @@ function _objectSpread2(e) {
60
60
  }
61
61
  return e;
62
62
  }
63
+ function _toPrimitive(t, r) {
64
+ if ("object" != typeof t || !t) return t;
65
+ var e = t[Symbol.toPrimitive];
66
+ if (void 0 !== e) {
67
+ var i = e.call(t, r || "default");
68
+ if ("object" != typeof i) return i;
69
+ throw new TypeError("@@toPrimitive must return a primitive value.");
70
+ }
71
+ return ("string" === r ? String : Number)(t);
72
+ }
73
+ function _toPropertyKey(t) {
74
+ var i = _toPrimitive(t, "string");
75
+ return "symbol" == typeof i ? i : String(i);
76
+ }
63
77
  function _typeof(o) {
64
78
  "@babel/helpers - typeof";
65
79
 
@@ -145,6 +159,33 @@ function _isNativeReflectConstruct() {
145
159
  return false;
146
160
  }
147
161
  }
162
+ function _objectWithoutPropertiesLoose(source, excluded) {
163
+ if (source == null) return {};
164
+ var target = {};
165
+ var sourceKeys = Object.keys(source);
166
+ var key, i;
167
+ for (i = 0; i < sourceKeys.length; i++) {
168
+ key = sourceKeys[i];
169
+ if (excluded.indexOf(key) >= 0) continue;
170
+ target[key] = source[key];
171
+ }
172
+ return target;
173
+ }
174
+ function _objectWithoutProperties(source, excluded) {
175
+ if (source == null) return {};
176
+ var target = _objectWithoutPropertiesLoose(source, excluded);
177
+ var key, i;
178
+ if (Object.getOwnPropertySymbols) {
179
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
180
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
181
+ key = sourceSymbolKeys[i];
182
+ if (excluded.indexOf(key) >= 0) continue;
183
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
184
+ target[key] = source[key];
185
+ }
186
+ }
187
+ return target;
188
+ }
148
189
  function _assertThisInitialized(self) {
149
190
  if (self === void 0) {
150
191
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
@@ -198,20 +239,6 @@ function _arrayLikeToArray(arr, len) {
198
239
  function _nonIterableSpread() {
199
240
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
200
241
  }
201
- function _toPrimitive(input, hint) {
202
- if (typeof input !== "object" || input === null) return input;
203
- var prim = input[Symbol.toPrimitive];
204
- if (prim !== undefined) {
205
- var res = prim.call(input, hint || "default");
206
- if (typeof res !== "object") return res;
207
- throw new TypeError("@@toPrimitive must return a primitive value.");
208
- }
209
- return (hint === "string" ? String : Number)(input);
210
- }
211
- function _toPropertyKey(arg) {
212
- var key = _toPrimitive(arg, "string");
213
- return typeof key === "symbol" ? key : String(key);
214
- }
215
242
 
216
243
  var bulkComponentContainer = null;
217
244
  /**
@@ -278,14 +305,12 @@ function getOriginalEditorClass(editorElement) {
278
305
  /**
279
306
  * Create an editor portal.
280
307
  *
281
- * @param {Document} [doc] Document to be used.
308
+ * @param {Document} doc Document to be used.
282
309
  * @param {React.ReactElement} editorElement Editor's element.
283
310
  * @returns {React.ReactPortal} The portal for the editor.
284
311
  */
285
- function createEditorPortal() {
286
- var doc = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
287
- var editorElement = arguments.length > 1 ? arguments[1] : undefined;
288
- if (editorElement === null) {
312
+ function createEditorPortal(doc, editorElement) {
313
+ if (typeof doc === 'undefined' || editorElement === null) {
289
314
  return null;
290
315
  }
291
316
  var containerProps = getContainerAttributesProps(editorElement.props, false);
@@ -358,11 +383,19 @@ function createPortal(rElement, props) {
358
383
  function getContainerAttributesProps(props) {
359
384
  var randomizeId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
360
385
  return {
361
- id: props.id || (randomizeId ? 'hot-' + Math.random().toString(36).substring(5) : void 0),
386
+ id: props.id || (randomizeId ? 'hot-' + Math.random().toString(36).substring(5) : undefined),
362
387
  className: props.className || '',
363
388
  style: props.style || {}
364
389
  };
365
390
  }
391
+ /**
392
+ * Checks if the environment that the code runs in is a browser.
393
+ *
394
+ * @returns {boolean}
395
+ */
396
+ function isCSR() {
397
+ return typeof window !== 'undefined';
398
+ }
366
399
 
367
400
  var SettingsMapper = /*#__PURE__*/function () {
368
401
  function SettingsMapper() {
@@ -521,7 +554,7 @@ var RenderersPortalManager = /*#__PURE__*/function (_React$Component) {
521
554
  return RenderersPortalManager;
522
555
  }(React__default["default"].Component);
523
556
 
524
- var version="0.0.0-next-d4cfa31-20231228";
557
+ var version="0.0.0-next-3388fcb-20240102";
525
558
 
526
559
  function createCommonjsModule(fn, module) {
527
560
  return module = { exports: {} }, fn(module, module.exports), module.exports;
@@ -884,14 +917,14 @@ var PropTypes = propTypes;
884
917
  *
885
918
  * ```
886
919
  *
887
- * @class HotTable
920
+ * @class HotTableCB
888
921
  */
889
- var HotTable = /*#__PURE__*/function (_React$Component) {
890
- _inherits(HotTable, _React$Component);
891
- var _super = _createSuper(HotTable);
892
- function HotTable() {
922
+ var HotTableClass = /*#__PURE__*/function (_React$Component) {
923
+ _inherits(HotTableClass, _React$Component);
924
+ var _super = _createSuper(HotTableClass);
925
+ function HotTableClass() {
893
926
  var _this;
894
- _classCallCheck(this, HotTable);
927
+ _classCallCheck(this, HotTableClass);
895
928
  _this = _super.apply(this, arguments);
896
929
  /**
897
930
  * The `id` of the main Handsontable DOM element.
@@ -957,7 +990,7 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
957
990
  *
958
991
  * @returns The version number of the package.
959
992
  */
960
- _createClass(HotTable, [{
993
+ _createClass(HotTableClass, [{
961
994
  key: "hotInstance",
962
995
  get:
963
996
  /**
@@ -1016,7 +1049,10 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
1016
1049
  }, {
1017
1050
  key: "getOwnerDocument",
1018
1051
  value: function getOwnerDocument() {
1019
- return this.hotElementRef ? this.hotElementRef.ownerDocument : document;
1052
+ if (isCSR()) {
1053
+ return this.hotElementRef ? this.hotElementRef.ownerDocument : document;
1054
+ }
1055
+ return null;
1020
1056
  }
1021
1057
  /**
1022
1058
  * Set the reference to the main Handsontable DOM element.
@@ -1303,7 +1339,6 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
1303
1339
  key: "render",
1304
1340
  value: function render() {
1305
1341
  var _this5 = this;
1306
- var containerProps = getContainerAttributesProps(this.props);
1307
1342
  var isHotColumn = function isHotColumn(childNode) {
1308
1343
  return childNode.type === HotColumn;
1309
1344
  };
@@ -1324,6 +1359,7 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
1324
1359
  children: childNode.props.children
1325
1360
  });
1326
1361
  });
1362
+ var containerProps = getContainerAttributesProps(this.props);
1327
1363
  var editorPortal = createEditorPortal(this.getOwnerDocument(), this.getGlobalEditorElement());
1328
1364
  return React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement("div", Object.assign({
1329
1365
  ref: this.setHotElementRef.bind(this)
@@ -1337,17 +1373,33 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
1337
1373
  return version;
1338
1374
  }
1339
1375
  }]);
1340
- return HotTable;
1376
+ return HotTableClass;
1341
1377
  }(React__default["default"].Component);
1342
1378
  /**
1343
1379
  * Prop types to be checked at runtime.
1344
1380
  */
1345
- HotTable.propTypes = {
1381
+ HotTableClass.propTypes = {
1346
1382
  style: PropTypes.object,
1347
1383
  id: PropTypes.string,
1348
1384
  className: PropTypes.string
1349
1385
  };
1350
1386
 
1387
+ var _excluded = ["children"];
1388
+ // Use global React variable for `forwardRef` access (React 16 support)
1389
+ var HotTable = React__default["default"].forwardRef(function (_ref, ref) {
1390
+ var _props$id;
1391
+ var children = _ref.children,
1392
+ props = _objectWithoutProperties(_ref, _excluded);
1393
+ var generatedId = typeof React__default["default"].useId === 'function' ? React__default["default"].useId() : undefined;
1394
+ var componentId = (_props$id = props.id) !== null && _props$id !== void 0 ? _props$id : generatedId;
1395
+ return React__default["default"].createElement(HotTableClass, Object.assign({
1396
+ id: componentId
1397
+ }, props, {
1398
+ ref: ref
1399
+ }), children);
1400
+ });
1401
+ HotTable.version = HotTableClass.version;
1402
+
1351
1403
  var BaseEditorComponent = /*#__PURE__*/function (_React$Component) {
1352
1404
  _inherits(BaseEditorComponent, _React$Component);
1353
1405
  var _super = _createSuper(BaseEditorComponent);