@m4l/components 9.2.56 → 9.2.57

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 (84) hide show
  1. package/.storybook/decorators/WithWindowsToolsContext/WithContextWindowTools.d.ts +5 -0
  2. package/components/AccountPopover/slots/AccountPopoverSlots.d.ts +3 -3
  3. package/components/AppBar/slots/AppBarSlots.d.ts +2 -2
  4. package/components/Chip/slots/ChipSlots.d.ts +1 -1
  5. package/components/Color/slots/ColorSlots.d.ts +1 -1
  6. package/components/CommonActions/components/ActionCancel/slots/ActionsCancelSlots.d.ts +1 -1
  7. package/components/CommonActions/components/ActionFormCancel/slots/ActionFormCancelSlots.d.ts +1 -1
  8. package/components/CommonActions/components/ActionIntro/slots/ActionsIntroSlots.d.ts +1 -1
  9. package/components/CommonActions/components/ActionsContainer/slots/ActionsContainerSlots.d.ts +1 -1
  10. package/components/DataGrid/DataGrid.js +2 -1
  11. package/components/DataGrid/contexts/DataGridContext/index.js +39 -8
  12. package/components/DataGrid/contexts/DataGridContext/types.d.ts +1 -2
  13. package/components/DataGrid/dictionary.d.ts +2 -1
  14. package/components/DataGrid/dictionary.js +22 -21
  15. package/components/DataGrid/subcomponents/Actions/index.js +9 -8
  16. package/components/DataGrid/subcomponents/Actions/subcomponents/Density/index.js +5 -5
  17. package/components/DataGrid/subcomponents/Actions/subcomponents/Filter/index.js +2 -2
  18. package/components/DataGrid/subcomponents/Actions/subcomponents/MobileMenuActions/index.d.ts +4 -1
  19. package/components/DataGrid/subcomponents/Actions/subcomponents/MobileMenuActions/index.js +3 -2
  20. package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/index.d.ts +2 -1
  21. package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/index.js +3 -2
  22. package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/subcomponents/ColumnsConfig/index.js +26 -26
  23. package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/subcomponents/ColumnsConfig/types.d.ts +2 -0
  24. package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/types.d.ts +4 -0
  25. package/components/DataGrid/subcomponents/Actions/subcomponents/hooks/useModalSettings/index.d.ts +2 -1
  26. package/components/DataGrid/subcomponents/Actions/subcomponents/hooks/useModalSettings/index.js +3 -2
  27. package/components/DataGrid/subcomponents/Actions/types.d.ts +5 -2
  28. package/components/DataGrid/subcomponents/Table/hooks/useSortColumnsRows.js +2 -0
  29. package/components/DynamicFilter/dictionary.d.ts +1 -0
  30. package/components/DynamicFilter/dictionary.js +2 -1
  31. package/components/DynamicFilter/slots/dynamicFilterSlots.d.ts +2 -2
  32. package/components/DynamicFilter/subcomponents/PopoverFilter/usePopoverFilter.d.ts +3 -3
  33. package/components/DynamicFilter/types.d.ts +1 -1
  34. package/components/DynamicSort/slots/DynamicSortSlots.d.ts +2 -2
  35. package/components/DynamicSort/subcomponents/PopoverSort/usePopoverSort.d.ts +3 -3
  36. package/components/Label/slots/LabelSlots.d.ts +1 -1
  37. package/components/LanguagePopover/slots/LanguagePopoverSlots.d.ts +1 -1
  38. package/components/MenuActions/slots/MenuActionsSlots.d.ts +2 -2
  39. package/components/ModalDialog/slots/ModalDialogSlots.d.ts +2 -2
  40. package/components/NumberInput/hooks/useNumberInput/useNumberInput.js +2 -0
  41. package/components/NumberInput/slots/NumberInputSlots.d.ts +2 -2
  42. package/components/ObjectLogs/slots/ObjectLogsSlots.d.ts +1 -1
  43. package/components/ToastContainer/slots/toastContainerSlots.d.ts +2 -2
  44. package/components/areas/components/AreasAdmin/slots/AreasAdminSlots.d.ts +2 -2
  45. package/components/extended/React-resizable-panels/slots/SplitLayoutSlots.d.ts +4 -4
  46. package/components/hook-form/RHFAutocompleteAsync/RHFAutocompleteAsync.d.ts +2 -1
  47. package/components/hook-form/RHFAutocompleteAsync/reducer/RHFAutocompleteReducer.js +7 -1
  48. package/components/hook-form/RHFCheckbox/slots/RHFCheckBoxSlots.d.ts +1 -1
  49. package/components/hook-form/RHFPeriod/slots/RHFPeriodSlots.d.ts +2 -2
  50. package/components/hook-form/RHFSelect/slots/RHFSlots.d.ts +1 -1
  51. package/components/hook-form/RHFTextField/slots/RHFTextFieldSlots.d.ts +1 -1
  52. package/components/hook-form/RHFTextFieldPassword/slots/RHFTextFieldPasswordSlots.d.ts +2 -2
  53. package/components/hook-form/RHFUpload/RHFUploadImage/slots/RHFUploadImageSlots.d.ts +2 -2
  54. package/components/hook-form/RHFUpload/RHFUploadSingleFile/slots/RHFUploadSingleFileSlots.d.ts +2 -2
  55. package/components/hook-form/RHFormContext/index.d.ts +1 -1
  56. package/components/mui_extended/Accordion/slots/AccordionSlots.d.ts +2 -2
  57. package/components/mui_extended/Autocomplete/renderOptions/index.d.ts +3 -1
  58. package/components/mui_extended/Autocomplete/renderOptions/index.js +3 -2
  59. package/components/mui_extended/Autocomplete/slots/AutocompleteSlots.d.ts +4 -4
  60. package/components/mui_extended/Avatar/slots/AvatarSlots.d.ts +1 -1
  61. package/components/mui_extended/Badge/slots/BadgeSlots.d.ts +1 -1
  62. package/components/mui_extended/Button/slots/ButtonSlots.d.ts +1 -1
  63. package/components/mui_extended/CheckBox/slots/CheckBoxSlots.d.ts +1 -1
  64. package/components/mui_extended/DateTimePicker/slots/DateTimePickerSlots.d.ts +4 -4
  65. package/components/mui_extended/Divider/slots/DividerSlots.d.ts +1 -1
  66. package/components/mui_extended/IconButton/slots/IconButtonSlots.d.ts +1 -1
  67. package/components/mui_extended/LoadingButton/slots/LoadingButtonSlots.d.ts +1 -1
  68. package/components/mui_extended/MenuDivider/slots/MenuDividerSlots.d.ts +1 -1
  69. package/components/mui_extended/MenuItem/slots/MenuItemSlots.d.ts +1 -1
  70. package/components/mui_extended/Popper/slots/PopperStlots.d.ts +1 -1
  71. package/components/mui_extended/Select/slots/SelectSlots.d.ts +2 -2
  72. package/components/mui_extended/Skeleton/Slots/skeletonSlots.d.ts +1 -1
  73. package/components/mui_extended/Stack/slots/StackSlot.d.ts +1 -1
  74. package/components/mui_extended/Tab/Slots/TabSlots.d.ts +1 -1
  75. package/components/mui_extended/Tabs/slots/TabsSlots.d.ts +1 -1
  76. package/components/mui_extended/TextField/slots/TextFieldSlots.d.ts +1 -1
  77. package/components/mui_extended/TimePicker/slots/TimePickerSlots.d.ts +3 -3
  78. package/components/mui_extended/ToggleButton/slots/ToggleButtonSlots.d.ts +1 -1
  79. package/components/mui_extended/ToggleIconButton/slots/ToggleIconButtonSlots.d.ts +1 -1
  80. package/components/mui_extended/Typography/slots/typographySlots.d.ts +1 -1
  81. package/hooks/useDynamicFilterAndSort/useDynamicFilterAndSort.js +13 -7
  82. package/package.json +1 -1
  83. package/storybook/components/ObjectLogs/ObjectLogs.stories.d.ts +2 -2
  84. package/components/DataGrid/subcomponents/Actions/subcomponents/types.d.ts +0 -2
