@panneau/lists 5.0.0-alpha.17 → 5.0.0-alpha.18
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 +14 -14
- package/dist/ListSkeleton.d.ts +3 -1
- package/dist/ListSkeleton.d.ts.map +1 -1
- package/dist/ListSkeleton.js +34 -30
- package/dist/ListSkeleton.js.map +1 -1
- package/dist/ListView.d.ts +3 -2
- package/dist/ListView.d.ts.map +1 -1
- package/dist/ListView.js +7 -4
- package/dist/ListView.js.map +1 -1
- package/dist/actions/ConfirmDialog.d.ts +5 -1
- package/dist/actions/ConfirmDialog.d.ts.map +1 -1
- package/dist/actions/ConfirmDialog.js +7 -3
- package/dist/actions/ConfirmDialog.js.map +1 -1
- package/dist/displays/Displays.css +6 -0
- package/dist/displays/Displays.module.js +3 -1
- package/dist/displays/Displays.module.js.map +1 -1
- package/dist/displays/displays.d.ts +9 -1
- package/dist/displays/displays.d.ts.map +1 -1
- package/dist/displays/displays.js +132 -27
- package/dist/displays/displays.js.map +1 -1
- package/dist/images.d.ts +3 -2
- package/dist/images.d.ts.map +1 -1
- package/dist/images.js +24 -3
- package/dist/images.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/inline/InlineCell.d.ts +3 -1
- package/dist/inline/InlineCell.d.ts.map +1 -1
- package/dist/inline/InlineCell.js +153 -134
- package/dist/inline/InlineCell.js.map +1 -1
- package/dist/layouts/TableLayout.css +31 -0
- package/dist/layouts/TableLayout.d.ts +4 -3
- package/dist/layouts/TableLayout.d.ts.map +1 -1
- package/dist/layouts/TableLayout.js +87 -54
- package/dist/layouts/TableLayout.js.map +1 -1
- package/dist/layouts/TableLayout.module.js +5 -1
- package/dist/layouts/TableLayout.module.js.map +1 -1
- package/dist/types.d.ts +4 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -2,7 +2,7 @@ import { messages } from "../messages.js";
|
|
|
2
2
|
import Inline_module_default from "./Inline.module.js";
|
|
3
3
|
import { getProblem } from "@panneau/core";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
|
-
import { Button, IconButton, Spinner, usePanneauIntl } from "@panneau/ui";
|
|
5
|
+
import { Button, IconButton, Spinner, usePanneauIntl, useToast } from "@panneau/ui";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { Pencil } from "lucide-react";
|
|
8
8
|
import { useEffect, useRef, useState } from "react";
|
|
@@ -32,9 +32,10 @@ function isEqualValue(a, b) {
|
|
|
32
32
|
* field's portable rules, then saved alone; errors and conflicts show in the cell.
|
|
33
33
|
*/
|
|
34
34
|
function InlineCell(t0) {
|
|
35
|
-
const $ = c(
|
|
36
|
-
const { item, field, itemLabel, children, renderValue, onSave, onItem, formatError } = t0;
|
|
35
|
+
const $ = c(78);
|
|
36
|
+
const { item, field, itemLabel, getItemLabel, children, renderValue, onSave, onItem, formatError } = t0;
|
|
37
37
|
const intl = usePanneauIntl();
|
|
38
|
+
const toasts = useToast();
|
|
38
39
|
let t1;
|
|
39
40
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
40
41
|
t1 = { mode: "idle" };
|
|
@@ -72,10 +73,13 @@ function InlineCell(t0) {
|
|
|
72
73
|
let t7;
|
|
73
74
|
let t8;
|
|
74
75
|
let t9;
|
|
75
|
-
if ($[4] !== Entry || $[5] !== bare || $[6] !== children || $[7] !== field || $[8] !== formatError || $[9] !==
|
|
76
|
+
if ($[4] !== Entry || $[5] !== bare || $[6] !== children || $[7] !== field || $[8] !== formatError || $[9] !== getItemLabel || $[10] !== intl || $[11] !== isBoolean || $[12] !== item || $[13] !== itemLabel || $[14] !== label || $[15] !== onItem || $[16] !== onSave || $[17] !== renderValue || $[18] !== state.current || $[19] !== state.draft || $[20] !== state.errors || $[21] !== state.mode || $[22] !== toasts || $[23] !== value) {
|
|
76
77
|
t9 = Symbol.for("react.early_return_sentinel");
|
|
77
78
|
bb0: {
|
|
78
|
-
save = (base, draft) => {
|
|
79
|
+
save = (base, draft, t10) => {
|
|
80
|
+
const { undoing: t11 } = t10 === void 0 ? {} : t10;
|
|
81
|
+
const undoing = t11 === void 0 ? false : t11;
|
|
82
|
+
const previous = base[field.name];
|
|
79
83
|
setState({
|
|
80
84
|
mode: "saving",
|
|
81
85
|
draft
|
|
@@ -84,6 +88,19 @@ function InlineCell(t0) {
|
|
|
84
88
|
onItem(saved);
|
|
85
89
|
focus.current = isBoolean ? null : "button";
|
|
86
90
|
setState({ mode: "idle" });
|
|
91
|
+
const names = {
|
|
92
|
+
item: getItemLabel?.(saved) ?? itemLabel,
|
|
93
|
+
field: label
|
|
94
|
+
};
|
|
95
|
+
const key = { key: `panneau-inline:${item.id}:${field.name}` };
|
|
96
|
+
toasts.show(undoing ? { title: intl.formatMessage(messages.inlineUndone, names) } : {
|
|
97
|
+
title: intl.formatMessage(messages.inlineSaved, names),
|
|
98
|
+
tone: "success",
|
|
99
|
+
action: {
|
|
100
|
+
label: intl.formatMessage(messages.undo),
|
|
101
|
+
onAction: () => save(saved, previous, { undoing: true })
|
|
102
|
+
}
|
|
103
|
+
}, key);
|
|
87
104
|
}, (error) => {
|
|
88
105
|
const problem = getProblem(error);
|
|
89
106
|
if (problem?.status === 412 && problem.current !== void 0) {
|
|
@@ -95,8 +112,8 @@ function InlineCell(t0) {
|
|
|
95
112
|
});
|
|
96
113
|
return;
|
|
97
114
|
}
|
|
98
|
-
const own = Object.entries(problem?.errors ?? {}).filter((
|
|
99
|
-
const [path] =
|
|
115
|
+
const own = Object.entries(problem?.errors ?? {}).filter((t12) => {
|
|
116
|
+
const [path] = t12;
|
|
100
117
|
return path === field.name || path.startsWith(`${field.name}.`);
|
|
101
118
|
}).flatMap(_temp);
|
|
102
119
|
const message = problem?.detail ?? (problem !== null ? problem.title : null) ?? (error instanceof Error && error.message !== "" ? error.message : null) ?? intl.formatMessage(messages.saveValueFailed);
|
|
@@ -166,69 +183,69 @@ function InlineCell(t0) {
|
|
|
166
183
|
hideLabel: true
|
|
167
184
|
});
|
|
168
185
|
if (isBoolean) {
|
|
169
|
-
let
|
|
170
|
-
if ($[
|
|
171
|
-
|
|
172
|
-
$[
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
175
|
-
} else
|
|
176
|
-
let
|
|
177
|
-
if ($[
|
|
178
|
-
|
|
186
|
+
let t13;
|
|
187
|
+
if ($[32] !== state.errors || $[33] !== state.mode) {
|
|
188
|
+
t13 = state.mode === "editing" ? state.errors : [];
|
|
189
|
+
$[32] = state.errors;
|
|
190
|
+
$[33] = state.mode;
|
|
191
|
+
$[34] = t13;
|
|
192
|
+
} else t13 = $[34];
|
|
193
|
+
let t14;
|
|
194
|
+
if ($[35] !== intl || $[36] !== state.mode) {
|
|
195
|
+
t14 = state.mode === "saving" ? /* @__PURE__ */ jsx(Spinner, {
|
|
179
196
|
size: "sm",
|
|
180
197
|
label: intl.formatMessage(messages.savingValue)
|
|
181
198
|
}) : null;
|
|
182
|
-
$[
|
|
183
|
-
$[
|
|
184
|
-
$[
|
|
185
|
-
} else
|
|
186
|
-
const
|
|
199
|
+
$[35] = intl;
|
|
200
|
+
$[36] = state.mode;
|
|
201
|
+
$[37] = t14;
|
|
202
|
+
} else t14 = $[37];
|
|
203
|
+
const t15 = /* @__PURE__ */ jsxs("div", {
|
|
187
204
|
className: Inline_module_default.control,
|
|
188
|
-
children: [control(state.mode === "idle" ? value : state.draft,
|
|
205
|
+
children: [control(state.mode === "idle" ? value : state.draft, t13, state.mode === "saving"), t14]
|
|
189
206
|
});
|
|
190
|
-
const
|
|
207
|
+
const t16 = state.mode === "conflict" ? /* @__PURE__ */ jsx(Conflict, {
|
|
191
208
|
current: renderValue(state.current),
|
|
192
209
|
onKeep: () => setState({ mode: "idle" }),
|
|
193
210
|
onSave: () => save(state.current, state.draft)
|
|
194
211
|
}) : null;
|
|
195
|
-
let
|
|
196
|
-
if ($[
|
|
197
|
-
|
|
212
|
+
let t17;
|
|
213
|
+
if ($[38] !== t15 || $[39] !== t16) {
|
|
214
|
+
t17 = /* @__PURE__ */ jsxs("div", {
|
|
198
215
|
className: Inline_module_default.cell,
|
|
199
|
-
children: [
|
|
216
|
+
children: [t15, t16]
|
|
200
217
|
});
|
|
201
|
-
$[36] = t13;
|
|
202
|
-
$[37] = t14;
|
|
203
218
|
$[38] = t15;
|
|
204
|
-
|
|
205
|
-
|
|
219
|
+
$[39] = t16;
|
|
220
|
+
$[40] = t17;
|
|
221
|
+
} else t17 = $[40];
|
|
222
|
+
t9 = t17;
|
|
206
223
|
break bb0;
|
|
207
224
|
}
|
|
208
225
|
if (state.mode === "idle") {
|
|
209
|
-
let
|
|
210
|
-
if ($[
|
|
211
|
-
|
|
226
|
+
let t13;
|
|
227
|
+
if ($[41] !== children) {
|
|
228
|
+
t13 = /* @__PURE__ */ jsx("span", {
|
|
212
229
|
className: Inline_module_default.value,
|
|
213
230
|
children
|
|
214
231
|
});
|
|
215
|
-
$[
|
|
216
|
-
$[
|
|
217
|
-
} else
|
|
218
|
-
let
|
|
219
|
-
if ($[
|
|
220
|
-
|
|
232
|
+
$[41] = children;
|
|
233
|
+
$[42] = t13;
|
|
234
|
+
} else t13 = $[42];
|
|
235
|
+
let t14;
|
|
236
|
+
if ($[43] !== intl || $[44] !== itemLabel || $[45] !== label) {
|
|
237
|
+
t14 = intl.formatMessage(messages.editValue, {
|
|
221
238
|
field: label,
|
|
222
239
|
item: itemLabel
|
|
223
240
|
});
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
228
|
-
} else
|
|
229
|
-
let
|
|
230
|
-
if ($[
|
|
231
|
-
|
|
241
|
+
$[43] = intl;
|
|
242
|
+
$[44] = itemLabel;
|
|
243
|
+
$[45] = label;
|
|
244
|
+
$[46] = t14;
|
|
245
|
+
} else t14 = $[46];
|
|
246
|
+
let t15;
|
|
247
|
+
if ($[47] !== value) {
|
|
248
|
+
t15 = () => {
|
|
232
249
|
focus.current = "editor";
|
|
233
250
|
setState({
|
|
234
251
|
mode: "editing",
|
|
@@ -236,35 +253,35 @@ function InlineCell(t0) {
|
|
|
236
253
|
errors: []
|
|
237
254
|
});
|
|
238
255
|
};
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
241
|
-
} else
|
|
242
|
-
let
|
|
243
|
-
if ($[
|
|
244
|
-
|
|
256
|
+
$[47] = value;
|
|
257
|
+
$[48] = t15;
|
|
258
|
+
} else t15 = $[48];
|
|
259
|
+
let t16;
|
|
260
|
+
if ($[49] !== t14 || $[50] !== t15) {
|
|
261
|
+
t16 = /* @__PURE__ */ jsx(IconButton, {
|
|
245
262
|
icon: Pencil,
|
|
246
263
|
size: "sm",
|
|
247
|
-
label:
|
|
264
|
+
label: t14,
|
|
248
265
|
showTooltip: false,
|
|
249
266
|
className: Inline_module_default.edit,
|
|
250
|
-
onPress:
|
|
267
|
+
onPress: t15
|
|
251
268
|
});
|
|
252
|
-
$[47] = t12;
|
|
253
|
-
$[48] = t13;
|
|
254
269
|
$[49] = t14;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
270
|
+
$[50] = t15;
|
|
271
|
+
$[51] = t16;
|
|
272
|
+
} else t16 = $[51];
|
|
273
|
+
let t17;
|
|
274
|
+
if ($[52] !== t13 || $[53] !== t16) {
|
|
275
|
+
t17 = /* @__PURE__ */ jsxs("div", {
|
|
259
276
|
ref: root,
|
|
260
277
|
className: Inline_module_default.cell,
|
|
261
|
-
children: [
|
|
278
|
+
children: [t13, t16]
|
|
262
279
|
});
|
|
263
|
-
$[
|
|
264
|
-
$[
|
|
265
|
-
$[
|
|
266
|
-
} else
|
|
267
|
-
t9 =
|
|
280
|
+
$[52] = t13;
|
|
281
|
+
$[53] = t16;
|
|
282
|
+
$[54] = t17;
|
|
283
|
+
} else t17 = $[54];
|
|
284
|
+
t9 = t17;
|
|
268
285
|
break bb0;
|
|
269
286
|
}
|
|
270
287
|
t5 = root;
|
|
@@ -272,75 +289,77 @@ function InlineCell(t0) {
|
|
|
272
289
|
t7 = onKeyDown;
|
|
273
290
|
t8 = onBlur;
|
|
274
291
|
t3 = Inline_module_default.control;
|
|
275
|
-
let
|
|
276
|
-
if ($[
|
|
277
|
-
|
|
278
|
-
$[
|
|
279
|
-
$[
|
|
280
|
-
$[
|
|
281
|
-
} else
|
|
282
|
-
t4 = control(state.draft,
|
|
292
|
+
let t13;
|
|
293
|
+
if ($[55] !== state.errors || $[56] !== state.mode) {
|
|
294
|
+
t13 = state.mode === "editing" ? state.errors : [];
|
|
295
|
+
$[55] = state.errors;
|
|
296
|
+
$[56] = state.mode;
|
|
297
|
+
$[57] = t13;
|
|
298
|
+
} else t13 = $[57];
|
|
299
|
+
t4 = control(state.draft, t13, state.mode === "saving");
|
|
283
300
|
}
|
|
284
301
|
$[4] = Entry;
|
|
285
302
|
$[5] = bare;
|
|
286
303
|
$[6] = children;
|
|
287
304
|
$[7] = field;
|
|
288
305
|
$[8] = formatError;
|
|
289
|
-
$[9] =
|
|
290
|
-
$[10] =
|
|
291
|
-
$[11] =
|
|
292
|
-
$[12] =
|
|
293
|
-
$[13] =
|
|
294
|
-
$[14] =
|
|
295
|
-
$[15] =
|
|
296
|
-
$[16] =
|
|
297
|
-
$[17] =
|
|
298
|
-
$[18] = state.
|
|
299
|
-
$[19] = state.
|
|
300
|
-
$[20] = state.
|
|
301
|
-
$[21] =
|
|
302
|
-
$[22] =
|
|
303
|
-
$[23] =
|
|
304
|
-
$[24] =
|
|
305
|
-
$[25] =
|
|
306
|
-
$[26] =
|
|
307
|
-
$[27] =
|
|
308
|
-
$[28] =
|
|
309
|
-
$[29] =
|
|
306
|
+
$[9] = getItemLabel;
|
|
307
|
+
$[10] = intl;
|
|
308
|
+
$[11] = isBoolean;
|
|
309
|
+
$[12] = item;
|
|
310
|
+
$[13] = itemLabel;
|
|
311
|
+
$[14] = label;
|
|
312
|
+
$[15] = onItem;
|
|
313
|
+
$[16] = onSave;
|
|
314
|
+
$[17] = renderValue;
|
|
315
|
+
$[18] = state.current;
|
|
316
|
+
$[19] = state.draft;
|
|
317
|
+
$[20] = state.errors;
|
|
318
|
+
$[21] = state.mode;
|
|
319
|
+
$[22] = toasts;
|
|
320
|
+
$[23] = value;
|
|
321
|
+
$[24] = save;
|
|
322
|
+
$[25] = t3;
|
|
323
|
+
$[26] = t4;
|
|
324
|
+
$[27] = t5;
|
|
325
|
+
$[28] = t6;
|
|
326
|
+
$[29] = t7;
|
|
327
|
+
$[30] = t8;
|
|
328
|
+
$[31] = t9;
|
|
310
329
|
} else {
|
|
311
|
-
save = $[
|
|
312
|
-
t3 = $[
|
|
313
|
-
t4 = $[
|
|
314
|
-
t5 = $[
|
|
315
|
-
t6 = $[
|
|
316
|
-
t7 = $[
|
|
317
|
-
t8 = $[
|
|
318
|
-
t9 = $[
|
|
330
|
+
save = $[24];
|
|
331
|
+
t3 = $[25];
|
|
332
|
+
t4 = $[26];
|
|
333
|
+
t5 = $[27];
|
|
334
|
+
t6 = $[28];
|
|
335
|
+
t7 = $[29];
|
|
336
|
+
t8 = $[30];
|
|
337
|
+
t9 = $[31];
|
|
319
338
|
}
|
|
320
339
|
if (t9 !== Symbol.for("react.early_return_sentinel")) return t9;
|
|
321
340
|
let t10;
|
|
322
|
-
if ($[
|
|
341
|
+
if ($[58] !== intl || $[59] !== state.mode) {
|
|
323
342
|
t10 = state.mode === "saving" ? /* @__PURE__ */ jsx(Spinner, {
|
|
324
343
|
size: "sm",
|
|
325
344
|
label: intl.formatMessage(messages.savingValue)
|
|
326
345
|
}) : null;
|
|
327
|
-
$[
|
|
328
|
-
$[
|
|
329
|
-
$[
|
|
330
|
-
} else t10 = $[
|
|
346
|
+
$[58] = intl;
|
|
347
|
+
$[59] = state.mode;
|
|
348
|
+
$[60] = t10;
|
|
349
|
+
} else t10 = $[60];
|
|
331
350
|
let t11;
|
|
332
|
-
if ($[
|
|
351
|
+
if ($[61] !== t10 || $[62] !== t3 || $[63] !== t4) {
|
|
333
352
|
t11 = /* @__PURE__ */ jsxs("div", {
|
|
334
353
|
className: t3,
|
|
335
354
|
children: [t4, t10]
|
|
336
355
|
});
|
|
337
|
-
$[
|
|
338
|
-
$[
|
|
339
|
-
$[
|
|
340
|
-
$[
|
|
341
|
-
} else t11 = $[
|
|
356
|
+
$[61] = t10;
|
|
357
|
+
$[62] = t3;
|
|
358
|
+
$[63] = t4;
|
|
359
|
+
$[64] = t11;
|
|
360
|
+
} else t11 = $[64];
|
|
342
361
|
let t12;
|
|
343
|
-
if ($[
|
|
362
|
+
if ($[65] !== renderValue || $[66] !== save || $[67] !== state.current || $[68] !== state.draft || $[69] !== state.mode) {
|
|
344
363
|
t12 = state.mode === "conflict" ? /* @__PURE__ */ jsx(Conflict, {
|
|
345
364
|
current: renderValue(state.current),
|
|
346
365
|
onKeep: () => {
|
|
@@ -349,15 +368,15 @@ function InlineCell(t0) {
|
|
|
349
368
|
},
|
|
350
369
|
onSave: () => save(state.current, state.draft)
|
|
351
370
|
}) : null;
|
|
352
|
-
$[
|
|
353
|
-
$[
|
|
354
|
-
$[
|
|
355
|
-
$[
|
|
356
|
-
$[
|
|
357
|
-
$[
|
|
358
|
-
} else t12 = $[
|
|
371
|
+
$[65] = renderValue;
|
|
372
|
+
$[66] = save;
|
|
373
|
+
$[67] = state.current;
|
|
374
|
+
$[68] = state.draft;
|
|
375
|
+
$[69] = state.mode;
|
|
376
|
+
$[70] = t12;
|
|
377
|
+
} else t12 = $[70];
|
|
359
378
|
let t13;
|
|
360
|
-
if ($[
|
|
379
|
+
if ($[71] !== t11 || $[72] !== t12 || $[73] !== t5 || $[74] !== t6 || $[75] !== t7 || $[76] !== t8) {
|
|
361
380
|
t13 = /* @__PURE__ */ jsxs("div", {
|
|
362
381
|
ref: t5,
|
|
363
382
|
className: t6,
|
|
@@ -365,14 +384,14 @@ function InlineCell(t0) {
|
|
|
365
384
|
onBlur: t8,
|
|
366
385
|
children: [t11, t12]
|
|
367
386
|
});
|
|
368
|
-
$[
|
|
369
|
-
$[
|
|
370
|
-
$[
|
|
371
|
-
$[
|
|
372
|
-
$[
|
|
373
|
-
$[
|
|
374
|
-
$[
|
|
375
|
-
} else t13 = $[
|
|
387
|
+
$[71] = t11;
|
|
388
|
+
$[72] = t12;
|
|
389
|
+
$[73] = t5;
|
|
390
|
+
$[74] = t6;
|
|
391
|
+
$[75] = t7;
|
|
392
|
+
$[76] = t8;
|
|
393
|
+
$[77] = t13;
|
|
394
|
+
} else t13 = $[77];
|
|
376
395
|
return t13;
|
|
377
396
|
}
|
|
378
397
|
/** What someone else saved, with the choice of keeping it or saving over it. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlineCell.js","names":["Pencil","FocusEvent","KeyboardEvent","ReactNode","useEffect","useRef","useState","getProblem","BooleanFieldEntry","DateFieldEntry","NumberFieldEntry","SelectFieldEntry","TextFieldEntry","Field","RuleFailure","checkValues","Button","IconButton","Spinner","usePanneauIntl","messages","ListItem","styles","ENTRIES","text","number","select","boolean","date","const","PICKED","Set","State","mode","draft","errors","current","InlineCellProps","item","field","itemLabel","children","renderValue","onSave","value","Promise","onItem","formatError","failure","isEqualValue","a","b","JSON","stringify","InlineCell","t0","$","_c","intl","t1","Symbol","for","state","setState","root","focus","label","name","isBoolean","type","Entry","bare","help","_help","t2","querySelector","save","t3","t4","t5","t6","t7","t8","t9","bb0","base","then","saved","error","problem","status","undefined","own","Object","entries","filter","t10","path","startsWith","flatMap","_temp","message","detail","title","Error","formatMessage","saveValueFailed","length","commit","draft_0","failures","partial","values","flat","map","cancel","onKeyDown","event","key","stopPropagation","has","preventDefault","onBlur","event_0","next","relatedTarget","Element","currentTarget","contains","closest","control","draft_1","errors_0","disabled","next_0","t11","t12","savingValue","t13","t14","t15","cell","editValue","edit","list","Conflict","onKeep","valueConflict","keepTheirs","saveMine","conflictActions","conflict","_c","styles"],"sources":["../../src/inline/InlineCell.tsx"],"sourcesContent":["import { Pencil } from 'lucide-react';\nimport {\n type FocusEvent,\n type KeyboardEvent,\n type ReactNode,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport { getProblem } from '@panneau/core';\nimport { BooleanFieldEntry } from '@panneau/fields/boolean';\nimport { DateFieldEntry } from '@panneau/fields/date';\nimport { NumberFieldEntry } from '@panneau/fields/number';\nimport { SelectFieldEntry } from '@panneau/fields/select';\nimport { TextFieldEntry } from '@panneau/fields/text';\nimport type { Field, RuleFailure } from '@panneau/protocol';\nimport { checkValues } from '@panneau/protocol/runtime';\nimport { Button, IconButton, Spinner, usePanneauIntl } from '@panneau/ui';\n\nimport { messages } from '../messages';\nimport type { ListItem } from '../types';\nimport styles from './Inline.module.css';\n\nconst ENTRIES = {\n text: TextFieldEntry,\n number: NumberFieldEntry,\n select: SelectFieldEntry,\n boolean: BooleanFieldEntry,\n date: DateFieldEntry,\n} as const;\n\n/** Types that save as soon as a value is picked, rather than on Enter or when leaving the cell. */\nconst PICKED = new Set(['select', 'date']);\n\ntype State =\n | { mode: 'idle' }\n | { mode: 'editing'; draft: unknown; errors: readonly string[] }\n | { mode: 'saving'; draft: unknown }\n | { mode: 'conflict'; draft: unknown; current: ListItem };\n\nexport interface InlineCellProps {\n item: ListItem;\n /** The field the cell edits, of a type of `INLINE_TYPES`. */\n field: Field;\n /** The label of the item, for the name of the edit button. */\n itemLabel: string;\n /** The content of the cell when it doesn't edit: the value, or the title's link. */\n children: ReactNode;\n /** Renders a value of the field, for the current value of a conflict. */\n renderValue: (item: ListItem) => ReactNode;\n /** Saves the value on an item (the current one after a conflict), with its version. */\n onSave: (item: ListItem, value: unknown) => Promise<ListItem>;\n /** Shows an item the backend gave back: saved, or changed by someone else. */\n onItem: (item: ListItem) => void;\n formatError: (failure: RuleFailure) => string;\n}\n\nfunction isEqualValue(a: unknown, b: unknown): boolean {\n return JSON.stringify(a ?? null) === JSON.stringify(b ?? null);\n}\n\n/**\n * A cell that edits its field in place (decision 0043): a checkbox for a boolean, otherwise the\n * value with a button that turns it into the field's control. Enter or leaving the cell saves,\n * Escape cancels; a select and a date save when one is picked. The value is checked by the\n * field's portable rules, then saved alone; errors and conflicts show in the cell.\n */\nexport function InlineCell({\n item,\n field,\n itemLabel,\n children,\n renderValue,\n onSave,\n onItem,\n formatError,\n}: InlineCellProps) {\n const intl = usePanneauIntl();\n const [state, setState] = useState<State>({ mode: 'idle' });\n const root = useRef<HTMLDivElement>(null);\n // Where focus goes once the cell has drawn its new state.\n const focus = useRef<'editor' | 'button' | null>(null);\n const label = field.label ?? field.name;\n const value = item[field.name];\n const isBoolean = field.type === 'boolean';\n const Entry = ENTRIES[field.type as keyof typeof ENTRIES];\n // The help of the field is for its form: a cell has no room for it.\n const { help: _help, ...bare } = field;\n\n useEffect(() => {\n if (focus.current === 'editor') {\n root.current?.querySelector<HTMLElement>('input, [role=\"spinbutton\"], button')?.focus();\n } else if (focus.current === 'button') {\n root.current?.querySelector<HTMLElement>('button')?.focus();\n }\n focus.current = null;\n });\n\n const save = (base: ListItem, draft: unknown) => {\n setState({ mode: 'saving', draft });\n onSave(base, draft).then(\n (saved) => {\n onItem(saved);\n focus.current = isBoolean ? null : 'button';\n setState({ mode: 'idle' });\n },\n (error: unknown) => {\n const problem = getProblem(error);\n if (problem?.status === 412 && problem.current !== undefined) {\n onItem(problem.current);\n setState({ mode: 'conflict', draft, current: problem.current });\n return;\n }\n const own = Object.entries(problem?.errors ?? {})\n .filter(([path]) => path === field.name || path.startsWith(`${field.name}.`))\n .flatMap(([, list]) => list);\n const message =\n problem?.detail ??\n (problem !== null ? problem.title : null) ??\n (error instanceof Error && error.message !== '' ? error.message : null) ??\n intl.formatMessage(messages.saveValueFailed);\n focus.current = 'editor';\n setState({ mode: 'editing', draft, errors: own.length > 0 ? own : [message] });\n },\n );\n };\n\n const commit = (draft: unknown) => {\n if (isEqualValue(draft, value)) {\n focus.current = 'button';\n setState({ mode: 'idle' });\n return;\n }\n const failures = checkValues(\n [field],\n { [field.name]: draft },\n {\n mode: 'update',\n partial: true,\n item,\n },\n );\n const errors = Object.values(failures)\n .flat()\n .map((failure) => formatError(failure));\n if (errors.length > 0) {\n setState({ mode: 'editing', draft, errors });\n return;\n }\n save(item, draft);\n };\n\n const cancel = () => {\n focus.current = 'button';\n setState({ mode: 'idle' });\n };\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (state.mode !== 'editing') {\n return;\n }\n if (event.key === 'Escape') {\n event.stopPropagation();\n cancel();\n } else if (event.key === 'Enter' && !PICKED.has(field.type)) {\n event.preventDefault();\n commit(state.draft);\n }\n };\n\n // Leaving the cell saves; the popover of a select or a date picker is part of it.\n const onBlur = (event: FocusEvent) => {\n const next = event.relatedTarget;\n if (\n state.mode !== 'editing' ||\n (next instanceof Element &&\n (event.currentTarget.contains(next) || next.closest('.panneau-popover') !== null))\n ) {\n return;\n }\n commit(state.draft);\n };\n\n const control = (draft: unknown, errors: readonly string[], disabled: boolean) => (\n <Entry\n field={bare}\n path={field.name}\n value={draft}\n onChange={(next) => {\n if (isBoolean || (PICKED.has(field.type) && next !== null)) {\n commit(next);\n } else {\n setState({ mode: 'editing', draft: next, errors: [] });\n }\n }}\n errors={errors}\n disabled={disabled}\n hideLabel\n />\n );\n\n if (isBoolean) {\n return (\n <div className={styles.cell}>\n <div className={styles.control}>\n {control(\n state.mode === 'idle' ? value : state.draft,\n state.mode === 'editing' ? state.errors : [],\n state.mode === 'saving',\n )}\n {state.mode === 'saving' ? (\n <Spinner size=\"sm\" label={intl.formatMessage(messages.savingValue)} />\n ) : null}\n </div>\n {state.mode === 'conflict' ? (\n <Conflict\n current={renderValue(state.current)}\n onKeep={() => setState({ mode: 'idle' })}\n onSave={() => save(state.current, state.draft)}\n />\n ) : null}\n </div>\n );\n }\n\n if (state.mode === 'idle') {\n return (\n <div ref={root} className={styles.cell}>\n <span className={styles.value}>{children}</span>\n <IconButton\n icon={Pencil}\n size=\"sm\"\n label={intl.formatMessage(messages.editValue, {\n field: label,\n item: itemLabel,\n })}\n showTooltip={false}\n className={styles.edit}\n onPress={() => {\n focus.current = 'editor';\n setState({ mode: 'editing', draft: value, errors: [] });\n }}\n />\n </div>\n );\n }\n\n return (\n <div ref={root} className={styles.cell} onKeyDown={onKeyDown} onBlur={onBlur}>\n <div className={styles.control}>\n {control(\n state.draft,\n state.mode === 'editing' ? state.errors : [],\n state.mode === 'saving',\n )}\n {state.mode === 'saving' ? (\n <Spinner size=\"sm\" label={intl.formatMessage(messages.savingValue)} />\n ) : null}\n </div>\n {state.mode === 'conflict' ? (\n <Conflict\n current={renderValue(state.current)}\n onKeep={() => {\n focus.current = 'button';\n setState({ mode: 'idle' });\n }}\n onSave={() => save(state.current, state.draft)}\n />\n ) : null}\n </div>\n );\n}\n\n/** What someone else saved, with the choice of keeping it or saving over it. */\nfunction Conflict({\n current,\n onKeep,\n onSave,\n}: {\n current: ReactNode;\n onKeep: () => void;\n onSave: () => void;\n}) {\n const intl = usePanneauIntl();\n return (\n <div className={styles.conflict} role=\"alert\">\n <span>\n {intl.formatMessage(messages.valueConflict)} <strong>{current}</strong>\n </span>\n <span className={styles.conflictActions}>\n <Button size=\"sm\" appearance=\"ghost\" onPress={onKeep}>\n {intl.formatMessage(messages.keepTheirs)}\n </Button>\n <Button size=\"sm\" onPress={onSave}>\n {intl.formatMessage(messages.saveMine)}\n </Button>\n </span>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,IAAMuB,UAAU;CACZC,MAAMZ;CACNa,QAAQf;CACRgB,QAAQf;CACRgB,SAASnB;CACToB,MAAMnB;AACV;;AAGA,IAAMqB,yBAAS,IAAIC,IAAI,CAAC,UAAU,MAAM,CAAC;AAyBzC,SAASkB,aAAaC,GAAYC,GAAqB;CACnD,OAAOC,KAAKC,UAAUH,KAAK,IAAI,MAAME,KAAKC,UAAUF,KAAK,IAAI;AACjE;;;;;;;AAQA,SAAOG,WAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAoB,MAAA,EAAAnB,MAAAC,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;CAAA,OAAAA,KAAAxB,EAAA;CAAA,IAAAyB;CAAA,IAAAzB,EAAA,QAAAb,UAAAa,EAAA,QAAAwB,IAAA;EAD1CC,KAAA,oBAAC,QAAD;GAAa,MAAA;GAActC,SAAAA;GACtBqC,UAAAA;EADE,CAAA;EAEExB,EAAA,MAAAb;EAAAa,EAAA,MAAAwB;EAAAxB,EAAA,MAAAyB;CAAA,OAAAA,KAAAzB,EAAA;CAAA,IAAA0B;CAAA,IAAA1B,EAAA,QAAAuB,MAAAvB,EAAA,QAAAyB,IAAA;EANbC,KAAA,qBAAA,QAAA;GAAiB,WAAA5D,sBAAMgI;GAAvB,UAAA,CACIvE,IAGAE,EAGG;;EAAAzB,EAAA,MAAAuB;EAAAvB,EAAA,MAAAyB;EAAAzB,EAAA,MAAA0B;CAAA,OAAAA,KAAA1B,EAAA;CAAA,IAAA2B;CAAA,IAAA3B,EAAA,QAAAqB,MAAArB,EAAA,QAAA0B,IAAA;EAXXC,KAAA,qBAAA,OAAA;GAAgB,WAAA7D,sBAAMiI;GAAgB,MAAA;GAAtC,UAAA,CACI1E,IAGAK,EAQE;;EAAA1B,EAAA,MAAAqB;EAAArB,EAAA,MAAA0B;EAAA1B,EAAA,MAAA2B;CAAA,OAAAA,KAAA3B,EAAA;CAAA,OAZN2B;AAYM"}
|
|
1
|
+
{"version":3,"file":"InlineCell.js","names":["Pencil","FocusEvent","KeyboardEvent","ReactNode","useEffect","useRef","useState","getProblem","BooleanFieldEntry","DateFieldEntry","NumberFieldEntry","SelectFieldEntry","TextFieldEntry","Field","RuleFailure","checkValues","Button","IconButton","Spinner","usePanneauIntl","useToast","messages","ListItem","styles","ENTRIES","text","number","select","boolean","date","const","PICKED","Set","State","mode","draft","errors","current","InlineCellProps","item","field","itemLabel","getItemLabel","children","renderValue","onSave","value","Promise","onItem","formatError","failure","isEqualValue","a","b","JSON","stringify","InlineCell","t0","$","_c","intl","toasts","t1","Symbol","for","state","setState","root","focus","label","name","isBoolean","type","Entry","bare","help","_help","t2","querySelector","save","t3","t4","t5","t6","t7","t8","t9","bb0","base","t10","undoing","t11","undefined","previous","then","saved","names","key","id","show","title","formatMessage","inlineUndone","inlineSaved","tone","action","undo","onAction","error","problem","status","own","Object","entries","filter","t12","path","startsWith","flatMap","_temp","message","detail","Error","saveValueFailed","length","commit","draft_0","failures","partial","values","flat","map","cancel","onKeyDown","event","stopPropagation","has","preventDefault","onBlur","event_0","next","relatedTarget","Element","currentTarget","contains","closest","control","draft_1","errors_0","disabled","next_0","t13","t14","savingValue","t15","t16","t17","cell","editValue","edit","list","Conflict","onKeep","valueConflict","keepTheirs","saveMine","conflictActions","conflict","_c","styles"],"sources":["../../src/inline/InlineCell.tsx"],"sourcesContent":["import { Pencil } from 'lucide-react';\nimport {\n type FocusEvent,\n type KeyboardEvent,\n type ReactNode,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport { getProblem } from '@panneau/core';\nimport { BooleanFieldEntry } from '@panneau/fields/boolean';\nimport { DateFieldEntry } from '@panneau/fields/date';\nimport { NumberFieldEntry } from '@panneau/fields/number';\nimport { SelectFieldEntry } from '@panneau/fields/select';\nimport { TextFieldEntry } from '@panneau/fields/text';\nimport type { Field, RuleFailure } from '@panneau/protocol';\nimport { checkValues } from '@panneau/protocol/runtime';\nimport { Button, IconButton, Spinner, usePanneauIntl, useToast } from '@panneau/ui';\n\nimport { messages } from '../messages';\nimport type { ListItem } from '../types';\nimport styles from './Inline.module.css';\n\nconst ENTRIES = {\n text: TextFieldEntry,\n number: NumberFieldEntry,\n select: SelectFieldEntry,\n boolean: BooleanFieldEntry,\n date: DateFieldEntry,\n} as const;\n\n/** Types that save as soon as a value is picked, rather than on Enter or when leaving the cell. */\nconst PICKED = new Set(['select', 'date']);\n\ntype State =\n | { mode: 'idle' }\n | { mode: 'editing'; draft: unknown; errors: readonly string[] }\n | { mode: 'saving'; draft: unknown }\n | { mode: 'conflict'; draft: unknown; current: ListItem };\n\nexport interface InlineCellProps {\n item: ListItem;\n /** The field the cell edits, of a type of `INLINE_TYPES`. */\n field: Field;\n /** The label of the item, for the name of the edit button. */\n itemLabel: string;\n /** The label of an item the backend gave back, for the toast that says it was saved. */\n getItemLabel?: (item: ListItem) => string;\n /** The content of the cell when it doesn't edit: the value, or the title's link. */\n children: ReactNode;\n /** Renders a value of the field, for the current value of a conflict. */\n renderValue: (item: ListItem) => ReactNode;\n /** Saves the value on an item (the current one after a conflict), with its version. */\n onSave: (item: ListItem, value: unknown) => Promise<ListItem>;\n /** Shows an item the backend gave back: saved, or changed by someone else. */\n onItem: (item: ListItem) => void;\n formatError: (failure: RuleFailure) => string;\n}\n\nfunction isEqualValue(a: unknown, b: unknown): boolean {\n return JSON.stringify(a ?? null) === JSON.stringify(b ?? null);\n}\n\n/**\n * A cell that edits its field in place (decision 0043): a checkbox for a boolean, otherwise the\n * value with a button that turns it into the field's control. Enter or leaving the cell saves,\n * Escape cancels; a select and a date save when one is picked. The value is checked by the\n * field's portable rules, then saved alone; errors and conflicts show in the cell.\n */\nexport function InlineCell({\n item,\n field,\n itemLabel,\n getItemLabel,\n children,\n renderValue,\n onSave,\n onItem,\n formatError,\n}: InlineCellProps) {\n const intl = usePanneauIntl();\n const toasts = useToast();\n const [state, setState] = useState<State>({ mode: 'idle' });\n const root = useRef<HTMLDivElement>(null);\n // Where focus goes once the cell has drawn its new state.\n const focus = useRef<'editor' | 'button' | null>(null);\n const label = field.label ?? field.name;\n const value = item[field.name];\n const isBoolean = field.type === 'boolean';\n const Entry = ENTRIES[field.type as keyof typeof ENTRIES];\n // The help of the field is for its form: a cell has no room for it.\n const { help: _help, ...bare } = field;\n\n useEffect(() => {\n if (focus.current === 'editor') {\n root.current?.querySelector<HTMLElement>('input, [role=\"spinbutton\"], button')?.focus();\n } else if (focus.current === 'button') {\n root.current?.querySelector<HTMLElement>('button')?.focus();\n }\n focus.current = null;\n });\n\n /**\n * Saves a value on an item. The toast that says it has \"Undo\", which saves the previous value\n * the same way, with the version the save just got (decision 0063): a conflict then shows in\n * the cell, as for any change. After an undo, a short toast says the value is back.\n */\n const save = (base: ListItem, draft: unknown, { undoing = false } = {}) => {\n const previous = base[field.name];\n setState({ mode: 'saving', draft });\n onSave(base, draft).then(\n (saved) => {\n onItem(saved);\n focus.current = isBoolean ? null : 'button';\n setState({ mode: 'idle' });\n const names = { item: getItemLabel?.(saved) ?? itemLabel, field: label };\n const key = { key: `panneau-inline:${item.id}:${field.name}` };\n toasts.show(\n undoing\n ? { title: intl.formatMessage(messages.inlineUndone, names) }\n : {\n title: intl.formatMessage(messages.inlineSaved, names),\n tone: 'success',\n action: {\n label: intl.formatMessage(messages.undo),\n onAction: () => save(saved, previous, { undoing: true }),\n },\n },\n key,\n );\n },\n (error: unknown) => {\n const problem = getProblem(error);\n if (problem?.status === 412 && problem.current !== undefined) {\n onItem(problem.current);\n setState({ mode: 'conflict', draft, current: problem.current });\n return;\n }\n const own = Object.entries(problem?.errors ?? {})\n .filter(([path]) => path === field.name || path.startsWith(`${field.name}.`))\n .flatMap(([, list]) => list);\n const message =\n problem?.detail ??\n (problem !== null ? problem.title : null) ??\n (error instanceof Error && error.message !== '' ? error.message : null) ??\n intl.formatMessage(messages.saveValueFailed);\n focus.current = 'editor';\n setState({ mode: 'editing', draft, errors: own.length > 0 ? own : [message] });\n },\n );\n };\n\n const commit = (draft: unknown) => {\n if (isEqualValue(draft, value)) {\n focus.current = 'button';\n setState({ mode: 'idle' });\n return;\n }\n const failures = checkValues(\n [field],\n { [field.name]: draft },\n {\n mode: 'update',\n partial: true,\n item,\n },\n );\n const errors = Object.values(failures)\n .flat()\n .map((failure) => formatError(failure));\n if (errors.length > 0) {\n setState({ mode: 'editing', draft, errors });\n return;\n }\n save(item, draft);\n };\n\n const cancel = () => {\n focus.current = 'button';\n setState({ mode: 'idle' });\n };\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (state.mode !== 'editing') {\n return;\n }\n if (event.key === 'Escape') {\n event.stopPropagation();\n cancel();\n } else if (event.key === 'Enter' && !PICKED.has(field.type)) {\n event.preventDefault();\n commit(state.draft);\n }\n };\n\n // Leaving the cell saves; the popover of a select or a date picker is part of it.\n const onBlur = (event: FocusEvent) => {\n const next = event.relatedTarget;\n if (\n state.mode !== 'editing' ||\n (next instanceof Element &&\n (event.currentTarget.contains(next) || next.closest('.panneau-popover') !== null))\n ) {\n return;\n }\n commit(state.draft);\n };\n\n const control = (draft: unknown, errors: readonly string[], disabled: boolean) => (\n <Entry\n field={bare}\n path={field.name}\n value={draft}\n onChange={(next) => {\n if (isBoolean || (PICKED.has(field.type) && next !== null)) {\n commit(next);\n } else {\n setState({ mode: 'editing', draft: next, errors: [] });\n }\n }}\n errors={errors}\n disabled={disabled}\n hideLabel\n />\n );\n\n if (isBoolean) {\n return (\n <div className={styles.cell}>\n <div className={styles.control}>\n {control(\n state.mode === 'idle' ? value : state.draft,\n state.mode === 'editing' ? state.errors : [],\n state.mode === 'saving',\n )}\n {state.mode === 'saving' ? (\n <Spinner size=\"sm\" label={intl.formatMessage(messages.savingValue)} />\n ) : null}\n </div>\n {state.mode === 'conflict' ? (\n <Conflict\n current={renderValue(state.current)}\n onKeep={() => setState({ mode: 'idle' })}\n onSave={() => save(state.current, state.draft)}\n />\n ) : null}\n </div>\n );\n }\n\n if (state.mode === 'idle') {\n return (\n <div ref={root} className={styles.cell}>\n <span className={styles.value}>{children}</span>\n <IconButton\n icon={Pencil}\n size=\"sm\"\n label={intl.formatMessage(messages.editValue, {\n field: label,\n item: itemLabel,\n })}\n showTooltip={false}\n className={styles.edit}\n onPress={() => {\n focus.current = 'editor';\n setState({ mode: 'editing', draft: value, errors: [] });\n }}\n />\n </div>\n );\n }\n\n return (\n <div ref={root} className={styles.cell} onKeyDown={onKeyDown} onBlur={onBlur}>\n <div className={styles.control}>\n {control(\n state.draft,\n state.mode === 'editing' ? state.errors : [],\n state.mode === 'saving',\n )}\n {state.mode === 'saving' ? (\n <Spinner size=\"sm\" label={intl.formatMessage(messages.savingValue)} />\n ) : null}\n </div>\n {state.mode === 'conflict' ? (\n <Conflict\n current={renderValue(state.current)}\n onKeep={() => {\n focus.current = 'button';\n setState({ mode: 'idle' });\n }}\n onSave={() => save(state.current, state.draft)}\n />\n ) : null}\n </div>\n );\n}\n\n/** What someone else saved, with the choice of keeping it or saving over it. */\nfunction Conflict({\n current,\n onKeep,\n onSave,\n}: {\n current: ReactNode;\n onKeep: () => void;\n onSave: () => void;\n}) {\n const intl = usePanneauIntl();\n return (\n <div className={styles.conflict} role=\"alert\">\n <span>\n {intl.formatMessage(messages.valueConflict)} <strong>{current}</strong>\n </span>\n <span className={styles.conflictActions}>\n <Button size=\"sm\" appearance=\"ghost\" onPress={onKeep}>\n {intl.formatMessage(messages.keepTheirs)}\n </Button>\n <Button size=\"sm\" onPress={onSave}>\n {intl.formatMessage(messages.saveMine)}\n </Button>\n </span>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,IAAMwB,UAAU;CACZC,MAAMb;CACNc,QAAQhB;CACRiB,QAAQhB;CACRiB,SAASpB;CACTqB,MAAMpB;AACV;;AAGA,IAAMsB,yBAAS,IAAIC,IAAI,CAAC,UAAU,MAAM,CAAC;AA2BzC,SAASmB,aAAaC,GAAYC,GAAqB;CACnD,OAAOC,KAAKC,UAAUH,KAAK,IAAI,MAAME,KAAKC,UAAUF,KAAK,IAAI;AACjE;;;;;;;AAQA,SAAOG,WAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAoB,MAAA,EAAApB,MAAAC,OAAAC,WAAAC,cAAAC,UAAAC,aAAAC,QAAAG,QAAAC,gBAAAQ;CAWvB,MAAAG,OAAazC,eAAe;CAC5B,MAAA0C,SAAezC,SAAS;CAAE,IAAA0C;CAAA,IAAAJ,EAAA,OAAAK,OAAAC,IAAA,2BAAA,GAAA;EACgBF,KAAA,EAAA5B,MAAQ,OAAO;EAACwB,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAA1D,MAAA,CAAAO,OAAAC,Y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B;EAAA3B,EAAA,MAAA4B;CAAA,OAAAA,KAAA5B,EAAA;CAAA,OAZN4B;AAYM"}
|
|
@@ -50,6 +50,37 @@
|
|
|
50
50
|
background-color: var(--panneau-color-hover);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
/* The thumbnail of an item, before its title (decision 0061). */
|
|
54
|
+
.panneau-table-layout-with-thumbnail {
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
gap: var(--panneau-space-3);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.panneau-table-layout-with-thumbnail > :last-child {
|
|
61
|
+
min-width: 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.panneau-table-layout-thumbnail {
|
|
65
|
+
display: flex;
|
|
66
|
+
flex: none;
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
width: 2.5rem;
|
|
70
|
+
height: 2.5rem;
|
|
71
|
+
overflow: hidden;
|
|
72
|
+
color: var(--panneau-color-text-muted);
|
|
73
|
+
background-color: var(--panneau-color-surface-sunken);
|
|
74
|
+
border-radius: var(--panneau-radius-sm);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.panneau-table-layout-thumbnail img {
|
|
78
|
+
display: block;
|
|
79
|
+
width: 100%;
|
|
80
|
+
height: 100%;
|
|
81
|
+
object-fit: cover;
|
|
82
|
+
}
|
|
83
|
+
|
|
53
84
|
.panneau-table-layout-center {
|
|
54
85
|
text-align: center !important;
|
|
55
86
|
}
|
|
@@ -2,8 +2,9 @@ import type { ListColumn, ListLayoutProps } from '../types.js';
|
|
|
2
2
|
/** The sort direction of a column, from the first `sort` value. */
|
|
3
3
|
export declare function getSortDirection(sort: readonly string[], column: ListColumn): 'ascending' | 'descending' | null;
|
|
4
4
|
/**
|
|
5
|
-
* Items as a table, with sortable column headers.
|
|
6
|
-
*
|
|
5
|
+
* Items as a table, with sortable column headers. With the image of items (`getItemImage`), each
|
|
6
|
+
* title starts with a thumbnail. On narrow lists (phones), each row turns into a block that shows
|
|
7
|
+
* the label of each value.
|
|
7
8
|
*/
|
|
8
|
-
export declare function TableLayout({ items, columns, renderValue, getItemLabel, getItemHref, isCurrent, selectable, isSelected, onToggle, renderActions, sort, onSort, label, pageSelection, renderCell, }: ListLayoutProps): import("react").JSX.Element;
|
|
9
|
+
export declare function TableLayout({ items, columns, renderValue, getItemLabel, getItemHref, getItemImage, isCurrent, selectable, isSelected, onToggle, renderActions, sort, onSort, label, pageSelection, renderCell, }: ListLayoutProps): import("react").JSX.Element;
|
|
9
10
|
//# sourceMappingURL=TableLayout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableLayout.d.ts","sourceRoot":"","sources":["../../src/layouts/TableLayout.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAI5D,mEAAmE;AACnE,wBAAgB,gBAAgB,CAC5B,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,MAAM,EAAE,UAAU,GACnB,WAAW,GAAG,YAAY,GAAG,IAAI,CAMnC;
|
|
1
|
+
{"version":3,"file":"TableLayout.d.ts","sourceRoot":"","sources":["../../src/layouts/TableLayout.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAI5D,mEAAmE;AACnE,wBAAgB,gBAAgB,CAC5B,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,MAAM,EAAE,UAAU,GACnB,WAAW,GAAG,YAAY,GAAG,IAAI,CAMnC;AAyBD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EACxB,KAAK,EACL,OAAO,EACP,WAAW,EACX,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,SAAS,EACT,UAAU,EACV,UAAU,EACV,QAAQ,EACR,aAAa,EACb,IAAI,EACJ,MAAM,EACN,KAAK,EACL,aAAa,EACb,UAAU,GACb,EAAE,eAAe,+BA8IjB"}
|