@lblod/ember-rdfa-editor-lblod-plugins 19.1.0 → 19.2.0
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 +22 -0
- package/addon/components/au-native-input.ts +12 -13
- package/addon/components/{worship-plugin → common/sort}/sortable-table-header.hbs +3 -9
- package/addon/components/{worship-plugin → common/sort}/sortable-table-header.ts +3 -6
- package/addon/components/lmb-plugin/insert.hbs +18 -0
- package/addon/components/lmb-plugin/insert.ts +121 -0
- package/addon/components/lmb-plugin/list.hbs +58 -0
- package/addon/components/lmb-plugin/search-modal.hbs +71 -0
- package/addon/components/lmb-plugin/search-modal.ts +173 -0
- package/addon/components/loading-alert.hbs +3 -1
- package/addon/components/location-plugin/edit.gts +380 -0
- package/addon/components/location-plugin/insert-variable.gts +67 -0
- package/addon/components/location-plugin/insert.gts +153 -0
- package/addon/components/location-plugin/nodeview.hbs +20 -0
- package/addon/components/location-plugin/nodeview.ts +49 -0
- package/addon/components/lpdc-plugin/lpdc-insert.hbs +19 -0
- package/addon/components/lpdc-plugin/lpdc-insert.ts +93 -0
- package/addon/components/lpdc-plugin/lpdc-modal.hbs +44 -0
- package/addon/components/lpdc-plugin/lpdc-modal.ts +79 -0
- package/addon/components/lpdc-plugin/lpdc-table-view.hbs +53 -0
- package/addon/components/lpdc-plugin/lpdc-table-view.ts +23 -0
- package/addon/components/variable-plugin/address/edit.ts +1 -1
- package/addon/components/variable-plugin/address/nodeview.ts +1 -1
- package/addon/components/worship-plugin/list.hbs +1 -1
- package/addon/models/mandatee.ts +35 -0
- package/addon/plugins/lmb-plugin/index.ts +3 -0
- package/addon/plugins/location-plugin/address.ts +405 -0
- package/addon/plugins/location-plugin/utils/address-helpers.ts +395 -0
- package/addon/plugins/location-plugin/utils/node-utils.ts +51 -0
- package/addon/plugins/lpdc-plugin/api.ts +114 -0
- package/addon/plugins/lpdc-plugin/index.ts +2 -0
- package/addon/plugins/lpdc-plugin/types.ts +5 -0
- package/addon/plugins/snippet-plugin/nodes/snippet-placeholder.ts +5 -3
- package/addon/plugins/variable-plugin/utils/address-helpers.ts +130 -12
- package/addon/plugins/variable-plugin/utils/dom-constructors.ts +3 -19
- package/addon/plugins/variable-plugin/variables/address.ts +122 -84
- package/addon/plugins/variable-plugin/variables/codelist.ts +1 -1
- package/addon/plugins/variable-plugin/variables/date.ts +1 -1
- package/addon/plugins/variable-plugin/variables/location.ts +2 -2
- package/addon/plugins/variable-plugin/variables/number.ts +1 -1
- package/addon/plugins/variable-plugin/variables/text.ts +1 -1
- package/addon/utils/constants.ts +15 -1
- package/addon/utils/dom-output-spec-helpers.ts +20 -3
- package/app/components/{worship-plugin → common/sort}/sortable-table-header.js +1 -1
- package/app/components/lmb-plugin/insert.js +1 -0
- package/app/components/lmb-plugin/list.js +1 -0
- package/app/components/lmb-plugin/search-modal.js +1 -0
- package/app/components/location-plugin/edit.js +1 -0
- package/app/components/location-plugin/insert-variable.js +1 -0
- package/app/components/location-plugin/insert.js +1 -0
- package/app/components/location-plugin/nodeview.js +1 -0
- package/app/components/lpdc-plugin/lpdc-insert.js +1 -0
- package/app/components/lpdc-plugin/lpdc-modal.js +1 -0
- package/app/components/lpdc-plugin/lpdc-table-view.js +1 -0
- package/app/styles/article-structure-plugin.scss +12 -6
- package/app/styles/snippet-plugin.scss +19 -0
- package/declarations/addon/components/au-native-input.d.ts +12 -10
- package/declarations/addon/components/{worship-plugin → common/sort}/sortable-table-header.d.ts +3 -3
- package/declarations/addon/components/lmb-plugin/insert.d.ts +17 -0
- package/declarations/addon/components/lmb-plugin/list.d.ts +1 -0
- package/declarations/addon/components/lmb-plugin/search-modal.d.ts +31 -0
- package/declarations/addon/components/location-plugin/edit.d.ts +47 -0
- package/declarations/addon/components/location-plugin/insert-variable.d.ts +17 -0
- package/declarations/addon/components/location-plugin/insert.d.ts +29 -0
- package/declarations/addon/components/location-plugin/nodeview.d.ts +22 -0
- package/declarations/addon/components/lpdc-plugin/lpdc-insert.d.ts +17 -0
- package/declarations/addon/components/lpdc-plugin/lpdc-modal.d.ts +42 -0
- package/declarations/addon/components/lpdc-plugin/lpdc-table-view.d.ts +37 -0
- package/declarations/addon/components/variable-plugin/address/edit.d.ts +1 -1
- package/declarations/addon/components/variable-plugin/address/nodeview.d.ts +1 -1
- package/declarations/addon/models/mandatee.d.ts +13 -0
- package/declarations/addon/plugins/lmb-plugin/index.d.ts +3 -0
- package/declarations/addon/plugins/location-plugin/address.d.ts +2 -0
- package/declarations/addon/plugins/location-plugin/utils/address-helpers.d.ts +65 -0
- package/declarations/addon/plugins/location-plugin/utils/node-utils.d.ts +2 -0
- package/declarations/addon/plugins/lpdc-plugin/api.d.ts +29 -0
- package/declarations/addon/plugins/lpdc-plugin/index.d.ts +2 -0
- package/declarations/addon/plugins/lpdc-plugin/types.d.ts +7 -0
- package/declarations/addon/plugins/variable-plugin/utils/address-helpers.d.ts +34 -1
- package/declarations/addon/plugins/variable-plugin/utils/dom-constructors.d.ts +5 -11
- package/declarations/addon/plugins/variable-plugin/variables/address.d.ts +0 -13
- package/declarations/addon/utils/constants.d.ts +5 -0
- package/declarations/addon/utils/dom-output-spec-helpers.d.ts +6 -2
- package/package.json +2 -2
- package/pnpm-lock.yaml +19 -8
- package/translations/en-US.yaml +41 -14
- package/translations/nl-BE.yaml +41 -13
- package/types/ember-concurrency/helpers/perform.d.ts +48 -0
- package/types/ember-power-select/components/power-select.d.ts +160 -0
- /package/addon/{plugins/variable-plugin/utils/attribute-parsers.ts → utils/variable-attribute-parsers.ts} +0 -0
- /package/declarations/addon/{plugins/variable-plugin/utils/attribute-parsers.d.ts → utils/variable-attribute-parsers.d.ts} +0 -0
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
import { unwrap } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
|
|
2
|
-
import { Address } from '../variables/address';
|
|
3
2
|
|
|
3
|
+
type GeoCoordinate = {
|
|
4
|
+
Lat_WGS84: number;
|
|
5
|
+
Lon_WGS84: number;
|
|
6
|
+
X_Lambert72: number;
|
|
7
|
+
Y_Lambert72: number;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Specified [in the API docs]{@link https://geo.api.vlaanderen.be/geolocation/}.
|
|
11
|
+
* It is not specified which fields can be null, so these might be incorrect.
|
|
12
|
+
*/
|
|
4
13
|
type LocationRegisterSearchResult = {
|
|
5
14
|
LocationResult: [
|
|
6
15
|
{
|
|
16
|
+
ID: number;
|
|
7
17
|
Municipality: string;
|
|
8
18
|
Zipcode: string | null;
|
|
9
19
|
Thoroughfarename: string | null;
|
|
10
20
|
Housenumber: string | null;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
21
|
+
FormattedAddress: string | null;
|
|
22
|
+
Location: GeoCoordinate;
|
|
23
|
+
LocationType: string | null;
|
|
24
|
+
BoundingBox: {
|
|
25
|
+
LowerLeft: GeoCoordinate;
|
|
26
|
+
UpperRight: GeoCoordinate;
|
|
14
27
|
};
|
|
15
28
|
},
|
|
16
29
|
];
|
|
@@ -40,6 +53,9 @@ type AddressSearchResult = {
|
|
|
40
53
|
}[];
|
|
41
54
|
};
|
|
42
55
|
|
|
56
|
+
/**
|
|
57
|
+
* {@link https://docs.basisregisters.vlaanderen.be/docs/api-documentation.html#operation/GetAddressV2}
|
|
58
|
+
*/
|
|
43
59
|
type AddressDetailResult = {
|
|
44
60
|
identificator: {
|
|
45
61
|
id: string;
|
|
@@ -72,6 +88,58 @@ type AddressDetailResult = {
|
|
|
72
88
|
};
|
|
73
89
|
};
|
|
74
90
|
|
|
91
|
+
export class Address {
|
|
92
|
+
declare id?: string;
|
|
93
|
+
declare street: string;
|
|
94
|
+
declare zipcode: string;
|
|
95
|
+
declare municipality: string;
|
|
96
|
+
declare housenumber?: string;
|
|
97
|
+
declare busnumber?: string;
|
|
98
|
+
declare location: Lambert72Coordinates;
|
|
99
|
+
constructor(
|
|
100
|
+
args: Pick<
|
|
101
|
+
Address,
|
|
102
|
+
| 'street'
|
|
103
|
+
| 'housenumber'
|
|
104
|
+
| 'zipcode'
|
|
105
|
+
| 'municipality'
|
|
106
|
+
| 'id'
|
|
107
|
+
| 'busnumber'
|
|
108
|
+
| 'location'
|
|
109
|
+
>,
|
|
110
|
+
) {
|
|
111
|
+
Object.assign(this, args);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
get formatted() {
|
|
115
|
+
if (this.housenumber && this.busnumber) {
|
|
116
|
+
return `${this.street} ${this.housenumber} bus ${this.busnumber}, ${this.zipcode} ${this.municipality}`;
|
|
117
|
+
} else if (this.housenumber) {
|
|
118
|
+
return `${this.street} ${this.housenumber}, ${this.zipcode} ${this.municipality}`;
|
|
119
|
+
} else {
|
|
120
|
+
return `${this.street}, ${this.zipcode} ${this.municipality}`;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
sameAs(
|
|
125
|
+
other?: Pick<
|
|
126
|
+
Address,
|
|
127
|
+
'street' | 'housenumber' | 'busnumber' | 'municipality'
|
|
128
|
+
> | null,
|
|
129
|
+
) {
|
|
130
|
+
return (
|
|
131
|
+
this.street === other?.street &&
|
|
132
|
+
this.housenumber === other?.housenumber &&
|
|
133
|
+
this.busnumber === other?.busnumber &&
|
|
134
|
+
this.municipality === other?.municipality
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
get hasHouseNumber() {
|
|
139
|
+
return !!this.housenumber;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
75
143
|
export class AddressError extends Error {
|
|
76
144
|
translation: string;
|
|
77
145
|
status?: number;
|
|
@@ -93,9 +161,9 @@ export class AddressError extends Error {
|
|
|
93
161
|
}
|
|
94
162
|
|
|
95
163
|
const LOC_GEOPUNT_ENDPOINT = `https://geo.api.vlaanderen.be/geolocation/v4/Location`;
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
const BASISREGISTER_ADRES =
|
|
164
|
+
const BASISREGISTER = 'https://api.basisregisters.vlaanderen.be/v2';
|
|
165
|
+
const BASISREGISTER_ADRESMATCH = `${BASISREGISTER}/adresmatch`;
|
|
166
|
+
const BASISREGISTER_ADRES = `${BASISREGISTER}/adressen`;
|
|
99
167
|
|
|
100
168
|
export const replaceAccents = (string: string) =>
|
|
101
169
|
string.normalize('NFD').replace(/([\u0300-\u036f])/g, '');
|
|
@@ -175,10 +243,10 @@ export async function resolveStreet(info: StreetInfo) {
|
|
|
175
243
|
street: unwrap(streetinfo.Thoroughfarename),
|
|
176
244
|
municipality: streetinfo.Municipality,
|
|
177
245
|
zipcode: unwrap(streetinfo.Zipcode),
|
|
178
|
-
|
|
246
|
+
location: {
|
|
179
247
|
x: streetinfo.Location.X_Lambert72,
|
|
180
248
|
y: streetinfo.Location.Y_Lambert72,
|
|
181
|
-
}
|
|
249
|
+
},
|
|
182
250
|
});
|
|
183
251
|
} else {
|
|
184
252
|
throw new AddressError({
|
|
@@ -215,7 +283,7 @@ export async function resolveAddress(info: AddressInfo) {
|
|
|
215
283
|
zipcode: result.postinfo.objectId,
|
|
216
284
|
municipality: result.gemeente.gemeentenaam.geografischeNaam.spelling,
|
|
217
285
|
id: result.identificator.id,
|
|
218
|
-
|
|
286
|
+
location: parseLambert72GMLString(result.adresPositie.geometrie.gml),
|
|
219
287
|
});
|
|
220
288
|
} else {
|
|
221
289
|
throw new AddressError({
|
|
@@ -267,11 +335,61 @@ export async function searchAddress(
|
|
|
267
335
|
}
|
|
268
336
|
}
|
|
269
337
|
|
|
270
|
-
|
|
338
|
+
/** Representation of a location in the `BD72 / Belgian Lambert 72` Coordinate Reference System */
|
|
339
|
+
export type Lambert72Coordinates = {
|
|
271
340
|
x: number;
|
|
272
341
|
y: number;
|
|
273
342
|
};
|
|
274
343
|
|
|
275
|
-
function constructLambert72GMLString({ x, y }: Lambert72Coordinates) {
|
|
344
|
+
export function constructLambert72GMLString({ x, y }: Lambert72Coordinates) {
|
|
276
345
|
return `<gml:Point srsName="https://www.opengis.net/def/crs/EPSG/0/31370" xmlns:gml="http://www.opengis.net/gml/3.2"><gml:pos>${x} ${y}</gml:pos></gml:Point>`;
|
|
277
346
|
}
|
|
347
|
+
/**
|
|
348
|
+
* Use a regex to parse a simple point as a GML string and return the coordinates.
|
|
349
|
+
* Throws an error if the format or CRS are not recognised
|
|
350
|
+
*/
|
|
351
|
+
export function parseLambert72GMLString(gml: string): Lambert72Coordinates {
|
|
352
|
+
// Parsers for GML exist in other libraries, but mostly within much larger projects (e.g.
|
|
353
|
+
// openlayers) in a way that is hard to extract due to the potential complexity of the geometries
|
|
354
|
+
// which can be represented. Since we handle only simple points, it's much less complex to just
|
|
355
|
+
// use a simple regex.
|
|
356
|
+
const [_, crs, x, y] =
|
|
357
|
+
/<gml.Point .*srsName="https:\/\/www.opengis.net\/def\/crs\/([^"]+)".+<gml.pos>(\S+) ([^<]+)<\/gml:pos>/.exec(
|
|
358
|
+
gml,
|
|
359
|
+
) || [];
|
|
360
|
+
if (!crs || crs !== 'EPSG/0/31370') {
|
|
361
|
+
throw new AddressError({
|
|
362
|
+
translation: 'editor-plugins.address.edit.errors.http-error',
|
|
363
|
+
message: 'An error occured when querying the address register',
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
return { x: Number(x), y: Number(y) };
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Construct a string to represent a geolocation, using the Lambert 72 reference system according to
|
|
370
|
+
* [the GeoSPARQL spec]{@link https://docs.ogc.org/is/22-047r1/22-047r1.html#10-8-1-%C2%A0-well-known-text}
|
|
371
|
+
*/
|
|
372
|
+
export function constructLambert72WKTString({ x, y }: Lambert72Coordinates) {
|
|
373
|
+
return `<https://www.opengis.net/def/crs/EPSG/0/31370> POINT(${x} ${y})`;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Use a regex to parse a simple point as a WKT string and return the coordinates.
|
|
377
|
+
* Throws an error if the format or CRS are not recognised
|
|
378
|
+
*/
|
|
379
|
+
export function parseLambert72WKTString(gml: string): Lambert72Coordinates {
|
|
380
|
+
// Parsers for WKT exist in other libraries, but either within much larger projects (e.g.
|
|
381
|
+
// openlayers) in a way that is hard to extract due to the potential complexity of the geometries
|
|
382
|
+
// which can be represented or within untyped libraries (e.g. wicket). Since we handle only simple
|
|
383
|
+
// points, it's much less complex to just use a simple regex.
|
|
384
|
+
const [_, crs, x, y] =
|
|
385
|
+
/<https:\/\/www.opengis.net\/def\/crs\/([^"]+)> POINT\((\S+) ([^)]+)\)/.exec(
|
|
386
|
+
gml,
|
|
387
|
+
) || [];
|
|
388
|
+
if (!crs || crs !== 'EPSG/0/31370') {
|
|
389
|
+
throw new AddressError({
|
|
390
|
+
translation: 'editor-plugins.address.edit.errors.http-error',
|
|
391
|
+
message: 'An error occured when querying the address register',
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
return { x: Number(x), y: Number(y) };
|
|
395
|
+
}
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
// This file contains helper functions used to create DOMOutputSpec objects
|
|
2
|
-
|
|
2
|
+
import { Attrs, DOMOutputSpec } from '@lblod/ember-rdfa-editor';
|
|
3
3
|
import {
|
|
4
4
|
DCT,
|
|
5
5
|
EXT,
|
|
6
6
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
7
7
|
import { span } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/dom-output-spec-helpers';
|
|
8
8
|
|
|
9
|
-
type Attributes = Record<string, unknown>;
|
|
10
|
-
type Children = unknown[];
|
|
11
|
-
|
|
12
9
|
/**
|
|
13
10
|
* Constructs a variable mapping span based on a mapping resource.
|
|
14
11
|
* This function also accepts additional attributes which are added to the span attributes, and a series of children.
|
|
15
12
|
*/
|
|
16
13
|
export const mappingSpan = (
|
|
17
14
|
mapping: string,
|
|
18
|
-
attributes:
|
|
19
|
-
...children:
|
|
15
|
+
attributes: Attrs,
|
|
16
|
+
...children: (DOMOutputSpec | 0)[]
|
|
20
17
|
) => {
|
|
21
18
|
return span(
|
|
22
19
|
{
|
|
@@ -51,16 +48,3 @@ export const sourceSpan = (variableSource: string) => {
|
|
|
51
48
|
resource: variableSource,
|
|
52
49
|
});
|
|
53
50
|
};
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Constructs a variable content span. Accepts optional additional attributes and a series of children.
|
|
57
|
-
*/
|
|
58
|
-
export const contentSpan = (attributes: Attributes, ...children: Children) => {
|
|
59
|
-
return span(
|
|
60
|
-
{
|
|
61
|
-
property: EXT('content').prefixed,
|
|
62
|
-
...attributes,
|
|
63
|
-
},
|
|
64
|
-
...children,
|
|
65
|
-
);
|
|
66
|
-
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ADRES,
|
|
3
|
+
ADRES_TYPO,
|
|
3
4
|
DCT,
|
|
4
5
|
EXT,
|
|
5
6
|
GENERIEK,
|
|
6
7
|
GEOSPARQL,
|
|
8
|
+
LOCN,
|
|
7
9
|
RDF,
|
|
8
10
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
9
11
|
import {
|
|
@@ -25,14 +27,16 @@ import {
|
|
|
25
27
|
parseLabel,
|
|
26
28
|
parseVariableInstance,
|
|
27
29
|
parseVariableType,
|
|
28
|
-
} from '@lblod/ember-rdfa-editor-lblod-plugins/
|
|
30
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/variable-attribute-parsers';
|
|
29
31
|
import {
|
|
30
32
|
findChildWithRdfaAttribute,
|
|
31
33
|
hasOutgoingNamedNodeTriple,
|
|
32
34
|
hasRDFaAttribute,
|
|
33
35
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
|
|
34
|
-
import {
|
|
35
|
-
|
|
36
|
+
import {
|
|
37
|
+
contentSpan,
|
|
38
|
+
span,
|
|
39
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/dom-output-spec-helpers';
|
|
36
40
|
import AddressNodeviewComponent from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/address/nodeview';
|
|
37
41
|
import type { ComponentLike } from '@glint/template';
|
|
38
42
|
import { getTranslationFunction } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/translation';
|
|
@@ -41,70 +45,26 @@ import {
|
|
|
41
45
|
rdfaAttrSpec,
|
|
42
46
|
renderRdfaAware,
|
|
43
47
|
} from '@lblod/ember-rdfa-editor/core/schema';
|
|
48
|
+
import {
|
|
49
|
+
Address,
|
|
50
|
+
constructLambert72WKTString,
|
|
51
|
+
type Lambert72Coordinates,
|
|
52
|
+
parseLambert72GMLString,
|
|
53
|
+
parseLambert72WKTString,
|
|
54
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/address-helpers';
|
|
44
55
|
|
|
45
56
|
const rdfaAware = true;
|
|
46
|
-
export class Address {
|
|
47
|
-
declare id?: string;
|
|
48
|
-
declare street: string;
|
|
49
|
-
declare zipcode: string;
|
|
50
|
-
declare municipality: string;
|
|
51
|
-
declare housenumber?: string;
|
|
52
|
-
declare busnumber?: string;
|
|
53
|
-
declare gml: string;
|
|
54
|
-
constructor(
|
|
55
|
-
args: Pick<
|
|
56
|
-
Address,
|
|
57
|
-
| 'street'
|
|
58
|
-
| 'housenumber'
|
|
59
|
-
| 'zipcode'
|
|
60
|
-
| 'municipality'
|
|
61
|
-
| 'id'
|
|
62
|
-
| 'busnumber'
|
|
63
|
-
| 'gml'
|
|
64
|
-
>,
|
|
65
|
-
) {
|
|
66
|
-
Object.assign(this, args);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
get formatted() {
|
|
70
|
-
if (this.housenumber && this.busnumber) {
|
|
71
|
-
return `${this.street} ${this.housenumber} bus ${this.busnumber}, ${this.zipcode} ${this.municipality}`;
|
|
72
|
-
} else if (this.housenumber) {
|
|
73
|
-
return `${this.street} ${this.housenumber}, ${this.zipcode} ${this.municipality}`;
|
|
74
|
-
} else {
|
|
75
|
-
return `${this.street}, ${this.zipcode} ${this.municipality}`;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
sameAs(
|
|
80
|
-
other?: Pick<
|
|
81
|
-
Address,
|
|
82
|
-
'street' | 'housenumber' | 'busnumber' | 'municipality'
|
|
83
|
-
> | null,
|
|
84
|
-
) {
|
|
85
|
-
return (
|
|
86
|
-
this.street === other?.street &&
|
|
87
|
-
this.housenumber === other?.housenumber &&
|
|
88
|
-
this.busnumber === other?.busnumber &&
|
|
89
|
-
this.municipality === other?.municipality
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
get hasHouseNumber() {
|
|
94
|
-
return !!this.housenumber;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
57
|
|
|
98
|
-
const constructLocationNode = (
|
|
58
|
+
const constructLocationNode = (location: Lambert72Coordinates) => {
|
|
99
59
|
return span(
|
|
100
60
|
{
|
|
101
61
|
property: ADRES('positie').full,
|
|
102
62
|
typeof: GENERIEK('GeografischePositie').full,
|
|
103
63
|
},
|
|
104
64
|
span({
|
|
105
|
-
property: GEOSPARQL('
|
|
106
|
-
datatype: GEOSPARQL('
|
|
107
|
-
content:
|
|
65
|
+
property: GEOSPARQL('asWKT').full,
|
|
66
|
+
datatype: GEOSPARQL('wktLiteral').full,
|
|
67
|
+
content: constructLambert72WKTString(location),
|
|
108
68
|
}),
|
|
109
69
|
);
|
|
110
70
|
};
|
|
@@ -115,7 +75,7 @@ const constructAddressNode = (address: Address) => {
|
|
|
115
75
|
' ',
|
|
116
76
|
span(
|
|
117
77
|
{
|
|
118
|
-
property: ADRES('huisnummer').full,
|
|
78
|
+
property: ADRES('Adresvoorstelling.huisnummer').full,
|
|
119
79
|
},
|
|
120
80
|
address.housenumber,
|
|
121
81
|
),
|
|
@@ -126,82 +86,91 @@ const constructAddressNode = (address: Address) => {
|
|
|
126
86
|
' bus ',
|
|
127
87
|
span(
|
|
128
88
|
{
|
|
129
|
-
property: ADRES('busnummer').full,
|
|
89
|
+
property: ADRES('Adresvoorstelling.busnummer').full,
|
|
130
90
|
},
|
|
131
91
|
address.busnumber,
|
|
132
92
|
),
|
|
133
93
|
]
|
|
134
94
|
: [];
|
|
95
|
+
const idNode = address.id
|
|
96
|
+
? [
|
|
97
|
+
span({
|
|
98
|
+
property: ADRES('verwijstNaar').full,
|
|
99
|
+
content: address.id,
|
|
100
|
+
}),
|
|
101
|
+
]
|
|
102
|
+
: [];
|
|
135
103
|
return contentSpan(
|
|
136
|
-
{ resource: address.id, typeof:
|
|
104
|
+
{ resource: address.id, typeof: LOCN('Adres').full },
|
|
137
105
|
span(
|
|
138
106
|
{
|
|
139
|
-
property:
|
|
107
|
+
property: DCT('spatial').full,
|
|
140
108
|
},
|
|
141
|
-
|
|
109
|
+
span(
|
|
110
|
+
{
|
|
111
|
+
property: LOCN('thoroughfare').full,
|
|
112
|
+
},
|
|
113
|
+
address.street,
|
|
114
|
+
),
|
|
115
|
+
...housenumberNode,
|
|
116
|
+
...busnumberNode,
|
|
142
117
|
),
|
|
143
|
-
...housenumberNode,
|
|
144
|
-
...busnumberNode,
|
|
145
118
|
', ',
|
|
146
119
|
span(
|
|
147
120
|
{
|
|
148
|
-
property:
|
|
149
|
-
typeof: ADRES('Postinfo').full,
|
|
121
|
+
property: LOCN('postcode').full,
|
|
150
122
|
},
|
|
151
|
-
|
|
152
|
-
{
|
|
153
|
-
property: ADRES('postcode').full,
|
|
154
|
-
},
|
|
155
|
-
address.zipcode,
|
|
156
|
-
),
|
|
123
|
+
address.zipcode,
|
|
157
124
|
),
|
|
158
125
|
' ',
|
|
159
126
|
span(
|
|
160
127
|
{
|
|
161
128
|
property: ADRES('gemeentenaam').full,
|
|
129
|
+
language: 'nl',
|
|
162
130
|
},
|
|
163
131
|
address.municipality,
|
|
164
132
|
),
|
|
165
|
-
|
|
133
|
+
...idNode,
|
|
134
|
+
constructLocationNode(address.location),
|
|
166
135
|
);
|
|
167
136
|
};
|
|
168
137
|
|
|
169
|
-
const
|
|
138
|
+
const parseOldAddressNode = (addressNode: Element): Address | undefined => {
|
|
170
139
|
const id = addressNode.getAttribute('resource');
|
|
171
140
|
const street = findChildWithRdfaAttribute(
|
|
172
141
|
addressNode,
|
|
173
142
|
'property',
|
|
174
|
-
|
|
143
|
+
ADRES_TYPO('heeftStraatnaam'),
|
|
175
144
|
)?.textContent;
|
|
176
145
|
const housenumber = findChildWithRdfaAttribute(
|
|
177
146
|
addressNode,
|
|
178
147
|
'property',
|
|
179
|
-
|
|
148
|
+
ADRES_TYPO('huisnummer'),
|
|
180
149
|
)?.textContent;
|
|
181
150
|
const busnumber = findChildWithRdfaAttribute(
|
|
182
151
|
addressNode,
|
|
183
152
|
'property',
|
|
184
|
-
|
|
153
|
+
ADRES_TYPO('busnummer'),
|
|
185
154
|
)?.textContent;
|
|
186
155
|
const postInfoNode = findChildWithRdfaAttribute(
|
|
187
156
|
addressNode,
|
|
188
157
|
'property',
|
|
189
|
-
|
|
158
|
+
ADRES_TYPO('heeftPostinfo'),
|
|
190
159
|
);
|
|
191
160
|
const zipcode =
|
|
192
161
|
postInfoNode &&
|
|
193
|
-
findChildWithRdfaAttribute(postInfoNode, 'property',
|
|
162
|
+
findChildWithRdfaAttribute(postInfoNode, 'property', ADRES_TYPO('postcode'))
|
|
194
163
|
?.textContent;
|
|
195
164
|
const municipality = findChildWithRdfaAttribute(
|
|
196
165
|
addressNode,
|
|
197
166
|
'property',
|
|
198
|
-
|
|
167
|
+
ADRES_TYPO('gemeentenaam'),
|
|
199
168
|
)?.textContent;
|
|
200
169
|
|
|
201
170
|
const locationNode = findChildWithRdfaAttribute(
|
|
202
171
|
addressNode,
|
|
203
172
|
'property',
|
|
204
|
-
|
|
173
|
+
ADRES_TYPO('positie'),
|
|
205
174
|
);
|
|
206
175
|
const gml =
|
|
207
176
|
locationNode &&
|
|
@@ -219,7 +188,75 @@ const parseAddressNode = (addressNode: Element): Address | undefined => {
|
|
|
219
188
|
zipcode,
|
|
220
189
|
municipality,
|
|
221
190
|
busnumber: busnumber ?? undefined,
|
|
222
|
-
gml,
|
|
191
|
+
location: parseLambert72GMLString(gml),
|
|
192
|
+
});
|
|
193
|
+
} else {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
const parseAddressNode = (addressNode: Element): Address | undefined => {
|
|
199
|
+
const id = findChildWithRdfaAttribute(
|
|
200
|
+
addressNode,
|
|
201
|
+
'property',
|
|
202
|
+
ADRES('verwijstNaar'),
|
|
203
|
+
)?.getAttribute('content');
|
|
204
|
+
const spatialNode = findChildWithRdfaAttribute(
|
|
205
|
+
addressNode,
|
|
206
|
+
'property',
|
|
207
|
+
DCT('spatial'),
|
|
208
|
+
);
|
|
209
|
+
const street =
|
|
210
|
+
spatialNode &&
|
|
211
|
+
findChildWithRdfaAttribute(spatialNode, 'property', LOCN('thoroughfare'))
|
|
212
|
+
?.textContent;
|
|
213
|
+
const housenumber =
|
|
214
|
+
spatialNode &&
|
|
215
|
+
findChildWithRdfaAttribute(
|
|
216
|
+
spatialNode,
|
|
217
|
+
'property',
|
|
218
|
+
ADRES('Adresvoorstelling.huisnummer'),
|
|
219
|
+
)?.textContent;
|
|
220
|
+
const busnumber =
|
|
221
|
+
spatialNode &&
|
|
222
|
+
findChildWithRdfaAttribute(
|
|
223
|
+
spatialNode,
|
|
224
|
+
'property',
|
|
225
|
+
ADRES('Adresvoorstelling.busnummer'),
|
|
226
|
+
)?.textContent;
|
|
227
|
+
const zipcode = findChildWithRdfaAttribute(
|
|
228
|
+
addressNode,
|
|
229
|
+
'property',
|
|
230
|
+
LOCN('postcode'),
|
|
231
|
+
)?.textContent;
|
|
232
|
+
const municipality = findChildWithRdfaAttribute(
|
|
233
|
+
addressNode,
|
|
234
|
+
'property',
|
|
235
|
+
ADRES('gemeentenaam'),
|
|
236
|
+
)?.textContent;
|
|
237
|
+
|
|
238
|
+
const locationNode = findChildWithRdfaAttribute(
|
|
239
|
+
addressNode,
|
|
240
|
+
'property',
|
|
241
|
+
ADRES('positie'),
|
|
242
|
+
);
|
|
243
|
+
const wkt =
|
|
244
|
+
locationNode &&
|
|
245
|
+
findChildWithRdfaAttribute(
|
|
246
|
+
locationNode,
|
|
247
|
+
'property',
|
|
248
|
+
GEOSPARQL('asWKT'),
|
|
249
|
+
)?.getAttribute('content');
|
|
250
|
+
|
|
251
|
+
if (street && municipality && zipcode && wkt) {
|
|
252
|
+
return new Address({
|
|
253
|
+
id: id ?? undefined,
|
|
254
|
+
street,
|
|
255
|
+
housenumber: housenumber ?? undefined,
|
|
256
|
+
zipcode,
|
|
257
|
+
municipality,
|
|
258
|
+
busnumber: busnumber ?? undefined,
|
|
259
|
+
location: parseLambert72WKTString(wkt),
|
|
223
260
|
});
|
|
224
261
|
} else {
|
|
225
262
|
return;
|
|
@@ -256,9 +293,10 @@ const parseDOM: ParseRule[] = [
|
|
|
256
293
|
if (!addressNode) {
|
|
257
294
|
return false;
|
|
258
295
|
}
|
|
296
|
+
const address = parseAddressNode(addressNode);
|
|
259
297
|
return {
|
|
260
298
|
...attrs,
|
|
261
|
-
value:
|
|
299
|
+
value: address ?? parseOldAddressNode(addressNode),
|
|
262
300
|
};
|
|
263
301
|
}
|
|
264
302
|
return false;
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
parseVariableInstance,
|
|
29
29
|
parseVariableSource,
|
|
30
30
|
parseVariableType,
|
|
31
|
-
} from '@lblod/ember-rdfa-editor-lblod-plugins/
|
|
31
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/variable-attribute-parsers';
|
|
32
32
|
import VariableNodeViewComponent from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/variable/nodeview';
|
|
33
33
|
import type { ComponentLike } from '@glint/template';
|
|
34
34
|
import { renderRdfaAware } from '@lblod/ember-rdfa-editor/core/schema';
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
isVariable,
|
|
27
27
|
parseLabel,
|
|
28
28
|
parseVariableType,
|
|
29
|
-
} from '@lblod/ember-rdfa-editor-lblod-plugins/
|
|
29
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/variable-attribute-parsers';
|
|
30
30
|
import type { ComponentLike } from '@glint/template';
|
|
31
31
|
import { getTranslationFunction } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/translation';
|
|
32
32
|
import { formatDate, validateDateFormat } from '../utils/date-helpers';
|
|
@@ -12,14 +12,14 @@ import {
|
|
|
12
12
|
parseVariableInstance,
|
|
13
13
|
parseVariableSource,
|
|
14
14
|
parseVariableType,
|
|
15
|
-
} from '@lblod/ember-rdfa-editor-lblod-plugins/
|
|
15
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/variable-attribute-parsers';
|
|
16
16
|
import {
|
|
17
|
-
contentSpan,
|
|
18
17
|
instanceSpan,
|
|
19
18
|
mappingSpan,
|
|
20
19
|
sourceSpan,
|
|
21
20
|
typeSpan,
|
|
22
21
|
} from '../utils/dom-constructors';
|
|
22
|
+
import { contentSpan } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/dom-output-spec-helpers';
|
|
23
23
|
import LocationNodeViewComponent from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/location/nodeview';
|
|
24
24
|
import type { ComponentLike } from '@glint/template';
|
|
25
25
|
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
parseLabel,
|
|
30
30
|
parseVariableInstance,
|
|
31
31
|
parseVariableType,
|
|
32
|
-
} from '@lblod/ember-rdfa-editor-lblod-plugins/
|
|
32
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/variable-attribute-parsers';
|
|
33
33
|
import { v4 as uuidv4 } from 'uuid';
|
|
34
34
|
import NumberNodeviewComponent from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/number/nodeview';
|
|
35
35
|
import type { ComponentLike } from '@glint/template';
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
parseLabel,
|
|
22
22
|
parseVariableInstance,
|
|
23
23
|
parseVariableType,
|
|
24
|
-
} from '@lblod/ember-rdfa-editor-lblod-plugins/
|
|
24
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/variable-attribute-parsers';
|
|
25
25
|
import VariableNodeViewComponent from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/variable/nodeview';
|
|
26
26
|
import type { ComponentLike } from '@glint/template';
|
|
27
27
|
import { hasOutgoingNamedNodeTriple } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
|
package/addon/utils/constants.ts
CHANGED
|
@@ -21,7 +21,11 @@ export const MOBILITEIT = namespace(
|
|
|
21
21
|
'mobiliteit',
|
|
22
22
|
);
|
|
23
23
|
|
|
24
|
-
export const
|
|
24
|
+
export const ADRES_TYPO = namespace(
|
|
25
|
+
'https://data.vlaanderen.be/ns/adres/',
|
|
26
|
+
'adres',
|
|
27
|
+
);
|
|
28
|
+
export const ADRES = namespace('https://data.vlaanderen.be/ns/adres#', 'adres');
|
|
25
29
|
export const GENERIEK = namespace(
|
|
26
30
|
'https://data.vlaanderen.be/ns/generiek/#',
|
|
27
31
|
'generiek',
|
|
@@ -31,3 +35,13 @@ export const GEOSPARQL = namespace(
|
|
|
31
35
|
'http://www.opengis.net/ont/geosparql#',
|
|
32
36
|
'geosparql',
|
|
33
37
|
);
|
|
38
|
+
export const MANDAAT = namespace(
|
|
39
|
+
'http://data.vlaanderen.be/ns/mandaat#',
|
|
40
|
+
'mandaat',
|
|
41
|
+
);
|
|
42
|
+
export const FOAF = namespace('http://xmlns.com/foaf/0.1/', 'foaf');
|
|
43
|
+
export const LOCN = namespace('http://www.w3.org/ns/locn#', 'locn');
|
|
44
|
+
export const SRO = namespace(
|
|
45
|
+
'https://data.vlaanderen.be/ns/slimmeraadpleegomgeving#',
|
|
46
|
+
'sro',
|
|
47
|
+
);
|
|
@@ -1,8 +1,25 @@
|
|
|
1
|
-
import { DOMOutputSpec } from '@lblod/ember-rdfa-editor';
|
|
1
|
+
import { Attrs, DOMOutputSpec } from '@lblod/ember-rdfa-editor';
|
|
2
|
+
import { EXT } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
2
3
|
|
|
3
4
|
export const span = (
|
|
4
|
-
attributes:
|
|
5
|
-
...children:
|
|
5
|
+
attributes: Attrs = {},
|
|
6
|
+
...children: (DOMOutputSpec | 0)[]
|
|
6
7
|
): DOMOutputSpec => {
|
|
7
8
|
return ['span', attributes, ...children];
|
|
8
9
|
};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Constructs a variable content span. Accepts optional additional attributes and a series of children.
|
|
13
|
+
*/
|
|
14
|
+
export const contentSpan = (
|
|
15
|
+
attributes: Attrs,
|
|
16
|
+
...children: (DOMOutputSpec | 0)[]
|
|
17
|
+
) => {
|
|
18
|
+
return span(
|
|
19
|
+
{
|
|
20
|
+
property: EXT('content').prefixed,
|
|
21
|
+
...attributes,
|
|
22
|
+
},
|
|
23
|
+
...children,
|
|
24
|
+
);
|
|
25
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/common/sort/sortable-table-header';
|