@panneau/lists 5.0.0-alpha.20 → 5.0.0-alpha.22
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.
- package/dist/ListView.d.ts +6 -1
- package/dist/ListView.d.ts.map +1 -1
- package/dist/ListView.js +281 -248
- package/dist/ListView.js.map +1 -1
- package/dist/displays/displays.js +1 -1
- package/dist/filters/controls.d.ts.map +1 -1
- package/dist/filters/controls.js +4 -2
- package/dist/filters/controls.js.map +1 -1
- package/dist/images.d.ts +1 -6
- package/dist/images.d.ts.map +1 -1
- package/dist/images.js +1 -39
- package/dist/index.js +1 -1
- package/dist/inline/InlineCell.js +1 -1
- package/dist/layouts/CalendarLayout.d.ts +1 -1
- package/dist/layouts/CalendarLayout.d.ts.map +1 -1
- package/dist/layouts/CalendarLayout.js +75 -71
- package/dist/layouts/CalendarLayout.js.map +1 -1
- package/dist/layouts/CardsLayout.d.ts +1 -1
- package/dist/layouts/CardsLayout.d.ts.map +1 -1
- package/dist/layouts/CardsLayout.js +6 -2
- package/dist/layouts/CardsLayout.js.map +1 -1
- package/dist/layouts/GalleryLayout.d.ts +1 -1
- package/dist/layouts/GalleryLayout.d.ts.map +1 -1
- package/dist/layouts/GalleryLayout.js +49 -43
- package/dist/layouts/GalleryLayout.js.map +1 -1
- package/dist/layouts/TableLayout.d.ts +1 -1
- package/dist/layouts/TableLayout.d.ts.map +1 -1
- package/dist/layouts/TableLayout.js +53 -47
- package/dist/layouts/TableLayout.js.map +1 -1
- package/dist/layouts/highlight.css +28 -0
- package/dist/layouts/highlight.module.js +12 -0
- package/dist/layouts/highlight.module.js.map +1 -0
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -7
- package/dist/images.js.map +0 -1
package/dist/ListView.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getActionHref, groupListActions, hasScope, isAllowedOn } from "./actions/actions.js";
|
|
2
2
|
import { messages } from "./messages.js";
|
|
3
3
|
import { ConfirmDialog, needsConfirmation } from "./actions/ConfirmDialog.js";
|
|
4
|
-
import { getColumnValue, toText } from "./values.js";
|
|
5
4
|
import { getImageUrl } from "./images.js";
|
|
5
|
+
import { getColumnValue, toText } from "./values.js";
|
|
6
6
|
import { getCalendarTimeZone } from "./layouts/calendarDays.js";
|
|
7
7
|
import { cx } from "./cx.js";
|
|
8
8
|
import { builtInLayouts } from "./layouts/builtIn.js";
|
|
@@ -27,7 +27,7 @@ import { c } from "react/compiler-runtime";
|
|
|
27
27
|
import { getActionLabel } from "@panneau/intl";
|
|
28
28
|
import { Alert, Button, Checkbox, usePanneauIntl, useToast } from "@panneau/ui";
|
|
29
29
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
30
|
-
import { useRef, useState } from "react";
|
|
30
|
+
import { useEffect, useRef, useState } from "react";
|
|
31
31
|
//#region src/ListView.tsx
|
|
32
32
|
function keyOf(action, item) {
|
|
33
33
|
return item !== void 0 ? `${action.id}\u0000${item.id}` : action.id;
|
|
@@ -38,25 +38,26 @@ function keyOf(action, item) {
|
|
|
38
38
|
* fetches nothing: the caller gives the items of the list's query and their total.
|
|
39
39
|
*/
|
|
40
40
|
function ListView(t0) {
|
|
41
|
-
const $ = c(
|
|
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:
|
|
41
|
+
const $ = c(123);
|
|
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, highlightedItemId: t10, displays, layoutComponents, filterControls, inlineEdit: t11, onInlineEdit, formatError: t12, toolbar, emptyMessage, "aria-label": ariaLabel, className } = t0;
|
|
43
43
|
const columnChoice = t1 === void 0 ? true : t1;
|
|
44
44
|
const isLoading = t2 === void 0 ? false : t2;
|
|
45
45
|
const error = t3 === void 0 ? null : t3;
|
|
46
|
-
let
|
|
46
|
+
let t13;
|
|
47
47
|
if ($[0] !== t4) {
|
|
48
|
-
|
|
48
|
+
t13 = t4 === void 0 ? [] : t4;
|
|
49
49
|
$[0] = t4;
|
|
50
|
-
$[1] =
|
|
51
|
-
} else
|
|
52
|
-
const filtersProp =
|
|
50
|
+
$[1] = t13;
|
|
51
|
+
} else t13 = $[1];
|
|
52
|
+
const filtersProp = t13;
|
|
53
53
|
const fields = t5 === void 0 ? [] : t5;
|
|
54
54
|
const search = t6 === void 0 ? false : t6;
|
|
55
55
|
const layoutsProp = t7 === void 0 ? ["table"] : t7;
|
|
56
56
|
const calendar = t8 === void 0 ? null : t8;
|
|
57
57
|
const currentItemId = t9 === void 0 ? null : t9;
|
|
58
|
-
const
|
|
59
|
-
const
|
|
58
|
+
const highlightedItemId = t10 === void 0 ? null : t10;
|
|
59
|
+
const inlineEdit = t11 === void 0 ? [] : t11;
|
|
60
|
+
const formatError = t12 === void 0 ? formatRuleFailure : t12;
|
|
60
61
|
const intl = usePanneauIntl();
|
|
61
62
|
const toasts = useToast();
|
|
62
63
|
const plugins = usePlugins();
|
|
@@ -65,16 +66,17 @@ function ListView(t0) {
|
|
|
65
66
|
const [confirming, setConfirming] = useState(null);
|
|
66
67
|
const [preview, setPreview] = useState(null);
|
|
67
68
|
const confirmation = useRef(0);
|
|
69
|
+
const root = useRef(null);
|
|
68
70
|
const [pending, setPending] = useState(null);
|
|
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
71
|
let t14;
|
|
72
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
73
|
+
t14 = {};
|
|
74
|
+
$[2] = t14;
|
|
75
|
+
} else t14 = $[2];
|
|
76
|
+
const [saved, setSaved] = useState(t14);
|
|
77
|
+
let t15;
|
|
76
78
|
if ($[3] !== items) {
|
|
77
|
-
|
|
79
|
+
t15 = (item) => {
|
|
78
80
|
const base = items?.find((candidate) => candidate.id === item.id);
|
|
79
81
|
if (base !== void 0) setSaved((current) => ({
|
|
80
82
|
...current,
|
|
@@ -85,108 +87,108 @@ function ListView(t0) {
|
|
|
85
87
|
}));
|
|
86
88
|
};
|
|
87
89
|
$[3] = items;
|
|
88
|
-
$[4] =
|
|
89
|
-
} else
|
|
90
|
-
const showItem =
|
|
91
|
-
let
|
|
90
|
+
$[4] = t15;
|
|
91
|
+
} else t15 = $[4];
|
|
92
|
+
const showItem = t15;
|
|
93
|
+
let t16;
|
|
92
94
|
if ($[5] !== ariaLabel || $[6] !== intl) {
|
|
93
|
-
|
|
95
|
+
t16 = ariaLabel ?? intl.formatMessage(messages.list);
|
|
94
96
|
$[5] = ariaLabel;
|
|
95
97
|
$[6] = intl;
|
|
96
|
-
$[7] =
|
|
97
|
-
} else
|
|
98
|
-
const label =
|
|
99
|
-
let
|
|
98
|
+
$[7] = t16;
|
|
99
|
+
} else t16 = $[7];
|
|
100
|
+
const label = t16;
|
|
101
|
+
let t17;
|
|
100
102
|
if ($[8] !== saved) {
|
|
101
|
-
|
|
103
|
+
t17 = (item_0) => saved[item_0.id]?.base === item_0 ? saved[item_0.id]?.item ?? item_0 : item_0;
|
|
102
104
|
$[8] = saved;
|
|
103
|
-
$[9] =
|
|
104
|
-
} else
|
|
105
|
-
const pageItems = (items ?? []).map(
|
|
105
|
+
$[9] = t17;
|
|
106
|
+
} else t17 = $[9];
|
|
107
|
+
const pageItems = (items ?? []).map(t17);
|
|
106
108
|
const count = total ?? pageItems.length;
|
|
107
|
-
let
|
|
109
|
+
let t18;
|
|
108
110
|
if ($[10] !== query.sort) {
|
|
109
|
-
|
|
111
|
+
t18 = query.sort ?? [];
|
|
110
112
|
$[10] = query.sort;
|
|
111
|
-
$[11] =
|
|
112
|
-
} else
|
|
113
|
-
const sort =
|
|
114
|
-
let
|
|
113
|
+
$[11] = t18;
|
|
114
|
+
} else t18 = $[11];
|
|
115
|
+
const sort = t18;
|
|
116
|
+
let t19;
|
|
115
117
|
if ($[12] !== plugins.listLayouts) {
|
|
116
|
-
|
|
118
|
+
t19 = Object.fromEntries(plugins.listLayouts);
|
|
117
119
|
$[12] = plugins.listLayouts;
|
|
118
|
-
$[13] =
|
|
119
|
-
} else
|
|
120
|
-
const
|
|
121
|
-
let
|
|
122
|
-
if ($[14] !== layoutComponents || $[15] !==
|
|
123
|
-
|
|
120
|
+
$[13] = t19;
|
|
121
|
+
} else t19 = $[13];
|
|
122
|
+
const t20 = t19;
|
|
123
|
+
let t21;
|
|
124
|
+
if ($[14] !== layoutComponents || $[15] !== t20) {
|
|
125
|
+
t21 = {
|
|
124
126
|
...builtInLayouts,
|
|
125
|
-
...
|
|
127
|
+
...t20,
|
|
126
128
|
...layoutComponents
|
|
127
129
|
};
|
|
128
130
|
$[14] = layoutComponents;
|
|
129
|
-
$[15] =
|
|
130
|
-
$[16] =
|
|
131
|
-
} else
|
|
132
|
-
const allLayouts =
|
|
133
|
-
let
|
|
131
|
+
$[15] = t20;
|
|
132
|
+
$[16] = t21;
|
|
133
|
+
} else t21 = $[16];
|
|
134
|
+
const allLayouts = t21;
|
|
135
|
+
let t22;
|
|
134
136
|
if ($[17] !== allLayouts || $[18] !== calendar || $[19] !== itemImage) {
|
|
135
|
-
|
|
137
|
+
t22 = (id) => allLayouts[id] !== void 0 && (id !== "gallery" || itemImage !== void 0) && (id !== "calendar" || calendar !== null);
|
|
136
138
|
$[17] = allLayouts;
|
|
137
139
|
$[18] = calendar;
|
|
138
140
|
$[19] = itemImage;
|
|
139
|
-
$[20] =
|
|
140
|
-
} else
|
|
141
|
-
const available = layoutsProp.filter(
|
|
141
|
+
$[20] = t22;
|
|
142
|
+
} else t22 = $[20];
|
|
143
|
+
const available = layoutsProp.filter(t22);
|
|
142
144
|
const layouts = available.length > 0 ? available : ["table"];
|
|
143
145
|
const chosenLayout = view.layout !== void 0 && layouts.includes(view.layout) ? view.layout : void 0;
|
|
144
146
|
const layout = controlledLayout ?? chosenLayout ?? layouts[0] ?? "table";
|
|
145
147
|
const columns = getShownColumns(allColumns, view.columns);
|
|
146
148
|
const Layout = allLayouts[layout] ?? builtInLayouts.table;
|
|
147
149
|
const inCalendar = layout === "calendar" && calendar !== null;
|
|
148
|
-
let
|
|
150
|
+
let t23;
|
|
149
151
|
if ($[21] !== calendar || $[22] !== filtersProp || $[23] !== inCalendar) {
|
|
150
|
-
|
|
152
|
+
t23 = inCalendar ? filtersProp.filter((filter) => filter.id !== calendar.filter) : filtersProp;
|
|
151
153
|
$[21] = calendar;
|
|
152
154
|
$[22] = filtersProp;
|
|
153
155
|
$[23] = inCalendar;
|
|
154
|
-
$[24] =
|
|
155
|
-
} else
|
|
156
|
-
const filters =
|
|
157
|
-
let
|
|
156
|
+
$[24] = t23;
|
|
157
|
+
} else t23 = $[24];
|
|
158
|
+
const filters = t23;
|
|
159
|
+
let t24;
|
|
158
160
|
if ($[25] !== calendar || $[26] !== inCalendar || $[27] !== query.filter) {
|
|
159
|
-
|
|
160
|
-
const [id_0] =
|
|
161
|
+
t24 = Object.fromEntries(Object.entries(query.filter ?? {}).filter((t25) => {
|
|
162
|
+
const [id_0] = t25;
|
|
161
163
|
return !(inCalendar && id_0 === calendar.filter);
|
|
162
164
|
}));
|
|
163
165
|
$[25] = calendar;
|
|
164
166
|
$[26] = inCalendar;
|
|
165
167
|
$[27] = query.filter;
|
|
166
|
-
$[28] =
|
|
167
|
-
} else
|
|
168
|
-
const filterValues =
|
|
169
|
-
let
|
|
168
|
+
$[28] = t24;
|
|
169
|
+
} else t24 = $[28];
|
|
170
|
+
const filterValues = t24;
|
|
171
|
+
let t25;
|
|
170
172
|
if ($[29] !== filterValues || $[30] !== query.q) {
|
|
171
|
-
|
|
173
|
+
t25 = Object.keys(filterValues).length > 0 || (query.q ?? "") !== "";
|
|
172
174
|
$[29] = filterValues;
|
|
173
175
|
$[30] = query.q;
|
|
174
|
-
$[31] =
|
|
175
|
-
} else
|
|
176
|
-
const hasQuery =
|
|
176
|
+
$[31] = t25;
|
|
177
|
+
} else t25 = $[31];
|
|
178
|
+
const hasQuery = t25;
|
|
177
179
|
const grouped = groupListActions(actionsProp);
|
|
178
180
|
const toolbarActions = [...grouped.toolbar, ...grouped.menu].filter(_temp);
|
|
179
181
|
const selectionActions = toolbarActions.filter(_temp2);
|
|
180
182
|
const resourceActions = toolbarActions.filter(_temp3);
|
|
181
183
|
const selectable = selectableProp ?? selectionActions.length > 0;
|
|
182
184
|
const selectedCount = selectable ? countSelected(selection, count) : 0;
|
|
183
|
-
let
|
|
185
|
+
let t26;
|
|
184
186
|
if ($[32] !== selection) {
|
|
185
|
-
|
|
187
|
+
t26 = (item_1) => isItemSelected(selection, item_1.id);
|
|
186
188
|
$[32] = selection;
|
|
187
|
-
$[33] =
|
|
188
|
-
} else
|
|
189
|
-
const selectedItems = pageItems.filter(
|
|
189
|
+
$[33] = t26;
|
|
190
|
+
} else t26 = $[33];
|
|
191
|
+
const selectedItems = pageItems.filter(t26);
|
|
190
192
|
const pageSelection = getPageSelection(selection, pageItems);
|
|
191
193
|
const getItemLabel = (item_2) => {
|
|
192
194
|
if (getItemLabelProp !== void 0) return getItemLabelProp(item_2);
|
|
@@ -302,14 +304,14 @@ function ListView(t0) {
|
|
|
302
304
|
primary: primaryAction
|
|
303
305
|
});
|
|
304
306
|
};
|
|
305
|
-
let
|
|
307
|
+
let t27;
|
|
306
308
|
if ($[34] !== intl) {
|
|
307
|
-
|
|
309
|
+
t27 = intl.formatMessage(messages.selectPage);
|
|
308
310
|
$[34] = intl;
|
|
309
|
-
$[35] =
|
|
310
|
-
} else
|
|
311
|
+
$[35] = t27;
|
|
312
|
+
} else t27 = $[35];
|
|
311
313
|
const pageCheckbox = /* @__PURE__ */ jsx(Checkbox, {
|
|
312
|
-
"aria-label":
|
|
314
|
+
"aria-label": t27,
|
|
313
315
|
isSelected: pageSelection === "all",
|
|
314
316
|
isIndeterminate: pageSelection === "some",
|
|
315
317
|
isDisabled: pageItems.length === 0,
|
|
@@ -322,56 +324,56 @@ function ListView(t0) {
|
|
|
322
324
|
const sortable = allColumns.some(_temp5);
|
|
323
325
|
const choosesColumns = columnChoice && allColumns.length > 1;
|
|
324
326
|
const showToolbar = search || filters.length > 0 || sortable || choosesColumns || layouts.length > 1 || resourceActions.length > 0 || toolbar !== void 0;
|
|
325
|
-
let
|
|
327
|
+
let t28;
|
|
326
328
|
if ($[36] !== filterValues || $[37] !== list || $[38] !== query.q) {
|
|
327
|
-
|
|
329
|
+
t28 = function clearFilters() {
|
|
328
330
|
Object.keys(filterValues).forEach((id_2) => list.setFilter(id_2, void 0));
|
|
329
331
|
if ((query.q ?? "") !== "") list.setSearch("");
|
|
330
332
|
};
|
|
331
333
|
$[36] = filterValues;
|
|
332
334
|
$[37] = list;
|
|
333
335
|
$[38] = query.q;
|
|
334
|
-
$[39] =
|
|
335
|
-
} else
|
|
336
|
-
const clearFilters =
|
|
337
|
-
let
|
|
336
|
+
$[39] = t28;
|
|
337
|
+
} else t28 = $[39];
|
|
338
|
+
const clearFilters = t28;
|
|
339
|
+
let t29;
|
|
338
340
|
bb0: {
|
|
339
341
|
if (error !== null) {
|
|
340
|
-
let
|
|
342
|
+
let t30;
|
|
341
343
|
if ($[40] !== intl) {
|
|
342
|
-
|
|
344
|
+
t30 = intl.formatMessage(messages.loadFailed);
|
|
343
345
|
$[40] = intl;
|
|
344
|
-
$[41] =
|
|
345
|
-
} else
|
|
346
|
-
let
|
|
346
|
+
$[41] = t30;
|
|
347
|
+
} else t30 = $[41];
|
|
348
|
+
let t31;
|
|
347
349
|
if ($[42] !== intl || $[43] !== onRetry) {
|
|
348
|
-
|
|
350
|
+
t31 = onRetry !== void 0 ? /* @__PURE__ */ jsx(Button, {
|
|
349
351
|
size: "sm",
|
|
350
352
|
onPress: onRetry,
|
|
351
353
|
children: intl.formatMessage(messages.retry)
|
|
352
354
|
}) : void 0;
|
|
353
355
|
$[42] = intl;
|
|
354
356
|
$[43] = onRetry;
|
|
355
|
-
$[44] =
|
|
356
|
-
} else
|
|
357
|
-
let
|
|
358
|
-
if ($[45] !== error.message || $[46] !==
|
|
359
|
-
|
|
357
|
+
$[44] = t31;
|
|
358
|
+
} else t31 = $[44];
|
|
359
|
+
let t32;
|
|
360
|
+
if ($[45] !== error.message || $[46] !== t30 || $[47] !== t31) {
|
|
361
|
+
t32 = /* @__PURE__ */ jsx(Alert, {
|
|
360
362
|
tone: "danger",
|
|
361
|
-
title:
|
|
362
|
-
actions:
|
|
363
|
+
title: t30,
|
|
364
|
+
actions: t31,
|
|
363
365
|
children: error.message
|
|
364
366
|
});
|
|
365
367
|
$[45] = error.message;
|
|
366
|
-
$[46] =
|
|
367
|
-
$[47] =
|
|
368
|
-
$[48] =
|
|
369
|
-
} else
|
|
370
|
-
|
|
368
|
+
$[46] = t30;
|
|
369
|
+
$[47] = t31;
|
|
370
|
+
$[48] = t32;
|
|
371
|
+
} else t32 = $[48];
|
|
372
|
+
t29 = t32;
|
|
371
373
|
break bb0;
|
|
372
374
|
}
|
|
373
375
|
if (items === void 0) {
|
|
374
|
-
|
|
376
|
+
t29 = /* @__PURE__ */ jsx(ListSkeleton, {
|
|
375
377
|
Layout,
|
|
376
378
|
columns,
|
|
377
379
|
perPage: query.perPage,
|
|
@@ -382,23 +384,23 @@ function ListView(t0) {
|
|
|
382
384
|
break bb0;
|
|
383
385
|
}
|
|
384
386
|
if (pageItems.length === 0 && !inCalendar) {
|
|
385
|
-
let
|
|
387
|
+
let t30;
|
|
386
388
|
if ($[49] !== emptyMessage || $[50] !== hasQuery || $[51] !== intl) {
|
|
387
|
-
|
|
389
|
+
t30 = hasQuery ? intl.formatMessage(messages.noResults) : emptyMessage ?? intl.formatMessage(messages.empty);
|
|
388
390
|
$[49] = emptyMessage;
|
|
389
391
|
$[50] = hasQuery;
|
|
390
392
|
$[51] = intl;
|
|
391
|
-
$[52] =
|
|
392
|
-
} else
|
|
393
|
-
let t30;
|
|
394
|
-
if ($[53] !== t29) {
|
|
395
|
-
t30 = /* @__PURE__ */ jsx("p", { children: t29 });
|
|
396
|
-
$[53] = t29;
|
|
397
|
-
$[54] = t30;
|
|
398
|
-
} else t30 = $[54];
|
|
393
|
+
$[52] = t30;
|
|
394
|
+
} else t30 = $[52];
|
|
399
395
|
let t31;
|
|
396
|
+
if ($[53] !== t30) {
|
|
397
|
+
t31 = /* @__PURE__ */ jsx("p", { children: t30 });
|
|
398
|
+
$[53] = t30;
|
|
399
|
+
$[54] = t31;
|
|
400
|
+
} else t31 = $[54];
|
|
401
|
+
let t32;
|
|
400
402
|
if ($[55] !== clearFilters || $[56] !== hasQuery || $[57] !== intl) {
|
|
401
|
-
|
|
403
|
+
t32 = hasQuery ? /* @__PURE__ */ jsx(Button, {
|
|
402
404
|
size: "sm",
|
|
403
405
|
onPress: () => clearFilters(),
|
|
404
406
|
children: intl.formatMessage(messages.clearFilters)
|
|
@@ -406,58 +408,64 @@ function ListView(t0) {
|
|
|
406
408
|
$[55] = clearFilters;
|
|
407
409
|
$[56] = hasQuery;
|
|
408
410
|
$[57] = intl;
|
|
409
|
-
$[58] =
|
|
410
|
-
} else
|
|
411
|
-
let
|
|
412
|
-
if ($[59] !==
|
|
413
|
-
|
|
411
|
+
$[58] = t32;
|
|
412
|
+
} else t32 = $[58];
|
|
413
|
+
let t33;
|
|
414
|
+
if ($[59] !== t31 || $[60] !== t32) {
|
|
415
|
+
t33 = /* @__PURE__ */ jsxs("div", {
|
|
414
416
|
className: ListView_module_default.state,
|
|
415
|
-
children: [
|
|
417
|
+
children: [t31, t32]
|
|
416
418
|
});
|
|
417
|
-
$[59] =
|
|
418
|
-
$[60] =
|
|
419
|
-
$[61] =
|
|
420
|
-
} else
|
|
421
|
-
|
|
419
|
+
$[59] = t31;
|
|
420
|
+
$[60] = t32;
|
|
421
|
+
$[61] = t33;
|
|
422
|
+
} else t33 = $[61];
|
|
423
|
+
t29 = t33;
|
|
422
424
|
break bb0;
|
|
423
425
|
}
|
|
424
|
-
let
|
|
426
|
+
let t30;
|
|
425
427
|
if ($[62] !== itemImage) {
|
|
426
|
-
|
|
428
|
+
t30 = itemImage !== void 0 ? (item_9) => getImageUrl(item_9[itemImage]) : void 0;
|
|
427
429
|
$[62] = itemImage;
|
|
428
|
-
$[63] =
|
|
429
|
-
} else
|
|
430
|
-
let
|
|
430
|
+
$[63] = t30;
|
|
431
|
+
} else t30 = $[63];
|
|
432
|
+
let t31;
|
|
431
433
|
if ($[64] !== currentItemId) {
|
|
432
|
-
|
|
434
|
+
t31 = (item_10) => item_10.id === currentItemId;
|
|
433
435
|
$[64] = currentItemId;
|
|
434
|
-
$[65] =
|
|
435
|
-
} else
|
|
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];
|
|
436
|
+
$[65] = t31;
|
|
437
|
+
} else t31 = $[65];
|
|
442
438
|
let t32;
|
|
443
|
-
if ($[
|
|
444
|
-
t32 = (
|
|
445
|
-
$[
|
|
446
|
-
$[
|
|
447
|
-
} else t32 = $[
|
|
439
|
+
if ($[66] !== highlightedItemId) {
|
|
440
|
+
t32 = (item_11) => item_11.id === highlightedItemId;
|
|
441
|
+
$[66] = highlightedItemId;
|
|
442
|
+
$[67] = t32;
|
|
443
|
+
} else t32 = $[67];
|
|
448
444
|
let t33;
|
|
445
|
+
if ($[68] !== selection) {
|
|
446
|
+
t33 = (item_12) => isItemSelected(selection, item_12.id);
|
|
447
|
+
$[68] = selection;
|
|
448
|
+
$[69] = t33;
|
|
449
|
+
} else t33 = $[69];
|
|
450
|
+
let t34;
|
|
449
451
|
if ($[70] !== list) {
|
|
450
|
-
|
|
452
|
+
t34 = (item_13) => list.toggle(item_13.id);
|
|
451
453
|
$[70] = list;
|
|
452
|
-
$[71] =
|
|
453
|
-
} else
|
|
454
|
-
|
|
454
|
+
$[71] = t34;
|
|
455
|
+
} else t34 = $[71];
|
|
456
|
+
let t35;
|
|
457
|
+
if ($[72] !== list) {
|
|
458
|
+
t35 = (column_3) => list.toggleSort(column_3.id);
|
|
459
|
+
$[72] = list;
|
|
460
|
+
$[73] = t35;
|
|
461
|
+
} else t35 = $[73];
|
|
462
|
+
t29 = /* @__PURE__ */ jsx(Layout, {
|
|
455
463
|
items: pageItems,
|
|
456
464
|
columns,
|
|
457
465
|
renderValue,
|
|
458
466
|
getItemLabel,
|
|
459
467
|
getItemHref,
|
|
460
|
-
getItemImage:
|
|
468
|
+
getItemImage: t30,
|
|
461
469
|
calendar: inCalendar ? {
|
|
462
470
|
field: calendar.field,
|
|
463
471
|
timeZone: getCalendarTimeZone([...fields, ...allColumns.map(_temp6)].find((field_0) => field_0?.name === calendar.field)),
|
|
@@ -465,26 +473,50 @@ function ListView(t0) {
|
|
|
465
473
|
onMonthChange: (month) => list.setMonth(month),
|
|
466
474
|
more: total !== void 0 && total > pageItems.length ? { total } : cursors !== void 0 && cursors.next !== null ? { total: null } : null
|
|
467
475
|
} : void 0,
|
|
468
|
-
isCurrent:
|
|
476
|
+
isCurrent: t31,
|
|
477
|
+
isHighlighted: t32,
|
|
469
478
|
selectable,
|
|
470
|
-
isSelected:
|
|
471
|
-
onToggle:
|
|
479
|
+
isSelected: t33,
|
|
480
|
+
onToggle: t34,
|
|
472
481
|
renderActions,
|
|
473
482
|
sort,
|
|
474
|
-
onSort:
|
|
483
|
+
onSort: t35,
|
|
475
484
|
label,
|
|
476
485
|
pageSelection: pageCheckbox,
|
|
477
486
|
renderCell
|
|
478
487
|
});
|
|
479
488
|
}
|
|
480
|
-
const body =
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
489
|
+
const body = t29;
|
|
490
|
+
const highlightShown = highlightedItemId !== null && pageItems.some((item_14) => item_14.id === highlightedItemId);
|
|
491
|
+
let t30;
|
|
492
|
+
if ($[74] !== highlightShown) {
|
|
493
|
+
t30 = () => {
|
|
494
|
+
if (!highlightShown) return;
|
|
495
|
+
const element = root.current?.querySelector("[data-highlighted]");
|
|
496
|
+
const reduced = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
|
|
497
|
+
element?.scrollIntoView?.({
|
|
498
|
+
block: "nearest",
|
|
499
|
+
behavior: reduced ? "auto" : "smooth"
|
|
500
|
+
});
|
|
501
|
+
};
|
|
502
|
+
$[74] = highlightShown;
|
|
503
|
+
$[75] = t30;
|
|
504
|
+
} else t30 = $[75];
|
|
505
|
+
let t31;
|
|
506
|
+
if ($[76] !== highlightShown || $[77] !== highlightedItemId) {
|
|
507
|
+
t31 = [highlightShown, highlightedItemId];
|
|
508
|
+
$[76] = highlightShown;
|
|
509
|
+
$[77] = highlightedItemId;
|
|
510
|
+
$[78] = t31;
|
|
511
|
+
} else t31 = $[78];
|
|
512
|
+
useEffect(t30, t31);
|
|
513
|
+
let t32;
|
|
514
|
+
if ($[79] !== className) {
|
|
515
|
+
t32 = cx(ListView_module_default.list, className);
|
|
516
|
+
$[79] = className;
|
|
517
|
+
$[80] = t32;
|
|
518
|
+
} else t32 = $[80];
|
|
519
|
+
const t33 = showToolbar ? /* @__PURE__ */ jsxs("div", {
|
|
488
520
|
className: ListView_module_default.toolbar,
|
|
489
521
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
490
522
|
className: ListView_module_default.toolbarStart,
|
|
@@ -538,43 +570,43 @@ function ListView(t0) {
|
|
|
538
570
|
]
|
|
539
571
|
})]
|
|
540
572
|
}) : null;
|
|
541
|
-
let
|
|
542
|
-
let
|
|
543
|
-
if ($[
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
$[
|
|
547
|
-
$[
|
|
548
|
-
$[
|
|
573
|
+
let t34;
|
|
574
|
+
let t35;
|
|
575
|
+
if ($[81] !== list) {
|
|
576
|
+
t34 = (id_4) => list.setFilter(id_4, void 0);
|
|
577
|
+
t35 = () => list.setSearch("");
|
|
578
|
+
$[81] = list;
|
|
579
|
+
$[82] = t34;
|
|
580
|
+
$[83] = t35;
|
|
549
581
|
} else {
|
|
550
|
-
|
|
551
|
-
|
|
582
|
+
t34 = $[82];
|
|
583
|
+
t35 = $[83];
|
|
552
584
|
}
|
|
553
|
-
let
|
|
554
|
-
if ($[
|
|
555
|
-
|
|
585
|
+
let t36;
|
|
586
|
+
if ($[84] !== allColumns || $[85] !== clearFilters || $[86] !== fields || $[87] !== filterLabels.labels || $[88] !== filterValues || $[89] !== filters || $[90] !== query.q || $[91] !== t34 || $[92] !== t35) {
|
|
587
|
+
t36 = /* @__PURE__ */ jsx(FilterChips, {
|
|
556
588
|
filters,
|
|
557
589
|
values: filterValues,
|
|
558
590
|
q: query.q,
|
|
559
|
-
onRemove:
|
|
560
|
-
onClearSearch:
|
|
591
|
+
onRemove: t34,
|
|
592
|
+
onClearSearch: t35,
|
|
561
593
|
onClear: clearFilters,
|
|
562
594
|
columns: allColumns,
|
|
563
595
|
fields,
|
|
564
596
|
labels: filterLabels.labels
|
|
565
597
|
});
|
|
566
|
-
$[
|
|
567
|
-
$[
|
|
568
|
-
$[
|
|
569
|
-
$[
|
|
570
|
-
$[
|
|
571
|
-
$[
|
|
572
|
-
$[
|
|
573
|
-
$[
|
|
574
|
-
$[
|
|
575
|
-
$[
|
|
576
|
-
} else
|
|
577
|
-
const
|
|
598
|
+
$[84] = allColumns;
|
|
599
|
+
$[85] = clearFilters;
|
|
600
|
+
$[86] = fields;
|
|
601
|
+
$[87] = filterLabels.labels;
|
|
602
|
+
$[88] = filterValues;
|
|
603
|
+
$[89] = filters;
|
|
604
|
+
$[90] = query.q;
|
|
605
|
+
$[91] = t34;
|
|
606
|
+
$[92] = t35;
|
|
607
|
+
$[93] = t36;
|
|
608
|
+
} else t36 = $[93];
|
|
609
|
+
const t37 = selectedCount > 0 ? /* @__PURE__ */ jsxs("div", {
|
|
578
610
|
className: ListView_module_default.selection,
|
|
579
611
|
children: [
|
|
580
612
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -597,7 +629,7 @@ function ListView(t0) {
|
|
|
597
629
|
selectionActions.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
598
630
|
className: ListView_module_default.selectionActions,
|
|
599
631
|
children: selectionActions.map((action_10) => {
|
|
600
|
-
const skipped_0 = selectedItems.filter((
|
|
632
|
+
const skipped_0 = selectedItems.filter((item_15) => !isAllowedOn(action_10, item_15)).length;
|
|
601
633
|
return /* @__PURE__ */ jsx(ActionButton, {
|
|
602
634
|
action: action_10,
|
|
603
635
|
icons: actionIcons,
|
|
@@ -611,21 +643,21 @@ function ListView(t0) {
|
|
|
611
643
|
}) : null
|
|
612
644
|
]
|
|
613
645
|
}) : null;
|
|
614
|
-
const
|
|
615
|
-
let
|
|
616
|
-
if ($[
|
|
617
|
-
|
|
646
|
+
const t38 = isLoading && items !== void 0;
|
|
647
|
+
let t39;
|
|
648
|
+
if ($[94] !== body || $[95] !== t38) {
|
|
649
|
+
t39 = /* @__PURE__ */ jsx("div", {
|
|
618
650
|
className: ListView_module_default.body,
|
|
619
|
-
"aria-busy":
|
|
651
|
+
"aria-busy": t38,
|
|
620
652
|
children: body
|
|
621
653
|
});
|
|
622
|
-
$[
|
|
623
|
-
$[
|
|
624
|
-
$[
|
|
625
|
-
} else
|
|
626
|
-
let
|
|
627
|
-
if ($[
|
|
628
|
-
|
|
654
|
+
$[94] = body;
|
|
655
|
+
$[95] = t38;
|
|
656
|
+
$[96] = t39;
|
|
657
|
+
} else t39 = $[96];
|
|
658
|
+
let t40;
|
|
659
|
+
if ($[97] !== cursors || $[98] !== error || $[99] !== inCalendar || $[100] !== list || $[101] !== pageItems || $[102] !== perPageOptions || $[103] !== query.cursor || $[104] !== query.page || $[105] !== query.perPage || $[106] !== total) {
|
|
660
|
+
t40 = inCalendar ? null : cursors !== void 0 && error === null ? /* @__PURE__ */ jsx(CursorPagination, {
|
|
629
661
|
perPage: query.perPage ?? pageItems.length,
|
|
630
662
|
hasPrevious: query.cursor !== void 0,
|
|
631
663
|
hasNext: cursors.next !== null,
|
|
@@ -643,61 +675,62 @@ function ListView(t0) {
|
|
|
643
675
|
perPageOptions,
|
|
644
676
|
onPerPageChange: (perPage_0) => list.setPerPage(perPage_0)
|
|
645
677
|
}) : null;
|
|
646
|
-
$[
|
|
647
|
-
$[
|
|
648
|
-
$[
|
|
649
|
-
$[
|
|
650
|
-
$[
|
|
651
|
-
$[
|
|
652
|
-
$[
|
|
653
|
-
$[
|
|
654
|
-
$[
|
|
655
|
-
$[
|
|
656
|
-
$[
|
|
657
|
-
} else
|
|
658
|
-
let
|
|
659
|
-
if ($[
|
|
660
|
-
|
|
661
|
-
$[
|
|
662
|
-
$[
|
|
663
|
-
} else
|
|
664
|
-
let
|
|
665
|
-
if ($[
|
|
666
|
-
|
|
678
|
+
$[97] = cursors;
|
|
679
|
+
$[98] = error;
|
|
680
|
+
$[99] = inCalendar;
|
|
681
|
+
$[100] = list;
|
|
682
|
+
$[101] = pageItems;
|
|
683
|
+
$[102] = perPageOptions;
|
|
684
|
+
$[103] = query.cursor;
|
|
685
|
+
$[104] = query.page;
|
|
686
|
+
$[105] = query.perPage;
|
|
687
|
+
$[106] = total;
|
|
688
|
+
$[107] = t40;
|
|
689
|
+
} else t40 = $[107];
|
|
690
|
+
let t41;
|
|
691
|
+
if ($[108] !== execute) {
|
|
692
|
+
t41 = (event_1) => void execute(event_1);
|
|
693
|
+
$[108] = execute;
|
|
694
|
+
$[109] = t41;
|
|
695
|
+
} else t41 = $[109];
|
|
696
|
+
let t42;
|
|
697
|
+
if ($[110] !== closeConfirmation || $[111] !== confirming || $[112] !== preview || $[113] !== t41) {
|
|
698
|
+
t42 = /* @__PURE__ */ jsx(ConfirmDialog, {
|
|
667
699
|
event: confirming,
|
|
668
700
|
preview,
|
|
669
|
-
onConfirm:
|
|
701
|
+
onConfirm: t41,
|
|
670
702
|
onCancel: closeConfirmation
|
|
671
703
|
});
|
|
672
|
-
$[
|
|
673
|
-
$[
|
|
674
|
-
$[
|
|
675
|
-
$[
|
|
676
|
-
$[
|
|
677
|
-
} else
|
|
678
|
-
let
|
|
679
|
-
if ($[
|
|
680
|
-
|
|
681
|
-
|
|
704
|
+
$[110] = closeConfirmation;
|
|
705
|
+
$[111] = confirming;
|
|
706
|
+
$[112] = preview;
|
|
707
|
+
$[113] = t41;
|
|
708
|
+
$[114] = t42;
|
|
709
|
+
} else t42 = $[114];
|
|
710
|
+
let t43;
|
|
711
|
+
if ($[115] !== t32 || $[116] !== t33 || $[117] !== t36 || $[118] !== t37 || $[119] !== t39 || $[120] !== t40 || $[121] !== t42) {
|
|
712
|
+
t43 = /* @__PURE__ */ jsxs("div", {
|
|
713
|
+
ref: root,
|
|
714
|
+
className: t32,
|
|
682
715
|
children: [
|
|
683
|
-
t30,
|
|
684
716
|
t33,
|
|
685
|
-
t34,
|
|
686
717
|
t36,
|
|
687
718
|
t37,
|
|
688
|
-
t39
|
|
719
|
+
t39,
|
|
720
|
+
t40,
|
|
721
|
+
t42
|
|
689
722
|
]
|
|
690
723
|
});
|
|
691
|
-
$[
|
|
692
|
-
$[
|
|
693
|
-
$[
|
|
694
|
-
$[
|
|
695
|
-
$[
|
|
696
|
-
$[
|
|
697
|
-
$[
|
|
698
|
-
$[
|
|
699
|
-
} else
|
|
700
|
-
return
|
|
724
|
+
$[115] = t32;
|
|
725
|
+
$[116] = t33;
|
|
726
|
+
$[117] = t36;
|
|
727
|
+
$[118] = t37;
|
|
728
|
+
$[119] = t39;
|
|
729
|
+
$[120] = t40;
|
|
730
|
+
$[121] = t42;
|
|
731
|
+
$[122] = t43;
|
|
732
|
+
} else t43 = $[122];
|
|
733
|
+
return t43;
|
|
701
734
|
}
|
|
702
735
|
function _temp6(column_2) {
|
|
703
736
|
return column_2.field;
|