@m4l/components 9.4.6-BE20260109-beta.2 → 9.4.6-BE20260120
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/@types/types.d.ts +17 -18
- package/components/AccountPopover/slots/AccountPopoverSlots.d.ts +3 -3
- package/components/ActionsGroup/slots/ActionsGroupSlots.d.ts +1 -1
- package/components/CheckableList/CheckableList.js +46 -23
- package/components/CheckableList/CheckableList.test.d.ts +1 -0
- package/components/CheckableList/dictionary.d.ts +1 -0
- package/components/CheckableList/hooks/useCheckableListHandlers.test.d.ts +1 -0
- package/components/CheckableList/hooks/useCheckableListItems.js +8 -6
- package/components/CheckableList/hooks/useCheckableListItems.test.d.ts +1 -0
- package/components/CheckableList/hooks/useCheckableListRender.js +44 -29
- package/components/CheckableList/hooks/useCheckableListRender.test.d.ts +1 -0
- package/components/CheckableList/hooks/useCheckableListSelection.test.d.ts +1 -0
- package/components/CheckableList/hooks/useCheckableListState.test.d.ts +1 -0
- package/components/CheckableList/hooks/useCheckableListVirtualization.test.d.ts +1 -0
- package/components/CheckableList/slots/styled.d.ts +4 -4
- package/components/Chip/slots/ChipSlots.d.ts +1 -1
- package/components/CommonActions/components/ActionFormSubmitProgrammatic/ActionFormSubmitProgrammatic.d.ts +34 -0
- package/components/CommonActions/components/ActionFormSubmitProgrammatic/ActionFormSubmitProgrammatic.js +46 -0
- package/components/CommonActions/components/ActionFormSubmitProgrammatic/ActionFormSubmitProgrammatic.styles.d.ts +2 -0
- package/components/CommonActions/components/ActionFormSubmitProgrammatic/ActionFormSubmitProgrammatic.styles.js +7 -0
- package/components/CommonActions/components/ActionFormSubmitProgrammatic/constanst.d.ts +6 -0
- package/components/CommonActions/components/ActionFormSubmitProgrammatic/constanst.js +7 -0
- package/components/CommonActions/components/ActionFormSubmitProgrammatic/index.d.ts +2 -0
- package/components/CommonActions/components/ActionFormSubmitProgrammatic/slots/ActionFormSubmitProgrammaticEnum.d.ts +3 -0
- package/components/CommonActions/components/ActionFormSubmitProgrammatic/slots/ActionFormSubmitProgrammaticEnum.js +7 -0
- package/components/CommonActions/components/ActionFormSubmitProgrammatic/slots/ActionFormSubmitProgrammaticSlots.d.ts +1 -0
- package/components/CommonActions/components/ActionFormSubmitProgrammatic/slots/ActionFormSubmitProgrammaticSlots.js +12 -0
- package/components/CommonActions/components/ActionFormSubmitProgrammatic/slots/index.d.ts +2 -0
- package/components/CommonActions/components/ActionFormSubmitProgrammatic/slots/index.js +1 -0
- package/components/CommonActions/components/ActionFormSubmitProgrammatic/types.d.ts +36 -0
- package/components/CommonActions/index.d.ts +1 -0
- package/components/DynamicFilter/subcomponents/PopoverFilter/PopoverFilter.js +7 -27
- package/components/DynamicFilter/subcomponents/PopoverMenuFields/PopoverMenuFields.js +3 -5
- package/components/DynamicSort/subcomponents/PopoverMenuFields/PopoverMenuFields.js +3 -5
- package/components/DynamicSort/subcomponents/PopoverSort/PopoverSort.js +7 -31
- package/components/EditLabel/slots/EditLabelSlots.d.ts +1 -1
- package/components/HelperError/slots/HelperErrorSlots.d.ts +1 -1
- package/components/ImageText/slots/ImageTextSlots.d.ts +2 -2
- package/components/Label/slots/LabelSlots.d.ts +2 -2
- package/components/LoadingError/slots/LoadingErrorSlots.d.ts +1 -1
- package/components/MFIsolationApp/slots/MFIsolationAppSlots.d.ts +2 -2
- package/components/ObjectLogs/slots/ObjectLogsSlots.d.ts +1 -1
- 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 +1 -1
- 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/subcomponents/ContentComponent/style.js +15 -2
- 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 +2 -2
- package/components/WindowBase/slots/WindowBaseSlots.d.ts +2 -2
- package/components/areas/components/AreasAdmin/slots/AreasAdminSlots.d.ts +1 -1
- package/components/areas/contexts/AreasContext/store.js +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 -11
- 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/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/RHFUpload/RHFUploadImage/slots/RHFUploadImageSlots.d.ts +1 -1
- package/components/hook-form/RHFUpload/RHFUploadSingleFile/slots/RHFUploadSingleFileSlots.d.ts +5 -5
- package/components/mui_extended/Accordion/slots/AccordionSlots.d.ts +1 -1
- package/components/mui_extended/Autocomplete/Autocomplete.js +7 -3
- package/components/mui_extended/Autocomplete/Autocomplete.styles.js +76 -45
- package/components/mui_extended/Autocomplete/constants.d.ts +23 -0
- package/components/mui_extended/Autocomplete/constants.js +9 -1
- package/components/mui_extended/Autocomplete/hooks/useAutocomplete/useAutocomplete.js +9 -4
- package/components/mui_extended/Autocomplete/hooks/useEndAdornments.d.ts +5 -1
- package/components/mui_extended/Autocomplete/hooks/useEndAdornments.js +42 -10
- package/components/mui_extended/Autocomplete/hooks/useMultipleChips.js +25 -6
- package/components/mui_extended/Autocomplete/slots/AutocompleteEnum.d.ts +6 -1
- package/components/mui_extended/Autocomplete/slots/AutocompleteEnum.js +8 -1
- package/components/mui_extended/Autocomplete/slots/AutocompleteSlots.d.ts +5 -2
- package/components/mui_extended/Autocomplete/slots/AutocompleteSlots.js +9 -4
- package/components/mui_extended/Autocomplete/subcomponents/renderOptions/index.js +4 -3
- package/components/mui_extended/Autocomplete/types.d.ts +9 -2
- package/components/mui_extended/Button/slots/ButtonSlots.d.ts +1 -1
- package/components/mui_extended/CheckBox/slots/CheckBoxSlots.d.ts +1 -1
- package/components/mui_extended/MenuItem/MenuItem.js +13 -15
- package/components/mui_extended/MenuItem/MenuItem.styles.js +33 -46
- package/components/mui_extended/MenuItem/constants.d.ts +1 -1
- package/components/mui_extended/MenuItem/slots/MenuItemEnum.d.ts +0 -1
- package/components/mui_extended/MenuItem/slots/MenuItemEnum.js +0 -1
- package/components/mui_extended/MenuItem/slots/MenuItemSlots.d.ts +2 -5
- package/components/mui_extended/MenuItem/slots/MenuItemSlots.js +1 -6
- package/components/mui_extended/NavLink/slots/NavLinkSlots.d.ts +1 -1
- package/components/mui_extended/Radio/slots/styled.d.ts +1 -1
- package/components/mui_extended/Select/Select.js +1 -1
- package/components/mui_extended/Select/slots/SelectSlots.d.ts +3 -3
- package/components/mui_extended/Tab/Slots/TabSlots.d.ts +1 -1
- package/components/mui_extended/TextField/slots/TextFieldSlots.d.ts +3 -3
- package/components/mui_extended/Typography/slots/typographySlots.d.ts +1 -1
- package/hooks/useDynamicFilterAndSort/slots/DynamicFilterAndSortSlots.d.ts +3 -3
- package/hooks/usePopoverContainer/usePopoverContainer.d.ts +1 -1
- package/hooks/usePopoverContainer/usePopoverContainer.js +10 -10
- package/index.js +116 -88
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -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
|
+
};
|