@sincpro/web-ui 2.8.0 → 2.10.0
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 +152 -3
- package/dist/components/activity/Activity.js +3 -2
- package/dist/components/board/Board.d.ts +2 -1
- package/dist/components/board/Board.js +17 -1
- package/dist/components/form/Form.js +12 -3
- package/dist/components/form/FormIndex.d.ts +5 -1
- package/dist/components/form/FormIndex.js +71 -23
- package/dist/components/form/Sheet.js +22 -4
- package/dist/components/listing/ListingBar.d.ts +25 -1
- package/dist/components/listing/ListingBar.js +43 -14
- package/dist/components/listing/Pagination.d.ts +4 -1
- package/dist/components/listing/Pagination.js +19 -6
- package/dist/components/listing/modelCells.js +1 -9
- package/dist/components/record/ActionDock.d.ts +58 -0
- package/dist/components/record/ActionDock.js +69 -0
- package/dist/components/record/Breadcrumb.d.ts +3 -1
- package/dist/components/record/Breadcrumb.js +13 -5
- package/dist/components/record/DirtyActions.js +11 -1
- package/dist/components/record/Pager.d.ts +12 -10
- package/dist/components/record/Pager.js +39 -6
- package/dist/components/record/RecordHeader.d.ts +13 -1
- package/dist/components/record/RecordHeader.js +70 -25
- package/dist/components/record/SmartButtons.js +2 -2
- package/dist/components/record/StatusBar.d.ts +68 -1
- package/dist/components/record/StatusBar.js +218 -48
- package/dist/components/record/dock.d.ts +56 -0
- package/dist/components/record/dock.js +58 -0
- package/dist/components/record/index.d.ts +3 -1
- package/dist/components/record/index.js +5 -1
- package/dist/foundations/copy.d.ts +9 -0
- package/dist/foundations/copy.es.js +10 -1
- package/dist/foundations/copy.js +5 -0
- package/dist/foundations/form.d.ts +10 -1
- package/dist/foundations/grouping.d.ts +9 -0
- package/dist/foundations/index.d.ts +3 -1
- package/dist/foundations/index.js +8 -2
- package/dist/foundations/keys.d.ts +34 -0
- package/dist/foundations/keys.js +99 -0
- package/dist/foundations/shortcut.d.ts +17 -1
- package/dist/foundations/shortcut.js +57 -1
- package/dist/foundations/viewStyle.d.ts +8 -0
- package/dist/foundations/viewStyle.js +12 -0
- package/dist/primitives/choice/Switch.d.ts +4 -1
- package/dist/primitives/choice/Switch.js +2 -2
- package/dist/primitives/menu/Menu.d.ts +3 -0
- package/dist/primitives/menu/Menu.js +7 -1
- package/dist/primitives/table/DataTable.d.ts +29 -0
- package/dist/primitives/table/DataTable.js +84 -13
- package/dist/primitives/table/EditableTable.js +7 -2
- package/dist/primitives/table/RowActions.d.ts +5 -0
- package/dist/primitives/table/RowActions.js +27 -3
- package/dist/primitives/table/SheetTable.d.ts +3 -0
- package/dist/primitives/table/SheetTable.js +15 -2
- package/dist/primitives/table/index.d.ts +1 -1
- package/dist/primitives/value/Value.d.ts +5 -1
- package/dist/primitives/value/Value.js +9 -3
- package/dist/primitives/value/YesNo.d.ts +22 -0
- package/dist/primitives/value/YesNo.js +16 -0
- package/dist/primitives/value/index.d.ts +1 -0
- package/dist/primitives/value/index.js +1 -0
- package/dist/tokens.css +35 -2
- package/dist/views/list/List.d.ts +7 -2
- package/dist/views/list/List.js +12 -4
- package/dist/views/list/ListView.d.ts +1 -1
- package/dist/views/list/ListView.js +112 -17
- package/dist/views/list/derive.d.ts +1 -1
- package/dist/views/list/derive.js +45 -9
- package/dist/views/list/presentations.d.ts +2 -2
- package/dist/views/list/presentations.js +35 -3
- package/dist/views/list/types.d.ts +43 -0
- package/dist/views/list/useReachBottom.d.ts +15 -0
- package/dist/views/list/useReachBottom.js +55 -0
- package/dist/views/record/Record.d.ts +16 -2
- package/dist/views/record/Record.js +30 -7
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@ import { type Pile } from "../../foundations/grouping.js";
|
|
|
2
2
|
import type { Tone } from "../../foundations/types.js";
|
|
3
3
|
import { type RowAction } from "./RowActions.js";
|
|
4
4
|
import type { SortState } from "./sorting.js";
|
|
5
|
+
import { type YesNoLook } from "../value/YesNo.js";
|
|
5
6
|
import { type ReactNode } from "react";
|
|
6
7
|
/** How a column is aggregated when its rows are pulled together into a group.
|
|
7
8
|
*
|
|
@@ -18,6 +19,18 @@ export type Aggregate = "count" | "sum" | "mean" | "min" | "max" | "unique";
|
|
|
18
19
|
* Not public.
|
|
19
20
|
*/
|
|
20
21
|
export declare function aggregateFormat<T>(column: DataColumn<T>): ((value: number) => string) | undefined;
|
|
22
|
+
/** How a number of the column is written: its `format`; else with its `decimals`, every number
|
|
23
|
+
* with the same — «6.057,10» over «8.370,57», not «6.057,1»; else `undefined`, the locale's. */
|
|
24
|
+
export declare function columnFormat<T>(column: DataColumn<T>, locale?: string): ((value: number) => string) | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* What a pile adds up to under one column: what whoever keeps the data summed (`Pile.totals`),
|
|
27
|
+
* else the column's aggregate over the rows — only when the pile holds ALL of its rows.
|
|
28
|
+
* `null` when the column declared no aggregate or the pile cannot say it.
|
|
29
|
+
*
|
|
30
|
+
* Exported for the sheet's bands, so a pile says the same total in the table and the sheet.
|
|
31
|
+
* Not public.
|
|
32
|
+
*/
|
|
33
|
+
export declare function pileAggregate<T extends object>(column: DataColumn<T>, pile: Pile<T>): number | null;
|
|
21
34
|
/** An aggregate of a column, written — or the bare number when nothing says how. */
|
|
22
35
|
export declare function aggregateText<T>(column: DataColumn<T>, value: number): string | number;
|
|
23
36
|
export interface DataColumn<T> {
|
|
@@ -69,6 +82,9 @@ export interface DataColumn<T> {
|
|
|
69
82
|
* the number in the copy table's locale, as before.
|
|
70
83
|
*/
|
|
71
84
|
format?: (value: number) => string;
|
|
85
|
+
/** How many decimals EVERY number of the column is written with — cells, piles, footer —
|
|
86
|
+
* when it has no `format`: `2` writes «6.057,10» beside «8.370,57», not «6.057,1». */
|
|
87
|
+
decimals?: number;
|
|
72
88
|
sortable?: boolean;
|
|
73
89
|
/** Odoo: fields without `optional` cannot leave the view. When true, the
|
|
74
90
|
* column appears in the columns submenu and can be hidden. */
|
|
@@ -100,7 +116,20 @@ export interface DataColumn<T> {
|
|
|
100
116
|
* A function copies what it returns for the row instead; `false` removes it from this
|
|
101
117
|
* column — a column of tags or of buttons has nothing worth pasting. */
|
|
102
118
|
copy?: false | ((row: T) => string);
|
|
119
|
+
/** A yes/no column (its `value` a boolean): how it reads — `check`, `icon`, `word` (the
|
|
120
|
+
* default, see `YesNo`) — or, with `onToggle`, a `checkbox` or a `switch` that changes it
|
|
121
|
+
* from the list without opening the record. */
|
|
122
|
+
yesNo?: YesNoColumn<T>;
|
|
103
123
|
}
|
|
124
|
+
/** How a yes/no column reads, and whether it is changed from the list. */
|
|
125
|
+
export type YesNoColumn<T> = {
|
|
126
|
+
look?: YesNoLook | "checkbox" | "switch";
|
|
127
|
+
/** Changes the row's value. Without it a checkbox or a switch reads as `check`: a control
|
|
128
|
+
* that cannot be pressed is a promise the cell does not keep. */
|
|
129
|
+
onToggle?: (row: T, next: boolean) => void;
|
|
130
|
+
/** Which rows can be changed — a closed course's enrolment cannot. All of them by default. */
|
|
131
|
+
when?: (row: T) => boolean;
|
|
132
|
+
};
|
|
104
133
|
/** Writing a new record in the list. See the file's header. */
|
|
105
134
|
export type DataTableCreate<T> = {
|
|
106
135
|
/** The record being written, or `null` when there is none. */
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { fillCopy, useUiCopy } from "../../foundations/copy.js";
|
|
3
|
+
import { currentCopyLocale, fillCopy, useUiCopy, } from "../../foundations/copy.js";
|
|
4
4
|
import { FieldBoundary } from "../../foundations/form.js";
|
|
5
5
|
import { pathKey, pileFoot, pileItems, } from "../../foundations/grouping.js";
|
|
6
|
+
import { Switch } from "../choice/Switch.js";
|
|
6
7
|
import { CellCopy } from "./CellCopy.js";
|
|
7
8
|
import { CellEditor } from "./CellEditor.js";
|
|
8
9
|
import { EditRow, firstControl } from "./EditableTable.js";
|
|
@@ -10,6 +11,7 @@ import { PileFootLine } from "./PileFootLine.js";
|
|
|
10
11
|
import { RowActions } from "./RowActions.js";
|
|
11
12
|
import { useRowWindow } from "./rowWindow.js";
|
|
12
13
|
import { SelectBox, Table, Td, Th, THead, Tr } from "./Table.js";
|
|
14
|
+
import { YesNo } from "../value/YesNo.js";
|
|
13
15
|
import { aggregationFns, columnGroupingFeature, createColumnHelper, createExpandedRowModel, createGroupedRowModel, createSortedRowModel, rowAggregationFeature, rowExpandingFeature, rowSortingFeature, sortFns, tableFeatures, useTable, } from "@tanstack/react-table";
|
|
14
16
|
import { ChevronRight, Plus } from "lucide-react";
|
|
15
17
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
@@ -27,9 +29,40 @@ const IN_COLUMN_UNITS = new Set(["sum", "mean", "min", "max"]);
|
|
|
27
29
|
*/
|
|
28
30
|
export function aggregateFormat(column) {
|
|
29
31
|
return column.aggregate !== undefined && IN_COLUMN_UNITS.has(column.aggregate)
|
|
30
|
-
? column
|
|
32
|
+
? columnFormat(column)
|
|
31
33
|
: undefined;
|
|
32
34
|
}
|
|
35
|
+
/** How a number of the column is written: its `format`; else with its `decimals`, every number
|
|
36
|
+
* with the same — «6.057,10» over «8.370,57», not «6.057,1»; else `undefined`, the locale's. */
|
|
37
|
+
export function columnFormat(column, locale = currentCopyLocale()) {
|
|
38
|
+
if (column.format !== undefined)
|
|
39
|
+
return column.format;
|
|
40
|
+
const digits = column.decimals;
|
|
41
|
+
return digits === undefined
|
|
42
|
+
? undefined
|
|
43
|
+
: (value) => value.toLocaleString(locale, {
|
|
44
|
+
minimumFractionDigits: digits,
|
|
45
|
+
maximumFractionDigits: digits,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* What a pile adds up to under one column: what whoever keeps the data summed (`Pile.totals`),
|
|
50
|
+
* else the column's aggregate over the rows — only when the pile holds ALL of its rows.
|
|
51
|
+
* `null` when the column declared no aggregate or the pile cannot say it.
|
|
52
|
+
*
|
|
53
|
+
* Exported for the sheet's bands, so a pile says the same total in the table and the sheet.
|
|
54
|
+
* Not public.
|
|
55
|
+
*/
|
|
56
|
+
export function pileAggregate(column, pile) {
|
|
57
|
+
if (column.aggregate === undefined)
|
|
58
|
+
return null;
|
|
59
|
+
const told = pile.totals?.[column.id] ??
|
|
60
|
+
(column.field === undefined ? undefined : pile.totals?.[column.field]);
|
|
61
|
+
if (told !== undefined)
|
|
62
|
+
return told;
|
|
63
|
+
const inside = pile.piles.length === 0 ? pile.items : pileItems(pile.piles);
|
|
64
|
+
return inside.length < pile.count ? null : aggregateOf(column, inside);
|
|
65
|
+
}
|
|
33
66
|
/** An aggregate of a column, written — or the bare number when nothing says how. */
|
|
34
67
|
export function aggregateText(column, value) {
|
|
35
68
|
const format = aggregateFormat(column);
|
|
@@ -39,7 +72,8 @@ function aggregateLabel(copy, column, v) {
|
|
|
39
72
|
const n = v.toLocaleString(copy.locale);
|
|
40
73
|
/* Raw, a sum of amounts read «78.752,9»: one decimal lost and no currency, under a
|
|
41
74
|
column whose every cell says «Bs. 12.300,00». */
|
|
42
|
-
const
|
|
75
|
+
const format = columnFormat(column, copy.locale);
|
|
76
|
+
const amount = (fallback) => (format === undefined ? fallback : format(v));
|
|
43
77
|
switch (column.aggregate ?? "count") {
|
|
44
78
|
case "sum":
|
|
45
79
|
return amount(n);
|
|
@@ -66,14 +100,32 @@ function raw(copy, v) {
|
|
|
66
100
|
return v ? copy.table.yes : copy.table.no;
|
|
67
101
|
return v;
|
|
68
102
|
}
|
|
103
|
+
/** A boolean drawn by its column's `yesNo`: read, or a control that changes it in place. The
|
|
104
|
+
* control's press stays in the cell — the row opens its record on a click. */
|
|
105
|
+
function drawYesNo(column, row, value) {
|
|
106
|
+
const look = column.yesNo?.look ?? "word";
|
|
107
|
+
const toggle = column.yesNo?.onToggle;
|
|
108
|
+
const can = toggle !== undefined && column.yesNo?.when?.(row) !== false;
|
|
109
|
+
if (look !== "checkbox" && look !== "switch")
|
|
110
|
+
return _jsx(YesNo, { value: value, look: look });
|
|
111
|
+
if (!can)
|
|
112
|
+
return _jsx(YesNo, { value: value, look: "check" });
|
|
113
|
+
return (_jsx("span", { className: "inline-flex", onClick: (event) => event.stopPropagation(), children: look === "checkbox" ? (_jsx(SelectBox, { label: column.header, checked: value, onChange: (next) => toggle(row, next) })) : (_jsx(Switch, { label: column.header, checked: value, onChange: (next) => toggle(row, next) })) }));
|
|
114
|
+
}
|
|
69
115
|
/** What a cell draws: its `cell`; without one, how it READS (`text`); only then the raw
|
|
70
|
-
* value — which is the sort key, «posted» and not «publicada». */
|
|
116
|
+
* value — which is the sort key, «posted» and not «publicada». A boolean reads as yes / no. */
|
|
71
117
|
function drawCell(copy, column, row) {
|
|
72
118
|
if (column.cell !== undefined)
|
|
73
119
|
return column.cell(row);
|
|
74
120
|
if (column.text !== undefined)
|
|
75
121
|
return column.text(row);
|
|
76
|
-
|
|
122
|
+
const value = column.value(row);
|
|
123
|
+
if (typeof value === "boolean")
|
|
124
|
+
return drawYesNo(column, row, value);
|
|
125
|
+
/* A number is written the way the column writes its numbers — the same way its footer and
|
|
126
|
+
its piles write them —, so a cell, its pile and the total never disagree on decimals. */
|
|
127
|
+
const format = typeof value === "number" ? columnFormat(column, copy.locale) : undefined;
|
|
128
|
+
return format === undefined ? raw(copy, value) : format(value);
|
|
77
129
|
}
|
|
78
130
|
/* The features are declared once. In v9 they are opt-in: asking only for what
|
|
79
131
|
is used is what keeps the bundle down to what is actually needed. */
|
|
@@ -127,7 +179,7 @@ export function aggregateOf(column, rows) {
|
|
|
127
179
|
}
|
|
128
180
|
/** The piles someone else counted, as the body draws them: open ones with what is inside,
|
|
129
181
|
* the deepest with its records and, when it holds fewer than it counts, its «show more». */
|
|
130
|
-
function entriesOfPiles(piles, keyOf, collapsed, onToggle, onMore) {
|
|
182
|
+
function entriesOfPiles(piles, columns, keyOf, collapsed, onToggle, onMore) {
|
|
131
183
|
return piles.flatMap((pile) => {
|
|
132
184
|
const key = pathKey(pile.path);
|
|
133
185
|
const open = collapsed?.includes(key) !== true;
|
|
@@ -139,13 +191,17 @@ function entriesOfPiles(piles, keyOf, collapsed, onToggle, onMore) {
|
|
|
139
191
|
label: pile.label,
|
|
140
192
|
count: pile.count,
|
|
141
193
|
detail: pile.detail,
|
|
194
|
+
totals: columns.map((column) => pileAggregate(column, pile)),
|
|
142
195
|
open,
|
|
143
196
|
toggle: onToggle === undefined ? undefined : () => onToggle(key),
|
|
144
197
|
};
|
|
145
198
|
if (!open)
|
|
146
199
|
return [head];
|
|
147
200
|
if (pile.piles.length > 0) {
|
|
148
|
-
return [
|
|
201
|
+
return [
|
|
202
|
+
head,
|
|
203
|
+
...entriesOfPiles(pile.piles, columns, keyOf, collapsed, onToggle, onMore),
|
|
204
|
+
];
|
|
149
205
|
}
|
|
150
206
|
const foot = pileFoot(pile, onMore !== undefined);
|
|
151
207
|
return [
|
|
@@ -308,7 +364,7 @@ export function DataTable({ data, columns, getRowId, sort, onSortChange, levels,
|
|
|
308
364
|
TanStack built from the page. Before, the table only knew the second — grouped on the
|
|
309
365
|
server, a list said «187» in rows and «12» in the table. */
|
|
310
366
|
const entries = piles !== undefined
|
|
311
|
-
? entriesOfPiles(piles, getRowId, collapsed, onGroupToggle, onMore)
|
|
367
|
+
? entriesOfPiles(piles, columns, getRowId, collapsed, onGroupToggle, onMore)
|
|
312
368
|
: shown.map((row) => {
|
|
313
369
|
if (row.subRows.length === 0)
|
|
314
370
|
return { kind: "row", id: row.id, item: row.original };
|
|
@@ -316,6 +372,12 @@ export function DataTable({ data, columns, getRowId, sort, onSortChange, levels,
|
|
|
316
372
|
const key = pathKey(path);
|
|
317
373
|
const depth = path.length - 1;
|
|
318
374
|
const level = levels?.find((one) => one.id === row.groupingColumnId);
|
|
375
|
+
/* The rows INSIDE, not the subgroups: `subRows` of a pile with levels below are the
|
|
376
|
+
piles of the next level. */
|
|
377
|
+
const inside = row
|
|
378
|
+
.getLeafRows()
|
|
379
|
+
.filter((leaf) => leaf.subRows.length === 0)
|
|
380
|
+
.map((leaf) => leaf.original);
|
|
319
381
|
/* The pile's KEY —the engine's— and the label, which the level sets: they are two
|
|
320
382
|
texts and only the second changes with the language. */
|
|
321
383
|
const value = path[depth] ?? key;
|
|
@@ -325,11 +387,10 @@ export function DataTable({ data, columns, getRowId, sort, onSortChange, levels,
|
|
|
325
387
|
depth,
|
|
326
388
|
level: level?.label,
|
|
327
389
|
label: level === undefined ? value : level.labelOf(value),
|
|
328
|
-
/*
|
|
329
|
-
|
|
330
|
-
forty rows. */
|
|
331
|
-
count: row.getLeafRows().filter((leaf) => leaf.subRows.length === 0).length,
|
|
390
|
+
/* Counting the subgroups said «2» where there are forty rows. */
|
|
391
|
+
count: inside.length,
|
|
332
392
|
detail: undefined,
|
|
393
|
+
totals: columns.map((column) => aggregateOf(column, inside)),
|
|
333
394
|
open: collapsed === undefined ? row.getIsExpanded() : !collapsed.includes(key),
|
|
334
395
|
toggle: () => onGroupToggle === undefined ? row.toggleExpanded() : onGroupToggle(key),
|
|
335
396
|
};
|
|
@@ -352,6 +413,13 @@ export function DataTable({ data, columns, getRowId, sort, onSortChange, levels,
|
|
|
352
413
|
`aggregationFn` lives in the GROUP model, and a footer exists precisely when
|
|
353
414
|
there are no groups. */
|
|
354
415
|
const footer = useMemo(() => (totals ? columns.map((c) => aggregateOf(c, data)) : null), [totals, columns, data]);
|
|
416
|
+
/* A pile's row is split where the numbers start: its name spans the columns up to the
|
|
417
|
+
first one that sums, and from there each column says what the pile adds up to UNDER
|
|
418
|
+
itself — Odoo's grouped list. With no column that sums, the name spans the row. */
|
|
419
|
+
const firstSum = columns.findIndex((c) => c.aggregate !== undefined && c.numeric === true);
|
|
420
|
+
const lead = selecting ? 1 : 0;
|
|
421
|
+
const labelSpan = firstSum < 0 ? width : Math.max(1, lead + firstSum);
|
|
422
|
+
const sumsFrom = firstSum < 0 ? columns.length : labelSpan - lead;
|
|
355
423
|
const all = leaves.length > 0 && leaves.every((id) => selected?.has(id) === true);
|
|
356
424
|
const some = leaves.some((id) => selected?.has(id) === true);
|
|
357
425
|
function toggle(id, on) {
|
|
@@ -384,7 +452,10 @@ export function DataTable({ data, columns, getRowId, sort, onSortChange, levels,
|
|
|
384
452
|
gap,
|
|
385
453
|
/* The pile's row: it spans the whole width, says which value it groups by
|
|
386
454
|
and how many are inside — what makes it useful without opening it. */
|
|
387
|
-
|
|
455
|
+
_jsxs("tr", { ...windowed, "data-ui": "table.pile", className: "border-b border-line bg-ground", children: [_jsx("td", { colSpan: labelSpan, className: "px-3 py-1.5 whitespace-nowrap", style: indent, children: entry.toggle === undefined ? (_jsx("span", { className: "inline-flex items-center gap-1.5 text-meta font-medium text-ink", children: head })) : (_jsx("button", { type: "button", onClick: entry.toggle, "aria-expanded": entry.open, className: "inline-flex items-center gap-1.5 rounded-control text-meta font-medium text-ink transition-colors duration-(--duration-instant) hover:text-primary focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary", children: head })) }), columns.slice(sumsFrom).map((c, i) => {
|
|
456
|
+
const value = entry.totals[sumsFrom + i] ?? null;
|
|
457
|
+
return (_jsx("td", { className: `px-3 py-1.5 text-meta font-semibold tabular-nums whitespace-nowrap text-ink ${c.numeric === true ? "text-right" : ""}`, children: value === null ? null : aggregateLabel(copy, c, value) }, c.id));
|
|
458
|
+
}), firstSum < 0 || rowActions === undefined ? null : _jsx("td", {})] }, entry.id),
|
|
388
459
|
];
|
|
389
460
|
}
|
|
390
461
|
if (entry.kind === "more") {
|
|
@@ -821,11 +821,16 @@ groupTotal, height, layout = "auto", onOpen, onDiscard, bands, adds, flag, onReo
|
|
|
821
821
|
reaches inside (see `FieldBoundary`). */
|
|
822
822
|
_jsx(FieldBoundary, { children: _jsxs("div", { ref: frame, className: "min-w-0", children: [_jsx("div", { ref: box.ref, tabIndex: box.tabIndex, className: `min-w-0 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary ${box.className}`, style: box.style, children: stacked ? (list) : (_jsxs("table", { "data-ui": "table", className: "w-full border-separate border-spacing-0 px-1 text-left", ...(view.on
|
|
823
823
|
? { "aria-rowcount": 1 + drawn.length + (totals === undefined ? 0 : 1) }
|
|
824
|
-
: {}), children: [_jsx("thead", { className: "sticky z-10 bg-ui-table-head", style: stickyTop, "data-ui": "table.head", children: _jsxs("tr", { ...(view.on ? { "aria-rowindex": 1 } : {}), children: [reorderable ? _jsx("td", { className: "w-0 border-b border-line-strong" }) : null, columns.map((c) => c.header === "" ? (_jsx("td", { className: "w-0 border-b border-line-strong" }, c.id)) : (_jsx("th", { scope: "col", style: c.width === undefined ? undefined : { width: c.width },
|
|
824
|
+
: {}), children: [_jsx("thead", { className: "sticky z-10 bg-ui-table-head", style: stickyTop, "data-ui": "table.head", children: _jsxs("tr", { ...(view.on ? { "aria-rowindex": 1 } : {}), children: [reorderable ? _jsx("td", { className: "w-0 border-b border-line-strong" }) : null, columns.map((c, ci) => c.header === "" ? (_jsx("td", { className: "w-0 border-b border-line-strong" }, c.id)) : (_jsx("th", { scope: "col", style: c.width === undefined ? undefined : { width: c.width },
|
|
825
825
|
/* A column of figures takes its figures' width (`w-0` in an auto
|
|
826
826
|
table is «as narrow as its content») and the text takes the rest:
|
|
827
827
|
the product name was cut while «Cantidad» had room for ten digits. */
|
|
828
|
-
className: `border-b border-line-strong ${HEADER_TEXT} ${cell} ${c.numeric === true ? "text-right" : "text-left"} ${c.numeric === true && c.width === undefined ? "w-0" : ""}
|
|
828
|
+
className: `border-b border-line-strong ${HEADER_TEXT} ${cell} ${c.numeric === true ? "text-right" : "text-left"} ${c.numeric === true && c.width === undefined ? "w-0" : ""} ${
|
|
829
|
+
/* The title column — the card's title on a phone — keeps its
|
|
830
|
+
least: a name cut with «…» asks for no width of its own. */
|
|
831
|
+
places[ci] === "title" && c.width === undefined
|
|
832
|
+
? "min-w-(--size-cell-title)"
|
|
833
|
+
: ""}`, children: c.header }, c.id))), onRemove === undefined ? null : (_jsx("td", { className: "w-0 border-b border-line-strong" }))] }) }), _jsxs("tbody", { ref: view.body.ref, ...(reorderable
|
|
829
834
|
? {
|
|
830
835
|
onDragOver: overRow,
|
|
831
836
|
onDrop: (event) => {
|
|
@@ -7,6 +7,11 @@ export interface RowAction {
|
|
|
7
7
|
tone?: "normal" | "action" | "danger";
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
onSelect: () => void;
|
|
10
|
+
/** A way INTO the record (look, open, open in…) and not something done to it: always one
|
|
11
|
+
* press away, first, and in the modern style grouped in the navigation pill. */
|
|
12
|
+
way?: boolean;
|
|
13
|
+
/** Its choices: the action is a menu (`icon` its trigger) — «Abrir en…» with the places. */
|
|
14
|
+
menu?: readonly Pick<RowAction, "id" | "label" | "icon" | "onSelect">[];
|
|
10
15
|
}
|
|
11
16
|
export declare function RowActions({ actions,
|
|
12
17
|
/** How many stay visible before the rest fall into the `⋯`. */
|
|
@@ -1,26 +1,50 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useUiCopy } from "../../foundations/copy.js";
|
|
4
|
+
import { useViewStyle } from "../../foundations/viewStyle.js";
|
|
4
5
|
import { IconButton } from "../button/Button.js";
|
|
5
6
|
import { Menu } from "../menu/Menu.js";
|
|
6
7
|
import { useRowWash } from "./Table.js";
|
|
7
8
|
import { MoreHorizontal } from "lucide-react";
|
|
9
|
+
/* ── The ways in, in the modern style ─────────────────────────────────
|
|
10
|
+
*
|
|
11
|
+
* Grey icons at the row's end read as decoration, and an application added its own beside the
|
|
12
|
+
* name — three sets, unaligned. In the modern style the ways in are ONE pill, the pager's
|
|
13
|
+
* translucent primary (navigation has that colour across the system: where I am, where I go),
|
|
14
|
+
* always at the same place at the row's end; what is done to the record follows, quiet. */
|
|
15
|
+
function WayButton({ way, pill }) {
|
|
16
|
+
if (way.menu !== undefined) {
|
|
17
|
+
const byId = new Map(way.menu.map((m) => [m.id, m]));
|
|
18
|
+
return (_jsx(Menu, { label: way.label, title: way.label, icon: way.icon, iconOnly: true, chevron: false, variant: "text", size: "sm", align: "end", groups: [
|
|
19
|
+
{ options: way.menu.map((m) => ({ id: m.id, label: m.label, icon: m.icon })) },
|
|
20
|
+
], onSelect: (id) => byId.get(id)?.onSelect() }));
|
|
21
|
+
}
|
|
22
|
+
return (_jsx(IconButton, { icon: way.icon, label: way.label, size: "sm", ...(pill
|
|
23
|
+
? { tone: "action" }
|
|
24
|
+
: way.tone === undefined
|
|
25
|
+
? {}
|
|
26
|
+
: { tone: way.tone }), ...(way.disabled === undefined ? {} : { disabled: way.disabled }), onClick: way.onSelect }));
|
|
27
|
+
}
|
|
8
28
|
export function RowActions({ actions,
|
|
9
29
|
/** How many stay visible before the rest fall into the `⋯`. */
|
|
10
30
|
inline = 2, }) {
|
|
11
31
|
const copy = useUiCopy();
|
|
12
32
|
const wash = useRowWash();
|
|
33
|
+
const pill = useViewStyle() === "modern";
|
|
13
34
|
if (actions.length === 0)
|
|
14
35
|
return _jsx("td", { className: `w-0 border-b border-line ${wash}` });
|
|
36
|
+
/* The ways in are never folded into ⋯: each is one press away. The rest share `inline`. */
|
|
37
|
+
const ways = actions.filter((a) => a.way === true);
|
|
38
|
+
const done = actions.filter((a) => a.way !== true);
|
|
15
39
|
/* With only one left over there is no `⋯`: a menu with a single item is one
|
|
16
40
|
extra click to reach the same button. */
|
|
17
|
-
const inlineActions =
|
|
18
|
-
const overflow =
|
|
41
|
+
const inlineActions = done.length <= inline + 1 ? done : done.slice(0, inline);
|
|
42
|
+
const overflow = done.slice(inlineActions.length);
|
|
19
43
|
const byId = new Map(actions.map((a) => [a.id, a]));
|
|
20
44
|
return (
|
|
21
45
|
/* The row's hairline runs under its actions too: without it the separators stopped one
|
|
22
46
|
column short and the actions read as outside the table. */
|
|
23
|
-
_jsx("td", { className: `w-0 border-b border-line py-1 pr-2 pl-1 align-middle whitespace-nowrap last:rounded-r-control ${wash}`, children: _jsxs("div", { onClick: (e) => e.stopPropagation(), className: "flex items-center justify-end gap-0.5 opacity-0 transition-opacity duration-(--duration-instant) group-hover/row:opacity-100 focus-within:opacity-100 pointer-coarse:opacity-100", children: [inlineActions.map((a) => (_jsx(IconButton, { icon: a.icon, label: a.label, size: "sm", ...(a.tone === undefined ? {} : { tone: a.tone }), ...(a.disabled === undefined ? {} : { disabled: a.disabled }), onClick: a.onSelect }, a.id))), overflow.length === 0 ? null : (_jsx(Menu, { label: copy.selection.more, icon: MoreHorizontal, iconOnly: true, chevron: false, align: "end", groups: [
|
|
47
|
+
_jsx("td", { className: `w-0 border-b border-line py-1 pr-2 pl-1 align-middle whitespace-nowrap last:rounded-r-control ${wash}`, children: _jsxs("div", { onClick: (e) => e.stopPropagation(), className: "flex items-center justify-end gap-0.5 opacity-0 transition-opacity duration-(--duration-instant) group-hover/row:opacity-100 focus-within:opacity-100 pointer-coarse:opacity-100", children: [ways.length === 0 ? null : (_jsx("span", { "data-ui": "row.ways", "data-look": pill ? "pill" : "plain", className: `flex items-center gap-0.5 ${pill ? "rounded-pill border border-primary/20 bg-primary/8 p-0.5" : ""}`, children: ways.map((way) => (_jsx(WayButton, { way: way, pill: pill }, way.id))) })), inlineActions.map((a) => (_jsx(IconButton, { icon: a.icon, label: a.label, size: "sm", ...(a.tone === undefined ? {} : { tone: a.tone }), ...(a.disabled === undefined ? {} : { disabled: a.disabled }), onClick: a.onSelect }, a.id))), overflow.length === 0 ? null : (_jsx(Menu, { label: copy.selection.more, icon: MoreHorizontal, iconOnly: true, chevron: false, align: "end", groups: [
|
|
24
48
|
{
|
|
25
49
|
options: overflow.map((a) => ({
|
|
26
50
|
id: a.id,
|
|
@@ -8,6 +8,9 @@ export interface SheetColumn {
|
|
|
8
8
|
* seeing that `importe` was read as text explains the rest of the screen. */
|
|
9
9
|
type?: string;
|
|
10
10
|
numeric?: boolean;
|
|
11
|
+
/** How many decimals every number of the column is written with — cells and the totals of
|
|
12
|
+
* its bands: `2` lines «6.057,10» up over «8.370,57». Absent, up to two, as each value has. */
|
|
13
|
+
decimals?: number;
|
|
11
14
|
width?: number;
|
|
12
15
|
}
|
|
13
16
|
export declare function SheetTable({ columns, rows,
|
|
@@ -192,7 +192,12 @@ note, height = 420, rowLabel, band, onBandToggle, caption, onCommit, editable, o
|
|
|
192
192
|
}, children: _jsx(ChevronRight, { className: `size-(--size-icon-sm) shrink-0 text-muted transition-transform duration-(--duration-instant) ${montón.open ? "rotate-90" : ""}`, strokeWidth: 2, "aria-hidden": true }) })) }), columns.map((c, ci) => {
|
|
193
193
|
const total = montón.total?.(c, ci) ?? null;
|
|
194
194
|
return (_jsx("div", { role: "gridcell", style: { width: c.width ?? WIDTH }, className: `flex shrink-0 items-center overflow-hidden border-r border-line px-2.5 whitespace-nowrap ${c.numeric === true ? "justify-end" : "justify-start"}`, children: ci === 0 ? (_jsxs("span", { className: "flex min-w-0 items-center gap-1.5", children: [montón.field === undefined ? null : (_jsx("span", { className: "shrink-0 text-micro text-muted", children: montón.field })), _jsx("span", { className: "truncate text-micro font-medium text-ink", children: montón.label }), _jsx("span", { className: "inline-flex shrink-0 items-center rounded-pill border border-line-strong bg-ink/5 px-2 py-0.5 text-micro tabular-nums text-muted", children: montón.count.toLocaleString(copy.locale) })] })) : total === null ? null : (_jsx("span", { className: "truncate text-meta font-medium tabular-nums text-ink", children: typeof total === "number"
|
|
195
|
-
? total.toLocaleString(copy.locale
|
|
195
|
+
? total.toLocaleString(copy.locale, c.decimals === undefined
|
|
196
|
+
? {}
|
|
197
|
+
: {
|
|
198
|
+
minimumFractionDigits: c.decimals,
|
|
199
|
+
maximumFractionDigits: c.decimals,
|
|
200
|
+
})
|
|
196
201
|
: total })) }, c.id));
|
|
197
202
|
})] }, item.key));
|
|
198
203
|
}
|
|
@@ -210,7 +215,15 @@ note, height = 420, rowLabel, band, onBandToggle, caption, onCommit, editable, o
|
|
|
210
215
|
? "inset-ring-2 inset-ring-primary"
|
|
211
216
|
: isEditable
|
|
212
217
|
? "cursor-cell"
|
|
213
|
-
: ""}`, children: isEditingHere ? (_jsx("input", { autoFocus: true, value: draft, onChange: (ev) => setDraft(ev.target.value), onBlur: () => commit(0, 0), className: `absolute inset-0 w-full bg-surface px-2.5 text-meta tabular-nums text-ink outline-none ${c.numeric === true ? "text-right" : "text-left"}` })) : (
|
|
218
|
+
: ""}`, children: isEditingHere ? (_jsx("input", { autoFocus: true, value: draft, onChange: (ev) => setDraft(ev.target.value), onBlur: () => commit(0, 0), className: `absolute inset-0 w-full bg-surface px-2.5 text-meta tabular-nums text-ink outline-none ${c.numeric === true ? "text-right" : "text-left"}` })) : ((() => {
|
|
219
|
+
const v = value(item.index, c, ci);
|
|
220
|
+
/* Cut by the column's WIDTH, with «…» and the whole text a hover
|
|
221
|
+
away: «TRASPASO CTA PROPIA BN» fit the character limit and not
|
|
222
|
+
the column, and was clipped mid-letter. */
|
|
223
|
+
return (_jsx("span", { className: "min-w-0 truncate", title: typeof v === "string" && v !== "" ? v : undefined, children: _jsx(Cell, { value: v, max: 24, ...(c.decimals === undefined
|
|
224
|
+
? {}
|
|
225
|
+
: { decimals: c.decimals }) }) }));
|
|
226
|
+
})()) }, c.id));
|
|
214
227
|
}), _jsx("div", { className: "flex-1" })] }, item.key));
|
|
215
228
|
}) })] }) }), canAdd ? (
|
|
216
229
|
/* Under the grid and outside its scroll box, like the editable table's «add»: in
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { type Aggregate, type DataColumn, DataTable, type DataTableCreate, type GroupColumn, } from "./DataTable.js";
|
|
1
|
+
export { type Aggregate, type DataColumn, DataTable, type DataTableCreate, type GroupColumn, type YesNoColumn, } from "./DataTable.js";
|
|
2
2
|
export { EditableTable, type EditAdd, type EditBands, type EditCellState, type EditColumn, type EditFlag, type EditLayout, type EditRowState, sectionLines, type StackPlace, stackPlaces, type TabTarget, tabTarget, } from "./EditableTable.js";
|
|
3
3
|
export { PileFootLine } from "./PileFootLine.js";
|
|
4
4
|
export { PivotTable, type PivotTableProps, } from "./PivotTable.js";
|
|
@@ -52,7 +52,11 @@ export declare function Numeric({ value, unit, format, align, rounding, signed,
|
|
|
52
52
|
export declare function Cell({ value,
|
|
53
53
|
/** From how many characters it gets truncated. A 64 character identifier
|
|
54
54
|
* breaks the width of the whole table for a column nobody reads in full. */
|
|
55
|
-
max,
|
|
55
|
+
max,
|
|
56
|
+
/** How many decimals a number is written with — the column's, so every number in it lines
|
|
57
|
+
* up: «6.057,10» over «8.370,57». Absent, up to two, as the value has them. */
|
|
58
|
+
decimals, }: {
|
|
56
59
|
value: string | number | null | undefined;
|
|
57
60
|
max?: number;
|
|
61
|
+
decimals?: number;
|
|
58
62
|
}): import("react").JSX.Element;
|
|
@@ -80,7 +80,10 @@ export function Numeric({ value, unit, format = "integer", align = "right", roun
|
|
|
80
80
|
export function Cell({ value,
|
|
81
81
|
/** From how many characters it gets truncated. A 64 character identifier
|
|
82
82
|
* breaks the width of the whole table for a column nobody reads in full. */
|
|
83
|
-
max = 48,
|
|
83
|
+
max = 48,
|
|
84
|
+
/** How many decimals a number is written with — the column's, so every number in it lines
|
|
85
|
+
* up: «6.057,10» over «8.370,57». Absent, up to two, as the value has them. */
|
|
86
|
+
decimals, }) {
|
|
84
87
|
const copy = useUiCopy();
|
|
85
88
|
if (value === null || value === undefined) {
|
|
86
89
|
return (
|
|
@@ -88,8 +91,11 @@ max = 48, }) {
|
|
|
88
91
|
cell — and a missing value is exactly what someone has to see. */
|
|
89
92
|
_jsx("span", { className: "text-ink italic", title: copy.cell.missing, children: copy.cell.missing }));
|
|
90
93
|
}
|
|
91
|
-
if (typeof value === "number")
|
|
92
|
-
return _jsx(Numeric, { value: value, format:
|
|
94
|
+
if (typeof value === "number") {
|
|
95
|
+
return (_jsx(Numeric, { value: value, format: decimals === undefined
|
|
96
|
+
? "decimal"
|
|
97
|
+
: { minimumFractionDigits: decimals, maximumFractionDigits: decimals } }));
|
|
98
|
+
}
|
|
93
99
|
if (value === "") {
|
|
94
100
|
return (_jsx("span", { className: "text-line-strong", title: copy.cell.empty, children: "\u00B7" }));
|
|
95
101
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A yes / no, READ: how a boolean looks where it is shown and not changed — a cell, a fact, a
|
|
3
|
+
* card.
|
|
4
|
+
*
|
|
5
|
+
* Context: a column of booleans drew «Sí» / «No» as plain text in one place, a bare ✓ and
|
|
6
|
+
* nothing in another, «✓ Sí» / «No» in a third. Each is right for some column, so they are
|
|
7
|
+
* LOOKS of one piece, chosen per column:
|
|
8
|
+
*
|
|
9
|
+
* check ✓ for yes, nothing for no — a column scanned for its yeses («Publicado»).
|
|
10
|
+
* icon a green ✓ and a quiet ✕ — both answers matter and are read at a glance.
|
|
11
|
+
* word «✓ Sí» / «No» — a check alone is not read by everyone the same way.
|
|
12
|
+
*
|
|
13
|
+
* Color never alone: the green ✓ has a shape that is not the ✕'s, and every look says «Sí» or
|
|
14
|
+
* «No» to a screen reader, the empty «no» of `check` included — an empty cell is not an answer.
|
|
15
|
+
* To CHANGE it from where it is shown, a column draws a checkbox or a switch instead (the
|
|
16
|
+
* table's `yesNo.onToggle`).
|
|
17
|
+
*/
|
|
18
|
+
export type YesNoLook = "check" | "icon" | "word";
|
|
19
|
+
export declare function YesNo({ value, look }: {
|
|
20
|
+
value: boolean;
|
|
21
|
+
look?: YesNoLook;
|
|
22
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useUiCopy } from "../../foundations/copy.js";
|
|
4
|
+
import { Check, X } from "lucide-react";
|
|
5
|
+
export function YesNo({ value, look = "word" }) {
|
|
6
|
+
const copy = useUiCopy();
|
|
7
|
+
const said = value ? copy.table.yes : copy.table.no;
|
|
8
|
+
if (look === "icon") {
|
|
9
|
+
return (_jsxs("span", { "data-ui": "yes-no", "data-value": value ? "yes" : "no", className: `inline-flex size-5 shrink-0 items-center justify-center rounded-pill ${value ? "bg-good/12 text-good" : "bg-ink/6 text-muted"}`, children: [value ? (_jsx(Check, { "aria-hidden": true, className: "size-(--size-icon-sm)", strokeWidth: 2.75 })) : (_jsx(X, { "aria-hidden": true, className: "size-(--size-icon-sm)", strokeWidth: 2.5 })), _jsx("span", { className: "sr-only", children: said })] }));
|
|
10
|
+
}
|
|
11
|
+
if (look === "check") {
|
|
12
|
+
return value ? (_jsxs("span", { "data-ui": "yes-no", "data-value": "yes", className: "inline-flex text-good", children: [_jsx(Check, { "aria-hidden": true, className: "size-(--size-icon-sm)", strokeWidth: 2.5 }), _jsx("span", { className: "sr-only", children: said })] })) : (_jsx("span", { "data-ui": "yes-no", "data-value": "no", className: "sr-only", children: said }));
|
|
13
|
+
}
|
|
14
|
+
/* `word`: «no» needs no icon — an empty mark next to every false row would only add noise. */
|
|
15
|
+
return value ? (_jsxs("span", { "data-ui": "yes-no", "data-value": "yes", className: "inline-flex items-center gap-1 text-ink", children: [_jsx(Check, { "aria-hidden": true, className: "size-(--size-icon-sm) text-good", strokeWidth: 2.5 }), said] })) : (_jsx("span", { "data-ui": "yes-no", "data-value": "no", className: "text-muted", children: said }));
|
|
16
|
+
}
|
|
@@ -10,3 +10,4 @@ export { isRichTextEmpty, richTextPlain, RichTextValue, sanitizeRichText, } from
|
|
|
10
10
|
export { type Rounding, type RoundingMethod, roundTo, } from "./rounding.js";
|
|
11
11
|
export { Totals, type TotalsCredit, type TotalsDeduction, type TotalsFact, type TotalsProps, type TotalsRow, } from "./Totals.js";
|
|
12
12
|
export { Cell, formatCount, formatDistance, formatNumber, formatWith, KeyValue, Numeric, } from "./Value.js";
|
|
13
|
+
export { YesNo, type YesNoLook } from "./YesNo.js";
|
|
@@ -12,3 +12,4 @@ export { isRichTextEmpty, richTextPlain, RichTextValue, sanitizeRichText, } from
|
|
|
12
12
|
export { roundTo, } from "./rounding.js";
|
|
13
13
|
export { Totals, } from "./Totals.js";
|
|
14
14
|
export { Cell, formatCount, formatDistance, formatNumber, formatWith, KeyValue, Numeric, } from "./Value.js";
|
|
15
|
+
export { YesNo } from "./YesNo.js";
|
package/dist/tokens.css
CHANGED
|
@@ -523,6 +523,10 @@
|
|
|
523
523
|
line. Without it, «de dónde vengo» takes the room from what hangs off the
|
|
524
524
|
record and the centre stops being in the centre. */
|
|
525
525
|
--container-crumb: 12rem;
|
|
526
|
+
/* The current crumb when the trail IS the page's heading (`Breadcrumb size="lg"`, the modern
|
|
527
|
+
style): at the title's size 12 rem cut «Clínica San Gabriel …» with the line half empty.
|
|
528
|
+
It still has a cap — a fifty-character name must leave room for the pager. */
|
|
529
|
+
--container-crumb-heading: 28rem;
|
|
526
530
|
--container-trail: 20rem;
|
|
527
531
|
|
|
528
532
|
/* The grid of the app switcher: three columns of icon + word. */
|
|
@@ -548,6 +552,12 @@
|
|
|
548
552
|
for «Contacto y guía pública», narrow enough that the cards keep the page. */
|
|
549
553
|
--container-form-index: 12rem;
|
|
550
554
|
|
|
555
|
+
/* The least a table's TITLE column keeps (`EditableTable`, `LineItems`): the product of an
|
|
556
|
+
invoice line. A name cut with «…» has almost no width of its own, so beside figures with
|
|
557
|
+
a width the table squeezed it to «Imp…» while «Precio» had room for ten digits. 14 rem
|
|
558
|
+
reads «Impresora térmica de tickets» whole; past it the table scrolls or stacks. */
|
|
559
|
+
--size-cell-title: 14rem;
|
|
560
|
+
|
|
551
561
|
/* The tag column of a list row. It is what the column ASKS FOR, and it
|
|
552
562
|
belongs to the system: with a width of its own every tag starts where its
|
|
553
563
|
own ends and twelve rows give twelve indents. Asking for the same 8 rem,
|
|
@@ -1196,8 +1206,15 @@
|
|
|
1196
1206
|
/* Horizontal only. Removing `overflow: hidden` entirely uncovered something that
|
|
1197
1207
|
* overflows sideways —a panel hidden off-screen, measured for
|
|
1198
1208
|
* a width that is no longer its own— and without this brake one could scroll to
|
|
1199
|
-
* the right to see it. The height stays free: that is what was being fixed.
|
|
1200
|
-
|
|
1209
|
+
* the right to see it. The height stays free: that is what was being fixed.
|
|
1210
|
+
*
|
|
1211
|
+
* `clip`, not `hidden`: `hidden` on one axis turns the other into `auto`, so the body was
|
|
1212
|
+
* a scroll container in waiting. While a menu or a dialog is open React Aria locks the
|
|
1213
|
+
* page (`overflow: hidden` on `html`), the body's overflow stops reaching the viewport,
|
|
1214
|
+
* and the body BECAME the scroller — every sticky thing (a list's bar, a table's header,
|
|
1215
|
+
* the floating actions) let go and slid away with the page, menu and all. `clip` cuts
|
|
1216
|
+
* the same and is never a scroller. */
|
|
1217
|
+
overflow-x: clip;
|
|
1201
1218
|
}
|
|
1202
1219
|
|
|
1203
1220
|
/* Tabular figures on everything monospaced: a column of rows has to line up
|
|
@@ -1470,6 +1487,22 @@
|
|
|
1470
1487
|
* whose tap the system takes for a swipe home. It needs `viewport-fit=cover` in the
|
|
1471
1488
|
* page to measure anything; without it the inset is 0 and this is plain `pb-3`.
|
|
1472
1489
|
* ------------------------------------------------------------------ */
|
|
1490
|
+
/* A board's figure FITS its tile (#68): never cut, never past the tile's edge. Its size is the
|
|
1491
|
+
tile's width over the figure's length — between the title step and its own step (the
|
|
1492
|
+
figure's, or the hero's for the lead one) —, so «15» stays big and «Bs 1.234.567,89» steps
|
|
1493
|
+
down until it fits. CSS only, nothing measured: the length is the figure's characters
|
|
1494
|
+
(`--figure-length`, written by the component), the width the tile's (`cqi` — the tile is its
|
|
1495
|
+
own container), and a character of the figure's face is about 0.62 of its size wide. */
|
|
1496
|
+
@utility figure-fit {
|
|
1497
|
+
font-size: clamp(
|
|
1498
|
+
var(--text-title),
|
|
1499
|
+
calc(100cqi / (var(--figure-length, 8) * 0.62)),
|
|
1500
|
+
var(--figure-step, var(--text-figure))
|
|
1501
|
+
);
|
|
1502
|
+
line-height: var(--text-figure--line-height);
|
|
1503
|
+
letter-spacing: var(--text-figure--letter-spacing);
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1473
1506
|
@utility safe-bottom {
|
|
1474
1507
|
padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
|
|
1475
1508
|
}
|
|
@@ -3,10 +3,11 @@ import type { ListIdentity } from "../../components/listing/ListingBar.js";
|
|
|
3
3
|
import type { SortField } from "../../components/listing/SortMenu.js";
|
|
4
4
|
import type { ViewIcon } from "../../components/listing/ViewSwitcher.js";
|
|
5
5
|
import type { Surface } from "../../foundations/types.js";
|
|
6
|
+
import type { OpenTarget } from "../../foundations/types.js";
|
|
6
7
|
import type { DataColumn, DataTableCreate } from "../../primitives/table/DataTable.js";
|
|
7
8
|
import type { RowAction } from "../../primitives/table/RowActions.js";
|
|
8
9
|
import type { SortState } from "../../primitives/table/sorting.js";
|
|
9
|
-
import {
|
|
10
|
+
import type { CardWays, ListCalendar, ListChart, ListCrumb, ListDock, ListEmpty, ListGantt, ListGroup, ListPivot, ListPresent, ListReport, ListSet, ListSheet, ListTimeline, RowOf } from "./types.js";
|
|
10
11
|
import type { ReactNode } from "react";
|
|
11
12
|
type BarProps = {
|
|
12
13
|
children?: ReactNode;
|
|
@@ -110,6 +111,9 @@ export type ListProps<T extends object> = {
|
|
|
110
111
|
onOpen?: (item: T) => void;
|
|
111
112
|
onPeek?: (item: T) => void;
|
|
112
113
|
isPeeked?: (item: T) => boolean;
|
|
114
|
+
/** «Abrir en…» in the row's ways: the other places its record opens (see `ListViewProps`). */
|
|
115
|
+
openTargets?: readonly OpenTarget[];
|
|
116
|
+
onOpenIn?: (item: T, to: OpenTarget) => void;
|
|
113
117
|
/** What a press on the row's body does when both ways in exist. `peek` (the default) looks
|
|
114
118
|
* without leaving the list; `open` goes to the record — a workspace whose rule is «a row
|
|
115
119
|
* opens the page» (the composer's) says `open`, and 👁 stays for the look. */
|
|
@@ -140,13 +144,14 @@ export type ListProps<T extends object> = {
|
|
|
140
144
|
empty?: ListEmpty;
|
|
141
145
|
children?: ReactNode;
|
|
142
146
|
};
|
|
143
|
-
export declare function List<T extends object>({ items, keyOf, embedded, surface, group, selection: selectWith, sort, onSortChange, sortable, present, onPresentChange, onOpen: openWith, onPeek: peekWith, isPeeked, readOnly, rowClick, onChoose, state, filtered, empty, children, }: ListProps<T>): import("react").JSX.Element;
|
|
147
|
+
export declare function List<T extends object>({ items, keyOf, embedded, surface, group, selection: selectWith, sort, onSortChange, sortable, present, onPresentChange, onOpen: openWith, onPeek: peekWith, isPeeked, openTargets, onOpenIn, readOnly, rowClick, onChoose, state, filtered, empty, children, }: ListProps<T>): import("react").JSX.Element;
|
|
144
148
|
export declare namespace List {
|
|
145
149
|
var Bar: ((props: BarProps) => ReactNode) & import("../../foundations/slots.js").Slotted<"bar">;
|
|
146
150
|
var Crumbs: ((props: CrumbsProps) => ReactNode) & import("../../foundations/slots.js").Slotted<"crumbs">;
|
|
147
151
|
var Identity: ((props: ListIdentity) => ReactNode) & import("../../foundations/slots.js").Slotted<"identity">;
|
|
148
152
|
var Search: ((props: NodeProps) => ReactNode) & import("../../foundations/slots.js").Slotted<"search">;
|
|
149
153
|
var Actions: ((props: NodeProps) => ReactNode) & import("../../foundations/slots.js").Slotted<"actions">;
|
|
154
|
+
var Dock: ((props: ListDock) => ReactNode) & import("../../foundations/slots.js").Slotted<"dock">;
|
|
150
155
|
var Pagination: ((props: NodeProps) => ReactNode) & import("../../foundations/slots.js").Slotted<"pagination">;
|
|
151
156
|
var Views: ((props: NodeProps) => ReactNode) & import("../../foundations/slots.js").Slotted<"views">;
|
|
152
157
|
var Metrics: ((props: NodeProps) => ReactNode) & import("../../foundations/slots.js").Slotted<"metrics">;
|