@lblod/ember-rdfa-editor-lblod-plugins 25.2.0 → 25.2.1-dev.0cb4f555effe599d6e481d14bfcb6de7ac15fb66
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/quiet-poems-float.md +5 -0
- package/CHANGELOG.md +8 -0
- package/addon/components/location-plugin/nodeview.gts +16 -28
- package/addon/components/variable-plugin/address/nodeview.hbs +4 -18
- package/addon/components/variable-plugin/address/nodeview.ts +12 -23
- package/addon/components/variable-plugin/address/utils.ts +2 -2
- package/addon/components/variable-plugin/autofilled/insert.gts +5 -4
- package/addon/components/variable-plugin/codelist/insert.ts +3 -3
- package/addon/components/variable-plugin/date/insert-variable.ts +2 -2
- package/addon/components/variable-plugin/date/insert.ts +2 -3
- package/addon/components/variable-plugin/date/nodeview.hbs +4 -12
- package/addon/components/variable-plugin/date/nodeview.ts +5 -23
- package/addon/components/variable-plugin/location/insert.ts +6 -4
- package/addon/components/variable-plugin/number/insert.ts +2 -2
- package/addon/components/variable-plugin/number/nodeview.hbs +4 -19
- package/addon/components/variable-plugin/number/nodeview.ts +12 -10
- package/addon/components/variable-plugin/person/insert.ts +2 -2
- package/addon/components/variable-plugin/person/nodeview.hbs +4 -18
- package/addon/components/variable-plugin/person/nodeview.ts +12 -19
- package/addon/components/variable-plugin/text/insert.ts +3 -3
- package/addon/components/variable-plugin/variable/nodeview.hbs +2 -8
- package/addon/components/variable-plugin/variable/nodeview.ts +16 -7
- package/addon/plugins/variable-plugin/variables/autofilled.ts +2 -2
- package/addon/plugins/variable-plugin/variables/location.ts +2 -3
- package/addon/utils/namespace.ts +4 -1
- package/app/styles/variable-plugin.scss +21 -26
- package/declarations/addon/components/location-plugin/nodeview.d.ts +2 -3
- package/declarations/addon/components/variable-plugin/address/nodeview.d.ts +2 -8
- package/declarations/addon/components/variable-plugin/date/nodeview.d.ts +2 -6
- package/declarations/addon/components/variable-plugin/number/nodeview.d.ts +2 -4
- package/declarations/addon/components/variable-plugin/person/nodeview.d.ts +2 -7
- package/declarations/addon/components/variable-plugin/variable/nodeview.d.ts +2 -2
- package/package.json +3 -3
- package/pnpm-lock.yaml +24 -17
- package/translations/en-US.yaml +5 -5
- package/translations/nl-BE.yaml +5 -5
- package/addon/components/variable-plugin/autofilled/nodeview.gts +0 -100
- package/addon/components/variable-plugin/location/nodeview.hbs +0 -24
- package/addon/components/variable-plugin/location/nodeview.ts +0 -46
- package/declarations/addon/components/variable-plugin/autofilled/nodeview.d.ts +0 -22
- package/declarations/addon/components/variable-plugin/location/nodeview.d.ts +0 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @lblod/ember-rdfa-editor-lblod-plugins
|
|
2
2
|
|
|
3
|
+
## 25.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#497](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/497) [`2b4b401`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/2b4b4011e3d66c23f232bf6690ca80a5b0a90298) Thanks [@lagartoverde](https://github.com/lagartoverde)! - Redesign variable pills
|
|
8
|
+
|
|
9
|
+
- [#497](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/497) [`2b4b401`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/2b4b4011e3d66c23f232bf6690ca80a5b0a90298) Thanks [@lagartoverde](https://github.com/lagartoverde)! - Bump ember-rdfa-editor to 10.7.3
|
|
10
|
+
|
|
3
11
|
## 25.2.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -2,7 +2,6 @@ import Component from '@glimmer/component';
|
|
|
2
2
|
import { service } from '@ember/service';
|
|
3
3
|
import { on } from '@ember/modifier';
|
|
4
4
|
import IntlService from 'ember-intl/services/intl';
|
|
5
|
-
import { PencilIcon } from '@appuniversum/ember-appuniversum/components/icons/pencil';
|
|
6
5
|
import AuPill, {
|
|
7
6
|
type AuPillSignature,
|
|
8
7
|
} from '@appuniversum/ember-appuniversum/components/au-pill';
|
|
@@ -25,14 +24,6 @@ type Signature = {
|
|
|
25
24
|
export default class AddressNodeviewComponent extends Component<Signature> {
|
|
26
25
|
@service declare intl: IntlService;
|
|
27
26
|
|
|
28
|
-
get translations() {
|
|
29
|
-
return {
|
|
30
|
-
placeholder: this.intl.t('editor-plugins.address.nodeview.placeholder', {
|
|
31
|
-
locale: this.args.controller.documentLanguage,
|
|
32
|
-
}),
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
27
|
get address() {
|
|
37
28
|
return this.args.node.attrs.value as Address | null;
|
|
38
29
|
}
|
|
@@ -42,26 +33,23 @@ export default class AddressNodeviewComponent extends Component<Signature> {
|
|
|
42
33
|
return getOutgoingTriple(this.args.node.attrs, EXT('label'))?.object.value;
|
|
43
34
|
}
|
|
44
35
|
|
|
36
|
+
get filled() {
|
|
37
|
+
return !!this.address;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
get content() {
|
|
41
|
+
if (this.filled) {
|
|
42
|
+
return this.address?.formatted;
|
|
43
|
+
} else {
|
|
44
|
+
return this.label;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
45
48
|
<template>
|
|
46
|
-
<AuPill
|
|
47
|
-
class='variable
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
...attributes
|
|
51
|
-
{{on 'click' @selectNode}}
|
|
52
|
-
>
|
|
53
|
-
{{#if this.address}}
|
|
54
|
-
{{this.address.formatted}}
|
|
55
|
-
{{else}}
|
|
56
|
-
<span class='mark-highlight-manual'>
|
|
57
|
-
{{this.translations.placeholder}}
|
|
58
|
-
</span>
|
|
59
|
-
{{/if}}
|
|
60
|
-
{{#if this.label}}
|
|
61
|
-
<span class='label'>
|
|
62
|
-
({{this.label}})
|
|
63
|
-
</span>
|
|
64
|
-
{{/if}}
|
|
49
|
+
<AuPill class='say-pill atomic' ...attributes {{on 'click' @selectNode}}>
|
|
50
|
+
<span class='{{unless this.filled "unfilled-variable"}}'>
|
|
51
|
+
{{this.content}}
|
|
52
|
+
</span>
|
|
65
53
|
</AuPill>
|
|
66
54
|
</template>
|
|
67
55
|
}
|
|
@@ -1,20 +1,6 @@
|
|
|
1
1
|
{{! @glint-nocheck: not typesafe yet }}
|
|
2
|
-
<AuPill
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
{{on 'click' @selectNode}}
|
|
7
|
-
>
|
|
8
|
-
{{#if this.address}}
|
|
9
|
-
{{this.address.formatted}}
|
|
10
|
-
{{else}}
|
|
11
|
-
<span class='mark-highlight-manual'>
|
|
12
|
-
{{this.translations.placeholder}}
|
|
13
|
-
</span>
|
|
14
|
-
{{/if}}
|
|
15
|
-
{{#if this.label}}
|
|
16
|
-
<span class='label'>
|
|
17
|
-
({{this.label}})
|
|
18
|
-
</span>
|
|
19
|
-
{{/if}}
|
|
2
|
+
<AuPill class='say-pill atomic' {{on 'click' @selectNode}}>
|
|
3
|
+
<span class='{{unless this.filled "unfilled-variable"}}'>
|
|
4
|
+
{{this.content}}
|
|
5
|
+
</span>
|
|
20
6
|
</AuPill>
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
|
-
import { service } from '@ember/service';
|
|
3
|
-
import IntlService from 'ember-intl/services/intl';
|
|
4
|
-
import { PencilIcon } from '@appuniversum/ember-appuniversum/components/icons/pencil';
|
|
5
2
|
|
|
6
3
|
import { PNode, SayController } from '@lblod/ember-rdfa-editor';
|
|
7
4
|
import { Address } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/address-helpers';
|
|
@@ -15,26 +12,6 @@ type Args = {
|
|
|
15
12
|
};
|
|
16
13
|
|
|
17
14
|
export default class AddressNodeviewComponent extends Component<Args> {
|
|
18
|
-
PencilIcon = PencilIcon;
|
|
19
|
-
|
|
20
|
-
@service declare intl: IntlService;
|
|
21
|
-
|
|
22
|
-
get controller() {
|
|
23
|
-
return this.args.controller;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
get documentLanguage() {
|
|
27
|
-
return this.controller.documentLanguage;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
get translations() {
|
|
31
|
-
return {
|
|
32
|
-
placeholder: this.intl.t('editor-plugins.address.nodeview.placeholder', {
|
|
33
|
-
locale: this.documentLanguage,
|
|
34
|
-
}),
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
15
|
get node() {
|
|
39
16
|
return this.args.node;
|
|
40
17
|
}
|
|
@@ -47,4 +24,16 @@ export default class AddressNodeviewComponent extends Component<Args> {
|
|
|
47
24
|
if (this.address) return '';
|
|
48
25
|
return getOutgoingTriple(this.node.attrs, EXT('label'))?.object.value;
|
|
49
26
|
}
|
|
27
|
+
|
|
28
|
+
get filled() {
|
|
29
|
+
return !!this.address;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
get content() {
|
|
33
|
+
if (this.filled) {
|
|
34
|
+
return this.address?.formatted;
|
|
35
|
+
} else {
|
|
36
|
+
return this.label;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
50
39
|
}
|
|
@@ -11,8 +11,8 @@ export function replaceSelectionWithAddress(
|
|
|
11
11
|
controller: SayController,
|
|
12
12
|
label?: string,
|
|
13
13
|
) {
|
|
14
|
-
const mappingResource = `http://data.lblod.info/mappings
|
|
15
|
-
const variableInstance = `http://data.lblod.info/variables
|
|
14
|
+
const mappingResource = `http://data.lblod.info/mappings/--ref-uuid4-${uuidv4()}`;
|
|
15
|
+
const variableInstance = `http://data.lblod.info/variables/--ref-uuid4-${uuidv4()}`;
|
|
16
16
|
|
|
17
17
|
controller.withTransaction((tr) => {
|
|
18
18
|
tr.replaceSelectionWith(
|
|
@@ -60,15 +60,16 @@ export default class AutoFilledVariableInsertComponent extends Component<Args> {
|
|
|
60
60
|
|
|
61
61
|
@action
|
|
62
62
|
insert() {
|
|
63
|
-
const mappingSubject = `http://data.lblod.info/mappings
|
|
64
|
-
const variableInstance = `http://data.lblod.info/variables
|
|
63
|
+
const mappingSubject = `http://data.lblod.info/mappings/--ref-uuid4-${uuidv4()}`;
|
|
64
|
+
const variableInstance = `http://data.lblod.info/variables/--ref-uuid4-${uuidv4()}`;
|
|
65
65
|
const variableId = uuidv4();
|
|
66
66
|
|
|
67
67
|
const placeholder = this.intl.t('variable.autofilled.label', {
|
|
68
68
|
locale: this.documentLanguage,
|
|
69
69
|
});
|
|
70
70
|
|
|
71
|
-
const label =
|
|
71
|
+
const label =
|
|
72
|
+
this.label != '' ? this.label : this.autofillKey || placeholder;
|
|
72
73
|
const node = this.schema.nodes.autofilled_variable.create(
|
|
73
74
|
{
|
|
74
75
|
subject: mappingSubject,
|
|
@@ -101,7 +102,7 @@ export default class AutoFilledVariableInsertComponent extends Component<Args> {
|
|
|
101
102
|
},
|
|
102
103
|
|
|
103
104
|
this.schema.node('placeholder', {
|
|
104
|
-
placeholderText:
|
|
105
|
+
placeholderText: label,
|
|
105
106
|
}),
|
|
106
107
|
);
|
|
107
108
|
this.label = '';
|
|
@@ -88,8 +88,8 @@ export default class CodelistInsertComponent extends Component<Args> {
|
|
|
88
88
|
|
|
89
89
|
@action
|
|
90
90
|
insert() {
|
|
91
|
-
const mappingResource = `http://data.lblod.info/mappings
|
|
92
|
-
const variableInstance = `http://data.lblod.info/variables
|
|
91
|
+
const mappingResource = `http://data.lblod.info/mappings/--ref-uuid4-${uuidv4()}`;
|
|
92
|
+
const variableInstance = `http://data.lblod.info/variables/--ref-uuid4-${uuidv4()}`;
|
|
93
93
|
const codelistResource = this.selectedCodelist?.uri;
|
|
94
94
|
const label =
|
|
95
95
|
this.label ??
|
|
@@ -137,7 +137,7 @@ export default class CodelistInsertComponent extends Component<Args> {
|
|
|
137
137
|
],
|
|
138
138
|
},
|
|
139
139
|
this.schema.node('placeholder', {
|
|
140
|
-
placeholderText:
|
|
140
|
+
placeholderText: label,
|
|
141
141
|
}),
|
|
142
142
|
);
|
|
143
143
|
|
|
@@ -41,8 +41,8 @@ export default class DateInsertVariableComponent extends Component<Args> {
|
|
|
41
41
|
|
|
42
42
|
@action
|
|
43
43
|
insert() {
|
|
44
|
-
const mappingResource = `http://data.lblod.info/mappings
|
|
45
|
-
const variableInstance = `http://data.lblod.info/variables
|
|
44
|
+
const mappingResource = `http://data.lblod.info/mappings/--ref-uuid4-${uuidv4()}`;
|
|
45
|
+
const variableInstance = `http://data.lblod.info/variables/--ref-uuid4-${uuidv4()}`;
|
|
46
46
|
|
|
47
47
|
const defaultLabel = this.intl.t('variable.date.label', {
|
|
48
48
|
locale: this.documentLanguage,
|
|
@@ -36,9 +36,8 @@ export default class DateInsertComponent extends Component<Args> {
|
|
|
36
36
|
|
|
37
37
|
@action
|
|
38
38
|
insert() {
|
|
39
|
-
const mappingResource = `http://data.lblod.info/mappings
|
|
40
|
-
|
|
41
|
-
const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
|
|
39
|
+
const mappingResource = `http://data.lblod.info/mappings/--ref-uuid4-${uuidv4()}`;
|
|
40
|
+
const variableInstance = `http://data.lblod.info/variables/--ref-uuid4-${uuidv4()}`;
|
|
42
41
|
const defaultLabel = this.intl.t('variable.date.label', {
|
|
43
42
|
locale: this.documentLanguage,
|
|
44
43
|
});
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
{{! @glint-nocheck: not typesafe yet }}
|
|
2
|
-
<AuPill
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
{{on 'click' @selectNode}}
|
|
7
|
-
>
|
|
8
|
-
{{this.humanReadableDate}}
|
|
9
|
-
{{#if this.label}}
|
|
10
|
-
<span class='label'>
|
|
11
|
-
({{this.label}})
|
|
12
|
-
</span>
|
|
13
|
-
{{/if}}
|
|
2
|
+
<AuPill class='say-pill atomic' {{on 'click' @selectNode}}>
|
|
3
|
+
<span class='{{unless this.filled "unfilled-variable"}}'>
|
|
4
|
+
{{this.humanReadableDate}}
|
|
5
|
+
</span>
|
|
14
6
|
</AuPill>
|
|
@@ -5,15 +5,12 @@ import {
|
|
|
5
5
|
SayController,
|
|
6
6
|
SayView,
|
|
7
7
|
} from '@lblod/ember-rdfa-editor';
|
|
8
|
-
import IntlService from 'ember-intl/services/intl';
|
|
9
|
-
import { service } from '@ember/service';
|
|
10
8
|
import {
|
|
11
9
|
formatDate,
|
|
12
10
|
validateDateFormat,
|
|
13
11
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/date-helpers';
|
|
14
12
|
import { getOutgoingTriple } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
|
|
15
13
|
import { EXT } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
16
|
-
import { PencilIcon } from '@appuniversum/ember-appuniversum/components/icons/pencil';
|
|
17
14
|
|
|
18
15
|
type Args = {
|
|
19
16
|
getPos: () => number | undefined;
|
|
@@ -26,16 +23,10 @@ type Args = {
|
|
|
26
23
|
};
|
|
27
24
|
|
|
28
25
|
export default class DateNodeviewComponent extends Component<Args> {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
get controller() {
|
|
34
|
-
return this.args.controller;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
get documentLanguage() {
|
|
38
|
-
return this.controller.documentLanguage;
|
|
26
|
+
get filled() {
|
|
27
|
+
const value = getOutgoingTriple(this.args.node.attrs, EXT('content'))
|
|
28
|
+
?.object.value;
|
|
29
|
+
return !!value;
|
|
39
30
|
}
|
|
40
31
|
|
|
41
32
|
get humanReadableDate() {
|
|
@@ -49,20 +40,11 @@ export default class DateNodeviewComponent extends Component<Args> {
|
|
|
49
40
|
return 'Ongeldig formaat';
|
|
50
41
|
}
|
|
51
42
|
} else {
|
|
52
|
-
return
|
|
53
|
-
? this.intl.t('date-plugin.insert.date', {
|
|
54
|
-
locale: this.documentLanguage,
|
|
55
|
-
})
|
|
56
|
-
: this.intl.t('date-plugin.insert.datetime', {
|
|
57
|
-
locale: this.documentLanguage,
|
|
58
|
-
});
|
|
43
|
+
return this.label;
|
|
59
44
|
}
|
|
60
45
|
}
|
|
61
46
|
|
|
62
47
|
get label() {
|
|
63
|
-
const value = getOutgoingTriple(this.args.node.attrs, EXT('content'))
|
|
64
|
-
?.object.value;
|
|
65
|
-
if (value) return '';
|
|
66
48
|
return getOutgoingTriple(this.args.node.attrs, EXT('label'))?.object.value;
|
|
67
49
|
}
|
|
68
50
|
}
|
|
@@ -44,22 +44,24 @@ export default class LocationInsertComponent extends Component<Args> {
|
|
|
44
44
|
|
|
45
45
|
@action
|
|
46
46
|
insert() {
|
|
47
|
-
const mappingResource = `http://data.lblod.info/mappings
|
|
48
|
-
const variableInstance = `http://data.lblod.info/variables
|
|
47
|
+
const mappingResource = `http://data.lblod.info/mappings/--ref-uuid4-${uuidv4()}`;
|
|
48
|
+
const variableInstance = `http://data.lblod.info/variables/--ref-uuid4-${uuidv4()}`;
|
|
49
49
|
|
|
50
50
|
const placeholder = this.intl.t('variable.location.label', {
|
|
51
51
|
locale: this.documentLanguage,
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
+
const label = this.label ?? placeholder;
|
|
55
|
+
|
|
54
56
|
const node = this.schema.nodes.location.create(
|
|
55
57
|
{
|
|
56
58
|
mappingResource,
|
|
57
59
|
variableInstance,
|
|
58
|
-
label:
|
|
60
|
+
label: label,
|
|
59
61
|
source: this.endpoint,
|
|
60
62
|
},
|
|
61
63
|
this.schema.node('placeholder', {
|
|
62
|
-
placeholderText:
|
|
64
|
+
placeholderText: label,
|
|
63
65
|
}),
|
|
64
66
|
);
|
|
65
67
|
|
|
@@ -85,9 +85,9 @@ export default class NumberInsertComponent extends Component<Args> {
|
|
|
85
85
|
insert() {
|
|
86
86
|
if (this.numberVariableError !== '') return;
|
|
87
87
|
|
|
88
|
-
const mappingResource = `http://data.lblod.info/mappings
|
|
88
|
+
const mappingResource = `http://data.lblod.info/mappings/--ref-uuid4-${uuidv4()}`;
|
|
89
|
+
const variableInstance = `http://data.lblod.info/variables/--ref-uuid4-${uuidv4()}`;
|
|
89
90
|
const subject = mappingResource;
|
|
90
|
-
const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
|
|
91
91
|
|
|
92
92
|
const defaultLabel = this.intl.t('variable.number.label', {
|
|
93
93
|
locale: this.documentLanguage,
|
|
@@ -4,25 +4,10 @@
|
|
|
4
4
|
@offsetOptions={{hash mainAxis=3}}
|
|
5
5
|
as |velcro|
|
|
6
6
|
>
|
|
7
|
-
<AuPill
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
{{velcro.hook}}
|
|
12
|
-
{{on 'click' @selectNode}}
|
|
13
|
-
>
|
|
14
|
-
{{#if this.formattedNumber}}
|
|
15
|
-
{{this.formattedNumber}}
|
|
16
|
-
{{else}}
|
|
17
|
-
<span class='mark-highlight-manual'>
|
|
18
|
-
{{this.translations.placeholder}}
|
|
19
|
-
</span>
|
|
20
|
-
{{/if}}
|
|
21
|
-
{{#if this.label}}
|
|
22
|
-
<span class='label'>
|
|
23
|
-
({{this.label}})
|
|
24
|
-
</span>
|
|
25
|
-
{{/if}}
|
|
7
|
+
<AuPill class='say-pill atomic' {{velcro.hook}} {{on 'click' @selectNode}}>
|
|
8
|
+
<span class='{{unless this.filled "unfilled-variable"}}'>
|
|
9
|
+
{{this.content}}
|
|
10
|
+
</span>
|
|
26
11
|
</AuPill>
|
|
27
12
|
{{#if this.selected}}
|
|
28
13
|
<div class='say-tooltip say-number-tooltip' {{velcro.loop}}>
|
|
@@ -17,7 +17,6 @@ import { isNumber } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/strings';
|
|
|
17
17
|
import { numberToWords } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/number-to-words';
|
|
18
18
|
import { EXT } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
19
19
|
import { getOutgoingTriple } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
|
|
20
|
-
import { PencilIcon } from '@appuniversum/ember-appuniversum/components/icons/pencil';
|
|
21
20
|
|
|
22
21
|
type Args = {
|
|
23
22
|
getPos: () => number | undefined;
|
|
@@ -31,7 +30,6 @@ type Args = {
|
|
|
31
30
|
};
|
|
32
31
|
|
|
33
32
|
export default class NumberNodeviewComponent extends Component<Args> {
|
|
34
|
-
PencilIcon = PencilIcon;
|
|
35
33
|
Velcro = Velcro;
|
|
36
34
|
|
|
37
35
|
@localCopy('number', '') declare inputNumber: string;
|
|
@@ -52,14 +50,6 @@ export default class NumberNodeviewComponent extends Component<Args> {
|
|
|
52
50
|
return this.controller.documentLanguage;
|
|
53
51
|
}
|
|
54
52
|
|
|
55
|
-
get translations() {
|
|
56
|
-
return {
|
|
57
|
-
placeholder: this.intl.t('variable.number.placeholder', {
|
|
58
|
-
locale: this.documentLanguage,
|
|
59
|
-
}),
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
53
|
get node() {
|
|
64
54
|
return this.args.node;
|
|
65
55
|
}
|
|
@@ -80,6 +70,18 @@ export default class NumberNodeviewComponent extends Component<Args> {
|
|
|
80
70
|
}
|
|
81
71
|
}
|
|
82
72
|
|
|
73
|
+
get filled() {
|
|
74
|
+
return !!this.formattedNumber;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
get content() {
|
|
78
|
+
if (this.filled) {
|
|
79
|
+
return this.formattedNumber;
|
|
80
|
+
} else {
|
|
81
|
+
return this.label;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
83
85
|
get selected() {
|
|
84
86
|
return this.args.selected;
|
|
85
87
|
}
|
|
@@ -40,8 +40,8 @@ export default class PersonVariableInsertComponent extends Component<Args> {
|
|
|
40
40
|
|
|
41
41
|
@action
|
|
42
42
|
insert() {
|
|
43
|
-
const mappingSubject = `http://data.lblod.info/mappings
|
|
44
|
-
const variableInstance = `http://data.lblod.info/variables
|
|
43
|
+
const mappingSubject = `http://data.lblod.info/mappings/--ref-uuid4-${uuidv4()}`;
|
|
44
|
+
const variableInstance = `http://data.lblod.info/variables/--ref-uuid4-${uuidv4()}`;
|
|
45
45
|
const variableId = uuidv4();
|
|
46
46
|
|
|
47
47
|
const placeholder = this.intl.t('variable.person.label', {
|
|
@@ -1,20 +1,6 @@
|
|
|
1
1
|
{{! @glint-nocheck: not typesafe yet }}
|
|
2
|
-
<AuPill
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
{{on 'click' @selectNode}}
|
|
7
|
-
>
|
|
8
|
-
{{#if this.mandatee}}
|
|
9
|
-
{{this.mandatee.fullName}}
|
|
10
|
-
{{else}}
|
|
11
|
-
<span class='mark-highlight-manual'>
|
|
12
|
-
{{this.translations.placeholder}}
|
|
13
|
-
</span>
|
|
14
|
-
{{/if}}
|
|
15
|
-
{{#if this.label}}
|
|
16
|
-
<span class='label'>
|
|
17
|
-
({{this.label}})
|
|
18
|
-
</span>
|
|
19
|
-
{{/if}}
|
|
2
|
+
<AuPill class='say-pill atomic' {{on 'click' @selectNode}}>
|
|
3
|
+
<span class='{{unless this.filled "unfilled-variable"}}'>
|
|
4
|
+
{{this.content}}
|
|
5
|
+
</span>
|
|
20
6
|
</AuPill>
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
|
-
import { service } from '@ember/service';
|
|
3
|
-
import IntlService from 'ember-intl/services/intl';
|
|
4
|
-
import { PencilIcon } from '@appuniversum/ember-appuniversum/components/icons/pencil';
|
|
5
2
|
|
|
6
3
|
import { PNode, SayController } from '@lblod/ember-rdfa-editor';
|
|
7
4
|
import { getOutgoingTriple } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
|
|
@@ -15,26 +12,10 @@ type Args = {
|
|
|
15
12
|
};
|
|
16
13
|
|
|
17
14
|
export default class PersonNodeviewComponent extends Component<Args> {
|
|
18
|
-
PencilIcon = PencilIcon;
|
|
19
|
-
|
|
20
|
-
@service declare intl: IntlService;
|
|
21
|
-
|
|
22
15
|
get controller() {
|
|
23
16
|
return this.args.controller;
|
|
24
17
|
}
|
|
25
18
|
|
|
26
|
-
get documentLanguage() {
|
|
27
|
-
return this.controller.documentLanguage;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
get translations() {
|
|
31
|
-
return {
|
|
32
|
-
placeholder: this.intl.t('variable-plugin.person.nodeview-placeholder', {
|
|
33
|
-
locale: this.documentLanguage,
|
|
34
|
-
}),
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
19
|
get node() {
|
|
39
20
|
return this.args.node;
|
|
40
21
|
}
|
|
@@ -47,4 +28,16 @@ export default class PersonNodeviewComponent extends Component<Args> {
|
|
|
47
28
|
if (this.mandatee) return '';
|
|
48
29
|
return getOutgoingTriple(this.node.attrs, EXT('label'))?.object.value;
|
|
49
30
|
}
|
|
31
|
+
|
|
32
|
+
get filled() {
|
|
33
|
+
return !!this.mandatee;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
get content() {
|
|
37
|
+
if (this.filled) {
|
|
38
|
+
return this.mandatee?.fullName;
|
|
39
|
+
} else {
|
|
40
|
+
return this.label;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
50
43
|
}
|
|
@@ -40,8 +40,8 @@ export default class TextVariableInsertComponent extends Component<Args> {
|
|
|
40
40
|
|
|
41
41
|
@action
|
|
42
42
|
insert() {
|
|
43
|
-
const mappingSubject = `http://data.lblod.info/mappings
|
|
44
|
-
const variableInstance = `http://data.lblod.info/variables
|
|
43
|
+
const mappingSubject = `http://data.lblod.info/mappings/--ref-uuid4-${uuidv4()}`;
|
|
44
|
+
const variableInstance = `http://data.lblod.info/variables/--ref-uuid4-${uuidv4()}`;
|
|
45
45
|
const variableId = uuidv4();
|
|
46
46
|
|
|
47
47
|
const placeholder = this.intl.t('variable.text.label', {
|
|
@@ -78,7 +78,7 @@ export default class TextVariableInsertComponent extends Component<Args> {
|
|
|
78
78
|
],
|
|
79
79
|
},
|
|
80
80
|
this.schema.node('placeholder', {
|
|
81
|
-
placeholderText:
|
|
81
|
+
placeholderText: label,
|
|
82
82
|
}),
|
|
83
83
|
);
|
|
84
84
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{{! @glint-nocheck: not typesafe yet }}
|
|
2
2
|
<AuPill
|
|
3
|
-
|
|
4
|
-
@iconAlignment='right'
|
|
5
|
-
class='variable'
|
|
3
|
+
class='say-pill'
|
|
6
4
|
{{on 'click' this.onClick}}
|
|
5
|
+
{{on 'focusout' this.resetVariable}}
|
|
7
6
|
>
|
|
8
7
|
<EmberNode::EmbeddedEditor
|
|
9
8
|
@controller={{@controller}}
|
|
@@ -17,9 +16,4 @@
|
|
|
17
16
|
@decorations={{@decorations}}
|
|
18
17
|
@contentDecorations={{@contentDecorations}}
|
|
19
18
|
/>
|
|
20
|
-
{{#if this.label}}
|
|
21
|
-
<span class='label'>
|
|
22
|
-
({{this.label}})
|
|
23
|
-
</span>
|
|
24
|
-
{{/if}}
|
|
25
19
|
</AuPill>
|
|
@@ -3,15 +3,12 @@ import { NodeSelection, ProsePlugin, SayView } from '@lblod/ember-rdfa-editor';
|
|
|
3
3
|
import { editableNodePlugin } from '@lblod/ember-rdfa-editor/plugins/editable-node';
|
|
4
4
|
import { tracked } from '@glimmer/tracking';
|
|
5
5
|
import { action } from '@ember/object';
|
|
6
|
-
import { PencilIcon } from '@appuniversum/ember-appuniversum/components/icons/pencil';
|
|
7
6
|
|
|
8
7
|
import { EmberNodeArgs } from '@lblod/ember-rdfa-editor/utils/ember-node';
|
|
9
8
|
import { getOutgoingTriple } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
|
|
10
9
|
import { EXT } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
11
10
|
|
|
12
11
|
export default class VariableNodeViewComponent extends Component<EmberNodeArgs> {
|
|
13
|
-
PencilIcon = PencilIcon;
|
|
14
|
-
|
|
15
12
|
@tracked innerView?: SayView;
|
|
16
13
|
|
|
17
14
|
get plugins(): ProsePlugin[] {
|
|
@@ -39,11 +36,23 @@ export default class VariableNodeViewComponent extends Component<EmberNodeArgs>
|
|
|
39
36
|
initEditor(view: SayView) {
|
|
40
37
|
this.innerView = view;
|
|
41
38
|
}
|
|
42
|
-
|
|
39
|
+
@action
|
|
40
|
+
resetVariable() {
|
|
41
|
+
if (this.innerView && this.innerView.state.doc.childCount === 0) {
|
|
42
|
+
const tr = this.innerView.state.tr;
|
|
43
|
+
const placeholderNode = this.innerView.state.schema.node('placeholder', {
|
|
44
|
+
placeholderText: this.label,
|
|
45
|
+
});
|
|
46
|
+
tr.insert(0, placeholderNode);
|
|
47
|
+
this.innerView?.dispatch(tr);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
43
50
|
get label() {
|
|
44
|
-
|
|
45
|
-
|
|
51
|
+
const labelTriple = getOutgoingTriple(this.args.node.attrs, EXT('label'));
|
|
52
|
+
if (labelTriple) {
|
|
53
|
+
return labelTriple.object.value;
|
|
54
|
+
} else {
|
|
55
|
+
return this.args.node.attrs.label;
|
|
46
56
|
}
|
|
47
|
-
return getOutgoingTriple(this.args.node.attrs, EXT('label'))?.object.value;
|
|
48
57
|
}
|
|
49
58
|
}
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
parseVariableInstance,
|
|
23
23
|
parseVariableType,
|
|
24
24
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/variable-attribute-parsers';
|
|
25
|
-
import
|
|
25
|
+
import NodeViewComponent from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/variable/nodeview';
|
|
26
26
|
import type { ComponentLike } from '@glint/template';
|
|
27
27
|
import { hasOutgoingNamedNodeTriple } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
|
|
28
28
|
import { renderRdfaAware } from '@lblod/ember-rdfa-editor/core/schema';
|
|
@@ -139,7 +139,7 @@ const toDOM = (node: PNode): DOMOutputSpec => {
|
|
|
139
139
|
|
|
140
140
|
const emberNodeConfig: EmberNodeConfig = {
|
|
141
141
|
name: 'autofilled-variable',
|
|
142
|
-
component:
|
|
142
|
+
component: NodeViewComponent as unknown as ComponentLike,
|
|
143
143
|
inline: true,
|
|
144
144
|
group: 'inline variable',
|
|
145
145
|
content: 'inline*',
|