fastapi-rtk 0.2.12 → 0.2.13

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 (38) hide show
  1. package/dist/.bundled/jsonforms/cjs/_virtual/index10.cjs +2 -2
  2. package/dist/.bundled/jsonforms/cjs/_virtual/index3.cjs +2 -2
  3. package/dist/.bundled/jsonforms/cjs/_virtual/index4.cjs +2 -2
  4. package/dist/.bundled/jsonforms/cjs/_virtual/index5.cjs +2 -2
  5. package/dist/.bundled/jsonforms/cjs/_virtual/index6.cjs +2 -2
  6. package/dist/.bundled/jsonforms/cjs/_virtual/index7.cjs +2 -2
  7. package/dist/.bundled/jsonforms/cjs/_virtual/index8.cjs +2 -2
  8. package/dist/.bundled/jsonforms/cjs/_virtual/index9.cjs +2 -2
  9. package/dist/.bundled/jsonforms/esm/_virtual/index10.mjs +2 -2
  10. package/dist/.bundled/jsonforms/esm/_virtual/index3.mjs +2 -2
  11. package/dist/.bundled/jsonforms/esm/_virtual/index4.mjs +2 -2
  12. package/dist/.bundled/jsonforms/esm/_virtual/index5.mjs +2 -2
  13. package/dist/.bundled/jsonforms/esm/_virtual/index6.mjs +2 -2
  14. package/dist/.bundled/jsonforms/esm/_virtual/index7.mjs +2 -2
  15. package/dist/.bundled/jsonforms/esm/_virtual/index8.mjs +2 -2
  16. package/dist/.bundled/jsonforms/esm/_virtual/index9.mjs +2 -2
  17. package/dist/.external/cjs/ajv@8.17.1/ajv/dist/compile/codegen/index.cjs +1 -1
  18. package/dist/.external/cjs/ajv@8.17.1/ajv/dist/compile/index.cjs +1 -1
  19. package/dist/.external/cjs/ajv@8.17.1/ajv/dist/compile/validate/index.cjs +1 -1
  20. package/dist/.external/cjs/ajv@8.17.1/ajv/dist/vocabularies/applicator/index.cjs +1 -1
  21. package/dist/.external/cjs/ajv@8.17.1/ajv/dist/vocabularies/core/index.cjs +1 -1
  22. package/dist/.external/cjs/ajv@8.17.1/ajv/dist/vocabularies/discriminator/index.cjs +1 -1
  23. package/dist/.external/cjs/ajv@8.17.1/ajv/dist/vocabularies/format/index.cjs +1 -1
  24. package/dist/.external/cjs/ajv@8.17.1/ajv/dist/vocabularies/validation/index.cjs +1 -1
  25. package/dist/.external/esm/ajv@8.17.1/ajv/dist/compile/codegen/index.mjs +1 -1
  26. package/dist/.external/esm/ajv@8.17.1/ajv/dist/compile/index.mjs +1 -1
  27. package/dist/.external/esm/ajv@8.17.1/ajv/dist/compile/validate/index.mjs +1 -1
  28. package/dist/.external/esm/ajv@8.17.1/ajv/dist/vocabularies/applicator/index.mjs +1 -1
  29. package/dist/.external/esm/ajv@8.17.1/ajv/dist/vocabularies/core/index.mjs +1 -1
  30. package/dist/.external/esm/ajv@8.17.1/ajv/dist/vocabularies/discriminator/index.mjs +1 -1
  31. package/dist/.external/esm/ajv@8.17.1/ajv/dist/vocabularies/format/index.mjs +1 -1
  32. package/dist/.external/esm/ajv@8.17.1/ajv/dist/vocabularies/validation/index.mjs +1 -1
  33. package/dist/core/cjs/ActionIcons/Modals/CommonModal.cjs +8 -5
  34. package/dist/core/esm/ActionIcons/Modals/CommonModal.mjs +9 -6
  35. package/dist/core/lib/ActionIcons/Add/AddDialog.d.ts +122 -4
  36. package/dist/core/lib/ActionIcons/Edit/EditDialog.d.ts +124 -4
  37. package/dist/core/lib/ActionIcons/Modals/CommonModal.d.ts +102 -18
  38. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- var compile = {};
4
- exports.__exports = compile;
3
+ var format = {};
4
+ exports.__exports = format;
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- var codegen = {};
4
- exports.__exports = codegen;
3
+ var discriminator = {};
4
+ exports.__exports = discriminator;
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- var discriminator = {};
4
- exports.__exports = discriminator;
3
+ var validate = {};
4
+ exports.__exports = validate;
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- var validate = {};
4
- exports.__exports = validate;
3
+ var codegen = {};
4
+ exports.__exports = codegen;
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- var core = {};
4
- exports.__exports = core;
3
+ var compile = {};
4
+ exports.__exports = compile;
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- var validation = {};
4
- exports.__exports = validation;
3
+ var core = {};
4
+ exports.__exports = core;
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- var applicator = {};
4
- exports.__exports = applicator;
3
+ var validation = {};
4
+ exports.__exports = validation;
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- var format = {};
4
- exports.__exports = format;
3
+ var applicator = {};
4
+ exports.__exports = applicator;
@@ -1,4 +1,4 @@
1
- var compile = {};
1
+ var format = {};
2
2
  export {
3
- compile as __exports
3
+ format as __exports
4
4
  };
