fastapi-rtk 0.2.7 → 0.2.9
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/DataGrid/Toolbar/Filter/FilterMenu.cjs +1 -1
- 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/ApiProvider/hooks/useProvideApi.cjs +8 -8
- package/dist/core/cjs/Wrappers/ApiProvider/hooks/useProvideBulk.cjs +4 -7
- 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/Wrappers/Provider/hooks/useProvideAuth.cjs +12 -10
- package/dist/core/cjs/fab-react-toolkit-patch/api/hooks/useProvideApi.cjs +8 -8
- package/dist/core/cjs/fab-react-toolkit-patch/api/hooks/useProvideBulk.cjs +4 -7
- package/dist/core/cjs/fab-react-toolkit-patch/auth/hooks/useProvideAuth.cjs +12 -10
- 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/DataGrid/Toolbar/Filter/FilterMenu.mjs +1 -1
- 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/ApiProvider/hooks/useProvideApi.mjs +8 -8
- package/dist/core/esm/Wrappers/ApiProvider/hooks/useProvideBulk.mjs +4 -7
- 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/Wrappers/Provider/hooks/useProvideAuth.mjs +12 -10
- package/dist/core/esm/fab-react-toolkit-patch/api/hooks/useProvideApi.mjs +8 -8
- package/dist/core/esm/fab-react-toolkit-patch/api/hooks/useProvideBulk.mjs +4 -7
- package/dist/core/esm/fab-react-toolkit-patch/auth/hooks/useProvideAuth.mjs +12 -10
- 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/ApiProvider/hooks/useProvideApi.d.ts +1 -1
- package/dist/core/lib/Wrappers/ApiProvider/hooks/useProvideBulk.d.ts +1 -0
- 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/Wrappers/Provider/hooks/useProvideAuth.d.ts +1 -0
- package/dist/core/lib/fab-react-toolkit-patch/api/hooks/useProvideApi.d.ts +1 -1
- package/dist/core/lib/fab-react-toolkit-patch/api/hooks/useProvideBulk.d.ts +1 -0
- package/dist/core/lib/fab-react-toolkit-patch/auth/hooks/useProvideAuth.d.ts +1 -0
- package/dist/core/lib/hooks/api/useApi.d.ts +415 -61
- package/dist/core/lib/hooks/api/useBulkActions.d.ts +39 -8
- package/dist/core/lib/hooks/api/useForms.d.ts +72 -13
- package/dist/core/lib/hooks/auth/useAuth.d.ts +84 -17
- package/dist/core/lib/hooks/auth/useInfo.d.ts +51 -9
- package/dist/hooks/cjs/useCustomFetch/useCustomFetch.cjs +4 -3
- package/dist/hooks/esm/useCustomFetch/useCustomFetch.mjs +5 -4
- package/dist/hooks/lib/useCustomFetch/useCustomFetch.d.ts +2 -1
- 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
- /package/dist/.external/cjs/{mantine-form-yup-resolver@2.0.0_@mantine_form@8.1.3_yup@1.6.1 → mantine-form-yup-resolver@2.0.0_@mantine_form@8.2.1_yup@1.6.1}/mantine-form-yup-resolver/dist/esm/index.cjs +0 -0
- /package/dist/.external/esm/{mantine-form-yup-resolver@2.0.0_@mantine_form@8.1.3_yup@1.6.1 → mantine-form-yup-resolver@2.0.0_@mantine_form@8.2.1_yup@1.6.1}/mantine-form-yup-resolver/dist/esm/index.mjs +0 -0
|
@@ -85,9 +85,9 @@ function useProvideApi({
|
|
|
85
85
|
}),
|
|
86
86
|
[streamingMode]
|
|
87
87
|
);
|
|
88
|
-
const [error, setError] = React.useState(
|
|
88
|
+
const [error, setError] = React.useState();
|
|
89
89
|
const memoizedError = React.useMemo(() => error, [error]);
|
|
90
|
-
const resetError = React.useCallback(() => setError(
|
|
90
|
+
const resetError = React.useCallback(() => setError(void 0), []);
|
|
91
91
|
const {
|
|
92
92
|
data: info,
|
|
93
93
|
isFetching: infoLoading,
|
|
@@ -150,8 +150,8 @@ function useProvideApi({
|
|
|
150
150
|
const getEntry = React.useCallback(
|
|
151
151
|
async (id) => {
|
|
152
152
|
try {
|
|
153
|
-
const response = await getItem.getItem(pathRef.current, convertId.convertId(id));
|
|
154
153
|
resetError();
|
|
154
|
+
const response = await getItem.getItem(pathRef.current, convertId.convertId(id));
|
|
155
155
|
return response;
|
|
156
156
|
} catch (error2) {
|
|
157
157
|
setError({ message: `Couldn't fetch item with id ${id}`, originalError: error2 });
|
|
@@ -166,9 +166,9 @@ function useProvideApi({
|
|
|
166
166
|
async (item) => {
|
|
167
167
|
var _a;
|
|
168
168
|
try {
|
|
169
|
+
resetError();
|
|
169
170
|
const func = ((_a = infoRef.current) == null ? void 0 : _a.add_type) === "form" ? formCreateItem.formCreateItem : createItem.createItem;
|
|
170
171
|
const response = await func(pathRef.current, item);
|
|
171
|
-
resetError();
|
|
172
172
|
return response;
|
|
173
173
|
} catch (error2) {
|
|
174
174
|
setError({ message: `Couldn't add item`, originalError: error2 });
|
|
@@ -183,9 +183,9 @@ function useProvideApi({
|
|
|
183
183
|
async (id, item) => {
|
|
184
184
|
var _a;
|
|
185
185
|
try {
|
|
186
|
+
resetError();
|
|
186
187
|
const func = ((_a = infoRef.current) == null ? void 0 : _a.edit_type) === "form" ? formUpdateItem.formUpdateItem : updateItem.updateItem;
|
|
187
188
|
const response = await func(pathRef.current, convertId.convertId(id), item);
|
|
188
|
-
resetError();
|
|
189
189
|
return response;
|
|
190
190
|
} catch (error2) {
|
|
191
191
|
setError({ message: `Couldn't update item with id ${id}`, originalError: error2 });
|
|
@@ -199,8 +199,8 @@ function useProvideApi({
|
|
|
199
199
|
const deleteEntry = React.useCallback(
|
|
200
200
|
async (id) => {
|
|
201
201
|
try {
|
|
202
|
-
const response = await deleteItem.deleteItem(pathRef.current, convertId.convertId(id));
|
|
203
202
|
resetError();
|
|
203
|
+
const response = await deleteItem.deleteItem(pathRef.current, convertId.convertId(id));
|
|
204
204
|
return response;
|
|
205
205
|
} catch (error2) {
|
|
206
206
|
setError({ message: `Couldn't delete item with id ${id}`, originalError: error2 });
|
|
@@ -214,8 +214,8 @@ function useProvideApi({
|
|
|
214
214
|
const download = React.useCallback(
|
|
215
215
|
async (label, { export_mode, delimiter, quotechar } = {}) => {
|
|
216
216
|
try {
|
|
217
|
-
await downloadItems.downloadItems(pathRef.current, queryParamsRef.current, { label, export_mode, delimiter, quotechar });
|
|
218
217
|
resetError();
|
|
218
|
+
await downloadItems.downloadItems(pathRef.current, queryParamsRef.current, { label, export_mode, delimiter, quotechar });
|
|
219
219
|
} catch (error2) {
|
|
220
220
|
setError({ message: `Couldn't download`, originalError: error2 });
|
|
221
221
|
if (throwOnError) {
|
|
@@ -228,8 +228,8 @@ function useProvideApi({
|
|
|
228
228
|
const upload = React.useCallback(
|
|
229
229
|
async (file, { delimiter, quotechar } = {}) => {
|
|
230
230
|
try {
|
|
231
|
-
const response = await uploadItems.uploadItems(pathRef.current, file, { delimiter, quotechar });
|
|
232
231
|
resetError();
|
|
232
|
+
const response = await uploadItems.uploadItems(pathRef.current, file, { delimiter, quotechar });
|
|
233
233
|
return response;
|
|
234
234
|
} catch (error2) {
|
|
235
235
|
setError({ message: `Couldn't upload`, originalError: error2 });
|
|
@@ -5,26 +5,23 @@ const postBulkAction = require("../utils/bulkActions/postBulkAction.cjs");
|
|
|
5
5
|
const useProvideBulk = ({ path }) => {
|
|
6
6
|
const [selectedIds, setSelectedIds] = React.useState([]);
|
|
7
7
|
const [error, setError] = React.useState();
|
|
8
|
+
const resetError = React.useCallback(() => setError(void 0), []);
|
|
8
9
|
const dispatchBulkActions = React.useCallback(
|
|
9
10
|
async (handler, data) => {
|
|
10
11
|
try {
|
|
12
|
+
resetError();
|
|
11
13
|
if (data === void 0) {
|
|
12
14
|
data = selectedIds;
|
|
13
15
|
}
|
|
14
16
|
const response = await postBulkAction.postBulk(path, handler, data);
|
|
15
|
-
setError(void 0);
|
|
16
17
|
return response;
|
|
17
18
|
} catch (error2) {
|
|
18
19
|
setError({ message: `Couldn't perform bulk action`, originalError: error2 });
|
|
19
20
|
}
|
|
20
21
|
},
|
|
21
|
-
[path, selectedIds]
|
|
22
|
+
[path, resetError, selectedIds]
|
|
22
23
|
);
|
|
23
24
|
const bulkActions = React.useMemo(() => ({ selectedIds, setSelectedIds }), [selectedIds, setSelectedIds]);
|
|
24
|
-
return {
|
|
25
|
-
bulkActions,
|
|
26
|
-
dispatchBulkActions,
|
|
27
|
-
error
|
|
28
|
-
};
|
|
25
|
+
return { bulkActions, dispatchBulkActions, error, resetError };
|
|
29
26
|
};
|
|
30
27
|
exports.useProvideBulk = useProvideBulk;
|
|
@@ -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));
|
|
@@ -13,31 +13,32 @@ function useProvideAuth(baseURL, authQueryProps) {
|
|
|
13
13
|
retry: false,
|
|
14
14
|
...authQueryProps
|
|
15
15
|
});
|
|
16
|
-
const [error, setError] = React.useState(
|
|
16
|
+
const [error, setError] = React.useState();
|
|
17
|
+
const resetError = React.useCallback(() => setError(void 0), []);
|
|
17
18
|
const signin = React.useCallback(
|
|
18
19
|
({ username, password }) => {
|
|
19
|
-
|
|
20
|
+
resetError();
|
|
20
21
|
authFetch.authSignin(baseURL, { username, password }).then(() => queryClient.invalidateQueries({ queryKey: ["user"] })).catch((err) => setError(err));
|
|
21
22
|
},
|
|
22
|
-
[baseURL, queryClient]
|
|
23
|
+
[baseURL, queryClient, resetError]
|
|
23
24
|
);
|
|
24
25
|
const signout = React.useCallback(() => {
|
|
25
|
-
|
|
26
|
+
resetError();
|
|
26
27
|
authFetch.authSignout(baseURL).then(() => queryClient.resetQueries({ queryKey: ["user"] })).then(() => queryClient.resetQueries({ queryKey: ["info"] })).catch((err) => setError(err));
|
|
27
|
-
}, [baseURL, queryClient]);
|
|
28
|
+
}, [baseURL, queryClient, resetError]);
|
|
28
29
|
const update = React.useCallback(
|
|
29
30
|
(data) => {
|
|
30
|
-
|
|
31
|
+
resetError();
|
|
31
32
|
userCRUD.updateUser(baseURL, data).then(() => queryClient.invalidateQueries({ queryKey: ["user"] })).catch((err) => setError(err));
|
|
32
33
|
},
|
|
33
|
-
[baseURL, queryClient]
|
|
34
|
+
[baseURL, queryClient, resetError]
|
|
34
35
|
);
|
|
35
36
|
const resetPassword = React.useCallback(
|
|
36
37
|
(password) => {
|
|
37
|
-
|
|
38
|
+
resetError();
|
|
38
39
|
authFetch.authResetPassword(baseURL, password, query.data).catch((err) => setError(err));
|
|
39
40
|
},
|
|
40
|
-
[baseURL, query.data]
|
|
41
|
+
[baseURL, query.data, resetError]
|
|
41
42
|
);
|
|
42
43
|
const oauth_signin = React.useCallback(
|
|
43
44
|
(provider, popup) => authFetch.authOAuthSignin(baseURL, provider, popup, () => queryClient.invalidateQueries({ queryKey: ["user"] })),
|
|
@@ -52,7 +53,8 @@ function useProvideAuth(baseURL, authQueryProps) {
|
|
|
52
53
|
update,
|
|
53
54
|
resetPassword,
|
|
54
55
|
oauth_signin,
|
|
55
|
-
refetch: query.refetch
|
|
56
|
+
refetch: query.refetch,
|
|
57
|
+
resetError
|
|
56
58
|
};
|
|
57
59
|
}
|
|
58
60
|
exports.useProvideAuth = useProvideAuth;
|
|
@@ -83,9 +83,9 @@ function useFabProvideApi({
|
|
|
83
83
|
}),
|
|
84
84
|
[streamingMode]
|
|
85
85
|
);
|
|
86
|
-
const [error, setError] = React.useState(
|
|
86
|
+
const [error, setError] = React.useState();
|
|
87
87
|
const memoizedError = React.useMemo(() => error, [error]);
|
|
88
|
-
const resetError = React.useCallback(() => setError(
|
|
88
|
+
const resetError = React.useCallback(() => setError(void 0), []);
|
|
89
89
|
const {
|
|
90
90
|
data: info,
|
|
91
91
|
isFetching: infoLoading,
|
|
@@ -144,8 +144,8 @@ function useFabProvideApi({
|
|
|
144
144
|
const getEntry = React.useCallback(
|
|
145
145
|
async (id) => {
|
|
146
146
|
try {
|
|
147
|
-
const response = await getItem.getItem(pathRef.current, convertId.convertId(id));
|
|
148
147
|
resetError();
|
|
148
|
+
const response = await getItem.getItem(pathRef.current, convertId.convertId(id));
|
|
149
149
|
return response;
|
|
150
150
|
} catch (error2) {
|
|
151
151
|
setError({ message: `Couldn't fetch item with id ${id}`, originalError: error2 });
|
|
@@ -159,8 +159,8 @@ function useFabProvideApi({
|
|
|
159
159
|
const addEntry = React.useCallback(
|
|
160
160
|
async (item) => {
|
|
161
161
|
try {
|
|
162
|
-
const response = await createItem.createItem(pathRef.current, item);
|
|
163
162
|
resetError();
|
|
163
|
+
const response = await createItem.createItem(pathRef.current, item);
|
|
164
164
|
return response;
|
|
165
165
|
} catch (error2) {
|
|
166
166
|
setError({ message: `Couldn't add item`, originalError: error2 });
|
|
@@ -174,8 +174,8 @@ function useFabProvideApi({
|
|
|
174
174
|
const updateEntry = React.useCallback(
|
|
175
175
|
async (id, item) => {
|
|
176
176
|
try {
|
|
177
|
-
const response = await updateItem.updateItem(pathRef.current, convertId.convertId(id), item);
|
|
178
177
|
resetError();
|
|
178
|
+
const response = await updateItem.updateItem(pathRef.current, convertId.convertId(id), item);
|
|
179
179
|
return response;
|
|
180
180
|
} catch (error2) {
|
|
181
181
|
setError({ message: `Couldn't update item with id ${id}`, originalError: error2 });
|
|
@@ -189,8 +189,8 @@ function useFabProvideApi({
|
|
|
189
189
|
const deleteEntry = React.useCallback(
|
|
190
190
|
async (id) => {
|
|
191
191
|
try {
|
|
192
|
-
const response = await deleteItem.deleteItem(pathRef.current, convertId.convertId(id));
|
|
193
192
|
resetError();
|
|
193
|
+
const response = await deleteItem.deleteItem(pathRef.current, convertId.convertId(id));
|
|
194
194
|
return response;
|
|
195
195
|
} catch (error2) {
|
|
196
196
|
setError({ message: `Couldn't delete item with id ${id}`, originalError: error2 });
|
|
@@ -204,8 +204,8 @@ function useFabProvideApi({
|
|
|
204
204
|
const download = React.useCallback(
|
|
205
205
|
async (label, { export_mode, delimiter, quotechar } = {}) => {
|
|
206
206
|
try {
|
|
207
|
-
await downloadItems.downloadItems(pathRef.current, queryParamsRef.current, { label, export_mode, delimiter, quotechar });
|
|
208
207
|
resetError();
|
|
208
|
+
await downloadItems.downloadItems(pathRef.current, queryParamsRef.current, { label, export_mode, delimiter, quotechar });
|
|
209
209
|
} catch (error2) {
|
|
210
210
|
setError({ message: `Couldn't download`, originalError: error2 });
|
|
211
211
|
if (throwOnError) {
|
|
@@ -218,8 +218,8 @@ function useFabProvideApi({
|
|
|
218
218
|
const upload = React.useCallback(
|
|
219
219
|
async (file, { delimiter, quotechar } = {}) => {
|
|
220
220
|
try {
|
|
221
|
-
const response = await uploadItems.uploadItems(pathRef.current, file, { delimiter, quotechar });
|
|
222
221
|
resetError();
|
|
222
|
+
const response = await uploadItems.uploadItems(pathRef.current, file, { delimiter, quotechar });
|
|
223
223
|
return response;
|
|
224
224
|
} catch (error2) {
|
|
225
225
|
setError({ message: `Couldn't upload`, originalError: error2 });
|
|
@@ -5,26 +5,23 @@ const postBulkAction = require("../utils/bulkActions/postBulkAction.cjs");
|
|
|
5
5
|
const useFabProvideBulk = ({ path }) => {
|
|
6
6
|
const [selectedIds, setSelectedIds] = React.useState([]);
|
|
7
7
|
const [error, setError] = React.useState();
|
|
8
|
+
const resetError = React.useCallback(() => setError(void 0), []);
|
|
8
9
|
const dispatchBulkActions = React.useCallback(
|
|
9
10
|
async (handler, data) => {
|
|
10
11
|
try {
|
|
12
|
+
resetError();
|
|
11
13
|
if (data === void 0) {
|
|
12
14
|
data = selectedIds;
|
|
13
15
|
}
|
|
14
16
|
const response = await postBulkAction.postBulk(path, handler, data);
|
|
15
|
-
setError(void 0);
|
|
16
17
|
return response;
|
|
17
18
|
} catch (error2) {
|
|
18
19
|
setError({ message: `Couldn't perform bulk action`, originalError: error2 });
|
|
19
20
|
}
|
|
20
21
|
},
|
|
21
|
-
[path, selectedIds]
|
|
22
|
+
[path, resetError, selectedIds]
|
|
22
23
|
);
|
|
23
24
|
const bulkActions = React.useMemo(() => ({ selectedIds, setSelectedIds }), [selectedIds, setSelectedIds]);
|
|
24
|
-
return {
|
|
25
|
-
bulkActions,
|
|
26
|
-
dispatchBulkActions,
|
|
27
|
-
error
|
|
28
|
-
};
|
|
25
|
+
return { bulkActions, dispatchBulkActions, error, resetError };
|
|
29
26
|
};
|
|
30
27
|
exports.useFabProvideBulk = useFabProvideBulk;
|
|
@@ -13,31 +13,32 @@ function useFabProvideAuth(baseURL, authQueryProps) {
|
|
|
13
13
|
retry: false,
|
|
14
14
|
...authQueryProps
|
|
15
15
|
});
|
|
16
|
-
const [error, setError] = React.useState(
|
|
16
|
+
const [error, setError] = React.useState();
|
|
17
|
+
const resetError = React.useCallback(() => setError(void 0), []);
|
|
17
18
|
const signin = React.useCallback(
|
|
18
19
|
({ username, password }) => {
|
|
19
|
-
|
|
20
|
+
resetError();
|
|
20
21
|
authFetch.authSignin(baseURL, { username, password }).then(() => queryClient.invalidateQueries({ queryKey: ["user"] })).catch((err) => setError(err));
|
|
21
22
|
},
|
|
22
|
-
[baseURL, queryClient]
|
|
23
|
+
[baseURL, queryClient, resetError]
|
|
23
24
|
);
|
|
24
25
|
const signout = React.useCallback(() => {
|
|
25
|
-
|
|
26
|
+
resetError();
|
|
26
27
|
authFetch.authSignout(baseURL).then(() => queryClient.resetQueries({ queryKey: ["user"] })).then(() => queryClient.resetQueries({ queryKey: ["info"] })).catch((err) => setError(err));
|
|
27
|
-
}, [baseURL, queryClient]);
|
|
28
|
+
}, [baseURL, queryClient, resetError]);
|
|
28
29
|
const update = React.useCallback(
|
|
29
30
|
(data) => {
|
|
30
|
-
|
|
31
|
+
resetError();
|
|
31
32
|
userCRUD.updateUser(baseURL, data).then(() => queryClient.invalidateQueries({ queryKey: ["user"] })).catch((err) => setError(err));
|
|
32
33
|
},
|
|
33
|
-
[baseURL, queryClient]
|
|
34
|
+
[baseURL, queryClient, resetError]
|
|
34
35
|
);
|
|
35
36
|
const resetPassword = React.useCallback(
|
|
36
37
|
(password) => {
|
|
37
|
-
|
|
38
|
+
resetError();
|
|
38
39
|
authFetch.authResetPassword(baseURL, password, query.data).catch((err) => setError(err));
|
|
39
40
|
},
|
|
40
|
-
[baseURL, query.data]
|
|
41
|
+
[baseURL, query.data, resetError]
|
|
41
42
|
);
|
|
42
43
|
const oauth_signin = React.useCallback(
|
|
43
44
|
(provider, popup) => authFetch.authOAuthSignin(baseURL, provider, popup, () => queryClient.invalidateQueries({ queryKey: ["user"] })),
|
|
@@ -52,7 +53,8 @@ function useFabProvideAuth(baseURL, authQueryProps) {
|
|
|
52
53
|
update,
|
|
53
54
|
resetPassword,
|
|
54
55
|
oauth_signin,
|
|
55
|
-
refetch: query.refetch
|
|
56
|
+
refetch: query.refetch,
|
|
57
|
+
resetError
|
|
56
58
|
};
|
|
57
59
|
}
|
|
58
60
|
exports.useFabProvideAuth = useFabProvideAuth;
|
|
@@ -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;
|
|
@@ -2,7 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useProps, Box, Flex, ActionIcon, Divider, Text, ScrollArea, Button, Group } from "@mantine/core";
|
|
3
3
|
import { useForm } from "@mantine/form";
|
|
4
4
|
import { randomId } from "@mantine/hooks";
|
|
5
|
-
import { yupResolver } from "../../../../../../.external/esm/mantine-form-yup-resolver@2.0.0_@mantine_form@8.
|
|
5
|
+
import { yupResolver } from "../../../../../../.external/esm/mantine-form-yup-resolver@2.0.0_@mantine_form@8.2.1_yup@1.6.1/mantine-form-yup-resolver/dist/esm/index.mjs";
|
|
6
6
|
import { useEffect } from "react";
|
|
7
7
|
import { object as create$3, array as create$2, mixed as create$8, string as create$6 } from "../../../../../../.external/esm/yup@1.6.1/yup/index.esm.mjs";
|
|
8
8
|
import { useApi } from "../../../../hooks/api/useApi.mjs";
|
|
@@ -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
|