@sincpro/web-framework 3.22.0 → 4.0.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 +114 -112
- package/dist/core/cache.d.ts +20 -23
- package/dist/core/cache.js +37 -52
- package/dist/core/changes.d.ts +10 -18
- package/dist/core/changes.js +11 -30
- package/dist/core/command.d.ts +25 -11
- package/dist/core/command.js +9 -12
- package/dist/core/edit.d.ts +16 -2
- package/dist/core/edit.js +13 -2
- package/dist/core/groups.d.ts +3 -2
- package/dist/core/groups.js +4 -3
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +2 -2
- package/dist/core/list.d.ts +17 -11
- package/dist/core/list.js +17 -11
- package/dist/core/names.d.ts +8 -6
- package/dist/core/names.js +14 -18
- package/dist/core/server.d.ts +9 -7
- package/dist/core/server.js +17 -21
- package/dist/core/trail.d.ts +6 -3
- package/dist/core/trail.js +2 -2
- package/dist/react/context.d.ts +13 -6
- package/dist/react/context.js +11 -9
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/useBatchCommand.d.ts +5 -5
- package/dist/react/useBatchCommand.js +10 -12
- package/dist/react/useCommand.d.ts +11 -15
- package/dist/react/useCommand.js +15 -13
- package/dist/react/useCount.d.ts +2 -2
- package/dist/react/useCounts.js +10 -9
- package/dist/react/useGroups.d.ts +1 -1
- package/dist/react/useGroups.js +22 -13
- package/dist/react/useHistory.js +7 -7
- package/dist/react/useListing.d.ts +14 -7
- package/dist/react/useListing.js +33 -9
- package/dist/react/useLookup.js +5 -7
- package/dist/react/useNameOf.d.ts +2 -2
- package/dist/react/useNameOf.js +4 -13
- package/dist/react/usePivot.d.ts +1 -1
- package/dist/react/usePivot.js +13 -7
- package/dist/react/useRecord.js +37 -55
- package/dist/react/useRecordLifecycle.js +8 -9
- package/dist/react/useServiceReading.js +6 -18
- package/dist/react/useUpload.js +9 -2
- package/dist/react/useWrites.d.ts +13 -12
- package/dist/react/useWrites.js +17 -16
- package/dist/web/board/Dashboard.d.ts +2 -2
- package/dist/web/list/EntityList.d.ts +2 -2
- package/dist/web/list/entityList/choosing.d.ts +3 -3
- package/dist/web/list/entityList/faces.d.ts +6 -6
- package/dist/web/list/entityList/grouping.d.ts +3 -3
- package/dist/web/list/entityList/opening.d.ts +4 -4
- package/dist/web/list/entityList/opening.js +2 -1
- package/dist/web/list/entityList/paging.d.ts +3 -3
- package/dist/web/list/entityList/props.d.ts +4 -4
- package/dist/web/list/entityList/rowActions.d.ts +4 -4
- package/dist/web/list/entityList/rowActions.js +1 -1
- package/dist/web/list/export.d.ts +2 -2
- package/dist/web/list/export.js +7 -8
- package/dist/web/list/presentation.d.ts +3 -3
- package/dist/web/list/records.d.ts +13 -10
- package/dist/web/list/records.js +23 -44
- package/dist/web/list/reorder.d.ts +1 -1
- package/dist/web/list/reorder.js +8 -6
- package/dist/web/list/rowCommands.d.ts +10 -9
- package/dist/web/list/rowCommands.js +14 -15
- package/dist/web/list/useEntityList.d.ts +4 -4
- package/dist/web/record/CommandButton.d.ts +8 -8
- package/dist/web/record/EntityTags.js +4 -4
- package/dist/web/record/RelatedList.js +2 -2
- package/dist/web/record/lines.js +4 -4
- package/dist/web/record/richText.js +1 -1
- package/dist/web/workspace/SincproApp.d.ts +8 -6
- package/dist/web/workspace/SincproApp.js +17 -19
- package/dist/web/workspace/composer.d.ts +14 -9
- package/dist/web/workspace/composer.js +29 -8
- package/dist/web/workspace/record.js +2 -2
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ChangeFeed, type Entity, type Transport } from "@sincpro/client-framework";
|
|
1
|
+
import { type ChangeFeed, type Entity, type OperationTransport, type Transport } from "@sincpro/client-framework";
|
|
2
2
|
import type { Meta } from "@sincpro/criteria";
|
|
3
3
|
import { type ComposerSkin, type OnViewError, type ResourceRef, type ViewSpec, type WorkspaceStore } from "@sincpro/web-composer";
|
|
4
4
|
import { type CacheOptions } from "../../core/cache.js";
|
|
@@ -7,9 +7,11 @@ import type { DateStyle } from "../../core/present.js";
|
|
|
7
7
|
import type { RichTextSettings } from "../../core/richText.js";
|
|
8
8
|
import { type People } from "../../react/context.js";
|
|
9
9
|
import { type ReactNode } from "react";
|
|
10
|
-
export declare function SincproApp({ transport, views, start, language, voice, metas, entities, empty, skin, cache, timeZone, dateStyle, currency, region, richText, uploads, people, events, workspace: given, bar, onViewError, changes, }: {
|
|
11
|
-
/** Who answers
|
|
12
|
-
* face of a product. */
|
|
10
|
+
export declare function SincproApp({ operations, transport, views, start, language, voice, metas, entities, empty, skin, cache, timeZone, dateStyle, currency, region, richText, uploads, people, events, workspace: given, bar, onViewError, changes, }: {
|
|
11
|
+
/** Who answers: the client's operations over its wire (`restOperations(…)`). Without them,
|
|
12
|
+
* the `FrameworkProvider` around the app — one provider for every face of a product. */
|
|
13
|
+
operations?: OperationTransport;
|
|
14
|
+
/** Where a file goes (`uploadTo`): the REST transport, when the app takes files. */
|
|
13
15
|
transport?: Transport;
|
|
14
16
|
/** The entities as composer views — `entityView(…)` — and any other view of the app. */
|
|
15
17
|
views: readonly ViewSpec[];
|
|
@@ -34,7 +36,7 @@ export declare function SincproApp({ transport, views, start, language, voice, m
|
|
|
34
36
|
skin?: ComposerSkin;
|
|
35
37
|
/**
|
|
36
38
|
* Repeated reads served from memory — the list gone back to, the record reopened — and
|
|
37
|
-
* forgotten the moment a write touches their entity (`
|
|
39
|
+
* forgotten the moment a write touches their entity (`cachedOperations`). 30 s by default;
|
|
38
40
|
* `false` asks the server every time.
|
|
39
41
|
*/
|
|
40
42
|
cache?: CacheOptions | false;
|
|
@@ -72,7 +74,7 @@ export declare function SincproApp({ transport, views, start, language, voice, m
|
|
|
72
74
|
onViewError?: OnViewError;
|
|
73
75
|
/**
|
|
74
76
|
* Where writes are announced — the process's (`processChanges`, @sincpro/client-framework),
|
|
75
|
-
* which every
|
|
77
|
+
* which every operation adapter of the framework writes to, whoever sends: a screen, or a use case's
|
|
76
78
|
* generated client. The cache forgets what each write touches, and the screens read it again.
|
|
77
79
|
*/
|
|
78
80
|
changes?: ChangeFeed;
|
|
@@ -3,22 +3,23 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { processChanges, processContext, reportError, } from "@sincpro/client-framework";
|
|
4
4
|
import { Composer, installComposerCopy, SPANISH_COMPOSER_COPY, useWorkspace, } from "@sincpro/web-composer";
|
|
5
5
|
import { createRegistry, formatRef, PHONE_WIDTH } from "@sincpro/web-composer/domain";
|
|
6
|
-
import {
|
|
6
|
+
import { cachedOperations, } from "../../core/cache.js";
|
|
7
7
|
import { installFrameworkCopy, SPANISH_FRAMEWORK_COPY, SPANISH_FRAMEWORK_COPY_TU, } from "../../core/copy.js";
|
|
8
8
|
import { FrameworkProvider, ModelDefinitions, useFrameworkIfAny, } from "../../react/context.js";
|
|
9
9
|
import { useSearchRecords } from "../list/records.js";
|
|
10
|
+
import { WorkspaceModels } from "./composer.js";
|
|
10
11
|
import { webUiSkin } from "./skin.js";
|
|
11
12
|
import { installCopy, SearchProvider, SPANISH_COPY, SPANISH_COPY_TU, ToastProvider, useSearchSettings, } from "@sincpro/web-ui";
|
|
12
13
|
import { useEffect, useMemo, useState, useSyncExternalStore } from "react";
|
|
13
14
|
/**
|
|
14
|
-
* The application context in one place: who answers (the
|
|
15
|
+
* The application context in one place: who answers (the operations), in which language, which
|
|
15
16
|
* model definitions are already known, the toasts, and the workspace with its views, ⌘K and
|
|
16
17
|
* shortcuts.
|
|
17
18
|
*
|
|
18
19
|
* Context: forge's `main.tsx` + `console.tsx` installed three copy tables, a toast provider, a
|
|
19
20
|
* context of its own and a composer by hand. This is that, once. It is a convenience, not the
|
|
20
21
|
* only door: everything it mounts is exported, and an app with its own shell mounts them itself.
|
|
21
|
-
* What it does NOT own: the session (the app builds the
|
|
22
|
+
* What it does NOT own: the session (the app builds the operations with its headers) and what the
|
|
22
23
|
* application bar says. The bar is the app's (`bar`), drawn above the workspace inside every
|
|
23
24
|
* provider; a menu in it opens views through the workspace the app holds (`workspace`, from
|
|
24
25
|
* composer's `useWorkspace()`) — a workspace owned in here could not be reached from outside.
|
|
@@ -26,13 +27,13 @@ import { useEffect, useMemo, useState, useSyncExternalStore } from "react";
|
|
|
26
27
|
* const workspace = useWorkspace();
|
|
27
28
|
* <SincproApp workspace={workspace} bar={<Menu onOpen={(ref) => workspace.push(ref)} />} … />
|
|
28
29
|
*
|
|
29
|
-
* Inside a product with several faces it is ONE of them: without `
|
|
30
|
-
* `FrameworkProvider` around it — its
|
|
30
|
+
* Inside a product with several faces it is ONE of them: without `operations` it joins the
|
|
31
|
+
* `FrameworkProvider` around it — its operations and cache, its context, its zone and currency —
|
|
31
32
|
* and brings only what is its own: its entities, the definitions of their models and their facts
|
|
32
33
|
* (`ModelDefinitions`). The configuration of the provider's (`timeZone`, `currency`, `region`,
|
|
33
34
|
* `dateStyle`, `richText`, `uploads`, `people`, `cache`, `changes`) is then the provider's: said once.
|
|
34
35
|
*
|
|
35
|
-
* <FrameworkProvider
|
|
36
|
+
* <FrameworkProvider operations={operations} timeZone="America/La_Paz" currency="BOB">
|
|
36
37
|
* <Site />
|
|
37
38
|
* <SincproApp views={views} entities={billing.entities} metas={metasOf(billing)} />
|
|
38
39
|
* </FrameworkProvider>
|
|
@@ -53,7 +54,7 @@ const isPhone = () => typeof window !== "undefined" && window.matchMedia !== und
|
|
|
53
54
|
/**
|
|
54
55
|
* The framework's search of a relation's records for every web-ui bar and builder below — a
|
|
55
56
|
* screen's own `SearchBar` included —, unless the application put its own around the app.
|
|
56
|
-
* Inside the `FrameworkProvider`: it searches through the screens'
|
|
57
|
+
* Inside the `FrameworkProvider`: it searches through the screens' operations.
|
|
57
58
|
*/
|
|
58
59
|
function FrameworkSearch({ children }) {
|
|
59
60
|
const framework = useSearchRecords();
|
|
@@ -62,7 +63,7 @@ function FrameworkSearch({ children }) {
|
|
|
62
63
|
}
|
|
63
64
|
/** A view that broke while drawing, told to the process's error reporter: `view <ref>`. */
|
|
64
65
|
const reportViewError = (error, { resource }) => reportError(error, `view ${formatRef(resource)}`);
|
|
65
|
-
export function SincproApp({ transport, views, start, language = "es", voice = "vos", metas, entities, empty, skin = webUiSkin, cache = {}, timeZone, dateStyle, currency, region, richText, uploads, people, events, workspace: given, bar, onViewError = reportViewError, changes = processChanges, }) {
|
|
66
|
+
export function SincproApp({ operations, transport, views, start, language = "es", voice = "vos", metas, entities, empty, skin = webUiSkin, cache = {}, timeZone, dateStyle, currency, region, richText, uploads, people, events, workspace: given, bar, onViewError = reportViewError, changes = processChanges, }) {
|
|
66
67
|
// Installed once, before anything draws: the three tables are module state of their packages.
|
|
67
68
|
useState(() => {
|
|
68
69
|
if (language === "es") {
|
|
@@ -73,17 +74,14 @@ export function SincproApp({ transport, views, start, language = "es", voice = "
|
|
|
73
74
|
return null;
|
|
74
75
|
});
|
|
75
76
|
const around = useFrameworkIfAny();
|
|
76
|
-
if (
|
|
77
|
-
throw new Error("SincproApp needs
|
|
78
|
-
const cached = useMemo(() =>
|
|
79
|
-
?
|
|
80
|
-
:
|
|
81
|
-
...(entities === undefined ? {} : { entities }),
|
|
82
|
-
...cache,
|
|
83
|
-
}),
|
|
77
|
+
if (operations === undefined && around === null)
|
|
78
|
+
throw new Error("SincproApp needs operations, or a FrameworkProvider around it.");
|
|
79
|
+
const cached = useMemo(() => operations === undefined || cache === false
|
|
80
|
+
? operations
|
|
81
|
+
: cachedOperations(operations, cache),
|
|
84
82
|
// The options are read once: a cache that changes shape mid-session forgets everything.
|
|
85
83
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
86
|
-
[
|
|
84
|
+
[operations]);
|
|
87
85
|
// What was read in one company is not the other's, and what anyone wrote is no longer what was
|
|
88
86
|
// read: a change of context forgets every answer, a write what it touched — whoever wrote it, a
|
|
89
87
|
// use case's client as much as a screen — before the screens read again.
|
|
@@ -110,9 +108,9 @@ export function SincproApp({ transport, views, start, language = "es", voice = "
|
|
|
110
108
|
// The first screen only: a re-render must not push it again.
|
|
111
109
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
112
110
|
}, [workspace]);
|
|
113
|
-
const shell = (
|
|
111
|
+
const shell = (_jsxs(FrameworkSearch, { children: [_jsx(WorkspaceModels, {}), _jsx(ToastProvider, { children: _jsxs("div", { className: "flex h-dvh min-h-0 flex-col bg-ground", children: [bar, _jsx("div", { className: "flex min-h-0 flex-1 flex-col", children: _jsx(Composer, { workspace: workspace, registry: registry, skin: skin, onViewError: onViewError, ...(empty === undefined ? {} : { empty }) }) })] }) })] }));
|
|
114
112
|
// One face of a product: the provider around it is the app's, and this brings only its own.
|
|
115
113
|
if (cached === undefined)
|
|
116
114
|
return (_jsx(ModelDefinitions, { ...(entities === undefined ? {} : { entities }), ...(metas === undefined ? {} : { metas }), ...(events === undefined ? {} : { events }), ...(people === undefined ? {} : { people }), children: shell }));
|
|
117
|
-
return (_jsx(FrameworkProvider, {
|
|
115
|
+
return (_jsx(FrameworkProvider, { operations: cached, ...(transport === undefined ? {} : { transport }), locale: language, changes: changes, ...(metas === undefined ? {} : { metas }), ...(entities === undefined ? {} : { entities }), ...(timeZone === undefined ? {} : { timeZone }), dateStyle: dateStyle ?? (phone ? "literal" : "numeric"), ...(currency === undefined ? {} : { currency }), ...(region === undefined ? {} : { region }), ...(richText === undefined ? {} : { richText }), ...(uploads === undefined ? {} : { uploads }), ...(people === undefined ? {} : { people }), ...(events === undefined ? {} : { events }), children: shell }));
|
|
118
116
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Entity, type
|
|
1
|
+
import { type Entity, type OperationTransport } from "@sincpro/client-framework";
|
|
2
2
|
import { type AnyRecord, type Meta } from "@sincpro/criteria";
|
|
3
3
|
import { type ViewProps, type ViewSpec } from "@sincpro/web-composer";
|
|
4
4
|
import { type ListDefinition } from "../../core/list.js";
|
|
@@ -21,20 +21,22 @@ import { type ComponentType } from "react";
|
|
|
21
21
|
* ⌘K asks the server with `matching` — 8 records — the same question a many2one asks. Each hit
|
|
22
22
|
* says what it is (`noun`, composer's) and, beside it, what tells it apart: the entity's own
|
|
23
23
|
* `option` look, else its summary's description or type — never its key, which tells a person
|
|
24
|
-
* nothing a UUID long («María Fernanda Apaza Quispe 01a1ebd4…»).
|
|
25
|
-
*
|
|
26
|
-
* without `tenant_id`
|
|
27
|
-
* `search: {
|
|
24
|
+
* nothing a UUID long («María Fernanda Apaza Quispe 01a1ebd4…»). Its model is `meta`, else the workspace's
|
|
25
|
+
* (`SincproApp`: the contract's, `metasOf`); without one, ⌘K finds nothing of it. A search that answers a SCOPE by a field of its input (forge's projects
|
|
26
|
+
* without `tenant_id` are the projects with NO tenant) is searched in the one ⌘K should see:
|
|
27
|
+
* `search: { input }`.
|
|
28
28
|
*
|
|
29
29
|
* The screens can come in a chunk of their own (`load`): the composer asks for a view's
|
|
30
30
|
* component when it first opens, so the application's bundle does not carry every screen of
|
|
31
31
|
* every entity — `entityView` keeps that, where handing it the components had lost it.
|
|
32
32
|
*
|
|
33
|
-
* entityView(invoices, {
|
|
33
|
+
* entityView(invoices, { operations, name: "Facturas",
|
|
34
34
|
* load: () => import("./invoice_views").then((m) => ({ list: m.Invoices, record: m.Invoice })) })
|
|
35
35
|
*/
|
|
36
36
|
export type EntityViewOptions = {
|
|
37
|
-
|
|
37
|
+
/** What ⌘K's search calls — the screens' operations (`screensOperations`, wrapped here when
|
|
38
|
+
* they are not). */
|
|
39
|
+
operations: OperationTransport;
|
|
38
40
|
/** How it reads in the palette, a panel's frame and the breadcrumb. */
|
|
39
41
|
name: string;
|
|
40
42
|
/** What ONE of its records is called — «Colegiado» —, beside each record ⌘K finds, so two
|
|
@@ -54,9 +56,10 @@ export type EntityViewOptions = {
|
|
|
54
56
|
* `useRecordInWorkspace` / `useRecordScreen`. */
|
|
55
57
|
title?: (record: AnyRecord) => string | null;
|
|
56
58
|
actions?: ViewSpec["actions"];
|
|
57
|
-
/** ⌘K's question: the
|
|
59
|
+
/** ⌘K's question: the fields of the search's input, beside the criteria, that say which
|
|
60
|
+
* records it searches. */
|
|
58
61
|
search?: {
|
|
59
|
-
|
|
62
|
+
input?: Readonly<Record<string, unknown>>;
|
|
60
63
|
};
|
|
61
64
|
/** The screens, loaded when the view first opens — a dynamic `import()`. What it does not
|
|
62
65
|
* bring is `list` / `record`, or the defaults. */
|
|
@@ -65,6 +68,8 @@ export type EntityViewOptions = {
|
|
|
65
68
|
record?: ComponentType<ViewProps>;
|
|
66
69
|
}>;
|
|
67
70
|
};
|
|
71
|
+
/** Inside the `FrameworkProvider`: hands its models to the views' searches while mounted. */
|
|
72
|
+
export declare function WorkspaceModels(): null;
|
|
68
73
|
export declare function entityView<T extends AnyRecord>(entity: Entity<T>, options: EntityViewOptions): ViewSpec;
|
|
69
74
|
/**
|
|
70
75
|
* A named list as a view of its own: «Por cobrar» in ⌘K's «Go to», its own breadcrumb, the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { isEntityId,
|
|
3
|
+
import { isEntityId, NEW_PARAM, processContext, scopeNameOf, scopeOfRef, screensOperations, } from "@sincpro/client-framework";
|
|
4
4
|
import { nameOf } from "@sincpro/criteria";
|
|
5
5
|
import { usePhone, } from "@sincpro/web-composer";
|
|
6
6
|
import { CHOOSE_MANY } from "../../core/list.js";
|
|
@@ -13,7 +13,7 @@ import { RecordOpeningProvider, } from "../record/opening.js";
|
|
|
13
13
|
import { openIn, RECORD_SIZE, targetsFor } from "./open.js";
|
|
14
14
|
import { EntityRecord } from "./RecordScreen.js";
|
|
15
15
|
import { useToastIfAny } from "@sincpro/web-ui";
|
|
16
|
-
import { useMemo } from "react";
|
|
16
|
+
import { useEffect, useMemo } from "react";
|
|
17
17
|
/**
|
|
18
18
|
* The fields of a view open their records in the workspace: a modal over this surface by
|
|
19
19
|
* default, beside it from inside a modal, «Buscar más…» as the entity's list that answers, and
|
|
@@ -40,10 +40,10 @@ function InWorkspace({ api, children }) {
|
|
|
40
40
|
};
|
|
41
41
|
}, [api, targets]);
|
|
42
42
|
// «Buscar más…» in the view's search bars: the same choosers, named by the framework's book.
|
|
43
|
-
const {
|
|
43
|
+
const { operations, metas, names, entities } = useFramework();
|
|
44
44
|
const named = useSearchRecords();
|
|
45
45
|
const toast = useToastIfAny();
|
|
46
|
-
const browser = useMemo(() => recordsBrowser({
|
|
46
|
+
const browser = useMemo(() => recordsBrowser({ operations, metas, names, entities }, opening, named, (failure) => toast?.show(refusalNotice(failure))), [operations, metas, names, entities, opening, named, toast]);
|
|
47
47
|
return (_jsx(RecordOpeningProvider, { value: opening, children: _jsx(RecordsBrowserProvider, { value: browser, children: children }) }));
|
|
48
48
|
}
|
|
49
49
|
/** The entity's list when the application writes none: opened under a named cut, it says
|
|
@@ -61,6 +61,25 @@ function recordOf(entity, title) {
|
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
/** The language the screens speak now — the provider puts it in the process's context. */
|
|
64
|
+
/**
|
|
65
|
+
* The models the mounted workspace knows — its `FrameworkProvider`'s store, the contract's
|
|
66
|
+
* (`metasOf`) and what the screens learned —, for ⌘K: a view searches outside React, before any of
|
|
67
|
+
* its screens is open. Set by `SincproApp` (`WorkspaceModels`); an application that mounts the
|
|
68
|
+
* composer itself gives each view its `meta`.
|
|
69
|
+
*/
|
|
70
|
+
const mounted = { metas: null };
|
|
71
|
+
/** Inside the `FrameworkProvider`: hands its models to the views' searches while mounted. */
|
|
72
|
+
export function WorkspaceModels() {
|
|
73
|
+
const { metas } = useFramework();
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
mounted.metas = metas;
|
|
76
|
+
return () => {
|
|
77
|
+
if (mounted.metas === metas)
|
|
78
|
+
mounted.metas = null;
|
|
79
|
+
};
|
|
80
|
+
}, [metas]);
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
64
83
|
function localeNow() {
|
|
65
84
|
const lang = processContext.get("lang");
|
|
66
85
|
return typeof lang === "string" && lang !== "" ? lang : undefined;
|
|
@@ -80,7 +99,8 @@ function titleOf(ref, name) {
|
|
|
80
99
|
}
|
|
81
100
|
export function entityView(entity, options) {
|
|
82
101
|
let meta = options.meta ?? null;
|
|
83
|
-
const
|
|
102
|
+
const operations = screensOperations(options.operations);
|
|
103
|
+
const input = options.search?.input ?? {};
|
|
84
104
|
async function screens() {
|
|
85
105
|
const loaded = options.load === undefined ? {} : await options.load();
|
|
86
106
|
const List = loaded.list ?? options.list ?? listOf(entity, options.name);
|
|
@@ -114,13 +134,14 @@ export function entityView(entity, options) {
|
|
|
114
134
|
search: async (query) => {
|
|
115
135
|
if (query.trim() === "")
|
|
116
136
|
return [];
|
|
117
|
-
|
|
118
|
-
meta = (await options.transport.list(route, { pagination: { limit: 1 } })).meta;
|
|
137
|
+
meta ??= mounted.metas?.get(entity.key) ?? null;
|
|
119
138
|
if (meta?.search == null)
|
|
120
139
|
return [];
|
|
121
140
|
// A hit reads as a choice anywhere a record is picked by name: its name and what tells it
|
|
122
141
|
// apart, never its key (`findChoices`).
|
|
123
|
-
const choices = await findChoices(
|
|
142
|
+
const choices = await findChoices(operations, entity, meta, query, localeNow(), {
|
|
143
|
+
input,
|
|
144
|
+
});
|
|
124
145
|
return choices.map((one) => ({
|
|
125
146
|
ref: entity.ref(one.id),
|
|
126
147
|
label: one.name,
|
|
@@ -57,13 +57,13 @@ export function useRecordScreen(entity, { api, resource }, options = {}) {
|
|
|
57
57
|
const summarize = useSummaryOf(entity);
|
|
58
58
|
const copy = frameworkCopy().record;
|
|
59
59
|
// Opened from a list: where it stands in it, and its neighbours (`Trail`).
|
|
60
|
-
const { trails,
|
|
60
|
+
const { trails, operations } = useFramework();
|
|
61
61
|
const trailKey = resource.params?.[TRAIL_PARAM];
|
|
62
62
|
const trail = trailKey === undefined ? undefined : trails.get(trailKey);
|
|
63
63
|
const go = (step) => () => {
|
|
64
64
|
if (trail === undefined || trailKey === undefined)
|
|
65
65
|
return;
|
|
66
|
-
void stepIn(
|
|
66
|
+
void stepIn(operations, trail, reading.id, step).then((moved) => {
|
|
67
67
|
if (moved === null)
|
|
68
68
|
return;
|
|
69
69
|
trails.set(trailKey, moved.trail);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sincpro/web-framework",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.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",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@opentelemetry/sdk-trace": "^3.1.0",
|
|
52
52
|
"@sentry/browser": "^11.11.0",
|
|
53
53
|
"@sentry/core": "^11.11.0",
|
|
54
|
-
"@sincpro/client-framework": "^
|
|
54
|
+
"@sincpro/client-framework": "^3.1.0",
|
|
55
55
|
"@sincpro/criteria": "^2.6.0",
|
|
56
56
|
"@sincpro/criteria-react": "^2.5.1",
|
|
57
57
|
"@sincpro/web-composer": "^1.7.0",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"@opentelemetry/sdk-trace": "3.1.0",
|
|
96
96
|
"@sentry/browser": "11.11.0",
|
|
97
97
|
"@sentry/core": "11.11.0",
|
|
98
|
-
"@sincpro/client-framework": "^
|
|
98
|
+
"@sincpro/client-framework": "^3.1.0",
|
|
99
99
|
"@sincpro/criteria": "^2.6.0",
|
|
100
100
|
"@sincpro/criteria-react": "^2.5.1",
|
|
101
101
|
"@sincpro/web-composer": "^1.9.0",
|