funda-ui 4.3.555 → 4.3.721

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 CHANGED
@@ -3532,8 +3532,8 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
3532
3532
  onFocus = props.onFocus,
3533
3533
  attributes = _objectWithoutProperties(props, _excluded);
3534
3534
  var DEPTH = depth || 1055; // the default value same as bootstrap
3535
- var LIVE_SEARCH_OK = typeof fetchTrigger !== 'undefined' && fetchTrigger === true ? true : false;
3536
- var LIVE_SEARCH_DISABLED = (typeof fetchTrigger === 'undefined' || fetchTrigger === false) && typeof window !== 'undefined' && typeof window['funda-ui__Select-disable-livesearch'] !== 'undefined' ? true : false; // Globally disable real-time search functionality (only valid for non-dynamic requests)
3535
+ var MANUAL_REQ = typeof fetchTrigger !== 'undefined' && fetchTrigger === true ? true : false; // Manual requests
3536
+ var LIVE_SEARCH_DISABLED = !MANUAL_REQ && typeof window !== 'undefined' && typeof window['funda-ui__Select-disable-livesearch'] !== 'undefined' ? true : false; // Globally disable real-time search functionality (only valid for non-dynamic requests)
3537
3537
 
3538
3538
  var FIRST_REQUEST_AUTO = typeof firstRequestAutoExec === 'undefined' ? true : firstRequestAutoExec;
3539
3539
  var INPUT_READONLY = LIVE_SEARCH_DISABLED ? true : typeof readOnly === 'undefined' ? null : readOnly;
@@ -3865,7 +3865,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
3865
3865
  // STEP 4: ===========
3866
3866
  // value & label must be initialized
3867
3867
  filterRes = [];
3868
- if (fetchTrigger) {
3868
+ if (MANUAL_REQ) {
3869
3869
  // If a manual action is used to trigger the request
3870
3870
  if (typeof fetchTriggerForDefaultData !== 'undefined' && fetchTriggerForDefaultData !== null && typeof (fetchTriggerForDefaultData === null || fetchTriggerForDefaultData === void 0 ? void 0 : fetchTriggerForDefaultData.values[0]) !== 'undefined') {
3871
3871
  filterRes = [{
@@ -4346,7 +4346,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4346
4346
  // hide list
4347
4347
  setIsOpen(false);
4348
4348
  if (!MULTI_SEL_VALID) popwinPosHide();
4349
- if (LIVE_SEARCH_OK) {
4349
+ if (MANUAL_REQ) {
4350
4350
  // clean data
4351
4351
  setOptionsData([]);
4352
4352
  } else {
@@ -4394,7 +4394,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4394
4394
  popwinNoMatchInit();
4395
4395
  }, 500);
4396
4396
  }
4397
- if (LIVE_SEARCH_OK) {
4397
+ if (MANUAL_REQ) {
4398
4398
  // clean data
4399
4399
  setOptionsData([]);
4400
4400
  } else {
@@ -4402,6 +4402,11 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4402
4402
  setOptionsData(orginalData);
4403
4403
  }
4404
4404
 
4405
+ // When you select multiple times, it automatically focuses on the search input box
4406
+ if (MULTI_SEL_VALID) {
4407
+ selectInputRef.current.select();
4408
+ }
4409
+
4405
4410
  // update temporary value
4406
4411
  setControlTempValue('');
4407
4412
 
@@ -4412,6 +4417,10 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4412
4417
  // This is also the element to apply the CSS '-webkit-overflow-scrolling: touch;' if desired.
4413
4418
  if (LOCK_BODY_SCROLL) (0,bodyScrollLock.disableBodyScroll)(document.querySelector('body'));
4414
4419
  }
4420
+ function fixFocusStatus() {
4421
+ // When selecting multiple times, in order to avoid losing
4422
+ if (MULTI_SEL_VALID) handleFocus(selectInputRef.current);
4423
+ }
4415
4424
  function handleSelect(_x5) {
4416
4425
  return _handleSelect.apply(this, arguments);
4417
4426
  }
@@ -4691,7 +4700,10 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4691
4700
  selectInputRef.current.blur();
4692
4701
  }
4693
4702
  }
4694
- case 12:
4703
+
4704
+ // Fixed an out-of-focus issue
4705
+ fixFocusStatus();
4706
+ case 13:
4695
4707
  case "end":
4696
4708
  return _context2.stop();
4697
4709
  }
@@ -4783,6 +4795,9 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4783
4795
  _values = _values2;
4784
4796
  }
4785
4797
  onChange === null || onChange === void 0 ? void 0 : onChange(selectInputRef.current, valueInputRef.current, multipleSelectionCallback(_values, _labels));
4798
+
4799
+ // Fixed an out-of-focus issue
4800
+ fixFocusStatus();
4786
4801
  }
4787
4802
  function handleCleanValue(event) {
4788
4803
  if (typeof event !== 'undefined') {
@@ -4894,7 +4909,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4894
4909
  inputVal = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : null;
4895
4910
  _oparams = fetchFuncMethodParams || [];
4896
4911
  _params = _oparams.map(function (item) {
4897
- return item !== '$QUERY_STRING' ? item : fetchTrigger ? '------' : '';
4912
+ return item !== '$QUERY_STRING' ? item : MANUAL_REQ ? '------' : '';
4898
4913
  });
4899
4914
  _context4.next = 5;
4900
4915
  return fetchData(_params.join(','), finalRes(inputVal), inputVal);
@@ -4926,6 +4941,9 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4926
4941
 
4927
4942
  //
4928
4943
  handleChangeFetchSafe(val);
4944
+
4945
+ // Fixed an out-of-focus issue
4946
+ fixFocusStatus();
4929
4947
  }
4930
4948
 
4931
4949
  //
@@ -4937,7 +4955,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4937
4955
  setControlTempValue('');
4938
4956
 
4939
4957
  //
4940
- onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
4958
+ onFocus === null || onFocus === void 0 ? void 0 : onFocus(selectInputRef.current);
4941
4959
  }
