@lblod/ember-rdfa-editor-lblod-plugins 28.0.0 → 28.1.0-dev.bd6a773a8a0f8eb8948de754f67fa8e3a75c9895

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.
Files changed (80) hide show
  1. package/.changeset/brown-bats-watch-1.md +10 -0
  2. package/.changeset/brown-bats-watch-2.md +10 -0
  3. package/.changeset/brown-bats-watch-3.md +10 -0
  4. package/.changeset/brown-bats-watch-4.md +10 -0
  5. package/.changeset/brown-bats-watch-5.md +10 -0
  6. package/.changeset/brown-bats-watch-6.md +10 -0
  7. package/.changeset/brown-bats-watch-7.md +10 -0
  8. package/.changeset/brown-bats-watch-8.md +12 -0
  9. package/.changeset/plenty-spies-scream.md +5 -0
  10. package/.changeset/stupid-eels-eat.md +9 -0
  11. package/CHANGELOG.md +12 -0
  12. package/addon/components/common/documents/preview.gts +24 -6
  13. package/addon/components/common/documents/types.ts +2 -17
  14. package/addon/components/lmb-plugin/insert.ts +4 -37
  15. package/addon/components/location-plugin/insert.gts +27 -5
  16. package/addon/components/snippet-plugin/nodes/snippet.gts +1 -1
  17. package/addon/components/snippet-plugin/snippet-insert.gts +1 -1
  18. package/addon/components/variable-plugin/address/edit.ts +3 -0
  19. package/addon/components/variable-plugin/address/insert.ts +3 -0
  20. package/addon/components/variable-plugin/address/nodeview.ts +3 -0
  21. package/addon/components/variable-plugin/address/utils.ts +3 -0
  22. package/addon/components/variable-plugin/autofilled/edit.gts +2 -34
  23. package/addon/components/variable-plugin/autofilled/insert.gts +0 -8
  24. package/addon/components/variable-plugin/codelist/edit.ts +2 -9
  25. package/addon/components/variable-plugin/codelist/insert.ts +0 -8
  26. package/addon/components/variable-plugin/date/edit.ts +12 -33
  27. package/addon/components/variable-plugin/date/insert-variable.ts +0 -8
  28. package/addon/components/variable-plugin/date/insert.ts +0 -8
  29. package/addon/components/variable-plugin/date/nodeview.ts +4 -10
  30. package/addon/components/variable-plugin/location/edit.ts +1 -3
  31. package/addon/components/variable-plugin/location/insert.ts +0 -8
  32. package/addon/components/variable-plugin/number/insert.ts +0 -6
  33. package/addon/components/variable-plugin/number/nodeview.ts +4 -24
  34. package/addon/components/variable-plugin/person/edit.hbs +1 -1
  35. package/addon/components/variable-plugin/person/edit.ts +35 -11
  36. package/addon/components/variable-plugin/person/insert.ts +4 -37
  37. package/addon/components/variable-plugin/person/nodeview.ts +12 -13
  38. package/addon/components/variable-plugin/text/insert.ts +0 -11
  39. package/addon/plugins/location-plugin/node.ts +26 -52
  40. package/addon/plugins/snippet-plugin/index.ts +5 -10
  41. package/addon/plugins/snippet-plugin/nodes/snippet.ts +1 -6
  42. package/addon/plugins/snippet-plugin/utils/collate-imported-resources.ts +5 -2
  43. package/addon/plugins/variable-plugin/actions/create-autofilled-variable.ts +34 -28
  44. package/addon/plugins/variable-plugin/actions/create-classic-location-variable.ts +42 -34
  45. package/addon/plugins/variable-plugin/actions/create-codelist-variable.ts +51 -40
  46. package/addon/plugins/variable-plugin/actions/create-date-variable.ts +46 -36
  47. package/addon/plugins/variable-plugin/actions/create-number-variable.ts +39 -31
  48. package/addon/plugins/variable-plugin/actions/create-person-variable.ts +43 -0
  49. package/addon/plugins/variable-plugin/actions/create-text-variable.ts +36 -29
  50. package/addon/plugins/variable-plugin/utils/recreate-variable-uris.ts +53 -7
  51. package/addon/plugins/variable-plugin/variables/autofilled.ts +57 -5
  52. package/addon/plugins/variable-plugin/variables/codelist.ts +66 -12
  53. package/addon/plugins/variable-plugin/variables/date.ts +71 -37
  54. package/addon/plugins/variable-plugin/variables/location.ts +58 -7
  55. package/addon/plugins/variable-plugin/variables/number.ts +64 -14
  56. package/addon/plugins/variable-plugin/variables/person.ts +49 -43
  57. package/addon/plugins/variable-plugin/variables/text.ts +48 -6
  58. package/declarations/addon/components/common/documents/preview.d.ts +2 -0
  59. package/declarations/addon/components/common/documents/types.d.ts +2 -9
  60. package/declarations/addon/components/variable-plugin/address/edit.d.ts +3 -0
  61. package/declarations/addon/components/variable-plugin/address/insert.d.ts +3 -0
  62. package/declarations/addon/components/variable-plugin/address/nodeview.d.ts +3 -0
  63. package/declarations/addon/components/variable-plugin/address/utils.d.ts +3 -0
  64. package/declarations/addon/components/variable-plugin/autofilled/edit.d.ts +1 -1
  65. package/declarations/addon/components/variable-plugin/date/nodeview.d.ts +3 -2
  66. package/declarations/addon/components/variable-plugin/person/edit.d.ts +1 -1
  67. package/declarations/addon/components/variable-plugin/person/nodeview.d.ts +3 -4
  68. package/declarations/addon/plugins/snippet-plugin/index.d.ts +3 -3
  69. package/declarations/addon/plugins/variable-plugin/actions/create-autofilled-variable.d.ts +10 -6
  70. package/declarations/addon/plugins/variable-plugin/actions/create-classic-location-variable.d.ts +11 -6
  71. package/declarations/addon/plugins/variable-plugin/actions/create-codelist-variable.d.ts +12 -6
  72. package/declarations/addon/plugins/variable-plugin/actions/create-date-variable.d.ts +14 -8
  73. package/declarations/addon/plugins/variable-plugin/actions/create-number-variable.d.ts +12 -7
  74. package/declarations/addon/plugins/variable-plugin/actions/create-person-variable.d.ts +18 -0
  75. package/declarations/addon/plugins/variable-plugin/actions/create-text-variable.d.ts +10 -6
  76. package/declarations/addon/plugins/variable-plugin/utils/recreate-variable-uris.d.ts +1 -3
  77. package/package.json +3 -3
  78. package/pnpm-lock.yaml +6 -32
  79. package/translations/en-US.yaml +8 -7
  80. package/translations/nl-BE.yaml +11 -10
