@m4l/components 9.2.56-beta.2 → 9.2.56-beta.4

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 (59) hide show
  1. package/.storybook/decorators/WithWindowsToolsContext/WithContextWindowTools.d.ts +5 -0
  2. package/components/DataGrid/DataGrid.js +8 -1
  3. package/components/DataGrid/Datagrid.styles.js +15 -3
  4. package/components/DataGrid/contexts/DataGridContext/index.js +39 -8
  5. package/components/DataGrid/contexts/DataGridContext/types.d.ts +1 -2
  6. package/components/DataGrid/dictionary.d.ts +2 -1
  7. package/components/DataGrid/dictionary.js +22 -21
  8. package/components/DataGrid/subcomponents/HeaderActions/index.js +4 -3
  9. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Density/index.js +5 -5
  10. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Filter/index.js +2 -2
  11. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/MobileMenuActions/index.d.ts +4 -1
  12. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/MobileMenuActions/index.js +3 -2
  13. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/index.d.ts +2 -1
  14. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/index.js +3 -2
  15. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfig/index.js +26 -26
  16. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfig/types.d.ts +2 -0
  17. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/types.d.ts +4 -0
  18. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettings/index.d.ts +2 -1
  19. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettings/index.js +3 -2
  20. package/components/DataGrid/subcomponents/HeaderActions/types.d.ts +1 -0
  21. package/components/DataGrid/types.d.ts +1 -1
  22. package/components/DynamicFilter/dictionary.d.ts +1 -0
  23. package/components/DynamicFilter/dictionary.js +2 -1
  24. package/components/DynamicFilter/types.d.ts +1 -1
  25. package/components/WindowBase/WindowBase.js +4 -1
  26. package/components/WindowBase/WindowBase.styles.js +54 -27
  27. package/components/WindowBase/subcomponents/Header/HeaderWindowBase.js +2 -0
  28. package/components/WindowBase/subcomponents/Header/types.d.ts +1 -1
  29. package/components/WindowBase/types.d.ts +6 -0
  30. package/components/areas/components/AreasViewer/AreasViewer.js +5 -2
  31. package/components/areas/components/AreasViewer/AreasViewer.styles.js +5 -3
  32. package/components/areas/components/AreasViewer/subcomponents/Area/Area.js +2 -2
  33. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/AreaGridLayout/AreaGridLayout.js +20 -4
  34. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/AreaGridLayout/types.d.ts +2 -0
  35. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/BaseArea/BaseArea.js +7 -2
  36. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/BaseArea/types.d.ts +2 -0
  37. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/Window.js +1 -0
  38. package/components/areas/components/AreasViewer/subcomponents/Area/types.d.ts +2 -0
  39. package/components/areas/components/AreasViewer/types.d.ts +5 -0
  40. package/components/areas/contexts/AreasContext/helpers/helper.d.ts +2 -9
  41. package/components/areas/contexts/AreasContext/helpers/helper.js +14 -16
  42. package/components/areas/contexts/AreasContext/store.js +3 -3
  43. package/components/formatters/BooleanFormatter/BooleanFormatter.styles.js +2 -2
  44. package/components/hook-form/RHFAutocompleteAsync/RHFAutocompleteAsync.d.ts +2 -1
  45. package/components/hook-form/RHFAutocompleteAsync/reducer/RHFAutocompleteReducer.js +2 -1
  46. package/components/mui_extended/Accordion/Accordion.js +1 -1
  47. package/components/mui_extended/Accordion/styles.js +12 -8
  48. package/components/mui_extended/Autocomplete/renderOptions/index.d.ts +3 -1
  49. package/components/mui_extended/Autocomplete/renderOptions/index.js +3 -2
  50. package/components/mui_extended/Tab/Tab.styles.js +3 -3
  51. package/components/mui_extended/TabContent/TabContent.js +2 -2
  52. package/components/mui_extended/TabContent/TabContent.styles.js +4 -2
  53. package/components/mui_extended/TabContent/types.d.ts +1 -0
  54. package/components/popups/components/PopupsViewer/PopupsViewer.styles.js +2 -2
  55. package/hooks/useDynamicFilterAndSort/icons.d.ts +2 -2
  56. package/hooks/useDynamicFilterAndSort/icons.js +2 -2
  57. package/hooks/useDynamicFilterAndSort/useDynamicFilterAndSort.js +15 -8
  58. package/package.json +3 -3
  59. package/components/DataGrid/subcomponents/HeaderActions/subcomponents/types.d.ts +0 -2
