@kne/super-select 0.1.20 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +228 -0
- package/dist/index.css +92 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +999 -75
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +970 -71
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var React = require('react');
|
|
2
|
-
var globalContext = require('@kne/global-context');
|
|
2
|
+
var globalContext$1 = require('@kne/global-context');
|
|
3
3
|
var useResize = require('@kne/use-resize');
|
|
4
4
|
var useControlValue = require('@kne/use-control-value');
|
|
5
5
|
var classnames = require('classnames');
|
|
@@ -15,6 +15,11 @@ require('simplebar-react/dist/simplebar.min.css');
|
|
|
15
15
|
var SearchInput = require('@kne/search-input');
|
|
16
16
|
var scrollLoader = require('@kne/scroll-loader');
|
|
17
17
|
require('@kne/scroll-loader/dist/index.css');
|
|
18
|
+
var memoize = require('lodash/memoize');
|
|
19
|
+
var isNil = require('lodash/isNil');
|
|
20
|
+
var omit = require('lodash/omit');
|
|
21
|
+
var pick = require('lodash/pick');
|
|
22
|
+
var merge = require('lodash/merge');
|
|
18
23
|
|
|
19
24
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
25
|
|
|
@@ -27,24 +32,38 @@ var last__default = /*#__PURE__*/_interopDefaultLegacy(last);
|
|
|
27
32
|
var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
|
|
28
33
|
var SimpleBar__default = /*#__PURE__*/_interopDefaultLegacy(SimpleBar);
|
|
29
34
|
var SearchInput__default = /*#__PURE__*/_interopDefaultLegacy(SearchInput);
|
|
35
|
+
var memoize__default = /*#__PURE__*/_interopDefaultLegacy(memoize);
|
|
36
|
+
var isNil__default = /*#__PURE__*/_interopDefaultLegacy(isNil);
|
|
37
|
+
var omit__default = /*#__PURE__*/_interopDefaultLegacy(omit);
|
|
38
|
+
var pick__default = /*#__PURE__*/_interopDefaultLegacy(pick);
|
|
39
|
+
var merge__default = /*#__PURE__*/_interopDefaultLegacy(merge);
|
|
30
40
|
|
|
31
|
-
function _extends() {
|
|
32
|
-
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
41
|
+
function _extends$1() {
|
|
42
|
+
return _extends$1 = Object.assign ? Object.assign.bind() : function (n) {
|
|
33
43
|
for (var e = 1; e < arguments.length; e++) {
|
|
34
44
|
var t = arguments[e];
|
|
35
45
|
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
36
46
|
}
|
|
37
47
|
return n;
|
|
38
|
-
}, _extends.apply(null, arguments);
|
|
48
|
+
}, _extends$1.apply(null, arguments);
|
|
49
|
+
}
|
|
50
|
+
function _objectWithoutPropertiesLoose$1(r, e) {
|
|
51
|
+
if (null == r) return {};
|
|
52
|
+
var t = {};
|
|
53
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
54
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
55
|
+
t[n] = r[n];
|
|
56
|
+
}
|
|
57
|
+
return t;
|
|
39
58
|
}
|
|
40
59
|
|
|
41
|
-
const context = globalContext.createContext();
|
|
60
|
+
const context = globalContext$1.createContext();
|
|
42
61
|
const {
|
|
43
62
|
Provider,
|
|
44
63
|
useContext
|
|
45
64
|
} = context;
|
|
46
65
|
|
|
47
|
-
var style$
|
|
66
|
+
var style$5 = {"select-input":"_d8lGc","disabled":"_3kjwO","wrap":"_dsTM2","select-input-inner":"_NQoX9","large":"_T8ZX8","small":"_1B72H","select-input-icon":"_g8QC-","placeholder":"_r3q69","overlay-content":"_zEqGe","overlay":"_ybN30","select-input-prefix":"_4Pw75","select-input-suffix":"_Wd4pE"};
|
|
48
67
|
|
|
49
68
|
const locale$1 = {
|
|
50
69
|
placeholder: '请选择',
|
|
@@ -66,8 +85,9 @@ const locale = {
|
|
|
66
85
|
defaultChildren: 'Dropdown content, to be implemented by the caller'
|
|
67
86
|
};
|
|
68
87
|
|
|
88
|
+
const _excluded$5 = ["children"];
|
|
69
89
|
const numberToPx = val => {
|
|
70
|
-
return typeof val === 'number' ?
|
|
90
|
+
return typeof val === 'number' ? val + "px" : val;
|
|
71
91
|
};
|
|
72
92
|
const pxToNumber = value => {
|
|
73
93
|
if (!value) return 0;
|
|
@@ -79,9 +99,9 @@ const pxToNumber = value => {
|
|
|
79
99
|
};
|
|
80
100
|
const ModalContent = _ref => {
|
|
81
101
|
let {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
102
|
+
children
|
|
103
|
+
} = _ref,
|
|
104
|
+
others = _objectWithoutPropertiesLoose$1(_ref, _excluded$5);
|
|
85
105
|
const {
|
|
86
106
|
open,
|
|
87
107
|
value: propsValue
|
|
@@ -300,11 +320,11 @@ const SelectInput = reactIntl.createWithIntlProvider({
|
|
|
300
320
|
if (typeof contextProps.props.inputRender === 'function') {
|
|
301
321
|
return contextProps.props.inputRender(props, contextProps);
|
|
302
322
|
}
|
|
303
|
-
return /*#__PURE__*/React__default["default"].createElement(antd.Flex, _extends({}, props, {
|
|
323
|
+
return /*#__PURE__*/React__default["default"].createElement(antd.Flex, _extends$1({}, props, {
|
|
304
324
|
ref: inputRef,
|
|
305
|
-
className: classnames__default["default"](className, style$
|
|
306
|
-
[style$
|
|
307
|
-
[style$
|
|
325
|
+
className: classnames__default["default"](className, style$5['select-input'], 'select-input', {
|
|
326
|
+
[style$5['wrap']]: labelWrap,
|
|
327
|
+
[style$5['disabled']]: disabled
|
|
308
328
|
}),
|
|
309
329
|
justify: "space-between",
|
|
310
330
|
onMouseOver: () => {
|
|
@@ -316,13 +336,13 @@ const SelectInput = reactIntl.createWithIntlProvider({
|
|
|
316
336
|
}), (() => {
|
|
317
337
|
const current = typeof prefix === 'function' ? prefix(contextProps) : prefix;
|
|
318
338
|
return current && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
319
|
-
className: classnames__default["default"](style$
|
|
339
|
+
className: classnames__default["default"](style$5['select-input-prefix'], 'select-input-prefix'),
|
|
320
340
|
onClick: e => {
|
|
321
341
|
e.stopPropagation();
|
|
322
342
|
}
|
|
323
343
|
}, current);
|
|
324
344
|
})(), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
325
|
-
className: classnames__default["default"](style$
|
|
345
|
+
className: classnames__default["default"](style$5['select-input-inner'], 'select-input-inner')
|
|
326
346
|
}, value.length > 0 ? single || value[0][valueKey] === selectedAllValue[valueKey] ? value[0][labelKey] : value.map(item => {
|
|
327
347
|
return /*#__PURE__*/React__default["default"].createElement(antd.Tag, {
|
|
328
348
|
key: item[valueKey],
|
|
@@ -334,9 +354,9 @@ const SelectInput = reactIntl.createWithIntlProvider({
|
|
|
334
354
|
}
|
|
335
355
|
}, item[labelKey]);
|
|
336
356
|
}) : /*#__PURE__*/React__default["default"].createElement("span", {
|
|
337
|
-
className: classnames__default["default"](style$
|
|
357
|
+
className: classnames__default["default"](style$5['placeholder'], 'select-input-placeholder')
|
|
338
358
|
}, placeholder)), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
339
|
-
className: classnames__default["default"](style$
|
|
359
|
+
className: classnames__default["default"](style$5['select-input-icon'], 'select-input-icon')
|
|
340
360
|
}, !disabled && allowClear && hover && value.length > 0 ? /*#__PURE__*/React__default["default"].createElement(icons.CloseCircleFilled, {
|
|
341
361
|
onClick: e => {
|
|
342
362
|
e.stopPropagation();
|
|
@@ -345,7 +365,7 @@ const SelectInput = reactIntl.createWithIntlProvider({
|
|
|
345
365
|
}) : /*#__PURE__*/React__default["default"].createElement(icons.DownOutlined, null)), (() => {
|
|
346
366
|
const current = typeof suffix === 'function' ? suffix(contextProps) : suffix;
|
|
347
367
|
return current && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
348
|
-
className: classnames__default["default"](style$
|
|
368
|
+
className: classnames__default["default"](style$5['select-input-suffix'], 'select-input-suffix'),
|
|
349
369
|
onClick: e => {
|
|
350
370
|
e.stopPropagation();
|
|
351
371
|
}
|
|
@@ -362,13 +382,13 @@ const SelectInput = reactIntl.createWithIntlProvider({
|
|
|
362
382
|
onOpenChange: setOpen,
|
|
363
383
|
placement: placement,
|
|
364
384
|
arrow: false,
|
|
365
|
-
overlayClassName: classnames__default["default"](style$
|
|
385
|
+
overlayClassName: classnames__default["default"](style$5['overlay'], overlayClassName),
|
|
366
386
|
trigger: "click",
|
|
367
387
|
popupRender: () => /*#__PURE__*/React__default["default"].createElement("div", {
|
|
368
388
|
style: {
|
|
369
389
|
'--overlay-width': popupOverlayWidth
|
|
370
390
|
},
|
|
371
|
-
className: classnames__default["default"](style$
|
|
391
|
+
className: classnames__default["default"](style$5['overlay-content'], 'over-content'),
|
|
372
392
|
onClick: e => {
|
|
373
393
|
e.stopPropagation();
|
|
374
394
|
}
|
|
@@ -380,7 +400,7 @@ const SelectInput = reactIntl.createWithIntlProvider({
|
|
|
380
400
|
}), /*#__PURE__*/React__default["default"].createElement(ModalContent, contextProps, renderModal)));
|
|
381
401
|
}));
|
|
382
402
|
|
|
383
|
-
var style$
|
|
403
|
+
var style$4 = {"selected-all":"_prlgN"};
|
|
384
404
|
|
|
385
405
|
const SelectedAll = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'super-select')(() => {
|
|
386
406
|
const {
|
|
@@ -405,7 +425,7 @@ const SelectedAll = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'super-s
|
|
|
405
425
|
const isSelectedAll = computedIsSelectAll(value, selectedAllValue, valueKey);
|
|
406
426
|
return /*#__PURE__*/React__default["default"].createElement(antd.Flex, {
|
|
407
427
|
justify: "space-between",
|
|
408
|
-
className: classnames__default["default"](style$
|
|
428
|
+
className: classnames__default["default"](style$4['selected-all'], 'selected-all')
|
|
409
429
|
}, /*#__PURE__*/React__default["default"].createElement(antd.Flex, {
|
|
410
430
|
gap: 8
|
|
411
431
|
}, /*#__PURE__*/React__default["default"].createElement("span", null, formatMessage({
|
|
@@ -428,10 +448,10 @@ const computedIsSelectAll = function (value, selectedAllValue, valueKey) {
|
|
|
428
448
|
if (valueKey === void 0) {
|
|
429
449
|
valueKey = 'value';
|
|
430
450
|
}
|
|
431
|
-
return value
|
|
451
|
+
return (value == null ? void 0 : value.length) === 1 && get__default["default"](value, "[0][" + valueKey + "]") === selectedAllValue[valueKey];
|
|
432
452
|
};
|
|
433
453
|
|
|
434
|
-
var style$
|
|
454
|
+
var style$3 = {"label":"_l3KoW","tag-list":"_CCPzb","tag-container":"_dKZHi","tag-container-inner":"_oijCI","tag":"_WmnnS","tag-inner":"_TMcFl"};
|
|
435
455
|
|
|
436
456
|
const SelectedTagList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'super-select')(() => {
|
|
437
457
|
const {
|
|
@@ -449,21 +469,21 @@ const SelectedTagList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
|
|
|
449
469
|
valueKey
|
|
450
470
|
} = Object.assign({}, props);
|
|
451
471
|
return /*#__PURE__*/React__default["default"].createElement(antd.Flex, {
|
|
452
|
-
className: classnames__default["default"](style$
|
|
472
|
+
className: classnames__default["default"](style$3['tag-list'], 'selected-tag-list'),
|
|
453
473
|
gap: 8
|
|
454
474
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
455
|
-
className: style$
|
|
475
|
+
className: style$3['label']
|
|
456
476
|
}, formatMessage({
|
|
457
477
|
id: 'selected'
|
|
458
|
-
}), !single && value.length > 0 &&
|
|
459
|
-
className: style$
|
|
478
|
+
}), !single && value.length > 0 && "(" + value.length + (Number.isInteger(maxLength) ? "/" + maxLength : '') + ")", ":"), /*#__PURE__*/React__default["default"].createElement(SimpleBar__default["default"], {
|
|
479
|
+
className: style$3['tag-container']
|
|
460
480
|
}, /*#__PURE__*/React__default["default"].createElement(antd.Flex, {
|
|
461
481
|
gap: 8,
|
|
462
482
|
wrap: true,
|
|
463
|
-
className: style$
|
|
483
|
+
className: style$3['tag-container-inner']
|
|
464
484
|
}, value.map(item => {
|
|
465
485
|
return /*#__PURE__*/React__default["default"].createElement(antd.Tag, {
|
|
466
|
-
className: style$
|
|
486
|
+
className: style$3['tag'],
|
|
467
487
|
key: item[valueKey],
|
|
468
488
|
closable: true,
|
|
469
489
|
bordered: false,
|
|
@@ -472,18 +492,19 @@ const SelectedTagList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
|
|
|
472
492
|
onRemove(item);
|
|
473
493
|
}
|
|
474
494
|
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
475
|
-
className: style$
|
|
495
|
+
className: style$3['tag-inner']
|
|
476
496
|
}, item[labelKey]));
|
|
477
497
|
}))));
|
|
478
498
|
});
|
|
479
499
|
|
|
480
|
-
var style$
|
|
500
|
+
var style$2 = {"list":"_IsXdU","is-popup":"_-dvpa","default-list":"_QD1Mz","is-selected-all":"_M-mOy","default-list-item":"_KtOsz","is-selected":"_TQhBB","single-checked":"_2rUrh","is-disabled":"_NbwX5","selected-all":"_vN2Fx","selected-tag":"_6oITk","select-search":"_iAH9D","select-list-item-description":"_TCkeJ","footer":"_v3f23"};
|
|
481
501
|
|
|
502
|
+
const _excluded$4 = ["children"];
|
|
482
503
|
const SelectList = React.forwardRef((_ref, ref) => {
|
|
483
504
|
let {
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
505
|
+
children
|
|
506
|
+
} = _ref,
|
|
507
|
+
p = _objectWithoutPropertiesLoose$1(_ref, _excluded$4);
|
|
487
508
|
const fetchListRef = React.useRef(null);
|
|
488
509
|
const props = Object.assign({}, {
|
|
489
510
|
renderItemContent: _ref2 => {
|
|
@@ -497,7 +518,7 @@ const SelectList = React.forwardRef((_ref, ref) => {
|
|
|
497
518
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
498
519
|
className: 'select-list-item-label'
|
|
499
520
|
}, item[labelKey]), item.description && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
500
|
-
className: classnames__default["default"](style$
|
|
521
|
+
className: classnames__default["default"](style$2['select-list-item-description'], 'select-list-item-description')
|
|
501
522
|
}, item.description));
|
|
502
523
|
},
|
|
503
524
|
renderItem: contextProps => {
|
|
@@ -518,9 +539,9 @@ const SelectList = React.forwardRef((_ref, ref) => {
|
|
|
518
539
|
} = props;
|
|
519
540
|
const isChecked = value.some(target => target[valueKey] === item[valueKey]);
|
|
520
541
|
return /*#__PURE__*/React__default["default"].createElement(antd.List.Item, {
|
|
521
|
-
className: classnames__default["default"](style$
|
|
522
|
-
[style$
|
|
523
|
-
[style$
|
|
542
|
+
className: classnames__default["default"](style$2['default-list-item'], 'select-list-item', {
|
|
543
|
+
[style$2['is-selected']]: isChecked,
|
|
544
|
+
[style$2['is-disabled']]: item.disabled
|
|
524
545
|
}),
|
|
525
546
|
key: item[valueKey],
|
|
526
547
|
onClick: () => {
|
|
@@ -548,7 +569,7 @@ const SelectList = React.forwardRef((_ref, ref) => {
|
|
|
548
569
|
flex: 1,
|
|
549
570
|
className: 'select-list-item-content'
|
|
550
571
|
}, renderItemContent(contextProps)), single && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
551
|
-
className: style$
|
|
572
|
+
className: style$2['single-checked']
|
|
552
573
|
}, isChecked && /*#__PURE__*/React__default["default"].createElement(icons.CheckOutlined, null)));
|
|
553
574
|
},
|
|
554
575
|
renderList: contextProps => {
|
|
@@ -561,8 +582,8 @@ const SelectList = React.forwardRef((_ref, ref) => {
|
|
|
561
582
|
renderItem
|
|
562
583
|
} = props;
|
|
563
584
|
return /*#__PURE__*/React__default["default"].createElement(antd.List, {
|
|
564
|
-
className: classnames__default["default"](style$
|
|
565
|
-
[style$
|
|
585
|
+
className: classnames__default["default"](style$2['default-list'], {
|
|
586
|
+
[style$2['is-selected-all']]: isSelectedAll
|
|
566
587
|
}),
|
|
567
588
|
size: "small",
|
|
568
589
|
dataSource: list,
|
|
@@ -572,7 +593,7 @@ const SelectList = React.forwardRef((_ref, ref) => {
|
|
|
572
593
|
});
|
|
573
594
|
}
|
|
574
595
|
}, p);
|
|
575
|
-
return /*#__PURE__*/React__default["default"].createElement(SelectInput, _extends({}, props, {
|
|
596
|
+
return /*#__PURE__*/React__default["default"].createElement(SelectInput, _extends$1({}, props, {
|
|
576
597
|
ref: ref
|
|
577
598
|
}), targetProps => {
|
|
578
599
|
const {
|
|
@@ -599,7 +620,7 @@ const SelectList = React.forwardRef((_ref, ref) => {
|
|
|
599
620
|
} = props;
|
|
600
621
|
const components = {
|
|
601
622
|
search: (api && typeof getSearchProps === 'function' || options && typeof getSearchCallback === 'function') && /*#__PURE__*/React__default["default"].createElement(SearchInput__default["default"], {
|
|
602
|
-
className: classnames__default["default"](style$
|
|
623
|
+
className: classnames__default["default"](style$2['select-search'], 'select-list-search', {
|
|
603
624
|
'is-popup': isPopup
|
|
604
625
|
}),
|
|
605
626
|
placeholder: searchPlaceholder,
|
|
@@ -613,12 +634,12 @@ const SelectList = React.forwardRef((_ref, ref) => {
|
|
|
613
634
|
showSearchButton: !isPopup
|
|
614
635
|
}),
|
|
615
636
|
selectedAll: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
616
|
-
className: classnames__default["default"](style$
|
|
637
|
+
className: classnames__default["default"](style$2['selected-all'], 'select-list-selected-all', {
|
|
617
638
|
'is-popup': isPopup
|
|
618
639
|
})
|
|
619
640
|
}, !single && allowSelectedAll && /*#__PURE__*/React__default["default"].createElement(SelectedAll, null)),
|
|
620
|
-
fetchList: /*#__PURE__*/React__default["default"].createElement(scrollLoader.FetchScrollLoader, _extends({}, props, {
|
|
621
|
-
className: classnames__default["default"](style$
|
|
641
|
+
fetchList: /*#__PURE__*/React__default["default"].createElement(scrollLoader.FetchScrollLoader, _extends$1({}, props, {
|
|
642
|
+
className: classnames__default["default"](style$2['list'], 'select-list-scroll-list', {
|
|
622
643
|
'is-popup': isPopup
|
|
623
644
|
}),
|
|
624
645
|
searchProps: searchProps,
|
|
@@ -655,7 +676,7 @@ const SelectList = React.forwardRef((_ref, ref) => {
|
|
|
655
676
|
}));
|
|
656
677
|
}),
|
|
657
678
|
selectedTag: showSelectedTag && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
658
|
-
className: classnames__default["default"](style$
|
|
679
|
+
className: classnames__default["default"](style$2['selected-tag'], 'select-list-selected-tag', {
|
|
659
680
|
'is-popup': isPopup
|
|
660
681
|
})
|
|
661
682
|
}, /*#__PURE__*/React__default["default"].createElement(SelectedTagList, null))
|
|
@@ -668,7 +689,7 @@ const SelectList = React.forwardRef((_ref, ref) => {
|
|
|
668
689
|
return /*#__PURE__*/React__default["default"].createElement(antd.Flex, {
|
|
669
690
|
vertical: true
|
|
670
691
|
}, components.search, components.selectedAll, components.fetchList, footer && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
671
|
-
className: classnames__default["default"](style$
|
|
692
|
+
className: classnames__default["default"](style$2['footer'], 'select-list-footer')
|
|
672
693
|
}, typeof footer === 'function' ? footer({
|
|
673
694
|
reload: () => {
|
|
674
695
|
fetchListRef.current && fetchListRef.current.reload();
|
|
@@ -680,7 +701,7 @@ const SelectList = React.forwardRef((_ref, ref) => {
|
|
|
680
701
|
});
|
|
681
702
|
});
|
|
682
703
|
|
|
683
|
-
var style = {"list":"_DrEYJ","is-popup":"_KgWTX","header":"_Vmbrg","col":"_dJmfs","body":"_704J1","is-selected-all":"_qU5zU","is-selected":"_MzyWg","is-disabled":"_5luTv","right-options":"_UXi-g","no-padding-btn":"_iaCir","tag":"_JkYqS","tag-inner":"_VZlBL","single-checked":"_Eiz-u","select-search":"_temy6","tags-search":"_7phL2","descriptions":"_ttNK9","descriptions-col-label":"_xU-i7","descriptions-col-content":"_SvfzQ","footer":"_lISfA"};
|
|
704
|
+
var style$1 = {"list":"_DrEYJ","is-popup":"_KgWTX","header":"_Vmbrg","col":"_dJmfs","body":"_704J1","is-selected-all":"_qU5zU","is-selected":"_MzyWg","is-disabled":"_5luTv","right-options":"_UXi-g","no-padding-btn":"_iaCir","tag":"_JkYqS","tag-inner":"_VZlBL","single-checked":"_Eiz-u","select-search":"_temy6","tags-search":"_7phL2","descriptions":"_ttNK9","descriptions-col-label":"_xU-i7","descriptions-col-content":"_SvfzQ","footer":"_lISfA"};
|
|
684
705
|
|
|
685
706
|
const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'super-select')(React.forwardRef((p, ref) => {
|
|
686
707
|
const {
|
|
@@ -709,7 +730,7 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
|
|
|
709
730
|
return null;
|
|
710
731
|
}
|
|
711
732
|
return /*#__PURE__*/React__default["default"].createElement(SearchInput__default["default"], {
|
|
712
|
-
className: classnames__default["default"](style['select-search'], 'select-list-search', {
|
|
733
|
+
className: classnames__default["default"](style$1['select-search'], 'select-list-search', {
|
|
713
734
|
'is-popup': isPopup
|
|
714
735
|
}),
|
|
715
736
|
placeholder: searchPlaceholder,
|
|
@@ -737,7 +758,7 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
|
|
|
737
758
|
}
|
|
738
759
|
}, p);
|
|
739
760
|
const bodyRef = React.useRef(null);
|
|
740
|
-
return /*#__PURE__*/React__default["default"].createElement(SelectInput, _extends({}, props, {
|
|
761
|
+
return /*#__PURE__*/React__default["default"].createElement(SelectInput, _extends$1({}, props, {
|
|
741
762
|
ref: ref
|
|
742
763
|
}), targetProps => {
|
|
743
764
|
const {
|
|
@@ -769,7 +790,7 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
|
|
|
769
790
|
} = props;
|
|
770
791
|
const isSelectedAll = computedIsSelectAll(value, selectedAllValue, valueKey);
|
|
771
792
|
const footerEl = footer && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
772
|
-
className: classnames__default["default"](style['footer'], 'select-table-footer')
|
|
793
|
+
className: classnames__default["default"](style$1['footer'], 'select-table-footer')
|
|
773
794
|
}, typeof footer === 'function' ? footer({
|
|
774
795
|
reload: () => {
|
|
775
796
|
fetchListRef.current && fetchListRef.current.reload();
|
|
@@ -785,9 +806,9 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
|
|
|
785
806
|
span: single ? 24 : 16
|
|
786
807
|
}, /*#__PURE__*/React__default["default"].createElement("div", null, filterRender(Object.assign({}, targetProps))), /*#__PURE__*/React__default["default"].createElement(antd.Row, {
|
|
787
808
|
wrap: false,
|
|
788
|
-
className: classnames__default["default"](style['header'], 'select-table-list-header')
|
|
809
|
+
className: classnames__default["default"](style$1['header'], 'select-table-list-header')
|
|
789
810
|
}, !single && /*#__PURE__*/React__default["default"].createElement(antd.Col, {
|
|
790
|
-
className: classnames__default["default"](style['col'], 'select-table-list-col')
|
|
811
|
+
className: classnames__default["default"](style$1['col'], 'select-table-list-col')
|
|
791
812
|
}, allowSelectedAll ? /*#__PURE__*/React__default["default"].createElement(antd.Checkbox, {
|
|
792
813
|
checked: isSelectedAll,
|
|
793
814
|
onChange: e => {
|
|
@@ -815,10 +836,10 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
|
|
|
815
836
|
return /*#__PURE__*/React__default["default"].createElement(antd.Col, {
|
|
816
837
|
key: name,
|
|
817
838
|
span: span,
|
|
818
|
-
className: classnames__default["default"](style['col'], 'select-table-list-col')
|
|
839
|
+
className: classnames__default["default"](style$1['col'], 'select-table-list-col')
|
|
819
840
|
}, title);
|
|
820
|
-
})))), /*#__PURE__*/React__default["default"].createElement(scrollLoader.FetchScrollLoader, _extends({}, props, {
|
|
821
|
-
className: classnames__default["default"](style['list'], 'select-table-list-scroll-list', {
|
|
841
|
+
})))), /*#__PURE__*/React__default["default"].createElement(scrollLoader.FetchScrollLoader, _extends$1({}, props, {
|
|
842
|
+
className: classnames__default["default"](style$1['list'], 'select-table-list-scroll-list', {
|
|
822
843
|
'is-popup': isPopup
|
|
823
844
|
}),
|
|
824
845
|
searchProps: searchProps,
|
|
@@ -860,10 +881,10 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
|
|
|
860
881
|
return /*#__PURE__*/React__default["default"].createElement(antd.Row, {
|
|
861
882
|
wrap: false,
|
|
862
883
|
key: item[valueKey],
|
|
863
|
-
className: classnames__default["default"](style['body'], 'select-table-list-body', [{
|
|
864
|
-
[style['is-selected-all']]: isSelectedAll,
|
|
865
|
-
[style['is-selected']]: isChecked,
|
|
866
|
-
[style['is-disabled']]: item.disabled
|
|
884
|
+
className: classnames__default["default"](style$1['body'], 'select-table-list-body', [{
|
|
885
|
+
[style$1['is-selected-all']]: isSelectedAll,
|
|
886
|
+
[style$1['is-selected']]: isChecked,
|
|
887
|
+
[style$1['is-disabled']]: item.disabled
|
|
867
888
|
}]),
|
|
868
889
|
onClick: () => {
|
|
869
890
|
if (item.disabled) {
|
|
@@ -882,7 +903,7 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
|
|
|
882
903
|
}
|
|
883
904
|
}
|
|
884
905
|
}, !single && /*#__PURE__*/React__default["default"].createElement(antd.Col, {
|
|
885
|
-
className: classnames__default["default"](style['col'], 'select-table-list-col')
|
|
906
|
+
className: classnames__default["default"](style$1['col'], 'select-table-list-col')
|
|
886
907
|
}, /*#__PURE__*/React__default["default"].createElement(antd.Checkbox, {
|
|
887
908
|
disabled: item.disabled || isSelectedAll,
|
|
888
909
|
checked: isSelectedAll || isChecked
|
|
@@ -899,19 +920,19 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
|
|
|
899
920
|
return /*#__PURE__*/React__default["default"].createElement(antd.Col, {
|
|
900
921
|
key: name,
|
|
901
922
|
span: span,
|
|
902
|
-
className: classnames__default["default"](style['col'], 'select-table-list-col')
|
|
923
|
+
className: classnames__default["default"](style$1['col'], 'select-table-list-col')
|
|
903
924
|
}, typeof getValueOf === 'function' ? getValueOf(item, contextProps) : get__default["default"](item, name));
|
|
904
925
|
}))), single && /*#__PURE__*/React__default["default"].createElement(antd.Col, {
|
|
905
|
-
className: classnames__default["default"](style['col'], style['single-checked'], 'select-table-list-col')
|
|
926
|
+
className: classnames__default["default"](style$1['col'], style$1['single-checked'], 'select-table-list-col')
|
|
906
927
|
}, isChecked && /*#__PURE__*/React__default["default"].createElement(icons.CheckOutlined, null)));
|
|
907
928
|
});
|
|
908
929
|
}), single && footerEl), !single && /*#__PURE__*/React__default["default"].createElement(antd.Col, {
|
|
909
|
-
className: classnames__default["default"](style['right-options'], {
|
|
930
|
+
className: classnames__default["default"](style$1['right-options'], {
|
|
910
931
|
'is-popup': isPopup
|
|
911
932
|
}),
|
|
912
933
|
span: 8
|
|
913
934
|
}, /*#__PURE__*/React__default["default"].createElement(SearchInput__default["default"], {
|
|
914
|
-
className: style['tags-search'],
|
|
935
|
+
className: style$1['tags-search'],
|
|
915
936
|
placeholder: searchPlaceholder,
|
|
916
937
|
value: tagSearchText,
|
|
917
938
|
onSearch: value => {
|
|
@@ -924,8 +945,8 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
|
|
|
924
945
|
align: 'middle'
|
|
925
946
|
}, /*#__PURE__*/React__default["default"].createElement(antd.Col, null, formatMessage({
|
|
926
947
|
id: 'selected'
|
|
927
|
-
}), value.length > 0 &&
|
|
928
|
-
className: style['no-padding-btn'],
|
|
948
|
+
}), value.length > 0 && "(" + value.length + (Number.isInteger(maxLength) ? "/" + maxLength : '') + ")", ":"), /*#__PURE__*/React__default["default"].createElement(antd.Col, null, /*#__PURE__*/React__default["default"].createElement(antd.Button, {
|
|
949
|
+
className: style$1['no-padding-btn'],
|
|
929
950
|
type: "link",
|
|
930
951
|
onClick: () => {
|
|
931
952
|
setValue([]);
|
|
@@ -935,7 +956,7 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
|
|
|
935
956
|
gap: 8
|
|
936
957
|
}, value.filter(item => getTagSearchCallback(tagSearchText, item, targetProps)).map(item => {
|
|
937
958
|
return /*#__PURE__*/React__default["default"].createElement(antd.Tag, {
|
|
938
|
-
className: style['tag'],
|
|
959
|
+
className: style$1['tag'],
|
|
939
960
|
key: item[valueKey],
|
|
940
961
|
closable: true,
|
|
941
962
|
bordered: false,
|
|
@@ -946,7 +967,7 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
|
|
|
946
967
|
}, /*#__PURE__*/React__default["default"].createElement(antd.Popover, {
|
|
947
968
|
getPopupContainer: () => bodyRef.current,
|
|
948
969
|
content: /*#__PURE__*/React__default["default"].createElement(antd.Row, {
|
|
949
|
-
className: style['descriptions']
|
|
970
|
+
className: style$1['descriptions']
|
|
950
971
|
}, columns.map(_ref2 => {
|
|
951
972
|
let {
|
|
952
973
|
name,
|
|
@@ -957,21 +978,924 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
|
|
|
957
978
|
key: name
|
|
958
979
|
}, /*#__PURE__*/React__default["default"].createElement(antd.Col, {
|
|
959
980
|
span: 8,
|
|
960
|
-
className: style['descriptions-col-label']
|
|
981
|
+
className: style$1['descriptions-col-label']
|
|
961
982
|
}, title), /*#__PURE__*/React__default["default"].createElement(antd.Col, {
|
|
962
|
-
className: style['descriptions-col-content'],
|
|
983
|
+
className: style$1['descriptions-col-content'],
|
|
963
984
|
span: 16
|
|
964
985
|
}, typeof getValueOf === 'function' ? getValueOf(item, targetProps) : get__default["default"](item, name)));
|
|
965
986
|
}))
|
|
966
987
|
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
967
|
-
className: style['tag-inner']
|
|
988
|
+
className: style$1['tag-inner']
|
|
968
989
|
}, item[labelKey])));
|
|
969
990
|
}))), footerEl));
|
|
970
991
|
});
|
|
971
992
|
}));
|
|
972
993
|
|
|
994
|
+
function createCommonjsModule(fn) {
|
|
995
|
+
var module = { exports: {} };
|
|
996
|
+
return fn(module, module.exports), module.exports;
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
function commonjsRequire (target) {
|
|
1000
|
+
throw new Error('Could not dynamically require "' + target + '". Please configure the dynamicRequireTargets option of @rollup/plugin-commonjs appropriately for this require call to behave properly.');
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
var object_hash = createCommonjsModule(function (module, exports) {
|
|
1004
|
+
!function(e){module.exports=e();}(function(){return function r(o,i,u){function s(n,e){if(!i[n]){if(!o[n]){var t="function"==typeof commonjsRequire&&commonjsRequire;if(!e&&t)return t(n,!0);if(a)return a(n,!0);throw new Error("Cannot find module '"+n+"'")}e=i[n]={exports:{}};o[n][0].call(e.exports,function(e){var t=o[n][1][e];return s(t||e)},e,e.exports,r,o,i,u);}return i[n].exports}for(var a="function"==typeof commonjsRequire&&commonjsRequire,e=0;e<u.length;e++)s(u[e]);return s}({1:[function(w,b,m){!function(e,n,s,c,d,h,p,g,y){var r=w("crypto");function t(e,t){t=u(e,t);var n;return void 0===(n="passthrough"!==t.algorithm?r.createHash(t.algorithm):new l).write&&(n.write=n.update,n.end=n.update),f(t,n).dispatch(e),n.update||n.end(""),n.digest?n.digest("buffer"===t.encoding?void 0:t.encoding):(e=n.read(),"buffer"!==t.encoding?e.toString(t.encoding):e)}(m=b.exports=t).sha1=function(e){return t(e)},m.keys=function(e){return t(e,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},m.MD5=function(e){return t(e,{algorithm:"md5",encoding:"hex"})},m.keysMD5=function(e){return t(e,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var o=r.getHashes?r.getHashes().slice():["sha1","md5"],i=(o.push("passthrough"),["buffer","hex","binary","base64"]);function u(e,t){var n={};if(n.algorithm=(t=t||{}).algorithm||"sha1",n.encoding=t.encoding||"hex",n.excludeValues=!!t.excludeValues,n.algorithm=n.algorithm.toLowerCase(),n.encoding=n.encoding.toLowerCase(),n.ignoreUnknown=!0===t.ignoreUnknown,n.respectType=!1!==t.respectType,n.respectFunctionNames=!1!==t.respectFunctionNames,n.respectFunctionProperties=!1!==t.respectFunctionProperties,n.unorderedArrays=!0===t.unorderedArrays,n.unorderedSets=!1!==t.unorderedSets,n.unorderedObjects=!1!==t.unorderedObjects,n.replacer=t.replacer||void 0,n.excludeKeys=t.excludeKeys||void 0,void 0===e)throw new Error("Object argument required.");for(var r=0;r<o.length;++r)o[r].toLowerCase()===n.algorithm.toLowerCase()&&(n.algorithm=o[r]);if(-1===o.indexOf(n.algorithm))throw new Error('Algorithm "'+n.algorithm+'" not supported. supported values: '+o.join(", "));if(-1===i.indexOf(n.encoding)&&"passthrough"!==n.algorithm)throw new Error('Encoding "'+n.encoding+'" not supported. supported values: '+i.join(", "));return n}function a(e){if("function"==typeof e)return null!=/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(e))}function f(o,t,i){i=i||[];function u(e){return t.update?t.update(e,"utf8"):t.write(e,"utf8")}return {dispatch:function(e){return this["_"+(null===(e=o.replacer?o.replacer(e):e)?"null":typeof e)](e)},_object:function(t){var n,e=Object.prototype.toString.call(t),r=/\[object (.*)\]/i.exec(e);r=(r=r?r[1]:"unknown:["+e+"]").toLowerCase();if(0<=(e=i.indexOf(t)))return this.dispatch("[CIRCULAR:"+e+"]");if(i.push(t),void 0!==s&&s.isBuffer&&s.isBuffer(t))return u("buffer:"),u(t);if("object"===r||"function"===r||"asyncfunction"===r)return e=Object.keys(t),o.unorderedObjects&&(e=e.sort()),!1===o.respectType||a(t)||e.splice(0,0,"prototype","__proto__","constructor"),o.excludeKeys&&(e=e.filter(function(e){return !o.excludeKeys(e)})),u("object:"+e.length+":"),n=this,e.forEach(function(e){n.dispatch(e),u(":"),o.excludeValues||n.dispatch(t[e]),u(",");});if(!this["_"+r]){if(o.ignoreUnknown)return u("["+r+"]");throw new Error('Unknown object type "'+r+'"')}this["_"+r](t);},_array:function(e,t){t=void 0!==t?t:!1!==o.unorderedArrays;var n=this;if(u("array:"+e.length+":"),!t||e.length<=1)return e.forEach(function(e){return n.dispatch(e)});var r=[],t=e.map(function(e){var t=new l,n=i.slice();return f(o,t,n).dispatch(e),r=r.concat(n.slice(i.length)),t.read().toString()});return i=i.concat(r),t.sort(),this._array(t,!1)},_date:function(e){return u("date:"+e.toJSON())},_symbol:function(e){return u("symbol:"+e.toString())},_error:function(e){return u("error:"+e.toString())},_boolean:function(e){return u("bool:"+e.toString())},_string:function(e){u("string:"+e.length+":"),u(e.toString());},_function:function(e){u("fn:"),a(e)?this.dispatch("[native]"):this.dispatch(e.toString()),!1!==o.respectFunctionNames&&this.dispatch("function-name:"+String(e.name)),o.respectFunctionProperties&&this._object(e);},_number:function(e){return u("number:"+e.toString())},_xml:function(e){return u("xml:"+e.toString())},_null:function(){return u("Null")},_undefined:function(){return u("Undefined")},_regexp:function(e){return u("regex:"+e.toString())},_uint8array:function(e){return u("uint8array:"),this.dispatch(Array.prototype.slice.call(e))},_uint8clampedarray:function(e){return u("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(e))},_int8array:function(e){return u("int8array:"),this.dispatch(Array.prototype.slice.call(e))},_uint16array:function(e){return u("uint16array:"),this.dispatch(Array.prototype.slice.call(e))},_int16array:function(e){return u("int16array:"),this.dispatch(Array.prototype.slice.call(e))},_uint32array:function(e){return u("uint32array:"),this.dispatch(Array.prototype.slice.call(e))},_int32array:function(e){return u("int32array:"),this.dispatch(Array.prototype.slice.call(e))},_float32array:function(e){return u("float32array:"),this.dispatch(Array.prototype.slice.call(e))},_float64array:function(e){return u("float64array:"),this.dispatch(Array.prototype.slice.call(e))},_arraybuffer:function(e){return u("arraybuffer:"),this.dispatch(new Uint8Array(e))},_url:function(e){return u("url:"+e.toString())},_map:function(e){u("map:");e=Array.from(e);return this._array(e,!1!==o.unorderedSets)},_set:function(e){u("set:");e=Array.from(e);return this._array(e,!1!==o.unorderedSets)},_file:function(e){return u("file:"),this.dispatch([e.name,e.size,e.type,e.lastModfied])},_blob:function(){if(o.ignoreUnknown)return u("[blob]");throw Error('Hashing Blob objects is currently not supported\n(see https://github.com/puleos/object-hash/issues/26)\nUse "options.replacer" or "options.ignoreUnknown"\n')},_domwindow:function(){return u("domwindow")},_bigint:function(e){return u("bigint:"+e.toString())},_process:function(){return u("process")},_timer:function(){return u("timer")},_pipe:function(){return u("pipe")},_tcp:function(){return u("tcp")},_udp:function(){return u("udp")},_tty:function(){return u("tty")},_statwatcher:function(){return u("statwatcher")},_securecontext:function(){return u("securecontext")},_connection:function(){return u("connection")},_zlib:function(){return u("zlib")},_context:function(){return u("context")},_nodescript:function(){return u("nodescript")},_httpparser:function(){return u("httpparser")},_dataview:function(){return u("dataview")},_signal:function(){return u("signal")},_fsevent:function(){return u("fsevent")},_tlswrap:function(){return u("tlswrap")}}}function l(){return {buf:"",write:function(e){this.buf+=e;},end:function(e){this.buf+=e;},read:function(){return this.buf}}}m.writeToStream=function(e,t,n){return void 0===n&&(n=t,t={}),f(t=u(e,t),n).dispatch(e)};}.call(this,w("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},w("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/fake_9a5aa49d.js","/");},{buffer:3,crypto:5,lYpoI2:11}],2:[function(e,t,f){!function(e,t,n,r,o,i,u,s,a){!function(e){var a="undefined"!=typeof Uint8Array?Uint8Array:Array,t="+".charCodeAt(0),n="/".charCodeAt(0),r="0".charCodeAt(0),o="a".charCodeAt(0),i="A".charCodeAt(0),u="-".charCodeAt(0),s="_".charCodeAt(0);function f(e){e=e.charCodeAt(0);return e===t||e===u?62:e===n||e===s?63:e<r?-1:e<r+10?e-r+26+26:e<i+26?e-i:e<o+26?e-o+26:void 0}e.toByteArray=function(e){var t,n;if(0<e.length%4)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.length,r="="===e.charAt(r-2)?2:"="===e.charAt(r-1)?1:0,o=new a(3*e.length/4-r),i=0<r?e.length-4:e.length,u=0;function s(e){o[u++]=e;}for(t=0;t<i;t+=4,0)s((16711680&(n=f(e.charAt(t))<<18|f(e.charAt(t+1))<<12|f(e.charAt(t+2))<<6|f(e.charAt(t+3))))>>16),s((65280&n)>>8),s(255&n);return 2==r?s(255&(n=f(e.charAt(t))<<2|f(e.charAt(t+1))>>4)):1==r&&(s((n=f(e.charAt(t))<<10|f(e.charAt(t+1))<<4|f(e.charAt(t+2))>>2)>>8&255),s(255&n)),o},e.fromByteArray=function(e){var t,n,r,o,i=e.length%3,u="";function s(e){return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)}for(t=0,r=e.length-i;t<r;t+=3)n=(e[t]<<16)+(e[t+1]<<8)+e[t+2],u+=s((o=n)>>18&63)+s(o>>12&63)+s(o>>6&63)+s(63&o);switch(i){case 1:u=(u+=s((n=e[e.length-1])>>2))+s(n<<4&63)+"==";break;case 2:u=(u=(u+=s((n=(e[e.length-2]<<8)+e[e.length-1])>>10))+s(n>>4&63))+s(n<<2&63)+"=";}return u};}(void 0===f?this.base64js={}:f);}.call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib");},{buffer:3,lYpoI2:11}],3:[function(O,e,H){!function(e,n,f,r,h,p,g,y,w){var a=O("base64-js"),i=O("ieee754");function f(e,t,n){if(!(this instanceof f))return new f(e,t,n);var r,o,i,u,s=typeof e;if("base64"===t&&"string"==s)for(e=(u=e).trim?u.trim():u.replace(/^\s+|\s+$/g,"");e.length%4!=0;)e+="=";if("number"==s)r=j(e);else if("string"==s)r=f.byteLength(e,t);else {if("object"!=s)throw new Error("First argument needs to be a number, array or string.");r=j(e.length);}if(f._useTypedArrays?o=f._augment(new Uint8Array(r)):((o=this).length=r,o._isBuffer=!0),f._useTypedArrays&&"number"==typeof e.byteLength)o._set(e);else if(C(u=e)||f.isBuffer(u)||u&&"object"==typeof u&&"number"==typeof u.length)for(i=0;i<r;i++)f.isBuffer(e)?o[i]=e.readUInt8(i):o[i]=e[i];else if("string"==s)o.write(e,0,t);else if("number"==s&&!f._useTypedArrays&&!n)for(i=0;i<r;i++)o[i]=0;return o}function b(e,t,n,r){return f._charsWritten=c(function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function m(e,t,n,r){return f._charsWritten=c(function(e){for(var t,n,r=[],o=0;o<e.length;o++)n=e.charCodeAt(o),t=n>>8,n=n%256,r.push(n),r.push(t);return r}(t),e,n,r)}function v(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o<n;o++)r+=String.fromCharCode(e[o]);return r}function o(e,t,n,r){r||(d("boolean"==typeof n,"missing or invalid endian"),d(null!=t,"missing offset"),d(t+1<e.length,"Trying to read beyond buffer length"));var o,r=e.length;if(!(r<=t))return n?(o=e[t],t+1<r&&(o|=e[t+1]<<8)):(o=e[t]<<8,t+1<r&&(o|=e[t+1])),o}function u(e,t,n,r){r||(d("boolean"==typeof n,"missing or invalid endian"),d(null!=t,"missing offset"),d(t+3<e.length,"Trying to read beyond buffer length"));var o,r=e.length;if(!(r<=t))return n?(t+2<r&&(o=e[t+2]<<16),t+1<r&&(o|=e[t+1]<<8),o|=e[t],t+3<r&&(o+=e[t+3]<<24>>>0)):(t+1<r&&(o=e[t+1]<<16),t+2<r&&(o|=e[t+2]<<8),t+3<r&&(o|=e[t+3]),o+=e[t]<<24>>>0),o}function _(e,t,n,r){if(r||(d("boolean"==typeof n,"missing or invalid endian"),d(null!=t,"missing offset"),d(t+1<e.length,"Trying to read beyond buffer length")),!(e.length<=t))return r=o(e,t,n,!0),32768&r?-1*(65535-r+1):r}function E(e,t,n,r){if(r||(d("boolean"==typeof n,"missing or invalid endian"),d(null!=t,"missing offset"),d(t+3<e.length,"Trying to read beyond buffer length")),!(e.length<=t))return r=u(e,t,n,!0),2147483648&r?-1*(4294967295-r+1):r}function I(e,t,n,r){return r||(d("boolean"==typeof n,"missing or invalid endian"),d(t+3<e.length,"Trying to read beyond buffer length")),i.read(e,t,n,23,4)}function A(e,t,n,r){return r||(d("boolean"==typeof n,"missing or invalid endian"),d(t+7<e.length,"Trying to read beyond buffer length")),i.read(e,t,n,52,8)}function s(e,t,n,r,o){o||(d(null!=t,"missing value"),d("boolean"==typeof r,"missing or invalid endian"),d(null!=n,"missing offset"),d(n+1<e.length,"trying to write beyond buffer length"),Y(t,65535));o=e.length;if(!(o<=n))for(var i=0,u=Math.min(o-n,2);i<u;i++)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i);}function l(e,t,n,r,o){o||(d(null!=t,"missing value"),d("boolean"==typeof r,"missing or invalid endian"),d(null!=n,"missing offset"),d(n+3<e.length,"trying to write beyond buffer length"),Y(t,4294967295));o=e.length;if(!(o<=n))for(var i=0,u=Math.min(o-n,4);i<u;i++)e[n+i]=t>>>8*(r?i:3-i)&255;}function B(e,t,n,r,o){o||(d(null!=t,"missing value"),d("boolean"==typeof r,"missing or invalid endian"),d(null!=n,"missing offset"),d(n+1<e.length,"Trying to write beyond buffer length"),F(t,32767,-32768)),e.length<=n||s(e,0<=t?t:65535+t+1,n,r,o);}function L(e,t,n,r,o){o||(d(null!=t,"missing value"),d("boolean"==typeof r,"missing or invalid endian"),d(null!=n,"missing offset"),d(n+3<e.length,"Trying to write beyond buffer length"),F(t,2147483647,-2147483648)),e.length<=n||l(e,0<=t?t:4294967295+t+1,n,r,o);}function U(e,t,n,r,o){o||(d(null!=t,"missing value"),d("boolean"==typeof r,"missing or invalid endian"),d(null!=n,"missing offset"),d(n+3<e.length,"Trying to write beyond buffer length"),D(t,34028234663852886e22,-34028234663852886e22)),e.length<=n||i.write(e,t,n,r,23,4);}function x(e,t,n,r,o){o||(d(null!=t,"missing value"),d("boolean"==typeof r,"missing or invalid endian"),d(null!=n,"missing offset"),d(n+7<e.length,"Trying to write beyond buffer length"),D(t,17976931348623157e292,-17976931348623157e292)),e.length<=n||i.write(e,t,n,r,52,8);}H.Buffer=f,H.SlowBuffer=f,H.INSPECT_MAX_BYTES=50,f.poolSize=8192,f._useTypedArrays=function(){try{var e=new ArrayBuffer(0),t=new Uint8Array(e);return t.foo=function(){return 42},42===t.foo()&&"function"==typeof t.subarray}catch(e){return !1}}(),f.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return !0;default:return !1}},f.isBuffer=function(e){return !(null==e||!e._isBuffer)},f.byteLength=function(e,t){var n;switch(e+="",t||"utf8"){case"hex":n=e.length/2;break;case"utf8":case"utf-8":n=T(e).length;break;case"ascii":case"binary":case"raw":n=e.length;break;case"base64":n=M(e).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n=2*e.length;break;default:throw new Error("Unknown encoding")}return n},f.concat=function(e,t){if(d(C(e),"Usage: Buffer.concat(list, [totalLength])\nlist should be an Array."),0===e.length)return new f(0);if(1===e.length)return e[0];if("number"!=typeof t)for(o=t=0;o<e.length;o++)t+=e[o].length;for(var n=new f(t),r=0,o=0;o<e.length;o++){var i=e[o];i.copy(n,r),r+=i.length;}return n},f.prototype.write=function(e,t,n,r){isFinite(t)?isFinite(n)||(r=n,n=void 0):(a=r,r=t,t=n,n=a),t=Number(t)||0;var o,i,u,s,a=this.length-t;switch((!n||a<(n=Number(n)))&&(n=a),r=String(r||"utf8").toLowerCase()){case"hex":o=function(e,t,n,r){n=Number(n)||0;var o=e.length-n;(!r||o<(r=Number(r)))&&(r=o),d((o=t.length)%2==0,"Invalid hex string"),o/2<r&&(r=o/2);for(var i=0;i<r;i++){var u=parseInt(t.substr(2*i,2),16);d(!isNaN(u),"Invalid hex string"),e[n+i]=u;}return f._charsWritten=2*i,i}(this,e,t,n);break;case"utf8":case"utf-8":i=this,u=t,s=n,o=f._charsWritten=c(T(e),i,u,s);break;case"ascii":case"binary":o=b(this,e,t,n);break;case"base64":i=this,u=t,s=n,o=f._charsWritten=c(M(e),i,u,s);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":o=m(this,e,t,n);break;default:throw new Error("Unknown encoding")}return o},f.prototype.toString=function(e,t,n){var r,o,i,u,s=this;if(e=String(e||"utf8").toLowerCase(),t=Number(t)||0,(n=void 0!==n?Number(n):s.length)===t)return "";switch(e){case"hex":r=function(e,t,n){var r=e.length;(!t||t<0)&&(t=0);(!n||n<0||r<n)&&(n=r);for(var o="",i=t;i<n;i++)o+=k(e[i]);return o}(s,t,n);break;case"utf8":case"utf-8":r=function(e,t,n){var r="",o="";n=Math.min(e.length,n);for(var i=t;i<n;i++)e[i]<=127?(r+=N(o)+String.fromCharCode(e[i]),o=""):o+="%"+e[i].toString(16);return r+N(o)}(s,t,n);break;case"ascii":case"binary":r=v(s,t,n);break;case"base64":o=s,u=n,r=0===(i=t)&&u===o.length?a.fromByteArray(o):a.fromByteArray(o.slice(i,u));break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":r=function(e,t,n){for(var r=e.slice(t,n),o="",i=0;i<r.length;i+=2)o+=String.fromCharCode(r[i]+256*r[i+1]);return o}(s,t,n);break;default:throw new Error("Unknown encoding")}return r},f.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},f.prototype.copy=function(e,t,n,r){if(t=t||0,(r=r||0===r?r:this.length)!==(n=n||0)&&0!==e.length&&0!==this.length){d(n<=r,"sourceEnd < sourceStart"),d(0<=t&&t<e.length,"targetStart out of bounds"),d(0<=n&&n<this.length,"sourceStart out of bounds"),d(0<=r&&r<=this.length,"sourceEnd out of bounds"),r>this.length&&(r=this.length);var o=(r=e.length-t<r-n?e.length-t+n:r)-n;if(o<100||!f._useTypedArrays)for(var i=0;i<o;i++)e[i+t]=this[i+n];else e._set(this.subarray(n,n+o),t);}},f.prototype.slice=function(e,t){var n=this.length;if(e=S(e,n,0),t=S(t,n,n),f._useTypedArrays)return f._augment(this.subarray(e,t));for(var r=t-e,o=new f(r,void 0,!0),i=0;i<r;i++)o[i]=this[i+e];return o},f.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},f.prototype.set=function(e,t){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,t)},f.prototype.readUInt8=function(e,t){if(t||(d(null!=e,"missing offset"),d(e<this.length,"Trying to read beyond buffer length")),!(e>=this.length))return this[e]},f.prototype.readUInt16LE=function(e,t){return o(this,e,!0,t)},f.prototype.readUInt16BE=function(e,t){return o(this,e,!1,t)},f.prototype.readUInt32LE=function(e,t){return u(this,e,!0,t)},f.prototype.readUInt32BE=function(e,t){return u(this,e,!1,t)},f.prototype.readInt8=function(e,t){if(t||(d(null!=e,"missing offset"),d(e<this.length,"Trying to read beyond buffer length")),!(e>=this.length))return 128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){return _(this,e,!0,t)},f.prototype.readInt16BE=function(e,t){return _(this,e,!1,t)},f.prototype.readInt32LE=function(e,t){return E(this,e,!0,t)},f.prototype.readInt32BE=function(e,t){return E(this,e,!1,t)},f.prototype.readFloatLE=function(e,t){return I(this,e,!0,t)},f.prototype.readFloatBE=function(e,t){return I(this,e,!1,t)},f.prototype.readDoubleLE=function(e,t){return A(this,e,!0,t)},f.prototype.readDoubleBE=function(e,t){return A(this,e,!1,t)},f.prototype.writeUInt8=function(e,t,n){n||(d(null!=e,"missing value"),d(null!=t,"missing offset"),d(t<this.length,"trying to write beyond buffer length"),Y(e,255)),t>=this.length||(this[t]=e);},f.prototype.writeUInt16LE=function(e,t,n){s(this,e,t,!0,n);},f.prototype.writeUInt16BE=function(e,t,n){s(this,e,t,!1,n);},f.prototype.writeUInt32LE=function(e,t,n){l(this,e,t,!0,n);},f.prototype.writeUInt32BE=function(e,t,n){l(this,e,t,!1,n);},f.prototype.writeInt8=function(e,t,n){n||(d(null!=e,"missing value"),d(null!=t,"missing offset"),d(t<this.length,"Trying to write beyond buffer length"),F(e,127,-128)),t>=this.length||(0<=e?this.writeUInt8(e,t,n):this.writeUInt8(255+e+1,t,n));},f.prototype.writeInt16LE=function(e,t,n){B(this,e,t,!0,n);},f.prototype.writeInt16BE=function(e,t,n){B(this,e,t,!1,n);},f.prototype.writeInt32LE=function(e,t,n){L(this,e,t,!0,n);},f.prototype.writeInt32BE=function(e,t,n){L(this,e,t,!1,n);},f.prototype.writeFloatLE=function(e,t,n){U(this,e,t,!0,n);},f.prototype.writeFloatBE=function(e,t,n){U(this,e,t,!1,n);},f.prototype.writeDoubleLE=function(e,t,n){x(this,e,t,!0,n);},f.prototype.writeDoubleBE=function(e,t,n){x(this,e,t,!1,n);},f.prototype.fill=function(e,t,n){if(t=t||0,n=n||this.length,d("number"==typeof(e="string"==typeof(e=e||0)?e.charCodeAt(0):e)&&!isNaN(e),"value is not a number"),d(t<=n,"end < start"),n!==t&&0!==this.length){d(0<=t&&t<this.length,"start out of bounds"),d(0<=n&&n<=this.length,"end out of bounds");for(var r=t;r<n;r++)this[r]=e;}},f.prototype.inspect=function(){for(var e=[],t=this.length,n=0;n<t;n++)if(e[n]=k(this[n]),n===H.INSPECT_MAX_BYTES){e[n+1]="...";break}return "<Buffer "+e.join(" ")+">"},f.prototype.toArrayBuffer=function(){if("undefined"==typeof Uint8Array)throw new Error("Buffer.toArrayBuffer not supported in this browser");if(f._useTypedArrays)return new f(this).buffer;for(var e=new Uint8Array(this.length),t=0,n=e.length;t<n;t+=1)e[t]=this[t];return e.buffer};var t=f.prototype;function S(e,t,n){return "number"!=typeof e?n:t<=(e=~~e)?t:0<=e||0<=(e+=t)?e:0}function j(e){return (e=~~Math.ceil(+e))<0?0:e}function C(e){return (Array.isArray||function(e){return "[object Array]"===Object.prototype.toString.call(e)})(e)}function k(e){return e<16?"0"+e.toString(16):e.toString(16)}function T(e){for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r<=127)t.push(e.charCodeAt(n));else for(var o=n,i=(55296<=r&&r<=57343&&n++,encodeURIComponent(e.slice(o,n+1)).substr(1).split("%")),u=0;u<i.length;u++)t.push(parseInt(i[u],16));}return t}function M(e){return a.toByteArray(e)}function c(e,t,n,r){for(var o=0;o<r&&!(o+n>=t.length||o>=e.length);o++)t[o+n]=e[o];return o}function N(e){try{return decodeURIComponent(e)}catch(e){return String.fromCharCode(65533)}}function Y(e,t){d("number"==typeof e,"cannot write a non-number as a number"),d(0<=e,"specified a negative value for writing an unsigned value"),d(e<=t,"value is larger than maximum value for type"),d(Math.floor(e)===e,"value has a fractional component");}function F(e,t,n){d("number"==typeof e,"cannot write a non-number as a number"),d(e<=t,"value larger than maximum allowed value"),d(n<=e,"value smaller than minimum allowed value"),d(Math.floor(e)===e,"value has a fractional component");}function D(e,t,n){d("number"==typeof e,"cannot write a non-number as a number"),d(e<=t,"value larger than maximum allowed value"),d(n<=e,"value smaller than minimum allowed value");}function d(e,t){if(!e)throw new Error(t||"Failed assertion")}f._augment=function(e){return e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=t.get,e.set=t.set,e.write=t.write,e.toString=t.toString,e.toLocaleString=t.toString,e.toJSON=t.toJSON,e.copy=t.copy,e.slice=t.slice,e.readUInt8=t.readUInt8,e.readUInt16LE=t.readUInt16LE,e.readUInt16BE=t.readUInt16BE,e.readUInt32LE=t.readUInt32LE,e.readUInt32BE=t.readUInt32BE,e.readInt8=t.readInt8,e.readInt16LE=t.readInt16LE,e.readInt16BE=t.readInt16BE,e.readInt32LE=t.readInt32LE,e.readInt32BE=t.readInt32BE,e.readFloatLE=t.readFloatLE,e.readFloatBE=t.readFloatBE,e.readDoubleLE=t.readDoubleLE,e.readDoubleBE=t.readDoubleBE,e.writeUInt8=t.writeUInt8,e.writeUInt16LE=t.writeUInt16LE,e.writeUInt16BE=t.writeUInt16BE,e.writeUInt32LE=t.writeUInt32LE,e.writeUInt32BE=t.writeUInt32BE,e.writeInt8=t.writeInt8,e.writeInt16LE=t.writeInt16LE,e.writeInt16BE=t.writeInt16BE,e.writeInt32LE=t.writeInt32LE,e.writeInt32BE=t.writeInt32BE,e.writeFloatLE=t.writeFloatLE,e.writeFloatBE=t.writeFloatBE,e.writeDoubleLE=t.writeDoubleLE,e.writeDoubleBE=t.writeDoubleBE,e.fill=t.fill,e.inspect=t.inspect,e.toArrayBuffer=t.toArrayBuffer,e};}.call(this,O("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},O("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer");},{"base64-js":2,buffer:3,ieee754:10,lYpoI2:11}],4:[function(c,d,e){!function(e,t,a,n,r,o,i,u,s){var a=c("buffer").Buffer,f=4,l=new a(f);l.fill(0);d.exports={hash:function(e,t,n,r){for(var o=t(function(e,t){e.length%f!=0&&(n=e.length+(f-e.length%f),e=a.concat([e,l],n));for(var n,r=[],o=t?e.readInt32BE:e.readInt32LE,i=0;i<e.length;i+=f)r.push(o.call(e,i));return r}(e=a.isBuffer(e)?e:new a(e),r),8*e.length),t=r,i=new a(n),u=t?i.writeInt32BE:i.writeInt32LE,s=0;s<o.length;s++)u.call(i,o[s],4*s,!0);return i}};}.call(this,c("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},c("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js","/node_modules/gulp-browserify/node_modules/crypto-browserify");},{buffer:3,lYpoI2:11}],5:[function(v,e,_){!function(l,c,u,d,h,p,g,y,w){var u=v("buffer").Buffer,e=v("./sha"),t=v("./sha256"),n=v("./rng"),b={sha1:e,sha256:t,md5:v("./md5")},s=64,a=new u(s);function r(e,n){var r=b[e=e||"sha1"],o=[];return r||i("algorithm:",e,"is not yet supported"),{update:function(e){return u.isBuffer(e)||(e=new u(e)),o.push(e),this},digest:function(e){var t=u.concat(o),t=n?function(e,t,n){u.isBuffer(t)||(t=new u(t)),u.isBuffer(n)||(n=new u(n)),t.length>s?t=e(t):t.length<s&&(t=u.concat([t,a],s));for(var r=new u(s),o=new u(s),i=0;i<s;i++)r[i]=54^t[i],o[i]=92^t[i];return n=e(u.concat([r,n])),e(u.concat([o,n]))}(r,n,t):r(t);return o=null,e?t.toString(e):t}}}function i(){var e=[].slice.call(arguments).join(" ");throw new Error([e,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join("\n"))}a.fill(0),_.createHash=function(e){return r(e)},_.createHmac=r,_.randomBytes=function(e,t){if(!t||!t.call)return new u(n(e));try{t.call(this,void 0,new u(n(e)));}catch(e){t(e);}};var o,f=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],m=function(e){_[e]=function(){i("sorry,",e,"is not implemented yet");};};for(o in f)m(f[o]);}.call(this,v("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},v("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify");},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:11}],6:[function(w,b,e){!function(e,r,o,i,u,a,f,l,y){var t=w("./helpers");function n(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;for(var n=1732584193,r=-271733879,o=-1732584194,i=271733878,u=0;u<e.length;u+=16){var s=n,a=r,f=o,l=i,n=c(n,r,o,i,e[u+0],7,-680876936),i=c(i,n,r,o,e[u+1],12,-389564586),o=c(o,i,n,r,e[u+2],17,606105819),r=c(r,o,i,n,e[u+3],22,-1044525330);n=c(n,r,o,i,e[u+4],7,-176418897),i=c(i,n,r,o,e[u+5],12,1200080426),o=c(o,i,n,r,e[u+6],17,-1473231341),r=c(r,o,i,n,e[u+7],22,-45705983),n=c(n,r,o,i,e[u+8],7,1770035416),i=c(i,n,r,o,e[u+9],12,-1958414417),o=c(o,i,n,r,e[u+10],17,-42063),r=c(r,o,i,n,e[u+11],22,-1990404162),n=c(n,r,o,i,e[u+12],7,1804603682),i=c(i,n,r,o,e[u+13],12,-40341101),o=c(o,i,n,r,e[u+14],17,-1502002290),n=d(n,r=c(r,o,i,n,e[u+15],22,1236535329),o,i,e[u+1],5,-165796510),i=d(i,n,r,o,e[u+6],9,-1069501632),o=d(o,i,n,r,e[u+11],14,643717713),r=d(r,o,i,n,e[u+0],20,-373897302),n=d(n,r,o,i,e[u+5],5,-701558691),i=d(i,n,r,o,e[u+10],9,38016083),o=d(o,i,n,r,e[u+15],14,-660478335),r=d(r,o,i,n,e[u+4],20,-405537848),n=d(n,r,o,i,e[u+9],5,568446438),i=d(i,n,r,o,e[u+14],9,-1019803690),o=d(o,i,n,r,e[u+3],14,-187363961),r=d(r,o,i,n,e[u+8],20,1163531501),n=d(n,r,o,i,e[u+13],5,-1444681467),i=d(i,n,r,o,e[u+2],9,-51403784),o=d(o,i,n,r,e[u+7],14,1735328473),n=h(n,r=d(r,o,i,n,e[u+12],20,-1926607734),o,i,e[u+5],4,-378558),i=h(i,n,r,o,e[u+8],11,-2022574463),o=h(o,i,n,r,e[u+11],16,1839030562),r=h(r,o,i,n,e[u+14],23,-35309556),n=h(n,r,o,i,e[u+1],4,-1530992060),i=h(i,n,r,o,e[u+4],11,1272893353),o=h(o,i,n,r,e[u+7],16,-155497632),r=h(r,o,i,n,e[u+10],23,-1094730640),n=h(n,r,o,i,e[u+13],4,681279174),i=h(i,n,r,o,e[u+0],11,-358537222),o=h(o,i,n,r,e[u+3],16,-722521979),r=h(r,o,i,n,e[u+6],23,76029189),n=h(n,r,o,i,e[u+9],4,-640364487),i=h(i,n,r,o,e[u+12],11,-421815835),o=h(o,i,n,r,e[u+15],16,530742520),n=p(n,r=h(r,o,i,n,e[u+2],23,-995338651),o,i,e[u+0],6,-198630844),i=p(i,n,r,o,e[u+7],10,1126891415),o=p(o,i,n,r,e[u+14],15,-1416354905),r=p(r,o,i,n,e[u+5],21,-57434055),n=p(n,r,o,i,e[u+12],6,1700485571),i=p(i,n,r,o,e[u+3],10,-1894986606),o=p(o,i,n,r,e[u+10],15,-1051523),r=p(r,o,i,n,e[u+1],21,-2054922799),n=p(n,r,o,i,e[u+8],6,1873313359),i=p(i,n,r,o,e[u+15],10,-30611744),o=p(o,i,n,r,e[u+6],15,-1560198380),r=p(r,o,i,n,e[u+13],21,1309151649),n=p(n,r,o,i,e[u+4],6,-145523070),i=p(i,n,r,o,e[u+11],10,-1120210379),o=p(o,i,n,r,e[u+2],15,718787259),r=p(r,o,i,n,e[u+9],21,-343485551),n=g(n,s),r=g(r,a),o=g(o,f),i=g(i,l);}return Array(n,r,o,i)}function s(e,t,n,r,o,i){return g((t=g(g(t,e),g(r,i)))<<o|t>>>32-o,n)}function c(e,t,n,r,o,i,u){return s(t&n|~t&r,e,t,o,i,u)}function d(e,t,n,r,o,i,u){return s(t&r|n&~r,e,t,o,i,u)}function h(e,t,n,r,o,i,u){return s(t^n^r,e,t,o,i,u)}function p(e,t,n,r,o,i,u){return s(n^(t|~r),e,t,o,i,u)}function g(e,t){var n=(65535&e)+(65535&t);return (e>>16)+(t>>16)+(n>>16)<<16|65535&n}b.exports=function(e){return t.hash(e,n,16)};}.call(this,w("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},w("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify");},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(e,l,t){!function(e,t,n,r,o,i,u,s,f){l.exports=function(e){for(var t,n=new Array(e),r=0;r<e;r++)0==(3&r)&&(t=4294967296*Math.random()),n[r]=t>>>((3&r)<<3)&255;return n};}.call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify");},{buffer:3,lYpoI2:11}],8:[function(c,d,e){!function(e,t,n,r,o,s,a,f,l){var i=c("./helpers");function u(l,c){l[c>>5]|=128<<24-c%32,l[15+(c+64>>9<<4)]=c;for(var e,t,n,r=Array(80),o=1732584193,i=-271733879,u=-1732584194,s=271733878,d=-1009589776,h=0;h<l.length;h+=16){for(var p=o,g=i,y=u,w=s,b=d,a=0;a<80;a++){r[a]=a<16?l[h+a]:v(r[a-3]^r[a-8]^r[a-14]^r[a-16],1);var f=m(m(v(o,5),(f=i,t=u,n=s,(e=a)<20?f&t|~f&n:!(e<40)&&e<60?f&t|f&n|t&n:f^t^n)),m(m(d,r[a]),(e=a)<20?1518500249:e<40?1859775393:e<60?-1894007588:-899497514)),d=s,s=u,u=v(i,30),i=o,o=f;}o=m(o,p),i=m(i,g),u=m(u,y),s=m(s,w),d=m(d,b);}return Array(o,i,u,s,d)}function m(e,t){var n=(65535&e)+(65535&t);return (e>>16)+(t>>16)+(n>>16)<<16|65535&n}function v(e,t){return e<<t|e>>>32-t}d.exports=function(e){return i.hash(e,u,20,!0)};}.call(this,c("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},c("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify");},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(c,d,e){!function(e,t,n,r,u,s,a,f,l){function b(e,t){var n=(65535&e)+(65535&t);return (e>>16)+(t>>16)+(n>>16)<<16|65535&n}function o(e,l){var c,d=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),t=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),n=new Array(64);e[l>>5]|=128<<24-l%32,e[15+(l+64>>9<<4)]=l;for(var r,o,h=0;h<e.length;h+=16){for(var i=t[0],u=t[1],s=t[2],p=t[3],a=t[4],g=t[5],y=t[6],w=t[7],f=0;f<64;f++)n[f]=f<16?e[f+h]:b(b(b((o=n[f-2],m(o,17)^m(o,19)^v(o,10)),n[f-7]),(o=n[f-15],m(o,7)^m(o,18)^v(o,3))),n[f-16]),c=b(b(b(b(w,m(o=a,6)^m(o,11)^m(o,25)),a&g^~a&y),d[f]),n[f]),r=b(m(r=i,2)^m(r,13)^m(r,22),i&u^i&s^u&s),w=y,y=g,g=a,a=b(p,c),p=s,s=u,u=i,i=b(c,r);t[0]=b(i,t[0]),t[1]=b(u,t[1]),t[2]=b(s,t[2]),t[3]=b(p,t[3]),t[4]=b(a,t[4]),t[5]=b(g,t[5]),t[6]=b(y,t[6]),t[7]=b(w,t[7]);}return t}var i=c("./helpers"),m=function(e,t){return e>>>t|e<<32-t},v=function(e,t){return e>>>t};d.exports=function(e){return i.hash(e,o,32,!0)};}.call(this,c("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},c("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify");},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(e,t,f){!function(e,t,n,r,o,i,u,s,a){f.read=function(e,t,n,r,o){var i,u,l=8*o-r-1,c=(1<<l)-1,d=c>>1,s=-7,a=n?o-1:0,f=n?-1:1,o=e[t+a];for(a+=f,i=o&(1<<-s)-1,o>>=-s,s+=l;0<s;i=256*i+e[t+a],a+=f,s-=8);for(u=i&(1<<-s)-1,i>>=-s,s+=r;0<s;u=256*u+e[t+a],a+=f,s-=8);if(0===i)i=1-d;else {if(i===c)return u?NaN:1/0*(o?-1:1);u+=Math.pow(2,r),i-=d;}return (o?-1:1)*u*Math.pow(2,i-r)},f.write=function(e,t,l,n,r,c){var o,i,u=8*c-r-1,s=(1<<u)-1,a=s>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:c-1,h=n?1:-1,c=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(i=isNaN(t)?1:0,o=s):(o=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-o))<1&&(o--,n*=2),2<=(t+=1<=o+a?d/n:d*Math.pow(2,1-a))*n&&(o++,n/=2),s<=o+a?(i=0,o=s):1<=o+a?(i=(t*n-1)*Math.pow(2,r),o+=a):(i=t*Math.pow(2,a-1)*Math.pow(2,r),o=0));8<=r;e[l+f]=255&i,f+=h,i/=256,r-=8);for(o=o<<r|i,u+=r;0<u;e[l+f]=255&o,f+=h,o/=256,u-=8);e[l+f-h]|=128*c;};}.call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/ieee754/index.js","/node_modules/gulp-browserify/node_modules/ieee754");},{buffer:3,lYpoI2:11}],11:[function(e,h,t){!function(e,t,n,r,o,f,l,c,d){var i,u,s;function a(){}(e=h.exports={}).nextTick=(u="undefined"!=typeof window&&window.setImmediate,s="undefined"!=typeof window&&window.postMessage&&window.addEventListener,u?function(e){return window.setImmediate(e)}:s?(i=[],window.addEventListener("message",function(e){var t=e.source;t!==window&&null!==t||"process-tick"!==e.data||(e.stopPropagation(),0<i.length&&i.shift()());},!0),function(e){i.push(e),window.postMessage("process-tick","*");}):function(e){setTimeout(e,0);}),e.title="browser",e.browser=!0,e.env={},e.argv=[],e.on=a,e.addListener=a,e.once=a,e.off=a,e.removeListener=a,e.removeAllListeners=a,e.emit=a,e.binding=function(e){throw new Error("process.binding is not supported")},e.cwd=function(){return "/"},e.chdir=function(e){throw new Error("process.chdir is not supported")};}.call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process");},{buffer:3,lYpoI2:11}]},{},[1])(1)});
|
|
1005
|
+
});
|
|
1006
|
+
|
|
1007
|
+
function _extends() {
|
|
1008
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
1009
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
1010
|
+
var t = arguments[e];
|
|
1011
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
1012
|
+
}
|
|
1013
|
+
return n;
|
|
1014
|
+
}, _extends.apply(null, arguments);
|
|
1015
|
+
}
|
|
1016
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
1017
|
+
if (null == r) return {};
|
|
1018
|
+
var t = {};
|
|
1019
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
1020
|
+
if (e.includes(n)) continue;
|
|
1021
|
+
t[n] = r[n];
|
|
1022
|
+
}
|
|
1023
|
+
return t;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
var start = {
|
|
1027
|
+
id: 'start',
|
|
1028
|
+
plugin: ({
|
|
1029
|
+
type
|
|
1030
|
+
}, context) => {
|
|
1031
|
+
const {
|
|
1032
|
+
onRequestStart
|
|
1033
|
+
} = context.componentContext.getProps();
|
|
1034
|
+
const {
|
|
1035
|
+
setIsLoading,
|
|
1036
|
+
setIsComplete
|
|
1037
|
+
} = context.componentContext;
|
|
1038
|
+
onRequestStart && onRequestStart();
|
|
1039
|
+
if (type === 'refresh') {
|
|
1040
|
+
setIsLoading(true);
|
|
1041
|
+
}
|
|
1042
|
+
setIsComplete(false);
|
|
1043
|
+
}
|
|
1044
|
+
};
|
|
1045
|
+
|
|
1046
|
+
var loader = {
|
|
1047
|
+
id: 'loader',
|
|
1048
|
+
plugin: async (props, context) => {
|
|
1049
|
+
const {
|
|
1050
|
+
loader
|
|
1051
|
+
} = context.componentContext.getProps();
|
|
1052
|
+
if (typeof loader !== 'function') {
|
|
1053
|
+
return;
|
|
1054
|
+
}
|
|
1055
|
+
if (context.outputStack['cache']) {
|
|
1056
|
+
return context.outputStack['cache'];
|
|
1057
|
+
}
|
|
1058
|
+
const data = await loader(context.outputStack['params']);
|
|
1059
|
+
return {
|
|
1060
|
+
data: {
|
|
1061
|
+
code: 200,
|
|
1062
|
+
results: data
|
|
1063
|
+
}
|
|
1064
|
+
};
|
|
1065
|
+
},
|
|
1066
|
+
dependencies: ['params']
|
|
1067
|
+
};
|
|
1068
|
+
|
|
1069
|
+
const _excluded$3 = ["options", "urlParams"];
|
|
1070
|
+
var params = {
|
|
1071
|
+
id: 'params',
|
|
1072
|
+
plugin: ({
|
|
1073
|
+
options,
|
|
1074
|
+
url,
|
|
1075
|
+
method,
|
|
1076
|
+
params,
|
|
1077
|
+
data
|
|
1078
|
+
}, context) => {
|
|
1079
|
+
const _context$componentCon = context.componentContext.getProps(),
|
|
1080
|
+
{
|
|
1081
|
+
options: componentOptions,
|
|
1082
|
+
urlParams
|
|
1083
|
+
} = _context$componentCon,
|
|
1084
|
+
componentProps = _objectWithoutPropertiesLoose(_context$componentCon, _excluded$3);
|
|
1085
|
+
const targetParams = merge__default["default"]({}, componentOptions, pick__default["default"](componentProps, ['url', 'method', 'params', 'data']), options, {
|
|
1086
|
+
url,
|
|
1087
|
+
method,
|
|
1088
|
+
params,
|
|
1089
|
+
data,
|
|
1090
|
+
urlParams
|
|
1091
|
+
});
|
|
1092
|
+
const output = Object.assign({}, targetParams);
|
|
1093
|
+
if (typeof urlParams === 'object' && Object.keys(urlParams).length > 0 && typeof output.url === 'string') {
|
|
1094
|
+
output.url = output.url.replace(/{([\s\S]+?)}/g, (match, name) => {
|
|
1095
|
+
return urlParams.hasOwnProperty(name) ? urlParams[name] : match;
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
context.componentContext.setRequestParams(targetParams);
|
|
1099
|
+
return output;
|
|
1100
|
+
}
|
|
1101
|
+
};
|
|
1102
|
+
|
|
1103
|
+
const _excluded$2 = ["isLocal"];
|
|
1104
|
+
class Cache {
|
|
1105
|
+
static now() {
|
|
1106
|
+
return new Date().getTime();
|
|
1107
|
+
}
|
|
1108
|
+
constructor(options) {
|
|
1109
|
+
const {
|
|
1110
|
+
ttl,
|
|
1111
|
+
maxLength,
|
|
1112
|
+
isLocal,
|
|
1113
|
+
localName
|
|
1114
|
+
} = Object.assign({}, options);
|
|
1115
|
+
this.ttl = ttl || 0;
|
|
1116
|
+
this.data = {};
|
|
1117
|
+
this.cacheNameMapping = {};
|
|
1118
|
+
this.maxLength = maxLength || 1000;
|
|
1119
|
+
this.isLocal = localName ? true : isLocal;
|
|
1120
|
+
this.localName = localName;
|
|
1121
|
+
this._load();
|
|
1122
|
+
}
|
|
1123
|
+
_load() {
|
|
1124
|
+
if (!this.isLocal) {
|
|
1125
|
+
return;
|
|
1126
|
+
}
|
|
1127
|
+
try {
|
|
1128
|
+
const dataString = window.localStorage && window.localStorage.getItem(this.localName || Cache.KEY_NAME);
|
|
1129
|
+
if (!dataString) {
|
|
1130
|
+
return;
|
|
1131
|
+
}
|
|
1132
|
+
const dataObj = JSON.parse(dataString);
|
|
1133
|
+
Object.keys(dataObj).forEach(key => {
|
|
1134
|
+
dataObj[key].isLocal = true;
|
|
1135
|
+
});
|
|
1136
|
+
this.data = dataObj;
|
|
1137
|
+
} catch (e) {}
|
|
1138
|
+
}
|
|
1139
|
+
_save() {
|
|
1140
|
+
if (!this.isLocal) {
|
|
1141
|
+
return;
|
|
1142
|
+
}
|
|
1143
|
+
const keys = Object.keys(this.data);
|
|
1144
|
+
Promise.all(keys.map(key => this.data[key].value)).then(data => {
|
|
1145
|
+
const output = {};
|
|
1146
|
+
Object.keys(this.data).forEach((key, index) => {
|
|
1147
|
+
const _this$data$key = this.data[key],
|
|
1148
|
+
{
|
|
1149
|
+
isLocal
|
|
1150
|
+
} = _this$data$key,
|
|
1151
|
+
props = _objectWithoutPropertiesLoose(_this$data$key, _excluded$2);
|
|
1152
|
+
if (isLocal === true) {
|
|
1153
|
+
output[key] = Object.assign({}, props, {
|
|
1154
|
+
value: data[index]
|
|
1155
|
+
});
|
|
1156
|
+
}
|
|
1157
|
+
});
|
|
1158
|
+
window.localStorage && window.localStorage.setItem(this.localName || Cache.KEY_NAME, JSON.stringify(output));
|
|
1159
|
+
});
|
|
1160
|
+
}
|
|
1161
|
+
get(key) {
|
|
1162
|
+
const obj = this.data[key];
|
|
1163
|
+
let val = null;
|
|
1164
|
+
if (obj) {
|
|
1165
|
+
val = obj.value;
|
|
1166
|
+
if (obj.expires && Cache.now() >= obj.expires) {
|
|
1167
|
+
val = null;
|
|
1168
|
+
delete this.data[key];
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
this._save();
|
|
1172
|
+
return val;
|
|
1173
|
+
}
|
|
1174
|
+
delByCacheName(cacheName) {
|
|
1175
|
+
if (this.cacheNameMapping[cacheName]) {
|
|
1176
|
+
this.cacheNameMapping[cacheName].forEach(key => {
|
|
1177
|
+
this.del(key);
|
|
1178
|
+
});
|
|
1179
|
+
this.cacheNameMapping[cacheName].clear();
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
del(key) {
|
|
1183
|
+
const oldValue = this.get(key);
|
|
1184
|
+
delete this.data[key];
|
|
1185
|
+
this._save();
|
|
1186
|
+
return oldValue;
|
|
1187
|
+
}
|
|
1188
|
+
put(key, val, options) {
|
|
1189
|
+
let {
|
|
1190
|
+
ttl,
|
|
1191
|
+
isLocal,
|
|
1192
|
+
cacheName
|
|
1193
|
+
} = options;
|
|
1194
|
+
if (ttl === undefined) {
|
|
1195
|
+
ttl = this.ttl;
|
|
1196
|
+
}
|
|
1197
|
+
let oldValue = this.del(key);
|
|
1198
|
+
if (val !== null) {
|
|
1199
|
+
const keys = Object.keys(this.data);
|
|
1200
|
+
if (keys.length >= this.maxLength) {
|
|
1201
|
+
const delKey = keys.sort((a, b) => {
|
|
1202
|
+
return this.data[a].createTime - this.data[b].createTime;
|
|
1203
|
+
})[0];
|
|
1204
|
+
delete this.data[delKey];
|
|
1205
|
+
}
|
|
1206
|
+
const now = Cache.now();
|
|
1207
|
+
this.data[key] = {
|
|
1208
|
+
expires: ttl === 0 ? null : now + ttl,
|
|
1209
|
+
value: val,
|
|
1210
|
+
createTime: now,
|
|
1211
|
+
isLocal
|
|
1212
|
+
};
|
|
1213
|
+
if (cacheName && !this.cacheNameMapping[cacheName]) {
|
|
1214
|
+
this.cacheNameMapping[cacheName] = new Set();
|
|
1215
|
+
}
|
|
1216
|
+
if (cacheName) {
|
|
1217
|
+
this.cacheNameMapping[cacheName].add(key);
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
this._save();
|
|
1221
|
+
return oldValue;
|
|
1222
|
+
}
|
|
1223
|
+
clean() {
|
|
1224
|
+
this.data = {};
|
|
1225
|
+
this._save();
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
Cache.KEY_NAME = 'REACT_FETCH_CACHE';
|
|
1229
|
+
|
|
1230
|
+
const globalParams = {
|
|
1231
|
+
cache: new Cache({
|
|
1232
|
+
ttl: 1000 * 60 * 10,
|
|
1233
|
+
maxLength: 1000,
|
|
1234
|
+
isLocal: true
|
|
1235
|
+
}),
|
|
1236
|
+
ajax: () => {
|
|
1237
|
+
throw new Error('默认的axios配置已经移除,请首先在preset里面配置');
|
|
1238
|
+
},
|
|
1239
|
+
loading: null,
|
|
1240
|
+
error: null,
|
|
1241
|
+
empty: null,
|
|
1242
|
+
pagination: {
|
|
1243
|
+
initCurrent: 1,
|
|
1244
|
+
pageSize: 10,
|
|
1245
|
+
transform: params => params
|
|
1246
|
+
},
|
|
1247
|
+
transformResponse: response => {
|
|
1248
|
+
const {
|
|
1249
|
+
data
|
|
1250
|
+
} = response;
|
|
1251
|
+
response.data = {
|
|
1252
|
+
code: data.code,
|
|
1253
|
+
msg: data.msg,
|
|
1254
|
+
results: data.results
|
|
1255
|
+
};
|
|
1256
|
+
return response;
|
|
1257
|
+
}
|
|
1258
|
+
};
|
|
1259
|
+
|
|
1260
|
+
var cache = {
|
|
1261
|
+
id: 'cache',
|
|
1262
|
+
plugin: ({
|
|
1263
|
+
force
|
|
1264
|
+
}, context) => {
|
|
1265
|
+
const {
|
|
1266
|
+
cache
|
|
1267
|
+
} = context.componentContext.getProps();
|
|
1268
|
+
const token = context.componentContext.getRequestToken();
|
|
1269
|
+
if (force === true || !cache) {
|
|
1270
|
+
return;
|
|
1271
|
+
}
|
|
1272
|
+
const cacheKey = (cache === true ? '' : cache) + token;
|
|
1273
|
+
const cacheData = globalParams.cache.get(cacheKey);
|
|
1274
|
+
if (!cacheData) {
|
|
1275
|
+
return;
|
|
1276
|
+
}
|
|
1277
|
+
return Promise.resolve(cacheData);
|
|
1278
|
+
}
|
|
1279
|
+
};
|
|
1280
|
+
|
|
1281
|
+
var request$1 = {
|
|
1282
|
+
id: 'request',
|
|
1283
|
+
plugin: ({
|
|
1284
|
+
force
|
|
1285
|
+
}, context) => {
|
|
1286
|
+
if (context.outputStack['loader'] || context.errorStack['loader']) {
|
|
1287
|
+
return;
|
|
1288
|
+
}
|
|
1289
|
+
if (context.outputStack['cache']) {
|
|
1290
|
+
return context.outputStack['cache'];
|
|
1291
|
+
}
|
|
1292
|
+
const token = context.componentContext.getRequestToken();
|
|
1293
|
+
context.componentContext.requestParams = context.outputStack['params'];
|
|
1294
|
+
const {
|
|
1295
|
+
ajax
|
|
1296
|
+
} = context.componentContext.getProps();
|
|
1297
|
+
const requestPromise = force !== true && get__default["default"](context.globalContext.pendingRequest, token) || (ajax || globalParams.ajax)(context.outputStack['params']);
|
|
1298
|
+
context.globalContext.pendingRequest = Object.assign({}, context.globalContext.pendingRequest, {
|
|
1299
|
+
[token]: requestPromise
|
|
1300
|
+
});
|
|
1301
|
+
return requestPromise.then(data => {
|
|
1302
|
+
delete context.globalContext.pendingRequest[token];
|
|
1303
|
+
return data;
|
|
1304
|
+
});
|
|
1305
|
+
},
|
|
1306
|
+
dependencies: ['params']
|
|
1307
|
+
};
|
|
1308
|
+
|
|
1309
|
+
var cacheRecord = {
|
|
1310
|
+
id: 'cache-record',
|
|
1311
|
+
plugin: (props, context) => {
|
|
1312
|
+
const {
|
|
1313
|
+
cache,
|
|
1314
|
+
isLocal,
|
|
1315
|
+
ttl
|
|
1316
|
+
} = context.componentContext.getProps();
|
|
1317
|
+
const token = context.componentContext.getRequestToken();
|
|
1318
|
+
const cacheName = cache === true ? '' : cache;
|
|
1319
|
+
const cacheKey = cacheName + token;
|
|
1320
|
+
if (cache && (context.outputStack['request'] || context.outputStack['loader']) && context.outputStack['output-data'] !== void 0) {
|
|
1321
|
+
globalParams.cache.put(cacheKey, context.outputStack['request'] || context.outputStack['loader'], {
|
|
1322
|
+
ttl,
|
|
1323
|
+
isLocal,
|
|
1324
|
+
cacheName
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
},
|
|
1328
|
+
dependencies: ['cache', 'request', 'output-data']
|
|
1329
|
+
};
|
|
1330
|
+
|
|
1331
|
+
var transformResponse = {
|
|
1332
|
+
id: 'transform-response',
|
|
1333
|
+
plugin: (props, context) => {
|
|
1334
|
+
const {
|
|
1335
|
+
transformResponse,
|
|
1336
|
+
ignoreSuccessState,
|
|
1337
|
+
options
|
|
1338
|
+
} = context.componentContext.getProps();
|
|
1339
|
+
const response = context.outputStack['request'];
|
|
1340
|
+
if (!response) {
|
|
1341
|
+
return;
|
|
1342
|
+
}
|
|
1343
|
+
if (ignoreSuccessState === true) {
|
|
1344
|
+
return response;
|
|
1345
|
+
}
|
|
1346
|
+
return (transformResponse || globalParams.transformResponse)(Object.assign({}, response));
|
|
1347
|
+
},
|
|
1348
|
+
dependencies: ['request']
|
|
1349
|
+
};
|
|
1350
|
+
|
|
1351
|
+
var outputData = {
|
|
1352
|
+
id: 'output-data',
|
|
1353
|
+
plugin: (props, context) => {
|
|
1354
|
+
const {
|
|
1355
|
+
options,
|
|
1356
|
+
onRequestSuccess,
|
|
1357
|
+
ignoreSuccessState,
|
|
1358
|
+
transformData
|
|
1359
|
+
} = context.componentContext.getProps();
|
|
1360
|
+
if (Object.keys(context.errorStack).length > 0) {
|
|
1361
|
+
return;
|
|
1362
|
+
}
|
|
1363
|
+
const responseData = context.output.data;
|
|
1364
|
+
if (ignoreSuccessState !== true && responseData.code !== 200) {
|
|
1365
|
+
const error = new Error(responseData.msg);
|
|
1366
|
+
error.responseData = responseData;
|
|
1367
|
+
throw error;
|
|
1368
|
+
}
|
|
1369
|
+
const output = (output => typeof transformData === 'function' ? transformData(output, context.outputStack['params']) : output)((ignoreSuccessState !== true ? responseData.results : responseData) || {});
|
|
1370
|
+
onRequestSuccess && onRequestSuccess(output);
|
|
1371
|
+
return output;
|
|
1372
|
+
},
|
|
1373
|
+
dependencies: ['request']
|
|
1374
|
+
};
|
|
1375
|
+
|
|
1376
|
+
var loadMore = {
|
|
1377
|
+
id: 'load-more',
|
|
1378
|
+
plugin: ({
|
|
1379
|
+
type,
|
|
1380
|
+
callback
|
|
1381
|
+
}, context) => {
|
|
1382
|
+
if (type === 'load-more' && typeof callback === 'function') {
|
|
1383
|
+
const {
|
|
1384
|
+
fetchData
|
|
1385
|
+
} = context.componentContext.getState();
|
|
1386
|
+
return callback(fetchData, context.output);
|
|
1387
|
+
}
|
|
1388
|
+
},
|
|
1389
|
+
dependencies: ['output-data']
|
|
1390
|
+
};
|
|
1391
|
+
|
|
1392
|
+
var complete = {
|
|
1393
|
+
id: 'complete',
|
|
1394
|
+
plugin: ({
|
|
1395
|
+
type
|
|
1396
|
+
}, context) => {
|
|
1397
|
+
const {
|
|
1398
|
+
setIsLoading,
|
|
1399
|
+
setIsComplete,
|
|
1400
|
+
setFetchData
|
|
1401
|
+
} = context.componentContext;
|
|
1402
|
+
setFetchData(context.output);
|
|
1403
|
+
if (type === 'refresh') {
|
|
1404
|
+
setIsLoading(false);
|
|
1405
|
+
}
|
|
1406
|
+
setIsComplete(true);
|
|
1407
|
+
}
|
|
1408
|
+
};
|
|
1409
|
+
|
|
1410
|
+
var error = {
|
|
1411
|
+
id: 'error',
|
|
1412
|
+
plugin: (props, context) => {
|
|
1413
|
+
const {
|
|
1414
|
+
onRequestError,
|
|
1415
|
+
onRequestComplete
|
|
1416
|
+
} = context.componentContext.getProps();
|
|
1417
|
+
const {
|
|
1418
|
+
setError
|
|
1419
|
+
} = context.componentContext;
|
|
1420
|
+
if (Object.keys(context.errorStack).length > 0) {
|
|
1421
|
+
const errorMsg = Object.values(context.errorStack).map(e => {
|
|
1422
|
+
return e.message;
|
|
1423
|
+
}).filter(msg => !!msg).join('\n');
|
|
1424
|
+
onRequestError && onRequestError(Object.values(context.errorStack));
|
|
1425
|
+
setError(errorMsg || '请求发生错误');
|
|
1426
|
+
} else {
|
|
1427
|
+
setError(null);
|
|
1428
|
+
}
|
|
1429
|
+
onRequestComplete && onRequestComplete(context);
|
|
1430
|
+
}
|
|
1431
|
+
};
|
|
1432
|
+
|
|
1433
|
+
const plugins = [start, params, cache, loader, request$1, transformResponse, outputData, cacheRecord, loadMore, complete, error];
|
|
1434
|
+
const globalContext = {};
|
|
1435
|
+
const createRunner = componentContext => {
|
|
1436
|
+
return async props => {
|
|
1437
|
+
props = Object.assign({}, props);
|
|
1438
|
+
const allPlugins = plugins;
|
|
1439
|
+
const pluginContext = {
|
|
1440
|
+
props,
|
|
1441
|
+
globalContext,
|
|
1442
|
+
componentContext,
|
|
1443
|
+
requestContext: {},
|
|
1444
|
+
outputStack: {},
|
|
1445
|
+
errorStack: {},
|
|
1446
|
+
runPath: [],
|
|
1447
|
+
output: null
|
|
1448
|
+
};
|
|
1449
|
+
const {
|
|
1450
|
+
debug
|
|
1451
|
+
} = componentContext.getProps();
|
|
1452
|
+
for (let currentPlugin of allPlugins) {
|
|
1453
|
+
try {
|
|
1454
|
+
// 依赖检查,依赖插件没有成功运行,跳过插件
|
|
1455
|
+
if ((currentPlugin.dependencies || []).find(name => {
|
|
1456
|
+
return pluginContext.runPath.indexOf(name) === -1;
|
|
1457
|
+
})) {
|
|
1458
|
+
continue;
|
|
1459
|
+
}
|
|
1460
|
+
if (debug === true) {
|
|
1461
|
+
console.info('react-fetch:plugin-' + currentPlugin.id + ':start', pluginContext);
|
|
1462
|
+
}
|
|
1463
|
+
const output = await currentPlugin.plugin(props, pluginContext);
|
|
1464
|
+
if (debug === true) {
|
|
1465
|
+
console.info('react-fetch:plugin-' + currentPlugin.id + ':complete', output);
|
|
1466
|
+
}
|
|
1467
|
+
pluginContext.outputStack[currentPlugin.id] = output;
|
|
1468
|
+
pluginContext.output = output !== void 0 ? output : pluginContext.output;
|
|
1469
|
+
pluginContext.runPath.push(currentPlugin.id);
|
|
1470
|
+
} catch (e) {
|
|
1471
|
+
console.error(e);
|
|
1472
|
+
pluginContext.errorStack[currentPlugin.id] = e;
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
return pluginContext;
|
|
1476
|
+
};
|
|
1477
|
+
};
|
|
1478
|
+
|
|
1479
|
+
const getRequestToken = props => object_hash(pick__default["default"](props, ['url', 'params', 'method', 'data', 'urlParams', 'options']), {
|
|
1480
|
+
algorithm: 'md5',
|
|
1481
|
+
encoding: 'base64'
|
|
1482
|
+
});
|
|
1483
|
+
|
|
1484
|
+
const useFetch = fetcherOptions => {
|
|
1485
|
+
const props = Object.assign({
|
|
1486
|
+
auto: true,
|
|
1487
|
+
updateType: 'reload'
|
|
1488
|
+
}, fetcherOptions);
|
|
1489
|
+
const propsRef = React.useRef(props);
|
|
1490
|
+
propsRef.current = props;
|
|
1491
|
+
const [isLoading, setIsLoading] = React.useState(false);
|
|
1492
|
+
const [isComplete, setIsComplete] = React.useState(false);
|
|
1493
|
+
const [fetchData, setFetchData] = React.useState(null);
|
|
1494
|
+
const [error, setError] = React.useState(null);
|
|
1495
|
+
const [requestParams, setRequestParams] = React.useState({});
|
|
1496
|
+
const stateRef = React.useRef({
|
|
1497
|
+
isLoading,
|
|
1498
|
+
isComplete,
|
|
1499
|
+
fetchData,
|
|
1500
|
+
error,
|
|
1501
|
+
requestParams
|
|
1502
|
+
});
|
|
1503
|
+
stateRef.current = {
|
|
1504
|
+
isLoading,
|
|
1505
|
+
isComplete,
|
|
1506
|
+
fetchData,
|
|
1507
|
+
error,
|
|
1508
|
+
requestParams
|
|
1509
|
+
};
|
|
1510
|
+
const requestToken = getRequestToken(props);
|
|
1511
|
+
const requestTokenRef = React.useRef(requestToken);
|
|
1512
|
+
requestTokenRef.current = requestToken;
|
|
1513
|
+
const pluginRunnerRef = React.useRef();
|
|
1514
|
+
React.useMemo(() => {
|
|
1515
|
+
pluginRunnerRef.current = createRunner({
|
|
1516
|
+
getProps: () => propsRef.current,
|
|
1517
|
+
getRequestToken: () => requestTokenRef.current,
|
|
1518
|
+
getState: () => stateRef.current,
|
|
1519
|
+
requestParams,
|
|
1520
|
+
setRequestParams,
|
|
1521
|
+
setFetchData,
|
|
1522
|
+
setError,
|
|
1523
|
+
setIsComplete,
|
|
1524
|
+
setIsLoading
|
|
1525
|
+
});
|
|
1526
|
+
}, []);
|
|
1527
|
+
const send = (sendProps, force = true) => {
|
|
1528
|
+
return pluginRunnerRef.current(Object.assign({}, sendProps, {
|
|
1529
|
+
force
|
|
1530
|
+
}));
|
|
1531
|
+
};
|
|
1532
|
+
const refresh = (sendProps, force = true) => {
|
|
1533
|
+
return pluginRunnerRef.current(Object.assign({}, sendProps, {
|
|
1534
|
+
force,
|
|
1535
|
+
type: 'refresh'
|
|
1536
|
+
}));
|
|
1537
|
+
};
|
|
1538
|
+
const reload = (sendProps, force = true) => {
|
|
1539
|
+
return pluginRunnerRef.current(Object.assign({}, sendProps, {
|
|
1540
|
+
force,
|
|
1541
|
+
type: 'reload'
|
|
1542
|
+
}));
|
|
1543
|
+
};
|
|
1544
|
+
const loadMore = (sendProps, callback, force = true) => {
|
|
1545
|
+
return pluginRunnerRef.current(Object.assign({}, sendProps, {
|
|
1546
|
+
force,
|
|
1547
|
+
callback,
|
|
1548
|
+
type: 'load-more'
|
|
1549
|
+
}));
|
|
1550
|
+
};
|
|
1551
|
+
const apiRef = React.useRef({});
|
|
1552
|
+
apiRef.current = {
|
|
1553
|
+
send,
|
|
1554
|
+
refresh,
|
|
1555
|
+
reload,
|
|
1556
|
+
loadMore,
|
|
1557
|
+
setData: setFetchData
|
|
1558
|
+
};
|
|
1559
|
+
React.useEffect(() => {
|
|
1560
|
+
if (propsRef.current.auto) {
|
|
1561
|
+
if (stateRef.current.isComplete) {
|
|
1562
|
+
apiRef.current.send({
|
|
1563
|
+
type: propsRef.current.updateType
|
|
1564
|
+
}, false);
|
|
1565
|
+
} else {
|
|
1566
|
+
apiRef.current.refresh({}, false);
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
}, [requestToken]);
|
|
1570
|
+
return {
|
|
1571
|
+
isLoading,
|
|
1572
|
+
isComplete,
|
|
1573
|
+
data: fetchData,
|
|
1574
|
+
error,
|
|
1575
|
+
send,
|
|
1576
|
+
refresh,
|
|
1577
|
+
reload,
|
|
1578
|
+
loadMore,
|
|
1579
|
+
setData: setFetchData,
|
|
1580
|
+
requestParams
|
|
1581
|
+
};
|
|
1582
|
+
};
|
|
1583
|
+
|
|
1584
|
+
const _excluded$1 = ["component", "render", "loading", "isEmpty", "empty", "error"];
|
|
1585
|
+
const Fetch = React.forwardRef((_ref, ref) => {
|
|
1586
|
+
let {
|
|
1587
|
+
component,
|
|
1588
|
+
render,
|
|
1589
|
+
loading,
|
|
1590
|
+
isEmpty,
|
|
1591
|
+
empty,
|
|
1592
|
+
error: errorComponent
|
|
1593
|
+
} = _ref,
|
|
1594
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
1595
|
+
const {
|
|
1596
|
+
isLoading,
|
|
1597
|
+
isComplete,
|
|
1598
|
+
data,
|
|
1599
|
+
requestParams,
|
|
1600
|
+
error,
|
|
1601
|
+
send,
|
|
1602
|
+
refresh,
|
|
1603
|
+
reload,
|
|
1604
|
+
loadMore,
|
|
1605
|
+
setData
|
|
1606
|
+
} = useFetch(props);
|
|
1607
|
+
const fetchPropsList = ['url', 'params', 'urlParams', 'method', 'data', 'cache', 'ttl', 'isLocal', 'auto', 'loader', 'options', 'updateType', 'onRequestError', 'onRequestSuccess', 'onRequestComplete', 'onRequestStart', 'debug', 'ajax', 'transformData', 'transformResponse'];
|
|
1608
|
+
const otherProps = omit__default["default"](props, fetchPropsList);
|
|
1609
|
+
const fetchProps = pick__default["default"](props, fetchPropsList);
|
|
1610
|
+
React.useImperativeHandle(ref, () => {
|
|
1611
|
+
return {
|
|
1612
|
+
isLoading,
|
|
1613
|
+
isComplete,
|
|
1614
|
+
data,
|
|
1615
|
+
requestParams,
|
|
1616
|
+
error,
|
|
1617
|
+
send,
|
|
1618
|
+
refresh,
|
|
1619
|
+
reload,
|
|
1620
|
+
loadMore,
|
|
1621
|
+
setData
|
|
1622
|
+
};
|
|
1623
|
+
});
|
|
1624
|
+
if (isLoading) {
|
|
1625
|
+
return loading === void 0 ? globalParams.loading : loading;
|
|
1626
|
+
}
|
|
1627
|
+
if (error) {
|
|
1628
|
+
const _error = errorComponent === void 0 ? globalParams.error : errorComponent;
|
|
1629
|
+
if (typeof _error === 'function') {
|
|
1630
|
+
return _error(error);
|
|
1631
|
+
}
|
|
1632
|
+
return _error;
|
|
1633
|
+
}
|
|
1634
|
+
if (!isComplete && !data) {
|
|
1635
|
+
return null;
|
|
1636
|
+
}
|
|
1637
|
+
if (typeof isEmpty === 'function' ? isEmpty(data, requestParams) : !data) {
|
|
1638
|
+
return empty === void 0 ? globalParams.empty : empty;
|
|
1639
|
+
}
|
|
1640
|
+
if (component) {
|
|
1641
|
+
const FetchComponent = component;
|
|
1642
|
+
return /*#__PURE__*/React__default["default"].createElement(FetchComponent, _extends({}, otherProps, {
|
|
1643
|
+
fetchProps: fetchProps,
|
|
1644
|
+
isComplete: isComplete,
|
|
1645
|
+
data: data,
|
|
1646
|
+
refresh: refresh,
|
|
1647
|
+
reload: reload,
|
|
1648
|
+
setData: setData,
|
|
1649
|
+
loadMore: loadMore,
|
|
1650
|
+
send: send,
|
|
1651
|
+
requestParams: requestParams
|
|
1652
|
+
}));
|
|
1653
|
+
}
|
|
1654
|
+
if (render) {
|
|
1655
|
+
return render(_extends({}, otherProps, {
|
|
1656
|
+
fetchProps,
|
|
1657
|
+
isComplete,
|
|
1658
|
+
data,
|
|
1659
|
+
refresh,
|
|
1660
|
+
reload,
|
|
1661
|
+
setData,
|
|
1662
|
+
loadMore,
|
|
1663
|
+
send,
|
|
1664
|
+
requestParams
|
|
1665
|
+
}));
|
|
1666
|
+
}
|
|
1667
|
+
throw new Error('请传入component参数或者render参数');
|
|
1668
|
+
});
|
|
1669
|
+
|
|
1670
|
+
var style = {"list":"_YTqxA","is-popup":"_TR-1a","default-list":"_IZN7r","is-selected-all":"_GCIMn","default-list-item":"_AYi0i","is-selected":"_eovZv","single-checked":"_Tr-bO","is-disabled":"_T-hri","selected-all":"_4XFtm","selected-tag":"_Whlzr","select-search":"_7zuBL","select-tree-item-description":"_R-Sye","footer":"_PjlnR"};
|
|
1671
|
+
|
|
1672
|
+
const _excluded = ["children"],
|
|
1673
|
+
_excluded2 = ["data"];
|
|
1674
|
+
const parseTreeData = memoize__default["default"](function (data, _ref) {
|
|
1675
|
+
if (data === void 0) {
|
|
1676
|
+
data = [];
|
|
1677
|
+
}
|
|
1678
|
+
let {
|
|
1679
|
+
parentKey,
|
|
1680
|
+
valueKey,
|
|
1681
|
+
childrenKey
|
|
1682
|
+
} = _ref;
|
|
1683
|
+
const parseTree = output => {
|
|
1684
|
+
return output.map(node => {
|
|
1685
|
+
const children = data.filter(item => {
|
|
1686
|
+
return !isNil__default["default"](node[valueKey]) && item[parentKey] === node[valueKey];
|
|
1687
|
+
});
|
|
1688
|
+
return Object.assign({}, node, {
|
|
1689
|
+
[childrenKey]: parseTree(children)
|
|
1690
|
+
});
|
|
1691
|
+
});
|
|
1692
|
+
};
|
|
1693
|
+
return {
|
|
1694
|
+
treeData: parseTree(data.filter(item => !item[parentKey])),
|
|
1695
|
+
ids: data.map(item => item.id)
|
|
1696
|
+
};
|
|
1697
|
+
});
|
|
1698
|
+
const SelectTree = React.forwardRef((_ref2, ref) => {
|
|
1699
|
+
let {
|
|
1700
|
+
children
|
|
1701
|
+
} = _ref2,
|
|
1702
|
+
p = _objectWithoutPropertiesLoose$1(_ref2, _excluded);
|
|
1703
|
+
const fetchListRef = React.useRef(null);
|
|
1704
|
+
const [expandedKeys, setExpandedKeys] = React.useState([]);
|
|
1705
|
+
const props = Object.assign({}, {
|
|
1706
|
+
parentKey: 'parentId',
|
|
1707
|
+
childrenKey: 'children',
|
|
1708
|
+
renderItemContent: _ref3 => {
|
|
1709
|
+
let {
|
|
1710
|
+
item,
|
|
1711
|
+
props
|
|
1712
|
+
} = _ref3;
|
|
1713
|
+
const {
|
|
1714
|
+
labelKey
|
|
1715
|
+
} = props;
|
|
1716
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1717
|
+
className: 'select-tree-item-label'
|
|
1718
|
+
}, item[labelKey]));
|
|
1719
|
+
},
|
|
1720
|
+
renderItem: contextProps => {
|
|
1721
|
+
const {
|
|
1722
|
+
item,
|
|
1723
|
+
props,
|
|
1724
|
+
isSelectedAll,
|
|
1725
|
+
value,
|
|
1726
|
+
onSelect,
|
|
1727
|
+
setValue,
|
|
1728
|
+
onOpenChange
|
|
1729
|
+
} = contextProps;
|
|
1730
|
+
const {
|
|
1731
|
+
single,
|
|
1732
|
+
isPopup,
|
|
1733
|
+
renderItemContent,
|
|
1734
|
+
valueKey
|
|
1735
|
+
} = props;
|
|
1736
|
+
const isChecked = value.some(target => target[valueKey] === item[valueKey]);
|
|
1737
|
+
return /*#__PURE__*/React__default["default"].createElement(antd.Flex, {
|
|
1738
|
+
className: classnames__default["default"](style['default-list-item'], 'select-tree-item', {
|
|
1739
|
+
[style['is-selected']]: isChecked,
|
|
1740
|
+
[style['is-disabled']]: item.disabled
|
|
1741
|
+
}),
|
|
1742
|
+
key: item[valueKey],
|
|
1743
|
+
onClick: () => {
|
|
1744
|
+
if (item.disabled) {
|
|
1745
|
+
return;
|
|
1746
|
+
}
|
|
1747
|
+
if (isSelectedAll) {
|
|
1748
|
+
return;
|
|
1749
|
+
}
|
|
1750
|
+
if (single) {
|
|
1751
|
+
setValue([item]);
|
|
1752
|
+
} else {
|
|
1753
|
+
onSelect(item);
|
|
1754
|
+
}
|
|
1755
|
+
if (isPopup && single) {
|
|
1756
|
+
onOpenChange(false);
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
}, !single && /*#__PURE__*/React__default["default"].createElement(antd.Flex, null, /*#__PURE__*/React__default["default"].createElement(antd.Checkbox, {
|
|
1760
|
+
checked: isSelectedAll || isChecked,
|
|
1761
|
+
disabled: isSelectedAll || item.disabled
|
|
1762
|
+
})), /*#__PURE__*/React__default["default"].createElement(antd.Flex, {
|
|
1763
|
+
vertical: true,
|
|
1764
|
+
gag: 8,
|
|
1765
|
+
flex: 1,
|
|
1766
|
+
className: 'select-tree-item-content'
|
|
1767
|
+
}, renderItemContent(contextProps)), single && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1768
|
+
className: style['single-checked']
|
|
1769
|
+
}, isChecked && /*#__PURE__*/React__default["default"].createElement(icons.CheckOutlined, null)));
|
|
1770
|
+
},
|
|
1771
|
+
renderTree: contextProps => {
|
|
1772
|
+
const {
|
|
1773
|
+
props,
|
|
1774
|
+
isSelectedAll,
|
|
1775
|
+
data
|
|
1776
|
+
} = contextProps;
|
|
1777
|
+
const {
|
|
1778
|
+
renderItem,
|
|
1779
|
+
valueKey,
|
|
1780
|
+
labelKey,
|
|
1781
|
+
childrenKey,
|
|
1782
|
+
parentKey
|
|
1783
|
+
} = props;
|
|
1784
|
+
const {
|
|
1785
|
+
treeData,
|
|
1786
|
+
ids
|
|
1787
|
+
} = parseTreeData(data, {
|
|
1788
|
+
valueKey,
|
|
1789
|
+
parentKey,
|
|
1790
|
+
childrenKey
|
|
1791
|
+
});
|
|
1792
|
+
return /*#__PURE__*/React__default["default"].createElement(antd.Tree, {
|
|
1793
|
+
className: classnames__default["default"](style['default-list'], {
|
|
1794
|
+
[style['is-selected-all']]: isSelectedAll
|
|
1795
|
+
}),
|
|
1796
|
+
showIcon: true,
|
|
1797
|
+
selectable: false,
|
|
1798
|
+
expandedKeys: expandedKeys,
|
|
1799
|
+
fieldNames: {
|
|
1800
|
+
title: labelKey,
|
|
1801
|
+
key: valueKey,
|
|
1802
|
+
children: childrenKey
|
|
1803
|
+
},
|
|
1804
|
+
treeData: treeData,
|
|
1805
|
+
onExpand: expandedKeys => {
|
|
1806
|
+
setExpandedKeys(expandedKeys);
|
|
1807
|
+
},
|
|
1808
|
+
titleRender: node => {
|
|
1809
|
+
return renderItem(Object.assign({}, contextProps, {
|
|
1810
|
+
item: node
|
|
1811
|
+
}));
|
|
1812
|
+
}
|
|
1813
|
+
});
|
|
1814
|
+
}
|
|
1815
|
+
}, p);
|
|
1816
|
+
return /*#__PURE__*/React__default["default"].createElement(SelectInput, _extends$1({}, props, {
|
|
1817
|
+
ref: ref
|
|
1818
|
+
}), targetProps => {
|
|
1819
|
+
const {
|
|
1820
|
+
props,
|
|
1821
|
+
value,
|
|
1822
|
+
onOpenChange
|
|
1823
|
+
} = targetProps;
|
|
1824
|
+
const {
|
|
1825
|
+
footer,
|
|
1826
|
+
isPopup,
|
|
1827
|
+
valueKey,
|
|
1828
|
+
single,
|
|
1829
|
+
allowSelectedAll,
|
|
1830
|
+
showSelectedTag,
|
|
1831
|
+
api,
|
|
1832
|
+
options,
|
|
1833
|
+
renderTree,
|
|
1834
|
+
selectedAllValue
|
|
1835
|
+
} = props;
|
|
1836
|
+
const components = {
|
|
1837
|
+
selectedAll: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1838
|
+
className: classnames__default["default"](style['selected-all'], 'select-tree-selected-all', {
|
|
1839
|
+
'is-popup': isPopup
|
|
1840
|
+
})
|
|
1841
|
+
}, !single && allowSelectedAll && /*#__PURE__*/React__default["default"].createElement(SelectedAll, null)),
|
|
1842
|
+
treeList: /*#__PURE__*/React__default["default"].createElement(Fetch, _extends$1({}, Object.assign({}, props, options ? {
|
|
1843
|
+
data: {
|
|
1844
|
+
options
|
|
1845
|
+
},
|
|
1846
|
+
loader: _ref4 => {
|
|
1847
|
+
let {
|
|
1848
|
+
data
|
|
1849
|
+
} = _ref4;
|
|
1850
|
+
return data.options;
|
|
1851
|
+
}
|
|
1852
|
+
} : api), {
|
|
1853
|
+
ref: fetchListRef,
|
|
1854
|
+
render: _ref5 => {
|
|
1855
|
+
let {
|
|
1856
|
+
data
|
|
1857
|
+
} = _ref5,
|
|
1858
|
+
fetchProps = _objectWithoutPropertiesLoose$1(_ref5, _excluded2);
|
|
1859
|
+
const isSelectedAll = computedIsSelectAll(value, selectedAllValue, valueKey);
|
|
1860
|
+
return /*#__PURE__*/React__default["default"].createElement(SimpleBar__default["default"], {
|
|
1861
|
+
className: classnames__default["default"](style['list'], 'select-tree-scroll-list', {
|
|
1862
|
+
'is-popup': isPopup
|
|
1863
|
+
})
|
|
1864
|
+
}, renderTree(Object.assign({}, fetchProps, targetProps, {
|
|
1865
|
+
isSelectedAll,
|
|
1866
|
+
data
|
|
1867
|
+
})));
|
|
1868
|
+
}
|
|
1869
|
+
})),
|
|
1870
|
+
selectedTag: showSelectedTag && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1871
|
+
className: classnames__default["default"](style['selected-tag'], 'select-tree-selected-tag', {
|
|
1872
|
+
'is-popup': isPopup
|
|
1873
|
+
})
|
|
1874
|
+
}, /*#__PURE__*/React__default["default"].createElement(SelectedTagList, null))
|
|
1875
|
+
};
|
|
1876
|
+
if (typeof children === 'function') {
|
|
1877
|
+
return children(Object.assign({}, targetProps, {
|
|
1878
|
+
components
|
|
1879
|
+
}));
|
|
1880
|
+
}
|
|
1881
|
+
return /*#__PURE__*/React__default["default"].createElement(antd.Flex, {
|
|
1882
|
+
vertical: true
|
|
1883
|
+
}, components.search, components.selectedAll, components.treeList, footer && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1884
|
+
className: classnames__default["default"](style['footer'], 'select-tree-footer')
|
|
1885
|
+
}, typeof footer === 'function' ? footer({
|
|
1886
|
+
reload: () => {
|
|
1887
|
+
fetchListRef.current && fetchListRef.current.reload();
|
|
1888
|
+
},
|
|
1889
|
+
close: () => {
|
|
1890
|
+
onOpenChange(false);
|
|
1891
|
+
}
|
|
1892
|
+
}) : footer), components.selectedTag);
|
|
1893
|
+
});
|
|
1894
|
+
});
|
|
1895
|
+
|
|
973
1896
|
exports.SelectInput = SelectInput;
|
|
974
1897
|
exports.SelectTableList = SelectTableList;
|
|
1898
|
+
exports.SelectTree = SelectTree;
|
|
975
1899
|
exports.SelectedAll = SelectedAll;
|
|
976
1900
|
exports.SelectedTagList = SelectedTagList;
|
|
977
1901
|
exports["default"] = SelectList;
|