@sincpro/web-ui 2.0.0 → 2.2.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 +45 -0
- package/dist/components/activity/Activity.d.ts +13 -14
- package/dist/components/activity/Activity.js +1 -1
- package/dist/components/activity/Messages.d.ts +5 -5
- package/dist/components/activity/Messages.js +8 -8
- package/dist/components/attachments/Attachments.d.ts +7 -1
- package/dist/components/attachments/Attachments.js +8 -2
- package/dist/components/board/Board.d.ts +32 -2
- package/dist/components/board/Board.js +27 -4
- package/dist/components/board/index.d.ts +1 -1
- package/dist/components/board/index.js +2 -1
- package/dist/components/form/Form.js +6 -6
- package/dist/components/form/index.js +2 -2
- package/dist/components/frame/FrameView.d.ts +5 -5
- package/dist/components/frame/FrameView.js +4 -4
- package/dist/components/listing/GroupingLevels.d.ts +22 -22
- package/dist/components/listing/GroupingLevels.js +9 -9
- package/dist/components/listing/Listing.d.ts +11 -11
- package/dist/components/listing/Listing.js +11 -11
- package/dist/components/listing/ListingBar.js +11 -11
- package/dist/components/listing/Row.d.ts +19 -19
- package/dist/components/listing/Row.js +27 -27
- package/dist/components/listing/SortMenu.d.ts +36 -36
- package/dist/components/listing/SortMenu.js +6 -6
- package/dist/components/listing/grouping.d.ts +16 -16
- package/dist/components/listing/grouping.js +6 -6
- package/dist/components/listing/index.js +1 -1
- package/dist/components/listing/modelColumns.d.ts +25 -25
- package/dist/components/listing/modelColumns.js +24 -24
- package/dist/components/listing/pages.js +4 -4
- package/dist/components/listing/set.d.ts +18 -18
- package/dist/components/navigation/NavigationTree.js +2 -2
- package/dist/components/navigation/index.js +2 -2
- package/dist/components/record/RecordSkeleton.js +7 -7
- package/dist/components/search/CriteriaBuilder.d.ts +22 -22
- package/dist/components/search/CriteriaBuilder.js +31 -31
- package/dist/components/search/CriteriaChips.d.ts +9 -9
- package/dist/components/search/CriteriaChips.js +12 -12
- package/dist/components/search/FilterBuilder.d.ts +67 -67
- package/dist/components/search/FilterBuilder.js +104 -104
- package/dist/components/search/JoinWord.d.ts +1 -1
- package/dist/components/search/JoinWord.js +14 -14
- package/dist/components/search/JsonEditor.d.ts +8 -8
- package/dist/components/search/JsonEditor.js +16 -16
- package/dist/components/search/SearchBar.d.ts +34 -34
- package/dist/components/search/SearchBar.js +140 -117
- package/dist/components/search/criteria.d.ts +61 -61
- package/dist/components/search/criteria.js +39 -39
- package/dist/components/search/datePeriods.d.ts +47 -48
- package/dist/components/search/datePeriods.js +29 -29
- package/dist/components/search/dateRanges.d.ts +27 -27
- package/dist/components/search/dateRanges.js +16 -16
- package/dist/components/search/index.js +13 -13
- package/dist/components/search/model.d.ts +28 -28
- package/dist/components/search/model.js +21 -21
- package/dist/components/search/query.d.ts +71 -71
- package/dist/components/search/query.js +119 -119
- package/dist/components/shell/AppFrame.d.ts +9 -2
- package/dist/components/shell/AppFrame.js +102 -14
- package/dist/components/shell/Sidebar.d.ts +34 -0
- package/dist/components/shell/Sidebar.js +32 -0
- package/dist/components/shell/TopBar.d.ts +2 -0
- package/dist/components/shell/TopBar.js +13 -9
- package/dist/components/shell/index.d.ts +2 -0
- package/dist/components/shell/index.js +5 -1
- package/dist/components/shell/sidebarDrawer.d.ts +26 -0
- package/dist/components/shell/sidebarDrawer.js +22 -0
- package/dist/foundations/calendar.d.ts +27 -27
- package/dist/foundations/calendar.js +72 -72
- package/dist/foundations/chart.d.ts +57 -57
- package/dist/foundations/chart.js +27 -27
- package/dist/foundations/copy.d.ts +109 -94
- package/dist/foundations/copy.es.js +10 -2
- package/dist/foundations/copy.js +10 -2
- package/dist/foundations/grouping.d.ts +175 -175
- package/dist/foundations/grouping.js +0 -0
- package/dist/foundations/index.d.ts +1 -1
- package/dist/foundations/index.js +21 -21
- package/dist/foundations/pivot.d.ts +133 -131
- package/dist/foundations/pivot.js +54 -54
- package/dist/foundations/pivotSheet.d.ts +36 -36
- package/dist/foundations/pivotSheet.js +0 -0
- package/dist/foundations/slots.d.ts +38 -38
- package/dist/foundations/slots.js +18 -18
- package/dist/foundations/sticky.d.ts +28 -28
- package/dist/foundations/sticky.js +59 -59
- package/dist/foundations/xlsx.d.ts +47 -47
- package/dist/foundations/xlsx.js +0 -0
- package/dist/primitives/block/Line.d.ts +4 -4
- package/dist/primitives/block/Line.js +28 -28
- package/dist/primitives/block/index.js +2 -2
- package/dist/primitives/cell/index.js +2 -2
- package/dist/primitives/choice/index.js +3 -3
- package/dist/primitives/date/Calendar.d.ts +7 -1
- package/dist/primitives/date/Calendar.js +13 -3
- package/dist/primitives/date/DatePicker.d.ts +4 -1
- package/dist/primitives/date/DatePicker.js +2 -2
- package/dist/primitives/date/index.js +3 -3
- package/dist/primitives/disclosure/index.js +1 -1
- package/dist/primitives/field/DropZone.d.ts +22 -3
- package/dist/primitives/field/DropZone.js +33 -12
- package/dist/primitives/menu/Menu.d.ts +10 -6
- package/dist/primitives/menu/Menu.js +4 -3
- package/dist/primitives/notice/Callout.d.ts +30 -30
- package/dist/primitives/notice/Callout.js +6 -6
- package/dist/primitives/overlay/index.js +3 -3
- package/dist/primitives/picker/Picker.d.ts +6 -0
- package/dist/primitives/picker/Picker.js +27 -4
- package/dist/primitives/picker/index.js +2 -2
- package/dist/primitives/table/DataTable.d.ts +32 -32
- package/dist/primitives/table/DataTable.js +24 -24
- package/dist/primitives/table/EditableTable.d.ts +10 -10
- package/dist/primitives/table/EditableTable.js +9 -9
- package/dist/primitives/table/ReportTable.js +7 -7
- package/dist/primitives/table/SheetTable.d.ts +13 -13
- package/dist/primitives/table/SheetTable.js +14 -14
- package/dist/primitives/table/Table.js +8 -8
- package/dist/primitives/tabs/Tabs.d.ts +46 -46
- package/dist/primitives/tabs/Tabs.js +4 -30
- package/dist/primitives/tag/Count.d.ts +23 -0
- package/dist/primitives/tag/Count.js +59 -0
- package/dist/primitives/tag/index.d.ts +1 -0
- package/dist/primitives/tag/index.js +5 -2
- package/dist/primitives/toolbar/index.js +1 -1
- package/dist/primitives/value/Copyable.d.ts +22 -22
- package/dist/primitives/value/Copyable.js +9 -9
- package/dist/primitives/value/Metric.d.ts +7 -2
- package/dist/primitives/value/Metric.js +12 -4
- package/dist/tokens.css +164 -57
- package/dist/views/list/List.d.ts +36 -36
- package/dist/views/list/List.js +19 -19
- package/dist/views/list/ListView.js +74 -74
- package/dist/views/list/columns.d.ts +10 -10
- package/dist/views/list/columns.js +10 -10
- package/dist/views/list/derive.d.ts +30 -30
- package/dist/views/list/derive.js +49 -49
- package/dist/views/list/index.js +2 -2
- package/dist/views/list/presentations.js +3 -3
- package/dist/views/list/types.d.ts +109 -109
- package/dist/views/record/Record.d.ts +14 -14
- package/dist/views/record/Record.js +24 -24
- package/dist/views/record/index.js +1 -1
- package/package.json +1 -1
|
@@ -60,18 +60,18 @@ import { createPortal } from "react-dom";
|
|
|
60
60
|
* ==================================================================== */
|
|
61
61
|
export function Listing({ bar, metrics, sticky = false, surface, children, }) {
|
|
62
62
|
const d = useDensity();
|
|
63
|
-
/*
|
|
64
|
-
Context:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
/* The bar STICKS to the top and the rows go beneath it.
|
|
64
|
+
Context: with 187 rows, scrolling to see the last one left you without search,
|
|
65
|
+
without pager and without the presentation switcher — so cutting
|
|
66
|
+
after looking forced you to scroll up again. It sticks below whatever is already
|
|
67
|
+
stuck (the application bar) and pushes the stack down for the
|
|
68
|
+
table's header, which sticks below it. See `system/sticky.tsx`. */
|
|
69
69
|
const band = useStickyLayer();
|
|
70
|
-
/*
|
|
71
|
-
|
|
72
|
-
scroll.
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
/* In compact it does NOT stick, and not for lack of space: compact is a drawer
|
|
71
|
+
or a preview, that is a short box with its own header and its own
|
|
72
|
+
scroll. A band stuck there is painted over the drawer's white paper —it
|
|
73
|
+
looks like a stain— to solve a scroll that does not exist in five rows.
|
|
74
|
+
It is the same reason `ListingBar` does not draw the identity there either. */
|
|
75
75
|
const pegada = sticky && d === "comfortable";
|
|
76
76
|
/* With a sidebar the bar is the screen's header: it goes in the frame's full-width slot,
|
|
77
77
|
above the sidebar (see `shell/headerSlot.ts`), and the frame does the sticking. */
|
|
@@ -103,18 +103,18 @@ export function ListingBar({ actions, title, description, counters, selection, s
|
|
|
103
103
|
: fillCopy(copy.list.count, { count: count.toLocaleString(copy.locale) }) })));
|
|
104
104
|
return (_jsx(SurfaceProvider, { value: "canvas", children: _jsxs("div", { className: `flex min-w-0 flex-wrap items-center gap-y-1.5 ${byDensity(d, "gap-x-3", "gap-x-2")}`, children: [title === undefined ? null : (_jsx("h2", { className: "min-w-0 shrink-0 truncate text-body font-semibold text-ink", children: title })), center === null ? null : (_jsx("div", { className: "flex min-w-0 flex-1 basis-(--container-name) items-center overflow-x-clip overflow-y-visible", children: center })), howMany, views === undefined ? null : (_jsx("div", { className: "ml-auto flex shrink-0 items-center gap-2", children: views })), actions === undefined ? null : (_jsx("div", { className: `flex shrink-0 items-center gap-1.5 ${views === undefined ? "ml-auto" : ""}`, children: actions }))] }) }));
|
|
105
105
|
}
|
|
106
|
-
/*
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
/* The search field goes in the CENTRE of the line, centred against the
|
|
107
|
+
line: it asks for `--container-search` and the two sides share what is left
|
|
108
|
+
in equal halves. Before, it took the rest, so a long trail on the
|
|
109
|
+
left pushed it —and two lists in a row drew their search box in two
|
|
110
|
+
different places—. See `primitives/block/Line.tsx`. */
|
|
111
111
|
const topRow = (_jsx(Line, { asks: "var(--container-crumb)", centerAsks: center === null ? "auto" : "var(--container-search)", gap: byDensity(d, "gap-x-4 gap-y-2", "gap-x-2 gap-y-1.5"), align: "items-start", start: crumbs,
|
|
112
|
-
/* `overflow-x-clip`
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
112
|
+
/* `overflow-x-clip` and NOT `overflow-hidden`: what has to be clipped is the
|
|
113
|
+
width —so the field does not paint over «1–80»—, and `hidden` on one axis
|
|
114
|
+
forces `auto` on the other, so it also clipped DOWNWARD. The
|
|
115
|
+
`SearchBar`'s filter panel hangs with `absolute top-full`, that is
|
|
116
|
+
just outside this box: pressing the funnel opened a panel nobody
|
|
117
|
+
saw. `clip` is the only value that leaves the other axis `visible`. */
|
|
118
118
|
center: center === null ? null : (_jsx("div", { className: "flex w-full min-w-0 items-center overflow-x-clip overflow-y-visible", children: center })), end: pagination }));
|
|
119
119
|
const bottomRow = actions === undefined && !withIdentity && views === undefined ? null : (
|
|
120
120
|
/* On a narrow list (a phone, a drawer) the name and its counters take the whole first
|
|
@@ -59,37 +59,37 @@ export declare function Row({ icon: Icon, avatar, name, onOpen, onPeek, click, o
|
|
|
59
59
|
children?: ReactNode;
|
|
60
60
|
}): import("react").JSX.Element;
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
62
|
+
* THE ROWS PRESENTATION'S HEADER.
|
|
63
63
|
*
|
|
64
|
-
* Context:
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
64
|
+
* Context: the table and the sheet say what each column is; the rows list
|
|
65
|
+
* said nothing. Eighty lines with «Ferretería Sur · 13 sept · Bs 12.480» on the
|
|
66
|
+
* right and a card at the end, and you had to deduce what each number was — or
|
|
67
|
+
* switch to the table to find out, which is changing presentation to read
|
|
68
|
+
* the same screen.
|
|
69
69
|
*
|
|
70
|
-
* **
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
70
|
+
* **They are not columns: they are the row's ZONES, labelled.** A row has a
|
|
71
|
+
* name that stretches, a `meta` that is ONE already-formatted string, and a
|
|
72
|
+
* column of cards of fixed width. Labelling them as if they were three aligned
|
|
73
|
+
* columns would be lying about what is underneath: one row's `meta` may
|
|
74
|
+
* say three things and another's two.
|
|
75
75
|
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
76
|
+
* That is why it traces `Row`'s box —same padding, same gaps, same
|
|
77
|
+
* checkbox, icon and actions spacers— instead of declaring a width of its
|
|
78
|
+
* own. If `Row` changes its geometry, this follows it.
|
|
79
79
|
*/
|
|
80
80
|
export declare function RowHeader({ name, meta, tags, withSelection, withIcon, withAvatar, withActions, trail, }: {
|
|
81
81
|
name: string;
|
|
82
82
|
meta?: string;
|
|
83
83
|
tags?: string;
|
|
84
|
-
/**
|
|
85
|
-
*
|
|
84
|
+
/** The spacers on the left. Whoever draws the rows puts them, because
|
|
85
|
+
* they are the only one who knows whether this list selects and whether its rows have an icon. */
|
|
86
86
|
withSelection?: boolean;
|
|
87
87
|
withIcon?: boolean;
|
|
88
88
|
/** The rows carry a face instead of an icon: a wider spacer, so the labels stay aligned. */
|
|
89
89
|
withAvatar?: boolean;
|
|
90
|
-
/**
|
|
91
|
-
* —
|
|
92
|
-
*
|
|
90
|
+
/** The actions zone on the right takes up its place even when invisible
|
|
91
|
+
* —so nothing shifts when the pointer passes—, so the cards' label
|
|
92
|
+
* ends up misaligned if the same is not reserved here. */
|
|
93
93
|
withActions?: boolean;
|
|
94
94
|
/** What the rows have at their end — the same flags `Row` gets — drawn invisible here so
|
|
95
95
|
* the header reserves exactly that width. Takes over from `withActions`. */
|
|
@@ -63,17 +63,17 @@ export function Row({ icon: Icon, avatar, name, onOpen, onPeek, click = "peek",
|
|
|
63
63
|
inset and rounded, so the hover is a mark and not a stripe. The inner
|
|
64
64
|
padding is shorter by exactly that inset, so the text does not move. */
|
|
65
65
|
className: `group/row flex min-w-0 items-center rounded-control transition-colors duration-(--duration-instant) ${interactive ? "cursor-pointer hover:bg-ink/4" : ""} ${byDensity(d, "gap-3 px-2 py-2", "gap-2 px-1.5 py-1")}`,
|
|
66
|
-
/* `onPeek`
|
|
67
|
-
natural
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
/* `onPeek` with `onOpen` as a fallback: whoever declares only `onOpen` —what is
|
|
67
|
+
natural if they never heard of the preview— must be able to open
|
|
68
|
+
just the same by clicking anywhere on the row, not only on the
|
|
69
|
+
name. With the preview turned off (`PeekLayer.tsx`) this is today the
|
|
70
|
+
case for everyone: a click on the row opens, plain and simple. */
|
|
71
71
|
onClick: click === "open" ? (onOpen ?? onPeek) : (onPeek ?? onOpen), role: "presentation", children: [onSelectedChange === undefined ? null : (_jsx("input", { type: "checkbox", checked: selected ?? false, "aria-label": fillCopy(copy.selection.named, { name }), onChange: (e) => onSelectedChange(e.target.checked), onClick: (e) => e.stopPropagation(), className: "size-3.5 shrink-0 cursor-pointer accent-primary" })), avatar !== undefined ? (_jsx(Avatar, { name: avatar.name, size: "sm", ...(avatar.src === undefined ? {} : { src: avatar.src }) })) : Icon === undefined ? null : (_jsx(Icon, { className: "size-(--size-icon-md) shrink-0 text-muted", strokeWidth: 1.75, "aria-hidden": true })), _jsxs("div", { className: `flex min-w-0 shrink grow basis-(--container-name) flex-wrap items-center gap-y-0 ${byDensity(d, "gap-x-3", "gap-x-2")}`, children: [_jsx("span", { className: "min-w-0 grow basis-(--container-name)", children: _jsx(RecordLink, { ...((onOpen ?? onPeek) === undefined ? {} : { onClick: (onOpen ?? onPeek) }), title: name, children: name }) }), meta === undefined ? null : (
|
|
72
72
|
/* Wrapped or not, the metadata is still there —it is what saves
|
|
73
73
|
having to open a set to know whether it is a thousand rows or a
|
|
74
74
|
million— and it truncates instead of wrapping into itself: three
|
|
75
75
|
lines per row in a 480 px drawer means three rows fit on screen. */
|
|
76
|
-
_jsx("span", { className: "min-w-0 truncate text-micro tabular-nums text-muted", children: meta }))
|
|
76
|
+
_jsx("span", { className: "min-w-0 truncate text-micro tabular-nums text-muted", children: meta })), tags === undefined ? null : (_jsx("span", { className: "ms-auto flex min-w-fit shrink basis-(--container-tags) items-center justify-end gap-1.5", children: tags }))] }), _jsx("span", { className: "flex shrink-0 items-center gap-1 opacity-0 transition-opacity duration-(--duration-instant) group-hover/row:opacity-100 focus-within:opacity-100 pointer-coarse:opacity-100", children: _jsx(Trail, { name: name, openAs: openAs, ...(actions === undefined ? {} : { actions }), copy: copyAs, ...(onPeek === undefined || !openers ? {} : { onPeek }), ...(onOpen === undefined || !openers ? {} : { onOpen }), ...(more === undefined ? {} : { more }), ...(onMoreSelect === undefined ? {} : { onMoreSelect }) }) })] }) }));
|
|
77
77
|
if (children === undefined)
|
|
78
78
|
return row;
|
|
79
79
|
/* What the resource produced, hanging below. The indent reaches up to where
|
|
@@ -86,31 +86,31 @@ export function Row({ icon: Icon, avatar, name, onOpen, onPeek, click = "peek",
|
|
|
86
86
|
return (_jsxs("div", { "data-slot": "branch", className: "flex min-w-0 flex-col", children: [row, _jsx("div", { className: `flex min-w-0 flex-col gap-1 border-l border-line-strong ${byDensity(d, "mb-2 ml-8 pb-0.5 pl-3 pr-3", "mb-1.5 ml-6 pl-2.5 pr-2.5")}`, children: children })] }));
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
|
-
*
|
|
89
|
+
* THE ROWS PRESENTATION'S HEADER.
|
|
90
90
|
*
|
|
91
|
-
* Context:
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
91
|
+
* Context: the table and the sheet say what each column is; the rows list
|
|
92
|
+
* said nothing. Eighty lines with «Ferretería Sur · 13 sept · Bs 12.480» on the
|
|
93
|
+
* right and a card at the end, and you had to deduce what each number was — or
|
|
94
|
+
* switch to the table to find out, which is changing presentation to read
|
|
95
|
+
* the same screen.
|
|
96
96
|
*
|
|
97
|
-
* **
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
97
|
+
* **They are not columns: they are the row's ZONES, labelled.** A row has a
|
|
98
|
+
* name that stretches, a `meta` that is ONE already-formatted string, and a
|
|
99
|
+
* column of cards of fixed width. Labelling them as if they were three aligned
|
|
100
|
+
* columns would be lying about what is underneath: one row's `meta` may
|
|
101
|
+
* say three things and another's two.
|
|
102
102
|
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
103
|
+
* That is why it traces `Row`'s box —same padding, same gaps, same
|
|
104
|
+
* checkbox, icon and actions spacers— instead of declaring a width of its
|
|
105
|
+
* own. If `Row` changes its geometry, this follows it.
|
|
106
106
|
*/
|
|
107
107
|
export function RowHeader({ name, meta, tags, withSelection = false, withIcon = false, withAvatar = false, withActions = false, trail, }) {
|
|
108
108
|
const d = useDensity();
|
|
109
109
|
const rotulo = `truncate ${HEADER_TEXT}`;
|
|
110
110
|
return (_jsxs("div", { "data-slot": "row-header",
|
|
111
|
-
/*
|
|
112
|
-
|
|
113
|
-
className: `sticky z-10 flex min-w-0 items-center border-b border-line-strong bg-ground ${byDensity(d, "gap-3 px-3 py-2", "gap-2 px-2.5 py-1.5")}`, style: stickyTop, role: "presentation", children: [!withSelection ? null : _jsx("span", { className: "size-3.5 shrink-0", "aria-hidden": true }), withAvatar ? (_jsx("span", { className: "size-5 shrink-0", "aria-hidden": true })) : !withIcon ? null : (_jsx("span", { className: "size-(--size-icon-md) shrink-0", "aria-hidden": true })), _jsxs("div", { className: `flex min-w-0 shrink grow basis-(--container-name) flex-wrap items-center gap-y-0 ${byDensity(d, "gap-x-3", "gap-x-2")}`, children: [_jsx("span", { className: `min-w-0 grow basis-(--container-name) ${rotulo}`, children: name }), meta === undefined ? null : _jsx("span", { className: `min-w-0 ${rotulo}`, children: meta })
|
|
111
|
+
/* It sticks below the list's bar, like the table's header
|
|
112
|
+
and the sheet's. See `system/sticky.tsx`. */
|
|
113
|
+
className: `sticky z-10 flex min-w-0 items-center border-b border-line-strong bg-ground ${byDensity(d, "gap-3 px-3 py-2", "gap-2 px-2.5 py-1.5")}`, style: stickyTop, role: "presentation", children: [!withSelection ? null : _jsx("span", { className: "size-3.5 shrink-0", "aria-hidden": true }), withAvatar ? (_jsx("span", { className: "size-5 shrink-0", "aria-hidden": true })) : !withIcon ? null : (_jsx("span", { className: "size-(--size-icon-md) shrink-0", "aria-hidden": true })), _jsxs("div", { className: `flex min-w-0 shrink grow basis-(--container-name) flex-wrap items-center gap-y-0 ${byDensity(d, "gap-x-3", "gap-x-2")}`, children: [_jsx("span", { className: `min-w-0 grow basis-(--container-name) ${rotulo}`, children: name }), meta === undefined ? null : _jsx("span", { className: `min-w-0 ${rotulo}`, children: meta }), tags === undefined ? null : (_jsx("span", { className: "ms-auto flex min-w-fit shrink basis-(--container-tags) items-center justify-end", children: _jsx("span", { className: rotulo, children: tags }) }))] }), trail !== undefined ? (_jsx("span", { inert: true, "aria-hidden": true, className: "invisible flex shrink-0 items-center gap-1", children: _jsx(Trail, { name: "", openAs: "", ...(trail.actions === undefined ? {} : { actions: trail.actions }), ...(trail.copy === false ? { copy: false } : {}), ...(trail.peek === true ? { onPeek: () => { } } : {}), ...(trail.open === true ? { onOpen: () => { } } : {}) }) })) : !withActions ? null : (_jsx("span", { className: "size-(--size-control-sm) shrink-0", "aria-hidden": true }))] }));
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
116
116
|
* The header of a group inside a list.
|
|
@@ -129,10 +129,10 @@ export function GroupHeader({ field, label, count, detail, depth = 0, open = tru
|
|
|
129
129
|
const d = useDensity();
|
|
130
130
|
const copy = useUiCopy();
|
|
131
131
|
const content = (_jsxs(_Fragment, { children: [onToggle === undefined ? null : (_jsx(ChevronRight, { className: `size-(--size-icon-sm) shrink-0 text-muted transition-transform duration-(--duration-instant) ${open ? "rotate-90" : ""}`, strokeWidth: 2, "aria-hidden": true })), field === undefined ? null : (_jsx("span", { className: "shrink-0 text-micro text-muted", children: field })), _jsx("span", { className: "truncate text-micro font-medium text-ink", children: label }), count === undefined ? null : (_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: count.toLocaleString(copy.locale) })), detail === undefined ? null : (_jsx("span", { className: "shrink-0 text-micro tabular-nums text-muted", children: detail }))] }));
|
|
132
|
-
/*
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
/* The indentation goes in the left padding and not in a margin: the
|
|
133
|
+
header has a background and a bottom border, and a margin would cut them before the
|
|
134
|
+
list's edge — the band would stop reading as a stripe. The hover
|
|
135
|
+
does not replace that background: it is a mark set inside, rounded. */
|
|
136
136
|
const box = `flex min-w-0 items-center gap-2 border-b border-line bg-ground ${byDensity(d, "px-3 py-1.5", "px-2.5 py-1")}`;
|
|
137
137
|
const indent = depth === 0 ? undefined : { paddingLeft: `calc(var(--spacing-indent) * ${depth})` };
|
|
138
138
|
const mark = (_jsx("span", { "aria-hidden": true, className: "pointer-events-none absolute inset-x-1 inset-y-0.5 rounded-control group-hover/head:bg-ink/4" }));
|
|
@@ -1,66 +1,66 @@
|
|
|
1
1
|
import type { Surface } from "../../foundations/types.js";
|
|
2
2
|
import { type SortState } from "../../primitives/table/sorting.js";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* SORT — by one or several fields, from the bar.
|
|
5
5
|
*
|
|
6
|
-
* Context:
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
6
|
+
* Context: sorting was a capability of `DataTable` and of nothing else. You
|
|
7
|
+
* clicked the column header, which is the right way **when there are
|
|
8
|
+
* headers**. In rows, board and sheet there are none, so
|
|
9
|
+
* changing presentation lost not only the order set: it lost the ability
|
|
10
|
+
* to sort.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
12
|
+
* The order belongs to the SET and not to the presentation, like the levels and
|
|
13
|
+
* the folding. That is why the control lives in the bar and not inside the table, and
|
|
14
|
+
* why the table still has its headers as well: they are two doors to the
|
|
15
|
+
* same thing, and the headers' one is faster when it exists.
|
|
16
16
|
*
|
|
17
|
-
* ──
|
|
17
|
+
* ── Several criteria, and so a panel and not a menu ─────────────────
|
|
18
18
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* Enter),
|
|
19
|
+
* It used to be said that sorting by two fields was «a tie-break done by the engine» and
|
|
20
|
+
* that choosing one was enough. People asked for the opposite on screen: by
|
|
21
|
+
* date, and within the same date by customer, and then by product. The engine
|
|
22
|
+
* already accepted it (`order: [...]`); what was missing was being able to say it. An order of N fields
|
|
23
|
+
* has an ORDER among them —the second only decides between the rows the
|
|
24
|
+
* first left equal—, and a menu of ticks cannot express that: it takes a
|
|
25
|
+
* list that reorders. It is React Aria's (`GridList` + `useDragAndDrop`):
|
|
26
|
+
* dragged with the mouse, and with the keyboard from the handle (Enter, arrows,
|
|
27
|
+
* Enter), announced.
|
|
28
28
|
*/
|
|
29
29
|
export type SortField<T = unknown> = {
|
|
30
30
|
field: string;
|
|
31
31
|
label: string;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* What value it is sorted by, when the BROWSER sorts.
|
|
34
34
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
35
|
+
* Absent = it already comes sorted from where it came. It is the same split the
|
|
36
|
+
* grouping has with `piles`: a set the server paginates cannot be
|
|
37
|
+
* sorted here —sorting twelve rows out of a hundred and eighty-seven gives a false
|
|
38
|
+
* order— so there the order travels in the read and this only reflects it.
|
|
39
39
|
*/
|
|
40
40
|
value?: (item: T) => string | number | null | undefined;
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
41
|
+
/** What «ascendente» means for this field. Without this, «ascendente».
|
|
42
|
+
* A date ascends from old to new and an amount from small to large, and
|
|
43
|
+
* saying so avoids the trial click. */
|
|
44
44
|
ascLabel?: string;
|
|
45
45
|
descLabel?: string;
|
|
46
46
|
};
|
|
47
47
|
export type SortMenuProps = {
|
|
48
|
-
/**
|
|
48
|
+
/** Which fields it can be sorted by. With none, the control is not drawn. */
|
|
49
49
|
fields: readonly SortField<never>[];
|
|
50
|
-
/**
|
|
50
|
+
/** The order, from outside in. Empty is «as they arrived». */
|
|
51
51
|
sort: readonly SortState[];
|
|
52
52
|
onSortChange: (next: SortState[]) => void;
|
|
53
53
|
surface?: Surface;
|
|
54
54
|
};
|
|
55
55
|
/**
|
|
56
|
-
*
|
|
56
|
+
* The rows, sorted here, by each criterion in its order.
|
|
57
57
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
58
|
+
* Only by the fields that declare `value`; the rest are skipped —sorting a
|
|
59
|
+
* page of a set paginated elsewhere produces an order that is a lie,
|
|
60
|
+
* because it sorts the twelve that arrived and not the hundred and eighty-seven. With
|
|
61
|
+
* no readable criterion, they are returned as is.
|
|
62
62
|
*
|
|
63
|
-
*
|
|
63
|
+
* The missing ones go ALWAYS at the end, whether the order goes up or down (see `compareBy`).
|
|
64
64
|
*/
|
|
65
65
|
export declare function sortItems<T>(items: readonly T[], fields: readonly SortField<T>[], sort: readonly SortState[] | undefined): readonly T[];
|
|
66
66
|
export declare function SortMenu({ fields, sort, onSortChange, surface }: SortMenuProps): import("react").JSX.Element | null;
|
|
@@ -7,14 +7,14 @@ import { compareBy, flipSort, moveSort, } from "../../primitives/table/sorting.j
|
|
|
7
7
|
import { ArrowDownUp, ArrowDownWideNarrow, ArrowUpNarrowWide, ChevronDown, GripVertical, Plus, X, } from "lucide-react";
|
|
8
8
|
import { Button as AriaButton, Dialog, DialogTrigger, GridList, GridListItem, useDragAndDrop, } from "react-aria-components";
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* The rows, sorted here, by each criterion in its order.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
12
|
+
* Only by the fields that declare `value`; the rest are skipped —sorting a
|
|
13
|
+
* page of a set paginated elsewhere produces an order that is a lie,
|
|
14
|
+
* because it sorts the twelve that arrived and not the hundred and eighty-seven. With
|
|
15
|
+
* no readable criterion, they are returned as is.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
17
|
+
* The missing ones go ALWAYS at the end, whether the order goes up or down (see `compareBy`).
|
|
18
18
|
*/
|
|
19
19
|
export function sortItems(items, fields, sort) {
|
|
20
20
|
if (sort === undefined || sort.length === 0)
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { type GroupGrain, type GroupLevel } from "../../foundations/grouping.js";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* THE LEVELS, as state somebody edits.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* `system/grouping.ts`,
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* The vocabulary —what a level is, what a heap is, how it is identified— lives in
|
|
6
|
+
* `system/grouping.ts`, because BOTH layers speak it: the list builds the tree and
|
|
7
|
+
* the table draws it, and a primitive cannot import from a context. Here
|
|
8
|
+
* only the CONTROL stays, which belongs to the list as do the columns' and the
|
|
9
|
+
* folding's.
|
|
10
10
|
*/
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
11
|
+
/** The levels set, and the four things done to them. The order IS the
|
|
12
|
+
* hierarchy: moving a level changes what is split first. */
|
|
13
13
|
export type GroupingControl = {
|
|
14
14
|
levels: readonly GroupLevel[];
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* Sets a level. A date field can be set with SEVERAL grains —«by
|
|
17
|
+
* month and inside it by day»— so what is not duplicated is the field+grain pair,
|
|
18
|
+
* not the field. Grouping twice by exactly the same splits into heaps of
|
|
19
|
+
* one, and that is always a typo.
|
|
20
20
|
*/
|
|
21
21
|
add: (field: string, grain?: GroupGrain) => void;
|
|
22
22
|
remove: (field: string, grain?: GroupGrain) => void;
|
|
23
|
-
/**
|
|
23
|
+
/** Tick and untick in one gesture, which is what a checkbox does. */
|
|
24
24
|
toggle: (field: string, grain?: GroupGrain) => void;
|
|
25
25
|
has: (field: string, grain?: GroupGrain) => boolean;
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
26
|
+
/** Moves a level `delta` places. It stays at the edges instead of wrapping
|
|
27
|
+
* around: reaching the first and coming back to the last is not what anyone expects of
|
|
28
|
+
* an «up» arrow. */
|
|
29
29
|
move: (field: string, delta: number) => void;
|
|
30
30
|
clear: () => void;
|
|
31
31
|
};
|
|
@@ -13,16 +13,16 @@ export function useGroupingControl(options = {}) {
|
|
|
13
13
|
const add = useCallback((field, grain) => {
|
|
14
14
|
if (levels.some((one) => levelKey(one) === keyOf(field, grain)))
|
|
15
15
|
return;
|
|
16
|
-
/*
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
/* It is normalised ALWAYS and not only when adding dates: it is the only way
|
|
17
|
+
for ticking «día» and then «mes» to give «mes › día» without whoever ticks
|
|
18
|
+
having to know in which order to do it. */
|
|
19
19
|
setLevels(normalizeLevels([...levels, grain === undefined ? { field } : { field, grain }]));
|
|
20
20
|
}, [levels, setLevels]);
|
|
21
21
|
const remove = useCallback((field, grain) => {
|
|
22
22
|
setLevels(grain === undefined && !levels.some((one) => levelKey(one) === field)
|
|
23
|
-
? /*
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
? /* No grain and no exact match: the WHOLE field is taken out, with
|
|
24
|
+
all its grains. It is what the × of a date field set
|
|
25
|
+
by month and by day means. */
|
|
26
26
|
levels.filter((one) => one.field !== field)
|
|
27
27
|
: levels.filter((one) => levelKey(one) !== keyOf(field, grain)));
|
|
28
28
|
}, [levels, setLevels]);
|
|
@@ -14,7 +14,7 @@ export { useSelection } from "./selection.js";
|
|
|
14
14
|
export { useSetControl } from "./set.js";
|
|
15
15
|
export { toggleCollapsed, useTreeControl, } from "./tree.js";
|
|
16
16
|
export { ViewSwitcher, } from "./ViewSwitcher.js";
|
|
17
|
-
/*
|
|
17
|
+
/* The grouping levels' control. The vocabulary is in `system/grouping.ts`. */
|
|
18
18
|
export { AxisLevels, levelId, levelLabeler, } from "./AxisLevels.js";
|
|
19
19
|
export { BoardColumns, } from "./BoardColumns.js";
|
|
20
20
|
export { ChartExplorer, } from "./ChartExplorer.js";
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { type ModelCellKind } from "./modelCells.js";
|
|
2
2
|
import { type ModelDefinition } from "../search/model.js";
|
|
3
3
|
import type { DataColumn } from "../../primitives/table/DataTable.js";
|
|
4
|
-
/**
|
|
4
|
+
/** Which model field a hand-declared column shows.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Without this, «filas» and `row_count` are two different things and the field
|
|
7
|
+
* would appear twice: once with the good label and once raw. */
|
|
8
8
|
export type ClaimedField = {
|
|
9
9
|
id: string;
|
|
10
10
|
field?: string;
|
|
11
11
|
};
|
|
12
|
-
/**
|
|
12
|
+
/** The fields the declared columns already answer.
|
|
13
13
|
*
|
|
14
14
|
* in [{id:"rows", field:"row_count"}, {id:"name"}]
|
|
15
15
|
* out Set {"row_count", "name"}
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* The `id` counts as a claim when it matches the field's name: most
|
|
18
|
+
* columns are named after what they show. */
|
|
19
19
|
export declare function claimedFields(columns: readonly ClaimedField[]): Set<string>;
|
|
20
|
-
/**
|
|
20
|
+
/** A record value, into something a cell can sort and draw.
|
|
21
21
|
*
|
|
22
|
-
* in ["edad","sexo"]
|
|
22
|
+
* in ["edad","sexo"] a `text[]`
|
|
23
23
|
* out "edad, sexo"
|
|
24
|
-
* in []
|
|
25
|
-
* out null
|
|
24
|
+
* in [] an empty list is not an empty text
|
|
25
|
+
* out null the table draws «—»
|
|
26
26
|
* in "2026-09-13T04:17:00"
|
|
27
27
|
* out "2026-09-13T04:17:00"
|
|
28
28
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
29
|
+
* Dates are left as they come —ISO— because in ISO alphabetical order IS
|
|
30
|
+
* chronological, and so the column sorts well without parsing anything. */
|
|
31
31
|
export declare function readModelValue(raw: unknown): string | number | boolean | null;
|
|
32
32
|
/** How a field of the model is drawn, by its `type` and in any case — «Email» and `email` are
|
|
33
33
|
* the same field. A type not known here stays `text`, exactly as before.
|
|
@@ -38,22 +38,22 @@ export declare function readModelValue(raw: unknown): string | number | boolean
|
|
|
38
38
|
*/
|
|
39
39
|
export declare function modelCellKind(type: string): ModelCellKind;
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
41
|
+
* The declared columns, plus one for each model field that none
|
|
42
|
+
* answered.
|
|
43
43
|
*
|
|
44
|
-
* in model
|
|
45
|
-
* in declared 6
|
|
46
|
-
* out
|
|
44
|
+
* in model the `model_meta_data` of `account.move` — 12 fields
|
|
45
|
+
* in declared 6 columns written by hand in the view
|
|
46
|
+
* out the 6, and behind them `journal_id`, `currency_id`, `invoice_origin`,
|
|
47
47
|
* `payment_reference`, `fiscal_position_id`, `company_id`,
|
|
48
|
-
* `move_type`,
|
|
48
|
+
* `move_type`, all switched off
|
|
49
49
|
*
|
|
50
|
-
*
|
|
51
|
-
* `translations()`
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
50
|
+
* The label of the added ones comes from `model.translations` in the requested language —the same
|
|
51
|
+
* `translations()` the model publishes for everything else—, with the `default` that same
|
|
52
|
+
* model declared if the language is missing, and the field's name as is only if the model
|
|
53
|
+
* said no word about it. It can never get out of sync with the engine because it comes from the
|
|
54
|
+
* SAME answer that names the field — unlike a dictionary maintained here.
|
|
55
55
|
*
|
|
56
|
-
* `model === null` —
|
|
57
|
-
*
|
|
56
|
+
* `model === null` —the definition has not arrived yet— returns the declared ones
|
|
57
|
+
* untouched, which is exactly what there was before.
|
|
58
58
|
*/
|
|
59
59
|
export declare function columnsFromModel<T extends object>(declared: readonly DataColumn<T>[], model: ModelDefinition | null | undefined, locale?: string): DataColumn<T>[];
|