@lblod/ember-rdfa-editor-lblod-plugins 33.4.0 → 34.0.1

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.
Files changed (28) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/addon/components/variable-plugin/codelist/edit.gts +48 -9
  3. package/addon/components/variable-plugin/codelist/{insert.ts → insert.gts} +52 -7
  4. package/addon/components/variable-plugin/codelist/nodeview.gts +49 -0
  5. package/addon/components/variable-plugin/location/edit.ts +3 -4
  6. package/addon/plugins/roadsign-regulation-plugin/actions/insert-measure.ts +1 -1
  7. package/addon/plugins/roadsign-regulation-plugin/schemas/variable.ts +1 -1
  8. package/addon/plugins/variable-plugin/actions/create-codelist-variable.ts +57 -40
  9. package/addon/plugins/variable-plugin/actions/create-legacy-codelist-variable.ts +101 -0
  10. package/addon/plugins/variable-plugin/utils/codelist-utils.ts +38 -3
  11. package/addon/plugins/variable-plugin/utils/fetch-data.ts +37 -15
  12. package/addon/plugins/variable-plugin/variables/codelist.ts +101 -175
  13. package/addon/plugins/variable-plugin/variables/legacy-codelist.ts +261 -0
  14. package/declarations/addon/components/variable-plugin/codelist/edit.d.ts +2 -0
  15. package/declarations/addon/components/variable-plugin/codelist/insert.d.ts +15 -9
  16. package/declarations/addon/components/variable-plugin/codelist/nodeview.d.ts +18 -0
  17. package/declarations/addon/plugins/roadsign-regulation-plugin/queries/variable.d.ts +6 -6
  18. package/declarations/addon/plugins/roadsign-regulation-plugin/schemas/variable-instance.d.ts +25 -25
  19. package/declarations/addon/plugins/roadsign-regulation-plugin/schemas/variable.d.ts +36 -36
  20. package/declarations/addon/plugins/variable-plugin/actions/create-codelist-variable.d.ts +20 -11
  21. package/declarations/addon/plugins/variable-plugin/actions/create-legacy-codelist-variable.d.ts +28 -0
  22. package/declarations/addon/plugins/variable-plugin/utils/codelist-utils.d.ts +7 -0
  23. package/declarations/addon/plugins/variable-plugin/utils/fetch-data.d.ts +3 -2
  24. package/declarations/addon/plugins/variable-plugin/variables/codelist.d.ts +3 -1
  25. package/declarations/addon/plugins/variable-plugin/variables/legacy-codelist.d.ts +2 -0
  26. package/docs/plugins/variable.md +1 -0
  27. package/package.json +1 -1
  28. package/addon/components/variable-plugin/codelist/insert.hbs +0 -31
@@ -2,67 +2,67 @@ import { z } from 'zod';
2
2
  export declare const TextVariableSchema: z.ZodObject<z.objectUtil.extendShape<{
3
3
  uri: z.ZodString;
4
4
  label: z.ZodString;
5
- source: z.ZodOptional<z.ZodString>;
5
+ source: z.ZodString;
6
6
  }, {
7
7
  type: z.ZodLiteral<"text">;
8
8
  defaultValue: z.ZodOptional<z.ZodString>;
9
9
  }>, "strip", z.ZodTypeAny, {
10
10
  type: "text";
11
11
  label: string;
12
+ source: string;
12
13
  uri: string;
13
- source?: string | undefined;
14
14
  defaultValue?: string | undefined;
15
15
  }, {
16
16
  type: "text";
17
17
  label: string;
18
+ source: string;
18
19
  uri: string;
19
- source?: string | undefined;
20
20
  defaultValue?: string | undefined;
21
21
  }>;
22
22
  export declare const NumberVariableSchema: z.ZodObject<z.objectUtil.extendShape<{
23
23
  uri: z.ZodString;
24
24
  label: z.ZodString;
25
- source: z.ZodOptional<z.ZodString>;
25
+ source: z.ZodString;
26
26
  }, {
27
27
  type: z.ZodLiteral<"number">;
28
28
  defaultValue: z.ZodOptional<z.ZodNumber>;
29
29
  }>, "strip", z.ZodTypeAny, {
30
30
  type: "number";
31
31
  label: string;
32
+ source: string;
32
33
  uri: string;
33
- source?: string | undefined;
34
34
  defaultValue?: number | undefined;
35
35
  }, {
36
36
  type: "number";
37
37
  label: string;
38
+ source: string;
38
39
  uri: string;
39
- source?: string | undefined;
40
40
  defaultValue?: number | undefined;
41
41
  }>;
