@kne/super-select 0.1.19 → 0.1.21
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 +302 -40
- package/dist/index.css +109 -6
- package/dist/index.css.map +1 -1
- package/dist/index.js +999 -74
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +988 -75
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React, { forwardRef, useState, useImperativeHandle, useEffect, useRef, Fragment } from 'react';
|
|
1
|
+
import React, { forwardRef, useState, useImperativeHandle, useEffect, useRef, Fragment, useMemo } from 'react';
|
|
2
2
|
import { createContext } from '@kne/global-context';
|
|
3
3
|
import useResize from '@kne/use-resize';
|
|
4
4
|
import useControlValue from '@kne/use-control-value';
|
|
5
5
|
import classnames from 'classnames';
|
|
6
6
|
import isEqual from 'lodash/isEqual';
|
|
7
7
|
import last from 'lodash/last';
|
|
8
|
-
import { Modal, App, Dropdown, Flex, Tag, Checkbox, List, Row, Col, Button, Popover } from 'antd';
|
|
8
|
+
import { Modal, App, Dropdown, Flex, Tag, Checkbox, List, Row, Col, Button, Popover, Tree } from 'antd';
|
|
9
9
|
import { CloseCircleFilled, DownOutlined, CheckOutlined } from '@ant-design/icons';
|
|
10
10
|
import { isNotEmpty } from '@kne/is-empty';
|
|
11
11
|
import { createWithIntlProvider, useIntl } from '@kne/react-intl';
|
|
@@ -15,17 +15,21 @@ import 'simplebar-react/dist/simplebar.min.css';
|
|
|
15
15
|
import SearchInput from '@kne/search-input';
|
|
16
16
|
import { FetchScrollLoader } from '@kne/scroll-loader';
|
|
17
17
|
import '@kne/scroll-loader/dist/index.css';
|
|
18
|
+
import memoize from 'lodash/memoize';
|
|
19
|
+
import omit from 'lodash/omit';
|
|
20
|
+
import pick from 'lodash/pick';
|
|
21
|
+
import merge from 'lodash/merge';
|
|
18
22
|
|
|
19
|
-
function _extends() {
|
|
20
|
-
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
23
|
+
function _extends$1() {
|
|
24
|
+
return _extends$1 = Object.assign ? Object.assign.bind() : function (n) {
|
|
21
25
|
for (var e = 1; e < arguments.length; e++) {
|
|
22
26
|
var t = arguments[e];
|
|
23
27
|
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
24
28
|
}
|
|
25
29
|
return n;
|
|
26
|
-
}, _extends.apply(null, arguments);
|
|
30
|
+
}, _extends$1.apply(null, arguments);
|
|
27
31
|
}
|
|
28
|
-
function _objectWithoutPropertiesLoose(r, e) {
|
|
32
|
+
function _objectWithoutPropertiesLoose$1(r, e) {
|
|
29
33
|
if (null == r) return {};
|
|
30
34
|
var t = {};
|
|
31
35
|
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
@@ -41,7 +45,7 @@ const {
|
|
|
41
45
|
useContext
|
|
42
46
|
} = context;
|
|
43
47
|
|
|
44
|
-
var style$
|
|
48
|
+
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"};
|
|
45
49
|
|
|
46
50
|
const locale$1 = {
|
|
47
51
|
placeholder: '请选择',
|
|
@@ -63,7 +67,7 @@ const locale = {
|
|
|
63
67
|
defaultChildren: 'Dropdown content, to be implemented by the caller'
|
|
64
68
|
};
|
|
65
69
|
|
|
66
|
-
const _excluded$
|
|
70
|
+
const _excluded$5 = ["children"];
|
|
67
71
|
const numberToPx = val => {
|
|
68
72
|
return typeof val === 'number' ? `${val}px` : val;
|
|
69
73
|
};
|
|
@@ -79,7 +83,7 @@ const ModalContent = _ref => {
|
|
|
79
83
|
let {
|
|
80
84
|
children
|
|
81
85
|
} = _ref,
|
|
82
|
-
others = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
86
|
+
others = _objectWithoutPropertiesLoose$1(_ref, _excluded$5);
|
|
83
87
|
const {
|
|
84
88
|
open,
|
|
85
89
|
value: propsValue
|
|
@@ -295,11 +299,11 @@ const SelectInput = createWithIntlProvider({
|
|
|
295
299
|
if (typeof contextProps.props.inputRender === 'function') {
|
|
296
300
|
return contextProps.props.inputRender(props, contextProps);
|
|
297
301
|
}
|
|
298
|
-
return /*#__PURE__*/React.createElement(Flex, _extends({}, props, {
|
|
302
|
+
return /*#__PURE__*/React.createElement(Flex, _extends$1({}, props, {
|
|
299
303
|
ref: inputRef,
|
|
300
|
-
className: classnames(className, style$
|
|
301
|
-
[style$
|
|
302
|
-
[style$
|
|
304
|
+
className: classnames(className, style$5['select-input'], 'select-input', {
|
|
305
|
+
[style$5['wrap']]: labelWrap,
|
|
306
|
+
[style$5['disabled']]: disabled
|
|
303
307
|
}),
|
|
304
308
|
justify: "space-between",
|
|
305
309
|
onMouseOver: () => {
|
|
@@ -311,13 +315,13 @@ const SelectInput = createWithIntlProvider({
|
|
|
311
315
|
}), (() => {
|
|
312
316
|
const current = typeof prefix === 'function' ? prefix(contextProps) : prefix;
|
|
313
317
|
return current && /*#__PURE__*/React.createElement("span", {
|
|
314
|
-
className: classnames(style$
|
|
318
|
+
className: classnames(style$5['select-input-prefix'], 'select-input-prefix'),
|
|
315
319
|
onClick: e => {
|
|
316
320
|
e.stopPropagation();
|
|
317
321
|
}
|
|
318
322
|
}, current);
|
|
319
323
|
})(), /*#__PURE__*/React.createElement("div", {
|
|
320
|
-
className: classnames(style$
|
|
324
|
+
className: classnames(style$5['select-input-inner'], 'select-input-inner')
|
|
321
325
|
}, value.length > 0 ? single || value[0][valueKey] === selectedAllValue[valueKey] ? value[0][labelKey] : value.map(item => {
|
|
322
326
|
return /*#__PURE__*/React.createElement(Tag, {
|
|
323
327
|
key: item[valueKey],
|
|
@@ -329,9 +333,9 @@ const SelectInput = createWithIntlProvider({
|
|
|
329
333
|
}
|
|
330
334
|
}, item[labelKey]);
|
|
331
335
|
}) : /*#__PURE__*/React.createElement("span", {
|
|
332
|
-
className: classnames(style$
|
|
336
|
+
className: classnames(style$5['placeholder'], 'select-input-placeholder')
|
|
333
337
|
}, placeholder)), /*#__PURE__*/React.createElement("div", {
|
|
334
|
-
className: classnames(style$
|
|
338
|
+
className: classnames(style$5['select-input-icon'], 'select-input-icon')
|
|
335
339
|
}, !disabled && allowClear && hover && value.length > 0 ? /*#__PURE__*/React.createElement(CloseCircleFilled, {
|
|
336
340
|
onClick: e => {
|
|
337
341
|
e.stopPropagation();
|
|
@@ -340,7 +344,7 @@ const SelectInput = createWithIntlProvider({
|
|
|
340
344
|
}) : /*#__PURE__*/React.createElement(DownOutlined, null)), (() => {
|
|
341
345
|
const current = typeof suffix === 'function' ? suffix(contextProps) : suffix;
|
|
342
346
|
return current && /*#__PURE__*/React.createElement("span", {
|
|
343
|
-
className: classnames(style$
|
|
347
|
+
className: classnames(style$5['select-input-suffix'], 'select-input-suffix'),
|
|
344
348
|
onClick: e => {
|
|
345
349
|
e.stopPropagation();
|
|
346
350
|
}
|
|
@@ -357,13 +361,13 @@ const SelectInput = createWithIntlProvider({
|
|
|
357
361
|
onOpenChange: setOpen,
|
|
358
362
|
placement: placement,
|
|
359
363
|
arrow: false,
|
|
360
|
-
overlayClassName: classnames(style$
|
|
364
|
+
overlayClassName: classnames(style$5['overlay'], overlayClassName),
|
|
361
365
|
trigger: "click",
|
|
362
366
|
popupRender: () => /*#__PURE__*/React.createElement("div", {
|
|
363
367
|
style: {
|
|
364
368
|
'--overlay-width': popupOverlayWidth
|
|
365
369
|
},
|
|
366
|
-
className: classnames(style$
|
|
370
|
+
className: classnames(style$5['overlay-content'], 'over-content'),
|
|
367
371
|
onClick: e => {
|
|
368
372
|
e.stopPropagation();
|
|
369
373
|
}
|
|
@@ -375,7 +379,7 @@ const SelectInput = createWithIntlProvider({
|
|
|
375
379
|
}), /*#__PURE__*/React.createElement(ModalContent, contextProps, renderModal)));
|
|
376
380
|
}));
|
|
377
381
|
|
|
378
|
-
var style$
|
|
382
|
+
var style$4 = {"selected-all":"_prlgN"};
|
|
379
383
|
|
|
380
384
|
const SelectedAll = createWithIntlProvider('zh-CN', locale$1, 'super-select')(() => {
|
|
381
385
|
const {
|
|
@@ -400,7 +404,7 @@ const SelectedAll = createWithIntlProvider('zh-CN', locale$1, 'super-select')(()
|
|
|
400
404
|
const isSelectedAll = computedIsSelectAll(value, selectedAllValue, valueKey);
|
|
401
405
|
return /*#__PURE__*/React.createElement(Flex, {
|
|
402
406
|
justify: "space-between",
|
|
403
|
-
className: classnames(style$
|
|
407
|
+
className: classnames(style$4['selected-all'], 'selected-all')
|
|
404
408
|
}, /*#__PURE__*/React.createElement(Flex, {
|
|
405
409
|
gap: 8
|
|
406
410
|
}, /*#__PURE__*/React.createElement("span", null, formatMessage({
|
|
@@ -423,7 +427,7 @@ const computedIsSelectAll = (value, selectedAllValue, valueKey = 'value') => {
|
|
|
423
427
|
return (value == null ? void 0 : value.length) === 1 && get(value, `[0][${valueKey}]`) === selectedAllValue[valueKey];
|
|
424
428
|
};
|
|
425
429
|
|
|
426
|
-
var style$
|
|
430
|
+
var style$3 = {"label":"_l3KoW","tag-list":"_CCPzb","tag-container":"_dKZHi","tag-container-inner":"_oijCI","tag":"_WmnnS","tag-inner":"_TMcFl"};
|
|
427
431
|
|
|
428
432
|
const SelectedTagList = createWithIntlProvider('zh-CN', locale$1, 'super-select')(() => {
|
|
429
433
|
const {
|
|
@@ -441,21 +445,21 @@ const SelectedTagList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
|
|
|
441
445
|
valueKey
|
|
442
446
|
} = Object.assign({}, props);
|
|
443
447
|
return /*#__PURE__*/React.createElement(Flex, {
|
|
444
|
-
className: classnames(style$
|
|
448
|
+
className: classnames(style$3['tag-list'], 'selected-tag-list'),
|
|
445
449
|
gap: 8
|
|
446
450
|
}, /*#__PURE__*/React.createElement("div", {
|
|
447
|
-
className: style$
|
|
451
|
+
className: style$3['label']
|
|
448
452
|
}, formatMessage({
|
|
449
453
|
id: 'selected'
|
|
450
454
|
}), !single && value.length > 0 && `(${value.length}${Number.isInteger(maxLength) ? `/${maxLength}` : ''})`, ":"), /*#__PURE__*/React.createElement(SimpleBar, {
|
|
451
|
-
className: style$
|
|
455
|
+
className: style$3['tag-container']
|
|
452
456
|
}, /*#__PURE__*/React.createElement(Flex, {
|
|
453
457
|
gap: 8,
|
|
454
458
|
wrap: true,
|
|
455
|
-
className: style$
|
|
459
|
+
className: style$3['tag-container-inner']
|
|
456
460
|
}, value.map(item => {
|
|
457
461
|
return /*#__PURE__*/React.createElement(Tag, {
|
|
458
|
-
className: style$
|
|
462
|
+
className: style$3['tag'],
|
|
459
463
|
key: item[valueKey],
|
|
460
464
|
closable: true,
|
|
461
465
|
bordered: false,
|
|
@@ -464,19 +468,20 @@ const SelectedTagList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
|
|
|
464
468
|
onRemove(item);
|
|
465
469
|
}
|
|
466
470
|
}, /*#__PURE__*/React.createElement("span", {
|
|
467
|
-
className: style$
|
|
471
|
+
className: style$3['tag-inner']
|
|
468
472
|
}, item[labelKey]));
|
|
469
473
|
}))));
|
|
470
474
|
});
|
|
471
475
|
|
|
472
|
-
var style$
|
|
476
|
+
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"};
|
|
473
477
|
|
|
474
|
-
const _excluded = ["children"];
|
|
478
|
+
const _excluded$4 = ["children"];
|
|
475
479
|
const SelectList = forwardRef((_ref, ref) => {
|
|
476
480
|
let {
|
|
477
481
|
children
|
|
478
482
|
} = _ref,
|
|
479
|
-
p = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
483
|
+
p = _objectWithoutPropertiesLoose$1(_ref, _excluded$4);
|
|
484
|
+
const fetchListRef = useRef(null);
|
|
480
485
|
const props = Object.assign({}, {
|
|
481
486
|
renderItemContent: ({
|
|
482
487
|
item,
|
|
@@ -488,7 +493,7 @@ const SelectList = forwardRef((_ref, ref) => {
|
|
|
488
493
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
489
494
|
className: 'select-list-item-label'
|
|
490
495
|
}, item[labelKey]), item.description && /*#__PURE__*/React.createElement("div", {
|
|
491
|
-
className: classnames(style$
|
|
496
|
+
className: classnames(style$2['select-list-item-description'], 'select-list-item-description')
|
|
492
497
|
}, item.description));
|
|
493
498
|
},
|
|
494
499
|
renderItem: contextProps => {
|
|
@@ -509,9 +514,9 @@ const SelectList = forwardRef((_ref, ref) => {
|
|
|
509
514
|
} = props;
|
|
510
515
|
const isChecked = value.some(target => target[valueKey] === item[valueKey]);
|
|
511
516
|
return /*#__PURE__*/React.createElement(List.Item, {
|
|
512
|
-
className: classnames(style$
|
|
513
|
-
[style$
|
|
514
|
-
[style$
|
|
517
|
+
className: classnames(style$2['default-list-item'], 'select-list-item', {
|
|
518
|
+
[style$2['is-selected']]: isChecked,
|
|
519
|
+
[style$2['is-disabled']]: item.disabled
|
|
515
520
|
}),
|
|
516
521
|
key: item[valueKey],
|
|
517
522
|
onClick: () => {
|
|
@@ -539,7 +544,7 @@ const SelectList = forwardRef((_ref, ref) => {
|
|
|
539
544
|
flex: 1,
|
|
540
545
|
className: 'select-list-item-content'
|
|
541
546
|
}, renderItemContent(contextProps)), single && /*#__PURE__*/React.createElement("div", {
|
|
542
|
-
className: style$
|
|
547
|
+
className: style$2['single-checked']
|
|
543
548
|
}, isChecked && /*#__PURE__*/React.createElement(CheckOutlined, null)));
|
|
544
549
|
},
|
|
545
550
|
renderList: contextProps => {
|
|
@@ -552,8 +557,8 @@ const SelectList = forwardRef((_ref, ref) => {
|
|
|
552
557
|
renderItem
|
|
553
558
|
} = props;
|
|
554
559
|
return /*#__PURE__*/React.createElement(List, {
|
|
555
|
-
className: classnames(style$
|
|
556
|
-
[style$
|
|
560
|
+
className: classnames(style$2['default-list'], {
|
|
561
|
+
[style$2['is-selected-all']]: isSelectedAll
|
|
557
562
|
}),
|
|
558
563
|
size: "small",
|
|
559
564
|
dataSource: list,
|
|
@@ -563,16 +568,18 @@ const SelectList = forwardRef((_ref, ref) => {
|
|
|
563
568
|
});
|
|
564
569
|
}
|
|
565
570
|
}, p);
|
|
566
|
-
return /*#__PURE__*/React.createElement(SelectInput, _extends({}, props, {
|
|
571
|
+
return /*#__PURE__*/React.createElement(SelectInput, _extends$1({}, props, {
|
|
567
572
|
ref: ref
|
|
568
573
|
}), targetProps => {
|
|
569
574
|
const {
|
|
570
575
|
props,
|
|
571
576
|
value,
|
|
572
577
|
searchProps,
|
|
573
|
-
setSearchProps
|
|
578
|
+
setSearchProps,
|
|
579
|
+
onOpenChange
|
|
574
580
|
} = targetProps;
|
|
575
581
|
const {
|
|
582
|
+
footer,
|
|
576
583
|
isPopup,
|
|
577
584
|
getSearchProps,
|
|
578
585
|
getSearchCallback,
|
|
@@ -588,7 +595,7 @@ const SelectList = forwardRef((_ref, ref) => {
|
|
|
588
595
|
} = props;
|
|
589
596
|
const components = {
|
|
590
597
|
search: (api && typeof getSearchProps === 'function' || options && typeof getSearchCallback === 'function') && /*#__PURE__*/React.createElement(SearchInput, {
|
|
591
|
-
className: classnames(style$
|
|
598
|
+
className: classnames(style$2['select-search'], 'select-list-search', {
|
|
592
599
|
'is-popup': isPopup
|
|
593
600
|
}),
|
|
594
601
|
placeholder: searchPlaceholder,
|
|
@@ -602,12 +609,12 @@ const SelectList = forwardRef((_ref, ref) => {
|
|
|
602
609
|
showSearchButton: !isPopup
|
|
603
610
|
}),
|
|
604
611
|
selectedAll: /*#__PURE__*/React.createElement("div", {
|
|
605
|
-
className: classnames(style$
|
|
612
|
+
className: classnames(style$2['selected-all'], 'select-list-selected-all', {
|
|
606
613
|
'is-popup': isPopup
|
|
607
614
|
})
|
|
608
615
|
}, !single && allowSelectedAll && /*#__PURE__*/React.createElement(SelectedAll, null)),
|
|
609
|
-
fetchList: /*#__PURE__*/React.createElement(FetchScrollLoader, _extends({}, props, {
|
|
610
|
-
className: classnames(style$
|
|
616
|
+
fetchList: /*#__PURE__*/React.createElement(FetchScrollLoader, _extends$1({}, props, {
|
|
617
|
+
className: classnames(style$2['list'], 'select-list-scroll-list', {
|
|
611
618
|
'is-popup': isPopup
|
|
612
619
|
}),
|
|
613
620
|
searchProps: searchProps,
|
|
@@ -634,7 +641,8 @@ const SelectList = forwardRef((_ref, ref) => {
|
|
|
634
641
|
pageData: options
|
|
635
642
|
};
|
|
636
643
|
}
|
|
637
|
-
} : api)
|
|
644
|
+
} : api),
|
|
645
|
+
ref: fetchListRef
|
|
638
646
|
}), fetchProps => {
|
|
639
647
|
const isSelectedAll = computedIsSelectAll(value, selectedAllValue, valueKey);
|
|
640
648
|
return renderList(Object.assign({}, fetchProps, targetProps, {
|
|
@@ -642,7 +650,7 @@ const SelectList = forwardRef((_ref, ref) => {
|
|
|
642
650
|
}));
|
|
643
651
|
}),
|
|
644
652
|
selectedTag: showSelectedTag && /*#__PURE__*/React.createElement("div", {
|
|
645
|
-
className: classnames(style$
|
|
653
|
+
className: classnames(style$2['selected-tag'], 'select-list-selected-tag', {
|
|
646
654
|
'is-popup': isPopup
|
|
647
655
|
})
|
|
648
656
|
}, /*#__PURE__*/React.createElement(SelectedTagList, null))
|
|
@@ -654,17 +662,27 @@ const SelectList = forwardRef((_ref, ref) => {
|
|
|
654
662
|
}
|
|
655
663
|
return /*#__PURE__*/React.createElement(Flex, {
|
|
656
664
|
vertical: true
|
|
657
|
-
}, components.search, components.selectedAll, components.fetchList,
|
|
665
|
+
}, components.search, components.selectedAll, components.fetchList, footer && /*#__PURE__*/React.createElement("div", {
|
|
666
|
+
className: classnames(style$2['footer'], 'select-list-footer')
|
|
667
|
+
}, typeof footer === 'function' ? footer({
|
|
668
|
+
reload: () => {
|
|
669
|
+
fetchListRef.current && fetchListRef.current.reload();
|
|
670
|
+
},
|
|
671
|
+
close: () => {
|
|
672
|
+
onOpenChange(false);
|
|
673
|
+
}
|
|
674
|
+
}) : footer), components.selectedTag);
|
|
658
675
|
});
|
|
659
676
|
});
|
|
660
677
|
|
|
661
|
-
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"};
|
|
678
|
+
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"};
|
|
662
679
|
|
|
663
680
|
const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select')(forwardRef((p, ref) => {
|
|
664
681
|
const {
|
|
665
682
|
formatMessage
|
|
666
683
|
} = useIntl();
|
|
667
684
|
const [tagSearchText, setTagSearchText] = useState('');
|
|
685
|
+
const fetchListRef = useRef();
|
|
668
686
|
const props = Object.assign({}, {
|
|
669
687
|
overlayWidth: '600px',
|
|
670
688
|
filterRender: contextProps => {
|
|
@@ -686,7 +704,7 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
|
|
|
686
704
|
return null;
|
|
687
705
|
}
|
|
688
706
|
return /*#__PURE__*/React.createElement(SearchInput, {
|
|
689
|
-
className: classnames(style['select-search'], 'select-list-search', {
|
|
707
|
+
className: classnames(style$1['select-search'], 'select-list-search', {
|
|
690
708
|
'is-popup': isPopup
|
|
691
709
|
}),
|
|
692
710
|
placeholder: searchPlaceholder,
|
|
@@ -714,7 +732,7 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
|
|
|
714
732
|
}
|
|
715
733
|
}, p);
|
|
716
734
|
const bodyRef = useRef(null);
|
|
717
|
-
return /*#__PURE__*/React.createElement(SelectInput, _extends({}, props, {
|
|
735
|
+
return /*#__PURE__*/React.createElement(SelectInput, _extends$1({}, props, {
|
|
718
736
|
ref: ref
|
|
719
737
|
}), targetProps => {
|
|
720
738
|
const {
|
|
@@ -726,6 +744,7 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
|
|
|
726
744
|
onOpenChange
|
|
727
745
|
} = targetProps;
|
|
728
746
|
const {
|
|
747
|
+
footer,
|
|
729
748
|
filterRender,
|
|
730
749
|
columns,
|
|
731
750
|
options,
|
|
@@ -744,6 +763,16 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
|
|
|
744
763
|
searchProps
|
|
745
764
|
} = props;
|
|
746
765
|
const isSelectedAll = computedIsSelectAll(value, selectedAllValue, valueKey);
|
|
766
|
+
const footerEl = footer && /*#__PURE__*/React.createElement("div", {
|
|
767
|
+
className: classnames(style$1['footer'], 'select-table-footer')
|
|
768
|
+
}, typeof footer === 'function' ? footer({
|
|
769
|
+
reload: () => {
|
|
770
|
+
fetchListRef.current && fetchListRef.current.reload();
|
|
771
|
+
},
|
|
772
|
+
close: () => {
|
|
773
|
+
onOpenChange(false);
|
|
774
|
+
}
|
|
775
|
+
}) : footer);
|
|
747
776
|
return /*#__PURE__*/React.createElement(Row, {
|
|
748
777
|
wrap: false,
|
|
749
778
|
ref: bodyRef
|
|
@@ -751,9 +780,9 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
|
|
|
751
780
|
span: single ? 24 : 16
|
|
752
781
|
}, /*#__PURE__*/React.createElement("div", null, filterRender(Object.assign({}, targetProps))), /*#__PURE__*/React.createElement(Row, {
|
|
753
782
|
wrap: false,
|
|
754
|
-
className: classnames(style['header'], 'select-table-list-header')
|
|
783
|
+
className: classnames(style$1['header'], 'select-table-list-header')
|
|
755
784
|
}, !single && /*#__PURE__*/React.createElement(Col, {
|
|
756
|
-
className: classnames(style['col'], 'select-table-list-col')
|
|
785
|
+
className: classnames(style$1['col'], 'select-table-list-col')
|
|
757
786
|
}, allowSelectedAll ? /*#__PURE__*/React.createElement(Checkbox, {
|
|
758
787
|
checked: isSelectedAll,
|
|
759
788
|
onChange: e => {
|
|
@@ -781,10 +810,10 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
|
|
|
781
810
|
return /*#__PURE__*/React.createElement(Col, {
|
|
782
811
|
key: name,
|
|
783
812
|
span: span,
|
|
784
|
-
className: classnames(style['col'], 'select-table-list-col')
|
|
813
|
+
className: classnames(style$1['col'], 'select-table-list-col')
|
|
785
814
|
}, title);
|
|
786
|
-
})))), /*#__PURE__*/React.createElement(FetchScrollLoader, _extends({}, props, {
|
|
787
|
-
className: classnames(style['list'], 'select-table-list-scroll-list', {
|
|
815
|
+
})))), /*#__PURE__*/React.createElement(FetchScrollLoader, _extends$1({}, props, {
|
|
816
|
+
className: classnames(style$1['list'], 'select-table-list-scroll-list', {
|
|
788
817
|
'is-popup': isPopup
|
|
789
818
|
}),
|
|
790
819
|
searchProps: searchProps,
|
|
@@ -811,7 +840,8 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
|
|
|
811
840
|
pageData: options
|
|
812
841
|
};
|
|
813
842
|
}
|
|
814
|
-
} : api)
|
|
843
|
+
} : api),
|
|
844
|
+
ref: fetchListRef
|
|
815
845
|
}), fetchProps => {
|
|
816
846
|
const {
|
|
817
847
|
list
|
|
@@ -824,10 +854,10 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
|
|
|
824
854
|
return /*#__PURE__*/React.createElement(Row, {
|
|
825
855
|
wrap: false,
|
|
826
856
|
key: item[valueKey],
|
|
827
|
-
className: classnames(style['body'], 'select-table-list-body', [{
|
|
828
|
-
[style['is-selected-all']]: isSelectedAll,
|
|
829
|
-
[style['is-selected']]: isChecked,
|
|
830
|
-
[style['is-disabled']]: item.disabled
|
|
857
|
+
className: classnames(style$1['body'], 'select-table-list-body', [{
|
|
858
|
+
[style$1['is-selected-all']]: isSelectedAll,
|
|
859
|
+
[style$1['is-selected']]: isChecked,
|
|
860
|
+
[style$1['is-disabled']]: item.disabled
|
|
831
861
|
}]),
|
|
832
862
|
onClick: () => {
|
|
833
863
|
if (item.disabled) {
|
|
@@ -846,7 +876,7 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
|
|
|
846
876
|
}
|
|
847
877
|
}
|
|
848
878
|
}, !single && /*#__PURE__*/React.createElement(Col, {
|
|
849
|
-
className: classnames(style['col'], 'select-table-list-col')
|
|
879
|
+
className: classnames(style$1['col'], 'select-table-list-col')
|
|
850
880
|
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
851
881
|
disabled: item.disabled || isSelectedAll,
|
|
852
882
|
checked: isSelectedAll || isChecked
|
|
@@ -863,19 +893,19 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
|
|
|
863
893
|
return /*#__PURE__*/React.createElement(Col, {
|
|
864
894
|
key: name,
|
|
865
895
|
span: span,
|
|
866
|
-
className: classnames(style['col'], 'select-table-list-col')
|
|
896
|
+
className: classnames(style$1['col'], 'select-table-list-col')
|
|
867
897
|
}, typeof getValueOf === 'function' ? getValueOf(item, contextProps) : get(item, name));
|
|
868
898
|
}))), single && /*#__PURE__*/React.createElement(Col, {
|
|
869
|
-
className: classnames(style['col'], style['single-checked'], 'select-table-list-col')
|
|
899
|
+
className: classnames(style$1['col'], style$1['single-checked'], 'select-table-list-col')
|
|
870
900
|
}, isChecked && /*#__PURE__*/React.createElement(CheckOutlined, null)));
|
|
871
901
|
});
|
|
872
|
-
})), !single && /*#__PURE__*/React.createElement(Col, {
|
|
873
|
-
className: classnames(style['right-options'], {
|
|
902
|
+
}), single && footerEl), !single && /*#__PURE__*/React.createElement(Col, {
|
|
903
|
+
className: classnames(style$1['right-options'], {
|
|
874
904
|
'is-popup': isPopup
|
|
875
905
|
}),
|
|
876
906
|
span: 8
|
|
877
907
|
}, /*#__PURE__*/React.createElement(SearchInput, {
|
|
878
|
-
className: style['tags-search'],
|
|
908
|
+
className: style$1['tags-search'],
|
|
879
909
|
placeholder: searchPlaceholder,
|
|
880
910
|
value: tagSearchText,
|
|
881
911
|
onSearch: value => {
|
|
@@ -889,7 +919,7 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
|
|
|
889
919
|
}, /*#__PURE__*/React.createElement(Col, null, formatMessage({
|
|
890
920
|
id: 'selected'
|
|
891
921
|
}), value.length > 0 && `(${value.length}${Number.isInteger(maxLength) ? `/${maxLength}` : ''})`, ":"), /*#__PURE__*/React.createElement(Col, null, /*#__PURE__*/React.createElement(Button, {
|
|
892
|
-
className: style['no-padding-btn'],
|
|
922
|
+
className: style$1['no-padding-btn'],
|
|
893
923
|
type: "link",
|
|
894
924
|
onClick: () => {
|
|
895
925
|
setValue([]);
|
|
@@ -899,7 +929,7 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
|
|
|
899
929
|
gap: 8
|
|
900
930
|
}, value.filter(item => getTagSearchCallback(tagSearchText, item, targetProps)).map(item => {
|
|
901
931
|
return /*#__PURE__*/React.createElement(Tag, {
|
|
902
|
-
className: style['tag'],
|
|
932
|
+
className: style$1['tag'],
|
|
903
933
|
key: item[valueKey],
|
|
904
934
|
closable: true,
|
|
905
935
|
bordered: false,
|
|
@@ -910,7 +940,7 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
|
|
|
910
940
|
}, /*#__PURE__*/React.createElement(Popover, {
|
|
911
941
|
getPopupContainer: () => bodyRef.current,
|
|
912
942
|
content: /*#__PURE__*/React.createElement(Row, {
|
|
913
|
-
className: style['descriptions']
|
|
943
|
+
className: style$1['descriptions']
|
|
914
944
|
}, columns.map(({
|
|
915
945
|
name,
|
|
916
946
|
title,
|
|
@@ -920,18 +950,901 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
|
|
|
920
950
|
key: name
|
|
921
951
|
}, /*#__PURE__*/React.createElement(Col, {
|
|
922
952
|
span: 8,
|
|
923
|
-
className: style['descriptions-col-label']
|
|
953
|
+
className: style$1['descriptions-col-label']
|
|
924
954
|
}, title), /*#__PURE__*/React.createElement(Col, {
|
|
925
|
-
className: style['descriptions-col-content'],
|
|
955
|
+
className: style$1['descriptions-col-content'],
|
|
926
956
|
span: 16
|
|
927
957
|
}, typeof getValueOf === 'function' ? getValueOf(item, targetProps) : get(item, name)));
|
|
928
958
|
}))
|
|
929
959
|
}, /*#__PURE__*/React.createElement("span", {
|
|
930
|
-
className: style['tag-inner']
|
|
960
|
+
className: style$1['tag-inner']
|
|
931
961
|
}, item[labelKey])));
|
|
932
|
-
})))));
|
|
962
|
+
}))), footerEl));
|
|
933
963
|
});
|
|
934
964
|
}));
|
|
935
965
|
|
|
936
|
-
|
|
966
|
+
function createCommonjsModule(fn) {
|
|
967
|
+
var module = { exports: {} };
|
|
968
|
+
return fn(module, module.exports), module.exports;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
function commonjsRequire (target) {
|
|
972
|
+
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.');
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
var object_hash = createCommonjsModule(function (module, exports) {
|
|
976
|
+
!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)});
|
|
977
|
+
});
|
|
978
|
+
|
|
979
|
+
function _extends() {
|
|
980
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
981
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
982
|
+
var t = arguments[e];
|
|
983
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
984
|
+
}
|
|
985
|
+
return n;
|
|
986
|
+
}, _extends.apply(null, arguments);
|
|
987
|
+
}
|
|
988
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
989
|
+
if (null == r) return {};
|
|
990
|
+
var t = {};
|
|
991
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
992
|
+
if (e.includes(n)) continue;
|
|
993
|
+
t[n] = r[n];
|
|
994
|
+
}
|
|
995
|
+
return t;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
var start = {
|
|
999
|
+
id: 'start',
|
|
1000
|
+
plugin: ({
|
|
1001
|
+
type
|
|
1002
|
+
}, context) => {
|
|
1003
|
+
const {
|
|
1004
|
+
onRequestStart
|
|
1005
|
+
} = context.componentContext.getProps();
|
|
1006
|
+
const {
|
|
1007
|
+
setIsLoading,
|
|
1008
|
+
setIsComplete
|
|
1009
|
+
} = context.componentContext;
|
|
1010
|
+
onRequestStart && onRequestStart();
|
|
1011
|
+
if (type === 'refresh') {
|
|
1012
|
+
setIsLoading(true);
|
|
1013
|
+
}
|
|
1014
|
+
setIsComplete(false);
|
|
1015
|
+
}
|
|
1016
|
+
};
|
|
1017
|
+
|
|
1018
|
+
var loader = {
|
|
1019
|
+
id: 'loader',
|
|
1020
|
+
plugin: async (props, context) => {
|
|
1021
|
+
const {
|
|
1022
|
+
loader
|
|
1023
|
+
} = context.componentContext.getProps();
|
|
1024
|
+
if (typeof loader !== 'function') {
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
if (context.outputStack['cache']) {
|
|
1028
|
+
return context.outputStack['cache'];
|
|
1029
|
+
}
|
|
1030
|
+
const data = await loader(context.outputStack['params']);
|
|
1031
|
+
return {
|
|
1032
|
+
data: {
|
|
1033
|
+
code: 200,
|
|
1034
|
+
results: data
|
|
1035
|
+
}
|
|
1036
|
+
};
|
|
1037
|
+
},
|
|
1038
|
+
dependencies: ['params']
|
|
1039
|
+
};
|
|
1040
|
+
|
|
1041
|
+
const _excluded$3 = ["options", "urlParams"];
|
|
1042
|
+
var params = {
|
|
1043
|
+
id: 'params',
|
|
1044
|
+
plugin: ({
|
|
1045
|
+
options,
|
|
1046
|
+
url,
|
|
1047
|
+
method,
|
|
1048
|
+
params,
|
|
1049
|
+
data
|
|
1050
|
+
}, context) => {
|
|
1051
|
+
const _context$componentCon = context.componentContext.getProps(),
|
|
1052
|
+
{
|
|
1053
|
+
options: componentOptions,
|
|
1054
|
+
urlParams
|
|
1055
|
+
} = _context$componentCon,
|
|
1056
|
+
componentProps = _objectWithoutPropertiesLoose(_context$componentCon, _excluded$3);
|
|
1057
|
+
const targetParams = merge({}, componentOptions, pick(componentProps, ['url', 'method', 'params', 'data']), options, {
|
|
1058
|
+
url,
|
|
1059
|
+
method,
|
|
1060
|
+
params,
|
|
1061
|
+
data,
|
|
1062
|
+
urlParams
|
|
1063
|
+
});
|
|
1064
|
+
const output = Object.assign({}, targetParams);
|
|
1065
|
+
if (typeof urlParams === 'object' && Object.keys(urlParams).length > 0 && typeof output.url === 'string') {
|
|
1066
|
+
output.url = output.url.replace(/{([\s\S]+?)}/g, (match, name) => {
|
|
1067
|
+
return urlParams.hasOwnProperty(name) ? urlParams[name] : match;
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
context.componentContext.setRequestParams(targetParams);
|
|
1071
|
+
return output;
|
|
1072
|
+
}
|
|
1073
|
+
};
|
|
1074
|
+
|
|
1075
|
+
const _excluded$2 = ["isLocal"];
|
|
1076
|
+
class Cache {
|
|
1077
|
+
static now() {
|
|
1078
|
+
return new Date().getTime();
|
|
1079
|
+
}
|
|
1080
|
+
constructor(options) {
|
|
1081
|
+
const {
|
|
1082
|
+
ttl,
|
|
1083
|
+
maxLength,
|
|
1084
|
+
isLocal,
|
|
1085
|
+
localName
|
|
1086
|
+
} = Object.assign({}, options);
|
|
1087
|
+
this.ttl = ttl || 0;
|
|
1088
|
+
this.data = {};
|
|
1089
|
+
this.cacheNameMapping = {};
|
|
1090
|
+
this.maxLength = maxLength || 1000;
|
|
1091
|
+
this.isLocal = localName ? true : isLocal;
|
|
1092
|
+
this.localName = localName;
|
|
1093
|
+
this._load();
|
|
1094
|
+
}
|
|
1095
|
+
_load() {
|
|
1096
|
+
if (!this.isLocal) {
|
|
1097
|
+
return;
|
|
1098
|
+
}
|
|
1099
|
+
try {
|
|
1100
|
+
const dataString = window.localStorage && window.localStorage.getItem(this.localName || Cache.KEY_NAME);
|
|
1101
|
+
if (!dataString) {
|
|
1102
|
+
return;
|
|
1103
|
+
}
|
|
1104
|
+
const dataObj = JSON.parse(dataString);
|
|
1105
|
+
Object.keys(dataObj).forEach(key => {
|
|
1106
|
+
dataObj[key].isLocal = true;
|
|
1107
|
+
});
|
|
1108
|
+
this.data = dataObj;
|
|
1109
|
+
} catch (e) {}
|
|
1110
|
+
}
|
|
1111
|
+
_save() {
|
|
1112
|
+
if (!this.isLocal) {
|
|
1113
|
+
return;
|
|
1114
|
+
}
|
|
1115
|
+
const keys = Object.keys(this.data);
|
|
1116
|
+
Promise.all(keys.map(key => this.data[key].value)).then(data => {
|
|
1117
|
+
const output = {};
|
|
1118
|
+
Object.keys(this.data).forEach((key, index) => {
|
|
1119
|
+
const _this$data$key = this.data[key],
|
|
1120
|
+
{
|
|
1121
|
+
isLocal
|
|
1122
|
+
} = _this$data$key,
|
|
1123
|
+
props = _objectWithoutPropertiesLoose(_this$data$key, _excluded$2);
|
|
1124
|
+
if (isLocal === true) {
|
|
1125
|
+
output[key] = Object.assign({}, props, {
|
|
1126
|
+
value: data[index]
|
|
1127
|
+
});
|
|
1128
|
+
}
|
|
1129
|
+
});
|
|
1130
|
+
window.localStorage && window.localStorage.setItem(this.localName || Cache.KEY_NAME, JSON.stringify(output));
|
|
1131
|
+
});
|
|
1132
|
+
}
|
|
1133
|
+
get(key) {
|
|
1134
|
+
const obj = this.data[key];
|
|
1135
|
+
let val = null;
|
|
1136
|
+
if (obj) {
|
|
1137
|
+
val = obj.value;
|
|
1138
|
+
if (obj.expires && Cache.now() >= obj.expires) {
|
|
1139
|
+
val = null;
|
|
1140
|
+
delete this.data[key];
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
this._save();
|
|
1144
|
+
return val;
|
|
1145
|
+
}
|
|
1146
|
+
delByCacheName(cacheName) {
|
|
1147
|
+
if (this.cacheNameMapping[cacheName]) {
|
|
1148
|
+
this.cacheNameMapping[cacheName].forEach(key => {
|
|
1149
|
+
this.del(key);
|
|
1150
|
+
});
|
|
1151
|
+
this.cacheNameMapping[cacheName].clear();
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
del(key) {
|
|
1155
|
+
const oldValue = this.get(key);
|
|
1156
|
+
delete this.data[key];
|
|
1157
|
+
this._save();
|
|
1158
|
+
return oldValue;
|
|
1159
|
+
}
|
|
1160
|
+
put(key, val, options) {
|
|
1161
|
+
let {
|
|
1162
|
+
ttl,
|
|
1163
|
+
isLocal,
|
|
1164
|
+
cacheName
|
|
1165
|
+
} = options;
|
|
1166
|
+
if (ttl === undefined) {
|
|
1167
|
+
ttl = this.ttl;
|
|
1168
|
+
}
|
|
1169
|
+
let oldValue = this.del(key);
|
|
1170
|
+
if (val !== null) {
|
|
1171
|
+
const keys = Object.keys(this.data);
|
|
1172
|
+
if (keys.length >= this.maxLength) {
|
|
1173
|
+
const delKey = keys.sort((a, b) => {
|
|
1174
|
+
return this.data[a].createTime - this.data[b].createTime;
|
|
1175
|
+
})[0];
|
|
1176
|
+
delete this.data[delKey];
|
|
1177
|
+
}
|
|
1178
|
+
const now = Cache.now();
|
|
1179
|
+
this.data[key] = {
|
|
1180
|
+
expires: ttl === 0 ? null : now + ttl,
|
|
1181
|
+
value: val,
|
|
1182
|
+
createTime: now,
|
|
1183
|
+
isLocal
|
|
1184
|
+
};
|
|
1185
|
+
if (cacheName && !this.cacheNameMapping[cacheName]) {
|
|
1186
|
+
this.cacheNameMapping[cacheName] = new Set();
|
|
1187
|
+
}
|
|
1188
|
+
if (cacheName) {
|
|
1189
|
+
this.cacheNameMapping[cacheName].add(key);
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
this._save();
|
|
1193
|
+
return oldValue;
|
|
1194
|
+
}
|
|
1195
|
+
clean() {
|
|
1196
|
+
this.data = {};
|
|
1197
|
+
this._save();
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
Cache.KEY_NAME = 'REACT_FETCH_CACHE';
|
|
1201
|
+
|
|
1202
|
+
const globalParams = {
|
|
1203
|
+
cache: new Cache({
|
|
1204
|
+
ttl: 1000 * 60 * 10,
|
|
1205
|
+
maxLength: 1000,
|
|
1206
|
+
isLocal: true
|
|
1207
|
+
}),
|
|
1208
|
+
ajax: () => {
|
|
1209
|
+
throw new Error('默认的axios配置已经移除,请首先在preset里面配置');
|
|
1210
|
+
},
|
|
1211
|
+
loading: null,
|
|
1212
|
+
error: null,
|
|
1213
|
+
empty: null,
|
|
1214
|
+
pagination: {
|
|
1215
|
+
initCurrent: 1,
|
|
1216
|
+
pageSize: 10,
|
|
1217
|
+
transform: params => params
|
|
1218
|
+
},
|
|
1219
|
+
transformResponse: response => {
|
|
1220
|
+
const {
|
|
1221
|
+
data
|
|
1222
|
+
} = response;
|
|
1223
|
+
response.data = {
|
|
1224
|
+
code: data.code,
|
|
1225
|
+
msg: data.msg,
|
|
1226
|
+
results: data.results
|
|
1227
|
+
};
|
|
1228
|
+
return response;
|
|
1229
|
+
}
|
|
1230
|
+
};
|
|
1231
|
+
|
|
1232
|
+
var cache = {
|
|
1233
|
+
id: 'cache',
|
|
1234
|
+
plugin: ({
|
|
1235
|
+
force
|
|
1236
|
+
}, context) => {
|
|
1237
|
+
const {
|
|
1238
|
+
cache
|
|
1239
|
+
} = context.componentContext.getProps();
|
|
1240
|
+
const token = context.componentContext.getRequestToken();
|
|
1241
|
+
if (force === true || !cache) {
|
|
1242
|
+
return;
|
|
1243
|
+
}
|
|
1244
|
+
const cacheKey = (cache === true ? '' : cache) + token;
|
|
1245
|
+
const cacheData = globalParams.cache.get(cacheKey);
|
|
1246
|
+
if (!cacheData) {
|
|
1247
|
+
return;
|
|
1248
|
+
}
|
|
1249
|
+
return Promise.resolve(cacheData);
|
|
1250
|
+
}
|
|
1251
|
+
};
|
|
1252
|
+
|
|
1253
|
+
var request$1 = {
|
|
1254
|
+
id: 'request',
|
|
1255
|
+
plugin: ({
|
|
1256
|
+
force
|
|
1257
|
+
}, context) => {
|
|
1258
|
+
if (context.outputStack['loader'] || context.errorStack['loader']) {
|
|
1259
|
+
return;
|
|
1260
|
+
}
|
|
1261
|
+
if (context.outputStack['cache']) {
|
|
1262
|
+
return context.outputStack['cache'];
|
|
1263
|
+
}
|
|
1264
|
+
const token = context.componentContext.getRequestToken();
|
|
1265
|
+
context.componentContext.requestParams = context.outputStack['params'];
|
|
1266
|
+
const {
|
|
1267
|
+
ajax
|
|
1268
|
+
} = context.componentContext.getProps();
|
|
1269
|
+
const requestPromise = force !== true && get(context.globalContext.pendingRequest, token) || (ajax || globalParams.ajax)(context.outputStack['params']);
|
|
1270
|
+
context.globalContext.pendingRequest = Object.assign({}, context.globalContext.pendingRequest, {
|
|
1271
|
+
[token]: requestPromise
|
|
1272
|
+
});
|
|
1273
|
+
return requestPromise.then(data => {
|
|
1274
|
+
delete context.globalContext.pendingRequest[token];
|
|
1275
|
+
return data;
|
|
1276
|
+
});
|
|
1277
|
+
},
|
|
1278
|
+
dependencies: ['params']
|
|
1279
|
+
};
|
|
1280
|
+
|
|
1281
|
+
var cacheRecord = {
|
|
1282
|
+
id: 'cache-record',
|
|
1283
|
+
plugin: (props, context) => {
|
|
1284
|
+
const {
|
|
1285
|
+
cache,
|
|
1286
|
+
isLocal,
|
|
1287
|
+
ttl
|
|
1288
|
+
} = context.componentContext.getProps();
|
|
1289
|
+
const token = context.componentContext.getRequestToken();
|
|
1290
|
+
const cacheName = cache === true ? '' : cache;
|
|
1291
|
+
const cacheKey = cacheName + token;
|
|
1292
|
+
if (cache && (context.outputStack['request'] || context.outputStack['loader']) && context.outputStack['output-data'] !== void 0) {
|
|
1293
|
+
globalParams.cache.put(cacheKey, context.outputStack['request'] || context.outputStack['loader'], {
|
|
1294
|
+
ttl,
|
|
1295
|
+
isLocal,
|
|
1296
|
+
cacheName
|
|
1297
|
+
});
|
|
1298
|
+
}
|
|
1299
|
+
},
|
|
1300
|
+
dependencies: ['cache', 'request', 'output-data']
|
|
1301
|
+
};
|
|
1302
|
+
|
|
1303
|
+
var transformResponse = {
|
|
1304
|
+
id: 'transform-response',
|
|
1305
|
+
plugin: (props, context) => {
|
|
1306
|
+
const {
|
|
1307
|
+
transformResponse,
|
|
1308
|
+
ignoreSuccessState,
|
|
1309
|
+
options
|
|
1310
|
+
} = context.componentContext.getProps();
|
|
1311
|
+
const response = context.outputStack['request'];
|
|
1312
|
+
if (!response) {
|
|
1313
|
+
return;
|
|
1314
|
+
}
|
|
1315
|
+
if (ignoreSuccessState === true) {
|
|
1316
|
+
return response;
|
|
1317
|
+
}
|
|
1318
|
+
return (transformResponse || globalParams.transformResponse)(Object.assign({}, response));
|
|
1319
|
+
},
|
|
1320
|
+
dependencies: ['request']
|
|
1321
|
+
};
|
|
1322
|
+
|
|
1323
|
+
var outputData = {
|
|
1324
|
+
id: 'output-data',
|
|
1325
|
+
plugin: (props, context) => {
|
|
1326
|
+
const {
|
|
1327
|
+
options,
|
|
1328
|
+
onRequestSuccess,
|
|
1329
|
+
ignoreSuccessState,
|
|
1330
|
+
transformData
|
|
1331
|
+
} = context.componentContext.getProps();
|
|
1332
|
+
if (Object.keys(context.errorStack).length > 0) {
|
|
1333
|
+
return;
|
|
1334
|
+
}
|
|
1335
|
+
const responseData = context.output.data;
|
|
1336
|
+
if (ignoreSuccessState !== true && responseData.code !== 200) {
|
|
1337
|
+
const error = new Error(responseData.msg);
|
|
1338
|
+
error.responseData = responseData;
|
|
1339
|
+
throw error;
|
|
1340
|
+
}
|
|
1341
|
+
const output = (output => typeof transformData === 'function' ? transformData(output, context.outputStack['params']) : output)((ignoreSuccessState !== true ? responseData.results : responseData) || {});
|
|
1342
|
+
onRequestSuccess && onRequestSuccess(output);
|
|
1343
|
+
return output;
|
|
1344
|
+
},
|
|
1345
|
+
dependencies: ['request']
|
|
1346
|
+
};
|
|
1347
|
+
|
|
1348
|
+
var loadMore = {
|
|
1349
|
+
id: 'load-more',
|
|
1350
|
+
plugin: ({
|
|
1351
|
+
type,
|
|
1352
|
+
callback
|
|
1353
|
+
}, context) => {
|
|
1354
|
+
if (type === 'load-more' && typeof callback === 'function') {
|
|
1355
|
+
const {
|
|
1356
|
+
fetchData
|
|
1357
|
+
} = context.componentContext.getState();
|
|
1358
|
+
return callback(fetchData, context.output);
|
|
1359
|
+
}
|
|
1360
|
+
},
|
|
1361
|
+
dependencies: ['output-data']
|
|
1362
|
+
};
|
|
1363
|
+
|
|
1364
|
+
var complete = {
|
|
1365
|
+
id: 'complete',
|
|
1366
|
+
plugin: ({
|
|
1367
|
+
type
|
|
1368
|
+
}, context) => {
|
|
1369
|
+
const {
|
|
1370
|
+
setIsLoading,
|
|
1371
|
+
setIsComplete,
|
|
1372
|
+
setFetchData
|
|
1373
|
+
} = context.componentContext;
|
|
1374
|
+
setFetchData(context.output);
|
|
1375
|
+
if (type === 'refresh') {
|
|
1376
|
+
setIsLoading(false);
|
|
1377
|
+
}
|
|
1378
|
+
setIsComplete(true);
|
|
1379
|
+
}
|
|
1380
|
+
};
|
|
1381
|
+
|
|
1382
|
+
var error = {
|
|
1383
|
+
id: 'error',
|
|
1384
|
+
plugin: (props, context) => {
|
|
1385
|
+
const {
|
|
1386
|
+
onRequestError,
|
|
1387
|
+
onRequestComplete
|
|
1388
|
+
} = context.componentContext.getProps();
|
|
1389
|
+
const {
|
|
1390
|
+
setError
|
|
1391
|
+
} = context.componentContext;
|
|
1392
|
+
if (Object.keys(context.errorStack).length > 0) {
|
|
1393
|
+
const errorMsg = Object.values(context.errorStack).map(e => {
|
|
1394
|
+
return e.message;
|
|
1395
|
+
}).filter(msg => !!msg).join('\n');
|
|
1396
|
+
onRequestError && onRequestError(Object.values(context.errorStack));
|
|
1397
|
+
setError(errorMsg || '请求发生错误');
|
|
1398
|
+
} else {
|
|
1399
|
+
setError(null);
|
|
1400
|
+
}
|
|
1401
|
+
onRequestComplete && onRequestComplete(context);
|
|
1402
|
+
}
|
|
1403
|
+
};
|
|
1404
|
+
|
|
1405
|
+
const plugins = [start, params, cache, loader, request$1, transformResponse, outputData, cacheRecord, loadMore, complete, error];
|
|
1406
|
+
const globalContext = {};
|
|
1407
|
+
const createRunner = componentContext => {
|
|
1408
|
+
return async props => {
|
|
1409
|
+
props = Object.assign({}, props);
|
|
1410
|
+
const allPlugins = plugins;
|
|
1411
|
+
const pluginContext = {
|
|
1412
|
+
props,
|
|
1413
|
+
globalContext,
|
|
1414
|
+
componentContext,
|
|
1415
|
+
requestContext: {},
|
|
1416
|
+
outputStack: {},
|
|
1417
|
+
errorStack: {},
|
|
1418
|
+
runPath: [],
|
|
1419
|
+
output: null
|
|
1420
|
+
};
|
|
1421
|
+
const {
|
|
1422
|
+
debug
|
|
1423
|
+
} = componentContext.getProps();
|
|
1424
|
+
for (let currentPlugin of allPlugins) {
|
|
1425
|
+
try {
|
|
1426
|
+
// 依赖检查,依赖插件没有成功运行,跳过插件
|
|
1427
|
+
if ((currentPlugin.dependencies || []).find(name => {
|
|
1428
|
+
return pluginContext.runPath.indexOf(name) === -1;
|
|
1429
|
+
})) {
|
|
1430
|
+
continue;
|
|
1431
|
+
}
|
|
1432
|
+
if (debug === true) {
|
|
1433
|
+
console.info('react-fetch:plugin-' + currentPlugin.id + ':start', pluginContext);
|
|
1434
|
+
}
|
|
1435
|
+
const output = await currentPlugin.plugin(props, pluginContext);
|
|
1436
|
+
if (debug === true) {
|
|
1437
|
+
console.info('react-fetch:plugin-' + currentPlugin.id + ':complete', output);
|
|
1438
|
+
}
|
|
1439
|
+
pluginContext.outputStack[currentPlugin.id] = output;
|
|
1440
|
+
pluginContext.output = output !== void 0 ? output : pluginContext.output;
|
|
1441
|
+
pluginContext.runPath.push(currentPlugin.id);
|
|
1442
|
+
} catch (e) {
|
|
1443
|
+
console.error(e);
|
|
1444
|
+
pluginContext.errorStack[currentPlugin.id] = e;
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
return pluginContext;
|
|
1448
|
+
};
|
|
1449
|
+
};
|
|
1450
|
+
|
|
1451
|
+
const getRequestToken = props => object_hash(pick(props, ['url', 'params', 'method', 'data', 'urlParams', 'options']), {
|
|
1452
|
+
algorithm: 'md5',
|
|
1453
|
+
encoding: 'base64'
|
|
1454
|
+
});
|
|
1455
|
+
|
|
1456
|
+
const useFetch = fetcherOptions => {
|
|
1457
|
+
const props = Object.assign({
|
|
1458
|
+
auto: true,
|
|
1459
|
+
updateType: 'reload'
|
|
1460
|
+
}, fetcherOptions);
|
|
1461
|
+
const propsRef = useRef(props);
|
|
1462
|
+
propsRef.current = props;
|
|
1463
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
1464
|
+
const [isComplete, setIsComplete] = useState(false);
|
|
1465
|
+
const [fetchData, setFetchData] = useState(null);
|
|
1466
|
+
const [error, setError] = useState(null);
|
|
1467
|
+
const [requestParams, setRequestParams] = useState({});
|
|
1468
|
+
const stateRef = useRef({
|
|
1469
|
+
isLoading,
|
|
1470
|
+
isComplete,
|
|
1471
|
+
fetchData,
|
|
1472
|
+
error,
|
|
1473
|
+
requestParams
|
|
1474
|
+
});
|
|
1475
|
+
stateRef.current = {
|
|
1476
|
+
isLoading,
|
|
1477
|
+
isComplete,
|
|
1478
|
+
fetchData,
|
|
1479
|
+
error,
|
|
1480
|
+
requestParams
|
|
1481
|
+
};
|
|
1482
|
+
const requestToken = getRequestToken(props);
|
|
1483
|
+
const requestTokenRef = useRef(requestToken);
|
|
1484
|
+
requestTokenRef.current = requestToken;
|
|
1485
|
+
const pluginRunnerRef = useRef();
|
|
1486
|
+
useMemo(() => {
|
|
1487
|
+
pluginRunnerRef.current = createRunner({
|
|
1488
|
+
getProps: () => propsRef.current,
|
|
1489
|
+
getRequestToken: () => requestTokenRef.current,
|
|
1490
|
+
getState: () => stateRef.current,
|
|
1491
|
+
requestParams,
|
|
1492
|
+
setRequestParams,
|
|
1493
|
+
setFetchData,
|
|
1494
|
+
setError,
|
|
1495
|
+
setIsComplete,
|
|
1496
|
+
setIsLoading
|
|
1497
|
+
});
|
|
1498
|
+
}, []);
|
|
1499
|
+
const send = (sendProps, force = true) => {
|
|
1500
|
+
return pluginRunnerRef.current(Object.assign({}, sendProps, {
|
|
1501
|
+
force
|
|
1502
|
+
}));
|
|
1503
|
+
};
|
|
1504
|
+
const refresh = (sendProps, force = true) => {
|
|
1505
|
+
return pluginRunnerRef.current(Object.assign({}, sendProps, {
|
|
1506
|
+
force,
|
|
1507
|
+
type: 'refresh'
|
|
1508
|
+
}));
|
|
1509
|
+
};
|
|
1510
|
+
const reload = (sendProps, force = true) => {
|
|
1511
|
+
return pluginRunnerRef.current(Object.assign({}, sendProps, {
|
|
1512
|
+
force,
|
|
1513
|
+
type: 'reload'
|
|
1514
|
+
}));
|
|
1515
|
+
};
|
|
1516
|
+
const loadMore = (sendProps, callback, force = true) => {
|
|
1517
|
+
return pluginRunnerRef.current(Object.assign({}, sendProps, {
|
|
1518
|
+
force,
|
|
1519
|
+
callback,
|
|
1520
|
+
type: 'load-more'
|
|
1521
|
+
}));
|
|
1522
|
+
};
|
|
1523
|
+
const apiRef = useRef({});
|
|
1524
|
+
apiRef.current = {
|
|
1525
|
+
send,
|
|
1526
|
+
refresh,
|
|
1527
|
+
reload,
|
|
1528
|
+
loadMore,
|
|
1529
|
+
setData: setFetchData
|
|
1530
|
+
};
|
|
1531
|
+
useEffect(() => {
|
|
1532
|
+
if (propsRef.current.auto) {
|
|
1533
|
+
if (stateRef.current.isComplete) {
|
|
1534
|
+
apiRef.current.send({
|
|
1535
|
+
type: propsRef.current.updateType
|
|
1536
|
+
}, false);
|
|
1537
|
+
} else {
|
|
1538
|
+
apiRef.current.refresh({}, false);
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
}, [requestToken]);
|
|
1542
|
+
return {
|
|
1543
|
+
isLoading,
|
|
1544
|
+
isComplete,
|
|
1545
|
+
data: fetchData,
|
|
1546
|
+
error,
|
|
1547
|
+
send,
|
|
1548
|
+
refresh,
|
|
1549
|
+
reload,
|
|
1550
|
+
loadMore,
|
|
1551
|
+
setData: setFetchData,
|
|
1552
|
+
requestParams
|
|
1553
|
+
};
|
|
1554
|
+
};
|
|
1555
|
+
|
|
1556
|
+
const _excluded$1 = ["component", "render", "loading", "isEmpty", "empty", "error"];
|
|
1557
|
+
const Fetch = forwardRef((_ref, ref) => {
|
|
1558
|
+
let {
|
|
1559
|
+
component,
|
|
1560
|
+
render,
|
|
1561
|
+
loading,
|
|
1562
|
+
isEmpty,
|
|
1563
|
+
empty,
|
|
1564
|
+
error: errorComponent
|
|
1565
|
+
} = _ref,
|
|
1566
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
1567
|
+
const {
|
|
1568
|
+
isLoading,
|
|
1569
|
+
isComplete,
|
|
1570
|
+
data,
|
|
1571
|
+
requestParams,
|
|
1572
|
+
error,
|
|
1573
|
+
send,
|
|
1574
|
+
refresh,
|
|
1575
|
+
reload,
|
|
1576
|
+
loadMore,
|
|
1577
|
+
setData
|
|
1578
|
+
} = useFetch(props);
|
|
1579
|
+
const fetchPropsList = ['url', 'params', 'urlParams', 'method', 'data', 'cache', 'ttl', 'isLocal', 'auto', 'loader', 'options', 'updateType', 'onRequestError', 'onRequestSuccess', 'onRequestComplete', 'onRequestStart', 'debug', 'ajax', 'transformData', 'transformResponse'];
|
|
1580
|
+
const otherProps = omit(props, fetchPropsList);
|
|
1581
|
+
const fetchProps = pick(props, fetchPropsList);
|
|
1582
|
+
useImperativeHandle(ref, () => {
|
|
1583
|
+
return {
|
|
1584
|
+
isLoading,
|
|
1585
|
+
isComplete,
|
|
1586
|
+
data,
|
|
1587
|
+
requestParams,
|
|
1588
|
+
error,
|
|
1589
|
+
send,
|
|
1590
|
+
refresh,
|
|
1591
|
+
reload,
|
|
1592
|
+
loadMore,
|
|
1593
|
+
setData
|
|
1594
|
+
};
|
|
1595
|
+
});
|
|
1596
|
+
if (isLoading) {
|
|
1597
|
+
return loading === void 0 ? globalParams.loading : loading;
|
|
1598
|
+
}
|
|
1599
|
+
if (error) {
|
|
1600
|
+
const _error = errorComponent === void 0 ? globalParams.error : errorComponent;
|
|
1601
|
+
if (typeof _error === 'function') {
|
|
1602
|
+
return _error(error);
|
|
1603
|
+
}
|
|
1604
|
+
return _error;
|
|
1605
|
+
}
|
|
1606
|
+
if (!isComplete && !data) {
|
|
1607
|
+
return null;
|
|
1608
|
+
}
|
|
1609
|
+
if (typeof isEmpty === 'function' ? isEmpty(data, requestParams) : !data) {
|
|
1610
|
+
return empty === void 0 ? globalParams.empty : empty;
|
|
1611
|
+
}
|
|
1612
|
+
if (component) {
|
|
1613
|
+
const FetchComponent = component;
|
|
1614
|
+
return /*#__PURE__*/React.createElement(FetchComponent, _extends({}, otherProps, {
|
|
1615
|
+
fetchProps: fetchProps,
|
|
1616
|
+
isComplete: isComplete,
|
|
1617
|
+
data: data,
|
|
1618
|
+
refresh: refresh,
|
|
1619
|
+
reload: reload,
|
|
1620
|
+
setData: setData,
|
|
1621
|
+
loadMore: loadMore,
|
|
1622
|
+
send: send,
|
|
1623
|
+
requestParams: requestParams
|
|
1624
|
+
}));
|
|
1625
|
+
}
|
|
1626
|
+
if (render) {
|
|
1627
|
+
return render(_extends({}, otherProps, {
|
|
1628
|
+
fetchProps,
|
|
1629
|
+
isComplete,
|
|
1630
|
+
data,
|
|
1631
|
+
refresh,
|
|
1632
|
+
reload,
|
|
1633
|
+
setData,
|
|
1634
|
+
loadMore,
|
|
1635
|
+
send,
|
|
1636
|
+
requestParams
|
|
1637
|
+
}));
|
|
1638
|
+
}
|
|
1639
|
+
throw new Error('请传入component参数或者render参数');
|
|
1640
|
+
});
|
|
1641
|
+
|
|
1642
|
+
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"};
|
|
1643
|
+
|
|
1644
|
+
const _excluded = ["children"],
|
|
1645
|
+
_excluded2 = ["data"];
|
|
1646
|
+
const parseTreeData = memoize((data = []) => {
|
|
1647
|
+
const parseTree = output => {
|
|
1648
|
+
return output.map(node => {
|
|
1649
|
+
const children = data.filter(item => {
|
|
1650
|
+
return item.parentId === node.id;
|
|
1651
|
+
});
|
|
1652
|
+
return Object.assign({}, node, {
|
|
1653
|
+
children: parseTree(children)
|
|
1654
|
+
});
|
|
1655
|
+
});
|
|
1656
|
+
};
|
|
1657
|
+
return {
|
|
1658
|
+
treeData: parseTree(data.filter(item => !item.parentId)),
|
|
1659
|
+
ids: data.map(item => item.id)
|
|
1660
|
+
};
|
|
1661
|
+
});
|
|
1662
|
+
const SelectTree = forwardRef((_ref, ref) => {
|
|
1663
|
+
let {
|
|
1664
|
+
children
|
|
1665
|
+
} = _ref,
|
|
1666
|
+
p = _objectWithoutPropertiesLoose$1(_ref, _excluded);
|
|
1667
|
+
const fetchListRef = useRef(null);
|
|
1668
|
+
const [expandedKeys, setExpandedKeys] = useState([]);
|
|
1669
|
+
const props = Object.assign({}, {
|
|
1670
|
+
renderItemContent: ({
|
|
1671
|
+
item,
|
|
1672
|
+
props
|
|
1673
|
+
}) => {
|
|
1674
|
+
const {
|
|
1675
|
+
labelKey
|
|
1676
|
+
} = props;
|
|
1677
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
1678
|
+
className: 'select-tree-item-label'
|
|
1679
|
+
}, item[labelKey]));
|
|
1680
|
+
},
|
|
1681
|
+
renderItem: contextProps => {
|
|
1682
|
+
const {
|
|
1683
|
+
item,
|
|
1684
|
+
props,
|
|
1685
|
+
isSelectedAll,
|
|
1686
|
+
value,
|
|
1687
|
+
onSelect,
|
|
1688
|
+
setValue,
|
|
1689
|
+
onOpenChange
|
|
1690
|
+
} = contextProps;
|
|
1691
|
+
const {
|
|
1692
|
+
single,
|
|
1693
|
+
isPopup,
|
|
1694
|
+
renderItemContent,
|
|
1695
|
+
valueKey
|
|
1696
|
+
} = props;
|
|
1697
|
+
const isChecked = value.some(target => target[valueKey] === item[valueKey]);
|
|
1698
|
+
return /*#__PURE__*/React.createElement(Flex, {
|
|
1699
|
+
className: classnames(style['default-list-item'], 'select-tree-item', {
|
|
1700
|
+
[style['is-selected']]: isChecked,
|
|
1701
|
+
[style['is-disabled']]: item.disabled
|
|
1702
|
+
}),
|
|
1703
|
+
key: item[valueKey],
|
|
1704
|
+
onClick: () => {
|
|
1705
|
+
if (item.disabled) {
|
|
1706
|
+
return;
|
|
1707
|
+
}
|
|
1708
|
+
if (isSelectedAll) {
|
|
1709
|
+
return;
|
|
1710
|
+
}
|
|
1711
|
+
if (single) {
|
|
1712
|
+
setValue([item]);
|
|
1713
|
+
} else {
|
|
1714
|
+
onSelect(item);
|
|
1715
|
+
}
|
|
1716
|
+
if (isPopup && single) {
|
|
1717
|
+
onOpenChange(false);
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
}, !single && /*#__PURE__*/React.createElement(Flex, null, /*#__PURE__*/React.createElement(Checkbox, {
|
|
1721
|
+
checked: isSelectedAll || isChecked,
|
|
1722
|
+
disabled: isSelectedAll || item.disabled
|
|
1723
|
+
})), /*#__PURE__*/React.createElement(Flex, {
|
|
1724
|
+
vertical: true,
|
|
1725
|
+
gag: 8,
|
|
1726
|
+
flex: 1,
|
|
1727
|
+
className: 'select-tree-item-content'
|
|
1728
|
+
}, renderItemContent(contextProps)), single && /*#__PURE__*/React.createElement("div", {
|
|
1729
|
+
className: style['single-checked']
|
|
1730
|
+
}, isChecked && /*#__PURE__*/React.createElement(CheckOutlined, null)));
|
|
1731
|
+
},
|
|
1732
|
+
renderTree: contextProps => {
|
|
1733
|
+
const {
|
|
1734
|
+
props,
|
|
1735
|
+
isSelectedAll,
|
|
1736
|
+
data
|
|
1737
|
+
} = contextProps;
|
|
1738
|
+
const {
|
|
1739
|
+
renderItem,
|
|
1740
|
+
valueKey,
|
|
1741
|
+
labelKey,
|
|
1742
|
+
childrenKey
|
|
1743
|
+
} = props;
|
|
1744
|
+
const {
|
|
1745
|
+
treeData,
|
|
1746
|
+
ids
|
|
1747
|
+
} = parseTreeData(data);
|
|
1748
|
+
return /*#__PURE__*/React.createElement(Tree, {
|
|
1749
|
+
className: classnames(style['default-list'], {
|
|
1750
|
+
[style['is-selected-all']]: isSelectedAll
|
|
1751
|
+
}),
|
|
1752
|
+
showIcon: true,
|
|
1753
|
+
selectable: false,
|
|
1754
|
+
expandedKeys: expandedKeys,
|
|
1755
|
+
fieldNames: {
|
|
1756
|
+
title: labelKey,
|
|
1757
|
+
key: valueKey,
|
|
1758
|
+
children: childrenKey || 'children'
|
|
1759
|
+
},
|
|
1760
|
+
treeData: treeData,
|
|
1761
|
+
onExpand: expandedKeys => {
|
|
1762
|
+
setExpandedKeys(expandedKeys);
|
|
1763
|
+
},
|
|
1764
|
+
titleRender: node => {
|
|
1765
|
+
return renderItem(Object.assign({}, contextProps, {
|
|
1766
|
+
item: node
|
|
1767
|
+
}));
|
|
1768
|
+
}
|
|
1769
|
+
});
|
|
1770
|
+
}
|
|
1771
|
+
}, p);
|
|
1772
|
+
return /*#__PURE__*/React.createElement(SelectInput, _extends$1({}, props, {
|
|
1773
|
+
ref: ref
|
|
1774
|
+
}), targetProps => {
|
|
1775
|
+
const {
|
|
1776
|
+
props,
|
|
1777
|
+
value,
|
|
1778
|
+
onOpenChange
|
|
1779
|
+
} = targetProps;
|
|
1780
|
+
const {
|
|
1781
|
+
footer,
|
|
1782
|
+
isPopup,
|
|
1783
|
+
valueKey,
|
|
1784
|
+
single,
|
|
1785
|
+
allowSelectedAll,
|
|
1786
|
+
showSelectedTag,
|
|
1787
|
+
api,
|
|
1788
|
+
options,
|
|
1789
|
+
renderTree,
|
|
1790
|
+
selectedAllValue
|
|
1791
|
+
} = props;
|
|
1792
|
+
const components = {
|
|
1793
|
+
selectedAll: /*#__PURE__*/React.createElement("div", {
|
|
1794
|
+
className: classnames(style['selected-all'], 'select-tree-selected-all', {
|
|
1795
|
+
'is-popup': isPopup
|
|
1796
|
+
})
|
|
1797
|
+
}, !single && allowSelectedAll && /*#__PURE__*/React.createElement(SelectedAll, null)),
|
|
1798
|
+
treeList: /*#__PURE__*/React.createElement(Fetch, _extends$1({}, Object.assign({}, props, options ? {
|
|
1799
|
+
data: {
|
|
1800
|
+
options
|
|
1801
|
+
},
|
|
1802
|
+
loader: ({
|
|
1803
|
+
data
|
|
1804
|
+
}) => data.options
|
|
1805
|
+
} : api), {
|
|
1806
|
+
ref: fetchListRef,
|
|
1807
|
+
render: _ref2 => {
|
|
1808
|
+
let {
|
|
1809
|
+
data
|
|
1810
|
+
} = _ref2,
|
|
1811
|
+
fetchProps = _objectWithoutPropertiesLoose$1(_ref2, _excluded2);
|
|
1812
|
+
const isSelectedAll = computedIsSelectAll(value, selectedAllValue, valueKey);
|
|
1813
|
+
return /*#__PURE__*/React.createElement(SimpleBar, {
|
|
1814
|
+
className: classnames(style['list'], 'select-tree-scroll-list', {
|
|
1815
|
+
'is-popup': isPopup
|
|
1816
|
+
})
|
|
1817
|
+
}, renderTree(Object.assign({}, fetchProps, targetProps, {
|
|
1818
|
+
isSelectedAll,
|
|
1819
|
+
data
|
|
1820
|
+
})));
|
|
1821
|
+
}
|
|
1822
|
+
})),
|
|
1823
|
+
selectedTag: showSelectedTag && /*#__PURE__*/React.createElement("div", {
|
|
1824
|
+
className: classnames(style['selected-tag'], 'select-tree-selected-tag', {
|
|
1825
|
+
'is-popup': isPopup
|
|
1826
|
+
})
|
|
1827
|
+
}, /*#__PURE__*/React.createElement(SelectedTagList, null))
|
|
1828
|
+
};
|
|
1829
|
+
if (typeof children === 'function') {
|
|
1830
|
+
return children(Object.assign({}, targetProps, {
|
|
1831
|
+
components
|
|
1832
|
+
}));
|
|
1833
|
+
}
|
|
1834
|
+
return /*#__PURE__*/React.createElement(Flex, {
|
|
1835
|
+
vertical: true
|
|
1836
|
+
}, components.search, components.selectedAll, components.treeList, footer && /*#__PURE__*/React.createElement("div", {
|
|
1837
|
+
className: classnames(style['footer'], 'select-tree-footer')
|
|
1838
|
+
}, typeof footer === 'function' ? footer({
|
|
1839
|
+
reload: () => {
|
|
1840
|
+
fetchListRef.current && fetchListRef.current.reload();
|
|
1841
|
+
},
|
|
1842
|
+
close: () => {
|
|
1843
|
+
onOpenChange(false);
|
|
1844
|
+
}
|
|
1845
|
+
}) : footer), components.selectedTag);
|
|
1846
|
+
});
|
|
1847
|
+
});
|
|
1848
|
+
|
|
1849
|
+
export { SelectInput, SelectTableList, SelectTree, SelectedAll, SelectedTagList, SelectList as default };
|
|
937
1850
|
//# sourceMappingURL=index.modern.js.map
|