@lblod/ember-rdfa-editor-lblod-plugins 25.2.0 → 25.2.1-dev.3f3b7d0dfbeef50aaf66f35c51097fc42ad192cd

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 (56) hide show
  1. package/.changeset/metal-bags-pump.md +5 -0
  2. package/.changeset/twelve-mugs-think.md +9 -0
  3. package/.changeset/wild-walls-turn.md +17 -0
  4. package/CHANGELOG.md +8 -0
  5. package/addon/components/lmb-plugin/insert.ts +10 -3
  6. package/addon/components/lmb-plugin/list.hbs +16 -22
  7. package/addon/components/lmb-plugin/search-modal.ts +11 -11
  8. package/addon/components/location-plugin/nodeview.gts +16 -28
  9. package/addon/components/variable-plugin/address/nodeview.hbs +4 -18
  10. package/addon/components/variable-plugin/address/nodeview.ts +12 -23
  11. package/addon/components/variable-plugin/autofilled/insert.gts +3 -2
  12. package/addon/components/variable-plugin/codelist/insert.ts +1 -1
  13. package/addon/components/variable-plugin/date/nodeview.hbs +4 -12
  14. package/addon/components/variable-plugin/date/nodeview.ts +5 -23
  15. package/addon/components/variable-plugin/location/insert.ts +4 -2
  16. package/addon/components/variable-plugin/number/nodeview.hbs +4 -19
  17. package/addon/components/variable-plugin/number/nodeview.ts +12 -10
  18. package/addon/components/variable-plugin/person/edit.ts +12 -12
  19. package/addon/components/variable-plugin/person/nodeview.hbs +4 -18
  20. package/addon/components/variable-plugin/person/nodeview.ts +16 -23
  21. package/addon/components/variable-plugin/text/insert.ts +1 -1
  22. package/addon/components/variable-plugin/variable/nodeview.hbs +2 -8
  23. package/addon/components/variable-plugin/variable/nodeview.ts +16 -7
  24. package/addon/models/electee.ts +22 -0
  25. package/addon/plugins/lmb-plugin/index.ts +7 -9
  26. package/addon/plugins/lmb-plugin/utils/fetchElectees.ts +163 -0
  27. package/addon/plugins/variable-plugin/variables/autofilled.ts +2 -2
  28. package/addon/plugins/variable-plugin/variables/location.ts +2 -3
  29. package/addon/plugins/variable-plugin/variables/person.ts +27 -10
  30. package/addon/utils/namespace.ts +4 -1
  31. package/app/styles/variable-plugin.scss +21 -26
  32. package/declarations/addon/components/lmb-plugin/insert.d.ts +2 -2
  33. package/declarations/addon/components/lmb-plugin/search-modal.d.ts +6 -6
  34. package/declarations/addon/components/location-plugin/nodeview.d.ts +2 -3
  35. package/declarations/addon/components/variable-plugin/address/nodeview.d.ts +2 -8
  36. package/declarations/addon/components/variable-plugin/date/nodeview.d.ts +2 -6
  37. package/declarations/addon/components/variable-plugin/number/nodeview.d.ts +2 -4
  38. package/declarations/addon/components/variable-plugin/person/edit.d.ts +2 -2
  39. package/declarations/addon/components/variable-plugin/person/nodeview.d.ts +4 -9
  40. package/declarations/addon/components/variable-plugin/variable/nodeview.d.ts +2 -2
  41. package/declarations/addon/models/electee.d.ts +10 -0
  42. package/declarations/addon/plugins/lmb-plugin/index.d.ts +2 -2
  43. package/declarations/addon/plugins/lmb-plugin/utils/{fetchMandatees.d.ts → fetchElectees.d.ts} +4 -4
  44. package/declarations/addon/plugins/variable-plugin/variables/person.d.ts +5 -0
  45. package/package.json +3 -3
  46. package/pnpm-lock.yaml +24 -17
  47. package/translations/en-US.yaml +12 -11
  48. package/translations/nl-BE.yaml +9 -10
  49. package/addon/components/variable-plugin/autofilled/nodeview.gts +0 -100
  50. package/addon/components/variable-plugin/location/nodeview.hbs +0 -24
  51. package/addon/components/variable-plugin/location/nodeview.ts +0 -46
  52. package/addon/models/mandatee.ts +0 -35
  53. package/addon/plugins/lmb-plugin/utils/fetchMandatees.ts +0 -143
  54. package/declarations/addon/components/variable-plugin/autofilled/nodeview.d.ts +0 -22
  55. package/declarations/addon/components/variable-plugin/location/nodeview.d.ts +0 -11
  56. package/declarations/addon/models/mandatee.d.ts +0 -13
