fastapi-rtk 0.2.8 → 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.
Files changed (48) 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/Modals/CommonModal.cjs +2 -1
  4. package/dist/core/cjs/Tables/DataGrid/Toolbar/Filter/FilterMenu.cjs +1 -1
  5. package/dist/core/cjs/Tables/NextGenDataGrid/NextGenDataGrid.cjs +2 -1
  6. package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/{Body.cjs → Cell.cjs} +22 -17
  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/Wrappers/ApiProvider/hooks/useProvideApi.cjs +8 -8
  10. package/dist/core/cjs/Wrappers/ApiProvider/hooks/useProvideBulk.cjs +4 -7
  11. package/dist/core/cjs/Wrappers/Provider/hooks/useProvideAuth.cjs +12 -10
  12. package/dist/core/cjs/fab-react-toolkit-patch/api/hooks/useProvideApi.cjs +8 -8
  13. package/dist/core/cjs/fab-react-toolkit-patch/api/hooks/useProvideBulk.cjs +4 -7
  14. package/dist/core/cjs/fab-react-toolkit-patch/auth/hooks/useProvideAuth.cjs +12 -10
  15. package/dist/core/esm/ActionIcons/Modals/CommonModal.mjs +2 -1
  16. package/dist/core/esm/Tables/DataGrid/Toolbar/Filter/FilterMenu.mjs +1 -1
  17. package/dist/core/esm/Tables/NextGenDataGrid/NextGenDataGrid.mjs +2 -1
  18. package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/{Body.mjs → Cell.mjs} +23 -18
  19. package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter.mjs +7 -2
  20. package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/useColumns.mjs +67 -24
  21. package/dist/core/esm/Wrappers/ApiProvider/hooks/useProvideApi.mjs +8 -8
  22. package/dist/core/esm/Wrappers/ApiProvider/hooks/useProvideBulk.mjs +4 -7
  23. package/dist/core/esm/Wrappers/Provider/hooks/useProvideAuth.mjs +12 -10
  24. package/dist/core/esm/fab-react-toolkit-patch/api/hooks/useProvideApi.mjs +8 -8
  25. package/dist/core/esm/fab-react-toolkit-patch/api/hooks/useProvideBulk.mjs +4 -7
  26. package/dist/core/esm/fab-react-toolkit-patch/auth/hooks/useProvideAuth.mjs +12 -10
  27. package/dist/core/lib/ActionIcons/Modals/CommonModal.d.ts +37 -14
  28. package/dist/core/lib/Tables/NextGenDataGrid/NextGenDataGrid.d.ts +5 -1
  29. package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/Cell.d.ts +12 -0
  30. package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter.d.ts +15 -0
  31. package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/useColumns.d.ts +1 -1
  32. package/dist/core/lib/Wrappers/ApiProvider/hooks/useProvideApi.d.ts +1 -1
  33. package/dist/core/lib/Wrappers/ApiProvider/hooks/useProvideBulk.d.ts +1 -0
  34. package/dist/core/lib/Wrappers/Provider/hooks/useProvideAuth.d.ts +1 -0
  35. package/dist/core/lib/fab-react-toolkit-patch/api/hooks/useProvideApi.d.ts +1 -1
  36. package/dist/core/lib/fab-react-toolkit-patch/api/hooks/useProvideBulk.d.ts +1 -0
  37. package/dist/core/lib/fab-react-toolkit-patch/auth/hooks/useProvideAuth.d.ts +1 -0
  38. package/dist/core/lib/hooks/api/useBulkActions.d.ts +15 -1
  39. package/dist/core/lib/hooks/auth/useAuth.d.ts +4 -0
  40. package/dist/hooks/cjs/useCustomFetch/useCustomFetch.cjs +4 -3
  41. package/dist/hooks/esm/useCustomFetch/useCustomFetch.mjs +5 -4
  42. package/dist/hooks/lib/useCustomFetch/useCustomFetch.d.ts +2 -1
  43. package/dist/jsonforms/cjs/MantineInputs/MantineDateTimeInput.cjs +1 -1
  44. package/dist/jsonforms/esm/MantineInputs/MantineDateTimeInput.mjs +1 -1
  45. package/package.json +1 -1
  46. package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/Body.d.ts +0 -6
  47. /package/dist/.external/cjs/{mantine-form-yup-resolver@2.0.0_@mantine_form@8.1.3_yup@1.6.1 → mantine-form-yup-resolver@2.0.0_@mantine_form@8.2.1_yup@1.6.1}/mantine-form-yup-resolver/dist/esm/index.cjs +0 -0
  48. /package/dist/.external/esm/{mantine-form-yup-resolver@2.0.0_@mantine_form@8.1.3_yup@1.6.1 → mantine-form-yup-resolver@2.0.0_@mantine_form@8.2.1_yup@1.6.1}/mantine-form-yup-resolver/dist/esm/index.mjs +0 -0
