funda-ui 4.3.555 → 4.4.15

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.
Files changed (63) hide show
  1. package/Date/index.js +104 -0
  2. package/EventCalendar/index.css +7 -0
  3. package/EventCalendar/index.d.ts +2 -0
  4. package/EventCalendar/index.js +228 -89
  5. package/EventCalendarTimeline/index.css +29 -1
  6. package/EventCalendarTimeline/index.d.ts +11 -1
  7. package/EventCalendarTimeline/index.js +796 -298
  8. package/MultipleSelect/index.js +1 -1
  9. package/NativeSelect/index.js +1 -1
  10. package/Select/index.css +17 -0
  11. package/Select/index.d.ts +1 -0
  12. package/Select/index.js +83 -38
  13. package/Table/index.d.ts +4 -4
  14. package/Table/index.js +17 -17
  15. package/Tree/index.js +1 -1
  16. package/Utils/date.d.ts +27 -1
  17. package/Utils/date.js +92 -0
  18. package/lib/cjs/Date/index.js +104 -0
  19. package/lib/cjs/EventCalendar/index.d.ts +2 -0
  20. package/lib/cjs/EventCalendar/index.js +228 -89
  21. package/lib/cjs/EventCalendarTimeline/index.d.ts +11 -1
  22. package/lib/cjs/EventCalendarTimeline/index.js +796 -298
  23. package/lib/cjs/MultipleSelect/index.js +1 -1
  24. package/lib/cjs/NativeSelect/index.js +1 -1
  25. package/lib/cjs/Select/index.d.ts +1 -0
  26. package/lib/cjs/Select/index.js +83 -38
  27. package/lib/cjs/Table/index.d.ts +4 -4
  28. package/lib/cjs/Table/index.js +17 -17
  29. package/lib/cjs/Tree/index.js +1 -1
  30. package/lib/cjs/Utils/date.d.ts +27 -1
  31. package/lib/cjs/Utils/date.js +92 -0
  32. package/lib/css/EventCalendar/index.css +7 -0
  33. package/lib/css/EventCalendarTimeline/index.css +29 -1
  34. package/lib/css/Select/index.css +17 -0
  35. package/lib/esm/EventCalendar/index.scss +9 -0
  36. package/lib/esm/EventCalendar/index.tsx +203 -156
  37. package/lib/esm/EventCalendarTimeline/index.scss +46 -1
  38. package/lib/esm/EventCalendarTimeline/index.tsx +815 -358
  39. package/lib/esm/MultipleSelect/ItemList.tsx +1 -1
  40. package/lib/esm/MultipleSelect/index.tsx +1 -1
  41. package/lib/esm/NativeSelect/index.tsx +1 -1
  42. package/lib/esm/Select/index.scss +36 -1
  43. package/lib/esm/Select/index.tsx +179 -30
  44. package/lib/esm/Table/Table.tsx +2 -2
  45. package/lib/esm/Table/TableCell.tsx +2 -2
  46. package/lib/esm/Table/TableRow.tsx +1 -1
  47. package/lib/esm/Table/index.tsx +4 -4
  48. package/lib/esm/Tree/TreeList.tsx +1 -1
  49. package/lib/esm/Utils/libs/date.ts +101 -1
  50. package/package.json +1 -1
  51. /package/lib/esm/MultipleSelect/{multiple-select-utils → utils}/func.ts +0 -0
  52. /package/lib/esm/NativeSelect/{native-select-utils → utils}/func.ts +0 -0
  53. /package/lib/esm/Select/{select-utils → utils}/func.ts +0 -0
  54. /package/lib/esm/Table/{table-utils → utils}/DragHandleSprite.tsx +0 -0
  55. /package/lib/esm/Table/{table-utils → utils}/SortSprite.tsx +0 -0
  56. /package/lib/esm/Table/{table-utils → utils}/TableFilter.tsx +0 -0
  57. /package/lib/esm/Table/{table-utils → utils}/ToggleSelection.tsx +0 -0
  58. /package/lib/esm/Table/{table-utils → utils}/func.ts +0 -0
  59. /package/lib/esm/Table/{table-utils → utils}/hooks/useTableDraggable.tsx +0 -0
  60. /package/lib/esm/Table/{table-utils → utils}/hooks/useTableKeyPress.tsx +0 -0
  61. /package/lib/esm/Table/{table-utils → utils}/hooks/useTableResponsive.tsx +0 -0
  62. /package/lib/esm/Table/{table-utils → utils}/hooks/useTableSort.tsx +0 -0
  63. /package/lib/esm/Tree/{tree-utils.ts → utils/func.ts} +0 -0