@@ -0,0 +1,5 @@
1
+ ---
2
+ '@lblod/ember-rdfa-editor-lblod-plugins': patch
3
+ ---
4
+
5
+ person-variable plugin: remove unused `content` node-attribute
@@ -0,0 +1,9 @@
1
+ ---
2
+ '@lblod/ember-rdfa-editor-lblod-plugins': major
3
+ ---
4
+
5
+ Adjustments to `lmb-plugin`:
6
+ - Rework `fetchMandatees` queries into `fetchElectees`
7
+ * Fetches all electees for a certain legislation period + all non-elected people with a mandate
8
+ * Replace `Mandatee` model by simpler `Electee` model
9
+ - Adjust UI components to reflect the `Mandatee` to `Electee` change
@@ -0,0 +1,17 @@
1
+ ---
2
+ '@lblod/ember-rdfa-editor-lblod-plugins': major
3
+ ---
4
+
5
+ Adjustments to `person` variable:
6
+ - Removal of unused `content` attribute
7
+ - Removal of `mandatee` attribute. Replaced by `value` attribute which contains an object of type `Person`.
8
+ ```ts
9
+ type Person = {
10
+ uri: string;
11
+ firstName: string;
12
+ lastName: string;
13
+ };
14
+ ```
15
+ - Adjust parsing rules of `person_variable` nodespec to work with old and new serializations
16
+ - Is now more generic, instead of relying on `Mandatee` instances
17
+
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @lblod/ember-rdfa-editor-lblod-plugins
2
2
 