42
42
  export declare const DateVariableSchema: z.ZodObject<z.objectUtil.extendShape<{
43
43
  uri: z.ZodString;
44
44
  label: z.ZodString;
45
- source: z.ZodOptional<z.ZodString>;
45
+ source: z.ZodString;
46
46
  }, {
47
47
  type: z.ZodLiteral<"date">;
48
48
  defaultValue: z.ZodOptional<z.ZodDate>;
49
49
  }>, "strip", z.ZodTypeAny, {
50
50
  type: "date";
51
51
  label: string;
52
+ source: string;
52
53
  uri: string;
53
- source?: string | undefined;
54
54
  defaultValue?: Date | undefined;
55
55
  }, {
56
56
  type: "date";
57
57
  label: string;
58
+ source: string;
58
59
  uri: string;
59
- source?: string | undefined;
60
60
  defaultValue?: Date | undefined;
61
61
  }>;
62
62
  export declare const CodelistVariableSchema: z.ZodObject<z.objectUtil.extendShape<{
63
63
  uri: z.ZodString;
64
64
  label: z.ZodString;
65
- source: z.ZodOptional<z.ZodString>;
65
+ source: z.ZodString;
66
66
  }, {
67
67
  type: z.ZodLiteral<"codelist">;
68
68
  defaultValue: z.ZodOptional<z.ZodString>;
@@ -70,116 +70,116 @@ export declare const CodelistVariableSchema: z.ZodObject<z.objectUtil.extendShap
70
70
  }>, "strip", z.ZodTypeAny, {
71
71
  type: "codelist";
72
72
  label: string;
73
+ source: string;
73
74
  uri: string;
74
75
  codelistUri: string;
75
- source?: string | undefined;
76
76
  defaultValue?: string | undefined;
77
77
  }, {
78
78
  type: "codelist";
79
79
  label: string;
80
+ source: string;
80
81
  uri: string;
81
82
  codelistUri: string;
82
- source?: string | undefined;
83
83
  defaultValue?: string | undefined;
84
84
  }>;
85
85
  export declare const LocationVariableSchema: z.ZodObject<z.objectUtil.extendShape<{
86
86
  uri: z.ZodString;
87
87
  label: z.ZodString;
88
- source: z.ZodOptional<z.ZodString>;
88
+ source: z.ZodString;
89
89
  }, {
90
90
  type: z.ZodLiteral<"location">;
91
91
  defaultValue: z.ZodOptional<z.ZodString>;
92
92
  }>, "strip", z.ZodTypeAny, {
93
93
  type: "location";
94
94
  label: string;
95
+ source: string;
95
96
  uri: string;
96
- source?: string | undefined;
97
97
  defaultValue?: string | undefined;
98
98
  }, {
99
99
  type: "location";
100
100
  label: string;
101
+ source: string;
101
102
  uri: string;
102
- source?: string | undefined;
103
103
  defaultValue?: string | undefined;
104
104
  }>;
105
105
  export declare const InstructionVariableSchema: z.ZodObject<z.objectUtil.extendShape<{
106
106
  uri: z.ZodString;
107
107
  label: z.ZodString;
108
- source: z.ZodOptional<z.ZodString>;
108
+ source: z.ZodString;
109
109
  }, {
110
110
  type: z.ZodLiteral<"instruction">;
111
111
  }>, "strip", z.ZodTypeAny, {
112
112
  type: "instruction";
113
113
  label: string;
114
+ source: string;
114
115
  uri: string;
115
- source?: string | undefined;
116
116
  }, {
117
117
  type: "instruction";
118
118
  label: string;
119
+ source: string;
119
120
  uri: string;
120
- source?: string | undefined;
121
121
  }>;
