fastapi-rtk 0.2.9 → 0.2.11

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.
Files changed (29) hide show
  1. package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/MantineInputs/MantineDateTimeInput.cjs +1 -1
  2. package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/MantineInputs/MantineDateTimeInput.mjs +1 -1
  3. package/dist/core/cjs/ActionIcons/Edit/EditDialog.cjs +22 -12
  4. package/dist/core/cjs/ActionIcons/Modals/CommonModal.cjs +2 -1
  5. package/dist/core/cjs/Tables/NextGenDataGrid/NextGenDataGrid.cjs +16 -2
  6. package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/{Body.cjs → Cell.cjs} +19 -18
  7. package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter.cjs +5 -0
  8. package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/useColumns.cjs +66 -23
  9. package/dist/core/cjs/_virtual/_commonjsHelpers.cjs +2 -0
  10. package/dist/core/cjs/_virtual/lodash.cjs +5 -0
  11. package/dist/core/cjs/_virtual/lodash2.cjs +4 -0
  12. package/dist/core/esm/ActionIcons/Edit/EditDialog.mjs +23 -13
  13. package/dist/core/esm/ActionIcons/Modals/CommonModal.mjs +2 -1
  14. package/dist/core/esm/Tables/NextGenDataGrid/NextGenDataGrid.mjs +16 -2
  15. package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/{Body.mjs → Cell.mjs} +20 -19
  16. package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter.mjs +7 -2
  17. package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/useColumns.mjs +67 -24
  18. package/dist/core/esm/_virtual/_commonjsHelpers.mjs +2 -0
  19. package/dist/core/esm/_virtual/lodash.mjs +5 -0
  20. package/dist/core/esm/_virtual/lodash2.mjs +4 -0
  21. package/dist/core/lib/ActionIcons/Modals/CommonModal.d.ts +37 -14
  22. package/dist/core/lib/Tables/NextGenDataGrid/NextGenDataGrid.d.ts +92 -4
  23. package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/Cell.d.ts +12 -0
  24. package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter.d.ts +15 -0
  25. package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/useColumns.d.ts +1 -1
  26. package/dist/jsonforms/cjs/MantineInputs/MantineDateTimeInput.cjs +1 -1
  27. package/dist/jsonforms/esm/MantineInputs/MantineDateTimeInput.mjs +1 -1
  28. package/package.json +1 -1
  29. package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/Body.d.ts +0 -6
@@ -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
  }
@@ -5,6 +5,7 @@ const constants = require("fastapi-rtk/constants");
5
5
  const utils = require("fastapi-rtk/utils");
6
6
  const core = require("@mantine/core");
7
7
  const hooks = require("@mantine/hooks");
8
+ const lodash = require("../../_virtual/lodash.cjs");
8
9
  const React = require("react");
9
10
  const convertToFormInputs = require("../../fab-react-toolkit-patch/utils/convertToFormInputs.cjs");
10
11
  const useApi = require("../../hooks/api/useApi.cjs");
@@ -23,11 +24,31 @@ function EditDialog({ jsonForms: __jsonForms, ...props }) {
23
24
  () => utils.deepMerge({ __: { setNull: true } }, _jsonForms, __jsonForms),
24
25
  [_jsonForms, __jsonForms]
25
26
  );
