@questpie/admin 3.2.2 → 3.2.4
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/components/blocks/block-library-sidebar.mjs +126 -113
- package/dist/client/components/fields/json-field.mjs +114 -118
- package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +38 -40
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs +6 -17
- package/dist/client/components/fields/rich-text-editor/index.mjs +71 -87
- package/dist/client/components/history-sidebar.mjs +25 -10
- package/dist/client/components/media/media-picker-dialog.mjs +237 -254
- package/dist/client/components/preview/live-preview-mode.mjs +230 -203
- package/dist/client/components/primitives/asset-preview.mjs +1 -1
- package/dist/client/contexts/focus-context.d.mts +4 -0
- package/dist/client/contexts/focus-context.mjs +106 -86
- package/dist/client/preview/block-scope-context.d.mts +2 -2
- package/dist/client/preview/diff.mjs +110 -0
- package/dist/client/preview/preview-banner.d.mts +2 -2
- package/dist/client/preview/preview-field.d.mts +4 -4
- package/dist/client/preview/preview-field.mjs +125 -187
- package/dist/client/preview/use-collection-preview.mjs +49 -21
- package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
- package/dist/client/views/auth/auth-layout.d.mts +3 -3
- package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
- package/dist/client/views/auth/reset-password-form.d.mts +2 -2
- package/dist/client/views/collection/bulk-action-toolbar.mjs +135 -156
- package/dist/client/views/collection/field-renderer.mjs +162 -51
- package/dist/client/views/collection/form-view.mjs +43 -81
- package/dist/client/views/collection/table-view.mjs +12 -10
- package/dist/client/views/common/global-search.mjs +199 -182
- package/dist/client/views/globals/global-form-view.mjs +625 -621
- package/dist/client/views/layout/admin-router.mjs +84 -100
- package/dist/client/views/pages/forgot-password-page.d.mts +2 -2
- package/dist/client/views/pages/invite-page.d.mts +2 -2
- 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 +67 -67
- 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/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 +41 -41
- 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/package.json +3 -3
|
@@ -47,7 +47,7 @@ function getSelectedIds(items) {
|
|
|
47
47
|
* ```
|
|
48
48
|
*/
|
|
49
49
|
function BulkActionToolbar(t0) {
|
|
50
|
-
const $ = c(
|
|
50
|
+
const $ = c(83);
|
|
51
51
|
const { table, actions, collection, helpers, totalCount, pageCount, onOpenDialog, onSelectAllMatching, onBulkDelete, onBulkRestore, filterCount: t1, onClearFilters, onOpenFilters } = t0;
|
|
52
52
|
const filterCount = t1 === void 0 ? 0 : t1;
|
|
53
53
|
const { t } = useTranslation();
|
|
@@ -121,31 +121,10 @@ function BulkActionToolbar(t0) {
|
|
|
121
121
|
const hasFilters = filterCount > 0;
|
|
122
122
|
const hasSelection = selectedCount > 0;
|
|
123
123
|
const isVisible = hasSelection || hasFilters;
|
|
124
|
-
|
|
124
|
+
if (!isVisible) return null;
|
|
125
125
|
let t7;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
t7 = () => {
|
|
129
|
-
if (isVisible) {
|
|
130
|
-
setShouldRender(true);
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
const timeout = window.setTimeout(() => setShouldRender(false), 180);
|
|
134
|
-
return () => window.clearTimeout(timeout);
|
|
135
|
-
};
|
|
136
|
-
t8 = [isVisible];
|
|
137
|
-
$[17] = isVisible;
|
|
138
|
-
$[18] = t7;
|
|
139
|
-
$[19] = t8;
|
|
140
|
-
} else {
|
|
141
|
-
t7 = $[18];
|
|
142
|
-
t8 = $[19];
|
|
143
|
-
}
|
|
144
|
-
React.useEffect(t7, t8);
|
|
145
|
-
if (!shouldRender) return null;
|
|
146
|
-
let t9;
|
|
147
|
-
if ($[20] !== ctx || $[21] !== helpers || $[22] !== onBulkDelete || $[23] !== onBulkRestore || $[24] !== onOpenDialog || $[25] !== selectedItems || $[26] !== t || $[27] !== table) {
|
|
148
|
-
t9 = async (action_0) => {
|
|
126
|
+
if ($[17] !== ctx || $[18] !== helpers || $[19] !== onBulkDelete || $[20] !== onBulkRestore || $[21] !== onOpenDialog || $[22] !== selectedItems || $[23] !== t || $[24] !== table) {
|
|
127
|
+
t7 = async (action_0) => {
|
|
149
128
|
const { handler } = action_0;
|
|
150
129
|
if (action_0.id === "deleteMany" && onBulkDelete) {
|
|
151
130
|
setIsLoading(true);
|
|
@@ -173,7 +152,7 @@ function BulkActionToolbar(t0) {
|
|
|
173
152
|
}
|
|
174
153
|
return;
|
|
175
154
|
}
|
|
176
|
-
|
|
155
|
+
bb77: switch (handler.type) {
|
|
177
156
|
case "api": {
|
|
178
157
|
setIsLoading(true);
|
|
179
158
|
const ids_1 = getSelectedIds(selectedItems);
|
|
@@ -187,7 +166,7 @@ function BulkActionToolbar(t0) {
|
|
|
187
166
|
helpers.toast.error(t("collection.bulkActionFailed"));
|
|
188
167
|
setIsLoading(false);
|
|
189
168
|
}
|
|
190
|
-
break
|
|
169
|
+
break bb77;
|
|
191
170
|
}
|
|
192
171
|
case "custom":
|
|
193
172
|
setIsLoading(true);
|
|
@@ -199,93 +178,93 @@ function BulkActionToolbar(t0) {
|
|
|
199
178
|
helpers.toast.error(t("collection.bulkActionFailed"));
|
|
200
179
|
setIsLoading(false);
|
|
201
180
|
}
|
|
202
|
-
break
|
|
181
|
+
break bb77;
|
|
203
182
|
case "dialog":
|
|
204
183
|
case "form":
|
|
205
184
|
onOpenDialog?.(action_0, selectedItems);
|
|
206
|
-
break
|
|
185
|
+
break bb77;
|
|
207
186
|
case "navigate":
|
|
208
187
|
helpers.toast.error("Navigate action not supported for bulk operations");
|
|
209
|
-
break
|
|
188
|
+
break bb77;
|
|
210
189
|
case "server": onOpenDialog?.(action_0, selectedItems);
|
|
211
190
|
}
|
|
212
191
|
};
|
|
213
|
-
$[
|
|
214
|
-
$[
|
|
215
|
-
$[
|
|
216
|
-
$[
|
|
217
|
-
$[
|
|
218
|
-
$[
|
|
219
|
-
$[
|
|
220
|
-
$[
|
|
221
|
-
$[
|
|
222
|
-
} else
|
|
223
|
-
const executeBulkAction =
|
|
224
|
-
let
|
|
225
|
-
if ($[
|
|
226
|
-
|
|
192
|
+
$[17] = ctx;
|
|
193
|
+
$[18] = helpers;
|
|
194
|
+
$[19] = onBulkDelete;
|
|
195
|
+
$[20] = onBulkRestore;
|
|
196
|
+
$[21] = onOpenDialog;
|
|
197
|
+
$[22] = selectedItems;
|
|
198
|
+
$[23] = t;
|
|
199
|
+
$[24] = table;
|
|
200
|
+
$[25] = t7;
|
|
201
|
+
} else t7 = $[25];
|
|
202
|
+
const executeBulkAction = t7;
|
|
203
|
+
let t8;
|
|
204
|
+
if ($[26] !== executeBulkAction) {
|
|
205
|
+
t8 = (action_1) => {
|
|
227
206
|
if (action_1.confirmation) setConfirmAction(action_1);
|
|
228
207
|
else executeBulkAction(action_1);
|
|
229
208
|
};
|
|
230
|
-
$[
|
|
231
|
-
$[
|
|
232
|
-
} else
|
|
233
|
-
const handleActionClick =
|
|
234
|
-
let
|
|
235
|
-
if ($[
|
|
236
|
-
|
|
209
|
+
$[26] = executeBulkAction;
|
|
210
|
+
$[27] = t8;
|
|
211
|
+
} else t8 = $[27];
|
|
212
|
+
const handleActionClick = t8;
|
|
213
|
+
let t9;
|
|
214
|
+
if ($[28] !== confirmAction || $[29] !== executeBulkAction) {
|
|
215
|
+
t9 = async () => {
|
|
237
216
|
if (confirmAction) {
|
|
238
217
|
await executeBulkAction(confirmAction);
|
|
239
218
|
setConfirmAction(null);
|
|
240
219
|
}
|
|
241
220
|
};
|
|
242
|
-
$[
|
|
243
|
-
$[
|
|
244
|
-
$[
|
|
245
|
-
} else
|
|
246
|
-
const handleConfirm =
|
|
247
|
-
let
|
|
248
|
-
if ($[
|
|
249
|
-
|
|
221
|
+
$[28] = confirmAction;
|
|
222
|
+
$[29] = executeBulkAction;
|
|
223
|
+
$[30] = t9;
|
|
224
|
+
} else t9 = $[30];
|
|
225
|
+
const handleConfirm = t9;
|
|
226
|
+
let t10;
|
|
227
|
+
if ($[31] !== onSelectAllMatching) {
|
|
228
|
+
t10 = async () => {
|
|
250
229
|
if (!onSelectAllMatching) return;
|
|
251
230
|
setIsSelectingAll(true);
|
|
252
231
|
try {
|
|
253
232
|
await onSelectAllMatching();
|
|
254
233
|
setIsSelectingAll(false);
|
|
255
|
-
} catch (
|
|
256
|
-
const _err =
|
|
234
|
+
} catch (t11$1) {
|
|
235
|
+
const _err = t11$1;
|
|
257
236
|
setIsSelectingAll(false);
|
|
258
237
|
throw _err;
|
|
259
238
|
}
|
|
260
239
|
};
|
|
261
|
-
$[
|
|
262
|
-
$[
|
|
263
|
-
} else
|
|
264
|
-
const handleSelectAllMatching =
|
|
265
|
-
let
|
|
266
|
-
if ($[
|
|
267
|
-
|
|
240
|
+
$[31] = onSelectAllMatching;
|
|
241
|
+
$[32] = t10;
|
|
242
|
+
} else t10 = $[32];
|
|
243
|
+
const handleSelectAllMatching = t10;
|
|
244
|
+
let t11;
|
|
245
|
+
if ($[33] !== ctx) {
|
|
246
|
+
t11 = (action_2) => {
|
|
268
247
|
if (action_2.disabled === void 0) return false;
|
|
269
248
|
if (typeof action_2.disabled === "function") return action_2.disabled(ctx);
|
|
270
249
|
return action_2.disabled;
|
|
271
250
|
};
|
|
272
|
-
$[
|
|
273
|
-
$[
|
|
274
|
-
} else
|
|
275
|
-
const isDisabled =
|
|
251
|
+
$[33] = ctx;
|
|
252
|
+
$[34] = t11;
|
|
253
|
+
} else t11 = $[34];
|
|
254
|
+
const isDisabled = t11;
|
|
255
|
+
let t12;
|
|
256
|
+
let t13;
|
|
276
257
|
let t14;
|
|
277
258
|
let t15;
|
|
278
259
|
let t16;
|
|
279
|
-
|
|
280
|
-
let t18;
|
|
281
|
-
if ($[38] !== filterCount || $[39] !== handleActionClick || $[40] !== handleSelectAllMatching || $[41] !== hasFilters || $[42] !== hasSelection || $[43] !== isDisabled || $[44] !== isLoading || $[45] !== isSelectingAll || $[46] !== isVisible || $[47] !== onClearFilters || $[48] !== onOpenFilters || $[49] !== onSelectAllMatching || $[50] !== pageCount || $[51] !== resolveText || $[52] !== selectedCount || $[53] !== t || $[54] !== table || $[55] !== totalCount || $[56] !== visibleActions) {
|
|
260
|
+
if ($[35] !== filterCount || $[36] !== handleActionClick || $[37] !== handleSelectAllMatching || $[38] !== hasFilters || $[39] !== hasSelection || $[40] !== isDisabled || $[41] !== isLoading || $[42] !== isSelectingAll || $[43] !== isVisible || $[44] !== onClearFilters || $[45] !== onOpenFilters || $[46] !== onSelectAllMatching || $[47] !== pageCount || $[48] !== resolveText || $[49] !== selectedCount || $[50] !== t || $[51] !== table || $[52] !== totalCount || $[53] !== visibleActions) {
|
|
282
261
|
const regularActions = visibleActions.filter(_temp2);
|
|
283
262
|
const destructiveActions = visibleActions.filter(_temp3);
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
if ($[
|
|
288
|
-
|
|
263
|
+
t15 = isVisible ? "open" : "closed";
|
|
264
|
+
t16 = "qa-bulk-toolbar fixed bottom-6 left-1/2 z-50 max-w-[calc(100%-2rem)] -translate-x-1/2 transition-[opacity,translate,scale] duration-[var(--motion-duration-slow)] ease-[var(--motion-ease-enter)] data-[state=closed]:pointer-events-none data-[state=closed]:translate-y-2 data-[state=closed]:scale-[0.98] data-[state=closed]:opacity-0 data-[state=open]:translate-y-0 data-[state=open]:scale-100 data-[state=open]:opacity-100 motion-reduce:transition-none sm:max-w-none";
|
|
265
|
+
t12 = "qa-bulk-toolbar__bar bg-background border-border flex items-center gap-2 overflow-x-auto rounded-full border px-3 py-2 shadow-lg transition-[gap,padding] duration-[var(--motion-duration-base)] ease-[var(--motion-ease-standard)] sm:gap-3 sm:px-4 sm:py-2.5";
|
|
266
|
+
if ($[59] !== filterCount || $[60] !== hasFilters || $[61] !== hasSelection || $[62] !== onClearFilters || $[63] !== onOpenFilters || $[64] !== t) {
|
|
267
|
+
t13 = hasFilters && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
289
268
|
className: "flex shrink-0 items-center gap-2",
|
|
290
269
|
children: [onOpenFilters ? /* @__PURE__ */ jsxs(Button, {
|
|
291
270
|
variant: "ghost",
|
|
@@ -317,15 +296,15 @@ function BulkActionToolbar(t0) {
|
|
|
317
296
|
className: "qa-bulk-toolbar__divider bg-border h-4 w-px shrink-0",
|
|
318
297
|
"aria-hidden": "true"
|
|
319
298
|
})] });
|
|
320
|
-
$[
|
|
321
|
-
$[
|
|
322
|
-
$[
|
|
323
|
-
$[
|
|
324
|
-
$[
|
|
325
|
-
$[
|
|
326
|
-
$[
|
|
327
|
-
} else
|
|
328
|
-
|
|
299
|
+
$[59] = filterCount;
|
|
300
|
+
$[60] = hasFilters;
|
|
301
|
+
$[61] = hasSelection;
|
|
302
|
+
$[62] = onClearFilters;
|
|
303
|
+
$[63] = onOpenFilters;
|
|
304
|
+
$[64] = t;
|
|
305
|
+
$[65] = t13;
|
|
306
|
+
} else t13 = $[65];
|
|
307
|
+
t14 = hasSelection && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
329
308
|
/* @__PURE__ */ jsx("span", {
|
|
330
309
|
className: "shrink-0 text-sm font-medium whitespace-nowrap",
|
|
331
310
|
children: t("collection.selected", { count: selectedCount })
|
|
@@ -417,63 +396,63 @@ function BulkActionToolbar(t0) {
|
|
|
417
396
|
})]
|
|
418
397
|
})
|
|
419
398
|
] });
|
|
420
|
-
$[
|
|
421
|
-
$[
|
|
422
|
-
$[
|
|
423
|
-
$[
|
|
424
|
-
$[
|
|
425
|
-
$[
|
|
426
|
-
$[
|
|
427
|
-
$[
|
|
428
|
-
$[
|
|
429
|
-
$[
|
|
430
|
-
$[
|
|
431
|
-
$[
|
|
432
|
-
$[
|
|
433
|
-
$[
|
|
434
|
-
$[
|
|
435
|
-
$[
|
|
436
|
-
$[
|
|
437
|
-
$[
|
|
438
|
-
$[
|
|
439
|
-
$[
|
|
440
|
-
$[
|
|
441
|
-
$[
|
|
442
|
-
$[
|
|
443
|
-
$[
|
|
399
|
+
$[35] = filterCount;
|
|
400
|
+
$[36] = handleActionClick;
|
|
401
|
+
$[37] = handleSelectAllMatching;
|
|
402
|
+
$[38] = hasFilters;
|
|
403
|
+
$[39] = hasSelection;
|
|
404
|
+
$[40] = isDisabled;
|
|
405
|
+
$[41] = isLoading;
|
|
406
|
+
$[42] = isSelectingAll;
|
|
407
|
+
$[43] = isVisible;
|
|
408
|
+
$[44] = onClearFilters;
|
|
409
|
+
$[45] = onOpenFilters;
|
|
410
|
+
$[46] = onSelectAllMatching;
|
|
411
|
+
$[47] = pageCount;
|
|
412
|
+
$[48] = resolveText;
|
|
413
|
+
$[49] = selectedCount;
|
|
414
|
+
$[50] = t;
|
|
415
|
+
$[51] = table;
|
|
416
|
+
$[52] = totalCount;
|
|
417
|
+
$[53] = visibleActions;
|
|
418
|
+
$[54] = t12;
|
|
419
|
+
$[55] = t13;
|
|
420
|
+
$[56] = t14;
|
|
421
|
+
$[57] = t15;
|
|
422
|
+
$[58] = t16;
|
|
444
423
|
} else {
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
424
|
+
t12 = $[54];
|
|
425
|
+
t13 = $[55];
|
|
426
|
+
t14 = $[56];
|
|
427
|
+
t15 = $[57];
|
|
428
|
+
t16 = $[58];
|
|
450
429
|
}
|
|
451
|
-
let
|
|
452
|
-
if ($[
|
|
453
|
-
|
|
454
|
-
className:
|
|
455
|
-
children: [
|
|
430
|
+
let t17;
|
|
431
|
+
if ($[66] !== t12 || $[67] !== t13 || $[68] !== t14) {
|
|
432
|
+
t17 = /* @__PURE__ */ jsxs("div", {
|
|
433
|
+
className: t12,
|
|
434
|
+
children: [t13, t14]
|
|
435
|
+
});
|
|
436
|
+
$[66] = t12;
|
|
437
|
+
$[67] = t13;
|
|
438
|
+
$[68] = t14;
|
|
439
|
+
$[69] = t17;
|
|
440
|
+
} else t17 = $[69];
|
|
441
|
+
let t18;
|
|
442
|
+
if ($[70] !== t15 || $[71] !== t16 || $[72] !== t17) {
|
|
443
|
+
t18 = /* @__PURE__ */ jsx("div", {
|
|
444
|
+
"data-state": t15,
|
|
445
|
+
className: t16,
|
|
446
|
+
children: t17
|
|
456
447
|
});
|
|
457
|
-
$[69] = t14;
|
|
458
448
|
$[70] = t15;
|
|
459
449
|
$[71] = t16;
|
|
460
|
-
$[72] =
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
className: t18,
|
|
467
|
-
children: t19
|
|
468
|
-
});
|
|
469
|
-
$[73] = t17;
|
|
470
|
-
$[74] = t18;
|
|
471
|
-
$[75] = t19;
|
|
472
|
-
$[76] = t20;
|
|
473
|
-
} else t20 = $[76];
|
|
474
|
-
let t21;
|
|
475
|
-
if ($[77] !== confirmAction || $[78] !== handleConfirm || $[79] !== isLoading || $[80] !== resolveText || $[81] !== selectedCount) {
|
|
476
|
-
t21 = confirmAction?.confirmation && /* @__PURE__ */ jsx(ConfirmationDialog, {
|
|
450
|
+
$[72] = t17;
|
|
451
|
+
$[73] = t18;
|
|
452
|
+
} else t18 = $[73];
|
|
453
|
+
let t19;
|
|
454
|
+
if ($[74] !== confirmAction || $[75] !== handleConfirm || $[76] !== isLoading || $[77] !== resolveText || $[78] !== selectedCount) {
|
|
455
|
+
t19 = confirmAction?.confirmation && /* @__PURE__ */ jsx(ConfirmationDialog, {
|
|
477
456
|
open: !!confirmAction,
|
|
478
457
|
onOpenChange: (open) => !open && setConfirmAction(null),
|
|
479
458
|
config: {
|
|
@@ -483,21 +462,21 @@ function BulkActionToolbar(t0) {
|
|
|
483
462
|
onConfirm: handleConfirm,
|
|
484
463
|
loading: isLoading
|
|
485
464
|
});
|
|
486
|
-
$[
|
|
487
|
-
$[
|
|
488
|
-
$[
|
|
489
|
-
$[
|
|
490
|
-
$[
|
|
491
|
-
$[
|
|
492
|
-
} else
|
|
493
|
-
let
|
|
494
|
-
if ($[
|
|
495
|
-
|
|
496
|
-
$[
|
|
497
|
-
$[
|
|
498
|
-
$[
|
|
499
|
-
} else
|
|
500
|
-
return
|
|
465
|
+
$[74] = confirmAction;
|
|
466
|
+
$[75] = handleConfirm;
|
|
467
|
+
$[76] = isLoading;
|
|
468
|
+
$[77] = resolveText;
|
|
469
|
+
$[78] = selectedCount;
|
|
470
|
+
$[79] = t19;
|
|
471
|
+
} else t19 = $[79];
|
|
472
|
+
let t20;
|
|
473
|
+
if ($[80] !== t18 || $[81] !== t19) {
|
|
474
|
+
t20 = /* @__PURE__ */ jsxs(Fragment, { children: [t18, t19] });
|
|
475
|
+
$[80] = t18;
|
|
476
|
+
$[81] = t19;
|
|
477
|
+
$[82] = t20;
|
|
478
|
+
} else t20 = $[82];
|
|
479
|
+
return t20;
|
|
501
480
|
}
|
|
502
481
|
function _temp3(a_0) {
|
|
503
482
|
return a_0.variant === "destructive";
|
|
@@ -8,17 +8,11 @@ import { buildComponentProps, getFieldContext, getFieldOptions, getFullFieldName
|
|
|
8
8
|
import { useFieldHooks } from "../../hooks/use-field-hooks.mjs";
|
|
9
9
|
import { useReactiveProps } from "../../hooks/use-reactive-prop.mjs";
|
|
10
10
|
import { c } from "react/compiler-runtime";
|
|
11
|
-
import
|
|
11
|
+
import "react";
|
|
12
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { useFormContext, useWatch } from "react-hook-form";
|
|
14
14
|
|
|
15
15
|
//#region src/client/views/collection/field-renderer.tsx
|
|
16
|
-
/**
|
|
17
|
-
* FieldRenderer Component
|
|
18
|
-
*
|
|
19
|
-
* Renders a single form field using FieldDefinition.
|
|
20
|
-
* Shared between AutoFormFields and BlockEditor.
|
|
21
|
-
*/
|
|
22
16
|
function renderConfigError(message) {
|
|
23
17
|
return /* @__PURE__ */ jsx("div", {
|
|
24
18
|
className: "border-destructive/40 bg-destructive/5 text-destructive rounded border p-3 text-sm",
|
|
@@ -143,38 +137,90 @@ function renderEmbeddedField({ context, registry, allCollectionsConfig, componen
|
|
|
143
137
|
* 2. FieldDefinition.field.component (registry-first approach)
|
|
144
138
|
* 3. Error message if no component registered
|
|
145
139
|
*/
|
|
146
|
-
function FieldRenderer(
|
|
140
|
+
function FieldRenderer(t0) {
|
|
141
|
+
const $ = c(44);
|
|
142
|
+
const { fieldName, fieldDef, collection, mode: t1, registry, fieldPrefix, allCollectionsConfig, renderEmbeddedFields, className, entityMeta: entityMetaProp, extraProps } = t0;
|
|
143
|
+
const mode = t1 === void 0 ? "collection" : t1;
|
|
147
144
|
const form = useFormContext();
|
|
148
145
|
const { locale } = useScopedLocale();
|
|
149
146
|
const resolveText = useResolveText();
|
|
150
147
|
const { data: adminConfig } = useAdminConfig();
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
148
|
+
let t2;
|
|
149
|
+
if ($[0] !== fieldName || $[1] !== fieldPrefix) {
|
|
150
|
+
t2 = getFullFieldName(fieldName, fieldPrefix);
|
|
151
|
+
$[0] = fieldName;
|
|
152
|
+
$[1] = fieldPrefix;
|
|
153
|
+
$[2] = t2;
|
|
154
|
+
} else t2 = $[2];
|
|
155
|
+
const fullFieldName = t2;
|
|
156
|
+
let t3;
|
|
157
|
+
if ($[3] !== fieldDef) {
|
|
158
|
+
t3 = getFieldOptions(fieldDef);
|
|
159
|
+
$[3] = fieldDef;
|
|
160
|
+
$[4] = t3;
|
|
161
|
+
} else t3 = $[4];
|
|
162
|
+
const fieldOptions = t3;
|
|
163
|
+
let t4;
|
|
164
|
+
if ($[5] !== fieldOptions || $[6] !== fieldPrefix || $[7] !== form) {
|
|
165
|
+
t4 = computeDynamicDependencyPaths({
|
|
166
|
+
fieldOptions,
|
|
167
|
+
form,
|
|
168
|
+
fieldPrefix
|
|
169
|
+
});
|
|
170
|
+
$[5] = fieldOptions;
|
|
171
|
+
$[6] = fieldPrefix;
|
|
172
|
+
$[7] = form;
|
|
173
|
+
$[8] = t4;
|
|
174
|
+
} else t4 = $[8];
|
|
175
|
+
const dynamicDependencyPaths = t4;
|
|
176
|
+
let t5;
|
|
177
|
+
if ($[9] !== dynamicDependencyPaths || $[10] !== fullFieldName) {
|
|
178
|
+
t5 = new Set([fullFieldName, ...dynamicDependencyPaths]);
|
|
179
|
+
$[9] = dynamicDependencyPaths;
|
|
180
|
+
$[10] = fullFieldName;
|
|
181
|
+
$[11] = t5;
|
|
182
|
+
} else t5 = $[11];
|
|
183
|
+
let t6;
|
|
184
|
+
if ($[12] !== t5) {
|
|
185
|
+
t6 = [...t5];
|
|
186
|
+
$[12] = t5;
|
|
187
|
+
$[13] = t6;
|
|
188
|
+
} else t6 = $[13];
|
|
189
|
+
const t7 = t6;
|
|
190
|
+
let t8;
|
|
191
|
+
if ($[14] !== form.control || $[15] !== t7) {
|
|
192
|
+
t8 = {
|
|
193
|
+
control: form.control,
|
|
194
|
+
name: t7
|
|
195
|
+
};
|
|
196
|
+
$[14] = form.control;
|
|
197
|
+
$[15] = t7;
|
|
198
|
+
$[16] = t8;
|
|
199
|
+
} else t8 = $[16];
|
|
200
|
+
const watchedDependencyValues = useWatch(t8);
|
|
169
201
|
const watchedFieldValue = Array.isArray(watchedDependencyValues) ? watchedDependencyValues[0] : watchedDependencyValues;
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
202
|
+
let t9;
|
|
203
|
+
bb0: {
|
|
204
|
+
if (!fieldPrefix) {
|
|
205
|
+
let t10$2;
|
|
206
|
+
if ($[17] !== form) {
|
|
207
|
+
t10$2 = form.getValues() ?? {};
|
|
208
|
+
$[17] = form;
|
|
209
|
+
$[18] = t10$2;
|
|
210
|
+
} else t10$2 = $[18];
|
|
211
|
+
t9 = t10$2;
|
|
212
|
+
break bb0;
|
|
213
|
+
}
|
|
214
|
+
let t10$1;
|
|
215
|
+
if ($[19] !== fieldPrefix || $[20] !== form) {
|
|
216
|
+
t10$1 = form.getValues(fieldPrefix) ?? {};
|
|
217
|
+
$[19] = fieldPrefix;
|
|
218
|
+
$[20] = form;
|
|
219
|
+
$[21] = t10$1;
|
|
220
|
+
} else t10$1 = $[21];
|
|
221
|
+
t9 = t10$1;
|
|
222
|
+
}
|
|
223
|
+
const formValues = t9;
|
|
178
224
|
const context = getFieldContext({
|
|
179
225
|
fieldName,
|
|
180
226
|
fieldDef,
|
|
@@ -197,19 +243,60 @@ function FieldRenderer({ fieldName, fieldDef, collection, mode = "collection", r
|
|
|
197
243
|
loadOptions: fieldOptions.loadOptions,
|
|
198
244
|
staticOptions: context.options
|
|
199
245
|
});
|
|
200
|
-
if (context.isHidden) return null;
|
|
201
|
-
if (!fieldDef) return renderConfigError(`Field "${fieldName}" not found in ${mode === "global" ? "global" : "collection"} "${collection}" config.`);
|
|
202
246
|
const resolvedOptions = hookOptions ?? context.options;
|
|
203
247
|
const rawComponentProps = buildComponentProps(context);
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
248
|
+
let t10;
|
|
249
|
+
if ($[22] !== fieldDef) {
|
|
250
|
+
t10 = stripFieldUiOptions(getFieldOptions(fieldDef));
|
|
251
|
+
$[22] = fieldDef;
|
|
252
|
+
$[23] = t10;
|
|
253
|
+
} else t10 = $[23];
|
|
254
|
+
let t11;
|
|
255
|
+
if ($[24] !== extraProps) {
|
|
256
|
+
t11 = extraProps ?? {};
|
|
257
|
+
$[24] = extraProps;
|
|
258
|
+
$[25] = t11;
|
|
259
|
+
} else t11 = $[25];
|
|
260
|
+
let t12;
|
|
261
|
+
if ($[26] !== t10 || $[27] !== t11) {
|
|
262
|
+
t12 = {
|
|
263
|
+
...t10,
|
|
264
|
+
...t11
|
|
265
|
+
};
|
|
266
|
+
$[26] = t10;
|
|
267
|
+
$[27] = t11;
|
|
268
|
+
$[28] = t12;
|
|
269
|
+
} else t12 = $[28];
|
|
270
|
+
const mergedFieldProps = t12;
|
|
271
|
+
const t13 = !context.isHidden && !!fieldDef;
|
|
272
|
+
let t14;
|
|
273
|
+
if ($[29] !== collection || $[30] !== fullFieldName || $[31] !== mergedFieldProps || $[32] !== mode || $[33] !== t13) {
|
|
274
|
+
t14 = {
|
|
275
|
+
entity: collection,
|
|
276
|
+
entityType: mode,
|
|
277
|
+
field: fullFieldName,
|
|
278
|
+
props: mergedFieldProps,
|
|
279
|
+
enabled: t13
|
|
280
|
+
};
|
|
281
|
+
$[29] = collection;
|
|
282
|
+
$[30] = fullFieldName;
|
|
283
|
+
$[31] = mergedFieldProps;
|
|
284
|
+
$[32] = mode;
|
|
285
|
+
$[33] = t13;
|
|
286
|
+
$[34] = t14;
|
|
287
|
+
} else t14 = $[34];
|
|
288
|
+
const { props: resolvedFieldProps } = useReactiveProps(t14);
|
|
289
|
+
if (context.isHidden) return null;
|
|
290
|
+
if (!fieldDef) {
|
|
291
|
+
const t15$1 = `Field "${fieldName}" not found in ${mode === "global" ? "global" : "collection"} "${collection}" config.`;
|
|
292
|
+
let t16;
|
|
293
|
+
if ($[35] !== t15$1) {
|
|
294
|
+
t16 = renderConfigError(t15$1);
|
|
295
|
+
$[35] = t15$1;
|
|
296
|
+
$[36] = t16;
|
|
297
|
+
} else t16 = $[36];
|
|
298
|
+
return t16;
|
|
299
|
+
}
|
|
213
300
|
const fieldValue = isComputed ? computedValue : watchedFieldValue === void 0 ? rawComponentProps.value : watchedFieldValue;
|
|
214
301
|
const componentProps = {
|
|
215
302
|
...rawComponentProps,
|
|
@@ -243,12 +330,36 @@ function FieldRenderer({ fieldName, fieldDef, collection, mode = "collection", r
|
|
|
243
330
|
componentProps,
|
|
244
331
|
blocks: adminConfig?.blocks
|
|
245
332
|
});
|
|
246
|
-
if (!content)
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
333
|
+
if (!content) {
|
|
334
|
+
const t15$1 = `No component registered for field type "${context.type}" (field: "${context.fieldName}").`;
|
|
335
|
+
let t16;
|
|
336
|
+
if ($[37] !== t15$1) {
|
|
337
|
+
t16 = renderConfigError(t15$1);
|
|
338
|
+
$[37] = t15$1;
|
|
339
|
+
$[38] = t16;
|
|
340
|
+
} else t16 = $[38];
|
|
341
|
+
content = t16;
|
|
342
|
+
}
|
|
343
|
+
if (className) {
|
|
344
|
+
let t15$1;
|
|
345
|
+
if ($[39] !== className || $[40] !== content) {
|
|
346
|
+
t15$1 = /* @__PURE__ */ jsx("div", {
|
|
347
|
+
className,
|
|
348
|
+
children: content
|
|
349
|
+
});
|
|
350
|
+
$[39] = className;
|
|
351
|
+
$[40] = content;
|
|
352
|
+
$[41] = t15$1;
|
|
353
|
+
} else t15$1 = $[41];
|
|
354
|
+
return t15$1;
|
|
355
|
+
}
|
|
356
|
+
let t15;
|
|
357
|
+
if ($[42] !== content) {
|
|
358
|
+
t15 = /* @__PURE__ */ jsx(Fragment, { children: content });
|
|
359
|
+
$[42] = content;
|
|
360
|
+
$[43] = t15;
|
|
361
|
+
} else t15 = $[43];
|
|
362
|
+
return t15;
|
|
252
363
|
}
|
|
253
364
|
|
|
254
365
|
//#endregion
|