@m4l/components 9.3.10 → 9.3.11
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/components/DataGrid/contexts/DataGridContext/index.js +3 -3
- package/components/DataGrid/subcomponents/Table/hooks/useSortColumnsRows.js +0 -2
- package/components/DataGrid/types.d.ts +1 -2
- package/components/DynamicFilter/types.d.ts +1 -0
- package/components/NumberInput/hooks/useNumberInput/useNumberInput.js +0 -2
- package/components/areas/contexts/AreasContext/store.js +2 -2
- package/components/hook-form/RHFAutocompleteAsync/reducer/RHFAutocompleteReducer.js +0 -5
- package/hooks/useDynamicFilterAndSort/useDynamicFilterAndSort.js +2 -1
- package/package.json +1 -1
- package/storybook/components/DataGrid/subcomponents/DataGridRender.d.ts +0 -2
|
@@ -166,7 +166,7 @@ function DataGridProvider(props) {
|
|
|
166
166
|
});
|
|
167
167
|
useEffect(() => {
|
|
168
168
|
const keys = new Set(columns.map((c) => c.key));
|
|
169
|
-
if (sortSettings?.sortsColumns
|
|
169
|
+
if (sortSettings?.sortsColumns) {
|
|
170
170
|
for (const sort of sortSettings.sortsColumns) {
|
|
171
171
|
if (!keys.has(sort)) {
|
|
172
172
|
throw new Error(
|
|
@@ -175,9 +175,9 @@ function DataGridProvider(props) {
|
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
if (filterSettings?.filterColumns
|
|
178
|
+
if (filterSettings?.filterColumns) {
|
|
179
179
|
for (const filterField of filterSettings.filterColumns) {
|
|
180
|
-
if (!keys.has(filterField.name)) {
|
|
180
|
+
if (!filterField.skipColumnValidation && !keys.has(filterField.name)) {
|
|
181
181
|
throw new Error(
|
|
182
182
|
`DataGridProvider: Fields incluye "${filterField.name}", pero no existe ninguna columna con key="${filterField.name}".`
|
|
183
183
|
);
|
|
@@ -17,7 +17,6 @@ function getComparator(columns, sortColumn) {
|
|
|
17
17
|
return column.customSort;
|
|
18
18
|
}
|
|
19
19
|
switch (typeOrder) {
|
|
20
|
-
//Si el tipo de dato de la columna es un numerico, retorna una función de ordenamiento numérica
|
|
21
20
|
case "number":
|
|
22
21
|
return (a, b) => {
|
|
23
22
|
try {
|
|
@@ -26,7 +25,6 @@ function getComparator(columns, sortColumn) {
|
|
|
26
25
|
return -1;
|
|
27
26
|
}
|
|
28
27
|
};
|
|
29
|
-
//Por defecto retorna una función de ordenamiento de string
|
|
30
28
|
default:
|
|
31
29
|
return (a, b) => {
|
|
32
30
|
try {
|
|
@@ -88,7 +88,6 @@ export interface SortSettings {
|
|
|
88
88
|
sortsColumns: string[];
|
|
89
89
|
sortsApplied: SortApplied[];
|
|
90
90
|
onChange: (event: SortChangeEvent) => void;
|
|
91
|
-
skipColumnValidation?: boolean;
|
|
92
91
|
}
|
|
93
92
|
/**---------------------------------------------------------------- */
|
|
94
93
|
export type FilterChangeAdd = {
|
|
@@ -102,6 +101,7 @@ export type FilterChangeEvent = FilterChangeAdd | FilterChangeOpenPopover;
|
|
|
102
101
|
interface FilterColumn {
|
|
103
102
|
name: string;
|
|
104
103
|
multiple: boolean;
|
|
104
|
+
skipColumnValidation?: boolean;
|
|
105
105
|
}
|
|
106
106
|
export type FilterApplied = {
|
|
107
107
|
columnKey: string;
|
|
@@ -111,7 +111,6 @@ export interface FilterSettings {
|
|
|
111
111
|
filterColumns: FilterColumn[];
|
|
112
112
|
filtersApplied: FilterApplied[];
|
|
113
113
|
onChange: (event: FilterChangeEvent) => void;
|
|
114
|
-
skipColumnValidation?: boolean;
|
|
115
114
|
}
|
|
116
115
|
/**--------------------Termina tipado de filtros-------------------------------------------- */
|
|
117
116
|
export interface GridProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> extends Omit<NativeDataGridProps<TRow, TSummaryRow>, 'rowKeyGetter' | 'rows' | 'columns' | 'onRowsChange' | 'selectedRows' | 'onSelectedRowsChange' | 'renderers'> {
|
|
@@ -46,6 +46,7 @@ export interface FieldBase<T extends FieldType = FieldType, TOption = any> {
|
|
|
46
46
|
defaultOperandsArray?: Maybe<FieldTypeOperandsArray<T>>;
|
|
47
47
|
selectOptions?: SelectOptions;
|
|
48
48
|
selectAsyncOptions?: SelectAsyncOptions<TOption>;
|
|
49
|
+
skipColumnValidation?: boolean;
|
|
49
50
|
}
|
|
50
51
|
export interface FieldWithSelectAsync<T extends 'selectAsync', TOption = any> extends FieldBase<T, TOption> {
|
|
51
52
|
selectAsyncOptions: SelectAsyncOptions<TOption>;
|
|
@@ -56,11 +56,9 @@ const useNumberInput = (parameters) => {
|
|
|
56
56
|
(event, field, fieldValue, reason) => {
|
|
57
57
|
if (field === "value" && typeof fieldValue !== "string") {
|
|
58
58
|
switch (reason) {
|
|
59
|
-
// only a blur event will dispatch `numberInput:clamp`
|
|
60
59
|
case "numberInput:inputChange":
|
|
61
60
|
onChange?.(event, fieldValue);
|
|
62
61
|
break;
|
|
63
|
-
// only a blur event will dispatch `numberInput:clamp`
|
|
64
62
|
case "numberInput:clamp":
|
|
65
63
|
onChange?.(event, fieldValue);
|
|
66
64
|
break;
|
|
@@ -441,8 +441,8 @@ const createAreasStore = (initProps, storeDevtoolsEnabled = false) => {
|
|
|
441
441
|
bounds: {
|
|
442
442
|
left: MARGIN_GRIDLAYOUT,
|
|
443
443
|
top: MARGIN_GRIDLAYOUT,
|
|
444
|
-
right: -
|
|
445
|
-
bottom: -
|
|
444
|
+
right: -10,
|
|
445
|
+
bottom: -10
|
|
446
446
|
}
|
|
447
447
|
});
|
|
448
448
|
}
|
|
@@ -65,11 +65,6 @@ const RHFAutocompleteAsyncReducer = (onChangeFilterParms) => (state, action) =>
|
|
|
65
65
|
...state,
|
|
66
66
|
isOpen: false
|
|
67
67
|
};
|
|
68
|
-
// case actionsType.SET_SELECTED_OPTIONS_TO_AUTOCOMPLETE:
|
|
69
|
-
// return {
|
|
70
|
-
// ...state,
|
|
71
|
-
// selectedOptions: action.payload,
|
|
72
|
-
// };
|
|
73
68
|
default:
|
|
74
69
|
return state;
|
|
75
70
|
}
|
|
@@ -389,7 +389,8 @@ const useDynamicFilterAndSort = (props) => {
|
|
|
389
389
|
return {
|
|
390
390
|
filterColumns: fields.map((filter) => ({
|
|
391
391
|
name: filter.name,
|
|
392
|
-
multiple: filter.multiple || false
|
|
392
|
+
multiple: filter.multiple || false,
|
|
393
|
+
skipColumnValidation: filter.skipColumnValidation || false
|
|
393
394
|
})),
|
|
394
395
|
filtersApplied: getCurrentFilters().map((filter) => ({
|
|
395
396
|
columnKey: filter.field.name,
|
package/package.json
CHANGED
|
@@ -10,8 +10,6 @@ interface DataGridRenderProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> {
|
|
|
10
10
|
visibleRefreshFilterSort?: boolean;
|
|
11
11
|
withExternalSortSettings?: boolean;
|
|
12
12
|
withExternalFilterSettings?: boolean;
|
|
13
|
-
skipSortValidation?: boolean;
|
|
14
|
-
skipFilterValidation?: boolean;
|
|
15
13
|
}
|
|
16
14
|
/**
|
|
17
15
|
* Componente que renderiza el DataGrid para el storybook
|