@lblod/ember-rdfa-editor-lblod-plugins 18.1.0 → 19.0.0-dev.4059db0c14a87dd4a1eadb3bb35ed2ef4a825fa3
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/.changeset/afraid-mails-clean.md +5 -0
- package/CHANGELOG.md +20 -0
- 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 +60 -0
- package/addon/components/lmb-plugin/search-modal.hbs +68 -0
- package/addon/components/lmb-plugin/search-modal.ts +157 -0
- package/addon/components/variable-plugin/number/nodeview.hbs +1 -1
- package/addon/components/variable-plugin/number/nodeview.ts +1 -0
- package/addon/models/mandatee.ts +35 -0
- package/addon/plugins/lmb-plugin/index.ts +3 -0
- package/addon/utils/constants.ts +5 -0
- 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/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/variable-plugin/number/nodeview.d.ts +1 -0
- package/declarations/addon/models/mandatee.d.ts +13 -0
- package/declarations/addon/plugins/lmb-plugin/index.d.ts +3 -0
- package/declarations/addon/utils/constants.d.ts +2 -0
- package/package.json +3 -3
- package/pnpm-lock.yaml +4 -4
- package/translations/en-US.yaml +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @lblod/ember-rdfa-editor-lblod-plugins
|
|
2
2
|
|
|
3
|
+
## 19.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`b9f7f56a469a18adbd75951e5ddd2a2f1cda7e45`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/b9f7f56a469a18adbd75951e5ddd2a2f1cda7e45) Thanks [@abeforgit](https://github.com/abeforgit)! - Use the selectNode argument instead of the helper
|
|
8
|
+
|
|
9
|
+
The select-on-click helper was removed in 9.8.0 of the editor, and was arguably never really public API.
|
|
10
|
+
|
|
11
|
+
This uses the replacement, a selectNode argument all ember-nodes receive.
|
|
12
|
+
|
|
13
|
+
This is breaking cause it restricts the peerdep to at least 9.8.0.
|
|
14
|
+
|
|
15
|
+
## 18.1.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`974469d3f16d045be14b6111cc1be9c251971609`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/974469d3f16d045be14b6111cc1be9c251971609) Thanks [@abeforgit](https://github.com/abeforgit)! - Fix peerdeps to avoid broken combo
|
|
20
|
+
|
|
21
|
+
Version 9.8.0 of the editor removes a helper that's used in the number variable nodeview. We restrict the peerdep here so we avoid a broken combination of plugins + editor
|
|
22
|
+
|
|
3
23
|
## 18.1.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
|
@@ -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,60 @@
|
|
|
1
|
+
<AuTable>
|
|
2
|
+
<:header>
|
|
3
|
+
<tr class='au-c-data-table__header-title'>
|
|
4
|
+
<th>
|
|
5
|
+
<WorshipPlugin::SortableTableHeader
|
|
6
|
+
@field='fullName'
|
|
7
|
+
@label={{t 'lmb-plugin.modal.fields.name'}}
|
|
8
|
+
@sort={{@sort}}
|
|
9
|
+
@setSort={{@setSort}}
|
|
10
|
+
/>
|
|
11
|
+
</th>
|
|
12
|
+
<th>
|
|
13
|
+
<WorshipPlugin::SortableTableHeader
|
|
14
|
+
@field='status'
|
|
15
|
+
@label={{t 'lmb-plugin.modal.fields.status'}}
|
|
16
|
+
@sort={{@sort}}
|
|
17
|
+
@setSort={{@setSort}}
|
|
18
|
+
/>
|
|
19
|
+
</th>
|
|
20
|
+
<th>
|
|
21
|
+
<WorshipPlugin::SortableTableHeader
|
|
22
|
+
@field='fractie'
|
|
23
|
+
@label={{t 'lmb-plugin.modal.fields.fractie'}}
|
|
24
|
+
@sort={{@sort}}
|
|
25
|
+
@setSort={{@setSort}}
|
|
26
|
+
/>
|
|
27
|
+
</th>
|
|
28
|
+
<th>
|
|
29
|
+
<WorshipPlugin::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
|
|
50
|
+
{{on 'click' (fn @insert row)}}
|
|
51
|
+
>
|
|
52
|
+
{{t 'lmb-plugin.modal.insert'}}
|
|
53
|
+
</AuButton>
|
|
54
|
+
</td>
|
|
55
|
+
</tr>
|
|
56
|
+
{{/each}}
|
|
57
|
+
{{/if}}
|
|
58
|
+
{{/unless}}
|
|
59
|
+
</:body>
|
|
60
|
+
</AuTable>
|
|
@@ -0,0 +1,68 @@
|
|
|
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 @scroll={{true}} class='worship-modal--main-container' as |mc|>
|
|
13
|
+
<mc.sidebar>
|
|
14
|
+
<div class='au-c-sidebar'>
|
|
15
|
+
<div class='au-c-sidebar__content au-u-padding'>
|
|
16
|
+
<AuHeading @level='3' @skin='4' class='au-u-padding-bottom-small'>
|
|
17
|
+
{{t 'lmb-plugin.modal.search.title'}}
|
|
18
|
+
</AuHeading>
|
|
19
|
+
<AuLabel
|
|
20
|
+
class='au-margin-bottom-small'
|
|
21
|
+
for='searchTerm'
|
|
22
|
+
>
|
|
23
|
+
{{t 'worship-plugin.modal.fields.name'}}
|
|
24
|
+
</AuLabel>
|
|
25
|
+
<AuNativeInput
|
|
26
|
+
@type='text'
|
|
27
|
+
@width='block'
|
|
28
|
+
id='searchTerm'
|
|
29
|
+
value={{this.searchText}}
|
|
30
|
+
placeholder={{t 'worship-plugin.modal.search.placeholder'}}
|
|
31
|
+
{{on 'input' this.setInputSearchText}}
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</mc.sidebar>
|
|
36
|
+
<mc.content @scroll={{true}}>
|
|
37
|
+
<div class='worship-modal--list-container'>
|
|
38
|
+
<LmbPlugin::List
|
|
39
|
+
@error={{this.error}}
|
|
40
|
+
@services={{this.servicesResource}}
|
|
41
|
+
@sort={{this.sort}}
|
|
42
|
+
@setSort={{this.setSort}}
|
|
43
|
+
@insert={{@onInsert}}
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
{{#if this.servicesResource.value.totalCount}}
|
|
47
|
+
{{#let
|
|
48
|
+
(pagination
|
|
49
|
+
page=this.pageNumber pageSize=this.pageSize count=this.servicesResource.value.totalCount
|
|
50
|
+
)
|
|
51
|
+
as |pg|
|
|
52
|
+
}}
|
|
53
|
+
<Pagination::PaginationView
|
|
54
|
+
@totalCount={{pg.count}}
|
|
55
|
+
@rangeStart={{pg.pageStart}}
|
|
56
|
+
@rangeEnd={{pg.pageEnd}}
|
|
57
|
+
@onNextPage={{this.nextPage}}
|
|
58
|
+
@onPreviousPage={{this.previousPage}}
|
|
59
|
+
@isFirstPage={{not pg.hasPreviousPage}}
|
|
60
|
+
@isLastPage={{not pg.hasNextPage}}
|
|
61
|
+
/>
|
|
62
|
+
{{/let}}
|
|
63
|
+
{{/if}}
|
|
64
|
+
|
|
65
|
+
</mc.content>
|
|
66
|
+
</AuMainContainer>
|
|
67
|
+
</modal.Body>
|
|
68
|
+
</AuModal>
|
|
@@ -0,0 +1,157 @@
|
|
|
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.includes(this.inputSearchText as string),
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (this.sort) {
|
|
105
|
+
const [key, sortingDirection] = this.sort;
|
|
106
|
+
mandatees = mandatees.sort((a: Mandatee, b: Mandatee) => {
|
|
107
|
+
if (a[key] > b[key]) {
|
|
108
|
+
return sortingDirection === 'ASC' ? 1 : -1;
|
|
109
|
+
} else {
|
|
110
|
+
return sortingDirection === 'ASC' ? -1 : 1;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const totalCount = mandatees?.length;
|
|
116
|
+
|
|
117
|
+
mandatees = mandatees?.slice(
|
|
118
|
+
this.pageSize * this.pageNumber,
|
|
119
|
+
this.pageSize * (this.pageNumber + 1),
|
|
120
|
+
);
|
|
121
|
+
return {
|
|
122
|
+
results: mandatees,
|
|
123
|
+
totalCount,
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
servicesResource = trackedTask(this, this.search, () => [
|
|
128
|
+
this.inputSearchText,
|
|
129
|
+
this.sort,
|
|
130
|
+
this.pageNumber,
|
|
131
|
+
this.pageSize,
|
|
132
|
+
]);
|
|
133
|
+
|
|
134
|
+
@action
|
|
135
|
+
setSort(sort: SearchSort) {
|
|
136
|
+
this.sort = sort;
|
|
137
|
+
}
|
|
138
|
+
@action
|
|
139
|
+
setInputSearchText(event: InputEvent) {
|
|
140
|
+
assert(
|
|
141
|
+
'inputSearchText must be bound to an input element',
|
|
142
|
+
event.target instanceof HTMLInputElement,
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
this.inputSearchText = event.target.value;
|
|
146
|
+
this.pageNumber = 0;
|
|
147
|
+
}
|
|
148
|
+
@action
|
|
149
|
+
previousPage() {
|
|
150
|
+
--this.pageNumber;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
@action
|
|
154
|
+
nextPage() {
|
|
155
|
+
++this.pageNumber;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IBindings } from 'fetch-sparql-endpoint';
|
|
2
|
+
import { unwrap } from '../utils/option';
|
|
3
|
+
|
|
4
|
+
export default class Mandatee {
|
|
5
|
+
constructor(
|
|
6
|
+
readonly personUri: string,
|
|
7
|
+
readonly mandateeUri: string,
|
|
8
|
+
readonly firstName: string,
|
|
9
|
+
readonly lastName: string,
|
|
10
|
+
readonly fullName: string,
|
|
11
|
+
readonly status: string,
|
|
12
|
+
readonly fractie: string,
|
|
13
|
+
readonly role: string,
|
|
14
|
+
) {}
|
|
15
|
+
static fromBinding(binding: IBindings) {
|
|
16
|
+
const personUri = unwrap(binding['person']?.value);
|
|
17
|
+
const mandateeUri = unwrap(binding['mandatee']?.value);
|
|
18
|
+
const firstName = unwrap(binding['firstName']?.value);
|
|
19
|
+
const lastName = unwrap(binding['lastName']?.value);
|
|
20
|
+
const fullName = `${firstName} ${lastName}`;
|
|
21
|
+
const status = unwrap(binding['statusLabel']?.value);
|
|
22
|
+
const fractie = unwrap(binding['fractieLabel']?.value);
|
|
23
|
+
const role = unwrap(binding['roleLabel']?.value);
|
|
24
|
+
return new Mandatee(
|
|
25
|
+
personUri,
|
|
26
|
+
mandateeUri,
|
|
27
|
+
firstName,
|
|
28
|
+
lastName,
|
|
29
|
+
fullName,
|
|
30
|
+
status,
|
|
31
|
+
fractie,
|
|
32
|
+
role,
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}
|
package/addon/utils/constants.ts
CHANGED
|
@@ -31,3 +31,8 @@ export const GEOSPARQL = namespace(
|
|
|
31
31
|
'http://www.opengis.net/ont/geosparql#',
|
|
32
32
|
'geosparql',
|
|
33
33
|
);
|
|
34
|
+
export const MANDAAT = namespace(
|
|
35
|
+
'http://data.vlaanderen.be/ns/mandaat#',
|
|
36
|
+
'mandaat',
|
|
37
|
+
);
|
|
38
|
+
export const FOAF = namespace('http://xmlns.com/foaf/0.1/', 'foaf');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/lmb-plugin/insert';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/lmb-plugin/list';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/lmb-plugin/search-modal';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
3
|
+
import { LmbPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/lmb-plugin';
|
|
4
|
+
import Mandatee from '@lblod/ember-rdfa-editor-lblod-plugins/models/mandatee';
|
|
5
|
+
interface Args {
|
|
6
|
+
controller: SayController;
|
|
7
|
+
config: LmbPluginConfig;
|
|
8
|
+
}
|
|
9
|
+
export default class LmbPluginInsertComponent extends Component<Args> {
|
|
10
|
+
AddIcon: TOC<import("@appuniversum/ember-appuniversum/components/icons/add").AddIconSignature>;
|
|
11
|
+
showModal: boolean;
|
|
12
|
+
get controller(): SayController;
|
|
13
|
+
openModal(): void;
|
|
14
|
+
closeModal(): void;
|
|
15
|
+
onInsert(mandatee: Mandatee): void;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { LmbPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/lmb-plugin';
|
|
3
|
+
import Mandatee from '@lblod/ember-rdfa-editor-lblod-plugins/models/mandatee';
|
|
4
|
+
type SearchSort = [keyof Mandatee, 'ASC' | 'DESC'] | false;
|
|
5
|
+
interface Args {
|
|
6
|
+
config: LmbPluginConfig;
|
|
7
|
+
open: boolean;
|
|
8
|
+
closeModal: () => void;
|
|
9
|
+
onInsert: () => void;
|
|
10
|
+
}
|
|
11
|
+
export default class LmbPluginSearchModalComponent extends Component<Args> {
|
|
12
|
+
error: unknown;
|
|
13
|
+
inputSearchText: string | null;
|
|
14
|
+
sort: SearchSort;
|
|
15
|
+
pageNumber: number;
|
|
16
|
+
pageSize: number;
|
|
17
|
+
totalCount: number;
|
|
18
|
+
get config(): LmbPluginConfig;
|
|
19
|
+
closeModal(): Promise<void>;
|
|
20
|
+
fetchData: import("ember-concurrency").TaskForAsyncTaskFunction<unknown, () => Promise<Mandatee[]>>;
|
|
21
|
+
search: import("ember-concurrency").TaskForAsyncTaskFunction<unknown, () => Promise<{
|
|
22
|
+
results: Mandatee[];
|
|
23
|
+
totalCount: number;
|
|
24
|
+
} | undefined>>;
|
|
25
|
+
servicesResource: import("ember-resources/util/ember-concurrency").TaskInstance<unknown>;
|
|
26
|
+
setSort(sort: SearchSort): void;
|
|
27
|
+
setInputSearchText(event: InputEvent): void;
|
|
28
|
+
previousPage(): void;
|
|
29
|
+
nextPage(): void;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -10,6 +10,7 @@ type Args = {
|
|
|
10
10
|
view: SayView;
|
|
11
11
|
selected: boolean;
|
|
12
12
|
contentDecorations?: DecorationSource;
|
|
13
|
+
selectNode: () => void;
|
|
13
14
|
};
|
|
14
15
|
export default class NumberNodeviewComponent extends Component<Args> {
|
|
15
16
|
PencilIcon: TOC<import("@appuniversum/ember-appuniversum/components/icons/pencil").PencilIconSignature>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IBindings } from 'fetch-sparql-endpoint';
|
|
2
|
+
export default class Mandatee {
|
|
3
|
+
readonly personUri: string;
|
|
4
|
+
readonly mandateeUri: string;
|
|
5
|
+
readonly firstName: string;
|
|
6
|
+
readonly lastName: string;
|
|
7
|
+
readonly fullName: string;
|
|
8
|
+
readonly status: string;
|
|
9
|
+
readonly fractie: string;
|
|
10
|
+
readonly role: string;
|
|
11
|
+
constructor(personUri: string, mandateeUri: string, firstName: string, lastName: string, fullName: string, status: string, fractie: string, role: string);
|
|
12
|
+
static fromBinding(binding: IBindings): Mandatee;
|
|
13
|
+
}
|
|
@@ -12,3 +12,5 @@ export declare const ADRES: (s: string) => import("@lblod/ember-rdfa-editor-lblo
|
|
|
12
12
|
export declare const GENERIEK: (s: string) => import("@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace").Resource;
|
|
13
13
|
export declare const GEO: (s: string) => import("@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace").Resource;
|
|
14
14
|
export declare const GEOSPARQL: (s: string) => import("@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace").Resource;
|
|
15
|
+
export declare const MANDAAT: (s: string) => import("@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace").Resource;
|
|
16
|
+
export declare const FOAF: (s: string) => import("@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace").Resource;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lblod/ember-rdfa-editor-lblod-plugins",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "19.0.0-dev.4059db0c14a87dd4a1eadb3bb35ed2ef4a825fa3",
|
|
4
4
|
"description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"@glint/template": "^1.4.0",
|
|
99
99
|
"@graphy/content.ttl.write": "^4.3.7",
|
|
100
100
|
"@graphy/memory.dataset.fast": "4.3.3",
|
|
101
|
-
"@lblod/ember-rdfa-editor": "9.
|
|
101
|
+
"@lblod/ember-rdfa-editor": "^9.8.0",
|
|
102
102
|
"@rdfjs/types": "^1.1.0",
|
|
103
103
|
"@release-it/keep-a-changelog": "^3.1.0",
|
|
104
104
|
"@tsconfig/ember": "^3.0.0",
|
|
@@ -180,7 +180,7 @@
|
|
|
180
180
|
"@appuniversum/ember-appuniversum": "^3.4.1",
|
|
181
181
|
"@ember/string": "3.x",
|
|
182
182
|
"@glint/template": "^1.1.0",
|
|
183
|
-
"@lblod/ember-rdfa-editor": "^9.
|
|
183
|
+
"@lblod/ember-rdfa-editor": "^9.8.0",
|
|
184
184
|
"ember-concurrency": "^2.3.7 || ^3.1.0",
|
|
185
185
|
"ember-intl": "^5.7.2 || ^6.1.0",
|
|
186
186
|
"ember-modifier": "^3.2.7",
|
package/pnpm-lock.yaml
CHANGED
|
@@ -149,8 +149,8 @@ devDependencies:
|
|
|
149
149
|
specifier: 4.3.3
|
|
150
150
|
version: 4.3.3
|
|
151
151
|
'@lblod/ember-rdfa-editor':
|
|
152
|
-
specifier: 9.
|
|
153
|
-
version: 9.
|
|
152
|
+
specifier: ^9.8.0
|
|
153
|
+
version: 9.9.0(@appuniversum/ember-appuniversum@3.4.1)(@glint/template@1.4.0)(@lezer/common@1.2.1)(ember-changeset@4.1.2)(ember-cli-sass@11.0.1)(ember-intl@5.7.2)(ember-modifier@3.2.7)(ember-source@4.12.0)(webpack@5.90.3)
|
|
154
154
|
'@rdfjs/types':
|
|
155
155
|
specifier: ^1.1.0
|
|
156
156
|
version: 1.1.0
|
|
@@ -2792,8 +2792,8 @@ packages:
|
|
|
2792
2792
|
'@jridgewell/resolve-uri': 3.1.2
|
|
2793
2793
|
'@jridgewell/sourcemap-codec': 1.4.15
|
|
2794
2794
|
|
|
2795
|
-
/@lblod/ember-rdfa-editor@9.
|
|
2796
|
-
resolution: {integrity: sha512-
|
|
2795
|
+
/@lblod/ember-rdfa-editor@9.9.0(@appuniversum/ember-appuniversum@3.4.1)(@glint/template@1.4.0)(@lezer/common@1.2.1)(ember-changeset@4.1.2)(ember-cli-sass@11.0.1)(ember-intl@5.7.2)(ember-modifier@3.2.7)(ember-source@4.12.0)(webpack@5.90.3):
|
|
2796
|
+
resolution: {integrity: sha512-BY8zxQHFSRXOKvMCE+YOMumEzFJJVwbernmeRaBNPuiwCIpmMptu7ajYTDbyUb0J6VSvwoDRZRa2RoiVAJQntQ==}
|
|
2797
2797
|
engines: {node: 16.* || 18.* || >= 20}
|
|
2798
2798
|
peerDependencies:
|
|
2799
2799
|
'@appuniversum/ember-appuniversum': ^2.15.0 || ^3.0.0
|
package/translations/en-US.yaml
CHANGED
|
@@ -403,3 +403,17 @@ worship-plugin:
|
|
|
403
403
|
sort: Sort
|
|
404
404
|
asc: Sort ascending
|
|
405
405
|
desc: Sort descending
|
|
406
|
+
|
|
407
|
+
lmb-plugin:
|
|
408
|
+
insert:
|
|
409
|
+
title: Insert mandatee from LMB service
|
|
410
|
+
modal:
|
|
411
|
+
title: Choose a mandatee
|
|
412
|
+
insert: Insert
|
|
413
|
+
search:
|
|
414
|
+
title: Filter on
|
|
415
|
+
fields:
|
|
416
|
+
name: Name
|
|
417
|
+
status: Status
|
|
418
|
+
fractie: Fractie
|
|
419
|
+
role: Role
|