@@ -0,0 +1,5 @@
1
+ import { StoryFn } from '@storybook/react';
2
+ /**
3
+ * Decorador para proveer los contextos de WindowTools y DynamicMFParms.
4
+ */
5
+ export declare const WithContextWindowTools: (Story: StoryFn<any>, context: any) => import("react/jsx-runtime").JSX.Element;
@@ -87,7 +87,14 @@ function DataGrid(props) {
87
87
  withActions && actionsProps && /* @__PURE__ */ jsx(
88
88
  HeaderActions,
89
89
  {
90
- ...{ withSettings, settingsProps, withRowsCount, withLocalFilters, leftActions, rightActions, withPager, pagerOptions },
90
+ withSettings,
91
+ settingsProps,
92
+ withRowsCount,
93
+ withLocalFilters,
94
+ leftActions,
95
+ rightActions,
96
+ withPager,
97
+ columns,
91
98
  size: currentSize
92
99
  }
93
100
  ),
@@ -21,6 +21,8 @@ const dataGridStyles = {
21
21
  gap: theme.vars.size.baseSpacings.sp3,
22
22
  height: "100%",
23
23
  width: "100%",
24
+ flex: 1,
25
+ overflow: "auto",
24
26
  "& .rdg .MuiCheckbox-root": {
25
27
  "& > svg": {
26
28
  color: theme.vars.palette.text.secondary
@@ -45,6 +47,11 @@ const dataGridStyles = {
45
47
  "&& .M4lclassCssSpecificity": {
46
48
  fontWeight: 400
47
49
  //Se utiliza directamente el valor porque no está tokenizado
50
+ },
51
+ '& [role="row"]:last-of-type': {
52
+ "& .rdg-cell": {
53
+ boxShadow: `inset 0 0.5px 0 0 ${theme.vars.palette?.border.secondary}, inset 0 -0.5px 0 0 ${theme.vars.palette?.border.secondary}`
54
+ }
48
55
  }
49
56
  }),
50
57
  customHeader: ({ ownerState }) => ({
@@ -81,7 +88,12 @@ const dataGridStyles = {
81
88
  display: "flex",
82
89
  flexDirection: "row",
83
90
  gap: theme.vars.size.baseSpacings["sp0-5"],
84
- alignItems: "center"
91
+ alignItems: "center",
92
+ borderRadius: theme.vars.size.borderRadius.r2,
93
+ border: theme.vars.size.borderStroke.container,
94
+ borderColor: theme.vars.palette?.border.disabled,
95
+ padding: theme.vars.size.baseSpacings.sp1,
96
+ boxShadow: theme.vars.customShadows.z1
85
97
  }),
86
98
  /**
87
99
  * Estilos para el contenedor de las acciones derecho
@@ -245,9 +257,9 @@ const dataGridStyles = {
245
257
  position: "relative",
246
258
  height: "100%",
247
259
  overflow: "hidden",
248
- borderRadius: theme.vars.size.borderRadius.r1,
260
+ borderRadius: theme.vars.size.borderRadius.r2,
249
261
  border: theme.vars.size.borderStroke.container,
250
- borderColor: theme.vars.palette?.border.default,
262
+ borderColor: theme.vars.palette?.border.secondary,
251
263
  "& .rdg ": {
252
264
  border: "none",
253
265
  background: theme.vars.palette.background.default,
@@ -5,6 +5,7 @@ import { useFirstRender } from "@m4l/graphics";
5
5
  import { g as getComponentClasses } from "../../../../utils/getComponentSlotRoot.js";
6
6
  import { D as DATAGRID_PREFIX_NAME } from "../../constants.js";
7
7
  import { C as ControlNavigateSlots, a as ColumnsConfigSlots, T as TextEditorSlots, b as TableSlots, R as RowsCountSlots, A as ActionsSlots, D as DataGridSlots } from "../../slots/DataGridEnum.js";
8
+ import { deepEqual } from "fast-equals";
8
9
  const DataGridContext = createContext(null);
9
10
  const getColumnConfigByKey = (key, storeColumnsConfig) => {
10
11
  let indexFind = -1;
@@ -42,7 +43,7 @@ function getColumnsConfig(id, columns, defaultUserColumns = void 0) {
42
43
  index: columnConfigIndex > -1 ? columnConfigIndex : index,
43
44
  visible: columnConfig.visible === void 0 ? true : columnConfig.visible,
44
45
  frozen: columnConfig.frozen ?? false,
45
- orginalIndex: index,
46
+ originalIndex: index,
46
47
  originalVisible: column.visible === void 0 ? true : column.visible,
47
48
  originalFrozen: column.frozen ?? false
48
49
  };
@@ -119,7 +120,7 @@ function DataGridProvider(props) {
119
120
  onChangeUserColumns,
120
121
  size
121
122
  } = props;
122
- const isFirstRender = useFirstRender();
123
+ const isFirstRender = useFirstRender([columns, id]);
123
124
  const classes = getComponentClasses(
124
125
  DATAGRID_PREFIX_NAME,
125
126
  {
@@ -170,13 +171,43 @@ function DataGridProvider(props) {
170
171
  }, [defaultUserColumns]);
171
172
  useEffect(() => {
172
173
  if (!isFirstRender) {
174
+ const finalColumnsConfig = [];
175
+ for (let i = 0; i < columnsConfig.length; i++) {
176
+ const columnIndex = columns.findIndex((c) => c.key === columnsConfig[i]?.key);
177
+ if (columnIndex !== -1) {
178
+ const column = columns[columnIndex];
179
+ finalColumnsConfig.push({
180
+ ...columnsConfig[i],
181
+ // name: column.name as string,
182
+ originalIndex: columnIndex,
183
+ originalFrozen: column.frozen ?? false,
184
+ originalVisible: column.visible ?? true
185
+ });
186
+ }
187
+ }
173
188
  const newColumns = columns.filter((column, index) => column.key !== columnsConfig[index]?.key);
174
- const newColConfig = getColumnsConfig(id, newColumns).map((column, index) => {
175
- const indexNewCol = index + columnsConfig.length;
176
- return { ...column, index: indexNewCol, orginalIndex: indexNewCol };
177
- });
178
- columnsConfig.push(...newColConfig);
179
- setColumnsWidths((prevColumnsWidth) => new Map([...prevColumnsWidth, ...getColumnsWidth(id, newColumns, defaultUserColumns)]));
189
+ if (newColumns.length > 0) {
190
+ const colLength = finalColumnsConfig.length;
191
+ const newColConfig = getColumnsConfig(id, newColumns).map((columnConfig, index) => {
192
+ const columnIndex = columns.findIndex((c) => c.key === newColumns[index].key);
193
+ const column = newColumns[index];
194
+ const indexNewCol = index + colLength;
195
+ return {
196
+ ...columnConfig,
197
+ index: indexNewCol,
198
+ name: column.name,
199
+ originalIndex: columnIndex,
200
+ originalFrozen: column.frozen ?? false,
201
+ originalVisible: column.visible ?? true
202
+ };
203
+ });
204
+ finalColumnsConfig.push(...newColConfig);
205
+ }
206
+ if (deepEqual(columnsConfig, finalColumnsConfig)) {
207
+ return;
208
+ }
209
+ console.log("useEffect columnsConfig changed", columnsConfig, finalColumnsConfig);
210
+ setColumnsConfigOptions(finalColumnsConfig);
180
211
  }
181
212
  }, [columns, id]);
182
213
  const onChangeColumnsConfig = useCallback(
@@ -7,11 +7,10 @@ export interface BaseConfigColumn {
7
7
  visible: boolean;
8
8
  index: number;
9
9
  frozen: boolean;
10
- name: string;
11
10
  }
12
11
  export interface IConfigColumn extends BaseConfigColumn {
13
12
  hidden: boolean;
14
- orginalIndex: number;
13
+ originalIndex: number;
15
14
  originalVisible: boolean;
16
15
  originalFrozen: boolean;
17
16
  }
@@ -1,8 +1,9 @@
1
+ export declare const DATAGRID_DICTIONARY_ID = "data_grid";
1
2
  /**
2
3
  * TODO: Documentar
3
4
  */
4
5
  export declare function getDataGridComponentsDictionary(): string[];
5
- export declare const dictionary: {
6
+ export declare const DICTIONARY: {
6
7
  LABEL_ACTIONS: string;
7
8
  LABEL_ROWS_PER_PAGE: string;
8
9
  LABEL_OF: string;
@@ -1,30 +1,31 @@
1
1
  import { g as getMenuActionsComponentsDictionary } from "../MenuActions/dictionary.js";
2
2
  import { g as getModalDictionary } from "../ModalDialog/dictionary.js";
3
3
  import { g as getPagerComponentsDictionary } from "../Pager/dicctionary.js";
4
+ const DATAGRID_DICTIONARY_ID = "data_grid";
4
5
  function getDataGridComponentsDictionary() {
5
- return ["data_grid"].concat(getPagerComponentsDictionary()).concat(getMenuActionsComponentsDictionary()).concat(getModalDictionary());
6
+ return [DATAGRID_DICTIONARY_ID].concat(getPagerComponentsDictionary()).concat(getMenuActionsComponentsDictionary()).concat(getModalDictionary());
6
7
  }
7
- const dictionary = {
8
- DENSITY_COMPACT: `${getDataGridComponentsDictionary()[0]}.density_compact`,
9
- DENSITY_STANDARD: `${getDataGridComponentsDictionary()[0]}.density_standard`,
10
- DENSITY_CONFORTABLE: `${getDataGridComponentsDictionary()[0]}.density_confortable`,
11
- DENSITY_TOOLTIP: `${getDataGridComponentsDictionary()[0]}.tooltip_density`,
12
- TOOLTIP_FILTER_HIDE: `${getDataGridComponentsDictionary()[0]}.tooltip_filter_hide`,
13
- TOOLTIP_FILTER_SHOW: `${getDataGridComponentsDictionary()[0]}.tooltip_filter_show`,
14
- SETTINGS_COLUMN_NAME: `${getDataGridComponentsDictionary()[0]}.settings_column_name`,
15
- SETTINGS_COLUMN_POSITION: `${getDataGridComponentsDictionary()[0]}.settings_column_position`,
16
- SETTINGS_COLUMN_VISIBLE: `${getDataGridComponentsDictionary()[0]}.settings_column_visible`,
17
- SETTINGS_COLUMNS_FROZEN: `${getDataGridComponentsDictionary()[0]}.settings_column_frozen`,
18
- SETTINGS_SEL_COLUMNS: `${getDataGridComponentsDictionary()[0]}.settings_sel_columns`,
19
- SETTINGS_MOVE_FIRST: `${getDataGridComponentsDictionary()[0]}.settings_move_first`,
20
- SETTINGS_MOVE_UP: `${getDataGridComponentsDictionary()[0]}.settings_move_up`,
21
- SETTINGS_MOVE_LAST: `${getDataGridComponentsDictionary()[0]}.settings_move_last`,
22
- SETTINGS_MOVE_DOWN: `${getDataGridComponentsDictionary()[0]}.settings_move_down`,
23
- SETTINGS_VISIBLE_ALL: `${getDataGridComponentsDictionary()[0]}.settings_visible_all`,
24
- SETTINGS_NO_VISIBLE_ALL: `${getDataGridComponentsDictionary()[0]}.settings_no_visible_all`,
25
- SETTINGS_RESTORE: `${getDataGridComponentsDictionary()[0]}.settings_restore`
8
+ const DICTIONARY = {
9
+ DENSITY_COMPACT: `${DATAGRID_DICTIONARY_ID}.density_compact`,
10
+ DENSITY_STANDARD: `${DATAGRID_DICTIONARY_ID}.density_standard`,
11
+ DENSITY_CONFORTABLE: `${DATAGRID_DICTIONARY_ID}.density_confortable`,
12
+ DENSITY_TOOLTIP: `${DATAGRID_DICTIONARY_ID}.tooltip_density`,
13
+ TOOLTIP_FILTER_HIDE: `${DATAGRID_DICTIONARY_ID}.tooltip_filter_hide`,
14
+ TOOLTIP_FILTER_SHOW: `${DATAGRID_DICTIONARY_ID}.tooltip_filter_show`,
15
+ SETTINGS_COLUMN_NAME: `${DATAGRID_DICTIONARY_ID}.settings_column_name`,
16
+ SETTINGS_COLUMN_POSITION: `${DATAGRID_DICTIONARY_ID}.settings_column_position`,
17
+ SETTINGS_COLUMN_VISIBLE: `${DATAGRID_DICTIONARY_ID}.settings_column_visible`,
18
+ SETTINGS_COLUMNS_FROZEN: `${DATAGRID_DICTIONARY_ID}.settings_column_frozen`,
19
+ SETTINGS_SEL_COLUMNS: `${DATAGRID_DICTIONARY_ID}.settings_sel_columns`,
20
+ SETTINGS_MOVE_FIRST: `${DATAGRID_DICTIONARY_ID}.settings_move_first`,
21
+ SETTINGS_MOVE_UP: `${DATAGRID_DICTIONARY_ID}.settings_move_up`,
22
+ SETTINGS_MOVE_LAST: `${DATAGRID_DICTIONARY_ID}.settings_move_last`,
23
+ SETTINGS_MOVE_DOWN: `${DATAGRID_DICTIONARY_ID}.settings_move_down`,
24
+ SETTINGS_VISIBLE_ALL: `${DATAGRID_DICTIONARY_ID}.settings_visible_all`,
25
+ SETTINGS_NO_VISIBLE_ALL: `${DATAGRID_DICTIONARY_ID}.settings_no_visible_all`,
26
+ SETTINGS_RESTORE: `${DATAGRID_DICTIONARY_ID}.settings_restore`
26
27
  };
27
28
  export {
28
- dictionary as d,
29
+ DICTIONARY as D,
29
30
  getDataGridComponentsDictionary as g
30
31
  };
@@ -15,21 +15,22 @@ function HeaderActions(props) {
15
15
  leftActions: LeftActions,
16
16
  rightActions: RightActions,
17
17
  withPager,
18
- size
18
+ size,
19
+ columns
19
20
  } = props;
20
21
  const isMobile = useIsMobile();
21
22
  const { rowHeights } = useDataGrid();
22
23
  const { currentSize } = useComponentSize(size);
23
24
  return /* @__PURE__ */ jsx(ActionsRootStyled, { ownerState: { size: currentSize }, children: isMobile ? /* @__PURE__ */ jsxs(Fragment, { children: [
24
25
  LeftActions,
25
- /* @__PURE__ */ jsx(MobileMenuActions, {}),
26
+ /* @__PURE__ */ jsx(MobileMenuActions, { columns }),
26
27
  RightActions
27
28
  ] }) : /* @__PURE__ */ jsxs(ActionsConfigContainerStyled, { ownerState: { withPager }, children: [
28
29
  /* @__PURE__ */ jsxs(ContainerLeftActionsStyled, { children: [
29
30
  LeftActions,
30
31
  typeof rowHeights !== "number" && /* @__PURE__ */ jsx(Density, {}),
31
32
  withLocalFilters && /* @__PURE__ */ jsx(Filter, {}),
32
- withSettings && /* @__PURE__ */ jsx(Settings, { ...settingsProps })
33
+ withSettings && /* @__PURE__ */ jsx(Settings, { ...settingsProps, columns })
33
34
  ] }),
34
35
  RightActions && /* @__PURE__ */ jsx(ContainerRightActionsStyled, { children: RightActions })
35
36
  ] }) });
@@ -5,7 +5,7 @@ import { useTheme } from "@mui/material";
5
5
  import { M as MenuActions } from "../../../../../MenuActions/MenuActions.js";
6
6
  import { u as useDataGrid } from "../../../../hooks/useDataGrid.js";
7
7
  import { p as pathIcons } from "../../../../icons.js";
8
- import { d as dictionary } from "../../../../dictionary.js";
8
+ import { D as DICTIONARY } from "../../../../dictionary.js";
9
9
  function Density() {
10
10
  const { host_static_assets, environment_assets } = useEnvironment();
11
11
  const { rowHeights, currentRowHeightVariant, setRowHeightVariant } = useDataGrid();
@@ -20,21 +20,21 @@ function Density() {
20
20
  startIcon: `${host_static_assets}/${environment_assets}/${pathIcons.compact}`,
21
21
  onClick: () => setRowHeightVariant("compact"),
22
22
  disabled: currentRowHeightVariant === "compact",
23
- label: getLabel(dictionary.DENSITY_COMPACT)
23
+ label: getLabel(DICTIONARY.DENSITY_COMPACT)
24
24
  },
25
25
  {
26
26
  type: "menuItem",
27
27
  startIcon: `${host_static_assets}/${environment_assets}/${pathIcons.standard}`,
28
28
  onClick: () => setRowHeightVariant("standard"),
29
29
  disabled: currentRowHeightVariant === "standard",
30
- label: getLabel(dictionary.DENSITY_STANDARD)
30
+ label: getLabel(DICTIONARY.DENSITY_STANDARD)
31
31
  },
32
32
  {
33
33
  type: "menuItem",
34
34
  startIcon: `${host_static_assets}/${environment_assets}/${pathIcons.confortable}`,
35
35
  onClick: () => setRowHeightVariant("confortable"),
36
36
  disabled: currentRowHeightVariant === "confortable",
37
- label: getLabel(dictionary.DENSITY_CONFORTABLE)
37
+ label: getLabel(DICTIONARY.DENSITY_CONFORTABLE)
38
38
  }
39
39
  ];
40
40
  }, [
@@ -66,7 +66,7 @@ function Density() {
66
66
  transformOrigin: { vertical: "top", horizontal: "left" },
67
67
  menuActions,
68
68
  icon: currenViewIcon,
69
- toolTip: getLabel(dictionary.DENSITY_TOOLTIP),
69
+ toolTip: getLabel(DICTIONARY.DENSITY_TOOLTIP),
70
70
  paperProps: { style: { marginTop: "5px" } }
71
71
  }
72
72
  );
@@ -3,7 +3,7 @@ import { useEnvironment, useModuleDictionary } from "@m4l/core";
3
3
  import { u as useFilters } from "../../../../hooks/useFilters.js";
4
4
  import { I as IconButton } from "../../../../../mui_extended/IconButton/IconButton.js";
5
5
  import { p as pathIcons } from "../../../../icons.js";
6
- import { d as dictionary } from "../../../../dictionary.js";
6
+ import { D as DICTIONARY } from "../../../../dictionary.js";
7
7
  function Filter() {
8
8
  const { activeFilters, setActiveFilters } = useFilters();
9
9
  const { host_static_assets, environment_assets } = useEnvironment();
@@ -14,7 +14,7 @@ function Filter() {
14
14
  return /* @__PURE__ */ jsx(
15
15
  IconButton,
16
16
  {
17
- tooltip: activeFilters ? getLabel(dictionary.TOOLTIP_FILTER_HIDE) : getLabel(dictionary.TOOLTIP_FILTER_SHOW),
17
+ tooltip: activeFilters ? getLabel(DICTIONARY.TOOLTIP_FILTER_HIDE) : getLabel(DICTIONARY.TOOLTIP_FILTER_SHOW),
18
18
  onClick: toggleIcon,
19
19
  "aria-label": "filter",
20
20
  icon: `${host_static_assets}/${environment_assets}/${pathIcons.filter}`
@@ -1,4 +1,7 @@
1
+ import { Column } from 'react-data-grid';
1
2
  /**
2
3
  * Renderiza las acciones cuando el dispositivo es un móvil
3
4
  */
4
- export declare const MobileMenuActions: () => import("react/jsx-runtime").JSX.Element;
5
+ export declare const MobileMenuActions: (props: {
6
+ columns: readonly Column<any, any>[];
7
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -5,12 +5,13 @@ import { u as useFilters } from "../../../../hooks/useFilters.js";
5
5
  import { u as useModalSettings } from "../hooks/useModalSettings/index.js";
6
6
  import { p as pathIcons } from "../../../../icons.js";
7
7
  import { M as MenuActions } from "../../../../../MenuActions/MenuActions.js";
8
- const MobileMenuActions = () => {
8
+ const MobileMenuActions = (props) => {
9
+ const { columns } = props;
9
10
  const { getLabel } = useModuleDictionary();
10
11
  const { host_static_assets, environment_assets } = useEnvironment();
11
12
  const { currentRowHeightVariant, setRowHeightVariant, size } = useDataGrid();
12
13
  const { activeFilters, setActiveFilters } = useFilters();
13
- const modalSettings = useModalSettings(size);
14
+ const modalSettings = useModalSettings(size, columns);
14
15
  const toggleIcon = () => {
15
16
  setActiveFilters(!activeFilters);
16
17
  };
@@ -1,4 +1,5 @@
1
+ import { SettingsProps } from './types';
1
2
  /**
2
3
  * Componente que renderiza el icono de configuración en el DataGrid
3
4
  */
4
- export declare function Settings(): import("react/jsx-runtime").JSX.Element;
5
+ export declare function Settings(props: SettingsProps): import("react/jsx-runtime").JSX.Element;
@@ -4,10 +4,11 @@ import { useEnvironment, useModuleDictionary } from "@m4l/core";
4
4
  import { u as useModalSettings } from "../hooks/useModalSettings/index.js";
5
5
  import { p as pathIcons } from "../../../../icons.js";
6
6
  import { u as useDataGrid } from "../../../../hooks/useDataGrid.js";
7
- function Settings() {
7
+ function Settings(props) {
8
+ const { columns } = props;
8
9
  const { host_static_assets, environment_assets } = useEnvironment();
9
10
  const { size } = useDataGrid();
10
- const modalSettings = useModalSettings(size);
11
+ const modalSettings = useModalSettings(size, columns);
11
12
  const { getLabel } = useModuleDictionary();
12
13
  return /* @__PURE__ */ jsx(
13
14
  IconButton,
@@ -5,18 +5,18 @@ import DataGrid from "react-data-grid";
5
5
  import { I as IconButton } from "../../../../../../../mui_extended/IconButton/IconButton.js";
6
6
  import { p as pathIcons } from "../../../../../../icons.js";
7
7
  import { g as ColumnsConfigWrapperStyled, h as ColumnsConfigDataGridStyled, i as ColumnsConfigSelColumnsStyled, T as TableWrapperDataGridStyled, j as ColumnsConfigActiosStyled } from "../../../../../../slots/DataGridSlot.js";
8
- import { d as dictionary } from "../../../../../../dictionary.js";
8
+ import { D as DICTIONARY } from "../../../../../../dictionary.js";
9
9
  import { C as ColumnInteractiveCheckFormatter } from "../../../../../../formatters/ColumnInteractiveCheckFormatter/formatter.js";
10
- function getRowsFromColumnsConfig(columnsConfig) {
11
- return columnsConfig.filter((column) => !column.hidden).map(
12
- (column) => ({
13
- key: column.key,
14
- name: column.name,
15
- visible: column.visible === void 0 ? true : column.visible,
16
- frozen: column.frozen === void 0 ? false : column.frozen,
17
- originalIndex: column.orginalIndex,
18
- originalFrozen: column.originalFrozen,
19
- originalVisible: column.originalVisible
10
+ function getRowsFromColumnsConfig(columnsConfig, columns) {
11
+ return columnsConfig.filter((cConfig) => !cConfig.hidden).map(
12
+ (cConfig) => ({
13
+ key: cConfig.key,
14
+ name: columns?.find((c) => c.key === cConfig.key)?.name ?? "",
15
+ visible: cConfig.visible === void 0 ? true : cConfig.visible,
16
+ frozen: cConfig.frozen === void 0 ? false : cConfig.frozen,
17
+ originalIndex: cConfig.originalIndex,
18
+ originalFrozen: cConfig.originalFrozen,
19
+ originalVisible: cConfig.originalVisible
20
20
  })
21
21
  );
22
22
  }
@@ -29,10 +29,10 @@ const getAlignClass = (align) => {
29
29
  };
30
30
  const ColumnsConfig = forwardRef((props, ref) => {
31
31
  const refdata_grid = useRef(null);
32
- const { onCloseSettings, columnsConfig, onChangeColumnsConfig, rowHeight, classes, size } = props;
32
+ const { onCloseSettings, columnsConfig, onChangeColumnsConfig, rowHeight, classes, size, columns } = props;
33
33
  const { getLabel } = useModuleDictionary();
34
34
  const [isInit, setIsInit] = useState(true);
35
- const [rows, setRows] = useState(getRowsFromColumnsConfig(columnsConfig));
35
+ const [rows, setRows] = useState(getRowsFromColumnsConfig(columnsConfig, columns));
36
36
  const [selRows, setSelRows] = useState(() => /* @__PURE__ */ new Set());
37
37
  const divRef = useRef(null);
38
38
  const { host_static_assets, environment_assets } = useEnvironment();
@@ -44,7 +44,7 @@ const ColumnsConfig = forwardRef((props, ref) => {
44
44
  () => [
45
45
  {
46
46
  key: "name",
47
- name: getLabel(dictionary.SETTINGS_COLUMN_NAME),
47
+ name: getLabel(DICTIONARY.SETTINGS_COLUMN_NAME),
48
48
  width: 220,
49
49
  resizable: true,
50
50
  type: "string",
@@ -52,14 +52,14 @@ const ColumnsConfig = forwardRef((props, ref) => {
52
52
  },
53
53
  {
54
54
  key: "originalIndex",
55
- name: getLabel(dictionary.SETTINGS_COLUMN_POSITION),
55
+ name: getLabel(DICTIONARY.SETTINGS_COLUMN_POSITION),
56
56
  width: 50,
57
57
  type: "number",
58
58
  ...getAlignClass("center")
59
59
  },
60
60
  {
61
61
  key: "visible",
62
- name: getLabel(dictionary.SETTINGS_COLUMN_VISIBLE),
62
+ name: getLabel(DICTIONARY.SETTINGS_COLUMN_VISIBLE),
63
63
  width: 80,
64
64
  type: "boolean",
65
65
  formatter: ColumnInteractiveCheckFormatter,
@@ -67,7 +67,7 @@ const ColumnsConfig = forwardRef((props, ref) => {
67
67
  },
68
68
  {
69
69
  key: "frozen",
70
- name: getLabel(dictionary.SETTINGS_COLUMNS_FROZEN),
70
+ name: getLabel(DICTIONARY.SETTINGS_COLUMNS_FROZEN),
71
71
  width: 80,
72
72
  type: "boolean",
73
73
  formatter: ColumnInteractiveCheckFormatter,
@@ -94,7 +94,7 @@ const ColumnsConfig = forwardRef((props, ref) => {
94
94
  };
95
95
  useEffect(() => {
96
96
  if (isInit === false) {
97
- setRows(getRowsFromColumnsConfig(columnsConfig));
97
+ setRows(getRowsFromColumnsConfig(columnsConfig, columns));
98
98
  }
99
99
  setIsInit(false);
100
100
  }, [columnsConfig]);
@@ -185,7 +185,7 @@ const ColumnsConfig = forwardRef((props, ref) => {
185
185
  };
186
186
  return /* @__PURE__ */ jsxs(ColumnsConfigWrapperStyled, { ref: divRef, children: [
187
187
  /* @__PURE__ */ jsxs(ColumnsConfigDataGridStyled, { children: [
188
- /* @__PURE__ */ jsx(ColumnsConfigSelColumnsStyled, { ownerState: { size }, children: getLabel(dictionary.SETTINGS_SEL_COLUMNS) }),
188
+ /* @__PURE__ */ jsx(ColumnsConfigSelColumnsStyled, { ownerState: { size }, children: getLabel(DICTIONARY.SETTINGS_SEL_COLUMNS) }),
189
189
  /* @__PURE__ */ jsx(TableWrapperDataGridStyled, { className: classes?.tableWrapperDataGrid, ownerState: { size }, children: /* @__PURE__ */ jsx(
190
190
  DataGrid,
191
191
  {
@@ -207,7 +207,7 @@ const ColumnsConfig = forwardRef((props, ref) => {
207
207
  /* @__PURE__ */ jsx(
208
208
  IconButton,
209
209
  {
210
- tooltip: getLabel(dictionary.SETTINGS_MOVE_FIRST),
210
+ tooltip: getLabel(DICTIONARY.SETTINGS_MOVE_FIRST),
211
211
  onClick: handleMoveFirst,
212
212
  "aria-label": "move first place",
213
213
  disabled: rowSelectedIndex < 1,
@@ -217,7 +217,7 @@ const ColumnsConfig = forwardRef((props, ref) => {
217
217
  /* @__PURE__ */ jsx(
218
218
  IconButton,
219
219
  {
220
- tooltip: getLabel(dictionary.SETTINGS_MOVE_UP),
220
+ tooltip: getLabel(DICTIONARY.SETTINGS_MOVE_UP),
221
221
  onClick: () => handleMoveUpDownd(-1),
222
222
  "aria-label": "move up place",
223
223
  disabled: rowSelectedIndex < 1,
@@ -227,7 +227,7 @@ const ColumnsConfig = forwardRef((props, ref) => {
227
227
  /* @__PURE__ */ jsx(
228
228
  IconButton,
229
229
  {
230
- tooltip: getLabel(dictionary.SETTINGS_MOVE_LAST),
230
+ tooltip: getLabel(DICTIONARY.SETTINGS_MOVE_LAST),
231
231
  onClick: handleMoveLast,
232
232
  "aria-label": "move last place",
233
233
  disabled: !!(rowSelectedIndex === rows.length - 1 || rowSelectedIndex === -1),
@@ -237,7 +237,7 @@ const ColumnsConfig = forwardRef((props, ref) => {
237
237
  /* @__PURE__ */ jsx(
238
238
  IconButton,
239
239
  {
240
- tooltip: getLabel(dictionary.SETTINGS_MOVE_DOWN),
240
+ tooltip: getLabel(DICTIONARY.SETTINGS_MOVE_DOWN),
241
241
  onClick: () => handleMoveUpDownd(1),
242
242
  "aria-label": "move down place",
243
243
  disabled: !!(rowSelectedIndex === rows.length - 1 || rowSelectedIndex === -1),
@@ -247,7 +247,7 @@ const ColumnsConfig = forwardRef((props, ref) => {
247
247
  /* @__PURE__ */ jsx(
248
248
  IconButton,
249
249
  {
250
- tooltip: getLabel(dictionary.SETTINGS_VISIBLE_ALL),
250
+ tooltip: getLabel(DICTIONARY.SETTINGS_VISIBLE_ALL),
251
251
  onClick: checkAll,
252
252
  "aria-label": "check visible all",
253
253
  icon: `${host_static_assets}/${environment_assets}/${pathIcons.checkAll}`
@@ -256,7 +256,7 @@ const ColumnsConfig = forwardRef((props, ref) => {
256
256
  /* @__PURE__ */ jsx(
257
257
  IconButton,
258
258
  {
259
- tooltip: getLabel(dictionary.SETTINGS_NO_VISIBLE_ALL),
259
+ tooltip: getLabel(DICTIONARY.SETTINGS_NO_VISIBLE_ALL),
260
260
  onClick: unCheckAll,
261
261
  "aria-label": "un check all",
262
262
  icon: `${host_static_assets}/${environment_assets}/${pathIcons.uncheckAll}`
@@ -265,7 +265,7 @@ const ColumnsConfig = forwardRef((props, ref) => {
265
265
  /* @__PURE__ */ jsx(
266
266
  IconButton,
267
267
  {
268
- tooltip: getLabel(dictionary.SETTINGS_RESTORE),
268
+ tooltip: getLabel(DICTIONARY.SETTINGS_RESTORE),
269
269
  onClick: restoreAll,
270
270
  "aria-label": "Restore columns",
271
271
  icon: `${host_static_assets}/${environment_assets}/${pathIcons.restoreColumns}`
@@ -1,5 +1,6 @@
1
1
  import { DataGridContextProps, IConfigColumn } from '../../../../../../contexts/DataGridContext/types';
2
2
  import { GridProps } from '../../../../../../types';
3
+ import { Column } from 'react-data-grid';
3
4
  export interface Row {
4
5
  key: string;
5
6
  name: string;
@@ -17,6 +18,7 @@ export type ColumnsConfigRef = {
17
18
  };
18
19
  export interface ConfigProps {
19
20
  onCloseSettings: () => void;
21
+ columns: readonly Column<any, any>[];
20
22
  columnsConfig: IConfigColumn[];
21
23
  onChangeColumnsConfig: (newColumnsConfig: IConfigColumn[]) => void;
22
24
  rowHeight: number;
@@ -0,0 +1,4 @@
1
+ import { Column } from 'react-data-grid';
2
+ export interface SettingsProps {
3
+ columns: readonly Column<any, any>[];
4
+ }
@@ -1,7 +1,8 @@
1
1
  import { GridProps } from '../../../../../types';
2
+ import { Column } from 'react-data-grid';
2
3
  /**
3
4
  * Hook que renderiza el modal de configuración de las columnas
4
5
  * de la tabla
5
6
  */
6
- declare const useModalSettings: (size: GridProps<unknown, unknown>["size"]) => () => void;
7
+ declare const useModalSettings: (size: GridProps<unknown, unknown>["size"], columns: readonly Column<any, any>[]) => () => void;
7
8
  export default useModalSettings;
@@ -11,7 +11,7 @@ import { A as ActionsContainer } from "../../../../../../CommonActions/component
11
11
  import { W as WindowBase } from "../../../../../../WindowBase/WindowBase.js";
12
12
  import { A as ActionCancel } from "../../../../../../CommonActions/components/ActionCancel/ActionCancel.js";
13
13
  import { A as ActionIntro } from "../../../../../../CommonActions/components/ActionIntro/ActionIntro.js";
14
- const useModalSettings = (size) => {
14
+ const useModalSettings = (size, columns) => {
15
15
  const { openModal, closeModal } = useModal();
16
16
  const { columnsConfig, onChangeColumnsConfig, currentRowHeight, classes } = useDataGrid();
17
17
  const { getLabel } = useModuleDictionary();
@@ -53,7 +53,8 @@ const useModalSettings = (size) => {
53
53
  onChangeColumnsConfig: handleColumnsSetting,
54
54
  onCloseSettings,
55
55
  classes,
56
- size
56
+ size,
57
+ columns
57
58
  }
58
59
  ) }),
59
60
  /* @__PURE__ */ jsxs(ActionsContainer, { children: [
@@ -1,4 +1,5 @@
1
1
  import { ActionsProps, DataGridProps } from '../../types';
2
2
  export interface HeaderActionsProps extends Omit<ActionsProps, 'pagerOptions'> {
3
3
  size: DataGridProps<unknown, unknown>['size'];
4
+ columns: DataGridProps<unknown, unknown>['columns'];
4
5
  }
@@ -7,8 +7,8 @@ import { OverridesStyleRules } from '@mui/material/styles/overrides';
7
7
  import { DATAGRID_PREFIX_NAME } from './constants';
8
8
  import { IGridConfig } from './contexts/DataGridContext/types';
9
9
  import { Sizes } from '@m4l/styles';
10
- import { SettingsProps } from './subcomponents/HeaderActions/subcomponents/types';
11
10
  import { PagerProps } from '../Pager';
11
+ import { SettingsProps } from './subcomponents/HeaderActions/subcomponents/Settings/types';
12
12
  export type GridFormatterPropss<T, SR> = FormatterProps<T, SR>;
13
13
  export type { ColumnUncertaintyFormatter, ColumnPointsFormatter, ColumnNestedValueFormatter, } from './formatters';
14
14
  export declare type ColumnType = 'string' | 'date' | 'number' | 'boolean' | 'custom';
@@ -45,5 +45,6 @@ export declare const DICCTIONARY: {
45
45
  readonly error_invalid_date: "dynamic_filter.error_invalid_date";
46
46
  readonly error_less_than_start: "dynamic_filter.error_less_than_start";
47
47
  readonly error_operand_mustbe_number: "dynamic_filter.error_operand_mustbe_number";
48
+ readonly error_invalid_filters_before: "dynamic_filter.error_invalid_filters_before";
48
49
  };
49
50
  export type TypeDictionary = typeof DICCTIONARY;
@@ -36,7 +36,8 @@ const DICCTIONARY = {
36
36
  error_operator_required: `${DYNAMIC_FILTER_DICTIONARY_ID}.error_operator_required`,
37
37
  error_invalid_date: `${DYNAMIC_FILTER_DICTIONARY_ID}.error_invalid_date`,
38
38
  error_less_than_start: `${DYNAMIC_FILTER_DICTIONARY_ID}.error_less_than_start`,
39
- error_operand_mustbe_number: `${DYNAMIC_FILTER_DICTIONARY_ID}.error_operand_mustbe_number`
39
+ error_operand_mustbe_number: `${DYNAMIC_FILTER_DICTIONARY_ID}.error_operand_mustbe_number`,
40
+ error_invalid_filters_before: `${DYNAMIC_FILTER_DICTIONARY_ID}.error_invalid_filters_before`
40
41
  };
41
42
  export {
42
43
  DYNAMIC_FILTER_DICTIONARY_ID as D,
@@ -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<RHFAutocompleteAsyncProps<TOption>, 'type' | 'endPoint' | 'responseToCamelCase' | 'multiple' | 'autoComplete' | 'autoCapitalize' | 'parms' | 'timeout'> & {
30
+ type SelectAsyncOptions<TOption = any> = Pick<RHFAutocompleteAsyncProps<TOption>, 'type' | 'endPoint' | 'responseToCamelCase' | 'multiple' | 'autoComplete' | 'autoCapitalize' | 'parms' | 'timeout' | 'onChangeFilterParms'> & {
31
31
  getOptionLabel: (option: TOption) => string;
32
32
  isOptionEqualToValue: (options: TOption | TOption[], value: TOption) => boolean;
33
33
  getOptionId: (option: TOption) => string | number;