4942
4960
  function handleBlur(event) {
4943
4961
  var _rootRef$current2;
@@ -4954,7 +4972,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4954
4972
  if (listContentRef.current) listContentRef.current.focus();
4955
4973
  }
4956
4974
  setTimeout(function () {
4957
- onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
4975
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(selectInputRef.current);
4958
4976
  }, 300);
4959
4977
  }
4960
4978
  function generateInputFocusStr() {
@@ -5094,6 +5112,16 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
5094
5112
  }));
5095
5113
  return _handleKeyPressed.apply(this, arguments);
5096
5114
  }
5115
+ function handleDocOut(e) {
5116
+ if (e.target.closest('.custom-select__options-wrapper') === null && e.target.closest('.custom-select__wrapper') === null) {
5117
+ // cancel
5118
+ cancel();
5119
+ if (MULTI_SEL_VALID) popwinPosHide();
5120
+
5121
+ //
5122
+ handleBlur(null);
5123
+ }
5124
+ }
5097
5125
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
5098
5126
  // Call a function when the component has been rendered completely
5099
5127
  //--------------
@@ -5129,6 +5157,19 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
5129
5157
  }
5130
5158
  }
5131
5159
  }, []);
5160
+
5161
+ // Fixed an out-of-focus issue
5162
+ //--------------
5163
+ // !!! TIPS:
5164
+ // Fixed: When `fixFocusStatus()` is triggered, the above judgment will be invalidated, and this judgment will be used
5165
+ // Fixed: The pop-up window is not closed due to the mixing of business components
5166
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
5167
+ document.addEventListener('pointerdown', handleDocOut);
5168
+ return function () {
5169
+ document.removeEventListener('pointerdown', handleDocOut);
5170
+ };
5171
+ }, [orginalData]); // // Avoid the issue that `setOptionsData(orginalData)` sets the original value to empty on the first entry
5172
+
5132
5173
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, label ? /*#__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", {
5133
5174
  className: "custom-select__label"
5134
5175
  }, typeof label === 'string' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("label", {
@@ -5240,7 +5281,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
5240
5281
  'reverse': isOpen
5241
5282
  }),
5242
5283
  style: {
5243
- display: fetchTrigger ? 'none' : 'inline-block'
5284
+ display: MANUAL_REQ ? 'none' : 'inline-block'
5244
5285
  }
5245
5286
  }, controlArrow ? controlArrow : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
5246
5287
  width: "10px",
@@ -5258,7 +5299,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
5258
5299
  transform: "translate(56.000000, 160.000000)"
5259
5300
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
5260
5301
  d: "M144,6525.39 L142.594,6524 L133.987,6532.261 L133.069,6531.38 L133.074,6531.385 L125.427,6524.045 L124,6525.414 C126.113,6527.443 132.014,6533.107 133.987,6535 C135.453,6533.594 134.024,6534.965 144,6525.39"
5261
- })))))), fetchTrigger ? /*#__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("span", {
5302
+ })))))), MANUAL_REQ ? /*#__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("span", {
5262
5303
  className: "custom-select-multi__control-searchbtn"
5263
5304
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
5264
5305
  tabIndex: -1,
@@ -5300,7 +5341,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
5300
5341
  className: "custom-select-multi__list"
5301
5342
  }, typeof multiSelectSelectedItemOnlyStatus !== 'undefined' ? /*#__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("li", {
5302
5343
  className: "custom-select-multi__list-item-statusstring"
5303
- }, typeof multiSelectSelectedItemOnlyStatus.itemsLabel === 'string' && controlArr.labels.length > 0 && controlArr.labels.length < optionsData.length ? multiSelectSelectedItemOnlyStatus.itemsLabel.replace('{num}', "".concat(controlArr.labels.length)) : null, typeof multiSelectSelectedItemOnlyStatus.noneLabel === 'string' && controlArr.labels.length === 0 ? multiSelectSelectedItemOnlyStatus.noneLabel : null, controlArr.labels.length > 0 ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, typeof multiSelectSelectedItemOnlyStatus.allItemsLabel === 'string' && controlArr.labels.length === optionsData.length ? multiSelectSelectedItemOnlyStatus.allItemsLabel.replace('{num}', "".concat(controlArr.labels.length)) : null) : null, typeof multiSelectSelectedItemOnlyStatus.itemsLabel !== 'string' && controlArr.labels.length > 0 ? MULTI_SEL_SELECTED_STATUS.itemsLabel.replace('{num}', "".concat(controlArr.labels.length)) : null, typeof multiSelectSelectedItemOnlyStatus.noneLabel !== 'string' && controlArr.labels.length === 0 ? MULTI_SEL_SELECTED_STATUS.noneLabel : null, controlArr.labels.length > 0 ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, typeof multiSelectSelectedItemOnlyStatus.allItemsLabel !== 'string' && controlArr.labels.length === optionsData.length ? MULTI_SEL_SELECTED_STATUS.allItemsLabel.replace('{num}', "".concat(controlArr.labels.length)) : null) : null)) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, typeof renderSelectedValue === 'function' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, renderSelectedValue(controlArr, handleMultiControlItemRemove)) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, controlArr.labels.map(function (item, index) {
5344
+ }, MANUAL_REQ ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, typeof multiSelectSelectedItemOnlyStatus.itemsLabel === 'string' && controlArr.labels.length > 0 ? multiSelectSelectedItemOnlyStatus.itemsLabel.replace('{num}', "".concat(controlArr.labels.length)) : null, typeof multiSelectSelectedItemOnlyStatus.noneLabel === 'string' && controlArr.labels.length === 0 ? multiSelectSelectedItemOnlyStatus.noneLabel : null, typeof multiSelectSelectedItemOnlyStatus.itemsLabel !== 'string' && controlArr.labels.length > 0 ? MULTI_SEL_SELECTED_STATUS.itemsLabel.replace('{num}', "".concat(controlArr.labels.length)) : null, typeof multiSelectSelectedItemOnlyStatus.noneLabel !== 'string' && controlArr.labels.length === 0 ? MULTI_SEL_SELECTED_STATUS.noneLabel : null) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, typeof multiSelectSelectedItemOnlyStatus.itemsLabel === 'string' && controlArr.labels.length > 0 && controlArr.labels.length < optionsData.length ? multiSelectSelectedItemOnlyStatus.itemsLabel.replace('{num}', "".concat(controlArr.labels.length)) : null, typeof multiSelectSelectedItemOnlyStatus.noneLabel === 'string' && controlArr.labels.length === 0 ? multiSelectSelectedItemOnlyStatus.noneLabel : null, controlArr.labels.length > 0 ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, typeof multiSelectSelectedItemOnlyStatus.allItemsLabel === 'string' && controlArr.labels.length === optionsData.length ? multiSelectSelectedItemOnlyStatus.allItemsLabel.replace('{num}', "".concat(controlArr.labels.length)) : null) : null, typeof multiSelectSelectedItemOnlyStatus.itemsLabel !== 'string' && controlArr.labels.length > 0 ? MULTI_SEL_SELECTED_STATUS.itemsLabel.replace('{num}', "".concat(controlArr.labels.length)) : null, typeof multiSelectSelectedItemOnlyStatus.noneLabel !== 'string' && controlArr.labels.length === 0 ? MULTI_SEL_SELECTED_STATUS.noneLabel : null, controlArr.labels.length > 0 ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, typeof multiSelectSelectedItemOnlyStatus.allItemsLabel !== 'string' && controlArr.labels.length === optionsData.length ? MULTI_SEL_SELECTED_STATUS.allItemsLabel.replace('{num}', "".concat(controlArr.labels.length)) : null) : null))) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, typeof renderSelectedValue === 'function' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, renderSelectedValue(controlArr, handleMultiControlItemRemove)) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, controlArr.labels.map(function (item, index) {
5304
5345
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
5305
5346
  key: 'selected-item-' + index,
5306
5347
  "data-value": controlArr.values[index],
@@ -5363,7 +5404,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
5363
5404
  'reverse': isOpen
5364
5405
  }),
5365
5406
  style: {
5366
- display: fetchTrigger ? 'none' : 'inline-block'
5407
+ display: MANUAL_REQ ? 'none' : 'inline-block'
5367
5408
  }
5368
5409
  }, controlArrow ? controlArrow : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
5369
5410
  width: "10px",
@@ -5381,7 +5422,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
5381
5422
  transform: "translate(56.000000, 160.000000)"
5382
5423
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
5383
5424
  d: "M144,6525.39 L142.594,6524 L133.987,6532.261 L133.069,6531.38 L133.074,6531.385 L125.427,6524.045 L124,6525.414 C126.113,6527.443 132.014,6533.107 133.987,6535 C135.453,6533.594 134.024,6534.965 144,6525.39"
5384
- })))))), fetchTrigger ? /*#__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("span", {
5425
+ })))))), MANUAL_REQ ? /*#__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("span", {
5385
5426
  className: "custom-select-multi__control-searchbtn"
5386
5427
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
5387
5428
  tabIndex: -1,
@@ -3532,8 +3532,8 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
3532
3532
  onFocus = props.onFocus,
3533
3533
  attributes = _objectWithoutProperties(props, _excluded);
3534
3534
  var DEPTH = depth || 1055; // the default value same as bootstrap
3535
- var LIVE_SEARCH_OK = typeof fetchTrigger !== 'undefined' && fetchTrigger === true ? true : false;
3536
- var LIVE_SEARCH_DISABLED = (typeof fetchTrigger === 'undefined' || fetchTrigger === false) && typeof window !== 'undefined' && typeof window['funda-ui__Select-disable-livesearch'] !== 'undefined' ? true : false; // Globally disable real-time search functionality (only valid for non-dynamic requests)
3535
+ var MANUAL_REQ = typeof fetchTrigger !== 'undefined' && fetchTrigger === true ? true : false; // Manual requests
3536
+ var LIVE_SEARCH_DISABLED = !MANUAL_REQ && typeof window !== 'undefined' && typeof window['funda-ui__Select-disable-livesearch'] !== 'undefined' ? true : false; // Globally disable real-time search functionality (only valid for non-dynamic requests)
3537
3537
 
3538
3538
  var FIRST_REQUEST_AUTO = typeof firstRequestAutoExec === 'undefined' ? true : firstRequestAutoExec;
3539
3539
  var INPUT_READONLY = LIVE_SEARCH_DISABLED ? true : typeof readOnly === 'undefined' ? null : readOnly;
@@ -3865,7 +3865,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
3865
3865
  // STEP 4: ===========
3866
3866
  // value & label must be initialized
3867
3867
  filterRes = [];
3868
- if (fetchTrigger) {
3868
+ if (MANUAL_REQ) {
3869
3869
  // If a manual action is used to trigger the request
3870
3870
  if (typeof fetchTriggerForDefaultData !== 'undefined' && fetchTriggerForDefaultData !== null && typeof (fetchTriggerForDefaultData === null || fetchTriggerForDefaultData === void 0 ? void 0 : fetchTriggerForDefaultData.values[0]) !== 'undefined') {
3871
3871
  filterRes = [{
@@ -4346,7 +4346,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4346
4346
  // hide list
4347
4347
  setIsOpen(false);
4348
4348
  if (!MULTI_SEL_VALID) popwinPosHide();
4349
- if (LIVE_SEARCH_OK) {
4349
+ if (MANUAL_REQ) {
4350
4350
  // clean data
4351
4351
  setOptionsData([]);
4352
4352
  } else {
@@ -4394,7 +4394,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4394
4394
  popwinNoMatchInit();
4395
4395
  }, 500);
4396
4396
  }
4397
- if (LIVE_SEARCH_OK) {
4397
+ if (MANUAL_REQ) {
4398
4398
  // clean data
4399
4399
  setOptionsData([]);
4400
4400
  } else {
@@ -4402,6 +4402,11 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4402
4402
  setOptionsData(orginalData);
4403
4403
  }
4404
4404
 
4405
+ // When you select multiple times, it automatically focuses on the search input box
4406
+ if (MULTI_SEL_VALID) {
4407
+ selectInputRef.current.select();
4408
+ }
4409
+
4405
4410
  // update temporary value
4406
4411
  setControlTempValue('');
4407
4412
 
@@ -4412,6 +4417,10 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4412
4417
  // This is also the element to apply the CSS '-webkit-overflow-scrolling: touch;' if desired.
4413
4418
  if (LOCK_BODY_SCROLL) (0,bodyScrollLock.disableBodyScroll)(document.querySelector('body'));
4414
4419
  }
4420
+ function fixFocusStatus() {
4421
+ // When selecting multiple times, in order to avoid losing
4422
+ if (MULTI_SEL_VALID) handleFocus(selectInputRef.current);
4423
+ }
4415
4424
  function handleSelect(_x5) {
4416
4425
  return _handleSelect.apply(this, arguments);
4417
4426
  }
@@ -4691,7 +4700,10 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4691
4700
  selectInputRef.current.blur();
4692
4701
  }
4693
4702
  }
4694
- case 12:
4703
+
4704
+ // Fixed an out-of-focus issue
4705
+ fixFocusStatus();
4706
+ case 13:
4695
4707
  case "end":
4696
4708
  return _context2.stop();
4697
4709
  }
@@ -4783,6 +4795,9 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4783
4795
  _values = _values2;
4784
4796
  }
4785
4797
  onChange === null || onChange === void 0 ? void 0 : onChange(selectInputRef.current, valueInputRef.current, multipleSelectionCallback(_values, _labels));
4798
+
4799
+ // Fixed an out-of-focus issue
4800
+ fixFocusStatus();
4786
4801
  }
4787
4802
  function handleCleanValue(event) {
4788
4803
  if (typeof event !== 'undefined') {
@@ -4894,7 +4909,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4894
4909
  inputVal = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : null;
4895
4910
  _oparams = fetchFuncMethodParams || [];
4896
4911
  _params = _oparams.map(function (item) {
4897
- return item !== '$QUERY_STRING' ? item : fetchTrigger ? '------' : '';
4912
+ return item !== '$QUERY_STRING' ? item : MANUAL_REQ ? '------' : '';
4898
4913
  });
4899
4914
  _context4.next = 5;
4900
4915
  return fetchData(_params.join(','), finalRes(inputVal), inputVal);
@@ -4926,6 +4941,9 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4926
4941
 
4927
4942
  //
4928
4943
  handleChangeFetchSafe(val);
4944
+
4945
+ // Fixed an out-of-focus issue
4946
+ fixFocusStatus();
4929
4947
  }
4930
4948
 
4931
4949
  //
@@ -4937,7 +4955,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4937
4955
  setControlTempValue('');
4938
4956
 
4939
4957
  //
4940
- onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
4958
+ onFocus === null || onFocus === void 0 ? void 0 : onFocus(selectInputRef.current);
4941
4959
  }
4942
4960
  function handleBlur(event) {
4943
4961
  var _rootRef$current2;
@@ -4954,7 +4972,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4954
4972
  if (listContentRef.current) listContentRef.current.focus();
4955
4973
  }
4956
4974
  setTimeout(function () {
4957
- onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
4975
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(selectInputRef.current);
4958
4976
  }, 300);
4959
4977
  }
4960
4978
  function generateInputFocusStr() {
@@ -5094,6 +5112,16 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
5094
5112
  }));
5095
5113
  return _handleKeyPressed.apply(this, arguments);
5096
5114
  }
5115
+ function handleDocOut(e) {
5116
+ if (e.target.closest('.custom-select__options-wrapper') === null && e.target.closest('.custom-select__wrapper') === null) {
5117
+ // cancel
5118
+ cancel();
5119
+ if (MULTI_SEL_VALID) popwinPosHide();
5120
+
5121
+ //
5122
+ handleBlur(null);
5123
+ }
5124
+ }
5097
5125
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
5098
5126
  // Call a function when the component has been rendered completely
5099
5127
  //--------------
@@ -5129,6 +5157,19 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
5129
5157
  }
5130
5158
  }
5131
5159
  }, []);
5160
+
5161
+ // Fixed an out-of-focus issue
5162
+ //--------------
5163
+ // !!! TIPS:
5164
+ // Fixed: When `fixFocusStatus()` is triggered, the above judgment will be invalidated, and this judgment will be used
5165
+ // Fixed: The pop-up window is not closed due to the mixing of business components
5166
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
5167
+ document.addEventListener('pointerdown', handleDocOut);
5168
+ return function () {
5169
+ document.removeEventListener('pointerdown', handleDocOut);
5170
+ };
5171
+ }, [orginalData]); // // Avoid the issue that `setOptionsData(orginalData)` sets the original value to empty on the first entry
5172
+
5132
5173
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, label ? /*#__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", {
5133
5174
  className: "custom-select__label"
5134
5175
  }, typeof label === 'string' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("label", {
@@ -5240,7 +5281,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
5240
5281
  'reverse': isOpen
5241
5282
  }),
5242
5283
  style: {
5243
- display: fetchTrigger ? 'none' : 'inline-block'
5284
+ display: MANUAL_REQ ? 'none' : 'inline-block'
5244
5285
  }
5245
5286
  }, controlArrow ? controlArrow : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
5246
5287
  width: "10px",
@@ -5258,7 +5299,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
5258
5299
  transform: "translate(56.000000, 160.000000)"
5259
5300
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
5260
5301
  d: "M144,6525.39 L142.594,6524 L133.987,6532.261 L133.069,6531.38 L133.074,6531.385 L125.427,6524.045 L124,6525.414 C126.113,6527.443 132.014,6533.107 133.987,6535 C135.453,6533.594 134.024,6534.965 144,6525.39"
5261
- })))))), fetchTrigger ? /*#__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("span", {
5302
+ })))))), MANUAL_REQ ? /*#__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("span", {
5262
5303
  className: "custom-select-multi__control-searchbtn"
5263
5304
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
5264
5305
  tabIndex: -1,
@@ -5300,7 +5341,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
5300
5341
  className: "custom-select-multi__list"
5301
5342
  }, typeof multiSelectSelectedItemOnlyStatus !== 'undefined' ? /*#__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("li", {
5302
5343
  className: "custom-select-multi__list-item-statusstring"
5303
- }, typeof multiSelectSelectedItemOnlyStatus.itemsLabel === 'string' && controlArr.labels.length > 0 && controlArr.labels.length < optionsData.length ? multiSelectSelectedItemOnlyStatus.itemsLabel.replace('{num}', "".concat(controlArr.labels.length)) : null, typeof multiSelectSelectedItemOnlyStatus.noneLabel === 'string' && controlArr.labels.length === 0 ? multiSelectSelectedItemOnlyStatus.noneLabel : null, controlArr.labels.length > 0 ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, typeof multiSelectSelectedItemOnlyStatus.allItemsLabel === 'string' && controlArr.labels.length === optionsData.length ? multiSelectSelectedItemOnlyStatus.allItemsLabel.replace('{num}', "".concat(controlArr.labels.length)) : null) : null, typeof multiSelectSelectedItemOnlyStatus.itemsLabel !== 'string' && controlArr.labels.length > 0 ? MULTI_SEL_SELECTED_STATUS.itemsLabel.replace('{num}', "".concat(controlArr.labels.length)) : null, typeof multiSelectSelectedItemOnlyStatus.noneLabel !== 'string' && controlArr.labels.length === 0 ? MULTI_SEL_SELECTED_STATUS.noneLabel : null, controlArr.labels.length > 0 ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, typeof multiSelectSelectedItemOnlyStatus.allItemsLabel !== 'string' && controlArr.labels.length === optionsData.length ? MULTI_SEL_SELECTED_STATUS.allItemsLabel.replace('{num}', "".concat(controlArr.labels.length)) : null) : null)) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, typeof renderSelectedValue === 'function' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, renderSelectedValue(controlArr, handleMultiControlItemRemove)) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, controlArr.labels.map(function (item, index) {
5344
+ }, MANUAL_REQ ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, typeof multiSelectSelectedItemOnlyStatus.itemsLabel === 'string' && controlArr.labels.length > 0 ? multiSelectSelectedItemOnlyStatus.itemsLabel.replace('{num}', "".concat(controlArr.labels.length)) : null, typeof multiSelectSelectedItemOnlyStatus.noneLabel === 'string' && controlArr.labels.length === 0 ? multiSelectSelectedItemOnlyStatus.noneLabel : null, typeof multiSelectSelectedItemOnlyStatus.itemsLabel !== 'string' && controlArr.labels.length > 0 ? MULTI_SEL_SELECTED_STATUS.itemsLabel.replace('{num}', "".concat(controlArr.labels.length)) : null, typeof multiSelectSelectedItemOnlyStatus.noneLabel !== 'string' && controlArr.labels.length === 0 ? MULTI_SEL_SELECTED_STATUS.noneLabel : null) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, typeof multiSelectSelectedItemOnlyStatus.itemsLabel === 'string' && controlArr.labels.length > 0 && controlArr.labels.length < optionsData.length ? multiSelectSelectedItemOnlyStatus.itemsLabel.replace('{num}', "".concat(controlArr.labels.length)) : null, typeof multiSelectSelectedItemOnlyStatus.noneLabel === 'string' && controlArr.labels.length === 0 ? multiSelectSelectedItemOnlyStatus.noneLabel : null, controlArr.labels.length > 0 ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, typeof multiSelectSelectedItemOnlyStatus.allItemsLabel === 'string' && controlArr.labels.length === optionsData.length ? multiSelectSelectedItemOnlyStatus.allItemsLabel.replace('{num}', "".concat(controlArr.labels.length)) : null) : null, typeof multiSelectSelectedItemOnlyStatus.itemsLabel !== 'string' && controlArr.labels.length > 0 ? MULTI_SEL_SELECTED_STATUS.itemsLabel.replace('{num}', "".concat(controlArr.labels.length)) : null, typeof multiSelectSelectedItemOnlyStatus.noneLabel !== 'string' && controlArr.labels.length === 0 ? MULTI_SEL_SELECTED_STATUS.noneLabel : null, controlArr.labels.length > 0 ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, typeof multiSelectSelectedItemOnlyStatus.allItemsLabel !== 'string' && controlArr.labels.length === optionsData.length ? MULTI_SEL_SELECTED_STATUS.allItemsLabel.replace('{num}', "".concat(controlArr.labels.length)) : null) : null))) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, typeof renderSelectedValue === 'function' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, renderSelectedValue(controlArr, handleMultiControlItemRemove)) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, controlArr.labels.map(function (item, index) {
5304
5345
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
5305
5346
  key: 'selected-item-' + index,
5306
5347
  "data-value": controlArr.values[index],
@@ -5363,7 +5404,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
5363
5404
  'reverse': isOpen
5364
5405
  }),
5365
5406
  style: {
5366
- display: fetchTrigger ? 'none' : 'inline-block'
5407
+ display: MANUAL_REQ ? 'none' : 'inline-block'
5367
5408
  }
5368
5409
  }, controlArrow ? controlArrow : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
5369
5410
  width: "10px",
@@ -5381,7 +5422,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
5381
5422
  transform: "translate(56.000000, 160.000000)"
5382
5423
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
5383
5424
  d: "M144,6525.39 L142.594,6524 L133.987,6532.261 L133.069,6531.38 L133.074,6531.385 L125.427,6524.045 L124,6525.414 C126.113,6527.443 132.014,6533.107 133.987,6535 C135.453,6533.594 134.024,6534.965 144,6525.39"
5384
- })))))), fetchTrigger ? /*#__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("span", {
5425
+ })))))), MANUAL_REQ ? /*#__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("span", {
5385
5426
  className: "custom-select-multi__control-searchbtn"
5386
5427
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
5387
5428
  tabIndex: -1,
@@ -49,7 +49,6 @@ import {
49
49
  import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
50
50
 
51
51
 
52
-
53
52
  export type SelectOptionChangeFnType = (arg1: any, arg2: any, arg3: any) => void;
54
53
 
55
54
  export interface MultiSelectDataConfig {
@@ -214,8 +213,8 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
214
213
 
215
214
 
216
215
  const DEPTH = depth || 1055; // the default value same as bootstrap
217
- const LIVE_SEARCH_OK = typeof fetchTrigger !== 'undefined' && fetchTrigger === true ? true : false;
218
- const LIVE_SEARCH_DISABLED = (typeof fetchTrigger === 'undefined' || fetchTrigger === false) && typeof window !== 'undefined' && typeof (window as any)['funda-ui__Select-disable-livesearch'] !== 'undefined' ? true : false; // Globally disable real-time search functionality (only valid for non-dynamic requests)
216
+ const MANUAL_REQ = typeof fetchTrigger !== 'undefined' && fetchTrigger === true ? true : false; // Manual requests
217
+ const LIVE_SEARCH_DISABLED = !MANUAL_REQ && typeof window !== 'undefined' && typeof (window as any)['funda-ui__Select-disable-livesearch'] !== 'undefined' ? true : false; // Globally disable real-time search functionality (only valid for non-dynamic requests)
219
218
 
220
219
 
221
220
  const FIRST_REQUEST_AUTO = typeof firstRequestAutoExec === 'undefined' ? true : firstRequestAutoExec;
@@ -414,7 +413,6 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
414
413
  //performance
415
414
  const handleChangeFetchSafe = useDebounce((val: any) => {
416
415
 
417
-
418
416
  let _orginalData: OptionConfig[] = [];
419
417
  const update = (inputData: any) => {
420
418
  const filterRes = () => {
@@ -533,7 +531,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
533
531
  let filterRes: any = [];
534
532
 
535
533
 
536
- if (fetchTrigger) {
534
+ if (MANUAL_REQ) {
537
535
 
538
536
  // If a manual action is used to trigger the request
539
537
  if (typeof fetchTriggerForDefaultData !== 'undefined' && fetchTriggerForDefaultData !== null && typeof fetchTriggerForDefaultData?.values[0] !== 'undefined') {
@@ -1131,7 +1129,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1131
1129
  if (!MULTI_SEL_VALID) popwinPosHide();
1132
1130
 
1133
1131
 
1134
- if (LIVE_SEARCH_OK) {
1132
+ if (MANUAL_REQ) {
1135
1133
  // clean data
1136
1134
  setOptionsData([]);
1137
1135
  } else {
@@ -1173,6 +1171,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1173
1171
  setIsOpen(true);
1174
1172
 
1175
1173
 
1174
+
1176
1175
  // pop win initalization
1177
1176
  setTimeout(() => {
1178
1177
  popwinPosInit();
@@ -1189,7 +1188,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1189
1188
 
1190
1189
 
1191
1190
 
1192
- if (LIVE_SEARCH_OK) {
1191
+ if (MANUAL_REQ) {
1193
1192
  // clean data
1194
1193
  setOptionsData([]);
1195
1194
  } else {
@@ -1198,6 +1197,11 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1198
1197
  }
1199
1198
 
1200
1199
 
1200
+ // When you select multiple times, it automatically focuses on the search input box
1201
+ if (MULTI_SEL_VALID) {
1202
+ selectInputRef.current.select();
1203
+ }
1204
+
1201
1205
  // update temporary value
1202
1206
  setControlTempValue('');
1203
1207
 
@@ -1211,6 +1215,12 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1211
1215
 
1212
1216
 
1213
1217
  }
1218
+
1219
+
1220
+ function fixFocusStatus() {
1221
+ // When selecting multiple times, in order to avoid losing
1222
+ if (MULTI_SEL_VALID) handleFocus(selectInputRef.current);
1223
+ }
1214
1224
 
1215
1225
  async function handleSelect(el: any, dataInput: any = false, valueArr: any[] = [], labelArr: any[] = []) {
1216
1226
 
@@ -1546,7 +1556,8 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1546
1556
  }
1547
1557
  }
1548
1558
 
1549
-
1559
+ // Fixed an out-of-focus issue
1560
+ fixFocusStatus();
1550
1561
 
1551
1562
  }
1552
1563
 
@@ -1656,6 +1667,9 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1656
1667
  multipleSelectionCallback(_values, _labels)
1657
1668
  );
1658
1669
 
1670
+ // Fixed an out-of-focus issue
1671
+ fixFocusStatus();
1672
+
1659
1673
 
1660
1674
  }
1661
1675
 
@@ -1757,7 +1771,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1757
1771
 
1758
1772
  async function handleFirstFetch(inputVal: any = null) {
1759
1773
  const _oparams: any[] = fetchFuncMethodParams || [];
1760
- const _params: any[] = _oparams.map((item: any) => item !== '$QUERY_STRING' ? item : (fetchTrigger ? '------' : ''));
1774
+ const _params: any[] = _oparams.map((item: any) => item !== '$QUERY_STRING' ? item : (MANUAL_REQ ? '------' : ''));
1761
1775
  const res = await fetchData((_params).join(','), finalRes(inputVal), inputVal);
1762
1776
 
1763
1777
  return res;
@@ -1787,6 +1801,9 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1787
1801
  //
1788
1802
  handleChangeFetchSafe(val);
1789
1803
 
1804
+ // Fixed an out-of-focus issue
1805
+ fixFocusStatus();
1806
+
1790
1807
 
1791
1808
  }
1792
1809
 
@@ -1798,8 +1815,10 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1798
1815
  // update temporary value
1799
1816
  setControlTempValue('');
1800
1817
 
1818
+
1801
1819
  //
1802
- onFocus?.(event);
1820
+ onFocus?.(selectInputRef.current);
1821
+
1803
1822
  }
1804
1823
 
1805
1824
  function handleBlur(event: any) {
@@ -1820,7 +1839,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1820
1839
 
1821
1840
 
1822
1841
  setTimeout(() => {
1823
- onBlur?.(event);
1842
+ onBlur?.(selectInputRef.current);
1824
1843
  }, 300);
1825
1844
  }
1826
1845
 
@@ -1957,6 +1976,19 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1957
1976
 
1958
1977
  }
1959
1978
 
1979
+ function handleDocOut(e: any) {
1980
+
1981
+ if (e.target.closest('.custom-select__options-wrapper') === null && e.target.closest('.custom-select__wrapper') === null) {
1982
+ // cancel
1983
+ cancel();
1984
+ if (MULTI_SEL_VALID) popwinPosHide();
1985
+
1986
+ //
1987
+ handleBlur(null);
1988
+ }
1989
+ }
1990
+
1991
+
1960
1992
  useEffect(() => {
1961
1993
 
1962
1994
 
@@ -2007,6 +2039,20 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
2007
2039
  }, []);
2008
2040
 
2009
2041
 
2042
+
2043
+ // Fixed an out-of-focus issue
2044
+ //--------------
2045
+ // !!! TIPS:
2046
+ // Fixed: When `fixFocusStatus()` is triggered, the above judgment will be invalidated, and this judgment will be used
2047
+ // Fixed: The pop-up window is not closed due to the mixing of business components
2048
+ useEffect(() => {
2049
+ document.addEventListener('pointerdown', handleDocOut);
2050
+ return () => {
2051
+ document.removeEventListener('pointerdown', handleDocOut);
2052
+ };
2053
+ }, [orginalData]); // Avoid the issue that `setOptionsData(orginalData)` sets the original value to empty on the first entry
2054
+
2055
+
2010
2056
  return (
2011
2057
  <>
2012
2058
 
@@ -2161,7 +2207,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
2161
2207
  {
2162
2208
  'reverse': isOpen
2163
2209
  }
2164
- )} style={{display: fetchTrigger ? 'none' : 'inline-block' }}>
2210
+ )} style={{display: MANUAL_REQ ? 'none' : 'inline-block' }}>
2165
2211
  {controlArrow ? controlArrow : <svg width="10px" height="10px" viewBox="0 -4.5 20 20">
2166
2212
  <g stroke="none" strokeWidth="1" fill="none">
2167
2213
  <g transform="translate(-180.000000, -6684.000000)" className="arrow-fill-g" fill="#a5a5a5">
@@ -2180,7 +2226,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
2180
2226
 
2181
2227
 
2182
2228
  {/* SEARCH BUTTON */}
