@panneau/lists 5.0.0-alpha.2 → 5.0.0-alpha.21

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 (165) hide show
  1. package/README.md +17 -15
  2. package/dist/ItemDetails.css +50 -0
  3. package/dist/ItemDetails.d.ts +27 -0
  4. package/dist/ItemDetails.d.ts.map +1 -0
  5. package/dist/ItemDetails.js +134 -0
  6. package/dist/ItemDetails.js.map +1 -0
  7. package/dist/ItemDetails.module.js +20 -0
  8. package/dist/ItemDetails.module.js.map +1 -0
  9. package/dist/List.d.ts +3 -3
  10. package/dist/List.d.ts.map +1 -1
  11. package/dist/List.js +31 -10
  12. package/dist/List.js.map +1 -1
  13. package/dist/ListSkeleton.d.ts +19 -0
  14. package/dist/ListSkeleton.d.ts.map +1 -0
  15. package/dist/ListSkeleton.js +115 -0
  16. package/dist/ListSkeleton.js.map +1 -0
  17. package/dist/ListView.d.ts +73 -8
  18. package/dist/ListView.d.ts.map +1 -1
  19. package/dist/ListView.js +616 -218
  20. package/dist/ListView.js.map +1 -1
  21. package/dist/actions/ActionButton.d.ts +8 -2
  22. package/dist/actions/ActionButton.d.ts.map +1 -1
  23. package/dist/actions/ActionButton.js +98 -26
  24. package/dist/actions/ActionButton.js.map +1 -1
  25. package/dist/actions/Actions.css +16 -38
  26. package/dist/actions/Actions.module.js +6 -6
  27. package/dist/actions/Actions.module.js.map +1 -1
  28. package/dist/actions/ConfirmDialog.d.ts +20 -4
  29. package/dist/actions/ConfirmDialog.d.ts.map +1 -1
  30. package/dist/actions/ConfirmDialog.js +110 -92
  31. package/dist/actions/ConfirmDialog.js.map +1 -1
  32. package/dist/actions/RowActions.d.ts +25 -9
  33. package/dist/actions/RowActions.d.ts.map +1 -1
  34. package/dist/actions/RowActions.js +151 -80
  35. package/dist/actions/RowActions.js.map +1 -1
  36. package/dist/actions/actions.d.ts +5 -4
  37. package/dist/actions/actions.d.ts.map +1 -1
  38. package/dist/actions/actions.js +7 -14
  39. package/dist/actions/actions.js.map +1 -1
  40. package/dist/actions/fit.d.ts +25 -0
  41. package/dist/actions/fit.d.ts.map +1 -0
  42. package/dist/actions/fit.js +197 -0
  43. package/dist/actions/fit.js.map +1 -0
  44. package/dist/actions/icons.d.ts +5 -0
  45. package/dist/actions/icons.d.ts.map +1 -1
  46. package/dist/actions/icons.js +15 -1
  47. package/dist/actions/icons.js.map +1 -1
  48. package/dist/columns.d.ts +10 -0
  49. package/dist/columns.d.ts.map +1 -0
  50. package/dist/columns.js +25 -0
  51. package/dist/columns.js.map +1 -0
  52. package/dist/cx.js.map +1 -1
  53. package/dist/displays/Displays.css +48 -0
  54. package/dist/displays/Displays.module.js +18 -2
  55. package/dist/displays/Displays.module.js.map +1 -1
  56. package/dist/displays/displays.d.ts +62 -6
  57. package/dist/displays/displays.d.ts.map +1 -1
  58. package/dist/displays/displays.js +1151 -89
  59. package/dist/displays/displays.js.map +1 -1
  60. package/dist/filters/Filters.css +25 -11
  61. package/dist/filters/Filters.d.ts +1 -1
  62. package/dist/filters/Filters.js.map +1 -1
  63. package/dist/filters/Filters.module.js +5 -1
  64. package/dist/filters/Filters.module.js.map +1 -1
  65. package/dist/filters/controls.d.ts +1 -1
  66. package/dist/filters/controls.d.ts.map +1 -1
  67. package/dist/filters/controls.js +57 -35
  68. package/dist/filters/controls.js.map +1 -1
  69. package/dist/filters/format.d.ts +1 -1
  70. package/dist/filters/format.js.map +1 -1
  71. package/dist/images.d.ts +7 -0
  72. package/dist/images.d.ts.map +1 -0
  73. package/dist/images.js +39 -0
  74. package/dist/images.js.map +1 -0
  75. package/dist/index.d.ts +22 -18
  76. package/dist/index.d.ts.map +1 -1
  77. package/dist/index.js +7 -3
  78. package/dist/inline/Inline.css +58 -0
  79. package/dist/inline/Inline.module.js +20 -0
  80. package/dist/inline/Inline.module.js.map +1 -0
  81. package/dist/inline/InlineCell.d.ts +29 -0
  82. package/dist/inline/InlineCell.d.ts.map +1 -0
  83. package/dist/inline/InlineCell.js +490 -0
  84. package/dist/inline/InlineCell.js.map +1 -0
  85. package/dist/inline/editable.d.ts +12 -0
  86. package/dist/inline/editable.d.ts.map +1 -0
  87. package/dist/inline/editable.js +29 -0
  88. package/dist/inline/editable.js.map +1 -0
  89. package/dist/layouts/CalendarLayout.css +153 -0
  90. package/dist/layouts/CalendarLayout.d.ts +9 -0
  91. package/dist/layouts/CalendarLayout.d.ts.map +1 -0
  92. package/dist/layouts/CalendarLayout.js +303 -0
  93. package/dist/layouts/CalendarLayout.js.map +1 -0
  94. package/dist/layouts/CalendarLayout.module.js +28 -0
  95. package/dist/layouts/CalendarLayout.module.js.map +1 -0
  96. package/dist/layouts/CardsLayout.css +5 -0
  97. package/dist/layouts/CardsLayout.d.ts +2 -2
  98. package/dist/layouts/CardsLayout.d.ts.map +1 -1
  99. package/dist/layouts/CardsLayout.js +92 -91
  100. package/dist/layouts/CardsLayout.js.map +1 -1
  101. package/dist/layouts/CardsLayout.module.js.map +1 -1
  102. package/dist/layouts/GalleryLayout.css +87 -0
  103. package/dist/layouts/GalleryLayout.d.ts +8 -0
  104. package/dist/layouts/GalleryLayout.d.ts.map +1 -0
  105. package/dist/layouts/GalleryLayout.js +152 -0
  106. package/dist/layouts/GalleryLayout.js.map +1 -0
  107. package/dist/layouts/GalleryLayout.module.js +26 -0
  108. package/dist/layouts/GalleryLayout.module.js.map +1 -0
  109. package/dist/layouts/ItemTitle.d.ts +3 -1
  110. package/dist/layouts/ItemTitle.d.ts.map +1 -1
  111. package/dist/layouts/ItemTitle.js +12 -8
  112. package/dist/layouts/ItemTitle.js.map +1 -1
  113. package/dist/layouts/TableLayout.css +56 -0
  114. package/dist/layouts/TableLayout.d.ts +5 -4
  115. package/dist/layouts/TableLayout.d.ts.map +1 -1
  116. package/dist/layouts/TableLayout.js +171 -101
  117. package/dist/layouts/TableLayout.js.map +1 -1
  118. package/dist/layouts/TableLayout.module.js +8 -4
  119. package/dist/layouts/TableLayout.module.js.map +1 -1
  120. package/dist/layouts/builtIn.d.ts +2 -2
  121. package/dist/layouts/builtIn.d.ts.map +1 -1
  122. package/dist/layouts/builtIn.js +6 -2
  123. package/dist/layouts/builtIn.js.map +1 -1
  124. package/dist/layouts/calendarDays.d.ts +14 -0
  125. package/dist/layouts/calendarDays.d.ts.map +1 -0
  126. package/dist/layouts/calendarDays.js +44 -0
  127. package/dist/layouts/calendarDays.js.map +1 -0
  128. package/dist/plugin.d.ts +1 -1
  129. package/dist/plugin.js.map +1 -1
  130. package/dist/query.d.ts +4 -3
  131. package/dist/query.d.ts.map +1 -1
  132. package/dist/query.js +15 -4
  133. package/dist/query.js.map +1 -1
  134. package/dist/selection.d.ts +1 -1
  135. package/dist/selection.js.map +1 -1
  136. package/dist/toolbar/ColumnMenu.d.ts +17 -0
  137. package/dist/toolbar/ColumnMenu.d.ts.map +1 -0
  138. package/dist/toolbar/ColumnMenu.js +193 -0
  139. package/dist/toolbar/ColumnMenu.js.map +1 -0
  140. package/dist/toolbar/LayoutSwitch.d.ts.map +1 -1
  141. package/dist/toolbar/LayoutSwitch.js +73 -55
  142. package/dist/toolbar/LayoutSwitch.js.map +1 -1
  143. package/dist/toolbar/Pagination.d.ts +33 -0
  144. package/dist/toolbar/Pagination.d.ts.map +1 -1
  145. package/dist/toolbar/Pagination.js +282 -42
  146. package/dist/toolbar/Pagination.js.map +1 -1
  147. package/dist/toolbar/SearchField.js.map +1 -1
  148. package/dist/toolbar/SortSelect.d.ts +1 -1
  149. package/dist/toolbar/SortSelect.js.map +1 -1
  150. package/dist/toolbar/Toolbar.css +36 -0
  151. package/dist/toolbar/Toolbar.module.js +12 -2
  152. package/dist/toolbar/Toolbar.module.js.map +1 -1
  153. package/dist/types.d.ts +69 -1
  154. package/dist/types.d.ts.map +1 -1
  155. package/dist/useDraft.js.map +1 -1
  156. package/dist/useListState.js.map +1 -1
  157. package/dist/useRenderValue.d.ts +10 -0
  158. package/dist/useRenderValue.d.ts.map +1 -0
  159. package/dist/useRenderValue.js +84 -0
  160. package/dist/useRenderValue.js.map +1 -0
  161. package/dist/values.d.ts +4 -1
  162. package/dist/values.d.ts.map +1 -1
  163. package/dist/values.js +6 -2
  164. package/dist/values.js.map +1 -1
  165. package/package.json +9 -9
