@lblod/ember-rdfa-editor-lblod-plugins 1.0.0-beta.1 → 1.0.0-beta.2
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 +29 -0
- package/addon/components/article-structure-plugin/article-structure-card.hbs +3 -1
- package/addon/components/au-dropdown-pill.hbs +32 -0
- package/addon/components/au-dropdown-pill.ts +65 -0
- package/addon/components/besluit-type-plugin/toolbar-dropdown.ts +19 -12
- package/addon/components/citation-plugin/citation-card.ts +1 -1
- package/addon/components/citation-plugin/citation-insert.ts +1 -1
- package/addon/components/import-snippet-plugin/card.ts +8 -12
- package/addon/components/rdfa-date-plugin/card.hbs +28 -0
- package/addon/components/rdfa-date-plugin/card.ts +72 -38
- package/addon/components/rdfa-date-plugin/date-time-picker.ts +1 -0
- package/addon/components/rdfa-date-plugin/insert.hbs +2 -2
- package/addon/components/rdfa-date-plugin/insert.ts +14 -23
- package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.ts +24 -25
- package/addon/components/roadsign-regulation-plugin/roadsigns-modal.ts +36 -17
- package/addon/components/standard-template-plugin/template-provider.ts +54 -11
- package/addon/components/{insert-variable-plugin → variable-plugin}/insert-variable-card.hbs +4 -4
- package/addon/components/{insert-variable-plugin → variable-plugin}/insert-variable-card.ts +26 -35
- package/addon/components/{template-variable-plugin → variable-plugin}/template-variable-card.hbs +6 -6
- package/addon/components/variable-plugin/template-variable-card.ts +174 -0
- package/addon/components/variable-plugin/variable.hbs +4 -0
- package/addon/components/variable-plugin/variable.ts +250 -0
- package/addon/plugins/article-structure-plugin/commands/insert-structure.ts +4 -2
- package/addon/plugins/article-structure-plugin/index.ts +1 -1
- package/addon/plugins/article-structure-plugin/structures/article-paragraph.ts +6 -2
- package/addon/plugins/article-structure-plugin/structures/article.ts +1 -1
- package/addon/plugins/article-structure-plugin/structures/chapter.ts +1 -2
- package/addon/plugins/article-structure-plugin/structures/section.ts +1 -1
- package/addon/plugins/article-structure-plugin/structures/subsection.ts +1 -1
- package/addon/plugins/article-structure-plugin/structures/title.ts +1 -2
- package/addon/plugins/citation-plugin/index.ts +184 -113
- package/addon/plugins/rdfa-date-plugin/index.ts +42 -3
- package/addon/plugins/rdfa-date-plugin/nodes/date.ts +127 -0
- package/addon/plugins/rdfa-date-plugin/nodes/index.ts +1 -0
- package/addon/plugins/rdfa-date-plugin/utils.ts +10 -0
- package/addon/plugins/roadsign-regulation-plugin/nodes.ts +107 -0
- package/addon/plugins/standard-template-plugin/index.ts +26 -0
- package/addon/plugins/standard-template-plugin/utils/nodes.ts +366 -0
- package/addon/plugins/{insert-variable-plugin → variable-plugin}/index.ts +6 -1
- package/addon/plugins/variable-plugin/nodes.ts +137 -0
- package/addon/plugins/variable-plugin/utils/constants.ts +107 -0
- package/addon/plugins/{template-variable-plugin → variable-plugin}/utils/fetch-data.ts +41 -0
- package/addon/services/standard-template-plugin.ts +16 -12
- package/addon/utils/changed-descendants.ts +29 -0
- package/addon/utils/constants.ts +11 -0
- package/addon/utils/namespace.ts +42 -7
- package/app/components/au-dropdown-pill.js +1 -0
- package/app/components/{insert-variable-plugin → variable-plugin}/insert-variable-card.js +1 -1
- package/app/components/{template-variable-plugin → variable-plugin}/template-variable-card.js +1 -1
- package/app/components/variable-plugin/variable-edit-modal.js +1 -0
- package/app/components/variable-plugin/variable.js +1 -0
- package/app/styles/date-plugin.scss +17 -0
- package/app/styles/variable-plugin.scss +65 -0
- package/components/au-dropdown-pill.d.ts +19 -0
- package/components/au-native-input.d.ts +1 -1
- package/components/citation-plugin/citation-card.d.ts +1 -1
- package/components/rdfa-date-plugin/card.d.ts +14 -5
- package/components/rdfa-date-plugin/insert.d.ts +1 -2
- package/components/roadsign-regulation-plugin/roadsign-regulation-card.d.ts +1 -0
- package/components/roadsign-regulation-plugin/roadsigns-modal.d.ts +3 -0
- package/components/standard-template-plugin/template-provider.d.ts +6 -1
- package/components/{insert-variable-plugin → variable-plugin}/insert-variable-card.d.ts +3 -4
- package/components/{template-variable-plugin → variable-plugin}/template-variable-card.d.ts +8 -5
- package/components/variable-plugin/variable.d.ts +42 -0
- package/package.json +4 -4
- package/plugins/article-structure-plugin/commands/insert-structure.d.ts +2 -2
- package/plugins/article-structure-plugin/index.d.ts +1 -1
- package/plugins/citation-plugin/index.d.ts +11 -4
- package/plugins/rdfa-date-plugin/index.d.ts +13 -1
- package/plugins/rdfa-date-plugin/nodes/date.d.ts +9 -0
- package/plugins/rdfa-date-plugin/nodes/index.d.ts +1 -0
- package/plugins/rdfa-date-plugin/utils.d.ts +1 -0
- package/plugins/roadsign-regulation-plugin/nodes.d.ts +2 -0
- package/plugins/standard-template-plugin/index.d.ts +12 -0
- package/plugins/standard-template-plugin/utils/nodes.d.ts +12 -0
- package/plugins/{insert-variable-plugin → variable-plugin}/index.d.ts +1 -0
- package/plugins/variable-plugin/nodes.d.ts +2 -0
- package/plugins/variable-plugin/utils/constants.d.ts +9 -0
- package/plugins/{template-variable-plugin → variable-plugin}/utils/fetch-data.d.ts +5 -0
- package/services/standard-template-plugin.d.ts +9 -10
- package/translations/en-US.yaml +4 -3
- package/translations/nl-BE.yaml +5 -4
- package/utils/changed-descendants.d.ts +2 -0
- package/utils/constants.d.ts +5 -0
- package/utils/namespace.d.ts +8 -3
- package/addon/components/template-variable-plugin/template-variable-card.ts +0 -227
- package/addon/plugins/insert-variable-plugin/utils/constants.ts +0 -67
- package/addon/plugins/insert-variable-plugin/utils/fetch-data.ts +0 -41
- package/addon/plugins/rdfa-date-plugin/commands/index.ts +0 -1
- package/addon/plugins/rdfa-date-plugin/commands/modify-date.ts +0 -48
- package/addon/plugins/template-variable-plugin/index.ts +0 -6
- package/addon/plugins/template-variable-plugin/utils/constants.ts +0 -2
- package/plugins/insert-variable-plugin/utils/constants.d.ts +0 -7
- package/plugins/insert-variable-plugin/utils/fetch-data.d.ts +0 -5
- package/plugins/rdfa-date-plugin/commands/index.d.ts +0 -1
- package/plugins/rdfa-date-plugin/commands/modify-date.d.ts +0 -2
- package/plugins/template-variable-plugin/index.d.ts +0 -2
- package/plugins/template-variable-plugin/utils/constants.d.ts +0 -1
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { PNode, Schema } from '@lblod/ember-rdfa-editor';
|
|
2
|
+
import { CodeList, fetchCodeListsByPublisher } from './fetch-data';
|
|
3
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
4
|
+
import { XSD } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
5
|
+
import { unwrap } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
|
|
6
|
+
|
|
7
|
+
export const MULTI_SELECT_CODELIST_TYPE =
|
|
8
|
+
'http://lblod.data.gift/concepts/57C93E12-A02C-4D4B-8B95-666B6701286C';
|
|
9
|
+
|
|
10
|
+
export type VariableType = {
|
|
11
|
+
label: string;
|
|
12
|
+
fetchSubtypes?: (endpoint: string, publisher: string) => Promise<CodeList[]>;
|
|
13
|
+
constructor: (
|
|
14
|
+
schema: Schema,
|
|
15
|
+
endpoint?: string,
|
|
16
|
+
selectedCodelist?: CodeList
|
|
17
|
+
) => PNode;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const DEFAULT_VARIABLE_TYPES: Record<string, VariableType> = {
|
|
21
|
+
text: {
|
|
22
|
+
label: 'text',
|
|
23
|
+
constructor: (schema) => {
|
|
24
|
+
const mappingURI = `http://data.lblod.info/mappings/${uuidv4()}`;
|
|
25
|
+
const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
|
|
26
|
+
return schema.node(
|
|
27
|
+
'variable',
|
|
28
|
+
{
|
|
29
|
+
mappingResource: mappingURI,
|
|
30
|
+
variableInstance,
|
|
31
|
+
type: 'text',
|
|
32
|
+
},
|
|
33
|
+
schema.node('placeholder', { placeholderText: 'text' })
|
|
34
|
+
);
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
number: {
|
|
38
|
+
label: 'number',
|
|
39
|
+
constructor: (schema) => {
|
|
40
|
+
const mappingURI = `http://data.lblod.info/mappings/${uuidv4()}`;
|
|
41
|
+
const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
|
|
42
|
+
return schema.node(
|
|
43
|
+
'variable',
|
|
44
|
+
{
|
|
45
|
+
mappingResource: mappingURI,
|
|
46
|
+
variableInstance,
|
|
47
|
+
type: 'number',
|
|
48
|
+
datatype: XSD('integer').prefixed,
|
|
49
|
+
},
|
|
50
|
+
schema.node('placeholder', { placeholderText: 'number' })
|
|
51
|
+
);
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
date: {
|
|
55
|
+
label: 'date',
|
|
56
|
+
constructor: (schema) => {
|
|
57
|
+
return unwrap(
|
|
58
|
+
schema.nodes.date.createAndFill({
|
|
59
|
+
mappingResource: `http://data.lblod.info/mappings/${uuidv4()}`,
|
|
60
|
+
})
|
|
61
|
+
);
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
location: {
|
|
65
|
+
label: 'location',
|
|
66
|
+
constructor: (schema, endpoint) => {
|
|
67
|
+
const mappingURI = `http://data.lblod.info/mappings/${uuidv4()}`;
|
|
68
|
+
const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
|
|
69
|
+
return schema.node(
|
|
70
|
+
'variable',
|
|
71
|
+
{
|
|
72
|
+
type: 'location',
|
|
73
|
+
mappingResource: mappingURI,
|
|
74
|
+
variableInstance,
|
|
75
|
+
source: endpoint,
|
|
76
|
+
},
|
|
77
|
+
schema.node('placeholder', {
|
|
78
|
+
placeholderText: 'location',
|
|
79
|
+
})
|
|
80
|
+
);
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
codelist: {
|
|
84
|
+
label: 'codelist',
|
|
85
|
+
fetchSubtypes: async (endpoint: string, publisher: string) => {
|
|
86
|
+
const codelists = fetchCodeListsByPublisher(endpoint, publisher);
|
|
87
|
+
return codelists;
|
|
88
|
+
},
|
|
89
|
+
constructor: (schema, endpoint, selectedCodelist?: CodeList) => {
|
|
90
|
+
const mappingURI = `http://data.lblod.info/mappings/${uuidv4()}`;
|
|
91
|
+
const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
|
|
92
|
+
return schema.node(
|
|
93
|
+
'variable',
|
|
94
|
+
{
|
|
95
|
+
type: 'codelist',
|
|
96
|
+
mappingResource: mappingURI,
|
|
97
|
+
codelistResource: selectedCodelist?.uri,
|
|
98
|
+
variableInstance,
|
|
99
|
+
source: endpoint,
|
|
100
|
+
},
|
|
101
|
+
schema.node('placeholder', {
|
|
102
|
+
placeholderText: selectedCodelist?.label ?? '',
|
|
103
|
+
})
|
|
104
|
+
);
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
};
|
|
@@ -60,3 +60,44 @@ function parseCodelistOptions(queryResult: QueryResult): CodeListOption[] {
|
|
|
60
60
|
label: binding['label']?.value,
|
|
61
61
|
}));
|
|
62
62
|
}
|
|
63
|
+
|
|
64
|
+
export type CodeList = {
|
|
65
|
+
uri?: string;
|
|
66
|
+
label?: string;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
function generateCodeListsByPublisherQuery(publisher: string): string {
|
|
70
|
+
const codeListOptionsQuery = `
|
|
71
|
+
PREFIX lblodMobilitiet: <http://data.lblod.info/vocabularies/mobiliteit/>
|
|
72
|
+
PREFIX dct: <http://purl.org/dc/terms/>
|
|
73
|
+
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
|
|
74
|
+
PREFIX mu: <http://mu.semte.ch/vocabularies/core/>
|
|
75
|
+
SELECT DISTINCT * WHERE {
|
|
76
|
+
?uri a lblodMobilitiet:Codelist;
|
|
77
|
+
skos:prefLabel ?label.
|
|
78
|
+
${
|
|
79
|
+
publisher
|
|
80
|
+
? `
|
|
81
|
+
?uri dct:publisher <${publisher}>.
|
|
82
|
+
`
|
|
83
|
+
: ''
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
`;
|
|
87
|
+
return codeListOptionsQuery;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export async function fetchCodeListsByPublisher(
|
|
91
|
+
endpoint: string,
|
|
92
|
+
publisher: string
|
|
93
|
+
): Promise<CodeList[]> {
|
|
94
|
+
const codelistsOptionsQueryResult = await executeQuery(
|
|
95
|
+
endpoint,
|
|
96
|
+
generateCodeListsByPublisherQuery(publisher)
|
|
97
|
+
);
|
|
98
|
+
const bindings = codelistsOptionsQueryResult.results.bindings;
|
|
99
|
+
return bindings.map((binding) => ({
|
|
100
|
+
uri: binding['uri']?.value,
|
|
101
|
+
label: binding['label']?.value,
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import Store from '@ember-data/store';
|
|
2
2
|
// eslint-disable-next-line ember/use-ember-data-rfc-395-imports
|
|
3
|
-
import { DS } from 'ember-data';
|
|
4
3
|
import Service, { inject as service } from '@ember/service';
|
|
5
|
-
import { task,
|
|
4
|
+
import { task, Task, waitForProperty } from 'ember-concurrency';
|
|
6
5
|
import { tracked } from '@glimmer/tracking';
|
|
7
6
|
import TemplateModel from '../models/template';
|
|
8
7
|
|
|
8
|
+
const BLACKLISTED_TEMPLATES = new Set(['Citeeropschrift']);
|
|
9
|
+
|
|
9
10
|
export default class StandardTemplatePluginService extends Service {
|
|
10
11
|
@service declare store: Store;
|
|
11
|
-
@tracked declare templates:
|
|
12
|
+
@tracked declare templates: TemplateModel[];
|
|
12
13
|
|
|
13
14
|
constructor() {
|
|
14
15
|
// eslint-disable-next-line prefer-rest-params
|
|
@@ -16,7 +17,7 @@ export default class StandardTemplatePluginService extends Service {
|
|
|
16
17
|
void this.loadTemplates();
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
fetchTemplates: Task<
|
|
20
|
+
fetchTemplates: Task<TemplateModel[], []> = task(async () => {
|
|
20
21
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
21
22
|
// @ts-ignore
|
|
22
23
|
await waitForProperty(this, 'templates');
|
|
@@ -24,19 +25,22 @@ export default class StandardTemplatePluginService extends Service {
|
|
|
24
25
|
});
|
|
25
26
|
|
|
26
27
|
async loadTemplates() {
|
|
27
|
-
|
|
28
|
+
const templates = await this.store.query('template', {
|
|
28
29
|
fields: { templates: 'title,contexts,matches,disabled-in-contexts' },
|
|
29
30
|
});
|
|
31
|
+
this.templates = templates.filter(
|
|
32
|
+
(template) => !BLACKLISTED_TEMPLATES.has(template.title)
|
|
33
|
+
);
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
Filter the valid templates for a context.
|
|
38
|
+
@method templatesForContext
|
|
39
|
+
@param {Array} Array of templates
|
|
40
|
+
@param {Array} The path of rdfaContext objects from the root till the current context
|
|
41
|
+
@return {Array} Array of templates (filtered)
|
|
42
|
+
@private
|
|
43
|
+
*/
|
|
40
44
|
templatesForContext(templates: TemplateModel[], rdfaTypes: string[]) {
|
|
41
45
|
const isMatchingForContext = (template: TemplateModel) => {
|
|
42
46
|
return (
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PNode } from '@lblod/ember-rdfa-editor';
|
|
2
|
+
|
|
3
|
+
// from https://github.com/ProseMirror/prosemirror-tables/blob/8ec1e96ae994c1585b07b1ca9dc3292f63e868e0/src/fixtables.ts#L24
|
|
4
|
+
export function changedDescendants(
|
|
5
|
+
old: PNode,
|
|
6
|
+
cur: PNode,
|
|
7
|
+
offset: number,
|
|
8
|
+
f: (node: PNode, pos: number) => void
|
|
9
|
+
): void {
|
|
10
|
+
const oldSize = old.childCount;
|
|
11
|
+
const curSize = cur.childCount;
|
|
12
|
+
outer: for (let i = 0, j = 0; i < curSize; i++) {
|
|
13
|
+
const child = cur.child(i);
|
|
14
|
+
for (let scan = j, e = Math.min(oldSize, i + 3); scan < e; scan++) {
|
|
15
|
+
if (old.child(scan) === child) {
|
|
16
|
+
j = scan + 1;
|
|
17
|
+
offset += child.nodeSize;
|
|
18
|
+
continue outer;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
f(child, offset);
|
|
22
|
+
if (j < oldSize && old.child(j).sameMarkup(child)) {
|
|
23
|
+
changedDescendants(old.child(j), child, offset + 1, f);
|
|
24
|
+
} else {
|
|
25
|
+
child.nodesBetween(0, child.content.size, f, offset + 1);
|
|
26
|
+
}
|
|
27
|
+
offset += child.nodeSize;
|
|
28
|
+
}
|
|
29
|
+
}
|
package/addon/utils/constants.ts
CHANGED
|
@@ -9,3 +9,14 @@ export const RDF = namespace(
|
|
|
9
9
|
export const ELI = namespace('http://data.europa.eu/eli/ontology#', 'eli');
|
|
10
10
|
export const XSD = namespace('http://www.w3.org/2001/XMLSchema#', 'xsd');
|
|
11
11
|
export const EXT = namespace('http://mu.semte.ch/vocabularies/ext/', 'ext');
|
|
12
|
+
export const BESLUIT = namespace(
|
|
13
|
+
'http://data.vlaanderen.be/ns/besluit#',
|
|
14
|
+
'besluit'
|
|
15
|
+
);
|
|
16
|
+
export const PROV = namespace('http://www.w3.org/ns/prov#', 'prov');
|
|
17
|
+
export const SKOS = namespace('http://www.w3.org/2004/02/skos/core#', 'skos');
|
|
18
|
+
export const DCT = namespace('http://purl.org/dc/terms/', 'dct');
|
|
19
|
+
export const MOBILITEIT = namespace(
|
|
20
|
+
'https://data.vlaanderen.be/ns/mobiliteit#',
|
|
21
|
+
'mobiliteit'
|
|
22
|
+
);
|
package/addon/utils/namespace.ts
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { PNode } from '@lblod/ember-rdfa-editor';
|
|
2
|
+
|
|
3
|
+
export class Resource {
|
|
3
4
|
full: string;
|
|
4
|
-
|
|
5
|
+
prefixed: string;
|
|
6
|
+
|
|
7
|
+
constructor(full: string, prefixed: string) {
|
|
8
|
+
this.full = full;
|
|
9
|
+
this.prefixed = prefixed;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
toString() {
|
|
13
|
+
return this.full;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
5
16
|
|
|
6
17
|
export function namespace(uri: string, prefix: string) {
|
|
7
18
|
return (s: string): Resource => {
|
|
8
|
-
return {
|
|
9
|
-
prefixed: prefix && `${prefix}:${s}`,
|
|
10
|
-
full: uri + s,
|
|
11
|
-
};
|
|
19
|
+
return new Resource(uri + s, `${prefix}:${s}`);
|
|
12
20
|
};
|
|
13
21
|
}
|
|
14
22
|
|
|
@@ -23,3 +31,30 @@ export function hasRDFaAttribute(
|
|
|
23
31
|
}
|
|
24
32
|
return false;
|
|
25
33
|
}
|
|
34
|
+
|
|
35
|
+
export function pnodeHasRdfaAttribute(
|
|
36
|
+
node: PNode,
|
|
37
|
+
attr: string,
|
|
38
|
+
value: Resource
|
|
39
|
+
) {
|
|
40
|
+
const result = (node.attrs[attr] as string | null)?.split(' ');
|
|
41
|
+
if (result) {
|
|
42
|
+
return result.includes(value.full) || result.includes(value.prefixed);
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function expandPrefixedString(
|
|
48
|
+
base: string,
|
|
49
|
+
prefix: string,
|
|
50
|
+
stringToExpand: string
|
|
51
|
+
): string {
|
|
52
|
+
if (stringToExpand.startsWith(base)) {
|
|
53
|
+
return stringToExpand;
|
|
54
|
+
} else if (stringToExpand.startsWith(prefix)) {
|
|
55
|
+
const [, affix] = stringToExpand.split(':');
|
|
56
|
+
return base + affix;
|
|
57
|
+
} else {
|
|
58
|
+
return stringToExpand;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/au-dropdown-pill';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/insert-variable-card';
|
package/app/components/{template-variable-plugin → variable-plugin}/template-variable-card.js
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/template-variable-card';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/variable-edit-modal';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/variable';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
span.date {
|
|
3
|
+
border-radius: 0.3rem;
|
|
4
|
+
margin-right: 0.5rem !important;
|
|
5
|
+
padding: 0 0.2rem !important;
|
|
6
|
+
line-height: 1.2rem !important;
|
|
7
|
+
transition: border 0.1s ease-in-out, background-color 0.1s ease-in-out;
|
|
8
|
+
&::selection {
|
|
9
|
+
background-color: var(--au-blue-200);
|
|
10
|
+
}
|
|
11
|
+
user-select: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
span.date.ProseMirror-selectednode {
|
|
15
|
+
background-color: var(--au-blue-200);
|
|
16
|
+
outline: 2px solid var(--au-blue-500);
|
|
17
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
[typeof='ext:Mapping'] + [typeof='ext:Mapping'] {
|
|
2
|
+
margin-left: 0.3rem;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
[typeof='ext:Mapping'] {
|
|
6
|
+
border-bottom: 0 !important;
|
|
7
|
+
|
|
8
|
+
[property],
|
|
9
|
+
.mark-highlight-manual {
|
|
10
|
+
border-bottom: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
[property='ext:content'] {
|
|
14
|
+
border-radius: 0.3rem;
|
|
15
|
+
padding: 0 0.3rem;
|
|
16
|
+
line-height: 1.2rem;
|
|
17
|
+
margin-bottom: 0.3rem;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
[property='dct:type'] ~ [property='ext:content'] {
|
|
21
|
+
color: var(--vl-picton-120);
|
|
22
|
+
border-radius: 0.3rem;
|
|
23
|
+
background-color: rgba(#16465b, 0.15);
|
|
24
|
+
transition: border 0.1s ease-in-out, background-color 0.1s ease-in-out;
|
|
25
|
+
|
|
26
|
+
&:hover,
|
|
27
|
+
&:focus,
|
|
28
|
+
&:focus-within {
|
|
29
|
+
background-color: rgba(#16465b, 0.1);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
[property='dct:type'] ~ [property='ext:content']:after {
|
|
34
|
+
position: relative;
|
|
35
|
+
top: -0.2rem;
|
|
36
|
+
content: '' !important;
|
|
37
|
+
display: inline-block !important;
|
|
38
|
+
width: 1rem;
|
|
39
|
+
height: 1rem;
|
|
40
|
+
margin-left: 0.3rem;
|
|
41
|
+
background-size: contain;
|
|
42
|
+
background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBmaWxsPSIjMTY0NjVCIj48cGF0aCBkPSJNMjAuODMxMTAwMywzLjE4Mzg0MTggQzIwLjQ1OTEwMDMsMi44MDc0MjE4IDIwLjAxNjEwMDMsMi41MDg1NjE4IDE5LjUyNzcwMDMsMi4zMDQ2MDE4IEMxOS4wMzk0MDAzLDIuMTAwNjMxOCAxOC41MTU0MDAzLDEuOTk1NjAxOCAxNy45ODYxMDAzLDEuOTk1NjAxOCBDMTcuNDU2OTAwMywxLjk5NTYwMTggMTYuOTMyOTAwMywyLjEwMDYzMTggMTYuNDQ0NjAwMywyLjMwNDYwMTggQzE1Ljk1NjIwMDMsMi41MDg1NjE4IDE1LjUxMzIwMDMsMi44MDc0MjE4IDE1LjE0MTEwMDMsMy4xODM4NDE4IEwzLjczMTE0MDMyLDE0LjU5MzgwMTggQzMuNjEzMTgwMzIsMTQuNzI3MzAxOCAzLjUyNDYwMDMyLDE0Ljg4NDAwMTggMy40NzExNDAzMiwxNS4wNTM4MDE4IEwyLjAxMTE0MDMyLDIwLjc2MzgwMTggQzEuOTY4ODEwMzIsMjAuOTMxMjAxOCAxLjk3MDUxMDMyLDIxLjEwNjYwMTggMi4wMTYwNzAzMiwyMS4yNzMxMDE4IEMyLjA2MTYzMDMyLDIxLjQzOTUwMTggMi4xNDk1MDAzMiwyMS41OTE0MDE4IDIuMjcxMTQwMzIsMjEuNzEzODAxOCBDMi4zOTM1OTAzMiwyMS44MzU1MDE4IDIuNTQ1NDQwMzIsMjEuOTIzNDAxOCAyLjcxMTkxMDMyLDIxLjk2ODkwMTggQzIuODc4MzgwMzIsMjIuMDE0NTAxOCAzLjA1MzgyMDMyLDIyLjAxNjIwMTggMy4yMjExNDAzMiwyMS45NzM4MDE4IEw4LjkyMTE0MDMyLDIwLjU0MzgwMTggQzkuMDkxMDEwMzIsMjAuNDkwNDAxOCA5LjI0NzczMDMyLDIwLjQwMTgwMTggOS4zODExNDAzMiwyMC4yODM4MDE4IEwyMC44MzExMDAzLDguODczODQxOCBDMjEuMjA3NjAwMyw4LjUwMTgyMTggMjEuNTA2NDAwMyw4LjA1ODc5MTggMjEuNzEwNDAwMyw3LjU3MDQzMTggQzIxLjkxNDQwMDMsNy4wODIwNzE4IDIyLjAxOTQwMDMsNi41NTgwOTE4IDIyLjAxOTQwMDMsNi4wMjg4NDE4IEMyMi4wMTk0MDAzLDUuNDk5NjAxOCAyMS45MTQ0MDAzLDQuOTc1NjIxOCAyMS43MTA0MDAzLDQuNDg3MjYxOCBDMjEuNTA2NDAwMywzLjk5ODkwMTggMjEuMjA3NjAwMywzLjU1NTg3MTggMjAuODMxMTAwMywzLjE4Mzg0MTggWiBNMTQuNDIxMTAwMyw2LjczMzg0MTggTDE3LjI4MTEwMDMsOS41OTM4NDE4IEw4LjcyMTE0MDMyLDE4LjE2MzgwMTggTDUuODUxMTQwMzIsMTUuMzAzODAxOCBMMTQuNDIxMTAwMyw2LjczMzg0MTggWiBNNC40MjExNDAzMiwxOS42MzM4MDE4IEw1LjAxMTE0MDMyLDE3LjI1MzgwMTggTDYuNzYxMTQwMzIsMTkuMDAzODAxOCBMNC40MjExNDAzMiwxOS42MzM4MDE4IFogTTE5LjQyMTEwMDMsNC42MzM4NDE4IEMxOS43ODY5MDAzLDUuMDIwMTQxOCAxOS45OTA3MDAzLDUuNTMxODgxOCAxOS45OTA3MDAzLDYuMDYzODQxOCBDMTkuOTkwNzAwMyw2LjU5NTgwMTggMTkuNzg2OTAwMyw3LjEwNzU0MTggMTkuNDIxMTAwMyw3LjQ5Mzg0MTggTDE4LjcwMTEwMDMsOC4yMTM4NDE4IEwxNS44MzExMDAzLDUuMzEzODQxOCBMMTYuNTUxMTAwMyw0LjU5Mzg0MTggQzE2LjkzNjgwMDMsNC4yMjI5MTE4IDE3LjQ1MTEwMDMsNC4wMTU3MTE4IDE3Ljk4NjEwMDMsNC4wMTU3MTE4IEMxOC41MjEyMDAzLDQuMDE1NzExOCAxOS4wMzU1MDAzLDQuMjIyOTExOCAxOS40MjExMDAzLDQuNTkzODQxOCBMMTkuNDIxMTAwMyw0LjYzMzg0MTggWiIvPjwvc3ZnPgo=');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.ember-node {
|
|
47
|
+
.variable {
|
|
48
|
+
[contenteditable] {
|
|
49
|
+
white-space: pre-wrap;
|
|
50
|
+
word-wrap: break-word;
|
|
51
|
+
outline: 0px;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.ember-node.ProseMirror-selectednode {
|
|
57
|
+
.variable {
|
|
58
|
+
background-color: var(--au-blue-200);
|
|
59
|
+
outline: 2px solid var(--au-blue-500);
|
|
60
|
+
|
|
61
|
+
::selection {
|
|
62
|
+
background-color: var(--au-blue-300);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
type Args = {
|
|
3
|
+
alignment: 'left' | 'right';
|
|
4
|
+
icon: string;
|
|
5
|
+
iconAlignment: 'left' | 'right';
|
|
6
|
+
skin?: string;
|
|
7
|
+
};
|
|
8
|
+
export default class AuDropdownPill extends Component<Args> {
|
|
9
|
+
dropdownOpen: boolean;
|
|
10
|
+
openDropdown(): void;
|
|
11
|
+
closeDropdown(): void;
|
|
12
|
+
toggleDropdown(): void;
|
|
13
|
+
clickOutsideDeactivates(event: InputEvent): boolean;
|
|
14
|
+
get alignment(): "au-c-dropdown__menu--left" | "au-c-dropdown__menu--right" | "";
|
|
15
|
+
get skin(): string;
|
|
16
|
+
get icon(): string;
|
|
17
|
+
get iconAlignment(): "left" | "right";
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -10,7 +10,7 @@ interface Args {
|
|
|
10
10
|
}
|
|
11
11
|
export default class AuNativeInput extends Component<Args> {
|
|
12
12
|
constructor(owner: unknown, args: Args);
|
|
13
|
-
get width(): "au-c-input--block"
|
|
13
|
+
get width(): "" | "au-c-input--block";
|
|
14
14
|
get iconAlignment(): "" | "au-c-input-wrapper--left" | "au-c-input-wrapper--right";
|
|
15
15
|
get error(): "" | "au-c-input--error";
|
|
16
16
|
get warning(): "" | "au-c-input--warning";
|
|
@@ -21,7 +21,7 @@ export default class CitationCardComponent extends Component<Args> {
|
|
|
21
21
|
cardText: string | null;
|
|
22
22
|
cardLegislationType: string | null;
|
|
23
23
|
get controller(): ProseController;
|
|
24
|
-
get showCard(): Option<CitationDecoration>;
|
|
24
|
+
get showCard(): false | Option<CitationDecoration>;
|
|
25
25
|
get plugin(): CitationPlugin;
|
|
26
26
|
get decorations(): import("prosemirror-view").DecorationSet | undefined;
|
|
27
27
|
get activeDecoration(): Option<CitationDecoration>;
|
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { ProseController } from '@lblod/ember-rdfa-editor/core/prosemirror';
|
|
3
|
+
import { DateFormat } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/rdfa-date-plugin';
|
|
3
4
|
type Args = {
|
|
4
5
|
controller: ProseController;
|
|
6
|
+
widgetArgs: {
|
|
7
|
+
options: {
|
|
8
|
+
formats: [DateFormat];
|
|
9
|
+
allowCustomFormat: boolean;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
5
12
|
};
|
|
6
13
|
export default class RdfaDatePluginCardComponent extends Component<Args> {
|
|
7
14
|
dateValue?: Date;
|
|
8
|
-
|
|
9
|
-
from: number;
|
|
10
|
-
to: number;
|
|
11
|
-
};
|
|
15
|
+
datePos?: number;
|
|
12
16
|
dateInDocument: boolean;
|
|
13
17
|
onlyDate: boolean;
|
|
14
|
-
|
|
18
|
+
dateFormat: string;
|
|
19
|
+
customDateFormat: string;
|
|
20
|
+
constructor(owner: unknown, args: Args);
|
|
15
21
|
get controller(): ProseController;
|
|
16
22
|
modifyDate(): void;
|
|
17
23
|
changeDate(date: Date): void;
|
|
24
|
+
setDateFormat(dateFormat: string): void;
|
|
25
|
+
setCustomDateFormat(event: InputEvent): void;
|
|
26
|
+
get showCard(): boolean;
|
|
18
27
|
onSelectionChanged(): void;
|
|
19
28
|
}
|
|
20
29
|
export {};
|
|
@@ -6,7 +6,6 @@ type Args = {
|
|
|
6
6
|
export default class RdfaDatePluginInsertComponent extends Component<Args> {
|
|
7
7
|
get controller(): ProseController;
|
|
8
8
|
get schema(): import("prosemirror-model").Schema<any, any>;
|
|
9
|
-
insertDate(): void;
|
|
10
|
-
insertDateTime(): void;
|
|
9
|
+
insertDate(onlyDate: boolean): void;
|
|
11
10
|
}
|
|
12
11
|
export {};
|
|
@@ -2,6 +2,7 @@ import Component from '@glimmer/component';
|
|
|
2
2
|
import RoadsignRegistryService from '@lblod/ember-rdfa-editor-lblod-plugins/services/roadsign-registry';
|
|
3
3
|
import Measure from '@lblod/ember-rdfa-editor-lblod-plugins/models/measure';
|
|
4
4
|
import { ProseController } from '@lblod/ember-rdfa-editor/core/prosemirror';
|
|
5
|
+
import IntlService from 'ember-intl/services/intl';
|
|
5
6
|
type Option = {
|
|
6
7
|
label: string;
|
|
7
8
|
value: string;
|
|
@@ -18,6 +19,7 @@ export default class RoadsignRegulationCard extends Component<Args> {
|
|
|
18
19
|
endpoint: string;
|
|
19
20
|
pageSize: number;
|
|
20
21
|
roadsignRegistry: RoadsignRegistryService;
|
|
22
|
+
intl: IntlService;
|
|
21
23
|
typeSelected?: TypeOption;
|
|
22
24
|
categorySelected?: Category;
|
|
23
25
|
zonalityOptions: Zonality[];
|
|
@@ -31,6 +33,7 @@ export default class RoadsignRegulationCard extends Component<Args> {
|
|
|
31
33
|
pageStart: number;
|
|
32
34
|
get isNotTypeSign(): boolean;
|
|
33
35
|
constructor(parent: unknown, args: Args);
|
|
36
|
+
get schema(): import("prosemirror-model").Schema<any, any>;
|
|
34
37
|
selectTypeOrCategory(option: Option): void;
|
|
35
38
|
changeCode(value: Code): void;
|
|
36
39
|
changeCodeCombination(value: Code[]): void;
|
|
@@ -2,16 +2,21 @@ import Component from '@glimmer/component';
|
|
|
2
2
|
import StandardTemplatePluginService from '@lblod/ember-rdfa-editor-lblod-plugins/services/standard-template-plugin';
|
|
3
3
|
import { ProseController } from '@lblod/ember-rdfa-editor/core/prosemirror';
|
|
4
4
|
import TemplateModel from '@lblod/ember-rdfa-editor-lblod-plugins/models/template';
|
|
5
|
+
import { PNode, ResolvedPos } from '@lblod/ember-rdfa-editor';
|
|
5
6
|
type Args = {
|
|
6
7
|
controller: ProseController;
|
|
7
8
|
};
|
|
9
|
+
export declare function findAncestors(pos: ResolvedPos, predicate?: (node: PNode) => boolean): {
|
|
10
|
+
node: PNode;
|
|
11
|
+
pos: number;
|
|
12
|
+
}[];
|
|
8
13
|
export default class TemplateProviderComponent extends Component<Args> {
|
|
9
14
|
standardTemplatePlugin: StandardTemplatePluginService;
|
|
10
15
|
get busy(): boolean;
|
|
11
16
|
get controller(): ProseController;
|
|
12
17
|
get hasApplicableTemplates(): boolean;
|
|
13
18
|
get applicableTemplates(): TemplateModel[];
|
|
14
|
-
templateIsApplicable(template: TemplateModel): boolean;
|
|
19
|
+
templateIsApplicable(template: TemplateModel): boolean | 0;
|
|
15
20
|
insert(template: TemplateModel): Promise<void>;
|
|
16
21
|
}
|
|
17
22
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { ProseController } from '@lblod/ember-rdfa-editor/core/prosemirror';
|
|
3
|
-
import { VariableType } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/
|
|
4
|
-
import { CodeList } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/
|
|
3
|
+
import { VariableType } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/constants';
|
|
4
|
+
import { CodeList } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/fetch-data';
|
|
5
5
|
type Args = {
|
|
6
6
|
controller: ProseController;
|
|
7
7
|
widgetArgs: {
|
|
@@ -15,7 +15,6 @@ type Args = {
|
|
|
15
15
|
export default class EditorPluginsInsertCodelistCardComponent extends Component<Args> {
|
|
16
16
|
variablesArray: VariableType[];
|
|
17
17
|
selectedVariable?: VariableType;
|
|
18
|
-
showCard: boolean;
|
|
19
18
|
hasSubtype: boolean;
|
|
20
19
|
selectedSubtype?: CodeList;
|
|
21
20
|
subtypes?: CodeList[];
|
|
@@ -26,6 +25,6 @@ export default class EditorPluginsInsertCodelistCardComponent extends Component<
|
|
|
26
25
|
updateSelectedVariable(variable: VariableType): void;
|
|
27
26
|
fetchSubtypes: import("ember-concurrency").TaskForAsyncTaskFunction<unknown, (fetchFunction: (endpoint: string, publisher: string) => Promise<CodeList[]>) => Promise<void>>;
|
|
28
27
|
updateSubtype(subtype: CodeList): void;
|
|
29
|
-
|
|
28
|
+
get showCard(): boolean;
|
|
30
29
|
}
|
|
31
30
|
export {};
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { ProseController } from '@lblod/ember-rdfa-editor/core/prosemirror';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { CodeListOption } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/fetch-data';
|
|
4
|
+
import { PNode } from '@lblod/ember-rdfa-editor';
|
|
5
5
|
type Args = {
|
|
6
6
|
controller: ProseController;
|
|
7
7
|
};
|
|
8
8
|
export default class EditorPluginsTemplateVariableCardComponent extends Component<Args> {
|
|
9
9
|
variableOptions: CodeListOption[];
|
|
10
|
-
|
|
10
|
+
selectedVariableOption?: CodeListOption | CodeListOption[];
|
|
11
|
+
selectedVariable: {
|
|
12
|
+
pos: number;
|
|
13
|
+
node: PNode;
|
|
14
|
+
} | undefined;
|
|
11
15
|
showCard: boolean;
|
|
12
16
|
multiSelect: boolean;
|
|
13
17
|
mappingUri?: string;
|
|
@@ -19,8 +23,7 @@ export default class EditorPluginsTemplateVariableCardComponent extends Componen
|
|
|
19
23
|
insert(): void;
|
|
20
24
|
wrapVariableInHighlight(text: string): string;
|
|
21
25
|
selectionChanged(): void;
|
|
22
|
-
|
|
23
|
-
updateVariable(variable: CodeListOption | CodeListOption[]): void;
|
|
26
|
+
updateVariableOption(variableOption: CodeListOption | CodeListOption[]): void;
|
|
24
27
|
fetchCodeListOptions: import("ember-concurrency").TaskForAsyncTaskFunction<unknown, (endpoint: string, codelistUri: string, isLocation?: boolean) => Promise<void>>;
|
|
25
28
|
wrapInLocation(value: string): string;
|
|
26
29
|
}
|