@sincpro/web-ui 2.7.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 +159 -4
- 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/components/search/CriteriaBuilder.d.ts +5 -2
- package/dist/components/search/CriteriaBuilder.js +2 -1
- package/dist/components/search/FieldPath.js +16 -7
- package/dist/components/search/FilterBuilder.d.ts +13 -4
- package/dist/components/search/FilterBuilder.js +72 -23
- package/dist/components/search/RuleValue.d.ts +6 -2
- package/dist/components/search/RuleValue.js +27 -5
- package/dist/components/search/SearchBar.d.ts +6 -6
- package/dist/components/search/SearchBar.js +41 -4
- package/dist/components/search/context.d.ts +6 -2
- package/dist/components/search/context.js +5 -2
- package/dist/components/search/index.d.ts +1 -1
- package/dist/components/search/records.d.ts +23 -0
- 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
|
@@ -4,14 +4,16 @@ import { useUiCopy } from "../../foundations/copy.js";
|
|
|
4
4
|
import { byDensity, useDensity } from "../../foundations/density.js";
|
|
5
5
|
import { useSurface } from "../../foundations/surface.js";
|
|
6
6
|
import { cn, focusRing, tv } from "../../foundations/variants.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { MenuList } from "../../primitives/menu/Menu.js";
|
|
8
|
+
import { Popover } from "../../primitives/overlay/Popover.js";
|
|
9
|
+
import { Check, ChevronDown, CircleAlert } from "lucide-react";
|
|
10
|
+
import { Button as AriaButton, MenuTrigger, Radio, RadioGroup } from "react-aria-components";
|
|
9
11
|
/** The track the stages sit in. Same rail as the other grouped controls on each
|
|
10
12
|
* surface: a tinted well with a hairline, and on the chrome TRANSLUCENT —ink at 8 %
|
|
11
13
|
* over the navy— so the header's brand wash goes across it and it reads as a layer,
|
|
12
14
|
* not as one more box stuck on top. */
|
|
13
15
|
const trackStyles = tv({
|
|
14
|
-
base: "min-w-0 gap-0.5
|
|
16
|
+
base: "min-w-0 gap-0.5 border p-0.5",
|
|
15
17
|
variants: {
|
|
16
18
|
surface: {
|
|
17
19
|
canvas: "border-line bg-ground",
|
|
@@ -21,7 +23,15 @@ const trackStyles = tv({
|
|
|
21
23
|
trail: "inline-flex max-w-full shrink-0 items-stretch",
|
|
22
24
|
stacked: "flex w-full flex-col",
|
|
23
25
|
},
|
|
26
|
+
/* `well` is Odoo's track; `pill` the segmented control — the action dock's shape: a pill
|
|
27
|
+
holding pills, on the paper's surface. */
|
|
28
|
+
shape: { well: "rounded-control", pill: "rounded-pill" },
|
|
24
29
|
},
|
|
30
|
+
compoundVariants: [
|
|
31
|
+
{ shape: "pill", surface: "canvas", class: "border-line-strong bg-surface" },
|
|
32
|
+
/* Stacked, a pill of rows is a capsule nobody reads as a list: the box's corners. */
|
|
33
|
+
{ shape: "pill", layout: "stacked", class: "rounded-box" },
|
|
34
|
+
],
|
|
25
35
|
});
|
|
26
36
|
/** One stage. Three steps —done, current, next— and ONE way of painting each, the
|
|
27
37
|
* same in both layouts and with or without `onSelect`:
|
|
@@ -36,8 +46,9 @@ const trackStyles = tv({
|
|
|
36
46
|
* one included — without competing with the fill. */
|
|
37
47
|
const stageStyles = tv({
|
|
38
48
|
extend: focusRing,
|
|
39
|
-
base: "relative flex min-w-0 items-center gap-1.5
|
|
49
|
+
base: "relative flex min-w-0 items-center gap-1.5 text-meta whitespace-nowrap transition-colors duration-(--duration-instant)",
|
|
40
50
|
variants: {
|
|
51
|
+
shape: { well: "rounded-mark px-2.5", pill: "rounded-pill px-3" },
|
|
41
52
|
surface: { canvas: "", chrome: "outline-chrome-link" },
|
|
42
53
|
step: { done: "font-medium", current: "font-semibold", next: "" },
|
|
43
54
|
failed: { true: "", false: "" },
|
|
@@ -82,38 +93,7 @@ const stageStyles = tv({
|
|
|
82
93
|
},
|
|
83
94
|
],
|
|
84
95
|
});
|
|
85
|
-
|
|
86
|
-
*
|
|
87
|
-
* ── One track, one language ──────────────────────────────────────────
|
|
88
|
-
*
|
|
89
|
-
* The stages are segments of ONE track, Odoo's statusbar: the order is the
|
|
90
|
-
* direction. What is behind is ink with a check, what comes next is muted, and the
|
|
91
|
-
* current stage is the only FILLED segment — `primary` on the canvas, the chrome's
|
|
92
|
-
* ink inverted on the rail. With `failed` that fill turns `danger` and carries an
|
|
93
|
-
* alert mark, so the failure is not only a color.
|
|
94
|
-
*
|
|
95
|
-
* A clipped arrow per step was tried and dropped: the notch between two arrows
|
|
96
|
-
* reads as a gap — four chips, not a path.
|
|
97
|
-
*
|
|
98
|
-
* ── Narrow: it STACKS, it does not hide ──────────────────────────────
|
|
99
|
-
*
|
|
100
|
-
* Four stages side by side do not fit in a 480 px drawer, and the answer is not
|
|
101
|
-
* tucking them behind a chevron: a state you have to open stops answering «where
|
|
102
|
-
* is this at?», which is the only question it has. It stacks — one stage per row —
|
|
103
|
-
* in the same track, with the same three paints and the same marks. What changes
|
|
104
|
-
* is the DIRECTION, not how much is shown nor how it is painted.
|
|
105
|
-
*
|
|
106
|
-
* ── And it can be CHOSEN ─────────────────────────────────────────────
|
|
107
|
-
*
|
|
108
|
-
* With `onSelect` the track is a React Aria `RadioGroup`: one stage at a time,
|
|
109
|
-
* arrow keys move between them, Tab enters at the chosen one. It is not
|
|
110
|
-
* «advancing» — a stage does not change by pressing it — it is choosing which
|
|
111
|
-
* stage we are talking about: in a list grouped by stage, pressing «generando» asks
|
|
112
|
-
* for those. So the record's CURRENT stage (`current`, the fill, `aria-current`)
|
|
113
|
-
* and the stage being VIEWED (`selected`, the underline, the checked radio) are two
|
|
114
|
-
* different things and are painted differently. Without `onSelect` it is a plain
|
|
115
|
-
* ordered list and the current stage is `aria-current="step"`. */
|
|
116
|
-
export function StatusBar({ stages, current, failed = false, surface: surfaceProp, onSelect, selected, layout, }) {
|
|
96
|
+
export function StatusBar({ stages, current, failed = false, surface: surfaceProp, onSelect, selected, layout, look = "track", display = "auto", renderStage, }) {
|
|
117
97
|
const d = useDensity();
|
|
118
98
|
const surface = useSurface(surfaceProp);
|
|
119
99
|
const copy = useUiCopy();
|
|
@@ -126,32 +106,221 @@ export function StatusBar({ stages, current, failed = false, surface: surfacePro
|
|
|
126
106
|
return "current";
|
|
127
107
|
return at >= 0 && i < at ? "done" : "next";
|
|
128
108
|
}
|
|
129
|
-
/** The
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
109
|
+
/** The icon a stage wears now: its `activeIcon` when it is current or looked at. */
|
|
110
|
+
function iconOf(stage, step, viewed) {
|
|
111
|
+
return (step === "current" || viewed) && stage.activeIcon !== undefined
|
|
112
|
+
? stage.activeIcon
|
|
113
|
+
: stage.icon;
|
|
114
|
+
}
|
|
115
|
+
/** Whether the stage's name is SEEN — otherwise it is said (visually hidden, and on hover). */
|
|
116
|
+
function nameShown(step, viewed) {
|
|
117
|
+
return (display === "auto" ||
|
|
118
|
+
display === "both" ||
|
|
119
|
+
display === "label" ||
|
|
120
|
+
(display === "current" && (step === "current" || viewed)));
|
|
121
|
+
}
|
|
122
|
+
/** `auto`, side by side, a stage that is not where the record is: its name is SAID on a
|
|
123
|
+
* phone and seen where there is room. */
|
|
124
|
+
function namedWide(step, viewed) {
|
|
125
|
+
return display === "auto" && !stacked && step !== "current" && !viewed;
|
|
126
|
+
}
|
|
127
|
+
/** The class of a stage's name: seen, said, or seen only where there is room. */
|
|
128
|
+
function nameClass(step, viewed, seen) {
|
|
129
|
+
if (!nameShown(step, viewed))
|
|
130
|
+
return "sr-only";
|
|
131
|
+
return namedWide(step, viewed) ? `${seen} max-sm:sr-only` : seen;
|
|
132
|
+
}
|
|
133
|
+
/** On a phone, a stage whose name is only said and that has no icon shows its number. */
|
|
134
|
+
function numberOnPhone(i) {
|
|
135
|
+
return (_jsx("span", { "aria-hidden": true, className: "min-w-(--size-icon-sm) text-center tabular-nums sm:hidden", children: (i + 1).toLocaleString(copy.locale) }));
|
|
136
|
+
}
|
|
137
|
+
/** The alert, the stage's icon, the check, its number — or nothing. Stacked keeps the slot
|
|
138
|
+
* even when it is empty, so the labels line up in a column; side by side an empty slot
|
|
139
|
+
* would only be a gap. */
|
|
140
|
+
function mark(stage, i, step, viewed) {
|
|
133
141
|
const icon = "size-(--size-icon-sm) shrink-0";
|
|
134
|
-
if (step === "done")
|
|
135
|
-
return _jsx(Check, { className: icon, strokeWidth: 2, "aria-hidden": true });
|
|
136
142
|
if (step === "current" && failed) {
|
|
137
143
|
return _jsx(CircleAlert, { className: icon, strokeWidth: 2, "aria-hidden": true });
|
|
138
144
|
}
|
|
145
|
+
const Icon = display === "label" ? undefined : iconOf(stage, step, viewed);
|
|
146
|
+
/* The stage's own icon says it better than the check: done is still read in its ink. */
|
|
147
|
+
if (Icon !== undefined)
|
|
148
|
+
return _jsx(Icon, { className: icon, strokeWidth: 2, "aria-hidden": true });
|
|
149
|
+
/* Its name hidden and no icon of its own: its place in the order. */
|
|
150
|
+
if (!nameShown(step, viewed)) {
|
|
151
|
+
return (_jsx("span", { "aria-hidden": true, className: "min-w-(--size-icon-sm) text-center tabular-nums", children: (i + 1).toLocaleString(copy.locale) }));
|
|
152
|
+
}
|
|
153
|
+
if (namedWide(step, viewed)) {
|
|
154
|
+
return (_jsxs(_Fragment, { children: [step === "done" ? (_jsx(Check, { className: `${icon} max-sm:hidden`, strokeWidth: 2, "aria-hidden": true })) : null, numberOnPhone(i)] }));
|
|
155
|
+
}
|
|
156
|
+
if (step === "done" && display !== "label") {
|
|
157
|
+
return _jsx(Check, { className: icon, strokeWidth: 2, "aria-hidden": true });
|
|
158
|
+
}
|
|
139
159
|
return stacked ? _jsx("span", { className: icon, "aria-hidden": true }) : null;
|
|
140
160
|
}
|
|
141
|
-
|
|
142
|
-
|
|
161
|
+
/** How many are on the stage, after its name — quieter than the name. */
|
|
162
|
+
function countOf(stage) {
|
|
163
|
+
return stage.count === undefined ? null : (_jsx("span", { className: "shrink-0 tabular-nums opacity-70", children: stage.count.toLocaleString(copy.locale) }));
|
|
164
|
+
}
|
|
165
|
+
function content(stage, i, step, viewed) {
|
|
166
|
+
if (renderStage !== undefined) {
|
|
167
|
+
return renderStage(stage, {
|
|
168
|
+
step,
|
|
169
|
+
failed: step === "current" && failed,
|
|
170
|
+
viewed,
|
|
171
|
+
index: i,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
const seen = nameShown(step, viewed);
|
|
175
|
+
return (
|
|
176
|
+
/* Its name hidden, the hint — else the name — is what pointing at it says. */
|
|
177
|
+
_jsxs("span", { className: "flex min-w-0 items-center gap-1.5", title: seen ? undefined : (stage.hint ?? stage.label), children: [mark(stage, i, step, viewed), _jsx("span", { title: seen ? stage.hint : undefined, "aria-current": step === "current" && selectable ? "step" : undefined, className: cn(nameClass(step, viewed, "min-w-0 truncate"), viewed &&
|
|
143
178
|
"underline decoration-2 underline-offset-4 " +
|
|
144
179
|
(step === "current"
|
|
145
180
|
? "decoration-current"
|
|
146
181
|
: surface === "chrome"
|
|
147
182
|
? "decoration-chrome-link"
|
|
148
|
-
: "decoration-primary")), children: stage.label })] }));
|
|
183
|
+
: "decoration-primary")), children: stage.label }), countOf(stage)] }));
|
|
184
|
+
}
|
|
185
|
+
const rounded = look === "segmented" ? "pill" : "well";
|
|
186
|
+
const track = trackStyles({ surface, layout: shape, shape: rounded });
|
|
187
|
+
if (look === "pill") {
|
|
188
|
+
const chrome = surface === "chrome";
|
|
189
|
+
const now = stages[at];
|
|
190
|
+
const dot = failed
|
|
191
|
+
? chrome
|
|
192
|
+
? "bg-chrome-bad"
|
|
193
|
+
: "bg-danger"
|
|
194
|
+
: chrome
|
|
195
|
+
? "bg-chrome-link"
|
|
196
|
+
: "bg-primary";
|
|
197
|
+
/* Its name is what it shows, said first what it is: «Estado: Publicada 2/3». As a button
|
|
198
|
+
the name comes from its content (voice control matches what is SEEN); a status takes no
|
|
199
|
+
name from content, so it says it in a label. */
|
|
200
|
+
const said = `${copy.record.status}: ${now?.label ?? current} ${at + 1}/${stages.length}`;
|
|
201
|
+
const NowIcon = now === undefined || display === "label" ? undefined : iconOf(now, "current", false);
|
|
202
|
+
const chip = (_jsxs(_Fragment, { children: [NowIcon !== undefined && !failed ? (_jsx(NowIcon, { className: `size-(--size-icon-sm) shrink-0 ${chrome ? "text-chrome-link" : "text-primary"}`, strokeWidth: 2, "aria-hidden": true })) : (_jsx("span", { "aria-hidden": true, className: `size-2 shrink-0 rounded-pill ${dot}` })), _jsx("span", { className: "font-semibold", children: now?.label ?? current }), _jsx("span", { className: `tabular-nums ${chrome ? "text-chrome-muted" : "text-muted"}`, children: `${at + 1}/${stages.length}` })] }));
|
|
203
|
+
const frame = `inline-flex h-(--size-control-sm) shrink-0 items-center gap-1.5 rounded-pill border px-2.5 text-meta ${chrome
|
|
204
|
+
? "border-chrome-ink/20 bg-chrome-ink/8 text-chrome-ink"
|
|
205
|
+
: "border-line-strong bg-surface text-ink"}`;
|
|
206
|
+
if (!selectable) {
|
|
207
|
+
return (_jsx("span", { role: "status", "aria-label": said, "data-failed": failed ? true : undefined, className: frame, children: chip }));
|
|
208
|
+
}
|
|
209
|
+
/* The chip IS the trigger: the same face, a chevron added — the stages open below it. */
|
|
210
|
+
return (_jsxs(MenuTrigger, { children: [_jsxs(AriaButton, { className: ({ isFocusVisible }) => cn(frame, "cursor-pointer transition-colors duration-(--duration-instant)", chrome
|
|
211
|
+
? "hover:bg-chrome-ink/14"
|
|
212
|
+
: "hover:border-primary/45 hover:bg-primary/5", isFocusVisible && "outline-2 outline-offset-2 outline-primary"), children: [_jsx("span", { className: "sr-only", children: `${copy.record.status}: ` }), chip, _jsx(ChevronDown, { className: `size-(--size-icon-sm) ${chrome ? "text-chrome-muted" : "text-muted"}`, strokeWidth: 2, "aria-hidden": true })] }), _jsx(Popover, { placement: "bottom end", className: "min-w-44", children: _jsx(MenuList, { label: copy.record.status, closeOnSelect: true, emptyText: "", width: "sm", groups: [
|
|
213
|
+
{
|
|
214
|
+
options: stages.map((stage) => ({
|
|
215
|
+
id: stage.id,
|
|
216
|
+
label: stage.label,
|
|
217
|
+
...(display === "label" || stage.icon === undefined
|
|
218
|
+
? {}
|
|
219
|
+
: { icon: stage.icon }),
|
|
220
|
+
...(stage.count === undefined
|
|
221
|
+
? {}
|
|
222
|
+
: { hint: stage.count.toLocaleString(copy.locale) }),
|
|
223
|
+
checked: stage.id === (selected ?? current),
|
|
224
|
+
})),
|
|
225
|
+
},
|
|
226
|
+
], onAction: (id) => onSelect?.(String(id)) }) })] }));
|
|
227
|
+
}
|
|
228
|
+
if (look === "progress" && !stacked) {
|
|
229
|
+
const chrome = surface === "chrome";
|
|
230
|
+
const barOf = (step) => step === "current"
|
|
231
|
+
? failed
|
|
232
|
+
? chrome
|
|
233
|
+
? "bg-chrome-bad"
|
|
234
|
+
: "bg-danger"
|
|
235
|
+
: chrome
|
|
236
|
+
? "bg-chrome-link"
|
|
237
|
+
: "bg-primary"
|
|
238
|
+
: step === "done"
|
|
239
|
+
? chrome
|
|
240
|
+
? "bg-chrome-link/45"
|
|
241
|
+
: "bg-primary/40"
|
|
242
|
+
: chrome
|
|
243
|
+
? "bg-chrome-ink/15"
|
|
244
|
+
: "bg-ink/10";
|
|
245
|
+
const labelOf = (step) => step === "current"
|
|
246
|
+
? `font-semibold ${chrome ? "text-chrome-ink" : "text-ink"}`
|
|
247
|
+
: step === "done"
|
|
248
|
+
? chrome
|
|
249
|
+
? "text-chrome-ink"
|
|
250
|
+
: "text-ink"
|
|
251
|
+
: chrome
|
|
252
|
+
? "text-chrome-muted"
|
|
253
|
+
: "text-muted";
|
|
254
|
+
const segment = (stage, i, viewed) => {
|
|
255
|
+
const where = stepOf(i);
|
|
256
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": true, className: `block h-1.5 w-full rounded-pill ${barOf(where)}` }), _jsxs("span", { "aria-current": where === "current" && selectable ? "step" : undefined, className: cn("mt-1 flex min-w-0 items-center gap-1 text-micro whitespace-nowrap", labelOf(where), viewed && "underline decoration-2 underline-offset-4"), children: [(() => {
|
|
257
|
+
const Icon = display === "label" ? undefined : iconOf(stage, where, viewed);
|
|
258
|
+
return where === "current" && failed ? (_jsx(CircleAlert, { className: "size-3 shrink-0", strokeWidth: 2.5, "aria-hidden": true })) : Icon !== undefined ? (_jsx(Icon, { className: "size-3 shrink-0", strokeWidth: 2.5, "aria-hidden": true })) : where === "done" && display !== "label" ? (_jsx(Check, { className: "size-3 shrink-0", strokeWidth: 2.5, "aria-hidden": true })) : null;
|
|
259
|
+
})(), _jsx("span", { className: nameClass(where, viewed, "min-w-0 truncate"), title: stage.hint, children: stage.label }), countOf(stage)] })] }));
|
|
260
|
+
};
|
|
261
|
+
/* Each stage asks for room for its name: squeezed, «Borrador Publicada» read as one. */
|
|
262
|
+
const row = "grid shrink-0 auto-cols-fr grid-flow-col gap-1.5";
|
|
263
|
+
if (!selectable) {
|
|
264
|
+
return (_jsx("ol", { "aria-label": copy.record.status, "data-look": "progress", className: row, children: stages.map((stage, i) => (_jsx("li", { "aria-current": stepOf(i) === "current" ? "step" : undefined, "data-failed": stepOf(i) === "current" && failed ? true : undefined, className: "flex w-24 min-w-0 flex-col", children: segment(stage, i, false) }, stage.id))) }));
|
|
265
|
+
}
|
|
266
|
+
return (_jsx(RadioGroup, { "aria-label": copy.record.status, orientation: "horizontal", ...(selected === undefined ? {} : { value: selected }), onChange: onSelect, "data-look": "progress", className: row, children: stages.map((stage, i) => (_jsx(Radio, { value: stage.id, className: ({ isFocusVisible }) => cn("flex w-24 min-w-0 cursor-pointer flex-col rounded-mark", isFocusVisible && "outline-2 outline-offset-2 outline-primary"), children: ({ isSelected }) => segment(stage, i, isSelected) }, stage.id))) }));
|
|
267
|
+
}
|
|
268
|
+
if (look === "steps" && !stacked) {
|
|
269
|
+
const chrome = surface === "chrome";
|
|
270
|
+
const dotOf = (step) => step === "current"
|
|
271
|
+
? failed
|
|
272
|
+
? `${chrome ? "bg-chrome-bad" : "bg-danger"} ring-3 ${chrome ? "ring-chrome-bad/25" : "ring-danger/20"}`
|
|
273
|
+
: `${chrome ? "bg-chrome-ink" : "bg-primary"} ring-3 ${chrome ? "ring-chrome-ink/25" : "ring-primary/20"}`
|
|
274
|
+
: step === "done"
|
|
275
|
+
? chrome
|
|
276
|
+
? "bg-chrome-ink/60"
|
|
277
|
+
: "bg-ink/55"
|
|
278
|
+
: `border ${chrome ? "border-chrome-muted/60" : "border-line-strong"} bg-transparent`;
|
|
279
|
+
const labelOf = (step) => step === "current"
|
|
280
|
+
? `font-semibold ${chrome ? "text-chrome-ink" : "text-ink"}`
|
|
281
|
+
: step === "done"
|
|
282
|
+
? chrome
|
|
283
|
+
? "text-chrome-ink"
|
|
284
|
+
: "text-ink"
|
|
285
|
+
: chrome
|
|
286
|
+
? "text-chrome-muted"
|
|
287
|
+
: "text-muted";
|
|
288
|
+
const joinOf = (i) => i <= at
|
|
289
|
+
? chrome
|
|
290
|
+
? "bg-chrome-ink/45"
|
|
291
|
+
: "bg-ink/35"
|
|
292
|
+
: chrome
|
|
293
|
+
? "bg-chrome-muted/35"
|
|
294
|
+
: "bg-line-strong";
|
|
295
|
+
const step = (stage, i, viewed) => {
|
|
296
|
+
const where = stepOf(i);
|
|
297
|
+
if (renderStage !== undefined) {
|
|
298
|
+
return (_jsxs(_Fragment, { children: [i === 0 ? null : (_jsx("span", { "aria-hidden": true, className: `h-px w-5 shrink-0 ${joinOf(i)}` })), renderStage(stage, {
|
|
299
|
+
step: where,
|
|
300
|
+
failed: where === "current" && failed,
|
|
301
|
+
viewed,
|
|
302
|
+
index: i,
|
|
303
|
+
})] }));
|
|
304
|
+
}
|
|
305
|
+
const StepIcon = display === "label" ? undefined : iconOf(stage, where, viewed);
|
|
306
|
+
return (_jsxs(_Fragment, { children: [i === 0 ? null : _jsx("span", { "aria-hidden": true, className: `h-px w-5 shrink-0 ${joinOf(i)}` }), _jsx("span", { "aria-hidden": true, className: `size-2 shrink-0 rounded-pill ${dotOf(where)}` }), where === "current" && failed ? (_jsx(CircleAlert, { className: `size-(--size-icon-sm) shrink-0 ${chrome ? "text-chrome-bad" : "text-danger"}`, strokeWidth: 2, "aria-hidden": true })) : StepIcon !== undefined ? (_jsx(StepIcon, { className: `size-(--size-icon-sm) shrink-0 ${labelOf(where)}`, strokeWidth: 2, "aria-hidden": true })) : null, _jsx("span", { title: stage.hint, "aria-current": where === "current" && selectable ? "step" : undefined, className: cn(nameClass(where, viewed, "min-w-0 truncate text-meta whitespace-nowrap"), labelOf(where), viewed && "underline decoration-2 underline-offset-4"), children: stage.label }), stage.count === undefined ? null : (_jsx("span", { className: `text-meta ${labelOf(where)}`, children: countOf(stage) }))] }));
|
|
307
|
+
};
|
|
308
|
+
if (!selectable) {
|
|
309
|
+
return (_jsx("ol", { "aria-label": copy.record.status, className: "flex min-w-0 shrink-0 items-center gap-2", children: stages.map((stage, i) => (_jsx("li", { "aria-current": stepOf(i) === "current" ? "step" : undefined, "data-failed": stepOf(i) === "current" && failed ? true : undefined, className: "flex min-w-0 items-center gap-2", children: step(stage, i, false) }, stage.id))) }));
|
|
310
|
+
}
|
|
311
|
+
return (_jsx(RadioGroup, { "aria-label": copy.record.status, orientation: "horizontal", ...(selected === undefined ? {} : { value: selected }), onChange: onSelect, className: "flex min-w-0 shrink-0 items-center gap-2", children: stages.map((stage, i) => (_jsx(Radio, { value: stage.id, className: ({ isFocusVisible }) => cn("flex min-w-0 cursor-pointer items-center gap-2 rounded-mark", isFocusVisible && "outline-2 outline-offset-2 outline-primary"), children: ({ isSelected }) => step(stage, i, isSelected) }, stage.id))) }));
|
|
149
312
|
}
|
|
150
|
-
const track = trackStyles({ surface, layout: shape });
|
|
151
313
|
if (!selectable) {
|
|
152
314
|
return (_jsx("ol", { "aria-label": copy.record.status, className: track, children: stages.map((stage, i) => {
|
|
153
315
|
const step = stepOf(i);
|
|
154
|
-
return (_jsx("li", { "aria-current": step === "current" ? "step" : undefined, "data-failed": step === "current" && failed ? true : undefined, className: stageStyles({
|
|
316
|
+
return (_jsx("li", { "aria-current": step === "current" ? "step" : undefined, "data-failed": step === "current" && failed ? true : undefined, className: stageStyles({
|
|
317
|
+
surface,
|
|
318
|
+
step,
|
|
319
|
+
failed,
|
|
320
|
+
selectable,
|
|
321
|
+
layout: shape,
|
|
322
|
+
shape: rounded,
|
|
323
|
+
}), children: content(stage, i, step, false) }, stage.id));
|
|
155
324
|
}) }));
|
|
156
325
|
}
|
|
157
326
|
return (_jsx(RadioGroup, { "aria-label": copy.record.status, orientation: stacked ? "vertical" : "horizontal", ...(selected === undefined ? {} : { value: selected }), onChange: onSelect, className: track, children: stages.map((stage, i) => {
|
|
@@ -162,7 +331,8 @@ export function StatusBar({ stages, current, failed = false, surface: surfacePro
|
|
|
162
331
|
failed,
|
|
163
332
|
selectable,
|
|
164
333
|
layout: shape,
|
|
334
|
+
shape: rounded,
|
|
165
335
|
isFocusVisible,
|
|
166
|
-
}), children: ({ isSelected }) => content(stage, step, isSelected) }, stage.id));
|
|
336
|
+
}), children: ({ isSelected }) => content(stage, i, step, isSelected) }, stage.id));
|
|
167
337
|
}) }));
|
|
168
338
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { MenuGroup, MenuOption } from "../../primitives/menu/Menu.js";
|
|
2
|
+
import type { LucideIcon } from "lucide-react";
|
|
3
|
+
/** One action of a dock. */
|
|
4
|
+
export interface DockAction {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
icon?: LucideIcon;
|
|
8
|
+
/** THE action the screen exists for: gold, always seen. One per dock — a second one is
|
|
9
|
+
* read as a secondary. */
|
|
10
|
+
primary?: boolean;
|
|
11
|
+
/** It destroys or undoes: drawn last in «Más», apart, never beside the primary. */
|
|
12
|
+
danger?: boolean;
|
|
13
|
+
/** In «Más» even with room: what is rarely done. */
|
|
14
|
+
tucked?: boolean;
|
|
15
|
+
onSelect?: () => void;
|
|
16
|
+
/** Sub-actions: «Imprimir ▸ Factura · Remito». Seen, the action is a menu button; in
|
|
17
|
+
* «Más», a submenu. Its own `onSelect` is not run — a row that opens does not also do. */
|
|
18
|
+
items?: readonly DockAction[];
|
|
19
|
+
/** The keys that run it, as people read them — «Ctrl+P». A hint in the menu. */
|
|
20
|
+
shortcut?: string;
|
|
21
|
+
/** The line under it, in the menu. */
|
|
22
|
+
hint?: string;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface DockPlan {
|
|
26
|
+
primary: DockAction | undefined;
|
|
27
|
+
/** The secondary actions seen, in order. */
|
|
28
|
+
shown: DockAction[];
|
|
29
|
+
/** «Más»: the rest, and the destructive ones apart. */
|
|
30
|
+
more: DockAction[];
|
|
31
|
+
danger: DockAction[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* What a dock shows for these actions, with room for `visible` secondary ones.
|
|
35
|
+
*
|
|
36
|
+
* in [Registrar pago*, Enviar, Imprimir▸, Duplicar, Anular!], visible 2
|
|
37
|
+
* out shown [Enviar, Imprimir] more [Duplicar] danger [Anular] primary Registrar pago
|
|
38
|
+
*/
|
|
39
|
+
export declare function dockPlan(actions: readonly DockAction[], visible?: number): DockPlan;
|
|
40
|
+
/** How a combination is drawn — the platform's way («⌥D», «Alt+D»); as written without one. */
|
|
41
|
+
export type KeysLabel = (keys: string) => string;
|
|
42
|
+
/** An action as a menu row — its sub-actions as a submenu, its shortcut drawn for this
|
|
43
|
+
* keyboard. */
|
|
44
|
+
export declare function dockOption(action: DockAction, label?: KeysLabel): MenuOption;
|
|
45
|
+
/** «Más» as menu groups: the rest, then the destructive ones apart. */
|
|
46
|
+
export declare function moreGroups(plan: DockPlan, label?: KeysLabel): MenuGroup[];
|
|
47
|
+
/**
|
|
48
|
+
* The combinations a dock answers: every action with a `shortcut` — sub-actions and what waits
|
|
49
|
+
* in «Más» included, a shortcut is how one reaches what is not in sight. None while there are
|
|
50
|
+
* changes: the actions are not there, and Save answers Mod+S itself (`DirtyActions`).
|
|
51
|
+
*/
|
|
52
|
+
export declare function dockShortcuts(actions: readonly DockAction[], dirty?: boolean): {
|
|
53
|
+
keys: string;
|
|
54
|
+
run: () => void;
|
|
55
|
+
enabled: boolean;
|
|
56
|
+
}[];
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a dock shows for these actions, with room for `visible` secondary ones.
|
|
3
|
+
*
|
|
4
|
+
* in [Registrar pago*, Enviar, Imprimir▸, Duplicar, Anular!], visible 2
|
|
5
|
+
* out shown [Enviar, Imprimir] more [Duplicar] danger [Anular] primary Registrar pago
|
|
6
|
+
*/
|
|
7
|
+
export function dockPlan(actions, visible = 2) {
|
|
8
|
+
const primary = actions.find((one) => one.primary === true);
|
|
9
|
+
const rest = actions.filter((one) => one !== primary);
|
|
10
|
+
const danger = rest.filter((one) => one.danger === true);
|
|
11
|
+
const candidates = rest.filter((one) => one.danger !== true && one.tucked !== true);
|
|
12
|
+
const shown = candidates.slice(0, Math.max(0, visible));
|
|
13
|
+
const more = rest.filter((one) => one.danger !== true && !shown.includes(one));
|
|
14
|
+
/* One action alone in «Más» is drawn instead of the menu — unless it was tucked on purpose
|
|
15
|
+
or something destructive shares the menu with it. */
|
|
16
|
+
if (more.length === 1 && danger.length === 0 && more[0].tucked !== true) {
|
|
17
|
+
return { primary, shown: [...shown, more[0]], more: [], danger };
|
|
18
|
+
}
|
|
19
|
+
return { primary, shown, more, danger };
|
|
20
|
+
}
|
|
21
|
+
/** An action as a menu row — its sub-actions as a submenu, its shortcut drawn for this
|
|
22
|
+
* keyboard. */
|
|
23
|
+
export function dockOption(action, label = (keys) => keys) {
|
|
24
|
+
return {
|
|
25
|
+
id: action.id,
|
|
26
|
+
label: action.label,
|
|
27
|
+
...(action.icon === undefined ? {} : { icon: action.icon }),
|
|
28
|
+
...(action.hint === undefined ? {} : { hint: action.hint }),
|
|
29
|
+
...(action.shortcut === undefined ? {} : { shortcut: label(action.shortcut) }),
|
|
30
|
+
...(action.disabled === undefined ? {} : { disabled: action.disabled }),
|
|
31
|
+
...(action.danger === true ? { danger: true } : {}),
|
|
32
|
+
...(action.onSelect === undefined ? {} : { onSelect: action.onSelect }),
|
|
33
|
+
...(action.items === undefined
|
|
34
|
+
? {}
|
|
35
|
+
: { items: action.items.map((one) => dockOption(one, label)) }),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** «Más» as menu groups: the rest, then the destructive ones apart. */
|
|
39
|
+
export function moreGroups(plan, label) {
|
|
40
|
+
const option = (one) => dockOption(one, label);
|
|
41
|
+
return [
|
|
42
|
+
...(plan.more.length === 0 ? [] : [{ options: plan.more.map(option) }]),
|
|
43
|
+
...(plan.danger.length === 0 ? [] : [{ options: plan.danger.map(option) }]),
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The combinations a dock answers: every action with a `shortcut` — sub-actions and what waits
|
|
48
|
+
* in «Más» included, a shortcut is how one reaches what is not in sight. None while there are
|
|
49
|
+
* changes: the actions are not there, and Save answers Mod+S itself (`DirtyActions`).
|
|
50
|
+
*/
|
|
51
|
+
export function dockShortcuts(actions, dirty = false) {
|
|
52
|
+
if (dirty)
|
|
53
|
+
return [];
|
|
54
|
+
const all = (list) => list.flatMap((one) => [one, ...(one.items === undefined ? [] : all(one.items))]);
|
|
55
|
+
return all(actions).flatMap((one) => one.shortcut === undefined || one.onSelect === undefined
|
|
56
|
+
? []
|
|
57
|
+
: [{ keys: one.shortcut, run: one.onSelect, enabled: one.disabled !== true }]);
|
|
58
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
export { ActionDock, type ActionDockProps, type DockLook, type DockPlacement, type RecordDockPlacement, type RecordDockProps, } from "./ActionDock.js";
|
|
1
2
|
export { Breadcrumb, type Crumb } from "./Breadcrumb.js";
|
|
2
3
|
export { DirtyActions, type DirtyState, } from "./DirtyActions.js";
|
|
4
|
+
export { type DockAction, dockOption, type DockPlan, dockPlan, moreGroups, } from "./dock.js";
|
|
3
5
|
export { Pager } from "./Pager.js";
|
|
4
6
|
export { RecordAudit, type RecordStamp } from "./RecordAudit.js";
|
|
5
7
|
export { RecordRibbon } from "./RecordRibbon.js";
|
|
6
8
|
export { RecordSkeleton } from "./RecordSkeleton.js";
|
|
7
9
|
export { SmartButton, SmartButtons } from "./SmartButtons.js";
|
|
8
|
-
export { type Stage, StatusBar } from "./StatusBar.js";
|
|
10
|
+
export { type Stage, type StageState, StatusBar, type StatusDisplay, type StatusLook, } from "./StatusBar.js";
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
/* RECORD PARTS — the header, status bar, pager and skeleton of one record. The `Record` view
|
|
2
2
|
composes them. */
|
|
3
|
+
/* The actions FLOATING, as data: what is seen and what waits in «Más» is
|
|
4
|
+
decided by `dockPlan`. */
|
|
5
|
+
export { ActionDock, } from "./ActionDock.js";
|
|
3
6
|
export { Breadcrumb } from "./Breadcrumb.js";
|
|
4
7
|
export { DirtyActions, } from "./DirtyActions.js";
|
|
8
|
+
export { dockOption, dockPlan, moreGroups, } from "./dock.js";
|
|
5
9
|
export { Pager } from "./Pager.js";
|
|
6
10
|
export { RecordAudit } from "./RecordAudit.js";
|
|
7
11
|
export { RecordRibbon } from "./RecordRibbon.js";
|
|
8
12
|
export { RecordSkeleton } from "./RecordSkeleton.js";
|
|
9
13
|
export { SmartButton, SmartButtons } from "./SmartButtons.js";
|
|
10
|
-
export { StatusBar } from "./StatusBar.js";
|
|
14
|
+
export { StatusBar, } from "./StatusBar.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ValueEditor } from "./context.js";
|
|
2
2
|
import type { BuiltFilter } from "./criteria.js";
|
|
3
3
|
import { type ModelDefinition } from "./model.js";
|
|
4
|
-
import type { SearchRecords } from "./records.js";
|
|
4
|
+
import type { BrowseRecords, SearchRecords } from "./records.js";
|
|
5
5
|
export interface BuiltSort {
|
|
6
6
|
field: string;
|
|
7
7
|
descending?: boolean;
|
|
@@ -55,13 +55,16 @@ export interface BuiltCriteria {
|
|
|
55
55
|
grouping?: BuiltGrouping;
|
|
56
56
|
specification?: Record<string, Record<string, never>>;
|
|
57
57
|
}
|
|
58
|
-
export declare function CriteriaBuilder({ model, initial, focus, onApply, onCancel, searchRecords: ownSearchRecords, valueEditor: ownValueEditor, }: {
|
|
58
|
+
export declare function CriteriaBuilder({ model, initial, focus, onApply, onCancel, searchRecords: ownSearchRecords, browseRecords: ownBrowseRecords, valueEditor: ownValueEditor, }: {
|
|
59
59
|
model: ModelDefinition;
|
|
60
60
|
/** The criteria that was already set. Reopening has to continue where it was left. */
|
|
61
61
|
initial?: BuiltCriteria;
|
|
62
62
|
/** Searches the records of a relation: a rule can then be about a relation itself, its
|
|
63
63
|
* records picked by name (see `records.ts`). Absent, the `SearchProvider`'s. */
|
|
64
64
|
searchRecords?: SearchRecords;
|
|
65
|
+
/** «Buscar más…» under a relation's records: the application's chooser. Absent, the
|
|
66
|
+
* provider's. */
|
|
67
|
+
browseRecords?: BrowseRecords;
|
|
65
68
|
/** The application's own value controls (see `ValueEditor`). Absent, the provider's. */
|
|
66
69
|
valueEditor?: ValueEditor;
|
|
67
70
|
/**
|
|
@@ -72,10 +72,11 @@ function nextGrain(grain) {
|
|
|
72
72
|
const at = GRAINS.indexOf(grain ?? null);
|
|
73
73
|
return GRAINS[(at + 1) % GRAINS.length] ?? null;
|
|
74
74
|
}
|
|
75
|
-
export function CriteriaBuilder({ model, initial, focus, onApply, onCancel, searchRecords: ownSearchRecords, valueEditor: ownValueEditor, }) {
|
|
75
|
+
export function CriteriaBuilder({ model, initial, focus, onApply, onCancel, searchRecords: ownSearchRecords, browseRecords: ownBrowseRecords, valueEditor: ownValueEditor, }) {
|
|
76
76
|
const surface = useSurface();
|
|
77
77
|
const settings = useSearchSettings({
|
|
78
78
|
...(ownSearchRecords === undefined ? {} : { searchRecords: ownSearchRecords }),
|
|
79
|
+
...(ownBrowseRecords === undefined ? {} : { browseRecords: ownBrowseRecords }),
|
|
79
80
|
...(ownValueEditor === undefined ? {} : { valueEditor: ownValueEditor }),
|
|
80
81
|
});
|
|
81
82
|
/* A filter read back carries keys; with records searchable, the rules about records are
|
|
@@ -126,7 +126,7 @@ function Levels({ models, start, canChoose, canFollow, onChoose, }) {
|
|
|
126
126
|
const offerSelf = relationField !== undefined &&
|
|
127
127
|
relationName !== undefined &&
|
|
128
128
|
canChoose(relationField, relationName, at.slice(0, -1));
|
|
129
|
-
const
|
|
129
|
+
const listed = level.status !== "ready"
|
|
130
130
|
? []
|
|
131
131
|
: Object.entries(level.model.fields)
|
|
132
132
|
.map(([name, field]) => ({
|
|
@@ -136,12 +136,21 @@ function Levels({ models, start, canChoose, canFollow, onChoose, }) {
|
|
|
136
136
|
choose: canChoose(field, name, at),
|
|
137
137
|
follow: canFollow(field, name, at),
|
|
138
138
|
}))
|
|
139
|
-
.filter((row) => row.choose || row.follow)
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
139
|
+
.filter((row) => row.choose || row.follow);
|
|
140
|
+
/* The column that identifies a to-one relation —its foreign key, «País» next to «País ›»—
|
|
141
|
+
is the same question with two rows, and the bare one asks for a key nobody knows. While
|
|
142
|
+
the relation itself is listed, its column is not. */
|
|
143
|
+
const naming = new Set(listed
|
|
144
|
+
.filter((row) => isRelation(row.field) && row.field.many !== true)
|
|
145
|
+
.map((row) => row.field.identifiedBy)
|
|
146
|
+
.filter((one) => one !== null && one !== undefined));
|
|
147
|
+
const rows = listed
|
|
148
|
+
.filter((row) => !naming.has(row.name))
|
|
149
|
+
.filter((row) => {
|
|
150
|
+
const q = fold(query.trim());
|
|
151
|
+
return q === "" || fold(row.label).includes(q) || fold(row.name).includes(q);
|
|
152
|
+
})
|
|
153
|
+
.sort((a, b) => a.label.localeCompare(b.label, copy.locale));
|
|
145
154
|
return (_jsxs("div", { onKeyDown: onKeyDown, className: "flex min-w-0 flex-col gap-2", children: [at.length === 0 ? null : (_jsxs("div", { className: "flex min-w-0 items-center gap-1", children: [_jsx(IconButton, { icon: ChevronLeft, label: copy.fieldPath.back, onClick: back }), _jsx("p", { className: "min-w-0 flex-1 truncate text-meta font-medium text-ink", children: here })] })), _jsx(SearchField, { value: query, onChange: setQuery, "aria-label": copy.fieldPath.search, placeholder: copy.fieldPath.search }), level.status === "loading" ? (_jsx(Skeleton, { rows: 4, label: copy.fieldPath.loading })) : level.status === "failed" ? (_jsx(Failed, { heading: copy.fieldPath.failed, sentence: copy.fieldPath.failedHint, detail: `${at.join(".") || "/"} — ${level.error}`, action: _jsx(Button, { role: "secondary", size: "sm", onClick: () => setAttempt((n) => n + 1), children: copy.attachments.retry }) })) : rows.length === 0 && !offerSelf ? (_jsx("p", { className: "px-2 py-3 text-meta text-muted", children: copy.fieldPath.empty })) : (_jsxs(ListBox, { "aria-label": at.length === 0 ? copy.fieldPath.search : here, className: "max-h-72 min-w-0 overflow-auto outline-0", onAction: (key) => {
|
|
146
155
|
const name = String(key);
|
|
147
156
|
if (name === SELF)
|
|
@@ -2,7 +2,7 @@ import { type ValueEditor } from "./context.js";
|
|
|
2
2
|
import type { BuiltFilter, CriteriaJoin, RecordKey, RecordOption, ThroughMatch } from "./criteria.js";
|
|
3
3
|
import { type ModelDefinition } from "./model.js";
|
|
4
4
|
import { type LoadModel, type ModelCache } from "./paths.js";
|
|
5
|
-
import { type RecordTarget, type SearchRecords } from "./records.js";
|
|
5
|
+
import { type BrowseRecords, type RecordTarget, type SearchRecords } from "./records.js";
|
|
6
6
|
/** Whether this is one of the shapes the filter recognises — condition, or `all`/`any`/
|
|
7
7
|
* `negate` group. A valid JSON that is none of these —`{}`, `{"foo": 1}`, a loose array—
|
|
8
8
|
* is not a filter this component knows how to draw, and is treated as a shape error instead of
|
|
@@ -102,7 +102,10 @@ export declare function recordOps(target: RecordTarget): string[];
|
|
|
102
102
|
* Only on the record's own fields: a relation of a related record needs its model, and a row
|
|
103
103
|
* that stays a plain condition still filters the same.
|
|
104
104
|
*/
|
|
105
|
-
export declare function liftRecords(node: TreeNode, model: ModelDefinition
|
|
105
|
+
export declare function liftRecords(node: TreeNode, model: ModelDefinition,
|
|
106
|
+
/** The model at the end of a path of relations, when it already arrived: with it, a rule
|
|
107
|
+
* about records past a relation —«Cliente > País es Bolivia»— is recognised too. */
|
|
108
|
+
modelAt?: (path: readonly string[]) => ModelDefinition | undefined): TreeNode;
|
|
106
109
|
/** The names of the records a tree has chosen, by relation and key: what says them in a
|
|
107
110
|
* sentence (`describeFilter`) once the tree is applied. */
|
|
108
111
|
export declare function namesOf(node: TreeNode): RecordNames;
|
|
@@ -159,7 +162,7 @@ export declare function ExpressionView({ node, model, depth, modelAt, at, }: {
|
|
|
159
162
|
/** The path up to here (through the outer `through`s). */
|
|
160
163
|
at?: readonly string[];
|
|
161
164
|
}): import("react").JSX.Element;
|
|
162
|
-
export declare function SelectionTree({ model, group, onChange, depth, focus, loadModel, models: shared, searchRecords: ownSearchRecords, valueEditor: ownValueEditor, }: {
|
|
165
|
+
export declare function SelectionTree({ model, group, onChange, depth, focus, loadModel, models: shared, searchRecords: ownSearchRecords, browseRecords: ownBrowseRecords, valueEditor: ownValueEditor, }: {
|
|
163
166
|
model: ModelDefinition;
|
|
164
167
|
group: TreeGroup;
|
|
165
168
|
onChange: (next: TreeGroup) => void;
|
|
@@ -167,6 +170,9 @@ export declare function SelectionTree({ model, group, onChange, depth, focus, lo
|
|
|
167
170
|
/** Searches the records of a relation: with it a rule can be about a relation ITSELF,
|
|
168
171
|
* its records picked by name (see `records.ts`). Absent, the `SearchProvider`'s. */
|
|
169
172
|
searchRecords?: SearchRecords;
|
|
173
|
+
/** «Buscar más…» under a relation's records: the application's chooser. Absent, the
|
|
174
|
+
* provider's. */
|
|
175
|
+
browseRecords?: BrowseRecords;
|
|
170
176
|
/** The application's own value controls (see `ValueEditor`). Absent, the provider's. */
|
|
171
177
|
valueEditor?: ValueEditor;
|
|
172
178
|
/**
|
|
@@ -194,7 +200,7 @@ export declare function SelectionTree({ model, group, onChange, depth, focus, lo
|
|
|
194
200
|
/** The model cache the rules share. The outer tree builds it. */
|
|
195
201
|
models?: ModelCache;
|
|
196
202
|
}): import("react").JSX.Element;
|
|
197
|
-
export declare function FilterBuilder({ model, initial, onApply, onCancel, loadModel, models: shared, searchRecords: ownSearchRecords, valueEditor: ownValueEditor, }: {
|
|
203
|
+
export declare function FilterBuilder({ model, initial, onApply, onCancel, loadModel, models: shared, searchRecords: ownSearchRecords, browseRecords: ownBrowseRecords, valueEditor: ownValueEditor, }: {
|
|
198
204
|
model: ModelDefinition;
|
|
199
205
|
/** The model at the end of a path of relations. With this, a rule can ask about
|
|
200
206
|
* a field of a related record: «alguna línea con algún impuesto con monto > 10».
|
|
@@ -212,6 +218,9 @@ export declare function FilterBuilder({ model, initial, onApply, onCancel, loadM
|
|
|
212
218
|
onCancel?: () => void;
|
|
213
219
|
/** Searches the records of a relation (see `records.ts`). Absent, the `SearchProvider`'s. */
|
|
214
220
|
searchRecords?: SearchRecords;
|
|
221
|
+
/** «Buscar más…» under a relation's records: the application's chooser. Absent, the
|
|
222
|
+
* provider's. */
|
|
223
|
+
browseRecords?: BrowseRecords;
|
|
215
224
|
/** The application's own value controls (see `ValueEditor`). Absent, the provider's. */
|
|
216
225
|
valueEditor?: ValueEditor;
|
|
217
226
|
}): import("react").JSX.Element;
|