2183
- {fetchTrigger ? <>
2229
+ {MANUAL_REQ ? <>
2184
2230
  <span className="custom-select-multi__control-searchbtn">
2185
2231
  <button tabIndex={-1} type="button" className="btn border-end-0 rounded-pill" onClick={(e: React.MouseEvent) => {
2186
2232
  handleFetch().then((response: any) => {
@@ -2223,25 +2269,113 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
2223
2269
  {typeof multiSelectSelectedItemOnlyStatus !== 'undefined' ? <>
2224
2270
 
2225
2271
  <li className="custom-select-multi__list-item-statusstring" >
2226
-
2227
- {typeof multiSelectSelectedItemOnlyStatus.itemsLabel === 'string' && controlArr.labels.length > 0 && controlArr.labels.length < optionsData.length ? multiSelectSelectedItemOnlyStatus.itemsLabel.replace('{num}', `${controlArr.labels.length}`) : null}
2228
- {typeof multiSelectSelectedItemOnlyStatus.noneLabel === 'string' && controlArr.labels.length === 0 ? multiSelectSelectedItemOnlyStatus.noneLabel : null}
2272
+
2273
+
2274
+ {MANUAL_REQ ? <>
2275
+ {/* ===================== Manual requests ===================== */}
2276
+ {
2277
+ typeof multiSelectSelectedItemOnlyStatus.itemsLabel === 'string' &&
2278
+ controlArr.labels.length > 0
2279
+ ?
2280
+ multiSelectSelectedItemOnlyStatus.itemsLabel.replace('{num}', `${controlArr.labels.length}`)
2281
+ :
2282
+ null
2283
+ }
2284
+ {
2285
+ typeof multiSelectSelectedItemOnlyStatus.noneLabel === 'string' &&
2286
+ controlArr.labels.length === 0
2287
+ ?
2288
+ multiSelectSelectedItemOnlyStatus.noneLabel
2289
+ :
2290
+ null
2291
+ }
2292
+
2293
+ {/*-- DEFAULT VALUE ---*/}
2294
+ {
2295
+ typeof multiSelectSelectedItemOnlyStatus.itemsLabel !== 'string' &&
2296
+ controlArr.labels.length > 0
2297
+ ?
2298
+ MULTI_SEL_SELECTED_STATUS.itemsLabel.replace('{num}', `${controlArr.labels.length}`)
2299
+ :
2300
+ null
2301
+ }
2302
+ {
2303
+ typeof multiSelectSelectedItemOnlyStatus.noneLabel !== 'string' &&
2304
+ controlArr.labels.length === 0
2305
+ ?
2306
+ MULTI_SEL_SELECTED_STATUS.noneLabel
2307
+ :
2308
+ null
2309
+ }
2310
+
2311
+ {/* ===================== /Manual requests ===================== */}
2229
2312
 
2230
- {/* all */}
2231
- {controlArr.labels.length > 0 ? <>
2232
- {typeof multiSelectSelectedItemOnlyStatus.allItemsLabel === 'string' && controlArr.labels.length === optionsData.length ? multiSelectSelectedItemOnlyStatus.allItemsLabel.replace('{num}', `${controlArr.labels.length}`) : null}
2233
- </>: null}
2313
+ </> : <>
2314
+ {/* ===================== Auto requests ===================== */}
2234
2315
 
2316
+ {
2317
+ typeof multiSelectSelectedItemOnlyStatus.itemsLabel === 'string' &&
2318
+ controlArr.labels.length > 0 &&
2319
+ controlArr.labels.length < optionsData.length
2320
+ ?
2321
+ multiSelectSelectedItemOnlyStatus.itemsLabel.replace('{num}', `${controlArr.labels.length}`)
2322
+ :
2323
+ null
2324
+ }
2325
+ {
2326
+ typeof multiSelectSelectedItemOnlyStatus.noneLabel === 'string' &&
2327
+ controlArr.labels.length === 0
2328
+ ?
2329
+ multiSelectSelectedItemOnlyStatus.noneLabel
2330
+ :
2331
+ null
2332
+ }
2235
2333
 
2236
- {/*-----*/}
2237
- {typeof multiSelectSelectedItemOnlyStatus.itemsLabel !== 'string' && controlArr.labels.length > 0 ? MULTI_SEL_SELECTED_STATUS.itemsLabel.replace('{num}', `${controlArr.labels.length}`) : null}
2238
- {typeof multiSelectSelectedItemOnlyStatus.noneLabel !== 'string' && controlArr.labels.length === 0 ? MULTI_SEL_SELECTED_STATUS.noneLabel : null}
2334
+ {/* all */}
2335
+ {controlArr.labels.length > 0 ? <>
2336
+ {
2337
+ typeof multiSelectSelectedItemOnlyStatus.allItemsLabel === 'string' &&
2338
+ controlArr.labels.length === optionsData.length
2339
+ ?
2340
+ multiSelectSelectedItemOnlyStatus.allItemsLabel.replace('{num}', `${controlArr.labels.length}`)
2341
+ :
2342
+ null
2343
+ }
2344
+ </>: null}
2239
2345
 
2240
- {/* all */}
2241
- {controlArr.labels.length > 0 ? <>
2242
- {typeof multiSelectSelectedItemOnlyStatus.allItemsLabel !== 'string' && controlArr.labels.length === optionsData.length ? MULTI_SEL_SELECTED_STATUS.allItemsLabel.replace('{num}', `${controlArr.labels.length}`) : null}
2243
- </>: null}
2244
2346
 
2347
+ {/*-- DEFAULT VALUE ---*/}
2348
+ {
2349
+ typeof multiSelectSelectedItemOnlyStatus.itemsLabel !== 'string' &&
2350
+ controlArr.labels.length > 0
2351
+ ?
2352
+ MULTI_SEL_SELECTED_STATUS.itemsLabel.replace('{num}', `${controlArr.labels.length}`)
2353
+ :
2354
+ null
2355
+ }
2356
+ {
2357
+ typeof multiSelectSelectedItemOnlyStatus.noneLabel !== 'string' &&
2358
+ controlArr.labels.length === 0
2359
+ ?
2360
+ MULTI_SEL_SELECTED_STATUS.noneLabel
2361
+ :
2362
+ null
2363
+ }
2364
+
2365
+ {/* all */}
2366
+ {controlArr.labels.length > 0 ? <>
2367
+ {
2368
+ typeof multiSelectSelectedItemOnlyStatus.allItemsLabel !== 'string' &&
2369
+ controlArr.labels.length === optionsData.length
2370
+ ?
2371
+ MULTI_SEL_SELECTED_STATUS.allItemsLabel.replace('{num}', `${controlArr.labels.length}`)
2372
+ :
2373
+ null
2374
+ }
2375
+ </>: null}
2376
+ {/* ===================== /Auto requests ===================== */}
2377
+
2378
+ </>}
2245
2379
 
2246
2380
  </li>
2247
2381
  </> : <>
@@ -2340,7 +2474,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
2340
2474
  {
2341
2475
  'reverse': isOpen
2342
2476
  }
2343
- )} style={{display: fetchTrigger ? 'none' : 'inline-block' }}>
2477
+ )} style={{display: MANUAL_REQ ? 'none' : 'inline-block' }}>
2344
2478
  {controlArrow ? controlArrow : <svg width="10px" height="10px" viewBox="0 -4.5 20 20">
2345
2479
  <g stroke="none" strokeWidth="1" fill="none">
2346
2480
  <g transform="translate(-180.000000, -6684.000000)" className="arrow-fill-g" fill="#a5a5a5">
@@ -2357,7 +2491,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
2357
2491
 
2358
2492
 
2359
2493
  {/* SEARCH BUTTON */}
2360
- {fetchTrigger ? <>
2494
+ {MANUAL_REQ ? <>
2361
2495
  <span className="custom-select-multi__control-searchbtn">
2362
2496
  <button tabIndex={-1} type="button" className="btn border-end-0 rounded-pill" onClick={(e: React.MouseEvent) => {
2363
2497
  handleFetch().then((response: any) => {
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.3.555",
5
+ "version": "4.3.721",
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",