@para-ui/core 4.0.22 → 4.0.25

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.
Files changed (115) hide show
  1. package/AutoTips/index.js +24 -13
  2. package/Button/index.js +1 -1
  3. package/ButtonGroup/index.js +1 -1
  4. package/Cascader/index.js +7 -6
  5. package/ComboSelect/index.js +2 -2
  6. package/CopyText/index.js +1 -1
  7. package/CycleSelector/index.d.ts +14 -2
  8. package/CycleSelector/index.js +43 -4
  9. package/DatePicker/index.js +1 -1
  10. package/Descriptions/index.js +1 -1
  11. package/Desktop/index.js +1 -1
  12. package/Drawer/index.js +1 -1
  13. package/Dropdown/index.js +1 -1
  14. package/DynamicMultiBox/index.js +2 -2
  15. package/Empty/index.js +0 -6
  16. package/Form/index.js +11 -8
  17. package/FormItem/index.js +3 -3
  18. package/FunctionModal/index.js +3 -3
  19. package/Image/PreviewGroup.d.ts +20 -0
  20. package/Image/index.d.ts +10 -0
  21. package/Image/index.js +1485 -0
  22. package/InputLang/index.js +1 -1
  23. package/Modal/index.js +1 -1
  24. package/MultiBox/index.js +1 -1
  25. package/OperateBtn/index.js +1 -1
  26. package/PageHeader/index.js +1 -1
  27. package/Pagination/index.js +3 -3
  28. package/PopConfirm/index.js +1 -1
  29. package/Popover/index.js +1 -1
  30. package/Querying/index.js +0 -12
  31. package/QuickReply/index.js +1 -1
  32. package/README.md +20 -0
  33. package/Search/index.js +1 -1
  34. package/Select/index.d.ts +2 -0
  35. package/Select/index.js +27 -10
  36. package/SelectInput/index.js +1 -1
  37. package/Selector/index.js +1 -1
  38. package/SelectorPicker/index.js +1 -1
  39. package/SingleBox/index.js +1 -1
  40. package/Slider/index.js +29 -14
  41. package/Slider/interface.d.ts +4 -0
  42. package/Table/index.js +9 -3
  43. package/Tabs/index.js +1 -1
  44. package/TextField/index.js +5 -4
  45. package/TimePicker/index.js +1 -1
  46. package/ToggleButton/index.js +1 -1
  47. package/Transfer/index.js +50 -44
  48. package/Tree/index.js +2 -2
  49. package/Upload/ImgCrop/EasyCrop.d.ts +2 -2
  50. package/Upload/ImgCrop/constants.d.ts +12 -0
  51. package/Upload/ImgCrop/interface.d.ts +10 -0
  52. package/Upload/index.js +506 -128
  53. package/Upload/interface.d.ts +43 -0
  54. package/Upload/util.d.ts +7 -0
  55. package/_verture/Portal-5bd49559.js +1698 -0
  56. package/_verture/{index-066d47d4.js → index-5f205d87.js} +38 -1727
  57. package/_verture/{index-b892f976.js → index-93662604.js} +2 -2
  58. package/_verture/{index-389675ab.js → index-bde7aabe.js} +1 -1
  59. package/index.d.ts +2 -0
  60. package/index.js +18 -12
  61. package/locale/index.js +2 -2
  62. package/package.json +3 -2
  63. package/umd/AutoBox.js +1 -1
  64. package/umd/AutoTips.js +1 -1
  65. package/umd/Breadcrumbs.js +2 -2
  66. package/umd/Button.js +2 -2
  67. package/umd/ButtonGroup.js +2 -2
  68. package/umd/Cascader.js +1 -1
  69. package/umd/ComboSelect.js +3 -3
  70. package/umd/CopyText.js +2 -2
  71. package/umd/CycleSelector.js +3 -3
  72. package/umd/DatePicker.js +2 -2
  73. package/umd/Descriptions.js +2 -2
  74. package/umd/Desktop.js +2 -2
  75. package/umd/Drawer.js +2 -2
  76. package/umd/Dropdown.js +1 -1
  77. package/umd/DynamicMultiBox.js +3 -3
  78. package/umd/Empty.js +1 -1
  79. package/umd/Form.js +4 -4
  80. package/umd/FormItem.js +3 -3
  81. package/umd/FunctionModal.js +6 -6
  82. package/umd/Image.js +42 -0
  83. package/umd/InputLang.js +2 -2
  84. package/umd/Menu.js +1 -1
  85. package/umd/Modal.js +5 -5
  86. package/umd/MultiBox.js +2 -2
  87. package/umd/OperateBtn.js +4 -4
  88. package/umd/PageHeader.js +2 -2
  89. package/umd/Pagination.js +2 -2
  90. package/umd/PopConfirm.js +4 -4
  91. package/umd/PopMenu.js +2 -2
  92. package/umd/Popover.js +1 -1
  93. package/umd/Querying.js +1 -1
  94. package/umd/QuickReply.js +4 -4
  95. package/umd/Search.js +2 -2
  96. package/umd/Select.js +3 -3
  97. package/umd/SelectInput.js +2 -2
  98. package/umd/Selector.js +2 -2
  99. package/umd/SelectorPicker.js +5 -5
  100. package/umd/SingleBox.js +2 -2
  101. package/umd/Slider.js +2 -2
  102. package/umd/Stepper.js +1 -1
  103. package/umd/Table.js +6 -6
  104. package/umd/Tabs.js +4 -4
  105. package/umd/Tag.js +1 -1
  106. package/umd/TextField.js +3 -3
  107. package/umd/TimePicker.js +2 -2
  108. package/umd/Title.js +1 -1
  109. package/umd/ToggleButton.js +2 -2
  110. package/umd/Transfer.js +2 -2
  111. package/umd/Tree.js +1 -1
  112. package/umd/Upload.js +6 -6
  113. package/umd/locale.js +1 -1
  114. /package/_verture/{index-4b965dd7.js → index-0eca82dc.js} +0 -0
  115. /package/_verture/{modalContext-c8cc3107.js → modalContext-c57b51b7.js} +0 -0