@@ -2,6 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { useState, useMemo, useEffect, useCallback, createContext } from "react";
3
3
  import { c as castMapColumnsWidthToRecord } from "../../helpers/castMapColumnsWidthToRecord.js";
4
4
  import { useFirstRender } from "@m4l/graphics";
5
+ import { deepEqual } from "fast-equals";
5
6
  const DataGridContext = createContext(null);
6
7
  const getColumnConfigByKey = (key, storeColumnsConfig) => {
7
8
  let indexFind = -1;
@@ -39,7 +40,7 @@ function getColumnsConfig(id, columns, defaultUserColumns = void 0) {
39
40
  index: columnConfigIndex > -1 ? columnConfigIndex : index,
40
41
  visible: columnConfig.visible === void 0 ? true : columnConfig.visible,
41
42
  frozen: columnConfig.frozen ?? false,
42
- orginalIndex: index,
43
+ originalIndex: index,
43
44
  originalVisible: column.visible === void 0 ? true : column.visible,
44
45
  originalFrozen: column.frozen ?? false
45
46
  };
@@ -115,7 +116,7 @@ function DataGridProvider(props) {
115
116
  rowKeyGetter,
116
117
  onChangeUserColumns
117
118
  } = props;
118
- const isFirstRender = useFirstRender();
119
+ const isFirstRender = useFirstRender([columns, id]);
119
120
  const [columnsWidths, setColumnsWidths] = useState(
120
121
  /* @__PURE__ */ new Map()
121
122
  );
@@ -154,13 +155,43 @@ function DataGridProvider(props) {
154
155
  }, [defaultUserColumns]);
