@panneau/lists 5.0.0-alpha.2 → 5.0.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendarDays.d.ts","sourceRoot":"","sources":["../../src/layouts/calendarDays.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAQ/C,+EAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAIlF;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACvB,KAAK,EAAE,OAAO,EACd,KAAK,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACtC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GACzB,MAAM,EAAE,CAoBV"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { getBoundDay, getDateRangeSettings, isDateRangeValue } from "@panneau/fields/daterange";
|
|
2
|
+
//#region src/layouts/calendarDays.ts
|
|
3
|
+
var DAY_MS = 864e5;
|
|
4
|
+
function addDays(day, count) {
|
|
5
|
+
return new Date(Date.parse(`${day}T00:00:00Z`) + count * DAY_MS).toISOString().slice(0, 10);
|
|
6
|
+
}
|
|
7
|
+
/** The time zone of a calendar's field: its `settings.timeZone`, or `null`. */
|
|
8
|
+
function getCalendarTimeZone(field) {
|
|
9
|
+
return field !== null && field !== void 0 ? getDateRangeSettings({
|
|
10
|
+
...field.settings,
|
|
11
|
+
time: true
|
|
12
|
+
}).timeZone : null;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The days an item shows on, within the days shown (`2026-10-26` to `2026-12-06`): the day of a
|
|
16
|
+
* `date` or a `datetime`, in the time zone (the browser's without one), or each day a `daterange`
|
|
17
|
+
* covers (decision 0053). A range open at its end shows on its first day; one open at its start, on
|
|
18
|
+
* its last.
|
|
19
|
+
*/
|
|
20
|
+
function getItemDays(value, shown, timeZone) {
|
|
21
|
+
if (isDateRangeValue(value)) {
|
|
22
|
+
const zone = value.timeZone ?? timeZone ?? void 0;
|
|
23
|
+
const first = getBoundDay(value.start, zone);
|
|
24
|
+
const last = getBoundDay(value.end, zone);
|
|
25
|
+
if (first === null || last === null) {
|
|
26
|
+
const day = first ?? last;
|
|
27
|
+
return day !== null && day >= shown.first && day <= shown.last ? [day] : [];
|
|
28
|
+
}
|
|
29
|
+
const days = [];
|
|
30
|
+
let day = first > shown.first ? first : shown.first;
|
|
31
|
+
const end = last < shown.last ? last : shown.last;
|
|
32
|
+
while (day <= end) {
|
|
33
|
+
days.push(day);
|
|
34
|
+
day = addDays(day, 1);
|
|
35
|
+
}
|
|
36
|
+
return days;
|
|
37
|
+
}
|
|
38
|
+
const day = typeof value === "string" ? getBoundDay(value, timeZone ?? void 0) : null;
|
|
39
|
+
return day !== null ? [day] : [];
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { getCalendarTimeZone, getItemDays };
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=calendarDays.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendarDays.js","names":["getBoundDay","getDateRangeSettings","isDateRangeValue","Field","DAY_MS","addDays","day","count","Date","parse","toISOString","slice","getCalendarTimeZone","field","undefined","settings","time","timeZone","getItemDays","value","shown","first","last","zone","start","end","days","push"],"sources":["../../src/layouts/calendarDays.ts"],"sourcesContent":["import { getBoundDay, getDateRangeSettings, isDateRangeValue } from '@panneau/fields/daterange';\nimport type { Field } from '@panneau/protocol';\n\nconst DAY_MS = 86_400_000;\n\nfunction addDays(day: string, count: number): string {\n return new Date(Date.parse(`${day}T00:00:00Z`) + count * DAY_MS).toISOString().slice(0, 10);\n}\n\n/** The time zone of a calendar's field: its `settings.timeZone`, or `null`. */\nexport function getCalendarTimeZone(field: Field | null | undefined): string | null {\n return field !== null && field !== undefined\n ? getDateRangeSettings({ ...field.settings, time: true }).timeZone\n : null;\n}\n\n/**\n * The days an item shows on, within the days shown (`2026-10-26` to `2026-12-06`): the day of a\n * `date` or a `datetime`, in the time zone (the browser's without one), or each day a `daterange`\n * covers (decision 0053). A range open at its end shows on its first day; one open at its start, on\n * its last.\n */\nexport function getItemDays(\n value: unknown,\n shown: { first: string; last: string },\n timeZone?: string | null,\n): string[] {\n if (isDateRangeValue(value)) {\n const zone = value.timeZone ?? timeZone ?? undefined;\n const first = getBoundDay(value.start, zone);\n const last = getBoundDay(value.end, zone);\n if (first === null || last === null) {\n const day = first ?? last;\n return day !== null && day >= shown.first && day <= shown.last ? [day] : [];\n }\n const days: string[] = [];\n let day = first > shown.first ? first : shown.first;\n const end = last < shown.last ? last : shown.last;\n while (day <= end) {\n days.push(day);\n day = addDays(day, 1);\n }\n return days;\n }\n const day = typeof value === 'string' ? getBoundDay(value, timeZone ?? undefined) : null;\n return day !== null ? [day] : [];\n}\n"],"mappings":";;AAGA,IAAMI,SAAS;AAEf,SAASC,QAAQC,KAAaC,OAAuB;CACjD,OAAO,IAAIC,KAAKA,KAAKC,MAAM,GAAGH,IAAG,WAAY,IAAIC,QAAQH,MAAM,CAAC,CAACM,YAAY,CAAC,CAACC,MAAM,GAAG,EAAE;AAC9F;;AAGA,SAAgBC,oBAAoBC,OAAgD;CAChF,OAAOA,UAAU,QAAQA,UAAUC,KAAAA,IAC7Bb,qBAAqB;EAAE,GAAGY,MAAME;EAAUC,MAAM;CAAK,CAAC,CAAC,CAACC,WACxD;AACV;;;;;;;AAQA,SAAgBC,YACZC,OACAC,OACAH,UACQ;CACR,IAAIf,iBAAiBiB,KAAK,GAAG;EACzB,MAAMI,OAAOJ,MAAMF,YAAYA,YAAYH,KAAAA;EAC3C,MAAMO,QAAQrB,YAAYmB,MAAMK,OAAOD,IAAI;EAC3C,MAAMD,OAAOtB,YAAYmB,MAAMM,KAAKF,IAAI;EACxC,IAAIF,UAAU,QAAQC,SAAS,MAAM;GACjC,MAAMhB,MAAMe,SAASC;GACrB,OAAOhB,QAAQ,QAAQA,OAAOc,MAAMC,SAASf,OAAOc,MAAME,OAAO,CAAChB,GAAG,IAAI,CAAA;EAC7E;EACA,MAAMoB,OAAiB,CAAA;EACvB,IAAIpB,MAAMe,QAAQD,MAAMC,QAAQA,QAAQD,MAAMC;EAC9C,MAAMI,MAAMH,OAAOF,MAAME,OAAOA,OAAOF,MAAME;EAC7C,OAAOhB,OAAOmB,KAAK;GACfC,KAAKC,KAAKrB,GAAG;GACbA,MAAMD,QAAQC,KAAK,CAAC;EACxB;EACA,OAAOoB;CACX;CACA,MAAMpB,MAAM,OAAOa,UAAU,WAAWnB,YAAYmB,OAAOF,YAAYH,KAAAA,CAAS,IAAI;CACpF,OAAOR,QAAQ,OAAO,CAACA,GAAG,IAAI,CAAA;AAClC"}
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DisplayEntry, ListLayoutEntry } from './types';
|
|
1
|
+
import type { DisplayEntry, ListLayoutEntry } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* The built-in displays and layouts as a `@panneau/core` plugin, with the French messages of every
|
|
4
4
|
* Panneau package (from `@panneau/intl`). Lists use the built-in displays and layouts without it:
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","names":[],"sources":["../src/plugin.ts"],"sourcesContent":["import { fr } from '@panneau/intl';\n\nimport { builtInDisplays } from './displays/displays';\nimport { builtInLayouts } from './layouts/builtIn';\nimport type { DisplayEntry, ListLayoutEntry } from './types';\n\n/**\n * The built-in displays and layouts as a `@panneau/core` plugin, with the French messages of every\n * Panneau package (from `@panneau/intl`). Lists use the built-in displays and layouts without it:\n * pass it for the messages, before the plugins that replace a display.\n */\nexport const listsPlugin: {\n id: string;\n displays: Readonly<Record<string, DisplayEntry>>;\n listLayouts: Readonly<Record<string, ListLayoutEntry>>;\n locales: Readonly<Record<string, Record<string, string>>>;\n} = {\n id: 'panneau-lists',\n displays: builtInDisplays,\n listLayouts: builtInLayouts,\n locales: { fr },\n};\n"],"mappings":";;;;;;;;;AAWA,
|
|
1
|
+
{"version":3,"file":"plugin.js","names":["fr","builtInDisplays","builtInLayouts","DisplayEntry","ListLayoutEntry","listsPlugin","id","displays","Readonly","Record","listLayouts","locales"],"sources":["../src/plugin.ts"],"sourcesContent":["import { fr } from '@panneau/intl';\n\nimport { builtInDisplays } from './displays/displays';\nimport { builtInLayouts } from './layouts/builtIn';\nimport type { DisplayEntry, ListLayoutEntry } from './types';\n\n/**\n * The built-in displays and layouts as a `@panneau/core` plugin, with the French messages of every\n * Panneau package (from `@panneau/intl`). Lists use the built-in displays and layouts without it:\n * pass it for the messages, before the plugins that replace a display.\n */\nexport const listsPlugin: {\n id: string;\n displays: Readonly<Record<string, DisplayEntry>>;\n listLayouts: Readonly<Record<string, ListLayoutEntry>>;\n locales: Readonly<Record<string, Record<string, string>>>;\n} = {\n id: 'panneau-lists',\n displays: builtInDisplays,\n listLayouts: builtInLayouts,\n locales: { fr },\n};\n"],"mappings":";;;;;;;;;AAWA,IAAaK,cAKT;CACAC,IAAI;CACJC,UAAUN;CACVS,aAAaR;CACbS,SAAS,EAAEX,GAAG;AAClB"}
|
package/dist/query.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ListQuery } from '@panneau/protocol';
|
|
2
|
-
import type { ListColumn, ListItem } from './types';
|
|
2
|
+
import type { ListColumn, ListItem } from './types.js';
|
|
3
3
|
export interface LocalQueryOptions {
|
|
4
4
|
/** The columns: values of localized fields are compared in `locale`. */
|
|
5
5
|
columns?: readonly ListColumn[];
|
|
@@ -14,8 +14,9 @@ export interface LocalQueryResult<T extends ListItem> {
|
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Applies a list query to items in memory, as a backend would: filters (the value, or one of the
|
|
17
|
-
* values, matches as a string; a range matches the values within its bounds
|
|
18
|
-
*
|
|
17
|
+
* values, matches as a string; a range matches the values within its bounds, and the date ranges
|
|
18
|
+
* that overlap them), search in every text value, sort (a date range by its start, money by its
|
|
19
|
+
* amount), then the page. For a product that has every item at hand.
|
|
19
20
|
*/
|
|
20
21
|
export declare function applyListQuery<T extends ListItem>(items: readonly T[], query: ListQuery, options?: LocalQueryOptions): LocalQueryResult<T>;
|
|
21
22
|
//# sourceMappingURL=query.d.ts.map
|
package/dist/query.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGnD,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGpD,MAAM,WAAW,iBAAiB;IAC9B,wEAAwE;IACxE,OAAO,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IAChC,+EAA+E;IAC/E,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,QAAQ;IAChD,6BAA6B;IAC7B,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAC;CACjB;
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGnD,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGpD,MAAM,WAAW,iBAAiB;IAC9B,wEAAwE;IACxE,OAAO,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IAChC,+EAA+E;IAC/E,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,QAAQ;IAChD,6BAA6B;IAC7B,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAC;CACjB;AAwBD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,QAAQ,EAC7C,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,KAAK,EAAE,SAAS,EAChB,OAAO,GAAE,iBAAsB,GAChC,gBAAgB,CAAC,CAAC,CAAC,CA6DrB"}
|
package/dist/query.js
CHANGED
|
@@ -6,9 +6,20 @@ function valueOf(item, key, options) {
|
|
|
6
6
|
return column !== void 0 ? getColumnValue(item, column, options.locale ?? "en") : item[key];
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
+
* What a value sorts by: the start of a date range (its end when it has none), the amount of money,
|
|
10
|
+
* or the value itself (decision 0053).
|
|
11
|
+
*/
|
|
12
|
+
function sortValue(value) {
|
|
13
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return value;
|
|
14
|
+
if ("start" in value && "end" in value) return value.start ?? value.end;
|
|
15
|
+
if ("currency" in value && "amount" in value && typeof value.amount === "number") return value.amount;
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
9
19
|
* Applies a list query to items in memory, as a backend would: filters (the value, or one of the
|
|
10
|
-
* values, matches as a string; a range matches the values within its bounds
|
|
11
|
-
*
|
|
20
|
+
* values, matches as a string; a range matches the values within its bounds, and the date ranges
|
|
21
|
+
* that overlap them), search in every text value, sort (a date range by its start, money by its
|
|
22
|
+
* amount), then the page. For a product that has every item at hand.
|
|
12
23
|
*/
|
|
13
24
|
function applyListQuery(items, query, options = {}) {
|
|
14
25
|
const locale = options.locale ?? "en";
|
|
@@ -39,8 +50,8 @@ function applyListQuery(items, query, options = {}) {
|
|
|
39
50
|
for (const part of sort) {
|
|
40
51
|
const descending = part.startsWith("-");
|
|
41
52
|
const key = descending ? part.slice(1) : part;
|
|
42
|
-
const left = valueOf(a, key, options);
|
|
43
|
-
const right = valueOf(b, key, options);
|
|
53
|
+
const left = sortValue(valueOf(a, key, options));
|
|
54
|
+
const right = sortValue(valueOf(b, key, options));
|
|
44
55
|
const order = typeof left === "number" && typeof right === "number" ? left - right : compareText(toText(left, locale), toText(right, locale), collator);
|
|
45
56
|
if (order !== 0) return descending ? -order : order;
|
|
46
57
|
}
|
package/dist/query.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","names":[],"sources":["../src/query.ts"],"sourcesContent":["import type { ListQuery } from '@panneau/protocol';\nimport { isFilterRange, matchesFilterRange } from '@panneau/protocol/runtime';\n\nimport type { ListColumn, ListItem } from './types';\nimport { getColumnValue, toText } from './values';\n\nexport interface LocalQueryOptions {\n /** The columns: values of localized fields are compared in `locale`. */\n columns?: readonly ListColumn[];\n /** Locale of localized values and of the text comparison. Defaults to `en`. */\n locale?: string;\n}\n\nexport interface LocalQueryResult<T extends ListItem> {\n /** The items of the page. */\n items: T[];\n /** How many items match the filters and the search, on every page. */\n total: number;\n}\n\nfunction valueOf(item: ListItem, key: string, options: LocalQueryOptions): unknown {\n const column = options.columns?.find((candidate) => candidate.id === key);\n return column !== undefined ? getColumnValue(item, column, options.locale ?? 'en') : item[key];\n}\n\n/**\n * Applies a list query to items in memory, as a backend would: filters (the value, or one of the\n * values, matches as a string; a range matches the values within its bounds), search in every text\n *
|
|
1
|
+
{"version":3,"file":"query.js","names":["ListQuery","isFilterRange","matchesFilterRange","ListColumn","ListItem","getColumnValue","toText","LocalQueryOptions","columns","locale","LocalQueryResult","items","T","total","valueOf","item","key","options","column","find","candidate","id","undefined","sortValue","value","Array","isArray","start","end","amount","applyListQuery","query","result","Object","entries","filter","forEach","expected","accepted","map","String","values","some","includes","q","trim","toLocaleLowerCase","sort","length","collator","Intl","Collator","numeric","sensitivity","a","b","part","descending","startsWith","slice","left","right","order","compareText","perPage","page","compare"],"sources":["../src/query.ts"],"sourcesContent":["import type { ListQuery } from '@panneau/protocol';\nimport { isFilterRange, matchesFilterRange } from '@panneau/protocol/runtime';\n\nimport type { ListColumn, ListItem } from './types';\nimport { getColumnValue, toText } from './values';\n\nexport interface LocalQueryOptions {\n /** The columns: values of localized fields are compared in `locale`. */\n columns?: readonly ListColumn[];\n /** Locale of localized values and of the text comparison. Defaults to `en`. */\n locale?: string;\n}\n\nexport interface LocalQueryResult<T extends ListItem> {\n /** The items of the page. */\n items: T[];\n /** How many items match the filters and the search, on every page. */\n total: number;\n}\n\nfunction valueOf(item: ListItem, key: string, options: LocalQueryOptions): unknown {\n const column = options.columns?.find((candidate) => candidate.id === key);\n return column !== undefined ? getColumnValue(item, column, options.locale ?? 'en') : item[key];\n}\n\n/**\n * What a value sorts by: the start of a date range (its end when it has none), the amount of money,\n * or the value itself (decision 0053).\n */\nfunction sortValue(value: unknown): unknown {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n return value;\n }\n if ('start' in value && 'end' in value) {\n return value.start ?? value.end;\n }\n if ('currency' in value && 'amount' in value && typeof value.amount === 'number') {\n return value.amount;\n }\n return value;\n}\n\n/**\n * Applies a list query to items in memory, as a backend would: filters (the value, or one of the\n * values, matches as a string; a range matches the values within its bounds, and the date ranges\n * that overlap them), search in every text value, sort (a date range by its start, money by its\n * amount), then the page. For a product that has every item at hand.\n */\nexport function applyListQuery<T extends ListItem>(\n items: readonly T[],\n query: ListQuery,\n options: LocalQueryOptions = {},\n): LocalQueryResult<T> {\n const locale = options.locale ?? 'en';\n let result = [...items];\n Object.entries(query.filter ?? {}).forEach(([key, expected]) => {\n if (isFilterRange(expected)) {\n result = result.filter((item) =>\n matchesFilterRange(valueOf(item, key, options), expected),\n );\n return;\n }\n const accepted = (Array.isArray(expected) ? expected : [expected]).map(String);\n result = result.filter((item) => {\n const value = valueOf(item, key, options);\n const values: unknown[] = Array.isArray(value) ? value : [value];\n return values.some((candidate) => {\n const id =\n candidate !== null && typeof candidate === 'object' && 'id' in candidate\n ? candidate.id\n : candidate;\n return accepted.includes(String(id));\n });\n });\n });\n const q = query.q?.trim().toLocaleLowerCase(locale) ?? '';\n if (q !== '') {\n result = result.filter((item) =>\n Object.entries(item)\n .filter(([key]) => key !== 'id' && key !== 'abilities' && key !== 'version')\n .some(([key]) =>\n toText(valueOf(item, key, options), locale)\n .toLocaleLowerCase(locale)\n .includes(q),\n ),\n );\n }\n const sort = query.sort ?? [];\n if (sort.length > 0) {\n const collator = new Intl.Collator(locale, { numeric: true, sensitivity: 'base' });\n result.sort((a, b) => {\n for (const part of sort) {\n const descending = part.startsWith('-');\n const key = descending ? part.slice(1) : part;\n const left = sortValue(valueOf(a, key, options));\n const right = sortValue(valueOf(b, key, options));\n const order =\n typeof left === 'number' && typeof right === 'number'\n ? left - right\n : compareText(toText(left, locale), toText(right, locale), collator);\n if (order !== 0) {\n return descending ? -order : order;\n }\n }\n return 0;\n });\n }\n const total = result.length;\n if (query.perPage !== undefined) {\n const page = query.page ?? 1;\n result = result.slice((page - 1) * query.perPage, page * query.perPage);\n }\n return { items: result, total };\n}\n\n/** Compares texts, empty ones last. */\nfunction compareText(left: string, right: string, collator: Intl.Collator): number {\n if (left === right) {\n return 0;\n }\n if (left === '') {\n return 1;\n }\n if (right === '') {\n return -1;\n }\n return collator.compare(left, right);\n}\n"],"mappings":";;;AAoBA,SAASc,QAAQC,MAAgBC,KAAaC,SAAqC;CAC/E,MAAMC,SAASD,QAAQT,SAASW,MAAMC,cAAcA,UAAUC,OAAOL,GAAG;CACxE,OAAOE,WAAWI,KAAAA,IAAYjB,eAAeU,MAAMG,QAAQD,QAAQR,UAAU,IAAI,IAAIM,KAAKC;AAC9F;;;;;AAMA,SAASO,UAAUC,OAAyB;CACxC,IAAIA,UAAU,QAAQ,OAAOA,UAAU,YAAYC,MAAMC,QAAQF,KAAK,GAClE,OAAOA;CAEX,IAAI,WAAWA,SAAS,SAASA,OAC7B,OAAOA,MAAMG,SAASH,MAAMI;CAEhC,IAAI,cAAcJ,SAAS,YAAYA,SAAS,OAAOA,MAAMK,WAAW,UACpE,OAAOL,MAAMK;CAEjB,OAAOL;AACX;;;;;;;AAQA,SAAgBM,eACZnB,OACAoB,OACAd,UAA6B,CAAC,GACX;CACnB,MAAMR,SAASQ,QAAQR,UAAU;CACjC,IAAIuB,SAAS,CAAC,GAAGrB,KAAK;CACtBsB,OAAOC,QAAQH,MAAMI,UAAU,CAAC,CAAC,CAAC,CAACC,SAAS,CAACpB,KAAKqB,cAAc;EAC5D,IAAIpC,cAAcoC,QAAQ,GAAG;GACzBL,SAASA,OAAOG,QAAQpB,SACpBb,mBAAmBY,QAAQC,MAA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C,GAAGtC,KAAKC,OAAO,CAAC;IAC/C,MAAM4C,QAAQtC,UAAUT,QAAQyC,GAAGvC,KAAKC,OAAO,CAAC;IAChD,MAAM6C,QACF,OAAOF,SAAS,YAAY,OAAOC,UAAU,WACvCD,OAAOC,QACPE,YAAYzD,OAAOsD,MAAMnD,MAAM,GAAGH,OAAOuD,OAAOpD,MAAM,GAAGwC,QAAQ;IAC3E,IAAIa,UAAU,GACV,OAAOL,aAAa,CAACK,QAAQA;GAErC;GACA,OAAO;EACX,CAAC;CACL;CACA,MAAMjD,QAAQmB,OAAOgB;CACrB,IAAIjB,MAAMiC,YAAY1C,KAAAA,GAAW;EAC7B,MAAM2C,OAAOlC,MAAMkC,QAAQ;EAC3BjC,SAASA,OAAO2B,OAAOM,OAAO,KAAKlC,MAAMiC,SAASC,OAAOlC,MAAMiC,OAAO;CAC1E;CACA,OAAO;EAAErD,OAAOqB;EAAQnB;CAAM;AAClC;;AAGA,SAASkD,YAAYH,MAAcC,OAAeZ,UAAiC;CAC/E,IAAIW,SAASC,OACT,OAAO;CAEX,IAAID,SAAS,IACT,OAAO;CAEX,IAAIC,UAAU,IACV,OAAO;CAEX,OAAOZ,SAASiB,QAAQN,MAAMC,KAAK;AACvC"}
|
package/dist/selection.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ListSelection } from '@panneau/core';
|
|
2
|
-
import type { ListItem } from './types';
|
|
2
|
+
import type { ListItem } from './types.js';
|
|
3
3
|
/** Whether an item is selected. */
|
|
4
4
|
export declare function isItemSelected(selection: ListSelection, id: string): boolean;
|
|
5
5
|
/** How many items are selected, given the total of the list (or the count of items without it). */
|
package/dist/selection.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selection.js","names":[],"sources":["../src/selection.ts"],"sourcesContent":["import type { ListSelection } from '@panneau/core';\n\nimport type { ListItem } from './types';\n\n// The selection is read from the subscribed state, not through the methods of the list\n// (`list.isSelected()`): under the React Compiler, a component that calls a method of an object\n// that doesn't change would keep its first result.\n\n/** Whether an item is selected. */\nexport function isItemSelected(selection: ListSelection, id: string): boolean {\n return selection.mode === 'all' ? !selection.except.includes(id) : selection.ids.includes(id);\n}\n\n/** How many items are selected, given the total of the list (or the count of items without it). */\nexport function countSelected(selection: ListSelection, total: number): number {\n return selection.mode === 'all'\n ? Math.max(0, total - selection.except.length)\n : selection.ids.length;\n}\n\n/** Whether every, some or none of the items of a page are selected. */\nexport function getPageSelection(\n selection: ListSelection,\n items: readonly ListItem[],\n): 'all' | 'some' | 'none' {\n const selected = items.filter((item) => isItemSelected(selection, item.id)).length;\n if (selected === 0 || items.length === 0) {\n return 'none';\n }\n return selected === items.length ? 'all' : 'some';\n}\n"],"mappings":";;AASA,
|
|
1
|
+
{"version":3,"file":"selection.js","names":["ListSelection","ListItem","isItemSelected","selection","id","mode","except","includes","ids","countSelected","total","Math","max","length","getPageSelection","items","selected","filter","item"],"sources":["../src/selection.ts"],"sourcesContent":["import type { ListSelection } from '@panneau/core';\n\nimport type { ListItem } from './types';\n\n// The selection is read from the subscribed state, not through the methods of the list\n// (`list.isSelected()`): under the React Compiler, a component that calls a method of an object\n// that doesn't change would keep its first result.\n\n/** Whether an item is selected. */\nexport function isItemSelected(selection: ListSelection, id: string): boolean {\n return selection.mode === 'all' ? !selection.except.includes(id) : selection.ids.includes(id);\n}\n\n/** How many items are selected, given the total of the list (or the count of items without it). */\nexport function countSelected(selection: ListSelection, total: number): number {\n return selection.mode === 'all'\n ? Math.max(0, total - selection.except.length)\n : selection.ids.length;\n}\n\n/** Whether every, some or none of the items of a page are selected. */\nexport function getPageSelection(\n selection: ListSelection,\n items: readonly ListItem[],\n): 'all' | 'some' | 'none' {\n const selected = items.filter((item) => isItemSelected(selection, item.id)).length;\n if (selected === 0 || items.length === 0) {\n return 'none';\n }\n return selected === items.length ? 'all' : 'some';\n}\n"],"mappings":";;AASA,SAAgBE,eAAeC,WAA0BC,IAAqB;CAC1E,OAAOD,UAAUE,SAAS,QAAQ,CAACF,UAAUG,OAAOC,SAASH,EAAE,IAAID,UAAUK,IAAID,SAASH,EAAE;AAChG;;AAGA,SAAgBK,cAAcN,WAA0BO,OAAuB;CAC3E,OAAOP,UAAUE,SAAS,QACpBM,KAAKC,IAAI,GAAGF,QAAQP,UAAUG,OAAOO,MAAM,IAC3CV,UAAUK,IAAIK;AACxB;;AAGA,SAAgBC,iBACZX,WACAY,OACuB;CACvB,MAAMC,WAAWD,MAAME,QAAQC,SAAShB,eAAeC,WAAWe,KAAKd,EAAE,CAAC,CAAC,CAACS;CAC5E,IAAIG,aAAa,KAAKD,MAAMF,WAAW,GACnC,OAAO;CAEX,OAAOG,aAAaD,MAAMF,SAAS,QAAQ;AAC/C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ListColumn } from '../types.js';
|
|
2
|
+
export interface ColumnMenuProps {
|
|
3
|
+
/** Every column of the list, in the order of the definition. */
|
|
4
|
+
columns: readonly ListColumn[];
|
|
5
|
+
/** The columns shown, in their order. */
|
|
6
|
+
shown: readonly ListColumn[];
|
|
7
|
+
/** Shows these columns, by id, in this order. */
|
|
8
|
+
onChange: (ids: string[]) => void;
|
|
9
|
+
/** Back to the columns of the definition, or `null` while they are shown. */
|
|
10
|
+
onReset: (() => void) | null;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A button that opens the columns of a list: a checkbox to show or hide each one, buttons to
|
|
14
|
+
* move the shown ones, and a reset to the columns of the definition (decision 0042).
|
|
15
|
+
*/
|
|
16
|
+
export declare function ColumnMenu({ columns, shown, onChange, onReset }: ColumnMenuProps): import("react").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=ColumnMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColumnMenu.d.ts","sourceRoot":"","sources":["../../src/toolbar/ColumnMenu.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG3C,MAAM,WAAW,eAAe;IAC5B,gEAAgE;IAChE,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;IAC/B,yCAAyC;IACzC,KAAK,EAAE,SAAS,UAAU,EAAE,CAAC;IAC7B,iDAAiD;IACjD,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAClC,6EAA6E;IAC7E,OAAO,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC;CAChC;AAMD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,eAAe,+BAmFhF"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { messages } from "../messages.js";
|
|
2
|
+
import Toolbar_module_default from "./Toolbar.module.js";
|
|
3
|
+
import { c } from "react/compiler-runtime";
|
|
4
|
+
import { Button, Checkbox, IconButton, Popover, PopoverTrigger, usePanneauIntl } from "@panneau/ui";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { ArrowDown, ArrowUp, Columns3 } from "lucide-react";
|
|
7
|
+
//#region src/toolbar/ColumnMenu.tsx
|
|
8
|
+
function labelOf(column) {
|
|
9
|
+
return typeof column.label === "string" ? column.label : column.id;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A button that opens the columns of a list: a checkbox to show or hide each one, buttons to
|
|
13
|
+
* move the shown ones, and a reset to the columns of the definition (decision 0042).
|
|
14
|
+
*/
|
|
15
|
+
function ColumnMenu(t0) {
|
|
16
|
+
const $ = c(42);
|
|
17
|
+
const { columns, shown, onChange, onReset } = t0;
|
|
18
|
+
const intl = usePanneauIntl();
|
|
19
|
+
let T0;
|
|
20
|
+
let T1;
|
|
21
|
+
let t1;
|
|
22
|
+
let t2;
|
|
23
|
+
let t3;
|
|
24
|
+
let t4;
|
|
25
|
+
let t5;
|
|
26
|
+
let t6;
|
|
27
|
+
if ($[0] !== columns || $[1] !== intl || $[2] !== onChange || $[3] !== shown) {
|
|
28
|
+
const ids = shown.map(_temp);
|
|
29
|
+
const ordered = [...shown, ...columns.filter((column_0) => !shown.includes(column_0))];
|
|
30
|
+
const move = (index, offset) => {
|
|
31
|
+
const next = [...ids];
|
|
32
|
+
const [id] = next.splice(index, 1);
|
|
33
|
+
if (id !== void 0) {
|
|
34
|
+
next.splice(index + offset, 0, id);
|
|
35
|
+
onChange(next);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
T1 = PopoverTrigger;
|
|
39
|
+
let t7;
|
|
40
|
+
if ($[12] !== intl) {
|
|
41
|
+
t7 = intl.formatMessage(messages.columns);
|
|
42
|
+
$[12] = intl;
|
|
43
|
+
$[13] = t7;
|
|
44
|
+
} else t7 = $[13];
|
|
45
|
+
if ($[14] !== t7) {
|
|
46
|
+
t6 = /* @__PURE__ */ jsx(Button, {
|
|
47
|
+
icon: Columns3,
|
|
48
|
+
children: t7
|
|
49
|
+
});
|
|
50
|
+
$[14] = t7;
|
|
51
|
+
$[15] = t6;
|
|
52
|
+
} else t6 = $[15];
|
|
53
|
+
T0 = Popover;
|
|
54
|
+
t4 = "bottom end";
|
|
55
|
+
if ($[16] !== intl) {
|
|
56
|
+
t5 = intl.formatMessage(messages.columns);
|
|
57
|
+
$[16] = intl;
|
|
58
|
+
$[17] = t5;
|
|
59
|
+
} else t5 = $[17];
|
|
60
|
+
t3 = Toolbar_module_default.columns;
|
|
61
|
+
t1 = Toolbar_module_default.columnList;
|
|
62
|
+
t2 = ordered.map((column_1) => {
|
|
63
|
+
const index_0 = ids.indexOf(column_1.id);
|
|
64
|
+
const isShown = index_0 !== -1;
|
|
65
|
+
const label = labelOf(column_1);
|
|
66
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
67
|
+
className: Toolbar_module_default.column,
|
|
68
|
+
children: [/* @__PURE__ */ jsx(Checkbox, {
|
|
69
|
+
isSelected: isShown,
|
|
70
|
+
isDisabled: column_1.hideable === false || isShown && ids.length === 1,
|
|
71
|
+
onChange: (selected) => onChange(selected ? [...ids, column_1.id] : ids.filter((id_0) => id_0 !== column_1.id)),
|
|
72
|
+
className: Toolbar_module_default.columnLabel,
|
|
73
|
+
children: label
|
|
74
|
+
}), isShown ? /* @__PURE__ */ jsxs("span", {
|
|
75
|
+
className: Toolbar_module_default.columnMoves,
|
|
76
|
+
children: [/* @__PURE__ */ jsx(IconButton, {
|
|
77
|
+
icon: ArrowUp,
|
|
78
|
+
size: "sm",
|
|
79
|
+
label: intl.formatMessage(messages.moveColumnUp, { column: label }),
|
|
80
|
+
showTooltip: false,
|
|
81
|
+
isDisabled: index_0 === 0,
|
|
82
|
+
onPress: () => move(index_0, -1)
|
|
83
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
84
|
+
icon: ArrowDown,
|
|
85
|
+
size: "sm",
|
|
86
|
+
label: intl.formatMessage(messages.moveColumnDown, { column: label }),
|
|
87
|
+
showTooltip: false,
|
|
88
|
+
isDisabled: index_0 === ids.length - 1,
|
|
89
|
+
onPress: () => move(index_0, 1)
|
|
90
|
+
})]
|
|
91
|
+
}) : null]
|
|
92
|
+
}, column_1.id);
|
|
93
|
+
});
|
|
94
|
+
$[0] = columns;
|
|
95
|
+
$[1] = intl;
|
|
96
|
+
$[2] = onChange;
|
|
97
|
+
$[3] = shown;
|
|
98
|
+
$[4] = T0;
|
|
99
|
+
$[5] = T1;
|
|
100
|
+
$[6] = t1;
|
|
101
|
+
$[7] = t2;
|
|
102
|
+
$[8] = t3;
|
|
103
|
+
$[9] = t4;
|
|
104
|
+
$[10] = t5;
|
|
105
|
+
$[11] = t6;
|
|
106
|
+
} else {
|
|
107
|
+
T0 = $[4];
|
|
108
|
+
T1 = $[5];
|
|
109
|
+
t1 = $[6];
|
|
110
|
+
t2 = $[7];
|
|
111
|
+
t3 = $[8];
|
|
112
|
+
t4 = $[9];
|
|
113
|
+
t5 = $[10];
|
|
114
|
+
t6 = $[11];
|
|
115
|
+
}
|
|
116
|
+
let t7;
|
|
117
|
+
if ($[18] !== t1 || $[19] !== t2) {
|
|
118
|
+
t7 = /* @__PURE__ */ jsx("ul", {
|
|
119
|
+
className: t1,
|
|
120
|
+
children: t2
|
|
121
|
+
});
|
|
122
|
+
$[18] = t1;
|
|
123
|
+
$[19] = t2;
|
|
124
|
+
$[20] = t7;
|
|
125
|
+
} else t7 = $[20];
|
|
126
|
+
const t8 = onReset === null;
|
|
127
|
+
let t9;
|
|
128
|
+
if ($[21] !== onReset) {
|
|
129
|
+
t9 = () => onReset?.();
|
|
130
|
+
$[21] = onReset;
|
|
131
|
+
$[22] = t9;
|
|
132
|
+
} else t9 = $[22];
|
|
133
|
+
let t10;
|
|
134
|
+
if ($[23] !== intl) {
|
|
135
|
+
t10 = intl.formatMessage(messages.resetColumns);
|
|
136
|
+
$[23] = intl;
|
|
137
|
+
$[24] = t10;
|
|
138
|
+
} else t10 = $[24];
|
|
139
|
+
let t11;
|
|
140
|
+
if ($[25] !== t10 || $[26] !== t8 || $[27] !== t9) {
|
|
141
|
+
t11 = /* @__PURE__ */ jsx(Button, {
|
|
142
|
+
size: "sm",
|
|
143
|
+
appearance: "ghost",
|
|
144
|
+
isDisabled: t8,
|
|
145
|
+
onPress: t9,
|
|
146
|
+
children: t10
|
|
147
|
+
});
|
|
148
|
+
$[25] = t10;
|
|
149
|
+
$[26] = t8;
|
|
150
|
+
$[27] = t9;
|
|
151
|
+
$[28] = t11;
|
|
152
|
+
} else t11 = $[28];
|
|
153
|
+
let t12;
|
|
154
|
+
if ($[29] !== t11 || $[30] !== t3 || $[31] !== t7) {
|
|
155
|
+
t12 = /* @__PURE__ */ jsxs("div", {
|
|
156
|
+
className: t3,
|
|
157
|
+
children: [t7, t11]
|
|
158
|
+
});
|
|
159
|
+
$[29] = t11;
|
|
160
|
+
$[30] = t3;
|
|
161
|
+
$[31] = t7;
|
|
162
|
+
$[32] = t12;
|
|
163
|
+
} else t12 = $[32];
|
|
164
|
+
let t13;
|
|
165
|
+
if ($[33] !== T0 || $[34] !== t12 || $[35] !== t4 || $[36] !== t5) {
|
|
166
|
+
t13 = /* @__PURE__ */ jsx(T0, {
|
|
167
|
+
placement: t4,
|
|
168
|
+
"aria-label": t5,
|
|
169
|
+
children: t12
|
|
170
|
+
});
|
|
171
|
+
$[33] = T0;
|
|
172
|
+
$[34] = t12;
|
|
173
|
+
$[35] = t4;
|
|
174
|
+
$[36] = t5;
|
|
175
|
+
$[37] = t13;
|
|
176
|
+
} else t13 = $[37];
|
|
177
|
+
let t14;
|
|
178
|
+
if ($[38] !== T1 || $[39] !== t13 || $[40] !== t6) {
|
|
179
|
+
t14 = /* @__PURE__ */ jsxs(T1, { children: [t6, t13] });
|
|
180
|
+
$[38] = T1;
|
|
181
|
+
$[39] = t13;
|
|
182
|
+
$[40] = t6;
|
|
183
|
+
$[41] = t14;
|
|
184
|
+
} else t14 = $[41];
|
|
185
|
+
return t14;
|
|
186
|
+
}
|
|
187
|
+
function _temp(column) {
|
|
188
|
+
return column.id;
|
|
189
|
+
}
|
|
190
|
+
//#endregion
|
|
191
|
+
export { ColumnMenu };
|
|
192
|
+
|
|
193
|
+
//# sourceMappingURL=ColumnMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColumnMenu.js","names":["ArrowDown","ArrowUp","Columns3","Button","Checkbox","IconButton","Popover","PopoverTrigger","usePanneauIntl","messages","ListColumn","styles","ColumnMenuProps","columns","shown","onChange","ids","onReset","labelOf","column","label","id","ColumnMenu","t0","$","_c","intl","T0","T1","t1","t2","t3","t4","t5","t6","map","_temp","ordered","filter","column_0","includes","move","index","offset","next","splice","undefined","t7","formatMessage","columnList","column_1","index_0","indexOf","isShown","hideable","length","selected","id_0","columnLabel","columnMoves","moveColumnUp","moveColumnDown","t8","t9","t10","resetColumns","t11","t12","t13","t14","_c","styles"],"sources":["../../src/toolbar/ColumnMenu.tsx"],"sourcesContent":["import { ArrowDown, ArrowUp, Columns3 } from 'lucide-react';\n\nimport { Button, Checkbox, IconButton, Popover, PopoverTrigger, usePanneauIntl } from '@panneau/ui';\n\nimport { messages } from '../messages';\nimport type { ListColumn } from '../types';\nimport styles from './Toolbar.module.css';\n\nexport interface ColumnMenuProps {\n /** Every column of the list, in the order of the definition. */\n columns: readonly ListColumn[];\n /** The columns shown, in their order. */\n shown: readonly ListColumn[];\n /** Shows these columns, by id, in this order. */\n onChange: (ids: string[]) => void;\n /** Back to the columns of the definition, or `null` while they are shown. */\n onReset: (() => void) | null;\n}\n\nfunction labelOf(column: ListColumn): string {\n return typeof column.label === 'string' ? column.label : column.id;\n}\n\n/**\n * A button that opens the columns of a list: a checkbox to show or hide each one, buttons to\n * move the shown ones, and a reset to the columns of the definition (decision 0042).\n */\nexport function ColumnMenu({ columns, shown, onChange, onReset }: ColumnMenuProps) {\n const intl = usePanneauIntl();\n const ids = shown.map((column) => column.id);\n // The shown columns first, in their order, then the others, where showing one adds it.\n const ordered = [...shown, ...columns.filter((column) => !shown.includes(column))];\n const move = (index: number, offset: number) => {\n const next = [...ids];\n const [id] = next.splice(index, 1);\n if (id !== undefined) {\n next.splice(index + offset, 0, id);\n onChange(next);\n }\n };\n return (\n <PopoverTrigger>\n <Button icon={Columns3}>{intl.formatMessage(messages.columns)}</Button>\n <Popover placement=\"bottom end\" aria-label={intl.formatMessage(messages.columns)}>\n <div className={styles.columns}>\n <ul className={styles.columnList}>\n {ordered.map((column) => {\n const index = ids.indexOf(column.id);\n const isShown = index !== -1;\n const label = labelOf(column);\n return (\n <li key={column.id} className={styles.column}>\n <Checkbox\n isSelected={isShown}\n // The last column shown stays: a list shows something.\n isDisabled={\n column.hideable === false ||\n (isShown && ids.length === 1)\n }\n onChange={(selected) =>\n onChange(\n selected\n ? [...ids, column.id]\n : ids.filter((id) => id !== column.id),\n )\n }\n className={styles.columnLabel}\n >\n {label}\n </Checkbox>\n {isShown ? (\n <span className={styles.columnMoves}>\n <IconButton\n icon={ArrowUp}\n size=\"sm\"\n label={intl.formatMessage(messages.moveColumnUp, {\n column: label,\n })}\n showTooltip={false}\n isDisabled={index === 0}\n onPress={() => move(index, -1)}\n />\n <IconButton\n icon={ArrowDown}\n size=\"sm\"\n label={intl.formatMessage(messages.moveColumnDown, {\n column: label,\n })}\n showTooltip={false}\n isDisabled={index === ids.length - 1}\n onPress={() => move(index, 1)}\n />\n </span>\n ) : null}\n </li>\n );\n })}\n </ul>\n <Button\n size=\"sm\"\n appearance=\"ghost\"\n isDisabled={onReset === null}\n onPress={() => onReset?.()}\n >\n {intl.formatMessage(messages.resetColumns)}\n </Button>\n </div>\n </Popover>\n </PopoverTrigger>\n );\n}\n"],"mappings":";;;;;;;AAmBA,SAASkB,QAAQC,QAA4B;CACzC,OAAO,OAAOA,OAAOC,UAAU,WAAWD,OAAOC,QAAQD,OAAOE;AACpE;;;;;AAMA,SAAOC,WAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAoB,MAAA,EAAAZ,SAAAC,OAAAC,UAAAE,YAAAM;CACvB,MAAAG,OAAalB,eAAe;CAAE,IAAAmB;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAV,EAAA,OAAAX,WAAAW,EAAA,OAAAE,QAAAF,EAAA,OAAAT,YAAAS,EAAA,OAAAV,OAAA;EAC9B,MAAAE,MAAYF,MAAKqB,IAAKC,KAAqB;EAE3C,MAAAC,UAAgB,CAAA,GAAIvB,OAAK,GAAKD,QAAOyB,QAAQC,aAAY,CAACzB,MAAK0B,SAAUrB,QAAM,CAAC,CAAC;EACjF,MAAAsB,QAAaC,OAAAC,WAAA;GACT,MAAAC,OAAa,CAAA,GAAI5B,GAAG;GACpB,MAAA,CAAAK,MAAauB,KAAIC,OAAQH,OAAO,CAAC;GACjC,IAAIrB,OAAOyB,KAAAA,GAAS;IAChBF,KAAIC,OAAQH,QAAQC,QAAQ,GAAGtB,EAA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,CACInC,IACAkC,GAFW,EAAA,CAAA;EAmEE5C,EAAA,MAAAI;EAAAJ,EAAA,MAAA4C;EAAA5C,EAAA,MAAAU;EAAAV,EAAA,MAAA6C;CAAA,OAAAA,MAAA7C,EAAA;CAAA,OAnEjB6C;AAmEiB;AAjFlB,SAAAjC,MAAAjB,QAAA;CAAA,OAE+BA,OAAME;AAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayoutSwitch.d.ts","sourceRoot":"","sources":["../../src/toolbar/LayoutSwitch.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LayoutSwitch.d.ts","sourceRoot":"","sources":["../../src/toolbar/LayoutSwitch.tsx"],"names":[],"mappings":"AAeA,MAAM,WAAW,iBAAiB;IAC9B,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,iBAAiB,+BAsC3E"}
|
|
@@ -3,16 +3,18 @@ import Toolbar_module_default from "./Toolbar.module.js";
|
|
|
3
3
|
import { c } from "react/compiler-runtime";
|
|
4
4
|
import { Icon, Tooltip, usePanneauIntl } from "@panneau/ui";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
import { LayoutGrid, Rows3, Square } from "lucide-react";
|
|
6
|
+
import { CalendarDays, Images, LayoutGrid, Rows3, Square } from "lucide-react";
|
|
7
7
|
import { ToggleButton, ToggleButtonGroup } from "react-aria-components";
|
|
8
8
|
//#region src/toolbar/LayoutSwitch.tsx
|
|
9
9
|
var ICONS = {
|
|
10
10
|
table: Rows3,
|
|
11
|
-
cards: LayoutGrid
|
|
11
|
+
cards: LayoutGrid,
|
|
12
|
+
gallery: Images,
|
|
13
|
+
calendar: CalendarDays
|
|
12
14
|
};
|
|
13
15
|
/** Buttons to show the items as a table, as cards, or in a plugin's layout. */
|
|
14
16
|
function LayoutSwitch(t0) {
|
|
15
|
-
const $ = c(
|
|
17
|
+
const $ = c(29);
|
|
16
18
|
const { layouts, value, onChange } = t0;
|
|
17
19
|
const intl = usePanneauIntl();
|
|
18
20
|
let t1;
|
|
@@ -28,42 +30,58 @@ function LayoutSwitch(t0) {
|
|
|
28
30
|
$[3] = t2;
|
|
29
31
|
} else t2 = $[3];
|
|
30
32
|
let t3;
|
|
31
|
-
if ($[4] !==
|
|
32
|
-
t3 =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
$[4] = t1;
|
|
37
|
-
$[5] = t2;
|
|
38
|
-
$[6] = t3;
|
|
39
|
-
} else t3 = $[6];
|
|
40
|
-
const labels = t3;
|
|
33
|
+
if ($[4] !== intl) {
|
|
34
|
+
t3 = intl.formatMessage(messages.layoutGallery);
|
|
35
|
+
$[4] = intl;
|
|
36
|
+
$[5] = t3;
|
|
37
|
+
} else t3 = $[5];
|
|
41
38
|
let t4;
|
|
42
|
-
if ($[
|
|
43
|
-
t4 = intl.formatMessage(messages.
|
|
44
|
-
$[
|
|
45
|
-
$[
|
|
46
|
-
} else t4 = $[
|
|
39
|
+
if ($[6] !== intl) {
|
|
40
|
+
t4 = intl.formatMessage(messages.layoutCalendar);
|
|
41
|
+
$[6] = intl;
|
|
42
|
+
$[7] = t4;
|
|
43
|
+
} else t4 = $[7];
|
|
47
44
|
let t5;
|
|
48
|
-
if ($[9] !==
|
|
49
|
-
t5 =
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
if ($[8] !== t1 || $[9] !== t2 || $[10] !== t3 || $[11] !== t4) {
|
|
46
|
+
t5 = {
|
|
47
|
+
table: t1,
|
|
48
|
+
cards: t2,
|
|
49
|
+
gallery: t3,
|
|
50
|
+
calendar: t4
|
|
51
|
+
};
|
|
52
|
+
$[8] = t1;
|
|
53
|
+
$[9] = t2;
|
|
54
|
+
$[10] = t3;
|
|
55
|
+
$[11] = t4;
|
|
56
|
+
$[12] = t5;
|
|
57
|
+
} else t5 = $[12];
|
|
58
|
+
const labels = t5;
|
|
53
59
|
let t6;
|
|
54
|
-
if ($[
|
|
55
|
-
t6 = (
|
|
60
|
+
if ($[13] !== intl) {
|
|
61
|
+
t6 = intl.formatMessage(messages.layout);
|
|
62
|
+
$[13] = intl;
|
|
63
|
+
$[14] = t6;
|
|
64
|
+
} else t6 = $[14];
|
|
65
|
+
let t7;
|
|
66
|
+
if ($[15] !== value) {
|
|
67
|
+
t7 = [value];
|
|
68
|
+
$[15] = value;
|
|
69
|
+
$[16] = t7;
|
|
70
|
+
} else t7 = $[16];
|
|
71
|
+
let t8;
|
|
72
|
+
if ($[17] !== onChange) {
|
|
73
|
+
t8 = (keys) => {
|
|
56
74
|
const [next] = [...keys];
|
|
57
75
|
if (next !== void 0) onChange(String(next));
|
|
58
76
|
};
|
|
59
|
-
$[
|
|
60
|
-
$[
|
|
61
|
-
} else
|
|
62
|
-
let
|
|
63
|
-
if ($[
|
|
64
|
-
let
|
|
65
|
-
if ($[
|
|
66
|
-
|
|
77
|
+
$[17] = onChange;
|
|
78
|
+
$[18] = t8;
|
|
79
|
+
} else t8 = $[18];
|
|
80
|
+
let t9;
|
|
81
|
+
if ($[19] !== labels || $[20] !== layouts) {
|
|
82
|
+
let t10;
|
|
83
|
+
if ($[22] !== labels) {
|
|
84
|
+
t10 = (layout) => {
|
|
67
85
|
const label = labels[layout] ?? layout;
|
|
68
86
|
return /* @__PURE__ */ jsx(Tooltip, {
|
|
69
87
|
content: label,
|
|
@@ -75,32 +93,32 @@ function LayoutSwitch(t0) {
|
|
|
75
93
|
})
|
|
76
94
|
}, layout);
|
|
77
95
|
};
|
|
78
|
-
$[
|
|
79
|
-
$[
|
|
80
|
-
} else
|
|
81
|
-
|
|
82
|
-
$[
|
|
83
|
-
$[
|
|
84
|
-
$[
|
|
85
|
-
} else
|
|
86
|
-
let
|
|
87
|
-
if ($[
|
|
88
|
-
|
|
89
|
-
"aria-label":
|
|
96
|
+
$[22] = labels;
|
|
97
|
+
$[23] = t10;
|
|
98
|
+
} else t10 = $[23];
|
|
99
|
+
t9 = layouts.map(t10);
|
|
100
|
+
$[19] = labels;
|
|
101
|
+
$[20] = layouts;
|
|
102
|
+
$[21] = t9;
|
|
103
|
+
} else t9 = $[21];
|
|
104
|
+
let t10;
|
|
105
|
+
if ($[24] !== t6 || $[25] !== t7 || $[26] !== t8 || $[27] !== t9) {
|
|
106
|
+
t10 = /* @__PURE__ */ jsx(ToggleButtonGroup, {
|
|
107
|
+
"aria-label": t6,
|
|
90
108
|
selectionMode: "single",
|
|
91
109
|
disallowEmptySelection: true,
|
|
92
|
-
selectedKeys:
|
|
93
|
-
onSelectionChange:
|
|
110
|
+
selectedKeys: t7,
|
|
111
|
+
onSelectionChange: t8,
|
|
94
112
|
className: Toolbar_module_default.layouts,
|
|
95
|
-
children:
|
|
113
|
+
children: t9
|
|
96
114
|
});
|
|
97
|
-
$[
|
|
98
|
-
$[
|
|
99
|
-
$[
|
|
100
|
-
$[
|
|
101
|
-
$[
|
|
102
|
-
} else
|
|
103
|
-
return
|
|
115
|
+
$[24] = t6;
|
|
116
|
+
$[25] = t7;
|
|
117
|
+
$[26] = t8;
|
|
118
|
+
$[27] = t9;
|
|
119
|
+
$[28] = t10;
|
|
120
|
+
} else t10 = $[28];
|
|
121
|
+
return t10;
|
|
104
122
|
}
|
|
105
123
|
//#endregion
|
|
106
124
|
export { LayoutSwitch };
|