@lblod/ember-rdfa-editor-lblod-plugins 32.6.1 → 32.6.2-dev.2b79e744693974a7028fb653bcb3f5c426cb767f
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/old-squids-flash.md +5 -0
- package/CHANGELOG.md +8 -0
- package/addon/components/roadsign-regulation-plugin/expanded-measure.gts +9 -15
- package/addon/components/roadsign-regulation-plugin/roadsigns-modal.gts +2 -3
- package/addon/components/variable-plugin/variable/nodeview.ts +8 -2
- package/addon/plugins/roadsign-regulation-plugin/actions/insert-measure.ts +15 -4
- package/addon/plugins/roadsign-regulation-plugin/constants.ts +6 -0
- package/addon/plugins/variable-plugin/variables/codelist.ts +8 -5
- package/addon/plugins/variable-plugin/variables/location.ts +4 -2
- package/declarations/addon/components/roadsign-regulation-plugin/expanded-measure.d.ts +4 -4
- package/declarations/addon/components/roadsign-regulation-plugin/roadsigns-modal.d.ts +2 -2
- package/declarations/addon/components/variable-plugin/variable/nodeview.d.ts +1 -1
- package/declarations/addon/plugins/roadsign-regulation-plugin/actions/insert-measure.d.ts +2 -2
- package/declarations/addon/plugins/roadsign-regulation-plugin/constants.d.ts +3 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @lblod/ember-rdfa-editor-lblod-plugins
|
|
2
2
|
|
|
3
|
+
## 32.6.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#598](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/598) [`4534978`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/4534978967ada361779096652ad8570d592320c1) Thanks [@piemonkey](https://github.com/piemonkey)! - Do not auto-focus variables unless they only contain a placeholder
|
|
8
|
+
|
|
9
|
+
- [#602](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/602) [`9037dd0`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/9037dd03b02c299e7fe56134fa592af3a3e19af0) Thanks [@elpoelma](https://github.com/elpoelma)! - Add default fallback values for `source` and `codelist` attributes of `location` and `codelist` variables. This ensures that older documents may be parsed without/with less issues/errors
|
|
10
|
+
|
|
3
11
|
## 32.6.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -10,17 +10,16 @@ import AuButton from '@appuniversum/ember-appuniversum/components/au-button';
|
|
|
10
10
|
import { MobilityMeasureConcept } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/roadsign-regulation-plugin/schemas/mobility-measure-concept';
|
|
11
11
|
import { action } from '@ember/object';
|
|
12
12
|
import { on } from '@ember/modifier';
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
ZONALITY_OPTIONS,
|
|
15
|
+
ZonalOrNot,
|
|
16
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/roadsign-regulation-plugin/constants';
|
|
14
17
|
import { Task } from 'ember-concurrency';
|
|
15
18
|
import { isSome } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
|
|
16
19
|
|
|
17
20
|
export type InsertMobilityMeasureTask = Task<
|
|
18
21
|
void,
|
|
19
|
-
[
|
|
20
|
-
MobilityMeasureConcept,
|
|
21
|
-
typeof ZONALITY_OPTIONS.ZONAL | typeof ZONALITY_OPTIONS.NON_ZONAL,
|
|
22
|
-
boolean,
|
|
23
|
-
]
|
|
22
|
+
[MobilityMeasureConcept, ZonalOrNot, boolean]
|
|
24
23
|
>;
|
|
25
24
|
type Signature = {
|
|
26
25
|
Args: {
|
|
@@ -32,9 +31,7 @@ type Signature = {
|
|
|
32
31
|
};
|
|
33
32
|
|
|
34
33
|
export default class ExpandedMeasure extends Component<Signature> {
|
|
35
|
-
@tracked zonalityValue?:
|
|
36
|
-
| typeof ZONALITY_OPTIONS.ZONAL
|
|
37
|
-
| typeof ZONALITY_OPTIONS.NON_ZONAL;
|
|
34
|
+
@tracked zonalityValue?: ZonalOrNot;
|
|
38
35
|
@tracked temporalValue?: boolean;
|
|
39
36
|
|
|
40
37
|
get isPotentiallyZonal() {
|
|
@@ -49,9 +46,7 @@ export default class ExpandedMeasure extends Component<Signature> {
|
|
|
49
46
|
}
|
|
50
47
|
|
|
51
48
|
@action
|
|
52
|
-
changeZonality(
|
|
53
|
-
zonality: typeof ZONALITY_OPTIONS.ZONAL | typeof ZONALITY_OPTIONS.NON_ZONAL,
|
|
54
|
-
) {
|
|
49
|
+
changeZonality(zonality: ZonalOrNot) {
|
|
55
50
|
this.zonalityValue = zonality;
|
|
56
51
|
}
|
|
57
52
|
|
|
@@ -64,9 +59,8 @@ export default class ExpandedMeasure extends Component<Signature> {
|
|
|
64
59
|
insert() {
|
|
65
60
|
this.args.insert.perform(
|
|
66
61
|
this.args.concept,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
| typeof ZONALITY_OPTIONS.NON_ZONAL,
|
|
62
|
+
// POTENTIALLY_ZONAL option is filtered out by requiring a zonalityValue to submit
|
|
63
|
+
(this.zonalityValue ?? this.args.concept.zonality) as ZonalOrNot,
|
|
70
64
|
this.temporalValue ?? false,
|
|
71
65
|
);
|
|
72
66
|
}
|
|
@@ -32,6 +32,7 @@ import { on } from '@ember/modifier';
|
|
|
32
32
|
import {
|
|
33
33
|
TRAFFIC_SIGNAL_CONCEPT_TYPES,
|
|
34
34
|
ZONALITY_OPTIONS,
|
|
35
|
+
type ZonalOrNot,
|
|
35
36
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/roadsign-regulation-plugin/constants';
|
|
36
37
|
import { resolveTemplate } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/roadsign-regulation-plugin/actions/resolve-template';
|
|
37
38
|
import { queryMobilityTemplates } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/roadsign-regulation-plugin/queries/mobility-template';
|
|
@@ -309,9 +310,7 @@ export default class RoadsignsModal extends Component<Signature> {
|
|
|
309
310
|
insertMeasure = task(
|
|
310
311
|
async (
|
|
311
312
|
concept: MobilityMeasureConcept,
|
|
312
|
-
zonality:
|
|
313
|
-
| typeof ZONALITY_OPTIONS.ZONAL
|
|
314
|
-
| typeof ZONALITY_OPTIONS.NON_ZONAL,
|
|
313
|
+
zonality: ZonalOrNot,
|
|
315
314
|
temporal: boolean,
|
|
316
315
|
) => {
|
|
317
316
|
if (!this.decisionLocation) {
|
|
@@ -16,7 +16,7 @@ export default class VariableNodeViewComponent extends Component<EmberNodeArgs>
|
|
|
16
16
|
return [editableNodePlugin(this.args.getPos)];
|
|
17
17
|
}
|
|
18
18
|
@action
|
|
19
|
-
onClick() {
|
|
19
|
+
onClick(event: Event) {
|
|
20
20
|
if (this.innerView) {
|
|
21
21
|
if (this.innerView.state.doc.firstChild?.type.name === 'placeholder') {
|
|
22
22
|
this.innerView.focus();
|
|
@@ -28,7 +28,13 @@ export default class VariableNodeViewComponent extends Component<EmberNodeArgs>
|
|
|
28
28
|
this.innerView?.dispatch(tr);
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
} else
|
|
31
|
+
} else if (
|
|
32
|
+
event.target instanceof Element &&
|
|
33
|
+
event.target.classList.contains('say-pill')
|
|
34
|
+
) {
|
|
35
|
+
// When clicking between the nested prosemirror and the border of the pill, we need to
|
|
36
|
+
// focus the inner view to avoid weird issues with the selection jumping after starting to
|
|
37
|
+
// type
|
|
32
38
|
this.innerView.focus();
|
|
33
39
|
}
|
|
34
40
|
}
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
TRAFFIC_SIGNAL_TYPE_MAPPING,
|
|
31
31
|
TRAFFIC_SIGNAL_TYPES,
|
|
32
32
|
ZONALITY_OPTIONS,
|
|
33
|
+
ZonalOrNot,
|
|
33
34
|
} from '../constants';
|
|
34
35
|
import { createTextVariable } from '../../variable-plugin/actions/create-text-variable';
|
|
35
36
|
import { generateVariableInstanceUri } from '../../variable-plugin/utils/variable-helpers';
|
|
@@ -40,7 +41,7 @@ import { createClassicLocationVariable } from '../../variable-plugin/actions/cre
|
|
|
40
41
|
|
|
41
42
|
interface InsertMeasureArgs {
|
|
42
43
|
measureConcept: MobilityMeasureConcept;
|
|
43
|
-
zonality:
|
|
44
|
+
zonality: ZonalOrNot;
|
|
44
45
|
temporal: boolean;
|
|
45
46
|
variables: Record<string, Exclude<Variable, { type: 'instruction' }>>;
|
|
46
47
|
templateString: string;
|
|
@@ -60,7 +61,7 @@ export default function insertMeasure({
|
|
|
60
61
|
return function (state: EditorState) {
|
|
61
62
|
const { schema } = state;
|
|
62
63
|
const signNodes = measureConcept.trafficSignalConcepts.map((signConcept) =>
|
|
63
|
-
constructSignNode(signConcept, schema),
|
|
64
|
+
constructSignNode(signConcept, schema, zonality),
|
|
64
65
|
);
|
|
65
66
|
let signSection: PNode[] = [];
|
|
66
67
|
if (signNodes.length) {
|
|
@@ -210,9 +211,19 @@ function determineSignLabel(signConcept: TrafficSignalConcept) {
|
|
|
210
211
|
}
|
|
211
212
|
}
|
|
212
213
|
|
|
213
|
-
function constructSignNode(
|
|
214
|
+
function constructSignNode(
|
|
215
|
+
signConcept: TrafficSignalConcept,
|
|
216
|
+
schema: Schema,
|
|
217
|
+
zonality?: ZonalOrNot,
|
|
218
|
+
) {
|
|
214
219
|
const signUri = `http://data.lblod.info/verkeerstekens/${uuid()}`;
|
|
215
220
|
const prefix = determineSignLabel(signConcept);
|
|
221
|
+
const zonalityText =
|
|
222
|
+
!zonality || zonality !== ZONALITY_OPTIONS.ZONAL
|
|
223
|
+
? ''
|
|
224
|
+
: prefix === 'Onderbord'
|
|
225
|
+
? ' op het verkeersbord met zonale geldigheid'
|
|
226
|
+
: ' met zonale geldigheid';
|
|
216
227
|
const node = schema.nodes.inline_rdfa.create(
|
|
217
228
|
{
|
|
218
229
|
rdfaNodeType: 'resource',
|
|
@@ -235,7 +246,7 @@ function constructSignNode(signConcept: TrafficSignalConcept, schema: Schema) {
|
|
|
235
246
|
},
|
|
236
247
|
],
|
|
237
248
|
},
|
|
238
|
-
schema.text(`${prefix} ${signConcept.code}`),
|
|
249
|
+
schema.text(`${prefix} ${signConcept.code}${zonalityText}`),
|
|
239
250
|
);
|
|
240
251
|
return node;
|
|
241
252
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MOBILITEIT } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
2
|
+
import { ValuesOf } from '@lblod/ember-rdfa-editor/utils/_private/types';
|
|
2
3
|
|
|
3
4
|
export const ZONALITY_OPTIONS = {
|
|
4
5
|
POTENTIALLY_ZONAL:
|
|
@@ -7,6 +8,11 @@ export const ZONALITY_OPTIONS = {
|
|
|
7
8
|
NON_ZONAL:
|
|
8
9
|
'http://lblod.data.gift/concepts/b651931b-923c-477c-8da9-fc7dd841fdcc',
|
|
9
10
|
} as const;
|
|
11
|
+
export type ZonalityOption = ValuesOf<typeof ZONALITY_OPTIONS>;
|
|
12
|
+
export type ZonalOrNot = Exclude<
|
|
13
|
+
ZonalityOption,
|
|
14
|
+
typeof ZONALITY_OPTIONS.POTENTIALLY_ZONAL
|
|
15
|
+
>;
|
|
10
16
|
|
|
11
17
|
export const TRAFFIC_SIGNAL_CONCEPT_TYPES = {
|
|
12
18
|
TRAFFIC_SIGNAL: MOBILITEIT('Verkeerstekenconcept').full,
|
|
@@ -106,8 +106,8 @@ const parseDOMLegacy = [
|
|
|
106
106
|
label,
|
|
107
107
|
// These attrs are required but it's possible for older documents to get into a broken
|
|
108
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
|
|
110
|
-
codelist: codelistUri
|
|
109
|
+
source: sourceUri,
|
|
110
|
+
codelist: codelistUri,
|
|
111
111
|
selectionStyle,
|
|
112
112
|
});
|
|
113
113
|
}
|
|
@@ -138,7 +138,6 @@ const parseDOMLegacy = [
|
|
|
138
138
|
const sourceUri = getOutgoingTriple(attrs, DCT('source'))?.object.value;
|
|
139
139
|
const selectionStyle = node.dataset.selectionStyle;
|
|
140
140
|
const label = getOutgoingTriple(attrs, EXT('label'))?.object.value;
|
|
141
|
-
|
|
142
141
|
return createCodelistVariableAttrs({
|
|
143
142
|
variable: variableUri,
|
|
144
143
|
variableInstance: variableInstanceUri,
|
|
@@ -237,8 +236,12 @@ const emberNodeConfig: EmberNodeConfig = {
|
|
|
237
236
|
label: {
|
|
238
237
|
default: null,
|
|
239
238
|
},
|
|
240
|
-
codelist: {
|
|
241
|
-
|
|
239
|
+
codelist: {
|
|
240
|
+
default: 'UNKNOWN',
|
|
241
|
+
},
|
|
242
|
+
source: {
|
|
243
|
+
default: 'UNKNOWN',
|
|
244
|
+
},
|
|
242
245
|
selectionStyle: {
|
|
243
246
|
default: null,
|
|
244
247
|
},
|
|
@@ -99,7 +99,7 @@ const parseDOMLegacy = [
|
|
|
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
|
+
source: sourceUri,
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
return false;
|
|
@@ -176,7 +176,9 @@ const emberNodeConfig: EmberNodeConfig = {
|
|
|
176
176
|
label: {
|
|
177
177
|
default: null,
|
|
178
178
|
},
|
|
179
|
-
source: {
|
|
179
|
+
source: {
|
|
180
|
+
default: '',
|
|
181
|
+
},
|
|
180
182
|
datatype: {
|
|
181
183
|
default: XSD('string').namedNode,
|
|
182
184
|
},
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { MobilityMeasureConcept } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/roadsign-regulation-plugin/schemas/mobility-measure-concept';
|
|
3
|
-
import {
|
|
3
|
+
import { ZonalOrNot } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/roadsign-regulation-plugin/constants';
|
|
4
4
|
import { Task } from 'ember-concurrency';
|
|
5
5
|
export type InsertMobilityMeasureTask = Task<void, [
|
|
6
6
|
MobilityMeasureConcept,
|
|
7
|
-
|
|
7
|
+
ZonalOrNot,
|
|
8
8
|
boolean
|
|
9
9
|
]>;
|
|
10
10
|
type Signature = {
|
|
@@ -16,11 +16,11 @@ type Signature = {
|
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
18
|
export default class ExpandedMeasure extends Component<Signature> {
|
|
19
|
-
zonalityValue?:
|
|
19
|
+
zonalityValue?: ZonalOrNot;
|
|
20
20
|
temporalValue?: boolean;
|
|
21
21
|
get isPotentiallyZonal(): boolean;
|
|
22
22
|
get insertButtonDisabled(): boolean;
|
|
23
|
-
changeZonality(zonality:
|
|
23
|
+
changeZonality(zonality: ZonalOrNot): void;
|
|
24
24
|
changeTemporality(temporality: 'true' | 'false'): void;
|
|
25
25
|
insert(): void;
|
|
26
26
|
unselectRow(): void;
|
|
@@ -4,7 +4,7 @@ import { RoadsignRegulationPluginOptions } from '@lblod/ember-rdfa-editor-lblod-
|
|
|
4
4
|
import { MobilityMeasureConcept } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/roadsign-regulation-plugin/schemas/mobility-measure-concept';
|
|
5
5
|
import { Select } from 'ember-power-select/components/power-select';
|
|
6
6
|
import { TaskInstance } from 'reactiveweb/ember-concurrency';
|
|
7
|
-
import {
|
|
7
|
+
import { type ZonalOrNot } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/roadsign-regulation-plugin/constants';
|
|
8
8
|
type Option = {
|
|
9
9
|
uri: string;
|
|
10
10
|
label: string;
|
|
@@ -131,7 +131,7 @@ export default class RoadsignsModal extends Component<Signature> {
|
|
|
131
131
|
}))[];
|
|
132
132
|
}[] | undefined;
|
|
133
133
|
get measureConceptCount(): number | undefined;
|
|
134
|
-
insertMeasure: import("ember-concurrency").TaskForAsyncTaskFunction<unknown, (concept: MobilityMeasureConcept, zonality:
|
|
134
|
+
insertMeasure: import("ember-concurrency").TaskForAsyncTaskFunction<unknown, (concept: MobilityMeasureConcept, zonality: ZonalOrNot, temporal: boolean) => Promise<void>>;
|
|
135
135
|
resetPagination(): void;
|
|
136
136
|
goToPreviousPage(): void;
|
|
137
137
|
goToNextPage(): void;
|
|
@@ -4,7 +4,7 @@ import { EmberNodeArgs } from '@lblod/ember-rdfa-editor/utils/ember-node';
|
|
|
4
4
|
export default class VariableNodeViewComponent extends Component<EmberNodeArgs> {
|
|
5
5
|
innerView?: SayView;
|
|
6
6
|
get plugins(): ProsePlugin[];
|
|
7
|
-
onClick(): void;
|
|
7
|
+
onClick(event: Event): void;
|
|
8
8
|
initEditor(view: SayView): void;
|
|
9
9
|
resetVariable(): void;
|
|
10
10
|
get label(): any;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { TransactionMonad } from '@lblod/ember-rdfa-editor/utils/transaction-utils';
|
|
2
2
|
import { MobilityMeasureConcept } from '../schemas/mobility-measure-concept';
|
|
3
3
|
import { Variable } from '../schemas/variable';
|
|
4
|
-
import {
|
|
4
|
+
import { ZonalOrNot } from '../constants';
|
|
5
5
|
interface InsertMeasureArgs {
|
|
6
6
|
measureConcept: MobilityMeasureConcept;
|
|
7
|
-
zonality:
|
|
7
|
+
zonality: ZonalOrNot;
|
|
8
8
|
temporal: boolean;
|
|
9
9
|
variables: Record<string, Exclude<Variable, {
|
|
10
10
|
type: 'instruction';
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { ValuesOf } from '@lblod/ember-rdfa-editor/utils/_private/types';
|
|
1
2
|
export declare const ZONALITY_OPTIONS: {
|
|
2
3
|
readonly POTENTIALLY_ZONAL: "http://lblod.data.gift/concepts/8f9367b2-c717-4be7-8833-4c75bbb4ae1f";
|
|
3
4
|
readonly ZONAL: "http://lblod.data.gift/concepts/c81c6b96-736a-48cf-b003-6f5cc3dbc55d";
|
|
4
5
|
readonly NON_ZONAL: "http://lblod.data.gift/concepts/b651931b-923c-477c-8da9-fc7dd841fdcc";
|
|
5
6
|
};
|
|
7
|
+
export type ZonalityOption = ValuesOf<typeof ZONALITY_OPTIONS>;
|
|
8
|
+
export type ZonalOrNot = Exclude<ZonalityOption, typeof ZONALITY_OPTIONS.POTENTIALLY_ZONAL>;
|
|
6
9
|
export declare const TRAFFIC_SIGNAL_CONCEPT_TYPES: {
|
|
7
10
|
readonly TRAFFIC_SIGNAL: "https://data.vlaanderen.be/ns/mobiliteit#Verkeerstekenconcept";
|
|
8
11
|
readonly ROAD_SIGN: "https://data.vlaanderen.be/ns/mobiliteit#Verkeersbordconcept";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lblod/ember-rdfa-editor-lblod-plugins",
|
|
3
|
-
"version": "32.6.
|
|
3
|
+
"version": "32.6.2-dev.2b79e744693974a7028fb653bcb3f5c426cb767f",
|
|
4
4
|
"description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|