122
122
  export declare const VariableSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<z.objectUtil.extendShape<{
123
123
  uri: z.ZodString;
124
124
  label: z.ZodString;
125
- source: z.ZodOptional<z.ZodString>;
125
+ source: z.ZodString;
126
126
  }, {
127
127
  type: z.ZodLiteral<"text">;
128
128
  defaultValue: z.ZodOptional<z.ZodString>;
129
129
  }>, "strip", z.ZodTypeAny, {
130
130
  type: "text";
131
131
  label: string;
132
+ source: string;
132
133
  uri: string;
133
- source?: string | undefined;
134
134
  defaultValue?: string | undefined;
135
135
  }, {
136
136
  type: "text";
137
137
  label: string;
138
+ source: string;
138
139
  uri: string;
139
- source?: string | undefined;
140
140
  defaultValue?: string | undefined;
141
141
  }>, z.ZodObject<z.objectUtil.extendShape<{
142
142
  uri: z.ZodString;
143
143
  label: z.ZodString;
144
- source: z.ZodOptional<z.ZodString>;
144
+ source: z.ZodString;
145
145
  }, {
146
146
  type: z.ZodLiteral<"number">;
147
147
  defaultValue: z.ZodOptional<z.ZodNumber>;
148
148
  }>, "strip", z.ZodTypeAny, {
149
149
  type: "number";
150
150
  label: string;
151
+ source: string;
151
152
  uri: string;
152
- source?: string | undefined;
153
153
  defaultValue?: number | undefined;
154
154
  }, {
155
155
  type: "number";
156
156
  label: string;
157
+ source: string;
157
158
  uri: string;
158
- source?: string | undefined;
159
159
  defaultValue?: number | undefined;
160
160
  }>, z.ZodObject<z.objectUtil.extendShape<{
161
161
  uri: z.ZodString;
162
162
  label: z.ZodString;
163
- source: z.ZodOptional<z.ZodString>;
163
+ source: z.ZodString;
164
164
  }, {
165
165
  type: z.ZodLiteral<"date">;
166
166
  defaultValue: z.ZodOptional<z.ZodDate>;
167
167
  }>, "strip", z.ZodTypeAny, {
168
168
  type: "date";
169
169
  label: string;
170
+ source: string;
170
171
  uri: string;
171
- source?: string | undefined;
172
172
  defaultValue?: Date | undefined;
173
173
  }, {
174
174
  type: "date";
175
175
  label: string;
176
+ source: string;
176
177
  uri: string;
177
- source?: string | undefined;
178
178
  defaultValue?: Date | undefined;
179
179
  }>, z.ZodObject<z.objectUtil.extendShape<{
180
180
  uri: z.ZodString;
181
181
  label: z.ZodString;
182
- source: z.ZodOptional<z.ZodString>;
182
+ source: z.ZodString;
183
183
  }, {
184
184
  type: z.ZodLiteral<"codelist">;
185
185
  defaultValue: z.ZodOptional<z.ZodString>;
@@ -187,51 +187,51 @@ export declare const VariableSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObjec
187
187
  }>, "strip", z.ZodTypeAny, {
188
188
  type: "codelist";
189
189
  label: string;
190
+ source: string;
190
191
  uri: string;
191
192
  codelistUri: string;
192
- source?: string | undefined;
193
193
  defaultValue?: string | undefined;
194
194
  }, {
195
195
  type: "codelist";
196
196
  label: string;
197
+ source: string;
197
198
  uri: string;
198
199
  codelistUri: string;
199
- source?: string | undefined;
200
200
  defaultValue?: string | undefined;
201
201
  }>, z.ZodObject<z.objectUtil.extendShape<{
202
202
  uri: z.ZodString;
203
203
  label: z.ZodString;
204
- source: z.ZodOptional<z.ZodString>;
204
+ source: z.ZodString;
205
205
  }, {
206
206
  type: z.ZodLiteral<"location">;
207
207
  defaultValue: z.ZodOptional<z.ZodString>;
208
208
  }>, "strip", z.ZodTypeAny, {
209
209
  type: "location";
210
210
  label: string;
211
+ source: string;
211
212
  uri: string;
212
- source?: string | undefined;
213
213
  defaultValue?: string | undefined;
214
214
  }, {
215
215
  type: "location";
216
216
  label: string;
217
+ source: string;
217
218
  uri: string;
218
- source?: string | undefined;
219
219
  defaultValue?: string | undefined;
220
220
  }>, z.ZodObject<z.objectUtil.extendShape<{
221
221
  uri: z.ZodString;
222
222
  label: z.ZodString;
223
- source: z.ZodOptional<z.ZodString>;
223
+ source: z.ZodString;
224
224
  }, {
225
225
  type: z.ZodLiteral<"instruction">;
226
226
  }>, "strip", z.ZodTypeAny, {
227
227
  type: "instruction";
228
228
  label: string;
229
+ source: string;
229
230
  uri: string;
230
- source?: string | undefined;
231
231
  }, {
232
232
  type: "instruction";
233
233
  label: string;
234
+ source: string;
234
235
  uri: string;
235
- source?: string | undefined;
236
236
  }>]>;
