fastapi-rtk 0.2.39 → 0.2.40

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 (25) hide show
  1. package/dist/core/cjs/Dialogs/AddDialog.cjs +1 -1
  2. package/dist/core/cjs/Dialogs/DeleteDialog.cjs +4 -4
  3. package/dist/core/cjs/Dialogs/EditDialog.cjs +1 -1
  4. package/dist/core/cjs/Tables/DataGrid/ErrorDialog.cjs +5 -2
  5. package/dist/core/cjs/Tables/DataGrid/Toolbar/Filter/FilterMenu.cjs +1 -1
  6. package/dist/core/cjs/Wrappers/ApiProvider/hooks/useProvideApi.cjs +8 -8
  7. package/dist/core/cjs/Wrappers/ApiProvider/hooks/useProvideBulk.cjs +1 -1
  8. package/dist/core/cjs/Wrappers/Provider/utils/authFetch.cjs +2 -2
  9. package/dist/core/cjs/fab-react-toolkit-patch/auth/utils/authFetch.cjs +2 -2
  10. package/dist/core/cjs/translations/de.cjs +25 -3
  11. package/dist/core/esm/Dialogs/AddDialog.mjs +1 -1
  12. package/dist/core/esm/Dialogs/DeleteDialog.mjs +4 -4
  13. package/dist/core/esm/Dialogs/EditDialog.mjs +1 -1
  14. package/dist/core/esm/Tables/DataGrid/ErrorDialog.mjs +5 -2
  15. package/dist/core/esm/Tables/DataGrid/Toolbar/Filter/FilterMenu.mjs +1 -1
  16. package/dist/core/esm/Wrappers/ApiProvider/hooks/useProvideApi.mjs +8 -8
  17. package/dist/core/esm/Wrappers/ApiProvider/hooks/useProvideBulk.mjs +1 -1
  18. package/dist/core/esm/Wrappers/Provider/utils/authFetch.mjs +2 -2
  19. package/dist/core/esm/fab-react-toolkit-patch/auth/utils/authFetch.mjs +2 -2
  20. package/dist/core/esm/translations/de.mjs +25 -3
  21. package/dist/core/lib/Dialogs/DeleteDialog.d.ts +5 -1
  22. package/dist/core/lib/translations/de.d.ts +20 -0
  23. package/package.json +1 -1
  24. /package/dist/.external/cjs/{mantine-form-yup-resolver@2.0.0_@mantine_form@8.2.8_yup@1.7.0 → mantine-form-yup-resolver@2.0.0_@mantine_form@8.3.1_yup@1.7.0}/mantine-form-yup-resolver/dist/esm/index.cjs +0 -0
  25. /package/dist/.external/esm/{mantine-form-yup-resolver@2.0.0_@mantine_form@8.2.8_yup@1.7.0 → mantine-form-yup-resolver@2.0.0_@mantine_form@8.3.1_yup@1.7.0}/mantine-form-yup-resolver/dist/esm/index.mjs +0 -0
@@ -7,7 +7,7 @@ const utils = require("fastapi-rtk/utils");
7
7
  const core = require("@mantine/core");
8
8
  const form = require("@mantine/form");
9
9
  const hooks = require("@mantine/hooks");
10
- const index = require("../../../.external/cjs/mantine-form-yup-resolver@2.0.0_@mantine_form@8.2.8_yup@1.7.0/mantine-form-yup-resolver/dist/esm/index.cjs");
10
+ const index = require("../../../.external/cjs/mantine-form-yup-resolver@2.0.0_@mantine_form@8.3.1_yup@1.7.0/mantine-form-yup-resolver/dist/esm/index.cjs");
11
11
  const React = require("react");
12
12
  const useApi = require("../hooks/api/useApi.cjs");
13
13
  const useForms = require("../hooks/api/useForms.cjs");
@@ -11,7 +11,7 @@ const useApi = require("../hooks/api/useApi.cjs");
11
11
  const useForms = require("../hooks/api/useForms.cjs");
12
12
  require("../Wrappers/Provider/Contexts/LangContext.cjs");
13
13
  const useTranslation = require("../../../.external/cjs/react-i18next@15.7.3_i18next@25.5.2_react-dom@18.3.1_react@18.3.1_typescript@5.9.2/react-i18next/dist/es/useTranslation.cjs");
