@sincpro/web-ui 2.6.0 → 2.8.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 CHANGED
@@ -267,7 +267,8 @@ of classes that change with the next refactor:
267
267
  The parts: `button`, `icon-button`, `control`, `popover`, `menu`, `menu.trigger`,
268
268
  `menu.section`, `menu.item`, `menu.fold`, `dialog`, `block`, `record-card`, `board.tile`,
269
269
  `board.stat`, `board.stat.value`, `activity.changes`, `file-list`, `file-list.file`, `metric`, `metric.detail`, `tag`, `tags.item`, `search`, `search.field`, `search.chip`,
270
- `search.panel`, `search.suggestions`, `search-entry`, `search-entry.keys`, `table`,
270
+ `search.panel`, `search.suggestions`, `search.suggestion`, `search.record`, `search.advanced`,
271
+ `search.keys`, `search-entry`, `search-entry.keys`, `table`,
271
272
  `table.head`, `topbar`, `topbar.brand`, `topbar.menus`, `topbar.actions`, `topbar.user`,
272
273
  `frame`, `frame.bar`, `frame.sidebar`, `frame.main`, `sidebar`, `sidebar.brand`,
273
274
  `sidebar.user`, `sidebar.search`, `sidebar.nav`, `sidebar.account`, `navigation`,