155
156
  useEffect(() => {
156
157
  if (!isFirstRender) {
158
+ const finalColumnsConfig = [];
159
+ for (let i = 0; i < columnsConfig.length; i++) {
160
+ const columnIndex = columns.findIndex((c) => c.key === columnsConfig[i]?.key);
161
+ if (columnIndex !== -1) {
162
+ const column = columns[columnIndex];
163
+ finalColumnsConfig.push({
164
+ ...columnsConfig[i],
165
+ // name: column.name as string,
166
+ originalIndex: columnIndex,
167
+ originalFrozen: column.frozen ?? false,
168
+ originalVisible: column.visible ?? true
169
+ });
170
+ }
171
+ }
157
172
  const newColumns = columns.filter((column, index) => column.key !== columnsConfig[index]?.key);
158
- const newColConfig = getColumnsConfig(id, newColumns).map((column, index) => {
159
- const indexNewCol = index + columnsConfig.length;
160
- return { ...column, index: indexNewCol, orginalIndex: indexNewCol };
161
- });
162
- columnsConfig.push(...newColConfig);
163
- setColumnsWidths((prevColumnsWidth) => new Map([...prevColumnsWidth, ...getColumnsWidth(id, newColumns, defaultUserColumns)]));
173
+ if (newColumns.length > 0) {
174
+ const colLength = finalColumnsConfig.length;
175
+ const newColConfig = getColumnsConfig(id, newColumns).map((columnConfig, index) => {
176
+ const columnIndex = columns.findIndex((c) => c.key === newColumns[index].key);
177
+ const column = newColumns[index];
178
+ const indexNewCol = index + colLength;
179
+ return {
180
+ ...columnConfig,
181
+ index: indexNewCol,
182
+ name: column.name,
183
+ originalIndex: columnIndex,
184
+ originalFrozen: column.frozen ?? false,
185
+ originalVisible: column.visible ?? true
186
+ };
187
+ });
188
+ finalColumnsConfig.push(...newColConfig);
189
+ }
190
+ if (deepEqual(columnsConfig, finalColumnsConfig)) {
191
+ return;
192
+ }
193
+ console.log("useEffect columnsConfig changed", columnsConfig, finalColumnsConfig);
194
+ setColumnsConfigOptions(finalColumnsConfig);
164
195
  }
165
196
  }, [columns, id]);
166
197
  const onChangeColumnsConfig = useCallback(
@@ -6,11 +6,10 @@ export interface BaseConfigColumn {
6
6
  visible: boolean;
7
7
  index: number;
8
8
  frozen: boolean;
9
- name: string;
10
9
  }
11
10
  export interface IConfigColumn extends BaseConfigColumn {
12
11
  hidden: boolean;
13
- orginalIndex: number;
12
+ originalIndex: number;
14
13
  originalVisible: boolean;
15
14
  originalFrozen: boolean;
16
15
  }
@@ -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
  };
