@questpie/admin 3.2.0 → 3.2.1

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.
Files changed (85) hide show
  1. package/dist/client/blocks/block-renderer.d.mts +12 -2
  2. package/dist/client/blocks/block-renderer.mjs +357 -49
  3. package/dist/client/components/blocks/block-editor-context.mjs +11 -1
  4. package/dist/client/components/blocks/block-editor-provider.mjs +68 -26
  5. package/dist/client/components/blocks/block-item.mjs +181 -170
  6. package/dist/client/components/blocks/utils/tree-utils.mjs +13 -1
  7. package/dist/client/components/fields/array-field.mjs +177 -118
  8. package/dist/client/components/filter-builder/filter-builder-sheet.mjs +305 -310
  9. package/dist/client/components/filter-builder/filters-tab.mjs +1 -1
  10. package/dist/client/components/history-sidebar.mjs +121 -114
  11. package/dist/client/components/preview/live-preview-mode.mjs +140 -114
  12. package/dist/client/components/preview/preview-pane.mjs +288 -333
  13. package/dist/client/components/primitives/option-label.mjs +44 -0
  14. package/dist/client/components/primitives/select-multi.mjs +408 -383
  15. package/dist/client/components/primitives/select-single.mjs +387 -357
  16. package/dist/client/components/widgets/chart-widget.mjs +168 -143
  17. package/dist/client/contexts/focus-context.d.mts +11 -0
  18. package/dist/client/contexts/focus-context.mjs +51 -34
  19. package/dist/client/hooks/use-brand.mjs +2 -1
  20. package/dist/client/preview/block-scope-context.d.mts +2 -2
  21. package/dist/client/preview/block-scope-context.mjs +10 -20
  22. package/dist/client/preview/index.d.mts +1 -1
  23. package/dist/client/preview/patch.mjs +100 -0
  24. package/dist/client/preview/preview-banner.d.mts +2 -2
  25. package/dist/client/preview/preview-field.d.mts +34 -5
  26. package/dist/client/preview/preview-field.mjs +385 -118
  27. package/dist/client/preview/types.d.mts +82 -3
  28. package/dist/client/preview/types.mjs +85 -6
  29. package/dist/client/preview/use-collection-preview.d.mts +19 -1
  30. package/dist/client/preview/use-collection-preview.mjs +182 -58
  31. package/dist/client/runtime/index.d.mts +2 -2
  32. package/dist/client/runtime/index.mjs +2 -2
  33. package/dist/client/runtime/provider.d.mts +5 -5
  34. package/dist/client/utils/build-field-definitions-from-schema.mjs +8 -3
  35. package/dist/client/views/auth/reset-password-form.d.mts +2 -2
  36. package/dist/client/views/auth/setup-form.d.mts +2 -2
  37. package/dist/client/views/collection/bulk-action-toolbar.mjs +23 -25
  38. package/dist/client/views/collection/cells/primitive-cells.mjs +63 -13
  39. package/dist/client/views/collection/columns/build-columns.mjs +1 -0
  40. package/dist/client/views/collection/form-view.mjs +262 -33
  41. package/dist/client/views/collection/table-view.mjs +16 -11
  42. package/dist/client/views/layout/admin-layout-provider.d.mts +5 -5
  43. package/dist/client/views/layout/admin-layout-provider.mjs +107 -16
  44. package/dist/client.d.mts +2 -2
  45. package/dist/client.mjs +1 -1
  46. package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
  47. package/dist/index.d.mts +2 -2
  48. package/dist/index.mjs +1 -1
  49. package/dist/server/augmentation/common.d.mts +8 -4
  50. package/dist/server/augmentation/form-layout.d.mts +1 -1
  51. package/dist/server/i18n/messages/cs.mjs +11 -0
  52. package/dist/server/i18n/messages/de.mjs +11 -0
  53. package/dist/server/i18n/messages/en.mjs +11 -0
  54. package/dist/server/i18n/messages/es.mjs +11 -0
  55. package/dist/server/i18n/messages/fr.mjs +11 -0
  56. package/dist/server/i18n/messages/pl.mjs +11 -0
  57. package/dist/server/i18n/messages/pt.mjs +11 -0
  58. package/dist/server/i18n/messages/sk.mjs +11 -0
  59. package/dist/server/modules/admin/block/block-builder.d.mts +7 -10
  60. package/dist/server/modules/admin/block/block-builder.mjs +7 -10
  61. package/dist/server/modules/admin/collections/account.d.mts +50 -50
  62. package/dist/server/modules/admin/collections/admin-locks.d.mts +54 -54
  63. package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
  64. package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
  65. package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
  66. package/dist/server/modules/admin/collections/assets.d.mts +57 -20
  67. package/dist/server/modules/admin/collections/session.d.mts +42 -42
  68. package/dist/server/modules/admin/collections/user.d.mts +100 -34
  69. package/dist/server/modules/admin/collections/user.mjs +4 -4
  70. package/dist/server/modules/admin/collections/verification.d.mts +32 -32
  71. package/dist/server/modules/admin/index.d.mts +3 -3
  72. package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
  73. package/dist/server/modules/admin/routes/admin-config.mjs +9 -12
  74. package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
  75. package/dist/server/modules/admin/routes/locales.d.mts +2 -2
  76. package/dist/server/modules/admin/routes/preview.d.mts +11 -11
  77. package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
  78. package/dist/server/modules/admin/routes/setup.d.mts +7 -7
  79. package/dist/server/modules/admin/routes/translations.d.mts +4 -4
  80. package/dist/server/modules/admin/routes/translations.mjs +1 -1
  81. package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
  82. package/dist/server/modules/admin-preferences/collections/admin-preferences.mjs +4 -6
  83. package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +31 -33
  84. package/dist/server/modules/admin-preferences/collections/saved-views.mjs +4 -6
  85. package/package.json +3 -3
