@lblod/ember-rdfa-editor-lblod-plugins 32.6.0 → 32.6.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.
- package/CHANGELOG.md +6 -0
- package/addon/components/roadsign-regulation-plugin/roadsigns-modal.gts +0 -7
- package/addon/components/variable-plugin/codelist/{edit.ts → edit.gts} +83 -5
- package/addon/plugins/variable-plugin/variables/codelist.ts +4 -2
- package/addon/plugins/variable-plugin/variables/location.ts +2 -1
- package/declarations/addon/components/variable-plugin/codelist/edit.d.ts +6 -4
- package/package.json +1 -1
- package/translations/en-US.yaml +1 -0
- package/translations/nl-BE.yaml +1 -0
- package/types/ember-power-select/components/power-select-multiple.d.ts +7 -0
- package/types/ember-power-select/components/power-select.d.ts +1 -0
- package/addon/components/variable-plugin/codelist/edit.hbs +0 -56
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @lblod/ember-rdfa-editor-lblod-plugins
|
|
2
2
|
|
|
3
|
+
## 32.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#600](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/600) [`93cb522`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/93cb522d59d066a00bb0c3b80f1de251948ad5fa) Thanks [@piemonkey](https://github.com/piemonkey)! - Display a warning for codelist variables with no codelist URI
|
|
8
|
+
|
|
3
9
|
## 32.6.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -393,7 +393,6 @@ export default class RoadsignsModal extends Component<Signature> {
|
|
|
393
393
|
</AuLabel>
|
|
394
394
|
<PowerSelect
|
|
395
395
|
@renderInPlace={{true}}
|
|
396
|
-
{{! @glint-expect-error some type issue of ember-power-select }}
|
|
397
396
|
@verticalPosition='below'
|
|
398
397
|
@options={{this.typeOptions}}
|
|
399
398
|
@searchEnabled={{true}}
|
|
@@ -412,7 +411,6 @@ export default class RoadsignsModal extends Component<Signature> {
|
|
|
412
411
|
</AuLabel>
|
|
413
412
|
<PowerSelect
|
|
414
413
|
@renderInPlace={{true}}
|
|
415
|
-
{{! @glint-expect-error some type issue of ember-power-select }}
|
|
416
414
|
@verticalPosition='below'
|
|
417
415
|
@searchEnabled={{true}}
|
|
418
416
|
@search={{this.searchCodes.perform}}
|
|
@@ -442,9 +440,7 @@ export default class RoadsignsModal extends Component<Signature> {
|
|
|
442
440
|
consume the value in the template and force powerselect to rerender.
|
|
443
441
|
Other tricks such as #let bindings also do not work. }}
|
|
444
442
|
{{#if this.codeCombinationOptions.length}}
|
|
445
|
-
{{! @glint-expect-error some type issue of ember-power-select }}
|
|
446
443
|
<PowerSelectMultiple
|
|
447
|
-
{{! @glint-expect-error some type issue of ember-power-select }}
|
|
448
444
|
@renderInPlace={{true}}
|
|
449
445
|
@verticalPosition='below'
|
|
450
446
|
@searchEnabled={{true}}
|
|
@@ -459,9 +455,7 @@ export default class RoadsignsModal extends Component<Signature> {
|
|
|
459
455
|
{{option.label}}
|
|
460
456
|
</PowerSelectMultiple>
|
|
461
457
|
{{else}}
|
|
462
|
-
{{! @glint-expect-error some type issue of ember-power-select }}
|
|
463
458
|
<PowerSelectMultiple
|
|
464
|
-
{{! @glint-expect-error some type issue of ember-power-select }}
|
|
465
459
|
@renderInPlace={{true}}
|
|
466
460
|
@verticalPosition='below'
|
|
467
461
|
@searchEnabled={{false}}
|
|
@@ -483,7 +477,6 @@ export default class RoadsignsModal extends Component<Signature> {
|
|
|
483
477
|
</AuLabel>
|
|
484
478
|
<PowerSelect
|
|
485
479
|
@renderInPlace={{true}}
|
|
486
|
-
{{! @glint-expect-error some type issue of ember-power-select }}
|
|
487
480
|
@verticalPosition='below'
|
|
488
481
|
@options={{this.zonalityOptions}}
|
|
489
482
|
@searchEnabled={{false}}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { action } from '@ember/object';
|
|
3
|
+
import { on } from '@ember/modifier';
|
|
4
|
+
import { eq, not } from 'ember-truth-helpers';
|
|
5
|
+
import t from 'ember-intl/helpers/t';
|
|
6
|
+
import PowerSelect from 'ember-power-select/components/power-select';
|
|
3
7
|
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
4
8
|
import {
|
|
5
9
|
CodeListOption,
|
|
@@ -12,15 +16,25 @@ import { trackedFunction } from 'reactiveweb/function';
|
|
|
12
16
|
import { updateCodelistVariable } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/codelist-utils';
|
|
13
17
|
import { Option } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
|
|
14
18
|
import { tracked } from '@glimmer/tracking';
|
|
19
|
+
import AuCard from '@appuniversum/ember-appuniversum/components/au-card';
|
|
20
|
+
import AuHeading from '@appuniversum/ember-appuniversum/components/au-heading';
|
|
21
|
+
import AuLabel from '@appuniversum/ember-appuniversum/components/au-label';
|
|
22
|
+
import PowerSelectMultiple from 'ember-power-select/components/power-select-multiple';
|
|
23
|
+
import AuButton from '@appuniversum/ember-appuniversum/components/au-button';
|
|
24
|
+
import { AlertTriangleIcon } from '@appuniversum/ember-appuniversum/components/icons/alert-triangle';
|
|
25
|
+
import AuAlert from '@appuniversum/ember-appuniversum/components/au-alert';
|
|
26
|
+
|
|
15
27
|
export type CodelistEditOptions = {
|
|
16
28
|
endpoint: string;
|
|
17
29
|
};
|
|
18
|
-
type
|
|
19
|
-
|
|
20
|
-
|
|
30
|
+
type Sig = {
|
|
31
|
+
Args: {
|
|
32
|
+
controller: SayController;
|
|
33
|
+
options: CodelistEditOptions;
|
|
34
|
+
};
|
|
21
35
|
};
|
|
22
36
|
|
|
23
|
-
export default class CodelistEditComponent extends Component<
|
|
37
|
+
export default class CodelistEditComponent extends Component<Sig> {
|
|
24
38
|
@tracked selectedCodelistOption?: CodeListOption | CodeListOption[];
|
|
25
39
|
|
|
26
40
|
get controller() {
|
|
@@ -46,7 +60,7 @@ export default class CodelistEditComponent extends Component<Args> {
|
|
|
46
60
|
if (this.selectedCodelist) {
|
|
47
61
|
const { node } = this.selectedCodelist;
|
|
48
62
|
const source = node.attrs['source'] as Option<string>;
|
|
49
|
-
if (source) {
|
|
63
|
+
if (source && source !== 'UNKNOWN') {
|
|
50
64
|
return source;
|
|
51
65
|
}
|
|
52
66
|
}
|
|
@@ -109,4 +123,68 @@ export default class CodelistEditComponent extends Component<Args> {
|
|
|
109
123
|
updateCodelistOption(codelistOption: CodeListOption | CodeListOption[]) {
|
|
110
124
|
this.selectedCodelistOption = codelistOption;
|
|
111
125
|
}
|
|
126
|
+
|
|
127
|
+
<template>
|
|
128
|
+
{{#if this.showCard}}
|
|
129
|
+
<AuCard
|
|
130
|
+
@flex={{true}}
|
|
131
|
+
@divided={{true}}
|
|
132
|
+
@isOpenInitially={{true}}
|
|
133
|
+
@expandable={{true}}
|
|
134
|
+
@shadow={{true}}
|
|
135
|
+
@size='small'
|
|
136
|
+
as |c|
|
|
137
|
+
>
|
|
138
|
+
<c.header>
|
|
139
|
+
<AuHeading @level='3' @skin='6'>
|
|
140
|
+
{{t 'variable-plugin.enter-variable-value'}}
|
|
141
|
+
</AuHeading>
|
|
142
|
+
</c.header>
|
|
143
|
+
<c.content>
|
|
144
|
+
{{#if (eq this.codelistUri 'UNKNOWN')}}
|
|
145
|
+
<AuAlert @icon={{AlertTriangleIcon}} @skin='warning'>
|
|
146
|
+
{{t 'variable-plugin.unknown-codelist'}}
|
|
147
|
+
</AuAlert>
|
|
148
|
+
{{else}}
|
|
149
|
+
<AuLabel for='codelist-select'>
|
|
150
|
+
{{this.label}}
|
|
151
|
+
</AuLabel>
|
|
152
|
+
{{#if this.multiSelect}}
|
|
153
|
+
<PowerSelectMultiple
|
|
154
|
+
id='codelist-select'
|
|
155
|
+
@allowClear={{false}}
|
|
156
|
+
@searchEnabled={{true}}
|
|
157
|
+
@searchField='label'
|
|
158
|
+
@options={{this.codelistOptions.value.options}}
|
|
159
|
+
@selected={{this.selectedCodelistOption}}
|
|
160
|
+
@onChange={{this.updateCodelistOption}}
|
|
161
|
+
as |option|
|
|
162
|
+
>
|
|
163
|
+
{{option.label}}
|
|
164
|
+
</PowerSelectMultiple>
|
|
165
|
+
{{else}}
|
|
166
|
+
<PowerSelect
|
|
167
|
+
id='codelist-select'
|
|
168
|
+
@allowClear={{false}}
|
|
169
|
+
@searchEnabled={{true}}
|
|
170
|
+
@searchField='label'
|
|
171
|
+
@options={{this.codelistOptions.value.options}}
|
|
172
|
+
@selected={{this.selectedCodelistOption}}
|
|
173
|
+
@onChange={{this.updateCodelistOption}}
|
|
174
|
+
as |option|
|
|
175
|
+
>
|
|
176
|
+
{{option.label}}
|
|
177
|
+
</PowerSelect>
|
|
178
|
+
{{/if}}
|
|
179
|
+
<AuButton
|
|
180
|
+
{{on 'click' this.insert}}
|
|
181
|
+
@disabled={{not this.selectedCodelistOption}}
|
|
182
|
+
>
|
|
183
|
+
{{t 'editor-plugins.utils.insert'}}
|
|
184
|
+
</AuButton>
|
|
185
|
+
{{/if}}
|
|
186
|
+
</c.content>
|
|
187
|
+
</AuCard>
|
|
188
|
+
{{/if}}
|
|
189
|
+
</template>
|
|
112
190
|
}
|
|
@@ -104,8 +104,10 @@ const parseDOMLegacy = [
|
|
|
104
104
|
variable: variableUri,
|
|
105
105
|
variableInstance: variableInstanceUri,
|
|
106
106
|
label,
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
// These attrs are required but it's possible for older documents to get into a broken
|
|
108
|
+
// state. We mark these as unknown so we can push the user to fix this as we can't do it.
|
|
109
|
+
source: sourceUri ?? 'UNKNOWN',
|
|
110
|
+
codelist: codelistUri ?? 'UNKNOWN',
|
|
109
111
|
selectionStyle,
|
|
110
112
|
});
|
|
111
113
|
}
|
|
@@ -98,7 +98,8 @@ const parseDOMLegacy = [
|
|
|
98
98
|
variable: variableUri,
|
|
99
99
|
variableInstance: variableInstanceUri,
|
|
100
100
|
label,
|
|
101
|
-
|
|
101
|
+
// Default to a blank string so the edit component uses the default
|
|
102
|
+
source: sourceUri ?? '',
|
|
102
103
|
});
|
|
103
104
|
}
|
|
104
105
|
return false;
|
|
@@ -4,11 +4,13 @@ import { CodeListOption, CodeListOptions } from '@lblod/ember-rdfa-editor-lblod-
|
|
|
4
4
|
export type CodelistEditOptions = {
|
|
5
5
|
endpoint: string;
|
|
6
6
|
};
|
|
7
|
-
type
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
type Sig = {
|
|
8
|
+
Args: {
|
|
9
|
+
controller: SayController;
|
|
10
|
+
options: CodelistEditOptions;
|
|
11
|
+
};
|
|
10
12
|
};
|
|
11
|
-
export default class CodelistEditComponent extends Component<
|
|
13
|
+
export default class CodelistEditComponent extends Component<Sig> {
|
|
12
14
|
selectedCodelistOption?: CodeListOption | CodeListOption[];
|
|
13
15
|
get controller(): SayController;
|
|
14
16
|
get selectedCodelist(): {
|
package/package.json
CHANGED
package/translations/en-US.yaml
CHANGED
package/translations/nl-BE.yaml
CHANGED
|
@@ -224,6 +224,7 @@ variable-plugin:
|
|
|
224
224
|
insert-variable: Voeg variabele in
|
|
225
225
|
button: Voeg in
|
|
226
226
|
enter-variable-value: Selecteer waarde
|
|
227
|
+
unknown-codelist: Er werden geen mogelijke waarden voor deze codelijst gevonden
|
|
227
228
|
label: Label
|
|
228
229
|
labelPlaceholder: Type iets...
|
|
229
230
|
number:
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Types from ember-power-select but with tweaks to improve glint support. Can be removed if moving
|
|
2
|
+
// to >v8.0
|
|
3
|
+
declare module 'ember-power-select/components/power-select-multiple' {
|
|
4
|
+
import PowerSelect from 'ember-power-select/components/power-select';
|
|
5
|
+
export * from 'ember-power-select/components/power-select';
|
|
6
|
+
export default PowerSelect;
|
|
7
|
+
}
|
|
@@ -34,6 +34,7 @@ declare module 'ember-power-select/components/power-select' {
|
|
|
34
34
|
allowClear?: boolean;
|
|
35
35
|
renderInPlace?: boolean;
|
|
36
36
|
disabled?: boolean;
|
|
37
|
+
verticalPosition?: 'below' | 'above' | 'auto';
|
|
37
38
|
// END extra args
|
|
38
39
|
highlightOnHover?: boolean;
|
|
39
40
|
placeholderComponent?: string;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
{{! @glint-nocheck: not typesafe yet }}
|
|
2
|
-
{{#if this.showCard}}
|
|
3
|
-
<AuCard
|
|
4
|
-
@flex={{true}}
|
|
5
|
-
@divided={{true}}
|
|
6
|
-
@isOpenInitially={{true}}
|
|
7
|
-
@expandable={{true}}
|
|
8
|
-
@shadow={{true}}
|
|
9
|
-
@size='small'
|
|
10
|
-
as |c|
|
|
11
|
-
>
|
|
12
|
-
<c.header>
|
|
13
|
-
<AuHeading @level='3' @skin='6'>
|
|
14
|
-
{{t 'variable-plugin.enter-variable-value'}}
|
|
15
|
-
</AuHeading>
|
|
16
|
-
</c.header>
|
|
17
|
-
<c.content>
|
|
18
|
-
<AuLabel for='codelist-select'>
|
|
19
|
-
{{this.label}}
|
|
20
|
-
</AuLabel>
|
|
21
|
-
{{#if this.multiSelect}}
|
|
22
|
-
<PowerSelectMultiple
|
|
23
|
-
id='codelist-select'
|
|
24
|
-
@allowClear={{false}}
|
|
25
|
-
@searchEnabled={{true}}
|
|
26
|
-
@searchField='label'
|
|
27
|
-
@options={{this.codelistOptions.value.options}}
|
|
28
|
-
@selected={{this.selectedCodelistOption}}
|
|
29
|
-
@onChange={{this.updateCodelistOption}}
|
|
30
|
-
as |option|
|
|
31
|
-
>
|
|
32
|
-
{{option.label}}
|
|
33
|
-
</PowerSelectMultiple>
|
|
34
|
-
{{else}}
|
|
35
|
-
<PowerSelect
|
|
36
|
-
id='codelist-select'
|
|
37
|
-
@allowClear={{false}}
|
|
38
|
-
@searchEnabled={{true}}
|
|
39
|
-
@searchField='label'
|
|
40
|
-
@options={{this.codelistOptions.value.options}}
|
|
41
|
-
@selected={{this.selectedCodelistOption}}
|
|
42
|
-
@onChange={{this.updateCodelistOption}}
|
|
43
|
-
as |option|
|
|
44
|
-
>
|
|
45
|
-
{{option.label}}
|
|
46
|
-
</PowerSelect>
|
|
47
|
-
{{/if}}
|
|
48
|
-
<AuButton
|
|
49
|
-
{{on 'click' this.insert}}
|
|
50
|
-
@disabled={{not this.selectedCodelistOption}}
|
|
51
|
-
>
|
|
52
|
-
{{t 'editor-plugins.utils.insert'}}
|
|
53
|
-
</AuButton>
|
|
54
|
-
</c.content>
|
|
55
|
-
</AuCard>
|
|
56
|
-
{{/if}}
|