funda-ui 4.7.555 → 4.7.560

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
@@ -3995,6 +3995,9 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
3995
3995
  setTimeout(function () {
3996
3996
  popwinPosInit();
3997
3997
  popwinFilterItems(val);
3998
+
3999
+ // Fix popup position after fetch loading completes
4000
+ fixPopupPositionAfterFetch();
3998
4001
  }, 0);
3999
4002
  setFetchLoading(false);
4000
4003
  });
@@ -4594,13 +4597,14 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4594
4597
  if (listContentRef.current === null) return;
4595
4598
  var _btnSelectAll = listContentRef.current.querySelector('.custom-select-multi__control-option-item--select-all');
4596
4599
  var _noDataDiv = listContentRef.current.querySelector('.custom-select-multi__control-option-item--nomatch');
4597
- var emptyFieldsCheck = [].slice.call(listContentRef.current.querySelectorAll('.custom-select-multi__control-option-item')).every(function (node) {
4600
+ var _items = [].slice.call(listContentRef.current.querySelectorAll('.custom-select-multi__control-option-item'));
4601
+ var itemsDoNotExist = _items.every(function (node) {
4598
4602
  if (!node.classList.contains('hide')) {
4599
4603
  return false;
4600
4604
  }
4601
4605
  return true;
4602
4606
  });
4603
- if (emptyFieldsCheck) {
4607
+ if (itemsDoNotExist) {
4604
4608
  _noDataDiv.classList.remove('hide');
4605
4609
  if (_btnSelectAll !== null) _btnSelectAll.classList.add('hide');
4606
4610
  } else {
@@ -4618,6 +4622,25 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4618
4622
  //
4619
4623
  if (selectInputRef.current) selectInputRef.current.value = '';
4620
4624
  }
4625
+ function fixPopupPositionAfterFetch() {
4626
+ if (listContentRef.current === null || !isOpen) return;
4627
+
4628
+ // Get the current position data
4629
+ var currentPos = listContentRef.current.dataset.pos;
4630
+ if (currentPos === 'top') {
4631
+ // Recalculate position for upward popup to fix offset issues
4632
+ var _modalRef = document.querySelector("#custom-select__options-wrapper-".concat(idRes));
4633
+ if (_modalRef && rootRef.current && selectInputRef.current) {
4634
+ var _getAbsolutePositionO3 = (0,getElementProperty.getAbsolutePositionOfStage)(rootRef.current),
4635
+ x = _getAbsolutePositionO3.x;
4636
+ var _getAbsolutePositionO4 = (0,getElementProperty.getAbsolutePositionOfStage)(selectInputRef.current),
4637
+ y = _getAbsolutePositionO4.y;
4638
+ _modalRef.style.left = x + 'px';
4639
+ var topPosition = y - POS_OFFSET - listContentRef.current.clientHeight - 2;
4640
+ _modalRef.style.top = topPosition + 'px';
4641
+ }
4642
+ }
4643
+ }
4621
4644
  function cancel() {
4622
4645
  // hide list
4623
4646
  setIsOpen(false);
@@ -5468,6 +5491,15 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
5468
5491
  }
5469
5492
  }
5470
5493
 
5494
+ // Select all detection functions in the input box (for "Single selection")
5495
+ function checkUserInputboxIsAllSelected(e) {
5496
+ var input = e.target;
5497
+ if (input && typeof input.selectionStart === 'number' && typeof input.selectionEnd === 'number') {
5498
+ setUserInputboxIsAllSelected(input.selectionStart === 0 && input.selectionEnd === input.value.length && input.value.length > 0);
5499
+ } else {
5500
+ setUserInputboxIsAllSelected(false);
5501
+ }
5502
+ }
5471
5503
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
5472
5504
  // Call a function when the component has been rendered completely
5473
5505
  //--------------
@@ -5619,15 +5651,6 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
5619
5651
  };
5620
5652
  }, [orginalData]); // Avoid the issue that `setOptionsData(orginalData)` sets the original value to empty on the first entry
5621
5653
 
