@m4l/components 9.4.13 → 9.4.15
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/slots/SettingsLayoutSlots.d.ts +3 -3
- 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/formatter.d.ts +33 -1
- package/components/datagrids/formatters/ColumnNestedValueFormatter/formatter.js +3 -2
- package/components/datagrids/formatters/ColumnNestedValueFormatter/index.d.ts +1 -0
- package/components/datagrids/formatters/ColumnNestedValueFormatter/types.d.ts +19 -1
- package/components/datagrids/formatters/ColumnNestedValueFormatter/useColumnNestedValue.d.ts +35 -2
- package/components/datagrids/formatters/ColumnNestedValueFormatter/useColumnNestedValue.js +24 -8
- 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/tests/helpers/types.d.ts +10 -0
- 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,17 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { I as IconsFormatter } from "../../../formatters/IconsFormatter/IconsFormatter.js";
|
|
3
|
+
const ColumnIconGroupFormatter = (props) => {
|
|
4
|
+
const { getIconProps } = props;
|
|
5
|
+
return (groupProps) => {
|
|
6
|
+
const { childRows } = groupProps;
|
|
7
|
+
if (childRows.length === 0) {
|
|
8
|
+
return /* @__PURE__ */ jsx(Fragment, { children: "-" });
|
|
9
|
+
}
|
|
10
|
+
const representativeRow = childRows[0];
|
|
11
|
+
const iconProps = getIconProps(representativeRow);
|
|
12
|
+
return /* @__PURE__ */ jsx(IconsFormatter, { icons: iconProps });
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
ColumnIconGroupFormatter as C
|
|
17
|
+
};
|
|
@@ -5,4 +5,5 @@ import { ColumnIconFormatterProps } from './types';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const useColumnIcon: <TRow>(props: ColumnIconFormatterProps<TRow>) => {
|
|
7
7
|
formatter: (renderProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
renderGroupCell: (groupProps: import('react-data-grid').RenderGroupCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { deepEqual } from "fast-equals";
|
|
2
2
|
import { useState, useRef, useEffect, useMemo } from "react";
|
|
3
3
|
import { C as ColumnIconFormatter } from "./formatter.js";
|
|
4
|
+
import { C as ColumnIconGroupFormatter } from "./ColumnIconGroupFormatter.js";
|
|
4
5
|
const useColumnIcon = (props) => {
|
|
5
6
|
const [stateProps, setStateProps] = useState(props);
|
|
6
7
|
const refProps = useRef({ ...props });
|
|
@@ -11,7 +12,8 @@ const useColumnIcon = (props) => {
|
|
|
11
12
|
}
|
|
12
13
|
}, [props]);
|
|
13
14
|
return useMemo(() => ({
|
|
14
|
-
formatter: ColumnIconFormatter(stateProps)
|
|
15
|
+
formatter: ColumnIconFormatter(stateProps),
|
|
16
|
+
renderGroupCell: ColumnIconGroupFormatter(stateProps)
|
|
15
17
|
}), [stateProps]);
|
|
16
18
|
};
|
|
17
19
|
export {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ColumnImageFormatterProps } from './types';
|
|
2
|
+
import { RenderGroupCellProps } from 'react-data-grid';
|
|
3
|
+
/**
|
|
4
|
+
* Formatter para mostrar imágenes en filas de grupo (TreeDataGrid).
|
|
5
|
+
*
|
|
6
|
+
* Esta función es utilizada cuando el TreeDataGrid agrupa filas y necesita
|
|
7
|
+
* mostrar una imagen 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 la URL de la imagen
|
|
11
|
+
* - fieldText: Campo opcional para el texto
|
|
12
|
+
* - cover: Modo de ajuste de la imagen
|
|
13
|
+
* @returns Función que recibe RenderGroupCellProps y retorna el ImageFormatter
|
|
14
|
+
*/
|
|
15
|
+
export declare const ColumnImageGroupFormatter: <TRow>(props: ColumnImageFormatterProps<TRow>) => (groupProps: RenderGroupCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { getPropertyByString } from "@m4l/core";
|
|
3
|
+
import { I as ImageFormatter } from "../../../formatters/ImageFormatter/ImageFormatter.js";
|
|
4
|
+
const ColumnImageGroupFormatter = (props) => {
|
|
5
|
+
const { fieldValue, fieldText, cover } = 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 src = getPropertyByString(
|
|
13
|
+
representativeRow,
|
|
14
|
+
fieldValue.toString()
|
|
15
|
+
);
|
|
16
|
+
const text = fieldText ? getPropertyByString(representativeRow, fieldText.toString()) : void 0;
|
|
17
|
+
if (!src) {
|
|
18
|
+
return /* @__PURE__ */ jsx(Fragment, { children: "-" });
|
|
19
|
+
}
|
|
20
|
+
return /* @__PURE__ */ jsx(
|
|
21
|
+
ImageFormatter,
|
|
22
|
+
{
|
|
23
|
+
src,
|
|
24
|
+
alt: text || src,
|
|
25
|
+
text: text ?? void 0,
|
|
26
|
+
cover
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
ColumnImageGroupFormatter as C
|
|
33
|
+
};
|
|
@@ -6,4 +6,5 @@ import { ColumnImageFormatterProps } from './types';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare const useColumnImage: <TRow>(props: ColumnImageFormatterProps<TRow>) => {
|
|
8
8
|
formatter: (formatterProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
renderGroupCell: (groupProps: import('react-data-grid').RenderGroupCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
};
|
|
@@ -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 ColumnImageFormatter } from "./formatter.js";
|
|
4
|
+
import { C as ColumnImageGroupFormatter } from "./ColumnImageGroupFormatter.js";
|
|
4
5
|
const useColumnImage = (props) => {
|
|
5
6
|
const [stateProps, setStateProps] = useState(props);
|
|
6
7
|
const refProps = useRef({ ...props });
|
|
@@ -12,7 +13,8 @@ const useColumnImage = (props) => {
|
|
|
12
13
|
}, [props]);
|
|
13
14
|
return useMemo(
|
|
14
15
|
() => ({
|
|
15
|
-
formatter: ColumnImageFormatter(stateProps)
|
|
16
|
+
formatter: ColumnImageFormatter(stateProps),
|
|
17
|
+
renderGroupCell: ColumnImageGroupFormatter(stateProps)
|
|
16
18
|
}),
|
|
17
19
|
[stateProps]
|
|
18
20
|
);
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { ColumnInteractiveCheckFormatterProps } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* ColumnInteractiveCheckFormatter: Es un formateador de columna booleano que permite la interacción directa
|
|
4
|
-
* (
|
|
4
|
+
* (cambiar el checked) sin la necesidad de entrar en edición como lo hace un editor.
|
|
5
|
+
*
|
|
6
|
+
* Soporta la propiedad opcional `disabledKey` en la columna, que indica qué campo del row
|
|
7
|
+
* determina si el checkbox está deshabilitado. Si el valor de ese campo es `false`,
|
|
8
|
+
* el checkbox se deshabilita.
|
|
9
|
+
* @example
|
|
10
|
+
* // Columna con checkbox siempre habilitado
|
|
11
|
+
* { key: 'visible', name: 'Visible', renderCell: ColumnInteractiveCheckFormatter }
|
|
12
|
+
* @example
|
|
13
|
+
* // Columna con checkbox condicionalmente deshabilitado
|
|
14
|
+
* { key: 'grouped', name: 'Agrupar', renderCell: ColumnInteractiveCheckFormatter, disabledKey: 'groupable' }
|
|
15
|
+
* // El checkbox se deshabilita cuando row.groupable === false
|
|
5
16
|
*/
|
|
6
17
|
export declare function ColumnInteractiveCheckFormatter<Row>(props: ColumnInteractiveCheckFormatterProps<Row>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,7 +2,12 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { C as CheckBox } from "../../../mui_extended/CheckBox/CheckBox.js";
|
|
3
3
|
function ColumnInteractiveCheckFormatter(props) {
|
|
4
4
|
const { row, onRowChange, column } = props;
|
|
5
|
+
const disabledKey = column.disabledKey;
|
|
6
|
+
const isDisabled = disabledKey ? !row[disabledKey] : false;
|
|
5
7
|
const handleChange = () => {
|
|
8
|
+
if (isDisabled) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
6
11
|
const newRow = { ...row };
|
|
7
12
|
newRow[column.key] = !row[column.key];
|
|
8
13
|
onRowChange(newRow);
|
|
@@ -12,6 +17,7 @@ function ColumnInteractiveCheckFormatter(props) {
|
|
|
12
17
|
{
|
|
13
18
|
size: "small",
|
|
14
19
|
checked: row[column.key] || false,
|
|
20
|
+
disabled: isDisabled,
|
|
15
21
|
onChange: handleChange
|
|
16
22
|
}
|
|
17
23
|
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ColumnNestedValueFormatterProps } from './types';
|
|
2
|
+
import { RenderGroupCellProps } from 'react-data-grid';
|
|
3
|
+
/**
|
|
4
|
+
* Formatter para mostrar valores anidados en filas de grupo (TreeDataGrid).
|
|
5
|
+
*
|
|
6
|
+
* Esta función es utilizada cuando el TreeDataGrid agrupa filas y necesita
|
|
7
|
+
* mostrar un valor anidado 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 anidado a mostrar (ej: 'user.name')
|
|
11
|
+
* - Component: Componente wrapper opcional
|
|
12
|
+
* @returns Función que recibe RenderGroupCellProps y retorna el valor formateado
|
|
13
|
+
*/
|
|
14
|
+
export declare function ColumnNestedValueGroupFormatter<TRow>(props: ColumnNestedValueFormatterProps<TRow>): (groupProps: RenderGroupCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { getPropertyByString } from "@m4l/core";
|
|
4
|
+
import { g as getNullGuard } from "../../../../utils/getNullGuard.js";
|
|
5
|
+
function ColumnNestedValueGroupFormatter(props) {
|
|
6
|
+
const { fieldValue, 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 property = getNullGuard(
|
|
14
|
+
getPropertyByString(representativeRow, fieldValue)
|
|
15
|
+
);
|
|
16
|
+
const value = typeof property === "object" ? JSON.stringify(property) : property;
|
|
17
|
+
return /* @__PURE__ */ jsx(Component, { children: value });
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
ColumnNestedValueGroupFormatter as C
|
|
22
|
+
};
|
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
import { ColumnNestedValueFormatterProps } from './types';
|
|
2
2
|
import { RenderCellProps } from 'react-data-grid';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Formatter para mostrar valores de propiedades anidadas en columnas del DataGrid.
|
|
5
|
+
*
|
|
6
|
+
* Este formatter permite acceder a propiedades dentro de objetos anidados usando
|
|
7
|
+
* "dot notation" (notación de punto). Es útil cuando los datos tienen estructuras
|
|
8
|
+
* complejas y necesitas mostrar un valor específico dentro de un objeto.
|
|
9
|
+
* @param props - Configuración del formatter
|
|
10
|
+
* @param props.fieldValue - Ruta a la propiedad usando dot notation (ej: 'user.profile.name')
|
|
11
|
+
* @param props.Component - Componente opcional para envolver el valor (default: React.Fragment)
|
|
12
|
+
* @param props.defaultValue - Valor a mostrar si es null/undefined (default: '-')
|
|
13
|
+
* @returns Función formatter compatible con react-data-grid
|
|
14
|
+
* @example
|
|
15
|
+
* // Filas de ejemplo:
|
|
16
|
+
* // { id: 1, user: { profile: { name: 'Juan' } } }
|
|
17
|
+
* // { id: 2, user: { profile: { name: null } } }
|
|
18
|
+
*
|
|
19
|
+
* // Uso recomendado con hook:
|
|
20
|
+
* const nestedColumn = useColumnNestedValue<MyRow>({
|
|
21
|
+
* fieldValue: 'user.profile.name',
|
|
22
|
+
* defaultValue: 'Sin nombre',
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* const columns = [
|
|
26
|
+
* {
|
|
27
|
+
* key: 'userName',
|
|
28
|
+
* name: 'Nombre',
|
|
29
|
+
* type: 'custom',
|
|
30
|
+
* ...nestedColumn, // Incluye formatter, customFilter y customSort
|
|
31
|
+
* }
|
|
32
|
+
* ];
|
|
33
|
+
*
|
|
34
|
+
* // Resultado en DataGrid:
|
|
35
|
+
* // Fila 1: "Juan"
|
|
36
|
+
* // Fila 2: "Sin nombre" (porque el valor es null)
|
|
5
37
|
*/
|
|
6
38
|
export declare function ColumnNestedValueFormatter<TRow>(props: ColumnNestedValueFormatterProps<TRow>): (formatterProps: RenderCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,10 +3,11 @@ import { getPropertyByString } from "@m4l/core";
|
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { g as getNullGuard } from "../../../../utils/getNullGuard.js";
|
|
5
5
|
function ColumnNestedValueFormatter(props) {
|
|
6
|
-
const { fieldValue, Component = React.Fragment } = props;
|
|
6
|
+
const { fieldValue, Component = React.Fragment, defaultValue = "-" } = props;
|
|
7
7
|
return (formatterProps) => {
|
|
8
8
|
const property = getNullGuard(
|
|
9
|
-
getPropertyByString(formatterProps.row, fieldValue)
|
|
9
|
+
getPropertyByString(formatterProps.row, fieldValue),
|
|
10
|
+
defaultValue
|
|
10
11
|
);
|
|
11
12
|
const value = typeof property === "object" ? JSON.stringify(property) : property;
|
|
12
13
|
return /* @__PURE__ */ jsx(Component, { children: value });
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { ColumnNestedValueFormatter } from './formatter';
|
|
2
|
+
export { ColumnNestedValueGroupFormatter } from './ColumnNestedValueGroupFormatter';
|
|
2
3
|
export type { ColumnNestedValueFormatterProps } from './types';
|
|
3
4
|
export { useColumnNestedValue } from './useColumnNestedValue';
|
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
import { DeepKeyOf } from '../../../../utils/types';
|
|
2
2
|
export interface ColumnNestedValueFormatterProps<TRow> {
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Ruta a la propiedad anidada usando dot notation.
|
|
5
|
+
* Permite acceder a valores dentro de objetos anidados.
|
|
6
|
+
* @example
|
|
7
|
+
* // Para acceder a { user: { profile: { name: 'Juan' } } }
|
|
8
|
+
* fieldValue: 'user.profile.name' // Retorna 'Juan'
|
|
9
|
+
*/
|
|
4
10
|
fieldValue: DeepKeyOf<TRow>;
|
|
11
|
+
/**
|
|
12
|
+
* Componente opcional para envolver el valor renderizado.
|
|
13
|
+
* Por defecto usa React.Fragment.
|
|
14
|
+
* @example
|
|
15
|
+
* Component: Typography // Envuelve el valor en <Typography>{valor}</Typography>
|
|
16
|
+
*/
|
|
17
|
+
Component?: React.ElementType;
|
|
18
|
+
/**
|
|
19
|
+
* Valor a mostrar cuando la propiedad es null o undefined.
|
|
20
|
+
* Por defecto es '-'.
|
|
21
|
+
*/
|
|
22
|
+
defaultValue?: string;
|
|
5
23
|
}
|
package/components/datagrids/formatters/ColumnNestedValueFormatter/useColumnNestedValue.d.ts
CHANGED
|
@@ -1,10 +1,43 @@
|
|
|
1
1
|
import { ColumnNestedValueFormatterProps } from './types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Hook para crear una columna que muestra valores de propiedades anidadas.
|
|
4
|
+
* @param props - Configuración del formatter
|
|
5
|
+
* @param props.fieldValue - Ruta a la propiedad usando dot notation (ej: 'user.profile.name')
|
|
6
|
+
* @param props.Component - Componente opcional para envolver el valor (default: React.Fragment)
|
|
7
|
+
* @param props.defaultValue - Valor a mostrar si es null/undefined (default: '-')
|
|
8
|
+
* @returns Objeto con { formatter, customFilter, customSort } para usar en la columna
|
|
9
|
+
* @example
|
|
10
|
+
* // Datos de ejemplo en el DataGrid:
|
|
11
|
+
* // [
|
|
12
|
+
* // { id: 1, nestedValue: { value: 'Activo' } },
|
|
13
|
+
* // { id: 2, nestedValue: { value: null } },
|
|
14
|
+
* // { id: 3, nestedValue: { value: 'Pendiente' } },
|
|
15
|
+
* // ]
|
|
16
|
+
*
|
|
17
|
+
* // Crear la columna con el hook
|
|
18
|
+
* const nestedColumn = useColumnNestedValue<RowType>({
|
|
19
|
+
* fieldValue: 'nestedValue.value',
|
|
20
|
+
* defaultValue: 'N/A', // Opcional, por defecto es '-'
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* // Usar en la definición de columnas
|
|
24
|
+
* const columns = [
|
|
25
|
+
* {
|
|
26
|
+
* key: 'nestedValue',
|
|
27
|
+
* name: 'Estado',
|
|
28
|
+
* type: 'custom',
|
|
29
|
+
* ...nestedColumn, // Spread incluye formatter, customFilter y customSort
|
|
30
|
+
* }
|
|
31
|
+
* ];
|
|
32
|
+
*
|
|
33
|
+
* // Resultado en el DataGrid:
|
|
34
|
+
* // Fila 1: "Activo"
|
|
35
|
+
* // Fila 2: "N/A" (porque el valor es null)
|
|
36
|
+
* // Fila 3: "Pendiente"
|
|
5
37
|
*/
|
|
6
38
|
export declare const useColumnNestedValue: <TRow>(props: ColumnNestedValueFormatterProps<TRow>) => {
|
|
7
39
|
formatter: (formatterProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
renderGroupCell: (groupProps: import('react-data-grid').RenderGroupCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
8
41
|
customFilter: (row: TRow, value: string) => any;
|
|
9
42
|
customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
|
|
10
43
|
};
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { getPropertyByString } from "@m4l/core";
|
|
2
|
+
import { C as ColumnNestedValueGroupFormatter } from "./ColumnNestedValueGroupFormatter.js";
|
|
2
3
|
import { useState, useRef, useEffect, useMemo } from "react";
|
|
3
4
|
import { deepEqual } from "fast-equals";
|
|
4
5
|
import { g as getNullGuard } from "../../../../utils/getNullGuard.js";
|
|
5
6
|
import { C as ColumnNestedValueFormatter } from "./formatter.js";
|
|
6
7
|
import { g as getColumnKey } from "../../helpers/shared/getColumnKey/getColumnKey.js";
|
|
7
8
|
const getCustomNestedValueFilter = (props) => {
|
|
9
|
+
const { defaultValue = "-" } = props;
|
|
8
10
|
return (row, value) => {
|
|
9
|
-
const property = getNullGuard(
|
|
11
|
+
const property = getNullGuard(
|
|
12
|
+
getPropertyByString(row, props.fieldValue),
|
|
13
|
+
defaultValue
|
|
14
|
+
);
|
|
10
15
|
if (typeof property === "object") {
|
|
11
16
|
return Object.values(property).includes(value);
|
|
12
17
|
}
|
|
@@ -14,10 +19,17 @@ const getCustomNestedValueFilter = (props) => {
|
|
|
14
19
|
};
|
|
15
20
|
};
|
|
16
21
|
const getCustomNestedValueSort = (props) => {
|
|
22
|
+
const { defaultValue = "-" } = props;
|
|
17
23
|
return (a, b) => {
|
|
18
24
|
const keyWiouthRow = getColumnKey(props.fieldValue);
|
|
19
|
-
const valueA = getNullGuard(
|
|
20
|
-
|
|
25
|
+
const valueA = getNullGuard(
|
|
26
|
+
getPropertyByString(a, keyWiouthRow),
|
|
27
|
+
defaultValue
|
|
28
|
+
);
|
|
29
|
+
const valueB = getNullGuard(
|
|
30
|
+
getPropertyByString(b, keyWiouthRow),
|
|
31
|
+
defaultValue
|
|
32
|
+
);
|
|
21
33
|
if (typeof valueA === "object" || typeof valueB === "object" || valueA === void 0 || valueB === void 0) {
|
|
22
34
|
return 0;
|
|
23
35
|
}
|
|
@@ -39,11 +51,15 @@ const useColumnNestedValue = (props) => {
|
|
|
39
51
|
setStateProps(props);
|
|
40
52
|
}
|
|
41
53
|
}, [props]);
|
|
42
|
-
return useMemo(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
54
|
+
return useMemo(
|
|
55
|
+
() => ({
|
|
56
|
+
formatter: ColumnNestedValueFormatter(stateProps),
|
|
57
|
+
renderGroupCell: ColumnNestedValueGroupFormatter(stateProps),
|
|
58
|
+
customFilter: getCustomNestedValueFilter(stateProps),
|
|
59
|
+
customSort: getCustomNestedValueSort(stateProps)
|
|
60
|
+
}),
|
|
61
|
+
[stateProps]
|
|
62
|
+
);
|
|
47
63
|
};
|
|
48
64
|
export {
|
|
49
65
|
useColumnNestedValue as u
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ColumnPointsFormatterProps } from './types';
|
|
2
|
+
import { RenderGroupCellProps } from 'react-data-grid';
|
|
3
|
+
/**
|
|
4
|
+
* Formatter para mostrar puntos de calibración en filas de grupo (TreeDataGrid).
|
|
5
|
+
*
|
|
6
|
+
* Esta función es utilizada cuando el TreeDataGrid agrupa filas y necesita
|
|
7
|
+
* mostrar puntos 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 de los puntos
|
|
11
|
+
* - fieldUnit: Campo que contiene la unidad de los puntos
|
|
12
|
+
* - Component: Componente wrapper opcional
|
|
13
|
+
* @returns Función que recibe RenderGroupCellProps y retorna el PointsFormatter
|
|
14
|
+
*/
|
|
15
|
+
export declare const ColumnPointsGroupFormatter: <TRow>(props: ColumnPointsFormatterProps<TRow>) => (groupProps: RenderGroupCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { P as PointsFormatter } from "../../../formatters/PointsFormatter/PointsFormatter.js";
|
|
4
|
+
const ColumnPointsGroupFormatter = (props) => {
|
|
5
|
+
const { Component = React.Fragment } = props;
|
|
6
|
+
const fieldValue = props.fieldValue;
|
|
7
|
+
const fieldUnit = props.fieldUnit;
|
|
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
|
+
return /* @__PURE__ */ jsx(
|
|
15
|
+
PointsFormatter,
|
|
16
|
+
{
|
|
17
|
+
obProps: representativeRow,
|
|
18
|
+
...props,
|
|
19
|
+
fieldValue,
|
|
20
|
+
fieldUnit,
|
|
21
|
+
Component
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
ColumnPointsGroupFormatter as C
|
|
28
|
+
};
|
|
@@ -5,6 +5,7 @@ import { ColumnPointsFormatterProps } from './types';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const useColumnPoints: <TRow>(props: ColumnPointsFormatterProps<TRow>) => {
|
|
7
7
|
formatter: (formatterProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
renderGroupCell: (groupProps: import('react-data-grid').RenderGroupCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
customFilter: (row: TRow, value: string) => boolean;
|
|
9
10
|
customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
|
|
10
11
|
};
|
|
@@ -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 ColumnPointsFormatter } from "./formatter.js";
|
|
4
|
+
import { C as ColumnPointsGroupFormatter } from "./ColumnPointsGroupFormatter.js";
|
|
4
5
|
import { g as getFormatPoints } from "../../../formatters/PointsFormatter/PointsFormatter.js";
|
|
5
6
|
import { g as getColumnKey } from "../../helpers/shared/getColumnKey/getColumnKey.js";
|
|
6
7
|
const getCustomPointsFilter = (props) => {
|
|
@@ -36,6 +37,7 @@ const useColumnPoints = (props) => {
|
|
|
36
37
|
}, [props]);
|
|
37
38
|
return useMemo(() => ({
|
|
38
39
|
formatter: ColumnPointsFormatter(stateProps),
|
|
40
|
+
renderGroupCell: ColumnPointsGroupFormatter(stateProps),
|
|
39
41
|
customFilter: getCustomPointsFilter(stateProps),
|
|
40
42
|
customSort: getCustomPointsSort(stateProps)
|
|
41
43
|
}), [stateProps]);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ColumnPriceFormatterProps } from './types';
|
|
2
|
+
import { RenderGroupCellProps } from 'react-data-grid';
|
|
3
|
+
/**
|
|
4
|
+
* Formatter para mostrar un precio en filas de grupo (TreeDataGrid).
|
|
5
|
+
*
|
|
6
|
+
* Esta función es utilizada cuando el TreeDataGrid agrupa filas y necesita
|
|
7
|
+
* mostrar un precio 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 precio
|
|
11
|
+
* - Component: Componente wrapper opcional
|
|
12
|
+
* @returns Función que recibe RenderGroupCellProps y retorna el PriceFormatter
|
|
13
|
+
*/
|
|
14
|
+
export declare const ColumnPriceGroupFormatter: <TRow>(props: ColumnPriceFormatterProps<TRow>) => (groupProps: RenderGroupCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { P as PriceFormatter } from "../../../formatters/PriceFormatter/PriceFormatter.js";
|
|
4
|
+
const ColumnPriceGroupFormatter = (props) => {
|
|
5
|
+
const { Component = React.Fragment } = props;
|
|
6
|
+
const fieldValue = props.fieldValue;
|
|
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
|
+
return /* @__PURE__ */ jsx(
|
|
14
|
+
PriceFormatter,
|
|
15
|
+
{
|
|
16
|
+
obProps: representativeRow,
|
|
17
|
+
...props,
|
|
18
|
+
fieldValue,
|
|
19
|
+
Component
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
ColumnPriceGroupFormatter as C
|
|
26
|
+
};
|
|
@@ -5,6 +5,7 @@ import { ColumnPriceFormatterProps } from './types';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const useColumnPrice: <TRow>(props: ColumnPriceFormatterProps<TRow>) => {
|
|
7
7
|
formatter: (formatterProps: import('react-data-grid').RenderCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
renderGroupCell: (groupProps: import('react-data-grid').RenderGroupCellProps<TRow, unknown>) => import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
customFilter: (row: TRow, value: string) => boolean;
|
|
9
10
|
customSort: (a: TRow, b: TRow) => 0 | 1 | -1;
|
|
10
11
|
};
|
|
@@ -3,6 +3,7 @@ import { useFormatter } from "@m4l/graphics";
|
|
|
3
3
|
import { getPropertyByString } from "@m4l/core";
|
|
4
4
|
import { deepEqual } from "fast-equals";
|
|
5
5
|
import { g as getFormatPrice } from "../../../formatters/PriceFormatter/PriceFormatter.js";
|
|
6
|
+
import { C as ColumnPriceGroupFormatter } from "./ColumnPriceGroupFormatter.js";
|
|
6
7
|
import { C as ColumnPriceFormatter } from "./formatter.js";
|
|
7
8
|
import { g as getColumnKey } from "../../helpers/shared/getColumnKey/getColumnKey.js";
|
|
8
9
|
const getCustomPriceFilter = (props) => {
|
|
@@ -51,6 +52,7 @@ const useColumnPrice = (props) => {
|
|
|
51
52
|
}, [props]);
|
|
52
53
|
return useMemo(() => ({
|
|
53
54
|
formatter: ColumnPriceFormatter(stateProps),
|
|
55
|
+
renderGroupCell: ColumnPriceGroupFormatter(stateProps),
|
|
54
56
|
customFilter,
|
|
55
57
|
customSort: getCustomPriceSort(stateProps)
|
|
56
58
|
}), [stateProps, customFilter]);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ColumnTagsFormatterProps } from './types';
|
|
2
|
+
import { RenderGroupCellProps } from 'react-data-grid';
|
|
3
|
+
/**
|
|
4
|
+
* Formatter para mostrar tags en filas de grupo (TreeDataGrid).
|
|
5
|
+
*
|
|
6
|
+
* Esta función es utilizada cuando el TreeDataGrid agrupa filas y necesita
|
|
7
|
+
* mostrar tags 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 los tags
|
|
11
|
+
* @returns Función que recibe RenderGroupCellProps y retorna el TagsFormatter
|
|
12
|
+
*/
|
|
13
|
+
export declare const ColumnTagsGroupFormatter: <TRow>(props: ColumnTagsFormatterProps<TRow>) => (groupProps: RenderGroupCellProps<TRow>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { getPropertyByString } from "@m4l/core";
|
|
3
|
+
import { T as TagsFormatter } from "../../../formatters/TagsFormatter/TagsFormatter.js";
|
|
4
|
+
const ColumnTagsGroupFormatter = (props) => {
|
|
5
|
+
const { fieldValue } = 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 tags = getPropertyByString(
|
|
13
|
+
representativeRow,
|
|
14
|
+
fieldValue.toString()
|
|
15
|
+
);
|
|
16
|
+
return /* @__PURE__ */ jsx(TagsFormatter, { tags });
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
ColumnTagsGroupFormatter as C
|
|
21
|
+
};
|
|
@@ -4,6 +4,7 @@ import { ColumnTagsFormatterProps } from './types';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const useColumnTags: <TRow>(props: ColumnTagsFormatterProps<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 { C as ColumnTagsFormatter } from "./formatter.js";
|
|
3
|
+
import { C as ColumnTagsGroupFormatter } from "./ColumnTagsGroupFormatter.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";
|
|
@@ -49,6 +50,7 @@ const useColumnTags = (props) => {
|
|
|
49
50
|
return useMemo(
|
|
50
51
|
() => ({
|
|
51
52
|
formatter: ColumnTagsFormatter(stateProps),
|
|
53
|
+
renderGroupCell: ColumnTagsGroupFormatter(stateProps),
|
|
52
54
|
customFilter: getCustomTagFilter(stateProps),
|
|
53
55
|
customSort: getCustomTagSort(stateProps)
|
|
54
56
|
}),
|