fastapi-rtk 0.2.36 → 0.2.37
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/.external/esm/@tanstack_query-core@5.87.1/@tanstack/query-core/build/modern/query.mjs +1 -1
- package/dist/core/cjs/ActionIcons/View/View.cjs +5 -9
- package/dist/core/cjs/{ActionIcons/Add → Dialogs}/AddDialog.cjs +7 -7
- package/dist/core/cjs/{ActionIcons/Delete → Dialogs}/DeleteDialog.cjs +4 -4
- package/dist/core/cjs/{ActionIcons/Edit → Dialogs}/EditDialog.cjs +10 -10
- package/dist/core/cjs/Dialogs/ViewDialog.cjs +50 -0
- package/dist/core/cjs/{ActionIcons/Modals → Modals}/CommonModal.cjs +4 -4
- package/dist/core/cjs/Tables/DataGrid/DataGrid.cjs +7 -3
- package/dist/core/cjs/Tables/NextGenDataGrid/NextGenDataGrid.cjs +9 -7
- package/dist/core/cjs/Wrappers/ApiProvider/ApiProvider.cjs +3 -1
- package/dist/core/cjs/Wrappers/ApiProvider/Contexts/FormContext.cjs +5 -0
- package/dist/core/cjs/hooks/api/useForms.cjs +3 -1
- package/dist/core/cjs/index.cjs +16 -8
- package/dist/core/esm/ActionIcons/View/View.mjs +7 -11
- package/dist/core/esm/{ActionIcons/Add → Dialogs}/AddDialog.mjs +7 -7
- package/dist/core/esm/{ActionIcons/Delete → Dialogs}/DeleteDialog.mjs +4 -4
- package/dist/core/esm/{ActionIcons/Edit → Dialogs}/EditDialog.mjs +10 -10
- package/dist/core/esm/Dialogs/ViewDialog.mjs +50 -0
- package/dist/core/esm/{ActionIcons/Modals → Modals}/CommonModal.mjs +4 -4
- package/dist/core/esm/Tables/DataGrid/DataGrid.mjs +7 -3
- package/dist/core/esm/Tables/NextGenDataGrid/NextGenDataGrid.mjs +9 -7
- package/dist/core/esm/Wrappers/ApiProvider/ApiProvider.mjs +4 -2
- package/dist/core/esm/Wrappers/ApiProvider/Contexts/FormContext.mjs +6 -1
- package/dist/core/esm/hooks/api/useForms.mjs +4 -2
- package/dist/core/esm/index.mjs +13 -5
- package/dist/core/lib/ActionIcons/View/{ViewDialog.d.ts → Unused.d.ts} +1 -1
- package/dist/core/lib/{ActionIcons/Add → Dialogs}/AddDialog.d.ts +12 -2
- package/dist/core/lib/{ActionIcons/Delete → Dialogs}/DeleteDialog.d.ts +3 -1
- package/dist/core/lib/{ActionIcons/Edit → Dialogs}/EditDialog.d.ts +17 -9
- package/dist/core/lib/Dialogs/ViewDialog.d.ts +169 -0
- package/dist/core/lib/Dialogs/index.d.ts +4 -0
- package/dist/core/lib/{ActionIcons/Modals → Modals}/CommonModal.d.ts +4 -4
- package/dist/core/lib/Modals/index.d.ts +3 -0
- package/dist/core/lib/Wrappers/ApiProvider/Contexts/FormContext.d.ts +5 -0
- package/dist/core/lib/hooks/api/useForms.d.ts +1 -1
- package/dist/core/lib/index.d.ts +4 -6
- package/dist/core/styles.css +19 -19
- package/package.json +1 -1
- package/dist/core/cjs/ActionIcons/View/RelationPanel.cjs +0 -17
- package/dist/core/cjs/ActionIcons/View/ViewDialog.cjs +0 -54
- package/dist/core/esm/ActionIcons/View/RelationPanel.mjs +0 -18
- package/dist/core/esm/ActionIcons/View/ViewDialog.mjs +0 -54
- /package/dist/core/cjs/{ActionIcons/Modals → Modals}/normalProps.cjs +0 -0
- /package/dist/core/cjs/{ActionIcons/Modals → Modals}/overlayProps.cjs +0 -0
- /package/dist/core/esm/{ActionIcons/Modals → Modals}/normalProps.mjs +0 -0
- /package/dist/core/esm/{ActionIcons/Modals → Modals}/overlayProps.mjs +0 -0
- /package/dist/core/lib/{ActionIcons/Modals → Modals}/normalProps.d.ts +0 -0
- /package/dist/core/lib/{ActionIcons/Modals → Modals}/overlayProps.d.ts +0 -0
|
@@ -5,9 +5,10 @@ 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._v6brefjjgmgbqbolvm3v6bkbsa/mantine-react-table/dist/index.esm.mjs";
|
|
7
7
|
import { forwardRef, useMemo, useEffect } from "react";
|
|
8
|
-
import { AddDialog } from "../../
|
|
9
|
-
import { DeleteDialog } from "../../
|
|
10
|
-
import { EditDialog } from "../../
|
|
8
|
+
import { AddDialog } from "../../Dialogs/AddDialog.mjs";
|
|
9
|
+
import { DeleteDialog } from "../../Dialogs/DeleteDialog.mjs";
|
|
10
|
+
import { EditDialog } from "../../Dialogs/EditDialog.mjs";
|
|
11
|
+
import { ViewDialog } from "../../Dialogs/ViewDialog.mjs";
|
|
11
12
|
import { LazyLoadWrapper } from "../../Wrappers/LazyLoadWrapper/LazyLoadWrapper.mjs";
|
|
12
13
|
import { useApi } from "../../hooks/api/useApi.mjs";
|
|
13
14
|
import { useForms } from "../../hooks/api/useForms.mjs";
|
|
@@ -27,7 +28,7 @@ import { useToolbar } from "./hooks/useToolbar/useToolbar.mjs";
|
|
|
27
28
|
import { useToolbarAlertBanner } from "./hooks/useToolbarAlertBanner/useToolbarAlertBanner.mjs";
|
|
28
29
|
const baseProps = { enableStickyHeader: true, enableColumnPinning: true };
|
|
29
30
|
const NextGenDataGrid = forwardRef((props, ref) => {
|
|
30
|
-
var _a, _b, _c, _d;
|
|
31
|
+
var _a, _b, _c, _d, _e;
|
|
31
32
|
const { info, data, queryParams, setQueryParams, refetch, specialKey } = useApi();
|
|
32
33
|
const propsFromMantineTheme = useProps("NextGenDataGrid", {}, {});
|
|
33
34
|
const {
|
|
@@ -221,9 +222,10 @@ const NextGenDataGrid = forwardRef((props, ref) => {
|
|
|
221
222
|
}, []);
|
|
222
223
|
return /* @__PURE__ */ jsxs(Box, { pos: "relative", h: "100%", w: "100%", mih: 0, flex: 1, ...wrapperProps, children: [
|
|
223
224
|
/* @__PURE__ */ jsxs(LazyLoadWrapper, { cond: !!info, children: [
|
|
224
|
-
/* @__PURE__ */ jsx(
|
|
225
|
-
/* @__PURE__ */ jsx(
|
|
226
|
-
/* @__PURE__ */ jsx(
|
|
225
|
+
/* @__PURE__ */ jsx(ViewDialog, { ...(_b = form == null ? void 0 : form.view) == null ? void 0 : _b.dialogProps }),
|
|
226
|
+
/* @__PURE__ */ jsx(AddDialog, { jsonForms: form == null ? void 0 : form.add, ...(_c = form == null ? void 0 : form.add) == null ? void 0 : _c.dialogProps }),
|
|
227
|
+
/* @__PURE__ */ jsx(EditDialog, { jsonForms: form == null ? void 0 : form.edit, ...(_d = form == null ? void 0 : form.edit) == null ? void 0 : _d.dialogProps }),
|
|
228
|
+
/* @__PURE__ */ jsx(DeleteDialog, { ...(_e = form == null ? void 0 : form.delete) == null ? void 0 : _e.dialogProps })
|
|
227
229
|
] }),
|
|
228
230
|
/* @__PURE__ */ jsx(MantineReactTable, { table: mrtTable, ...rest }),
|
|
229
231
|
children == null ? void 0 : children({ table: mrtTable }),
|
|
@@ -7,7 +7,7 @@ import { defaultBulk } from "../../fab-react-toolkit-patch/api/hooks/useProvideB
|
|
|
7
7
|
import { useInfo } from "../../hooks/auth/useInfo.mjs";
|
|
8
8
|
import { ApiContextProvider } from "./Contexts/ApiContext.mjs";
|
|
9
9
|
import { BulkActionsContextProvider } from "./Contexts/BulkActionsContext.mjs";
|
|
10
|
-
import { FormContextAddProvider, FormContextEditProvider, FormContextDeleteProvider } from "./Contexts/FormContext.mjs";
|
|
10
|
+
import { FormContextViewProvider, FormContextAddProvider, FormContextEditProvider, FormContextDeleteProvider } 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";
|
|
@@ -46,13 +46,15 @@ function ApiProvider({
|
|
|
46
46
|
const apiProxy = useProxy(api);
|
|
47
47
|
const bulkActions = useProvideBulk(apiProxy, bulkParams);
|
|
48
48
|
const bulkActionsProxy = useProxy(bulkActions);
|
|
49
|
+
const formView = useProvideForm();
|
|
50
|
+
const [formViewProxy] = useState(() => createProxy(formView));
|
|
49
51
|
const formAdd = useProvideForm();
|
|
50
52
|
const [formAddProxy] = useState(() => createProxy(formAdd));
|
|
51
53
|
const formEdit = useProvideForm();
|
|
52
54
|
const [formEditProxy] = useState(() => createProxy(formEdit));
|
|
53
55
|
const formDelete = useProvideForm();
|
|
54
56
|
const [formDeleteProxy] = useState(() => createProxy(formDelete));
|
|
55
|
-
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: /* @__PURE__ */ jsx(FormContextDeleteProvider, { value: formDeleteProxy, children }) }) }) }) });
|
|
57
|
+
return /* @__PURE__ */ jsx(ApiContextProvider, { value: apiProxy, children: /* @__PURE__ */ jsx(BulkActionsContextProvider, { value: bulkActionsProxy, children: /* @__PURE__ */ jsx(FormContextViewProvider, { value: formViewProxy, children: /* @__PURE__ */ jsx(FormContextAddProvider, { value: formAddProxy, children: /* @__PURE__ */ jsx(FormContextEditProvider, { value: formEditProxy, children: /* @__PURE__ */ jsx(FormContextDeleteProvider, { value: formDeleteProxy, children }) }) }) }) }) });
|
|
56
58
|
}
|
|
57
59
|
export {
|
|
58
60
|
ApiProvider
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { createSafeContext } from "fastapi-rtk/utils";
|
|
2
|
+
const [FormContextViewProvider, useFormViewProvider] = createSafeContext(
|
|
3
|
+
"useForms('view') must be used within an ApiProvider"
|
|
4
|
+
);
|
|
2
5
|
const [FormContextAddProvider, useFormAddProvider] = createSafeContext(
|
|
3
6
|
"useForms('add') must be used within an ApiProvider"
|
|
4
7
|
);
|
|
@@ -12,7 +15,9 @@ export {
|
|
|
12
15
|
FormContextAddProvider,
|
|
13
16
|
FormContextDeleteProvider,
|
|
14
17
|
FormContextEditProvider,
|
|
18
|
+
FormContextViewProvider,
|
|
15
19
|
useFormAddProvider,
|
|
16
20
|
useFormDeleteProvider,
|
|
17
|
-
useFormEditProvider
|
|
21
|
+
useFormEditProvider,
|
|
22
|
+
useFormViewProvider
|
|
18
23
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { useFormDeleteProvider, useFormEditProvider, useFormAddProvider } from "../../Wrappers/ApiProvider/Contexts/FormContext.mjs";
|
|
1
|
+
import { useFormDeleteProvider, useFormEditProvider, useFormAddProvider, useFormViewProvider } from "../../Wrappers/ApiProvider/Contexts/FormContext.mjs";
|
|
2
2
|
const useForms = (type, options) => {
|
|
3
3
|
switch (type) {
|
|
4
|
+
case "view":
|
|
5
|
+
return useFormViewProvider(options);
|
|
4
6
|
case "add":
|
|
5
7
|
return useFormAddProvider(options);
|
|
6
8
|
case "edit":
|
|
@@ -8,7 +10,7 @@ const useForms = (type, options) => {
|
|
|
8
10
|
case "delete":
|
|
9
11
|
return useFormDeleteProvider(options);
|
|
10
12
|
default:
|
|
11
|
-
throw new Error(`useForms: Unknown form type '${type}'. Expected 'add', 'edit', or 'delete'.`);
|
|
13
|
+
throw new Error(`useForms: Unknown form type '${type}'. Expected 'view', 'add', 'edit', or 'delete'.`);
|
|
12
14
|
}
|
|
13
15
|
};
|
|
14
16
|
export {
|
package/dist/core/esm/index.mjs
CHANGED
|
@@ -6,17 +6,21 @@ import { Edit } from "./ActionIcons/Edit/Edit.mjs";
|
|
|
6
6
|
import { Refresh } from "./ActionIcons/Refresh/Refresh.mjs";
|
|
7
7
|
import { Upload } from "./ActionIcons/Upload/Upload.mjs";
|
|
8
8
|
import { View } from "./ActionIcons/View/View.mjs";
|
|
9
|
+
import { AddDialog } from "./Dialogs/AddDialog.mjs";
|
|
10
|
+
import { DeleteDialog } from "./Dialogs/DeleteDialog.mjs";
|
|
11
|
+
import { EditDialog } from "./Dialogs/EditDialog.mjs";
|
|
12
|
+
import { TabsDisplay, ViewDialog } from "./Dialogs/ViewDialog.mjs";
|
|
9
13
|
import { useApi } from "./hooks/api/useApi.mjs";
|
|
10
14
|
import { useBulkActions } from "./hooks/api/useBulkActions.mjs";
|
|
11
15
|
import { useForms } from "./hooks/api/useForms.mjs";
|
|
12
16
|
import { useAuth } from "./hooks/auth/useAuth.mjs";
|
|
13
17
|
import { useInfo } from "./hooks/auth/useInfo.mjs";
|
|
18
|
+
import { useLang } from "./hooks/lang/useLang.mjs";
|
|
14
19
|
import { UserMenu } from "./Menu/UserMenu/UserMenu.mjs";
|
|
15
20
|
import { LanguageSelector } from "./Selectors/LanguageSelector.mjs";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { ViewDialog } from "./ActionIcons/View/ViewDialog.mjs";
|
|
21
|
+
import { CommonModal } from "./Modals/CommonModal.mjs";
|
|
22
|
+
import { normalProps } from "./Modals/normalProps.mjs";
|
|
23
|
+
import { overlayProps } from "./Modals/overlayProps.mjs";
|
|
20
24
|
import { DataGrid, DataGrid as DataGrid2 } from "./Tables/DataGrid/DataGrid.mjs";
|
|
21
25
|
import { NextGenDataGrid, NextGenDataGrid as NextGenDataGrid2, NextGenDataGrid as NextGenDataGrid3, NextGenDataGrid as NextGenDataGrid4 } from "./Tables/NextGenDataGrid/NextGenDataGrid.mjs";
|
|
22
26
|
import { ApiProvider } from "./Wrappers/ApiProvider/ApiProvider.mjs";
|
|
@@ -28,7 +32,6 @@ export * from "fastapi-rtk/constants";
|
|
|
28
32
|
export * from "fastapi-rtk/hooks";
|
|
29
33
|
export * from "fastapi-rtk/utils";
|
|
30
34
|
export * from "fastapi-rtk/zustand";
|
|
31
|
-
import "./Wrappers/Provider/Contexts/LangContext.mjs";
|
|
32
35
|
import { Filter } from "./Tables/DataGrid/Toolbar/Filter/Filter.mjs";
|
|
33
36
|
import { useTranslation } from "../../.external/esm/react-i18next@15.7.3_i18next@25.5.2_react-dom@18.3.1_react@18.3.1_typescript@5.9.2/react-i18next/dist/es/useTranslation.mjs";
|
|
34
37
|
export {
|
|
@@ -40,6 +43,7 @@ export {
|
|
|
40
43
|
DataGrid,
|
|
41
44
|
DataGrid2 as Datagrid,
|
|
42
45
|
Delete,
|
|
46
|
+
DeleteDialog,
|
|
43
47
|
Download,
|
|
44
48
|
Edit,
|
|
45
49
|
EditDialog,
|
|
@@ -53,14 +57,18 @@ export {
|
|
|
53
57
|
NextGenDataGrid4 as Nextgendatagrid,
|
|
54
58
|
Provider,
|
|
55
59
|
Refresh,
|
|
60
|
+
TabsDisplay,
|
|
56
61
|
Upload,
|
|
57
62
|
UserMenu,
|
|
58
63
|
View,
|
|
59
64
|
ViewDialog,
|
|
65
|
+
normalProps,
|
|
66
|
+
overlayProps,
|
|
60
67
|
useApi,
|
|
61
68
|
useAuth,
|
|
62
69
|
useBulkActions,
|
|
63
70
|
useForms,
|
|
64
71
|
useInfo,
|
|
72
|
+
useLang,
|
|
65
73
|
useTranslation
|
|
66
74
|
};
|
|
@@ -31,6 +31,10 @@
|
|
|
31
31
|
* @property {CommonModalTitleOptionsProps} [titleOptions] - Options for customizing the title area, such as toggles for full screen and overlay modes.
|
|
32
32
|
* @property {CommonModalActionButtonsProps} [actionButtons] - Options for customizing the action buttons area.
|
|
33
33
|
* @property {Record<string, any>} rest - Additional props to be passed to the Modal component.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* @typedef {Object} AddDialogProps
|
|
37
|
+
* @property {Record<string, any>} [jsonForms] - Additional JSON Forms customization options.
|
|
34
38
|
* @property {(result: Record<string, any> | null) => void} [onSuccess] - Callback function triggered on successful form submission.
|
|
35
39
|
* @property {(error: any) => void} [onError] - Callback function triggered on form submission error.
|
|
36
40
|
*/
|
|
@@ -41,10 +45,10 @@
|
|
|
41
45
|
* view modes, and loading state via custom hooks. The component also manages the merge
|
|
42
46
|
* of default JSON Forms settings with any additional props provided.
|
|
43
47
|
*
|
|
44
|
-
* @param {CommonModalProps} props - The properties
|
|
48
|
+
* @param {AddDialogProps & CommonModalProps} props - The properties for the AddDialog component.
|
|
45
49
|
* @returns {JSX.Element} The rendered modal dialog component for adding an entry.
|
|
46
50
|
*/
|
|
47
|
-
export function AddDialog({ jsonForms: __jsonForms, onSuccess, onError, ...props }: CommonModalProps): JSX.Element;
|
|
51
|
+
export function AddDialog({ jsonForms: __jsonForms, onSuccess, onError, ...props }: AddDialogProps & CommonModalProps): JSX.Element;
|
|
48
52
|
export type CommonModalTitleOptionsProps = {
|
|
49
53
|
/**
|
|
50
54
|
* - Content or function to render on the left side of the title.
|
|
@@ -162,6 +166,12 @@ export type CommonModalProps = {
|
|
|
162
166
|
* - Additional props to be passed to the Modal component.
|
|
163
167
|
*/
|
|
164
168
|
rest: Record<string, any>;
|
|
169
|
+
};
|
|
170
|
+
export type AddDialogProps = {
|
|
171
|
+
/**
|
|
172
|
+
* - Additional JSON Forms customization options.
|
|
173
|
+
*/
|
|
174
|
+
jsonForms?: Record<string, any>;
|
|
165
175
|
/**
|
|
166
176
|
* - Callback function triggered on successful form submission.
|
|
167
177
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function DeleteDialog({ onSuccess, onError, ...props }: CommonModalProps): JSX.Element;
|
|
1
|
+
export function DeleteDialog({ onSuccess, onError, ...props }: DeleteDialogProps & CommonModalProps): JSX.Element;
|
|
2
2
|
export type CommonModalTitleOptionsProps = {
|
|
3
3
|
/**
|
|
4
4
|
* - Content or function to render on the left side of the title.
|
|
@@ -116,6 +116,8 @@ export type CommonModalProps = {
|
|
|
116
116
|
* - Additional props to be passed to the Modal component.
|
|
117
117
|
*/
|
|
118
118
|
rest: Record<string, any>;
|
|
119
|
+
};
|
|
120
|
+
export type DeleteDialogProps = {
|
|
119
121
|
/**
|
|
120
122
|
* - Callback function triggered on successful form submission.
|
|
121
123
|
*/
|
|
@@ -31,22 +31,24 @@
|
|
|
31
31
|
* @property {CommonModalTitleOptionsProps} [titleOptions] - Options for customizing the title area, such as toggles for full screen and overlay modes.
|
|
32
32
|
* @property {CommonModalActionButtonsProps} [actionButtons] - Options for customizing the action buttons area.
|
|
33
33
|
* @property {Record<string, any>} rest - Additional props to be passed to the Modal component.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* @typedef {Object} EditDialogProps
|
|
37
|
+
* @property {Record<string, any>} [jsonForms] - Additional JSON Forms customization options.
|
|
34
38
|
* @property {(result: Record<string, any> | null) => void} [onSuccess] - Callback function triggered on successful form submission.
|
|
35
39
|
* @property {(error: any) => void} [onError] - Callback function triggered on form submission error.
|
|
36
40
|
*/
|
|
37
41
|
/**
|
|
38
|
-
* EditDialog component renders a modal dialog for editing an entry.
|
|
42
|
+
* EditDialog is a component that renders a modal dialog for editing an existing entry.
|
|
39
43
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* a refetch of data and related information.
|
|
44
|
+
* It integrates with the application's API to edit entries and manages form state,
|
|
45
|
+
* view modes, and loading state via custom hooks. The component also manages the merge
|
|
46
|
+
* of default JSON Forms settings with any additional props provided.
|
|
44
47
|
*
|
|
45
|
-
* @component
|
|
46
|
-
* @
|
|
47
|
-
* @returns {JSX.Element} The rendered EditDialog component.
|
|
48
|
+
* @param {EditDialogProps & CommonModalProps} props - The properties for the EditDialog component.
|
|
49
|
+
* @returns {JSX.Element} The rendered modal dialog component for editing an entry.
|
|
48
50
|
*/
|
|
49
|
-
export function EditDialog({ jsonForms: __jsonForms, onSuccess, onError, ...props }: CommonModalProps): JSX.Element;
|
|
51
|
+
export function EditDialog({ jsonForms: __jsonForms, onSuccess, onError, ...props }: EditDialogProps & CommonModalProps): JSX.Element;
|
|
50
52
|
export type CommonModalTitleOptionsProps = {
|
|
51
53
|
/**
|
|
52
54
|
* - Content or function to render on the left side of the title.
|
|
@@ -164,6 +166,12 @@ export type CommonModalProps = {
|
|
|
164
166
|
* - Additional props to be passed to the Modal component.
|
|
165
167
|
*/
|
|
166
168
|
rest: Record<string, any>;
|
|
169
|
+
};
|
|
170
|
+
export type EditDialogProps = {
|
|
171
|
+
/**
|
|
172
|
+
* - Additional JSON Forms customization options.
|
|
173
|
+
*/
|
|
174
|
+
jsonForms?: Record<string, any>;
|
|
167
175
|
/**
|
|
168
176
|
* - Callback function triggered on successful form submission.
|
|
169
177
|
*/
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} CommonModalTitleOptionsProps
|
|
3
|
+
* @property {React.ReactNode | ((props: { view: string; setView: (view: string) => void }) => React.ReactNode)} left - Content or function to render on the left side of the title.
|
|
4
|
+
* @property {React.ReactNode | ((props: { view: string; setView: (view: string) => void }) => React.ReactNode)} right - Content or function to render on the right side of the title.
|
|
5
|
+
* @property {boolean} [hideOverlay=false] - If true, hides the overlay toggle button.
|
|
6
|
+
* @property {boolean} [hideFullScreen=false] - If true, hides the full screen toggle button.
|
|
7
|
+
* @property {Record<string, any> | ((props: { view: string; setView: (view: string) => void }) => Record<string, any>)} [overlayButtonProps] - Additional props to be passed to the overlay toggle button.
|
|
8
|
+
* @property {Record<string, any> | ((props: { view: string; setView: (view: string) => void }) => Record<string, any>)} [fullScreenButtonProps] - Additional props to be passed to the full screen toggle button.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* @typedef {Object} CommonModalActionButtonsProps
|
|
12
|
+
* @property {Record<string, any>} [groupProps] - Additional properties to be passed to the Group component wrapping the buttons.
|
|
13
|
+
* @property {boolean} [withResetButton=true] - Flag to determine if the reset button should be displayed.
|
|
14
|
+
* @property {boolean} [withSubmitButton=true] - Flag to determine if the submit button should be displayed.
|
|
15
|
+
* @property {Record<string, any>} [resetButtonProps] - Additional properties to be passed to the reset Button component.
|
|
16
|
+
* @property {Record<string, any>} [submitButtonProps] - Additional properties to be passed to the submit Button component.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {Object} CommonModalProps
|
|
20
|
+
* @property {React.ReactNode} children - The content to be rendered inside the modal.
|
|
21
|
+
* @property {string} view - Current view mode (e.g., VIEW_MODE.NORMAL, VIEW_MODE.FULL_SCREEN, VIEW_MODE.OVERLAY).
|
|
22
|
+
* @property {Function} setView - Function to update the view mode.
|
|
23
|
+
* @property {Function} onReset - Callback function triggered on form reset.
|
|
24
|
+
* @property {Function} onSubmit - Callback function triggered on form submission.
|
|
25
|
+
* @property {Record<string, any>} boxProps - Additional properties to be passed to the Box component wrapping the form.
|
|
26
|
+
* @property {string} resetButtonText - Text displayed on the reset button.
|
|
27
|
+
* @property {string} buttonText - Text displayed on the submit button.
|
|
28
|
+
* @property {boolean} buttonLoading - Indicates whether the submit button should display a loading state.
|
|
29
|
+
* @property {boolean} [withTitleOptions=true] - Flag to determine if title options (e.g., full screen, overlay toggles) should be displayed.
|
|
30
|
+
* @property {boolean} [withButtons=true] - Flag to determine if action buttons (e.g., submit button) should be displayed.
|
|
31
|
+
* @property {CommonModalTitleOptionsProps} [titleOptions] - Options for customizing the title area, such as toggles for full screen and overlay modes.
|
|
32
|
+
* @property {CommonModalActionButtonsProps} [actionButtons] - Options for customizing the action buttons area.
|
|
33
|
+
* @property {Record<string, any>} rest - Additional props to be passed to the Modal component.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* ViewDialog is a component that renders a modal dialog for viewing an existing entry.
|
|
37
|
+
*
|
|
38
|
+
* It integrates with the application's API to fetch entry details and manages form state,
|
|
39
|
+
* view modes, and loading state via custom hooks. The component also manages the merge
|
|
40
|
+
* of default JSON Forms settings with any additional props provided.
|
|
41
|
+
*
|
|
42
|
+
* @param {CommonModalProps} props - The properties for the ViewDialog component.
|
|
43
|
+
* @returns {JSX.Element} The rendered modal dialog component for viewing an entry.
|
|
44
|
+
*/
|
|
45
|
+
export function ViewDialog({ ...props }: CommonModalProps): JSX.Element;
|
|
46
|
+
export function TabsDisplay({ columns, data, label_columns, gridProps }: {
|
|
47
|
+
columns: any;
|
|
48
|
+
data: any;
|
|
49
|
+
label_columns: any;
|
|
50
|
+
gridProps: any;
|
|
51
|
+
}): import("react").JSX.Element;
|
|
52
|
+
export type CommonModalTitleOptionsProps = {
|
|
53
|
+
/**
|
|
54
|
+
* - Content or function to render on the left side of the title.
|
|
55
|
+
*/
|
|
56
|
+
left: React.ReactNode | ((props: {
|
|
57
|
+
view: string;
|
|
58
|
+
setView: (view: string) => void;
|
|
59
|
+
}) => React.ReactNode);
|
|
60
|
+
/**
|
|
61
|
+
* - Content or function to render on the right side of the title.
|
|
62
|
+
*/
|
|
63
|
+
right: React.ReactNode | ((props: {
|
|
64
|
+
view: string;
|
|
65
|
+
setView: (view: string) => void;
|
|
66
|
+
}) => React.ReactNode);
|
|
67
|
+
/**
|
|
68
|
+
* - If true, hides the overlay toggle button.
|
|
69
|
+
*/
|
|
70
|
+
hideOverlay?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* - If true, hides the full screen toggle button.
|
|
73
|
+
*/
|
|
74
|
+
hideFullScreen?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* - Additional props to be passed to the overlay toggle button.
|
|
77
|
+
*/
|
|
78
|
+
overlayButtonProps?: Record<string, any> | ((props: {
|
|
79
|
+
view: string;
|
|
80
|
+
setView: (view: string) => void;
|
|
81
|
+
}) => Record<string, any>);
|
|
82
|
+
/**
|
|
83
|
+
* - Additional props to be passed to the full screen toggle button.
|
|
84
|
+
*/
|
|
85
|
+
fullScreenButtonProps?: Record<string, any> | ((props: {
|
|
86
|
+
view: string;
|
|
87
|
+
setView: (view: string) => void;
|
|
88
|
+
}) => Record<string, any>);
|
|
89
|
+
};
|
|
90
|
+
export type CommonModalActionButtonsProps = {
|
|
91
|
+
/**
|
|
92
|
+
* - Additional properties to be passed to the Group component wrapping the buttons.
|
|
93
|
+
*/
|
|
94
|
+
groupProps?: Record<string, any>;
|
|
95
|
+
/**
|
|
96
|
+
* - Flag to determine if the reset button should be displayed.
|
|
97
|
+
*/
|
|
98
|
+
withResetButton?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* - Flag to determine if the submit button should be displayed.
|
|
101
|
+
*/
|
|
102
|
+
withSubmitButton?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* - Additional properties to be passed to the reset Button component.
|
|
105
|
+
*/
|
|
106
|
+
resetButtonProps?: Record<string, any>;
|
|
107
|
+
/**
|
|
108
|
+
* - Additional properties to be passed to the submit Button component.
|
|
109
|
+
*/
|
|
110
|
+
submitButtonProps?: Record<string, any>;
|
|
111
|
+
};
|
|
112
|
+
export type CommonModalProps = {
|
|
113
|
+
/**
|
|
114
|
+
* - The content to be rendered inside the modal.
|
|
115
|
+
*/
|
|
116
|
+
children: React.ReactNode;
|
|
117
|
+
/**
|
|
118
|
+
* - Current view mode (e.g., VIEW_MODE.NORMAL, VIEW_MODE.FULL_SCREEN, VIEW_MODE.OVERLAY).
|
|
119
|
+
*/
|
|
120
|
+
view: string;
|
|
121
|
+
/**
|
|
122
|
+
* - Function to update the view mode.
|
|
123
|
+
*/
|
|
124
|
+
setView: Function;
|
|
125
|
+
/**
|
|
126
|
+
* - Callback function triggered on form reset.
|
|
127
|
+
*/
|
|
128
|
+
onReset: Function;
|
|
129
|
+
/**
|
|
130
|
+
* - Callback function triggered on form submission.
|
|
131
|
+
*/
|
|
132
|
+
onSubmit: Function;
|
|
133
|
+
/**
|
|
134
|
+
* - Additional properties to be passed to the Box component wrapping the form.
|
|
135
|
+
*/
|
|
136
|
+
boxProps: Record<string, any>;
|
|
137
|
+
/**
|
|
138
|
+
* - Text displayed on the reset button.
|
|
139
|
+
*/
|
|
140
|
+
resetButtonText: string;
|
|
141
|
+
/**
|
|
142
|
+
* - Text displayed on the submit button.
|
|
143
|
+
*/
|
|
144
|
+
buttonText: string;
|
|
145
|
+
/**
|
|
146
|
+
* - Indicates whether the submit button should display a loading state.
|
|
147
|
+
*/
|
|
148
|
+
buttonLoading: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* - Flag to determine if title options (e.g., full screen, overlay toggles) should be displayed.
|
|
151
|
+
*/
|
|
152
|
+
withTitleOptions?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* - Flag to determine if action buttons (e.g., submit button) should be displayed.
|
|
155
|
+
*/
|
|
156
|
+
withButtons?: boolean;
|
|
157
|
+
/**
|
|
158
|
+
* - Options for customizing the title area, such as toggles for full screen and overlay modes.
|
|
159
|
+
*/
|
|
160
|
+
titleOptions?: CommonModalTitleOptionsProps;
|
|
161
|
+
/**
|
|
162
|
+
* - Options for customizing the action buttons area.
|
|
163
|
+
*/
|
|
164
|
+
actionButtons?: CommonModalActionButtonsProps;
|
|
165
|
+
/**
|
|
166
|
+
* - Additional props to be passed to the Modal component.
|
|
167
|
+
*/
|
|
168
|
+
rest: Record<string, any>;
|
|
169
|
+
};
|
|
@@ -35,13 +35,13 @@ import { Modal } from '@mantine/core';
|
|
|
35
35
|
* @typedef {CommonModalProps & React.ComponentProps<typeof Modal>} CommonModalComponentProps
|
|
36
36
|
*/
|
|
37
37
|
/**
|
|
38
|
-
* CommonModal
|
|
38
|
+
* CommonModal is a reusable modal component that provides flexible configuration for displaying forms and actions.
|
|
39
39
|
*
|
|
40
|
-
* @
|
|
40
|
+
* @param {Object} props - Component props.
|
|
41
41
|
* @param {CommonModalComponentProps} props - The properties for the CommonModal component.
|
|
42
|
-
* @returns
|
|
42
|
+
* @returns {JSX.Element} The rendered modal component.
|
|
43
43
|
*/
|
|
44
|
-
export function CommonModal({ children, view, setView, onReset, onSubmit, boxProps, resetButtonText, buttonText, buttonLoading, withTitleOptions, withButtons, titleOptions, actionButtons, ...props }:
|
|
44
|
+
export function CommonModal({ children, view, setView, onReset, onSubmit, boxProps, resetButtonText, buttonText, buttonLoading, withTitleOptions, withButtons, titleOptions, actionButtons, ...props }: any): JSX.Element;
|
|
45
45
|
export type CommonModalTitleOptionsProps = {
|
|
46
46
|
/**
|
|
47
47
|
* - Content or function to render on the left side of the title.
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
export const FormContextViewProvider: import('react').ComponentType<{
|
|
2
|
+
value: any;
|
|
3
|
+
children: any;
|
|
4
|
+
}>;
|
|
5
|
+
export const useFormViewProvider: (options?: SafeContextOptions) => any;
|
|
1
6
|
export const FormContextAddProvider: import('react').ComponentType<{
|
|
2
7
|
value: any;
|
|
3
8
|
children: any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function useForms(type: "add" | "edit" | "delete", options: SafeContextOptions): FormsContext;
|
|
1
|
+
export function useForms(type: "view" | "add" | "edit" | "delete", options: SafeContextOptions): FormsContext;
|
|
2
2
|
export type SafeContextOptions = {
|
|
3
3
|
/**
|
|
4
4
|
* - Whether to throw an error if the context is not provided.
|
package/dist/core/lib/index.d.ts
CHANGED
|
@@ -6,6 +6,9 @@ export { Edit } from './ActionIcons/Edit/Edit';
|
|
|
6
6
|
export { Refresh } from './ActionIcons/Refresh/Refresh';
|
|
7
7
|
export { Upload } from './ActionIcons/Upload/Upload';
|
|
8
8
|
export { View } from './ActionIcons/View/View';
|
|
9
|
+
export * from './Dialogs';
|
|
10
|
+
export * from './Modals';
|
|
11
|
+
export * from './sub-packages-exporter';
|
|
9
12
|
export { useApi } from './hooks/api/useApi';
|
|
10
13
|
export { useBulkActions } from './hooks/api/useBulkActions';
|
|
11
14
|
export { useForms } from './hooks/api/useForms';
|
|
@@ -13,16 +16,11 @@ export { useAuth } from './hooks/auth/useAuth';
|
|
|
13
16
|
export { useInfo } from './hooks/auth/useInfo';
|
|
14
17
|
export { UserMenu } from './Menu/UserMenu/UserMenu';
|
|
15
18
|
export { LanguageSelector } from './Selectors/LanguageSelector';
|
|
16
|
-
export { AddDialog } from './ActionIcons/Add/AddDialog';
|
|
17
|
-
export { EditDialog } from './ActionIcons/Edit/EditDialog';
|
|
18
|
-
export { CommonModal } from './ActionIcons/Modals/CommonModal';
|
|
19
|
-
export { ViewDialog } from './ActionIcons/View/ViewDialog';
|
|
20
19
|
export { ApiProvider } from './Wrappers/ApiProvider/ApiProvider';
|
|
21
20
|
export { InfiniteScroll } from './Wrappers/InfiniteScroll/InfiniteScroll';
|
|
22
21
|
export { LazyLoadWrapper } from './Wrappers/LazyLoadWrapper/LazyLoadWrapper';
|
|
23
22
|
export { Provider } from './Wrappers/Provider/Provider';
|
|
24
|
-
export * from './sub-packages-exporter';
|
|
25
|
-
export { useTranslation } from './hooks/lang/useLang';
|
|
26
23
|
export { Filter } from './Tables/DataGrid/Toolbar/Filter/Filter';
|
|
24
|
+
export { useLang, useTranslation } from './hooks/lang/useLang';
|
|
27
25
|
export { DataGrid, DataGrid as Datagrid } from './Tables/DataGrid/DataGrid';
|
|
28
26
|
export { NextGenDataGrid, NextGenDataGrid as NextGenDatagrid, NextGenDataGrid as NextGendatagrid, NextGenDataGrid as Nextgendatagrid } from './Tables/NextGenDataGrid/NextGenDataGrid';
|
package/dist/core/styles.css
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
|
-
.
|
|
1
|
+
._iconSmall_sxv3z_1 {
|
|
2
|
+
width: 14px;
|
|
3
|
+
height: 14px;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
._iconLarge_sxv3z_6 {
|
|
7
|
+
width: 34px;
|
|
8
|
+
height: 34px;
|
|
9
|
+
margin-top: 10px;
|
|
10
|
+
margin-left: 10px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
._iconLarge_sxv3z_6:hover {
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
._btn_sxv3z_17:hover {
|
|
18
|
+
/* background-color: var(--mantine-color-gray-1);; */
|
|
19
|
+
}._field_zdaf7_1 {
|
|
2
20
|
/* Include font styles from theme.fn.fontStyles() if needed */
|
|
3
21
|
font-size: var(--mantine-font-size-md);
|
|
4
22
|
vertical-align: top;
|
|
@@ -49,24 +67,6 @@
|
|
|
49
67
|
}
|
|
50
68
|
._scrollbar_isyo2_1 {
|
|
51
69
|
z-index: 1;
|
|
52
|
-
}._iconSmall_sxv3z_1 {
|
|
53
|
-
width: 14px;
|
|
54
|
-
height: 14px;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
._iconLarge_sxv3z_6 {
|
|
58
|
-
width: 34px;
|
|
59
|
-
height: 34px;
|
|
60
|
-
margin-top: 10px;
|
|
61
|
-
margin-left: 10px;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
._iconLarge_sxv3z_6:hover {
|
|
65
|
-
cursor: pointer;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
._btn_sxv3z_17:hover {
|
|
69
|
-
/* background-color: var(--mantine-color-gray-1);; */
|
|
70
70
|
}.MRT_TableBody-module_root__kGhRy {
|
|
71
71
|
background-color: var(--mrt-base-background-color);
|
|
72
72
|
position: relative;
|
package/package.json
CHANGED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
-
const utils = require("fastapi-rtk/utils");
|
|
4
|
-
const React = require("react");
|
|
5
|
-
const DataGrid = require("../../Tables/DataGrid/DataGrid.cjs");
|
|
6
|
-
const ApiProvider = require("../../Wrappers/ApiProvider/ApiProvider.cjs");
|
|
7
|
-
const useApi = require("../../hooks/api/useApi.cjs");
|
|
8
|
-
function RelationPanel({ relatedPath, ...relation }) {
|
|
9
|
-
const { path } = useApi.useApi();
|
|
10
|
-
utils.urlJoin(
|
|
11
|
-
path ? path.substring(0, path.lastIndexOf("/")) : "",
|
|
12
|
-
relatedPath.substring(0, relatedPath.lastIndexOf("/"))
|
|
13
|
-
);
|
|
14
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ApiProvider.ApiProvider, { resource_name: relatedPath.replace("/", ""), relation, children: /* @__PURE__ */ jsxRuntime.jsx(DataGrid.DataGrid, { hideToolbar: true, hideDownload: false }) });
|
|
15
|
-
}
|
|
16
|
-
const RelationPanel$1 = React.memo(RelationPanel);
|
|
17
|
-
module.exports = RelationPanel$1;
|