@@ -296,6 +297,63 @@ written out under it on the left, the control on the right —, every `FormSecti
296
297
  the rail. The layout (`stacked` / `horizontal`) is still the screen's: stacked, the help and the
297
298
  control go under the label. Without the provider nothing changes.
298
299
 
300
+ #### Searching the records of a relation — and extending the search
301
+
302
+ Typing «andres» in the bar offers «Cliente con «andres» ▸», and the ▸ (or →) unfolds the
303
+ CLIENTS that match — the way Odoo's «Search Contact for: …» does. Choosing one filters by that
304
+ record: what travels is its key, what reads is its name («Cliente: Andrés Pérez»), and a second
305
+ one lands in the same chip («… o Andrés Gutiérrez», sent as `in`). An enum unfolds into its
306
+ words («Pagada», sent as `paid`), and the builder asks the same way: «Cliente es [Andrés Pérez]»
307
+ with a picker, «está en» with tags, «está vacío» with nothing.
308
+
309
+ web-ui does not know where the records live. The application gives **one** search, by prop or
310
+ once for the whole app — web-framework wires it to the relation's literal search, the one a
311
+ many2one already asks:
312
+
313
+ ```tsx
314
+ const searchRecords: SearchRecords = ({ relation, path, text, keys, signal }) =>
315
+ keys !== undefined
316
+ ? api.names(relation, keys, { signal }) // name what a filter read back carries
317
+ : api.literalSearch(relation, text, { limit: 8, signal }); // what was typed
318
+
319
+ <SearchProvider
320
+ searchRecords={searchRecords}
321
+ browseRecords={(browse) => openChooser(browse)} // your list in choosing mode, its own bar
322
+ valueEditor={myValueEditor}
323
+ >
324
+ <App /> {/* every SearchBar, FilterBuilder and CriteriaBuilder inside */}
325
+ </SearchProvider>;
326
+ ```
327
+
328
+ `RecordOption.id` is what the relation compares: for a many2one, what its identifying column
329
+ (`identifiedBy`, its foreign key) holds; for a to-many relation, the key of the record on the
330
+ other side (`relationKey`, `id` by default) — the filter crosses it with `through`. An enum's
331
+ words come from `translations.choices`.
332
+
333
+ A path is walked the same way: in «Cliente › País» the first option is «País (el registro)» —
334
+ the rule then asks for COUNTRIES, picked by name— above País's own fields, for when the
335
+ question is about a field («Código empieza con B»). «Buscar más…» opens your chooser: another
336
+ context, the relation's whole list with its own search bar (which unfolds relations too).
337
+
338
+ Who does what: web-ui draws and notifies; **web-framework** wires `searchRecords` to the
339
+ entity's literal search, `browseRecords` to the entity's list in choosing mode and `loadModel`
340
+ to the related meta — once, for every entity; composer decides where the chooser opens (a modal
341
+ over a page, beside a modal); the application only overrides what it wants.
342
+
343
+ What can be extended, and how:
344
+
345
+ | You want | Use |
346
+ | ------------------------------------------------ | -------------------------------------------------------------------------------------------- |
347
+ | The records of a relation, from your server | `searchRecords` (prop, or `SearchProvider` once) |
348
+ | A record drawn your way in the dropdown | `SearchBar renderRecord` |
349
+ | «Buscar más…» under the records: your chooser | `browseRecords` (prop or `SearchProvider`), bar and builder; answer with `choose` |
350
+ | A field's value drawn your way in the builder | `valueEditor` (prop or `SearchProvider`): answer `undefined` to keep ours |
351
+ | A list that opens filtered (defaults, a link) | `queryField` + `valuesCriteria` / `conditionCriteria` / `toggleNamed` |
352
+ | One more value into a chip, by code | `withValue(criteria, field, record)` |
353
+ | The filter said with names, for your own chip | `describeFilter(selection, model, modelAt, names)`, `FilterBuilder onApply(selection, said)` |
354
+ | Your own builder | `SelectionTree`, `RuleValue`, `liftRecords`, `recordsFilter`, `recordOps` |
355
+ | The words of an operator («no está establecido») | the copy table: `ops` |
356
+
299
357
  #### A guided tour: the screen says what each thing is
300
358
 
301
359
  `Guide` walks a person through a screen: the rest dims, the thing being explained is cut out,
@@ -1,5 +1,7 @@
1
+ import { type ValueEditor } from "./context.js";
1
2
  import type { BuiltFilter } from "./criteria.js";
2
3
  import { type ModelDefinition } from "./model.js";
4
+ import type { BrowseRecords, SearchRecords } from "./records.js";
3
5
  export interface BuiltSort {
4
6
  field: string;
5
7
  descending?: boolean;
@@ -53,10 +55,18 @@ export interface BuiltCriteria {
53
55
  grouping?: BuiltGrouping;
54
56
  specification?: Record<string, Record<string, never>>;
55
57
  }
56
- export declare function CriteriaBuilder({ model, initial, focus, onApply, onCancel, }: {
58
+ export declare function CriteriaBuilder({ model, initial, focus, onApply, onCancel, searchRecords: ownSearchRecords, browseRecords: ownBrowseRecords, valueEditor: ownValueEditor, }: {
57
59
  model: ModelDefinition;
58
60
  /** The criteria that was already set. Reopening has to continue where it was left. */
59
61
  initial?: BuiltCriteria;
62
+ /** Searches the records of a relation: a rule can then be about a relation itself, its
63
+ * records picked by name (see `records.ts`). Absent, the `SearchProvider`'s. */
64
+ searchRecords?: SearchRecords;
65
+ /** «Buscar más…» under a relation's records: the application's chooser. Absent, the
66
+ * provider's. */
67
+ browseRecords?: BrowseRecords;
68
+ /** The application's own value controls (see `ValueEditor`). Absent, the provider's. */
69
+ valueEditor?: ValueEditor;
60
70
  /**
61
71
  * The condition's field to show first: the chip somebody
62
72
  * touched in the bar.
@@ -66,6 +76,8 @@ export declare function CriteriaBuilder({ model, initial, focus, onApply, onCanc
66
76
  * edit the wrong one.
67
77
  */
68
78
  focus?: string;
69
- onApply: (criteria: BuiltCriteria | undefined) => void;
79
+ /** The criteria applied, and how its filter reads —with the names of the records chosen—
80
+ * for the chip that shows it. */
81
+ onApply: (criteria: BuiltCriteria | undefined, said?: string) => void;
70
82
  onCancel?: () => void;
71
83
  }): import("react").JSX.Element;
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { blankGroup, ExpressionView, SelectionTree, treeFromFilter, treeToFilter, } from "./FilterBuilder.js";
3
+ import { useSearchSettings, } from "./context.js";
4
+ import { blankGroup, describeFilter, ExpressionView, liftRecords, namesOf, SelectionTree, treeFromFilter, treeToFilter, useRecordNames, } from "./FilterBuilder.js";
4
5
  import { LazyJsonEditor } from "./LazyJsonEditor.js";
5
6
  import { filterableNames, } from "./model.js";
6
7
  import { fillCopy, useUiCopy } from "../../foundations/copy.js";
@@ -71,14 +72,27 @@ function nextGrain(grain) {
71
72
  const at = GRAINS.indexOf(grain ?? null);
72
73
  return GRAINS[(at + 1) % GRAINS.length] ?? null;
73
74
  }
74
- export function CriteriaBuilder({ model, initial, focus, onApply, onCancel, }) {
75
+ export function CriteriaBuilder({ model, initial, focus, onApply, onCancel, searchRecords: ownSearchRecords, browseRecords: ownBrowseRecords, valueEditor: ownValueEditor, }) {
75
76
  const surface = useSurface();
77
+ const settings = useSearchSettings({
78
+ ...(ownSearchRecords === undefined ? {} : { searchRecords: ownSearchRecords }),
79
+ ...(ownBrowseRecords === undefined ? {} : { browseRecords: ownBrowseRecords }),
80
+ ...(ownValueEditor === undefined ? {} : { valueEditor: ownValueEditor }),
81
+ });
82
+ /* A filter read back carries keys; with records searchable, the rules about records are
83
+ drawn as such again — by name. */
84
+ const read = (filter) => {
85
+ const node = treeFromFilter(filter);
86
+ return node === null || settings.searchRecords === undefined
87
+ ? node
88
+ : liftRecords(node, model);
89
+ };
76
90
  const names = Object.keys(model.fields).sort();
77
91
  /* Never a relational nor a value-object: neither has a comparison of its own
78
92
  (empty `ops`), so neither serves as a target for a filter, an order or a level. */
79
93
  const scalarNames = filterableNames(model);
80
94
  const sortable = names.filter((name) => model.fields[name]?.sortable === true);
81
- const decomposed = initial?.selection === undefined ? null : treeFromFilter(initial.selection);
95
+ const decomposed = initial?.selection === undefined ? null : read(initial.selection);
82
96
  const [tree, setTree] = useState(() => decomposed !== null && decomposed.kind === "group"
83
97
  ? decomposed
84
98
  : decomposed !== null
@@ -110,6 +124,7 @@ export function CriteriaBuilder({ model, initial, focus, onApply, onCancel, }) {
110
124
  const [fields, setFields] = useState(Object.keys(initial?.specification ?? {}));
111
125
  const [rawText, setRawText] = useState(() => initial === undefined ? "" : JSON.stringify(initial, null, 2));
112
126
  const [rawError, setRawError] = useState(null);
127
+ useRecordNames(tree, settings.searchRecords, (named) => setTree((current) => named(current)));
113
128
  /** What the controls say, together: it is what is applied and what the JSON shows. */
114
129
  function assemble(next) {
115
130
  const selection = next.locked ?? lockedSelection ?? treeToFilter(next.tree ?? tree);
@@ -187,7 +202,7 @@ export function CriteriaBuilder({ model, initial, focus, onApply, onCancel, }) {
187
202
  return;
188
203
  }
189
204
  setRawError(null);
190
- const node = parsed.selection === undefined ? null : treeFromFilter(parsed.selection);
205
+ const node = parsed.selection === undefined ? null : read(parsed.selection);
191
206
  if (node !== null) {
192
207
  setTree(node.kind === "group" ? node : { kind: "group", join: "all", children: [node] });
193
208
  setLockedSelection(null);
@@ -211,7 +226,7 @@ export function CriteriaBuilder({ model, initial, focus, onApply, onCancel, }) {
211
226
  ? "border-chrome-ink/20 bg-chrome text-chrome-ink"
212
227
  : "border-ink/15 bg-surface text-ink";
213
228
  const select = `min-w-0 flex-1 basis-40 rounded-control border px-2 py-1 text-meta ${box}`;
214
- return (_jsxs("div", { className: "flex min-w-0 flex-col gap-3 p-3", children: [_jsxs("section", { className: "flex min-w-0 flex-col gap-2", children: [_jsx(Rule, { label: copy.builder.filter }), _jsx("div", { className: "max-h-72 min-w-0 overflow-auto", children: lockedSelection !== null ? (_jsxs(_Fragment, { children: [_jsx("p", { className: "mb-2 text-meta text-muted", children: copy.search.unreadable }), _jsx(ExpressionView, { node: lockedSelection, model: model })] })) : (_jsx(SelectionTree, { model: model, group: tree, onChange: (next) => push({ tree: next }), ...(focus === undefined ? {} : { focus }) })) })] }), _jsxs("section", { className: "flex min-w-0 flex-col gap-2", children: [_jsx(Rule, { label: copy.builder.order }), _jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-1", children: [_jsx(Tags, { items: order.map((sort, index) => ({
229
+ return (_jsxs("div", { className: "flex min-w-0 flex-col gap-3 p-3", children: [_jsxs("section", { className: "flex min-w-0 flex-col gap-2", children: [_jsx(Rule, { label: copy.builder.filter }), _jsx("div", { className: "max-h-72 min-w-0 overflow-auto", children: lockedSelection !== null ? (_jsxs(_Fragment, { children: [_jsx("p", { className: "mb-2 text-meta text-muted", children: copy.search.unreadable }), _jsx(ExpressionView, { node: lockedSelection, model: model })] })) : (_jsx(SelectionTree, { model: model, group: tree, onChange: (next) => push({ tree: next }), ...settings, ...(focus === undefined ? {} : { focus }) })) })] }), _jsxs("section", { className: "flex min-w-0 flex-col gap-2", children: [_jsx(Rule, { label: copy.builder.order }), _jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-1", children: [_jsx(Tags, { items: order.map((sort, index) => ({
215
230
  id: `${sort.field}-${index}`,
216
231
  label: sort.field,
217
232
  note: sort.descending === true ? "↓" : "↑",
@@ -285,5 +300,10 @@ export function CriteriaBuilder({ model, initial, focus, onApply, onCancel, }) {
285
300
  return (_jsx("button", { type: "button", onClick: () => push({
286
301
  fields: chosen ? fields.filter((one) => one !== name) : [...fields, name],
287
302
  }), className: `rounded-pill border px-2 py-0.5 text-micro ${chosen ? chosenTone("canvas") : `text-muted ${box}`}`, children: name }, name));
288
- }) })] }), _jsx(LazyJsonEditor, { value: rawText, onChange: updateRaw, error: rawError, height: "14rem", label: copy.builder.json }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { role: "primary", disabled: rawError !== null, onClick: () => onApply(rawText.trim() === "" ? undefined : JSON.parse(rawText)), children: copy.builder.apply }), onCancel === undefined ? null : (_jsx(Button, { role: "ghost", onClick: onCancel, children: copy.builder.cancel }))] })] }));
303
+ }) })] }), _jsx(LazyJsonEditor, { value: rawText, onChange: updateRaw, error: rawError, height: "14rem", label: copy.builder.json }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { role: "primary", disabled: rawError !== null, onClick: () => {
304
+ const built = rawText.trim() === "" ? undefined : JSON.parse(rawText);
305
+ onApply(built, built?.selection === undefined
306
+ ? undefined
307
+ : describeFilter(built.selection, model, undefined, namesOf(tree)));
308
+ }, children: copy.builder.apply }), onCancel === undefined ? null : (_jsx(Button, { role: "ghost", onClick: onCancel, children: copy.builder.cancel }))] })] }));
289
309
  }
@@ -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 rows = level.status !== "ready"
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
- .filter((row) => {
141
- const q = fold(query.trim());
142
- return q === "" || fold(row.label).includes(q) || fold(row.name).includes(q);
143
- })
144
- .sort((a, b) => a.label.localeCompare(b.label, copy.locale));
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)
@@ -1,6 +1,8 @@
1
- import type { BuiltFilter, CriteriaJoin, ThroughMatch } from "./criteria.js";
1
+ import { type ValueEditor } from "./context.js";
2
+ import type { BuiltFilter, CriteriaJoin, RecordKey, RecordOption, ThroughMatch } from "./criteria.js";
2
3
  import { type ModelDefinition } from "./model.js";
3
4
  import { type LoadModel, type ModelCache } from "./paths.js";
5
+ import { type BrowseRecords, type RecordTarget, type SearchRecords } from "./records.js";
4
6
  /** Whether this is one of the shapes the filter recognises — condition, or `all`/`any`/
5
7
  * `negate` group. A valid JSON that is none of these —`{}`, `{"foo": 1}`, a loose array—
6
8
  * is not a filter this component knows how to draw, and is treated as a shape error instead of
@@ -27,6 +29,16 @@ export interface TreeCondition {
27
29
  /** The other end, for the operators that compare against two —today `between`—. Empty in
28
30
  * all the others, where it means nothing. */
29
31
  upper?: string;
32
+ /** The value as it travels when it is not the text: `true`, `7`, a list read back — kept so
33
+ * a rule read from a filter goes back out the same, not as the string it is drawn with.
34
+ * Writing in the box drops it: what is written is then the value. */
35
+ raw?: unknown;
36
+ /** The values CHOSEN, with the names they are read by — records of a relation, words of an
37
+ * enum, «está en» a list. What travels is their `id`. */
38
+ values?: RecordOption[];
39
+ /** The rule asks about RECORDS of a relation: `field` is the relation itself, chosen by
40
+ * name and compared by key (`recordsFilter`). */
41
+ target?: RecordTarget;
30
42
  }
31
43
  export interface TreeGroup {
32
44
  kind: "group";
@@ -70,6 +82,39 @@ export declare function treeToFilter(node: TreeNode): BuiltFilter | undefined;
70
82
  * shows it read-only while still letting you touch it as JSON.
71
83
  */
72
84
  export declare function treeFromFilter(filter: unknown): TreeNode | null;
85
+ /** The operators a rule about records offers: one record or several, in or out — and, through
86
+ * a column that admits it, «está vacío». A to-many relation is asked by some of its records
87
+ * or none of them. */
88
+ export declare function recordOps(target: RecordTarget): string[];
89
+ /**
90
+ * The rules about RECORDS of a relation, recognised again in a tree read back.
91
+ *
92
+ * A filter carries keys, never which relation they were chosen from: `customer_id in [7, 9]`
93
+ * is, for the tree, a column compared to two numbers. The model says that `customer_id` is
94
+ * how «Cliente» is compared, so the row is drawn as «Cliente es alguno de [Andrés Pérez,
95
+ * Andrés Gutiérrez]» — the names asked of `searchRecords` by key. The same for a to-many
96
+ * crossed to its key: `{through: "tags", selection: {field: "id", operator: "in", …}}` is
97
+ * «Etiquetas es alguno de …».
98
+ *
99
+ * in {field: "customer_id", operator: "in", value: [7, 9]} (customer_id names Cliente)
100
+ * out {field: "customer", target: Cliente, operator: "in", values: [#7, #9]}
101
+ *
102
+ * Only on the record's own fields: a relation of a related record needs its model, and a row
103
+ * that stays a plain condition still filters the same.
104
+ */
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;
109
+ /** The names of the records a tree has chosen, by relation and key: what says them in a
110
+ * sentence (`describeFilter`) once the tree is applied. */
111
+ export declare function namesOf(node: TreeNode): RecordNames;
112
+ /**
113
+ * Names the records a tree read back carries only by key — ONE question per relation, for the
114
+ * whole tree. Per row, five rows answered at five moments and each wrote its answer over a tree
115
+ * that no longer had the others'. Until it answers, a record reads «#7».
116
+ */
117
+ export declare function useRecordNames(tree: TreeNode, searchRecords: SearchRecords | undefined, apply: (named: (tree: TreeNode) => TreeNode) => void): void;
73
118
  /** The filter said in one line, for a chip or a label.
74
119
  *
75
120
  * in {field: "row_count", operator: ">", value: 1000}, with the model
@@ -95,7 +140,12 @@ export declare function treeFromFilter(filter: unknown): TreeNode | null;
95
140
  export declare function describeFilter(node: BuiltFilter, model?: ModelDefinition,
96
141
  /** The model at the end of a path of relations, when it already arrived: it names the
97
142
  * fields of a `through`. Without it they keep their raw names. */
98
- modelAt?: (path: readonly string[]) => ModelDefinition | undefined): string;
143
+ modelAt?: (path: readonly string[]) => ModelDefinition | undefined,
144
+ /** The names of the records a filter asks for, by relation and key: «Cliente es Andrés
145
+ * Pérez» instead of «customer_id es 7». The builder hands its own (`namesOf`). */
146
+ names?: RecordNames): string;
147
+ /** A record's name by the relation it was chosen from and its key, when it is known. */
148
+ export type RecordNames = (relation: string, key: RecordKey) => string | undefined;
99
149
  /** The filter drawn as it is, recursive: a condition is a line, `all`/`any` are a
100
150
  * group with its label and its children inside, `negate` is «no» wrapping the one it negates.
101
151
  *
@@ -112,11 +162,19 @@ export declare function ExpressionView({ node, model, depth, modelAt, at, }: {
112
162
  /** The path up to here (through the outer `through`s). */
113
163
  at?: readonly string[];
114
164
  }): import("react").JSX.Element;
115
- export declare function SelectionTree({ model, group, onChange, depth, focus, loadModel, models: shared, }: {
165
+ export declare function SelectionTree({ model, group, onChange, depth, focus, loadModel, models: shared, searchRecords: ownSearchRecords, browseRecords: ownBrowseRecords, valueEditor: ownValueEditor, }: {
116
166
  model: ModelDefinition;
117
167
  group: TreeGroup;
118
168
  onChange: (next: TreeGroup) => void;
119
169
  depth?: number;
170
+ /** Searches the records of a relation: with it a rule can be about a relation ITSELF,
171
+ * its records picked by name (see `records.ts`). Absent, the `SearchProvider`'s. */
172
+ searchRecords?: SearchRecords;
173
+ /** «Buscar más…» under a relation's records: the application's chooser. Absent, the
174
+ * provider's. */
175
+ browseRecords?: BrowseRecords;
176
+ /** The application's own value controls (see `ValueEditor`). Absent, the provider's. */
177
+ valueEditor?: ValueEditor;
120
178
  /**
121
179
  * The condition's field to show FIRST: the one somebody touched in
122
180
  * the bar.
@@ -142,7 +200,7 @@ export declare function SelectionTree({ model, group, onChange, depth, focus, lo
142
200
  /** The model cache the rules share. The outer tree builds it. */
143
201
  models?: ModelCache;
144
202
  }): import("react").JSX.Element;
145
- export declare function FilterBuilder({ model, initial, onApply, onCancel, loadModel, models: shared, }: {
203
+ export declare function FilterBuilder({ model, initial, onApply, onCancel, loadModel, models: shared, searchRecords: ownSearchRecords, browseRecords: ownBrowseRecords, valueEditor: ownValueEditor, }: {
146
204
  model: ModelDefinition;
147
205
  /** The model at the end of a path of relations. With this, a rule can ask about
148
206
  * a field of a related record: «alguna línea con algún impuesto con monto > 10».
@@ -154,6 +212,15 @@ export declare function FilterBuilder({ model, initial, onApply, onCancel, loadM
154
212
  /** The filter that was already set, if there was one. Reopening the builder with this inside
155
213
  * has to continue where it was left, not start blank. */
156
214
  initial?: BuiltFilter;
157
- onApply: (selection: BuiltFilter | undefined) => void;
215
+ /** The filter applied, and how it reads —with the names of the records chosen, «Cliente es
216
+ * Andrés Pérez»— for the chip that shows it. */
217
+ onApply: (selection: BuiltFilter | undefined, said?: string) => void;
158
218
  onCancel?: () => void;
219
+ /** Searches the records of a relation (see `records.ts`). Absent, the `SearchProvider`'s. */
220
+ searchRecords?: SearchRecords;
221
+ /** «Buscar más…» under a relation's records: the application's chooser. Absent, the
222
+ * provider's. */
223
+ browseRecords?: BrowseRecords;
224
+ /** The application's own value controls (see `ValueEditor`). Absent, the provider's. */
225
+ valueEditor?: ValueEditor;
159
226
  }): import("react").JSX.Element;