fastapi-rtk 0.1.20 → 0.1.21

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 (65) hide show
  1. package/dist/core/cjs/ActionIcons/Edit/EditDialog.cjs +3 -3
  2. package/dist/core/cjs/ActionIcons/View/ViewDialog.cjs +2 -2
  3. package/dist/core/cjs/Tables/DataGrid/FormField/Inputs/FormRelatedListSelect.cjs +3 -2
  4. package/dist/core/cjs/Tables/DataGrid/FormField/Inputs/FormRelatedSelect.cjs +4 -4
  5. package/dist/core/cjs/Tables/NextGenDataGrid/NextGenDataGrid.cjs +1 -1
  6. package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useActions.cjs +2 -1
  7. package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter/ColumnHeaderFilter.cjs +2 -0
  8. package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter/HeaderInputs/HeaderMultiSelectInput.cjs +2 -1
  9. package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/useColumns.cjs +2 -0
  10. package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/utils.cjs +3 -2
  11. package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useEvent.cjs +2 -6
  12. package/dist/core/cjs/Wrappers/ApiProvider/hooks/useProvideApi.cjs +7 -7
  13. package/dist/core/cjs/Wrappers/Provider/Provider.cjs +5 -6
  14. package/dist/core/cjs/fab-react-toolkit-patch/api/hooks/useProvideApi.cjs +7 -7
  15. package/dist/core/cjs/fab-react-toolkit-patch/utils/convertToFormInputs.cjs +6 -8
  16. package/dist/core/esm/ActionIcons/Edit/EditDialog.mjs +4 -4
  17. package/dist/core/esm/ActionIcons/View/ViewDialog.mjs +3 -3
  18. package/dist/core/esm/Tables/DataGrid/FormField/Inputs/FormRelatedListSelect.mjs +3 -2
  19. package/dist/core/esm/Tables/DataGrid/FormField/Inputs/FormRelatedSelect.mjs +4 -4
  20. package/dist/core/esm/Tables/NextGenDataGrid/NextGenDataGrid.mjs +2 -2
  21. package/dist/core/esm/Tables/NextGenDataGrid/hooks/useActions.mjs +2 -1
  22. package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter/ColumnHeaderFilter.mjs +2 -0
  23. package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter/HeaderInputs/HeaderMultiSelectInput.mjs +2 -1
  24. package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/useColumns.mjs +2 -0
  25. package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/utils.mjs +3 -2
  26. package/dist/core/esm/Tables/NextGenDataGrid/hooks/useEvent.mjs +2 -6
  27. package/dist/core/esm/Wrappers/ApiProvider/hooks/useProvideApi.mjs +2 -2
  28. package/dist/core/esm/Wrappers/Provider/Provider.mjs +5 -6
  29. package/dist/core/esm/fab-react-toolkit-patch/api/hooks/useProvideApi.mjs +2 -2
  30. package/dist/core/esm/fab-react-toolkit-patch/utils/convertToFormInputs.mjs +6 -8
  31. package/dist/core/lib/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter/ColumnHeaderFilter.d.ts +2 -1
  32. package/dist/core/lib/Tables/NextGenDataGrid/hooks/useEvent.d.ts +1 -1
  33. package/dist/core/lib/Wrappers/ApiProvider/utils/convertId.d.ts +1 -1
  34. package/dist/core/lib/Wrappers/Provider/Provider.d.ts +23 -6
  35. package/dist/core/lib/fab-react-toolkit-patch/api/utils/convertId.d.ts +1 -1
  36. package/dist/core/styles.css +1 -0
  37. package/dist/hooks/lib/index.d.ts +3 -3
  38. package/dist/hooks/lib/useActionIcon/index.d.ts +1 -0
  39. package/dist/hooks/lib/useCustomFetch/index.d.ts +1 -0
  40. package/dist/hooks/lib/useTrueOnce/index.d.ts +1 -0
  41. package/dist/utils/cjs/getItemId/getItemId.cjs +4 -0
  42. package/dist/utils/cjs/getItemName/getItemName.cjs +4 -0
  43. package/dist/utils/cjs/index.cjs +5 -0
  44. package/dist/utils/cjs/parseValue/parseValue.cjs +2 -1
  45. package/dist/utils/esm/getItemId/getItemId.mjs +4 -0
  46. package/dist/utils/esm/getItemName/getItemName.mjs +4 -0
  47. package/dist/utils/esm/index.mjs +6 -1
  48. package/dist/utils/esm/parseValue/parseValue.mjs +2 -1
  49. package/dist/utils/lib/createFetchParams/index.d.ts +1 -0
  50. package/dist/utils/lib/deepMerge/index.d.ts +1 -0
  51. package/dist/utils/lib/getItemId/getItemId.d.ts +1 -0
  52. package/dist/utils/lib/getItemId/index.d.ts +1 -0
  53. package/dist/utils/lib/getItemName/getItemName.d.ts +1 -0
  54. package/dist/utils/lib/getItemName/index.d.ts +1 -0
  55. package/dist/utils/lib/getValue/index.d.ts +1 -0
  56. package/dist/utils/lib/getValueOrDefault/index.d.ts +1 -0
  57. package/dist/utils/lib/index.d.ts +10 -8
  58. package/dist/utils/lib/isTruthy/index.d.ts +1 -0
  59. package/dist/utils/lib/parseFromValuesOrFunc/index.d.ts +1 -0
  60. package/dist/utils/lib/parseValue/index.d.ts +1 -0
  61. package/dist/utils/lib/urlJoin/index.d.ts +1 -0
  62. package/dist/zustand/lib/index.d.ts +2 -3
  63. package/dist/zustand/lib/useProxy/index.d.ts +1 -0
  64. package/dist/zustand/lib/utils/index.d.ts +2 -0
  65. package/package.json +1 -1
@@ -16,7 +16,7 @@ const overlayProps = require("../Modals/overlayProps.cjs");
16
16
  const convertToFormInputs$1 = require("../utils/convertToFormInputs.cjs");
