@handsontable/react-wrapper 0.0.0-next-7cc7ef7-20241028
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 +25 -0
- package/README.md +136 -0
- package/commonjs/react-handsontable.js +2139 -0
- package/commonjs/src/helpers.d.ts +105 -0
- package/commonjs/src/hotColumn.d.ts +5 -0
- package/commonjs/src/hotColumnContext.d.ts +16 -0
- package/commonjs/src/hotEditor.d.ts +33 -0
- package/commonjs/src/hotTable.d.ts +29 -0
- package/commonjs/src/hotTableContext.d.ts +55 -0
- package/commonjs/src/hotTableInner.d.ts +5 -0
- package/commonjs/src/index.d.ts +5 -0
- package/commonjs/src/renderersPortalManager.d.ts +6 -0
- package/commonjs/src/settingsMapper.d.ts +18 -0
- package/commonjs/src/types.d.ts +78 -0
- package/dist/react-handsontable.js +1133 -0
- package/dist/react-handsontable.js.map +1 -0
- package/dist/react-handsontable.min.js +31 -0
- package/dist/react-handsontable.min.js.map +1 -0
- package/dist/src/helpers.d.ts +105 -0
- package/dist/src/hotColumn.d.ts +5 -0
- package/dist/src/hotColumnContext.d.ts +16 -0
- package/dist/src/hotEditor.d.ts +33 -0
- package/dist/src/hotTable.d.ts +29 -0
- package/dist/src/hotTableContext.d.ts +55 -0
- package/dist/src/hotTableInner.d.ts +5 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/renderersPortalManager.d.ts +6 -0
- package/dist/src/settingsMapper.d.ts +18 -0
- package/dist/src/types.d.ts +78 -0
- package/es/react-handsontable.mjs +2125 -0
- package/handsontable-non-commercial-license.pdf +0 -0
- package/helpers.d.ts +105 -0
- package/hotColumn.d.ts +5 -0
- package/hotColumnContext.d.ts +16 -0
- package/hotEditor.d.ts +33 -0
- package/hotTable.d.ts +29 -0
- package/hotTableContext.d.ts +55 -0
- package/hotTableInner.d.ts +5 -0
- package/index.d.ts +5 -0
- package/package.json +130 -0
- package/renderersPortalManager.d.ts +6 -0
- package/settingsMapper.d.ts +18 -0
- package/types.d.ts +78 -0
@@ -0,0 +1,2125 @@
|
|
1
|
+
import React, { useEffect, createContext, useRef, useCallback, useMemo, useContext, useState, useDeferredValue, useImperativeHandle, forwardRef, Fragment, Children, useId } from 'react';
|
2
|
+
import ReactDOM from 'react-dom';
|
3
|
+
import Handsontable from 'handsontable/base';
|
4
|
+
import { getRenderer } from 'handsontable/renderers/registry';
|
5
|
+
import { getEditor } from 'handsontable/editors/registry';
|
6
|
+
|
7
|
+
var bulkComponentContainer = null;
|
8
|
+
/**
|
9
|
+
* Warning message for the `autoRowSize`/`autoColumnSize` compatibility check.
|
10
|
+
*/
|
11
|
+
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.';
|
12
|
+
/**
|
13
|
+
* Warning message for the `hot-renderer` obsolete renderer passing method.
|
14
|
+
*/
|
15
|
+
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.';
|
16
|
+
/**
|
17
|
+
* Warning message for the `hot-editor` obsolete editor passing method.
|
18
|
+
*/
|
19
|
+
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.';
|
20
|
+
/**
|
21
|
+
* Warning message for the unexpected children of HotTable component.
|
22
|
+
*/
|
23
|
+
var UNEXPECTED_HOTTABLE_CHILDREN_WARNING = 'Unexpected children nodes found in HotTable component. ' + 'Only HotColumn components are allowed.';
|
24
|
+
/**
|
25
|
+
* Warning message for the unexpected children of HotColumn component.
|
26
|
+
*/
|
27
|
+
var UNEXPECTED_HOTCOLUMN_CHILDREN_WARNING = 'Unexpected children nodes found in HotColumn component. ' + 'HotColumn components do not support any children.';
|
28
|
+
/**
|
29
|
+
* Message for the warning thrown if the Handsontable instance has been destroyed.
|
30
|
+
*/
|
31
|
+
var HOT_DESTROYED_WARNING = 'The Handsontable instance bound to this component was destroyed and cannot be' + ' used properly.';
|
32
|
+
/**
|
33
|
+
* Default classname given to the wrapper container.
|
34
|
+
*/
|
35
|
+
var DEFAULT_CLASSNAME = 'hot-wrapper-editor-container';
|
36
|
+
/**
|
37
|
+
* Logs warn to the console if the `console` object is exposed.
|
38
|
+
*
|
39
|
+
* @param {...*} args Values which will be logged.
|
40
|
+
*/
|
41
|
+
function warn() {
|
42
|
+
if (typeof console !== 'undefined') {
|
43
|
+
var _console;
|
44
|
+
(_console = console).warn.apply(_console, arguments);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
/**
|
48
|
+
* Detect if `hot-renderer` or `hot-editor` is defined, and if so, throw an incompatibility warning.
|
49
|
+
*
|
50
|
+
* @returns {boolean} 'true' if the warning was issued
|
51
|
+
*/
|
52
|
+
function displayObsoleteRenderersEditorsWarning(children) {
|
53
|
+
if (hasChildElementOfType(children, 'hot-renderer')) {
|
54
|
+
warn(OBSOLETE_HOTRENDERER_WARNING);
|
55
|
+
return true;
|
56
|
+
}
|
57
|
+
if (hasChildElementOfType(children, 'hot-editor')) {
|
58
|
+
warn(OBSOLETE_HOTEDITOR_WARNING);
|
59
|
+
return true;
|
60
|
+
}
|
61
|
+
return false;
|
62
|
+
}
|
63
|
+
/**
|
64
|
+
* Detect if children of specified type are defined, and if so, throw an incompatibility warning.
|
65
|
+
*
|
66
|
+
* @param {ReactNode} children Component children nodes
|
67
|
+
* @param {ComponentType} Component Component type to check
|
68
|
+
* @returns {boolean} 'true' if the warning was issued
|
69
|
+
*/
|
70
|
+
function displayChildrenOfTypeWarning(children, Component) {
|
71
|
+
var childrenArray = React.Children.toArray(children);
|
72
|
+
if (childrenArray.some(function (child) {
|
73
|
+
return child.type !== Component;
|
74
|
+
})) {
|
75
|
+
warn(UNEXPECTED_HOTTABLE_CHILDREN_WARNING);
|
76
|
+
return true;
|
77
|
+
}
|
78
|
+
return false;
|
79
|
+
}
|
80
|
+
/**
|
81
|
+
* Detect if children is defined, and if so, throw an incompatibility warning.
|
82
|
+
*
|
83
|
+
* @param {ReactNode} children Component children nodes
|
84
|
+
* @returns {boolean} 'true' if the warning was issued
|
85
|
+
*/
|
86
|
+
function displayAnyChildrenWarning(children) {
|
87
|
+
var childrenArray = React.Children.toArray(children);
|
88
|
+
if (childrenArray.length) {
|
89
|
+
warn(UNEXPECTED_HOTCOLUMN_CHILDREN_WARNING);
|
90
|
+
return true;
|
91
|
+
}
|
92
|
+
return false;
|
93
|
+
}
|
94
|
+
/**
|
95
|
+
* Check the existence of elements of the provided `type` from the `HotColumn` component's children.
|
96
|
+
*
|
97
|
+
* @param {ReactNode} children HotTable children array.
|
98
|
+
* @param {String} type Either `'hot-renderer'` or `'hot-editor'`.
|
99
|
+
* @returns {boolean} `true` if the child of that type was found, `false` otherwise.
|
100
|
+
*/
|
101
|
+
function hasChildElementOfType(children, type) {
|
102
|
+
var childrenArray = React.Children.toArray(children);
|
103
|
+
return childrenArray.some(function (child) {
|
104
|
+
return child.props[type] !== void 0;
|
105
|
+
});
|
106
|
+
}
|
107
|
+
/**
|
108
|
+
* Create an editor portal.
|
109
|
+
*
|
110
|
+
* @param {Document} doc Document to be used.
|
111
|
+
* @param {ComponentType} Editor Editor component or render function.
|
112
|
+
* @returns {ReactPortal} The portal for the editor.
|
113
|
+
*/
|
114
|
+
function createEditorPortal(doc, Editor) {
|
115
|
+
if (!doc || !Editor) {
|
116
|
+
return null;
|
117
|
+
}
|
118
|
+
var editorElement = React.createElement(Editor, null);
|
119
|
+
var containerProps = getContainerAttributesProps({}, false);
|
120
|
+
containerProps.className = "".concat(DEFAULT_CLASSNAME, " ").concat(containerProps.className);
|
121
|
+
return ReactDOM.createPortal(React.createElement("div", Object.assign({}, containerProps), editorElement), doc.body);
|
122
|
+
}
|
123
|
+
/**
|
124
|
+
* Render a cell component to an external DOM node.
|
125
|
+
*
|
126
|
+
* @param {React.ReactElement} rElement React element to be used as a base for the component.
|
127
|
+
* @param {Document} [ownerDocument] The owner document to set the portal up into.
|
128
|
+
* @param {String} portalKey The key to be used for the portal.
|
129
|
+
* @param {HTMLElement} [cachedContainer] The cached container to be used for the portal.
|
130
|
+
* @returns {{portal: ReactPortal, portalContainer: HTMLElement}} An object containing the portal and its container.
|
131
|
+
*/
|
132
|
+
function createPortal(rElement) {
|
133
|
+
var ownerDocument = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;
|
134
|
+
var portalKey = arguments.length > 2 ? arguments[2] : undefined;
|
135
|
+
var cachedContainer = arguments.length > 3 ? arguments[3] : undefined;
|
136
|
+
if (!ownerDocument) {
|
137
|
+
ownerDocument = document;
|
138
|
+
}
|
139
|
+
if (!bulkComponentContainer) {
|
140
|
+
bulkComponentContainer = ownerDocument.createDocumentFragment();
|
141
|
+
}
|
142
|
+
var portalContainer = cachedContainer !== null && cachedContainer !== void 0 ? cachedContainer : ownerDocument.createElement('DIV');
|
143
|
+
bulkComponentContainer.appendChild(portalContainer);
|
144
|
+
return {
|
145
|
+
portal: ReactDOM.createPortal(rElement, portalContainer, portalKey),
|
146
|
+
portalContainer: portalContainer
|
147
|
+
};
|
148
|
+
}
|
149
|
+
/**
|
150
|
+
* Get an object containing the `id`, `className` and `style` keys, representing the corresponding props passed to the
|
151
|
+
* component.
|
152
|
+
*
|
153
|
+
* @param {HotTableProps} props Object containing the React element props.
|
154
|
+
* @param {Boolean} randomizeId If set to `true`, the function will randomize the `id` property when no `id` was present in the `prop` object.
|
155
|
+
* @returns An object containing the `id`, `className` and `style` keys, representing the corresponding props passed to the
|
156
|
+
* component.
|
157
|
+
*/
|
158
|
+
function getContainerAttributesProps(props) {
|
159
|
+
var randomizeId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
160
|
+
return {
|
161
|
+
id: props.id || (randomizeId ? 'hot-' + Math.random().toString(36).substring(5) : undefined),
|
162
|
+
className: props.className || '',
|
163
|
+
style: props.style || {}
|
164
|
+
};
|
165
|
+
}
|
166
|
+
/**
|
167
|
+
* Checks if the environment that the code runs in is a browser.
|
168
|
+
*
|
169
|
+
* @returns {boolean}
|
170
|
+
*/
|
171
|
+
function isCSR() {
|
172
|
+
return typeof window !== 'undefined';
|
173
|
+
}
|
174
|
+
/**
|
175
|
+
* A variant of useEffect hook that does not trigger on initial mount, only updates
|
176
|
+
*
|
177
|
+
* @param effect Effect function
|
178
|
+
* @param deps Effect dependencies
|
179
|
+
*/
|
180
|
+
function useUpdateEffect(effect, deps) {
|
181
|
+
var notInitialRender = React.useRef(false);
|
182
|
+
useEffect(function () {
|
183
|
+
if (notInitialRender.current) {
|
184
|
+
return effect();
|
185
|
+
} else {
|
186
|
+
notInitialRender.current = true;
|
187
|
+
}
|
188
|
+
}, deps);
|
189
|
+
}
|
190
|
+
|
191
|
+
function _arrayLikeToArray(r, a) {
|
192
|
+
(null == a || a > r.length) && (a = r.length);
|
193
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
194
|
+
return n;
|
195
|
+
}
|
196
|
+
function _arrayWithHoles(r) {
|
197
|
+
if (Array.isArray(r)) return r;
|
198
|
+
}
|
199
|
+
function _arrayWithoutHoles(r) {
|
200
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
201
|
+
}
|
202
|
+
function _assertThisInitialized(e) {
|
203
|
+
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
204
|
+
return e;
|
205
|
+
}
|
206
|
+
function _callSuper(t, o, e) {
|
207
|
+
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
|
208
|
+
}
|
209
|
+
function _classCallCheck(a, n) {
|
210
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
211
|
+
}
|
212
|
+
function _defineProperties(e, r) {
|
213
|
+
for (var t = 0; t < r.length; t++) {
|
214
|
+
var o = r[t];
|
215
|
+
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
|
216
|
+
}
|
217
|
+
}
|
218
|
+
function _createClass(e, r, t) {
|
219
|
+
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
220
|
+
writable: !1
|
221
|
+
}), e;
|
222
|
+
}
|
223
|
+
function _defineProperty(e, r, t) {
|
224
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
225
|
+
value: t,
|
226
|
+
enumerable: !0,
|
227
|
+
configurable: !0,
|
228
|
+
writable: !0
|
229
|
+
}) : e[r] = t, e;
|
230
|
+
}
|
231
|
+
function _getPrototypeOf(t) {
|
232
|
+
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
233
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
234
|
+
}, _getPrototypeOf(t);
|
235
|
+
}
|
236
|
+
function _inherits(t, e) {
|
237
|
+
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
238
|
+
t.prototype = Object.create(e && e.prototype, {
|
239
|
+
constructor: {
|
240
|
+
value: t,
|
241
|
+
writable: !0,
|
242
|
+
configurable: !0
|
243
|
+
}
|
244
|
+
}), Object.defineProperty(t, "prototype", {
|
245
|
+
writable: !1
|
246
|
+
}), e && _setPrototypeOf(t, e);
|
247
|
+
}
|
248
|
+
function _isNativeReflectConstruct() {
|
249
|
+
try {
|
250
|
+
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
251
|
+
} catch (t) {}
|
252
|
+
return (_isNativeReflectConstruct = function () {
|
253
|
+
return !!t;
|
254
|
+
})();
|
255
|
+
}
|
256
|
+
function _iterableToArray(r) {
|
257
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
258
|
+
}
|
259
|
+
function _iterableToArrayLimit(r, l) {
|
260
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
261
|
+
if (null != t) {
|
262
|
+
var e,
|
263
|
+
n,
|
264
|
+
i,
|
265
|
+
u,
|
266
|
+
a = [],
|
267
|
+
f = !0,
|
268
|
+
o = !1;
|
269
|
+
try {
|
270
|
+
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
271
|
+
} catch (r) {
|
272
|
+
o = !0, n = r;
|
273
|
+
} finally {
|
274
|
+
try {
|
275
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
276
|
+
} finally {
|
277
|
+
if (o) throw n;
|
278
|
+
}
|
279
|
+
}
|
280
|
+
return a;
|
281
|
+
}
|
282
|
+
}
|
283
|
+
function _nonIterableRest() {
|
284
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
285
|
+
}
|
286
|
+
function _nonIterableSpread() {
|
287
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
288
|
+
}
|
289
|
+
function ownKeys(e, r) {
|
290
|
+
var t = Object.keys(e);
|
291
|
+
if (Object.getOwnPropertySymbols) {
|
292
|
+
var o = Object.getOwnPropertySymbols(e);
|
293
|
+
r && (o = o.filter(function (r) {
|
294
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
295
|
+
})), t.push.apply(t, o);
|
296
|
+
}
|
297
|
+
return t;
|
298
|
+
}
|
299
|
+
function _objectSpread2(e) {
|
300
|
+
for (var r = 1; r < arguments.length; r++) {
|
301
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
302
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
303
|
+
_defineProperty(e, r, t[r]);
|
304
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
305
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
306
|
+
});
|
307
|
+
}
|
308
|
+
return e;
|
309
|
+
}
|
310
|
+
function _objectWithoutProperties(e, t) {
|
311
|
+
if (null == e) return {};
|
312
|
+
var o,
|
313
|
+
r,
|
314
|
+
i = _objectWithoutPropertiesLoose(e, t);
|
315
|
+
if (Object.getOwnPropertySymbols) {
|
316
|
+
var s = Object.getOwnPropertySymbols(e);
|
317
|
+
for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
318
|
+
}
|
319
|
+
return i;
|
320
|
+
}
|
321
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
322
|
+
if (null == r) return {};
|
323
|
+
var t = {};
|
324
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
325
|
+
if (e.includes(n)) continue;
|
326
|
+
t[n] = r[n];
|
327
|
+
}
|
328
|
+
return t;
|
329
|
+
}
|
330
|
+
function _possibleConstructorReturn(t, e) {
|
331
|
+
if (e && ("object" == typeof e || "function" == typeof e)) return e;
|
332
|
+
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
333
|
+
return _assertThisInitialized(t);
|
334
|
+
}
|
335
|
+
function _setPrototypeOf(t, e) {
|
336
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
337
|
+
return t.__proto__ = e, t;
|
338
|
+
}, _setPrototypeOf(t, e);
|
339
|
+
}
|
340
|
+
function _slicedToArray(r, e) {
|
341
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
342
|
+
}
|
343
|
+
function _toConsumableArray(r) {
|
344
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
345
|
+
}
|
346
|
+
function _toPrimitive(t, r) {
|
347
|
+
if ("object" != typeof t || !t) return t;
|
348
|
+
var e = t[Symbol.toPrimitive];
|
349
|
+
if (void 0 !== e) {
|
350
|
+
var i = e.call(t, r || "default");
|
351
|
+
if ("object" != typeof i) return i;
|
352
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
353
|
+
}
|
354
|
+
return ("string" === r ? String : Number)(t);
|
355
|
+
}
|
356
|
+
function _toPropertyKey(t) {
|
357
|
+
var i = _toPrimitive(t, "string");
|
358
|
+
return "symbol" == typeof i ? i : i + "";
|
359
|
+
}
|
360
|
+
function _typeof(o) {
|
361
|
+
"@babel/helpers - typeof";
|
362
|
+
|
363
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
364
|
+
return typeof o;
|
365
|
+
} : function (o) {
|
366
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
367
|
+
}, _typeof(o);
|
368
|
+
}
|
369
|
+
function _unsupportedIterableToArray(r, a) {
|
370
|
+
if (r) {
|
371
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
372
|
+
var t = {}.toString.call(r).slice(8, -1);
|
373
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
374
|
+
}
|
375
|
+
}
|
376
|
+
|
377
|
+
var SettingsMapper = /*#__PURE__*/function () {
|
378
|
+
function SettingsMapper() {
|
379
|
+
_classCallCheck(this, SettingsMapper);
|
380
|
+
}
|
381
|
+
return _createClass(SettingsMapper, null, [{
|
382
|
+
key: "getSettings",
|
383
|
+
value:
|
384
|
+
/**
|
385
|
+
* Parse component settings into Handsontable-compatible settings.
|
386
|
+
*
|
387
|
+
* @param {Object} properties Object containing properties from the HotTable object.
|
388
|
+
* @param {Object} additionalSettings Additional settings.
|
389
|
+
* @param {boolean} additionalSettings.isInit Flag determining whether the settings are being set during initialization.
|
390
|
+
* @param {string[]} additionalSettings.initOnlySettingKeys Array of keys that can be set only during initialization.
|
391
|
+
* @returns {Object} Handsontable-compatible settings object.
|
392
|
+
*/
|
393
|
+
function getSettings(properties) {
|
394
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
395
|
+
_ref$prevProps = _ref.prevProps,
|
396
|
+
prevProps = _ref$prevProps === void 0 ? {} : _ref$prevProps,
|
397
|
+
_ref$isInit = _ref.isInit,
|
398
|
+
isInit = _ref$isInit === void 0 ? false : _ref$isInit,
|
399
|
+
_ref$initOnlySettingK = _ref.initOnlySettingKeys,
|
400
|
+
initOnlySettingKeys = _ref$initOnlySettingK === void 0 ? [] : _ref$initOnlySettingK;
|
401
|
+
var shouldSkipProp = function shouldSkipProp(key) {
|
402
|
+
// Omit settings that can be set only during initialization and are intentionally modified.
|
403
|
+
if (!isInit && initOnlySettingKeys.includes(key)) {
|
404
|
+
return prevProps[key] === properties[key];
|
405
|
+
}
|
406
|
+
return false;
|
407
|
+
};
|
408
|
+
var newSettings = {};
|
409
|
+
for (var key in properties) {
|
410
|
+
if (key !== 'children' && !shouldSkipProp(key) && properties.hasOwnProperty(key)) {
|
411
|
+
newSettings[key] = properties[key];
|
412
|
+
}
|
413
|
+
}
|
414
|
+
return newSettings;
|
415
|
+
}
|
416
|
+
}]);
|
417
|
+
}();
|
418
|
+
|
419
|
+
var HotTableContext = createContext(undefined);
|
420
|
+
var HotTableContextProvider = function HotTableContextProvider(_ref) {
|
421
|
+
var children = _ref.children;
|
422
|
+
var columnsSettings = useRef([]);
|
423
|
+
var setHotColumnSettings = useCallback(function (columnSettings, columnIndex) {
|
424
|
+
columnsSettings.current[columnIndex] = columnSettings;
|
425
|
+
}, []);
|
426
|
+
var componentRendererColumns = useRef(new Map());
|
427
|
+
var renderedCellCache = useRef(new Map());
|
428
|
+
var clearRenderedCellCache = useCallback(function () {
|
429
|
+
return renderedCellCache.current.clear();
|
430
|
+
}, []);
|
431
|
+
var portalCache = useRef(new Map());
|
432
|
+
var clearPortalCache = useCallback(function () {
|
433
|
+
return portalCache.current.clear();
|
434
|
+
}, []);
|
435
|
+
var portalContainerCache = useRef(new Map());
|
436
|
+
var getRendererWrapper = useCallback(function (Renderer) {
|
437
|
+
return function __internalRenderer(instance, TD, row, col, prop, value, cellProperties) {
|
438
|
+
var key = "".concat(row, "-").concat(col);
|
439
|
+
// Handsontable.Core type is missing guid
|
440
|
+
var instanceGuid = instance.guid;
|
441
|
+
var portalContainerKey = "".concat(instanceGuid, "-").concat(key);
|
442
|
+
var portalKey = "".concat(key, "-").concat(instanceGuid);
|
443
|
+
if (renderedCellCache.current.has(key)) {
|
444
|
+
TD.innerHTML = renderedCellCache.current.get(key).innerHTML;
|
445
|
+
}
|
446
|
+
if (TD && !TD.getAttribute('ghost-table')) {
|
447
|
+
var cachedPortal = portalCache.current.get(portalKey);
|
448
|
+
var cachedPortalContainer = portalContainerCache.current.get(portalContainerKey);
|
449
|
+
while (TD.firstChild) {
|
450
|
+
TD.removeChild(TD.firstChild);
|
451
|
+
}
|
452
|
+
// if portal already exists, do not recreate
|
453
|
+
if (cachedPortal && cachedPortalContainer) {
|
454
|
+
TD.appendChild(cachedPortalContainer);
|
455
|
+
} else {
|
456
|
+
var rendererElement = React.createElement(Renderer, {
|
457
|
+
instance: instance,
|
458
|
+
TD: TD,
|
459
|
+
row: row,
|
460
|
+
col: col,
|
461
|
+
prop: prop,
|
462
|
+
value: value,
|
463
|
+
cellProperties: cellProperties
|
464
|
+
});
|
465
|
+
var _createPortal = createPortal(rendererElement, TD.ownerDocument, portalKey, cachedPortalContainer),
|
466
|
+
portal = _createPortal.portal,
|
467
|
+
portalContainer = _createPortal.portalContainer;
|
468
|
+
portalContainerCache.current.set(portalContainerKey, portalContainer);
|
469
|
+
TD.appendChild(portalContainer);
|
470
|
+
portalCache.current.set(portalKey, portal);
|
471
|
+
}
|
472
|
+
}
|
473
|
+
renderedCellCache.current.set("".concat(row, "-").concat(col), TD);
|
474
|
+
return TD;
|
475
|
+
};
|
476
|
+
}, []);
|
477
|
+
var renderersPortalManager = useRef(function () {
|
478
|
+
return undefined;
|
479
|
+
});
|
480
|
+
var setRenderersPortalManagerRef = useCallback(function (pmComponent) {
|
481
|
+
renderersPortalManager.current = pmComponent;
|
482
|
+
}, []);
|
483
|
+
var pushCellPortalsIntoPortalManager = useCallback(function () {
|
484
|
+
renderersPortalManager.current(_toConsumableArray(portalCache.current.values()));
|
485
|
+
}, []);
|
486
|
+
var contextImpl = useMemo(function () {
|
487
|
+
return {
|
488
|
+
componentRendererColumns: componentRendererColumns.current,
|
489
|
+
columnsSettings: columnsSettings.current,
|
490
|
+
emitColumnSettings: setHotColumnSettings,
|
491
|
+
getRendererWrapper: getRendererWrapper,
|
492
|
+
clearPortalCache: clearPortalCache,
|
493
|
+
clearRenderedCellCache: clearRenderedCellCache,
|
494
|
+
setRenderersPortalManagerRef: setRenderersPortalManagerRef,
|
495
|
+
pushCellPortalsIntoPortalManager: pushCellPortalsIntoPortalManager
|
496
|
+
};
|
497
|
+
}, [setHotColumnSettings, getRendererWrapper, clearRenderedCellCache, setRenderersPortalManagerRef, pushCellPortalsIntoPortalManager]);
|
498
|
+
return React.createElement(HotTableContext.Provider, {
|
499
|
+
value: contextImpl
|
500
|
+
}, children);
|
501
|
+
};
|
502
|
+
/**
|
503
|
+
* Exposes the table context object to components
|
504
|
+
*
|
505
|
+
* @returns HotTableContext
|
506
|
+
*/
|
507
|
+
function useHotTableContext() {
|
508
|
+
return useContext(HotTableContext);
|
509
|
+
}
|
510
|
+
|
511
|
+
var HotColumnContext = createContext(undefined);
|
512
|
+
var HotColumnContextProvider = function HotColumnContextProvider(_ref) {
|
513
|
+
var columnIndex = _ref.columnIndex,
|
514
|
+
getOwnerDocument = _ref.getOwnerDocument,
|
515
|
+
children = _ref.children;
|
516
|
+
var contextImpl = useMemo(function () {
|
517
|
+
return {
|
518
|
+
columnIndex: columnIndex,
|
519
|
+
getOwnerDocument: getOwnerDocument
|
520
|
+
};
|
521
|
+
}, [columnIndex, getOwnerDocument]);
|
522
|
+
return React.createElement(HotColumnContext.Provider, {
|
523
|
+
value: contextImpl
|
524
|
+
}, children);
|
525
|
+
};
|
526
|
+
var useHotColumnContext = function useHotColumnContext() {
|
527
|
+
return useContext(HotColumnContext);
|
528
|
+
};
|
529
|
+
|
530
|
+
var AbstractMethods = ['close', 'focus', 'open'];
|
531
|
+
var ExcludedMethods = ['getValue', 'setValue'];
|
532
|
+
var MethodsMap = {
|
533
|
+
open: 'onOpen',
|
534
|
+
close: 'onClose',
|
535
|
+
prepare: 'onPrepare',
|
536
|
+
focus: 'onFocus'
|
537
|
+
};
|
538
|
+
/**
|
539
|
+
* Create a class to be passed to the Handsontable's settings.
|
540
|
+
*
|
541
|
+
* @param {RefObject<HotEditorHooks>} hooksRef Reference to component-based editor overridden hooks object.
|
542
|
+
* @param {RefObject} instanceRef Reference to Handsontable-native custom editor class instance.
|
543
|
+
* @returns {Function} A class to be passed to the Handsontable editor settings.
|
544
|
+
*/
|
545
|
+
function makeEditorClass(hooksRef, instanceRef) {
|
546
|
+
return /*#__PURE__*/function (_Handsontable$editors) {
|
547
|
+
function CustomEditor(hotInstance) {
|
548
|
+
var _this;
|
549
|
+
_classCallCheck(this, CustomEditor);
|
550
|
+
_this = _callSuper(this, CustomEditor, [hotInstance]);
|
551
|
+
instanceRef.current = _this;
|
552
|
+
Object.getOwnPropertyNames(Handsontable.editors.BaseEditor.prototype).forEach(function (propName) {
|
553
|
+
if (propName === 'constructor' || ExcludedMethods.includes(propName)) {
|
554
|
+
return;
|
555
|
+
}
|
556
|
+
var baseMethod = Handsontable.editors.BaseEditor.prototype[propName];
|
557
|
+
CustomEditor.prototype[propName] = function () {
|
558
|
+
var _hooksRef$current;
|
559
|
+
var result;
|
560
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
561
|
+
args[_key] = arguments[_key];
|
562
|
+
}
|
563
|
+
if (!AbstractMethods.includes(propName)) {
|
564
|
+
result = baseMethod.call.apply(baseMethod, [this].concat(args)); // call super
|
565
|
+
}
|
566
|
+
if (MethodsMap[propName] && (_hooksRef$current = hooksRef.current) !== null && _hooksRef$current !== void 0 && _hooksRef$current[MethodsMap[propName]]) {
|
567
|
+
var _hooksRef$current$Met;
|
568
|
+
result = (_hooksRef$current$Met = hooksRef.current[MethodsMap[propName]]).call.apply(_hooksRef$current$Met, [this].concat(args));
|
569
|
+
}
|
570
|
+
return result;
|
571
|
+
}.bind(_this);
|
572
|
+
});
|
573
|
+
return _this;
|
574
|
+
}
|
575
|
+
_inherits(CustomEditor, _Handsontable$editors);
|
576
|
+
return _createClass(CustomEditor, [{
|
577
|
+
key: "focus",
|
578
|
+
value: function focus() {}
|
579
|
+
}, {
|
580
|
+
key: "getValue",
|
581
|
+
value: function getValue() {
|
582
|
+
return this.value;
|
583
|
+
}
|
584
|
+
}, {
|
585
|
+
key: "setValue",
|
586
|
+
value: function setValue(newValue) {
|
587
|
+
this.value = newValue;
|
588
|
+
}
|
589
|
+
}, {
|
590
|
+
key: "open",
|
591
|
+
value: function open() {}
|
592
|
+
}, {
|
593
|
+
key: "close",
|
594
|
+
value: function close() {}
|
595
|
+
}]);
|
596
|
+
}(Handsontable.editors.BaseEditor);
|
597
|
+
}
|
598
|
+
/**
|
599
|
+
* Context to provide Handsontable-native custom editor class instance to overridden hooks object.
|
600
|
+
*/
|
601
|
+
var EditorContext = createContext(undefined);
|
602
|
+
/**
|
603
|
+
* Provider of the context that exposes Handsontable-native editor instance and passes hooks object
|
604
|
+
* for custom editor components.
|
605
|
+
*
|
606
|
+
* @param {Ref} hooksRef Reference for component-based editor overridden hooks object.
|
607
|
+
* @param {RefObject} hotCustomEditorInstanceRef Reference to Handsontable-native editor instance.
|
608
|
+
*/
|
609
|
+
var EditorContextProvider = function EditorContextProvider(_ref) {
|
610
|
+
var hooksRef = _ref.hooksRef,
|
611
|
+
hotCustomEditorInstanceRef = _ref.hotCustomEditorInstanceRef,
|
612
|
+
children = _ref.children;
|
613
|
+
return React.createElement(EditorContext.Provider, {
|
614
|
+
value: {
|
615
|
+
hooksRef: hooksRef,
|
616
|
+
hotCustomEditorInstanceRef: hotCustomEditorInstanceRef
|
617
|
+
}
|
618
|
+
}, children);
|
619
|
+
};
|
620
|
+
/**
|
621
|
+
* Hook that allows encapsulating custom behaviours of component-based editor by customizing passed ref with overridden hooks object.
|
622
|
+
*
|
623
|
+
* @param {HotEditorHooks} overriddenHooks Overrides specific for the custom editor.
|
624
|
+
* @param {DependencyList} deps Overridden hooks object React dependency list.
|
625
|
+
* @returns {UseHotEditorImpl} Editor API methods
|
626
|
+
*/
|
627
|
+
function useHotEditor(overriddenHooks, deps) {
|
628
|
+
var _useContext = useContext(EditorContext),
|
629
|
+
hooksRef = _useContext.hooksRef,
|
630
|
+
hotCustomEditorInstanceRef = _useContext.hotCustomEditorInstanceRef;
|
631
|
+
var _useState = useState(0),
|
632
|
+
_useState2 = _slicedToArray(_useState, 2),
|
633
|
+
rerenderTrigger = _useState2[0],
|
634
|
+
setRerenderTrigger = _useState2[1];
|
635
|
+
var _useState3 = useState(),
|
636
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
637
|
+
editorValue = _useState4[0],
|
638
|
+
setEditorValue = _useState4[1];
|
639
|
+
// return a deferred value that allows for optimizing performance by delaying the update of a value until the next render.
|
640
|
+
var deferredValue = useDeferredValue(editorValue);
|
641
|
+
useImperativeHandle(hooksRef, function () {
|
642
|
+
return _objectSpread2(_objectSpread2({}, overriddenHooks), {}, {
|
643
|
+
onOpen: function onOpen() {
|
644
|
+
var _hotCustomEditorInsta, _overriddenHooks$onOp;
|
645
|
+
setEditorValue((_hotCustomEditorInsta = hotCustomEditorInstanceRef.current) === null || _hotCustomEditorInsta === void 0 ? void 0 : _hotCustomEditorInsta.getValue());
|
646
|
+
overriddenHooks === null || overriddenHooks === void 0 || (_overriddenHooks$onOp = overriddenHooks.onOpen) === null || _overriddenHooks$onOp === void 0 || _overriddenHooks$onOp.call(overriddenHooks);
|
647
|
+
setRerenderTrigger(function (t) {
|
648
|
+
return t + 1;
|
649
|
+
});
|
650
|
+
}
|
651
|
+
});
|
652
|
+
}, deps);
|
653
|
+
return useMemo(function () {
|
654
|
+
return {
|
655
|
+
get value() {
|
656
|
+
return deferredValue;
|
657
|
+
},
|
658
|
+
setValue: function setValue(newValue) {
|
659
|
+
var _hotCustomEditorInsta2;
|
660
|
+
setEditorValue(newValue);
|
661
|
+
(_hotCustomEditorInsta2 = hotCustomEditorInstanceRef.current) === null || _hotCustomEditorInsta2 === void 0 || _hotCustomEditorInsta2.setValue(newValue);
|
662
|
+
},
|
663
|
+
get isOpen() {
|
664
|
+
var _hotCustomEditorInsta3, _hotCustomEditorInsta4;
|
665
|
+
return (_hotCustomEditorInsta3 = (_hotCustomEditorInsta4 = hotCustomEditorInstanceRef.current) === null || _hotCustomEditorInsta4 === void 0 ? void 0 : _hotCustomEditorInsta4.isOpened()) !== null && _hotCustomEditorInsta3 !== void 0 ? _hotCustomEditorInsta3 : false;
|
666
|
+
},
|
667
|
+
finishEditing: function finishEditing() {
|
668
|
+
var _hotCustomEditorInsta5;
|
669
|
+
(_hotCustomEditorInsta5 = hotCustomEditorInstanceRef.current) === null || _hotCustomEditorInsta5 === void 0 || _hotCustomEditorInsta5.finishEditing();
|
670
|
+
},
|
671
|
+
get row() {
|
672
|
+
var _hotCustomEditorInsta6;
|
673
|
+
return (_hotCustomEditorInsta6 = hotCustomEditorInstanceRef.current) === null || _hotCustomEditorInsta6 === void 0 ? void 0 : _hotCustomEditorInsta6.row;
|
674
|
+
},
|
675
|
+
get col() {
|
676
|
+
var _hotCustomEditorInsta7;
|
677
|
+
return (_hotCustomEditorInsta7 = hotCustomEditorInstanceRef.current) === null || _hotCustomEditorInsta7 === void 0 ? void 0 : _hotCustomEditorInsta7.col;
|
678
|
+
}
|
679
|
+
};
|
680
|
+
}, [rerenderTrigger, hotCustomEditorInstanceRef, deferredValue]);
|
681
|
+
}
|
682
|
+
|
683
|
+
var isHotColumn = function isHotColumn(childNode) {
|
684
|
+
return childNode.type === HotColumn;
|
685
|
+
};
|
686
|
+
var internalProps = ['_columnIndex', '_getOwnerDocument', 'children'];
|
687
|
+
var HotColumn = function HotColumn(props) {
|
688
|
+
var _useHotTableContext = useHotTableContext(),
|
689
|
+
componentRendererColumns = _useHotTableContext.componentRendererColumns,
|
690
|
+
emitColumnSettings = _useHotTableContext.emitColumnSettings,
|
691
|
+
getRendererWrapper = _useHotTableContext.getRendererWrapper;
|
692
|
+
var _useHotColumnContext = useHotColumnContext(),
|
693
|
+
columnIndex = _useHotColumnContext.columnIndex,
|
694
|
+
getOwnerDocument = _useHotColumnContext.getOwnerDocument;
|
695
|
+
/**
|
696
|
+
* Reference to component-based editor overridden hooks object.
|
697
|
+
*/
|
698
|
+
var localEditorHooksRef = useRef(null);
|
699
|
+
/**
|
700
|
+
* Reference to HOT-native custom editor class instance.
|
701
|
+
*/
|
702
|
+
var localEditorClassInstance = useRef(null);
|
703
|
+
/**
|
704
|
+
* Logic performed after mounting & updating of the HotColumn component.
|
705
|
+
*/
|
706
|
+
useEffect(function () {
|
707
|
+
/**
|
708
|
+
* Filter out all the internal properties and return an object with just the Handsontable-related props.
|
709
|
+
*
|
710
|
+
* @returns {Object}
|
711
|
+
*/
|
712
|
+
var getSettingsProps = function getSettingsProps() {
|
713
|
+
return Object.keys(props).filter(function (key) {
|
714
|
+
return !internalProps.includes(key);
|
715
|
+
}).reduce(function (obj, key) {
|
716
|
+
obj[key] = props[key];
|
717
|
+
return obj;
|
718
|
+
}, {});
|
719
|
+
};
|
720
|
+
/**
|
721
|
+
* Create the column settings based on the data provided to the `HotColumn` component and its child components.
|
722
|
+
*/
|
723
|
+
var createColumnSettings = function createColumnSettings() {
|
724
|
+
var columnSettings = SettingsMapper.getSettings(getSettingsProps());
|
725
|
+
if (props.renderer) {
|
726
|
+
columnSettings.renderer = getRendererWrapper(props.renderer);
|
727
|
+
componentRendererColumns.set(columnIndex, true);
|
728
|
+
} else if (props.hotRenderer) {
|
729
|
+
columnSettings.renderer = props.hotRenderer;
|
730
|
+
}
|
731
|
+
if (props.editor) {
|
732
|
+
columnSettings.editor = makeEditorClass(localEditorHooksRef, localEditorClassInstance);
|
733
|
+
} else if (props.hotEditor) {
|
734
|
+
columnSettings.editor = props.hotEditor;
|
735
|
+
}
|
736
|
+
return columnSettings;
|
737
|
+
};
|
738
|
+
var columnSettings = createColumnSettings();
|
739
|
+
emitColumnSettings(columnSettings, columnIndex);
|
740
|
+
if (!displayObsoleteRenderersEditorsWarning(props.children)) {
|
741
|
+
displayAnyChildrenWarning(props.children);
|
742
|
+
}
|
743
|
+
});
|
744
|
+
var editorPortal = createEditorPortal(getOwnerDocument(), props.editor);
|
745
|
+
/**
|
746
|
+
* Render the portals of the editors, if there are any.
|
747
|
+
*
|
748
|
+
* @returns {ReactElement}
|
749
|
+
*/
|
750
|
+
return React.createElement(EditorContextProvider, {
|
751
|
+
hooksRef: localEditorHooksRef,
|
752
|
+
hotCustomEditorInstanceRef: localEditorClassInstance
|
753
|
+
}, editorPortal);
|
754
|
+
};
|
755
|
+
|
756
|
+
var version="0.0.0-next-7cc7ef7-20241028";
|
757
|
+
|
758
|
+
/**
|
759
|
+
* Component used to manage the renderer component portals.
|
760
|
+
*/
|
761
|
+
var RenderersPortalManager = forwardRef(function (_, ref) {
|
762
|
+
var _useState = useState([]),
|
763
|
+
_useState2 = _slicedToArray(_useState, 2),
|
764
|
+
portals = _useState2[0],
|
765
|
+
setPortals = _useState2[1];
|
766
|
+
useImperativeHandle(ref, function () {
|
767
|
+
return setPortals;
|
768
|
+
});
|
769
|
+
return React.createElement(Fragment, null, portals);
|
770
|
+
});
|
771
|
+
|
772
|
+
function getDefaultExportFromCjs (x) {
|
773
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
774
|
+
}
|
775
|
+
|
776
|
+
var propTypes = {exports: {}};
|
777
|
+
|
778
|
+
var reactIs = {exports: {}};
|
779
|
+
|
780
|
+
var reactIs_production_min = {};
|
781
|
+
|
782
|
+
var hasRequiredReactIs_production_min;
|
783
|
+
function requireReactIs_production_min() {
|
784
|
+
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
785
|
+
hasRequiredReactIs_production_min = 1;
|
786
|
+
var b = "function" === typeof Symbol && Symbol["for"],
|
787
|
+
c = b ? Symbol["for"]("react.element") : 60103,
|
788
|
+
d = b ? Symbol["for"]("react.portal") : 60106,
|
789
|
+
e = b ? Symbol["for"]("react.fragment") : 60107,
|
790
|
+
f = b ? Symbol["for"]("react.strict_mode") : 60108,
|
791
|
+
g = b ? Symbol["for"]("react.profiler") : 60114,
|
792
|
+
h = b ? Symbol["for"]("react.provider") : 60109,
|
793
|
+
k = b ? Symbol["for"]("react.context") : 60110,
|
794
|
+
l = b ? Symbol["for"]("react.async_mode") : 60111,
|
795
|
+
m = b ? Symbol["for"]("react.concurrent_mode") : 60111,
|
796
|
+
n = b ? Symbol["for"]("react.forward_ref") : 60112,
|
797
|
+
p = b ? Symbol["for"]("react.suspense") : 60113,
|
798
|
+
q = b ? Symbol["for"]("react.suspense_list") : 60120,
|
799
|
+
r = b ? Symbol["for"]("react.memo") : 60115,
|
800
|
+
t = b ? Symbol["for"]("react.lazy") : 60116,
|
801
|
+
v = b ? Symbol["for"]("react.block") : 60121,
|
802
|
+
w = b ? Symbol["for"]("react.fundamental") : 60117,
|
803
|
+
x = b ? Symbol["for"]("react.responder") : 60118,
|
804
|
+
y = b ? Symbol["for"]("react.scope") : 60119;
|
805
|
+
function z(a) {
|
806
|
+
if ("object" === _typeof(a) && null !== a) {
|
807
|
+
var u = a.$$typeof;
|
808
|
+
switch (u) {
|
809
|
+
case c:
|
810
|
+
switch (a = a.type, a) {
|
811
|
+
case l:
|
812
|
+
case m:
|
813
|
+
case e:
|
814
|
+
case g:
|
815
|
+
case f:
|
816
|
+
case p:
|
817
|
+
return a;
|
818
|
+
default:
|
819
|
+
switch (a = a && a.$$typeof, a) {
|
820
|
+
case k:
|
821
|
+
case n:
|
822
|
+
case t:
|
823
|
+
case r:
|
824
|
+
case h:
|
825
|
+
return a;
|
826
|
+
default:
|
827
|
+
return u;
|
828
|
+
}
|
829
|
+
}
|
830
|
+
case d:
|
831
|
+
return u;
|
832
|
+
}
|
833
|
+
}
|
834
|
+
}
|
835
|
+
function A(a) {
|
836
|
+
return z(a) === m;
|
837
|
+
}
|
838
|
+
reactIs_production_min.AsyncMode = l;
|
839
|
+
reactIs_production_min.ConcurrentMode = m;
|
840
|
+
reactIs_production_min.ContextConsumer = k;
|
841
|
+
reactIs_production_min.ContextProvider = h;
|
842
|
+
reactIs_production_min.Element = c;
|
843
|
+
reactIs_production_min.ForwardRef = n;
|
844
|
+
reactIs_production_min.Fragment = e;
|
845
|
+
reactIs_production_min.Lazy = t;
|
846
|
+
reactIs_production_min.Memo = r;
|
847
|
+
reactIs_production_min.Portal = d;
|
848
|
+
reactIs_production_min.Profiler = g;
|
849
|
+
reactIs_production_min.StrictMode = f;
|
850
|
+
reactIs_production_min.Suspense = p;
|
851
|
+
reactIs_production_min.isAsyncMode = function (a) {
|
852
|
+
return A(a) || z(a) === l;
|
853
|
+
};
|
854
|
+
reactIs_production_min.isConcurrentMode = A;
|
855
|
+
reactIs_production_min.isContextConsumer = function (a) {
|
856
|
+
return z(a) === k;
|
857
|
+
};
|
858
|
+
reactIs_production_min.isContextProvider = function (a) {
|
859
|
+
return z(a) === h;
|
860
|
+
};
|
861
|
+
reactIs_production_min.isElement = function (a) {
|
862
|
+
return "object" === _typeof(a) && null !== a && a.$$typeof === c;
|
863
|
+
};
|
864
|
+
reactIs_production_min.isForwardRef = function (a) {
|
865
|
+
return z(a) === n;
|
866
|
+
};
|
867
|
+
reactIs_production_min.isFragment = function (a) {
|
868
|
+
return z(a) === e;
|
869
|
+
};
|
870
|
+
reactIs_production_min.isLazy = function (a) {
|
871
|
+
return z(a) === t;
|
872
|
+
};
|
873
|
+
reactIs_production_min.isMemo = function (a) {
|
874
|
+
return z(a) === r;
|
875
|
+
};
|
876
|
+
reactIs_production_min.isPortal = function (a) {
|
877
|
+
return z(a) === d;
|
878
|
+
};
|
879
|
+
reactIs_production_min.isProfiler = function (a) {
|
880
|
+
return z(a) === g;
|
881
|
+
};
|
882
|
+
reactIs_production_min.isStrictMode = function (a) {
|
883
|
+
return z(a) === f;
|
884
|
+
};
|
885
|
+
reactIs_production_min.isSuspense = function (a) {
|
886
|
+
return z(a) === p;
|
887
|
+
};
|
888
|
+
reactIs_production_min.isValidElementType = function (a) {
|
889
|
+
return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === _typeof(a) && null !== a && (a.$$typeof === t || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
|
890
|
+
};
|
891
|
+
reactIs_production_min.typeOf = z;
|
892
|
+
return reactIs_production_min;
|
893
|
+
}
|
894
|
+
|
895
|
+
var reactIs_development = {};
|
896
|
+
|
897
|
+
var hasRequiredReactIs_development;
|
898
|
+
function requireReactIs_development() {
|
899
|
+
if (hasRequiredReactIs_development) return reactIs_development;
|
900
|
+
hasRequiredReactIs_development = 1;
|
901
|
+
if (process.env.NODE_ENV !== "production") {
|
902
|
+
(function () {
|
903
|
+
|
904
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
905
|
+
// nor polyfill, then a plain number is used for performance.
|
906
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol["for"];
|
907
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol["for"]('react.element') : 0xeac7;
|
908
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol["for"]('react.portal') : 0xeaca;
|
909
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol["for"]('react.fragment') : 0xeacb;
|
910
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol["for"]('react.strict_mode') : 0xeacc;
|
911
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol["for"]('react.profiler') : 0xead2;
|
912
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol["for"]('react.provider') : 0xeacd;
|
913
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol["for"]('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
914
|
+
// (unstable) APIs that have been removed. Can we remove the symbols?
|
915
|
+
|
916
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol["for"]('react.async_mode') : 0xeacf;
|
917
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol["for"]('react.concurrent_mode') : 0xeacf;
|
918
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol["for"]('react.forward_ref') : 0xead0;
|
919
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol["for"]('react.suspense') : 0xead1;
|
920
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol["for"]('react.suspense_list') : 0xead8;
|
921
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol["for"]('react.memo') : 0xead3;
|
922
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol["for"]('react.lazy') : 0xead4;
|
923
|
+
var REACT_BLOCK_TYPE = hasSymbol ? Symbol["for"]('react.block') : 0xead9;
|
924
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol["for"]('react.fundamental') : 0xead5;
|
925
|
+
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol["for"]('react.responder') : 0xead6;
|
926
|
+
var REACT_SCOPE_TYPE = hasSymbol ? Symbol["for"]('react.scope') : 0xead7;
|
927
|
+
function isValidElementType(type) {
|
928
|
+
return typeof type === 'string' || typeof type === 'function' ||
|
929
|
+
// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
930
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || _typeof(type) === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
931
|
+
}
|
932
|
+
function typeOf(object) {
|
933
|
+
if (_typeof(object) === 'object' && object !== null) {
|
934
|
+
var $$typeof = object.$$typeof;
|
935
|
+
switch ($$typeof) {
|
936
|
+
case REACT_ELEMENT_TYPE:
|
937
|
+
var type = object.type;
|
938
|
+
switch (type) {
|
939
|
+
case REACT_ASYNC_MODE_TYPE:
|
940
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
941
|
+
case REACT_FRAGMENT_TYPE:
|
942
|
+
case REACT_PROFILER_TYPE:
|
943
|
+
case REACT_STRICT_MODE_TYPE:
|
944
|
+
case REACT_SUSPENSE_TYPE:
|
945
|
+
return type;
|
946
|
+
default:
|
947
|
+
var $$typeofType = type && type.$$typeof;
|
948
|
+
switch ($$typeofType) {
|
949
|
+
case REACT_CONTEXT_TYPE:
|
950
|
+
case REACT_FORWARD_REF_TYPE:
|
951
|
+
case REACT_LAZY_TYPE:
|
952
|
+
case REACT_MEMO_TYPE:
|
953
|
+
case REACT_PROVIDER_TYPE:
|
954
|
+
return $$typeofType;
|
955
|
+
default:
|
956
|
+
return $$typeof;
|
957
|
+
}
|
958
|
+
}
|
959
|
+
case REACT_PORTAL_TYPE:
|
960
|
+
return $$typeof;
|
961
|
+
}
|
962
|
+
}
|
963
|
+
return undefined;
|
964
|
+
} // AsyncMode is deprecated along with isAsyncMode
|
965
|
+
|
966
|
+
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
967
|
+
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
968
|
+
var ContextConsumer = REACT_CONTEXT_TYPE;
|
969
|
+
var ContextProvider = REACT_PROVIDER_TYPE;
|
970
|
+
var Element = REACT_ELEMENT_TYPE;
|
971
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
972
|
+
var Fragment = REACT_FRAGMENT_TYPE;
|
973
|
+
var Lazy = REACT_LAZY_TYPE;
|
974
|
+
var Memo = REACT_MEMO_TYPE;
|
975
|
+
var Portal = REACT_PORTAL_TYPE;
|
976
|
+
var Profiler = REACT_PROFILER_TYPE;
|
977
|
+
var StrictMode = REACT_STRICT_MODE_TYPE;
|
978
|
+
var Suspense = REACT_SUSPENSE_TYPE;
|
979
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
|
980
|
+
|
981
|
+
function isAsyncMode(object) {
|
982
|
+
{
|
983
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
984
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
985
|
+
|
986
|
+
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
987
|
+
}
|
988
|
+
}
|
989
|
+
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
990
|
+
}
|
991
|
+
function isConcurrentMode(object) {
|
992
|
+
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
993
|
+
}
|
994
|
+
function isContextConsumer(object) {
|
995
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
996
|
+
}
|
997
|
+
function isContextProvider(object) {
|
998
|
+
return typeOf(object) === REACT_PROVIDER_TYPE;
|
999
|
+
}
|
1000
|
+
function isElement(object) {
|
1001
|
+
return _typeof(object) === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
1002
|
+
}
|
1003
|
+
function isForwardRef(object) {
|
1004
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
1005
|
+
}
|
1006
|
+
function isFragment(object) {
|
1007
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
1008
|
+
}
|
1009
|
+
function isLazy(object) {
|
1010
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
1011
|
+
}
|
1012
|
+
function isMemo(object) {
|
1013
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
1014
|
+
}
|
1015
|
+
function isPortal(object) {
|
1016
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
1017
|
+
}
|
1018
|
+
function isProfiler(object) {
|
1019
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
1020
|
+
}
|
1021
|
+
function isStrictMode(object) {
|
1022
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
1023
|
+
}
|
1024
|
+
function isSuspense(object) {
|
1025
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
1026
|
+
}
|
1027
|
+
reactIs_development.AsyncMode = AsyncMode;
|
1028
|
+
reactIs_development.ConcurrentMode = ConcurrentMode;
|
1029
|
+
reactIs_development.ContextConsumer = ContextConsumer;
|
1030
|
+
reactIs_development.ContextProvider = ContextProvider;
|
1031
|
+
reactIs_development.Element = Element;
|
1032
|
+
reactIs_development.ForwardRef = ForwardRef;
|
1033
|
+
reactIs_development.Fragment = Fragment;
|
1034
|
+
reactIs_development.Lazy = Lazy;
|
1035
|
+
reactIs_development.Memo = Memo;
|
1036
|
+
reactIs_development.Portal = Portal;
|
1037
|
+
reactIs_development.Profiler = Profiler;
|
1038
|
+
reactIs_development.StrictMode = StrictMode;
|
1039
|
+
reactIs_development.Suspense = Suspense;
|
1040
|
+
reactIs_development.isAsyncMode = isAsyncMode;
|
1041
|
+
reactIs_development.isConcurrentMode = isConcurrentMode;
|
1042
|
+
reactIs_development.isContextConsumer = isContextConsumer;
|
1043
|
+
reactIs_development.isContextProvider = isContextProvider;
|
1044
|
+
reactIs_development.isElement = isElement;
|
1045
|
+
reactIs_development.isForwardRef = isForwardRef;
|
1046
|
+
reactIs_development.isFragment = isFragment;
|
1047
|
+
reactIs_development.isLazy = isLazy;
|
1048
|
+
reactIs_development.isMemo = isMemo;
|
1049
|
+
reactIs_development.isPortal = isPortal;
|
1050
|
+
reactIs_development.isProfiler = isProfiler;
|
1051
|
+
reactIs_development.isStrictMode = isStrictMode;
|
1052
|
+
reactIs_development.isSuspense = isSuspense;
|
1053
|
+
reactIs_development.isValidElementType = isValidElementType;
|
1054
|
+
reactIs_development.typeOf = typeOf;
|
1055
|
+
})();
|
1056
|
+
}
|
1057
|
+
return reactIs_development;
|
1058
|
+
}
|
1059
|
+
|
1060
|
+
var hasRequiredReactIs;
|
1061
|
+
function requireReactIs() {
|
1062
|
+
if (hasRequiredReactIs) return reactIs.exports;
|
1063
|
+
hasRequiredReactIs = 1;
|
1064
|
+
if (process.env.NODE_ENV === 'production') {
|
1065
|
+
reactIs.exports = requireReactIs_production_min();
|
1066
|
+
} else {
|
1067
|
+
reactIs.exports = requireReactIs_development();
|
1068
|
+
}
|
1069
|
+
return reactIs.exports;
|
1070
|
+
}
|
1071
|
+
|
1072
|
+
/*
|
1073
|
+
object-assign
|
1074
|
+
(c) Sindre Sorhus
|
1075
|
+
@license MIT
|
1076
|
+
*/
|
1077
|
+
var objectAssign;
|
1078
|
+
var hasRequiredObjectAssign;
|
1079
|
+
function requireObjectAssign() {
|
1080
|
+
if (hasRequiredObjectAssign) return objectAssign;
|
1081
|
+
hasRequiredObjectAssign = 1;
|
1082
|
+
/* eslint-disable no-unused-vars */
|
1083
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
1084
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
1085
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
1086
|
+
function toObject(val) {
|
1087
|
+
if (val === null || val === undefined) {
|
1088
|
+
throw new TypeError('Object.assign cannot be called with null or undefined');
|
1089
|
+
}
|
1090
|
+
return Object(val);
|
1091
|
+
}
|
1092
|
+
function shouldUseNative() {
|
1093
|
+
try {
|
1094
|
+
if (!Object.assign) {
|
1095
|
+
return false;
|
1096
|
+
}
|
1097
|
+
|
1098
|
+
// Detect buggy property enumeration order in older V8 versions.
|
1099
|
+
|
1100
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
1101
|
+
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
1102
|
+
test1[5] = 'de';
|
1103
|
+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
1104
|
+
return false;
|
1105
|
+
}
|
1106
|
+
|
1107
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
1108
|
+
var test2 = {};
|
1109
|
+
for (var i = 0; i < 10; i++) {
|
1110
|
+
test2['_' + String.fromCharCode(i)] = i;
|
1111
|
+
}
|
1112
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
1113
|
+
return test2[n];
|
1114
|
+
});
|
1115
|
+
if (order2.join('') !== '0123456789') {
|
1116
|
+
return false;
|
1117
|
+
}
|
1118
|
+
|
1119
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
1120
|
+
var test3 = {};
|
1121
|
+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
1122
|
+
test3[letter] = letter;
|
1123
|
+
});
|
1124
|
+
if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') {
|
1125
|
+
return false;
|
1126
|
+
}
|
1127
|
+
return true;
|
1128
|
+
} catch (err) {
|
1129
|
+
// We don't expect any of the above to throw, but better to be safe.
|
1130
|
+
return false;
|
1131
|
+
}
|
1132
|
+
}
|
1133
|
+
objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
1134
|
+
var from;
|
1135
|
+
var to = toObject(target);
|
1136
|
+
var symbols;
|
1137
|
+
for (var s = 1; s < arguments.length; s++) {
|
1138
|
+
from = Object(arguments[s]);
|
1139
|
+
for (var key in from) {
|
1140
|
+
if (hasOwnProperty.call(from, key)) {
|
1141
|
+
to[key] = from[key];
|
1142
|
+
}
|
1143
|
+
}
|
1144
|
+
if (getOwnPropertySymbols) {
|
1145
|
+
symbols = getOwnPropertySymbols(from);
|
1146
|
+
for (var i = 0; i < symbols.length; i++) {
|
1147
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
1148
|
+
to[symbols[i]] = from[symbols[i]];
|
1149
|
+
}
|
1150
|
+
}
|
1151
|
+
}
|
1152
|
+
}
|
1153
|
+
return to;
|
1154
|
+
};
|
1155
|
+
return objectAssign;
|
1156
|
+
}
|
1157
|
+
|
1158
|
+
/**
|
1159
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
1160
|
+
*
|
1161
|
+
* This source code is licensed under the MIT license found in the
|
1162
|
+
* LICENSE file in the root directory of this source tree.
|
1163
|
+
*/
|
1164
|
+
var ReactPropTypesSecret_1;
|
1165
|
+
var hasRequiredReactPropTypesSecret;
|
1166
|
+
function requireReactPropTypesSecret() {
|
1167
|
+
if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
|
1168
|
+
hasRequiredReactPropTypesSecret = 1;
|
1169
|
+
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
1170
|
+
ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
1171
|
+
return ReactPropTypesSecret_1;
|
1172
|
+
}
|
1173
|
+
|
1174
|
+
var has;
|
1175
|
+
var hasRequiredHas;
|
1176
|
+
function requireHas() {
|
1177
|
+
if (hasRequiredHas) return has;
|
1178
|
+
hasRequiredHas = 1;
|
1179
|
+
has = Function.call.bind(Object.prototype.hasOwnProperty);
|
1180
|
+
return has;
|
1181
|
+
}
|
1182
|
+
|
1183
|
+
var checkPropTypes_1;
|
1184
|
+
var hasRequiredCheckPropTypes;
|
1185
|
+
function requireCheckPropTypes() {
|
1186
|
+
if (hasRequiredCheckPropTypes) return checkPropTypes_1;
|
1187
|
+
hasRequiredCheckPropTypes = 1;
|
1188
|
+
var printWarning = function printWarning() {};
|
1189
|
+
if (process.env.NODE_ENV !== 'production') {
|
1190
|
+
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
1191
|
+
var loggedTypeFailures = {};
|
1192
|
+
var has = requireHas();
|
1193
|
+
printWarning = function printWarning(text) {
|
1194
|
+
var message = 'Warning: ' + text;
|
1195
|
+
if (typeof console !== 'undefined') {
|
1196
|
+
console.error(message);
|
1197
|
+
}
|
1198
|
+
try {
|
1199
|
+
// --- Welcome to debugging React ---
|
1200
|
+
// This error was thrown as a convenience so that you can use this stack
|
1201
|
+
// to find the callsite that caused this warning to fire.
|
1202
|
+
throw new Error(message);
|
1203
|
+
} catch (x) {/**/}
|
1204
|
+
};
|
1205
|
+
}
|
1206
|
+
|
1207
|
+
/**
|
1208
|
+
* Assert that the values match with the type specs.
|
1209
|
+
* Error messages are memorized and will only be shown once.
|
1210
|
+
*
|
1211
|
+
* @param {object} typeSpecs Map of name to a ReactPropType
|
1212
|
+
* @param {object} values Runtime values that need to be type-checked
|
1213
|
+
* @param {string} location e.g. "prop", "context", "child context"
|
1214
|
+
* @param {string} componentName Name of the component for error messages.
|
1215
|
+
* @param {?Function} getStack Returns the component stack.
|
1216
|
+
* @private
|
1217
|
+
*/
|
1218
|
+
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
1219
|
+
if (process.env.NODE_ENV !== 'production') {
|
1220
|
+
for (var typeSpecName in typeSpecs) {
|
1221
|
+
if (has(typeSpecs, typeSpecName)) {
|
1222
|
+
var error;
|
1223
|
+
// Prop type validation may throw. In case they do, we don't want to
|
1224
|
+
// fail the render phase where it didn't fail before. So we log it.
|
1225
|
+
// After these have been cleaned up, we'll let them throw.
|
1226
|
+
try {
|
1227
|
+
// This is intentionally an invariant that gets caught. It's the same
|
1228
|
+
// behavior as without this statement except with a better message.
|
1229
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
1230
|
+
var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + _typeof(typeSpecs[typeSpecName]) + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
|
1231
|
+
err.name = 'Invariant Violation';
|
1232
|
+
throw err;
|
1233
|
+
}
|
1234
|
+
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
1235
|
+
} catch (ex) {
|
1236
|
+
error = ex;
|
1237
|
+
}
|
1238
|
+
if (error && !(error instanceof Error)) {
|
1239
|
+
printWarning((componentName || 'React class') + ': type specification of ' + location + ' `' + typeSpecName + '` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a ' + _typeof(error) + '. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).');
|
1240
|
+
}
|
1241
|
+
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
1242
|
+
// Only monitor this failure once because there tends to be a lot of the
|
1243
|
+
// same error.
|
1244
|
+
loggedTypeFailures[error.message] = true;
|
1245
|
+
var stack = getStack ? getStack() : '';
|
1246
|
+
printWarning('Failed ' + location + ' type: ' + error.message + (stack != null ? stack : ''));
|
1247
|
+
}
|
1248
|
+
}
|
1249
|
+
}
|
1250
|
+
}
|
1251
|
+
}
|
1252
|
+
|
1253
|
+
/**
|
1254
|
+
* Resets warning cache when testing.
|
1255
|
+
*
|
1256
|
+
* @private
|
1257
|
+
*/
|
1258
|
+
checkPropTypes.resetWarningCache = function () {
|
1259
|
+
if (process.env.NODE_ENV !== 'production') {
|
1260
|
+
loggedTypeFailures = {};
|
1261
|
+
}
|
1262
|
+
};
|
1263
|
+
checkPropTypes_1 = checkPropTypes;
|
1264
|
+
return checkPropTypes_1;
|
1265
|
+
}
|
1266
|
+
|
1267
|
+
var factoryWithTypeCheckers;
|
1268
|
+
var hasRequiredFactoryWithTypeCheckers;
|
1269
|
+
function requireFactoryWithTypeCheckers() {
|
1270
|
+
if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
|
1271
|
+
hasRequiredFactoryWithTypeCheckers = 1;
|
1272
|
+
var ReactIs = requireReactIs();
|
1273
|
+
var assign = requireObjectAssign();
|
1274
|
+
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
1275
|
+
var has = requireHas();
|
1276
|
+
var checkPropTypes = requireCheckPropTypes();
|
1277
|
+
var printWarning = function printWarning() {};
|
1278
|
+
if (process.env.NODE_ENV !== 'production') {
|
1279
|
+
printWarning = function printWarning(text) {
|
1280
|
+
var message = 'Warning: ' + text;
|
1281
|
+
if (typeof console !== 'undefined') {
|
1282
|
+
console.error(message);
|
1283
|
+
}
|
1284
|
+
try {
|
1285
|
+
// --- Welcome to debugging React ---
|
1286
|
+
// This error was thrown as a convenience so that you can use this stack
|
1287
|
+
// to find the callsite that caused this warning to fire.
|
1288
|
+
throw new Error(message);
|
1289
|
+
} catch (x) {}
|
1290
|
+
};
|
1291
|
+
}
|
1292
|
+
function emptyFunctionThatReturnsNull() {
|
1293
|
+
return null;
|
1294
|
+
}
|
1295
|
+
factoryWithTypeCheckers = function factoryWithTypeCheckers(isValidElement, throwOnDirectAccess) {
|
1296
|
+
/* global Symbol */
|
1297
|
+
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
1298
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
1299
|
+
|
1300
|
+
/**
|
1301
|
+
* Returns the iterator method function contained on the iterable object.
|
1302
|
+
*
|
1303
|
+
* Be sure to invoke the function with the iterable as context:
|
1304
|
+
*
|
1305
|
+
* var iteratorFn = getIteratorFn(myIterable);
|
1306
|
+
* if (iteratorFn) {
|
1307
|
+
* var iterator = iteratorFn.call(myIterable);
|
1308
|
+
* ...
|
1309
|
+
* }
|
1310
|
+
*
|
1311
|
+
* @param {?object} maybeIterable
|
1312
|
+
* @return {?function}
|
1313
|
+
*/
|
1314
|
+
function getIteratorFn(maybeIterable) {
|
1315
|
+
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
1316
|
+
if (typeof iteratorFn === 'function') {
|
1317
|
+
return iteratorFn;
|
1318
|
+
}
|
1319
|
+
}
|
1320
|
+
|
1321
|
+
/**
|
1322
|
+
* Collection of methods that allow declaration and validation of props that are
|
1323
|
+
* supplied to React components. Example usage:
|
1324
|
+
*
|
1325
|
+
* var Props = require('ReactPropTypes');
|
1326
|
+
* var MyArticle = React.createClass({
|
1327
|
+
* propTypes: {
|
1328
|
+
* // An optional string prop named "description".
|
1329
|
+
* description: Props.string,
|
1330
|
+
*
|
1331
|
+
* // A required enum prop named "category".
|
1332
|
+
* category: Props.oneOf(['News','Photos']).isRequired,
|
1333
|
+
*
|
1334
|
+
* // A prop named "dialog" that requires an instance of Dialog.
|
1335
|
+
* dialog: Props.instanceOf(Dialog).isRequired
|
1336
|
+
* },
|
1337
|
+
* render: function() { ... }
|
1338
|
+
* });
|
1339
|
+
*
|
1340
|
+
* A more formal specification of how these methods are used:
|
1341
|
+
*
|
1342
|
+
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
1343
|
+
* decl := ReactPropTypes.{type}(.isRequired)?
|
1344
|
+
*
|
1345
|
+
* Each and every declaration produces a function with the same signature. This
|
1346
|
+
* allows the creation of custom validation functions. For example:
|
1347
|
+
*
|
1348
|
+
* var MyLink = React.createClass({
|
1349
|
+
* propTypes: {
|
1350
|
+
* // An optional string or URI prop named "href".
|
1351
|
+
* href: function(props, propName, componentName) {
|
1352
|
+
* var propValue = props[propName];
|
1353
|
+
* if (propValue != null && typeof propValue !== 'string' &&
|
1354
|
+
* !(propValue instanceof URI)) {
|
1355
|
+
* return new Error(
|
1356
|
+
* 'Expected a string or an URI for ' + propName + ' in ' +
|
1357
|
+
* componentName
|
1358
|
+
* );
|
1359
|
+
* }
|
1360
|
+
* }
|
1361
|
+
* },
|
1362
|
+
* render: function() {...}
|
1363
|
+
* });
|
1364
|
+
*
|
1365
|
+
* @internal
|
1366
|
+
*/
|
1367
|
+
|
1368
|
+
var ANONYMOUS = '<<anonymous>>';
|
1369
|
+
|
1370
|
+
// Important!
|
1371
|
+
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
|
1372
|
+
var ReactPropTypes = {
|
1373
|
+
array: createPrimitiveTypeChecker('array'),
|
1374
|
+
bigint: createPrimitiveTypeChecker('bigint'),
|
1375
|
+
bool: createPrimitiveTypeChecker('boolean'),
|
1376
|
+
func: createPrimitiveTypeChecker('function'),
|
1377
|
+
number: createPrimitiveTypeChecker('number'),
|
1378
|
+
object: createPrimitiveTypeChecker('object'),
|
1379
|
+
string: createPrimitiveTypeChecker('string'),
|
1380
|
+
symbol: createPrimitiveTypeChecker('symbol'),
|
1381
|
+
any: createAnyTypeChecker(),
|
1382
|
+
arrayOf: createArrayOfTypeChecker,
|
1383
|
+
element: createElementTypeChecker(),
|
1384
|
+
elementType: createElementTypeTypeChecker(),
|
1385
|
+
instanceOf: createInstanceTypeChecker,
|
1386
|
+
node: createNodeChecker(),
|
1387
|
+
objectOf: createObjectOfTypeChecker,
|
1388
|
+
oneOf: createEnumTypeChecker,
|
1389
|
+
oneOfType: createUnionTypeChecker,
|
1390
|
+
shape: createShapeTypeChecker,
|
1391
|
+
exact: createStrictShapeTypeChecker
|
1392
|
+
};
|
1393
|
+
|
1394
|
+
/**
|
1395
|
+
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
1396
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
1397
|
+
*/
|
1398
|
+
/*eslint-disable no-self-compare*/
|
1399
|
+
function is(x, y) {
|
1400
|
+
// SameValue algorithm
|
1401
|
+
if (x === y) {
|
1402
|
+
// Steps 1-5, 7-10
|
1403
|
+
// Steps 6.b-6.e: +0 != -0
|
1404
|
+
return x !== 0 || 1 / x === 1 / y;
|
1405
|
+
} else {
|
1406
|
+
// Step 6.a: NaN == NaN
|
1407
|
+
return x !== x && y !== y;
|
1408
|
+
}
|
1409
|
+
}
|
1410
|
+
/*eslint-enable no-self-compare*/
|
1411
|
+
|
1412
|
+
/**
|
1413
|
+
* We use an Error-like object for backward compatibility as people may call
|
1414
|
+
* PropTypes directly and inspect their output. However, we don't use real
|
1415
|
+
* Errors anymore. We don't inspect their stack anyway, and creating them
|
1416
|
+
* is prohibitively expensive if they are created too often, such as what
|
1417
|
+
* happens in oneOfType() for any type before the one that matched.
|
1418
|
+
*/
|
1419
|
+
function PropTypeError(message, data) {
|
1420
|
+
this.message = message;
|
1421
|
+
this.data = data && _typeof(data) === 'object' ? data : {};
|
1422
|
+
this.stack = '';
|
1423
|
+
}
|
1424
|
+
// Make `instanceof Error` still work for returned errors.
|
1425
|
+
PropTypeError.prototype = Error.prototype;
|
1426
|
+
function createChainableTypeChecker(validate) {
|
1427
|
+
if (process.env.NODE_ENV !== 'production') {
|
1428
|
+
var manualPropTypeCallCache = {};
|
1429
|
+
var manualPropTypeWarningCount = 0;
|
1430
|
+
}
|
1431
|
+
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
1432
|
+
componentName = componentName || ANONYMOUS;
|
1433
|
+
propFullName = propFullName || propName;
|
1434
|
+
if (secret !== ReactPropTypesSecret) {
|
1435
|
+
if (throwOnDirectAccess) {
|
1436
|
+
// New behavior only for users of `prop-types` package
|
1437
|
+
var err = new Error('Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use `PropTypes.checkPropTypes()` to call them. ' + 'Read more at http://fb.me/use-check-prop-types');
|
1438
|
+
err.name = 'Invariant Violation';
|
1439
|
+
throw err;
|
1440
|
+
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
1441
|
+
// Old behavior for people using React.PropTypes
|
1442
|
+
var cacheKey = componentName + ':' + propName;
|
1443
|
+
if (!manualPropTypeCallCache[cacheKey] &&
|
1444
|
+
// Avoid spamming the console because they are often not actionable except for lib authors
|
1445
|
+
manualPropTypeWarningCount < 3) {
|
1446
|
+
printWarning('You are manually calling a React.PropTypes validation ' + 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + 'and will throw in the standalone `prop-types` package. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.');
|
1447
|
+
manualPropTypeCallCache[cacheKey] = true;
|
1448
|
+
manualPropTypeWarningCount++;
|
1449
|
+
}
|
1450
|
+
}
|
1451
|
+
}
|
1452
|
+
if (props[propName] == null) {
|
1453
|
+
if (isRequired) {
|
1454
|
+
if (props[propName] === null) {
|
1455
|
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
1456
|
+
}
|
1457
|
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
1458
|
+
}
|
1459
|
+
return null;
|
1460
|
+
} else {
|
1461
|
+
return validate(props, propName, componentName, location, propFullName);
|
1462
|
+
}
|
1463
|
+
}
|
1464
|
+
var chainedCheckType = checkType.bind(null, false);
|
1465
|
+
chainedCheckType.isRequired = checkType.bind(null, true);
|
1466
|
+
return chainedCheckType;
|
1467
|
+
}
|
1468
|
+
function createPrimitiveTypeChecker(expectedType) {
|
1469
|
+
function validate(props, propName, componentName, location, propFullName, secret) {
|
1470
|
+
var propValue = props[propName];
|
1471
|
+
var propType = getPropType(propValue);
|
1472
|
+
if (propType !== expectedType) {
|
1473
|
+
// `propValue` being instance of, say, date/regexp, pass the 'object'
|
1474
|
+
// check, but we can offer a more precise error message here rather than
|
1475
|
+
// 'of type `object`'.
|
1476
|
+
var preciseType = getPreciseType(propValue);
|
1477
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'), {
|
1478
|
+
expectedType: expectedType
|
1479
|
+
});
|
1480
|
+
}
|
1481
|
+
return null;
|
1482
|
+
}
|
1483
|
+
return createChainableTypeChecker(validate);
|
1484
|
+
}
|
1485
|
+
function createAnyTypeChecker() {
|
1486
|
+
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
1487
|
+
}
|
1488
|
+
function createArrayOfTypeChecker(typeChecker) {
|
1489
|
+
function validate(props, propName, componentName, location, propFullName) {
|
1490
|
+
if (typeof typeChecker !== 'function') {
|
1491
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
1492
|
+
}
|
1493
|
+
var propValue = props[propName];
|
1494
|
+
if (!Array.isArray(propValue)) {
|
1495
|
+
var propType = getPropType(propValue);
|
1496
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
1497
|
+
}
|
1498
|
+
for (var i = 0; i < propValue.length; i++) {
|
1499
|
+
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
|
1500
|
+
if (error instanceof Error) {
|
1501
|
+
return error;
|
1502
|
+
}
|
1503
|
+
}
|
1504
|
+
return null;
|
1505
|
+
}
|
1506
|
+
return createChainableTypeChecker(validate);
|
1507
|
+
}
|
1508
|
+
function createElementTypeChecker() {
|
1509
|
+
function validate(props, propName, componentName, location, propFullName) {
|
1510
|
+
var propValue = props[propName];
|
1511
|
+
if (!isValidElement(propValue)) {
|
1512
|
+
var propType = getPropType(propValue);
|
1513
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
1514
|
+
}
|
1515
|
+
return null;
|
1516
|
+
}
|
1517
|
+
return createChainableTypeChecker(validate);
|
1518
|
+
}
|
1519
|
+
function createElementTypeTypeChecker() {
|
1520
|
+
function validate(props, propName, componentName, location, propFullName) {
|
1521
|
+
var propValue = props[propName];
|
1522
|
+
if (!ReactIs.isValidElementType(propValue)) {
|
1523
|
+
var propType = getPropType(propValue);
|
1524
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
1525
|
+
}
|
1526
|
+
return null;
|
1527
|
+
}
|
1528
|
+
return createChainableTypeChecker(validate);
|
1529
|
+
}
|
1530
|
+
function createInstanceTypeChecker(expectedClass) {
|
1531
|
+
function validate(props, propName, componentName, location, propFullName) {
|
1532
|
+
if (!(props[propName] instanceof expectedClass)) {
|
1533
|
+
var expectedClassName = expectedClass.name || ANONYMOUS;
|
1534
|
+
var actualClassName = getClassName(props[propName]);
|
1535
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
1536
|
+
}
|
1537
|
+
return null;
|
1538
|
+
}
|
1539
|
+
return createChainableTypeChecker(validate);
|
1540
|
+
}
|
1541
|
+
function createEnumTypeChecker(expectedValues) {
|
1542
|
+
if (!Array.isArray(expectedValues)) {
|
1543
|
+
if (process.env.NODE_ENV !== 'production') {
|
1544
|
+
if (arguments.length > 1) {
|
1545
|
+
printWarning('Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' + 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).');
|
1546
|
+
} else {
|
1547
|
+
printWarning('Invalid argument supplied to oneOf, expected an array.');
|
1548
|
+
}
|
1549
|
+
}
|
1550
|
+
return emptyFunctionThatReturnsNull;
|
1551
|
+
}
|
1552
|
+
function validate(props, propName, componentName, location, propFullName) {
|
1553
|
+
var propValue = props[propName];
|
1554
|
+
for (var i = 0; i < expectedValues.length; i++) {
|
1555
|
+
if (is(propValue, expectedValues[i])) {
|
1556
|
+
return null;
|
1557
|
+
}
|
1558
|
+
}
|
1559
|
+
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
1560
|
+
var type = getPreciseType(value);
|
1561
|
+
if (type === 'symbol') {
|
1562
|
+
return String(value);
|
1563
|
+
}
|
1564
|
+
return value;
|
1565
|
+
});
|
1566
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
1567
|
+
}
|
1568
|
+
return createChainableTypeChecker(validate);
|
1569
|
+
}
|
1570
|
+
function createObjectOfTypeChecker(typeChecker) {
|
1571
|
+
function validate(props, propName, componentName, location, propFullName) {
|
1572
|
+
if (typeof typeChecker !== 'function') {
|
1573
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
1574
|
+
}
|
1575
|
+
var propValue = props[propName];
|
1576
|
+
var propType = getPropType(propValue);
|
1577
|
+
if (propType !== 'object') {
|
1578
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
1579
|
+
}
|
1580
|
+
for (var key in propValue) {
|
1581
|
+
if (has(propValue, key)) {
|
1582
|
+
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
1583
|
+
if (error instanceof Error) {
|
1584
|
+
return error;
|
1585
|
+
}
|
1586
|
+
}
|
1587
|
+
}
|
1588
|
+
return null;
|
1589
|
+
}
|
1590
|
+
return createChainableTypeChecker(validate);
|
1591
|
+
}
|
1592
|
+
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
1593
|
+
if (!Array.isArray(arrayOfTypeCheckers)) {
|
1594
|
+
process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
1595
|
+
return emptyFunctionThatReturnsNull;
|
1596
|
+
}
|
1597
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
1598
|
+
var checker = arrayOfTypeCheckers[i];
|
1599
|
+
if (typeof checker !== 'function') {
|
1600
|
+
printWarning('Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.');
|
1601
|
+
return emptyFunctionThatReturnsNull;
|
1602
|
+
}
|
1603
|
+
}
|
1604
|
+
function validate(props, propName, componentName, location, propFullName) {
|
1605
|
+
var expectedTypes = [];
|
1606
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
1607
|
+
var checker = arrayOfTypeCheckers[i];
|
1608
|
+
var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
|
1609
|
+
if (checkerResult == null) {
|
1610
|
+
return null;
|
1611
|
+
}
|
1612
|
+
if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
|
1613
|
+
expectedTypes.push(checkerResult.data.expectedType);
|
1614
|
+
}
|
1615
|
+
}
|
1616
|
+
var expectedTypesMessage = expectedTypes.length > 0 ? ', expected one of type [' + expectedTypes.join(', ') + ']' : '';
|
1617
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
|
1618
|
+
}
|
1619
|
+
return createChainableTypeChecker(validate);
|
1620
|
+
}
|
1621
|
+
function createNodeChecker() {
|
1622
|
+
function validate(props, propName, componentName, location, propFullName) {
|
1623
|
+
if (!isNode(props[propName])) {
|
1624
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
1625
|
+
}
|
1626
|
+
return null;
|
1627
|
+
}
|
1628
|
+
return createChainableTypeChecker(validate);
|
1629
|
+
}
|
1630
|
+
function invalidValidatorError(componentName, location, propFullName, key, type) {
|
1631
|
+
return new PropTypeError((componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.');
|
1632
|
+
}
|
1633
|
+
function createShapeTypeChecker(shapeTypes) {
|
1634
|
+
function validate(props, propName, componentName, location, propFullName) {
|
1635
|
+
var propValue = props[propName];
|
1636
|
+
var propType = getPropType(propValue);
|
1637
|
+
if (propType !== 'object') {
|
1638
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
1639
|
+
}
|
1640
|
+
for (var key in shapeTypes) {
|
1641
|
+
var checker = shapeTypes[key];
|
1642
|
+
if (typeof checker !== 'function') {
|
1643
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
1644
|
+
}
|
1645
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
1646
|
+
if (error) {
|
1647
|
+
return error;
|
1648
|
+
}
|
1649
|
+
}
|
1650
|
+
return null;
|
1651
|
+
}
|
1652
|
+
return createChainableTypeChecker(validate);
|
1653
|
+
}
|
1654
|
+
function createStrictShapeTypeChecker(shapeTypes) {
|
1655
|
+
function validate(props, propName, componentName, location, propFullName) {
|
1656
|
+
var propValue = props[propName];
|
1657
|
+
var propType = getPropType(propValue);
|
1658
|
+
if (propType !== 'object') {
|
1659
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
1660
|
+
}
|
1661
|
+
// We need to check all keys in case some are required but missing from props.
|
1662
|
+
var allKeys = assign({}, props[propName], shapeTypes);
|
1663
|
+
for (var key in allKeys) {
|
1664
|
+
var checker = shapeTypes[key];
|
1665
|
+
if (has(shapeTypes, key) && typeof checker !== 'function') {
|
1666
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
1667
|
+
}
|
1668
|
+
if (!checker) {
|
1669
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' '));
|
1670
|
+
}
|
1671
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
1672
|
+
if (error) {
|
1673
|
+
return error;
|
1674
|
+
}
|
1675
|
+
}
|
1676
|
+
return null;
|
1677
|
+
}
|
1678
|
+
return createChainableTypeChecker(validate);
|
1679
|
+
}
|
1680
|
+
function isNode(propValue) {
|
1681
|
+
switch (_typeof(propValue)) {
|
1682
|
+
case 'number':
|
1683
|
+
case 'string':
|
1684
|
+
case 'undefined':
|
1685
|
+
return true;
|
1686
|
+
case 'boolean':
|
1687
|
+
return !propValue;
|
1688
|
+
case 'object':
|
1689
|
+
if (Array.isArray(propValue)) {
|
1690
|
+
return propValue.every(isNode);
|
1691
|
+
}
|
1692
|
+
if (propValue === null || isValidElement(propValue)) {
|
1693
|
+
return true;
|
1694
|
+
}
|
1695
|
+
var iteratorFn = getIteratorFn(propValue);
|
1696
|
+
if (iteratorFn) {
|
1697
|
+
var iterator = iteratorFn.call(propValue);
|
1698
|
+
var step;
|
1699
|
+
if (iteratorFn !== propValue.entries) {
|
1700
|
+
while (!(step = iterator.next()).done) {
|
1701
|
+
if (!isNode(step.value)) {
|
1702
|
+
return false;
|
1703
|
+
}
|
1704
|
+
}
|
1705
|
+
} else {
|
1706
|
+
// Iterator will provide entry [k,v] tuples rather than values.
|
1707
|
+
while (!(step = iterator.next()).done) {
|
1708
|
+
var entry = step.value;
|
1709
|
+
if (entry) {
|
1710
|
+
if (!isNode(entry[1])) {
|
1711
|
+
return false;
|
1712
|
+
}
|
1713
|
+
}
|
1714
|
+
}
|
1715
|
+
}
|
1716
|
+
} else {
|
1717
|
+
return false;
|
1718
|
+
}
|
1719
|
+
return true;
|
1720
|
+
default:
|
1721
|
+
return false;
|
1722
|
+
}
|
1723
|
+
}
|
1724
|
+
function isSymbol(propType, propValue) {
|
1725
|
+
// Native Symbol.
|
1726
|
+
if (propType === 'symbol') {
|
1727
|
+
return true;
|
1728
|
+
}
|
1729
|
+
|
1730
|
+
// falsy value can't be a Symbol
|
1731
|
+
if (!propValue) {
|
1732
|
+
return false;
|
1733
|
+
}
|
1734
|
+
|
1735
|
+
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
1736
|
+
if (propValue['@@toStringTag'] === 'Symbol') {
|
1737
|
+
return true;
|
1738
|
+
}
|
1739
|
+
|
1740
|
+
// Fallback for non-spec compliant Symbols which are polyfilled.
|
1741
|
+
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
1742
|
+
return true;
|
1743
|
+
}
|
1744
|
+
return false;
|
1745
|
+
}
|
1746
|
+
|
1747
|
+
// Equivalent of `typeof` but with special handling for array and regexp.
|
1748
|
+
function getPropType(propValue) {
|
1749
|
+
var propType = _typeof(propValue);
|
1750
|
+
if (Array.isArray(propValue)) {
|
1751
|
+
return 'array';
|
1752
|
+
}
|
1753
|
+
if (propValue instanceof RegExp) {
|
1754
|
+
// Old webkits (at least until Android 4.0) return 'function' rather than
|
1755
|
+
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
1756
|
+
// passes PropTypes.object.
|
1757
|
+
return 'object';
|
1758
|
+
}
|
1759
|
+
if (isSymbol(propType, propValue)) {
|
1760
|
+
return 'symbol';
|
1761
|
+
}
|
1762
|
+
return propType;
|
1763
|
+
}
|
1764
|
+
|
1765
|
+
// This handles more types than `getPropType`. Only used for error messages.
|
1766
|
+
// See `createPrimitiveTypeChecker`.
|
1767
|
+
function getPreciseType(propValue) {
|
1768
|
+
if (typeof propValue === 'undefined' || propValue === null) {
|
1769
|
+
return '' + propValue;
|
1770
|
+
}
|
1771
|
+
var propType = getPropType(propValue);
|
1772
|
+
if (propType === 'object') {
|
1773
|
+
if (propValue instanceof Date) {
|
1774
|
+
return 'date';
|
1775
|
+
} else if (propValue instanceof RegExp) {
|
1776
|
+
return 'regexp';
|
1777
|
+
}
|
1778
|
+
}
|
1779
|
+
return propType;
|
1780
|
+
}
|
1781
|
+
|
1782
|
+
// Returns a string that is postfixed to a warning about an invalid type.
|
1783
|
+
// For example, "undefined" or "of type array"
|
1784
|
+
function getPostfixForTypeWarning(value) {
|
1785
|
+
var type = getPreciseType(value);
|
1786
|
+
switch (type) {
|
1787
|
+
case 'array':
|
1788
|
+
case 'object':
|
1789
|
+
return 'an ' + type;
|
1790
|
+
case 'boolean':
|
1791
|
+
case 'date':
|
1792
|
+
case 'regexp':
|
1793
|
+
return 'a ' + type;
|
1794
|
+
default:
|
1795
|
+
return type;
|
1796
|
+
}
|
1797
|
+
}
|
1798
|
+
|
1799
|
+
// Returns class name of the object, if any.
|
1800
|
+
function getClassName(propValue) {
|
1801
|
+
if (!propValue.constructor || !propValue.constructor.name) {
|
1802
|
+
return ANONYMOUS;
|
1803
|
+
}
|
1804
|
+
return propValue.constructor.name;
|
1805
|
+
}
|
1806
|
+
ReactPropTypes.checkPropTypes = checkPropTypes;
|
1807
|
+
ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
|
1808
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
1809
|
+
return ReactPropTypes;
|
1810
|
+
};
|
1811
|
+
return factoryWithTypeCheckers;
|
1812
|
+
}
|
1813
|
+
|
1814
|
+
/**
|
1815
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
1816
|
+
*
|
1817
|
+
* This source code is licensed under the MIT license found in the
|
1818
|
+
* LICENSE file in the root directory of this source tree.
|
1819
|
+
*/
|
1820
|
+
var factoryWithThrowingShims;
|
1821
|
+
var hasRequiredFactoryWithThrowingShims;
|
1822
|
+
function requireFactoryWithThrowingShims() {
|
1823
|
+
if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
|
1824
|
+
hasRequiredFactoryWithThrowingShims = 1;
|
1825
|
+
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
1826
|
+
function emptyFunction() {}
|
1827
|
+
function emptyFunctionWithReset() {}
|
1828
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
1829
|
+
factoryWithThrowingShims = function factoryWithThrowingShims() {
|
1830
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
1831
|
+
if (secret === ReactPropTypesSecret) {
|
1832
|
+
// It is still safe when called from React.
|
1833
|
+
return;
|
1834
|
+
}
|
1835
|
+
var err = new Error('Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types');
|
1836
|
+
err.name = 'Invariant Violation';
|
1837
|
+
throw err;
|
1838
|
+
}
|
1839
|
+
shim.isRequired = shim;
|
1840
|
+
function getShim() {
|
1841
|
+
return shim;
|
1842
|
+
}
|
1843
|
+
// Important!
|
1844
|
+
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
1845
|
+
var ReactPropTypes = {
|
1846
|
+
array: shim,
|
1847
|
+
bigint: shim,
|
1848
|
+
bool: shim,
|
1849
|
+
func: shim,
|
1850
|
+
number: shim,
|
1851
|
+
object: shim,
|
1852
|
+
string: shim,
|
1853
|
+
symbol: shim,
|
1854
|
+
any: shim,
|
1855
|
+
arrayOf: getShim,
|
1856
|
+
element: shim,
|
1857
|
+
elementType: shim,
|
1858
|
+
instanceOf: getShim,
|
1859
|
+
node: shim,
|
1860
|
+
objectOf: getShim,
|
1861
|
+
oneOf: getShim,
|
1862
|
+
oneOfType: getShim,
|
1863
|
+
shape: getShim,
|
1864
|
+
exact: getShim,
|
1865
|
+
checkPropTypes: emptyFunctionWithReset,
|
1866
|
+
resetWarningCache: emptyFunction
|
1867
|
+
};
|
1868
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
1869
|
+
return ReactPropTypes;
|
1870
|
+
};
|
1871
|
+
return factoryWithThrowingShims;
|
1872
|
+
}
|
1873
|
+
|
1874
|
+
/**
|
1875
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
1876
|
+
*
|
1877
|
+
* This source code is licensed under the MIT license found in the
|
1878
|
+
* LICENSE file in the root directory of this source tree.
|
1879
|
+
*/
|
1880
|
+
if (process.env.NODE_ENV !== 'production') {
|
1881
|
+
var ReactIs = requireReactIs();
|
1882
|
+
|
1883
|
+
// By explicitly using `prop-types` you are opting into new development behavior.
|
1884
|
+
// http://fb.me/prop-types-in-prod
|
1885
|
+
var throwOnDirectAccess = true;
|
1886
|
+
propTypes.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
|
1887
|
+
} else {
|
1888
|
+
// By explicitly using `prop-types` you are opting into new production behavior.
|
1889
|
+
// http://fb.me/prop-types-in-prod
|
1890
|
+
propTypes.exports = requireFactoryWithThrowingShims()();
|
1891
|
+
}
|
1892
|
+
var propTypesExports = propTypes.exports;
|
1893
|
+
var PropTypes = /*@__PURE__*/getDefaultExportFromCjs(propTypesExports);
|
1894
|
+
|
1895
|
+
var HotTableInner = forwardRef(function (props, ref) {
|
1896
|
+
/**
|
1897
|
+
* Reference to the Handsontable instance.
|
1898
|
+
*/
|
1899
|
+
var __hotInstance = useRef(null);
|
1900
|
+
/**
|
1901
|
+
* Reference to the main Handsontable DOM element.
|
1902
|
+
*/
|
1903
|
+
var hotElementRef = useRef(null);
|
1904
|
+
/**
|
1905
|
+
* Reference to component-based editor overridden hooks object.
|
1906
|
+
*/
|
1907
|
+
var globalEditorHooksRef = useRef(null);
|
1908
|
+
/**
|
1909
|
+
* Reference to HOT-native custom editor class instance.
|
1910
|
+
*/
|
1911
|
+
var globalEditorClassInstance = useRef(null);
|
1912
|
+
/**
|
1913
|
+
* Reference to the previous props object.
|
1914
|
+
*/
|
1915
|
+
var prevProps = useRef();
|
1916
|
+
/**
|
1917
|
+
* HotTable context exposing helper functions.
|
1918
|
+
*/
|
1919
|
+
var context = useHotTableContext();
|
1920
|
+
/**
|
1921
|
+
* Getter for the property storing the Handsontable instance.
|
1922
|
+
*/
|
1923
|
+
var getHotInstance = useCallback(function () {
|
1924
|
+
if (!__hotInstance.current || !__hotInstance.current.isDestroyed) {
|
1925
|
+
// Will return the Handsontable instance or `null` if it's not yet been created.
|
1926
|
+
return __hotInstance.current;
|
1927
|
+
} else {
|
1928
|
+
console.warn(HOT_DESTROYED_WARNING);
|
1929
|
+
return null;
|
1930
|
+
}
|
1931
|
+
}, [__hotInstance]);
|
1932
|
+
var isHotInstanceDestroyed = useCallback(function () {
|
1933
|
+
return !__hotInstance.current || __hotInstance.current.isDestroyed;
|
1934
|
+
}, [__hotInstance]);
|
1935
|
+
/**
|
1936
|
+
* Clear both the editor and the renderer cache.
|
1937
|
+
*/
|
1938
|
+
var clearCache = useCallback(function () {
|
1939
|
+
context.clearRenderedCellCache();
|
1940
|
+
context.componentRendererColumns.clear();
|
1941
|
+
}, [context]);
|
1942
|
+
/**
|
1943
|
+
* Get the `Document` object corresponding to the main component element.
|
1944
|
+
*
|
1945
|
+
* @returns The `Document` object used by the component.
|
1946
|
+
*/
|
1947
|
+
var getOwnerDocument = useCallback(function () {
|
1948
|
+
if (isCSR()) {
|
1949
|
+
return hotElementRef.current ? hotElementRef.current.ownerDocument : document;
|
1950
|
+
}
|
1951
|
+
return null;
|
1952
|
+
}, [hotElementRef]);
|
1953
|
+
/**
|
1954
|
+
* Create a new settings object containing the column settings and global editors and renderers.
|
1955
|
+
*
|
1956
|
+
* @returns {Handsontable.GridSettings} New global set of settings for Handsontable.
|
1957
|
+
*/
|
1958
|
+
var createNewGlobalSettings = function createNewGlobalSettings() {
|
1959
|
+
var _getHotInstance;
|
1960
|
+
var init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
1961
|
+
var prevProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
1962
|
+
var initOnlySettingKeys = !isHotInstanceDestroyed() ?
|
1963
|
+
// Needed for React's double-rendering.
|
1964
|
+
((_getHotInstance = getHotInstance()) === null || _getHotInstance === void 0 || (_getHotInstance = _getHotInstance.getSettings()) === null || _getHotInstance === void 0 ? void 0 : _getHotInstance._initOnlySettings) || [] : [];
|
1965
|
+
var newSettings = SettingsMapper.getSettings(props, {
|
1966
|
+
prevProps: prevProps,
|
1967
|
+
isInit: init,
|
1968
|
+
initOnlySettingKeys: initOnlySettingKeys
|
1969
|
+
});
|
1970
|
+
newSettings.columns = context.columnsSettings.length ? context.columnsSettings : newSettings.columns;
|
1971
|
+
if (props.renderer) {
|
1972
|
+
newSettings.renderer = context.getRendererWrapper(props.renderer);
|
1973
|
+
context.componentRendererColumns.set('global', true);
|
1974
|
+
} else {
|
1975
|
+
newSettings.renderer = props.hotRenderer || getRenderer('text');
|
1976
|
+
}
|
1977
|
+
if (props.editor) {
|
1978
|
+
newSettings.editor = makeEditorClass(globalEditorHooksRef, globalEditorClassInstance);
|
1979
|
+
} else {
|
1980
|
+
newSettings.editor = props.hotEditor || getEditor('text');
|
1981
|
+
}
|
1982
|
+
return newSettings;
|
1983
|
+
};
|
1984
|
+
/**
|
1985
|
+
* Detect if `autoRowSize` or `autoColumnSize` is defined, and if so, throw an incompatibility warning.
|
1986
|
+
*/
|
1987
|
+
var displayAutoSizeWarning = function displayAutoSizeWarning(hotInstance) {
|
1988
|
+
var _hotInstance$getPlugi, _hotInstance$getPlugi2;
|
1989
|
+
if (hotInstance && ((_hotInstance$getPlugi = hotInstance.getPlugin('autoRowSize')) !== null && _hotInstance$getPlugi !== void 0 && _hotInstance$getPlugi.enabled || (_hotInstance$getPlugi2 = hotInstance.getPlugin('autoColumnSize')) !== null && _hotInstance$getPlugi2 !== void 0 && _hotInstance$getPlugi2.enabled)) {
|
1990
|
+
if (context.componentRendererColumns.size > 0) {
|
1991
|
+
warn(AUTOSIZE_WARNING);
|
1992
|
+
}
|
1993
|
+
}
|
1994
|
+
};
|
1995
|
+
/**
|
1996
|
+
* Initialize Handsontable after the component has mounted.
|
1997
|
+
*/
|
1998
|
+
useEffect(function () {
|
1999
|
+
var newGlobalSettings = createNewGlobalSettings(true);
|
2000
|
+
// Update prevProps with the current props
|
2001
|
+
prevProps.current = props;
|
2002
|
+
__hotInstance.current = new Handsontable.Core(hotElementRef.current, newGlobalSettings);
|
2003
|
+
/**
|
2004
|
+
* Handsontable's `beforeViewRender` hook callback.
|
2005
|
+
*/
|
2006
|
+
__hotInstance.current.addHook('beforeViewRender', function () {
|
2007
|
+
context.clearPortalCache();
|
2008
|
+
context.clearRenderedCellCache();
|
2009
|
+
});
|
2010
|
+
/**
|
2011
|
+
* Handsontable's `afterViewRender` hook callback.
|
2012
|
+
*/
|
2013
|
+
__hotInstance.current.addHook('afterViewRender', function () {
|
2014
|
+
context.pushCellPortalsIntoPortalManager();
|
2015
|
+
});
|
2016
|
+
__hotInstance.current.init();
|
2017
|
+
displayAutoSizeWarning(__hotInstance.current);
|
2018
|
+
if (!displayObsoleteRenderersEditorsWarning(props.children)) {
|
2019
|
+
displayChildrenOfTypeWarning(props.children, HotColumn);
|
2020
|
+
}
|
2021
|
+
/**
|
2022
|
+
* Destroy the Handsontable instance when the parent component unmounts.
|
2023
|
+
*/
|
2024
|
+
return function () {
|
2025
|
+
var _getHotInstance2;
|
2026
|
+
clearCache();
|
2027
|
+
(_getHotInstance2 = getHotInstance()) === null || _getHotInstance2 === void 0 || _getHotInstance2.destroy();
|
2028
|
+
};
|
2029
|
+
}, []);
|
2030
|
+
/**
|
2031
|
+
* Logic performed after the component update.
|
2032
|
+
*/
|
2033
|
+
useUpdateEffect(function () {
|
2034
|
+
clearCache();
|
2035
|
+
var hotInstance = getHotInstance();
|
2036
|
+
var newGlobalSettings = createNewGlobalSettings(false, prevProps.current);
|
2037
|
+
// Update prevProps with the current props
|
2038
|
+
prevProps.current = props;
|
2039
|
+
hotInstance === null || hotInstance === void 0 || hotInstance.updateSettings(newGlobalSettings, false);
|
2040
|
+
displayAutoSizeWarning(hotInstance);
|
2041
|
+
displayObsoleteRenderersEditorsWarning(props.children);
|
2042
|
+
});
|
2043
|
+
/**
|
2044
|
+
* Interface exposed to parent components by HotTable instance via React ref
|
2045
|
+
*/
|
2046
|
+
useImperativeHandle(ref, function () {
|
2047
|
+
return {
|
2048
|
+
get hotElementRef() {
|
2049
|
+
return hotElementRef.current;
|
2050
|
+
},
|
2051
|
+
get hotInstance() {
|
2052
|
+
return getHotInstance();
|
2053
|
+
}
|
2054
|
+
};
|
2055
|
+
});
|
2056
|
+
/**
|
2057
|
+
* Render the component.
|
2058
|
+
*/
|
2059
|
+
var hotColumnWrapped = Children.toArray(props.children).filter(isHotColumn).map(function (childNode, columnIndex) {
|
2060
|
+
return React.createElement(HotColumnContextProvider, {
|
2061
|
+
columnIndex: columnIndex,
|
2062
|
+
getOwnerDocument: getOwnerDocument,
|
2063
|
+
key: columnIndex
|
2064
|
+
}, childNode);
|
2065
|
+
});
|
2066
|
+
var containerProps = getContainerAttributesProps(props);
|
2067
|
+
var editorPortal = createEditorPortal(getOwnerDocument(), props.editor);
|
2068
|
+
return React.createElement(Fragment, null, React.createElement("div", Object.assign({
|
2069
|
+
ref: hotElementRef
|
2070
|
+
}, containerProps), hotColumnWrapped), React.createElement(RenderersPortalManager, {
|
2071
|
+
ref: context.setRenderersPortalManagerRef
|
2072
|
+
}), React.createElement(EditorContextProvider, {
|
2073
|
+
hooksRef: globalEditorHooksRef,
|
2074
|
+
hotCustomEditorInstanceRef: globalEditorClassInstance
|
2075
|
+
}, editorPortal));
|
2076
|
+
});
|
2077
|
+
/**
|
2078
|
+
* Prop types to be checked at runtime.
|
2079
|
+
*/
|
2080
|
+
HotTableInner.propTypes = {
|
2081
|
+
style: PropTypes.object,
|
2082
|
+
id: PropTypes.string,
|
2083
|
+
className: PropTypes.string
|
2084
|
+
};
|
2085
|
+
|
2086
|
+
var _excluded = ["children"];
|
2087
|
+
/**
|
2088
|
+
* A Handsontable-ReactJS wrapper.
|
2089
|
+
*
|
2090
|
+
* To implement, use the `HotTable` tag with properties corresponding to Handsontable options.
|
2091
|
+
* For example:
|
2092
|
+
*
|
2093
|
+
* ```js
|
2094
|
+
* <HotTable id="hot" data={dataObject} contextMenu={true} colHeaders={true} width={600} height={300} stretchH="all" />
|
2095
|
+
*
|
2096
|
+
* // is analogous to
|
2097
|
+
* let hot = new Handsontable(document.getElementById('hot'), {
|
2098
|
+
* data: dataObject,
|
2099
|
+
* contextMenu: true,
|
2100
|
+
* colHeaders: true,
|
2101
|
+
* width: 600
|
2102
|
+
* height: 300
|
2103
|
+
* });
|
2104
|
+
*
|
2105
|
+
* ```
|
2106
|
+
*/
|
2107
|
+
var HotTable = forwardRef(function (_ref, ref) {
|
2108
|
+
var _props$id;
|
2109
|
+
var children = _ref.children,
|
2110
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
2111
|
+
var componentId = (_props$id = props.id) !== null && _props$id !== void 0 ? _props$id : useId();
|
2112
|
+
return React.createElement(HotTableContextProvider, null, React.createElement(HotTableInner, Object.assign({
|
2113
|
+
id: componentId
|
2114
|
+
}, props, {
|
2115
|
+
ref: ref
|
2116
|
+
}), children));
|
2117
|
+
});
|
2118
|
+
/**
|
2119
|
+
* Package version.
|
2120
|
+
*
|
2121
|
+
* @returns The version number of the package.
|
2122
|
+
*/
|
2123
|
+
HotTable.version = version;
|
2124
|
+
|
2125
|
+
export { HotColumn, HotTable, HotTable as default, isHotColumn, useHotEditor };
|