fastapi-rtk 1.0.43 → 1.0.44
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/_virtual/index11.cjs +2 -2
- package/dist/.bundled/jsonforms/cjs/_virtual/index12.cjs +2 -2
- package/dist/.bundled/jsonforms/cjs/_virtual/index3.cjs +2 -2
- package/dist/.bundled/jsonforms/cjs/_virtual/index4.cjs +2 -2
- package/dist/.bundled/jsonforms/cjs/_virtual/index5.cjs +2 -2
- package/dist/.bundled/jsonforms/esm/_virtual/index11.mjs +2 -2
- package/dist/.bundled/jsonforms/esm/_virtual/index12.mjs +2 -2
- package/dist/.bundled/jsonforms/esm/_virtual/index3.mjs +2 -2
- package/dist/.bundled/jsonforms/esm/_virtual/index4.mjs +2 -2
- package/dist/.bundled/jsonforms/esm/_virtual/index5.mjs +2 -2
- package/dist/.external/cjs/ajv@8.18.0/ajv/dist/compile/codegen/index.cjs +1 -1
- package/dist/.external/cjs/ajv@8.18.0/ajv/dist/compile/validate/index.cjs +1 -1
- package/dist/.external/cjs/ajv@8.18.0/ajv/dist/vocabularies/discriminator/index.cjs +1 -1
- package/dist/.external/cjs/fast-uri@3.1.0/fast-uri/index.cjs +1 -1
- package/dist/.external/cjs/json-schema-traverse@1.0.0/json-schema-traverse/index.cjs +1 -1
- package/dist/.external/cjs/mantine-react-table@2.0.0-beta.9_@mantine_core@7.17.8_@mantine_dates@7.17.8_@mantine_hooks@7._7jqiyi5sshrifwwn7z7vmkfdl4/mantine-react-table/dist/index.esm.cjs +13 -13
- package/dist/.external/esm/ajv@8.18.0/ajv/dist/compile/codegen/index.mjs +1 -1
- package/dist/.external/esm/ajv@8.18.0/ajv/dist/compile/validate/index.mjs +1 -1
- package/dist/.external/esm/ajv@8.18.0/ajv/dist/vocabularies/discriminator/index.mjs +1 -1
- package/dist/.external/esm/fast-uri@3.1.0/fast-uri/index.mjs +1 -1
- package/dist/.external/esm/json-schema-traverse@1.0.0/json-schema-traverse/index.mjs +1 -1
- package/dist/.external/esm/mantine-react-table@2.0.0-beta.9_@mantine_core@7.17.8_@mantine_dates@7.17.8_@mantine_hooks@7._7jqiyi5sshrifwwn7z7vmkfdl4/mantine-react-table/dist/index.esm.mjs +5 -5
- package/dist/core/cjs/Tables/NextGenDataGrid/HooksComponent.cjs +21 -0
- package/dist/core/cjs/Tables/NextGenDataGrid/NextGenDataGrid.cjs +43 -39
- package/dist/core/cjs/Tables/NextGenDataGrid/components/OptimizedMRT_RowSelectColumn/getOptimizedMRT_RowSelectColumnDef.cjs +85 -0
- package/dist/core/cjs/Tables/NextGenDataGrid/components/OptimizedMRT_RowSelectColumn/zustand.cjs +38 -0
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilterInput/ColumnHeaderFilterInput.cjs +25 -10
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useOnLoad.cjs +13 -0
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useOptimizations.cjs +26 -0
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useQueryOnlyVisibleColumns.cjs +20 -0
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useSelection/useSelection.cjs +14 -0
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useToolbarAlertBanner/FASTAPI_RTK_ToolbarAlertBanner.cjs +3 -66
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useToolbarAlertBanner/useToolbarAlertBanner.cjs +12 -3
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useView.cjs +18 -0
- package/dist/core/cjs/Tables/NextGenDataGrid/patch/MRT_TableContainer.cjs +34 -25
- package/dist/core/cjs/Tables/NextGenDataGrid/patch/MRT_TopToolbar.cjs +2 -1
- package/dist/core/cjs/Tables/NextGenDataGrid/patch/body/MRT_TableBody.cjs +146 -0
- package/dist/core/cjs/Tables/NextGenDataGrid/patch/body/MRT_TableBody.module.css.cjs +14 -0
- package/dist/core/cjs/Tables/NextGenDataGrid/patch/body/MRT_TableBodyRow.cjs +164 -0
- package/dist/core/cjs/Tables/NextGenDataGrid/patch/body/MRT_TableBodyRow.module.css.cjs +10 -0
- package/dist/core/cjs/Tables/NextGenDataGrid/patch/table/MRT_Table.cjs +67 -0
- package/dist/core/cjs/Tables/NextGenDataGrid/patch/table/MRT_Table.module.css.cjs +9 -0
- package/dist/core/cjs/Tables/NextGenDataGrid/patch/toolbar/MRT_ToolbarAlertBanner.cjs +132 -0
- package/dist/core/cjs/Tables/NextGenDataGrid/patch/toolbar/MRT_ToolbarAlertBanner.module.css.cjs +13 -0
- package/dist/core/esm/Tables/NextGenDataGrid/HooksComponent.mjs +21 -0
- package/dist/core/esm/Tables/NextGenDataGrid/NextGenDataGrid.mjs +45 -41
- package/dist/core/esm/Tables/NextGenDataGrid/components/OptimizedMRT_RowSelectColumn/getOptimizedMRT_RowSelectColumnDef.mjs +85 -0
- package/dist/core/esm/Tables/NextGenDataGrid/components/OptimizedMRT_RowSelectColumn/zustand.mjs +38 -0
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilterInput/ColumnHeaderFilterInput.mjs +25 -10
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useOnLoad.mjs +13 -0
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useOptimizations.mjs +26 -0
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useQueryOnlyVisibleColumns.mjs +20 -0
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useSelection/useSelection.mjs +14 -0
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useToolbarAlertBanner/FASTAPI_RTK_ToolbarAlertBanner.mjs +5 -68
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useToolbarAlertBanner/useToolbarAlertBanner.mjs +12 -3
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useView.mjs +18 -0
- package/dist/core/esm/Tables/NextGenDataGrid/patch/MRT_TableContainer.mjs +36 -27
- package/dist/core/esm/Tables/NextGenDataGrid/patch/MRT_TopToolbar.mjs +2 -1
- package/dist/core/esm/Tables/NextGenDataGrid/patch/body/MRT_TableBody.mjs +146 -0
- package/dist/core/esm/Tables/NextGenDataGrid/patch/body/MRT_TableBody.module.css.mjs +14 -0
- package/dist/core/esm/Tables/NextGenDataGrid/patch/body/MRT_TableBodyRow.mjs +164 -0
- package/dist/core/esm/Tables/NextGenDataGrid/patch/body/MRT_TableBodyRow.module.css.mjs +10 -0
- package/dist/core/esm/Tables/NextGenDataGrid/patch/table/MRT_Table.mjs +67 -0
- package/dist/core/esm/Tables/NextGenDataGrid/patch/table/MRT_Table.module.css.mjs +9 -0
- package/dist/core/esm/Tables/NextGenDataGrid/patch/toolbar/MRT_ToolbarAlertBanner.mjs +132 -0
- package/dist/core/esm/Tables/NextGenDataGrid/patch/toolbar/MRT_ToolbarAlertBanner.module.css.mjs +13 -0
- package/dist/core/lib/Tables/NextGenDataGrid/HooksComponent.d.ts +7 -0
- package/dist/core/lib/Tables/NextGenDataGrid/NextGenDataGrid.d.ts +15 -1
- package/dist/core/lib/Tables/NextGenDataGrid/components/OptimizedMRT_RowSelectColumn/index.d.ts +2 -0
- package/dist/core/lib/Tables/NextGenDataGrid/components/OptimizedMRT_RowSelectColumn/zustand.d.ts +24 -0
- package/dist/core/lib/Tables/NextGenDataGrid/components/index.d.ts +1 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useOnLoad.d.ts +1 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useOptimizations.d.ts +5 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useQueryOnlyVisibleColumns.d.ts +1 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useSelection/useSelection.d.ts +4 -0
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useToolbarAlertBanner/FASTAPI_RTK_ToolbarAlertBanner.d.ts +4 -2
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useToolbarAlertBanner/useToolbarAlertBanner.d.ts +4 -2
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useView.d.ts +1 -0
- package/dist/core/lib/Tables/NextGenDataGrid/patch/body/MRT_TableBody.d.ts +12 -0
- package/dist/core/lib/Tables/NextGenDataGrid/patch/body/MRT_TableBodyRow.d.ts +26 -0
- package/dist/core/lib/Tables/NextGenDataGrid/patch/table/MRT_Table.d.ts +4 -0
- package/dist/core/lib/Tables/NextGenDataGrid/patch/toolbar/MRT_ToolbarAlertBanner.d.ts +5 -0
- package/dist/core/styles.css +273 -0
- package/dist/utils/cjs/{MemoWrapper → Memoizer}/MemoWrapper.cjs +1 -1
- package/dist/utils/cjs/Memoizer/RenderWrapper.cjs +20 -0
- package/dist/utils/cjs/index.cjs +3 -1
- package/dist/utils/esm/{MemoWrapper → Memoizer}/MemoWrapper.mjs +1 -1
- package/dist/utils/esm/Memoizer/RenderWrapper.mjs +20 -0
- package/dist/utils/esm/index.mjs +3 -1
- package/dist/utils/lib/Memoizer/RenderWrapper.d.ts +10 -0
- package/dist/utils/lib/Memoizer/index.d.ts +2 -0
- package/dist/utils/lib/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useCheckbox.cjs +0 -6
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useCheckbox.mjs +0 -6
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useCheckbox.d.ts +0 -3
- package/dist/utils/lib/MemoWrapper/index.d.ts +0 -1
- /package/dist/utils/lib/{MemoWrapper → Memoizer}/MemoWrapper.d.ts +0 -0
package/dist/core/esm/Tables/NextGenDataGrid/components/OptimizedMRT_RowSelectColumn/zustand.mjs
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { create } from "../../../../../../.external/esm/zustand@5.0.11_@types_react@19.2.14_react@19.2.4/zustand/esm/react.mjs";
|
|
2
|
+
const selectionStoreFactory = () => create((set, get) => ({
|
|
3
|
+
rowSelection: {},
|
|
4
|
+
getIsAllRowsSelected: (table) => {
|
|
5
|
+
const rowModel = table.getRowModel();
|
|
6
|
+
return rowModel.rows.length > 0 && rowModel.rows.every((row) => get().rowSelection[row.id]);
|
|
7
|
+
},
|
|
8
|
+
getIsSomeRowsSelected: (table) => {
|
|
9
|
+
const rowModel = table.getRowModel();
|
|
10
|
+
return rowModel.rows.some((row) => get().rowSelection[row.id]);
|
|
11
|
+
},
|
|
12
|
+
toggleRowSelected: (rowId) => set((state) => {
|
|
13
|
+
const isSelected = state.rowSelection[rowId];
|
|
14
|
+
const newRowSelection = { ...state.rowSelection };
|
|
15
|
+
if (isSelected) {
|
|
16
|
+
delete newRowSelection[rowId];
|
|
17
|
+
} else {
|
|
18
|
+
newRowSelection[rowId] = true;
|
|
19
|
+
}
|
|
20
|
+
return { rowSelection: newRowSelection };
|
|
21
|
+
}),
|
|
22
|
+
toggleAllRowsSelected: (table, value) => set((state) => {
|
|
23
|
+
const newRowSelection = { ...state.rowSelection };
|
|
24
|
+
table.getRowModel().rows.forEach((row) => {
|
|
25
|
+
if (value) {
|
|
26
|
+
newRowSelection[row.id] = true;
|
|
27
|
+
} else {
|
|
28
|
+
delete newRowSelection[row.id];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
return { rowSelection: newRowSelection };
|
|
32
|
+
})
|
|
33
|
+
}));
|
|
34
|
+
const useSelectionStore = (store, selector) => store(selector);
|
|
35
|
+
export {
|
|
36
|
+
selectionStoreFactory,
|
|
37
|
+
useSelectionStore
|
|
38
|
+
};
|
|
@@ -154,10 +154,6 @@ function ColumnHeaderFilterInput({
|
|
|
154
154
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
155
155
|
[actionIconProps]
|
|
156
156
|
);
|
|
157
|
-
const configuration = useMemo(
|
|
158
|
-
() => parseFromValuesOrFunc(enableFilterModes ? mergeProps(filterProps, opr) : filterProps, functionProps),
|
|
159
|
-
[enableFilterModes, filterProps, functionProps, opr]
|
|
160
|
-
);
|
|
161
157
|
const headerInputProps = useMemo(
|
|
162
158
|
() => {
|
|
163
159
|
var _a2, _b2;
|
|
@@ -207,13 +203,20 @@ function ColumnHeaderFilterInput({
|
|
|
207
203
|
if (node) {
|
|
208
204
|
mrtProps.table.refs.filterInputRefs.current[`${mrtProps.column.id}-0`] = node;
|
|
209
205
|
}
|
|
210
|
-
}
|
|
211
|
-
...field.isDirty() ? { clearIcon: /* @__PURE__ */ jsx(CloseButton, { ...clearIconProps }) } : {},
|
|
212
|
-
...configuration,
|
|
213
|
-
cleariconprops: clearIconProps
|
|
206
|
+
}
|
|
214
207
|
};
|
|
215
208
|
},
|
|
216
|
-
|
|
209
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
210
|
+
[filters.length, t]
|
|
211
|
+
);
|
|
212
|
+
const headerIconProps = useMemo(
|
|
213
|
+
() => field.isDirty() ? { clearIcon: /* @__PURE__ */ jsx(CloseButton, { ...clearIconProps }), cleariconprops: clearIconProps } : {},
|
|
214
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
215
|
+
[clearIconProps, field.isDirty()]
|
|
216
|
+
);
|
|
217
|
+
const configuration = parseFromValuesOrFunc(
|
|
218
|
+
enableFilterModes ? mergeProps(filterProps, opr) : filterProps,
|
|
219
|
+
functionProps
|
|
217
220
|
);
|
|
218
221
|
return /* @__PURE__ */ jsx(
|
|
219
222
|
MemoWrapper,
|
|
@@ -222,7 +225,19 @@ function ColumnHeaderFilterInput({
|
|
|
222
225
|
component,
|
|
223
226
|
value: field.getInputProps().value,
|
|
224
227
|
headerInputProps,
|
|
225
|
-
|
|
228
|
+
headerIconProps,
|
|
229
|
+
configuration,
|
|
230
|
+
children: /* @__PURE__ */ jsx(
|
|
231
|
+
HeaderInput,
|
|
232
|
+
{
|
|
233
|
+
component,
|
|
234
|
+
field,
|
|
235
|
+
...field.getInputProps(),
|
|
236
|
+
...headerInputProps,
|
|
237
|
+
...headerIconProps,
|
|
238
|
+
...configuration
|
|
239
|
+
}
|
|
240
|
+
)
|
|
226
241
|
}
|
|
227
242
|
);
|
|
228
243
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useApi } from "../../../hooks/api/useApi.mjs";
|
|
3
|
+
const useOnLoad = (fetchOnMount) => {
|
|
4
|
+
const { queryParams, refetch } = useApi();
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
if (!queryParams && fetchOnMount) {
|
|
7
|
+
refetch();
|
|
8
|
+
}
|
|
9
|
+
}, []);
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
useOnLoad
|
|
13
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useMemo, useEffect } from "react";
|
|
2
|
+
import { getOptimizedMRT_RowSelectColumnDef } from "../components/OptimizedMRT_RowSelectColumn/getOptimizedMRT_RowSelectColumnDef.mjs";
|
|
3
|
+
import { useSelectionStore } from "../components/OptimizedMRT_RowSelectColumn/zustand.mjs";
|
|
4
|
+
const useOptimizations = (tableOptions, columns, optimizations) => {
|
|
5
|
+
const { enableRowSelection } = tableOptions;
|
|
6
|
+
return useMemo(
|
|
7
|
+
() => (optimizations == null ? void 0 : optimizations.selection) && enableRowSelection ? { columns: [getOptimizedMRT_RowSelectColumnDef(tableOptions), ...columns], enableRowSelection: false } : void 0,
|
|
8
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
9
|
+
[columns, enableRowSelection, optimizations == null ? void 0 : optimizations.selection]
|
|
10
|
+
);
|
|
11
|
+
};
|
|
12
|
+
const useTableOptimizations = (table, onSelectCheckbox, bulkActions, optimizations) => {
|
|
13
|
+
const store = table.refs.selectionStoreRef.current;
|
|
14
|
+
const optimizedRowSelection = useSelectionStore(store, (state) => state.rowSelection);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!(optimizations == null ? void 0 : optimizations.selection)) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
onSelectCheckbox == null ? void 0 : onSelectCheckbox(Object.keys(optimizedRowSelection));
|
|
20
|
+
bulkActions == null ? void 0 : bulkActions.setSelectedIds(Object.keys(optimizedRowSelection));
|
|
21
|
+
}, [bulkActions, onSelectCheckbox, optimizedRowSelection]);
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
useOptimizations,
|
|
25
|
+
useTableOptimizations
|
|
26
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useApi } from "../../../hooks/api/useApi.mjs";
|
|
3
|
+
const useQueryOnlyVisibleColumns = (table, queryOnlyVisibleColumns) => {
|
|
4
|
+
const { data, setQueryParams } = useApi();
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
if (!queryOnlyVisibleColumns || !(data == null ? void 0 : data.list_columns)) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const columnVisibility = table.getState().columnVisibility;
|
|
10
|
+
const visibleColumns = table.getAllColumns().filter((col) => columnVisibility[col.id] !== false).filter((col) => data.list_columns.includes(col.id));
|
|
11
|
+
if (data.list_columns.length === visibleColumns.length) {
|
|
12
|
+
setQueryParams({ columns: [] });
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
setQueryParams({ columns: visibleColumns.map((col) => col.id) });
|
|
16
|
+
}, [table.getState().columnVisibility, setQueryParams]);
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
useQueryOnlyVisibleColumns
|
|
20
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
function useSelection(onSelectCheckbox, bulkActions) {
|
|
3
|
+
return { enableRowSelection: !!onSelectCheckbox || !!bulkActions };
|
|
4
|
+
}
|
|
5
|
+
const useTableSelection = (table, onSelectCheckbox, bulkActions) => {
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
onSelectCheckbox == null ? void 0 : onSelectCheckbox(Object.keys(table.getState().rowSelection));
|
|
8
|
+
bulkActions == null ? void 0 : bulkActions.setSelectedIds(Object.keys(table.getState().rowSelection));
|
|
9
|
+
}, [bulkActions, table.getState().rowSelection, onSelectCheckbox]);
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
useSelection,
|
|
13
|
+
useTableSelection
|
|
14
|
+
};
|
|
@@ -1,30 +1,15 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { parseFromValuesOrFunc, getValueOrDefault } from "fastapi-rtk/utils";
|
|
3
|
-
import { Flex,
|
|
3
|
+
import { Flex, Group, Stack } from "@mantine/core";
|
|
4
4
|
import { clsx } from "../../../../../../.external/esm/clsx@2.1.1/clsx/dist/clsx.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import { useMemo, Fragment } from "react";
|
|
5
|
+
import { MRT_SelectCheckbox } from "../../../../../../.external/esm/mantine-react-table@2.0.0-beta.9_@mantine_core@7.17.8_@mantine_dates@7.17.8_@mantine_hooks@7._7jqiyi5sshrifwwn7z7vmkfdl4/mantine-react-table/dist/index.esm.mjs";
|
|
7
6
|
import classes from "./FASTAPI_RTK_ToolbarAlertBanner.module.css.mjs";
|
|
8
|
-
const FASTAPI_RTK_ToolbarAlertBanner = ({
|
|
9
|
-
var _a, _b;
|
|
7
|
+
const FASTAPI_RTK_ToolbarAlertBanner = ({ groupedAlert, selectedAlert, table, alertBanner, ...rest }) => {
|
|
10
8
|
const {
|
|
11
|
-
getFilteredSelectedRowModel,
|
|
12
|
-
getPrePaginationRowModel,
|
|
13
9
|
getState,
|
|
14
|
-
|
|
15
|
-
options: {
|
|
16
|
-
enableRowSelection,
|
|
17
|
-
enableSelectAll,
|
|
18
|
-
icons: { IconX },
|
|
19
|
-
localization,
|
|
20
|
-
mantineToolbarAlertBannerBadgeProps,
|
|
21
|
-
mantineToolbarAlertBannerProps,
|
|
22
|
-
manualPagination,
|
|
23
|
-
positionToolbarAlertBanner,
|
|
24
|
-
rowCount
|
|
25
|
-
}
|
|
10
|
+
options: { enableRowSelection, enableSelectAll, mantineToolbarAlertBannerProps, positionToolbarAlertBanner }
|
|
26
11
|
} = table;
|
|
27
|
-
const { density
|
|
12
|
+
const { density } = getState();
|
|
28
13
|
const { left, right, renderToolbarAlertBannerContent, wrapperProps } = alertBanner ?? {};
|
|
29
14
|
const { flex, group, stack } = wrapperProps ?? {};
|
|
30
15
|
const alertProps = {
|
|
@@ -33,54 +18,6 @@ const FASTAPI_RTK_ToolbarAlertBanner = ({ alertBanner, table, ...rest }) => {
|
|
|
33
18
|
}),
|
|
34
19
|
...rest
|
|
35
20
|
};
|
|
36
|
-
const badgeProps = parseFromValuesOrFunc(mantineToolbarAlertBannerBadgeProps, { table });
|
|
37
|
-
const totalRowCount = rowCount ?? getPrePaginationRowModel().flatRows.length;
|
|
38
|
-
const selectedRowCount = useMemo(
|
|
39
|
-
() => manualPagination ? Object.values(rowSelection).filter(Boolean).length : getFilteredSelectedRowModel().rows.length,
|
|
40
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
41
|
-
[rowSelection, totalRowCount, manualPagination]
|
|
42
|
-
);
|
|
43
|
-
const selectedAlert = selectedRowCount ? /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "sm", children: [
|
|
44
|
-
(_b = (_a = localization.selectedCountOfRowCountRowsSelected) == null ? void 0 : _a.replace("{selectedCount}", selectedRowCount.toString())) == null ? void 0 : _b.replace("{rowCount}", totalRowCount.toString()),
|
|
45
|
-
/* @__PURE__ */ jsx(Button, { onClick: resetRowSelection, size: "compact-xs", variant: "subtle", children: localization.clearSelection }),
|
|
46
|
-
/* @__PURE__ */ jsx(
|
|
47
|
-
Button,
|
|
48
|
-
{
|
|
49
|
-
onClick: (event) => getMRT_SelectAllHandler({ table })(event, false, true),
|
|
50
|
-
size: "compact-xs",
|
|
51
|
-
variant: "subtle",
|
|
52
|
-
children: localization.clearSelectionOnThisPage ?? "Clear selection on this page"
|
|
53
|
-
}
|
|
54
|
-
)
|
|
55
|
-
] }) : null;
|
|
56
|
-
const groupedAlert = grouping.length > 0 ? /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
|
|
57
|
-
localization.groupedBy,
|
|
58
|
-
grouping.map((columnId, index) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
59
|
-
index > 0 ? localization.thenBy : "",
|
|
60
|
-
/* @__PURE__ */ jsxs(
|
|
61
|
-
Badge,
|
|
62
|
-
{
|
|
63
|
-
className: "alert-badge",
|
|
64
|
-
rightSection: /* @__PURE__ */ jsx(
|
|
65
|
-
ActionIcon,
|
|
66
|
-
{
|
|
67
|
-
color: "white",
|
|
68
|
-
onClick: () => table.getColumn(columnId).toggleGrouping(),
|
|
69
|
-
size: "xs",
|
|
70
|
-
variant: "subtle",
|
|
71
|
-
children: /* @__PURE__ */ jsx(IconX, { style: { transform: "scale(0.8)" } })
|
|
72
|
-
}
|
|
73
|
-
),
|
|
74
|
-
variant: "filled",
|
|
75
|
-
...badgeProps,
|
|
76
|
-
children: [
|
|
77
|
-
table.getColumn(columnId).columnDef.header,
|
|
78
|
-
" "
|
|
79
|
-
]
|
|
80
|
-
}
|
|
81
|
-
)
|
|
82
|
-
] }, `${index}-${columnId}`))
|
|
83
|
-
] }) : null;
|
|
84
21
|
return /* @__PURE__ */ jsxs(
|
|
85
22
|
Flex,
|
|
86
23
|
{
|
package/dist/core/esm/Tables/NextGenDataGrid/hooks/useToolbarAlertBanner/useToolbarAlertBanner.mjs
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
import { FASTAPI_RTK_ToolbarAlertBanner } from "./FASTAPI_RTK_ToolbarAlertBanner.mjs";
|
|
4
|
-
function useToolbarAlertBanner(toolbar) {
|
|
4
|
+
function useToolbarAlertBanner(toolbar, optimizations) {
|
|
5
5
|
const { alertBanner } = toolbar;
|
|
6
6
|
return useMemo(
|
|
7
7
|
() => ({
|
|
8
|
-
renderToolbarAlertBannerContent: ({ table }) => /* @__PURE__ */ jsx(
|
|
8
|
+
renderToolbarAlertBannerContent: ({ groupedAlert, selectedAlert, table }) => /* @__PURE__ */ jsx(
|
|
9
|
+
FASTAPI_RTK_ToolbarAlertBanner,
|
|
10
|
+
{
|
|
11
|
+
groupedAlert,
|
|
12
|
+
selectedAlert,
|
|
13
|
+
table,
|
|
14
|
+
alertBanner,
|
|
15
|
+
optimizations
|
|
16
|
+
}
|
|
17
|
+
)
|
|
9
18
|
}),
|
|
10
|
-
[alertBanner]
|
|
19
|
+
[alertBanner, optimizations]
|
|
11
20
|
);
|
|
12
21
|
}
|
|
13
22
|
export {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useForms } from "../../../hooks/api/useForms.mjs";
|
|
3
|
+
const useView = (form) => {
|
|
4
|
+
const { setView: setViewAdd } = useForms("add");
|
|
5
|
+
const { setView: setViewEdit } = useForms("edit");
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
if ((_a = form == null ? void 0 : form.add) == null ? void 0 : _a.initialView) {
|
|
9
|
+
setViewAdd(form.add.initialView);
|
|
10
|
+
}
|
|
11
|
+
if ((_b = form == null ? void 0 : form.edit) == null ? void 0 : _b.initialView) {
|
|
12
|
+
setViewEdit(form.edit.initialView);
|
|
13
|
+
}
|
|
14
|
+
}, []);
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
useView
|
|
18
|
+
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { parseFromValuesOrFunc } from "fastapi-rtk/utils";
|
|
2
|
+
import { parseFromValuesOrFunc, RenderWrapper } from "fastapi-rtk/utils";
|
|
3
3
|
import { Box, LoadingOverlay } from "@mantine/core";
|
|
4
4
|
import { clsx } from "../../../../../.external/esm/clsx@2.1.1/clsx/dist/clsx.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { MRT_EditRowModal } from "../../../../../.external/esm/mantine-react-table@2.0.0-beta.9_@mantine_core@7.17.8_@mantine_dates@7.17.8_@mantine_hooks@7._7jqiyi5sshrifwwn7z7vmkfdl4/mantine-react-table/dist/index.esm.mjs";
|
|
6
6
|
import { useState, useLayoutEffect, useEffect } from "react";
|
|
7
7
|
import classes from "./MRT_TableContainer.module.css.mjs";
|
|
8
|
+
import { MRT_Table } from "./table/MRT_Table.mjs";
|
|
8
9
|
const useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
9
10
|
const MRT_TableContainer = ({ table, ...rest }) => {
|
|
10
11
|
const {
|
|
@@ -35,6 +36,7 @@ const MRT_TableContainer = ({ table, ...rest }) => {
|
|
|
35
36
|
const createModalOpen = createDisplayMode === "modal" && creatingRow;
|
|
36
37
|
const editModalOpen = editDisplayMode === "modal" && editingRow;
|
|
37
38
|
const tableContainerWrapperProps = parseFromValuesOrFunc(mantineTableContainerWrapperProps, { table });
|
|
39
|
+
const optimizations = table.refs.optimizations.current;
|
|
38
40
|
return /* @__PURE__ */ jsxs(
|
|
39
41
|
Box,
|
|
40
42
|
{
|
|
@@ -43,33 +45,40 @@ const MRT_TableContainer = ({ table, ...rest }) => {
|
|
|
43
45
|
className: clsx("mrt-table-container-wrapper", tableContainerWrapperProps == null ? void 0 : tableContainerWrapperProps.className),
|
|
44
46
|
children: [
|
|
45
47
|
/* @__PURE__ */ jsx(LoadingOverlay, { visible: isLoading || showLoadingOverlay, zIndex: 2, ...loadingOverlayProps }),
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
|
|
48
|
+
/* @__PURE__ */ jsx(
|
|
49
|
+
RenderWrapper,
|
|
48
50
|
{
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
51
|
+
componentName: "MRT_TableContainer",
|
|
52
|
+
render: (optimizations == null ? void 0 : optimizations.loading) ? !(isLoading || showLoadingOverlay || (loadingOverlayProps == null ? void 0 : loadingOverlayProps.visible)) : true,
|
|
53
|
+
children: /* @__PURE__ */ jsxs(
|
|
54
|
+
Box,
|
|
55
|
+
{
|
|
56
|
+
...tableContainerProps,
|
|
57
|
+
__vars: {
|
|
58
|
+
"--mrt-top-toolbar-height": `${totalToolbarHeight}`,
|
|
59
|
+
...tableContainerProps == null ? void 0 : tableContainerProps.__vars
|
|
60
|
+
},
|
|
61
|
+
className: clsx(
|
|
62
|
+
"mrt-table-container",
|
|
63
|
+
classes.root,
|
|
64
|
+
enableStickyHeader && classes["root-sticky"],
|
|
65
|
+
isFullScreen && classes["root-fullscreen"],
|
|
66
|
+
tableContainerProps == null ? void 0 : tableContainerProps.className
|
|
67
|
+
),
|
|
68
|
+
ref: (node) => {
|
|
69
|
+
if (node) {
|
|
70
|
+
tableContainerRef.current = node;
|
|
71
|
+
if (tableContainerProps == null ? void 0 : tableContainerProps.ref) {
|
|
72
|
+
tableContainerProps.ref.current = node;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ jsx(MRT_Table, { table }),
|
|
78
|
+
(createModalOpen || editModalOpen) && /* @__PURE__ */ jsx(MRT_EditRowModal, { open: true, table })
|
|
79
|
+
]
|
|
67
80
|
}
|
|
68
|
-
|
|
69
|
-
children: [
|
|
70
|
-
/* @__PURE__ */ jsx(MRT_Table, { table }),
|
|
71
|
-
(createModalOpen || editModalOpen) && /* @__PURE__ */ jsx(MRT_EditRowModal, { open: true, table })
|
|
72
|
-
]
|
|
81
|
+
)
|
|
73
82
|
}
|
|
74
83
|
)
|
|
75
84
|
]
|
|
@@ -3,9 +3,10 @@ import { parseFromValuesOrFunc } from "fastapi-rtk/utils";
|
|
|
3
3
|
import { Box, Group, Flex, Center } from "@mantine/core";
|
|
4
4
|
import { useMediaQuery } from "@mantine/hooks";
|
|
5
5
|
import { clsx } from "../../../../../.external/esm/clsx@2.1.1/clsx/dist/clsx.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { MRT_ToolbarDropZone, MRT_GlobalFilterTextInput, MRT_ToolbarInternalButtons, MRT_TablePagination, MRT_ProgressBar } from "../../../../../.external/esm/mantine-react-table@2.0.0-beta.9_@mantine_core@7.17.8_@mantine_dates@7.17.8_@mantine_hooks@7._7jqiyi5sshrifwwn7z7vmkfdl4/mantine-react-table/dist/index.esm.mjs";
|
|
7
7
|
import commonClasses from "./common.styles.module.css.mjs";
|
|
8
8
|
import classes from "./MRT_TopToolbar.module.css.mjs";
|
|
9
|
+
import { MRT_ToolbarAlertBanner } from "./toolbar/MRT_ToolbarAlertBanner.mjs";
|
|
9
10
|
const MRT_TopToolbar = ({ table, ...rest }) => {
|
|
10
11
|
const {
|
|
11
12
|
getState,
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { clsx } from "../../../../../../.external/esm/clsx@2.1.1/clsx/dist/clsx.mjs";
|
|
3
|
+
import classes from "./MRT_TableBody.module.css.mjs";
|
|
4
|
+
import { memo, useMemo } from "react";
|
|
5
|
+
import { parseFromValuesOrFunc } from "fastapi-rtk/utils";
|
|
6
|
+
import { TableTbody } from "@mantine/core";
|
|
7
|
+
import { useMRT_Rows, useMRT_RowVirtualizer, MRT_TableBodyEmptyRow } from "../../../../../../.external/esm/mantine-react-table@2.0.0-beta.9_@mantine_core@7.17.8_@mantine_dates@7.17.8_@mantine_hooks@7._7jqiyi5sshrifwwn7z7vmkfdl4/mantine-react-table/dist/index.esm.mjs";
|
|
8
|
+
import { Memo_MRT_TableBodyRow, MRT_TableBodyRow } from "./MRT_TableBodyRow.mjs";
|
|
9
|
+
const MRT_TableBody = ({ columnVirtualizer, table, tableProps, ...rest }) => {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
const {
|
|
12
|
+
getBottomRows,
|
|
13
|
+
getIsSomeRowsPinned,
|
|
14
|
+
getRowModel,
|
|
15
|
+
getState,
|
|
16
|
+
getTopRows,
|
|
17
|
+
options: {
|
|
18
|
+
enableStickyFooter,
|
|
19
|
+
enableStickyHeader,
|
|
20
|
+
layoutMode,
|
|
21
|
+
mantineTableBodyProps,
|
|
22
|
+
memoMode,
|
|
23
|
+
renderDetailPanel,
|
|
24
|
+
rowPinningDisplayMode
|
|
25
|
+
},
|
|
26
|
+
refs: { tableFooterRef, tableHeadRef }
|
|
27
|
+
} = table;
|
|
28
|
+
const { isFullScreen, rowPinning } = getState();
|
|
29
|
+
const tableBodyProps = {
|
|
30
|
+
...parseFromValuesOrFunc(mantineTableBodyProps, { table }),
|
|
31
|
+
...rest
|
|
32
|
+
};
|
|
33
|
+
const tableHeadHeight = (enableStickyHeader || isFullScreen) && ((_a = tableHeadRef.current) == null ? void 0 : _a.clientHeight) || 0;
|
|
34
|
+
const tableFooterHeight = enableStickyFooter && ((_b = tableFooterRef.current) == null ? void 0 : _b.clientHeight) || 0;
|
|
35
|
+
const pinnedRowIds = useMemo(() => {
|
|
36
|
+
var _a2, _b2;
|
|
37
|
+
if (!((_a2 = rowPinning.bottom) == null ? void 0 : _a2.length) && !((_b2 = rowPinning.top) == null ? void 0 : _b2.length)) return [];
|
|
38
|
+
return getRowModel().rows.filter((row) => row.getIsPinned()).map((r) => r.id);
|
|
39
|
+
}, [rowPinning, getRowModel().rows]);
|
|
40
|
+
const rows = useMRT_Rows(table);
|
|
41
|
+
const rowVirtualizer = useMRT_RowVirtualizer(table, rows);
|
|
42
|
+
const { virtualRows } = rowVirtualizer ?? {};
|
|
43
|
+
const commonRowProps = {
|
|
44
|
+
columnVirtualizer,
|
|
45
|
+
numRows: rows.length,
|
|
46
|
+
table,
|
|
47
|
+
tableProps
|
|
48
|
+
};
|
|
49
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
50
|
+
!(rowPinningDisplayMode == null ? void 0 : rowPinningDisplayMode.includes("sticky")) && getIsSomeRowsPinned("top") && /* @__PURE__ */ jsx(
|
|
51
|
+
TableTbody,
|
|
52
|
+
{
|
|
53
|
+
...tableBodyProps,
|
|
54
|
+
__vars: {
|
|
55
|
+
"--mrt-table-head-height": `${tableHeadHeight}`,
|
|
56
|
+
...tableBodyProps == null ? void 0 : tableBodyProps.__vars
|
|
57
|
+
},
|
|
58
|
+
className: clsx(
|
|
59
|
+
classes.pinned,
|
|
60
|
+
(layoutMode == null ? void 0 : layoutMode.startsWith("grid")) && classes["root-grid"],
|
|
61
|
+
tableBodyProps == null ? void 0 : tableBodyProps.className
|
|
62
|
+
),
|
|
63
|
+
children: getTopRows().map((row, renderedRowIndex) => {
|
|
64
|
+
const rowProps = {
|
|
65
|
+
...commonRowProps,
|
|
66
|
+
renderedRowIndex,
|
|
67
|
+
row
|
|
68
|
+
};
|
|
69
|
+
return memoMode === "rows" ? /* @__PURE__ */ jsx(Memo_MRT_TableBodyRow, { ...rowProps }, row.id) : /* @__PURE__ */ jsx(MRT_TableBodyRow, { ...rowProps }, row.id);
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ jsx(
|
|
74
|
+
TableTbody,
|
|
75
|
+
{
|
|
76
|
+
...tableBodyProps,
|
|
77
|
+
__vars: {
|
|
78
|
+
"--mrt-table-body-height": rowVirtualizer ? `${rowVirtualizer.getTotalSize()}px` : void 0,
|
|
79
|
+
...tableBodyProps == null ? void 0 : tableBodyProps.__vars
|
|
80
|
+
},
|
|
81
|
+
className: clsx(
|
|
82
|
+
classes.root,
|
|
83
|
+
(layoutMode == null ? void 0 : layoutMode.startsWith("grid")) && classes["root-grid"],
|
|
84
|
+
!rows.length && classes["root-no-rows"],
|
|
85
|
+
rowVirtualizer && classes["root-virtualized"],
|
|
86
|
+
tableBodyProps == null ? void 0 : tableBodyProps.className
|
|
87
|
+
),
|
|
88
|
+
children: (tableBodyProps == null ? void 0 : tableBodyProps.children) ?? (!rows.length ? /* @__PURE__ */ jsx(MRT_TableBodyEmptyRow, { ...commonRowProps }) : /* @__PURE__ */ jsx(Fragment, { children: (virtualRows ?? rows).map((rowOrVirtualRow, renderedRowIndex) => {
|
|
89
|
+
if (rowVirtualizer) {
|
|
90
|
+
if (renderDetailPanel) {
|
|
91
|
+
if (rowOrVirtualRow.index % 2 === 1) {
|
|
92
|
+
return null;
|
|
93
|
+
} else {
|
|
94
|
+
renderedRowIndex = rowOrVirtualRow.index / 2;
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
renderedRowIndex = rowOrVirtualRow.index;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const row = rowVirtualizer ? rows[renderedRowIndex] : rowOrVirtualRow;
|
|
101
|
+
const props = {
|
|
102
|
+
...commonRowProps,
|
|
103
|
+
pinnedRowIds,
|
|
104
|
+
renderedRowIndex,
|
|
105
|
+
row,
|
|
106
|
+
rowVirtualizer,
|
|
107
|
+
virtualRow: rowVirtualizer ? rowOrVirtualRow : void 0
|
|
108
|
+
};
|
|
109
|
+
const key = `${row.id}-${row.index}`;
|
|
110
|
+
return memoMode === "rows" ? /* @__PURE__ */ jsx(Memo_MRT_TableBodyRow, { ...props }, key) : /* @__PURE__ */ jsx(MRT_TableBodyRow, { ...props }, key);
|
|
111
|
+
}) }))
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
!(rowPinningDisplayMode == null ? void 0 : rowPinningDisplayMode.includes("sticky")) && getIsSomeRowsPinned("bottom") && /* @__PURE__ */ jsx(
|
|
115
|
+
TableTbody,
|
|
116
|
+
{
|
|
117
|
+
...tableBodyProps,
|
|
118
|
+
__vars: {
|
|
119
|
+
"--mrt-table-footer-height": `${tableFooterHeight}`,
|
|
120
|
+
...tableBodyProps == null ? void 0 : tableBodyProps.__vars
|
|
121
|
+
},
|
|
122
|
+
className: clsx(
|
|
123
|
+
classes.pinned,
|
|
124
|
+
(layoutMode == null ? void 0 : layoutMode.startsWith("grid")) && classes["root-grid"],
|
|
125
|
+
tableBodyProps == null ? void 0 : tableBodyProps.className
|
|
126
|
+
),
|
|
127
|
+
children: getBottomRows().map((row, renderedRowIndex) => {
|
|
128
|
+
const props = {
|
|
129
|
+
...commonRowProps,
|
|
130
|
+
renderedRowIndex,
|
|
131
|
+
row
|
|
132
|
+
};
|
|
133
|
+
return memoMode === "rows" ? /* @__PURE__ */ jsx(Memo_MRT_TableBodyRow, { ...props }, row.id) : /* @__PURE__ */ jsx(MRT_TableBodyRow, { ...props }, row.id);
|
|
134
|
+
})
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
] });
|
|
138
|
+
};
|
|
139
|
+
const Memo_MRT_TableBody = memo(
|
|
140
|
+
MRT_TableBody,
|
|
141
|
+
(prev, next) => prev.table.options.data === next.table.options.data
|
|
142
|
+
);
|
|
143
|
+
export {
|
|
144
|
+
MRT_TableBody,
|
|
145
|
+
Memo_MRT_TableBody
|
|
146
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const root = "_root_1cl4e_1";
|
|
2
|
+
const pinned = "_pinned_1cl4e_37";
|
|
3
|
+
const classes = {
|
|
4
|
+
root,
|
|
5
|
+
"root-grid": "_root-grid_1cl4e_6",
|
|
6
|
+
"root-no-rows": "_root-no-rows_1cl4e_10",
|
|
7
|
+
"root-virtualized": "_root-virtualized_1cl4e_14",
|
|
8
|
+
pinned
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
classes as default,
|
|
12
|
+
pinned,
|
|
13
|
+
root
|
|
14
|
+
};
|