@sincpro/web-ui 2.8.0 → 2.9.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 +143 -2
- package/dist/components/activity/Activity.js +3 -2
- 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/record/ActionDock.d.ts +36 -0
- package/dist/components/record/ActionDock.js +58 -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 +107 -31
- package/dist/components/record/SmartButtons.d.ts +8 -2
- package/dist/components/record/SmartButtons.js +8 -3
- 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/menu/Menu.d.ts +3 -0
- package/dist/primitives/menu/Menu.js +7 -1
- package/dist/primitives/table/DataTable.d.ts +15 -0
- package/dist/primitives/table/DataTable.js +67 -12
- package/dist/primitives/table/EditableTable.js +7 -2
- package/dist/primitives/table/SheetTable.d.ts +3 -0
- package/dist/primitives/table/SheetTable.js +15 -2
- package/dist/primitives/value/Value.d.ts +5 -1
- package/dist/primitives/value/Value.js +9 -3
- package/dist/tokens.css +19 -2
- package/dist/views/list/List.d.ts +2 -1
- package/dist/views/list/List.js +6 -2
- package/dist/views/list/ListView.d.ts +1 -1
- package/dist/views/list/ListView.js +53 -14
- package/dist/views/list/derive.d.ts +1 -1
- package/dist/views/list/derive.js +45 -9
- package/dist/views/list/types.d.ts +33 -0
- package/dist/views/record/Record.d.ts +16 -2
- package/dist/views/record/Record.js +33 -8
- package/package.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** The keyboard the page is used with — what a combination is drawn and matched for. */
|
|
2
|
+
export type KeyboardPlatform = "apple" | "other";
|
|
3
|
+
/** A combination as written: «Alt+D», «Mod+S», «Alt+Shift+P», «Escape». */
|
|
4
|
+
export type Keys = string;
|
|
5
|
+
export interface ParsedKeys {
|
|
6
|
+
alt: boolean;
|
|
7
|
+
shift: boolean;
|
|
8
|
+
ctrl: boolean;
|
|
9
|
+
meta: boolean;
|
|
10
|
+
/** The platform's command key: ⌘ on a Mac, Ctrl elsewhere. */
|
|
11
|
+
mod: boolean;
|
|
12
|
+
/** The key itself, as written: «D», «S», «ArrowLeft», «Escape». */
|
|
13
|
+
key: string;
|
|
14
|
+
}
|
|
15
|
+
/** What a keydown carries that a combination is compared to. */
|
|
16
|
+
export interface KeyPress {
|
|
17
|
+
key: string;
|
|
18
|
+
code: string;
|
|
19
|
+
altKey: boolean;
|
|
20
|
+
shiftKey: boolean;
|
|
21
|
+
ctrlKey: boolean;
|
|
22
|
+
metaKey: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare function parseKeys(keys: Keys): ParsedKeys;
|
|
25
|
+
/** Whether the press IS the combination — every modifier exactly, the key by its place when it
|
|
26
|
+
* is a letter or a digit (layouts and Alt change what it types, not where it is). */
|
|
27
|
+
export declare function matchesKeys(press: KeyPress, keys: Keys, platform: KeyboardPlatform): boolean;
|
|
28
|
+
/** Whether the combination needs a modifier — then it works while a field is being typed in;
|
|
29
|
+
* a bare key does not, or typing «d» would duplicate the record. */
|
|
30
|
+
export declare function needsModifier(keys: Keys): boolean;
|
|
31
|
+
/** How the combination is drawn on this keyboard: «⌥D» on a Mac, «Alt+D» elsewhere. */
|
|
32
|
+
export declare function keysLabel(keys: Keys, platform: KeyboardPlatform | null): string;
|
|
33
|
+
/** What `aria-keyshortcuts` says on this keyboard: «Alt+D», «Meta+S». */
|
|
34
|
+
export declare function keysAria(keys: Keys, platform: KeyboardPlatform | null): string;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/* ==================================================================== *
|
|
2
|
+
* A KEY COMBINATION — written once, pressed on any keyboard, read the way that keyboard says it.
|
|
3
|
+
*
|
|
4
|
+
* Context: an ERP is worked from the keyboard — next record, duplicate, save — and a shortcut
|
|
5
|
+
* written as a hint in a menu that nothing binds is a promise the screen does not keep. The
|
|
6
|
+
* combination is written ONE way and this module reads it three:
|
|
7
|
+
*
|
|
8
|
+
* "Alt+D" what is written: modifiers, then the key, joined with «+»
|
|
9
|
+
* matchesKeys whether a keydown IS it — by the key's PLACE for a letter or a digit
|
|
10
|
+
* (`KeyD`), so Alt+D on a Mac, where it types «∂», still matches
|
|
11
|
+
* keysLabel how it is drawn: «⌥D» on a Mac, «Alt+D» elsewhere
|
|
12
|
+
* keysAria what `aria-keyshortcuts` says: «Alt+D»
|
|
13
|
+
*
|
|
14
|
+
* `Mod` is the platform's command key — ⌘ on a Mac, Ctrl elsewhere —: «Mod+S» saves on both.
|
|
15
|
+
* Pure: what is bound and when lives in `useShortcuts`.
|
|
16
|
+
* ==================================================================== */
|
|
17
|
+
export function parseKeys(keys) {
|
|
18
|
+
const parts = keys.split("+").map((one) => one.trim());
|
|
19
|
+
const key = parts.pop() ?? "";
|
|
20
|
+
const has = (name) => parts.some((one) => one.toLowerCase() === name);
|
|
21
|
+
return {
|
|
22
|
+
alt: has("alt") || has("option"),
|
|
23
|
+
shift: has("shift"),
|
|
24
|
+
ctrl: has("ctrl") || has("control"),
|
|
25
|
+
meta: has("meta") || has("cmd"),
|
|
26
|
+
mod: has("mod"),
|
|
27
|
+
key,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** Whether the press IS the combination — every modifier exactly, the key by its place when it
|
|
31
|
+
* is a letter or a digit (layouts and Alt change what it types, not where it is). */
|
|
32
|
+
export function matchesKeys(press, keys, platform) {
|
|
33
|
+
const want = parseKeys(keys);
|
|
34
|
+
const ctrl = want.ctrl || (want.mod && platform === "other");
|
|
35
|
+
const meta = want.meta || (want.mod && platform === "apple");
|
|
36
|
+
if (press.altKey !== want.alt ||
|
|
37
|
+
press.shiftKey !== want.shift ||
|
|
38
|
+
press.ctrlKey !== ctrl ||
|
|
39
|
+
press.metaKey !== meta)
|
|
40
|
+
return false;
|
|
41
|
+
if (/^[a-z]$/i.test(want.key))
|
|
42
|
+
return press.code === `Key${want.key.toUpperCase()}`;
|
|
43
|
+
if (/^\d$/.test(want.key))
|
|
44
|
+
return press.code === `Digit${want.key}`;
|
|
45
|
+
return press.key.toLowerCase() === want.key.toLowerCase();
|
|
46
|
+
}
|
|
47
|
+
/** Whether the combination needs a modifier — then it works while a field is being typed in;
|
|
48
|
+
* a bare key does not, or typing «d» would duplicate the record. */
|
|
49
|
+
export function needsModifier(keys) {
|
|
50
|
+
const want = parseKeys(keys);
|
|
51
|
+
return want.alt || want.ctrl || want.meta || want.mod;
|
|
52
|
+
}
|
|
53
|
+
const APPLE = {
|
|
54
|
+
alt: "⌥",
|
|
55
|
+
shift: "⇧",
|
|
56
|
+
ctrl: "⌃",
|
|
57
|
+
meta: "⌘",
|
|
58
|
+
mod: "⌘",
|
|
59
|
+
};
|
|
60
|
+
const OTHER = {
|
|
61
|
+
alt: "Alt",
|
|
62
|
+
shift: "Shift",
|
|
63
|
+
ctrl: "Ctrl",
|
|
64
|
+
meta: "Meta",
|
|
65
|
+
mod: "Ctrl",
|
|
66
|
+
};
|
|
67
|
+
const KEY_WORDS = {
|
|
68
|
+
ArrowLeft: "←",
|
|
69
|
+
ArrowRight: "→",
|
|
70
|
+
ArrowUp: "↑",
|
|
71
|
+
ArrowDown: "↓",
|
|
72
|
+
Escape: "Esc",
|
|
73
|
+
Enter: "↵",
|
|
74
|
+
};
|
|
75
|
+
/** How the combination is drawn on this keyboard: «⌥D» on a Mac, «Alt+D» elsewhere. */
|
|
76
|
+
export function keysLabel(keys, platform) {
|
|
77
|
+
if (platform === null)
|
|
78
|
+
return keys;
|
|
79
|
+
const want = parseKeys(keys);
|
|
80
|
+
const key = KEY_WORDS[want.key] ?? want.key.toUpperCase();
|
|
81
|
+
const names = platform === "apple" ? APPLE : OTHER;
|
|
82
|
+
const mods = ["mod", "ctrl", "alt", "shift", "meta"]
|
|
83
|
+
.filter((one) => want[one] && !(one === "meta" && want.mod))
|
|
84
|
+
.map((one) => names[one]);
|
|
85
|
+
return platform === "apple" ? [...mods, key].join("") : [...mods, key].join("+");
|
|
86
|
+
}
|
|
87
|
+
/** What `aria-keyshortcuts` says on this keyboard: «Alt+D», «Meta+S». */
|
|
88
|
+
export function keysAria(keys, platform) {
|
|
89
|
+
const want = parseKeys(keys);
|
|
90
|
+
const mod = platform === "apple" ? "Meta" : "Control";
|
|
91
|
+
return [
|
|
92
|
+
...(want.mod ? [mod] : []),
|
|
93
|
+
...(want.ctrl ? ["Control"] : []),
|
|
94
|
+
...(want.meta && !want.mod ? ["Meta"] : []),
|
|
95
|
+
...(want.alt ? ["Alt"] : []),
|
|
96
|
+
...(want.shift ? ["Shift"] : []),
|
|
97
|
+
want.key.length === 1 ? want.key.toUpperCase() : want.key,
|
|
98
|
+
].join("+");
|
|
99
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type KeyboardPlatform, type Keys } from "./keys.js";
|
|
1
2
|
/**
|
|
2
3
|
* Context: a shortcut is drawn the way the person's keyboard says it — «⌘K» on a Mac, «Ctrl K»
|
|
3
4
|
* everywhere else. A «Ctrl K» on a Mac is a shortcut that does not work, and people stop
|
|
@@ -5,7 +6,7 @@
|
|
|
5
6
|
* it is `null`, and the shortcut appears right after instead of being drawn wrong and
|
|
6
7
|
* corrected in front of the person.
|
|
7
8
|
*/
|
|
8
|
-
export type KeyboardPlatform
|
|
9
|
+
export type { KeyboardPlatform };
|
|
9
10
|
/** The keyboard the page is being used with; `null` on the server and while hydrating. */
|
|
10
11
|
export declare function useKeyboardPlatform(): KeyboardPlatform | null;
|
|
11
12
|
export type ModShortcut = {
|
|
@@ -16,3 +17,18 @@ export type ModShortcut = {
|
|
|
16
17
|
};
|
|
17
18
|
/** The platform's command key with `key`: ⌘ on a Mac, Ctrl elsewhere. */
|
|
18
19
|
export declare function modShortcut(key: string, platform: KeyboardPlatform): ModShortcut;
|
|
20
|
+
export interface Shortcut {
|
|
21
|
+
/** «Alt+D», «Mod+S», «Alt+P»: see `foundations/keys`. */
|
|
22
|
+
keys: Keys;
|
|
23
|
+
run: () => void;
|
|
24
|
+
/** Off for now — an action disabled, a pager at its end. */
|
|
25
|
+
enabled?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** Binds these combinations while the calling piece is mounted — the last mounted wins. */
|
|
28
|
+
export declare function useShortcuts(shortcuts: readonly Shortcut[]): void;
|
|
29
|
+
/** How a combination is drawn and announced on this keyboard: the label for a tooltip or a
|
|
30
|
+
* menu, `aria-keyshortcuts` for the control. `undefined` until the platform is known. */
|
|
31
|
+
export declare function useKeysHint(keys: Keys | undefined): {
|
|
32
|
+
label: string;
|
|
33
|
+
aria: string;
|
|
34
|
+
} | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { keysAria, keysLabel, matchesKeys, needsModifier, } from "./keys.js";
|
|
3
|
+
import { useEffect, useRef, useSyncExternalStore } from "react";
|
|
3
4
|
function readPlatform() {
|
|
4
5
|
const nav = navigator;
|
|
5
6
|
/* `userAgentData` where there is one (Chromium); `platform` is deprecated but it is the
|
|
@@ -18,3 +19,58 @@ export function modShortcut(key, platform) {
|
|
|
18
19
|
? { label: `⌘${key}`, aria: `Meta+${key}` }
|
|
19
20
|
: { label: `Ctrl ${key}`, aria: `Control+${key}` };
|
|
20
21
|
}
|
|
22
|
+
const stack = [];
|
|
23
|
+
function editable(target) {
|
|
24
|
+
if (!(target instanceof HTMLElement))
|
|
25
|
+
return false;
|
|
26
|
+
return (target.isContentEditable ||
|
|
27
|
+
target.tagName === "INPUT" ||
|
|
28
|
+
target.tagName === "TEXTAREA" ||
|
|
29
|
+
target.tagName === "SELECT");
|
|
30
|
+
}
|
|
31
|
+
function onKeyDown(event) {
|
|
32
|
+
if (event.defaultPrevented || event.isComposing)
|
|
33
|
+
return;
|
|
34
|
+
const platform = readPlatform();
|
|
35
|
+
for (let at = stack.length - 1; at >= 0; at--) {
|
|
36
|
+
for (const one of stack[at].current) {
|
|
37
|
+
if (one.enabled === false || !matchesKeys(event, one.keys, platform))
|
|
38
|
+
continue;
|
|
39
|
+
if (!needsModifier(one.keys) && editable(event.target))
|
|
40
|
+
continue;
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
one.run();
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** Binds these combinations while the calling piece is mounted — the last mounted wins. */
|
|
48
|
+
export function useShortcuts(shortcuts) {
|
|
49
|
+
const latest = useRef(shortcuts);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
latest.current = shortcuts;
|
|
52
|
+
});
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
const entry = latest;
|
|
55
|
+
stack.push(entry);
|
|
56
|
+
if (stack.length === 1)
|
|
57
|
+
window.addEventListener("keydown", onKeyDown);
|
|
58
|
+
return () => {
|
|
59
|
+
const at = stack.indexOf(entry);
|
|
60
|
+
if (at >= 0)
|
|
61
|
+
stack.splice(at, 1);
|
|
62
|
+
if (stack.length === 0)
|
|
63
|
+
window.removeEventListener("keydown", onKeyDown);
|
|
64
|
+
};
|
|
65
|
+
}, []);
|
|
66
|
+
}
|
|
67
|
+
/** How a combination is drawn and announced on this keyboard: the label for a tooltip or a
|
|
68
|
+
* menu, `aria-keyshortcuts` for the control. `undefined` until the platform is known. */
|
|
69
|
+
export function useKeysHint(keys) {
|
|
70
|
+
const platform = useKeyboardPlatform();
|
|
71
|
+
/* On the server the keyboard is unknown: no hint rather than a wrong one (Ctrl on a Mac). It
|
|
72
|
+
appears after hydration, as the search entry's does. */
|
|
73
|
+
return keys === undefined || platform === null
|
|
74
|
+
? undefined
|
|
75
|
+
: { label: keysLabel(keys, platform), aria: keysAria(keys, platform) };
|
|
76
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export type ViewStyle = "traditional" | "modern";
|
|
3
|
+
export declare function ViewStyleProvider({ value, children, }: {
|
|
4
|
+
value: ViewStyle;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
7
|
+
/** The style in force: the record's own, else the provider's. */
|
|
8
|
+
export declare function useViewStyle(own?: ViewStyle): ViewStyle;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
const Ctx = createContext("traditional");
|
|
5
|
+
export function ViewStyleProvider({ value, children, }) {
|
|
6
|
+
return _jsx(Ctx.Provider, { value: value, children: children });
|
|
7
|
+
}
|
|
8
|
+
/** The style in force: the record's own, else the provider's. */
|
|
9
|
+
export function useViewStyle(own) {
|
|
10
|
+
const inherited = useContext(Ctx);
|
|
11
|
+
return own ?? inherited;
|
|
12
|
+
}
|
|
@@ -34,6 +34,9 @@ export interface MenuOption {
|
|
|
34
34
|
* exist until it is opened. In an ERP the frequent verbs have a shortcut, and the menu
|
|
35
35
|
* is where people learn it. */
|
|
36
36
|
shortcut?: string;
|
|
37
|
+
/** It destroys or undoes — «Anular», «Eliminar»: the label and its icon in the danger tone,
|
|
38
|
+
* so it is read before it is pressed. Put such options in a group of their own, last. */
|
|
39
|
+
danger?: boolean;
|
|
37
40
|
/** The option opens a SUBMENU with these options instead of running. Its own `onSelect`
|
|
38
41
|
* and `checked` are ignored — a row that opens something does not also do something.
|
|
39
42
|
* Children may carry `items` too, but a third level is usually a dialog in disguise. */
|
|
@@ -135,7 +135,13 @@ export function MenuList({ label, groups, onAction, closeOnSelect, emptyText, wi
|
|
|
135
135
|
const Icon = o.icon;
|
|
136
136
|
const opens = o.items !== undefined;
|
|
137
137
|
const checked = !opens && o.checked === true;
|
|
138
|
-
return (_jsxs(MenuItem, { id: o.id, textValue: o.hint === undefined ? o.label : `${o.label} ${o.hint}`, isDisabled: o.disabled, "data-ui": "menu.item", className: `flex w-full cursor-default rounded-ui-option ${hasHints ? "items-start py-1.5" : "items-center py-1"} gap-2 ${nested ? "pr-2 pl-(--spacing-indent)" : "px-2"} text-left outline-0 transition-colors duration-(--duration-instant)
|
|
138
|
+
return (_jsxs(MenuItem, { id: o.id, textValue: o.hint === undefined ? o.label : `${o.label} ${o.hint}`, isDisabled: o.disabled, "data-ui": "menu.item", className: `flex w-full cursor-default rounded-ui-option ${hasHints ? "items-start py-1.5" : "items-center py-1"} gap-2 ${nested ? "pr-2 pl-(--spacing-indent)" : "px-2"} text-left outline-0 transition-colors duration-(--duration-instant) ${o.danger === true
|
|
139
|
+
? "data-focused:bg-danger/10"
|
|
140
|
+
: "data-focused:bg-ui-option-active data-open:bg-ui-option-active"} disabled:opacity-45`, children: [hasMarks ? (_jsx("span", { className: `${hasHints ? "mt-0.5" : ""} flex size-(--size-icon-sm) shrink-0 items-center justify-center`, children: checked ? (_jsx(Check, { className: "size-(--size-icon-sm) text-primary", strokeWidth: 2.5, "aria-hidden": true })) : Icon !== undefined ? (_jsx(Icon, { className: `size-(--size-icon-sm) ${o.danger === true ? "text-danger" : "text-muted"}`, strokeWidth: 2, "aria-hidden": true })) : null })) : null, _jsxs("span", { className: "min-w-0 flex-1", children: [_jsxs("span", { className: "flex items-center gap-1.5", children: [_jsx("span", { className: `truncate text-meta ${o.danger === true
|
|
141
|
+
? "text-danger"
|
|
142
|
+
: checked
|
|
143
|
+
? "font-medium text-ink"
|
|
144
|
+
: "text-ink"}`, children: o.label }), o.badge === undefined ? null : typeof o.badge === "number" ? (_jsx("span", { className: "ml-auto flex shrink-0", children: _jsx(Count, { value: o.badge }) })) : typeof o.badge === "string" ? (_jsx("span", { className: "inline-flex shrink-0 items-center rounded-pill border border-warn/30 bg-warn/10 px-2 py-0.5 text-micro text-warn", children: o.badge })) : (_jsx("span", { className: "ml-auto shrink-0", children: o.badge }))] }), o.hint === undefined ? null : (_jsx("span", { className: "mt-0.5 block truncate text-micro text-muted", children: o.hint }))] }), o.shortcut === undefined ? null : (_jsx(Keyboard, { className: "shrink-0 self-center pl-3 font-mono text-micro text-muted", children: o.shortcut })), opens ? (_jsx(ChevronRight, { className: "size-(--size-icon-sm) shrink-0 self-center text-muted", strokeWidth: 2, "aria-hidden": true })) : null] }, o.id));
|
|
139
145
|
};
|
|
140
146
|
return (_jsx(AriaMenu, { "data-ui": "menu", "aria-label": label, shouldCloseOnSelect: closeOnSelect, onAction: act, renderEmptyState: () => (_jsx("p", { className: "px-3 py-3 text-meta text-muted italic", children: emptyText })), className: `max-h-[inherit] overflow-y-auto p-1 outline-0 ${layout === "columns" ? "flex flex-col sm:flex-row sm:items-stretch" : ""}`, children: groups.map((g, gi) => {
|
|
141
147
|
const key = sectionKey(g, gi);
|
|
@@ -18,6 +18,18 @@ export type Aggregate = "count" | "sum" | "mean" | "min" | "max" | "unique";
|
|
|
18
18
|
* Not public.
|
|
19
19
|
*/
|
|
20
20
|
export declare function aggregateFormat<T>(column: DataColumn<T>): ((value: number) => string) | undefined;
|
|
21
|
+
/** How a number of the column is written: its `format`; else with its `decimals`, every number
|
|
22
|
+
* with the same — «6.057,10» over «8.370,57», not «6.057,1»; else `undefined`, the locale's. */
|
|
23
|
+
export declare function columnFormat<T>(column: DataColumn<T>, locale?: string): ((value: number) => string) | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* What a pile adds up to under one column: what whoever keeps the data summed (`Pile.totals`),
|
|
26
|
+
* else the column's aggregate over the rows — only when the pile holds ALL of its rows.
|
|
27
|
+
* `null` when the column declared no aggregate or the pile cannot say it.
|
|
28
|
+
*
|
|
29
|
+
* Exported for the sheet's bands, so a pile says the same total in the table and the sheet.
|
|
30
|
+
* Not public.
|
|
31
|
+
*/
|
|
32
|
+
export declare function pileAggregate<T extends object>(column: DataColumn<T>, pile: Pile<T>): number | null;
|
|
21
33
|
/** An aggregate of a column, written — or the bare number when nothing says how. */
|
|
22
34
|
export declare function aggregateText<T>(column: DataColumn<T>, value: number): string | number;
|
|
23
35
|
export interface DataColumn<T> {
|
|
@@ -69,6 +81,9 @@ export interface DataColumn<T> {
|
|
|
69
81
|
* the number in the copy table's locale, as before.
|
|
70
82
|
*/
|
|
71
83
|
format?: (value: number) => string;
|
|
84
|
+
/** How many decimals EVERY number of the column is written with — cells, piles, footer —
|
|
85
|
+
* when it has no `format`: `2` writes «6.057,10» beside «8.370,57», not «6.057,1». */
|
|
86
|
+
decimals?: number;
|
|
72
87
|
sortable?: boolean;
|
|
73
88
|
/** Odoo: fields without `optional` cannot leave the view. When true, the
|
|
74
89
|
* column appears in the columns submenu and can be hidden. */
|
|
@@ -1,6 +1,6 @@
|
|
|
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
6
|
import { CellCopy } from "./CellCopy.js";
|
|
@@ -27,9 +27,40 @@ const IN_COLUMN_UNITS = new Set(["sum", "mean", "min", "max"]);
|
|
|
27
27
|
*/
|
|
28
28
|
export function aggregateFormat(column) {
|
|
29
29
|
return column.aggregate !== undefined && IN_COLUMN_UNITS.has(column.aggregate)
|
|
30
|
-
? column
|
|
30
|
+
? columnFormat(column)
|
|
31
31
|
: undefined;
|
|
32
32
|
}
|
|
33
|
+
/** How a number of the column is written: its `format`; else with its `decimals`, every number
|
|
34
|
+
* with the same — «6.057,10» over «8.370,57», not «6.057,1»; else `undefined`, the locale's. */
|
|
35
|
+
export function columnFormat(column, locale = currentCopyLocale()) {
|
|
36
|
+
if (column.format !== undefined)
|
|
37
|
+
return column.format;
|
|
38
|
+
const digits = column.decimals;
|
|
39
|
+
return digits === undefined
|
|
40
|
+
? undefined
|
|
41
|
+
: (value) => value.toLocaleString(locale, {
|
|
42
|
+
minimumFractionDigits: digits,
|
|
43
|
+
maximumFractionDigits: digits,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* What a pile adds up to under one column: what whoever keeps the data summed (`Pile.totals`),
|
|
48
|
+
* else the column's aggregate over the rows — only when the pile holds ALL of its rows.
|
|
49
|
+
* `null` when the column declared no aggregate or the pile cannot say it.
|
|
50
|
+
*
|
|
51
|
+
* Exported for the sheet's bands, so a pile says the same total in the table and the sheet.
|
|
52
|
+
* Not public.
|
|
53
|
+
*/
|
|
54
|
+
export function pileAggregate(column, pile) {
|
|
55
|
+
if (column.aggregate === undefined)
|
|
56
|
+
return null;
|
|
57
|
+
const told = pile.totals?.[column.id] ??
|
|
58
|
+
(column.field === undefined ? undefined : pile.totals?.[column.field]);
|
|
59
|
+
if (told !== undefined)
|
|
60
|
+
return told;
|
|
61
|
+
const inside = pile.piles.length === 0 ? pile.items : pileItems(pile.piles);
|
|
62
|
+
return inside.length < pile.count ? null : aggregateOf(column, inside);
|
|
63
|
+
}
|
|
33
64
|
/** An aggregate of a column, written — or the bare number when nothing says how. */
|
|
34
65
|
export function aggregateText(column, value) {
|
|
35
66
|
const format = aggregateFormat(column);
|
|
@@ -39,7 +70,8 @@ function aggregateLabel(copy, column, v) {
|
|
|
39
70
|
const n = v.toLocaleString(copy.locale);
|
|
40
71
|
/* Raw, a sum of amounts read «78.752,9»: one decimal lost and no currency, under a
|
|
41
72
|
column whose every cell says «Bs. 12.300,00». */
|
|
42
|
-
const
|
|
73
|
+
const format = columnFormat(column, copy.locale);
|
|
74
|
+
const amount = (fallback) => (format === undefined ? fallback : format(v));
|
|
43
75
|
switch (column.aggregate ?? "count") {
|
|
44
76
|
case "sum":
|
|
45
77
|
return amount(n);
|
|
@@ -73,7 +105,11 @@ function drawCell(copy, column, row) {
|
|
|
73
105
|
return column.cell(row);
|
|
74
106
|
if (column.text !== undefined)
|
|
75
107
|
return column.text(row);
|
|
76
|
-
|
|
108
|
+
const value = column.value(row);
|
|
109
|
+
/* A number is written the way the column writes its numbers — the same way its footer and
|
|
110
|
+
its piles write them —, so a cell, its pile and the total never disagree on decimals. */
|
|
111
|
+
const format = typeof value === "number" ? columnFormat(column, copy.locale) : undefined;
|
|
112
|
+
return format === undefined ? raw(copy, value) : format(value);
|
|
77
113
|
}
|
|
78
114
|
/* The features are declared once. In v9 they are opt-in: asking only for what
|
|
79
115
|
is used is what keeps the bundle down to what is actually needed. */
|
|
@@ -127,7 +163,7 @@ export function aggregateOf(column, rows) {
|
|
|
127
163
|
}
|
|
128
164
|
/** The piles someone else counted, as the body draws them: open ones with what is inside,
|
|
129
165
|
* the deepest with its records and, when it holds fewer than it counts, its «show more». */
|
|
130
|
-
function entriesOfPiles(piles, keyOf, collapsed, onToggle, onMore) {
|
|
166
|
+
function entriesOfPiles(piles, columns, keyOf, collapsed, onToggle, onMore) {
|
|
131
167
|
return piles.flatMap((pile) => {
|
|
132
168
|
const key = pathKey(pile.path);
|
|
133
169
|
const open = collapsed?.includes(key) !== true;
|
|
@@ -139,13 +175,17 @@ function entriesOfPiles(piles, keyOf, collapsed, onToggle, onMore) {
|
|
|
139
175
|
label: pile.label,
|
|
140
176
|
count: pile.count,
|
|
141
177
|
detail: pile.detail,
|
|
178
|
+
totals: columns.map((column) => pileAggregate(column, pile)),
|
|
142
179
|
open,
|
|
143
180
|
toggle: onToggle === undefined ? undefined : () => onToggle(key),
|
|
144
181
|
};
|
|
145
182
|
if (!open)
|
|
146
183
|
return [head];
|
|
147
184
|
if (pile.piles.length > 0) {
|
|
148
|
-
return [
|
|
185
|
+
return [
|
|
186
|
+
head,
|
|
187
|
+
...entriesOfPiles(pile.piles, columns, keyOf, collapsed, onToggle, onMore),
|
|
188
|
+
];
|
|
149
189
|
}
|
|
150
190
|
const foot = pileFoot(pile, onMore !== undefined);
|
|
151
191
|
return [
|
|
@@ -308,7 +348,7 @@ export function DataTable({ data, columns, getRowId, sort, onSortChange, levels,
|
|
|
308
348
|
TanStack built from the page. Before, the table only knew the second — grouped on the
|
|
309
349
|
server, a list said «187» in rows and «12» in the table. */
|
|
310
350
|
const entries = piles !== undefined
|
|
311
|
-
? entriesOfPiles(piles, getRowId, collapsed, onGroupToggle, onMore)
|
|
351
|
+
? entriesOfPiles(piles, columns, getRowId, collapsed, onGroupToggle, onMore)
|
|
312
352
|
: shown.map((row) => {
|
|
313
353
|
if (row.subRows.length === 0)
|
|
314
354
|
return { kind: "row", id: row.id, item: row.original };
|
|
@@ -316,6 +356,12 @@ export function DataTable({ data, columns, getRowId, sort, onSortChange, levels,
|
|
|
316
356
|
const key = pathKey(path);
|
|
317
357
|
const depth = path.length - 1;
|
|
318
358
|
const level = levels?.find((one) => one.id === row.groupingColumnId);
|
|
359
|
+
/* The rows INSIDE, not the subgroups: `subRows` of a pile with levels below are the
|
|
360
|
+
piles of the next level. */
|
|
361
|
+
const inside = row
|
|
362
|
+
.getLeafRows()
|
|
363
|
+
.filter((leaf) => leaf.subRows.length === 0)
|
|
364
|
+
.map((leaf) => leaf.original);
|
|
319
365
|
/* The pile's KEY —the engine's— and the label, which the level sets: they are two
|
|
320
366
|
texts and only the second changes with the language. */
|
|
321
367
|
const value = path[depth] ?? key;
|
|
@@ -325,11 +371,10 @@ export function DataTable({ data, columns, getRowId, sort, onSortChange, levels,
|
|
|
325
371
|
depth,
|
|
326
372
|
level: level?.label,
|
|
327
373
|
label: level === undefined ? value : level.labelOf(value),
|
|
328
|
-
/*
|
|
329
|
-
|
|
330
|
-
forty rows. */
|
|
331
|
-
count: row.getLeafRows().filter((leaf) => leaf.subRows.length === 0).length,
|
|
374
|
+
/* Counting the subgroups said «2» where there are forty rows. */
|
|
375
|
+
count: inside.length,
|
|
332
376
|
detail: undefined,
|
|
377
|
+
totals: columns.map((column) => aggregateOf(column, inside)),
|
|
333
378
|
open: collapsed === undefined ? row.getIsExpanded() : !collapsed.includes(key),
|
|
334
379
|
toggle: () => onGroupToggle === undefined ? row.toggleExpanded() : onGroupToggle(key),
|
|
335
380
|
};
|
|
@@ -352,6 +397,13 @@ export function DataTable({ data, columns, getRowId, sort, onSortChange, levels,
|
|
|
352
397
|
`aggregationFn` lives in the GROUP model, and a footer exists precisely when
|
|
353
398
|
there are no groups. */
|
|
354
399
|
const footer = useMemo(() => (totals ? columns.map((c) => aggregateOf(c, data)) : null), [totals, columns, data]);
|
|
400
|
+
/* A pile's row is split where the numbers start: its name spans the columns up to the
|
|
401
|
+
first one that sums, and from there each column says what the pile adds up to UNDER
|
|
402
|
+
itself — Odoo's grouped list. With no column that sums, the name spans the row. */
|
|
403
|
+
const firstSum = columns.findIndex((c) => c.aggregate !== undefined && c.numeric === true);
|
|
404
|
+
const lead = selecting ? 1 : 0;
|
|
405
|
+
const labelSpan = firstSum < 0 ? width : Math.max(1, lead + firstSum);
|
|
406
|
+
const sumsFrom = firstSum < 0 ? columns.length : labelSpan - lead;
|
|
355
407
|
const all = leaves.length > 0 && leaves.every((id) => selected?.has(id) === true);
|
|
356
408
|
const some = leaves.some((id) => selected?.has(id) === true);
|
|
357
409
|
function toggle(id, on) {
|
|
@@ -384,7 +436,10 @@ export function DataTable({ data, columns, getRowId, sort, onSortChange, levels,
|
|
|
384
436
|
gap,
|
|
385
437
|
/* The pile's row: it spans the whole width, says which value it groups by
|
|
386
438
|
and how many are inside — what makes it useful without opening it. */
|
|
387
|
-
|
|
439
|
+
_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) => {
|
|
440
|
+
const value = entry.totals[sumsFrom + i] ?? null;
|
|
441
|
+
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));
|
|
442
|
+
}), firstSum < 0 || rowActions === undefined ? null : _jsx("td", {})] }, entry.id),
|
|
388
443
|
];
|
|
389
444
|
}
|
|
390
445
|
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) => {
|
|
@@ -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
|
|
@@ -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
|
}
|
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
|