@panneau/lists 5.0.0-alpha.2 → 5.0.0-alpha.20
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/README.md +17 -15
- package/dist/ItemDetails.css +50 -0
- package/dist/ItemDetails.d.ts +27 -0
- package/dist/ItemDetails.d.ts.map +1 -0
- package/dist/ItemDetails.js +134 -0
- package/dist/ItemDetails.js.map +1 -0
- package/dist/ItemDetails.module.js +20 -0
- package/dist/ItemDetails.module.js.map +1 -0
- package/dist/List.d.ts +3 -3
- package/dist/List.d.ts.map +1 -1
- package/dist/List.js +31 -10
- package/dist/List.js.map +1 -1
- package/dist/ListSkeleton.d.ts +19 -0
- package/dist/ListSkeleton.d.ts.map +1 -0
- package/dist/ListSkeleton.js +115 -0
- package/dist/ListSkeleton.js.map +1 -0
- package/dist/ListView.d.ts +73 -8
- package/dist/ListView.d.ts.map +1 -1
- package/dist/ListView.js +616 -218
- package/dist/ListView.js.map +1 -1
- package/dist/actions/ActionButton.d.ts +8 -2
- package/dist/actions/ActionButton.d.ts.map +1 -1
- package/dist/actions/ActionButton.js +98 -26
- package/dist/actions/ActionButton.js.map +1 -1
- package/dist/actions/Actions.css +16 -38
- package/dist/actions/Actions.module.js +6 -6
- package/dist/actions/Actions.module.js.map +1 -1
- package/dist/actions/ConfirmDialog.d.ts +20 -4
- package/dist/actions/ConfirmDialog.d.ts.map +1 -1
- package/dist/actions/ConfirmDialog.js +110 -92
- package/dist/actions/ConfirmDialog.js.map +1 -1
- package/dist/actions/RowActions.d.ts +25 -9
- package/dist/actions/RowActions.d.ts.map +1 -1
- package/dist/actions/RowActions.js +151 -80
- package/dist/actions/RowActions.js.map +1 -1
- package/dist/actions/actions.d.ts +5 -4
- package/dist/actions/actions.d.ts.map +1 -1
- package/dist/actions/actions.js +7 -14
- package/dist/actions/actions.js.map +1 -1
- package/dist/actions/fit.d.ts +25 -0
- package/dist/actions/fit.d.ts.map +1 -0
- package/dist/actions/fit.js +197 -0
- package/dist/actions/fit.js.map +1 -0
- package/dist/actions/icons.d.ts +5 -0
- package/dist/actions/icons.d.ts.map +1 -1
- package/dist/actions/icons.js +15 -1
- package/dist/actions/icons.js.map +1 -1
- package/dist/columns.d.ts +10 -0
- package/dist/columns.d.ts.map +1 -0
- package/dist/columns.js +25 -0
- package/dist/columns.js.map +1 -0
- package/dist/cx.js.map +1 -1
- package/dist/displays/Displays.css +48 -0
- package/dist/displays/Displays.module.js +18 -2
- package/dist/displays/Displays.module.js.map +1 -1
- package/dist/displays/displays.d.ts +62 -6
- package/dist/displays/displays.d.ts.map +1 -1
- package/dist/displays/displays.js +1151 -89
- package/dist/displays/displays.js.map +1 -1
- package/dist/filters/Filters.css +25 -11
- package/dist/filters/Filters.d.ts +1 -1
- package/dist/filters/Filters.js.map +1 -1
- package/dist/filters/Filters.module.js +5 -1
- package/dist/filters/Filters.module.js.map +1 -1
- package/dist/filters/controls.d.ts +1 -1
- package/dist/filters/controls.d.ts.map +1 -1
- package/dist/filters/controls.js +57 -35
- package/dist/filters/controls.js.map +1 -1
- package/dist/filters/format.d.ts +1 -1
- package/dist/filters/format.js.map +1 -1
- package/dist/images.d.ts +7 -0
- package/dist/images.d.ts.map +1 -0
- package/dist/images.js +39 -0
- package/dist/images.js.map +1 -0
- package/dist/index.d.ts +22 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/inline/Inline.css +58 -0
- package/dist/inline/Inline.module.js +20 -0
- package/dist/inline/Inline.module.js.map +1 -0
- package/dist/inline/InlineCell.d.ts +29 -0
- package/dist/inline/InlineCell.d.ts.map +1 -0
- package/dist/inline/InlineCell.js +490 -0
- package/dist/inline/InlineCell.js.map +1 -0
- package/dist/inline/editable.d.ts +12 -0
- package/dist/inline/editable.d.ts.map +1 -0
- package/dist/inline/editable.js +29 -0
- package/dist/inline/editable.js.map +1 -0
- package/dist/layouts/CalendarLayout.css +153 -0
- package/dist/layouts/CalendarLayout.d.ts +9 -0
- package/dist/layouts/CalendarLayout.d.ts.map +1 -0
- package/dist/layouts/CalendarLayout.js +303 -0
- package/dist/layouts/CalendarLayout.js.map +1 -0
- package/dist/layouts/CalendarLayout.module.js +28 -0
- package/dist/layouts/CalendarLayout.module.js.map +1 -0
- package/dist/layouts/CardsLayout.css +5 -0
- package/dist/layouts/CardsLayout.d.ts +2 -2
- package/dist/layouts/CardsLayout.d.ts.map +1 -1
- package/dist/layouts/CardsLayout.js +92 -91
- package/dist/layouts/CardsLayout.js.map +1 -1
- package/dist/layouts/CardsLayout.module.js.map +1 -1
- package/dist/layouts/GalleryLayout.css +87 -0
- package/dist/layouts/GalleryLayout.d.ts +8 -0
- package/dist/layouts/GalleryLayout.d.ts.map +1 -0
- package/dist/layouts/GalleryLayout.js +152 -0
- package/dist/layouts/GalleryLayout.js.map +1 -0
- package/dist/layouts/GalleryLayout.module.js +26 -0
- package/dist/layouts/GalleryLayout.module.js.map +1 -0
- package/dist/layouts/ItemTitle.d.ts +3 -1
- package/dist/layouts/ItemTitle.d.ts.map +1 -1
- package/dist/layouts/ItemTitle.js +12 -8
- package/dist/layouts/ItemTitle.js.map +1 -1
- package/dist/layouts/TableLayout.css +56 -0
- package/dist/layouts/TableLayout.d.ts +5 -4
- package/dist/layouts/TableLayout.d.ts.map +1 -1
- package/dist/layouts/TableLayout.js +171 -101
- package/dist/layouts/TableLayout.js.map +1 -1
- package/dist/layouts/TableLayout.module.js +8 -4
- package/dist/layouts/TableLayout.module.js.map +1 -1
- package/dist/layouts/builtIn.d.ts +2 -2
- package/dist/layouts/builtIn.d.ts.map +1 -1
- package/dist/layouts/builtIn.js +6 -2
- package/dist/layouts/builtIn.js.map +1 -1
- package/dist/layouts/calendarDays.d.ts +14 -0
- package/dist/layouts/calendarDays.d.ts.map +1 -0
- package/dist/layouts/calendarDays.js +44 -0
- package/dist/layouts/calendarDays.js.map +1 -0
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.js.map +1 -1
- package/dist/query.d.ts +4 -3
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +15 -4
- package/dist/query.js.map +1 -1
- package/dist/selection.d.ts +1 -1
- package/dist/selection.js.map +1 -1
- package/dist/toolbar/ColumnMenu.d.ts +17 -0
- package/dist/toolbar/ColumnMenu.d.ts.map +1 -0
- package/dist/toolbar/ColumnMenu.js +193 -0
- package/dist/toolbar/ColumnMenu.js.map +1 -0
- package/dist/toolbar/LayoutSwitch.d.ts.map +1 -1
- package/dist/toolbar/LayoutSwitch.js +73 -55
- package/dist/toolbar/LayoutSwitch.js.map +1 -1
- package/dist/toolbar/Pagination.d.ts +33 -0
- package/dist/toolbar/Pagination.d.ts.map +1 -1
- package/dist/toolbar/Pagination.js +282 -42
- package/dist/toolbar/Pagination.js.map +1 -1
- package/dist/toolbar/SearchField.js.map +1 -1
- package/dist/toolbar/SortSelect.d.ts +1 -1
- package/dist/toolbar/SortSelect.js.map +1 -1
- package/dist/toolbar/Toolbar.css +36 -0
- package/dist/toolbar/Toolbar.module.js +12 -2
- package/dist/toolbar/Toolbar.module.js.map +1 -1
- package/dist/types.d.ts +69 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/useDraft.js.map +1 -1
- package/dist/useListState.js.map +1 -1
- package/dist/useRenderValue.d.ts +10 -0
- package/dist/useRenderValue.d.ts.map +1 -0
- package/dist/useRenderValue.js +84 -0
- package/dist/useRenderValue.js.map +1 -0
- package/dist/values.d.ts +4 -1
- package/dist/values.d.ts.map +1 -1
- package/dist/values.js +6 -2
- package/dist/values.js.map +1 -1
- package/package.json +9 -9
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { messages } from "../messages.js";
|
|
2
2
|
import Actions_module_default from "./Actions.module.js";
|
|
3
|
+
import { asksConfirmation } from "@panneau/core";
|
|
3
4
|
import { c } from "react/compiler-runtime";
|
|
4
|
-
import {
|
|
5
|
+
import { getActionLabel } from "@panneau/intl";
|
|
6
|
+
import { Button, Dialog, Spinner, usePanneauIntl } from "@panneau/ui";
|
|
5
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
8
|
//#region src/actions/ConfirmDialog.tsx
|
|
7
9
|
/** Formats an ICU message of the definition (`{count, plural, …}`) in the locale. */
|
|
@@ -12,23 +14,30 @@ function formatDefinitionMessage(intl, message, values) {
|
|
|
12
14
|
return message;
|
|
13
15
|
}
|
|
14
16
|
}
|
|
15
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Whether an action needs a confirmation: it asks for one, or it is undoable but runs on more items
|
|
19
|
+
* than an undo can put back (`asksConfirmation()`, decision 0063), or some selected items are
|
|
20
|
+
* skipped.
|
|
21
|
+
*/
|
|
16
22
|
function needsConfirmation(event) {
|
|
17
|
-
|
|
18
|
-
return confirm !== void 0 && confirm !== false || event.skipped.length > 0;
|
|
23
|
+
return asksConfirmation(event.action, event.count) || event.skipped.length > 0;
|
|
19
24
|
}
|
|
20
25
|
/**
|
|
21
26
|
* Asks before running an action (decision 0017): the action's `confirm` title and message (an ICU
|
|
22
|
-
* message with `{count}`), or default ones, and how many selected items will be skipped
|
|
27
|
+
* message with `{count}`), or default ones, and how many selected items will be skipped: those of
|
|
28
|
+
* the current page that don't allow it, or the backend's count for every item matching a query.
|
|
23
29
|
*/
|
|
24
30
|
function ConfirmDialog(t0) {
|
|
25
31
|
const $ = c(40);
|
|
26
|
-
const { event, onConfirm, onCancel } = t0;
|
|
32
|
+
const { event, preview: t1, onConfirm, onCancel } = t0;
|
|
33
|
+
const preview = t1 === void 0 ? null : t1;
|
|
27
34
|
const intl = usePanneauIntl();
|
|
28
35
|
if (event === null) return null;
|
|
29
|
-
const { action, count
|
|
36
|
+
const { action, count } = event;
|
|
37
|
+
const loading = preview?.status === "loading";
|
|
38
|
+
const skipped = preview?.status === "done" ? preview.skipped : event.skipped.length;
|
|
30
39
|
let T0;
|
|
31
|
-
let
|
|
40
|
+
let t10;
|
|
32
41
|
let t2;
|
|
33
42
|
let t3;
|
|
34
43
|
let t4;
|
|
@@ -37,119 +46,128 @@ function ConfirmDialog(t0) {
|
|
|
37
46
|
let t7;
|
|
38
47
|
let t8;
|
|
39
48
|
let t9;
|
|
40
|
-
if ($[0] !== action
|
|
49
|
+
if ($[0] !== action || $[1] !== count || $[2] !== event || $[3] !== intl || $[4] !== loading || $[5] !== onCancel || $[6] !== onConfirm) {
|
|
41
50
|
const confirm = typeof action.confirm === "object" ? action.confirm : {};
|
|
51
|
+
const label = getActionLabel(action, intl);
|
|
42
52
|
const values = {
|
|
43
53
|
count,
|
|
44
|
-
action:
|
|
54
|
+
action: label
|
|
45
55
|
};
|
|
46
56
|
T0 = Dialog;
|
|
47
|
-
|
|
48
|
-
if ($[
|
|
49
|
-
|
|
57
|
+
t4 = true;
|
|
58
|
+
if ($[17] !== onCancel) {
|
|
59
|
+
t5 = (open) => {
|
|
50
60
|
if (!open) onCancel();
|
|
51
61
|
};
|
|
52
|
-
$[
|
|
53
|
-
$[
|
|
54
|
-
} else
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
let
|
|
60
|
-
if ($[
|
|
61
|
-
|
|
62
|
-
$[
|
|
63
|
-
$[
|
|
64
|
-
$[
|
|
65
|
-
} else
|
|
66
|
-
|
|
62
|
+
$[17] = onCancel;
|
|
63
|
+
$[18] = t5;
|
|
64
|
+
} else t5 = $[18];
|
|
65
|
+
t6 = "alertdialog";
|
|
66
|
+
t7 = false;
|
|
67
|
+
t8 = "sm";
|
|
68
|
+
t9 = confirm.title !== void 0 ? formatDefinitionMessage(intl, confirm.title, values) : intl.formatMessage(messages.confirmTitle, { action: label });
|
|
69
|
+
let t11;
|
|
70
|
+
if ($[19] !== event || $[20] !== onConfirm) {
|
|
71
|
+
t11 = () => onConfirm(event);
|
|
72
|
+
$[19] = event;
|
|
73
|
+
$[20] = onConfirm;
|
|
74
|
+
$[21] = t11;
|
|
75
|
+
} else t11 = $[21];
|
|
76
|
+
t10 = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Button, {
|
|
67
77
|
variant: "ghost",
|
|
68
78
|
onPress: onCancel,
|
|
69
79
|
children: confirm.cancelLabel ?? intl.formatMessage(messages.cancel)
|
|
70
80
|
}), /* @__PURE__ */ jsx(Button, {
|
|
71
81
|
variant: action.destructive === true ? "danger" : "primary",
|
|
72
82
|
autoFocus: true,
|
|
73
|
-
|
|
74
|
-
|
|
83
|
+
isDisabled: loading,
|
|
84
|
+
onPress: t11,
|
|
85
|
+
children: confirm.confirmLabel ?? label
|
|
75
86
|
})] });
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
$[0] = action
|
|
79
|
-
$[1] =
|
|
80
|
-
$[2] =
|
|
81
|
-
$[3] =
|
|
82
|
-
$[4] =
|
|
83
|
-
$[5] =
|
|
84
|
-
$[6] =
|
|
85
|
-
$[7] =
|
|
86
|
-
$[8] =
|
|
87
|
-
$[9] =
|
|
88
|
-
$[10] =
|
|
89
|
-
$[11] =
|
|
90
|
-
$[12] =
|
|
91
|
-
$[13] =
|
|
92
|
-
$[14] =
|
|
93
|
-
$[15] =
|
|
94
|
-
$[16] =
|
|
95
|
-
$[17] = t9;
|
|
87
|
+
t2 = Actions_module_default.message;
|
|
88
|
+
t3 = confirm.message !== void 0 ? formatDefinitionMessage(intl, confirm.message, values) : intl.formatMessage(messages.confirmMessage, values);
|
|
89
|
+
$[0] = action;
|
|
90
|
+
$[1] = count;
|
|
91
|
+
$[2] = event;
|
|
92
|
+
$[3] = intl;
|
|
93
|
+
$[4] = loading;
|
|
94
|
+
$[5] = onCancel;
|
|
95
|
+
$[6] = onConfirm;
|
|
96
|
+
$[7] = T0;
|
|
97
|
+
$[8] = t10;
|
|
98
|
+
$[9] = t2;
|
|
99
|
+
$[10] = t3;
|
|
100
|
+
$[11] = t4;
|
|
101
|
+
$[12] = t5;
|
|
102
|
+
$[13] = t6;
|
|
103
|
+
$[14] = t7;
|
|
104
|
+
$[15] = t8;
|
|
105
|
+
$[16] = t9;
|
|
96
106
|
} else {
|
|
97
|
-
T0 = $[
|
|
98
|
-
|
|
99
|
-
t2 = $[
|
|
100
|
-
t3 = $[
|
|
101
|
-
t4 = $[
|
|
102
|
-
t5 = $[
|
|
103
|
-
t6 = $[
|
|
104
|
-
t7 = $[
|
|
105
|
-
t8 = $[
|
|
106
|
-
t9 = $[
|
|
107
|
+
T0 = $[7];
|
|
108
|
+
t10 = $[8];
|
|
109
|
+
t2 = $[9];
|
|
110
|
+
t3 = $[10];
|
|
111
|
+
t4 = $[11];
|
|
112
|
+
t5 = $[12];
|
|
113
|
+
t6 = $[13];
|
|
114
|
+
t7 = $[14];
|
|
115
|
+
t8 = $[15];
|
|
116
|
+
t9 = $[16];
|
|
107
117
|
}
|
|
108
|
-
let t10;
|
|
109
|
-
if ($[23] !== t1 || $[24] !== t2) {
|
|
110
|
-
t10 = /* @__PURE__ */ jsx("p", {
|
|
111
|
-
className: t1,
|
|
112
|
-
children: t2
|
|
113
|
-
});
|
|
114
|
-
$[23] = t1;
|
|
115
|
-
$[24] = t2;
|
|
116
|
-
$[25] = t10;
|
|
117
|
-
} else t10 = $[25];
|
|
118
118
|
let t11;
|
|
119
|
-
if ($[
|
|
120
|
-
t11 =
|
|
119
|
+
if ($[22] !== t2 || $[23] !== t3) {
|
|
120
|
+
t11 = /* @__PURE__ */ jsx("p", {
|
|
121
|
+
className: t2,
|
|
122
|
+
children: t3
|
|
123
|
+
});
|
|
124
|
+
$[22] = t2;
|
|
125
|
+
$[23] = t3;
|
|
126
|
+
$[24] = t11;
|
|
127
|
+
} else t11 = $[24];
|
|
128
|
+
let t12;
|
|
129
|
+
if ($[25] !== intl || $[26] !== loading || $[27] !== skipped) {
|
|
130
|
+
t12 = loading ? /* @__PURE__ */ jsx("div", {
|
|
121
131
|
className: Actions_module_default.skipped,
|
|
122
|
-
children:
|
|
132
|
+
children: /* @__PURE__ */ jsx(Spinner, {
|
|
133
|
+
size: "sm",
|
|
134
|
+
label: intl.formatMessage(messages.confirmChecking),
|
|
135
|
+
showLabel: true
|
|
136
|
+
})
|
|
137
|
+
}) : skipped > 0 ? /* @__PURE__ */ jsx("p", {
|
|
138
|
+
className: Actions_module_default.skipped,
|
|
139
|
+
children: intl.formatMessage(messages.confirmSkipped, { count: skipped })
|
|
123
140
|
}) : null;
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
141
|
+
$[25] = intl;
|
|
142
|
+
$[26] = loading;
|
|
143
|
+
$[27] = skipped;
|
|
144
|
+
$[28] = t12;
|
|
145
|
+
} else t12 = $[28];
|
|
146
|
+
let t13;
|
|
147
|
+
if ($[29] !== T0 || $[30] !== t10 || $[31] !== t11 || $[32] !== t12 || $[33] !== t4 || $[34] !== t5 || $[35] !== t6 || $[36] !== t7 || $[37] !== t8 || $[38] !== t9) {
|
|
148
|
+
t13 = /* @__PURE__ */ jsxs(T0, {
|
|
149
|
+
isOpen: t4,
|
|
150
|
+
onOpenChange: t5,
|
|
151
|
+
role: t6,
|
|
152
|
+
isDismissable: t7,
|
|
153
|
+
size: t8,
|
|
154
|
+
title: t9,
|
|
155
|
+
footer: t10,
|
|
156
|
+
children: [t11, t12]
|
|
139
157
|
});
|
|
140
158
|
$[29] = T0;
|
|
141
159
|
$[30] = t10;
|
|
142
160
|
$[31] = t11;
|
|
143
|
-
$[32] =
|
|
161
|
+
$[32] = t12;
|
|
144
162
|
$[33] = t4;
|
|
145
163
|
$[34] = t5;
|
|
146
164
|
$[35] = t6;
|
|
147
165
|
$[36] = t7;
|
|
148
166
|
$[37] = t8;
|
|
149
167
|
$[38] = t9;
|
|
150
|
-
$[39] =
|
|
151
|
-
} else
|
|
152
|
-
return
|
|
168
|
+
$[39] = t13;
|
|
169
|
+
} else t13 = $[39];
|
|
170
|
+
return t13;
|
|
153
171
|
}
|
|
154
172
|
//#endregion
|
|
155
173
|
export { ConfirmDialog, needsConfirmation };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmDialog.js","names":["onCancel","_c","_Fragment","styles"],"sources":["../../src/actions/ConfirmDialog.tsx"],"sourcesContent":["import type { IntlShape } from 'react-intl';\n\nimport { Button, Dialog, usePanneauIntl } from '@panneau/ui';\n\nimport { messages } from '../messages';\nimport type { ListActionEvent } from '../types';\nimport styles from './Actions.module.css';\n\n/** Formats an ICU message of the definition (`{count, plural, …}`) in the locale. */\nfunction formatDefinitionMessage(\n intl: IntlShape,\n message: string,\n values: Record<string, unknown>,\n) {\n try {\n return String(\n intl.formatters\n .getMessageFormat(message, intl.locale)\n .format(values as Record<string, string | number>),\n );\n } catch {\n return message;\n }\n}\n\n
|
|
1
|
+
{"version":3,"file":"ConfirmDialog.js","names":["IntlShape","asksConfirmation","getActionLabel","Button","Dialog","Spinner","usePanneauIntl","messages","ListActionEvent","ListActionPreview","styles","formatDefinitionMessage","intl","message","values","Record","String","formatters","getMessageFormat","locale","format","needsConfirmation","event","action","count","skipped","length","ConfirmPreview","status","ConfirmDialogProps","preview","onConfirm","onCancel","ConfirmDialog","t0","$","_c","t1","undefined","loading","T0","t10","t2","t3","t4","t5","t6","t7","t8","t9","confirm","label","open","title","formatMessage","confirmTitle","t11","cancelLabel","cancel","destructive","confirmLabel","confirmMessage","t12","confirmChecking","confirmSkipped","t13","_c","_Fragment","styles"],"sources":["../../src/actions/ConfirmDialog.tsx"],"sourcesContent":["import type { IntlShape } from 'react-intl';\n\nimport { asksConfirmation } from '@panneau/core';\nimport { getActionLabel } from '@panneau/intl';\nimport { Button, Dialog, Spinner, usePanneauIntl } from '@panneau/ui';\n\nimport { messages } from '../messages';\nimport type { ListActionEvent, ListActionPreview } from '../types';\nimport styles from './Actions.module.css';\n\n/** Formats an ICU message of the definition (`{count, plural, …}`) in the locale. */\nfunction formatDefinitionMessage(\n intl: IntlShape,\n message: string,\n values: Record<string, unknown>,\n) {\n try {\n return String(\n intl.formatters\n .getMessageFormat(message, intl.locale)\n .format(values as Record<string, string | number>),\n );\n } catch {\n return message;\n }\n}\n\n/**\n * Whether an action needs a confirmation: it asks for one, or it is undoable but runs on more items\n * than an undo can put back (`asksConfirmation()`, decision 0063), or some selected items are\n * skipped.\n */\nexport function needsConfirmation(event: ListActionEvent): boolean {\n return asksConfirmation(event.action, event.count) || event.skipped.length > 0;\n}\n\n/** The dry run of a query selection: in progress, or done with the backend's count. */\nexport type ConfirmPreview = { status: 'loading' } | ({ status: 'done' } & ListActionPreview);\n\nexport interface ConfirmDialogProps {\n /** The action to confirm, or `null` when the dialog is closed. */\n event: ListActionEvent | null;\n /**\n * What the backend told about a query selection. Its count of skipped items replaces the\n * count of the current page; while it loads, the dialog says so and can't be confirmed.\n */\n preview?: ConfirmPreview | null;\n onConfirm: (event: ListActionEvent) => void;\n onCancel: () => void;\n}\n\n/**\n * Asks before running an action (decision 0017): the action's `confirm` title and message (an ICU\n * message with `{count}`), or default ones, and how many selected items will be skipped: those of\n * the current page that don't allow it, or the backend's count for every item matching a query.\n */\nexport function ConfirmDialog({ event, preview = null, onConfirm, onCancel }: ConfirmDialogProps) {\n const intl = usePanneauIntl();\n if (event === null) {\n return null;\n }\n const { action, count } = event;\n const loading = preview?.status === 'loading';\n const skipped = preview?.status === 'done' ? preview.skipped : event.skipped.length;\n const confirm = typeof action.confirm === 'object' ? action.confirm : {};\n const label = getActionLabel(action, intl);\n const values = { count, action: label };\n return (\n <Dialog\n isOpen\n onOpenChange={(open) => {\n if (!open) {\n onCancel();\n }\n }}\n role=\"alertdialog\"\n isDismissable={false}\n size=\"sm\"\n title={\n confirm.title !== undefined\n ? formatDefinitionMessage(intl, confirm.title, values)\n : intl.formatMessage(messages.confirmTitle, { action: label })\n }\n footer={\n <>\n <Button variant=\"ghost\" onPress={onCancel}>\n {confirm.cancelLabel ?? intl.formatMessage(messages.cancel)}\n </Button>\n <Button\n variant={action.destructive === true ? 'danger' : 'primary'}\n autoFocus\n isDisabled={loading}\n onPress={() => onConfirm(event)}\n >\n {confirm.confirmLabel ?? label}\n </Button>\n </>\n }\n >\n <p className={styles.message}>\n {confirm.message !== undefined\n ? formatDefinitionMessage(intl, confirm.message, values)\n : intl.formatMessage(messages.confirmMessage, values)}\n </p>\n {loading ? (\n <div className={styles.skipped}>\n <Spinner\n size=\"sm\"\n label={intl.formatMessage(messages.confirmChecking)}\n showLabel\n />\n </div>\n ) : skipped > 0 ? (\n <p className={styles.skipped}>\n {intl.formatMessage(messages.confirmSkipped, { count: skipped })}\n </p>\n ) : null}\n </Dialog>\n );\n}\n"],"mappings":"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"}
|
|
@@ -1,20 +1,36 @@
|
|
|
1
|
+
import type { ItemAction } from '@panneau/core';
|
|
1
2
|
import type { Action } from '@panneau/protocol';
|
|
2
|
-
import type
|
|
3
|
-
import { type ActionIcons } from './icons';
|
|
3
|
+
import { type ActionIcons } from './icons.js';
|
|
4
4
|
export interface RowActionsProps {
|
|
5
|
-
item: ListItem;
|
|
6
5
|
/** The label of the item, for the accessible names of its actions. */
|
|
7
6
|
itemLabel: string;
|
|
8
|
-
/** Actions
|
|
9
|
-
actions: readonly
|
|
10
|
-
/** Actions in the
|
|
11
|
-
menu: readonly
|
|
7
|
+
/** Actions placed in `row`, with their links (`selectItemActions()` of `@panneau/core`). */
|
|
8
|
+
actions: readonly ItemAction[];
|
|
9
|
+
/** Actions placed in `menu`: icons too while they fit, the first to go in the menu. */
|
|
10
|
+
menu: readonly ItemAction[];
|
|
12
11
|
/** Id of the action that is running on this item, if any. */
|
|
13
12
|
pending: string | null;
|
|
14
13
|
onRun: (action: Action) => void;
|
|
15
14
|
/** Icons of actions by id, over the icon the action names. */
|
|
16
15
|
icons?: ActionIcons | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* The actions of every row of the list, in order (`orderRowActions()`): a row keeps the place
|
|
18
|
+
* of those it doesn't have, so the actions of the rows line up. Without it, its own.
|
|
19
|
+
*/
|
|
20
|
+
slots?: readonly ItemAction[] | undefined;
|
|
21
|
+
/** The id of the main action of rows, which keeps its label (`show` or `edit`). */
|
|
22
|
+
primary?: string | null | undefined;
|
|
17
23
|
}
|
|
18
|
-
/**
|
|
19
|
-
|
|
24
|
+
/**
|
|
25
|
+
* The actions of a row in their order: those placed in `row`, then those placed in `menu`, and
|
|
26
|
+
* those that destroy last. The last ones are the first to go in the menu.
|
|
27
|
+
*/
|
|
28
|
+
export declare function orderRowActions(actions: readonly ItemAction[], menu: readonly ItemAction[]): ItemAction[];
|
|
29
|
+
/**
|
|
30
|
+
* The actions of a row (decision 0060): their icons, in their colors, with their labels as names
|
|
31
|
+
* and tooltips, but the main action, which keeps its label while the row has room; and when the
|
|
32
|
+
* icons don't fit, the last ones in an overflow menu, which never holds a single action. How they fit is the same for every row of the list (`RowActionsFit`), and a
|
|
33
|
+
* row keeps the place of the actions of other rows that it doesn't have, so they line up.
|
|
34
|
+
*/
|
|
35
|
+
export declare function RowActions({ itemLabel, actions, menu, pending, onRun, icons, slots, primary, }: RowActionsProps): import("react").JSX.Element;
|
|
20
36
|
//# sourceMappingURL=RowActions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RowActions.d.ts","sourceRoot":"","sources":["../../src/actions/RowActions.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RowActions.d.ts","sourceRoot":"","sources":["../../src/actions/RowActions.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAOhD,OAAO,EAAE,KAAK,WAAW,EAAiB,MAAM,SAAS,CAAC;AAE1D,MAAM,WAAW,eAAe;IAC5B,sEAAsE;IACtE,SAAS,EAAE,MAAM,CAAC;IAClB,4FAA4F;IAC5F,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;IAC/B,uFAAuF;IACvF,IAAI,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5B,6DAA6D;IAC7D,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,8DAA8D;IAC9D,KAAK,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAChC;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,UAAU,EAAE,GAAG,SAAS,CAAC;IAC1C,mFAAmF;IACnF,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACvC;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC3B,OAAO,EAAE,SAAS,UAAU,EAAE,EAC9B,IAAI,EAAE,SAAS,UAAU,EAAE,GAC5B,UAAU,EAAE,CASd;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EACvB,SAAS,EACT,OAAO,EACP,IAAI,EACJ,OAAO,EACP,KAAK,EACL,KAAK,EACL,KAAK,EACL,OAAc,GACjB,EAAE,eAAe,+BA0FjB"}
|
|
@@ -1,99 +1,170 @@
|
|
|
1
|
-
import { getActionHref } from "./actions.js";
|
|
2
1
|
import { messages } from "../messages.js";
|
|
3
2
|
import Actions_module_default from "./Actions.module.js";
|
|
4
3
|
import { getActionIcon } from "./icons.js";
|
|
4
|
+
import { RowActionsFit } from "./fit.js";
|
|
5
5
|
import { ActionButton } from "./ActionButton.js";
|
|
6
6
|
import { c } from "react/compiler-runtime";
|
|
7
|
+
import { getActionLabel } from "@panneau/intl";
|
|
7
8
|
import { IconButton, Menu, MenuItem, MenuTrigger, usePanneauIntl } from "@panneau/ui";
|
|
8
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
import { Ellipsis } from "lucide-react";
|
|
11
|
+
import { use } from "react";
|
|
10
12
|
//#region src/actions/RowActions.tsx
|
|
11
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The actions of a row in their order: those placed in `row`, then those placed in `menu`, and
|
|
15
|
+
* those that destroy last. The last ones are the first to go in the menu.
|
|
16
|
+
*/
|
|
17
|
+
function orderRowActions(actions, menu) {
|
|
18
|
+
const all = [...actions, ...menu].filter((entry, index, list) => list.findIndex((other) => other.action.id === entry.action.id) === index);
|
|
19
|
+
return [...all.filter(({ action }) => action.destructive !== true), ...all.filter(({ action }) => action.destructive === true)];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The actions of a row (decision 0060): their icons, in their colors, with their labels as names
|
|
23
|
+
* and tooltips, but the main action, which keeps its label while the row has room; and when the
|
|
24
|
+
* icons don't fit, the last ones in an overflow menu, which never holds a single action. How they fit is the same for every row of the list (`RowActionsFit`), and a
|
|
25
|
+
* row keeps the place of the actions of other rows that it doesn't have, so they line up.
|
|
26
|
+
*/
|
|
12
27
|
function RowActions(t0) {
|
|
13
|
-
const $ = c(
|
|
14
|
-
const {
|
|
28
|
+
const $ = c(30);
|
|
29
|
+
const { itemLabel, actions, menu, pending, onRun, icons, slots, primary: t1 } = t0;
|
|
30
|
+
const primary = t1 === void 0 ? null : t1;
|
|
15
31
|
const intl = usePanneauIntl();
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
32
|
+
const level = use(RowActionsFit);
|
|
33
|
+
let t2;
|
|
34
|
+
if ($[0] !== actions || $[1] !== icons || $[2] !== intl || $[3] !== itemLabel || $[4] !== level || $[5] !== menu || $[6] !== onRun || $[7] !== pending || $[8] !== primary || $[9] !== slots) {
|
|
35
|
+
const own = orderRowActions(actions, menu);
|
|
36
|
+
let t3;
|
|
37
|
+
if ($[11] !== slots) {
|
|
38
|
+
t3 = (t4) => {
|
|
39
|
+
const { action } = t4;
|
|
40
|
+
return slots?.some((slot) => slot.action.id === action.id) !== true;
|
|
41
|
+
};
|
|
42
|
+
$[11] = slots;
|
|
43
|
+
$[12] = t3;
|
|
44
|
+
} else t3 = $[12];
|
|
45
|
+
const all = [...slots ?? [], ...own.filter(t3)];
|
|
46
|
+
const find = (slot_0) => own.find((t4) => {
|
|
47
|
+
const { action: action_0 } = t4;
|
|
48
|
+
return action_0.id === slot_0.action.id;
|
|
49
|
+
});
|
|
50
|
+
const inMenu = level >= 2 && all.length >= 2 ? Math.min(level, all.length) : 0;
|
|
51
|
+
const shown = all.slice(0, all.length - inMenu);
|
|
52
|
+
const overflow = all.slice(all.length - inMenu).flatMap((slot_1) => find(slot_1) ?? []);
|
|
53
|
+
let t5;
|
|
54
|
+
if ($[13] !== intl || $[14] !== itemLabel) {
|
|
55
|
+
t5 = (action_1) => intl.formatMessage(messages.actionOnItem, {
|
|
56
|
+
action: getActionLabel(action_1, intl),
|
|
57
|
+
item: itemLabel
|
|
58
|
+
});
|
|
59
|
+
$[13] = intl;
|
|
60
|
+
$[14] = itemLabel;
|
|
61
|
+
$[15] = t5;
|
|
62
|
+
} else t5 = $[15];
|
|
63
|
+
const name = t5;
|
|
64
|
+
let t6;
|
|
65
|
+
if ($[16] !== icons || $[17] !== level || $[18] !== name || $[19] !== onRun || $[20] !== pending || $[21] !== primary) {
|
|
66
|
+
t6 = (entry) => /* @__PURE__ */ jsx(ActionButton, {
|
|
67
|
+
action: entry.action,
|
|
22
68
|
icons,
|
|
23
|
-
href:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
$[
|
|
33
|
-
$[
|
|
34
|
-
$[
|
|
35
|
-
$[
|
|
36
|
-
$[
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
69
|
+
href: entry.href,
|
|
70
|
+
iconOnly: level >= 1 || entry.action.id !== primary,
|
|
71
|
+
isPending: pending === entry.action.id,
|
|
72
|
+
isDisabled: pending !== null && pending !== entry.action.id,
|
|
73
|
+
"aria-label": name(entry.action),
|
|
74
|
+
onPress: () => onRun(entry.action)
|
|
75
|
+
}, entry.action.id);
|
|
76
|
+
$[16] = icons;
|
|
77
|
+
$[17] = level;
|
|
78
|
+
$[18] = name;
|
|
79
|
+
$[19] = onRun;
|
|
80
|
+
$[20] = pending;
|
|
81
|
+
$[21] = primary;
|
|
82
|
+
$[22] = t6;
|
|
83
|
+
} else t6 = $[22];
|
|
84
|
+
const button = t6;
|
|
85
|
+
const placeholder = _temp;
|
|
86
|
+
let t7;
|
|
87
|
+
if ($[23] !== intl || $[24] !== itemLabel) {
|
|
88
|
+
t7 = intl.formatMessage(messages.itemActions, { item: itemLabel });
|
|
89
|
+
$[23] = intl;
|
|
90
|
+
$[24] = itemLabel;
|
|
91
|
+
$[25] = t7;
|
|
92
|
+
} else t7 = $[25];
|
|
93
|
+
const t8 = overflow.length >= 2;
|
|
94
|
+
const t9 = pending !== null && overflow.some((t10) => {
|
|
95
|
+
const { action: action_2 } = t10;
|
|
96
|
+
return action_2.id === pending;
|
|
97
|
+
});
|
|
98
|
+
let t11;
|
|
99
|
+
if ($[26] !== t7 || $[27] !== t8 || $[28] !== t9) {
|
|
100
|
+
t11 = /* @__PURE__ */ jsx(IconButton, {
|
|
101
|
+
icon: Ellipsis,
|
|
102
|
+
size: "sm",
|
|
103
|
+
appearance: "subtle",
|
|
104
|
+
label: t7,
|
|
105
|
+
showTooltip: t8,
|
|
106
|
+
isPending: t9
|
|
107
|
+
});
|
|
108
|
+
$[26] = t7;
|
|
109
|
+
$[27] = t8;
|
|
110
|
+
$[28] = t9;
|
|
111
|
+
$[29] = t11;
|
|
112
|
+
} else t11 = $[29];
|
|
113
|
+
const menuButton = t11;
|
|
114
|
+
t2 = /* @__PURE__ */ jsxs("div", {
|
|
115
|
+
className: Actions_module_default.row,
|
|
116
|
+
"data-row-actions": all.length,
|
|
117
|
+
children: [shown.map((slot_2) => {
|
|
118
|
+
const entry_0 = find(slot_2);
|
|
119
|
+
return entry_0 !== void 0 ? button(entry_0) : placeholder(slot_2.action.id, button({
|
|
120
|
+
...slot_2,
|
|
121
|
+
href: null
|
|
122
|
+
}));
|
|
123
|
+
}), overflow.length >= 2 ? /* @__PURE__ */ jsxs(MenuTrigger, { children: [menuButton, /* @__PURE__ */ jsx(Menu, {
|
|
124
|
+
placement: "bottom end",
|
|
125
|
+
onAction: (key_0) => {
|
|
126
|
+
const entry_1 = overflow.find((t12) => {
|
|
127
|
+
const { action: action_3 } = t12;
|
|
128
|
+
return action_3.id === key_0;
|
|
129
|
+
});
|
|
130
|
+
if (entry_1 !== void 0 && entry_1.href === null) onRun(entry_1.action);
|
|
131
|
+
},
|
|
132
|
+
children: overflow.map((t13) => {
|
|
133
|
+
const { action: action_4, href } = t13;
|
|
134
|
+
const icon = getActionIcon(action_4, icons);
|
|
135
|
+
return /* @__PURE__ */ jsx(MenuItem, {
|
|
136
|
+
id: action_4.id,
|
|
137
|
+
isDanger: action_4.destructive === true,
|
|
138
|
+
...icon !== void 0 ? { icon } : {},
|
|
139
|
+
...href !== null ? { href } : {},
|
|
140
|
+
children: getActionLabel(action_4, intl)
|
|
141
|
+
}, action_4.id);
|
|
142
|
+
})
|
|
143
|
+
})] }) : overflow.length === 1 && overflow[0] !== void 0 ? button(overflow[0]) : inMenu > 0 ? placeholder("menu", menuButton) : null]
|
|
144
|
+
});
|
|
41
145
|
$[0] = actions;
|
|
42
146
|
$[1] = icons;
|
|
43
147
|
$[2] = intl;
|
|
44
|
-
$[3] =
|
|
45
|
-
$[4] =
|
|
46
|
-
$[5] =
|
|
47
|
-
$[6] =
|
|
48
|
-
$[7] =
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
},
|
|
63
|
-
children: menu.map((action_2) => {
|
|
64
|
-
const href = getActionHref(action_2, item);
|
|
65
|
-
const icon = getActionIcon(action_2, icons);
|
|
66
|
-
return /* @__PURE__ */ jsx(MenuItem, {
|
|
67
|
-
id: action_2.id,
|
|
68
|
-
isDanger: action_2.destructive === true,
|
|
69
|
-
...icon !== void 0 ? { icon } : {},
|
|
70
|
-
...href !== null ? { href } : {},
|
|
71
|
-
children: action_2.label
|
|
72
|
-
}, action_2.id);
|
|
73
|
-
})
|
|
74
|
-
})] }) : null;
|
|
75
|
-
$[15] = icons;
|
|
76
|
-
$[16] = intl;
|
|
77
|
-
$[17] = item;
|
|
78
|
-
$[18] = itemLabel;
|
|
79
|
-
$[19] = menu;
|
|
80
|
-
$[20] = onRun;
|
|
81
|
-
$[21] = pending;
|
|
82
|
-
$[22] = t2;
|
|
83
|
-
} else t2 = $[22];
|
|
84
|
-
let t3;
|
|
85
|
-
if ($[23] !== t1 || $[24] !== t2) {
|
|
86
|
-
t3 = /* @__PURE__ */ jsxs("div", {
|
|
87
|
-
className: Actions_module_default.row,
|
|
88
|
-
children: [t1, t2]
|
|
89
|
-
});
|
|
90
|
-
$[23] = t1;
|
|
91
|
-
$[24] = t2;
|
|
92
|
-
$[25] = t3;
|
|
93
|
-
} else t3 = $[25];
|
|
94
|
-
return t3;
|
|
148
|
+
$[3] = itemLabel;
|
|
149
|
+
$[4] = level;
|
|
150
|
+
$[5] = menu;
|
|
151
|
+
$[6] = onRun;
|
|
152
|
+
$[7] = pending;
|
|
153
|
+
$[8] = primary;
|
|
154
|
+
$[9] = slots;
|
|
155
|
+
$[10] = t2;
|
|
156
|
+
} else t2 = $[10];
|
|
157
|
+
return t2;
|
|
158
|
+
}
|
|
159
|
+
function _temp(key, content) {
|
|
160
|
+
return /* @__PURE__ */ jsx("span", {
|
|
161
|
+
className: Actions_module_default.placeholder,
|
|
162
|
+
"aria-hidden": "true",
|
|
163
|
+
inert: true,
|
|
164
|
+
children: content
|
|
165
|
+
}, key);
|
|
95
166
|
}
|
|
96
167
|
//#endregion
|
|
97
|
-
export { RowActions };
|
|
168
|
+
export { RowActions, orderRowActions };
|
|
98
169
|
|
|
99
170
|
//# sourceMappingURL=RowActions.js.map
|