17
17
  function EditDialog({ jsonForms: __jsonForms, ...props }) {
18
18
  const { info, refetch, refetchInfo, updateEntry } = useApi.useApi();
19
- const { opened, setOpened, item, state, getState, setState, reset, view, setView } = useForms.useForms("edit");
19
+ const { opened, setOpened, item, getItem, state, getState, setState, reset, view, setView } = useForms.useForms("edit");
20
20
  const [loading, setLoading] = hooks.useDebouncedState(false, constants.DEBOUNCE_LOADING_DELAY);
21
21
  const { jsonForms: _jsonForms } = core.useProps("EditDialog", {}, {});
22
22
  const jsonForms = React.useMemo(
@@ -27,7 +27,7 @@ function EditDialog({ jsonForms: __jsonForms, ...props }) {
27
27
  (e) => {
28
28
  e == null ? void 0 : e.preventDefault();
29
29
  setLoading(true);
30
- updateEntry(item == null ? void 0 : item.id, getState().data).then((res) => {
30
+ updateEntry(utils.getItemId(getItem()), getState().data).then((res) => {
31
31
  if (res) {
32
32
  refetch();
33
33
  refetchInfo();
@@ -38,7 +38,7 @@ function EditDialog({ jsonForms: __jsonForms, ...props }) {
38
38
  setOpened(false);
39
39
  });
40
40
  },
41
- [setLoading, updateEntry, item == null ? void 0 : item.id, getState, refetch, refetchInfo, setOpened]
41
+ [setLoading, updateEntry, getItem, getState, refetch, refetchInfo, setOpened]
42
42
  );
43
43
  const { fab } = useInfo.useInfo();
44
44
  const initialState = React.useMemo(
@@ -18,7 +18,7 @@ function ViewDialog({ item, info, opened, onClose, ...props }) {
18
18
  {
19
19
  opened,
20
20
  onClose,
21
- title: `${item == null ? void 0 : item.show_title} (#${convertId.convertId(item == null ? void 0 : item.id)})`,
21
+ title: `${item == null ? void 0 : item.show_title} (#${convertId.convertId(utils.getItemId(item))})`,
22
22
  size: "lg",
23
23
  centered: true,
24
24
  zIndex: 1e3,
@@ -42,7 +42,7 @@ function ViewDialog({ item, info, opened, onClose, ...props }) {
42
42
  RelationPanel,
43
43
  {
44
44
  relatedPath: relation.path,
45
- id: convertId.convertId(item.id),
45
+ id: convertId.convertId(utils.getItemId(item)),
46
46
  foreign_key: relation.foreign_key,
47
47
  type: relation.type
48
48
  }
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
+ const utils = require("fastapi-rtk/utils");
4
5
  const core = require("@mantine/core");
5
6
  const convertId = require("../../../../Wrappers/ApiProvider/utils/convertId.cjs");
6
7
  function FormRelatedListSelect({ form, name, items, ...props }) {
7
- const data = items.map((item) => ({ value: String(convertId.convertId(item.id)), label: item.value }));
8
- const currentItems = Array.isArray(form.getInputProps(name).value) ? form.getInputProps(name).value.map((value) => typeof value === "object" ? String(convertId.convertId(value.id)) : String(value)) : [];
8
+ const data = items.map((item) => ({ value: String(convertId.convertId(utils.getItemId(item))), label: item.value }));
9
+ const currentItems = Array.isArray(form.getInputProps(name).value) ? form.getInputProps(name).value.map((value) => typeof value === "object" ? String(convertId.convertId(utils.getItemId(value))) : String(value)) : [];
9
10
  return /* @__PURE__ */ jsxRuntime.jsx(core.MultiSelect, { data, searchable: true, ...form.getInputProps(name), value: currentItems || [], ...props });
10
11
  }
11
12
  exports.FormRelatedListSelect = FormRelatedListSelect;
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
+ const utils = require("fastapi-rtk/utils");
4
5
  const core = require("@mantine/core");
5
6
  const convertId = require("../../../../Wrappers/ApiProvider/utils/convertId.cjs");
6
7
  function FormRelatedSelect({ form, name, items, filter, ...props }) {
7
- var _a;
8
8
  const data = items.map((item) => ({
9
- value: String(convertId.convertId(item.id)),
9
+ value: String(convertId.convertId(utils.getItemId(item))),
10
10
  label: item.value
11
11
  }));
12
12
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -20,10 +20,10 @@ function FormRelatedSelect({ form, name, items, filter, ...props }) {
20
20
  form.setFieldValue(name, value);
21
21
  return;
22
22
  }
23
- const newItem = items.find((item) => String(convertId.convertId(item.id)) === value) || null;
23
+ const newItem = items.find((item) => String(convertId.convertId(utils.getItemId(item))) === value) || null;
24
24
  form.setFieldValue(name, newItem);
25
25
  },
26
- value: filter ? form.getInputProps(name).value : String(convertId.convertId((_a = form.getInputProps(name).value) == null ? void 0 : _a.id)) || "",
26
+ value: filter ? form.getInputProps(name).value : String(convertId.convertId(utils.getItemId(form.getInputProps(name).value))) || "",
27
27
  ...props
28
28
  }
29
29
  );
@@ -149,7 +149,7 @@ const NextGenDataGrid = React.forwardRef((props, ref) => {
149
149
  const mrtProps = React.useMemo(
150
150
  () => utils.deepMerge(
151
151
  baseProps,
152
- { mantinePaperProps: { ref }, getRowId: (originalRow) => originalRow.id },
152
+ { mantinePaperProps: { ref }, getRowId: utils.getItemId },
153
153
  columnsProps,
154
154
  dataProps,
155
155
  sortingProps,
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
+ const utils = require("fastapi-rtk/utils");
4
5
  const React = require("react");
5
6
  const Actions = require("../../../ActionIcons/Actions.cjs");
6
7
  const useApi = require("../../../hooks/api/useApi.cjs");
@@ -13,7 +14,7 @@ function useActions(hideActions, component) {
13
14
  ({ row, ...rest }) => /* @__PURE__ */ jsxRuntime.jsx(
14
15
  FallbackWrapper.FallbackWrapper,
15
16
  {
16
- fallback: /* @__PURE__ */ jsxRuntime.jsx(Actions.Actions, { id: row.original.id }),
17
+ fallback: /* @__PURE__ */ jsxRuntime.jsx(Actions.Actions, { id: utils.getItemId(row.original) }),
17
18
  functionProps: {
18
19
  api,
19
20
  auth,
@@ -43,6 +43,7 @@ function ColumnHeaderFilter({
43
43
  filterProps,
44
44
  filterModeDescription,
45
45
  filterMenu,
46
+ onFilterClear,
46
47
  filters,
47
48
  filterFn,
48
49
  mrtProps: { column, table, ...restProps }
@@ -76,6 +77,7 @@ function ColumnHeaderFilter({
76
77
  const handleClear = React.useCallback(() => {
77
78
  field.reset();
78
79
  column.setFilterValue(void 0);
80
+ onFilterClear == null ? void 0 : onFilterClear();
79
81
  }, []);
80
82
  const [debounced] = hooks.useDebouncedValue(field.getInputProps().value, constants.DEBOUNCE_DELAY);
81
83
  const isMounted = hooks.useMounted();
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
+ const utils = require("fastapi-rtk/utils");
4
5
  const core = require("@mantine/core");
5
6
  const React = require("react");
6
7
  const convertId = require("../../../../../../Wrappers/ApiProvider/utils/convertId.cjs");
7
8
  const HeaderMultiSelectInput = React.forwardRef(
8
9
  // eslint-disable-next-line no-unused-vars
9
10
  ({ data, clearIcon, mrtprops: { multiselectprops }, placeholder, ...props }, ref) => {
10
- const value = Array.isArray(props.value) ? props.value.map((value2) => typeof value2 === "object" ? String(convertId.convertId(value2.id)) : String(value2)) : [];
11
+ const value = Array.isArray(props.value) ? props.value.map((value2) => typeof value2 === "object" ? String(convertId.convertId(utils.getItemId(value2))) : String(value2)) : [];
11
12
  return /* @__PURE__ */ jsxRuntime.jsxs(core.Box, { ...props, children: [
12
13
  !value.length && /* @__PURE__ */ jsxRuntime.jsx(core.TextInput, { pos: "absolute", placeholder, ...props, value: void 0, onChange: void 0 }),
13
14
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -33,6 +33,7 @@ function useColumns(columnProps, header, body, textFilterSeparator) {
33
33
  filterProps,
34
34
  filterModeDescription,
35
35
  filterMenu,
36
+ onFilterClear,
36
37
  defaultOpr = ((_d = (_c = (_b = (_a = info == null ? void 0 : info.filters) == null ? void 0 : _a[col]) == null ? void 0 : _b.filters) == null ? void 0 : _c[0]) == null ? void 0 : _d.operator) || ""
37
38
  } = utils.getProps(header, specialKey.all, col);
38
39
  const filterFn = utils.fromFilterToFilterFn(col, defaultOpr);
@@ -54,6 +55,7 @@ function useColumns(columnProps, header, body, textFilterSeparator) {
54
55
  filterProps,
55
56
  filterModeDescription,
56
57
  filterMenu,
58
+ onFilterClear,
57
59
  filters,
58
60
  filterFn,
59
61
  mrtProps: props,
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
+ const utils = require("fastapi-rtk/utils");
4
5
  const convertId = require("../../../../Wrappers/ApiProvider/utils/convertId.cjs");
5
6
  const HeaderBetweenInput = require("./ColumnHeaderFilter/HeaderInputs/HeaderBetweenInput.cjs");
6
7
  const HeaderBooleanInput = require("./ColumnHeaderFilter/HeaderInputs/HeaderBooleanInput.cjs");
@@ -46,7 +47,7 @@ const getBasicInput = (opr, schema) => {
46
47
  return ({ componentProps }) => /* @__PURE__ */ jsxRuntime.jsx(
47
48
  HeaderSelectInput.HeaderSelectInput,
48
49
  {
49
- data: schema.values.map((item) => ({ value: String(convertId.convertId(item.id)), label: item.value })),
50
+ data: schema.values.map((item) => ({ value: String(convertId.convertId(utils.getItemId(item))), label: item.value })),
50
51
  ...componentProps
51
52
  }
52
53
  );
@@ -55,7 +56,7 @@ const getBasicInput = (opr, schema) => {
55
56
  return ({ componentProps }) => /* @__PURE__ */ jsxRuntime.jsx(
56
57
  HeaderMultiSelectInput.HeaderMultiSelectInput,
57
58
  {
58
- data: schema.values.map((item) => ({ value: String(convertId.convertId(item.id)), label: item.value })),
59
+ data: schema.values.map((item) => ({ value: String(convertId.convertId(utils.getItemId(item))), label: item.value })),
59
60
  ...componentProps
60
61
  }
61
62
  );
@@ -1,17 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const useApi = require("../../../hooks/api/useApi.cjs");
3
+ const utils = require("fastapi-rtk/utils");
4
4
  function useEvent(onClickEntry) {
5
- const { data } = useApi.useApi();
6
5
  if (!onClickEntry) {
7
6
  return null;
8
7
  }
9
8
  return {
10
9
  mantineTableBodyRowProps: ({ row }) => ({
11
- onClick: () => {
12
- const id = data.ids[row.id];
13
- onClickEntry(id, row.original);
14
- },
10
+ onClick: () => onClickEntry(utils.getItemId(row.original), row.original),
15
11
  style: { cursor: "pointer" }
16
12
  })
17
13
  };
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const React = require("react");
4
- const utils$1 = require("fastapi-rtk/utils");
4
+ const utils = require("fastapi-rtk/utils");
5
5
  const hooks = require("@mantine/hooks");
6
6
  const useQuery = require("../../../../../.external/cjs/@tanstack_react-query@5.76.1_react@18.3.1/@tanstack/react-query/build/modern/useQuery.cjs");
7
7
  const createItem = require("../utils/api/createItem.cjs");
@@ -15,7 +15,7 @@ const uploadItems = require("../utils/api/uploadItems.cjs");
15
15
  const convertId = require("../utils/convertId.cjs");
16
16
  const convertInfo = require("../utils/convertInfo.cjs");
17
17
  const createQueryParams = require("../utils/createQueryParams.cjs");
18
- const utils = require("../../../../../.external/cjs/@tanstack_query-core@5.76.0/@tanstack/query-core/build/modern/utils.cjs");
18
+ const utils$1 = require("../../../../../.external/cjs/@tanstack_query-core@5.76.0/@tanstack/query-core/build/modern/utils.cjs");
19
19
  function useProvideApi({
20
20
  path,
21
21
  initialQueryParams,
@@ -45,7 +45,7 @@ function useProvideApi({
45
45
  ...relation ? {
46
46
  filters: [
47
47
  ...queryParams.filters || [],
48
- { col: relation.foreign_key, opr: relation.type, value: convertId.convertId(relation.id) }
48
+ { col: relation.foreign_key, opr: relation.type, value: convertId.convertId(utils.getItemId(relation)) }
49
49
  ]
50
50
  } : {}
51
51
  } : null;
@@ -93,8 +93,8 @@ function useProvideApi({
93
93
  error: infoError
94
94
  } = useQuery.useQuery({
95
95
  queryKey: [`info`, path],
96
- queryFn: ({ signal }) => getInfo.getInfo(utils$1.urlJoin(path, "_info"), signal).then((data2) => ({ ...convertInfo.convertInfo(data2), path })),
97
- placeholderData: clearInfoOnRefetch ? null : utils.keepPreviousData,
96
+ queryFn: ({ signal }) => getInfo.getInfo(utils.urlJoin(path, "_info"), signal).then((data2) => ({ ...convertInfo.convertInfo(data2), path })),
97
+ placeholderData: clearInfoOnRefetch ? null : utils$1.keepPreviousData,
98
98
  enabled: fetchInfo,
99
99
  retry: false,
100
100
  refetchOnMount: false,
@@ -109,12 +109,12 @@ function useProvideApi({
109
109
  error: dataError
110
110
  } = useQuery.useQuery({
111
111
  queryKey: [`data`, memoizedQueryParamsPathRef.current, JSON.stringify(memoizedQueryParams)],
112
- queryFn: ({ signal }) => memoizedQueryParams ? getItems.getItems(utils$1.urlJoin(memoizedQueryParamsPathRef.current, "/"), memoizedQueryParams, signal).then((data2) => ({
112
+ queryFn: ({ signal }) => memoizedQueryParams ? getItems.getItems(utils.urlJoin(memoizedQueryParamsPathRef.current, "/"), memoizedQueryParams, signal).then((data2) => ({
113
113
  ...data2,
114
114
  result: data2.result.map((item, index) => ({ ...item, id: data2.ids[index] })),
115
115
  path: memoizedQueryParamsPathRef.current
116
116
  })) : null,
117
- placeholderData: clearDataOnRefetch ? null : utils.keepPreviousData,
117
+ placeholderData: clearDataOnRefetch ? null : utils$1.keepPreviousData,
118
118
  retry: false,
119
119
  ...dataQueryProps
120
120
  });
@@ -23,17 +23,16 @@ function useInfo(baseUrl, auth, fab) {
23
23
  }
24
24
  return useProvideInfo$1.useProvideInfo(baseUrl, auth);
25
25
  }
26
- function InnerProvider(providerProps) {
26
+ function InnerProvider(props) {
27
27
  const defaultproviderProps = { baseUrl: new URL(document.baseURI).pathname + "/api/v1", inheritMantineTheme: false };
28
- const { baseUrl, authQueryProps, children } = { ...defaultproviderProps, ...providerProps };
29
- const auth = useAuth(baseUrl, authQueryProps, providerProps.fab);
28
+ const { baseUrl, authQueryProps, children } = { ...defaultproviderProps, ...props };
29
+ const auth = useAuth(baseUrl, authQueryProps, props.fab);
30
30
  const authProxy = zustand.useProxy(auth);
31
- const info = useInfo(baseUrl, auth, providerProps.fab);
31
+ const info = useInfo(baseUrl, auth, props.fab);
32
32
  const infoProxy = zustand.useProxy(info);
33
33
  return /* @__PURE__ */ jsxRuntime.jsx(AuthContext.AuthContext.Provider, { value: authProxy, children: /* @__PURE__ */ jsxRuntime.jsx(InfoContext.InfoContext.Provider, { value: infoProxy, children }) });
34
34
  }
35
- const Provider = ({ fab, baseUrl, authQueryProps, ...rest }) => {
36
- const props = { fab, baseUrl, authQueryProps, ...rest };
35
+ const Provider = (props) => {
37
36
  const [queryClient$1] = React.useState(() => new queryClient.QueryClient());
38
37
  return /* @__PURE__ */ jsxRuntime.jsx(QueryClientProvider.QueryClientProvider, { client: queryClient$1, children: /* @__PURE__ */ jsxRuntime.jsx(InnerProvider, { ...props }) });
39
38
  };
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const React = require("react");
4
- const utils$1 = require("fastapi-rtk/utils");
4
+ const utils = require("fastapi-rtk/utils");
5
5
  const hooks = require("@mantine/hooks");
6
- const utils = require("../../../../../.external/cjs/@tanstack_query-core@5.76.0/@tanstack/query-core/build/modern/utils.cjs");
6
+ const utils$1 = require("../../../../../.external/cjs/@tanstack_query-core@5.76.0/@tanstack/query-core/build/modern/utils.cjs");
7
7
  const useQuery = require("../../../../../.external/cjs/@tanstack_react-query@5.76.1_react@18.3.1/@tanstack/react-query/build/modern/useQuery.cjs");
8
8
  const createItem = require("../utils/api/createItem.cjs");
9
9
  const deleteItem = require("../utils/api/deleteItem.cjs");
@@ -45,7 +45,7 @@ function useFabProvideApi({
45
45
  ...relation ? {
46
46
  filters: [
47
47
  ...queryParams.filters || [],
48
- { col: relation.foreign_key, opr: relation.type, value: convertId.convertId(relation.id) }
48
+ { col: relation.foreign_key, opr: relation.type, value: convertId.convertId(utils.getItemId(relation)) }
49
49
  ]
50
50
  } : {}
51
51
  } : null;
@@ -93,8 +93,8 @@ function useFabProvideApi({
93
93
  error: infoError
94
94
  } = useQuery.useQuery({
95
95
  queryKey: [`info`, path],
96
- queryFn: ({ signal }) => getInfo.getInfo(utils$1.urlJoin(path, "_info"), signal).then((data2) => ({ ...convertInfo.convertInfo(data2), path })),
97
- placeholderData: clearInfoOnRefetch ? null : utils.keepPreviousData,
96
+ queryFn: ({ signal }) => getInfo.getInfo(utils.urlJoin(path, "_info"), signal).then((data2) => ({ ...convertInfo.convertInfo(data2), path })),
97
+ placeholderData: clearInfoOnRefetch ? null : utils$1.keepPreviousData,
98
98
  enabled: fetchInfo,
99
99
  retry: false,
100
100
  refetchOnMount: false,
@@ -109,12 +109,12 @@ function useFabProvideApi({
109
109
  error: dataError
110
110
  } = useQuery.useQuery({
111
111
  queryKey: [`data`, memoizedQueryParamsPathRef.current, JSON.stringify(memoizedQueryParams)],
112
- queryFn: ({ signal }) => memoizedQueryParams ? getItems.getItems(utils$1.urlJoin(memoizedQueryParamsPathRef.current, "/"), memoizedQueryParams, signal).then((data2) => ({
112
+ queryFn: ({ signal }) => memoizedQueryParams ? getItems.getItems(utils.urlJoin(memoizedQueryParamsPathRef.current, "/"), memoizedQueryParams, signal).then((data2) => ({
113
113
  ...data2,
114
114
  result: data2.result.map((item, index) => ({ ...item, id: data2.ids[index] })),
115
115
  path: memoizedQueryParamsPathRef.current
116
116
  })) : null,
117
- placeholderData: clearDataOnRefetch ? null : utils.keepPreviousData,
117
+ placeholderData: clearDataOnRefetch ? null : utils$1.keepPreviousData,
118
118
  retry: false,
119
119
  ...dataQueryProps
120
120
  });
@@ -1,22 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const utils = require("fastapi-rtk/utils");
3
4
  function convertToFormInputs(item, columns) {
4
5
  const result = {};
5
6
  columns.forEach((column) => {
6
- var _a, _b;
7
+ var _a;
7
8
  const { type, values } = column;
8
9
  if (!values) {
9
- result[column.name] = (((_a = item[column.name]) == null ? void 0 : _a.id) || item[column.name]) ?? void 0;
10
+ result[column.name] = (utils.getItemId(item[column.name]) || item[column.name]) ?? void 0;
10
11
  return;
11
12
  }
12
13
  if (type === "Related") {
13
- result[column.name] = values.find((val) => {
14
- var _a2;
15
- return val.id === ((_a2 = item[column.name]) == null ? void 0 : _a2.id);
16
- }) || item[column.name];
14
+ result[column.name] = values.find((val) => utils.getItemId(val) === utils.getItemId(item[column.name])) || item[column.name];
17
15
  } else {
18
- const existingValues = ((_b = item[column.name]) == null ? void 0 : _b.map((item2) => item2.id || item2)) || [];
19
- result[column.name] = values.filter((val) => existingValues.includes(val.id)).map((val) => val.id);
16
+ const existingValues = ((_a = item[column.name]) == null ? void 0 : _a.map((item2) => utils.getItemId(item2) || item2)) || [];
17
+ result[column.name] = values.filter((val) => existingValues.includes(utils.getItemId(val))).map(utils.getItemId);
20
18
  }
21
19
  });
22
20
  return result;
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { DEBOUNCE_LOADING_DELAY, initialState, VIEW_MODE } from "fastapi-rtk/constants";
3
- import { deepMerge } from "fastapi-rtk/utils";
3
+ import { deepMerge, getItemId } from "fastapi-rtk/utils";
4
4
  import { useProps } from "@mantine/core";
5
5
  import { useDebouncedState } from "@mantine/hooks";
6
6
  import { useMemo, useCallback, useEffect } from "react";
@@ -14,7 +14,7 @@ import { overlayProps } from "../Modals/overlayProps.mjs";
14
14
  import { convertToFormInputs as convertToFormInputs$1 } from "../utils/convertToFormInputs.mjs";
15
15
  function EditDialog({ jsonForms: __jsonForms, ...props }) {
16
16
  const { info, refetch, refetchInfo, updateEntry } = useApi();
17
- const { opened, setOpened, item, state, getState, setState, reset, view, setView } = useForms("edit");
17
+ const { opened, setOpened, item, getItem, state, getState, setState, reset, view, setView } = useForms("edit");
18
18
  const [loading, setLoading] = useDebouncedState(false, DEBOUNCE_LOADING_DELAY);
19
19
  const { jsonForms: _jsonForms } = useProps("EditDialog", {}, {});
20
20
  const jsonForms = useMemo(
@@ -25,7 +25,7 @@ function EditDialog({ jsonForms: __jsonForms, ...props }) {
25
25
  (e) => {
26
26
  e == null ? void 0 : e.preventDefault();
27
27
  setLoading(true);
28
- updateEntry(item == null ? void 0 : item.id, getState().data).then((res) => {
28
+ updateEntry(getItemId(getItem()), getState().data).then((res) => {
29
29
  if (res) {
30
30
  refetch();
31
31
  refetchInfo();
@@ -36,7 +36,7 @@ function EditDialog({ jsonForms: __jsonForms, ...props }) {
36
36
  setOpened(false);
37
37
  });
38
38
  },
39
- [setLoading, updateEntry, item == null ? void 0 : item.id, getState, refetch, refetchInfo, setOpened]
39
+ [setLoading, updateEntry, getItem, getState, refetch, refetchInfo, setOpened]
40
40
  );
41
41
  const { fab } = useInfo();
42
42
  const initialState$1 = useMemo(
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { getValue } from "fastapi-rtk/utils";
2
+ import { getValue, getItemId } from "fastapi-rtk/utils";
3
3
  import { useProps, Modal, Tabs, Paper, Stack, ScrollArea, Grid, Text } from "@mantine/core";
4
4
  import { convertId } from "../../Wrappers/ApiProvider/utils/convertId.mjs";
5
5
  import RelationPanel from "./RelationPanel.mjs";
@@ -16,7 +16,7 @@ function ViewDialog({ item, info, opened, onClose, ...props }) {
16
16
  {
17
17
  opened,
18
18
  onClose,
19
- title: `${item == null ? void 0 : item.show_title} (#${convertId(item == null ? void 0 : item.id)})`,
19
+ title: `${item == null ? void 0 : item.show_title} (#${convertId(getItemId(item))})`,
20
20
  size: "lg",
21
21
  centered: true,
22
22
  zIndex: 1e3,
@@ -40,7 +40,7 @@ function ViewDialog({ item, info, opened, onClose, ...props }) {
40
40
  RelationPanel,
41
41
  {
42
42
  relatedPath: relation.path,
43
- id: convertId(item.id),
43
+ id: convertId(getItemId(item)),
44
44
  foreign_key: relation.foreign_key,
45
45
  type: relation.type
46
46
  }
@@ -1,9 +1,10 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import { getItemId } from "fastapi-rtk/utils";
2
3
  import { MultiSelect } from "@mantine/core";
3
4
  import { convertId } from "../../../../Wrappers/ApiProvider/utils/convertId.mjs";
4
5
  function FormRelatedListSelect({ form, name, items, ...props }) {
5
- const data = items.map((item) => ({ value: String(convertId(item.id)), label: item.value }));
6
- const currentItems = Array.isArray(form.getInputProps(name).value) ? form.getInputProps(name).value.map((value) => typeof value === "object" ? String(convertId(value.id)) : String(value)) : [];
6
+ const data = items.map((item) => ({ value: String(convertId(getItemId(item))), label: item.value }));
7
+ const currentItems = Array.isArray(form.getInputProps(name).value) ? form.getInputProps(name).value.map((value) => typeof value === "object" ? String(convertId(getItemId(value))) : String(value)) : [];
7
8
  return /* @__PURE__ */ jsx(MultiSelect, { data, searchable: true, ...form.getInputProps(name), value: currentItems || [], ...props });
8
9
  }
9
10
  export {
@@ -1,10 +1,10 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import { getItemId } from "fastapi-rtk/utils";
2
3
  import { Select } from "@mantine/core";
3
4
  import { convertId } from "../../../../Wrappers/ApiProvider/utils/convertId.mjs";
4
5
  function FormRelatedSelect({ form, name, items, filter, ...props }) {
5
- var _a;
6
6
  const data = items.map((item) => ({
7
- value: String(convertId(item.id)),
7
+ value: String(convertId(getItemId(item))),
8
8
  label: item.value
9
9
  }));
10
10
  return /* @__PURE__ */ jsx(
@@ -18,10 +18,10 @@ function FormRelatedSelect({ form, name, items, filter, ...props }) {
18
18
  form.setFieldValue(name, value);
19
19
  return;
20
20
  }
21
- const newItem = items.find((item) => String(convertId(item.id)) === value) || null;
21
+ const newItem = items.find((item) => String(convertId(getItemId(item))) === value) || null;
22
22
  form.setFieldValue(name, newItem);
23
23
  },
24
- value: filter ? form.getInputProps(name).value : String(convertId((_a = form.getInputProps(name).value) == null ? void 0 : _a.id)) || "",
24
+ value: filter ? form.getInputProps(name).value : String(convertId(getItemId(form.getInputProps(name).value))) || "",
25
25
  ...props
26
26
  }
27
27
  );
@@ -1,7 +1,7 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  /* empty css */
3
3
  /* empty css */
4
- import { deepMerge } from "fastapi-rtk/utils";
4
+ import { deepMerge, getItemId } from "fastapi-rtk/utils";
5
5
  import { useProps, Box } from "@mantine/core";
6
6
  import { useMantineReactTable, MantineReactTable } from "../../../../.external/esm/mantine-react-table@2.0.0-beta.9_@mantine_core@7.17.7_@mantine_dates@7.17.7_@mantine_hooks@7._dm3meh6s7t7wwl37at3cedg6gm/mantine-react-table/dist/index.esm.mjs";
7
7
  import { forwardRef, useMemo, useEffect } from "react";
@@ -147,7 +147,7 @@ const NextGenDataGrid = forwardRef((props, ref) => {
147
147
  const mrtProps = useMemo(
148
148
  () => deepMerge(
149
149
  baseProps,
150
- { mantinePaperProps: { ref }, getRowId: (originalRow) => originalRow.id },
150
+ { mantinePaperProps: { ref }, getRowId: getItemId },
151
151
  columnsProps,
152
152
  dataProps,
153
153
  sortingProps,
@@ -1,4 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import { getItemId } from "fastapi-rtk/utils";
2
3
  import { useCallback } from "react";
3
4
  import { Actions } from "../../../ActionIcons/Actions.mjs";
4
5
  import { useApi } from "../../../hooks/api/useApi.mjs";
@@ -11,7 +12,7 @@ function useActions(hideActions, component) {
11
12
  ({ row, ...rest }) => /* @__PURE__ */ jsx(
12
13
  FallbackWrapper,
13
14
  {
14
- fallback: /* @__PURE__ */ jsx(Actions, { id: row.original.id }),
15
+ fallback: /* @__PURE__ */ jsx(Actions, { id: getItemId(row.original) }),
15
16
  functionProps: {
16
17
  api,
17
18
  auth,
@@ -41,6 +41,7 @@ function ColumnHeaderFilter({
41
41
  filterProps,
42
42
  filterModeDescription,
43
43
  filterMenu,
44
+ onFilterClear,
44
45
  filters,
45
46
  filterFn,
46
47
  mrtProps: { column, table, ...restProps }
@@ -74,6 +75,7 @@ function ColumnHeaderFilter({
74
75
  const handleClear = useCallback(() => {
75
76
  field.reset();
76
77
  column.setFilterValue(void 0);
78
+ onFilterClear == null ? void 0 : onFilterClear();
77
79
  }, []);
78
80
  const [debounced] = useDebouncedValue(field.getInputProps().value, DEBOUNCE_DELAY);
79
81
  const isMounted = useMounted();
@@ -1,11 +1,12 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { getItemId } from "fastapi-rtk/utils";
2
3
  import { Box, TextInput, MultiSelect } from "@mantine/core";
3
4
  import { forwardRef } from "react";
4
5
  import { convertId } from "../../../../../../Wrappers/ApiProvider/utils/convertId.mjs";
5
6
  const HeaderMultiSelectInput = forwardRef(
6
7
  // eslint-disable-next-line no-unused-vars
7
8
  ({ data, clearIcon, mrtprops: { multiselectprops }, placeholder, ...props }, ref) => {
8
- const value = Array.isArray(props.value) ? props.value.map((value2) => typeof value2 === "object" ? String(convertId(value2.id)) : String(value2)) : [];
9
+ const value = Array.isArray(props.value) ? props.value.map((value2) => typeof value2 === "object" ? String(convertId(getItemId(value2))) : String(value2)) : [];
9
10
  return /* @__PURE__ */ jsxs(Box, { ...props, children: [
10
11
  !value.length && /* @__PURE__ */ jsx(TextInput, { pos: "absolute", placeholder, ...props, value: void 0, onChange: void 0 }),
11
12
  /* @__PURE__ */ jsx(
@@ -31,6 +31,7 @@ function useColumns(columnProps, header, body, textFilterSeparator) {
31
31
  filterProps,
32
32
  filterModeDescription,
33
33
  filterMenu,
34
+ onFilterClear,
34
35
  defaultOpr = ((_d = (_c = (_b = (_a = info == null ? void 0 : info.filters) == null ? void 0 : _a[col]) == null ? void 0 : _b.filters) == null ? void 0 : _c[0]) == null ? void 0 : _d.operator) || ""
35
36
  } = getProps(header, specialKey.all, col);
36
37
  const filterFn = fromFilterToFilterFn(col, defaultOpr);
@@ -52,6 +53,7 @@ function useColumns(columnProps, header, body, textFilterSeparator) {
52
53
  filterProps,
53
54
  filterModeDescription,
54
55
  filterMenu,
56
+ onFilterClear,
55
57
  filters,
56
58
  filterFn,
57
59
  mrtProps: props,
@@ -1,4 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import { getItemId } from "fastapi-rtk/utils";
2
3
  import { convertId } from "../../../../Wrappers/ApiProvider/utils/convertId.mjs";
3
4
  import { HeaderBetweenInput } from "./ColumnHeaderFilter/HeaderInputs/HeaderBetweenInput.mjs";
4
5
  import { HeaderBooleanInput } from "./ColumnHeaderFilter/HeaderInputs/HeaderBooleanInput.mjs";
@@ -44,7 +45,7 @@ const getBasicInput = (opr, schema) => {
44
45
  return ({ componentProps }) => /* @__PURE__ */ jsx(
45
46
  HeaderSelectInput,
46
47
  {
47
- data: schema.values.map((item) => ({ value: String(convertId(item.id)), label: item.value })),
48
+ data: schema.values.map((item) => ({ value: String(convertId(getItemId(item))), label: item.value })),
48
49
  ...componentProps
49
50
  }
50
51
  );
@@ -53,7 +54,7 @@ const getBasicInput = (opr, schema) => {
53
54
  return ({ componentProps }) => /* @__PURE__ */ jsx(
54
55
  HeaderMultiSelectInput,
55
56
  {
56
- data: schema.values.map((item) => ({ value: String(convertId(item.id)), label: item.value })),
57
+ data: schema.values.map((item) => ({ value: String(convertId(getItemId(item))), label: item.value })),
57
58
  ...componentProps
58
59
  }
59
60
  );
@@ -1,15 +1,11 @@
1
- import { useApi } from "../../../hooks/api/useApi.mjs";
1
+ import { getItemId } from "fastapi-rtk/utils";
2
2
  function useEvent(onClickEntry) {
3
- const { data } = useApi();
4
3
  if (!onClickEntry) {
5
4
  return null;
6
5
  }
7
6
  return {
8
7
  mantineTableBodyRowProps: ({ row }) => ({
9
- onClick: () => {
10
- const id = data.ids[row.id];
11
- onClickEntry(id, row.original);
12
- },
8
+ onClick: () => onClickEntry(getItemId(row.original), row.original),
13
9
  style: { cursor: "pointer" }
14
10
  })
15
11
  };
@@ -1,5 +1,5 @@
1
1
  import { useState, useRef, useEffect, useMemo, useCallback } from "react";
2
- import { urlJoin } from "fastapi-rtk/utils";
2
+ import { getItemId, urlJoin } from "fastapi-rtk/utils";
3
3
  import { useDidUpdate, useSetState } from "@mantine/hooks";
4
4
  import { useQuery } from "../../../../../.external/esm/@tanstack_react-query@5.76.1_react@18.3.1/@tanstack/react-query/build/modern/useQuery.mjs";
5
5
  import { createItem } from "../utils/api/createItem.mjs";
@@ -43,7 +43,7 @@ function useProvideApi({
43
43
  ...relation ? {
44
44
  filters: [
45
45
  ...queryParams.filters || [],
46
- { col: relation.foreign_key, opr: relation.type, value: convertId(relation.id) }
46
+ { col: relation.foreign_key, opr: relation.type, value: convertId(getItemId(relation)) }
47
47
  ]
48
48
  } : {}
49
49
  } : null;
@@ -21,17 +21,16 @@ function useInfo(baseUrl, auth, fab) {
21
21
  }
22
22
  return useProvideInfo(baseUrl, auth);
23
23
  }
24
- function InnerProvider(providerProps) {
24
+ function InnerProvider(props) {
25
25
  const defaultproviderProps = { baseUrl: new URL(document.baseURI).pathname + "/api/v1", inheritMantineTheme: false };
26
- const { baseUrl, authQueryProps, children } = { ...defaultproviderProps, ...providerProps };
27
- const auth = useAuth(baseUrl, authQueryProps, providerProps.fab);
26
+ const { baseUrl, authQueryProps, children } = { ...defaultproviderProps, ...props };
27
+ const auth = useAuth(baseUrl, authQueryProps, props.fab);
28
28
  const authProxy = useProxy(auth);
29
- const info = useInfo(baseUrl, auth, providerProps.fab);
29
+ const info = useInfo(baseUrl, auth, props.fab);
30
30
  const infoProxy = useProxy(info);
31
31
  return /* @__PURE__ */ jsx(AuthContext.Provider, { value: authProxy, children: /* @__PURE__ */ jsx(InfoContext.Provider, { value: infoProxy, children }) });
32
32
  }
33
- const Provider = ({ fab, baseUrl, authQueryProps, ...rest }) => {
34
- const props = { fab, baseUrl, authQueryProps, ...rest };
33
+ const Provider = (props) => {
35
34
  const [queryClient] = useState(() => new QueryClient());
36
35
  return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx(InnerProvider, { ...props }) });
37
36
  };
@@ -1,5 +1,5 @@
1
1
  import { useState, useRef, useEffect, useMemo, useCallback } from "react";
2
- import { urlJoin } from "fastapi-rtk/utils";
2
+ import { getItemId, urlJoin } from "fastapi-rtk/utils";
3
3
  import { useDidUpdate, useSetState } from "@mantine/hooks";
4
4
  import { keepPreviousData } from "../../../../../.external/esm/@tanstack_query-core@5.76.0/@tanstack/query-core/build/modern/utils.mjs";
5
5
  import { useQuery } from "../../../../../.external/esm/@tanstack_react-query@5.76.1_react@18.3.1/@tanstack/react-query/build/modern/useQuery.mjs";
@@ -43,7 +43,7 @@ function useFabProvideApi({
43
43
  ...relation ? {
44
44
  filters: [
45
45
  ...queryParams.filters || [],
46
- { col: relation.foreign_key, opr: relation.type, value: convertId(relation.id) }
46
+ { col: relation.foreign_key, opr: relation.type, value: convertId(getItemId(relation)) }
47
47
  ]
48
48
  } : {}
49
49
  } : null;
@@ -1,20 +1,18 @@
1
+ import { getItemId } from "fastapi-rtk/utils";
1
2
  function convertToFormInputs(item, columns) {
2
3
  const result = {};
3
4
  columns.forEach((column) => {
4
- var _a, _b;
5
+ var _a;
5
6
  const { type, values } = column;
6
7
  if (!values) {
7
- result[column.name] = (((_a = item[column.name]) == null ? void 0 : _a.id) || item[column.name]) ?? void 0;
8
+ result[column.name] = (getItemId(item[column.name]) || item[column.name]) ?? void 0;
8
9
  return;
9
10
  }
10
11
  if (type === "Related") {
11
- result[column.name] = values.find((val) => {
12
- var _a2;
13
- return val.id === ((_a2 = item[column.name]) == null ? void 0 : _a2.id);
14
- }) || item[column.name];
12
+ result[column.name] = values.find((val) => getItemId(val) === getItemId(item[column.name])) || item[column.name];
15
13
  } else {
16
- const existingValues = ((_b = item[column.name]) == null ? void 0 : _b.map((item2) => item2.id || item2)) || [];
17
- result[column.name] = values.filter((val) => existingValues.includes(val.id)).map((val) => val.id);
14
+ const existingValues = ((_a = item[column.name]) == null ? void 0 : _a.map((item2) => getItemId(item2) || item2)) || [];
15
+ result[column.name] = values.filter((val) => existingValues.includes(getItemId(val))).map(getItemId);
18
16
  }
19
17
  });
20
18
  return result;
@@ -1,10 +1,11 @@
1
- export function ColumnHeaderFilter({ children, enableFilterModes, enableAdvancedFilters, filterProps, filterModeDescription, filterMenu, filters, filterFn, mrtProps: { column, table, ...restProps }, }: {
1
+ export function ColumnHeaderFilter({ children, enableFilterModes, enableAdvancedFilters, filterProps, filterModeDescription, filterMenu, onFilterClear, filters, filterFn, mrtProps: { column, table, ...restProps }, }: {
2
2
  children: any;
3
3
  enableFilterModes: any;
4
4
  enableAdvancedFilters: any;
5
5
  filterProps: any;
6
6
  filterModeDescription: any;
7
7
  filterMenu: any;
8
+ onFilterClear: any;
8
9
  filters: any;
9
10
  filterFn: any;
10
11
  mrtProps: {
@@ -2,7 +2,7 @@ export function useEvent(onClickEntry: any): {
2
2
  mantineTableBodyRowProps: ({ row }: {
3
3
  row: any;
4
4
  }) => {
5
- onClick: () => void;
5
+ onClick: () => any;
6
6
  style: {
7
7
  cursor: string;
8
8
  };
@@ -1 +1 @@
1
- export function convertId(value: any): any;
1
+ export function convertId(value: Record<string, any> | string | number | string[] | number[]): string;
@@ -1,6 +1,23 @@
1
- export function Provider({ fab, baseUrl, authQueryProps, ...rest }: {
2
- [x: string]: any;
3
- fab: any;
4
- baseUrl: any;
5
- authQueryProps: any;
6
- }): import("react").JSX.Element;
1
+ export function Provider(props: ProviderProps): JSX.Element;
2
+ export type ProviderProps = {
3
+ /**
4
+ * - The base URL for the API
5
+ */
6
+ baseUrl: string;
7
+ /**
8
+ * - The react-query props for the auth. See here `https://tanstack.com/query/latest/docs/framework/react/reference/useQuery`
9
+ */
10
+ authQueryProps?: Record<string, any>;
11
+ /**
12
+ * - The children to be rendered inside the provider
13
+ */
14
+ children: ReactNode;
15
+ /**
16
+ * - Whether to use the backward compatibility to fab-react-toolkit
17
+ */
18
+ fab?: boolean;
19
+ /**
20
+ * - Whether to inherit the Mantine theme
21
+ */
22
+ inheritMantineTheme?: boolean;
23
+ };
@@ -1 +1 @@
1
- export function convertId(value: any): any;
1
+ export function convertId(value: Record<string, any> | string | number | string[] | number[]): string;
@@ -1430,6 +1430,7 @@
1430
1430
  display: flex;
1431
1431
  justify-content: space-between;
1432
1432
  align-items: center;
1433
+ height: unset;
1433
1434
  }
1434
1435
 
1435
1436
  .mrt-table-head-cell-content .mrt-table-head-cell-content-actions .mantine-ActionIcon-icon {
@@ -1,3 +1,3 @@
1
- export { useActionIcon } from './useActionIcon/useActionIcon';
2
- export { useCustomFetch } from './useCustomFetch/useCustomFetch';
3
- export { useTrueOnce } from './useTrueOnce/useTrueOnce';
1
+ export * from './useActionIcon/index';
2
+ export * from './useCustomFetch/index';
3
+ export * from './useTrueOnce/index';
@@ -0,0 +1 @@
1
+ export * from './useActionIcon';
@@ -0,0 +1 @@
1
+ export * from './useCustomFetch';
@@ -0,0 +1 @@
1
+ export * from './useTrueOnce';
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const getItemId = (item) => item ? item.id_ ?? item.id : void 0;
4
+ exports.getItemId = getItemId;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const getItemName = (item) => item ? item.name_ ?? item._name : void 0;
4
+ exports.getItemName = getItemName;
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const createFetchParams = require("./createFetchParams/createFetchParams.cjs");
4
4
  const deepMerge = require("./deepMerge/deepMerge.cjs");
5
+ const getItemId = require("./getItemId/getItemId.cjs");
6
+ const getItemName = require("./getItemName/getItemName.cjs");
5
7
  const getValue = require("./getValue/getValue.cjs");
6
8
  const getValueOrDefault = require("./getValueOrDefault/getValueOrDefault.cjs");
7
9
  const isTruthy = require("./isTruthy/isTruthy.cjs");
@@ -10,9 +12,12 @@ const parseValue = require("./parseValue/parseValue.cjs");
10
12
  const urlJoin = require("./urlJoin/urlJoin.cjs");
11
13
  exports.createFetchParams = createFetchParams.createFetchParams;
12
14
  exports.deepMerge = deepMerge.deepMerge;
15
+ exports.getItemId = getItemId.getItemId;
16
+ exports.getItemName = getItemName.getItemName;
13
17
  exports.getValue = getValue.getValue;
14
18
  exports.getValueOrDefault = getValueOrDefault.getValueOrDefault;
15
19
  exports.isTruthy = isTruthy.isTruthy;
16
20
  exports.parseFromValuesOrFunc = parseFromValuesOrFunc.parseFromValuesOrFunc;
17
21
  exports.parseValue = parseValue.parseValue;
22
+ exports.normalize = urlJoin.normalize;
18
23
  exports.urlJoin = urlJoin.urlJoin;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const getItemName = require("../getItemName/getItemName.cjs");
3
4
  const parseValue = (value) => {
4
5
  if (value === void 0 || value === null) {
5
6
  return value;
@@ -11,7 +12,7 @@ const parseValue = (value) => {
11
12
  return value.map((entryItem) => parseValue(entryItem)).join(", ");
12
13
  }
13
14
  if (typeof value === "object") {
14
- return value.name_ || value._name || JSON.stringify(value);
15
+ return getItemName.getItemName(value) ?? JSON.stringify(value);
15
16
  }
16
17
  return value;
17
18
  };
@@ -0,0 +1,4 @@
1
+ const getItemId = (item) => item ? item.id_ ?? item.id : void 0;
2
+ export {
3
+ getItemId
4
+ };
@@ -0,0 +1,4 @@
1
+ const getItemName = (item) => item ? item.name_ ?? item._name : void 0;
2
+ export {
3
+ getItemName
4
+ };
@@ -1,17 +1,22 @@
1
1
  import { createFetchParams } from "./createFetchParams/createFetchParams.mjs";
2
2
  import { deepMerge } from "./deepMerge/deepMerge.mjs";
3
+ import { getItemId } from "./getItemId/getItemId.mjs";
4
+ import { getItemName } from "./getItemName/getItemName.mjs";
3
5
  import { getValue } from "./getValue/getValue.mjs";
4
6
  import { getValueOrDefault } from "./getValueOrDefault/getValueOrDefault.mjs";
5
7
  import { isTruthy } from "./isTruthy/isTruthy.mjs";
6
8
  import { parseFromValuesOrFunc } from "./parseFromValuesOrFunc/parseFromValuesOrFunc.mjs";
7
9
  import { parseValue } from "./parseValue/parseValue.mjs";
8
- import { urlJoin } from "./urlJoin/urlJoin.mjs";
10
+ import { normalize, urlJoin } from "./urlJoin/urlJoin.mjs";
9
11
  export {
10
12
  createFetchParams,
11
13
  deepMerge,
14
+ getItemId,
15
+ getItemName,
12
16
  getValue,
13
17
  getValueOrDefault,
14
18
  isTruthy,
19
+ normalize,
15
20
  parseFromValuesOrFunc,
16
21
  parseValue,
17
22
  urlJoin
@@ -1,3 +1,4 @@
1
+ import { getItemName } from "../getItemName/getItemName.mjs";
1
2
  const parseValue = (value) => {
2
3
  if (value === void 0 || value === null) {
3
4
  return value;
@@ -9,7 +10,7 @@ const parseValue = (value) => {
9
10
  return value.map((entryItem) => parseValue(entryItem)).join(", ");
10
11
  }
11
12
  if (typeof value === "object") {
12
- return value.name_ || value._name || JSON.stringify(value);
13
+ return getItemName(value) ?? JSON.stringify(value);
13
14
  }
14
15
  return value;
15
16
  };
@@ -0,0 +1 @@
1
+ export * from './createFetchParams';
@@ -0,0 +1 @@
1
+ export * from './deepMerge';
@@ -0,0 +1 @@
1
+ export function getItemId(item: Record<string, any>): (string | number | undefined);
@@ -0,0 +1 @@
1
+ export * from './getItemId';
@@ -0,0 +1 @@
1
+ export function getItemName(item: Record<string, any>): string | undefined;
@@ -0,0 +1 @@
1
+ export * from './getItemName';
@@ -0,0 +1 @@
1
+ export * from './getValue';
@@ -0,0 +1 @@
1
+ export * from './getValueOrDefault';
@@ -1,8 +1,10 @@
1
- export { createFetchParams } from './createFetchParams/createFetchParams';
2
- export { deepMerge } from './deepMerge/deepMerge';
3
- export { getValue } from './getValue/getValue';
4
- export { getValueOrDefault } from './getValueOrDefault/getValueOrDefault';
5
- export { isTruthy } from './isTruthy/isTruthy';
6
- export { parseFromValuesOrFunc } from './parseFromValuesOrFunc/parseFromValuesOrFunc';
7
- export { parseValue } from './parseValue/parseValue';
8
- export { urlJoin } from './urlJoin/urlJoin';
1
+ export * from './createFetchParams/index';
2
+ export * from './deepMerge/index';
3
+ export * from './getItemId/index';
4
+ export * from './getItemName/index';
5
+ export * from './getValue/index';
6
+ export * from './getValueOrDefault/index';
7
+ export * from './isTruthy/index';
8
+ export * from './parseFromValuesOrFunc/index';
9
+ export * from './parseValue/index';
10
+ export * from './urlJoin/index';
@@ -0,0 +1 @@
1
+ export * from './isTruthy';
@@ -0,0 +1 @@
1
+ export * from './parseFromValuesOrFunc';
@@ -0,0 +1 @@
1
+ export * from './parseValue';
@@ -0,0 +1 @@
1
+ export * from './urlJoin';
@@ -1,3 +1,2 @@
1
- export { useProxy } from './useProxy/useProxy';
2
- export { compareStateWithStore } from './utils/compareStateWithStore';
3
- export { createProxy } from './utils/createProxy';
1
+ export * from './useProxy/index';
2
+ export * from './utils/index';
@@ -0,0 +1 @@
1
+ export * from './useProxy';
@@ -0,0 +1,2 @@
1
+ export * from './compareStateWithStore';
2
+ export * from './createProxy';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastapi-rtk",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
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",