@@ -8,7 +8,7 @@ import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
8
8
 
9
9
 
10
10
 
11
- import { formatIndentVal, multiSelControlOptionExist } from './multiple-select-utils/func';
11
+ import { formatIndentVal, multiSelControlOptionExist } from './utils/func';
12
12
 
13
13
  /* Recursively nested components to traverse nodes
14
14
  -------------------------------------------------*/
@@ -22,7 +22,7 @@ import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
22
22
 
23
23
 
24
24
 
25
- import { multiSelControlOptionExist, uniqueArr } from './multiple-select-utils/func';
25
+ import { multiSelControlOptionExist, uniqueArr } from './utils/func';
26
26
  import ItemList from './ItemList';
27
27
 
28
28
 
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState, useRef, forwardRef } from 'react';
2
2
 
3
- import { optionsFlat, isObject } from './native-select-utils/func';
3
+ import { optionsFlat, isObject } from './utils/func';
4
4
 
5
5
 
6
6
  import useComId from 'funda-utils/dist/cjs/useComId';
@@ -376,6 +376,7 @@
376
376
  --cus-sel-listgroup-popwin-min-width: 200px;
377
377
  --cus-sel-listgroup-tool-bg: rgb(248,249,250);
378
378
  --cus-sel-listgroup-checkbox: #a5a5a5;
379
+ --cus-sel-listgroup-checkbox-active: #3162B2;
379
380
  --cus-sel-listgroup-item-hover-focus-bg: rgba(0,0,0,.1);
380
381
  --cus-sel-listgroup-content-scrollbar-color: rgba(0, 0, 0, 0.2);
381
382
  --cus-sel-listgroup-content-scrollbar-track: rgba(0, 0, 0, 0);
@@ -384,6 +385,8 @@
384
385
  --cus-sel-listgroup-groupborder-color: #d8d8d8;
385
386
 
386
387
 
388
+
389
+
387
390
  display: none;
388
391
  min-width: var(--cus-sel-listgroup-popwin-min-width);
389
392
  z-index: 1055; /* --bs-modal-zindex */
@@ -463,10 +466,31 @@
463
466
 
464
467
  }
465
468
 
469
+
466
470
 
471
+ /* ITEM SELECTED */
467
472
  &.item-selected {
473
+
474
+ .custom-select-multi__control-option-checkbox-placeholder {
475
+ svg {
476
+ path {
477
+ stroke: var(--cus-sel-listgroup-checkbox-active);
478
+ }
479
+ }
480
+
481
+ }
482
+
483
+
484
+ .custom-select-multi__control-option-checkbox-selected {
485
+ svg {
486
+ fill: var(--cus-sel-listgroup-checkbox-active);
468
487
 
469
-
488
+ path {
489
+ stroke: var(--cus-sel-listgroup-checkbox-active);
490
+ }
491
+ }
492
+
493
+ }
470
494
 
471
495
  }
472
496
 
@@ -475,8 +499,19 @@
475
499
  background-color: var(--cus-sel-listgroup-item-hover-focus-bg);
476
500
  }
477
501
 
502
+
478
503
  }
479
504
 
