@lblod/ember-rdfa-editor-lblod-plugins 29.1.0 → 29.1.1-dev.4ca46ea39b10dedc794770fcf202fb89b6e0a16e
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/brown-bats-watch-1.md +10 -0
- package/.changeset/brown-bats-watch-2.md +10 -0
- package/.changeset/brown-bats-watch-3.md +10 -0
- package/.changeset/brown-bats-watch-4.md +10 -0
- package/.changeset/brown-bats-watch-5.md +10 -0
- package/.changeset/brown-bats-watch-6.md +10 -0
- package/.changeset/brown-bats-watch-7.md +10 -0
- package/.changeset/brown-bats-watch-8.md +12 -0
- package/.changeset/friendly-suits-deliver.md +5 -0
- package/.changeset/hot-fans-promise.md +5 -0
- package/.changeset/plenty-spies-scream.md +5 -0
- package/.changeset/stupid-eels-eat.md +9 -0
- package/CHANGELOG.md +6 -0
- package/addon/components/lmb-plugin/insert.ts +4 -37
- package/addon/components/location-plugin/insert.gts +27 -5
- package/addon/components/variable-plugin/address/edit.ts +3 -0
- package/addon/components/variable-plugin/address/insert.ts +3 -0
- package/addon/components/variable-plugin/address/nodeview.ts +3 -0
- package/addon/components/variable-plugin/address/utils.ts +3 -0
- package/addon/components/variable-plugin/autofilled/edit.gts +2 -34
- package/addon/components/variable-plugin/autofilled/insert.gts +0 -8
- package/addon/components/variable-plugin/codelist/edit.ts +2 -9
- package/addon/components/variable-plugin/codelist/insert.ts +0 -8
- package/addon/components/variable-plugin/date/edit.ts +12 -33
- package/addon/components/variable-plugin/date/insert-variable.ts +0 -8
- package/addon/components/variable-plugin/date/insert.ts +0 -8
- package/addon/components/variable-plugin/date/nodeview.ts +4 -10
- package/addon/components/variable-plugin/location/edit.ts +1 -3
- package/addon/components/variable-plugin/location/insert.ts +0 -8
- package/addon/components/variable-plugin/number/insert.ts +0 -6
- package/addon/components/variable-plugin/number/nodeview.ts +4 -24
- package/addon/components/variable-plugin/person/edit.hbs +1 -1
- package/addon/components/variable-plugin/person/edit.ts +35 -11
- package/addon/components/variable-plugin/person/insert.ts +4 -37
- package/addon/components/variable-plugin/person/nodeview.ts +12 -13
- package/addon/components/variable-plugin/text/insert.ts +0 -11
- package/addon/models/electee.ts +2 -2
- package/addon/plugins/besluit-type-plugin/utils/fetchBesluitTypes.ts +9 -20
- package/addon/plugins/location-plugin/node.ts +26 -52
- package/addon/plugins/snippet-plugin/nodes/snippet.ts +1 -6
- package/addon/plugins/variable-plugin/actions/create-autofilled-variable.ts +34 -28
- package/addon/plugins/variable-plugin/actions/create-classic-location-variable.ts +42 -34
- package/addon/plugins/variable-plugin/actions/create-codelist-variable.ts +51 -40
- package/addon/plugins/variable-plugin/actions/create-date-variable.ts +46 -36
- package/addon/plugins/variable-plugin/actions/create-number-variable.ts +39 -31
- package/addon/plugins/variable-plugin/actions/create-person-variable.ts +41 -0
- package/addon/plugins/variable-plugin/actions/create-text-variable.ts +36 -29
- package/addon/plugins/variable-plugin/utils/recreate-variable-uris.ts +53 -7
- package/addon/plugins/variable-plugin/variables/autofilled.ts +57 -5
- package/addon/plugins/variable-plugin/variables/codelist.ts +66 -12
- package/addon/plugins/variable-plugin/variables/date.ts +72 -38
- package/addon/plugins/variable-plugin/variables/location.ts +56 -6
- package/addon/plugins/variable-plugin/variables/number.ts +69 -20
- package/addon/plugins/variable-plugin/variables/person.ts +44 -39
- package/addon/plugins/variable-plugin/variables/text.ts +46 -5
- package/declarations/addon/components/variable-plugin/address/edit.d.ts +3 -0
- package/declarations/addon/components/variable-plugin/address/insert.d.ts +3 -0
- package/declarations/addon/components/variable-plugin/address/nodeview.d.ts +3 -0
- package/declarations/addon/components/variable-plugin/address/utils.d.ts +3 -0
- package/declarations/addon/components/variable-plugin/autofilled/edit.d.ts +1 -1
- package/declarations/addon/components/variable-plugin/date/nodeview.d.ts +3 -2
- package/declarations/addon/components/variable-plugin/person/edit.d.ts +1 -1
- package/declarations/addon/components/variable-plugin/person/nodeview.d.ts +3 -4
- package/declarations/addon/models/electee.d.ts +2 -2
- package/declarations/addon/plugins/variable-plugin/actions/create-autofilled-variable.d.ts +10 -6
- package/declarations/addon/plugins/variable-plugin/actions/create-classic-location-variable.d.ts +11 -6
- package/declarations/addon/plugins/variable-plugin/actions/create-codelist-variable.d.ts +12 -6
- package/declarations/addon/plugins/variable-plugin/actions/create-date-variable.d.ts +14 -8
- package/declarations/addon/plugins/variable-plugin/actions/create-number-variable.d.ts +12 -7
- package/declarations/addon/plugins/variable-plugin/actions/create-person-variable.d.ts +18 -0
- package/declarations/addon/plugins/variable-plugin/actions/create-text-variable.d.ts +10 -6
- package/declarations/addon/plugins/variable-plugin/utils/recreate-variable-uris.d.ts +1 -3
- package/package.json +3 -4
- package/pnpm-lock.yaml +5 -98
- package/translations/en-US.yaml +1 -1
- package/translations/nl-BE.yaml +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
'@lblod/ember-rdfa-editor-lblod-plugins': major
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Convert `text` variable to smart variable system
|
|
6
|
+
|
|
7
|
+
- Fully rdfa-aware
|
|
8
|
+
- Literal node
|
|
9
|
+
- `xsd:string` datatype
|
|
10
|
+
- May optionally contain MOW-variable information in external-triples, but is decoupled from this info and does not depend on it
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
'@lblod/ember-rdfa-editor-lblod-plugins': major
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Convert `number` variable to smart variable system
|
|
6
|
+
|
|
7
|
+
- Fully rdfa-aware
|
|
8
|
+
- Literal node
|
|
9
|
+
- `xsd:decimal` datatype
|
|
10
|
+
- May optionally contain MOW-variable information in external-triples, but is decoupled from this info and does not depend on it
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
'@lblod/ember-rdfa-editor-lblod-plugins': major
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Convert `date` variable to smart variable system
|
|
6
|
+
|
|
7
|
+
- Fully rdfa-aware
|
|
8
|
+
- Literal node
|
|
9
|
+
- `xsd:date` or `xsd:dateTime` datatype
|
|
10
|
+
- May optionally contain MOW-variable information in external-triples, but is decoupled from this info and does not depend on it
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
'@lblod/ember-rdfa-editor-lblod-plugins': major
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Convert `autofilled` variable to smart variable system
|
|
6
|
+
|
|
7
|
+
- Fully rdfa-aware
|
|
8
|
+
- Literal node
|
|
9
|
+
- `xsd:string` datatype
|
|
10
|
+
- May optionally contain MOW-variable information in external-triples, but is decoupled from this info and does not depend on it
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
'@lblod/ember-rdfa-editor-lblod-plugins': major
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Convert `location` (classic) variable to smart variable system
|
|
6
|
+
|
|
7
|
+
- Fully rdfa-aware
|
|
8
|
+
- Literal node
|
|
9
|
+
- `xsd:string` datatype
|
|
10
|
+
- May optionally contain MOW-variable information in external-triples, but is decoupled from this info and does not depend on it
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
'@lblod/ember-rdfa-editor-lblod-plugins': major
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Convert `codelist` variable to smart variable system
|
|
6
|
+
|
|
7
|
+
- Fully rdfa-aware
|
|
8
|
+
- Literal node
|
|
9
|
+
- `xsd:string` datatype
|
|
10
|
+
- May optionally contain MOW-variable information in external-triples, but is decoupled from this info and does not depend on it
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
'@lblod/ember-rdfa-editor-lblod-plugins': major
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Convert `person` variable to smart variable system
|
|
6
|
+
|
|
7
|
+
- Resource node
|
|
8
|
+
- Is not configured to be able to contain MOW-variable information (but this would not be hard to add, due to it's decoupled nature)
|
|
9
|
+
- If empty, contains a placeholder subject. Subject changes every time the person contained changes. Backlinks and external triples are kept when person contained changes, properties are not.
|
|
10
|
+
- Fully rdfa-aware
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
'@lblod/ember-rdfa-editor-lblod-plugins': major
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Convert `oslo_location` variable to smart variable system
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
- Resource node
|
|
9
|
+
- Is not configured to be able to contain MOW-variable information (but this would not be hard to add, due to it's decoupled nature)
|
|
10
|
+
- May not be empty
|
|
11
|
+
- Subject changes every time the person contained changes. Backlinks and external triples are kept when location contained changes, properties are not.
|
|
12
|
+
- Partially rdfa-aware: backlinks and external-triples, but properties are ignored (this variable uses it's own value attribute which overrides the properties)
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
---
|
|
2
|
+
'@lblod/ember-rdfa-editor-lblod-plugins': patch
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Remove obsolete `fetch-sparql-endpoint` dependency. This dependency requires node.js polyfills, which we are no longer providing with this package. This caused an issue in some applications using the `besluit-type` plugin.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @lblod/ember-rdfa-editor-lblod-plugins
|
|
2
2
|
|
|
3
|
+
## 29.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#562](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/562) [`fc24ae5`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/fc24ae53b956a69d6df861427d085da209756a00) Thanks [@elpoelma](https://github.com/elpoelma)! - Remove obsolete `fetch-sparql-endpoint` dependency. This dependency requires node.js polyfills, which we are no longer providing with this package. This caused an issue in some applications using the `besluit-type` plugin.
|
|
8
|
+
|
|
3
9
|
## 29.1.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -6,17 +6,11 @@ import { AddIcon } from '@appuniversum/ember-appuniversum/components/icons/add';
|
|
|
6
6
|
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
7
7
|
import { LmbPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/lmb-plugin';
|
|
8
8
|
import Electee from '@lblod/ember-rdfa-editor-lblod-plugins/models/electee';
|
|
9
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
10
|
-
import {
|
|
11
|
-
DCT,
|
|
12
|
-
EXT,
|
|
13
|
-
RDF,
|
|
14
|
-
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
15
9
|
import { replaceSelectionWithAndSelectNode } from '@lblod/ember-rdfa-editor-lblod-plugins/commands';
|
|
16
10
|
import { service } from '@ember/service';
|
|
17
11
|
import IntlService from 'ember-intl/services/intl';
|
|
18
|
-
import { sayDataFactory } from '@lblod/ember-rdfa-editor/core/say-data-factory';
|
|
19
12
|
import { Person } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/variables';
|
|
13
|
+
import { createPersonVariable } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/actions/create-person-variable';
|
|
20
14
|
|
|
21
15
|
interface Args {
|
|
22
16
|
controller: SayController;
|
|
@@ -47,14 +41,6 @@ export default class LmbPluginInsertComponent extends Component<Args> {
|
|
|
47
41
|
|
|
48
42
|
@action
|
|
49
43
|
onInsert(electee: Electee) {
|
|
50
|
-
const mappingSubject = `http://data.lblod.info/mappings/${
|
|
51
|
-
this.args.templateMode ? '--ref-uuid4-' : ''
|
|
52
|
-
}${uuidv4()}`;
|
|
53
|
-
const variableInstance = `http://data.lblod.info/variables/${
|
|
54
|
-
this.args.templateMode ? '--ref-uuid4-' : ''
|
|
55
|
-
}${uuidv4()}`;
|
|
56
|
-
const variableId = uuidv4();
|
|
57
|
-
|
|
58
44
|
const person: Person = {
|
|
59
45
|
uri: electee.uri,
|
|
60
46
|
firstName: electee.firstName,
|
|
@@ -64,29 +50,10 @@ export default class LmbPluginInsertComponent extends Component<Args> {
|
|
|
64
50
|
const label = this.intl.t('variable.person.label', {
|
|
65
51
|
locale: this.controller.documentLanguage,
|
|
66
52
|
});
|
|
67
|
-
const node =
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
__rdfaId: variableId,
|
|
53
|
+
const node = createPersonVariable({
|
|
54
|
+
schema: this.controller.schema,
|
|
55
|
+
label,
|
|
71
56
|
value: person,
|
|
72
|
-
properties: [
|
|
73
|
-
{
|
|
74
|
-
predicate: RDF('type').full,
|
|
75
|
-
object: sayDataFactory.namedNode(EXT('Mapping').full),
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
predicate: EXT('instance').full,
|
|
79
|
-
object: sayDataFactory.namedNode(variableInstance),
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
predicate: EXT('label').full,
|
|
83
|
-
object: sayDataFactory.literal(label),
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
predicate: DCT('type').full,
|
|
87
|
-
object: sayDataFactory.literal('person'),
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
57
|
});
|
|
91
58
|
|
|
92
59
|
this.controller.doCommand(replaceSelectionWithAndSelectNode(node), {
|
|
@@ -32,6 +32,8 @@ import LocationMap, {
|
|
|
32
32
|
SUPPORTED_LOCATION_TYPES,
|
|
33
33
|
type LocationType,
|
|
34
34
|
} from './map';
|
|
35
|
+
import { transactionCombinator } from '@lblod/ember-rdfa-editor/utils/transaction-utils';
|
|
36
|
+
import { updateSubject } from '@lblod/ember-rdfa-editor/plugins/rdfa-info/utils';
|
|
35
37
|
|
|
36
38
|
export type CurrentLocation = Address | GlobalCoordinates | undefined;
|
|
37
39
|
|
|
@@ -270,11 +272,31 @@ export default class LocationPluginInsertComponent extends Component<Signature>
|
|
|
270
272
|
}
|
|
271
273
|
if (toInsert) {
|
|
272
274
|
this.modalOpen = false;
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
this.
|
|
277
|
-
|
|
275
|
+
if (this.selectedLocationNode) {
|
|
276
|
+
// Update, while keeping backlinks intact
|
|
277
|
+
const { pos } = this.selectedLocationNode;
|
|
278
|
+
this.controller.withTransaction((tr) => {
|
|
279
|
+
return transactionCombinator(
|
|
280
|
+
this.controller.activeEditorState,
|
|
281
|
+
tr.setNodeAttribute(pos, 'value', toInsert),
|
|
282
|
+
)([
|
|
283
|
+
updateSubject({
|
|
284
|
+
pos,
|
|
285
|
+
targetSubject: toInsert.uri,
|
|
286
|
+
keepBacklinks: true,
|
|
287
|
+
keepProperties: false,
|
|
288
|
+
keepExternalTriples: true,
|
|
289
|
+
}),
|
|
290
|
+
]).transaction;
|
|
291
|
+
});
|
|
292
|
+
} else {
|
|
293
|
+
// Insert
|
|
294
|
+
replaceSelectionWithLocation(
|
|
295
|
+
this.controller,
|
|
296
|
+
toInsert,
|
|
297
|
+
this.args.config.subjectTypesToLinkTo,
|
|
298
|
+
);
|
|
299
|
+
}
|
|
278
300
|
}
|
|
279
301
|
}
|
|
280
302
|
|
|
@@ -13,33 +13,11 @@ import AuHeading from '@appuniversum/ember-appuniversum/components/au-heading';
|
|
|
13
13
|
import t from 'ember-intl/helpers/t';
|
|
14
14
|
import { on } from '@ember/modifier';
|
|
15
15
|
import { trackedReset } from 'tracked-toolbox';
|
|
16
|
-
import { DCT } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
17
|
-
import { sayDataFactory } from '@lblod/ember-rdfa-editor/core/say-data-factory/data-factory';
|
|
18
|
-
import { getOutgoingTriple } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
|
|
19
16
|
import LabelInput from '../utils/label-input';
|
|
20
|
-
import {
|
|
21
|
-
ContentLiteralTerm,
|
|
22
|
-
SayLiteral,
|
|
23
|
-
SayNamedNode,
|
|
24
|
-
} from '@lblod/ember-rdfa-editor/core/say-data-factory';
|
|
25
17
|
type Args = {
|
|
26
18
|
controller: SayController;
|
|
27
19
|
};
|
|
28
20
|
|
|
29
|
-
type nodeProperty =
|
|
30
|
-
| {
|
|
31
|
-
predicate: string;
|
|
32
|
-
object: SayNamedNode<string>;
|
|
33
|
-
}
|
|
34
|
-
| {
|
|
35
|
-
predicate: string;
|
|
36
|
-
object: SayLiteral;
|
|
37
|
-
}
|
|
38
|
-
| {
|
|
39
|
-
predicate: string;
|
|
40
|
-
object: ContentLiteralTerm;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
21
|
export default class AutoFilledVariableInsertComponent extends Component<Args> {
|
|
44
22
|
@service declare intl: IntlService;
|
|
45
23
|
|
|
@@ -97,8 +75,7 @@ export default class AutoFilledVariableInsertComponent extends Component<Args> {
|
|
|
97
75
|
}
|
|
98
76
|
get labelAttr() {
|
|
99
77
|
if (!this.selectedVariable) return '';
|
|
100
|
-
return
|
|
101
|
-
?.object.value;
|
|
78
|
+
return this.selectedVariable.node.attrs['label'];
|
|
102
79
|
}
|
|
103
80
|
|
|
104
81
|
get showCard() {
|
|
@@ -144,16 +121,7 @@ export default class AutoFilledVariableInsertComponent extends Component<Args> {
|
|
|
144
121
|
'convertToString',
|
|
145
122
|
this.convertToString,
|
|
146
123
|
);
|
|
147
|
-
|
|
148
|
-
const newProperties = oldProperties.filter(
|
|
149
|
-
(property: nodeProperty) =>
|
|
150
|
-
property.predicate !== DCT('title').full,
|
|
151
|
-
);
|
|
152
|
-
newProperties.push({
|
|
153
|
-
predicate: DCT('title').full,
|
|
154
|
-
object: sayDataFactory.literal(this.label || ''),
|
|
155
|
-
});
|
|
156
|
-
tr.setNodeAttribute(position, 'properties', newProperties);
|
|
124
|
+
tr.setNodeAttribute(position, 'label', this.label || '');
|
|
157
125
|
return tr;
|
|
158
126
|
},
|
|
159
127
|
// because the variable pill contains a nested editor, when it's
|
|
@@ -14,10 +14,6 @@ import t from 'ember-intl/helpers/t';
|
|
|
14
14
|
import { on } from '@ember/modifier';
|
|
15
15
|
import LabelInput from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/utils/label-input';
|
|
16
16
|
import { createAutofilledVariable } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/actions/create-autofilled-variable';
|
|
17
|
-
import {
|
|
18
|
-
generateVariableInstanceUri,
|
|
19
|
-
generateVariableUri,
|
|
20
|
-
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/variable-helpers';
|
|
21
17
|
|
|
22
18
|
type Args = {
|
|
23
19
|
controller: SayController;
|
|
@@ -67,10 +63,6 @@ export default class AutoFilledVariableInsertComponent extends Component<Args> {
|
|
|
67
63
|
this.label != '' ? this.label : this.autofillKey || placeholder;
|
|
68
64
|
const node = createAutofilledVariable({
|
|
69
65
|
schema: this.schema,
|
|
70
|
-
variable: generateVariableUri(),
|
|
71
|
-
variableInstance: generateVariableInstanceUri({
|
|
72
|
-
templateMode: this.args.templateMode,
|
|
73
|
-
}),
|
|
74
66
|
label,
|
|
75
67
|
autofillKey: this.autofillKey,
|
|
76
68
|
convertToString: this.convertToString,
|
|
@@ -10,11 +10,6 @@ import { MULTI_SELECT_CODELIST_TYPE } from '@lblod/ember-rdfa-editor-lblod-plugi
|
|
|
10
10
|
import { NodeSelection } from '@lblod/ember-rdfa-editor';
|
|
11
11
|
import { trackedFunction } from 'reactiveweb/function';
|
|
12
12
|
import { updateCodelistVariable } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/codelist-utils';
|
|
13
|
-
import { getOutgoingTriple } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
|
|
14
|
-
import {
|
|
15
|
-
DCT,
|
|
16
|
-
MOBILITEIT,
|
|
17
|
-
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
18
13
|
import { Option } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
|
|
19
14
|
import { tracked } from '@glimmer/tracking';
|
|
20
15
|
export type CodelistEditOptions = {
|
|
@@ -50,8 +45,7 @@ export default class CodelistEditComponent extends Component<Args> {
|
|
|
50
45
|
get source() {
|
|
51
46
|
if (this.selectedCodelist) {
|
|
52
47
|
const { node } = this.selectedCodelist;
|
|
53
|
-
const source =
|
|
54
|
-
.value as Option<string>;
|
|
48
|
+
const source = node.attrs['source'] as Option<string>;
|
|
55
49
|
if (source) {
|
|
56
50
|
return source;
|
|
57
51
|
}
|
|
@@ -62,8 +56,7 @@ export default class CodelistEditComponent extends Component<Args> {
|
|
|
62
56
|
get codelistUri() {
|
|
63
57
|
if (this.selectedCodelist) {
|
|
64
58
|
const { node } = this.selectedCodelist;
|
|
65
|
-
const codelistUri =
|
|
66
|
-
?.object.value as Option<string>;
|
|
59
|
+
const codelistUri = node.attrs['codelist'] as Option<string>;
|
|
67
60
|
if (codelistUri) {
|
|
68
61
|
return codelistUri;
|
|
69
62
|
}
|
|
@@ -11,10 +11,6 @@ import IntlService from 'ember-intl/services/intl';
|
|
|
11
11
|
import { trackedFunction } from 'reactiveweb/function';
|
|
12
12
|
import { replaceSelectionWithAndSelectNode } from '@lblod/ember-rdfa-editor-lblod-plugins/commands';
|
|
13
13
|
import { createCodelistVariable } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/actions/create-codelist-variable';
|
|
14
|
-
import {
|
|
15
|
-
generateVariableInstanceUri,
|
|
16
|
-
generateVariableUri,
|
|
17
|
-
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/variable-helpers';
|
|
18
14
|
|
|
19
15
|
export type CodelistInsertOptions = {
|
|
20
16
|
publisher?: string;
|
|
@@ -97,10 +93,6 @@ export default class CodelistInsertComponent extends Component<Args> {
|
|
|
97
93
|
const source = this.endpoint;
|
|
98
94
|
const node = createCodelistVariable({
|
|
99
95
|
schema: this.schema,
|
|
100
|
-
variable: generateVariableUri(),
|
|
101
|
-
variableInstance: generateVariableInstanceUri({
|
|
102
|
-
templateMode: this.args.templateMode,
|
|
103
|
-
}),
|
|
104
96
|
selectionStyle: this.selectedStyleValue,
|
|
105
97
|
codelist: codelistResource,
|
|
106
98
|
source,
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
Transaction,
|
|
8
8
|
} from '@lblod/ember-rdfa-editor';
|
|
9
9
|
import { NodeSelection, PNode } from '@lblod/ember-rdfa-editor';
|
|
10
|
-
import { sayDataFactory } from '@lblod/ember-rdfa-editor/core/say-data-factory';
|
|
11
10
|
import { service } from '@ember/service';
|
|
12
11
|
import IntlService from 'ember-intl/services/intl';
|
|
13
12
|
import {
|
|
@@ -28,14 +27,10 @@ import {
|
|
|
28
27
|
validateDateFormat,
|
|
29
28
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/date-helpers';
|
|
30
29
|
import { Velcro } from 'ember-velcro';
|
|
31
|
-
|
|
32
|
-
RDF,
|
|
33
|
-
XSD,
|
|
34
|
-
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
35
|
-
import { OutgoingTriple } from '@lblod/ember-rdfa-editor/core/rdfa-processor';
|
|
36
|
-
import { getOutgoingTriple } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
|
|
30
|
+
|
|
37
31
|
import { InfoCircleIcon } from '@appuniversum/ember-appuniversum/components/icons/info-circle';
|
|
38
32
|
import { CrossIcon } from '@appuniversum/ember-appuniversum/components/icons/cross';
|
|
33
|
+
import { XSD } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
39
34
|
|
|
40
35
|
type Args = {
|
|
41
36
|
controller: SayController;
|
|
@@ -79,10 +74,7 @@ export default class DateEditComponent extends Component<Args> {
|
|
|
79
74
|
|
|
80
75
|
get documentDate(): Option<Date> {
|
|
81
76
|
if (this.selectedDateNode) {
|
|
82
|
-
const dateVal =
|
|
83
|
-
this.selectedDateNode.attrs,
|
|
84
|
-
RDF('value'),
|
|
85
|
-
)?.object.value as Option<string>;
|
|
77
|
+
const dateVal = this.selectedDateNode.attrs['content'] as Option<string>;
|
|
86
78
|
if (dateVal) {
|
|
87
79
|
return new Date(dateVal);
|
|
88
80
|
}
|
|
@@ -214,26 +206,7 @@ export default class DateEditComponent extends Component<Args> {
|
|
|
214
206
|
const pos = this.documentDatePos;
|
|
215
207
|
if (pos) {
|
|
216
208
|
this.controller.withTransaction((tr: Transaction) => {
|
|
217
|
-
|
|
218
|
-
if (!node) {
|
|
219
|
-
return tr;
|
|
220
|
-
}
|
|
221
|
-
const properties = node.attrs.properties as OutgoingTriple[];
|
|
222
|
-
const newProperties = properties.filter((prop) => {
|
|
223
|
-
return !(
|
|
224
|
-
prop.object.termType === 'Literal' &&
|
|
225
|
-
RDF('value').matches(prop.predicate)
|
|
226
|
-
);
|
|
227
|
-
});
|
|
228
|
-
const datatype = this.onlyDate ? XSD('date') : XSD('dateTime');
|
|
229
|
-
newProperties.push({
|
|
230
|
-
predicate: RDF('value').full,
|
|
231
|
-
object: sayDataFactory.literal(
|
|
232
|
-
date.toISOString(),
|
|
233
|
-
datatype.namedNode,
|
|
234
|
-
),
|
|
235
|
-
});
|
|
236
|
-
return tr.setNodeAttribute(pos, 'properties', newProperties);
|
|
209
|
+
return tr.setNodeAttribute(pos, 'content', date.toISOString());
|
|
237
210
|
});
|
|
238
211
|
}
|
|
239
212
|
}
|
|
@@ -258,11 +231,14 @@ export default class DateEditComponent extends Component<Args> {
|
|
|
258
231
|
if (isNone(pos)) {
|
|
259
232
|
return;
|
|
260
233
|
}
|
|
234
|
+
const datatype = !formatContainsTime(dateFormat)
|
|
235
|
+
? XSD('date').namedNode
|
|
236
|
+
: XSD('dateTime').namedNode;
|
|
261
237
|
this.controller.withTransaction((tr) => {
|
|
262
238
|
return tr
|
|
263
239
|
.setNodeAttribute(pos, 'format', dateFormat)
|
|
264
240
|
.setNodeAttribute(pos, 'custom', custom)
|
|
265
|
-
.setNodeAttribute(pos, '
|
|
241
|
+
.setNodeAttribute(pos, 'datatype', datatype);
|
|
266
242
|
});
|
|
267
243
|
}
|
|
268
244
|
|
|
@@ -293,10 +269,13 @@ export default class DateEditComponent extends Component<Args> {
|
|
|
293
269
|
|
|
294
270
|
const pos = this.documentDatePos;
|
|
295
271
|
if (isSome(pos) && isSome(format)) {
|
|
272
|
+
const datatype = !formatContainsTime(format)
|
|
273
|
+
? XSD('date').namedNode
|
|
274
|
+
: XSD('dateTime').namedNode;
|
|
296
275
|
this.controller.withTransaction((tr) => {
|
|
297
276
|
return tr
|
|
298
277
|
.setNodeAttribute(pos, 'format', format)
|
|
299
|
-
.setNodeAttribute(pos, '
|
|
278
|
+
.setNodeAttribute(pos, 'datatype', datatype);
|
|
300
279
|
});
|
|
301
280
|
}
|
|
302
281
|
}
|
|
@@ -5,10 +5,6 @@ import { service } from '@ember/service';
|
|
|
5
5
|
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
6
6
|
import IntlService from 'ember-intl/services/intl';
|
|
7
7
|
import { replaceSelectionWithAndSelectNode } from '@lblod/ember-rdfa-editor-lblod-plugins/commands';
|
|
8
|
-
import {
|
|
9
|
-
generateVariableInstanceUri,
|
|
10
|
-
generateVariableUri,
|
|
11
|
-
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/variable-helpers';
|
|
12
8
|
import { createDateVariable } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/actions/create-date-variable';
|
|
13
9
|
|
|
14
10
|
type Args = {
|
|
@@ -45,10 +41,6 @@ export default class DateInsertVariableComponent extends Component<Args> {
|
|
|
45
41
|
const label = this.label ?? defaultLabel;
|
|
46
42
|
|
|
47
43
|
const node = createDateVariable({
|
|
48
|
-
variable: generateVariableUri(),
|
|
49
|
-
variableInstance: generateVariableInstanceUri({
|
|
50
|
-
templateMode: this.args.templateMode,
|
|
51
|
-
}),
|
|
52
44
|
schema: this.schema,
|
|
53
45
|
label,
|
|
54
46
|
});
|
|
@@ -6,10 +6,6 @@ import IntlService from 'ember-intl/services/intl';
|
|
|
6
6
|
import { replaceSelectionWithAndSelectNode } from '@lblod/ember-rdfa-editor-lblod-plugins/commands';
|
|
7
7
|
import { AddIcon } from '@appuniversum/ember-appuniversum/components/icons/add';
|
|
8
8
|
import { createDateVariable } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/actions/create-date-variable';
|
|
9
|
-
import {
|
|
10
|
-
generateVariableInstanceUri,
|
|
11
|
-
generateVariableUri,
|
|
12
|
-
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/variable-helpers';
|
|
13
9
|
|
|
14
10
|
type Args = {
|
|
15
11
|
controller: SayController;
|
|
@@ -41,10 +37,6 @@ export default class DateInsertComponent extends Component<Args> {
|
|
|
41
37
|
const label = defaultLabel;
|
|
42
38
|
|
|
43
39
|
const node = createDateVariable({
|
|
44
|
-
variable: generateVariableUri(),
|
|
45
|
-
variableInstance: generateVariableInstanceUri({
|
|
46
|
-
templateMode: this.args.templateMode,
|
|
47
|
-
}),
|
|
48
40
|
schema: this.schema,
|
|
49
41
|
label,
|
|
50
42
|
});
|
|
@@ -9,11 +9,7 @@ import {
|
|
|
9
9
|
formatDate,
|
|
10
10
|
validateDateFormat,
|
|
11
11
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/date-helpers';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
DCT,
|
|
15
|
-
RDF,
|
|
16
|
-
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
12
|
+
import { Option } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
|
|
17
13
|
|
|
18
14
|
type Args = {
|
|
19
15
|
getPos: () => number | undefined;
|
|
@@ -27,14 +23,12 @@ type Args = {
|
|
|
27
23
|
|
|
28
24
|
export default class DateNodeviewComponent extends Component<Args> {
|
|
29
25
|
get filled() {
|
|
30
|
-
const value =
|
|
31
|
-
.value;
|
|
26
|
+
const value = this.args.node.attrs['content'] as Option<string>;
|
|
32
27
|
return !!value;
|
|
33
28
|
}
|
|
34
29
|
|
|
35
30
|
get humanReadableDate() {
|
|
36
|
-
const value =
|
|
37
|
-
.value;
|
|
31
|
+
const value = this.args.node.attrs['content'] as Option<string>;
|
|
38
32
|
const format = this.args.node.attrs.format as string;
|
|
39
33
|
if (value) {
|
|
40
34
|
if (validateDateFormat(format).type === 'ok') {
|
|
@@ -48,6 +42,6 @@ export default class DateNodeviewComponent extends Component<Args> {
|
|
|
48
42
|
}
|
|
49
43
|
|
|
50
44
|
get label() {
|
|
51
|
-
return
|
|
45
|
+
return this.args.node.attrs['label'] as Option<string>;
|
|
52
46
|
}
|
|
53
47
|
}
|
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
hasOutgoingNamedNodeTriple,
|
|
19
19
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
|
|
20
20
|
import {
|
|
21
|
-
DCT,
|
|
22
21
|
EXT,
|
|
23
22
|
MOBILITEIT,
|
|
24
23
|
RDF,
|
|
@@ -79,8 +78,7 @@ export default class LocationEditComponent extends Component<Args> {
|
|
|
79
78
|
get source() {
|
|
80
79
|
if (this.selectedLocation) {
|
|
81
80
|
const { node } = this.selectedLocation;
|
|
82
|
-
const source =
|
|
83
|
-
.value as Option<string>;
|
|
81
|
+
const source = node.attrs.source as Option<string>;
|
|
84
82
|
if (source) {
|
|
85
83
|
return source;
|
|
86
84
|
}
|
|
@@ -6,10 +6,6 @@ import { service } from '@ember/service';
|
|
|
6
6
|
import IntlService from 'ember-intl/services/intl';
|
|
7
7
|
import { replaceSelectionWithAndSelectNode } from '@lblod/ember-rdfa-editor-lblod-plugins/commands';
|
|
8
8
|
import { createClassicLocationVariable } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/actions/create-classic-location-variable';
|
|
9
|
-
import {
|
|
10
|
-
generateVariableInstanceUri,
|
|
11
|
-
generateVariableUri,
|
|
12
|
-
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/variable-helpers';
|
|
13
9
|
|
|
14
10
|
export type LocationInsertOptions = {
|
|
15
11
|
endpoint: string;
|
|
@@ -57,10 +53,6 @@ export default class LocationInsertComponent extends Component<Args> {
|
|
|
57
53
|
|
|
58
54
|
const node = createClassicLocationVariable({
|
|
59
55
|
schema: this.schema,
|
|
60
|
-
variable: generateVariableUri(),
|
|
61
|
-
variableInstance: generateVariableInstanceUri({
|
|
62
|
-
templateMode: this.args.templateMode,
|
|
63
|
-
}),
|
|
64
56
|
label,
|
|
65
57
|
source: this.endpoint,
|
|
66
58
|
});
|