@lblod/ember-rdfa-editor-lblod-plugins 19.1.0 → 19.2.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/CHANGELOG.md +22 -0
- package/addon/components/au-native-input.ts +12 -13
- package/addon/components/{worship-plugin → common/sort}/sortable-table-header.hbs +3 -9
- package/addon/components/{worship-plugin → common/sort}/sortable-table-header.ts +3 -6
- package/addon/components/lmb-plugin/insert.hbs +18 -0
- package/addon/components/lmb-plugin/insert.ts +121 -0
- package/addon/components/lmb-plugin/list.hbs +58 -0
- package/addon/components/lmb-plugin/search-modal.hbs +71 -0
- package/addon/components/lmb-plugin/search-modal.ts +173 -0
- package/addon/components/loading-alert.hbs +3 -1
- package/addon/components/location-plugin/edit.gts +380 -0
- package/addon/components/location-plugin/insert-variable.gts +67 -0
- package/addon/components/location-plugin/insert.gts +153 -0
- package/addon/components/location-plugin/nodeview.hbs +20 -0
- package/addon/components/location-plugin/nodeview.ts +49 -0
- package/addon/components/lpdc-plugin/lpdc-insert.hbs +19 -0
- package/addon/components/lpdc-plugin/lpdc-insert.ts +93 -0
- package/addon/components/lpdc-plugin/lpdc-modal.hbs +44 -0
- package/addon/components/lpdc-plugin/lpdc-modal.ts +79 -0
- package/addon/components/lpdc-plugin/lpdc-table-view.hbs +53 -0
- package/addon/components/lpdc-plugin/lpdc-table-view.ts +23 -0
- package/addon/components/variable-plugin/address/edit.ts +1 -1
- package/addon/components/variable-plugin/address/nodeview.ts +1 -1
- package/addon/components/worship-plugin/list.hbs +1 -1
- package/addon/models/mandatee.ts +35 -0
- package/addon/plugins/lmb-plugin/index.ts +3 -0
- package/addon/plugins/location-plugin/address.ts +405 -0
- package/addon/plugins/location-plugin/utils/address-helpers.ts +395 -0
- package/addon/plugins/location-plugin/utils/node-utils.ts +51 -0
- package/addon/plugins/lpdc-plugin/api.ts +114 -0
- package/addon/plugins/lpdc-plugin/index.ts +2 -0
- package/addon/plugins/lpdc-plugin/types.ts +5 -0
- package/addon/plugins/snippet-plugin/nodes/snippet-placeholder.ts +5 -3
- package/addon/plugins/variable-plugin/utils/address-helpers.ts +130 -12
- package/addon/plugins/variable-plugin/utils/dom-constructors.ts +3 -19
- package/addon/plugins/variable-plugin/variables/address.ts +122 -84
- package/addon/plugins/variable-plugin/variables/codelist.ts +1 -1
- package/addon/plugins/variable-plugin/variables/date.ts +1 -1
- package/addon/plugins/variable-plugin/variables/location.ts +2 -2
- package/addon/plugins/variable-plugin/variables/number.ts +1 -1
- package/addon/plugins/variable-plugin/variables/text.ts +1 -1
- package/addon/utils/constants.ts +15 -1
- package/addon/utils/dom-output-spec-helpers.ts +20 -3
- package/app/components/{worship-plugin → common/sort}/sortable-table-header.js +1 -1
- package/app/components/lmb-plugin/insert.js +1 -0
- package/app/components/lmb-plugin/list.js +1 -0
- package/app/components/lmb-plugin/search-modal.js +1 -0
- package/app/components/location-plugin/edit.js +1 -0
- package/app/components/location-plugin/insert-variable.js +1 -0
- package/app/components/location-plugin/insert.js +1 -0
- package/app/components/location-plugin/nodeview.js +1 -0
- package/app/components/lpdc-plugin/lpdc-insert.js +1 -0
- package/app/components/lpdc-plugin/lpdc-modal.js +1 -0
- package/app/components/lpdc-plugin/lpdc-table-view.js +1 -0
- package/app/styles/article-structure-plugin.scss +12 -6
- package/app/styles/snippet-plugin.scss +19 -0
- package/declarations/addon/components/au-native-input.d.ts +12 -10
- package/declarations/addon/components/{worship-plugin → common/sort}/sortable-table-header.d.ts +3 -3
- package/declarations/addon/components/lmb-plugin/insert.d.ts +17 -0
- package/declarations/addon/components/lmb-plugin/list.d.ts +1 -0
- package/declarations/addon/components/lmb-plugin/search-modal.d.ts +31 -0
- package/declarations/addon/components/location-plugin/edit.d.ts +47 -0
- package/declarations/addon/components/location-plugin/insert-variable.d.ts +17 -0
- package/declarations/addon/components/location-plugin/insert.d.ts +29 -0
- package/declarations/addon/components/location-plugin/nodeview.d.ts +22 -0
- package/declarations/addon/components/lpdc-plugin/lpdc-insert.d.ts +17 -0
- package/declarations/addon/components/lpdc-plugin/lpdc-modal.d.ts +42 -0
- package/declarations/addon/components/lpdc-plugin/lpdc-table-view.d.ts +37 -0
- package/declarations/addon/components/variable-plugin/address/edit.d.ts +1 -1
- package/declarations/addon/components/variable-plugin/address/nodeview.d.ts +1 -1
- package/declarations/addon/models/mandatee.d.ts +13 -0
- package/declarations/addon/plugins/lmb-plugin/index.d.ts +3 -0
- package/declarations/addon/plugins/location-plugin/address.d.ts +2 -0
- package/declarations/addon/plugins/location-plugin/utils/address-helpers.d.ts +65 -0
- package/declarations/addon/plugins/location-plugin/utils/node-utils.d.ts +2 -0
- package/declarations/addon/plugins/lpdc-plugin/api.d.ts +29 -0
- package/declarations/addon/plugins/lpdc-plugin/index.d.ts +2 -0
- package/declarations/addon/plugins/lpdc-plugin/types.d.ts +7 -0
- package/declarations/addon/plugins/variable-plugin/utils/address-helpers.d.ts +34 -1
- package/declarations/addon/plugins/variable-plugin/utils/dom-constructors.d.ts +5 -11
- package/declarations/addon/plugins/variable-plugin/variables/address.d.ts +0 -13
- package/declarations/addon/utils/constants.d.ts +5 -0
- package/declarations/addon/utils/dom-output-spec-helpers.d.ts +6 -2
- package/package.json +2 -2
- package/pnpm-lock.yaml +19 -8
- package/translations/en-US.yaml +41 -14
- package/translations/nl-BE.yaml +41 -13
- package/types/ember-concurrency/helpers/perform.d.ts +48 -0
- package/types/ember-power-select/components/power-select.d.ts +160 -0
- /package/addon/{plugins/variable-plugin/utils/attribute-parsers.ts → utils/variable-attribute-parsers.ts} +0 -0
- /package/declarations/addon/{plugins/variable-plugin/utils/attribute-parsers.d.ts → utils/variable-attribute-parsers.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @lblod/ember-rdfa-editor-lblod-plugins
|
|
2
2
|
|
|
3
|
+
## 19.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#427](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/427) [`0de131824462d4297190bc25f8916a70b358e46a`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/0de131824462d4297190bc25f8916a70b358e46a) Thanks [@lagartoverde](https://github.com/lagartoverde)! - Added lmb-plugin to add LMB mandatees to the document
|
|
8
|
+
|
|
9
|
+
- [#429](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/429) [`db575dea5da9b71c645c5ed5e091a307bb075ba4`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/db575dea5da9b71c645c5ed5e091a307bb075ba4) Thanks [@dkozickis](https://github.com/dkozickis)! - GN-4693: Insert LPDC
|
|
10
|
+
|
|
11
|
+
- [#431](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/431) [`f3bfdd1caff44d4011fb0aaf7edeef5da7510a35`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/f3bfdd1caff44d4011fb0aaf7edeef5da7510a35) Thanks [@piemonkey](https://github.com/piemonkey)! - Add location plugin
|
|
12
|
+
|
|
13
|
+
- [#430](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/430) [`e9a92cbf8548bb782c819c95bce44486ce9633eb`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/e9a92cbf8548bb782c819c95bce44486ce9633eb) Thanks [@piemonkey](https://github.com/piemonkey)! - Use OSLO model for addresses in variable-plugin
|
|
14
|
+
|
|
15
|
+
- [#432](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/432) [`81f82bee3cc2f269f9a92031167000697d72365d`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/81f82bee3cc2f269f9a92031167000697d72365d) Thanks [@piemonkey](https://github.com/piemonkey)! - Move location-plugin address search to a modal
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#428](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/428) [`c21ac34b0fd304ad9126243f9b693d4ce6107c4b`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/c21ac34b0fd304ad9126243f9b693d4ce6107c4b) Thanks [@lagartoverde](https://github.com/lagartoverde)! - Styling fixes
|
|
20
|
+
|
|
21
|
+
- [#430](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/430) [`b19acda5b1b31bfb289c0f0c0a16e43712ca376f`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/b19acda5b1b31bfb289c0f0c0a16e43712ca376f) Thanks [@piemonkey](https://github.com/piemonkey)! - Change format for geodata used by the address plugin to WKT instead of GML to match the OSLO spec
|
|
22
|
+
|
|
23
|
+
- [#430](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/430) [`def6922e0037dbea6857fc309ac4fdae07fffca6`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/def6922e0037dbea6857fc309ac4fdae07fffca6) Thanks [@piemonkey](https://github.com/piemonkey)! - Correct typo in adres: prefix
|
|
24
|
+
|
|
3
25
|
## 19.1.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { ComponentLike } from '@glint/template';
|
|
3
3
|
|
|
4
|
-
interface
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
interface Signature {
|
|
5
|
+
Args: {
|
|
6
|
+
width?: 'block';
|
|
7
|
+
iconAlignment?: 'left' | 'right';
|
|
8
|
+
error?: boolean;
|
|
9
|
+
warning?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
type?: string;
|
|
12
|
+
icon?: ComponentLike;
|
|
13
|
+
};
|
|
14
|
+
Element: HTMLInputElement;
|
|
12
15
|
}
|
|
13
16
|
|
|
14
|
-
export default class AuNativeInput extends Component<
|
|
15
|
-
constructor(owner: unknown, args: Args) {
|
|
16
|
-
super(owner, args);
|
|
17
|
-
}
|
|
18
|
-
|
|
17
|
+
export default class AuNativeInput extends Component<Signature> {
|
|
19
18
|
get width() {
|
|
20
19
|
if (this.args.width == 'block') return 'au-c-input--block';
|
|
21
20
|
else return '';
|
|
@@ -11,9 +11,7 @@
|
|
|
11
11
|
{{on 'click' this.changeSort}}
|
|
12
12
|
class='au-c-data-table__sort'
|
|
13
13
|
>
|
|
14
|
-
<span class='au-u-hidden-visually'>{{t
|
|
15
|
-
'worship-plugin.modal.sort.asc'
|
|
16
|
-
}}</span>
|
|
14
|
+
<span class='au-u-hidden-visually'>{{t 'common.sort.asc'}}</span>
|
|
17
15
|
<AuIcon @icon={{this.NavUpIcon}} />
|
|
18
16
|
</button>
|
|
19
17
|
{{else if (eq this.order 'ASC')}}
|
|
@@ -22,9 +20,7 @@
|
|
|
22
20
|
{{on 'click' this.changeSort}}
|
|
23
21
|
class='au-c-data-table__sort'
|
|
24
22
|
>
|
|
25
|
-
<span class='au-u-hidden-visually'>{{t
|
|
26
|
-
'worship-plugin.modal.sort.desc'
|
|
27
|
-
}}</span>
|
|
23
|
+
<span class='au-u-hidden-visually'>{{t 'common.sort.desc'}}</span>
|
|
28
24
|
<AuIcon @icon={{this.NavDownIcon}} />
|
|
29
25
|
</button>
|
|
30
26
|
{{else}}
|
|
@@ -33,9 +29,7 @@
|
|
|
33
29
|
{{on 'click' this.changeSort}}
|
|
34
30
|
class='au-c-data-table__sort'
|
|
35
31
|
>
|
|
36
|
-
<span class='au-u-hidden-visually'>{{t
|
|
37
|
-
'worship-plugin.modal.sort.sort'
|
|
38
|
-
}}</span>
|
|
32
|
+
<span class='au-u-hidden-visually'>{{t 'common.sort.sort'}}</span>
|
|
39
33
|
<AuIcon @icon={{this.NavUpDownIcon}} />
|
|
40
34
|
</button>
|
|
41
35
|
{{/if}}
|
|
@@ -3,19 +3,16 @@ import Component from '@glimmer/component';
|
|
|
3
3
|
import { NavUpIcon } from '@appuniversum/ember-appuniversum/components/icons/nav-up';
|
|
4
4
|
import { NavDownIcon } from '@appuniversum/ember-appuniversum/components/icons/nav-down';
|
|
5
5
|
import { NavUpDownIcon } from '@appuniversum/ember-appuniversum/components/icons/nav-up-down';
|
|
6
|
-
import {
|
|
7
|
-
SearchSort,
|
|
8
|
-
WorshipService,
|
|
9
|
-
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin/utils/fetchWorshipServices';
|
|
10
6
|
|
|
7
|
+
type SearchSort = [string, 'ASC' | 'DESC'] | false;
|
|
11
8
|
interface Args {
|
|
12
9
|
label: string;
|
|
13
|
-
field:
|
|
10
|
+
field: string;
|
|
14
11
|
sort: SearchSort;
|
|
15
12
|
setSort: (sort: SearchSort) => void;
|
|
16
13
|
}
|
|
17
14
|
|
|
18
|
-
export default class
|
|
15
|
+
export default class SortableTableHeaderComponent extends Component<Args> {
|
|
19
16
|
NavUpIcon = NavUpIcon;
|
|
20
17
|
NavDownIcon = NavDownIcon;
|
|
21
18
|
NavUpDownIcon = NavUpDownIcon;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{{! @glint-nocheck: not typesafe yet }}
|
|
2
|
+
<li class='au-c-list__item'>
|
|
3
|
+
<AuButton
|
|
4
|
+
@icon={{this.AddIcon}}
|
|
5
|
+
@iconAlignment='left'
|
|
6
|
+
@skin='link'
|
|
7
|
+
{{on 'click' this.openModal}}
|
|
8
|
+
>
|
|
9
|
+
{{t 'lmb-plugin.insert.title'}}
|
|
10
|
+
</AuButton>
|
|
11
|
+
</li>
|
|
12
|
+
|
|
13
|
+
<LmbPlugin::SearchModal
|
|
14
|
+
@open={{this.showModal}}
|
|
15
|
+
@closeModal={{this.closeModal}}
|
|
16
|
+
@config={{@config}}
|
|
17
|
+
@onInsert={{this.onInsert}}
|
|
18
|
+
/>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { action } from '@ember/object';
|
|
2
|
+
import Component from '@glimmer/component';
|
|
3
|
+
import { tracked } from '@glimmer/tracking';
|
|
4
|
+
import { AddIcon } from '@appuniversum/ember-appuniversum/components/icons/add';
|
|
5
|
+
|
|
6
|
+
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
7
|
+
import { LmbPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/lmb-plugin';
|
|
8
|
+
import Mandatee from '@lblod/ember-rdfa-editor-lblod-plugins/models/mandatee';
|
|
9
|
+
import { v4 as uuid } from 'uuid';
|
|
10
|
+
import { sayDataFactory } from '@lblod/ember-rdfa-editor/core/say-data-factory';
|
|
11
|
+
import {
|
|
12
|
+
MANDAAT,
|
|
13
|
+
FOAF,
|
|
14
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
15
|
+
|
|
16
|
+
interface Args {
|
|
17
|
+
controller: SayController;
|
|
18
|
+
config: LmbPluginConfig;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default class LmbPluginInsertComponent extends Component<Args> {
|
|
22
|
+
AddIcon = AddIcon;
|
|
23
|
+
|
|
24
|
+
@tracked showModal = false;
|
|
25
|
+
|
|
26
|
+
get controller() {
|
|
27
|
+
return this.args.controller;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@action
|
|
31
|
+
openModal() {
|
|
32
|
+
this.controller.focus();
|
|
33
|
+
this.showModal = true;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@action
|
|
37
|
+
closeModal() {
|
|
38
|
+
this.showModal = false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@action
|
|
42
|
+
onInsert(mandatee: Mandatee) {
|
|
43
|
+
const schema = this.controller.schema;
|
|
44
|
+
const firstNameUuid = uuid();
|
|
45
|
+
const firstNameNode = schema.node(
|
|
46
|
+
'inline_rdfa',
|
|
47
|
+
{
|
|
48
|
+
rdfaNodeType: 'literal',
|
|
49
|
+
__rdfaId: firstNameUuid,
|
|
50
|
+
backlinks: [
|
|
51
|
+
{
|
|
52
|
+
subject: sayDataFactory.literalNode(mandatee.personUri),
|
|
53
|
+
predicate: FOAF('gebruikteVoornaam').prefixed,
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
[schema.text(mandatee.firstName)],
|
|
58
|
+
);
|
|
59
|
+
const lastNameUuid = uuid();
|
|
60
|
+
const lastNameNode = schema.node(
|
|
61
|
+
'inline_rdfa',
|
|
62
|
+
{
|
|
63
|
+
rdfaNodeType: 'literal',
|
|
64
|
+
__rdfaId: lastNameUuid,
|
|
65
|
+
backlinks: [
|
|
66
|
+
{
|
|
67
|
+
subject: sayDataFactory.literalNode(mandatee.personUri),
|
|
68
|
+
predicate: FOAF('familyName').prefixed,
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
[schema.text(mandatee.lastName)],
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const personNode = schema.node(
|
|
76
|
+
'inline_rdfa',
|
|
77
|
+
{
|
|
78
|
+
rdfaNodeType: 'resource',
|
|
79
|
+
subject: mandatee.personUri,
|
|
80
|
+
properties: [
|
|
81
|
+
{
|
|
82
|
+
predicate: FOAF('gebruikteVoornaam').prefixed,
|
|
83
|
+
object: sayDataFactory.literalNode(firstNameUuid),
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
predicate: FOAF('familyName').prefixed,
|
|
87
|
+
object: sayDataFactory.literalNode(lastNameUuid),
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
backlinks: [
|
|
91
|
+
{
|
|
92
|
+
subject: sayDataFactory.literalNode(mandatee.mandateeUri),
|
|
93
|
+
predicate: MANDAAT('isBestuurlijkeAliasVan').prefixed,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
[firstNameNode, lastNameNode],
|
|
98
|
+
);
|
|
99
|
+
const mandateeNode = schema.node(
|
|
100
|
+
'inline_rdfa',
|
|
101
|
+
{
|
|
102
|
+
rdfaNodeType: 'resource',
|
|
103
|
+
subject: mandatee.mandateeUri,
|
|
104
|
+
properties: [
|
|
105
|
+
{
|
|
106
|
+
predicate: MANDAAT('isBestuurlijkeAliasVan').prefixed,
|
|
107
|
+
object: sayDataFactory.resourceNode(mandatee.personUri),
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
[personNode],
|
|
112
|
+
);
|
|
113
|
+
this.controller.withTransaction(
|
|
114
|
+
(tr) => {
|
|
115
|
+
return tr.replaceSelectionWith(mandateeNode);
|
|
116
|
+
},
|
|
117
|
+
{ view: this.controller.mainEditorView },
|
|
118
|
+
);
|
|
119
|
+
this.closeModal();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<AuTable>
|
|
2
|
+
<:header>
|
|
3
|
+
<tr class='au-c-data-table__header-title'>
|
|
4
|
+
<th>
|
|
5
|
+
<Common::Sort::SortableTableHeader
|
|
6
|
+
@field='fullName'
|
|
7
|
+
@label={{t 'lmb-plugin.modal.fields.name'}}
|
|
8
|
+
@sort={{@sort}}
|
|
9
|
+
@setSort={{@setSort}}
|
|
10
|
+
/>
|
|
11
|
+
</th>
|
|
12
|
+
<th>
|
|
13
|
+
<Common::Sort::SortableTableHeader
|
|
14
|
+
@field='status'
|
|
15
|
+
@label={{t 'lmb-plugin.modal.fields.status'}}
|
|
16
|
+
@sort={{@sort}}
|
|
17
|
+
@setSort={{@setSort}}
|
|
18
|
+
/>
|
|
19
|
+
</th>
|
|
20
|
+
<th>
|
|
21
|
+
<Common::Sort::SortableTableHeader
|
|
22
|
+
@field='fractie'
|
|
23
|
+
@label={{t 'lmb-plugin.modal.fields.fractie'}}
|
|
24
|
+
@sort={{@sort}}
|
|
25
|
+
@setSort={{@setSort}}
|
|
26
|
+
/>
|
|
27
|
+
</th>
|
|
28
|
+
<th>
|
|
29
|
+
<Common::Sort::SortableTableHeader
|
|
30
|
+
@field='role'
|
|
31
|
+
@label={{t 'lmb-plugin.modal.fields.role'}}
|
|
32
|
+
@sort={{@sort}}
|
|
33
|
+
@setSort={{@setSort}}
|
|
34
|
+
/>
|
|
35
|
+
</th>
|
|
36
|
+
<th />
|
|
37
|
+
</tr>
|
|
38
|
+
</:header>
|
|
39
|
+
<:body>
|
|
40
|
+
{{#unless (or @services.isRunning @error)}}
|
|
41
|
+
{{#if @services.value.totalCount}}
|
|
42
|
+
{{#each @services.value.results as |row|}}
|
|
43
|
+
<tr>
|
|
44
|
+
<td>{{row.fullName}}</td>
|
|
45
|
+
<td>{{row.status}}</td>
|
|
46
|
+
<td>{{row.fractie}}</td>
|
|
47
|
+
<td>{{row.role}}</td>
|
|
48
|
+
<td class='au-u-text-center'>
|
|
49
|
+
<AuButton {{on 'click' (fn @insert row)}}>
|
|
50
|
+
{{t 'lmb-plugin.modal.insert'}}
|
|
51
|
+
</AuButton>
|
|
52
|
+
</td>
|
|
53
|
+
</tr>
|
|
54
|
+
{{/each}}
|
|
55
|
+
{{/if}}
|
|
56
|
+
{{/unless}}
|
|
57
|
+
</:body>
|
|
58
|
+
</AuTable>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{{! @glint-nocheck: not typesafe yet }}
|
|
2
|
+
<AuModal
|
|
3
|
+
class='worship-modal'
|
|
4
|
+
@modalOpen={{@open}}
|
|
5
|
+
@closeModal={{this.closeModal}}
|
|
6
|
+
@title={{t 'lmb-plugin.modal.title'}}
|
|
7
|
+
@size='large'
|
|
8
|
+
@padding='none'
|
|
9
|
+
as |modal|
|
|
10
|
+
>
|
|
11
|
+
<modal.Body>
|
|
12
|
+
<AuMainContainer
|
|
13
|
+
@scroll={{true}}
|
|
14
|
+
class='worship-modal--main-container'
|
|
15
|
+
as |mc|
|
|
16
|
+
>
|
|
17
|
+
<mc.sidebar>
|
|
18
|
+
<div class='au-c-sidebar'>
|
|
19
|
+
<div class='au-c-sidebar__content au-u-padding'>
|
|
20
|
+
<AuHeading @level='3' @skin='4' class='au-u-padding-bottom-small'>
|
|
21
|
+
{{t 'lmb-plugin.modal.search.title'}}
|
|
22
|
+
</AuHeading>
|
|
23
|
+
<AuLabel class='au-margin-bottom-small' for='searchTerm'>
|
|
24
|
+
{{t 'worship-plugin.modal.fields.name'}}
|
|
25
|
+
</AuLabel>
|
|
26
|
+
<AuNativeInput
|
|
27
|
+
@type='text'
|
|
28
|
+
@width='block'
|
|
29
|
+
id='searchTerm'
|
|
30
|
+
value={{this.searchText}}
|
|
31
|
+
placeholder={{t 'worship-plugin.modal.search.placeholder'}}
|
|
32
|
+
{{on 'input' this.setInputSearchText}}
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</mc.sidebar>
|
|
37
|
+
<mc.content @scroll={{true}}>
|
|
38
|
+
<div class='worship-modal--list-container'>
|
|
39
|
+
<LmbPlugin::List
|
|
40
|
+
@error={{this.error}}
|
|
41
|
+
@services={{this.servicesResource}}
|
|
42
|
+
@sort={{this.sort}}
|
|
43
|
+
@setSort={{this.setSort}}
|
|
44
|
+
@insert={{@onInsert}}
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
47
|
+
{{#if this.servicesResource.value.totalCount}}
|
|
48
|
+
{{#let
|
|
49
|
+
(pagination
|
|
50
|
+
page=this.pageNumber
|
|
51
|
+
pageSize=this.pageSize
|
|
52
|
+
count=this.servicesResource.value.totalCount
|
|
53
|
+
)
|
|
54
|
+
as |pg|
|
|
55
|
+
}}
|
|
56
|
+
<Pagination::PaginationView
|
|
57
|
+
@totalCount={{pg.count}}
|
|
58
|
+
@rangeStart={{pg.pageStart}}
|
|
59
|
+
@rangeEnd={{pg.pageEnd}}
|
|
60
|
+
@onNextPage={{this.nextPage}}
|
|
61
|
+
@onPreviousPage={{this.previousPage}}
|
|
62
|
+
@isFirstPage={{not pg.hasPreviousPage}}
|
|
63
|
+
@isLastPage={{not pg.hasNextPage}}
|
|
64
|
+
/>
|
|
65
|
+
{{/let}}
|
|
66
|
+
{{/if}}
|
|
67
|
+
|
|
68
|
+
</mc.content>
|
|
69
|
+
</AuMainContainer>
|
|
70
|
+
</modal.Body>
|
|
71
|
+
</AuModal>
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { tracked } from '@glimmer/tracking';
|
|
3
|
+
import { assert } from '@ember/debug';
|
|
4
|
+
import { action } from '@ember/object';
|
|
5
|
+
import { restartableTask } from 'ember-concurrency';
|
|
6
|
+
import { task as trackedTask } from 'ember-resources/util/ember-concurrency';
|
|
7
|
+
import { LmbPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/lmb-plugin';
|
|
8
|
+
|
|
9
|
+
import Mandatee from '@lblod/ember-rdfa-editor-lblod-plugins/models/mandatee';
|
|
10
|
+
import { IBindings } from 'fetch-sparql-endpoint';
|
|
11
|
+
type SearchSort = [keyof Mandatee, 'ASC' | 'DESC'] | false;
|
|
12
|
+
|
|
13
|
+
interface Args {
|
|
14
|
+
config: LmbPluginConfig;
|
|
15
|
+
open: boolean;
|
|
16
|
+
closeModal: () => void;
|
|
17
|
+
onInsert: () => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface SparqlResponse {
|
|
21
|
+
results: {
|
|
22
|
+
bindings: IBindings[];
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default class LmbPluginSearchModalComponent extends Component<Args> {
|
|
27
|
+
// Display
|
|
28
|
+
@tracked error: unknown;
|
|
29
|
+
@tracked inputSearchText: string | null = null;
|
|
30
|
+
@tracked sort: SearchSort = false;
|
|
31
|
+
|
|
32
|
+
// Pagination
|
|
33
|
+
@tracked pageNumber = 0;
|
|
34
|
+
@tracked pageSize = 20;
|
|
35
|
+
@tracked totalCount = 0;
|
|
36
|
+
|
|
37
|
+
get config() {
|
|
38
|
+
return this.args.config;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@action
|
|
42
|
+
async closeModal() {
|
|
43
|
+
await this.servicesResource.cancel();
|
|
44
|
+
this.args.closeModal();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
fetchData = restartableTask(async () => {
|
|
48
|
+
const endpoint = this.args.config.endpoint;
|
|
49
|
+
const queryResponse = await fetch(endpoint, {
|
|
50
|
+
method: 'POST',
|
|
51
|
+
headers: {
|
|
52
|
+
'Content-Type': 'application/json',
|
|
53
|
+
},
|
|
54
|
+
body: JSON.stringify({
|
|
55
|
+
query: `
|
|
56
|
+
PREFIX besluit: <http://data.vlaanderen.be/ns/besluit#>
|
|
57
|
+
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
|
|
58
|
+
PREFIX mandaat: <http://data.vlaanderen.be/ns/mandaat#>
|
|
59
|
+
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
|
|
60
|
+
PREFIX persoon: <http://data.vlaanderen.be/ns/persoon#>
|
|
61
|
+
PREFIX org: <http://www.w3.org/ns/org#>
|
|
62
|
+
PREFIX regorg: <https://www.w3.org/ns/regorg#>
|
|
63
|
+
SELECT DISTINCT ?mandatee ?person ?firstName ?lastName ?statusLabel ?fractieLabel ?roleLabel WHERE {
|
|
64
|
+
?mandatee a mandaat:Mandataris;
|
|
65
|
+
org:holds ?mandaat;
|
|
66
|
+
mandaat:status ?status;
|
|
67
|
+
mandaat:isBestuurlijkeAliasVan ?person;
|
|
68
|
+
org:hasMembership ?membership.
|
|
69
|
+
?person foaf:familyName ?lastName;
|
|
70
|
+
persoon:gebruikteVoornaam ?firstName.
|
|
71
|
+
?status skos:prefLabel ?statusLabel.
|
|
72
|
+
?membership org:organisation ?fractie.
|
|
73
|
+
?fractie regorg:legalName ?fractieLabel.
|
|
74
|
+
?mandaat org:role ?role.
|
|
75
|
+
?role skos:prefLabel ?roleLabel.
|
|
76
|
+
OPTIONAL {
|
|
77
|
+
?mandatee mandaat:einde ?endDate
|
|
78
|
+
}
|
|
79
|
+
filter (!bound(?endDate) || ?endDate > now()).
|
|
80
|
+
}
|
|
81
|
+
`,
|
|
82
|
+
}),
|
|
83
|
+
});
|
|
84
|
+
const queryJson: SparqlResponse = await queryResponse.json();
|
|
85
|
+
const mandatees = queryJson.results.bindings.map(Mandatee.fromBinding);
|
|
86
|
+
return mandatees;
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
search = restartableTask(async () => {
|
|
90
|
+
// Can't do what I want, so if the user modifies the filter before resolving the query will run again
|
|
91
|
+
if (!this.fetchData.lastComplete) {
|
|
92
|
+
await this.fetchData.perform();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (!this.fetchData.lastComplete?.value) return;
|
|
96
|
+
let mandatees: Mandatee[] = [...this.fetchData.lastComplete.value];
|
|
97
|
+
|
|
98
|
+
if (this.inputSearchText) {
|
|
99
|
+
mandatees = mandatees?.filter((mandatee: Mandatee) =>
|
|
100
|
+
mandatee.fullName
|
|
101
|
+
.toLowerCase()
|
|
102
|
+
.includes(this.inputSearchText?.toLowerCase() as string),
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (this.sort) {
|
|
107
|
+
const [key, sortingDirection] = this.sort;
|
|
108
|
+
mandatees = mandatees.sort((a: Mandatee, b: Mandatee) => {
|
|
109
|
+
if (key === 'fullName') {
|
|
110
|
+
if (a.lastName === b.lastName) {
|
|
111
|
+
if (a.firstName > b.firstName) {
|
|
112
|
+
return sortingDirection === 'ASC' ? 1 : -1;
|
|
113
|
+
} else {
|
|
114
|
+
return sortingDirection === 'ASC' ? -1 : 1;
|
|
115
|
+
}
|
|
116
|
+
} else {
|
|
117
|
+
if (a.lastName > b.lastName) {
|
|
118
|
+
return sortingDirection === 'ASC' ? 1 : -1;
|
|
119
|
+
} else {
|
|
120
|
+
return sortingDirection === 'ASC' ? -1 : 1;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
} else if (a[key] > b[key]) {
|
|
124
|
+
return sortingDirection === 'ASC' ? 1 : -1;
|
|
125
|
+
} else {
|
|
126
|
+
return sortingDirection === 'ASC' ? -1 : 1;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const totalCount = mandatees?.length;
|
|
132
|
+
|
|
133
|
+
mandatees = mandatees?.slice(
|
|
134
|
+
this.pageSize * this.pageNumber,
|
|
135
|
+
this.pageSize * (this.pageNumber + 1),
|
|
136
|
+
);
|
|
137
|
+
return {
|
|
138
|
+
results: mandatees,
|
|
139
|
+
totalCount,
|
|
140
|
+
};
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
servicesResource = trackedTask(this, this.search, () => [
|
|
144
|
+
this.inputSearchText,
|
|
145
|
+
this.sort,
|
|
146
|
+
this.pageNumber,
|
|
147
|
+
this.pageSize,
|
|
148
|
+
]);
|
|
149
|
+
|
|
150
|
+
@action
|
|
151
|
+
setSort(sort: SearchSort) {
|
|
152
|
+
this.sort = sort;
|
|
153
|
+
}
|
|
154
|
+
@action
|
|
155
|
+
setInputSearchText(event: InputEvent) {
|
|
156
|
+
assert(
|
|
157
|
+
'inputSearchText must be bound to an input element',
|
|
158
|
+
event.target instanceof HTMLInputElement,
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
this.inputSearchText = event.target.value;
|
|
162
|
+
this.pageNumber = 0;
|
|
163
|
+
}
|
|
164
|
+
@action
|
|
165
|
+
previousPage() {
|
|
166
|
+
--this.pageNumber;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
@action
|
|
170
|
+
nextPage() {
|
|
171
|
+
++this.pageNumber;
|
|
172
|
+
}
|
|
173
|
+
}
|