5622
- // Select all detection functions in the input box (for "Single selection")
5623
- function checkUserInputboxIsAllSelected(e) {
5624
- var input = e.target;
5625
- if (input && typeof input.selectionStart === 'number' && typeof input.selectionEnd === 'number') {
5626
- setUserInputboxIsAllSelected(input.selectionStart === 0 && input.selectionEnd === input.value.length && input.value.length > 0);
5627
- } else {
5628
- setUserInputboxIsAllSelected(false);
5629
- }
5630
- }
5631
5654
  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", {
5632
5655
  className: "custom-select__label"
5633
5656
  }, typeof label === 'string' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("label", {
@@ -5828,6 +5851,9 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
5828
5851
  setTimeout(function () {
5829
5852
  popwinPosInit();
5830
5853
  popwinFilterItems(controlTempValue);
5854
+
5855
+ // Fix popup position after fetch loading completes
5856
+ fixPopupPositionAfterFetch();
5831
5857
  }, 0);
5832
5858
  });
5833
5859
  }
@@ -5953,6 +5979,9 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
5953
5979
  setTimeout(function () {
5954
5980
  popwinPosInit();
5955
5981
  popwinFilterItems(controlTempValue);
5982
+
5983
+ // Fix popup position after fetch loading completes
5984
+ fixPopupPositionAfterFetch();
5956
5985
  }, 0);
5957
5986
  });
5958
5987
  }
@@ -3995,6 +3995,9 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
3995
3995
  setTimeout(function () {
3996
3996
  popwinPosInit();
3997
3997
  popwinFilterItems(val);
3998
+
3999
+ // Fix popup position after fetch loading completes
4000
+ fixPopupPositionAfterFetch();
3998
4001
  }, 0);
3999
4002
  setFetchLoading(false);
4000
4003
  });
@@ -4594,13 +4597,14 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4594
4597
  if (listContentRef.current === null) return;
4595
4598
  var _btnSelectAll = listContentRef.current.querySelector('.custom-select-multi__control-option-item--select-all');
4596
4599
  var _noDataDiv = listContentRef.current.querySelector('.custom-select-multi__control-option-item--nomatch');
4597
- var emptyFieldsCheck = [].slice.call(listContentRef.current.querySelectorAll('.custom-select-multi__control-option-item')).every(function (node) {
4600
+ var _items = [].slice.call(listContentRef.current.querySelectorAll('.custom-select-multi__control-option-item'));
4601
+ var itemsDoNotExist = _items.every(function (node) {
4598
4602
  if (!node.classList.contains('hide')) {
4599
4603
  return false;
4600
4604
  }
4601
4605
  return true;
4602
4606
  });
4603
- if (emptyFieldsCheck) {
4607
+ if (itemsDoNotExist) {
4604
4608
  _noDataDiv.classList.remove('hide');
4605
4609
  if (_btnSelectAll !== null) _btnSelectAll.classList.add('hide');
4606
4610
  } else {
@@ -4618,6 +4622,25 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4618
4622
  //
4619
4623
  if (selectInputRef.current) selectInputRef.current.value = '';
4620
4624
  }
4625
+ function fixPopupPositionAfterFetch() {
4626
+ if (listContentRef.current === null || !isOpen) return;
4627
+
4628
+ // Get the current position data
4629
+ var currentPos = listContentRef.current.dataset.pos;
4630
+ if (currentPos === 'top') {
4631
+ // Recalculate position for upward popup to fix offset issues
4632
+ var _modalRef = document.querySelector("#custom-select__options-wrapper-".concat(idRes));
4633
+ if (_modalRef && rootRef.current && selectInputRef.current) {
4634
+ var _getAbsolutePositionO3 = (0,getElementProperty.getAbsolutePositionOfStage)(rootRef.current),
4635
+ x = _getAbsolutePositionO3.x;
4636
+ var _getAbsolutePositionO4 = (0,getElementProperty.getAbsolutePositionOfStage)(selectInputRef.current),
4637
+ y = _getAbsolutePositionO4.y;
4638
+ _modalRef.style.left = x + 'px';
4639
+ var topPosition = y - POS_OFFSET - listContentRef.current.clientHeight - 2;
4640
+ _modalRef.style.top = topPosition + 'px';
4641
+ }
4642
+ }
4643
+ }
4621
4644
  function cancel() {
4622
4645
  // hide list
4623
4646
  setIsOpen(false);
@@ -5468,6 +5491,15 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
5468
5491
  }
5469
5492
  }
5470
5493
 
5494
+ // Select all detection functions in the input box (for "Single selection")
5495
+ function checkUserInputboxIsAllSelected(e) {
5496
+ var input = e.target;
5497
+ if (input && typeof input.selectionStart === 'number' && typeof input.selectionEnd === 'number') {
5498
+ setUserInputboxIsAllSelected(input.selectionStart === 0 && input.selectionEnd === input.value.length && input.value.length > 0);
5499
+ } else {
5500
+ setUserInputboxIsAllSelected(false);
5501
+ }
5502
+ }
5471
5503
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
5472
5504
  // Call a function when the component has been rendered completely
5473
5505
  //--------------
@@ -5619,15 +5651,6 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
5619
5651
  };
5620
5652
  }, [orginalData]); // Avoid the issue that `setOptionsData(orginalData)` sets the original value to empty on the first entry
