@lblod/ember-rdfa-editor-lblod-plugins 25.2.2 → 26.0.1

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 (58) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/addon/components/lmb-plugin/insert.ts +17 -5
  3. package/addon/components/lmb-plugin/list.hbs +16 -22
  4. package/addon/components/lmb-plugin/search-modal.ts +11 -11
  5. package/addon/components/location-plugin/insert.gts +2 -0
  6. package/addon/components/mandatee-table-plugin/node.gts +13 -4
  7. package/addon/components/structure-plugin/_private/structure.gts +1 -16
  8. package/addon/components/variable-plugin/address/insert-variable.ts +2 -0
  9. package/addon/components/variable-plugin/address/insert.ts +2 -0
  10. package/addon/components/variable-plugin/address/utils.ts +7 -2
  11. package/addon/components/variable-plugin/autofilled/insert.gts +7 -2
  12. package/addon/components/variable-plugin/codelist/insert.ts +7 -2
  13. package/addon/components/variable-plugin/date/insert-variable.ts +7 -2
  14. package/addon/components/variable-plugin/date/insert.ts +7 -3
  15. package/addon/components/variable-plugin/insert-variable-card.hbs +1 -0
  16. package/addon/components/variable-plugin/location/insert.ts +7 -2
  17. package/addon/components/variable-plugin/number/insert.ts +7 -2
  18. package/addon/components/variable-plugin/person/edit.ts +12 -12
  19. package/addon/components/variable-plugin/person/insert.ts +7 -2
  20. package/addon/components/variable-plugin/person/nodeview.ts +7 -7
  21. package/addon/components/variable-plugin/text/insert.ts +7 -2
  22. package/addon/models/electee.ts +22 -0
  23. package/addon/plugins/lmb-plugin/index.ts +7 -9
  24. package/addon/plugins/lmb-plugin/utils/fetchElectees.ts +163 -0
  25. package/addon/plugins/location-plugin/utils/node-utils.ts +7 -3
  26. package/addon/plugins/variable-plugin/recreateUuidsOnPaste.ts +11 -3
  27. package/addon/plugins/variable-plugin/variables/person.ts +31 -11
  28. package/app/styles/mandatee-table-plugin.scss +5 -2
  29. package/app/styles/structure-plugin.scss +0 -12
  30. package/declarations/addon/components/lmb-plugin/insert.d.ts +3 -2
  31. package/declarations/addon/components/lmb-plugin/search-modal.d.ts +6 -6
  32. package/declarations/addon/components/location-plugin/insert.d.ts +1 -0
  33. package/declarations/addon/components/structure-plugin/_private/structure.d.ts +0 -1
  34. package/declarations/addon/components/variable-plugin/address/insert-variable.d.ts +1 -0
  35. package/declarations/addon/components/variable-plugin/address/insert.d.ts +1 -0
  36. package/declarations/addon/components/variable-plugin/address/utils.d.ts +1 -1
  37. package/declarations/addon/components/variable-plugin/autofilled/insert.d.ts +1 -0
  38. package/declarations/addon/components/variable-plugin/codelist/insert.d.ts +1 -0
  39. package/declarations/addon/components/variable-plugin/date/insert-variable.d.ts +1 -0
  40. package/declarations/addon/components/variable-plugin/date/insert.d.ts +1 -0
  41. package/declarations/addon/components/variable-plugin/location/insert.d.ts +1 -0
  42. package/declarations/addon/components/variable-plugin/number/insert.d.ts +1 -0
  43. package/declarations/addon/components/variable-plugin/person/edit.d.ts +2 -2
  44. package/declarations/addon/components/variable-plugin/person/insert.d.ts +1 -0
  45. package/declarations/addon/components/variable-plugin/person/nodeview.d.ts +2 -2
  46. package/declarations/addon/components/variable-plugin/text/insert.d.ts +1 -0
  47. package/declarations/addon/models/electee.d.ts +10 -0
  48. package/declarations/addon/plugins/lmb-plugin/index.d.ts +2 -2
  49. package/declarations/addon/plugins/lmb-plugin/utils/{fetchMandatees.d.ts → fetchElectees.d.ts} +4 -4
  50. package/declarations/addon/plugins/location-plugin/utils/node-utils.d.ts +1 -1
  51. package/declarations/addon/plugins/variable-plugin/variables/person.d.ts +5 -0
  52. package/package.json +2 -2
  53. package/pnpm-lock.yaml +5 -5
  54. package/translations/en-US.yaml +8 -7
  55. package/translations/nl-BE.yaml +5 -7
  56. package/addon/models/mandatee.ts +0 -35
  57. package/addon/plugins/lmb-plugin/utils/fetchMandatees.ts +0 -143
  58. package/declarations/addon/models/mandatee.d.ts +0 -13
