funda-ui 4.7.515 → 4.7.517
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/Select/index.js +110 -88
- package/lib/cjs/Select/index.js +110 -88
- package/lib/esm/Select/index.tsx +165 -148
- package/package.json +1 -1
package/Select/index.js
CHANGED
|
@@ -3703,54 +3703,92 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
3703
3703
|
var LIST_CONTAINER_MAX_HEIGHT = 300;
|
|
3704
3704
|
var keyboardSelectedItem = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
3705
3705
|
|
|
3706
|
+
// loading
|
|
3707
|
+
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
3708
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
3709
|
+
fetchLoading = _useState2[0],
|
|
3710
|
+
setFetchLoading = _useState2[1];
|
|
3711
|
+
var loadingOutput = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
3712
|
+
className: "cus-select-loader"
|
|
3713
|
+
}, loader || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
|
|
3714
|
+
height: "12px",
|
|
3715
|
+
width: "12px",
|
|
3716
|
+
viewBox: "0 0 512 512"
|
|
3717
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("g", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
3718
|
+
fill: "inherit",
|
|
3719
|
+
d: "M256,0c-23.357,0-42.297,18.932-42.297,42.288c0,23.358,18.94,42.288,42.297,42.288c23.357,0,42.279-18.93,42.279-42.288C298.279,18.932,279.357,0,256,0z"
|
|
3720
|
+
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
3721
|
+
fill: "inherit",
|
|
3722
|
+
d: "M256,427.424c-23.357,0-42.297,18.931-42.297,42.288C213.703,493.07,232.643,512,256,512c23.357,0,42.279-18.93,42.279-42.288C298.279,446.355,279.357,427.424,256,427.424z"
|
|
3723
|
+
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
3724
|
+
fill: "inherit",
|
|
3725
|
+
d: "M74.974,74.983c-16.52,16.511-16.52,43.286,0,59.806c16.52,16.52,43.287,16.52,59.806,0c16.52-16.511,16.52-43.286,0-59.806C118.261,58.463,91.494,58.463,74.974,74.983z"
|
|
3726
|
+
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
3727
|
+
fill: "inherit",
|
|
3728
|
+
d: "M377.203,377.211c-16.503,16.52-16.503,43.296,0,59.815c16.519,16.52,43.304,16.52,59.806,0c16.52-16.51,16.52-43.295,0-59.815C420.489,360.692,393.722,360.7,377.203,377.211z"
|
|
3729
|
+
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
3730
|
+
fill: "inherit",
|
|
3731
|
+
d: "M84.567,256c0.018-23.348-18.922-42.279-42.279-42.279c-23.357-0.009-42.297,18.932-42.279,42.288c-0.018,23.348,18.904,42.279,42.279,42.279C65.645,298.288,84.567,279.358,84.567,256z"
|
|
3732
|
+
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
3733
|
+
fill: "inherit",
|
|
3734
|
+
d: "M469.712,213.712c-23.357,0-42.279,18.941-42.297,42.288c0,23.358,18.94,42.288,42.297,42.297c23.357,0,42.297-18.94,42.279-42.297C512.009,232.652,493.069,213.712,469.712,213.712z"
|
|
3735
|
+
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
3736
|
+
fill: "inherit",
|
|
3737
|
+
d: "M74.991,377.22c-16.519,16.511-16.519,43.296,0,59.806c16.503,16.52,43.27,16.52,59.789,0c16.52-16.519,16.52-43.295,0-59.815C118.278,360.692,91.511,360.692,74.991,377.22z"
|
|
3738
|
+
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
3739
|
+
fill: "inherit",
|
|
3740
|
+
d: "M437.026,134.798c16.52-16.52,16.52-43.304,0-59.824c-16.519-16.511-43.304-16.52-59.823,0c-16.52,16.52-16.503,43.295,0,59.815C393.722,151.309,420.507,151.309,437.026,134.798z"
|
|
3741
|
+
})))));
|
|
3742
|
+
|
|
3706
3743
|
// return a array of options
|
|
3707
3744
|
var staticOptionsData = optionsRes;
|
|
3745
|
+
var hasDefaultOptions = staticOptionsData.length > 0;
|
|
3708
3746
|
|
|
3709
3747
|
//
|
|
3710
|
-
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(staticOptionsData),
|
|
3711
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
3712
|
-
orginalData = _useState2[0],
|
|
3713
|
-
setOrginalData = _useState2[1];
|
|
3714
3748
|
var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(staticOptionsData),
|
|
3715
3749
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(
|
|
3750
|
+
orginalData = _useState4[0],
|
|
3751
|
+
setOrginalData = _useState4[1];
|
|
3752
|
+
var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(staticOptionsData),
|
|
3719
3753
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
3720
|
-
|
|
3721
|
-
|
|
3754
|
+
optionsData = _useState6[0],
|
|
3755
|
+
setOptionsData = _useState6[1];
|
|
3756
|
+
var _useState7 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
3757
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
3758
|
+
hasErr = _useState8[0],
|
|
3759
|
+
setHasErr = _useState8[1];
|
|
3722
3760
|
|
|
3723
3761
|
// Set the final result
|
|
3724
|
-
var _useState7 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(''),
|
|
3725
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
3726
|
-
controlLabel = _useState8[0],
|
|
3727
|
-
setControlLabel = _useState8[1];
|
|
3728
3762
|
var _useState9 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(''),
|
|
3729
3763
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
3730
|
-
|
|
3731
|
-
|
|
3764
|
+
controlLabel = _useState10[0],
|
|
3765
|
+
setControlLabel = _useState10[1];
|
|
3766
|
+
var _useState11 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(''),
|
|
3767
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
3768
|
+
controlValue = _useState12[0],
|
|
3769
|
+
setControlValue = _useState12[1];
|
|
3732
3770
|
|
|
3733
3771
|
//
|
|
3734
|
-
var
|
|
3735
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
3736
|
-
controlTempValue = _useState12[0],
|
|
3737
|
-
setControlTempValue = _useState12[1]; // Storage for temporary input
|
|
3738
|
-
var _useState13 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
3772
|
+
var _useState13 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null),
|
|
3739
3773
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
var _useState15 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(
|
|
3774
|
+
controlTempValue = _useState14[0],
|
|
3775
|
+
setControlTempValue = _useState14[1]; // Storage for temporary input
|
|
3776
|
+
var _useState15 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
3743
3777
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
var _useState17 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(
|
|
3778
|
+
isOpen = _useState16[0],
|
|
3779
|
+
setIsOpen = _useState16[1];
|
|
3780
|
+
var _useState17 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null),
|
|
3747
3781
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
3748
|
-
|
|
3749
|
-
|
|
3782
|
+
incomingData = _useState18[0],
|
|
3783
|
+
setIncomingData = _useState18[1];
|
|
3750
3784
|
var _useState19 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
3751
3785
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
3752
|
-
|
|
3753
|
-
|
|
3786
|
+
firstRequestExecuted = _useState20[0],
|
|
3787
|
+
setFirstRequestExecuted = _useState20[1];
|
|
3788
|
+
var _useState21 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
3789
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
3790
|
+
handleFirstFetchCompleted = _useState22[0],
|
|
3791
|
+
setHandleFirstFetchCompleted = _useState22[1];
|
|
3754
3792
|
|
|
3755
3793
|
// Mark whether it is out of focus
|
|
3756
3794
|
// Fixed the issue that caused the pop-up window to still display due to
|
|
@@ -3758,25 +3796,25 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
3758
3796
|
var isBlurringRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);
|
|
3759
3797
|
|
|
3760
3798
|
// filter status
|
|
3761
|
-
var
|
|
3762
|
-
|
|
3763
|
-
filterItemsHasNoMatchData =
|
|
3764
|
-
setFilterItemsHasNoMatchData =
|
|
3799
|
+
var _useState23 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
3800
|
+
_useState24 = _slicedToArray(_useState23, 2),
|
|
3801
|
+
filterItemsHasNoMatchData = _useState24[0],
|
|
3802
|
+
setFilterItemsHasNoMatchData = _useState24[1];
|
|
3765
3803
|
|
|
3766
3804
|
// blinking cursor
|
|
3767
3805
|
var BLINKING_CURSOR_STR = '|';
|
|
3768
|
-
var
|
|
3769
|
-
|
|
3770
|
-
blinkingPosStart =
|
|
3771
|
-
setBlinkingPosStart =
|
|
3806
|
+
var _useState25 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
|
|
3807
|
+
_useState26 = _slicedToArray(_useState25, 2),
|
|
3808
|
+
blinkingPosStart = _useState26[0],
|
|
3809
|
+
setBlinkingPosStart = _useState26[1];
|
|
3772
3810
|
var blinkingPosFauxRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
3773
3811
|
var blinkingCursorPosDivRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
3774
3812
|
|
|
3775
3813
|
// Select All status (for "Single selection")
|
|
3776
|
-
var
|
|
3777
|
-
|
|
3778
|
-
userInputboxIsAllSelected =
|
|
3779
|
-
setUserInputboxIsAllSelected =
|
|
3814
|
+
var _useState27 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
3815
|
+
_useState28 = _slicedToArray(_useState27, 2),
|
|
3816
|
+
userInputboxIsAllSelected = _useState28[0],
|
|
3817
|
+
setUserInputboxIsAllSelected = _useState28[1];
|
|
3780
3818
|
var selectedSign = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);
|
|
3781
3819
|
var MULTI_SEL_VALID = multiSelect ? multiSelect.valid : false;
|
|
3782
3820
|
var MULTI_SEL_ENTIRE_AREA_TRIGGER = typeof multiSelectEntireAreaTrigger === 'undefined' ? true : multiSelectEntireAreaTrigger;
|
|
@@ -3787,13 +3825,13 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
3787
3825
|
allItemsLabel: 'All Content ({num})',
|
|
3788
3826
|
noneLabel: 'No items selected'
|
|
3789
3827
|
};
|
|
3790
|
-
var
|
|
3828
|
+
var _useState29 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({
|
|
3791
3829
|
labels: [],
|
|
3792
3830
|
values: []
|
|
3793
3831
|
}),
|
|
3794
|
-
|
|
3795
|
-
controlArr =
|
|
3796
|
-
setControlArr =
|
|
3832
|
+
_useState30 = _slicedToArray(_useState29, 2),
|
|
3833
|
+
controlArr = _useState30[0],
|
|
3834
|
+
setControlArr = _useState30[1];
|
|
3797
3835
|
|
|
3798
3836
|
// Only single symbols such as , #, and @ are allowed, and , a, a, , etc. are not allowed.
|
|
3799
3837
|
var isSingleSpecialChar = function isSingleSpecialChar(str) {
|
|
@@ -3943,6 +3981,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
3943
3981
|
|
|
3944
3982
|
//performance
|
|
3945
3983
|
var handleChangeFetchSafe = useDebounce_default()(function (val) {
|
|
3984
|
+
setFetchLoading(true);
|
|
3946
3985
|
if (fetchUpdate) {
|
|
3947
3986
|
// update filter status
|
|
3948
3987
|
setFilterItemsHasNoMatchData(false);
|
|
@@ -3954,6 +3993,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
3954
3993
|
popwinPosInit();
|
|
3955
3994
|
popwinFilterItems(val);
|
|
3956
3995
|
}, 0);
|
|
3996
|
+
setFetchLoading(false);
|
|
3957
3997
|
});
|
|
3958
3998
|
} else {
|
|
3959
3999
|
// pop win initalization
|
|
@@ -3961,6 +4001,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
3961
4001
|
popwinPosInit();
|
|
3962
4002
|
popwinFilterItems(val);
|
|
3963
4003
|
}, 0);
|
|
4004
|
+
setFetchLoading(false);
|
|
3964
4005
|
}
|
|
3965
4006
|
}, 350, [optionsData]);
|
|
3966
4007
|
function fetchData(_x2, _x3, _x4) {
|
|
@@ -4517,10 +4558,9 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
4517
4558
|
setIsOpen(false);
|
|
4518
4559
|
if (!MULTI_SEL_VALID) popwinPosHide();
|
|
4519
4560
|
if (MANUAL_REQ) {
|
|
4520
|
-
//
|
|
4521
|
-
setOptionsData(
|
|
4561
|
+
// restore to static data
|
|
4562
|
+
setOptionsData(staticOptionsData);
|
|
4522
4563
|
} else {
|
|
4523
|
-
// restore data
|
|
4524
4564
|
setOptionsData(orginalData);
|
|
4525
4565
|
}
|
|
4526
4566
|
|
|
@@ -4576,8 +4616,8 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
4576
4616
|
}, 500);
|
|
4577
4617
|
}
|
|
4578
4618
|
if (MANUAL_REQ) {
|
|
4579
|
-
//
|
|
4580
|
-
setOptionsData(
|
|
4619
|
+
// display static data
|
|
4620
|
+
setOptionsData(staticOptionsData);
|
|
4581
4621
|
} else {
|
|
4582
4622
|
// restore data
|
|
4583
4623
|
setOptionsData(orginalData);
|
|
@@ -4589,7 +4629,8 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
4589
4629
|
}
|
|
4590
4630
|
|
|
4591
4631
|
// Every time the input changes or the search button is clicked, a data request will be triggered
|
|
4592
|
-
|
|
4632
|
+
// !!! If the default data is empty, the pop-up window is not displayed
|
|
4633
|
+
if (MANUAL_REQ && (controlTempValue === '' || controlTempValue === null) && !hasDefaultOptions) {
|
|
4593
4634
|
setTimeout(function () {
|
|
4594
4635
|
popwinPosHide();
|
|
4595
4636
|
}, 0);
|
|
@@ -5098,18 +5139,21 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
5098
5139
|
while (1) switch (_context6.prev = _context6.next) {
|
|
5099
5140
|
case 0:
|
|
5100
5141
|
inputVal = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : null;
|
|
5142
|
+
setFetchLoading(true);
|
|
5143
|
+
|
|
5101
5144
|
// data init
|
|
5102
5145
|
searchStr = typeof inputVal === 'string' ? inputVal : controlTempValue || controlTempValue === '' ? controlTempValue : '';
|
|
5103
5146
|
_oparams = fetchFuncMethodParams || [];
|
|
5104
5147
|
_params = _oparams.map(function (item) {
|
|
5105
5148
|
return item !== '$QUERY_STRING' ? item : searchStr;
|
|
5106
5149
|
});
|
|
5107
|
-
_context6.next =
|
|
5150
|
+
_context6.next = 7;
|
|
5108
5151
|
return fetchData(_params.join(','), '', '', false);
|
|
5109
|
-
case
|
|
5152
|
+
case 7:
|
|
5110
5153
|
res = _context6.sent;
|
|
5154
|
+
setFetchLoading(false);
|
|
5111
5155
|
return _context6.abrupt("return", res);
|
|
5112
|
-
case
|
|
5156
|
+
case 10:
|
|
5113
5157
|
case "end":
|
|
5114
5158
|
return _context6.stop();
|
|
5115
5159
|
}
|
|
@@ -5904,7 +5948,15 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
5904
5948
|
__html: "".concat(CLEAR_TRIGGER_LABEL)
|
|
5905
5949
|
},
|
|
5906
5950
|
onClick: handleClearValue
|
|
5907
|
-
}))) : null) : null,
|
|
5951
|
+
}))) : null) : null, fetchLoading && MANUAL_REQ && hasDefaultOptions ?
|
|
5952
|
+
/*#__PURE__*/
|
|
5953
|
+
// only loading
|
|
5954
|
+
external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
|
|
5955
|
+
tabIndex: -1,
|
|
5956
|
+
type: "button",
|
|
5957
|
+
className: "list-group-item list-group-item-action no-match border-0 custom-select-multi__control-option-item--nomatch",
|
|
5958
|
+
disabled: true
|
|
5959
|
+
}, loadingOutput)) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
|
|
5908
5960
|
tabIndex: -1,
|
|
5909
5961
|
type: "button",
|
|
5910
5962
|
className: "list-group-item list-group-item-action no-match border-0 custom-select-multi__control-option-item--nomatch hide",
|
|
@@ -5913,37 +5965,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
5913
5965
|
// (1) Handling async data with the click event
|
|
5914
5966
|
!FIRST_REQUEST_AUTO && !handleFirstFetchCompleted ||
|
|
5915
5967
|
// (2) Every time the input changes or the search button is clicked, a data request will be triggered
|
|
5916
|
-
fetchUpdate && !filterItemsHasNoMatchData && controlTempValue !== '' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(
|
|
5917
|
-
className: "cus-select-loader"
|
|
5918
|
-
}, loader || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
|
|
5919
|
-
height: "12px",
|
|
5920
|
-
width: "12px",
|
|
5921
|
-
viewBox: "0 0 512 512"
|
|
5922
|
-
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("g", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
5923
|
-
fill: "inherit",
|
|
5924
|
-
d: "M256,0c-23.357,0-42.297,18.932-42.297,42.288c0,23.358,18.94,42.288,42.297,42.288c23.357,0,42.279-18.93,42.279-42.288C298.279,18.932,279.357,0,256,0z"
|
|
5925
|
-
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
5926
|
-
fill: "inherit",
|
|
5927
|
-
d: "M256,427.424c-23.357,0-42.297,18.931-42.297,42.288C213.703,493.07,232.643,512,256,512c23.357,0,42.279-18.93,42.279-42.288C298.279,446.355,279.357,427.424,256,427.424z"
|
|
5928
|
-
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
5929
|
-
fill: "inherit",
|
|
5930
|
-
d: "M74.974,74.983c-16.52,16.511-16.52,43.286,0,59.806c16.52,16.52,43.287,16.52,59.806,0c16.52-16.511,16.52-43.286,0-59.806C118.261,58.463,91.494,58.463,74.974,74.983z"
|
|
5931
|
-
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
5932
|
-
fill: "inherit",
|
|
5933
|
-
d: "M377.203,377.211c-16.503,16.52-16.503,43.296,0,59.815c16.519,16.52,43.304,16.52,59.806,0c16.52-16.51,16.52-43.295,0-59.815C420.489,360.692,393.722,360.7,377.203,377.211z"
|
|
5934
|
-
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
5935
|
-
fill: "inherit",
|
|
5936
|
-
d: "M84.567,256c0.018-23.348-18.922-42.279-42.279-42.279c-23.357-0.009-42.297,18.932-42.279,42.288c-0.018,23.348,18.904,42.279,42.279,42.279C65.645,298.288,84.567,279.358,84.567,256z"
|
|
5937
|
-
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
5938
|
-
fill: "inherit",
|
|
5939
|
-
d: "M469.712,213.712c-23.357,0-42.279,18.941-42.297,42.288c0,23.358,18.94,42.288,42.297,42.297c23.357,0,42.297-18.94,42.279-42.297C512.009,232.652,493.069,213.712,469.712,213.712z"
|
|
5940
|
-
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
5941
|
-
fill: "inherit",
|
|
5942
|
-
d: "M74.991,377.22c-16.519,16.511-16.519,43.296,0,59.806c16.503,16.52,43.27,16.52,59.789,0c16.52-16.519,16.52-43.295,0-59.815C118.278,360.692,91.511,360.692,74.991,377.22z"
|
|
5943
|
-
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
5944
|
-
fill: "inherit",
|
|
5945
|
-
d: "M437.026,134.798c16.52-16.52,16.52-43.304,0-59.824c-16.519-16.511-43.304-16.52-59.823,0c-16.52,16.52-16.503,43.295,0,59.815C393.722,151.309,420.507,151.309,437.026,134.798z"
|
|
5946
|
-
}))))) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, fetchNoneInfo)), optionsData ? optionsData.map(function (item, index) {
|
|
5968
|
+
fetchUpdate && !filterItemsHasNoMatchData && controlTempValue !== '' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, loadingOutput) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, fetchNoneInfo)), optionsData ? optionsData.map(function (item, index) {
|
|
5947
5969
|
var startItemBorder = index === 0 ? 'border-top-0' : '';
|
|
5948
5970
|
var endItemBorder = index === optionsData.length - 1 ? 'border-bottom-0' : '';
|
|
5949
5971
|
|
|
@@ -6047,7 +6069,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
6047
6069
|
}
|
|
6048
6070
|
})));
|
|
6049
6071
|
}
|
|
6050
|
-
}) : null))))) : null));
|
|
6072
|
+
}) : null)))))) : null));
|
|
6051
6073
|
});
|
|
6052
6074
|
/* harmony default export */ const src = (Select);
|
|
6053
6075
|
})();
|
package/lib/cjs/Select/index.js
CHANGED
|
@@ -3703,54 +3703,92 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
3703
3703
|
var LIST_CONTAINER_MAX_HEIGHT = 300;
|
|
3704
3704
|
var keyboardSelectedItem = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
3705
3705
|
|
|
3706
|
+
// loading
|
|
3707
|
+
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
3708
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
3709
|
+
fetchLoading = _useState2[0],
|
|
3710
|
+
setFetchLoading = _useState2[1];
|
|
3711
|
+
var loadingOutput = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
3712
|
+
className: "cus-select-loader"
|
|
3713
|
+
}, loader || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
|
|
3714
|
+
height: "12px",
|
|
3715
|
+
width: "12px",
|
|
3716
|
+
viewBox: "0 0 512 512"
|
|
3717
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("g", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
3718
|
+
fill: "inherit",
|
|
3719
|
+
d: "M256,0c-23.357,0-42.297,18.932-42.297,42.288c0,23.358,18.94,42.288,42.297,42.288c23.357,0,42.279-18.93,42.279-42.288C298.279,18.932,279.357,0,256,0z"
|
|
3720
|
+
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
3721
|
+
fill: "inherit",
|
|
3722
|
+
d: "M256,427.424c-23.357,0-42.297,18.931-42.297,42.288C213.703,493.07,232.643,512,256,512c23.357,0,42.279-18.93,42.279-42.288C298.279,446.355,279.357,427.424,256,427.424z"
|
|
3723
|
+
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
3724
|
+
fill: "inherit",
|
|
3725
|
+
d: "M74.974,74.983c-16.52,16.511-16.52,43.286,0,59.806c16.52,16.52,43.287,16.52,59.806,0c16.52-16.511,16.52-43.286,0-59.806C118.261,58.463,91.494,58.463,74.974,74.983z"
|
|
3726
|
+
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
3727
|
+
fill: "inherit",
|
|
3728
|
+
d: "M377.203,377.211c-16.503,16.52-16.503,43.296,0,59.815c16.519,16.52,43.304,16.52,59.806,0c16.52-16.51,16.52-43.295,0-59.815C420.489,360.692,393.722,360.7,377.203,377.211z"
|
|
3729
|
+
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
3730
|
+
fill: "inherit",
|
|
3731
|
+
d: "M84.567,256c0.018-23.348-18.922-42.279-42.279-42.279c-23.357-0.009-42.297,18.932-42.279,42.288c-0.018,23.348,18.904,42.279,42.279,42.279C65.645,298.288,84.567,279.358,84.567,256z"
|
|
3732
|
+
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
3733
|
+
fill: "inherit",
|
|
3734
|
+
d: "M469.712,213.712c-23.357,0-42.279,18.941-42.297,42.288c0,23.358,18.94,42.288,42.297,42.297c23.357,0,42.297-18.94,42.279-42.297C512.009,232.652,493.069,213.712,469.712,213.712z"
|
|
3735
|
+
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
3736
|
+
fill: "inherit",
|
|
3737
|
+
d: "M74.991,377.22c-16.519,16.511-16.519,43.296,0,59.806c16.503,16.52,43.27,16.52,59.789,0c16.52-16.519,16.52-43.295,0-59.815C118.278,360.692,91.511,360.692,74.991,377.22z"
|
|
3738
|
+
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
3739
|
+
fill: "inherit",
|
|
3740
|
+
d: "M437.026,134.798c16.52-16.52,16.52-43.304,0-59.824c-16.519-16.511-43.304-16.52-59.823,0c-16.52,16.52-16.503,43.295,0,59.815C393.722,151.309,420.507,151.309,437.026,134.798z"
|
|
3741
|
+
})))));
|
|
3742
|
+
|
|
3706
3743
|
// return a array of options
|
|
3707
3744
|
var staticOptionsData = optionsRes;
|
|
3745
|
+
var hasDefaultOptions = staticOptionsData.length > 0;
|
|
3708
3746
|
|
|
3709
3747
|
//
|
|
3710
|
-
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(staticOptionsData),
|
|
3711
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
3712
|
-
orginalData = _useState2[0],
|
|
3713
|
-
setOrginalData = _useState2[1];
|
|
3714
3748
|
var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(staticOptionsData),
|
|
3715
3749
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(
|
|
3750
|
+
orginalData = _useState4[0],
|
|
3751
|
+
setOrginalData = _useState4[1];
|
|
3752
|
+
var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(staticOptionsData),
|
|
3719
3753
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
3720
|
-
|
|
3721
|
-
|
|
3754
|
+
optionsData = _useState6[0],
|
|
3755
|
+
setOptionsData = _useState6[1];
|
|
3756
|
+
var _useState7 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
3757
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
3758
|
+
hasErr = _useState8[0],
|
|
3759
|
+
setHasErr = _useState8[1];
|
|
3722
3760
|
|
|
3723
3761
|
// Set the final result
|
|
3724
|
-
var _useState7 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(''),
|
|
3725
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
3726
|
-
controlLabel = _useState8[0],
|
|
3727
|
-
setControlLabel = _useState8[1];
|
|
3728
3762
|
var _useState9 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(''),
|
|
3729
3763
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
3730
|
-
|
|
3731
|
-
|
|
3764
|
+
controlLabel = _useState10[0],
|
|
3765
|
+
setControlLabel = _useState10[1];
|
|
3766
|
+
var _useState11 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(''),
|
|
3767
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
3768
|
+
controlValue = _useState12[0],
|
|
3769
|
+
setControlValue = _useState12[1];
|
|
3732
3770
|
|
|
3733
3771
|
//
|
|
3734
|
-
var
|
|
3735
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
3736
|
-
controlTempValue = _useState12[0],
|
|
3737
|
-
setControlTempValue = _useState12[1]; // Storage for temporary input
|
|
3738
|
-
var _useState13 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
3772
|
+
var _useState13 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null),
|
|
3739
3773
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
var _useState15 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(
|
|
3774
|
+
controlTempValue = _useState14[0],
|
|
3775
|
+
setControlTempValue = _useState14[1]; // Storage for temporary input
|
|
3776
|
+
var _useState15 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
3743
3777
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
var _useState17 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(
|
|
3778
|
+
isOpen = _useState16[0],
|
|
3779
|
+
setIsOpen = _useState16[1];
|
|
3780
|
+
var _useState17 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null),
|
|
3747
3781
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
3748
|
-
|
|
3749
|
-
|
|
3782
|
+
incomingData = _useState18[0],
|
|
3783
|
+
setIncomingData = _useState18[1];
|
|
3750
3784
|
var _useState19 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
3751
3785
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
3752
|
-
|
|
3753
|
-
|
|
3786
|
+
firstRequestExecuted = _useState20[0],
|
|
3787
|
+
setFirstRequestExecuted = _useState20[1];
|
|
3788
|
+
var _useState21 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
3789
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
3790
|
+
handleFirstFetchCompleted = _useState22[0],
|
|
3791
|
+
setHandleFirstFetchCompleted = _useState22[1];
|
|
3754
3792
|
|
|
3755
3793
|
// Mark whether it is out of focus
|
|
3756
3794
|
// Fixed the issue that caused the pop-up window to still display due to
|
|
@@ -3758,25 +3796,25 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
3758
3796
|
var isBlurringRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);
|
|
3759
3797
|
|
|
3760
3798
|
// filter status
|
|
3761
|
-
var
|
|
3762
|
-
|
|
3763
|
-
filterItemsHasNoMatchData =
|
|
3764
|
-
setFilterItemsHasNoMatchData =
|
|
3799
|
+
var _useState23 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
3800
|
+
_useState24 = _slicedToArray(_useState23, 2),
|
|
3801
|
+
filterItemsHasNoMatchData = _useState24[0],
|
|
3802
|
+
setFilterItemsHasNoMatchData = _useState24[1];
|
|
3765
3803
|
|
|
3766
3804
|
// blinking cursor
|
|
3767
3805
|
var BLINKING_CURSOR_STR = '|';
|
|
3768
|
-
var
|
|
3769
|
-
|
|
3770
|
-
blinkingPosStart =
|
|
3771
|
-
setBlinkingPosStart =
|
|
3806
|
+
var _useState25 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
|
|
3807
|
+
_useState26 = _slicedToArray(_useState25, 2),
|
|
3808
|
+
blinkingPosStart = _useState26[0],
|
|
3809
|
+
setBlinkingPosStart = _useState26[1];
|
|
3772
3810
|
var blinkingPosFauxRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
3773
3811
|
var blinkingCursorPosDivRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
3774
3812
|
|
|
3775
3813
|
// Select All status (for "Single selection")
|
|
3776
|
-
var
|
|
3777
|
-
|
|
3778
|
-
userInputboxIsAllSelected =
|
|
3779
|
-
setUserInputboxIsAllSelected =
|
|
3814
|
+
var _useState27 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
3815
|
+
_useState28 = _slicedToArray(_useState27, 2),
|
|
3816
|
+
userInputboxIsAllSelected = _useState28[0],
|
|
3817
|
+
setUserInputboxIsAllSelected = _useState28[1];
|
|
3780
3818
|
var selectedSign = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);
|
|
3781
3819
|
var MULTI_SEL_VALID = multiSelect ? multiSelect.valid : false;
|
|
3782
3820
|
var MULTI_SEL_ENTIRE_AREA_TRIGGER = typeof multiSelectEntireAreaTrigger === 'undefined' ? true : multiSelectEntireAreaTrigger;
|
|
@@ -3787,13 +3825,13 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
3787
3825
|
allItemsLabel: 'All Content ({num})',
|
|
3788
3826
|
noneLabel: 'No items selected'
|
|
3789
3827
|
};
|
|
3790
|
-
var
|
|
3828
|
+
var _useState29 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({
|
|
3791
3829
|
labels: [],
|
|
3792
3830
|
values: []
|
|
3793
3831
|
}),
|
|
3794
|
-
|
|
3795
|
-
controlArr =
|
|
3796
|
-
setControlArr =
|
|
3832
|
+
_useState30 = _slicedToArray(_useState29, 2),
|
|
3833
|
+
controlArr = _useState30[0],
|
|
3834
|
+
setControlArr = _useState30[1];
|
|
3797
3835
|
|
|
3798
3836
|
// Only single symbols such as , #, and @ are allowed, and , a, a, , etc. are not allowed.
|
|
3799
3837
|
var isSingleSpecialChar = function isSingleSpecialChar(str) {
|
|
@@ -3943,6 +3981,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
3943
3981
|
|
|
3944
3982
|
//performance
|
|
3945
3983
|
var handleChangeFetchSafe = useDebounce_default()(function (val) {
|
|
3984
|
+
setFetchLoading(true);
|
|
3946
3985
|
if (fetchUpdate) {
|
|
3947
3986
|
// update filter status
|
|
3948
3987
|
setFilterItemsHasNoMatchData(false);
|
|
@@ -3954,6 +3993,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
3954
3993
|
popwinPosInit();
|
|
3955
3994
|
popwinFilterItems(val);
|
|
3956
3995
|
}, 0);
|
|
3996
|
+
setFetchLoading(false);
|
|
3957
3997
|
});
|
|
3958
3998
|
} else {
|
|
3959
3999
|
// pop win initalization
|
|
@@ -3961,6 +4001,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
3961
4001
|
popwinPosInit();
|
|
3962
4002
|
popwinFilterItems(val);
|
|
3963
4003
|
}, 0);
|
|
4004
|
+
setFetchLoading(false);
|
|
3964
4005
|
}
|
|
3965
4006
|
}, 350, [optionsData]);
|
|
3966
4007
|
function fetchData(_x2, _x3, _x4) {
|
|
@@ -4517,10 +4558,9 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
4517
4558
|
setIsOpen(false);
|
|
4518
4559
|
if (!MULTI_SEL_VALID) popwinPosHide();
|
|
4519
4560
|
if (MANUAL_REQ) {
|
|
4520
|
-
//
|
|
4521
|
-
setOptionsData(
|
|
4561
|
+
// restore to static data
|
|
4562
|
+
setOptionsData(staticOptionsData);
|
|
4522
4563
|
} else {
|
|
4523
|
-
// restore data
|
|
4524
4564
|
setOptionsData(orginalData);
|
|
4525
4565
|
}
|
|
4526
4566
|
|
|
@@ -4576,8 +4616,8 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
4576
4616
|
}, 500);
|
|
4577
4617
|
}
|
|
4578
4618
|
if (MANUAL_REQ) {
|
|
4579
|
-
//
|
|
4580
|
-
setOptionsData(
|
|
4619
|
+
// display static data
|
|
4620
|
+
setOptionsData(staticOptionsData);
|
|
4581
4621
|
} else {
|
|
4582
4622
|
// restore data
|
|
4583
4623
|
setOptionsData(orginalData);
|
|
@@ -4589,7 +4629,8 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
4589
4629
|
}
|
|
4590
4630
|
|
|
4591
4631
|
// Every time the input changes or the search button is clicked, a data request will be triggered
|
|
4592
|
-
|
|
4632
|
+
// !!! If the default data is empty, the pop-up window is not displayed
|
|
4633
|
+
if (MANUAL_REQ && (controlTempValue === '' || controlTempValue === null) && !hasDefaultOptions) {
|
|
4593
4634
|
setTimeout(function () {
|
|
4594
4635
|
popwinPosHide();
|
|
4595
4636
|
}, 0);
|
|
@@ -5098,18 +5139,21 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
5098
5139
|
while (1) switch (_context6.prev = _context6.next) {
|
|
5099
5140
|
case 0:
|
|
5100
5141
|
inputVal = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : null;
|
|
5142
|
+
setFetchLoading(true);
|
|
5143
|
+
|
|
5101
5144
|
// data init
|
|
5102
5145
|
searchStr = typeof inputVal === 'string' ? inputVal : controlTempValue || controlTempValue === '' ? controlTempValue : '';
|
|
5103
5146
|
_oparams = fetchFuncMethodParams || [];
|
|
5104
5147
|
_params = _oparams.map(function (item) {
|
|
5105
5148
|
return item !== '$QUERY_STRING' ? item : searchStr;
|
|
5106
5149
|
});
|
|
5107
|
-
_context6.next =
|
|
5150
|
+
_context6.next = 7;
|
|
5108
5151
|
return fetchData(_params.join(','), '', '', false);
|
|
5109
|
-
case
|
|
5152
|
+
case 7:
|
|
5110
5153
|
res = _context6.sent;
|
|
5154
|
+
setFetchLoading(false);
|
|
5111
5155
|
return _context6.abrupt("return", res);
|
|
5112
|
-
case
|
|
5156
|
+
case 10:
|
|
5113
5157
|
case "end":
|
|
5114
5158
|
return _context6.stop();
|
|
5115
5159
|
}
|
|
@@ -5904,7 +5948,15 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
5904
5948
|
__html: "".concat(CLEAR_TRIGGER_LABEL)
|
|
5905
5949
|
},
|
|
5906
5950
|
onClick: handleClearValue
|
|
5907
|
-
}))) : null) : null,
|
|
5951
|
+
}))) : null) : null, fetchLoading && MANUAL_REQ && hasDefaultOptions ?
|
|
5952
|
+
/*#__PURE__*/
|
|
5953
|
+
// only loading
|
|
5954
|
+
external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
|
|
5955
|
+
tabIndex: -1,
|
|
5956
|
+
type: "button",
|
|
5957
|
+
className: "list-group-item list-group-item-action no-match border-0 custom-select-multi__control-option-item--nomatch",
|
|
5958
|
+
disabled: true
|
|
5959
|
+
}, loadingOutput)) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
|
|
5908
5960
|
tabIndex: -1,
|
|
5909
5961
|
type: "button",
|
|
5910
5962
|
className: "list-group-item list-group-item-action no-match border-0 custom-select-multi__control-option-item--nomatch hide",
|
|
@@ -5913,37 +5965,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
5913
5965
|
// (1) Handling async data with the click event
|
|
5914
5966
|
!FIRST_REQUEST_AUTO && !handleFirstFetchCompleted ||
|
|
5915
5967
|
// (2) Every time the input changes or the search button is clicked, a data request will be triggered
|
|
5916
|
-
fetchUpdate && !filterItemsHasNoMatchData && controlTempValue !== '' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(
|
|
5917
|
-
className: "cus-select-loader"
|
|
5918
|
-
}, loader || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
|
|
5919
|
-
height: "12px",
|
|
5920
|
-
width: "12px",
|
|
5921
|
-
viewBox: "0 0 512 512"
|
|
5922
|
-
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("g", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
5923
|
-
fill: "inherit",
|
|
5924
|
-
d: "M256,0c-23.357,0-42.297,18.932-42.297,42.288c0,23.358,18.94,42.288,42.297,42.288c23.357,0,42.279-18.93,42.279-42.288C298.279,18.932,279.357,0,256,0z"
|
|
5925
|
-
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
5926
|
-
fill: "inherit",
|
|
5927
|
-
d: "M256,427.424c-23.357,0-42.297,18.931-42.297,42.288C213.703,493.07,232.643,512,256,512c23.357,0,42.279-18.93,42.279-42.288C298.279,446.355,279.357,427.424,256,427.424z"
|
|
5928
|
-
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
5929
|
-
fill: "inherit",
|
|
5930
|
-
d: "M74.974,74.983c-16.52,16.511-16.52,43.286,0,59.806c16.52,16.52,43.287,16.52,59.806,0c16.52-16.511,16.52-43.286,0-59.806C118.261,58.463,91.494,58.463,74.974,74.983z"
|
|
5931
|
-
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
5932
|
-
fill: "inherit",
|
|
5933
|
-
d: "M377.203,377.211c-16.503,16.52-16.503,43.296,0,59.815c16.519,16.52,43.304,16.52,59.806,0c16.52-16.51,16.52-43.295,0-59.815C420.489,360.692,393.722,360.7,377.203,377.211z"
|
|
5934
|
-
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
5935
|
-
fill: "inherit",
|
|
5936
|
-
d: "M84.567,256c0.018-23.348-18.922-42.279-42.279-42.279c-23.357-0.009-42.297,18.932-42.279,42.288c-0.018,23.348,18.904,42.279,42.279,42.279C65.645,298.288,84.567,279.358,84.567,256z"
|
|
5937
|
-
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
5938
|
-
fill: "inherit",
|
|
5939
|
-
d: "M469.712,213.712c-23.357,0-42.279,18.941-42.297,42.288c0,23.358,18.94,42.288,42.297,42.297c23.357,0,42.297-18.94,42.279-42.297C512.009,232.652,493.069,213.712,469.712,213.712z"
|
|
5940
|
-
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
5941
|
-
fill: "inherit",
|
|
5942
|
-
d: "M74.991,377.22c-16.519,16.511-16.519,43.296,0,59.806c16.503,16.52,43.27,16.52,59.789,0c16.52-16.519,16.52-43.295,0-59.815C118.278,360.692,91.511,360.692,74.991,377.22z"
|
|
5943
|
-
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
5944
|
-
fill: "inherit",
|
|
5945
|
-
d: "M437.026,134.798c16.52-16.52,16.52-43.304,0-59.824c-16.519-16.511-43.304-16.52-59.823,0c-16.52,16.52-16.503,43.295,0,59.815C393.722,151.309,420.507,151.309,437.026,134.798z"
|
|
5946
|
-
}))))) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, fetchNoneInfo)), optionsData ? optionsData.map(function (item, index) {
|
|
5968
|
+
fetchUpdate && !filterItemsHasNoMatchData && controlTempValue !== '' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, loadingOutput) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, fetchNoneInfo)), optionsData ? optionsData.map(function (item, index) {
|
|
5947
5969
|
var startItemBorder = index === 0 ? 'border-top-0' : '';
|
|
5948
5970
|
var endItemBorder = index === optionsData.length - 1 ? 'border-bottom-0' : '';
|
|
5949
5971
|
|
|
@@ -6047,7 +6069,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
6047
6069
|
}
|
|
6048
6070
|
})));
|
|
6049
6071
|
}
|
|
6050
|
-
}) : null))))) : null));
|
|
6072
|
+
}) : null)))))) : null));
|
|
6051
6073
|
});
|
|
6052
6074
|
/* harmony default export */ const src = (Select);
|
|
6053
6075
|
})();
|
package/lib/esm/Select/index.tsx
CHANGED
|
@@ -269,8 +269,14 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
269
269
|
const keyboardSelectedItem = useRef<any>(null);
|
|
270
270
|
|
|
271
271
|
|
|
272
|
+
// loading
|
|
273
|
+
const [fetchLoading, setFetchLoading] = useState(false);
|
|
274
|
+
const loadingOutput = <><div className="cus-select-loader">{loader || <svg height="12px" width="12px" viewBox="0 0 512 512"><g><path fill="inherit" d="M256,0c-23.357,0-42.297,18.932-42.297,42.288c0,23.358,18.94,42.288,42.297,42.288c23.357,0,42.279-18.93,42.279-42.288C298.279,18.932,279.357,0,256,0z" /><path fill="inherit" d="M256,427.424c-23.357,0-42.297,18.931-42.297,42.288C213.703,493.07,232.643,512,256,512c23.357,0,42.279-18.93,42.279-42.288C298.279,446.355,279.357,427.424,256,427.424z" /><path fill="inherit" d="M74.974,74.983c-16.52,16.511-16.52,43.286,0,59.806c16.52,16.52,43.287,16.52,59.806,0c16.52-16.511,16.52-43.286,0-59.806C118.261,58.463,91.494,58.463,74.974,74.983z" /><path fill="inherit" d="M377.203,377.211c-16.503,16.52-16.503,43.296,0,59.815c16.519,16.52,43.304,16.52,59.806,0c16.52-16.51,16.52-43.295,0-59.815C420.489,360.692,393.722,360.7,377.203,377.211z" /><path fill="inherit" d="M84.567,256c0.018-23.348-18.922-42.279-42.279-42.279c-23.357-0.009-42.297,18.932-42.279,42.288c-0.018,23.348,18.904,42.279,42.279,42.279C65.645,298.288,84.567,279.358,84.567,256z" /><path fill="inherit" d="M469.712,213.712c-23.357,0-42.279,18.941-42.297,42.288c0,23.358,18.94,42.288,42.297,42.297c23.357,0,42.297-18.94,42.279-42.297C512.009,232.652,493.069,213.712,469.712,213.712z" /><path fill="inherit" d="M74.991,377.22c-16.519,16.511-16.519,43.296,0,59.806c16.503,16.52,43.27,16.52,59.789,0c16.52-16.519,16.52-43.295,0-59.815C118.278,360.692,91.511,360.692,74.991,377.22z" /><path fill="inherit" d="M437.026,134.798c16.52-16.52,16.52-43.304,0-59.824c-16.519-16.511-43.304-16.52-59.823,0c-16.52,16.52-16.503,43.295,0,59.815C393.722,151.309,420.507,151.309,437.026,134.798z" /></g></svg>}</div></>;
|
|
275
|
+
|
|
276
|
+
|
|
272
277
|
// return a array of options
|
|
273
278
|
let staticOptionsData: OptionConfig[] = optionsRes;
|
|
279
|
+
const hasDefaultOptions = staticOptionsData.length > 0;
|
|
274
280
|
|
|
275
281
|
//
|
|
276
282
|
const [orginalData, setOrginalData] = useState<OptionConfig[]>(staticOptionsData);
|
|
@@ -481,6 +487,8 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
481
487
|
//performance
|
|
482
488
|
const handleChangeFetchSafe = useDebounce((val: any) => {
|
|
483
489
|
|
|
490
|
+
setFetchLoading(true);
|
|
491
|
+
|
|
484
492
|
if (fetchUpdate) {
|
|
485
493
|
|
|
486
494
|
// update filter status
|
|
@@ -495,6 +503,8 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
495
503
|
popwinPosInit();
|
|
496
504
|
popwinFilterItems(val);
|
|
497
505
|
}, 0);
|
|
506
|
+
|
|
507
|
+
setFetchLoading(false);
|
|
498
508
|
});
|
|
499
509
|
} else {
|
|
500
510
|
|
|
@@ -504,13 +514,13 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
504
514
|
popwinFilterItems(val);
|
|
505
515
|
}, 0);
|
|
506
516
|
|
|
517
|
+
setFetchLoading(false);
|
|
518
|
+
|
|
507
519
|
}
|
|
508
520
|
|
|
509
521
|
|
|
510
522
|
}, 350, [optionsData]);
|
|
511
523
|
|
|
512
|
-
|
|
513
|
-
|
|
514
524
|
async function fetchData(params: any, valueToInputDefault: any, inputDefault: any, init: boolean = true) {
|
|
515
525
|
|
|
516
526
|
|
|
@@ -1152,12 +1162,10 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1152
1162
|
setIsOpen(false);
|
|
1153
1163
|
if (!MULTI_SEL_VALID) popwinPosHide();
|
|
1154
1164
|
|
|
1155
|
-
|
|
1156
1165
|
if (MANUAL_REQ) {
|
|
1157
|
-
//
|
|
1158
|
-
setOptionsData(
|
|
1166
|
+
// restore to static data
|
|
1167
|
+
setOptionsData(staticOptionsData);
|
|
1159
1168
|
} else {
|
|
1160
|
-
// restore data
|
|
1161
1169
|
setOptionsData(orginalData);
|
|
1162
1170
|
}
|
|
1163
1171
|
|
|
@@ -1220,10 +1228,9 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1220
1228
|
|
|
1221
1229
|
}
|
|
1222
1230
|
|
|
1223
|
-
|
|
1224
1231
|
if (MANUAL_REQ) {
|
|
1225
|
-
//
|
|
1226
|
-
setOptionsData(
|
|
1232
|
+
// display static data
|
|
1233
|
+
setOptionsData(staticOptionsData);
|
|
1227
1234
|
} else {
|
|
1228
1235
|
// restore data
|
|
1229
1236
|
setOptionsData(orginalData);
|
|
@@ -1237,7 +1244,8 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1237
1244
|
|
|
1238
1245
|
|
|
1239
1246
|
// Every time the input changes or the search button is clicked, a data request will be triggered
|
|
1240
|
-
|
|
1247
|
+
// !!! If the default data is empty, the pop-up window is not displayed
|
|
1248
|
+
if (MANUAL_REQ && (controlTempValue === '' || controlTempValue === null) && !hasDefaultOptions) {
|
|
1241
1249
|
setTimeout(() => {
|
|
1242
1250
|
popwinPosHide();
|
|
1243
1251
|
}, 0);
|
|
@@ -1715,7 +1723,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1715
1723
|
setControlTempValue(null);
|
|
1716
1724
|
|
|
1717
1725
|
// update filter status
|
|
1718
|
-
setFilterItemsHasNoMatchData(false);
|
|
1726
|
+
setFilterItemsHasNoMatchData(false);
|
|
1719
1727
|
|
|
1720
1728
|
}
|
|
1721
1729
|
|
|
@@ -1787,8 +1795,8 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1787
1795
|
|
|
1788
1796
|
}
|
|
1789
1797
|
|
|
1790
|
-
|
|
1791
1798
|
async function handleFetch(inputVal: any = null) {
|
|
1799
|
+
setFetchLoading(true);
|
|
1792
1800
|
|
|
1793
1801
|
// data init
|
|
1794
1802
|
const searchStr: string = typeof inputVal === 'string' ? inputVal : (controlTempValue || controlTempValue === '' ? controlTempValue : '');
|
|
@@ -1798,6 +1806,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1798
1806
|
|
|
1799
1807
|
const res = await fetchData((_params).join(','), '', '', false);
|
|
1800
1808
|
|
|
1809
|
+
setFetchLoading(false);
|
|
1801
1810
|
|
|
1802
1811
|
return res;
|
|
1803
1812
|
}
|
|
@@ -2801,161 +2810,169 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
2801
2810
|
{/* /CLEAR BUTTON (Only Single selection) */}
|
|
2802
2811
|
|
|
2803
2812
|
|
|
2804
|
-
{/* NO MATCH & LOADER */}
|
|
2805
|
-
<button tabIndex={-1} type="button" className="list-group-item list-group-item-action no-match border-0 custom-select-multi__control-option-item--nomatch hide" disabled>
|
|
2806
|
-
{
|
|
2807
|
-
// (1) Handling async data with the click event
|
|
2808
|
-
(!FIRST_REQUEST_AUTO && !handleFirstFetchCompleted) ||
|
|
2809
|
-
|
|
2810
|
-
// (2) Every time the input changes or the search button is clicked, a data request will be triggered
|
|
2811
|
-
(fetchUpdate && !filterItemsHasNoMatchData && controlTempValue !== '')
|
|
2812
|
-
? <><div className="cus-select-loader">{loader || <svg height="12px" width="12px" viewBox="0 0 512 512"><g><path fill="inherit" d="M256,0c-23.357,0-42.297,18.932-42.297,42.288c0,23.358,18.94,42.288,42.297,42.288c23.357,0,42.279-18.93,42.279-42.288C298.279,18.932,279.357,0,256,0z" /><path fill="inherit" d="M256,427.424c-23.357,0-42.297,18.931-42.297,42.288C213.703,493.07,232.643,512,256,512c23.357,0,42.279-18.93,42.279-42.288C298.279,446.355,279.357,427.424,256,427.424z" /><path fill="inherit" d="M74.974,74.983c-16.52,16.511-16.52,43.286,0,59.806c16.52,16.52,43.287,16.52,59.806,0c16.52-16.511,16.52-43.286,0-59.806C118.261,58.463,91.494,58.463,74.974,74.983z" /><path fill="inherit" d="M377.203,377.211c-16.503,16.52-16.503,43.296,0,59.815c16.519,16.52,43.304,16.52,59.806,0c16.52-16.51,16.52-43.295,0-59.815C420.489,360.692,393.722,360.7,377.203,377.211z" /><path fill="inherit" d="M84.567,256c0.018-23.348-18.922-42.279-42.279-42.279c-23.357-0.009-42.297,18.932-42.279,42.288c-0.018,23.348,18.904,42.279,42.279,42.279C65.645,298.288,84.567,279.358,84.567,256z" /><path fill="inherit" d="M469.712,213.712c-23.357,0-42.279,18.941-42.297,42.288c0,23.358,18.94,42.288,42.297,42.297c23.357,0,42.297-18.94,42.279-42.297C512.009,232.652,493.069,213.712,469.712,213.712z" /><path fill="inherit" d="M74.991,377.22c-16.519,16.511-16.519,43.296,0,59.806c16.503,16.52,43.27,16.52,59.789,0c16.52-16.519,16.52-43.295,0-59.815C118.278,360.692,91.511,360.692,74.991,377.22z" /><path fill="inherit" d="M437.026,134.798c16.52-16.52,16.52-43.304,0-59.824c-16.519-16.511-43.304-16.52-59.823,0c-16.52,16.52-16.503,43.295,0,59.815C393.722,151.309,420.507,151.309,437.026,134.798z" /></g></svg>}</div></> : <>{fetchNoneInfo}</>}
|
|
2813
|
-
</button>
|
|
2814
|
-
{/* /NO MATCH & LOADER */}
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
2813
|
|
|
2818
2814
|
{/* OPTIONS LIST */}
|
|
2819
|
-
{
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
if (!MULTI_SEL_VALID) {
|
|
2832
|
-
const _defaultValue = controlValue.toString();
|
|
2833
|
-
let filterRes: any = [];
|
|
2834
|
-
const filterResQueryValue = optionsData.filter((item: any) => item.value == _defaultValue);
|
|
2835
|
-
const filterResQueryLabel = optionsData.filter((item: any) => item.label == _defaultValue);
|
|
2836
|
-
|
|
2837
|
-
if (filterResQueryValue.length === 0 && filterResQueryLabel.length > 0) {
|
|
2838
|
-
filterRes = filterResQueryValue;
|
|
2839
|
-
if (filterResQueryValue.length === 0) filterRes = filterResQueryLabel;
|
|
2840
|
-
}
|
|
2841
|
-
|
|
2842
|
-
const _targetValue = filterRes.length > 0 ? filterRes[0].value : _defaultValue;
|
|
2843
|
-
const _realValue = item.value.toString();
|
|
2844
|
-
|
|
2845
|
-
if (_realValue === _targetValue && _targetValue !== '') {
|
|
2846
|
-
disabledCurrentOption = true;
|
|
2847
|
-
}
|
|
2848
|
-
}
|
|
2849
|
-
|
|
2850
|
-
}
|
|
2815
|
+
{fetchLoading && MANUAL_REQ && hasDefaultOptions ? (
|
|
2816
|
+
// only loading
|
|
2817
|
+
<><button tabIndex={-1} type="button" className="list-group-item list-group-item-action no-match border-0 custom-select-multi__control-option-item--nomatch" disabled>{loadingOutput}</button></>
|
|
2818
|
+
) : (
|
|
2819
|
+
<>
|
|
2820
|
+
|
|
2821
|
+
{/* NO MATCH & LOADER */}
|
|
2822
|
+
<button tabIndex={-1} type="button" className="list-group-item list-group-item-action no-match border-0 custom-select-multi__control-option-item--nomatch hide" disabled>
|
|
2823
|
+
{
|
|
2824
|
+
// (1) Handling async data with the click event
|
|
2825
|
+
(!FIRST_REQUEST_AUTO && !handleFirstFetchCompleted) ||
|
|
2851
2826
|
|
|
2827
|
+
// (2) Every time the input changes or the search button is clicked, a data request will be triggered
|
|
2828
|
+
(fetchUpdate && !filterItemsHasNoMatchData && controlTempValue !== '')
|
|
2829
|
+
? <>{loadingOutput}</> : <>{fetchNoneInfo}</>}
|
|
2830
|
+
</button>
|
|
2831
|
+
{/* /NO MATCH & LOADER */}
|
|
2852
2832
|
|
|
2853
2833
|
|
|
2854
|
-
|
|
2834
|
+
{optionsData ? optionsData.map((item, index) => {
|
|
2835
|
+
const startItemBorder = index === 0 ? 'border-top-0' : '';
|
|
2836
|
+
const endItemBorder = index === optionsData.length - 1 ? 'border-bottom-0' : '';
|
|
2855
2837
|
|
|
2856
|
-
// ++++++++++++++++++++
|
|
2857
|
-
// Single selection
|
|
2858
|
-
// ++++++++++++++++++++
|
|
2859
|
-
return <button
|
|
2860
|
-
tabIndex={-1}
|
|
2861
|
-
type="button"
|
|
2862
|
-
data-index={index}
|
|
2863
|
-
key={index}
|
|
2864
|
-
className={combinedCls(
|
|
2865
|
-
'list-group-item list-group-item-action border-start-0 border-end-0 custom-select-multi__control-option-item border-bottom-0',
|
|
2866
|
-
startItemBorder,
|
|
2867
|
-
endItemBorder,
|
|
2868
|
-
{
|
|
2869
|
-
'disabled': item.disabled,
|
|
2870
|
-
'active disabled': disabledCurrentOption,
|
|
2871
|
-
'custom-select-grouptitle': item.group
|
|
2872
|
-
}
|
|
2873
2838
|
|
|
2874
|
-
)
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
role="tab"
|
|
2881
|
-
onClick={handleSelect}
|
|
2882
|
-
>
|
|
2883
|
-
{typeof renderOption === 'function' ? <>
|
|
2884
|
-
{renderOption(item, index)}
|
|
2885
|
-
</> : <>
|
|
2886
|
-
<span dangerouslySetInnerHTML={{
|
|
2887
|
-
__html: typeof item.listItemLabel === 'undefined' ? item.label : item.listItemLabel
|
|
2888
|
-
}}></span>
|
|
2889
|
-
</>}
|
|
2890
|
-
</button>
|
|
2839
|
+
// disable selected options (only single selection)
|
|
2840
|
+
let disabledCurrentOption: boolean = false;
|
|
2841
|
+
if (
|
|
2842
|
+
(typeof controlValue !== 'undefined' && controlValue !== null && controlValue !== '') &&
|
|
2843
|
+
(typeof item.value !== 'undefined' && item.value !== null && item.value !== '')
|
|
2844
|
+
) {
|
|
2891
2845
|
|
|
2892
|
-
|
|
2846
|
+
if (!MULTI_SEL_VALID) {
|
|
2847
|
+
const _defaultValue = controlValue.toString();
|
|
2848
|
+
let filterRes: any = [];
|
|
2849
|
+
const filterResQueryValue = optionsData.filter((item: any) => item.value == _defaultValue);
|
|
2850
|
+
const filterResQueryLabel = optionsData.filter((item: any) => item.label == _defaultValue);
|
|
2893
2851
|
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2852
|
+
if (filterResQueryValue.length === 0 && filterResQueryLabel.length > 0) {
|
|
2853
|
+
filterRes = filterResQueryValue;
|
|
2854
|
+
if (filterResQueryValue.length === 0) filterRes = filterResQueryLabel;
|
|
2855
|
+
}
|
|
2898
2856
|
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
type="button"
|
|
2902
|
-
data-selected={`${itemSelected ? 'true' : 'false'}`}
|
|
2903
|
-
data-index={index}
|
|
2904
|
-
key={index}
|
|
2905
|
-
className={combinedCls(
|
|
2906
|
-
'list-group-item list-group-item-action border-start-0 border-end-0 custom-select-multi__control-option-item border-bottom-0',
|
|
2907
|
-
startItemBorder,
|
|
2908
|
-
endItemBorder,
|
|
2909
|
-
{
|
|
2910
|
-
'list-group-item-secondary item-selected': itemSelected,
|
|
2911
|
-
'disabled': item.disabled,
|
|
2912
|
-
'custom-select-grouptitle': item.group
|
|
2857
|
+
const _targetValue = filterRes.length > 0 ? filterRes[0].value : _defaultValue;
|
|
2858
|
+
const _realValue = item.value.toString();
|
|
2913
2859
|
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
data-label={`${item.label}`}
|
|
2918
|
-
data-querystring={`${typeof item.queryString === 'undefined' ? '' : item.queryString}`}
|
|
2919
|
-
data-list-item-label={`${typeof item.listItemLabel === 'undefined' ? '' : item.listItemLabel}`}
|
|
2920
|
-
data-itemdata={JSON.stringify(item)}
|
|
2921
|
-
role="tab"
|
|
2922
|
-
onClick={handleSelect}
|
|
2923
|
-
>
|
|
2924
|
-
<var className={combinedCls(
|
|
2925
|
-
'me-1 custom-select-multi__control-option-checkbox-selected',
|
|
2926
|
-
{
|
|
2927
|
-
'd-none': !itemSelected
|
|
2860
|
+
if (_realValue === _targetValue && _targetValue !== '') {
|
|
2861
|
+
disabledCurrentOption = true;
|
|
2862
|
+
}
|
|
2928
2863
|
}
|
|
2929
2864
|
|
|
2930
|
-
|
|
2931
|
-
<svg width="1.2em" height="1.2em" fill="#000000" viewBox="0 0 24 24"><path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" /></svg>
|
|
2865
|
+
}
|
|
2932
2866
|
|
|
2933
|
-
</var>
|
|
2934
|
-
|
|
2935
|
-
<var className={combinedCls(
|
|
2936
|
-
'me-1 custom-select-multi__control-option-checkbox-placeholder',
|
|
2937
|
-
{
|
|
2938
|
-
'd-none': itemSelected
|
|
2939
|
-
}
|
|
2940
|
-
)}>
|
|
2941
|
-
<svg width="1.2em" height="1.2em" fill="#000000" viewBox="0 0 24 24"><path d="M4 7.2002V16.8002C4 17.9203 4 18.4801 4.21799 18.9079C4.40973 19.2842 4.71547 19.5905 5.0918 19.7822C5.5192 20 6.07899 20 7.19691 20H16.8031C17.921 20 18.48 20 18.9074 19.7822C19.2837 19.5905 19.5905 19.2842 19.7822 18.9079C20 18.4805 20 17.9215 20 16.8036V7.19691C20 6.07899 20 5.5192 19.7822 5.0918C19.5905 4.71547 19.2837 4.40973 18.9074 4.21799C18.4796 4 17.9203 4 16.8002 4H7.2002C6.08009 4 5.51962 4 5.0918 4.21799C4.71547 4.40973 4.40973 4.71547 4.21799 5.0918C4 5.51962 4 6.08009 4 7.2002Z" /></svg>
|
|
2942
|
-
</var>
|
|
2943
|
-
|
|
2944
|
-
{typeof renderOption === 'function' ? <>
|
|
2945
|
-
{renderOption(item, index)}
|
|
2946
|
-
</> : <>
|
|
2947
|
-
<span dangerouslySetInnerHTML={{
|
|
2948
|
-
__html: typeof item.listItemLabel === 'undefined' ? item.label : item.listItemLabel
|
|
2949
|
-
}}></span>
|
|
2950
|
-
</>}
|
|
2951
2867
|
|
|
2952
2868
|
|
|
2953
|
-
|
|
2869
|
+
if (!MULTI_SEL_VALID) {
|
|
2870
|
+
|
|
2871
|
+
// ++++++++++++++++++++
|
|
2872
|
+
// Single selection
|
|
2873
|
+
// ++++++++++++++++++++
|
|
2874
|
+
return <button
|
|
2875
|
+
tabIndex={-1}
|
|
2876
|
+
type="button"
|
|
2877
|
+
data-index={index}
|
|
2878
|
+
key={index}
|
|
2879
|
+
className={combinedCls(
|
|
2880
|
+
'list-group-item list-group-item-action border-start-0 border-end-0 custom-select-multi__control-option-item border-bottom-0',
|
|
2881
|
+
startItemBorder,
|
|
2882
|
+
endItemBorder,
|
|
2883
|
+
{
|
|
2884
|
+
'disabled': item.disabled,
|
|
2885
|
+
'active disabled': disabledCurrentOption,
|
|
2886
|
+
'custom-select-grouptitle': item.group
|
|
2887
|
+
}
|
|
2888
|
+
|
|
2889
|
+
)}
|
|
2890
|
+
data-value={`${item.value}`}
|
|
2891
|
+
data-label={`${item.label}`}
|
|
2892
|
+
data-querystring={`${typeof item.queryString === 'undefined' ? '' : item.queryString}`}
|
|
2893
|
+
data-itemdata={JSON.stringify(item)}
|
|
2894
|
+
data-list-item-label={`${typeof item.listItemLabel === 'undefined' ? '' : item.listItemLabel}`}
|
|
2895
|
+
role="tab"
|
|
2896
|
+
onClick={handleSelect}
|
|
2897
|
+
>
|
|
2898
|
+
{typeof renderOption === 'function' ? <>
|
|
2899
|
+
{renderOption(item, index)}
|
|
2900
|
+
</> : <>
|
|
2901
|
+
<span dangerouslySetInnerHTML={{
|
|
2902
|
+
__html: typeof item.listItemLabel === 'undefined' ? item.label : item.listItemLabel
|
|
2903
|
+
}}></span>
|
|
2904
|
+
</>}
|
|
2905
|
+
</button>
|
|
2906
|
+
|
|
2907
|
+
} else {
|
|
2908
|
+
|
|
2909
|
+
// ++++++++++++++++++++
|
|
2910
|
+
// Multiple selection
|
|
2911
|
+
// ++++++++++++++++++++
|
|
2912
|
+
const itemSelected = multiSelControlOptionExist(controlArr.values, item.value) ? true : false;
|
|
2913
|
+
|
|
2914
|
+
return <button
|
|
2915
|
+
tabIndex={-1}
|
|
2916
|
+
type="button"
|
|
2917
|
+
data-selected={`${itemSelected ? 'true' : 'false'}`}
|
|
2918
|
+
data-index={index}
|
|
2919
|
+
key={index}
|
|
2920
|
+
className={combinedCls(
|
|
2921
|
+
'list-group-item list-group-item-action border-start-0 border-end-0 custom-select-multi__control-option-item border-bottom-0',
|
|
2922
|
+
startItemBorder,
|
|
2923
|
+
endItemBorder,
|
|
2924
|
+
{
|
|
2925
|
+
'list-group-item-secondary item-selected': itemSelected,
|
|
2926
|
+
'disabled': item.disabled,
|
|
2927
|
+
'custom-select-grouptitle': item.group
|
|
2928
|
+
|
|
2929
|
+
}
|
|
2930
|
+
)}
|
|
2931
|
+
data-value={`${item.value}`}
|
|
2932
|
+
data-label={`${item.label}`}
|
|
2933
|
+
data-querystring={`${typeof item.queryString === 'undefined' ? '' : item.queryString}`}
|
|
2934
|
+
data-list-item-label={`${typeof item.listItemLabel === 'undefined' ? '' : item.listItemLabel}`}
|
|
2935
|
+
data-itemdata={JSON.stringify(item)}
|
|
2936
|
+
role="tab"
|
|
2937
|
+
onClick={handleSelect}
|
|
2938
|
+
>
|
|
2939
|
+
<var className={combinedCls(
|
|
2940
|
+
'me-1 custom-select-multi__control-option-checkbox-selected',
|
|
2941
|
+
{
|
|
2942
|
+
'd-none': !itemSelected
|
|
2943
|
+
}
|
|
2944
|
+
|
|
2945
|
+
)}>
|
|
2946
|
+
<svg width="1.2em" height="1.2em" fill="#000000" viewBox="0 0 24 24"><path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" /></svg>
|
|
2947
|
+
|
|
2948
|
+
</var>
|
|
2949
|
+
|
|
2950
|
+
<var className={combinedCls(
|
|
2951
|
+
'me-1 custom-select-multi__control-option-checkbox-placeholder',
|
|
2952
|
+
{
|
|
2953
|
+
'd-none': itemSelected
|
|
2954
|
+
}
|
|
2955
|
+
)}>
|
|
2956
|
+
<svg width="1.2em" height="1.2em" fill="#000000" viewBox="0 0 24 24"><path d="M4 7.2002V16.8002C4 17.9203 4 18.4801 4.21799 18.9079C4.40973 19.2842 4.71547 19.5905 5.0918 19.7822C5.5192 20 6.07899 20 7.19691 20H16.8031C17.921 20 18.48 20 18.9074 19.7822C19.2837 19.5905 19.5905 19.2842 19.7822 18.9079C20 18.4805 20 17.9215 20 16.8036V7.19691C20 6.07899 20 5.5192 19.7822 5.0918C19.5905 4.71547 19.2837 4.40973 18.9074 4.21799C18.4796 4 17.9203 4 16.8002 4H7.2002C6.08009 4 5.51962 4 5.0918 4.21799C4.71547 4.40973 4.40973 4.71547 4.21799 5.0918C4 5.51962 4 6.08009 4 7.2002Z" /></svg>
|
|
2957
|
+
</var>
|
|
2958
|
+
|
|
2959
|
+
{typeof renderOption === 'function' ? <>
|
|
2960
|
+
{renderOption(item, index)}
|
|
2961
|
+
</> : <>
|
|
2962
|
+
<span dangerouslySetInnerHTML={{
|
|
2963
|
+
__html: typeof item.listItemLabel === 'undefined' ? item.label : item.listItemLabel
|
|
2964
|
+
}}></span>
|
|
2965
|
+
</>}
|
|
2966
|
+
|
|
2967
|
+
|
|
2968
|
+
</button>
|
|
2954
2969
|
|
|
2955
|
-
|
|
2970
|
+
}
|
|
2956
2971
|
|
|
2957
2972
|
|
|
2958
|
-
|
|
2973
|
+
}) : null}
|
|
2974
|
+
</>
|
|
2975
|
+
)}
|
|
2959
2976
|
{/* /OPTIONS LIST */}
|
|
2960
2977
|
|
|
2961
2978
|
</div>
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"author": "UIUX Lab",
|
|
3
3
|
"email": "uiuxlab@gmail.com",
|
|
4
4
|
"name": "funda-ui",
|
|
5
|
-
"version": "4.7.
|
|
5
|
+
"version": "4.7.517",
|
|
6
6
|
"description": "React components using pure Bootstrap 5+ which does not contain any external style and script libraries.",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|