14
- const DeleteDialog = ({ onSuccess, onError, ...props }) => {
14
+ const DeleteDialog = ({ deleteText, onSuccess, onError, ...props }) => {
15
15
  const { refetch, refetchInfo, deleteEntry } = useApi.useApi();
16
16
  const { t } = useTranslation.useTranslation();
17
17
  const { opened, setOpened, getItem, reset, view, setView } = useForms.useForms("delete");
@@ -42,7 +42,7 @@ const DeleteDialog = ({ onSuccess, onError, ...props }) => {
42
42
  onReset,
43
43
  onSubmit,
44
44
  withTitleOptions: false,
45
- actionButtons: { groupProps: { mt: "xs" } },
45
+ actionButtons: { resetButtonProps: { variant: "outline" }, submitButtonProps: { color: "red" } },
46
46
  resetButtonText: t("Cancel"),
47
47
  buttonText: t("Delete"),
48
48
  buttonLoading: loading,
@@ -52,8 +52,8 @@ const DeleteDialog = ({ onSuccess, onError, ...props }) => {
52
52
  onExitTransitionEnd: reset,
53
53
  ...view === constants.VIEW_MODE.OVERLAY ? overlayProps.overlayProps : {},
54
54
  ...props,
55
- title: props.title ?? "Delete #" + String(getItem()),
56
- children: /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ta: "center", children: t("Are you sure you want to delete this item?") })
55
+ title: props.title ?? t("Delete Item?"),
56
+ children: deleteText ?? /* @__PURE__ */ jsxRuntime.jsx(core.Text, { children: t("Are you sure you want to delete this item?") })
57
57
  }
58
58
  );
59
59
  };
@@ -8,7 +8,7 @@ const core = require("@mantine/core");
8
8
  const form = require("@mantine/form");
9
9
  const hooks = require("@mantine/hooks");
10
10
  const lodash = require("../_virtual/lodash.cjs");
11
- const index = require("../../../.external/cjs/mantine-form-yup-resolver@2.0.0_@mantine_form@8.2.8_yup@1.7.0/mantine-form-yup-resolver/dist/esm/index.cjs");
11
+ const index = require("../../../.external/cjs/mantine-form-yup-resolver@2.0.0_@mantine_form@8.3.1_yup@1.7.0/mantine-form-yup-resolver/dist/esm/index.cjs");
12
12
  const React = require("react");
13
13
  const convertToFormInputs$1 = require("../ActionIcons/utils/convertToFormInputs.cjs");
14
14
  const convertToFormInputs = require("../fab-react-toolkit-patch/utils/convertToFormInputs.cjs");
@@ -3,9 +3,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const core = require("@mantine/core");
5
5
  const useApi = require("../../hooks/api/useApi.cjs");
6
+ require("../../Wrappers/Provider/Contexts/LangContext.cjs");
7
+ const useTranslation = require("../../../../.external/cjs/react-i18next@15.7.3_i18next@25.5.2_react-dom@18.3.1_react@18.3.1_typescript@5.9.2/react-i18next/dist/es/useTranslation.cjs");
6
8
  const IconAlertCircle = require("../../../../.external/cjs/@tabler_icons-react@3.18.0_react@18.3.1/@tabler/icons-react/dist/esm/icons/IconAlertCircle.cjs");
7
9
  function ErrorDialog() {
8
10
  const { error, resetError } = useApi.useApi();
11
+ const { t } = useTranslation.useTranslation();
9
12
  return /* @__PURE__ */ jsxRuntime.jsx(
10
13
  core.Modal,
11
14
  {
@@ -13,10 +16,10 @@ function ErrorDialog() {
13
16
  onClose: resetError,
14
17
  title: /* @__PURE__ */ jsxRuntime.jsxs(core.Group, { children: [
15
18
  /* @__PURE__ */ jsxRuntime.jsx(IconAlertCircle, { size: 16, color: "red" }),
16
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { children: error ? error.message : "Error" })
19
+ /* @__PURE__ */ jsxRuntime.jsx(core.Text, { children: error ? t(error.message, error.data) : t("Error") })
17
20
  ] }),
18
21
  centered: true,
19
- children: error ? /* @__PURE__ */ jsxRuntime.jsx(core.Text, { children: error.originalError.detail || error.originalError.message }) : null
22
+ children: error ? /* @__PURE__ */ jsxRuntime.jsx(core.Text, { children: error.originalError.detail || t(error.originalError.message) }) : null
20
23
  }
21
24
  );
22
25
  }