@@ -18,8 +18,9 @@ function Actions(props) {
18
18
  withSettings = true,
19
19
  settingsProps,
20
20
  withLocalFilters,
21
- leftActions: LeftActions,
22
- rightActions: RightActions
21
+ leftActions,
22
+ rightActions,
23
+ columns
23
24
  } = props;
24
25
  return /* @__PURE__ */ jsxs(ActionsRootStyled, { children: [
25
26
  withRowsCount && !withPager && !isMobile && /* @__PURE__ */ jsx(RowsCount, {}),
@@ -31,15 +32,15 @@ function Actions(props) {
31
32
  }
32
33
  ),
33
34
  isMobile ? /* @__PURE__ */ jsxs(Fragment, { children: [
34
- LeftActions,
35
- /* @__PURE__ */ jsx(MobileMenuActions, {}),
36
- RightActions
35
+ leftActions,
36
+ /* @__PURE__ */ jsx(MobileMenuActions, { columns }),
37
+ rightActions
37
38
  ] }) : /* @__PURE__ */ jsxs(ActionsConfigContainerStyled, { children: [
38
- LeftActions,
39
+ leftActions,
39
40
  typeof rowHeights !== "number" && /* @__PURE__ */ jsx(Density, {}),
40
41
  withLocalFilters && /* @__PURE__ */ jsx(Filter, {}),
41
- withSettings && /* @__PURE__ */ jsx(Settings, { ...settingsProps }),
42
- RightActions
42
+ withSettings && /* @__PURE__ */ jsx(Settings, { ...settingsProps, columns }),
43
+ rightActions
43
44
  ] })
44
45
  ] });
45
46
  }
@@ -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: "right" },
67
67
  menuActions,
68
68
  icon: currenViewIcon,
69
- toolTip: getLabel(dictionary.DENSITY_TOOLTIP)
69
+ toolTip: getLabel(DICTIONARY.DENSITY_TOOLTIP)
70
70
  }
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 } = useDataGrid();
12
13
  const { activeFilters, setActiveFilters } = useFilters();
