@lblod/ember-rdfa-editor-lblod-plugins 11.1.0 → 11.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/.woodpecker/.changelog.yml +9 -0
  2. package/.woodpecker/.test.yml +0 -8
  3. package/CHANGELOG.md +14 -1
  4. package/README.md +14 -12
  5. package/addon/components/citation-plugin/citation-card.ts +22 -18
  6. package/addon/components/citation-plugin/citation-insert.hbs +0 -1
  7. package/addon/components/citation-plugin/citation-insert.ts +5 -7
  8. package/addon/components/citation-plugin/citations/decision-detail.ts +4 -5
  9. package/addon/components/citation-plugin/citations/decision-preview.hbs +61 -15
  10. package/addon/components/citation-plugin/citations/decision-preview.ts +19 -0
  11. package/addon/components/citation-plugin/citations/search-modal.hbs +49 -47
  12. package/addon/components/citation-plugin/citations/search-modal.ts +28 -17
  13. package/addon/components/variable-plugin/codelist/edit.ts +6 -1
  14. package/addon/components/variable-plugin/codelist/insert.hbs +16 -6
  15. package/addon/components/variable-plugin/codelist/insert.ts +40 -9
  16. package/addon/plugins/citation-plugin/index.ts +8 -2
  17. package/addon/plugins/citation-plugin/utils/article.ts +193 -0
  18. package/addon/plugins/citation-plugin/utils/cache.ts +7 -0
  19. package/addon/plugins/citation-plugin/utils/legal-documents.ts +133 -0
  20. package/addon/plugins/citation-plugin/utils/process-match.ts +60 -44
  21. package/addon/plugins/citation-plugin/utils/public-decisions.ts +228 -0
  22. package/addon/plugins/citation-plugin/utils/{legislation-types.ts → types.ts} +24 -18
  23. package/addon/plugins/citation-plugin/utils/utils.ts +14 -0
  24. package/addon/plugins/citation-plugin/utils/vlaamse-codex.ts +29 -390
  25. package/addon/plugins/variable-plugin/utils/attribute-parsers.ts +4 -0
  26. package/addon/plugins/variable-plugin/variables/codelist.ts +15 -2
  27. package/components/citation-plugin/citation-card.d.ts +11 -14
  28. package/components/citation-plugin/citation-insert.d.ts +4 -3
  29. package/components/citation-plugin/citations/decision-detail.d.ts +3 -3
  30. package/components/citation-plugin/citations/decision-preview.d.ts +10 -0
  31. package/components/citation-plugin/citations/search-modal.d.ts +15 -16
  32. package/components/variable-plugin/codelist/insert.d.ts +18 -4
  33. package/package.json +4 -3
  34. package/plugins/citation-plugin/index.d.ts +2 -1
  35. package/plugins/citation-plugin/utils/article.d.ts +29 -0
  36. package/plugins/citation-plugin/utils/cache.d.ts +1 -0
  37. package/plugins/citation-plugin/utils/legal-documents.d.ts +48 -0
  38. package/plugins/citation-plugin/utils/public-decisions.d.ts +8 -0
  39. package/plugins/citation-plugin/utils/types.d.ts +28 -0
  40. package/plugins/citation-plugin/utils/utils.d.ts +1 -0
  41. package/plugins/citation-plugin/utils/vlaamse-codex.d.ts +7 -69
  42. package/plugins/variable-plugin/utils/attribute-parsers.d.ts +1 -0
  43. package/translations/en-US.yaml +7 -1
  44. package/translations/nl-BE.yaml +7 -1
  45. package/plugins/citation-plugin/utils/legislation-types.d.ts +0 -24
@@ -0,0 +1,9 @@
1
+ steps:
2
+ changelog:
3
+ image: danlynn/ember-cli:4.8.0
4
+ commands:
5
+ - git fetch origin master
6
+ - git diff -wb --name-only origin/master..HEAD | grep CHANGELOG.md
7
+ when:
8
+ event: pull_request
9
+ evaluate: 'not (CI_COMMIT_PULL_REQUEST_LABELS contains "dependabot")'
@@ -1,12 +1,4 @@
1
1
  steps:
