@lblod/ember-rdfa-editor-lblod-plugins 34.1.0 → 34.1.1-dev.3f365333c21531feb20132202d5ff855c72a5149
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/.changeset/chatty-cherries-run.md +5 -0
- package/.changeset/green-bulldogs-ring.md +5 -0
- package/.changeset/healthy-experts-clean.md +5 -0
- package/.changeset/mighty-rivers-applaud.md +5 -0
- package/CHANGELOG.md +6 -0
- package/addon/components/document-validation-plugin/card.gts +8 -6
- package/addon/components/roadsign-regulation-plugin/roadsigns-table.gts +22 -19
- package/addon/components/variable-plugin/codelist/edit.gts +20 -9
- package/addon/components/variable-plugin/codelist/insert.gts +28 -19
- package/addon/components/variable-plugin/date/{insert.ts → insert.gts} +22 -6
- package/addon/components/variable-plugin/marcode/insert.gts +71 -0
- package/addon/plugins/roadsign-regulation-plugin/actions/insert-measure.ts +13 -4
- package/addon/plugins/roadsign-regulation-plugin/helpers/removeZFromLabel.ts +5 -0
- package/addon/plugins/roadsign-regulation-plugin/schemas/mobility-measure-design.ts +5 -1
- package/addon/plugins/variable-plugin/actions/create-classic-location-variable.ts +9 -0
- package/addon/plugins/variable-plugin/actions/create-codelist-variable.ts +6 -1
- package/addon/plugins/variable-plugin/variables/codelist.ts +26 -2
- package/addon/plugins/variable-plugin/variables/marcode.ts +433 -0
- package/app/components/variable-plugin/marcode/insert.js +1 -0
- package/declarations/addon/components/variable-plugin/codelist/edit.d.ts +3 -1
- package/declarations/addon/components/variable-plugin/codelist/insert.d.ts +9 -5
- package/declarations/addon/components/variable-plugin/date/insert.d.ts +6 -5
- package/declarations/addon/components/variable-plugin/marcode/insert.d.ts +17 -0
- package/declarations/addon/plugins/roadsign-regulation-plugin/helpers/removeZFromLabel.d.ts +1 -0
- package/declarations/addon/plugins/roadsign-regulation-plugin/schemas/mobility-measure-design.d.ts +80 -4
- package/declarations/addon/plugins/variable-plugin/actions/create-classic-location-variable.d.ts +2 -1
- package/declarations/addon/plugins/variable-plugin/actions/create-codelist-variable.d.ts +4 -11
- package/declarations/addon/plugins/variable-plugin/variables/codelist.d.ts +11 -0
- package/declarations/addon/plugins/variable-plugin/variables/marcode.d.ts +4 -0
- package/package.json +1 -1
- package/translations/en-US.yaml +3 -0
- package/translations/nl-BE.yaml +3 -0
- package/addon/components/variable-plugin/date/insert.hbs +0 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @lblod/ember-rdfa-editor-lblod-plugins
|
|
2
2
|
|
|
3
|
+
## 34.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`ea58ba1`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/ea58ba1cebf5d69c4f1d784c524a13c1dfe6034e) Thanks [@abeforgit](https://github.com/abeforgit)! - Allow insertMeasure to take in ar-designs with concepts instead of signs
|
|
8
|
+
|
|
3
9
|
## 34.1.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -176,12 +176,14 @@ export default class DocumentValidationPluginCard extends Component<Sig> {
|
|
|
176
176
|
as |error|
|
|
177
177
|
}}
|
|
178
178
|
<div class='say-document-validation__error-container'>
|
|
179
|
-
<
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
179
|
+
<div class='au-u-margin-right-small'>
|
|
180
|
+
<AuIcon
|
|
181
|
+
@icon={{CloseFilledIcon}}
|
|
182
|
+
@size='large'
|
|
183
|
+
@ariaHidden={{true}}
|
|
184
|
+
class='say-document-validation__icon-error'
|
|
185
|
+
/>
|
|
186
|
+
</div>
|
|
185
187
|
<div>
|
|
186
188
|
{{error.message}}
|
|
187
189
|
<AuButton
|
|
@@ -20,6 +20,7 @@ import t from 'ember-intl/helpers/t';
|
|
|
20
20
|
import { on } from '@ember/modifier';
|
|
21
21
|
import { fn } from '@ember/helper';
|
|
22
22
|
import { TRAFFIC_SIGNAL_CONCEPT_TYPES } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/roadsign-regulation-plugin/constants';
|
|
23
|
+
import removeZFromLabel from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/roadsign-regulation-plugin/helpers/removeZFromLabel';
|
|
23
24
|
|
|
24
25
|
type Signature = {
|
|
25
26
|
Args: {
|
|
@@ -90,7 +91,7 @@ export default class RoadSignsTable extends Component<Signature> {
|
|
|
90
91
|
{{on 'click' (fn this.selectRow measureConcept.uri)}}
|
|
91
92
|
>
|
|
92
93
|
<td>
|
|
93
|
-
<p>{{measureConcept.label}}</p>
|
|
94
|
+
<p>{{removeZFromLabel measureConcept.label}}</p>
|
|
94
95
|
</td>
|
|
95
96
|
<td>
|
|
96
97
|
<div class='au-o-grid au-o-grid--tiny'>
|
|
@@ -99,24 +100,26 @@ export default class RoadSignsTable extends Component<Signature> {
|
|
|
99
100
|
as |signalConcept|
|
|
100
101
|
}}
|
|
101
102
|
<div class='au-o-grid__item au-u-1-3'>
|
|
102
|
-
{{#
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
103
|
+
{{#unless (eq signalConcept.code 'Z')}}
|
|
104
|
+
{{#if signalConcept.image}}
|
|
105
|
+
<img
|
|
106
|
+
src={{signalConcept.image}}
|
|
107
|
+
alt={{t
|
|
108
|
+
'editor-plugins.roadsign-regulation.table.content.image.alt'
|
|
109
|
+
code=signalConcept.code
|
|
110
|
+
}}
|
|
111
|
+
class='au-c-data-table__image'
|
|
112
|
+
/>
|
|
113
|
+
{{else}}
|
|
114
|
+
<AuPill
|
|
115
|
+
@skin='border'
|
|
116
|
+
@size='small'
|
|
117
|
+
@draft={{true}}
|
|
118
|
+
>
|
|
119
|
+
{{signalConcept.code}}
|
|
120
|
+
</AuPill>
|
|
121
|
+
{{/if}}
|
|
122
|
+
{{/unless}}
|
|
120
123
|
</div>
|
|
121
124
|
{{/each}}
|
|
122
125
|
</div>
|
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
updateCodelistVariable,
|
|
18
18
|
updateCodelistVariableLegacy,
|
|
19
19
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/codelist-utils';
|
|
20
|
-
import { Option } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
|
|
21
20
|
import AuCard from '@appuniversum/ember-appuniversum/components/au-card';
|
|
22
21
|
import AuHeading from '@appuniversum/ember-appuniversum/components/au-heading';
|
|
23
22
|
import AuLabel from '@appuniversum/ember-appuniversum/components/au-label';
|
|
@@ -26,6 +25,7 @@ import AuButton from '@appuniversum/ember-appuniversum/components/au-button';
|
|
|
26
25
|
import { AlertTriangleIcon } from '@appuniversum/ember-appuniversum/components/icons/alert-triangle';
|
|
27
26
|
import AuAlert from '@appuniversum/ember-appuniversum/components/au-alert';
|
|
28
27
|
import { tracked } from '@glimmer/tracking';
|
|
28
|
+
import { CodelistAttrs } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/variables';
|
|
29
29
|
|
|
30
30
|
export type CodelistEditOptions = {
|
|
31
31
|
endpoint: string;
|
|
@@ -68,10 +68,17 @@ export default class CodelistEditComponent extends Component<Sig> {
|
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
get
|
|
71
|
+
get codelistAttrs() {
|
|
72
72
|
if (this.selectedCodelist) {
|
|
73
73
|
const { node } = this.selectedCodelist;
|
|
74
|
-
|
|
74
|
+
return node.attrs as CodelistAttrs;
|
|
75
|
+
}
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
get source() {
|
|
80
|
+
if (this.codelistAttrs) {
|
|
81
|
+
const source = this.codelistAttrs['source'];
|
|
75
82
|
if (source && source !== 'UNKNOWN') {
|
|
76
83
|
return source;
|
|
77
84
|
}
|
|
@@ -80,9 +87,8 @@ export default class CodelistEditComponent extends Component<Sig> {
|
|
|
80
87
|
}
|
|
81
88
|
|
|
82
89
|
get codelistUri() {
|
|
83
|
-
if (this.
|
|
84
|
-
const
|
|
85
|
-
const codelistUri = node.attrs['codelist'] as Option<string>;
|
|
90
|
+
if (this.codelistAttrs) {
|
|
91
|
+
const codelistUri = this.codelistAttrs['codelist'];
|
|
86
92
|
if (codelistUri) {
|
|
87
93
|
return codelistUri;
|
|
88
94
|
}
|
|
@@ -95,7 +101,7 @@ export default class CodelistEditComponent extends Component<Sig> {
|
|
|
95
101
|
}
|
|
96
102
|
|
|
97
103
|
get label() {
|
|
98
|
-
return this.
|
|
104
|
+
return this.codelistAttrs?.label;
|
|
99
105
|
}
|
|
100
106
|
|
|
101
107
|
get schema() {
|
|
@@ -104,6 +110,12 @@ export default class CodelistEditComponent extends Component<Sig> {
|
|
|
104
110
|
|
|
105
111
|
codelistOptions = trackedFunction(this, async () => {
|
|
106
112
|
let result: CodeListOptions | undefined;
|
|
113
|
+
if (this.codelistAttrs?.hardcodedOptionList) {
|
|
114
|
+
return {
|
|
115
|
+
type: '',
|
|
116
|
+
options: this.codelistAttrs.hardcodedOptionList,
|
|
117
|
+
} as CodeListOptions;
|
|
118
|
+
}
|
|
107
119
|
if (this.source && this.codelistUri) {
|
|
108
120
|
result = await fetchCodeListOptions(this.source, this.codelistUri);
|
|
109
121
|
}
|
|
@@ -138,8 +150,7 @@ export default class CodelistEditComponent extends Component<Sig> {
|
|
|
138
150
|
});
|
|
139
151
|
|
|
140
152
|
get multiSelect() {
|
|
141
|
-
const localStyle = this.
|
|
142
|
-
.selectionStyle as string;
|
|
153
|
+
const localStyle = this.codelistAttrs?.selectionStyle;
|
|
143
154
|
if (localStyle) {
|
|
144
155
|
return localStyle === 'multi';
|
|
145
156
|
} else
|
|
@@ -24,10 +24,13 @@ export type CodelistInsertOptions = {
|
|
|
24
24
|
endpoint: string;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
type
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
type Sig = {
|
|
28
|
+
Args: {
|
|
29
|
+
controller: SayController;
|
|
30
|
+
options: CodelistInsertOptions;
|
|
31
|
+
templateMode?: boolean;
|
|
32
|
+
fixedCodelist?: CodeList;
|
|
33
|
+
};
|
|
31
34
|
};
|
|
32
35
|
|
|
33
36
|
interface SelectStyle {
|
|
@@ -35,12 +38,16 @@ interface SelectStyle {
|
|
|
35
38
|
value: 'single' | 'multi';
|
|
36
39
|
}
|
|
37
40
|
|
|
38
|
-
export default class CodelistInsertComponent extends Component<
|
|
41
|
+
export default class CodelistInsertComponent extends Component<Sig> {
|
|
39
42
|
@service declare intl: IntlService;
|
|
40
43
|
@tracked selectedCodelist?: CodeList;
|
|
41
44
|
@tracked label: string = '';
|
|
42
45
|
@tracked selectedStyleValue: 'single' | 'multi' = 'single';
|
|
43
46
|
|
|
47
|
+
get codelistToInsert() {
|
|
48
|
+
return this.args.fixedCodelist ?? this.selectedCodelist;
|
|
49
|
+
}
|
|
50
|
+
|
|
44
51
|
get controller() {
|
|
45
52
|
return this.args.controller;
|
|
46
53
|
}
|
|
@@ -90,13 +97,13 @@ export default class CodelistInsertComponent extends Component<Args> {
|
|
|
90
97
|
|
|
91
98
|
@action
|
|
92
99
|
insert() {
|
|
93
|
-
const codelistResource = this.
|
|
100
|
+
const codelistResource = this.codelistToInsert?.uri;
|
|
94
101
|
if (!codelistResource) {
|
|
95
102
|
return;
|
|
96
103
|
}
|
|
97
104
|
const label =
|
|
98
105
|
this.label ??
|
|
99
|
-
this.
|
|
106
|
+
this.codelistToInsert?.label ??
|
|
100
107
|
this.intl.t('variable.codelist.label', {
|
|
101
108
|
locale: this.documentLanguage,
|
|
102
109
|
});
|
|
@@ -127,17 +134,19 @@ export default class CodelistInsertComponent extends Component<Args> {
|
|
|
127
134
|
|
|
128
135
|
<template>
|
|
129
136
|
{{#if this.codelistData.value}}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
{{#unless @fixedCodelist}}
|
|
138
|
+
<PowerSelect
|
|
139
|
+
@allowClear={{false}}
|
|
140
|
+
@searchEnabled={{true}}
|
|
141
|
+
@searchField='label'
|
|
142
|
+
@options={{this.codelistData.value}}
|
|
143
|
+
@selected={{this.selectedCodelist}}
|
|
144
|
+
@onChange={{this.selectCodelist}}
|
|
145
|
+
as |codelist|
|
|
146
|
+
>
|
|
147
|
+
{{codelist.label}}
|
|
148
|
+
</PowerSelect>
|
|
149
|
+
{{/unless}}
|
|
141
150
|
<PowerSelect
|
|
142
151
|
@allowClear={{false}}
|
|
143
152
|
@searchEnabled={{false}}
|
|
@@ -153,7 +162,7 @@ export default class CodelistInsertComponent extends Component<Args> {
|
|
|
153
162
|
</AuFormRow>
|
|
154
163
|
<AuButton
|
|
155
164
|
{{on 'click' this.insert}}
|
|
156
|
-
@disabled={{not this.
|
|
165
|
+
@disabled={{not this.codelistToInsert}}
|
|
157
166
|
>
|
|
158
167
|
{{t 'variable-plugin.button'}}
|
|
159
168
|
</AuButton>
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { action } from '@ember/object';
|
|
3
3
|
import { service } from '@ember/service';
|
|
4
|
+
import { on } from '@ember/modifier';
|
|
4
5
|
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
5
6
|
import IntlService from 'ember-intl/services/intl';
|
|
7
|
+
import t from 'ember-intl/helpers/t';
|
|
6
8
|
import { replaceSelectionWithAndSelectNode } from '@lblod/ember-rdfa-editor-lblod-plugins/commands';
|
|
7
9
|
import { AddIcon } from '@appuniversum/ember-appuniversum/components/icons/add';
|
|
8
10
|
import { createDateVariable } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/actions/create-date-variable';
|
|
11
|
+
import AuButton from '@appuniversum/ember-appuniversum/components/au-button';
|
|
9
12
|
|
|
10
|
-
type
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
type Sig = {
|
|
14
|
+
Args: {
|
|
15
|
+
controller: SayController;
|
|
16
|
+
templateMode?: boolean;
|
|
17
|
+
};
|
|
13
18
|
};
|
|
14
19
|
|
|
15
|
-
export default class DateInsertComponent extends Component<
|
|
16
|
-
AddIcon = AddIcon;
|
|
17
|
-
|
|
20
|
+
export default class DateInsertComponent extends Component<Sig> {
|
|
18
21
|
@service declare intl: IntlService;
|
|
19
22
|
|
|
20
23
|
get controller() {
|
|
@@ -44,4 +47,17 @@ export default class DateInsertComponent extends Component<Args> {
|
|
|
44
47
|
view: this.controller.mainEditorView,
|
|
45
48
|
});
|
|
46
49
|
}
|
|
50
|
+
|
|
51
|
+
<template>
|
|
52
|
+
<li class='au-c-list__item'>
|
|
53
|
+
<AuButton
|
|
54
|
+
@icon={{AddIcon}}
|
|
55
|
+
@iconAlignment='left'
|
|
56
|
+
@skin='link'
|
|
57
|
+
{{on 'click' this.insert}}
|
|
58
|
+
>
|
|
59
|
+
{{t 'date-plugin.insert.date'}}
|
|
60
|
+
</AuButton>
|
|
61
|
+
</li>
|
|
62
|
+
</template>
|
|
47
63
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { action } from '@ember/object';
|
|
3
|
+
import { service } from '@ember/service';
|
|
4
|
+
import { on } from '@ember/modifier';
|
|
5
|
+
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
6
|
+
import IntlService from 'ember-intl/services/intl';
|
|
7
|
+
import t from 'ember-intl/helpers/t';
|
|
8
|
+
import { AddIcon } from '@appuniversum/ember-appuniversum/components/icons/add';
|
|
9
|
+
import AuButton from '@appuniversum/ember-appuniversum/components/au-button';
|
|
10
|
+
import { replaceSelectionWithAndSelectNode } from '@lblod/ember-rdfa-editor-lblod-plugins/commands';
|
|
11
|
+
import { createCodelistVariable } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/actions/create-codelist-variable';
|
|
12
|
+
import { hardcodedMarcodeList } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/variables/marcode';
|
|
13
|
+
|
|
14
|
+
type Sig = {
|
|
15
|
+
Args: {
|
|
16
|
+
controller: SayController;
|
|
17
|
+
templateMode?: boolean;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default class MarcodeInsertComponent extends Component<Sig> {
|
|
22
|
+
@service declare intl: IntlService;
|
|
23
|
+
|
|
24
|
+
get controller() {
|
|
25
|
+
return this.args.controller;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
get schema() {
|
|
29
|
+
return this.controller.schema;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
get documentLanguage() {
|
|
33
|
+
return this.controller.documentLanguage;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@action
|
|
37
|
+
insert() {
|
|
38
|
+
const defaultLabel = this.intl.t('variable.marcode.label', {
|
|
39
|
+
locale: this.documentLanguage,
|
|
40
|
+
});
|
|
41
|
+
const label = defaultLabel;
|
|
42
|
+
|
|
43
|
+
const node = createCodelistVariable({
|
|
44
|
+
schema: this.schema,
|
|
45
|
+
// It's not clear if this should always be single, or whether we need to add a way to set it
|
|
46
|
+
selectionStyle: 'single',
|
|
47
|
+
codelist: 'http://example.org/this/doesnt/exist/yet',
|
|
48
|
+
source: 'https://data.lblod.info/sparql',
|
|
49
|
+
// This list is huge, but this hack also seems to be temporary... Maybe we should keep the
|
|
50
|
+
// list in code instead of in the doc?
|
|
51
|
+
hardcodedOptionList: hardcodedMarcodeList,
|
|
52
|
+
label,
|
|
53
|
+
});
|
|
54
|
+
this.controller.doCommand(replaceSelectionWithAndSelectNode(node), {
|
|
55
|
+
view: this.controller.mainEditorView,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
<template>
|
|
60
|
+
<li class='au-c-list__item'>
|
|
61
|
+
<AuButton
|
|
62
|
+
@icon={{AddIcon}}
|
|
63
|
+
@iconAlignment='left'
|
|
64
|
+
@skin='link'
|
|
65
|
+
{{on 'click' this.insert}}
|
|
66
|
+
>
|
|
67
|
+
{{t 'variable.marcode.insert'}}
|
|
68
|
+
</AuButton>
|
|
69
|
+
</li>
|
|
70
|
+
</template>
|
|
71
|
+
}
|
|
@@ -46,6 +46,7 @@ import {
|
|
|
46
46
|
VariableInstance,
|
|
47
47
|
} from '../schemas/variable-instance';
|
|
48
48
|
import { createCodelistVariable } from '../../variable-plugin/actions/create-codelist-variable';
|
|
49
|
+
import removeZFromLabel from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/roadsign-regulation-plugin/helpers/removeZFromLabel';
|
|
49
50
|
|
|
50
51
|
type InsertMeasureArgs = {
|
|
51
52
|
arDesignUri?: string;
|
|
@@ -122,20 +123,25 @@ export default function insertMeasure({
|
|
|
122
123
|
signList,
|
|
123
124
|
];
|
|
124
125
|
}
|
|
125
|
-
const
|
|
126
|
+
const measureUri = `http://data.lblod.info/mobiliteitsmaatregels/${uuid()}`;
|
|
127
|
+
const measureBody = constructMeasureBody(
|
|
128
|
+
templateString,
|
|
129
|
+
variables,
|
|
130
|
+
schema,
|
|
131
|
+
measureUri,
|
|
132
|
+
);
|
|
126
133
|
const temporalNode = temporal
|
|
127
134
|
? schema.nodes.paragraph.create(
|
|
128
135
|
{},
|
|
129
136
|
schema.text('Deze signalisatie is dynamisch.'),
|
|
130
137
|
)
|
|
131
138
|
: undefined;
|
|
132
|
-
const measureUri = `http://data.lblod.info/mobiliteitsmaatregels/${uuid()}`;
|
|
133
139
|
const measureNode = schema.nodes.block_rdfa.create(
|
|
134
140
|
{
|
|
135
141
|
rdfaNodeType: 'resource',
|
|
136
142
|
subject: measureUri,
|
|
137
143
|
__rdfaId: uuid(),
|
|
138
|
-
label: `Mobiliteitsmaatregel ${measureConcept.label}`,
|
|
144
|
+
label: `Mobiliteitsmaatregel ${removeZFromLabel(measureConcept.label)}`,
|
|
139
145
|
properties: [
|
|
140
146
|
{
|
|
141
147
|
predicate: RDF('type').full,
|
|
@@ -226,6 +232,7 @@ function constructMeasureBody(
|
|
|
226
232
|
Exclude<Variable, { type: 'instruction' }> | VariableInstance
|
|
227
233
|
>,
|
|
228
234
|
schema: Schema,
|
|
235
|
+
measureUri: string,
|
|
229
236
|
) {
|
|
230
237
|
const parts = templateString.split(/(\$\{[^{}$]+\})/);
|
|
231
238
|
const nodes = [];
|
|
@@ -238,7 +245,7 @@ function constructMeasureBody(
|
|
|
238
245
|
const variableName = match[1];
|
|
239
246
|
const matchedVariable = variables[variableName];
|
|
240
247
|
if (matchedVariable) {
|
|
241
|
-
nodes.push(constructVariableNode(matchedVariable, schema));
|
|
248
|
+
nodes.push(constructVariableNode(matchedVariable, schema, measureUri));
|
|
242
249
|
} else {
|
|
243
250
|
nodes.push(schema.text(part));
|
|
244
251
|
}
|
|
@@ -322,6 +329,7 @@ function constructVariableNode(
|
|
|
322
329
|
| Exclude<Variable, { type: 'instruction' }>
|
|
323
330
|
| VariableInstance,
|
|
324
331
|
schema: Schema,
|
|
332
|
+
measureUri: string,
|
|
325
333
|
) {
|
|
326
334
|
const variable = isVariableInstance(variableOrVariableInstance)
|
|
327
335
|
? variableOrVariableInstance.variable
|
|
@@ -338,6 +346,7 @@ function constructVariableNode(
|
|
|
338
346
|
: variableInstance.value?.toString();
|
|
339
347
|
const args = {
|
|
340
348
|
schema,
|
|
349
|
+
measureUri,
|
|
341
350
|
variable: variable.uri,
|
|
342
351
|
variableInstance: variableInstance.uri,
|
|
343
352
|
value: valueStr,
|
|
@@ -4,10 +4,14 @@ import {
|
|
|
4
4
|
type MobilityMeasureConcept,
|
|
5
5
|
MobilityMeasureConceptSchema,
|
|
6
6
|
} from './mobility-measure-concept';
|
|
7
|
+
import { TrafficSignalConceptSchema } from './traffic-signal-concept';
|
|
7
8
|
|
|
8
9
|
export const MobilityMeasureDesignSchema = z.object({
|
|
9
10
|
uri: z.string(),
|
|
10
|
-
trafficSignals: z.
|
|
11
|
+
trafficSignals: z.union([
|
|
12
|
+
z.array(TrafficSignalSchema),
|
|
13
|
+
z.array(TrafficSignalConceptSchema),
|
|
14
|
+
]),
|
|
11
15
|
measureConcept: MobilityMeasureConceptSchema,
|
|
12
16
|
});
|
|
13
17
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Schema } from '@lblod/ember-rdfa-editor';
|
|
2
2
|
import {
|
|
3
3
|
DCT,
|
|
4
|
+
MOBILITEIT,
|
|
4
5
|
RDF,
|
|
5
6
|
VARIABLES,
|
|
6
7
|
XSD,
|
|
@@ -35,6 +36,7 @@ export function createClassicLocationVariable(
|
|
|
35
36
|
type CreateClassicLocationVariableAttrsArgs = {
|
|
36
37
|
label?: string;
|
|
37
38
|
source?: string;
|
|
39
|
+
measureUri?: string;
|
|
38
40
|
} & AllOrNone<{ variable: string; variableInstance: string }>;
|
|
39
41
|
|
|
40
42
|
export function createClassicLocationVariableAttrs({
|
|
@@ -42,6 +44,7 @@ export function createClassicLocationVariableAttrs({
|
|
|
42
44
|
variableInstance,
|
|
43
45
|
label,
|
|
44
46
|
source,
|
|
47
|
+
measureUri,
|
|
45
48
|
}: CreateClassicLocationVariableAttrsArgs) {
|
|
46
49
|
const externalTriples: FullTriple[] = [];
|
|
47
50
|
const backlinks: IncomingTriple[] = [];
|
|
@@ -70,6 +73,12 @@ export function createClassicLocationVariableAttrs({
|
|
|
70
73
|
object: sayDataFactory.namedNode(source),
|
|
71
74
|
});
|
|
72
75
|
}
|
|
76
|
+
if (measureUri) {
|
|
77
|
+
backlinks.push({
|
|
78
|
+
subject: sayDataFactory.resourceNode(measureUri),
|
|
79
|
+
predicate: MOBILITEIT('plaatsbepaling').full,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
73
82
|
backlinks.push({
|
|
74
83
|
subject: sayDataFactory.resourceNode(variableInstance),
|
|
75
84
|
predicate: RDF('value').full,
|
|
@@ -12,6 +12,8 @@ import {
|
|
|
12
12
|
OutgoingTriple,
|
|
13
13
|
} from '@lblod/ember-rdfa-editor/core/rdfa-processor';
|
|
14
14
|
import { sayDataFactory } from '@lblod/ember-rdfa-editor/core/say-data-factory';
|
|
15
|
+
import { CodelistAttrs } from '../variables';
|
|
16
|
+
import { CodeListOption } from '../utils/fetch-data';
|
|
15
17
|
|
|
16
18
|
type CreateCodelistVariableArgs = {
|
|
17
19
|
schema: Schema;
|
|
@@ -39,6 +41,7 @@ type CreateCodelistVariableAttrsArgs = {
|
|
|
39
41
|
label?: string;
|
|
40
42
|
source: string;
|
|
41
43
|
codelist: string;
|
|
44
|
+
hardcodedOptionList?: CodeListOption[];
|
|
42
45
|
} & AllOrNone<{ variable: string; variableInstance: string }>;
|
|
43
46
|
|
|
44
47
|
export function createCodelistVariableAttrs({
|
|
@@ -48,6 +51,7 @@ export function createCodelistVariableAttrs({
|
|
|
48
51
|
codelist,
|
|
49
52
|
variable,
|
|
50
53
|
variableInstance,
|
|
54
|
+
hardcodedOptionList,
|
|
51
55
|
}: CreateCodelistVariableAttrsArgs) {
|
|
52
56
|
const externalTriples: FullTriple[] = [];
|
|
53
57
|
if (variable) {
|
|
@@ -79,7 +83,8 @@ export function createCodelistVariableAttrs({
|
|
|
79
83
|
label,
|
|
80
84
|
variable,
|
|
81
85
|
variableInstance,
|
|
82
|
-
|
|
86
|
+
hardcodedOptionList,
|
|
87
|
+
} as CodelistAttrs;
|
|
83
88
|
}
|
|
84
89
|
|
|
85
90
|
type CreateCodelistOptionNodeArgs = {
|
|
@@ -22,7 +22,22 @@ import { recreateVariableUris } from '../utils/recreate-variable-uris';
|
|
|
22
22
|
import getClassnamesFromNode from '@lblod/ember-rdfa-editor/utils/get-classnames-from-node';
|
|
23
23
|
import SayNodeSpec from '@lblod/ember-rdfa-editor/core/say-node-spec';
|
|
24
24
|
import CodelistNodeviewComponent from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/codelist/nodeview';
|
|
25
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
Option,
|
|
27
|
+
unwrap,
|
|
28
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
|
|
29
|
+
import { jsonParse } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/strings';
|
|
30
|
+
import { CodeListOption } from '../utils/fetch-data';
|
|
31
|
+
|
|
32
|
+
export type CodelistAttrs = {
|
|
33
|
+
label: Option<string>;
|
|
34
|
+
source: Option<string>;
|
|
35
|
+
codelist: Option<string>;
|
|
36
|
+
variable: Option<string>;
|
|
37
|
+
variableInstance: Option<string>;
|
|
38
|
+
selectionStyle: Option<string>;
|
|
39
|
+
hardcodedOptionList: Option<CodeListOption[]>;
|
|
40
|
+
};
|
|
26
41
|
|
|
27
42
|
const rdfaAware = true;
|
|
28
43
|
|
|
@@ -45,6 +60,9 @@ const parseDOM: TagParseRule[] = [
|
|
|
45
60
|
const variable = node.dataset.variable;
|
|
46
61
|
const variableInstance = node.dataset.variableInstance;
|
|
47
62
|
const selectionStyle = node.dataset.selectionStyle;
|
|
63
|
+
const hardcodedOptionList = jsonParse(
|
|
64
|
+
node.dataset.optionList,
|
|
65
|
+
) as Option<CodeListOption[]>;
|
|
48
66
|
return {
|
|
49
67
|
...attrs,
|
|
50
68
|
label,
|
|
@@ -53,7 +71,8 @@ const parseDOM: TagParseRule[] = [
|
|
|
53
71
|
selectionStyle,
|
|
54
72
|
variable,
|
|
55
73
|
variableInstance,
|
|
56
|
-
|
|
74
|
+
hardcodedOptionList,
|
|
75
|
+
} satisfies CodelistAttrs;
|
|
57
76
|
}
|
|
58
77
|
return false;
|
|
59
78
|
},
|
|
@@ -92,6 +111,7 @@ const toDOM = (node: PNode): DOMOutputSpec => {
|
|
|
92
111
|
selectionStyle,
|
|
93
112
|
variable,
|
|
94
113
|
variableInstance,
|
|
114
|
+
hardcodedOptionList,
|
|
95
115
|
} = node.attrs;
|
|
96
116
|
const className = humanReadableContent ? '' : ' say-variable';
|
|
97
117
|
const codelist_option_nodes = node.content.content;
|
|
@@ -119,6 +139,7 @@ const toDOM = (node: PNode): DOMOutputSpec => {
|
|
|
119
139
|
'data-selection-style': selectionStyle as string,
|
|
120
140
|
'data-variable': variable as string,
|
|
121
141
|
'data-variable-instance': variableInstance as string,
|
|
142
|
+
'data-option-list': JSON.stringify(hardcodedOptionList),
|
|
122
143
|
},
|
|
123
144
|
contentArray: contentArray.length ? contentArray : [label],
|
|
124
145
|
});
|
|
@@ -152,6 +173,9 @@ const emberNodeConfig: EmberNodeConfig = {
|
|
|
152
173
|
variableInstance: {
|
|
153
174
|
default: null,
|
|
154
175
|
},
|
|
176
|
+
hardcodedOptionList: {
|
|
177
|
+
default: null,
|
|
178
|
+
},
|
|
155
179
|
},
|
|
156
180
|
classNames: ['say-codelist-variable'],
|
|
157
181
|
toDOM,
|