@@ -4,8 +4,8 @@ import { useTranslation } from "../../i18n/hooks.mjs";
4
4
  import { cn } from "../../lib/utils.mjs";
5
5
  import { Button } from "../ui/button.mjs";
6
6
  import { Tabs, TabsList, TabsTrigger } from "../ui/tabs.mjs";
7
- import { useIsMobile } from "../../hooks/use-media-query.mjs";
8
7
  import { FocusProvider, parsePreviewFieldPath, scrollFieldIntoView, useFocus } from "../../contexts/focus-context.mjs";
8
+ import { useIsMobile } from "../../hooks/use-media-query.mjs";
9
9
  import { PreviewPane } from "./preview-pane.mjs";
10
10
  import { c } from "react/compiler-runtime";
11
11
  import { Icon } from "@iconify/react";
@@ -126,8 +126,8 @@ function useLivePreviewRenderTelemetry(t0) {
126
126
  React.useEffect(t1);
127
127
  }
128
128
  function LivePreviewContent(t0) {
129
- const $ = c(68);
130
- const { open, onClose, children, previewUrl, previewRef, defaultSize: t1, minSize: t2 } = t0;
129
+ const $ = c(77);
130
+ const { open, children, previewUrl, previewRef, onFieldValueEdited, onPatchApplied, onResyncRequest, defaultSize: t1, minSize: t2 } = t0;
131
131
  const defaultSize = t1 === void 0 ? 50 : t1;
132
132
  const minSize = t2 === void 0 ? 30 : t2;
133
133
  const { t } = useTranslation();
@@ -255,10 +255,19 @@ function LivePreviewContent(t0) {
255
255
  $[20] = t11;
256
256
  } else t11 = $[20];
257
257
  const handlePreviewBlockClick = t11;
258
- const t12 = open ? "bg-background fixed inset-0 z-50 flex flex-col" : "w-full";
259
- let t13;
260
- if ($[21] !== activeTab || $[22] !== isMobile || $[23] !== onClose || $[24] !== open || $[25] !== t) {
261
- t13 = open && /* @__PURE__ */ jsxs("div", {
258
+ let t12;
259
+ if ($[21] !== focusContext) {
260
+ t12 = (message) => {
261
+ focusContext.requestBlockInsert(message.position, message.referenceBlockId);
262
+ };
263
+ $[21] = focusContext;
264
+ $[22] = t12;
265
+ } else t12 = $[22];
266
+ const handlePreviewBlockInsertRequest = t12;
267
+ const t13 = open ? "bg-background fixed inset-0 z-50 flex flex-col" : "w-full";
268
+ let t14;
269
+ if ($[23] !== activeTab || $[24] !== isMobile || $[25] !== open || $[26] !== t) {
270
+ t14 = open && /* @__PURE__ */ jsxs("div", {
262
271
  className: "flex shrink-0 items-center justify-between border-b px-4 py-2",
263
272
  children: [
264
273
  /* @__PURE__ */ jsxs("div", {
@@ -288,9 +297,9 @@ function LivePreviewContent(t0) {
288
297
  })]
289
298
  })
290
299
  }),
291
- /* @__PURE__ */ jsxs("div", {
300
+ /* @__PURE__ */ jsx("div", {
292
301
  className: "flex items-center gap-1",
293
- children: [/* @__PURE__ */ jsxs(Button, {
302
+ children: /* @__PURE__ */ jsxs(Button, {
294
303
  variant: "ghost",
295
304
  size: "sm",
296
305
  onClick: handleExitPreview,
@@ -303,68 +312,60 @@ function LivePreviewContent(t0) {
303
312
  className: "hidden sm:inline",
304
313
  children: t("preview.exitPreview")
305
314
  })]
306
- }), /* @__PURE__ */ jsxs(Button, {
307
- variant: "ghost",
308
- size: "icon",
309
- onClick: onClose,
310
- children: [/* @__PURE__ */ jsx(Icon, {
311
- icon: "ph:x",
312
- className: "h-4 w-4"
313
- }), /* @__PURE__ */ jsx("span", {
314
- className: "sr-only",
315
- children: t("common.close")
316
- })]
317
- })]
315
+ })
318
316
  })
319
317
  ]
320
318
  });
321
- $[21] = activeTab;
322
- $[22] = isMobile;
323
- $[23] = onClose;
324
- $[24] = open;
325
- $[25] = t;
326
- $[26] = t13;
327
- } else t13 = $[26];
328
- const t14 = open && !isMobile ? containerRef : void 0;
329
- const t15 = open ? isMobile ? "min-h-0 flex-1" : "flex min-h-0 flex-1" : "w-full";
330
- let t16;
331
- if ($[27] !== activeTab || $[28] !== isMobile || $[29] !== open) {
332
- t16 = open ? isMobile ? cn("h-full overflow-y-auto p-6", activeTab !== "form" && "hidden") : "bg-background h-full overflow-y-auto border-r p-6" : "w-full";
333
- $[27] = activeTab;
334
- $[28] = isMobile;
335
- $[29] = open;
336
- $[30] = t16;
337
- } else t16 = $[30];
319
+ $[23] = activeTab;
320
+ $[24] = isMobile;
321
+ $[25] = open;
322
+ $[26] = t;
323
+ $[27] = t14;
324
+ } else t14 = $[27];
325
+ const t15 = open && !isMobile ? containerRef : void 0;
326
+ const t16 = open ? isMobile ? "min-h-0 flex-1" : "flex min-h-0 flex-1" : "w-full";
338
327
  let t17;