@@ -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
  }
@@ -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,
@@ -4,7 +4,7 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const core = require("@mantine/core");
5
5
  const form = require("@mantine/form");
6
6
  const hooks = require("@mantine/hooks");
7
- const index = require("../../../../../../.external/cjs/mantine-form-yup-resolver@2.0.0_@mantine_form@8.1.3_yup@1.6.1/mantine-form-yup-resolver/dist/esm/index.cjs");
7
+ const index = require("../../../../../../.external/cjs/mantine-form-yup-resolver@2.0.0_@mantine_form@8.2.1_yup@1.6.1/mantine-form-yup-resolver/dist/esm/index.cjs");
8
8
  const React = require("react");
9
9
  const index_esm = require("../../../../../../.external/cjs/yup@1.6.1/yup/index.esm.cjs");
10
10
  const useApi = require("../../../../hooks/api/useApi.cjs");
@@ -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 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, 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, { 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
- }),
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
- exports.Body = Body;
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 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
  ]
@@ -85,9 +85,9 @@ function useProvideApi({
85
85
  }),
86
86
  [streamingMode]
87
87
  );
88
- const [error, setError] = React.useState(null);
88
+ const [error, setError] = React.useState();
89
89
  const memoizedError = React.useMemo(() => error, [error]);
90
- const resetError = React.useCallback(() => setError(null), []);
90
+ const resetError = React.useCallback(() => setError(void 0), []);
91
91
  const {
92
92
  data: info,
93
93
  isFetching: infoLoading,
@@ -150,8 +150,8 @@ function useProvideApi({
150
150
  const getEntry = React.useCallback(
151
151
  async (id) => {
152
152
  try {
153
- const response = await getItem.getItem(pathRef.current, convertId.convertId(id));
154
153
  resetError();
154
+ const response = await getItem.getItem(pathRef.current, convertId.convertId(id));
155
155
  return response;
156
156
  } catch (error2) {
157
157
  setError({ message: `Couldn't fetch item with id ${id}`, originalError: error2 });
@@ -166,9 +166,9 @@ function useProvideApi({
166
166
  async (item) => {
167
167
  var _a;
168
168
  try {
169
+ resetError();
169
170
  const func = ((_a = infoRef.current) == null ? void 0 : _a.add_type) === "form" ? formCreateItem.formCreateItem : createItem.createItem;
170
171
  const response = await func(pathRef.current, item);
171
- resetError();
172
172
  return response;
173
173
  } catch (error2) {
174
174
  setError({ message: `Couldn't add item`, originalError: error2 });
@@ -183,9 +183,9 @@ function useProvideApi({
183
183
  async (id, item) => {
184
184
  var _a;
185
185
  try {
186
+ resetError();
186
187
  const func = ((_a = infoRef.current) == null ? void 0 : _a.edit_type) === "form" ? formUpdateItem.formUpdateItem : updateItem.updateItem;
187
188
  const response = await func(pathRef.current, convertId.convertId(id), item);
188
- resetError();
189
189
  return response;
190
190
  } catch (error2) {
191
191
  setError({ message: `Couldn't update item with id ${id}`, originalError: error2 });
@@ -199,8 +199,8 @@ function useProvideApi({
199
199
  const deleteEntry = React.useCallback(
200
200
  async (id) => {
201
201
  try {
202
- const response = await deleteItem.deleteItem(pathRef.current, convertId.convertId(id));
203
202
  resetError();
203
+ const response = await deleteItem.deleteItem(pathRef.current, convertId.convertId(id));
204
204
  return response;
205
205
  } catch (error2) {
206
206
  setError({ message: `Couldn't delete item with id ${id}`, originalError: error2 });
@@ -214,8 +214,8 @@ function useProvideApi({
214
214
  const download = React.useCallback(
215
215
  async (label, { export_mode, delimiter, quotechar } = {}) => {
216
216
  try {
217
- await downloadItems.downloadItems(pathRef.current, queryParamsRef.current, { label, export_mode, delimiter, quotechar });
218
217
  resetError();
218
+ await downloadItems.downloadItems(pathRef.current, queryParamsRef.current, { label, export_mode, delimiter, quotechar });
219
219
  } catch (error2) {
220
220
  setError({ message: `Couldn't download`, originalError: error2 });
221
221
  if (throwOnError) {
@@ -228,8 +228,8 @@ function useProvideApi({
228
228
  const upload = React.useCallback(
229
229
  async (file, { delimiter, quotechar } = {}) => {
230
230
  try {
231
- const response = await uploadItems.uploadItems(pathRef.current, file, { delimiter, quotechar });
232
231
  resetError();
232
+ const response = await uploadItems.uploadItems(pathRef.current, file, { delimiter, quotechar });
233
233
  return response;
234
234
  } catch (error2) {
235
235
  setError({ message: `Couldn't upload`, originalError: error2 });
@@ -5,26 +5,23 @@ const postBulkAction = require("../utils/bulkActions/postBulkAction.cjs");
5
5
  const useProvideBulk = ({ path }) => {
6
6
  const [selectedIds, setSelectedIds] = React.useState([]);
7
7
  const [error, setError] = React.useState();
8
+ const resetError = React.useCallback(() => setError(void 0), []);
8
9
  const dispatchBulkActions = React.useCallback(
9
10
  async (handler, data) => {
10
11
  try {
12
+ resetError();
11
13
  if (data === void 0) {
12
14
  data = selectedIds;
13
15
  }
14
16
  const response = await postBulkAction.postBulk(path, handler, data);
15
- setError(void 0);
16
17
  return response;
17
18
  } catch (error2) {
18
19
  setError({ message: `Couldn't perform bulk action`, originalError: error2 });
19
20
  }
20
21
  },
21
- [path, selectedIds]
22
+ [path, resetError, selectedIds]
22
23
  );
23
24
  const bulkActions = React.useMemo(() => ({ selectedIds, setSelectedIds }), [selectedIds, setSelectedIds]);
24
- return {
25
- bulkActions,
26
- dispatchBulkActions,
27
- error
28
- };
25
+ return { bulkActions, dispatchBulkActions, error, resetError };
29
26
  };
30
27
  exports.useProvideBulk = useProvideBulk;
@@ -13,31 +13,32 @@ function useProvideAuth(baseURL, authQueryProps) {
13
13
  retry: false,
14
14
  ...authQueryProps
15
15
  });
16
- const [error, setError] = React.useState(null);
16
+ const [error, setError] = React.useState();
17
+ const resetError = React.useCallback(() => setError(void 0), []);
17
18
  const signin = React.useCallback(
18
19
  ({ username, password }) => {
19
- setError(null);
20
+ resetError();
20
21
  authFetch.authSignin(baseURL, { username, password }).then(() => queryClient.invalidateQueries({ queryKey: ["user"] })).catch((err) => setError(err));
21
22
  },
22
- [baseURL, queryClient]
23
+ [baseURL, queryClient, resetError]
23
24
  );
24
25
  const signout = React.useCallback(() => {
25
- setError(null);
26
+ resetError();
26
27
  authFetch.authSignout(baseURL).then(() => queryClient.resetQueries({ queryKey: ["user"] })).then(() => queryClient.resetQueries({ queryKey: ["info"] })).catch((err) => setError(err));
27
- }, [baseURL, queryClient]);
28
+ }, [baseURL, queryClient, resetError]);
28
29
  const update = React.useCallback(
29
30
  (data) => {
30
- setError(null);
31
+ resetError();
31
32
  userCRUD.updateUser(baseURL, data).then(() => queryClient.invalidateQueries({ queryKey: ["user"] })).catch((err) => setError(err));
32
33
  },
33
- [baseURL, queryClient]
34
+ [baseURL, queryClient, resetError]
34
35
  );
35
36
  const resetPassword = React.useCallback(
36
37
  (password) => {
37
- setError(null);
38
+ resetError();
38
39
  authFetch.authResetPassword(baseURL, password, query.data).catch((err) => setError(err));
39
40
  },
40
- [baseURL, query.data]
41
+ [baseURL, query.data, resetError]
41
42
  );
42
43
  const oauth_signin = React.useCallback(
43
44
  (provider, popup) => authFetch.authOAuthSignin(baseURL, provider, popup, () => queryClient.invalidateQueries({ queryKey: ["user"] })),
@@ -52,7 +53,8 @@ function useProvideAuth(baseURL, authQueryProps) {
52
53
  update,
53
54
  resetPassword,
54
55
  oauth_signin,
55
- refetch: query.refetch
56
+ refetch: query.refetch,
57
+ resetError
56
58
  };
57
59
  }
58
60
  exports.useProvideAuth = useProvideAuth;
@@ -83,9 +83,9 @@ function useFabProvideApi({
83
83
  }),
84
84
  [streamingMode]
85
85
  );
86
- const [error, setError] = React.useState(null);
86
+ const [error, setError] = React.useState();
87
87
  const memoizedError = React.useMemo(() => error, [error]);
88
- const resetError = React.useCallback(() => setError(null), []);
88
+ const resetError = React.useCallback(() => setError(void 0), []);
89
89
  const {
90
90
  data: info,
91
91
  isFetching: infoLoading,
@@ -144,8 +144,8 @@ function useFabProvideApi({
144
144
  const getEntry = React.useCallback(
145
145
  async (id) => {
146
146
  try {
147
- const response = await getItem.getItem(pathRef.current, convertId.convertId(id));
148
147
  resetError();
148
+ const response = await getItem.getItem(pathRef.current, convertId.convertId(id));
149
149
  return response;
150
150
  } catch (error2) {
151
151
  setError({ message: `Couldn't fetch item with id ${id}`, originalError: error2 });
@@ -159,8 +159,8 @@ function useFabProvideApi({
159
159
  const addEntry = React.useCallback(
160
160
  async (item) => {
161
161
  try {
162
- const response = await createItem.createItem(pathRef.current, item);
163
162
  resetError();
163
+ const response = await createItem.createItem(pathRef.current, item);
164
164
  return response;
165
165
  } catch (error2) {
166
166
  setError({ message: `Couldn't add item`, originalError: error2 });
@@ -174,8 +174,8 @@ function useFabProvideApi({
174
174
  const updateEntry = React.useCallback(
175
175
  async (id, item) => {
176
176
  try {
177
- const response = await updateItem.updateItem(pathRef.current, convertId.convertId(id), item);
178
177
  resetError();
178
+ const response = await updateItem.updateItem(pathRef.current, convertId.convertId(id), item);
179
179
  return response;
180
180
  } catch (error2) {
181
181
  setError({ message: `Couldn't update item with id ${id}`, originalError: error2 });
@@ -189,8 +189,8 @@ function useFabProvideApi({
189
189
  const deleteEntry = React.useCallback(
190
190
  async (id) => {
191
191
  try {
192
- const response = await deleteItem.deleteItem(pathRef.current, convertId.convertId(id));
193
192
  resetError();
193
+ const response = await deleteItem.deleteItem(pathRef.current, convertId.convertId(id));
194
194
  return response;
195
195
  } catch (error2) {
196
196
  setError({ message: `Couldn't delete item with id ${id}`, originalError: error2 });
@@ -204,8 +204,8 @@ function useFabProvideApi({
204
204
  const download = React.useCallback(
205
205
  async (label, { export_mode, delimiter, quotechar } = {}) => {
206
206
  try {
207
- await downloadItems.downloadItems(pathRef.current, queryParamsRef.current, { label, export_mode, delimiter, quotechar });
208
207
  resetError();
208
+ await downloadItems.downloadItems(pathRef.current, queryParamsRef.current, { label, export_mode, delimiter, quotechar });
209
209
  } catch (error2) {
210
210
  setError({ message: `Couldn't download`, originalError: error2 });
211
211
  if (throwOnError) {
@@ -218,8 +218,8 @@ function useFabProvideApi({
218
218
  const upload = React.useCallback(
219
219
  async (file, { delimiter, quotechar } = {}) => {
220
220
  try {
221
- const response = await uploadItems.uploadItems(pathRef.current, file, { delimiter, quotechar });
222
221
  resetError();
222
+ const response = await uploadItems.uploadItems(pathRef.current, file, { delimiter, quotechar });
223
223
  return response;
224
224
  } catch (error2) {
225
225
  setError({ message: `Couldn't upload`, originalError: error2 });
@@ -5,26 +5,23 @@ const postBulkAction = require("../utils/bulkActions/postBulkAction.cjs");
5
5
  const useFabProvideBulk = ({ path }) => {
6
6
  const [selectedIds, setSelectedIds] = React.useState([]);
7
7
  const [error, setError] = React.useState();
8
+ const resetError = React.useCallback(() => setError(void 0), []);
8
9
  const dispatchBulkActions = React.useCallback(
9
10
  async (handler, data) => {
10
11
  try {
12
+ resetError();
11
13
  if (data === void 0) {
12
14
  data = selectedIds;
13
15
  }
14
16
  const response = await postBulkAction.postBulk(path, handler, data);
15
- setError(void 0);
16
17
  return response;
17
18
  } catch (error2) {
18
19
  setError({ message: `Couldn't perform bulk action`, originalError: error2 });
19
20
  }
20
21
  },
21
- [path, selectedIds]
22
+ [path, resetError, selectedIds]
22
23
  );
23
24
  const bulkActions = React.useMemo(() => ({ selectedIds, setSelectedIds }), [selectedIds, setSelectedIds]);
24
- return {
25
- bulkActions,
26
- dispatchBulkActions,
27
- error
28
- };
25
+ return { bulkActions, dispatchBulkActions, error, resetError };
29
26
  };
30
27
  exports.useFabProvideBulk = useFabProvideBulk;
@@ -13,31 +13,32 @@ function useFabProvideAuth(baseURL, authQueryProps) {
13
13
  retry: false,
14
14
  ...authQueryProps
15
15
  });
16
- const [error, setError] = React.useState(null);
16
+ const [error, setError] = React.useState();
17
+ const resetError = React.useCallback(() => setError(void 0), []);
17
18
  const signin = React.useCallback(
18
19
  ({ username, password }) => {
19
- setError(null);
20
+ resetError();
20
21
  authFetch.authSignin(baseURL, { username, password }).then(() => queryClient.invalidateQueries({ queryKey: ["user"] })).catch((err) => setError(err));
21
22
  },
22
- [baseURL, queryClient]
23
+ [baseURL, queryClient, resetError]
23
24
  );
24
25
  const signout = React.useCallback(() => {
25
- setError(null);
26
+ resetError();
26
27
  authFetch.authSignout(baseURL).then(() => queryClient.resetQueries({ queryKey: ["user"] })).then(() => queryClient.resetQueries({ queryKey: ["info"] })).catch((err) => setError(err));
27
- }, [baseURL, queryClient]);
28
+ }, [baseURL, queryClient, resetError]);
28
29
  const update = React.useCallback(
29
30
  (data) => {
30
- setError(null);
31
+ resetError();
31
32
  userCRUD.updateUser(baseURL, data).then(() => queryClient.invalidateQueries({ queryKey: ["user"] })).catch((err) => setError(err));
32
33
  },
33
- [baseURL, queryClient]
34
+ [baseURL, queryClient, resetError]
34
35
  );
35
36
  const resetPassword = React.useCallback(
36
37
  (password) => {
37
- setError(null);
38
+ resetError();
38
39
  authFetch.authResetPassword(baseURL, password, query.data).catch((err) => setError(err));
39
40
  },
40
- [baseURL, query.data]
41
+ [baseURL, query.data, resetError]
41
42
  );
42
43
  const oauth_signin = React.useCallback(
43
44
  (provider, popup) => authFetch.authOAuthSignin(baseURL, provider, popup, () => queryClient.invalidateQueries({ queryKey: ["user"] })),
@@ -52,7 +53,8 @@ function useFabProvideAuth(baseURL, authQueryProps) {
52
53
  update,
53
54
  resetPassword,
54
55
  oauth_signin,
55
- refetch: query.refetch
56
+ refetch: query.refetch,
57
+ resetError
56
58
  };
57
59
  }
58
60
  exports.useFabProvideAuth = useFabProvideAuth;
@@ -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,
@@ -2,7 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useProps, Box, Flex, ActionIcon, Divider, Text, ScrollArea, Button, Group } from "@mantine/core";
3
3
  import { useForm } from "@mantine/form";
4
4
  import { randomId } from "@mantine/hooks";
5
- import { yupResolver } from "../../../../../../.external/esm/mantine-form-yup-resolver@2.0.0_@mantine_form@8.1.3_yup@1.6.1/mantine-form-yup-resolver/dist/esm/index.mjs";
5
+ import { yupResolver } from "../../../../../../.external/esm/mantine-form-yup-resolver@2.0.0_@mantine_form@8.2.1_yup@1.6.1/mantine-form-yup-resolver/dist/esm/index.mjs";
6
6
  import { useEffect } from "react";
7
7
  import { object as create$3, array as create$2, mixed as create$8, string as create$6 } from "../../../../../../.external/esm/yup@1.6.1/yup/index.esm.mjs";
8
8
  import { useApi } from "../../../../hooks/api/useApi.mjs";
@@ -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();