237
237
  export type Variable = z.infer<typeof VariableSchema>;
@@ -1,28 +1,37 @@
1
1
  import { Schema } from '@lblod/ember-rdfa-editor';
2
2
  import { AllOrNone } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/types';
3
- import { FullTriple, IncomingTriple } from '@lblod/ember-rdfa-editor/core/rdfa-processor';
3
+ import { FullTriple } from '@lblod/ember-rdfa-editor/core/rdfa-processor';
4
4
  type CreateCodelistVariableArgs = {
5
5
  schema: Schema;
6
- value?: string;
7
6
  } & CreateCodelistVariableAttrsArgs;
8
7
  export declare function createCodelistVariable(args: CreateCodelistVariableArgs): import("prosemirror-model").Node;
9
8
  type CreateCodelistVariableAttrsArgs = {
9
+ selectionStyle?: 'single' | 'multi';
10
10
  label?: string;
11
- source?: string;
12
- codelist?: string;
13
- selectionStyle?: string;
11
+ source: string;
12
+ codelist: string;
14
13
  } & AllOrNone<{
15
14
  variable: string;
16
15
  variableInstance: string;
17
16
  }>;
18
- export declare function createCodelistVariableAttrs({ variable, variableInstance, label, source, codelist, selectionStyle, }: CreateCodelistVariableAttrsArgs): {
17
+ export declare function createCodelistVariableAttrs({ selectionStyle, label, source, codelist, variable, variableInstance, }: CreateCodelistVariableAttrsArgs): {
19
18
  rdfaNodeType: string;
20
- datatype: import("@lblod/ember-rdfa-editor/core/say-data-factory").SayNamedNode<string>;
21
19
  externalTriples: FullTriple[];
22
- backlinks: IncomingTriple[];
23
- source: string | undefined;
24
- codelist: string | undefined;
20
+ selectionStyle: "single" | "multi" | undefined;
21
+ source: string;
22
+ codelist: string;
25
23
  label: string | undefined;
26
- selectionStyle: string | undefined;
24
+ variable: string | undefined;
25
+ variableInstance: string | undefined;
26
+ };
27
+ type CreateCodelistOptionNodeArgs = {
28
+ schema: Schema;
29
+ text: string;
30
+ } & CreateCodelistOptionNodeAttrsArgs;
31
+ export declare function createCodelistOptionNode(args: CreateCodelistOptionNodeArgs): import("prosemirror-model").Node;
32
+ type CreateCodelistOptionNodeAttrsArgs = {
33
+ subject: string;
34
+ text: string;
35
+ variableInstance?: string;
27
36
  };
28
37
  export {};
@@ -0,0 +1,28 @@
1
+ import { Schema } from '@lblod/ember-rdfa-editor';
2
+ import { AllOrNone } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/types';
3
+ import { FullTriple, IncomingTriple } from '@lblod/ember-rdfa-editor/core/rdfa-processor';
4
+ type CreateLegacyCodelistVariableArgs = {
5
+ schema: Schema;
6
+ value?: string;
7
+ } & CreateLegacyCodelistVariableAttrsArgs;
8
+ export declare function createLegacyCodelistVariable(args: CreateLegacyCodelistVariableArgs): import("prosemirror-model").Node;
9
+ type CreateLegacyCodelistVariableAttrsArgs = {
10
+ label?: string;
11
+ source?: string;
12
+ codelist?: string;
13
+ selectionStyle?: string;
14
+ } & AllOrNone<{
15
+ variable: string;
16
+ variableInstance: string;
17
+ }>;
18
+ export declare function createLegacyCodelistVariableAttrs({ variable, variableInstance, label, source, codelist, selectionStyle, }: CreateLegacyCodelistVariableAttrsArgs): {
19
+ rdfaNodeType: string;
20
+ datatype: import("@lblod/ember-rdfa-editor/core/say-data-factory").SayNamedNode<string>;
21
+ externalTriples: FullTriple[];
22
+ backlinks: IncomingTriple[];
23
+ source: string | undefined;
24
+ codelist: string | undefined;
25
+ label: string | undefined;
26
+ selectionStyle: string | undefined;
27
+ };
28
+ export {};
@@ -4,3 +4,10 @@ export declare function updateCodelistVariable(selectedCodelist: {
4
4
  node: PNode;
5
5
  pos: number;
6
6
  }, selectedOption: CodeListOption | CodeListOption[], controller: SayController): void;
7
+ /**
8
+ * @deprecated use `updateCodelistVariable` instead
9
+ */
10
+ export declare function updateCodelistVariableLegacy(selectedCodelist: {
11
+ node: PNode;
12
+ pos: number;
13
+ }, selectedOption: CodeListOption | CodeListOption[], controller: SayController): void;
@@ -3,10 +3,11 @@ export type CodeListOptions = {
3
3
  options: CodeListOption[];
4
4
  };
5
5
  export type CodeListOption = {
6
- value?: string;
7
- label?: string;
6
+ uri: string;
7
+ label: string;
8
8
  };
9
9
  export declare function fetchCodeListOptions(endpoint: string, codelistUri: string): Promise<CodeListOptions>;
10
+ export declare function fetchCodelistOption(endpoint: string, codelistOptionUri: string): Promise<Required<CodeListOption> | undefined>;
10
11
  export type CodeList = {
11
12
  uri?: string;
12
13
  label?: string;
@@ -1,2 +1,4 @@
1
- export declare const codelist: import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
1
+ import SayNodeSpec from '@lblod/ember-rdfa-editor/core/say-node-spec';
2
+ export declare const codelist: SayNodeSpec;
2
3
  export declare const codelistView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
4
+ export declare const codelist_option: SayNodeSpec;
@@ -0,0 +1,2 @@
1
+ export declare const legacy_codelist: import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
2
+ export declare const legacyCodelistView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
@@ -23,6 +23,7 @@ import {
23
23
  autofilledVariableView,
24
24
  codelist,
25
25
  codelistView,
26
+ codelist_option,
26
27
  date,
27
28
  dateView,
28
29
  location,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lblod/ember-rdfa-editor-lblod-plugins",
3
- "version": "33.4.0",
3
+ "version": "34.0.1",
4
4
  "description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -1,31 +0,0 @@
1
- {{! @glint-nocheck: not typesafe yet }}
2
- <PowerSelect
3
- @allowClear={{false}}
4
- @searchEnabled={{true}}
5
- @searchField='label'
6
- @options={{this.codelistData.value}}
7
- @selected={{this.selectedCodelist}}
8
- @onChange={{this.selectCodelist}}
9
- as |codelist|
10
- >
11
- {{codelist.label}}
12
- </PowerSelect>
13
- <PowerSelect
14
- @allowClear={{false}}
15
- @searchEnabled={{false}}
16
- @options={{this.selectionStyles}}
17
- @selected={{this.selectedStyle}}
18
- @onChange={{this.selectStyle}}
19
- as |style|
20
- >
21
- {{style.label}}
22
- </PowerSelect>
23
- <AuFormRow>
24
- <VariablePlugin::Utils::LabelInput
25
- @label={{this.label}}
26
- @updateLabel={{this.updateLabel}}
27
- />
28
- </AuFormRow>
29
- <AuButton {{on 'click' this.insert}} @disabled={{not this.selectedCodelist}}>
30
- {{t 'variable-plugin.button'}}
31
- </AuButton>