@@ -1,4 +1,4 @@
1
- var codegen = {};
1
+ var discriminator = {};
2
2
  export {
3
- codegen as __exports
3
+ discriminator as __exports
4
4
  };
@@ -1,4 +1,4 @@
1
- var discriminator = {};
1
+ var validate = {};
2
2
  export {
3
- discriminator as __exports
3
+ validate as __exports
4
4
  };
@@ -1,4 +1,4 @@
1
- var validate = {};
1
+ var codegen = {};
2
2
  export {
3
- validate as __exports
3
+ codegen as __exports
4
4
  };
@@ -1,4 +1,4 @@
1
- var core = {};
1
+ var compile = {};
2
2
  export {
3
- core as __exports
3
+ compile as __exports
4
4
  };
@@ -1,4 +1,4 @@
1
- var validation = {};
1
+ var core = {};
2
2
  export {
3
- validation as __exports
3
+ core as __exports
4
4
  };
@@ -1,4 +1,4 @@
1
- var applicator = {};
1
+ var validation = {};
2
2
  export {
3
- applicator as __exports
3
+ validation as __exports
4
4
  };
@@ -1,4 +1,4 @@
1
- var format = {};
1
+ var applicator = {};
2
2
  export {
3
- format as __exports
3
+ applicator as __exports
4
4
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("../../../../../../../.bundled/jsonforms/cjs/_virtual/index3.cjs");
3
+ const index = require("../../../../../../../.bundled/jsonforms/cjs/_virtual/index5.cjs");
4
4
  const code = require("./code.cjs");
5
5
  const scope = require("./scope.cjs");
6
6
  var hasRequiredCodegen;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("../../../../../../.bundled/jsonforms/cjs/_virtual/index10.cjs");
3
+ const index = require("../../../../../../.bundled/jsonforms/cjs/_virtual/index6.cjs");
4
4
  const index$1 = require("./codegen/index.cjs");
5
5
  const validation_error = require("../runtime/validation_error.cjs");
6
6
  const names = require("./names.cjs");
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("../../../../../../../.bundled/jsonforms/cjs/_virtual/index5.cjs");
3
+ const index = require("../../../../../../../.bundled/jsonforms/cjs/_virtual/index4.cjs");
4
4
  const boolSchema = require("./boolSchema.cjs");
5
5
  const dataType = require("./dataType.cjs");
6
6
  const applicability = require("./applicability.cjs");
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("../../../../../../../.bundled/jsonforms/cjs/_virtual/index8.cjs");
3
+ const index = require("../../../../../../../.bundled/jsonforms/cjs/_virtual/index9.cjs");
4
4
  const additionalItems = require("./additionalItems.cjs");
5
5
  const prefixItems = require("./prefixItems.cjs");
6
6
  const items = require("./items.cjs");
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("../../../../../../../.bundled/jsonforms/cjs/_virtual/index6.cjs");
3
+ const index = require("../../../../../../../.bundled/jsonforms/cjs/_virtual/index7.cjs");
4
4
  const id = require("./id.cjs");
5
5
  const ref = require("./ref.cjs");
6
6
  var hasRequiredCore;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("../../../../../../../.bundled/jsonforms/cjs/_virtual/index4.cjs");
3
+ const index = require("../../../../../../../.bundled/jsonforms/cjs/_virtual/index3.cjs");
4
4
  const index$1 = require("../../compile/codegen/index.cjs");
5
5
  const types = require("./types.cjs");
6
6
  const index$2 = require("../../compile/index.cjs");
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("../../../../../../../.bundled/jsonforms/cjs/_virtual/index9.cjs");
3
+ const index = require("../../../../../../../.bundled/jsonforms/cjs/_virtual/index10.cjs");
4
4
  const format = require("./format.cjs");
5
5
  var hasRequiredFormat;
6
6
  function requireFormat() {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("../../../../../../../.bundled/jsonforms/cjs/_virtual/index7.cjs");
3
+ const index = require("../../../../../../../.bundled/jsonforms/cjs/_virtual/index8.cjs");
4
4
  const limitNumber = require("./limitNumber.cjs");
5
5
  const multipleOf = require("./multipleOf.cjs");
6
6
  const limitLength = require("./limitLength.cjs");
@@ -1,4 +1,4 @@
1
- import { __exports as codegen } from "../../../../../../../.bundled/jsonforms/esm/_virtual/index3.mjs";
1
+ import { __exports as codegen } from "../../../../../../../.bundled/jsonforms/esm/_virtual/index5.mjs";
2
2
  import { __require as requireCode } from "./code.mjs";
3
3
  import { __require as requireScope } from "./scope.mjs";
4
4
  var hasRequiredCodegen;
@@ -1,4 +1,4 @@
1
- import { __exports as compile } from "../../../../../../.bundled/jsonforms/esm/_virtual/index10.mjs";
1
+ import { __exports as compile } from "../../../../../../.bundled/jsonforms/esm/_virtual/index6.mjs";
2
2
  import { __require as requireCodegen } from "./codegen/index.mjs";
3
3
  import { __require as requireValidation_error } from "../runtime/validation_error.mjs";
4
4
  import { __require as requireNames } from "./names.mjs";
@@ -1,4 +1,4 @@
1
- import { __exports as validate } from "../../../../../../../.bundled/jsonforms/esm/_virtual/index5.mjs";
1
+ import { __exports as validate } from "../../../../../../../.bundled/jsonforms/esm/_virtual/index4.mjs";
2
2
  import { __require as requireBoolSchema } from "./boolSchema.mjs";
3
3
  import { __require as requireDataType } from "./dataType.mjs";
4
4
  import { __require as requireApplicability } from "./applicability.mjs";
@@ -1,4 +1,4 @@
1
- import { __exports as applicator } from "../../../../../../../.bundled/jsonforms/esm/_virtual/index8.mjs";
1
+ import { __exports as applicator } from "../../../../../../../.bundled/jsonforms/esm/_virtual/index9.mjs";
2
2
  import { __require as requireAdditionalItems } from "./additionalItems.mjs";
3
3
  import { __require as requirePrefixItems } from "./prefixItems.mjs";
4
4
  import { __require as requireItems } from "./items.mjs";
@@ -1,4 +1,4 @@
1
- import { __exports as core } from "../../../../../../../.bundled/jsonforms/esm/_virtual/index6.mjs";
1
+ import { __exports as core } from "../../../../../../../.bundled/jsonforms/esm/_virtual/index7.mjs";
2
2
  import { __require as requireId } from "./id.mjs";
3
3
  import { __require as requireRef } from "./ref.mjs";
4
4
  var hasRequiredCore;
@@ -1,4 +1,4 @@
1
- import { __exports as discriminator } from "../../../../../../../.bundled/jsonforms/esm/_virtual/index4.mjs";
1
+ import { __exports as discriminator } from "../../../../../../../.bundled/jsonforms/esm/_virtual/index3.mjs";
2
2
  import { __require as requireCodegen } from "../../compile/codegen/index.mjs";
3
3
  import { __require as requireTypes } from "./types.mjs";
4
4
  import { __require as requireCompile } from "../../compile/index.mjs";
@@ -1,4 +1,4 @@
1
- import { __exports as format } from "../../../../../../../.bundled/jsonforms/esm/_virtual/index9.mjs";
1
+ import { __exports as format } from "../../../../../../../.bundled/jsonforms/esm/_virtual/index10.mjs";
2
2
  import { __require as requireFormat$1 } from "./format.mjs";
3
3
  var hasRequiredFormat;
4
4
  function requireFormat() {
@@ -1,4 +1,4 @@
1
- import { __exports as validation } from "../../../../../../../.bundled/jsonforms/esm/_virtual/index7.mjs";
1
+ import { __exports as validation } from "../../../../../../../.bundled/jsonforms/esm/_virtual/index8.mjs";
2
2
  import { __require as requireLimitNumber } from "./limitNumber.mjs";
3
3
  import { __require as requireMultipleOf } from "./multipleOf.mjs";
4
4
  import { __require as requireLimitLength } from "./limitLength.mjs";
@@ -25,6 +25,7 @@ function CommonModal({
25
25
  buttonText,
26
26
  buttonLoading,
27
27
  withTitleOptions = true,
28
+ titleOptions,
28
29
  ...props
29
30
  }) {
30
31
  var _a;
@@ -59,8 +60,9 @@ function CommonModal({
59
60
  title: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
60
61
  props.title,
61
62
  !fab && withTitleOptions && //* Backward compatibility to fab-react-toolkit
62
- /* @__PURE__ */ jsxRuntime.jsx(core.Group, { children: /* @__PURE__ */ jsxRuntime.jsxs(core.Group, { gap: "xs", pr: "xs", children: [
63
- /* @__PURE__ */ jsxRuntime.jsx(
63
+ /* @__PURE__ */ jsxRuntime.jsxs(core.Group, { gap: "xs", pr: "xs", children: [
64
+ utils.parseFromValuesOrFunc(titleOptions == null ? void 0 : titleOptions.left, { view, setView }),
65
+ !(titleOptions == null ? void 0 : titleOptions.hideOverlay) && /* @__PURE__ */ jsxRuntime.jsx(
64
66
  core.CloseButton,
65
67
  {
66
68
  onClick: () => setView(view !== constants.VIEW_MODE.OVERLAY ? constants.VIEW_MODE.OVERLAY : constants.VIEW_MODE.NORMAL),
@@ -74,7 +76,7 @@ function CommonModal({
74
76
  )
75
77
  }
76
78
  ),
77
- /* @__PURE__ */ jsxRuntime.jsx(
79
+ !(titleOptions == null ? void 0 : titleOptions.hideFullScreen) && /* @__PURE__ */ jsxRuntime.jsx(
78
80
  core.CloseButton,
79
81
  {
80
82
  onClick: () => setView(view !== constants.VIEW_MODE.FULL_SCREEN ? constants.VIEW_MODE.FULL_SCREEN : constants.VIEW_MODE.NORMAL),
@@ -87,8 +89,9 @@ function CommonModal({
87
89
  }
88
90
  )
89
91
  }
90
- )
91
- ] }) })
92
+ ),
93
+ utils.parseFromValuesOrFunc(titleOptions == null ? void 0 : titleOptions.right, { view, setView })
94
+ ] })
92
95
  ] }),
93
96
  classNames: { content: "mrt-table-container" },
94
97
  styles: utils.deepMerge(props.styles, {
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { JsonFormsWithCustomizer } from "fastapi-rtk/.bundled-jsonforms";
3
3
  import { VIEW_MODE } from "fastapi-rtk/constants";
4
- import { deepMerge } from "fastapi-rtk/utils";
4
+ import { deepMerge, parseFromValuesOrFunc } from "fastapi-rtk/utils";
5
5
  import { Icon } from "../../../../.external/esm/@iconify_react@6.0.0_react@18.3.1/@iconify/react/dist/iconify.mjs";
6
6
  import { Modal, Box, Stack, Group, Button, CloseButton } from "@mantine/core";
7
7
  import { useForm, yupResolver } from "@mantine/form";
@@ -23,6 +23,7 @@ function CommonModal({
23
23
  buttonText,
24
24
  buttonLoading,
25
25
  withTitleOptions = true,
26
+ titleOptions,
26
27
  ...props
27
28
  }) {
28
29
  var _a;
@@ -57,8 +58,9 @@ function CommonModal({
57
58
  title: /* @__PURE__ */ jsxs(Fragment, { children: [
58
59
  props.title,
59
60
  !fab && withTitleOptions && //* Backward compatibility to fab-react-toolkit
60
- /* @__PURE__ */ jsx(Group, { children: /* @__PURE__ */ jsxs(Group, { gap: "xs", pr: "xs", children: [
61
- /* @__PURE__ */ jsx(
61
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", pr: "xs", children: [
62
+ parseFromValuesOrFunc(titleOptions == null ? void 0 : titleOptions.left, { view, setView }),
63
+ !(titleOptions == null ? void 0 : titleOptions.hideOverlay) && /* @__PURE__ */ jsx(
62
64
  CloseButton,
63
65
  {
64
66
  onClick: () => setView(view !== VIEW_MODE.OVERLAY ? VIEW_MODE.OVERLAY : VIEW_MODE.NORMAL),
@@ -72,7 +74,7 @@ function CommonModal({
72
74
  )
73
75
  }
74
76
  ),
75
- /* @__PURE__ */ jsx(
77
+ !(titleOptions == null ? void 0 : titleOptions.hideFullScreen) && /* @__PURE__ */ jsx(
76
78
  CloseButton,
77
79
  {
78
80
  onClick: () => setView(view !== VIEW_MODE.FULL_SCREEN ? VIEW_MODE.FULL_SCREEN : VIEW_MODE.NORMAL),
@@ -85,8 +87,9 @@ function CommonModal({
85
87
  }
86
88
  )
87
89
  }
88
- )
89
- ] }) })
90
+ ),
91
+ parseFromValuesOrFunc(titleOptions == null ? void 0 : titleOptions.right, { view, setView })
92
+ ] })
90
93
  ] }),
91
94
  classNames: { content: "mrt-table-container" },
92
95
  styles: deepMerge(props.styles, {
@@ -1,4 +1,122 @@
1
- export function AddDialog({ jsonForms: __jsonForms, ...props }: {
2
- [x: string]: any;
3
- jsonForms: any;
4
- }): import("react").JSX.Element;
1
+ /**
2
+ * @typedef {Object} CommonModalTitleOptionsProps
3
+ * @property {React.ReactNode | ((props: { view: string; setView: (view: string) => void }) => React.ReactNode)} left - Content or function to render on the left side of the title.
4
+ * @property {React.ReactNode | ((props: { view: string; setView: (view: string) => void }) => React.ReactNode)} right - Content or function to render on the right side of the title.
5
+ * @property {boolean} [hideOverlay=false] - If true, hides the overlay toggle button.
6
+ * @property {boolean} [hideFullScreen=false] - If true, hides the full screen toggle button.
7
+ */
8
+ /**
9
+ * @typedef {Object} CommonModalProps
10
+ * @property {Record<string, any>} fabSchema - Schema for backward compatibility with fab-react-toolkit that includes defaultValues and validation schema.
11
+ * @property {Record<string, any>} schema - JSON Schema used by JsonFormsWithCustomizer.
12
+ * @property {Record<string, any>} uischema - UI schema for customizing the form layout.
13
+ * @property {Record<string, any>} state - State object containing the form data.
14
+ * @property {Function} setState - Function to update the state containing form data.
15
+ * @property {string} view - Current view mode (e.g., VIEW_MODE.NORMAL, VIEW_MODE.FULL_SCREEN, VIEW_MODE.OVERLAY).
16
+ * @property {Function} setView - Function to update the view mode.
17
+ * @property {Record<string, any>} jsonForms - Customizer configuration or additional properties for JsonFormsWithCustomizer.
18
+ * @property {Function} onSubmit - Callback function triggered on form submission.
19
+ * @property {Record<string, any>} boxProps - Additional properties to be passed to the Box component wrapping the form.
20
+ * @property {string} buttonText - Text displayed on the submit button.
21
+ * @property {boolean} buttonLoading - Indicates whether the submit button should display a loading state.
22
+ * @property {boolean} [withTitleOptions=true] - Flag to determine if title options (e.g., full screen, overlay toggles) should be displayed.
23
+ * @property {CommonModalTitleOptionsProps} [titleOptions] - Options for customizing the title area, such as toggles for full screen and overlay modes.
24
+ * @property {Record<string, any>} rest - Additional props to be passed to the Modal component.
25
+ */
26
+ /**
27
+ * AddDialog is a component that renders a modal dialog for adding a new entry.
28
+ *
29
+ * It integrates with the application's API to add entries and manages form state,
30
+ * view modes, and loading state via custom hooks. The component also manages the merge
31
+ * of default JSON Forms settings with any additional props provided.
32
+ *
33
+ * @param {CommonModalProps} props - The properties passed to the AddDialog component.
34
+ * @returns {JSX.Element} The rendered modal dialog component for adding an entry.
35
+ */
36
+ export function AddDialog({ jsonForms: __jsonForms, ...props }: CommonModalProps): JSX.Element;
37
+ export type CommonModalTitleOptionsProps = {
38
+ /**
39
+ * - Content or function to render on the left side of the title.
40
+ */
41
+ left: React.ReactNode | ((props: {
42
+ view: string;
43
+ setView: (view: string) => void;
44
+ }) => React.ReactNode);
45
+ /**
46
+ * - Content or function to render on the right side of the title.
47
+ */
48
+ right: React.ReactNode | ((props: {
49
+ view: string;
50
+ setView: (view: string) => void;
51
+ }) => React.ReactNode);
52
+ /**
53
+ * - If true, hides the overlay toggle button.
54
+ */
55
+ hideOverlay?: boolean;
56
+ /**
57
+ * - If true, hides the full screen toggle button.
58
+ */
59
+ hideFullScreen?: boolean;
60
+ };
61
+ export type CommonModalProps = {
62
+ /**
63
+ * - Schema for backward compatibility with fab-react-toolkit that includes defaultValues and validation schema.
64
+ */
65
+ fabSchema: Record<string, any>;
66
+ /**
67
+ * - JSON Schema used by JsonFormsWithCustomizer.
68
+ */
69
+ schema: Record<string, any>;
70
+ /**
71
+ * - UI schema for customizing the form layout.
72
+ */
73
+ uischema: Record<string, any>;
74
+ /**
75
+ * - State object containing the form data.
76
+ */
77
+ state: Record<string, any>;
78
+ /**
79
+ * - Function to update the state containing form data.
80
+ */
81
+ setState: Function;
82
+ /**
83
+ * - Current view mode (e.g., VIEW_MODE.NORMAL, VIEW_MODE.FULL_SCREEN, VIEW_MODE.OVERLAY).
84
+ */
85
+ view: string;
86
+ /**
87
+ * - Function to update the view mode.
88
+ */
89
+ setView: Function;
90
+ /**
91
+ * - Customizer configuration or additional properties for JsonFormsWithCustomizer.
92
+ */
93
+ jsonForms: Record<string, any>;
94
+ /**
95
+ * - Callback function triggered on form submission.
96
+ */
97
+ onSubmit: Function;
98
+ /**
99
+ * - Additional properties to be passed to the Box component wrapping the form.
100
+ */
101
+ boxProps: Record<string, any>;
102
+ /**
103
+ * - Text displayed on the submit button.
104
+ */
105
+ buttonText: string;
106
+ /**
107
+ * - Indicates whether the submit button should display a loading state.
108
+ */
109
+ buttonLoading: boolean;
110
+ /**
111
+ * - Flag to determine if title options (e.g., full screen, overlay toggles) should be displayed.
112
+ */
113
+ withTitleOptions?: boolean;
114
+ /**
115
+ * - Options for customizing the title area, such as toggles for full screen and overlay modes.
116
+ */
117
+ titleOptions?: CommonModalTitleOptionsProps;
118
+ /**
119
+ * - Additional props to be passed to the Modal component.
120
+ */
121
+ rest: Record<string, any>;
122
+ };
@@ -1,4 +1,124 @@
1
- export function EditDialog({ jsonForms: __jsonForms, ...props }: {
2
- [x: string]: any;
3
- jsonForms: any;
4
- }): import("react").JSX.Element;
1
+ /**
2
+ * @typedef {Object} CommonModalTitleOptionsProps
3
+ * @property {React.ReactNode | ((props: { view: string; setView: (view: string) => void }) => React.ReactNode)} left - Content or function to render on the left side of the title.
4
+ * @property {React.ReactNode | ((props: { view: string; setView: (view: string) => void }) => React.ReactNode)} right - Content or function to render on the right side of the title.
5
+ * @property {boolean} [hideOverlay=false] - If true, hides the overlay toggle button.
6
+ * @property {boolean} [hideFullScreen=false] - If true, hides the full screen toggle button.
7
+ */
8
+ /**
9
+ * @typedef {Object} CommonModalProps
10
+ * @property {Record<string, any>} fabSchema - Schema for backward compatibility with fab-react-toolkit that includes defaultValues and validation schema.
11
+ * @property {Record<string, any>} schema - JSON Schema used by JsonFormsWithCustomizer.
12
+ * @property {Record<string, any>} uischema - UI schema for customizing the form layout.
13
+ * @property {Record<string, any>} state - State object containing the form data.
14
+ * @property {Function} setState - Function to update the state containing form data.
15
+ * @property {string} view - Current view mode (e.g., VIEW_MODE.NORMAL, VIEW_MODE.FULL_SCREEN, VIEW_MODE.OVERLAY).
16
+ * @property {Function} setView - Function to update the view mode.
17
+ * @property {Record<string, any>} jsonForms - Customizer configuration or additional properties for JsonFormsWithCustomizer.
18
+ * @property {Function} onSubmit - Callback function triggered on form submission.
19
+ * @property {Record<string, any>} boxProps - Additional properties to be passed to the Box component wrapping the form.
20
+ * @property {string} buttonText - Text displayed on the submit button.
21
+ * @property {boolean} buttonLoading - Indicates whether the submit button should display a loading state.
22
+ * @property {boolean} [withTitleOptions=true] - Flag to determine if title options (e.g., full screen, overlay toggles) should be displayed.
23
+ * @property {CommonModalTitleOptionsProps} [titleOptions] - Options for customizing the title area, such as toggles for full screen and overlay modes.
24
+ * @property {Record<string, any>} rest - Additional props to be passed to the Modal component.
25
+ */
26
+ /**
27
+ * EditDialog component renders a modal dialog for editing an entry.
28
+ *
29
+ * This component leverages various hooks to manage form state, API interactions, and UI transitions.
30
+ * It initializes the form state based on the provided item's result and handles form submission by
31
+ * sending only changed data to update the corresponding entry. Upon a successful update, it triggers
32
+ * a refetch of data and related information.
33
+ *
34
+ * @component
35
+ * @param {CommonModalProps} props - The component props.
36
+ * @returns {JSX.Element} The rendered EditDialog component.
37
+ */
38
+ export function EditDialog({ jsonForms: __jsonForms, ...props }: CommonModalProps): JSX.Element;
39
+ export type CommonModalTitleOptionsProps = {
40
+ /**
41
+ * - Content or function to render on the left side of the title.
42
+ */
43
+ left: React.ReactNode | ((props: {
44
+ view: string;
45
+ setView: (view: string) => void;
46
+ }) => React.ReactNode);
47
+ /**
48
+ * - Content or function to render on the right side of the title.
49
+ */
50
+ right: React.ReactNode | ((props: {
51
+ view: string;
52
+ setView: (view: string) => void;
53
+ }) => React.ReactNode);
54
+ /**
55
+ * - If true, hides the overlay toggle button.
56
+ */
57
+ hideOverlay?: boolean;
58
+ /**
59
+ * - If true, hides the full screen toggle button.
60
+ */
61
+ hideFullScreen?: boolean;
62
+ };
63
+ export type CommonModalProps = {
64
+ /**
65
+ * - Schema for backward compatibility with fab-react-toolkit that includes defaultValues and validation schema.
66
+ */
67
+ fabSchema: Record<string, any>;
68
+ /**
69
+ * - JSON Schema used by JsonFormsWithCustomizer.
70
+ */
71
+ schema: Record<string, any>;
72
+ /**
73
+ * - UI schema for customizing the form layout.
74
+ */
75
+ uischema: Record<string, any>;
76
+ /**
77
+ * - State object containing the form data.
78
+ */
79
+ state: Record<string, any>;
80
+ /**
81
+ * - Function to update the state containing form data.
82
+ */
83
+ setState: Function;
84
+ /**
85
+ * - Current view mode (e.g., VIEW_MODE.NORMAL, VIEW_MODE.FULL_SCREEN, VIEW_MODE.OVERLAY).
86
+ */
87
+ view: string;
88
+ /**
89
+ * - Function to update the view mode.
90
+ */
91
+ setView: Function;
92
+ /**
93
+ * - Customizer configuration or additional properties for JsonFormsWithCustomizer.
94
+ */
95
+ jsonForms: Record<string, any>;
96
+ /**
97
+ * - Callback function triggered on form submission.
98
+ */
99
+ onSubmit: Function;
100
+ /**
101
+ * - Additional properties to be passed to the Box component wrapping the form.
102
+ */
103
+ boxProps: Record<string, any>;
104
+ /**
105
+ * - Text displayed on the submit button.
106
+ */
107
+ buttonText: string;
108
+ /**
109
+ * - Indicates whether the submit button should display a loading state.
110
+ */
111
+ buttonLoading: boolean;
112
+ /**
113
+ * - Flag to determine if title options (e.g., full screen, overlay toggles) should be displayed.
114
+ */
115
+ withTitleOptions?: boolean;
116
+ /**
117
+ * - Options for customizing the title area, such as toggles for full screen and overlay modes.
118
+ */
119
+ titleOptions?: CommonModalTitleOptionsProps;
120
+ /**
121
+ * - Additional props to be passed to the Modal component.
122
+ */
123
+ rest: Record<string, any>;
124
+ };
@@ -1,38 +1,122 @@
1
+ import { Modal } from '@mantine/core';
2
+ /**
3
+ * @typedef {Object} CommonModalTitleOptionsProps
4
+ * @property {React.ReactNode | ((props: { view: string; setView: (view: string) => void }) => React.ReactNode)} left - Content or function to render on the left side of the title.
5
+ * @property {React.ReactNode | ((props: { view: string; setView: (view: string) => void }) => React.ReactNode)} right - Content or function to render on the right side of the title.
6
+ * @property {boolean} [hideOverlay=false] - If true, hides the overlay toggle button.
7
+ * @property {boolean} [hideFullScreen=false] - If true, hides the full screen toggle button.
8
+ */
9
+ /**
10
+ * @typedef {Object} CommonModalProps
11
+ * @property {Record<string, any>} fabSchema - Schema for backward compatibility with fab-react-toolkit that includes defaultValues and validation schema.
12
+ * @property {Record<string, any>} schema - JSON Schema used by JsonFormsWithCustomizer.
13
+ * @property {Record<string, any>} uischema - UI schema for customizing the form layout.
14
+ * @property {Record<string, any>} state - State object containing the form data.
15
+ * @property {Function} setState - Function to update the state containing form data.
16
+ * @property {string} view - Current view mode (e.g., VIEW_MODE.NORMAL, VIEW_MODE.FULL_SCREEN, VIEW_MODE.OVERLAY).
17
+ * @property {Function} setView - Function to update the view mode.
18
+ * @property {Record<string, any>} jsonForms - Customizer configuration or additional properties for JsonFormsWithCustomizer.
19
+ * @property {Function} onSubmit - Callback function triggered on form submission.
20
+ * @property {Record<string, any>} boxProps - Additional properties to be passed to the Box component wrapping the form.
21
+ * @property {string} buttonText - Text displayed on the submit button.
22
+ * @property {boolean} buttonLoading - Indicates whether the submit button should display a loading state.
23
+ * @property {boolean} [withTitleOptions=true] - Flag to determine if title options (e.g., full screen, overlay toggles) should be displayed.
24
+ * @property {CommonModalTitleOptionsProps} [titleOptions] - Options for customizing the title area, such as toggles for full screen and overlay modes.
25
+ * @property {Record<string, any>} rest - Additional props to be passed to the Modal component.
26
+ * @typedef {CommonModalProps & React.ComponentProps<typeof Modal>} CommonModalComponentProps
27
+ */
1
28
  /**
2
29
  * CommonModal component renders a modal with a form.
3
30
  *
4
31
  * @component
5
- * @param {Object} props - The component props.
6
- * @param {Record<string, any>} props.fabSchema - Schema for backward compatibility with fab-react-toolkit that includes defaultValues and validation schema.
7
- * @param {Record<string, any>} props.schema - JSON Schema used by JsonFormsWithCustomizer.
8
- * @param {Record<string, any>} props.uischema - UI schema for customizing the form layout.
9
- * @param {Record<string, any>} props.state - State object containing the form data.
10
- * @param {Function} props.setState - Function to update the state containing form data.
11
- * @param {string} props.view - Current view mode (e.g., VIEW_MODE.NORMAL, VIEW_MODE.FULL_SCREEN, VIEW_MODE.OVERLAY).
12
- * @param {Function} props.setView - Function to update the view mode.
13
- * @param {Record<string, any>} props.jsonForms - Customizer configuration or additional properties for JsonFormsWithCustomizer.
14
- * @param {Function} props.onSubmit - Callback function triggered on form submission.
15
- * @param {Record<string, any>} props.boxProps - Additional properties to be passed to the Box component wrapping the form.
16
- * @param {string} props.buttonText - Text displayed on the submit button.
17
- * @param {boolean} props.buttonLoading - Indicates whether the submit button should display a loading state.
18
- * @param {boolean} [props.withTitleOptions=true] - Flag to determine if title options (e.g., full screen, overlay toggles) should be displayed.
19
- * @param {Record<string, any>} props.rest - Additional props to be passed to the Modal component.
20
- *
32
+ * @param {CommonModalComponentProps} props - The properties for the CommonModal component.
21
33
  * @returns - A rendered Modal component with an embedded form and optional title controls.
22
34
  */
23
- export function CommonModal({ fabSchema, schema, uischema, state, setState, view, setView, jsonForms, onSubmit, boxProps, buttonText, buttonLoading, withTitleOptions, ...props }: {
35
+ export function CommonModal({ fabSchema, schema, uischema, state, setState, view, setView, jsonForms, onSubmit, boxProps, buttonText, buttonLoading, withTitleOptions, titleOptions, ...props }: CommonModalComponentProps): import("react").JSX.Element;
36
+ export type CommonModalTitleOptionsProps = {
37
+ /**
38
+ * - Content or function to render on the left side of the title.
39
+ */
40
+ left: React.ReactNode | ((props: {
41
+ view: string;
42
+ setView: (view: string) => void;
43
+ }) => React.ReactNode);
44
+ /**
45
+ * - Content or function to render on the right side of the title.
46
+ */
47
+ right: React.ReactNode | ((props: {
48
+ view: string;
49
+ setView: (view: string) => void;
50
+ }) => React.ReactNode);
51
+ /**
52
+ * - If true, hides the overlay toggle button.
53
+ */
54
+ hideOverlay?: boolean;
55
+ /**
56
+ * - If true, hides the full screen toggle button.
57
+ */
58
+ hideFullScreen?: boolean;
59
+ };
60
+ export type CommonModalProps = {
61
+ /**
62
+ * - Schema for backward compatibility with fab-react-toolkit that includes defaultValues and validation schema.
63
+ */
24
64
  fabSchema: Record<string, any>;
65
+ /**
66
+ * - JSON Schema used by JsonFormsWithCustomizer.
67
+ */
25
68
  schema: Record<string, any>;
69
+ /**
70
+ * - UI schema for customizing the form layout.
71
+ */
26
72
  uischema: Record<string, any>;
73
+ /**
74
+ * - State object containing the form data.
75
+ */
27
76
  state: Record<string, any>;
77
+ /**
78
+ * - Function to update the state containing form data.
79
+ */
28
80
  setState: Function;
81
+ /**
82
+ * - Current view mode (e.g., VIEW_MODE.NORMAL, VIEW_MODE.FULL_SCREEN, VIEW_MODE.OVERLAY).
83
+ */
29
84
  view: string;
85
+ /**
86
+ * - Function to update the view mode.
87
+ */
30
88
  setView: Function;
89
+ /**
90
+ * - Customizer configuration or additional properties for JsonFormsWithCustomizer.
91
+ */
31
92
  jsonForms: Record<string, any>;
93
+ /**
94
+ * - Callback function triggered on form submission.
95
+ */
32
96
  onSubmit: Function;
97
+ /**
98
+ * - Additional properties to be passed to the Box component wrapping the form.
99
+ */
33
100
  boxProps: Record<string, any>;
101
+ /**
102
+ * - Text displayed on the submit button.
103
+ */
34
104
  buttonText: string;
105
+ /**
106
+ * - Indicates whether the submit button should display a loading state.
107
+ */
35
108
  buttonLoading: boolean;
109
+ /**
110
+ * - Flag to determine if title options (e.g., full screen, overlay toggles) should be displayed.
111
+ */
36
112
  withTitleOptions?: boolean;
113
+ /**
114
+ * - Options for customizing the title area, such as toggles for full screen and overlay modes.
115
+ */
116
+ titleOptions?: CommonModalTitleOptionsProps;
117
+ /**
118
+ * - Additional props to be passed to the Modal component.
119
+ */
37
120
  rest: Record<string, any>;
38
- }): import("react").JSX.Element;
121
+ };
122
+ export type CommonModalComponentProps = CommonModalProps & React.ComponentProps<typeof Modal>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastapi-rtk",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
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",