@lblod/ember-rdfa-editor-lblod-plugins 0.1.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/LICENSE.md +9 -0
- package/README.md +37 -0
- package/addon-main.js +4 -0
- package/dist/_app_/components/besluit-type-plugin/besluit-type-select.js +1 -0
- package/dist/_app_/components/besluit-type-plugin/toolbar-dropdown.js +1 -0
- package/dist/_app_/components/citaten-plugin/citaat-card.js +1 -0
- package/dist/_app_/components/citaten-plugin/citaat-insert.js +1 -0
- package/dist/_app_/components/citaten-plugin/citations/article-list.js +1 -0
- package/dist/_app_/components/citaten-plugin/citations/article-preview.js +1 -0
- package/dist/_app_/components/citaten-plugin/citations/decision-detail.js +1 -0
- package/dist/_app_/components/citaten-plugin/citations/decision-list.js +1 -0
- package/dist/_app_/components/citaten-plugin/citations/decision-preview.js +1 -0
- package/dist/_app_/components/citaten-plugin/citations/search-modal.js +1 -0
- package/dist/_app_/components/citaten-plugin/helpers/alert-load-error.js +1 -0
- package/dist/_app_/components/citaten-plugin/helpers/alert-no-items.js +1 -0
- package/dist/_app_/components/import-snippet-plugin/card.js +1 -0
- package/dist/_app_/components/rdfa-date-plugin/rdfa-date-plugin-card.js +1 -0
- package/dist/_app_/components/rdfa-date-plugin/rdfa-date-plugin-insert.js +1 -0
- package/dist/_app_/components/rdfa-date-plugin/rdfa-date-time-picker.js +1 -0
- package/dist/_app_/components/standard-template-plugin/template-card.js +1 -0
- package/dist/_app_/components/standard-template-plugin/template-provider.js +1 -0
- package/dist/_app_/components/table-of-contents-plugin/card.js +1 -0
- package/dist/_app_/components/table-of-contents-plugin/inline-components/outline.js +1 -0
- package/dist/_app_/components/table-of-contents-plugin/inline-components/table-of-contents.js +1 -0
- package/dist/_app_/initializers/plugin-initializer.js +1 -0
- package/dist/_app_/models/template.js +1 -0
- package/dist/_app_/serializers/application.js +1 -0
- package/dist/_app_/services/import-rdfa-snippet.js +1 -0
- package/dist/_app_/services/standard-template-plugin.js +1 -0
- package/dist/_rollupPluginBabelHelpers-537ad14b.js +48 -0
- package/dist/_rollupPluginBabelHelpers-537ad14b.js.map +1 -0
- package/dist/components/besluit-type-plugin/besluit-type-select.js +30 -0
- package/dist/components/besluit-type-plugin/besluit-type-select.js.map +1 -0
- package/dist/components/besluit-type-plugin/toolbar-dropdown.js +292 -0
- package/dist/components/besluit-type-plugin/toolbar-dropdown.js.map +1 -0
- package/dist/components/citaten-plugin/citaat-card.js +367 -0
- package/dist/components/citaten-plugin/citaat-card.js.map +1 -0
- package/dist/components/citaten-plugin/citaat-insert.js +84 -0
- package/dist/components/citaten-plugin/citaat-insert.js.map +1 -0
- package/dist/components/citaten-plugin/citations/article-list.js +10 -0
- package/dist/components/citaten-plugin/citations/article-list.js.map +1 -0
- package/dist/components/citaten-plugin/citations/article-preview.js +10 -0
- package/dist/components/citaten-plugin/citations/article-preview.js.map +1 -0
- package/dist/components/citaten-plugin/citations/decision-detail.js +123 -0
- package/dist/components/citaten-plugin/citations/decision-detail.js.map +1 -0
- package/dist/components/citaten-plugin/citations/decision-list.js +10 -0
- package/dist/components/citaten-plugin/citations/decision-list.js.map +1 -0
- package/dist/components/citaten-plugin/citations/decision-preview.js +10 -0
- package/dist/components/citaten-plugin/citations/decision-preview.js.map +1 -0
- package/dist/components/citaten-plugin/citations/search-modal.js +282 -0
- package/dist/components/citaten-plugin/citations/search-modal.js.map +1 -0
- package/dist/components/citaten-plugin/helpers/alert-load-error.js +10 -0
- package/dist/components/citaten-plugin/helpers/alert-load-error.js.map +1 -0
- package/dist/components/citaten-plugin/helpers/alert-no-items.js +10 -0
- package/dist/components/citaten-plugin/helpers/alert-no-items.js.map +1 -0
- package/dist/components/import-snippet-plugin/card.js +99 -0
- package/dist/components/import-snippet-plugin/card.js.map +1 -0
- package/dist/components/rdfa-date-plugin/rdfa-date-plugin-card.js +85 -0
- package/dist/components/rdfa-date-plugin/rdfa-date-plugin-card.js.map +1 -0
- package/dist/components/rdfa-date-plugin/rdfa-date-plugin-insert.js +23 -0
- package/dist/components/rdfa-date-plugin/rdfa-date-plugin-insert.js.map +1 -0
- package/dist/components/rdfa-date-plugin/rdfa-date-time-picker.js +91 -0
- package/dist/components/rdfa-date-plugin/rdfa-date-time-picker.js.map +1 -0
- package/dist/components/standard-template-plugin/template-card.js +15 -0
- package/dist/components/standard-template-plugin/template-card.js.map +1 -0
- package/dist/components/standard-template-plugin/template-provider.js +109 -0
- package/dist/components/standard-template-plugin/template-provider.js.map +1 -0
- package/dist/components/table-of-contents-plugin/card.js +52 -0
- package/dist/components/table-of-contents-plugin/card.js.map +1 -0
- package/dist/components/table-of-contents-plugin/inline-components/outline.js +10 -0
- package/dist/components/table-of-contents-plugin/inline-components/outline.js.map +1 -0
- package/dist/components/table-of-contents-plugin/inline-components/table-of-contents.js +92 -0
- package/dist/components/table-of-contents-plugin/inline-components/table-of-contents.js.map +1 -0
- package/dist/constants-af958fcd.js +12 -0
- package/dist/constants-af958fcd.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/initializers/plugin-initializer.js +307 -0
- package/dist/initializers/plugin-initializer.js.map +1 -0
- package/dist/legislation-types-4d487cb9.js +26 -0
- package/dist/legislation-types-4d487cb9.js.map +1 -0
- package/dist/models/template.js +48 -0
- package/dist/models/template.js.map +1 -0
- package/dist/serializers/application.js +10 -0
- package/dist/serializers/application.js.map +1 -0
- package/dist/services/import-rdfa-snippet.js +178 -0
- package/dist/services/import-rdfa-snippet.js.map +1 -0
- package/dist/services/standard-template-plugin.js +53 -0
- package/dist/services/standard-template-plugin.js.map +1 -0
- package/dist/styles/citaten-plugin.scss +50 -0
- package/dist/styles/test.css +0 -0
- package/dist/vlaamse-codex-187fe526.js +304 -0
- package/dist/vlaamse-codex-187fe526.js.map +1 -0
- package/package.json +117 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { _ as _applyDecoratedDescriptor, a as _initializerDefineProperty } from '../../_rollupPluginBabelHelpers-537ad14b.js';
|
|
2
|
+
import { setComponentTemplate } from '@ember/component';
|
|
3
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
4
|
+
import Component from '@glimmer/component';
|
|
5
|
+
import { inject } from '@ember/service';
|
|
6
|
+
import { action } from '@ember/object';
|
|
7
|
+
import { tracked } from '@glimmer/tracking';
|
|
8
|
+
|
|
9
|
+
var TEMPLATE = hbs("{{#each this.snippets as |snippet|}}\n <AuCard @flex={{true}} @divided={{true}} @expandable={{true}} @shadow={{true}} @isOpenInitially={{true}} @size=\"small\" as |c|>\n <c.header>\n <AuHeading @level=\"3\" @skin=\"6\">\n Document importeren\n </AuHeading>\n </c.header>\n <c.content>\n <p class=\"u-spacer--tiny\">Er is een <a href=\"{{snippet.source}}\" target=\"_blank\" rel=\"noopener noreferrer\">document</a> beschikbaar</p>\n <p><strong>Wenst u dit document in te voegen?</strong></p>\n {{#if this.besluitNode}}\n <AuButton {{on \"click\" (fn this.insert snippet \'attachment\')}} >Bijlage invoegen</AuButton>\n {{/if}}\n <AuButton {{on \"click\" (fn this.insert snippet)}} >Document invoegen</AuButton>\n </c.content>\n </AuCard>\n{{/each}}\n");
|
|
10
|
+
|
|
11
|
+
var _class, _descriptor, _descriptor2, _descriptor3;
|
|
12
|
+
let ImportSnippetPluginCard = (_class = class ImportSnippetPluginCard extends Component {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
_initializerDefineProperty(this, "importRdfaSnippet", _descriptor, this);
|
|
16
|
+
_initializerDefineProperty(this, "snippets", _descriptor2, this);
|
|
17
|
+
_initializerDefineProperty(this, "besluitNode", _descriptor3, this);
|
|
18
|
+
this.args.controller.onEvent('selectionChanged', this.selectionChangedHandler);
|
|
19
|
+
}
|
|
20
|
+
selectionChangedHandler() {
|
|
21
|
+
const {
|
|
22
|
+
controller
|
|
23
|
+
} = this.args;
|
|
24
|
+
const selectedRange = controller.selection.lastRange;
|
|
25
|
+
if (!selectedRange) {
|
|
26
|
+
console.info('Selection did not have a range, skipping handling of the selectionChanged event');
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
this.snippets = this.importRdfaSnippet.snippetsForType('roadsign');
|
|
30
|
+
const limitedDatastore = controller.datastore.limitToRange(selectedRange, 'rangeIsInside');
|
|
31
|
+
const besluit = limitedDatastore.match(null, 'a', '>http://data.vlaanderen.be/ns/besluit#Besluit').asSubjectNodes().next().value;
|
|
32
|
+
if (besluit) {
|
|
33
|
+
this.besluitNode = [...besluit.nodes][0];
|
|
34
|
+
} else {
|
|
35
|
+
this.besluitNode = undefined;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
insert(snippet, type) {
|
|
39
|
+
const html = this.generateSnippetHtml(snippet, type);
|
|
40
|
+
let rangeToInsert;
|
|
41
|
+
if (this.besluitNode) {
|
|
42
|
+
rangeToInsert = this.args.controller.rangeFactory.fromInNode(this.besluitNode, this.besluitNode.getMaxOffset(), this.besluitNode.getMaxOffset());
|
|
43
|
+
} else {
|
|
44
|
+
rangeToInsert = this.args.controller.selection.lastRange;
|
|
45
|
+
}
|
|
46
|
+
if (rangeToInsert) {
|
|
47
|
+
this.args.controller.executeCommand('insert-html', html, rangeToInsert);
|
|
48
|
+
this.importRdfaSnippet.removeSnippet(snippet);
|
|
49
|
+
} else {
|
|
50
|
+
console.warn('Could not find a range to insert, so we skipped inserting');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
generateSnippetHtml(snippet, type) {
|
|
54
|
+
if (type === 'attachment') {
|
|
55
|
+
return `
|
|
56
|
+
<div property="http://lblod.data.gift/vocabularies/editor/isLumpNode">
|
|
57
|
+
<div
|
|
58
|
+
resource="${snippet.source}"
|
|
59
|
+
property="http://data.europa.eu/eli/ontology#related_to"
|
|
60
|
+
typeof="http://xmlns.com/foaf/0.1/Document http://lblod.data.gift/vocabularies/editor/SnippetAttachment"
|
|
61
|
+
>
|
|
62
|
+
Bijlage uit externe bron <a href="${snippet.source}">${new URL(snippet.source).hostname}</a>
|
|
63
|
+
<div property="http://www.w3.org/ns/prov#value">${snippet.content}</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
`;
|
|
67
|
+
} else {
|
|
68
|
+
return `
|
|
69
|
+
<div property="http://lblod.data.gift/vocabularies/editor/isLumpNode">
|
|
70
|
+
Bijlage uit externe bron
|
|
71
|
+
<div property="http://data.europa.eu/eli/ontology#related_to" resource="${snippet.source}">
|
|
72
|
+
<div property="http://www.w3.org/ns/prov#value">${snippet.content}</div>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
`;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "importRdfaSnippet", [inject], {
|
|
79
|
+
configurable: true,
|
|
80
|
+
enumerable: true,
|
|
81
|
+
writable: true,
|
|
82
|
+
initializer: null
|
|
83
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "snippets", [tracked], {
|
|
84
|
+
configurable: true,
|
|
85
|
+
enumerable: true,
|
|
86
|
+
writable: true,
|
|
87
|
+
initializer: function () {
|
|
88
|
+
return [];
|
|
89
|
+
}
|
|
90
|
+
}), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, "besluitNode", [tracked], {
|
|
91
|
+
configurable: true,
|
|
92
|
+
enumerable: true,
|
|
93
|
+
writable: true,
|
|
94
|
+
initializer: null
|
|
95
|
+
}), _applyDecoratedDescriptor(_class.prototype, "selectionChangedHandler", [action], Object.getOwnPropertyDescriptor(_class.prototype, "selectionChangedHandler"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "insert", [action], Object.getOwnPropertyDescriptor(_class.prototype, "insert"), _class.prototype)), _class);
|
|
96
|
+
setComponentTemplate(TEMPLATE, ImportSnippetPluginCard);
|
|
97
|
+
|
|
98
|
+
export { ImportSnippetPluginCard as default };
|
|
99
|
+
//# sourceMappingURL=card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.js","sources":["../../../src/components/import-snippet-plugin/card.hbs.js","../../../src/components/import-snippet-plugin/card.js"],"sourcesContent":["import { hbs } from 'ember-cli-htmlbars';\nexport default hbs(\"{{#each this.snippets as |snippet|}}\\n <AuCard @flex={{true}} @divided={{true}} @expandable={{true}} @shadow={{true}} @isOpenInitially={{true}} @size=\\\"small\\\" as |c|>\\n <c.header>\\n <AuHeading @level=\\\"3\\\" @skin=\\\"6\\\">\\n Document importeren\\n </AuHeading>\\n </c.header>\\n <c.content>\\n <p class=\\\"u-spacer--tiny\\\">Er is een <a href=\\\"{{snippet.source}}\\\" target=\\\"_blank\\\" rel=\\\"noopener noreferrer\\\">document</a> beschikbaar</p>\\n <p><strong>Wenst u dit document in te voegen?</strong></p>\\n {{#if this.besluitNode}}\\n <AuButton {{on \\\"click\\\" (fn this.insert snippet \\'attachment\\')}} >Bijlage invoegen</AuButton>\\n {{/if}}\\n <AuButton {{on \\\"click\\\" (fn this.insert snippet)}} >Document invoegen</AuButton>\\n </c.content>\\n </AuCard>\\n{{/each}}\\n\")","import Component from '@glimmer/component';\nimport { inject as service } from '@ember/service';\nimport { action } from '@ember/object';\nimport { tracked } from '@glimmer/tracking';\n\nexport default class ImportSnippetPluginCard extends Component {\n @service importRdfaSnippet;\n @tracked snippets = [];\n @tracked besluitNode;\n\n constructor() {\n super(...arguments);\n this.args.controller.onEvent(\n 'selectionChanged',\n this.selectionChangedHandler\n );\n }\n\n @action\n selectionChangedHandler() {\n const { controller } = this.args;\n const selectedRange = controller.selection.lastRange;\n if (!selectedRange) {\n console.info(\n 'Selection did not have a range, skipping handling of the selectionChanged event'\n );\n return;\n }\n this.snippets = this.importRdfaSnippet.snippetsForType('roadsign');\n const limitedDatastore = controller.datastore.limitToRange(\n selectedRange,\n 'rangeIsInside'\n );\n const besluit = limitedDatastore\n .match(null, 'a', '>http://data.vlaanderen.be/ns/besluit#Besluit')\n .asSubjectNodes()\n .next().value;\n if (besluit) {\n this.besluitNode = [...besluit.nodes][0];\n } else {\n this.besluitNode = undefined;\n }\n }\n\n @action\n insert(snippet, type) {\n const html = this.generateSnippetHtml(snippet, type);\n let rangeToInsert;\n if (this.besluitNode) {\n rangeToInsert = this.args.controller.rangeFactory.fromInNode(\n this.besluitNode,\n this.besluitNode.getMaxOffset(),\n this.besluitNode.getMaxOffset()\n );\n } else {\n rangeToInsert = this.args.controller.selection.lastRange;\n }\n if (rangeToInsert) {\n this.args.controller.executeCommand('insert-html', html, rangeToInsert);\n this.importRdfaSnippet.removeSnippet(snippet);\n } else {\n console.warn('Could not find a range to insert, so we skipped inserting');\n }\n }\n\n generateSnippetHtml(snippet, type) {\n if (type === 'attachment') {\n return `\n <div property=\"http://lblod.data.gift/vocabularies/editor/isLumpNode\">\n <div\n resource=\"${snippet.source}\"\n property=\"http://data.europa.eu/eli/ontology#related_to\"\n typeof=\"http://xmlns.com/foaf/0.1/Document http://lblod.data.gift/vocabularies/editor/SnippetAttachment\"\n >\n Bijlage uit externe bron <a href=\"${snippet.source}\">${\n new URL(snippet.source).hostname\n }</a>\n <div property=\"http://www.w3.org/ns/prov#value\">${\n snippet.content\n }</div>\n </div>\n </div>\n `;\n } else {\n return `\n <div property=\"http://lblod.data.gift/vocabularies/editor/isLumpNode\">\n Bijlage uit externe bron\n <div property=\"http://data.europa.eu/eli/ontology#related_to\" resource=\"${snippet.source}\">\n <div property=\"http://www.w3.org/ns/prov#value\">${snippet.content}</div>\n </div>\n </div>\n `;\n }\n }\n}\n"],"names":["hbs","ImportSnippetPluginCard","Component","constructor","arguments","args","controller","onEvent","selectionChangedHandler","selectedRange","selection","lastRange","console","info","snippets","importRdfaSnippet","snippetsForType","limitedDatastore","datastore","limitToRange","besluit","match","asSubjectNodes","next","value","besluitNode","nodes","undefined","insert","snippet","type","html","generateSnippetHtml","rangeToInsert","rangeFactory","fromInNode","getMaxOffset","executeCommand","removeSnippet","warn","source","URL","hostname","content","service","tracked","action"],"mappings":";;;;;;;;AACA,eAAeA,GAAG,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EAAA,uBAAA,CAAA;;;;"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { _ as _applyDecoratedDescriptor, a as _initializerDefineProperty } from '../../_rollupPluginBabelHelpers-537ad14b.js';
|
|
2
|
+
import { setComponentTemplate } from '@ember/component';
|
|
3
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
4
|
+
import Component from '@glimmer/component';
|
|
5
|
+
import { tracked } from '@glimmer/tracking';
|
|
6
|
+
import { action } from '@ember/object';
|
|
7
|
+
|
|
8
|
+
var TEMPLATE = hbs("{{#if this.showCard}}\n <AuCard @shadow={{true}} @size=\"flush\" as |c|>\n <c.header class=\"au-u-hidden-visually\">\n <AuHeading @level=\"3\" @skin=\"6\">{{t \"date-plugin.card.title\"}}</AuHeading>\n </c.header>\n <c.content class=\"au-o-box au-o-box--small\">\n <div class=\"au-o-flow au-o-flow--small\">\n <RdfaDatePlugin::RdfaDateTimePicker\n @onChange={{this.changeDate}}\n @value={{this.dateValue}}\n @onlyDate={{this.onlyDate}}/>\n {{#unless this.dateInDocument}}\n <AuFormRow class=\"au-u-margin-top\">\n <AuButton {{on \'click\' this.modifyDate}}>\n {{if this.onlyDate (t \"date-plugin.card.insert-date\") (t \"date-plugin.card.insert-datetime\")}}\n </AuButton>\n </AuFormRow>\n {{/unless}}\n </div>\n </c.content>\n </AuCard>\n{{/if}}\n");
|
|
9
|
+
|
|
10
|
+
var _class, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5;
|
|
11
|
+
let RdfaDatePluginCardComponent = (_class = class RdfaDatePluginCardComponent extends Component {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
_initializerDefineProperty(this, "showCard", _descriptor, this);
|
|
15
|
+
_initializerDefineProperty(this, "dateValue", _descriptor2, this);
|
|
16
|
+
_initializerDefineProperty(this, "dateElement", _descriptor3, this);
|
|
17
|
+
_initializerDefineProperty(this, "dateInDocument", _descriptor4, this);
|
|
18
|
+
_initializerDefineProperty(this, "onlyDate", _descriptor5, this);
|
|
19
|
+
this.args.controller.onEvent('selectionChanged', this.selectionChangedHandler);
|
|
20
|
+
}
|
|
21
|
+
modifyDate() {
|
|
22
|
+
this.args.controller.executeCommand('modify-date', this.args.controller, this.dateElement, this.dateValue, this.onlyDate);
|
|
23
|
+
}
|
|
24
|
+
changeDate(date) {
|
|
25
|
+
this.dateValue = date;
|
|
26
|
+
if (this.dateInDocument) this.modifyDate();
|
|
27
|
+
}
|
|
28
|
+
selectionChangedHandler() {
|
|
29
|
+
const selectedRange = this.args.controller.selection.lastRange;
|
|
30
|
+
if (!selectedRange) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const selectionParent = selectedRange.start.parent;
|
|
34
|
+
const datatype = selectionParent.attributeMap.get('datatype');
|
|
35
|
+
if (datatype === 'xsd:dateTime') {
|
|
36
|
+
this.showCard = true;
|
|
37
|
+
this.dateElement = selectionParent;
|
|
38
|
+
const dateContent = selectionParent.attributeMap.get('content');
|
|
39
|
+
this.dateValue = dateContent ? new Date(dateContent) : new Date();
|
|
40
|
+
this.dateInDocument = !!dateContent;
|
|
41
|
+
this.onlyDate = false;
|
|
42
|
+
} else if (datatype === 'xsd:date') {
|
|
43
|
+
this.showCard = true;
|
|
44
|
+
this.dateElement = selectionParent;
|
|
45
|
+
const dateContent = selectionParent.attributeMap.get('content');
|
|
46
|
+
this.dateValue = dateContent ? new Date(dateContent) : new Date();
|
|
47
|
+
this.dateInDocument = !!dateContent;
|
|
48
|
+
this.onlyDate = true;
|
|
49
|
+
} else {
|
|
50
|
+
this.showCard = false;
|
|
51
|
+
this.dateElement = undefined;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "showCard", [tracked], {
|
|
55
|
+
configurable: true,
|
|
56
|
+
enumerable: true,
|
|
57
|
+
writable: true,
|
|
58
|
+
initializer: function () {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "dateValue", [tracked], {
|
|
62
|
+
configurable: true,
|
|
63
|
+
enumerable: true,
|
|
64
|
+
writable: true,
|
|
65
|
+
initializer: null
|
|
66
|
+
}), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, "dateElement", [tracked], {
|
|
67
|
+
configurable: true,
|
|
68
|
+
enumerable: true,
|
|
69
|
+
writable: true,
|
|
70
|
+
initializer: null
|
|
71
|
+
}), _descriptor4 = _applyDecoratedDescriptor(_class.prototype, "dateInDocument", [tracked], {
|
|
72
|
+
configurable: true,
|
|
73
|
+
enumerable: true,
|
|
74
|
+
writable: true,
|
|
75
|
+
initializer: null
|
|
76
|
+
}), _descriptor5 = _applyDecoratedDescriptor(_class.prototype, "onlyDate", [tracked], {
|
|
77
|
+
configurable: true,
|
|
78
|
+
enumerable: true,
|
|
79
|
+
writable: true,
|
|
80
|
+
initializer: null
|
|
81
|
+
}), _applyDecoratedDescriptor(_class.prototype, "modifyDate", [action], Object.getOwnPropertyDescriptor(_class.prototype, "modifyDate"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "changeDate", [action], Object.getOwnPropertyDescriptor(_class.prototype, "changeDate"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "selectionChangedHandler", [action], Object.getOwnPropertyDescriptor(_class.prototype, "selectionChangedHandler"), _class.prototype)), _class);
|
|
82
|
+
setComponentTemplate(TEMPLATE, RdfaDatePluginCardComponent);
|
|
83
|
+
|
|
84
|
+
export { RdfaDatePluginCardComponent as default };
|
|
85
|
+
//# sourceMappingURL=rdfa-date-plugin-card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rdfa-date-plugin-card.js","sources":["../../../src/components/rdfa-date-plugin/rdfa-date-plugin-card.hbs.js","../../../src/components/rdfa-date-plugin/rdfa-date-plugin-card.js"],"sourcesContent":["import { hbs } from 'ember-cli-htmlbars';\nexport default hbs(\"{{#if this.showCard}}\\n <AuCard @shadow={{true}} @size=\\\"flush\\\" as |c|>\\n <c.header class=\\\"au-u-hidden-visually\\\">\\n <AuHeading @level=\\\"3\\\" @skin=\\\"6\\\">{{t \\\"date-plugin.card.title\\\"}}</AuHeading>\\n </c.header>\\n <c.content class=\\\"au-o-box au-o-box--small\\\">\\n <div class=\\\"au-o-flow au-o-flow--small\\\">\\n <RdfaDatePlugin::RdfaDateTimePicker\\n @onChange={{this.changeDate}}\\n @value={{this.dateValue}}\\n @onlyDate={{this.onlyDate}}/>\\n {{#unless this.dateInDocument}}\\n <AuFormRow class=\\\"au-u-margin-top\\\">\\n <AuButton {{on \\'click\\' this.modifyDate}}>\\n {{if this.onlyDate (t \\\"date-plugin.card.insert-date\\\") (t \\\"date-plugin.card.insert-datetime\\\")}}\\n </AuButton>\\n </AuFormRow>\\n {{/unless}}\\n </div>\\n </c.content>\\n </AuCard>\\n{{/if}}\\n\")","import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\n\nexport default class RdfaDatePluginCardComponent extends Component {\n @tracked showCard = false;\n @tracked dateValue;\n @tracked dateElement;\n @tracked dateInDocument;\n @tracked onlyDate;\n\n constructor() {\n super(...arguments);\n this.args.controller.onEvent(\n 'selectionChanged',\n this.selectionChangedHandler\n );\n }\n\n @action\n modifyDate() {\n this.args.controller.executeCommand(\n 'modify-date',\n this.args.controller,\n this.dateElement,\n this.dateValue,\n this.onlyDate\n );\n }\n\n @action\n changeDate(date) {\n this.dateValue = date;\n if (this.dateInDocument) this.modifyDate();\n }\n\n @action\n selectionChangedHandler() {\n const selectedRange = this.args.controller.selection.lastRange;\n if (!selectedRange) {\n return;\n }\n const selectionParent = selectedRange.start.parent;\n const datatype = selectionParent.attributeMap.get('datatype');\n if (datatype === 'xsd:dateTime') {\n this.showCard = true;\n this.dateElement = selectionParent;\n const dateContent = selectionParent.attributeMap.get('content');\n this.dateValue = dateContent ? new Date(dateContent) : new Date();\n this.dateInDocument = !!dateContent;\n this.onlyDate = false;\n } else if (datatype === 'xsd:date') {\n this.showCard = true;\n this.dateElement = selectionParent;\n const dateContent = selectionParent.attributeMap.get('content');\n this.dateValue = dateContent ? new Date(dateContent) : new Date();\n this.dateInDocument = !!dateContent;\n this.onlyDate = true;\n } else {\n this.showCard = false;\n this.dateElement = undefined;\n }\n }\n}\n"],"names":["hbs","RdfaDatePluginCardComponent","Component","constructor","arguments","args","controller","onEvent","selectionChangedHandler","modifyDate","executeCommand","dateElement","dateValue","onlyDate","changeDate","date","dateInDocument","selectedRange","selection","lastRange","selectionParent","start","parent","datatype","attributeMap","get","showCard","dateContent","Date","undefined","tracked","action"],"mappings":";;;;;;;AACA,eAAeA,GAAG,CAAC,g3BAAg3B,CAAC;;;ACC71B,IAElBC,2BAA2B,IAAjC,MAAA,GAAA,MAAMA,2BAA2B,SAASC,SAAS,CAAC;AAOjEC,EAAAA,WAAW,GAAG;IACZ,KAAK,CAAC,GAAGC,SAAS,CAAC,CAAA;AAAC,IAAA,0BAAA,CAAA,IAAA,EAAA,UAAA,EAAA,WAAA,EAAA,IAAA,CAAA,CAAA;AAAA,IAAA,0BAAA,CAAA,IAAA,EAAA,WAAA,EAAA,YAAA,EAAA,IAAA,CAAA,CAAA;AAAA,IAAA,0BAAA,CAAA,IAAA,EAAA,aAAA,EAAA,YAAA,EAAA,IAAA,CAAA,CAAA;AAAA,IAAA,0BAAA,CAAA,IAAA,EAAA,gBAAA,EAAA,YAAA,EAAA,IAAA,CAAA,CAAA;AAAA,IAAA,0BAAA,CAAA,IAAA,EAAA,UAAA,EAAA,YAAA,EAAA,IAAA,CAAA,CAAA;AACpB,IAAA,IAAI,CAACC,IAAI,CAACC,UAAU,CAACC,OAAO,CAC1B,kBAAkB,EAClB,IAAI,CAACC,uBAAuB,CAC7B,CAAA;AACH,GAAA;AAGAC,EAAAA,UAAU,GAAG;IACX,IAAI,CAACJ,IAAI,CAACC,UAAU,CAACI,cAAc,CACjC,aAAa,EACb,IAAI,CAACL,IAAI,CAACC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AA;AAAA,CAAA,CAAA,EAAA,YAAA,GAAA,yBAAA,CAAA,MAAA,CAAA,SAAA,EAAA,UAAA,EAAA,CACPA,OAAO,CAAA,EAAA;AAAA,EAAA,YAAA,EAAA,IAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,QAAA,EAAA,IAAA;AAAA,EAAA,WAAA,EAAA,IAAA;AAAA,CAAA,CAAA,EAAA,yBAAA,CAAA,MAAA,CAAA,SAAA,EAAA,YAAA,EAAA,CAUPC,MAAM,CAAA,EAAA,MAAA,CAAA,wBAAA,CAAA,MAAA,CAAA,SAAA,EAAA,YAAA,CAAA,EAAA,MAAA,CAAA,SAAA,CAAA,EAAA,yBAAA,CAAA,MAAA,CAAA,SAAA,EAAA,YAAA,EAAA,CAWNA,MAAM,CAAA,EAAA,MAAA,CAAA,wBAAA,CAAA,MAAA,CAAA,SAAA,EAAA,YAAA,CAAA,EAAA,MAAA,CAAA,SAAA,CAAA,EAAA,yBAAA,CAAA,MAAA,CAAA,SAAA,EAAA,yBAAA,EAAA,CAMNA,MAAM,CAAA,EAAA,MAAA,CAAA,wBAAA,CAAA,MAAA,CAAA,SAAA,EAAA,yBAAA,CAAA,EAAA,MAAA,CAAA,SAAA,CAAA,GAAA,MAAA,EAAA;AAhCuC,oBAAA,CAAA,QAAA,EAAA,2BAAA,CAAA;;;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { _ as _applyDecoratedDescriptor } from '../../_rollupPluginBabelHelpers-537ad14b.js';
|
|
2
|
+
import { setComponentTemplate } from '@ember/component';
|
|
3
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
4
|
+
import Component from '@glimmer/component';
|
|
5
|
+
import { action } from '@ember/object';
|
|
6
|
+
|
|
7
|
+
var TEMPLATE = hbs("<AuList::Item>\n <AuButton\n @icon=\"add\"\n @iconAlignment=\"left\"\n @skin=\"link\"\n {{on \'click\' this.insertDate}}>\n {{t \"date-plugin.insert.date\"}}\n </AuButton>\n</AuList::Item>\n<AuList::Item>\n <AuButton\n @icon=\"add\"\n @iconAlignment=\"left\"\n @skin=\"link\"\n {{on \'click\' this.insertDateTime}}>\n {{t \"date-plugin.insert.datetime\"}}\n </AuButton>\n</AuList::Item>\n");
|
|
8
|
+
|
|
9
|
+
var _class;
|
|
10
|
+
let RdfaDatePluginInsertComponent = (_class = class RdfaDatePluginInsertComponent extends Component {
|
|
11
|
+
insertDate() {
|
|
12
|
+
const selection = this.args.controller.selection.lastRange;
|
|
13
|
+
this.args.controller.executeCommand('insert-html', '<span datatype="xsd:date" property="ext:content">${date}</span>', selection);
|
|
14
|
+
}
|
|
15
|
+
insertDateTime() {
|
|
16
|
+
const selection = this.args.controller.selection.lastRange;
|
|
17
|
+
this.args.controller.executeCommand('insert-html', '<span datatype="xsd:dateTime" property="ext:content">${date and time}</span>', selection);
|
|
18
|
+
}
|
|
19
|
+
}, (_applyDecoratedDescriptor(_class.prototype, "insertDate", [action], Object.getOwnPropertyDescriptor(_class.prototype, "insertDate"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "insertDateTime", [action], Object.getOwnPropertyDescriptor(_class.prototype, "insertDateTime"), _class.prototype)), _class);
|
|
20
|
+
setComponentTemplate(TEMPLATE, RdfaDatePluginInsertComponent);
|
|
21
|
+
|
|
22
|
+
export { RdfaDatePluginInsertComponent as default };
|
|
23
|
+
//# sourceMappingURL=rdfa-date-plugin-insert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rdfa-date-plugin-insert.js","sources":["../../../src/components/rdfa-date-plugin/rdfa-date-plugin-insert.hbs.js","../../../src/components/rdfa-date-plugin/rdfa-date-plugin-insert.js"],"sourcesContent":["import { hbs } from 'ember-cli-htmlbars';\nexport default hbs(\"<AuList::Item>\\n <AuButton\\n @icon=\\\"add\\\"\\n @iconAlignment=\\\"left\\\"\\n @skin=\\\"link\\\"\\n {{on \\'click\\' this.insertDate}}>\\n {{t \\\"date-plugin.insert.date\\\"}}\\n </AuButton>\\n</AuList::Item>\\n<AuList::Item>\\n <AuButton\\n @icon=\\\"add\\\"\\n @iconAlignment=\\\"left\\\"\\n @skin=\\\"link\\\"\\n {{on \\'click\\' this.insertDateTime}}>\\n {{t \\\"date-plugin.insert.datetime\\\"}}\\n </AuButton>\\n</AuList::Item>\\n\")","import Component from '@glimmer/component';\nimport { action } from '@ember/object';\n\nexport default class RdfaDatePluginInsertComponent extends Component {\n @action\n insertDate() {\n const selection = this.args.controller.selection.lastRange;\n this.args.controller.executeCommand(\n 'insert-html',\n '<span datatype=\"xsd:date\" property=\"ext:content\">${date}</span>',\n selection\n );\n }\n\n @action\n insertDateTime() {\n const selection = this.args.controller.selection.lastRange;\n this.args.controller.executeCommand(\n 'insert-html',\n '<span datatype=\"xsd:dateTime\" property=\"ext:content\">${date and time}</span>',\n selection\n );\n }\n}\n"],"names":["hbs","RdfaDatePluginInsertComponent","Component","insertDate","selection","args","controller","lastRange","executeCommand","insertDateTime","action"],"mappings":";;;;;;AACA,eAAeA,GAAG,CAAC,waAAwa,CAAC;;;ACArZ,IAElBC,6BAA6B,IAAnC,MAAA,GAAA,MAAMA,6BAA6B,SAASC,SAAS,CAAC;AAEnEC,EAAAA,UAAU,GAAG;IACX,MAAMC,SAAS,GAAG,IAAI,CAACC,IAAI,CAACC,UAAU,CAACF,SAAS,CAACG,SAAS,CAAA;AAC1D,IAAA,IAAI,CAACF,IAAI,CAACC,UAAU,CAACE,cAAc,CACjC,aAAa,EACb,iEAAiE,EACjEJ,SAAS,CACV,CAAA;AACH,GAAA;AAGAK,EAAAA,cAAc,GAAG;IACf,MAAML,SAAS,GAAG,IAAI,CAACC,IAAI,CAACC,UAAU,CAACF,SAAS,CAACG,SAAS,CAAA;AAC1D,IAAA,IAAI,CAACF,IAAI,CAACC,UAAU,CAACE,cAAc,CACjC,aAAa,EACb,8EAA8E,EAC9EJ,SAAS,CACV,CAAA;AACH,GAAA;AACF,CAAC,GAAA,yBAAA,CAAA,MAAA,CAAA,SAAA,EAAA,YAAA,EAAA,CAnBEM,MAAM,CAAA,EAAA,MAAA,CAAA,wBAAA,CAAA,MAAA,CAAA,SAAA,EAAA,YAAA,CAAA,EAAA,MAAA,CAAA,SAAA,CAAA,EAAA,yBAAA,CAAA,MAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,CAUNA,MAAM,CAAA,EAAA,MAAA,CAAA,wBAAA,CAAA,MAAA,CAAA,SAAA,EAAA,gBAAA,CAAA,EAAA,MAAA,CAAA,SAAA,CAAA,GAAA,MAAA,EAAA;AAXyC,oBAAA,CAAA,QAAA,EAAA,6BAAA,CAAA;;;;"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { _ as _applyDecoratedDescriptor, a as _initializerDefineProperty } from '../../_rollupPluginBabelHelpers-537ad14b.js';
|
|
2
|
+
import { setComponentTemplate } from '@ember/component';
|
|
3
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
4
|
+
import Component from '@glimmer/component';
|
|
5
|
+
import { action } from '@ember/object';
|
|
6
|
+
import { inject } from '@ember/service';
|
|
7
|
+
import { localCopy } from 'tracked-toolbox';
|
|
8
|
+
|
|
9
|
+
var TEMPLATE = hbs("<AuFormRow>\n <AuDatePicker\n @onChange={{this.onChangeDate}}\n @value={{this.date}}\n @label={{t \"date-plugin.card.label\"}}\n @localization={{this.datePickerLocalization}}/>\n</AuFormRow>\n{{#unless @onlyDate}}\n <AuFormRow>\n <AuTimePicker\n @hoursLabel={{t \"date-plugin.card.hours\"}}\n @minutesLabel={{t \"date-plugin.card.minutes\"}}\n @nowLabel={{t \"date-plugin.card.now\"}}\n @hours={{this.hours}}\n @minutes={{this.minutes}}\n @showSeconds={{false}}\n @showNow={{true}}\n @onChange={{this.onChangeTime}}\n />\n </AuFormRow>\n{{/unless}}\n");
|
|
10
|
+
|
|
11
|
+
var _dec, _class, _descriptor, _descriptor2;
|
|
12
|
+
let RdfaDateTimePicker = (_dec = localCopy('args.value'), (_class = class RdfaDateTimePicker extends Component {
|
|
13
|
+
constructor(...args) {
|
|
14
|
+
super(...args);
|
|
15
|
+
_initializerDefineProperty(this, "intl", _descriptor, this);
|
|
16
|
+
_initializerDefineProperty(this, "date", _descriptor2, this);
|
|
17
|
+
}
|
|
18
|
+
get hours() {
|
|
19
|
+
return this.date.getHours();
|
|
20
|
+
}
|
|
21
|
+
get minutes() {
|
|
22
|
+
return this.date.getMinutes();
|
|
23
|
+
}
|
|
24
|
+
get datePickerLocalization() {
|
|
25
|
+
return {
|
|
26
|
+
buttonLabel: this.intl.t('auDatePicker.buttonLabel'),
|
|
27
|
+
selectedDateMessage: this.intl.t('auDatePicker.selectedDateMessage'),
|
|
28
|
+
prevMonthLabel: this.intl.t('auDatePicker.prevMonthLabel'),
|
|
29
|
+
nextMonthLabel: this.intl.t('auDatePicker.nextMonthLabel'),
|
|
30
|
+
monthSelectLabel: this.intl.t('auDatePicker.monthSelectLabel'),
|
|
31
|
+
yearSelectLabel: this.intl.t('auDatePicker.yearSelectLabel'),
|
|
32
|
+
closeLabel: this.intl.t('auDatePicker.closeLabel'),
|
|
33
|
+
keyboardInstruction: this.intl.t('auDatePicker.keyboardInstruction'),
|
|
34
|
+
calendarHeading: this.intl.t('auDatePicker.calendarHeading'),
|
|
35
|
+
dayNames: getLocalizedDays(this.intl),
|
|
36
|
+
monthNames: getLocalizedMonths(this.intl),
|
|
37
|
+
monthNamesShort: getLocalizedMonths(this.intl, 'short')
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
onChangeDate(isoDate, date) {
|
|
41
|
+
let wasDateInputCleared = !date;
|
|
42
|
+
if (!wasDateInputCleared) {
|
|
43
|
+
if (!this.date) {
|
|
44
|
+
this.date = new Date();
|
|
45
|
+
}
|
|
46
|
+
this.date.setDate(date.getDate());
|
|
47
|
+
this.date.setMonth(date.getMonth());
|
|
48
|
+
this.date.setFullYear(date.getFullYear());
|
|
49
|
+
this.args.onChange(this.date);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
onChangeTime(timeObject) {
|
|
53
|
+
if (!this.date) this.date = new Date();
|
|
54
|
+
this.date.setHours(timeObject.hours);
|
|
55
|
+
this.date.setMinutes(timeObject.minutes);
|
|
56
|
+
this.args.onChange(this.date);
|
|
57
|
+
}
|
|
58
|
+
}, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "intl", [inject], {
|
|
59
|
+
configurable: true,
|
|
60
|
+
enumerable: true,
|
|
61
|
+
writable: true,
|
|
62
|
+
initializer: null
|
|
63
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "date", [_dec], {
|
|
64
|
+
configurable: true,
|
|
65
|
+
enumerable: true,
|
|
66
|
+
writable: true,
|
|
67
|
+
initializer: null
|
|
68
|
+
}), _applyDecoratedDescriptor(_class.prototype, "onChangeDate", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onChangeDate"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "onChangeTime", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onChangeTime"), _class.prototype)), _class));
|
|
69
|
+
function getLocalizedMonths(intl, monthFormat = 'long') {
|
|
70
|
+
let someYear = 2021;
|
|
71
|
+
return [...Array(12).keys()].map(monthIndex => {
|
|
72
|
+
let date = new Date(someYear, monthIndex);
|
|
73
|
+
return intl.formatDate(date, {
|
|
74
|
+
month: monthFormat
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function getLocalizedDays(intl, weekdayFormat = 'long') {
|
|
79
|
+
let someSunday = new Date('2021-01-03');
|
|
80
|
+
return [...Array(7).keys()].map(index => {
|
|
81
|
+
let weekday = new Date(someSunday.getTime());
|
|
82
|
+
weekday.setDate(someSunday.getDate() + index);
|
|
83
|
+
return intl.formatDate(weekday, {
|
|
84
|
+
weekday: weekdayFormat
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
setComponentTemplate(TEMPLATE, RdfaDateTimePicker);
|
|
89
|
+
|
|
90
|
+
export { RdfaDateTimePicker as default };
|
|
91
|
+
//# sourceMappingURL=rdfa-date-time-picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rdfa-date-time-picker.js","sources":["../../../src/components/rdfa-date-plugin/rdfa-date-time-picker.hbs.js","../../../src/components/rdfa-date-plugin/rdfa-date-time-picker.js"],"sourcesContent":["import { hbs } from 'ember-cli-htmlbars';\nexport default hbs(\"<AuFormRow>\\n <AuDatePicker\\n @onChange={{this.onChangeDate}}\\n @value={{this.date}}\\n @label={{t \\\"date-plugin.card.label\\\"}}\\n @localization={{this.datePickerLocalization}}/>\\n</AuFormRow>\\n{{#unless @onlyDate}}\\n <AuFormRow>\\n <AuTimePicker\\n @hoursLabel={{t \\\"date-plugin.card.hours\\\"}}\\n @minutesLabel={{t \\\"date-plugin.card.minutes\\\"}}\\n @nowLabel={{t \\\"date-plugin.card.now\\\"}}\\n @hours={{this.hours}}\\n @minutes={{this.minutes}}\\n @showSeconds={{false}}\\n @showNow={{true}}\\n @onChange={{this.onChangeTime}}\\n />\\n </AuFormRow>\\n{{/unless}}\\n\")","import Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { inject as service } from '@ember/service';\nimport { localCopy } from 'tracked-toolbox';\n\nexport default class RdfaDateTimePicker extends Component {\n @service intl;\n @localCopy('args.value') date;\n\n get hours() {\n return this.date.getHours();\n }\n\n get minutes() {\n return this.date.getMinutes();\n }\n\n get datePickerLocalization() {\n return {\n buttonLabel: this.intl.t('auDatePicker.buttonLabel'),\n selectedDateMessage: this.intl.t('auDatePicker.selectedDateMessage'),\n prevMonthLabel: this.intl.t('auDatePicker.prevMonthLabel'),\n nextMonthLabel: this.intl.t('auDatePicker.nextMonthLabel'),\n monthSelectLabel: this.intl.t('auDatePicker.monthSelectLabel'),\n yearSelectLabel: this.intl.t('auDatePicker.yearSelectLabel'),\n closeLabel: this.intl.t('auDatePicker.closeLabel'),\n keyboardInstruction: this.intl.t('auDatePicker.keyboardInstruction'),\n calendarHeading: this.intl.t('auDatePicker.calendarHeading'),\n dayNames: getLocalizedDays(this.intl),\n monthNames: getLocalizedMonths(this.intl),\n monthNamesShort: getLocalizedMonths(this.intl, 'short'),\n };\n }\n\n @action\n onChangeDate(isoDate, date) {\n let wasDateInputCleared = !date;\n if (!wasDateInputCleared) {\n if (!this.date) {\n this.date = new Date();\n }\n this.date.setDate(date.getDate());\n this.date.setMonth(date.getMonth());\n this.date.setFullYear(date.getFullYear());\n this.args.onChange(this.date);\n }\n }\n\n @action\n onChangeTime(timeObject) {\n if (!this.date) this.date = new Date();\n this.date.setHours(timeObject.hours);\n this.date.setMinutes(timeObject.minutes);\n this.args.onChange(this.date);\n }\n}\n\nfunction getLocalizedMonths(intl, monthFormat = 'long') {\n let someYear = 2021;\n return [...Array(12).keys()].map((monthIndex) => {\n let date = new Date(someYear, monthIndex);\n return intl.formatDate(date, { month: monthFormat });\n });\n}\n\nfunction getLocalizedDays(intl, weekdayFormat = 'long') {\n let someSunday = new Date('2021-01-03');\n return [...Array(7).keys()].map((index) => {\n let weekday = new Date(someSunday.getTime());\n weekday.setDate(someSunday.getDate() + index);\n return intl.formatDate(weekday, { weekday: weekdayFormat });\n });\n}\n"],"names":["hbs","RdfaDateTimePicker","localCopy","Component","hours","date","getHours","minutes","getMinutes","datePickerLocalization","buttonLabel","intl","t","selectedDateMessage","prevMonthLabel","nextMonthLabel","monthSelectLabel","yearSelectLabel","closeLabel","keyboardInstruction","calendarHeading","dayNames","getLocalizedDays","monthNames","getLocalizedMonths","monthNamesShort","onChangeDate","isoDate","wasDateInputCleared","Date","setDate","getDate","setMonth","getMonth","setFullYear","getFullYear","args","onChange","onChangeTime","timeObject","setHours","setMinutes","service","action","monthFormat","someYear","Array","keys","map","monthIndex","formatDate","month","weekdayFormat","someSunday","index","weekday","getTime"],"mappings":";;;;;;;;AACA,eAAeA,GAAG,CAAC,umBAAumB,CAAC;;;ACItmBC,IAAAA,kBAAkB,IAEpCC,IAAAA,GAAAA,SAAS,CAA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AGiB,KAAK,CAAC,CAAC,CAAC,CAACC,IAAI,EAAE,CAAC,CAACC,GAAG,CAAEM,KAAK,IAAK;IACzC,IAAIC,OAAO,GAAG,IAAI1B,IAAI,CAACwB,UAAU,CAACG,OAAO,EAAE,CAAC,CAAA;IAC5CD,OAAO,CAACzB,OAAO,CAACuB,UAAU,CAACtB,OAAO,EAAE,GAAGuB,KAAK,CAAC,CAAA;AAC7C,IAAA,OAAO3C,IAAI,CAACuC,UAAU,CAACK,OAAO,EAAE;AAAEA,MAAAA,OAAO,EAAEH,aAAAA;AAAc,KAAC,CAAC,CAAA;AAC7D,GAAC,CAAC,CAAA;AACJ,CAAA;AAAC,oBAAA,CAAA,QAAA,EAAA,kBAAA,CAAA;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { setComponentTemplate } from '@ember/component';
|
|
2
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
3
|
+
import Component from '@glimmer/component';
|
|
4
|
+
|
|
5
|
+
var TEMPLATE = hbs("<StandardTemplatePlugin::TemplateProvider @controller={{@controller}} as |provider|>\n {{#if provider.hasApplicableTemplates}}\n {{#each provider.applicableTemplates as |template|}}\n <AuList::Item>\n <AuButton\n @skin=\"link\"\n @icon=\"add\"\n @iconAlignment=\"left\"\n {{on \"click\" (fn provider.insert template)}}\n >\n {{template.title}}\n </AuButton>\n </AuList::Item>\n {{/each}}\n {{/if}}\n</StandardTemplatePlugin::TemplateProvider>");
|
|
6
|
+
|
|
7
|
+
class StandardTemplateTemplateCardComponent extends Component {
|
|
8
|
+
get controller() {
|
|
9
|
+
return this.args.controller;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
setComponentTemplate(TEMPLATE, StandardTemplateTemplateCardComponent);
|
|
13
|
+
|
|
14
|
+
export { StandardTemplateTemplateCardComponent as default };
|
|
15
|
+
//# sourceMappingURL=template-card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-card.js","sources":["../../../src/components/standard-template-plugin/template-card.hbs.js","../../../src/components/standard-template-plugin/template-card.js"],"sourcesContent":["import { hbs } from 'ember-cli-htmlbars';\nexport default hbs(\"<StandardTemplatePlugin::TemplateProvider @controller={{@controller}} as |provider|>\\n {{#if provider.hasApplicableTemplates}}\\n {{#each provider.applicableTemplates as |template|}}\\n <AuList::Item>\\n <AuButton\\n @skin=\\\"link\\\"\\n @icon=\\\"add\\\"\\n @iconAlignment=\\\"left\\\"\\n {{on \\\"click\\\" (fn provider.insert template)}}\\n >\\n {{template.title}}\\n </AuButton>\\n </AuList::Item>\\n {{/each}}\\n {{/if}}\\n</StandardTemplatePlugin::TemplateProvider>\")","import Component from '@glimmer/component';\n\nexport default class StandardTemplateTemplateCardComponent extends Component {\n get controller() {\n return this.args.controller;\n }\n}\n"],"names":["hbs","StandardTemplateTemplateCardComponent","Component","controller","args"],"mappings":";;;;AACA,eAAeA,GAAG,CAAC,ghBAAghB,CAAC;;ACCrhB,MAAMC,qCAAqC,SAASC,SAAS,CAAC;AAC3E,EAAA,IAAIC,UAAU,GAAG;AACf,IAAA,OAAO,IAAI,CAACC,IAAI,CAACD,UAAU,CAAA;AAC7B,GAAA;AACF,CAAA;AAAC,oBAAA,CAAA,QAAA,EAJoBF,qCAAqC,CAAA;;;;"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { _ as _applyDecoratedDescriptor, a as _initializerDefineProperty } from '../../_rollupPluginBabelHelpers-537ad14b.js';
|
|
2
|
+
import { setComponentTemplate } from '@ember/component';
|
|
3
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
4
|
+
import Component from '@glimmer/component';
|
|
5
|
+
import { action } from '@ember/object';
|
|
6
|
+
import { tracked } from '@glimmer/tracking';
|
|
7
|
+
import { inject } from '@ember/service';
|
|
8
|
+
import { v4 } from 'uuid';
|
|
9
|
+
|
|
10
|
+
var TEMPLATE = hbs("{{yield (hash\n applicableTemplates=this.applicableTemplates\n hasApplicableTemplates=this.hasApplicableTemplates\n busy=this.busy\n insert=this.insert\n )}}");
|
|
11
|
+
|
|
12
|
+
function memoize(func) {
|
|
13
|
+
let cache = {};
|
|
14
|
+
return function () {
|
|
15
|
+
let args = JSON.stringify(arguments);
|
|
16
|
+
cache[args] = cache[args] || func.apply(this, arguments);
|
|
17
|
+
return cache[args];
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Given a template string, we instantiate uuids by matching
|
|
23
|
+
* ${generateUuid()} pattern in the string and evaluating generateUuid()
|
|
24
|
+
*
|
|
25
|
+
* Note: the general approach is similar to converting a string to a template literal, but since
|
|
26
|
+
* this approach does not work in IE, we had to fall back to plain regex matching.
|
|
27
|
+
*
|
|
28
|
+
* @method instantiateUuids
|
|
29
|
+
* @param {String} templateString
|
|
30
|
+
*
|
|
31
|
+
* @return {String} template string with instantiated uuids
|
|
32
|
+
*
|
|
33
|
+
* @private
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
function determineFunction(string) {
|
|
37
|
+
switch (string) {
|
|
38
|
+
case 'generateUuid()':
|
|
39
|
+
return v4;
|
|
40
|
+
case 'generateBoundUuid()':
|
|
41
|
+
return memoize(v4);
|
|
42
|
+
default:
|
|
43
|
+
throw new Error(`Could not convert ${string} to function`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function instantiateUuids(templateString) {
|
|
47
|
+
return templateString.replace(/\$\{.+?}/g, match => {
|
|
48
|
+
//input '${content}' and eval('content')
|
|
49
|
+
return determineFunction(match.substring(2, match.length - 1))();
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
var _class, _descriptor, _descriptor2;
|
|
54
|
+
let TemplateProviderComponent = (_class = class TemplateProviderComponent extends Component {
|
|
55
|
+
constructor() {
|
|
56
|
+
super(...arguments);
|
|
57
|
+
_initializerDefineProperty(this, "standardTemplatePlugin", _descriptor, this);
|
|
58
|
+
_initializerDefineProperty(this, "applicableTemplates", _descriptor2, this);
|
|
59
|
+
this.args.controller.onEvent('selectionChanged', this.trackSelectionChange);
|
|
60
|
+
}
|
|
61
|
+
get busy() {
|
|
62
|
+
return this.standardTemplatePlugin.fetchTemplates.isRunning;
|
|
63
|
+
}
|
|
64
|
+
get controller() {
|
|
65
|
+
return this.args.controller;
|
|
66
|
+
}
|
|
67
|
+
get hasApplicableTemplates() {
|
|
68
|
+
return this.applicableTemplates.length > 0;
|
|
69
|
+
}
|
|
70
|
+
templateIsApplicable(template) {
|
|
71
|
+
const selectedRange = this.controller.selection.lastRange;
|
|
72
|
+
if (!selectedRange) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
const rangeStore = this.controller.datastore.limitToRange(selectedRange, 'rangeIsInside');
|
|
76
|
+
const containsTypes = rangeStore.match(null, 'a').dataset.some(quad => {
|
|
77
|
+
return template.contexts.includes(quad.object.value);
|
|
78
|
+
});
|
|
79
|
+
const containsDisabledTypes = rangeStore.match(null, 'a').dataset.some(quad => template.disabledInContexts.includes(quad.object.value));
|
|
80
|
+
return containsTypes && !containsDisabledTypes;
|
|
81
|
+
}
|
|
82
|
+
trackSelectionChange() {
|
|
83
|
+
this.applicableTemplates = this.standardTemplatePlugin.fetchTemplates.last.value?.filter(template => this.templateIsApplicable(template)) || [];
|
|
84
|
+
}
|
|
85
|
+
async insert(template) {
|
|
86
|
+
await template.reload();
|
|
87
|
+
let insertRange = this.controller.selection.lastRange;
|
|
88
|
+
if (insertRange.getMarks().hasMarkName('highlighted')) {
|
|
89
|
+
insertRange = this.controller.rangeFactory.fromAroundNode(insertRange.getCommonAncestor());
|
|
90
|
+
}
|
|
91
|
+
this.controller.executeCommand('insert-html', instantiateUuids(template.body), insertRange, 'right');
|
|
92
|
+
}
|
|
93
|
+
}, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "standardTemplatePlugin", [inject], {
|
|
94
|
+
configurable: true,
|
|
95
|
+
enumerable: true,
|
|
96
|
+
writable: true,
|
|
97
|
+
initializer: null
|
|
98
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "applicableTemplates", [tracked], {
|
|
99
|
+
configurable: true,
|
|
100
|
+
enumerable: true,
|
|
101
|
+
writable: true,
|
|
102
|
+
initializer: function () {
|
|
103
|
+
return [];
|
|
104
|
+
}
|
|
105
|
+
}), _applyDecoratedDescriptor(_class.prototype, "trackSelectionChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "trackSelectionChange"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "insert", [action], Object.getOwnPropertyDescriptor(_class.prototype, "insert"), _class.prototype)), _class);
|
|
106
|
+
setComponentTemplate(TEMPLATE, TemplateProviderComponent);
|
|
107
|
+
|
|
108
|
+
export { TemplateProviderComponent as default };
|
|
109
|
+
//# sourceMappingURL=template-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-provider.js","sources":["../../../src/components/standard-template-plugin/template-provider.hbs.js","../../../src/utils/memoize.js","../../../src/utils/instantiate-uuids.js","../../../src/components/standard-template-plugin/template-provider.js"],"sourcesContent":["import { hbs } from 'ember-cli-htmlbars';\nexport default hbs(\"{{yield (hash\\n applicableTemplates=this.applicableTemplates\\n hasApplicableTemplates=this.hasApplicableTemplates\\n busy=this.busy\\n insert=this.insert\\n )}}\")","export default function memoize(func) {\n let cache = {};\n return function () {\n let args = JSON.stringify(arguments);\n cache[args] = cache[args] || func.apply(this, arguments);\n return cache[args];\n };\n}\n","import memoize from '../utils/memoize';\nimport { v4 as uuidv4 } from 'uuid';\n\n/**\n * Given a template string, we instantiate uuids by matching\n * ${generateUuid()} pattern in the string and evaluating generateUuid()\n *\n * Note: the general approach is similar to converting a string to a template literal, but since\n * this approach does not work in IE, we had to fall back to plain regex matching.\n *\n * @method instantiateUuids\n * @param {String} templateString\n *\n * @return {String} template string with instantiated uuids\n *\n * @private\n */\n\nfunction determineFunction(string) {\n switch (string) {\n case 'generateUuid()':\n return uuidv4;\n case 'generateBoundUuid()':\n return memoize(uuidv4);\n default:\n throw new Error(`Could not convert ${string} to function`);\n }\n}\nexport default function instantiateUuids(templateString) {\n return templateString.replace(/\\$\\{.+?}/g, (match) => {\n //input '${content}' and eval('content')\n return determineFunction(match.substring(2, match.length - 1))();\n });\n}\n","import Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { tracked } from '@glimmer/tracking';\nimport { inject as service } from '@ember/service';\nimport instantiateUuids from '../../utils/instantiate-uuids';\n\nexport default class TemplateProviderComponent extends Component {\n @service standardTemplatePlugin;\n @tracked applicableTemplates = [];\n\n constructor() {\n super(...arguments);\n this.args.controller.onEvent('selectionChanged', this.trackSelectionChange);\n }\n\n get busy() {\n return this.standardTemplatePlugin.fetchTemplates.isRunning;\n }\n\n get controller() {\n return this.args.controller;\n }\n\n get hasApplicableTemplates() {\n return this.applicableTemplates.length > 0;\n }\n\n templateIsApplicable(template) {\n const selectedRange = this.controller.selection.lastRange;\n if (!selectedRange) {\n return false;\n }\n const rangeStore = this.controller.datastore.limitToRange(\n selectedRange,\n 'rangeIsInside'\n );\n\n const containsTypes = rangeStore.match(null, 'a').dataset.some((quad) => {\n return template.contexts.includes(quad.object.value);\n });\n\n const containsDisabledTypes = rangeStore\n .match(null, 'a')\n .dataset.some((quad) =>\n template.disabledInContexts.includes(quad.object.value)\n );\n\n return containsTypes && !containsDisabledTypes;\n }\n\n @action\n trackSelectionChange() {\n this.applicableTemplates =\n this.standardTemplatePlugin.fetchTemplates.last.value?.filter(\n (template) => this.templateIsApplicable(template)\n ) || [];\n }\n\n @action\n async insert(template) {\n await template.reload();\n let insertRange = this.controller.selection.lastRange;\n if (insertRange.getMarks().hasMarkName('highlighted')) {\n insertRange = this.controller.rangeFactory.fromAroundNode(\n insertRange.getCommonAncestor()\n );\n }\n this.controller.executeCommand(\n 'insert-html',\n instantiateUuids(template.body),\n insertRange,\n 'right'\n );\n }\n}\n"],"names":["hbs","memoize","func","cache","args","JSON","stringify","arguments","apply","determineFunction","string","uuidv4","Error","instantiateUuids","templateString","replace","match","substring","length","TemplateProviderComponent","Component","constructor","controller","onEvent","trackSelectionChange","busy","standardTemplatePlugin","fetchTemplates","isRunning","hasApplicableTemplates","applicableTemplates","templateIsApplicable","template","selectedRange","selection","lastRange","rangeStore","datastore","limitToRange","containsTypes","dataset","some","quad","contexts","includes","object","value","containsDisabledTypes","disabledInContexts","last","filter","insert","reload","insertRange","getMarks","hasMarkName","rangeFactory","fromAroundNode","getCommonAncestor","executeCommand","body","service","tracked","action"],"mappings":";;;;;;;;;AACA,eAAeA,GAAG,CAAC,0MAA0M,CAAC;;ACD/M,SAASC,OAAO,CAACC,IAAI,EAAE;EACpC,IAAIC,KAAK,GAAG,EAAE,CAAA;AACd,EAAA,OAAO,YAAY;AACjB,IAAA,IAAIC,IAAI,GAAGC,IAAI,CAACC,SAAS,CAACC,SAAS,CAAC,CAAA;AACpCJ,IAAAA,KAAK,CAACC,IAAI,CAAC,GAAGD,KAAK,CAACC,IAAI,CAAC,IAAIF,IAAI,CAACM,KAAK,CAAC,IAAI,EAAED,SAAS,CAAC,CAAA;IACxD,OAAOJ,KAAK,CAACC,IAAI,CAAC,CAAA;GACnB,CAAA;AACH;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASK,iBAAiB,CAACC,MAAM,EAAE;AACjC,EAAA,QAAQA,MAAM;AACZ,IAAA,KAAK,gBAAgB;AACnB,MAAA,OAAOC,EAAM,CAAA;AACf,IAAA,KAAK,qBAAqB;MACxB,OAAOV,OAAO,CAACU,EAAM,CAAC,CAAA;AACxB,IAAA;AACE,MAAA,MAAM,IAAIC,KAAK,CAAE,CAAoBF,kBAAAA,EAAAA,MAAO,cAAa,CAAC,CAAA;AAAC,GAAA;AAEjE,CAAA;AACe,SAASG,gBAAgB,CAACC,cAAc,EAAE;AACvD,EAAA,OAAOA,cAAc,CAACC,OAAO,CAAC,WAAW,EAAGC,KAAK,IAAK;AACpD;AACA,IAAA,OA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,GAAA;AACF,CAAC,wFAnEEQ,MAAO,CAAA,EAAA;AAAA,EAAA,YAAA,EAAA,IAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,QAAA,EAAA,IAAA;AAAA,EAAA,WAAA,EAAA,IAAA;AAAA,CAAA,CAAA,EAAA,YAAA,GAAA,yBAAA,CAAA,MAAA,CAAA,SAAA,EAAA,qBAAA,EAAA,CACPC,OAAO,CAAA,EAAA;AAAA,EAAA,YAAA,EAAA,IAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,QAAA,EAAA,IAAA;AAAA,EAAA,WAAA,EAAA,YAAA;AAAA,IAAA,OAAuB,EAAE,CAAA;AAAA,GAAA;AAAA,CA0ChCC,CAAAA,EAAAA,yBAAAA,CAAAA,MAAAA,CAAAA,SAAAA,EAAAA,sBAAAA,EAAAA,CAAAA,MAAM,wJAQNA,MAAM,CAAA,EAAA,MAAA,CAAA,wBAAA,CAAA,MAAA,CAAA,SAAA,EAAA,QAAA,CAAA,EAAA,MAAA,CAAA,SAAA,CAAA,GAAA,MAAA,EAAA;AApDqC,oBAAA,CAAA,QAAA,EAAA,yBAAA,CAAA;;;;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { _ as _applyDecoratedDescriptor, a as _initializerDefineProperty } from '../../_rollupPluginBabelHelpers-537ad14b.js';
|
|
2
|
+
import { setComponentTemplate } from '@ember/component';
|
|
3
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
4
|
+
import { action } from '@ember/object';
|
|
5
|
+
import Component from '@glimmer/component';
|
|
6
|
+
import { tracked } from '@glimmer/tracking';
|
|
7
|
+
|
|
8
|
+
var TEMPLATE = hbs("<AuCard @flex={{true}} @divided={{true}} @expandable={{false}} @shadow={{true}} @size=\"flush\" as |c|>\n <c.content class=\"au-c-content--small\">\n <AuToggleSwitch @label={{t \"table-of-contents-plugin.toggle\" }} @checked={{this.toggled}} @onChange={{this.toggle}} />\n </c.content>\n</AuCard>");
|
|
9
|
+
|
|
10
|
+
var _class, _descriptor;
|
|
11
|
+
let TableOfContentsCardComponent = (_class = class TableOfContentsCardComponent extends Component {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
_initializerDefineProperty(this, "toggled", _descriptor, this);
|
|
15
|
+
this.toggled = this.tableOfContentsInstances.length !== 0;
|
|
16
|
+
this.args.controller.onEvent('modelWritten', () => {
|
|
17
|
+
this.toggled = this.tableOfContentsInstances.length !== 0;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
get tableOfContentsInstances() {
|
|
21
|
+
return this.args.controller.getComponentInstances({
|
|
22
|
+
componentName: 'table-of-contents-plugin/inline-components/table-of-contents'
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
get tableOfContentsProps() {
|
|
26
|
+
return this.args.widgetArgs.config ? {
|
|
27
|
+
config: this.args.widgetArgs.config
|
|
28
|
+
} : {};
|
|
29
|
+
}
|
|
30
|
+
toggle() {
|
|
31
|
+
if (this.toggled) {
|
|
32
|
+
// Remove instances from table of contents
|
|
33
|
+
this.tableOfContentsInstances.forEach(instance => {
|
|
34
|
+
const model = instance.componentController.model;
|
|
35
|
+
this.args.controller.executeCommand('remove-component', model);
|
|
36
|
+
});
|
|
37
|
+
} else {
|
|
38
|
+
// Add table of contents
|
|
39
|
+
console.log(this.tableOfContentsProps);
|
|
40
|
+
this.args.controller.executeCommand('insert-component', 'table-of-contents-plugin/inline-components/table-of-contents', this.tableOfContentsProps, false, this.args.controller.rangeFactory.fromInElement(this.args.controller.modelRoot, 0, 0));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "toggled", [tracked], {
|
|
44
|
+
configurable: true,
|
|
45
|
+
enumerable: true,
|
|
46
|
+
writable: true,
|
|
47
|
+
initializer: null
|
|
48
|
+
}), _applyDecoratedDescriptor(_class.prototype, "toggle", [action], Object.getOwnPropertyDescriptor(_class.prototype, "toggle"), _class.prototype)), _class);
|
|
49
|
+
setComponentTemplate(TEMPLATE, TableOfContentsCardComponent);
|
|
50
|
+
|
|
51
|
+
export { TableOfContentsCardComponent as default };
|
|
52
|
+
//# sourceMappingURL=card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.js","sources":["../../../src/components/table-of-contents-plugin/card.hbs.js","../../../src/components/table-of-contents-plugin/card.js"],"sourcesContent":["import { hbs } from 'ember-cli-htmlbars';\nexport default hbs(\"<AuCard @flex={{true}} @divided={{true}} @expandable={{false}} @shadow={{true}} @size=\\\"flush\\\" as |c|>\\n <c.content class=\\\"au-c-content--small\\\">\\n <AuToggleSwitch @label={{t \\\"table-of-contents-plugin.toggle\\\" }} @checked={{this.toggled}} @onChange={{this.toggle}} />\\n </c.content>\\n</AuCard>\")","import { action } from '@ember/object';\nimport Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\n\nexport default class TableOfContentsCardComponent extends Component {\n @tracked toggled;\n\n constructor() {\n super(...arguments);\n this.toggled = this.tableOfContentsInstances.length !== 0;\n this.args.controller.onEvent('modelWritten', () => {\n this.toggled = this.tableOfContentsInstances.length !== 0;\n });\n }\n\n get tableOfContentsInstances() {\n return this.args.controller.getComponentInstances({\n componentName:\n 'table-of-contents-plugin/inline-components/table-of-contents',\n });\n }\n\n get tableOfContentsProps() {\n return this.args.widgetArgs.config\n ? { config: this.args.widgetArgs.config }\n : {};\n }\n\n @action\n toggle() {\n if (this.toggled) {\n // Remove instances from table of contents\n this.tableOfContentsInstances.forEach((instance) => {\n const model = instance.componentController.model;\n this.args.controller.executeCommand('remove-component', model);\n });\n } else {\n // Add table of contents\n console.log(this.tableOfContentsProps);\n this.args.controller.executeCommand(\n 'insert-component',\n 'table-of-contents-plugin/inline-components/table-of-contents',\n this.tableOfContentsProps,\n false,\n this.args.controller.rangeFactory.fromInElement(\n this.args.controller.modelRoot,\n 0,\n 0\n )\n );\n }\n }\n}\n"],"names":["hbs","TableOfContentsCardComponent","Component","constructor","arguments","toggled","tableOfContentsInstances","length","args","controller","onEvent","getComponentInstances","componentName","tableOfContentsProps","widgetArgs","config","toggle","forEach","instance","model","componentController","executeCommand","console","log","rangeFactory","fromInElement","modelRoot","tracked","action"],"mappings":";;;;;;;AACA,eAAeA,GAAG,CAAC,+SAA+S,CAAC;;;ACCvR,IAEvBC,4BAA4B,IAAlC,MAAA,GAAA,MAAMA,4BAA4B,SAASC,SAAS,CAAC;AAGlEC,EAAAA,WAAW,GAAG;IACZ,KAAK,CAAC,GAAGC,SAAS,CAAC,CAAA;AAAC,IAAA,0BAAA,CAAA,IAAA,EAAA,SAAA,EAAA,WAAA,EAAA,IAAA,CAAA,CAAA;IACpB,IAAI,CAACC,OAAO,GAAG,IAAI,CAACC,wBAAwB,CAACC,MAAM,KAAK,CAAC,CAAA;IACzD,IAAI,CAACC,IAAI,CAACC,UAAU,CAACC,OAAO,CAAC,cAAc,EAAE,MAAM;MACjD,IAAI,CAACL,OAAO,GAAG,IAAI,CAACC,wBAAwB,CAACC,MAAM,KAAK,CAAC,CAAA;AAC3D,KAAC,CAAC,CAAA;AACJ,GAAA;AAEA,EAAA,IAAID,wBAAwB,GAAG;AAC7B,IAAA,OAAO,IAAI,CAACE,IAAI,CAACC,UAAU,CAACE,qBAAqB,CAAC;AAChDC,MAAAA,aAAa,EACX,8DAAA;AACJ,KAAC,CAAC,CAAA;AACJ,GAAA;AAEA,EAAA,IAAIC,oBAAoB,GAAG;AACzB,IAAA,OAAO,IAAI,CAACL,IAAI,CAACM,UAAU,CAACC,MAAM,GAC9B;AAAEA,MAAAA,MAAM,EAAE,IAAI,CAACP,IAAI,CAACM,UAAU,CAACC,MAAAA;KAAQ,GACvC,EAAE,CAAA;AACR,GAAA;AAGAC,EAAAA,MAAM,GAAG;IACP,IAAI,IAAI,CAACX,OAAO,EAAE;AAChB;AACA,MAAA,IAAI,CAACC,wBAAwB,CAACW,OAAO,CAAEC,QAAQ,IAAK;AAClD,QAAA,MAAMC,KAAK,GAAGD,QAAQ,CAACE,mBAAmB,CAACD,KAAK,CAAA;QAChD,IAAI,CAACX,IAAI,CAACC,UAAU,CAACY,cAAc,CAAC,kBAAkB,EAAEF,KAAK,CAAC,CAAA;AAChE,OAAC,CAAC,CAAA;AACJ,KAAC,MAAM;AACL;AACAG,MAAAA,OAAO,CAACC,GAAG,CAAC,IAAI,CAACV,oBAAoB,CAAC,CAAA;AACtC,MAAA,IAAI,CAACL,IAAI,CAACC,UAAU,CAACY,cAAc,CACjC,kBAAkB,EAClB,8DAA8D,EAC9D,IAAI,CAACR,oBAAoB,EACzB,KAAK,EACL,IAAI,CAACL,IAAI,CAACC,UAAU,CAACe,YAAY,CAACC,aAAa,CAC7C,IAAI,CAACjB,IAAI,CAACC,UAAU,CAACiB,SAAS,EAC9B,CAAC,EACD,CAAC,CACF,CACF,CAAA;AACH,KAAA;AACF,GAAA;AACF,CAAC,yEA/CEC,OAAO,CAAA,EAAA;AAAA,EAAA,YAAA,EAAA,IAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,QAAA,EAAA,IAAA;AAAA,EAAA,WAAA,EAAA,IAAA;AAAA,CAAA,CAAA,EAAA,yBAAA,CAAA,MAAA,CAAA,SAAA,EAAA,QAAA,EAAA,CAuBPC,MAAM,CAAA,EAAA,MAAA,CAAA,wBAAA,CAAA,MAAA,CAAA,SAAA,EAAA,QAAA,CAAA,EAAA,MAAA,CAAA,SAAA,CAAA,GAAA,MAAA,EAAA;AAxBwC,oBAAA,CAAA,QAAA,EAAA,4BAAA,CAAA;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { setComponentTemplate } from '@ember/component';
|
|
2
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
3
|
+
import templateOnly from '@ember/component/template-only';
|
|
4
|
+
|
|
5
|
+
var TEMPLATE = hbs("<AuList @divider={{true}} class=\'table-of-contents\'>\n {{#each @entries as |outlineEntry|}}\n <AuList::Item>\n <AuButton\n @wrap={{true}}\n {{! template-lint-disable no-capital-arguments }}\n @block={{true}}\n @skin=\'link-secondary\'\n onclick={{fn @onEntryClick outlineEntry.node}}\n >\n {{outlineEntry.content}}\n </AuButton>\n {{#if outlineEntry.children}}\n <InlineComponents::Outline\n @entries={{outlineEntry.children}}\n @onEntryClick={{@onEntryClick}}\n />\n {{/if}}\n </AuList::Item>\n {{/each}}\n</AuList>\n");
|
|
6
|
+
|
|
7
|
+
var outline = setComponentTemplate(TEMPLATE, templateOnly());
|
|
8
|
+
|
|
9
|
+
export { outline as default };
|
|
10
|
+
//# sourceMappingURL=outline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outline.js","sources":["../../../../src/components/table-of-contents-plugin/inline-components/outline.hbs.js","../../../../src/components/table-of-contents-plugin/inline-components/outline.js"],"sourcesContent":["import { hbs } from 'ember-cli-htmlbars';\nexport default hbs(\"<AuList @divider={{true}} class=\\'table-of-contents\\'>\\n {{#each @entries as |outlineEntry|}}\\n <AuList::Item>\\n <AuButton\\n @wrap={{true}}\\n {{! template-lint-disable no-capital-arguments }}\\n @block={{true}}\\n @skin=\\'link-secondary\\'\\n onclick={{fn @onEntryClick outlineEntry.node}}\\n >\\n {{outlineEntry.content}}\\n </AuButton>\\n {{#if outlineEntry.children}}\\n <InlineComponents::Outline\\n @entries={{outlineEntry.children}}\\n @onEntryClick={{@onEntryClick}}\\n />\\n {{/if}}\\n </AuList::Item>\\n {{/each}}\\n</AuList>\\n\")","import templateOnly from '@ember/component/template-only';\nexport default templateOnly();\n"],"names":["hbs","templateOnly"],"mappings":";;;;AACA,eAAeA,GAAG,CAAC,qnBAAqnB,CAAC;;ACAzoB,cAAA,oBAAA,CAAA,QAAA,EAAeC,YAAY,EAAE,CAAA;;;;"}
|