@m4l/components 9.2.51 → 9.2.53
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/.storybook/test-utils/index.d.ts +1 -0
- package/.storybook/test-utils/waitForHelpers.d.ts +4 -0
- package/.storybook/utils/getStylesColorsByMode.d.ts +98 -70
- package/components/Chip/Chip.js +3 -1
- package/components/Chip/types.d.ts +4 -0
- package/components/DataGrid/constants.d.ts +21 -0
- package/components/DataGrid/constants.js +24 -1
- package/components/DataGrid/index.d.ts +1 -0
- package/components/DataGrid/subcomponents/Table/subcomponents/ActionsColumn.js +2 -2
- package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/helpers.js +3 -2
- package/components/DynamicFilter/types.d.ts +2 -2
- package/components/ObjectLogs/subcomponents/ObjectLogsByOthers/ObjectLogsByOthers.js +1 -1
- package/components/hook-form/RHFAutocomplete/RHFAutocomplete.js +30 -19
- package/components/hook-form/RHFAutocomplete/tests/common.d.ts +37 -0
- package/components/hook-form/RHFAutocomplete/types.d.ts +3 -8
- package/components/hook-form/RHFAutocompleteAsync/RHFAutocompleteAsync.d.ts +32 -5
- package/components/hook-form/RHFAutocompleteAsync/RHFAutocompleteAsync.js +49 -84
- package/components/hook-form/RHFAutocompleteAsync/RHFAutocompleteAsyncStyles.d.ts +2 -2
- package/components/hook-form/RHFAutocompleteAsync/hooks/useFetchOptions.d.ts +5 -0
- package/components/hook-form/RHFAutocompleteAsync/hooks/useFetchOptions.js +64 -0
- package/components/hook-form/RHFAutocompleteAsync/reducer/RHFAutocompleteReducer.d.ts +14 -0
- package/components/hook-form/RHFAutocompleteAsync/reducer/RHFAutocompleteReducer.js +79 -0
- package/components/hook-form/RHFAutocompleteAsync/slots/RHFAutocompleteSlotsAsync.d.ts +1 -1
- package/components/hook-form/RHFAutocompleteAsync/tests/OnChangFilterParmsDefined.test.d.ts +1 -0
- package/components/hook-form/RHFAutocompleteAsync/tests/OnChangFilterParmsUndefined.test.d.ts +1 -0
- package/components/hook-form/RHFAutocompleteAsync/tests/RHFAutocompleteReducer.test.d.ts +1 -0
- package/components/hook-form/RHFAutocompleteAsync/tests/common.d.ts +41 -0
- package/components/hook-form/RHFAutocompleteAsync/types.d.ts +120 -4
- package/components/hook-form/RHFAutocompleteAsync/types.js +38 -0
- package/components/hook-form/RHFTextField/RHFTextField.js +3 -2
- package/components/mui_extended/Autocomplete/Autocomplete.d.ts +7 -0
- package/components/mui_extended/Autocomplete/Autocomplete.js +59 -196
- package/components/mui_extended/Autocomplete/Autocomplete.styles.js +27 -16
- package/components/mui_extended/Autocomplete/hooks/useEndAdornments.d.ts +14 -0
- package/components/mui_extended/Autocomplete/hooks/useEndAdornments.js +47 -0
- package/components/mui_extended/Autocomplete/hooks/useStartAdornments.d.ts +21 -0
- package/components/mui_extended/Autocomplete/hooks/useStartAdornments.js +31 -0
- package/components/mui_extended/Autocomplete/hooks/useValuesAndHandlers.d.ts +23 -0
- package/components/mui_extended/Autocomplete/hooks/useValuesAndHandlers.js +135 -0
- package/components/mui_extended/Autocomplete/icons.d.ts +4 -0
- package/components/mui_extended/Autocomplete/icons.js +7 -0
- package/components/mui_extended/Autocomplete/renderOptions/index.d.ts +7 -2
- package/components/mui_extended/Autocomplete/renderOptions/index.js +7 -6
- package/components/mui_extended/Autocomplete/slots/AutocompleteSlots.js +7 -8
- package/components/mui_extended/Autocomplete/types.d.ts +2 -0
- package/hooks/useDynamicFilterAndSort/useDynamicFilterAndSort.js +13 -10
- package/index.js +2 -0
- package/mockServiceWorker.js +1 -1
- package/package.json +1 -1
- package/storybook/components/SideBar/SideBar.stories.d.ts +17 -5
- package/storybook/components/extended/mui/Autocomplete/AutoComple.stories.d.ts +1 -0
- package/storybook/hook-form/RHFAutocomplete/RHFAutocomplete.stories.d.ts +8 -6
- package/storybook/hook-form/RHFAutocomplete/constants.d.ts +23 -0
- package/storybook/hook-form/RHFAutocompleteAsync/RHFAutocompleteAsync.stories.d.ts +11 -4
- package/storybook/hook-form/RHFAutocompleteAsync/constants.d.ts +10 -1
- package/storybook/hook-form/RHFAutocompleteAsync/handlers.d.ts +1 -0
- package/components/hook-form/RHFAutocomplete/oldTypes.d.ts +0 -43
- /package/components/hook-form/RHFAutocomplete/{RHFAutocomplete.test.d.ts → tests/RHFAutocomplete.test.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './waitForHelpers';
|
|
@@ -53,6 +53,8 @@ export declare const colorsLight: {
|
|
|
53
53
|
readonly surface: string;
|
|
54
54
|
readonly hover: string;
|
|
55
55
|
readonly backdrop: string;
|
|
56
|
+
readonly base: string;
|
|
57
|
+
readonly blur: string;
|
|
56
58
|
readonly paper: "#000";
|
|
57
59
|
};
|
|
58
60
|
readonly chips: {
|
|
@@ -62,35 +64,40 @@ export declare const colorsLight: {
|
|
|
62
64
|
readonly warning: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
63
65
|
readonly default: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
64
66
|
readonly forest: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
67
|
+
readonly pink: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
68
|
+
readonly orange: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
69
|
+
readonly candy: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
70
|
+
readonly persianGreen: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
71
|
+
readonly aqua: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
65
72
|
readonly disabled: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
66
73
|
readonly primary: {
|
|
67
74
|
readonly outlined: {
|
|
68
|
-
readonly color:
|
|
69
|
-
readonly backgroundColor:
|
|
70
|
-
readonly backgroundHover:
|
|
71
|
-
readonly backgroundActive:
|
|
72
|
-
readonly colorTone:
|
|
73
|
-
readonly backgroundColorTone:
|
|
74
|
-
readonly backgroundHoverTone:
|
|
75
|
-
readonly backgroundActiveTone:
|
|
75
|
+
readonly color: string;
|
|
76
|
+
readonly backgroundColor: string;
|
|
77
|
+
readonly backgroundHover: string;
|
|
78
|
+
readonly backgroundActive: string;
|
|
79
|
+
readonly colorTone: string;
|
|
80
|
+
readonly backgroundColorTone: string;
|
|
81
|
+
readonly backgroundHoverTone: string;
|
|
82
|
+
readonly backgroundActiveTone: string;
|
|
76
83
|
};
|
|
77
84
|
readonly contained: {
|
|
78
|
-
readonly color:
|
|
79
|
-
readonly backgroundColor:
|
|
80
|
-
readonly backgroundHover:
|
|
81
|
-
readonly backgroundActive:
|
|
82
|
-
readonly colorTone:
|
|
83
|
-
readonly backgroundColorTone:
|
|
84
|
-
readonly backgroundHoverTone:
|
|
85
|
-
readonly backgroundActiveTone:
|
|
85
|
+
readonly color: string;
|
|
86
|
+
readonly backgroundColor: string;
|
|
87
|
+
readonly backgroundHover: string;
|
|
88
|
+
readonly backgroundActive: string;
|
|
89
|
+
readonly colorTone: string;
|
|
90
|
+
readonly backgroundColorTone: string;
|
|
91
|
+
readonly backgroundHoverTone: string;
|
|
92
|
+
readonly backgroundActiveTone: string;
|
|
86
93
|
};
|
|
87
94
|
};
|
|
88
95
|
};
|
|
89
96
|
readonly border: {
|
|
90
97
|
readonly main: string;
|
|
98
|
+
readonly dens: string;
|
|
91
99
|
readonly default: string;
|
|
92
100
|
readonly secondary: string;
|
|
93
|
-
readonly dens: string;
|
|
94
101
|
readonly disabled: string;
|
|
95
102
|
readonly error: string;
|
|
96
103
|
};
|
|
@@ -238,6 +245,8 @@ export declare const colorsLight: {
|
|
|
238
245
|
readonly surface: string;
|
|
239
246
|
readonly hover: string;
|
|
240
247
|
readonly backdrop: string;
|
|
248
|
+
readonly base: string;
|
|
249
|
+
readonly blur: string;
|
|
241
250
|
readonly paper: "#000";
|
|
242
251
|
};
|
|
243
252
|
readonly chips: {
|
|
@@ -247,35 +256,40 @@ export declare const colorsLight: {
|
|
|
247
256
|
readonly warning: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
248
257
|
readonly default: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
249
258
|
readonly forest: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
259
|
+
readonly pink: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
260
|
+
readonly orange: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
261
|
+
readonly candy: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
262
|
+
readonly persianGreen: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
263
|
+
readonly aqua: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
250
264
|
readonly disabled: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
251
265
|
readonly primary: {
|
|
252
266
|
readonly outlined: {
|
|
253
|
-
readonly color:
|
|
254
|
-
readonly backgroundColor:
|
|
255
|
-
readonly backgroundHover:
|
|
256
|
-
readonly backgroundActive:
|
|
257
|
-
readonly colorTone:
|
|
258
|
-
readonly backgroundColorTone:
|
|
259
|
-
readonly backgroundHoverTone:
|
|
260
|
-
readonly backgroundActiveTone:
|
|
267
|
+
readonly color: string;
|
|
268
|
+
readonly backgroundColor: string;
|
|
269
|
+
readonly backgroundHover: string;
|
|
270
|
+
readonly backgroundActive: string;
|
|
271
|
+
readonly colorTone: string;
|
|
272
|
+
readonly backgroundColorTone: string;
|
|
273
|
+
readonly backgroundHoverTone: string;
|
|
274
|
+
readonly backgroundActiveTone: string;
|
|
261
275
|
};
|
|
262
276
|
readonly contained: {
|
|
263
|
-
readonly color:
|
|
264
|
-
readonly backgroundColor:
|
|
265
|
-
readonly backgroundHover:
|
|
266
|
-
readonly backgroundActive:
|
|
267
|
-
readonly colorTone:
|
|
268
|
-
readonly backgroundColorTone:
|
|
269
|
-
readonly backgroundHoverTone:
|
|
270
|
-
readonly backgroundActiveTone:
|
|
277
|
+
readonly color: string;
|
|
278
|
+
readonly backgroundColor: string;
|
|
279
|
+
readonly backgroundHover: string;
|
|
280
|
+
readonly backgroundActive: string;
|
|
281
|
+
readonly colorTone: string;
|
|
282
|
+
readonly backgroundColorTone: string;
|
|
283
|
+
readonly backgroundHoverTone: string;
|
|
284
|
+
readonly backgroundActiveTone: string;
|
|
271
285
|
};
|
|
272
286
|
};
|
|
273
287
|
};
|
|
274
288
|
readonly border: {
|
|
275
289
|
readonly main: string;
|
|
276
|
-
readonly default: string;
|
|
277
|
-
readonly secondary: string;
|
|
278
290
|
readonly dens: string;
|
|
291
|
+
readonly default: string | undefined;
|
|
292
|
+
readonly secondary: string;
|
|
279
293
|
readonly disabled: string;
|
|
280
294
|
readonly error: string;
|
|
281
295
|
};
|
|
@@ -424,6 +438,8 @@ export declare const colorsDark: {
|
|
|
424
438
|
readonly surface: string;
|
|
425
439
|
readonly hover: string;
|
|
426
440
|
readonly backdrop: string;
|
|
441
|
+
readonly base: string;
|
|
442
|
+
readonly blur: string;
|
|
427
443
|
readonly paper: "#000";
|
|
428
444
|
};
|
|
429
445
|
readonly chips: {
|
|
@@ -433,35 +449,40 @@ export declare const colorsDark: {
|
|
|
433
449
|
readonly warning: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
434
450
|
readonly default: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
435
451
|
readonly forest: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
452
|
+
readonly pink: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
453
|
+
readonly orange: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
454
|
+
readonly candy: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
455
|
+
readonly persianGreen: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
456
|
+
readonly aqua: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
436
457
|
readonly disabled: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
437
458
|
readonly primary: {
|
|
438
459
|
readonly outlined: {
|
|
439
|
-
readonly color:
|
|
440
|
-
readonly backgroundColor:
|
|
441
|
-
readonly backgroundHover:
|
|
442
|
-
readonly backgroundActive:
|
|
443
|
-
readonly colorTone:
|
|
444
|
-
readonly backgroundColorTone:
|
|
445
|
-
readonly backgroundHoverTone:
|
|
446
|
-
readonly backgroundActiveTone:
|
|
460
|
+
readonly color: string;
|
|
461
|
+
readonly backgroundColor: string;
|
|
462
|
+
readonly backgroundHover: string;
|
|
463
|
+
readonly backgroundActive: string;
|
|
464
|
+
readonly colorTone: string;
|
|
465
|
+
readonly backgroundColorTone: string;
|
|
466
|
+
readonly backgroundHoverTone: string;
|
|
467
|
+
readonly backgroundActiveTone: string;
|
|
447
468
|
};
|
|
448
469
|
readonly contained: {
|
|
449
|
-
readonly color:
|
|
450
|
-
readonly backgroundColor:
|
|
451
|
-
readonly backgroundHover:
|
|
452
|
-
readonly backgroundActive:
|
|
453
|
-
readonly colorTone:
|
|
454
|
-
readonly backgroundColorTone:
|
|
455
|
-
readonly backgroundHoverTone:
|
|
456
|
-
readonly backgroundActiveTone:
|
|
470
|
+
readonly color: string;
|
|
471
|
+
readonly backgroundColor: string;
|
|
472
|
+
readonly backgroundHover: string;
|
|
473
|
+
readonly backgroundActive: string;
|
|
474
|
+
readonly colorTone: string;
|
|
475
|
+
readonly backgroundColorTone: string;
|
|
476
|
+
readonly backgroundHoverTone: string;
|
|
477
|
+
readonly backgroundActiveTone: string;
|
|
457
478
|
};
|
|
458
479
|
};
|
|
459
480
|
};
|
|
460
481
|
readonly border: {
|
|
461
482
|
readonly main: string;
|
|
483
|
+
readonly dens: string;
|
|
462
484
|
readonly default: string;
|
|
463
485
|
readonly secondary: string;
|
|
464
|
-
readonly dens: string;
|
|
465
486
|
readonly disabled: string;
|
|
466
487
|
readonly error: string;
|
|
467
488
|
};
|
|
@@ -609,6 +630,8 @@ export declare const colorsDark: {
|
|
|
609
630
|
readonly surface: string;
|
|
610
631
|
readonly hover: string;
|
|
611
632
|
readonly backdrop: string;
|
|
633
|
+
readonly base: string;
|
|
634
|
+
readonly blur: string;
|
|
612
635
|
readonly paper: "#000";
|
|
613
636
|
};
|
|
614
637
|
readonly chips: {
|
|
@@ -618,35 +641,40 @@ export declare const colorsDark: {
|
|
|
618
641
|
readonly warning: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
619
642
|
readonly default: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
620
643
|
readonly forest: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
644
|
+
readonly pink: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
645
|
+
readonly orange: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
646
|
+
readonly candy: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
647
|
+
readonly persianGreen: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
648
|
+
readonly aqua: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
621
649
|
readonly disabled: Record<import('@m4l/styles').ChipColorVariant, import('@m4l/styles').ChipColor>;
|
|
622
650
|
readonly primary: {
|
|
623
651
|
readonly outlined: {
|
|
624
|
-
readonly color:
|
|
625
|
-
readonly backgroundColor:
|
|
626
|
-
readonly backgroundHover:
|
|
627
|
-
readonly backgroundActive:
|
|
628
|
-
readonly colorTone:
|
|
629
|
-
readonly backgroundColorTone:
|
|
630
|
-
readonly backgroundHoverTone:
|
|
631
|
-
readonly backgroundActiveTone:
|
|
652
|
+
readonly color: string;
|
|
653
|
+
readonly backgroundColor: string;
|
|
654
|
+
readonly backgroundHover: string;
|
|
655
|
+
readonly backgroundActive: string;
|
|
656
|
+
readonly colorTone: string;
|
|
657
|
+
readonly backgroundColorTone: string;
|
|
658
|
+
readonly backgroundHoverTone: string;
|
|
659
|
+
readonly backgroundActiveTone: string;
|
|
632
660
|
};
|
|
633
661
|
readonly contained: {
|
|
634
|
-
readonly color:
|
|
635
|
-
readonly backgroundColor:
|
|
636
|
-
readonly backgroundHover:
|
|
637
|
-
readonly backgroundActive:
|
|
638
|
-
readonly colorTone:
|
|
639
|
-
readonly backgroundColorTone:
|
|
640
|
-
readonly backgroundHoverTone:
|
|
641
|
-
readonly backgroundActiveTone:
|
|
662
|
+
readonly color: string;
|
|
663
|
+
readonly backgroundColor: string;
|
|
664
|
+
readonly backgroundHover: string;
|
|
665
|
+
readonly backgroundActive: string;
|
|
666
|
+
readonly colorTone: string;
|
|
667
|
+
readonly backgroundColorTone: string;
|
|
668
|
+
readonly backgroundHoverTone: string;
|
|
669
|
+
readonly backgroundActiveTone: string;
|
|
642
670
|
};
|
|
643
671
|
};
|
|
644
672
|
};
|
|
645
673
|
readonly border: {
|
|
646
674
|
readonly main: string;
|
|
647
|
-
readonly default: string;
|
|
648
|
-
readonly secondary: string;
|
|
649
675
|
readonly dens: string;
|
|
676
|
+
readonly default: string | undefined;
|
|
677
|
+
readonly secondary: string;
|
|
650
678
|
readonly disabled: string;
|
|
651
679
|
readonly error: string;
|
|
652
680
|
};
|
package/components/Chip/Chip.js
CHANGED
|
@@ -22,6 +22,7 @@ const Chip = forwardRef((props, ref) => {
|
|
|
22
22
|
iconButtonProps,
|
|
23
23
|
className,
|
|
24
24
|
dataTestId,
|
|
25
|
+
disabledDeleteButton,
|
|
25
26
|
...others
|
|
26
27
|
} = props;
|
|
27
28
|
const { currentSize } = useComponentSize(size);
|
|
@@ -93,7 +94,8 @@ const Chip = forwardRef((props, ref) => {
|
|
|
93
94
|
src: iconClose,
|
|
94
95
|
size: adjustedSize,
|
|
95
96
|
ownerState: { ...ownerState },
|
|
96
|
-
onClick: handleDelete
|
|
97
|
+
onClick: handleDelete,
|
|
98
|
+
disabled: disabledDeleteButton
|
|
97
99
|
}
|
|
98
100
|
)
|
|
99
101
|
]
|
|
@@ -74,6 +74,10 @@ export interface ChipProps {
|
|
|
74
74
|
* Test id for the `Chip`.
|
|
75
75
|
*/
|
|
76
76
|
dataTestId?: string;
|
|
77
|
+
/**
|
|
78
|
+
* If the `Chip` delete button is disabled.
|
|
79
|
+
*/
|
|
80
|
+
disabledDeleteButton?: boolean;
|
|
77
81
|
}
|
|
78
82
|
/**
|
|
79
83
|
* Owner state of the `Chip` used to define internal style and behavior properties.
|
|
@@ -1,3 +1,24 @@
|
|
|
1
1
|
export declare const DATAGRID_PREFIX_NAME = "M4LDataGrid";
|
|
2
2
|
export declare const DATAGRID_SELECT_COLUMN_KEY = "M4LDataGrid-CheckedColumn";
|
|
3
3
|
export declare const DATAGRID_ACTIONS_COLUMN_KEY = "M4LDataGrid-ActionsColumn";
|
|
4
|
+
export declare enum DATAGRID_SEMANTIC_WIDTHS {
|
|
5
|
+
actions = 40,
|
|
6
|
+
bigChip = 190,
|
|
7
|
+
bigDescription = 350,
|
|
8
|
+
bigId = 200,
|
|
9
|
+
bigName = 290,
|
|
10
|
+
bigNumber = 150,
|
|
11
|
+
date = 180,
|
|
12
|
+
email = 300,
|
|
13
|
+
mediumChip = 140,
|
|
14
|
+
mediumDescription = 280,
|
|
15
|
+
mediumId = 130,
|
|
16
|
+
mediumName = 180,
|
|
17
|
+
mediumNumber = 150,
|
|
18
|
+
percentNumber = 90,
|
|
19
|
+
smallChip = 70,
|
|
20
|
+
smallDescription = 130,
|
|
21
|
+
smallId = 50,
|
|
22
|
+
smallName = 90,
|
|
23
|
+
smallNumber = 60
|
|
24
|
+
}
|
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
const DATAGRID_PREFIX_NAME = "M4LDataGrid";
|
|
2
2
|
const DATAGRID_SELECT_COLUMN_KEY = "M4LDataGrid-CheckedColumn";
|
|
3
3
|
const DATAGRID_ACTIONS_COLUMN_KEY = "M4LDataGrid-ActionsColumn";
|
|
4
|
+
var DATAGRID_SEMANTIC_WIDTHS = /* @__PURE__ */ ((DATAGRID_SEMANTIC_WIDTHS2) => {
|
|
5
|
+
DATAGRID_SEMANTIC_WIDTHS2[DATAGRID_SEMANTIC_WIDTHS2["actions"] = 40] = "actions";
|
|
6
|
+
DATAGRID_SEMANTIC_WIDTHS2[DATAGRID_SEMANTIC_WIDTHS2["bigChip"] = 190] = "bigChip";
|
|
7
|
+
DATAGRID_SEMANTIC_WIDTHS2[DATAGRID_SEMANTIC_WIDTHS2["bigDescription"] = 350] = "bigDescription";
|
|
8
|
+
DATAGRID_SEMANTIC_WIDTHS2[DATAGRID_SEMANTIC_WIDTHS2["bigId"] = 200] = "bigId";
|
|
9
|
+
DATAGRID_SEMANTIC_WIDTHS2[DATAGRID_SEMANTIC_WIDTHS2["bigName"] = 290] = "bigName";
|
|
10
|
+
DATAGRID_SEMANTIC_WIDTHS2[DATAGRID_SEMANTIC_WIDTHS2["bigNumber"] = 150] = "bigNumber";
|
|
11
|
+
DATAGRID_SEMANTIC_WIDTHS2[DATAGRID_SEMANTIC_WIDTHS2["date"] = 180] = "date";
|
|
12
|
+
DATAGRID_SEMANTIC_WIDTHS2[DATAGRID_SEMANTIC_WIDTHS2["email"] = 300] = "email";
|
|
13
|
+
DATAGRID_SEMANTIC_WIDTHS2[DATAGRID_SEMANTIC_WIDTHS2["mediumChip"] = 140] = "mediumChip";
|
|
14
|
+
DATAGRID_SEMANTIC_WIDTHS2[DATAGRID_SEMANTIC_WIDTHS2["mediumDescription"] = 280] = "mediumDescription";
|
|
15
|
+
DATAGRID_SEMANTIC_WIDTHS2[DATAGRID_SEMANTIC_WIDTHS2["mediumId"] = 130] = "mediumId";
|
|
16
|
+
DATAGRID_SEMANTIC_WIDTHS2[DATAGRID_SEMANTIC_WIDTHS2["mediumName"] = 180] = "mediumName";
|
|
17
|
+
DATAGRID_SEMANTIC_WIDTHS2[DATAGRID_SEMANTIC_WIDTHS2["mediumNumber"] = 150] = "mediumNumber";
|
|
18
|
+
DATAGRID_SEMANTIC_WIDTHS2[DATAGRID_SEMANTIC_WIDTHS2["percentNumber"] = 90] = "percentNumber";
|
|
19
|
+
DATAGRID_SEMANTIC_WIDTHS2[DATAGRID_SEMANTIC_WIDTHS2["smallChip"] = 70] = "smallChip";
|
|
20
|
+
DATAGRID_SEMANTIC_WIDTHS2[DATAGRID_SEMANTIC_WIDTHS2["smallDescription"] = 130] = "smallDescription";
|
|
21
|
+
DATAGRID_SEMANTIC_WIDTHS2[DATAGRID_SEMANTIC_WIDTHS2["smallId"] = 50] = "smallId";
|
|
22
|
+
DATAGRID_SEMANTIC_WIDTHS2[DATAGRID_SEMANTIC_WIDTHS2["smallName"] = 90] = "smallName";
|
|
23
|
+
DATAGRID_SEMANTIC_WIDTHS2[DATAGRID_SEMANTIC_WIDTHS2["smallNumber"] = 60] = "smallNumber";
|
|
24
|
+
return DATAGRID_SEMANTIC_WIDTHS2;
|
|
25
|
+
})(DATAGRID_SEMANTIC_WIDTHS || {});
|
|
4
26
|
export {
|
|
5
27
|
DATAGRID_PREFIX_NAME as D,
|
|
6
28
|
DATAGRID_SELECT_COLUMN_KEY as a,
|
|
7
|
-
|
|
29
|
+
DATAGRID_SEMANTIC_WIDTHS as b,
|
|
30
|
+
DATAGRID_ACTIONS_COLUMN_KEY as c
|
|
8
31
|
};
|
|
@@ -6,3 +6,4 @@ export { getDataGridComponentsDictionary } from './dictionary';
|
|
|
6
6
|
export { TextEditor, NumberEditor } from './subcomponents/editors/TextEditor';
|
|
7
7
|
export { getDataGridRowsFromSet } from './utils/getDataGridRowsFromSet';
|
|
8
8
|
export type { IGridConfig, BaseConfigColumn } from './contexts/DataGridContext/types';
|
|
9
|
+
export { DATAGRID_SEMANTIC_WIDTHS } from './constants';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { u as useDataGrid } from "../../../hooks/useDataGrid.js";
|
|
3
3
|
import { useTheme } from "@mui/material";
|
|
4
|
-
import { b as DATAGRID_ACTIONS_COLUMN_KEY } from "../../../constants.js";
|
|
4
|
+
import { b as DATAGRID_SEMANTIC_WIDTHS, c as DATAGRID_ACTIONS_COLUMN_KEY } from "../../../constants.js";
|
|
5
5
|
import { M as MenuActions } from "../../../../MenuActions/MenuActions.js";
|
|
6
6
|
function ActionsFormatter(props) {
|
|
7
7
|
const { rowActionsGetter } = useDataGrid();
|
|
@@ -27,7 +27,7 @@ const ActionsColumn = {
|
|
|
27
27
|
key: DATAGRID_ACTIONS_COLUMN_KEY,
|
|
28
28
|
// name: getLabel(dictionary.LABEL_ACTIONS),
|
|
29
29
|
name: getActionLabel(),
|
|
30
|
-
width:
|
|
30
|
+
width: DATAGRID_SEMANTIC_WIDTHS.actions,
|
|
31
31
|
minWidth: 32,
|
|
32
32
|
isDraggable: false,
|
|
33
33
|
withFilter: false,
|
|
@@ -2,6 +2,7 @@ import * as Yup from "yup";
|
|
|
2
2
|
import { b as DATE_TIME_OPERATORS } from "../../../constants.js";
|
|
3
3
|
import { D as DYNAMIC_FILTER_DICTIONARY_ID, a as DICCTIONARY } from "../../../dictionary.js";
|
|
4
4
|
import { D as DateTimeFilter } from "./index.js";
|
|
5
|
+
import { startOfDay, endOfDay } from "date-fns";
|
|
5
6
|
import { i as isValidDate } from "../../../../../utils/isValidDate.js";
|
|
6
7
|
class DateTimeFilterHelpers {
|
|
7
8
|
getComponent() {
|
|
@@ -34,8 +35,8 @@ class DateTimeFilterHelpers {
|
|
|
34
35
|
getFormValue(field, getLabel, filterValueDateTime) {
|
|
35
36
|
const filterValue = filterValueDateTime;
|
|
36
37
|
const operator = filterValue ? filterValue.operator : field.defaultOperator ?? "b";
|
|
37
|
-
const defaultStartDate = /* @__PURE__ */ new Date();
|
|
38
|
-
const defaultEndDate = /* @__PURE__ */ new Date();
|
|
38
|
+
const defaultStartDate = startOfDay(/* @__PURE__ */ new Date());
|
|
39
|
+
const defaultEndDate = endOfDay(/* @__PURE__ */ new Date());
|
|
39
40
|
const defaultOperand1 = field.defaultOperand1 && field.defaultOperand1 instanceof Date ? field.defaultOperand1 : defaultStartDate;
|
|
40
41
|
const defaultOperand2 = field.defaultOperand2 && field.defaultOperand2 instanceof Date ? field.defaultOperand2 : defaultEndDate;
|
|
41
42
|
const formValueOperand1 = filterValue ? filterValue.operand1 : defaultOperand1;
|
|
@@ -2,7 +2,7 @@ import { Maybe } from '@m4l/core';
|
|
|
2
2
|
import { Sizes } from '@m4l/styles';
|
|
3
3
|
import { Theme } from '@mui/material/styles';
|
|
4
4
|
import { M4LOverridesStyleRules } from '../../@types/augmentations';
|
|
5
|
-
import {
|
|
5
|
+
import { RHFAutocompleteAsyncProps } from '../hook-form/RHFAutocompleteAsync/types';
|
|
6
6
|
import { RHFSelectProps } from '../hook-form/RHFSelect';
|
|
7
7
|
import { DynamicFilterSlots } from './slots';
|
|
8
8
|
export type FieldType = 'number' | 'string' | 'boolean' | 'datetime' | 'select' | 'selectAsync';
|
|
@@ -27,7 +27,7 @@ export type OperandsSelectArray = Array<OperandSelect>;
|
|
|
27
27
|
export type FieldTypeOperator<T extends FieldType> = T extends 'boolean' ? BooleanOperator : T extends 'datetime' ? DateTimeOperator : T extends 'number' ? NumberOperator : T extends 'select' ? SelectOperator : T extends 'selectAsync' ? SelectOperatorAsync : T extends 'string' ? StringOperator : T;
|
|
28
28
|
export type FieldTypeOperand<T extends FieldType> = T extends 'boolean' ? boolean : T extends 'datetime' ? Date : T extends 'number' ? number : T extends 'string' ? string : T extends 'select' ? OperandSelect : T extends 'selectAsync' ? OperandSelectAsync : FieldType;
|
|
29
29
|
export type FieldTypeOperandsArray<T extends FieldType> = T extends 'boolean' ? never : T extends 'datetime' ? never : T extends 'number' ? never : T extends 'string' ? never : T extends 'select' ? OperandsSelectArray : T extends 'selectAsync' ? OperandsArraySelectAsync : never;
|
|
30
|
-
type SelectAsyncOptions<TOption = any> = Pick<
|
|
30
|
+
type SelectAsyncOptions<TOption = any> = Pick<RHFAutocompleteAsyncProps<TOption>, 'type' | 'endPoint' | 'responseToCamelCase' | 'multiple' | 'autoComplete' | 'autoCapitalize' | 'parms' | 'timeout'> & {
|
|
31
31
|
getOptionLabel: (option: TOption) => string;
|
|
32
32
|
isOptionEqualToValue: (options: TOption | TOption[], value: TOption) => boolean;
|
|
33
33
|
getOptionId: (option: TOption) => string | number;
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { getPropertyByString } from "@m4l/core";
|
|
3
3
|
import { useIsMobile } from "@m4l/graphics";
|
|
4
4
|
import { useTheme } from "@mui/material";
|
|
5
|
-
import { useState, useEffect } from "react";
|
|
5
|
+
import { useId, useState, useCallback, useEffect } from "react";
|
|
6
6
|
import { useFormContext, Controller } from "react-hook-form";
|
|
7
7
|
import { A as AutocompleteRootStyled, L as LabelStyled } from "./slots/RHFAutocompleteSlots.js";
|
|
8
8
|
import { A as Autocomplete } from "../../mui_extended/Autocomplete/Autocomplete.js";
|
|
@@ -29,28 +29,36 @@ function RHFAutocomplete(props) {
|
|
|
29
29
|
imageScale = true,
|
|
30
30
|
imageRepeat,
|
|
31
31
|
refresh
|
|
32
|
+
// onChange: onChangeRHF,
|
|
32
33
|
} = props;
|
|
34
|
+
const htmlForId = useId();
|
|
33
35
|
const theme = useTheme();
|
|
34
36
|
const [open, setOpen] = useState(false);
|
|
35
37
|
const isDesktop = !useIsMobile();
|
|
36
|
-
const onCloseLocal = (event, reason) => {
|
|
38
|
+
const onCloseLocal = useCallback((event, reason) => {
|
|
37
39
|
setOpen(false);
|
|
38
40
|
if (onClose) {
|
|
39
41
|
onClose(event, reason);
|
|
40
42
|
}
|
|
41
|
-
};
|
|
42
|
-
const onOpenLocal = (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
onOpen
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
}, [onClose]);
|
|
44
|
+
const onOpenLocal = useCallback(
|
|
45
|
+
(event) => {
|
|
46
|
+
setOpen((currentState) => !currentState);
|
|
47
|
+
if (onOpen) {
|
|
48
|
+
onOpen(event);
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
[onOpen]
|
|
52
|
+
);
|
|
53
|
+
const getOptionLabelLocal = useCallback(
|
|
54
|
+
(option) => {
|
|
55
|
+
if (option === void 0 || option === null) {
|
|
56
|
+
return "";
|
|
57
|
+
}
|
|
58
|
+
return getOptionLabel(option);
|
|
59
|
+
},
|
|
60
|
+
[getOptionLabel]
|
|
61
|
+
);
|
|
54
62
|
const paletteColor = getPropertyByString(
|
|
55
63
|
theme.vars.palette,
|
|
56
64
|
disabled ? "default" : color || "default",
|
|
@@ -108,11 +116,11 @@ function RHFAutocomplete(props) {
|
|
|
108
116
|
{
|
|
109
117
|
ownerState: { ...ownerState },
|
|
110
118
|
label,
|
|
119
|
+
htmlFor: htmlForId,
|
|
111
120
|
size,
|
|
112
121
|
mandatory,
|
|
113
122
|
mandatoryMessage,
|
|
114
123
|
helperMessage,
|
|
115
|
-
htmlFor: `autocomplete-${nameRHF}`,
|
|
116
124
|
disabled
|
|
117
125
|
}
|
|
118
126
|
),
|
|
@@ -124,8 +132,10 @@ function RHFAutocomplete(props) {
|
|
|
124
132
|
options,
|
|
125
133
|
getOptionLabel,
|
|
126
134
|
isOptionEqualToValue,
|
|
127
|
-
multiple
|
|
128
|
-
onChange: (
|
|
135
|
+
multiple,
|
|
136
|
+
onChange: (_event, newValue, _reason) => {
|
|
137
|
+
onChange(newValue);
|
|
138
|
+
},
|
|
129
139
|
onChangeFilterParmsLocal,
|
|
130
140
|
refresh,
|
|
131
141
|
disabled,
|
|
@@ -133,7 +143,8 @@ function RHFAutocomplete(props) {
|
|
|
133
143
|
onOpen: onOpenLocal,
|
|
134
144
|
onClose: onCloseLocal,
|
|
135
145
|
size,
|
|
136
|
-
value
|
|
146
|
+
value,
|
|
147
|
+
htmlFor: htmlForId
|
|
137
148
|
}
|
|
138
149
|
),
|
|
139
150
|
currentVariant === "error" ? /* @__PURE__ */ jsx(HelperError, { message: error?.message }) : null
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { renderMaterialUI } from '../../../../test';
|
|
2
|
+
import { FieldValues } from 'react-hook-form';
|
|
3
|
+
import { RHFAutocompleteProps } from '../types';
|
|
4
|
+
import * as Yup from 'yup';
|
|
5
|
+
export declare const FIELD_NAME = "rhf-autocomplete";
|
|
6
|
+
export declare const FIELD_NAME_REQUIRED = "rhf-autocomplete-required";
|
|
7
|
+
export declare const FIELD_NAME_PRESELECTED = "rhf-autocomplete-preselected";
|
|
8
|
+
export declare const FIELD_NAME_PRESELECTED_NOT_IN_OPTIONS = "rhf-autocomplete-preselected-not-in-options";
|
|
9
|
+
export declare const FIELD_NAME_PRESELECTED_MULTIPLE = "rhf-autocomplete-preselected-multiple";
|
|
10
|
+
export declare const FIELD_NAME_PRESELECTED_MULTIPLE_NOT_IN_OPTIONS = "rhf-autocomplete-preselected-multiple-not-in-options";
|
|
11
|
+
export interface OptionsTests {
|
|
12
|
+
id: number;
|
|
13
|
+
name: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const mockItems: OptionsTests[];
|
|
16
|
+
export declare const mockItemPreselected: OptionsTests;
|
|
17
|
+
export declare const mockItemPreselectedMultiple: OptionsTests[];
|
|
18
|
+
export declare const mockItemPreselectedNotInOptions: OptionsTests;
|
|
19
|
+
export declare const mockItemPreselectedMultipleNotInOptions: OptionsTests[];
|
|
20
|
+
export declare const INITIAL_FORM_VALUES: FieldValues;
|
|
21
|
+
export declare const DEFAULT_PROPS: RHFAutocompleteProps<OptionsTests>;
|
|
22
|
+
export declare const errorMessage = "This field is required";
|
|
23
|
+
export declare const VALIDATION_SCHEMA: Yup.ObjectSchema<import('yup/lib/object').Assign<import('yup/lib/object').ObjectShape, {
|
|
24
|
+
"rhf-autocomplete-required": import('yup/lib/string').RequiredStringSchema<string | undefined, import('yup/lib/types').AnyObject>;
|
|
25
|
+
}>, import('yup/lib/object').AnyObject, import('yup/lib/object').TypeOfShape<import('yup/lib/object').Assign<import('yup/lib/object').ObjectShape, {
|
|
26
|
+
"rhf-autocomplete-required": import('yup/lib/string').RequiredStringSchema<string | undefined, import('yup/lib/types').AnyObject>;
|
|
27
|
+
}>>, import('yup/lib/object').AssertsShape<import('yup/lib/object').Assign<import('yup/lib/object').ObjectShape, {
|
|
28
|
+
"rhf-autocomplete-required": import('yup/lib/string').RequiredStringSchema<string | undefined, import('yup/lib/types').AnyObject>;
|
|
29
|
+
}>>>;
|
|
30
|
+
/**
|
|
31
|
+
* Renderiza el componente con el contexto de EnvironmentProvider y RHFormProvider.
|
|
32
|
+
*/
|
|
33
|
+
export declare const renderWithContexts: (ui: React.ReactElement, initialValuesFormContext?: FieldValues, validationSchema?: any) => ReturnType<typeof renderMaterialUI>;
|
|
34
|
+
/**
|
|
35
|
+
* Renders the RHFAutocompleteAsync component with the provided props.
|
|
36
|
+
*/
|
|
37
|
+
export declare const renderRHFAutocomplete: (fieldName: string, overrideProps?: Partial<RHFAutocompleteProps<OptionsTests>>, withFormValidation?: boolean) => ReturnType<typeof renderMaterialUI>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AutocompleteCloseReason, AutocompleteFreeSoloValueMapping, AutocompleteInputChangeReason,
|
|
1
|
+
import { AutocompleteCloseReason, AutocompleteFreeSoloValueMapping, AutocompleteInputChangeReason, AutocompleteProps as MUIAutocompleteProps, Theme, PaletteColor, PopperProps } from '@mui/material';
|
|
2
2
|
import { ComponentPalletColor, Sizes } from '@m4l/styles';
|
|
3
3
|
import { TextFieldProps } from '../../mui_extended/TextField/types';
|
|
4
4
|
import { RFHAUTOCOMPLETE_KEY_COMPONENT } from './constants';
|
|
@@ -12,7 +12,7 @@ export type RHFAutocompleteType = 'text' | 'image';
|
|
|
12
12
|
* Props for the unified Autocomplete component.
|
|
13
13
|
* Supports both single and multiple selection, and two types: `text` and `image`.
|
|
14
14
|
*/
|
|
15
|
-
export interface RHFAutocompleteProps<T, Multiple extends boolean | undefined =
|
|
15
|
+
export interface RHFAutocompleteProps<T = any, Multiple extends boolean | undefined = undefined, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined> extends Omit<MUIAutocompleteProps<T, Multiple, DisableClearable, FreeSolo>, 'variant' | 'color' | 'size' | 'value' | 'classes' | 'defaultValue' | 'onBlur' | 'onFocus' | 'autoComplete' | 'renderInput' | 'onChange' | 'open' | 'value' | 'multiple'>, Omit<TextFieldProps, 'label' | 'variant' | 'defaultValue' | 'classes' | 'onBlur' | 'onFocus' | 'onKeyDown' | 'ref' | 'onChange' | 'helperText' | 'value'>, Omit<LabelProps, 'label'> {
|
|
16
16
|
name: string;
|
|
17
17
|
/**
|
|
18
18
|
* The label for the autocomplete field.
|
|
@@ -20,11 +20,6 @@ export interface RHFAutocompleteProps<T, Multiple extends boolean | undefined =
|
|
|
20
20
|
popperProps?: Omit<PopperProps, 'color'>;
|
|
21
21
|
onFocus?: (event: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
22
22
|
autoComplete?: string;
|
|
23
|
-
/**
|
|
24
|
-
* The value of the autocomplete, supports single or multiple selection.
|
|
25
|
-
* Extended to include `null` for controlled components.
|
|
26
|
-
*/
|
|
27
|
-
value?: AutocompleteValue<T, Multiple, DisableClearable, FreeSolo> | null | undefined;
|
|
28
23
|
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
29
24
|
variant?: RHFAutocompleteVariants;
|
|
30
25
|
color?: Extract<ComponentPalletColor, 'primary'>;
|
|
@@ -42,7 +37,7 @@ export interface RHFAutocompleteProps<T, Multiple extends boolean | undefined =
|
|
|
42
37
|
helperMessage?: string;
|
|
43
38
|
onClose?: (event: React.SyntheticEvent, reason: AutocompleteCloseReason) => void;
|
|
44
39
|
onChangeFilterParmsLocal?: (newValue: string, reason: AutocompleteInputChangeReason) => void;
|
|
45
|
-
multiple?:
|
|
40
|
+
multiple?: boolean;
|
|
46
41
|
type?: RHFAutocompleteType;
|
|
47
42
|
getOptionUrlImage?: (option: T) => string;
|
|
48
43
|
imageScale?: boolean;
|