339
- if ($[31] !== isMobile || $[32] !== open || $[33] !== previewPercent) {
340
- t17 = open && !isMobile ? { width: `${100 - previewPercent}%` } : void 0;
341
- $[31] = isMobile;
342
- $[32] = open;
343
- $[33] = previewPercent;
344
- $[34] = t17;
345
- } else t17 = $[34];
328
+ if ($[28] !== activeTab || $[29] !== isMobile || $[30] !== open) {
329
+ t17 = open ? isMobile ? cn("h-full overflow-y-auto p-6", activeTab !== "form" && "hidden") : "bg-background h-full overflow-y-auto border-r p-6" : "w-full";
330
+ $[28] = activeTab;
331
+ $[29] = isMobile;
332
+ $[30] = open;
333
+ $[31] = t17;
334
+ } else t17 = $[31];
346
335
  let t18;
347
- if ($[35] !== children || $[36] !== t16 || $[37] !== t17) {
348
- t18 = /* @__PURE__ */ jsx("div", {
336
+ if ($[32] !== isMobile || $[33] !== open || $[34] !== previewPercent) {
337
+ t18 = open && !isMobile ? { width: `${100 - previewPercent}%` } : void 0;
338
+ $[32] = isMobile;
339
+ $[33] = open;
340
+ $[34] = previewPercent;
341
+ $[35] = t18;
342
+ } else t18 = $[35];
343
+ let t19;
344
+ if ($[36] !== children || $[37] !== t17 || $[38] !== t18) {
345
+ t19 = /* @__PURE__ */ jsx("div", {
349
346
  "data-preview-form-scope": true,
350
- className: t16,
351
- style: t17,
347
+ className: t17,
348
+ style: t18,
352
349
  children
353
350
  });
354
- $[35] = children;
355
- $[36] = t16;
351
+ $[36] = children;
356
352
  $[37] = t17;
357
353
  $[38] = t18;
358
- } else t18 = $[38];
359
- let t19;
360
- if ($[39] !== activeTab || $[40] !== handlePreviewBlockClick || $[41] !== handlePreviewFieldClick || $[42] !== isMobile || $[43] !== open || $[44] !== previewRef || $[45] !== previewUrl || $[46] !== t) {
361
- t19 = open && isMobile && /* @__PURE__ */ jsx("div", {
354
+ $[39] = t19;
355
+ } else t19 = $[39];
356
+ let t20;
357
+ if ($[40] !== activeTab || $[41] !== handlePreviewBlockClick || $[42] !== handlePreviewBlockInsertRequest || $[43] !== handlePreviewFieldClick || $[44] !== isMobile || $[45] !== onFieldValueEdited || $[46] !== onPatchApplied || $[47] !== onResyncRequest || $[48] !== open || $[49] !== previewRef || $[50] !== previewUrl || $[51] !== t) {
358
+ t20 = open && isMobile && /* @__PURE__ */ jsx("div", {
362
359
  className: activeTab === "preview" ? "h-full" : "hidden",
363
360
  children: previewUrl ? /* @__PURE__ */ jsx(PreviewPane, {
364
361
  ref: previewRef,
365
362
  url: previewUrl,
366
363
  onFieldClick: handlePreviewFieldClick,
367
- onBlockClick: handlePreviewBlockClick
364
+ onBlockClick: handlePreviewBlockClick,
365
+ onBlockInsertRequest: handlePreviewBlockInsertRequest,
366
+ onFieldValueEdited,
367
+ onPatchApplied,
368
+ onResyncRequest
368
369
  }) : /* @__PURE__ */ jsxs("div", {
369
370
  className: "flex h-full items-center justify-center",
370
371
  children: [/* @__PURE__ */ jsx(Icon, {
@@ -376,19 +377,23 @@ function LivePreviewContent(t0) {
376
377
  })]
377
378
  })
378
379
  });
379
- $[39] = activeTab;
380
- $[40] = handlePreviewBlockClick;
381
- $[41] = handlePreviewFieldClick;
382
- $[42] = isMobile;
383
- $[43] = open;
384
- $[44] = previewRef;
385
- $[45] = previewUrl;
386
- $[46] = t;
387
- $[47] = t19;
388
- } else t19 = $[47];
389
- let t20;
390
- if ($[48] !== handleMouseDown || $[49] !== handlePreviewBlockClick || $[50] !== handlePreviewFieldClick || $[51] !== isMobile || $[52] !== open || $[53] !== previewPercent || $[54] !== previewRef || $[55] !== previewUrl || $[56] !== t) {
391
- t20 = open && !isMobile && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("button", {
380
+ $[40] = activeTab;
381
+ $[41] = handlePreviewBlockClick;
382
+ $[42] = handlePreviewBlockInsertRequest;
383
+ $[43] = handlePreviewFieldClick;
384
+ $[44] = isMobile;
385
+ $[45] = onFieldValueEdited;
386
+ $[46] = onPatchApplied;
387
+ $[47] = onResyncRequest;
388
+ $[48] = open;
389
+ $[49] = previewRef;
390
+ $[50] = previewUrl;
391
+ $[51] = t;
392
+ $[52] = t20;
393
+ } else t20 = $[52];
394
+ let t21;
395
+ if ($[53] !== handleMouseDown || $[54] !== handlePreviewBlockClick || $[55] !== handlePreviewBlockInsertRequest || $[56] !== handlePreviewFieldClick || $[57] !== isMobile || $[58] !== onFieldValueEdited || $[59] !== onPatchApplied || $[60] !== onResyncRequest || $[61] !== open || $[62] !== previewPercent || $[63] !== previewRef || $[64] !== previewUrl || $[65] !== t) {
396
+ t21 = open && !isMobile && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("button", {
392
397
  type: "button",
393
398
  "aria-label": "Resize preview pane",
394
399
  onMouseDown: handleMouseDown,
@@ -401,7 +406,11 @@ function LivePreviewContent(t0) {
401
406
  ref: previewRef,
402
407
  url: previewUrl,
403
408
  onFieldClick: handlePreviewFieldClick,
404
- onBlockClick: handlePreviewBlockClick
409
+ onBlockClick: handlePreviewBlockClick,
410
+ onBlockInsertRequest: handlePreviewBlockInsertRequest,
411
+ onFieldValueEdited,
412
+ onPatchApplied,
413
+ onResyncRequest
405
414
  }) : /* @__PURE__ */ jsxs("div", {
406
415
  className: "flex h-full items-center justify-center",
407
416
  children: [/* @__PURE__ */ jsx(Icon, {
@@ -413,47 +422,51 @@ function LivePreviewContent(t0) {
413
422
  })]
414
423
  })
415
424
  })] });
416
- $[48] = handleMouseDown;
417
- $[49] = handlePreviewBlockClick;
418
- $[50] = handlePreviewFieldClick;
419
- $[51] = isMobile;
420
- $[52] = open;
421
- $[53] = previewPercent;
422
- $[54] = previewRef;
423
- $[55] = previewUrl;
424
- $[56] = t;
425
- $[57] = t20;
426
- } else t20 = $[57];
427
- let t21;
428
- if ($[58] !== t14 || $[59] !== t15 || $[60] !== t18 || $[61] !== t19 || $[62] !== t20) {
429
- t21 = /* @__PURE__ */ jsxs("div", {
430
- ref: t14,
431
- className: t15,
425
+ $[53] = handleMouseDown;
426
+ $[54] = handlePreviewBlockClick;
427
+ $[55] = handlePreviewBlockInsertRequest;
428
+ $[56] = handlePreviewFieldClick;
429
+ $[57] = isMobile;
430
+ $[58] = onFieldValueEdited;
431
+ $[59] = onPatchApplied;
432
+ $[60] = onResyncRequest;
433
+ $[61] = open;
434
+ $[62] = previewPercent;
435
+ $[63] = previewRef;
436
+ $[64] = previewUrl;
437
+ $[65] = t;
438
+ $[66] = t21;
439
+ } else t21 = $[66];
440
+ let t22;
441
+ if ($[67] !== t15 || $[68] !== t16 || $[69] !== t19 || $[70] !== t20 || $[71] !== t21) {
442
+ t22 = /* @__PURE__ */ jsxs("div", {
443
+ ref: t15,
444
+ className: t16,
432
445
  children: [
433
- t18,
434
446
  t19,
435
- t20
447
+ t20,
448
+ t21
436
449
  ]
437
450
  });
438
- $[58] = t14;
439
- $[59] = t15;
440
- $[60] = t18;
441
- $[61] = t19;
442
- $[62] = t20;
443
- $[63] = t21;
444
- } else t21 = $[63];
445
- let t22;
446
- if ($[64] !== t12 || $[65] !== t13 || $[66] !== t21) {
447
- t22 = /* @__PURE__ */ jsxs("div", {
448
- className: t12,
449
- children: [t13, t21]
451
+ $[67] = t15;
452
+ $[68] = t16;
453
+ $[69] = t19;
454
+ $[70] = t20;
455
+ $[71] = t21;
456
+ $[72] = t22;
457
+ } else t22 = $[72];
458
+ let t23;
459
+ if ($[73] !== t13 || $[74] !== t14 || $[75] !== t22) {
460
+ t23 = /* @__PURE__ */ jsxs("div", {
461
+ className: t13,
462
+ children: [t14, t22]
450
463
  });
451
- $[64] = t12;
452
- $[65] = t13;
453
- $[66] = t21;
454
- $[67] = t22;
455
- } else t22 = $[67];
456
- return t22;
464
+ $[73] = t13;
465
+ $[74] = t14;
466
+ $[75] = t22;
467
+ $[76] = t23;
468
+ } else t23 = $[76];
469
+ return t23;
457
470
  }
458
471
  function _temp2(e_0) {
459
472
  return e_0.preventDefault();
@@ -462,13 +475,13 @@ function _temp() {
462
475
  window.location.href = "/api/preview?disable=true";
463
476
  }
464
477
  function LivePreviewMode(t0) {
465
- const $ = c(8);
466
- const { open, onClose, children, previewUrl, previewRef: previewRefProp, defaultSize, minSize } = t0;
478
+ const $ = c(11);
479
+ const { open, onClose, children, previewUrl, previewRef: previewRefProp, onFieldValueEdited, onPatchApplied, onResyncRequest, defaultSize, minSize } = t0;
467
480
  const fallbackPreviewRef = React.useRef(null);
468
481
  const previewRef = previewRefProp ?? fallbackPreviewRef;
469
482
  const handleFocusChange = _temp3;
470
483
  let t1;
471
- if ($[0] !== children || $[1] !== defaultSize || $[2] !== minSize || $[3] !== onClose || $[4] !== open || $[5] !== previewRef || $[6] !== previewUrl) {
484
+ if ($[0] !== children || $[1] !== defaultSize || $[2] !== minSize || $[3] !== onClose || $[4] !== onFieldValueEdited || $[5] !== onPatchApplied || $[6] !== onResyncRequest || $[7] !== open || $[8] !== previewRef || $[9] !== previewUrl) {
472
485
  t1 = /* @__PURE__ */ jsx(FocusProvider, {
473
486
  onFocusChange: handleFocusChange,
474
487
  children: /* @__PURE__ */ jsx(LivePreviewContent, {
@@ -476,6 +489,9 @@ function LivePreviewMode(t0) {
476
489
  onClose,
477
490
  previewUrl,
478
491
  previewRef,
492
+ onFieldValueEdited,
493
+ onPatchApplied,
494
+ onResyncRequest,
479
495
  defaultSize,
480
496
  minSize,
481
497
  children
@@ -485,11 +501,14 @@ function LivePreviewMode(t0) {
485
501
  $[1] = defaultSize;
486
502
  $[2] = minSize;
487
503
  $[3] = onClose;
488
- $[4] = open;
489
- $[5] = previewRef;
490
- $[6] = previewUrl;
491
- $[7] = t1;
492
- } else t1 = $[7];
504
+ $[4] = onFieldValueEdited;
505
+ $[5] = onPatchApplied;
506
+ $[6] = onResyncRequest;
507
+ $[7] = open;
508
+ $[8] = previewRef;
509
+ $[9] = previewUrl;
510
+ $[10] = t1;
511
+ } else t1 = $[10];
493
512
  return t1;
494
513
  }
495
514
  function _temp3(state) {
@@ -497,6 +516,13 @@ function _temp3(state) {
497
516
  else if (state.type === "block") setTimeout(() => {
498
517
  scrollFieldIntoView(state.fieldPath ? `content._values.${state.blockId}.${state.fieldPath}` : `content._values.${state.blockId}`);
499
518
  }, 150);
519
+ else if (state.type === "block-insert") {
520
+ const targetBlockId = state.referenceBlockId ?? state.position.parentId;
521
+ if (!targetBlockId) return;
522
+ setTimeout(() => {
523
+ scrollFieldIntoView(`content._values.${targetBlockId}`);
524
+ }, 150);
525
+ }
500
526
  }
501
527
 
502
528
  //#endregion