@sincpro/web-framework 3.19.0 → 3.21.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.
@@ -0,0 +1,43 @@
1
+ "use client";
2
+ import { listRoute } from "@sincpro/client-framework";
3
+ import { useFramework } from "./context.js";
4
+ import { useEffect, useState } from "react";
5
+ /**
6
+ * How many records each question keeps, asked together — a record's smart buttons («Sus pagos 4»,
7
+ * «Cuotas pendientes 2»), as many as the record has. `null` while it is asked, or when the server
8
+ * did not answer one.
9
+ *
10
+ * const [pagos, cuotas] = useCounts([
11
+ * { entity: pagos, where: { field: "colegiado_id", operator: "=", value: id } },
12
+ * { entity: cuotas, where: pendientesDe(id) },
13
+ * ]);
14
+ *
15
+ * Context: `useCount` is a listing of one, so a screen counted one question per hook — and a
16
+ * record's links, whose number and questions depend on the record, ended as hooks an application
17
+ * passed as data (`useEnlaces`). The questions here are data, read again when they or the
18
+ * process's context change.
19
+ */
20
+ export function useCounts(asked) {
21
+ const { transport, context } = useFramework();
22
+ // The questions by their content: a new array of the same questions asks nothing again.
23
+ const key = JSON.stringify(asked.map((one) => [listRoute(one.entity.list), one.where]));
24
+ const [counted, setCounted] = useState();
25
+ useEffect(() => {
26
+ const questions = JSON.parse(key);
27
+ if (questions.length === 0)
28
+ return;
29
+ let current = true;
30
+ void Promise.all(questions.map(([route, where]) => transport
31
+ .list(route, {
32
+ selection: where,
33
+ count: "exact",
34
+ pagination: { limit: 1 },
35
+ })
36
+ .then((page) => page.count?.value ?? null, () => null))).then((values) => {
37
+ if (current)
38
+ setCounted({ key, values });
39
+ });
40
+ return () => void (current = false);
41
+ }, [transport, key, context]);
42
+ return counted?.key === key ? counted.values : asked.map(() => null);
43
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The name of each person among `who`, by the application's port (`FrameworkProvider people`):
3
+ * every username asked at once, and asked again only when the set changes. A username nobody
4
+ * names — or every one, without the port — reads as itself.
5
+ *
6
+ * const nameOf = usePeopleOf(history.map((one) => one.by));
7
+ * nameOf("jperez") // "Juana Pérez", once the port answers
8
+ *
9
+ * Context: a record's history and authorship say who by username — the fact's `actor` —, and an
10
+ * application showed «jperez» or wrote its own hook to rename them on every screen (quipu's
11
+ * `usePorNombre`). Who is who is the application's to answer (its accounts are a bounded context
12
+ * of their own); asking it, once per screen, is the framework's.
13
+ */
14
+ export declare function usePeopleOf(who: readonly (string | null | undefined)[]): (who: string) => string;
@@ -0,0 +1,35 @@
1
+ "use client";
2
+ import { useFramework } from "./context.js";
3
+ import { useEffect, useState } from "react";
4
+ /**
5
+ * The name of each person among `who`, by the application's port (`FrameworkProvider people`):
6
+ * every username asked at once, and asked again only when the set changes. A username nobody
7
+ * names — or every one, without the port — reads as itself.
8
+ *
9
+ * const nameOf = usePeopleOf(history.map((one) => one.by));
10
+ * nameOf("jperez") // "Juana Pérez", once the port answers
11
+ *
12
+ * Context: a record's history and authorship say who by username — the fact's `actor` —, and an
13
+ * application showed «jperez» or wrote its own hook to rename them on every screen (quipu's
14
+ * `usePorNombre`). Who is who is the application's to answer (its accounts are a bounded context
15
+ * of their own); asking it, once per screen, is the framework's.
16
+ */
17
+ export function usePeopleOf(who) {
18
+ const { people, context } = useFramework();
19
+ const [named, setNamed] = useState({});
20
+ // The set as its content: a new array of the same people asks nothing again.
21
+ const asked = [...new Set(who.filter((one) => !!one))].sort().join("\n");
22
+ useEffect(() => {
23
+ if (people === undefined || asked === "")
24
+ return;
25
+ let current = true;
26
+ void people(asked.split("\n")).then((names) => {
27
+ if (current)
28
+ setNamed(names);
29
+ },
30
+ // Unnamed is no error: the username stays.
31
+ () => undefined);
32
+ return () => void (current = false);
33
+ }, [people, asked, context]);
34
+ return (one) => named[one] ?? one;
35
+ }
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { newEntityId, pathFor, retryKeys, startingValuesOf, TransportError, WITH_PARAM, } from "@sincpro/client-framework";
3
- import { changesOf, computedLocally, creationOf, defaultsOf, editedOf, errorsByField, fieldStateOf, lineStatesOf, missingOf, needsPreview, } from "../core/edit.js";
3
+ import { canCreate, changesOf, computedLocally, creationOf, defaultsOf, editedOf, errorsByField, fieldStateOf, lineStatesOf, missingOf, needsPreview, } from "../core/edit.js";
4
4
  import { linesAnswered } from "../core/lines.js";
