@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
@@ -6,7 +6,6 @@ import { resolveIconElement } from "../../components/component-renderer.mjs";
6
6
  import { Button } from "../../components/ui/button.mjs";
7
7
  import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "../../components/ui/dropdown-menu.mjs";
8
8
  import { ConfirmationDialog } from "../../components/actions/confirmation-dialog.mjs";
9
- import { c } from "react/compiler-runtime";
10
9
  import { Icon } from "@iconify/react";
11
10
  import * as React from "react";
12
11
  import { useQueryClient } from "@tanstack/react-query";
@@ -46,10 +45,7 @@ function getSelectedIds(items) {
46
45
  * )}
47
46
  * ```
48
47
  */
49
- function BulkActionToolbar(t0) {
50
- const $ = c(83);
51
- const { table, actions, collection, helpers, totalCount, pageCount, onOpenDialog, onSelectAllMatching, onBulkDelete, onBulkRestore, filterCount: t1, onClearFilters, onOpenFilters } = t0;
52
- const filterCount = t1 === void 0 ? 0 : t1;
48
+ function BulkActionToolbar({ table, actions, collection, helpers, totalCount, pageCount, onOpenDialog, onSelectAllMatching, onBulkDelete, onBulkRestore, filterCount = 0, onClearFilters, onOpenFilters }) {
53
49
  const { t } = useTranslation();
54
50
  const resolveText = useResolveText();
55
51
  const authClient = useAdminStore(selectAuthClient);
@@ -57,214 +53,139 @@ function BulkActionToolbar(t0) {
57
53
  const [confirmAction, setConfirmAction] = React.useState(null);
58
54
  const [isLoading, setIsLoading] = React.useState(false);
59
55
  const [isSelectingAll, setIsSelectingAll] = React.useState(false);
60
- let t2;
61
- if ($[0] !== queryClient) {
62
- t2 = {
63
- invalidateQueries: (filters) => queryClient.invalidateQueries(filters),
64
- refetchQueries: (filters_0) => queryClient.refetchQueries(filters_0),
65
- resetQueries: (filters_1) => queryClient.resetQueries(filters_1)
66
- };
67
- $[0] = queryClient;
68
- $[1] = t2;
69
- } else t2 = $[1];
70
- const actionQueryClient = t2;
71
- let t3;
72
- if ($[2] !== table) {
73
- t3 = table.getSelectedRowModel();
74
- $[2] = table;
75
- $[3] = t3;
76
- } else t3 = $[3];
77
- const selectedRows = t3.rows;
78
- let t4;
79
- if ($[4] !== selectedRows) {
80
- t4 = selectedRows.map(_temp);
81
- $[4] = selectedRows;
82
- $[5] = t4;
83
- } else t4 = $[5];
84
- const selectedItems = t4;
56
+ const actionQueryClient = React.useMemo(() => ({
57
+ invalidateQueries: (filters) => queryClient.invalidateQueries(filters),
58
+ refetchQueries: (filters) => queryClient.refetchQueries(filters),
59
+ resetQueries: (filters) => queryClient.resetQueries(filters)
60
+ }), [queryClient]);
61
+ const selectedRows = table.getSelectedRowModel().rows;
62
+ const selectedItems = React.useMemo(() => selectedRows.map((row) => row.original), [selectedRows]);
85
63
  const selectedCount = selectedItems.length;
86
- let t5;
87
- if ($[6] !== actionQueryClient || $[7] !== authClient || $[8] !== collection || $[9] !== helpers || $[10] !== selectedItems) {
88
- t5 = {
89
- item: selectedItems,
90
- collection,
91
- helpers,
92
- queryClient: actionQueryClient,
93
- authClient
94
- };
95
- $[6] = actionQueryClient;
96
- $[7] = authClient;
97
- $[8] = collection;
98
- $[9] = helpers;
99
- $[10] = selectedItems;
100
- $[11] = t5;
101
- } else t5 = $[11];
102
- const ctx = t5;
103
- let t6;
104
- if ($[12] !== actions || $[13] !== ctx) {
105
- let t7$1;
106
- if ($[15] !== ctx) {
107
- t7$1 = (action) => {
108
- if (action.visible === void 0) return true;
109
- if (typeof action.visible === "function") return action.visible(ctx);
110
- return action.visible;
111
- };
112
- $[15] = ctx;
113
- $[16] = t7$1;
114
- } else t7$1 = $[16];
115
- t6 = actions.filter(t7$1);
116
- $[12] = actions;
117
- $[13] = ctx;
118
- $[14] = t6;
119
- } else t6 = $[14];
120
- const visibleActions = t6;
64
+ const ctx = React.useMemo(() => ({
65
+ item: selectedItems,
66
+ collection,
67
+ helpers,
68
+ queryClient: actionQueryClient,
69
+ authClient
70
+ }), [
71
+ selectedItems,
72
+ collection,
73
+ helpers,
74
+ actionQueryClient,
75
+ authClient
76
+ ]);
77
+ const visibleActions = React.useMemo(() => {
78
+ return actions.filter((action) => {
79
+ if (action.visible === void 0) return true;
80
+ if (typeof action.visible === "function") return action.visible(ctx);
81
+ return action.visible;
82
+ });
83
+ }, [actions, ctx]);
121
84
  const hasFilters = filterCount > 0;
122
85
  const hasSelection = selectedCount > 0;
123
86
  const isVisible = hasSelection || hasFilters;
124
87
  if (!isVisible) return null;
125
- let t7;
126
- if ($[17] !== ctx || $[18] !== helpers || $[19] !== onBulkDelete || $[20] !== onBulkRestore || $[21] !== onOpenDialog || $[22] !== selectedItems || $[23] !== t || $[24] !== table) {
127
- t7 = async (action_0) => {
128
- const { handler } = action_0;
129
- if (action_0.id === "deleteMany" && onBulkDelete) {
88
+ const executeBulkAction = async (action) => {
89
+ const { handler } = action;
90
+ if (action.id === "deleteMany" && onBulkDelete) {
91
+ setIsLoading(true);
92
+ const ids = getSelectedIds(selectedItems);
93
+ try {
94
+ await onBulkDelete(ids);
95
+ table.resetRowSelection();
96
+ setIsLoading(false);
97
+ } catch {
98
+ helpers.toast.error(t("collection.bulkDeleteError"));
99
+ setIsLoading(false);
100
+ }
101
+ return;
102
+ }
103
+ if (action.id === "restoreMany" && onBulkRestore) {
104
+ setIsLoading(true);
105
+ const ids = getSelectedIds(selectedItems);
106
+ try {
107
+ await onBulkRestore(ids);
108
+ table.resetRowSelection();
109
+ setIsLoading(false);
110
+ } catch {
111
+ helpers.toast.error(t("collection.bulkRestoreError"));
112
+ setIsLoading(false);
113
+ }
114
+ return;
115
+ }
116
+ switch (handler.type) {
117
+ case "api": {
130
118
  setIsLoading(true);
131
119
  const ids = getSelectedIds(selectedItems);
120
+ const method = handler.method ? handler.method : "POST";
132
121
  try {
133
- await onBulkDelete(ids);
122
+ helpers.toast.info(`Bulk API call: ${method} ${handler.endpoint} (${ids.length} items)`);
123
+ helpers.refresh();
134
124
  table.resetRowSelection();
135
125
  setIsLoading(false);
136
126
  } catch {
137
- helpers.toast.error(t("collection.bulkDeleteError"));
127
+ helpers.toast.error(t("collection.bulkActionFailed"));
138
128
  setIsLoading(false);
139
129
  }
140
- return;
130
+ break;
141
131
  }
142
- if (action_0.id === "restoreMany" && onBulkRestore) {
132
+ case "custom":
143
133
  setIsLoading(true);
144
- const ids_0 = getSelectedIds(selectedItems);
145
134
  try {
146
- await onBulkRestore(ids_0);
135
+ await handler.fn(ctx);
147
136
  table.resetRowSelection();
148
137
  setIsLoading(false);
149
138
  } catch {
150
- helpers.toast.error(t("collection.bulkRestoreError"));
139
+ helpers.toast.error(t("collection.bulkActionFailed"));
151
140
  setIsLoading(false);
152
141
  }
153
- return;
154
- }
155
- bb77: switch (handler.type) {
156
- case "api": {
157
- setIsLoading(true);
158
- const ids_1 = getSelectedIds(selectedItems);
159
- const method = handler.method ? handler.method : "POST";
160
- try {
161
- helpers.toast.info(`Bulk API call: ${method} ${handler.endpoint} (${ids_1.length} items)`);
162
- helpers.refresh();
163
- table.resetRowSelection();
164
- setIsLoading(false);
165
- } catch {
166
- helpers.toast.error(t("collection.bulkActionFailed"));
167
- setIsLoading(false);
168
- }
169
- break bb77;
170
- }
171
- case "custom":
172
- setIsLoading(true);
173
- try {
174
- await handler.fn(ctx);
175
- table.resetRowSelection();
176
- setIsLoading(false);
177
- } catch {
178
- helpers.toast.error(t("collection.bulkActionFailed"));
179
- setIsLoading(false);
180
- }
181
- break bb77;
182
- case "dialog":
183
- case "form":
184
- onOpenDialog?.(action_0, selectedItems);
185
- break bb77;
186
- case "navigate":
187
- helpers.toast.error("Navigate action not supported for bulk operations");
188
- break bb77;
189
- case "server": onOpenDialog?.(action_0, selectedItems);
190
- }
191
- };
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) => {
206
- if (action_1.confirmation) setConfirmAction(action_1);
207
- else executeBulkAction(action_1);
208
- };
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 () => {
216
- if (confirmAction) {
217
- await executeBulkAction(confirmAction);
218
- setConfirmAction(null);
219
- }
220
- };
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 () => {
229
- if (!onSelectAllMatching) return;
230
- setIsSelectingAll(true);
231
- try {
232
- await onSelectAllMatching();
233
- setIsSelectingAll(false);
234
- } catch (t11$1) {
235
- const _err = t11$1;
236
- setIsSelectingAll(false);
237
- throw _err;
238
- }
239
- };
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) => {
247
- if (action_2.disabled === void 0) return false;
248
- if (typeof action_2.disabled === "function") return action_2.disabled(ctx);
249
- return action_2.disabled;
250
- };
251
- $[33] = ctx;
252
- $[34] = t11;
253
- } else t11 = $[34];
254
- const isDisabled = t11;
255
- let t12;
256
- let t13;
257
- let t14;
258
- let t15;
259
- let t16;
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) {
261
- const regularActions = visibleActions.filter(_temp2);
262
- const destructiveActions = visibleActions.filter(_temp3);
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", {
142
+ break;
143
+ case "dialog":
144
+ case "form":
145
+ onOpenDialog?.(action, selectedItems);
146
+ break;
147
+ case "navigate":
148
+ helpers.toast.error("Navigate action not supported for bulk operations");
149
+ break;
150
+ case "server":
151
+ onOpenDialog?.(action, selectedItems);
152
+ break;
153
+ }
154
+ };
155
+ const handleActionClick = (action) => {
156
+ if (action.confirmation) setConfirmAction(action);
157
+ else executeBulkAction(action);
158
+ };
159
+ const handleConfirm = async () => {
160
+ if (confirmAction) {
161
+ await executeBulkAction(confirmAction);
162
+ setConfirmAction(null);
163
+ }
164
+ };
165
+ const handleSelectAllMatching = async () => {
166
+ if (!onSelectAllMatching) return;
167
+ setIsSelectingAll(true);
168
+ try {
169
+ await onSelectAllMatching();
170
+ setIsSelectingAll(false);
171
+ } catch (_err) {
172
+ setIsSelectingAll(false);
173
+ throw _err;
174
+ }
175
+ };
176
+ const isDisabled = (action) => {
177
+ if (action.disabled === void 0) return false;
178
+ if (typeof action.disabled === "function") return action.disabled(ctx);
179
+ return action.disabled;
180
+ };
181
+ const regularActions = visibleActions.filter((a) => a.variant !== "destructive");
182
+ const destructiveActions = visibleActions.filter((a) => a.variant === "destructive");
183
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
184
+ "data-state": isVisible ? "open" : "closed",
185
+ className: "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",
186
+ children: /* @__PURE__ */ jsxs("div", {
187
+ className: "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",
188
+ children: [hasFilters && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
268
189
  className: "flex shrink-0 items-center gap-2",
269
190
  children: [onOpenFilters ? /* @__PURE__ */ jsxs(Button, {
270
191
  variant: "ghost",
@@ -295,197 +216,109 @@ function BulkActionToolbar(t0) {
295
216
  }), hasSelection && /* @__PURE__ */ jsx("div", {
296
217
  className: "qa-bulk-toolbar__divider bg-border h-4 w-px shrink-0",
297
218
  "aria-hidden": "true"
298
- })] });
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: [
308
- /* @__PURE__ */ jsx("span", {
309
- className: "shrink-0 text-sm font-medium whitespace-nowrap",
310
- children: t("collection.selected", { count: selectedCount })
311
- }),
312
- /* @__PURE__ */ jsx("div", {
313
- className: "qa-bulk-toolbar__divider bg-border h-4 w-px shrink-0",
314
- "aria-hidden": "true"
315
- }),
316
- /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(DropdownMenuTrigger, {
317
- nativeButton: false,
318
- render: /* @__PURE__ */ jsx(Button, {
319
- variant: "ghost",
320
- size: "sm",
321
- className: "h-7 shrink-0 gap-1 px-2"
219
+ })] }), hasSelection && /* @__PURE__ */ jsxs(Fragment, { children: [
220
+ /* @__PURE__ */ jsx("span", {
221
+ className: "shrink-0 text-sm font-medium whitespace-nowrap",
222
+ children: t("collection.selected", { count: selectedCount })
322
223
  }),
323
- disabled: isSelectingAll,
324
- children: [t("common.selectAll").split(" ")[0], /* @__PURE__ */ jsx(Icon, {
325
- icon: "ph:caret-down",
326
- className: "size-3"
327
- })]
328
- }), /* @__PURE__ */ jsxs(DropdownMenuContent, {
329
- align: "center",
330
- side: "top",
331
- sideOffset: 8,
332
- children: [
333
- /* @__PURE__ */ jsxs(DropdownMenuItem, {
334
- onClick: () => table.toggleAllPageRowsSelected(true),
335
- children: [t("collection.selectOnPage"), pageCount ? ` (${pageCount})` : ""]
224
+ /* @__PURE__ */ jsx("div", {
225
+ className: "qa-bulk-toolbar__divider bg-border h-4 w-px shrink-0",
226
+ "aria-hidden": "true"
227
+ }),
228
+ /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(DropdownMenuTrigger, {
229
+ nativeButton: false,
230
+ render: /* @__PURE__ */ jsx(Button, {
231
+ variant: "ghost",
232
+ size: "sm",
233
+ className: "h-7 shrink-0 gap-1 px-2"
336
234
  }),
337
- onSelectAllMatching && totalCount && totalCount > (pageCount ?? 0) && /* @__PURE__ */ jsx(DropdownMenuItem, {
338
- onClick: handleSelectAllMatching,
339
- children: t("collection.selectAllMatching", { count: totalCount })
235
+ disabled: isSelectingAll,
236
+ children: [t("common.selectAll").split(" ")[0], /* @__PURE__ */ jsx(Icon, {
237
+ icon: "ph:caret-down",
238
+ className: "size-3"
239
+ })]
240
+ }), /* @__PURE__ */ jsxs(DropdownMenuContent, {
241
+ align: "center",
242
+ side: "top",
243
+ sideOffset: 8,
244
+ children: [
245
+ /* @__PURE__ */ jsxs(DropdownMenuItem, {
246
+ onClick: () => table.toggleAllPageRowsSelected(true),
247
+ children: [t("collection.selectOnPage"), pageCount ? ` (${pageCount})` : ""]
248
+ }),
249
+ onSelectAllMatching && totalCount && totalCount > (pageCount ?? 0) && /* @__PURE__ */ jsx(DropdownMenuItem, {
250
+ onClick: handleSelectAllMatching,
251
+ children: t("collection.selectAllMatching", { count: totalCount })
252
+ }),
253
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
254
+ /* @__PURE__ */ jsx(DropdownMenuItem, {
255
+ onClick: () => table.resetRowSelection(),
256
+ children: t("collection.clearSelection")
257
+ })
258
+ ]
259
+ })] }),
260
+ visibleActions.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(DropdownMenuTrigger, {
261
+ nativeButton: false,
262
+ render: /* @__PURE__ */ jsx(Button, {
263
+ variant: "outline",
264
+ size: "sm",
265
+ className: "h-7 shrink-0 gap-1 px-2"
340
266
  }),
341
- /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
342
- /* @__PURE__ */ jsx(DropdownMenuItem, {
343
- onClick: () => table.resetRowSelection(),
267
+ disabled: isLoading,
268
+ children: [t("common.actions"), /* @__PURE__ */ jsx(Icon, {
269
+ icon: "ph:caret-down",
270
+ className: "size-3"
271
+ })]
272
+ }), /* @__PURE__ */ jsxs(DropdownMenuContent, {
273
+ align: "center",
274
+ side: "top",
275
+ sideOffset: 8,
276
+ children: [
277
+ regularActions.map((action) => {
278
+ const iconElement = resolveIconElement(action.icon, { className: "mr-2 size-4" });
279
+ return /* @__PURE__ */ jsxs(DropdownMenuItem, {
280
+ onClick: () => handleActionClick(action),
281
+ disabled: isDisabled(action) || isLoading,
282
+ children: [iconElement, resolveText(action.label)]
283
+ }, action.id);
284
+ }),
285
+ regularActions.length > 0 && destructiveActions.length > 0 && /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
286
+ destructiveActions.map((action) => {
287
+ const iconElement = resolveIconElement(action.icon, { className: "mr-2 size-4" });
288
+ return /* @__PURE__ */ jsxs(DropdownMenuItem, {
289
+ variant: "destructive",
290
+ onClick: () => handleActionClick(action),
291
+ disabled: isDisabled(action) || isLoading,
292
+ children: [iconElement, resolveText(action.label)]
293
+ }, action.id);
294
+ })
295
+ ]
296
+ })] }),
297
+ /* @__PURE__ */ jsxs(Button, {
298
+ variant: "ghost",
299
+ size: "icon-sm",
300
+ onClick: () => table.resetRowSelection(),
301
+ className: "size-7 shrink-0",
302
+ children: [/* @__PURE__ */ jsx(Icon, {
303
+ icon: "ph:x",
304
+ className: "size-4"
305
+ }), /* @__PURE__ */ jsx("span", {
306
+ className: "sr-only",
344
307
  children: t("collection.clearSelection")
345
- })
346
- ]
347
- })] }),
348
- visibleActions.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(DropdownMenuTrigger, {
349
- nativeButton: false,
350
- render: /* @__PURE__ */ jsx(Button, {
351
- variant: "outline",
352
- size: "sm",
353
- className: "h-7 shrink-0 gap-1 px-2"
354
- }),
355
- disabled: isLoading,
356
- children: [t("common.actions"), /* @__PURE__ */ jsx(Icon, {
357
- icon: "ph:caret-down",
358
- className: "size-3"
359
- })]
360
- }), /* @__PURE__ */ jsxs(DropdownMenuContent, {
361
- align: "center",
362
- side: "top",
363
- sideOffset: 8,
364
- children: [
365
- regularActions.map((action_3) => {
366
- const iconElement = resolveIconElement(action_3.icon, { className: "mr-2 size-4" });
367
- return /* @__PURE__ */ jsxs(DropdownMenuItem, {
368
- onClick: () => handleActionClick(action_3),
369
- disabled: isDisabled(action_3) || isLoading,
370
- children: [iconElement, resolveText(action_3.label)]
371
- }, action_3.id);
372
- }),
373
- regularActions.length > 0 && destructiveActions.length > 0 && /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
374
- destructiveActions.map((action_4) => {
375
- const iconElement_0 = resolveIconElement(action_4.icon, { className: "mr-2 size-4" });
376
- return /* @__PURE__ */ jsxs(DropdownMenuItem, {
377
- variant: "destructive",
378
- onClick: () => handleActionClick(action_4),
379
- disabled: isDisabled(action_4) || isLoading,
380
- children: [iconElement_0, resolveText(action_4.label)]
381
- }, action_4.id);
382
- })
383
- ]
384
- })] }),
385
- /* @__PURE__ */ jsxs(Button, {
386
- variant: "ghost",
387
- size: "icon-sm",
388
- onClick: () => table.resetRowSelection(),
389
- className: "size-7 shrink-0",
390
- children: [/* @__PURE__ */ jsx(Icon, {
391
- icon: "ph:x",
392
- className: "size-4"
393
- }), /* @__PURE__ */ jsx("span", {
394
- className: "sr-only",
395
- children: t("collection.clearSelection")
396
- })]
397
- })
398
- ] });
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;
423
- } else {
424
- t12 = $[54];
425
- t13 = $[55];
426
- t14 = $[56];
427
- t15 = $[57];
428
- t16 = $[58];
429
- }
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
447
- });
448
- $[70] = t15;
449
- $[71] = t16;
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, {
456
- open: !!confirmAction,
457
- onOpenChange: (open) => !open && setConfirmAction(null),
458
- config: {
459
- ...confirmAction.confirmation,
460
- description: confirmAction.confirmation.description ? `${resolveText(confirmAction.confirmation.description)} (${selectedCount} items)` : `This will affect ${selectedCount} items.`
461
- },
462
- onConfirm: handleConfirm,
463
- loading: isLoading
464
- });
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;
480
- }
481
- function _temp3(a_0) {
482
- return a_0.variant === "destructive";
483
- }
484
- function _temp2(a) {
485
- return a.variant !== "destructive";
486
- }
487
- function _temp(row) {
488
- return row.original;
308
+ })]
309
+ })
310
+ ] })]
311
+ })
312
+ }), confirmAction?.confirmation && /* @__PURE__ */ jsx(ConfirmationDialog, {
313
+ open: !!confirmAction,
314
+ onOpenChange: (open) => !open && setConfirmAction(null),
315
+ config: {
316
+ ...confirmAction.confirmation,
317
+ description: confirmAction.confirmation.description ? `${resolveText(confirmAction.confirmation.description)} (${selectedCount} items)` : `This will affect ${selectedCount} items.`
318
+ },
319
+ onConfirm: handleConfirm,
320
+ loading: isLoading
321
+ })] });
489
322
  }
490
323
 
491
324
  //#endregion