@m4l/components 9.3.8 → 9.3.9
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 +2 -2
- package/components/DataGrid/subcomponents/Table/hooks/useSortColumnsRows.js +4 -2
- package/components/DataGrid/types.d.ts +2 -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/package.json +1 -1
- package/storybook/components/DataGrid/subcomponents/DataGridRender.d.ts +2 -0
|
@@ -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 && !sortSettings.skipColumnValidation) {
|
|
170
170
|
for (const sort of sortSettings.sortsColumns) {
|
|
171
171
|
if (!keys.has(sort)) {
|
|
172
172
|
throw new Error(
|
|
@@ -175,7 +175,7 @@ function DataGridProvider(props) {
|
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
if (filterSettings?.filterColumns) {
|
|
178
|
+
if (filterSettings?.filterColumns && !filterSettings.skipColumnValidation) {
|
|
179
179
|
for (const filterField of filterSettings.filterColumns) {
|
|
180
180
|
if (!keys.has(filterField.name)) {
|
|
181
181
|
throw new Error(
|
|
@@ -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 {
|
|
@@ -185,6 +183,10 @@ const useSortColumnsRows = (sourceColumns, sourceRows, popoverHandlers) => {
|
|
|
185
183
|
let fixedValue;
|
|
186
184
|
if (typeof valueMaybeString === "string") {
|
|
187
185
|
fixedValue = valueMaybeString;
|
|
186
|
+
} else if (typeof valueMaybeString === "number") {
|
|
187
|
+
fixedValue = valueMaybeString.toString();
|
|
188
|
+
} else if (valueMaybeString !== null && valueMaybeString !== void 0) {
|
|
189
|
+
fixedValue = String(valueMaybeString);
|
|
188
190
|
} else {
|
|
189
191
|
fixedValue = "";
|
|
190
192
|
}
|
|
@@ -88,6 +88,7 @@ export interface SortSettings {
|
|
|
88
88
|
sortsColumns: string[];
|
|
89
89
|
sortsApplied: SortApplied[];
|
|
90
90
|
onChange: (event: SortChangeEvent) => void;
|
|
91
|
+
skipColumnValidation?: boolean;
|
|
91
92
|
}
|
|
92
93
|
/**---------------------------------------------------------------- */
|
|
93
94
|
export type FilterChangeAdd = {
|
|
@@ -110,6 +111,7 @@ export interface FilterSettings {
|
|
|
110
111
|
filterColumns: FilterColumn[];
|
|
111
112
|
filtersApplied: FilterApplied[];
|
|
112
113
|
onChange: (event: FilterChangeEvent) => void;
|
|
114
|
+
skipColumnValidation?: boolean;
|
|
113
115
|
}
|
|
114
116
|
/**--------------------Termina tipado de filtros-------------------------------------------- */
|
|
115
117
|
export interface GridProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> extends Omit<NativeDataGridProps<TRow, TSummaryRow>, 'rowKeyGetter' | 'rows' | 'columns' | 'onRowsChange' | 'selectedRows' | 'onSelectedRowsChange' | 'renderers'> {
|
|
@@ -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
|
}
|
package/package.json
CHANGED
|
@@ -10,6 +10,8 @@ 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;
|
|
13
15
|
}
|
|
14
16
|
/**
|
|
15
17
|
* Componente que renderiza el DataGrid para el storybook
|