@sincpro/web-framework 0.4.0 → 0.4.1
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/dist/core/cache.d.ts +10 -2
- package/dist/core/cache.js +31 -9
- package/dist/core/copy.d.ts +4 -0
- package/dist/core/copy.js +4 -0
- package/dist/core/edit.d.ts +5 -0
- package/dist/core/edit.js +6 -2
- package/dist/core/entity.d.ts +21 -2
- package/dist/core/entity.js +30 -3
- package/dist/core/history.js +5 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/useCommand.js +1 -1
- package/dist/react/useListing.d.ts +1 -1
- package/dist/react/useListing.js +2 -7
- package/dist/react/useLookup.d.ts +10 -1
- package/dist/react/useLookup.js +29 -3
- package/dist/react/useRecord.d.ts +7 -2
- package/dist/react/useRecord.js +42 -20
- package/dist/web/list/rowCommands.js +2 -1
- package/dist/web/record/CommandButton.d.ts +3 -1
- package/dist/web/record/CommandButton.js +2 -2
- package/dist/web/record/EntityPicker.d.ts +15 -3
- package/dist/web/record/EntityPicker.js +35 -14
- package/dist/web/workspace/SincproApp.d.ts +15 -4
- package/dist/web/workspace/SincproApp.js +18 -7
- package/dist/web/workspace/composer.d.ts +20 -1
- package/dist/web/workspace/composer.js +22 -9
- package/dist/web/workspace/record.js +12 -2
- package/package.json +3 -3
package/dist/core/cache.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Entity } from "./entity.js";
|
|
1
2
|
import type { Transport } from "./transport.js";
|
|
2
3
|
/**
|
|
3
4
|
* A transport that remembers what it read, for a while, and forgets it when something writes.
|
|
@@ -13,12 +14,17 @@ import type { Transport } from "./transport.js";
|
|
|
13
14
|
* different filters, orders or pages never share an answer. A read that fails is not kept.
|
|
14
15
|
* Only completed answers are remembered: a request aborted half-way is simply not cached.
|
|
15
16
|
*
|
|
17
|
+
* A write forgets every collection its route NAMES, not only the first: «leave a tenant»
|
|
18
|
+
* (`POST /users/{email}/tenants/{tenant}/leave`) changes the tenant's members as much as the
|
|
19
|
+
* user. And an entity's business events live on a route of their own (`/project-events`): with
|
|
20
|
+
* `entities`, a write under an entity's list also forgets its history.
|
|
21
|
+
*
|
|
16
22
|
* const transport = cachedTransport(restTransport({ base: "/v1" }), { ttl: 30_000 });
|
|
17
23
|
* transport.invalidate("/facturas"); // forget an entity by hand (a push from the server)
|
|
18
24
|
*/
|
|
19
25
|
export type CachedTransport = Transport & {
|
|
20
|
-
/** Forget every answer whose route
|
|
21
|
-
* every page and filter of it, and every record under it
|
|
26
|
+
/** Forget every answer whose route lies under this path: `"/facturas"` forgets the list,
|
|
27
|
+
* every page and filter of it, and every record under it — not `"/facturas-events"`. */
|
|
22
28
|
invalidate: (path?: string) => void;
|
|
23
29
|
};
|
|
24
30
|
export type CacheOptions = {
|
|
@@ -26,5 +32,7 @@ export type CacheOptions = {
|
|
|
26
32
|
ttl?: number;
|
|
27
33
|
/** The clock — for tests. */
|
|
28
34
|
now?: () => number;
|
|
35
|
+
/** The application's entities: a write to one also forgets its history route. */
|
|
36
|
+
entities?: readonly Entity[];
|
|
29
37
|
};
|
|
30
38
|
export declare function cachedTransport(transport: Transport, options?: CacheOptions): CachedTransport;
|
package/dist/core/cache.js
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
function pathOf(route) {
|
|
2
|
+
return route.split("?")[0] ?? route;
|
|
3
|
+
}
|
|
4
|
+
/** `route` is `path` or lies under it: `"/facturas"` holds `"/facturas/F-1"`, never `"/facturas-events"`. */
|
|
5
|
+
function under(route, path) {
|
|
6
|
+
const own = pathOf(route);
|
|
7
|
+
return own === path || own.startsWith(path.endsWith("/") ? path : `${path}/`);
|
|
8
|
+
}
|
|
9
|
+
/** What a write may have changed: every segment of its route as a collection, and the history
|
|
10
|
+
* of each entity it writes under. A segment that is a key (`/F-1`) forgets nothing. */
|
|
11
|
+
function touchedBy(route, entities) {
|
|
12
|
+
const path = pathOf(route);
|
|
13
|
+
const segments = path.split("/").filter((one) => one !== "");
|
|
14
|
+
const history = entities
|
|
15
|
+
.filter((one) => one.history !== undefined && under(path, pathOf(one.list)))
|
|
16
|
+
.map((one) => pathOf(one.history?.route ?? ""));
|
|
17
|
+
return [...segments.map((one) => `/${one}`), ...history];
|
|
6
18
|
}
|
|
7
19
|
export function cachedTransport(transport, options = {}) {
|
|
8
20
|
const ttl = options.ttl ?? 30_000;
|
|
@@ -16,12 +28,22 @@ export function cachedTransport(transport, options = {}) {
|
|
|
16
28
|
entries.set(key, { at: now(), answer });
|
|
17
29
|
return answer;
|
|
18
30
|
}
|
|
31
|
+
const entities = options.entities ?? [];
|
|
32
|
+
/** Forget every answer under any of `paths` — one walk over the entries, whatever their
|
|
33
|
+
* number. A path with a query (`/projects?tenant_id=acme`) forgets its whole collection. */
|
|
34
|
+
const forget = (paths) => {
|
|
35
|
+
const targets = paths.map(pathOf);
|
|
36
|
+
for (const key of [...entries.keys()]) {
|
|
37
|
+
// `list <route> <criteria>` / `one <route>`: the route is the second word.
|
|
38
|
+
const route = key.split(" ", 2)[1] ?? "";
|
|
39
|
+
if (targets.some((path) => under(route, path)))
|
|
40
|
+
entries.delete(key);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
19
43
|
const invalidate = (path) => {
|
|
20
44
|
if (path === undefined)
|
|
21
45
|
return entries.clear();
|
|
22
|
-
|
|
23
|
-
if (key.slice(key.indexOf(" ") + 1).startsWith(path))
|
|
24
|
-
entries.delete(key);
|
|
46
|
+
forget([path]);
|
|
25
47
|
};
|
|
26
48
|
return {
|
|
27
49
|
list(route, criteria, signal) {
|
|
@@ -39,7 +61,7 @@ export function cachedTransport(transport, options = {}) {
|
|
|
39
61
|
finally {
|
|
40
62
|
// Even a refused write may have changed something (a 409 says someone else did).
|
|
41
63
|
if (!preview)
|
|
42
|
-
|
|
64
|
+
forget(touchedBy(route, entities));
|
|
43
65
|
}
|
|
44
66
|
},
|
|
45
67
|
invalidate,
|
package/dist/core/copy.d.ts
CHANGED
|
@@ -59,6 +59,8 @@ export type FrameworkCopy = {
|
|
|
59
59
|
picker: {
|
|
60
60
|
/** The button beside a many2one that opens the chooser over the whole set. */
|
|
61
61
|
browse: string;
|
|
62
|
+
/** The choice of nothing, when a field may be left empty (`EntityPicker none`). */
|
|
63
|
+
none: string;
|
|
62
64
|
};
|
|
63
65
|
summary: {
|
|
64
66
|
/** The facts of a record's summary: when it was made and last changed. */
|
|
@@ -69,6 +71,8 @@ export type FrameworkCopy = {
|
|
|
69
71
|
/** A card's last line: «Updated 12 Mar 2026 by Ana», or «Created …» if never changed. */
|
|
70
72
|
updatedLine: (at: string, by: string | null) => string;
|
|
71
73
|
createdLine: (at: string, by: string | null) => string;
|
|
74
|
+
/** A fact of a record's history that carries no label of its own. */
|
|
75
|
+
recorded: string;
|
|
72
76
|
};
|
|
73
77
|
command: {
|
|
74
78
|
/** The confirmation of an action that cannot be undone, after its dry run. */
|
package/dist/core/copy.js
CHANGED
|
@@ -33,6 +33,7 @@ export const ENGLISH_FRAMEWORK_COPY = {
|
|
|
33
33
|
},
|
|
34
34
|
picker: {
|
|
35
35
|
browse: "Search all",
|
|
36
|
+
none: "None",
|
|
36
37
|
},
|
|
37
38
|
summary: {
|
|
38
39
|
created: "Created",
|
|
@@ -40,6 +41,7 @@ export const ENGLISH_FRAMEWORK_COPY = {
|
|
|
40
41
|
when: (at, by) => (by === null ? at : `${at} · ${by}`),
|
|
41
42
|
updatedLine: (at, by) => (by === null ? `Updated ${at}` : `Updated ${at} by ${by}`),
|
|
42
43
|
createdLine: (at, by) => (by === null ? `Created ${at}` : `Created ${at} by ${by}`),
|
|
44
|
+
recorded: "Change recorded",
|
|
43
45
|
},
|
|
44
46
|
command: {
|
|
45
47
|
confirm: "Do it",
|
|
@@ -101,6 +103,7 @@ export const SPANISH_FRAMEWORK_COPY = {
|
|
|
101
103
|
},
|
|
102
104
|
picker: {
|
|
103
105
|
browse: "Buscar en todos",
|
|
106
|
+
none: "Ninguno",
|
|
104
107
|
},
|
|
105
108
|
summary: {
|
|
106
109
|
created: "Creado",
|
|
@@ -108,6 +111,7 @@ export const SPANISH_FRAMEWORK_COPY = {
|
|
|
108
111
|
when: (at, by) => (by === null ? at : `${at} · ${by}`),
|
|
109
112
|
updatedLine: (at, by) => by === null ? `Actualizado el ${at}` : `Actualizado el ${at} por ${by}`,
|
|
110
113
|
createdLine: (at, by) => (by === null ? `Creado el ${at}` : `Creado el ${at} por ${by}`),
|
|
114
|
+
recorded: "Cambio registrado",
|
|
111
115
|
},
|
|
112
116
|
command: {
|
|
113
117
|
confirm: "Hacerlo",
|
package/dist/core/edit.d.ts
CHANGED
|
@@ -68,5 +68,10 @@ export declare function defaultsOf(meta: Meta | null | undefined): AnyRecord;
|
|
|
68
68
|
* What a create sends: every value on screen the caller may write. A field the model marks
|
|
69
69
|
* `readonly` is the server's to fill (the number, the totals), and an empty one is left for
|
|
70
70
|
* the server's own default — never sent as `""`.
|
|
71
|
+
*
|
|
72
|
+
* Context: only the model's fixed `readonly` counts, never a `readonly_when`: a currency chosen
|
|
73
|
+
* and then locked by the lines added after it is still the record's currency, and a key written
|
|
74
|
+
* when creating and never after (a tenant's slug) is a `readonly_when` the backend publishes for
|
|
75
|
+
* the stored record. Both travel.
|
|
71
76
|
*/
|
|
72
77
|
export declare function creationOf(meta: Meta | null | undefined, values: AnyRecord): AnyRecord;
|
package/dist/core/edit.js
CHANGED
|
@@ -110,12 +110,16 @@ export function defaultsOf(meta) {
|
|
|
110
110
|
* What a create sends: every value on screen the caller may write. A field the model marks
|
|
111
111
|
* `readonly` is the server's to fill (the number, the totals), and an empty one is left for
|
|
112
112
|
* the server's own default — never sent as `""`.
|
|
113
|
+
*
|
|
114
|
+
* Context: only the model's fixed `readonly` counts, never a `readonly_when`: a currency chosen
|
|
115
|
+
* and then locked by the lines added after it is still the record's currency, and a key written
|
|
116
|
+
* when creating and never after (a tenant's slug) is a `readonly_when` the backend publishes for
|
|
117
|
+
* the stored record. Both travel.
|
|
113
118
|
*/
|
|
114
119
|
export function creationOf(meta, values) {
|
|
115
120
|
const sent = {};
|
|
116
121
|
for (const [name, value] of Object.entries(values)) {
|
|
117
|
-
|
|
118
|
-
if (field?.readonly === true)
|
|
122
|
+
if (meta?.fields[name]?.readonly === true)
|
|
119
123
|
continue;
|
|
120
124
|
if (value === undefined || value === null || value === "")
|
|
121
125
|
continue;
|
package/dist/core/entity.d.ts
CHANGED
|
@@ -50,6 +50,10 @@ export type Entity<T extends AnyRecord = AnyRecord> = {
|
|
|
50
50
|
preview?: WriteRoute;
|
|
51
51
|
/** Where this caller keeps an edit between requests — sincpro_framework's `Drafts`. */
|
|
52
52
|
draft?: WriteRoute;
|
|
53
|
+
/** sincpro_framework's `Edit`: ONE route that keeps the draft, saves and discards, by its
|
|
54
|
+
* `action`. Declared, a save sends the record whole as the form holds it — not the fields
|
|
55
|
+
* that changed under `save` — and it is also where the draft is kept. */
|
|
56
|
+
edit?: WriteRoute;
|
|
53
57
|
/** Its business events: the context's events route, and the `entity_type` they carry. */
|
|
54
58
|
history?: {
|
|
55
59
|
route: string;
|
|
@@ -108,6 +112,8 @@ export type EntityRoutes = {
|
|
|
108
112
|
save?: string;
|
|
109
113
|
preview?: string;
|
|
110
114
|
draft?: string;
|
|
115
|
+
/** `"PUT /invoices/{id}/edit"`: the use case that answers sincpro_framework's `Edit`. */
|
|
116
|
+
edit?: string;
|
|
111
117
|
history?: {
|
|
112
118
|
route: string;
|
|
113
119
|
type: string;
|
|
@@ -120,6 +126,19 @@ export type EntityRoutes = {
|
|
|
120
126
|
};
|
|
121
127
|
/** `"POST /invoices/{id}/confirm"` → its method and path. A write without a method is a bug. */
|
|
122
128
|
export declare function writeRoute(text: string): WriteRoute;
|
|
123
|
-
/**
|
|
124
|
-
|
|
129
|
+
/**
|
|
130
|
+
* The path with the record's key in place of `{id}`, and every other `{name}` taken from the
|
|
131
|
+
* body's field of that name: `POST /projects/{id}/shares/{tenant_id}/revoke` with
|
|
132
|
+
* `{ tenant_id: "acme" }`.
|
|
133
|
+
*
|
|
134
|
+
* Context: sincpro_framework reads a path parameter as a field of the use case's DTO (its
|
|
135
|
+
* wire merges `{...body, ...path_params}`), so the body already names every key a route
|
|
136
|
+
* needs — a second argument for them would say the same thing twice. A key the body lacks is
|
|
137
|
+
* the screen's bug, said before anything is sent. Without an `id`, `{id}` stays: a create or a
|
|
138
|
+
* preview of a new record has none.
|
|
139
|
+
*/
|
|
140
|
+
export declare function pathFor(route: WriteRoute, id?: string, body?: AnyRecord): string;
|
|
141
|
+
/** A list's route with its own parameters: `{ tenant_id: "acme" }` → `/projects?tenant_id=acme`.
|
|
142
|
+
* An empty value is no parameter — a filter left blank. */
|
|
143
|
+
export declare function listRoute(list: string, params?: Readonly<Record<string, string>>): string;
|
|
125
144
|
export declare function entity<T extends AnyRecord = AnyRecord>(key: string, routes: EntityRoutes): Entity<T>;
|
package/dist/core/entity.js
CHANGED
|
@@ -40,9 +40,35 @@ export function writeRoute(text) {
|
|
|
40
40
|
throw new Error(`"${text}" is not "METHOD /path": a write says how it is sent`);
|
|
41
41
|
return { method: method, path };
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
const PATH_KEY = /\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
|
|
44
|
+
/**
|
|
45
|
+
* The path with the record's key in place of `{id}`, and every other `{name}` taken from the
|
|
46
|
+
* body's field of that name: `POST /projects/{id}/shares/{tenant_id}/revoke` with
|
|
47
|
+
* `{ tenant_id: "acme" }`.
|
|
48
|
+
*
|
|
49
|
+
* Context: sincpro_framework reads a path parameter as a field of the use case's DTO (its
|
|
50
|
+
* wire merges `{...body, ...path_params}`), so the body already names every key a route
|
|
51
|
+
* needs — a second argument for them would say the same thing twice. A key the body lacks is
|
|
52
|
+
* the screen's bug, said before anything is sent. Without an `id`, `{id}` stays: a create or a
|
|
53
|
+
* preview of a new record has none.
|
|
54
|
+
*/
|
|
55
|
+
export function pathFor(route, id, body) {
|
|
56
|
+
return route.path.replace(PATH_KEY, (whole, name) => {
|
|
57
|
+
if (name === "id")
|
|
58
|
+
return id === undefined ? whole : encodeURIComponent(id);
|
|
59
|
+
const value = body?.[name];
|
|
60
|
+
if (value === undefined || value === null || value === "")
|
|
61
|
+
throw new Error(`"${route.method} ${route.path}" needs "${name}" in the body`);
|
|
62
|
+
return encodeURIComponent(String(value));
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/** A list's route with its own parameters: `{ tenant_id: "acme" }` → `/projects?tenant_id=acme`.
|
|
66
|
+
* An empty value is no parameter — a filter left blank. */
|
|
67
|
+
export function listRoute(list, params) {
|
|
68
|
+
const query = new URLSearchParams(Object.entries(params ?? {}).filter(([, value]) => value !== "")).toString();
|
|
69
|
+
if (query === "")
|
|
70
|
+
return list;
|
|
71
|
+
return `${list}${list.includes("?") ? "&" : "?"}${query}`;
|
|
46
72
|
}
|
|
47
73
|
export function entity(key, routes) {
|
|
48
74
|
if (!/^[^:\s]+:[^:\s]+$/.test(key))
|
|
@@ -82,6 +108,7 @@ export function entity(key, routes) {
|
|
|
82
108
|
...(routes.save === undefined ? {} : { save: writeRoute(routes.save) }),
|
|
83
109
|
...(routes.preview === undefined ? {} : { preview: writeRoute(routes.preview) }),
|
|
84
110
|
...(routes.draft === undefined ? {} : { draft: writeRoute(routes.draft) }),
|
|
111
|
+
...(routes.edit === undefined ? {} : { edit: writeRoute(routes.edit) }),
|
|
85
112
|
...(routes.history === undefined ? {} : { history: routes.history }),
|
|
86
113
|
summary: routes.summary ?? {},
|
|
87
114
|
...(routes.aggregate === undefined ? {} : { aggregate: routes.aggregate }),
|
package/dist/core/history.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { labelOf } from "@sincpro/criteria";
|
|
2
|
+
import { frameworkCopy } from "./copy.js";
|
|
2
3
|
/** What every fact carries: what remains is what this fact says. */
|
|
3
4
|
const ENVELOPE = new Set([
|
|
4
5
|
"id",
|
|
@@ -24,7 +25,10 @@ export function historyOf(rows, meta, locale) {
|
|
|
24
25
|
const label = row["label"];
|
|
25
26
|
const word = typeof label === "string"
|
|
26
27
|
? label
|
|
27
|
-
:
|
|
28
|
+
: // A fact without a label is still a change; its id is not a word anyone reads.
|
|
29
|
+
((locale ? label?.[locale] : undefined) ??
|
|
30
|
+
label?.["default"] ??
|
|
31
|
+
frameworkCopy().summary.recorded);
|
|
28
32
|
const parts = Object.entries(row)
|
|
29
33
|
.filter(([key]) => !ENVELOPE.has(key))
|
|
30
34
|
.map(([key, value]) => [key, said(value)])
|
package/dist/core/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
export { type CachedTransport, cachedTransport, type CacheOptions, } from "./cache.js";
|
|
7
7
|
export { ENGLISH_FRAMEWORK_COPY, type FrameworkCopy, frameworkCopy, installFrameworkCopy, SPANISH_FRAMEWORK_COPY, } from "./copy.js";
|
|
8
8
|
export { type Advice, adviceAt, changesOf, creationOf, defaultsOf, errorAt, errorsByField, type FieldState, fieldStateOf, type FieldStates, lineStatesOf, missingOf, pathOf, type ServerFieldState, } from "./edit.js";
|
|
9
|
-
export { type Entity, entity, type EntityRef, type EntityRoutes, NEW_PARAM, pathFor, PICK_PARAM, QUERY_PARAM, startingValuesOf, TRAIL_PARAM, WITH_PARAM, type WriteRoute, writeRoute, } from "./entity.js";
|
|
9
|
+
export { type Entity, entity, type EntityRef, type EntityRoutes, listRoute, NEW_PARAM, pathFor, PICK_PARAM, QUERY_PARAM, startingValuesOf, TRAIL_PARAM, WITH_PARAM, type WriteRoute, writeRoute, } from "./entity.js";
|
|
10
10
|
export { type FormLayout, formOf } from "./form.js";
|
|
11
11
|
export { type HistoryEntry, historyOf } from "./history.js";
|
|
12
12
|
export { addingOf, type AddingRule, blankLine, type Declared, editableLines, type LineAdding, lineFields, lineKey, linesAnswered, moved, sameLine, writtenInCell, } from "./lines.js";
|
package/dist/core/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
export { cachedTransport, } from "./cache.js";
|
|
7
7
|
export { ENGLISH_FRAMEWORK_COPY, frameworkCopy, installFrameworkCopy, SPANISH_FRAMEWORK_COPY, } from "./copy.js";
|
|
8
8
|
export { adviceAt, changesOf, creationOf, defaultsOf, errorAt, errorsByField, fieldStateOf, lineStatesOf, missingOf, pathOf, } from "./edit.js";
|
|
9
|
-
export { entity, NEW_PARAM, pathFor, PICK_PARAM, QUERY_PARAM, startingValuesOf, TRAIL_PARAM, WITH_PARAM, writeRoute, } from "./entity.js";
|
|
9
|
+
export { entity, listRoute, NEW_PARAM, pathFor, PICK_PARAM, QUERY_PARAM, startingValuesOf, TRAIL_PARAM, WITH_PARAM, writeRoute, } from "./entity.js";
|
|
10
10
|
export { formOf } from "./form.js";
|
|
11
11
|
export { historyOf } from "./history.js";
|
|
12
12
|
export { addingOf, blankLine, editableLines, lineFields, lineKey, linesAnswered, moved, sameLine, writtenInCell, } from "./lines.js";
|
package/dist/react/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { type CommandState, type Rehearsal, useCommand, } from "./useCommand.js"
|
|
|
8
8
|
export { type Groups, useGroups } from "./useGroups.js";
|
|
9
9
|
export { useHistory } from "./useHistory.js";
|
|
10
10
|
export { type Listing, type ListingOptions, type Paging, useListing, } from "./useListing.js";
|
|
11
|
-
export { type Lookup, useLookup } from "./useLookup.js";
|
|
11
|
+
export { excluding, type Lookup, useLookup } from "./useLookup.js";
|
|
12
12
|
export { type PivotAxes, type PivotReading, usePivot, } from "./usePivot.js";
|
|
13
13
|
export { type Editing, type RecordReading, type RecordState, useRecord, } from "./useRecord.js";
|
|
14
14
|
export { useRelated } from "./useRelated.js";
|
package/dist/react/index.js
CHANGED
|
@@ -8,7 +8,7 @@ export { useCommand, } from "./useCommand.js";
|
|
|
8
8
|
export { useGroups } from "./useGroups.js";
|
|
9
9
|
export { useHistory } from "./useHistory.js";
|
|
10
10
|
export { useListing, } from "./useListing.js";
|
|
11
|
-
export { useLookup } from "./useLookup.js";
|
|
11
|
+
export { excluding, useLookup } from "./useLookup.js";
|
|
12
12
|
export { usePivot, } from "./usePivot.js";
|
|
13
13
|
export { useRecord, } from "./useRecord.js";
|
|
14
14
|
export { useRelated } from "./useRelated.js";
|
package/dist/react/useCommand.js
CHANGED
|
@@ -26,7 +26,7 @@ export function useCommand(entity, name) {
|
|
|
26
26
|
setError(null);
|
|
27
27
|
const idempotencyKey = gesture.keyFor({ id, body });
|
|
28
28
|
try {
|
|
29
|
-
const answer = await transport.send(route.method, pathFor(route, id), body, undefined, { idempotencyKey });
|
|
29
|
+
const answer = await transport.send(route.method, pathFor(route, id, body), body, undefined, { idempotencyKey });
|
|
30
30
|
gesture.settle(null);
|
|
31
31
|
return answer;
|
|
32
32
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AnyRecord, type Count, type Criteria, type Dropped, type Expression, type Meta, type ReadingStatus, type Sort } from "@sincpro/criteria";
|
|
2
|
-
import type
|
|
2
|
+
import { type Entity } from "../core/entity.js";
|
|
3
3
|
import { type ListDefinition } from "../core/list.js";
|
|
4
4
|
/**
|
|
5
5
|
* N records of an entity, live: what a list draws and the gestures that drive it.
|
package/dist/react/useListing.js
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { merge, resource, resumingFrom, searchOver, } from "@sincpro/criteria";
|
|
3
3
|
import { useReading } from "@sincpro/criteria-react";
|
|
4
|
+
import { listRoute } from "../core/entity.js";
|
|
4
5
|
import { isList, scopeOf } from "../core/list.js";
|
|
5
6
|
import { useFramework } from "./context.js";
|
|
6
7
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
7
8
|
/** How long typing has to pause before the search goes out. */
|
|
8
9
|
const TYPING_PAUSE = 200;
|
|
9
|
-
function routeOf(list, params) {
|
|
10
|
-
const query = new URLSearchParams(Object.entries(params ?? {}).filter(([, value]) => value !== "")).toString();
|
|
11
|
-
if (query === "")
|
|
12
|
-
return list;
|
|
13
|
-
return `${list}${list.includes("?") ? "&" : "?"}${query}`;
|
|
14
|
-
}
|
|
15
10
|
export function useListing(given, own = {}) {
|
|
16
11
|
const { transport, locale, metas } = useFramework();
|
|
17
12
|
// A named list is its entity under a fixed scope: the scope ANDs under the caller's own.
|
|
@@ -25,7 +20,7 @@ export function useListing(given, own = {}) {
|
|
|
25
20
|
? scopeOf(definition)
|
|
26
21
|
: merge(scopeOf(definition), own.criteria),
|
|
27
22
|
};
|
|
28
|
-
const route =
|
|
23
|
+
const route = listRoute(entity.list, options.params);
|
|
29
24
|
const source = useMemo(() => resource((criteria, signal) => transport.list(route, criteria, signal)), [transport, route]);
|
|
30
25
|
// Decided once, at mount: a definition already known means the server is not asked for it
|
|
31
26
|
// again. Deciding it later would change the criteria and restart the reading.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AnyRecord, type Criteria, type Meta } from "@sincpro/criteria";
|
|
2
2
|
import type { Entity } from "../core/entity.js";
|
|
3
3
|
import { type ListDefinition } from "../core/list.js";
|
|
4
4
|
import { type LookupOption } from "../core/lookup.js";
|
|
@@ -14,6 +14,11 @@ import { type LookupOption } from "../core/lookup.js";
|
|
|
14
14
|
* The chosen record usually is NOT on the page on screen — a search narrowed it, or it lies
|
|
15
15
|
* past the first ten — so its name is kept: from the options it was seen among, or asked of
|
|
16
16
|
* the server once by its key (`chosen`).
|
|
17
|
+
*
|
|
18
|
+
* `exclude` leaves keys out of the choices — the tenants a project is already shared with — and
|
|
19
|
+
* the SERVER leaves them out (`not in` under `criteria`), so the ten are ten that may be chosen.
|
|
20
|
+
* It needs the entity's key field: until its definition is known the first ten come
|
|
21
|
+
* unexcluded, and the reading starts over when it arrives.
|
|
17
22
|
*/
|
|
18
23
|
export type Lookup = {
|
|
19
24
|
options: LookupOption[];
|
|
@@ -31,6 +36,8 @@ export type Lookup = {
|
|
|
31
36
|
* not known yet are asked of the server in one question. */
|
|
32
37
|
chosenAll: LookupOption[];
|
|
33
38
|
};
|
|
39
|
+
/** What may be chosen: the screen's own cut, without the keys it excludes. */
|
|
40
|
+
export declare function excluding<T extends AnyRecord>(criteria: Criteria<T> | undefined, exclude: readonly string[] | undefined, meta: Meta | null | undefined): Criteria<T> | undefined;
|
|
34
41
|
export declare function useLookup<T extends AnyRecord>(
|
|
35
42
|
/** The entity, or a named list of it: «active customers» chooses only those. */
|
|
36
43
|
entity: Entity<T> | ListDefinition<T>, options?: {
|
|
@@ -44,4 +51,6 @@ entity: Entity<T> | ListDefinition<T>, options?: {
|
|
|
44
51
|
value?: string;
|
|
45
52
|
/** The keys chosen in a many2many, to keep their names (`chosenAll`). */
|
|
46
53
|
values?: readonly string[];
|
|
54
|
+
/** Keys never offered — those already chosen elsewhere. Left out by the server. */
|
|
55
|
+
exclude?: readonly string[];
|
|
47
56
|
}): Lookup;
|
package/dist/react/useLookup.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { merge } from "@sincpro/criteria";
|
|
2
3
|
import { isList } from "../core/list.js";
|
|
3
4
|
import { lookupOf } from "../core/lookup.js";
|
|
4
5
|
import { useFramework } from "./context.js";
|
|
@@ -6,17 +7,42 @@ import { useListing } from "./useListing.js";
|
|
|
6
7
|
import { useEffect, useRef, useState } from "react";
|
|
7
8
|
/** Ten: what a dropdown shows without scrolling, and what Odoo's many2one asks for. */
|
|
8
9
|
const FIRST = 10;
|
|
10
|
+
/** What may be chosen: the screen's own cut, without the keys it excludes. */
|
|
11
|
+
export function excluding(criteria, exclude, meta) {
|
|
12
|
+
if (exclude === undefined || exclude.length === 0 || meta == null)
|
|
13
|
+
return criteria;
|
|
14
|
+
const out = {
|
|
15
|
+
where: {
|
|
16
|
+
field: meta.get_id || meta.identity || "id",
|
|
17
|
+
operator: "not in",
|
|
18
|
+
value: [...exclude],
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
return criteria === undefined ? out : merge(criteria, out);
|
|
22
|
+
}
|
|
9
23
|
export function useLookup(
|
|
10
24
|
/** The entity, or a named list of it: «active customers» chooses only those. */
|
|
11
25
|
entity, options = {}) {
|
|
12
|
-
const { transport } = useFramework();
|
|
26
|
+
const { transport, metas } = useFramework();
|
|
27
|
+
const base = isList(entity) ? entity.entity : entity;
|
|
28
|
+
// The key field to exclude by comes with the definition: known already, or with the first
|
|
29
|
+
// answer — then this renders again and the reading starts over without the excluded.
|
|
30
|
+
const [definition, setDefinition] = useState(() => ({
|
|
31
|
+
key: base.key,
|
|
32
|
+
meta: metas.get(base.key),
|
|
33
|
+
}));
|
|
34
|
+
const keyed = definition.key === base.key ? definition.meta : metas.get(base.key);
|
|
35
|
+
const scope = excluding(options.criteria, options.exclude, keyed);
|
|
13
36
|
// «More», not pages: a choice list grows downwards, and its ceiling keeps it light.
|
|
14
37
|
const listing = useListing(entity, {
|
|
15
38
|
paging: "more",
|
|
16
39
|
pageSize: options.pageSize ?? FIRST,
|
|
17
|
-
...(
|
|
40
|
+
...(scope === undefined ? {} : { criteria: scope }),
|
|
18
41
|
});
|
|
19
|
-
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (keyed === undefined && listing.meta !== null)
|
|
44
|
+
setDefinition({ key: base.key, meta: listing.meta });
|
|
45
|
+
}, [keyed, listing.meta, base.key]);
|
|
20
46
|
const choices = lookupOf(listing.meta, listing.rows, base.summary);
|
|
21
47
|
// Every choice seen is remembered: the chosen are named even after the page moved on.
|
|
22
48
|
const seen = useRef(new Map());
|
|
@@ -18,6 +18,11 @@ import { type Draft } from "../core/transport.js";
|
|
|
18
18
|
* in between, the server answers 409 and the screen says so instead of overwriting.
|
|
19
19
|
* - **drafts** — an edit kept between requests (sincpro_framework's `Drafts`) comes back with
|
|
20
20
|
* the record and is shown as restored; `keep()` stores the current one.
|
|
21
|
+
* - **`Edit`** — an entity that declares `edit` speaks sincpro_framework's `Edit` on it for all
|
|
22
|
+
* three: `keep()` is `save_draft`, `save()` is `save` — the record whole, the fields changed,
|
|
23
|
+
* the draft version read and the stored version it started from — and `discard()` is
|
|
24
|
+
* `discard`, which drops the draft on the server too. Without it, a save sends the changed
|
|
25
|
+
* fields and the version to `save`.
|
|
21
26
|
* - **creating** — with no id it is a record that does not exist yet: it starts from the
|
|
22
27
|
* defaults the model publishes, previews like any other, and `save()` sends it to the
|
|
23
28
|
* entity's `create` route with an `Idempotency-Key` (a retry never creates two). When the
|
|
@@ -74,8 +79,8 @@ export type Editing = {
|
|
|
74
79
|
draft: Draft | null;
|
|
75
80
|
save: () => Promise<boolean>;
|
|
76
81
|
discard: () => void;
|
|
77
|
-
/** Store the current edit as a draft — only when the entity declares where
|
|
78
|
-
* exists: a draft is kept against a record. */
|
|
82
|
+
/** Store the current edit as a draft — only when the entity declares where (`draft` or
|
|
83
|
+
* `edit`), and the record exists: a draft is kept against a record. */
|
|
79
84
|
keep?: () => Promise<void>;
|
|
80
85
|
/** What the last create answered, when it did not say the new record's identity. */
|
|
81
86
|
created: unknown;
|
package/dist/react/useRecord.js
CHANGED
|
@@ -145,10 +145,19 @@ export function useRecord(entity, opened) {
|
|
|
145
145
|
return;
|
|
146
146
|
cancelPreview();
|
|
147
147
|
pause.current = setTimeout(() => {
|
|
148
|
+
// A key of the route (`{tenant_id}`) is a field of the record on screen. One it lacks is
|
|
149
|
+
// a preview not asked — never an error thrown out of a timer.
|
|
150
|
+
let path;
|
|
151
|
+
try {
|
|
152
|
+
path = pathFor(preview, isNew ? undefined : id, { ...record, ...next });
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
148
157
|
const aborter = new AbortController();
|
|
149
158
|
asking.current = aborter;
|
|
150
159
|
transport
|
|
151
|
-
.send(preview.method,
|
|
160
|
+
.send(preview.method, path, {
|
|
152
161
|
id: isNew ? null : id,
|
|
153
162
|
values: isNew ? { ...record, ...next } : changesOf(record, next),
|
|
154
163
|
changed: [name],
|
|
@@ -181,6 +190,17 @@ export function useRecord(entity, opened) {
|
|
|
181
190
|
else
|
|
182
191
|
setFailure(error);
|
|
183
192
|
};
|
|
193
|
+
// sincpro_framework's `Edit`: the record as the form holds it, whole; the fields changed; the
|
|
194
|
+
// draft version read (`0`: none) — another tab that kept first wins —, and the stored version
|
|
195
|
+
// the edit started from. Without an `action` it is the server's default, `save_draft`.
|
|
196
|
+
const editOf = (action) => ({
|
|
197
|
+
id,
|
|
198
|
+
values,
|
|
199
|
+
changed: Object.keys(changed),
|
|
200
|
+
version: draft?.version ?? 0,
|
|
201
|
+
...(typeof version === "number" ? { origin_version: version } : {}),
|
|
202
|
+
...(action === undefined ? {} : { action }),
|
|
203
|
+
});
|
|
184
204
|
const edit = {
|
|
185
205
|
values,
|
|
186
206
|
changed,
|
|
@@ -209,17 +229,16 @@ export function useRecord(entity, opened) {
|
|
|
209
229
|
save: async () => {
|
|
210
230
|
if (isNew)
|
|
211
231
|
return create();
|
|
212
|
-
const route = entity.save;
|
|
232
|
+
const route = entity.edit ?? entity.save;
|
|
213
233
|
if (route === undefined)
|
|
214
234
|
throw new Error(`${entity.key} declares no save route`);
|
|
215
235
|
cancelPreview();
|
|
216
236
|
setSaving(true);
|
|
217
237
|
setFailure(null);
|
|
218
238
|
try {
|
|
219
|
-
await transport.send(route.method, pathFor(route, id),
|
|
220
|
-
...changed,
|
|
221
|
-
|
|
222
|
-
});
|
|
239
|
+
await transport.send(route.method, pathFor(route, id, values), entity.edit === undefined
|
|
240
|
+
? { ...changed, ...(version === undefined ? {} : { version }) }
|
|
241
|
+
: editOf("save"));
|
|
223
242
|
setDraft(null);
|
|
224
243
|
reload();
|
|
225
244
|
return true;
|
|
@@ -236,24 +255,27 @@ export function useRecord(entity, opened) {
|
|
|
236
255
|
setSaving(false);
|
|
237
256
|
}
|
|
238
257
|
},
|
|
239
|
-
discard:
|
|
258
|
+
discard: () => {
|
|
259
|
+
forget();
|
|
260
|
+
// The draft lives on the server: discarding only here would bring it back on the next read.
|
|
261
|
+
const route = entity.edit;
|
|
262
|
+
if (route === undefined || isNew || draft === null)
|
|
263
|
+
return;
|
|
264
|
+
setDraft(null);
|
|
265
|
+
// Through the promise: a route key the record lacks is refused like any failure.
|
|
266
|
+
Promise.resolve()
|
|
267
|
+
.then(() => transport.send(route.method, pathFor(route, id, values), editOf("discard")))
|
|
268
|
+
.then(() => mounted.current && reload())
|
|
269
|
+
.catch((error) => mounted.current && refused(error));
|
|
270
|
+
},
|
|
240
271
|
created,
|
|
241
|
-
...(entity.draft === undefined || isNew
|
|
272
|
+
...((entity.edit ?? entity.draft) === undefined || isNew
|
|
242
273
|
? {}
|
|
243
274
|
: {
|
|
244
275
|
keep: async () => {
|
|
245
|
-
const route = entity.draft;
|
|
246
|
-
// sincpro_framework's `Edit`: the record as the form holds it, whole; the fields
|
|
247
|
-
// changed; the draft version read (`0`: none) — another tab that kept first wins —,
|
|
248
|
-
// and the stored version the edit started from.
|
|
276
|
+
const route = (entity.edit ?? entity.draft);
|
|
249
277
|
try {
|
|
250
|
-
const kept = await transport.send(route.method, pathFor(route, id),
|
|
251
|
-
id,
|
|
252
|
-
values,
|
|
253
|
-
changed: Object.keys(changed),
|
|
254
|
-
version: draft?.version ?? 0,
|
|
255
|
-
...(typeof version === "number" ? { origin_version: version } : {}),
|
|
256
|
-
});
|
|
278
|
+
const kept = await transport.send(route.method, pathFor(route, id, values), entity.edit === undefined ? editOf() : editOf("save_draft"));
|
|
257
279
|
const now = kept.draft;
|
|
258
280
|
if (now)
|
|
259
281
|
setDraft({
|
|
@@ -281,7 +303,7 @@ export function useRecord(entity, opened) {
|
|
|
281
303
|
const body = creationOf(state.meta, values);
|
|
282
304
|
const idempotencyKey = creating.current.keyFor(body);
|
|
283
305
|
try {
|
|
284
|
-
const answer = await transport.send(route.method, pathFor(route), body, undefined, { idempotencyKey });
|
|
306
|
+
const answer = await transport.send(route.method, pathFor(route, undefined, body), body, undefined, { idempotencyKey });
|
|
285
307
|
creating.current.settle(null);
|
|
286
308
|
if (!mounted.current)
|
|
287
309
|
return true;
|
|
@@ -24,7 +24,8 @@ export function useRowCommands(listing, commands) {
|
|
|
24
24
|
setRunning((now) => new Set(now).add(gesture));
|
|
25
25
|
setError(null);
|
|
26
26
|
try {
|
|
27
|
-
|
|
27
|
+
// A key of the route beyond `{id}` (`{tenant_id}`) is the row's, unless the body says it.
|
|
28
|
+
await transport.send(route.method, pathFor(route, id, { ...row, ...body }), body, undefined, {
|
|
28
29
|
idempotencyKey: retry.keyFor(body),
|
|
29
30
|
});
|
|
30
31
|
retry.settle(null);
|
|
@@ -9,7 +9,7 @@ import type { Entity } from "../../core/entity.js";
|
|
|
9
9
|
* shows THAT in the window: the confirmation is the consequence, in the server's words, not a
|
|
10
10
|
* question. A refusal is shown where it happened, with what to do.
|
|
11
11
|
*/
|
|
12
|
-
export declare function CommandButton<T extends AnyRecord, R = unknown>({ entity, command, id, body, label, destructive, role, onDone, }: {
|
|
12
|
+
export declare function CommandButton<T extends AnyRecord, R = unknown>({ entity, command, id, body, label, destructive, role, disabled, onDone, }: {
|
|
13
13
|
entity: Entity<T>;
|
|
14
14
|
command: string;
|
|
15
15
|
id?: string;
|
|
@@ -18,5 +18,7 @@ export declare function CommandButton<T extends AnyRecord, R = unknown>({ entity
|
|
|
18
18
|
/** Asks the server what it would do before doing it. */
|
|
19
19
|
destructive?: boolean;
|
|
20
20
|
role?: "primary" | "secondary" | "ghost";
|
|
21
|
+
/** Not offered right now — «Mover» with no other tenant chosen. The server still decides. */
|
|
22
|
+
disabled?: boolean;
|
|
21
23
|
onDone?: (answer: R) => void;
|
|
22
24
|
}): import("react").JSX.Element;
|
|
@@ -14,7 +14,7 @@ import { useState } from "react";
|
|
|
14
14
|
* shows THAT in the window: the confirmation is the consequence, in the server's words, not a
|
|
15
15
|
* question. A refusal is shown where it happened, with what to do.
|
|
16
16
|
*/
|
|
17
|
-
export function CommandButton({ entity, command, id, body, label, destructive = false, role = "secondary", onDone, }) {
|
|
17
|
+
export function CommandButton({ entity, command, id, body, label, destructive = false, role = "secondary", disabled = false, onDone, }) {
|
|
18
18
|
const copy = frameworkCopy().command;
|
|
19
19
|
const action = useCommand(entity, command);
|
|
20
20
|
const [open, setOpen] = useState(false);
|
|
@@ -36,5 +36,5 @@ export function CommandButton({ entity, command, id, body, label, destructive =
|
|
|
36
36
|
setOpen(false);
|
|
37
37
|
action.reset();
|
|
38
38
|
};
|
|
39
|
-
return (_jsxs(_Fragment, { children: [_jsx(Button, { size: "sm", role: destructive ? "secondary" : role, disabled: action.busy, onClick: () => void (destructive ? ask() : run()), children: label }), open ? (_jsx(Dialog, { open: true, title: label, onClose: close, footer: destructive && action.error === null ? (_jsxs("div", { className: "flex justify-end gap-2", children: [_jsx(Button, { size: "sm", role: "secondary", onClick: close, children: copy.cancel }), _jsx(Button, { size: "sm", role: "primary", disabled: action.busy || action.rehearsal === null, onClick: () => void run(), children: copy.confirm })] })) : undefined, children: action.error !== null ? (_jsx(Refused, { error: action.error })) : action.rehearsal === null ? (_jsx("p", { className: "text-meta text-muted", children: copy.rehearsing })) : (_jsx("p", { className: "text-ink", children: action.rehearsal.text })) })) : null] }));
|
|
39
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { size: "sm", role: destructive ? "secondary" : role, disabled: disabled || action.busy, onClick: () => void (destructive ? ask() : run()), children: label }), open ? (_jsx(Dialog, { open: true, title: label, onClose: close, footer: destructive && action.error === null ? (_jsxs("div", { className: "flex justify-end gap-2", children: [_jsx(Button, { size: "sm", role: "secondary", onClick: close, children: copy.cancel }), _jsx(Button, { size: "sm", role: "primary", disabled: action.busy || action.rehearsal === null, onClick: () => void run(), children: copy.confirm })] })) : undefined, children: action.error !== null ? (_jsx(Refused, { error: action.error })) : action.rehearsal === null ? (_jsx("p", { className: "text-meta text-muted", children: copy.rehearsing })) : (_jsx("p", { className: "text-ink", children: action.rehearsal.text })) })) : null] }));
|
|
40
40
|
}
|
|
@@ -28,10 +28,17 @@ import { type OpenTarget } from "@sincpro/web-ui";
|
|
|
28
28
|
* way to the server's literal search. The chooser is a table — the columns the list declares,
|
|
29
29
|
* or `columns` — searched by the entity's literal search on the server.
|
|
30
30
|
*
|
|
31
|
+
* A field that may stay empty offers that as a choice (`none`): «Ninguno», or the screen's own
|
|
32
|
+
* word («Sin tenant»), answered as `""`. web-ui's `Picker` has no way to clear a choice, so it
|
|
33
|
+
* is the first option, while nothing is typed. `exclude` leaves keys out of the choices — the
|
|
34
|
+
* tenants a project is already shared with —, in the picker and its chooser, and the SERVER
|
|
35
|
+
* leaves them out (`useLookup exclude`).
|
|
36
|
+
*
|
|
31
37
|
* <EntityPicker entity={customers} value={id} onChange={set} />
|
|
32
38
|
* <EntityPicker entity={activeCustomers} columns={["name", "tax_id", "city"]} … />
|
|
39
|
+
* <EntityPicker entity={tenants} none="Sin tenant" exclude={sharedWith} … />
|
|
33
40
|
*/
|
|
34
|
-
export declare function EntityPicker<T extends AnyRecord>({ entity, value, onChange, onOpen, openTargets, onBrowseAll, criteria, columns, browse, placeholder, disabled, "aria-label": ariaLabel, }: {
|
|
41
|
+
export declare function EntityPicker<T extends AnyRecord>({ entity, value, onChange, onOpen, openTargets, onBrowseAll, criteria, columns, browse, none, exclude, placeholder, disabled, "aria-label": ariaLabel, }: {
|
|
35
42
|
/** What is chosen from: an entity, or a named list of it (its cut, columns and title). */
|
|
36
43
|
entity: Entity<T> | ListDefinition<T>;
|
|
37
44
|
/** The chooser's columns. Without it, the named list's, or every scalar field. */
|
|
@@ -40,9 +47,14 @@ export declare function EntityPicker<T extends AnyRecord>({ entity, value, onCha
|
|
|
40
47
|
browse?: boolean;
|
|
41
48
|
/** Which records may be chosen at all: applied by the server under what is typed. */
|
|
42
49
|
criteria?: Criteria<T>;
|
|
50
|
+
/** The field may stay empty: a first choice that answers `""` — `true` says «Ninguno», a
|
|
51
|
+
* text is the screen's own word for it. */
|
|
52
|
+
none?: boolean | string;
|
|
53
|
+
/** Keys never offered — those already chosen elsewhere. Left out by the server. */
|
|
54
|
+
exclude?: readonly string[];
|
|
43
55
|
value?: string;
|
|
44
|
-
/** The key chosen, and its record when the choice brought it — what a line
|
|
45
|
-
* key so its cell names the choice without asking again. */
|
|
56
|
+
/** The key chosen (`""` for `none`), and its record when the choice brought it — what a line
|
|
57
|
+
* keeps beside the key so its cell names the choice without asking again. */
|
|
46
58
|
onChange: (id: string, chosen?: T) => void;
|
|
47
59
|
/** Open the chosen record where the person asked — in composer,
|
|
48
60
|
* `(id, to) => openIn(api, entity.ref(id), to)`. */
|
|
@@ -3,8 +3,9 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { nameOf } from "@sincpro/criteria";
|
|
4
4
|
import { frameworkCopy } from "../../core/copy.js";
|
|
5
5
|
import { isList } from "../../core/list.js";
|
|
6
|
+
import { useFramework } from "../../react/context.js";
|
|
6
7
|
import { useListing } from "../../react/useListing.js";
|
|
7
|
-
import { useLookup } from "../../react/useLookup.js";
|
|
8
|
+
import { excluding, useLookup } from "../../react/useLookup.js";
|
|
8
9
|
import { EntityList } from "../list/EntityList.js";
|
|
9
10
|
import { over, presentationOf } from "../list/presentation.js";
|
|
10
11
|
import { Dialog, IconButton, Picker } from "@sincpro/web-ui";
|
|
@@ -36,27 +37,47 @@ import { useState } from "react";
|
|
|
36
37
|
* way to the server's literal search. The chooser is a table — the columns the list declares,
|
|
37
38
|
* or `columns` — searched by the entity's literal search on the server.
|
|
38
39
|
*
|
|
40
|
+
* A field that may stay empty offers that as a choice (`none`): «Ninguno», or the screen's own
|
|
41
|
+
* word («Sin tenant»), answered as `""`. web-ui's `Picker` has no way to clear a choice, so it
|
|
42
|
+
* is the first option, while nothing is typed. `exclude` leaves keys out of the choices — the
|
|
43
|
+
* tenants a project is already shared with —, in the picker and its chooser, and the SERVER
|
|
44
|
+
* leaves them out (`useLookup exclude`).
|
|
45
|
+
*
|
|
39
46
|
* <EntityPicker entity={customers} value={id} onChange={set} />
|
|
40
47
|
* <EntityPicker entity={activeCustomers} columns={["name", "tax_id", "city"]} … />
|
|
48
|
+
* <EntityPicker entity={tenants} none="Sin tenant" exclude={sharedWith} … />
|
|
41
49
|
*/
|
|
42
|
-
export function EntityPicker({ entity, value, onChange, onOpen, openTargets, onBrowseAll, criteria, columns, browse = true, placeholder, disabled, "aria-label": ariaLabel, }) {
|
|
50
|
+
export function EntityPicker({ entity, value, onChange, onOpen, openTargets, onBrowseAll, criteria, columns, browse = true, none, exclude, placeholder, disabled, "aria-label": ariaLabel, }) {
|
|
51
|
+
const base = isList(entity) ? entity.entity : entity;
|
|
52
|
+
const { metas } = useFramework();
|
|
43
53
|
const lookup = useLookup(entity, {
|
|
44
54
|
...(criteria === undefined ? {} : { criteria }),
|
|
45
55
|
...(value === undefined ? {} : { value }),
|
|
56
|
+
...(exclude === undefined ? {} : { exclude }),
|
|
46
57
|
});
|
|
47
|
-
|
|
58
|
+
// The chooser opens after the picker read the definition: it excludes from its first page.
|
|
59
|
+
const scope = excluding(criteria, exclude, metas.get(base.key));
|
|
60
|
+
const person = base.summary.person === true;
|
|
61
|
+
const nothing = none === undefined || none === false || lookup.text !== ""
|
|
62
|
+
? []
|
|
63
|
+
: [{ id: "", name: none === true ? frameworkCopy().picker.none : none }];
|
|
48
64
|
const look = presentationOf(entity).option;
|
|
49
65
|
const [choosing, setChoosing] = useState(false);
|
|
50
66
|
const browseAll = onBrowseAll ?? (() => setChoosing(true));
|
|
51
|
-
const picker = (_jsx(Picker, { items:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
67
|
+
const picker = (_jsx(Picker, { items: [
|
|
68
|
+
...nothing,
|
|
69
|
+
...lookup.options.map((one) => over({
|
|
70
|
+
id: one.id,
|
|
71
|
+
name: one.label,
|
|
72
|
+
...(one.detail === undefined ? {} : { meta: one.detail, haystack: one.detail }),
|
|
73
|
+
// A person or a company is chosen by their face: the photo, or their initials.
|
|
74
|
+
...(person ? { avatar: one.image ?? true } : {}),
|
|
75
|
+
},
|
|
76
|
+
// The entity's own look of a choice, over the default (`presented`).
|
|
77
|
+
look === undefined || one.record === undefined
|
|
78
|
+
? undefined
|
|
79
|
+
: look(one.record))),
|
|
80
|
+
], ...(value === undefined ? {} : { value }), ...(lookup.chosen === undefined
|
|
60
81
|
? {}
|
|
61
82
|
: {
|
|
62
83
|
valueLabel: (lookup.chosen.record === undefined || look === undefined
|
|
@@ -64,8 +85,8 @@ export function EntityPicker({ entity, value, onChange, onOpen, openTargets, onB
|
|
|
64
85
|
: look(lookup.chosen.record).name) ?? lookup.chosen.label,
|
|
65
86
|
}), onChange: (id) => onChange(id, lookup.options.find((one) => one.id === id)?.record), ...(lookup.searchable ? { onSearch: lookup.search } : {}),
|
|
66
87
|
// «Loading» only before there is anything: refining keeps the ten on screen.
|
|
67
|
-
loading: lookup.loading && lookup.options.length === 0, ...(onOpen === undefined ? {} : { onOpen }), ...(openTargets === undefined ? {} : { openTargets }), onBrowseAll: browseAll, ...(placeholder === undefined ? {} : { placeholder }), ...(disabled === undefined ? {} : { disabled }), ...(ariaLabel === undefined ? {} : { "aria-label": ariaLabel }) }));
|
|
68
|
-
return (_jsxs(_Fragment, { children: [browse ? (_jsxs("span", { className: "flex min-w-0 items-start gap-1", children: [_jsx("span", { className: "min-w-0 flex-1", children: picker }), _jsx(IconButton, { icon: TextSearch, label: frameworkCopy().picker.browse, onClick: () => browseAll(lookup.text), ...(disabled === undefined ? {} : { disabled }) })] })) : (picker), choosing ? (_jsx(Chooser, { entity: entity, ...(columns === undefined ? {} : { columns }), ...(
|
|
88
|
+
loading: lookup.loading && lookup.options.length === 0, ...(onOpen === undefined || value === "" ? {} : { onOpen }), ...(openTargets === undefined ? {} : { openTargets }), onBrowseAll: browseAll, ...(placeholder === undefined ? {} : { placeholder }), ...(disabled === undefined ? {} : { disabled }), ...(ariaLabel === undefined ? {} : { "aria-label": ariaLabel }) }));
|
|
89
|
+
return (_jsxs(_Fragment, { children: [browse ? (_jsxs("span", { className: "flex min-w-0 items-start gap-1", children: [_jsx("span", { className: "min-w-0 flex-1", children: picker }), _jsx(IconButton, { icon: TextSearch, label: frameworkCopy().picker.browse, onClick: () => browseAll(lookup.text), ...(disabled === undefined ? {} : { disabled }) })] })) : (picker), choosing ? (_jsx(Chooser, { entity: entity, ...(columns === undefined ? {} : { columns }), ...(scope === undefined ? {} : { criteria: scope }), onChoose: (id, row) => {
|
|
69
90
|
onChange(id, row);
|
|
70
91
|
setChoosing(false);
|
|
71
92
|
}, onClose: () => setChoosing(false) })) : null] }));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Meta } from "@sincpro/criteria";
|
|
2
|
-
import { type ComposerSkin, type ResourceRef, type ViewSpec } from "@sincpro/web-composer";
|
|
2
|
+
import { type ComposerSkin, type ResourceRef, type ViewSpec, type WorkspaceStore } from "@sincpro/web-composer";
|
|
3
3
|
import { type CacheOptions } from "../../core/cache.js";
|
|
4
4
|
import type { Entity } from "../../core/entity.js";
|
|
5
5
|
import type { Transport } from "../../core/transport.js";
|
|
@@ -12,10 +12,15 @@ import { type ReactNode } from "react";
|
|
|
12
12
|
* Context: forge's `main.tsx` + `console.tsx` installed three copy tables, a toast provider, a
|
|
13
13
|
* context of its own and a composer by hand. This is that, once. It is a convenience, not the
|
|
14
14
|
* only door: everything it mounts is exported, and an app with its own shell mounts them itself.
|
|
15
|
-
* What it does NOT own: the session (the app builds the transport with its headers) and the
|
|
16
|
-
* application bar
|
|
15
|
+
* What it does NOT own: the session (the app builds the transport with its headers) and what the
|
|
16
|
+
* application bar says. The bar is the app's (`bar`), drawn above the workspace inside every
|
|
17
|
+
* provider; a menu in it opens views through the workspace the app holds (`workspace`, from
|
|
18
|
+
* composer's `useWorkspace()`) — a workspace owned in here could not be reached from outside.
|
|
19
|
+
*
|
|
20
|
+
* const workspace = useWorkspace();
|
|
21
|
+
* <SincproApp workspace={workspace} bar={<Menu onOpen={(ref) => workspace.push(ref)} />} … />
|
|
17
22
|
*/
|
|
18
|
-
export declare function SincproApp({ transport, views, start, language, metas, entities, empty, skin, cache, timeZone, }: {
|
|
23
|
+
export declare function SincproApp({ transport, views, start, language, metas, entities, empty, skin, cache, timeZone, workspace: given, bar, }: {
|
|
19
24
|
transport: Transport;
|
|
20
25
|
/** The entities as composer views — `entityView(…)` — and any other view of the app. */
|
|
21
26
|
views: readonly ViewSpec[];
|
|
@@ -40,4 +45,10 @@ export declare function SincproApp({ transport, views, start, language, metas, e
|
|
|
40
45
|
/** Where the business is (`"America/La_Paz"`): every date and time on its wall clock.
|
|
41
46
|
* Without it, the browser's. */
|
|
42
47
|
timeZone?: string;
|
|
48
|
+
/** The workspace, when the app needs to reach it (a menu of its bar): composer's
|
|
49
|
+
* `useWorkspace()`. Without it, the app keeps one of its own. */
|
|
50
|
+
workspace?: WorkspaceStore;
|
|
51
|
+
/** The application's bar, above the workspace and inside the providers: its menus may read
|
|
52
|
+
* the framework (`useFramework`) and open views through `workspace`. */
|
|
53
|
+
bar?: ReactNode;
|
|
43
54
|
}): import("react").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Composer, installComposerCopy, SPANISH_COMPOSER_COPY, useWorkspace, } from "@sincpro/web-composer";
|
|
4
4
|
import { createRegistry } from "@sincpro/web-composer/domain";
|
|
5
5
|
import { cachedTransport } from "../../core/cache.js";
|
|
@@ -16,10 +16,15 @@ import { useEffect, useMemo, useState } from "react";
|
|
|
16
16
|
* Context: forge's `main.tsx` + `console.tsx` installed three copy tables, a toast provider, a
|
|
17
17
|
* context of its own and a composer by hand. This is that, once. It is a convenience, not the
|
|
18
18
|
* only door: everything it mounts is exported, and an app with its own shell mounts them itself.
|
|
19
|
-
* What it does NOT own: the session (the app builds the transport with its headers) and the
|
|
20
|
-
* application bar
|
|
19
|
+
* What it does NOT own: the session (the app builds the transport with its headers) and what the
|
|
20
|
+
* application bar says. The bar is the app's (`bar`), drawn above the workspace inside every
|
|
21
|
+
* provider; a menu in it opens views through the workspace the app holds (`workspace`, from
|
|
22
|
+
* composer's `useWorkspace()`) — a workspace owned in here could not be reached from outside.
|
|
23
|
+
*
|
|
24
|
+
* const workspace = useWorkspace();
|
|
25
|
+
* <SincproApp workspace={workspace} bar={<Menu onOpen={(ref) => workspace.push(ref)} />} … />
|
|
21
26
|
*/
|
|
22
|
-
export function SincproApp({ transport, views, start, language = "es", metas, entities, empty, skin = webUiSkin, cache = {}, timeZone, }) {
|
|
27
|
+
export function SincproApp({ transport, views, start, language = "es", metas, entities, empty, skin = webUiSkin, cache = {}, timeZone, workspace: given, bar, }) {
|
|
23
28
|
// Installed once, before anything draws: the three tables are module state of their packages.
|
|
24
29
|
useState(() => {
|
|
25
30
|
if (language === "es") {
|
|
@@ -29,11 +34,17 @@ export function SincproApp({ transport, views, start, language = "es", metas, en
|
|
|
29
34
|
}
|
|
30
35
|
return null;
|
|
31
36
|
});
|
|
32
|
-
const cached = useMemo(() =>
|
|
37
|
+
const cached = useMemo(() => cache === false
|
|
38
|
+
? transport
|
|
39
|
+
: cachedTransport(transport, {
|
|
40
|
+
...(entities === undefined ? {} : { entities }),
|
|
41
|
+
...cache,
|
|
42
|
+
}),
|
|
33
43
|
// The options are read once: a cache that changes shape mid-session forgets everything.
|
|
34
44
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
45
|
[transport]);
|
|
36
|
-
const
|
|
46
|
+
const own = useWorkspace();
|
|
47
|
+
const workspace = given ?? own;
|
|
37
48
|
const registry = useMemo(() => createRegistry(views), [views]);
|
|
38
49
|
useEffect(() => {
|
|
39
50
|
if (start !== undefined)
|
|
@@ -41,5 +52,5 @@ export function SincproApp({ transport, views, start, language = "es", metas, en
|
|
|
41
52
|
// The first screen only: a re-render must not push it again.
|
|
42
53
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
43
54
|
}, [workspace]);
|
|
44
|
-
return (_jsx(FrameworkProvider, { transport: cached, locale: language, ...(metas === undefined ? {} : { metas }), ...(entities === undefined ? {} : { entities }), ...(timeZone === undefined ? {} : { timeZone }), children: _jsx(ToastProvider, { children:
|
|
55
|
+
return (_jsx(FrameworkProvider, { transport: cached, locale: language, ...(metas === undefined ? {} : { metas }), ...(entities === undefined ? {} : { entities }), ...(timeZone === undefined ? {} : { timeZone }), children: _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, ...(empty === undefined ? {} : { empty }) }) })] }) }) }));
|
|
45
56
|
}
|
|
@@ -21,7 +21,16 @@ import { type ComponentType } from "react";
|
|
|
21
21
|
*
|
|
22
22
|
* ⌘K asks the server with `matching` — 8 records, identity and display — the same question a
|
|
23
23
|
* many2one asks. The model definition is asked for once, on the first search, unless `meta`
|
|
24
|
-
* is handed over.
|
|
24
|
+
* is handed over. A list whose route answers a SCOPE by its params (forge's `/projects`
|
|
25
|
+
* without `tenant_id` is the projects with NO tenant) is searched in the one ⌘K should see:
|
|
26
|
+
* `search: { params }`.
|
|
27
|
+
*
|
|
28
|
+
* The screens can come in a chunk of their own (`load`): the composer asks for a view's
|
|
29
|
+
* component when it first opens, so the application's bundle does not carry every screen of
|
|
30
|
+
* every entity — `entityView` keeps that, where handing it the components had lost it.
|
|
31
|
+
*
|
|
32
|
+
* entityView(invoices, { transport, name: "Facturas",
|
|
33
|
+
* load: () => import("./invoice_views").then((m) => ({ list: m.Invoices, record: m.Invoice })) })
|
|
25
34
|
*/
|
|
26
35
|
export type EntityViewOptions = {
|
|
27
36
|
transport: Transport;
|
|
@@ -37,6 +46,16 @@ export type EntityViewOptions = {
|
|
|
37
46
|
/** Known before any search: no request asks for it. */
|
|
38
47
|
meta?: Meta;
|
|
39
48
|
actions?: ViewSpec["actions"];
|
|
49
|
+
/** ⌘K's question: the list route's params that say which records it searches. */
|
|
50
|
+
search?: {
|
|
51
|
+
params?: Readonly<Record<string, string>>;
|
|
52
|
+
};
|
|
53
|
+
/** The screens, loaded when the view first opens — a dynamic `import()`. What it does not
|
|
54
|
+
* bring is `list` / `record`, or the defaults. */
|
|
55
|
+
load?: () => Promise<{
|
|
56
|
+
list?: ComponentType<ViewProps>;
|
|
57
|
+
record?: ComponentType<ViewProps>;
|
|
58
|
+
}>;
|
|
40
59
|
};
|
|
41
60
|
export declare function entityView<T extends AnyRecord>(entity: Entity<T>, options: EntityViewOptions): ViewSpec;
|
|
42
61
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { matching } from "@sincpro/criteria";
|
|
4
|
-
import { NEW_PARAM } from "../../core/entity.js";
|
|
4
|
+
import { listRoute, NEW_PARAM } from "../../core/entity.js";
|
|
5
5
|
import { lookupOf } from "../../core/lookup.js";
|
|
6
6
|
import { useListing } from "../../react/useListing.js";
|
|
7
7
|
import { EntityList } from "../list/EntityList.js";
|
|
@@ -45,13 +45,20 @@ function recordOf(entity) {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
export function entityView(entity, options) {
|
|
48
|
-
const List = options.list ?? listOf(entity);
|
|
49
|
-
const One = options.record ?? recordOf(entity);
|
|
50
48
|
let meta = options.meta ?? null;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
const route = listRoute(entity.list, options.search?.params);
|
|
50
|
+
async function screens() {
|
|
51
|
+
const loaded = options.load === undefined ? {} : await options.load();
|
|
52
|
+
const List = loaded.list ?? options.list ?? listOf(entity);
|
|
53
|
+
const One = loaded.record ?? options.record ?? recordOf(entity);
|
|
54
|
+
return function EntityView(props) {
|
|
55
|
+
const record = props.resource.id !== undefined || props.resource.params?.[NEW_PARAM] !== undefined;
|
|
56
|
+
return (_jsx(InWorkspace, { api: props.api, children: record ? _jsx(One, { ...props }) : _jsx(List, { ...props }) }));
|
|
57
|
+
};
|
|
54
58
|
}
|
|
59
|
+
// Built once: a second open of the view must be the same component, or it would remount. A
|
|
60
|
+
// chunk that failed to arrive is asked again next time.
|
|
61
|
+
let view = null;
|
|
55
62
|
return {
|
|
56
63
|
domain: entity.domain,
|
|
57
64
|
kind: entity.kind,
|
|
@@ -63,10 +70,10 @@ export function entityView(entity, options) {
|
|
|
63
70
|
if (query.trim() === "")
|
|
64
71
|
return [];
|
|
65
72
|
if (meta === null)
|
|
66
|
-
meta = (await options.transport.list(
|
|
73
|
+
meta = (await options.transport.list(route, { pagination: { limit: 1 } })).meta;
|
|
67
74
|
if (meta?.search == null)
|
|
68
75
|
return [];
|
|
69
|
-
const page = await options.transport.list(
|
|
76
|
+
const page = await options.transport.list(route, {
|
|
70
77
|
...matching(meta, query),
|
|
71
78
|
meta: false,
|
|
72
79
|
});
|
|
@@ -82,7 +89,13 @@ export function entityView(entity, options) {
|
|
|
82
89
|
};
|
|
83
90
|
});
|
|
84
91
|
},
|
|
85
|
-
load:
|
|
92
|
+
load: () => {
|
|
93
|
+
view ??= screens().catch((failure) => {
|
|
94
|
+
view = null;
|
|
95
|
+
throw failure;
|
|
96
|
+
});
|
|
97
|
+
return view;
|
|
98
|
+
},
|
|
86
99
|
};
|
|
87
100
|
}
|
|
88
101
|
export function listView(list, options = {}) {
|
|
@@ -68,12 +68,22 @@ export function EntityRecord({ api, resource, entity, fields, pages, actions, })
|
|
|
68
68
|
const dirty = dirtyOf(reading);
|
|
69
69
|
const created = summary?.created;
|
|
70
70
|
const updated = summary?.updated;
|
|
71
|
-
|
|
71
|
+
// Who, only when the record says it (web-ui 1.9: an author is optional, the line then says
|
|
72
|
+
// only when). The moment goes as the framework writes every fact of the record.
|
|
73
|
+
const stamp = (one) => one?.at == null ? undefined : { at: one.at, ...(one.by == null ? {} : { by: one.by }) };
|
|
72
74
|
const createdStamp = stamp(created);
|
|
73
75
|
const updatedStamp = stamp(updated);
|
|
74
76
|
// Moving away with something typed would lose it: «save / discard» comes first.
|
|
75
77
|
const place = trail === undefined || reading.isNew || edit.dirty ? null : placeOf(trail, reading.id);
|
|
76
|
-
return (_jsxs(Record
|
|
78
|
+
return (_jsxs(Record
|
|
79
|
+
// Where it is mounted decides the paper, not what the rail carries: crumbs, pager and
|
|
80
|
+
// actions come and go while it is on screen (loading, a draft), and the paper flipping
|
|
81
|
+
// with them remounted the form under the field being typed in. A modal is already a card.
|
|
82
|
+
, {
|
|
83
|
+
// Where it is mounted decides the paper, not what the rail carries: crumbs, pager and
|
|
84
|
+
// actions come and go while it is on screen (loading, a draft), and the paper flipping
|
|
85
|
+
// with them remounted the form under the field being typed in. A modal is already a card.
|
|
86
|
+
placement: api.surface === "modal" ? "card" : "page", identity: {
|
|
77
87
|
title: summary?.name ?? copy.creating(nameOf(meta, locale) || ""),
|
|
78
88
|
...(summary?.type == null ? {} : { subtitle: summary.type }),
|
|
79
89
|
...(summary?.state == null ? {} : { tag: { label: summary.state } }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sincpro/web-framework",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
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",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@sincpro/criteria": "^0.3.1",
|
|
27
27
|
"@sincpro/criteria-react": "^0.3.1",
|
|
28
28
|
"@sincpro/web-composer": "^1.5.0",
|
|
29
|
-
"@sincpro/web-ui": "^1.
|
|
29
|
+
"@sincpro/web-ui": "^1.9.0",
|
|
30
30
|
"react": ">=19",
|
|
31
31
|
"react-dom": ">=19"
|
|
32
32
|
},
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@sincpro/criteria": "^0.3.1",
|
|
36
36
|
"@sincpro/criteria-react": "^0.3.1",
|
|
37
37
|
"@sincpro/web-composer": "^1.5.0",
|
|
38
|
-
"@sincpro/web-ui": "^1.
|
|
38
|
+
"@sincpro/web-ui": "^1.9.0",
|
|
39
39
|
"@storybook/addon-a11y": "10.6.5",
|
|
40
40
|
"@storybook/addon-docs": "10.6.5",
|
|
41
41
|
"@storybook/addon-mcp": "10.6.5",
|