fastapi-rtk 0.2.9 → 0.2.10
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/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/MantineInputs/MantineDateTimeInput.cjs +1 -1
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/MantineInputs/MantineDateTimeInput.mjs +1 -1
- package/dist/core/cjs/ActionIcons/Modals/CommonModal.cjs +2 -1
- package/dist/core/cjs/Tables/NextGenDataGrid/NextGenDataGrid.cjs +2 -1
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/{Body.cjs → Cell.cjs} +22 -17
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter.cjs +5 -0
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/useColumns.cjs +66 -23
- package/dist/core/esm/ActionIcons/Modals/CommonModal.mjs +2 -1
- package/dist/core/esm/Tables/NextGenDataGrid/NextGenDataGrid.mjs +2 -1
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/{Body.mjs → Cell.mjs} +23 -18
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter.mjs +7 -2
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/useColumns.mjs +67 -24
- package/dist/core/lib/ActionIcons/Modals/CommonModal.d.ts +37 -14
- package/dist/core/lib/Tables/NextGenDataGrid/NextGenDataGrid.d.ts +5 -1
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/Cell.d.ts +12 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter.d.ts +15 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/useColumns.d.ts +1 -1
- package/dist/jsonforms/cjs/MantineInputs/MantineDateTimeInput.cjs +1 -1
- package/dist/jsonforms/esm/MantineInputs/MantineDateTimeInput.mjs +1 -1
- package/package.json +1 -1
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/Body.d.ts +0 -6
package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/MantineInputs/MantineDateTimeInput.cjs
CHANGED
|
@@ -26,7 +26,7 @@ function MantineDateTimeInput({ margin, ...props }) {
|
|
|
26
26
|
}
|
|
27
27
|
}, [data, setToLocal, setToUTC]);
|
|
28
28
|
const componentProps = React.useMemo(() => ({ ...commonProps, ...dateProps }), [commonProps, dateProps]);
|
|
29
|
-
const [Component, _props] = useContextProps.useContextProps("DateTime", path, componentProps, props);
|
|
29
|
+
const [Component, { initialUTC: _, ..._props }] = useContextProps.useContextProps("DateTime", path, componentProps, props);
|
|
30
30
|
if (!props.visible) {
|
|
31
31
|
return null;
|
|
32
32
|
}
|
package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/MantineInputs/MantineDateTimeInput.mjs
CHANGED
|
@@ -24,7 +24,7 @@ function MantineDateTimeInput({ margin, ...props }) {
|
|
|
24
24
|
}
|
|
25
25
|
}, [data, setToLocal, setToUTC]);
|
|
26
26
|
const componentProps = useMemo(() => ({ ...commonProps, ...dateProps }), [commonProps, dateProps]);
|
|
27
|
-
const [Component, _props] = useContextProps("DateTime", path, componentProps, props);
|
|
27
|
+
const [Component, { initialUTC: _, ..._props }] = useContextProps("DateTime", path, componentProps, props);
|
|
28
28
|
if (!props.visible) {
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
@@ -24,6 +24,7 @@ function CommonModal({
|
|
|
24
24
|
boxProps,
|
|
25
25
|
buttonText,
|
|
26
26
|
buttonLoading,
|
|
27
|
+
withTitleOptions = true,
|
|
27
28
|
...props
|
|
28
29
|
}) {
|
|
29
30
|
var _a;
|
|
@@ -57,7 +58,7 @@ function CommonModal({
|
|
|
57
58
|
...props,
|
|
58
59
|
title: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
59
60
|
props.title,
|
|
60
|
-
!fab && //* Backward compatibility to fab-react-toolkit
|
|
61
|
+
!fab && withTitleOptions && //* Backward compatibility to fab-react-toolkit
|
|
61
62
|
/* @__PURE__ */ jsxRuntime.jsx(core.Group, { children: /* @__PURE__ */ jsxRuntime.jsxs(core.Group, { gap: "xs", pr: "xs", children: [
|
|
62
63
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
63
64
|
core.CloseButton,
|
|
@@ -54,6 +54,7 @@ const NextGenDataGrid = React.forwardRef((props, ref) => {
|
|
|
54
54
|
textFilterSeparator = ";",
|
|
55
55
|
enableAdvancedFilters,
|
|
56
56
|
wrapperProps,
|
|
57
|
+
memo,
|
|
57
58
|
// Deprecated props
|
|
58
59
|
bodySeparator,
|
|
59
60
|
bodyTruncate,
|
|
@@ -136,7 +137,7 @@ const NextGenDataGrid = React.forwardRef((props, ref) => {
|
|
|
136
137
|
const dataProps = useData.useData();
|
|
137
138
|
const sortingProps = useSorting.useSorting();
|
|
138
139
|
const paginationProps = usePagination.usePagination(hidePagination);
|
|
139
|
-
const columnsProps = useColumns.useColumns(columnProps, header, body, textFilterSeparator, enableAdvancedFilters);
|
|
140
|
+
const columnsProps = useColumns.useColumns(columnProps, header, body, textFilterSeparator, enableAdvancedFilters, memo);
|
|
140
141
|
const sizeProps = useSize.useSize(withBorder);
|
|
141
142
|
const actionsProps = useActions.useActions(hideActions, (_a = utils.mergeProps(body, specialKey.actions)) == null ? void 0 : _a.component);
|
|
142
143
|
const globalFilterProps = useGlobalFilter.useGlobalFilter();
|
|
@@ -7,12 +7,13 @@ const useApi = require("../../../../hooks/api/useApi.cjs");
|
|
|
7
7
|
const useAuth = require("../../../../hooks/auth/useAuth.cjs");
|
|
8
8
|
const FallbackWrapper = require("../../FallbackWrapper.cjs");
|
|
9
9
|
const MultiLineHighlight = require("./MultiLineHighlight.cjs");
|
|
10
|
-
const
|
|
10
|
+
const Cell = ({ body, col, textFilterSeparator, mrtProps }) => {
|
|
11
11
|
const { table, column, cell } = mrtProps;
|
|
12
12
|
const api = useApi.useApi();
|
|
13
13
|
const auth = useAuth.useAuth();
|
|
14
14
|
const { specialKey } = useApi.useApi();
|
|
15
|
-
const
|
|
15
|
+
const colProps = utils.mergeProps(body, specialKey.all, col);
|
|
16
|
+
const { component, separator, truncate, tooltipProps, highlightProps } = colProps;
|
|
16
17
|
const highlights = React.useMemo(() => {
|
|
17
18
|
const globalFilter = table.getState().globalFilter;
|
|
18
19
|
const columnTextFilter = column.getFilterValue();
|
|
@@ -52,6 +53,16 @@ const Body = ({ body, col, textFilterSeparator, mrtProps }) => {
|
|
|
52
53
|
return result;
|
|
53
54
|
}, [cell.getValue(), separator, truncate]);
|
|
54
55
|
const highlight = React.useMemo(() => [...highlights, ...cellObj.highlight], [highlights, cellObj.highlight]);
|
|
56
|
+
const functionProps = {
|
|
57
|
+
api,
|
|
58
|
+
auth,
|
|
59
|
+
data: cell.row.original,
|
|
60
|
+
highlight,
|
|
61
|
+
cell: cellObj,
|
|
62
|
+
colProps,
|
|
63
|
+
componentProps: { value: cellObj.value },
|
|
64
|
+
mrtProps
|
|
65
|
+
};
|
|
55
66
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
56
67
|
FallbackWrapper.FallbackWrapper,
|
|
57
68
|
{
|
|
@@ -60,25 +71,19 @@ const Body = ({ body, col, textFilterSeparator, mrtProps }) => {
|
|
|
60
71
|
{
|
|
61
72
|
highlight,
|
|
62
73
|
truncate: cellObj.truncate,
|
|
63
|
-
tooltipProps: utils.parseFromValuesOrFunc(tooltipProps, {
|
|
64
|
-
highlightProps: utils.parseFromValuesOrFunc(highlightProps, {
|
|
65
|
-
value: cellObj.value,
|
|
66
|
-
data: cell.row.original,
|
|
67
|
-
cellObj
|
|
68
|
-
}),
|
|
74
|
+
tooltipProps: utils.parseFromValuesOrFunc(tooltipProps, { ...functionProps.componentProps, functionProps }),
|
|
75
|
+
highlightProps: utils.parseFromValuesOrFunc(highlightProps, { ...functionProps.componentProps, functionProps }),
|
|
69
76
|
children: cellObj.value
|
|
70
77
|
}
|
|
71
78
|
),
|
|
72
|
-
functionProps
|
|
73
|
-
api,
|
|
74
|
-
auth,
|
|
75
|
-
data: cell.row.original,
|
|
76
|
-
highlight,
|
|
77
|
-
componentProps: { value: cellObj.value },
|
|
78
|
-
mrtProps
|
|
79
|
-
},
|
|
79
|
+
functionProps,
|
|
80
80
|
children: component
|
|
81
81
|
}
|
|
82
82
|
);
|
|
83
83
|
};
|
|
84
|
-
|
|
84
|
+
const MemoCell = React.memo(
|
|
85
|
+
Cell,
|
|
86
|
+
(prevProps, nextProps) => JSON.stringify(prevProps.memo) === JSON.stringify(nextProps.memo)
|
|
87
|
+
);
|
|
88
|
+
exports.Cell = Cell;
|
|
89
|
+
exports.MemoCell = MemoCell;
|
|
@@ -86,4 +86,9 @@ const ColumnHeaderFilter = ({
|
|
|
86
86
|
)
|
|
87
87
|
] });
|
|
88
88
|
};
|
|
89
|
+
const MemoColumnHeaderFilter = React.memo(
|
|
90
|
+
ColumnHeaderFilter,
|
|
91
|
+
(prevProps, nextProps) => JSON.stringify(prevProps.memo) === JSON.stringify(nextProps.memo)
|
|
92
|
+
);
|
|
89
93
|
exports.ColumnHeaderFilter = ColumnHeaderFilter;
|
|
94
|
+
exports.MemoColumnHeaderFilter = MemoColumnHeaderFilter;
|
|
@@ -8,11 +8,11 @@ const React = require("react");
|
|
|
8
8
|
const useApi = require("../../../../hooks/api/useApi.cjs");
|
|
9
9
|
const useAuth = require("../../../../hooks/auth/useAuth.cjs");
|
|
10
10
|
const utils$1 = require("../../utils.cjs");
|
|
11
|
-
const
|
|
11
|
+
const Cell = require("./Cell.cjs");
|
|
12
12
|
const ColumnHeaderFilter = require("./ColumnHeaderFilter.cjs");
|
|
13
13
|
const HeaderAdvancedFiltersMenuButton = require("./HeaderAdvancedFiltersMenuButton.cjs");
|
|
14
|
-
function useColumns(columnProps, header, body, textFilterSeparator, enableAdvancedFilters) {
|
|
15
|
-
const { path, info, data, specialKey } = useApi.useApi();
|
|
14
|
+
function useColumns(columnProps, header, body, textFilterSeparator, enableAdvancedFilters, memo) {
|
|
15
|
+
const { path, info, queryParams, data, specialKey } = useApi.useApi();
|
|
16
16
|
const api = useApi.useApi();
|
|
17
17
|
const auth = useAuth.useAuth();
|
|
18
18
|
const idValueMap = hooks.useMap();
|
|
@@ -58,28 +58,69 @@ function useColumns(columnProps, header, body, textFilterSeparator, enableAdvanc
|
|
|
58
58
|
] });
|
|
59
59
|
} : void 0,
|
|
60
60
|
filterTooltipValueFn: (value) => idValueMap.get(`${data == null ? void 0 : data.path}-${col}-${value}`) ?? value,
|
|
61
|
-
Filter: (props) =>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
61
|
+
Filter: (props) => {
|
|
62
|
+
var _a2, _b2;
|
|
63
|
+
return enableAdvancedFilters ? null : memo === true || memo === "filters" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
64
|
+
ColumnHeaderFilter.MemoColumnHeaderFilter,
|
|
65
|
+
{
|
|
66
|
+
enableFilterModes,
|
|
67
|
+
filters,
|
|
68
|
+
filterFn,
|
|
69
|
+
filterProps,
|
|
70
|
+
filterState,
|
|
71
|
+
filterSync,
|
|
72
|
+
filterMenu,
|
|
73
|
+
filterModeDescription,
|
|
74
|
+
updateQueryParams,
|
|
75
|
+
withLocalStorage,
|
|
76
|
+
localStorageKey,
|
|
77
|
+
mrtProps: props,
|
|
78
|
+
memo: {
|
|
79
|
+
columnFilterValue: props.column.getFilterValue(),
|
|
80
|
+
filterStateValues: [
|
|
81
|
+
props.column.getFilterValue(),
|
|
82
|
+
filterState == null ? void 0 : filterState.value,
|
|
83
|
+
updateQueryParams ? (_b2 = (_a2 = queryParams == null ? void 0 : queryParams.filters) == null ? void 0 : _a2.find((qpFilter) => qpFilter.id === props.column.id)) == null ? void 0 : _b2.value : void 0
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
children: filterComponent
|
|
87
|
+
}
|
|
88
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
89
|
+
ColumnHeaderFilter.ColumnHeaderFilter,
|
|
90
|
+
{
|
|
91
|
+
enableFilterModes,
|
|
92
|
+
filters,
|
|
93
|
+
filterFn,
|
|
94
|
+
filterProps,
|
|
95
|
+
filterState,
|
|
96
|
+
filterSync,
|
|
97
|
+
filterMenu,
|
|
98
|
+
filterModeDescription,
|
|
99
|
+
updateQueryParams,
|
|
100
|
+
withLocalStorage,
|
|
101
|
+
localStorageKey,
|
|
102
|
+
mrtProps: props,
|
|
103
|
+
children: filterComponent
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
},
|
|
79
107
|
enableSorting: data == null ? void 0 : data.order_columns.includes(col),
|
|
80
108
|
filterFn: filters.length ? filterFn : void 0,
|
|
81
109
|
columnFilterModeOptions: filters.map((f) => utils$1.fromFilterToFilterFn(col, f.operator)),
|
|
82
|
-
Cell: (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
110
|
+
Cell: (props) => memo === true || memo === "cells" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
111
|
+
Cell.MemoCell,
|
|
112
|
+
{
|
|
113
|
+
body,
|
|
114
|
+
col,
|
|
115
|
+
textFilterSeparator,
|
|
116
|
+
mrtProps: props,
|
|
117
|
+
memo: {
|
|
118
|
+
globalFilter: props.table.getState().globalFilter,
|
|
119
|
+
columnFilterValue: props.column.getFilterValue(),
|
|
120
|
+
cellValue: props.cell.getValue()
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(Cell.Cell, { body, col, textFilterSeparator, mrtProps: props }),
|
|
83
124
|
...additionalProps,
|
|
84
125
|
...utils.mergeProps(columnProps, specialKey.all, col)
|
|
85
126
|
};
|
|
@@ -92,11 +133,13 @@ function useColumns(columnProps, header, body, textFilterSeparator, enableAdvanc
|
|
|
92
133
|
info == null ? void 0 : info.filters,
|
|
93
134
|
header,
|
|
94
135
|
specialKey.all,
|
|
136
|
+
enableAdvancedFilters,
|
|
95
137
|
columnProps,
|
|
96
138
|
api,
|
|
97
139
|
auth,
|
|
98
140
|
idValueMap,
|
|
99
|
-
|
|
141
|
+
memo,
|
|
142
|
+
queryParams == null ? void 0 : queryParams.filters,
|
|
100
143
|
body,
|
|
101
144
|
textFilterSeparator
|
|
102
145
|
]
|
|
@@ -22,6 +22,7 @@ function CommonModal({
|
|
|
22
22
|
boxProps,
|
|
23
23
|
buttonText,
|
|
24
24
|
buttonLoading,
|
|
25
|
+
withTitleOptions = true,
|
|
25
26
|
...props
|
|
26
27
|
}) {
|
|
27
28
|
var _a;
|
|
@@ -55,7 +56,7 @@ function CommonModal({
|
|
|
55
56
|
...props,
|
|
56
57
|
title: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
57
58
|
props.title,
|
|
58
|
-
!fab && //* Backward compatibility to fab-react-toolkit
|
|
59
|
+
!fab && withTitleOptions && //* Backward compatibility to fab-react-toolkit
|
|
59
60
|
/* @__PURE__ */ jsx(Group, { children: /* @__PURE__ */ jsxs(Group, { gap: "xs", pr: "xs", children: [
|
|
60
61
|
/* @__PURE__ */ jsx(
|
|
61
62
|
CloseButton,
|
|
@@ -52,6 +52,7 @@ const NextGenDataGrid = forwardRef((props, ref) => {
|
|
|
52
52
|
textFilterSeparator = ";",
|
|
53
53
|
enableAdvancedFilters,
|
|
54
54
|
wrapperProps,
|
|
55
|
+
memo,
|
|
55
56
|
// Deprecated props
|
|
56
57
|
bodySeparator,
|
|
57
58
|
bodyTruncate,
|
|
@@ -134,7 +135,7 @@ const NextGenDataGrid = forwardRef((props, ref) => {
|
|
|
134
135
|
const dataProps = useData();
|
|
135
136
|
const sortingProps = useSorting();
|
|
136
137
|
const paginationProps = usePagination(hidePagination);
|
|
137
|
-
const columnsProps = useColumns(columnProps, header, body, textFilterSeparator, enableAdvancedFilters);
|
|
138
|
+
const columnsProps = useColumns(columnProps, header, body, textFilterSeparator, enableAdvancedFilters, memo);
|
|
138
139
|
const sizeProps = useSize(withBorder);
|
|
139
140
|
const actionsProps = useActions(hideActions, (_a = mergeProps(body, specialKey.actions)) == null ? void 0 : _a.component);
|
|
140
141
|
const globalFilterProps = useGlobalFilter();
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { mergeProps, parseFromValuesOrFunc } from "fastapi-rtk/utils";
|
|
3
|
-
import { useMemo } from "react";
|
|
3
|
+
import { memo, useMemo } from "react";
|
|
4
4
|
import { useApi } from "../../../../hooks/api/useApi.mjs";
|
|
5
5
|
import { useAuth } from "../../../../hooks/auth/useAuth.mjs";
|
|
6
6
|
import { FallbackWrapper } from "../../FallbackWrapper.mjs";
|
|
7
7
|
import { MultiLineHighlight } from "./MultiLineHighlight.mjs";
|
|
8
|
-
const
|
|
8
|
+
const Cell = ({ body, col, textFilterSeparator, mrtProps }) => {
|
|
9
9
|
const { table, column, cell } = mrtProps;
|
|
10
10
|
const api = useApi();
|
|
11
11
|
const auth = useAuth();
|
|
12
12
|
const { specialKey } = useApi();
|
|
13
|
-
const
|
|
13
|
+
const colProps = mergeProps(body, specialKey.all, col);
|
|
14
|
+
const { component, separator, truncate, tooltipProps, highlightProps } = colProps;
|
|
14
15
|
const highlights = useMemo(() => {
|
|
15
16
|
const globalFilter = table.getState().globalFilter;
|
|
16
17
|
const columnTextFilter = column.getFilterValue();
|
|
@@ -50,6 +51,16 @@ const Body = ({ body, col, textFilterSeparator, mrtProps }) => {
|
|
|
50
51
|
return result;
|
|
51
52
|
}, [cell.getValue(), separator, truncate]);
|
|
52
53
|
const highlight = useMemo(() => [...highlights, ...cellObj.highlight], [highlights, cellObj.highlight]);
|
|
54
|
+
const functionProps = {
|
|
55
|
+
api,
|
|
56
|
+
auth,
|
|
57
|
+
data: cell.row.original,
|
|
58
|
+
highlight,
|
|
59
|
+
cell: cellObj,
|
|
60
|
+
colProps,
|
|
61
|
+
componentProps: { value: cellObj.value },
|
|
62
|
+
mrtProps
|
|
63
|
+
};
|
|
53
64
|
return /* @__PURE__ */ jsx(
|
|
54
65
|
FallbackWrapper,
|
|
55
66
|
{
|
|
@@ -58,27 +69,21 @@ const Body = ({ body, col, textFilterSeparator, mrtProps }) => {
|
|
|
58
69
|
{
|
|
59
70
|
highlight,
|
|
60
71
|
truncate: cellObj.truncate,
|
|
61
|
-
tooltipProps: parseFromValuesOrFunc(tooltipProps, {
|
|
62
|
-
highlightProps: parseFromValuesOrFunc(highlightProps, {
|
|
63
|
-
value: cellObj.value,
|
|
64
|
-
data: cell.row.original,
|
|
65
|
-
cellObj
|
|
66
|
-
}),
|
|
72
|
+
tooltipProps: parseFromValuesOrFunc(tooltipProps, { ...functionProps.componentProps, functionProps }),
|
|
73
|
+
highlightProps: parseFromValuesOrFunc(highlightProps, { ...functionProps.componentProps, functionProps }),
|
|
67
74
|
children: cellObj.value
|
|
68
75
|
}
|
|
69
76
|
),
|
|
70
|
-
functionProps
|
|
71
|
-
api,
|
|
72
|
-
auth,
|
|
73
|
-
data: cell.row.original,
|
|
74
|
-
highlight,
|
|
75
|
-
componentProps: { value: cellObj.value },
|
|
76
|
-
mrtProps
|
|
77
|
-
},
|
|
77
|
+
functionProps,
|
|
78
78
|
children: component
|
|
79
79
|
}
|
|
80
80
|
);
|
|
81
81
|
};
|
|
82
|
+
const MemoCell = memo(
|
|
83
|
+
Cell,
|
|
84
|
+
(prevProps, nextProps) => JSON.stringify(prevProps.memo) === JSON.stringify(nextProps.memo)
|
|
85
|
+
);
|
|
82
86
|
export {
|
|
83
|
-
|
|
87
|
+
Cell,
|
|
88
|
+
MemoCell
|
|
84
89
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Stack, Flex } from "@mantine/core";
|
|
3
|
-
import { useMemo } from "react";
|
|
3
|
+
import { memo, useMemo } from "react";
|
|
4
4
|
import { useApi } from "../../../../hooks/api/useApi.mjs";
|
|
5
5
|
import { useAuth } from "../../../../hooks/auth/useAuth.mjs";
|
|
6
6
|
import { fromFilterFnToFilter } from "../../utils.mjs";
|
|
@@ -84,6 +84,11 @@ const ColumnHeaderFilter = ({
|
|
|
84
84
|
)
|
|
85
85
|
] });
|
|
86
86
|
};
|
|
87
|
+
const MemoColumnHeaderFilter = memo(
|
|
88
|
+
ColumnHeaderFilter,
|
|
89
|
+
(prevProps, nextProps) => JSON.stringify(prevProps.memo) === JSON.stringify(nextProps.memo)
|
|
90
|
+
);
|
|
87
91
|
export {
|
|
88
|
-
ColumnHeaderFilter
|
|
92
|
+
ColumnHeaderFilter,
|
|
93
|
+
MemoColumnHeaderFilter
|
|
89
94
|
};
|
|
@@ -6,11 +6,11 @@ import { useEffect, useMemo } from "react";
|
|
|
6
6
|
import { useApi } from "../../../../hooks/api/useApi.mjs";
|
|
7
7
|
import { useAuth } from "../../../../hooks/auth/useAuth.mjs";
|
|
8
8
|
import { fromFilterToFilterFn } from "../../utils.mjs";
|
|
9
|
-
import {
|
|
10
|
-
import { ColumnHeaderFilter } from "./ColumnHeaderFilter.mjs";
|
|
9
|
+
import { MemoCell, Cell } from "./Cell.mjs";
|
|
10
|
+
import { MemoColumnHeaderFilter, ColumnHeaderFilter } from "./ColumnHeaderFilter.mjs";
|
|
11
11
|
import { HeaderAdvancedFiltersMenuButton } from "./HeaderAdvancedFiltersMenuButton.mjs";
|
|
12
|
-
function useColumns(columnProps, header, body, textFilterSeparator, enableAdvancedFilters) {
|
|
13
|
-
const { path, info, data, specialKey } = useApi();
|
|
12
|
+
function useColumns(columnProps, header, body, textFilterSeparator, enableAdvancedFilters, memo) {
|
|
13
|
+
const { path, info, queryParams, data, specialKey } = useApi();
|
|
14
14
|
const api = useApi();
|
|
15
15
|
const auth = useAuth();
|
|
16
16
|
const idValueMap = useMap();
|
|
@@ -56,28 +56,69 @@ function useColumns(columnProps, header, body, textFilterSeparator, enableAdvanc
|
|
|
56
56
|
] });
|
|
57
57
|
} : void 0,
|
|
58
58
|
filterTooltipValueFn: (value) => idValueMap.get(`${data == null ? void 0 : data.path}-${col}-${value}`) ?? value,
|
|
59
|
-
Filter: (props) =>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
59
|
+
Filter: (props) => {
|
|
60
|
+
var _a2, _b2;
|
|
61
|
+
return enableAdvancedFilters ? null : memo === true || memo === "filters" ? /* @__PURE__ */ jsx(
|
|
62
|
+
MemoColumnHeaderFilter,
|
|
63
|
+
{
|
|
64
|
+
enableFilterModes,
|
|
65
|
+
filters,
|
|
66
|
+
filterFn,
|
|
67
|
+
filterProps,
|
|
68
|
+
filterState,
|
|
69
|
+
filterSync,
|
|
70
|
+
filterMenu,
|
|
71
|
+
filterModeDescription,
|
|
72
|
+
updateQueryParams,
|
|
73
|
+
withLocalStorage,
|
|
74
|
+
localStorageKey,
|
|
75
|
+
mrtProps: props,
|
|
76
|
+
memo: {
|
|
77
|
+
columnFilterValue: props.column.getFilterValue(),
|
|
78
|
+
filterStateValues: [
|
|
79
|
+
props.column.getFilterValue(),
|
|
80
|
+
filterState == null ? void 0 : filterState.value,
|
|
81
|
+
updateQueryParams ? (_b2 = (_a2 = queryParams == null ? void 0 : queryParams.filters) == null ? void 0 : _a2.find((qpFilter) => qpFilter.id === props.column.id)) == null ? void 0 : _b2.value : void 0
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
children: filterComponent
|
|
85
|
+
}
|
|
86
|
+
) : /* @__PURE__ */ jsx(
|
|
87
|
+
ColumnHeaderFilter,
|
|
88
|
+
{
|
|
89
|
+
enableFilterModes,
|
|
90
|
+
filters,
|
|
91
|
+
filterFn,
|
|
92
|
+
filterProps,
|
|
93
|
+
filterState,
|
|
94
|
+
filterSync,
|
|
95
|
+
filterMenu,
|
|
96
|
+
filterModeDescription,
|
|
97
|
+
updateQueryParams,
|
|
98
|
+
withLocalStorage,
|
|
99
|
+
localStorageKey,
|
|
100
|
+
mrtProps: props,
|
|
101
|
+
children: filterComponent
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
},
|
|
77
105
|
enableSorting: data == null ? void 0 : data.order_columns.includes(col),
|
|
78
106
|
filterFn: filters.length ? filterFn : void 0,
|
|
79
107
|
columnFilterModeOptions: filters.map((f) => fromFilterToFilterFn(col, f.operator)),
|
|
80
|
-
Cell: (props) =>
|
|
108
|
+
Cell: (props) => memo === true || memo === "cells" ? /* @__PURE__ */ jsx(
|
|
109
|
+
MemoCell,
|
|
110
|
+
{
|
|
111
|
+
body,
|
|
112
|
+
col,
|
|
113
|
+
textFilterSeparator,
|
|
114
|
+
mrtProps: props,
|
|
115
|
+
memo: {
|
|
116
|
+
globalFilter: props.table.getState().globalFilter,
|
|
117
|
+
columnFilterValue: props.column.getFilterValue(),
|
|
118
|
+
cellValue: props.cell.getValue()
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
) : /* @__PURE__ */ jsx(Cell, { body, col, textFilterSeparator, mrtProps: props }),
|
|
81
122
|
...additionalProps,
|
|
82
123
|
...mergeProps(columnProps, specialKey.all, col)
|
|
83
124
|
};
|
|
@@ -90,11 +131,13 @@ function useColumns(columnProps, header, body, textFilterSeparator, enableAdvanc
|
|
|
90
131
|
info == null ? void 0 : info.filters,
|
|
91
132
|
header,
|
|
92
133
|
specialKey.all,
|
|
134
|
+
enableAdvancedFilters,
|
|
93
135
|
columnProps,
|
|
94
136
|
api,
|
|
95
137
|
auth,
|
|
96
138
|
idValueMap,
|
|
97
|
-
|
|
139
|
+
memo,
|
|
140
|
+
queryParams == null ? void 0 : queryParams.filters,
|
|
98
141
|
body,
|
|
99
142
|
textFilterSeparator
|
|
100
143
|
]
|
|
@@ -1,15 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
/**
|
|
2
|
+
* CommonModal component renders a modal with a form.
|
|
3
|
+
*
|
|
4
|
+
* @component
|
|
5
|
+
* @param {Object} props - The component props.
|
|
6
|
+
* @param {Record<string, any>} props.fabSchema - Schema for backward compatibility with fab-react-toolkit that includes defaultValues and validation schema.
|
|
7
|
+
* @param {Record<string, any>} props.schema - JSON Schema used by JsonFormsWithCustomizer.
|
|
8
|
+
* @param {Record<string, any>} props.uischema - UI schema for customizing the form layout.
|
|
9
|
+
* @param {Record<string, any>} props.state - State object containing the form data.
|
|
10
|
+
* @param {Function} props.setState - Function to update the state containing form data.
|
|
11
|
+
* @param {string} props.view - Current view mode (e.g., VIEW_MODE.NORMAL, VIEW_MODE.FULL_SCREEN, VIEW_MODE.OVERLAY).
|
|
12
|
+
* @param {Function} props.setView - Function to update the view mode.
|
|
13
|
+
* @param {Record<string, any>} props.jsonForms - Customizer configuration or additional properties for JsonFormsWithCustomizer.
|
|
14
|
+
* @param {Function} props.onSubmit - Callback function triggered on form submission.
|
|
15
|
+
* @param {Record<string, any>} props.boxProps - Additional properties to be passed to the Box component wrapping the form.
|
|
16
|
+
* @param {string} props.buttonText - Text displayed on the submit button.
|
|
17
|
+
* @param {boolean} props.buttonLoading - Indicates whether the submit button should display a loading state.
|
|
18
|
+
* @param {boolean} [props.withTitleOptions=true] - Flag to determine if title options (e.g., full screen, overlay toggles) should be displayed.
|
|
19
|
+
* @param {Record<string, any>} props.rest - Additional props to be passed to the Modal component.
|
|
20
|
+
*
|
|
21
|
+
* @returns - A rendered Modal component with an embedded form and optional title controls.
|
|
22
|
+
*/
|
|
23
|
+
export function CommonModal({ fabSchema, schema, uischema, state, setState, view, setView, jsonForms, onSubmit, boxProps, buttonText, buttonLoading, withTitleOptions, ...props }: {
|
|
24
|
+
fabSchema: Record<string, any>;
|
|
25
|
+
schema: Record<string, any>;
|
|
26
|
+
uischema: Record<string, any>;
|
|
27
|
+
state: Record<string, any>;
|
|
28
|
+
setState: Function;
|
|
29
|
+
view: string;
|
|
30
|
+
setView: Function;
|
|
31
|
+
jsonForms: Record<string, any>;
|
|
32
|
+
onSubmit: Function;
|
|
33
|
+
boxProps: Record<string, any>;
|
|
34
|
+
buttonText: string;
|
|
35
|
+
buttonLoading: boolean;
|
|
36
|
+
withTitleOptions?: boolean;
|
|
37
|
+
rest: Record<string, any>;
|
|
15
38
|
}): import("react").JSX.Element;
|
|
@@ -197,9 +197,13 @@ export type NextGenDataGridProps = {
|
|
|
197
197
|
enableAdvancedFilters?: boolean;
|
|
198
198
|
/**
|
|
199
199
|
* - Wrapper props for the table
|
|
200
|
-
* Deprecated props
|
|
201
200
|
*/
|
|
202
201
|
wrapperProps?: Record<string, any>;
|
|
202
|
+
/**
|
|
203
|
+
* - Whether to memoize the filters and body cells. If `true`, both filters and body cells will be memoized. If `'filters'`, only filters will be memoized. If `'cells'`, only body cells will be memoized. Defaults to `false` (no memoization)
|
|
204
|
+
* Deprecated props
|
|
205
|
+
*/
|
|
206
|
+
memo?: boolean | "filters" | "cells";
|
|
203
207
|
/**
|
|
204
208
|
* - Body separator for the table
|
|
205
209
|
*/
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function Cell({ body, col, textFilterSeparator, mrtProps }: {
|
|
2
|
+
body: any;
|
|
3
|
+
col: any;
|
|
4
|
+
textFilterSeparator: any;
|
|
5
|
+
mrtProps: any;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
7
|
+
export const MemoCell: import('react').MemoExoticComponent<({ body, col, textFilterSeparator, mrtProps }: {
|
|
8
|
+
body: any;
|
|
9
|
+
col: any;
|
|
10
|
+
textFilterSeparator: any;
|
|
11
|
+
mrtProps: any;
|
|
12
|
+
}) => import("react").JSX.Element>;
|
|
@@ -13,3 +13,18 @@ export function ColumnHeaderFilter({ children, enableFilterModes, filters, filte
|
|
|
13
13
|
localStorageKey: any;
|
|
14
14
|
mrtProps: any;
|
|
15
15
|
}): import("react").JSX.Element;
|
|
16
|
+
export const MemoColumnHeaderFilter: import('react').MemoExoticComponent<({ children, enableFilterModes, filters, filterFn, filterProps, filterState, filterSync, filterMenu, filterModeDescription, updateQueryParams, withLocalStorage, localStorageKey, mrtProps, }: {
|
|
17
|
+
children: any;
|
|
18
|
+
enableFilterModes: any;
|
|
19
|
+
filters: any;
|
|
20
|
+
filterFn: any;
|
|
21
|
+
filterProps: any;
|
|
22
|
+
filterState: any;
|
|
23
|
+
filterSync: any;
|
|
24
|
+
filterMenu: any;
|
|
25
|
+
filterModeDescription: any;
|
|
26
|
+
updateQueryParams: any;
|
|
27
|
+
withLocalStorage: any;
|
|
28
|
+
localStorageKey: any;
|
|
29
|
+
mrtProps: any;
|
|
30
|
+
}) => import("react").JSX.Element>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function useColumns(columnProps: any, header: any, body: any, textFilterSeparator: any, enableAdvancedFilters: any): {
|
|
1
|
+
export function useColumns(columnProps: any, header: any, body: any, textFilterSeparator: any, enableAdvancedFilters: any, memo: any): {
|
|
2
2
|
columns: any;
|
|
3
3
|
manualFiltering: boolean;
|
|
4
4
|
};
|
|
@@ -26,7 +26,7 @@ function MantineDateTimeInput({ margin, ...props }) {
|
|
|
26
26
|
}
|
|
27
27
|
}, [data, setToLocal, setToUTC]);
|
|
28
28
|
const componentProps = React.useMemo(() => ({ ...commonProps, ...dateProps }), [commonProps, dateProps]);
|
|
29
|
-
const [Component, _props] = useContextProps.useContextProps("DateTime", path, componentProps, props);
|
|
29
|
+
const [Component, { initialUTC: _, ..._props }] = useContextProps.useContextProps("DateTime", path, componentProps, props);
|
|
30
30
|
if (!props.visible) {
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
@@ -24,7 +24,7 @@ function MantineDateTimeInput({ margin, ...props }) {
|
|
|
24
24
|
}
|
|
25
25
|
}, [data, setToLocal, setToUTC]);
|
|
26
26
|
const componentProps = useMemo(() => ({ ...commonProps, ...dateProps }), [commonProps, dateProps]);
|
|
27
|
-
const [Component, _props] = useContextProps("DateTime", path, componentProps, props);
|
|
27
|
+
const [Component, { initialUTC: _, ..._props }] = useContextProps("DateTime", path, componentProps, props);
|
|
28
28
|
if (!props.visible) {
|
|
29
29
|
return null;
|
|
30
30
|
}
|
package/package.json
CHANGED