@handsontable/react 0.0.0-next-9ec04ce-20221121

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2514 @@
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
+
9
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
+
11
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
12
+ var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
13
+ var Handsontable__default = /*#__PURE__*/_interopDefaultLegacy(Handsontable);
14
+
15
+ function ownKeys(object, enumerableOnly) {
16
+ var keys = Object.keys(object);
17
+ if (Object.getOwnPropertySymbols) {
18
+ var symbols = Object.getOwnPropertySymbols(object);
19
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
20
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
21
+ })), keys.push.apply(keys, symbols);
22
+ }
23
+ return keys;
24
+ }
25
+ function _objectSpread2(target) {
26
+ for (var i = 1; i < arguments.length; i++) {
27
+ var source = null != arguments[i] ? arguments[i] : {};
28
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
29
+ _defineProperty(target, key, source[key]);
30
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
31
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
32
+ });
33
+ }
34
+ return target;
35
+ }
36
+ function _typeof(obj) {
37
+ "@babel/helpers - typeof";
38
+
39
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
40
+ return typeof obj;
41
+ } : function (obj) {
42
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
43
+ }, _typeof(obj);
44
+ }
45
+ function _classCallCheck(instance, Constructor) {
46
+ if (!(instance instanceof Constructor)) {
47
+ throw new TypeError("Cannot call a class as a function");
48
+ }
49
+ }
50
+ function _defineProperties(target, props) {
51
+ for (var i = 0; i < props.length; i++) {
52
+ var descriptor = props[i];
53
+ descriptor.enumerable = descriptor.enumerable || false;
54
+ descriptor.configurable = true;
55
+ if ("value" in descriptor) descriptor.writable = true;
56
+ Object.defineProperty(target, descriptor.key, descriptor);
57
+ }
58
+ }
59
+ function _createClass(Constructor, protoProps, staticProps) {
60
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
61
+ if (staticProps) _defineProperties(Constructor, staticProps);
62
+ Object.defineProperty(Constructor, "prototype", {
63
+ writable: false
64
+ });
65
+ return Constructor;
66
+ }
67
+ function _defineProperty(obj, key, value) {
68
+ if (key in obj) {
69
+ Object.defineProperty(obj, key, {
70
+ value: value,
71
+ enumerable: true,
72
+ configurable: true,
73
+ writable: true
74
+ });
75
+ } else {
76
+ obj[key] = value;
77
+ }
78
+ return obj;
79
+ }
80
+ function _inherits(subClass, superClass) {
81
+ if (typeof superClass !== "function" && superClass !== null) {
82
+ throw new TypeError("Super expression must either be null or a function");
83
+ }
84
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
85
+ constructor: {
86
+ value: subClass,
87
+ writable: true,
88
+ configurable: true
89
+ }
90
+ });
91
+ Object.defineProperty(subClass, "prototype", {
92
+ writable: false
93
+ });
94
+ if (superClass) _setPrototypeOf(subClass, superClass);
95
+ }
96
+ function _getPrototypeOf(o) {
97
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
98
+ return o.__proto__ || Object.getPrototypeOf(o);
99
+ };
100
+ return _getPrototypeOf(o);
101
+ }
102
+ function _setPrototypeOf(o, p) {
103
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
104
+ o.__proto__ = p;
105
+ return o;
106
+ };
107
+ return _setPrototypeOf(o, p);
108
+ }
109
+ function _isNativeReflectConstruct() {
110
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
111
+ if (Reflect.construct.sham) return false;
112
+ if (typeof Proxy === "function") return true;
113
+ try {
114
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
115
+ return true;
116
+ } catch (e) {
117
+ return false;
118
+ }
119
+ }
120
+ function _assertThisInitialized(self) {
121
+ if (self === void 0) {
122
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
123
+ }
124
+ return self;
125
+ }
126
+ function _possibleConstructorReturn(self, call) {
127
+ if (call && (typeof call === "object" || typeof call === "function")) {
128
+ return call;
129
+ } else if (call !== void 0) {
130
+ throw new TypeError("Derived constructors may only return object or undefined");
131
+ }
132
+ return _assertThisInitialized(self);
133
+ }
134
+ function _createSuper(Derived) {
135
+ var hasNativeReflectConstruct = _isNativeReflectConstruct();
136
+ return function _createSuperInternal() {
137
+ var Super = _getPrototypeOf(Derived),
138
+ result;
139
+ if (hasNativeReflectConstruct) {
140
+ var NewTarget = _getPrototypeOf(this).constructor;
141
+ result = Reflect.construct(Super, arguments, NewTarget);
142
+ } else {
143
+ result = Super.apply(this, arguments);
144
+ }
145
+ return _possibleConstructorReturn(this, result);
146
+ };
147
+ }
148
+
149
+ var bulkComponentContainer = null;
150
+ /**
151
+ * Warning message for the `autoRowSize`/`autoColumnSize` compatibility check.
152
+ */
153
+ 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.';
154
+ /**
155
+ * Message for the warning thrown if the Handsontable instance has been destroyed.
156
+ */
157
+ var HOT_DESTROYED_WARNING = 'The Handsontable instance bound to this component was destroyed and cannot be' + ' used properly.';
158
+ /**
159
+ * String identifier for the global-scoped editor components.
160
+ */
161
+ var GLOBAL_EDITOR_SCOPE = 'global';
162
+ /**
163
+ * Default classname given to the wrapper container.
164
+ */
165
+ var DEFAULT_CLASSNAME = 'hot-wrapper-editor-container';
166
+ /**
167
+ * Logs warn to the console if the `console` object is exposed.
168
+ *
169
+ * @param {...*} args Values which will be logged.
170
+ */
171
+ function warn() {
172
+ if (typeof console !== 'undefined') {
173
+ var _console;
174
+ (_console = console).warn.apply(_console, arguments);
175
+ }
176
+ }
177
+ /**
178
+ * Filter out and return elements of the provided `type` from the `HotColumn` component's children.
179
+ *
180
+ * @param {React.ReactNode} children HotTable children array.
181
+ * @param {String} type Either `'hot-renderer'` or `'hot-editor'`.
182
+ * @returns {Object|null} A child (React node) or `null`, if no child of that type was found.
183
+ */
184
+ function getChildElementByType(children, type) {
185
+ var childrenArray = React__default["default"].Children.toArray(children);
186
+ var childrenCount = React__default["default"].Children.count(children);
187
+ var wantedChild = null;
188
+ if (childrenCount !== 0) {
189
+ if (childrenCount === 1 && childrenArray[0].props[type]) {
190
+ wantedChild = childrenArray[0];
191
+ } else {
192
+ wantedChild = childrenArray.find(function (child) {
193
+ return child.props[type] !== void 0;
194
+ });
195
+ }
196
+ }
197
+ return wantedChild || null;
198
+ }
199
+ /**
200
+ * Get the reference to the original editor class.
201
+ *
202
+ * @param {React.ReactElement} editorElement React element of the editor class.
203
+ * @returns {Function} Original class of the editor component.
204
+ */
205
+ function getOriginalEditorClass(editorElement) {
206
+ if (!editorElement) {
207
+ return null;
208
+ }
209
+ return editorElement.type.WrappedComponent ? editorElement.type.WrappedComponent : editorElement.type;
210
+ }
211
+ /**
212
+ * Remove editor containers from DOM.
213
+ *
214
+ * @param {Document} [doc] Document to be used.
215
+ * @param {Map} editorCache The editor cache reference.
216
+ */
217
+ function removeEditorContainers() {
218
+ var doc = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
219
+ doc.querySelectorAll("[class^=\"".concat(DEFAULT_CLASSNAME, "\"]")).forEach(function (domNode) {
220
+ if (domNode.parentNode) {
221
+ domNode.parentNode.removeChild(domNode);
222
+ }
223
+ });
224
+ }
225
+ /**
226
+ * Create an editor portal.
227
+ *
228
+ * @param {Document} [doc] Document to be used.
229
+ * @param {React.ReactElement} editorElement Editor's element.
230
+ * @param {Map} editorCache The editor cache reference.
231
+ * @returns {React.ReactPortal} The portal for the editor.
232
+ */
233
+ function createEditorPortal() {
234
+ var doc = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
235
+ var editorElement = arguments.length > 1 ? arguments[1] : undefined;
236
+ if (editorElement === null) {
237
+ return;
238
+ }
239
+ var editorContainer = doc.createElement('DIV');
240
+ var _getContainerAttribut = getContainerAttributesProps(editorElement.props, false),
241
+ id = _getContainerAttribut.id,
242
+ className = _getContainerAttribut.className,
243
+ style = _getContainerAttribut.style;
244
+ if (id) {
245
+ editorContainer.id = id;
246
+ }
247
+ editorContainer.className = [DEFAULT_CLASSNAME, className].join(' ');
248
+ if (style) {
249
+ Object.assign(editorContainer.style, style);
250
+ }
251
+ doc.body.appendChild(editorContainer);
252
+ return ReactDOM__default["default"].createPortal(editorElement, editorContainer);
253
+ }
254
+ /**
255
+ * Get an editor element extended with a instance-emitting method.
256
+ *
257
+ * @param {React.ReactNode} children Component children.
258
+ * @param {Map} editorCache Component's editor cache.
259
+ * @param {string|number} [editorColumnScope] The editor scope (column index or a 'global' string). Defaults to
260
+ * 'global'.
261
+ * @returns {React.ReactElement} An editor element containing the additional methods.
262
+ */
263
+ function getExtendedEditorElement(children, editorCache) {
264
+ var editorColumnScope = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : GLOBAL_EDITOR_SCOPE;
265
+ var editorElement = getChildElementByType(children, 'hot-editor');
266
+ var editorClass = getOriginalEditorClass(editorElement);
267
+ if (!editorElement) {
268
+ return null;
269
+ }
270
+ return React__default["default"].cloneElement(editorElement, {
271
+ emitEditorInstance: function emitEditorInstance(editorInstance, editorColumnScope) {
272
+ if (!editorCache.get(editorClass)) {
273
+ editorCache.set(editorClass, new Map());
274
+ }
275
+ var cacheEntry = editorCache.get(editorClass);
276
+ cacheEntry.set(editorColumnScope !== null && editorColumnScope !== void 0 ? editorColumnScope : GLOBAL_EDITOR_SCOPE, editorInstance);
277
+ },
278
+ editorColumnScope: editorColumnScope,
279
+ isEditor: true
280
+ });
281
+ }
282
+ /**
283
+ * Create a react component and render it to an external DOM done.
284
+ *
285
+ * @param {React.ReactElement} rElement React element to be used as a base for the component.
286
+ * @param {Object} props Props to be passed to the cloned element.
287
+ * @param {Function} callback Callback to be called after the component has been mounted.
288
+ * @param {Document} [ownerDocument] The owner document to set the portal up into.
289
+ * @returns {{portal: React.ReactPortal, portalContainer: HTMLElement}} An object containing the portal and its container.
290
+ */
291
+ function createPortal(rElement, props, callback) {
292
+ var ownerDocument = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : document;
293
+ if (!ownerDocument) {
294
+ ownerDocument = document;
295
+ }
296
+ if (!bulkComponentContainer) {
297
+ bulkComponentContainer = ownerDocument.createDocumentFragment();
298
+ }
299
+ var portalContainer = ownerDocument.createElement('DIV');
300
+ bulkComponentContainer.appendChild(portalContainer);
301
+ var extendedRendererElement = React__default["default"].cloneElement(rElement, _objectSpread2({
302
+ key: "".concat(props.row, "-").concat(props.col)
303
+ }, props));
304
+ return {
305
+ portal: ReactDOM__default["default"].createPortal(extendedRendererElement, portalContainer, "".concat(props.row, "-").concat(props.col, "-").concat(Math.random())),
306
+ portalContainer: portalContainer
307
+ };
308
+ }
309
+ /**
310
+ * Get an object containing the `id`, `className` and `style` keys, representing the corresponding props passed to the
311
+ * component.
312
+ *
313
+ * @param {Object} props Object containing the react element props.
314
+ * @param {Boolean} randomizeId If set to `true`, the function will randomize the `id` property when no `id` was present in the `prop` object.
315
+ * @returns An object containing the `id`, `className` and `style` keys, representing the corresponding props passed to the
316
+ * component.
317
+ */
318
+ function getContainerAttributesProps(props) {
319
+ var randomizeId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
320
+ return {
321
+ id: props.id || (randomizeId ? 'hot-' + Math.random().toString(36).substring(5) : void 0),
322
+ className: props.className || '',
323
+ style: props.style || {}
324
+ };
325
+ }
326
+ /**
327
+ * Add the `UNSAFE_` prefixes to the deprecated lifecycle methods for React >= 16.3.
328
+ *
329
+ * @param {Object} instance Instance to have the methods renamed.
330
+ */
331
+ function addUnsafePrefixes(instance) {
332
+ var reactSemverArray = React__default["default"].version.split('.').map(function (v) {
333
+ return parseInt(v);
334
+ });
335
+ var shouldPrefix = reactSemverArray[0] >= 16 && reactSemverArray[1] >= 3 || reactSemverArray[0] >= 17;
336
+ if (shouldPrefix) {
337
+ instance.UNSAFE_componentWillUpdate = instance.componentWillUpdate;
338
+ instance.componentWillUpdate = void 0;
339
+ instance.UNSAFE_componentWillMount = instance.componentWillMount;
340
+ instance.componentWillMount = void 0;
341
+ }
342
+ }
343
+
344
+ var SettingsMapper = /*#__PURE__*/function () {
345
+ function SettingsMapper() {
346
+ _classCallCheck(this, SettingsMapper);
347
+ }
348
+ _createClass(SettingsMapper, null, [{
349
+ key: "getSettings",
350
+ value:
351
+ /**
352
+ * Parse component settings into Handosntable-compatible settings.
353
+ *
354
+ * @param {Object} properties Object containing properties from the HotTable object.
355
+ * @returns {Object} Handsontable-compatible settings object.
356
+ */
357
+ function getSettings(properties) {
358
+ var newSettings = {};
359
+ if (properties.settings) {
360
+ var settings = properties.settings;
361
+ for (var key in settings) {
362
+ if (settings.hasOwnProperty(key)) {
363
+ newSettings[key] = settings[key];
364
+ }
365
+ }
366
+ }
367
+ for (var _key in properties) {
368
+ if (_key !== 'settings' && _key !== 'children' && properties.hasOwnProperty(_key)) {
369
+ newSettings[_key] = properties[_key];
370
+ }
371
+ }
372
+ return newSettings;
373
+ }
374
+ }]);
375
+ return SettingsMapper;
376
+ }();
377
+
378
+ var HotColumn = /*#__PURE__*/function (_React$Component) {
379
+ _inherits(HotColumn, _React$Component);
380
+ var _super = _createSuper(HotColumn);
381
+ /**
382
+ * HotColumn class constructor.
383
+ *
384
+ * @param {HotColumnProps} props Component props.
385
+ * @param {*} [context] Component context.
386
+ */
387
+ function HotColumn(props, context) {
388
+ var _this;
389
+ _classCallCheck(this, HotColumn);
390
+ _this = _super.call(this, props, context);
391
+ /**
392
+ * Local editor portal cache.
393
+ *
394
+ * @private
395
+ * @type {ReactPortal}
396
+ */
397
+ _this.localEditorPortal = null;
398
+ addUnsafePrefixes(_assertThisInitialized(_this));
399
+ return _this;
400
+ }
401
+ /**
402
+ * Get the local editor portal cache property.
403
+ *
404
+ * @return {ReactPortal} Local editor portal.
405
+ */
406
+ _createClass(HotColumn, [{
407
+ key: "getLocalEditorPortal",
408
+ value: function getLocalEditorPortal() {
409
+ return this.localEditorPortal;
410
+ }
411
+ /**
412
+ * Set the local editor portal cache property.
413
+ *
414
+ * @param {ReactPortal} portal Local editor portal.
415
+ */
416
+ }, {
417
+ key: "setLocalEditorPortal",
418
+ value: function setLocalEditorPortal(portal) {
419
+ this.localEditorPortal = portal;
420
+ }
421
+ /**
422
+ * Filter out all the internal properties and return an object with just the Handsontable-related props.
423
+ *
424
+ * @returns {Object}
425
+ */
426
+ }, {
427
+ key: "getSettingsProps",
428
+ value: function getSettingsProps() {
429
+ var _this2 = this;
430
+ this.internalProps = ['__componentRendererColumns', '_emitColumnSettings', '_columnIndex', '_getChildElementByType', '_getRendererWrapper', '_getEditorClass', '_getEditorCache', '_getOwnerDocument', 'hot-renderer', 'hot-editor', 'children'];
431
+ return Object.keys(this.props).filter(function (key) {
432
+ return !_this2.internalProps.includes(key);
433
+ }).reduce(function (obj, key) {
434
+ obj[key] = _this2.props[key];
435
+ return obj;
436
+ }, {});
437
+ }
438
+ /**
439
+ * Get the editor element for the current column.
440
+ *
441
+ * @returns {React.ReactElement} React editor component element.
442
+ */
443
+ }, {
444
+ key: "getLocalEditorElement",
445
+ value: function getLocalEditorElement() {
446
+ return getExtendedEditorElement(this.props.children, this.props._getEditorCache(), this.props._columnIndex);
447
+ }
448
+ /**
449
+ * Create the column settings based on the data provided to the `HotColumn` component and it's child components.
450
+ */
451
+ }, {
452
+ key: "createColumnSettings",
453
+ value: function createColumnSettings() {
454
+ var rendererElement = this.props._getChildElementByType(this.props.children, 'hot-renderer');
455
+ var editorElement = this.getLocalEditorElement();
456
+ this.columnSettings = SettingsMapper.getSettings(this.getSettingsProps());
457
+ if (rendererElement !== null) {
458
+ this.columnSettings.renderer = this.props._getRendererWrapper(rendererElement);
459
+ this.props._componentRendererColumns.set(this.props._columnIndex, true);
460
+ }
461
+ if (editorElement !== null) {
462
+ this.columnSettings.editor = this.props._getEditorClass(editorElement, this.props._columnIndex);
463
+ }
464
+ }
465
+ /**
466
+ * Create the local editor portal and its destination HTML element if needed.
467
+ *
468
+ * @param {React.ReactNode} [children] Children of the HotTable instance. Defaults to `this.props.children`.
469
+ */
470
+ }, {
471
+ key: "createLocalEditorPortal",
472
+ value: function createLocalEditorPortal() {
473
+ var children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props.children;
474
+ var editorCache = this.props._getEditorCache();
475
+ var localEditorElement = getExtendedEditorElement(children, editorCache, this.props._columnIndex);
476
+ if (localEditorElement) {
477
+ this.setLocalEditorPortal(createEditorPortal(this.props._getOwnerDocument(), localEditorElement, editorCache));
478
+ }
479
+ }
480
+ /**
481
+ * Emit the column settings to the parent using a prop passed from the parent.
482
+ */
483
+ }, {
484
+ key: "emitColumnSettings",
485
+ value: function emitColumnSettings() {
486
+ this.props._emitColumnSettings(this.columnSettings, this.props._columnIndex);
487
+ }
488
+ /*
489
+ ---------------------------------------
490
+ ------- React lifecycle methods -------
491
+ ---------------------------------------
492
+ */
493
+ /**
494
+ * Logic performed before the mounting of the HotColumn component.
495
+ */
496
+ }, {
497
+ key: "componentWillMount",
498
+ value: function componentWillMount() {
499
+ this.createLocalEditorPortal();
500
+ }
501
+ /**
502
+ * Logic performed after the mounting of the HotColumn component.
503
+ */
504
+ }, {
505
+ key: "componentDidMount",
506
+ value: function componentDidMount() {
507
+ this.createColumnSettings();
508
+ this.emitColumnSettings();
509
+ }
510
+ /**
511
+ * Logic performed before the updating of the HotColumn component.
512
+ */
513
+ }, {
514
+ key: "componentWillUpdate",
515
+ value: function componentWillUpdate(nextProps, nextState, nextContext) {
516
+ this.createLocalEditorPortal(nextProps.children);
517
+ }
518
+ /**
519
+ * Logic performed after the updating of the HotColumn component.
520
+ */
521
+ }, {
522
+ key: "componentDidUpdate",
523
+ value: function componentDidUpdate() {
524
+ this.createColumnSettings();
525
+ this.emitColumnSettings();
526
+ }
527
+ /**
528
+ * Render the portals of the editors, if there are any.
529
+ *
530
+ * @returns {React.ReactElement}
531
+ */
532
+ }, {
533
+ key: "render",
534
+ value: function render() {
535
+ return React__default["default"].createElement(React__default["default"].Fragment, null, this.getLocalEditorPortal());
536
+ }
537
+ }]);
538
+ return HotColumn;
539
+ }(React__default["default"].Component);
540
+
541
+ /**
542
+ * Component class used to manage the renderer component portals.
543
+ */
544
+ var PortalManager = /*#__PURE__*/function (_React$Component) {
545
+ _inherits(PortalManager, _React$Component);
546
+ var _super = _createSuper(PortalManager);
547
+ function PortalManager(props) {
548
+ var _this;
549
+ _classCallCheck(this, PortalManager);
550
+ _this = _super.call(this, props);
551
+ _this.state = {
552
+ portals: []
553
+ };
554
+ return _this;
555
+ }
556
+ _createClass(PortalManager, [{
557
+ key: "render",
558
+ value: function render() {
559
+ return React__default["default"].createElement(React__default["default"].Fragment, null, this.state.portals);
560
+ }
561
+ }]);
562
+ return PortalManager;
563
+ }(React__default["default"].Component);
564
+
565
+ var version="0.0.0-next-9ec04ce-20221121";
566
+
567
+ function createCommonjsModule(fn, module) {
568
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
569
+ }
570
+
571
+ /** @license React v16.13.1
572
+ * react-is.production.min.js
573
+ *
574
+ * Copyright (c) Facebook, Inc. and its affiliates.
575
+ *
576
+ * This source code is licensed under the MIT license found in the
577
+ * LICENSE file in the root directory of this source tree.
578
+ */
579
+ var b = "function" === typeof Symbol && Symbol["for"],
580
+ c = b ? Symbol["for"]("react.element") : 60103,
581
+ d = b ? Symbol["for"]("react.portal") : 60106,
582
+ e = b ? Symbol["for"]("react.fragment") : 60107,
583
+ f = b ? Symbol["for"]("react.strict_mode") : 60108,
584
+ g = b ? Symbol["for"]("react.profiler") : 60114,
585
+ h = b ? Symbol["for"]("react.provider") : 60109,
586
+ k = b ? Symbol["for"]("react.context") : 60110,
587
+ l = b ? Symbol["for"]("react.async_mode") : 60111,
588
+ m = b ? Symbol["for"]("react.concurrent_mode") : 60111,
589
+ n = b ? Symbol["for"]("react.forward_ref") : 60112,
590
+ p = b ? Symbol["for"]("react.suspense") : 60113,
591
+ q = b ? Symbol["for"]("react.suspense_list") : 60120,
592
+ r = b ? Symbol["for"]("react.memo") : 60115,
593
+ t = b ? Symbol["for"]("react.lazy") : 60116,
594
+ v = b ? Symbol["for"]("react.block") : 60121,
595
+ w = b ? Symbol["for"]("react.fundamental") : 60117,
596
+ x = b ? Symbol["for"]("react.responder") : 60118,
597
+ y = b ? Symbol["for"]("react.scope") : 60119;
598
+ function z(a) {
599
+ if ("object" === _typeof(a) && null !== a) {
600
+ var u = a.$$typeof;
601
+ switch (u) {
602
+ case c:
603
+ switch (a = a.type, a) {
604
+ case l:
605
+ case m:
606
+ case e:
607
+ case g:
608
+ case f:
609
+ case p:
610
+ return a;
611
+ default:
612
+ switch (a = a && a.$$typeof, a) {
613
+ case k:
614
+ case n:
615
+ case t:
616
+ case r:
617
+ case h:
618
+ return a;
619
+ default:
620
+ return u;
621
+ }
622
+ }
623
+ case d:
624
+ return u;
625
+ }
626
+ }
627
+ }
628
+ function A(a) {
629
+ return z(a) === m;
630
+ }
631
+ var AsyncMode = l;
632
+ var ConcurrentMode = m;
633
+ var ContextConsumer = k;
634
+ var ContextProvider = h;
635
+ var Element = c;
636
+ var ForwardRef = n;
637
+ var Fragment = e;
638
+ var Lazy = t;
639
+ var Memo = r;
640
+ var Portal = d;
641
+ var Profiler = g;
642
+ var StrictMode = f;
643
+ var Suspense = p;
644
+ var isAsyncMode = function isAsyncMode(a) {
645
+ return A(a) || z(a) === l;
646
+ };
647
+ var isConcurrentMode = A;
648
+ var isContextConsumer = function isContextConsumer(a) {
649
+ return z(a) === k;
650
+ };
651
+ var isContextProvider = function isContextProvider(a) {
652
+ return z(a) === h;
653
+ };
654
+ var isElement = function isElement(a) {
655
+ return "object" === _typeof(a) && null !== a && a.$$typeof === c;
656
+ };
657
+ var isForwardRef = function isForwardRef(a) {
658
+ return z(a) === n;
659
+ };
660
+ var isFragment = function isFragment(a) {
661
+ return z(a) === e;
662
+ };
663
+ var isLazy = function isLazy(a) {
664
+ return z(a) === t;
665
+ };
666
+ var isMemo = function isMemo(a) {
667
+ return z(a) === r;
668
+ };
669
+ var isPortal = function isPortal(a) {
670
+ return z(a) === d;
671
+ };
672
+ var isProfiler = function isProfiler(a) {
673
+ return z(a) === g;
674
+ };
675
+ var isStrictMode = function isStrictMode(a) {
676
+ return z(a) === f;
677
+ };
678
+ var isSuspense = function isSuspense(a) {
679
+ return z(a) === p;
680
+ };
681
+ var isValidElementType = function isValidElementType(a) {
682
+ 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);
683
+ };
684
+ var typeOf = z;
685
+ var reactIs_production_min = {
686
+ AsyncMode: AsyncMode,
687
+ ConcurrentMode: ConcurrentMode,
688
+ ContextConsumer: ContextConsumer,
689
+ ContextProvider: ContextProvider,
690
+ Element: Element,
691
+ ForwardRef: ForwardRef,
692
+ Fragment: Fragment,
693
+ Lazy: Lazy,
694
+ Memo: Memo,
695
+ Portal: Portal,
696
+ Profiler: Profiler,
697
+ StrictMode: StrictMode,
698
+ Suspense: Suspense,
699
+ isAsyncMode: isAsyncMode,
700
+ isConcurrentMode: isConcurrentMode,
701
+ isContextConsumer: isContextConsumer,
702
+ isContextProvider: isContextProvider,
703
+ isElement: isElement,
704
+ isForwardRef: isForwardRef,
705
+ isFragment: isFragment,
706
+ isLazy: isLazy,
707
+ isMemo: isMemo,
708
+ isPortal: isPortal,
709
+ isProfiler: isProfiler,
710
+ isStrictMode: isStrictMode,
711
+ isSuspense: isSuspense,
712
+ isValidElementType: isValidElementType,
713
+ typeOf: typeOf
714
+ };
715
+
716
+ var reactIs_development = createCommonjsModule(function (module, exports) {
717
+
718
+ if (process.env.NODE_ENV !== "production") {
719
+ (function () {
720
+
721
+ // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
722
+ // nor polyfill, then a plain number is used for performance.
723
+ var hasSymbol = typeof Symbol === 'function' && Symbol["for"];
724
+ var REACT_ELEMENT_TYPE = hasSymbol ? Symbol["for"]('react.element') : 0xeac7;
725
+ var REACT_PORTAL_TYPE = hasSymbol ? Symbol["for"]('react.portal') : 0xeaca;
726
+ var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol["for"]('react.fragment') : 0xeacb;
727
+ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol["for"]('react.strict_mode') : 0xeacc;
728
+ var REACT_PROFILER_TYPE = hasSymbol ? Symbol["for"]('react.profiler') : 0xead2;
729
+ var REACT_PROVIDER_TYPE = hasSymbol ? Symbol["for"]('react.provider') : 0xeacd;
730
+ var REACT_CONTEXT_TYPE = hasSymbol ? Symbol["for"]('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
731
+ // (unstable) APIs that have been removed. Can we remove the symbols?
732
+
733
+ var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol["for"]('react.async_mode') : 0xeacf;
734
+ var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol["for"]('react.concurrent_mode') : 0xeacf;
735
+ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol["for"]('react.forward_ref') : 0xead0;
736
+ var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol["for"]('react.suspense') : 0xead1;
737
+ var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol["for"]('react.suspense_list') : 0xead8;
738
+ var REACT_MEMO_TYPE = hasSymbol ? Symbol["for"]('react.memo') : 0xead3;
739
+ var REACT_LAZY_TYPE = hasSymbol ? Symbol["for"]('react.lazy') : 0xead4;
740
+ var REACT_BLOCK_TYPE = hasSymbol ? Symbol["for"]('react.block') : 0xead9;
741
+ var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol["for"]('react.fundamental') : 0xead5;
742
+ var REACT_RESPONDER_TYPE = hasSymbol ? Symbol["for"]('react.responder') : 0xead6;
743
+ var REACT_SCOPE_TYPE = hasSymbol ? Symbol["for"]('react.scope') : 0xead7;
744
+ function isValidElementType(type) {
745
+ return typeof type === 'string' || typeof type === 'function' ||
746
+ // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
747
+ 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);
748
+ }
749
+ function typeOf(object) {
750
+ if (_typeof(object) === 'object' && object !== null) {
751
+ var $$typeof = object.$$typeof;
752
+ switch ($$typeof) {
753
+ case REACT_ELEMENT_TYPE:
754
+ var type = object.type;
755
+ switch (type) {
756
+ case REACT_ASYNC_MODE_TYPE:
757
+ case REACT_CONCURRENT_MODE_TYPE:
758
+ case REACT_FRAGMENT_TYPE:
759
+ case REACT_PROFILER_TYPE:
760
+ case REACT_STRICT_MODE_TYPE:
761
+ case REACT_SUSPENSE_TYPE:
762
+ return type;
763
+ default:
764
+ var $$typeofType = type && type.$$typeof;
765
+ switch ($$typeofType) {
766
+ case REACT_CONTEXT_TYPE:
767
+ case REACT_FORWARD_REF_TYPE:
768
+ case REACT_LAZY_TYPE:
769
+ case REACT_MEMO_TYPE:
770
+ case REACT_PROVIDER_TYPE:
771
+ return $$typeofType;
772
+ default:
773
+ return $$typeof;
774
+ }
775
+ }
776
+ case REACT_PORTAL_TYPE:
777
+ return $$typeof;
778
+ }
779
+ }
780
+ return undefined;
781
+ } // AsyncMode is deprecated along with isAsyncMode
782
+
783
+ var AsyncMode = REACT_ASYNC_MODE_TYPE;
784
+ var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
785
+ var ContextConsumer = REACT_CONTEXT_TYPE;
786
+ var ContextProvider = REACT_PROVIDER_TYPE;
787
+ var Element = REACT_ELEMENT_TYPE;
788
+ var ForwardRef = REACT_FORWARD_REF_TYPE;
789
+ var Fragment = REACT_FRAGMENT_TYPE;
790
+ var Lazy = REACT_LAZY_TYPE;
791
+ var Memo = REACT_MEMO_TYPE;
792
+ var Portal = REACT_PORTAL_TYPE;
793
+ var Profiler = REACT_PROFILER_TYPE;
794
+ var StrictMode = REACT_STRICT_MODE_TYPE;
795
+ var Suspense = REACT_SUSPENSE_TYPE;
796
+ var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
797
+
798
+ function isAsyncMode(object) {
799
+ {
800
+ if (!hasWarnedAboutDeprecatedIsAsyncMode) {
801
+ hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
802
+
803
+ 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.');
804
+ }
805
+ }
806
+ return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
807
+ }
808
+ function isConcurrentMode(object) {
809
+ return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
810
+ }
811
+ function isContextConsumer(object) {
812
+ return typeOf(object) === REACT_CONTEXT_TYPE;
813
+ }
814
+ function isContextProvider(object) {
815
+ return typeOf(object) === REACT_PROVIDER_TYPE;
816
+ }
817
+ function isElement(object) {
818
+ return _typeof(object) === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
819
+ }
820
+ function isForwardRef(object) {
821
+ return typeOf(object) === REACT_FORWARD_REF_TYPE;
822
+ }
823
+ function isFragment(object) {
824
+ return typeOf(object) === REACT_FRAGMENT_TYPE;
825
+ }
826
+ function isLazy(object) {
827
+ return typeOf(object) === REACT_LAZY_TYPE;
828
+ }
829
+ function isMemo(object) {
830
+ return typeOf(object) === REACT_MEMO_TYPE;
831
+ }
832
+ function isPortal(object) {
833
+ return typeOf(object) === REACT_PORTAL_TYPE;
834
+ }
835
+ function isProfiler(object) {
836
+ return typeOf(object) === REACT_PROFILER_TYPE;
837
+ }
838
+ function isStrictMode(object) {
839
+ return typeOf(object) === REACT_STRICT_MODE_TYPE;
840
+ }
841
+ function isSuspense(object) {
842
+ return typeOf(object) === REACT_SUSPENSE_TYPE;
843
+ }
844
+ exports.AsyncMode = AsyncMode;
845
+ exports.ConcurrentMode = ConcurrentMode;
846
+ exports.ContextConsumer = ContextConsumer;
847
+ exports.ContextProvider = ContextProvider;
848
+ exports.Element = Element;
849
+ exports.ForwardRef = ForwardRef;
850
+ exports.Fragment = Fragment;
851
+ exports.Lazy = Lazy;
852
+ exports.Memo = Memo;
853
+ exports.Portal = Portal;
854
+ exports.Profiler = Profiler;
855
+ exports.StrictMode = StrictMode;
856
+ exports.Suspense = Suspense;
857
+ exports.isAsyncMode = isAsyncMode;
858
+ exports.isConcurrentMode = isConcurrentMode;
859
+ exports.isContextConsumer = isContextConsumer;
860
+ exports.isContextProvider = isContextProvider;
861
+ exports.isElement = isElement;
862
+ exports.isForwardRef = isForwardRef;
863
+ exports.isFragment = isFragment;
864
+ exports.isLazy = isLazy;
865
+ exports.isMemo = isMemo;
866
+ exports.isPortal = isPortal;
867
+ exports.isProfiler = isProfiler;
868
+ exports.isStrictMode = isStrictMode;
869
+ exports.isSuspense = isSuspense;
870
+ exports.isValidElementType = isValidElementType;
871
+ exports.typeOf = typeOf;
872
+ })();
873
+ }
874
+ });
875
+ reactIs_development.AsyncMode;
876
+ reactIs_development.ConcurrentMode;
877
+ reactIs_development.ContextConsumer;
878
+ reactIs_development.ContextProvider;
879
+ reactIs_development.Element;
880
+ reactIs_development.ForwardRef;
881
+ reactIs_development.Fragment;
882
+ reactIs_development.Lazy;
883
+ reactIs_development.Memo;
884
+ reactIs_development.Portal;
885
+ reactIs_development.Profiler;
886
+ reactIs_development.StrictMode;
887
+ reactIs_development.Suspense;
888
+ reactIs_development.isAsyncMode;
889
+ reactIs_development.isConcurrentMode;
890
+ reactIs_development.isContextConsumer;
891
+ reactIs_development.isContextProvider;
892
+ reactIs_development.isElement;
893
+ reactIs_development.isForwardRef;
894
+ reactIs_development.isFragment;
895
+ reactIs_development.isLazy;
896
+ reactIs_development.isMemo;
897
+ reactIs_development.isPortal;
898
+ reactIs_development.isProfiler;
899
+ reactIs_development.isStrictMode;
900
+ reactIs_development.isSuspense;
901
+ reactIs_development.isValidElementType;
902
+ reactIs_development.typeOf;
903
+
904
+ var reactIs = createCommonjsModule(function (module) {
905
+
906
+ if (process.env.NODE_ENV === 'production') {
907
+ module.exports = reactIs_production_min;
908
+ } else {
909
+ module.exports = reactIs_development;
910
+ }
911
+ });
912
+
913
+ /*
914
+ object-assign
915
+ (c) Sindre Sorhus
916
+ @license MIT
917
+ */
918
+
919
+ /* eslint-disable no-unused-vars */
920
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
921
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
922
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
923
+ function toObject(val) {
924
+ if (val === null || val === undefined) {
925
+ throw new TypeError('Object.assign cannot be called with null or undefined');
926
+ }
927
+ return Object(val);
928
+ }
929
+ function shouldUseNative() {
930
+ try {
931
+ if (!Object.assign) {
932
+ return false;
933
+ }
934
+
935
+ // Detect buggy property enumeration order in older V8 versions.
936
+
937
+ // https://bugs.chromium.org/p/v8/issues/detail?id=4118
938
+ var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
939
+ test1[5] = 'de';
940
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
941
+ return false;
942
+ }
943
+
944
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
945
+ var test2 = {};
946
+ for (var i = 0; i < 10; i++) {
947
+ test2['_' + String.fromCharCode(i)] = i;
948
+ }
949
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
950
+ return test2[n];
951
+ });
952
+ if (order2.join('') !== '0123456789') {
953
+ return false;
954
+ }
955
+
956
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
957
+ var test3 = {};
958
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
959
+ test3[letter] = letter;
960
+ });
961
+ if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') {
962
+ return false;
963
+ }
964
+ return true;
965
+ } catch (err) {
966
+ // We don't expect any of the above to throw, but better to be safe.
967
+ return false;
968
+ }
969
+ }
970
+ var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
971
+ var from;
972
+ var to = toObject(target);
973
+ var symbols;
974
+ for (var s = 1; s < arguments.length; s++) {
975
+ from = Object(arguments[s]);
976
+ for (var key in from) {
977
+ if (hasOwnProperty.call(from, key)) {
978
+ to[key] = from[key];
979
+ }
980
+ }
981
+ if (getOwnPropertySymbols) {
982
+ symbols = getOwnPropertySymbols(from);
983
+ for (var i = 0; i < symbols.length; i++) {
984
+ if (propIsEnumerable.call(from, symbols[i])) {
985
+ to[symbols[i]] = from[symbols[i]];
986
+ }
987
+ }
988
+ }
989
+ }
990
+ return to;
991
+ };
992
+
993
+ /**
994
+ * Copyright (c) 2013-present, Facebook, Inc.
995
+ *
996
+ * This source code is licensed under the MIT license found in the
997
+ * LICENSE file in the root directory of this source tree.
998
+ */
999
+
1000
+ var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
1001
+ var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
1002
+
1003
+ var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
1004
+
1005
+ var printWarning$1 = function printWarning() {};
1006
+ if (process.env.NODE_ENV !== 'production') {
1007
+ var ReactPropTypesSecret = ReactPropTypesSecret_1;
1008
+ var loggedTypeFailures = {};
1009
+ var has = has$1;
1010
+ printWarning$1 = function printWarning(text) {
1011
+ var message = 'Warning: ' + text;
1012
+ if (typeof console !== 'undefined') {
1013
+ console.error(message);
1014
+ }
1015
+ try {
1016
+ // --- Welcome to debugging React ---
1017
+ // This error was thrown as a convenience so that you can use this stack
1018
+ // to find the callsite that caused this warning to fire.
1019
+ throw new Error(message);
1020
+ } catch (x) {/**/}
1021
+ };
1022
+ }
1023
+
1024
+ /**
1025
+ * Assert that the values match with the type specs.
1026
+ * Error messages are memorized and will only be shown once.
1027
+ *
1028
+ * @param {object} typeSpecs Map of name to a ReactPropType
1029
+ * @param {object} values Runtime values that need to be type-checked
1030
+ * @param {string} location e.g. "prop", "context", "child context"
1031
+ * @param {string} componentName Name of the component for error messages.
1032
+ * @param {?Function} getStack Returns the component stack.
1033
+ * @private
1034
+ */
1035
+ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
1036
+ if (process.env.NODE_ENV !== 'production') {
1037
+ for (var typeSpecName in typeSpecs) {
1038
+ if (has(typeSpecs, typeSpecName)) {
1039
+ var error;
1040
+ // Prop type validation may throw. In case they do, we don't want to
1041
+ // fail the render phase where it didn't fail before. So we log it.
1042
+ // After these have been cleaned up, we'll let them throw.
1043
+ try {
1044
+ // This is intentionally an invariant that gets caught. It's the same
1045
+ // behavior as without this statement except with a better message.
1046
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
1047
+ 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`.');
1048
+ err.name = 'Invariant Violation';
1049
+ throw err;
1050
+ }
1051
+ error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
1052
+ } catch (ex) {
1053
+ error = ex;
1054
+ }
1055
+ if (error && !(error instanceof Error)) {
1056
+ printWarning$1((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).');
1057
+ }
1058
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
1059
+ // Only monitor this failure once because there tends to be a lot of the
1060
+ // same error.
1061
+ loggedTypeFailures[error.message] = true;
1062
+ var stack = getStack ? getStack() : '';
1063
+ printWarning$1('Failed ' + location + ' type: ' + error.message + (stack != null ? stack : ''));
1064
+ }
1065
+ }
1066
+ }
1067
+ }
1068
+ }
1069
+
1070
+ /**
1071
+ * Resets warning cache when testing.
1072
+ *
1073
+ * @private
1074
+ */
1075
+ checkPropTypes.resetWarningCache = function () {
1076
+ if (process.env.NODE_ENV !== 'production') {
1077
+ loggedTypeFailures = {};
1078
+ }
1079
+ };
1080
+ var checkPropTypes_1 = checkPropTypes;
1081
+
1082
+ var printWarning = function printWarning() {};
1083
+ if (process.env.NODE_ENV !== 'production') {
1084
+ printWarning = function printWarning(text) {
1085
+ var message = 'Warning: ' + text;
1086
+ if (typeof console !== 'undefined') {
1087
+ console.error(message);
1088
+ }
1089
+ try {
1090
+ // --- Welcome to debugging React ---
1091
+ // This error was thrown as a convenience so that you can use this stack
1092
+ // to find the callsite that caused this warning to fire.
1093
+ throw new Error(message);
1094
+ } catch (x) {}
1095
+ };
1096
+ }
1097
+ function emptyFunctionThatReturnsNull() {
1098
+ return null;
1099
+ }
1100
+ var factoryWithTypeCheckers = function factoryWithTypeCheckers(isValidElement, throwOnDirectAccess) {
1101
+ /* global Symbol */
1102
+ var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
1103
+ var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
1104
+
1105
+ /**
1106
+ * Returns the iterator method function contained on the iterable object.
1107
+ *
1108
+ * Be sure to invoke the function with the iterable as context:
1109
+ *
1110
+ * var iteratorFn = getIteratorFn(myIterable);
1111
+ * if (iteratorFn) {
1112
+ * var iterator = iteratorFn.call(myIterable);
1113
+ * ...
1114
+ * }
1115
+ *
1116
+ * @param {?object} maybeIterable
1117
+ * @return {?function}
1118
+ */
1119
+ function getIteratorFn(maybeIterable) {
1120
+ var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
1121
+ if (typeof iteratorFn === 'function') {
1122
+ return iteratorFn;
1123
+ }
1124
+ }
1125
+
1126
+ /**
1127
+ * Collection of methods that allow declaration and validation of props that are
1128
+ * supplied to React components. Example usage:
1129
+ *
1130
+ * var Props = require('ReactPropTypes');
1131
+ * var MyArticle = React.createClass({
1132
+ * propTypes: {
1133
+ * // An optional string prop named "description".
1134
+ * description: Props.string,
1135
+ *
1136
+ * // A required enum prop named "category".
1137
+ * category: Props.oneOf(['News','Photos']).isRequired,
1138
+ *
1139
+ * // A prop named "dialog" that requires an instance of Dialog.
1140
+ * dialog: Props.instanceOf(Dialog).isRequired
1141
+ * },
1142
+ * render: function() { ... }
1143
+ * });
1144
+ *
1145
+ * A more formal specification of how these methods are used:
1146
+ *
1147
+ * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
1148
+ * decl := ReactPropTypes.{type}(.isRequired)?
1149
+ *
1150
+ * Each and every declaration produces a function with the same signature. This
1151
+ * allows the creation of custom validation functions. For example:
1152
+ *
1153
+ * var MyLink = React.createClass({
1154
+ * propTypes: {
1155
+ * // An optional string or URI prop named "href".
1156
+ * href: function(props, propName, componentName) {
1157
+ * var propValue = props[propName];
1158
+ * if (propValue != null && typeof propValue !== 'string' &&
1159
+ * !(propValue instanceof URI)) {
1160
+ * return new Error(
1161
+ * 'Expected a string or an URI for ' + propName + ' in ' +
1162
+ * componentName
1163
+ * );
1164
+ * }
1165
+ * }
1166
+ * },
1167
+ * render: function() {...}
1168
+ * });
1169
+ *
1170
+ * @internal
1171
+ */
1172
+
1173
+ var ANONYMOUS = '<<anonymous>>';
1174
+
1175
+ // Important!
1176
+ // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
1177
+ var ReactPropTypes = {
1178
+ array: createPrimitiveTypeChecker('array'),
1179
+ bigint: createPrimitiveTypeChecker('bigint'),
1180
+ bool: createPrimitiveTypeChecker('boolean'),
1181
+ func: createPrimitiveTypeChecker('function'),
1182
+ number: createPrimitiveTypeChecker('number'),
1183
+ object: createPrimitiveTypeChecker('object'),
1184
+ string: createPrimitiveTypeChecker('string'),
1185
+ symbol: createPrimitiveTypeChecker('symbol'),
1186
+ any: createAnyTypeChecker(),
1187
+ arrayOf: createArrayOfTypeChecker,
1188
+ element: createElementTypeChecker(),
1189
+ elementType: createElementTypeTypeChecker(),
1190
+ instanceOf: createInstanceTypeChecker,
1191
+ node: createNodeChecker(),
1192
+ objectOf: createObjectOfTypeChecker,
1193
+ oneOf: createEnumTypeChecker,
1194
+ oneOfType: createUnionTypeChecker,
1195
+ shape: createShapeTypeChecker,
1196
+ exact: createStrictShapeTypeChecker
1197
+ };
1198
+
1199
+ /**
1200
+ * inlined Object.is polyfill to avoid requiring consumers ship their own
1201
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
1202
+ */
1203
+ /*eslint-disable no-self-compare*/
1204
+ function is(x, y) {
1205
+ // SameValue algorithm
1206
+ if (x === y) {
1207
+ // Steps 1-5, 7-10
1208
+ // Steps 6.b-6.e: +0 != -0
1209
+ return x !== 0 || 1 / x === 1 / y;
1210
+ } else {
1211
+ // Step 6.a: NaN == NaN
1212
+ return x !== x && y !== y;
1213
+ }
1214
+ }
1215
+ /*eslint-enable no-self-compare*/
1216
+
1217
+ /**
1218
+ * We use an Error-like object for backward compatibility as people may call
1219
+ * PropTypes directly and inspect their output. However, we don't use real
1220
+ * Errors anymore. We don't inspect their stack anyway, and creating them
1221
+ * is prohibitively expensive if they are created too often, such as what
1222
+ * happens in oneOfType() for any type before the one that matched.
1223
+ */
1224
+ function PropTypeError(message, data) {
1225
+ this.message = message;
1226
+ this.data = data && _typeof(data) === 'object' ? data : {};
1227
+ this.stack = '';
1228
+ }
1229
+ // Make `instanceof Error` still work for returned errors.
1230
+ PropTypeError.prototype = Error.prototype;
1231
+ function createChainableTypeChecker(validate) {
1232
+ if (process.env.NODE_ENV !== 'production') {
1233
+ var manualPropTypeCallCache = {};
1234
+ var manualPropTypeWarningCount = 0;
1235
+ }
1236
+ function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
1237
+ componentName = componentName || ANONYMOUS;
1238
+ propFullName = propFullName || propName;
1239
+ if (secret !== ReactPropTypesSecret_1) {
1240
+ if (throwOnDirectAccess) {
1241
+ // New behavior only for users of `prop-types` package
1242
+ 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');
1243
+ err.name = 'Invariant Violation';
1244
+ throw err;
1245
+ } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
1246
+ // Old behavior for people using React.PropTypes
1247
+ var cacheKey = componentName + ':' + propName;
1248
+ if (!manualPropTypeCallCache[cacheKey] &&
1249
+ // Avoid spamming the console because they are often not actionable except for lib authors
1250
+ manualPropTypeWarningCount < 3) {
1251
+ 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.');
1252
+ manualPropTypeCallCache[cacheKey] = true;
1253
+ manualPropTypeWarningCount++;
1254
+ }
1255
+ }
1256
+ }
1257
+ if (props[propName] == null) {
1258
+ if (isRequired) {
1259
+ if (props[propName] === null) {
1260
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
1261
+ }
1262
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
1263
+ }
1264
+ return null;
1265
+ } else {
1266
+ return validate(props, propName, componentName, location, propFullName);
1267
+ }
1268
+ }
1269
+ var chainedCheckType = checkType.bind(null, false);
1270
+ chainedCheckType.isRequired = checkType.bind(null, true);
1271
+ return chainedCheckType;
1272
+ }
1273
+ function createPrimitiveTypeChecker(expectedType) {
1274
+ function validate(props, propName, componentName, location, propFullName, secret) {
1275
+ var propValue = props[propName];
1276
+ var propType = getPropType(propValue);
1277
+ if (propType !== expectedType) {
1278
+ // `propValue` being instance of, say, date/regexp, pass the 'object'
1279
+ // check, but we can offer a more precise error message here rather than
1280
+ // 'of type `object`'.
1281
+ var preciseType = getPreciseType(propValue);
1282
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'), {
1283
+ expectedType: expectedType
1284
+ });
1285
+ }
1286
+ return null;
1287
+ }
1288
+ return createChainableTypeChecker(validate);
1289
+ }
1290
+ function createAnyTypeChecker() {
1291
+ return createChainableTypeChecker(emptyFunctionThatReturnsNull);
1292
+ }
1293
+ function createArrayOfTypeChecker(typeChecker) {
1294
+ function validate(props, propName, componentName, location, propFullName) {
1295
+ if (typeof typeChecker !== 'function') {
1296
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
1297
+ }
1298
+ var propValue = props[propName];
1299
+ if (!Array.isArray(propValue)) {
1300
+ var propType = getPropType(propValue);
1301
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
1302
+ }
1303
+ for (var i = 0; i < propValue.length; i++) {
1304
+ var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1);
1305
+ if (error instanceof Error) {
1306
+ return error;
1307
+ }
1308
+ }
1309
+ return null;
1310
+ }
1311
+ return createChainableTypeChecker(validate);
1312
+ }
1313
+ function createElementTypeChecker() {
1314
+ function validate(props, propName, componentName, location, propFullName) {
1315
+ var propValue = props[propName];
1316
+ if (!isValidElement(propValue)) {
1317
+ var propType = getPropType(propValue);
1318
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
1319
+ }
1320
+ return null;
1321
+ }
1322
+ return createChainableTypeChecker(validate);
1323
+ }
1324
+ function createElementTypeTypeChecker() {
1325
+ function validate(props, propName, componentName, location, propFullName) {
1326
+ var propValue = props[propName];
1327
+ if (!reactIs.isValidElementType(propValue)) {
1328
+ var propType = getPropType(propValue);
1329
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
1330
+ }
1331
+ return null;
1332
+ }
1333
+ return createChainableTypeChecker(validate);
1334
+ }
1335
+ function createInstanceTypeChecker(expectedClass) {
1336
+ function validate(props, propName, componentName, location, propFullName) {
1337
+ if (!(props[propName] instanceof expectedClass)) {
1338
+ var expectedClassName = expectedClass.name || ANONYMOUS;
1339
+ var actualClassName = getClassName(props[propName]);
1340
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
1341
+ }
1342
+ return null;
1343
+ }
1344
+ return createChainableTypeChecker(validate);
1345
+ }
1346
+ function createEnumTypeChecker(expectedValues) {
1347
+ if (!Array.isArray(expectedValues)) {
1348
+ if (process.env.NODE_ENV !== 'production') {
1349
+ if (arguments.length > 1) {
1350
+ 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]).');
1351
+ } else {
1352
+ printWarning('Invalid argument supplied to oneOf, expected an array.');
1353
+ }
1354
+ }
1355
+ return emptyFunctionThatReturnsNull;
1356
+ }
1357
+ function validate(props, propName, componentName, location, propFullName) {
1358
+ var propValue = props[propName];
1359
+ for (var i = 0; i < expectedValues.length; i++) {
1360
+ if (is(propValue, expectedValues[i])) {
1361
+ return null;
1362
+ }
1363
+ }
1364
+ var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
1365
+ var type = getPreciseType(value);
1366
+ if (type === 'symbol') {
1367
+ return String(value);
1368
+ }
1369
+ return value;
1370
+ });
1371
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
1372
+ }
1373
+ return createChainableTypeChecker(validate);
1374
+ }
1375
+ function createObjectOfTypeChecker(typeChecker) {
1376
+ function validate(props, propName, componentName, location, propFullName) {
1377
+ if (typeof typeChecker !== 'function') {
1378
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
1379
+ }
1380
+ var propValue = props[propName];
1381
+ var propType = getPropType(propValue);
1382
+ if (propType !== 'object') {
1383
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
1384
+ }
1385
+ for (var key in propValue) {
1386
+ if (has$1(propValue, key)) {
1387
+ var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
1388
+ if (error instanceof Error) {
1389
+ return error;
1390
+ }
1391
+ }
1392
+ }
1393
+ return null;
1394
+ }
1395
+ return createChainableTypeChecker(validate);
1396
+ }
1397
+ function createUnionTypeChecker(arrayOfTypeCheckers) {
1398
+ if (!Array.isArray(arrayOfTypeCheckers)) {
1399
+ process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
1400
+ return emptyFunctionThatReturnsNull;
1401
+ }
1402
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
1403
+ var checker = arrayOfTypeCheckers[i];
1404
+ if (typeof checker !== 'function') {
1405
+ printWarning('Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.');
1406
+ return emptyFunctionThatReturnsNull;
1407
+ }
1408
+ }
1409
+ function validate(props, propName, componentName, location, propFullName) {
1410
+ var expectedTypes = [];
1411
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
1412
+ var checker = arrayOfTypeCheckers[i];
1413
+ var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1);
1414
+ if (checkerResult == null) {
1415
+ return null;
1416
+ }
1417
+ if (checkerResult.data && has$1(checkerResult.data, 'expectedType')) {
1418
+ expectedTypes.push(checkerResult.data.expectedType);
1419
+ }
1420
+ }
1421
+ var expectedTypesMessage = expectedTypes.length > 0 ? ', expected one of type [' + expectedTypes.join(', ') + ']' : '';
1422
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
1423
+ }
1424
+ return createChainableTypeChecker(validate);
1425
+ }
1426
+ function createNodeChecker() {
1427
+ function validate(props, propName, componentName, location, propFullName) {
1428
+ if (!isNode(props[propName])) {
1429
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
1430
+ }
1431
+ return null;
1432
+ }
1433
+ return createChainableTypeChecker(validate);
1434
+ }
1435
+ function invalidValidatorError(componentName, location, propFullName, key, type) {
1436
+ 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 + '`.');
1437
+ }
1438
+ function createShapeTypeChecker(shapeTypes) {
1439
+ function validate(props, propName, componentName, location, propFullName) {
1440
+ var propValue = props[propName];
1441
+ var propType = getPropType(propValue);
1442
+ if (propType !== 'object') {
1443
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
1444
+ }
1445
+ for (var key in shapeTypes) {
1446
+ var checker = shapeTypes[key];
1447
+ if (typeof checker !== 'function') {
1448
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
1449
+ }
1450
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
1451
+ if (error) {
1452
+ return error;
1453
+ }
1454
+ }
1455
+ return null;
1456
+ }
1457
+ return createChainableTypeChecker(validate);
1458
+ }
1459
+ function createStrictShapeTypeChecker(shapeTypes) {
1460
+ function validate(props, propName, componentName, location, propFullName) {
1461
+ var propValue = props[propName];
1462
+ var propType = getPropType(propValue);
1463
+ if (propType !== 'object') {
1464
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
1465
+ }
1466
+ // We need to check all keys in case some are required but missing from props.
1467
+ var allKeys = objectAssign({}, props[propName], shapeTypes);
1468
+ for (var key in allKeys) {
1469
+ var checker = shapeTypes[key];
1470
+ if (has$1(shapeTypes, key) && typeof checker !== 'function') {
1471
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
1472
+ }
1473
+ if (!checker) {
1474
+ 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, ' '));
1475
+ }
1476
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
1477
+ if (error) {
1478
+ return error;
1479
+ }
1480
+ }
1481
+ return null;
1482
+ }
1483
+ return createChainableTypeChecker(validate);
1484
+ }
1485
+ function isNode(propValue) {
1486
+ switch (_typeof(propValue)) {
1487
+ case 'number':
1488
+ case 'string':
1489
+ case 'undefined':
1490
+ return true;
1491
+ case 'boolean':
1492
+ return !propValue;
1493
+ case 'object':
1494
+ if (Array.isArray(propValue)) {
1495
+ return propValue.every(isNode);
1496
+ }
1497
+ if (propValue === null || isValidElement(propValue)) {
1498
+ return true;
1499
+ }
1500
+ var iteratorFn = getIteratorFn(propValue);
1501
+ if (iteratorFn) {
1502
+ var iterator = iteratorFn.call(propValue);
1503
+ var step;
1504
+ if (iteratorFn !== propValue.entries) {
1505
+ while (!(step = iterator.next()).done) {
1506
+ if (!isNode(step.value)) {
1507
+ return false;
1508
+ }
1509
+ }
1510
+ } else {
1511
+ // Iterator will provide entry [k,v] tuples rather than values.
1512
+ while (!(step = iterator.next()).done) {
1513
+ var entry = step.value;
1514
+ if (entry) {
1515
+ if (!isNode(entry[1])) {
1516
+ return false;
1517
+ }
1518
+ }
1519
+ }
1520
+ }
1521
+ } else {
1522
+ return false;
1523
+ }
1524
+ return true;
1525
+ default:
1526
+ return false;
1527
+ }
1528
+ }
1529
+ function isSymbol(propType, propValue) {
1530
+ // Native Symbol.
1531
+ if (propType === 'symbol') {
1532
+ return true;
1533
+ }
1534
+
1535
+ // falsy value can't be a Symbol
1536
+ if (!propValue) {
1537
+ return false;
1538
+ }
1539
+
1540
+ // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
1541
+ if (propValue['@@toStringTag'] === 'Symbol') {
1542
+ return true;
1543
+ }
1544
+
1545
+ // Fallback for non-spec compliant Symbols which are polyfilled.
1546
+ if (typeof Symbol === 'function' && propValue instanceof Symbol) {
1547
+ return true;
1548
+ }
1549
+ return false;
1550
+ }
1551
+
1552
+ // Equivalent of `typeof` but with special handling for array and regexp.
1553
+ function getPropType(propValue) {
1554
+ var propType = _typeof(propValue);
1555
+ if (Array.isArray(propValue)) {
1556
+ return 'array';
1557
+ }
1558
+ if (propValue instanceof RegExp) {
1559
+ // Old webkits (at least until Android 4.0) return 'function' rather than
1560
+ // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
1561
+ // passes PropTypes.object.
1562
+ return 'object';
1563
+ }
1564
+ if (isSymbol(propType, propValue)) {
1565
+ return 'symbol';
1566
+ }
1567
+ return propType;
1568
+ }
1569
+
1570
+ // This handles more types than `getPropType`. Only used for error messages.
1571
+ // See `createPrimitiveTypeChecker`.
1572
+ function getPreciseType(propValue) {
1573
+ if (typeof propValue === 'undefined' || propValue === null) {
1574
+ return '' + propValue;
1575
+ }
1576
+ var propType = getPropType(propValue);
1577
+ if (propType === 'object') {
1578
+ if (propValue instanceof Date) {
1579
+ return 'date';
1580
+ } else if (propValue instanceof RegExp) {
1581
+ return 'regexp';
1582
+ }
1583
+ }
1584
+ return propType;
1585
+ }
1586
+
1587
+ // Returns a string that is postfixed to a warning about an invalid type.
1588
+ // For example, "undefined" or "of type array"
1589
+ function getPostfixForTypeWarning(value) {
1590
+ var type = getPreciseType(value);
1591
+ switch (type) {
1592
+ case 'array':
1593
+ case 'object':
1594
+ return 'an ' + type;
1595
+ case 'boolean':
1596
+ case 'date':
1597
+ case 'regexp':
1598
+ return 'a ' + type;
1599
+ default:
1600
+ return type;
1601
+ }
1602
+ }
1603
+
1604
+ // Returns class name of the object, if any.
1605
+ function getClassName(propValue) {
1606
+ if (!propValue.constructor || !propValue.constructor.name) {
1607
+ return ANONYMOUS;
1608
+ }
1609
+ return propValue.constructor.name;
1610
+ }
1611
+ ReactPropTypes.checkPropTypes = checkPropTypes_1;
1612
+ ReactPropTypes.resetWarningCache = checkPropTypes_1.resetWarningCache;
1613
+ ReactPropTypes.PropTypes = ReactPropTypes;
1614
+ return ReactPropTypes;
1615
+ };
1616
+
1617
+ function emptyFunction() {}
1618
+ function emptyFunctionWithReset() {}
1619
+ emptyFunctionWithReset.resetWarningCache = emptyFunction;
1620
+ var factoryWithThrowingShims = function factoryWithThrowingShims() {
1621
+ function shim(props, propName, componentName, location, propFullName, secret) {
1622
+ if (secret === ReactPropTypesSecret_1) {
1623
+ // It is still safe when called from React.
1624
+ return;
1625
+ }
1626
+ 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');
1627
+ err.name = 'Invariant Violation';
1628
+ throw err;
1629
+ }
1630
+ shim.isRequired = shim;
1631
+ function getShim() {
1632
+ return shim;
1633
+ }
1634
+ // Important!
1635
+ // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
1636
+ var ReactPropTypes = {
1637
+ array: shim,
1638
+ bigint: shim,
1639
+ bool: shim,
1640
+ func: shim,
1641
+ number: shim,
1642
+ object: shim,
1643
+ string: shim,
1644
+ symbol: shim,
1645
+ any: shim,
1646
+ arrayOf: getShim,
1647
+ element: shim,
1648
+ elementType: shim,
1649
+ instanceOf: getShim,
1650
+ node: shim,
1651
+ objectOf: getShim,
1652
+ oneOf: getShim,
1653
+ oneOfType: getShim,
1654
+ shape: getShim,
1655
+ exact: getShim,
1656
+ checkPropTypes: emptyFunctionWithReset,
1657
+ resetWarningCache: emptyFunction
1658
+ };
1659
+ ReactPropTypes.PropTypes = ReactPropTypes;
1660
+ return ReactPropTypes;
1661
+ };
1662
+
1663
+ var propTypes = createCommonjsModule(function (module) {
1664
+ /**
1665
+ * Copyright (c) 2013-present, Facebook, Inc.
1666
+ *
1667
+ * This source code is licensed under the MIT license found in the
1668
+ * LICENSE file in the root directory of this source tree.
1669
+ */
1670
+
1671
+ if (process.env.NODE_ENV !== 'production') {
1672
+ var ReactIs = reactIs;
1673
+
1674
+ // By explicitly using `prop-types` you are opting into new development behavior.
1675
+ // http://fb.me/prop-types-in-prod
1676
+ var throwOnDirectAccess = true;
1677
+ module.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess);
1678
+ } else {
1679
+ // By explicitly using `prop-types` you are opting into new production behavior.
1680
+ // http://fb.me/prop-types-in-prod
1681
+ module.exports = factoryWithThrowingShims();
1682
+ }
1683
+ });
1684
+ var PropTypes = propTypes;
1685
+
1686
+ /**
1687
+ * A Handsontable-ReactJS wrapper.
1688
+ *
1689
+ * To implement, use the `HotTable` tag with properties corresponding to Handsontable options.
1690
+ * For example:
1691
+ *
1692
+ * ```js
1693
+ * <HotTable id="hot" data={dataObject} contextMenu={true} colHeaders={true} width={600} height={300} stretchH="all" />
1694
+ *
1695
+ * // is analogous to
1696
+ * let hot = new Handsontable(document.getElementById('hot'), {
1697
+ * data: dataObject,
1698
+ * contextMenu: true,
1699
+ * colHeaders: true,
1700
+ * width: 600
1701
+ * height: 300
1702
+ * });
1703
+ *
1704
+ * ```
1705
+ *
1706
+ * @class HotTable
1707
+ */
1708
+ var HotTable = /*#__PURE__*/function (_React$Component) {
1709
+ _inherits(HotTable, _React$Component);
1710
+ var _super = _createSuper(HotTable);
1711
+ /**
1712
+ * HotTable class constructor.
1713
+ *
1714
+ * @param {HotTableProps} props Component props.
1715
+ * @param {*} [context] Component context.
1716
+ */
1717
+ function HotTable(props, context) {
1718
+ var _this;
1719
+ _classCallCheck(this, HotTable);
1720
+ _this = _super.call(this, props, context);
1721
+ /**
1722
+ * The `id` of the main Handsontable DOM element.
1723
+ *
1724
+ * @type {String}
1725
+ */
1726
+ _this.id = null;
1727
+ /**
1728
+ * Reference to the Handsontable instance.
1729
+ *
1730
+ * @private
1731
+ * @type {Object}
1732
+ */
1733
+ _this.__hotInstance = null;
1734
+ /**
1735
+ * Reference to the main Handsontable DOM element.
1736
+ *
1737
+ * @type {HTMLElement}
1738
+ */
1739
+ _this.hotElementRef = null;
1740
+ /**
1741
+ * Array of object containing the column settings.
1742
+ *
1743
+ * @type {Array}
1744
+ */
1745
+ _this.columnSettings = [];
1746
+ /**
1747
+ * Component used to manage the renderer portals.
1748
+ *
1749
+ * @type {React.Component}
1750
+ */
1751
+ _this.portalManager = null;
1752
+ /**
1753
+ * Array containing the portals cashed to be rendered in bulk after Handsontable's render cycle.
1754
+ */
1755
+ _this.portalCacheArray = [];
1756
+ /**
1757
+ * Global editor portal cache.
1758
+ *
1759
+ * @private
1760
+ * @type {React.ReactPortal}
1761
+ */
1762
+ _this.globalEditorPortal = null;
1763
+ /**
1764
+ * The rendered cells cache.
1765
+ *
1766
+ * @private
1767
+ * @type {Map}
1768
+ */
1769
+ _this.renderedCellCache = new Map();
1770
+ /**
1771
+ * Editor cache.
1772
+ *
1773
+ * @private
1774
+ * @type {Map}
1775
+ */
1776
+ _this.editorCache = new Map();
1777
+ /**
1778
+ * Map with column indexes (or a string = 'global') as keys, and booleans as values. Each key represents a component-based editor
1779
+ * declared for the used column index, or a global one, if the key is the `global` string.
1780
+ *
1781
+ * @private
1782
+ * @type {Map}
1783
+ */
1784
+ _this.componentRendererColumns = new Map();
1785
+ addUnsafePrefixes(_assertThisInitialized(_this));
1786
+ return _this;
1787
+ }
1788
+ /**
1789
+ * Package version getter.
1790
+ *
1791
+ * @returns The version number of the package.
1792
+ */
1793
+ _createClass(HotTable, [{
1794
+ key: "hotInstance",
1795
+ get:
1796
+ /**
1797
+ * Getter for the property storing the Handsontable instance.
1798
+ */
1799
+ function get() {
1800
+ if (!this.__hotInstance || this.__hotInstance && !this.__hotInstance.isDestroyed) {
1801
+ // Will return the Handsontable instance or `null` if it's not yet been created.
1802
+ return this.__hotInstance;
1803
+ } else {
1804
+ console.warn(HOT_DESTROYED_WARNING);
1805
+ return null;
1806
+ }
1807
+ }
1808
+ /**
1809
+ * Setter for the property storing the Handsontable instance.
1810
+ * @param {Handsontable} hotInstance The Handsontable instance.
1811
+ */,
1812
+ set: function set(hotInstance) {
1813
+ this.__hotInstance = hotInstance;
1814
+ }
1815
+ /**
1816
+ * Get the rendered table cell cache.
1817
+ *
1818
+ * @returns {Map}
1819
+ */
1820
+ }, {
1821
+ key: "getRenderedCellCache",
1822
+ value: function getRenderedCellCache() {
1823
+ return this.renderedCellCache;
1824
+ }
1825
+ /**
1826
+ * Get the editor cache and return it.
1827
+ *
1828
+ * @returns {Map}
1829
+ */
1830
+ }, {
1831
+ key: "getEditorCache",
1832
+ value: function getEditorCache() {
1833
+ return this.editorCache;
1834
+ }
1835
+ /**
1836
+ * Get the global editor portal property.
1837
+ *
1838
+ * @return {React.ReactPortal} The global editor portal.
1839
+ */
1840
+ }, {
1841
+ key: "getGlobalEditorPortal",
1842
+ value: function getGlobalEditorPortal() {
1843
+ return this.globalEditorPortal;
1844
+ }
1845
+ /**
1846
+ * Set the private editor portal cache property.
1847
+ *
1848
+ * @param {React.ReactPortal} portal Global editor portal.
1849
+ */
1850
+ }, {
1851
+ key: "setGlobalEditorPortal",
1852
+ value: function setGlobalEditorPortal(portal) {
1853
+ this.globalEditorPortal = portal;
1854
+ }
1855
+ /**
1856
+ * Clear both the editor and the renderer cache.
1857
+ */
1858
+ }, {
1859
+ key: "clearCache",
1860
+ value: function clearCache() {
1861
+ var renderedCellCache = this.getRenderedCellCache();
1862
+ this.setGlobalEditorPortal(null);
1863
+ removeEditorContainers(this.getOwnerDocument());
1864
+ this.getEditorCache().clear();
1865
+ renderedCellCache.clear();
1866
+ this.componentRendererColumns.clear();
1867
+ }
1868
+ /**
1869
+ * Get the `Document` object corresponding to the main component element.
1870
+ *
1871
+ * @returns The `Document` object used by the component.
1872
+ */
1873
+ }, {
1874
+ key: "getOwnerDocument",
1875
+ value: function getOwnerDocument() {
1876
+ return this.hotElementRef ? this.hotElementRef.ownerDocument : document;
1877
+ }
1878
+ /**
1879
+ * Set the reference to the main Handsontable DOM element.
1880
+ *
1881
+ * @param {HTMLElement} element The main Handsontable DOM element.
1882
+ */
1883
+ }, {
1884
+ key: "setHotElementRef",
1885
+ value: function setHotElementRef(element) {
1886
+ this.hotElementRef = element;
1887
+ }
1888
+ /**
1889
+ * Return a renderer wrapper function for the provided renderer component.
1890
+ *
1891
+ * @param {React.ReactElement} rendererElement React renderer component.
1892
+ * @returns {Handsontable.renderers.Base} The Handsontable rendering function.
1893
+ */
1894
+ }, {
1895
+ key: "getRendererWrapper",
1896
+ value: function getRendererWrapper(rendererElement) {
1897
+ var hotTableComponent = this;
1898
+ return function (instance, TD, row, col, prop, value, cellProperties) {
1899
+ var renderedCellCache = hotTableComponent.getRenderedCellCache();
1900
+ if (renderedCellCache.has("".concat(row, "-").concat(col))) {
1901
+ TD.innerHTML = renderedCellCache.get("".concat(row, "-").concat(col)).innerHTML;
1902
+ }
1903
+ if (TD && !TD.getAttribute('ghost-table')) {
1904
+ var _createPortal = createPortal(rendererElement, {
1905
+ TD: TD,
1906
+ row: row,
1907
+ col: col,
1908
+ prop: prop,
1909
+ value: value,
1910
+ cellProperties: cellProperties,
1911
+ isRenderer: true
1912
+ }, function () {}, TD.ownerDocument),
1913
+ portal = _createPortal.portal,
1914
+ portalContainer = _createPortal.portalContainer;
1915
+ while (TD.firstChild) {
1916
+ TD.removeChild(TD.firstChild);
1917
+ }
1918
+ TD.appendChild(portalContainer);
1919
+ hotTableComponent.portalCacheArray.push(portal);
1920
+ }
1921
+ renderedCellCache.set("".concat(row, "-").concat(col), TD);
1922
+ return TD;
1923
+ };
1924
+ }
1925
+ /**
1926
+ * Create a fresh class to be used as an editor, based on the provided editor React element.
1927
+ *
1928
+ * @param {React.ReactElement} editorElement React editor component.
1929
+ * @param {string|number} [editorColumnScope] The editor scope (column index or a 'global' string). Defaults to
1930
+ * 'global'.
1931
+ * @returns {Function} A class to be passed to the Handsontable editor settings.
1932
+ */
1933
+ }, {
1934
+ key: "getEditorClass",
1935
+ value: function getEditorClass(editorElement) {
1936
+ var _editorCache$get;
1937
+ var editorColumnScope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : GLOBAL_EDITOR_SCOPE;
1938
+ var editorClass = getOriginalEditorClass(editorElement);
1939
+ var editorCache = this.getEditorCache();
1940
+ var cachedComponent = (_editorCache$get = editorCache.get(editorClass)) === null || _editorCache$get === void 0 ? void 0 : _editorCache$get.get(editorColumnScope);
1941
+ return this.makeEditorClass(cachedComponent);
1942
+ }
1943
+ /**
1944
+ * Create a class to be passed to the Handsontable's settings.
1945
+ *
1946
+ * @param {React.ReactElement} editorComponent React editor component.
1947
+ * @returns {Function} A class to be passed to the Handsontable editor settings.
1948
+ */
1949
+ }, {
1950
+ key: "makeEditorClass",
1951
+ value: function makeEditorClass(editorComponent) {
1952
+ var customEditorClass = /*#__PURE__*/function (_Handsontable$editors) {
1953
+ _inherits(CustomEditor, _Handsontable$editors);
1954
+ var _super2 = _createSuper(CustomEditor);
1955
+ function CustomEditor(hotInstance) {
1956
+ var _this2;
1957
+ _classCallCheck(this, CustomEditor);
1958
+ _this2 = _super2.call(this, hotInstance);
1959
+ editorComponent.hotCustomEditorInstance = _assertThisInitialized(_this2);
1960
+ _this2.editorComponent = editorComponent;
1961
+ return _this2;
1962
+ }
1963
+ _createClass(CustomEditor, [{
1964
+ key: "focus",
1965
+ value: function focus() {}
1966
+ }, {
1967
+ key: "getValue",
1968
+ value: function getValue() {}
1969
+ }, {
1970
+ key: "setValue",
1971
+ value: function setValue() {}
1972
+ }, {
1973
+ key: "open",
1974
+ value: function open() {}
1975
+ }, {
1976
+ key: "close",
1977
+ value: function close() {}
1978
+ }]);
1979
+ return CustomEditor;
1980
+ }(Handsontable__default["default"].editors.BaseEditor);
1981
+ // Fill with the rest of the BaseEditor methods
1982
+ Object.getOwnPropertyNames(Handsontable__default["default"].editors.BaseEditor.prototype).forEach(function (propName) {
1983
+ if (propName === 'constructor') {
1984
+ return;
1985
+ }
1986
+ customEditorClass.prototype[propName] = function () {
1987
+ var _editorComponent$prop;
1988
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1989
+ args[_key] = arguments[_key];
1990
+ }
1991
+ return (_editorComponent$prop = editorComponent[propName]).call.apply(_editorComponent$prop, [editorComponent].concat(args));
1992
+ };
1993
+ });
1994
+ return customEditorClass;
1995
+ }
1996
+ /**
1997
+ * Get the renderer element for the entire HotTable instance.
1998
+ *
1999
+ * @returns {React.ReactElement} React renderer component element.
2000
+ */
2001
+ }, {
2002
+ key: "getGlobalRendererElement",
2003
+ value: function getGlobalRendererElement() {
2004
+ var hotTableSlots = this.props.children;
2005
+ return getChildElementByType(hotTableSlots, 'hot-renderer');
2006
+ }
2007
+ /**
2008
+ * Get the editor element for the entire HotTable instance.
2009
+ *
2010
+ * @param {React.ReactNode} [children] Children of the HotTable instance. Defaults to `this.props.children`.
2011
+ * @returns {React.ReactElement} React editor component element.
2012
+ */
2013
+ }, {
2014
+ key: "getGlobalEditorElement",
2015
+ value: function getGlobalEditorElement() {
2016
+ var children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props.children;
2017
+ return getExtendedEditorElement(children, this.getEditorCache());
2018
+ }
2019
+ /**
2020
+ * Create the global editor portal and its destination HTML element if needed.
2021
+ *
2022
+ * @param {React.ReactNode} [children] Children of the HotTable instance. Defaults to `this.props.children`.
2023
+ */
2024
+ }, {
2025
+ key: "createGlobalEditorPortal",
2026
+ value: function createGlobalEditorPortal() {
2027
+ var children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props.children;
2028
+ var globalEditorElement = this.getGlobalEditorElement(children);
2029
+ if (globalEditorElement) {
2030
+ this.setGlobalEditorPortal(createEditorPortal(this.getOwnerDocument(), globalEditorElement, this.getEditorCache()));
2031
+ }
2032
+ }
2033
+ /**
2034
+ * Create a new settings object containing the column settings and global editors and renderers.
2035
+ *
2036
+ * @returns {Handsontable.GridSettings} New global set of settings for Handsontable.
2037
+ */
2038
+ }, {
2039
+ key: "createNewGlobalSettings",
2040
+ value: function createNewGlobalSettings() {
2041
+ var newSettings = SettingsMapper.getSettings(this.props);
2042
+ var globalRendererNode = this.getGlobalRendererElement();
2043
+ var globalEditorNode = this.getGlobalEditorElement();
2044
+ newSettings.columns = this.columnSettings.length ? this.columnSettings : newSettings.columns;
2045
+ if (globalEditorNode) {
2046
+ newSettings.editor = this.getEditorClass(globalEditorNode, GLOBAL_EDITOR_SCOPE);
2047
+ } else {
2048
+ newSettings.editor = this.props.editor || (this.props.settings ? this.props.settings.editor : void 0);
2049
+ }
2050
+ if (globalRendererNode) {
2051
+ newSettings.renderer = this.getRendererWrapper(globalRendererNode);
2052
+ this.componentRendererColumns.set('global', true);
2053
+ } else {
2054
+ newSettings.renderer = this.props.renderer || (this.props.settings ? this.props.settings.renderer : void 0);
2055
+ }
2056
+ return newSettings;
2057
+ }
2058
+ /**
2059
+ * Detect if `autoRowSize` or `autoColumnSize` is defined, and if so, throw an incompatibility warning.
2060
+ *
2061
+ * @param {Handsontable.GridSettings} newGlobalSettings New global settings passed as Handsontable config.
2062
+ */
2063
+ }, {
2064
+ key: "displayAutoSizeWarning",
2065
+ value: function displayAutoSizeWarning(newGlobalSettings) {
2066
+ var _this$hotInstance$get, _this$hotInstance$get2;
2067
+ if (this.hotInstance && ((_this$hotInstance$get = this.hotInstance.getPlugin('autoRowSize')) !== null && _this$hotInstance$get !== void 0 && _this$hotInstance$get.enabled || (_this$hotInstance$get2 = this.hotInstance.getPlugin('autoColumnSize')) !== null && _this$hotInstance$get2 !== void 0 && _this$hotInstance$get2.enabled)) {
2068
+ if (this.componentRendererColumns.size > 0) {
2069
+ warn(AUTOSIZE_WARNING);
2070
+ }
2071
+ }
2072
+ }
2073
+ /**
2074
+ * Sets the column settings based on information received from HotColumn.
2075
+ *
2076
+ * @param {HotTableProps} columnSettings Column settings object.
2077
+ * @param {Number} columnIndex Column index.
2078
+ */
2079
+ }, {
2080
+ key: "setHotColumnSettings",
2081
+ value: function setHotColumnSettings(columnSettings, columnIndex) {
2082
+ this.columnSettings[columnIndex] = columnSettings;
2083
+ }
2084
+ /**
2085
+ * Handsontable's `beforeViewRender` hook callback.
2086
+ */
2087
+ }, {
2088
+ key: "handsontableBeforeViewRender",
2089
+ value: function handsontableBeforeViewRender() {
2090
+ this.getRenderedCellCache().clear();
2091
+ }
2092
+ /**
2093
+ * Handsontable's `afterViewRender` hook callback.
2094
+ */
2095
+ }, {
2096
+ key: "handsontableAfterViewRender",
2097
+ value: function handsontableAfterViewRender() {
2098
+ var _this3 = this;
2099
+ this.portalManager.setState(function () {
2100
+ return Object.assign({}, {
2101
+ portals: _this3.portalCacheArray
2102
+ });
2103
+ }, function () {
2104
+ _this3.portalCacheArray.length = 0;
2105
+ });
2106
+ }
2107
+ /**
2108
+ * Call the `updateSettings` method for the Handsontable instance.
2109
+ *
2110
+ * @param {Object} newSettings The settings object.
2111
+ */
2112
+ }, {
2113
+ key: "updateHot",
2114
+ value: function updateHot(newSettings) {
2115
+ if (this.hotInstance) {
2116
+ this.hotInstance.updateSettings(newSettings, false);
2117
+ }
2118
+ }
2119
+ /**
2120
+ * Set the portal manager ref.
2121
+ *
2122
+ * @param {React.ReactComponent} pmComponent The PortalManager component.
2123
+ */
2124
+ }, {
2125
+ key: "setPortalManagerRef",
2126
+ value: function setPortalManagerRef(pmComponent) {
2127
+ this.portalManager = pmComponent;
2128
+ }
2129
+ /*
2130
+ ---------------------------------------
2131
+ ------- React lifecycle methods -------
2132
+ ---------------------------------------
2133
+ */
2134
+ /**
2135
+ * Logic performed before the mounting of the component.
2136
+ */
2137
+ }, {
2138
+ key: "componentWillMount",
2139
+ value: function componentWillMount() {
2140
+ this.clearCache();
2141
+ this.createGlobalEditorPortal();
2142
+ }
2143
+ /**
2144
+ * Initialize Handsontable after the component has mounted.
2145
+ */
2146
+ }, {
2147
+ key: "componentDidMount",
2148
+ value: function componentDidMount() {
2149
+ var hotTableComponent = this;
2150
+ var newGlobalSettings = this.createNewGlobalSettings();
2151
+ this.hotInstance = new Handsontable__default["default"].Core(this.hotElementRef, newGlobalSettings);
2152
+ this.hotInstance.addHook('beforeViewRender', function (isForced) {
2153
+ hotTableComponent.handsontableBeforeViewRender();
2154
+ });
2155
+ this.hotInstance.addHook('afterViewRender', function () {
2156
+ hotTableComponent.handsontableAfterViewRender();
2157
+ });
2158
+ // `init` missing in Handsontable's type definitions.
2159
+ this.hotInstance.init();
2160
+ this.displayAutoSizeWarning(newGlobalSettings);
2161
+ }
2162
+ /**
2163
+ * Logic performed before the component update.
2164
+ */
2165
+ }, {
2166
+ key: "componentWillUpdate",
2167
+ value: function componentWillUpdate(nextProps, nextState, nextContext) {
2168
+ this.clearCache();
2169
+ removeEditorContainers(this.getOwnerDocument());
2170
+ this.createGlobalEditorPortal(nextProps.children);
2171
+ }
2172
+ /**
2173
+ * Logic performed after the component update.
2174
+ */
2175
+ }, {
2176
+ key: "componentDidUpdate",
2177
+ value: function componentDidUpdate() {
2178
+ var newGlobalSettings = this.createNewGlobalSettings();
2179
+ this.updateHot(newGlobalSettings);
2180
+ this.displayAutoSizeWarning(newGlobalSettings);
2181
+ }
2182
+ /**
2183
+ * Destroy the Handsontable instance when the parent component unmounts.
2184
+ */
2185
+ }, {
2186
+ key: "componentWillUnmount",
2187
+ value: function componentWillUnmount() {
2188
+ if (this.hotInstance) {
2189
+ this.hotInstance.destroy();
2190
+ }
2191
+ removeEditorContainers(this.getOwnerDocument());
2192
+ }
2193
+ /**
2194
+ * Render the component.
2195
+ */
2196
+ }, {
2197
+ key: "render",
2198
+ value: function render() {
2199
+ var _this4 = this;
2200
+ var _getContainerAttribut = getContainerAttributesProps(this.props),
2201
+ id = _getContainerAttribut.id,
2202
+ className = _getContainerAttribut.className,
2203
+ style = _getContainerAttribut.style;
2204
+ var isHotColumn = function isHotColumn(childNode) {
2205
+ return childNode.type === HotColumn;
2206
+ };
2207
+ var children = React__default["default"].Children.toArray(this.props.children);
2208
+ // filter out anything that's not a HotColumn
2209
+ children = children.filter(function (childNode) {
2210
+ return isHotColumn(childNode);
2211
+ });
2212
+ // clone the HotColumn nodes and extend them with the callbacks
2213
+ var childClones = children.map(function (childNode, columnIndex) {
2214
+ return React__default["default"].cloneElement(childNode, {
2215
+ _componentRendererColumns: _this4.componentRendererColumns,
2216
+ _emitColumnSettings: _this4.setHotColumnSettings.bind(_this4),
2217
+ _columnIndex: columnIndex,
2218
+ _getChildElementByType: getChildElementByType.bind(_this4),
2219
+ _getRendererWrapper: _this4.getRendererWrapper.bind(_this4),
2220
+ _getEditorClass: _this4.getEditorClass.bind(_this4),
2221
+ _getOwnerDocument: _this4.getOwnerDocument.bind(_this4),
2222
+ _getEditorCache: _this4.getEditorCache.bind(_this4),
2223
+ children: childNode.props.children
2224
+ });
2225
+ });
2226
+ // add the global editor to the list of children
2227
+ childClones.push(this.getGlobalEditorPortal());
2228
+ return React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement("div", {
2229
+ ref: this.setHotElementRef.bind(this),
2230
+ id: id,
2231
+ className: className,
2232
+ style: style
2233
+ }, childClones), React__default["default"].createElement(PortalManager, {
2234
+ ref: this.setPortalManagerRef.bind(this)
2235
+ }));
2236
+ }
2237
+ }], [{
2238
+ key: "version",
2239
+ get: function get() {
2240
+ return version;
2241
+ }
2242
+ }]);
2243
+ return HotTable;
2244
+ }(React__default["default"].Component);
2245
+ /**
2246
+ * Prop types to be checked at runtime.
2247
+ */
2248
+ HotTable.propTypes = {
2249
+ style: PropTypes.object,
2250
+ id: PropTypes.string,
2251
+ className: PropTypes.string
2252
+ };
2253
+
2254
+ var BaseEditorComponent = /*#__PURE__*/function (_React$Component) {
2255
+ _inherits(BaseEditorComponent, _React$Component);
2256
+ var _super = _createSuper(BaseEditorComponent);
2257
+ function BaseEditorComponent(props) {
2258
+ var _this;
2259
+ _classCallCheck(this, BaseEditorComponent);
2260
+ _this = _super.call(this, props);
2261
+ _this.name = 'BaseEditorComponent';
2262
+ _this.instance = null;
2263
+ _this.row = null;
2264
+ _this.col = null;
2265
+ _this.prop = null;
2266
+ _this.TD = null;
2267
+ _this.originalValue = null;
2268
+ _this.cellProperties = null;
2269
+ _this.state = null;
2270
+ _this.hotInstance = null;
2271
+ _this.hotCustomEditorInstance = null;
2272
+ _this.hot = null;
2273
+ if (props.emitEditorInstance) {
2274
+ props.emitEditorInstance(_assertThisInitialized(_this), props.editorColumnScope);
2275
+ }
2276
+ return _this;
2277
+ }
2278
+ // BaseEditor methods:
2279
+ _createClass(BaseEditorComponent, [{
2280
+ key: "_fireCallbacks",
2281
+ value: function _fireCallbacks() {
2282
+ var _Handsontable$editors;
2283
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2284
+ args[_key] = arguments[_key];
2285
+ }
2286
+ (_Handsontable$editors = Handsontable__default["default"].editors.BaseEditor.prototype._fireCallbacks).call.apply(_Handsontable$editors, [this.hotCustomEditorInstance].concat(args));
2287
+ }
2288
+ }, {
2289
+ key: "beginEditing",
2290
+ value: function beginEditing() {
2291
+ var _Handsontable$editors2;
2292
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
2293
+ args[_key2] = arguments[_key2];
2294
+ }
2295
+ return (_Handsontable$editors2 = Handsontable__default["default"].editors.BaseEditor.prototype.beginEditing).call.apply(_Handsontable$editors2, [this.hotCustomEditorInstance].concat(args));
2296
+ }
2297
+ }, {
2298
+ key: "cancelChanges",
2299
+ value: function cancelChanges() {
2300
+ var _Handsontable$editors3;
2301
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
2302
+ args[_key3] = arguments[_key3];
2303
+ }
2304
+ return (_Handsontable$editors3 = Handsontable__default["default"].editors.BaseEditor.prototype.cancelChanges).call.apply(_Handsontable$editors3, [this.hotCustomEditorInstance].concat(args));
2305
+ }
2306
+ }, {
2307
+ key: "checkEditorSection",
2308
+ value: function checkEditorSection() {
2309
+ var _Handsontable$editors4;
2310
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
2311
+ args[_key4] = arguments[_key4];
2312
+ }
2313
+ return (_Handsontable$editors4 = Handsontable__default["default"].editors.BaseEditor.prototype.checkEditorSection).call.apply(_Handsontable$editors4, [this.hotCustomEditorInstance].concat(args));
2314
+ }
2315
+ }, {
2316
+ key: "close",
2317
+ value: function close() {
2318
+ var _Handsontable$editors5;
2319
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
2320
+ args[_key5] = arguments[_key5];
2321
+ }
2322
+ return (_Handsontable$editors5 = Handsontable__default["default"].editors.BaseEditor.prototype.close).call.apply(_Handsontable$editors5, [this.hotCustomEditorInstance].concat(args));
2323
+ }
2324
+ }, {
2325
+ key: "discardEditor",
2326
+ value: function discardEditor() {
2327
+ var _Handsontable$editors6;
2328
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
2329
+ args[_key6] = arguments[_key6];
2330
+ }
2331
+ return (_Handsontable$editors6 = Handsontable__default["default"].editors.BaseEditor.prototype.discardEditor).call.apply(_Handsontable$editors6, [this.hotCustomEditorInstance].concat(args));
2332
+ }
2333
+ }, {
2334
+ key: "enableFullEditMode",
2335
+ value: function enableFullEditMode() {
2336
+ var _Handsontable$editors7;
2337
+ for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
2338
+ args[_key7] = arguments[_key7];
2339
+ }
2340
+ return (_Handsontable$editors7 = Handsontable__default["default"].editors.BaseEditor.prototype.enableFullEditMode).call.apply(_Handsontable$editors7, [this.hotCustomEditorInstance].concat(args));
2341
+ }
2342
+ }, {
2343
+ key: "extend",
2344
+ value: function extend() {
2345
+ var _Handsontable$editors8;
2346
+ for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
2347
+ args[_key8] = arguments[_key8];
2348
+ }
2349
+ return (_Handsontable$editors8 = Handsontable__default["default"].editors.BaseEditor.prototype.extend).call.apply(_Handsontable$editors8, [this.hotCustomEditorInstance].concat(args));
2350
+ }
2351
+ }, {
2352
+ key: "finishEditing",
2353
+ value: function finishEditing() {
2354
+ var _Handsontable$editors9;
2355
+ for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
2356
+ args[_key9] = arguments[_key9];
2357
+ }
2358
+ return (_Handsontable$editors9 = Handsontable__default["default"].editors.BaseEditor.prototype.finishEditing).call.apply(_Handsontable$editors9, [this.hotCustomEditorInstance].concat(args));
2359
+ }
2360
+ }, {
2361
+ key: "focus",
2362
+ value: function focus() {
2363
+ var _Handsontable$editors10;
2364
+ for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
2365
+ args[_key10] = arguments[_key10];
2366
+ }
2367
+ return (_Handsontable$editors10 = Handsontable__default["default"].editors.BaseEditor.prototype.focus).call.apply(_Handsontable$editors10, [this.hotCustomEditorInstance].concat(args));
2368
+ }
2369
+ }, {
2370
+ key: "getValue",
2371
+ value: function getValue() {
2372
+ var _Handsontable$editors11;
2373
+ for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
2374
+ args[_key11] = arguments[_key11];
2375
+ }
2376
+ return (_Handsontable$editors11 = Handsontable__default["default"].editors.BaseEditor.prototype.getValue).call.apply(_Handsontable$editors11, [this.hotCustomEditorInstance].concat(args));
2377
+ }
2378
+ }, {
2379
+ key: "init",
2380
+ value: function init() {
2381
+ var _Handsontable$editors12;
2382
+ for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
2383
+ args[_key12] = arguments[_key12];
2384
+ }
2385
+ return (_Handsontable$editors12 = Handsontable__default["default"].editors.BaseEditor.prototype.init).call.apply(_Handsontable$editors12, [this.hotCustomEditorInstance].concat(args));
2386
+ }
2387
+ }, {
2388
+ key: "isInFullEditMode",
2389
+ value: function isInFullEditMode() {
2390
+ var _Handsontable$editors13;
2391
+ for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
2392
+ args[_key13] = arguments[_key13];
2393
+ }
2394
+ return (_Handsontable$editors13 = Handsontable__default["default"].editors.BaseEditor.prototype.isInFullEditMode).call.apply(_Handsontable$editors13, [this.hotCustomEditorInstance].concat(args));
2395
+ }
2396
+ }, {
2397
+ key: "isOpened",
2398
+ value: function isOpened() {
2399
+ var _Handsontable$editors14;
2400
+ for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
2401
+ args[_key14] = arguments[_key14];
2402
+ }
2403
+ return (_Handsontable$editors14 = Handsontable__default["default"].editors.BaseEditor.prototype.isOpened).call.apply(_Handsontable$editors14, [this.hotCustomEditorInstance].concat(args));
2404
+ }
2405
+ }, {
2406
+ key: "isWaiting",
2407
+ value: function isWaiting() {
2408
+ var _Handsontable$editors15;
2409
+ for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
2410
+ args[_key15] = arguments[_key15];
2411
+ }
2412
+ return (_Handsontable$editors15 = Handsontable__default["default"].editors.BaseEditor.prototype.isWaiting).call.apply(_Handsontable$editors15, [this.hotCustomEditorInstance].concat(args));
2413
+ }
2414
+ }, {
2415
+ key: "open",
2416
+ value: function open() {
2417
+ var _Handsontable$editors16;
2418
+ for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {
2419
+ args[_key16] = arguments[_key16];
2420
+ }
2421
+ return (_Handsontable$editors16 = Handsontable__default["default"].editors.BaseEditor.prototype.open).call.apply(_Handsontable$editors16, [this.hotCustomEditorInstance].concat(args));
2422
+ }
2423
+ }, {
2424
+ key: "prepare",
2425
+ value: function prepare(row, col, prop, TD, originalValue, cellProperties) {
2426
+ this.hotInstance = cellProperties.instance;
2427
+ this.row = row;
2428
+ this.col = col;
2429
+ this.prop = prop;
2430
+ this.TD = TD;
2431
+ this.originalValue = originalValue;
2432
+ this.cellProperties = cellProperties;
2433
+ return Handsontable__default["default"].editors.BaseEditor.prototype.prepare.call(this.hotCustomEditorInstance, row, col, prop, TD, originalValue, cellProperties);
2434
+ }
2435
+ }, {
2436
+ key: "saveValue",
2437
+ value: function saveValue() {
2438
+ var _Handsontable$editors17;
2439
+ for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {
2440
+ args[_key17] = arguments[_key17];
2441
+ }
2442
+ return (_Handsontable$editors17 = Handsontable__default["default"].editors.BaseEditor.prototype.saveValue).call.apply(_Handsontable$editors17, [this.hotCustomEditorInstance].concat(args));
2443
+ }
2444
+ }, {
2445
+ key: "setValue",
2446
+ value: function setValue() {
2447
+ var _Handsontable$editors18;
2448
+ for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {
2449
+ args[_key18] = arguments[_key18];
2450
+ }
2451
+ return (_Handsontable$editors18 = Handsontable__default["default"].editors.BaseEditor.prototype.setValue).call.apply(_Handsontable$editors18, [this.hotCustomEditorInstance].concat(args));
2452
+ }
2453
+ }, {
2454
+ key: "addHook",
2455
+ value: function addHook() {
2456
+ var _Handsontable$editors19;
2457
+ for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {
2458
+ args[_key19] = arguments[_key19];
2459
+ }
2460
+ return (_Handsontable$editors19 = Handsontable__default["default"].editors.BaseEditor.prototype.addHook).call.apply(_Handsontable$editors19, [this.hotCustomEditorInstance].concat(args));
2461
+ }
2462
+ }, {
2463
+ key: "removeHooksByKey",
2464
+ value: function removeHooksByKey() {
2465
+ var _Handsontable$editors20;
2466
+ for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {
2467
+ args[_key20] = arguments[_key20];
2468
+ }
2469
+ return (_Handsontable$editors20 = Handsontable__default["default"].editors.BaseEditor.prototype.removeHooksByKey).call.apply(_Handsontable$editors20, [this.hotCustomEditorInstance].concat(args));
2470
+ }
2471
+ }, {
2472
+ key: "clearHooks",
2473
+ value: function clearHooks() {
2474
+ var _Handsontable$editors21;
2475
+ for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {
2476
+ args[_key21] = arguments[_key21];
2477
+ }
2478
+ return (_Handsontable$editors21 = Handsontable__default["default"].editors.BaseEditor.prototype.clearHooks).call.apply(_Handsontable$editors21, [this.hotCustomEditorInstance].concat(args));
2479
+ }
2480
+ }, {
2481
+ key: "getEditedCell",
2482
+ value: function getEditedCell() {
2483
+ var _Handsontable$editors22;
2484
+ for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {
2485
+ args[_key22] = arguments[_key22];
2486
+ }
2487
+ return (_Handsontable$editors22 = Handsontable__default["default"].editors.BaseEditor.prototype.getEditedCell).call.apply(_Handsontable$editors22, [this.hotCustomEditorInstance].concat(args));
2488
+ }
2489
+ }, {
2490
+ key: "getEditedCellRect",
2491
+ value: function getEditedCellRect() {
2492
+ var _Handsontable$editors23;
2493
+ for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {
2494
+ args[_key23] = arguments[_key23];
2495
+ }
2496
+ return (_Handsontable$editors23 = Handsontable__default["default"].editors.BaseEditor.prototype.getEditedCellRect).call.apply(_Handsontable$editors23, [this.hotCustomEditorInstance].concat(args));
2497
+ }
2498
+ }, {
2499
+ key: "getEditedCellsZIndex",
2500
+ value: function getEditedCellsZIndex() {
2501
+ var _Handsontable$editors24;
2502
+ for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {
2503
+ args[_key24] = arguments[_key24];
2504
+ }
2505
+ return (_Handsontable$editors24 = Handsontable__default["default"].editors.BaseEditor.prototype.getEditedCellsZIndex).call.apply(_Handsontable$editors24, [this.hotCustomEditorInstance].concat(args));
2506
+ }
2507
+ }]);
2508
+ return BaseEditorComponent;
2509
+ }(React__default["default"].Component);
2510
+
2511
+ exports.BaseEditorComponent = BaseEditorComponent;
2512
+ exports.HotColumn = HotColumn;
2513
+ exports.HotTable = HotTable;
2514
+ exports["default"] = HotTable;