13
- const modalSettings = useModalSettings();
14
+ const modalSettings = useModalSettings(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;
@@ -3,9 +3,10 @@ import { I as IconButton } from "../../../../../mui_extended/IconButton/IconButt
3
3
  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
- function Settings() {
6
+ function Settings(props) {
7
+ const { columns } = props;
7
8
  const { host_static_assets, environment_assets } = useEnvironment();
8
- const modalSettings = useModalSettings();
9
+ const modalSettings = useModalSettings(columns);
9
10
  const { getLabel } = useModuleDictionary();
10
11
  return /* @__PURE__ */ jsx(
11
12
  IconButton,
@@ -5,27 +5,27 @@ 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 { d as ColumnsConfigWrapperStyled, e as ColumnsConfigSelColumnsStyled, f as ColumnsConfigDataGridStyled, T as TableWrapperDataGridStyled, g 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
  }
23
23
  const ColumnsConfig = forwardRef((props, ref) => {
24
24
  const refdata_grid = useRef(null);
25
- const { onCloseSettings, columnsConfig, onChangeColumnsConfig, rowHeight } = props;
25
+ const { onCloseSettings, columnsConfig, onChangeColumnsConfig, rowHeight, columns } = props;
26
26
  const { getLabel } = useModuleDictionary();
27
27
  const [isInit, setIsInit] = useState(true);
28
- const [rows, setRows] = useState(getRowsFromColumnsConfig(columnsConfig));
28
+ const [rows, setRows] = useState(getRowsFromColumnsConfig(columnsConfig, columns));
29
29
  const [selRows, setSelRows] = useState(() => /* @__PURE__ */ new Set());
30
30
  const divRef = useRef(null);
31
31
  const { host_static_assets, environment_assets } = useEnvironment();
@@ -37,21 +37,21 @@ const ColumnsConfig = forwardRef((props, ref) => {
37
37
  () => [
38
38
  {
39
39
  key: "name",
40
- name: getLabel(dictionary.SETTINGS_COLUMN_NAME),
40
+ name: getLabel(DICTIONARY.SETTINGS_COLUMN_NAME),
41
41
  width: 220,
42
42
  resizable: true,
43
43
  type: "string"
44
44
  },
45
45
  {
46
46
  key: "originalIndex",
47
- name: getLabel(dictionary.SETTINGS_COLUMN_POSITION),
47
+ name: getLabel(DICTIONARY.SETTINGS_COLUMN_POSITION),
48
48
  width: 50,
49
49
  type: "number",
50
50
  cellClass: "rdg-cell-align-center"
51
51
  },
52
52
  {
53
53
  key: "visible",
54
- name: getLabel(dictionary.SETTINGS_COLUMN_VISIBLE),
54
+ name: getLabel(DICTIONARY.SETTINGS_COLUMN_VISIBLE),
55
55
  width: 80,
56
56
  type: "boolean",
57
57
  formatter: ColumnInteractiveCheckFormatter,
@@ -59,7 +59,7 @@ const ColumnsConfig = forwardRef((props, ref) => {
59
59
  },
60
60
  {
61
61
  key: "frozen",
62
- name: getLabel(dictionary.SETTINGS_COLUMNS_FROZEN),
62
+ name: getLabel(DICTIONARY.SETTINGS_COLUMNS_FROZEN),
63
63
  width: 80,
64
64
  type: "boolean",
65
65
  formatter: ColumnInteractiveCheckFormatter,
@@ -86,7 +86,7 @@ const ColumnsConfig = forwardRef((props, ref) => {
86
86
  };
87
87
  useEffect(() => {
88
88
  if (isInit === false) {
89
- setRows(getRowsFromColumnsConfig(columnsConfig));
89
+ setRows(getRowsFromColumnsConfig(columnsConfig, columns));
90
90
  }
91
91
  setIsInit(false);
92
92
  }, [columnsConfig]);
@@ -176,7 +176,7 @@ const ColumnsConfig = forwardRef((props, ref) => {
176
176
  setSelRows(mySet);
177
177
  };
178
178
  return /* @__PURE__ */ jsxs(ColumnsConfigWrapperStyled, { ref: divRef, children: [
179
- /* @__PURE__ */ jsx(ColumnsConfigSelColumnsStyled, { children: getLabel(dictionary.SETTINGS_SEL_COLUMNS) }),
179
+ /* @__PURE__ */ jsx(ColumnsConfigSelColumnsStyled, { children: getLabel(DICTIONARY.SETTINGS_SEL_COLUMNS) }),
180
180
  /* @__PURE__ */ jsx(ColumnsConfigDataGridStyled, { children: /* @__PURE__ */ jsx(TableWrapperDataGridStyled, { children: /* @__PURE__ */ jsx(
181
181
  DataGrid,
182
182
  {
@@ -197,7 +197,7 @@ const ColumnsConfig = forwardRef((props, ref) => {
197
197
  /* @__PURE__ */ jsx(
198
198
  IconButton,
199
199
  {
200
- tooltip: getLabel(dictionary.SETTINGS_MOVE_FIRST),
200
+ tooltip: getLabel(DICTIONARY.SETTINGS_MOVE_FIRST),
201
201
  onClick: handleMoveFirst,
202
202
  "aria-label": "move first place",
203
203
  disabled: rowSelectedIndex < 1,
@@ -207,7 +207,7 @@ const ColumnsConfig = forwardRef((props, ref) => {
207
207
  /* @__PURE__ */ jsx(
208
208
  IconButton,
209
209
  {
210
- tooltip: getLabel(dictionary.SETTINGS_MOVE_UP),
210
+ tooltip: getLabel(DICTIONARY.SETTINGS_MOVE_UP),
211
211
  onClick: () => handleMoveUpDownd(-1),
212
212
  "aria-label": "move up 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_LAST),
220
+ tooltip: getLabel(DICTIONARY.SETTINGS_MOVE_LAST),
221
221
  onClick: handleMoveLast,
222
222
  "aria-label": "move last place",
223
223
  disabled: !!(rowSelectedIndex === rows.length - 1 || 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_DOWN),
230
+ tooltip: getLabel(DICTIONARY.SETTINGS_MOVE_DOWN),
231
231
  onClick: () => handleMoveUpDownd(1),
232
232
  "aria-label": "move down 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_VISIBLE_ALL),
240
+ tooltip: getLabel(DICTIONARY.SETTINGS_VISIBLE_ALL),
241
241
  onClick: checkAll,
242
242
  "aria-label": "check visible all",
243
243
  icon: `${host_static_assets}/${environment_assets}/${pathIcons.checkAll}`
@@ -246,7 +246,7 @@ const ColumnsConfig = forwardRef((props, ref) => {
246
246
  /* @__PURE__ */ jsx(
247
247
  IconButton,
248
248
  {
249
- tooltip: getLabel(dictionary.SETTINGS_NO_VISIBLE_ALL),
249
+ tooltip: getLabel(DICTIONARY.SETTINGS_NO_VISIBLE_ALL),
250
250
  onClick: unCheckAll,
251
251
  "aria-label": "un check all",
252
252
  icon: `${host_static_assets}/${environment_assets}/${pathIcons.uncheckAll}`
@@ -255,7 +255,7 @@ const ColumnsConfig = forwardRef((props, ref) => {
255
255
  /* @__PURE__ */ jsx(
256
256
  IconButton,
257
257
  {
258
- tooltip: getLabel(dictionary.SETTINGS_RESTORE),
258
+ tooltip: getLabel(DICTIONARY.SETTINGS_RESTORE),
259
259
  onClick: restoreAll,
260
260
  "aria-label": "Restore columns",
261
261
  icon: `${host_static_assets}/${environment_assets}/${pathIcons.restoreColumns}`
@@ -1,3 +1,4 @@
1
+ import { Column } from 'react-data-grid';
1
2
  import { IConfigColumn } from '../../../../../../contexts/DataGridContext/types';
2
3
  export interface Row {
3
4
  key: string;
@@ -16,6 +17,7 @@ export type ColumnsConfigRef = {
16
17
  };
17
18
  export interface ConfigProps {
18
19
  onCloseSettings: () => void;
20
+ columns: readonly Column<any, any>[];
19
21
  columnsConfig: IConfigColumn[];
20
22
  onChangeColumnsConfig: (newColumnsConfig: IConfigColumn[]) => void;
21
23
  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,6 +1,7 @@
1
+ import { Column } from 'react-data-grid';
1
2
  /**
2
3
  * Hook que renderiza el modal de configuración de las columnas
3
4
  * de la tabla
4
5
  */
5
- declare const useModalSettings: () => () => void;
6
+ declare const useModalSettings: (columns: readonly Column<any, any>[]) => () => void;
6
7
  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 = () => {
14
+ const useModalSettings = (columns) => {
15
15
  const { openModal, closeModal } = useModal();
16
16
  const { columnsConfig, onChangeColumnsConfig, currentRowHeight } = useDataGrid();
17
17
  const { getLabel } = useModuleDictionary();
@@ -48,7 +48,8 @@ const useModalSettings = () => {
48
48
  rowHeight: currentRowHeight,
49
49
  columnsConfig,
50
50
  onChangeColumnsConfig: handleColumnsSetting,
51
- onCloseSettings
51
+ onCloseSettings,
52
+ columns
52
53
  }
53
54
  ) }) }) }),
54
55
  /* @__PURE__ */ jsxs(ActionsContainer, { children: [
@@ -1,5 +1,6 @@
1
1
  import { PagerProps } from '../../../Pager/types';
2
- import { SettingsProps } from './subcomponents/types';
2
+ import { SettingsProps } from './subcomponents/Settings/types';
3
+ import { Column } from 'react-data-grid';
3
4
  export interface ActionsProps {
4
5
  withSettings?: boolean;
5
6
  settingsProps?: SettingsProps;
@@ -10,4 +11,6 @@ export interface ActionsProps {
10
11
  leftActions?: React.ReactNode;
11
12
  rightActions?: React.ReactNode;
12
13
  }
13
- export type InternalActionsProps = ActionsProps;
14
+ export type InternalActionsProps = ActionsProps & {
15
+ columns: readonly Column<any, any>[];
16
+ };
@@ -17,6 +17,7 @@ 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
20
21
  case "number":
21
22
  return (a, b) => {
22
23
  try {
@@ -25,6 +26,7 @@ function getComparator(columns, sortColumn) {
25
26
  return -1;
26
27
  }
27
28
  };
29
+ //Por defecto retorna una función de ordenamiento de string
28
30
  default:
29
31
  return (a, b) => {
30
32
  try {
@@ -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,