2
- changelog:
3
- image: danlynn/ember-cli:4.8.0
4
- commands:
5
- - git fetch origin master
6
- - git diff -wb --name-only origin/master..HEAD | grep CHANGELOG.md
7
- when:
8
- event: pull_request
9
- evaluate: 'not (CI_COMMIT_PULL_REQUEST_LABELS contains "dependabot")'
10
2
  install:
11
3
  image: danlynn/ember-cli:4.8.0
12
4
  commands:
package/CHANGELOG.md CHANGED
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [11.3.0] - 2023-09-06
11
+
12
+ ### Changed
13
+ - CI: move changelog check to seperate CI pipeline
14
+
15
+ ### Added
16
+ - GN-4266: Referring to published decisions
17
+ ## [11.2.0] - 2023-09-04
18
+ ### Added
19
+ - ember-modifier is now explicitely a peerDependency
20
+ - GN4470: ability to specifly single/multi-select per codelist instance
10
21
  ## [11.1.0] - 2023-08-29
11
22
 
12
23
  ### Fixed
@@ -691,7 +702,7 @@ add onclick handler to pencil icon in variable plugin
691
702
 
692
703
  # Changelog
693
704
 
694
- [unreleased]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v11.1.0...HEAD
705
+ [unreleased]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v11.3.0...HEAD
695
706
  [8.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v8.0.0...v8.0.1
696
707
  [8.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v7.1.0...v8.0.0
697
708
  [7.1.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v7.0.0...v7.1.0
@@ -707,6 +718,8 @@ add onclick handler to pencil icon in variable plugin
707
718
  [3.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v2.1.2...v3.0.0
708
719
  [2.1.2]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v2.1.1...v2.1.2
709
720
  [2.1.1]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v2.1.0...v2.1.1
721
+ [11.3.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v11.2.0...v11.3.0
722
+ [11.2.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v11.1.0...v11.2.0
710
723
  [11.1.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v11.0.0...v11.1.0
711
724
  [11.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v10.0.0...v11.0.0
712
725
  [10.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v9.1.1...v10.0.0
package/README.md CHANGED
@@ -235,7 +235,7 @@ With these changes you will see a warning if the decision is missing a title, a
235
235
 
236
236
  Plugin which allows a user to insert references to a legal resource or legal expression into the document.
237
237
 
238
- This plugin provides a card that needs to be added to the sidebar of the editor like
238
+ This plugin provides a card that shows up when using certain keywords. This needs to be added to the sidebar of the editor like
239
239
  ```hbs
240
240
  <CitationPlugin::CitationCard
241
241
  @controller={{this.controller}}
@@ -244,14 +244,7 @@ This plugin provides a card that needs to be added to the sidebar of the editor
244
244
  />
245
245
  ```
246
246
 
247
- You need to specify the endpoint for the plugin in the config object
248
- ```js
249
- {
250
- endpoint: 'https://codex.opendata.api.vlaanderen.be:8888/sparql'
251
- }
252
- ```
253
-
254
- Same goes for the `CitationInsert` component
247
+ Same goes for the `CitationInsert` component, with which you can directly insert a citation
255
248
  ```hbs
256
249
  <CitationPlugin::CitationInsert
257
250
  @controller={{this.controller}}
@@ -259,6 +252,16 @@ Same goes for the `CitationInsert` component
259
252
  />
260
253
  ```
261
254
 
255
+ You need to specify the endpoints for the plugin in the config object
256
+ ```js
257
+ {
258
+ endpoint: 'https://codex.opendata.api.vlaanderen.be:8888/sparql'
259
+ decisionsEndpoint: 'https://https://publicatie.gelinkt-notuleren.vlaanderen.be/sparql'
260
+ }
261
+ ```
262
+
263
+ The `decisionsEndpoint` is optional, and is required if you want to display decisions from the Publicatie.
264
+
262
265
 
263
266
  Make `this.citationPlugin` a tracked reference to the plugin created with the function exported from the package and the wished configuration
264
267
  ```js
@@ -307,7 +310,7 @@ const configB = {
307
310
 
308
311
  If used with the example configuration provided this plugin can be triggered by typing one of the following in the correct RDFa context (
309
312
  the [besluit:motivering](http://data.vlaanderen.be/ns/besluit#motivering) of
310
- a [besluit:Besluit](https://data.vlaanderen.be/ns/besluit#Besluit)).
313
+ a [besluit:Besluit](https://data.vlaanderen.be/ns/besluit#Besluit)).These will make `CitationCard` visible with the typed search terms.
311
314
 
312
315
  * [specification]**decreet** [words to search for] *(e.g. "gemeentedecreet wijziging")*
313
316
  * **omzendbrief** [words to search for]
@@ -323,8 +326,7 @@ a [besluit:Besluit](https://data.vlaanderen.be/ns/besluit#Besluit)).
323
326
  * **ministerieel besluit** [words to search for]
324
327
  * **genummerd besluit** [words to search for]
325
328
 
326
- You should be able to add a reference manually by clicking on the `Insert` > `Insert reference` item in the Insert menu
327
- located on the top right of the editor. This will open the advanced search window. **Note** that this will only be
329
+ You can also add a reference manually by clicking on the `Insert` > `Insert reference` item in the Insert menu located on the top right of the editor (this is the `CitationInsert` component). This will open the advanced search window. **Note** that this will only be
328
330
  avaliable in the proper context (see above in this section).
329
331
 
330
332
  ## import-snippet-plugin
@@ -3,12 +3,6 @@ import { tracked } from '@glimmer/tracking';
3
3
  import { restartableTask, timeout } from 'ember-concurrency';
4
4
  import { action } from '@ember/object';
5
5
  import { capitalize } from '@ember/string';
6
- import {
7
- Article,
8
- cleanCaches,
9
- Decision,
10
- fetchDecisions,
11
- } from '../../plugins/citation-plugin/utils/vlaamse-codex';
12
6
  import { task as trackedTask } from 'ember-resources/util/ember-concurrency';
13
7
  import {
14
8
  Option,
@@ -18,22 +12,28 @@ import {
18
12
  import {
19
13
  CitationDecoration,
20
14
  CitationPlugin,
15
+ CitationPluginEmberComponentConfig,
21
16
  } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin';
22
17
  import { SayController, Transaction } from '@lblod/ember-rdfa-editor';
23
18
  import { citedText } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/cited-text';
24
19
  import {
25
- LEGISLATION_TYPES,
26
20
  LEGISLATION_TYPE_CONCEPTS,
27
- } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/legislation-types';
21
+ legislationKeysCapitalized,
22
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/types';
23
+ import { Article } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/article';
24
+ import {
25
+ fetchLegalDocuments,
26
+ LegalDocument,
27
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/legal-documents';
28
+ import { cleanCaches } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/cache';
28
29
 
29
30
  interface Args {
30
31
  controller: SayController;
31
32
  plugin: CitationPlugin;
32
- config: {
33
- endpoint: string;
34
- };
33
+ config: CitationPluginEmberComponentConfig;
35
34
  }
36
35
 
36
+ /* A component card that will only show up when certain keywords are typed */
37
37
  export default class CitationCardComponent extends Component<Args> {
38
38
  @tracked pageNumber = 0;
39
39
  @tracked pageSize = 5;
@@ -42,7 +42,7 @@ export default class CitationCardComponent extends Component<Args> {
42
42
  @tracked decisions = [];
43
43
  @tracked error: unknown;
44
44
  @tracked showModal = false;
45
- @tracked decision: Decision | null = null;
45
+ @tracked decision: LegalDocument | null = null;
46
46
  @tracked cardText: string | null = null;
47
47
  @tracked cardLegislationType: string | null = null;
48
48
  @tracked documentLegislationType: Option<string>;
@@ -91,7 +91,11 @@ export default class CitationCardComponent extends Component<Args> {
91
91
  }
92
92
 
93
93
  get legislationTypes() {
94
- return Object.keys(LEGISLATION_TYPES).map(capitalize);
94
+ if (this.config.decisionsEndpoint) {
95
+ return legislationKeysCapitalized;
96
+ }
97
+
98
+ return legislationKeysCapitalized.filter((key) => key !== 'Besluit');
95
99
  }
96
100
 
97
101
  get selectedLegislationType() {
@@ -128,7 +132,7 @@ export default class CitationCardComponent extends Component<Args> {
128
132
  const filter = {
129
133
  type: unwrapOr('', this.selectedLegislationTypeUri),
130
134
  };
131
- const results = await fetchDecisions({
135
+ const results = await fetchLegalDocuments({
132
136
  words: words,
133
137
  filter: filter,
134
138
  pageNumber: this.pageNumber,
@@ -136,7 +140,7 @@ export default class CitationCardComponent extends Component<Args> {
136
140
  config: this.args.config,
137
141
  });
138
142
  this.totalCount = results.totalCount;
139
- return results.decisions;
143
+ return results.legalDocuments;
140
144
  } catch (e) {
141
145
  console.warn(e); // eslint-ignore-line no-console
142
146
  this.totalCount = 0;
@@ -167,7 +171,7 @@ export default class CitationCardComponent extends Component<Args> {
167
171
  }
168
172
 
169
173
  @action
170
- openDecisionDetailModal(decision: Decision): void {
174
+ openDecisionDetailModal(decision: LegalDocument): void {
171
175
  this.decision = decision;
172
176
  /** why focus? see {@link EditorPluginsCitationInsertComponent.openModal } */
173
177
  this.focus();
@@ -195,7 +199,7 @@ export default class CitationCardComponent extends Component<Args> {
195
199
  }
196
200
 
197
201
  @action
198
- insertDecisionCitation(decision: Decision): void {
202
+ insertDecisionCitation(decision: LegalDocument): void {
199
203
  const uri = decision.uri;
200
204
  const title = decision.title ?? '';
201
205
  const { from, to } = unwrap(this.activeDecoration);
@@ -214,7 +218,7 @@ export default class CitationCardComponent extends Component<Args> {
214
218
  }
215
219
 
216
220
  @action
217
- insertArticleCitation(decision: Decision, article: Article): void {
221
+ insertArticleCitation(decision: LegalDocument, article: Article): void {
218
222
  const uri = article.uri;
219
223
  let title = '';
220
224
  if (decision.title) {
@@ -16,7 +16,6 @@
16
16
  @insertDecisionCitation={{this.insertDecisionCitation}}
17
17
  @insertArticleCitation={{this.insertArticleCitation}}
18
18
  @legislationTypeUri={{this.selectedLegislationTypeUri}}
19
-
20
19
  @selectLegislationType={{this.selectLegislationType}}
21
20
  @text={{this.text}}
22
21
  @config={{this.config}}
@@ -7,18 +7,16 @@ import {
7
7
  Slice,
8
8
  Transaction,
9
9
  } from '@lblod/ember-rdfa-editor';
10
- import {
11
- Article,
12
- Decision,
13
- } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/vlaamse-codex';
14
10
  import { citedText } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/cited-text';
15
11
  import { CitationPluginEmberComponentConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin';
16
12
  import {
17
13
  LEGISLATION_TYPE_CONCEPTS,
18
14
  LEGISLATION_TYPES,
19
- } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/legislation-types';
15
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/types';
20
16
  import { unwrap } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
21
17
  import { findParentNodeOfType } from '@curvenote/prosemirror-utils';
18
+ import { Article } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/article';
19
+ import { LegalDocument } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/legal-documents';
22
20
 
23
21
  interface Args {
24
22
  controller: SayController;
@@ -106,7 +104,7 @@ export default class EditorPluginsCitationInsertComponent extends Component<Args
106
104
  }
107
105
 
108
106
  @action
109
- insertDecisionCitation(decision: Decision) {
107
+ insertDecisionCitation(decision: LegalDocument) {
110
108
  const type = decision.legislationType?.label || '';
111
109
  const uri = decision.uri;
112
110
  const title = decision.title ?? '';
@@ -129,7 +127,7 @@ export default class EditorPluginsCitationInsertComponent extends Component<Args
129
127
  }
130
128
 
131
129
  @action
132
- insertArticleCitation(decision: Decision, article: Article) {
130
+ insertArticleCitation(decision: LegalDocument, article: Article) {
133
131
  const type = decision.legislationType?.label || '';
134
132
  const uri = article.uri;
135
133
  let title = '';
@@ -2,14 +2,13 @@ import Component from '@glimmer/component';
2
2
  import { restartableTask, timeout } from 'ember-concurrency';
3
3
  import { tracked } from '@glimmer/tracking';
4
4
  import { action } from '@ember/object';
5
- import {
6
- Decision,
7
- fetchArticles,
8
- } from '../../../plugins/citation-plugin/utils/vlaamse-codex';
9
5
  import { task as trackedTask } from 'ember-resources/util/ember-concurrency';
10
6
 
7
+ import { LegalDocument } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/legal-documents';
8
+ import { fetchArticles } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/article';
9
+
11
10
  interface Args {
12
- decision: Decision;
11
+ decision: LegalDocument;
13
12
  close: () => void;
14
13
  config: { endpoint: string };
15
14
  }
@@ -21,13 +21,36 @@
21
21
  {{on "click" @onCitationInsert}}>
22
22
  {{t "citaten-plugin.references.insert"}}
23
23
  </AuButton>
24
- <AuButton
25
- @skin="secondary"
26
- @icon="manual"
27
- @iconAlignment="left"
28
- {{on "click" @onCitationDetails}}>
29
- {{t "citaten-plugin.references.details"}}
30
- </AuButton>
24
+ {{#if this.isBesluit}}
25
+ {{#if this.hasPublicationLink}}
26
+ <AuLinkExternal
27
+ @skin="button"
28
+ @icon="link-external"
29
+ @iconAlignment="left"
30
+ href={{@decision.meta.publicationLink}}
31
+ rel="noreferrer noopener">
32
+ {{t "citaten-plugin.references.lookup-publicatie"}}
33
+ </AuLinkExternal>
34
+ {{else}}
35
+ <AuButton
36
+ @skin='button'
37
+ @icon="link-external"
38
+ @iconAlignment="left"
39
+ @disabled={{true}}
40
+ >
41
+ {{t "citaten-plugin.references.publicatie-non-available"}}
42
+ </AuButton>
43
+ {{/if}}
44
+ {{else}}
45
+ <AuButton
46
+ @skin="secondary"
47
+ @icon="manual"
48
+ @iconAlignment="left"
49
+ {{on "click" @onCitationDetails}}>
50
+ {{t "citaten-plugin.references.details"}}
51
+ </AuButton>
52
+ {{/if}}
53
+
31
54
  </AuButtonGroup>
32
55
  </div>
33
56
  {{else}}
@@ -40,14 +63,37 @@
40
63
  {{on "click" @onCitationInsert}}>
41
64
  {{t "citaten-plugin.references.insert"}}
42
65
  </AuButton>
43
- <AuButton
44
- @skin="link"
45
- @icon="manual"
46
- @iconAlignment="left"
47
- class="au-u-h-functional"
48
- {{on "click" @onCitationDetails}}>
49
- {{t "citaten-plugin.references.details"}}
50
- </AuButton>
66
+ {{#if this.isBesluit}}
67
+ {{#if this.hasPublicationLink}}
68
+ <AuLinkExternal
69
+ @skin="link"
70
+ @icon="link-external"
71
+ @iconAlignment="left"
72
+ href={{@decision.meta.publicationLink}}
73
+ rel="noreferrer noopener"
74
+ class="au-u-h-functional"
75
+ >
76
+ {{t "citaten-plugin.references.lookup-publicatie-short"}}
77
+ </AuLinkExternal>
78
+ {{else}}
79
+ <AuButton
80
+ @skin='link'
81
+ @disabled={{true}}
82
+ class="au-u-h-functional"
83
+ >
84
+ {{t "citaten-plugin.references.publicatie-non-available-short"}}
85
+ </AuButton>
86
+ {{/if}}
87
+ {{else}}
88
+ <AuButton
89
+ @skin="link"
90
+ @icon="manual"
91
+ @iconAlignment="left"
92
+ class="au-u-h-functional"
93
+ {{on "click" @onCitationDetails}}>
94
+ {{t "citaten-plugin.references.details"}}
95
+ </AuButton>
96
+ {{/if}}
51
97
  </div>
52
98
  {{/if}}
53
99
  </div>
@@ -0,0 +1,19 @@
1
+ import Component from '@glimmer/component';
2
+ import {
3
+ isBesluitLegalDocument,
4
+ LegalDocument,
5
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/legal-documents';
6
+
7
+ interface Args {
8
+ decision: LegalDocument;
9
+ }
10
+
11
+ export default class DecisionPreviewComponent extends Component<Args> {
12
+ get isBesluit() {
13
+ return isBesluitLegalDocument(this.args.decision);
14
+ }
15
+
16
+ get hasPublicationLink() {
17
+ return this.isBesluit && this.args.decision.meta?.publicationLink;
18
+ }
19
+ }
@@ -118,55 +118,57 @@
118
118
  </AuFormRow>
119
119
 
120
120
  {{! Date of staatsblad }}
121
- <AuLabel
122
- class='au-u-margin-top au-u-margin-bottom-small'
123
- for='search-codex-datum-staatsblad-van'
124
- @inline={{false}}
125
- >{{t 'citaten-plugin.search.date-publication'}}</AuLabel>
126
- {{! From }}
127
- <AuFormRow @alignment='pre' class='au-u-margin-bottom-tiny'>
121
+ {{#unless this.isBesluitType}}
128
122
  <AuLabel
123
+ class='au-u-margin-top au-u-margin-bottom-small'
129
124
  for='search-codex-datum-staatsblad-van'
130
- class='au-u-hidden-visually'
131
- >{{t 'citaten-plugin.search.date-publication-from'}}</AuLabel>
132
- <AuLabel
133
- for='search-codex-datum-staatsblad-van'
134
- aria-hidden='true'
135
- class='au-u-1-4'
136
- @inline={{true}}
137
- >{{t 'citaten-plugin.search.from'}}</AuLabel>
138
- <AuDatePicker
139
- @id='search-codex-datum-staatsblad-van'
140
- @alignment='top'
141
- @onChange={{this.updatePublicationDateFrom}}
142
- @value={{this.publicationDateFrom}}
143
- @min={{this.minDate}}
144
- @max={{this.maxDate}}
145
- @localization={{this.datePickerLocalization}}
146
- />
147
- </AuFormRow>
148
- {{! To }}
149
- <AuFormRow @alignment='pre'>
150
- <AuLabel
151
- for='search-codex-datum-staatsblad-tot'
152
- class='au-u-hidden-visually'
153
- >{{t 'citaten-plugin.search.date-publication-to'}}</AuLabel>
154
- <AuLabel
155
- for='search-codex-datum-staatsblad-tot'
156
- aria-hidden='true'
157
- class='au-u-1-4'
158
- @inline={{true}}
159
- >{{t 'citaten-plugin.search.to'}}</AuLabel>
160
- <AuDatePicker
161
- @id='search-codex-datum-staatsblad-tot'
162
- @alignment='top'
163
- @onChange={{this.updatePublicationDateTo}}
164
- @value={{this.publicationDateTo}}
165
- @min={{this.minDate}}
166
- @max={{this.maxDate}}
167
- @localization={{this.datePickerLocalization}}
168
- />
169
- </AuFormRow>
125
+ @inline={{false}}
126
+ >{{t 'citaten-plugin.search.date-publication'}}</AuLabel>
127
+ {{! From }}
128
+ <AuFormRow @alignment='pre' class='au-u-margin-bottom-tiny'>
129
+ <AuLabel
130
+ for='search-codex-datum-staatsblad-van'
131
+ class='au-u-hidden-visually'
132
+ >{{t 'citaten-plugin.search.date-publication-from'}}</AuLabel>
133
+ <AuLabel
134
+ for='search-codex-datum-staatsblad-van'
135
+ aria-hidden='true'
136
+ class='au-u-1-4'
137
+ @inline={{true}}
138
+ >{{t 'citaten-plugin.search.from'}}</AuLabel>
139
+ <AuDatePicker
140
+ @id='search-codex-datum-staatsblad-van'
141
+ @alignment='top'
142
+ @onChange={{this.updatePublicationDateFrom}}
143
+ @value={{this.publicationDateFrom}}
144
+ @min={{this.minDate}}
145
+ @max={{this.maxDate}}
146
+ @localization={{this.datePickerLocalization}}
147
+ />
148
+ </AuFormRow>
149
+ {{! To }}
150
+ <AuFormRow @alignment='pre'>
151
+ <AuLabel
152
+ for='search-codex-datum-staatsblad-tot'
153
+ class='au-u-hidden-visually'
154
+ >{{t 'citaten-plugin.search.date-publication-to'}}</AuLabel>
155
+ <AuLabel
156
+ for='search-codex-datum-staatsblad-tot'
157
+ aria-hidden='true'
158
+ class='au-u-1-4'
159
+ @inline={{true}}
160
+ >{{t 'citaten-plugin.search.to'}}</AuLabel>
161
+ <AuDatePicker
162
+ @id='search-codex-datum-staatsblad-tot'
163
+ @alignment='top'
164
+ @onChange={{this.updatePublicationDateTo}}
165
+ @value={{this.publicationDateTo}}
166
+ @min={{this.minDate}}
167
+ @max={{this.maxDate}}
168
+ @localization={{this.datePickerLocalization}}
169
+ />
170
+ </AuFormRow>
171
+ {{/unless}}
170
172
  </div>
171
173
  </div>
172
174
  </mc.sidebar>
@@ -6,19 +6,22 @@ import { inject as service } from '@ember/service';
6
6
  import { capitalize } from '@ember/string';
7
7
  import { task as trackedTask } from 'ember-resources/util/ember-concurrency';
8
8
  import {
9
+ isBesluitType,
9
10
  LEGISLATION_TYPE_CONCEPTS,
10
11
  LEGISLATION_TYPES,
11
- } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/legislation-types';
12
- import {
13
- Article,
14
- Decision,
15
- fetchDecisions,
16
- } from '../../../plugins/citation-plugin/utils/vlaamse-codex';
12
+ legislationKeysCapitalized,
13
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/types';
14
+ import { CitationPluginEmberComponentConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin';
17
15
  import IntlService from 'ember-intl/services/intl';
18
16
  import {
19
17
  Option,
20
18
  unwrap,
21
19
  } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
20
+ import { Article } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/article';
21
+ import {
22
+ fetchLegalDocuments,
23
+ LegalDocument,
24
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/legal-documents';
22
25
 
23
26
  function getISODate(date: Option<Date>): string | null {
24
27
  if (date) {
@@ -34,13 +37,13 @@ function getISODate(date: Option<Date>): string | null {
34
37
  }
35
38
 
36
39
  interface Args {
37
- selectedDecision: Decision;
40
+ selectedDecision: LegalDocument;
38
41
  legislationTypeUri: string;
39
42
  text: string;
40
- insertDecisionCitation: (decision: Decision) => void;
41
- insertArticleCitation: (decision: Decision, article: Article) => void;
43
+ insertDecisionCitation: (decision: LegalDocument) => void;
44
+ insertArticleCitation: (decision: LegalDocument, article: Article) => void;
42
45
  closeModal: (legislationTypeUri?: string, text?: string) => void;
43
- config: { endpoint: string };
46
+ config: CitationPluginEmberComponentConfig;
44
47
  }
45
48
 
46
49
  export default class EditorPluginsCitationsSearchModalComponent extends Component<Args> {
@@ -53,7 +56,7 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
53
56
  @tracked totalCount = 0;
54
57
  @tracked decisions = [];
55
58
  @tracked error: unknown;
56
- @tracked selectedDecision: Decision | null = null;
59
+ @tracked selectedDecision: LegalDocument | null = null;
57
60
  @tracked documentDateFrom: Date | null = null;
58
61
  @tracked documentDateTo: Date | null = null;
59
62
  @tracked publicationDateFrom: Date | null = null;
@@ -84,7 +87,11 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
84
87
  }
85
88
 
86
89
  get legislationTypes() {
87
- return Object.keys(LEGISLATION_TYPES).map(capitalize);
90
+ if (this.config.decisionsEndpoint) {
91
+ return legislationKeysCapitalized;
92
+ }
93
+
94
+ return legislationKeysCapitalized.filter((key) => key !== 'Besluit');
88
95
  }
89
96
 
90
97
  get legislationSelected() {
@@ -123,7 +130,7 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
123
130
  publicationDateFrom: getISODate(this.publicationDateFrom),
124
131
  publicationDateTo: getISODate(this.publicationDateTo),
125
132
  };
126
- const results = await fetchDecisions({
133
+ const results = await fetchLegalDocuments({
127
134
  words: words,
128
135
  filter: filter,
129
136
  pageNumber: this.pageNumber,
@@ -131,7 +138,7 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
131
138
  config: this.args.config,
132
139
  });
133
140
  this.totalCount = results.totalCount;
134
- return results.decisions;
141
+ return results.legalDocuments;
135
142
  } catch (e) {
136
143
  console.warn(e); // eslint-ignore-line no-console
137
144
  this.totalCount = 0;
@@ -154,6 +161,10 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
154
161
  this.publicationDateTo,
155
162
  ]);
156
163
 
164
+ get isBesluitType() {
165
+ return isBesluitType(this.legislationTypeUri);
166
+ }
167
+
157
168
  @action
158
169
  setInputSearchText(event: InputEvent) {
159
170
  this.inputSearchText = (event.target as HTMLInputElement).value;
@@ -180,13 +191,13 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
180
191
  }
181
192
 
182
193
  @action
183
- async insertDecisionCitation(decision: Decision) {
194
+ async insertDecisionCitation(decision: LegalDocument) {
184
195
  this.args.insertDecisionCitation(decision);
185
196
  await this.closeModal();
186
197
  }
187
198
 
188
199
  @action
189
- async insertArticleCitation(decision: Decision, article: Article) {
200
+ async insertArticleCitation(decision: LegalDocument, article: Article) {
190
201
  this.args.insertArticleCitation(decision, article);
191
202
  await this.closeModal();
192
203
  }
@@ -199,7 +210,7 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
199
210
  }
200
211
 
201
212
  @action
202
- openDecisionDetail(decision: Decision) {
213
+ openDecisionDetail(decision: LegalDocument) {
203
214
  this.selectedDecision = decision;
204
215
  }
205
216
 
@@ -72,7 +72,12 @@ export default class CodelistEditComponent extends Component<Args> {
72
72
  });
73
73
 
74
74
  get multiSelect() {
75
- return this.codelistOptions.value?.type === MULTI_SELECT_CODELIST_TYPE;
75
+ const localStyle = this.selectedCodelist.value?.node.attrs
76
+ .selectionStyle as string;
77
+ if (localStyle) {
78
+ return localStyle === 'multi';
79
+ } else
80
+ return this.codelistOptions.value?.type === MULTI_SELECT_CODELIST_TYPE;
76
81
  }
77
82
 
78
83
  @action