5621
5653
 
5622
- // Select all detection functions in the input box (for "Single selection")
5623
- function checkUserInputboxIsAllSelected(e) {
5624
- var input = e.target;
5625
- if (input && typeof input.selectionStart === 'number' && typeof input.selectionEnd === 'number') {
5626
- setUserInputboxIsAllSelected(input.selectionStart === 0 && input.selectionEnd === input.value.length && input.value.length > 0);
5627
- } else {
5628
- setUserInputboxIsAllSelected(false);
5629
- }
5630
- }
5631
5654
  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", {
5632
5655
  className: "custom-select__label"
5633
5656
  }, typeof label === 'string' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("label", {
@@ -5828,6 +5851,9 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
5828
5851
  setTimeout(function () {
5829
5852
  popwinPosInit();
5830
5853
  popwinFilterItems(controlTempValue);
5854
+
5855
+ // Fix popup position after fetch loading completes
5856
+ fixPopupPositionAfterFetch();
5831
5857
  }, 0);
5832
5858
  });
5833
5859
  }
@@ -5953,6 +5979,9 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
5953
5979
  setTimeout(function () {
5954
5980
  popwinPosInit();
5955
5981
  popwinFilterItems(controlTempValue);
5982
+
5983
+ // Fix popup position after fetch loading completes
5984
+ fixPopupPositionAfterFetch();
5956
5985
  }, 0);
5957
5986
  });
5958
5987
  }
