@questpie/admin 3.2.3 → 3.2.5
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 +106 -220
- 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 +107 -313
- 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 -182
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs +8 -19
- package/dist/client/components/fields/rich-text-editor/image-upload.mjs +13 -29
- package/dist/client/components/fields/rich-text-editor/index.mjs +196 -530
- 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 +39 -74
- 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 +306 -611
- 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 +177 -494
- package/dist/client/components/preview/live-preview-mode.mjs +240 -438
- 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 +200 -559
- package/dist/client/components/primitives/select-single.mjs +165 -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.d.mts +4 -0
- package/dist/client/contexts/focus-context.mjs +87 -150
- 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.d.mts +2 -2
- package/dist/client/preview/block-scope-context.mjs +14 -36
- package/dist/client/preview/diff.mjs +110 -0
- 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 +166 -409
- package/dist/client/preview/use-collection-preview.mjs +135 -201
- 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.d.mts +2 -2
- package/dist/client/scope/picker.mjs +86 -321
- package/dist/client/scope/provider.d.mts +2 -2
- package/dist/client/scope/provider.mjs +8 -17
- 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.mjs +128 -453
- 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 -400
- package/dist/client/views/collection/cells/complex-cells.mjs +183 -611
- package/dist/client/views/collection/cells/primitive-cells.mjs +109 -363
- 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 +11 -24
- package/dist/client/views/collection/form-view.mjs +288 -560
- package/dist/client/views/collection/table-view.mjs +239 -469
- package/dist/client/views/collection/view-skeletons.mjs +112 -237
- package/dist/client/views/common/global-search.mjs +241 -543
- 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 +478 -1298
- 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 +457 -1289
- 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.mjs +95 -290
- package/dist/client/views/pages/dashboard-page.mjs +11 -57
- package/dist/client/views/pages/forgot-password-page.mjs +31 -83
- package/dist/client/views/pages/invite-page.mjs +35 -90
- 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.d.mts +2 -2
- package/dist/components/rich-text/rich-text-renderer.mjs +9 -33
- package/dist/server/modules/admin/collections/account.d.mts +50 -50
- package/dist/server/modules/admin/collections/admin-locks.d.mts +54 -54
- 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 +34 -34
- package/dist/server/modules/admin/collections/session.d.mts +42 -42
- package/dist/server/modules/admin/collections/user.d.mts +53 -53
- package/dist/server/modules/admin/collections/verification.d.mts +36 -36
- package/dist/server/modules/admin/index.d.mts +21 -20
- 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 +27 -27
- package/package.json +3 -5
|
@@ -8,7 +8,6 @@ import { buildValidationSchema } from "../../builder/validation.mjs";
|
|
|
8
8
|
import { useValidationErrorMap } from "../../hooks/use-validation-error-map.mjs";
|
|
9
9
|
import { AutoFormFields } from "../../views/collection/auto-form-fields.mjs";
|
|
10
10
|
import { ResponsiveDialog, ResponsiveDialogContent, ResponsiveDialogDescription, ResponsiveDialogFooter, ResponsiveDialogHeader, ResponsiveDialogTitle } from "../ui/responsive-dialog.mjs";
|
|
11
|
-
import { c } from "react/compiler-runtime";
|
|
12
11
|
import * as React from "react";
|
|
13
12
|
import { useQueryClient } from "@tanstack/react-query";
|
|
14
13
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -58,403 +57,180 @@ function createActionFormResolver(fields, errorMap) {
|
|
|
58
57
|
* Uses buildValidationSchema for automatic Zod schema generation
|
|
59
58
|
* from field definitions, providing full field system support.
|
|
60
59
|
*/
|
|
61
|
-
function FormDialogContent(
|
|
62
|
-
const $ = c(66);
|
|
63
|
-
const { action, ctx, onClose } = t0;
|
|
60
|
+
function FormDialogContent({ action, ctx, onClose }) {
|
|
64
61
|
const { config } = action.handler;
|
|
65
62
|
const resolveText = useResolveText();
|
|
66
63
|
const { t } = useTranslation();
|
|
67
64
|
const errorMap = useValidationErrorMap();
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
let t1;
|
|
79
|
-
if ($[2] !== config.defaultValues) {
|
|
80
|
-
t1 = config.defaultValues || {};
|
|
81
|
-
$[2] = config.defaultValues;
|
|
82
|
-
$[3] = t1;
|
|
83
|
-
} else t1 = $[3];
|
|
84
|
-
let t2;
|
|
85
|
-
if ($[4] !== t1 || $[5] !== values) {
|
|
86
|
-
t2 = {
|
|
87
|
-
...values,
|
|
88
|
-
...t1
|
|
89
|
-
};
|
|
90
|
-
$[4] = t1;
|
|
91
|
-
$[5] = values;
|
|
92
|
-
$[6] = t2;
|
|
93
|
-
} else t2 = $[6];
|
|
94
|
-
const defaultValues = t2;
|
|
95
|
-
let t3;
|
|
96
|
-
if ($[7] !== config.fields || $[8] !== errorMap) {
|
|
97
|
-
t3 = createActionFormResolver(config.fields, errorMap);
|
|
98
|
-
$[7] = config.fields;
|
|
99
|
-
$[8] = errorMap;
|
|
100
|
-
$[9] = t3;
|
|
101
|
-
} else t3 = $[9];
|
|
102
|
-
const resolver = t3;
|
|
103
|
-
let t4;
|
|
104
|
-
if ($[10] !== defaultValues || $[11] !== resolver) {
|
|
105
|
-
t4 = {
|
|
106
|
-
defaultValues,
|
|
107
|
-
resolver
|
|
108
|
-
};
|
|
109
|
-
$[10] = defaultValues;
|
|
110
|
-
$[11] = resolver;
|
|
111
|
-
$[12] = t4;
|
|
112
|
-
} else t4 = $[12];
|
|
113
|
-
const form = useForm(t4);
|
|
114
|
-
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
|
115
|
-
let t5;
|
|
116
|
-
if ($[13] !== config || $[14] !== ctx || $[15] !== form || $[16] !== onClose || $[17] !== t) {
|
|
117
|
-
let t6$1;
|
|
118
|
-
if ($[19] !== config || $[20] !== ctx || $[21] !== onClose || $[22] !== t) {
|
|
119
|
-
t6$1 = async (data) => {
|
|
120
|
-
setIsSubmitting(true);
|
|
121
|
-
const submitPromise = async () => {
|
|
122
|
-
await config.onSubmit(data, ctx);
|
|
123
|
-
return data;
|
|
124
|
-
};
|
|
125
|
-
toast.promise(submitPromise(), {
|
|
126
|
-
loading: t("toast.processing"),
|
|
127
|
-
success: () => {
|
|
128
|
-
onClose();
|
|
129
|
-
return t("toast.actionSuccess");
|
|
130
|
-
},
|
|
131
|
-
error: (error) => error instanceof Error ? error.message : t("toast.actionFailed"),
|
|
132
|
-
finally: () => {
|
|
133
|
-
setIsSubmitting(false);
|
|
134
|
-
}
|
|
135
|
-
});
|
|
65
|
+
const form = useForm({
|
|
66
|
+
defaultValues: React.useMemo(() => {
|
|
67
|
+
const values = {};
|
|
68
|
+
for (const [fieldName, fieldDef] of Object.entries(config.fields)) {
|
|
69
|
+
const options = fieldDef["~options"];
|
|
70
|
+
if (options?.defaultValue !== void 0) values[fieldName] = options.defaultValue;
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
...values,
|
|
74
|
+
...config.defaultValues || {}
|
|
136
75
|
};
|
|
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
|
-
if ($[26] !== config.title || $[27] !== resolveText) {
|
|
162
|
-
t8 = resolveText(config.title);
|
|
163
|
-
$[26] = config.title;
|
|
164
|
-
$[27] = resolveText;
|
|
165
|
-
$[28] = t8;
|
|
166
|
-
} else t8 = $[28];
|
|
167
|
-
let t9;
|
|
168
|
-
if ($[29] !== t8) {
|
|
169
|
-
t9 = /* @__PURE__ */ jsx(ResponsiveDialogTitle, { children: t8 });
|
|
170
|
-
$[29] = t8;
|
|
171
|
-
$[30] = t9;
|
|
172
|
-
} else t9 = $[30];
|
|
173
|
-
let t10;
|
|
174
|
-
if ($[31] !== config.description || $[32] !== resolveText) {
|
|
175
|
-
t10 = config.description && /* @__PURE__ */ jsx(ResponsiveDialogDescription, { children: resolveText(config.description) });
|
|
176
|
-
$[31] = config.description;
|
|
177
|
-
$[32] = resolveText;
|
|
178
|
-
$[33] = t10;
|
|
179
|
-
} else t10 = $[33];
|
|
180
|
-
let t11;
|
|
181
|
-
if ($[34] !== t10 || $[35] !== t9) {
|
|
182
|
-
t11 = /* @__PURE__ */ jsxs(ResponsiveDialogHeader, { children: [t9, t10] });
|
|
183
|
-
$[34] = t10;
|
|
184
|
-
$[35] = t9;
|
|
185
|
-
$[36] = t11;
|
|
186
|
-
} else t11 = $[36];
|
|
187
|
-
let t12;
|
|
188
|
-
if ($[37] !== collectionConfig) {
|
|
189
|
-
t12 = /* @__PURE__ */ jsx(AutoFormFields, {
|
|
190
|
-
collection: "__action__",
|
|
191
|
-
config: collectionConfig
|
|
192
|
-
});
|
|
193
|
-
$[37] = collectionConfig;
|
|
194
|
-
$[38] = t12;
|
|
195
|
-
} else t12 = $[38];
|
|
196
|
-
let t13;
|
|
197
|
-
if ($[39] !== config.cancelLabel || $[40] !== resolveText || $[41] !== t) {
|
|
198
|
-
t13 = resolveText(config.cancelLabel, t("common.cancel"));
|
|
199
|
-
$[39] = config.cancelLabel;
|
|
200
|
-
$[40] = resolveText;
|
|
201
|
-
$[41] = t;
|
|
202
|
-
$[42] = t13;
|
|
203
|
-
} else t13 = $[42];
|
|
204
|
-
let t14;
|
|
205
|
-
if ($[43] !== isSubmitting || $[44] !== onClose || $[45] !== t13) {
|
|
206
|
-
t14 = /* @__PURE__ */ jsx(Button, {
|
|
207
|
-
type: "button",
|
|
208
|
-
variant: "outline",
|
|
209
|
-
onClick: onClose,
|
|
210
|
-
disabled: isSubmitting,
|
|
211
|
-
children: t13
|
|
212
|
-
});
|
|
213
|
-
$[43] = isSubmitting;
|
|
214
|
-
$[44] = onClose;
|
|
215
|
-
$[45] = t13;
|
|
216
|
-
$[46] = t14;
|
|
217
|
-
} else t14 = $[46];
|
|
218
|
-
let t15;
|
|
219
|
-
if ($[47] !== config.submitLabel || $[48] !== isSubmitting || $[49] !== resolveText || $[50] !== t) {
|
|
220
|
-
t15 = isSubmitting ? t("common.loading") : resolveText(config.submitLabel, t("common.submit"));
|
|
221
|
-
$[47] = config.submitLabel;
|
|
222
|
-
$[48] = isSubmitting;
|
|
223
|
-
$[49] = resolveText;
|
|
224
|
-
$[50] = t;
|
|
225
|
-
$[51] = t15;
|
|
226
|
-
} else t15 = $[51];
|
|
227
|
-
let t16;
|
|
228
|
-
if ($[52] !== isSubmitting || $[53] !== t15) {
|
|
229
|
-
t16 = /* @__PURE__ */ jsx(Button, {
|
|
230
|
-
type: "submit",
|
|
231
|
-
disabled: isSubmitting,
|
|
232
|
-
children: t15
|
|
233
|
-
});
|
|
234
|
-
$[52] = isSubmitting;
|
|
235
|
-
$[53] = t15;
|
|
236
|
-
$[54] = t16;
|
|
237
|
-
} else t16 = $[54];
|
|
238
|
-
let t17;
|
|
239
|
-
if ($[55] !== t14 || $[56] !== t16) {
|
|
240
|
-
t17 = /* @__PURE__ */ jsxs(ResponsiveDialogFooter, {
|
|
241
|
-
className: "mt-6",
|
|
242
|
-
children: [t14, t16]
|
|
76
|
+
}, [config.fields, config.defaultValues]),
|
|
77
|
+
resolver: React.useMemo(() => {
|
|
78
|
+
return createActionFormResolver(config.fields, errorMap);
|
|
79
|
+
}, [config.fields, errorMap])
|
|
80
|
+
});
|
|
81
|
+
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
|
82
|
+
const handleSubmit = form.handleSubmit(async (data) => {
|
|
83
|
+
setIsSubmitting(true);
|
|
84
|
+
const submitPromise = async () => {
|
|
85
|
+
await config.onSubmit(data, ctx);
|
|
86
|
+
return data;
|
|
87
|
+
};
|
|
88
|
+
toast.promise(submitPromise(), {
|
|
89
|
+
loading: t("toast.processing"),
|
|
90
|
+
success: () => {
|
|
91
|
+
onClose();
|
|
92
|
+
return t("toast.actionSuccess");
|
|
93
|
+
},
|
|
94
|
+
error: (error) => {
|
|
95
|
+
return error instanceof Error ? error.message : t("toast.actionFailed");
|
|
96
|
+
},
|
|
97
|
+
finally: () => {
|
|
98
|
+
setIsSubmitting(false);
|
|
99
|
+
}
|
|
243
100
|
});
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
if ($[58] !== handleSubmit || $[59] !== t12 || $[60] !== t17) {
|
|
250
|
-
t18 = /* @__PURE__ */ jsxs("form", {
|
|
101
|
+
});
|
|
102
|
+
const collectionConfig = React.useMemo(() => ({ fields: config.fields }), [config.fields]);
|
|
103
|
+
return /* @__PURE__ */ jsxs(FormProvider, {
|
|
104
|
+
...form,
|
|
105
|
+
children: [/* @__PURE__ */ jsxs(ResponsiveDialogHeader, { children: [/* @__PURE__ */ jsx(ResponsiveDialogTitle, { children: resolveText(config.title) }), config.description && /* @__PURE__ */ jsx(ResponsiveDialogDescription, { children: resolveText(config.description) })] }), /* @__PURE__ */ jsxs("form", {
|
|
251
106
|
onSubmit: handleSubmit,
|
|
252
107
|
className: "space-y-4",
|
|
253
|
-
children: [
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
108
|
+
children: [/* @__PURE__ */ jsx(AutoFormFields, {
|
|
109
|
+
collection: "__action__",
|
|
110
|
+
config: collectionConfig
|
|
111
|
+
}), /* @__PURE__ */ jsxs(ResponsiveDialogFooter, {
|
|
112
|
+
className: "mt-6",
|
|
113
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
114
|
+
type: "button",
|
|
115
|
+
variant: "outline",
|
|
116
|
+
onClick: onClose,
|
|
117
|
+
disabled: isSubmitting,
|
|
118
|
+
children: resolveText(config.cancelLabel, t("common.cancel"))
|
|
119
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
120
|
+
type: "submit",
|
|
121
|
+
disabled: isSubmitting,
|
|
122
|
+
children: isSubmitting ? t("common.loading") : resolveText(config.submitLabel, t("common.submit"))
|
|
123
|
+
})]
|
|
124
|
+
})]
|
|
125
|
+
})]
|
|
126
|
+
});
|
|
272
127
|
}
|
|
273
128
|
/**
|
|
274
129
|
* Custom Dialog content - renders lazy-loaded component
|
|
275
130
|
*/
|
|
276
|
-
function CustomDialogContent(
|
|
277
|
-
const $ = c(26);
|
|
278
|
-
const { action, ctx, onClose } = t0;
|
|
131
|
+
function CustomDialogContent({ action, ctx, onClose }) {
|
|
279
132
|
const { t } = useTranslation();
|
|
280
133
|
const handler = action.handler;
|
|
281
134
|
const [Component, setComponent] = React.useState(null);
|
|
282
135
|
const [loading, setLoading] = React.useState(true);
|
|
283
136
|
const [error, setError] = React.useState(null);
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
137
|
+
React.useEffect(() => {
|
|
138
|
+
let mounted = true;
|
|
139
|
+
async function loadComponent() {
|
|
140
|
+
try {
|
|
141
|
+
const comp = handler.component;
|
|
142
|
+
if (typeof comp === "function") {
|
|
143
|
+
const lazyComp = comp;
|
|
144
|
+
if (lazyComp._payload !== void 0) {
|
|
145
|
+
const resolved = await lazyComp._payload();
|
|
146
|
+
if (mounted) {
|
|
147
|
+
let comp2;
|
|
148
|
+
if (resolved.default) comp2 = resolved.default;
|
|
149
|
+
else comp2 = resolved;
|
|
150
|
+
setComponent(() => comp2);
|
|
151
|
+
}
|
|
152
|
+
} else {
|
|
153
|
+
const result = comp();
|
|
154
|
+
let hasThen = false;
|
|
155
|
+
if (result != null) {
|
|
156
|
+
if (result.then) hasThen = true;
|
|
157
|
+
}
|
|
158
|
+
if (hasThen) {
|
|
159
|
+
const mod = await result;
|
|
296
160
|
if (mounted) {
|
|
297
161
|
let comp2;
|
|
298
|
-
if (
|
|
299
|
-
else comp2 =
|
|
162
|
+
if (mod.default) comp2 = mod.default;
|
|
163
|
+
else comp2 = mod;
|
|
300
164
|
setComponent(() => comp2);
|
|
301
165
|
}
|
|
302
|
-
} else
|
|
303
|
-
const result = comp();
|
|
304
|
-
let hasThen = false;
|
|
305
|
-
if (result != null) {
|
|
306
|
-
if (result.then) hasThen = true;
|
|
307
|
-
}
|
|
308
|
-
if (hasThen) {
|
|
309
|
-
const mod = await result;
|
|
310
|
-
if (mounted) {
|
|
311
|
-
let comp2_0;
|
|
312
|
-
if (mod.default) comp2_0 = mod.default;
|
|
313
|
-
else comp2_0 = mod;
|
|
314
|
-
setComponent(() => comp2_0);
|
|
315
|
-
}
|
|
316
|
-
} else if (mounted) setComponent(() => comp);
|
|
317
|
-
}
|
|
318
|
-
} else if (mounted) setComponent(() => comp);
|
|
319
|
-
if (mounted) setLoading(false);
|
|
320
|
-
} catch (t3$1) {
|
|
321
|
-
const err = t3$1;
|
|
322
|
-
if (mounted) {
|
|
323
|
-
if (err instanceof Error) setError(err);
|
|
324
|
-
else setError(new Error(t("error.failedToLoad")));
|
|
325
|
-
setLoading(false);
|
|
166
|
+
} else if (mounted) setComponent(() => comp);
|
|
326
167
|
}
|
|
168
|
+
} else if (mounted) setComponent(() => comp);
|
|
169
|
+
if (mounted) setLoading(false);
|
|
170
|
+
} catch (err) {
|
|
171
|
+
if (mounted) {
|
|
172
|
+
if (err instanceof Error) setError(err);
|
|
173
|
+
else setError(new Error(t("error.failedToLoad")));
|
|
174
|
+
setLoading(false);
|
|
327
175
|
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
loadComponent();
|
|
179
|
+
return () => {
|
|
180
|
+
mounted = false;
|
|
332
181
|
};
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
className: "
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
} else t3$1 = $[7];
|
|
382
|
-
let t4$1;
|
|
383
|
-
if ($[8] !== onClose) {
|
|
384
|
-
t4$1 = /* @__PURE__ */ jsx(Button, {
|
|
385
|
-
variant: "outline",
|
|
386
|
-
onClick: onClose,
|
|
387
|
-
className: "mt-4",
|
|
388
|
-
children: "Close"
|
|
389
|
-
});
|
|
390
|
-
$[8] = onClose;
|
|
391
|
-
$[9] = t4$1;
|
|
392
|
-
} else t4$1 = $[9];
|
|
393
|
-
let t5;
|
|
394
|
-
if ($[10] !== t3$1 || $[11] !== t4$1) {
|
|
395
|
-
t5 = /* @__PURE__ */ jsxs("div", {
|
|
396
|
-
className: "p-4 text-center",
|
|
397
|
-
children: [t3$1, t4$1]
|
|
398
|
-
});
|
|
399
|
-
$[10] = t3$1;
|
|
400
|
-
$[11] = t4$1;
|
|
401
|
-
$[12] = t5;
|
|
402
|
-
} else t5 = $[12];
|
|
403
|
-
return t5;
|
|
404
|
-
}
|
|
405
|
-
if (!Component) {
|
|
406
|
-
let t3$1;
|
|
407
|
-
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
408
|
-
t3$1 = /* @__PURE__ */ jsx("p", {
|
|
409
|
-
className: "text-muted-foreground",
|
|
410
|
-
children: "Component not found"
|
|
411
|
-
});
|
|
412
|
-
$[13] = t3$1;
|
|
413
|
-
} else t3$1 = $[13];
|
|
414
|
-
let t4$1;
|
|
415
|
-
if ($[14] !== onClose) {
|
|
416
|
-
t4$1 = /* @__PURE__ */ jsxs("div", {
|
|
417
|
-
className: "p-4 text-center",
|
|
418
|
-
children: [t3$1, /* @__PURE__ */ jsx(Button, {
|
|
419
|
-
variant: "outline",
|
|
420
|
-
onClick: onClose,
|
|
421
|
-
className: "mt-4",
|
|
422
|
-
children: "Close"
|
|
423
|
-
})]
|
|
424
|
-
});
|
|
425
|
-
$[14] = onClose;
|
|
426
|
-
$[15] = t4$1;
|
|
427
|
-
} else t4$1 = $[15];
|
|
428
|
-
return t4$1;
|
|
429
|
-
}
|
|
430
|
-
let t3;
|
|
431
|
-
if ($[16] !== ctx.helpers || $[17] !== onClose) {
|
|
432
|
-
t3 = () => {
|
|
182
|
+
}, [handler.component, t]);
|
|
183
|
+
if (loading) return /* @__PURE__ */ jsxs("div", {
|
|
184
|
+
className: "space-y-4 py-2",
|
|
185
|
+
"aria-busy": "true",
|
|
186
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
187
|
+
className: "space-y-2",
|
|
188
|
+
children: [/* @__PURE__ */ jsx(Skeleton, {
|
|
189
|
+
variant: "text",
|
|
190
|
+
className: "h-4 w-24"
|
|
191
|
+
}), /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-full" })]
|
|
192
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
193
|
+
className: "space-y-2",
|
|
194
|
+
children: [/* @__PURE__ */ jsx(Skeleton, {
|
|
195
|
+
variant: "text",
|
|
196
|
+
className: "h-4 w-32"
|
|
197
|
+
}), /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-full" })]
|
|
198
|
+
})]
|
|
199
|
+
});
|
|
200
|
+
if (error) return /* @__PURE__ */ jsxs("div", {
|
|
201
|
+
className: "p-4 text-center",
|
|
202
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
203
|
+
className: "text-destructive",
|
|
204
|
+
children: error.message
|
|
205
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
206
|
+
variant: "outline",
|
|
207
|
+
onClick: onClose,
|
|
208
|
+
className: "mt-4",
|
|
209
|
+
children: "Close"
|
|
210
|
+
})]
|
|
211
|
+
});
|
|
212
|
+
if (!Component) return /* @__PURE__ */ jsxs("div", {
|
|
213
|
+
className: "p-4 text-center",
|
|
214
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
215
|
+
className: "text-muted-foreground",
|
|
216
|
+
children: "Component not found"
|
|
217
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
218
|
+
variant: "outline",
|
|
219
|
+
onClick: onClose,
|
|
220
|
+
className: "mt-4",
|
|
221
|
+
children: "Close"
|
|
222
|
+
})]
|
|
223
|
+
});
|
|
224
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
225
|
+
item: ctx.item,
|
|
226
|
+
items: ctx.items,
|
|
227
|
+
collection: ctx.collection,
|
|
228
|
+
onClose,
|
|
229
|
+
onSuccess: () => {
|
|
433
230
|
ctx.helpers.refresh();
|
|
434
231
|
onClose();
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
$[17] = onClose;
|
|
438
|
-
$[18] = t3;
|
|
439
|
-
} else t3 = $[18];
|
|
440
|
-
let t4;
|
|
441
|
-
if ($[19] !== Component || $[20] !== ctx.collection || $[21] !== ctx.item || $[22] !== ctx.items || $[23] !== onClose || $[24] !== t3) {
|
|
442
|
-
t4 = /* @__PURE__ */ jsx(Component, {
|
|
443
|
-
item: ctx.item,
|
|
444
|
-
items: ctx.items,
|
|
445
|
-
collection: ctx.collection,
|
|
446
|
-
onClose,
|
|
447
|
-
onSuccess: t3
|
|
448
|
-
});
|
|
449
|
-
$[19] = Component;
|
|
450
|
-
$[20] = ctx.collection;
|
|
451
|
-
$[21] = ctx.item;
|
|
452
|
-
$[22] = ctx.items;
|
|
453
|
-
$[23] = onClose;
|
|
454
|
-
$[24] = t3;
|
|
455
|
-
$[25] = t4;
|
|
456
|
-
} else t4 = $[25];
|
|
457
|
-
return t4;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
458
234
|
}
|
|
459
235
|
/**
|
|
460
236
|
* ActionDialog - Renders dialog-type and form-type actions
|
|
@@ -471,130 +247,56 @@ function CustomDialogContent(t0) {
|
|
|
471
247
|
* />
|
|
472
248
|
* ```
|
|
473
249
|
*/
|
|
474
|
-
function ActionDialog(
|
|
475
|
-
const $ = c(35);
|
|
476
|
-
const { open, onOpenChange, action, collection, item, items, helpers } = t0;
|
|
250
|
+
function ActionDialog({ open, onOpenChange, action, collection, item, items, helpers }) {
|
|
477
251
|
const queryClient = useQueryClient();
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
} else t1 = $[1];
|
|
484
|
-
let t2;
|
|
485
|
-
if ($[2] !== helpers || $[3] !== t1) {
|
|
486
|
-
t2 = {
|
|
252
|
+
const ctx = React.useMemo(() => ({
|
|
253
|
+
item,
|
|
254
|
+
items,
|
|
255
|
+
collection,
|
|
256
|
+
helpers: {
|
|
487
257
|
...helpers,
|
|
488
|
-
closeDialog:
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
$[3] = t1;
|
|
492
|
-
$[4] = t2;
|
|
493
|
-
} else t2 = $[4];
|
|
494
|
-
let t3;
|
|
495
|
-
if ($[5] !== queryClient) {
|
|
496
|
-
t3 = {
|
|
258
|
+
closeDialog: () => onOpenChange(false)
|
|
259
|
+
},
|
|
260
|
+
queryClient: {
|
|
497
261
|
invalidateQueries: (filters) => queryClient.invalidateQueries(filters),
|
|
498
|
-
resetQueries: (
|
|
499
|
-
refetchQueries: (
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
}[action.handler.config.width || "md"];
|
|
537
|
-
if (action.handler.type === "dialog") return "sm:max-w-lg";
|
|
538
|
-
return "sm:max-w-md";
|
|
539
|
-
};
|
|
540
|
-
$[15] = action.handler;
|
|
541
|
-
$[16] = t6;
|
|
542
|
-
} else t6 = $[16];
|
|
543
|
-
const getDialogClassName = t6;
|
|
544
|
-
let t7;
|
|
545
|
-
if ($[17] !== getDialogClassName) {
|
|
546
|
-
t7 = cn("qa-action-dialog", getDialogClassName());
|
|
547
|
-
$[17] = getDialogClassName;
|
|
548
|
-
$[18] = t7;
|
|
549
|
-
} else t7 = $[18];
|
|
550
|
-
let t8;
|
|
551
|
-
if ($[19] !== action || $[20] !== ctx || $[21] !== handleClose) {
|
|
552
|
-
t8 = action.handler.type === "form" && /* @__PURE__ */ jsx(FormDialogContent, {
|
|
553
|
-
action,
|
|
554
|
-
ctx,
|
|
555
|
-
onClose: handleClose
|
|
556
|
-
});
|
|
557
|
-
$[19] = action;
|
|
558
|
-
$[20] = ctx;
|
|
559
|
-
$[21] = handleClose;
|
|
560
|
-
$[22] = t8;
|
|
561
|
-
} else t8 = $[22];
|
|
562
|
-
let t9;
|
|
563
|
-
if ($[23] !== action || $[24] !== ctx || $[25] !== handleClose) {
|
|
564
|
-
t9 = action.handler.type === "dialog" && /* @__PURE__ */ jsx(CustomDialogContent, {
|
|
565
|
-
action,
|
|
566
|
-
ctx,
|
|
567
|
-
onClose: handleClose
|
|
568
|
-
});
|
|
569
|
-
$[23] = action;
|
|
570
|
-
$[24] = ctx;
|
|
571
|
-
$[25] = handleClose;
|
|
572
|
-
$[26] = t9;
|
|
573
|
-
} else t9 = $[26];
|
|
574
|
-
let t10;
|
|
575
|
-
if ($[27] !== t7 || $[28] !== t8 || $[29] !== t9) {
|
|
576
|
-
t10 = /* @__PURE__ */ jsxs(ResponsiveDialogContent, {
|
|
577
|
-
className: t7,
|
|
578
|
-
children: [t8, t9]
|
|
579
|
-
});
|
|
580
|
-
$[27] = t7;
|
|
581
|
-
$[28] = t8;
|
|
582
|
-
$[29] = t9;
|
|
583
|
-
$[30] = t10;
|
|
584
|
-
} else t10 = $[30];
|
|
585
|
-
let t11;
|
|
586
|
-
if ($[31] !== onOpenChange || $[32] !== open || $[33] !== t10) {
|
|
587
|
-
t11 = /* @__PURE__ */ jsx(ResponsiveDialog, {
|
|
588
|
-
open,
|
|
589
|
-
onOpenChange,
|
|
590
|
-
children: t10
|
|
591
|
-
});
|
|
592
|
-
$[31] = onOpenChange;
|
|
593
|
-
$[32] = open;
|
|
594
|
-
$[33] = t10;
|
|
595
|
-
$[34] = t11;
|
|
596
|
-
} else t11 = $[34];
|
|
597
|
-
return t11;
|
|
262
|
+
resetQueries: (filters) => queryClient.resetQueries(filters),
|
|
263
|
+
refetchQueries: (filters) => queryClient.refetchQueries(filters)
|
|
264
|
+
}
|
|
265
|
+
}), [
|
|
266
|
+
item,
|
|
267
|
+
items,
|
|
268
|
+
collection,
|
|
269
|
+
helpers,
|
|
270
|
+
onOpenChange,
|
|
271
|
+
queryClient
|
|
272
|
+
]);
|
|
273
|
+
const handleClose = () => onOpenChange(false);
|
|
274
|
+
const getDialogClassName = () => {
|
|
275
|
+
if (action.handler.type === "form") return {
|
|
276
|
+
sm: "sm:max-w-sm",
|
|
277
|
+
md: "sm:max-w-md",
|
|
278
|
+
lg: "sm:max-w-lg",
|
|
279
|
+
xl: "sm:max-w-xl"
|
|
280
|
+
}[action.handler.config.width || "md"];
|
|
281
|
+
if (action.handler.type === "dialog") return "sm:max-w-lg";
|
|
282
|
+
return "sm:max-w-md";
|
|
283
|
+
};
|
|
284
|
+
return /* @__PURE__ */ jsx(ResponsiveDialog, {
|
|
285
|
+
open,
|
|
286
|
+
onOpenChange,
|
|
287
|
+
children: /* @__PURE__ */ jsxs(ResponsiveDialogContent, {
|
|
288
|
+
className: cn("qa-action-dialog", getDialogClassName()),
|
|
289
|
+
children: [action.handler.type === "form" && /* @__PURE__ */ jsx(FormDialogContent, {
|
|
290
|
+
action,
|
|
291
|
+
ctx,
|
|
292
|
+
onClose: handleClose
|
|
293
|
+
}), action.handler.type === "dialog" && /* @__PURE__ */ jsx(CustomDialogContent, {
|
|
294
|
+
action,
|
|
295
|
+
ctx,
|
|
296
|
+
onClose: handleClose
|
|
297
|
+
})]
|
|
298
|
+
})
|
|
299
|
+
});
|
|
598
300
|
}
|
|
599
301
|
|
|
600
302
|
//#endregion
|