package/dist/ListView.js CHANGED
@@ -2,23 +2,32 @@ import { getActionHref, groupListActions, hasScope, isAllowedOn } from "./action
2
2
  import { messages } from "./messages.js";
3
3
  import { ConfirmDialog, needsConfirmation } from "./actions/ConfirmDialog.js";
4
4
  import { getColumnValue, toText } from "./values.js";
5
- import { builtInDisplays } from "./displays/displays.js";
5
+ import { getImageUrl } from "./images.js";
6
+ import { getCalendarTimeZone } from "./layouts/calendarDays.js";
6
7
  import { cx } from "./cx.js";
7
8
  import { builtInLayouts } from "./layouts/builtIn.js";
9
+ import { useRenderValue } from "./useRenderValue.js";
10
+ import { ListSkeleton } from "./ListSkeleton.js";
8
11
  import ListView_module_default from "./ListView.module.js";
9
12
  import { ActionButton } from "./actions/ActionButton.js";
10
- import { RowActions } from "./actions/RowActions.js";
13
+ import { RowActions, orderRowActions } from "./actions/RowActions.js";
14
+ import { getShownColumns } from "./columns.js";
11
15
  import { FilterChips, FilterControls, useFilterLabels } from "./filters/Filters.js";
16
+ import { InlineCell } from "./inline/InlineCell.js";
17
+ import { getInlineField } from "./inline/editable.js";
12
18
  import { countSelected, getPageSelection, isItemSelected } from "./selection.js";
19
+ import { ColumnMenu } from "./toolbar/ColumnMenu.js";
13
20
  import { LayoutSwitch } from "./toolbar/LayoutSwitch.js";
14
- import { Pagination } from "./toolbar/Pagination.js";
21
+ import { CursorPagination, Pagination } from "./toolbar/Pagination.js";
15
22
  import { SearchField } from "./toolbar/SearchField.js";
16
23
  import { SortSelect } from "./toolbar/SortSelect.js";
17
24
  import { useListState } from "./useListState.js";
18
- import { usePlugins } from "@panneau/core";
19
- import { Alert, Button, Checkbox, Spinner, usePanneauIntl, useToast } from "@panneau/ui";
25
+ import { asksConfirmation, currentMonth, formatRuleFailure, selectItemActions, usePlugins } from "@panneau/core";
26
+ import { c } from "react/compiler-runtime";
27
+ import { getActionLabel } from "@panneau/intl";
28
+ import { Alert, Button, Checkbox, usePanneauIntl, useToast } from "@panneau/ui";
20
29
  import { jsx, jsxs } from "react/jsx-runtime";
21
- import { useState } from "react";
30
+ import { useRef, useState } from "react";
22
31
  //#region src/ListView.tsx
