fastapi-rtk 0.2.7 → 0.2.8
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.
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/hooks/useContextProps.cjs +1 -1
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/layouts/MantineCategorizationLayoutRenderer.cjs +63 -0
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/layouts/MantineGroupLayoutRenderer.cjs +3 -3
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/layouts/MantineHotizontalLayoutRenderer.cjs +2 -2
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/layouts/MantineVerticalLayoutRenderer.cjs +3 -3
- package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/renderers/mantineRenderers.cjs +2 -0
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/hooks/useContextProps.mjs +1 -1
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/layouts/MantineCategorizationLayoutRenderer.mjs +63 -0
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/layouts/MantineGroupLayoutRenderer.mjs +3 -3
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/layouts/MantineHotizontalLayoutRenderer.mjs +2 -2
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/layouts/MantineVerticalLayoutRenderer.mjs +3 -3
- package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/renderers/mantineRenderers.mjs +2 -0
- package/dist/core/cjs/Tables/NextGenDataGrid/NextGenDataGrid.cjs +1 -2
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/Body.cjs +4 -5
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilterInput/ColumnHeaderFilterInput.cjs +1 -2
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/FilterModeDescription.cjs +2 -2
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/useColumns.cjs +9 -9
- package/dist/core/cjs/Tables/NextGenDataGrid/utils.cjs +0 -3
- package/dist/core/cjs/Wrappers/ApiProvider/ApiProvider.cjs +1 -1
- package/dist/core/cjs/Wrappers/ApiProvider/Contexts/ApiContext.cjs +4 -40
- package/dist/core/cjs/Wrappers/ApiProvider/Contexts/BulkActionsContext.cjs +6 -11
- package/dist/core/cjs/Wrappers/ApiProvider/Contexts/FormContext.cjs +11 -38
- package/dist/core/cjs/Wrappers/Provider/Contexts/AuthContext.cjs +4 -19
- package/dist/core/cjs/Wrappers/Provider/Contexts/InfoContext.cjs +4 -14
- package/dist/core/cjs/Wrappers/Provider/Provider.cjs +1 -1
- package/dist/core/cjs/hooks/api/useApi.cjs +1 -8
- package/dist/core/cjs/hooks/api/useBulkActions.cjs +1 -8
- package/dist/core/cjs/hooks/api/useForms.cjs +4 -8
- package/dist/core/cjs/hooks/auth/useAuth.cjs +1 -4
- package/dist/core/cjs/hooks/auth/useInfo.cjs +1 -4
- package/dist/core/esm/Tables/NextGenDataGrid/NextGenDataGrid.mjs +2 -3
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/Body.mjs +2 -3
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilterInput/ColumnHeaderFilterInput.mjs +2 -3
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/FilterModeDescription.mjs +2 -2
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/useColumns.mjs +5 -5
- package/dist/core/esm/Tables/NextGenDataGrid/utils.mjs +1 -4
- package/dist/core/esm/Wrappers/ApiProvider/ApiProvider.mjs +4 -4
- package/dist/core/esm/Wrappers/ApiProvider/Contexts/ApiContext.mjs +4 -40
- package/dist/core/esm/Wrappers/ApiProvider/Contexts/BulkActionsContext.mjs +6 -11
- package/dist/core/esm/Wrappers/ApiProvider/Contexts/FormContext.mjs +11 -38
- package/dist/core/esm/Wrappers/Provider/Contexts/AuthContext.mjs +4 -19
- package/dist/core/esm/Wrappers/Provider/Contexts/InfoContext.mjs +4 -14
- package/dist/core/esm/Wrappers/Provider/Provider.mjs +3 -3
- package/dist/core/esm/hooks/api/useApi.mjs +2 -9
- package/dist/core/esm/hooks/api/useBulkActions.mjs +2 -9
- package/dist/core/esm/hooks/api/useForms.mjs +5 -9
- package/dist/core/esm/hooks/auth/useAuth.mjs +2 -5
- package/dist/core/esm/hooks/auth/useInfo.mjs +2 -5
- package/dist/core/lib/Tables/NextGenDataGrid/hooks/useData.d.ts +1 -1
- package/dist/core/lib/Tables/NextGenDataGrid/utils.d.ts +0 -1
- package/dist/core/lib/Wrappers/ApiProvider/Contexts/ApiContext.d.ts +4 -131
- package/dist/core/lib/Wrappers/ApiProvider/Contexts/BulkActionsContext.d.ts +4 -27
- package/dist/core/lib/Wrappers/ApiProvider/Contexts/FormContext.d.ts +8 -28
- package/dist/core/lib/Wrappers/Provider/Contexts/AuthContext.d.ts +4 -28
- package/dist/core/lib/Wrappers/Provider/Contexts/InfoContext.d.ts +4 -21
- package/dist/core/lib/hooks/api/useApi.d.ts +415 -61
- package/dist/core/lib/hooks/api/useBulkActions.d.ts +25 -8
- package/dist/core/lib/hooks/api/useForms.d.ts +72 -13
- package/dist/core/lib/hooks/auth/useAuth.d.ts +80 -17
- package/dist/core/lib/hooks/auth/useInfo.d.ts +51 -9
- package/dist/jsonforms/cjs/hooks/useContextProps.cjs +1 -1
- package/dist/jsonforms/cjs/layouts/MantineCategorizationLayoutRenderer.cjs +63 -0
- package/dist/jsonforms/cjs/layouts/MantineGroupLayoutRenderer.cjs +3 -3
- package/dist/jsonforms/cjs/layouts/MantineHotizontalLayoutRenderer.cjs +2 -2
- package/dist/jsonforms/cjs/layouts/MantineVerticalLayoutRenderer.cjs +3 -3
- package/dist/jsonforms/cjs/renderers/mantineRenderers.cjs +2 -0
- package/dist/jsonforms/esm/hooks/useContextProps.mjs +1 -1
- package/dist/jsonforms/esm/layouts/MantineCategorizationLayoutRenderer.mjs +63 -0
- package/dist/jsonforms/esm/layouts/MantineGroupLayoutRenderer.mjs +3 -3
- package/dist/jsonforms/esm/layouts/MantineHotizontalLayoutRenderer.mjs +2 -2
- package/dist/jsonforms/esm/layouts/MantineVerticalLayoutRenderer.mjs +3 -3
- package/dist/jsonforms/esm/renderers/mantineRenderers.mjs +2 -0
- package/dist/jsonforms/lib/layouts/MantineCategorizationLayoutRenderer.d.ts +2 -0
- package/dist/jsonforms/lib/renderers/mantineRenderers.d.ts +3 -9
- package/dist/utils/cjs/createSafeContext/createSafeContext.cjs +17 -0
- package/dist/utils/cjs/getByPath/getByPath.cjs +4 -0
- package/dist/utils/cjs/index.cjs +6 -0
- package/dist/utils/cjs/mergeProps/mergeProps.cjs +6 -0
- package/dist/utils/esm/createSafeContext/createSafeContext.mjs +17 -0
- package/dist/utils/esm/getByPath/getByPath.mjs +4 -0
- package/dist/utils/esm/index.mjs +6 -0
- package/dist/utils/esm/mergeProps/mergeProps.mjs +6 -0
- package/dist/utils/lib/createSafeContext/createSafeContext.d.ts +14 -0
- package/dist/utils/lib/createSafeContext/index.d.ts +1 -0
- package/dist/utils/lib/getByPath/getByPath.d.ts +1 -0
- package/dist/utils/lib/getByPath/index.d.ts +1 -0
- package/dist/utils/lib/index.d.ts +3 -0
- package/dist/utils/lib/mergeProps/index.d.ts +1 -0
- package/dist/utils/lib/mergeProps/mergeProps.d.ts +1 -0
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ const utils = require("fastapi-rtk/utils");
|
|
|
5
5
|
const core$1 = require("@mantine/core");
|
|
6
6
|
const React = require("react");
|
|
7
7
|
function useContextProps(name, path, componentProps, jsonFormsProps, withAllProps = true) {
|
|
8
|
-
const { specialKey } = core.useApi();
|
|
8
|
+
const { specialKey } = core.useApi({ throwOnError: false });
|
|
9
9
|
const allProps = core$1.useProps((specialKey == null ? void 0 : specialKey.all) || "all", {}, {});
|
|
10
10
|
const _componentProps = core$1.useProps(name, {}, {});
|
|
11
11
|
const contextProps = core$1.useProps(path, {}, {});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const utils = require("fastapi-rtk/utils");
|
|
5
|
+
const jsonformsCore_esm = require("../../../../../../../.external/cjs/@jsonforms_core@3.6.0/@jsonforms/core/lib/jsonforms-core.esm.cjs");
|
|
6
|
+
const jsonformsReact_esm = require("../../../../../../../.external/cjs/@jsonforms_react@3.6.0_@jsonforms_core@3.6.0_react@18.3.1/@jsonforms/react/lib/jsonforms-react.esm.cjs");
|
|
7
|
+
const core = require("@mantine/core");
|
|
8
|
+
const React = require("react");
|
|
9
|
+
const useContextProps = require("../hooks/useContextProps.cjs");
|
|
10
|
+
const layout = require("../utils/layout.cjs");
|
|
11
|
+
const ComponentTab = ({ value, jsonFormsProps, ...props }) => {
|
|
12
|
+
const [, _props] = useContextProps.useContextProps(
|
|
13
|
+
`Categorization.Tab`,
|
|
14
|
+
`Categorization.Tab.${value}`,
|
|
15
|
+
{ value },
|
|
16
|
+
jsonFormsProps,
|
|
17
|
+
false
|
|
18
|
+
);
|
|
19
|
+
const mergedProps = React.useMemo(() => utils.deepMerge(props, _props), [props, _props]);
|
|
20
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.Tabs.Tab, { value, ...mergedProps, children: value });
|
|
21
|
+
};
|
|
22
|
+
const ComponentPanel = ({ value, jsonFormsProps, children, ...props }) => {
|
|
23
|
+
const [, _props] = useContextProps.useContextProps(
|
|
24
|
+
`Categorization.Panel`,
|
|
25
|
+
`Categorization.Panel.${value}`,
|
|
26
|
+
{ value },
|
|
27
|
+
jsonFormsProps,
|
|
28
|
+
false
|
|
29
|
+
);
|
|
30
|
+
const mergedProps = React.useMemo(() => utils.deepMerge(props, _props), [props, _props]);
|
|
31
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.Tabs.Panel, { value, ...mergedProps, children });
|
|
32
|
+
};
|
|
33
|
+
const Component = (props) => {
|
|
34
|
+
var _a;
|
|
35
|
+
const { schema, uischema, path, enabled, visible, renderers, cells, data } = props;
|
|
36
|
+
const _categorization = uischema;
|
|
37
|
+
const _categories = React.useMemo(
|
|
38
|
+
() => _categorization.elements.filter((category) => jsonformsCore_esm.isVisible(category, data)),
|
|
39
|
+
[_categorization.elements, data]
|
|
40
|
+
);
|
|
41
|
+
const [_value, setValue] = React.useState(((_a = _categories == null ? void 0 : _categories[0]) == null ? void 0 : _a.label) ?? "");
|
|
42
|
+
let componentProps = { categorization: _categorization, categories: _categories, value: _value, onChange: setValue };
|
|
43
|
+
const contextPath = `Categorization.[${componentProps.categorization.elements.map((c) => c.label).join("|")}]`;
|
|
44
|
+
const [, _props] = useContextProps.useContextProps(`Categorization`, contextPath, componentProps, props, false);
|
|
45
|
+
componentProps = { ...componentProps, ..._props };
|
|
46
|
+
const { categorization, categories, value, onChange, listProps, tabProps, panelProps, ...rest } = componentProps;
|
|
47
|
+
const categoryLabels = React.useMemo(() => categories.map((category) => category.label), [categories]);
|
|
48
|
+
React.useEffect(() => {
|
|
49
|
+
var _a2;
|
|
50
|
+
if (!categoryLabels.includes(value)) {
|
|
51
|
+
onChange(((_a2 = categories == null ? void 0 : categories[0]) == null ? void 0 : _a2.label) ?? "");
|
|
52
|
+
}
|
|
53
|
+
}, [categoryLabels]);
|
|
54
|
+
const childProps = { schema, path, enabled, visible, direction: "column" };
|
|
55
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(core.Tabs, { value, onChange, m: "0.5rem", mx: "calc(0.5rem + 2px)", ...rest, children: [
|
|
56
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Tabs.List, { ...listProps, children: categoryLabels.map((label) => /* @__PURE__ */ jsxRuntime.jsx(ComponentTab, { value: label, jsonFormsProps: props, ...tabProps }, label)) }),
|
|
57
|
+
categories.map((category) => /* @__PURE__ */ jsxRuntime.jsx(ComponentPanel, { value: category.label, jsonFormsProps: props, ...panelProps, children: /* @__PURE__ */ jsxRuntime.jsx(layout.MantineLayoutRenderer, { ...childProps, elements: category.elements, renderers, cells }) }, category.label))
|
|
58
|
+
] });
|
|
59
|
+
};
|
|
60
|
+
const MantineCategorizationLayoutTester = jsonformsCore_esm.rankWith(1, jsonformsCore_esm.uiTypeIs("Categorization"));
|
|
61
|
+
const MantineCategorizationLayoutRenderer = jsonformsReact_esm.withJsonFormsLayoutProps(Component);
|
|
62
|
+
exports.MantineCategorizationLayoutRenderer = MantineCategorizationLayoutRenderer;
|
|
63
|
+
exports.MantineCategorizationLayoutTester = MantineCategorizationLayoutTester;
|
package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/layouts/MantineGroupLayoutRenderer.cjs
CHANGED
|
@@ -5,9 +5,9 @@ const jsonformsCore_esm = require("../../../../../../../.external/cjs/@jsonforms
|
|
|
5
5
|
const jsonformsReact_esm = require("../../../../../../../.external/cjs/@jsonforms_react@3.6.0_@jsonforms_core@3.6.0_react@18.3.1/@jsonforms/react/lib/jsonforms-react.esm.cjs");
|
|
6
6
|
const core = require("@mantine/core");
|
|
7
7
|
const layout = require("../utils/layout.cjs");
|
|
8
|
-
const Component = ({
|
|
9
|
-
const
|
|
10
|
-
const childProps = { visible, elements:
|
|
8
|
+
const Component = ({ schema, uischema, path, enabled, visible, renderers, cells, label }) => {
|
|
9
|
+
const layout$1 = uischema;
|
|
10
|
+
const childProps = { schema, path, enabled, visible, elements: layout$1.elements, direction: "column" };
|
|
11
11
|
return /* @__PURE__ */ jsxRuntime.jsx(core.Fieldset, { legend: label, m: "0.5rem", mx: "calc(0.5rem + 2px)", children: /* @__PURE__ */ jsxRuntime.jsx(layout.MantineLayoutRenderer, { ...childProps, renderers, cells }) });
|
|
12
12
|
};
|
|
13
13
|
const MantineGroupLayoutTester = jsonformsCore_esm.rankWith(1, jsonformsCore_esm.uiTypeIs("Group"));
|
|
@@ -4,9 +4,9 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const jsonformsCore_esm = require("../../../../../../../.external/cjs/@jsonforms_core@3.6.0/@jsonforms/core/lib/jsonforms-core.esm.cjs");
|
|
5
5
|
const jsonformsReact_esm = require("../../../../../../../.external/cjs/@jsonforms_react@3.6.0_@jsonforms_core@3.6.0_react@18.3.1/@jsonforms/react/lib/jsonforms-react.esm.cjs");
|
|
6
6
|
const layout = require("../utils/layout.cjs");
|
|
7
|
-
const Component = ({
|
|
7
|
+
const Component = ({ schema, uischema, path, enabled, visible, renderers, cells }) => {
|
|
8
8
|
const layout$1 = uischema;
|
|
9
|
-
const childProps = { visible, elements: layout$1.elements,
|
|
9
|
+
const childProps = { schema, path, enabled, visible, elements: layout$1.elements, direction: "row" };
|
|
10
10
|
return /* @__PURE__ */ jsxRuntime.jsx(layout.MantineLayoutRenderer, { ...childProps, renderers, cells });
|
|
11
11
|
};
|
|
12
12
|
const mantineHorizontalLayoutTester = jsonformsCore_esm.rankWith(1, jsonformsCore_esm.uiTypeIs("HorizontalLayout"));
|
package/dist/.bundled/jsonforms/cjs/packages/jsonforms/src/layouts/MantineVerticalLayoutRenderer.cjs
CHANGED
|
@@ -4,9 +4,9 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const jsonformsCore_esm = require("../../../../../../../.external/cjs/@jsonforms_core@3.6.0/@jsonforms/core/lib/jsonforms-core.esm.cjs");
|
|
5
5
|
const jsonformsReact_esm = require("../../../../../../../.external/cjs/@jsonforms_react@3.6.0_@jsonforms_core@3.6.0_react@18.3.1/@jsonforms/react/lib/jsonforms-react.esm.cjs");
|
|
6
6
|
const layout = require("../utils/layout.cjs");
|
|
7
|
-
const Component = ({
|
|
8
|
-
const
|
|
9
|
-
const childProps = { visible, elements:
|
|
7
|
+
const Component = ({ schema, uischema, path, enabled, visible, renderers, cells }) => {
|
|
8
|
+
const layout$1 = uischema;
|
|
9
|
+
const childProps = { schema, path, enabled, visible, elements: layout$1.elements, direction: "column" };
|
|
10
10
|
return /* @__PURE__ */ jsxRuntime.jsx(layout.MantineLayoutRenderer, { ...childProps, renderers, cells });
|
|
11
11
|
};
|
|
12
12
|
const mantineVerticalLayoutTester = jsonformsCore_esm.rankWith(1, jsonformsCore_esm.uiTypeIs("VerticalLayout"));
|
|
@@ -16,6 +16,7 @@ const MantineOneOfEnumControl = require("../controls/MantineOneOfEnumControl.cjs
|
|
|
16
16
|
const MantineTextControl = require("../controls/MantineTextControl.cjs");
|
|
17
17
|
const MantineTimeControl = require("../controls/MantineTimeControl.cjs");
|
|
18
18
|
const MantineLabelRenderer = require("../labels/MantineLabelRenderer.cjs");
|
|
19
|
+
const MantineCategorizationLayoutRenderer = require("../layouts/MantineCategorizationLayoutRenderer.cjs");
|
|
19
20
|
const MantineGroupLayoutRenderer = require("../layouts/MantineGroupLayoutRenderer.cjs");
|
|
20
21
|
const MantineHotizontalLayoutRenderer = require("../layouts/MantineHotizontalLayoutRenderer.cjs");
|
|
21
22
|
const MantineVerticalLayoutRenderer = require("../layouts/MantineVerticalLayoutRenderer.cjs");
|
|
@@ -41,6 +42,7 @@ const mantineRenderers = [
|
|
|
41
42
|
{ tester: MantineHotizontalLayoutRenderer.mantineHorizontalLayoutTester, renderer: MantineHotizontalLayoutRenderer.MantineHorizontalLayoutRenderer },
|
|
42
43
|
{ tester: MantineVerticalLayoutRenderer.mantineVerticalLayoutTester, renderer: MantineVerticalLayoutRenderer.MantineVerticalLayoutRenderer },
|
|
43
44
|
{ tester: MantineGroupLayoutRenderer.MantineGroupLayoutTester, renderer: MantineGroupLayoutRenderer.MantineGroupLayoutRenderer },
|
|
45
|
+
{ tester: MantineCategorizationLayoutRenderer.MantineCategorizationLayoutTester, renderer: MantineCategorizationLayoutRenderer.MantineCategorizationLayoutRenderer },
|
|
44
46
|
// Labels
|
|
45
47
|
{ tester: MantineLabelRenderer.MantineLabelTester, renderer: MantineLabelRenderer.MantineLabelRenderer }
|
|
46
48
|
];
|
|
@@ -3,7 +3,7 @@ import { deepMerge, parseFromValuesOrFunc } from "fastapi-rtk/utils";
|
|
|
3
3
|
import { useProps } from "@mantine/core";
|
|
4
4
|
import { useMemo } from "react";
|
|
5
5
|
function useContextProps(name, path, componentProps, jsonFormsProps, withAllProps = true) {
|
|
6
|
-
const { specialKey } = useApi();
|
|
6
|
+
const { specialKey } = useApi({ throwOnError: false });
|
|
7
7
|
const allProps = useProps((specialKey == null ? void 0 : specialKey.all) || "all", {}, {});
|
|
8
8
|
const _componentProps = useProps(name, {}, {});
|
|
9
9
|
const contextProps = useProps(path, {}, {});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { deepMerge } from "fastapi-rtk/utils";
|
|
3
|
+
import { rankWith, uiTypeIs, isVisible } from "../../../../../../../.external/esm/@jsonforms_core@3.6.0/@jsonforms/core/lib/jsonforms-core.esm.mjs";
|
|
4
|
+
import { withJsonFormsLayoutProps } from "../../../../../../../.external/esm/@jsonforms_react@3.6.0_@jsonforms_core@3.6.0_react@18.3.1/@jsonforms/react/lib/jsonforms-react.esm.mjs";
|
|
5
|
+
import { Tabs } from "@mantine/core";
|
|
6
|
+
import { useMemo, useState, useEffect } from "react";
|
|
7
|
+
import { useContextProps } from "../hooks/useContextProps.mjs";
|
|
8
|
+
import { MantineLayoutRenderer } from "../utils/layout.mjs";
|
|
9
|
+
const ComponentTab = ({ value, jsonFormsProps, ...props }) => {
|
|
10
|
+
const [, _props] = useContextProps(
|
|
11
|
+
`Categorization.Tab`,
|
|
12
|
+
`Categorization.Tab.${value}`,
|
|
13
|
+
{ value },
|
|
14
|
+
jsonFormsProps,
|
|
15
|
+
false
|
|
16
|
+
);
|
|
17
|
+
const mergedProps = useMemo(() => deepMerge(props, _props), [props, _props]);
|
|
18
|
+
return /* @__PURE__ */ jsx(Tabs.Tab, { value, ...mergedProps, children: value });
|
|
19
|
+
};
|
|
20
|
+
const ComponentPanel = ({ value, jsonFormsProps, children, ...props }) => {
|
|
21
|
+
const [, _props] = useContextProps(
|
|
22
|
+
`Categorization.Panel`,
|
|
23
|
+
`Categorization.Panel.${value}`,
|
|
24
|
+
{ value },
|
|
25
|
+
jsonFormsProps,
|
|
26
|
+
false
|
|
27
|
+
);
|
|
28
|
+
const mergedProps = useMemo(() => deepMerge(props, _props), [props, _props]);
|
|
29
|
+
return /* @__PURE__ */ jsx(Tabs.Panel, { value, ...mergedProps, children });
|
|
30
|
+
};
|
|
31
|
+
const Component = (props) => {
|
|
32
|
+
var _a;
|
|
33
|
+
const { schema, uischema, path, enabled, visible, renderers, cells, data } = props;
|
|
34
|
+
const _categorization = uischema;
|
|
35
|
+
const _categories = useMemo(
|
|
36
|
+
() => _categorization.elements.filter((category) => isVisible(category, data)),
|
|
37
|
+
[_categorization.elements, data]
|
|
38
|
+
);
|
|
39
|
+
const [_value, setValue] = useState(((_a = _categories == null ? void 0 : _categories[0]) == null ? void 0 : _a.label) ?? "");
|
|
40
|
+
let componentProps = { categorization: _categorization, categories: _categories, value: _value, onChange: setValue };
|
|
41
|
+
const contextPath = `Categorization.[${componentProps.categorization.elements.map((c) => c.label).join("|")}]`;
|
|
42
|
+
const [, _props] = useContextProps(`Categorization`, contextPath, componentProps, props, false);
|
|
43
|
+
componentProps = { ...componentProps, ..._props };
|
|
44
|
+
const { categorization, categories, value, onChange, listProps, tabProps, panelProps, ...rest } = componentProps;
|
|
45
|
+
const categoryLabels = useMemo(() => categories.map((category) => category.label), [categories]);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
var _a2;
|
|
48
|
+
if (!categoryLabels.includes(value)) {
|
|
49
|
+
onChange(((_a2 = categories == null ? void 0 : categories[0]) == null ? void 0 : _a2.label) ?? "");
|
|
50
|
+
}
|
|
51
|
+
}, [categoryLabels]);
|
|
52
|
+
const childProps = { schema, path, enabled, visible, direction: "column" };
|
|
53
|
+
return /* @__PURE__ */ jsxs(Tabs, { value, onChange, m: "0.5rem", mx: "calc(0.5rem + 2px)", ...rest, children: [
|
|
54
|
+
/* @__PURE__ */ jsx(Tabs.List, { ...listProps, children: categoryLabels.map((label) => /* @__PURE__ */ jsx(ComponentTab, { value: label, jsonFormsProps: props, ...tabProps }, label)) }),
|
|
55
|
+
categories.map((category) => /* @__PURE__ */ jsx(ComponentPanel, { value: category.label, jsonFormsProps: props, ...panelProps, children: /* @__PURE__ */ jsx(MantineLayoutRenderer, { ...childProps, elements: category.elements, renderers, cells }) }, category.label))
|
|
56
|
+
] });
|
|
57
|
+
};
|
|
58
|
+
const MantineCategorizationLayoutTester = rankWith(1, uiTypeIs("Categorization"));
|
|
59
|
+
const MantineCategorizationLayoutRenderer = withJsonFormsLayoutProps(Component);
|
|
60
|
+
export {
|
|
61
|
+
MantineCategorizationLayoutRenderer,
|
|
62
|
+
MantineCategorizationLayoutTester
|
|
63
|
+
};
|
package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/layouts/MantineGroupLayoutRenderer.mjs
CHANGED
|
@@ -3,9 +3,9 @@ import { rankWith, uiTypeIs } from "../../../../../../../.external/esm/@jsonform
|
|
|
3
3
|
import { withJsonFormsLayoutProps } from "../../../../../../../.external/esm/@jsonforms_react@3.6.0_@jsonforms_core@3.6.0_react@18.3.1/@jsonforms/react/lib/jsonforms-react.esm.mjs";
|
|
4
4
|
import { Fieldset } from "@mantine/core";
|
|
5
5
|
import { MantineLayoutRenderer } from "../utils/layout.mjs";
|
|
6
|
-
const Component = ({
|
|
7
|
-
const
|
|
8
|
-
const childProps = { visible, elements:
|
|
6
|
+
const Component = ({ schema, uischema, path, enabled, visible, renderers, cells, label }) => {
|
|
7
|
+
const layout = uischema;
|
|
8
|
+
const childProps = { schema, path, enabled, visible, elements: layout.elements, direction: "column" };
|
|
9
9
|
return /* @__PURE__ */ jsx(Fieldset, { legend: label, m: "0.5rem", mx: "calc(0.5rem + 2px)", children: /* @__PURE__ */ jsx(MantineLayoutRenderer, { ...childProps, renderers, cells }) });
|
|
10
10
|
};
|
|
11
11
|
const MantineGroupLayoutTester = rankWith(1, uiTypeIs("Group"));
|
|
@@ -2,9 +2,9 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { rankWith, uiTypeIs } from "../../../../../../../.external/esm/@jsonforms_core@3.6.0/@jsonforms/core/lib/jsonforms-core.esm.mjs";
|
|
3
3
|
import { withJsonFormsLayoutProps } from "../../../../../../../.external/esm/@jsonforms_react@3.6.0_@jsonforms_core@3.6.0_react@18.3.1/@jsonforms/react/lib/jsonforms-react.esm.mjs";
|
|
4
4
|
import { MantineLayoutRenderer } from "../utils/layout.mjs";
|
|
5
|
-
const Component = ({
|
|
5
|
+
const Component = ({ schema, uischema, path, enabled, visible, renderers, cells }) => {
|
|
6
6
|
const layout = uischema;
|
|
7
|
-
const childProps = { visible, elements: layout.elements,
|
|
7
|
+
const childProps = { schema, path, enabled, visible, elements: layout.elements, direction: "row" };
|
|
8
8
|
return /* @__PURE__ */ jsx(MantineLayoutRenderer, { ...childProps, renderers, cells });
|
|
9
9
|
};
|
|
10
10
|
const mantineHorizontalLayoutTester = rankWith(1, uiTypeIs("HorizontalLayout"));
|
package/dist/.bundled/jsonforms/esm/packages/jsonforms/src/layouts/MantineVerticalLayoutRenderer.mjs
CHANGED
|
@@ -2,9 +2,9 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { rankWith, uiTypeIs } from "../../../../../../../.external/esm/@jsonforms_core@3.6.0/@jsonforms/core/lib/jsonforms-core.esm.mjs";
|
|
3
3
|
import { withJsonFormsLayoutProps } from "../../../../../../../.external/esm/@jsonforms_react@3.6.0_@jsonforms_core@3.6.0_react@18.3.1/@jsonforms/react/lib/jsonforms-react.esm.mjs";
|
|
4
4
|
import { MantineLayoutRenderer } from "../utils/layout.mjs";
|
|
5
|
-
const Component = ({
|
|
6
|
-
const
|
|
7
|
-
const childProps = { visible, elements:
|
|
5
|
+
const Component = ({ schema, uischema, path, enabled, visible, renderers, cells }) => {
|
|
6
|
+
const layout = uischema;
|
|
7
|
+
const childProps = { schema, path, enabled, visible, elements: layout.elements, direction: "column" };
|
|
8
8
|
return /* @__PURE__ */ jsx(MantineLayoutRenderer, { ...childProps, renderers, cells });
|
|
9
9
|
};
|
|
10
10
|
const mantineVerticalLayoutTester = rankWith(1, uiTypeIs("VerticalLayout"));
|
|
@@ -14,6 +14,7 @@ import { MantineOneOfEnumControl, mantineOneOfEnumControlTester } from "../contr
|
|
|
14
14
|
import { MantineTextControl, mantineTextControlTester } from "../controls/MantineTextControl.mjs";
|
|
15
15
|
import { MantineTimeControl, mantineTimeControlTester } from "../controls/MantineTimeControl.mjs";
|
|
16
16
|
import { MantineLabelRenderer, MantineLabelTester } from "../labels/MantineLabelRenderer.mjs";
|
|
17
|
+
import { MantineCategorizationLayoutRenderer, MantineCategorizationLayoutTester } from "../layouts/MantineCategorizationLayoutRenderer.mjs";
|
|
17
18
|
import { MantineGroupLayoutRenderer, MantineGroupLayoutTester } from "../layouts/MantineGroupLayoutRenderer.mjs";
|
|
18
19
|
import { MantineHorizontalLayoutRenderer, mantineHorizontalLayoutTester } from "../layouts/MantineHotizontalLayoutRenderer.mjs";
|
|
19
20
|
import { MantineVerticalLayoutRenderer, mantineVerticalLayoutTester } from "../layouts/MantineVerticalLayoutRenderer.mjs";
|
|
@@ -39,6 +40,7 @@ const mantineRenderers = [
|
|
|
39
40
|
{ tester: mantineHorizontalLayoutTester, renderer: MantineHorizontalLayoutRenderer },
|
|
40
41
|
{ tester: mantineVerticalLayoutTester, renderer: MantineVerticalLayoutRenderer },
|
|
41
42
|
{ tester: MantineGroupLayoutTester, renderer: MantineGroupLayoutRenderer },
|
|
43
|
+
{ tester: MantineCategorizationLayoutTester, renderer: MantineCategorizationLayoutRenderer },
|
|
42
44
|
// Labels
|
|
43
45
|
{ tester: MantineLabelTester, renderer: MantineLabelRenderer }
|
|
44
46
|
];
|
|
@@ -25,7 +25,6 @@ const useSize = require("./hooks/useSize.cjs");
|
|
|
25
25
|
const useSorting = require("./hooks/useSorting.cjs");
|
|
26
26
|
const useToolbar = require("./hooks/useToolbar/useToolbar.cjs");
|
|
27
27
|
const useToolbarAlertBanner = require("./hooks/useToolbarAlertBanner/useToolbarAlertBanner.cjs");
|
|
28
|
-
const utils$1 = require("./utils.cjs");
|
|
29
28
|
const baseProps = { enableStickyHeader: true, enableColumnPinning: true };
|
|
30
29
|
const NextGenDataGrid = React.forwardRef((props, ref) => {
|
|
31
30
|
var _a, _b, _c;
|
|
@@ -139,7 +138,7 @@ const NextGenDataGrid = React.forwardRef((props, ref) => {
|
|
|
139
138
|
const paginationProps = usePagination.usePagination(hidePagination);
|
|
140
139
|
const columnsProps = useColumns.useColumns(columnProps, header, body, textFilterSeparator, enableAdvancedFilters);
|
|
141
140
|
const sizeProps = useSize.useSize(withBorder);
|
|
142
|
-
const actionsProps = useActions.useActions(hideActions, (_a = utils
|
|
141
|
+
const actionsProps = useActions.useActions(hideActions, (_a = utils.mergeProps(body, specialKey.actions)) == null ? void 0 : _a.component);
|
|
143
142
|
const globalFilterProps = useGlobalFilter.useGlobalFilter();
|
|
144
143
|
const toolbarProps = useToolbar.useToolbar(toolbar, quickFilters, hideToolbar, enableAdvancedFilters);
|
|
145
144
|
const eventProps = useEvent.useEvent(onClickEntry);
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const utils
|
|
4
|
+
const utils = require("fastapi-rtk/utils");
|
|
5
5
|
const React = require("react");
|
|
6
6
|
const useApi = require("../../../../hooks/api/useApi.cjs");
|
|
7
7
|
const useAuth = require("../../../../hooks/auth/useAuth.cjs");
|
|
8
8
|
const FallbackWrapper = require("../../FallbackWrapper.cjs");
|
|
9
|
-
const utils = require("../../utils.cjs");
|
|
10
9
|
const MultiLineHighlight = require("./MultiLineHighlight.cjs");
|
|
11
10
|
const Body = ({ body, col, textFilterSeparator, mrtProps }) => {
|
|
12
11
|
const { table, column, cell } = mrtProps;
|
|
13
12
|
const api = useApi.useApi();
|
|
14
13
|
const auth = useAuth.useAuth();
|
|
15
14
|
const { specialKey } = useApi.useApi();
|
|
16
|
-
const { component, separator, truncate, tooltipProps, highlightProps } = utils.
|
|
15
|
+
const { component, separator, truncate, tooltipProps, highlightProps } = utils.mergeProps(body, specialKey.all, col);
|
|
17
16
|
const highlights = React.useMemo(() => {
|
|
18
17
|
const globalFilter = table.getState().globalFilter;
|
|
19
18
|
const columnTextFilter = column.getFilterValue();
|
|
@@ -61,8 +60,8 @@ const Body = ({ body, col, textFilterSeparator, mrtProps }) => {
|
|
|
61
60
|
{
|
|
62
61
|
highlight,
|
|
63
62
|
truncate: cellObj.truncate,
|
|
64
|
-
tooltipProps: utils
|
|
65
|
-
highlightProps: utils
|
|
63
|
+
tooltipProps: utils.parseFromValuesOrFunc(tooltipProps, { value: cellObj.value, data: cell.row.original, cellObj }),
|
|
64
|
+
highlightProps: utils.parseFromValuesOrFunc(highlightProps, {
|
|
66
65
|
value: cellObj.value,
|
|
67
66
|
data: cell.row.original,
|
|
68
67
|
cellObj
|
|
@@ -10,7 +10,6 @@ const hooks = require("@mantine/hooks");
|
|
|
10
10
|
const clsx = require("../../../../../../../.external/cjs/clsx@2.1.1/clsx/dist/clsx.cjs");
|
|
11
11
|
const React = require("react");
|
|
12
12
|
const useApi = require("../../../../../hooks/api/useApi.cjs");
|
|
13
|
-
const utils$2 = require("../../../utils.cjs");
|
|
14
13
|
const utils$1 = require("../utils.cjs");
|
|
15
14
|
const HeaderInput = require("./HeaderInput.cjs");
|
|
16
15
|
const getLocalStorageValue = (key, defaultValue) => {
|
|
@@ -155,7 +154,7 @@ function ColumnHeaderFilterInput({
|
|
|
155
154
|
[actionIconProps]
|
|
156
155
|
);
|
|
157
156
|
const configuration = utils.parseFromValuesOrFunc(
|
|
158
|
-
enableFilterModes ? utils
|
|
157
|
+
enableFilterModes ? utils.mergeProps(filterProps, opr) : filterProps,
|
|
159
158
|
functionProps
|
|
160
159
|
);
|
|
161
160
|
const headerInputProps = React.useMemo(
|
|
@@ -1,11 +1,11 @@
|
|
|
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 index_esm = require("../../../../../../.external/cjs/mantine-react-table@2.0.0-beta.9_@mantine_core@7.17.8_@mantine_dates@7.17.8_@mantine_hooks@7._ll5dfnmvjphm4bajaxt6oy7mty/mantine-react-table/dist/index.esm.cjs");
|
|
6
7
|
const React = require("react");
|
|
7
8
|
const FallbackWrapper = require("../../FallbackWrapper.cjs");
|
|
8
|
-
const utils = require("../../utils.cjs");
|
|
9
9
|
const FilterModeDescription = ({ table, column, opr, filters, filterModeDescription, functionProps }) => {
|
|
10
10
|
const filterName = React.useMemo(() => {
|
|
11
11
|
var _a;
|
|
@@ -16,7 +16,7 @@ const FilterModeDescription = ({ table, column, opr, filters, filterModeDescript
|
|
|
16
16
|
{
|
|
17
17
|
fallback: filters.length ? /* @__PURE__ */ jsxRuntime.jsx(core.Input.Description, { size: "xs", children: table.options.localization.filterMode.replace(
|
|
18
18
|
"{filterType}",
|
|
19
|
-
index_esm.localizedFilterOption(utils.
|
|
19
|
+
index_esm.localizedFilterOption(utils.mergeProps(table.options.localization, column.id), filterName) || index_esm.localizedFilterOption(table.options.localization, filterName) || filterName
|
|
20
20
|
) }) : null,
|
|
21
21
|
functionProps: { ...functionProps, componentProps: { value: filterName } },
|
|
22
22
|
children: filterModeDescription
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const utils
|
|
4
|
+
const utils = require("fastapi-rtk/utils");
|
|
5
5
|
const core = require("@mantine/core");
|
|
6
6
|
const hooks = require("@mantine/hooks");
|
|
7
7
|
const React = require("react");
|
|
8
8
|
const useApi = require("../../../../hooks/api/useApi.cjs");
|
|
9
9
|
const useAuth = require("../../../../hooks/auth/useAuth.cjs");
|
|
10
|
-
const utils = require("../../utils.cjs");
|
|
10
|
+
const utils$1 = require("../../utils.cjs");
|
|
11
11
|
const Body = require("./Body.cjs");
|
|
12
12
|
const ColumnHeaderFilter = require("./ColumnHeaderFilter.cjs");
|
|
13
13
|
const HeaderAdvancedFiltersMenuButton = require("./HeaderAdvancedFiltersMenuButton.cjs");
|
|
@@ -39,21 +39,21 @@ function useColumns(columnProps, header, body, textFilterSeparator, enableAdvanc
|
|
|
39
39
|
withLocalStorage,
|
|
40
40
|
localStorageKey,
|
|
41
41
|
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) || ""
|
|
42
|
-
} = utils.
|
|
43
|
-
const filterFn = utils.fromFilterToFilterFn(col, defaultOpr);
|
|
42
|
+
} = utils.mergeProps(header, specialKey.all, col);
|
|
43
|
+
const filterFn = utils$1.fromFilterToFilterFn(col, defaultOpr);
|
|
44
44
|
const filters = ((_f = (_e = info == null ? void 0 : info.filters) == null ? void 0 : _e[col]) == null ? void 0 : _f.filters) || [];
|
|
45
45
|
const additionalProps = {};
|
|
46
46
|
if (component !== void 0) {
|
|
47
|
-
additionalProps.Header = (props) => utils
|
|
47
|
+
additionalProps.Header = (props) => utils.parseFromValuesOrFunc(component, { api, auth, mrtProps: props });
|
|
48
48
|
}
|
|
49
49
|
return {
|
|
50
50
|
accessorKey: col,
|
|
51
|
-
accessorFn: (row) => utils
|
|
51
|
+
accessorFn: (row) => utils.getValue(row, col),
|
|
52
52
|
header: (_g = data == null ? void 0 : data.label_columns) == null ? void 0 : _g[col],
|
|
53
53
|
Header: enableAdvancedFilters ? (props) => {
|
|
54
54
|
var _a2, _b2;
|
|
55
55
|
return /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { gap: "2px", style: { placeItems: "center" }, children: [
|
|
56
|
-
((_a2 = utils.
|
|
56
|
+
((_a2 = utils.mergeProps(columnProps, specialKey.all, col)) == null ? void 0 : _a2.header) ?? ((_b2 = data == null ? void 0 : data.label_columns) == null ? void 0 : _b2[col]),
|
|
57
57
|
/* @__PURE__ */ jsxRuntime.jsx(HeaderAdvancedFiltersMenuButton.HeaderAdvancedFiltersMenuButton, { filters, mrtProps: props })
|
|
58
58
|
] });
|
|
59
59
|
} : void 0,
|
|
@@ -78,10 +78,10 @@ function useColumns(columnProps, header, body, textFilterSeparator, enableAdvanc
|
|
|
78
78
|
),
|
|
79
79
|
enableSorting: data == null ? void 0 : data.order_columns.includes(col),
|
|
80
80
|
filterFn: filters.length ? filterFn : void 0,
|
|
81
|
-
columnFilterModeOptions: filters.map((f) => utils.fromFilterToFilterFn(col, f.operator)),
|
|
81
|
+
columnFilterModeOptions: filters.map((f) => utils$1.fromFilterToFilterFn(col, f.operator)),
|
|
82
82
|
Cell: (props) => /* @__PURE__ */ jsxRuntime.jsx(Body.Body, { body, col, textFilterSeparator, mrtProps: props }),
|
|
83
83
|
...additionalProps,
|
|
84
|
-
...utils.
|
|
84
|
+
...utils.mergeProps(columnProps, specialKey.all, col)
|
|
85
85
|
};
|
|
86
86
|
})) || [],
|
|
87
87
|
[
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const utils = require("fastapi-rtk/utils");
|
|
4
|
-
const getProps = (propsObj = {}, ...keys) => keys.reduce((acc, key) => utils.deepMerge(acc, propsObj[key]), {});
|
|
5
3
|
const fromFilterToFilterFn = (columnId, operator, filterPrefix = false) => {
|
|
6
4
|
let word = "";
|
|
7
5
|
if (filterPrefix) {
|
|
@@ -20,4 +18,3 @@ const fromFilterFnToFilter = (filterKey = "") => {
|
|
|
20
18
|
};
|
|
21
19
|
exports.fromFilterFnToFilter = fromFilterFnToFilter;
|
|
22
20
|
exports.fromFilterToFilterFn = fromFilterToFilterFn;
|
|
23
|
-
exports.getProps = getProps;
|
|
@@ -62,6 +62,6 @@ function ApiProvider({
|
|
|
62
62
|
const [formAddProxy] = React.useState(() => zustand.createProxy(formAdd));
|
|
63
63
|
const formEdit = useProvideForm.useProvideForm();
|
|
64
64
|
const [formEditProxy] = React.useState(() => zustand.createProxy(formEdit));
|
|
65
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ApiContext.
|
|
65
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ApiContext.ApiContextProvider, { value: apiProxy, children: /* @__PURE__ */ jsxRuntime.jsx(BulkActionsContext.BulkActionsContextProvider, { value: bulkActionsProxy, children: /* @__PURE__ */ jsxRuntime.jsx(FormContext.FormContextAddProvider, { value: formAddProxy, children: /* @__PURE__ */ jsxRuntime.jsx(FormContext.FormContextEditProvider, { value: formEditProxy, children }) }) }) });
|
|
66
66
|
}
|
|
67
67
|
exports.ApiProvider = ApiProvider;
|
|
@@ -1,42 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* @type {{count: number, description_columns: Record<string, string>, ids: number[] | string[], label_columns: Record<string, string>, list_columns: string[], list_title: string, order_columns: string[], result: Record<string, any>[], path: string, queryParams: Record<string, any>} | null}
|
|
8
|
-
*/
|
|
9
|
-
data: null,
|
|
10
|
-
/**
|
|
11
|
-
* @type {{add_columns: ColumnInfo[], add_title: string, add_schema: Record<string, any>, add_uischema: Record<string, any>, edit_columns: ColumnInfo[], edit_title: string, edit_schema: Record<string, any>, edit_uischema: Record<string, any>, filter_options: Record<string, any>, filters: Record<string, Filter>, permissions: string[], relations: string[] | null, path: string} | null}
|
|
12
|
-
*/
|
|
13
|
-
info: null,
|
|
14
|
-
/**
|
|
15
|
-
* @type {{columns: string[], filters: {col: string, opr: string, value: Any}[], order_column: string | undefined, order_direction: string | undefined, page: number, page_size: number, global_filter: string | undefined} | null}
|
|
16
|
-
*/
|
|
17
|
-
queryParams: null,
|
|
18
|
-
loading: false,
|
|
19
|
-
/**
|
|
20
|
-
* @type {{message: string, originalError: Error} | null}
|
|
21
|
-
*/
|
|
22
|
-
error: null,
|
|
23
|
-
/**
|
|
24
|
-
* @type {{data: Record<string, Record<string, any>[]>, isEnd: boolean, fetch: () => void}}
|
|
25
|
-
*/
|
|
26
|
-
streaming: null,
|
|
27
|
-
/**
|
|
28
|
-
* @type {{all: string, actions: string}}
|
|
29
|
-
*/
|
|
30
|
-
specialKey: null,
|
|
31
|
-
setQueryParams: (partialQueryParams) => null,
|
|
32
|
-
refetch: async (options) => null,
|
|
33
|
-
refetchInfo: async (options) => null,
|
|
34
|
-
getEntry: async (id) => ({}),
|
|
35
|
-
addEntry: async (item) => ({}),
|
|
36
|
-
updateEntry: async (id, item) => ({}),
|
|
37
|
-
deleteEntry: async (id) => ({}),
|
|
38
|
-
download: async (label, { export_mode, delimiter, quotechar } = {}) => null,
|
|
39
|
-
upload: async (file, { delimiter, quotechar } = {}) => ({}),
|
|
40
|
-
resetError: () => null
|
|
41
|
-
});
|
|
42
|
-
exports.ApiContext = ApiContext;
|
|
3
|
+
const utils = require("fastapi-rtk/utils");
|
|
4
|
+
const [ApiContextProvider, useApiProvider] = utils.createSafeContext("useApi must be used within an ApiProvider");
|
|
5
|
+
exports.ApiContextProvider = ApiContextProvider;
|
|
6
|
+
exports.useApiProvider = useApiProvider;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* @type {{message: string, originalError: Error} | null}
|
|
10
|
-
*/
|
|
11
|
-
error: null
|
|
12
|
-
});
|
|
13
|
-
exports.BulkActionsContext = BulkActionsContext;
|
|
3
|
+
const utils = require("fastapi-rtk/utils");
|
|
4
|
+
const [BulkActionsContextProvider, useBulkActionsProvider] = utils.createSafeContext(
|
|
5
|
+
"useBulkActions must be used within an ApiProvider"
|
|
6
|
+
);
|
|
7
|
+
exports.BulkActionsContextProvider = BulkActionsContextProvider;
|
|
8
|
+
exports.useBulkActionsProvider = useBulkActionsProvider;
|
|
@@ -1,40 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
throw new Error("getView must be defined in a provider");
|
|
15
|
-
},
|
|
16
|
-
setView: () => {
|
|
17
|
-
throw new Error("setView must be defined in a provider");
|
|
18
|
-
},
|
|
19
|
-
state: void 0,
|
|
20
|
-
getState: () => {
|
|
21
|
-
throw new Error("getState must be defined in a provider");
|
|
22
|
-
},
|
|
23
|
-
setState: () => {
|
|
24
|
-
throw new Error("setState must be defined in a provider");
|
|
25
|
-
},
|
|
26
|
-
reset: () => {
|
|
27
|
-
throw new Error("reset must be defined in a provider");
|
|
28
|
-
},
|
|
29
|
-
item: void 0,
|
|
30
|
-
getItem: () => {
|
|
31
|
-
throw new Error("getItem must be defined in a provider");
|
|
32
|
-
},
|
|
33
|
-
setItem: () => {
|
|
34
|
-
throw new Error("setItem must be defined in a provider");
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
const FormContextAdd = React.createContext(stubContext);
|
|
38
|
-
const FormContextEdit = React.createContext(stubContext);
|
|
39
|
-
exports.FormContextAdd = FormContextAdd;
|
|
40
|
-
exports.FormContextEdit = FormContextEdit;
|
|
3
|
+
const utils = require("fastapi-rtk/utils");
|
|
4
|
+
const [FormContextAddProvider, useFormAddProvider] = utils.createSafeContext(
|
|
5
|
+
"useForms('add') must be used within an ApiProvider"
|
|
6
|
+
);
|
|
7
|
+
const [FormContextEditProvider, useFormEditProvider] = utils.createSafeContext(
|
|
8
|
+
"useForms('edit') must be used within an ApiProvider"
|
|
9
|
+
);
|
|
10
|
+
exports.FormContextAddProvider = FormContextAddProvider;
|
|
11
|
+
exports.FormContextEditProvider = FormContextEditProvider;
|
|
12
|
+
exports.useFormAddProvider = useFormAddProvider;
|
|
13
|
+
exports.useFormEditProvider = useFormEditProvider;
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*/
|
|
8
|
-
user: null,
|
|
9
|
-
loading: false,
|
|
10
|
-
/**
|
|
11
|
-
* @type {{message: string, originalError: Error} | null}
|
|
12
|
-
*/
|
|
13
|
-
error: null,
|
|
14
|
-
signin: async (username, password) => null,
|
|
15
|
-
signout: async () => null,
|
|
16
|
-
update: async (data) => null,
|
|
17
|
-
resetPassword: async (password) => null,
|
|
18
|
-
oauth_signin: (provider, popup) => null,
|
|
19
|
-
refetch: async () => null
|
|
20
|
-
});
|
|
21
|
-
exports.AuthContext = AuthContext;
|
|
3
|
+
const utils = require("fastapi-rtk/utils");
|
|
4
|
+
const [AuthContextProvider, useAuthProvider] = utils.createSafeContext("useAuth must be used within a Provider");
|
|
5
|
+
exports.AuthContextProvider = AuthContextProvider;
|
|
6
|
+
exports.useAuthProvider = useAuthProvider;
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* @type {{icon: string, level: string, name: string, path: string, permission_name: string, type: string}[] | null}
|
|
8
|
-
*/
|
|
9
|
-
info: null,
|
|
10
|
-
loading: false,
|
|
11
|
-
/**
|
|
12
|
-
* @type {{message: string, originalError: Error} | null}
|
|
13
|
-
*/
|
|
14
|
-
error: null
|
|
15
|
-
});
|
|
16
|
-
exports.InfoContext = InfoContext;
|
|
3
|
+
const utils = require("fastapi-rtk/utils");
|
|
4
|
+
const [InfoContextProvider, useInfoProvider] = utils.createSafeContext("useInfo must be used within a Provider");
|
|
5
|
+
exports.InfoContextProvider = InfoContextProvider;
|
|
6
|
+
exports.useInfoProvider = useInfoProvider;
|
|
@@ -30,7 +30,7 @@ function InnerProvider(props) {
|
|
|
30
30
|
const authProxy = zustand.useProxy(auth);
|
|
31
31
|
const info = useInfo(baseUrl, auth, props.fab);
|
|
32
32
|
const infoProxy = zustand.useProxy(info);
|
|
33
|
-
return /* @__PURE__ */ jsxRuntime.jsx(AuthContext.
|
|
33
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AuthContext.AuthContextProvider, { value: authProxy, children: /* @__PURE__ */ jsxRuntime.jsx(InfoContext.InfoContextProvider, { value: infoProxy, children }) });
|
|
34
34
|
}
|
|
35
35
|
const Provider = (props) => {
|
|
36
36
|
const [queryClient$1] = React.useState(() => new queryClient.QueryClient(props.queryClientProps));
|