@dashadmin/dash-auto-admin 1.3.25 → 1.3.26
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/DashAutoAdminComponentRegistry.js +64 -1
- package/dist/DashAutoAdminForm.js +137 -1
- package/dist/DashAutoAdminResizableDrawer.js +63 -1
- package/dist/DashAutoAdminSaveButton.js +57 -1
- package/dist/DashAutoCreate.js +102 -1
- package/dist/DashAutoDrawer.js +256 -1
- package/dist/DashAutoEdit.js +99 -1
- package/dist/DashAutoFiltersGenerator.js +193 -1
- package/dist/DashAutoFormGroups.js +118 -1
- package/dist/DashAutoFormLayout.js +68 -1
- package/dist/DashAutoFormMuiTabs.js +291 -1
- package/dist/DashAutoFormTabs.js +132 -1
- package/dist/DashAutoGroup.js +27 -1
- package/dist/DashAutoLayout.js +31 -1
- package/dist/DashAutoList.js +218 -1
- package/dist/DashAutoPostFilterForm.js +47 -1
- package/dist/DashAutoReferenceTab.js +10 -1
- package/dist/DashAutoResource.js +77 -1
- package/dist/DashAutoResourceLayout.js +16 -1
- package/dist/DashAutoShow.js +195 -1
- package/dist/DashAutoTabbedForm.js +244 -1
- package/dist/DashAutoTabbedForm.review.js +221 -1
- package/dist/DashAutoTabs.js +11 -1
- package/dist/DashFilterWrapper.js +62 -1
- package/dist/DashRedirect.js +56 -1
- package/dist/TabbedLayout.js +38 -1
- package/dist/common/DashAutoTitle.js +33 -1
- package/dist/common/components/FabButton.js +59 -1
- package/dist/common/components/TranslatedLabel.js +60 -1
- package/dist/common/settings/Settings.js +196 -1
- package/dist/common/settings/SettingsBarIcons.js +61 -1
- package/dist/context/DashAutoAdminFormContext.js +15 -1
- package/dist/hooks/useAutoAdminLoadingStateMediator.js +36 -1
- package/dist/hooks/useAutoAdminTranslate.js +61 -1
- package/dist/hooks/useHash.js +24 -1
- package/dist/hooks/useLogger.js +20 -1
- package/dist/hooks/useRoutePathPattern.js +20 -1
- package/dist/hooks/useVirtualHash.js +28 -1
- package/dist/index.js +77 -3406
- package/dist/list/DashAutoListActions.js +57 -1
- package/dist/list/DashAutoListDatagridWrapper.js +68 -1
- package/dist/list/DashAutoListDefaultActionsWrapper.js +14 -1
- package/dist/list/DashAutoListFilterFormWithButton.js +80 -1
- package/dist/list/DashAutoListTopToolbar.js +180 -1
- package/dist/mui/AttributeToField.js +576 -1
- package/dist/mui/AttributeToInput.js +630 -1
- package/dist/mui/AutoAdminResizableDrawer.js +63 -1
- package/dist/mui/AutoDataGrid.js +120 -1
- package/dist/mui/AutoReferenceFormTab.js +53 -1
- package/dist/mui/AutoReferenceTab.js +46 -1
- package/dist/mui/AutoTabs.js +19 -1
- package/dist/mui/components/ExtendedPagination.js +34 -1
- package/dist/mui/components/ListStringField.js +25 -1
- package/dist/providers/DashAuthProvider.js +215 -1
- package/dist/providers/DashDataProvider.js +310 -1
- package/dist/providers/index.js +10 -1
- package/dist/react-admin.d.js +0 -0
- package/dist/toolbar/buttons/BottomToolbarButtons.js +65 -1
- package/dist/toolbar/buttons/DashResourceButton.js +181 -1
- package/dist/toolbar/buttons/ListButtons.js +80 -1
- package/dist/toolbar/buttons/ToolbarButtons.js +135 -1
- package/dist/types/ActionCallback.d.js +0 -0
- package/dist/utils/SimpleLogger.js +52 -1
- package/dist/utils/enumToChoices.js +5 -1
- package/dist/utils/evalActionPermission.js +11 -1
- package/dist/utils/groupByTabs.js +21 -1
- package/dist/utils/hashedGroupByTabs.js +12 -1
- package/dist/utils/invertMap.js +12 -1
- package/dist/utils/isClassComponent.js +7 -1
- package/dist/utils/isComponent.js +29 -1
- package/dist/utils/isEnum.js +5 -1
- package/dist/utils/isFC.js +8 -1
- package/dist/utils/replaceParams.js +9 -1
- package/dist/utils/validate.js +19 -1
- package/dist/wrappers/UserAction.js +60 -1
- package/dist/wrappers/index.js +4 -1
- package/package.json +135 -120
- package/src/DashAutoAdminComponentRegistry.tsx +75 -0
- package/src/DashAutoAdminForm.tsx +155 -0
- package/src/DashAutoAdminResizableDrawer.tsx +69 -0
- package/src/DashAutoAdminSaveButton.tsx +116 -0
- package/src/DashAutoCreate.tsx +118 -0
- package/src/DashAutoDrawer.tsx +288 -0
- package/src/DashAutoEdit.tsx +109 -0
- package/src/DashAutoFiltersGenerator.tsx +208 -0
- package/src/DashAutoFormGroups.tsx +146 -0
- package/src/DashAutoFormLayout.tsx.review +113 -0
- package/src/DashAutoFormMuiTabs.tsx +368 -0
- package/src/DashAutoFormTabs.tsx +177 -0
- package/src/DashAutoGroup.tsx +42 -0
- package/src/DashAutoLayout.tsx +57 -0
- package/src/DashAutoList.tsx +237 -0
- package/src/DashAutoPostFilterForm.tsx +35 -0
- package/src/DashAutoReferenceTab.tsx +9 -0
- package/src/DashAutoResource.tsx +85 -0
- package/src/DashAutoResourceLayout.tsx +50 -0
- package/src/DashAutoShow.tsx +200 -0
- package/src/DashAutoTabbedForm.review.tsx +262 -0
- package/src/DashAutoTabbedForm.tsx +324 -0
- package/src/DashAutoTabs.tsx +19 -0
- package/src/DashFilterWrapper.tsx +43 -0
- package/src/DashRedirect.tsx +46 -0
- package/src/TabbedLayout.tsx +29 -0
- package/src/common/DashAutoTitle.tsx +24 -0
- package/src/common/components/FabButton.tsx +40 -0
- package/src/common/components/TranslatedLabel.tsx +81 -0
- package/src/common/settings/Settings.tsx +236 -0
- package/src/common/settings/SettingsBarIcons.tsx +72 -0
- package/src/context/DashAutoAdminFormContext.tsx +31 -0
- package/src/hooks/useAutoAdminLoadingStateMediator.tsx +42 -0
- package/src/hooks/useAutoAdminTranslate.tsx +106 -0
- package/src/hooks/useHash.tsx +27 -0
- package/src/hooks/useLogger.tsx +23 -0
- package/src/hooks/useRoutePathPattern.tsx +24 -0
- package/src/hooks/useVirtualHash.tsx +34 -0
- package/src/index.ts +85 -0
- package/src/interfaces/ICustomResourceSubComponent.ts +11 -0
- package/src/interfaces/IDashApplicationLayoutMainAction.ts +37 -0
- package/src/interfaces/IDashApplicationLayoutMenuItem.ts +24 -0
- package/src/interfaces/IDashAutoAdminAttribute.ts +104 -0
- package/src/interfaces/IDashAutoAdminCustomFieldComponent.ts +18 -0
- package/src/interfaces/IDashAutoAdminFormOptions.ts +22 -0
- package/src/interfaces/IDashAutoAdminListActions.ts +13 -0
- package/src/interfaces/IDashAutoAdminReference.ts +16 -0
- package/src/interfaces/IDashAutoAdminResourceConfig.ts +360 -0
- package/src/interfaces/IDashAutoForm.ts +24 -0
- package/src/interfaces/IDashAutoGridButton.ts +35 -0
- package/src/interfaces/IDashAutoShow.ts +12 -0
- package/src/interfaces/IGroupExtraData.ts +8 -0
- package/src/interfaces/IRecord.ts +7 -0
- package/src/interfaces/IReferenceFilter.ts +55 -0
- package/src/interfaces/IResourceComponent.ts +8 -0
- package/src/interfaces/IToolbarButton.ts +11 -0
- package/src/list/DashAutoListActions.tsx +88 -0
- package/src/list/DashAutoListDatagridWrapper.tsx +74 -0
- package/src/list/DashAutoListDefaultActionsWrapper.tsx +31 -0
- package/src/list/DashAutoListFilterFormWithButton.tsx +93 -0
- package/src/list/DashAutoListTopToolbar.tsx +240 -0
- package/src/mui/AttributeToField.tsx +657 -0
- package/src/mui/AttributeToInput.tsx +728 -0
- package/src/mui/AutoAdminResizableDrawer.tsx +69 -0
- package/src/mui/AutoDataGrid.tsx +127 -0
- package/src/mui/AutoReferenceFormTab.tsx +51 -0
- package/src/mui/AutoReferenceTab.tsx +45 -0
- package/src/mui/AutoTabs.tsx +32 -0
- package/src/mui/components/ExtendedPagination.tsx +23 -0
- package/src/mui/components/ListStringField.tsx +32 -0
- package/src/providers/DashAuthProvider.ts +341 -0
- package/src/providers/DashDataProvider.ts +466 -0
- package/src/providers/index.ts +17 -0
- package/src/toolbar/buttons/BottomToolbarButtons.tsx +59 -0
- package/src/toolbar/buttons/DashResourceButton.tsx +223 -0
- package/src/toolbar/buttons/ListButtons.tsx +137 -0
- package/src/toolbar/buttons/ToolbarButtons.tsx +186 -0
- package/src/utils/SimpleLogger.tsx +46 -0
- package/src/utils/enumToChoices.tsx +3 -0
- package/src/utils/evalActionPermission.tsx +14 -0
- package/src/utils/groupByTabs.tsx +23 -0
- package/src/utils/hashedGroupByTabs.tsx +16 -0
- package/src/utils/invertMap.tsx +10 -0
- package/src/utils/isClassComponent.tsx +9 -0
- package/src/utils/isComponent.tsx +45 -0
- package/src/utils/isEnum.tsx +3 -0
- package/src/utils/isFC.tsx +6 -0
- package/src/utils/replaceParams.tsx +6 -0
- package/src/utils/validate.tsx +24 -0
- package/src/wrappers/UserAction.tsx +67 -0
- package/src/wrappers/index.tsx +1 -0
- /package/{dist → src}/DashAutoAdminSaveButton.tsx.bkup +0 -0
- /package/{dist/DashAutoFormLayout.tsx.review → src/DashAutoFormLayout.tsx} +0 -0
- /package/{dist → src}/DashAutoFormTabs.review +0 -0
- /package/{dist → src}/DashAutoFormTabs.tsx.formcontext.wip +0 -0
- /package/{dist → src}/mui/AttributeToField.tsx.review +0 -0
- /package/{dist → src}/mui/AttributeToInput.tsx.review +0 -0
- /package/{dist → src}/react-admin.d.ts +0 -0
- /package/{dist → src}/types/ActionCallback.d.ts +0 -0
package/dist/DashAutoDrawer.js
CHANGED
|
@@ -1 +1,256 @@
|
|
|
1
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
33
|
+
import { createElement } from "react";
|
|
34
|
+
import { useCallback, useEffect, useState } from "react";
|
|
35
|
+
import AutoCreate from "./DashAutoCreate";
|
|
36
|
+
import AutoEdit from "./DashAutoEdit";
|
|
37
|
+
import { Toolbar, Button } from "react-admin";
|
|
38
|
+
import { match } from "node-match-path";
|
|
39
|
+
import { useLocation } from "react-router";
|
|
40
|
+
import AutoShow from "./DashAutoShow";
|
|
41
|
+
import { Drawer, SwipeableDrawer } from "@mui/material";
|
|
42
|
+
import DashAutoAdminSaveButton from "./DashAutoAdminSaveButton";
|
|
43
|
+
const DashAutoDrawer = (_a) => {
|
|
44
|
+
var _b = _a, {
|
|
45
|
+
resourceConfig,
|
|
46
|
+
recordId,
|
|
47
|
+
type = "normal",
|
|
48
|
+
placement = "right",
|
|
49
|
+
width = "100%",
|
|
50
|
+
height: height,
|
|
51
|
+
beforeSubmit,
|
|
52
|
+
onSubmit,
|
|
53
|
+
onError,
|
|
54
|
+
children
|
|
55
|
+
} = _b, props = __objRest(_b, [
|
|
56
|
+
"resourceConfig",
|
|
57
|
+
"recordId",
|
|
58
|
+
"type",
|
|
59
|
+
"placement",
|
|
60
|
+
"width",
|
|
61
|
+
// TODO: This is the default value for the drawer width, to be deprecated; must be set at a HoC.
|
|
62
|
+
"height",
|
|
63
|
+
"beforeSubmit",
|
|
64
|
+
"onSubmit",
|
|
65
|
+
"onError",
|
|
66
|
+
"children"
|
|
67
|
+
]);
|
|
68
|
+
var _a2, _b2, _c, _d;
|
|
69
|
+
const location = useLocation();
|
|
70
|
+
const DrawerComponent = type === "swipeable" ? SwipeableDrawer : Drawer;
|
|
71
|
+
const [open, setOpen] = useState(
|
|
72
|
+
((_a2 = location.state) == null ? void 0 : _a2.hash) ? true : false
|
|
73
|
+
);
|
|
74
|
+
const handleCloseDrawer = () => {
|
|
75
|
+
setOpen(false);
|
|
76
|
+
};
|
|
77
|
+
const handleOpenDrawer = () => {
|
|
78
|
+
setOpen(true);
|
|
79
|
+
};
|
|
80
|
+
const _onSubmit = (values) => {
|
|
81
|
+
if (resourceConfig.closeDrawerAfterSave) handleCloseDrawer();
|
|
82
|
+
if (onSubmit) onSubmit(values);
|
|
83
|
+
};
|
|
84
|
+
const [localHash, setLocalHash] = useState(
|
|
85
|
+
((_b2 = location.state) == null ? void 0 : _b2.hash) ? location.state.hash : window.location.hash
|
|
86
|
+
);
|
|
87
|
+
const hashChangeHandler = useCallback((e) => {
|
|
88
|
+
setLocalHash(e.data);
|
|
89
|
+
setOpen(true);
|
|
90
|
+
}, []);
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
window.addEventListener("virtualhash", hashChangeHandler);
|
|
93
|
+
return () => {
|
|
94
|
+
window.removeEventListener("virtualhash", hashChangeHandler);
|
|
95
|
+
};
|
|
96
|
+
}, []);
|
|
97
|
+
let mode = "edit";
|
|
98
|
+
const _createMatch = match(
|
|
99
|
+
`/${resourceConfig.model}/inline/create`,
|
|
100
|
+
String(localHash).substring(1)
|
|
101
|
+
);
|
|
102
|
+
if (_createMatch.matches) {
|
|
103
|
+
mode = "create";
|
|
104
|
+
}
|
|
105
|
+
const _editMatch = match(
|
|
106
|
+
`/${resourceConfig.model}/inline/:id/:mode`,
|
|
107
|
+
String(localHash).substring(1)
|
|
108
|
+
);
|
|
109
|
+
mode = _editMatch.matches && ((_c = _editMatch.params) == null ? void 0 : _c.mode) ? _editMatch.params.mode : mode;
|
|
110
|
+
const resource_id = ["edit", "show"].includes(mode) ? (_d = _editMatch.params) == null ? void 0 : _d.id : null;
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
var _a3;
|
|
113
|
+
if ((_a3 = location.state) == null ? void 0 : _a3.hash) {
|
|
114
|
+
history.replaceState(null, "", location.state.hash);
|
|
115
|
+
}
|
|
116
|
+
return () => {
|
|
117
|
+
history.replaceState(null, "", null);
|
|
118
|
+
};
|
|
119
|
+
}, []);
|
|
120
|
+
const DrawerToolbar = () => {
|
|
121
|
+
if ((resourceConfig == null ? void 0 : resourceConfig.bottomToolbar) === false) return /* @__PURE__ */ jsx(Fragment, {});
|
|
122
|
+
return /* @__PURE__ */ jsxs(Toolbar, { children: [
|
|
123
|
+
mode === "edit" && (resourceConfig == null ? void 0 : resourceConfig.saveButton) !== false && /* @__PURE__ */ jsx(
|
|
124
|
+
DashAutoAdminSaveButton,
|
|
125
|
+
{
|
|
126
|
+
alwaysEnable: (resourceConfig == null ? void 0 : resourceConfig.saveButtonAlwaysEnabled) === true ? true : false,
|
|
127
|
+
label: "Guardar",
|
|
128
|
+
resourceConfig
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
mode === "create" && (resourceConfig == null ? void 0 : resourceConfig.saveButton) !== false && /* @__PURE__ */ jsx(
|
|
132
|
+
DashAutoAdminSaveButton,
|
|
133
|
+
{
|
|
134
|
+
resourceConfig,
|
|
135
|
+
alwaysEnable: (resourceConfig == null ? void 0 : resourceConfig.saveButtonAlwaysEnabled) === true ? true : false,
|
|
136
|
+
label: "Crear"
|
|
137
|
+
}
|
|
138
|
+
),
|
|
139
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => handleCloseDrawer(), children: /* @__PURE__ */ jsx(Fragment, { children: "Cerrar" }) })
|
|
140
|
+
] });
|
|
141
|
+
};
|
|
142
|
+
if (mode !== "list" && mode === "create")
|
|
143
|
+
return /* @__PURE__ */ createElement(
|
|
144
|
+
DrawerComponent,
|
|
145
|
+
__spreadValues(__spreadProps(__spreadValues({
|
|
146
|
+
anchor: placement,
|
|
147
|
+
onClose: () => handleCloseDrawer()
|
|
148
|
+
}, type === "swipeable" && { onOpen: handleOpenDrawer }), {
|
|
149
|
+
open,
|
|
150
|
+
key: placement,
|
|
151
|
+
sx: {
|
|
152
|
+
width: { xs: "90%", sm: "90%", md: "50%", lg: "40%" },
|
|
153
|
+
"& .MuiDrawer-paper": {
|
|
154
|
+
width: { xs: "90%", sm: "90%", md: "50%", lg: "40%" }
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
slotProps: {},
|
|
158
|
+
size: "large"
|
|
159
|
+
}), props),
|
|
160
|
+
/* @__PURE__ */ jsx(
|
|
161
|
+
"div",
|
|
162
|
+
{
|
|
163
|
+
style: __spreadValues(__spreadValues({}, height && { height }), width && { width }),
|
|
164
|
+
children: /* @__PURE__ */ jsx(
|
|
165
|
+
AutoCreate,
|
|
166
|
+
{
|
|
167
|
+
toolbar: /* @__PURE__ */ jsx(DrawerToolbar, {}),
|
|
168
|
+
isDrawer: true,
|
|
169
|
+
resourceConfig: __spreadProps(__spreadValues({}, resourceConfig), { formGroupMode: resourceConfig.formGroupMode === "tabs" || !resourceConfig.formGroupMode ? "groups" : resourceConfig.formGroupMode }),
|
|
170
|
+
beforeSubmit,
|
|
171
|
+
onSubmit: _onSubmit,
|
|
172
|
+
onError,
|
|
173
|
+
onCancel: () => handleCloseDrawer()
|
|
174
|
+
}
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
)
|
|
178
|
+
);
|
|
179
|
+
if (mode !== "list" && mode === "edit" && resource_id)
|
|
180
|
+
return /* @__PURE__ */ createElement(
|
|
181
|
+
DrawerComponent,
|
|
182
|
+
__spreadValues(__spreadProps(__spreadValues({
|
|
183
|
+
anchor: placement,
|
|
184
|
+
onClose: () => handleCloseDrawer()
|
|
185
|
+
}, type === "swipeable" && { onOpen: handleOpenDrawer }), {
|
|
186
|
+
open,
|
|
187
|
+
key: placement,
|
|
188
|
+
sx: {
|
|
189
|
+
width: { xs: "90%", sm: "90%", md: "50%", lg: "40%" },
|
|
190
|
+
"& .MuiDrawer-paper": {
|
|
191
|
+
width: { xs: "90%", sm: "90%", md: "50%", lg: "40%" }
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
slotProps: {},
|
|
195
|
+
size: "large"
|
|
196
|
+
}), props),
|
|
197
|
+
/* @__PURE__ */ jsx(
|
|
198
|
+
"div",
|
|
199
|
+
{
|
|
200
|
+
style: __spreadValues(__spreadValues({}, height && { height }), width && { width }),
|
|
201
|
+
children: /* @__PURE__ */ jsx(
|
|
202
|
+
AutoEdit,
|
|
203
|
+
{
|
|
204
|
+
isDrawer: true,
|
|
205
|
+
toolbar: /* @__PURE__ */ jsx(DrawerToolbar, {}),
|
|
206
|
+
id: resource_id,
|
|
207
|
+
resourceConfig: __spreadProps(__spreadValues({}, resourceConfig), { formGroupMode: resourceConfig.formGroupMode === "tabs" || !resourceConfig.formGroupMode ? "groups" : resourceConfig.formGroupMode }),
|
|
208
|
+
beforeSubmit,
|
|
209
|
+
onSubmit: _onSubmit,
|
|
210
|
+
onError,
|
|
211
|
+
onCancel: () => handleCloseDrawer()
|
|
212
|
+
}
|
|
213
|
+
)
|
|
214
|
+
}
|
|
215
|
+
)
|
|
216
|
+
);
|
|
217
|
+
if (mode === "show" && resource_id) {
|
|
218
|
+
return /* @__PURE__ */ createElement(
|
|
219
|
+
DrawerComponent,
|
|
220
|
+
__spreadValues(__spreadProps(__spreadValues({
|
|
221
|
+
anchor: placement,
|
|
222
|
+
onClose: () => handleCloseDrawer()
|
|
223
|
+
}, type === "swipeable" && { onOpen: handleOpenDrawer }), {
|
|
224
|
+
open,
|
|
225
|
+
key: placement,
|
|
226
|
+
sx: {
|
|
227
|
+
width: { xs: "90%", sm: "90%", md: "50%", lg: "40%" },
|
|
228
|
+
"& .MuiDrawer-paper": {
|
|
229
|
+
width: { xs: "90%", sm: "90%", md: "50%", lg: "40%" }
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
slotProps: {},
|
|
233
|
+
size: "large"
|
|
234
|
+
}), props),
|
|
235
|
+
/* @__PURE__ */ jsx(
|
|
236
|
+
"div",
|
|
237
|
+
{
|
|
238
|
+
style: __spreadValues(__spreadValues({}, height && { height }), width && { width }),
|
|
239
|
+
children: /* @__PURE__ */ jsx(
|
|
240
|
+
AutoShow,
|
|
241
|
+
{
|
|
242
|
+
isDrawer: true,
|
|
243
|
+
id: resource_id,
|
|
244
|
+
resourceConfig: __spreadProps(__spreadValues({}, resourceConfig), { formGroupMode: resourceConfig.formGroupMode === "tabs" || !resourceConfig.formGroupMode ? "groups" : resourceConfig.formGroupMode })
|
|
245
|
+
}
|
|
246
|
+
)
|
|
247
|
+
}
|
|
248
|
+
)
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
252
|
+
};
|
|
253
|
+
var DashAutoDrawer_default = DashAutoDrawer;
|
|
254
|
+
export {
|
|
255
|
+
DashAutoDrawer_default as default
|
|
256
|
+
};
|
package/dist/DashAutoEdit.js
CHANGED
|
@@ -1 +1,99 @@
|
|
|
1
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
33
|
+
import AutoTitle from "./common/DashAutoTitle";
|
|
34
|
+
import AutoTabbedForm from "./DashAutoTabbedForm";
|
|
35
|
+
import { TopToolbar, Edit, Toolbar } from "react-admin";
|
|
36
|
+
import { ToolbarCreateButton, ToolbarDeleteButton, ToolbarEditButton, ToolbarExportButton, ToolbarListButton } from "./toolbar/buttons/ToolbarButtons";
|
|
37
|
+
import { BottomToolbarDeleteButton, BottomToolbarSaveButton } from "./toolbar/buttons/BottomToolbarButtons";
|
|
38
|
+
const DashAutoEdit = ({
|
|
39
|
+
id,
|
|
40
|
+
resourceConfig,
|
|
41
|
+
onSubmit,
|
|
42
|
+
onError,
|
|
43
|
+
onCancel,
|
|
44
|
+
beforeSubmit,
|
|
45
|
+
toolbar,
|
|
46
|
+
actions,
|
|
47
|
+
isDrawer = false,
|
|
48
|
+
locale
|
|
49
|
+
}) => {
|
|
50
|
+
const EditActions = (_a) => {
|
|
51
|
+
var props = __objRest(_a, []);
|
|
52
|
+
const _isDrawer = !!resourceConfig.drawer;
|
|
53
|
+
return /* @__PURE__ */ jsxs(TopToolbar, __spreadProps(__spreadValues({ sx: { mb: 2 } }, props), { children: [
|
|
54
|
+
(resourceConfig == null ? void 0 : resourceConfig.AutoEditTopToolbarElements) ? resourceConfig.AutoEditTopToolbarElements(resourceConfig) : null,
|
|
55
|
+
!_isDrawer && /* @__PURE__ */ jsx(ToolbarListButton, { mode: "edit", resourceConfig }),
|
|
56
|
+
!_isDrawer && /* @__PURE__ */ jsx(ToolbarEditButton, { mode: "edit", resourceConfig }),
|
|
57
|
+
!_isDrawer && /* @__PURE__ */ jsx(ToolbarCreateButton, { mode: "edit", resourceConfig }),
|
|
58
|
+
!_isDrawer && /* @__PURE__ */ jsx(ToolbarDeleteButton, { mode: "edit", resourceConfig }),
|
|
59
|
+
!_isDrawer && /* @__PURE__ */ jsx(ToolbarExportButton, { mode: "edit", resourceConfig })
|
|
60
|
+
] }));
|
|
61
|
+
};
|
|
62
|
+
const EditToolbar = (_b) => {
|
|
63
|
+
var props = __objRest(_b, []);
|
|
64
|
+
return /* @__PURE__ */ jsxs(Toolbar, __spreadProps(__spreadValues({}, props), { children: [
|
|
65
|
+
/* @__PURE__ */ jsx(BottomToolbarSaveButton, { mode: "edit", resourceConfig, onError, onSubmit }),
|
|
66
|
+
/* @__PURE__ */ jsx(BottomToolbarDeleteButton, { mode: "edit", resourceConfig, onError, onSubmit }),
|
|
67
|
+
(resourceConfig == null ? void 0 : resourceConfig.AutoEditBottomToolbarElements) ? resourceConfig.AutoEditBottomToolbarElements(resourceConfig) : /* @__PURE__ */ jsx(Fragment, {})
|
|
68
|
+
] }));
|
|
69
|
+
};
|
|
70
|
+
return /* @__PURE__ */ jsx(
|
|
71
|
+
Edit,
|
|
72
|
+
__spreadProps(__spreadValues(__spreadProps(__spreadValues({
|
|
73
|
+
component: "div"
|
|
74
|
+
}, id && { id }), {
|
|
75
|
+
actions: actions || /* @__PURE__ */ jsx(EditActions, {}),
|
|
76
|
+
mutationMode: resourceConfig.mutationMode,
|
|
77
|
+
title: /* @__PURE__ */ jsx(AutoTitle, { resourceConfig })
|
|
78
|
+
}), (resourceConfig == null ? void 0 : resourceConfig.editProps) || {}), {
|
|
79
|
+
children: /* @__PURE__ */ jsx(
|
|
80
|
+
AutoTabbedForm,
|
|
81
|
+
__spreadProps(__spreadValues({
|
|
82
|
+
isDrawer,
|
|
83
|
+
mode: "edit",
|
|
84
|
+
resourceConfig,
|
|
85
|
+
toolbar: toolbar || /* @__PURE__ */ jsx(EditToolbar, {}),
|
|
86
|
+
onSubmit,
|
|
87
|
+
onError
|
|
88
|
+
}, beforeSubmit && { beforeSubmit }), {
|
|
89
|
+
onCancel,
|
|
90
|
+
locale
|
|
91
|
+
})
|
|
92
|
+
)
|
|
93
|
+
})
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
var DashAutoEdit_default = DashAutoEdit;
|
|
97
|
+
export {
|
|
98
|
+
DashAutoEdit_default as default
|
|
99
|
+
};
|
|
@@ -1 +1,193 @@
|
|
|
1
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import { jsx } from "react/jsx-runtime";
|
|
21
|
+
import { TextInput, ReferenceInput, SelectInput, DateInput } from "react-admin";
|
|
22
|
+
import { SelectArrayInput } from "react-admin";
|
|
23
|
+
const generateFilter = (r, idx) => {
|
|
24
|
+
const {
|
|
25
|
+
label,
|
|
26
|
+
source,
|
|
27
|
+
reference,
|
|
28
|
+
optionText,
|
|
29
|
+
alwaysOn = true,
|
|
30
|
+
referenceComponent,
|
|
31
|
+
fieldProps = {},
|
|
32
|
+
slotProps = {},
|
|
33
|
+
inputOptions = {},
|
|
34
|
+
multiple = false,
|
|
35
|
+
date = false
|
|
36
|
+
} = r;
|
|
37
|
+
console.log("\u{1F527} DashAutoFiltersGenerator DEBUG - generateFilter called:", {
|
|
38
|
+
idx,
|
|
39
|
+
label,
|
|
40
|
+
source,
|
|
41
|
+
reference,
|
|
42
|
+
hasReferenceComponent: !!referenceComponent,
|
|
43
|
+
fieldProps,
|
|
44
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
45
|
+
});
|
|
46
|
+
if (referenceComponent && !reference) {
|
|
47
|
+
console.log("\u{1F527} DashAutoFiltersGenerator DEBUG - Rendering with reference component (no reference):", {
|
|
48
|
+
idx,
|
|
49
|
+
source,
|
|
50
|
+
label,
|
|
51
|
+
referenceComponent: referenceComponent.name,
|
|
52
|
+
fieldProps,
|
|
53
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
54
|
+
});
|
|
55
|
+
const ReferenceComponent2 = referenceComponent;
|
|
56
|
+
const finalProps = __spreadValues({
|
|
57
|
+
source,
|
|
58
|
+
label,
|
|
59
|
+
alwaysOn
|
|
60
|
+
}, fieldProps);
|
|
61
|
+
console.log("\u{1F527} DashAutoFiltersGenerator DEBUG - Final props for reference component (DETAILED):", {
|
|
62
|
+
idx,
|
|
63
|
+
source,
|
|
64
|
+
label,
|
|
65
|
+
finalProps,
|
|
66
|
+
fieldPropsResource: fieldProps == null ? void 0 : fieldProps.resource,
|
|
67
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
68
|
+
});
|
|
69
|
+
return /* @__PURE__ */ jsx(
|
|
70
|
+
ReferenceComponent2,
|
|
71
|
+
__spreadValues({}, finalProps),
|
|
72
|
+
idx
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
let ReferenceComponent = referenceComponent || SelectInput;
|
|
76
|
+
if (reference && typeof reference === "object") {
|
|
77
|
+
if (multiple && !referenceComponent) {
|
|
78
|
+
ReferenceComponent = SelectArrayInput;
|
|
79
|
+
}
|
|
80
|
+
console.log("\u{1F517} DashAutoFiltersGenerator DEBUG - Rendering with object reference:", {
|
|
81
|
+
idx,
|
|
82
|
+
source,
|
|
83
|
+
label,
|
|
84
|
+
reference,
|
|
85
|
+
ReferenceComponent: ReferenceComponent.name,
|
|
86
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
87
|
+
});
|
|
88
|
+
return /* @__PURE__ */ jsx(
|
|
89
|
+
ReferenceComponent,
|
|
90
|
+
__spreadValues({
|
|
91
|
+
choices: reference,
|
|
92
|
+
label,
|
|
93
|
+
source,
|
|
94
|
+
alwaysOn
|
|
95
|
+
}, fieldProps),
|
|
96
|
+
idx
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
if (reference) {
|
|
100
|
+
console.log("\u{1F517} DashAutoFiltersGenerator DEBUG - Rendering ReferenceInput:", {
|
|
101
|
+
idx,
|
|
102
|
+
source,
|
|
103
|
+
label,
|
|
104
|
+
reference,
|
|
105
|
+
ReferenceComponent: ReferenceComponent.name,
|
|
106
|
+
inputOptions,
|
|
107
|
+
fieldProps,
|
|
108
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
109
|
+
});
|
|
110
|
+
return /* @__PURE__ */ jsx(
|
|
111
|
+
ReferenceInput,
|
|
112
|
+
__spreadProps(__spreadValues({
|
|
113
|
+
label,
|
|
114
|
+
source,
|
|
115
|
+
reference,
|
|
116
|
+
allowEmpty: true,
|
|
117
|
+
alwaysOn
|
|
118
|
+
}, inputOptions), {
|
|
119
|
+
children: /* @__PURE__ */ jsx(
|
|
120
|
+
ReferenceComponent,
|
|
121
|
+
__spreadValues({
|
|
122
|
+
label,
|
|
123
|
+
optionText
|
|
124
|
+
}, fieldProps)
|
|
125
|
+
)
|
|
126
|
+
}),
|
|
127
|
+
idx
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
if (date) {
|
|
131
|
+
console.log("\u{1F4C5} DashAutoFiltersGenerator DEBUG - Rendering DateInput:", {
|
|
132
|
+
idx,
|
|
133
|
+
source,
|
|
134
|
+
label,
|
|
135
|
+
fieldProps,
|
|
136
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
137
|
+
});
|
|
138
|
+
return /* @__PURE__ */ jsx(
|
|
139
|
+
DateInput,
|
|
140
|
+
__spreadValues({
|
|
141
|
+
placeholder: "Date",
|
|
142
|
+
label,
|
|
143
|
+
source,
|
|
144
|
+
alwaysOn
|
|
145
|
+
}, fieldProps),
|
|
146
|
+
idx
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
console.log("\u{1F4DD} DashAutoFiltersGenerator DEBUG - Rendering TextInput (default):", {
|
|
150
|
+
idx,
|
|
151
|
+
source,
|
|
152
|
+
label,
|
|
153
|
+
fieldProps,
|
|
154
|
+
slotProps,
|
|
155
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
156
|
+
});
|
|
157
|
+
return /* @__PURE__ */ jsx(
|
|
158
|
+
TextInput,
|
|
159
|
+
__spreadValues(__spreadValues({
|
|
160
|
+
label,
|
|
161
|
+
source,
|
|
162
|
+
alwaysOn
|
|
163
|
+
}, fieldProps), slotProps ? { slotProps } : {}),
|
|
164
|
+
idx
|
|
165
|
+
);
|
|
166
|
+
};
|
|
167
|
+
const dashAutoFiltersGenerator = (resourceConfig, locale) => {
|
|
168
|
+
const referenceFilters = (resourceConfig == null ? void 0 : resourceConfig.referenceFilters) || [];
|
|
169
|
+
const filters = [];
|
|
170
|
+
console.log("\u{1F3ED} DashAutoFiltersGenerator DEBUG - dashAutoFiltersGenerator called:", {
|
|
171
|
+
resourceConfig: (resourceConfig == null ? void 0 : resourceConfig.model) || "unknown",
|
|
172
|
+
filtersCount: referenceFilters.length,
|
|
173
|
+
filters: referenceFilters.map((f) => ({
|
|
174
|
+
id: f.id,
|
|
175
|
+
source: f.source,
|
|
176
|
+
label: f.label,
|
|
177
|
+
hasReferenceComponent: !!f.referenceComponent,
|
|
178
|
+
fieldProps: f.fieldProps
|
|
179
|
+
})),
|
|
180
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
181
|
+
});
|
|
182
|
+
if (referenceFilters && referenceFilters.length > 0) {
|
|
183
|
+
referenceFilters.forEach((r, idx) => {
|
|
184
|
+
filters.push(generateFilter(r, idx));
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
return filters;
|
|
188
|
+
};
|
|
189
|
+
var DashAutoFiltersGenerator_default = dashAutoFiltersGenerator;
|
|
190
|
+
export {
|
|
191
|
+
DashAutoFiltersGenerator_default as default,
|
|
192
|
+
generateFilter
|
|
193
|
+
};
|
|
@@ -1 +1,118 @@
|
|
|
1
|
-
import{jsx
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { AutoAdminSettings } from ".";
|
|
3
|
+
import groupByTabs from "./utils/groupByTabs";
|
|
4
|
+
import { default as AttributeToInput } from "./mui/AttributeToInput";
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { TranslatedLabel } from "./common/components/TranslatedLabel";
|
|
7
|
+
const DashAutoFormGroups = ({
|
|
8
|
+
schema,
|
|
9
|
+
resourceConfig,
|
|
10
|
+
options
|
|
11
|
+
}) => {
|
|
12
|
+
var _a;
|
|
13
|
+
const DEFAULT_TAB_LABEL = ((_a = AutoAdminSettings) == null ? void 0 : _a.defaultTabName) || resourceConfig.label;
|
|
14
|
+
const renderLegend = (label) => /* @__PURE__ */ jsx("legend", { children: /* @__PURE__ */ jsx(TranslatedLabel, { label, fallback: DEFAULT_TAB_LABEL }) });
|
|
15
|
+
const isDrawer = (options == null ? void 0 : options.isDrawer) === true ? true : false;
|
|
16
|
+
switch (options == null ? void 0 : options.mode) {
|
|
17
|
+
case "create":
|
|
18
|
+
return groupByTabs(schema).map((groupOfAttributes, idx) => {
|
|
19
|
+
let attributes = groupOfAttributes;
|
|
20
|
+
if (isDrawer)
|
|
21
|
+
attributes = attributes.filter(
|
|
22
|
+
(attribute) => (attribute == null ? void 0 : attribute.inDrawer) !== false
|
|
23
|
+
);
|
|
24
|
+
const filteredAttributes = attributes.filter((attribute) => (attribute == null ? void 0 : attribute.inCreate) !== false);
|
|
25
|
+
return filteredAttributes.length ? /* @__PURE__ */ jsxs("fieldset", { children: [
|
|
26
|
+
filteredAttributes.length > 0 && renderLegend(attributes[0].tab || (options == null ? void 0 : options.label)),
|
|
27
|
+
filteredAttributes.map(
|
|
28
|
+
(attribute, i) => React.cloneElement(
|
|
29
|
+
AttributeToInput(
|
|
30
|
+
options.mode,
|
|
31
|
+
resourceConfig,
|
|
32
|
+
attribute,
|
|
33
|
+
i,
|
|
34
|
+
options
|
|
35
|
+
),
|
|
36
|
+
{ key: `create-${idx}-${i}` }
|
|
37
|
+
)
|
|
38
|
+
)
|
|
39
|
+
] }, `auto-admin-fieldset-${idx}`) : null;
|
|
40
|
+
});
|
|
41
|
+
case "edit":
|
|
42
|
+
return groupByTabs(schema).map((groupOfAttributes, idx) => {
|
|
43
|
+
let attributes = groupOfAttributes;
|
|
44
|
+
if (isDrawer)
|
|
45
|
+
attributes = attributes.filter(
|
|
46
|
+
(attribute) => (attribute == null ? void 0 : attribute.inDrawer) !== false
|
|
47
|
+
);
|
|
48
|
+
const filteredAttributes = attributes.filter((attribute) => (attribute == null ? void 0 : attribute.inEdit) !== false);
|
|
49
|
+
return filteredAttributes.length ? /* @__PURE__ */ jsxs("fieldset", { children: [
|
|
50
|
+
filteredAttributes.length > 0 && renderLegend(attributes[0].tab || (options == null ? void 0 : options.label)),
|
|
51
|
+
filteredAttributes.map(
|
|
52
|
+
(attribute, i) => React.cloneElement(
|
|
53
|
+
AttributeToInput(
|
|
54
|
+
options.mode,
|
|
55
|
+
resourceConfig,
|
|
56
|
+
attribute,
|
|
57
|
+
i,
|
|
58
|
+
options
|
|
59
|
+
),
|
|
60
|
+
{ key: `edit-${idx}-${i}` }
|
|
61
|
+
)
|
|
62
|
+
)
|
|
63
|
+
] }, `auto-admin-fieldset-${idx}`) : null;
|
|
64
|
+
});
|
|
65
|
+
case "view":
|
|
66
|
+
return groupByTabs(schema).map((groupOfAttributes, idx) => {
|
|
67
|
+
let attributes = groupOfAttributes;
|
|
68
|
+
if (isDrawer)
|
|
69
|
+
attributes = attributes.filter(
|
|
70
|
+
(attribute) => (attribute == null ? void 0 : attribute.inDrawer) !== false
|
|
71
|
+
);
|
|
72
|
+
const filteredAttributes = attributes.filter((attribute) => (attribute == null ? void 0 : attribute.inShow) !== false);
|
|
73
|
+
return filteredAttributes.length ? /* @__PURE__ */ jsxs("fieldset", { children: [
|
|
74
|
+
filteredAttributes.length > 0 && renderLegend(attributes[0].tab || (options == null ? void 0 : options.label)),
|
|
75
|
+
filteredAttributes.map(
|
|
76
|
+
(attribute, i) => React.cloneElement(
|
|
77
|
+
AttributeToInput(
|
|
78
|
+
options.mode,
|
|
79
|
+
resourceConfig,
|
|
80
|
+
attribute,
|
|
81
|
+
i,
|
|
82
|
+
options
|
|
83
|
+
),
|
|
84
|
+
{ key: `view-${idx}-${i}` }
|
|
85
|
+
)
|
|
86
|
+
)
|
|
87
|
+
] }, `auto-admin-fieldset-${idx}`) : null;
|
|
88
|
+
});
|
|
89
|
+
case "list":
|
|
90
|
+
return groupByTabs(schema).map((groupOfAttributes, idx) => {
|
|
91
|
+
let attributes = groupOfAttributes;
|
|
92
|
+
if (isDrawer)
|
|
93
|
+
attributes = attributes.filter(
|
|
94
|
+
(attribute) => (attribute == null ? void 0 : attribute.inDrawer) !== false
|
|
95
|
+
);
|
|
96
|
+
const filteredAttributes = attributes.filter((attribute) => (attribute == null ? void 0 : attribute.inShow) !== false);
|
|
97
|
+
return filteredAttributes.length ? /* @__PURE__ */ jsxs("fieldset", { children: [
|
|
98
|
+
filteredAttributes.length > 0 && renderLegend(attributes[0].tab || (options == null ? void 0 : options.label)),
|
|
99
|
+
filteredAttributes.map(
|
|
100
|
+
(attribute, i) => React.cloneElement(
|
|
101
|
+
AttributeToInput(
|
|
102
|
+
options.mode,
|
|
103
|
+
resourceConfig,
|
|
104
|
+
attribute,
|
|
105
|
+
i,
|
|
106
|
+
options
|
|
107
|
+
),
|
|
108
|
+
{ key: `list-${idx}-${i}` }
|
|
109
|
+
)
|
|
110
|
+
)
|
|
111
|
+
] }, `auto-admin-fieldset-${idx}`) : null;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
var DashAutoFormGroups_default = DashAutoFormGroups;
|
|
116
|
+
export {
|
|
117
|
+
DashAutoFormGroups_default as default
|
|
118
|
+
};
|