505
+ /*------ Multiple selection ------*/
506
+ &.multiple-selection {
507
+ .list-group-item {
508
+ &.active {
509
+ border-top-width: 0;
510
+ }
511
+ }
512
+ }
513
+
514
+
480
515
 
481
516
  /*------ Group ------*/
482
517
  .custom-select-grouptitle {
@@ -7,7 +7,7 @@ import {
7
7
  removeItemOnce,
8
8
  optionsCustomSelectFlat,
9
9
  isObject
10
- } from './select-utils/func';
10
+ } from './utils/func';
11
11
 
12
12
 
13
13
  import RootPortal from 'funda-root-portal';
@@ -154,6 +154,7 @@ export type SelectProps = {
154
154
  onChange?: SelectOptionChangeFnType | null;
155
155
  onBlur?: (e: any) => void;
156
156
  onFocus?: (e: any) => void;
157
+ onKeyPressed?: (arg1: any, arg2: any, arg3: any) => void;
157
158
  };
158
159
 
159
160
 
@@ -209,13 +210,14 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
209
210
  onChange,
210
211
  onBlur,
211
212
  onFocus,
213
+ onKeyPressed,
212
214
  ...attributes
213
215
  } = props;
214
216
 
215
217
 
216
218
  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)
219
+ const MANUAL_REQ = typeof fetchTrigger !== 'undefined' && fetchTrigger === true ? true : false; // Manual requests
220
+ 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
221
 
220
222
 
221
223
  const FIRST_REQUEST_AUTO = typeof firstRequestAutoExec === 'undefined' ? true : firstRequestAutoExec;
@@ -414,7 +416,6 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
414
416
  //performance
