@wavemaker-ai/react-runtime 1.0.0-rc.322 → 1.0.0-rc.326
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/actions/login-action.js +1 -1
- package/components/advanced/carousel/index.d.ts +1 -0
- package/components/advanced/carousel/template.d.ts +1 -0
- package/components/advanced/login/index.d.ts +1 -0
- package/components/advanced/marquee/index.d.ts +1 -0
- package/components/basic/anchor/index.d.ts +1 -0
- package/components/basic/anchor/index.js +19 -14
- package/components/basic/audio/index.d.ts +1 -0
- package/components/basic/html/index.d.ts +1 -0
- package/components/basic/icon/index.d.ts +1 -0
- package/components/basic/icon/index.js +13 -16
- package/components/basic/iframe/index.d.ts +1 -0
- package/components/basic/label/index.d.ts +1 -0
- package/components/basic/label/index.js +5 -3
- package/components/basic/label/props.d.ts +1 -1
- package/components/basic/picture/index.d.ts +1 -0
- package/components/basic/picture/index.js +3 -2
- package/components/basic/progress-bar/index.d.ts +1 -0
- package/components/basic/progress-circle/index.d.ts +1 -0
- package/components/basic/richtexteditor/index.d.ts +2 -0
- package/components/basic/search/index.d.ts +6 -0
- package/components/basic/search/index.js +69 -9
- package/components/basic/search/props.d.ts +4 -0
- package/components/basic/spinner/index.d.ts +2 -0
- package/components/basic/spinner/index.js +11 -9
- package/components/basic/spinner/props.d.ts +5 -0
- package/components/basic/tile/index.d.ts +1 -0
- package/components/basic/tree/index.d.ts +1 -0
- package/components/basic/video/index.d.ts +1 -0
- package/components/chart/index.d.ts +2 -0
- package/components/chart/props.d.ts +1 -0
- package/components/chart/src/chart.js +12 -1
- package/components/chart/src/types.d.ts +2 -0
- package/components/common/WmAppIcon/index.d.ts +15 -0
- package/components/common/WmAppIcon/index.js +130 -0
- package/components/common/WmAppIcon/props.d.ts +17 -0
- package/components/common/WmAppIcon/props.js +0 -0
- package/components/common/index.d.ts +3 -1
- package/components/common/index.js +10 -2
- package/components/common/wm-skeleton.d.ts +7 -0
- package/components/common/wm-skeleton.js +11 -1
- package/components/container/accordion/accordion-pane/index.d.ts +2 -0
- package/components/container/accordion/accordion-pane/index.js +10 -1
- package/components/container/accordion/accordion-pane/props.d.ts +1 -0
- package/components/container/accordion/index.d.ts +1 -0
- package/components/container/accordion/index.js +2 -2
- package/components/container/index.d.ts +1 -0
- package/components/container/index.js +6 -1
- package/components/container/layout-grid/grid-column/index.d.ts +1 -0
- package/components/container/layout-grid/grid-row/index.d.ts +1 -0
- package/components/container/layout-grid/grid-row/index.js +1 -1
- package/components/container/layout-grid/index.d.ts +1 -0
- package/components/container/linear-layout/index.d.ts +1 -0
- package/components/container/linear-layout/linear-layout-item/index.d.ts +1 -0
- package/components/container/panel/components/panel-header/index.js +16 -16
- package/components/container/panel/index.d.ts +1 -0
- package/components/container/repeat-template/index.d.ts +1 -0
- package/components/container/tabs/index.d.ts +1 -0
- package/components/container/tabs/index.js +18 -18
- package/components/container/tabs/props.d.ts +1 -0
- package/components/container/tabs/tab-pane/index.d.ts +2 -0
- package/components/container/tabs/tab-pane/index.js +2 -0
- package/components/container/tabs/tab-pane/props.d.ts +1 -0
- package/components/container/wizard/components/StepComponents.js +14 -6
- package/components/container/wizard/index.d.ts +2 -0
- package/components/container/wizard/index.js +2 -2
- package/components/container/wizard/props.d.ts +4 -0
- package/components/container/wizard/wizard-step/index.d.ts +1 -0
- package/components/container/wizard/wizard-step/index.js +6 -0
- package/components/data/card/card-actions/index.d.ts +1 -0
- package/components/data/card/card-content/index.d.ts +1 -0
- package/components/data/card/card-footer/index.d.ts +1 -0
- package/components/data/card/index.d.ts +1 -0
- package/components/data/card/index.js +13 -6
- package/components/data/form/base-form/hooks/useFormSubmission.d.ts +1 -1
- package/components/data/form/base-form/hooks/useFormSubmission.js +3 -1
- package/components/data/form/base-form/index.js +11 -14
- package/components/data/form/base-form/props.d.ts +3 -0
- package/components/data/form/dynamic-fields/index.js +1 -0
- package/components/data/form/form-action/index.d.ts +2 -0
- package/components/data/form/form-action/index.js +6 -4
- package/components/data/form/form-controller/withFormController.js +19 -2
- package/components/data/form/form-field/base-field.js +8 -5
- package/components/data/form/form-field/index.js +14 -9
- package/components/data/form/form-field/props.d.ts +1 -0
- package/components/data/form/form-header/index.d.ts +1 -1
- package/components/data/form/form-header/index.js +10 -1
- package/components/data/form/index.js +5 -3
- package/components/data/form/props.d.ts +1 -0
- package/components/data/list/components/ListHeader.js +19 -3
- package/components/data/list/components/ListItemWithTemplate.js +10 -3
- package/components/data/list/components/ListItems.d.ts +1 -1
- package/components/data/list/components/ListItems.js +5 -1
- package/components/data/list/components/LoadMoreButton.js +14 -2
- package/components/data/list/components/StandardListItems.js +1 -1
- package/components/data/list/components/props.d.ts +11 -5
- package/components/data/list/hooks/props.d.ts +2 -2
- package/components/data/list/hooks/useListEffects.js +1 -1
- package/components/data/list/hooks/useListEventHandlers.js +3 -2
- package/components/data/list/index.d.ts +5 -1
- package/components/data/list/index.js +28 -7
- package/components/data/list/props.d.ts +14 -2
- package/components/data/list/utils/constants.d.ts +0 -1
- package/components/data/list/utils/constants.js +0 -2
- package/components/data/list/utils/list-helpers.d.ts +5 -1
- package/components/data/list/utils/list-helpers.js +10 -0
- package/components/data/pagination/components/PageSizeSelector.js +49 -155
- package/components/data/pagination/hooks/usePagination.js +24 -1
- package/components/data/table/components/RowCells.js +18 -4
- package/components/data/table/components/TableBody.js +5 -3
- package/components/data/table/components/TableDataRow.js +16 -3
- package/components/data/table/components/TableHeader.js +10 -8
- package/components/data/table/components/TablePanelHeading.js +15 -3
- package/components/data/table/hooks/useDynamicColumns.js +1 -1
- package/components/data/table/hooks/useResponsiveColumns.d.ts +1 -0
- package/components/data/table/hooks/useRowExpansion.js +41 -31
- package/components/data/table/hooks/useRowHandlers.js +0 -1
- package/components/data/table/hooks/useServerSideSorting.js +0 -1
- package/components/data/table/hooks/useTableColumns.js +17 -9
- package/components/data/table/hooks/useTableData.js +30 -2
- package/components/data/table/hooks/useTableEdit.js +0 -1
- package/components/data/table/index.d.ts +4 -0
- package/components/data/table/index.js +93 -47
- package/components/data/table/live-table/index.d.ts +1 -0
- package/components/data/table/live-table/index.js +0 -1
- package/components/data/table/props.d.ts +15 -2
- package/components/data/table/table-action/index.d.ts +1 -0
- package/components/data/table/table-column/index.d.ts +1 -0
- package/components/data/table/table-row/index.d.ts +1 -0
- package/components/data/table/table-row-action/index.d.ts +1 -0
- package/components/data/table/utils/buildSelectionColumns.d.ts +1 -1
- package/components/data/table/utils/buildSelectionColumns.js +95 -71
- package/components/data/table/utils/columnBuilder.d.ts +29 -2
- package/components/data/table/utils/columnBuilder.js +40 -26
- package/components/data/table/utils/columnWidthDistribution.d.ts +1 -1
- package/components/data/table/utils/columnWidthDistribution.js +14 -1
- package/components/data/table/utils/constants.d.ts +0 -4
- package/components/data/table/utils/constants.js +0 -7
- package/components/data/table/utils/dynamic-columns.d.ts +1 -1
- package/components/data/table/utils/dynamic-columns.js +3 -8
- package/components/data/table/utils/expansionColumn.d.ts +23 -0
- package/components/data/table/utils/expansionColumn.js +56 -0
- package/components/data/table/utils/index.d.ts +14 -2
- package/components/data/table/utils/index.js +45 -19
- package/components/dialogs/alert-dialog/index.d.ts +2 -0
- package/components/dialogs/confirm-dialog/index.d.ts +2 -0
- package/components/dialogs/dialog/index.d.ts +2 -0
- package/components/dialogs/dialog/index.js +3 -2
- package/components/dialogs/dialog-actions/index.d.ts +1 -0
- package/components/dialogs/dialog-body/index.d.ts +1 -0
- package/components/dialogs/dialog-content/index.d.ts +1 -0
- package/components/dialogs/dialog-header/index.d.ts +1 -0
- package/components/dialogs/dialog-header/index.js +11 -12
- package/components/dialogs/iframe-dialog/index.d.ts +2 -0
- package/components/dialogs/login-dialog/index.d.ts +4 -0
- package/components/dialogs/login-dialog/index.js +2 -1
- package/components/dialogs/login-dialog/props.d.ts +1 -0
- package/components/dialogs/page-dialog/index.d.ts +4 -0
- package/components/dialogs/page-dialog/index.js +2 -1
- package/components/dialogs/page-dialog/props.d.ts +1 -0
- package/components/form/button/index.d.ts +1 -0
- package/components/form/button/index.js +29 -33
- package/components/form/button-group/index.d.ts +1 -0
- package/components/input/calendar/index.d.ts +2 -0
- package/components/input/chips/index.d.ts +2 -0
- package/components/input/chips/index.js +9 -3
- package/components/input/chips/utils.d.ts +5 -0
- package/components/input/chips/utils.js +29 -0
- package/components/input/color-picker/index.d.ts +2 -0
- package/components/input/composite/index.d.ts +1 -0
- package/components/input/composite/index.js +1 -0
- package/components/input/currency/index.d.ts +2 -0
- package/components/input/default/checkbox/index.d.ts +6 -0
- package/components/input/default/checkbox/index.js +48 -18
- package/components/input/default/checkbox/props.d.ts +8 -0
- package/components/input/default/checkboxset/index.d.ts +2 -0
- package/components/input/default/radioset/index.d.ts +2 -0
- package/components/input/default/radioset/index.js +2 -1
- package/components/input/default/switch/index.d.ts +6 -0
- package/components/input/default/switch/index.js +36 -9
- package/components/input/default/switch/prop.d.ts +2 -0
- package/components/input/epoch/date/index.d.ts +1 -0
- package/components/input/epoch/datetime/index.d.ts +1 -0
- package/components/input/epoch/time/index.d.ts +1 -0
- package/components/input/fileupload/components/ListItems.d.ts +5 -1
- package/components/input/fileupload/components/ListItems.js +27 -5
- package/components/input/fileupload/components/MultiUpload.js +12 -1
- package/components/input/fileupload/components/SingleUpload.js +12 -1
- package/components/input/fileupload/index.d.ts +3 -0
- package/components/input/fileupload/index.js +11 -0
- package/components/input/fileupload/props.d.ts +10 -0
- package/components/input/number/index.d.ts +2 -0
- package/components/input/rating/index.d.ts +6 -0
- package/components/input/rating/index.js +10 -5
- package/components/input/rating/props.d.ts +8 -0
- package/components/input/select/index.d.ts +2 -0
- package/components/input/select/index.js +1 -2
- package/components/input/slider/index.d.ts +6 -0
- package/components/input/slider/index.js +19 -2
- package/components/input/slider/props.d.ts +2 -0
- package/components/input/text/index.d.ts +7 -1
- package/components/input/text/index.js +25 -6
- package/components/input/text/props.d.ts +8 -0
- package/components/input/textarea/index.d.ts +2 -0
- package/components/input/textarea/index.js +10 -5
- package/components/input/textarea/util.d.ts +1 -0
- package/components/input/textarea/util.js +17 -0
- package/components/input/upload/index.d.ts +2 -0
- package/components/navbar/index.d.ts +7 -0
- package/components/navbar/index.js +21 -7
- package/components/navbar/nav/index.d.ts +1 -0
- package/components/navbar/nav-item/index.d.ts +1 -0
- package/components/navigation/breadcrumb/index.d.ts +1 -0
- package/components/navigation/menu/index.d.ts +3 -1
- package/components/navigation/menu/index.js +22 -4
- package/components/navigation/menu/props.d.ts +1 -0
- package/components/navigation/popover/index.d.ts +1 -0
- package/components/navigation/popover/index.js +23 -9
- package/components/page/index.js +1 -1
- package/components/page/page-content/index.js +6 -2
- package/components/page/partial/index.d.ts +1 -0
- package/components/page/partial-container/index.js +2 -1
- package/components/prefab/index.js +3 -2
- package/components/prefab/props.d.ts +1 -0
- package/context/WidgetProvider.js +2 -1
- package/core/appstore.d.ts +10 -0
- package/core/appstore.js +9 -1
- package/core/constants/events.d.ts +3 -0
- package/core/constants/events.js +13 -1
- package/core/proxy-service.d.ts +1 -0
- package/core/proxy-service.js +54 -3
- package/core/util/index.d.ts +2 -0
- package/core/util/index.js +32 -1
- package/higherOrder/BasePage.js +106 -30
- package/higherOrder/props.d.ts +1 -0
- package/higherOrder/useActivePageReactivity.d.ts +21 -0
- package/higherOrder/useActivePageReactivity.js +57 -0
- package/higherOrder/withBaseWrapper.js +11 -7
- package/higherOrder/withRenderLogger.d.ts +15 -0
- package/higherOrder/withRenderLogger.js +53 -0
- package/hooks/useAuth.js +7 -1
- package/package-lock.json +273 -263
- package/package.json +4 -3
- package/runtime-dynamic/components/partial-content.js +3 -1
- package/runtime-dynamic/factories/dynamic-component.js +44 -8
- package/runtime-dynamic/factories/utils.js +7 -1
- package/runtime-dynamic/services/compile-render.js +2 -1
- package/runtime-dynamic/services/css-scoping.d.ts +2 -0
- package/runtime-dynamic/services/css-scoping.js +39 -20
- package/store/slices/i18nSlice.d.ts +2 -0
- package/store/slices/i18nSlice.js +3 -1
- package/types/index.d.ts +6 -0
- package/utils/attr.js +4 -1
- package/utils/custom-expression/parser.js +11 -8
- package/utils/svg-icon.d.ts +27 -0
- package/utils/svg-icon.js +75 -0
- package/utils/transformedDataset-utils.d.ts +3 -3
- package/utils/transformedDataset-utils.js +1 -2
|
@@ -121,6 +121,10 @@ export interface TableProps {
|
|
|
121
121
|
* CSS class for the table icon.
|
|
122
122
|
*/
|
|
123
123
|
iconclass?: string;
|
|
124
|
+
/**
|
|
125
|
+
* URL for the table icon (.svg renders inline, other URLs as image).
|
|
126
|
+
*/
|
|
127
|
+
iconurl?: string;
|
|
124
128
|
/**
|
|
125
129
|
* The collection of data items to display in the table.
|
|
126
130
|
*/
|
|
@@ -748,6 +752,10 @@ export interface TableRowProps {
|
|
|
748
752
|
* Rendering function for content.
|
|
749
753
|
*/
|
|
750
754
|
renderPartial?: (props: Record<string, any>, onLoad: () => void, currentItem: any) => ReactNode;
|
|
755
|
+
/**
|
|
756
|
+
* Per-row callback from codegen for row-bound attrs (e.g. show, disabled).
|
|
757
|
+
*/
|
|
758
|
+
tableRowProps?: (rowData: any) => Partial<TableRowProps>;
|
|
751
759
|
/**
|
|
752
760
|
* Children components.
|
|
753
761
|
*/
|
|
@@ -885,6 +893,8 @@ export interface TablePanelHeadingProps {
|
|
|
885
893
|
title?: string;
|
|
886
894
|
subheading?: string;
|
|
887
895
|
iconclass?: string;
|
|
896
|
+
iconurl?: string;
|
|
897
|
+
prefabName?: string;
|
|
888
898
|
exportformat?: any[];
|
|
889
899
|
headerActions: any[];
|
|
890
900
|
spacing?: TablePanelSpacing;
|
|
@@ -930,11 +940,13 @@ export interface ActionButtonConfig {
|
|
|
930
940
|
export interface BuildSelectionColumnsProps {
|
|
931
941
|
useRadioSelect: boolean;
|
|
932
942
|
useMultiSelect: boolean;
|
|
933
|
-
|
|
943
|
+
/** @deprecated Header now reads from table.getIsAllRowsSelected() — no longer used internally. */
|
|
944
|
+
selectedRowIds?: string[];
|
|
934
945
|
handleRadioSelection: (rowId: string, rowData?: any) => void;
|
|
935
946
|
handleMultiSelection: (rowId: string, rowData: any, isSelected: boolean) => void;
|
|
936
947
|
handleSelectAll: (isSelected: boolean) => void;
|
|
937
|
-
|
|
948
|
+
/** @deprecated Header now reads from table.getIsAllRowsSelected() — no longer used internally. */
|
|
949
|
+
internalDataset?: any[];
|
|
938
950
|
radioselecttitle?: string;
|
|
939
951
|
radioselectarialabel?: string;
|
|
940
952
|
multiselecttitle?: string;
|
|
@@ -1068,6 +1080,7 @@ export interface UsePanelStructureProps {
|
|
|
1068
1080
|
title?: string;
|
|
1069
1081
|
subheading?: string;
|
|
1070
1082
|
iconclass?: string;
|
|
1083
|
+
iconurl?: string;
|
|
1071
1084
|
exportformat?: any[];
|
|
1072
1085
|
headerActions: any[];
|
|
1073
1086
|
footerActions: any[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ColumnDef } from "@tanstack/react-table";
|
|
2
2
|
import { BuildSelectionColumnsProps } from "../props";
|
|
3
|
-
export declare const buildSelectionColumns: ({ useRadioSelect, useMultiSelect,
|
|
3
|
+
export declare const buildSelectionColumns: ({ useRadioSelect, useMultiSelect, handleRadioSelection, handleMultiSelection, handleSelectAll, radioselecttitle, radioselectarialabel, multiselecttitle, multiselectarialabel, tableName, }: BuildSelectionColumnsProps) => ColumnDef<any> | null;
|
|
@@ -1,49 +1,114 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Radio, Checkbox, FormControlLabel, Tooltip } from "@mui/material";
|
|
3
3
|
import { TABLE_MESSAGES } from "./constants";
|
|
4
|
+
const getSelectionMeta = (ctx) => {
|
|
5
|
+
var _a, _b, _c, _d;
|
|
6
|
+
return (_d = (_c = (_b = (_a = ctx.column) == null ? void 0 : _a.columnDef) == null ? void 0 : _b.meta) == null ? void 0 : _c.selection) != null ? _d : {};
|
|
7
|
+
};
|
|
8
|
+
function RadioSelectCell(ctx) {
|
|
9
|
+
const { row } = ctx;
|
|
10
|
+
const rowId = row.id;
|
|
11
|
+
const isSelected = row.getIsSelected();
|
|
12
|
+
const { handleRadioSelection, radioselecttitle, radioselectarialabel, tableName } = getSelectionMeta(ctx);
|
|
13
|
+
return /* @__PURE__ */ jsx(Box, { sx: { display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ jsx(Tooltip, { title: radioselecttitle != null ? radioselecttitle : "", placement: "top", children: /* @__PURE__ */ jsx(Box, { className: "radio app-radio", children: /* @__PURE__ */ jsx(
|
|
14
|
+
FormControlLabel,
|
|
15
|
+
{
|
|
16
|
+
control: /* @__PURE__ */ jsx(
|
|
17
|
+
Radio,
|
|
18
|
+
{
|
|
19
|
+
checked: isSelected,
|
|
20
|
+
onChange: () => handleRadioSelection == null ? void 0 : handleRadioSelection(rowId, row.original),
|
|
21
|
+
value: rowId,
|
|
22
|
+
name: `wmRadioselect-${tableName != null ? tableName : "table"}`,
|
|
23
|
+
inputProps: {
|
|
24
|
+
"aria-label": radioselectarialabel
|
|
25
|
+
},
|
|
26
|
+
rowselectinput: "",
|
|
27
|
+
size: "small"
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
label: "",
|
|
31
|
+
className: "caption"
|
|
32
|
+
}
|
|
33
|
+
) }) }) });
|
|
34
|
+
}
|
|
35
|
+
RadioSelectCell.displayName = "RadioSelectCell";
|
|
36
|
+
function MultiSelectCell(ctx) {
|
|
37
|
+
const { row } = ctx;
|
|
38
|
+
const rowId = row.id;
|
|
39
|
+
const isSelected = row.getIsSelected();
|
|
40
|
+
const { handleMultiSelection, multiselecttitle, multiselectarialabel } = getSelectionMeta(ctx);
|
|
41
|
+
return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", justifyContent: "center" }, children: [
|
|
42
|
+
/* @__PURE__ */ jsx(Tooltip, { title: multiselecttitle != null ? multiselecttitle : "", placement: "top", children: /* @__PURE__ */ jsx(Box, { className: "app-checkbox checkbox", children: /* @__PURE__ */ jsx(
|
|
43
|
+
Checkbox,
|
|
44
|
+
{
|
|
45
|
+
checked: isSelected,
|
|
46
|
+
onChange: (e) => handleMultiSelection == null ? void 0 : handleMultiSelection(rowId, row.original, e.target.checked),
|
|
47
|
+
value: rowId,
|
|
48
|
+
name: "gridMultiSelect",
|
|
49
|
+
inputProps: {
|
|
50
|
+
"aria-label": multiselectarialabel,
|
|
51
|
+
role: "checkbox",
|
|
52
|
+
"aria-live": "assertive"
|
|
53
|
+
},
|
|
54
|
+
size: "small",
|
|
55
|
+
sx: {
|
|
56
|
+
padding: 0
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
) }) }),
|
|
60
|
+
isSelected ? /* @__PURE__ */ jsx("span", { className: "sr-only", "aria-live": "assertive", children: "Row Selected" }) : /* @__PURE__ */ jsx("span", { className: "sr-only", "aria-live": "assertive", children: "Row Deselected" })
|
|
61
|
+
] });
|
|
62
|
+
}
|
|
63
|
+
MultiSelectCell.displayName = "MultiSelectCell";
|
|
64
|
+
function MultiSelectHeader({ table, column }) {
|
|
65
|
+
var _a, _b;
|
|
66
|
+
const isAllSelected = table.getIsAllRowsSelected();
|
|
67
|
+
const { handleSelectAll } = (_b = (_a = column.columnDef.meta) == null ? void 0 : _a.selection) != null ? _b : {};
|
|
68
|
+
return /* @__PURE__ */ jsx(Box, { sx: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx(Box, { className: "app-checkbox checkbox", children: /* @__PURE__ */ jsx(
|
|
69
|
+
Checkbox,
|
|
70
|
+
{
|
|
71
|
+
checked: isAllSelected,
|
|
72
|
+
onChange: (e) => handleSelectAll == null ? void 0 : handleSelectAll(e.target.checked),
|
|
73
|
+
size: "small",
|
|
74
|
+
inputProps: {
|
|
75
|
+
"aria-label": "Select all rows"
|
|
76
|
+
},
|
|
77
|
+
sx: {
|
|
78
|
+
padding: 0
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
) }) });
|
|
82
|
+
}
|
|
83
|
+
MultiSelectHeader.displayName = "MultiSelectHeader";
|
|
4
84
|
const buildSelectionColumns = ({
|
|
5
85
|
useRadioSelect,
|
|
6
86
|
useMultiSelect,
|
|
7
|
-
selectedRowIds,
|
|
8
87
|
handleRadioSelection,
|
|
9
88
|
handleMultiSelection,
|
|
10
89
|
handleSelectAll,
|
|
11
|
-
internalDataset,
|
|
12
90
|
radioselecttitle = "",
|
|
13
91
|
radioselectarialabel = TABLE_MESSAGES.radioSelectAriaLabel,
|
|
14
92
|
multiselecttitle = "",
|
|
15
93
|
multiselectarialabel = TABLE_MESSAGES.multiSelectAriaLabel,
|
|
16
94
|
tableName = "table"
|
|
17
95
|
}) => {
|
|
96
|
+
const selection = {
|
|
97
|
+
handleRadioSelection,
|
|
98
|
+
handleMultiSelection,
|
|
99
|
+
handleSelectAll,
|
|
100
|
+
radioselecttitle,
|
|
101
|
+
radioselectarialabel,
|
|
102
|
+
multiselecttitle,
|
|
103
|
+
multiselectarialabel,
|
|
104
|
+
tableName
|
|
105
|
+
};
|
|
18
106
|
if (useRadioSelect) {
|
|
19
107
|
return {
|
|
20
108
|
id: "radioSelect",
|
|
21
109
|
header: () => /* @__PURE__ */ jsx(Box, { sx: { display: "flex", justifyContent: "center" } }),
|
|
22
|
-
cell:
|
|
23
|
-
|
|
24
|
-
const isSelected = row.getIsSelected();
|
|
25
|
-
return /* @__PURE__ */ jsx(Box, { sx: { display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ jsx(Tooltip, { title: radioselecttitle, placement: "top", children: /* @__PURE__ */ jsx(Box, { className: "radio app-radio", children: /* @__PURE__ */ jsx(
|
|
26
|
-
FormControlLabel,
|
|
27
|
-
{
|
|
28
|
-
control: /* @__PURE__ */ jsx(
|
|
29
|
-
Radio,
|
|
30
|
-
{
|
|
31
|
-
checked: isSelected,
|
|
32
|
-
onChange: () => handleRadioSelection(rowId, row.original),
|
|
33
|
-
value: rowId,
|
|
34
|
-
name: `wmRadioselect-${tableName}`,
|
|
35
|
-
inputProps: {
|
|
36
|
-
"aria-label": radioselectarialabel
|
|
37
|
-
},
|
|
38
|
-
rowselectinput: "",
|
|
39
|
-
size: "small"
|
|
40
|
-
}
|
|
41
|
-
),
|
|
42
|
-
label: "",
|
|
43
|
-
className: "caption"
|
|
44
|
-
}
|
|
45
|
-
) }) }) });
|
|
46
|
-
},
|
|
110
|
+
cell: RadioSelectCell,
|
|
111
|
+
meta: { selection },
|
|
47
112
|
size: 40,
|
|
48
113
|
minSize: 40,
|
|
49
114
|
maxSize: 40,
|
|
@@ -53,50 +118,9 @@ const buildSelectionColumns = ({
|
|
|
53
118
|
if (useMultiSelect) {
|
|
54
119
|
return {
|
|
55
120
|
id: "multiSelect",
|
|
56
|
-
header:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return /* @__PURE__ */ jsx(Box, { sx: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx(Box, { className: "app-checkbox checkbox", children: /* @__PURE__ */ jsx(
|
|
60
|
-
Checkbox,
|
|
61
|
-
{
|
|
62
|
-
checked: isAllSelected,
|
|
63
|
-
indeterminate: false,
|
|
64
|
-
onChange: (e) => handleSelectAll(e.target.checked),
|
|
65
|
-
size: "small",
|
|
66
|
-
inputProps: {
|
|
67
|
-
"aria-label": "Select all rows"
|
|
68
|
-
},
|
|
69
|
-
sx: {
|
|
70
|
-
padding: 0
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
) }) });
|
|
74
|
-
},
|
|
75
|
-
cell: ({ row }) => {
|
|
76
|
-
const rowId = row.id;
|
|
77
|
-
const isSelected = row.getIsSelected();
|
|
78
|
-
return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", justifyContent: "center" }, children: [
|
|
79
|
-
/* @__PURE__ */ jsx(Tooltip, { title: multiselecttitle, placement: "top", children: /* @__PURE__ */ jsx(Box, { className: "app-checkbox checkbox", children: /* @__PURE__ */ jsx(
|
|
80
|
-
Checkbox,
|
|
81
|
-
{
|
|
82
|
-
checked: isSelected,
|
|
83
|
-
onChange: (e) => handleMultiSelection(rowId, row.original, e.target.checked),
|
|
84
|
-
value: rowId,
|
|
85
|
-
name: "gridMultiSelect",
|
|
86
|
-
inputProps: {
|
|
87
|
-
"aria-label": multiselectarialabel,
|
|
88
|
-
role: "checkbox",
|
|
89
|
-
"aria-live": "assertive"
|
|
90
|
-
},
|
|
91
|
-
size: "small",
|
|
92
|
-
sx: {
|
|
93
|
-
padding: 0
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
) }) }),
|
|
97
|
-
isSelected ? /* @__PURE__ */ jsx("span", { className: "sr-only", "aria-live": "assertive", children: "Row Selected" }) : /* @__PURE__ */ jsx("span", { className: "sr-only", "aria-live": "assertive", children: "Row Deselected" })
|
|
98
|
-
] });
|
|
99
|
-
},
|
|
121
|
+
header: MultiSelectHeader,
|
|
122
|
+
cell: MultiSelectCell,
|
|
123
|
+
meta: { selection },
|
|
100
124
|
size: 40,
|
|
101
125
|
minSize: 40,
|
|
102
126
|
maxSize: 40,
|
|
@@ -1,6 +1,33 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { ColumnDef } from "@tanstack/react-table";
|
|
1
|
+
import React, { type ReactElement } from "react";
|
|
2
|
+
import { ColumnDef, CellContext } from "@tanstack/react-table";
|
|
3
3
|
import { WmTableColumnProps, ActionButtonConfig } from "../props";
|
|
4
|
+
/**
|
|
5
|
+
* Per-column render config stored in `meta._cell`.
|
|
6
|
+
*
|
|
7
|
+
* Why nested under `_cell` instead of flat in `meta`:
|
|
8
|
+
* RowCells spreads `...otherMeta` into the TableCell `style` prop for WaveMaker style
|
|
9
|
+
* passthrough. Storing a function (`renderCell`) or a complex object (`wmColumn`) flat
|
|
10
|
+
* in meta would spread them into the DOM `style` attribute, producing React warnings.
|
|
11
|
+
* A single `_cell` key is destructured out in RowCells before the spread.
|
|
12
|
+
*/
|
|
13
|
+
export interface DataCellMeta {
|
|
14
|
+
wmColumn: WmTableColumnProps;
|
|
15
|
+
renderCell: (wmColumn: WmTableColumnProps, row: any) => React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
/** Actions-column render config stored in `meta._actions` (namespaced like `_cell`). */
|
|
18
|
+
export interface ActionCellMeta {
|
|
19
|
+
renderActionCell: (ctx: CellContext<any, unknown>) => React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Stable cell renderer for the actions column. Same motivation as DataCell: flexRender
|
|
23
|
+
* uses `cell` as the component TYPE, so a changing renderActionCell identity would
|
|
24
|
+
* unmount/remount the row action buttons. Read the renderer from `meta._actions` instead.
|
|
25
|
+
*/
|
|
26
|
+
declare function ActionCell(ctx: CellContext<any, unknown>): ReactElement;
|
|
27
|
+
declare namespace ActionCell {
|
|
28
|
+
var displayName: string;
|
|
29
|
+
}
|
|
30
|
+
export { ActionCell };
|
|
4
31
|
/**
|
|
5
32
|
* Creates row index column definition
|
|
6
33
|
*/
|
|
@@ -17,10 +17,36 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
import { jsx } from "react/jsx-runtime";
|
|
20
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
21
21
|
import { Box } from "@mui/material";
|
|
22
22
|
import { get } from "lodash-es";
|
|
23
23
|
import { parseWidth } from ".";
|
|
24
|
+
function RowIndexCell({ row, table }) {
|
|
25
|
+
const { pageIndex, pageSize } = table.getState().pagination;
|
|
26
|
+
const isManualPagination = table.options.manualPagination;
|
|
27
|
+
let rowPositionOnPage;
|
|
28
|
+
if (isManualPagination) {
|
|
29
|
+
rowPositionOnPage = row.index;
|
|
30
|
+
} else {
|
|
31
|
+
const currentPageRows = table.getPaginationRowModel().rows;
|
|
32
|
+
rowPositionOnPage = currentPageRows.findIndex((pageRow) => pageRow.id === row.id);
|
|
33
|
+
}
|
|
34
|
+
const rowNumber = pageIndex * pageSize + rowPositionOnPage + 1;
|
|
35
|
+
return /* @__PURE__ */ jsx(Box, { "data-col-identifier": "rowIndex", children: rowNumber });
|
|
36
|
+
}
|
|
37
|
+
RowIndexCell.displayName = "RowIndexCell";
|
|
38
|
+
function DataCell(ctx) {
|
|
39
|
+
var _a;
|
|
40
|
+
const { wmColumn, renderCell } = (_a = ctx.column.columnDef.meta) == null ? void 0 : _a._cell;
|
|
41
|
+
return /* @__PURE__ */ jsx(Fragment, { children: renderCell(wmColumn, ctx.row) });
|
|
42
|
+
}
|
|
43
|
+
DataCell.displayName = "DataCell";
|
|
44
|
+
function ActionCell(ctx) {
|
|
45
|
+
var _a;
|
|
46
|
+
const { renderActionCell } = (_a = ctx.column.columnDef.meta) == null ? void 0 : _a._actions;
|
|
47
|
+
return /* @__PURE__ */ jsx(Fragment, { children: renderActionCell(ctx) });
|
|
48
|
+
}
|
|
49
|
+
ActionCell.displayName = "ActionCell";
|
|
24
50
|
const createRowIndexColumn = () => ({
|
|
25
51
|
id: "rowIndex",
|
|
26
52
|
header: "S. No.",
|
|
@@ -28,21 +54,7 @@ const createRowIndexColumn = () => ({
|
|
|
28
54
|
minSize: 70,
|
|
29
55
|
maxSize: 70,
|
|
30
56
|
enableResizing: false,
|
|
31
|
-
cell:
|
|
32
|
-
const pageIndex = table.getState().pagination.pageIndex;
|
|
33
|
-
const pageSize = table.getState().pagination.pageSize;
|
|
34
|
-
const isManualPagination = table.options.manualPagination;
|
|
35
|
-
let rowPositionOnPage;
|
|
36
|
-
if (isManualPagination) {
|
|
37
|
-
rowPositionOnPage = row.index;
|
|
38
|
-
} else {
|
|
39
|
-
const paginationModel = table.getPaginationRowModel();
|
|
40
|
-
const currentPageRows = paginationModel.rows;
|
|
41
|
-
rowPositionOnPage = currentPageRows.findIndex((pageRow) => pageRow.id === row.id);
|
|
42
|
-
}
|
|
43
|
-
const rowNumber = pageIndex * pageSize + rowPositionOnPage + 1;
|
|
44
|
-
return /* @__PURE__ */ jsx(Box, { "data-col-identifier": "rowIndex", children: rowNumber });
|
|
45
|
-
},
|
|
57
|
+
cell: RowIndexCell,
|
|
46
58
|
enableSorting: false
|
|
47
59
|
});
|
|
48
60
|
const createDataColumn = (wmColumn, renderCell, index = 0) => {
|
|
@@ -55,6 +67,7 @@ const createDataColumn = (wmColumn, renderCell, index = 0) => {
|
|
|
55
67
|
columnSize = parseWidth(wmColumn.styles.width);
|
|
56
68
|
}
|
|
57
69
|
const accessorKey = wmColumn.field || wmColumn.name;
|
|
70
|
+
const isDomHidden = wmColumn.show === false;
|
|
58
71
|
const columnId = (accessorKey == null ? void 0 : accessorKey.replace(/\./g, "_")) || (typeof wmColumn.caption === "string" && wmColumn.caption ? wmColumn.caption : void 0) || `column_${index}`;
|
|
59
72
|
return __spreadProps(__spreadValues({
|
|
60
73
|
id: columnId,
|
|
@@ -63,13 +76,11 @@ const createDataColumn = (wmColumn, renderCell, index = 0) => {
|
|
|
63
76
|
// Supports nested properties like "department.store.employee"
|
|
64
77
|
accessorFn: wmColumn.sortby ? (row) => get(row, wmColumn.sortby || "") : void 0,
|
|
65
78
|
header: wmColumn.caption,
|
|
66
|
-
size: columnSize,
|
|
67
|
-
minSize: 50
|
|
68
|
-
}, columnSize ? {} : { maxSize: 500 }), {
|
|
69
|
-
// Only set maxSize for auto-sized columns
|
|
79
|
+
size: isDomHidden ? 0 : columnSize,
|
|
80
|
+
minSize: isDomHidden ? 0 : 50
|
|
81
|
+
}, isDomHidden ? { maxSize: 0 } : columnSize ? {} : { maxSize: 500 }), {
|
|
70
82
|
enableResizing: true,
|
|
71
|
-
|
|
72
|
-
cell: ({ row }) => renderCell(wmColumn, row),
|
|
83
|
+
cell: DataCell,
|
|
73
84
|
enableSorting: wmColumn.sortable,
|
|
74
85
|
// Pass column styles and properties through meta for TableCell styling and filtering
|
|
75
86
|
meta: __spreadProps(__spreadValues({
|
|
@@ -78,6 +89,7 @@ const createDataColumn = (wmColumn, renderCell, index = 0) => {
|
|
|
78
89
|
className: wmColumn == null ? void 0 : wmColumn.className,
|
|
79
90
|
colClass: colClassProp
|
|
80
91
|
}, wmColumn.styles), {
|
|
92
|
+
domHidden: isDomHidden,
|
|
81
93
|
// Include widget types for filter rendering
|
|
82
94
|
widgetType: wmColumn.widgetType,
|
|
83
95
|
editWidgetType: wmColumn.editWidgetType,
|
|
@@ -86,16 +98,17 @@ const createDataColumn = (wmColumn, renderCell, index = 0) => {
|
|
|
86
98
|
type: wmColumn.type || wmColumn.columntype || "string",
|
|
87
99
|
searchable: wmColumn.searchable !== false,
|
|
88
100
|
// Custom cell renderer for optimized rendering in MemoizedRowCells
|
|
89
|
-
renderCellContent: wmColumn == null ? void 0 : wmColumn.renderCellContent
|
|
101
|
+
renderCellContent: wmColumn == null ? void 0 : wmColumn.renderCellContent,
|
|
102
|
+
// DataCell reads renderCell + wmColumn from here at render time.
|
|
103
|
+
// Namespaced under _cell so RowCells can exclude it from the style spread.
|
|
104
|
+
_cell: { wmColumn, renderCell }
|
|
90
105
|
})
|
|
91
106
|
});
|
|
92
107
|
};
|
|
93
108
|
const createDataColumns = (wmTableColumns, renderCell) => {
|
|
94
109
|
const columns = [];
|
|
95
110
|
wmTableColumns.forEach((wmColumn, index) => {
|
|
96
|
-
|
|
97
|
-
columns.push(createDataColumn(wmColumn, renderCell, index));
|
|
98
|
-
}
|
|
111
|
+
columns.push(createDataColumn(wmColumn, renderCell, index));
|
|
99
112
|
});
|
|
100
113
|
return columns;
|
|
101
114
|
};
|
|
@@ -177,6 +190,7 @@ const getActionColumnSize = (editmode) => {
|
|
|
177
190
|
return editmode === "quickedit" ? { size: 80, minSize: 60 } : { size: 100, minSize: 80 };
|
|
178
191
|
};
|
|
179
192
|
export {
|
|
193
|
+
ActionCell,
|
|
180
194
|
createDataColumn,
|
|
181
195
|
createDataColumns,
|
|
182
196
|
createDefaultColumnProps,
|
|
@@ -16,7 +16,7 @@ export declare const hasExplicitWidth: (column: ColumnDef<any>) => boolean;
|
|
|
16
16
|
* 3. Data columns with explicit widths (via column.width or column.styles.width) maintain their specified size
|
|
17
17
|
*
|
|
18
18
|
* @param columns - Array of column definitions
|
|
19
|
-
* @param tableWidth - Total available table width (
|
|
19
|
+
* @param tableWidth - Total available table width in pixels (must be > 0 to distribute)
|
|
20
20
|
* @returns Modified column definitions with auto-sized data columns
|
|
21
21
|
*/
|
|
22
22
|
export declare const distributeColumnWidths: (columns: ColumnDef<any>[], tableWidth?: number) => ColumnDef<any>[];
|
|
@@ -18,16 +18,29 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
const NON_DATA_COLUMN_IDS = ["radioSelect", "multiSelect", "rowIndex", "actions"];
|
|
21
|
+
const isDomHiddenColumn = (column) => {
|
|
22
|
+
var _a;
|
|
23
|
+
return !!((_a = column.meta) == null ? void 0 : _a.domHidden);
|
|
24
|
+
};
|
|
21
25
|
const isDataColumn = (column) => {
|
|
26
|
+
if (isDomHiddenColumn(column)) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
22
29
|
return !NON_DATA_COLUMN_IDS.includes(column.id || "");
|
|
23
30
|
};
|
|
24
31
|
const hasExplicitWidth = (column) => {
|
|
25
32
|
return typeof column.size === "number" && column.size > 0;
|
|
26
33
|
};
|
|
27
|
-
const distributeColumnWidths = (columns, tableWidth
|
|
34
|
+
const distributeColumnWidths = (columns, tableWidth) => {
|
|
35
|
+
if (!tableWidth || tableWidth <= 0) {
|
|
36
|
+
return columns;
|
|
37
|
+
}
|
|
28
38
|
let usedWidth = 0;
|
|
29
39
|
let dataColumnsNeedingWidth = 0;
|
|
30
40
|
columns.forEach((column) => {
|
|
41
|
+
if (isDomHiddenColumn(column)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
31
44
|
if (!isDataColumn(column)) {
|
|
32
45
|
const size = column.size || getDefaultColumnSize(column.id || "");
|
|
33
46
|
usedWidth += size;
|
|
@@ -45,8 +45,4 @@ export declare const INTERACTIVE_CLASSES: readonly ["MuiInputBase", "MuiSelect",
|
|
|
45
45
|
export declare const INTERACTIVE_ROLES: readonly ["button", "textbox", "combobox", "listbox"];
|
|
46
46
|
export declare const INTERACTIVE_DATA_ROLES: readonly ["input", "select", "date", "time", "color", "editor", "checkbox", "radio", "slider", "chips", "rating"];
|
|
47
47
|
export declare const INTERACTIVE_TAG_NAMES: readonly ["INPUT", "BUTTON", "SELECT", "TEXTAREA", "A", "LABEL"];
|
|
48
|
-
export declare const DYNAMIC_COLUMNS_CONFIG: {
|
|
49
|
-
readonly maxColumns: 10;
|
|
50
|
-
readonly sampleSize: 3;
|
|
51
|
-
};
|
|
52
48
|
export declare const UNSUPPORTED_STATE_PERSISTENCE_TYPES: readonly string[];
|
|
@@ -112,19 +112,12 @@ const INTERACTIVE_TAG_NAMES = [
|
|
|
112
112
|
"A",
|
|
113
113
|
"LABEL"
|
|
114
114
|
];
|
|
115
|
-
const DYNAMIC_COLUMNS_CONFIG = {
|
|
116
|
-
maxColumns: 10,
|
|
117
|
-
// Maximum number of columns to generate from data (matching Angular behavior)
|
|
118
|
-
sampleSize: 3
|
|
119
|
-
// Number of rows to sample for column detection
|
|
120
|
-
};
|
|
121
115
|
const UNSUPPORTED_STATE_PERSISTENCE_TYPES = [
|
|
122
116
|
"Scroll",
|
|
123
117
|
"On-Demand",
|
|
124
118
|
"Inline"
|
|
125
119
|
];
|
|
126
120
|
export {
|
|
127
|
-
DYNAMIC_COLUMNS_CONFIG,
|
|
128
121
|
INTERACTIVE_CLASSES,
|
|
129
122
|
INTERACTIVE_DATA_ROLES,
|
|
130
123
|
INTERACTIVE_ROLES,
|
|
@@ -25,7 +25,7 @@ export interface PreparedFieldTerminal {
|
|
|
25
25
|
*
|
|
26
26
|
* Uses lodash `pickBy` to drop internal keys in one pass per object; recursion stays shallow.
|
|
27
27
|
*/
|
|
28
|
-
export declare const prepareFieldsFromMergedRow: (mergedRow: Record<string, any
|
|
28
|
+
export declare const prepareFieldsFromMergedRow: (mergedRow: Record<string, any>) => PreparedFieldTerminal[];
|
|
29
29
|
/**
|
|
30
30
|
* Generate column definitions from data array.
|
|
31
31
|
* Uses Angular-style nested flattening (prepareFieldDefs) so dynamic tables and
|
|
@@ -21,7 +21,6 @@ import isArray from "lodash-es/isArray";
|
|
|
21
21
|
import pickBy from "lodash-es/pickBy";
|
|
22
22
|
import startCase from "lodash-es/startCase";
|
|
23
23
|
import { createDefaultColumnProps } from "./columnBuilder";
|
|
24
|
-
import { DYNAMIC_COLUMNS_CONFIG } from "./constants";
|
|
25
24
|
import { INTERNAL_PROPERTIES } from "./index";
|
|
26
25
|
const INTERNAL_FIELD_PATTERNS = [
|
|
27
26
|
"_wm",
|
|
@@ -93,11 +92,9 @@ function relatedFieldsFromKey(rawKey) {
|
|
|
93
92
|
function isLeafColumnValue(value) {
|
|
94
93
|
return value === null || value === void 0 || typeof value !== "object" || value instanceof Date || isArray(value) && !value[0];
|
|
95
94
|
}
|
|
96
|
-
const prepareFieldsFromMergedRow = (mergedRow
|
|
95
|
+
const prepareFieldsFromMergedRow = (mergedRow) => {
|
|
97
96
|
const terminals = [];
|
|
98
|
-
let columnCount = 0;
|
|
99
97
|
const pushTerminal = (fieldPath, relatedTable, relatedField) => {
|
|
100
|
-
if (columnCount >= upperBound) return;
|
|
101
98
|
const displayName = displayNameForFieldPath(fieldPath);
|
|
102
99
|
terminals.push({
|
|
103
100
|
displayName,
|
|
@@ -106,14 +103,12 @@ const prepareFieldsFromMergedRow = (mergedRow, upperBound = DYNAMIC_COLUMNS_CONF
|
|
|
106
103
|
relatedTable,
|
|
107
104
|
relatedField: relatedField != null ? relatedField : displayName
|
|
108
105
|
});
|
|
109
|
-
columnCount += 1;
|
|
110
106
|
};
|
|
111
107
|
const pushFieldDef = (node, prefix, depth) => {
|
|
112
|
-
if (
|
|
108
|
+
if (depth > MAX_FIELD_DEPTH || node == null) return;
|
|
113
109
|
if (!isPlainRecord(node)) return;
|
|
114
110
|
const visible = pickBy(node, (_v, k) => !isInternalField(String(k)));
|
|
115
111
|
forEach(visible, (value, rawKey) => {
|
|
116
|
-
if (columnCount >= upperBound) return;
|
|
117
112
|
const path = prefix ? `${prefix}.${rawKey}` : rawKey;
|
|
118
113
|
const rel = relatedFieldsFromKey(rawKey);
|
|
119
114
|
if (isLeafColumnValue(value)) {
|
|
@@ -155,7 +150,7 @@ const generateColumnsFromData = (data) => {
|
|
|
155
150
|
if (!merged) {
|
|
156
151
|
return [];
|
|
157
152
|
}
|
|
158
|
-
const terminals = prepareFieldsFromMergedRow(merged
|
|
153
|
+
const terminals = prepareFieldsFromMergedRow(merged);
|
|
159
154
|
if (terminals.length === 0) {
|
|
160
155
|
return [];
|
|
161
156
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
/** Minimal header shape for expansion insert-index calculation (TanStack Header-compatible). */
|
|
3
|
+
export type ExpansionColumnHeaderLike = {
|
|
4
|
+
id: string;
|
|
5
|
+
column: {
|
|
6
|
+
id: string;
|
|
7
|
+
columnDef?: unknown;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Index at which the row-expansion `<th>` / `<td>` / `<col>` is inserted.
|
|
12
|
+
* Mirrors Angular datatable.js preparedHeaderData row-expansion placement.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getExpansionColumnInsertIndex(headers: ReadonlyArray<ExpansionColumnHeaderLike>, rowExpansionConfig: {
|
|
15
|
+
position?: string | number;
|
|
16
|
+
} | null | undefined, options?: {
|
|
17
|
+
appendForGroupedTable?: boolean;
|
|
18
|
+
}): number;
|
|
19
|
+
export declare function buildExpansionColSpec(columnwidth?: string): {
|
|
20
|
+
key: string;
|
|
21
|
+
width: string;
|
|
22
|
+
style: CSSProperties;
|
|
23
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const SYSTEM_HEADER_IDS = /* @__PURE__ */ new Set([
|
|
2
|
+
"multiSelect",
|
|
3
|
+
"radioSelect",
|
|
4
|
+
"row-index",
|
|
5
|
+
"rowIndex",
|
|
6
|
+
"actions"
|
|
7
|
+
]);
|
|
8
|
+
function findFirstDataColumnIndex(headers) {
|
|
9
|
+
for (let i = 0; i < headers.length; i++) {
|
|
10
|
+
if (!SYSTEM_HEADER_IDS.has(headers[i].id)) {
|
|
11
|
+
return i;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
function getExpansionColumnInsertIndex(headers, rowExpansionConfig, options) {
|
|
17
|
+
if (!rowExpansionConfig) return -1;
|
|
18
|
+
if (options == null ? void 0 : options.appendForGroupedTable) {
|
|
19
|
+
return headers.length;
|
|
20
|
+
}
|
|
21
|
+
const position = rowExpansionConfig.position;
|
|
22
|
+
if (position === "-1" || position === -1) {
|
|
23
|
+
return Math.max(0, headers.length - 1);
|
|
24
|
+
}
|
|
25
|
+
if (typeof position === "number" || typeof position === "string" && !isNaN(Number(position))) {
|
|
26
|
+
return findFirstDataColumnIndex([...headers]) + Number(position);
|
|
27
|
+
}
|
|
28
|
+
if (typeof position === "string") {
|
|
29
|
+
const columnIndex = headers.findIndex((header) => {
|
|
30
|
+
var _a;
|
|
31
|
+
if (header.id === position || header.column.id === position) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
const accessorKey = (_a = header.column.columnDef) == null ? void 0 : _a.accessorKey;
|
|
35
|
+
if (accessorKey === position) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
const normalizedPosition = position.replace(/\./g, "_");
|
|
39
|
+
return header.id === normalizedPosition || header.column.id === normalizedPosition;
|
|
40
|
+
});
|
|
41
|
+
return columnIndex >= 0 ? columnIndex + 1 : 0;
|
|
42
|
+
}
|
|
43
|
+
return 0;
|
|
44
|
+
}
|
|
45
|
+
function buildExpansionColSpec(columnwidth) {
|
|
46
|
+
const w = columnwidth || "50px";
|
|
47
|
+
return {
|
|
48
|
+
key: "row-expansion",
|
|
49
|
+
width: w,
|
|
50
|
+
style: { width: w }
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
buildExpansionColSpec,
|
|
55
|
+
getExpansionColumnInsertIndex
|
|
56
|
+
};
|