@lblod/ember-rdfa-editor-lblod-plugins 12.0.0 → 12.1.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 (35) hide show
  1. package/.woodpecker/.changeset.yml +1 -2
  2. package/CHANGELOG.md +20 -1
  3. package/README.md +61 -8
  4. package/addon/components/citation-plugin/citations/search-modal.hbs +22 -0
  5. package/addon/components/citation-plugin/citations/search-modal.ts +15 -0
  6. package/addon/components/rdfa-date-plugin/date.hbs +1 -1
  7. package/addon/components/variable-plugin/address/edit.ts +1 -1
  8. package/addon/components/variable-plugin/address/insert-variable.hbs +9 -0
  9. package/addon/components/variable-plugin/address/insert-variable.ts +27 -0
  10. package/addon/components/variable-plugin/address/insert.hbs +2 -1
  11. package/addon/components/variable-plugin/address/insert.ts +10 -20
  12. package/addon/components/variable-plugin/address/nodeview.hbs +1 -1
  13. package/addon/components/variable-plugin/address/utils.ts +26 -0
  14. package/addon/components/variable-plugin/location/nodeview.hbs +8 -0
  15. package/addon/components/variable-plugin/location/nodeview.ts +15 -0
  16. package/addon/components/variable-plugin/number/nodeview.hbs +1 -1
  17. package/addon/components/variable-plugin/variable/nodeview.hbs +1 -0
  18. package/addon/plugins/citation-plugin/index.ts +1 -0
  19. package/addon/plugins/citation-plugin/utils/legal-documents.ts +2 -0
  20. package/addon/plugins/citation-plugin/utils/public-decisions.ts +62 -26
  21. package/addon/plugins/variable-plugin/variables/location.ts +1 -1
  22. package/app/components/variable-plugin/address/insert-variable.js +1 -0
  23. package/app/components/variable-plugin/location/nodeview.js +1 -0
  24. package/app/styles/variable-plugin.scss +6 -2
  25. package/components/citation-plugin/citations/search-modal.d.ts +3 -0
  26. package/components/variable-plugin/address/insert-variable.d.ts +12 -0
  27. package/components/variable-plugin/address/insert.d.ts +1 -1
  28. package/components/variable-plugin/address/utils.d.ts +2 -0
  29. package/components/variable-plugin/location/nodeview.d.ts +12 -0
  30. package/index.js +3 -0
  31. package/package.json +10 -8
  32. package/plugins/citation-plugin/index.d.ts +1 -0
  33. package/plugins/citation-plugin/utils/legal-documents.d.ts +1 -0
  34. package/translations/en-US.yaml +1 -0
  35. package/translations/nl-BE.yaml +1 -0
@@ -5,5 +5,4 @@ steps:
5
5
  - git fetch origin master
6
6
  - git diff -wb --name-only origin/master..HEAD | grep "\.changeset/.*\.md"
7
7
  when:
