@lblod/ember-rdfa-editor-lblod-plugins 12.0.0 → 13.0.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/.changeset.yml +1 -2
- package/CHANGELOG.md +49 -1
- package/README.md +242 -138
- package/addon/components/citation-plugin/citations/search-modal.hbs +22 -0
- package/addon/components/citation-plugin/citations/search-modal.ts +15 -0
- package/addon/components/decision-plugin/decision-plugin-card.hbs +3 -3
- package/addon/components/snippet-plugin/snippet-list/snippet-list-view.hbs +2 -2
- package/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.ts +1 -0
- package/addon/components/template-comments-plugin/template-comment.hbs +4 -4
- package/addon/components/template-comments-plugin/template-comment.ts +16 -0
- package/addon/components/variable-plugin/address/edit.ts +1 -1
- package/addon/components/variable-plugin/address/insert-variable.hbs +9 -0
- package/addon/components/variable-plugin/address/insert-variable.ts +40 -0
- package/addon/components/variable-plugin/address/insert.hbs +2 -1
- package/addon/components/variable-plugin/address/insert.ts +22 -18
- package/addon/components/variable-plugin/address/nodeview.hbs +2 -2
- package/addon/components/variable-plugin/address/nodeview.ts +23 -1
- package/addon/components/variable-plugin/address/utils.ts +26 -0
- package/addon/components/variable-plugin/codelist/insert.ts +10 -1
- package/addon/components/{rdfa-date-plugin → variable-plugin/date}/date-time-picker.ts +1 -1
- package/addon/components/{rdfa-date-plugin/card.hbs → variable-plugin/date/edit.hbs} +3 -3
- package/addon/components/{rdfa-date-plugin/card.ts → variable-plugin/date/edit.ts} +10 -10
- package/addon/components/{rdfa-date-plugin → variable-plugin/date}/help-modal.ts +2 -2
- package/addon/components/variable-plugin/date/insert-variable.hbs +9 -0
- package/addon/components/variable-plugin/date/insert-variable.ts +57 -0
- package/addon/components/variable-plugin/date/insert.hbs +9 -9
- package/addon/components/variable-plugin/date/insert.ts +13 -10
- package/addon/components/{rdfa-date-plugin/date.hbs → variable-plugin/date/nodeview.hbs} +1 -1
- package/addon/components/{rdfa-date-plugin/date.ts → variable-plugin/date/nodeview.ts} +20 -6
- package/addon/components/variable-plugin/location/insert.ts +11 -2
- package/addon/components/variable-plugin/location/nodeview.hbs +8 -0
- package/addon/components/variable-plugin/location/nodeview.ts +15 -0
- package/addon/components/variable-plugin/number/insert.hbs +1 -1
- package/addon/components/variable-plugin/number/insert.ts +9 -1
- package/addon/components/variable-plugin/number/nodeview.hbs +2 -2
- package/addon/components/variable-plugin/number/nodeview.ts +17 -0
- package/addon/components/variable-plugin/text/insert.ts +14 -2
- package/addon/components/variable-plugin/variable/nodeview.hbs +1 -0
- package/addon/plugins/citation-plugin/index.ts +1 -0
- package/addon/plugins/citation-plugin/utils/legal-documents.ts +2 -0
- package/addon/plugins/citation-plugin/utils/public-decisions.ts +62 -26
- package/addon/plugins/table-of-contents-plugin/nodes/table-of-contents.ts +8 -13
- package/addon/plugins/table-of-contents-plugin/utils/index.ts +7 -4
- package/addon/plugins/template-comments-plugin/node.ts +12 -3
- package/addon/plugins/variable-plugin/variables/address.ts +15 -8
- package/addon/plugins/variable-plugin/variables/codelist.ts +4 -4
- package/addon/plugins/variable-plugin/variables/date.ts +200 -0
- package/addon/plugins/variable-plugin/variables/index.ts +1 -0
- package/addon/plugins/variable-plugin/variables/location.ts +4 -4
- package/addon/plugins/variable-plugin/variables/number.ts +11 -8
- package/addon/plugins/variable-plugin/variables/text.ts +4 -4
- package/addon/utils/translation.ts +19 -0
- package/app/components/variable-plugin/address/insert-variable.js +1 -0
- package/app/components/variable-plugin/date/date-time-picker.js +1 -0
- package/app/components/{rdfa-date-plugin/card.js → variable-plugin/date/edit.js} +1 -1
- package/app/components/{rdfa-date-plugin → variable-plugin/date}/help-modal.js +1 -1
- package/app/components/{rdfa-date-plugin/date.js → variable-plugin/date/insert-variable.js} +1 -1
- package/app/components/{rdfa-date-plugin/insert.js → variable-plugin/date/nodeview.js} +1 -1
- package/app/components/{rdfa-date-plugin/date-time-picker.js → variable-plugin/location/nodeview.js} +1 -1
- package/app/styles/besluit-plugin.scss +2 -2
- package/app/styles/date-plugin.scss +0 -20
- package/app/styles/snippet-plugin.scss +1 -1
- package/app/styles/template-comments-plugin.scss +4 -4
- package/app/styles/variable-plugin.scss +8 -4
- package/components/citation-plugin/citations/search-modal.d.ts +3 -0
- package/components/template-comments-plugin/template-comment.d.ts +6 -0
- package/components/variable-plugin/address/insert-variable.d.ts +15 -0
- package/components/variable-plugin/address/insert.d.ts +4 -1
- package/components/variable-plugin/address/nodeview.d.ts +7 -0
- package/components/variable-plugin/address/utils.d.ts +2 -0
- package/components/variable-plugin/codelist/insert.d.ts +1 -0
- package/components/{rdfa-date-plugin → variable-plugin/date}/date-time-picker.d.ts +1 -1
- package/components/{rdfa-date-plugin/card.d.ts → variable-plugin/date/edit.d.ts} +3 -3
- package/components/{rdfa-date-plugin → variable-plugin/date}/help-modal.d.ts +1 -1
- package/components/variable-plugin/date/insert-variable.d.ts +16 -0
- package/components/variable-plugin/date/insert.d.ts +4 -3
- package/components/{rdfa-date-plugin/date.d.ts → variable-plugin/date/nodeview.d.ts} +5 -1
- package/components/variable-plugin/location/insert.d.ts +1 -0
- package/components/variable-plugin/location/nodeview.d.ts +12 -0
- package/components/variable-plugin/number/insert.d.ts +1 -0
- package/components/variable-plugin/number/nodeview.d.ts +5 -0
- package/components/variable-plugin/text/insert.d.ts +3 -0
- package/index.js +3 -0
- package/package.json +14 -10
- package/plugins/citation-plugin/index.d.ts +1 -0
- package/plugins/citation-plugin/utils/legal-documents.d.ts +1 -0
- package/plugins/table-of-contents-plugin/utils/index.d.ts +3 -2
- package/plugins/{rdfa-date-plugin/nodes → variable-plugin/variables}/date.d.ts +10 -1
- package/plugins/variable-plugin/variables/index.d.ts +1 -0
- package/translations/en-US.yaml +12 -0
- package/translations/nl-BE.yaml +13 -0
- package/utils/translation.d.ts +3 -0
- package/addon/components/rdfa-date-plugin/insert.hbs +0 -9
- package/addon/components/rdfa-date-plugin/insert.ts +0 -52
- package/addon/plugins/rdfa-date-plugin/index.ts +0 -28
- package/addon/plugins/rdfa-date-plugin/nodes/date.ts +0 -167
- package/components/rdfa-date-plugin/insert.d.ts +0 -16
- package/plugins/rdfa-date-plugin/index.d.ts +0 -15
- /package/addon/components/{rdfa-date-plugin → variable-plugin/date}/date-time-picker.hbs +0 -0
- /package/addon/components/{rdfa-date-plugin → variable-plugin/date}/help-modal.hbs +0 -0
- /package/addon/plugins/{rdfa-date-plugin/utils.ts → variable-plugin/utils/date-helpers.ts} +0 -0
- /package/plugins/{rdfa-date-plugin/utils.d.ts → variable-plugin/utils/date-helpers.d.ts} +0 -0
|
@@ -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,5 +1,5 @@
|
|
|
1
1
|
{{#if this.canInsertTitle}}
|
|
2
|
-
<AuAlert class="validation-alert" @skin="warning" @closable={{false}} @icon="alert-triangle" @title={{t "besluit-plugin.missing-title-warning"}}>
|
|
2
|
+
<AuAlert class="say-validation-alert" @skin="warning" @closable={{false}} @icon="alert-triangle" @title={{t "besluit-plugin.missing-title-warning"}}>
|
|
3
3
|
<AuButton @iconAlignment="left" @skin="link-secondary" @disabled={{not this.canInsertTitle}} {{on 'click'
|
|
4
4
|
this.insertTitle}}>
|
|
5
5
|
{{t "besluit-plugin.insert.decision-title"}}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
</AuAlert>
|
|
8
8
|
{{/if}}
|
|
9
9
|
{{#if this.canInsertMotivation}}
|
|
10
|
-
<AuAlert class="validation-alert" @skin="warning" @closable={{false}} @icon="alert-triangle" @title={{t "besluit-plugin.missing-motivation-warning"}}>
|
|
10
|
+
<AuAlert class="say-validation-alert" @skin="warning" @closable={{false}} @icon="alert-triangle" @title={{t "besluit-plugin.missing-motivation-warning"}}>
|
|
11
11
|
<AuButton @iconAlignment="left" @skin="link-secondary" @disabled={{not this.canInsertMotivation}} {{on 'click'
|
|
12
12
|
this.insertMotivation}}>
|
|
13
13
|
{{t "besluit-plugin.insert.motivation"}}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
</AuAlert>
|
|
16
16
|
{{/if}}
|
|
17
17
|
{{#if this.missingArticleBlock}}
|
|
18
|
-
<AuAlert class="validation-alert" @skin="warning" @closable={{false}} @icon="alert-triangle" @title={{t "besluit-plugin.missing-article-block-warning"}}>
|
|
18
|
+
<AuAlert class="say-validation-alert" @skin="warning" @closable={{false}} @icon="alert-triangle" @title={{t "besluit-plugin.missing-article-block-warning"}}>
|
|
19
19
|
<AuButton @iconAlignment="left" @skin="link-secondary" @disabled={{not this.missingArticleBlock}} {{on 'click'
|
|
20
20
|
this.insertArticleBlock}}>
|
|
21
21
|
{{t "besluit-plugin.insert.article-block"}}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
{{t 'snippet-plugin.snippet-list.modal.subtitle'}}
|
|
3
3
|
</AuHeading>
|
|
4
4
|
{{#if @snippetLists.length}}
|
|
5
|
-
<div class="snippet-lists-table">
|
|
6
|
-
<AuTable class="snippet-lists-table">
|
|
5
|
+
<div class="say-snippet-lists-table">
|
|
6
|
+
<AuTable class="say-snippet-lists-table">
|
|
7
7
|
<:header>
|
|
8
8
|
<tr>
|
|
9
9
|
<th class="selectColumn">{{t 'snippet-plugin.snippet-list.modal.table.select'}}</th>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<AuAlert
|
|
2
2
|
@size='small'
|
|
3
|
-
@title={{
|
|
3
|
+
@title={{this.translation.title}}
|
|
4
4
|
@skin='info'
|
|
5
5
|
@icon='circle-info'
|
|
6
|
-
class='template-comment {{
|
|
6
|
+
class='say-template-comment {{
|
|
7
7
|
if this.selectionInside 'ProseMirror-selectednode'
|
|
8
|
-
}} default-cursor'
|
|
8
|
+
}} say-default-cursor'
|
|
9
9
|
>
|
|
10
|
-
<div class='text-cursor'>
|
|
10
|
+
<div class='say-text-cursor'>
|
|
11
11
|
{{yield}}
|
|
12
12
|
</div>
|
|
13
13
|
</AuAlert>
|
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
|
+
import { service } from '@ember/service';
|
|
3
|
+
import IntlService from 'ember-intl/services/intl';
|
|
2
4
|
import { EmberNodeArgs } from '@lblod/ember-rdfa-editor/utils/ember-node';
|
|
3
5
|
|
|
4
6
|
export default class TemplateCommentsPluginTemplateCommentComponent extends Component<EmberNodeArgs> {
|
|
7
|
+
@service declare intl: IntlService;
|
|
8
|
+
|
|
5
9
|
get controller() {
|
|
6
10
|
return this.args.controller;
|
|
7
11
|
}
|
|
8
12
|
|
|
13
|
+
get documentLanguage() {
|
|
14
|
+
return this.controller.documentLanguage;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
get translation() {
|
|
18
|
+
return {
|
|
19
|
+
title: this.intl.t('template-comments-plugin.long-title', {
|
|
20
|
+
locale: this.documentLanguage,
|
|
21
|
+
}),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
9
25
|
get selectionInside() {
|
|
10
26
|
const { pos: selectPos } = this.controller.mainEditorState.selection.$from;
|
|
11
27
|
const nodePos = this.args.getPos();
|
|
@@ -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.
|
|
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,40 @@
|
|
|
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 { service } from '@ember/service';
|
|
6
|
+
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
7
|
+
import IntlService from 'ember-intl/services/intl';
|
|
8
|
+
|
|
9
|
+
type Args = {
|
|
10
|
+
controller: SayController;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default class VariablePluginAddressInsertVariableComponent extends Component<Args> {
|
|
14
|
+
@service declare intl: IntlService;
|
|
15
|
+
@tracked label?: string;
|
|
16
|
+
|
|
17
|
+
get controller() {
|
|
18
|
+
return this.args.controller;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
get documentLanguage() {
|
|
22
|
+
return this.controller.documentLanguage;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@action
|
|
26
|
+
updateLabel(event: InputEvent) {
|
|
27
|
+
this.label = (event.target as HTMLInputElement).value;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@action
|
|
31
|
+
insertAddress() {
|
|
32
|
+
replaceSelectionWithAddress(
|
|
33
|
+
this.controller,
|
|
34
|
+
this.label ??
|
|
35
|
+
this.intl.t('variable.address.label', {
|
|
36
|
+
locale: this.documentLanguage,
|
|
37
|
+
}),
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -1,37 +1,41 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { action } from '@ember/object';
|
|
3
|
+
import { service } from '@ember/service';
|
|
3
4
|
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
4
|
-
import
|
|
5
|
-
|
|
5
|
+
import IntlService from 'ember-intl/services/intl';
|
|
6
|
+
|
|
7
|
+
import { replaceSelectionWithAddress } from './utils';
|
|
6
8
|
|
|
7
9
|
type Args = {
|
|
8
10
|
controller: SayController;
|
|
9
11
|
};
|
|
10
12
|
|
|
11
13
|
export default class InsertAddressComponent extends Component<Args> {
|
|
14
|
+
@service declare intl: IntlService;
|
|
15
|
+
|
|
12
16
|
get controller() {
|
|
13
17
|
return this.args.controller;
|
|
14
18
|
}
|
|
15
19
|
|
|
16
|
-
get
|
|
17
|
-
return this.controller.
|
|
20
|
+
get documentLanguage() {
|
|
21
|
+
return this.controller.documentLanguage;
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
@action
|
|
21
25
|
insertAddress() {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return
|
|
35
|
-
}
|
|
26
|
+
replaceSelectionWithAddress(
|
|
27
|
+
this.controller,
|
|
28
|
+
this.intl.t('variable.address.label', {
|
|
29
|
+
locale: this.documentLanguage,
|
|
30
|
+
}),
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
get canInsertAddress() {
|
|
35
|
+
if (this.controller.activeEditorView.props.nodeViews?.address) {
|
|
36
|
+
return true;
|
|
37
|
+
} else {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
36
40
|
}
|
|
37
41
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
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}}
|
|
8
8
|
{{this.address.formatted}}
|
|
9
9
|
{{else}}
|
|
10
10
|
<span class='mark-highlight-manual'>
|
|
11
|
-
{{
|
|
11
|
+
{{this.translations.placeholder}}
|
|
12
12
|
</span>
|
|
13
13
|
{{/if}}
|
|
14
14
|
{{#if @node.attrs.label}}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
|
-
import { NodeSelection, PNode, SayController } from '@lblod/ember-rdfa-editor';
|
|
3
2
|
import { action } from '@ember/object';
|
|
3
|
+
import { service } from '@ember/service';
|
|
4
|
+
import IntlService from 'ember-intl/services/intl';
|
|
5
|
+
|
|
6
|
+
import { NodeSelection, PNode, SayController } from '@lblod/ember-rdfa-editor';
|
|
4
7
|
import { Address } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/variables/address';
|
|
5
8
|
|
|
6
9
|
type Args = {
|
|
@@ -8,7 +11,26 @@ type Args = {
|
|
|
8
11
|
node: PNode;
|
|
9
12
|
controller: SayController;
|
|
10
13
|
};
|
|
14
|
+
|
|
11
15
|
export default class AddressNodeviewComponent extends Component<Args> {
|
|
16
|
+
@service declare intl: IntlService;
|
|
17
|
+
|
|
18
|
+
get controller() {
|
|
19
|
+
return this.args.controller;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
get documentLanguage() {
|
|
23
|
+
return this.controller.documentLanguage;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
get translations() {
|
|
27
|
+
return {
|
|
28
|
+
placeholder: this.intl.t('editor-plugins.address.nodeview.placeholder', {
|
|
29
|
+
locale: this.documentLanguage,
|
|
30
|
+
}),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
12
34
|
get node() {
|
|
13
35
|
return this.args.node;
|
|
14
36
|
}
|
|
@@ -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
|
+
}
|
|
@@ -36,6 +36,10 @@ export default class CodelistInsertComponent extends Component<Args> {
|
|
|
36
36
|
return this.args.controller;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
get documentLanguage() {
|
|
40
|
+
return this.controller.documentLanguage;
|
|
41
|
+
}
|
|
42
|
+
|
|
39
43
|
get schema() {
|
|
40
44
|
return this.args.controller.schema;
|
|
41
45
|
}
|
|
@@ -84,7 +88,12 @@ export default class CodelistInsertComponent extends Component<Args> {
|
|
|
84
88
|
mappingResource,
|
|
85
89
|
variableInstance,
|
|
86
90
|
codelistResource: this.selectedCodelist?.uri,
|
|
87
|
-
label:
|
|
91
|
+
label:
|
|
92
|
+
this.label ??
|
|
93
|
+
this.selectedCodelist?.label ??
|
|
94
|
+
this.intl.t('variable.codelist.label', {
|
|
95
|
+
locale: this.documentLanguage,
|
|
96
|
+
}),
|
|
88
97
|
source: this.endpoint,
|
|
89
98
|
selectionStyle: this.selectedStyleValue,
|
|
90
99
|
},
|
|
@@ -9,7 +9,7 @@ type Args = {
|
|
|
9
9
|
onChange: (date: Date) => void;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
export default class
|
|
12
|
+
export default class DateTimePickerComponent extends Component<Args> {
|
|
13
13
|
@service declare intl: Intl;
|
|
14
14
|
@localCopy('args.value') declare date?: Date;
|
|
15
15
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
</c.header>
|
|
7
7
|
<c.content class="au-o-box au-o-box--small">
|
|
8
8
|
<div class="au-o-flow au-o-flow--small">
|
|
9
|
-
<
|
|
9
|
+
<VariablePlugin::Date::DateTimePicker
|
|
10
10
|
@onChange={{this.changeDate}}
|
|
11
11
|
@value={{this.pickerDate}}
|
|
12
12
|
@onlyDate={{this.onlyDate}}
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
</Velcro>
|
|
44
44
|
{{/if}}
|
|
45
45
|
</AuFormRow>
|
|
46
|
-
</
|
|
46
|
+
</VariablePlugin::Date::DateTimePicker>
|
|
47
47
|
{{#each this.formats as |format|}}
|
|
48
48
|
<AuFormRow>
|
|
49
49
|
<AuControlRadio
|
|
@@ -86,4 +86,4 @@
|
|
|
86
86
|
</AuCard>
|
|
87
87
|
{{/if}}
|
|
88
88
|
</div>
|
|
89
|
-
<
|
|
89
|
+
<VariablePlugin::Date::HelpModal @modalOpen={{this.helpModalOpen}} @closeModal={{this.toggleHelpModal}} />
|
|
@@ -3,15 +3,6 @@ import { tracked } from '@glimmer/tracking';
|
|
|
3
3
|
import { action } from '@ember/object';
|
|
4
4
|
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
5
5
|
import { NodeSelection, PNode } from '@lblod/ember-rdfa-editor';
|
|
6
|
-
import {
|
|
7
|
-
DateFormat,
|
|
8
|
-
DateOptions,
|
|
9
|
-
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/rdfa-date-plugin';
|
|
10
|
-
import {
|
|
11
|
-
formatContainsTime,
|
|
12
|
-
validateDateFormat,
|
|
13
|
-
ValidationError,
|
|
14
|
-
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/rdfa-date-plugin/utils';
|
|
15
6
|
import { inject as service } from '@ember/service';
|
|
16
7
|
import IntlService from 'ember-intl/services/intl';
|
|
17
8
|
import {
|
|
@@ -22,13 +13,22 @@ import {
|
|
|
22
13
|
optionMapOr,
|
|
23
14
|
unwrapOr,
|
|
24
15
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
|
|
16
|
+
import {
|
|
17
|
+
DateFormat,
|
|
18
|
+
DateOptions,
|
|
19
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/variables/date';
|
|
20
|
+
import {
|
|
21
|
+
ValidationError,
|
|
22
|
+
formatContainsTime,
|
|
23
|
+
validateDateFormat,
|
|
24
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/date-helpers';
|
|
25
25
|
|
|
26
26
|
type Args = {
|
|
27
27
|
controller: SayController;
|
|
28
28
|
options: DateOptions;
|
|
29
29
|
};
|
|
30
30
|
const SECONDS_REGEX = new RegExp('[sStT]|p{2,}');
|
|
31
|
-
export default class
|
|
31
|
+
export default class DateEditComponent extends Component<Args> {
|
|
32
32
|
@service
|
|
33
33
|
declare intl: IntlService;
|
|
34
34
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { action } from '@ember/object';
|
|
2
2
|
import Component from '@glimmer/component';
|
|
3
|
-
import { formatDate } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/
|
|
3
|
+
import { formatDate } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/date-helpers';
|
|
4
4
|
|
|
5
5
|
interface Args {
|
|
6
6
|
modalOpen: boolean;
|
|
7
7
|
closeModal: () => void;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export default class
|
|
10
|
+
export default class DateHelpComponent extends Component<Args> {
|
|
11
11
|
exampleDate: Date = new Date();
|
|
12
12
|
|
|
13
13
|
@action
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { tracked } from '@glimmer/tracking';
|
|
3
|
+
import { action } from '@ember/object';
|
|
4
|
+
import { service } from '@ember/service';
|
|
5
|
+
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
6
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
7
|
+
import IntlService from 'ember-intl/services/intl';
|
|
8
|
+
|
|
9
|
+
type Args = {
|
|
10
|
+
controller: SayController;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default class DateInsertVariableComponent extends Component<Args> {
|
|
14
|
+
@service declare intl: IntlService;
|
|
15
|
+
@tracked label?: string;
|
|
16
|
+
|
|
17
|
+
get controller() {
|
|
18
|
+
return this.args.controller;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
get schema() {
|
|
22
|
+
return this.args.controller.schema;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
get documentLanguage() {
|
|
26
|
+
return this.controller.documentLanguage;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@action
|
|
30
|
+
updateLabel(event: InputEvent) {
|
|
31
|
+
this.label = (event.target as HTMLInputElement).value;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@action
|
|
35
|
+
insert() {
|
|
36
|
+
const mappingResource = `http://data.lblod.info/mappings/${uuidv4()}`;
|
|
37
|
+
|
|
38
|
+
const defaultLabel = this.intl.t('variable.date.label', {
|
|
39
|
+
locale: this.documentLanguage,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const node = this.schema.nodes.date.create({
|
|
43
|
+
label: this.label ?? defaultLabel,
|
|
44
|
+
value: null,
|
|
45
|
+
mappingResource,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
this.label = undefined;
|
|
49
|
+
|
|
50
|
+
this.controller.withTransaction(
|
|
51
|
+
(tr) => {
|
|
52
|
+
return tr.replaceSelectionWith(node);
|
|
53
|
+
},
|
|
54
|
+
{ view: this.controller.mainEditorView },
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<
|
|
2
|
-
<
|
|
3
|
-
@
|
|
4
|
-
@
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
</
|
|
1
|
+
<AuList::Item>
|
|
2
|
+
<AuButton
|
|
3
|
+
@icon="add"
|
|
4
|
+
@iconAlignment="left"
|
|
5
|
+
@skin="link"
|
|
6
|
+
{{on 'click' this.insert}}>
|
|
7
|
+
{{t "date-plugin.insert.date"}}
|
|
8
|
+
</AuButton>
|
|
9
|
+
</AuList::Item>
|
|
@@ -1,40 +1,43 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
|
-
import { tracked } from '@glimmer/tracking';
|
|
3
2
|
import { action } from '@ember/object';
|
|
3
|
+
import { service } from '@ember/service';
|
|
4
4
|
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
5
|
+
import IntlService from 'ember-intl/services/intl';
|
|
5
6
|
import { v4 as uuidv4 } from 'uuid';
|
|
6
7
|
|
|
7
8
|
type Args = {
|
|
8
9
|
controller: SayController;
|
|
9
10
|
};
|
|
10
11
|
|
|
11
|
-
export default class
|
|
12
|
-
@
|
|
12
|
+
export default class DateInsertComponent extends Component<Args> {
|
|
13
|
+
@service declare intl: IntlService;
|
|
13
14
|
|
|
14
15
|
get controller() {
|
|
15
16
|
return this.args.controller;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
get schema() {
|
|
19
|
-
return this.
|
|
20
|
+
return this.controller.schema;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.label = (event.target as HTMLInputElement).value;
|
|
23
|
+
get documentLanguage() {
|
|
24
|
+
return this.controller.documentLanguage;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
@action
|
|
28
28
|
insert() {
|
|
29
29
|
const mappingResource = `http://data.lblod.info/mappings/${uuidv4()}`;
|
|
30
|
+
|
|
31
|
+
const defaultLabel = this.intl.t('variable.date.label', {
|
|
32
|
+
locale: this.documentLanguage,
|
|
33
|
+
});
|
|
34
|
+
|
|
30
35
|
const node = this.schema.nodes.date.create({
|
|
31
|
-
label:
|
|
36
|
+
label: defaultLabel,
|
|
32
37
|
value: null,
|
|
33
38
|
mappingResource,
|
|
34
39
|
});
|
|
35
40
|
|
|
36
|
-
this.label = undefined;
|
|
37
|
-
|
|
38
41
|
this.controller.withTransaction(
|
|
39
42
|
(tr) => {
|
|
40
43
|
return tr.replaceSelectionWith(node);
|