@alulore/kumiko 0.18.3 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dialog/ask.d.ts +7 -0
- package/dist/dialog/ask.js +8 -0
- package/dist/dialog/dialog-content.d.ts +23 -0
- package/dist/dialog/dialog-content.js +15 -0
- package/dist/dialog/dialog-entry.d.ts +14 -0
- package/dist/dialog/dialog-entry.js +111 -0
- package/dist/dialog/dialog-labels.d.ts +23 -0
- package/dist/dialog/dialog-labels.js +16 -0
- package/dist/dialog/dialog-store.d.ts +139 -0
- package/dist/dialog/dialog-store.js +296 -0
- package/dist/dialog/dialog.css +36 -0
- package/dist/dialog/dialog.d.ts +0 -3
- package/dist/dialog/dialog.js +0 -6
- package/dist/dialog/index.d.ts +8 -2
- package/dist/dialog/index.js +7 -2
- package/dist/dialog/leave-guard.d.ts +24 -0
- package/dist/dialog/leave-guard.js +98 -0
- package/dist/dialog/nest.d.ts +14 -0
- package/dist/dialog/nest.js +26 -0
- package/dist/dialog/open-dialog.d.ts +16 -0
- package/dist/dialog/open-dialog.js +13 -0
- package/dist/dialog/overlay-host.d.ts +27 -0
- package/dist/dialog/overlay-host.js +56 -0
- package/dist/dialog/question-dialog.d.ts +21 -0
- package/dist/dialog/question-dialog.js +78 -0
- package/dist/drawer/drawer.css +18 -16
- package/dist/menu/menu.css +21 -17
- package/dist/otp-input/otp-input.css +38 -37
- package/dist/page/index.d.ts +8 -0
- package/dist/page/index.js +8 -0
- package/dist/page/page-action.d.ts +26 -0
- package/dist/page/page-action.js +23 -0
- package/dist/page/page-actions.d.ts +10 -0
- package/dist/page/page-actions.js +66 -0
- package/dist/page/page-back.d.ts +11 -0
- package/dist/page/page-back.js +17 -0
- package/dist/page/page-breadcrumbs.d.ts +21 -0
- package/dist/page/page-breadcrumbs.js +60 -0
- package/dist/page/page-context.d.ts +5 -0
- package/dist/page/page-context.js +13 -0
- package/dist/page/page-fit.d.ts +26 -0
- package/dist/page/page-fit.js +36 -0
- package/dist/page/page-header.d.ts +26 -0
- package/dist/page/page-header.js +16 -0
- package/dist/page/page-icons.d.ts +4 -0
- package/dist/page/page-icons.js +13 -0
- package/dist/page/page-labels.d.ts +12 -0
- package/dist/page/page-labels.js +6 -0
- package/dist/page/page-section.d.ts +14 -0
- package/dist/page/page-section.js +9 -0
- package/dist/page/page.css +422 -0
- package/dist/page/page.d.ts +16 -0
- package/dist/page/page.js +12 -0
- package/dist/page/use-measured-fit.d.ts +22 -0
- package/dist/page/use-measured-fit.js +75 -0
- package/dist/page/use-stuck.d.ts +7 -0
- package/dist/page/use-stuck.js +31 -0
- package/dist/pagination/index.d.ts +3 -0
- package/dist/pagination/index.js +3 -0
- package/dist/pagination/pagination-extras.d.ts +28 -0
- package/dist/pagination/pagination-extras.js +42 -0
- package/dist/pagination/pagination-fit.d.ts +15 -0
- package/dist/pagination/pagination-fit.js +52 -0
- package/dist/pagination/pagination-icons.d.ts +4 -0
- package/dist/pagination/pagination-icons.js +16 -0
- package/dist/pagination/pagination-labels.d.ts +23 -0
- package/dist/pagination/pagination-labels.js +14 -0
- package/dist/pagination/pagination-math.d.ts +7 -0
- package/dist/pagination/pagination-math.js +24 -0
- package/dist/pagination/pagination-motion.d.ts +6 -0
- package/dist/pagination/pagination-motion.js +71 -0
- package/dist/pagination/pagination.css +455 -0
- package/dist/pagination/pagination.d.ts +59 -0
- package/dist/pagination/pagination.js +77 -0
- package/dist/select/select.css +6 -10
- package/dist/server-render.test.js +49 -0
- package/dist/sidebar/app-shell.d.ts +54 -0
- package/dist/sidebar/app-shell.js +28 -0
- package/dist/sidebar/index.d.ts +9 -0
- package/dist/sidebar/index.js +8 -0
- package/dist/sidebar/shell-context.d.ts +30 -0
- package/dist/sidebar/shell-context.js +20 -0
- package/dist/sidebar/shell-sheet.d.ts +7 -0
- package/dist/sidebar/shell-sheet.js +12 -0
- package/dist/sidebar/shell-top-bar.d.ts +8 -0
- package/dist/sidebar/shell-top-bar.js +25 -0
- package/dist/sidebar/sidebar-body.d.ts +5 -0
- package/dist/sidebar/sidebar-body.js +37 -0
- package/dist/sidebar/sidebar-icons.d.ts +4 -0
- package/dist/sidebar/sidebar-icons.js +13 -0
- package/dist/sidebar/sidebar-item.d.ts +26 -0
- package/dist/sidebar/sidebar-item.js +68 -0
- package/dist/sidebar/sidebar-labels.d.ts +14 -0
- package/dist/sidebar/sidebar-labels.js +7 -0
- package/dist/sidebar/sidebar-marker.d.ts +12 -0
- package/dist/sidebar/sidebar-marker.js +77 -0
- package/dist/sidebar/sidebar-storage.d.ts +18 -0
- package/dist/sidebar/sidebar-storage.js +27 -0
- package/dist/sidebar/sidebar-toggle.d.ts +7 -0
- package/dist/sidebar/sidebar-toggle.js +18 -0
- package/dist/sidebar/sidebar.css +587 -0
- package/dist/sidebar/sidebar.d.ts +19 -0
- package/dist/sidebar/sidebar.js +31 -0
- package/dist/sidebar/use-collapsed.d.ts +13 -0
- package/dist/sidebar/use-collapsed.js +20 -0
- package/dist/sidebar/use-narrow.d.ts +4 -0
- package/dist/sidebar/use-narrow.js +18 -0
- package/dist/sidebar/use-shell-focus.d.ts +8 -0
- package/dist/sidebar/use-shell-focus.js +30 -0
- package/dist/sidebar/use-shell-shortcut.d.ts +4 -0
- package/dist/sidebar/use-shell-shortcut.js +32 -0
- package/dist/sidebar/use-shell-state.d.ts +18 -0
- package/dist/sidebar/use-shell-state.js +47 -0
- package/dist/slider/slider.css +9 -6
- package/dist/smooth-caret/caret-geometry.js +10 -4
- package/dist/table/data-table-props.d.ts +96 -0
- package/dist/table/data-table-props.js +1 -0
- package/dist/table/data-table.d.ts +7 -0
- package/dist/table/data-table.js +59 -0
- package/dist/table/index.d.ts +7 -0
- package/dist/table/index.js +5 -0
- package/dist/table/table-actions.d.ts +9 -0
- package/dist/table/table-actions.js +24 -0
- package/dist/table/table-builder.d.ts +60 -0
- package/dist/table/table-builder.js +99 -0
- package/dist/table/table-cells.d.ts +19 -0
- package/dist/table/table-cells.js +67 -0
- package/dist/table/table-columns.d.ts +38 -0
- package/dist/table/table-columns.js +119 -0
- package/dist/table/table-icons.d.ts +3 -0
- package/dist/table/table-icons.js +8 -0
- package/dist/table/table-labels.d.ts +24 -0
- package/dist/table/table-labels.js +17 -0
- package/dist/table/table-model.d.ts +28 -0
- package/dist/table/table-model.js +69 -0
- package/dist/table/table-sections.d.ts +25 -0
- package/dist/table/table-sections.js +79 -0
- package/dist/table/table-state.d.ts +42 -0
- package/dist/table/table-state.js +81 -0
- package/dist/table/table-types.d.ts +86 -0
- package/dist/table/table-types.js +1 -0
- package/dist/table/table.css +919 -0
- package/dist/table/use-table-view.d.ts +30 -0
- package/dist/table/use-table-view.js +147 -0
- package/dist/toast/index.d.ts +1 -2
- package/dist/toast/index.js +1 -2
- package/package.json +44 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cloneElement } from "react";
|
|
3
|
+
import { Checkbox } from "../checkbox";
|
|
4
|
+
import { RowActions } from "./table-actions";
|
|
5
|
+
import { isActionsColumn } from "./table-columns";
|
|
6
|
+
/** Any element accepts these props: they land on whatever the app's link renders. */
|
|
7
|
+
function takesExtras(_element) {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
function withExtras(element, extras) {
|
|
11
|
+
return takesExtras(element) ? cloneElement(element, extras) : element;
|
|
12
|
+
}
|
|
13
|
+
function pressable(context) {
|
|
14
|
+
return Boolean(context.rowLink ?? context.onRowPress);
|
|
15
|
+
}
|
|
16
|
+
/** The visible link or button, wrapped around the link column's content. */
|
|
17
|
+
function LinkedContent({ context, row, children }) {
|
|
18
|
+
const { rowLink, onRowPress } = context;
|
|
19
|
+
if (rowLink) {
|
|
20
|
+
return withExtras(rowLink(row, children), { "data-slot": "table-row-link" });
|
|
21
|
+
}
|
|
22
|
+
if (onRowPress) {
|
|
23
|
+
return (_jsx("button", { type: "button", "data-slot": "table-row-link", onClick: () => {
|
|
24
|
+
onRowPress(row);
|
|
25
|
+
}, children: children }));
|
|
26
|
+
}
|
|
27
|
+
return children;
|
|
28
|
+
}
|
|
29
|
+
/** A second, hidden copy of the link, behind the cells, so the whole row can be clicked. Screen readers and Tab skip it. */
|
|
30
|
+
function RowOverlay({ context, row }) {
|
|
31
|
+
const { rowLink, onRowPress } = context;
|
|
32
|
+
if (rowLink) {
|
|
33
|
+
return withExtras(rowLink(row, null), {
|
|
34
|
+
tabIndex: -1,
|
|
35
|
+
"aria-hidden": true,
|
|
36
|
+
"data-slot": "table-row-overlay"
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
if (onRowPress) {
|
|
40
|
+
return (_jsx("button", { type: "button", tabIndex: -1, "aria-hidden": "true", "data-slot": "table-row-overlay", onClick: () => {
|
|
41
|
+
onRowPress(row);
|
|
42
|
+
} }));
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
function DataCell({ context, column, item }) {
|
|
47
|
+
const { view } = context;
|
|
48
|
+
const content = column.render(item.row, { locale: context.locale, labels: view.words });
|
|
49
|
+
const linked = column.id === view.linkColumnId;
|
|
50
|
+
return (_jsxs("td", { role: "cell", "data-align": column.align, "data-priority": column.priority, "data-link": linked || undefined, "data-card-label": column.cardLabel ? undefined : "off", children: [_jsx("span", { "data-slot": "table-cell-label", "aria-hidden": "true", children: column.label }), _jsx("span", { "data-slot": "table-cell-value", children: linked ? (_jsx(LinkedContent, { context: context, row: item.row, children: content })) : (content) }), column.id === context.overlayId && _jsx(RowOverlay, { context: context, row: item.row })] }));
|
|
51
|
+
}
|
|
52
|
+
function ActionsCell({ context, column, item }) {
|
|
53
|
+
const { view } = context;
|
|
54
|
+
return (_jsxs("td", { role: "cell", "data-kind": "actions", "data-align": "end", "data-priority": column.priority, children: [isActionsColumn(column) && (_jsx(RowActions, { column: column, row: item.row, name: view.rowName(item.row), words: view.words })), column.id === context.overlayId && _jsx(RowOverlay, { context: context, row: item.row })] }));
|
|
55
|
+
}
|
|
56
|
+
/** A body row: the selection box, then a cell for each column. */
|
|
57
|
+
export function BodyRow({ context, item }) {
|
|
58
|
+
const { view } = context;
|
|
59
|
+
const selected = context.selected.has(item.id);
|
|
60
|
+
return (_jsxs("tr", { role: "row", "data-selected": selected || undefined, "data-pressable": pressable(context) || undefined, children: [context.selection && (_jsx("td", { role: "cell", "data-kind": "select", children: _jsx("span", { "data-slot": "table-control", children: _jsx(Checkbox, { size: "sm", "aria-label": view.words.selectRow(view.rowName(item.row)), checked: selected, onCheckedChange: (next) => {
|
|
61
|
+
view.dispatch({
|
|
62
|
+
type: "select",
|
|
63
|
+
ids: [item.id],
|
|
64
|
+
on: next === true
|
|
65
|
+
});
|
|
66
|
+
} }) }) })), context.columns.map((column) => isActionsColumn(column) ? (_jsx(ActionsCell, { context: context, column: column, item: item }, column.id)) : (_jsx(DataCell, { context: context, column: column, item: item }, column.id)))] }));
|
|
67
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ActionsLook, CellContext, ColumnOptions, SortValue, TableAction, TableColumn } from "./table-types";
|
|
2
|
+
export type Accessor<Row, Value> = (row: Row) => Value;
|
|
3
|
+
/** A missing value: the missing word on screen, and the spoken word for screen readers. */
|
|
4
|
+
export declare function Missing({ context }: {
|
|
5
|
+
context: CellContext;
|
|
6
|
+
}): React.JSX.Element;
|
|
7
|
+
/** A column of any value. Without `cell`, the value shows as text, and a missing value as the missing word. */
|
|
8
|
+
export declare function column<Row, Value>(id: string, label: string, read: Accessor<Row, Value>, options?: ColumnOptions<Row, Value>): TableColumn<Row>;
|
|
9
|
+
type FormattedOptions<Row, Value, Format> = Omit<ColumnOptions<Row, Value>, "cell"> & {
|
|
10
|
+
format?: Format;
|
|
11
|
+
};
|
|
12
|
+
/** A column of numbers, written for the table's locale and aligned to the end. */
|
|
13
|
+
export declare function numberColumn<Row>(id: string, label: string, read: Accessor<Row, number | null | undefined>, options?: FormattedOptions<Row, number | null | undefined, Intl.NumberFormatOptions>): TableColumn<Row>;
|
|
14
|
+
type DateInput = Date | string | number | null | undefined;
|
|
15
|
+
/** A column of dates, written for the table's locale and sorted by time. A missing or broken date shows the missing word. */
|
|
16
|
+
export declare function dateColumn<Row>(id: string, label: string, read: Accessor<Row, DateInput>, options?: FormattedOptions<Row, DateInput, Intl.DateTimeFormatOptions>): TableColumn<Row>;
|
|
17
|
+
export interface ActionsOptions {
|
|
18
|
+
/** @defaultValue "inline" */
|
|
19
|
+
look?: ActionsLook;
|
|
20
|
+
/** @defaultValue "actions" */
|
|
21
|
+
id?: string;
|
|
22
|
+
}
|
|
23
|
+
/** The marker the table reads to draw a row's actions; the column itself renders nothing. */
|
|
24
|
+
export interface ActionsColumn<Row> extends TableColumn<Row> {
|
|
25
|
+
kind: "actions";
|
|
26
|
+
actions: (row: Row) => TableAction[];
|
|
27
|
+
look: ActionsLook;
|
|
28
|
+
}
|
|
29
|
+
/** A column of row actions: icon buttons with tooltips, or one menu. Hidden actions are left out. */
|
|
30
|
+
export declare function actionsColumn<Row>(actions: (row: Row) => TableAction[], options?: ActionsOptions): ActionsColumn<Row>;
|
|
31
|
+
export declare function isActionsColumn<Row>(candidate: TableColumn<Row>): candidate is ActionsColumn<Row>;
|
|
32
|
+
/**
|
|
33
|
+
* Compares two present sort values: dates and numbers by value, text by the collator. Missing values reach
|
|
34
|
+
* TanStack as `undefined` with `sortUndefined: "last"`, which keeps them last in either direction; the check
|
|
35
|
+
* here only keeps the order sane for direct callers.
|
|
36
|
+
*/
|
|
37
|
+
export declare function compareSortValues(a: SortValue, b: SortValue, collator: Intl.Collator): number;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/** A missing value: the missing word on screen, and the spoken word for screen readers. */
|
|
3
|
+
export function Missing({ context }) {
|
|
4
|
+
return (_jsxs("span", { "data-slot": "table-missing", children: [_jsx("span", { "aria-hidden": "true", children: context.labels.missing }), _jsx("span", { "data-slot": "table-visually-hidden", children: context.labels.missingSpoken })] }));
|
|
5
|
+
}
|
|
6
|
+
function isMissing(value) {
|
|
7
|
+
return value === null || value === undefined || value === "";
|
|
8
|
+
}
|
|
9
|
+
/** Text and numbers are searched and shown as they are; anything else is left to the column's own options. */
|
|
10
|
+
function plainText(value) {
|
|
11
|
+
if (typeof value === "string") {
|
|
12
|
+
return value === "" ? null : value;
|
|
13
|
+
}
|
|
14
|
+
return typeof value === "number" && Number.isFinite(value) ? String(value) : null;
|
|
15
|
+
}
|
|
16
|
+
function plainSortValue(value) {
|
|
17
|
+
if (typeof value === "string" || typeof value === "number" || value instanceof Date) {
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
/** A column of any value. Without `cell`, the value shows as text, and a missing value as the missing word. */
|
|
23
|
+
export function column(id, label, read, options = {}) {
|
|
24
|
+
const { cell, searchText, sortValue } = options;
|
|
25
|
+
return {
|
|
26
|
+
id,
|
|
27
|
+
label,
|
|
28
|
+
kind: "data",
|
|
29
|
+
sortable: options.sortable ?? false,
|
|
30
|
+
align: options.align ?? "start",
|
|
31
|
+
priority: options.priority ?? "high",
|
|
32
|
+
width: options.width,
|
|
33
|
+
cardLabel: options.cardLabel ?? true,
|
|
34
|
+
render: (row, context) => {
|
|
35
|
+
const value = read(row);
|
|
36
|
+
if (cell) {
|
|
37
|
+
return cell(value, row, context);
|
|
38
|
+
}
|
|
39
|
+
return isMissing(value) ? _jsx(Missing, { context: context }) : (plainText(value) ?? null);
|
|
40
|
+
},
|
|
41
|
+
text: (row) => {
|
|
42
|
+
const value = read(row);
|
|
43
|
+
return searchText ? (searchText(value, row) ?? null) : plainText(value);
|
|
44
|
+
},
|
|
45
|
+
sortValue: (row) => {
|
|
46
|
+
const value = read(row);
|
|
47
|
+
return sortValue ? sortValue(value, row) : plainSortValue(value);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** A column of numbers, written for the table's locale and aligned to the end. */
|
|
52
|
+
export function numberColumn(id, label, read, options = {}) {
|
|
53
|
+
const { format, ...rest } = options;
|
|
54
|
+
return column(id, label, read, {
|
|
55
|
+
align: "end",
|
|
56
|
+
...rest,
|
|
57
|
+
cell: (value, _row, context) => isMissing(value) || !Number.isFinite(value) ? (_jsx(Missing, { context: context })) : (new Intl.NumberFormat(context.locale, format).format(value)),
|
|
58
|
+
searchText: rest.searchText ?? ((value) => (isMissing(value) ? null : String(value)))
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function toDate(value) {
|
|
62
|
+
if (isMissing(value)) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
66
|
+
return Number.isNaN(date.getTime()) ? null : date;
|
|
67
|
+
}
|
|
68
|
+
/** A column of dates, written for the table's locale and sorted by time. A missing or broken date shows the missing word. */
|
|
69
|
+
export function dateColumn(id, label, read, options = {}) {
|
|
70
|
+
const { format = { dateStyle: "medium" }, ...rest } = options;
|
|
71
|
+
return column(id, label, read, {
|
|
72
|
+
...rest,
|
|
73
|
+
cell: (value, _row, context) => {
|
|
74
|
+
const date = toDate(value);
|
|
75
|
+
return date ? (_jsx("time", { dateTime: date.toISOString(), children: new Intl.DateTimeFormat(context.locale, format).format(date) })) : (_jsx(Missing, { context: context }));
|
|
76
|
+
},
|
|
77
|
+
sortValue: rest.sortValue ?? ((value) => toDate(value)),
|
|
78
|
+
searchText: rest.searchText ?? (() => null)
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/** A column of row actions: icon buttons with tooltips, or one menu. Hidden actions are left out. */
|
|
82
|
+
export function actionsColumn(actions, options = {}) {
|
|
83
|
+
return {
|
|
84
|
+
id: options.id ?? "actions",
|
|
85
|
+
label: "",
|
|
86
|
+
kind: "actions",
|
|
87
|
+
sortable: false,
|
|
88
|
+
align: "end",
|
|
89
|
+
priority: "high",
|
|
90
|
+
width: undefined,
|
|
91
|
+
cardLabel: false,
|
|
92
|
+
render: () => null,
|
|
93
|
+
text: () => null,
|
|
94
|
+
sortValue: () => null,
|
|
95
|
+
actions: (row) => actions(row).filter((action) => action.hidden !== true),
|
|
96
|
+
look: options.look ?? "inline"
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export function isActionsColumn(candidate) {
|
|
100
|
+
return candidate.kind === "actions";
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Compares two present sort values: dates and numbers by value, text by the collator. Missing values reach
|
|
104
|
+
* TanStack as `undefined` with `sortUndefined: "last"`, which keeps them last in either direction; the check
|
|
105
|
+
* here only keeps the order sane for direct callers.
|
|
106
|
+
*/
|
|
107
|
+
export function compareSortValues(a, b, collator) {
|
|
108
|
+
const aMissing = a === null || a === undefined || a === "";
|
|
109
|
+
const bMissing = b === null || b === undefined || b === "";
|
|
110
|
+
if (aMissing || bMissing) {
|
|
111
|
+
return Number(aMissing) - Number(bMissing);
|
|
112
|
+
}
|
|
113
|
+
const left = a instanceof Date ? a.getTime() : a;
|
|
114
|
+
const right = b instanceof Date ? b.getTime() : b;
|
|
115
|
+
if (typeof left === "number" && typeof right === "number") {
|
|
116
|
+
return left - right;
|
|
117
|
+
}
|
|
118
|
+
return collator.compare(String(left), String(right));
|
|
119
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/** The sort icon of a header: both arrows, with the ones for the sorted direction picked out by CSS. */
|
|
3
|
+
export function SortIcon() {
|
|
4
|
+
return (_jsxs("svg", { "data-slot": "table-sort-icon", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [_jsx("path", { "data-part": "up", d: "M5 6.5 8 3.5l3 3" }), _jsx("path", { "data-part": "down", d: "M5 9.5l3 3 3-3" })] }));
|
|
5
|
+
}
|
|
6
|
+
export function MoreIcon() {
|
|
7
|
+
return (_jsxs("svg", { "data-slot": "table-icon", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", children: [_jsx("circle", { cx: "3.5", cy: "8", r: "1.25" }), _jsx("circle", { cx: "8", cy: "8", r: "1.25" }), _jsx("circle", { cx: "12.5", cy: "8", r: "1.25" })] }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { PaginationLabels } from "../pagination";
|
|
2
|
+
/** Every word the table shows or reads out. Numbers arrive already formatted for the locale. */
|
|
3
|
+
export interface TableLabels {
|
|
4
|
+
search: string;
|
|
5
|
+
noResults: string;
|
|
6
|
+
empty: string;
|
|
7
|
+
loading: string;
|
|
8
|
+
actions: string;
|
|
9
|
+
rowActions: (row: string) => string;
|
|
10
|
+
/** Read out after a sort, like "Sorted by Name, ascending, 95 rows". */
|
|
11
|
+
sorted: (column: string, descending: boolean, rows: string) => string;
|
|
12
|
+
/** Read out after a search, like "12 results". */
|
|
13
|
+
results: (count: string) => string;
|
|
14
|
+
selectAll: string;
|
|
15
|
+
selectRow: (row: string) => string;
|
|
16
|
+
selected: (count: string) => string;
|
|
17
|
+
clearSelection: string;
|
|
18
|
+
/** Shown for a missing value; hidden from screen readers, which hear `missingSpoken`. */
|
|
19
|
+
missing: string;
|
|
20
|
+
missingSpoken: string;
|
|
21
|
+
/** The words of the paging bar below the table, over the pagination's English ones. */
|
|
22
|
+
paging: Partial<PaginationLabels>;
|
|
23
|
+
}
|
|
24
|
+
export declare const tableLabels: TableLabels;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const tableLabels = {
|
|
2
|
+
search: "Search",
|
|
3
|
+
noResults: "No results",
|
|
4
|
+
empty: "Nothing here yet",
|
|
5
|
+
loading: "Loading",
|
|
6
|
+
actions: "Actions",
|
|
7
|
+
rowActions: (row) => `Actions for ${row}`,
|
|
8
|
+
sorted: (column, descending, rows) => `Sorted by ${column}, ${descending ? "descending" : "ascending"}, ${rows} ${rows === "1" ? "row" : "rows"}`,
|
|
9
|
+
results: (count) => `${count} ${count === "1" ? "result" : "results"}`,
|
|
10
|
+
selectAll: "Select all rows on this page",
|
|
11
|
+
selectRow: (row) => `Select ${row}`,
|
|
12
|
+
selected: (count) => `${count} selected`,
|
|
13
|
+
clearSelection: "Clear selection",
|
|
14
|
+
missing: "—",
|
|
15
|
+
missingSpoken: "None",
|
|
16
|
+
paging: {}
|
|
17
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type Row as TanRow } from "@tanstack/react-table";
|
|
2
|
+
import type { TableColumn, TableState } from "./table-types";
|
|
3
|
+
declare const features: {
|
|
4
|
+
rowSortingFeature: import("@tanstack/react-table").TableFeature;
|
|
5
|
+
columnFilteringFeature: import("@tanstack/react-table").TableFeature;
|
|
6
|
+
globalFilteringFeature: import("@tanstack/react-table").TableFeature;
|
|
7
|
+
filteredRowModel: (table: import("@tanstack/react-table").Table<any, any>) => () => import("@tanstack/react-table").RowModel<any, any>;
|
|
8
|
+
sortedRowModel: (table: import("@tanstack/react-table").Table<any, any>) => () => import("@tanstack/react-table").RowModel<any, any>;
|
|
9
|
+
};
|
|
10
|
+
type Features = typeof features;
|
|
11
|
+
type Rows<Row extends object> = TanRow<Features, Row>[];
|
|
12
|
+
/** Folds case and accents away, so "jose" finds "José". */
|
|
13
|
+
export declare function foldText(text: string): string;
|
|
14
|
+
export interface ModelOptions<Row extends object> {
|
|
15
|
+
data: readonly Row[];
|
|
16
|
+
columns: readonly TableColumn<Row>[];
|
|
17
|
+
state: TableState;
|
|
18
|
+
locale: string | undefined;
|
|
19
|
+
serverSide: boolean;
|
|
20
|
+
rowId: (row: Row) => string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The rows after search and sort, from TanStack. It gets stable inputs: its column definitions are rebuilt
|
|
24
|
+
* only when the columns' ids or sortable flags change, and read the latest columns through a ref, so a
|
|
25
|
+
* builder that runs on every render doesn't rebuild the row models.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useTableModel<Row extends object>(options: ModelOptions<Row>): Rows<Row>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { createSortedRowModel, createFilteredRowModel, columnFilteringFeature, globalFilteringFeature, rowSortingFeature, tableFeatures, useTable } from "@tanstack/react-table";
|
|
2
|
+
import { useCallback, useMemo, useRef } from "react";
|
|
3
|
+
import { compareSortValues, isActionsColumn } from "./table-columns";
|
|
4
|
+
const features = tableFeatures({
|
|
5
|
+
rowSortingFeature,
|
|
6
|
+
columnFilteringFeature,
|
|
7
|
+
globalFilteringFeature,
|
|
8
|
+
filteredRowModel: createFilteredRowModel(),
|
|
9
|
+
sortedRowModel: createSortedRowModel()
|
|
10
|
+
});
|
|
11
|
+
/** Folds case and accents away, so "jose" finds "José". */
|
|
12
|
+
export function foldText(text) {
|
|
13
|
+
return text.normalize("NFD").replaceAll(/\p{M}/gu, "").toLocaleLowerCase();
|
|
14
|
+
}
|
|
15
|
+
function present(value) {
|
|
16
|
+
return value === null || value === "" ? undefined : value;
|
|
17
|
+
}
|
|
18
|
+
function columnDef(column, latest, collator) {
|
|
19
|
+
const { id } = column;
|
|
20
|
+
return {
|
|
21
|
+
id,
|
|
22
|
+
accessorFn: (row) => present(latest.current.columns.find((item) => item.id === id)?.sortValue(row)),
|
|
23
|
+
enableSorting: column.sortable,
|
|
24
|
+
sortUndefined: "last",
|
|
25
|
+
sortFn: (rowA, rowB, columnId) => compareSortValues(present(rowA.getValue(columnId)), present(rowB.getValue(columnId)), collator)
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/** TanStack's column definitions, rebuilt only when the columns' ids or sortable flags change. */
|
|
29
|
+
function useColumnDefs(columns, latest, locale) {
|
|
30
|
+
const dataColumns = columns.filter((column) => !isActionsColumn(column));
|
|
31
|
+
const key = JSON.stringify(dataColumns.map((column) => [column.id, column.sortable]));
|
|
32
|
+
const collator = useMemo(() => new Intl.Collator(locale, { numeric: true, sensitivity: "base" }), [locale]);
|
|
33
|
+
return useMemo(() => latest.current.columns
|
|
34
|
+
.filter((column) => !isActionsColumn(column))
|
|
35
|
+
.map((column) => columnDef(column, latest, collator)),
|
|
36
|
+
// The key stands for the ids and sortable flags; the columns themselves are read through the ref.
|
|
37
|
+
[key, collator, latest]);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The rows after search and sort, from TanStack. It gets stable inputs: its column definitions are rebuilt
|
|
41
|
+
* only when the columns' ids or sortable flags change, and read the latest columns through a ref, so a
|
|
42
|
+
* builder that runs on every render doesn't rebuild the row models.
|
|
43
|
+
*/
|
|
44
|
+
export function useTableModel(options) {
|
|
45
|
+
const { data, columns, state, locale, serverSide, rowId } = options;
|
|
46
|
+
const latest = useRef({ columns, rowId });
|
|
47
|
+
latest.current = { columns, rowId };
|
|
48
|
+
const defs = useColumnDefs(columns, latest, locale);
|
|
49
|
+
const globalFilterFn = useCallback((row, columnId, needle) => {
|
|
50
|
+
const text = latest.current.columns
|
|
51
|
+
.find((column) => column.id === columnId)
|
|
52
|
+
?.text(row.original);
|
|
53
|
+
return text ? foldText(text).includes(foldText(needle).trim()) : false;
|
|
54
|
+
}, []);
|
|
55
|
+
const getRowId = useCallback((row) => latest.current.rowId(row), []);
|
|
56
|
+
const table = useTable({
|
|
57
|
+
features,
|
|
58
|
+
data,
|
|
59
|
+
columns: defs,
|
|
60
|
+
getRowId,
|
|
61
|
+
state: { sorting: state.sort, globalFilter: state.search },
|
|
62
|
+
globalFilterFn,
|
|
63
|
+
getColumnCanGlobalFilter: () => true,
|
|
64
|
+
manualSorting: serverSide,
|
|
65
|
+
manualFiltering: serverSide,
|
|
66
|
+
autoResetAll: false
|
|
67
|
+
});
|
|
68
|
+
return table.getRowModel().rows;
|
|
69
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type RowContext } from "./table-cells";
|
|
3
|
+
import type { TableColumn } from "./table-types";
|
|
4
|
+
import type { TableView } from "./use-table-view";
|
|
5
|
+
/** The header row. Its selection box covers the rows on the page shown. */
|
|
6
|
+
export declare function Header<Row extends object>({ columns, view, selection }: {
|
|
7
|
+
columns: readonly TableColumn<Row>[];
|
|
8
|
+
view: TableView<Row>;
|
|
9
|
+
selection: boolean;
|
|
10
|
+
}): React.JSX.Element;
|
|
11
|
+
/** The body. It comes from one decision: placeholders, the empty message, no results, or the rows. */
|
|
12
|
+
export declare function Body<Row extends object>({ context, empty }: {
|
|
13
|
+
context: RowContext<Row>;
|
|
14
|
+
empty: ReactNode;
|
|
15
|
+
}): React.JSX.Element;
|
|
16
|
+
/** The search field, and the bar that shows what is selected and what to do with it. */
|
|
17
|
+
export declare function Toolbar<Row extends object>({ view, search, selection }: {
|
|
18
|
+
view: TableView<Row>;
|
|
19
|
+
search: {
|
|
20
|
+
label: string;
|
|
21
|
+
} | undefined;
|
|
22
|
+
selection: {
|
|
23
|
+
actions: ReactNode;
|
|
24
|
+
} | undefined;
|
|
25
|
+
}): React.JSX.Element | null;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "../button";
|
|
3
|
+
import { Checkbox } from "../checkbox";
|
|
4
|
+
import { SearchInput } from "../input";
|
|
5
|
+
import { Skeleton } from "../skeleton";
|
|
6
|
+
import { BodyRow } from "./table-cells";
|
|
7
|
+
import { isActionsColumn } from "./table-columns";
|
|
8
|
+
import { SortIcon } from "./table-icons";
|
|
9
|
+
function ariaSort(rule) {
|
|
10
|
+
if (!rule) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
return rule.desc ? "descending" : "ascending";
|
|
14
|
+
}
|
|
15
|
+
function HeaderCell({ column, view }) {
|
|
16
|
+
const rule = view.state.sort.find((item) => item.id === column.id);
|
|
17
|
+
const actions = isActionsColumn(column);
|
|
18
|
+
return (_jsxs("th", { role: "columnheader", scope: "col", "aria-sort": ariaSort(rule), "data-align": column.align, "data-priority": column.priority, "data-kind": actions ? "actions" : undefined, style: { inlineSize: column.width }, children: [column.sortable && (_jsxs("button", { type: "button", "data-slot": "table-sort", onClick: () => {
|
|
19
|
+
view.dispatch({ type: "sort", id: column.id });
|
|
20
|
+
}, children: [_jsx("span", { children: column.label }), _jsx(SortIcon, {})] })), !column.sortable && !actions && column.label, actions && _jsx("span", { "data-slot": "table-visually-hidden", children: view.words.actions })] }));
|
|
21
|
+
}
|
|
22
|
+
function checkedOf(selected) {
|
|
23
|
+
if (selected === "some") {
|
|
24
|
+
return "indeterminate";
|
|
25
|
+
}
|
|
26
|
+
return selected === "all";
|
|
27
|
+
}
|
|
28
|
+
/** The header row. Its selection box covers the rows on the page shown. */
|
|
29
|
+
export function Header({ columns, view, selection }) {
|
|
30
|
+
return (_jsx("thead", { role: "rowgroup", children: _jsxs("tr", { role: "row", children: [selection && (_jsx("th", { role: "columnheader", scope: "col", "data-kind": "select", children: _jsx("span", { "data-slot": "table-control", children: _jsx(Checkbox, { size: "sm", "aria-label": view.words.selectAll, checked: checkedOf(view.pageSelected), disabled: view.pageRows.length === 0, onCheckedChange: (next) => {
|
|
31
|
+
view.dispatch({
|
|
32
|
+
type: "select",
|
|
33
|
+
ids: view.pageRows.map((item) => item.id),
|
|
34
|
+
on: next === true
|
|
35
|
+
});
|
|
36
|
+
} }) }) })), columns.map((column) => (_jsx(HeaderCell, { column: column, view: view }, column.id)))] }) }));
|
|
37
|
+
}
|
|
38
|
+
const skeletonWidths = ["70%", "55%", "85%", "45%", "65%"];
|
|
39
|
+
function SkeletonRows({ columns, view, selection }) {
|
|
40
|
+
return (_jsx(_Fragment, { children: Array.from({ length: view.loadingRows }, (_, index) => (_jsxs("tr", { role: "row", "data-slot": "table-skeleton-row", children: [selection && _jsx("td", { role: "cell", "data-kind": "select" }), columns.map((column, at) => (_jsxs("td", { role: "cell", "data-priority": column.priority, "data-align": column.align, "data-card-label": "off", children: [index === 0 && at === 0 && (_jsx("span", { "data-slot": "table-visually-hidden", children: view.words.loading })), !isActionsColumn(column) && (_jsx(Skeleton, { shape: "text", width: skeletonWidths[(index + at) % skeletonWidths.length] }))] }, column.id)))] }, index))) }));
|
|
41
|
+
}
|
|
42
|
+
function MessageRow({ span, children }) {
|
|
43
|
+
return (_jsx("tr", { role: "row", "data-slot": "table-message-row", children: _jsx("td", { role: "cell", colSpan: span, "data-slot": "table-message", children: children }) }));
|
|
44
|
+
}
|
|
45
|
+
/** The body. It comes from one decision: placeholders, the empty message, no results, or the rows. */
|
|
46
|
+
export function Body({ context, empty }) {
|
|
47
|
+
const { view, columns, selection } = context;
|
|
48
|
+
const span = columns.length + (selection ? 1 : 0);
|
|
49
|
+
let content;
|
|
50
|
+
switch (view.body) {
|
|
51
|
+
case "loading":
|
|
52
|
+
content = _jsx(SkeletonRows, { columns: columns, view: view, selection: selection });
|
|
53
|
+
break;
|
|
54
|
+
case "empty":
|
|
55
|
+
content = _jsx(MessageRow, { span: span, children: empty ?? view.words.empty });
|
|
56
|
+
break;
|
|
57
|
+
case "no-results":
|
|
58
|
+
content = _jsx(MessageRow, { span: span, children: view.words.noResults });
|
|
59
|
+
break;
|
|
60
|
+
case "rows":
|
|
61
|
+
content = view.pageRows.map((item) => (_jsx(BodyRow, { context: context, item: item }, item.id)));
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
return _jsx("tbody", { role: "rowgroup", children: content });
|
|
65
|
+
}
|
|
66
|
+
function SelectionBar({ view, actions }) {
|
|
67
|
+
return (_jsx("div", { "data-slot": "table-selection", "aria-live": "polite", "data-empty": view.selectedCount === 0 || undefined, children: view.selectedCount > 0 && (_jsxs(_Fragment, { children: [_jsx("span", { "data-slot": "table-selected", children: view.words.selected(view.format(view.selectedCount)) }), actions, _jsx(Button, { variant: "link", size: "sm", "data-part": "clear", onClick: () => {
|
|
68
|
+
view.dispatch({ type: "clearSelection" });
|
|
69
|
+
}, children: view.words.clearSelection })] })) }));
|
|
70
|
+
}
|
|
71
|
+
/** The search field, and the bar that shows what is selected and what to do with it. */
|
|
72
|
+
export function Toolbar({ view, search, selection }) {
|
|
73
|
+
if (!search && !selection) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
return (_jsxs("div", { "data-slot": "table-toolbar", children: [search && (_jsx(SearchInput, { "aria-label": search.label, placeholder: search.label, value: view.state.search, onValueChange: (text) => {
|
|
77
|
+
view.dispatch({ type: "search", text });
|
|
78
|
+
} })), selection && _jsx(SelectionBar, { view: view, actions: selection.actions })] }));
|
|
79
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { SortRule, TableBody, TableChange, TableState } from "./table-types";
|
|
2
|
+
export type TableEvent = {
|
|
3
|
+
type: "sort";
|
|
4
|
+
id: string;
|
|
5
|
+
} | {
|
|
6
|
+
type: "search";
|
|
7
|
+
text: string;
|
|
8
|
+
} | {
|
|
9
|
+
type: "page";
|
|
10
|
+
page: number;
|
|
11
|
+
} | {
|
|
12
|
+
type: "pageSize";
|
|
13
|
+
size: number;
|
|
14
|
+
} | {
|
|
15
|
+
type: "select";
|
|
16
|
+
ids: readonly string[];
|
|
17
|
+
on: boolean;
|
|
18
|
+
} | {
|
|
19
|
+
type: "clearSelection";
|
|
20
|
+
};
|
|
21
|
+
export declare const changeOf: Record<TableEvent["type"], TableChange>;
|
|
22
|
+
/**
|
|
23
|
+
* Sorting a column starts ascending, and sorting it again flips it. Another column replaces the sort, unless
|
|
24
|
+
* `multi` keeps the earlier rules after it.
|
|
25
|
+
*/
|
|
26
|
+
export declare function nextSort(sort: readonly SortRule[], id: string, multi: boolean): SortRule[];
|
|
27
|
+
/** The state after an event. A new search or page size goes back to the first page. */
|
|
28
|
+
export declare function nextState(state: TableState, event: TableEvent, multiSort?: boolean): TableState;
|
|
29
|
+
/** The page shown: the one asked for, kept within the pages there are, so a shrinking list never shows nothing. */
|
|
30
|
+
export declare function shownPage(page: number, pageCount: number): number;
|
|
31
|
+
/**
|
|
32
|
+
* What the body shows. Loading wins; with nothing at all (and no search narrowing it) it is empty; a search
|
|
33
|
+
* that matches nothing keeps the header and says so.
|
|
34
|
+
*/
|
|
35
|
+
export declare function bodyOf(options: {
|
|
36
|
+
loading: boolean;
|
|
37
|
+
total: number;
|
|
38
|
+
searching: boolean;
|
|
39
|
+
shown: number;
|
|
40
|
+
}): TableBody;
|
|
41
|
+
/** How much of the page shown is selected, for the header checkbox. */
|
|
42
|
+
export declare function pageSelection(selected: readonly string[], pageIds: readonly string[]): "none" | "some" | "all";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export const changeOf = {
|
|
2
|
+
sort: "sort",
|
|
3
|
+
search: "search",
|
|
4
|
+
page: "page",
|
|
5
|
+
pageSize: "pageSize",
|
|
6
|
+
select: "select",
|
|
7
|
+
clearSelection: "select"
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Sorting a column starts ascending, and sorting it again flips it. Another column replaces the sort, unless
|
|
11
|
+
* `multi` keeps the earlier rules after it.
|
|
12
|
+
*/
|
|
13
|
+
export function nextSort(sort, id, multi) {
|
|
14
|
+
const current = sort.find((rule) => rule.id === id);
|
|
15
|
+
const flipped = { id, desc: current ? !current.desc : false };
|
|
16
|
+
if (!multi) {
|
|
17
|
+
return [flipped];
|
|
18
|
+
}
|
|
19
|
+
return [flipped, ...sort.filter((rule) => rule.id !== id)];
|
|
20
|
+
}
|
|
21
|
+
function withSelection(selected, ids, on) {
|
|
22
|
+
const chosen = new Set(selected);
|
|
23
|
+
for (const id of ids) {
|
|
24
|
+
if (on) {
|
|
25
|
+
chosen.add(id);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
chosen.delete(id);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return [...chosen];
|
|
32
|
+
}
|
|
33
|
+
function setPage(state, page) {
|
|
34
|
+
const next = Math.max(1, Math.floor(page));
|
|
35
|
+
return next === state.page ? state : { ...state, page: next };
|
|
36
|
+
}
|
|
37
|
+
/** The state after an event. A new search or page size goes back to the first page. */
|
|
38
|
+
export function nextState(state, event, multiSort = false) {
|
|
39
|
+
switch (event.type) {
|
|
40
|
+
case "sort":
|
|
41
|
+
return { ...state, sort: nextSort(state.sort, event.id, multiSort) };
|
|
42
|
+
case "search":
|
|
43
|
+
return event.text === state.search ? state : { ...state, search: event.text, page: 1 };
|
|
44
|
+
case "page":
|
|
45
|
+
return setPage(state, event.page);
|
|
46
|
+
case "pageSize":
|
|
47
|
+
return event.size === state.pageSize
|
|
48
|
+
? state
|
|
49
|
+
: { ...state, pageSize: event.size, page: 1 };
|
|
50
|
+
case "select":
|
|
51
|
+
return { ...state, selected: withSelection(state.selected, event.ids, event.on) };
|
|
52
|
+
case "clearSelection":
|
|
53
|
+
return state.selected.length === 0 ? state : { ...state, selected: [] };
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/** The page shown: the one asked for, kept within the pages there are, so a shrinking list never shows nothing. */
|
|
57
|
+
export function shownPage(page, pageCount) {
|
|
58
|
+
return Math.min(Math.max(page, 1), Math.max(pageCount, 1));
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* What the body shows. Loading wins; with nothing at all (and no search narrowing it) it is empty; a search
|
|
62
|
+
* that matches nothing keeps the header and says so.
|
|
63
|
+
*/
|
|
64
|
+
export function bodyOf(options) {
|
|
65
|
+
if (options.loading) {
|
|
66
|
+
return "loading";
|
|
67
|
+
}
|
|
68
|
+
if (options.total === 0 && !options.searching) {
|
|
69
|
+
return "empty";
|
|
70
|
+
}
|
|
71
|
+
return options.shown === 0 ? "no-results" : "rows";
|
|
72
|
+
}
|
|
73
|
+
/** How much of the page shown is selected, for the header checkbox. */
|
|
74
|
+
export function pageSelection(selected, pageIds) {
|
|
75
|
+
const chosen = new Set(selected);
|
|
76
|
+
const count = pageIds.filter((id) => chosen.has(id)).length;
|
|
77
|
+
if (count === 0) {
|
|
78
|
+
return "none";
|
|
79
|
+
}
|
|
80
|
+
return count === pageIds.length ? "all" : "some";
|
|
81
|
+
}
|