@m4l/components 9.4.12 → 9.4.14
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/AccountPopover/slots/AccountPopoverSlots.d.ts +6 -6
- package/components/ActionsGroup/slots/ActionsGroupSlots.d.ts +2 -2
- package/components/AppBar/slots/AppBarSlots.d.ts +1 -1
- package/components/Card/constants.d.ts +1 -1
- package/components/CheckableList/slots/styled.d.ts +9 -9
- package/components/Chip/slots/ChipSlots.d.ts +2 -2
- package/components/CommonActions/components/ActionCancel/slots/ActionsCancelSlots.d.ts +1 -1
- package/components/CommonActions/components/ActionFormCancel/slots/ActionFormCancelSlots.d.ts +1 -1
- package/components/CommonActions/components/ActionFormSubmitProgrammatic/slots/ActionFormSubmitProgrammaticSlots.d.ts +1 -1
- package/components/CommonActions/components/ActionIntro/slots/ActionsIntroSlots.d.ts +1 -1
- package/components/CommonActions/components/ActionsContainer/slots/ActionsContainerSlots.d.ts +1 -1
- package/components/DynamicFilter/slots/dynamicFilterSlots.d.ts +2 -2
- package/components/DynamicSort/slots/DynamicSortSlots.d.ts +2 -2
- package/components/EditLabel/slots/EditLabelSlots.d.ts +4 -4
- package/components/GridLayout/classes/index.d.ts +1 -1
- package/components/HelperError/slots/HelperErrorSlots.d.ts +1 -1
- package/components/ImageText/constants.d.ts +1 -1
- package/components/ImageText/slots/ImageTextSlots.d.ts +2 -2
- package/components/Label/slots/LabelSlots.d.ts +3 -3
- package/components/LanguagePopover/slots/LanguagePopoverSlots.d.ts +1 -1
- package/components/LoadingError/slots/LoadingErrorSlots.d.ts +1 -1
- package/components/MFIsolationApp/slots/MFIsolationAppSlots.d.ts +2 -2
- package/components/MenuActions/constants.d.ts +1 -1
- package/components/MenuActions/slots/MenuActionsSlots.d.ts +2 -2
- package/components/ModalDialog/slots/ModalDialogSlots.d.ts +2 -2
- package/components/NumberInput/hooks/useNumberInput/useNumberInput.js +0 -2
- package/components/NumberInput/slots/NumberInputSlots.d.ts +2 -2
- package/components/ObjectLogs/slots/ObjectLogsSlots.d.ts +2 -2
- package/components/Pager/slots/PagerSlots.d.ts +3 -3
- package/components/PaperForm/slots/PaperFormSlots.d.ts +1 -1
- package/components/SettingsLayout/SettingsLayout.js +4 -3
- package/components/SettingsLayout/constants.d.ts +1 -0
- package/components/SettingsLayout/constants.js +5 -3
- package/components/SettingsLayout/slots/SettingsLayoutSlots.d.ts +3 -3
- package/components/SettingsLayout/slots/SettingsLayoutSlots.js +1 -1
- package/components/SettingsLayout/subcomponents/SettingsLayoutBase/SettingsLayoutBase.js +1 -1
- package/components/SettingsLayout/types.d.ts +4 -0
- package/components/SideBar/slots/SideBarSlots.d.ts +1 -1
- package/components/Stepper/slots/StepperSlot.d.ts +4 -4
- package/components/TabsNavigator/slots/TabsNavigatorSlots.d.ts +2 -2
- package/components/ToastContainer/slots/toastContainerSlots.d.ts +4 -4
- package/components/WindowBase/slots/WindowBaseSlots.d.ts +2 -2
- package/components/areas/components/AreasAdmin/slots/AreasAdminSlots.d.ts +3 -3
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useWindow.d.ts +1 -1
- package/components/datagrids/Datagrid.styles.js +24 -0
- package/components/datagrids/components/BaseDataGrid/BaseDataGrid.d.ts +12 -0
- package/components/datagrids/components/BaseDataGrid/BaseDataGrid.js +131 -0
- package/components/datagrids/components/BaseDataGrid/index.d.ts +1 -0
- package/components/datagrids/components/BaseDataGrid/index.js +1 -0
- package/components/datagrids/components/DataGridMain/DataGridMain.js +22 -134
- package/components/datagrids/components/TreeDataGrid/TreeDataGrid.d.ts +22 -0
- package/components/datagrids/components/TreeDataGrid/TreeDataGrid.js +50 -0
- package/components/datagrids/components/TreeDataGrid/TreeDataGrid.test.d.ts +1 -0
- package/components/datagrids/components/TreeDataGrid/index.d.ts +1 -0
- package/components/datagrids/components/TreeDataGrid/index.js +1 -0
- package/components/datagrids/constants.js +3 -5
- package/components/datagrids/contexts/DataGridContext/DataGridContext.js +8 -4
- package/components/datagrids/contexts/DataGridContext/types.d.ts +19 -3
- package/components/datagrids/dictionary.d.ts +3 -0
- package/components/datagrids/dictionary.js +4 -0
- package/components/datagrids/formatters/ColumnBooleanFormatter/ColumnBooleanGroupFormatter.d.ts +15 -0
- package/components/datagrids/formatters/ColumnBooleanFormatter/ColumnBooleanGroupFormatter.js +32 -0
- package/components/datagrids/formatters/ColumnBooleanFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnBooleanFormatter/useColumnBoolean.d.ts +1 -0
- package/components/datagrids/formatters/ColumnBooleanFormatter/useColumnBoolean.js +2 -0
- package/components/datagrids/formatters/ColumnChipStatusFormatter/ColumnChipStatusGroupFormatter.d.ts +16 -0
- package/components/datagrids/formatters/ColumnChipStatusFormatter/ColumnChipStatusGroupFormatter.js +37 -0
- package/components/datagrids/formatters/ColumnChipStatusFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnChipStatusFormatter/useColumnChipStatus.d.ts +1 -0
- package/components/datagrids/formatters/ColumnChipStatusFormatter/useColumnChipStatus.js +2 -0
- package/components/datagrids/formatters/ColumnColorFormatter/ColumnColorGroupFormatter.d.ts +14 -0
- package/components/datagrids/formatters/ColumnColorFormatter/ColumnColorGroupFormatter.js +24 -0
- package/components/datagrids/formatters/ColumnColorFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnColorFormatter/useColumnColor.d.ts +1 -0
- package/components/datagrids/formatters/ColumnColorFormatter/useColumnColor.js +3 -1
- package/components/datagrids/formatters/ColumnConcatenatedValuesFormatter/ColumnConcatenatedValuesGroupFormatter.d.ts +15 -0
- package/components/datagrids/formatters/ColumnConcatenatedValuesFormatter/ColumnConcatenatedValuesGroupFormatter.js +35 -0
- package/components/datagrids/formatters/ColumnConcatenatedValuesFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnConcatenatedValuesFormatter/useColumnConcatenatedValues.d.ts +1 -0
- package/components/datagrids/formatters/ColumnConcatenatedValuesFormatter/useColumnConcatenatedValues.js +2 -0
- package/components/datagrids/formatters/ColumnDateFormatter/ColumnDateGroupFormatter.d.ts +9 -0
- package/components/datagrids/formatters/ColumnDateFormatter/ColumnDateGroupFormatter.js +35 -0
- package/components/datagrids/formatters/ColumnDateFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnDateFormatter/useColumnDate.d.ts +1 -0
- package/components/datagrids/formatters/ColumnDateFormatter/useColumnDate.js +2 -0
- package/components/datagrids/formatters/ColumnIconFormatter/ColumnIconGroupFormatter.d.ts +13 -0
- package/components/datagrids/formatters/ColumnIconFormatter/ColumnIconGroupFormatter.js +17 -0
- package/components/datagrids/formatters/ColumnIconFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnIconFormatter/useColumnIcon.d.ts +1 -0
- package/components/datagrids/formatters/ColumnIconFormatter/useColumnIcon.js +3 -1
- package/components/datagrids/formatters/ColumnImageFormatter/ColumnImageGroupFormatter.d.ts +15 -0
- package/components/datagrids/formatters/ColumnImageFormatter/ColumnImageGroupFormatter.js +33 -0
- package/components/datagrids/formatters/ColumnImageFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnImageFormatter/useColumnImage.d.ts +1 -0
- package/components/datagrids/formatters/ColumnImageFormatter/useColumnImage.js +3 -1
- package/components/datagrids/formatters/ColumnInteractiveCheckFormatter/formatter.d.ts +12 -1
- package/components/datagrids/formatters/ColumnInteractiveCheckFormatter/formatter.js +6 -0
- package/components/datagrids/formatters/ColumnNestedValueFormatter/ColumnNestedValueGroupFormatter.d.ts +14 -0
- package/components/datagrids/formatters/ColumnNestedValueFormatter/ColumnNestedValueGroupFormatter.js +22 -0
- package/components/datagrids/formatters/ColumnNestedValueFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnNestedValueFormatter/useColumnNestedValue.d.ts +1 -0
- package/components/datagrids/formatters/ColumnNestedValueFormatter/useColumnNestedValue.js +2 -0
- package/components/datagrids/formatters/ColumnPointsFormatter/ColumnPointsGroupFormatter.d.ts +15 -0
- package/components/datagrids/formatters/ColumnPointsFormatter/ColumnPointsGroupFormatter.js +28 -0
- package/components/datagrids/formatters/ColumnPointsFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnPointsFormatter/useColumnPoints.d.ts +1 -0
- package/components/datagrids/formatters/ColumnPointsFormatter/useColumnPoints.js +2 -0
- package/components/datagrids/formatters/ColumnPriceFormatter/ColumnPriceGroupFormatter.d.ts +14 -0
- package/components/datagrids/formatters/ColumnPriceFormatter/ColumnPriceGroupFormatter.js +26 -0
- package/components/datagrids/formatters/ColumnPriceFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnPriceFormatter/useColumnPrice.d.ts +1 -0
- package/components/datagrids/formatters/ColumnPriceFormatter/useColumnPrice.js +2 -0
- package/components/datagrids/formatters/ColumnTagsFormatter/ColumnTagsGroupFormatter.d.ts +13 -0
- package/components/datagrids/formatters/ColumnTagsFormatter/ColumnTagsGroupFormatter.js +21 -0
- package/components/datagrids/formatters/ColumnTagsFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnTagsFormatter/useColumnTags.d.ts +1 -0
- package/components/datagrids/formatters/ColumnTagsFormatter/useColumnTags.js +2 -0
- package/components/datagrids/formatters/ColumnUncertaintyFormatter/ColumnUncertaintyGroupFormatter.d.ts +15 -0
- package/components/datagrids/formatters/ColumnUncertaintyFormatter/ColumnUncertaintyGroupFormatter.js +27 -0
- package/components/datagrids/formatters/ColumnUncertaintyFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnUncertaintyFormatter/useColumnUncertainty.d.ts +1 -0
- package/components/datagrids/formatters/ColumnUncertaintyFormatter/useColumnUncertainty.js +2 -0
- package/components/datagrids/helpers/shared/getInitialColumnsConfig/getInitialColumnsConfig.js +8 -0
- package/components/datagrids/helpers/shared/getViewSpecificConfig/getViewSpecificConfig.js +10 -3
- package/components/datagrids/hooks/useChangeColumnsOrder/useChangeColumnsOrder.d.ts +1 -0
- package/components/datagrids/hooks/useChangeColumnsOrder/useChangeColumnsOrder.js +12 -4
- package/components/datagrids/icons.d.ts +5 -0
- package/components/datagrids/icons.js +5 -1
- package/components/datagrids/index.d.ts +2 -1
- package/components/datagrids/slots/DataGridEnum.d.ts +3 -1
- package/components/datagrids/slots/DataGridEnum.js +2 -0
- package/components/datagrids/slots/DataGridSlot.d.ts +2 -0
- package/components/datagrids/slots/DataGridSlot.js +12 -2
- package/components/datagrids/types.d.ts +52 -0
- package/components/datagrids/views/CardsView/hooks/useProcessedColumns/useProcessedColumns.d.ts +2 -0
- package/components/datagrids/views/CardsView/hooks/useProcessedColumns/useProcessedColumns.js +3 -2
- package/components/datagrids/views/TableView/TableView.d.ts +4 -4
- package/components/datagrids/views/TableView/TableView.js +41 -3
- package/components/datagrids/views/TableView/helpers/defaultRowGrouper/defaultRowGrouper.d.ts +28 -0
- package/components/datagrids/views/TableView/helpers/defaultRowGrouper/defaultRowGrouper.js +15 -0
- package/components/datagrids/views/TableView/helpers/defaultRowGrouper/defaultRowGrouper.test.d.ts +1 -0
- package/components/datagrids/views/TableView/helpers/defaultRowGrouper/index.d.ts +1 -0
- package/components/datagrids/views/TableView/helpers/defaultRowGrouper/index.js +1 -0
- package/components/datagrids/views/TableView/helpers/getGroupBy/getGroupBy.d.ts +20 -0
- package/components/datagrids/views/TableView/helpers/getGroupBy/getGroupBy.js +13 -0
- package/components/datagrids/views/TableView/helpers/getGroupBy/getGroupBy.test.d.ts +1 -0
- package/components/datagrids/views/TableView/helpers/getGroupBy/index.d.ts +1 -0
- package/components/datagrids/views/TableView/helpers/getGroupBy/index.js +1 -0
- package/components/datagrids/views/TableView/helpers/index.d.ts +2 -0
- package/components/datagrids/views/TableView/hooks/useHeaderMenuActions/useHeaderMenuActions.js +62 -1
- package/components/datagrids/views/TableView/hooks/useSortColumnsRows/useSortColumnsRows.js +39 -13
- package/components/datagrids/views/TableView/subcomponents/ActionsColumn/ActionsColumn.js +1 -1
- package/components/datagrids/views/TableView/subcomponents/HeaderRenderClick/HeaderRenderClick.js +1 -1
- package/components/datagrids/views/TableView/subcomponents/RadioSelectColumn/RadioSelectColumn.js +2 -2
- package/components/datagrids/views/TableView/subcomponents/RenderGroupCell/RenderGroupCell.d.ts +10 -0
- package/components/datagrids/views/TableView/subcomponents/RenderGroupCell/RenderGroupCell.js +35 -0
- package/components/datagrids/views/TableView/subcomponents/RenderGroupCell/RenderGroupCell.test.d.ts +1 -0
- package/components/datagrids/views/TableView/subcomponents/RenderGroupCell/index.d.ts +2 -0
- package/components/datagrids/views/TableView/subcomponents/RenderGroupCell/index.js +1 -0
- package/components/datagrids/views/TableView/subcomponents/RenderGroupCell/types.d.ts +12 -0
- package/components/datagrids/views/TableView/subcomponents/SelectColumn/SelectColumn.js +46 -14
- package/components/datagrids/views/TableView/subcomponents/Settings/hooks/useModalSettings/useModalSettings.js +13 -2
- package/components/datagrids/views/TableView/subcomponents/Settings/subcomponents/ColumnsConfig/ColumnsConfig.js +47 -13
- package/components/datagrids/views/TableView/subcomponents/Settings/subcomponents/ColumnsConfig/types.d.ts +22 -0
- package/components/datagrids/views/adapters/CheckboxCellAdapter/CheckboxCellAdapter.js +1 -1
- package/components/extended/React-Resizable/Resizable/slots/ResizableSlots.d.ts +1 -1
- package/components/extended/React-Resizable/ResizableBox/slots/ResizableBoxSlots.d.ts +1 -1
- package/components/extended/React-resizable-panels/slots/SplitLayoutSlots.d.ts +6 -6
- package/components/formatters/BooleanFormatter/slots/BooleanFormatterSlots.d.ts +1 -1
- package/components/formatters/ConcatenatedFormatter/slots/ConcatenatedFormatterSlots.d.ts +1 -1
- package/components/formatters/DateFormatter/slots/DateFormatterSlots.d.ts +1 -1
- package/components/formatters/DistanceToNowFormatter/slots/DistanceToNowFormatterSlots.d.ts +1 -1
- package/components/formatters/ImageFormatter/slots/ImageFormatterSlots.d.ts +1 -1
- package/components/formatters/PeriodFormatter/slots/PeriodFormatterSlots.d.ts +1 -1
- package/components/formatters/PointsFormatter/slots/ointsFormatterSlots.d.ts +1 -1
- package/components/formatters/PriceFormatter/slots/PriceFormatterSlots.d.ts +1 -1
- package/components/formatters/UncertaintyFormatter/slots/UncertaintyFormatterSlots.d.ts +1 -1
- package/components/hook-form/RHFAutocompleteAsync/reducer/RHFAutocompleteReducer.js +0 -5
- package/components/hook-form/RHFCheckbox/slots/RHFCheckBoxSlots.d.ts +1 -1
- package/components/hook-form/RHFColorPicker/slots/RHFColorPickerSlots.d.ts +1 -1
- package/components/hook-form/RHFDatePicker/slots/RHFDatePickerSlots.d.ts +3 -3
- package/components/hook-form/RHFPeriod/slots/RHFPeriodSlots.d.ts +1 -1
- package/components/hook-form/RHFSelect/constants.d.ts +1 -1
- package/components/hook-form/RHFSelect/slots/RHFSlots.d.ts +1 -1
- package/components/hook-form/RHFTextField/slots/RHFTextFieldSlots.d.ts +1 -1
- package/components/hook-form/RHFTextFieldPassword/slots/RHFTextFieldPasswordSlots.d.ts +2 -2
- package/components/hook-form/RHFUpload/RHFUploadImage/slots/RHFUploadImageSlots.d.ts +3 -3
- package/components/hook-form/RHFUpload/RHFUploadSingleFile/constants.d.ts +1 -1
- package/components/hook-form/RHFUpload/RHFUploadSingleFile/slots/RHFUploadSingleFileSlots.d.ts +7 -7
- package/components/hook-form/RHFormProvider/classes/index.d.ts +1 -1
- package/components/mui_extended/Accordion/slots/AccordionSlots.d.ts +3 -3
- package/components/mui_extended/Autocomplete/slots/AutocompleteSlots.d.ts +6 -6
- package/components/mui_extended/Avatar/slots/AvatarSlots.d.ts +1 -1
- package/components/mui_extended/Badge/slots/BadgeSlots.d.ts +1 -1
- package/components/mui_extended/Button/slots/ButtonSlots.d.ts +2 -2
- package/components/mui_extended/CheckBox/slots/CheckBoxSlots.d.ts +2 -2
- package/components/mui_extended/DatePicker/constants.d.ts +1 -1
- package/components/mui_extended/DatePicker/slots/DatePickerSlots.d.ts +3 -3
- package/components/mui_extended/DateTimePicker/slots/DateTimePickerSlots.d.ts +4 -4
- package/components/mui_extended/Divider/slots/DividerSlots.d.ts +1 -1
- package/components/mui_extended/IconButton/constants.d.ts +1 -1
- package/components/mui_extended/IconButton/slots/IconButtonSlots.d.ts +1 -1
- package/components/mui_extended/LoadingButton/slots/LoadingButtonSlots.d.ts +1 -1
- package/components/mui_extended/MenuDivider/slots/MenuDividerSlots.d.ts +1 -1
- package/components/mui_extended/MenuItem/slots/MenuItemSlots.d.ts +2 -2
- package/components/mui_extended/NavLink/slots/NavLinkSlots.d.ts +1 -1
- package/components/mui_extended/Popper/slots/PopperStlots.d.ts +1 -1
- package/components/mui_extended/Radio/slots/styled.d.ts +2 -2
- package/components/mui_extended/Select/constants.d.ts +1 -1
- package/components/mui_extended/Select/slots/SelectSlots.d.ts +5 -5
- package/components/mui_extended/Skeleton/Slots/skeletonSlots.d.ts +1 -1
- package/components/mui_extended/Stack/slots/StackSlot.d.ts +1 -1
- package/components/mui_extended/Tab/Slots/TabSlots.d.ts +2 -2
- package/components/mui_extended/Tabs/slots/TabsSlots.d.ts +1 -1
- package/components/mui_extended/TextField/constants.d.ts +1 -1
- package/components/mui_extended/TextField/slots/TextFieldSlots.d.ts +4 -4
- package/components/mui_extended/TimePicker/slots/TimePickerSlots.d.ts +3 -3
- package/components/mui_extended/ToggleButton/slots/ToggleButtonSlots.d.ts +1 -1
- package/components/mui_extended/ToggleIconButton/slots/ToggleIconButtonSlots.d.ts +1 -1
- package/components/mui_extended/Typography/slots/typographySlots.d.ts +1 -1
- package/hooks/useDynamicFilterAndSort/slots/DynamicFilterAndSortSlots.d.ts +4 -4
- package/index.js +108 -82
- package/not_recognized/index.js +25 -100
- package/package.json +1 -1
- package/test/mocks.d.ts +2 -2
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TreeDataGridProps, RowKey } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* TreeDataGrid es un componente para mostrar datos jerárquicos con agrupación.
|
|
4
|
+
*
|
|
5
|
+
* Características principales:
|
|
6
|
+
* - Vista de tabla con agrupación jerárquica
|
|
7
|
+
* - Expansión/colapso de grupos
|
|
8
|
+
* - Todas las funcionalidades del DataGrid (paginación, filtros, ordenamiento, etc.)
|
|
9
|
+
*
|
|
10
|
+
* IMPORTANTE: Solo soporta vista de tabla (no cards).
|
|
11
|
+
*
|
|
12
|
+
* El groupBy se calcula automáticamente desde las columnas con grouped=true,
|
|
13
|
+
* ordenadas por groupOrder. El desarrollador solo define:
|
|
14
|
+
* - `grouped: true` en columnas que deben agruparse por defecto
|
|
15
|
+
* - `groupable: true` en columnas que el usuario puede agrupar/desagrupar
|
|
16
|
+
*
|
|
17
|
+
* Modos de control para expandedGroupIds:
|
|
18
|
+
* - Sin props: Estado interno, todos los grupos colapsados inicialmente
|
|
19
|
+
* - Solo expandedGroupIds: Usa ese valor como inicial, luego maneja internamente
|
|
20
|
+
* - expandedGroupIds + onExpandedGroupIdsChange: Modo controlado, padre maneja estado
|
|
21
|
+
*/
|
|
22
|
+
export declare function TreeDataGrid<TRow, TSummaryRow, TKey extends RowKey = RowKey>(props: TreeDataGridProps<TRow, TSummaryRow, TKey>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { T as TableView } from "../../views/TableView/TableView.js";
|
|
4
|
+
import { B as BaseDataGrid } from "../BaseDataGrid/BaseDataGrid.js";
|
|
5
|
+
function TreeDataGrid(props) {
|
|
6
|
+
const {
|
|
7
|
+
id,
|
|
8
|
+
withActions,
|
|
9
|
+
columns,
|
|
10
|
+
rows,
|
|
11
|
+
selectedRows,
|
|
12
|
+
onSelectedRowsChange,
|
|
13
|
+
rowKeyGetter,
|
|
14
|
+
onRowsChange,
|
|
15
|
+
focusOnRowKey,
|
|
16
|
+
checkedRows,
|
|
17
|
+
onCheckedRowsChange,
|
|
18
|
+
rowGrouper,
|
|
19
|
+
expandedGroupIds: expandedGroupIdsProp,
|
|
20
|
+
onExpandedGroupIdsChange: onExpandedGroupIdsChangeProp
|
|
21
|
+
} = props;
|
|
22
|
+
const [internalExpandedGroupIds, setInternalExpandedGroupIds] = useState(() => new Set(expandedGroupIdsProp ?? []));
|
|
23
|
+
const isControlled = expandedGroupIdsProp !== void 0 && onExpandedGroupIdsChangeProp !== void 0;
|
|
24
|
+
const expandedGroupIds = isControlled ? expandedGroupIdsProp : internalExpandedGroupIds;
|
|
25
|
+
const onExpandedGroupIdsChange = isControlled ? onExpandedGroupIdsChangeProp : setInternalExpandedGroupIds;
|
|
26
|
+
return /* @__PURE__ */ jsx(BaseDataGrid, { ...props, children: /* @__PURE__ */ jsx(
|
|
27
|
+
TableView,
|
|
28
|
+
{
|
|
29
|
+
id,
|
|
30
|
+
withActions,
|
|
31
|
+
columns,
|
|
32
|
+
rows,
|
|
33
|
+
selectedRows,
|
|
34
|
+
onSelectedRowsChange,
|
|
35
|
+
rowKeyGetter,
|
|
36
|
+
onRowsChange,
|
|
37
|
+
focusOnRowKey,
|
|
38
|
+
checkedRows,
|
|
39
|
+
onCheckedRowsChange,
|
|
40
|
+
treeProps: {
|
|
41
|
+
rowGrouper,
|
|
42
|
+
expandedGroupIds,
|
|
43
|
+
onExpandedGroupIdsChange
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
) });
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
TreeDataGrid as T
|
|
50
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TreeDataGrid } from './TreeDataGrid';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const DATAGRID_PREFIX_NAME = "M4LDataGrid";
|
|
2
|
-
const DATAGRID_SELECT_COLUMN_KEY = "M4LDataGrid-CheckedColumn";
|
|
3
2
|
const DATAGRID_ACTIONS_COLUMN_KEY = "M4LDataGrid-ActionsColumn";
|
|
4
3
|
const TEST_SKELETON = "data-skeleton";
|
|
5
4
|
const DATAGRID_HEADER_RENDER_CLICK_KEY = "M4LDataGrid-HeaderRenderClick";
|
|
@@ -45,8 +44,7 @@ export {
|
|
|
45
44
|
DATAGRID_ROW_HEIGHTS as a,
|
|
46
45
|
DATAGRID_ROW_HEADER_HEIGHTS as b,
|
|
47
46
|
DATAGRID_ID_DICTIONARY as c,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
DATAGRID_HEADER_RENDER_CLICK_KEY as g
|
|
47
|
+
DATAGRID_ACTIONS_COLUMN_KEY as d,
|
|
48
|
+
DATAGRID_SEMANTIC_WIDTHS as e,
|
|
49
|
+
DATAGRID_HEADER_RENDER_CLICK_KEY as f
|
|
52
50
|
};
|
|
@@ -192,8 +192,8 @@ function DataGridProvider(props) {
|
|
|
192
192
|
columns,
|
|
193
193
|
"table",
|
|
194
194
|
resolvedDefaultConfig?.columnsConfig,
|
|
195
|
-
{ frozen: false },
|
|
196
|
-
{ originalFrozen: false }
|
|
195
|
+
{ frozen: false, grouped: false, groupOrder: 0 },
|
|
196
|
+
{ originalFrozen: false, originalGrouped: false, originalGroupOrder: 0 }
|
|
197
197
|
)
|
|
198
198
|
);
|
|
199
199
|
const finalCardsConfig = (() => {
|
|
@@ -267,12 +267,16 @@ function DataGridProvider(props) {
|
|
|
267
267
|
if (newColumnsForView.length > 0) {
|
|
268
268
|
const colLength = currentConfig.length;
|
|
269
269
|
const viewSpecificDefaults = viewModeParam === "cards" ? { showTitle: false } : {
|
|
270
|
-
frozen: false
|
|
270
|
+
frozen: false,
|
|
271
|
+
grouped: false,
|
|
272
|
+
groupOrder: 0
|
|
271
273
|
};
|
|
272
274
|
const originalViewSpecificDefaults = viewModeParam === "cards" ? {
|
|
273
275
|
originalShowTitle: false
|
|
274
276
|
} : {
|
|
275
|
-
originalFrozen: false
|
|
277
|
+
originalFrozen: false,
|
|
278
|
+
originalGrouped: false,
|
|
279
|
+
originalGroupOrder: 0
|
|
276
280
|
};
|
|
277
281
|
const newColConfig = getInitialColumnsConfig(
|
|
278
282
|
id,
|
|
@@ -23,16 +23,26 @@ export interface BaseConfigColumn {
|
|
|
23
23
|
visible: boolean;
|
|
24
24
|
index: number;
|
|
25
25
|
frozen: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Si la columna está agrupada actualmente.
|
|
28
|
+
* Solo aplica para TreeDataGrid.
|
|
29
|
+
*/
|
|
30
|
+
grouped?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Orden en la jerarquía de agrupación (0 = primer nivel).
|
|
33
|
+
* Solo aplica para TreeDataGrid.
|
|
34
|
+
*/
|
|
35
|
+
groupOrder?: number;
|
|
26
36
|
/**
|
|
27
37
|
* @deprecated internamente el componente usa el name de columns.
|
|
28
38
|
*/
|
|
29
39
|
name?: string;
|
|
30
40
|
}
|
|
31
41
|
/**
|
|
32
|
-
* Configuración base para vista cards - omite frozen y agrega showTitle
|
|
42
|
+
* Configuración base para vista cards - omite frozen, grouped y groupOrder y agrega showTitle
|
|
33
43
|
* USO: Los desarrolladores pasan esto en defaultUserColumns.columnsConfigCards
|
|
34
44
|
*/
|
|
35
|
-
export interface BaseConfigColumnCards extends Omit<BaseConfigColumn, 'frozen'> {
|
|
45
|
+
export interface BaseConfigColumnCards extends Omit<BaseConfigColumn, 'frozen' | 'grouped' | 'groupOrder'> {
|
|
36
46
|
showTitle: boolean;
|
|
37
47
|
}
|
|
38
48
|
/**
|
|
@@ -44,12 +54,16 @@ export interface IConfigColumn extends BaseConfigColumn {
|
|
|
44
54
|
originalIndex: number;
|
|
45
55
|
originalVisible: boolean;
|
|
46
56
|
originalFrozen: boolean;
|
|
57
|
+
/** Valor original de grouped definido en la columna */
|
|
58
|
+
originalGrouped?: boolean;
|
|
59
|
+
/** Valor original de groupOrder */
|
|
60
|
+
originalGroupOrder?: number;
|
|
47
61
|
}
|
|
48
62
|
/**
|
|
49
63
|
* Configuración extendida para cards (estado interno)
|
|
50
64
|
* USO INTERNO: El contexto agrega estas propiedades para tracking y gestión de estado
|
|
51
65
|
*/
|
|
52
|
-
export interface IConfigColumnCards extends Omit<IConfigColumn, 'frozen' | 'originalFrozen'> {
|
|
66
|
+
export interface IConfigColumnCards extends Omit<IConfigColumn, 'frozen' | 'originalFrozen' | 'grouped' | 'groupOrder' | 'originalGrouped' | 'originalGroupOrder'> {
|
|
53
67
|
showTitle: boolean;
|
|
54
68
|
originalShowTitle: boolean;
|
|
55
69
|
}
|
|
@@ -60,7 +74,9 @@ export type ViewMode = 'table' | 'cards';
|
|
|
60
74
|
* EXTENSIBILIDAD: Agregar aquí nuevas propiedades para nuevas vistas (ej: columnsConfigList)
|
|
61
75
|
*/
|
|
62
76
|
export interface IGridConfigExtended extends IGridConfig {
|
|
77
|
+
/** Configuración de columnas para vista cards */
|
|
63
78
|
columnsConfigCards?: BaseConfigColumnCards[];
|
|
79
|
+
/** Modo de vista actual (table/cards) */
|
|
64
80
|
viewMode?: ViewMode;
|
|
65
81
|
}
|
|
66
82
|
export interface DataGridProviderProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> extends Pick<GridProps<TRow, TSummaryRow, TKey>, 'rows' | 'columns' | 'rowActionsGetter' | 'rowHeaderHeights' | 'rowHeights' | 'initialRowHeightVariant' | 'checkedRows' | 'onCheckedRowsChange' | 'checkedRowsMultiple' | 'rowKeyGetter' | 'externalSortSettings' | 'externalFilterSettings' | 'defaultViewMode' | 'cardsViewConfig'> {
|
|
@@ -34,6 +34,9 @@ export declare const DICTIONARY: {
|
|
|
34
34
|
UNFREEZE_COLUMN: string;
|
|
35
35
|
HIDE_COLUMN: string;
|
|
36
36
|
ADD_FILTER_COLUMN: string;
|
|
37
|
+
SETTINGS_COLUMN_GROUP: string;
|
|
38
|
+
GROUP_BY_COLUMN: string;
|
|
39
|
+
REMOVE_GROUP_COLUMN: string;
|
|
37
40
|
VIEW_MODE_TABLE: string;
|
|
38
41
|
VIEW_MODE_CARDS: string;
|
|
39
42
|
TOOLTIP_VIEW_MODE: string;
|
|
@@ -34,6 +34,10 @@ const DICTIONARY = {
|
|
|
34
34
|
UNFREEZE_COLUMN: `${DATAGRID_ID_DICTIONARY}.unfreeze_column`,
|
|
35
35
|
HIDE_COLUMN: `${DATAGRID_ID_DICTIONARY}.hide_column`,
|
|
36
36
|
ADD_FILTER_COLUMN: `${DATAGRID_ID_DICTIONARY}.add_filter`,
|
|
37
|
+
// Labels para agrupación de columnas (Row Grouping)
|
|
38
|
+
SETTINGS_COLUMN_GROUP: `${DATAGRID_ID_DICTIONARY}.settings_column_group`,
|
|
39
|
+
GROUP_BY_COLUMN: `${DATAGRID_ID_DICTIONARY}.group_by_column`,
|
|
40
|
+
REMOVE_GROUP_COLUMN: `${DATAGRID_ID_DICTIONARY}.remove_group_column`,
|
|
37
41
|
VIEW_MODE_TABLE: `${DATAGRID_ID_DICTIONARY}.view_mode_table`,
|
|
38
42
|
VIEW_MODE_CARDS: `${DATAGRID_ID_DICTIONARY}.view_mode_cards`,
|
|
39
43
|
TOOLTIP_VIEW_MODE: `${DATAGRID_ID_DICTIONARY}.tooltip_view_mode`,
|
package/components/datagrids/formatters/ColumnBooleanFormatter/ColumnBooleanGroupFormatter.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ColumnBooleanFormatterProps } from './types';
|
|
2
|
+
import { RenderGroupCellProps } from 'react-data-grid';
|
|
3
|
+
/**
|
|
4
|
+
* Formatter para mostrar valores booleanos en filas de grupo (TreeDataGrid).
|
|
5
|
+
*
|
|
6
|
+
* Esta función es utilizada cuando el TreeDataGrid agrupa filas y necesita
|
|
7
|
+
* mostrar un valor booleano en el encabezado del grupo. Usa la primera fila
|
|
8
|
+
* del grupo (childRows[0]) como fuente de datos representativa.
|
|
9
|
+
* @param props - Propiedades del formatter que incluyen:
|
|
10
|
+
* - fieldValue: Campo que contiene el valor booleano
|
|
11
|
+
* - presentationType: Tipo de presentación (text, icon, etc.)
|
|
12
|
+
* - Component: Componente wrapper opcional
|
|
13
|
+
* @returns Función que recibe RenderGroupCellProps y retorna el BooleanFormatter
|
|
14
|
+
*/
|
|
15
|
+
export declare function ColumnBooleanGroupFormatter<TRow>(props: ColumnBooleanFormatterProps<TRow>): (groupProps: RenderGroupCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { getPropertyByString } from "@m4l/core";
|
|
4
|
+
import { B as BooleanFormatter } from "../../../formatters/BooleanFormatter/BooleanFormatter.js";
|
|
5
|
+
function ColumnBooleanGroupFormatter(props) {
|
|
6
|
+
const { fieldValue, presentationType, Component = React.Fragment } = props;
|
|
7
|
+
return (groupProps) => {
|
|
8
|
+
const { childRows } = groupProps;
|
|
9
|
+
if (childRows.length === 0) {
|
|
10
|
+
return /* @__PURE__ */ jsx(Fragment, { children: "-" });
|
|
11
|
+
}
|
|
12
|
+
const representativeRow = childRows[0];
|
|
13
|
+
const valueMaybeString = getPropertyByString(representativeRow, fieldValue);
|
|
14
|
+
let fixedValue;
|
|
15
|
+
if (typeof valueMaybeString === "boolean") {
|
|
16
|
+
fixedValue = valueMaybeString;
|
|
17
|
+
} else {
|
|
18
|
+
fixedValue = void 0;
|
|
19
|
+
}
|
|
20
|
+
return /* @__PURE__ */ jsx(
|
|
21
|
+
BooleanFormatter,
|
|
22
|
+
{
|
|
23
|
+
presentationType,
|
|
24
|
+
value: fixedValue,
|
|
25
|
+
Component
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
ColumnBooleanGroupFormatter as C
|
|
32
|
+
};
|
|
@@ -4,6 +4,7 @@ import { ColumnBooleanFormatterProps } from './types';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const useColumnBoolean: <TRow>(props: ColumnBooleanFormatterProps<TRow>) => {
|
|
6
6
|
formatter: (renderProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
renderGroupCell: (groupProps: import('react-data-grid').RenderGroupCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
customFilter: (row: TRow, value: string) => boolean;
|
|
8
9
|
customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
|
|
9
10
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { g as getFormatBoolean } from "../../../formatters/BooleanFormatter/BooleanFormatter.js";
|
|
2
2
|
import { C as ColumnBooleanFormatter } from "./formatter.js";
|
|
3
|
+
import { C as ColumnBooleanGroupFormatter } from "./ColumnBooleanGroupFormatter.js";
|
|
3
4
|
import { useModuleDictionary, getPropertyByString } from "@m4l/core";
|
|
4
5
|
import { useState, useRef, useEffect, useMemo } from "react";
|
|
5
6
|
import { deepEqual } from "fast-equals";
|
|
@@ -70,6 +71,7 @@ const useColumnBoolean = (props) => {
|
|
|
70
71
|
return useMemo(
|
|
71
72
|
() => ({
|
|
72
73
|
formatter: ColumnBooleanFormatter(stateProps),
|
|
74
|
+
renderGroupCell: ColumnBooleanGroupFormatter(stateProps),
|
|
73
75
|
customFilter: getCustomBooleanFilter(stateProps, getLabel),
|
|
74
76
|
customSort: getCustomBooleanSort(stateProps, getLabel)
|
|
75
77
|
}),
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ColumnChipStatusFormatterProps } from './types';
|
|
2
|
+
import { RenderGroupCellProps } from 'react-data-grid';
|
|
3
|
+
/**
|
|
4
|
+
* Formatter para mostrar un chip de estado en filas de grupo (TreeDataGrid).
|
|
5
|
+
*
|
|
6
|
+
* Esta función es utilizada cuando el TreeDataGrid agrupa filas y necesita
|
|
7
|
+
* mostrar un ChipStatus en el encabezado del grupo. Usa la primera fila
|
|
8
|
+
* del grupo (childRows[0]) como fuente de datos representativa.
|
|
9
|
+
* @param props - Propiedades del formatter que incluyen:
|
|
10
|
+
* - fieldStatus: Campo que contiene el valor del estado
|
|
11
|
+
* - fieldLabel: Campo o función que genera la etiqueta del chip
|
|
12
|
+
* - statusesColors: Mapeo de estados a colores
|
|
13
|
+
* - fallbackColor: Color por defecto si el estado no tiene mapeo
|
|
14
|
+
* @returns Función que recibe RenderGroupCellProps y retorna el ChipStatusFormatter
|
|
15
|
+
*/
|
|
16
|
+
export declare const ColumnChipStatusGroupFormatter: <TRow>(props: ColumnChipStatusFormatterProps<TRow>) => (groupProps: RenderGroupCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
|
package/components/datagrids/formatters/ColumnChipStatusFormatter/ColumnChipStatusGroupFormatter.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { getPropertyByString } from "@m4l/core";
|
|
3
|
+
import { C as ChipStatusFormatterColumnWrapperStyled } from "../../../formatters/ChipStatusFormatter/slots/ChipStatusFormatterSlots.js";
|
|
4
|
+
import { g as getNullGuard } from "../../../../utils/getNullGuard.js";
|
|
5
|
+
import { C as ChipStatusFormatter } from "../../../formatters/ChipStatusFormatter/ChipStatusFormatter.js";
|
|
6
|
+
const ColumnChipStatusGroupFormatter = (props) => {
|
|
7
|
+
const { fieldStatus, fieldLabel, statusesColors, fallbackColor } = props;
|
|
8
|
+
return (groupProps) => {
|
|
9
|
+
const { childRows } = groupProps;
|
|
10
|
+
if (childRows.length === 0) {
|
|
11
|
+
return /* @__PURE__ */ jsx(Fragment, { children: "-" });
|
|
12
|
+
}
|
|
13
|
+
const representativeRow = childRows[0];
|
|
14
|
+
const cleanFieldStatus = fieldStatus.toString().startsWith("row.") ? fieldStatus.toString().substring(4) : fieldStatus.toString();
|
|
15
|
+
const cleanFieldLabel = typeof fieldLabel === "string" && fieldLabel.startsWith("row.") ? fieldLabel.substring(4) : fieldLabel;
|
|
16
|
+
const status = getNullGuard(
|
|
17
|
+
getPropertyByString(representativeRow, cleanFieldStatus)
|
|
18
|
+
);
|
|
19
|
+
const baseLabel = typeof cleanFieldLabel === "string" ? getNullGuard(
|
|
20
|
+
getPropertyByString(representativeRow, cleanFieldLabel)
|
|
21
|
+
) : typeof fieldLabel === "function" ? fieldLabel(representativeRow, status) : "";
|
|
22
|
+
const label = `${baseLabel} (${childRows.length})`;
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
ChipStatusFormatter,
|
|
25
|
+
{
|
|
26
|
+
label,
|
|
27
|
+
status,
|
|
28
|
+
statusesColors,
|
|
29
|
+
Component: ChipStatusFormatterColumnWrapperStyled,
|
|
30
|
+
fallbackColor
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
ColumnChipStatusGroupFormatter as C
|
|
37
|
+
};
|
|
@@ -4,6 +4,7 @@ import { ColumnChipStatusFormatterProps } from './types';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const useColumnChipStatus: <TRow>(props: ColumnChipStatusFormatterProps<TRow>) => {
|
|
6
6
|
formatter: (renderProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
renderGroupCell: (groupProps: import('react-data-grid').RenderGroupCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
customFilter: (row: TRow, value: string | number) => boolean;
|
|
8
9
|
customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
|
|
9
10
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getPropertyByString } from "@m4l/core";
|
|
2
2
|
import { C as ColumnChipStatusFormatter } from "./formatter.js";
|
|
3
|
+
import { C as ColumnChipStatusGroupFormatter } from "./ColumnChipStatusGroupFormatter.js";
|
|
3
4
|
import { deepEqual } from "fast-equals";
|
|
4
5
|
import { useState, useRef, useEffect, useMemo } from "react";
|
|
5
6
|
import { g as getColumnKey } from "../../helpers/shared/getColumnKey/getColumnKey.js";
|
|
@@ -28,6 +29,7 @@ const useColumnChipStatus = (props) => {
|
|
|
28
29
|
}, [props]);
|
|
29
30
|
return useMemo(() => ({
|
|
30
31
|
formatter: ColumnChipStatusFormatter(stateProps),
|
|
32
|
+
renderGroupCell: ColumnChipStatusGroupFormatter(stateProps),
|
|
31
33
|
customFilter: getCustomChipStatusFilter(stateProps),
|
|
32
34
|
customSort: getCustomChipStatusSort(stateProps)
|
|
33
35
|
}), [stateProps]);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RenderGroupCellProps } from 'react-data-grid';
|
|
2
|
+
import { ColumnColorFormatterProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Formatter para mostrar colores en filas de grupo (TreeDataGrid).
|
|
5
|
+
*
|
|
6
|
+
* Esta función es utilizada cuando el TreeDataGrid agrupa filas y necesita
|
|
7
|
+
* mostrar un color en el encabezado del grupo. Usa la primera fila
|
|
8
|
+
* del grupo (childRows[0]) como fuente de datos representativa.
|
|
9
|
+
* @param props - Propiedades del formatter que incluyen:
|
|
10
|
+
* - fieldValue: Campo que contiene el valor del color
|
|
11
|
+
* - size: Tamaño del indicador de color
|
|
12
|
+
* @returns Función que recibe RenderGroupCellProps y retorna el ColorFormatter
|
|
13
|
+
*/
|
|
14
|
+
export declare const ColumnColorGroupFormatter: <TRow>(props: ColumnColorFormatterProps<TRow>) => (groupProps: RenderGroupCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { getPropertyByString } from "@m4l/core";
|
|
3
|
+
import { C as ColorFormatter } from "../../../formatters/ColorFormatter/ColorFormatter.js";
|
|
4
|
+
const ColumnColorGroupFormatter = (props) => {
|
|
5
|
+
const { fieldValue, size = "medium" } = props;
|
|
6
|
+
return (groupProps) => {
|
|
7
|
+
const { childRows } = groupProps;
|
|
8
|
+
if (childRows.length === 0) {
|
|
9
|
+
return /* @__PURE__ */ jsx(Fragment, { children: "-" });
|
|
10
|
+
}
|
|
11
|
+
const representativeRow = childRows[0];
|
|
12
|
+
const colorValue = getPropertyByString(representativeRow, fieldValue.toString());
|
|
13
|
+
let fixedValue;
|
|
14
|
+
if (typeof colorValue === "string") {
|
|
15
|
+
fixedValue = colorValue;
|
|
16
|
+
} else {
|
|
17
|
+
fixedValue = null;
|
|
18
|
+
}
|
|
19
|
+
return /* @__PURE__ */ jsx(ColorFormatter, { value: fixedValue, size });
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
ColumnColorGroupFormatter as C
|
|
24
|
+
};
|
|
@@ -11,4 +11,5 @@ import { ColumnColorFormatterProps } from './types';
|
|
|
11
11
|
*/
|
|
12
12
|
export declare const useColumnColor: <TRow>(props: ColumnColorFormatterProps<TRow>) => {
|
|
13
13
|
formatter: (renderProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
renderGroupCell: (groupProps: import('react-data-grid').RenderGroupCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useState, useRef, useEffect, useMemo } from "react";
|
|
2
2
|
import { deepEqual } from "fast-equals";
|
|
3
3
|
import { C as ColumnColorFormatter } from "./formatter.js";
|
|
4
|
+
import { C as ColumnColorGroupFormatter } from "./ColumnColorGroupFormatter.js";
|
|
4
5
|
const useColumnColor = (props) => {
|
|
5
6
|
const [stateProps, setStateProps] = useState(props);
|
|
6
7
|
const refProps = useRef({ ...props });
|
|
@@ -12,7 +13,8 @@ const useColumnColor = (props) => {
|
|
|
12
13
|
}, [props]);
|
|
13
14
|
return useMemo(
|
|
14
15
|
() => ({
|
|
15
|
-
formatter: ColumnColorFormatter(stateProps)
|
|
16
|
+
formatter: ColumnColorFormatter(stateProps),
|
|
17
|
+
renderGroupCell: ColumnColorGroupFormatter(stateProps)
|
|
16
18
|
}),
|
|
17
19
|
[stateProps]
|
|
18
20
|
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ColumnConcatenatedValuesFormatterProps } from './types';
|
|
2
|
+
import { RenderGroupCellProps } from 'react-data-grid';
|
|
3
|
+
/**
|
|
4
|
+
* Formatter para mostrar valores concatenados en filas de grupo (TreeDataGrid).
|
|
5
|
+
*
|
|
6
|
+
* Esta función es utilizada cuando el TreeDataGrid agrupa filas y necesita
|
|
7
|
+
* mostrar valores concatenados en el encabezado del grupo. Usa la primera fila
|
|
8
|
+
* del grupo (childRows[0]) como fuente de datos representativa.
|
|
9
|
+
* @param props - Propiedades del formatter que incluyen:
|
|
10
|
+
* - fieldValue: Array de campos a concatenar
|
|
11
|
+
* - fieldSeparator: Separador entre valores
|
|
12
|
+
* - Component: Componente wrapper opcional
|
|
13
|
+
* @returns Función que recibe RenderGroupCellProps y retorna el ConcatenatedFormatter
|
|
14
|
+
*/
|
|
15
|
+
export declare function ColumnConcatenatedValuesGroupFormatter<TRow>(props: ColumnConcatenatedValuesFormatterProps<TRow>): (groupProps: RenderGroupCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { getPropertyByString } from "@m4l/core";
|
|
4
|
+
import { C as ConcatenatedFormatter } from "../../../formatters/ConcatenatedFormatter/ConcatenatedFormatter.js";
|
|
5
|
+
function ColumnConcatenatedValuesGroupFormatter(props) {
|
|
6
|
+
const { fieldValue, fieldSeparator, Component = React.Fragment } = props;
|
|
7
|
+
return (groupProps) => {
|
|
8
|
+
const { childRows } = groupProps;
|
|
9
|
+
if (childRows.length === 0) {
|
|
10
|
+
return /* @__PURE__ */ jsx(Fragment, { children: "-" });
|
|
11
|
+
}
|
|
12
|
+
const representativeRow = childRows[0];
|
|
13
|
+
const values = fieldValue.map((element) => {
|
|
14
|
+
const valueMaybeString = getPropertyByString(representativeRow, element);
|
|
15
|
+
let fixedValue;
|
|
16
|
+
if (typeof valueMaybeString === "string" || typeof valueMaybeString === "number") {
|
|
17
|
+
fixedValue = valueMaybeString.toString();
|
|
18
|
+
} else {
|
|
19
|
+
fixedValue = "";
|
|
20
|
+
}
|
|
21
|
+
return fixedValue;
|
|
22
|
+
});
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
ConcatenatedFormatter,
|
|
25
|
+
{
|
|
26
|
+
values,
|
|
27
|
+
separator: fieldSeparator,
|
|
28
|
+
Component
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
ColumnConcatenatedValuesGroupFormatter as C
|
|
35
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { ColumnConcatenatedValuesFormatter as ColumnConcatenatedValueFormatter } from './formatter';
|
|
2
|
+
export { ColumnConcatenatedValuesGroupFormatter } from './ColumnConcatenatedValuesGroupFormatter';
|
|
2
3
|
export type { ColumnConcatenatedValuesFormatterProps } from './types';
|
|
3
4
|
export { useColumnConcatenatedValues as useColumnConcatenatedValue } from './useColumnConcatenatedValues';
|
|
@@ -4,6 +4,7 @@ import { ColumnConcatenatedValuesFormatterProps } from './types';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const useColumnConcatenatedValues: <TRow>(props: ColumnConcatenatedValuesFormatterProps<TRow>) => {
|
|
6
6
|
formatter: (renderProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
renderGroupCell: (groupProps: import('react-data-grid').RenderGroupCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
customFilter: (row: TRow, value: string) => boolean;
|
|
8
9
|
customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
|
|
9
10
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getPropertyByString } from "@m4l/core";
|
|
2
2
|
import { deepEqual } from "fast-equals";
|
|
3
|
+
import { C as ColumnConcatenatedValuesGroupFormatter } from "./ColumnConcatenatedValuesGroupFormatter.js";
|
|
3
4
|
import { g as getFormatConcatenated } from "../../../formatters/ConcatenatedFormatter/ConcatenatedFormatter.js";
|
|
4
5
|
import { useState, useRef, useEffect, useMemo } from "react";
|
|
5
6
|
import { C as ColumnConcatenatedValuesFormatter } from "./formatter.js";
|
|
@@ -50,6 +51,7 @@ const useColumnConcatenatedValues = (props) => {
|
|
|
50
51
|
}, [props]);
|
|
51
52
|
return useMemo(() => ({
|
|
52
53
|
formatter: ColumnConcatenatedValuesFormatter(stateProps),
|
|
54
|
+
renderGroupCell: ColumnConcatenatedValuesGroupFormatter(stateProps),
|
|
53
55
|
customFilter: getCustomContatenatedValueFilter(stateProps),
|
|
54
56
|
customSort: getCustomConcatenatedValueSort(stateProps)
|
|
55
57
|
}), [stateProps]);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ColumnDateFormatterProps } from './types';
|
|
2
|
+
import { RenderGroupCellProps } from 'react-data-grid';
|
|
3
|
+
/**
|
|
4
|
+
* Formatter para mostrar una fecha en filas de grupo (TreeDataGrid).
|
|
5
|
+
* Usa la primera fila del grupo (childRows[0]) como fuente de datos.
|
|
6
|
+
* @param props - Propiedades del formatter (fieldValue, presentationType, Component)
|
|
7
|
+
* @returns Función que recibe RenderGroupCellProps y retorna el DateFormatter
|
|
8
|
+
*/
|
|
9
|
+
export declare function ColumnDateGroupFormatter<TRow>(props: ColumnDateFormatterProps<TRow>): (groupProps: RenderGroupCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { getPropertyByString } from "@m4l/core";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { D as DateFormatter } from "../../../formatters/DateFormatter/DateFormatter.js";
|
|
5
|
+
function ColumnDateGroupFormatter(props) {
|
|
6
|
+
const { fieldValue, presentationType, Component = React.Fragment } = props;
|
|
7
|
+
return (groupProps) => {
|
|
8
|
+
const { childRows } = groupProps;
|
|
9
|
+
if (childRows.length === 0) {
|
|
10
|
+
return /* @__PURE__ */ jsx(Fragment, { children: "-" });
|
|
11
|
+
}
|
|
12
|
+
const representativeRow = childRows[0];
|
|
13
|
+
const valueMaybeDateStringNumber = getPropertyByString(
|
|
14
|
+
representativeRow,
|
|
15
|
+
fieldValue
|
|
16
|
+
);
|
|
17
|
+
let fixedValue;
|
|
18
|
+
if (typeof valueMaybeDateStringNumber === "string" || typeof valueMaybeDateStringNumber === "number" || valueMaybeDateStringNumber instanceof Date) {
|
|
19
|
+
fixedValue = valueMaybeDateStringNumber;
|
|
20
|
+
} else {
|
|
21
|
+
fixedValue = "";
|
|
22
|
+
}
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
DateFormatter,
|
|
25
|
+
{
|
|
26
|
+
presentationType,
|
|
27
|
+
value: fixedValue,
|
|
28
|
+
Component
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
ColumnDateGroupFormatter as C
|
|
35
|
+
};
|
|
@@ -9,6 +9,7 @@ export declare const useCustomDateFilter: <TRow>(props: ColumnDateFormatterProps
|
|
|
9
9
|
*/
|
|
10
10
|
export declare const useColumnDate: <TRow>(props: ColumnDateFormatterProps<TRow>) => {
|
|
11
11
|
formatter: (formatterProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
renderGroupCell: (groupProps: import('react-data-grid').RenderGroupCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
customFilter: (row: TRow, value: string) => boolean;
|
|
13
14
|
customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
|
|
14
15
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getPropertyByString } from "@m4l/core";
|
|
2
2
|
import { g as getFormatDate } from "../../../formatters/DateFormatter/DateFormatter.js";
|
|
3
3
|
import { C as ColumnDateFormatter } from "./formatter.js";
|
|
4
|
+
import { C as ColumnDateGroupFormatter } from "./ColumnDateGroupFormatter.js";
|
|
4
5
|
import { useFormatter } from "@m4l/graphics";
|
|
5
6
|
import { g as getValidDate } from "../../../../utils/getValidDate.js";
|
|
6
7
|
import { useState, useRef, useEffect, useMemo, useCallback } from "react";
|
|
@@ -56,6 +57,7 @@ const useColumnDate = (props) => {
|
|
|
56
57
|
}, [props]);
|
|
57
58
|
return useMemo(() => ({
|
|
58
59
|
formatter: ColumnDateFormatter(stateProps),
|
|
60
|
+
renderGroupCell: ColumnDateGroupFormatter(stateProps),
|
|
59
61
|
customFilter,
|
|
60
62
|
customSort: getCustomDateSort(stateProps)
|
|
61
63
|
}), [stateProps, customFilter]);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ColumnIconFormatterProps } from './types';
|
|
2
|
+
import { RenderGroupCellProps } from 'react-data-grid';
|
|
3
|
+
/**
|
|
4
|
+
* Formatter para mostrar iconos en filas de grupo (TreeDataGrid).
|
|
5
|
+
*
|
|
6
|
+
* Esta función es utilizada cuando el TreeDataGrid agrupa filas y necesita
|
|
7
|
+
* mostrar iconos en el encabezado del grupo. Usa la primera fila
|
|
8
|
+
* del grupo (childRows[0]) como fuente de datos representativa.
|
|
9
|
+
* @param props - Propiedades del formatter que incluyen:
|
|
10
|
+
* - getIconProps: Función que obtiene las props del icono de una fila
|
|
11
|
+
* @returns Función que recibe RenderGroupCellProps y retorna el IconsFormatter
|
|
12
|
+
*/
|
|
13
|
+
export declare const ColumnIconGroupFormatter: <TRow>(props: ColumnIconFormatterProps<TRow>) => (groupProps: RenderGroupCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
|