@lblod/ember-rdfa-editor-lblod-plugins 34.0.2 → 34.1.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/CHANGELOG.md +6 -0
- package/addon/plugins/roadsign-regulation-plugin/actions/insert-measure.ts +4 -0
- package/addon/plugins/roadsign-regulation-plugin/schemas/variable-instance.ts +1 -0
- package/addon/plugins/variable-plugin/actions/create-codelist-variable.ts +12 -0
- package/declarations/addon/plugins/roadsign-regulation-plugin/schemas/variable-instance.d.ts +3 -0
- package/declarations/addon/plugins/variable-plugin/actions/create-codelist-variable.d.ts +3 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @lblod/ember-rdfa-editor-lblod-plugins
|
|
2
2
|
|
|
3
|
+
## 34.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#617](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/617) [`b77f866`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/b77f866cde0afa81671fcd8378d735eb747afa90) Thanks [@abeforgit](https://github.com/abeforgit)! - Automatically instantiate codelist options when possible
|
|
8
|
+
|
|
3
9
|
## 34.0.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -341,6 +341,10 @@ function constructVariableNode(
|
|
|
341
341
|
variable: variable.uri,
|
|
342
342
|
variableInstance: variableInstance.uri,
|
|
343
343
|
value: valueStr,
|
|
344
|
+
valueLabel:
|
|
345
|
+
'valueLabel' in variableInstance
|
|
346
|
+
? variableInstance.valueLabel
|
|
347
|
+
: undefined,
|
|
344
348
|
label: variable.label,
|
|
345
349
|
};
|
|
346
350
|
switch (variable.type) {
|
|
@@ -34,6 +34,7 @@ const LocationVariableInstanceSchema = BaseVariableInstanceSchema.extend({
|
|
|
34
34
|
|
|
35
35
|
const CodelistVariableInstanceSchema = BaseVariableInstanceSchema.extend({
|
|
36
36
|
value: z.string().optional(),
|
|
37
|
+
valueLabel: z.string().optional(),
|
|
37
38
|
variable: CodelistVariableSchema,
|
|
38
39
|
});
|
|
39
40
|
|
|
@@ -15,11 +15,22 @@ import { sayDataFactory } from '@lblod/ember-rdfa-editor/core/say-data-factory';
|
|
|
15
15
|
|
|
16
16
|
type CreateCodelistVariableArgs = {
|
|
17
17
|
schema: Schema;
|
|
18
|
+
value?: string;
|
|
19
|
+
valueLabel?: string;
|
|
18
20
|
} & CreateCodelistVariableAttrsArgs;
|
|
19
21
|
|
|
20
22
|
export function createCodelistVariable(args: CreateCodelistVariableArgs) {
|
|
21
23
|
const { schema } = args;
|
|
22
24
|
const attrs = createCodelistVariableAttrs(args);
|
|
25
|
+
if (args.value && args.valueLabel) {
|
|
26
|
+
const codelistOption = createCodelistOptionNode({
|
|
27
|
+
schema,
|
|
28
|
+
subject: args.value,
|
|
29
|
+
variableInstance: args.variableInstance,
|
|
30
|
+
text: args.valueLabel,
|
|
31
|
+
});
|
|
32
|
+
return schema.nodes.codelist.create(attrs, [codelistOption]);
|
|
33
|
+
}
|
|
23
34
|
return schema.nodes.codelist.create(attrs);
|
|
24
35
|
}
|
|
25
36
|
|
|
@@ -85,6 +96,7 @@ export function createCodelistOptionNode(args: CreateCodelistOptionNodeArgs) {
|
|
|
85
96
|
type CreateCodelistOptionNodeAttrsArgs = {
|
|
86
97
|
subject: string;
|
|
87
98
|
text: string;
|
|
99
|
+
value?: string;
|
|
88
100
|
variableInstance?: string;
|
|
89
101
|
};
|
|
90
102
|
|
package/declarations/addon/plugins/roadsign-regulation-plugin/schemas/variable-instance.d.ts
CHANGED
|
@@ -180,6 +180,7 @@ export declare const VariableInstanceSchema: z.ZodUnion<[z.ZodObject<z.objectUti
|
|
|
180
180
|
uri: z.ZodString;
|
|
181
181
|
}, {
|
|
182
182
|
value: z.ZodOptional<z.ZodString>;
|
|
183
|
+
valueLabel: z.ZodOptional<z.ZodString>;
|
|
183
184
|
variable: z.ZodObject<z.objectUtil.extendShape<{
|
|
184
185
|
uri: z.ZodString;
|
|
185
186
|
label: z.ZodString;
|
|
@@ -214,6 +215,7 @@ export declare const VariableInstanceSchema: z.ZodUnion<[z.ZodObject<z.objectUti
|
|
|
214
215
|
defaultValue?: string | undefined;
|
|
215
216
|
};
|
|
216
217
|
value?: string | undefined;
|
|
218
|
+
valueLabel?: string | undefined;
|
|
217
219
|
}, {
|
|
218
220
|
uri: string;
|
|
219
221
|
variable: {
|
|
@@ -225,6 +227,7 @@ export declare const VariableInstanceSchema: z.ZodUnion<[z.ZodObject<z.objectUti
|
|
|
225
227
|
defaultValue?: string | undefined;
|
|
226
228
|
};
|
|
227
229
|
value?: string | undefined;
|
|
230
|
+
valueLabel?: string | undefined;
|
|
228
231
|
}>]>;
|
|
229
232
|
export type VariableInstance = z.infer<typeof VariableInstanceSchema>;
|
|
230
233
|
export declare function isVariableInstance(variableOrVariableInstance: Variable | VariableInstance): variableOrVariableInstance is VariableInstance;
|
|
@@ -3,6 +3,8 @@ import { AllOrNone } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/types';
|
|
|
3
3
|
import { FullTriple } from '@lblod/ember-rdfa-editor/core/rdfa-processor';
|
|
4
4
|
type CreateCodelistVariableArgs = {
|
|
5
5
|
schema: Schema;
|
|
6
|
+
value?: string;
|
|
7
|
+
valueLabel?: string;
|
|
6
8
|
} & CreateCodelistVariableAttrsArgs;
|
|
7
9
|
export declare function createCodelistVariable(args: CreateCodelistVariableArgs): import("prosemirror-model").Node;
|
|
8
10
|
type CreateCodelistVariableAttrsArgs = {
|
|
@@ -32,6 +34,7 @@ export declare function createCodelistOptionNode(args: CreateCodelistOptionNodeA
|
|
|
32
34
|
type CreateCodelistOptionNodeAttrsArgs = {
|
|
33
35
|
subject: string;
|
|
34
36
|
text: string;
|
|
37
|
+
value?: string;
|
|
35
38
|
variableInstance?: string;
|
|
36
39
|
};
|
|
37
40
|
export {};
|