415
417
  const handleChangeFetchSafe = useDebounce((val: any) => {
416
418
 
417
-
418
419
  let _orginalData: OptionConfig[] = [];
419
420
  const update = (inputData: any) => {
420
421
  const filterRes = () => {
@@ -533,7 +534,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
533
534
  let filterRes: any = [];
534
535
 
535
536
 
536
- if (fetchTrigger) {
537
+ if (MANUAL_REQ) {
537
538
 
538
539
  // If a manual action is used to trigger the request
539
540
  if (typeof fetchTriggerForDefaultData !== 'undefined' && fetchTriggerForDefaultData !== null && typeof fetchTriggerForDefaultData?.values[0] !== 'undefined') {
@@ -1131,7 +1132,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1131
1132
  if (!MULTI_SEL_VALID) popwinPosHide();
1132
1133
 
1133
1134
 
1134
- if (LIVE_SEARCH_OK) {
1135
+ if (MANUAL_REQ) {
1135
1136
  // clean data
1136
1137
  setOptionsData([]);
1137
1138
  } else {
@@ -1173,6 +1174,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1173
1174
  setIsOpen(true);
1174
1175
 
1175
1176
 
1177
+
1176
1178
  // pop win initalization
1177
1179
  setTimeout(() => {
1178
1180
  popwinPosInit();
@@ -1189,7 +1191,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1189
1191
 
1190
1192
 
1191
1193
 
1192
- if (LIVE_SEARCH_OK) {
1194
+ if (MANUAL_REQ) {
1193
1195
  // clean data
1194
1196
  setOptionsData([]);
1195
1197
  } else {
@@ -1198,6 +1200,11 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1198
1200
  }
1199
1201
 
1200
1202
 
1203
+ // When you select multiple times, it automatically focuses on the search input box
1204
+ if (MULTI_SEL_VALID) {
1205
+ selectInputRef.current.select();
1206
+ }
1207
+
1201
1208
  // update temporary value
1202
1209
  setControlTempValue('');
1203
1210
 
@@ -1211,6 +1218,12 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1211
1218
 
1212
1219
 
1213
1220
  }
1221
+
1222
+
1223
+ function fixFocusStatus() {
1224
+ // When selecting multiple times, in order to avoid losing
1225
+ if (MULTI_SEL_VALID) handleFocus(selectInputRef.current);
1226
+ }
1214
1227
 
1215
1228
  async function handleSelect(el: any, dataInput: any = false, valueArr: any[] = [], labelArr: any[] = []) {
1216
1229
 
@@ -1546,7 +1559,8 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1546
1559
  }
1547
1560
  }
1548
1561
 
1549
-
1562
+ // Fixed an out-of-focus issue
1563
+ fixFocusStatus();
1550
1564
 
1551
1565
  }
1552
1566
 
@@ -1656,6 +1670,9 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1656
1670
  multipleSelectionCallback(_values, _labels)
1657
1671
  );
1658
1672
 
1673
+ // Fixed an out-of-focus issue
1674
+ fixFocusStatus();
1675
+
1659
1676
 
1660
1677
  }
1661
1678
 
@@ -1757,7 +1774,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1757
1774
 
1758
1775
  async function handleFirstFetch(inputVal: any = null) {
1759
1776
  const _oparams: any[] = fetchFuncMethodParams || [];
1760
- const _params: any[] = _oparams.map((item: any) => item !== '$QUERY_STRING' ? item : (fetchTrigger ? '------' : ''));
1777
+ const _params: any[] = _oparams.map((item: any) => item !== '$QUERY_STRING' ? item : (MANUAL_REQ ? '------' : ''));
1761
1778
  const res = await fetchData((_params).join(','), finalRes(inputVal), inputVal);
1762
1779
 
1763
1780
  return res;
@@ -1787,6 +1804,9 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1787
1804
  //
1788
1805
  handleChangeFetchSafe(val);
1789
1806
 
1807
+ // Fixed an out-of-focus issue
1808
+ fixFocusStatus();
1809
+
1790
1810
 
1791
1811
  }
1792
1812
 
@@ -1798,8 +1818,10 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1798
1818
  // update temporary value
1799
1819
  setControlTempValue('');
1800
1820
 
1821
+
1801
1822
  //
1802
- onFocus?.(event);
1823
+ onFocus?.(selectInputRef.current);
1824
+
1803
1825
  }
1804
1826
 
1805
1827
  function handleBlur(event: any) {
@@ -1820,7 +1842,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1820
1842
 
1821
1843
 
1822
1844
  setTimeout(() => {
1823
- onBlur?.(event);
1845
+ onBlur?.(selectInputRef.current);
1824
1846
  }, 300);
1825
1847
  }
1826
1848
 
@@ -1883,6 +1905,14 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1883
1905
  async function handleKeyPressed(event: KeyboardEvent<HTMLDivElement>) {
1884
1906
  const key = event.code;
1885
1907
 
1908
+ //
1909
+ onKeyPressed?.(
1910
+ event,
1911
+ selectInputRef.current,
1912
+ valueInputRef.current
1913
+ );
1914
+
1915
+
1886
1916
  if (!isOpen) return;
1887
1917
 
1888
1918
  let res: any = null;
@@ -1957,6 +1987,18 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1957
1987
 
1958
1988
  }
1959
1989
 
1990
+ function handleDocOut(e: any) {
1991
+
1992
+ if (e.target.closest('.custom-select__options-wrapper') === null && e.target.closest('.custom-select__wrapper') === null) {
1993
+ // cancel
1994
+ cancel();
1995
+ if (MULTI_SEL_VALID) popwinPosHide();
1996
+
1997
+ // DO NOT USE "handleBlur(null)"
1998
+ }
1999
+ }
2000
+
2001
+
1960
2002
  useEffect(() => {
1961
2003
 
1962
2004
 
@@ -2007,6 +2049,20 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
2007
2049
  }, []);
2008
2050
 
2009
2051
 
2052
+
2053
+ // Fixed an out-of-focus issue
2054
+ //--------------
2055
+ // !!! TIPS:
2056
+ // Fixed: When `fixFocusStatus()` is triggered, the above judgment will be invalidated, and this judgment will be used
2057
+ // Fixed: The pop-up window is not closed due to the mixing of business components
2058
+ useEffect(() => {
2059
+ document.addEventListener('pointerdown', handleDocOut);
2060
+ return () => {
2061
+ document.removeEventListener('pointerdown', handleDocOut);
2062
+ };
2063
+ }, [orginalData]); // Avoid the issue that `setOptionsData(orginalData)` sets the original value to empty on the first entry
2064
+
2065
+
2010
2066
  return (
2011
2067
  <>
2012
2068
 
@@ -2161,7 +2217,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
2161
2217
  {
2162
2218
  'reverse': isOpen
2163
2219
  }
2164
- )} style={{display: fetchTrigger ? 'none' : 'inline-block' }}>
2220
+ )} style={{display: MANUAL_REQ ? 'none' : 'inline-block' }}>
2165
2221
  {controlArrow ? controlArrow : <svg width="10px" height="10px" viewBox="0 -4.5 20 20">
2166
2222
  <g stroke="none" strokeWidth="1" fill="none">
2167
2223
  <g transform="translate(-180.000000, -6684.000000)" className="arrow-fill-g" fill="#a5a5a5">
@@ -2180,7 +2236,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
2180
2236
 
2181
2237
 
2182
2238
  {/* SEARCH BUTTON */}
2183
- {fetchTrigger ? <>
2239
+ {MANUAL_REQ ? <>
2184
2240
  <span className="custom-select-multi__control-searchbtn">
2185
2241
  <button tabIndex={-1} type="button" className="btn border-end-0 rounded-pill" onClick={(e: React.MouseEvent) => {
2186
2242
  handleFetch().then((response: any) => {
@@ -2223,25 +2279,113 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
2223
2279
  {typeof multiSelectSelectedItemOnlyStatus !== 'undefined' ? <>
2224
2280
 
2225
2281
  <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}
2282
+
2283
+
2284
+ {MANUAL_REQ ? <>
2285
+ {/* ===================== Manual requests ===================== */}
2286
+ {
2287
+ typeof multiSelectSelectedItemOnlyStatus.itemsLabel === 'string' &&
2288
+ controlArr.labels.length > 0
2289
+ ?
2290
+ multiSelectSelectedItemOnlyStatus.itemsLabel.replace('{num}', `${controlArr.labels.length}`)
2291
+ :
2292
+ null
2293
+ }
2294
+ {
2295
+ typeof multiSelectSelectedItemOnlyStatus.noneLabel === 'string' &&
2296
+ controlArr.labels.length === 0
2297
+ ?
2298
+ multiSelectSelectedItemOnlyStatus.noneLabel
2299
+ :
2300
+ null
2301
+ }
2229
2302
 
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}
2303
+ {/*-- DEFAULT VALUE ---*/}
2304
+ {
2305
+ typeof multiSelectSelectedItemOnlyStatus.itemsLabel !== 'string' &&
2306
+ controlArr.labels.length > 0
2307
+ ?
2308
+ MULTI_SEL_SELECTED_STATUS.itemsLabel.replace('{num}', `${controlArr.labels.length}`)
2309
+ :
2310
+ null
2311
+ }
2312
+ {
2313
+ typeof multiSelectSelectedItemOnlyStatus.noneLabel !== 'string' &&
2314
+ controlArr.labels.length === 0
2315
+ ?
2316
+ MULTI_SEL_SELECTED_STATUS.noneLabel
2317
+ :
2318
+ null
2319
+ }
2234
2320
 
2321
+ {/* ===================== /Manual requests ===================== */}
2235
2322
 
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}
2323
+ </> : <>
2324
+ {/* ===================== Auto requests ===================== */}
2239
2325
 
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}
2326
+ {
2327
+ typeof multiSelectSelectedItemOnlyStatus.itemsLabel === 'string' &&
2328
+ controlArr.labels.length > 0 &&
2329
+ controlArr.labels.length < optionsData.length
2330
+ ?
2331
+ multiSelectSelectedItemOnlyStatus.itemsLabel.replace('{num}', `${controlArr.labels.length}`)
2332
+ :
2333
+ null
2334
+ }
2335
+ {
2336
+ typeof multiSelectSelectedItemOnlyStatus.noneLabel === 'string' &&
2337
+ controlArr.labels.length === 0
2338
+ ?
2339
+ multiSelectSelectedItemOnlyStatus.noneLabel
2340
+ :
2341
+ null
2342
+ }
2343
+
2344
+ {/* all */}
2345
+ {controlArr.labels.length > 0 ? <>
2346
+ {
2347
+ typeof multiSelectSelectedItemOnlyStatus.allItemsLabel === 'string' &&
2348
+ controlArr.labels.length === optionsData.length
2349
+ ?
2350
+ multiSelectSelectedItemOnlyStatus.allItemsLabel.replace('{num}', `${controlArr.labels.length}`)
2351
+ :
2352
+ null
2353
+ }
2354
+ </>: null}
2355
+
2356
+
2357
+ {/*-- DEFAULT VALUE ---*/}
2358
+ {
2359
+ typeof multiSelectSelectedItemOnlyStatus.itemsLabel !== 'string' &&
2360
+ controlArr.labels.length > 0
2361
+ ?
2362
+ MULTI_SEL_SELECTED_STATUS.itemsLabel.replace('{num}', `${controlArr.labels.length}`)
2363
+ :
2364
+ null
2365
+ }
2366
+ {
2367
+ typeof multiSelectSelectedItemOnlyStatus.noneLabel !== 'string' &&
2368
+ controlArr.labels.length === 0
2369
+ ?
2370
+ MULTI_SEL_SELECTED_STATUS.noneLabel
2371
+ :
2372
+ null
2373
+ }
2374
+
2375
+ {/* all */}
2376
+ {controlArr.labels.length > 0 ? <>
2377
+ {
2378
+ typeof multiSelectSelectedItemOnlyStatus.allItemsLabel !== 'string' &&
2379
+ controlArr.labels.length === optionsData.length
2380
+ ?
2381
+ MULTI_SEL_SELECTED_STATUS.allItemsLabel.replace('{num}', `${controlArr.labels.length}`)
2382
+ :
2383
+ null
2384
+ }
2385
+ </>: null}
2386
+ {/* ===================== /Auto requests ===================== */}
2244
2387
 
2388
+ </>}
2245
2389
 
2246
2390
  </li>
2247
2391
  </> : <>
@@ -2340,7 +2484,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
2340
2484
  {
2341
2485
  'reverse': isOpen
2342
2486
  }
2343
- )} style={{display: fetchTrigger ? 'none' : 'inline-block' }}>
2487
+ )} style={{display: MANUAL_REQ ? 'none' : 'inline-block' }}>
2344
2488
  {controlArrow ? controlArrow : <svg width="10px" height="10px" viewBox="0 -4.5 20 20">
2345
2489
  <g stroke="none" strokeWidth="1" fill="none">
2346
2490
  <g transform="translate(-180.000000, -6684.000000)" className="arrow-fill-g" fill="#a5a5a5">
@@ -2357,7 +2501,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
2357
2501
 
2358
2502
 
2359
2503
  {/* SEARCH BUTTON */}
2360
- {fetchTrigger ? <>
2504
+ {MANUAL_REQ ? <>
2361
2505
  <span className="custom-select-multi__control-searchbtn">
2362
2506
  <button tabIndex={-1} type="button" className="btn border-end-0 rounded-pill" onClick={(e: React.MouseEvent) => {
2363
2507
  handleFetch().then((response: any) => {
@@ -2390,7 +2534,12 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
2390
2534
  <div
2391
2535
  ref={listRef}
2392
2536
  id={`custom-select__options-wrapper-${idRes}`}
2393
- className="custom-select__options-wrapper list-group position-absolute border shadow small"
2537
+ className={combinedCls(
2538
+ 'custom-select__options-wrapper list-group position-absolute border shadow small',
2539
+ {
2540
+ 'multiple-selection': MULTI_SEL_VALID
2541
+ }
2542
+ )}
2394
2543
  style={{ zIndex: DEPTH, width: WIN_WIDTH, display: 'none' }}
2395
2544
  role="tablist"
2396
2545
  >
@@ -7,8 +7,8 @@ import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
7
7
 
8
8
 
9
9
  import { TableProvider } from './TableContext';
10
- import useTableResponsive from './table-utils/hooks/useTableResponsive';
11
- import useTableDraggable from './table-utils/hooks/useTableDraggable';
10
+ import useTableResponsive from './utils/hooks/useTableResponsive';
11
+ import useTableDraggable from './utils/hooks/useTableDraggable';
12
12
 
13
13
 
14
14
  export interface TableProps extends React.HTMLAttributes<HTMLDivElement> {
@@ -6,8 +6,8 @@ import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
6
6
 
7
7
  import { TableContext } from './TableContext';
8
8
 
9
- import { cellMark, removeCellFocusClassName } from './table-utils/func';
10
- import useTableKeyPress from './table-utils/hooks/useTableKeyPress';
9
+ import { cellMark, removeCellFocusClassName } from './utils/func';
10
+ import useTableKeyPress from './utils/hooks/useTableKeyPress';
11
11
 
12
12
  export interface TableCellProps extends React.HTMLAttributes<HTMLTableCellElement> {
13
13
  active?: boolean;
@@ -1,7 +1,7 @@
1
1
  import React, { useContext, forwardRef } from 'react';
2
2
 
3
3
  import { TableContext } from './TableContext';
4
- import { convertMapToArr } from './table-utils/func';
4
+ import { convertMapToArr } from './utils/func';
5
5
 
6
6
  export interface TableRowProps extends React.HTMLAttributes<HTMLTableRowElement> {
7
7
  active?: boolean;
@@ -8,7 +8,7 @@ export { default as TableColgroup } from './TableColgroup';
8
8
  export { default as TableCaption } from './TableCaption';
9
9
 
10
10
  // utils
11
- export { default as TableFilter } from './table-utils/TableFilter';
12
- export { default as ToggleSelection } from './table-utils/ToggleSelection';
13
- export { default as DragHandleSprite } from './table-utils/DragHandleSprite';
14
- export { default as SortSprite } from './table-utils/SortSprite';
11
+ export { default as TableFilter } from './utils/TableFilter';
12
+ export { default as ToggleSelection } from './utils/ToggleSelection';
13
+ export { default as DragHandleSprite } from './utils/DragHandleSprite';
14
+ export { default as SortSprite } from './utils/SortSprite';
@@ -11,7 +11,7 @@ import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
11
11
 
12
12
 
13
13
  import { initUlHeight } from './init-height';
14
- import { removeItemOnce, activeClass } from './tree-utils';
14
+ import { removeItemOnce, activeClass } from './utils/func';
15
15
 
16
16
  export interface FetchConfig {
17
17
  fetchFuncAsync?: any | undefined;
@@ -101,6 +101,33 @@ function dateFormat(v: Date | string): Date | String {
101
101
  }
102
102
 
103
103
 
104
+ /**
105
+ * Get date details
106
+ * @param {Date | String} v
107
+ * @param {Boolean} padZeroEnabled
108
+ * @typedef {Object} JSON
109
+ */
110
+ function getDateDetails(v: Date | string, padZeroEnabled: boolean = true): Record<string, string | number> {
111
+
112
+ const date: any = dateFormat(v);
113
+ const year = date.getFullYear();
114
+ const month = padZero(date.getMonth() + 1, padZeroEnabled);
115
+ const day = padZero(date.getDate(), padZeroEnabled);
116
+ const hours = padZero(date.getHours(), padZeroEnabled);
117
+ const minutes = padZero(date.getMinutes(), padZeroEnabled);
118
+ const seconds = padZero(date.getSeconds(), padZeroEnabled);
119
+
120
+ return {
121
+ year: String(year),
122
+ month,
123
+ day,
124
+ hours,
125
+ minutes,
126
+ seconds
127
+ };
128
+ }
129
+
130
+
104
131
  /**
105
132
  * Get calendar date
106
133
  * @param {Date | String} v
@@ -433,11 +460,79 @@ function timestampToDate(v: number, padZeroEnabled: boolean = true): string {
433
460
  }
434
461
 
435
462
 
463
+ /**
464
+ * Get the date of the specified month
465
+ * @param {Number} year
466
+ * @param {Number} month
467
+ * @returns {Array<string>}
468
+ */
469
+ function getMonthDates(year: number, month: number) {
470
+ const dates: string[] = [];
471
+
472
+ // Get the total number of days in the month
473
+ const daysInMonth = new Date(year, month, 0).getDate();
474
+
475
+
476
+ for (let day = 1; day <= daysInMonth; day++) {
477
+ dates.push(`${year}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`); // 'YYYY-MM-DD'
478
+ }
479
+
480
+ return dates;
481
+ }
482
+
483
+ /**
484
+ * Get the date of the specified week (From Sunday)
485
+ * @param {Number} weekOffset
486
+ * @returns {Array<Date>}
487
+ */
488
+ function getWeekDatesFromSun(weekOffset: number) {
489
+ const dates: Array<Date> = [];
490
+ const currentDate = new Date();
491
+
492
+ // Calculate the date of Sunday
493
+ const dayOfWeek = currentDate.getDay(); // 0 is Sunday
494
+ currentDate.setDate(currentDate.getDate() - dayOfWeek + weekOffset * 7);
495
+
496
+ // Get the date of the week
497
+ for (let i = 0; i < 7; i++) {
498
+ const date = new Date(currentDate);
499
+ date.setDate(currentDate.getDate() + i);
500
+ dates.push(date);
501
+ }
502
+
503
+ return dates;
504
+ }
505
+
506
+ /**
507
+ * Get the date of the specified week (From Monday)
508
+ * @param {Number} weekOffset
509
+ * @returns {Array<Date>}
510
+ */
511
+ function getWeekDatesFromMon(weekOffset: number) {
512
+ const dates: Array<Date> = [];
513
+ const currentDate = new Date();
514
+
515
+ // Set the date to Monday
516
+ const dayOfWeek = currentDate.getDay();
517
+ const diffToMonday = dayOfWeek === 0 ? -6 : 1 - dayOfWeek;
518
+ currentDate.setDate(currentDate.getDate() + diffToMonday + weekOffset * 7);
519
+
520
+ // Get the date of the week
521
+ for (let i = 0; i < 7; i++) {
522
+ const date = new Date(currentDate);
523
+ date.setDate(currentDate.getDate() + i);
524
+ dates.push(date);
525
+ }
526
+
527
+ return dates;
528
+ }
529
+
436
530
  export {
437
531
  isTimeString,
438
532
  getNow,
439
533
  padZero,
440
534
  dateFormat,
535
+ getDateDetails,
441
536
 
442
537
  //
443
538
  isValidDate,
@@ -474,5 +569,10 @@ export {
474
569
  setDateHours,
475
570
  setDateMinutes,
476
571
  setDateDays,
477
- timestampToDate
572
+ timestampToDate,
573
+
574
+ // get dates list
575
+ getMonthDates,
576
+ getWeekDatesFromSun,
577
+ getWeekDatesFromMon
478
578
  }