@@ -47,7 +47,6 @@ import {
47
47
  import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
48
48
 
49
49
 
50
-
51
50
  export interface MultiSelectValue {
52
51
  items: { label: string; value: string }[];
53
52
  labels: string[];
@@ -273,7 +272,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
273
272
 
274
273
 
275
274
  // loading
276
- const [fetchLoading, setFetchLoading] = useState(false);
275
+ const [fetchLoading, setFetchLoading] = useState<boolean>(false);
277
276
  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></>;
278
277
 
279
278
 
@@ -500,21 +499,27 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
500
499
 
501
500
  // Make a request
502
501
  handleFetch(val).then((response: any) => {
503
-
502
+
504
503
  // pop win initalization
505
504
  setTimeout(() => {
506
505
  popwinPosInit();
507
506
  popwinFilterItems(val);
507
+
508
+ // Fix popup position after fetch loading completes
509
+ fixPopupPositionAfterFetch();
510
+
508
511
  }, 0);
509
512
 
510
513
  setFetchLoading(false);
511
514
  });
512
515
  } else {
516
+
513
517
 
514
518
  // pop win initalization
515
519
  setTimeout(() => {
516
520
  popwinPosInit();
517
521
  popwinFilterItems(val);
522
+
518
523
  }, 0);
519
524
 
520
525
  setFetchLoading(false);
@@ -1190,14 +1195,15 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1190
1195
 
1191
1196
  const _btnSelectAll = listContentRef.current.querySelector('.custom-select-multi__control-option-item--select-all');
1192
1197
  const _noDataDiv = listContentRef.current.querySelector('.custom-select-multi__control-option-item--nomatch');
1193
- const emptyFieldsCheck = [].slice.call(listContentRef.current.querySelectorAll('.custom-select-multi__control-option-item')).every((node: any) => {
1198
+ const _items = [].slice.call(listContentRef.current.querySelectorAll('.custom-select-multi__control-option-item'));
1199
+ const itemsDoNotExist = _items.every((node: any) => {
1194
1200
  if (!node.classList.contains('hide')) {
1195
1201
  return false;
1196
1202
  }
1197
1203
  return true;
1198
1204
  });
1199
1205
 
1200
- if (emptyFieldsCheck) {
1206
+ if (itemsDoNotExist) {
1201
1207
  _noDataDiv.classList.remove('hide');
1202
1208
  if (_btnSelectAll !== null) _btnSelectAll.classList.add('hide');
1203
1209
  } else {
@@ -1221,6 +1227,28 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1221
1227
 
1222
1228
  }
1223
1229
 
1230
+
1231
+ function fixPopupPositionAfterFetch() {
1232
+ if (listContentRef.current === null || !isOpen) return;
1233
+
1234
+ // Get the current position data
1235
+ const currentPos = listContentRef.current.dataset.pos;
1236
+
1237
+ if (currentPos === 'top') {
1238
+ // Recalculate position for upward popup to fix offset issues
1239
+ const _modalRef: any = document.querySelector(`#custom-select__options-wrapper-${idRes}`);
1240
+ if (_modalRef && rootRef.current && selectInputRef.current) {
1241
+ const { x } = getAbsolutePositionOfStage(rootRef.current);
1242
+ const { y } = getAbsolutePositionOfStage(selectInputRef.current);
1243
+
1244
+ _modalRef.style.left = x + 'px';
1245
+ const topPosition = y - POS_OFFSET - (listContentRef.current.clientHeight) - 2;
1246
+ _modalRef.style.top = topPosition + 'px';
1247
+ }
1248
+ }
1249
+ }
1250
+
1251
+
1224
1252
  function cancel() {
1225
1253
  // hide list
1226
1254
  setIsOpen(false);
@@ -2112,6 +2140,17 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
2112
2140
  }
2113
2141
 
2114
2142
 
2143
+ // Select all detection functions in the input box (for "Single selection")
2144
+ function checkUserInputboxIsAllSelected(e: any) {
2145
+ const input = e.target;
2146
+ if (input && typeof input.selectionStart === 'number' && typeof input.selectionEnd === 'number') {
2147
+ setUserInputboxIsAllSelected(input.selectionStart === 0 && input.selectionEnd === input.value.length && input.value.length > 0);
2148
+ } else {
2149
+ setUserInputboxIsAllSelected(false);
2150
+ }
2151
+ }
2152
+
2153
+
2115
2154
  useEffect(() => {
2116
2155
 
2117
2156
  // Call a function when the component has been rendered completely
@@ -2278,15 +2317,6 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
2278
2317
  }, [orginalData]); // Avoid the issue that `setOptionsData(orginalData)` sets the original value to empty on the first entry
2279
2318
 
2280
2319
 
2281
- // Select all detection functions in the input box (for "Single selection")
2282
- function checkUserInputboxIsAllSelected(e: any) {
2283
- const input = e.target;
2284
- if (input && typeof input.selectionStart === 'number' && typeof input.selectionEnd === 'number') {
2285
- setUserInputboxIsAllSelected(input.selectionStart === 0 && input.selectionEnd === input.value.length && input.value.length > 0);
2286
- } else {
2287
- setUserInputboxIsAllSelected(false);
2288
- }
2289
- }
2290
2320
 
2291
2321
 
2292
2322
  return (
@@ -2515,6 +2545,10 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
2515
2545
  setTimeout(() => {
2516
2546
  popwinPosInit();
2517
2547
  popwinFilterItems(controlTempValue);
2548
+
2549
+ // Fix popup position after fetch loading completes
2550
+ fixPopupPositionAfterFetch();
2551
+
2518
2552
  }, 0);
2519
2553
  });
2520
2554
 
@@ -2787,6 +2821,10 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
2787
2821
  setTimeout(() => {
2788
2822
  popwinPosInit();
2789
2823
  popwinFilterItems(controlTempValue);
2824
+
2825
+ // Fix popup position after fetch loading completes
2826
+ fixPopupPositionAfterFetch();
2827
+
2790
2828
  }, 0);
2791
2829
  });
2792
2830
  }}>
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.555",
5
+ "version": "4.7.560",
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",