@@ -0,0 +1,1698 @@
1
+ import { _ as _slicedToArray } from './slicedToArray-a8206399.js';
2
+ import * as React from 'react';
3
+ import { createPortal } from 'react-dom';
4
+ import { _ as _typeof } from './typeof-adeedc13.js';
5
+ import { _ as _toConsumableArray } from './toConsumableArray-8f4c9589.js';
6
+ import { _ as _defineProperty } from './defineProperty-6f62bb2a.js';
7
+
8
+ function _extends() {
9
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
10
+ for (var i = 1; i < arguments.length; i++) {
11
+ var source = arguments[i];
12
+ for (var key in source) {
13
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
14
+ target[key] = source[key];
15
+ }
16
+ }
17
+ }
18
+ return target;
19
+ };
20
+ return _extends.apply(this, arguments);
21
+ }
22
+
23
+ function ownKeys(e, r) {
24
+ var t = Object.keys(e);
25
+ if (Object.getOwnPropertySymbols) {
26
+ var o = Object.getOwnPropertySymbols(e);
27
+ r && (o = o.filter(function (r) {
28
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
29
+ })), t.push.apply(t, o);
30
+ }
31
+ return t;
32
+ }
33
+ function _objectSpread2(e) {
34
+ for (var r = 1; r < arguments.length; r++) {
35
+ var t = null != arguments[r] ? arguments[r] : {};
36
+ r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
37
+ _defineProperty(e, r, t[r]);
38
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
39
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
40
+ });
41
+ }
42
+ return e;
43
+ }
44
+
45
+ function _objectWithoutPropertiesLoose(source, excluded) {
46
+ if (source == null) return {};
47
+ var target = {};
48
+ for (var key in source) {
49
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
50
+ if (excluded.indexOf(key) >= 0) continue;
51
+ target[key] = source[key];
52
+ }
53
+ }
54
+ return target;
55
+ }
56
+
57
+ function _objectWithoutProperties(source, excluded) {
58
+ if (source == null) return {};
59
+ var target = _objectWithoutPropertiesLoose(source, excluded);
60
+ var key, i;
61
+ if (Object.getOwnPropertySymbols) {
62
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
63
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
64
+ key = sourceSymbolKeys[i];
65
+ if (excluded.indexOf(key) >= 0) continue;
66
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
67
+ target[key] = source[key];
68
+ }
69
+ }
70
+ return target;
71
+ }
72
+
73
+ function useEvent(callback) {
74
+ var fnRef = React.useRef();
75
+ fnRef.current = callback;
76
+ var memoFn = React.useCallback(function () {
77
+ var _fnRef$current;
78
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
79
+ args[_key] = arguments[_key];
80
+ }
81
+ return (_fnRef$current = fnRef.current) === null || _fnRef$current === void 0 ? void 0 : _fnRef$current.call.apply(_fnRef$current, [fnRef].concat(args));
82
+ }, []);
83
+ return memoFn;
84
+ }
85
+
86
+ function canUseDom() {
87
+ return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
88
+ }
89
+
90
+ /**
91
+ * Wrap `React.useLayoutEffect` which will not throw warning message in test env
92
+ */
93
+ var useInternalLayoutEffect = process.env.NODE_ENV !== 'test' && canUseDom() ? React.useLayoutEffect : React.useEffect;
94
+ var useLayoutEffect = function useLayoutEffect(callback, deps) {
95
+ var firstMountRef = React.useRef(true);
96
+ useInternalLayoutEffect(function () {
97
+ return callback(firstMountRef.current);
98
+ }, deps);
99
+
100
+ // We tell react that first mount has passed
101
+ useInternalLayoutEffect(function () {
102
+ firstMountRef.current = false;
103
+ return function () {
104
+ firstMountRef.current = true;
105
+ };
106
+ }, []);
107
+ };
108
+ var useLayoutUpdateEffect = function useLayoutUpdateEffect(callback, deps) {
109
+ useLayoutEffect(function (firstMount) {
110
+ if (!firstMount) {
111
+ return callback();
112
+ }
113
+ }, deps);
114
+ };
115
+
116
+ /**
117
+ * Same as React.useState but `setState` accept `ignoreDestroy` param to not to setState after destroyed.
118
+ * We do not make this auto is to avoid real memory leak.
119
+ * Developer should confirm it's safe to ignore themselves.
120
+ */
121
+ function useSafeState(defaultValue) {
122
+ var destroyRef = React.useRef(false);
123
+ var _React$useState = React.useState(defaultValue),
124
+ _React$useState2 = _slicedToArray(_React$useState, 2),
125
+ value = _React$useState2[0],
126
+ setValue = _React$useState2[1];
127
+ React.useEffect(function () {
128
+ destroyRef.current = false;
129
+ return function () {
130
+ destroyRef.current = true;
131
+ };
132
+ }, []);
133
+ function safeSetState(updater, ignoreDestroy) {
134
+ if (ignoreDestroy && destroyRef.current) {
135
+ return;
136
+ }
137
+ setValue(updater);
138
+ }
139
+ return [value, safeSetState];
140
+ }
141
+
142
+ /** We only think `undefined` is empty */
143
+ function hasValue(value) {
144
+ return value !== undefined;
145
+ }
146
+
147
+ /**
148
+ * Similar to `useState` but will use props value if provided.
149
+ * Note that internal use rc-util `useState` hook.
150
+ */
151
+ function useMergedState(defaultStateValue, option) {
152
+ var _ref = option || {},
153
+ defaultValue = _ref.defaultValue,
154
+ value = _ref.value,
155
+ onChange = _ref.onChange,
156
+ postState = _ref.postState;
157
+
158
+ // ======================= Init =======================
159
+ var _useState = useSafeState(function () {
160
+ if (hasValue(value)) {
161
+ return value;
162
+ } else if (hasValue(defaultValue)) {
163
+ return typeof defaultValue === 'function' ? defaultValue() : defaultValue;
164
+ } else {
165
+ return typeof defaultStateValue === 'function' ? defaultStateValue() : defaultStateValue;
166
+ }
167
+ }),
168
+ _useState2 = _slicedToArray(_useState, 2),
169
+ innerValue = _useState2[0],
170
+ setInnerValue = _useState2[1];
171
+ var mergedValue = value !== undefined ? value : innerValue;
172
+ var postMergedValue = postState ? postState(mergedValue) : mergedValue;
173
+
174
+ // ====================== Change ======================
175
+ var onChangeFn = useEvent(onChange);
176
+ var _useState3 = useSafeState([mergedValue]),
177
+ _useState4 = _slicedToArray(_useState3, 2),
178
+ prevValue = _useState4[0],
179
+ setPrevValue = _useState4[1];
180
+ useLayoutUpdateEffect(function () {
181
+ var prev = prevValue[0];
182
+ if (innerValue !== prev) {
183
+ onChangeFn(innerValue, prev);
184
+ }
185
+ }, [prevValue]);
186
+
187
+ // Sync value back to `undefined` when it from control to un-control
188
+ useLayoutUpdateEffect(function () {
189
+ if (!hasValue(value)) {
190
+ setInnerValue(value);
191
+ }
192
+ }, [value]);
193
+
194
+ // ====================== Update ======================
195
+ var triggerChange = useEvent(function (updater, ignoreDestroy) {
196
+ setInnerValue(updater, ignoreDestroy);
197
+ setPrevValue([mergedValue], ignoreDestroy);
198
+ });
199
+ return [postMergedValue, triggerChange];
200
+ }
201
+
202
+ /* eslint-disable no-console */
203
+ var warned = {};
204
+ var preWarningFns = [];
205
+
206
+ /**
207
+ * Pre warning enable you to parse content before console.error.
208
+ * Modify to null will prevent warning.
209
+ */
210
+ var preMessage = function preMessage(fn) {
211
+ preWarningFns.push(fn);
212
+ };
213
+
214
+ /**
215
+ * Warning if condition not match.
216
+ * @param valid Condition
217
+ * @param message Warning message
218
+ * @example
219
+ * ```js
220
+ * warning(false, 'some error'); // print some error
221
+ * warning(true, 'some error'); // print nothing
222
+ * warning(1 === 2, 'some error'); // print some error
223
+ * ```
224
+ */
225
+ function warning(valid, message) {
226
+ if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
227
+ var finalMessage = preWarningFns.reduce(function (msg, preMessageFn) {
228
+ return preMessageFn(msg !== null && msg !== void 0 ? msg : '', 'warning');
229
+ }, message);
230
+ if (finalMessage) {
231
+ console.error("Warning: ".concat(finalMessage));
232
+ }
233
+ }
234
+ }
235
+
236
+ /** @see Similar to {@link warning} */
237
+ function note(valid, message) {
238
+ if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
239
+ var finalMessage = preWarningFns.reduce(function (msg, preMessageFn) {
240
+ return preMessageFn(msg !== null && msg !== void 0 ? msg : '', 'note');
241
+ }, message);
242
+ if (finalMessage) {
243
+ console.warn("Note: ".concat(finalMessage));
244
+ }
245
+ }
246
+ }
247
+ function resetWarned() {
248
+ warned = {};
249
+ }
250
+ function call(method, valid, message) {
251
+ if (!valid && !warned[message]) {
252
+ method(false, message);
253
+ warned[message] = true;
254
+ }
255
+ }
256
+
257
+ /** @see Same as {@link warning}, but only warn once for the same message */
258
+ function warningOnce(valid, message) {
259
+ call(warning, valid, message);
260
+ }
261
+
262
+ /** @see Same as {@link warning}, but only warn once for the same message */
263
+ function noteOnce(valid, message) {
264
+ call(note, valid, message);
265
+ }
266
+ warningOnce.preMessage = preMessage;
267
+ warningOnce.resetWarned = resetWarned;
268
+ warningOnce.noteOnce = noteOnce;
269
+
270
+ var classnames = {exports: {}};
271
+
272
+ /*!
273
+ Copyright (c) 2018 Jed Watson.
274
+ Licensed under the MIT License (MIT), see
275
+ http://jedwatson.github.io/classnames
276
+ */
277
+
278
+ (function (module) {
279
+ /* global define */
280
+
281
+ (function () {
282
+
283
+ var hasOwn = {}.hasOwnProperty;
284
+
285
+ function classNames () {
286
+ var classes = '';
287
+
288
+ for (var i = 0; i < arguments.length; i++) {
289
+ var arg = arguments[i];
290
+ if (arg) {
291
+ classes = appendClass(classes, parseValue(arg));
292
+ }
293
+ }
294
+
295
+ return classes;
296
+ }
297
+
298
+ function parseValue (arg) {
299
+ if (typeof arg === 'string' || typeof arg === 'number') {
300
+ return arg;
301
+ }
302
+
303
+ if (typeof arg !== 'object') {
304
+ return '';
305
+ }
306
+
307
+ if (Array.isArray(arg)) {
308
+ return classNames.apply(null, arg);
309
+ }
310
+
311
+ if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
312
+ return arg.toString();
313
+ }
314
+
315
+ var classes = '';
316
+
317
+ for (var key in arg) {
318
+ if (hasOwn.call(arg, key) && arg[key]) {
319
+ classes = appendClass(classes, key);
320
+ }
321
+ }
322
+
323
+ return classes;
324
+ }
325
+
326
+ function appendClass (value, newClass) {
327
+ if (!newClass) {
328
+ return value;
329
+ }
330
+
331
+ if (value) {
332
+ return value + ' ' + newClass;
333
+ }
334
+
335
+ return value + newClass;
336
+ }
337
+
338
+ if (module.exports) {
339
+ classNames.default = classNames;
340
+ module.exports = classNames;
341
+ } else {
342
+ window.classNames = classNames;
343
+ }
344
+ }());
345
+ } (classnames));
346
+
347
+ var clsx = classnames.exports;
348
+
349
+ /**
350
+ * @ignore
351
+ * some key-codes definition and utils from closure-library
352
+ * @author yiminghe@gmail.com
353
+ */
354
+
355
+ var KeyCode = {
356
+ /**
357
+ * MAC_ENTER
358
+ */
359
+ MAC_ENTER: 3,
360
+ /**
361
+ * BACKSPACE
362
+ */
363
+ BACKSPACE: 8,
364
+ /**
365
+ * TAB
366
+ */
367
+ TAB: 9,
368
+ /**
369
+ * NUMLOCK on FF/Safari Mac
370
+ */
371
+ NUM_CENTER: 12,
372
+ // NUMLOCK on FF/Safari Mac
373
+ /**
374
+ * ENTER
375
+ */
376
+ ENTER: 13,
377
+ /**
378
+ * SHIFT
379
+ */
380
+ SHIFT: 16,
381
+ /**
382
+ * CTRL
383
+ */
384
+ CTRL: 17,
385
+ /**
386
+ * ALT
387
+ */
388
+ ALT: 18,
389
+ /**
390
+ * PAUSE
391
+ */
392
+ PAUSE: 19,
393
+ /**
394
+ * CAPS_LOCK
395
+ */
396
+ CAPS_LOCK: 20,
397
+ /**
398
+ * ESC
399
+ */
400
+ ESC: 27,
401
+ /**
402
+ * SPACE
403
+ */
404
+ SPACE: 32,
405
+ /**
406
+ * PAGE_UP
407
+ */
408
+ PAGE_UP: 33,
409
+ // also NUM_NORTH_EAST
410
+ /**
411
+ * PAGE_DOWN
412
+ */
413
+ PAGE_DOWN: 34,
414
+ // also NUM_SOUTH_EAST
415
+ /**
416
+ * END
417
+ */
418
+ END: 35,
419
+ // also NUM_SOUTH_WEST
420
+ /**
421
+ * HOME
422
+ */
423
+ HOME: 36,
424
+ // also NUM_NORTH_WEST
425
+ /**
426
+ * LEFT
427
+ */
428
+ LEFT: 37,
429
+ // also NUM_WEST
430
+ /**
431
+ * UP
432
+ */
433
+ UP: 38,
434
+ // also NUM_NORTH
435
+ /**
436
+ * RIGHT
437
+ */
438
+ RIGHT: 39,
439
+ // also NUM_EAST
440
+ /**
441
+ * DOWN
442
+ */
443
+ DOWN: 40,
444
+ // also NUM_SOUTH
445
+ /**
446
+ * PRINT_SCREEN
447
+ */
448
+ PRINT_SCREEN: 44,
449
+ /**
450
+ * INSERT
451
+ */
452
+ INSERT: 45,
453
+ // also NUM_INSERT
454
+ /**
455
+ * DELETE
456
+ */
457
+ DELETE: 46,
458
+ // also NUM_DELETE
459
+ /**
460
+ * ZERO
461
+ */
462
+ ZERO: 48,
463
+ /**
464
+ * ONE
465
+ */
466
+ ONE: 49,
467
+ /**
468
+ * TWO
469
+ */
470
+ TWO: 50,
471
+ /**
472
+ * THREE
473
+ */
474
+ THREE: 51,
475
+ /**
476
+ * FOUR
477
+ */
478
+ FOUR: 52,
479
+ /**
480
+ * FIVE
481
+ */
482
+ FIVE: 53,
483
+ /**
484
+ * SIX
485
+ */
486
+ SIX: 54,
487
+ /**
488
+ * SEVEN
489
+ */
490
+ SEVEN: 55,
491
+ /**
492
+ * EIGHT
493
+ */
494
+ EIGHT: 56,
495
+ /**
496
+ * NINE
497
+ */
498
+ NINE: 57,
499
+ /**
500
+ * QUESTION_MARK
501
+ */
502
+ QUESTION_MARK: 63,
503
+ // needs localization
504
+ /**
505
+ * A
506
+ */
507
+ A: 65,
508
+ /**
509
+ * B
510
+ */
511
+ B: 66,
512
+ /**
513
+ * C
514
+ */
515
+ C: 67,
516
+ /**
517
+ * D
518
+ */
519
+ D: 68,
520
+ /**
521
+ * E
522
+ */
523
+ E: 69,
524
+ /**
525
+ * F
526
+ */
527
+ F: 70,
528
+ /**
529
+ * G
530
+ */
531
+ G: 71,
532
+ /**
533
+ * H
534
+ */
535
+ H: 72,
536
+ /**
537
+ * I
538
+ */
539
+ I: 73,
540
+ /**
541
+ * J
542
+ */
543
+ J: 74,
544
+ /**
545
+ * K
546
+ */
547
+ K: 75,
548
+ /**
549
+ * L
550
+ */
551
+ L: 76,
552
+ /**
553
+ * M
554
+ */
555
+ M: 77,
556
+ /**
557
+ * N
558
+ */
559
+ N: 78,
560
+ /**
561
+ * O
562
+ */
563
+ O: 79,
564
+ /**
565
+ * P
566
+ */
567
+ P: 80,
568
+ /**
569
+ * Q
570
+ */
571
+ Q: 81,
572
+ /**
573
+ * R
574
+ */
575
+ R: 82,
576
+ /**
577
+ * S
578
+ */
579
+ S: 83,
580
+ /**
581
+ * T
582
+ */
583
+ T: 84,
584
+ /**
585
+ * U
586
+ */
587
+ U: 85,
588
+ /**
589
+ * V
590
+ */
591
+ V: 86,
592
+ /**
593
+ * W
594
+ */
595
+ W: 87,
596
+ /**
597
+ * X
598
+ */
599
+ X: 88,
600
+ /**
601
+ * Y
602
+ */
603
+ Y: 89,
604
+ /**
605
+ * Z
606
+ */
607
+ Z: 90,
608
+ /**
609
+ * META
610
+ */
611
+ META: 91,
612
+ // WIN_KEY_LEFT
613
+ /**
614
+ * WIN_KEY_RIGHT
615
+ */
616
+ WIN_KEY_RIGHT: 92,
617
+ /**
618
+ * CONTEXT_MENU
619
+ */
620
+ CONTEXT_MENU: 93,
621
+ /**
622
+ * NUM_ZERO
623
+ */
624
+ NUM_ZERO: 96,
625
+ /**
626
+ * NUM_ONE
627
+ */
628
+ NUM_ONE: 97,
629
+ /**
630
+ * NUM_TWO
631
+ */
632
+ NUM_TWO: 98,
633
+ /**
634
+ * NUM_THREE
635
+ */
636
+ NUM_THREE: 99,
637
+ /**
638
+ * NUM_FOUR
639
+ */
640
+ NUM_FOUR: 100,
641
+ /**
642
+ * NUM_FIVE
643
+ */
644
+ NUM_FIVE: 101,
645
+ /**
646
+ * NUM_SIX
647
+ */
648
+ NUM_SIX: 102,
649
+ /**
650
+ * NUM_SEVEN
651
+ */
652
+ NUM_SEVEN: 103,
653
+ /**
654
+ * NUM_EIGHT
655
+ */
656
+ NUM_EIGHT: 104,
657
+ /**
658
+ * NUM_NINE
659
+ */
660
+ NUM_NINE: 105,
661
+ /**
662
+ * NUM_MULTIPLY
663
+ */
664
+ NUM_MULTIPLY: 106,
665
+ /**
666
+ * NUM_PLUS
667
+ */
668
+ NUM_PLUS: 107,
669
+ /**
670
+ * NUM_MINUS
671
+ */
672
+ NUM_MINUS: 109,
673
+ /**
674
+ * NUM_PERIOD
675
+ */
676
+ NUM_PERIOD: 110,
677
+ /**
678
+ * NUM_DIVISION
679
+ */
680
+ NUM_DIVISION: 111,
681
+ /**
682
+ * F1
683
+ */
684
+ F1: 112,
685
+ /**
686
+ * F2
687
+ */
688
+ F2: 113,
689
+ /**
690
+ * F3
691
+ */
692
+ F3: 114,
693
+ /**
694
+ * F4
695
+ */
696
+ F4: 115,
697
+ /**
698
+ * F5
699
+ */
700
+ F5: 116,
701
+ /**
702
+ * F6
703
+ */
704
+ F6: 117,
705
+ /**
706
+ * F7
707
+ */
708
+ F7: 118,
709
+ /**
710
+ * F8
711
+ */
712
+ F8: 119,
713
+ /**
714
+ * F9
715
+ */
716
+ F9: 120,
717
+ /**
718
+ * F10
719
+ */
720
+ F10: 121,
721
+ /**
722
+ * F11
723
+ */
724
+ F11: 122,
725
+ /**
726
+ * F12
727
+ */
728
+ F12: 123,
729
+ /**
730
+ * NUMLOCK
731
+ */
732
+ NUMLOCK: 144,
733
+ /**
734
+ * SEMICOLON
735
+ */
736
+ SEMICOLON: 186,
737
+ // needs localization
738
+ /**
739
+ * DASH
740
+ */
741
+ DASH: 189,
742
+ // needs localization
743
+ /**
744
+ * EQUALS
745
+ */
746
+ EQUALS: 187,
747
+ // needs localization
748
+ /**
749
+ * COMMA
750
+ */
751
+ COMMA: 188,
752
+ // needs localization
753
+ /**
754
+ * PERIOD
755
+ */
756
+ PERIOD: 190,
757
+ // needs localization
758
+ /**
759
+ * SLASH
760
+ */
761
+ SLASH: 191,
762
+ // needs localization
763
+ /**
764
+ * APOSTROPHE
765
+ */
766
+ APOSTROPHE: 192,
767
+ // needs localization
768
+ /**
769
+ * SINGLE_QUOTE
770
+ */
771
+ SINGLE_QUOTE: 222,
772
+ // needs localization
773
+ /**
774
+ * OPEN_SQUARE_BRACKET
775
+ */
776
+ OPEN_SQUARE_BRACKET: 219,
777
+ // needs localization
778
+ /**
779
+ * BACKSLASH
780
+ */
781
+ BACKSLASH: 220,
782
+ // needs localization
783
+ /**
784
+ * CLOSE_SQUARE_BRACKET
785
+ */
786
+ CLOSE_SQUARE_BRACKET: 221,
787
+ // needs localization
788
+ /**
789
+ * WIN_KEY
790
+ */
791
+ WIN_KEY: 224,
792
+ /**
793
+ * MAC_FF_META
794
+ */
795
+ MAC_FF_META: 224,
796
+ // Firefox (Gecko) fires this for the meta key instead of 91
797
+ /**
798
+ * WIN_IME
799
+ */
800
+ WIN_IME: 229,
801
+ // ======================== Function ========================
802
+ /**
803
+ * whether text and modified key is entered at the same time.
804
+ */
805
+ isTextModifyingKeyEvent: function isTextModifyingKeyEvent(e) {
806
+ var keyCode = e.keyCode;
807
+ if (e.altKey && !e.ctrlKey || e.metaKey ||
808
+ // Function keys don't generate text
809
+ keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) {
810
+ return false;
811
+ }
812
+
813
+ // The following keys are quite harmless, even in combination with
814
+ // CTRL, ALT or SHIFT.
815
+ switch (keyCode) {
816
+ case KeyCode.ALT:
817
+ case KeyCode.CAPS_LOCK:
818
+ case KeyCode.CONTEXT_MENU:
819
+ case KeyCode.CTRL:
820
+ case KeyCode.DOWN:
821
+ case KeyCode.END:
822
+ case KeyCode.ESC:
823
+ case KeyCode.HOME:
824
+ case KeyCode.INSERT:
825
+ case KeyCode.LEFT:
826
+ case KeyCode.MAC_FF_META:
827
+ case KeyCode.META:
828
+ case KeyCode.NUMLOCK:
829
+ case KeyCode.NUM_CENTER:
830
+ case KeyCode.PAGE_DOWN:
831
+ case KeyCode.PAGE_UP:
832
+ case KeyCode.PAUSE:
833
+ case KeyCode.PRINT_SCREEN:
834
+ case KeyCode.RIGHT:
835
+ case KeyCode.SHIFT:
836
+ case KeyCode.UP:
837
+ case KeyCode.WIN_KEY:
838
+ case KeyCode.WIN_KEY_RIGHT:
839
+ return false;
840
+ default:
841
+ return true;
842
+ }
843
+ },
844
+ /**
845
+ * whether character is entered.
846
+ */
847
+ isCharacterKey: function isCharacterKey(keyCode) {
848
+ if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) {
849
+ return true;
850
+ }
851
+ if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) {
852
+ return true;
853
+ }
854
+ if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) {
855
+ return true;
856
+ }
857
+
858
+ // Safari sends zero key code for non-latin characters.
859
+ if (window.navigator.userAgent.indexOf('WebKit') !== -1 && keyCode === 0) {
860
+ return true;
861
+ }
862
+ switch (keyCode) {
863
+ case KeyCode.SPACE:
864
+ case KeyCode.QUESTION_MARK:
865
+ case KeyCode.NUM_PLUS:
866
+ case KeyCode.NUM_MINUS:
867
+ case KeyCode.NUM_PERIOD:
868
+ case KeyCode.NUM_DIVISION:
869
+ case KeyCode.SEMICOLON:
870
+ case KeyCode.DASH:
871
+ case KeyCode.EQUALS:
872
+ case KeyCode.COMMA:
873
+ case KeyCode.PERIOD:
874
+ case KeyCode.SLASH:
875
+ case KeyCode.APOSTROPHE:
876
+ case KeyCode.SINGLE_QUOTE:
877
+ case KeyCode.OPEN_SQUARE_BRACKET:
878
+ case KeyCode.BACKSLASH:
879
+ case KeyCode.CLOSE_SQUARE_BRACKET:
880
+ return true;
881
+ default:
882
+ return false;
883
+ }
884
+ }
885
+ };
886
+
887
+ var reactIs = {exports: {}};
888
+
889
+ var reactIs_production_min = {};
890
+
891
+ /**
892
+ * @license React
893
+ * react-is.production.min.js
894
+ *
895
+ * Copyright (c) Facebook, Inc. and its affiliates.
896
+ *
897
+ * This source code is licensed under the MIT license found in the
898
+ * LICENSE file in the root directory of this source tree.
899
+ */
900
+
901
+ var hasRequiredReactIs_production_min;
902
+
903
+ function requireReactIs_production_min () {
904
+ if (hasRequiredReactIs_production_min) return reactIs_production_min;
905
+ hasRequiredReactIs_production_min = 1;
906
+ var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),h=Symbol.for("react.context"),k=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),u;u=Symbol.for("react.module.reference");
907
+ function v(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}reactIs_production_min.ContextConsumer=h;reactIs_production_min.ContextProvider=g;reactIs_production_min.Element=b;reactIs_production_min.ForwardRef=l;reactIs_production_min.Fragment=d;reactIs_production_min.Lazy=q;reactIs_production_min.Memo=p;reactIs_production_min.Portal=c;reactIs_production_min.Profiler=f;reactIs_production_min.StrictMode=e;reactIs_production_min.Suspense=m;
908
+ reactIs_production_min.SuspenseList=n;reactIs_production_min.isAsyncMode=function(){return !1};reactIs_production_min.isConcurrentMode=function(){return !1};reactIs_production_min.isContextConsumer=function(a){return v(a)===h};reactIs_production_min.isContextProvider=function(a){return v(a)===g};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===b};reactIs_production_min.isForwardRef=function(a){return v(a)===l};reactIs_production_min.isFragment=function(a){return v(a)===d};reactIs_production_min.isLazy=function(a){return v(a)===q};reactIs_production_min.isMemo=function(a){return v(a)===p};
909
+ reactIs_production_min.isPortal=function(a){return v(a)===c};reactIs_production_min.isProfiler=function(a){return v(a)===f};reactIs_production_min.isStrictMode=function(a){return v(a)===e};reactIs_production_min.isSuspense=function(a){return v(a)===m};reactIs_production_min.isSuspenseList=function(a){return v(a)===n};
910
+ reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1};reactIs_production_min.typeOf=v;
911
+ return reactIs_production_min;
912
+ }
913
+
914
+ var reactIs_development = {};
915
+
916
+ /**
917
+ * @license React
918
+ * react-is.development.js
919
+ *
920
+ * Copyright (c) Facebook, Inc. and its affiliates.
921
+ *
922
+ * This source code is licensed under the MIT license found in the
923
+ * LICENSE file in the root directory of this source tree.
924
+ */
925
+
926
+ var hasRequiredReactIs_development;
927
+
928
+ function requireReactIs_development () {
929
+ if (hasRequiredReactIs_development) return reactIs_development;
930
+ hasRequiredReactIs_development = 1;
931
+
932
+ if (process.env.NODE_ENV !== "production") {
933
+ (function() {
934
+
935
+ // ATTENTION
936
+ // When adding new symbols to this file,
937
+ // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
938
+ // The Symbol used to tag the ReactElement-like types.
939
+ var REACT_ELEMENT_TYPE = Symbol.for('react.element');
940
+ var REACT_PORTAL_TYPE = Symbol.for('react.portal');
941
+ var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
942
+ var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
943
+ var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
944
+ var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
945
+ var REACT_CONTEXT_TYPE = Symbol.for('react.context');
946
+ var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context');
947
+ var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
948
+ var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
949
+ var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
950
+ var REACT_MEMO_TYPE = Symbol.for('react.memo');
951
+ var REACT_LAZY_TYPE = Symbol.for('react.lazy');
952
+ var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
953
+
954
+ // -----------------------------------------------------------------------------
955
+
956
+ var enableScopeAPI = false; // Experimental Create Event Handle API.
957
+ var enableCacheElement = false;
958
+ var enableTransitionTracing = false; // No known bugs, but needs performance testing
959
+
960
+ var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
961
+ // stuff. Intended to enable React core members to more easily debug scheduling
962
+ // issues in DEV builds.
963
+
964
+ var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
965
+
966
+ var REACT_MODULE_REFERENCE;
967
+
968
+ {
969
+ REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
970
+ }
971
+
972
+ function isValidElementType(type) {
973
+ if (typeof type === 'string' || typeof type === 'function') {
974
+ return true;
975
+ } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
976
+
977
+
978
+ if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
979
+ return true;
980
+ }
981
+
982
+ if (typeof type === 'object' && type !== null) {
983
+ if (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 || // This needs to include all possible module reference object
984
+ // types supported by any Flight configuration anywhere since
985
+ // we don't know which Flight build this will end up being used
986
+ // with.
987
+ type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
988
+ return true;
989
+ }
990
+ }
991
+
992
+ return false;
993
+ }
994
+
995
+ function typeOf(object) {
996
+ if (typeof object === 'object' && object !== null) {
997
+ var $$typeof = object.$$typeof;
998
+
999
+ switch ($$typeof) {
1000
+ case REACT_ELEMENT_TYPE:
1001
+ var type = object.type;
1002
+
1003
+ switch (type) {
1004
+ case REACT_FRAGMENT_TYPE:
1005
+ case REACT_PROFILER_TYPE:
1006
+ case REACT_STRICT_MODE_TYPE:
1007
+ case REACT_SUSPENSE_TYPE:
1008
+ case REACT_SUSPENSE_LIST_TYPE:
1009
+ return type;
1010
+
1011
+ default:
1012
+ var $$typeofType = type && type.$$typeof;
1013
+
1014
+ switch ($$typeofType) {
1015
+ case REACT_SERVER_CONTEXT_TYPE:
1016
+ case REACT_CONTEXT_TYPE:
1017
+ case REACT_FORWARD_REF_TYPE:
1018
+ case REACT_LAZY_TYPE:
1019
+ case REACT_MEMO_TYPE:
1020
+ case REACT_PROVIDER_TYPE:
1021
+ return $$typeofType;
1022
+
1023
+ default:
1024
+ return $$typeof;
1025
+ }
1026
+
1027
+ }
1028
+
1029
+ case REACT_PORTAL_TYPE:
1030
+ return $$typeof;
1031
+ }
1032
+ }
1033
+
1034
+ return undefined;
1035
+ }
1036
+ var ContextConsumer = REACT_CONTEXT_TYPE;
1037
+ var ContextProvider = REACT_PROVIDER_TYPE;
1038
+ var Element = REACT_ELEMENT_TYPE;
1039
+ var ForwardRef = REACT_FORWARD_REF_TYPE;
1040
+ var Fragment = REACT_FRAGMENT_TYPE;
1041
+ var Lazy = REACT_LAZY_TYPE;
1042
+ var Memo = REACT_MEMO_TYPE;
1043
+ var Portal = REACT_PORTAL_TYPE;
1044
+ var Profiler = REACT_PROFILER_TYPE;
1045
+ var StrictMode = REACT_STRICT_MODE_TYPE;
1046
+ var Suspense = REACT_SUSPENSE_TYPE;
1047
+ var SuspenseList = REACT_SUSPENSE_LIST_TYPE;
1048
+ var hasWarnedAboutDeprecatedIsAsyncMode = false;
1049
+ var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated
1050
+
1051
+ function isAsyncMode(object) {
1052
+ {
1053
+ if (!hasWarnedAboutDeprecatedIsAsyncMode) {
1054
+ hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
1055
+
1056
+ console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
1057
+ }
1058
+ }
1059
+
1060
+ return false;
1061
+ }
1062
+ function isConcurrentMode(object) {
1063
+ {
1064
+ if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
1065
+ hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint
1066
+
1067
+ console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
1068
+ }
1069
+ }
1070
+
1071
+ return false;
1072
+ }
1073
+ function isContextConsumer(object) {
1074
+ return typeOf(object) === REACT_CONTEXT_TYPE;
1075
+ }
1076
+ function isContextProvider(object) {
1077
+ return typeOf(object) === REACT_PROVIDER_TYPE;
1078
+ }
1079
+ function isElement(object) {
1080
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1081
+ }
1082
+ function isForwardRef(object) {
1083
+ return typeOf(object) === REACT_FORWARD_REF_TYPE;
1084
+ }
1085
+ function isFragment(object) {
1086
+ return typeOf(object) === REACT_FRAGMENT_TYPE;
1087
+ }
1088
+ function isLazy(object) {
1089
+ return typeOf(object) === REACT_LAZY_TYPE;
1090
+ }
1091
+ function isMemo(object) {
1092
+ return typeOf(object) === REACT_MEMO_TYPE;
1093
+ }
1094
+ function isPortal(object) {
1095
+ return typeOf(object) === REACT_PORTAL_TYPE;
1096
+ }
1097
+ function isProfiler(object) {
1098
+ return typeOf(object) === REACT_PROFILER_TYPE;
1099
+ }
1100
+ function isStrictMode(object) {
1101
+ return typeOf(object) === REACT_STRICT_MODE_TYPE;
1102
+ }
1103
+ function isSuspense(object) {
1104
+ return typeOf(object) === REACT_SUSPENSE_TYPE;
1105
+ }
1106
+ function isSuspenseList(object) {
1107
+ return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
1108
+ }
1109
+
1110
+ reactIs_development.ContextConsumer = ContextConsumer;
1111
+ reactIs_development.ContextProvider = ContextProvider;
1112
+ reactIs_development.Element = Element;
1113
+ reactIs_development.ForwardRef = ForwardRef;
1114
+ reactIs_development.Fragment = Fragment;
1115
+ reactIs_development.Lazy = Lazy;
1116
+ reactIs_development.Memo = Memo;
1117
+ reactIs_development.Portal = Portal;
1118
+ reactIs_development.Profiler = Profiler;
1119
+ reactIs_development.StrictMode = StrictMode;
1120
+ reactIs_development.Suspense = Suspense;
1121
+ reactIs_development.SuspenseList = SuspenseList;
1122
+ reactIs_development.isAsyncMode = isAsyncMode;
1123
+ reactIs_development.isConcurrentMode = isConcurrentMode;
1124
+ reactIs_development.isContextConsumer = isContextConsumer;
1125
+ reactIs_development.isContextProvider = isContextProvider;
1126
+ reactIs_development.isElement = isElement;
1127
+ reactIs_development.isForwardRef = isForwardRef;
1128
+ reactIs_development.isFragment = isFragment;
1129
+ reactIs_development.isLazy = isLazy;
1130
+ reactIs_development.isMemo = isMemo;
1131
+ reactIs_development.isPortal = isPortal;
1132
+ reactIs_development.isProfiler = isProfiler;
1133
+ reactIs_development.isStrictMode = isStrictMode;
1134
+ reactIs_development.isSuspense = isSuspense;
1135
+ reactIs_development.isSuspenseList = isSuspenseList;
1136
+ reactIs_development.isValidElementType = isValidElementType;
1137
+ reactIs_development.typeOf = typeOf;
1138
+ })();
1139
+ }
1140
+ return reactIs_development;
1141
+ }
1142
+
1143
+ (function (module) {
1144
+
1145
+ if (process.env.NODE_ENV === 'production') {
1146
+ module.exports = requireReactIs_production_min();
1147
+ } else {
1148
+ module.exports = requireReactIs_development();
1149
+ }
1150
+ } (reactIs));
1151
+
1152
+ function useMemo(getValue, condition, shouldUpdate) {
1153
+ var cacheRef = React.useRef({});
1154
+ if (!('value' in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) {
1155
+ cacheRef.current.value = getValue();
1156
+ cacheRef.current.condition = condition;
1157
+ }
1158
+ return cacheRef.current.value;
1159
+ }
1160
+
1161
+ var fillRef = function fillRef(ref, node) {
1162
+ if (typeof ref === 'function') {
1163
+ ref(node);
1164
+ } else if (_typeof(ref) === 'object' && ref && 'current' in ref) {
1165
+ ref.current = node;
1166
+ }
1167
+ };
1168
+
1169
+ /**
1170
+ * Merge refs into one ref function to support ref passing.
1171
+ */
1172
+ var composeRef = function composeRef() {
1173
+ for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
1174
+ refs[_key] = arguments[_key];
1175
+ }
1176
+ var refList = refs.filter(Boolean);
1177
+ if (refList.length <= 1) {
1178
+ return refList[0];
1179
+ }
1180
+ return function (node) {
1181
+ refs.forEach(function (ref) {
1182
+ fillRef(ref, node);
1183
+ });
1184
+ };
1185
+ };
1186
+ var useComposeRef = function useComposeRef() {
1187
+ for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1188
+ refs[_key2] = arguments[_key2];
1189
+ }
1190
+ return useMemo(function () {
1191
+ return composeRef.apply(void 0, refs);
1192
+ }, refs, function (prev, next) {
1193
+ return prev.length !== next.length || prev.every(function (ref, i) {
1194
+ return ref !== next[i];
1195
+ });
1196
+ });
1197
+ };
1198
+ var supportRef = function supportRef(nodeOrComponent) {
1199
+ var _type$prototype, _nodeOrComponent$prot;
1200
+ var type = reactIs.exports.isMemo(nodeOrComponent) ? nodeOrComponent.type.type : nodeOrComponent.type;
1201
+
1202
+ // Function component node
1203
+ if (typeof type === 'function' && !((_type$prototype = type.prototype) !== null && _type$prototype !== void 0 && _type$prototype.render) && type.$$typeof !== reactIs.exports.ForwardRef) {
1204
+ return false;
1205
+ }
1206
+
1207
+ // Class component
1208
+ if (typeof nodeOrComponent === 'function' && !((_nodeOrComponent$prot = nodeOrComponent.prototype) !== null && _nodeOrComponent$prot !== void 0 && _nodeOrComponent$prot.render) && nodeOrComponent.$$typeof !== reactIs.exports.ForwardRef) {
1209
+ return false;
1210
+ }
1211
+ return true;
1212
+ };
1213
+
1214
+ var raf = function raf(callback) {
1215
+ return +setTimeout(callback, 16);
1216
+ };
1217
+ var caf = function caf(num) {
1218
+ return clearTimeout(num);
1219
+ };
1220
+ if (typeof window !== 'undefined' && 'requestAnimationFrame' in window) {
1221
+ raf = function raf(callback) {
1222
+ return window.requestAnimationFrame(callback);
1223
+ };
1224
+ caf = function caf(handle) {
1225
+ return window.cancelAnimationFrame(handle);
1226
+ };
1227
+ }
1228
+ var rafUUID = 0;
1229
+ var rafIds = new Map();
1230
+ function cleanup(id) {
1231
+ rafIds.delete(id);
1232
+ }
1233
+ var wrapperRaf = function wrapperRaf(callback) {
1234
+ var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
1235
+ rafUUID += 1;
1236
+ var id = rafUUID;
1237
+ function callRef(leftTimes) {
1238
+ if (leftTimes === 0) {
1239
+ // Clean up
1240
+ cleanup(id);
1241
+
1242
+ // Trigger
1243
+ callback();
1244
+ } else {
1245
+ // Next raf
1246
+ var realId = raf(function () {
1247
+ callRef(leftTimes - 1);
1248
+ });
1249
+
1250
+ // Bind real raf id
1251
+ rafIds.set(id, realId);
1252
+ }
1253
+ }
1254
+ callRef(times);
1255
+ return id;
1256
+ };
1257
+ wrapperRaf.cancel = function (id) {
1258
+ var realId = rafIds.get(id);
1259
+ cleanup(id);
1260
+ return caf(realId);
1261
+ };
1262
+ if (process.env.NODE_ENV !== 'production') {
1263
+ wrapperRaf.ids = function () {
1264
+ return rafIds;
1265
+ };
1266
+ }
1267
+
1268
+ var OrderContext = /*#__PURE__*/React.createContext(null);
1269
+
1270
+ var EMPTY_LIST = [];
1271
+
1272
+ /**
1273
+ * Will add `div` to document. Nest call will keep order
1274
+ * @param render Render DOM in document
1275
+ */
1276
+ function useDom(render, debug) {
1277
+ var _React$useState = React.useState(function () {
1278
+ if (!canUseDom()) {
1279
+ return null;
1280
+ }
1281
+ var defaultEle = document.createElement('div');
1282
+ if (process.env.NODE_ENV !== 'production' && debug) {
1283
+ defaultEle.setAttribute('data-debug', debug);
1284
+ }
1285
+ return defaultEle;
1286
+ }),
1287
+ _React$useState2 = _slicedToArray(_React$useState, 1),
1288
+ ele = _React$useState2[0];
1289
+
1290
+ // ========================== Order ==========================
1291
+ var appendedRef = React.useRef(false);
1292
+ var queueCreate = React.useContext(OrderContext);
1293
+ var _React$useState3 = React.useState(EMPTY_LIST),
1294
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
1295
+ queue = _React$useState4[0],
1296
+ setQueue = _React$useState4[1];
1297
+ var mergedQueueCreate = queueCreate || (appendedRef.current ? undefined : function (appendFn) {
1298
+ setQueue(function (origin) {
1299
+ var newQueue = [appendFn].concat(_toConsumableArray(origin));
1300
+ return newQueue;
1301
+ });
1302
+ });
1303
+
1304
+ // =========================== DOM ===========================
1305
+ function append() {
1306
+ if (!ele.parentElement) {
1307
+ document.body.appendChild(ele);
1308
+ }
1309
+ appendedRef.current = true;
1310
+ }
1311
+ function cleanup() {
1312
+ var _ele$parentElement;
1313
+ (_ele$parentElement = ele.parentElement) === null || _ele$parentElement === void 0 ? void 0 : _ele$parentElement.removeChild(ele);
1314
+ appendedRef.current = false;
1315
+ }
1316
+ useLayoutEffect(function () {
1317
+ if (render) {
1318
+ if (queueCreate) {
1319
+ queueCreate(append);
1320
+ } else {
1321
+ append();
1322
+ }
1323
+ } else {
1324
+ cleanup();
1325
+ }
1326
+ return cleanup;
1327
+ }, [render]);
1328
+ useLayoutEffect(function () {
1329
+ if (queue.length) {
1330
+ queue.forEach(function (appendFn) {
1331
+ return appendFn();
1332
+ });
1333
+ setQueue(EMPTY_LIST);
1334
+ }
1335
+ }, [queue]);
1336
+ return [ele, mergedQueueCreate];
1337
+ }
1338
+
1339
+ function contains(root, n) {
1340
+ if (!root) {
1341
+ return false;
1342
+ }
1343
+
1344
+ // Use native if support
1345
+ if (root.contains) {
1346
+ return root.contains(n);
1347
+ }
1348
+
1349
+ // `document.contains` not support with IE11
1350
+ var node = n;
1351
+ while (node) {
1352
+ if (node === root) {
1353
+ return true;
1354
+ }
1355
+ node = node.parentNode;
1356
+ }
1357
+ return false;
1358
+ }
1359
+
1360
+ var APPEND_ORDER = 'data-rc-order';
1361
+ var APPEND_PRIORITY = 'data-rc-priority';
1362
+ var MARK_KEY = "rc-util-key";
1363
+ var containerCache = new Map();
1364
+ function getMark() {
1365
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1366
+ mark = _ref.mark;
1367
+ if (mark) {
1368
+ return mark.startsWith('data-') ? mark : "data-".concat(mark);
1369
+ }
1370
+ return MARK_KEY;
1371
+ }
1372
+ function getContainer(option) {
1373
+ if (option.attachTo) {
1374
+ return option.attachTo;
1375
+ }
1376
+ var head = document.querySelector('head');
1377
+ return head || document.body;
1378
+ }
1379
+ function getOrder(prepend) {
1380
+ if (prepend === 'queue') {
1381
+ return 'prependQueue';
1382
+ }
1383
+ return prepend ? 'prepend' : 'append';
1384
+ }
1385
+
1386
+ /**
1387
+ * Find style which inject by rc-util
1388
+ */
1389
+ function findStyles(container) {
1390
+ return Array.from((containerCache.get(container) || container).children).filter(function (node) {
1391
+ return node.tagName === 'STYLE';
1392
+ });
1393
+ }
1394
+ function injectCSS(css) {
1395
+ var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1396
+ if (!canUseDom()) {
1397
+ return null;
1398
+ }
1399
+ var csp = option.csp,
1400
+ prepend = option.prepend,
1401
+ _option$priority = option.priority,
1402
+ priority = _option$priority === void 0 ? 0 : _option$priority;
1403
+ var mergedOrder = getOrder(prepend);
1404
+ var isPrependQueue = mergedOrder === 'prependQueue';
1405
+ var styleNode = document.createElement('style');
1406
+ styleNode.setAttribute(APPEND_ORDER, mergedOrder);
1407
+ if (isPrependQueue && priority) {
1408
+ styleNode.setAttribute(APPEND_PRIORITY, "".concat(priority));
1409
+ }
1410
+ if (csp !== null && csp !== void 0 && csp.nonce) {
1411
+ styleNode.nonce = csp === null || csp === void 0 ? void 0 : csp.nonce;
1412
+ }
1413
+ styleNode.innerHTML = css;
1414
+ var container = getContainer(option);
1415
+ var firstChild = container.firstChild;
1416
+ if (prepend) {
1417
+ // If is queue `prepend`, it will prepend first style and then append rest style
1418
+ if (isPrependQueue) {
1419
+ var existStyle = (option.styles || findStyles(container)).filter(function (node) {
1420
+ // Ignore style which not injected by rc-util with prepend
1421
+ if (!['prepend', 'prependQueue'].includes(node.getAttribute(APPEND_ORDER))) {
1422
+ return false;
1423
+ }
1424
+
1425
+ // Ignore style which priority less then new style
1426
+ var nodePriority = Number(node.getAttribute(APPEND_PRIORITY) || 0);
1427
+ return priority >= nodePriority;
1428
+ });
1429
+ if (existStyle.length) {
1430
+ container.insertBefore(styleNode, existStyle[existStyle.length - 1].nextSibling);
1431
+ return styleNode;
1432
+ }
1433
+ }
1434
+
1435
+ // Use `insertBefore` as `prepend`
1436
+ container.insertBefore(styleNode, firstChild);
1437
+ } else {
1438
+ container.appendChild(styleNode);
1439
+ }
1440
+ return styleNode;
1441
+ }
1442
+ function findExistNode(key) {
1443
+ var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1444
+ var container = getContainer(option);
1445
+ return (option.styles || findStyles(container)).find(function (node) {
1446
+ return node.getAttribute(getMark(option)) === key;
1447
+ });
1448
+ }
1449
+ function removeCSS(key) {
1450
+ var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1451
+ var existNode = findExistNode(key, option);
1452
+ if (existNode) {
1453
+ var container = getContainer(option);
1454
+ container.removeChild(existNode);
1455
+ }
1456
+ }
1457
+
1458
+ /**
1459
+ * qiankun will inject `appendChild` to insert into other
1460
+ */
1461
+ function syncRealContainer(container, option) {
1462
+ var cachedRealContainer = containerCache.get(container);
1463
+
1464
+ // Find real container when not cached or cached container removed
1465
+ if (!cachedRealContainer || !contains(document, cachedRealContainer)) {
1466
+ var placeholderStyle = injectCSS('', option);
1467
+ var parentNode = placeholderStyle.parentNode;
1468
+ containerCache.set(container, parentNode);
1469
+ container.removeChild(placeholderStyle);
1470
+ }
1471
+ }
1472
+ function updateCSS(css, key) {
1473
+ var originOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1474
+ var container = getContainer(originOption);
1475
+ var styles = findStyles(container);
1476
+ var option = _objectSpread2(_objectSpread2({}, originOption), {}, {
1477
+ styles: styles
1478
+ });
1479
+
1480
+ // Sync real parent
1481
+ syncRealContainer(container, option);
1482
+ var existNode = findExistNode(key, option);
1483
+ if (existNode) {
1484
+ var _option$csp, _option$csp2;
1485
+ if ((_option$csp = option.csp) !== null && _option$csp !== void 0 && _option$csp.nonce && existNode.nonce !== ((_option$csp2 = option.csp) === null || _option$csp2 === void 0 ? void 0 : _option$csp2.nonce)) {
1486
+ var _option$csp3;
1487
+ existNode.nonce = (_option$csp3 = option.csp) === null || _option$csp3 === void 0 ? void 0 : _option$csp3.nonce;
1488
+ }
1489
+ if (existNode.innerHTML !== css) {
1490
+ existNode.innerHTML = css;
1491
+ }
1492
+ return existNode;
1493
+ }
1494
+ var newNode = injectCSS(css, option);
1495
+ newNode.setAttribute(getMark(option), key);
1496
+ return newNode;
1497
+ }
1498
+
1499
+ /* eslint-disable no-param-reassign */
1500
+ function measureScrollbarSize(ele) {
1501
+ var randomId = "rc-scrollbar-measure-".concat(Math.random().toString(36).substring(7));
1502
+ var measureEle = document.createElement('div');
1503
+ measureEle.id = randomId;
1504
+
1505
+ // Create Style
1506
+ var measureStyle = measureEle.style;
1507
+ measureStyle.position = 'absolute';
1508
+ measureStyle.left = '0';
1509
+ measureStyle.top = '0';
1510
+ measureStyle.width = '100px';
1511
+ measureStyle.height = '100px';
1512
+ measureStyle.overflow = 'scroll';
1513
+
1514
+ // Clone Style if needed
1515
+ var fallbackWidth;
1516
+ var fallbackHeight;
1517
+ if (ele) {
1518
+ var targetStyle = getComputedStyle(ele);
1519
+ measureStyle.scrollbarColor = targetStyle.scrollbarColor;
1520
+ measureStyle.scrollbarWidth = targetStyle.scrollbarWidth;
1521
+
1522
+ // Set Webkit style
1523
+ var webkitScrollbarStyle = getComputedStyle(ele, '::-webkit-scrollbar');
1524
+ var width = parseInt(webkitScrollbarStyle.width, 10);
1525
+ var height = parseInt(webkitScrollbarStyle.height, 10);
1526
+
1527
+ // Try wrap to handle CSP case
1528
+ try {
1529
+ var widthStyle = width ? "width: ".concat(webkitScrollbarStyle.width, ";") : '';
1530
+ var heightStyle = height ? "height: ".concat(webkitScrollbarStyle.height, ";") : '';
1531
+ updateCSS("\n#".concat(randomId, "::-webkit-scrollbar {\n").concat(widthStyle, "\n").concat(heightStyle, "\n}"), randomId);
1532
+ } catch (e) {
1533
+ // Can't wrap, just log error
1534
+ console.error(e);
1535
+
1536
+ // Get from style directly
1537
+ fallbackWidth = width;
1538
+ fallbackHeight = height;
1539
+ }
1540
+ }
1541
+ document.body.appendChild(measureEle);
1542
+
1543
+ // Measure. Get fallback style if provided
1544
+ var scrollWidth = ele && fallbackWidth && !isNaN(fallbackWidth) ? fallbackWidth : measureEle.offsetWidth - measureEle.clientWidth;
1545
+ var scrollHeight = ele && fallbackHeight && !isNaN(fallbackHeight) ? fallbackHeight : measureEle.offsetHeight - measureEle.clientHeight;
1546
+
1547
+ // Clean up
1548
+ document.body.removeChild(measureEle);
1549
+ removeCSS(randomId);
1550
+ return {
1551
+ width: scrollWidth,
1552
+ height: scrollHeight
1553
+ };
1554
+ }
1555
+ function getTargetScrollBarSize(target) {
1556
+ if (typeof document === 'undefined' || !target || !(target instanceof Element)) {
1557
+ return {
1558
+ width: 0,
1559
+ height: 0
1560
+ };
1561
+ }
1562
+ return measureScrollbarSize(target);
1563
+ }
1564
+
1565
+ /**
1566
+ * Test usage export. Do not use in your production
1567
+ */
1568
+ function isBodyOverflowing() {
1569
+ return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) && window.innerWidth > document.body.offsetWidth;
1570
+ }
1571
+
1572
+ var UNIQUE_ID = "rc-util-locker-".concat(Date.now());
1573
+ var uuid = 0;
1574
+ function useScrollLocker(lock) {
1575
+ var mergedLock = !!lock;
1576
+ var _React$useState = React.useState(function () {
1577
+ uuid += 1;
1578
+ return "".concat(UNIQUE_ID, "_").concat(uuid);
1579
+ }),
1580
+ _React$useState2 = _slicedToArray(_React$useState, 1),
1581
+ id = _React$useState2[0];
1582
+ useLayoutEffect(function () {
1583
+ if (mergedLock) {
1584
+ var scrollbarSize = getTargetScrollBarSize(document.body).width;
1585
+ var isOverflow = isBodyOverflowing();
1586
+ updateCSS("\nhtml body {\n overflow-y: hidden;\n ".concat(isOverflow ? "width: calc(100% - ".concat(scrollbarSize, "px);") : '', "\n}"), id);
1587
+ } else {
1588
+ removeCSS(id);
1589
+ }
1590
+ return function () {
1591
+ removeCSS(id);
1592
+ };
1593
+ }, [mergedLock, id]);
1594
+ }
1595
+
1596
+ var inline = false;
1597
+ function inlineMock(nextInline) {
1598
+ if (typeof nextInline === 'boolean') {
1599
+ inline = nextInline;
1600
+ }
1601
+ return inline;
1602
+ }
1603
+
1604
+ var getPortalContainer = function getPortalContainer(getContainer) {
1605
+ if (getContainer === false) {
1606
+ return false;
1607
+ }
1608
+ if (!canUseDom() || !getContainer) {
1609
+ return null;
1610
+ }
1611
+ if (typeof getContainer === 'string') {
1612
+ return document.querySelector(getContainer);
1613
+ }
1614
+ if (typeof getContainer === 'function') {
1615
+ return getContainer();
1616
+ }
1617
+ return getContainer;
1618
+ };
1619
+ var Portal = /*#__PURE__*/React.forwardRef(function (props, ref) {
1620
+ var open = props.open,
1621
+ autoLock = props.autoLock,
1622
+ getContainer = props.getContainer,
1623
+ debug = props.debug,
1624
+ _props$autoDestroy = props.autoDestroy,
1625
+ autoDestroy = _props$autoDestroy === void 0 ? true : _props$autoDestroy,
1626
+ children = props.children;
1627
+ var _React$useState = React.useState(open),
1628
+ _React$useState2 = _slicedToArray(_React$useState, 2),
1629
+ shouldRender = _React$useState2[0],
1630
+ setShouldRender = _React$useState2[1];
1631
+ var mergedRender = shouldRender || open;
1632
+
1633
+ // ========================= Warning =========================
1634
+ if (process.env.NODE_ENV !== 'production') {
1635
+ warningOnce(canUseDom() || !open, "Portal only work in client side. Please call 'useEffect' to show Portal instead default render in SSR.");
1636
+ }
1637
+
1638
+ // ====================== Should Render ======================
1639
+ React.useEffect(function () {
1640
+ if (autoDestroy || open) {
1641
+ setShouldRender(open);
1642
+ }
1643
+ }, [open, autoDestroy]);
1644
+
1645
+ // ======================== Container ========================
1646
+ var _React$useState3 = React.useState(function () {
1647
+ return getPortalContainer(getContainer);
1648
+ }),
1649
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
1650
+ innerContainer = _React$useState4[0],
1651
+ setInnerContainer = _React$useState4[1];
1652
+ React.useEffect(function () {
1653
+ var customizeContainer = getPortalContainer(getContainer);
1654
+
1655
+ // Tell component that we check this in effect which is safe to be `null`
1656
+ setInnerContainer(customizeContainer !== null && customizeContainer !== void 0 ? customizeContainer : null);
1657
+ });
1658
+ var _useDom = useDom(mergedRender && !innerContainer, debug),
1659
+ _useDom2 = _slicedToArray(_useDom, 2),
1660
+ defaultContainer = _useDom2[0],
1661
+ queueCreate = _useDom2[1];
1662
+ var mergedContainer = innerContainer !== null && innerContainer !== void 0 ? innerContainer : defaultContainer;
1663
+
1664
+ // ========================= Locker ==========================
1665
+ useScrollLocker(autoLock && open && canUseDom() && (mergedContainer === defaultContainer || mergedContainer === document.body));
1666
+
1667
+ // =========================== Ref ===========================
1668
+ var childRef = null;
1669
+ if (children && supportRef(children) && ref) {
1670
+ var _ref = children;
1671
+ childRef = _ref.ref;
1672
+ }
1673
+ var mergedRef = useComposeRef(childRef, ref);
1674
+
1675
+ // ========================= Render ==========================
1676
+ // Do not render when nothing need render
1677
+ // When innerContainer is `undefined`, it may not ready since user use ref in the same render
1678
+ if (!mergedRender || !canUseDom() || innerContainer === undefined) {
1679
+ return null;
1680
+ }
1681
+
1682
+ // Render inline
1683
+ var renderInline = mergedContainer === false || inlineMock();
1684
+ var reffedChildren = children;
1685
+ if (ref) {
1686
+ reffedChildren = /*#__PURE__*/React.cloneElement(children, {
1687
+ ref: mergedRef
1688
+ });
1689
+ }
1690
+ return /*#__PURE__*/React.createElement(OrderContext.Provider, {
1691
+ value: queueCreate
1692
+ }, renderInline ? reffedChildren : /*#__PURE__*/createPortal(reffedChildren, mergedContainer));
1693
+ });
1694
+ if (process.env.NODE_ENV !== 'production') {
1695
+ Portal.displayName = 'Portal';
1696
+ }
1697
+
1698
+ export { KeyCode as K, Portal as P, _objectSpread2 as _, _extends as a, _objectWithoutProperties as b, clsx as c, wrapperRaf as d, useEvent as e, useLayoutEffect as f, composeRef as g, fillRef as h, warningOnce as i, useMergedState as j, canUseDom as k, useMemo as l, noteOnce as n, reactIs as r, supportRef as s, useComposeRef as u, warning as w };