funda-ui 4.7.155 → 4.7.163
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/LiveSearch/index.css +33 -0
- package/LiveSearch/index.d.ts +1 -0
- package/LiveSearch/index.js +173 -85
- package/Select/index.js +149 -126
- package/lib/cjs/LiveSearch/index.d.ts +1 -0
- package/lib/cjs/LiveSearch/index.js +173 -85
- package/lib/cjs/Select/index.js +149 -126
- package/lib/css/LiveSearch/index.css +33 -0
- package/lib/esm/LiveSearch/index.scss +47 -0
- package/lib/esm/LiveSearch/index.tsx +120 -64
- package/lib/esm/SearchBar/index.tsx +1 -0
- package/lib/esm/Select/index.tsx +141 -123
- package/package.json +1 -1
package/LiveSearch/index.css
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
<!-- Live Search -->
|
|
3
3
|
/* ====================================================== */
|
|
4
4
|
.livesearch__wrapper {
|
|
5
|
+
position: relative;
|
|
5
6
|
/*------ Search button ------*/
|
|
7
|
+
/*------ Loader ------*/
|
|
6
8
|
}
|
|
7
9
|
.livesearch__wrapper .livesearch__wrapper-searchbtn {
|
|
8
10
|
position: absolute;
|
|
@@ -12,6 +14,35 @@
|
|
|
12
14
|
z-index: 5;
|
|
13
15
|
pointer-events: auto;
|
|
14
16
|
}
|
|
17
|
+
.livesearch__wrapper .livesearch-loader {
|
|
18
|
+
position: absolute;
|
|
19
|
+
right: 0;
|
|
20
|
+
top: 50%;
|
|
21
|
+
margin-top: -6px;
|
|
22
|
+
pointer-events: none;
|
|
23
|
+
pointer-events: none;
|
|
24
|
+
z-index: 5;
|
|
25
|
+
width: 12px;
|
|
26
|
+
height: 12px;
|
|
27
|
+
text-align: center;
|
|
28
|
+
transform-origin: center;
|
|
29
|
+
transform: translate(-5px, 0) rotate(0);
|
|
30
|
+
animation: 1s linear infinite livesearch__spinner;
|
|
31
|
+
}
|
|
32
|
+
.livesearch__wrapper .livesearch-loader.pos-offset {
|
|
33
|
+
right: 2rem;
|
|
34
|
+
}
|
|
35
|
+
.livesearch__wrapper .livesearch-loader svg {
|
|
36
|
+
vertical-align: top;
|
|
37
|
+
}
|
|
38
|
+
.livesearch__wrapper .livesearch-loader svg path {
|
|
39
|
+
fill: var(--cus-sel-loader-color);
|
|
40
|
+
}
|
|
41
|
+
@keyframes livesearch__spinner {
|
|
42
|
+
to {
|
|
43
|
+
transform: translate(-5px, 0) rotate(-360deg);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
15
46
|
|
|
16
47
|
/*------ List ------*/
|
|
17
48
|
.livesearch__options-wrapper {
|
|
@@ -23,6 +54,7 @@
|
|
|
23
54
|
display: none;
|
|
24
55
|
min-width: var(--livesearch-listgroup-popwin-min-width);
|
|
25
56
|
z-index: 1055; /* --bs-modal-zindex */
|
|
57
|
+
/*------ Options ------*/
|
|
26
58
|
}
|
|
27
59
|
.livesearch__options-wrapper.active {
|
|
28
60
|
display: block !important;
|
|
@@ -30,6 +62,7 @@
|
|
|
30
62
|
.livesearch__options-wrapper .livesearch__options-contentlist {
|
|
31
63
|
overflow: hidden;
|
|
32
64
|
overflow-y: auto;
|
|
65
|
+
background-color: var(--bs-list-group-bg);
|
|
33
66
|
}
|
|
34
67
|
.livesearch__options-wrapper .livesearch__options-contentlist.noscroll {
|
|
35
68
|
overflow-y: hidden;
|
package/LiveSearch/index.d.ts
CHANGED
package/LiveSearch/index.js
CHANGED
|
@@ -2752,7 +2752,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2752
2752
|
/* harmony import */ var funda_utils_dist_cjs_getElementProperty__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(funda_utils_dist_cjs_getElementProperty__WEBPACK_IMPORTED_MODULE_8__);
|
|
2753
2753
|
/* harmony import */ var funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(188);
|
|
2754
2754
|
/* harmony import */ var funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_9__);
|
|
2755
|
-
var _excluded = ["contentRef", "popupRef", "wrapperClassName", "controlClassName", "controlExClassName", "optionsExClassName", "controlGroupWrapperClassName", "controlGroupTextClassName", "exceededSidePosOffset", "appearance", "isSearchInput", "allowSpacingRetrive", "readOnly", "disabled", "required", "placeholder", "noMatchPopup", "options", "value", "label", "name", "units", "iconLeft", "iconRight", "minLength", "maxLength", "id", "autoComplete", "autoCapitalize", "spellCheck", "icon", "btnId", "fetchTrigger", "hideIcon", "depth", "style", "winWidth", "tabIndex", "data", "autoShowOptions", "fetchNoneInfo", "fetchUpdate", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "fetchCallback", "onClick", "onFetch", "onChange", "onKeyboardInput", "onBlur", "onPressEnter"];
|
|
2755
|
+
var _excluded = ["contentRef", "popupRef", "wrapperClassName", "controlClassName", "controlExClassName", "optionsExClassName", "controlGroupWrapperClassName", "controlGroupTextClassName", "exceededSidePosOffset", "appearance", "isSearchInput", "allowSpacingRetrive", "loader", "readOnly", "disabled", "required", "placeholder", "noMatchPopup", "options", "value", "label", "name", "units", "iconLeft", "iconRight", "minLength", "maxLength", "id", "autoComplete", "autoCapitalize", "spellCheck", "icon", "btnId", "fetchTrigger", "hideIcon", "depth", "style", "winWidth", "tabIndex", "data", "autoShowOptions", "fetchNoneInfo", "fetchUpdate", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "fetchCallback", "onClick", "onFetch", "onChange", "onKeyboardInput", "onBlur", "onPressEnter"];
|
|
2756
2756
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2757
2757
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
2758
2758
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
@@ -2793,6 +2793,7 @@ var LiveSearch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(
|
|
|
2793
2793
|
appearance = props.appearance,
|
|
2794
2794
|
isSearchInput = props.isSearchInput,
|
|
2795
2795
|
allowSpacingRetrive = props.allowSpacingRetrive,
|
|
2796
|
+
loader = props.loader,
|
|
2796
2797
|
readOnly = props.readOnly,
|
|
2797
2798
|
disabled = props.disabled,
|
|
2798
2799
|
required = props.required,
|
|
@@ -2821,7 +2822,8 @@ var LiveSearch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(
|
|
|
2821
2822
|
tabIndex = props.tabIndex,
|
|
2822
2823
|
data = props.data,
|
|
2823
2824
|
autoShowOptions = props.autoShowOptions,
|
|
2824
|
-
fetchNoneInfo = props.fetchNoneInfo,
|
|
2825
|
+
_props$fetchNoneInfo = props.fetchNoneInfo,
|
|
2826
|
+
fetchNoneInfo = _props$fetchNoneInfo === void 0 ? 'No match yet' : _props$fetchNoneInfo,
|
|
2825
2827
|
fetchUpdate = props.fetchUpdate,
|
|
2826
2828
|
fetchFuncAsync = props.fetchFuncAsync,
|
|
2827
2829
|
fetchFuncMethod = props.fetchFuncMethod,
|
|
@@ -2838,7 +2840,9 @@ var LiveSearch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(
|
|
|
2838
2840
|
var DEPTH = depth || 1055; // the default value same as bootstrap
|
|
2839
2841
|
var POS_OFFSET = 0;
|
|
2840
2842
|
var EXCEEDED_SIDE_POS_OFFSET = Number(exceededSidePosOffset) || 15;
|
|
2841
|
-
var
|
|
2843
|
+
var AUTO_SHOW_OPTIONS = typeof autoShowOptions !== 'undefined' && autoShowOptions === true ? true : false;
|
|
2844
|
+
var MANUAL_REQ = typeof fetchTrigger !== 'undefined' && fetchTrigger === true ? true : false; // Manual requests
|
|
2845
|
+
|
|
2842
2846
|
var NO_MATCH_POPUP = typeof noMatchPopup === 'undefined' ? true : noMatchPopup;
|
|
2843
2847
|
var WIN_WIDTH = typeof winWidth === 'function' ? winWidth() : winWidth ? winWidth : 'auto';
|
|
2844
2848
|
var uniqueID = funda_utils_dist_cjs_useComId__WEBPACK_IMPORTED_MODULE_3___default()();
|
|
@@ -2853,34 +2857,47 @@ var LiveSearch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(
|
|
|
2853
2857
|
var staticOptionsData = optionsRes;
|
|
2854
2858
|
|
|
2855
2859
|
//
|
|
2856
|
-
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(
|
|
2860
|
+
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null),
|
|
2857
2861
|
_useState2 = _slicedToArray(_useState, 2),
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(
|
|
2862
|
+
controlTempValue = _useState2[0],
|
|
2863
|
+
setControlTempValue = _useState2[1]; // Storage for temporary input
|
|
2864
|
+
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
|
|
2861
2865
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(
|
|
2866
|
+
firstFetch = _useState4[0],
|
|
2867
|
+
setFirstFetch = _useState4[1];
|
|
2868
|
+
var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(staticOptionsData),
|
|
2865
2869
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
var _useState7 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(
|
|
2870
|
+
dataInit = _useState6[0],
|
|
2871
|
+
setOrginalDataInit = _useState6[1];
|
|
2872
|
+
var _useState7 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]),
|
|
2869
2873
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
var _useState9 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(
|
|
2874
|
+
orginalData = _useState8[0],
|
|
2875
|
+
setOrginalData = _useState8[1];
|
|
2876
|
+
var _useState9 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(value || ''),
|
|
2873
2877
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
2874
|
-
|
|
2875
|
-
|
|
2878
|
+
changedVal = _useState10[0],
|
|
2879
|
+
setChangedVal = _useState10[1];
|
|
2876
2880
|
var _useState11 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
|
|
2877
2881
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
2878
|
-
|
|
2879
|
-
|
|
2882
|
+
isOpen = _useState12[0],
|
|
2883
|
+
setIsOpen = _useState12[1];
|
|
2880
2884
|
var _useState13 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
|
|
2881
2885
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
2882
|
-
|
|
2883
|
-
|
|
2886
|
+
hasErr = _useState14[0],
|
|
2887
|
+
setHasErr = _useState14[1];
|
|
2888
|
+
var _useState15 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
|
|
2889
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
2890
|
+
componentFirstLoad = _useState16[0],
|
|
2891
|
+
setComponentFirstLoad = _useState16[1];
|
|
2892
|
+
var _useState17 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
|
|
2893
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
2894
|
+
reqProgress = _useState18[0],
|
|
2895
|
+
setReqProgress = _useState18[1];
|
|
2896
|
+
|
|
2897
|
+
// Mark whether it is out of focus
|
|
2898
|
+
// Fixed the issue that caused the pop-up window to still display due to
|
|
2899
|
+
// the delayed close in handleBlur and the timing of the call to popwinPosInit
|
|
2900
|
+
var isBlurringRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false);
|
|
2884
2901
|
|
|
2885
2902
|
//performance
|
|
2886
2903
|
var handleChangeFetchSafe = funda_utils_dist_cjs_useDebounce__WEBPACK_IMPORTED_MODULE_7___default()(function (e) {
|
|
@@ -2891,8 +2908,10 @@ var LiveSearch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(
|
|
|
2891
2908
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useImperativeHandle)(popupRef, function () {
|
|
2892
2909
|
return {
|
|
2893
2910
|
close: function close() {
|
|
2894
|
-
setIsOpen(false);
|
|
2895
2911
|
cancel();
|
|
2912
|
+
},
|
|
2913
|
+
open: function open() {
|
|
2914
|
+
activate();
|
|
2896
2915
|
}
|
|
2897
2916
|
};
|
|
2898
2917
|
}, [popupRef]);
|
|
@@ -2928,7 +2947,6 @@ var LiveSearch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(
|
|
|
2928
2947
|
},
|
|
2929
2948
|
handle: function handle(event) {
|
|
2930
2949
|
// cancel
|
|
2931
|
-
setIsOpen(false);
|
|
2932
2950
|
cancel();
|
|
2933
2951
|
}
|
|
2934
2952
|
}, [isOpen, rootRef, listRef]);
|
|
@@ -2947,6 +2965,11 @@ var LiveSearch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(
|
|
|
2947
2965
|
function popwinPosInit() {
|
|
2948
2966
|
var showAct = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
2949
2967
|
if (listContentRef.current === null || inputRef.current === null) return;
|
|
2968
|
+
|
|
2969
|
+
// If it is out of focus, do not perform position initialization
|
|
2970
|
+
if (isBlurringRef.current && !MANUAL_REQ) return;
|
|
2971
|
+
|
|
2972
|
+
//
|
|
2950
2973
|
var contentHeightOffset = 80;
|
|
2951
2974
|
var contentMaxHeight = 0;
|
|
2952
2975
|
|
|
@@ -3145,9 +3168,12 @@ var LiveSearch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(
|
|
|
3145
3168
|
var val = e.target.value;
|
|
3146
3169
|
setChangedVal(val);
|
|
3147
3170
|
|
|
3171
|
+
// update temporary value
|
|
3172
|
+
setControlTempValue(val);
|
|
3173
|
+
|
|
3148
3174
|
//
|
|
3149
|
-
if (!
|
|
3150
|
-
matchData(val, fetchUpdate,
|
|
3175
|
+
if (!MANUAL_REQ) {
|
|
3176
|
+
matchData(val, fetchUpdate, AUTO_SHOW_OPTIONS).then(function (response) {
|
|
3151
3177
|
setOrginalData(response);
|
|
3152
3178
|
|
|
3153
3179
|
//
|
|
@@ -3172,8 +3198,15 @@ var LiveSearch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(
|
|
|
3172
3198
|
}
|
|
3173
3199
|
}
|
|
3174
3200
|
function cancel() {
|
|
3201
|
+
// hide list
|
|
3202
|
+
setIsOpen(false);
|
|
3203
|
+
|
|
3204
|
+
//
|
|
3175
3205
|
setOrginalData([]);
|
|
3176
3206
|
popwinPosHide();
|
|
3207
|
+
|
|
3208
|
+
// update temporary value
|
|
3209
|
+
setControlTempValue(null);
|
|
3177
3210
|
}
|
|
3178
3211
|
function fetchData(_x2) {
|
|
3179
3212
|
return _fetchData.apply(this, arguments);
|
|
@@ -3184,13 +3217,17 @@ var LiveSearch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(
|
|
|
3184
3217
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3185
3218
|
while (1) switch (_context2.prev = _context2.next) {
|
|
3186
3219
|
case 0:
|
|
3220
|
+
// update request process
|
|
3221
|
+
setReqProgress(true);
|
|
3222
|
+
|
|
3223
|
+
//
|
|
3187
3224
|
if (!(_typeof(fetchFuncAsync) === 'object')) {
|
|
3188
|
-
_context2.next =
|
|
3225
|
+
_context2.next = 15;
|
|
3189
3226
|
break;
|
|
3190
3227
|
}
|
|
3191
|
-
_context2.next =
|
|
3228
|
+
_context2.next = 4;
|
|
3192
3229
|
return fetchFuncAsync["".concat(fetchFuncMethod)].apply(fetchFuncAsync, _toConsumableArray(params.split(',')));
|
|
3193
|
-
case
|
|
3230
|
+
case 4:
|
|
3194
3231
|
response = _context2.sent;
|
|
3195
3232
|
_ORGIN_DATA = response.data; // reset data structure
|
|
3196
3233
|
if (typeof fetchCallback === 'function') {
|
|
@@ -3217,10 +3254,15 @@ var LiveSearch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(
|
|
|
3217
3254
|
popwinPosInit();
|
|
3218
3255
|
}, 500);
|
|
3219
3256
|
}
|
|
3257
|
+
|
|
3258
|
+
// update request process
|
|
3259
|
+
setReqProgress(false);
|
|
3220
3260
|
return _context2.abrupt("return", _ORGIN_DATA);
|
|
3221
|
-
case
|
|
3261
|
+
case 15:
|
|
3262
|
+
// update request process
|
|
3263
|
+
setReqProgress(false);
|
|
3222
3264
|
return _context2.abrupt("return", []);
|
|
3223
|
-
case
|
|
3265
|
+
case 17:
|
|
3224
3266
|
case "end":
|
|
3225
3267
|
return _context2.stop();
|
|
3226
3268
|
}
|
|
@@ -3256,32 +3298,37 @@ var LiveSearch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(
|
|
|
3256
3298
|
_data = JSON.parse(dataInput);
|
|
3257
3299
|
onChange === null || onChange === void 0 ? void 0 : onChange(inputRef.current, orginalData, _data, listRef.current);
|
|
3258
3300
|
setChangedVal(_data.label);
|
|
3259
|
-
_context3.next =
|
|
3301
|
+
_context3.next = 23;
|
|
3260
3302
|
break;
|
|
3261
3303
|
case 9:
|
|
3262
3304
|
_curData = typeof el.target !== 'undefined' ? el.target.dataset.itemdata : el.dataset.itemdata;
|
|
3305
|
+
if (!(typeof _curData === 'undefined')) {
|
|
3306
|
+
_context3.next = 12;
|
|
3307
|
+
break;
|
|
3308
|
+
}
|
|
3309
|
+
return _context3.abrupt("return");
|
|
3310
|
+
case 12:
|
|
3263
3311
|
_data2 = JSON.parse(_curData);
|
|
3264
3312
|
res = [];
|
|
3265
|
-
if (
|
|
3266
|
-
_context3.next =
|
|
3313
|
+
if (AUTO_SHOW_OPTIONS) {
|
|
3314
|
+
_context3.next = 20;
|
|
3267
3315
|
break;
|
|
3268
3316
|
}
|
|
3269
|
-
_context3.next =
|
|
3270
|
-
return matchData(inputRef.current.value, false,
|
|
3271
|
-
case
|
|
3317
|
+
_context3.next = 17;
|
|
3318
|
+
return matchData(inputRef.current.value, false, AUTO_SHOW_OPTIONS);
|
|
3319
|
+
case 17:
|
|
3272
3320
|
res = _context3.sent;
|
|
3273
|
-
_context3.next =
|
|
3321
|
+
_context3.next = 21;
|
|
3274
3322
|
break;
|
|
3275
|
-
case
|
|
3323
|
+
case 20:
|
|
3276
3324
|
res = dataInit;
|
|
3277
|
-
case
|
|
3325
|
+
case 21:
|
|
3278
3326
|
onChange === null || onChange === void 0 ? void 0 : onChange(inputRef.current, res, _data2, listRef.current);
|
|
3279
3327
|
setChangedVal(_data2.label);
|
|
3280
|
-
case
|
|
3328
|
+
case 23:
|
|
3281
3329
|
// cancel
|
|
3282
|
-
setIsOpen(false);
|
|
3283
3330
|
cancel();
|
|
3284
|
-
case
|
|
3331
|
+
case 24:
|
|
3285
3332
|
case "end":
|
|
3286
3333
|
return _context3.stop();
|
|
3287
3334
|
}
|
|
@@ -3298,12 +3345,12 @@ var LiveSearch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(
|
|
|
3298
3345
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3299
3346
|
while (1) switch (_context4.prev = _context4.next) {
|
|
3300
3347
|
case 0:
|
|
3301
|
-
if (!
|
|
3348
|
+
if (!MANUAL_REQ) {
|
|
3302
3349
|
_context4.next = 7;
|
|
3303
3350
|
break;
|
|
3304
3351
|
}
|
|
3305
3352
|
_context4.next = 3;
|
|
3306
|
-
return matchData(changedVal,
|
|
3353
|
+
return matchData(changedVal, true, true);
|
|
3307
3354
|
case 3:
|
|
3308
3355
|
res = _context4.sent;
|
|
3309
3356
|
setOrginalData(res);
|
|
@@ -3323,38 +3370,45 @@ var LiveSearch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(
|
|
|
3323
3370
|
}));
|
|
3324
3371
|
return _handleFetch.apply(this, arguments);
|
|
3325
3372
|
}
|
|
3326
|
-
function
|
|
3327
|
-
if (
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
}
|
|
3373
|
+
function activate() {
|
|
3374
|
+
if (AUTO_SHOW_OPTIONS) {
|
|
3375
|
+
setOrginalData(dataInit);
|
|
3376
|
+
setIsOpen(true);
|
|
3377
|
+
}
|
|
3332
3378
|
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3379
|
+
// window position
|
|
3380
|
+
setTimeout(function () {
|
|
3381
|
+
popwinPosInit();
|
|
3382
|
+
}, 0);
|
|
3383
|
+
}
|
|
3384
|
+
function handleShowList() {
|
|
3385
|
+
// Reset the out-of-focus marker
|
|
3386
|
+
isBlurringRef.current = false;
|
|
3387
|
+
if (!isOpen) {
|
|
3388
|
+
activate();
|
|
3337
3389
|
} else {
|
|
3338
3390
|
// cancel
|
|
3339
|
-
setIsOpen(false);
|
|
3340
3391
|
cancel();
|
|
3341
3392
|
}
|
|
3393
|
+
|
|
3394
|
+
// Every time the input changes or the search button is clicked, a data request will be triggered
|
|
3395
|
+
if (!AUTO_SHOW_OPTIONS && (controlTempValue === '' || controlTempValue === null) || MANUAL_REQ) {
|
|
3396
|
+
setTimeout(function () {
|
|
3397
|
+
popwinPosHide();
|
|
3398
|
+
}, 0);
|
|
3399
|
+
}
|
|
3342
3400
|
onClick === null || onClick === void 0 ? void 0 : onClick(inputRef.current, listRef.current);
|
|
3343
3401
|
}
|
|
3344
3402
|
function handleBlur(e) {
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3403
|
+
// Set the out-of-focus marker
|
|
3404
|
+
isBlurringRef.current = true;
|
|
3405
|
+
setTimeout(function () {
|
|
3406
|
+
// cancel
|
|
3407
|
+
cancel(); // The delay is to avoid losing focus and not being able to click on the option
|
|
3350
3408
|
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
}
|
|
3355
|
-
}
|
|
3356
|
-
function handleMouseLeaveTrigger() {
|
|
3357
|
-
setIsOpen(false);
|
|
3409
|
+
//
|
|
3410
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(inputRef.current, listRef.current);
|
|
3411
|
+
}, 300);
|
|
3358
3412
|
}
|
|
3359
3413
|
function optionFocus(type) {
|
|
3360
3414
|
return new Promise(function (resolve) {
|
|
@@ -3484,13 +3538,16 @@ var LiveSearch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(
|
|
|
3484
3538
|
|
|
3485
3539
|
// data init
|
|
3486
3540
|
//--------------
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3541
|
+
// If automatic request enabled, do not send them for the first time
|
|
3542
|
+
if (AUTO_SHOW_OPTIONS) {
|
|
3543
|
+
var _oparams = fetchFuncMethodParams || [];
|
|
3544
|
+
var _params = _oparams.map(function (item) {
|
|
3545
|
+
return item !== '$QUERY_STRING' ? item : MANUAL_REQ && !fetchUpdate ? '' : fetchUpdate ? QUERY_STRING_PLACEHOLDER : MANUAL_REQ ? QUERY_STRING_PLACEHOLDER : '';
|
|
3546
|
+
});
|
|
3547
|
+
if (!firstFetch) {
|
|
3548
|
+
fetchData(_params.join(','));
|
|
3549
|
+
setFirstFetch(true); // avoid triggering two data requests if the input value has not changed
|
|
3550
|
+
}
|
|
3494
3551
|
}
|
|
3495
3552
|
}, [value, data]);
|
|
3496
3553
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, label ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
@@ -3509,7 +3566,6 @@ var LiveSearch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(
|
|
|
3509
3566
|
className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_9__.combinedCls)('livesearch__wrapper', (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_9__.clsWrite)(wrapperClassName, 'mb-3 position-relative'), {
|
|
3510
3567
|
'active': isOpen
|
|
3511
3568
|
}),
|
|
3512
|
-
onMouseLeave: handleMouseLeaveTrigger,
|
|
3513
3569
|
onKeyDown: handleKeyPressed
|
|
3514
3570
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((funda_searchbar__WEBPACK_IMPORTED_MODULE_2___default()), _extends({
|
|
3515
3571
|
wrapperClassName: "",
|
|
@@ -3546,8 +3602,8 @@ var LiveSearch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(
|
|
|
3546
3602
|
},
|
|
3547
3603
|
onBlur: handleBlur,
|
|
3548
3604
|
onSubmit: handleFetch,
|
|
3549
|
-
onClick:
|
|
3550
|
-
icon: hideIcon ? '' : !
|
|
3605
|
+
onClick: handleShowList,
|
|
3606
|
+
icon: hideIcon ? '' : !MANUAL_REQ ? '' : icon,
|
|
3551
3607
|
btnId: btnId,
|
|
3552
3608
|
autoComplete: typeof autoComplete === 'undefined' ? 'off' : autoComplete,
|
|
3553
3609
|
autoCapitalize: typeof autoCapitalize === 'undefined' ? 'off' : autoCapitalize,
|
|
@@ -3578,9 +3634,6 @@ var LiveSearch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(
|
|
|
3578
3634
|
className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_9__.combinedCls)('livesearch__options-contentlist rounded', {
|
|
3579
3635
|
'd-none': orginalData && orginalData.length === 0 && !NO_MATCH_POPUP
|
|
3580
3636
|
}),
|
|
3581
|
-
style: {
|
|
3582
|
-
backgroundColor: 'var(--bs-list-group-bg)'
|
|
3583
|
-
},
|
|
3584
3637
|
ref: listContentRef
|
|
3585
3638
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
3586
3639
|
className: "livesearch__options-contentlist-inner"
|
|
@@ -3589,7 +3642,7 @@ var LiveSearch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(
|
|
|
3589
3642
|
type: "button",
|
|
3590
3643
|
className: "list-group-item list-group-item-action border-top-0 border-bottom-0 no-match livesearch__control-option-item--nomatch",
|
|
3591
3644
|
disabled: true
|
|
3592
|
-
}, fetchNoneInfo
|
|
3645
|
+
}, fetchNoneInfo)) : null, orginalData ? orginalData.map(function (item, index) {
|
|
3593
3646
|
var startItemBorder = index === 0 ? 'border-top-0' : '';
|
|
3594
3647
|
var endItemBorder = index === orginalData.length - 1 ? 'border-bottom-0' : '';
|
|
3595
3648
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("button", {
|
|
@@ -3611,14 +3664,49 @@ var LiveSearch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(
|
|
|
3611
3664
|
},
|
|
3612
3665
|
onClick: handleSelect
|
|
3613
3666
|
});
|
|
3614
|
-
}) : null))))) : null,
|
|
3667
|
+
}) : null))))) : null, reqProgress ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
3668
|
+
className: "livesearch-loader ".concat(!hideIcon ? 'pos-offset' : '')
|
|
3669
|
+
}, loader || /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", {
|
|
3670
|
+
height: "12px",
|
|
3671
|
+
width: "12px",
|
|
3672
|
+
viewBox: "0 0 512 512"
|
|
3673
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("g", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", {
|
|
3674
|
+
fill: "inherit",
|
|
3675
|
+
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"
|
|
3676
|
+
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", {
|
|
3677
|
+
fill: "inherit",
|
|
3678
|
+
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"
|
|
3679
|
+
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", {
|
|
3680
|
+
fill: "inherit",
|
|
3681
|
+
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"
|
|
3682
|
+
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", {
|
|
3683
|
+
fill: "inherit",
|
|
3684
|
+
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"
|
|
3685
|
+
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", {
|
|
3686
|
+
fill: "inherit",
|
|
3687
|
+
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"
|
|
3688
|
+
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", {
|
|
3689
|
+
fill: "inherit",
|
|
3690
|
+
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"
|
|
3691
|
+
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", {
|
|
3692
|
+
fill: "inherit",
|
|
3693
|
+
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"
|
|
3694
|
+
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", {
|
|
3695
|
+
fill: "inherit",
|
|
3696
|
+
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"
|
|
3697
|
+
}))))) : null, hideIcon ? null : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
|
|
3615
3698
|
className: "livesearch__wrapper-searchbtn"
|
|
3616
3699
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("button", {
|
|
3617
3700
|
tabIndex: -1,
|
|
3618
3701
|
type: "button",
|
|
3619
3702
|
className: "btn border-end-0 rounded-pill",
|
|
3620
|
-
style: {
|
|
3703
|
+
style: MANUAL_REQ ? undefined : {
|
|
3621
3704
|
pointerEvents: 'none'
|
|
3705
|
+
},
|
|
3706
|
+
onClick: function onClick(e) {
|
|
3707
|
+
e.preventDefault();
|
|
3708
|
+
e.stopPropagation();
|
|
3709
|
+
handleFetch();
|
|
3622
3710
|
}
|
|
3623
3711
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", {
|
|
3624
3712
|
width: "1em",
|
|
@@ -3628,7 +3716,7 @@ var LiveSearch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(
|
|
|
3628
3716
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", {
|
|
3629
3717
|
d: "M12.027 9.92L16 13.95 14 16l-4.075-3.976A6.465 6.465 0 0 1 6.5 13C2.91 13 0 10.083 0 6.5 0 2.91 2.917 0 6.5 0 10.09 0 13 2.917 13 6.5a6.463 6.463 0 0 1-.973 3.42zM1.997 6.452c0 2.48 2.014 4.5 4.5 4.5 2.48 0 4.5-2.015 4.5-4.5 0-2.48-2.015-4.5-4.5-4.5-2.48 0-4.5 2.014-4.5 4.5z",
|
|
3630
3718
|
fillRule: "evenodd"
|
|
3631
|
-
})))))
|
|
3719
|
+
})))))));
|
|
3632
3720
|
});
|
|
3633
3721
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LiveSearch);
|
|
3634
3722
|
})();
|