funda-ui 4.7.202 → 4.7.212

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.
@@ -53,7 +53,19 @@ import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
53
53
 
54
54
 
55
55
 
56
- export type SelectOptionChangeFnType = (arg1: any, arg2: any, arg3: any) => void;
56
+ export interface MultiSelectValue {
57
+ items: { label: string; value: string }[];
58
+ labels: string[];
59
+ values: string[];
60
+ labelsOfString: string;
61
+ valuesOfString: string;
62
+ }
63
+
64
+ export type SelectOptionChangeFnType = (
65
+ event: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,
66
+ element: HTMLElement,
67
+ value: OptionConfig | MultiSelectValue
68
+ ) => void | Promise<void>;
57
69
 
58
70
 
59
71
  export interface MultiSelectControlValConfig {
@@ -69,7 +81,8 @@ export interface OptionConfig {
69
81
  listItemLabel?: string;
70
82
  value: string | number | boolean;
71
83
  queryString: string | number;
72
- callback?: () => void;
84
+ callback?: () => void | Promise<void>;
85
+ [key: string]: string | number | boolean | any[] | (() => void | Promise<void>) | undefined;
73
86
  }
74
87
 
75
88
 
@@ -147,14 +160,28 @@ export type SelectProps = {
147
160
  fetchFuncAsync?: any;
148
161
  fetchFuncMethod?: string;
149
162
  fetchFuncMethodParams?: any[];
150
- fetchCallback?: (data: any) => void;
151
- onFetch?: (e: any, e2: any, value: string, data: any, incomingData: string | null | undefined) => void;
152
- onLoad?: (e: any, e2: any, value: string | null | undefined) => void;
153
- onSelect?: (data: any) => void;
163
+ fetchCallback?: (data: OptionConfig[]) => OptionConfig[];
164
+ onFetch?: (
165
+ event: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,
166
+ element: HTMLElement,
167
+ value: string,
168
+ data: OptionConfig[],
169
+ incomingData: string | null | undefined
170
+ ) => void;
171
+ onLoad?: (
172
+ event: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,
173
+ element: HTMLElement,
174
+ value: string | null | undefined
175
+ ) => void;
176
+ onSelect?: (data: OptionConfig) => void | Promise<void>;
154
177
  onChange?: SelectOptionChangeFnType | null;
155
- onBlur?: (e: any) => void;
156
- onFocus?: (e: any) => void;
157
- onKeyPressed?: (arg1: any, arg2: any, arg3: any) => void;
178
+ onBlur?: (event: React.FocusEvent<HTMLElement>) => void;
179
+ onFocus?: (event: React.FocusEvent<HTMLElement>) => void;
180
+ onKeyPressed?: (
181
+ event: React.KeyboardEvent<HTMLElement>,
182
+ element: HTMLElement,
183
+ value: string
184
+ ) => void;
158
185
  };
159
186
 
160
187
 
@@ -1402,7 +1429,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1402
1429
  //
1403
1430
  if (noCallback && typeof (onChange) === 'function') {
1404
1431
 
1405
- onChange?.(
1432
+ await onChange?.(
1406
1433
  selectInputRef.current,
1407
1434
  valueInputRef.current,
1408
1435
  !MULTI_SEL_VALID ? curItem : multipleSelectionCallback(currentControlValueArr, currentControlLabelArr)
@@ -1547,7 +1574,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1547
1574
  //
1548
1575
  if (noCallback && typeof (onChange) === 'function') {
1549
1576
 
1550
- onChange?.(
1577
+ await onChange?.(
1551
1578
  selectInputRef.current,
1552
1579
  valueInputRef.current,
1553
1580
  !MULTI_SEL_VALID ? curItem : multipleSelectionCallback(currentControlValueArr, currentControlLabelArr)
@@ -1641,7 +1668,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1641
1668
 
1642
1669
 
1643
1670
 
1644
- function handleSelectAll(event: any) {
1671
+ async function handleSelectAll(event: any) {
1645
1672
  event.preventDefault();
1646
1673
  event.stopPropagation(); /* REQUIRED */
1647
1674
 
@@ -1664,7 +1691,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1664
1691
 
1665
1692
  }
1666
1693
 
1667
- onChange?.(
1694
+ await onChange?.(
1668
1695
  selectInputRef.current,
1669
1696
  valueInputRef.current,
1670
1697
  multipleSelectionCallback(_values, _labels)
@@ -1696,7 +1723,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1696
1723
 
1697
1724
 
1698
1725
 
1699
- function handleMultiControlItemRemove(event: any) {
1726
+ async function handleMultiControlItemRemove(event: any) {
1700
1727
  event.preventDefault();
1701
1728
  event.stopPropagation(); /* REQUIRED */
1702
1729
 
@@ -1732,7 +1759,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1732
1759
  //
1733
1760
  if (typeof (onChange) === 'function') {
1734
1761
 
1735
- onChange?.(
1762
+ await onChange?.(
1736
1763
  selectInputRef.current,
1737
1764
  valueInputRef.current,
1738
1765
  multipleSelectionCallback(currentControlValueArr, currentControlLabelArr)
@@ -1971,7 +1998,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
1971
1998
  //
1972
1999
  if (typeof (onChange) === 'function') {
1973
2000
 
1974
- onChange?.(
2001
+ await onChange?.(
1975
2002
  selectInputRef.current,
1976
2003
  valueInputRef.current,
1977
2004
  !MULTI_SEL_VALID ? currentData : multipleSelectionCallback(currentControlValueArr, currentControlLabelArr)
@@ -2214,14 +2241,14 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
2214
2241
  <button
2215
2242
  tabIndex={-1}
2216
2243
  type="button"
2217
- onClick={(e: React.MouseEvent) => {
2244
+ onClick={async (e: React.MouseEvent) => {
2218
2245
  e.preventDefault();
2219
2246
  e.stopPropagation();
2220
2247
 
2221
2248
  if (MULTI_SEL_VALID) {
2222
2249
  updateOptionCheckboxes('remove');
2223
2250
 
2224
- onChange?.(
2251
+ await onChange?.(
2225
2252
  selectInputRef.current,
2226
2253
  valueInputRef.current,
2227
2254
  multipleSelectionCallback([], [])
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.202",
5
+ "version": "4.7.212",
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",