@stonecrop/stonecrop 0.18.0 → 0.20.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/doctype.d.ts +8 -1
- package/dist/src/doctype.d.ts.map +1 -1
- package/dist/src/doctype.js +10 -2
- package/dist/src/types/doctype.d.ts +2 -0
- package/dist/src/types/doctype.d.ts.map +1 -1
- package/dist/stonecrop.d.ts +10 -1
- package/dist/stonecrop.js +10 -3
- package/dist/stonecrop.js.map +1 -1
- package/package.json +4 -4
- package/src/doctype.ts +12 -2
- package/src/types/doctype.ts +2 -0
package/dist/src/doctype.d.ts
CHANGED
|
@@ -42,6 +42,12 @@ export default class Doctype {
|
|
|
42
42
|
* @readonly
|
|
43
43
|
*/
|
|
44
44
|
readonly links?: Record<string, LinkDeclaration>;
|
|
45
|
+
/**
|
|
46
|
+
* Field on this doctype used when displaying a reference to one of its records.
|
|
47
|
+
* @public
|
|
48
|
+
* @readonly
|
|
49
|
+
*/
|
|
50
|
+
readonly displayField?: string;
|
|
45
51
|
/**
|
|
46
52
|
* Creates a new Doctype instance
|
|
47
53
|
* @param doctype - The doctype name
|
|
@@ -49,8 +55,9 @@ export default class Doctype {
|
|
|
49
55
|
* @param workflow - The doctype workflow configuration (XState machine)
|
|
50
56
|
* @param component - Optional Vue component for rendering the doctype
|
|
51
57
|
* @param links - Optional relationship links to other doctypes
|
|
58
|
+
* @param displayField - Optional field used when displaying references to this doctype
|
|
52
59
|
*/
|
|
53
|
-
constructor(doctype: string, schema: ImmutableDoctype['schema'], workflow: ImmutableDoctype['workflow'], component?: Component, links?: Record<string, LinkDeclaration
|
|
60
|
+
constructor(doctype: string, schema: ImmutableDoctype['schema'], workflow: ImmutableDoctype['workflow'], component?: Component, links?: Record<string, LinkDeclaration>, displayField?: string);
|
|
54
61
|
/**
|
|
55
62
|
* Creates a Doctype instance from a plain configuration object.
|
|
56
63
|
* Handles conversion of arrays to Immutable.js collections internally.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctype.d.ts","sourceRoot":"","sources":["../../src/doctype.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAgB,MAAM,mBAAmB,CAAA;AAGvG,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAE/B,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAEtE;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,OAAO;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IAExB;;;;OAIG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAA;IAE3C;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAA;IAE/C;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAA;IAE9B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAEhD
|
|
1
|
+
{"version":3,"file":"doctype.d.ts","sourceRoot":"","sources":["../../src/doctype.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAgB,MAAM,mBAAmB,CAAA;AAGvG,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAE/B,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAEtE;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,OAAO;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IAExB;;;;OAIG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;I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GAAG,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAcpE;;;;;;;;;;;;;;OAcG;IACH,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAAG,SAAS;IAS5D;;;;;;;;;;;;;;OAcG;IACH,aAAa,CAAC,UAAU,EAAE,MAAM,GAC7B;QACA,KAAK,EAAE,MAAM,CAAA;QACb,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;QACzB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;KACvB,GACD,SAAS;IAWZ;;;;;;;;;;;;;;;OAeG;IACH,IAAI,IAAI,WAKP;CACD"}
|
package/dist/src/doctype.js
CHANGED
|
@@ -43,6 +43,12 @@ export default class Doctype {
|
|
|
43
43
|
* @readonly
|
|
44
44
|
*/
|
|
45
45
|
links;
|
|
46
|
+
/**
|
|
47
|
+
* Field on this doctype used when displaying a reference to one of its records.
|
|
48
|
+
* @public
|
|
49
|
+
* @readonly
|
|
50
|
+
*/
|
|
51
|
+
displayField;
|
|
46
52
|
/**
|
|
47
53
|
* Creates a new Doctype instance
|
|
48
54
|
* @param doctype - The doctype name
|
|
@@ -50,13 +56,15 @@ export default class Doctype {
|
|
|
50
56
|
* @param workflow - The doctype workflow configuration (XState machine)
|
|
51
57
|
* @param component - Optional Vue component for rendering the doctype
|
|
52
58
|
* @param links - Optional relationship links to other doctypes
|
|
59
|
+
* @param displayField - Optional field used when displaying references to this doctype
|
|
53
60
|
*/
|
|
54
|
-
constructor(doctype, schema, workflow, component, links) {
|
|
61
|
+
constructor(doctype, schema, workflow, component, links, displayField) {
|
|
55
62
|
this.doctype = doctype;
|
|
56
63
|
this.schema = schema;
|
|
57
64
|
this.workflow = workflow;
|
|
58
65
|
this.component = component;
|
|
59
66
|
this.links = links;
|
|
67
|
+
this.displayField = displayField;
|
|
60
68
|
}
|
|
61
69
|
/**
|
|
62
70
|
* Creates a Doctype instance from a plain configuration object.
|
|
@@ -104,7 +112,7 @@ export default class Doctype {
|
|
|
104
112
|
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- normalizeFieldKind only injects the `kind` discriminant; the field shape is otherwise preserved
|
|
105
113
|
const fields = config.fields?.map(normalizeFieldKind);
|
|
106
114
|
const schema = fields ? List(fields) : List();
|
|
107
|
-
return new Doctype(config.name, schema, config.workflow, undefined, config.links);
|
|
115
|
+
return new Doctype(config.name, schema, config.workflow, undefined, config.links, config.displayField);
|
|
108
116
|
}
|
|
109
117
|
/**
|
|
110
118
|
* Returns the raw authoring schema as a plain array.
|
|
@@ -20,6 +20,8 @@ export type DoctypeConfig = {
|
|
|
20
20
|
name: string;
|
|
21
21
|
/** URL-friendly slug (kebab-case) */
|
|
22
22
|
slug?: string;
|
|
23
|
+
/** Field used when displaying a reference to one of this doctype's records */
|
|
24
|
+
displayField?: string;
|
|
23
25
|
/** Field definitions (a link field is one carrying `doctype`) */
|
|
24
26
|
fields?: DoctypeField[];
|
|
25
27
|
/** Relationship links to other doctypes */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctype.d.ts","sourceRoot":"","sources":["../../../src/types/doctype.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACpF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAA;AAEtE;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,oBAAoB,GAAG,kBAAkB,GAAG,YAAY,CAAA;CAC5E,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC3B,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ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CAAC,EAAE,MAAM,CAAA;CACjB,CAAA"}
|
package/dist/stonecrop.d.ts
CHANGED
|
@@ -250,6 +250,12 @@ export declare class Doctype {
|
|
|
250
250
|
* @readonly
|
|
251
251
|
*/
|
|
252
252
|
readonly links?: Record<string, LinkDeclaration>;
|
|
253
|
+
/**
|
|
254
|
+
* Field on this doctype used when displaying a reference to one of its records.
|
|
255
|
+
* @public
|
|
256
|
+
* @readonly
|
|
257
|
+
*/
|
|
258
|
+
readonly displayField?: string;
|
|
253
259
|
/**
|
|
254
260
|
* Creates a new Doctype instance
|
|
255
261
|
* @param doctype - The doctype name
|
|
@@ -257,8 +263,9 @@ export declare class Doctype {
|
|
|
257
263
|
* @param workflow - The doctype workflow configuration (XState machine)
|
|
258
264
|
* @param component - Optional Vue component for rendering the doctype
|
|
259
265
|
* @param links - Optional relationship links to other doctypes
|
|
266
|
+
* @param displayField - Optional field used when displaying references to this doctype
|
|
260
267
|
*/
|
|
261
|
-
constructor(doctype: string, schema: ImmutableDoctype['schema'], workflow: ImmutableDoctype['workflow'], component?: Component, links?: Record<string, LinkDeclaration
|
|
268
|
+
constructor(doctype: string, schema: ImmutableDoctype['schema'], workflow: ImmutableDoctype['workflow'], component?: Component, links?: Record<string, LinkDeclaration>, displayField?: string);
|
|
262
269
|
/**
|
|
263
270
|
* Creates a Doctype instance from a plain configuration object.
|
|
264
271
|
* Handles conversion of arrays to Immutable.js collections internally.
|
|
@@ -452,6 +459,8 @@ export declare type DoctypeConfig = {
|
|
|
452
459
|
name: string;
|
|
453
460
|
/** URL-friendly slug (kebab-case) */
|
|
454
461
|
slug?: string;
|
|
462
|
+
/** Field used when displaying a reference to one of this doctype's records */
|
|
463
|
+
displayField?: string;
|
|
455
464
|
/** Field definitions (a link field is one carrying `doctype`) */
|
|
456
465
|
fields?: DoctypeField[];
|
|
457
466
|
/** Relationship links to other doctypes */
|
package/dist/stonecrop.js
CHANGED
|
@@ -1868,6 +1868,12 @@ class Oe {
|
|
|
1868
1868
|
* @readonly
|
|
1869
1869
|
*/
|
|
1870
1870
|
links;
|
|
1871
|
+
/**
|
|
1872
|
+
* Field on this doctype used when displaying a reference to one of its records.
|
|
1873
|
+
* @public
|
|
1874
|
+
* @readonly
|
|
1875
|
+
*/
|
|
1876
|
+
displayField;
|
|
1871
1877
|
/**
|
|
1872
1878
|
* Creates a new Doctype instance
|
|
1873
1879
|
* @param doctype - The doctype name
|
|
@@ -1875,9 +1881,10 @@ class Oe {
|
|
|
1875
1881
|
* @param workflow - The doctype workflow configuration (XState machine)
|
|
1876
1882
|
* @param component - Optional Vue component for rendering the doctype
|
|
1877
1883
|
* @param links - Optional relationship links to other doctypes
|
|
1884
|
+
* @param displayField - Optional field used when displaying references to this doctype
|
|
1878
1885
|
*/
|
|
1879
|
-
constructor(e, t, r, i, n) {
|
|
1880
|
-
this.doctype = e, this.schema = t, this.workflow = r, this.component = i, this.links = n;
|
|
1886
|
+
constructor(e, t, r, i, n, o) {
|
|
1887
|
+
this.doctype = e, this.schema = t, this.workflow = r, this.component = i, this.links = n, this.displayField = o;
|
|
1881
1888
|
}
|
|
1882
1889
|
/**
|
|
1883
1890
|
* Creates a Doctype instance from a plain configuration object.
|
|
@@ -1919,7 +1926,7 @@ class Oe {
|
|
|
1919
1926
|
*/
|
|
1920
1927
|
static fromObject(e) {
|
|
1921
1928
|
const t = e.fields?.map(Fe), r = t ? he(t) : he();
|
|
1922
|
-
return new Oe(e.name, r, e.workflow, void 0, e.links);
|
|
1929
|
+
return new Oe(e.name, r, e.workflow, void 0, e.links, e.displayField);
|
|
1923
1930
|
}
|
|
1924
1931
|
/**
|
|
1925
1932
|
* Returns the raw authoring schema as a plain array.
|