@@ -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.2.8_yup@1.7.0/mantine-form-yup-resolver/dist/esm/index.cjs");
7
+ const index = require("../../../../../../.external/cjs/mantine-form-yup-resolver@2.0.0_@mantine_form@8.3.1_yup@1.7.0/mantine-form-yup-resolver/dist/esm/index.cjs");
8
8
  const React = require("react");
9
9
  const index_esm = require("../../../../../../.external/cjs/yup@1.7.0/yup/index.esm.cjs");
10
10
  const useApi = require("../../../../hooks/api/useApi.cjs");
@@ -143,11 +143,11 @@ function useProvideApi({
143
143
  });
144
144
  React.useEffect(() => {
145
145
  if (infoError) {
146
- setError({ message: `Couldn't fetch info`, originalError: infoError });
146
+ setError({ message: `Could not fetch info`, originalError: infoError });
147
147
  return;
148
148
  }
149
149
  if (dataError) {
150
- setError({ message: `Couldn't fetch list`, originalError: dataError });
150
+ setError({ message: `Could not fetch list`, originalError: dataError });
151
151
  return;
152
152
  }
153
153
  resetError();
@@ -172,7 +172,7 @@ function useProvideApi({
172
172
  });
173
173
  return response;
174
174
  } catch (error2) {
175
- setError({ message: `Couldn't fetch item with id ${id}`, originalError: error2 });
175
+ setError({ message: "Could not fetch item with id {{id}}", data: { id }, originalError: error2 });
176
176
  if (throwOnError) {
177
177
  throw error2;
178
178
  }
@@ -191,7 +191,7 @@ function useProvideApi({
191
191
  });
192
192
  return response;
193
193
  } catch (error2) {
194
- setError({ message: `Couldn't add item`, originalError: error2 });
194
+ setError({ message: `Could not add item`, originalError: error2 });
195
195
  if (throwOnError) {
196
196
  throw error2;
197
197
  }
@@ -210,7 +210,7 @@ function useProvideApi({
210
210
  });
211
211
  return response;
212
212
  } catch (error2) {
213
- setError({ message: `Couldn't update item with id ${id}`, originalError: error2 });
213
+ setError({ message: "Could not update item with id {{id}}", data: { id }, originalError: error2 });
214
214
  if (throwOnError) {
215
215
  throw error2;
216
216
  }
@@ -227,7 +227,7 @@ function useProvideApi({
227
227
  });
228
228
  return response;
229
229
  } catch (error2) {
230
- setError({ message: `Couldn't delete item with id ${id}`, originalError: error2 });
230
+ setError({ message: "Could not delete item with id {{id}}", data: { id }, originalError: error2 });
231
231
  if (throwOnError) {
232
232
  throw error2;
233
233
  }
@@ -241,7 +241,7 @@ function useProvideApi({
241
241
  resetError();
242
242
  await api.downloadItems(pathRef.current, queryParamsRef.current, { label, export_mode, delimiter, quotechar });
243
243
  } catch (error2) {
244
- setError({ message: `Couldn't download`, originalError: error2 });
244
+ setError({ message: `Could not download`, originalError: error2 });
245
245
  if (throwOnError) {
246
246
  throw error2;
247
247
  }
@@ -256,7 +256,7 @@ function useProvideApi({
256
256
  const response = await api.uploadItems(pathRef.current, file, { delimiter, quotechar });
257
257
  return response;
258
258
  } catch (error2) {
259
- setError({ message: `Couldn't upload`, originalError: error2 });
259
+ setError({ message: `Could not upload`, originalError: error2 });
260
260
  if (throwOnError) {
261
261
  throw error2;
262
262
  }
@@ -17,7 +17,7 @@ const useProvideBulk = ({ path }, bulk = defaultBulk) => {
17
17
  const response = await bulk.postBulk(path, handler, data);
18
18
  return response;
19
19
  } catch (error2) {
20
- setError({ message: `Couldn't perform bulk action`, originalError: error2 });
20
+ setError({ message: `Could not perform bulk action`, originalError: error2 });
21
21
  }
22
22
  },
23
23
  [bulk, path, resetError, selectedIds]
@@ -42,7 +42,7 @@ async function authResetPassword(baseUrl, newPassword, { email }) {
42
42
  });
43
43
  const forgotPasswordRes = await fetch(fetchPath, options);
44
44
  if (!forgotPasswordRes.ok) {
45
- throw new Error("Couldn't request token to reset password");
45
+ throw new Error("Could not request token to reset password");
46
46
  }
47
47
  const jsonResponse = await forgotPasswordRes.json();
48
48
  const { token } = jsonResponse;
@@ -53,7 +53,7 @@ async function authResetPassword(baseUrl, newPassword, { email }) {
53
53
  });
54
54
  const resetPasswordRes = await fetch(fetchPath2, options2);
55
55
  if (!resetPasswordRes.ok) {
56
- throw new Error("Couldn't reset password");
56
+ throw new Error("Could not reset password");
57
57
  }
58
58
  }
59
59
  function authOAuthSignin(baseUrl, provider, popup, afterSigninPopup) {
@@ -34,7 +34,7 @@ async function authResetPassword(baseUrl, newPassword, { email }) {
34
34
  });
35
35
  const forgotPasswordRes = await fetch(fetchPath, options);
36
36
  if (!forgotPasswordRes.ok) {
37
- throw new Error("Couldn't request token to reset password");
37
+ throw new Error("Could not request token to reset password");
38
38
  }
39
39
  const jsonResponse = await forgotPasswordRes.json();
40
40
  const { token } = jsonResponse;
@@ -45,7 +45,7 @@ async function authResetPassword(baseUrl, newPassword, { email }) {
45
45
  });
46
46
  const resetPasswordRes = await fetch(fetchPath2, options2);
47
47
  if (!resetPasswordRes.ok) {
48
- throw new Error("Couldn't reset password");
48
+ throw new Error("Could not reset password");
49
49
  }
50
50
  }
