@sincpro/web-framework 2.4.0 → 2.6.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 +117 -86
- package/dist/core/cache.d.ts +19 -7
- package/dist/core/cache.js +81 -44
- package/dist/core/changes.d.ts +25 -0
- package/dist/core/changes.js +39 -0
- package/dist/core/edit.d.ts +19 -0
- package/dist/core/edit.js +46 -0
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +3 -3
- package/dist/core/list.d.ts +20 -0
- package/dist/core/list.js +32 -1
- package/dist/core/names.d.ts +25 -0
- package/dist/core/names.js +79 -0
- package/dist/core/present.d.ts +22 -0
- package/dist/core/present.js +51 -19
- package/dist/react/context.d.ts +15 -2
- package/dist/react/context.js +11 -4
- package/dist/react/index.d.ts +4 -0
- package/dist/react/index.js +4 -0
- package/dist/react/useCount.d.ts +18 -0
- package/dist/react/useCount.js +23 -0
- package/dist/react/useGroups.js +4 -1
- package/dist/react/useHistory.js +4 -1
- package/dist/react/useListing.js +9 -6
- package/dist/react/useNameOf.d.ts +5 -4
- package/dist/react/useNameOf.js +25 -26
- package/dist/react/usePivot.js +4 -1
- package/dist/react/useRecord.d.ts +4 -4
- package/dist/react/useRecord.js +20 -13
- package/dist/react/useService.d.ts +5 -1
- package/dist/react/useServiceReading.d.ts +35 -0
- package/dist/react/useServiceReading.js +75 -0
- package/dist/react/useTextOf.d.ts +16 -0
- package/dist/react/useTextOf.js +21 -0
- package/dist/react/useWrites.d.ts +19 -0
- package/dist/react/useWrites.js +35 -0
- package/dist/web/index.d.ts +1 -0
- package/dist/web/index.js +1 -0
- package/dist/web/list/EntityList.d.ts +4 -1
- package/dist/web/list/EntityList.js +6 -3
- package/dist/web/list/EntitySearchBar.d.ts +4 -1
- package/dist/web/list/EntitySearchBar.js +2 -2
- package/dist/web/list/groups.d.ts +13 -3
- package/dist/web/list/groups.js +21 -8
- package/dist/web/list/openIn.d.ts +4 -2
- package/dist/web/list/openIn.js +9 -2
- package/dist/web/record/ActionButton.d.ts +34 -0
- package/dist/web/record/ActionButton.js +41 -0
- package/dist/web/record/CommandButton.d.ts +5 -6
- package/dist/web/record/CommandButton.js +16 -33
- package/dist/web/record/ServiceButton.d.ts +31 -0
- package/dist/web/record/ServiceButton.js +40 -0
- package/dist/web/record/control.d.ts +9 -3
- package/dist/web/record/control.js +13 -4
- package/dist/web/record/edit.js +1 -1
- package/dist/web/record/lines.js +1 -1
- package/dist/web/record/record.js +36 -3
- package/dist/web/workspace/SincproApp.d.ts +8 -2
- package/dist/web/workspace/SincproApp.js +13 -7
- package/dist/web/workspace/composer.d.ts +6 -2
- package/dist/web/workspace/composer.js +31 -12
- package/dist/web/workspace/open.d.ts +1 -1
- package/dist/web/workspace/open.js +7 -1
- package/dist/web/workspace/record.d.ts +6 -2
- package/dist/web/workspace/record.js +6 -5
- package/dist/web/workspace/workspace.d.ts +7 -1
- package/dist/web/workspace/workspace.js +13 -4
- package/package.json +6 -6
|
@@ -35,7 +35,9 @@ export type Stamp = {
|
|
|
35
35
|
* `Record.Rail`), and a region wrapped in one of ours is not found. Before it, forge's console
|
|
36
36
|
* carried these 150 lines itself (`shared/record_screen.tsx`).
|
|
37
37
|
*/
|
|
38
|
-
export declare function useRecordScreen<T extends AnyRecord>(entity: Entity<T>, { api, resource }: Pick<ViewProps, "api" | "resource"
|
|
38
|
+
export declare function useRecordScreen<T extends AnyRecord>(entity: Entity<T>, { api, resource }: Pick<ViewProps, "api" | "resource">, options?: {
|
|
39
|
+
title?: ((record: T) => string | null) | undefined;
|
|
40
|
+
}): {
|
|
39
41
|
reading: RecordReading<T>;
|
|
40
42
|
crumbs: readonly import("@sincpro/web-composer").Crumb[];
|
|
41
43
|
history: import("../../index.js").HistoryEntry[] | undefined;
|
|
@@ -66,8 +68,10 @@ export declare function useRecordScreen<T extends AnyRecord>(entity: Entity<T>,
|
|
|
66
68
|
created?: Stamp | undefined;
|
|
67
69
|
} | undefined;
|
|
68
70
|
};
|
|
69
|
-
export declare function EntityRecord<T extends AnyRecord>({ api, resource, entity, fields, pages, actions, }: ViewProps & {
|
|
71
|
+
export declare function EntityRecord<T extends AnyRecord>({ api, resource, entity, fields, pages, actions, title, }: ViewProps & {
|
|
70
72
|
entity: Entity<T>;
|
|
73
|
+
/** Its name, the screen's way — for a record whose model has no display field. */
|
|
74
|
+
title?: (record: T) => string | null;
|
|
71
75
|
/** The fields, in this order. Without it, the model's (`formOf`). */
|
|
72
76
|
fields?: readonly string[];
|
|
73
77
|
/** The one2many shown as pages, in this order. Without it, every one the model has. */
|
|
@@ -64,10 +64,10 @@ function refusalOf(failure) {
|
|
|
64
64
|
* `Record.Rail`), and a region wrapped in one of ours is not found. Before it, forge's console
|
|
65
65
|
* carried these 150 lines itself (`shared/record_screen.tsx`).
|
|
66
66
|
*/
|
|
67
|
-
export function useRecordScreen(entity, { api, resource }) {
|
|
67
|
+
export function useRecordScreen(entity, { api, resource }, options = {}) {
|
|
68
68
|
const reading = useRecord(entity, resource);
|
|
69
69
|
const crumbs = useCrumbs(api);
|
|
70
|
-
useRecordInWorkspace(api, reading);
|
|
70
|
+
useRecordInWorkspace(api, reading, options);
|
|
71
71
|
const history = useHistory(entity, reading.isNew ? "" : reading.id, [reading.record]);
|
|
72
72
|
const summarize = useSummaryOf(entity);
|
|
73
73
|
const copy = frameworkCopy().record;
|
|
@@ -112,7 +112,8 @@ export function useRecordScreen(entity, { api, resource }) {
|
|
|
112
112
|
placement: api.surface === "modal" ? "card" : "page",
|
|
113
113
|
identity: {
|
|
114
114
|
// A new record is «creating»; an existing one has no name until it is read.
|
|
115
|
-
title:
|
|
115
|
+
title: (ready && !reading.isNew ? options.title?.(reading.record) : null) ??
|
|
116
|
+
summary?.name ??
|
|
116
117
|
(reading.isNew ? copy.creating(nameOf(reading.meta, reading.locale) || "") : ""),
|
|
117
118
|
...(summary?.type == null ? {} : { subtitle: summary.type }),
|
|
118
119
|
...(summary?.state == null ? {} : { tag: { label: summary.state } }),
|
|
@@ -134,8 +135,8 @@ export function useRecordScreen(entity, { api, resource }) {
|
|
|
134
135
|
},
|
|
135
136
|
};
|
|
136
137
|
}
|
|
137
|
-
export function EntityRecord({ api, resource, entity, fields, pages, actions, }) {
|
|
138
|
-
const screen = useRecordScreen(entity, { api, resource });
|
|
138
|
+
export function EntityRecord({ api, resource, entity, fields, pages, actions, title, }) {
|
|
139
|
+
const screen = useRecordScreen(entity, { api, resource }, { title });
|
|
139
140
|
const { reading, crumbs, history, pager } = screen;
|
|
140
141
|
const [page, setPage] = useState(undefined);
|
|
141
142
|
const copy = frameworkCopy().record;
|
|
@@ -17,10 +17,16 @@ import type { RecordReading } from "../../react/useRecord.js";
|
|
|
17
17
|
* to ANSWER (`api.pick(entity.newRef(…))` — «Agregar» on a record's one2many), it answers the
|
|
18
18
|
* record it became instead, and the surface closes: whoever asked reads it again.
|
|
19
19
|
*
|
|
20
|
+
* Its name is the model's display field — or the screen's word for it (`title`), for a record
|
|
21
|
+
* whose model has none: a singleton («the institution's texts») would read as its key.
|
|
22
|
+
*
|
|
20
23
|
* const invoice = useRecord(invoices, resource);
|
|
21
24
|
* useRecordInWorkspace(api, invoice);
|
|
25
|
+
* useRecordInWorkspace(api, texts, { title: () => "Textos de la institución" });
|
|
22
26
|
*/
|
|
23
|
-
export declare function useRecordInWorkspace<T extends AnyRecord>(api: WorkspaceApi, record: RecordReading<T
|
|
27
|
+
export declare function useRecordInWorkspace<T extends AnyRecord>(api: WorkspaceApi, record: RecordReading<T>, options?: {
|
|
28
|
+
title?: ((record: T) => string | null) | undefined;
|
|
29
|
+
}): void;
|
|
24
30
|
/**
|
|
25
31
|
* «Browse everything» as the composer's chooser: the entity's own list opens in a window and
|
|
26
32
|
* the row clicked there answers the field.
|
|
@@ -20,16 +20,25 @@ import { useEffect } from "react";
|
|
|
20
20
|
* to ANSWER (`api.pick(entity.newRef(…))` — «Agregar» on a record's one2many), it answers the
|
|
21
21
|
* record it became instead, and the surface closes: whoever asked reads it again.
|
|
22
22
|
*
|
|
23
|
+
* Its name is the model's display field — or the screen's word for it (`title`), for a record
|
|
24
|
+
* whose model has none: a singleton («the institution's texts») would read as its key.
|
|
25
|
+
*
|
|
23
26
|
* const invoice = useRecord(invoices, resource);
|
|
24
27
|
* useRecordInWorkspace(api, invoice);
|
|
28
|
+
* useRecordInWorkspace(api, texts, { title: () => "Textos de la institución" });
|
|
25
29
|
*/
|
|
26
|
-
export function useRecordInWorkspace(api, record) {
|
|
30
|
+
export function useRecordInWorkspace(api, record, options = {}) {
|
|
27
31
|
const display = record.meta?.display || record.meta?.identity || "";
|
|
32
|
+
const named = record.status === "ready" && options.title !== undefined
|
|
33
|
+
? options.title(record.record)
|
|
34
|
+
: null;
|
|
28
35
|
const title = record.isNew
|
|
29
36
|
? newTitle(record.meta, record.locale)
|
|
30
|
-
:
|
|
31
|
-
?
|
|
32
|
-
:
|
|
37
|
+
: named !== null
|
|
38
|
+
? named
|
|
39
|
+
: record.status === "ready" && display !== ""
|
|
40
|
+
? textOf(record.meta, display, record.record[display], record.locale)
|
|
41
|
+
: null;
|
|
33
42
|
const dirty = record.edit.dirty;
|
|
34
43
|
const opened = api.self.id ?? "";
|
|
35
44
|
const { entity, id } = record;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sincpro/web-framework",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.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",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"@opentelemetry/resources": "^3.1.0",
|
|
41
41
|
"@opentelemetry/sdk-trace": "^3.1.0",
|
|
42
42
|
"@sentry/browser": "^11.11.0",
|
|
43
|
-
"@sincpro/client-framework": "^1.
|
|
43
|
+
"@sincpro/client-framework": "^1.10.0",
|
|
44
44
|
"@sincpro/criteria": "^2.1.0",
|
|
45
45
|
"@sincpro/criteria-react": "^2.1.0",
|
|
46
|
-
"@sincpro/web-composer": "^1.
|
|
46
|
+
"@sincpro/web-composer": "^1.7.0",
|
|
47
47
|
"@sincpro/web-ui": "^2.1.0",
|
|
48
48
|
"react": ">=19",
|
|
49
49
|
"react-dom": ">=19"
|
|
@@ -72,11 +72,11 @@
|
|
|
72
72
|
"@opentelemetry/resources": "3.1.0",
|
|
73
73
|
"@opentelemetry/sdk-trace": "3.1.0",
|
|
74
74
|
"@sentry/browser": "11.11.0",
|
|
75
|
-
"@sincpro/client-framework": "^1.
|
|
75
|
+
"@sincpro/client-framework": "^1.10.0",
|
|
76
76
|
"@sincpro/criteria": "^2.1.0",
|
|
77
77
|
"@sincpro/criteria-react": "^2.1.0",
|
|
78
|
-
"@sincpro/web-composer": "^1.
|
|
79
|
-
"@sincpro/web-ui": "^2.
|
|
78
|
+
"@sincpro/web-composer": "^1.7.0",
|
|
79
|
+
"@sincpro/web-ui": "^2.2.0",
|
|
80
80
|
"@storybook/addon-a11y": "10.6.5",
|
|
81
81
|
"@storybook/addon-docs": "10.6.5",
|
|
82
82
|
"@storybook/addon-mcp": "10.6.5",
|