@lblod/ember-rdfa-editor-lblod-plugins 6.1.0 → 7.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.
- package/.woodpecker/.release.yml +8 -1
- package/CHANGELOG.md +20 -1
- package/Dockerfile +10 -0
- package/README.md +41 -0
- package/addon/components/article-structure-plugin/structure-card.hbs +1 -1
- package/addon/components/citation-plugin/citation-card.hbs +1 -0
- package/addon/components/citation-plugin/citation-card.ts +14 -6
- package/addon/components/citation-plugin/citation-insert.hbs +1 -0
- package/addon/components/citation-plugin/citation-insert.ts +2 -2
- package/addon/components/citation-plugin/citations/decision-detail.ts +8 -6
- package/addon/components/citation-plugin/citations/search-modal.hbs +1 -0
- package/addon/components/citation-plugin/citations/search-modal.ts +12 -6
- package/addon/components/decision-plugin/decision-plugin-card.hbs +22 -6
- package/addon/components/decision-plugin/decision-plugin-card.ts +37 -18
- package/addon/components/rdfa-date-plugin/date-time-picker.ts +5 -5
- package/addon/components/rdfa-date-plugin/insert.ts +1 -0
- package/addon/plugins/citation-plugin/index.ts +4 -0
- package/addon/plugins/citation-plugin/utils/vlaamse-codex.ts +93 -59
- package/addon/plugins/decision-plugin/commands/insert-motivation.ts +59 -6
- package/addon/plugins/decision-plugin/utils/validation-rules.ts +11 -0
- package/addon/plugins/rdfa-date-plugin/nodes/date.ts +8 -9
- package/addon/plugins/validation/index.ts +2 -17
- package/addon/plugins/variable-plugin/nodes.ts +1 -0
- package/app/styles/besluit-plugin.scss +1 -1
- package/app/styles/variable-plugin.scss +5 -1
- package/components/citation-plugin/citation-card.d.ts +6 -0
- package/components/citation-plugin/citation-insert.d.ts +3 -3
- package/components/citation-plugin/citations/decision-detail.d.ts +3 -0
- package/components/citation-plugin/citations/search-modal.d.ts +6 -0
- package/components/decision-plugin/decision-plugin-card.d.ts +4 -2
- package/components/rdfa-date-plugin/date-time-picker.d.ts +5 -5
- package/package.json +3 -3
- package/plugins/citation-plugin/index.d.ts +3 -0
- package/plugins/citation-plugin/utils/vlaamse-codex.d.ts +18 -2
- package/plugins/decision-plugin/commands/insert-motivation.d.ts +3 -2
- package/plugins/decision-plugin/utils/validation-rules.d.ts +10 -0
- package/translations/en-US.yaml +14 -1
- package/translations/nl-BE.yaml +14 -1
package/.woodpecker/.release.yml
CHANGED
|
@@ -8,8 +8,15 @@ pipeline:
|
|
|
8
8
|
settings:
|
|
9
9
|
token:
|
|
10
10
|
from_secret: npm_access_token
|
|
11
|
+
push-tagged-build:
|
|
12
|
+
image: plugins/docker
|
|
13
|
+
settings:
|
|
14
|
+
repo: lblod/ember-rdfa-editor-lblod-plugins
|
|
15
|
+
tags: "${CI_COMMIT_TAG##v}"
|
|
16
|
+
purge: true
|
|
17
|
+
secrets: [ docker_username, docker_password ]
|
|
11
18
|
# Pipeline level conditions aren't supported yet:
|
|
12
19
|
# https://github.com/woodpecker-ci/woodpecker/issues/283
|
|
13
20
|
when:
|
|
14
21
|
event: tag
|
|
15
|
-
tag: v*
|
|
22
|
+
tag: v*
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [7.1.0] - 2023-05-18
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- validate motivering and article section
|
|
14
|
+
|
|
15
|
+
## [7.0.0] - 2023-05-17
|
|
16
|
+
### Added
|
|
17
|
+
- add docker build for easy demo environments
|
|
18
|
+
### Change
|
|
19
|
+
- BREAKING: Endpoint config for `CitationPlugin`
|
|
20
|
+
### Fixed
|
|
21
|
+
- Remove structure doesn't always work - disable the "Remove <structure>" button correctly
|
|
22
|
+
- Fix initialization of default date properties
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
10
26
|
## [6.1.0] - 2023-05-11
|
|
11
27
|
|
|
12
28
|
### Added
|
|
@@ -18,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
18
34
|
|
|
19
35
|
### Added
|
|
20
36
|
- validation plugin
|
|
37
|
+
- Enable Firefox cursor fix for variables
|
|
21
38
|
|
|
22
39
|
### Deprecated
|
|
23
40
|
- the decision-plugin card component is now deprecated in favor of the host app's choice of insert button
|
|
@@ -427,7 +444,9 @@ add onclick handler to pencil icon in variable plugin
|
|
|
427
444
|
|
|
428
445
|
# Changelog
|
|
429
446
|
|
|
430
|
-
[unreleased]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/
|
|
447
|
+
[unreleased]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v7.1.0...HEAD
|
|
448
|
+
[7.1.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v7.0.0...v7.1.0
|
|
449
|
+
[7.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v6.1.0...v7.0.0
|
|
431
450
|
[6.1.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v6.0.0...v6.1.0
|
|
432
451
|
[6.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v5.0.1...v6.0.0
|
|
433
452
|
[5.0.1]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v5.0.0...v5.0.1
|
package/Dockerfile
ADDED
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@ This addon contains the following editor plugins:
|
|
|
21
21
|
|
|
22
22
|
* besluit-type-plugin
|
|
23
23
|
* citaten-plugin
|
|
24
|
+
* decision-plugin
|
|
24
25
|
* import-snippet-plugin
|
|
25
26
|
* insert-variable-plugin
|
|
26
27
|
* rdfa-date-plugin
|
|
@@ -76,6 +77,28 @@ You can need to specify the endpoint from which the plugin will fetch the types
|
|
|
76
77
|
}
|
|
77
78
|
```
|
|
78
79
|
|
|
80
|
+
## decision-plugin
|
|
81
|
+
|
|
82
|
+
This plugin provides some warnings to the user if the validation for a besluit fails, it need to be used with the validation plugin as it exports some validation rules for it.
|
|
83
|
+
In order to use it you will need to add its card to the sidebar like
|
|
84
|
+
```hbs
|
|
85
|
+
<DecisionPlugin::DecisionPluginCard
|
|
86
|
+
@controller={{this.controller}}
|
|
87
|
+
/>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
and then import the rule and add it to the config of your validation plugin like
|
|
91
|
+
```js
|
|
92
|
+
import { atLeastOneArticleContainer } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/decision-plugin/utils/validation-rules';
|
|
93
|
+
...
|
|
94
|
+
@tracked validationPlugin = validation((schema: Schema) => ({
|
|
95
|
+
shapes: [
|
|
96
|
+
atLeastOneArticleContainer(schema),
|
|
97
|
+
]
|
|
98
|
+
})
|
|
99
|
+
```
|
|
100
|
+
With these changes you will see a warning if the decision is missing a title, a motivation block or an article block.
|
|
101
|
+
|
|
79
102
|
## citaten-plugin
|
|
80
103
|
|
|
81
104
|
Plugin which allows a user to insert references to a legal resource or legal expression into the document.
|
|
@@ -85,8 +108,26 @@ This plugin provides a card that needs to be added to the sidebar of the editor
|
|
|
85
108
|
<CitationPlugin::CitationCard
|
|
86
109
|
@controller={{this.controller}}
|
|
87
110
|
@plugin={{this.citationPlugin}}
|
|
111
|
+
@config={{this.config.citation}}
|
|
88
112
|
/>
|
|
89
113
|
```
|
|
114
|
+
|
|
115
|
+
You need to specify the endpoint for the plugin in the config object
|
|
116
|
+
```js
|
|
117
|
+
{
|
|
118
|
+
endpoint: 'https://codex.opendata.api.vlaanderen.be:8888/sparql'
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Same goes for the `CitationInsert` component
|
|
123
|
+
```hbs
|
|
124
|
+
<CitationPlugin::CitationInsert
|
|
125
|
+
@controller={{this.controller}}
|
|
126
|
+
@config={{this.config.citation}}
|
|
127
|
+
/>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
|
|
90
131
|
Being this.citationPlugin a tracked reference to the plugin created with the function exported from the package and the wished configuration
|
|
91
132
|
```js
|
|
92
133
|
import { citationPlugin } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin';
|
|
@@ -29,6 +29,9 @@ import {
|
|
|
29
29
|
interface Args {
|
|
30
30
|
controller: SayController;
|
|
31
31
|
plugin: CitationPlugin;
|
|
32
|
+
config: {
|
|
33
|
+
endpoint: string;
|
|
34
|
+
};
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
export default class CitationCardComponent extends Component<Args> {
|
|
@@ -70,6 +73,10 @@ export default class CitationCardComponent extends Component<Args> {
|
|
|
70
73
|
return this.args.plugin;
|
|
71
74
|
}
|
|
72
75
|
|
|
76
|
+
get config() {
|
|
77
|
+
return this.args.config;
|
|
78
|
+
}
|
|
79
|
+
|
|
73
80
|
get decorations() {
|
|
74
81
|
return this.plugin.getState(this.controller.mainEditorState)?.highlights;
|
|
75
82
|
}
|
|
@@ -121,12 +128,13 @@ export default class CitationCardComponent extends Component<Args> {
|
|
|
121
128
|
const filter = {
|
|
122
129
|
type: unwrapOr('', this.selectedLegislationTypeUri),
|
|
123
130
|
};
|
|
124
|
-
const results = await fetchDecisions(
|
|
125
|
-
words,
|
|
126
|
-
filter,
|
|
127
|
-
this.pageNumber,
|
|
128
|
-
this.pageSize
|
|
129
|
-
|
|
131
|
+
const results = await fetchDecisions({
|
|
132
|
+
words: words,
|
|
133
|
+
filter: filter,
|
|
134
|
+
pageNumber: this.pageNumber,
|
|
135
|
+
pageSize: this.pageSize,
|
|
136
|
+
config: this.args.config,
|
|
137
|
+
});
|
|
130
138
|
this.totalCount = results.totalCount;
|
|
131
139
|
return results.decisions;
|
|
132
140
|
} catch (e) {
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
Decision,
|
|
13
13
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/vlaamse-codex';
|
|
14
14
|
import { citedText } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/cited-text';
|
|
15
|
-
import {
|
|
15
|
+
import { CitationPluginEmberComponentConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin';
|
|
16
16
|
import {
|
|
17
17
|
LEGISLATION_TYPE_CONCEPTS,
|
|
18
18
|
LEGISLATION_TYPES,
|
|
@@ -22,7 +22,7 @@ import { findParentNodeOfType } from '@curvenote/prosemirror-utils';
|
|
|
22
22
|
|
|
23
23
|
interface Args {
|
|
24
24
|
controller: SayController;
|
|
25
|
-
config:
|
|
25
|
+
config: CitationPluginEmberComponentConfig;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export default class EditorPluginsCitationInsertComponent extends Component<Args> {
|
|
@@ -11,6 +11,7 @@ import { task as trackedTask } from 'ember-resources/util/ember-concurrency';
|
|
|
11
11
|
interface Args {
|
|
12
12
|
decision: Decision;
|
|
13
13
|
close: () => void;
|
|
14
|
+
config: { endpoint: string };
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export default class EditorPluginsCitationsDecisionDetailComponent extends Component<Args> {
|
|
@@ -32,12 +33,13 @@ export default class EditorPluginsCitationsDecisionDetailComponent extends Compo
|
|
|
32
33
|
this.error = null;
|
|
33
34
|
const abortController = new AbortController();
|
|
34
35
|
try {
|
|
35
|
-
const results = await fetchArticles(
|
|
36
|
-
this.args.decision.uri,
|
|
37
|
-
this.pageNumber,
|
|
38
|
-
this.pageSize,
|
|
39
|
-
this.articleFilterAfterTimeout
|
|
40
|
-
|
|
36
|
+
const results = await fetchArticles({
|
|
37
|
+
legalExpression: this.args.decision.uri,
|
|
38
|
+
pageNumber: this.pageNumber,
|
|
39
|
+
pageSize: this.pageSize,
|
|
40
|
+
articleFilter: this.articleFilterAfterTimeout,
|
|
41
|
+
config: this.args.config,
|
|
42
|
+
});
|
|
41
43
|
this.totalCount = results.totalCount;
|
|
42
44
|
return results.articles;
|
|
43
45
|
} catch (e) {
|
|
@@ -40,6 +40,7 @@ interface Args {
|
|
|
40
40
|
insertDecisionCitation: (decision: Decision) => void;
|
|
41
41
|
insertArticleCitation: (decision: Decision, article: Article) => void;
|
|
42
42
|
closeModal: (legislationTypeUri?: string, text?: string) => void;
|
|
43
|
+
config: { endpoint: string };
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
export default class EditorPluginsCitationsSearchModalComponent extends Component<Args> {
|
|
@@ -99,6 +100,10 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
|
|
|
99
100
|
return this.args.text;
|
|
100
101
|
}
|
|
101
102
|
|
|
103
|
+
get config() {
|
|
104
|
+
return this.args.config;
|
|
105
|
+
}
|
|
106
|
+
|
|
102
107
|
get searchText() {
|
|
103
108
|
return this.inputSearchText ?? this.text;
|
|
104
109
|
}
|
|
@@ -135,12 +140,13 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
|
|
|
135
140
|
publicationDateFrom: getISODate(this.publicationDateFrom),
|
|
136
141
|
publicationDateTo: getISODate(this.publicationDateTo),
|
|
137
142
|
};
|
|
138
|
-
const results = await fetchDecisions(
|
|
139
|
-
words,
|
|
140
|
-
filter,
|
|
141
|
-
this.pageNumber,
|
|
142
|
-
this.pageSize
|
|
143
|
-
|
|
143
|
+
const results = await fetchDecisions({
|
|
144
|
+
words: words,
|
|
145
|
+
filter: filter,
|
|
146
|
+
pageNumber: this.pageNumber,
|
|
147
|
+
pageSize: this.pageSize,
|
|
148
|
+
config: this.args.config,
|
|
149
|
+
});
|
|
144
150
|
this.totalCount = results.totalCount;
|
|
145
151
|
return results.decisions;
|
|
146
152
|
} catch (e) {
|
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
{{#if this.canInsertTitle}}
|
|
2
|
-
<AuAlert class="
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
</AuAlert>
|
|
2
|
+
<AuAlert class="validation-alert" @skin="warning" @closable={{false}} @icon="alert-triangle" @title={{t "besluit-plugin.missing-title-warning"}}>
|
|
3
|
+
<AuButton @iconAlignment="left" @skin="link-secondary" @disabled={{not this.canInsertTitle}} {{on 'click'
|
|
4
|
+
this.insertTitle}}>
|
|
5
|
+
{{t "besluit-plugin.insert.decision-title"}}
|
|
6
|
+
</AuButton>
|
|
7
|
+
</AuAlert>
|
|
8
|
+
{{/if}}
|
|
9
|
+
{{#if this.canInsertMotivation}}
|
|
10
|
+
<AuAlert class="validation-alert" @skin="warning" @closable={{false}} @icon="alert-triangle" @title={{t "besluit-plugin.missing-motivation-warning"}}>
|
|
11
|
+
<AuButton @iconAlignment="left" @skin="link-secondary" @disabled={{not this.canInsertMotivation}} {{on 'click'
|
|
12
|
+
this.insertMotivation}}>
|
|
13
|
+
{{t "besluit-plugin.insert.motivation"}}
|
|
14
|
+
</AuButton>
|
|
15
|
+
</AuAlert>
|
|
16
|
+
{{/if}}
|
|
17
|
+
{{#if this.missingArticleBlock}}
|
|
18
|
+
<AuAlert class="validation-alert" @skin="warning" @closable={{false}} @icon="alert-triangle" @title={{t "besluit-plugin.missing-article-block-warning"}}>
|
|
19
|
+
<AuButton @iconAlignment="left" @skin="link-secondary" @disabled={{not this.missingArticleBlock}} {{on 'click'
|
|
20
|
+
this.insertArticleBlock}}>
|
|
21
|
+
{{t "besluit-plugin.insert.article-block"}}
|
|
22
|
+
</AuButton>
|
|
23
|
+
</AuAlert>
|
|
8
24
|
{{/if}}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { action } from '@ember/object';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
insertMotivation,
|
|
5
|
+
insertArticleContainer,
|
|
6
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/decision-plugin/commands';
|
|
4
7
|
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
5
8
|
import { inject as service } from '@ember/service';
|
|
6
9
|
import IntlService from 'ember-intl/services/intl';
|
|
10
|
+
import { VALIDATION_KEY } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/validation';
|
|
7
11
|
|
|
8
12
|
type Args = {
|
|
9
13
|
controller: SayController;
|
|
@@ -24,26 +28,41 @@ export default class DecisionPluginCard extends Component<Args> {
|
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
@action
|
|
27
|
-
|
|
28
|
-
this.controller.doCommand(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
)
|
|
31
|
+
insertMotivation() {
|
|
32
|
+
this.controller.doCommand(insertMotivation({ intl: this.intl }), {
|
|
33
|
+
view: this.controller.mainEditorView,
|
|
34
|
+
});
|
|
35
|
+
this.focus();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
get canInsertMotivation() {
|
|
39
|
+
return this.controller.checkCommand(insertMotivation({ intl: this.intl }), {
|
|
40
|
+
view: this.controller.mainEditorView,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@action
|
|
45
|
+
insertArticleBlock() {
|
|
46
|
+
this.controller.doCommand(insertArticleContainer({ intl: this.intl }), {
|
|
47
|
+
view: this.controller.mainEditorView,
|
|
48
|
+
});
|
|
36
49
|
this.focus();
|
|
37
50
|
}
|
|
38
51
|
|
|
39
|
-
get
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
52
|
+
get missingArticleBlock() {
|
|
53
|
+
const state = VALIDATION_KEY.getState(this.controller.activeEditorState);
|
|
54
|
+
if (state) {
|
|
55
|
+
let missingArticleBlock = false;
|
|
56
|
+
const results = state.report.results;
|
|
57
|
+
if (!results) return false;
|
|
58
|
+
for (const result of results) {
|
|
59
|
+
if (result.sourceShape.name === 'at-least-one-article-container') {
|
|
60
|
+
missingArticleBlock = true;
|
|
61
|
+
}
|
|
46
62
|
}
|
|
47
|
-
|
|
63
|
+
return missingArticleBlock;
|
|
64
|
+
} else {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
48
67
|
}
|
|
49
68
|
}
|
|
@@ -7,25 +7,25 @@ import { localCopy } from 'tracked-toolbox';
|
|
|
7
7
|
import Intl from 'ember-intl/services/intl';
|
|
8
8
|
|
|
9
9
|
type Args = {
|
|
10
|
-
value
|
|
10
|
+
value?: Date;
|
|
11
11
|
onChange: (date: Date) => void;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export default class RdfaDatePluginDateTimePicker extends Component<Args> {
|
|
15
15
|
@service declare intl: Intl;
|
|
16
16
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
17
|
-
@localCopy('args.value') declare date
|
|
17
|
+
@localCopy('args.value') declare date?: Date;
|
|
18
18
|
|
|
19
19
|
get hours() {
|
|
20
|
-
return this.date
|
|
20
|
+
return this.date?.getHours();
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
get minutes() {
|
|
24
|
-
return this.date
|
|
24
|
+
return this.date?.getMinutes();
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
get seconds() {
|
|
28
|
-
return this.date
|
|
28
|
+
return this.date?.getSeconds();
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
get datePickerLocalization() {
|
|
@@ -132,6 +132,10 @@ export type CitationPluginConfig =
|
|
|
132
132
|
| CitationPluginNodeConfig
|
|
133
133
|
| CitationPluginRangeConfig;
|
|
134
134
|
|
|
135
|
+
export type CitationPluginEmberComponentConfig = CitationPluginConfig & {
|
|
136
|
+
endpoint: string;
|
|
137
|
+
};
|
|
138
|
+
|
|
135
139
|
export function citationPlugin(config: CitationPluginConfig): CitationPlugin {
|
|
136
140
|
const citation: CitationPlugin = new ProsePlugin({
|
|
137
141
|
state: {
|
|
@@ -8,10 +8,6 @@ import {
|
|
|
8
8
|
import Ember from 'ember';
|
|
9
9
|
import SafeString = Ember.Handlebars.SafeString;
|
|
10
10
|
|
|
11
|
-
const SPARQL_ENDPOINT = '/codex/sparql/';
|
|
12
|
-
|
|
13
|
-
//const SPARQL_ENDPOINT = 'https://codex.opendata.api.vlaanderen.be:8888/sparql';
|
|
14
|
-
|
|
15
11
|
interface DecisionArgs {
|
|
16
12
|
uri: string;
|
|
17
13
|
legislationTypeUri: Option<string>;
|
|
@@ -106,13 +102,20 @@ export interface QueryFilter {
|
|
|
106
102
|
publicationDateTo?: Option<string>;
|
|
107
103
|
}
|
|
108
104
|
|
|
109
|
-
async function fetchDecisions(
|
|
110
|
-
words
|
|
111
|
-
filter
|
|
105
|
+
async function fetchDecisions({
|
|
106
|
+
words,
|
|
107
|
+
filter,
|
|
112
108
|
pageNumber = 0,
|
|
113
|
-
pageSize = 5
|
|
109
|
+
pageSize = 5,
|
|
110
|
+
config,
|
|
111
|
+
}: {
|
|
112
|
+
words: string[];
|
|
113
|
+
filter: QueryFilter;
|
|
114
|
+
pageNumber: number;
|
|
115
|
+
pageSize: number;
|
|
116
|
+
config: CodexQueryConfig;
|
|
117
|
+
}) {
|
|
114
118
|
/*abortSignal*/
|
|
115
|
-
) {
|
|
116
119
|
//This is silly, but null != undefined, so we have to be careful and include the correct value here
|
|
117
120
|
//Also, reconstruct the whole filter object to always have the same ordering, hopefully.
|
|
118
121
|
filter = {
|
|
@@ -132,12 +135,13 @@ async function fetchDecisions(
|
|
|
132
135
|
if (results) {
|
|
133
136
|
return results;
|
|
134
137
|
} else {
|
|
135
|
-
const newResults = await fetchDecisionsMemo(
|
|
138
|
+
const newResults = await fetchDecisionsMemo({
|
|
136
139
|
words,
|
|
137
140
|
filter,
|
|
138
141
|
pageNumber,
|
|
139
|
-
pageSize
|
|
140
|
-
|
|
142
|
+
pageSize,
|
|
143
|
+
config,
|
|
144
|
+
});
|
|
141
145
|
fetchDecisionsMemory.set(stringArguments, newResults);
|
|
142
146
|
return newResults;
|
|
143
147
|
}
|
|
@@ -148,13 +152,19 @@ interface DecisionCollection {
|
|
|
148
152
|
decisions: Decision[];
|
|
149
153
|
}
|
|
150
154
|
|
|
151
|
-
async function fetchDecisionsMemo(
|
|
152
|
-
words
|
|
153
|
-
filter
|
|
155
|
+
async function fetchDecisionsMemo({
|
|
156
|
+
words,
|
|
157
|
+
filter,
|
|
154
158
|
pageNumber = 0,
|
|
155
159
|
pageSize = 5,
|
|
156
|
-
|
|
157
|
-
|
|
160
|
+
config,
|
|
161
|
+
}: {
|
|
162
|
+
words: string[];
|
|
163
|
+
filter: QueryFilter;
|
|
164
|
+
config: CodexQueryConfig;
|
|
165
|
+
pageNumber?: number;
|
|
166
|
+
pageSize?: number;
|
|
167
|
+
}): Promise<DecisionCollection> {
|
|
158
168
|
// TBD/NOTE: in the context of a <http://data.europa.eu/eli/ontology#LegalResource>
|
|
159
169
|
// the eli:cites can have either a <http://xmlns.com/foaf/0.1/Document> or <http://data.europa.eu/eli/ontology#LegalResource>
|
|
160
170
|
// as range (see AP https://data.vlaanderen.be/doc/applicatieprofiel/besluit-publicatie/#Rechtsgrond),
|
|
@@ -199,8 +209,8 @@ async function fetchDecisionsMemo(
|
|
|
199
209
|
'FILTER(! STRSTARTS(LCASE(?title),"tot wijziging"))'
|
|
200
210
|
);
|
|
201
211
|
}
|
|
202
|
-
const totalCount = await executeCountQuery(
|
|
203
|
-
`PREFIX eli: <http://data.europa.eu/eli/ontology#>
|
|
212
|
+
const totalCount = await executeCountQuery({
|
|
213
|
+
query: `PREFIX eli: <http://data.europa.eu/eli/ontology#>
|
|
204
214
|
|
|
205
215
|
SELECT COUNT(DISTINCT(?expressionUri)) as ?count
|
|
206
216
|
WHERE {
|
|
@@ -220,12 +230,12 @@ async function fetchDecisionsMemo(
|
|
|
220
230
|
${documentDateFilter}
|
|
221
231
|
${publicationDateFilter}
|
|
222
232
|
}`,
|
|
223
|
-
|
|
224
|
-
);
|
|
233
|
+
config,
|
|
234
|
+
});
|
|
225
235
|
|
|
226
236
|
if (totalCount > 0) {
|
|
227
|
-
const response = await executeQuery<DecisionBinding>(
|
|
228
|
-
`PREFIX eli: <http://data.europa.eu/eli/ontology#>
|
|
237
|
+
const response = await executeQuery<DecisionBinding>({
|
|
238
|
+
query: `PREFIX eli: <http://data.europa.eu/eli/ontology#>
|
|
229
239
|
|
|
230
240
|
SELECT DISTINCT ?expressionUri as ?uri ?title ?publicationDate ?documentDate
|
|
231
241
|
WHERE {
|
|
@@ -246,8 +256,8 @@ async function fetchDecisionsMemo(
|
|
|
246
256
|
${documentDateFilter}
|
|
247
257
|
${publicationDateFilter}
|
|
248
258
|
} ORDER BY ?title LIMIT ${pageSize} OFFSET ${pageNumber * pageSize}`,
|
|
249
|
-
|
|
250
|
-
);
|
|
259
|
+
config,
|
|
260
|
+
});
|
|
251
261
|
|
|
252
262
|
const decisions = response.results.bindings.map((binding) => {
|
|
253
263
|
const escapedTitle = escapeValue(binding.title.value);
|
|
@@ -291,13 +301,19 @@ interface DecisionBinding {
|
|
|
291
301
|
|
|
292
302
|
const fetchArticlesMemory = new Map<string, ArticleCollection>();
|
|
293
303
|
|
|
294
|
-
async function fetchArticles(
|
|
295
|
-
legalExpression
|
|
296
|
-
pageNumber
|
|
297
|
-
pageSize
|
|
298
|
-
articleFilter
|
|
299
|
-
|
|
300
|
-
|
|
304
|
+
async function fetchArticles({
|
|
305
|
+
legalExpression,
|
|
306
|
+
pageNumber,
|
|
307
|
+
pageSize,
|
|
308
|
+
articleFilter,
|
|
309
|
+
config,
|
|
310
|
+
}: {
|
|
311
|
+
legalExpression: string;
|
|
312
|
+
pageNumber: number;
|
|
313
|
+
pageSize: number;
|
|
314
|
+
articleFilter: string;
|
|
315
|
+
config: CodexQueryConfig;
|
|
316
|
+
}): Promise<ArticleCollection> {
|
|
301
317
|
//Simpler here, only one way arguments are set up
|
|
302
318
|
const stringArguments = JSON.stringify({
|
|
303
319
|
legalExpression,
|
|
@@ -309,12 +325,13 @@ async function fetchArticles(
|
|
|
309
325
|
if (results) {
|
|
310
326
|
return results;
|
|
311
327
|
} else {
|
|
312
|
-
const newResults = await fetchArticlesMemo(
|
|
328
|
+
const newResults = await fetchArticlesMemo({
|
|
313
329
|
legalExpression,
|
|
314
330
|
pageNumber,
|
|
315
331
|
pageSize,
|
|
316
|
-
articleFilter
|
|
317
|
-
|
|
332
|
+
articleFilter,
|
|
333
|
+
config,
|
|
334
|
+
});
|
|
318
335
|
fetchArticlesMemory.set(stringArguments, newResults);
|
|
319
336
|
return newResults;
|
|
320
337
|
}
|
|
@@ -352,18 +369,24 @@ interface ArticleCollection {
|
|
|
352
369
|
articles: Article[];
|
|
353
370
|
}
|
|
354
371
|
|
|
355
|
-
async function fetchArticlesMemo(
|
|
356
|
-
legalExpression
|
|
372
|
+
async function fetchArticlesMemo({
|
|
373
|
+
legalExpression,
|
|
357
374
|
pageNumber = 0,
|
|
358
375
|
pageSize = 10,
|
|
359
|
-
articleFilter
|
|
360
|
-
|
|
361
|
-
|
|
376
|
+
articleFilter,
|
|
377
|
+
config,
|
|
378
|
+
}: {
|
|
379
|
+
legalExpression: string;
|
|
380
|
+
pageNumber: number;
|
|
381
|
+
pageSize: number;
|
|
382
|
+
articleFilter: string;
|
|
383
|
+
config: CodexQueryConfig;
|
|
384
|
+
}): Promise<ArticleCollection> {
|
|
362
385
|
const numberFilter = articleFilter
|
|
363
386
|
? `FILTER( !BOUND(?number) || CONTAINS(?number, "${articleFilter}"))`
|
|
364
387
|
: '';
|
|
365
|
-
const totalCount = await executeCountQuery(
|
|
366
|
-
`PREFIX eli: <http://data.europa.eu/eli/ontology#>
|
|
388
|
+
const totalCount = await executeCountQuery({
|
|
389
|
+
query: `PREFIX eli: <http://data.europa.eu/eli/ontology#>
|
|
367
390
|
PREFIX dct: <http://purl.org/dc/terms/>
|
|
368
391
|
|
|
369
392
|
SELECT COUNT(DISTINCT(?article)) as ?count
|
|
@@ -381,14 +404,14 @@ async function fetchArticlesMemo(
|
|
|
381
404
|
OPTIONAL { ?article eli:number ?number . }
|
|
382
405
|
${numberFilter}
|
|
383
406
|
}`,
|
|
384
|
-
|
|
385
|
-
);
|
|
407
|
+
config,
|
|
408
|
+
});
|
|
386
409
|
|
|
387
410
|
if (totalCount > 0) {
|
|
388
411
|
// ?number has format like "Artikel 12." We parse the number from the string for ordering
|
|
389
412
|
// Second degree ordering on ?numberStr to make sure "Artikel 3/1." comes after "Artikel 3."
|
|
390
|
-
const response = await executeQuery<ArticleBinding>(
|
|
391
|
-
`PREFIX eli: <http://data.europa.eu/eli/ontology#>
|
|
413
|
+
const response = await executeQuery<ArticleBinding>({
|
|
414
|
+
query: `PREFIX eli: <http://data.europa.eu/eli/ontology#>
|
|
392
415
|
PREFIX prov: <http://www.w3.org/ns/prov#>
|
|
393
416
|
PREFIX dct: <http://purl.org/dc/terms/>
|
|
394
417
|
|
|
@@ -411,8 +434,8 @@ async function fetchArticlesMemo(
|
|
|
411
434
|
} ORDER BY ?numberInt ?numberStr LIMIT ${pageSize} OFFSET ${
|
|
412
435
|
pageNumber * pageSize
|
|
413
436
|
}`,
|
|
414
|
-
|
|
415
|
-
);
|
|
437
|
+
config,
|
|
438
|
+
});
|
|
416
439
|
|
|
417
440
|
const articles = response.results.bindings.map((binding) => {
|
|
418
441
|
const escapedContent = escapeValue(
|
|
@@ -483,28 +506,39 @@ function dateValue(value?: string): string | null {
|
|
|
483
506
|
}
|
|
484
507
|
}
|
|
485
508
|
|
|
486
|
-
async function executeCountQuery(
|
|
487
|
-
|
|
509
|
+
async function executeCountQuery({
|
|
510
|
+
query,
|
|
511
|
+
config,
|
|
512
|
+
}: {
|
|
513
|
+
query: string;
|
|
514
|
+
config: CodexQueryConfig;
|
|
515
|
+
}) {
|
|
516
|
+
const response = await executeQuery<{ count: { value: string } }>({
|
|
488
517
|
query,
|
|
489
|
-
|
|
490
|
-
);
|
|
518
|
+
config,
|
|
519
|
+
});
|
|
491
520
|
return optionMapOr(0, parseInt, response.results.bindings[0]?.count.value);
|
|
492
521
|
}
|
|
493
522
|
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
523
|
+
type CodexQueryConfig = { endpoint: string; abortSignal?: AbortSignal };
|
|
524
|
+
|
|
525
|
+
async function executeQuery<A>({
|
|
526
|
+
query,
|
|
527
|
+
config,
|
|
528
|
+
}: {
|
|
529
|
+
query: string;
|
|
530
|
+
config: CodexQueryConfig;
|
|
531
|
+
}): Promise<QueryResponse<A>> {
|
|
498
532
|
const encodedQuery = encodeURIComponent(query.trim());
|
|
499
|
-
|
|
500
|
-
const response = await fetch(endpoint, {
|
|
533
|
+
|
|
534
|
+
const response = await fetch(config.endpoint, {
|
|
501
535
|
method: 'POST',
|
|
502
536
|
headers: {
|
|
503
537
|
Accept: 'application/sparql-results+json',
|
|
504
538
|
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
|
505
539
|
},
|
|
506
540
|
body: `query=${encodedQuery}`,
|
|
507
|
-
signal: abortSignal,
|
|
541
|
+
signal: config.abortSignal,
|
|
508
542
|
});
|
|
509
543
|
|
|
510
544
|
if (response.ok) {
|
|
@@ -8,16 +8,17 @@ import { v4 as uuid } from 'uuid';
|
|
|
8
8
|
import { isNone } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
|
|
9
9
|
import { transactionCompliesWithShapes } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/validation/utils/transaction-complies-with-shapes';
|
|
10
10
|
import { findInsertionPosInAncestorOfType } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/find-insertion-pos-in-ancestor-of-type';
|
|
11
|
+
import IntlService from 'ember-intl/services/intl';
|
|
11
12
|
|
|
12
13
|
interface InsertMotivationArgs {
|
|
13
|
-
|
|
14
|
+
intl: IntlService;
|
|
14
15
|
validateShapes?: Set<string>;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export default function insertMotivation({
|
|
19
|
+
intl,
|
|
18
20
|
validateShapes,
|
|
19
|
-
|
|
20
|
-
}: InsertMotivationArgs = {}): Command {
|
|
21
|
+
}: InsertMotivationArgs): Command {
|
|
21
22
|
return function (state: EditorState, dispatch?: (tr: Transaction) => void) {
|
|
22
23
|
const { selection, schema } = state;
|
|
23
24
|
const nodeToInsert = schema.node('motivering', { __rdfaId: uuid() }, [
|
|
@@ -25,9 +26,63 @@ export default function insertMotivation({
|
|
|
25
26
|
'paragraph',
|
|
26
27
|
null,
|
|
27
28
|
schema.node('placeholder', {
|
|
28
|
-
placeholderText,
|
|
29
|
+
placeholderText: intl.t('besluit-plugin.placeholder.government-body'),
|
|
29
30
|
})
|
|
30
31
|
),
|
|
32
|
+
schema.node(
|
|
33
|
+
'heading',
|
|
34
|
+
{
|
|
35
|
+
level: 5,
|
|
36
|
+
},
|
|
37
|
+
[schema.text(intl.t('besluit-plugin.text.authority'))]
|
|
38
|
+
),
|
|
39
|
+
schema.node('bullet_list', null, [
|
|
40
|
+
schema.node('list_item', null, [
|
|
41
|
+
schema.node('paragraph', null, [
|
|
42
|
+
schema.node('placeholder', {
|
|
43
|
+
placeholderText: intl.t(
|
|
44
|
+
'besluit-plugin.placeholder.legal-jurisdiction'
|
|
45
|
+
),
|
|
46
|
+
}),
|
|
47
|
+
]),
|
|
48
|
+
]),
|
|
49
|
+
]),
|
|
50
|
+
schema.node(
|
|
51
|
+
'heading',
|
|
52
|
+
{
|
|
53
|
+
level: 5,
|
|
54
|
+
},
|
|
55
|
+
[schema.text(intl.t('besluit-plugin.text.legal-context'))]
|
|
56
|
+
),
|
|
57
|
+
schema.node('bullet_list', null, [
|
|
58
|
+
schema.node('list_item', null, [
|
|
59
|
+
schema.node('paragraph', null, [
|
|
60
|
+
schema.node('placeholder', {
|
|
61
|
+
placeholderText: intl.t(
|
|
62
|
+
'besluit-plugin.placeholder.insert-legal-context'
|
|
63
|
+
),
|
|
64
|
+
}),
|
|
65
|
+
]),
|
|
66
|
+
]),
|
|
67
|
+
]),
|
|
68
|
+
schema.node(
|
|
69
|
+
'heading',
|
|
70
|
+
{
|
|
71
|
+
level: 5,
|
|
72
|
+
},
|
|
73
|
+
[schema.text(intl.t('besluit-plugin.text.factual-context'))]
|
|
74
|
+
),
|
|
75
|
+
schema.node('bullet_list', null, [
|
|
76
|
+
schema.node('list_item', null, [
|
|
77
|
+
schema.node('paragraph', null, [
|
|
78
|
+
schema.node('placeholder', {
|
|
79
|
+
placeholderText: intl.t(
|
|
80
|
+
'besluit-plugin.placeholder.insert-factual-context'
|
|
81
|
+
),
|
|
82
|
+
}),
|
|
83
|
+
]),
|
|
84
|
+
]),
|
|
85
|
+
]),
|
|
31
86
|
]);
|
|
32
87
|
// how the offset between the insertion point and the point where the cursor should end up
|
|
33
88
|
const cursorOffset = 2;
|
|
@@ -47,8 +102,6 @@ export default function insertMotivation({
|
|
|
47
102
|
return false;
|
|
48
103
|
}
|
|
49
104
|
if (dispatch) {
|
|
50
|
-
console.log('inserts in ', insertionPos);
|
|
51
|
-
console.log('selection on ', insertionPos + cursorOffset);
|
|
52
105
|
const selectionPos = tr.doc.resolve(insertionPos + cursorOffset);
|
|
53
106
|
// const targetPos = tr.doc.resolve(insertionPos + cursorOffset + 1);
|
|
54
107
|
// TODO figure out why I cant just set a nodeSelection here
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Schema } from '@lblod/ember-rdfa-editor';
|
|
2
|
+
|
|
3
|
+
export const atLeastOneArticleContainer = (schema: Schema) => ({
|
|
4
|
+
name: 'at-least-one-article-container',
|
|
5
|
+
focusNodeType: schema.nodes.besluit,
|
|
6
|
+
path: ['article_container'],
|
|
7
|
+
message: 'Document must contain at least one article container.',
|
|
8
|
+
constraints: {
|
|
9
|
+
minCount: 1,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
@@ -16,11 +16,9 @@ const date: (options: DateOptions) => NodeSpec = (options) => {
|
|
|
16
16
|
mappingResource: {
|
|
17
17
|
default: null,
|
|
18
18
|
},
|
|
19
|
-
value: {
|
|
20
|
-
default: new Date().toISOString(),
|
|
21
|
-
},
|
|
19
|
+
value: {},
|
|
22
20
|
format: {
|
|
23
|
-
default:
|
|
21
|
+
default: options.formats[0].dateFormat,
|
|
24
22
|
},
|
|
25
23
|
onlyDate: {
|
|
26
24
|
default: true,
|
|
@@ -86,7 +84,7 @@ const date: (options: DateOptions) => NodeSpec = (options) => {
|
|
|
86
84
|
) {
|
|
87
85
|
const onlyDate = hasRDFaAttribute(node, 'datatype', XSD('date'));
|
|
88
86
|
return {
|
|
89
|
-
value: node.getAttribute('content'),
|
|
87
|
+
value: node.getAttribute('content') ?? new Date().toISOString(),
|
|
90
88
|
onlyDate,
|
|
91
89
|
format: node.dataset.format,
|
|
92
90
|
custom: node.dataset.custom === 'true',
|
|
@@ -115,13 +113,14 @@ const date: (options: DateOptions) => NodeSpec = (options) => {
|
|
|
115
113
|
);
|
|
116
114
|
const dateNode = [...node.children].find((el) =>
|
|
117
115
|
hasRDFaAttribute(el, 'property', EXT('content'))
|
|
118
|
-
);
|
|
116
|
+
) as HTMLElement | undefined;
|
|
119
117
|
return {
|
|
120
118
|
mappingResource,
|
|
121
119
|
onlyDate,
|
|
122
|
-
value:
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
value:
|
|
121
|
+
dateNode?.getAttribute('content') ?? new Date().toISOString(),
|
|
122
|
+
format: dateNode?.dataset.format,
|
|
123
|
+
custom: dateNode?.dataset.custom === 'true',
|
|
125
124
|
};
|
|
126
125
|
}
|
|
127
126
|
}
|
|
@@ -141,13 +141,7 @@ export function validation(
|
|
|
141
141
|
const schemaChanged = oldState.schema !== newState.schema;
|
|
142
142
|
if (schemaChanged) {
|
|
143
143
|
const spec = compileSpec(configurator, newState.schema);
|
|
144
|
-
const newValidation = doValidation(
|
|
145
|
-
tr,
|
|
146
|
-
oldPluginState,
|
|
147
|
-
oldState,
|
|
148
|
-
newState,
|
|
149
|
-
spec
|
|
150
|
-
);
|
|
144
|
+
const newValidation = doValidation(newState, spec);
|
|
151
145
|
tr.setMeta('validated', newValidation);
|
|
152
146
|
tr.setMeta('firstPass', false);
|
|
153
147
|
return { spec, report: newValidation };
|
|
@@ -166,13 +160,7 @@ export function validation(
|
|
|
166
160
|
tr.setMeta('firstPass', false);
|
|
167
161
|
return cachedValidation;
|
|
168
162
|
}
|
|
169
|
-
const newValidation = doValidation(
|
|
170
|
-
tr,
|
|
171
|
-
oldPluginState,
|
|
172
|
-
oldState,
|
|
173
|
-
newState,
|
|
174
|
-
spec
|
|
175
|
-
);
|
|
163
|
+
const newValidation = doValidation(newState, spec);
|
|
176
164
|
tr.setMeta('validated', newValidation);
|
|
177
165
|
tr.setMeta('firstPass', false);
|
|
178
166
|
return { spec, report: newValidation };
|
|
@@ -230,9 +218,6 @@ interface ValidationContext {
|
|
|
230
218
|
* @param spec
|
|
231
219
|
*/
|
|
232
220
|
function doValidation(
|
|
233
|
-
tr: Transaction,
|
|
234
|
-
oldPluginState: ValidationState,
|
|
235
|
-
oldState: EditorState,
|
|
236
221
|
newState: EditorState,
|
|
237
222
|
spec: ValidationSpec
|
|
238
223
|
): ValidationReport {
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
margin-left: 0.3rem;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
+
.mark-highlight-manual + .ProseMirror-firefox-fake-cursor {
|
|
6
|
+
margin-left: -0.5rem;
|
|
7
|
+
}
|
|
8
|
+
|
|
5
9
|
[typeof='ext:Mapping'] {
|
|
6
10
|
border-bottom: 0 !important;
|
|
7
11
|
|
|
@@ -63,4 +67,4 @@
|
|
|
63
67
|
background-color: var(--au-blue-300);
|
|
64
68
|
}
|
|
65
69
|
}
|
|
66
|
-
}
|
|
70
|
+
}
|
|
@@ -6,6 +6,9 @@ import { SayController } from '@lblod/ember-rdfa-editor';
|
|
|
6
6
|
interface Args {
|
|
7
7
|
controller: SayController;
|
|
8
8
|
plugin: CitationPlugin;
|
|
9
|
+
config: {
|
|
10
|
+
endpoint: string;
|
|
11
|
+
};
|
|
9
12
|
}
|
|
10
13
|
export default class CitationCardComponent extends Component<Args> {
|
|
11
14
|
pageNumber: number;
|
|
@@ -24,6 +27,9 @@ export default class CitationCardComponent extends Component<Args> {
|
|
|
24
27
|
get controller(): SayController;
|
|
25
28
|
get showCard(): false | Option<CitationDecoration>;
|
|
26
29
|
get plugin(): CitationPlugin;
|
|
30
|
+
get config(): {
|
|
31
|
+
endpoint: string;
|
|
32
|
+
};
|
|
27
33
|
get decorations(): import("prosemirror-view").DecorationSet | undefined;
|
|
28
34
|
get activeDecoration(): Option<CitationDecoration>;
|
|
29
35
|
get searchText(): string;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
3
3
|
import { Article, Decision } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/vlaamse-codex';
|
|
4
|
-
import {
|
|
4
|
+
import { CitationPluginEmberComponentConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin';
|
|
5
5
|
interface Args {
|
|
6
6
|
controller: SayController;
|
|
7
|
-
config:
|
|
7
|
+
config: CitationPluginEmberComponentConfig;
|
|
8
8
|
}
|
|
9
9
|
export default class EditorPluginsCitationInsertComponent extends Component<Args> {
|
|
10
10
|
showModal: boolean;
|
|
11
11
|
legislationTypeUri: string;
|
|
12
12
|
text: string;
|
|
13
13
|
legislationType: string | null;
|
|
14
|
-
get config():
|
|
14
|
+
get config(): CitationPluginEmberComponentConfig;
|
|
15
15
|
get selectedLegislationTypeUri(): string;
|
|
16
16
|
get selectedLegislationType(): {
|
|
17
17
|
label: string;
|
|
@@ -3,6 +3,9 @@ import { Decision } from '../../../plugins/citation-plugin/utils/vlaamse-codex';
|
|
|
3
3
|
interface Args {
|
|
4
4
|
decision: Decision;
|
|
5
5
|
close: () => void;
|
|
6
|
+
config: {
|
|
7
|
+
endpoint: string;
|
|
8
|
+
};
|
|
6
9
|
}
|
|
7
10
|
export default class EditorPluginsCitationsDecisionDetailComponent extends Component<Args> {
|
|
8
11
|
error: unknown;
|
|
@@ -8,6 +8,9 @@ interface Args {
|
|
|
8
8
|
insertDecisionCitation: (decision: Decision) => void;
|
|
9
9
|
insertArticleCitation: (decision: Decision, article: Article) => void;
|
|
10
10
|
closeModal: (legislationTypeUri?: string, text?: string) => void;
|
|
11
|
+
config: {
|
|
12
|
+
endpoint: string;
|
|
13
|
+
};
|
|
11
14
|
}
|
|
12
15
|
export default class EditorPluginsCitationsSearchModalComponent extends Component<Args> {
|
|
13
16
|
intl: IntlService;
|
|
@@ -42,6 +45,9 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
|
|
|
42
45
|
get legislationTypes(): string[];
|
|
43
46
|
get legislationSelected(): string;
|
|
44
47
|
get text(): string;
|
|
48
|
+
get config(): {
|
|
49
|
+
endpoint: string;
|
|
50
|
+
};
|
|
45
51
|
get searchText(): string;
|
|
46
52
|
get rangeStart(): number;
|
|
47
53
|
get rangeEnd(): number;
|
|
@@ -11,7 +11,9 @@ export default class DecisionPluginCard extends Component<Args> {
|
|
|
11
11
|
intl: IntlService;
|
|
12
12
|
get controller(): SayController;
|
|
13
13
|
focus(): void;
|
|
14
|
-
|
|
15
|
-
get
|
|
14
|
+
insertMotivation(): void;
|
|
15
|
+
get canInsertMotivation(): boolean;
|
|
16
|
+
insertArticleBlock(): void;
|
|
17
|
+
get missingArticleBlock(): boolean;
|
|
16
18
|
}
|
|
17
19
|
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import Intl from 'ember-intl/services/intl';
|
|
3
3
|
type Args = {
|
|
4
|
-
value
|
|
4
|
+
value?: Date;
|
|
5
5
|
onChange: (date: Date) => void;
|
|
6
6
|
};
|
|
7
7
|
export default class RdfaDatePluginDateTimePicker extends Component<Args> {
|
|
8
8
|
intl: Intl;
|
|
9
|
-
date
|
|
10
|
-
get hours(): number;
|
|
11
|
-
get minutes(): number;
|
|
12
|
-
get seconds(): number;
|
|
9
|
+
date?: Date;
|
|
10
|
+
get hours(): number | undefined;
|
|
11
|
+
get minutes(): number | undefined;
|
|
12
|
+
get seconds(): number | undefined;
|
|
13
13
|
get datePickerLocalization(): {
|
|
14
14
|
buttonLabel: string;
|
|
15
15
|
selectedDateMessage: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lblod/ember-rdfa-editor-lblod-plugins",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@embroider/test-setup": "^1.8.3",
|
|
64
64
|
"@glimmer/component": "^1.1.2",
|
|
65
65
|
"@glimmer/tracking": "^1.1.2",
|
|
66
|
-
"@lblod/ember-rdfa-editor": "^3.
|
|
66
|
+
"@lblod/ember-rdfa-editor": "^3.7.0",
|
|
67
67
|
"@rdfjs/types": "^1.1.0",
|
|
68
68
|
"@release-it/keep-a-changelog": "^3.1.0",
|
|
69
69
|
"@tsconfig/ember": "^1.0.1",
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
},
|
|
144
144
|
"peerDependencies": {
|
|
145
145
|
"@appuniversum/ember-appuniversum": "^2.4.2",
|
|
146
|
-
"@lblod/ember-rdfa-editor": "^3.
|
|
146
|
+
"@lblod/ember-rdfa-editor": "^3.7.0",
|
|
147
147
|
"ember-concurrency": "^2.3.7"
|
|
148
148
|
},
|
|
149
149
|
"engines": {
|
|
@@ -31,5 +31,8 @@ export interface CitationPluginRangeConfig {
|
|
|
31
31
|
activeInRanges(state: EditorState): [number, number][];
|
|
32
32
|
}
|
|
33
33
|
export type CitationPluginConfig = CitationPluginNodeConfig | CitationPluginRangeConfig;
|
|
34
|
+
export type CitationPluginEmberComponentConfig = CitationPluginConfig & {
|
|
35
|
+
endpoint: string;
|
|
36
|
+
};
|
|
34
37
|
export declare function citationPlugin(config: CitationPluginConfig): CitationPlugin;
|
|
35
38
|
export {};
|
|
@@ -42,15 +42,31 @@ export interface QueryFilter {
|
|
|
42
42
|
publicationDateFrom?: Option<string>;
|
|
43
43
|
publicationDateTo?: Option<string>;
|
|
44
44
|
}
|
|
45
|
-
declare function fetchDecisions(words
|
|
45
|
+
declare function fetchDecisions({ words, filter, pageNumber, pageSize, config, }: {
|
|
46
|
+
words: string[];
|
|
47
|
+
filter: QueryFilter;
|
|
48
|
+
pageNumber: number;
|
|
49
|
+
pageSize: number;
|
|
50
|
+
config: CodexQueryConfig;
|
|
51
|
+
}): Promise<DecisionCollection>;
|
|
46
52
|
interface DecisionCollection {
|
|
47
53
|
totalCount: number;
|
|
48
54
|
decisions: Decision[];
|
|
49
55
|
}
|
|
50
|
-
declare function fetchArticles(legalExpression
|
|
56
|
+
declare function fetchArticles({ legalExpression, pageNumber, pageSize, articleFilter, config, }: {
|
|
57
|
+
legalExpression: string;
|
|
58
|
+
pageNumber: number;
|
|
59
|
+
pageSize: number;
|
|
60
|
+
articleFilter: string;
|
|
61
|
+
config: CodexQueryConfig;
|
|
62
|
+
}): Promise<ArticleCollection>;
|
|
51
63
|
interface ArticleCollection {
|
|
52
64
|
totalCount: number;
|
|
53
65
|
articles: Article[];
|
|
54
66
|
}
|
|
55
67
|
declare function cleanCaches(): void;
|
|
68
|
+
type CodexQueryConfig = {
|
|
69
|
+
endpoint: string;
|
|
70
|
+
abortSignal?: AbortSignal;
|
|
71
|
+
};
|
|
56
72
|
export { fetchDecisions, fetchArticles, cleanCaches };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Command } from '@lblod/ember-rdfa-editor';
|
|
2
|
+
import IntlService from 'ember-intl/services/intl';
|
|
2
3
|
interface InsertMotivationArgs {
|
|
3
|
-
|
|
4
|
+
intl: IntlService;
|
|
4
5
|
validateShapes?: Set<string>;
|
|
5
6
|
}
|
|
6
|
-
export default function insertMotivation({
|
|
7
|
+
export default function insertMotivation({ intl, validateShapes, }: InsertMotivationArgs): Command;
|
|
7
8
|
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Schema } from '@lblod/ember-rdfa-editor';
|
|
2
|
+
export declare const atLeastOneArticleContainer: (schema: Schema) => {
|
|
3
|
+
name: string;
|
|
4
|
+
focusNodeType: import("prosemirror-model").NodeType;
|
|
5
|
+
path: string[];
|
|
6
|
+
message: string;
|
|
7
|
+
constraints: {
|
|
8
|
+
minCount: number;
|
|
9
|
+
};
|
|
10
|
+
};
|
package/translations/en-US.yaml
CHANGED
|
@@ -114,11 +114,24 @@ besluit-type-plugin:
|
|
|
114
114
|
error-rest-body: '. For more specific details about this problem, inspect the browser console.'
|
|
115
115
|
|
|
116
116
|
besluit-plugin:
|
|
117
|
-
missing-title-warning: This decision is missing a title
|
|
117
|
+
missing-title-warning: This decision is missing a title.
|
|
118
|
+
missing-motivation-warning: This decision is missing a motivation block, a decision without this block will be harder to parse by our system.
|
|
119
|
+
missing-article-block-warning: This decision is missing an article block, a decision without this block will be harder to parse by our system.
|
|
118
120
|
insert:
|
|
119
121
|
decision-title: Insert decision title
|
|
122
|
+
motivation: Insert motivation
|
|
123
|
+
article-block: Insert article block
|
|
120
124
|
placeholder:
|
|
121
125
|
decision-title: Insert decision title
|
|
126
|
+
government-body: specify governing body
|
|
127
|
+
legal-jurisdiction: Legal basis providing that body has jurisdiction.
|
|
128
|
+
insert-legal-context: Insert juridische context
|
|
129
|
+
insert-factual-context: Factual context and reasoning
|
|
130
|
+
insert-article: Insert article
|
|
131
|
+
text:
|
|
132
|
+
authority: Authority
|
|
133
|
+
legal-context: Legal context
|
|
134
|
+
factual-context: Factual context and reasoning
|
|
122
135
|
|
|
123
136
|
date-plugin:
|
|
124
137
|
help:
|
package/translations/nl-BE.yaml
CHANGED
|
@@ -117,11 +117,24 @@ besluit-type-plugin:
|
|
|
117
117
|
|
|
118
118
|
|
|
119
119
|
besluit-plugin:
|
|
120
|
-
missing-title-warning: Dit besluit heeft geen titel
|
|
120
|
+
missing-title-warning: Dit besluit heeft geen titel.
|
|
121
|
+
missing-motivation-warning: Dit besluit mist een motivatieblok, een besluit zonder dit blok zal moeilijker te ontleden zijn door ons systeem.
|
|
122
|
+
missing-article-block-warning: Deze besluit mist een artikelblok, een besluit zonder dit blok zal moeilijker te ontleden zijn door ons systeem.
|
|
121
123
|
insert:
|
|
122
124
|
decision-title: Voeg besluittitel in
|
|
125
|
+
motivation: Voeg motivatie in
|
|
126
|
+
article-block: Voeg artikelblok in
|
|
123
127
|
placeholder:
|
|
124
128
|
decision-title: Geef titel besluit op
|
|
129
|
+
government-body: geef bestuursorgaan op
|
|
130
|
+
legal-jurisdiction: Rechtsgrond die bepaalt dat dit orgaan bevoegd is.
|
|
131
|
+
insert-legal-context: Voeg juridische context in
|
|
132
|
+
insert-factual-context: Feitelijke context en argumentatie
|
|
133
|
+
insert-article: Artikel invoegen
|
|
134
|
+
text:
|
|
135
|
+
authority: Bevoegdheid
|
|
136
|
+
legal-context: Juridische context
|
|
137
|
+
factual-context: Feitelijke context en argumentatie
|
|
125
138
|
|
|
126
139
|
|
|
127
140
|
date-plugin:
|