51
51
  function authOAuthSignin(baseUrl, provider, popup, afterSigninPopup) {
@@ -3,9 +3,10 @@ const de = {
3
3
  // Actions
4
4
  View: "Ansehen",
5
5
  Add: "Hinzufügen",
6
- "Add Item": "Element hinzufügen",
6
+ "Add Item": "Item hinzufügen",
7
7
  Edit: "Bearbeiten",
8
8
  Delete: "Löschen",
9
+ "Delete Item?": "Item löschen?",
9
10
  Refresh: "Aktualisieren",
10
11
  Download: "Herunterladen",
11
12
  Cancel: "Abbrechen",
@@ -13,9 +14,30 @@ const de = {
13
14
  "Exit overlay": "Overlay verlassen",
14
15
  "Full screen": "Vollbild",
15
16
  "Exit full screen": "Vollbild verlassen",
16
- // Dialogs,
17
+ // Dialogs
17
18
  "Are you sure you want to delete this item?": "Sind Sie Sicher, dass Sie das Item löschen wollen?",
18
19
  "No filters": "Keine Filter",
19
- "Advanced Filters": "Erweiterte Filter"
20
+ "Advanced Filters": "Erweiterte Filter",
21
+ // Error titles
22
+ Error: "Fehler",
23
+ "Could not fetch info": "Informationen konnten nicht abgerufen werden",
24
+ "Could not fetch list": "Liste konnte nicht abgerufen werden",
25
+ "Could not fetch item with id {{id}}": "Item mit der ID {{id}} konnte nicht abgerufen werden",
26
+ "Could not add item": "Item konnte nicht hinzugefügt werden",
27
+ "Could not update item with id {{id}}": "Item mit der ID {{id}} konnte nicht aktualisiert werden",
28
+ "Could not delete item with id {{id}}": "Item mit der ID {{id}} konnte nicht gelöscht werden",
29
+ "Could not download": "Download konnte nicht durchgeführt werden",
30
+ "Could not upload": "Upload konnte nicht durchgeführt werden",
31
+ "Could not perform bulk action": "Massenaktion konnte nicht durchgeführt werden",
32
+ "Could not sign in": "Anmeldung fehlgeschlagen",
33
+ "Could not sign out": "Abmeldung fehlgeschlagen",
34
+ "Could not update user": "Benutzer konnte nicht aktualisiert werden",
35
+ "Could not reset password": "Passwort konnte nicht zurückgesetzt werden",
36
+ // Error messages
37
+ "Failed to fetch": "Abrufen fehlgeschlagen",
38
+ "Username or password wrong.": "Benutzername oder Passwort falsch.",
39
+ "Failed to sign in.": "Anmeldung fehlgeschlagen.",
40
+ "Failed to sign out.": "Abmeldung fehlgeschlagen.",
41
+ "Could not request token to reset password": "Token zum Zurücksetzen des Passworts konnte nicht angefordert werden"
20
42
  };
21
43
  module.exports = de;
@@ -5,7 +5,7 @@ import { deepMerge } from "fastapi-rtk/utils";
5
5
  import { useProps, Stack } from "@mantine/core";
6
6
  import { useForm } from "@mantine/form";
7
7
  import { useDebouncedState } from "@mantine/hooks";
8
- import { yupResolver } from "../../../.external/esm/mantine-form-yup-resolver@2.0.0_@mantine_form@8.2.8_yup@1.7.0/mantine-form-yup-resolver/dist/esm/index.mjs";
8
+ import { yupResolver } from "../../../.external/esm/mantine-form-yup-resolver@2.0.0_@mantine_form@8.3.1_yup@1.7.0/mantine-form-yup-resolver/dist/esm/index.mjs";
9
9
  import { useMemo, useCallback, useEffect } from "react";
10
10
  import { useApi } from "../hooks/api/useApi.mjs";
11
11
  import { useForms } from "../hooks/api/useForms.mjs";
@@ -9,7 +9,7 @@ import { useApi } from "../hooks/api/useApi.mjs";
9
9
  import { useForms } from "../hooks/api/useForms.mjs";
10
10
  import "../Wrappers/Provider/Contexts/LangContext.mjs";
11
11
  import { useTranslation } from "../../../.external/esm/react-i18next@15.7.3_i18next@25.5.2_react-dom@18.3.1_react@18.3.1_typescript@5.9.2/react-i18next/dist/es/useTranslation.mjs";
12
- const DeleteDialog = ({ onSuccess, onError, ...props }) => {
12
+ const DeleteDialog = ({ deleteText, onSuccess, onError, ...props }) => {
13
13
  const { refetch, refetchInfo, deleteEntry } = useApi();
14
14
  const { t } = useTranslation();
15
15
  const { opened, setOpened, getItem, reset, view, setView } = useForms("delete");
@@ -40,7 +40,7 @@ const DeleteDialog = ({ onSuccess, onError, ...props }) => {
40
40
  onReset,
41
41
  onSubmit,
42
42
  withTitleOptions: false,
43
- actionButtons: { groupProps: { mt: "xs" } },
43
+ actionButtons: { resetButtonProps: { variant: "outline" }, submitButtonProps: { color: "red" } },
44
44
  resetButtonText: t("Cancel"),
45
45
  buttonText: t("Delete"),
46
46
  buttonLoading: loading,
@@ -50,8 +50,8 @@ const DeleteDialog = ({ onSuccess, onError, ...props }) => {
50
50
  onExitTransitionEnd: reset,
51
51
  ...view === VIEW_MODE.OVERLAY ? overlayProps : {},
52
52
  ...props,
53
- title: props.title ?? "Delete #" + String(getItem()),
54
- children: /* @__PURE__ */ jsx(Text, { ta: "center", children: t("Are you sure you want to delete this item?") })
53
+ title: props.title ?? t("Delete Item?"),
54
+ children: deleteText ?? /* @__PURE__ */ jsx(Text, { children: t("Are you sure you want to delete this item?") })
55
55
  }
56
56
  );
57
57
  };
@@ -6,7 +6,7 @@ import { useProps, Stack } from "@mantine/core";
6
6
  import { useForm } from "@mantine/form";
7
7
  import { useDebouncedState } from "@mantine/hooks";
8
8
  import { l as lodashExports } from "../_virtual/lodash.mjs";
9
- import { yupResolver } from "../../../.external/esm/mantine-form-yup-resolver@2.0.0_@mantine_form@8.2.8_yup@1.7.0/mantine-form-yup-resolver/dist/esm/index.mjs";
9
+ import { yupResolver } from "../../../.external/esm/mantine-form-yup-resolver@2.0.0_@mantine_form@8.3.1_yup@1.7.0/mantine-form-yup-resolver/dist/esm/index.mjs";
10
10
  import { useMemo, useRef, useEffect, useCallback } from "react";
11
11
  import { convertToFormInputs as convertToFormInputs$1 } from "../ActionIcons/utils/convertToFormInputs.mjs";
12
12
  import { convertToFormInputs } from "../fab-react-toolkit-patch/utils/convertToFormInputs.mjs";
@@ -1,9 +1,12 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Modal, Text, Group } from "@mantine/core";
3
3
  import { useApi } from "../../hooks/api/useApi.mjs";
4
+ import "../../Wrappers/Provider/Contexts/LangContext.mjs";
5
+ import { useTranslation } from "../../../../.external/esm/react-i18next@15.7.3_i18next@25.5.2_react-dom@18.3.1_react@18.3.1_typescript@5.9.2/react-i18next/dist/es/useTranslation.mjs";
4
6
  import IconAlertCircle from "../../../../.external/esm/@tabler_icons-react@3.18.0_react@18.3.1/@tabler/icons-react/dist/esm/icons/IconAlertCircle.mjs";
5
7
  function ErrorDialog() {
6
8
  const { error, resetError } = useApi();
9
+ const { t } = useTranslation();
7
10
  return /* @__PURE__ */ jsx(
8
11
  Modal,
9
12
  {
@@ -11,10 +14,10 @@ function ErrorDialog() {
11
14
  onClose: resetError,
12
15
  title: /* @__PURE__ */ jsxs(Group, { children: [
13
16
  /* @__PURE__ */ jsx(IconAlertCircle, { size: 16, color: "red" }),
14
- /* @__PURE__ */ jsx(Text, { children: error ? error.message : "Error" })
17
+ /* @__PURE__ */ jsx(Text, { children: error ? t(error.message, error.data) : t("Error") })
15
18
  ] }),
16
19
  centered: true,
17
- children: error ? /* @__PURE__ */ jsx(Text, { children: error.originalError.detail || error.originalError.message }) : null
20
+ children: error ? /* @__PURE__ */ jsx(Text, { children: error.originalError.detail || t(error.originalError.message) }) : null
18
21
  }
19
22
  );
20
23
  }
@@ -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.2.8_yup@1.7.0/mantine-form-yup-resolver/dist/esm/index.mjs";
5
+ import { yupResolver } from "../../../../../../.external/esm/mantine-form-yup-resolver@2.0.0_@mantine_form@8.3.1_yup@1.7.0/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.7.0/yup/index.esm.mjs";
8
8
  import { useApi } from "../../../../hooks/api/useApi.mjs";
@@ -141,11 +141,11 @@ function useProvideApi({
141
141
  });
142
142
  useEffect(() => {
143
143
  if (infoError) {
144
- setError({ message: `Couldn't fetch info`, originalError: infoError });
144
+ setError({ message: `Could not fetch info`, originalError: infoError });
145
145
  return;
146
146
  }
147
147
  if (dataError) {
148
- setError({ message: `Couldn't fetch list`, originalError: dataError });
148
+ setError({ message: `Could not fetch list`, originalError: dataError });
149
149
  return;
150
150
  }
151
151
  resetError();
@@ -170,7 +170,7 @@ function useProvideApi({
170
170
  });
171
171
  return response;
172
172
  } catch (error2) {
173
- setError({ message: `Couldn't fetch item with id ${id}`, originalError: error2 });
173
+ setError({ message: "Could not fetch item with id {{id}}", data: { id }, originalError: error2 });
174
174
  if (throwOnError) {
175
175
  throw error2;
176
176
  }
@@ -189,7 +189,7 @@ function useProvideApi({
189
189
  });
190
190
  return response;
191
191
  } catch (error2) {
192
- setError({ message: `Couldn't add item`, originalError: error2 });
192
+ setError({ message: `Could not add item`, originalError: error2 });
193
193
  if (throwOnError) {
194
194
  throw error2;
195
195
  }
@@ -208,7 +208,7 @@ function useProvideApi({
208
208
  });
209
209
  return response;
210
210
  } catch (error2) {
211
- setError({ message: `Couldn't update item with id ${id}`, originalError: error2 });
211
+ setError({ message: "Could not update item with id {{id}}", data: { id }, originalError: error2 });
212
212
  if (throwOnError) {
213
213
  throw error2;
214
214
  }
@@ -225,7 +225,7 @@ function useProvideApi({
225
225
  });
226
226
  return response;
227
227
  } catch (error2) {
228
- setError({ message: `Couldn't delete item with id ${id}`, originalError: error2 });
228
+ setError({ message: "Could not delete item with id {{id}}", data: { id }, originalError: error2 });
229
229
  if (throwOnError) {
230
230
  throw error2;
231
231
  }
@@ -239,7 +239,7 @@ function useProvideApi({
239
239
  resetError();
240
240
  await api.downloadItems(pathRef.current, queryParamsRef.current, { label, export_mode, delimiter, quotechar });
241
241
  } catch (error2) {
242
- setError({ message: `Couldn't download`, originalError: error2 });
242
+ setError({ message: `Could not download`, originalError: error2 });
243
243
  if (throwOnError) {
244
244
  throw error2;
245
245
  }
@@ -254,7 +254,7 @@ function useProvideApi({
254
254
  const response = await api.uploadItems(pathRef.current, file, { delimiter, quotechar });
255
255
  return response;
256
256
  } catch (error2) {
257
- setError({ message: `Couldn't upload`, originalError: error2 });
257
+ setError({ message: `Could not upload`, originalError: error2 });
258
258
  if (throwOnError) {
259
259
  throw error2;
260
260
  }
@@ -15,7 +15,7 @@ const useProvideBulk = ({ path }, bulk = defaultBulk) => {
15
15
  const response = await bulk.postBulk(path, handler, data);
16
16
  return response;
17
17
  } catch (error2) {
18
- setError({ message: `Couldn't perform bulk action`, originalError: error2 });
18
+ setError({ message: `Could not perform bulk action`, originalError: error2 });
19
19
  }
20
20
  },
21
21
  [bulk, path, resetError, selectedIds]
@@ -40,7 +40,7 @@ async function authResetPassword(baseUrl, newPassword, { email }) {
40
40
  });
41
41
  const forgotPasswordRes = await fetch(fetchPath, options);
42
42
  if (!forgotPasswordRes.ok) {
43
- throw new Error("Couldn't request token to reset password");
43
+ throw new Error("Could not request token to reset password");
44
44
  }
45
45
  const jsonResponse = await forgotPasswordRes.json();
46
46
  const { token } = jsonResponse;
@@ -51,7 +51,7 @@ async function authResetPassword(baseUrl, newPassword, { email }) {
51
51
  });
52
52
  const resetPasswordRes = await fetch(fetchPath2, options2);
53
53
  if (!resetPasswordRes.ok) {
54
- throw new Error("Couldn't reset password");
54
+ throw new Error("Could not reset password");
55
55
  }
56
56
  }
57
57
  function authOAuthSignin(baseUrl, provider, popup, afterSigninPopup) {
@@ -32,7 +32,7 @@ async function authResetPassword(baseUrl, newPassword, { email }) {
32
32
  });
33
33
  const forgotPasswordRes = await fetch(fetchPath, options);
34
34
  if (!forgotPasswordRes.ok) {
35
- throw new Error("Couldn't request token to reset password");
35
+ throw new Error("Could not request token to reset password");
36
36
  }
37
37
  const jsonResponse = await forgotPasswordRes.json();
38
38
  const { token } = jsonResponse;
@@ -43,7 +43,7 @@ async function authResetPassword(baseUrl, newPassword, { email }) {
43
43
  });
44
44
  const resetPasswordRes = await fetch(fetchPath2, options2);
45
45
  if (!resetPasswordRes.ok) {
46
- throw new Error("Couldn't reset password");
46
+ throw new Error("Could not reset password");
47
47
  }
48
48
  }
49
49
  function authOAuthSignin(baseUrl, provider, popup, afterSigninPopup) {
@@ -2,9 +2,10 @@ const de = {
2
2
  // Actions
3
3
  View: "Ansehen",
4
4
  Add: "Hinzufügen",
5
- "Add Item": "Element hinzufügen",
5
+ "Add Item": "Item hinzufügen",
6
6
  Edit: "Bearbeiten",
7
7
  Delete: "Löschen",
8
+ "Delete Item?": "Item löschen?",
8
9
  Refresh: "Aktualisieren",
9
10
  Download: "Herunterladen",
10
11
  Cancel: "Abbrechen",
@@ -12,10 +13,31 @@ const de = {
12
13
  "Exit overlay": "Overlay verlassen",
13
14
  "Full screen": "Vollbild",
14
15
  "Exit full screen": "Vollbild verlassen",
15
- // Dialogs,
16
+ // Dialogs
16
17
  "Are you sure you want to delete this item?": "Sind Sie Sicher, dass Sie das Item löschen wollen?",
17
18
  "No filters": "Keine Filter",
18
- "Advanced Filters": "Erweiterte Filter"
19
+ "Advanced Filters": "Erweiterte Filter",
20
+ // Error titles
21
+ Error: "Fehler",
22
+ "Could not fetch info": "Informationen konnten nicht abgerufen werden",
23
+ "Could not fetch list": "Liste konnte nicht abgerufen werden",
24
+ "Could not fetch item with id {{id}}": "Item mit der ID {{id}} konnte nicht abgerufen werden",
25
+ "Could not add item": "Item konnte nicht hinzugefügt werden",
26
+ "Could not update item with id {{id}}": "Item mit der ID {{id}} konnte nicht aktualisiert werden",
27
+ "Could not delete item with id {{id}}": "Item mit der ID {{id}} konnte nicht gelöscht werden",
28
+ "Could not download": "Download konnte nicht durchgeführt werden",
29
+ "Could not upload": "Upload konnte nicht durchgeführt werden",
30
+ "Could not perform bulk action": "Massenaktion konnte nicht durchgeführt werden",
31
+ "Could not sign in": "Anmeldung fehlgeschlagen",
32
+ "Could not sign out": "Abmeldung fehlgeschlagen",
33
+ "Could not update user": "Benutzer konnte nicht aktualisiert werden",
34
+ "Could not reset password": "Passwort konnte nicht zurückgesetzt werden",
35
+ // Error messages
36
+ "Failed to fetch": "Abrufen fehlgeschlagen",
37
+ "Username or password wrong.": "Benutzername oder Passwort falsch.",
38
+ "Failed to sign in.": "Anmeldung fehlgeschlagen.",
39
+ "Failed to sign out.": "Abmeldung fehlgeschlagen.",
40
+ "Could not request token to reset password": "Token zum Zurücksetzen des Passworts konnte nicht angefordert werden"
19
41
  };
20
42
  export {
21
43
  de as default
@@ -1,4 +1,4 @@
1
- export function DeleteDialog({ onSuccess, onError, ...props }: DeleteDialogProps & CommonModalProps): JSX.Element;
1
+ export function DeleteDialog({ deleteText, onSuccess, onError, ...props }: DeleteDialogProps & CommonModalProps): JSX.Element;
2
2
  export type CommonModalTitleOptionsProps = {
3
3
  /**
4
4
  * - Content or function to render on the left side of the title.
@@ -118,6 +118,10 @@ export type CommonModalProps = {
118
118
  rest: Record<string, any>;
119
119
  };
120
120
  export type DeleteDialogProps = {
121
+ /**
122
+ * - Custom text or component to display in the delete confirmation dialog.
123
+ */
124
+ deleteText?: React.ReactNode;
121
125
  /**
122
126
  * - Callback function triggered on successful form submission.
123
127
  */
@@ -4,6 +4,7 @@ declare const _default: {
4
4
  'Add Item': string;
5
5
  Edit: string;
6
6
  Delete: string;
7
+ 'Delete Item?': string;
7
8
  Refresh: string;
8
9
  Download: string;
9
10
  Cancel: string;
@@ -14,5 +15,24 @@ declare const _default: {
14
15
  'Are you sure you want to delete this item?': string;
15
16
  'No filters': string;
16
17
  'Advanced Filters': string;
18
+ Error: string;
19
+ 'Could not fetch info': string;
20
+ 'Could not fetch list': string;
21
+ 'Could not fetch item with id {{id}}': string;
22
+ 'Could not add item': string;
23
+ 'Could not update item with id {{id}}': string;
24
+ 'Could not delete item with id {{id}}': string;
25
+ 'Could not download': string;
26
+ 'Could not upload': string;
27
+ 'Could not perform bulk action': string;
28
+ 'Could not sign in': string;
29
+ 'Could not sign out': string;
30
+ 'Could not update user': string;
31
+ 'Could not reset password': string;
32
+ 'Failed to fetch': string;
33
+ 'Username or password wrong.': string;
34
+ 'Failed to sign in.': string;
35
+ 'Failed to sign out.': string;
36
+ 'Could not request token to reset password': string;
17
37
  };
18
38
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastapi-rtk",
3
- "version": "0.2.39",
3
+ "version": "0.2.40",
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",