@questpie/admin 3.2.4 → 3.2.6
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/client/blocks/block-renderer.d.mts +2 -2
- package/dist/client/blocks/block-renderer.mjs +164 -339
- package/dist/client/components/actions/action-button.mjs +9 -9
- package/dist/client/components/actions/action-dialog.mjs +195 -493
- package/dist/client/components/actions/confirmation-dialog.mjs +44 -159
- package/dist/client/components/actions/header-actions.mjs +73 -165
- package/dist/client/components/admin-link.d.mts +2 -2
- package/dist/client/components/admin-link.mjs +40 -126
- package/dist/client/components/auth/auth-loading.mjs +9 -44
- package/dist/client/components/blocks/block-canvas.mjs +31 -95
- package/dist/client/components/blocks/block-editor-context.mjs +13 -57
- package/dist/client/components/blocks/block-editor-layout.mjs +72 -166
- package/dist/client/components/blocks/block-editor-provider.mjs +184 -245
- package/dist/client/components/blocks/block-fields-renderer.mjs +54 -229
- package/dist/client/components/blocks/block-insert-button.mjs +49 -165
- package/dist/client/components/blocks/block-item-menu.mjs +102 -301
- package/dist/client/components/blocks/block-item.mjs +136 -370
- package/dist/client/components/blocks/block-library-sidebar.mjs +103 -230
- package/dist/client/components/blocks/block-tree.mjs +12 -68
- package/dist/client/components/blocks/block-type-icon.mjs +14 -56
- package/dist/client/components/brand-logo.mjs +35 -149
- package/dist/client/components/component-renderer.mjs +42 -118
- package/dist/client/components/error-boundary.mjs +14 -58
- package/dist/client/components/fields/array-field.mjs +209 -521
- package/dist/client/components/fields/asset-preview-field.mjs +41 -141
- package/dist/client/components/fields/blocks-field/blocks-field.mjs +60 -156
- package/dist/client/components/fields/boolean-field.mjs +29 -59
- package/dist/client/components/fields/date-field.mjs +7 -37
- package/dist/client/components/fields/datetime-field.mjs +7 -38
- package/dist/client/components/fields/email-field.mjs +25 -54
- package/dist/client/components/fields/field-wrapper.mjs +30 -105
- package/dist/client/components/fields/json-field.mjs +94 -296
- package/dist/client/components/fields/locale-badge.mjs +6 -15
- package/dist/client/components/fields/number-field.mjs +27 -60
- package/dist/client/components/fields/object-array-field.mjs +283 -659
- package/dist/client/components/fields/object-field.mjs +165 -633
- package/dist/client/components/fields/relation/displays/cards-display.mjs +106 -220
- package/dist/client/components/fields/relation/displays/chips-display.mjs +78 -150
- package/dist/client/components/fields/relation/displays/grid-display.mjs +92 -186
- package/dist/client/components/fields/relation/displays/list-display.mjs +122 -239
- package/dist/client/components/fields/relation/displays/table-display.mjs +70 -244
- package/dist/client/components/fields/relation/relation-items-display.mjs +30 -126
- package/dist/client/components/fields/relation-field.mjs +10 -66
- package/dist/client/components/fields/relation-picker.mjs +18 -18
- package/dist/client/components/fields/relation-select.mjs +12 -12
- package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +80 -180
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs +2 -2
- package/dist/client/components/fields/rich-text-editor/image-upload.mjs +13 -29
- package/dist/client/components/fields/rich-text-editor/index.mjs +195 -513
- package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +61 -111
- package/dist/client/components/fields/rich-text-editor/table-controls.mjs +105 -415
- package/dist/client/components/fields/rich-text-editor/toolbar.mjs +256 -511
- package/dist/client/components/fields/rich-text-field.mjs +14 -53
- package/dist/client/components/fields/select-field.mjs +61 -72
- package/dist/client/components/fields/text-field.mjs +26 -59
- package/dist/client/components/fields/textarea-field.mjs +26 -58
- package/dist/client/components/fields/time-field.mjs +7 -35
- package/dist/client/components/fields/upload-field.mjs +47 -165
- package/dist/client/components/filter-builder/columns-tab.mjs +80 -280
- package/dist/client/components/filter-builder/filter-builder-sheet.mjs +197 -540
- package/dist/client/components/filter-builder/filters-tab.mjs +96 -386
- package/dist/client/components/filter-builder/saved-views-tab.mjs +133 -351
- package/dist/client/components/history-sidebar.mjs +285 -605
- package/dist/client/components/layout/field-layout-renderer.mjs +106 -254
- package/dist/client/components/locale-switcher.mjs +106 -228
- package/dist/client/components/media/media-grid.mjs +84 -273
- package/dist/client/components/media/media-picker-dialog.mjs +176 -476
- package/dist/client/components/preview/live-preview-mode.mjs +233 -458
- package/dist/client/components/preview/preview-pane.mjs +22 -22
- package/dist/client/components/primitives/asset-preview.mjs +290 -666
- package/dist/client/components/primitives/checkbox-input.mjs +9 -35
- package/dist/client/components/primitives/date-input.mjs +109 -327
- package/dist/client/components/primitives/dropzone.mjs +209 -336
- package/dist/client/components/primitives/field-select-control.mjs +12 -80
- package/dist/client/components/primitives/number-input.mjs +4 -4
- package/dist/client/components/primitives/select-multi.mjs +229 -572
- package/dist/client/components/primitives/select-single.mjs +179 -499
- package/dist/client/components/primitives/time-input.mjs +43 -117
- package/dist/client/components/primitives/toggle-input.mjs +9 -29
- package/dist/client/components/sheets/resource-sheet.mjs +61 -70
- package/dist/client/components/ui/accordion.mjs +35 -155
- package/dist/client/components/ui/alert.mjs +13 -68
- package/dist/client/components/ui/badge.mjs +9 -51
- package/dist/client/components/ui/button.mjs +8 -54
- package/dist/client/components/ui/card.mjs +37 -193
- package/dist/client/components/ui/checkbox.mjs +12 -68
- package/dist/client/components/ui/command.mjs +48 -219
- package/dist/client/components/ui/dialog.mjs +50 -262
- package/dist/client/components/ui/drawer.mjs +55 -259
- package/dist/client/components/ui/dropdown-menu.mjs +86 -427
- package/dist/client/components/ui/empty-state.mjs +28 -98
- package/dist/client/components/ui/field.mjs +73 -309
- package/dist/client/components/ui/input-group.mjs +42 -167
- package/dist/client/components/ui/input.mjs +7 -37
- package/dist/client/components/ui/kbd.mjs +6 -36
- package/dist/client/components/ui/label.mjs +7 -37
- package/dist/client/components/ui/popover.mjs +34 -169
- package/dist/client/components/ui/responsive-dialog.mjs +67 -273
- package/dist/client/components/ui/scroll-fade.mjs +63 -158
- package/dist/client/components/ui/search-input.mjs +33 -100
- package/dist/client/components/ui/select.mjs +72 -393
- package/dist/client/components/ui/separator.mjs +7 -38
- package/dist/client/components/ui/sheet.mjs +49 -269
- package/dist/client/components/ui/sidebar.mjs +171 -690
- package/dist/client/components/ui/skeleton.mjs +7 -38
- package/dist/client/components/ui/sonner.mjs +11 -42
- package/dist/client/components/ui/switch.mjs +9 -45
- package/dist/client/components/ui/table.mjs +48 -266
- package/dist/client/components/ui/tabs.mjs +26 -139
- package/dist/client/components/ui/textarea.mjs +6 -32
- package/dist/client/components/ui/tooltip.mjs +27 -129
- package/dist/client/components/widgets/chart-widget.mjs +174 -522
- package/dist/client/components/widgets/progress-widget.mjs +66 -172
- package/dist/client/components/widgets/quick-actions-widget.mjs +102 -261
- package/dist/client/components/widgets/recent-items-widget.mjs +69 -195
- package/dist/client/components/widgets/stats-widget.mjs +41 -175
- package/dist/client/components/widgets/table-widget.mjs +9 -9
- package/dist/client/components/widgets/timeline-widget.mjs +86 -226
- package/dist/client/components/widgets/value-widget.mjs +74 -381
- package/dist/client/components/widgets/widget-empty-state.mjs +26 -76
- package/dist/client/components/widgets/widget-skeletons.mjs +138 -421
- package/dist/client/contexts/focus-context.mjs +63 -146
- package/dist/client/hooks/typed-hooks.mjs +241 -701
- package/dist/client/hooks/use-action.mjs +62 -198
- package/dist/client/hooks/use-admin-config.mjs +5 -35
- package/dist/client/hooks/use-admin-preferences.mjs +16 -88
- package/dist/client/hooks/use-admin-routes.mjs +22 -56
- package/dist/client/hooks/use-audit-history.mjs +21 -69
- package/dist/client/hooks/use-brand.mjs +1 -9
- package/dist/client/hooks/use-collection-fields.mjs +17 -57
- package/dist/client/hooks/use-collection-meta.mjs +12 -44
- package/dist/client/hooks/use-collection-schema.mjs +10 -33
- package/dist/client/hooks/use-collection-validation.mjs +23 -53
- package/dist/client/hooks/use-collection.mjs +194 -614
- package/dist/client/hooks/use-current-user.mjs +0 -1
- package/dist/client/hooks/use-field-hooks.mjs +10 -10
- package/dist/client/hooks/use-field-options.mjs +61 -202
- package/dist/client/hooks/use-global-fields.mjs +14 -46
- package/dist/client/hooks/use-global-meta.mjs +9 -30
- package/dist/client/hooks/use-global-schema.mjs +9 -30
- package/dist/client/hooks/use-global.mjs +63 -219
- package/dist/client/hooks/use-locks.mjs +117 -325
- package/dist/client/hooks/use-media-query.mjs +16 -36
- package/dist/client/hooks/use-prefill-params.mjs +0 -1
- package/dist/client/hooks/use-questpie-query-options.mjs +12 -29
- package/dist/client/hooks/use-reactive-fields.mjs +1 -1
- package/dist/client/hooks/use-reactive-prop.mjs +65 -223
- package/dist/client/hooks/use-realtime-highlight.mjs +51 -114
- package/dist/client/hooks/use-saved-views.mjs +22 -103
- package/dist/client/hooks/use-search-param-toggle.mjs +28 -79
- package/dist/client/hooks/use-search.mjs +31 -143
- package/dist/client/hooks/use-server-actions.mjs +18 -50
- package/dist/client/hooks/use-server-validation.mjs +72 -166
- package/dist/client/hooks/use-server-widget-data.mjs +7 -33
- package/dist/client/hooks/use-setup-status.mjs +12 -25
- package/dist/client/hooks/use-sidebar-search-param.mjs +33 -78
- package/dist/client/hooks/use-transition-stage.mjs +8 -38
- package/dist/client/hooks/use-upload.mjs +54 -152
- package/dist/client/hooks/use-validation-error-map.mjs +6 -26
- package/dist/client/hooks/use-view-state.mjs +187 -437
- package/dist/client/i18n/hooks.mjs +65 -197
- package/dist/client/lib/render-profiler.mjs +14 -41
- package/dist/client/preview/block-scope-context.mjs +14 -36
- package/dist/client/preview/preview-banner.d.mts +2 -2
- package/dist/client/preview/preview-banner.mjs +42 -108
- package/dist/client/preview/preview-field.d.mts +4 -4
- package/dist/client/preview/preview-field.mjs +167 -348
- package/dist/client/preview/use-collection-preview.mjs +121 -215
- package/dist/client/runtime/content-locales-provider.mjs +31 -83
- package/dist/client/runtime/locale-scope.mjs +22 -63
- package/dist/client/runtime/provider.mjs +100 -255
- package/dist/client/runtime/translations-provider.mjs +41 -107
- package/dist/client/scope/picker.mjs +86 -321
- package/dist/client/scope/provider.mjs +8 -17
- package/dist/client/utils/build-field-definitions-from-schema.mjs +4 -2
- package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
- package/dist/client/views/auth/accept-invite-form.mjs +121 -412
- package/dist/client/views/auth/auth-layout.d.mts +3 -3
- package/dist/client/views/auth/auth-layout.mjs +104 -284
- package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
- package/dist/client/views/auth/forgot-password-form.mjs +94 -325
- package/dist/client/views/auth/invite-form.mjs +107 -442
- package/dist/client/views/auth/login-form.d.mts +2 -2
- package/dist/client/views/auth/login-form.mjs +116 -337
- package/dist/client/views/auth/reset-password-form.d.mts +2 -2
- package/dist/client/views/auth/reset-password-form.mjs +128 -453
- package/dist/client/views/auth/setup-form.d.mts +2 -2
- package/dist/client/views/auth/setup-form.mjs +140 -478
- package/dist/client/views/collection/auto-form-fields.mjs +243 -615
- package/dist/client/views/collection/bulk-action-toolbar.mjs +212 -379
- package/dist/client/views/collection/cells/complex-cells.mjs +183 -611
- package/dist/client/views/collection/cells/primitive-cells.mjs +116 -356
- package/dist/client/views/collection/cells/relation-cells.mjs +86 -233
- package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +142 -371
- package/dist/client/views/collection/cells/shared/relation-chip.mjs +35 -131
- package/dist/client/views/collection/cells/upload-cells.mjs +60 -177
- package/dist/client/views/collection/columns/build-columns.mjs +8 -48
- package/dist/client/views/collection/field-renderer.mjs +58 -182
- package/dist/client/views/collection/form-view.mjs +284 -518
- package/dist/client/views/collection/table-view.mjs +231 -463
- package/dist/client/views/collection/view-skeletons.mjs +112 -237
- package/dist/client/views/common/global-search.mjs +241 -560
- package/dist/client/views/dashboard/dashboard-grid.mjs +256 -775
- package/dist/client/views/dashboard/dashboard-widget.mjs +38 -126
- package/dist/client/views/dashboard/widget-card.mjs +61 -269
- package/dist/client/views/globals/global-form-view.mjs +477 -1301
- package/dist/client/views/layout/admin-layout-provider.mjs +28 -88
- package/dist/client/views/layout/admin-layout.mjs +83 -246
- package/dist/client/views/layout/admin-router.mjs +458 -1274
- package/dist/client/views/layout/admin-sidebar.mjs +510 -1292
- package/dist/client/views/layout/admin-theme.mjs +30 -64
- package/dist/client/views/layout/admin-view-layout.mjs +40 -144
- package/dist/client/views/pages/accept-invite-page.d.mts +2 -2
- package/dist/client/views/pages/accept-invite-page.mjs +95 -290
- package/dist/client/views/pages/dashboard-page.d.mts +2 -2
- package/dist/client/views/pages/dashboard-page.mjs +11 -57
- package/dist/client/views/pages/forgot-password-page.d.mts +2 -2
- package/dist/client/views/pages/forgot-password-page.mjs +31 -83
- package/dist/client/views/pages/invite-page.d.mts +2 -2
- package/dist/client/views/pages/invite-page.mjs +35 -90
- package/dist/client/views/pages/login-page.d.mts +2 -2
- package/dist/client/views/pages/login-page.mjs +41 -121
- package/dist/client/views/pages/reset-password-page.d.mts +2 -2
- package/dist/client/views/pages/reset-password-page.mjs +46 -173
- package/dist/client/views/pages/setup-page.d.mts +2 -2
- package/dist/client/views/pages/setup-page.mjs +33 -95
- package/dist/components/rich-text/rich-text-renderer.mjs +9 -33
- package/dist/server/adapters/index.d.mts +2 -0
- package/dist/server/adapters/nextjs.d.mts +1 -0
- package/dist/server/auth-helpers.d.mts +1 -0
- package/dist/server/modules/admin/.generated/module.d.mts +1 -0
- package/dist/server/modules/admin/collections/account.d.mts +46 -46
- package/dist/server/modules/admin/collections/admin-locks.d.mts +50 -50
- package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
- package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
- package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
- package/dist/server/modules/admin/collections/assets.d.mts +39 -39
- package/dist/server/modules/admin/collections/session.d.mts +42 -42
- package/dist/server/modules/admin/collections/user.d.mts +62 -62
- package/dist/server/modules/admin/collections/verification.d.mts +23 -23
- package/dist/server/modules/admin/index.d.mts +20 -19
- package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
- package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
- package/dist/server/modules/admin/routes/locales.d.mts +2 -2
- package/dist/server/modules/admin/routes/preview.d.mts +11 -11
- package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
- package/dist/server/modules/admin/routes/setup.d.mts +7 -7
- package/dist/server/modules/admin/routes/translations.d.mts +4 -4
- package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
- package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +45 -45
- package/dist/server/modules/audit/.generated/module.d.mts +6 -6
- package/dist/server/modules/audit/collections/audit-log.d.mts +78 -78
- package/dist/server/modules/audit/jobs/audit-cleanup.d.mts +2 -2
- package/dist/server.d.mts +2 -0
- package/package.json +3 -5
|
@@ -12,7 +12,6 @@ import { useGlobalMeta } from "../../hooks/use-global-meta.mjs";
|
|
|
12
12
|
import { scopeDependencies, trackDependencies } from "../../utils/dependency-tracker.mjs";
|
|
13
13
|
import { getFullFieldName, resolveValue } from "./field-context.mjs";
|
|
14
14
|
import { FieldRenderer } from "./field-renderer.mjs";
|
|
15
|
-
import { c } from "react/compiler-runtime";
|
|
16
15
|
import * as React from "react";
|
|
17
16
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
17
|
import { useFormContext, useWatch } from "react-hook-form";
|
|
@@ -125,133 +124,38 @@ function getLayoutKey(item) {
|
|
|
125
124
|
}).join("-");
|
|
126
125
|
return fieldKey ? `section-${fieldKey}` : "section";
|
|
127
126
|
}
|
|
128
|
-
function FieldLayoutItems(
|
|
129
|
-
const $ = c(25);
|
|
130
|
-
const { fieldItems, fields, collection, mode: t1, registry, fieldPrefix, allCollectionsConfig, excludedFields, entityMeta, formValues, resolveText } = t0;
|
|
131
|
-
const mode = t1 === void 0 ? "collection" : t1;
|
|
127
|
+
function FieldLayoutItems({ fieldItems, fields, collection, mode = "collection", registry, fieldPrefix, allCollectionsConfig, excludedFields, entityMeta, formValues, resolveText }) {
|
|
132
128
|
if (!fieldItems?.length) return null;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
}, fieldName);
|
|
166
|
-
}
|
|
167
|
-
if (typeof item === "object" && "type" in item) switch (item.type) {
|
|
168
|
-
case "tabs": return /* @__PURE__ */ jsx(TabsLayoutRenderer, {
|
|
169
|
-
tabsLayout: item,
|
|
170
|
-
fields,
|
|
171
|
-
collection,
|
|
172
|
-
mode,
|
|
173
|
-
registry,
|
|
174
|
-
fieldPrefix,
|
|
175
|
-
allCollectionsConfig,
|
|
176
|
-
excludedFields,
|
|
177
|
-
entityMeta,
|
|
178
|
-
formValues,
|
|
179
|
-
resolveText
|
|
180
|
-
}, getLayoutKey(item));
|
|
181
|
-
case "section": return /* @__PURE__ */ jsx(SectionLayoutRenderer, {
|
|
182
|
-
section: item,
|
|
183
|
-
index,
|
|
184
|
-
fields,
|
|
185
|
-
collection,
|
|
186
|
-
mode,
|
|
187
|
-
registry,
|
|
188
|
-
fieldPrefix,
|
|
189
|
-
allCollectionsConfig,
|
|
190
|
-
excludedFields,
|
|
191
|
-
entityMeta,
|
|
192
|
-
formValues,
|
|
193
|
-
resolveText
|
|
194
|
-
}, getLayoutKey(item));
|
|
195
|
-
default: return null;
|
|
196
|
-
}
|
|
197
|
-
return null;
|
|
198
|
-
};
|
|
199
|
-
$[12] = allCollectionsConfig;
|
|
200
|
-
$[13] = collection;
|
|
201
|
-
$[14] = entityMeta;
|
|
202
|
-
$[15] = excludedFields;
|
|
203
|
-
$[16] = fieldPrefix;
|
|
204
|
-
$[17] = fields;
|
|
205
|
-
$[18] = formValues;
|
|
206
|
-
$[19] = mode;
|
|
207
|
-
$[20] = registry;
|
|
208
|
-
$[21] = resolveText;
|
|
209
|
-
$[22] = t3$1;
|
|
210
|
-
} else t3$1 = $[22];
|
|
211
|
-
t2 = fieldItems.map(t3$1).filter(Boolean);
|
|
212
|
-
$[0] = allCollectionsConfig;
|
|
213
|
-
$[1] = collection;
|
|
214
|
-
$[2] = entityMeta;
|
|
215
|
-
$[3] = excludedFields;
|
|
216
|
-
$[4] = fieldItems;
|
|
217
|
-
$[5] = fieldPrefix;
|
|
218
|
-
$[6] = fields;
|
|
219
|
-
$[7] = formValues;
|
|
220
|
-
$[8] = mode;
|
|
221
|
-
$[9] = registry;
|
|
222
|
-
$[10] = resolveText;
|
|
223
|
-
$[11] = t2;
|
|
224
|
-
} else t2 = $[11];
|
|
225
|
-
const validItems = t2;
|
|
226
|
-
let t3;
|
|
227
|
-
if ($[23] !== validItems) {
|
|
228
|
-
t3 = validItems.length === 1 ? validItems[0] : /* @__PURE__ */ jsx("div", {
|
|
229
|
-
className: "space-y-6",
|
|
230
|
-
children: validItems
|
|
231
|
-
});
|
|
232
|
-
$[23] = validItems;
|
|
233
|
-
$[24] = t3;
|
|
234
|
-
} else t3 = $[24];
|
|
235
|
-
return t3;
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* Render a section layout
|
|
239
|
-
* Mirrors object field: wrapper (flat|collapsible) + layout (stack|inline|grid)
|
|
240
|
-
*/
|
|
241
|
-
function SectionLayoutRenderer(t0) {
|
|
242
|
-
const $ = c(51);
|
|
243
|
-
const { section, index, fields, collection, mode: t1, registry, fieldPrefix, allCollectionsConfig, excludedFields, entityMeta, formValues, resolveText } = t0;
|
|
244
|
-
const mode = t1 === void 0 ? "collection" : t1;
|
|
245
|
-
if (resolveValue(section.hidden, formValues, false)) return null;
|
|
246
|
-
const wrapper = section.wrapper ?? "flat";
|
|
247
|
-
const layout = section.layout ?? "stack";
|
|
248
|
-
const columns = section.columns ?? 2;
|
|
249
|
-
const gap = section.gap;
|
|
250
|
-
let t2;
|
|
251
|
-
if ($[0] !== allCollectionsConfig || $[1] !== collection || $[2] !== columns || $[3] !== entityMeta || $[4] !== excludedFields || $[5] !== fieldPrefix || $[6] !== fields || $[7] !== formValues || $[8] !== gap || $[9] !== layout || $[10] !== mode || $[11] !== registry || $[12] !== resolveText || $[13] !== section.className || $[14] !== section.fields) {
|
|
252
|
-
const renderSectionFields = () => {
|
|
253
|
-
if (layout === "grid") return renderFields({
|
|
254
|
-
fieldItems: section.fields,
|
|
129
|
+
const validItems = fieldItems.map((item, index) => {
|
|
130
|
+
if (isFieldReference(item)) {
|
|
131
|
+
const fieldName = getFieldName(item);
|
|
132
|
+
if (!fieldName || !fields[fieldName]) return null;
|
|
133
|
+
if (excludedFields?.has(fieldName)) return null;
|
|
134
|
+
const fieldDef = fields[fieldName];
|
|
135
|
+
return /* @__PURE__ */ jsx(FieldRenderer, {
|
|
136
|
+
fieldName,
|
|
137
|
+
fieldDef,
|
|
138
|
+
collection,
|
|
139
|
+
mode,
|
|
140
|
+
registry,
|
|
141
|
+
fieldPrefix,
|
|
142
|
+
allCollectionsConfig,
|
|
143
|
+
entityMeta,
|
|
144
|
+
className: typeof item === "object" && "className" in item ? item.className : void 0,
|
|
145
|
+
extraProps: typeof item === "object" && "props" in item ? item.props : void 0,
|
|
146
|
+
renderEmbeddedFields: ({ embeddedCollection, embeddedCollectionConfig, fullFieldName, index: embeddedIndex }) => /* @__PURE__ */ jsx(AutoFormFields, {
|
|
147
|
+
collection: embeddedCollection,
|
|
148
|
+
mode: "collection",
|
|
149
|
+
config: embeddedCollectionConfig,
|
|
150
|
+
registry,
|
|
151
|
+
fieldPrefix: `${fullFieldName}.${embeddedIndex}`,
|
|
152
|
+
allCollectionsConfig
|
|
153
|
+
})
|
|
154
|
+
}, fieldName);
|
|
155
|
+
}
|
|
156
|
+
if (typeof item === "object" && "type" in item) switch (item.type) {
|
|
157
|
+
case "tabs": return /* @__PURE__ */ jsx(TabsLayoutRenderer, {
|
|
158
|
+
tabsLayout: item,
|
|
255
159
|
fields,
|
|
256
160
|
collection,
|
|
257
161
|
mode,
|
|
@@ -260,43 +164,12 @@ function SectionLayoutRenderer(t0) {
|
|
|
260
164
|
allCollectionsConfig,
|
|
261
165
|
excludedFields,
|
|
262
166
|
entityMeta,
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
children: section.fields.map((item, _idx) => {
|
|
270
|
-
const fieldName = getFieldName(item);
|
|
271
|
-
if (!fieldName || !fields[fieldName]) return null;
|
|
272
|
-
if (excludedFields?.has(fieldName)) return null;
|
|
273
|
-
const fieldDef = fields[fieldName];
|
|
274
|
-
return /* @__PURE__ */ jsx(FieldRenderer, {
|
|
275
|
-
fieldName,
|
|
276
|
-
fieldDef,
|
|
277
|
-
collection,
|
|
278
|
-
mode,
|
|
279
|
-
registry,
|
|
280
|
-
fieldPrefix,
|
|
281
|
-
allCollectionsConfig,
|
|
282
|
-
entityMeta,
|
|
283
|
-
className: typeof item === "object" && "className" in item ? item.className : void 0,
|
|
284
|
-
renderEmbeddedFields: (t3$1) => {
|
|
285
|
-
const { embeddedCollection, embeddedCollectionConfig, fullFieldName, index: embeddedIndex } = t3$1;
|
|
286
|
-
return /* @__PURE__ */ jsx(AutoFormFields, {
|
|
287
|
-
collection: embeddedCollection,
|
|
288
|
-
mode: "collection",
|
|
289
|
-
config: embeddedCollectionConfig,
|
|
290
|
-
registry,
|
|
291
|
-
fieldPrefix: `${fullFieldName}.${embeddedIndex}`,
|
|
292
|
-
allCollectionsConfig
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
}, fieldName);
|
|
296
|
-
})
|
|
297
|
-
});
|
|
298
|
-
return /* @__PURE__ */ jsx(FieldLayoutItems, {
|
|
299
|
-
fieldItems: section.fields,
|
|
167
|
+
formValues,
|
|
168
|
+
resolveText
|
|
169
|
+
}, getLayoutKey(item));
|
|
170
|
+
case "section": return /* @__PURE__ */ jsx(SectionLayoutRenderer, {
|
|
171
|
+
section: item,
|
|
172
|
+
index,
|
|
300
173
|
fields,
|
|
301
174
|
collection,
|
|
302
175
|
mode,
|
|
@@ -307,272 +180,175 @@ function SectionLayoutRenderer(t0) {
|
|
|
307
180
|
entityMeta,
|
|
308
181
|
formValues,
|
|
309
182
|
resolveText
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
$[6] = fields;
|
|
320
|
-
$[7] = formValues;
|
|
321
|
-
$[8] = gap;
|
|
322
|
-
$[9] = layout;
|
|
323
|
-
$[10] = mode;
|
|
324
|
-
$[11] = registry;
|
|
325
|
-
$[12] = resolveText;
|
|
326
|
-
$[13] = section.className;
|
|
327
|
-
$[14] = section.fields;
|
|
328
|
-
$[15] = t2;
|
|
329
|
-
} else t2 = $[15];
|
|
330
|
-
const content = t2;
|
|
331
|
-
if (!content) return null;
|
|
332
|
-
let t3;
|
|
333
|
-
if ($[16] !== formValues || $[17] !== resolveText || $[18] !== section.description || $[19] !== section.label) {
|
|
334
|
-
t3 = section.label || section.description ? /* @__PURE__ */ jsxs("div", {
|
|
335
|
-
className: "mb-4",
|
|
336
|
-
children: [section.label && /* @__PURE__ */ jsx("h3", {
|
|
337
|
-
className: "qa-form-fields__section-title text-lg font-semibold",
|
|
338
|
-
children: resolveText(section.label, "", formValues)
|
|
339
|
-
}), section.description && /* @__PURE__ */ jsx("p", {
|
|
340
|
-
className: "text-muted-foreground mt-1 text-sm text-pretty",
|
|
341
|
-
children: resolveText(section.description, "", formValues)
|
|
342
|
-
})]
|
|
343
|
-
}) : null;
|
|
344
|
-
$[16] = formValues;
|
|
345
|
-
$[17] = resolveText;
|
|
346
|
-
$[18] = section.description;
|
|
347
|
-
$[19] = section.label;
|
|
348
|
-
$[20] = t3;
|
|
349
|
-
} else t3 = $[20];
|
|
350
|
-
const header = t3;
|
|
351
|
-
if (wrapper === "collapsible") {
|
|
352
|
-
const value = `section-${index}`;
|
|
353
|
-
const defaultOpen = section.defaultCollapsed !== true;
|
|
354
|
-
let t4$1;
|
|
355
|
-
if ($[21] !== defaultOpen || $[22] !== value) {
|
|
356
|
-
t4$1 = defaultOpen ? [value] : [];
|
|
357
|
-
$[21] = defaultOpen;
|
|
358
|
-
$[22] = value;
|
|
359
|
-
$[23] = t4$1;
|
|
360
|
-
} else t4$1 = $[23];
|
|
361
|
-
let t5$1;
|
|
362
|
-
if ($[24] !== formValues || $[25] !== resolveText || $[26] !== section.label) {
|
|
363
|
-
t5$1 = resolveText(section.label, "Section", formValues);
|
|
364
|
-
$[24] = formValues;
|
|
365
|
-
$[25] = resolveText;
|
|
366
|
-
$[26] = section.label;
|
|
367
|
-
$[27] = t5$1;
|
|
368
|
-
} else t5$1 = $[27];
|
|
369
|
-
let t6;
|
|
370
|
-
if ($[28] !== t5$1) {
|
|
371
|
-
t6 = /* @__PURE__ */ jsx(AccordionTrigger, {
|
|
372
|
-
className: "hover:no-underline",
|
|
373
|
-
children: /* @__PURE__ */ jsx("span", {
|
|
374
|
-
className: "font-semibold",
|
|
375
|
-
children: t5$1
|
|
376
|
-
})
|
|
377
|
-
});
|
|
378
|
-
$[28] = t5$1;
|
|
379
|
-
$[29] = t6;
|
|
380
|
-
} else t6 = $[29];
|
|
381
|
-
let t7;
|
|
382
|
-
if ($[30] !== formValues || $[31] !== resolveText || $[32] !== section.description) {
|
|
383
|
-
t7 = section.description && /* @__PURE__ */ jsx("p", {
|
|
384
|
-
className: "text-muted-foreground mb-4 text-sm text-pretty",
|
|
385
|
-
children: resolveText(section.description, "", formValues)
|
|
386
|
-
});
|
|
387
|
-
$[30] = formValues;
|
|
388
|
-
$[31] = resolveText;
|
|
389
|
-
$[32] = section.description;
|
|
390
|
-
$[33] = t7;
|
|
391
|
-
} else t7 = $[33];
|
|
392
|
-
let t8;
|
|
393
|
-
if ($[34] !== content || $[35] !== t7) {
|
|
394
|
-
t8 = /* @__PURE__ */ jsxs(AccordionContent, {
|
|
395
|
-
className: "pt-2 pb-4",
|
|
396
|
-
children: [t7, content]
|
|
397
|
-
});
|
|
398
|
-
$[34] = content;
|
|
399
|
-
$[35] = t7;
|
|
400
|
-
$[36] = t8;
|
|
401
|
-
} else t8 = $[36];
|
|
402
|
-
let t9;
|
|
403
|
-
if ($[37] !== t6 || $[38] !== t8 || $[39] !== value) {
|
|
404
|
-
t9 = /* @__PURE__ */ jsxs(AccordionItem, {
|
|
405
|
-
value,
|
|
406
|
-
className: "border-transparent px-4",
|
|
407
|
-
children: [t6, t8]
|
|
408
|
-
});
|
|
409
|
-
$[37] = t6;
|
|
410
|
-
$[38] = t8;
|
|
411
|
-
$[39] = value;
|
|
412
|
-
$[40] = t9;
|
|
413
|
-
} else t9 = $[40];
|
|
414
|
-
let t10;
|
|
415
|
-
if ($[41] !== t4$1 || $[42] !== t9 || $[43] !== value) {
|
|
416
|
-
t10 = /* @__PURE__ */ jsx(Accordion, {
|
|
417
|
-
defaultValue: t4$1,
|
|
418
|
-
className: "w-full",
|
|
419
|
-
children: t9
|
|
420
|
-
}, value);
|
|
421
|
-
$[41] = t4$1;
|
|
422
|
-
$[42] = t9;
|
|
423
|
-
$[43] = value;
|
|
424
|
-
$[44] = t10;
|
|
425
|
-
} else t10 = $[44];
|
|
426
|
-
return t10;
|
|
427
|
-
}
|
|
428
|
-
let t4;
|
|
429
|
-
if ($[45] !== section.className) {
|
|
430
|
-
t4 = cn("qa-form-fields__section space-y-4", section.className);
|
|
431
|
-
$[45] = section.className;
|
|
432
|
-
$[46] = t4;
|
|
433
|
-
} else t4 = $[46];
|
|
434
|
-
let t5;
|
|
435
|
-
if ($[47] !== content || $[48] !== header || $[49] !== t4) {
|
|
436
|
-
t5 = /* @__PURE__ */ jsxs("div", {
|
|
437
|
-
className: t4,
|
|
438
|
-
children: [header, content]
|
|
439
|
-
});
|
|
440
|
-
$[47] = content;
|
|
441
|
-
$[48] = header;
|
|
442
|
-
$[49] = t4;
|
|
443
|
-
$[50] = t5;
|
|
444
|
-
} else t5 = $[50];
|
|
445
|
-
return t5;
|
|
183
|
+
}, getLayoutKey(item));
|
|
184
|
+
default: return null;
|
|
185
|
+
}
|
|
186
|
+
return null;
|
|
187
|
+
}).filter(Boolean);
|
|
188
|
+
return validItems.length === 1 ? validItems[0] : /* @__PURE__ */ jsx("div", {
|
|
189
|
+
className: "space-y-6",
|
|
190
|
+
children: validItems
|
|
191
|
+
});
|
|
446
192
|
}
|
|
447
193
|
/**
|
|
448
|
-
* Render
|
|
194
|
+
* Render a section layout
|
|
195
|
+
* Mirrors object field: wrapper (flat|collapsible) + layout (stack|inline|grid)
|
|
449
196
|
*/
|
|
450
|
-
function
|
|
451
|
-
|
|
452
|
-
const
|
|
453
|
-
const
|
|
454
|
-
const
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
className: "
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
mode,
|
|
197
|
+
function SectionLayoutRenderer({ section, index, fields, collection, mode = "collection", registry, fieldPrefix, allCollectionsConfig, excludedFields, entityMeta, formValues, resolveText }) {
|
|
198
|
+
if (resolveValue(section.hidden, formValues, false)) return null;
|
|
199
|
+
const wrapper = section.wrapper ?? "flat";
|
|
200
|
+
const layout = section.layout ?? "stack";
|
|
201
|
+
const columns = section.columns ?? 2;
|
|
202
|
+
const gap = section.gap;
|
|
203
|
+
const renderSectionFields = () => {
|
|
204
|
+
if (layout === "grid") return renderFields({
|
|
205
|
+
fieldItems: section.fields,
|
|
206
|
+
fields,
|
|
207
|
+
collection,
|
|
208
|
+
mode,
|
|
209
|
+
registry,
|
|
210
|
+
fieldPrefix,
|
|
211
|
+
allCollectionsConfig,
|
|
212
|
+
excludedFields,
|
|
213
|
+
entityMeta,
|
|
214
|
+
columns,
|
|
215
|
+
gap,
|
|
216
|
+
className: section.className
|
|
217
|
+
});
|
|
218
|
+
if (layout === "inline") return /* @__PURE__ */ jsx("div", {
|
|
219
|
+
className: cn("flex flex-wrap gap-4", section.className),
|
|
220
|
+
children: section.fields.map((item, _idx) => {
|
|
221
|
+
const fieldName = getFieldName(item);
|
|
222
|
+
if (!fieldName || !fields[fieldName]) return null;
|
|
223
|
+
if (excludedFields?.has(fieldName)) return null;
|
|
224
|
+
const fieldDef = fields[fieldName];
|
|
225
|
+
return /* @__PURE__ */ jsx(FieldRenderer, {
|
|
226
|
+
fieldName,
|
|
227
|
+
fieldDef,
|
|
228
|
+
collection,
|
|
229
|
+
mode,
|
|
230
|
+
registry,
|
|
231
|
+
fieldPrefix,
|
|
232
|
+
allCollectionsConfig,
|
|
233
|
+
entityMeta,
|
|
234
|
+
className: typeof item === "object" && "className" in item ? item.className : void 0,
|
|
235
|
+
renderEmbeddedFields: ({ embeddedCollection, embeddedCollectionConfig, fullFieldName, index: embeddedIndex }) => /* @__PURE__ */ jsx(AutoFormFields, {
|
|
236
|
+
collection: embeddedCollection,
|
|
237
|
+
mode: "collection",
|
|
238
|
+
config: embeddedCollectionConfig,
|
|
493
239
|
registry,
|
|
494
|
-
fieldPrefix
|
|
495
|
-
allCollectionsConfig
|
|
496
|
-
excludedFields,
|
|
497
|
-
entityMeta,
|
|
498
|
-
formValues,
|
|
499
|
-
resolveText
|
|
240
|
+
fieldPrefix: `${fullFieldName}.${embeddedIndex}`,
|
|
241
|
+
allCollectionsConfig
|
|
500
242
|
})
|
|
501
|
-
},
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
$[22] = fieldPrefix;
|
|
507
|
-
$[23] = fields;
|
|
508
|
-
$[24] = formValues;
|
|
509
|
-
$[25] = mode;
|
|
510
|
-
$[26] = registry;
|
|
511
|
-
$[27] = resolveText;
|
|
512
|
-
$[28] = t7;
|
|
513
|
-
} else t7 = $[28];
|
|
514
|
-
t3 = /* @__PURE__ */ jsxs(Tabs, {
|
|
515
|
-
defaultValue: defaultTab,
|
|
516
|
-
children: [/* @__PURE__ */ jsx(TabsList, {
|
|
517
|
-
className: "w-full",
|
|
518
|
-
children: visibleTabs.map(t6)
|
|
519
|
-
}), visibleTabs.map(t7)]
|
|
520
|
-
});
|
|
521
|
-
}
|
|
522
|
-
$[0] = allCollectionsConfig;
|
|
523
|
-
$[1] = collection;
|
|
524
|
-
$[2] = entityMeta;
|
|
525
|
-
$[3] = excludedFields;
|
|
526
|
-
$[4] = fieldPrefix;
|
|
527
|
-
$[5] = fields;
|
|
528
|
-
$[6] = formValues;
|
|
529
|
-
$[7] = mode;
|
|
530
|
-
$[8] = registry;
|
|
531
|
-
$[9] = resolveText;
|
|
532
|
-
$[10] = tabsLayout.tabs;
|
|
533
|
-
$[11] = t3;
|
|
534
|
-
$[12] = t4;
|
|
535
|
-
} else {
|
|
536
|
-
t3 = $[11];
|
|
537
|
-
t4 = $[12];
|
|
538
|
-
}
|
|
539
|
-
if (t4 !== Symbol.for("react.early_return_sentinel")) return t4;
|
|
540
|
-
return t3;
|
|
541
|
-
}
|
|
542
|
-
/**
|
|
543
|
-
* Render sidebar content
|
|
544
|
-
*/
|
|
545
|
-
function SidebarRenderer(t0) {
|
|
546
|
-
const $ = c(11);
|
|
547
|
-
const { sidebar, fields, collection, mode: t1, registry, fieldPrefix, allCollectionsConfig, entityMeta, formValues, resolveText } = t0;
|
|
548
|
-
const mode = t1 === void 0 ? "collection" : t1;
|
|
549
|
-
let t2;
|
|
550
|
-
if ($[0] !== allCollectionsConfig || $[1] !== collection || $[2] !== entityMeta || $[3] !== fieldPrefix || $[4] !== fields || $[5] !== formValues || $[6] !== mode || $[7] !== registry || $[8] !== resolveText || $[9] !== sidebar.fields) {
|
|
551
|
-
t2 = /* @__PURE__ */ jsx(FieldLayoutItems, {
|
|
552
|
-
fieldItems: sidebar.fields,
|
|
243
|
+
}, fieldName);
|
|
244
|
+
})
|
|
245
|
+
});
|
|
246
|
+
return /* @__PURE__ */ jsx(FieldLayoutItems, {
|
|
247
|
+
fieldItems: section.fields,
|
|
553
248
|
fields,
|
|
554
249
|
collection,
|
|
555
250
|
mode,
|
|
556
251
|
registry,
|
|
557
252
|
fieldPrefix,
|
|
558
253
|
allCollectionsConfig,
|
|
254
|
+
excludedFields,
|
|
559
255
|
entityMeta,
|
|
560
256
|
formValues,
|
|
561
257
|
resolveText
|
|
562
258
|
});
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
259
|
+
};
|
|
260
|
+
const content = renderSectionFields();
|
|
261
|
+
if (!content) return null;
|
|
262
|
+
const header = section.label || section.description ? /* @__PURE__ */ jsxs("div", {
|
|
263
|
+
className: "mb-4",
|
|
264
|
+
children: [section.label && /* @__PURE__ */ jsx("h3", {
|
|
265
|
+
className: "qa-form-fields__section-title text-lg font-semibold",
|
|
266
|
+
children: resolveText(section.label, "", formValues)
|
|
267
|
+
}), section.description && /* @__PURE__ */ jsx("p", {
|
|
268
|
+
className: "text-muted-foreground mt-1 text-sm text-pretty",
|
|
269
|
+
children: resolveText(section.description, "", formValues)
|
|
270
|
+
})]
|
|
271
|
+
}) : null;
|
|
272
|
+
if (wrapper === "collapsible") {
|
|
273
|
+
const value = `section-${index}`;
|
|
274
|
+
return /* @__PURE__ */ jsx(Accordion, {
|
|
275
|
+
defaultValue: section.defaultCollapsed !== true ? [value] : [],
|
|
276
|
+
className: "w-full",
|
|
277
|
+
children: /* @__PURE__ */ jsxs(AccordionItem, {
|
|
278
|
+
value,
|
|
279
|
+
className: "border-transparent px-4",
|
|
280
|
+
children: [/* @__PURE__ */ jsx(AccordionTrigger, {
|
|
281
|
+
className: "hover:no-underline",
|
|
282
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
283
|
+
className: "font-semibold",
|
|
284
|
+
children: resolveText(section.label, "Section", formValues)
|
|
285
|
+
})
|
|
286
|
+
}), /* @__PURE__ */ jsxs(AccordionContent, {
|
|
287
|
+
className: "pt-2 pb-4",
|
|
288
|
+
children: [section.description && /* @__PURE__ */ jsx("p", {
|
|
289
|
+
className: "text-muted-foreground mb-4 text-sm text-pretty",
|
|
290
|
+
children: resolveText(section.description, "", formValues)
|
|
291
|
+
}), content]
|
|
292
|
+
})]
|
|
293
|
+
})
|
|
294
|
+
}, value);
|
|
295
|
+
}
|
|
296
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
297
|
+
className: cn("qa-form-fields__section space-y-4", section.className),
|
|
298
|
+
children: [header, content]
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Render tabs layout
|
|
303
|
+
*/
|
|
304
|
+
function TabsLayoutRenderer({ tabsLayout, fields, collection, mode = "collection", registry, fieldPrefix, allCollectionsConfig, excludedFields, entityMeta, formValues, resolveText }) {
|
|
305
|
+
const visibleTabs = tabsLayout.tabs.filter((tab) => !resolveValue(tab.hidden, formValues, false));
|
|
306
|
+
if (!visibleTabs.length) return null;
|
|
307
|
+
const defaultTab = visibleTabs[0]?.id;
|
|
308
|
+
return /* @__PURE__ */ jsxs(Tabs, {
|
|
309
|
+
defaultValue: defaultTab,
|
|
310
|
+
children: [/* @__PURE__ */ jsx(TabsList, {
|
|
311
|
+
className: "w-full",
|
|
312
|
+
children: visibleTabs.map((tab) => /* @__PURE__ */ jsxs(TabsTrigger, {
|
|
313
|
+
value: tab.id,
|
|
314
|
+
className: "flex-1",
|
|
315
|
+
children: [resolveIconElement(tab.icon, { className: "size-3.5" }), resolveText(tab.label, tab.id, formValues)]
|
|
316
|
+
}, tab.id))
|
|
317
|
+
}), visibleTabs.map((tab) => /* @__PURE__ */ jsx(TabsContent, {
|
|
318
|
+
value: tab.id,
|
|
319
|
+
className: "mt-4",
|
|
320
|
+
children: /* @__PURE__ */ jsx(FieldLayoutItems, {
|
|
321
|
+
fieldItems: tab.fields,
|
|
322
|
+
fields,
|
|
323
|
+
collection,
|
|
324
|
+
mode,
|
|
325
|
+
registry,
|
|
326
|
+
fieldPrefix,
|
|
327
|
+
allCollectionsConfig,
|
|
328
|
+
excludedFields,
|
|
329
|
+
entityMeta,
|
|
330
|
+
formValues,
|
|
331
|
+
resolveText
|
|
332
|
+
})
|
|
333
|
+
}, tab.id))]
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Render sidebar content
|
|
338
|
+
*/
|
|
339
|
+
function SidebarRenderer({ sidebar, fields, collection, mode = "collection", registry, fieldPrefix, allCollectionsConfig, entityMeta, formValues, resolveText }) {
|
|
340
|
+
return /* @__PURE__ */ jsx(FieldLayoutItems, {
|
|
341
|
+
fieldItems: sidebar.fields,
|
|
342
|
+
fields,
|
|
343
|
+
collection,
|
|
344
|
+
mode,
|
|
345
|
+
registry,
|
|
346
|
+
fieldPrefix,
|
|
347
|
+
allCollectionsConfig,
|
|
348
|
+
entityMeta,
|
|
349
|
+
formValues,
|
|
350
|
+
resolveText
|
|
351
|
+
});
|
|
576
352
|
}
|
|
577
353
|
/**
|
|
578
354
|
* Extract field names from field layout items recursively
|
|
@@ -609,54 +385,15 @@ function extractFieldNamesFromFieldItems(fieldItems) {
|
|
|
609
385
|
* Supports recursive tabs/sections nesting and auto-generates
|
|
610
386
|
* field list when no form config is defined.
|
|
611
387
|
*/
|
|
612
|
-
function AutoFormFields(
|
|
613
|
-
const $ = c(55);
|
|
614
|
-
const { collection, mode: t1, config, registry, fieldResolver, fieldPrefix, allCollectionsConfig } = t0;
|
|
615
|
-
const mode = t1 === void 0 ? "collection" : t1;
|
|
388
|
+
function AutoFormFields({ app: _cms, collection, mode = "collection", config, registry, fieldResolver, fieldPrefix, allCollectionsConfig }) {
|
|
616
389
|
const isActionForm = collection === "__action__";
|
|
617
|
-
const
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
} else t4 = $[1];
|
|
625
|
-
let t5;
|
|
626
|
-
if ($[2] !== t2 || $[3] !== t4) {
|
|
627
|
-
t5 = {
|
|
628
|
-
fallbackFields: t2,
|
|
629
|
-
schemaQueryOptions: t4
|
|
630
|
-
};
|
|
631
|
-
$[2] = t2;
|
|
632
|
-
$[3] = t4;
|
|
633
|
-
$[4] = t5;
|
|
634
|
-
} else t5 = $[4];
|
|
635
|
-
const collectionResult = useCollectionFields(mode === "collection" ? collection : "", t5);
|
|
636
|
-
const t6 = mode === "global";
|
|
637
|
-
let t7;
|
|
638
|
-
if ($[5] !== t6) {
|
|
639
|
-
t7 = { schemaQueryOptions: { enabled: t6 } };
|
|
640
|
-
$[5] = t6;
|
|
641
|
-
$[6] = t7;
|
|
642
|
-
} else t7 = $[6];
|
|
643
|
-
const globalResult = useGlobalFields(mode === "global" ? collection : "", t7);
|
|
644
|
-
const t8 = mode === "collection" && !isActionForm;
|
|
645
|
-
let t9;
|
|
646
|
-
if ($[7] !== t8) {
|
|
647
|
-
t9 = { enabled: t8 };
|
|
648
|
-
$[7] = t8;
|
|
649
|
-
$[8] = t9;
|
|
650
|
-
} else t9 = $[8];
|
|
651
|
-
const { data: collectionMeta } = useCollectionMeta(collection, t9);
|
|
652
|
-
const t10 = mode === "global";
|
|
653
|
-
let t11;
|
|
654
|
-
if ($[9] !== t10) {
|
|
655
|
-
t11 = { enabled: t10 };
|
|
656
|
-
$[9] = t10;
|
|
657
|
-
$[10] = t11;
|
|
658
|
-
} else t11 = $[10];
|
|
659
|
-
const { data: globalMeta } = useGlobalMeta(collection, t11);
|
|
390
|
+
const collectionResult = useCollectionFields(mode === "collection" ? collection : "", {
|
|
391
|
+
fallbackFields: mode === "collection" ? config?.fields : void 0,
|
|
392
|
+
schemaQueryOptions: { enabled: mode === "collection" && !isActionForm }
|
|
393
|
+
});
|
|
394
|
+
const globalResult = useGlobalFields(mode === "global" ? collection : "", { schemaQueryOptions: { enabled: mode === "global" } });
|
|
395
|
+
const { data: collectionMeta } = useCollectionMeta(collection, { enabled: mode === "collection" && !isActionForm });
|
|
396
|
+
const { data: globalMeta } = useGlobalMeta(collection, { enabled: mode === "global" });
|
|
660
397
|
const resolvedFields = mode === "global" ? {
|
|
661
398
|
...globalResult.fields,
|
|
662
399
|
...config?.fields
|
|
@@ -666,104 +403,44 @@ function AutoFormFields(t0) {
|
|
|
666
403
|
const form = useFormContext();
|
|
667
404
|
const resolveText = useResolveText();
|
|
668
405
|
const fields = resolvedFields || {};
|
|
669
|
-
const
|
|
670
|
-
let t13;
|
|
671
|
-
if ($[11] !== t12) {
|
|
672
|
-
t13 = mapFormSchemaToConfig(t12);
|
|
673
|
-
$[11] = t12;
|
|
674
|
-
$[12] = t13;
|
|
675
|
-
} else t13 = $[12];
|
|
676
|
-
const schemaFormConfig = t13;
|
|
406
|
+
const schemaFormConfig = mapFormSchemaToConfig(schema?.admin?.form);
|
|
677
407
|
const formConfig = (config?.form)?.["~config"] ?? config?.form ?? schemaFormConfig;
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
t15$2 = form.getValues() ?? {};
|
|
684
|
-
$[13] = form;
|
|
685
|
-
$[14] = t15$2;
|
|
686
|
-
} else t15$2 = $[14];
|
|
687
|
-
t14 = t15$2;
|
|
688
|
-
break bb0;
|
|
689
|
-
}
|
|
690
|
-
let t15$1;
|
|
691
|
-
if ($[15] !== fieldPrefix || $[16] !== form) {
|
|
692
|
-
t15$1 = form.getValues(fieldPrefix) ?? {};
|
|
693
|
-
$[15] = fieldPrefix;
|
|
694
|
-
$[16] = form;
|
|
695
|
-
$[17] = t15$1;
|
|
696
|
-
} else t15$1 = $[17];
|
|
697
|
-
t14 = t15$1;
|
|
698
|
-
}
|
|
699
|
-
const initialScopedValues = t14;
|
|
700
|
-
let t15;
|
|
701
|
-
if ($[18] !== fieldPrefix || $[19] !== formConfig || $[20] !== initialScopedValues) {
|
|
408
|
+
const initialScopedValues = React.useMemo(() => {
|
|
409
|
+
if (!fieldPrefix) return form.getValues() ?? {};
|
|
410
|
+
return form.getValues(fieldPrefix) ?? {};
|
|
411
|
+
}, [form, fieldPrefix]);
|
|
412
|
+
const layoutWatchDeps = React.useMemo(() => {
|
|
702
413
|
const deps = /* @__PURE__ */ new Set();
|
|
703
414
|
collectLayoutDependencies(formConfig?.fields, initialScopedValues, deps);
|
|
704
415
|
if (formConfig?.sidebar?.fields) collectLayoutDependencies(formConfig.sidebar.fields, initialScopedValues, deps);
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
const
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
$[25] = t18;
|
|
725
|
-
} else t18 = $[25];
|
|
726
|
-
useWatch(t18);
|
|
727
|
-
let t19;
|
|
728
|
-
bb1: {
|
|
729
|
-
if (!fieldPrefix) {
|
|
730
|
-
let t20$2;
|
|
731
|
-
if ($[26] !== form) {
|
|
732
|
-
t20$2 = form.getValues() ?? {};
|
|
733
|
-
$[26] = form;
|
|
734
|
-
$[27] = t20$2;
|
|
735
|
-
} else t20$2 = $[27];
|
|
736
|
-
t19 = t20$2;
|
|
737
|
-
break bb1;
|
|
738
|
-
}
|
|
739
|
-
let t20$1;
|
|
740
|
-
if ($[28] !== fieldPrefix || $[29] !== form) {
|
|
741
|
-
t20$1 = form.getValues(fieldPrefix) ?? {};
|
|
742
|
-
$[28] = fieldPrefix;
|
|
743
|
-
$[29] = form;
|
|
744
|
-
$[30] = t20$1;
|
|
745
|
-
} else t20$1 = $[30];
|
|
746
|
-
t19 = t20$1;
|
|
747
|
-
}
|
|
748
|
-
const formValues = t19;
|
|
416
|
+
return scopeDependencies([...deps], fieldPrefix);
|
|
417
|
+
}, [
|
|
418
|
+
formConfig,
|
|
419
|
+
initialScopedValues,
|
|
420
|
+
fieldPrefix
|
|
421
|
+
]);
|
|
422
|
+
const watchedLayoutDeps = useWatch({
|
|
423
|
+
control: form.control,
|
|
424
|
+
name: layoutWatchDeps,
|
|
425
|
+
disabled: layoutWatchDeps.length === 0
|
|
426
|
+
});
|
|
427
|
+
const formValues = React.useMemo(() => {
|
|
428
|
+
if (!fieldPrefix) return form.getValues() ?? {};
|
|
429
|
+
return form.getValues(fieldPrefix) ?? {};
|
|
430
|
+
}, [
|
|
431
|
+
form,
|
|
432
|
+
fieldPrefix,
|
|
433
|
+
watchedLayoutDeps
|
|
434
|
+
]);
|
|
749
435
|
const allFieldNames = Object.keys(fields);
|
|
750
436
|
const sidebarFieldNames = formConfig?.sidebar ? extractFieldNamesFromFieldItems(formConfig.sidebar.fields) : /* @__PURE__ */ new Set();
|
|
751
|
-
if (fieldResolver) {
|
|
752
|
-
|
|
437
|
+
if (fieldResolver) return /* @__PURE__ */ jsx("div", {
|
|
438
|
+
className: "space-y-4",
|
|
439
|
+
children: allFieldNames.map((fieldName) => {
|
|
753
440
|
const fullFieldName = getFullFieldName(fieldName, fieldPrefix);
|
|
754
441
|
return /* @__PURE__ */ jsx(React.Fragment, { children: fieldResolver(fullFieldName, fields[fieldName]) }, fullFieldName);
|
|
755
|
-
})
|
|
756
|
-
|
|
757
|
-
if ($[31] !== renderedFields) {
|
|
758
|
-
t20$1 = /* @__PURE__ */ jsx("div", {
|
|
759
|
-
className: "space-y-4",
|
|
760
|
-
children: renderedFields
|
|
761
|
-
});
|
|
762
|
-
$[31] = renderedFields;
|
|
763
|
-
$[32] = t20$1;
|
|
764
|
-
} else t20$1 = $[32];
|
|
765
|
-
return t20$1;
|
|
766
|
-
}
|
|
442
|
+
})
|
|
443
|
+
});
|
|
767
444
|
let mainContent = null;
|
|
768
445
|
if (formConfig?.fields?.length) mainContent = /* @__PURE__ */ jsx(FieldLayoutItems, {
|
|
769
446
|
fieldItems: formConfig.fields,
|
|
@@ -791,32 +468,15 @@ function AutoFormFields(t0) {
|
|
|
791
468
|
entityMeta
|
|
792
469
|
});
|
|
793
470
|
}
|
|
794
|
-
if (formConfig?.sidebar?.fields?.length && formConfig?.sidebar) {
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
$[33] = t20$1;
|
|
800
|
-
$[34] = t21;
|
|
801
|
-
} else t21 = $[34];
|
|
802
|
-
let t22;
|
|
803
|
-
if ($[35] !== mainContent) {
|
|
804
|
-
t22 = /* @__PURE__ */ jsx("div", {
|
|
471
|
+
if (formConfig?.sidebar?.fields?.length && formConfig?.sidebar) return /* @__PURE__ */ jsx("div", {
|
|
472
|
+
className: "qa-form-fields @container w-full",
|
|
473
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
474
|
+
className: cn("qa-form-fields__layout flex flex-col-reverse gap-6 @2xl:flex-row", (formConfig.sidebar.position || "right") === "left" && "@2xl:flex-row-reverse"),
|
|
475
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
805
476
|
className: "qa-form-fields__main min-w-0 flex-1",
|
|
806
477
|
children: mainContent
|
|
807
|
-
})
|
|
808
|
-
|
|
809
|
-
$[36] = t22;
|
|
810
|
-
} else t22 = $[36];
|
|
811
|
-
let t23;
|
|
812
|
-
if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
|
|
813
|
-
t23 = cn("qa-form-fields__sidebar", "w-full @max-2xl:pb-2 @2xl:max-w-[18rem] @2xl:pl-1");
|
|
814
|
-
$[37] = t23;
|
|
815
|
-
} else t23 = $[37];
|
|
816
|
-
let t24;
|
|
817
|
-
if ($[38] !== allCollectionsConfig || $[39] !== collection || $[40] !== entityMeta || $[41] !== fieldPrefix || $[42] !== fields || $[43] !== formConfig.sidebar || $[44] !== formValues || $[45] !== mode || $[46] !== registry || $[47] !== resolveText) {
|
|
818
|
-
t24 = /* @__PURE__ */ jsx("aside", {
|
|
819
|
-
className: t23,
|
|
478
|
+
}), /* @__PURE__ */ jsx("aside", {
|
|
479
|
+
className: cn("qa-form-fields__sidebar", "w-full @max-2xl:pb-2 @2xl:max-w-[18rem] @2xl:pl-1"),
|
|
820
480
|
children: /* @__PURE__ */ jsx("div", {
|
|
821
481
|
className: "bg-surface-low/45 space-y-4 rounded-md px-3 py-3 @2xl:sticky @2xl:top-4 @2xl:h-auto",
|
|
822
482
|
children: /* @__PURE__ */ jsx(SidebarRenderer, {
|
|
@@ -832,45 +492,13 @@ function AutoFormFields(t0) {
|
|
|
832
492
|
resolveText
|
|
833
493
|
})
|
|
834
494
|
})
|
|
835
|
-
})
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
$[44] = formValues;
|
|
843
|
-
$[45] = mode;
|
|
844
|
-
$[46] = registry;
|
|
845
|
-
$[47] = resolveText;
|
|
846
|
-
$[48] = t24;
|
|
847
|
-
} else t24 = $[48];
|
|
848
|
-
let t25;
|
|
849
|
-
if ($[49] !== t21 || $[50] !== t22 || $[51] !== t24) {
|
|
850
|
-
t25 = /* @__PURE__ */ jsx("div", {
|
|
851
|
-
className: "qa-form-fields @container w-full",
|
|
852
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
853
|
-
className: t21,
|
|
854
|
-
children: [t22, t24]
|
|
855
|
-
})
|
|
856
|
-
});
|
|
857
|
-
$[49] = t21;
|
|
858
|
-
$[50] = t22;
|
|
859
|
-
$[51] = t24;
|
|
860
|
-
$[52] = t25;
|
|
861
|
-
} else t25 = $[52];
|
|
862
|
-
return t25;
|
|
863
|
-
}
|
|
864
|
-
let t20;
|
|
865
|
-
if ($[53] !== mainContent) {
|
|
866
|
-
t20 = /* @__PURE__ */ jsx("div", {
|
|
867
|
-
className: "qa-form-fields @container",
|
|
868
|
-
children: mainContent
|
|
869
|
-
});
|
|
870
|
-
$[53] = mainContent;
|
|
871
|
-
$[54] = t20;
|
|
872
|
-
} else t20 = $[54];
|
|
873
|
-
return t20;
|
|
495
|
+
})]
|
|
496
|
+
})
|
|
497
|
+
});
|
|
498
|
+
return /* @__PURE__ */ jsx("div", {
|
|
499
|
+
className: "qa-form-fields @container",
|
|
500
|
+
children: mainContent
|
|
501
|
+
});
|
|
874
502
|
}
|
|
875
503
|
|
|
876
504
|
//#endregion
|