27
+ const { fab } = useInfo.useInfo();
28
+ const initialState = React.useMemo(
29
+ () => ({
30
+ ...constants.initialState,
31
+ data: fab ? convertToFormInputs.convertToFormInputs((item == null ? void 0 : item.result) || {}, info.edit_columns) : convertToFormInputs$1.convertToFormInputs((item == null ? void 0 : item.result) || {}, info.edit_schema)
32
+ }),
33
+ [fab, info.edit_columns, info.edit_schema, item == null ? void 0 : item.result]
34
+ );
35
+ const initialStateRef = React.useRef(initialState);
36
+ React.useEffect(() => {
37
+ setState({ data: initialState.data });
38
+ initialStateRef.current = initialState;
39
+ }, [initialState, setState]);
26
40
  const onSubmit = React.useCallback(
27
41
  (e) => {
28
42
  e == null ? void 0 : e.preventDefault();
29
43
  setLoading(true);
30
- updateEntry(utils.getItemId(getItem()), getState().data).then((res) => {
44
+ const new_data = Object.entries(getState().data).reduce((acc, [key, value]) => {
45
+ if (lodash.lodashExports.isEqual(value, initialStateRef.current.data[key])) {
46
+ return acc;
47
+ }
48
+ acc[key] = value;
49
+ return acc;
50
+ }, {});
51
+ updateEntry(utils.getItemId(getItem()), new_data).then((res) => {
31
52
  if (res) {
32
53
  refetch();
33
54
  refetchInfo();
@@ -40,17 +61,6 @@ function EditDialog({ jsonForms: __jsonForms, ...props }) {
40
61
  },
41
62
  [setLoading, updateEntry, getItem, getState, refetch, refetchInfo, setOpened]
42
63
  );
43
- const { fab } = useInfo.useInfo();
44
- const initialState = React.useMemo(
45
- () => ({
46
- ...constants.initialState,
47
- data: fab ? convertToFormInputs.convertToFormInputs((item == null ? void 0 : item.result) || {}, info.edit_columns) : convertToFormInputs$1.convertToFormInputs((item == null ? void 0 : item.result) || {}, info.edit_schema)
48
- }),
49
- [fab, info.edit_columns, info.edit_schema, item == null ? void 0 : item.result]
50
- );
51
- React.useEffect(() => {
52
- setState({ data: initialState.data });
53
- }, [initialState, setState]);
54
64
  return /* @__PURE__ */ jsxRuntime.jsx(
55
65
  CommonModal.CommonModal,
56
66
  {
@@ -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,
@@ -28,7 +28,7 @@ const useToolbarAlertBanner = require("./hooks/useToolbarAlertBanner/useToolbarA
28
28
  const baseProps = { enableStickyHeader: true, enableColumnPinning: true };
29
29
  const NextGenDataGrid = React.forwardRef((props, ref) => {
30
30
  var _a, _b, _c;
31
- const { info, data, queryParams, refetch, specialKey } = useApi.useApi();
31
+ const { info, data, queryParams, setQueryParams, refetch, specialKey } = useApi.useApi();
32
32
  const propsFromMantineTheme = core.useProps("NextGenDataGrid", {}, {});
33
33
  const {
34
34
  children,
@@ -54,6 +54,8 @@ const NextGenDataGrid = React.forwardRef((props, ref) => {
54
54
  textFilterSeparator = ";",
55
55
  enableAdvancedFilters,
56
56
  wrapperProps,
57
+ memo,
58
+ queryOnlyVisibleColumns,
57
59
  // Deprecated props
58
60
  bodySeparator,
59
61
  bodyTruncate,
@@ -136,7 +138,7 @@ const NextGenDataGrid = React.forwardRef((props, ref) => {
136
138
  const dataProps = useData.useData();
137
139
  const sortingProps = useSorting.useSorting();
138
140
  const paginationProps = usePagination.usePagination(hidePagination);
139
- const columnsProps = useColumns.useColumns(columnProps, header, body, textFilterSeparator, enableAdvancedFilters);
141
+ const columnsProps = useColumns.useColumns(columnProps, header, body, textFilterSeparator, enableAdvancedFilters, memo);
140
142
  const sizeProps = useSize.useSize(withBorder);
141
143
  const actionsProps = useActions.useActions(hideActions, (_a = utils.mergeProps(body, specialKey.actions)) == null ? void 0 : _a.component);
142
144
  const globalFilterProps = useGlobalFilter.useGlobalFilter();
@@ -191,6 +193,18 @@ const NextGenDataGrid = React.forwardRef((props, ref) => {
191
193
  onSelectCheckbox == null ? void 0 : onSelectCheckbox(Object.keys(mrtTable.getState().rowSelection));
192
194
  bulkActions == null ? void 0 : bulkActions.setSelectedIds(Object.keys(mrtTable.getState().rowSelection));
193
195
  }, [bulkActions, data == null ? void 0 : data.ids, mrtTable.getState().rowSelection, onSelectCheckbox]);
196
+ React.useEffect(() => {
197
+ if (!queryOnlyVisibleColumns || !(data == null ? void 0 : data.list_columns)) {
198
+ return;
199
+ }
200
+ const columnVisibility = mrtTable.getState().columnVisibility;
201
+ const visibleColumns = mrtTable.getAllColumns().filter((col) => columnVisibility[col.id] !== false).filter((col) => data.list_columns.includes(col.id));
202
+ if (data.list_columns.length === visibleColumns.length) {
203
+ setQueryParams({ columns: [] });
204
+ return;
205
+ }
206
+ setQueryParams({ columns: visibleColumns.map((col) => col.id) });
207
+ }, [mrtTable.getState().columnVisibility, setQueryParams]);
194
208
  const { setView: setViewAdd } = useForms.useForms("add");
195
209
  const { setView: setViewEdit } = useForms.useForms("edit");
196
210
  React.useEffect(() => {
@@ -7,12 +7,14 @@ 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 Body = ({ body, col, textFilterSeparator, mrtProps }) => {
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 { component, separator, truncate, tooltipProps, highlightProps } = utils.mergeProps(body, specialKey.all, col);
15
+ const colProps = utils.mergeProps(body, specialKey.all, col);
16
+ const { component, separator, truncate, highlight: _highlight, tooltipProps, highlightProps } = colProps;
17
+ let functionProps = { api, auth, data: cell.row.original, colProps, mrtProps };
16
18
  const highlights = React.useMemo(() => {
17
19
  const globalFilter = table.getState().globalFilter;
18
20
  const columnTextFilter = column.getFilterValue();
@@ -23,8 +25,12 @@ const Body = ({ body, col, textFilterSeparator, mrtProps }) => {
23
25
  if (columnTextFilter && typeof columnTextFilter === "string") {
24
26
  highlights2.push(...columnTextFilter.split(textFilterSeparator).map((f) => f.trim()));
25
27
  }
28
+ if (_highlight) {
29
+ const extraHighlight = utils.parseFromValuesOrFunc(_highlight, functionProps);
30
+ highlights2.push(...Array.isArray(extraHighlight) ? extraHighlight : [extraHighlight]);
31
+ }
26
32
  return highlights2;
27
- }, [column.getFilterValue(), table.getState().globalFilter, textFilterSeparator]);
33
+ }, [column.getFilterValue(), table.getState().globalFilter, textFilterSeparator, _highlight]);
28
34
  const cellObj = React.useMemo(() => {
29
35
  const result = { value: cell.getValue(), truncate: {}, highlight: [] };
30
36
  if (typeof result.value === "number") {
@@ -52,6 +58,7 @@ const Body = ({ body, col, textFilterSeparator, mrtProps }) => {
52
58
  return result;
53
59
  }, [cell.getValue(), separator, truncate]);
54
60
  const highlight = React.useMemo(() => [...highlights, ...cellObj.highlight], [highlights, cellObj.highlight]);
61
+ functionProps = { ...functionProps, highlight, cell: cellObj, componentProps: { value: cellObj.value } };
55
62
  return /* @__PURE__ */ jsxRuntime.jsx(
56
63
  FallbackWrapper.FallbackWrapper,
57
64
  {
@@ -60,25 +67,19 @@ const Body = ({ body, col, textFilterSeparator, mrtProps }) => {
60
67
  {
61
68
  highlight,
62
69
  truncate: cellObj.truncate,
63
- tooltipProps: utils.parseFromValuesOrFunc(tooltipProps, { value: cellObj.value, data: cell.row.original, cellObj }),
64
- highlightProps: utils.parseFromValuesOrFunc(highlightProps, {
65
- value: cellObj.value,
66
- data: cell.row.original,
67
- cellObj
68
- }),
70
+ tooltipProps: utils.parseFromValuesOrFunc(tooltipProps, { ...functionProps.componentProps, functionProps }),
71
+ highlightProps: utils.parseFromValuesOrFunc(highlightProps, { ...functionProps.componentProps, functionProps }),
69
72
  children: cellObj.value
70
73
  }
71
74
  ),
72
- functionProps: {
73
- api,
74
- auth,
75
- data: cell.row.original,
76
- highlight,
77
- componentProps: { value: cellObj.value },
78
- mrtProps
79
- },
75
+ functionProps,
80
76
  children: component
81
77
  }
82
78
  );
83
79
  };
84
- exports.Body = Body;
80
+ const MemoCell = React.memo(
81
+ Cell,
82
+ (prevProps, nextProps) => JSON.stringify(prevProps.memo) === JSON.stringify(nextProps.memo)
83
+ );
84
+ exports.Cell = Cell;
85
+ 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 Body = require("./Body.cjs");
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) => enableAdvancedFilters ? null : /* @__PURE__ */ jsxRuntime.jsx(
62
- ColumnHeaderFilter.ColumnHeaderFilter,
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
- children: filterComponent
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(Body.Body, { body, col, textFilterSeparator, mrtProps: props }),
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
- enableAdvancedFilters,
141
+ memo,
142
+ queryParams == null ? void 0 : queryParams.filters,
100
143
  body,
101
144
  textFilterSeparator
102
145
  ]
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
3
4
  function getDefaultExportFromCjs(x) {
4
5
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
5
6
  }
7
+ exports.commonjsGlobal = commonjsGlobal;
6
8
  exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const lodash = require("../../../.external/cjs/lodash@4.17.21/lodash/lodash.cjs");
4
+ var lodashExports = lodash.__require();
5
+ exports.lodashExports = lodashExports;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ var lodash = { exports: {} };
4
+ exports.__module = lodash;
@@ -3,7 +3,8 @@ import { DEBOUNCE_LOADING_DELAY, initialState, VIEW_MODE } from "fastapi-rtk/con
3
3
  import { deepMerge, getItemId } from "fastapi-rtk/utils";
4
4
  import { useProps } from "@mantine/core";
5
5
  import { useDebouncedState } from "@mantine/hooks";
6
- import { useMemo, useCallback, useEffect } from "react";
6
+ import { l as lodashExports } from "../../_virtual/lodash.mjs";
7
+ import { useMemo, useRef, useEffect, useCallback } from "react";
7
8
  import { convertToFormInputs } from "../../fab-react-toolkit-patch/utils/convertToFormInputs.mjs";
8
9
  import { useApi } from "../../hooks/api/useApi.mjs";
9
10
  import { useForms } from "../../hooks/api/useForms.mjs";
@@ -21,11 +22,31 @@ function EditDialog({ jsonForms: __jsonForms, ...props }) {
21
22
  () => deepMerge({ __: { setNull: true } }, _jsonForms, __jsonForms),
22
23
  [_jsonForms, __jsonForms]
23
24
  );
25
+ const { fab } = useInfo();
26
+ const initialState$1 = useMemo(
27
+ () => ({
28
+ ...initialState,
29
+ data: fab ? convertToFormInputs((item == null ? void 0 : item.result) || {}, info.edit_columns) : convertToFormInputs$1((item == null ? void 0 : item.result) || {}, info.edit_schema)
30
+ }),
31
+ [fab, info.edit_columns, info.edit_schema, item == null ? void 0 : item.result]
32
+ );
33
+ const initialStateRef = useRef(initialState$1);
34
+ useEffect(() => {
35
+ setState({ data: initialState$1.data });
36
+ initialStateRef.current = initialState$1;
37
+ }, [initialState$1, setState]);
24
38
  const onSubmit = useCallback(
25
39
  (e) => {
26
40
  e == null ? void 0 : e.preventDefault();
27
41
  setLoading(true);
28
- updateEntry(getItemId(getItem()), getState().data).then((res) => {
42
+ const new_data = Object.entries(getState().data).reduce((acc, [key, value]) => {
43
+ if (lodashExports.isEqual(value, initialStateRef.current.data[key])) {
44
+ return acc;
45
+ }
46
+ acc[key] = value;
47
+ return acc;
48
+ }, {});
49
+ updateEntry(getItemId(getItem()), new_data).then((res) => {
29
50
  if (res) {
30
51
  refetch();
31
52
  refetchInfo();
@@ -38,17 +59,6 @@ function EditDialog({ jsonForms: __jsonForms, ...props }) {
38
59
  },
39
60
  [setLoading, updateEntry, getItem, getState, refetch, refetchInfo, setOpened]
40
61
  );
41
- const { fab } = useInfo();
42
- const initialState$1 = useMemo(
43
- () => ({
44
- ...initialState,
45
- data: fab ? convertToFormInputs((item == null ? void 0 : item.result) || {}, info.edit_columns) : convertToFormInputs$1((item == null ? void 0 : item.result) || {}, info.edit_schema)
46
- }),
47
- [fab, info.edit_columns, info.edit_schema, item == null ? void 0 : item.result]
48
- );
49
- useEffect(() => {
50
- setState({ data: initialState$1.data });
51
- }, [initialState$1, setState]);
52
62
  return /* @__PURE__ */ jsx(
53
63
  CommonModal,
54
64
  {
@@ -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,
@@ -26,7 +26,7 @@ import { useToolbarAlertBanner } from "./hooks/useToolbarAlertBanner/useToolbarA
26
26
  const baseProps = { enableStickyHeader: true, enableColumnPinning: true };
27
27
  const NextGenDataGrid = forwardRef((props, ref) => {
28
28
  var _a, _b, _c;
29
- const { info, data, queryParams, refetch, specialKey } = useApi();
29
+ const { info, data, queryParams, setQueryParams, refetch, specialKey } = useApi();
30
30
  const propsFromMantineTheme = useProps("NextGenDataGrid", {}, {});
31
31
  const {
32
32
  children,
@@ -52,6 +52,8 @@ const NextGenDataGrid = forwardRef((props, ref) => {
52
52
  textFilterSeparator = ";",
53
53
  enableAdvancedFilters,
54
54
  wrapperProps,
55
+ memo,
56
+ queryOnlyVisibleColumns,
55
57
  // Deprecated props
56
58
  bodySeparator,
57
59
  bodyTruncate,
@@ -134,7 +136,7 @@ const NextGenDataGrid = forwardRef((props, ref) => {
134
136
  const dataProps = useData();
135
137
  const sortingProps = useSorting();
136
138
  const paginationProps = usePagination(hidePagination);
137
- const columnsProps = useColumns(columnProps, header, body, textFilterSeparator, enableAdvancedFilters);
139
+ const columnsProps = useColumns(columnProps, header, body, textFilterSeparator, enableAdvancedFilters, memo);
138
140
  const sizeProps = useSize(withBorder);
139
141
  const actionsProps = useActions(hideActions, (_a = mergeProps(body, specialKey.actions)) == null ? void 0 : _a.component);
140
142
  const globalFilterProps = useGlobalFilter();
@@ -189,6 +191,18 @@ const NextGenDataGrid = forwardRef((props, ref) => {
189
191
  onSelectCheckbox == null ? void 0 : onSelectCheckbox(Object.keys(mrtTable.getState().rowSelection));
190
192
  bulkActions == null ? void 0 : bulkActions.setSelectedIds(Object.keys(mrtTable.getState().rowSelection));
191
193
  }, [bulkActions, data == null ? void 0 : data.ids, mrtTable.getState().rowSelection, onSelectCheckbox]);
194
+ useEffect(() => {
195
+ if (!queryOnlyVisibleColumns || !(data == null ? void 0 : data.list_columns)) {
196
+ return;
197
+ }
198
+ const columnVisibility = mrtTable.getState().columnVisibility;
199
+ const visibleColumns = mrtTable.getAllColumns().filter((col) => columnVisibility[col.id] !== false).filter((col) => data.list_columns.includes(col.id));
200
+ if (data.list_columns.length === visibleColumns.length) {
201
+ setQueryParams({ columns: [] });
202
+ return;
203
+ }
204
+ setQueryParams({ columns: visibleColumns.map((col) => col.id) });
205
+ }, [mrtTable.getState().columnVisibility, setQueryParams]);
192
206
  const { setView: setViewAdd } = useForms("add");
193
207
  const { setView: setViewEdit } = useForms("edit");
194
208
  useEffect(() => {
@@ -1,16 +1,18 @@
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 Body = ({ body, col, textFilterSeparator, mrtProps }) => {
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 { component, separator, truncate, tooltipProps, highlightProps } = mergeProps(body, specialKey.all, col);
13
+ const colProps = mergeProps(body, specialKey.all, col);
14
+ const { component, separator, truncate, highlight: _highlight, tooltipProps, highlightProps } = colProps;
15
+ let functionProps = { api, auth, data: cell.row.original, colProps, mrtProps };
14
16
  const highlights = useMemo(() => {
15
17
  const globalFilter = table.getState().globalFilter;
16
18
  const columnTextFilter = column.getFilterValue();
@@ -21,8 +23,12 @@ const Body = ({ body, col, textFilterSeparator, mrtProps }) => {
21
23
  if (columnTextFilter && typeof columnTextFilter === "string") {
22
24
  highlights2.push(...columnTextFilter.split(textFilterSeparator).map((f) => f.trim()));
23
25
  }
26
+ if (_highlight) {
27
+ const extraHighlight = parseFromValuesOrFunc(_highlight, functionProps);
28
+ highlights2.push(...Array.isArray(extraHighlight) ? extraHighlight : [extraHighlight]);
29
+ }
24
30
  return highlights2;
25
- }, [column.getFilterValue(), table.getState().globalFilter, textFilterSeparator]);
31
+ }, [column.getFilterValue(), table.getState().globalFilter, textFilterSeparator, _highlight]);
26
32
  const cellObj = useMemo(() => {
27
33
  const result = { value: cell.getValue(), truncate: {}, highlight: [] };
28
34
  if (typeof result.value === "number") {
@@ -50,6 +56,7 @@ const Body = ({ body, col, textFilterSeparator, mrtProps }) => {
50
56
  return result;
51
57
  }, [cell.getValue(), separator, truncate]);
52
58
  const highlight = useMemo(() => [...highlights, ...cellObj.highlight], [highlights, cellObj.highlight]);
59
+ functionProps = { ...functionProps, highlight, cell: cellObj, componentProps: { value: cellObj.value } };
53
60
  return /* @__PURE__ */ jsx(
54
61
  FallbackWrapper,
55
62
  {
@@ -58,27 +65,21 @@ const Body = ({ body, col, textFilterSeparator, mrtProps }) => {
58
65
  {
59
66
  highlight,
60
67
  truncate: cellObj.truncate,
61
- tooltipProps: parseFromValuesOrFunc(tooltipProps, { value: cellObj.value, data: cell.row.original, cellObj }),
62
- highlightProps: parseFromValuesOrFunc(highlightProps, {
63
- value: cellObj.value,
64
- data: cell.row.original,
65
- cellObj
66
- }),
68
+ tooltipProps: parseFromValuesOrFunc(tooltipProps, { ...functionProps.componentProps, functionProps }),
69
+ highlightProps: parseFromValuesOrFunc(highlightProps, { ...functionProps.componentProps, functionProps }),
67
70
  children: cellObj.value
68
71
  }
69
72
  ),
70
- functionProps: {
71
- api,
72
- auth,
73
- data: cell.row.original,
74
- highlight,
75
- componentProps: { value: cellObj.value },
76
- mrtProps
77
- },
73
+ functionProps,
78
74
  children: component
79
75
  }
80
76
  );
81
77
  };
78
+ const MemoCell = memo(
79
+ Cell,
80
+ (prevProps, nextProps) => JSON.stringify(prevProps.memo) === JSON.stringify(nextProps.memo)
81
+ );
82
82
  export {
83
- Body
83
+ Cell,
84
+ MemoCell
84
85
  };
@@ -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 { Body } from "./Body.mjs";
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) => enableAdvancedFilters ? null : /* @__PURE__ */ jsx(
60
- ColumnHeaderFilter,
61
- {
62
- enableFilterModes,
63
- filters,
64
- filterFn,
65
- filterProps,
66
- filterState,
67
- filterSync,
68
- filterMenu,
69
- filterModeDescription,
70
- updateQueryParams,
71
- withLocalStorage,
72
- localStorageKey,
73
- mrtProps: props,
74
- children: filterComponent
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) => /* @__PURE__ */ jsx(Body, { body, col, textFilterSeparator, mrtProps: 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
- enableAdvancedFilters,
139
+ memo,
140
+ queryParams == null ? void 0 : queryParams.filters,
98
141
  body,
99
142
  textFilterSeparator
100
143
  ]
@@ -1,6 +1,8 @@
1
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
1
2
  function getDefaultExportFromCjs(x) {
2
3
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
3
4
  }
4
5
  export {
6
+ commonjsGlobal,
5
7
  getDefaultExportFromCjs
6
8
  };
@@ -0,0 +1,5 @@
1
+ import { __require as requireLodash } from "../../../.external/esm/lodash@4.17.21/lodash/lodash.mjs";
2
+ var lodashExports = requireLodash();
3
+ export {
4
+ lodashExports as l
5
+ };
@@ -0,0 +1,4 @@
1
+ var lodash = { exports: {} };
2
+ export {
3
+ lodash as __module
4
+ };
@@ -1,15 +1,38 @@
1
- export function CommonModal({ fabSchema, schema, uischema, state, setState, view, setView, jsonForms, onSubmit, boxProps, buttonText, buttonLoading, ...props }: {
2
- [x: string]: any;
3
- fabSchema: any;
4
- schema: any;
5
- uischema: any;
6
- state: any;
7
- setState: any;
8
- view: any;
9
- setView: any;
10
- jsonForms: any;
11
- onSubmit: any;
12
- boxProps: any;
13
- buttonText: any;
14
- buttonLoading: any;
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;
@@ -32,6 +32,82 @@ export type NextGenDataGridFilterSyncProps = {
32
32
  */
33
33
  delay?: number;
34
34
  };
35
+ export type NextGenDataGridBodyCellHighlightProps = {
36
+ /**
37
+ * - API instance
38
+ */
39
+ api: Record<string, any>;
40
+ /**
41
+ * - Auth instance
42
+ */
43
+ auth: Record<string, any>;
44
+ /**
45
+ * - Row data
46
+ */
47
+ data: Record<string, any>;
48
+ /**
49
+ * - Column properties
50
+ */
51
+ colProps: Record<string, any>;
52
+ /**
53
+ * - MantineReactTable props
54
+ */
55
+ mrtProps: Record<string, any>;
56
+ };
57
+ export type NextGenDataGridBodyCellCellProps = {
58
+ /**
59
+ * - The value of the cell, either `string` or `string[]`
60
+ */
61
+ value: string | string[];
62
+ /**
63
+ * - The truncate object containing the original and truncated value
64
+ */
65
+ truncate: Record<string, any>;
66
+ /**
67
+ * - The highlight keywords to highlight in the cell value
68
+ */
69
+ highlight: string[];
70
+ };
71
+ export type NextGenDataGridBodyCellComponentProps = {
72
+ /**
73
+ * - The value of the cell, either `string` or `string[]`
74
+ */
75
+ value: string | string[];
76
+ };
77
+ export type NextGenDataGridBodyCellProps = {
78
+ /**
79
+ * - API instance
80
+ */
81
+ api: Record<string, any>;
82
+ /**
83
+ * - Auth instance
84
+ */
85
+ auth: Record<string, any>;
86
+ /**
87
+ * - Row data
88
+ */
89
+ data: Record<string, any>;
90
+ /**
91
+ * - Column properties
92
+ */
93
+ colProps: Record<string, any>;
94
+ /**
95
+ * - MantineReactTable props
96
+ */
97
+ mrtProps: Record<string, any>;
98
+ /**
99
+ * - Array of highlight keywords
100
+ */
101
+ highlights: string[];
102
+ /**
103
+ * - The cell object containing the value, truncate and highlight
104
+ */
105
+ cell: NextGenDataGridBodyCellCellProps;
106
+ /**
107
+ * - Props for the cell component
108
+ */
109
+ componentProps: NextGenDataGridBodyCellComponentProps;
110
+ };
35
111
  export type NextGenDataGridHeaderProps = {
36
112
  /**
37
113
  * - Customize the header that is shown above the filter
@@ -88,7 +164,7 @@ export type NextGenDataGridBodyProps = {
88
164
  /**
89
165
  * - Customize the component within the body
90
166
  */
91
- component?: JSX.Element | (({ api, auth, mrtProps }: any) => JSX.Element);
167
+ component?: JSX.Element | ((props: NextGenDataGridBodyCellProps) => JSX.Element);
92
168
  /**
93
169
  * - Separate the value of a column into multiple rows
94
170
  */
@@ -97,14 +173,18 @@ export type NextGenDataGridBodyProps = {
97
173
  * - Truncate the value of a column to a certain length. Will be shown as `...` when it exceeds the length with a tooltip containing the full value
98
174
  */
99
175
  truncate?: number;
176
+ /**
177
+ * - Additional highlight keywords to highlight in the cell value. Can be a string, an array of strings, or a function that returns a string or an array of strings
178
+ */
179
+ highlight?: string | string[] | ((props: NextGenDataGridBodyCellHighlightProps) => string | string[]);
100
180
  /**
101
181
  * - Props for the tooltip component that is shown when the value is truncated. The `value` is the value of the cell, either `string` or `string[]`, `data` is the row data, and `cellObj` is the cell object containing the value, truncate and highlight
102
182
  */
103
- tooltipProps?: Record<string, any> | (({ value, data, cellObj }: any) => Record<string, any>);
183
+ tooltipProps?: Record<string, any> | ((props: NextGenDataGridBodyCellProps & NextGenDataGridBodyCellComponentProps) => Record<string, any>);
104
184
  /**
105
185
  * - Props for the highlight component. The `value` is the value of the cell, either `string` or `string[]`, `data` is the row data, and `cellObj` is the cell object containing the value, truncate and highlight
106
186
  */
107
- highlightProps?: Record<string, any> | (({ value, data, cellObj }: any) => Record<string, any>);
187
+ highlightProps?: Record<string, any> | ((props: NextGenDataGridBodyCellProps & NextGenDataGridBodyCellComponentProps) => Record<string, any>);
108
188
  };
109
189
  export type NextGenDataGridProps = {
110
190
  /**
@@ -197,9 +277,17 @@ export type NextGenDataGridProps = {
197
277
  enableAdvancedFilters?: boolean;
198
278
  /**
199
279
  * - Wrapper props for the table
200
- * Deprecated props
201
280
  */
202
281
  wrapperProps?: Record<string, any>;
282
+ /**
283
+ * - 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)
284
+ */
285
+ memo?: boolean | "filters" | "cells";
286
+ /**
287
+ * - Whether to only query the visible columns from the backend. When enabled, it modifies the `columns` from the `queryParams` to only include the visible columns. Defaults to `false`
288
+ * Deprecated props
289
+ */
290
+ queryOnlyVisibleColumns?: boolean;
203
291
  /**
204
292
  * - Body separator for the table
205
293
  */
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastapi-rtk",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "private": false,
5
5
  "description": "A React component library for FastAPI in combination with FastAPI React Toolkit backend, built with Mantine, JsonForms, and Zustand.",
6
6
  "license": "MIT",
@@ -1,6 +0,0 @@
1
- export function Body({ body, col, textFilterSeparator, mrtProps }: {
2
- body: any;
3
- col: any;
4
- textFilterSeparator: any;
5
- mrtProps: any;
6
- }): import("react").JSX.Element;