@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.
Files changed (255) hide show
  1. package/dist/client/blocks/block-renderer.d.mts +2 -2
  2. package/dist/client/blocks/block-renderer.mjs +164 -339
  3. package/dist/client/components/actions/action-button.mjs +9 -9
  4. package/dist/client/components/actions/action-dialog.mjs +195 -493
  5. package/dist/client/components/actions/confirmation-dialog.mjs +44 -159
  6. package/dist/client/components/actions/header-actions.mjs +73 -165
  7. package/dist/client/components/admin-link.d.mts +2 -2
  8. package/dist/client/components/admin-link.mjs +40 -126
  9. package/dist/client/components/auth/auth-loading.mjs +9 -44
  10. package/dist/client/components/blocks/block-canvas.mjs +31 -95
  11. package/dist/client/components/blocks/block-editor-context.mjs +13 -57
  12. package/dist/client/components/blocks/block-editor-layout.mjs +72 -166
  13. package/dist/client/components/blocks/block-editor-provider.mjs +184 -245
  14. package/dist/client/components/blocks/block-fields-renderer.mjs +54 -229
  15. package/dist/client/components/blocks/block-insert-button.mjs +49 -165
  16. package/dist/client/components/blocks/block-item-menu.mjs +102 -301
  17. package/dist/client/components/blocks/block-item.mjs +136 -370
  18. package/dist/client/components/blocks/block-library-sidebar.mjs +103 -230
  19. package/dist/client/components/blocks/block-tree.mjs +12 -68
  20. package/dist/client/components/blocks/block-type-icon.mjs +14 -56
  21. package/dist/client/components/brand-logo.mjs +35 -149
  22. package/dist/client/components/component-renderer.mjs +42 -118
  23. package/dist/client/components/error-boundary.mjs +14 -58
  24. package/dist/client/components/fields/array-field.mjs +209 -521
  25. package/dist/client/components/fields/asset-preview-field.mjs +41 -141
  26. package/dist/client/components/fields/blocks-field/blocks-field.mjs +60 -156
  27. package/dist/client/components/fields/boolean-field.mjs +29 -59
  28. package/dist/client/components/fields/date-field.mjs +7 -37
  29. package/dist/client/components/fields/datetime-field.mjs +7 -38
  30. package/dist/client/components/fields/email-field.mjs +25 -54
  31. package/dist/client/components/fields/field-wrapper.mjs +30 -105
  32. package/dist/client/components/fields/json-field.mjs +94 -296
  33. package/dist/client/components/fields/locale-badge.mjs +6 -15
  34. package/dist/client/components/fields/number-field.mjs +27 -60
  35. package/dist/client/components/fields/object-array-field.mjs +283 -659
  36. package/dist/client/components/fields/object-field.mjs +165 -633
  37. package/dist/client/components/fields/relation/displays/cards-display.mjs +106 -220
  38. package/dist/client/components/fields/relation/displays/chips-display.mjs +78 -150
  39. package/dist/client/components/fields/relation/displays/grid-display.mjs +92 -186
  40. package/dist/client/components/fields/relation/displays/list-display.mjs +122 -239
  41. package/dist/client/components/fields/relation/displays/table-display.mjs +70 -244
  42. package/dist/client/components/fields/relation/relation-items-display.mjs +30 -126
  43. package/dist/client/components/fields/relation-field.mjs +10 -66
  44. package/dist/client/components/fields/relation-picker.mjs +18 -18
  45. package/dist/client/components/fields/relation-select.mjs +12 -12
  46. package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +80 -180
  47. package/dist/client/components/fields/rich-text-editor/image-popover.mjs +2 -2
  48. package/dist/client/components/fields/rich-text-editor/image-upload.mjs +13 -29
  49. package/dist/client/components/fields/rich-text-editor/index.mjs +195 -513
  50. package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +61 -111
  51. package/dist/client/components/fields/rich-text-editor/table-controls.mjs +105 -415
  52. package/dist/client/components/fields/rich-text-editor/toolbar.mjs +256 -511
  53. package/dist/client/components/fields/rich-text-field.mjs +14 -53
  54. package/dist/client/components/fields/select-field.mjs +61 -72
  55. package/dist/client/components/fields/text-field.mjs +26 -59
  56. package/dist/client/components/fields/textarea-field.mjs +26 -58
  57. package/dist/client/components/fields/time-field.mjs +7 -35
  58. package/dist/client/components/fields/upload-field.mjs +47 -165
  59. package/dist/client/components/filter-builder/columns-tab.mjs +80 -280
  60. package/dist/client/components/filter-builder/filter-builder-sheet.mjs +197 -540
  61. package/dist/client/components/filter-builder/filters-tab.mjs +96 -386
  62. package/dist/client/components/filter-builder/saved-views-tab.mjs +133 -351
  63. package/dist/client/components/history-sidebar.mjs +285 -605
  64. package/dist/client/components/layout/field-layout-renderer.mjs +106 -254
  65. package/dist/client/components/locale-switcher.mjs +106 -228
  66. package/dist/client/components/media/media-grid.mjs +84 -273
  67. package/dist/client/components/media/media-picker-dialog.mjs +176 -476
  68. package/dist/client/components/preview/live-preview-mode.mjs +233 -458
  69. package/dist/client/components/preview/preview-pane.mjs +22 -22
  70. package/dist/client/components/primitives/asset-preview.mjs +290 -666
  71. package/dist/client/components/primitives/checkbox-input.mjs +9 -35
  72. package/dist/client/components/primitives/date-input.mjs +109 -327
  73. package/dist/client/components/primitives/dropzone.mjs +209 -336
  74. package/dist/client/components/primitives/field-select-control.mjs +12 -80
  75. package/dist/client/components/primitives/number-input.mjs +4 -4
  76. package/dist/client/components/primitives/select-multi.mjs +229 -572
  77. package/dist/client/components/primitives/select-single.mjs +179 -499
  78. package/dist/client/components/primitives/time-input.mjs +43 -117
  79. package/dist/client/components/primitives/toggle-input.mjs +9 -29
  80. package/dist/client/components/sheets/resource-sheet.mjs +61 -70
  81. package/dist/client/components/ui/accordion.mjs +35 -155
  82. package/dist/client/components/ui/alert.mjs +13 -68
  83. package/dist/client/components/ui/badge.mjs +9 -51
  84. package/dist/client/components/ui/button.mjs +8 -54
  85. package/dist/client/components/ui/card.mjs +37 -193
  86. package/dist/client/components/ui/checkbox.mjs +12 -68
  87. package/dist/client/components/ui/command.mjs +48 -219
  88. package/dist/client/components/ui/dialog.mjs +50 -262
  89. package/dist/client/components/ui/drawer.mjs +55 -259
  90. package/dist/client/components/ui/dropdown-menu.mjs +86 -427
  91. package/dist/client/components/ui/empty-state.mjs +28 -98
  92. package/dist/client/components/ui/field.mjs +73 -309
  93. package/dist/client/components/ui/input-group.mjs +42 -167
  94. package/dist/client/components/ui/input.mjs +7 -37
  95. package/dist/client/components/ui/kbd.mjs +6 -36
  96. package/dist/client/components/ui/label.mjs +7 -37
  97. package/dist/client/components/ui/popover.mjs +34 -169
  98. package/dist/client/components/ui/responsive-dialog.mjs +67 -273
  99. package/dist/client/components/ui/scroll-fade.mjs +63 -158
  100. package/dist/client/components/ui/search-input.mjs +33 -100
  101. package/dist/client/components/ui/select.mjs +72 -393
  102. package/dist/client/components/ui/separator.mjs +7 -38
  103. package/dist/client/components/ui/sheet.mjs +49 -269
  104. package/dist/client/components/ui/sidebar.mjs +171 -690
  105. package/dist/client/components/ui/skeleton.mjs +7 -38
  106. package/dist/client/components/ui/sonner.mjs +11 -42
  107. package/dist/client/components/ui/switch.mjs +9 -45
  108. package/dist/client/components/ui/table.mjs +48 -266
  109. package/dist/client/components/ui/tabs.mjs +26 -139
  110. package/dist/client/components/ui/textarea.mjs +6 -32
  111. package/dist/client/components/ui/tooltip.mjs +27 -129
  112. package/dist/client/components/widgets/chart-widget.mjs +174 -522
  113. package/dist/client/components/widgets/progress-widget.mjs +66 -172
  114. package/dist/client/components/widgets/quick-actions-widget.mjs +102 -261
  115. package/dist/client/components/widgets/recent-items-widget.mjs +69 -195
  116. package/dist/client/components/widgets/stats-widget.mjs +41 -175
  117. package/dist/client/components/widgets/table-widget.mjs +9 -9
  118. package/dist/client/components/widgets/timeline-widget.mjs +86 -226
  119. package/dist/client/components/widgets/value-widget.mjs +74 -381
  120. package/dist/client/components/widgets/widget-empty-state.mjs +26 -76
  121. package/dist/client/components/widgets/widget-skeletons.mjs +138 -421
  122. package/dist/client/contexts/focus-context.mjs +63 -146
  123. package/dist/client/hooks/typed-hooks.mjs +241 -701
  124. package/dist/client/hooks/use-action.mjs +62 -198
  125. package/dist/client/hooks/use-admin-config.mjs +5 -35
  126. package/dist/client/hooks/use-admin-preferences.mjs +16 -88
  127. package/dist/client/hooks/use-admin-routes.mjs +22 -56
  128. package/dist/client/hooks/use-audit-history.mjs +21 -69
  129. package/dist/client/hooks/use-brand.mjs +1 -9
  130. package/dist/client/hooks/use-collection-fields.mjs +17 -57
  131. package/dist/client/hooks/use-collection-meta.mjs +12 -44
  132. package/dist/client/hooks/use-collection-schema.mjs +10 -33
  133. package/dist/client/hooks/use-collection-validation.mjs +23 -53
  134. package/dist/client/hooks/use-collection.mjs +194 -614
  135. package/dist/client/hooks/use-current-user.mjs +0 -1
  136. package/dist/client/hooks/use-field-hooks.mjs +10 -10
  137. package/dist/client/hooks/use-field-options.mjs +61 -202
  138. package/dist/client/hooks/use-global-fields.mjs +14 -46
  139. package/dist/client/hooks/use-global-meta.mjs +9 -30
  140. package/dist/client/hooks/use-global-schema.mjs +9 -30
  141. package/dist/client/hooks/use-global.mjs +63 -219
  142. package/dist/client/hooks/use-locks.mjs +117 -325
  143. package/dist/client/hooks/use-media-query.mjs +16 -36
  144. package/dist/client/hooks/use-prefill-params.mjs +0 -1
  145. package/dist/client/hooks/use-questpie-query-options.mjs +12 -29
  146. package/dist/client/hooks/use-reactive-fields.mjs +1 -1
  147. package/dist/client/hooks/use-reactive-prop.mjs +65 -223
  148. package/dist/client/hooks/use-realtime-highlight.mjs +51 -114
  149. package/dist/client/hooks/use-saved-views.mjs +22 -103
  150. package/dist/client/hooks/use-search-param-toggle.mjs +28 -79
  151. package/dist/client/hooks/use-search.mjs +31 -143
  152. package/dist/client/hooks/use-server-actions.mjs +18 -50
  153. package/dist/client/hooks/use-server-validation.mjs +72 -166
  154. package/dist/client/hooks/use-server-widget-data.mjs +7 -33
  155. package/dist/client/hooks/use-setup-status.mjs +12 -25
  156. package/dist/client/hooks/use-sidebar-search-param.mjs +33 -78
  157. package/dist/client/hooks/use-transition-stage.mjs +8 -38
  158. package/dist/client/hooks/use-upload.mjs +54 -152
  159. package/dist/client/hooks/use-validation-error-map.mjs +6 -26
  160. package/dist/client/hooks/use-view-state.mjs +187 -437
  161. package/dist/client/i18n/hooks.mjs +65 -197
  162. package/dist/client/lib/render-profiler.mjs +14 -41
  163. package/dist/client/preview/block-scope-context.mjs +14 -36
  164. package/dist/client/preview/preview-banner.d.mts +2 -2
  165. package/dist/client/preview/preview-banner.mjs +42 -108
  166. package/dist/client/preview/preview-field.d.mts +4 -4
  167. package/dist/client/preview/preview-field.mjs +167 -348
  168. package/dist/client/preview/use-collection-preview.mjs +121 -215
  169. package/dist/client/runtime/content-locales-provider.mjs +31 -83
  170. package/dist/client/runtime/locale-scope.mjs +22 -63
  171. package/dist/client/runtime/provider.mjs +100 -255
  172. package/dist/client/runtime/translations-provider.mjs +41 -107
  173. package/dist/client/scope/picker.mjs +86 -321
  174. package/dist/client/scope/provider.mjs +8 -17
  175. package/dist/client/utils/build-field-definitions-from-schema.mjs +4 -2
  176. package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
  177. package/dist/client/views/auth/accept-invite-form.mjs +121 -412
  178. package/dist/client/views/auth/auth-layout.d.mts +3 -3
  179. package/dist/client/views/auth/auth-layout.mjs +104 -284
  180. package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
  181. package/dist/client/views/auth/forgot-password-form.mjs +94 -325
  182. package/dist/client/views/auth/invite-form.mjs +107 -442
  183. package/dist/client/views/auth/login-form.d.mts +2 -2
  184. package/dist/client/views/auth/login-form.mjs +116 -337
  185. package/dist/client/views/auth/reset-password-form.d.mts +2 -2
  186. package/dist/client/views/auth/reset-password-form.mjs +128 -453
  187. package/dist/client/views/auth/setup-form.d.mts +2 -2
  188. package/dist/client/views/auth/setup-form.mjs +140 -478
  189. package/dist/client/views/collection/auto-form-fields.mjs +243 -615
  190. package/dist/client/views/collection/bulk-action-toolbar.mjs +212 -379
  191. package/dist/client/views/collection/cells/complex-cells.mjs +183 -611
  192. package/dist/client/views/collection/cells/primitive-cells.mjs +116 -356
  193. package/dist/client/views/collection/cells/relation-cells.mjs +86 -233
  194. package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +142 -371
  195. package/dist/client/views/collection/cells/shared/relation-chip.mjs +35 -131
  196. package/dist/client/views/collection/cells/upload-cells.mjs +60 -177
  197. package/dist/client/views/collection/columns/build-columns.mjs +8 -48
  198. package/dist/client/views/collection/field-renderer.mjs +58 -182
  199. package/dist/client/views/collection/form-view.mjs +284 -518
  200. package/dist/client/views/collection/table-view.mjs +231 -463
  201. package/dist/client/views/collection/view-skeletons.mjs +112 -237
  202. package/dist/client/views/common/global-search.mjs +241 -560
  203. package/dist/client/views/dashboard/dashboard-grid.mjs +256 -775
  204. package/dist/client/views/dashboard/dashboard-widget.mjs +38 -126
  205. package/dist/client/views/dashboard/widget-card.mjs +61 -269
  206. package/dist/client/views/globals/global-form-view.mjs +477 -1301
  207. package/dist/client/views/layout/admin-layout-provider.mjs +28 -88
  208. package/dist/client/views/layout/admin-layout.mjs +83 -246
  209. package/dist/client/views/layout/admin-router.mjs +458 -1274
  210. package/dist/client/views/layout/admin-sidebar.mjs +510 -1292
  211. package/dist/client/views/layout/admin-theme.mjs +30 -64
  212. package/dist/client/views/layout/admin-view-layout.mjs +40 -144
  213. package/dist/client/views/pages/accept-invite-page.d.mts +2 -2
  214. package/dist/client/views/pages/accept-invite-page.mjs +95 -290
  215. package/dist/client/views/pages/dashboard-page.d.mts +2 -2
  216. package/dist/client/views/pages/dashboard-page.mjs +11 -57
  217. package/dist/client/views/pages/forgot-password-page.d.mts +2 -2
  218. package/dist/client/views/pages/forgot-password-page.mjs +31 -83
  219. package/dist/client/views/pages/invite-page.d.mts +2 -2
  220. package/dist/client/views/pages/invite-page.mjs +35 -90
  221. package/dist/client/views/pages/login-page.d.mts +2 -2
  222. package/dist/client/views/pages/login-page.mjs +41 -121
  223. package/dist/client/views/pages/reset-password-page.d.mts +2 -2
  224. package/dist/client/views/pages/reset-password-page.mjs +46 -173
  225. package/dist/client/views/pages/setup-page.d.mts +2 -2
  226. package/dist/client/views/pages/setup-page.mjs +33 -95
  227. package/dist/components/rich-text/rich-text-renderer.mjs +9 -33
  228. package/dist/server/adapters/index.d.mts +2 -0
  229. package/dist/server/adapters/nextjs.d.mts +1 -0
  230. package/dist/server/auth-helpers.d.mts +1 -0
  231. package/dist/server/modules/admin/.generated/module.d.mts +1 -0
  232. package/dist/server/modules/admin/collections/account.d.mts +46 -46
  233. package/dist/server/modules/admin/collections/admin-locks.d.mts +50 -50
  234. package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
  235. package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
  236. package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
  237. package/dist/server/modules/admin/collections/assets.d.mts +39 -39
  238. package/dist/server/modules/admin/collections/session.d.mts +42 -42
  239. package/dist/server/modules/admin/collections/user.d.mts +62 -62
  240. package/dist/server/modules/admin/collections/verification.d.mts +23 -23
  241. package/dist/server/modules/admin/index.d.mts +20 -19
  242. package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
  243. package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
  244. package/dist/server/modules/admin/routes/locales.d.mts +2 -2
  245. package/dist/server/modules/admin/routes/preview.d.mts +11 -11
  246. package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
  247. package/dist/server/modules/admin/routes/setup.d.mts +7 -7
  248. package/dist/server/modules/admin/routes/translations.d.mts +4 -4
  249. package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
  250. package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +45 -45
  251. package/dist/server/modules/audit/.generated/module.d.mts +6 -6
  252. package/dist/server/modules/audit/collections/audit-log.d.mts +78 -78
  253. package/dist/server/modules/audit/jobs/audit-cleanup.d.mts +2 -2
  254. package/dist/server.d.mts +2 -0
  255. package/package.json +3 -5