package/CHANGELOG.md CHANGED
@@ -1,5 +1,47 @@
1
1
  # @lblod/ember-rdfa-editor-lblod-plugins
2
2
 
3
+ ## 26.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#507](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/507) [`d7bf867`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/d7bf867860134c38aff2ab7bb6a3431c0546e354) Thanks [@elpoelma](https://github.com/elpoelma)! - Update `@lblod/template-uuid-instantiator` to version [1.0.3](https://github.com/lblod/template-uuid-instantiator/releases/tag/v1.0.3)
8
+
9
+ ## 26.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - [#504](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/504) [`82dd848`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/82dd848062665bf907055d47231beaa156ec243c) Thanks [@elpoelma](https://github.com/elpoelma)! - Adjustments to `lmb-plugin`:
14
+
15
+ - Rework `fetchMandatees` queries into `fetchElectees`
16
+ - Fetches all electees for a certain legislation period + all non-elected people with a mandate
17
+ - Replace `Mandatee` model by simpler `Electee` model
18
+ - Adjust UI components to reflect the `Mandatee` to `Electee` change
19
+
20
+ - [#504](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/504) [`82dd848`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/82dd848062665bf907055d47231beaa156ec243c) Thanks [@elpoelma](https://github.com/elpoelma)! - Adjustments to `person` variable:
21
+ - Removal of unused `content` attribute
22
+ - Removal of `mandatee` attribute. Replaced by `value` attribute which contains an object of type `Person`.
23
+ ```ts
24
+ type Person = {
25
+ uri: string;
26
+ firstName: string;
27
+ lastName: string;
28
+ };
29
+ ```
30
+ - Adjust parsing rules of `person_variable` nodespec to work with old and new serializations
31
+ - Is now more generic, instead of relying on `Mandatee` instances
32
+
33
+ ### Minor Changes
34
+
35
+ - [#509](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/509) [`092cc56`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/092cc569ef130e65611bb6de0e45c6d73f9c3718) Thanks [@elpoelma](https://github.com/elpoelma)! - Mandatee table plugin: ensure synchronisation warning shown in mandatee tables is clearer/more explicit
36
+
37
+ ### Patch Changes
38
+
39
+ - [#504](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/504) [`c5d4e05`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/c5d4e05c9b1e7a37bba6f79df862d5505aebbd47) Thanks [@elpoelma](https://github.com/elpoelma)! - person-variable plugin: remove unused `content` node-attribute
40
+
41
+ - [#505](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/505) [`0cb4f55`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/0cb4f555effe599d6e481d14bfcb6de7ac15fb66) Thanks [@lagartoverde](https://github.com/lagartoverde)! - Use new template uris on variables
42
+
43
+ - [#508](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/508) [`05f5e77`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/05f5e7711f7062132f1912f6675b8fd440d54daf) Thanks [@elpoelma](https://github.com/elpoelma)! - Decision article structures: remove unnecessary css placeholder from content section
44
+
3
45
  ## 25.2.2
4
46
 
5
47
  ### Patch Changes
@@ -5,7 +5,7 @@ import { AddIcon } from '@appuniversum/ember-appuniversum/components/icons/add';
5
5
 
6
6
  import { SayController } from '@lblod/ember-rdfa-editor';
7
7
  import { LmbPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/lmb-plugin';
8
- import Mandatee from '@lblod/ember-rdfa-editor-lblod-plugins/models/mandatee';
8
+ import Electee from '@lblod/ember-rdfa-editor-lblod-plugins/models/electee';
9
9
  import { v4 as uuidv4 } from 'uuid';
10
10
  import {
11
11
  DCT,
@@ -16,10 +16,12 @@ import { replaceSelectionWithAndSelectNode } from '@lblod/ember-rdfa-editor-lblo
16
16
  import { service } from '@ember/service';
17
17
  import IntlService from 'ember-intl/services/intl';
18
18
  import { sayDataFactory } from '@lblod/ember-rdfa-editor/core/say-data-factory';
19
+ import { Person } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/variables';
19
20
 
20
21
  interface Args {
21
22
  controller: SayController;
22
23
  config: LmbPluginConfig;
24
+ templateMode?: boolean;
23
25
  }
24
26
 
25
27
  export default class LmbPluginInsertComponent extends Component<Args> {
@@ -44,11 +46,21 @@ export default class LmbPluginInsertComponent extends Component<Args> {
44
46
  }
45
47
 
46
48
  @action
47
- onInsert(mandatee: Mandatee) {
48
- const mappingSubject = `http://data.lblod.info/mappings/${uuidv4()}`;
49
- const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
49
+ 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()}`;
50
56
  const variableId = uuidv4();
51
57
 
58
+ const person: Person = {
59
+ uri: electee.uri,
60
+ firstName: electee.firstName,
61
+ lastName: electee.lastName,
62
+ };
63
+
52
64
  const label = this.intl.t('variable.person.label', {
53
65
  locale: this.controller.documentLanguage,
54
66
  });
@@ -56,7 +68,7 @@ export default class LmbPluginInsertComponent extends Component<Args> {
56
68
  subject: mappingSubject,
57
69
  rdfaNodeType: 'resource',
58
70
  __rdfaId: variableId,
59
- mandatee,
71
+ value: person,
60
72
  properties: [
61
73
  {
62
74
  predicate: RDF('type').full,
@@ -11,24 +11,8 @@
11
11
  </th>
12
12
  <th>
13
13
  <Common::Sort::SortableTableHeader
14
- @field='status'
15
- @label={{t 'lmb-plugin.modal.fields.status'}}
16
- @sort={{@sort}}
17
- @setSort={{@setSort}}
18
- />
19
- </th>
20
- <th>
21
- <Common::Sort::SortableTableHeader
22
- @field='fractie'
23
- @label={{t 'lmb-plugin.modal.fields.fractie'}}
24
- @sort={{@sort}}
25
- @setSort={{@setSort}}
26
- />
27
- </th>
28
- <th>
29
- <Common::Sort::SortableTableHeader
30
- @field='role'
31
- @label={{t 'lmb-plugin.modal.fields.role'}}
14
+ @field='kandidatenlijst'
15
+ @label={{t 'lmb-plugin.modal.fields.kandidatenlijst'}}
32
16
  @sort={{@sort}}
33
17
  @setSort={{@setSort}}
34
18
  />
@@ -39,7 +23,7 @@
39
23
  <:body>
40
24
  {{#if @services.isRunning}}
41
25
  <tr>
42
- <td colspan='5'>
26
+ <td colspan='100%'>
43
27
  <AuLoader @centered={{true}}>
44
28
  {{t 'common.search.loading'}}
45
29
  </AuLoader>
@@ -50,9 +34,13 @@
50
34
  {{#each @services.value.results as |row|}}
51
35
  <tr>
52
36
  <td>{{row.fullName}}</td>
53
- <td>{{row.status}}</td>
54
- <td>{{row.fractie}}</td>
55
- <td>{{row.role}}</td>
37
+ <td>
38
+ {{#if row.kandidatenlijst}}
39
+ {{row.kandidatenlijst}}
40
+ {{else}}
41
+ <span class='au-u-italic'>{{t 'common.not-applicable'}}</span>
42
+ {{/if}}
43
+ </td>
56
44
  <td class='au-u-text-center'>
57
45
  <AuButton {{on 'click' (fn @insert row)}}>
58
46
  {{t 'lmb-plugin.modal.insert'}}
@@ -60,6 +48,12 @@
60
48
  </td>
61
49
  </tr>
62
50
  {{/each}}
51
+ {{else}}
52
+ <tr>
53
+ <td colspan='100%'>
54
+ {{t 'common.search.no-results'}}
55
+ </td>
56
+ </tr>
63
57
  {{/if}}
64
58
  {{/if}}
65
59
  </:body>
@@ -6,24 +6,24 @@ import { restartableTask, timeout } from 'ember-concurrency';
6
6
  import { task as trackedTask } from 'reactiveweb/ember-concurrency';
7
7
  import { LmbPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/lmb-plugin';
8
8
 
9
- import Mandatee from '@lblod/ember-rdfa-editor-lblod-plugins/models/mandatee';
9
+ import Electee from '@lblod/ember-rdfa-editor-lblod-plugins/models/electee';
10
10
  import {
11
11
  FetchMandateesArgs,
12
- fetchMandatees,
13
- } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/lmb-plugin/utils/fetchMandatees';
12
+ fetchElectees,
13
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/lmb-plugin/utils/fetchElectees';
14
14
  import {
15
15
  BESTUURSPERIODES,
16
16
  BestuursperiodeLabel,
17
17
  BestuursperiodeURI,
18
18
  } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
19
19
  import { isSome } from '@lblod/ember-rdfa-editor/utils/_private/option';
20
- export type SearchSort = [keyof Mandatee, 'ASC' | 'DESC'] | false;
20
+ export type SearchSort = [keyof Electee, 'ASC' | 'DESC'] | false;
21
21
 
22
22
  interface Args {
23
23
  config: LmbPluginConfig;
24
24
  open: boolean;
25
25
  closeModal: () => void;
26
- onInsert: (mandatee: Mandatee) => void;
26
+ onInsert: (electee: Electee) => void;
27
27
  }
28
28
  interface AdminPeriodOption {
29
29
  label: BestuursperiodeLabel;
@@ -118,7 +118,7 @@ export default class LmbPluginSearchModalComponent extends Component<Args> {
118
118
  }
119
119
 
120
120
  try {
121
- const result = await fetchMandatees({
121
+ const result = await fetchElectees({
122
122
  endpoint,
123
123
  searchString,
124
124
  page,
@@ -127,14 +127,14 @@ export default class LmbPluginSearchModalComponent extends Component<Args> {
127
127
  period,
128
128
  adminUnitSearch,
129
129
  });
130
- const { count, mandatees } = result;
130
+ const { count, electees } = result;
131
131
 
132
132
  return {
133
- results: mandatees,
133
+ results: electees,
134
134
  totalCount: count,
135
135
  };
136
136
  } catch (err) {
137
- console.error('Got an error fetching LMB data', err);
137
+ console.error('Got an error fetching electees', err);
138
138
  this.error = err;
139
139
  }
140
140
  return {
@@ -182,8 +182,8 @@ export default class LmbPluginSearchModalComponent extends Component<Args> {
182
182
  ++this.pageNumber;
183
183
  }
184
184
  @action
185
- async onInsert(mandatee: Mandatee) {
186
- this.args.onInsert(mandatee);
185
+ async onInsert(electee: Electee) {
186
+ this.args.onInsert(electee);
187
187
  await this.closeModal();
188
188
  }
189
189
  }
@@ -54,6 +54,7 @@ interface Signature {
54
54
  controller: SayController;
55
55
  config: LocationPluginConfig;
56
56
  defaultMunicipality?: string;
57
+ templateMode?: boolean;
57
58
  };
58
59
  Element: HTMLLIElement;
59
60
  }
@@ -194,6 +195,7 @@ export default class LocationPluginInsertComponent extends Component<Signature>
194
195
  this.intl.t('location-plugin.default-label', {
195
196
  locale: this.documentLanguage,
196
197
  }),
198
+ this.args.templateMode,
197
199
  );
198
200
  }
199
201
  this.modalOpen = true;
@@ -1,4 +1,6 @@
1
+ import AuAlert from '@appuniversum/ember-appuniversum/components/au-alert';
1
2
  import AuIcon from '@appuniversum/ember-appuniversum/components/au-icon';
3
+ import { AlertTriangleIcon } from '@appuniversum/ember-appuniversum/components/icons/alert-triangle';
2
4
 
3
5
  import { UserIcon } from '@appuniversum/ember-appuniversum/components/icons/user';
4
6
  import { service } from '@ember/service';
@@ -45,12 +47,19 @@ export default class MandateeTableNode extends Component<Sig> {
45
47
  />
46
48
  <div>
47
49
  <h6 class='say-mandatee-table__title'>{{this.title}}</h6>
48
- <p class='say-mandatee-table__warning'>
49
- {{this.warning}}
50
- </p>
51
50
  </div>
52
51
  </div>
53
- <div class='say-mandatee-table-content'>{{yield}}</div>
52
+ <div class='say-mandatee-table-content'>
53
+ <AuAlert
54
+ class='say-mandatee-table__warning'
55
+ @icon={{AlertTriangleIcon}}
56
+ @skin='warning'
57
+ @size='small'
58
+ >
59
+ {{this.warning}}
60
+ </AuAlert>
61
+ {{yield}}
62
+ </div>
54
63
  </div>
55
64
  </template>
56
65
  }
@@ -5,7 +5,6 @@ import { tracked } from '@glimmer/tracking';
5
5
  import { SayView, Schema } from '@lblod/ember-rdfa-editor';
6
6
  import { redacted } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/confidentiality-plugin';
7
7
  import NestedProsemirror from '@lblod/ember-rdfa-editor-lblod-plugins/utils/nested-prosemirror';
8
- import { unwrap } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
9
8
  import { color } from '@lblod/ember-rdfa-editor/plugins/color/marks/color';
10
9
  import { highlight } from '@lblod/ember-rdfa-editor/plugins/highlight/marks/highlight';
11
10
  import {
@@ -75,20 +74,6 @@ export default class Structure extends Component<Sig> {
75
74
  return this.args.node;
76
75
  }
77
76
 
78
- get isEmpty() {
79
- if (this.node.childCount > 1) {
80
- return false;
81
- }
82
- const firstChild = unwrap(this.node.firstChild);
83
- if (!firstChild.isTextblock) {
84
- return false;
85
- }
86
- if (firstChild.childCount > 0) {
87
- return false;
88
- }
89
- return true;
90
- }
91
-
92
77
  get tag() {
93
78
  return 'div';
94
79
  }
@@ -188,7 +173,7 @@ export default class Structure extends Component<Sig> {
188
173
  </Tag>
189
174
  {{/let}}
190
175
  </div>
191
- <div class='say-structure__content {{if this.isEmpty "say-empty" ""}}'>
176
+ <div class='say-structure__content'>
192
177
  {{yield}}
193
178
  </div>
194
179
  </div>
@@ -8,6 +8,7 @@ import IntlService from 'ember-intl/services/intl';
8
8
 
9
9
  type Args = {
10
10
  controller: SayController;
11
+ templateMode?: boolean;
11
12
  };
12
13
 
13
14
  export default class VariablePluginAddressInsertVariableComponent extends Component<Args> {
@@ -35,6 +36,7 @@ export default class VariablePluginAddressInsertVariableComponent extends Compon
35
36
  this.intl.t('variable.address.label', {
36
37
  locale: this.documentLanguage,
37
38
  }),
39
+ this.args.templateMode,
38
40
  );
39
41
  }
40
42
  }
@@ -9,6 +9,7 @@ import { replaceSelectionWithAddress } from './utils';
9
9
 
10
10
  type Args = {
11
11
  controller: SayController;
12
+ templateMode?: boolean;
12
13
  };
13
14
 
14
15
  export default class InsertAddressComponent extends Component<Args> {
@@ -31,6 +32,7 @@ export default class InsertAddressComponent extends Component<Args> {
31
32
  this.intl.t('variable.address.label', {
32
33
  locale: this.documentLanguage,
33
34
  }),
35
+ this.args.templateMode,
34
36
  );
35
37
  }
36
38
 
@@ -10,9 +10,14 @@ import { v4 as uuidv4 } from 'uuid';
10
10
  export function replaceSelectionWithAddress(
11
11
  controller: SayController,
12
12
  label?: string,
13
+ templateMode?: boolean,
13
14
  ) {
14
- const mappingResource = `http://data.lblod.info/mappings/${uuidv4()}`;
15
- const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
15
+ const mappingResource = `http://data.lblod.info/mappings/${
16
+ templateMode ? '--ref-uuid4-' : ''
17
+ }${uuidv4()}`;
18
+ const variableInstance = `http://data.lblod.info/variables/${
19
+ templateMode ? '--ref-uuid4-' : ''
20
+ }${uuidv4()}`;
16
21
 
17
22
  controller.withTransaction((tr) => {
18
23
  tr.replaceSelectionWith(
@@ -23,6 +23,7 @@ import LabelInput from '@lblod/ember-rdfa-editor-lblod-plugins/components/variab
23
23
 
24
24
  type Args = {
25
25
  controller: SayController;
26
+ templateMode?: boolean;
26
27
  };
27
28
 
28
29
  export default class AutoFilledVariableInsertComponent extends Component<Args> {
@@ -60,8 +61,12 @@ export default class AutoFilledVariableInsertComponent extends Component<Args> {
60
61
 
61
62
  @action
62
63
  insert() {
63
- const mappingSubject = `http://data.lblod.info/mappings/${uuidv4()}`;
64
- const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
64
+ const mappingSubject = `http://data.lblod.info/mappings/${
65
+ this.args.templateMode ? '--ref-uuid4-' : ''
66
+ }${uuidv4()}`;
67
+ const variableInstance = `http://data.lblod.info/variables/${
68
+ this.args.templateMode ? '--ref-uuid4-' : ''
69
+ }${uuidv4()}`;
65
70
  const variableId = uuidv4();
66
71
 
67
72
  const placeholder = this.intl.t('variable.autofilled.label', {
@@ -26,6 +26,7 @@ export type CodelistInsertOptions = {
26
26
  type Args = {
27
27
  controller: SayController;
28
28
  options: CodelistInsertOptions;
29
+ templateMode?: boolean;
29
30
  };
30
31
 
31
32
  interface SelectStyle {
@@ -88,8 +89,12 @@ export default class CodelistInsertComponent extends Component<Args> {
88
89
 
89
90
  @action
90
91
  insert() {
91
- const mappingResource = `http://data.lblod.info/mappings/${uuidv4()}`;
92
- const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
92
+ const mappingResource = `http://data.lblod.info/mappings/${
93
+ this.args.templateMode ? '--ref-uuid4-' : ''
94
+ }${uuidv4()}`;
95
+ const variableInstance = `http://data.lblod.info/variables/${
96
+ this.args.templateMode ? '--ref-uuid4-' : ''
97
+ }${uuidv4()}`;
93
98
  const codelistResource = this.selectedCodelist?.uri;
94
99
  const label =
95
100
  this.label ??
@@ -16,6 +16,7 @@ import { replaceSelectionWithAndSelectNode } from '@lblod/ember-rdfa-editor-lblo
16
16
 
17
17
  type Args = {
18
18
  controller: SayController;
19
+ templateMode?: boolean;
19
20
  };
20
21
 
21
22
  export default class DateInsertVariableComponent extends Component<Args> {
@@ -41,8 +42,12 @@ export default class DateInsertVariableComponent extends Component<Args> {
41
42
 
42
43
  @action
43
44
  insert() {
44
- const mappingResource = `http://data.lblod.info/mappings/${uuidv4()}`;
45
- const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
45
+ const mappingResource = `http://data.lblod.info/mappings/${
46
+ this.args.templateMode ? '--ref-uuid4-' : ''
47
+ }${uuidv4()}`;
48
+ const variableInstance = `http://data.lblod.info/variables/${
49
+ this.args.templateMode ? '--ref-uuid4-' : ''
50
+ }${uuidv4()}`;
46
51
 
47
52
  const defaultLabel = this.intl.t('variable.date.label', {
48
53
  locale: this.documentLanguage,
@@ -15,6 +15,7 @@ import { AddIcon } from '@appuniversum/ember-appuniversum/components/icons/add';
15
15
 
16
16
  type Args = {
17
17
  controller: SayController;
18
+ templateMode?: boolean;
18
19
  };
19
20
 
20
21
  export default class DateInsertComponent extends Component<Args> {
@@ -36,9 +37,12 @@ export default class DateInsertComponent extends Component<Args> {
36
37
 
37
38
  @action
38
39
  insert() {
39
- const mappingResource = `http://data.lblod.info/mappings/${uuidv4()}`;
40
-
41
- const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
40
+ const mappingResource = `http://data.lblod.info/mappings/${
41
+ this.args.templateMode ? '--ref-uuid4-' : ''
42
+ }${uuidv4()}`;
43
+ const variableInstance = `http://data.lblod.info/variables/${
44
+ this.args.templateMode ? '--ref-uuid4-' : ''
45
+ }${uuidv4()}`;
42
46
  const defaultLabel = this.intl.t('variable.date.label', {
43
47
  locale: this.documentLanguage,
44
48
  });
@@ -29,6 +29,7 @@
29
29
  <this.selectedVariable.component
30
30
  @controller={{this.controller}}
31
31
  @options={{this.selectedVariable.options}}
32
+ @templateMode={{@templateMode}}
32
33
  />
33
34
  {{/if}}
34
35
  </c.content>
@@ -14,6 +14,7 @@ export type LocationInsertOptions = {
14
14
  type Args = {
15
15
  controller: SayController;
16
16
  options: LocationInsertOptions;
17
+ templateMode?: boolean;
17
18
  };
18
19
 
19
20
  export default class LocationInsertComponent extends Component<Args> {
@@ -44,8 +45,12 @@ export default class LocationInsertComponent extends Component<Args> {
44
45
 
45
46
  @action
46
47
  insert() {
47
- const mappingResource = `http://data.lblod.info/mappings/${uuidv4()}`;
48
- const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
48
+ const mappingResource = `http://data.lblod.info/mappings/${
49
+ this.args.templateMode ? '--ref-uuid4-' : ''
50
+ }${uuidv4()}`;
51
+ const variableInstance = `http://data.lblod.info/variables/${
52
+ this.args.templateMode ? '--ref-uuid4-' : ''
53
+ }${uuidv4()}`;
49
54
 
50
55
  const placeholder = this.intl.t('variable.location.label', {
51
56
  locale: this.documentLanguage,
@@ -17,6 +17,7 @@ import { replaceSelectionWithAndSelectNode } from '@lblod/ember-rdfa-editor-lblo
17
17
 
18
18
  type Args = {
19
19
  controller: SayController;
20
+ templateMode?: boolean;
20
21
  };
21
22
 
22
23
  export default class NumberInsertComponent extends Component<Args> {
@@ -85,9 +86,13 @@ export default class NumberInsertComponent extends Component<Args> {
85
86
  insert() {
86
87
  if (this.numberVariableError !== '') return;
87
88
 
88
- const mappingResource = `http://data.lblod.info/mappings/${uuidv4()}`;
89
+ const mappingResource = `http://data.lblod.info/mappings/${
90
+ this.args.templateMode ? '--ref-uuid4-' : ''
91
+ }${uuidv4()}`;
92
+ const variableInstance = `http://data.lblod.info/variables/${
93
+ this.args.templateMode ? '--ref-uuid4-' : ''
94
+ }${uuidv4()}`;
89
95
  const subject = mappingResource;
90
- const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
91
96
 
92
97
  const defaultLabel = this.intl.t('variable.number.label', {
93
98
  locale: this.documentLanguage,
@@ -4,7 +4,8 @@ import { SayController, PNode } from '@lblod/ember-rdfa-editor';
4
4
  import { NodeSelection } from '@lblod/ember-rdfa-editor';
5
5
  import { tracked } from '@glimmer/tracking';
6
6
  import { LmbPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/lmb-plugin';
7
- import Mandatee from '@lblod/ember-rdfa-editor-lblod-plugins/models/mandatee';
7
+ import Electee from '@lblod/ember-rdfa-editor-lblod-plugins/models/electee';
8
+ import { Person } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/variables/person';
8
9
 
9
10
  type Args = {
10
11
  controller: SayController;
@@ -44,12 +45,11 @@ export default class PersonEditComponent extends Component<Args> {
44
45
 
45
46
  get isEditing() {
46
47
  const personNode = this.selectedPersonNode;
47
- return !!personNode?.node.attrs.mandatee;
48
+ return !!personNode?.node.attrs.value;
48
49
  }
49
50
 
50
51
  @action
51
52
  openModal() {
52
- console.log('Open modal!!!');
53
53
  this.controller.focus();
54
54
  this.showModal = true;
55
55
  }
@@ -59,16 +59,16 @@ export default class PersonEditComponent extends Component<Args> {
59
59
  this.showModal = false;
60
60
  }
61
61
  @action
62
- onInsert(mandatee: Mandatee) {
62
+ onInsert(electee: Electee) {
63
63
  const personNode = this.selectedPersonNode as PersonNode;
64
- this.controller.withTransaction((tr) => {
65
- tr.setNodeAttribute(personNode.pos, 'mandatee', mandatee);
66
- return tr.setNodeAttribute(
67
- personNode.pos,
68
- 'content',
69
- mandatee.mandateeUri,
70
- );
71
- });
64
+ const person: Person = {
65
+ uri: electee.uri,
66
+ firstName: electee.firstName,
67
+ lastName: electee.lastName,
68
+ };
69
+ this.controller.withTransaction((tr) =>
70
+ tr.setNodeAttribute(personNode.pos, 'value', person),
71
+ );
72
72
  this.closeModal();
73
73
  }
74
74
  }
@@ -15,6 +15,7 @@ import { replaceSelectionWithAndSelectNode } from '@lblod/ember-rdfa-editor-lblo
15
15
 
16
16
  type Args = {
17
17
  controller: SayController;
18
+ templateMode?: boolean;
18
19
  };
19
20
 
20
21
  export default class PersonVariableInsertComponent extends Component<Args> {
@@ -40,8 +41,12 @@ export default class PersonVariableInsertComponent extends Component<Args> {
40
41
 
41
42
  @action
42
43
  insert() {
43
- const mappingSubject = `http://data.lblod.info/mappings/${uuidv4()}`;
44
- const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
44
+ const mappingSubject = `http://data.lblod.info/mappings/${
45
+ this.args.templateMode ? '--ref-uuid4-' : ''
46
+ }${uuidv4()}`;
47
+ const variableInstance = `http://data.lblod.info/variables/${
48
+ this.args.templateMode ? '--ref-uuid4-' : ''
49
+ }${uuidv4()}`;
45
50
  const variableId = uuidv4();
46
51
 
47
52
  const placeholder = this.intl.t('variable.person.label', {
@@ -3,7 +3,7 @@ import Component from '@glimmer/component';
3
3
  import { PNode, SayController } from '@lblod/ember-rdfa-editor';
4
4
  import { getOutgoingTriple } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
5
5
  import { EXT } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
6
- import Mandatee from '@lblod/ember-rdfa-editor-lblod-plugins/models/mandatee';
6
+ import { Person } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/variables';
7
7
 
8
8
  type Args = {
9
9
  getPos: () => number | undefined;
@@ -20,22 +20,22 @@ export default class PersonNodeviewComponent extends Component<Args> {
20
20
  return this.args.node;
21
21
  }
22
22
 
23
- get mandatee() {
24
- return this.node.attrs.mandatee as Mandatee | null;
23
+ get person() {
24
+ return this.node.attrs.value as Person | null;
25
25
  }
26
26
 
27
27
  get label() {
28
- if (this.mandatee) return '';
28
+ if (this.person) return '';
29
29
  return getOutgoingTriple(this.node.attrs, EXT('label'))?.object.value;
30
30
  }
31
31
 
32
32
  get filled() {
33
- return !!this.mandatee;
33
+ return !!this.person;
34
34
  }
35
35
 
36
36
  get content() {
37
- if (this.filled) {
38
- return this.mandatee?.fullName;
37
+ if (this.person) {
38
+ return `${this.person.firstName} ${this.person.lastName}`;
39
39
  } else {
40
40
  return this.label;
41
41
  }