@sincpro/web-framework 3.16.0 → 3.18.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.
@@ -77,6 +77,12 @@ export type Groups<T> = {
77
77
  * has no next page, or the ceiling was reached), `undefined` while the group is unread.
78
78
  * web-ui's `Pile.more`: «Show 50 more of 49,950», or «Showing 500 of 49,950». */
79
79
  brings: (bucket: Bucket<T>) => number | false | undefined;
80
+ /** Turn a group's page — `1` the next, `-1` the one before — in place of the rows it shows,
81
+ * as Odoo's pager on a group's line. Nothing while it reads, or with no page that way. */
82
+ page: (bucket: Bucket<T>, step: 1 | -1) => void;
83
+ /** Where the rows shown start among the group's — `0` on its first page —: web-ui's
84
+ * `Pile.from`, which its pager reads as «51–100 / 2.328». */
85
+ fromOf: (bucket: Bucket<T>) => number;
80
86
  /** Why reading what a group holds failed — its level below or its rows —, or `null`. */
81
87
  errorOf: (bucket: Bucket<T>) => unknown;
82
88
  };
@@ -71,7 +71,9 @@ export function useGroups(listing, options = {}) {
71
71
  if (inFlight.current.has(tag))
72
72
  return;
73
73
  const had = now.current.rows.get(key);
74
- if (mode === "more" && (had === undefined || had.after === null))
74
+ if ((mode === "more" || mode === "next") && (had === undefined || had.after === null))
75
+ return;
76
+ if (mode === "prev" && (had === undefined || had.back.length === 0))
75
77
  return;
76
78
  inFlight.current.add(tag);
77
79
  const { id, signal } = generation.current;
@@ -80,7 +82,14 @@ export function useGroups(listing, options = {}) {
80
82
  ? Math.min(maxRows, Math.max(pageSize, had?.rows.length ?? 0))
81
83
  : pageSize;
82
84
  const first = rowsQuestion(bucket, limit);
83
- const criteria = mode === "more" && had !== undefined ? resumingFrom(first, had.after) : first;
85
+ // The page turned back to: where it started, as it was read then.
86
+ const before = mode === "prev" ? had?.back.at(-1) : undefined;
87
+ // Where this reading starts: after the rows in hand («more», «next»), where the page
88
+ // stepped back to started, or the group's first row.
89
+ const at = (mode === "more" || mode === "next") && had !== undefined
90
+ ? had.after
91
+ : (before?.at ?? null);
92
+ const criteria = at === null ? first : resumingFrom(first, at);
84
93
  if (had !== undefined)
85
94
  setRows((map) => new Map(map).set(key, { ...had, reading: true, error: null }));
86
95
  transport.list(route, criteria, signal).then((page) => {
@@ -88,13 +97,27 @@ export function useGroups(listing, options = {}) {
88
97
  if (generation.current.id !== id)
89
98
  return;
90
99
  setRows((map) => {
91
- const before = mode === "more" ? (map.get(key)?.rows ?? []) : [];
100
+ const held = map.get(key);
101
+ const kept = mode === "more" ? (held?.rows ?? []) : [];
102
+ // «more» adds to the page on screen; «next» and «prev» turn it; the rest start over.
103
+ const place = mode === "more" && held !== undefined
104
+ ? { from: held.from, at: held.at, back: held.back }
105
+ : mode === "next" && held !== undefined
106
+ ? {
107
+ from: held.from + held.rows.length,
108
+ at,
109
+ back: [...held.back, { from: held.from, at: held.at }],
110
+ }
111
+ : mode === "prev" && held !== undefined && before !== undefined
112
+ ? { from: before.from, at: before.at, back: held.back.slice(0, -1) }
113
+ : { from: 0, at: null, back: [] };
92
114
  return new Map(map).set(key, {
93
115
  path,
94
- rows: [...before, ...page.rows],
116
+ rows: [...kept, ...page.rows],
95
117
  after: page.cursor,
96
118
  reading: false,
97
119
  error: null,
120
+ ...place,
98
121
  });
99
122
  });
100
123
  }, (error) => {
@@ -102,7 +125,14 @@ export function useGroups(listing, options = {}) {
102
125
  if (generation.current.id !== id)
103
126
  return;
104
127
  setRows((map) => new Map(map).set(key, {
105
- ...(map.get(key) ?? { path, rows: [], after: null }),
128
+ ...(map.get(key) ?? {
129
+ path,
130
+ rows: [],
131
+ after: null,
132
+ from: 0,
133
+ at: null,
134
+ back: [],
135
+ }),
106
136
  reading: false,
107
137
  error,
108
138
  }));
@@ -372,9 +402,19 @@ export function useGroups(listing, options = {}) {
372
402
  return undefined;
373
403
  if (!hasMore(bucket))
374
404
  return false;
375
- const left = Math.min(maxRows, bucket.count) - read.rows.length;
405
+ // What is left after the rows shown — a group turned to its third page has left what
406
+ // follows it, not what precedes it.
407
+ const left = Math.min(maxRows, bucket.count - read.from) - read.rows.length;
376
408
  return Math.max(0, Math.min(pageSize, left));
377
409
  },
410
+ page: (bucket, step) => {
411
+ const read = readOf(bucket);
412
+ if (read === undefined || read.reading)
413
+ return;
414
+ if (step === 1 ? read.after !== null : read.back.length > 0)
415
+ readRows(bucket, pathOf(bucket), step === 1 ? "next" : "prev");
416
+ },
417
+ fromOf: (bucket) => readOf(bucket)?.from ?? 0,
378
418
  errorOf: (bucket) => (isDeepest(bucket) ? readOf(bucket) : levelOf(bucket))?.error ?? null,
379
419
  };
380
420
  }
@@ -282,6 +282,8 @@ export function EntityList({ listing, api, columns: askedColumns, cells, yesNo,
282
282
  elsewhere.join(),
283
283
  openingIn === undefined,
284
284
  dateStyle,
285
+ // The tags' colours: a new map of tones redraws the table's cells, as it does the sheet's.
286
+ look.tones,
285
287
  ]);
286
288
  // A state the application gave colours to is the row's tag — and not again among its facts.
287
289
  const stateField = summaryFieldsOf(meta, {}, listing.entity.summary).state;
@@ -325,7 +327,12 @@ export function EntityList({ listing, api, columns: askedColumns, cells, yesNo,
325
327
  id: column.id,
326
328
  header: String(column.header),
327
329
  ...(column.numeric === true ? { numeric: true } : {}),
328
- })), [shown]);
330
+ // A state in a toned tag, as the table draws it — not a painted cell, which is how
331
+ // a sheet marks a value out of range.
332
+ ...(look.tones?.[column.id] === undefined
333
+ ? {}
334
+ : { look: "tag" }),
335
+ })), [shown, look.tones]);
329
336
  const sortStates = useMemo(() => listing.order.map((one) => ({
330
337
  key: one.field,
331
338
  direction: one.descending ? "desc" : "asc",
@@ -411,6 +418,13 @@ export function EntityList({ listing, api, columns: askedColumns, cells, yesNo,
411
418
  if (bucket !== undefined)
412
419
  groups.more(bucket);
413
420
  },
421
+ // Odoo's pager on an open group's line — «51–100 / 2.328 ‹ ›» — turns its page in
422
+ // place of its rows (web-ui's `onPage`); «See N more» stays under it.
423
+ onPage: (pile, step) => {
424
+ const bucket = bucketAt.get(pathKey(pile.path));
425
+ if (bucket !== undefined)
426
+ groups.page(bucket, step);
427
+ },
414
428
  // «Ver N grupos más» after the last group of a level: the first level, or the one
415
429
  // under an open group — counted by the server (`groups_count`).
416
430
  ...(groups.groupsCount === null ? {} : { pilesCount: groups.groupsCount }),
@@ -503,11 +517,23 @@ export function EntityList({ listing, api, columns: askedColumns, cells, yesNo,
503
517
  // Emptied (or cleared with ×): the whole set again, at once.
504
518
  if (next === "" && listing.text !== "")
505
519
  listing.search("", { now: true });
506
- }, onSubmit: (text) => listing.search(text, { now: true }), placeholder: copy.search, "aria-label": copy.search }) })) : null, started.drawn === null ? null : (_jsxs(List.Actions, { children: [started.drawn, creating === undefined ? null : (_jsx(Button, { role: "primary", size: "sm", onClick: creating, children: frameworkCopy().record.create }))] })), startDock.length === 0 && forChosen.dock.length === 0 ? null : (_jsx(List.Dock, { ...(startDock.length === 0 ? {} : { actions: startDock }), ...(forChosen.dock.length === 0 ? {} : { selection: forChosen.dock }) })), paging === null ? null : _jsx(List.Pagination, { children: paging })] }), views.includes("table") ? (_jsx(List.Table, { columns: shown, ...(totalled ? { totals: true } : {}), ...(rowActions === undefined ? {} : { rowActions }), ...(reorder.move === undefined ? {} : { onReorder: reorder.move }) })) : null, _jsx(List.Rows, { row: rowOf }), views.includes("sheet") ? (_jsx(List.Sheet, { columns: sheetColumns, cell: (row, column) => {
520
+ }, onSubmit: (text) => listing.search(text, { now: true }), placeholder: copy.search, "aria-label": copy.search }) })) : null, started.drawn === null ? null : (_jsxs(List.Actions, { children: [started.drawn, creating === undefined ? null : (_jsx(Button, { role: "primary", size: "sm", onClick: creating, children: frameworkCopy().record.create }))] })), startDock.length === 0 && forChosen.dock.length === 0 ? null : (_jsx(List.Dock, { ...(startDock.length === 0 ? {} : { actions: startDock }), ...(forChosen.dock.length === 0 ? {} : { selection: forChosen.dock }) })), paging === null ? null : _jsx(List.Pagination, { children: paging })] }), views.includes("table") ? (_jsx(List.Table, { columns: shown, ...(totalled ? { totals: true } : {}), ...(rowActions === undefined ? {} : { rowActions }), ...(reorder.move === undefined ? {} : { onReorder: reorder.move }) })) : null, _jsx(List.Rows, { row: rowOf }), views.includes("sheet") ? (_jsx(List.Sheet, {
521
+ // The set comes in pages (50 by default): the sheet grows with its page, as the table
522
+ // does, instead of web-ui's fixed box — which suits a sheet of thousands, not a page.
523
+ height: "auto", columns: sheetColumns, cell: (row, column) => {
507
524
  const value = row[column.id];
508
525
  return value === null || value === undefined
509
526
  ? null
510
527
  : (textOf(meta, column.id, value, locale) ?? String(value));
528
+ },
529
+ // The tones the application gave its choices (`presented(entity, { tones })`): the
530
+ // same colour a state has in the table, the record and its tag.
531
+ tone: (row, column) => {
532
+ const tones = look.tones?.[column.id];
533
+ const value = row[column.id];
534
+ return tones === undefined || value === null || value === undefined
535
+ ? undefined
536
+ : (tones[String(value)] ?? "neutral");
511
537
  } })) : null, views.includes("pivot") ? (_jsx(List.Pivot, { folded: folded ??
512
538
  pivotOf({
513
539
  crossed: [],
@@ -16,7 +16,7 @@ import { type GroupableField, type Pile } from "@sincpro/web-ui";
16
16
  export declare function groupableOf(meta: Meta | null, locale?: string, only?: readonly string[]): GroupableField[];
17
17
  /** The levels below the first, as `useGroups` reads them: each when its group opens, a page at
18
18
  * a time. Without it, the levels below are the ones each bucket carries (`bucket.groups`). */
19
- export type GroupTree<T> = Pick<Groups<T>, "groupsOf" | "groupsCountOf" | "bringsGroups" | "isDeepest" | "errorOf">;
19
+ export type GroupTree<T> = Pick<Groups<T>, "groupsOf" | "groupsCountOf" | "bringsGroups" | "isDeepest" | "errorOf"> & Partial<Pick<Groups<T>, "fromOf">>;
20
20
  /**
21
21
  * The server's groups as piles, with the words a person reads, and each pile's group so that
22
22
  * opening one reads its rows. Rows sit only on the deepest level, once read.
@@ -118,6 +118,10 @@ underColumns = new Set(), tree) {
118
118
  count: bucket.count,
119
119
  ...summed(bucket),
120
120
  items: deepest ? [...(rowsOf(bucket) ?? [])] : [],
121
+ // Where those rows start among the group's, when a page was turned (web-ui's pager).
122
+ ...(deepest && (tree?.fromOf?.(bucket) ?? 0) > 0
123
+ ? { from: tree?.fromOf?.(bucket) }
124
+ : {}),
121
125
  piles: deepest ? [] : walk(below, path, depth + 1),
122
126
  ...more(bucket, deepest),
123
127
  ...(counted === null || counted === undefined ? {} : { pilesCount: counted }),
@@ -1,7 +1,7 @@
1
1
  import { type CommandAnswers, type CommandBodies, type Entity } from "@sincpro/client-framework";
2
2
  import type { AnyRecord } from "@sincpro/criteria";
3
3
  import { type ListDefinition } from "../../core/list.js";
4
- import type { PickerItem, RecordCard, RowOf, Tone } from "@sincpro/web-ui";
4
+ import type { DockMoment, PickerItem, RecordCard, RowOf, Tone } from "@sincpro/web-ui";
5
5
  import type { ComponentProps } from "react";
6
6
  /**
7
7
  * How a record of an entity looks at each size — a choice, a row, a card — declared ONCE with
@@ -66,6 +66,17 @@ export type Presentation<T> = {
66
66
  * dictionary per state and passed it to its rows, its record and its cells by hand.
67
67
  */
68
68
  tones?: ChoiceTones<T>;
69
+ /**
70
+ * What a record's action pill says while nothing is being edited — its moment, with its tone:
71
+ * `(colegiado) => colegiado.situacion === "OBSERVADO" ? { text: "Colegiado observado",
72
+ * detail: "Su portal está congelado hasta que levantes la observación.", tone: "warn" } :
73
+ * undefined`. Unsaved changes, saving and «Guardado» are the framework's and say themselves.
74
+ *
75
+ * Context: the header's tag already names the state; this is for what the state MEANS for
76
+ * whoever is looking — what waits, why an action is not there. Nothing by default: a pill
77
+ * repeating the tag would be the same word twice.
78
+ */
79
+ moment?: (record: T) => DockMoment | undefined;
69
80
  /** The colour of each kind of fact in its history, by its `name` — whole, or its last part
70
81
  * (`pago_aprobado`) — over the framework's own (`FACT_TONES`). */
71
82
  facts?: Readonly<Record<string, Tone>>;
@@ -12,6 +12,13 @@ export type FieldControl = {
12
12
  /** No `Field` names it — a cell of a table: the control carries its label itself. Inside a
13
13
  * `Field` it must not, or React Aria reads both and names it «Precio Precio». */
14
14
  standalone?: boolean;
15
+ /** No `Field` names it, yet it keeps its full look — a `RecordField bare`, inside a section
16
+ * that already says what it is: it carries `label` as its accessible name, a textarea still
17
+ * a textarea (`standalone` would make it a cell's one-line input). */
18
+ unlabelled?: boolean;
19
+ /** With `unlabelled`, the id of what is said under it — its refusal —, so the control reads it
20
+ * as its description (what `Field` wires when it wraps one). */
21
+ describedBy?: string;
15
22
  /** Whose field it is — the entity, the record's id, the field —, for what is sent apart from
16
23
  * the record: a file, a picture inside a rich text. `RecordField` says it. */
17
24
  about?: UploadAbout;
@@ -27,7 +27,16 @@ const SHORT_LABEL = 24;
27
27
  */
28
28
  export function controlFor(control, type, exact, choices, widget, segmented = false) {
29
29
  const { value, set } = control;
30
- const named = control.standalone === true ? { "aria-label": control.label } : {};
30
+ const named = control.standalone === true || control.unlabelled === true
31
+ ? {
32
+ "aria-label": control.label,
33
+ // No `Field` around it says it is wrong and why: the control says it itself.
34
+ ...(control.unlabelled === true ? { invalid: control.invalid } : {}),
35
+ ...(control.unlabelled === true && control.describedBy !== undefined
36
+ ? { describedBy: control.describedBy }
37
+ : {}),
38
+ }
39
+ : {};
31
40
  // Several of the values at once — a list whose values are a choice: each one a check, the
32
41
  // list's label above them.
33
42
  if (choices.length > 0 && type.endsWith("[]"))
@@ -5,7 +5,7 @@ import { type FieldControl } from "./control.js";
5
5
  import { type LinesLook } from "./lines.js";
6
6
  export type { FieldControl } from "./control.js";
7
7
  import { type DirtyState } from "@sincpro/web-ui";
8
- import type { ReactNode } from "react";
8
+ import { type ReactNode } from "react";
9
9
  /**
10
10
  * One field of a record being edited, from the model: its word, whether it is required or
11
11
  * read-only now (the hints, evaluated over what is on screen), the server's error for it, and a
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import {} from "@sincpro/client-framework";
4
4
  import { choicesOf } from "@sincpro/criteria";
5
5
  import { frameworkCopy } from "../../core/copy.js";
@@ -21,6 +21,7 @@ import { RecordLines } from "./record.js";
21
21
  import { RelatedList } from "./RelatedList.js";
22
22
  import { RichTextControl } from "./richText.js";
23
23
  import { Checkbox, Field, FileValue, FormSection, ReadValue, RelationValue, useFormStyle, } from "@sincpro/web-ui";
24
+ import { useId } from "react";
24
25
  /** `value` with `path` (`numero`, or `emisor.nit`) set to `next` — a new object, the rest kept. */
25
26
  function setAt(value, path, next) {
26
27
  const base = typeof value === "object" && value !== null ? value : {};
@@ -104,6 +105,8 @@ export function RecordField({ record, name, as, bare = false, lines: look, list:
104
105
  const opening = useRecordOpening();
105
106
  const { metas, uploads } = useFramework();
106
107
  const settings = useFormStyle() === "settings";
108
+ // Bare, its refusal is said under the control — and tied to it by this id.
109
+ const refusalId = useId();
107
110
  if (!state.visible)
108
111
  return null;
109
112
  // A one2many is a BLOCK, named by a section — never a `Field`: web-ui's controls read the
@@ -177,6 +180,11 @@ export function RecordField({ record, name, as, bare = false, lines: look, list:
177
180
  invalid: error !== undefined,
178
181
  label: view.label,
179
182
  about: aboutOf(record, name),
183
+ // Bare, no `Field` names it: the control carries its label as its accessible name, and
184
+ // what is wrong with it as its description.
185
+ ...(bare
186
+ ? { unlabelled: true, ...(error === undefined ? {} : { describedBy: refusalId }) }
187
+ : {}),
180
188
  };
181
189
  const field = fieldMetaOf(meta, name);
182
190
  if (as === undefined && holdsFile(field)) {
@@ -231,11 +239,16 @@ export function RecordField({ record, name, as, bare = false, lines: look, list:
231
239
  return controlFor(control, view.type, false, choices, field?.widget);
232
240
  if (view.type === "boolean" && as === undefined)
233
241
  return (_jsx(Checkbox, { checked: value === true, onChange: control.set, label: view.label, disabled: state.readonly }));
242
+ const input = as !== undefined ? (as(control)) : relation !== undefined && !relation.many && target !== undefined ? (manyToOne()) : holdsRichText(field) ? (_jsx(RichTextControl, { control: control })) : state.readonly ? (_jsx(ReadValue, { value: textOf(meta, name, value, locale) ?? "—" })) : (controlFor(control, view.type, field?.exact === true, choices,
243
+ // A value object of an amount and a currency is a money, whatever it is called.
244
+ field?.widget ?? (isMoneyDefinition(field?.definition) ? "money" : undefined), settings && state.required));
245
+ // Bare: the section around it already names it — the control takes the whole width, and only
246
+ // a refusal is said under it.
247
+ if (bare)
248
+ return (_jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [input, error === undefined ? null : (_jsx("p", { id: refusalId, role: "alert", className: "text-meta text-bad", children: error }))] }));
234
249
  return (_jsx(Field, { label: view.label, required: state.required && !state.readonly,
235
250
  // Said only in web-ui's «settings» form style: a field that may stay empty, and is typed in.
236
- optional: !state.required && !state.readonly, ...(view.help === undefined ? {} : { hint: view.help }), ...(error === undefined ? {} : { error }), children: as !== undefined ? (as(control)) : relation !== undefined && !relation.many && target !== undefined ? (manyToOne()) : holdsRichText(field) ? (_jsx(RichTextControl, { control: control })) : state.readonly ? (_jsx(ReadValue, { value: textOf(meta, name, value, locale) ?? "—" })) : (controlFor(control, view.type, field?.exact === true, choices,
237
- // A value object of an amount and a currency is a money, whatever it is called.
238
- field?.widget ?? (isMoneyDefinition(field?.definition) ? "money" : undefined), settings && state.required)) }));
251
+ optional: !state.required && !state.readonly, ...(view.help === undefined ? {} : { hint: view.help }), ...(error === undefined ? {} : { error }), children: input }));
239
252
  }
240
253
  /**
241
254
  * The record's «save / discard», for `<Record dirty={…}>`: present only while something changed,
@@ -246,10 +259,14 @@ export function dirtyOf(record) {
246
259
  if (!edit.dirty)
247
260
  return undefined;
248
261
  const missing = edit.missing.map((name) => viewOf(meta, name, locale).label);
262
+ // How many fields changed: the floating pill writes «3 cambios sin guardar» — the marks of
263
+ // the fields themselves may be far up the form, out of sight.
264
+ const changes = Object.keys(edit.changed).length;
249
265
  return {
250
266
  onSave: () => void edit.save(),
251
267
  onDiscard: edit.discard,
252
268
  saving: edit.saving,
269
+ ...(changes === 0 ? {} : { changes }),
253
270
  ...(missing.length === 0 ? {} : { blocked: frameworkCopy().record.missing(missing) }),
254
271
  };
255
272
  }
@@ -47,7 +47,9 @@ export function RichTextControl({ control }) {
47
47
  }, [uploads, about, transport]);
48
48
  if (control.readonly)
49
49
  return (_jsx(RichTextValue, { value: html, ...(richText.embeds === undefined ? {} : { embeds: richText.embeds }), ...(richText.sanitized === undefined ? {} : { sanitized: richText.sanitized }) }));
50
- return (_jsx(RichTextInput, { value: html, onChange: (next) => control.set(next), invalid: control.invalid, toolbar: richText.toolbar ?? "full", ...(richText.embeds === undefined ? {} : { embeds: richText.embeds }), ...(images === undefined ? {} : { images }), ...(control.standalone === true ? { "aria-label": control.label } : {}) }));
50
+ return (_jsx(RichTextInput, { value: html, onChange: (next) => control.set(next), invalid: control.invalid, toolbar: richText.toolbar ?? "full", ...(richText.embeds === undefined ? {} : { embeds: richText.embeds }), ...(images === undefined ? {} : { images }), ...(control.standalone === true || control.unlabelled === true
51
+ ? { "aria-label": control.label }
52
+ : {}) }));
51
53
  }
52
54
  /** `RichTextControl` as a field's control, by reference: `<RecordField … as={richTextControl} />`. */
53
55
  export const richTextControl = (control) => (_jsx(RichTextControl, { control: control }));
@@ -64,6 +64,8 @@ export declare function useRecordScreen<T extends AnyRecord>(entity: Entity<T>,
64
64
  title: string;
65
65
  };
66
66
  };
67
+ /** `Record.Dock moment`: the application's word on the record's moment (`presented`). */
68
+ moment: import("@sincpro/web-ui").DockMoment | undefined;
67
69
  /** `Record.Pager`'s props, when it was opened from a list and nothing is typed. */
68
70
  pager: {
69
71
  index: number;
@@ -104,6 +104,9 @@ export function useRecordScreen(entity, { api, resource }, options = {}) {
104
104
  ? undefined
105
105
  : look.tones?.[stateField]?.[String(reading.record[stateField])];
106
106
  const dirty = ready ? dirtyOf(reading) : undefined;
107
+ // What the application says of this record's moment — while nothing is being edited: then the
108
+ // pill says the unsaved changes itself.
109
+ const moment = ready && dirty === undefined ? look.moment?.(reading.record) : undefined;
107
110
  const failure = reading.edit.failure;
108
111
  // Who, only when the record says it (an author is optional: the line then says only when).
109
112
  const stamp = (one) => one?.at == null ? undefined : { at: one.at, ...(one.by == null ? {} : { by: one.by }) };
@@ -138,6 +141,8 @@ export function useRecordScreen(entity, { api, resource }, options = {}) {
138
141
  // The refusal in words; its heading when the server said nothing more (no detail).
139
142
  ...(failure === null || failure === undefined ? {} : { error: refusalOf(failure) }),
140
143
  },
144
+ /** `Record.Dock moment`: the application's word on the record's moment (`presented`). */
145
+ moment,
141
146
  /** `Record.Pager`'s props, when it was opened from a list and nothing is typed. */
142
147
  pager: place === null
143
148
  ? undefined
@@ -153,7 +158,7 @@ export function useRecordScreen(entity, { api, resource }, options = {}) {
153
158
  }
154
159
  export function EntityRecord({ api, resource, entity, fields, pages, actions, title, initial, }) {
155
160
  const screen = useRecordScreen(entity, { api, resource }, { title, initial });
156
- const { reading, crumbs, history, pager } = screen;
161
+ const { reading, crumbs, history, pager, moment } = screen;
157
162
  const [page, setPage] = useState(undefined);
158
163
  const copy = frameworkCopy().record;
159
164
  // On a phone a form is one column, its label over its value: two side by side at 400 px
@@ -185,7 +190,8 @@ export function EntityRecord({ api, resource, entity, fields, pages, actions, ti
185
190
  return (_jsxs(_Fragment, { children: [_jsxs(Record, { ...screen.record, children: [crumbs.length === 0 &&
186
191
  pager === undefined &&
187
192
  docked.length === 0 &&
188
- drawn === null ? null : (_jsxs(Record.Rail, { children: [crumbs.length === 0 ? null : _jsx(Record.Crumbs, { crumbs: crumbs }), pager === undefined ? null : _jsx(Record.Pager, { ...pager }), drawn === null ? null : _jsx(Record.Actions, { children: drawn }), docked.length === 0 ? null : _jsx(Record.Dock, { actions: docked })] })), _jsxs(Record.Paper, { layout: phone ? "stacked" : "horizontal", children: [edit.conflict || edit.restored ? (_jsxs("div", { className: "flex flex-col gap-3", children: [edit.conflict ? (_jsx(Callout, { tone: "warn", title: copy.conflict, children: _jsx(Button, { size: "sm", role: "secondary", onClick: reading.reload, children: copy.reload }) })) : null, edit.restored ? (_jsx(Callout, { tone: "info", title: copy.restored, children: null })) : null] })) : null, _jsx(FormSection, { columns: columns, ...(settings && fields === undefined && layout.sections.length > 0
193
+ moment === undefined &&
194
+ drawn === null ? null : (_jsxs(Record.Rail, { children: [crumbs.length === 0 ? null : _jsx(Record.Crumbs, { crumbs: crumbs }), pager === undefined ? null : _jsx(Record.Pager, { ...pager }), drawn === null ? null : _jsx(Record.Actions, { children: drawn }), docked.length === 0 && moment === undefined ? null : (_jsx(Record.Dock, { actions: docked, ...(moment === undefined ? {} : { moment }) }))] })), _jsxs(Record.Paper, { layout: phone ? "stacked" : "horizontal", children: [edit.conflict || edit.restored ? (_jsxs("div", { className: "flex flex-col gap-3", children: [edit.conflict ? (_jsx(Callout, { tone: "warn", title: copy.conflict, children: _jsx(Button, { size: "sm", role: "secondary", onClick: reading.reload, children: copy.reload }) })) : null, edit.restored ? (_jsx(Callout, { tone: "info", title: copy.restored, children: null })) : null] })) : null, _jsx(FormSection, { columns: columns, ...(settings && fields === undefined && layout.sections.length > 0
189
195
  ? { title: copy.general }
190
196
  : {}), children: shown.map((name) => (_jsx(RecordField, { record: reading, name: name }, name))) }), fields !== undefined
191
197
  ? null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sincpro/web-framework",
3
- "version": "3.16.0",
3
+ "version": "3.18.0",
4
4
  "description": "The web client of sincpro_framework: entities, lists and records bound to the metadata the server publishes, drawn with @sincpro/web-ui and arranged with @sincpro/web-composer.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -55,7 +55,7 @@
55
55
  "@sincpro/criteria": "^2.5.1",
56
56
  "@sincpro/criteria-react": "^2.5.1",
57
57
  "@sincpro/web-composer": "^1.7.0",
58
- "@sincpro/web-ui": "^2.19.0",
58
+ "@sincpro/web-ui": "^2.20.0",
59
59
  "react": ">=19",
60
60
  "react-dom": ">=19"
61
61
  },
@@ -99,7 +99,7 @@
99
99
  "@sincpro/criteria": "^2.5.1",
100
100
  "@sincpro/criteria-react": "^2.5.1",
101
101
  "@sincpro/web-composer": "^1.9.0",
102
- "@sincpro/web-ui": "^2.19.0",
102
+ "@sincpro/web-ui": "^2.20.0",
103
103
  "@storybook/addon-a11y": "10.6.5",
104
104
  "@storybook/addon-docs": "10.6.5",
105
105
  "@storybook/addon-mcp": "10.6.5",