@@ -37,7 +37,6 @@ import { detectManyToManyRelations, hasManyToManyRelations } from "../../utils/d
37
37
  import { shouldHandleAdminShortcut } from "../../utils/keyboard-shortcuts.mjs";
38
38
  import { AdminViewHeader } from "../layout/admin-view-layout.mjs";
39
39
  import { FormViewSkeleton } from "./view-skeletons.mjs";
40
- import { c } from "react/compiler-runtime";
41
40
  import { Icon } from "@iconify/react";
42
41
  import * as React from "react";
43
42
  import { useQuery, useQueryClient } from "@tanstack/react-query";
@@ -135,444 +134,220 @@ function normalizeInlineEditValue(message) {
135
134
  * Component that manages reactive field states.
136
135
  * Must be rendered inside FormProvider to access form context.
137
136
  */
138
- function ReactiveFieldsManager(t0) {
139
- const $ = c(8);
140
- const { collection, mode: t1, reactiveConfigs, enabled } = t0;
141
- const mode = t1 === void 0 ? "collection" : t1;
142
- let t2;
143
- if ($[0] !== enabled || $[1] !== reactiveConfigs) {
144
- t2 = enabled && Object.keys(reactiveConfigs).length > 0;
145
- $[0] = enabled;
146
- $[1] = reactiveConfigs;
147
- $[2] = t2;
148
- } else t2 = $[2];
149
- let t3;
150
- if ($[3] !== collection || $[4] !== mode || $[5] !== reactiveConfigs || $[6] !== t2) {
151
- t3 = {
152
- collection,
153
- mode,
154
- reactiveConfigs,
155
- enabled: t2,
156
- debounce: 300
157
- };
158
- $[3] = collection;
159
- $[4] = mode;
160
- $[5] = reactiveConfigs;
161
- $[6] = t2;
162
- $[7] = t3;
163
- } else t3 = $[7];
164
- useReactiveFields(t3);
137
+ function ReactiveFieldsManager({ collection, mode = "collection", reactiveConfigs, enabled }) {
138
+ useReactiveFields({
139
+ collection,
140
+ mode,
141
+ reactiveConfigs,
142
+ enabled: enabled && Object.keys(reactiveConfigs).length > 0,
143
+ debounce: 300
144
+ });
165
145
  return null;
166
146
  }
167
- const FormFieldsContent = React.memo(function FormFieldsContent$1(t0) {
168
- const $ = c(8);
169
- const { collection, config, registry, allCollectionsConfig } = t0;
170
- const t1 = `form.fields.${collection}`;
171
- const t2 = collection;
172
- const t3 = config;
173
- const t4 = allCollectionsConfig;
174
- let t5;
175
- if ($[0] !== registry || $[1] !== t2 || $[2] !== t3 || $[3] !== t4) {
176
- t5 = /* @__PURE__ */ jsx(AutoFormFields, {
177
- collection: t2,
178
- config: t3,
147
+ const FormFieldsContent = React.memo(function FormFieldsContent$1({ collection, config, registry, allCollectionsConfig }) {
148
+ return /* @__PURE__ */ jsx(RenderProfiler, {
149
+ id: `form.fields.${collection}`,
150
+ minDurationMs: 10,
151
+ children: /* @__PURE__ */ jsx(AutoFormFields, {
152
+ collection,
153
+ config,
179
154
  registry,
180
- allCollectionsConfig: t4
181
- });
182
- $[0] = registry;
183
- $[1] = t2;
184
- $[2] = t3;
185
- $[3] = t4;
186
- $[4] = t5;
187
- } else t5 = $[4];
188
- let t6;
189
- if ($[5] !== t1 || $[6] !== t5) {
190
- t6 = /* @__PURE__ */ jsx(RenderProfiler, {
191
- id: t1,
192
- minDurationMs: 10,
193
- children: t5
194
- });
195
- $[5] = t1;
196
- $[6] = t5;
197
- $[7] = t6;
198
- } else t6 = $[7];
199
- return t6;
155
+ allCollectionsConfig
156
+ })
157
+ });
200
158
  });
201
- const FormStateRefBridge = React.memo(function FormStateRefBridge$1(t0) {
202
- const $ = c(10);
203
- const { control, onDirtyChange, onSubmittingChange } = t0;
204
- let t1;
205
- if ($[0] !== control) {
206
- t1 = { control };
207
- $[0] = control;
208
- $[1] = t1;
209
- } else t1 = $[1];
210
- const { isDirty, isSubmitting } = useFormState(t1);
211
- let t2;
212
- let t3;
213
- if ($[2] !== isDirty || $[3] !== onDirtyChange) {
214
- t2 = () => {
215
- onDirtyChange(isDirty);
216
- };
217
- t3 = [isDirty, onDirtyChange];
218
- $[2] = isDirty;
219
- $[3] = onDirtyChange;
220
- $[4] = t2;
221
- $[5] = t3;
222
- } else {
223
- t2 = $[4];
224
- t3 = $[5];
225
- }
226
- React.useEffect(t2, t3);
227
- let t4;
228
- let t5;
229
- if ($[6] !== isSubmitting || $[7] !== onSubmittingChange) {
230
- t4 = () => {
231
- onSubmittingChange(isSubmitting);
232
- };
233
- t5 = [isSubmitting, onSubmittingChange];
234
- $[6] = isSubmitting;
235
- $[7] = onSubmittingChange;
236
- $[8] = t4;
237
- $[9] = t5;
238
- } else {
239
- t4 = $[8];
240
- t5 = $[9];
241
- }
242
- React.useEffect(t4, t5);
159
+ const FormStateRefBridge = React.memo(function FormStateRefBridge$1({ control, onDirtyChange, onSubmittingChange }) {
160
+ const { isDirty, isSubmitting } = useFormState({ control });
161
+ React.useEffect(() => {
162
+ onDirtyChange(isDirty);
163
+ }, [isDirty, onDirtyChange]);
164
+ React.useEffect(() => {
165
+ onSubmittingChange(isSubmitting);
166
+ }, [isSubmitting, onSubmittingChange]);
243
167
  return null;
244
168
  });
245
- const PreviewPatchBridge = React.memo(function PreviewPatchBridge$1(t0) {
246
- const $ = c(5);
247
- const { form, previewRef, enabled } = t0;
169
+ const PreviewPatchBridge = React.memo(function PreviewPatchBridge$1({ form, previewRef, enabled }) {
248
170
  const previousSnapshotRef = React.useRef(null);
249
171
  const snapshotVersionRef = React.useRef(void 0);
250
- let t1;
251
- let t2;
252
- if ($[0] !== enabled || $[1] !== form || $[2] !== previewRef) {
253
- t1 = () => {
254
- if (!enabled) {
255
- previousSnapshotRef.current = null;
256
- snapshotVersionRef.current = void 0;
172
+ React.useEffect(() => {
173
+ if (!enabled) {
174
+ previousSnapshotRef.current = null;
175
+ snapshotVersionRef.current = void 0;
176
+ return;
177
+ }
178
+ const initialSnapshot = cloneSnapshot(form.getValues());
179
+ previousSnapshotRef.current = initialSnapshot;
180
+ snapshotVersionRef.current = previewRef.current?.sendInitSnapshot(initialSnapshot);
181
+ let animationFrame = null;
182
+ const pendingOps = /* @__PURE__ */ new Map();
183
+ const flushPendingOps = () => {
184
+ animationFrame = null;
185
+ if (pendingOps.size === 0) return;
186
+ const ops = [...pendingOps.values()];
187
+ pendingOps.clear();
188
+ previewRef.current?.sendPatchBatch(ops, snapshotVersionRef.current);
189
+ };
190
+ const queuePatchOps = (ops) => {
191
+ for (const op of ops) if (op.path) pendingOps.set(op.path, op);
192
+ if (pendingOps.size === 0 || animationFrame !== null) return;
193
+ animationFrame = window.requestAnimationFrame(flushPendingOps);
194
+ };
195
+ const subscription = form.watch((values, info) => {
196
+ const previousSnapshot = previousSnapshotRef.current;
197
+ const nextValues = values;
198
+ if (!previousSnapshot) {
199
+ const nextSnapshot = cloneSnapshot(nextValues);
200
+ previousSnapshotRef.current = nextSnapshot;
201
+ snapshotVersionRef.current = previewRef.current?.sendInitSnapshot(nextSnapshot);
257
202
  return;
258
203
  }
259
- const initialSnapshot = cloneSnapshot(form.getValues());
260
- previousSnapshotRef.current = initialSnapshot;
261
- snapshotVersionRef.current = previewRef.current?.sendInitSnapshot(initialSnapshot);
262
- let animationFrame = null;
263
- const pendingOps = /* @__PURE__ */ new Map();
264
- const flushPendingOps = () => {
265
- animationFrame = null;
266
- if (pendingOps.size === 0) return;
267
- const ops = [...pendingOps.values()];
204
+ const changedPath = info?.name;
205
+ let ops = changedPath && isSafePreviewEditPath(changedPath) ? diffSnapshotAtPath(previousSnapshot, nextValues, changedPath) : diffSnapshot(previousSnapshot, nextValues);
206
+ if (ops.some((op) => !op.path)) {
207
+ const nextSnapshot = cloneSnapshot(nextValues);
208
+ previousSnapshotRef.current = nextSnapshot;
209
+ snapshotVersionRef.current = previewRef.current?.sendInitSnapshot(nextSnapshot);
268
210
  pendingOps.clear();
269
- previewRef.current?.sendPatchBatch(ops, snapshotVersionRef.current);
270
- };
271
- const queuePatchOps = (ops_0) => {
272
- for (const op of ops_0) if (op.path) pendingOps.set(op.path, op);
273
- if (pendingOps.size === 0 || animationFrame !== null) return;
274
- animationFrame = window.requestAnimationFrame(flushPendingOps);
275
- };
276
- const subscription = form.watch((values, info) => {
277
- const previousSnapshot = previousSnapshotRef.current;
278
- const nextValues = values;
279
- if (!previousSnapshot) {
280
- const nextSnapshot = cloneSnapshot(nextValues);
281
- previousSnapshotRef.current = nextSnapshot;
282
- snapshotVersionRef.current = previewRef.current?.sendInitSnapshot(nextSnapshot);
283
- return;
284
- }
285
- const changedPath = info?.name;
286
- let ops_1 = changedPath && isSafePreviewEditPath(changedPath) ? diffSnapshotAtPath(previousSnapshot, nextValues, changedPath) : diffSnapshot(previousSnapshot, nextValues);
287
- if (ops_1.some(_temp)) {
288
- const nextSnapshot_0 = cloneSnapshot(nextValues);
289
- previousSnapshotRef.current = nextSnapshot_0;
290
- snapshotVersionRef.current = previewRef.current?.sendInitSnapshot(nextSnapshot_0);
291
- pendingOps.clear();
292
- return;
293
- }
294
- ops_1 = ops_1.filter(_temp2);
295
- if (ops_1.length === 0) return;
296
- previousSnapshotRef.current = applyPatchBatchImmutable(previousSnapshot, ops_1);
297
- queuePatchOps(ops_1);
298
- });
299
- return () => {
300
- if (animationFrame !== null) window.cancelAnimationFrame(animationFrame);
301
- subscription.unsubscribe();
302
- };
211
+ return;
212
+ }
213
+ ops = ops.filter((op) => op.path);
214
+ if (ops.length === 0) return;
215
+ previousSnapshotRef.current = applyPatchBatchImmutable(previousSnapshot, ops);
216
+ queuePatchOps(ops);
217
+ });
218
+ return () => {
219
+ if (animationFrame !== null) window.cancelAnimationFrame(animationFrame);
220
+ subscription.unsubscribe();
303
221
  };
304
- t2 = [
305
- enabled,
306
- form,
307
- previewRef
308
- ];
309
- $[0] = enabled;
310
- $[1] = form;
311
- $[2] = previewRef;
312
- $[3] = t1;
313
- $[4] = t2;
314
- } else {
315
- t1 = $[3];
316
- t2 = $[4];
317
- }
318
- React.useEffect(t1, t2);
222
+ }, [
223
+ enabled,
224
+ form,
225
+ previewRef
226
+ ]);
319
227
  return null;
320
228
  });
321
- const AutosaveManager = React.memo(function AutosaveManager$1(t0) {
322
- const $ = c(19);
323
- const { form, formElementRef, isEditMode, id, enabled, debounce, isDirtyRef, isSubmittingRef, updateMutation, onPreviewRefresh, onPreviewCommit, onSavingChange, onSaved } = t0;
229
+ const AutosaveManager = React.memo(function AutosaveManager$1({ form, formElementRef, isEditMode, id, enabled, debounce, isDirtyRef, isSubmittingRef, updateMutation, onPreviewRefresh, onPreviewCommit, onSavingChange, onSaved }) {
324
230
  const { t } = useTranslation();
325
231
  const timerRef = React.useRef(null);
326
- let t1;
327
- if ($[0] !== form || $[1] !== id || $[2] !== isDirtyRef || $[3] !== isSubmittingRef || $[4] !== onPreviewCommit || $[5] !== onPreviewRefresh || $[6] !== onSaved || $[7] !== onSavingChange || $[8] !== t || $[9] !== updateMutation) {
328
- t1 = async () => {
329
- if (!id || !isDirtyRef.current || isSubmittingRef.current) return;
330
- try {
331
- onSavingChange(true);
332
- await form.handleSubmit(async (data) => {
333
- const result = await updateMutation.mutateAsync({
334
- id,
335
- data
336
- });
337
- form.reset(result, { keepTouched: true });
338
- onPreviewCommit?.(result);
339
- onPreviewRefresh?.();
340
- onSaved(/* @__PURE__ */ new Date());
341
- onSavingChange(false);
342
- }, () => {
343
- onSavingChange(false);
344
- })();
345
- } catch (t2$1) {
346
- const error = t2$1;
232
+ const runAutosave = React.useCallback(async () => {
233
+ if (!id || !isDirtyRef.current || isSubmittingRef.current) return;
234
+ try {
235
+ onSavingChange(true);
236
+ await form.handleSubmit(async (data) => {
237
+ const result = await updateMutation.mutateAsync({
238
+ id,
239
+ data
240
+ });
241
+ form.reset(result, { keepTouched: true });
242
+ onPreviewCommit?.(result);
243
+ onPreviewRefresh?.();
244
+ onSaved(/* @__PURE__ */ new Date());
347
245
  onSavingChange(false);
348
- console.error("Autosave failed:", error);
349
- toast.error(t("error.autosaveFailed"), { description: error instanceof Error ? error.message : void 0 });
350
- }
246
+ }, () => {
247
+ onSavingChange(false);
248
+ })();
249
+ } catch (error) {
250
+ onSavingChange(false);
251
+ console.error("Autosave failed:", error);
252
+ toast.error(t("error.autosaveFailed"), { description: error instanceof Error ? error.message : void 0 });
253
+ }
254
+ }, [
255
+ form,
256
+ id,
257
+ isDirtyRef,
258
+ isSubmittingRef,
259
+ onSaved,
260
+ onSavingChange,
261
+ onPreviewCommit,
262
+ onPreviewRefresh,
263
+ t,
264
+ updateMutation
265
+ ]);
266
+ React.useEffect(() => {
267
+ if (timerRef.current) clearTimeout(timerRef.current);
268
+ if (!enabled || !isEditMode || !id) return;
269
+ const target = formElementRef.current;
270
+ if (!target) return;
271
+ const scheduleAutosave = () => {
272
+ if (timerRef.current) clearTimeout(timerRef.current);
273
+ timerRef.current = setTimeout(() => {
274
+ runAutosave();
275
+ }, debounce);
351
276
  };
352
- $[0] = form;
353
- $[1] = id;
354
- $[2] = isDirtyRef;
355
- $[3] = isSubmittingRef;
356
- $[4] = onPreviewCommit;
357
- $[5] = onPreviewRefresh;
358
- $[6] = onSaved;
359
- $[7] = onSavingChange;
360
- $[8] = t;
361
- $[9] = updateMutation;
362
- $[10] = t1;
363
- } else t1 = $[10];
364
- const runAutosave = t1;
365
- let t2;
366
- let t3;
367
- if ($[11] !== debounce || $[12] !== enabled || $[13] !== formElementRef || $[14] !== id || $[15] !== isEditMode || $[16] !== runAutosave) {
368
- t2 = () => {
277
+ target.addEventListener("input", scheduleAutosave, { capture: true });
278
+ target.addEventListener("change", scheduleAutosave, { capture: true });
279
+ return () => {
280
+ target.removeEventListener("input", scheduleAutosave, { capture: true });
281
+ target.removeEventListener("change", scheduleAutosave, { capture: true });
369
282
  if (timerRef.current) clearTimeout(timerRef.current);
370
- if (!enabled || !isEditMode || !id) return;
371
- const target = formElementRef.current;
372
- if (!target) return;
373
- const scheduleAutosave = () => {
374
- if (timerRef.current) clearTimeout(timerRef.current);
375
- timerRef.current = setTimeout(() => {
376
- runAutosave();
377
- }, debounce);
378
- };
379
- target.addEventListener("input", scheduleAutosave, { capture: true });
380
- target.addEventListener("change", scheduleAutosave, { capture: true });
381
- return () => {
382
- target.removeEventListener("input", scheduleAutosave, { capture: true });
383
- target.removeEventListener("change", scheduleAutosave, { capture: true });
384
- if (timerRef.current) clearTimeout(timerRef.current);
385
- };
386
283
  };
387
- t3 = [
388
- debounce,
389
- enabled,
390
- formElementRef,
391
- id,
392
- isEditMode,
393
- runAutosave
394
- ];
395
- $[11] = debounce;
396
- $[12] = enabled;
397
- $[13] = formElementRef;
398
- $[14] = id;
399
- $[15] = isEditMode;
400
- $[16] = runAutosave;
401
- $[17] = t2;
402
- $[18] = t3;
403
- } else {
404
- t2 = $[17];
405
- t3 = $[18];
406
- }
407
- React.useEffect(t2, t3);
284
+ }, [
285
+ debounce,
286
+ enabled,
287
+ formElementRef,
288
+ id,
289
+ isEditMode,
290
+ runAutosave
291
+ ]);
408
292
  return null;
409
293
  });
410
- const AutosaveIndicator = React.memo(function AutosaveIndicator$1(t0) {
411
- const $ = c(26);
412
- const { control, enabled, indicator, isEditMode, isSaving, lastSaved, formatTimeAgo, t } = t0;
413
- let t1;
414
- if ($[0] !== control) {
415
- t1 = { control };
416
- $[0] = control;
417
- $[1] = t1;
418
- } else t1 = $[1];
419
- const { isDirty } = useFormState(t1);
420
- const [, forceUpdate] = React.useReducer(_temp3, 0);
421
- let t2;
422
- if ($[2] !== forceUpdate || $[3] !== lastSaved) {
423
- t2 = () => {
424
- if (!lastSaved) return;
425
- const interval = setInterval(forceUpdate, 1e4);
426
- return () => clearInterval(interval);
427
- };
428
- $[2] = forceUpdate;
429
- $[3] = lastSaved;
430
- $[4] = t2;
431
- } else t2 = $[4];
432
- let t3;
433
- if ($[5] !== lastSaved) {
434
- t3 = [lastSaved];
435
- $[5] = lastSaved;
436
- $[6] = t3;
437
- } else t3 = $[6];
438
- React.useEffect(t2, t3);
294
+ const AutosaveIndicator = React.memo(function AutosaveIndicator$1({ control, enabled, indicator, isEditMode, isSaving, lastSaved, formatTimeAgo, t }) {
295
+ const { isDirty } = useFormState({ control });
296
+ const [, forceUpdate] = React.useReducer((x) => x + 1, 0);
297
+ React.useEffect(() => {
298
+ if (!lastSaved) return;
299
+ const interval = setInterval(forceUpdate, 1e4);
300
+ return () => clearInterval(interval);
301
+ }, [lastSaved]);
439
302
  if (!enabled || !indicator || !isEditMode) return null;
440
- if (isSaving) {
441
- let t4;
442
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
443
- t4 = /* @__PURE__ */ jsx(Icon, {
444
- icon: "ph:spinner-gap",
445
- className: "size-3 animate-spin"
446
- });
447
- $[7] = t4;
448
- } else t4 = $[7];
449
- let t5;
450
- if ($[8] !== t) {
451
- t5 = t("autosave.saving");
452
- $[8] = t;
453
- $[9] = t5;
454
- } else t5 = $[9];
455
- let t6;
456
- if ($[10] !== t5) {
457
- t6 = /* @__PURE__ */ jsxs(Badge, {
458
- variant: "secondary",
459
- className: "gap-1.5",
460
- children: [t4, t5]
461
- });
462
- $[10] = t5;
463
- $[11] = t6;
464
- } else t6 = $[11];
465
- return t6;
466
- }
467
- if (isDirty) {
468
- let t4;
469
- if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
470
- t4 = /* @__PURE__ */ jsx(Icon, {
471
- icon: "ph:clock-counter-clockwise",
472
- className: "size-3"
473
- });
474
- $[12] = t4;
475
- } else t4 = $[12];
476
- let t5;
477
- if ($[13] !== t) {
478
- t5 = t("autosave.unsavedChanges");
479
- $[13] = t;
480
- $[14] = t5;
481
- } else t5 = $[14];
482
- let t6;
483
- if ($[15] !== t5) {
484
- t6 = /* @__PURE__ */ jsxs(Badge, {
485
- variant: "outline",
486
- className: "gap-1.5",
487
- children: [t4, t5]
488
- });
489
- $[15] = t5;
490
- $[16] = t6;
491
- } else t6 = $[16];
492
- return t6;
493
- }
494
- if (lastSaved) {
495
- let t4;
496
- if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
497
- t4 = /* @__PURE__ */ jsx(Icon, {
303
+ if (isSaving) return /* @__PURE__ */ jsxs(Badge, {
304
+ variant: "secondary",
305
+ className: "gap-1.5",
306
+ children: [/* @__PURE__ */ jsx(Icon, {
307
+ icon: "ph:spinner-gap",
308
+ className: "size-3 animate-spin"
309
+ }), t("autosave.saving")]
310
+ });
311
+ if (isDirty) return /* @__PURE__ */ jsxs(Badge, {
312
+ variant: "outline",
313
+ className: "gap-1.5",
314
+ children: [/* @__PURE__ */ jsx(Icon, {
315
+ icon: "ph:clock-counter-clockwise",
316
+ className: "size-3"
317
+ }), t("autosave.unsavedChanges")]
318
+ });
319
+ if (lastSaved) return /* @__PURE__ */ jsxs(Badge, {
320
+ variant: "secondary",
321
+ className: "text-muted-foreground gap-1.5",
322
+ children: [
323
+ /* @__PURE__ */ jsx(Icon, {
498
324
  icon: "ph:check",
499
325
  className: "size-3"
500
- });
501
- $[17] = t4;
502
- } else t4 = $[17];
503
- let t5;
504
- if ($[18] !== t) {
505
- t5 = t("autosave.saved");
506
- $[18] = t;
507
- $[19] = t5;
508
- } else t5 = $[19];
509
- let t6;
510
- if ($[20] !== formatTimeAgo || $[21] !== lastSaved) {
511
- t6 = formatTimeAgo(lastSaved);
512
- $[20] = formatTimeAgo;
513
- $[21] = lastSaved;
514
- $[22] = t6;
515
- } else t6 = $[22];
516
- let t7;
517
- if ($[23] !== t5 || $[24] !== t6) {
518
- t7 = /* @__PURE__ */ jsxs(Badge, {
519
- variant: "secondary",
520
- className: "text-muted-foreground gap-1.5",
521
- children: [
522
- t4,
523
- t5,
524
- " ",
525
- t6
526
- ]
527
- });
528
- $[23] = t5;
529
- $[24] = t6;
530
- $[25] = t7;
531
- } else t7 = $[25];
532
- return t7;
533
- }
326
+ }),
327
+ t("autosave.saved"),
328
+ " ",
329
+ formatTimeAgo(lastSaved)
330
+ ]
331
+ });
534
332
  return null;
535
333
  });
536
- const SaveSubmitButton = React.memo(function SaveSubmitButton$1(t0) {
537
- const $ = c(8);
538
- const { control, isMutationPending, t } = t0;
539
- let t1;
540
- if ($[0] !== control) {
541
- t1 = { control };
542
- $[0] = control;
543
- $[1] = t1;
544
- } else t1 = $[1];
545
- const { isDirty, isSubmitting } = useFormState(t1);
334
+ const SaveSubmitButton = React.memo(function SaveSubmitButton$1({ control, isMutationPending, t }) {
335
+ const { isDirty, isSubmitting } = useFormState({ control });
546
336
  const isSubmittingNow = isMutationPending || isSubmitting;
547
- const t2 = isSubmittingNow || !isDirty;
548
- let t3;
549
- if ($[2] !== isSubmittingNow || $[3] !== t) {
550
- t3 = isSubmittingNow ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Icon, {
337
+ return /* @__PURE__ */ jsx(Button, {
338
+ type: "submit",
339
+ size: "sm",
340
+ disabled: isSubmittingNow || !isDirty,
341
+ className: "gap-2",
342
+ children: isSubmittingNow ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Icon, {
551
343
  icon: "ph:spinner-gap",
552
344
  className: "size-4 animate-spin"
553
345
  }), t("common.loading")] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Icon, {
554
346
  icon: "ph:check",
555
347
  width: 16,
556
348
  height: 16
557
- }), t("common.save")] });
558
- $[2] = isSubmittingNow;
559
- $[3] = t;
560
- $[4] = t3;
561
- } else t3 = $[4];
562
- let t4;
563
- if ($[5] !== t2 || $[6] !== t3) {
564
- t4 = /* @__PURE__ */ jsx(Button, {
565
- type: "submit",
566
- size: "sm",
567
- disabled: t2,
568
- className: "gap-2",
569
- children: t3
570
- });
571
- $[5] = t2;
572
- $[6] = t3;
573
- $[7] = t4;
574
- } else t4 = $[7];
575
- return t4;
349
+ }), t("common.save")] })
350
+ });
576
351
  });
577
352
  /**
578
353
  * FormView - Default form-based edit/create view for collections
@@ -694,8 +469,8 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
694
469
  const allowedTransitions = React.useMemo(() => {
695
470
  if (!workflowConfig?.stages || !currentStage) return [];
696
471
  const stageNames = currentStageConfig?.transitions;
697
- if (stageNames && stageNames.length > 0) return stageNames.map((name) => workflowConfig.stages.find((s_0) => s_0.name === name)).filter(Boolean);
698
- return workflowConfig.stages.filter((s_1) => s_1.name !== currentStage);
472
+ if (stageNames && stageNames.length > 0) return stageNames.map((name) => workflowConfig.stages.find((s) => s.name === name)).filter(Boolean);
473
+ return workflowConfig.stages.filter((s) => s.name !== currentStage);
699
474
  }, [
700
475
  workflowConfig,
701
476
  currentStage,
@@ -741,8 +516,8 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
741
516
  });
742
517
  setTimeout(() => scrollFieldIntoView(message.path, { focus: false }), 0);
743
518
  }, [form, schema]);
744
- const handlePreviewResyncRequest = React.useCallback((reason_0) => {
745
- triggerPreviewFullResync(reason_0 ?? "preview-request");
519
+ const handlePreviewResyncRequest = React.useCallback((reason) => {
520
+ triggerPreviewFullResync(reason ?? "preview-request");
746
521
  }, [triggerPreviewFullResync]);
747
522
  /**
748
523
  * Execute the confirmed workflow transition (immediate or scheduled).
@@ -762,10 +537,10 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
762
537
  setTransitionSchedule(false);
763
538
  setTransitionScheduledAt(null);
764
539
  };
765
- transitionMutation.mutateAsync(params).then((result_0) => {
766
- if (result_0) {
767
- if (typeof result_0 === "object") {
768
- if ("id" in result_0) form.reset(result_0);
540
+ transitionMutation.mutateAsync(params).then((result) => {
541
+ if (result) {
542
+ if (typeof result === "object") {
543
+ if ("id" in result) form.reset(result);
769
544
  }
770
545
  }
771
546
  triggerPreviewFullResync("workflow-transition");
@@ -892,23 +667,23 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
892
667
  const handleLocaleDialogOpenChange = React.useCallback((open) => {
893
668
  if (!open) handleLocaleChangeCancel();
894
669
  }, [handleLocaleChangeCancel]);
895
- const onSubmit = React.useEffectEvent(async (data_0) => {
670
+ const onSubmit = React.useEffectEvent(async (data) => {
896
671
  const savePromise = async () => {
897
672
  if (isEditMode && id) return await updateMutation.mutateAsync({
898
673
  id,
899
- data: data_0
674
+ data
900
675
  });
901
- else return await createMutation.mutateAsync(data_0);
676
+ else return await createMutation.mutateAsync(data);
902
677
  };
903
678
  toast.promise(savePromise(), {
904
679
  loading: isEditMode ? t("toast.saving") : t("toast.creating"),
905
- success: (result_1) => {
906
- if (onSuccess) onSuccess(result_1);
680
+ success: (result) => {
681
+ if (onSuccess) onSuccess(result);
907
682
  else if (isEditMode) {
908
- form.reset(result_1);
909
- commitPreviewSnapshot(result_1);
683
+ form.reset(result);
684
+ commitPreviewSnapshot(result);
910
685
  triggerPreviewRefresh();
911
- } else if (result_1?.id) navigate(`${basePath}/collections/${collection}/${result_1.id}`);
686
+ } else if (result?.id) navigate(`${basePath}/collections/${collection}/${result.id}`);
912
687
  else navigate(`${basePath}/collections/${collection}`);
913
688
  return isEditMode ? t("toast.saveSuccess") : t("toast.createSuccess");
914
689
  },
@@ -920,9 +695,9 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
920
695
  });
921
696
  return t("toast.validationFailed");
922
697
  }
923
- const message_0 = error instanceof Error ? error.message : t("error.unknown");
924
- onError?.(error instanceof Error ? error : new Error(message_0));
925
- return `${t("toast.saveFailed")}: ${message_0}`;
698
+ const message = error instanceof Error ? error.message : t("error.unknown");
699
+ onError?.(error instanceof Error ? error : new Error(message));
700
+ return `${t("toast.saveFailed")}: ${message}`;
926
701
  }
927
702
  });
928
703
  });
@@ -942,13 +717,13 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
942
717
  onSubmitRef.current = onSubmit;
943
718
  });
944
719
  React.useEffect(() => {
945
- const handleKeyDown = (e_0) => {
946
- if (shouldHandleAdminShortcut(e_0, {
720
+ const handleKeyDown = (e) => {
721
+ if (shouldHandleAdminShortcut(e, {
947
722
  allowEditableTarget: true,
948
723
  key: "s"
949
724
  })) {
950
- e_0.preventDefault();
951
- e_0.stopPropagation();
725
+ e.preventDefault();
726
+ e.stopPropagation();
952
727
  form.handleSubmit(onSubmitRef.current, (errors) => {
953
728
  console.warn("[FormView] Validation errors:", errors);
954
729
  toast.error(t("toast.validationFailed"));
@@ -976,10 +751,10 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
976
751
  const primary = [...base.primary ?? []];
977
752
  const secondary = [...base.secondary ?? []];
978
753
  const existingIds = new Set([...primary, ...secondary].map((a) => a.id));
979
- for (const action_0 of scopedServerFormActions) {
980
- if (existingIds.has(action_0.id)) continue;
981
- secondary.push(action_0);
982
- existingIds.add(action_0.id);
754
+ for (const action of scopedServerFormActions) {
755
+ if (existingIds.has(action.id)) continue;
756
+ secondary.push(action);
757
+ existingIds.add(action.id);
983
758
  }
984
759
  return {
985
760
  primary,
@@ -1003,8 +778,8 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
1003
778
  }), [client, contentLocale]);
1004
779
  const actionQueryClient = React.useMemo(() => ({
1005
780
  invalidateQueries: (filters) => queryClient.invalidateQueries(filters),
1006
- refetchQueries: (filters_0) => queryClient.refetchQueries(filters_0),
1007
- resetQueries: (filters_1) => queryClient.resetQueries(filters_1)
781
+ refetchQueries: (filters) => queryClient.refetchQueries(filters),
782
+ resetQueries: (filters) => queryClient.resetQueries(filters)
1008
783
  }), [queryClient]);
1009
784
  const actionHelpers = React.useMemo(() => ({
1010
785
  navigate: storeNavigate,
@@ -1030,18 +805,18 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
1030
805
  contentLocale
1031
806
  ]) });
1032
807
  },
1033
- invalidateItem: async (itemId, targetCollection_0) => {
1034
- const col_0 = targetCollection_0 || collection;
808
+ invalidateItem: async (itemId, targetCollection) => {
809
+ const col = targetCollection || collection;
1035
810
  await queryClient.invalidateQueries({ queryKey: queryOpts.key([
1036
811
  "collections",
1037
- col_0,
812
+ col,
1038
813
  "findOne",
1039
814
  contentLocale,
1040
815
  { id: itemId }
1041
816
  ]) });
1042
817
  await queryClient.invalidateQueries({ queryKey: queryOpts.key([
1043
818
  "collections",
1044
- col_0,
819
+ col,
1045
820
  "find",
1046
821
  contentLocale
1047
822
  ]) });
@@ -1094,48 +869,48 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
1094
869
  ]);
1095
870
  const filterVisibleActions = React.useCallback((actions) => {
1096
871
  if (!actions) return [];
1097
- return actions.filter((action_1) => {
1098
- if (action_1.visible === void 0) return true;
1099
- if (typeof action_1.visible === "function") return action_1.visible(actionContext);
1100
- return action_1.visible;
872
+ return actions.filter((action) => {
873
+ if (action.visible === void 0) return true;
874
+ if (typeof action.visible === "function") return action.visible(actionContext);
875
+ return action.visible;
1101
876
  });
1102
877
  }, [actionContext]);
1103
878
  const visiblePrimaryActions = React.useMemo(() => filterVisibleActions(formActions.primary), [formActions.primary, filterVisibleActions]);
1104
879
  const visibleSecondaryActions = React.useMemo(() => filterVisibleActions(formActions.secondary), [formActions.secondary, filterVisibleActions]);
1105
- const regularSecondary = visibleSecondaryActions.filter((a_0) => a_0.variant !== "destructive");
1106
- const destructiveSecondary = visibleSecondaryActions.filter((a_1) => a_1.variant === "destructive");
1107
- const executeAction = async (action_2) => {
1108
- const { handler } = action_2;
1109
- const actionLabel = resolveText(action_2.label, action_2.id);
880
+ const regularSecondary = visibleSecondaryActions.filter((a) => a.variant !== "destructive");
881
+ const destructiveSecondary = visibleSecondaryActions.filter((a) => a.variant === "destructive");
882
+ const executeAction = async (action) => {
883
+ const { handler } = action;
884
+ const actionLabel = resolveText(action.label, action.id);
1110
885
  switch (handler.type) {
1111
886
  case "navigate":
1112
887
  storeNavigate(typeof handler.path === "function" ? handler.path(transformedItem) : handler.path);
1113
888
  break;
1114
889
  case "api":
1115
890
  if (handler.method === "POST" && handler.endpoint === "{id}/restore") {
1116
- const itemId_0 = transformedItem?.id || id;
1117
- if (!itemId_0) {
891
+ const itemId = transformedItem?.id || id;
892
+ if (!itemId) {
1118
893
  toast.error(t("collection.restoreError"));
1119
894
  break;
1120
895
  }
1121
896
  setActionLoading(true);
1122
- toast.promise(restoreMutation.mutateAsync({ id: itemId_0 }).finally(() => {
897
+ toast.promise(restoreMutation.mutateAsync({ id: itemId }).finally(() => {
1123
898
  setActionLoading(false);
1124
899
  }), {
1125
900
  loading: t("collection.restoring"),
1126
901
  success: t("collection.restoreSuccess"),
1127
- error: (err_1) => err_1.message || t("collection.restoreError")
902
+ error: (err) => err.message || t("collection.restoreError")
1128
903
  });
1129
904
  break;
1130
905
  }
1131
906
  if (handler.method === "DELETE") {
1132
- const itemId_1 = transformedItem?.id || id;
1133
- if (!itemId_1) {
907
+ const itemId = transformedItem?.id || id;
908
+ if (!itemId) {
1134
909
  toast.error(t("toast.deleteFailed"));
1135
910
  break;
1136
911
  }
1137
912
  setActionLoading(true);
1138
- toast.promise(deleteMutation.mutateAsync({ id: itemId_1 }).finally(() => {
913
+ toast.promise(deleteMutation.mutateAsync({ id: itemId }).finally(() => {
1139
914
  setActionLoading(false);
1140
915
  }), {
1141
916
  loading: t("toast.deleting"),
@@ -1143,7 +918,7 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
1143
918
  storeNavigate(`${storeBasePath || basePath}/collections/${collection}`);
1144
919
  return t("toast.deleteSuccess");
1145
920
  },
1146
- error: (err_2) => err_2.message || t("toast.deleteFailed")
921
+ error: (err) => err.message || t("toast.deleteFailed")
1147
922
  });
1148
923
  } else {
1149
924
  let itemId_;
@@ -1156,15 +931,15 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
1156
931
  setActionLoading(true);
1157
932
  const apiPromise = async () => {
1158
933
  const url = `${storeBasePath}/${collection}/${endpoint}`;
1159
- const response_0 = await fetch(url, {
934
+ const response = await fetch(url, {
1160
935
  method,
1161
936
  headers: { "Content-Type": "application/json" },
1162
937
  body
1163
938
  });
1164
- if (!response_0.ok) {
939
+ if (!response.ok) {
1165
940
  let errorBody = {};
1166
941
  try {
1167
- errorBody = await response_0.json();
942
+ errorBody = await response.json();
1168
943
  } catch {}
1169
944
  let errorMessage;
1170
945
  if (errorBody.message) if (typeof errorBody.message === "string") errorMessage = errorBody.message;
@@ -1172,15 +947,15 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
1172
947
  else errorMessage = t("toast.actionFailed");
1173
948
  throw new Error(errorMessage);
1174
949
  }
1175
- return response_0.json();
950
+ return response.json();
1176
951
  };
1177
952
  const p = apiPromise();
1178
953
  p.then(() => setActionLoading(false), () => setActionLoading(false));
1179
954
  toast.promise(p, {
1180
955
  loading: `${actionLabel}...`,
1181
956
  success: t("toast.actionSuccess"),
1182
- error: (err_3) => {
1183
- if (err_3.message) return err_3.message;
957
+ error: (err) => {
958
+ if (err.message) return err.message;
1184
959
  return t("toast.actionFailed");
1185
960
  }
1186
961
  });
@@ -1193,7 +968,7 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
1193
968
  toast.promise(customPromise.finally(() => setActionLoading(false)), {
1194
969
  loading: `${actionLabel}...`,
1195
970
  success: t("toast.actionSuccess"),
1196
- error: (err_0) => err_0.message || t("toast.actionFailed")
971
+ error: (err) => err.message || t("toast.actionFailed")
1197
972
  });
1198
973
  }
1199
974
  break;
@@ -1210,17 +985,17 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
1210
985
  itemId: transformedItem?.id || id
1211
986
  });
1212
987
  if (!response?.success || response.result?.type === "error") throw new Error(response?.error ?? response?.result?.toast?.message ?? t("error.serverActionFailed"));
1213
- const result_2 = response.result;
1214
- if (result_2?.toast?.message) toast.success(result_2.toast.message);
988
+ const result = response.result;
989
+ if (result?.toast?.message) toast.success(result.toast.message);
1215
990
  else toast.success(t("toast.actionSuccess"));
1216
- if (result_2?.effects?.invalidate === true) await actionHelpers.invalidateAll();
1217
- else if (Array.isArray(result_2?.effects?.invalidate)) for (const col_1 of result_2.effects.invalidate) await actionHelpers.invalidateCollection(col_1);
1218
- if (result_2?.effects?.redirect) storeNavigate(result_2.effects.redirect);
1219
- if (result_2?.type === "redirect" && result_2.url) if (result_2.external) window.open(result_2.url, "_blank");
1220
- else storeNavigate(result_2.url);
1221
- if (result_2?.effects?.closeModal) actionHelpers.closeDialog();
1222
- } catch (error_0) {
1223
- toast.error(error_0 instanceof Error ? error_0.message : t("error.actionFailed"));
991
+ if (result?.effects?.invalidate === true) await actionHelpers.invalidateAll();
992
+ else if (Array.isArray(result?.effects?.invalidate)) for (const col of result.effects.invalidate) await actionHelpers.invalidateCollection(col);
993
+ if (result?.effects?.redirect) storeNavigate(result.effects.redirect);
994
+ if (result?.type === "redirect" && result.url) if (result.external) window.open(result.url, "_blank");
995
+ else storeNavigate(result.url);
996
+ if (result?.effects?.closeModal) actionHelpers.closeDialog();
997
+ } catch (error) {
998
+ toast.error(error instanceof Error ? error.message : t("error.actionFailed"));
1224
999
  } finally {
1225
1000
  setActionLoading(false);
1226
1001
  }
@@ -1237,31 +1012,31 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
1237
1012
  const payload = { id };
1238
1013
  if (typeof pendingRevertVersion.versionId === "string") payload.versionId = pendingRevertVersion.versionId;
1239
1014
  else if (typeof pendingRevertVersion.versionNumber === "number") payload.version = pendingRevertVersion.versionNumber;
1240
- const result_3 = await revertVersionMutation.mutateAsync(payload);
1241
- form.reset(result_3);
1015
+ const result = await revertVersionMutation.mutateAsync(payload);
1016
+ form.reset(result);
1242
1017
  triggerPreviewFullResync("version-revert");
1243
1018
  toast.success(t("version.revertSuccess"));
1244
1019
  setPendingRevertVersion(null);
1245
1020
  };
1246
- const handleActionClick = (action_3) => {
1247
- if (action_3.confirmation) setConfirmAction(action_3);
1248
- else if (action_3.handler.type === "dialog" || action_3.handler.type === "form") setDialogAction(action_3);
1249
- else executeAction(action_3);
1021
+ const handleActionClick = (action) => {
1022
+ if (action.confirmation) setConfirmAction(action);
1023
+ else if (action.handler.type === "dialog" || action.handler.type === "form") setDialogAction(action);
1024
+ else executeAction(action);
1250
1025
  };
1251
1026
  const handleConfirm = async () => {
1252
1027
  if (confirmAction) await executeAction(confirmAction);
1253
1028
  };
1254
- const handleConfirmActionOpenChange = React.useCallback((open_0) => {
1255
- if (!open_0) setConfirmAction(null);
1029
+ const handleConfirmActionOpenChange = React.useCallback((open) => {
1030
+ if (!open) setConfirmAction(null);
1256
1031
  }, []);
1257
- const handleActionDialogOpenChange = React.useCallback((open_1) => {
1258
- if (!open_1) setDialogAction(null);
1032
+ const handleActionDialogOpenChange = React.useCallback((open) => {
1033
+ if (!open) setDialogAction(null);
1259
1034
  }, []);
1260
- const handleRevertDialogOpenChange = React.useCallback((open_2) => {
1261
- if (!open_2) setPendingRevertVersion(null);
1035
+ const handleRevertDialogOpenChange = React.useCallback((open) => {
1036
+ if (!open) setPendingRevertVersion(null);
1262
1037
  }, []);
1263
- const handleWorkflowDialogOpenChange = React.useCallback((open_3) => {
1264
- if (!open_3) {
1038
+ const handleWorkflowDialogOpenChange = React.useCallback((open) => {
1039
+ if (!open) {
1265
1040
  setTransitionTarget(null);
1266
1041
  setTransitionSchedule(false);
1267
1042
  setTransitionScheduledAt(null);
@@ -1286,8 +1061,8 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
1286
1061
  minute: "2-digit"
1287
1062
  });
1288
1063
  };
1289
- const formatTimeAgo = (date_0) => {
1290
- const seconds = Math.floor((Date.now() - date_0.getTime()) / 1e3);
1064
+ const formatTimeAgo = (date) => {
1065
+ const seconds = Math.floor((Date.now() - date.getTime()) / 1e3);
1291
1066
  if (seconds < 10) return t("autosave.justNow");
1292
1067
  if (seconds < 60) return t("autosave.secondsAgo", { count: seconds });
1293
1068
  const minutes = Math.floor(seconds / 60);
@@ -1309,7 +1084,7 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
1309
1084
  for (const event of events) target.addEventListener(event, scheduleLockRefresh, { capture: true });
1310
1085
  scheduleLockRefresh();
1311
1086
  return () => {
1312
- for (const event_0 of events) target.removeEventListener(event_0, scheduleLockRefresh, { capture: true });
1087
+ for (const event of events) target.removeEventListener(event, scheduleLockRefresh, { capture: true });
1313
1088
  if (lockRefreshTimerRef.current) clearTimeout(lockRefreshTimerRef.current);
1314
1089
  };
1315
1090
  }, [
@@ -1449,17 +1224,17 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
1449
1224
  minDurationMs: 12,
1450
1225
  children: /* @__PURE__ */ jsxs("form", {
1451
1226
  ref: formElementRef,
1452
- onSubmit: (e_1) => {
1453
- e_1.stopPropagation();
1227
+ onSubmit: (e) => {
1228
+ e.stopPropagation();
1454
1229
  if (isBlocked) {
1455
- e_1.preventDefault();
1230
+ e.preventDefault();
1456
1231
  toast.error(t("lock.cannotSave"));
1457
1232
  return;
1458
1233
  }
1459
- form.handleSubmit(onSubmit, (errors_0) => {
1460
- console.warn("[FormView] Validation errors:", errors_0);
1234
+ form.handleSubmit(onSubmit, (errors) => {
1235
+ console.warn("[FormView] Validation errors:", errors);
1461
1236
  toast.error(t("toast.validationFailed"), { description: t("toast.validationDescription") });
1462
- })(e_1);
1237
+ })(e);
1463
1238
  },
1464
1239
  className: "qa-form-view__form space-y-4",
1465
1240
  children: [
@@ -1569,13 +1344,13 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
1569
1344
  }), stage.label || stage.name]
1570
1345
  }, stage.name))
1571
1346
  })] }),