8
- event: pull_request
9
- evaluate: 'not (CI_COMMIT_PULL_REQUEST_LABELS contains "dependabot")'
8
+ - evaluate: 'CI_PIPELINE_EVENT == "pull_request" && not (CI_COMMIT_PULL_REQUEST_LABELS contains "dependabot")'
package/CHANGELOG.md CHANGED
@@ -1,4 +1,21 @@
1
- ## 11.3.0 - 2023-09-06
1
+ # @lblod/ember-rdfa-editor-lblod-plugins
2
+
3
+ ## 12.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#286](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/286) [`955535b`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/955535b4d99d729b40f0e01bf1c634042894bf60) Thanks [@dkozickis](https://github.com/dkozickis)! - GN-4266: Referring to published decisions - filter by government name
8
+
9
+ - [#299](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/299) [`3732e50`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/3732e5041df3d3e994df34de9dd436f59f7bade0) Thanks [@x-m-el](https://github.com/x-m-el)! - Update readme documentation for RDFa date and Table of Contents plugin to include explanation about their configurations
10
+
11
+ - [#290](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/290) [`8c1ad72`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/8c1ad729b0eb1a159637d3ed9f3b49a02a659a96) Thanks [@elpoelma](https://github.com/elpoelma)! - Add support for address variables inside location variables
12
+
13
+ - [#296](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/296) [`bcf7a2d`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/bcf7a2d7314dfd1156ca1e310d5c15d1d2c2fbfe) Thanks [@abeforgit](https://github.com/abeforgit)! - bump ember and ember data to 4.12 for development, and add correct peerdep specification for consumers
14
+
15
+ - [#298](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/298) [`2908aa3`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/2908aa355b6dadc694ee90fd93ad2e79faa22257) Thanks [@x-m-el](https://github.com/x-m-el)! - Added a second address insert `variable-plugin/address/insert-variable`. This replaces the `insert` from before when used inside the `insert-variable-card` dropdown.
16
+
17
+ - same UI as other variables
18
+ - allows using a custom label
2
19
 
3
20
  ## 12.0.0
4
21
 
@@ -17,6 +34,8 @@
17
34
 
18
35
  - [#289](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/289) [`d1e2af1`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/d1e2af14bab0eb4ed6e1d7d62a5c55e396c707ce) Thanks [@elpoelma](https://github.com/elpoelma)! - Bumps `@lblod/ember-rdfa-editor` from 5.2.0 to 5.3.0
19
36
 
37
+ ## [11.3.0] - 2023-09-06
38
+
20
39
  ### Changed
21
40
 
22
41
  - CI: move changelog check to separate CI pipeline
package/README.md CHANGED
@@ -5,7 +5,9 @@ related to the LBLOD Project.
5
5
 
6
6
  ## Compatibility
7
7
 
8
- * Ember.js v3.28 or above
8
+ * Ember.js and ember data v3.28 or 4.x
9
+ note: we smoke-test for 3.28 but develop on the latest 4.x minor. The 5.x range is currently untested and not officially supported, but we accept issues and PRs to do so.
10
+
9
11
  * Embroider or ember-auto-import v2
10
12
  * Node 18 or above
11
13
 
@@ -254,13 +256,15 @@ Same goes for the `CitationInsert` component, with which you can directly insert
254
256
 
255
257
  You need to specify the endpoints for the plugin in the config object
256
258
  ```js
257
- {
258
- endpoint: 'https://codex.opendata.api.vlaanderen.be:8888/sparql'
259
- decisionsEndpoint: 'https://https://publicatie.gelinkt-notuleren.vlaanderen.be/sparql'
259
+ const citationPluginConfig = {
260
+ endpoint: 'https://codex.opendata.api.vlaanderen.be:8888/sparql',
261
+ decisionsEndpoint: 'https://publicatie.gelinkt-notuleren.vlaanderen.be/sparql',
262
+ defaultDecisionsGovernmentName: 'Edegem'
260
263
  }
261
264
  ```
262
265
 
263
- The `decisionsEndpoint` is optional, and is required if you want to display decisions from the Publicatie.
266
+ The `decisionsEndpoint` is optional, and is required if you want to display decisions from the Publicatie.
267
+ The `defaultDecisionsGovernmentName` is also optional, and is used to filter the decisions from the Publicatie by government name, the government name for the filter can be changed by the user during the search.
264
268
 
265
269
 
266
270
  Make `this.citationPlugin` a tracked reference to the plugin created with the function exported from the package and the wished configuration
@@ -380,15 +384,38 @@ And an insert button to insert new dates that needs to be added to the insert pa
380
384
  />
381
385
  ```
382
386
 
383
- You will also need to add the date node with the following configuration (being the insertDate and insertDateTime the placeholder strings):
387
+ You will also need to add a configuration like the following:
384
388
  ```js
385
389
  date: date({
386
390
  placeholder: {
387
391
  insertDate: this.intl.t('date-plugin.insert.date'),
388
392
  insertDateTime: this.intl.t('date-plugin.insert.datetime'),
389
393
  },
394
+ formats: [
395
+ {
396
+ label: 'Short Date',
397
+ key: 'short',
398
+ dateFormat: 'dd/MM/yy',
399
+ dateTimeFormat: 'dd/MM/yy HH:mm',
400
+ },
401
+ {
402
+ label: 'Long Date',
403
+ key: 'long',
404
+ dateFormat: 'EEEE dd MMMM yyyy',
405
+ dateTimeFormat: 'PPPPp',
406
+ },
407
+ ],
408
+ allowCustomFormat: true,
390
409
  }),
391
410
  ```
411
+ - `formats`: specify default formats to show for selection in the date card.
412
+ - `label` (optional): The label shown to the user on the card. If not provided, the format is used instead e.g.: `dd/MM/yyyy`
413
+ - `key`: A **unique** identifier used for identification in the internal code.
414
+ - `dateFormat`: The date format used when this is selected.
415
+ - `dateTimeFormat`: The datetime format to use when this is selected. Used when the user selects "Include time".
416
+ - `allowCustomFormat`: true/false, determines if the option to insert a fully custom format is available.
417
+
418
+ The syntax of formats can be found at [date-fns](https://date-fns.org/v2.29.3/docs/format).
392
419
 
393
420
  ## roadsign-regulation-plugin
394
421
 
@@ -411,7 +438,7 @@ You will need to set the following configuration in the config object
411
438
  imageBaseUrl: 'https://register.mobiliteit.vlaanderen.be/',
412
439
  }
413
440
  ```
414
- The `endpoint` from where the plugin will fetch the roadsigns, and the `imageBaseUrl` is a fallback for the images that don't have a baseUrl specified, probably you won't need it if your data is correctly constructed.
441
+ The `endpoint` from where the plugin will fetch the roadsigns, and the `imageBaseUrl` is a fallback for the images that don't have a baseUrl specified. This won't be used if your data is correctly constructed.
415
442
 
416
443
  ## standard-template-plugin
417
444
 
@@ -454,6 +481,15 @@ In order to enable the plugin you need to add the table of contents button to th
454
481
  ```js
455
482
  tableOfContentsView(this.config.tableOfContents)(controller),
456
483
  ```
484
+
485
+ You also need to allow this node as content by adding it to the doc node of the schema. It is *not* part of the block group.
486
+ ``` js
487
+ // example to allow the table of contents at the top and any blocks underneath
488
+ doc: docWithConfig({
489
+ content: 'table-of-contents? block+'
490
+ }),
491
+ ```
492
+
457
493
  ### Configuring the plugin with a custom config
458
494
 
459
495
  You can configure the nodeview with the hierarchy of the nodes.
@@ -470,6 +506,11 @@ For very custom setups, the plugin might be unable to find your scrollContainer
470
506
  },
471
507
  ```
472
508
 
509
+ `nodeHierarchy` is a list of *regex* strings to specify the node structure of the document. Note that this means the order of the words does not matter. The example shows this for article structures.
510
+ The *first string* selects the main nodes in the document that define the structure.
511
+ The strings afterwards are the sub-nodes inside main nodes that should be used to find the actual content to display in the table of contents, if the main node does not contain the content directly. In the example a title will have a `structure_header` that contains the actual text of the title.
512
+ In the case that `structure_header` contains a node `actual_title_text` that should be used as content, you'd have to add a third regex string that matches `actual_title_text`.
513
+
473
514
  ### Internationalization of the table of contents
474
515
  The dynamic version of the table of contents is internationalized based on the current document language and using the `ember-intl` service.
475
516
  The static (serialized) version of the table of contents can also be internationalized based on the current document language. For this to work correctly, the `emberApplication` prosemirror-plugin should be present.
@@ -530,7 +571,7 @@ This addon includes an insert-component for each of these variable types:
530
571
  - `variable-plugin/date/insert`
531
572
  - `variable-plugin/location/insert`
532
573
  - `variable-plugin/codelist/insert`
533
- - `variable-plugin/address/insert`
574
+ - `variable-plugin/address/insert-variable`
534
575
 
535
576
  Each of these components presents a custom UI which allows a user to insert a variable of the corresponding type in a document.
536
577
 
@@ -604,6 +645,12 @@ get variableTypes() {
604
645
  },
605
646
  },
606
647
  },
648
+ {
649
+ label: 'address',
650
+ component: {
651
+ path: 'variable-plugin/address/insert-variable',
652
+ },
653
+ },
607
654
  ];
608
655
  }
609
656
  ```
@@ -674,6 +721,12 @@ The edit card can be configured with two arguments:
674
721
  - An instance of a `SayController` (required)
675
722
  - A `defaultMuncipality` which should be used as the default value of the `muncipality` field in the edit-card (optional)
676
723
 
724
+
725
+ You can also add an insert component meant for use outside of `insert-variable-card` by using the `variable-plugin/address/insert` component. This has no label-input and will show a default label.
726
+ ```hbs
727
+ <VariablePlugin::Address::Insert @controller={{this.controller}}/>
728
+ ```
729
+
677
730
  ## validation-plugin
678
731
 
679
732
  see [the plugin docs](addon/plugins/validation/README.md)
@@ -66,6 +66,28 @@
66
66
  />
67
67
 
68
68
  <AuHr @size='large' />
69
+ {{#if this.isBesluitType}}
70
+ <AuLabel
71
+ class='au-u-margin-top au-margin-bottom-small'
72
+ for='search-government'
73
+ @inline={{false}}
74
+ @required={{false}}
75
+ @error={{false}}
76
+ @warning={{false}}
77
+ >
78
+ {{t 'citaten-plugin.search.government-search'}}
79
+ </AuLabel>
80
+ <AuNativeInput
81
+ @icon='search'
82
+ @type='text'
83
+ @width='block'
84
+ @iconAlignment='right'
85
+ id='search-government'
86
+ value={{this.governmentSearchText}}
87
+ placeholder={{t 'citaten-plugin.search.placeholder'}}
88
+ {{on 'input' this.setGovernmentSearchText}}
89
+ />
90
+ {{/if}}
69
91
  {{! Date of document }}
70
92
  <AuLabel
71
93
  class='au-u-margin-top au-u-margin-bottom-small'
@@ -62,6 +62,7 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
62
62
  @tracked publicationDateFrom: Date | null = null;
63
63
  @tracked publicationDateTo: Date | null = null;
64
64
  @tracked inputSearchText: string | null = null;
65
+ @tracked inputGovernmentSearchText: string | null = null;
65
66
  minDate = new Date('1930-01-01T12:00:00');
66
67
  maxDate = new Date(`${new Date().getFullYear() + 10}-01-01T12:00:00`);
67
68
 
@@ -115,6 +116,13 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
115
116
  return this.inputSearchText ?? this.text;
116
117
  }
117
118
 
119
+ get governmentSearchText() {
120
+ return (
121
+ this.inputGovernmentSearchText ??
122
+ this.config.defaultDecisionsGovernmentName
123
+ );
124
+ }
125
+
118
126
  resourceSearch = restartableTask(async () => {
119
127
  await timeout(500);
120
128
  this.error = null;
@@ -129,6 +137,7 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
129
137
  documentDateTo: getISODate(this.documentDateTo),
130
138
  publicationDateFrom: getISODate(this.publicationDateFrom),
131
139
  publicationDateTo: getISODate(this.publicationDateTo),
140
+ governmentName: this.governmentSearchText,
132
141
  };
133
142
  const results = await fetchLegalDocuments({
134
143
  words: words,
@@ -152,6 +161,7 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
152
161
 
153
162
  decisionResource = trackedTask(this, this.resourceSearch, () => [
154
163
  this.searchText,
164
+ this.governmentSearchText,
155
165
  this.legislationTypeUri,
156
166
  this.pageSize,
157
167
  this.pageNumber,
@@ -170,6 +180,11 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
170
180
  this.inputSearchText = (event.target as HTMLInputElement).value;
171
181
  }
172
182
 
183
+ @action
184
+ setGovernmentSearchText(event: InputEvent) {
185
+ this.inputGovernmentSearchText = (event.target as HTMLInputElement).value;
186
+ }
187
+
173
188
  @action
174
189
  updateDocumentDateFrom(_isoDate: unknown, date: Date) {
175
190
  this.documentDateFrom = date;
@@ -1,4 +1,4 @@
1
- <AuPill @icon="pencil" @iconAlignment="right" class="variable" {{on 'click' this.onClick}}>
1
+ <AuPill @icon="pencil" @iconAlignment="right" class="variable atomic" {{on 'click' this.onClick}}>
2
2
 
3
3
  {{this.humanReadableDate}}
4
4
  {{#if @node.attrs.label}}
@@ -101,7 +101,7 @@ export default class AddressEditComponent extends Component<Args> {
101
101
  }
102
102
 
103
103
  get selectedAddressVariable() {
104
- const { selection, schema } = this.controller.mainEditorState;
104
+ const { selection, schema } = this.controller.activeEditorState;
105
105
  if (
106
106
  selection instanceof NodeSelection &&
107
107
  selection.node.type === schema.nodes.address
@@ -0,0 +1,9 @@
1
+ <AuFormRow>
2
+ <VariablePlugin::Utils::LabelInput
3
+ @label={{this.label}}
4
+ @updateLabel={{this.updateLabel}}
5
+ />
6
+ </AuFormRow>
7
+ <AuButton {{on 'click' this.insertAddress}}>
8
+ {{t 'variable-plugin.button'}}
9
+ </AuButton>
@@ -0,0 +1,27 @@
1
+ import Component from '@glimmer/component';
2
+ import { replaceSelectionWithAddress } from './utils';
3
+ import { action } from '@ember/object';
4
+ import { tracked } from '@glimmer/tracking';
5
+ import { SayController } from '@lblod/ember-rdfa-editor';
6
+
7
+ type Args = {
8
+ controller: SayController;
9
+ };
10
+
11
+ export default class VariablePluginAddressInsertVariableComponent extends Component<Args> {
12
+ @tracked label?: string;
13
+
14
+ get controller() {
15
+ return this.args.controller;
16
+ }
17
+
18
+ @action
19
+ updateLabel(event: InputEvent) {
20
+ this.label = (event.target as HTMLInputElement).value;
21
+ }
22
+
23
+ @action
24
+ insertAddress() {
25
+ replaceSelectionWithAddress(this.controller, this.label);
26
+ }
27
+ }
@@ -3,7 +3,8 @@
3
3
  @icon="add"
4
4
  @iconAlignment="left"
5
5
  @skin="link"
6
- {{on 'click' (fn this.insertAddress true)}}>
6
+ {{on 'click' (fn this.insertAddress true)}}
7
+ @disabled={{not this.canInsertAddress}}>
7
8
  {{t "editor-plugins.address.insert"}}
8
9
  </AuButton>
9
10
  </AuList::Item>
@@ -1,8 +1,7 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { action } from '@ember/object';
3
3
  import { SayController } from '@lblod/ember-rdfa-editor';
4
- import { NodeSelection } from '@lblod/ember-rdfa-editor';
5
- import { v4 as uuidv4 } from 'uuid';
4
+ import { replaceSelectionWithAddress } from './utils';
6
5
 
7
6
  type Args = {
8
7
  controller: SayController;
@@ -13,25 +12,16 @@ export default class InsertAddressComponent extends Component<Args> {
13
12
  return this.args.controller;
14
13
  }
15
14
 
16
- get schema() {
17
- return this.controller.schema;
18
- }
19
-
20
15
  @action
21
16
  insertAddress() {
22
- const mappingResource = `http://data.lblod.info/mappings/${uuidv4()}`;
23
- const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
24
- this.controller.withTransaction((tr) => {
25
- tr.replaceSelectionWith(
26
- this.schema.node('address', { mappingResource, variableInstance }),
27
- );
28
- if (tr.selection.$anchor.nodeBefore) {
29
- const resolvedPos = tr.doc.resolve(
30
- tr.selection.anchor - tr.selection.$anchor.nodeBefore?.nodeSize,
31
- );
32
- tr.setSelection(new NodeSelection(resolvedPos));
33
- }
34
- return tr;
35
- });
17
+ replaceSelectionWithAddress(this.controller);
18
+ }
19
+
20
+ get canInsertAddress() {
21
+ if (this.controller.activeEditorView.props.nodeViews?.address) {
22
+ return true;
23
+ } else {
24
+ return false;
25
+ }
36
26
  }
37
27
  }
@@ -1,7 +1,7 @@
1
1
  <AuPill
2
2
  @icon='pencil'
3
3
  @iconAlignment='right'
4
- class='variable'
4
+ class='variable atomic'
5
5
  {{on 'click' this.selectThisNode}}
6
6
  >
7
7
  {{#if this.address}}
@@ -0,0 +1,26 @@
1
+ import { SayController, NodeSelection } from '@lblod/ember-rdfa-editor';
2
+ import { v4 as uuidv4 } from 'uuid';
3
+
4
+ export function replaceSelectionWithAddress(
5
+ controller: SayController,
6
+ label?: string,
7
+ ) {
8
+ const mappingResource = `http://data.lblod.info/mappings/${uuidv4()}`;
9
+ const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
10
+ controller.withTransaction((tr) => {
11
+ tr.replaceSelectionWith(
12
+ controller.schema.node('address', {
13
+ label: label,
14
+ mappingResource,
15
+ variableInstance,
16
+ }),
17
+ );
18
+ if (tr.selection.$anchor.nodeBefore) {
19
+ const resolvedPos = tr.doc.resolve(
20
+ tr.selection.anchor - tr.selection.$anchor.nodeBefore?.nodeSize,
21
+ );
22
+ tr.setSelection(new NodeSelection(resolvedPos));
23
+ }
24
+ return tr;
25
+ });
26
+ }
@@ -0,0 +1,8 @@
1
+ <VariablePlugin::Variable::Nodeview
2
+ @controller={{@controller}}
3
+ @node={{@node}}
4
+ @view={{@view}}
5
+ @getPos={{@getPos}}
6
+ @selected={{@selected}}
7
+ @nodeViews={{this.nodeViews}}
8
+ />
@@ -0,0 +1,15 @@
1
+ import Component from '@glimmer/component';
2
+ import { SayController, SayView } from '@lblod/ember-rdfa-editor';
3
+ import { tracked } from '@glimmer/tracking';
4
+ import { addressView } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/variables';
5
+
6
+ type Args = {
7
+ controller: SayController;
8
+ };
9
+
10
+ export default class LocationNodeViewComponent extends Component<Args> {
11
+ @tracked nodeViews = {
12
+ address: addressView(this.args.controller),
13
+ };
14
+ @tracked innerView?: SayView;
15
+ }
@@ -5,7 +5,7 @@
5
5
  <AuPill
6
6
  @icon='pencil'
7
7
  @iconAlignment='right'
8
- class='variable'
8
+ class='variable atomic'
9
9
  {{velcro.hook}}
10
10
  {{select-node-on-click @controller @getPos}}
11
11
  >
@@ -6,6 +6,7 @@
6
6
  @getPos={{@getPos}}
7
7
  @selected={{@selected}}
8
8
  @initEditor={{this.initEditor}}
9
+ @nodeViews={{@nodeViews}}
9
10
  />
10
11
  {{#if @node.attrs.label}}
11
12
  <span class="label">
@@ -140,6 +140,7 @@ export type CitationPluginConfig =
140
140
  export type CitationPluginEmberComponentConfig = CitationPluginConfig & {
141
141
  endpoint: string;
142
142
  decisionsEndpoint?: string;
143
+ defaultDecisionsGovernmentName?: string;
143
144
  };
144
145
 
145
146
  export function citationPlugin(config: CitationPluginConfig): CitationPlugin {
@@ -65,6 +65,7 @@ export interface LegalDocumentsQueryFilter {
65
65
  documentDateTo?: Option<string>;
66
66
  publicationDateFrom?: Option<string>;
67
67
  publicationDateTo?: Option<string>;
68
+ governmentName?: Option<string>;
68
69
  }
69
70
 
70
71
  export type LegalDocumentsQueryConfig = {
@@ -94,6 +95,7 @@ export async function fetchLegalDocuments({
94
95
  documentDateTo: filter.documentDateTo || null,
95
96
  publicationDateFrom: filter.publicationDateFrom || null,
96
97
  publicationDateTo: filter.publicationDateTo || null,
98
+ governmentName: filter.governmentName || null,
97
99
  };
98
100
  const stringArguments = JSON.stringify({
99
101
  words,
@@ -42,6 +42,12 @@ const getFilters = ({
42
42
  );
43
43
  }
44
44
 
45
+ const governmentNameFilter = filter.governmentName?.trim()
46
+ ? `FILTER (CONTAINS(LCASE(?administrativeUnitName), "${replaceDiacriticsInWord(
47
+ filter.governmentName?.trim(),
48
+ ).toLowerCase()}"))`
49
+ : '';
50
+
45
51
  return `
46
52
  ${words
47
53
  .map(
@@ -51,7 +57,10 @@ const getFilters = ({
51
57
  ).toLowerCase()}"))`,
52
58
  )
53
59
  .join('\n')}
54
- ${documentDateFilter.join('\n')}`;
60
+ ${documentDateFilter.join('\n')}
61
+ ${governmentNameFilter}
62
+ FILTER(BOUND(?decisionTitle))
63
+ `;
55
64
  };
56
65
 
57
66
  const getCountQuery = ({
@@ -69,25 +78,31 @@ const getCountQuery = ({
69
78
  PREFIX ext: <http://mu.semte.ch/vocabularies/ext/>
70
79
  PREFIX eli: <http://data.europa.eu/eli/ontology#>
71
80
  PREFIX prov: <http://www.w3.org/ns/prov#>
72
- PREFIX schema: <http://schema.org/>
73
81
  PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
74
82
  PREFIX mandaat: <http://data.vlaanderen.be/ns/mandaat#>
75
- PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
76
83
  PREFIX mu: <http://mu.semte.ch/vocabularies/core/>
84
+ PREFIX dct: <http://purl.org/dc/terms/>
77
85
 
78
86
  SELECT (COUNT(DISTINCT(?decision)) as ?count) WHERE {
79
87
  ?session rdf:type besluit:Zitting;
80
88
  mu:uuid ?zittingUuid;
81
- (besluit:isGehoudenDoor/mandaat:isTijdspecialisatieVan/skos:prefLabel) ?governmentName;
82
- ext:besluitenlijst ?decisionList.
83
- ?decisionList ext:besluitenlijstBesluit ?decision.
84
- ?decision eli:title ?decisionTitle.
89
+ (besluit:isGehoudenDoor/mandaat:isTijdspecialisatieVan) ?administrativeUnit.
90
+ ?administrativeUnit skos:prefLabel ?administrativeUnitFullName;
91
+ besluit:bestuurt ?bestuurseenheid.
92
+ ?bestuurseenheid skos:prefLabel ?administrativeUnitName;
93
+ (besluit:classificatie/skos:prefLabel) ?administrativeUnitTypeName.
85
94
  OPTIONAL {
86
- ?agenda rdf:type besluit:BehandelingVanAgendapunt;
95
+ ?session besluit:behandelt ?agendaPoint.
96
+ ?agendaPointTreatment dct:subject ?agendaPoint;
87
97
  prov:generated ?decision.
88
- ?treatment rdf:type ext:Uittreksel;
89
- ext:uittrekselBvap ?agenda;
90
- mu:uuid ?treatmentUuida.
98
+ ?decision eli:title ?decisionTitle.
99
+ }
100
+ OPTIONAL {
101
+ ?session ext:uittreksel ?treatment.
102
+ ?treatment mu:uuid ?treatmentUuid.
103
+ ?treatment ext:uittrekselBvap ?agendaPointTreatment.
104
+ ?agendaPointTreatment prov:generated ?decision.
105
+ ?decision eli:title ?decisionTitle.
91
106
  }
92
107
  ${filterString}
93
108
  }
@@ -113,25 +128,31 @@ const getQuery = ({
113
128
  PREFIX ext: <http://mu.semte.ch/vocabularies/ext/>
114
129
  PREFIX eli: <http://data.europa.eu/eli/ontology#>
115
130
  PREFIX prov: <http://www.w3.org/ns/prov#>
116
- PREFIX schema: <http://schema.org/>
117
131
  PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
118
132
  PREFIX mandaat: <http://data.vlaanderen.be/ns/mandaat#>
119
- PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
120
133
  PREFIX mu: <http://mu.semte.ch/vocabularies/core/>
134
+ PREFIX dct: <http://purl.org/dc/terms/>
121
135
 
122
- SELECT DISTINCT ?governmentName ?decision ?decisionTitle ?documentDate ?zittingUuid ?treatmentUuid WHERE {
136
+ SELECT DISTINCT ?administrativeUnitFullName ?administrativeUnitTypeName ?administrativeUnitName ?documentDate ?decision ?decisionTitle ?zittingUuid ?treatmentUuid WHERE {
123
137
  ?session rdf:type besluit:Zitting;
124
138
  mu:uuid ?zittingUuid;
125
- (besluit:isGehoudenDoor/mandaat:isTijdspecialisatieVan/skos:prefLabel) ?governmentName;
126
- ext:besluitenlijst ?decisionList.
127
- ?decisionList ext:besluitenlijstBesluit ?decision.
128
- ?decision eli:title ?decisionTitle.
139
+ (besluit:isGehoudenDoor/mandaat:isTijdspecialisatieVan) ?administrativeUnit.
140
+ ?administrativeUnit skos:prefLabel ?administrativeUnitFullName;
141
+ besluit:bestuurt ?bestuurseenheid.
142
+ ?bestuurseenheid skos:prefLabel ?administrativeUnitName;
143
+ (besluit:classificatie/skos:prefLabel) ?administrativeUnitTypeName.
129
144
  OPTIONAL {
130
- ?agenda rdf:type besluit:BehandelingVanAgendapunt;
145
+ ?session besluit:behandelt ?agendaPoint.
146
+ ?agendaPointTreatment dct:subject ?agendaPoint;
131
147
  prov:generated ?decision.
132
- ?treatment rdf:type ext:Uittreksel;
133
- ext:uittrekselBvap ?agenda;
134
- mu:uuid ?treatmentUuid.
148
+ ?decision eli:title ?decisionTitle.
149
+ }
150
+ OPTIONAL {
151
+ ?session ext:uittreksel ?treatment.
152
+ ?treatment mu:uuid ?treatmentUuid.
153
+ ?treatment ext:uittrekselBvap ?agendaPointTreatment.
154
+ ?agendaPointTreatment prov:generated ?decision.
155
+ ?decision eli:title ?decisionTitle.
135
156
  }
136
157
  ${filterString}
137
158
  }
@@ -142,7 +163,9 @@ const getQuery = ({
142
163
  };
143
164
 
144
165
  interface PublicDecisionLegalDocumentBinding {
145
- governmentName: Binding<string>;
166
+ administrativeUnitName: Binding<string>;
167
+ administrativeUnitTypeName: Binding<string>;
168
+ administrativeUnitFullName: Binding<string>;
146
169
  decision: Binding<string>;
147
170
  decisionTitle: Binding<string>;
148
171
  documentDate?: Binding<string>;
@@ -176,7 +199,7 @@ export async function fetchPublicDecisions({
176
199
 
177
200
  const legalDocuments = response.results.bindings.map((binding) => {
178
201
  const escapedGovernmentName =
179
- escapeValue(binding.governmentName.value) ?? '';
202
+ escapeValue(binding.administrativeUnitFullName.value) ?? '';
180
203
 
181
204
  const escapedTitle = escapeValue(binding.decisionTitle.value) ?? '';
182
205
 
@@ -198,8 +221,12 @@ export async function fetchPublicDecisions({
198
221
  publicationLink:
199
222
  binding.zittingUuid.value && binding.treatmentUuid?.value
200
223
  ? getPublicationLink({
224
+ administrativeUnitName: binding.administrativeUnitName.value,
225
+ administrativeUnitTypeName:
226
+ binding.administrativeUnitTypeName.value,
201
227
  zittingUuid: binding.zittingUuid.value,
202
228
  treatmentUuid: binding.treatmentUuid.value,
229
+ decisionsEndpoint: config.endpoint,
203
230
  })
204
231
  : null,
205
232
  },
@@ -219,10 +246,19 @@ export async function fetchPublicDecisions({
219
246
  }
220
247
 
221
248
  const getPublicationLink = ({
249
+ administrativeUnitName,
250
+ administrativeUnitTypeName,
222
251
  zittingUuid,
223
252
  treatmentUuid,
253
+ decisionsEndpoint,
224
254
  }: {
255
+ administrativeUnitName: string;
256
+ administrativeUnitTypeName: string;
225
257
  zittingUuid: string;
226
258
  treatmentUuid: string;
227
- }) =>
228
- `https://publicatie.gelinkt-notuleren.lblod.info/Edegem/Gemeente/zittingen/${zittingUuid}/uittreksels/${treatmentUuid}`;
259
+ decisionsEndpoint: string;
260
+ }) => {
261
+ return `https://${
262
+ new URL(decisionsEndpoint).host
263
+ }/${administrativeUnitName}/${administrativeUnitTypeName}/zittingen/${zittingUuid}/uittreksels/${treatmentUuid}`;
264
+ };
@@ -71,7 +71,7 @@ const toDOM = (node: PNode): DOMOutputSpec => {
71
71
 
72
72
  const emberNodeConfig: EmberNodeConfig = {
73
73
  name: 'location',
74
- componentPath: 'variable-plugin/variable/nodeview',
74
+ componentPath: 'variable-plugin/location/nodeview',
75
75
  inline: true,
76
76
  group: 'inline variable',
77
77
  content: 'inline*',
@@ -0,0 +1 @@
1
+ export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/address/insert-variable';
@@ -0,0 +1 @@
1
+ export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/location/nodeview';
@@ -48,12 +48,14 @@
48
48
  }
49
49
 
50
50
  .ember-node {
51
+ white-space: normal !important;
51
52
  .variable {
52
53
  [contenteditable] {
53
54
  white-space: break-spaces;
54
55
  word-break: break-all;
55
56
  word-wrap: break-word;
56
57
  outline: 0px;
58
+ padding: 2px;
57
59
  }
58
60
  .label {
59
61
  font-size: var(--au-base);
@@ -68,8 +70,10 @@
68
70
  }
69
71
 
70
72
  .ember-node.ProseMirror-selectednode {
71
- .variable {
72
- background-color: var(--au-blue-200);
73
+ > .variable {
74
+ &.atomic {
75
+ background-color: var(--au-blue-200);
76
+ }
73
77
  outline: 2px solid var(--au-blue-500);
74
78
 
75
79
  ::selection {
@@ -25,6 +25,7 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
25
25
  publicationDateFrom: Date | null;
26
26
  publicationDateTo: Date | null;
27
27
  inputSearchText: string | null;
28
+ inputGovernmentSearchText: string | null;
28
29
  minDate: Date;
29
30
  maxDate: Date;
30
31
  get legislationTypeUri(): string;
@@ -47,10 +48,12 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
47
48
  get text(): string;
48
49
  get config(): CitationPluginEmberComponentConfig;
49
50
  get searchText(): string;
51
+ get governmentSearchText(): string | undefined;
50
52
  resourceSearch: import("ember-concurrency").TaskForAsyncTaskFunction<unknown, () => Promise<LegalDocument[]>>;
51
53
  decisionResource: import("ember-resources/util/ember-concurrency").TaskInstance<unknown>;
52
54
  get isBesluitType(): boolean;
53
55
  setInputSearchText(event: InputEvent): void;
56
+ setGovernmentSearchText(event: InputEvent): void;
54
57
  updateDocumentDateFrom(_isoDate: unknown, date: Date): void;
55
58
  updateDocumentDateTo(_isoDate: unknown, date: Date): void;
56
59
  updatePublicationDateFrom(_isoDate: unknown, date: Date): void;
@@ -0,0 +1,12 @@
1
+ import Component from '@glimmer/component';
2
+ import { SayController } from '@lblod/ember-rdfa-editor';
3
+ type Args = {
4
+ controller: SayController;
5
+ };
6
+ export default class VariablePluginAddressInsertVariableComponent extends Component<Args> {
7
+ label?: string;
8
+ get controller(): SayController;
9
+ updateLabel(event: InputEvent): void;
10
+ insertAddress(): void;
11
+ }
12
+ export {};
@@ -5,7 +5,7 @@ type Args = {
5
5
  };
6
6
  export default class InsertAddressComponent extends Component<Args> {
7
7
  get controller(): SayController;
8
- get schema(): import("prosemirror-model").Schema<any, any>;
9
8
  insertAddress(): void;
9
+ get canInsertAddress(): boolean;
10
10
  }
11
11
  export {};
@@ -0,0 +1,2 @@
1
+ import { SayController } from '@lblod/ember-rdfa-editor';
2
+ export declare function replaceSelectionWithAddress(controller: SayController, label?: string): void;
@@ -0,0 +1,12 @@
1
+ import Component from '@glimmer/component';
2
+ import { SayController, SayView } from '@lblod/ember-rdfa-editor';
3
+ type Args = {
4
+ controller: SayController;
5
+ };
6
+ export default class LocationNodeViewComponent extends Component<Args> {
7
+ nodeViews: {
8
+ address: import("prosemirror-view").NodeViewConstructor;
9
+ };
10
+ innerView?: SayView;
11
+ }
12
+ export {};
package/index.js CHANGED
@@ -6,6 +6,9 @@ module.exports = {
6
6
  return process.env.EMBER_ENV === 'development';
7
7
  },
8
8
  options: {
9
+ 'ember-cli-babel': {
10
+ enableTypeScriptTransform: true,
11
+ },
9
12
  babel: {
10
13
  sourceMaps: 'inline',
11
14
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lblod/ember-rdfa-editor-lblod-plugins",
3
- "version": "12.0.0",
3
+ "version": "12.1.0",
4
4
  "description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -46,7 +46,6 @@
46
46
  "ember-auto-import": "~2.6.3",
47
47
  "ember-cli-babel": "^7.26.11",
48
48
  "ember-cli-htmlbars": "^6.1.1",
49
- "ember-cli-typescript": "^5.2.1",
50
49
  "ember-concurrency": "^2.3.7",
51
50
  "ember-mu-transform-helpers": "^2.0.0",
52
51
  "ember-power-select": "^6.0.1",
@@ -106,18 +105,19 @@
106
105
  "@types/rdfjs__dataset": "^2.0.0",
107
106
  "@types/rsvp": "^4.0.4",
108
107
  "@types/uuid": "^9.0.0",
109
- "@typescript-eslint/eslint-plugin": "^5.21.0",
110
- "@typescript-eslint/parser": "^5.21.0",
108
+ "@typescript-eslint/eslint-plugin": "^6.6.0",
109
+ "@typescript-eslint/parser": "^6.6.0",
111
110
  "babel-eslint": "^10.1.0",
112
111
  "broccoli-asset-rev": "^3.0.0",
113
112
  "changesets-release-it-plugin": "^0.1.1",
114
- "ember-cli": "~4.8.0",
113
+ "ember-cli": "~4.12.0",
114
+ "ember-cli-typescript": "^5.2.1",
115
115
  "ember-cli-dependency-checker": "^3.3.1",
116
116
  "ember-cli-inject-live-reload": "^2.1.0",
117
117
  "ember-cli-sass": "^11.0.1",
118
118
  "ember-cli-sri": "^2.1.1",
119
119
  "ember-cli-terser": "^4.0.2",
120
- "ember-data": "^3.28.12",
120
+ "ember-data": "^4.12.0",
121
121
  "ember-disable-prototype-extensions": "^1.1.3",
122
122
  "ember-functions-as-helper-polyfill": "^2.1.1",
123
123
  "ember-intl": "^5.7.2",
@@ -126,7 +126,7 @@
126
126
  "ember-qunit": "^6.0.0",
127
127
  "ember-resolver": "^8.0.3",
128
128
  "ember-simple-auth": "4.2.2",
129
- "ember-source": "~4.8.0",
129
+ "ember-source": "~4.12.0",
130
130
  "ember-source-channel-url": "^3.0.0",
131
131
  "ember-template-lint": "^4.16.1",
132
132
  "ember-try": "^2.0.0",
@@ -151,7 +151,9 @@
151
151
  "@appuniversum/ember-appuniversum": "^2.4.2",
152
152
  "@lblod/ember-rdfa-editor": "^5.3.0",
153
153
  "ember-concurrency": "^2.3.7",
154
- "ember-modifier": "^3.2.7"
154
+ "ember-modifier": "^3.2.7",
155
+ "ember-source": "^3.28.0 || ^4.0.0",
156
+ "ember-data": "^3.28.0 || ^4.0.0"
155
157
  },
156
158
  "overrides": {
157
159
  "ember-intl": {
@@ -34,6 +34,7 @@ export type CitationPluginConfig = CitationPluginNodeConfig | CitationPluginRang
34
34
  export type CitationPluginEmberComponentConfig = CitationPluginConfig & {
35
35
  endpoint: string;
36
36
  decisionsEndpoint?: string;
37
+ defaultDecisionsGovernmentName?: string;
37
38
  };
38
39
  export declare function citationPlugin(config: CitationPluginConfig): CitationPlugin;
39
40
  export {};
@@ -32,6 +32,7 @@ export interface LegalDocumentsQueryFilter {
32
32
  documentDateTo?: Option<string>;
33
33
  publicationDateFrom?: Option<string>;
34
34
  publicationDateTo?: Option<string>;
35
+ governmentName?: Option<string>;
35
36
  }
36
37
  export type LegalDocumentsQueryConfig = {
37
38
  endpoint: string;
@@ -69,6 +69,7 @@ citaten-plugin:
69
69
  title: Insert reference
70
70
  search:
71
71
  term: Search term
72
+ government-search: Filter by government
72
73
  advanced: Advanced search
73
74
  type: Type of document
74
75
  placeholder: Type to search
@@ -70,6 +70,7 @@ citaten-plugin:
70
70
  title: Citeeropschrift invoegen
71
71
  search:
72
72
  term: Zoekterm
73
+ government-search: Filter op bestuursorgaan
73
74
  advanced: Uitgebreid zoeken
74
75
  type: Type van document
75
76
  placeholder: Typ om te zoeken