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