5
5
  import { useFramework } from "./context.js";
6
6
  import { useWrites } from "./useWrites.js";
@@ -200,7 +200,7 @@ export function useRecord(entity, opened, options = {}) {
200
200
  // neither — every field of it is read only, whatever the model's hints say: an input nothing
201
201
  // can save is an invitation that lies.
202
202
  const writable = isNew
203
- ? byEdit || entity.create !== undefined
203
+ ? canCreate(entity, state.meta)
204
204
  : (entity.edit ?? entity.save) !== undefined;
205
205
  /** The record's key for a write: its own, or the one minted for it while it is new. */
206
206
  const keyNow = () => {
@@ -39,8 +39,8 @@ export { Refused } from "./Refused.js";
39
39
  export { RouteError, type RouteErrorProps } from "./RouteError.js";
40
40
  export { entityView, type EntityViewOptions, listView, type ListViewOptions, } from "./workspace/composer.js";
41
41
  export { openIn, openOptions, RECORD_SIZE, RelatedRecord, targetsFor, } from "./workspace/open.js";
42
- export { type Stamp, useRecordScreen } from "./workspace/record.js";
43
- export { EntityRecord, type ReadyRecord, RecordScreen, type RecordScreenProps, useScreenRecord, } from "./workspace/RecordScreen.js";
42
+ export { type RecordTag, type Stamp, useRecordScreen, } from "./workspace/record.js";
43
+ export { EntityRecord, type FieldDrawn, type ReadyRecord, RecordScreen, type RecordScreenProps, type RelatedLink, useRecordNotices, useScreenColumns, useScreenRecord, } from "./workspace/RecordScreen.js";
44
44
  export { SincproApp } from "./workspace/SincproApp.js";
45
45
  export { webUiSkin } from "./workspace/skin.js";
46
46
  export { chooserIn, useFollowed, useRecordInWorkspace, } from "./workspace/workspace.js";
package/dist/web/index.js CHANGED
@@ -39,8 +39,8 @@ export { Refused } from "./Refused.js";
39
39
  export { RouteError } from "./RouteError.js";
40
40
  export { entityView, listView, } from "./workspace/composer.js";
41
41
  export { openIn, openOptions, RECORD_SIZE, RelatedRecord, targetsFor, } from "./workspace/open.js";
42
- export { useRecordScreen } from "./workspace/record.js";
43
- export { EntityRecord, RecordScreen, useScreenRecord, } from "./workspace/RecordScreen.js";
42
+ export { useRecordScreen, } from "./workspace/record.js";
43
+ export { EntityRecord, RecordScreen, useRecordNotices, useScreenColumns, useScreenRecord, } from "./workspace/RecordScreen.js";
44
44
  export { SincproApp } from "./workspace/SincproApp.js";
45
45
  export { webUiSkin } from "./workspace/skin.js";
46
46
  export { chooserIn, useFollowed, useRecordInWorkspace, } from "./workspace/workspace.js";
@@ -30,7 +30,7 @@ export declare function useListOpening<T extends AnyRecord, C extends CommandBod
30
30
  choosing: boolean;
31
31
  choosingMany: boolean;
32
32
  embedded: boolean;
33
- create: boolean;
33
+ create: boolean | string;
34
34
  actions: ScreenActions | undefined;
35
35
  onOpen: ((row: T) => void) | undefined;
36
36
  onPeek: ((row: T) => void) | undefined;
@@ -2,9 +2,11 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { TRAIL_PARAM } from "@sincpro/client-framework";
4
4
  import { frameworkCopy } from "../../../core/copy.js";
5
+ import { canCreate } from "../../../core/edit.js";
5
6
  import { trailKeyOf } from "../../../core/trail.js";
6
7
  import { useFramework } from "../../../react/context.js";
7
8
  import { actionsOf } from "../dock.js";
9
+ import { useListExport } from "../export.js";
8
10
  import { OpenInMenu, openOptions, targetsFor } from "../openIn.js";
9
11
  import { Plus } from "lucide-react";
10
12
  import { useEffect, useId, useRef } from "react";
@@ -83,12 +85,14 @@ export function useListOpening({ listing, api, idOf, chosen, choosing, choosingM
83
85
  api !== undefined &&
84
86
  !choosing &&
85
87
  !embedded &&
86
- listing.entity.create !== undefined
88
+ canCreate(listing.entity, listing.meta)
87
89
  ? () => api.open(listing.entity.newRef())
88
90
  : undefined;
89
91
  // What the list starts, as data: «Nuevo» — the primary — and the screen's, drawn by the view
90
92
  // style (`List.Dock`). Actions drawn by hand stay in the bar, with «Nuevo» beside them.
91
93
  const started = actionsOf(actions);
94
+ // «Exportar», tucked: the list's question as a spreadsheet, when the entity declares its export.
95
+ const exporting = useListExport(listing, !embedded && !choosing);
92
96
  const startDock = started.drawn !== null
93
97
  ? []
94
98
  : [
@@ -97,13 +101,14 @@ export function useListOpening({ listing, api, idOf, chosen, choosing, choosingM
97
101
  : [
98
102
  {
99
103
  id: "create",
100
- label: frameworkCopy().record.create,
104
+ label: typeof create === "string" ? create : frameworkCopy().record.create,
101
105
  icon: Plus,
102
106
  primary: true,
103
107
  onSelect: creating,
104
108
  },
105
109
  ]),
106
110
  ...started.dock,
111
+ ...(exporting === null ? [] : [exporting]),
107
112
  ];
108
113
  const openingIn = onOpenIn ??
109
114
  (api === undefined
@@ -127,9 +127,10 @@ export type EntityListProps<T extends AnyRecord, C extends CommandBodies = Comma
127
127
  /**
128
128
  * With `api` and an entity that declares `create`, the bar offers «New», which opens the
129
129
  * record's form with no id (`entity.newRef()`). `false` hides it — a list of what only a
130
- * Command produces, or a caller who may not create.
130
+ * Command produces, or a caller who may not create. A text is its words, the business's way:
131
+ * `create="Nueva noticia"`.
131
132
  */
132
- create?: boolean;
133
+ create?: boolean | string;
133
134
  /**
134
135
  * The entity's Commands offered on each row («Confirmar»), sent with their idempotency key;
135
136
  * the list is read again when one is done (`useRowCommands`).
@@ -0,0 +1,13 @@
1
+ import { type AnyRecord } from "@sincpro/criteria";
2
+ import type { Listing } from "../../react/useListing.js";
3
+ import { type DockAction } from "@sincpro/web-ui";
4
+ /**
5
+ * «Exportar»: the list's records — its question on screen, filter and order, every page — as a
6
+ * spreadsheet (`core/export`), saved by the browser. Offered when the entity declares its export
7
+ * (`entity(…, { export: "/invoices/export" })`); `null` otherwise.
8
+ *
9
+ * Context: the server writes the export (JSON Lines, read as it streams: no page of the list is
10
+ * fetched to build it, so a million rows is the server's work, not the page's), and this writes
11
+ * what a person opens: the model's words as headers, the region's separator and decimal.
12
+ */
13
+ export declare function useListExport<T extends AnyRecord>(listing: Listing<T>, enabled: boolean): DockAction | null;
@@ -0,0 +1,61 @@
1
+ "use client";
2
+ import { downloadRoute, exportRoute } from "@sincpro/client-framework";
3
+ import { nameOf } from "@sincpro/criteria";
4
+ import { frameworkCopy } from "../../core/copy.js";
5
+ import { csvOf, exportColumnsOf } from "../../core/export.js";
6
+ import { useFramework } from "../../react/context.js";
7
+ import { refusalNotice } from "./records.js";
8
+ import { useToastIfAny } from "@sincpro/web-ui";
9
+ import { Download } from "lucide-react";
10
+ /**
11
+ * «Exportar»: the list's records — its question on screen, filter and order, every page — as a
12
+ * spreadsheet (`core/export`), saved by the browser. Offered when the entity declares its export
13
+ * (`entity(…, { export: "/invoices/export" })`); `null` otherwise.
14
+ *
15
+ * Context: the server writes the export (JSON Lines, read as it streams: no page of the list is
16
+ * fetched to build it, so a million rows is the server's work, not the page's), and this writes
17
+ * what a person opens: the model's words as headers, the region's separator and decimal.
18
+ */
19
+ export function useListExport(listing, enabled) {
20
+ const { transport, locale } = useFramework();
21
+ const toast = useToastIfAny();
22
+ const entity = listing.entity;
23
+ if (!enabled || entity.export === undefined)
24
+ return null;
25
+ const path = entity.export;
26
+ return {
27
+ id: "export",
28
+ label: frameworkCopy().list.export,
29
+ icon: Download,
30
+ tucked: true,
31
+ onSelect: () => {
32
+ // The question on screen without its page: every record it keeps, in its order.
33
+ const { pagination: _page, ...asked } = listing.question;
34
+ void downloadRoute(transport, exportRoute(path, asked, "jsonl"))
35
+ .then((download) => download.blob())
36
+ .then((blob) => blob.text())
37
+ .then((text) => {
38
+ const csv = csvOf(text.split("\n"), exportColumnsOf(listing.meta, locale), regionOf());
39
+ save(new Blob([csv], { type: "text/csv;charset=utf-8" }), fileNameOf(listing.meta, locale));
40
+ })
41
+ .catch((failure) => toast?.show(refusalNotice(failure)));
42
+ },
43
+ };
44
+ }
45
+ /** The region numbers are written in: the browser's, as a spreadsheet on this machine reads. */
46
+ function regionOf() {
47
+ return typeof navigator === "undefined" ? undefined : navigator.language;
48
+ }
49
+ function fileNameOf(meta, locale) {
50
+ const name = nameOf(meta, locale) || "export";
51
+ return `${name.toLowerCase().replace(/\s+/g, "-")}.csv`;
52
+ }
53
+ /** Saved by the browser, as a link the person followed. */
54
+ function save(blob, name) {
55
+ const url = URL.createObjectURL(blob);
56
+ const link = document.createElement("a");
57
+ link.href = url;
58
+ link.download = name;
59
+ link.click();
60
+ setTimeout(() => URL.revokeObjectURL(url), 0);
61
+ }
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
3
3
  import { keysOf, listRoute } from "@sincpro/client-framework";
4
4
  import { choicesOf } from "@sincpro/criteria";
5
5
  import { frameworkCopy } from "../../core/copy.js";
@@ -14,7 +14,7 @@ import { refusalNotice } from "../list/records.js";
14
14
  import { controlFor, RelationPicker, } from "./control.js";
15
15
  import { RecordOpeningProvider, useRecordOpening, } from "./opening.js";
16
16
  import { usePartLook } from "./record.js";
17
- import { Button, Field, LineItems, ReadValue, Tag, useToastIfAny, } from "@sincpro/web-ui";
17
+ import { Field, LineItems, ReadValue, Tag, useToastIfAny, } from "@sincpro/web-ui";
18
18
  import { useRef } from "react";
19
19
  /** How a field of a line reads: a many2one's key by the name of what it points at. */
20
20
  function textIn(definition, field, relation, line, locale) {
@@ -237,7 +237,9 @@ export function RecordLinesEditor({ record, name, lines, look = {}, }) {
237
237
  ...(one.numeric === undefined ? {} : { numeric: one.numeric }),
238
238
  })),
239
239
  ];
240
- const table = (_jsx(LineItems, { lines: lines, columns: columns, getLineId: keyOf, mode: writing ? "edit" : "read", adding: adding, onChange: (key, next) => write((all) => all.map((one) => (keyOf(one) === key ? sameLine(one, next) : one))), newLine: newLine, onAdd: (line) => write((all) => [...all, line]), onRemove: (key) => write((all) => all.filter((one) => keyOf(one) !== key)), onRestore: (line, index) => write((all) => [...all.slice(0, index), line, ...all.slice(index)]), onReorder: (key, before) => write((all) => moved(all, identity, key, before)),
240
+ const table = (_jsx(LineItems, { lines: lines, columns: columns, getLineId: keyOf, mode: writing ? "edit" : "read", adding: adding, onChange: (key, next) => write((all) => all.map((one) => (keyOf(one) === key ? sameLine(one, next) : one))), newLine: newLine, ...(addMany === undefined
241
+ ? {}
242
+ : { moreAdds: [{ label: frameworkCopy().record.addMany, onAdd: addMany }] }), onAdd: (line) => write((all) => [...all, line]), onRemove: (key) => write((all) => all.filter((one) => keyOf(one) !== key)), onRestore: (line, index) => write((all) => [...all.slice(0, index), line, ...all.slice(index)]), onReorder: (key, before) => write((all) => moved(all, identity, key, before)),
241
243
  // A cell says its own (web-ui 1.6 `cellState`): the line model's hints refined by the
242
244
  // server's `items[i]`, the error pointing at it (under its value) and its warning.
243
245
  cellState: (line, column) => {
@@ -291,9 +293,7 @@ export function RecordLinesEditor({ record, name, lines, look = {}, }) {
291
293
  // line's dialog, a modal over a modal). Opening a chosen record is still the workspace's.
292
294
  const inLine = opening === null ? null : withoutChoose(opening);
293
295
  const lined = inLine === null ? (table) : (_jsx(RecordOpeningProvider, { value: inLine, children: table }));
294
- if (addMany === undefined)
295
- return lined;
296
- return (_jsxs("div", { className: "flex flex-col gap-2", children: [lined, _jsx("div", { children: _jsx(Button, { size: "sm", role: "secondary", onClick: addMany, children: frameworkCopy().record.addMany }) })] }));
296
+ return lined;
297
297
  }
298
298
  /** The opening inside a line: without the workspace's chooser (see the end of the editor), or
299
299
  * `null` when there is none to take away. */
@@ -1,11 +1,14 @@
1
1
  import type { Entity } from "@sincpro/client-framework";
2
- import type { AnyRecord } from "@sincpro/criteria";
2
+ import type { AnyRecord, Expression } from "@sincpro/criteria";
3
3
  import { type ViewProps } from "@sincpro/web-composer";
4
4
  import type { RecordRead } from "../../core/server.js";
5
5
  import type { RecordReading } from "../../react/useRecord.js";
6
6
  import { actionsOf, type ScreenActions } from "../list/dock.js";
7
7
  import { type NoProps } from "../parts.js";
8
- import { useRecordScreen } from "./record.js";
8
+ import type { FieldControl } from "../record/control.js";
9
+ import type { DockedAction } from "../record/dock.js";
10
+ import { type RecordTag, useRecordScreen } from "./record.js";
11
+ import { type DockAction, type DockMoment, type SmartLink } from "@sincpro/web-ui";
9
12
  import { type ReactNode } from "react";
10
13
  /**
11
14
  * A record screen written as a tree of the framework's parts.
@@ -65,6 +68,8 @@ type RecordScreenState = {
65
68
  docked: ReturnType<typeof actionsOf>["dock"];
66
69
  /** The actions the screen draws by hand, with the lifecycle's buttons beside them. */
67
70
  drawn: ReactNode | null;
71
+ /** What hangs off the record, opened in the workspace (`links`). */
72
+ links: readonly SmartLink[];
68
73
  /** The restored draft's notice was put away: the draft stays, its notice is read. */
69
74
  restoredAway: boolean;
70
75
  putRestoredAway: () => void;
@@ -81,13 +86,41 @@ type RecordScreenState = {
81
86
  * The entity is only its type: the record is the screen's.
82
87
  */
83
88
  export declare function useScreenRecord<T extends AnyRecord>(_entity?: Entity<T>): ReadyRecord<T>;
89
+ /**
90
+ * How many columns the record's form takes where the screen is mounted — two on a page or in a
91
+ * modal, one in a panel, a peek or a phone —, for a block of the application that lays itself out
92
+ * the same way («three figures side by side when wide»). The screen decided it; a block never
93
+ * asks the workspace where it opened.
94
+ */
95
+ export declare function useScreenColumns(): 1 | 2;
96
+ /**
97
+ * The record's notices for a screen that writes web-ui's `Record` itself (`useRecordScreen`):
98
+ * the edit's and the server's advice, as `RecordScreen.Notices` and `.Advice` draw them —
99
+ * elements of web-ui's slot, written straight among `Record`'s children. Nothing while the record
100
+ * is not read.
101
+ *
102
+ * const notices = useRecordNotices(screen.reading);
103
+ * <Record {...screen.record}>{notices}<Record.Rail>…</Record.Rail>…</Record>
104
+ *
105
+ * Context: a screen at the hooks level copied the framework's notices — as `Callout`s among the
106
+ * fields, which web-ui says not to do (#112).
107
+ */
108
+ export declare function useRecordNotices<T extends AnyRecord>(reading: RecordReading<T>): ReactNode[];
109
+ /** A field drawn the screen's way inside `RecordScreen.Fields`: its control, and the record. */
110
+ export type FieldDrawn = (control: FieldControl, record: ReadyRecord<AnyRecord>) => ReactNode;
84
111
  /**
85
112
  * The record's fields in web-ui's form grid: two columns on a page and in a modal, one in a
86
- * panel, a peek or a phone. `names` chooses and orders them; `title` heads the section.
113
+ * panel, a peek or a phone. `names` chooses and orders them; `title` heads the section and
114
+ * `hint` says what it is for. A field the model cannot draw as the screen wants — a body with
115
+ * pictures, a year — is drawn by `controls`, with the field's control and the record. A section
116
+ * of one field that bears its name («Sesiones», the sessions) does not name it twice: the field
117
+ * is drawn bare under the section's title.
87
118
  */
88
- declare function Fields({ names, title, }: {
119
+ declare function Fields({ names, title, hint, controls, }: {
89
120
  names?: readonly string[] | undefined;
90
121
  title?: string | undefined;
122
+ hint?: string | undefined;
123
+ controls?: Readonly<Partial<Record<string, FieldDrawn>>> | undefined;
91
124
  }): import("react").JSX.Element;
92
125
  /** Each value the record embeds (a payment's receipt) as a section of its own fields. */
93
126
  declare function Sections(): import("react").JSX.Element;
@@ -100,6 +133,17 @@ export type RecordScreenProps<T extends AnyRecord> = ViewProps & {
100
133
  title?: ((record: T) => string | null) | undefined;
101
134
  /** The line under its name, the screen's way. Without it, the record's type, if any. */
102
135
  subtitle?: ((record: T) => string | null) | undefined;
136
+ /** Its tag, the screen's way («Publicada»). Without it, its state in the entity's tone. */
137
+ tag?: ((record: T) => RecordTag | null | undefined) | undefined;
138
+ /** How a new one is named: «Nueva noticia». Without it, the model's name and «nuevo». */
139
+ creating?: string | undefined;
140
+ /** The dock's word on its moment, the screen's way — one that depends on who looks. Without
141
+ * it, the entity's (`presented(entity, { moment })`). */
142
+ moment?: ((record: T) => DockMoment | undefined) | undefined;
143
+ /** What hangs off it, opened in the workspace — `RecordScreen.Smart`, in the rail: a list of
144
+ * related records declared (`RelatedLink`: counted and opened by the screen), or a link of the
145
+ * screen's own. Not while it is new: nothing hangs off a record that does not exist yet. */
146
+ links?: ((record: T) => readonly (SmartLink | RelatedLink)[]) | undefined;
103
147
  /** The fields `RecordScreen.Fields` shows, in this order. Without it, the model's (`formOf`). */
104
148
  fields?: readonly string[] | undefined;
105
149
  /** The one2many `RecordScreen.Pages` shows, in this order. Without it, every one the model has. */
@@ -109,13 +153,13 @@ export type RecordScreenProps<T extends AnyRecord> = ViewProps & {
109
153
  * (`DockAction`s) the view style draws them with the lifecycle's: the rail's buttons in
110
154
  * `traditional`, one floating pill in `modern`. A node drawn by hand stays in the rail.
111
155
  */
112
- actions?: ((record: RecordReading<T>) => ScreenActions) | undefined;
156
+ actions?: ((record: RecordReading<T>) => ScreenActions | readonly (DockAction | DockedAction)[]) | undefined;
113
157
  /** `false`: the screen draws its own history — it is not read. */
114
158
  history?: boolean | undefined;
115
159
  /** The screen's tree. Without it, the default screen. */
116
160
  children?: ReactNode;
117
161
  };
118
- declare function RecordScreenRoot<T extends AnyRecord>({ api, resource, entity, initial, title, subtitle, fields, pages, actions, history, children, }: RecordScreenProps<T>): import("react").JSX.Element;
162
+ declare function RecordScreenRoot<T extends AnyRecord>({ api, resource, entity, initial, title, subtitle, tag, creating, moment, links, fields, pages, actions, history, children, }: RecordScreenProps<T>): import("react").JSX.Element;
119
163
  /**
120
164
  * A record screen by parts: the framework's default, or any part of it replaced. See the top of
121
165
  * this file.
@@ -126,7 +170,11 @@ export declare const RecordScreen: typeof RecordScreenRoot & {
126
170
  }, RecordScreenState>;
127
171
  Crumbs: import("../parts.js").Part<NoProps, RecordScreenState>;
128
172
  Pager: import("../parts.js").Part<NoProps, RecordScreenState>;
129
- Actions: import("../parts.js").Part<NoProps, RecordScreenState>;
173
+ Smart: import("../parts.js").Part<NoProps, RecordScreenState>;
174
+ Actions: import("../parts.js").Part<{
175
+ visible?: number | undefined;
176
+ children?: never;
177
+ }, RecordScreenState>;
130
178
  Paper: import("../parts.js").Part<{
131
179
  children?: ReactNode;
132
180
  layout?: "horizontal" | "stacked";
@@ -153,4 +201,22 @@ export declare const RecordScreen: typeof RecordScreenRoot & {
153
201
  * actions={(invoice) => <CommandButton entity={invoices} command="post" … />} /> })
154
202
  */
155
203
  export declare function EntityRecord<T extends AnyRecord>(props: Omit<RecordScreenProps<T>, "children" | "history">): import("react").JSX.Element;
204
+ /**
205
+ * A list of records related to this one, declared — Odoo's smart button: its icon and words, the
206
+ * entity it lists and what keeps them (`where`, from the record), and the title its list opens
207
+ * with. The screen counts it and opens it; the application writes no hook for it.
208
+ *
209
+ * links={(pago) => [
210
+ * { icon: Receipt, label: "Sus pagos", list: pagos, title: pago.colegiado_nombre,
211
+ * where: { field: "colegiado_id", operator: "=", value: pago.colegiado_id } },
212
+ * ]}
213
+ */
214
+ export type RelatedLink = {
215
+ icon: SmartLink["icon"];
216
+ label: string;
217
+ list: Entity;
218
+ where: Expression;
219
+ /** Whose the list is: «María» of «Pagos · María». */
220
+ title?: string;
221
+ };
156
222
  export {};