@stonecrop/stonecrop 0.24.0 → 0.26.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/dist/src/registry.d.ts +2 -1
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/registry.js +4 -5
- package/dist/src/stonecrop.d.ts +4 -5
- package/dist/src/stonecrop.d.ts.map +1 -1
- package/dist/src/stonecrop.js +17 -1
- package/dist/src/types/stonecrop.d.ts +15 -0
- package/dist/src/types/stonecrop.d.ts.map +1 -1
- package/dist/stonecrop.d.ts +21 -5
- package/dist/stonecrop.js +84 -76
- package/dist/stonecrop.js.map +1 -1
- package/package.json +4 -4
- package/src/registry.ts +5 -6
- package/src/stonecrop.ts +21 -4
- package/src/types/stonecrop.ts +16 -0
package/dist/src/registry.d.ts
CHANGED
|
@@ -92,7 +92,8 @@ export default class Registry {
|
|
|
92
92
|
private resolveFields;
|
|
93
93
|
/**
|
|
94
94
|
* Build a `ResolvedTable` from a resolved Link field with many cardinality.
|
|
95
|
-
*
|
|
95
|
+
* Columns come from {@link @stonecrop/aform#resolvedFieldsToColumns}, the shared definition of
|
|
96
|
+
* which resolved fields a cell can render.
|
|
96
97
|
* @internal
|
|
97
98
|
*/
|
|
98
99
|
private buildTableConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAiE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAiE,MAAM,kBAAkB,CAAA;AAEpH,OAAO,KAAK,EAAgB,eAAe,EAA+B,MAAM,mBAAmB,CAAA;AAEnG,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC,OAAO,OAAO,MAAM,WAAW,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,CAAC,WAAW,EAAE,MAAM,GAAG,KAAK,CAAC,eAAe,GAAG;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAWvF;;;;;;;;;;;;;OAaG;IACH,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,KAAK,CAAC,eAAe,GAAG;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAwBtG;;;OAGG;IACH,OAAO,CAAC,oBAAoB;CAgC5B"}
|
package/dist/src/registry.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolvedFieldsToColumns } from '@stonecrop/aform';
|
|
1
2
|
import { componentCategory, componentLinkExpansion, resolveLinkRenderMode } from '@stonecrop/schema';
|
|
2
3
|
/**
|
|
3
4
|
* Stonecrop Registry class
|
|
@@ -217,14 +218,12 @@ export default class Registry {
|
|
|
217
218
|
}
|
|
218
219
|
/**
|
|
219
220
|
* Build a `ResolvedTable` from a resolved Link field with many cardinality.
|
|
220
|
-
*
|
|
221
|
+
* Columns come from {@link @stonecrop/aform#resolvedFieldsToColumns}, the shared definition of
|
|
222
|
+
* which resolved fields a cell can render.
|
|
221
223
|
* @internal
|
|
222
224
|
*/
|
|
223
225
|
buildTableConfig(field, childSchema, component) {
|
|
224
|
-
|
|
225
|
-
const columns = childSchema
|
|
226
|
-
.filter((f) => f.kind === 'field')
|
|
227
|
-
.map(({ kind: _k, ...col }) => col);
|
|
226
|
+
const columns = resolvedFieldsToColumns(childSchema);
|
|
228
227
|
const config = field.config ?? { view: 'list' };
|
|
229
228
|
const { options: _opt, cardinality: _card, ...fieldRest } = field;
|
|
230
229
|
return {
|
package/dist/src/stonecrop.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import Registry from './registry';
|
|
|
4
4
|
import { type HSTNode } from './stores/hst';
|
|
5
5
|
import type { OperationLogConfig } from './types/operation-log';
|
|
6
6
|
import type { RouteContext } from './types/registry';
|
|
7
|
-
import type { StonecropOptions } from './types/stonecrop';
|
|
7
|
+
import type { PageInfo, StonecropOptions } from './types/stonecrop';
|
|
8
8
|
/**
|
|
9
9
|
* Main Stonecrop class with HST integration and built-in Operation Log
|
|
10
10
|
* @public
|
|
@@ -393,6 +393,8 @@ export declare class Stonecrop {
|
|
|
393
393
|
* nothing on this side of the wire knows what is safe for an arbitrary backend. A caller that
|
|
394
394
|
* passes none gets whatever the server considers a reasonable page.
|
|
395
395
|
*
|
|
396
|
+
* `options.offset === 0` (or omitted) replaces the doctype's HST records; `offset > 0` appends.
|
|
397
|
+
*
|
|
396
398
|
* @param doctype - The doctype
|
|
397
399
|
* @param options - Query options (filters, orderBy, limit, offset), forwarded to the client
|
|
398
400
|
* @throws Error if no data client has been configured
|
|
@@ -410,10 +412,7 @@ export declare class Stonecrop {
|
|
|
410
412
|
* @returns Page info, or undefined if this doctype's records have not been fetched
|
|
411
413
|
* @public
|
|
412
414
|
*/
|
|
413
|
-
getPageInfo(doctype: string | Doctype):
|
|
414
|
-
hasMore: boolean;
|
|
415
|
-
count?: number;
|
|
416
|
-
} | undefined;
|
|
415
|
+
getPageInfo(doctype: string | Doctype): PageInfo | undefined;
|
|
417
416
|
/**
|
|
418
417
|
* Fetch a single record from the server and store it in HST.
|
|
419
418
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stonecrop.d.ts","sourceRoot":"","sources":["../../src/stonecrop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAG1G,OAAO,OAAO,MAAM,WAAW,CAAA;AAE/B,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAA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AO,EAChB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;KAAE,GAC9C,OAAO,CAAC,IAAI,CAAC;IAgChB;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;CA2BzB"}
|
package/dist/src/stonecrop.js
CHANGED
|
@@ -258,6 +258,8 @@ export class Stonecrop {
|
|
|
258
258
|
* nothing on this side of the wire knows what is safe for an arbitrary backend. A caller that
|
|
259
259
|
* passes none gets whatever the server considers a reasonable page.
|
|
260
260
|
*
|
|
261
|
+
* `options.offset === 0` (or omitted) replaces the doctype's HST records; `offset > 0` appends.
|
|
262
|
+
*
|
|
261
263
|
* @param doctype - The doctype
|
|
262
264
|
* @param options - Query options (filters, orderBy, limit, offset), forwarded to the client
|
|
263
265
|
* @throws Error if no data client has been configured
|
|
@@ -270,10 +272,24 @@ export class Stonecrop {
|
|
|
270
272
|
}
|
|
271
273
|
const result = await this._client.getRecords(doctype, options);
|
|
272
274
|
const records = result.data;
|
|
275
|
+
const offset = options?.offset ?? 0;
|
|
273
276
|
// Page info is kept beside HST, not in it. `getRecordIds` reads the raw keys under a
|
|
274
277
|
// doctype node, so anything filed there becomes a phantom record — the same hazard that
|
|
275
278
|
// ruled out seeding a draft node.
|
|
276
|
-
|
|
279
|
+
const pageEntry = {
|
|
280
|
+
hasMore: result.hasMore,
|
|
281
|
+
offset,
|
|
282
|
+
limit: records.length,
|
|
283
|
+
};
|
|
284
|
+
if (result.count != null) {
|
|
285
|
+
pageEntry.count = result.count;
|
|
286
|
+
}
|
|
287
|
+
this.pageInfo[doctype.slug] = pageEntry;
|
|
288
|
+
// offset === 0 replaces the doctype's HST records; offset > 0 appends. A failed fetch
|
|
289
|
+
// must not clear — that happens only after a successful response lands above.
|
|
290
|
+
if (offset === 0) {
|
|
291
|
+
this.clearRecords(doctype);
|
|
292
|
+
}
|
|
277
293
|
// Key each record by its declared primary key, falling back to `id`. This used to read
|
|
278
294
|
// `record.id` only, which silently dropped every row of a natural-keyed doctype (no `id`
|
|
279
295
|
// column at all) — the records never entered HST, so the list rendered empty and no
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import type { DataClient } from '@stonecrop/schema';
|
|
2
|
+
/**
|
|
3
|
+
* Pagination metadata from the last {@link Stonecrop.getRecords} for a doctype.
|
|
4
|
+
* Kept beside HST, not in it — see {@link Stonecrop.getPageInfo}.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface PageInfo {
|
|
8
|
+
/** Whether the backend holds further records beyond what has been fetched */
|
|
9
|
+
hasMore: boolean;
|
|
10
|
+
/** Total matching the filters when the caller passed includeTotal */
|
|
11
|
+
count?: number;
|
|
12
|
+
/** Offset of the last fetch */
|
|
13
|
+
offset: number;
|
|
14
|
+
/** Number of rows in the last page (result.data.length) */
|
|
15
|
+
limit: number;
|
|
16
|
+
}
|
|
2
17
|
/**
|
|
3
18
|
* Options for constructing a Stonecrop instance directly.
|
|
4
19
|
* When using the Vue plugin, pass these via `InstallOptions` instead.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stonecrop.d.ts","sourceRoot":"","sources":["../../../src/types/stonecrop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,UAAU,CAAA;CACnB"}
|
|
1
|
+
{"version":3,"file":"stonecrop.d.ts","sourceRoot":"","sources":["../../../src/types/stonecrop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACxB,6EAA6E;IAC7E,OAAO,EAAE,OAAO,CAAA;IAChB,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAA;IACd,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAA;CACb;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,UAAU,CAAA;CACnB"}
|
package/dist/stonecrop.d.ts
CHANGED
|
@@ -1289,6 +1289,22 @@ export declare interface OperationLogSnapshot {
|
|
|
1289
1289
|
*/
|
|
1290
1290
|
export declare type OperationSource = 'user' | 'system' | 'sync' | 'undo' | 'redo';
|
|
1291
1291
|
|
|
1292
|
+
/**
|
|
1293
|
+
* Pagination metadata from the last {@link Stonecrop.getRecords} for a doctype.
|
|
1294
|
+
* Kept beside HST, not in it — see {@link Stonecrop.getPageInfo}.
|
|
1295
|
+
* @public
|
|
1296
|
+
*/
|
|
1297
|
+
export declare interface PageInfo {
|
|
1298
|
+
/** Whether the backend holds further records beyond what has been fetched */
|
|
1299
|
+
hasMore: boolean;
|
|
1300
|
+
/** Total matching the filters when the caller passed includeTotal */
|
|
1301
|
+
count?: number;
|
|
1302
|
+
/** Offset of the last fetch */
|
|
1303
|
+
offset: number;
|
|
1304
|
+
/** Number of rows in the last page (result.data.length) */
|
|
1305
|
+
limit: number;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1292
1308
|
/**
|
|
1293
1309
|
* Pattern matching result for wildcard paths
|
|
1294
1310
|
* @internal
|
|
@@ -1439,7 +1455,8 @@ export declare class Registry {
|
|
|
1439
1455
|
private resolveFields;
|
|
1440
1456
|
/**
|
|
1441
1457
|
* Build a `ResolvedTable` from a resolved Link field with many cardinality.
|
|
1442
|
-
*
|
|
1458
|
+
* Columns come from {@link @stonecrop/aform#resolvedFieldsToColumns}, the shared definition of
|
|
1459
|
+
* which resolved fields a cell can render.
|
|
1443
1460
|
* @internal
|
|
1444
1461
|
*/
|
|
1445
1462
|
private buildTableConfig;
|
|
@@ -1961,6 +1978,8 @@ export declare class Stonecrop {
|
|
|
1961
1978
|
* nothing on this side of the wire knows what is safe for an arbitrary backend. A caller that
|
|
1962
1979
|
* passes none gets whatever the server considers a reasonable page.
|
|
1963
1980
|
*
|
|
1981
|
+
* `options.offset === 0` (or omitted) replaces the doctype's HST records; `offset > 0` appends.
|
|
1982
|
+
*
|
|
1964
1983
|
* @param doctype - The doctype
|
|
1965
1984
|
* @param options - Query options (filters, orderBy, limit, offset), forwarded to the client
|
|
1966
1985
|
* @throws Error if no data client has been configured
|
|
@@ -1978,10 +1997,7 @@ export declare class Stonecrop {
|
|
|
1978
1997
|
* @returns Page info, or undefined if this doctype's records have not been fetched
|
|
1979
1998
|
* @public
|
|
1980
1999
|
*/
|
|
1981
|
-
getPageInfo(doctype: string | Doctype):
|
|
1982
|
-
hasMore: boolean;
|
|
1983
|
-
count?: number;
|
|
1984
|
-
} | undefined;
|
|
2000
|
+
getPageInfo(doctype: string | Doctype): PageInfo | undefined;
|
|
1985
2001
|
/**
|
|
1986
2002
|
* Fetch a single record from the server and store it in HST.
|
|
1987
2003
|
*
|
package/dist/stonecrop.js
CHANGED
|
@@ -2,17 +2,18 @@ import { useRouter as Te } from "vue-router";
|
|
|
2
2
|
import { defineStore as be, storeToRefs as ke } from "pinia";
|
|
3
3
|
import { ref as E, computed as P, watch as X, reactive as ue, inject as ee, onMounted as Ce, provide as de, getCurrentInstance as De, nextTick as Pe } from "vue";
|
|
4
4
|
import { useLocalStorage as Le, useMagicKeys as xe, whenever as q } from "@vueuse/core";
|
|
5
|
-
import { normalizeFieldKind as Fe, getRecordIdentity as
|
|
5
|
+
import { normalizeFieldKind as Fe, getRecordIdentity as Ne, getRecordIdField as _e, isActionAllowedInState as fe, resolveLinkRenderMode as ge, componentLinkExpansion as Se, componentCategory as Me } from "@stonecrop/schema";
|
|
6
6
|
import { List as he } from "immutable";
|
|
7
|
-
|
|
7
|
+
import { resolvedFieldsToColumns as Be } from "@stonecrop/aform";
|
|
8
|
+
const We = Object.getPrototypeOf(async () => {
|
|
8
9
|
}).constructor;
|
|
9
10
|
async function Re(s, e = {}) {
|
|
10
11
|
const t = Object.keys(e);
|
|
11
|
-
return new
|
|
12
|
+
return new We(...t, s)(...t.map((i) => e[i]));
|
|
12
13
|
}
|
|
13
|
-
const
|
|
14
|
-
function
|
|
15
|
-
return s ===
|
|
14
|
+
const ze = "new";
|
|
15
|
+
function N(s) {
|
|
16
|
+
return s === ze;
|
|
16
17
|
}
|
|
17
18
|
function le() {
|
|
18
19
|
return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
@@ -31,7 +32,7 @@ function Y(s) {
|
|
|
31
32
|
timestamp: t.timestamp.toISOString()
|
|
32
33
|
}))), e;
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
+
function Ve(s) {
|
|
35
36
|
const e = {
|
|
36
37
|
type: s.type,
|
|
37
38
|
clientId: s.clientId,
|
|
@@ -174,7 +175,7 @@ const G = be("hst-operation-log", () => {
|
|
|
174
175
|
function L() {
|
|
175
176
|
e.value = [], t.value = -1;
|
|
176
177
|
}
|
|
177
|
-
function
|
|
178
|
+
function _(h, p) {
|
|
178
179
|
return e.value.filter((f) => f.doctype === h && (p === void 0 || f.recordId === p));
|
|
179
180
|
}
|
|
180
181
|
function $(h, p) {
|
|
@@ -204,7 +205,7 @@ const G = be("hst-operation-log", () => {
|
|
|
204
205
|
typeof window > "u" || !window.BroadcastChannel || (T = new BroadcastChannel("stonecrop-operation-log"), T.addEventListener("message", (h) => {
|
|
205
206
|
const p = h.data;
|
|
206
207
|
if (!p || typeof p != "object") return;
|
|
207
|
-
const f =
|
|
208
|
+
const f = Ve(p);
|
|
208
209
|
f.clientId !== r.value && (f.type === "operation" && f.operation ? (e.value.push({ ...f.operation, source: "sync" }), t.value = e.value.length - 1) : f.type === "operation" && f.operations && (e.value.push(
|
|
209
210
|
...f.operations.map((I) => Object.assign({}, I, { source: "sync" }))
|
|
210
211
|
), t.value = e.value.length - 1));
|
|
@@ -318,7 +319,7 @@ const G = be("hst-operation-log", () => {
|
|
|
318
319
|
undo: w,
|
|
319
320
|
redo: R,
|
|
320
321
|
clear: L,
|
|
321
|
-
getOperationsFor:
|
|
322
|
+
getOperationsFor: _,
|
|
322
323
|
getSnapshot: C,
|
|
323
324
|
markIrreversible: $,
|
|
324
325
|
logAction: x
|
|
@@ -667,16 +668,16 @@ class U {
|
|
|
667
668
|
function B(s) {
|
|
668
669
|
return new U(s);
|
|
669
670
|
}
|
|
670
|
-
function
|
|
671
|
+
function it(s, e) {
|
|
671
672
|
B().registerAction(s, e);
|
|
672
673
|
}
|
|
673
|
-
function
|
|
674
|
+
function ot(s, e) {
|
|
674
675
|
B().registerTransitionAction(s, e);
|
|
675
676
|
}
|
|
676
|
-
function
|
|
677
|
+
function st(s, e, t) {
|
|
677
678
|
B().setFieldRollback(s, e, t);
|
|
678
679
|
}
|
|
679
|
-
async function
|
|
680
|
+
async function at(s, e, t) {
|
|
680
681
|
const r = B(), i = {
|
|
681
682
|
path: t?.path || (t?.recordId ? `${s}.${t.recordId}` : s),
|
|
682
683
|
fieldname: "",
|
|
@@ -693,7 +694,7 @@ async function ot(s, e, t) {
|
|
|
693
694
|
};
|
|
694
695
|
return await r.executeTransitionActions(i);
|
|
695
696
|
}
|
|
696
|
-
function
|
|
697
|
+
function ct(s, e) {
|
|
697
698
|
if (s)
|
|
698
699
|
try {
|
|
699
700
|
G().markIrreversible(s, e);
|
|
@@ -987,7 +988,7 @@ class te {
|
|
|
987
988
|
return e ? e.replace(/\[(\d+)\]/g, ".$1").split(".").filter((r) => r.length > 0) : [];
|
|
988
989
|
}
|
|
989
990
|
}
|
|
990
|
-
function
|
|
991
|
+
function He(s, e) {
|
|
991
992
|
return new te(s, e, "", null);
|
|
992
993
|
}
|
|
993
994
|
class M {
|
|
@@ -1056,7 +1057,7 @@ class M {
|
|
|
1056
1057
|
const e = {};
|
|
1057
1058
|
Object.keys(this.registry.registry).forEach((t) => {
|
|
1058
1059
|
e[t] = {};
|
|
1059
|
-
}), this.hstStore =
|
|
1060
|
+
}), this.hstStore = He(ue(e), "StonecropStore");
|
|
1060
1061
|
}
|
|
1061
1062
|
/**
|
|
1062
1063
|
* Setup automatic sync with Registry when doctypes are added
|
|
@@ -1151,7 +1152,7 @@ class M {
|
|
|
1151
1152
|
* @returns Object with `ready: true` if all blocked links are loaded, or `ready: false` with `blockedLinks` array
|
|
1152
1153
|
*/
|
|
1153
1154
|
isWorkflowReady(e, t) {
|
|
1154
|
-
if (
|
|
1155
|
+
if (N(t))
|
|
1155
1156
|
return { ready: !0 };
|
|
1156
1157
|
const r = this.registry.getDescendantLinks(e.slug), i = [];
|
|
1157
1158
|
for (const n of r)
|
|
@@ -1174,6 +1175,8 @@ class M {
|
|
|
1174
1175
|
* nothing on this side of the wire knows what is safe for an arbitrary backend. A caller that
|
|
1175
1176
|
* passes none gets whatever the server considers a reasonable page.
|
|
1176
1177
|
*
|
|
1178
|
+
* `options.offset === 0` (or omitted) replaces the doctype's HST records; `offset > 0` appends.
|
|
1179
|
+
*
|
|
1177
1180
|
* @param doctype - The doctype
|
|
1178
1181
|
* @param options - Query options (filters, orderBy, limit, offset), forwarded to the client
|
|
1179
1182
|
* @throws Error if no data client has been configured
|
|
@@ -1184,10 +1187,14 @@ class M {
|
|
|
1184
1187
|
throw new Error(
|
|
1185
1188
|
"No data client configured. Call setClient() with a DataClient implementation (e.g., StonecropClient from @stonecrop/graphql-client) before fetching records."
|
|
1186
1189
|
);
|
|
1187
|
-
const r = await this._client.getRecords(e, t), i = r.data
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1190
|
+
const r = await this._client.getRecords(e, t), i = r.data, n = t?.offset ?? 0, o = {
|
|
1191
|
+
hasMore: r.hasMore,
|
|
1192
|
+
offset: n,
|
|
1193
|
+
limit: i.length
|
|
1194
|
+
};
|
|
1195
|
+
return r.count != null && (o.count = r.count), this.pageInfo[e.slug] = o, n === 0 && this.clearRecords(e), i.forEach((a) => {
|
|
1196
|
+
const c = e.getRecordId(a);
|
|
1197
|
+
c !== void 0 && this.addRecord(e, c, a);
|
|
1191
1198
|
}), r;
|
|
1192
1199
|
}
|
|
1193
1200
|
/**
|
|
@@ -1231,7 +1238,7 @@ class M {
|
|
|
1231
1238
|
const i = typeof e == "string" ? this.registry.getDoctype(e) : e;
|
|
1232
1239
|
if (!i)
|
|
1233
1240
|
throw new Error(`Doctype not found: ${typeof e == "string" ? e : e.slug}`);
|
|
1234
|
-
if (
|
|
1241
|
+
if (N(t) || this.getRecordById(i.slug, t))
|
|
1235
1242
|
return;
|
|
1236
1243
|
const n = await this._client.getRecord(i, t, r);
|
|
1237
1244
|
n?.record && this.addRecord(i, t, n.record);
|
|
@@ -1416,9 +1423,9 @@ function ye(s, e) {
|
|
|
1416
1423
|
const t = new Error(s);
|
|
1417
1424
|
return t.code = e, t;
|
|
1418
1425
|
}
|
|
1419
|
-
function
|
|
1426
|
+
function qe(s) {
|
|
1420
1427
|
s || (s = {});
|
|
1421
|
-
const e = s.registry || ee("$registry"), t = ee("$stonecrop"), r = E(), i = E(), n = E({}), o = E([]), a = E(!1), c = E(null), u = E(), l = P(() => !r.value || !u.value || !s.recordId ||
|
|
1428
|
+
const e = s.registry || ee("$registry"), t = ee("$stonecrop"), r = E(), i = E(), n = E({}), o = E([]), a = E(!1), c = E(null), u = E(), l = P(() => !r.value || !u.value || !s.recordId || N(s.recordId) ? !0 : r.value.isWorkflowReady(u.value, s.recordId).ready), d = P(() => !r.value || !u.value || !s.recordId || N(s.recordId) ? [] : r.value.isWorkflowReady(u.value, s.recordId).blockedLinks ?? []), v = t || M._root;
|
|
1422
1429
|
v && (r.value = v), s?.doctype && typeof s.doctype != "string" && (u.value = s.doctype);
|
|
1423
1430
|
const S = E([]), m = E(-1), k = P(() => r.value?.getOperationLogStore().canUndo ?? !1), w = P(() => r.value?.getOperationLogStore().canRedo ?? !1), R = P(() => r.value?.getOperationLogStore().undoCount ?? 0), C = P(() => r.value?.getOperationLogStore().redoCount ?? 0), L = P(
|
|
1424
1431
|
() => r.value?.getOperationLogStore().undoRedoState ?? {
|
|
@@ -1428,7 +1435,7 @@ function He(s) {
|
|
|
1428
1435
|
redoCount: 0,
|
|
1429
1436
|
currentIndex: -1
|
|
1430
1437
|
}
|
|
1431
|
-
),
|
|
1438
|
+
), _ = (g) => r.value?.getOperationLogStore().undo(g) ?? !1, $ = (g) => r.value?.getOperationLogStore().redo(g) ?? !1, x = () => {
|
|
1432
1439
|
r.value?.getOperationLogStore().startBatch();
|
|
1433
1440
|
}, T = (g) => r.value?.getOperationLogStore().commitBatch(g) ?? null, z = () => {
|
|
1434
1441
|
r.value?.getOperationLogStore().cancelBatch();
|
|
@@ -1461,7 +1468,7 @@ function He(s) {
|
|
|
1461
1468
|
);
|
|
1462
1469
|
} catch {
|
|
1463
1470
|
}
|
|
1464
|
-
s.doctype && typeof s.doctype != "string" && e && r.value && (i.value = r.value.getStore(), o.value = e.resolveSchema(s.doctype), (!s.recordId ||
|
|
1471
|
+
s.doctype && typeof s.doctype != "string" && e && r.value && (i.value = r.value.getStore(), o.value = e.resolveSchema(s.doctype), (!s.recordId || N(s.recordId)) && (n.value = e.initializeRecord(o.value)), i.value && we(s.doctype, s.recordId || "new", n, i.value)), Ce(async () => {
|
|
1465
1472
|
if (!(!e || !r.value) && s.doctype) {
|
|
1466
1473
|
const g = s.recordId;
|
|
1467
1474
|
if (typeof s.doctype == "string") {
|
|
@@ -1483,7 +1490,7 @@ function He(s) {
|
|
|
1483
1490
|
a.value = !1;
|
|
1484
1491
|
}
|
|
1485
1492
|
if (u.value = b, !b) return;
|
|
1486
|
-
if (o.value = e.resolveSchema(b), g && !
|
|
1493
|
+
if (o.value = e.resolveSchema(b), g && !N(g)) {
|
|
1487
1494
|
const O = r.value.getRecordById(b, g);
|
|
1488
1495
|
if (O)
|
|
1489
1496
|
n.value = O.get("") || {};
|
|
@@ -1498,7 +1505,7 @@ function He(s) {
|
|
|
1498
1505
|
} else
|
|
1499
1506
|
n.value = e.initializeRecord(o.value);
|
|
1500
1507
|
i.value && we(b, g || "new", n, i.value);
|
|
1501
|
-
} else if (g && !
|
|
1508
|
+
} else if (g && !N(g)) {
|
|
1502
1509
|
const y = s.doctype, b = r.value.getRecordById(y, g);
|
|
1503
1510
|
if (b)
|
|
1504
1511
|
n.value = b.get("") || {};
|
|
@@ -1537,7 +1544,7 @@ function He(s) {
|
|
|
1537
1544
|
}
|
|
1538
1545
|
i.value.set(g.path, g.value);
|
|
1539
1546
|
const O = g.fieldname.split("."), D = { ...n.value };
|
|
1540
|
-
O.length === 1 ? D[O[0]] = g.value :
|
|
1547
|
+
O.length === 1 ? D[O[0]] = g.value : Ue(D, O, g.value), n.value = D;
|
|
1541
1548
|
} catch {
|
|
1542
1549
|
}
|
|
1543
1550
|
};
|
|
@@ -1571,7 +1578,7 @@ function He(s) {
|
|
|
1571
1578
|
canRedo: w,
|
|
1572
1579
|
undoCount: R,
|
|
1573
1580
|
redoCount: C,
|
|
1574
|
-
undo:
|
|
1581
|
+
undo: _,
|
|
1575
1582
|
redo: $,
|
|
1576
1583
|
startBatch: x,
|
|
1577
1584
|
commitBatch: T,
|
|
@@ -1621,7 +1628,7 @@ function we(s, e, t, r) {
|
|
|
1621
1628
|
{ deep: !0 }
|
|
1622
1629
|
);
|
|
1623
1630
|
}
|
|
1624
|
-
function
|
|
1631
|
+
function Ue(s, e, t) {
|
|
1625
1632
|
let r = s;
|
|
1626
1633
|
for (let n = 0; n < e.length - 1; n++) {
|
|
1627
1634
|
const o = e[n];
|
|
@@ -1630,15 +1637,15 @@ function qe(s, e, t) {
|
|
|
1630
1637
|
const i = e[e.length - 1];
|
|
1631
1638
|
r[i] = t;
|
|
1632
1639
|
}
|
|
1633
|
-
function
|
|
1640
|
+
function je(s, e) {
|
|
1634
1641
|
if (e[s.recordIdField] !== void 0)
|
|
1635
1642
|
return s.getRecordId(e);
|
|
1636
1643
|
}
|
|
1637
|
-
function
|
|
1644
|
+
function Ge(s) {
|
|
1638
1645
|
console.error("Action failed:", s.message), typeof window < "u" && window.alert(s.message);
|
|
1639
1646
|
}
|
|
1640
|
-
function
|
|
1641
|
-
const { stonecrop: e } =
|
|
1647
|
+
function lt(s = {}) {
|
|
1648
|
+
const { stonecrop: e } = qe(), t = Te(), r = s.onError ?? Ge, i = () => t ?? e.value?.registry.router, n = s.buildArgs ?? // Spreading `undefined` in an object literal adds nothing, so `extra` needs no fallback.
|
|
1642
1649
|
(({ recordId: u, isDraft: l, data: d, extra: v }) => [{ ...l ? {} : { id: u }, data: d, ...v }]), o = s.followRecord ?? (async ({ doctype: u, recordId: l }) => {
|
|
1643
1650
|
await i()?.replace(`/${u}/${l}`);
|
|
1644
1651
|
});
|
|
@@ -1647,13 +1654,13 @@ function at(s = {}) {
|
|
|
1647
1654
|
if (!m) return { success: !1, data: null, error: "Stonecrop is not initialized" };
|
|
1648
1655
|
const k = m.registry.getDoctype(u);
|
|
1649
1656
|
if (!k) return { success: !1, data: null, error: `Unknown doctype: ${u}` };
|
|
1650
|
-
const w =
|
|
1657
|
+
const w = N(l), R = await m.dispatchAction(
|
|
1651
1658
|
k,
|
|
1652
1659
|
v,
|
|
1653
1660
|
n({ doctype: u, action: v, recordId: l, isDraft: w, data: d, extra: S })
|
|
1654
1661
|
);
|
|
1655
1662
|
if (R.success && R.data) {
|
|
1656
|
-
const C = R.data, L =
|
|
1663
|
+
const C = R.data, L = je(k, C);
|
|
1657
1664
|
if (L === void 0)
|
|
1658
1665
|
return w || m.addRecord(u, l, C), R;
|
|
1659
1666
|
l !== L && (m.removeRecord(u, l), await o({ doctype: u, recordId: L, previousRecordId: l }));
|
|
@@ -1675,13 +1682,13 @@ function at(s = {}) {
|
|
|
1675
1682
|
});
|
|
1676
1683
|
return;
|
|
1677
1684
|
}
|
|
1678
|
-
const C = l.getRecordById(v, S)?.get("") ?? m, L = ($, x) => a(v, S, m, $, x),
|
|
1685
|
+
const C = l.getRecordById(v, S)?.get("") ?? m, L = ($, x) => a(v, S, m, $, x), _ = {
|
|
1679
1686
|
query($, x) {
|
|
1680
1687
|
const T = l.getClient();
|
|
1681
1688
|
return T?.query ? T.query($, x) : Promise.reject(new Error("The configured data client does not support graphql.query"));
|
|
1682
1689
|
}
|
|
1683
1690
|
};
|
|
1684
|
-
await Re(R, { router: i(), record: C, runAction: L, graphql:
|
|
1691
|
+
await Re(R, { router: i(), record: C, runAction: L, graphql: _ });
|
|
1685
1692
|
} catch (C) {
|
|
1686
1693
|
r({
|
|
1687
1694
|
message: C instanceof Error ? C.message : String(C),
|
|
@@ -1694,7 +1701,7 @@ function at(s = {}) {
|
|
|
1694
1701
|
}
|
|
1695
1702
|
return { run: c };
|
|
1696
1703
|
}
|
|
1697
|
-
function
|
|
1704
|
+
function ut(s, e, t) {
|
|
1698
1705
|
const r = ee("$stonecrop") || M._root;
|
|
1699
1706
|
if (!r)
|
|
1700
1707
|
throw new Error("Stonecrop instance not available. Ensure useStonecrop() has been called first.");
|
|
@@ -1779,7 +1786,7 @@ function $e(s) {
|
|
|
1779
1786
|
function L($, x, T, z = "success", V) {
|
|
1780
1787
|
return t.logAction($, x, T, z, V);
|
|
1781
1788
|
}
|
|
1782
|
-
function
|
|
1789
|
+
function _($) {
|
|
1783
1790
|
t.configure($);
|
|
1784
1791
|
}
|
|
1785
1792
|
return {
|
|
@@ -1802,10 +1809,10 @@ function $e(s) {
|
|
|
1802
1809
|
getSnapshot: R,
|
|
1803
1810
|
markIrreversible: C,
|
|
1804
1811
|
logAction: L,
|
|
1805
|
-
configure:
|
|
1812
|
+
configure: _
|
|
1806
1813
|
};
|
|
1807
1814
|
}
|
|
1808
|
-
function
|
|
1815
|
+
function dt(s, e = !0) {
|
|
1809
1816
|
if (!e) return;
|
|
1810
1817
|
const { undo: t, redo: r, canUndo: i, canRedo: n } = $e(), o = xe();
|
|
1811
1818
|
q(o["Ctrl+Z"], () => {
|
|
@@ -1820,7 +1827,7 @@ function lt(s, e = !0) {
|
|
|
1820
1827
|
n.value && r(s);
|
|
1821
1828
|
});
|
|
1822
1829
|
}
|
|
1823
|
-
async function
|
|
1830
|
+
async function ft(s, e) {
|
|
1824
1831
|
const { startBatch: t, commitBatch: r, cancelBatch: i } = $e();
|
|
1825
1832
|
t();
|
|
1826
1833
|
try {
|
|
@@ -1959,7 +1966,7 @@ class Oe {
|
|
|
1959
1966
|
* @public
|
|
1960
1967
|
*/
|
|
1961
1968
|
getRecordId(e) {
|
|
1962
|
-
return
|
|
1969
|
+
return Ne(this.getSchemaArray(), e);
|
|
1963
1970
|
}
|
|
1964
1971
|
/**
|
|
1965
1972
|
* The field a record of this doctype is identified by: the declared `primaryKey`, or `id`
|
|
@@ -1980,7 +1987,7 @@ class Oe {
|
|
|
1980
1987
|
* @public
|
|
1981
1988
|
*/
|
|
1982
1989
|
get recordIdField() {
|
|
1983
|
-
return
|
|
1990
|
+
return _e(this.getSchemaArray());
|
|
1984
1991
|
}
|
|
1985
1992
|
/**
|
|
1986
1993
|
* Returns the transitions available from a given workflow state, derived from the
|
|
@@ -2262,11 +2269,12 @@ class j {
|
|
|
2262
2269
|
}
|
|
2263
2270
|
/**
|
|
2264
2271
|
* Build a `ResolvedTable` from a resolved Link field with many cardinality.
|
|
2265
|
-
*
|
|
2272
|
+
* Columns come from {@link @stonecrop/aform#resolvedFieldsToColumns}, the shared definition of
|
|
2273
|
+
* which resolved fields a cell can render.
|
|
2266
2274
|
* @internal
|
|
2267
2275
|
*/
|
|
2268
2276
|
buildTableConfig(e, t, r) {
|
|
2269
|
-
const i = t
|
|
2277
|
+
const i = Be(t), n = e.config ?? { view: "list" }, { options: o, cardinality: a, ...c } = e;
|
|
2270
2278
|
return {
|
|
2271
2279
|
...c,
|
|
2272
2280
|
kind: "table",
|
|
@@ -2399,14 +2407,14 @@ class j {
|
|
|
2399
2407
|
// }
|
|
2400
2408
|
// }
|
|
2401
2409
|
}
|
|
2402
|
-
async function
|
|
2410
|
+
async function Ke(s, e, t) {
|
|
2403
2411
|
await Pe();
|
|
2404
2412
|
try {
|
|
2405
2413
|
await t(s, e);
|
|
2406
2414
|
} catch {
|
|
2407
2415
|
}
|
|
2408
2416
|
}
|
|
2409
|
-
const
|
|
2417
|
+
const gt = {
|
|
2410
2418
|
install: (s, e) => {
|
|
2411
2419
|
const t = s.config.globalProperties.$router, r = e?.router, i = t || r;
|
|
2412
2420
|
!t && r && s.use(r);
|
|
@@ -2426,9 +2434,9 @@ const dt = {
|
|
|
2426
2434
|
if (e?.components)
|
|
2427
2435
|
for (const [a, c] of Object.entries(e.components))
|
|
2428
2436
|
s.component(a, c);
|
|
2429
|
-
e?.autoInitializeRouter && e.onRouterInitialized &&
|
|
2437
|
+
e?.autoInitializeRouter && e.onRouterInitialized && Ke(n, o, e.onRouterInitialized);
|
|
2430
2438
|
}
|
|
2431
|
-
},
|
|
2439
|
+
}, ht = be("stonecrop-validation", () => {
|
|
2432
2440
|
const s = E([]), e = P(() => s.value.length === 0), t = P(() => {
|
|
2433
2441
|
const l = {};
|
|
2434
2442
|
for (const d of s.value)
|
|
@@ -2481,7 +2489,7 @@ const dt = {
|
|
|
2481
2489
|
};
|
|
2482
2490
|
});
|
|
2483
2491
|
var A = /* @__PURE__ */ ((s) => (s.ERROR = "error", s.WARNING = "warning", s.INFO = "info", s))(A || {});
|
|
2484
|
-
class
|
|
2492
|
+
class Ze {
|
|
2485
2493
|
options;
|
|
2486
2494
|
/**
|
|
2487
2495
|
* Creates a new SchemaValidator instance
|
|
@@ -2721,43 +2729,43 @@ class Ke {
|
|
|
2721
2729
|
return r;
|
|
2722
2730
|
}
|
|
2723
2731
|
}
|
|
2724
|
-
function
|
|
2725
|
-
return new
|
|
2732
|
+
function Je(s, e) {
|
|
2733
|
+
return new Ze({
|
|
2726
2734
|
registry: s,
|
|
2727
2735
|
...e
|
|
2728
2736
|
});
|
|
2729
2737
|
}
|
|
2730
|
-
function
|
|
2731
|
-
return
|
|
2738
|
+
function pt(s, e, t, r, i) {
|
|
2739
|
+
return Je(t).validate(s, e, r, i);
|
|
2732
2740
|
}
|
|
2733
2741
|
export {
|
|
2734
|
-
|
|
2742
|
+
ze as DRAFT_RECORD_ID,
|
|
2735
2743
|
Oe as Doctype,
|
|
2736
2744
|
U as FieldTriggerEngine,
|
|
2737
2745
|
W as HST,
|
|
2738
2746
|
j as Registry,
|
|
2739
|
-
|
|
2747
|
+
Ze as SchemaValidator,
|
|
2740
2748
|
M as Stonecrop,
|
|
2741
2749
|
A as ValidationSeverity,
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2750
|
+
He as createHST,
|
|
2751
|
+
Je as createValidator,
|
|
2752
|
+
gt as default,
|
|
2745
2753
|
Re as executeClientHandler,
|
|
2746
2754
|
B as getGlobalTriggerEngine,
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
+
N as isDraftRecordId,
|
|
2756
|
+
ct as markOperationIrreversible,
|
|
2757
|
+
it as registerGlobalAction,
|
|
2758
|
+
ot as registerTransitionAction,
|
|
2759
|
+
st as setFieldRollback,
|
|
2760
|
+
at as triggerTransition,
|
|
2761
|
+
lt as useClientAction,
|
|
2762
|
+
ut as useLazyLink,
|
|
2755
2763
|
$e as useOperationLog,
|
|
2756
2764
|
G as useOperationLogStore,
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2765
|
+
qe as useStonecrop,
|
|
2766
|
+
dt as useUndoRedoShortcuts,
|
|
2767
|
+
ht as useValidationStore,
|
|
2768
|
+
pt as validateSchema,
|
|
2769
|
+
ft as withBatch
|
|
2762
2770
|
};
|
|
2763
2771
|
//# sourceMappingURL=stonecrop.js.map
|