23
32
  function keyOf(action, item) {
24
33
  return item !== void 0 ? `${action.id}\u0000${item.id}` : action.id;
@@ -28,296 +37,685 @@ function keyOf(action, item) {
28
37
  * cards), with sorting, search, filters and their chips, pagination, selection and actions. It
29
38
  * fetches nothing: the caller gives the items of the list's query and their total.
30
39
  */
31
- function ListView({ list, items, columns, total, isLoading = false, error = null, onRetry, filters = [], fields = [], search = false, layouts: layoutsProp = ["table"], layout: controlledLayout, onLayoutChange, perPageOptions, selectable: selectableProp, actions: actionsProp, onAction, actionIcons, itemTitle, getItemLabel: getItemLabelProp, getItemHref, displays, layoutComponents, filterControls, toolbar, emptyMessage, "aria-label": ariaLabel, className }) {
40
+ function ListView(t0) {
41
+ const $ = c(116);
42
+ const { list, items, columns: allColumns, columnChoice: t1, total, cursors, isLoading: t2, error: t3, onRetry, filters: t4, fields: t5, search: t6, layouts: t7, layout: controlledLayout, onLayoutChange, perPageOptions, selectable: selectableProp, actions: actionsProp, onAction, previewAction, actionIcons, itemTitle, itemImage, calendar: t8, primaryAction: primaryActionProp, getItemLabel: getItemLabelProp, getItemHref, getLinkHref, currentItemId: t9, displays, layoutComponents, filterControls, inlineEdit: t10, onInlineEdit, formatError: t11, toolbar, emptyMessage, "aria-label": ariaLabel, className } = t0;
43
+ const columnChoice = t1 === void 0 ? true : t1;
44
+ const isLoading = t2 === void 0 ? false : t2;
45
+ const error = t3 === void 0 ? null : t3;
46
+ let t12;
47
+ if ($[0] !== t4) {
48
+ t12 = t4 === void 0 ? [] : t4;
49
+ $[0] = t4;
50
+ $[1] = t12;
51
+ } else t12 = $[1];
52
+ const filtersProp = t12;
53
+ const fields = t5 === void 0 ? [] : t5;
54
+ const search = t6 === void 0 ? false : t6;
55
+ const layoutsProp = t7 === void 0 ? ["table"] : t7;
56
+ const calendar = t8 === void 0 ? null : t8;
57
+ const currentItemId = t9 === void 0 ? null : t9;
58
+ const inlineEdit = t10 === void 0 ? [] : t10;
59
+ const formatError = t11 === void 0 ? formatRuleFailure : t11;
32
60
  const intl = usePanneauIntl();
33
61
  const toasts = useToast();
34
62
  const plugins = usePlugins();
35
- const { query, selection } = useListState(list);
63
+ const { query, view, selection } = useListState(list);
36
64
  const filterLabels = useFilterLabels();
37
- const [uncontrolledLayout, setLayout] = useState(null);
38
65
  const [confirming, setConfirming] = useState(null);
66
+ const [preview, setPreview] = useState(null);
67
+ const confirmation = useRef(0);
39
68
  const [pending, setPending] = useState(null);
40
- const label = ariaLabel ?? intl.formatMessage(messages.list);
41
- const pageItems = items ?? [];
69
+ let t13;
70
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
71
+ t13 = {};
72
+ $[2] = t13;
73
+ } else t13 = $[2];
74
+ const [saved, setSaved] = useState(t13);
75
+ let t14;
76
+ if ($[3] !== items) {
77
+ t14 = (item) => {
78
+ const base = items?.find((candidate) => candidate.id === item.id);
79
+ if (base !== void 0) setSaved((current) => ({
80
+ ...current,
81
+ [item.id]: {
82
+ base,
83
+ item
84
+ }
85
+ }));
86
+ };
87
+ $[3] = items;
88
+ $[4] = t14;
89
+ } else t14 = $[4];
90
+ const showItem = t14;
91
+ let t15;
92
+ if ($[5] !== ariaLabel || $[6] !== intl) {
93
+ t15 = ariaLabel ?? intl.formatMessage(messages.list);
94
+ $[5] = ariaLabel;
95
+ $[6] = intl;
96
+ $[7] = t15;
97
+ } else t15 = $[7];
98
+ const label = t15;
99
+ let t16;
100
+ if ($[8] !== saved) {
101
+ t16 = (item_0) => saved[item_0.id]?.base === item_0 ? saved[item_0.id]?.item ?? item_0 : item_0;
102
+ $[8] = saved;
103
+ $[9] = t16;
104
+ } else t16 = $[9];
105
+ const pageItems = (items ?? []).map(t16);
42
106
  const count = total ?? pageItems.length;
43
- const sort = query.sort ?? [];
44
- const filterValues = query.filter ?? {};
45
- const hasQuery = Object.keys(filterValues).length > 0 || (query.q ?? "") !== "";
46
- const allDisplays = {
47
- ...builtInDisplays,
48
- ...Object.fromEntries(plugins.displays),
49
- ...displays
50
- };
51
- const allLayouts = {
52
- ...builtInLayouts,
53
- ...Object.fromEntries(plugins.listLayouts),
54
- ...layoutComponents
55
- };
56
- const available = layoutsProp.filter((id) => allLayouts[id] !== void 0);
107
+ let t17;
108
+ if ($[10] !== query.sort) {
109
+ t17 = query.sort ?? [];
110
+ $[10] = query.sort;
111
+ $[11] = t17;
112
+ } else t17 = $[11];
113
+ const sort = t17;
114
+ let t18;
115
+ if ($[12] !== plugins.listLayouts) {
116
+ t18 = Object.fromEntries(plugins.listLayouts);
117
+ $[12] = plugins.listLayouts;
118
+ $[13] = t18;
119
+ } else t18 = $[13];
120
+ const t19 = t18;
121
+ let t20;
122
+ if ($[14] !== layoutComponents || $[15] !== t19) {
123
+ t20 = {
124
+ ...builtInLayouts,
125
+ ...t19,
126
+ ...layoutComponents
127
+ };
128
+ $[14] = layoutComponents;
129
+ $[15] = t19;
130
+ $[16] = t20;
131
+ } else t20 = $[16];
132
+ const allLayouts = t20;
133
+ let t21;
134
+ if ($[17] !== allLayouts || $[18] !== calendar || $[19] !== itemImage) {
135
+ t21 = (id) => allLayouts[id] !== void 0 && (id !== "gallery" || itemImage !== void 0) && (id !== "calendar" || calendar !== null);
136
+ $[17] = allLayouts;
137
+ $[18] = calendar;
138
+ $[19] = itemImage;
139
+ $[20] = t21;
140
+ } else t21 = $[20];
141
+ const available = layoutsProp.filter(t21);
57
142
  const layouts = available.length > 0 ? available : ["table"];
58
- const layout = controlledLayout ?? uncontrolledLayout ?? layouts[0] ?? "table";
143
+ const chosenLayout = view.layout !== void 0 && layouts.includes(view.layout) ? view.layout : void 0;
144
+ const layout = controlledLayout ?? chosenLayout ?? layouts[0] ?? "table";
145
+ const columns = getShownColumns(allColumns, view.columns);
59
146
  const Layout = allLayouts[layout] ?? builtInLayouts.table;
147
+ const inCalendar = layout === "calendar" && calendar !== null;
148
+ let t22;
149
+ if ($[21] !== calendar || $[22] !== filtersProp || $[23] !== inCalendar) {
150
+ t22 = inCalendar ? filtersProp.filter((filter) => filter.id !== calendar.filter) : filtersProp;
151
+ $[21] = calendar;
152
+ $[22] = filtersProp;
153
+ $[23] = inCalendar;
154
+ $[24] = t22;
155
+ } else t22 = $[24];
156
+ const filters = t22;
157
+ let t23;
158
+ if ($[25] !== calendar || $[26] !== inCalendar || $[27] !== query.filter) {
159
+ t23 = Object.fromEntries(Object.entries(query.filter ?? {}).filter((t24) => {
160
+ const [id_0] = t24;
161
+ return !(inCalendar && id_0 === calendar.filter);
162
+ }));
163
+ $[25] = calendar;
164
+ $[26] = inCalendar;
165
+ $[27] = query.filter;
166
+ $[28] = t23;
167
+ } else t23 = $[28];
168
+ const filterValues = t23;
169
+ let t24;
170
+ if ($[29] !== filterValues || $[30] !== query.q) {
171
+ t24 = Object.keys(filterValues).length > 0 || (query.q ?? "") !== "";
172
+ $[29] = filterValues;
173
+ $[30] = query.q;
174
+ $[31] = t24;
175
+ } else t24 = $[31];
176
+ const hasQuery = t24;
60
177
  const grouped = groupListActions(actionsProp);
61
- const rowActions = grouped.row.filter((action) => hasScope(action, "item"));
62
- const rowMenu = grouped.menu.filter((action_0) => hasScope(action_0, "item"));
63
- const toolbarActions = [...grouped.toolbar, ...grouped.menu].filter((action_1, index, all) => (hasScope(action_1, "selection") || hasScope(action_1, "resource")) && all.findIndex((candidate) => candidate.id === action_1.id) === index);
64
- const selectionActions = toolbarActions.filter((action_2) => hasScope(action_2, "selection"));
65
- const resourceActions = toolbarActions.filter((action_3) => hasScope(action_3, "resource"));
178
+ const toolbarActions = [...grouped.toolbar, ...grouped.menu].filter(_temp);
179
+ const selectionActions = toolbarActions.filter(_temp2);
180
+ const resourceActions = toolbarActions.filter(_temp3);
66
181
  const selectable = selectableProp ?? selectionActions.length > 0;
67
182
  const selectedCount = selectable ? countSelected(selection, count) : 0;
68
- const selectedItems = pageItems.filter((item) => isItemSelected(selection, item.id));
183
+ let t25;
184
+ if ($[32] !== selection) {
185
+ t25 = (item_1) => isItemSelected(selection, item_1.id);
186
+ $[32] = selection;
187
+ $[33] = t25;
188
+ } else t25 = $[33];
189
+ const selectedItems = pageItems.filter(t25);
69
190
  const pageSelection = getPageSelection(selection, pageItems);
70
- const getItemLabel = (item_0) => {
71
- if (getItemLabelProp !== void 0) return getItemLabelProp(item_0);
72
- const titleColumn = columns.find((column) => column.id === itemTitle) ?? (itemTitle === void 0 ? columns[0] : void 0);
73
- const title = titleColumn !== void 0 ? toText(getColumnValue(item_0, titleColumn, intl.locale), intl.locale) : itemTitle !== void 0 ? toText(item_0[itemTitle], intl.locale) : "";
74
- return title !== "" ? title : item_0.id;
191
+ const getItemLabel = (item_2) => {
192
+ if (getItemLabelProp !== void 0) return getItemLabelProp(item_2);
193
+ const titleColumn = allColumns.find((column) => column.id === itemTitle) ?? (itemTitle === void 0 ? columns[0] : void 0);
194
+ const title = titleColumn !== void 0 ? toText(getColumnValue(item_2, titleColumn, intl.locale), intl.locale) : itemTitle !== void 0 ? toText(item_2[itemTitle], intl.locale) : "";
195
+ return title !== "" ? title : item_2.id;
75
196
  };
76
- const renderValue = (item_1, column_0) => {
77
- if (column_0.render !== void 0) return column_0.render(item_1);
78
- const Display = (column_0.display !== void 0 && column_0.display !== null ? allDisplays[column_0.display] : void 0) ?? builtInDisplays.text;
79
- if (Display === void 0) return null;
80
- return /* @__PURE__ */ jsx(Display, {
81
- value: getColumnValue(item_1, column_0, intl.locale),
82
- item: item_1,
83
- column: column_0,
84
- field: column_0.field ?? null
85
- });
197
+ const renderValue = useRenderValue(displays);
198
+ const renderCell = (item_3, column_0, content) => {
199
+ const field = onInlineEdit !== void 0 ? getInlineField(column_0, item_3, inlineEdit) : null;
200
+ if (field === null || onInlineEdit === void 0) return content;
201
+ return /* @__PURE__ */ jsx(InlineCell, {
202
+ item: item_3,
203
+ field,
204
+ itemLabel: getItemLabel(item_3),
205
+ getItemLabel,
206
+ renderValue: (current_0) => renderValue(current_0, column_0),
207
+ onSave: (base_0, value) => onInlineEdit({
208
+ item: base_0,
209
+ field,
210
+ value
211
+ }),
212
+ onItem: showItem,
213
+ formatError: (failure) => formatError(failure, field.name),
214
+ children: content
215
+ }, `${item_3.id}\u0000${column_0.id}`);
86
216
  };
87
- const execute = async (event) => {
217
+ const closeConfirmation = () => {
218
+ confirmation.current = confirmation.current + 1;
88
219
  setConfirming(null);
220
+ setPreview(null);
221
+ };
222
+ const execute = async (event) => {
223
+ closeConfirmation();
89
224
  setPending(keyOf(event.action, event.item));
90
- try {
91
- const outcome = await onAction?.(event);
225
+ await Promise.resolve().then(() => onAction?.(event)).then((outcome) => {
92
226
  if (event.scope === "selection" && outcome !== false) list.clearSelection();
93
- } catch (caught) {
227
+ }).catch((caught) => {
94
228
  toasts.show({
95
- title: intl.formatMessage(messages.actionFailed, { action: event.action.label }),
229
+ title: intl.formatMessage(messages.actionFailed, { action: getActionLabel(event.action, intl) }),
96
230
  ...caught instanceof Error && caught.message !== "" ? { description: caught.message } : {},
97
231
  tone: "danger"
98
232
  });
99
- } finally {
100
- setPending(null);
101
- }
233
+ });
234
+ setPending(null);
102
235
  };
103
236
  const run = (event_0) => {
237
+ const { action: action_2, selection: selection_0 } = event_0;
238
+ if (previewAction !== void 0 && action_2.dryRun === true && selection_0 !== void 0 && "query" in selection_0) {
239
+ const current_1 = confirmation.current = confirmation.current + 1;
240
+ const asks = action_2.confirm !== void 0 && action_2.confirm !== false;
241
+ setConfirming(event_0);
242
+ setPreview({ status: "loading" });
243
+ previewAction(event_0).then((result) => {
244
+ if (confirmation.current !== current_1) return;
245
+ const skipped = result?.skipped ?? event_0.skipped.length;
246
+ if (skipped === 0 && !asks && !asksConfirmation(action_2, Math.max(0, event_0.count - skipped))) execute(event_0);
247
+ else setPreview(result !== null ? {
248
+ status: "done",
249
+ ...result
250
+ } : null);
251
+ }, () => {
252
+ if (confirmation.current !== current_1) return;
253
+ if (needsConfirmation(event_0)) setPreview(null);
254
+ else execute(event_0);
255
+ });
256
+ return;
257
+ }
104
258
  if (needsConfirmation(event_0)) setConfirming(event_0);
105
259
  else execute(event_0);
106
260
  };
107
- const runOnItem = (action_4, item_2) => run({
108
- action: action_4,
261
+ const runOnItem = (action_3, item_4) => run({
262
+ action: action_3,
109
263
  scope: "item",
110
- item: item_2,
264
+ item: item_4,
111
265
  count: 1,
112
266
  skipped: []
113
267
  });
114
- const runOnSelection = (action_5) => {
268
+ const runOnSelection = (action_4) => {
115
269
  const selected = list.getSelection();
116
270
  if (selected === null) return;
117
271
  run({
118
- action: action_5,
272
+ action: action_4,
119
273
  scope: "selection",
120
274
  selection: selected,
121
275
  count: selectedCount,
122
- skipped: selectedItems.filter((item_3) => !isAllowedOn(action_5, item_3))
276
+ skipped: selectedItems.filter((item_5) => !isAllowedOn(action_4, item_5))
123
277
  });
124
278
  };
125
- const runOnResource = (action_6) => run({
126
- action: action_6,
279
+ const runOnResource = (action_5) => run({
280
+ action: action_5,
127
281
  scope: "resource",
128
282
  count,
129
283
  skipped: []
130
284
  });
131
- const renderActions = (item_4) => {
132
- const allowed = rowActions.filter((action_7) => isAllowedOn(action_7, item_4));
133
- const menu = rowMenu.filter((action_8) => isAllowedOn(action_8, item_4));
285
+ const pageActions = pageItems.map((item_6) => [...selectItemActions(grouped.row, item_6, "row", { getLinkHref }), ...selectItemActions(grouped.menu, item_6, "menu", { getLinkHref })]);
286
+ const firstOf = (action_6) => pageActions.flat().find((entry) => entry.action.id === action_6.id) ?? [];
287
+ const slots = orderRowActions(grouped.row.flatMap(firstOf), grouped.menu.flatMap(firstOf));
288
+ const primaryAction = primaryActionProp !== void 0 ? primaryActionProp : ["show", "edit"].find((id_1) => slots.some((slot) => slot.action.id === id_1)) ?? null;
289
+ const renderActions = (item_7) => {
290
+ const allowed = selectItemActions(grouped.row, item_7, "row", { getLinkHref });
291
+ const menu = selectItemActions(grouped.menu, item_7, "menu", { getLinkHref });
134
292
  if (allowed.length === 0 && menu.length === 0) return null;
135
- const running = pending?.endsWith(`\u0000${item_4.id}`) === true ? pending.split("\0")[0] : null;
293
+ const running = pending?.endsWith(`\u0000${item_7.id}`) === true ? pending.split("\0")[0] : null;
136
294
  return /* @__PURE__ */ jsx(RowActions, {
137
- item: item_4,
138
- itemLabel: getItemLabel(item_4),
295
+ itemLabel: getItemLabel(item_7),
139
296
  actions: allowed,
140
297
  menu,
141
298
  pending: running ?? null,
142
- onRun: (action_9) => runOnItem(action_9, item_4),
143
- icons: actionIcons
299
+ onRun: (action_7) => runOnItem(action_7, item_7),
300
+ icons: actionIcons,
301
+ slots,
302
+ primary: primaryAction
144
303
  });
145
304
  };
305
+ let t26;
306
+ if ($[34] !== intl) {
307
+ t26 = intl.formatMessage(messages.selectPage);
308
+ $[34] = intl;
309
+ $[35] = t26;
310
+ } else t26 = $[35];
146
311
  const pageCheckbox = /* @__PURE__ */ jsx(Checkbox, {
147
- "aria-label": intl.formatMessage(messages.selectPage),
312
+ "aria-label": t26,
148
313
  isSelected: pageSelection === "all",
149
314
  isIndeterminate: pageSelection === "some",
150
315
  isDisabled: pageItems.length === 0,
151
316
  onChange: () => {
152
- const ids = pageItems.map((item_5) => item_5.id);
317
+ const ids = pageItems.map(_temp4);
153
318
  if (pageSelection === "all") list.deselect(ids);
154
319
  else list.select(ids);
155
320
  }
156
321
  });
157
- const sortable = columns.some((column_1) => column_1.sortable === true);
158
- const showToolbar = search || filters.length > 0 || sortable || layouts.length > 1 || resourceActions.length > 0 || toolbar !== void 0;
159
- const body = (() => {
160
- if (error !== null) return /* @__PURE__ */ jsx(Alert, {
161
- tone: "danger",
162
- title: intl.formatMessage(messages.loadFailed),
163
- actions: onRetry !== void 0 ? /* @__PURE__ */ jsx(Button, {
164
- size: "sm",
165
- onPress: onRetry,
166
- children: intl.formatMessage(messages.retry)
167
- }) : void 0,
168
- children: error.message
169
- });
170
- if (items === void 0) return /* @__PURE__ */ jsx("div", {
171
- className: ListView_module_default.state,
172
- children: /* @__PURE__ */ jsx(Spinner, { showLabel: true })
173
- });
174
- if (pageItems.length === 0) return /* @__PURE__ */ jsxs("div", {
175
- className: ListView_module_default.state,
176
- children: [/* @__PURE__ */ jsx("p", { children: hasQuery ? intl.formatMessage(messages.noResults) : emptyMessage ?? intl.formatMessage(messages.empty) }), hasQuery ? /* @__PURE__ */ jsx(Button, {
177
- size: "sm",
178
- onPress: () => clearFilters(),
179
- children: intl.formatMessage(messages.clearFilters)
180
- }) : null]
181
- });
182
- return /* @__PURE__ */ jsx(Layout, {
322
+ const sortable = allColumns.some(_temp5);
323
+ const choosesColumns = columnChoice && allColumns.length > 1;
324
+ const showToolbar = search || filters.length > 0 || sortable || choosesColumns || layouts.length > 1 || resourceActions.length > 0 || toolbar !== void 0;
325
+ let t27;
326
+ if ($[36] !== filterValues || $[37] !== list || $[38] !== query.q) {
327
+ t27 = function clearFilters() {
328
+ Object.keys(filterValues).forEach((id_2) => list.setFilter(id_2, void 0));
329
+ if ((query.q ?? "") !== "") list.setSearch("");
330
+ };
331
+ $[36] = filterValues;
332
+ $[37] = list;
333
+ $[38] = query.q;
334
+ $[39] = t27;
335
+ } else t27 = $[39];
336
+ const clearFilters = t27;
337
+ let t28;
338
+ bb0: {
339
+ if (error !== null) {
340
+ let t29;
341
+ if ($[40] !== intl) {
342
+ t29 = intl.formatMessage(messages.loadFailed);
343
+ $[40] = intl;
344
+ $[41] = t29;
345
+ } else t29 = $[41];
346
+ let t30;
347
+ if ($[42] !== intl || $[43] !== onRetry) {
348
+ t30 = onRetry !== void 0 ? /* @__PURE__ */ jsx(Button, {
349
+ size: "sm",
350
+ onPress: onRetry,
351
+ children: intl.formatMessage(messages.retry)
352
+ }) : void 0;
353
+ $[42] = intl;
354
+ $[43] = onRetry;
355
+ $[44] = t30;
356
+ } else t30 = $[44];
357
+ let t31;
358
+ if ($[45] !== error.message || $[46] !== t29 || $[47] !== t30) {
359
+ t31 = /* @__PURE__ */ jsx(Alert, {
360
+ tone: "danger",
361
+ title: t29,
362
+ actions: t30,
363
+ children: error.message
364
+ });
365
+ $[45] = error.message;
366
+ $[46] = t29;
367
+ $[47] = t30;
368
+ $[48] = t31;
369
+ } else t31 = $[48];
370
+ t28 = t31;
371
+ break bb0;
372
+ }
373
+ if (items === void 0) {
374
+ t28 = /* @__PURE__ */ jsx(ListSkeleton, {
375
+ Layout,
376
+ columns,
377
+ perPage: query.perPage,
378
+ sort,
379
+ label,
380
+ withImages: itemImage !== void 0
381
+ });
382
+ break bb0;
383
+ }
384
+ if (pageItems.length === 0 && !inCalendar) {
385
+ let t29;
386
+ if ($[49] !== emptyMessage || $[50] !== hasQuery || $[51] !== intl) {
387
+ t29 = hasQuery ? intl.formatMessage(messages.noResults) : emptyMessage ?? intl.formatMessage(messages.empty);
388
+ $[49] = emptyMessage;
389
+ $[50] = hasQuery;
390
+ $[51] = intl;
391
+ $[52] = t29;
392
+ } else t29 = $[52];
393
+ let t30;
394
+ if ($[53] !== t29) {
395
+ t30 = /* @__PURE__ */ jsx("p", { children: t29 });
396
+ $[53] = t29;
397
+ $[54] = t30;
398
+ } else t30 = $[54];
399
+ let t31;
400
+ if ($[55] !== clearFilters || $[56] !== hasQuery || $[57] !== intl) {
401
+ t31 = hasQuery ? /* @__PURE__ */ jsx(Button, {
402
+ size: "sm",
403
+ onPress: () => clearFilters(),
404
+ children: intl.formatMessage(messages.clearFilters)
405
+ }) : null;
406
+ $[55] = clearFilters;
407
+ $[56] = hasQuery;
408
+ $[57] = intl;
409
+ $[58] = t31;
410
+ } else t31 = $[58];
411
+ let t32;
412
+ if ($[59] !== t30 || $[60] !== t31) {
413
+ t32 = /* @__PURE__ */ jsxs("div", {
414
+ className: ListView_module_default.state,
415
+ children: [t30, t31]
416
+ });
417
+ $[59] = t30;
418
+ $[60] = t31;
419
+ $[61] = t32;
420
+ } else t32 = $[61];
421
+ t28 = t32;
422
+ break bb0;
423
+ }
424
+ let t29;
425
+ if ($[62] !== itemImage) {
426
+ t29 = itemImage !== void 0 ? (item_9) => getImageUrl(item_9[itemImage]) : void 0;
427
+ $[62] = itemImage;
428
+ $[63] = t29;
429
+ } else t29 = $[63];
430
+ let t30;
431
+ if ($[64] !== currentItemId) {
432
+ t30 = (item_10) => item_10.id === currentItemId;
433
+ $[64] = currentItemId;
434
+ $[65] = t30;
435
+ } else t30 = $[65];
436
+ let t31;
437
+ if ($[66] !== selection) {
438
+ t31 = (item_11) => isItemSelected(selection, item_11.id);
439
+ $[66] = selection;
440
+ $[67] = t31;
441
+ } else t31 = $[67];
442
+ let t32;
443
+ if ($[68] !== list) {
444
+ t32 = (item_12) => list.toggle(item_12.id);
445
+ $[68] = list;
446
+ $[69] = t32;
447
+ } else t32 = $[69];
448
+ let t33;
449
+ if ($[70] !== list) {
450
+ t33 = (column_3) => list.toggleSort(column_3.id);
451
+ $[70] = list;
452
+ $[71] = t33;
453
+ } else t33 = $[71];
454
+ t28 = /* @__PURE__ */ jsx(Layout, {
183
455
  items: pageItems,
184
456
  columns,
185
457
  renderValue,
186
458
  getItemLabel,
187
459
  getItemHref,
460
+ getItemImage: t29,
461
+ calendar: inCalendar ? {
462
+ field: calendar.field,
463
+ timeZone: getCalendarTimeZone([...fields, ...allColumns.map(_temp6)].find((field_0) => field_0?.name === calendar.field)),
464
+ month: view.month ?? currentMonth(),
465
+ onMonthChange: (month) => list.setMonth(month),
466
+ more: total !== void 0 && total > pageItems.length ? { total } : cursors !== void 0 && cursors.next !== null ? { total: null } : null
467
+ } : void 0,
468
+ isCurrent: t30,
188
469
  selectable,
189
- isSelected: (item_6) => isItemSelected(selection, item_6.id),
190
- onToggle: (item_7) => list.toggle(item_7.id),
470
+ isSelected: t31,
471
+ onToggle: t32,
191
472
  renderActions,
192
473
  sort,
193
- onSort: (column_2) => list.toggleSort(column_2.id),
474
+ onSort: t33,
194
475
  label,
195
- pageSelection: pageCheckbox
476
+ pageSelection: pageCheckbox,
477
+ renderCell
196
478
  });
197
- })();
198
- function clearFilters() {
199
- Object.keys(filterValues).forEach((id_0) => list.setFilter(id_0, void 0));
200
- if ((query.q ?? "") !== "") list.setSearch("");
201
479
  }
202
- return /* @__PURE__ */ jsxs("div", {
203
- className: cx(ListView_module_default.list, className),
204
- children: [
205
- showToolbar ? /* @__PURE__ */ jsxs("div", {
206
- className: ListView_module_default.toolbar,
207
- children: [/* @__PURE__ */ jsxs("div", {
208
- className: ListView_module_default.toolbarStart,
209
- children: [search ? /* @__PURE__ */ jsx(SearchField, {
210
- value: query.q ?? "",
211
- onChange: (q) => list.setSearch(q)
212
- }) : null, filters.length > 0 ? /* @__PURE__ */ jsx(FilterControls, {
213
- filters,
214
- values: filterValues,
215
- onChange: (id_1, value) => list.setFilter(id_1, value),
216
- onLabel: filterLabels.remember,
217
- controls: filterControls,
218
- columns,
219
- fields,
220
- labels: filterLabels.labels
221
- }) : null]
222
- }), /* @__PURE__ */ jsxs("div", {
223
- className: ListView_module_default.toolbarEnd,
224
- children: [
225
- sortable ? /* @__PURE__ */ jsx("div", {
226
- className: layout === "table" ? ListView_module_default.tableSort : void 0,
227
- children: /* @__PURE__ */ jsx(SortSelect, {
228
- columns,
229
- sort,
230
- onChange: (next) => list.setSort(next)
231
- })
232
- }) : null,
233
- layouts.length > 1 ? /* @__PURE__ */ jsx(LayoutSwitch, {
234
- layouts,
235
- value: layout,
236
- onChange: (next_0) => {
237
- setLayout(next_0);
238
- onLayoutChange?.(next_0);
239
- }
240
- }) : null,
241
- resourceActions.filter((action_10) => selectedCount === 0 || !hasScope(action_10, "selection")).map((action_11) => /* @__PURE__ */ jsx(ActionButton, {
242
- action: action_11,
243
- icons: actionIcons,
244
- size: "md",
245
- href: getActionHref(action_11),
246
- isPending: pending === keyOf(action_11),
247
- onPress: () => runOnResource(action_11)
248
- }, action_11.id)),
249
- toolbar
250
- ]
251
- })]
252
- }) : null,
253
- /* @__PURE__ */ jsx(FilterChips, {
480
+ const body = t28;
481
+ let t29;
482
+ if ($[72] !== className) {
483
+ t29 = cx(ListView_module_default.list, className);
484
+ $[72] = className;
485
+ $[73] = t29;
486
+ } else t29 = $[73];
487
+ const t30 = showToolbar ? /* @__PURE__ */ jsxs("div", {
488
+ className: ListView_module_default.toolbar,
489
+ children: [/* @__PURE__ */ jsxs("div", {
490
+ className: ListView_module_default.toolbarStart,
491
+ children: [search ? /* @__PURE__ */ jsx(SearchField, {
492
+ value: query.q ?? "",
493
+ onChange: (q) => list.setSearch(q)
494
+ }) : null, filters.length > 0 ? /* @__PURE__ */ jsx(FilterControls, {
254
495
  filters,
255
496
  values: filterValues,
256
- q: query.q,
257
- onRemove: (id_2) => list.setFilter(id_2, void 0),
258
- onClearSearch: () => list.setSearch(""),
259
- onClear: clearFilters,
260
- columns,
497
+ onChange: (id_3, value_0) => list.setFilter(id_3, value_0),
498
+ onLabel: filterLabels.remember,
499
+ controls: filterControls,
500
+ columns: allColumns,
261
501
  fields,
262
502
  labels: filterLabels.labels
503
+ }) : null]
504
+ }), /* @__PURE__ */ jsxs("div", {
505
+ className: ListView_module_default.toolbarEnd,
506
+ children: [
507
+ sortable ? /* @__PURE__ */ jsx("div", {
508
+ className: layout === "table" ? ListView_module_default.tableSort : void 0,
509
+ children: /* @__PURE__ */ jsx(SortSelect, {
510
+ columns: allColumns,
511
+ sort,
512
+ onChange: (next) => list.setSort(next)
513
+ })
514
+ }) : null,
515
+ layouts.length > 1 ? /* @__PURE__ */ jsx(LayoutSwitch, {
516
+ layouts,
517
+ value: layout,
518
+ onChange: (next_0) => {
519
+ if (controlledLayout === void 0) list.setLayout(next_0);
520
+ onLayoutChange?.(next_0);
521
+ }
522
+ }) : null,
523
+ choosesColumns ? /* @__PURE__ */ jsx(ColumnMenu, {
524
+ columns: allColumns,
525
+ shown: columns,
526
+ onChange: (ids_0) => list.setColumns(ids_0),
527
+ onReset: view.columns !== void 0 ? () => list.resetColumns() : null
528
+ }) : null,
529
+ resourceActions.filter((action_8) => selectedCount === 0 || !hasScope(action_8, "selection")).map((action_9) => /* @__PURE__ */ jsx(ActionButton, {
530
+ action: action_9,
531
+ icons: actionIcons,
532
+ size: "md",
533
+ href: getActionHref(action_9),
534
+ isPending: pending === keyOf(action_9),
535
+ onPress: () => runOnResource(action_9)
536
+ }, action_9.id)),
537
+ toolbar
538
+ ]
539
+ })]
540
+ }) : null;
541
+ let t31;
542
+ let t32;
543
+ if ($[74] !== list) {
544
+ t31 = (id_4) => list.setFilter(id_4, void 0);
545
+ t32 = () => list.setSearch("");
546
+ $[74] = list;
547
+ $[75] = t31;
548
+ $[76] = t32;
549
+ } else {
550
+ t31 = $[75];
551
+ t32 = $[76];
552
+ }
553
+ let t33;
554
+ if ($[77] !== allColumns || $[78] !== clearFilters || $[79] !== fields || $[80] !== filterLabels.labels || $[81] !== filterValues || $[82] !== filters || $[83] !== query.q || $[84] !== t31 || $[85] !== t32) {
555
+ t33 = /* @__PURE__ */ jsx(FilterChips, {
556
+ filters,
557
+ values: filterValues,
558
+ q: query.q,
559
+ onRemove: t31,
560
+ onClearSearch: t32,
561
+ onClear: clearFilters,
562
+ columns: allColumns,
563
+ fields,
564
+ labels: filterLabels.labels
565
+ });
566
+ $[77] = allColumns;
567
+ $[78] = clearFilters;
568
+ $[79] = fields;
569
+ $[80] = filterLabels.labels;
570
+ $[81] = filterValues;
571
+ $[82] = filters;
572
+ $[83] = query.q;
573
+ $[84] = t31;
574
+ $[85] = t32;
575
+ $[86] = t33;
576
+ } else t33 = $[86];
577
+ const t34 = selectedCount > 0 ? /* @__PURE__ */ jsxs("div", {
578
+ className: ListView_module_default.selection,
579
+ children: [
580
+ /* @__PURE__ */ jsx("span", {
581
+ className: ListView_module_default.selectionCount,
582
+ role: "status",
583
+ children: selection.mode === "all" ? intl.formatMessage(messages.allMatchingSelected, { total: selectedCount }) : intl.formatMessage(messages.selectedCount, { count: selectedCount })
263
584
  }),
264
- selectedCount > 0 ? /* @__PURE__ */ jsxs("div", {
265
- className: ListView_module_default.selection,
266
- children: [
267
- /* @__PURE__ */ jsx("span", {
268
- className: ListView_module_default.selectionCount,
269
- role: "status",
270
- children: selection.mode === "all" ? intl.formatMessage(messages.allMatchingSelected, { total: selectedCount }) : intl.formatMessage(messages.selectedCount, { count: selectedCount })
271
- }),
272
- selection.mode === "ids" && pageSelection === "all" && count > pageItems.length ? /* @__PURE__ */ jsx(Button, {
273
- size: "sm",
274
- variant: "ghost",
275
- onPress: () => list.selectAllMatching(),
276
- children: intl.formatMessage(messages.selectAllMatching, { total: count })
277
- }) : null,
278
- /* @__PURE__ */ jsx(Button, {
279
- size: "sm",
280
- variant: "ghost",
281
- onPress: () => list.clearSelection(),
282
- children: intl.formatMessage(messages.clearSelection)
283
- }),
284
- selectionActions.length > 0 ? /* @__PURE__ */ jsx("div", {
285
- className: ListView_module_default.selectionActions,
286
- children: selectionActions.map((action_12) => {
287
- const skipped = selectedItems.filter((item_8) => !isAllowedOn(action_12, item_8)).length;
288
- return /* @__PURE__ */ jsx(ActionButton, {
289
- action: action_12,
290
- icons: actionIcons,
291
- size: "md",
292
- href: null,
293
- isPending: pending === keyOf(action_12),
294
- isDisabled: pending !== null && pending !== keyOf(action_12) || skipped >= selectedCount,
295
- onPress: () => runOnSelection(action_12)
296
- }, action_12.id);
297
- })
298
- }) : null
299
- ]
585
+ selection.mode === "ids" && pageSelection === "all" && count > pageItems.length ? /* @__PURE__ */ jsx(Button, {
586
+ size: "sm",
587
+ variant: "ghost",
588
+ onPress: () => list.selectAllMatching(),
589
+ children: intl.formatMessage(messages.selectAllMatching, { total: count })
300
590
  }) : null,
301
- /* @__PURE__ */ jsx("div", {
302
- className: ListView_module_default.body,
303
- "aria-busy": isLoading && items !== void 0,
304
- children: body
591
+ /* @__PURE__ */ jsx(Button, {
592
+ size: "sm",
593
+ variant: "ghost",
594
+ onPress: () => list.clearSelection(),
595
+ children: intl.formatMessage(messages.clearSelection)
305
596
  }),
306
- total !== void 0 && error === null && total > 0 ? /* @__PURE__ */ jsx(Pagination, {
307
- page: query.page ?? 1,
308
- perPage: query.perPage ?? pageItems.length,
309
- total,
310
- onPageChange: (page) => list.setPage(page),
311
- perPageOptions,
312
- onPerPageChange: (perPage) => list.setPerPage(perPage)
313
- }) : null,
314
- /* @__PURE__ */ jsx(ConfirmDialog, {
315
- event: confirming,
316
- onConfirm: (event_1) => void execute(event_1),
317
- onCancel: () => setConfirming(null)
318
- })
597
+ selectionActions.length > 0 ? /* @__PURE__ */ jsx("div", {
598
+ className: ListView_module_default.selectionActions,
599
+ children: selectionActions.map((action_10) => {
600
+ const skipped_0 = selectedItems.filter((item_13) => !isAllowedOn(action_10, item_13)).length;
601
+ return /* @__PURE__ */ jsx(ActionButton, {
602
+ action: action_10,
603
+ icons: actionIcons,
604
+ size: "md",
605
+ href: null,
606
+ isPending: pending === keyOf(action_10),
607
+ isDisabled: pending !== null && pending !== keyOf(action_10) || skipped_0 >= selectedCount,
608
+ onPress: () => runOnSelection(action_10)
609
+ }, action_10.id);
610
+ })
611
+ }) : null
319
612
  ]
320
- });
613
+ }) : null;
614
+ const t35 = isLoading && items !== void 0;
615
+ let t36;
616
+ if ($[87] !== body || $[88] !== t35) {
617
+ t36 = /* @__PURE__ */ jsx("div", {
618
+ className: ListView_module_default.body,
619
+ "aria-busy": t35,
620
+ children: body
621
+ });
622
+ $[87] = body;
623
+ $[88] = t35;
624
+ $[89] = t36;
625
+ } else t36 = $[89];
626
+ let t37;
627
+ if ($[90] !== cursors || $[91] !== error || $[92] !== inCalendar || $[93] !== list || $[94] !== pageItems || $[95] !== perPageOptions || $[96] !== query.cursor || $[97] !== query.page || $[98] !== query.perPage || $[99] !== total) {
628
+ t37 = inCalendar ? null : cursors !== void 0 && error === null ? /* @__PURE__ */ jsx(CursorPagination, {
629
+ perPage: query.perPage ?? pageItems.length,
630
+ hasPrevious: query.cursor !== void 0,
631
+ hasNext: cursors.next !== null,
632
+ onPrevious: () => list.previousPage(cursors.previous),
633
+ onNext: () => {
634
+ if (cursors.next !== null) list.nextPage(cursors.next);
635
+ },
636
+ perPageOptions,
637
+ onPerPageChange: (perPage) => list.setPerPage(perPage)
638
+ }) : total !== void 0 && error === null && total > 0 ? /* @__PURE__ */ jsx(Pagination, {
639
+ page: query.page ?? 1,
640
+ perPage: query.perPage ?? pageItems.length,
641
+ total,
642
+ onPageChange: (page) => list.setPage(page),
643
+ perPageOptions,
644
+ onPerPageChange: (perPage_0) => list.setPerPage(perPage_0)
645
+ }) : null;
646
+ $[90] = cursors;
647
+ $[91] = error;
648
+ $[92] = inCalendar;
649
+ $[93] = list;
650
+ $[94] = pageItems;
651
+ $[95] = perPageOptions;
652
+ $[96] = query.cursor;
653
+ $[97] = query.page;
654
+ $[98] = query.perPage;
655
+ $[99] = total;
656
+ $[100] = t37;
657
+ } else t37 = $[100];
658
+ let t38;
659
+ if ($[101] !== execute) {
660
+ t38 = (event_1) => void execute(event_1);
661
+ $[101] = execute;
662
+ $[102] = t38;
663
+ } else t38 = $[102];
664
+ let t39;
665
+ if ($[103] !== closeConfirmation || $[104] !== confirming || $[105] !== preview || $[106] !== t38) {
666
+ t39 = /* @__PURE__ */ jsx(ConfirmDialog, {
667
+ event: confirming,
668
+ preview,
669
+ onConfirm: t38,
670
+ onCancel: closeConfirmation
671
+ });
672
+ $[103] = closeConfirmation;
673
+ $[104] = confirming;
674
+ $[105] = preview;
675
+ $[106] = t38;
676
+ $[107] = t39;
677
+ } else t39 = $[107];
678
+ let t40;
679
+ if ($[108] !== t29 || $[109] !== t30 || $[110] !== t33 || $[111] !== t34 || $[112] !== t36 || $[113] !== t37 || $[114] !== t39) {
680
+ t40 = /* @__PURE__ */ jsxs("div", {
681
+ className: t29,
682
+ children: [
683
+ t30,
684
+ t33,
685
+ t34,
686
+ t36,
687
+ t37,
688
+ t39
689
+ ]
690
+ });
691
+ $[108] = t29;
692
+ $[109] = t30;
693
+ $[110] = t33;
694
+ $[111] = t34;
695
+ $[112] = t36;
696
+ $[113] = t37;
697
+ $[114] = t39;
698
+ $[115] = t40;
699
+ } else t40 = $[115];
700
+ return t40;
701
+ }
702
+ function _temp6(column_2) {
703
+ return column_2.field;
704
+ }
705
+ function _temp5(column_1) {
706
+ return column_1.sortable === true;
707
+ }
708
+ function _temp4(item_8) {
709
+ return item_8.id;
710
+ }
711
+ function _temp3(action_1) {
712
+ return hasScope(action_1, "resource");
713
+ }
714
+ function _temp2(action_0) {
715
+ return hasScope(action_0, "selection");
716
+ }
717
+ function _temp(action, index, all) {
718
+ return (hasScope(action, "selection") || hasScope(action, "resource")) && all.findIndex((candidate_0) => candidate_0.id === action.id) === index;
321
719
  }
322
720
  //#endregion
323
721
  export { ListView };