1572
- visiblePrimaryActions.map((action_4) => /* @__PURE__ */ jsx(ActionButton, {
1573
- action: action_4,
1347
+ visiblePrimaryActions.map((action) => /* @__PURE__ */ jsx(ActionButton, {
1348
+ action,
1574
1349
  collection,
1575
1350
  helpers: actionHelpers,
1576
1351
  size: "sm",
1577
- onOpenDialog: (a_2) => setDialogAction(a_2)
1578
- }, action_4.id)),
1352
+ onOpenDialog: (a) => setDialogAction(a)
1353
+ }, action.id)),
1579
1354
  /* @__PURE__ */ jsx(SaveSubmitButton, {
1580
1355
  control: form.control,
1581
1356
  isMutationPending,
@@ -1593,21 +1368,21 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
1593
1368
  }), /* @__PURE__ */ jsxs(DropdownMenuContent, {
1594
1369
  align: "end",
1595
1370
  children: [
1596
- regularSecondary.map((action_5) => {
1371
+ regularSecondary.map((action) => {
1597
1372
  return /* @__PURE__ */ jsxs(DropdownMenuItem, {
1598
- onClick: () => handleActionClick(action_5),
1373
+ onClick: () => handleActionClick(action),
1599
1374
  disabled: actionLoading,
1600
- children: [resolveIconElement(action_5.icon, { className: "mr-2 size-4" }), resolveText(action_5.label)]
1601
- }, action_5.id);
1375
+ children: [resolveIconElement(action.icon, { className: "mr-2 size-4" }), resolveText(action.label)]
1376
+ }, action.id);
1602
1377
  }),
1603
1378
  regularSecondary.length > 0 && destructiveSecondary.length > 0 && /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
1604
- destructiveSecondary.map((action_6) => {
1379
+ destructiveSecondary.map((action) => {
1605
1380
  return /* @__PURE__ */ jsxs(DropdownMenuItem, {
1606
1381
  variant: "destructive",
1607
- onClick: () => handleActionClick(action_6),
1382
+ onClick: () => handleActionClick(action),
1608
1383
  disabled: actionLoading,
1609
- children: [resolveIconElement(action_6.icon, { className: "mr-2 size-4" }), resolveText(action_6.label)]
1610
- }, action_6.id);
1384
+ children: [resolveIconElement(action.icon, { className: "mr-2 size-4" }), resolveText(action.label)]
1385
+ }, action.id);
1611
1386
  })
1612
1387
  ]
1613
1388
  })] })
@@ -1678,8 +1453,8 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
1678
1453
  fields: schema?.fields,
1679
1454
  isLoadingVersions: versionsLoading,
1680
1455
  isReverting: revertVersionMutation.isPending,
1681
- onRevert: async (version_0) => {
1682
- handleRevertVersion(version_0);
1456
+ onRevert: async (version) => {
1457
+ handleRevertVersion(version);
1683
1458
  },
1684
1459
  showVersionsTab: !!schema?.options?.versioning
1685
1460
  }),
@@ -1781,15 +1556,6 @@ function FormView({ collection, id, config, viewConfig, navigate, basePath = "/a
1781
1556
  children: formShell
1782
1557
  });
1783
1558
  }
1784
- function _temp(op_0) {
1785
- return !op_0.path;
1786
- }
1787
- function _temp2(op_1) {
1788
- return op_1.path;
1789
- }
1790
- function _temp3(x) {
1791
- return x + 1;
1792
- }
1793
1559
 
1794
1560
  //#endregion
1795
1561
  export { FormView as default };