@lblod/ember-rdfa-editor-lblod-plugins 35.1.2 → 35.2.0-dev.1af0eb76be419961a72f420e5268117782ddecc0
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/wet-buckets-shout.md +5 -0
- package/CHANGELOG.md +12 -0
- package/addon/components/besluit-topic-plugin/besluit-topic-select.ts +2 -0
- package/addon/components/location-plugin/insert-location-placeholder.gts +6 -6
- package/addon/components/location-plugin/insert.gts +28 -8
- package/addon/components/location-plugin/map.gts +7 -6
- package/addon/components/variable-plugin/marcode/insert.gts +1 -0
- package/addon/plugins/location-plugin/_private/utils/node-utils.ts +52 -15
- package/addon/plugins/location-plugin/node.ts +1 -0
- package/addon/plugins/location-plugin/utils/node-utils.ts +3 -3
- package/addon/plugins/variable-plugin/actions/create-codelist-variable.ts +7 -0
- package/addon/plugins/variable-plugin/utils/codelist-utils.ts +4 -0
- package/addon/plugins/variable-plugin/variables/codelist.ts +37 -27
- package/declarations/addon/components/besluit-topic-plugin/besluit-topic-select.d.ts +2 -0
- package/declarations/addon/components/location-plugin/map.d.ts +1 -1
- package/declarations/addon/plugins/location-plugin/_private/utils/node-utils.d.ts +22 -6
- package/declarations/addon/plugins/location-plugin/node.d.ts +1 -0
- package/declarations/addon/plugins/variable-plugin/actions/create-codelist-variable.d.ts +3 -1
- package/package.json +6 -5
- package/translations/en-US.yaml +1 -1
- package/translations/nl-BE.yaml +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @lblod/ember-rdfa-editor-lblod-plugins
|
|
2
2
|
|
|
3
|
+
## 35.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#640](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/640) [`3180369`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/31803691c6e577dfed2d6e0f91962a5180906101) Thanks [@abeforgit](https://github.com/abeforgit)! - Add option to explicitly configure subject to link locations to
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#639](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/639) [`0946fdb`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/0946fdb3561050ed2b4f197305b0556007fe32d3) Thanks [@lagartoverde](https://github.com/lagartoverde)! - Fix typing in besluit topic select
|
|
12
|
+
|
|
13
|
+
- [#638](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/638) [`32f2217`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/32f22174393411561665f3266db62eb463bfc4ea) Thanks [@piemonkey](https://github.com/piemonkey)! - Invert oslo-location toggle to be 'GRB' in place of 'Open Streetmap'
|
|
14
|
+
|
|
3
15
|
## 35.1.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -6,6 +6,8 @@ import { BesluitTopic } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/bes
|
|
|
6
6
|
|
|
7
7
|
type Args = {
|
|
8
8
|
besluitTopics: BesluitTopic[];
|
|
9
|
+
selected?: BesluitTopic[];
|
|
10
|
+
onchange: (topic: BesluitTopic[]) => void;
|
|
9
11
|
};
|
|
10
12
|
|
|
11
13
|
export default class BesluitTopicSelectComponent extends Component<Args> {
|
|
@@ -52,12 +52,12 @@ export default class LocationPluginInsertComponent extends Component<Signature>
|
|
|
52
52
|
const uri = `http://data.lblod.info/variables/${
|
|
53
53
|
this.args.templateMode ? '--ref-uuid4-' : ''
|
|
54
54
|
}${uuidv4()}`;
|
|
55
|
-
replaceSelectionWithLocation(
|
|
56
|
-
this.controller,
|
|
57
|
-
uri,
|
|
58
|
-
|
|
59
|
-
this.args.config.
|
|
60
|
-
);
|
|
55
|
+
replaceSelectionWithLocation({
|
|
56
|
+
controller: this.controller,
|
|
57
|
+
subject: uri,
|
|
58
|
+
subjectTypes: this.args.config.subjectTypesToLinkTo,
|
|
59
|
+
explicitSubjectToLinkTo: this.args.config.explicitSubjectToLinkTo,
|
|
60
|
+
});
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
<template>
|
|
@@ -35,6 +35,9 @@ import { transactionCombinator } from '@lblod/ember-rdfa-editor/utils/transactio
|
|
|
35
35
|
import { updateSubject } from '@lblod/ember-rdfa-editor/plugins/rdfa-info/utils';
|
|
36
36
|
import { replaceSelectionWithLocation } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location-plugin/_private/utils/node-utils';
|
|
37
37
|
import type { Option } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
|
|
38
|
+
import type { FullTriple } from '@lblod/ember-rdfa-editor/core/rdfa-processor';
|
|
39
|
+
import { PROV } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
40
|
+
import { SayDataFactory } from '@lblod/ember-rdfa-editor/core/say-data-factory';
|
|
38
41
|
|
|
39
42
|
export type CurrentLocation = Address | GlobalCoordinates | undefined;
|
|
40
43
|
|
|
@@ -274,13 +277,29 @@ export default class LocationPluginInsertComponent extends Component<Signature>
|
|
|
274
277
|
if (toInsert) {
|
|
275
278
|
this.modalOpen = false;
|
|
276
279
|
if (this.selectedLocationNode) {
|
|
277
|
-
|
|
278
|
-
const { pos } = this.selectedLocationNode;
|
|
280
|
+
const df = new SayDataFactory();
|
|
281
|
+
const { pos, value: locNode } = this.selectedLocationNode;
|
|
282
|
+
// The location's subject has likely changed, so we should update the external links too
|
|
283
|
+
// if they exist
|
|
284
|
+
// NOTE: It's VERY important that this is done without mutating the triple objects
|
|
285
|
+
// otherwise the attributes will not update as expected when undo-ing
|
|
286
|
+
const newExternalTriples: FullTriple[] = (
|
|
287
|
+
locNode.attrs.externalTriples as FullTriple[]
|
|
288
|
+
).map((tr) => {
|
|
289
|
+
if (PROV('atLocation').matches(tr.predicate)) {
|
|
290
|
+
return { ...tr, object: df.namedNode(toInsert.uri) };
|
|
291
|
+
} else {
|
|
292
|
+
return tr;
|
|
293
|
+
}
|
|
294
|
+
}); // update the location value and the external triples
|
|
279
295
|
this.controller.withTransaction((tr) => {
|
|
280
296
|
return transactionCombinator(
|
|
281
297
|
this.controller.activeEditorState,
|
|
282
|
-
tr
|
|
298
|
+
tr
|
|
299
|
+
.setNodeAttribute(pos, 'value', toInsert)
|
|
300
|
+
.setNodeAttribute(pos, 'externalTriples', newExternalTriples),
|
|
283
301
|
)([
|
|
302
|
+
// Update the subject uri, while keeping backlinks intact
|
|
284
303
|
updateSubject({
|
|
285
304
|
pos,
|
|
286
305
|
targetSubject: toInsert.uri,
|
|
@@ -292,12 +311,13 @@ export default class LocationPluginInsertComponent extends Component<Signature>
|
|
|
292
311
|
});
|
|
293
312
|
} else {
|
|
294
313
|
// Insert
|
|
295
|
-
replaceSelectionWithLocation(
|
|
296
|
-
this.controller,
|
|
297
|
-
toInsert.uri,
|
|
314
|
+
replaceSelectionWithLocation({
|
|
315
|
+
controller: this.controller,
|
|
316
|
+
subject: toInsert.uri,
|
|
298
317
|
toInsert,
|
|
299
|
-
this.args.config.subjectTypesToLinkTo,
|
|
300
|
-
|
|
318
|
+
subjectTypes: this.args.config.subjectTypesToLinkTo,
|
|
319
|
+
explicitSubjectToLinkTo: this.args.config.explicitSubjectToLinkTo,
|
|
320
|
+
});
|
|
301
321
|
}
|
|
302
322
|
}
|
|
303
323
|
}
|
|
@@ -230,7 +230,7 @@ class MapWrapper extends Component<MapWrapperSig> {
|
|
|
230
230
|
|
|
231
231
|
export default class LocationPluginMapComponent extends Component<Signature> {
|
|
232
232
|
@tracked vertices: GlobalCoordinates[] = [];
|
|
233
|
-
@tracked
|
|
233
|
+
@tracked useGRB = true;
|
|
234
234
|
|
|
235
235
|
// Use untracked properties as otherwise the map jumps to any area or location we pick
|
|
236
236
|
existingAreaBounds = generateBoundsFromShape(this.args.existingArea);
|
|
@@ -275,7 +275,7 @@ export default class LocationPluginMapComponent extends Component<Signature> {
|
|
|
275
275
|
}
|
|
276
276
|
|
|
277
277
|
get tileProvider() {
|
|
278
|
-
if (this.
|
|
278
|
+
if (!this.useGRB) {
|
|
279
279
|
return TILE_PROVIDER_CONSTANTS.OPEN_STREET_MAP;
|
|
280
280
|
} else {
|
|
281
281
|
return TILE_PROVIDER_CONSTANTS.GRB;
|
|
@@ -331,10 +331,11 @@ export default class LocationPluginMapComponent extends Component<Signature> {
|
|
|
331
331
|
as |c|
|
|
332
332
|
>
|
|
333
333
|
<c.content>
|
|
334
|
-
<AuToggleSwitch
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
334
|
+
<AuToggleSwitch
|
|
335
|
+
@checked={{this.useGRB}}
|
|
336
|
+
@onChange={{set this 'useGRB'}}
|
|
337
|
+
>
|
|
338
|
+
<p class='au-u-para-tiny'>{{t 'location-plugin.use-grb'}}</p>
|
|
338
339
|
</AuToggleSwitch>
|
|
339
340
|
</c.content>
|
|
340
341
|
</AuCard>
|
|
@@ -50,6 +50,7 @@ export default class MarcodeInsertComponent extends Component<Sig> {
|
|
|
50
50
|
// list in code instead of in the doc?
|
|
51
51
|
hardcodedOptionList: hardcodedMarcodeList,
|
|
52
52
|
label,
|
|
53
|
+
hasNonLiteralContents: true,
|
|
53
54
|
});
|
|
54
55
|
this.controller.doCommand(replaceSelectionWithAndSelectNode(node), {
|
|
55
56
|
view: this.controller.mainEditorView,
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
SayController,
|
|
3
|
+
NodeSelection,
|
|
4
|
+
PNode,
|
|
5
|
+
RdfaAttrs,
|
|
6
|
+
} from '@lblod/ember-rdfa-editor';
|
|
7
|
+
import {
|
|
8
|
+
SayDataFactory,
|
|
9
|
+
sayDataFactory,
|
|
10
|
+
} from '@lblod/ember-rdfa-editor/core/say-data-factory';
|
|
3
11
|
import {
|
|
4
12
|
PROV,
|
|
5
13
|
RDF,
|
|
@@ -12,6 +20,29 @@ import {
|
|
|
12
20
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
|
|
13
21
|
import { Area, Place } from './geo-helpers';
|
|
14
22
|
import { Address } from './address-helpers';
|
|
23
|
+
import { FullTriple } from '@lblod/ember-rdfa-editor/core/rdfa-processor';
|
|
24
|
+
|
|
25
|
+
const df = new SayDataFactory();
|
|
26
|
+
interface ReplaceSelectionWithLocationArgs {
|
|
27
|
+
/** SayController */
|
|
28
|
+
controller: SayController;
|
|
29
|
+
/** The uri of the Location resource */
|
|
30
|
+
subject: string;
|
|
31
|
+
/** The object representing the location to insert */
|
|
32
|
+
toInsert?: Place | Address | Area;
|
|
33
|
+
/**
|
|
34
|
+
* A list of Resources, each will be looked at in turn to compare the
|
|
35
|
+
* `rdf:type` of the resource, if no parent is found matching the first, then the second will be
|
|
36
|
+
* used, etc.
|
|
37
|
+
*
|
|
38
|
+
* If found, the location will be linked to that resource using prov:atLocation
|
|
39
|
+
*/
|
|
40
|
+
subjectTypes?: Resource[];
|
|
41
|
+
/**
|
|
42
|
+
* If present, the location will be linked to this uri using prov:atLocation using external triples.
|
|
43
|
+
*/
|
|
44
|
+
explicitSubjectToLinkTo?: string;
|
|
45
|
+
}
|
|
15
46
|
|
|
16
47
|
/**
|
|
17
48
|
* Creates an 'OSLO location' node in place of the selection, along with the RDFa to create a triple
|
|
@@ -19,18 +50,14 @@ import { Address } from './address-helpers';
|
|
|
19
50
|
* prov:atLocation. This doesn't work well with the RDFa tools, but since refactoring is required to
|
|
20
51
|
* clean up the RDFa structure inherited from variables and to make it work well with 'undo', this
|
|
21
52
|
* work was put off until then.
|
|
22
|
-
* @param controller - SayController
|
|
23
|
-
* @param toInsert - The object representing the location to insert
|
|
24
|
-
* @param subjectTypes - A list of Resources, each will be looked at in turn to compare the
|
|
25
|
-
* `rdf:type` of the resource, if no parent is found matching the first, then the second will be
|
|
26
|
-
* used, etc.
|
|
27
53
|
*/
|
|
28
|
-
export function replaceSelectionWithLocation(
|
|
29
|
-
controller
|
|
30
|
-
subject
|
|
31
|
-
toInsert
|
|
32
|
-
subjectTypes
|
|
33
|
-
|
|
54
|
+
export function replaceSelectionWithLocation({
|
|
55
|
+
controller,
|
|
56
|
+
subject,
|
|
57
|
+
toInsert,
|
|
58
|
+
subjectTypes,
|
|
59
|
+
explicitSubjectToLinkTo,
|
|
60
|
+
}: ReplaceSelectionWithLocationArgs) {
|
|
34
61
|
let resourceToLink: { pos: number; node: PNode } | undefined;
|
|
35
62
|
subjectTypes?.forEach((subjectType) => {
|
|
36
63
|
if (!resourceToLink) {
|
|
@@ -59,7 +86,16 @@ export function replaceSelectionWithLocation(
|
|
|
59
86
|
),
|
|
60
87
|
},
|
|
61
88
|
];
|
|
62
|
-
|
|
89
|
+
let externalTriples: FullTriple[];
|
|
90
|
+
if (explicitSubjectToLinkTo) {
|
|
91
|
+
externalTriples = [
|
|
92
|
+
{
|
|
93
|
+
subject: df.namedNode(explicitSubjectToLinkTo),
|
|
94
|
+
predicate: PROV('atLocation').full,
|
|
95
|
+
object: df.namedNode(subject),
|
|
96
|
+
},
|
|
97
|
+
];
|
|
98
|
+
}
|
|
63
99
|
controller.withTransaction((tr) => {
|
|
64
100
|
tr.replaceSelectionWith(
|
|
65
101
|
controller.schema.node('oslo_location', {
|
|
@@ -69,7 +105,8 @@ export function replaceSelectionWithLocation(
|
|
|
69
105
|
value: toInsert,
|
|
70
106
|
properties: [],
|
|
71
107
|
backlinks,
|
|
72
|
-
|
|
108
|
+
externalTriples,
|
|
109
|
+
} satisfies RdfaAttrs & { value: Place | Address | Area | undefined }),
|
|
73
110
|
);
|
|
74
111
|
if (tr.selection.$anchor.nodeBefore) {
|
|
75
112
|
const resolvedPos = tr.doc.resolve(
|
|
@@ -21,10 +21,10 @@ export function replaceSelectionWithLocation(
|
|
|
21
21
|
toInsert: Place | Address | Area,
|
|
22
22
|
subjectTypes?: Resource[],
|
|
23
23
|
) {
|
|
24
|
-
return replaceSelectionWithLocationInternal(
|
|
24
|
+
return replaceSelectionWithLocationInternal({
|
|
25
25
|
controller,
|
|
26
|
-
toInsert.uri,
|
|
26
|
+
subject: toInsert.uri,
|
|
27
27
|
toInsert,
|
|
28
28
|
subjectTypes,
|
|
29
|
-
);
|
|
29
|
+
});
|
|
30
30
|
}
|
|
@@ -30,6 +30,7 @@ export function createCodelistVariable(args: CreateCodelistVariableArgs) {
|
|
|
30
30
|
subject: args.value,
|
|
31
31
|
variableInstance: args.variableInstance,
|
|
32
32
|
text: args.valueLabel,
|
|
33
|
+
pointsToNode: args.__rdfaId,
|
|
33
34
|
});
|
|
34
35
|
return schema.nodes.codelist.create(attrs, [codelistOption]);
|
|
35
36
|
}
|
|
@@ -42,6 +43,7 @@ type CreateCodelistVariableAttrsArgs = {
|
|
|
42
43
|
source: string;
|
|
43
44
|
codelist: string;
|
|
44
45
|
hardcodedOptionList?: CodeListOption[];
|
|
46
|
+
hasNonLiteralContents?: boolean;
|
|
45
47
|
} & AllOrNone<{
|
|
46
48
|
variable: string;
|
|
47
49
|
variableInstance: string;
|
|
@@ -57,6 +59,7 @@ export function createCodelistVariableAttrs({
|
|
|
57
59
|
variable,
|
|
58
60
|
variableInstance,
|
|
59
61
|
hardcodedOptionList,
|
|
62
|
+
hasNonLiteralContents,
|
|
60
63
|
}: CreateCodelistVariableAttrsArgs) {
|
|
61
64
|
const externalTriples: FullTriple[] = [];
|
|
62
65
|
if (variable) {
|
|
@@ -90,6 +93,7 @@ export function createCodelistVariableAttrs({
|
|
|
90
93
|
variable,
|
|
91
94
|
variableInstance,
|
|
92
95
|
hardcodedOptionList,
|
|
96
|
+
hasNonLiteralContents: !!hasNonLiteralContents,
|
|
93
97
|
} as CodelistAttrs;
|
|
94
98
|
}
|
|
95
99
|
|
|
@@ -109,12 +113,14 @@ type CreateCodelistOptionNodeAttrsArgs = {
|
|
|
109
113
|
text: string;
|
|
110
114
|
value?: string;
|
|
111
115
|
variableInstance?: string;
|
|
116
|
+
pointsToNode?: string;
|
|
112
117
|
};
|
|
113
118
|
|
|
114
119
|
function createCodelistOptionNodeAttrs({
|
|
115
120
|
subject,
|
|
116
121
|
text,
|
|
117
122
|
variableInstance,
|
|
123
|
+
pointsToNode,
|
|
118
124
|
}: CreateCodelistOptionNodeAttrsArgs) {
|
|
119
125
|
const backlinks: IncomingTriple[] = [];
|
|
120
126
|
if (variableInstance) {
|
|
@@ -135,5 +141,6 @@ function createCodelistOptionNodeAttrs({
|
|
|
135
141
|
subject,
|
|
136
142
|
properties,
|
|
137
143
|
backlinks,
|
|
144
|
+
pointsToNode,
|
|
138
145
|
};
|
|
139
146
|
}
|
|
@@ -35,12 +35,16 @@ export function updateCodelistVariable(
|
|
|
35
35
|
const variableInstance = selectedCodelist.node.attrs['variableInstance'] as
|
|
36
36
|
| string
|
|
37
37
|
| undefined;
|
|
38
|
+
const pointerTarget = selectedCodelist.node.attrs['__rdfaId'] as
|
|
39
|
+
| string
|
|
40
|
+
| undefined;
|
|
38
41
|
const codelistOptionNodes = selectedOptions.map((option) =>
|
|
39
42
|
createCodelistOptionNode({
|
|
40
43
|
schema: controller.schema,
|
|
41
44
|
text: option.label,
|
|
42
45
|
subject: option.uri,
|
|
43
46
|
variableInstance,
|
|
47
|
+
pointsToNode: pointerTarget,
|
|
44
48
|
}),
|
|
45
49
|
);
|
|
46
50
|
const range = {
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
} from '@lblod/ember-rdfa-editor/utils/ember-node';
|
|
6
6
|
import {
|
|
7
7
|
DOMOutputSpec,
|
|
8
|
+
EditorState,
|
|
8
9
|
Fragment,
|
|
9
10
|
PNode,
|
|
10
11
|
Schema,
|
|
@@ -102,7 +103,7 @@ const parseDOM: TagParseRule[] = [
|
|
|
102
103
|
},
|
|
103
104
|
];
|
|
104
105
|
|
|
105
|
-
const toDOM = (node: PNode): DOMOutputSpec => {
|
|
106
|
+
const toDOM = (node: PNode, state?: EditorState): DOMOutputSpec => {
|
|
106
107
|
const {
|
|
107
108
|
label = 'codelist',
|
|
108
109
|
codelist,
|
|
@@ -119,30 +120,36 @@ const toDOM = (node: PNode): DOMOutputSpec => {
|
|
|
119
120
|
for (let i = 0; i < codelist_option_nodes.length; i++) {
|
|
120
121
|
const codelist_option_node = codelist_option_nodes[i];
|
|
121
122
|
contentArray.push(
|
|
122
|
-
unwrap(codelist_option_node.type.spec.toDOM)(
|
|
123
|
+
unwrap((codelist_option_node.type.spec as SayNodeSpec).toDOM)(
|
|
124
|
+
codelist_option_node,
|
|
125
|
+
state,
|
|
126
|
+
),
|
|
123
127
|
);
|
|
124
128
|
if (i !== codelist_option_nodes.length - 1) {
|
|
125
129
|
contentArray.push(', ');
|
|
126
130
|
}
|
|
127
131
|
}
|
|
128
|
-
return renderRdfaAware(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
132
|
+
return renderRdfaAware(
|
|
133
|
+
{
|
|
134
|
+
renderable: node,
|
|
135
|
+
tag: 'span',
|
|
136
|
+
attrs: {
|
|
137
|
+
class: `${getClassnamesFromNode(node)}${className}`,
|
|
138
|
+
'data-say-variable': 'true',
|
|
139
|
+
'data-say-variable-type': 'codelist',
|
|
140
|
+
'data-say-node-version': '2',
|
|
141
|
+
'data-label': label as string | null,
|
|
142
|
+
'data-codelist': codelist as string,
|
|
143
|
+
'data-source': source as string,
|
|
144
|
+
'data-selection-style': selectionStyle as string,
|
|
145
|
+
'data-variable': variable as string,
|
|
146
|
+
'data-variable-instance': variableInstance as string,
|
|
147
|
+
'data-option-list': JSON.stringify(hardcodedOptionList),
|
|
148
|
+
},
|
|
149
|
+
contentArray: contentArray.length ? contentArray : [label],
|
|
143
150
|
},
|
|
144
|
-
|
|
145
|
-
|
|
151
|
+
state,
|
|
152
|
+
);
|
|
146
153
|
};
|
|
147
154
|
|
|
148
155
|
const emberNodeConfig: EmberNodeConfig = {
|
|
@@ -195,14 +202,17 @@ export const codelist_option: SayNodeSpec = {
|
|
|
195
202
|
attrs: {
|
|
196
203
|
...rdfaAttrSpec({ rdfaAware }),
|
|
197
204
|
},
|
|
198
|
-
toDOM: (node) => {
|
|
199
|
-
return renderRdfaAware(
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
205
|
+
toDOM: (node, state) => {
|
|
206
|
+
return renderRdfaAware(
|
|
207
|
+
{
|
|
208
|
+
renderable: node,
|
|
209
|
+
attrs: {
|
|
210
|
+
'data-say-type': 'codelist_option',
|
|
211
|
+
},
|
|
212
|
+
tag: 'span',
|
|
213
|
+
content: node.textContent,
|
|
203
214
|
},
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
});
|
|
215
|
+
state,
|
|
216
|
+
);
|
|
207
217
|
},
|
|
208
218
|
};
|
|
@@ -2,6 +2,8 @@ import Component from '@glimmer/component';
|
|
|
2
2
|
import { BesluitTopic } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/besluit-topic-plugin/utils/fetchBesluitTopics';
|
|
3
3
|
type Args = {
|
|
4
4
|
besluitTopics: BesluitTopic[];
|
|
5
|
+
selected?: BesluitTopic[];
|
|
6
|
+
onchange: (topic: BesluitTopic[]) => void;
|
|
5
7
|
};
|
|
6
8
|
export default class BesluitTopicSelectComponent extends Component<Args> {
|
|
7
9
|
AlertTriangleIcon: import("@ember/component/template-only").TOC<import("@appuniversum/ember-appuniversum/components/icons/alert-triangle").AlertTriangleIconSignature>;
|
|
@@ -20,7 +20,7 @@ interface Signature {
|
|
|
20
20
|
}
|
|
21
21
|
export default class LocationPluginMapComponent extends Component<Signature> {
|
|
22
22
|
vertices: GlobalCoordinates[];
|
|
23
|
-
|
|
23
|
+
useGRB: boolean;
|
|
24
24
|
existingAreaBounds: LatLngBoundsExpression | undefined;
|
|
25
25
|
existingLocationCoords: GlobalCoordinates | undefined;
|
|
26
26
|
mapLocation: LeafletMapStart;
|
|
@@ -2,16 +2,32 @@ import { SayController } from '@lblod/ember-rdfa-editor';
|
|
|
2
2
|
import { Resource } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
|
|
3
3
|
import { Area, Place } from './geo-helpers';
|
|
4
4
|
import { Address } from './address-helpers';
|
|
5
|
+
interface ReplaceSelectionWithLocationArgs {
|
|
6
|
+
/** SayController */
|
|
7
|
+
controller: SayController;
|
|
8
|
+
/** The uri of the Location resource */
|
|
9
|
+
subject: string;
|
|
10
|
+
/** The object representing the location to insert */
|
|
11
|
+
toInsert?: Place | Address | Area;
|
|
12
|
+
/**
|
|
13
|
+
* A list of Resources, each will be looked at in turn to compare the
|
|
14
|
+
* `rdf:type` of the resource, if no parent is found matching the first, then the second will be
|
|
15
|
+
* used, etc.
|
|
16
|
+
*
|
|
17
|
+
* If found, the location will be linked to that resource using prov:atLocation
|
|
18
|
+
*/
|
|
19
|
+
subjectTypes?: Resource[];
|
|
20
|
+
/**
|
|
21
|
+
* If present, the location will be linked to this uri using prov:atLocation using external triples.
|
|
22
|
+
*/
|
|
23
|
+
explicitSubjectToLinkTo?: string;
|
|
24
|
+
}
|
|
5
25
|
/**
|
|
6
26
|
* Creates an 'OSLO location' node in place of the selection, along with the RDFa to create a triple
|
|
7
27
|
* with the nearest parent of one of the passed types as the subject and the predicate
|
|
8
28
|
* prov:atLocation. This doesn't work well with the RDFa tools, but since refactoring is required to
|
|
9
29
|
* clean up the RDFa structure inherited from variables and to make it work well with 'undo', this
|
|
10
30
|
* work was put off until then.
|
|
11
|
-
* @param controller - SayController
|
|
12
|
-
* @param toInsert - The object representing the location to insert
|
|
13
|
-
* @param subjectTypes - A list of Resources, each will be looked at in turn to compare the
|
|
14
|
-
* `rdf:type` of the resource, if no parent is found matching the first, then the second will be
|
|
15
|
-
* used, etc.
|
|
16
31
|
*/
|
|
17
|
-
export declare function replaceSelectionWithLocation(controller
|
|
32
|
+
export declare function replaceSelectionWithLocation({ controller, subject, toInsert, subjectTypes, explicitSubjectToLinkTo, }: ReplaceSelectionWithLocationArgs): void;
|
|
33
|
+
export {};
|
|
@@ -5,6 +5,7 @@ export interface LocationPluginConfig {
|
|
|
5
5
|
defaultPlaceUriRoot: string;
|
|
6
6
|
defaultPointUriRoot: string;
|
|
7
7
|
subjectTypesToLinkTo?: Resource[];
|
|
8
|
+
explicitSubjectToLinkTo?: string;
|
|
8
9
|
additionalRDFTypes?: NamedNode[];
|
|
9
10
|
}
|
|
10
11
|
export declare const osloLocation: (config: LocationPluginConfig) => import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
|
|
@@ -14,12 +14,13 @@ type CreateCodelistVariableAttrsArgs = {
|
|
|
14
14
|
source: string;
|
|
15
15
|
codelist: string;
|
|
16
16
|
hardcodedOptionList?: CodeListOption[];
|
|
17
|
+
hasNonLiteralContents?: boolean;
|
|
17
18
|
} & AllOrNone<{
|
|
18
19
|
variable: string;
|
|
19
20
|
variableInstance: string;
|
|
20
21
|
__rdfaId?: string;
|
|
21
22
|
}>;
|
|
22
|
-
export declare function createCodelistVariableAttrs({ selectionStyle, label, source, codelist, __rdfaId, variable, variableInstance, hardcodedOptionList, }: CreateCodelistVariableAttrsArgs): CodelistAttrs;
|
|
23
|
+
export declare function createCodelistVariableAttrs({ selectionStyle, label, source, codelist, __rdfaId, variable, variableInstance, hardcodedOptionList, hasNonLiteralContents, }: CreateCodelistVariableAttrsArgs): CodelistAttrs;
|
|
23
24
|
type CreateCodelistOptionNodeArgs = {
|
|
24
25
|
schema: Schema;
|
|
25
26
|
text: string;
|
|
@@ -30,5 +31,6 @@ type CreateCodelistOptionNodeAttrsArgs = {
|
|
|
30
31
|
text: string;
|
|
31
32
|
value?: string;
|
|
32
33
|
variableInstance?: string;
|
|
34
|
+
pointsToNode?: string;
|
|
33
35
|
};
|
|
34
36
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lblod/ember-rdfa-editor-lblod-plugins",
|
|
3
|
-
"version": "35.
|
|
3
|
+
"version": "35.2.0-dev.1af0eb76be419961a72f420e5268117782ddecc0",
|
|
4
4
|
"description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -38,8 +38,9 @@
|
|
|
38
38
|
"lint:js": "eslint . --cache",
|
|
39
39
|
"lint:js:fix": "eslint . --fix",
|
|
40
40
|
"lint:prettier": "prettier --check .",
|
|
41
|
-
"lint:prettier:fix": "
|
|
41
|
+
"lint:prettier:fix": "pnpm format",
|
|
42
42
|
"lint:types": "glint",
|
|
43
|
+
"format": "prettier --write .",
|
|
43
44
|
"start": "concurrently -c \"auto\" -P \"pnpm:serve {@}\" \"pnpm:typecheck\" --",
|
|
44
45
|
"typecheck": "glint --watch --preserveWatchOutput",
|
|
45
46
|
"serve": "ember serve",
|
|
@@ -110,9 +111,8 @@
|
|
|
110
111
|
"@glint/environment-ember-loose": "^1.5.0",
|
|
111
112
|
"@glint/environment-ember-template-imports": "^1.5.0",
|
|
112
113
|
"@glint/template": "^1.5.0",
|
|
113
|
-
"@
|
|
114
|
-
"@
|
|
115
|
-
"@lblod/ember-rdfa-editor": "13.1.1",
|
|
114
|
+
"@lblod/ember-rdfa-editor": "13.5.0-dev.a6492f963d68ec437e460b64569e45c4203cdc4b",
|
|
115
|
+
"@rdfjs/to-ntriples": "^3.0.1",
|
|
116
116
|
"@rdfjs/types": "^1.1.0",
|
|
117
117
|
"@release-it/keep-a-changelog": "^4.0.0",
|
|
118
118
|
"@tsconfig/ember": "^3.0.8",
|
|
@@ -207,6 +207,7 @@
|
|
|
207
207
|
"pnpm": {
|
|
208
208
|
"overrides": {
|
|
209
209
|
"babel-plugin-ember-template-compilation": "^2.2.5",
|
|
210
|
+
"@codemirror/state": "6.5.2",
|
|
210
211
|
"prosemirror-view": "^1.41.5"
|
|
211
212
|
}
|
|
212
213
|
},
|
package/translations/en-US.yaml
CHANGED