@@ -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': major
3
+ ---
4
+
5
+ Update `@lblod/ember-rdfa-editor` peerdependency to version 12.0.0
@@ -0,0 +1,9 @@
1
+ ---
2
+ '@lblod/ember-rdfa-editor-lblod-plugins': minor
3
+ ---
4
+
5
+ Introduce 'smart variable' system:
6
+ - Decoupled from the MOW variable namespace
7
+ - Mostly literal nodes
8
+ - Supports multiple backlinks and external triples
9
+
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @lblod/ember-rdfa-editor-lblod-plugins
2
2
 
3
+ ## 28.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#549](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/549) [`ab33ef7`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/ab33ef7e9ef6d237457db61d217f5286362ed74d) Thanks [@piemonkey](https://github.com/piemonkey)! - Change preview list to asynchronously load previews
8
+
9
+ ### Patch Changes
10
+
11
+ - [#551](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/551) [`f88d903`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/f88d903697e4f689a09cf2d364bf8c5b81bbbb19) Thanks [@lagartoverde](https://github.com/lagartoverde)! - Change number variable modal to clarify the upper number is also included in the range
12
+
13
+ - [#552](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/552) [`4cf94fd`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/4cf94fd78616a141265f09e8b403923e8018cd05) Thanks [@lagartoverde](https://github.com/lagartoverde)! - Rename "citeeropschrift" to "citaat"
14
+
3
15
  ## 28.0.0
4
16
 
5
17
  ### Major Changes
@@ -1,4 +1,5 @@
1
1
  import AuButton from '@appuniversum/ember-appuniversum/components/au-button';
2
+ import AuLoader from '@appuniversum/ember-appuniversum/components/au-loader';
2
3
  import AuIcon from '@appuniversum/ember-appuniversum/components/au-icon';
3
4
  import { NavDownIcon } from '@appuniversum/ember-appuniversum/components/icons/nav-down';
4
5
  import { NavUpIcon } from '@appuniversum/ember-appuniversum/components/icons/nav-up';
@@ -7,6 +8,8 @@ import { on } from '@ember/modifier';
7
8
  import { action } from '@ember/object';
8
9
  import Component from '@glimmer/component';
9
10
  import { tracked } from '@glimmer/tracking';
11
+ import { htmlSafe } from '@ember/template';
12
+ import { task } from 'ember-concurrency';
10
13
  import t from 'ember-intl/helpers/t';
11
14
  import { SayController } from '@lblod/ember-rdfa-editor';
12
15
  import { PreviewableDocument } from './types';
@@ -35,6 +38,9 @@ export default class DocumentPreview<
35
38
 
36
39
  @action
37
40
  togglePreview() {
41
+ if (!this.isExpanded && this.contentTask.isIdle && !this.contentTask.last) {
42
+ this.contentTask.perform();
43
+ }
38
44
  this.isExpanded = !this.isExpanded;
39
45
  }
40
46
 
@@ -46,6 +52,14 @@ export default class DocumentPreview<
46
52
  this.args.toggleFavourite?.(this.args.doc);
47
53
  };
48
54
 
55
+ contentTask = task(async () => {
56
+ const content = await this.args.doc.content;
57
+ return content && htmlSafe(content);
58
+ });
59
+ get content() {
60
+ return this.contentTask.last?.value;
61
+ }
62
+
49
63
  <template>
50
64
  <div
51
65
  class='snippet-preview {{if this.isExpanded "snippet-preview--expanded"}}'
@@ -54,7 +68,7 @@ export default class DocumentPreview<
54
68
  <div class='snippet-preview__header'>
55
69
  <div
56
70
  role='button'
57
- title={{t 'snippet-plugin.modal.preview-button.title'}}
71
+ title={{t 'common.preview-list.preview-button.title'}}
58
72
  {{on 'click' this.togglePreview}}
59
73
  {{! template-lint-disable require-presentational-children}}
60
74
  >
@@ -86,12 +100,12 @@ export default class DocumentPreview<
86
100
  </div>
87
101
  <div
88
102
  role='button'
89
- title={{t 'snippet-plugin.modal.select-button.title'}}
103
+ title={{t 'common.preview-list.select-button.title'}}
90
104
  {{on 'click' this.onInsert}}
91
105
  {{! template-lint-disable require-presentational-children}}
92
106
  >
93
107
  <AuButton class='snippet-preview__insert-button' @skin='naked'>
94
- {{t 'snippet-plugin.modal.select-button.label'}}
108
+ {{t 'common.preview-list.select-button.label'}}
95
109
  </AuButton>
96
110
  </div>
97
111
 
@@ -100,10 +114,14 @@ export default class DocumentPreview<
100
114
  <div
101
115
  class='say-editor say-content rdfa-annotations rdfa-annotations-highlight rdfa-annotations-hover snippet-preview__content'
102
116
  >
103
- {{#if @doc.content}}
104
- {{@doc.content}}
117
+ {{#if this.content}}
118
+ {{this.content}}
119
+ {{else if this.contentTask.isRunning}}
120
+ <AuLoader @hideMessage={{true}}>
121
+ {{t 'common.search.loading'}}
122
+ </AuLoader>
105
123
  {{else}}
106
- <p class='au-u-italic'>{{t 'snippet-plugin.modal.no-content'}}</p>
124
+ <p class='au-u-italic'>{{t 'common.preview-list.no-content'}}</p>
107
125
  {{/if}}
108
126
  </div>
109
127
  {{/if}}
@@ -1,19 +1,4 @@
1
- import { htmlSafe } from '@ember/template';
2
-
3
- import { optionMapOr } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
4
- import { SafeString } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/types';
5
-
6
- interface PreviewableDocumentArgs {
1
+ export interface PreviewableDocument {
7
2
  title: string | null;
8
- content: string | null;
9
- }
10
-
11
- export class PreviewableDocument {
12
- content: SafeString | null;
13
- title: string | null;
14
-
15
- constructor({ title, content }: PreviewableDocumentArgs) {
16
- this.content = optionMapOr(null, htmlSafe, content);
17
- this.title = title;
18
- }
3
+ content: string | Promise<string | null> | null;
19
4
  }
@@ -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 = this.controller.schema.nodes.person_variable.create({
68
- subject: mappingSubject,
69
- rdfaNodeType: 'resource',
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
- replaceSelectionWithLocation(
274
- this.controller,
275
- toInsert,
276
- this.args.config.subjectTypesToLinkTo,
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
 
@@ -197,7 +197,7 @@ export default class SnippetNode extends Component<Signature> {
197
197
  }
198
198
  this.controller.doCommand(
199
199
  insertSnippet({
200
- content: snippet.content?.toHTML() ?? '',
200
+ content: snippet.content ?? '',
201
201
  title: snippet.title ?? '',
202
202
  listProperties: {
203
203
  placeholderId: this.node.attrs.placeholderId,
@@ -64,7 +64,7 @@ export default class SnippetInsertComponent extends Component<Sig> {
64
64
  if (this.args.listProperties) {
65
65
  this.controller.doCommand(
66
66
  insertSnippet({
67
- content: snippet.content?.toHTML() ?? '',
67
+ content: snippet.content ?? '',
68
68
  title: snippet.title ?? '',
69
69
  listProperties: this.args.listProperties,
70
70
  allowMultipleSnippets: this.args.allowMultipleSnippets,
@@ -22,6 +22,9 @@ type Args = {
22
22
  defaultMunicipality?: string;
23
23
  };
24
24
 
25
+ /**
26
+ * @deprecated
27
+ */
25
28
  export default class AddressEditComponent extends Component<Args> {
26
29
  @service declare intl: IntlService;
27
30
 
@@ -12,6 +12,9 @@ type Args = {
12
12
  templateMode?: boolean;
13
13
  };
14
14
 
15
+ /**
16
+ * @deprecated
17
+ */
15
18
  export default class InsertAddressComponent extends Component<Args> {
16
19
  AddIcon = AddIcon;
17
20
 
@@ -11,6 +11,9 @@ type Args = {
11
11
  controller: SayController;
12
12
  };
13
13
 
14
+ /**
15
+ * @deprecated
16
+ */
14
17
  export default class AddressNodeviewComponent extends Component<Args> {
15
18
  get node() {
16
19
  return this.args.node;
@@ -7,6 +7,9 @@ import {
7
7
  } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
8
8
  import { v4 as uuidv4 } from 'uuid';
9
9
 
10
+ /**
11
+ * @deprecated
12
+ */
10
13
  export function replaceSelectionWithAddress(
11
14
  controller: SayController,
12
15
  label?: string,
@@ -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 getOutgoingTriple(this.selectedVariable.node.attrs, DCT('title'))
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
- const oldProperties = this.selectedVariable?.node.attrs.properties;
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 = getOutgoingTriple(node.attrs, DCT('source'))?.object
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 = getOutgoingTriple(node.attrs, MOBILITEIT('codelijst'))
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
- import {
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 = getOutgoingTriple(
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
- const node = tr.doc.nodeAt(pos);
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, 'onlyDate', !formatContainsTime(dateFormat));
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, 'onlyDate', !formatContainsTime(format));
278
+ .setNodeAttribute(pos, 'datatype', datatype);
300
279
  });
301
280
  }
302
281
  }