3
+ ## 25.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#497](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/497) [`2b4b401`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/2b4b4011e3d66c23f232bf6690ca80a5b0a90298) Thanks [@lagartoverde](https://github.com/lagartoverde)! - Redesign variable pills
8
+
9
+ - [#497](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/497) [`2b4b401`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/2b4b4011e3d66c23f232bf6690ca80a5b0a90298) Thanks [@lagartoverde](https://github.com/lagartoverde)! - Bump ember-rdfa-editor to 10.7.3
10
+
3
11
  ## 25.2.0
4
12
 
5
13
  ### Minor 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,6 +16,7 @@ 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;
@@ -44,11 +45,17 @@ export default class LmbPluginInsertComponent extends Component<Args> {
44
45
  }
45
46
 
46
47
  @action
47
- onInsert(mandatee: Mandatee) {
48
+ onInsert(electee: Electee) {
48
49
  const mappingSubject = `http://data.lblod.info/mappings/${uuidv4()}`;
49
50
  const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
50
51
  const variableId = uuidv4();
51
52
 
53
+ const person: Person = {
54
+ uri: electee.uri,
55
+ firstName: electee.firstName,
56
+ lastName: electee.lastName,
57
+ };
58
+
52
59
  const label = this.intl.t('variable.person.label', {
53
60
  locale: this.controller.documentLanguage,
54
61
  });
@@ -56,7 +63,7 @@ export default class LmbPluginInsertComponent extends Component<Args> {
56
63
  subject: mappingSubject,
57
64
  rdfaNodeType: 'resource',
58
65
  __rdfaId: variableId,
59
- mandatee,
66
+ value: person,
60
67
  properties: [
61
68
  {
62
69
  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
  }
@@ -2,7 +2,6 @@ import Component from '@glimmer/component';
2
2
  import { service } from '@ember/service';
3
3
  import { on } from '@ember/modifier';
4
4
  import IntlService from 'ember-intl/services/intl';
5
- import { PencilIcon } from '@appuniversum/ember-appuniversum/components/icons/pencil';
6
5
  import AuPill, {
7
6
  type AuPillSignature,
8
7
  } from '@appuniversum/ember-appuniversum/components/au-pill';
@@ -25,14 +24,6 @@ type Signature = {
25
24
  export default class AddressNodeviewComponent extends Component<Signature> {
26
25
  @service declare intl: IntlService;
27
26
 
28
- get translations() {
29
- return {
30
- placeholder: this.intl.t('editor-plugins.address.nodeview.placeholder', {
31
- locale: this.args.controller.documentLanguage,
32
- }),
33
- };
34
- }
35
-
36
27
  get address() {
37
28
  return this.args.node.attrs.value as Address | null;
38
29
  }
@@ -42,26 +33,23 @@ export default class AddressNodeviewComponent extends Component<Signature> {
42
33
  return getOutgoingTriple(this.args.node.attrs, EXT('label'))?.object.value;
43
34
  }
44
35
 
36
+ get filled() {
37
+ return !!this.address;
38
+ }
39
+
40
+ get content() {
41
+ if (this.filled) {
42
+ return this.address?.formatted;
43
+ } else {
44
+ return this.label;
45
+ }
46
+ }
47
+
45
48
  <template>
46
- <AuPill
47
- class='variable atomic'
48
- @icon={{PencilIcon}}
49
- @iconAlignment='right'
50
- ...attributes
51
- {{on 'click' @selectNode}}
52
- >
53
- {{#if this.address}}
54
- {{this.address.formatted}}
55
- {{else}}
56
- <span class='mark-highlight-manual'>
57
- {{this.translations.placeholder}}
58
- </span>
59
- {{/if}}
60
- {{#if this.label}}
61
- <span class='label'>
62
- ({{this.label}})
63
- </span>
64
- {{/if}}
49
+ <AuPill class='say-pill atomic' ...attributes {{on 'click' @selectNode}}>
50
+ <span class='{{unless this.filled "unfilled-variable"}}'>
51
+ {{this.content}}
52
+ </span>
65
53
  </AuPill>
66
54
  </template>
67
55
  }
@@ -1,20 +1,6 @@
1
1
  {{! @glint-nocheck: not typesafe yet }}
2
- <AuPill
3
- @icon={{this.PencilIcon}}
4
- @iconAlignment='right'
5
- class='variable atomic'
6
- {{on 'click' @selectNode}}
7
- >
8
- {{#if this.address}}
9
- {{this.address.formatted}}
10
- {{else}}
11
- <span class='mark-highlight-manual'>
12
- {{this.translations.placeholder}}
13
- </span>
14
- {{/if}}
15
- {{#if this.label}}
16
- <span class='label'>
17
- ({{this.label}})
18
- </span>
19
- {{/if}}
2
+ <AuPill class='say-pill atomic' {{on 'click' @selectNode}}>
3
+ <span class='{{unless this.filled "unfilled-variable"}}'>
4
+ {{this.content}}
5
+ </span>
20
6
  </AuPill>
@@ -1,7 +1,4 @@
1
1
  import Component from '@glimmer/component';
2
- import { service } from '@ember/service';
3
- import IntlService from 'ember-intl/services/intl';
4
- import { PencilIcon } from '@appuniversum/ember-appuniversum/components/icons/pencil';
5
2
 
6
3
  import { PNode, SayController } from '@lblod/ember-rdfa-editor';
7
4
  import { Address } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/address-helpers';
@@ -15,26 +12,6 @@ type Args = {
15
12
  };
16
13
 
17
14
  export default class AddressNodeviewComponent extends Component<Args> {
18
- PencilIcon = PencilIcon;
19
-
20
- @service declare intl: IntlService;
21
-
22
- get controller() {
23
- return this.args.controller;
24
- }
25
-
26
- get documentLanguage() {
27
- return this.controller.documentLanguage;
28
- }
29
-
30
- get translations() {
31
- return {
32
- placeholder: this.intl.t('editor-plugins.address.nodeview.placeholder', {
33
- locale: this.documentLanguage,
34
- }),
35
- };
36
- }
37
-
38
15
  get node() {
39
16
  return this.args.node;
40
17
  }
@@ -47,4 +24,16 @@ export default class AddressNodeviewComponent extends Component<Args> {
47
24
  if (this.address) return '';
48
25
  return getOutgoingTriple(this.node.attrs, EXT('label'))?.object.value;
49
26
  }
27
+
28
+ get filled() {
29
+ return !!this.address;
30
+ }
31
+
32
+ get content() {
33
+ if (this.filled) {
34
+ return this.address?.formatted;
35
+ } else {
36
+ return this.label;
37
+ }
38
+ }
50
39
  }
@@ -68,7 +68,8 @@ export default class AutoFilledVariableInsertComponent extends Component<Args> {
68
68
  locale: this.documentLanguage,
69
69
  });
70
70
 
71
- const label = this.label != '' ? this.label : placeholder;
71
+ const label =
72
+ this.label != '' ? this.label : this.autofillKey || placeholder;
72
73
  const node = this.schema.nodes.autofilled_variable.create(
73
74
  {
74
75
  subject: mappingSubject,
@@ -101,7 +102,7 @@ export default class AutoFilledVariableInsertComponent extends Component<Args> {
101
102
  },
102
103
 
103
104
  this.schema.node('placeholder', {
104
- placeholderText: `Autofill ${this.autofillKey}`,
105
+ placeholderText: label,
105
106
  }),
106
107
  );
107
108
  this.label = '';
@@ -137,7 +137,7 @@ export default class CodelistInsertComponent extends Component<Args> {
137
137
  ],
138
138
  },
139
139
  this.schema.node('placeholder', {
140
- placeholderText: this.selectedCodelist?.label,
140
+ placeholderText: label,
141
141
  }),
142
142
  );
143
143
 
@@ -1,14 +1,6 @@
1
1
  {{! @glint-nocheck: not typesafe yet }}
2
- <AuPill
3
- @icon={{this.PencilIcon}}
4
- @iconAlignment='right'
5
- class='variable atomic'
6
- {{on 'click' @selectNode}}
7
- >
8
- {{this.humanReadableDate}}
9
- {{#if this.label}}
10
- <span class='label'>
11
- ({{this.label}})
12
- </span>
13
- {{/if}}
2
+ <AuPill class='say-pill atomic' {{on 'click' @selectNode}}>
3
+ <span class='{{unless this.filled "unfilled-variable"}}'>
4
+ {{this.humanReadableDate}}
5
+ </span>
14
6
  </AuPill>
@@ -5,15 +5,12 @@ import {
5
5
  SayController,
6
6
  SayView,
7
7
  } from '@lblod/ember-rdfa-editor';
8
- import IntlService from 'ember-intl/services/intl';
9
- import { service } from '@ember/service';
10
8
  import {
11
9
  formatDate,
12
10
  validateDateFormat,
13
11
  } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/date-helpers';
14
12
  import { getOutgoingTriple } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
15
13
  import { EXT } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
16
- import { PencilIcon } from '@appuniversum/ember-appuniversum/components/icons/pencil';
17
14
 
18
15
  type Args = {
19
16
  getPos: () => number | undefined;
@@ -26,16 +23,10 @@ type Args = {
26
23
  };
27
24
 
28
25
  export default class DateNodeviewComponent extends Component<Args> {
29
- PencilIcon = PencilIcon;
30
-
31
- @service declare intl: IntlService;
32
-
33
- get controller() {
34
- return this.args.controller;
35
- }
36
-
37
- get documentLanguage() {
38
- return this.controller.documentLanguage;
26
+ get filled() {
27
+ const value = getOutgoingTriple(this.args.node.attrs, EXT('content'))
28
+ ?.object.value;
29
+ return !!value;
39
30
  }
40
31
 
41
32
  get humanReadableDate() {
@@ -49,20 +40,11 @@ export default class DateNodeviewComponent extends Component<Args> {
49
40
  return 'Ongeldig formaat';
50
41
  }
51
42
  } else {
52
- return (this.args.node.attrs.onlyDate as boolean)
53
- ? this.intl.t('date-plugin.insert.date', {
54
- locale: this.documentLanguage,
55
- })
56
- : this.intl.t('date-plugin.insert.datetime', {
57
- locale: this.documentLanguage,
58
- });
43
+ return this.label;
59
44
  }
60
45
  }
61
46
 
62
47
  get label() {
63
- const value = getOutgoingTriple(this.args.node.attrs, EXT('content'))
64
- ?.object.value;
65
- if (value) return '';
66
48
  return getOutgoingTriple(this.args.node.attrs, EXT('label'))?.object.value;
67
49
  }
68
50
  }
@@ -51,15 +51,17 @@ export default class LocationInsertComponent extends Component<Args> {
51
51
  locale: this.documentLanguage,
52
52
  });
53
53
 
54
+ const label = this.label ?? placeholder;
55
+
54
56
  const node = this.schema.nodes.location.create(
55
57
  {
56
58
  mappingResource,
57
59
  variableInstance,
58
- label: this.label ?? placeholder,
60
+ label: label,
59
61
  source: this.endpoint,
60
62
  },
61
63
  this.schema.node('placeholder', {
62
- placeholderText: placeholder,
64
+ placeholderText: label,
63
65
  }),
64
66
  );
65
67
 
@@ -4,25 +4,10 @@
4
4
  @offsetOptions={{hash mainAxis=3}}
5
5
  as |velcro|
6
6
  >
7
- <AuPill
8
- @icon={{this.PencilIcon}}
9
- @iconAlignment='right'
10
- class='variable atomic'
11
- {{velcro.hook}}
12
- {{on 'click' @selectNode}}
13
- >
14
- {{#if this.formattedNumber}}
15
- {{this.formattedNumber}}
16
- {{else}}
17
- <span class='mark-highlight-manual'>
18
- {{this.translations.placeholder}}
19
- </span>
20
- {{/if}}
21
- {{#if this.label}}
22
- <span class='label'>
23
- ({{this.label}})
24
- </span>
25
- {{/if}}
7
+ <AuPill class='say-pill atomic' {{velcro.hook}} {{on 'click' @selectNode}}>
8
+ <span class='{{unless this.filled "unfilled-variable"}}'>
9
+ {{this.content}}
10
+ </span>
26
11
  </AuPill>
27
12
  {{#if this.selected}}
28
13
  <div class='say-tooltip say-number-tooltip' {{velcro.loop}}>
@@ -17,7 +17,6 @@ import { isNumber } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/strings';
17
17
  import { numberToWords } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/number-to-words';
18
18
  import { EXT } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
19
19
  import { getOutgoingTriple } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
20
- import { PencilIcon } from '@appuniversum/ember-appuniversum/components/icons/pencil';
21
20
 
22
21
  type Args = {
23
22
  getPos: () => number | undefined;
@@ -31,7 +30,6 @@ type Args = {
31
30
  };
32
31
 
33
32
  export default class NumberNodeviewComponent extends Component<Args> {
34
- PencilIcon = PencilIcon;
35
33
  Velcro = Velcro;
36
34
 
37
35
  @localCopy('number', '') declare inputNumber: string;
@@ -52,14 +50,6 @@ export default class NumberNodeviewComponent extends Component<Args> {
52
50
  return this.controller.documentLanguage;
53
51
  }
54
52
 
55
- get translations() {
56
- return {
57
- placeholder: this.intl.t('variable.number.placeholder', {
58
- locale: this.documentLanguage,
59
- }),
60
- };
61
- }
62
-
63
53
  get node() {
64
54
  return this.args.node;
65
55
  }
@@ -80,6 +70,18 @@ export default class NumberNodeviewComponent extends Component<Args> {
80
70
  }
81
71
  }
82
72
 
73
+ get filled() {
74
+ return !!this.formattedNumber;
75
+ }
76
+
77
+ get content() {
78
+ if (this.filled) {
79
+ return this.formattedNumber;
80
+ } else {
81
+ return this.label;
82
+ }
83
+ }
84
+
83
85
  get selected() {
84
86
  return this.args.selected;
85
87
  }
@@ -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.electee;
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
  }
@@ -1,20 +1,6 @@
1
1
  {{! @glint-nocheck: not typesafe yet }}
2
- <AuPill
3
- @icon={{this.PencilIcon}}
4
- @iconAlignment='right'
5
- class='variable atomic'
6
- {{on 'click' @selectNode}}
7
- >
8
- {{#if this.mandatee}}
9
- {{this.mandatee.fullName}}
10
- {{else}}
11
- <span class='mark-highlight-manual'>
12
- {{this.translations.placeholder}}
13
- </span>
14
- {{/if}}
15
- {{#if this.label}}
16
- <span class='label'>
17
- ({{this.label}})
18
- </span>
19
- {{/if}}
2
+ <AuPill class='say-pill atomic' {{on 'click' @selectNode}}>
3
+ <span class='{{unless this.filled "unfilled-variable"}}'>
4
+ {{this.content}}
5
+ </span>
20
6
  </AuPill>