@stonecrop/stonecrop 0.25.0 → 0.27.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/stonecrop.d.ts +2 -1
- package/dist/stonecrop.js +74 -72
- package/dist/stonecrop.js.map +1 -1
- package/package.json +4 -4
- package/src/registry.ts +5 -6
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,CAAA;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE/C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,QAAQ;IAC5B;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAA;IAEtB;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAa;IAElC;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAK;IAE/C;;;;;;;OAOG;IACH,OAAO,CAAC,cAAc,CAAqE;IAE3F;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB,CAAgB;IAE3C;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IAExB;;;;OAIG;gBACS,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAUjG;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAEpE;;;;;OAKG;IACH,UAAU,CAAC,OAAO,EAAE,OAAO;IAsB3B;;;;;;;;;;;;;;;;;;OAkBG;IACH,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,aAAa,EAAE;IA4BvE;;;;OAIG;IACH,OAAO,CAAC,aAAa;IA2FrB;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAgBxB;;;;;;;;;;;OAWG;IACH,gBAAgB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAuC9D;;;;;OAKG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAI7C;;;;;;;;;;;;;OAaG;IACH,kBAAkB,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/stonecrop.d.ts
CHANGED
|
@@ -1455,7 +1455,8 @@ export declare class Registry {
|
|
|
1455
1455
|
private resolveFields;
|
|
1456
1456
|
/**
|
|
1457
1457
|
* Build a `ResolvedTable` from a resolved Link field with many cardinality.
|
|
1458
|
-
*
|
|
1458
|
+
* Columns come from {@link @stonecrop/aform#resolvedFieldsToColumns}, the shared definition of
|
|
1459
|
+
* which resolved fields a cell can render.
|
|
1459
1460
|
* @internal
|
|
1460
1461
|
*/
|
|
1461
1462
|
private buildTableConfig;
|
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)
|
|
@@ -1237,7 +1238,7 @@ class M {
|
|
|
1237
1238
|
const i = typeof e == "string" ? this.registry.getDoctype(e) : e;
|
|
1238
1239
|
if (!i)
|
|
1239
1240
|
throw new Error(`Doctype not found: ${typeof e == "string" ? e : e.slug}`);
|
|
1240
|
-
if (
|
|
1241
|
+
if (N(t) || this.getRecordById(i.slug, t))
|
|
1241
1242
|
return;
|
|
1242
1243
|
const n = await this._client.getRecord(i, t, r);
|
|
1243
1244
|
n?.record && this.addRecord(i, t, n.record);
|
|
@@ -1422,9 +1423,9 @@ function ye(s, e) {
|
|
|
1422
1423
|
const t = new Error(s);
|
|
1423
1424
|
return t.code = e, t;
|
|
1424
1425
|
}
|
|
1425
|
-
function
|
|
1426
|
+
function qe(s) {
|
|
1426
1427
|
s || (s = {});
|
|
1427
|
-
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;
|
|
1428
1429
|
v && (r.value = v), s?.doctype && typeof s.doctype != "string" && (u.value = s.doctype);
|
|
1429
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(
|
|
1430
1431
|
() => r.value?.getOperationLogStore().undoRedoState ?? {
|
|
@@ -1434,7 +1435,7 @@ function He(s) {
|
|
|
1434
1435
|
redoCount: 0,
|
|
1435
1436
|
currentIndex: -1
|
|
1436
1437
|
}
|
|
1437
|
-
),
|
|
1438
|
+
), _ = (g) => r.value?.getOperationLogStore().undo(g) ?? !1, $ = (g) => r.value?.getOperationLogStore().redo(g) ?? !1, x = () => {
|
|
1438
1439
|
r.value?.getOperationLogStore().startBatch();
|
|
1439
1440
|
}, T = (g) => r.value?.getOperationLogStore().commitBatch(g) ?? null, z = () => {
|
|
1440
1441
|
r.value?.getOperationLogStore().cancelBatch();
|
|
@@ -1467,7 +1468,7 @@ function He(s) {
|
|
|
1467
1468
|
);
|
|
1468
1469
|
} catch {
|
|
1469
1470
|
}
|
|
1470
|
-
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 () => {
|
|
1471
1472
|
if (!(!e || !r.value) && s.doctype) {
|
|
1472
1473
|
const g = s.recordId;
|
|
1473
1474
|
if (typeof s.doctype == "string") {
|
|
@@ -1489,7 +1490,7 @@ function He(s) {
|
|
|
1489
1490
|
a.value = !1;
|
|
1490
1491
|
}
|
|
1491
1492
|
if (u.value = b, !b) return;
|
|
1492
|
-
if (o.value = e.resolveSchema(b), g && !
|
|
1493
|
+
if (o.value = e.resolveSchema(b), g && !N(g)) {
|
|
1493
1494
|
const O = r.value.getRecordById(b, g);
|
|
1494
1495
|
if (O)
|
|
1495
1496
|
n.value = O.get("") || {};
|
|
@@ -1504,7 +1505,7 @@ function He(s) {
|
|
|
1504
1505
|
} else
|
|
1505
1506
|
n.value = e.initializeRecord(o.value);
|
|
1506
1507
|
i.value && we(b, g || "new", n, i.value);
|
|
1507
|
-
} else if (g && !
|
|
1508
|
+
} else if (g && !N(g)) {
|
|
1508
1509
|
const y = s.doctype, b = r.value.getRecordById(y, g);
|
|
1509
1510
|
if (b)
|
|
1510
1511
|
n.value = b.get("") || {};
|
|
@@ -1543,7 +1544,7 @@ function He(s) {
|
|
|
1543
1544
|
}
|
|
1544
1545
|
i.value.set(g.path, g.value);
|
|
1545
1546
|
const O = g.fieldname.split("."), D = { ...n.value };
|
|
1546
|
-
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;
|
|
1547
1548
|
} catch {
|
|
1548
1549
|
}
|
|
1549
1550
|
};
|
|
@@ -1577,7 +1578,7 @@ function He(s) {
|
|
|
1577
1578
|
canRedo: w,
|
|
1578
1579
|
undoCount: R,
|
|
1579
1580
|
redoCount: C,
|
|
1580
|
-
undo:
|
|
1581
|
+
undo: _,
|
|
1581
1582
|
redo: $,
|
|
1582
1583
|
startBatch: x,
|
|
1583
1584
|
commitBatch: T,
|
|
@@ -1627,7 +1628,7 @@ function we(s, e, t, r) {
|
|
|
1627
1628
|
{ deep: !0 }
|
|
1628
1629
|
);
|
|
1629
1630
|
}
|
|
1630
|
-
function
|
|
1631
|
+
function Ue(s, e, t) {
|
|
1631
1632
|
let r = s;
|
|
1632
1633
|
for (let n = 0; n < e.length - 1; n++) {
|
|
1633
1634
|
const o = e[n];
|
|
@@ -1636,15 +1637,15 @@ function qe(s, e, t) {
|
|
|
1636
1637
|
const i = e[e.length - 1];
|
|
1637
1638
|
r[i] = t;
|
|
1638
1639
|
}
|
|
1639
|
-
function
|
|
1640
|
+
function je(s, e) {
|
|
1640
1641
|
if (e[s.recordIdField] !== void 0)
|
|
1641
1642
|
return s.getRecordId(e);
|
|
1642
1643
|
}
|
|
1643
|
-
function
|
|
1644
|
+
function Ge(s) {
|
|
1644
1645
|
console.error("Action failed:", s.message), typeof window < "u" && window.alert(s.message);
|
|
1645
1646
|
}
|
|
1646
|
-
function
|
|
1647
|
-
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.
|
|
1648
1649
|
(({ recordId: u, isDraft: l, data: d, extra: v }) => [{ ...l ? {} : { id: u }, data: d, ...v }]), o = s.followRecord ?? (async ({ doctype: u, recordId: l }) => {
|
|
1649
1650
|
await i()?.replace(`/${u}/${l}`);
|
|
1650
1651
|
});
|
|
@@ -1653,13 +1654,13 @@ function at(s = {}) {
|
|
|
1653
1654
|
if (!m) return { success: !1, data: null, error: "Stonecrop is not initialized" };
|
|
1654
1655
|
const k = m.registry.getDoctype(u);
|
|
1655
1656
|
if (!k) return { success: !1, data: null, error: `Unknown doctype: ${u}` };
|
|
1656
|
-
const w =
|
|
1657
|
+
const w = N(l), R = await m.dispatchAction(
|
|
1657
1658
|
k,
|
|
1658
1659
|
v,
|
|
1659
1660
|
n({ doctype: u, action: v, recordId: l, isDraft: w, data: d, extra: S })
|
|
1660
1661
|
);
|
|
1661
1662
|
if (R.success && R.data) {
|
|
1662
|
-
const C = R.data, L =
|
|
1663
|
+
const C = R.data, L = je(k, C);
|
|
1663
1664
|
if (L === void 0)
|
|
1664
1665
|
return w || m.addRecord(u, l, C), R;
|
|
1665
1666
|
l !== L && (m.removeRecord(u, l), await o({ doctype: u, recordId: L, previousRecordId: l }));
|
|
@@ -1681,13 +1682,13 @@ function at(s = {}) {
|
|
|
1681
1682
|
});
|
|
1682
1683
|
return;
|
|
1683
1684
|
}
|
|
1684
|
-
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), _ = {
|
|
1685
1686
|
query($, x) {
|
|
1686
1687
|
const T = l.getClient();
|
|
1687
1688
|
return T?.query ? T.query($, x) : Promise.reject(new Error("The configured data client does not support graphql.query"));
|
|
1688
1689
|
}
|
|
1689
1690
|
};
|
|
1690
|
-
await Re(R, { router: i(), record: C, runAction: L, graphql:
|
|
1691
|
+
await Re(R, { router: i(), record: C, runAction: L, graphql: _ });
|
|
1691
1692
|
} catch (C) {
|
|
1692
1693
|
r({
|
|
1693
1694
|
message: C instanceof Error ? C.message : String(C),
|
|
@@ -1700,7 +1701,7 @@ function at(s = {}) {
|
|
|
1700
1701
|
}
|
|
1701
1702
|
return { run: c };
|
|
1702
1703
|
}
|
|
1703
|
-
function
|
|
1704
|
+
function ut(s, e, t) {
|
|
1704
1705
|
const r = ee("$stonecrop") || M._root;
|
|
1705
1706
|
if (!r)
|
|
1706
1707
|
throw new Error("Stonecrop instance not available. Ensure useStonecrop() has been called first.");
|
|
@@ -1785,7 +1786,7 @@ function $e(s) {
|
|
|
1785
1786
|
function L($, x, T, z = "success", V) {
|
|
1786
1787
|
return t.logAction($, x, T, z, V);
|
|
1787
1788
|
}
|
|
1788
|
-
function
|
|
1789
|
+
function _($) {
|
|
1789
1790
|
t.configure($);
|
|
1790
1791
|
}
|
|
1791
1792
|
return {
|
|
@@ -1808,10 +1809,10 @@ function $e(s) {
|
|
|
1808
1809
|
getSnapshot: R,
|
|
1809
1810
|
markIrreversible: C,
|
|
1810
1811
|
logAction: L,
|
|
1811
|
-
configure:
|
|
1812
|
+
configure: _
|
|
1812
1813
|
};
|
|
1813
1814
|
}
|
|
1814
|
-
function
|
|
1815
|
+
function dt(s, e = !0) {
|
|
1815
1816
|
if (!e) return;
|
|
1816
1817
|
const { undo: t, redo: r, canUndo: i, canRedo: n } = $e(), o = xe();
|
|
1817
1818
|
q(o["Ctrl+Z"], () => {
|
|
@@ -1826,7 +1827,7 @@ function lt(s, e = !0) {
|
|
|
1826
1827
|
n.value && r(s);
|
|
1827
1828
|
});
|
|
1828
1829
|
}
|
|
1829
|
-
async function
|
|
1830
|
+
async function ft(s, e) {
|
|
1830
1831
|
const { startBatch: t, commitBatch: r, cancelBatch: i } = $e();
|
|
1831
1832
|
t();
|
|
1832
1833
|
try {
|
|
@@ -1965,7 +1966,7 @@ class Oe {
|
|
|
1965
1966
|
* @public
|
|
1966
1967
|
*/
|
|
1967
1968
|
getRecordId(e) {
|
|
1968
|
-
return
|
|
1969
|
+
return Ne(this.getSchemaArray(), e);
|
|
1969
1970
|
}
|
|
1970
1971
|
/**
|
|
1971
1972
|
* The field a record of this doctype is identified by: the declared `primaryKey`, or `id`
|
|
@@ -1986,7 +1987,7 @@ class Oe {
|
|
|
1986
1987
|
* @public
|
|
1987
1988
|
*/
|
|
1988
1989
|
get recordIdField() {
|
|
1989
|
-
return
|
|
1990
|
+
return _e(this.getSchemaArray());
|
|
1990
1991
|
}
|
|
1991
1992
|
/**
|
|
1992
1993
|
* Returns the transitions available from a given workflow state, derived from the
|
|
@@ -2268,11 +2269,12 @@ class j {
|
|
|
2268
2269
|
}
|
|
2269
2270
|
/**
|
|
2270
2271
|
* Build a `ResolvedTable` from a resolved Link field with many cardinality.
|
|
2271
|
-
*
|
|
2272
|
+
* Columns come from {@link @stonecrop/aform#resolvedFieldsToColumns}, the shared definition of
|
|
2273
|
+
* which resolved fields a cell can render.
|
|
2272
2274
|
* @internal
|
|
2273
2275
|
*/
|
|
2274
2276
|
buildTableConfig(e, t, r) {
|
|
2275
|
-
const i = t
|
|
2277
|
+
const i = Be(t), n = e.config ?? { view: "list" }, { options: o, cardinality: a, ...c } = e;
|
|
2276
2278
|
return {
|
|
2277
2279
|
...c,
|
|
2278
2280
|
kind: "table",
|
|
@@ -2405,14 +2407,14 @@ class j {
|
|
|
2405
2407
|
// }
|
|
2406
2408
|
// }
|
|
2407
2409
|
}
|
|
2408
|
-
async function
|
|
2410
|
+
async function Ke(s, e, t) {
|
|
2409
2411
|
await Pe();
|
|
2410
2412
|
try {
|
|
2411
2413
|
await t(s, e);
|
|
2412
2414
|
} catch {
|
|
2413
2415
|
}
|
|
2414
2416
|
}
|
|
2415
|
-
const
|
|
2417
|
+
const gt = {
|
|
2416
2418
|
install: (s, e) => {
|
|
2417
2419
|
const t = s.config.globalProperties.$router, r = e?.router, i = t || r;
|
|
2418
2420
|
!t && r && s.use(r);
|
|
@@ -2432,9 +2434,9 @@ const dt = {
|
|
|
2432
2434
|
if (e?.components)
|
|
2433
2435
|
for (const [a, c] of Object.entries(e.components))
|
|
2434
2436
|
s.component(a, c);
|
|
2435
|
-
e?.autoInitializeRouter && e.onRouterInitialized &&
|
|
2437
|
+
e?.autoInitializeRouter && e.onRouterInitialized && Ke(n, o, e.onRouterInitialized);
|
|
2436
2438
|
}
|
|
2437
|
-
},
|
|
2439
|
+
}, ht = be("stonecrop-validation", () => {
|
|
2438
2440
|
const s = E([]), e = P(() => s.value.length === 0), t = P(() => {
|
|
2439
2441
|
const l = {};
|
|
2440
2442
|
for (const d of s.value)
|
|
@@ -2487,7 +2489,7 @@ const dt = {
|
|
|
2487
2489
|
};
|
|
2488
2490
|
});
|
|
2489
2491
|
var A = /* @__PURE__ */ ((s) => (s.ERROR = "error", s.WARNING = "warning", s.INFO = "info", s))(A || {});
|
|
2490
|
-
class
|
|
2492
|
+
class Ze {
|
|
2491
2493
|
options;
|
|
2492
2494
|
/**
|
|
2493
2495
|
* Creates a new SchemaValidator instance
|
|
@@ -2727,43 +2729,43 @@ class Ke {
|
|
|
2727
2729
|
return r;
|
|
2728
2730
|
}
|
|
2729
2731
|
}
|
|
2730
|
-
function
|
|
2731
|
-
return new
|
|
2732
|
+
function Je(s, e) {
|
|
2733
|
+
return new Ze({
|
|
2732
2734
|
registry: s,
|
|
2733
2735
|
...e
|
|
2734
2736
|
});
|
|
2735
2737
|
}
|
|
2736
|
-
function
|
|
2737
|
-
return
|
|
2738
|
+
function pt(s, e, t, r, i) {
|
|
2739
|
+
return Je(t).validate(s, e, r, i);
|
|
2738
2740
|
}
|
|
2739
2741
|
export {
|
|
2740
|
-
|
|
2742
|
+
ze as DRAFT_RECORD_ID,
|
|
2741
2743
|
Oe as Doctype,
|
|
2742
2744
|
U as FieldTriggerEngine,
|
|
2743
2745
|
W as HST,
|
|
2744
2746
|
j as Registry,
|
|
2745
|
-
|
|
2747
|
+
Ze as SchemaValidator,
|
|
2746
2748
|
M as Stonecrop,
|
|
2747
2749
|
A as ValidationSeverity,
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2750
|
+
He as createHST,
|
|
2751
|
+
Je as createValidator,
|
|
2752
|
+
gt as default,
|
|
2751
2753
|
Re as executeClientHandler,
|
|
2752
2754
|
B as getGlobalTriggerEngine,
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
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,
|
|
2761
2763
|
$e as useOperationLog,
|
|
2762
2764
|
G as useOperationLogStore,
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2765
|
+
qe as useStonecrop,
|
|
2766
|
+
dt as useUndoRedoShortcuts,
|
|
2767
|
+
ht as useValidationStore,
|
|
2768
|
+
pt as validateSchema,
|
|
2769
|
+
ft as withBatch
|
|
2768
2770
|
};
|
|
2769
2771
|
//# sourceMappingURL=stonecrop.js.map
|