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
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const React = require("react");
|
|
4
3
|
const ApiContext = require("../../Wrappers/ApiProvider/Contexts/ApiContext.cjs");
|
|
5
|
-
const useApi = () =>
|
|
6
|
-
const context = React.useContext(ApiContext.ApiContext);
|
|
7
|
-
if (context === void 0) {
|
|
8
|
-
throw new Error("useApi must be used within a ApiProvider");
|
|
9
|
-
}
|
|
10
|
-
return context;
|
|
11
|
-
};
|
|
4
|
+
const useApi = (options) => ApiContext.useApiProvider(options);
|
|
12
5
|
exports.useApi = useApi;
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const React = require("react");
|
|
4
3
|
const BulkActionsContext = require("../../Wrappers/ApiProvider/Contexts/BulkActionsContext.cjs");
|
|
5
|
-
const useBulkActions = () =>
|
|
6
|
-
const context = React.useContext(BulkActionsContext.BulkActionsContext);
|
|
7
|
-
if (context === void 0) {
|
|
8
|
-
throw new Error("useBulkActions must be used within a ApiProvider");
|
|
9
|
-
}
|
|
10
|
-
return context;
|
|
11
|
-
};
|
|
4
|
+
const useBulkActions = (options) => BulkActionsContext.useBulkActionsProvider(options);
|
|
12
5
|
exports.useBulkActions = useBulkActions;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const React = require("react");
|
|
4
3
|
const FormContext = require("../../Wrappers/ApiProvider/Contexts/FormContext.cjs");
|
|
5
|
-
const useForms = (type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
return context;
|
|
11
|
-
};
|
|
4
|
+
const useForms = (type, options) => (
|
|
5
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
6
|
+
type === "add" ? FormContext.useFormAddProvider(options) : FormContext.useFormEditProvider(options)
|
|
7
|
+
);
|
|
12
8
|
exports.useForms = useForms;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const React = require("react");
|
|
4
3
|
const AuthContext = require("../../Wrappers/Provider/Contexts/AuthContext.cjs");
|
|
5
|
-
const useAuth = () =>
|
|
6
|
-
return React.useContext(AuthContext.AuthContext);
|
|
7
|
-
};
|
|
4
|
+
const useAuth = (options) => AuthContext.useAuthProvider(options);
|
|
8
5
|
exports.useAuth = useAuth;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const React = require("react");
|
|
4
3
|
const InfoContext = require("../../Wrappers/Provider/Contexts/InfoContext.cjs");
|
|
5
|
-
const useInfo = () =>
|
|
6
|
-
return React.useContext(InfoContext.InfoContext);
|
|
7
|
-
};
|
|
4
|
+
const useInfo = (options) => InfoContext.useInfoProvider(options);
|
|
8
5
|
exports.useInfo = useInfo;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
/* empty css */
|
|
3
3
|
/* empty css */
|
|
4
|
-
import { deepMerge, getItemId } from "fastapi-rtk/utils";
|
|
4
|
+
import { deepMerge, mergeProps, getItemId } from "fastapi-rtk/utils";
|
|
5
5
|
import { useProps, Box } from "@mantine/core";
|
|
6
6
|
import { useMantineReactTable, MantineReactTable } from "../../../../.external/esm/mantine-react-table@2.0.0-beta.9_@mantine_core@7.17.8_@mantine_dates@7.17.8_@mantine_hooks@7._ll5dfnmvjphm4bajaxt6oy7mty/mantine-react-table/dist/index.esm.mjs";
|
|
7
7
|
import { forwardRef, useMemo, useEffect } from "react";
|
|
@@ -23,7 +23,6 @@ import { useSize } from "./hooks/useSize.mjs";
|
|
|
23
23
|
import { useSorting } from "./hooks/useSorting.mjs";
|
|
24
24
|
import { useToolbar } from "./hooks/useToolbar/useToolbar.mjs";
|
|
25
25
|
import { useToolbarAlertBanner } from "./hooks/useToolbarAlertBanner/useToolbarAlertBanner.mjs";
|
|
26
|
-
import { getProps } from "./utils.mjs";
|
|
27
26
|
const baseProps = { enableStickyHeader: true, enableColumnPinning: true };
|
|
28
27
|
const NextGenDataGrid = forwardRef((props, ref) => {
|
|
29
28
|
var _a, _b, _c;
|
|
@@ -137,7 +136,7 @@ const NextGenDataGrid = forwardRef((props, ref) => {
|
|
|
137
136
|
const paginationProps = usePagination(hidePagination);
|
|
138
137
|
const columnsProps = useColumns(columnProps, header, body, textFilterSeparator, enableAdvancedFilters);
|
|
139
138
|
const sizeProps = useSize(withBorder);
|
|
140
|
-
const actionsProps = useActions(hideActions, (_a =
|
|
139
|
+
const actionsProps = useActions(hideActions, (_a = mergeProps(body, specialKey.actions)) == null ? void 0 : _a.component);
|
|
141
140
|
const globalFilterProps = useGlobalFilter();
|
|
142
141
|
const toolbarProps = useToolbar(toolbar, quickFilters, hideToolbar, enableAdvancedFilters);
|
|
143
142
|
const eventProps = useEvent(onClickEntry);
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { parseFromValuesOrFunc } from "fastapi-rtk/utils";
|
|
2
|
+
import { mergeProps, parseFromValuesOrFunc } from "fastapi-rtk/utils";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
import { useApi } from "../../../../hooks/api/useApi.mjs";
|
|
5
5
|
import { useAuth } from "../../../../hooks/auth/useAuth.mjs";
|
|
6
6
|
import { FallbackWrapper } from "../../FallbackWrapper.mjs";
|
|
7
|
-
import { getProps } from "../../utils.mjs";
|
|
8
7
|
import { MultiLineHighlight } from "./MultiLineHighlight.mjs";
|
|
9
8
|
const Body = ({ body, col, textFilterSeparator, mrtProps }) => {
|
|
10
9
|
const { table, column, cell } = mrtProps;
|
|
11
10
|
const api = useApi();
|
|
12
11
|
const auth = useAuth();
|
|
13
12
|
const { specialKey } = useApi();
|
|
14
|
-
const { component, separator, truncate, tooltipProps, highlightProps } =
|
|
13
|
+
const { component, separator, truncate, tooltipProps, highlightProps } = mergeProps(body, specialKey.all, col);
|
|
15
14
|
const highlights = useMemo(() => {
|
|
16
15
|
const globalFilter = table.getState().globalFilter;
|
|
17
16
|
const columnTextFilter = column.getFilterValue();
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import classes from "./headerinput.module.css.mjs";
|
|
3
3
|
import { useSyncValues } from "fastapi-rtk/hooks";
|
|
4
|
-
import { getValueOrDefault, parseFromValuesOrFunc } from "fastapi-rtk/utils";
|
|
4
|
+
import { getValueOrDefault, parseFromValuesOrFunc, mergeProps } from "fastapi-rtk/utils";
|
|
5
5
|
import { Tooltip, Indicator, CloseButton } from "@mantine/core";
|
|
6
6
|
import { useField } from "@mantine/form";
|
|
7
7
|
import { useElementSize, useMergedRef, useDidUpdate } from "@mantine/hooks";
|
|
8
8
|
import { clsx } from "../../../../../../../.external/esm/clsx@2.1.1/clsx/dist/clsx.mjs";
|
|
9
9
|
import { forwardRef, cloneElement, useMemo, useRef } from "react";
|
|
10
10
|
import { useApi } from "../../../../../hooks/api/useApi.mjs";
|
|
11
|
-
import { getProps } from "../../../utils.mjs";
|
|
12
11
|
import { getBasicInput } from "../utils.mjs";
|
|
13
12
|
import { HeaderInput } from "./HeaderInput.mjs";
|
|
14
13
|
const getLocalStorageValue = (key, defaultValue) => {
|
|
@@ -153,7 +152,7 @@ function ColumnHeaderFilterInput({
|
|
|
153
152
|
[actionIconProps]
|
|
154
153
|
);
|
|
155
154
|
const configuration = parseFromValuesOrFunc(
|
|
156
|
-
enableFilterModes ?
|
|
155
|
+
enableFilterModes ? mergeProps(filterProps, opr) : filterProps,
|
|
157
156
|
functionProps
|
|
158
157
|
);
|
|
159
158
|
const headerInputProps = useMemo(
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { mergeProps } from "fastapi-rtk/utils";
|
|
2
3
|
import { Input } from "@mantine/core";
|
|
3
4
|
import { localizedFilterOption } from "../../../../../../.external/esm/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.mjs";
|
|
4
5
|
import { useMemo } from "react";
|
|
5
6
|
import { FallbackWrapper } from "../../FallbackWrapper.mjs";
|
|
6
|
-
import { getProps } from "../../utils.mjs";
|
|
7
7
|
const FilterModeDescription = ({ table, column, opr, filters, filterModeDescription, functionProps }) => {
|
|
8
8
|
const filterName = useMemo(() => {
|
|
9
9
|
var _a;
|
|
@@ -14,7 +14,7 @@ const FilterModeDescription = ({ table, column, opr, filters, filterModeDescript
|
|
|
14
14
|
{
|
|
15
15
|
fallback: filters.length ? /* @__PURE__ */ jsx(Input.Description, { size: "xs", children: table.options.localization.filterMode.replace(
|
|
16
16
|
"{filterType}",
|
|
17
|
-
localizedFilterOption(
|
|
17
|
+
localizedFilterOption(mergeProps(table.options.localization, column.id), filterName) || localizedFilterOption(table.options.localization, filterName) || filterName
|
|
18
18
|
) }) : null,
|
|
19
19
|
functionProps: { ...functionProps, componentProps: { value: filterName } },
|
|
20
20
|
children: filterModeDescription
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { getValue, parseFromValuesOrFunc } from "fastapi-rtk/utils";
|
|
2
|
+
import { mergeProps, getValue, parseFromValuesOrFunc } from "fastapi-rtk/utils";
|
|
3
3
|
import { Flex } from "@mantine/core";
|
|
4
4
|
import { useMap, useSetState } from "@mantine/hooks";
|
|
5
5
|
import { useEffect, useMemo } from "react";
|
|
6
6
|
import { useApi } from "../../../../hooks/api/useApi.mjs";
|
|
7
7
|
import { useAuth } from "../../../../hooks/auth/useAuth.mjs";
|
|
8
|
-
import {
|
|
8
|
+
import { fromFilterToFilterFn } from "../../utils.mjs";
|
|
9
9
|
import { Body } from "./Body.mjs";
|
|
10
10
|
import { ColumnHeaderFilter } from "./ColumnHeaderFilter.mjs";
|
|
11
11
|
import { HeaderAdvancedFiltersMenuButton } from "./HeaderAdvancedFiltersMenuButton.mjs";
|
|
@@ -37,7 +37,7 @@ function useColumns(columnProps, header, body, textFilterSeparator, enableAdvanc
|
|
|
37
37
|
withLocalStorage,
|
|
38
38
|
localStorageKey,
|
|
39
39
|
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) || ""
|
|
40
|
-
} =
|
|
40
|
+
} = mergeProps(header, specialKey.all, col);
|
|
41
41
|
const filterFn = fromFilterToFilterFn(col, defaultOpr);
|
|
42
42
|
const filters = ((_f = (_e = info == null ? void 0 : info.filters) == null ? void 0 : _e[col]) == null ? void 0 : _f.filters) || [];
|
|
43
43
|
const additionalProps = {};
|
|
@@ -51,7 +51,7 @@ function useColumns(columnProps, header, body, textFilterSeparator, enableAdvanc
|
|
|
51
51
|
Header: enableAdvancedFilters ? (props) => {
|
|
52
52
|
var _a2, _b2;
|
|
53
53
|
return /* @__PURE__ */ jsxs(Flex, { gap: "2px", style: { placeItems: "center" }, children: [
|
|
54
|
-
((_a2 =
|
|
54
|
+
((_a2 = mergeProps(columnProps, specialKey.all, col)) == null ? void 0 : _a2.header) ?? ((_b2 = data == null ? void 0 : data.label_columns) == null ? void 0 : _b2[col]),
|
|
55
55
|
/* @__PURE__ */ jsx(HeaderAdvancedFiltersMenuButton, { filters, mrtProps: props })
|
|
56
56
|
] });
|
|
57
57
|
} : void 0,
|
|
@@ -79,7 +79,7 @@ function useColumns(columnProps, header, body, textFilterSeparator, enableAdvanc
|
|
|
79
79
|
columnFilterModeOptions: filters.map((f) => fromFilterToFilterFn(col, f.operator)),
|
|
80
80
|
Cell: (props) => /* @__PURE__ */ jsx(Body, { body, col, textFilterSeparator, mrtProps: props }),
|
|
81
81
|
...additionalProps,
|
|
82
|
-
...
|
|
82
|
+
...mergeProps(columnProps, specialKey.all, col)
|
|
83
83
|
};
|
|
84
84
|
})) || [],
|
|
85
85
|
[
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { deepMerge } from "fastapi-rtk/utils";
|
|
2
|
-
const getProps = (propsObj = {}, ...keys) => keys.reduce((acc, key) => deepMerge(acc, propsObj[key]), {});
|
|
3
1
|
const fromFilterToFilterFn = (columnId, operator, filterPrefix = false) => {
|
|
4
2
|
let word = "";
|
|
5
3
|
if (filterPrefix) {
|
|
@@ -18,6 +16,5 @@ const fromFilterFnToFilter = (filterKey = "") => {
|
|
|
18
16
|
};
|
|
19
17
|
export {
|
|
20
18
|
fromFilterFnToFilter,
|
|
21
|
-
fromFilterToFilterFn
|
|
22
|
-
getProps
|
|
19
|
+
fromFilterToFilterFn
|
|
23
20
|
};
|
|
@@ -5,9 +5,9 @@ import { useState } from "react";
|
|
|
5
5
|
import { useFabProvideApi } from "../../fab-react-toolkit-patch/api/hooks/useProvideApi.mjs";
|
|
6
6
|
import { useFabProvideBulk } from "../../fab-react-toolkit-patch/api/hooks/useProvideBulk.mjs";
|
|
7
7
|
import { useInfo } from "../../hooks/auth/useInfo.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { ApiContextProvider } from "./Contexts/ApiContext.mjs";
|
|
9
|
+
import { BulkActionsContextProvider } from "./Contexts/BulkActionsContext.mjs";
|
|
10
|
+
import { FormContextAddProvider, FormContextEditProvider } from "./Contexts/FormContext.mjs";
|
|
11
11
|
import { useProvideApi } from "./hooks/useProvideApi.mjs";
|
|
12
12
|
import { useProvideBulk } from "./hooks/useProvideBulk.mjs";
|
|
13
13
|
import { useProvideForm } from "./hooks/useProvideForm.mjs";
|
|
@@ -60,7 +60,7 @@ function ApiProvider({
|
|
|
60
60
|
const [formAddProxy] = useState(() => createProxy(formAdd));
|
|
61
61
|
const formEdit = useProvideForm();
|
|
62
62
|
const [formEditProxy] = useState(() => createProxy(formEdit));
|
|
63
|
-
return /* @__PURE__ */ jsx(
|
|
63
|
+
return /* @__PURE__ */ jsx(ApiContextProvider, { value: apiProxy, children: /* @__PURE__ */ jsx(BulkActionsContextProvider, { value: bulkActionsProxy, children: /* @__PURE__ */ jsx(FormContextAddProvider, { value: formAddProxy, children: /* @__PURE__ */ jsx(FormContextEditProvider, { value: formEditProxy, children }) }) }) });
|
|
64
64
|
}
|
|
65
65
|
export {
|
|
66
66
|
ApiProvider
|
|
@@ -1,42 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
3
|
-
path: "",
|
|
4
|
-
/**
|
|
5
|
-
* @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}
|
|
6
|
-
*/
|
|
7
|
-
data: null,
|
|
8
|
-
/**
|
|
9
|
-
* @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}
|
|
10
|
-
*/
|
|
11
|
-
info: null,
|
|
12
|
-
/**
|
|
13
|
-
* @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}
|
|
14
|
-
*/
|
|
15
|
-
queryParams: null,
|
|
16
|
-
loading: false,
|
|
17
|
-
/**
|
|
18
|
-
* @type {{message: string, originalError: Error} | null}
|
|
19
|
-
*/
|
|
20
|
-
error: null,
|
|
21
|
-
/**
|
|
22
|
-
* @type {{data: Record<string, Record<string, any>[]>, isEnd: boolean, fetch: () => void}}
|
|
23
|
-
*/
|
|
24
|
-
streaming: null,
|
|
25
|
-
/**
|
|
26
|
-
* @type {{all: string, actions: string}}
|
|
27
|
-
*/
|
|
28
|
-
specialKey: null,
|
|
29
|
-
setQueryParams: (partialQueryParams) => null,
|
|
30
|
-
refetch: async (options) => null,
|
|
31
|
-
refetchInfo: async (options) => null,
|
|
32
|
-
getEntry: async (id) => ({}),
|
|
33
|
-
addEntry: async (item) => ({}),
|
|
34
|
-
updateEntry: async (id, item) => ({}),
|
|
35
|
-
deleteEntry: async (id) => ({}),
|
|
36
|
-
download: async (label, { export_mode, delimiter, quotechar } = {}) => null,
|
|
37
|
-
upload: async (file, { delimiter, quotechar } = {}) => ({}),
|
|
38
|
-
resetError: () => null
|
|
39
|
-
});
|
|
1
|
+
import { createSafeContext } from "fastapi-rtk/utils";
|
|
2
|
+
const [ApiContextProvider, useApiProvider] = createSafeContext("useApi must be used within an ApiProvider");
|
|
40
3
|
export {
|
|
41
|
-
|
|
4
|
+
ApiContextProvider,
|
|
5
|
+
useApiProvider
|
|
42
6
|
};
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
},
|
|
6
|
-
/**
|
|
7
|
-
* @type {{message: string, originalError: Error} | null}
|
|
8
|
-
*/
|
|
9
|
-
error: null
|
|
10
|
-
});
|
|
1
|
+
import { createSafeContext } from "fastapi-rtk/utils";
|
|
2
|
+
const [BulkActionsContextProvider, useBulkActionsProvider] = createSafeContext(
|
|
3
|
+
"useBulkActions must be used within an ApiProvider"
|
|
4
|
+
);
|
|
11
5
|
export {
|
|
12
|
-
|
|
6
|
+
BulkActionsContextProvider,
|
|
7
|
+
useBulkActionsProvider
|
|
13
8
|
};
|
|
@@ -1,40 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
throw new Error("setOpened must be defined in a provider");
|
|
9
|
-
},
|
|
10
|
-
view: 0,
|
|
11
|
-
getView: () => {
|
|
12
|
-
throw new Error("getView must be defined in a provider");
|
|
13
|
-
},
|
|
14
|
-
setView: () => {
|
|
15
|
-
throw new Error("setView must be defined in a provider");
|
|
16
|
-
},
|
|
17
|
-
state: void 0,
|
|
18
|
-
getState: () => {
|
|
19
|
-
throw new Error("getState must be defined in a provider");
|
|
20
|
-
},
|
|
21
|
-
setState: () => {
|
|
22
|
-
throw new Error("setState must be defined in a provider");
|
|
23
|
-
},
|
|
24
|
-
reset: () => {
|
|
25
|
-
throw new Error("reset must be defined in a provider");
|
|
26
|
-
},
|
|
27
|
-
item: void 0,
|
|
28
|
-
getItem: () => {
|
|
29
|
-
throw new Error("getItem must be defined in a provider");
|
|
30
|
-
},
|
|
31
|
-
setItem: () => {
|
|
32
|
-
throw new Error("setItem must be defined in a provider");
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
const FormContextAdd = createContext(stubContext);
|
|
36
|
-
const FormContextEdit = createContext(stubContext);
|
|
1
|
+
import { createSafeContext } from "fastapi-rtk/utils";
|
|
2
|
+
const [FormContextAddProvider, useFormAddProvider] = createSafeContext(
|
|
3
|
+
"useForms('add') must be used within an ApiProvider"
|
|
4
|
+
);
|
|
5
|
+
const [FormContextEditProvider, useFormEditProvider] = createSafeContext(
|
|
6
|
+
"useForms('edit') must be used within an ApiProvider"
|
|
7
|
+
);
|
|
37
8
|
export {
|
|
38
|
-
|
|
39
|
-
|
|
9
|
+
FormContextAddProvider,
|
|
10
|
+
FormContextEditProvider,
|
|
11
|
+
useFormAddProvider,
|
|
12
|
+
useFormEditProvider
|
|
40
13
|
};
|
|
@@ -1,21 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
3
|
-
/**
|
|
4
|
-
* @type {{email: string, first_name: string, id: number, is_active: boolean, last_name: string, permissions: string[], roles: string[], username: string} | null}
|
|
5
|
-
*/
|
|
6
|
-
user: null,
|
|
7
|
-
loading: false,
|
|
8
|
-
/**
|
|
9
|
-
* @type {{message: string, originalError: Error} | null}
|
|
10
|
-
*/
|
|
11
|
-
error: null,
|
|
12
|
-
signin: async (username, password) => null,
|
|
13
|
-
signout: async () => null,
|
|
14
|
-
update: async (data) => null,
|
|
15
|
-
resetPassword: async (password) => null,
|
|
16
|
-
oauth_signin: (provider, popup) => null,
|
|
17
|
-
refetch: async () => null
|
|
18
|
-
});
|
|
1
|
+
import { createSafeContext } from "fastapi-rtk/utils";
|
|
2
|
+
const [AuthContextProvider, useAuthProvider] = createSafeContext("useAuth must be used within a Provider");
|
|
19
3
|
export {
|
|
20
|
-
|
|
4
|
+
AuthContextProvider,
|
|
5
|
+
useAuthProvider
|
|
21
6
|
};
|
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
3
|
-
baseUrl: "",
|
|
4
|
-
/**
|
|
5
|
-
* @type {{icon: string, level: string, name: string, path: string, permission_name: string, type: string}[] | null}
|
|
6
|
-
*/
|
|
7
|
-
info: null,
|
|
8
|
-
loading: false,
|
|
9
|
-
/**
|
|
10
|
-
* @type {{message: string, originalError: Error} | null}
|
|
11
|
-
*/
|
|
12
|
-
error: null
|
|
13
|
-
});
|
|
1
|
+
import { createSafeContext } from "fastapi-rtk/utils";
|
|
2
|
+
const [InfoContextProvider, useInfoProvider] = createSafeContext("useInfo must be used within a Provider");
|
|
14
3
|
export {
|
|
15
|
-
|
|
4
|
+
InfoContextProvider,
|
|
5
|
+
useInfoProvider
|
|
16
6
|
};
|
|
@@ -5,8 +5,8 @@ import { QueryClientProvider } from "../../../../.external/esm/@tanstack_react-q
|
|
|
5
5
|
import { useState } from "react";
|
|
6
6
|
import { useFabProvideAuth } from "../../fab-react-toolkit-patch/auth/hooks/useProvideAuth.mjs";
|
|
7
7
|
import { useFabProvideInfo } from "../../fab-react-toolkit-patch/auth/hooks/useProvideInfo.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { AuthContextProvider } from "./Contexts/AuthContext.mjs";
|
|
9
|
+
import { InfoContextProvider } from "./Contexts/InfoContext.mjs";
|
|
10
10
|
import { useProvideAuth } from "./hooks/useProvideAuth.mjs";
|
|
11
11
|
import { useProvideInfo } from "./hooks/useProvideInfo.mjs";
|
|
12
12
|
function useAuth(baseUrl, authQueryProps, fab) {
|
|
@@ -28,7 +28,7 @@ function InnerProvider(props) {
|
|
|
28
28
|
const authProxy = useProxy(auth);
|
|
29
29
|
const info = useInfo(baseUrl, auth, props.fab);
|
|
30
30
|
const infoProxy = useProxy(info);
|
|
31
|
-
return /* @__PURE__ */ jsx(
|
|
31
|
+
return /* @__PURE__ */ jsx(AuthContextProvider, { value: authProxy, children: /* @__PURE__ */ jsx(InfoContextProvider, { value: infoProxy, children }) });
|
|
32
32
|
}
|
|
33
33
|
const Provider = (props) => {
|
|
34
34
|
const [queryClient] = useState(() => new QueryClient(props.queryClientProps));
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const useApi = () => {
|
|
4
|
-
const context = useContext(ApiContext);
|
|
5
|
-
if (context === void 0) {
|
|
6
|
-
throw new Error("useApi must be used within a ApiProvider");
|
|
7
|
-
}
|
|
8
|
-
return context;
|
|
9
|
-
};
|
|
1
|
+
import { useApiProvider } from "../../Wrappers/ApiProvider/Contexts/ApiContext.mjs";
|
|
2
|
+
const useApi = (options) => useApiProvider(options);
|
|
10
3
|
export {
|
|
11
4
|
useApi
|
|
12
5
|
};
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const useBulkActions = () => {
|
|
4
|
-
const context = useContext(BulkActionsContext);
|
|
5
|
-
if (context === void 0) {
|
|
6
|
-
throw new Error("useBulkActions must be used within a ApiProvider");
|
|
7
|
-
}
|
|
8
|
-
return context;
|
|
9
|
-
};
|
|
1
|
+
import { useBulkActionsProvider } from "../../Wrappers/ApiProvider/Contexts/BulkActionsContext.mjs";
|
|
2
|
+
const useBulkActions = (options) => useBulkActionsProvider(options);
|
|
10
3
|
export {
|
|
11
4
|
useBulkActions
|
|
12
5
|
};
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
throw new Error("useForms must be used within an ApiProvider");
|
|
7
|
-
}
|
|
8
|
-
return context;
|
|
9
|
-
};
|
|
1
|
+
import { useFormEditProvider, useFormAddProvider } from "../../Wrappers/ApiProvider/Contexts/FormContext.mjs";
|
|
2
|
+
const useForms = (type, options) => (
|
|
3
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
4
|
+
type === "add" ? useFormAddProvider(options) : useFormEditProvider(options)
|
|
5
|
+
);
|
|
10
6
|
export {
|
|
11
7
|
useForms
|
|
12
8
|
};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const useAuth = () => {
|
|
4
|
-
return useContext(AuthContext);
|
|
5
|
-
};
|
|
1
|
+
import { useAuthProvider } from "../../Wrappers/Provider/Contexts/AuthContext.mjs";
|
|
2
|
+
const useAuth = (options) => useAuthProvider(options);
|
|
6
3
|
export {
|
|
7
4
|
useAuth
|
|
8
5
|
};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const useInfo = () => {
|
|
4
|
-
return useContext(InfoContext);
|
|
5
|
-
};
|
|
1
|
+
import { useInfoProvider } from "../../Wrappers/Provider/Contexts/InfoContext.mjs";
|
|
2
|
+
const useInfo = (options) => useInfoProvider(options);
|
|
6
3
|
export {
|
|
7
4
|
useInfo
|
|
8
5
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export function getProps(propsObj?: Record<string, any>, ...keys: string[]): Record<string, any>;
|
|
2
1
|
export function fromFilterToFilterFn(columnId: string, operator: string, filterPrefix?: boolean): string;
|
|
3
2
|
export function fromFilterFnToFilter(filterKey?: string): {
|
|
4
3
|
col: string;
|