@stonecrop/stonecrop 0.17.0 → 0.19.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stonecrop/stonecrop",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "Schema-driven framework with XState workflows and HST state management",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/agritheory/stonecrop/issues"
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"immutable": "^5.1.4",
|
|
35
35
|
"pinia-shared-state": "^1.0.1",
|
|
36
36
|
"xstate": "^5.25.0",
|
|
37
|
-
"@stonecrop/
|
|
38
|
-
"@stonecrop/
|
|
39
|
-
"@stonecrop/
|
|
37
|
+
"@stonecrop/atable": "0.19.0",
|
|
38
|
+
"@stonecrop/schema": "0.19.0",
|
|
39
|
+
"@stonecrop/aform": "0.19.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@microsoft/api-documenter": "^7.30.5",
|
package/src/doctype.ts
CHANGED
|
@@ -54,6 +54,13 @@ export default class Doctype {
|
|
|
54
54
|
*/
|
|
55
55
|
readonly links?: Record<string, LinkDeclaration>
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Field on this doctype used when displaying a reference to one of its records.
|
|
59
|
+
* @public
|
|
60
|
+
* @readonly
|
|
61
|
+
*/
|
|
62
|
+
readonly displayField?: string
|
|
63
|
+
|
|
57
64
|
/**
|
|
58
65
|
* Creates a new Doctype instance
|
|
59
66
|
* @param doctype - The doctype name
|
|
@@ -61,19 +68,22 @@ export default class Doctype {
|
|
|
61
68
|
* @param workflow - The doctype workflow configuration (XState machine)
|
|
62
69
|
* @param component - Optional Vue component for rendering the doctype
|
|
63
70
|
* @param links - Optional relationship links to other doctypes
|
|
71
|
+
* @param displayField - Optional field used when displaying references to this doctype
|
|
64
72
|
*/
|
|
65
73
|
constructor(
|
|
66
74
|
doctype: string,
|
|
67
75
|
schema: ImmutableDoctype['schema'],
|
|
68
76
|
workflow: ImmutableDoctype['workflow'],
|
|
69
77
|
component?: Component,
|
|
70
|
-
links?: Record<string, LinkDeclaration
|
|
78
|
+
links?: Record<string, LinkDeclaration>,
|
|
79
|
+
displayField?: string
|
|
71
80
|
) {
|
|
72
81
|
this.doctype = doctype
|
|
73
82
|
this.schema = schema
|
|
74
83
|
this.workflow = workflow
|
|
75
84
|
this.component = component
|
|
76
85
|
this.links = links
|
|
86
|
+
this.displayField = displayField
|
|
77
87
|
}
|
|
78
88
|
|
|
79
89
|
/**
|
|
@@ -123,7 +133,7 @@ export default class Doctype {
|
|
|
123
133
|
const fields = config.fields?.map(normalizeFieldKind) as DoctypeField[] | undefined
|
|
124
134
|
const schema = fields ? List(fields) : List<DoctypeField>()
|
|
125
135
|
|
|
126
|
-
return new Doctype(config.name, schema, config.workflow, undefined, config.links)
|
|
136
|
+
return new Doctype(config.name, schema, config.workflow, undefined, config.links, config.displayField)
|
|
127
137
|
}
|
|
128
138
|
|
|
129
139
|
/**
|
package/src/types/doctype.ts
CHANGED
|
@@ -22,6 +22,8 @@ export type DoctypeConfig = {
|
|
|
22
22
|
name: string
|
|
23
23
|
/** URL-friendly slug (kebab-case) */
|
|
24
24
|
slug?: string
|
|
25
|
+
/** Field used when displaying a reference to one of this doctype's records */
|
|
26
|
+
displayField?: string
|
|
25
27
|
/** Field definitions (a link field is one carrying `doctype`) */
|
|
26
28
|
fields?: DoctypeField[]
|
|
27
29
|
/** Relationship links to other doctypes */
|