@lblod/ember-rdfa-editor-lblod-plugins 34.1.0 → 34.1.1-dev.1d2f3e742d24669db16d226d25207f75de2e81a7
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/fifty-planes-rhyme.md +5 -0
- package/.changeset/green-bulldogs-ring.md +5 -0
- package/.changeset/healthy-experts-clean.md +5 -0
- package/.changeset/long-years-sniff.md +5 -0
- package/.changeset/sweet-dogs-shake.md +5 -0
- package/.changeset/weak-clocks-return.md +5 -0
- package/CHANGELOG.md +6 -0
- package/addon/components/citation-plugin/citations/legal-document-preview.hbs +12 -0
- package/addon/components/citation-plugin/citations/legal-document-preview.ts +2 -0
- package/addon/components/document-validation-plugin/card.gts +128 -17
- 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 +47 -12
- package/addon/plugins/roadsign-regulation-plugin/helpers/removeZFromLabel.ts +5 -0
- package/addon/plugins/roadsign-regulation-plugin/queries/mobility-measure-concept.ts +6 -1
- package/addon/plugins/roadsign-regulation-plugin/schemas/mobility-measure-design.ts +5 -1
- 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/app/styles/document-validation.scss +4 -0
- package/declarations/addon/components/citation-plugin/citations/legal-document-preview.d.ts +1 -0
- package/declarations/addon/components/document-validation-plugin/card.d.ts +12 -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-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 +10 -2
- package/translations/nl-BE.yaml +10 -2
- package/addon/components/variable-plugin/date/insert.hbs +0 -11
- package/pnpm-lock.yaml +0 -22129
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
|
|
@@ -9,6 +9,17 @@
|
|
|
9
9
|
>
|
|
10
10
|
{{if @fullSize (capitalize @legalDocument.fullTitle) @legalDocument.title}}
|
|
11
11
|
</p>
|
|
12
|
+
{{#if (and @fullSize @legalDocument.documentDate)}}
|
|
13
|
+
<AuPill
|
|
14
|
+
class='au-u-margin-top-small au-u-margin-bottom-small'
|
|
15
|
+
@skin='border'
|
|
16
|
+
@icon={{this.DocumentIcon}}
|
|
17
|
+
@iconAlignment='left'
|
|
18
|
+
>
|
|
19
|
+
{{t 'citaten-plugin.pills.document-date'}}
|
|
20
|
+
{{@legalDocument.documentDate}}
|
|
21
|
+
</AuPill>
|
|
22
|
+
{{/if}}
|
|
12
23
|
{{#if (and @fullSize @legalDocument.publicationDate)}}
|
|
13
24
|
<AuPill
|
|
14
25
|
class='au-u-margin-top-small au-u-margin-bottom-small'
|
|
@@ -16,6 +27,7 @@
|
|
|
16
27
|
@icon={{this.CalendarIcon}}
|
|
17
28
|
@iconAlignment='left'
|
|
18
29
|
>
|
|
30
|
+
{{t 'citaten-plugin.pills.publication-date'}}
|
|
19
31
|
{{@legalDocument.publicationDate}}
|
|
20
32
|
</AuPill>
|
|
21
33
|
{{/if}}
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
LegalDocument,
|
|
5
5
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/legal-documents';
|
|
6
6
|
import { CalendarIcon } from '@appuniversum/ember-appuniversum/components/icons/calendar';
|
|
7
|
+
import { DocumentIcon } from '@appuniversum/ember-appuniversum/components/icons/document';
|
|
7
8
|
import { PlusTextIcon } from '@appuniversum/ember-appuniversum/components/icons/plus-text';
|
|
8
9
|
import { LinkExternalIcon } from '@appuniversum/ember-appuniversum/components/icons/link-external';
|
|
9
10
|
import { ManualIcon } from '@appuniversum/ember-appuniversum/components/icons/manual';
|
|
@@ -17,6 +18,7 @@ export default class LegalDocumentPreviewComponent extends Component<Args> {
|
|
|
17
18
|
LinkExternalIcon = LinkExternalIcon;
|
|
18
19
|
PlusTextIcon = PlusTextIcon;
|
|
19
20
|
CalendarIcon = CalendarIcon;
|
|
21
|
+
DocumentIcon = DocumentIcon;
|
|
20
22
|
|
|
21
23
|
get isBesluit() {
|
|
22
24
|
return isBesluitLegalDocument(this.args.legalDocument);
|
|
@@ -11,13 +11,17 @@ import { fn } from '@ember/helper';
|
|
|
11
11
|
import AuButton from '@appuniversum/ember-appuniversum/components/au-button';
|
|
12
12
|
import { ExternalLinkIcon } from '@appuniversum/ember-appuniversum/components/icons/external-link';
|
|
13
13
|
import t from 'ember-intl/helpers/t';
|
|
14
|
-
import { eq } from 'ember-truth-helpers';
|
|
14
|
+
import { and, eq } from 'ember-truth-helpers';
|
|
15
15
|
import ValidationReport from 'rdf-validate-shacl/src/validation-report';
|
|
16
16
|
import { CircleInfoIcon } from '@appuniversum/ember-appuniversum/components/icons/circle-info';
|
|
17
|
+
import { SettingsIcon } from '@appuniversum/ember-appuniversum/components/icons/settings';
|
|
18
|
+
import { tracked } from '@glimmer/tracking';
|
|
19
|
+
import AuModal from '@appuniversum/ember-appuniversum/components/au-modal';
|
|
17
20
|
|
|
18
21
|
interface Sig {
|
|
19
22
|
Args: {
|
|
20
23
|
controller: SayController;
|
|
24
|
+
enableDeveloperInfo?: boolean;
|
|
21
25
|
};
|
|
22
26
|
}
|
|
23
27
|
|
|
@@ -33,6 +37,7 @@ function hasProperty<
|
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
export default class DocumentValidationPluginCard extends Component<Sig> {
|
|
40
|
+
@tracked developerModalOpen = false;
|
|
36
41
|
get controller() {
|
|
37
42
|
return this.args.controller;
|
|
38
43
|
}
|
|
@@ -81,6 +86,9 @@ export default class DocumentValidationPluginCard extends Component<Sig> {
|
|
|
81
86
|
view: this.controller.mainEditorView,
|
|
82
87
|
});
|
|
83
88
|
this.controller.focus();
|
|
89
|
+
if (this.developerModalOpen) {
|
|
90
|
+
this.developerModalOpen = false;
|
|
91
|
+
}
|
|
84
92
|
};
|
|
85
93
|
get status() {
|
|
86
94
|
if (!this.validationState?.report) return 'not-run';
|
|
@@ -140,6 +148,24 @@ export default class DocumentValidationPluginCard extends Component<Sig> {
|
|
|
140
148
|
}
|
|
141
149
|
return true;
|
|
142
150
|
};
|
|
151
|
+
openDeveloperModal = (event: Event) => {
|
|
152
|
+
this.developerModalOpen = true;
|
|
153
|
+
event.stopPropagation();
|
|
154
|
+
};
|
|
155
|
+
closeDeveloperModal = () => {
|
|
156
|
+
this.developerModalOpen = false;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
get formattedValidationResult() {
|
|
160
|
+
return this.validationState?.report?.results.map((result) => ({
|
|
161
|
+
focusNode: result.focusNode?.value,
|
|
162
|
+
path: result.path?.value,
|
|
163
|
+
severity: result.severity?.value,
|
|
164
|
+
sourceConstraintComponent: result.sourceConstraintComponent?.value,
|
|
165
|
+
sourceShape: result.sourceShape?.value,
|
|
166
|
+
value: result.value?.value,
|
|
167
|
+
}));
|
|
168
|
+
}
|
|
143
169
|
|
|
144
170
|
<template>
|
|
145
171
|
<AuCard
|
|
@@ -157,17 +183,27 @@ export default class DocumentValidationPluginCard extends Component<Sig> {
|
|
|
157
183
|
as |c|
|
|
158
184
|
>
|
|
159
185
|
<c.header>
|
|
160
|
-
<
|
|
161
|
-
|
|
162
|
-
{{
|
|
163
|
-
|
|
164
|
-
{{
|
|
165
|
-
|
|
166
|
-
{{
|
|
167
|
-
|
|
168
|
-
{{
|
|
186
|
+
<div class='au-u-flex au-u-flex--between au-u-1-1'>
|
|
187
|
+
<p class='au-u-medium au-u-h6'>
|
|
188
|
+
{{#if (eq this.status 'valid')}}
|
|
189
|
+
{{t 'document-validation-plugin.valid-document-title'}}
|
|
190
|
+
{{else if (eq this.status 'invalid')}}
|
|
191
|
+
{{t 'document-validation-plugin.invalid-document-title'}}
|
|
192
|
+
{{else if (eq this.status 'not-run')}}
|
|
193
|
+
{{t 'document-validation-plugin.document-not-validated-title'}}
|
|
194
|
+
{{else if (eq this.status 'no-matches')}}
|
|
195
|
+
{{t 'document-validation-plugin.no-matching-rules'}}
|
|
196
|
+
{{/if}}
|
|
197
|
+
</p>
|
|
198
|
+
{{#if (and @enableDeveloperInfo this.documentValidationErrors)}}
|
|
199
|
+
<AuButton
|
|
200
|
+
@icon={{SettingsIcon}}
|
|
201
|
+
@iconAlignment='left'
|
|
202
|
+
@skin='link'
|
|
203
|
+
{{on 'click' this.openDeveloperModal}}
|
|
204
|
+
/>
|
|
169
205
|
{{/if}}
|
|
170
|
-
</
|
|
206
|
+
</div>
|
|
171
207
|
</c.header>
|
|
172
208
|
<c.content>
|
|
173
209
|
<div>
|
|
@@ -176,12 +212,14 @@ export default class DocumentValidationPluginCard extends Component<Sig> {
|
|
|
176
212
|
as |error|
|
|
177
213
|
}}
|
|
178
214
|
<div class='say-document-validation__error-container'>
|
|
179
|
-
<
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
215
|
+
<div class='au-u-margin-right-small'>
|
|
216
|
+
<AuIcon
|
|
217
|
+
@icon={{CloseFilledIcon}}
|
|
218
|
+
@size='large'
|
|
219
|
+
@ariaHidden={{true}}
|
|
220
|
+
class='say-document-validation__icon-error'
|
|
221
|
+
/>
|
|
222
|
+
</div>
|
|
185
223
|
<div>
|
|
186
224
|
{{error.message}}
|
|
187
225
|
<AuButton
|
|
@@ -230,5 +268,78 @@ export default class DocumentValidationPluginCard extends Component<Sig> {
|
|
|
230
268
|
</c.content>
|
|
231
269
|
|
|
232
270
|
</AuCard>
|
|
271
|
+
{{#if @enableDeveloperInfo}}
|
|
272
|
+
<AuModal
|
|
273
|
+
@title={{t 'document-validation-plugin.developer-modal-title'}}
|
|
274
|
+
@closeModal={{this.closeDeveloperModal}}
|
|
275
|
+
@modalOpen={{this.developerModalOpen}}
|
|
276
|
+
@size='large'
|
|
277
|
+
as |Modal|
|
|
278
|
+
>
|
|
279
|
+
<Modal.Body>
|
|
280
|
+
{{#each this.formattedValidationResult as |result|}}
|
|
281
|
+
<AuCard
|
|
282
|
+
class='au-u-margin say-document-validation__developer-card'
|
|
283
|
+
@disableAuContent={{true}}
|
|
284
|
+
as |c|
|
|
285
|
+
>
|
|
286
|
+
<c.content>
|
|
287
|
+
{{! template-lint-disable no-bare-strings }}
|
|
288
|
+
<p>
|
|
289
|
+
<span class='au-u-bold'>
|
|
290
|
+
FocusNode:
|
|
291
|
+
</span>
|
|
292
|
+
{{result.focusNode}}
|
|
293
|
+
<AuButton
|
|
294
|
+
class='au-u-padding-left-none au-u-padding-right-none'
|
|
295
|
+
@icon={{ExternalLinkIcon}}
|
|
296
|
+
@skin='link'
|
|
297
|
+
title={{result.focusNode}}
|
|
298
|
+
{{on 'click' (fn this.goToSubject result.focusNode)}}
|
|
299
|
+
>{{t
|
|
300
|
+
'document-validation-plugin.see-related-node'
|
|
301
|
+
}}</AuButton>
|
|
302
|
+
</p>
|
|
303
|
+
<p>
|
|
304
|
+
<span class='au-u-bold'>
|
|
305
|
+
Path:
|
|
306
|
+
</span>
|
|
307
|
+
{{result.path}}
|
|
308
|
+
</p>
|
|
309
|
+
<p>
|
|
310
|
+
<span class='au-u-bold'>
|
|
311
|
+
Severity:
|
|
312
|
+
</span>
|
|
313
|
+
{{result.severity}}
|
|
314
|
+
</p>
|
|
315
|
+
<p>
|
|
316
|
+
<span class='au-u-bold'>
|
|
317
|
+
SourceConstraintComponent:
|
|
318
|
+
</span>
|
|
319
|
+
{{result.sourceConstraintComponent}}
|
|
320
|
+
</p>
|
|
321
|
+
<p>
|
|
322
|
+
<span class='au-u-bold'>
|
|
323
|
+
SourceShape:
|
|
324
|
+
</span>
|
|
325
|
+
{{result.sourceShape}}
|
|
326
|
+
</p>
|
|
327
|
+
<p>
|
|
328
|
+
<span class='au-u-bold'>
|
|
329
|
+
Value:
|
|
330
|
+
</span>
|
|
331
|
+
{{result.value}}
|
|
332
|
+
</p>
|
|
333
|
+
</c.content>
|
|
334
|
+
</AuCard>
|
|
335
|
+
{{/each}}
|
|
336
|
+
</Modal.Body>
|
|
337
|
+
<Modal.Footer>
|
|
338
|
+
<AuButton {{on 'click' this.closeDeveloperModal}}>{{t
|
|
339
|
+
'document-validation-plugin.developer-modal-button'
|
|
340
|
+
}}</AuButton>
|
|
341
|
+
</Modal.Footer>
|
|
342
|
+
</AuModal>
|
|
343
|
+
{{/if}}
|
|
233
344
|
</template>
|
|
234
345
|
}
|
|
@@ -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
|
+
}
|