@questpie/admin 3.2.3 → 3.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) 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 +106 -220
  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 +107 -313
  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 -182
  47. package/dist/client/components/fields/rich-text-editor/image-popover.mjs +8 -19
  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 +196 -530
  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 +39 -74
  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 +306 -611
  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 +177 -494
  68. package/dist/client/components/preview/live-preview-mode.mjs +240 -438
  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 +200 -559
  77. package/dist/client/components/primitives/select-single.mjs +165 -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.d.mts +4 -0
  123. package/dist/client/contexts/focus-context.mjs +87 -150
  124. package/dist/client/hooks/typed-hooks.mjs +241 -701
  125. package/dist/client/hooks/use-action.mjs +62 -198
  126. package/dist/client/hooks/use-admin-config.mjs +5 -35
  127. package/dist/client/hooks/use-admin-preferences.mjs +16 -88
  128. package/dist/client/hooks/use-admin-routes.mjs +22 -56
  129. package/dist/client/hooks/use-audit-history.mjs +21 -69
  130. package/dist/client/hooks/use-brand.mjs +1 -9
  131. package/dist/client/hooks/use-collection-fields.mjs +17 -57
  132. package/dist/client/hooks/use-collection-meta.mjs +12 -44
  133. package/dist/client/hooks/use-collection-schema.mjs +10 -33
  134. package/dist/client/hooks/use-collection-validation.mjs +23 -53
  135. package/dist/client/hooks/use-collection.mjs +194 -614
  136. package/dist/client/hooks/use-current-user.mjs +0 -1
  137. package/dist/client/hooks/use-field-hooks.mjs +10 -10
  138. package/dist/client/hooks/use-field-options.mjs +61 -202
  139. package/dist/client/hooks/use-global-fields.mjs +14 -46
  140. package/dist/client/hooks/use-global-meta.mjs +9 -30
  141. package/dist/client/hooks/use-global-schema.mjs +9 -30
  142. package/dist/client/hooks/use-global.mjs +63 -219
  143. package/dist/client/hooks/use-locks.mjs +117 -325
  144. package/dist/client/hooks/use-media-query.mjs +16 -36
  145. package/dist/client/hooks/use-prefill-params.mjs +0 -1
  146. package/dist/client/hooks/use-questpie-query-options.mjs +12 -29
  147. package/dist/client/hooks/use-reactive-fields.mjs +1 -1
  148. package/dist/client/hooks/use-reactive-prop.mjs +65 -223
  149. package/dist/client/hooks/use-realtime-highlight.mjs +51 -114
  150. package/dist/client/hooks/use-saved-views.mjs +22 -103
  151. package/dist/client/hooks/use-search-param-toggle.mjs +28 -79
  152. package/dist/client/hooks/use-search.mjs +31 -143
  153. package/dist/client/hooks/use-server-actions.mjs +18 -50
  154. package/dist/client/hooks/use-server-validation.mjs +72 -166
  155. package/dist/client/hooks/use-server-widget-data.mjs +7 -33
  156. package/dist/client/hooks/use-setup-status.mjs +12 -25
  157. package/dist/client/hooks/use-sidebar-search-param.mjs +33 -78
  158. package/dist/client/hooks/use-transition-stage.mjs +8 -38
  159. package/dist/client/hooks/use-upload.mjs +54 -152
  160. package/dist/client/hooks/use-validation-error-map.mjs +6 -26
  161. package/dist/client/hooks/use-view-state.mjs +187 -437
  162. package/dist/client/i18n/hooks.mjs +65 -197
  163. package/dist/client/lib/render-profiler.mjs +14 -41
  164. package/dist/client/preview/block-scope-context.d.mts +2 -2
  165. package/dist/client/preview/block-scope-context.mjs +14 -36
  166. package/dist/client/preview/diff.mjs +110 -0
  167. package/dist/client/preview/preview-banner.mjs +42 -108
  168. package/dist/client/preview/preview-field.d.mts +4 -4
  169. package/dist/client/preview/preview-field.mjs +166 -409
  170. package/dist/client/preview/use-collection-preview.mjs +135 -201
  171. package/dist/client/runtime/content-locales-provider.mjs +31 -83
  172. package/dist/client/runtime/locale-scope.mjs +22 -63
  173. package/dist/client/runtime/provider.mjs +100 -255
  174. package/dist/client/runtime/translations-provider.mjs +41 -107
  175. package/dist/client/scope/picker.d.mts +2 -2
  176. package/dist/client/scope/picker.mjs +86 -321
  177. package/dist/client/scope/provider.d.mts +2 -2
  178. package/dist/client/scope/provider.mjs +8 -17
  179. package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
  180. package/dist/client/views/auth/accept-invite-form.mjs +121 -412
  181. package/dist/client/views/auth/auth-layout.d.mts +3 -3
  182. package/dist/client/views/auth/auth-layout.mjs +104 -284
  183. package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
  184. package/dist/client/views/auth/forgot-password-form.mjs +94 -325
  185. package/dist/client/views/auth/invite-form.mjs +107 -442
  186. package/dist/client/views/auth/login-form.d.mts +2 -2
  187. package/dist/client/views/auth/login-form.mjs +116 -337
  188. package/dist/client/views/auth/reset-password-form.mjs +128 -453
  189. package/dist/client/views/auth/setup-form.mjs +140 -478
  190. package/dist/client/views/collection/auto-form-fields.mjs +243 -615
  191. package/dist/client/views/collection/bulk-action-toolbar.mjs +212 -400
  192. package/dist/client/views/collection/cells/complex-cells.mjs +183 -611
  193. package/dist/client/views/collection/cells/primitive-cells.mjs +109 -363
  194. package/dist/client/views/collection/cells/relation-cells.mjs +86 -233
  195. package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +142 -371
  196. package/dist/client/views/collection/cells/shared/relation-chip.mjs +35 -131
  197. package/dist/client/views/collection/cells/upload-cells.mjs +60 -177
  198. package/dist/client/views/collection/columns/build-columns.mjs +8 -48
  199. package/dist/client/views/collection/field-renderer.mjs +11 -24
  200. package/dist/client/views/collection/form-view.mjs +288 -560
  201. package/dist/client/views/collection/table-view.mjs +239 -469
  202. package/dist/client/views/collection/view-skeletons.mjs +112 -237
  203. package/dist/client/views/common/global-search.mjs +241 -543
  204. package/dist/client/views/dashboard/dashboard-grid.mjs +256 -775
  205. package/dist/client/views/dashboard/dashboard-widget.mjs +38 -126
  206. package/dist/client/views/dashboard/widget-card.mjs +61 -269
  207. package/dist/client/views/globals/global-form-view.mjs +478 -1298
  208. package/dist/client/views/layout/admin-layout-provider.mjs +28 -88
  209. package/dist/client/views/layout/admin-layout.mjs +83 -246
  210. package/dist/client/views/layout/admin-router.mjs +457 -1289
  211. package/dist/client/views/layout/admin-sidebar.mjs +510 -1292
  212. package/dist/client/views/layout/admin-theme.mjs +30 -64
  213. package/dist/client/views/layout/admin-view-layout.mjs +40 -144
  214. package/dist/client/views/pages/accept-invite-page.mjs +95 -290
  215. package/dist/client/views/pages/dashboard-page.mjs +11 -57
  216. package/dist/client/views/pages/forgot-password-page.mjs +31 -83
  217. package/dist/client/views/pages/invite-page.mjs +35 -90
  218. package/dist/client/views/pages/login-page.mjs +41 -121
  219. package/dist/client/views/pages/reset-password-page.d.mts +2 -2
  220. package/dist/client/views/pages/reset-password-page.mjs +46 -173
  221. package/dist/client/views/pages/setup-page.d.mts +2 -2
  222. package/dist/client/views/pages/setup-page.mjs +33 -95
  223. package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
  224. package/dist/components/rich-text/rich-text-renderer.mjs +9 -33
  225. package/dist/server/modules/admin/collections/account.d.mts +50 -50
  226. package/dist/server/modules/admin/collections/admin-locks.d.mts +54 -54
  227. package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
  228. package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
  229. package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
  230. package/dist/server/modules/admin/collections/assets.d.mts +34 -34
  231. package/dist/server/modules/admin/collections/session.d.mts +42 -42
  232. package/dist/server/modules/admin/collections/user.d.mts +53 -53
  233. package/dist/server/modules/admin/collections/verification.d.mts +36 -36
  234. package/dist/server/modules/admin/index.d.mts +21 -20
  235. package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
  236. package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
  237. package/dist/server/modules/admin/routes/locales.d.mts +2 -2
  238. package/dist/server/modules/admin/routes/preview.d.mts +11 -11
  239. package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
  240. package/dist/server/modules/admin/routes/setup.d.mts +7 -7
  241. package/dist/server/modules/admin/routes/translations.d.mts +4 -4
  242. package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
  243. package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +27 -27
  244. 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(86);
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,235 +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
- const [shouldRender, setShouldRender] = React.useState(isVisible);
125
- let t7;
126
- let t8;
127
- if ($[17] !== isVisible) {
128
- t7 = () => {
129
- if (isVisible) {
130
- setShouldRender(true);
131
- return;
87
+ if (!isVisible) return null;
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);
132
113
  }
133
- const timeout = window.setTimeout(() => setShouldRender(false), 180);
134
- return () => window.clearTimeout(timeout);
135
- };
136
- t8 = [isVisible];
137
- $[17] = isVisible;
138
- $[18] = t7;
139
- $[19] = t8;
140
- } else {
141
- t7 = $[18];
142
- t8 = $[19];
143
- }
144
- React.useEffect(t7, t8);
145
- if (!shouldRender) return null;
146
- let t9;
147
- if ($[20] !== ctx || $[21] !== helpers || $[22] !== onBulkDelete || $[23] !== onBulkRestore || $[24] !== onOpenDialog || $[25] !== selectedItems || $[26] !== t || $[27] !== table) {
148
- t9 = async (action_0) => {
149
- const { handler } = action_0;
150
- if (action_0.id === "deleteMany" && onBulkDelete) {
114
+ return;
115
+ }
116
+ switch (handler.type) {
117
+ case "api": {
151
118
  setIsLoading(true);
152
119
  const ids = getSelectedIds(selectedItems);
120
+ const method = handler.method ? handler.method : "POST";
153
121
  try {
154
- await onBulkDelete(ids);
122
+ helpers.toast.info(`Bulk API call: ${method} ${handler.endpoint} (${ids.length} items)`);
123
+ helpers.refresh();
155
124
  table.resetRowSelection();
156
125
  setIsLoading(false);
157
126
  } catch {
158
- helpers.toast.error(t("collection.bulkDeleteError"));
127
+ helpers.toast.error(t("collection.bulkActionFailed"));
159
128
  setIsLoading(false);
160
129
  }
161
- return;
130
+ break;
162
131
  }
163
- if (action_0.id === "restoreMany" && onBulkRestore) {
132
+ case "custom":
164
133
  setIsLoading(true);
165
- const ids_0 = getSelectedIds(selectedItems);
166
134
  try {
167
- await onBulkRestore(ids_0);
135
+ await handler.fn(ctx);
168
136
  table.resetRowSelection();
169
137
  setIsLoading(false);
170
138
  } catch {
171
- helpers.toast.error(t("collection.bulkRestoreError"));
139
+ helpers.toast.error(t("collection.bulkActionFailed"));
172
140
  setIsLoading(false);
173
141
  }
174
- return;
175
- }
176
- bb86: switch (handler.type) {
177
- case "api": {
178
- setIsLoading(true);
179
- const ids_1 = getSelectedIds(selectedItems);
180
- const method = handler.method ? handler.method : "POST";
181
- try {
182
- helpers.toast.info(`Bulk API call: ${method} ${handler.endpoint} (${ids_1.length} items)`);
183
- helpers.refresh();
184
- table.resetRowSelection();
185
- setIsLoading(false);
186
- } catch {
187
- helpers.toast.error(t("collection.bulkActionFailed"));
188
- setIsLoading(false);
189
- }
190
- break bb86;
191
- }
192
- case "custom":
193
- setIsLoading(true);
194
- try {
195
- await handler.fn(ctx);
196
- table.resetRowSelection();
197
- setIsLoading(false);
198
- } catch {
199
- helpers.toast.error(t("collection.bulkActionFailed"));
200
- setIsLoading(false);
201
- }
202
- break bb86;
203
- case "dialog":
204
- case "form":
205
- onOpenDialog?.(action_0, selectedItems);
206
- break bb86;
207
- case "navigate":
208
- helpers.toast.error("Navigate action not supported for bulk operations");
209
- break bb86;
210
- case "server": onOpenDialog?.(action_0, selectedItems);
211
- }
212
- };
213
- $[20] = ctx;
214
- $[21] = helpers;
215
- $[22] = onBulkDelete;
216
- $[23] = onBulkRestore;
217
- $[24] = onOpenDialog;
218
- $[25] = selectedItems;
219
- $[26] = t;
220
- $[27] = table;
221
- $[28] = t9;
222
- } else t9 = $[28];
223
- const executeBulkAction = t9;
224
- let t10;
225
- if ($[29] !== executeBulkAction) {
226
- t10 = (action_1) => {
227
- if (action_1.confirmation) setConfirmAction(action_1);
228
- else executeBulkAction(action_1);
229
- };
230
- $[29] = executeBulkAction;
231
- $[30] = t10;
232
- } else t10 = $[30];
233
- const handleActionClick = t10;
234
- let t11;
235
- if ($[31] !== confirmAction || $[32] !== executeBulkAction) {
236
- t11 = async () => {
237
- if (confirmAction) {
238
- await executeBulkAction(confirmAction);
239
- setConfirmAction(null);
240
- }
241
- };
242
- $[31] = confirmAction;
243
- $[32] = executeBulkAction;
244
- $[33] = t11;
245
- } else t11 = $[33];
246
- const handleConfirm = t11;
247
- let t12;
248
- if ($[34] !== onSelectAllMatching) {
249
- t12 = async () => {
250
- if (!onSelectAllMatching) return;
251
- setIsSelectingAll(true);
252
- try {
253
- await onSelectAllMatching();
254
- setIsSelectingAll(false);
255
- } catch (t13$1) {
256
- const _err = t13$1;
257
- setIsSelectingAll(false);
258
- throw _err;
259
- }
260
- };
261
- $[34] = onSelectAllMatching;
262
- $[35] = t12;
263
- } else t12 = $[35];
264
- const handleSelectAllMatching = t12;
265
- let t13;
266
- if ($[36] !== ctx) {
267
- t13 = (action_2) => {
268
- if (action_2.disabled === void 0) return false;
269
- if (typeof action_2.disabled === "function") return action_2.disabled(ctx);
270
- return action_2.disabled;
271
- };
272
- $[36] = ctx;
273
- $[37] = t13;
274
- } else t13 = $[37];
275
- const isDisabled = t13;
276
- let t14;
277
- let t15;
278
- let t16;
279
- let t17;
280
- let t18;
281
- if ($[38] !== filterCount || $[39] !== handleActionClick || $[40] !== handleSelectAllMatching || $[41] !== hasFilters || $[42] !== hasSelection || $[43] !== isDisabled || $[44] !== isLoading || $[45] !== isSelectingAll || $[46] !== isVisible || $[47] !== onClearFilters || $[48] !== onOpenFilters || $[49] !== onSelectAllMatching || $[50] !== pageCount || $[51] !== resolveText || $[52] !== selectedCount || $[53] !== t || $[54] !== table || $[55] !== totalCount || $[56] !== visibleActions) {
282
- const regularActions = visibleActions.filter(_temp2);
283
- const destructiveActions = visibleActions.filter(_temp3);
284
- t17 = isVisible ? "open" : "closed";
285
- t18 = "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";
286
- t14 = "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";
287
- if ($[62] !== filterCount || $[63] !== hasFilters || $[64] !== hasSelection || $[65] !== onClearFilters || $[66] !== onOpenFilters || $[67] !== t) {
288
- t15 = 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", {
289
189
  className: "flex shrink-0 items-center gap-2",
290
190
  children: [onOpenFilters ? /* @__PURE__ */ jsxs(Button, {
291
191
  variant: "ghost",
@@ -316,197 +216,109 @@ function BulkActionToolbar(t0) {
316
216
  }), hasSelection && /* @__PURE__ */ jsx("div", {
317
217
  className: "qa-bulk-toolbar__divider bg-border h-4 w-px shrink-0",
318
218
  "aria-hidden": "true"
319
- })] });
320
- $[62] = filterCount;
321
- $[63] = hasFilters;
322
- $[64] = hasSelection;
323
- $[65] = onClearFilters;
324
- $[66] = onOpenFilters;
325
- $[67] = t;
326
- $[68] = t15;
327
- } else t15 = $[68];
328
- t16 = hasSelection && /* @__PURE__ */ jsxs(Fragment, { children: [
329
- /* @__PURE__ */ jsx("span", {
330
- className: "shrink-0 text-sm font-medium whitespace-nowrap",
331
- children: t("collection.selected", { count: selectedCount })
332
- }),
333
- /* @__PURE__ */ jsx("div", {
334
- className: "qa-bulk-toolbar__divider bg-border h-4 w-px shrink-0",
335
- "aria-hidden": "true"
336
- }),
337
- /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(DropdownMenuTrigger, {
338
- nativeButton: false,
339
- render: /* @__PURE__ */ jsx(Button, {
340
- variant: "ghost",
341
- size: "sm",
342
- 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 })
343
223
  }),
344
- disabled: isSelectingAll,
345
- children: [t("common.selectAll").split(" ")[0], /* @__PURE__ */ jsx(Icon, {
346
- icon: "ph:caret-down",
347
- className: "size-3"
348
- })]
349
- }), /* @__PURE__ */ jsxs(DropdownMenuContent, {
350
- align: "center",
351
- side: "top",
352
- sideOffset: 8,
353
- children: [
354
- /* @__PURE__ */ jsxs(DropdownMenuItem, {
355
- onClick: () => table.toggleAllPageRowsSelected(true),
356
- 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"
357
234
  }),
358
- onSelectAllMatching && totalCount && totalCount > (pageCount ?? 0) && /* @__PURE__ */ jsx(DropdownMenuItem, {
359
- onClick: handleSelectAllMatching,
360
- 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"
361
266
  }),
362
- /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
363
- /* @__PURE__ */ jsx(DropdownMenuItem, {
364
- 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",
365
307
  children: t("collection.clearSelection")
366
- })
367
- ]
368
- })] }),
369
- visibleActions.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(DropdownMenuTrigger, {
370
- nativeButton: false,
371
- render: /* @__PURE__ */ jsx(Button, {
372
- variant: "outline",
373
- size: "sm",
374
- className: "h-7 shrink-0 gap-1 px-2"
375
- }),
376
- disabled: isLoading,
377
- children: [t("common.actions"), /* @__PURE__ */ jsx(Icon, {
378
- icon: "ph:caret-down",
379
- className: "size-3"
380
- })]
381
- }), /* @__PURE__ */ jsxs(DropdownMenuContent, {
382
- align: "center",
383
- side: "top",
384
- sideOffset: 8,
385
- children: [
386
- regularActions.map((action_3) => {
387
- const iconElement = resolveIconElement(action_3.icon, { className: "mr-2 size-4" });
388
- return /* @__PURE__ */ jsxs(DropdownMenuItem, {
389
- onClick: () => handleActionClick(action_3),
390
- disabled: isDisabled(action_3) || isLoading,
391
- children: [iconElement, resolveText(action_3.label)]
392
- }, action_3.id);
393
- }),
394
- regularActions.length > 0 && destructiveActions.length > 0 && /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
395
- destructiveActions.map((action_4) => {
396
- const iconElement_0 = resolveIconElement(action_4.icon, { className: "mr-2 size-4" });
397
- return /* @__PURE__ */ jsxs(DropdownMenuItem, {
398
- variant: "destructive",
399
- onClick: () => handleActionClick(action_4),
400
- disabled: isDisabled(action_4) || isLoading,
401
- children: [iconElement_0, resolveText(action_4.label)]
402
- }, action_4.id);
403
- })
404
- ]
405
- })] }),
406
- /* @__PURE__ */ jsxs(Button, {
407
- variant: "ghost",
408
- size: "icon-sm",
409
- onClick: () => table.resetRowSelection(),
410
- className: "size-7 shrink-0",
411
- children: [/* @__PURE__ */ jsx(Icon, {
412
- icon: "ph:x",
413
- className: "size-4"
414
- }), /* @__PURE__ */ jsx("span", {
415
- className: "sr-only",
416
- children: t("collection.clearSelection")
417
- })]
418
- })
419
- ] });
420
- $[38] = filterCount;
421
- $[39] = handleActionClick;
422
- $[40] = handleSelectAllMatching;
423
- $[41] = hasFilters;
424
- $[42] = hasSelection;
425
- $[43] = isDisabled;
426
- $[44] = isLoading;
427
- $[45] = isSelectingAll;
428
- $[46] = isVisible;
429
- $[47] = onClearFilters;
430
- $[48] = onOpenFilters;
431
- $[49] = onSelectAllMatching;
432
- $[50] = pageCount;
433
- $[51] = resolveText;
434
- $[52] = selectedCount;
435
- $[53] = t;
436
- $[54] = table;
437
- $[55] = totalCount;
438
- $[56] = visibleActions;
439
- $[57] = t14;
440
- $[58] = t15;
441
- $[59] = t16;
442
- $[60] = t17;
443
- $[61] = t18;
444
- } else {
445
- t14 = $[57];
446
- t15 = $[58];
447
- t16 = $[59];
448
- t17 = $[60];
449
- t18 = $[61];
450
- }
451
- let t19;
452
- if ($[69] !== t14 || $[70] !== t15 || $[71] !== t16) {
453
- t19 = /* @__PURE__ */ jsxs("div", {
454
- className: t14,
455
- children: [t15, t16]
456
- });
457
- $[69] = t14;
458
- $[70] = t15;
459
- $[71] = t16;
460
- $[72] = t19;
461
- } else t19 = $[72];
462
- let t20;
463
- if ($[73] !== t17 || $[74] !== t18 || $[75] !== t19) {
464
- t20 = /* @__PURE__ */ jsx("div", {
465
- "data-state": t17,
466
- className: t18,
467
- children: t19
468
- });
469
- $[73] = t17;
470
- $[74] = t18;
471
- $[75] = t19;
472
- $[76] = t20;
473
- } else t20 = $[76];
474
- let t21;
475
- if ($[77] !== confirmAction || $[78] !== handleConfirm || $[79] !== isLoading || $[80] !== resolveText || $[81] !== selectedCount) {
476
- t21 = confirmAction?.confirmation && /* @__PURE__ */ jsx(ConfirmationDialog, {
477
- open: !!confirmAction,
478
- onOpenChange: (open) => !open && setConfirmAction(null),
479
- config: {
480
- ...confirmAction.confirmation,
481
- description: confirmAction.confirmation.description ? `${resolveText(confirmAction.confirmation.description)} (${selectedCount} items)` : `This will affect ${selectedCount} items.`
482
- },
483
- onConfirm: handleConfirm,
484
- loading: isLoading
485
- });
486
- $[77] = confirmAction;
487
- $[78] = handleConfirm;
488
- $[79] = isLoading;
489
- $[80] = resolveText;
490
- $[81] = selectedCount;
491
- $[82] = t21;
492
- } else t21 = $[82];
493
- let t22;
494
- if ($[83] !== t20 || $[84] !== t21) {
495
- t22 = /* @__PURE__ */ jsxs(Fragment, { children: [t20, t21] });
496
- $[83] = t20;
497
- $[84] = t21;
498
- $[85] = t22;
499
- } else t22 = $[85];
500
- return t22;
501
- }
502
- function _temp3(a_0) {
503
- return a_0.variant === "destructive";
504
- }
505
- function _temp2(a) {
506
- return a.variant !== "destructive";
507
- }
508
- function _temp(row) {
509
- 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
+ })] });
510
322
  }
511
323
 
512
324
  //#endregion