@lblod/ember-rdfa-editor-lblod-plugins 0.3.1 → 0.4.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.
Files changed (269) hide show
  1. package/.release-it.json +14 -0
  2. package/.woodpecker/.release.yml +15 -0
  3. package/.woodpecker/.test.yml +23 -0
  4. package/CHANGELOG.md +84 -0
  5. package/RELEASE.md +60 -0
  6. package/addon/commands/generate-template-command.js +35 -0
  7. package/addon/commands/insert-and-collapse.js +32 -0
  8. package/addon/commands/modify-date-command.js +42 -0
  9. package/addon/components/besluit-type-plugin/besluit-type-select.hbs +28 -0
  10. package/addon/components/besluit-type-plugin/besluit-type-select.js +21 -0
  11. package/addon/components/besluit-type-plugin/toolbar-dropdown.hbs +83 -0
  12. package/addon/components/besluit-type-plugin/toolbar-dropdown.js +188 -0
  13. package/addon/components/citaten-plugin/citaat-card.hbs +76 -0
  14. package/addon/components/citaten-plugin/citaat-card.js +286 -0
  15. package/addon/components/citaten-plugin/citaat-insert.hbs +20 -0
  16. package/addon/components/citaten-plugin/citaat-insert.js +68 -0
  17. package/addon/components/citaten-plugin/citations/article-list.hbs +13 -0
  18. package/addon/components/citaten-plugin/citations/article-preview.hbs +16 -0
  19. package/addon/components/citaten-plugin/citations/decision-detail.hbs +110 -0
  20. package/addon/components/citaten-plugin/citations/decision-detail.js +94 -0
  21. package/addon/components/citaten-plugin/citations/decision-list.hbs +15 -0
  22. package/addon/components/citaten-plugin/citations/decision-preview.hbs +53 -0
  23. package/addon/components/citaten-plugin/citations/search-modal.hbs +175 -0
  24. package/addon/components/citaten-plugin/citations/search-modal.js +244 -0
  25. package/addon/components/citaten-plugin/helpers/alert-load-error.hbs +21 -0
  26. package/addon/components/citaten-plugin/helpers/alert-no-items.hbs +10 -0
  27. package/addon/components/import-snippet-plugin/card.hbs +17 -0
  28. package/addon/components/import-snippet-plugin/card.js +95 -0
  29. package/addon/components/insert-variable-plugin/insert-variable-card.hbs +33 -0
  30. package/addon/components/insert-variable-plugin/insert-variable-card.js +125 -0
  31. package/addon/components/rdfa-date-plugin/rdfa-date-plugin-card.hbs +22 -0
  32. package/addon/components/rdfa-date-plugin/rdfa-date-plugin-card.js +64 -0
  33. package/addon/components/rdfa-date-plugin/rdfa-date-plugin-insert.hbs +18 -0
  34. package/addon/components/rdfa-date-plugin/rdfa-date-plugin-insert.js +24 -0
  35. package/addon/components/rdfa-date-plugin/rdfa-date-time-picker.hbs +21 -0
  36. package/addon/components/rdfa-date-plugin/rdfa-date-time-picker.js +73 -0
  37. package/addon/components/roadsign-regulation-plugin/expanded-measure.hbs +44 -0
  38. package/addon/components/roadsign-regulation-plugin/expanded-measure.js +38 -0
  39. package/addon/components/roadsign-regulation-plugin/measure-template.hbs +5 -0
  40. package/addon/components/roadsign-regulation-plugin/measure-template.js +30 -0
  41. package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.hbs +12 -0
  42. package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.js +101 -0
  43. package/addon/components/roadsign-regulation-plugin/roadsigns-modal.hbs +92 -0
  44. package/addon/components/roadsign-regulation-plugin/roadsigns-modal.js +268 -0
  45. package/addon/components/roadsign-regulation-plugin/roadsigns-pagination.hbs +25 -0
  46. package/addon/components/roadsign-regulation-plugin/roadsigns-pagination.js +55 -0
  47. package/addon/components/roadsign-regulation-plugin/roadsigns-table.hbs +73 -0
  48. package/addon/components/roadsign-regulation-plugin/roadsigns-table.js +24 -0
  49. package/addon/components/standard-template-plugin/template-card.hbs +16 -0
  50. package/addon/components/standard-template-plugin/template-card.js +7 -0
  51. package/addon/components/standard-template-plugin/template-provider.hbs +6 -0
  52. package/addon/components/standard-template-plugin/template-provider.js +75 -0
  53. package/addon/components/table-of-contents-plugin/card.hbs +5 -0
  54. package/addon/components/table-of-contents-plugin/card.js +53 -0
  55. package/addon/components/table-of-contents-plugin/inline-components/outline.hbs +21 -0
  56. package/addon/components/table-of-contents-plugin/inline-components/table-of-contents.hbs +9 -0
  57. package/addon/components/table-of-contents-plugin/inline-components/table-of-contents.js +100 -0
  58. package/addon/components/template-variable-plugin/template-variable-card.hbs +34 -0
  59. package/addon/components/template-variable-plugin/template-variable-card.js +230 -0
  60. package/addon/constants.js +24 -0
  61. package/{dist → addon}/helpers/limit-text.js +1 -4
  62. package/addon/initializers/plugin-initializer.js +75 -0
  63. package/addon/inline-components/table-of-contents.js +43 -0
  64. package/addon/marks/citaten-mark.js +32 -0
  65. package/addon/models/instruction.js +19 -0
  66. package/addon/models/measure.js +46 -0
  67. package/{dist → addon}/models/sign.js +12 -13
  68. package/addon/models/template.js +9 -0
  69. package/addon/plugins/besluit-type-plugin.js +16 -0
  70. package/addon/plugins/citaten-plugin.js +22 -0
  71. package/addon/plugins/generate-template-plugin.js +16 -0
  72. package/addon/plugins/import-snippet-plugin.js +16 -0
  73. package/addon/plugins/insert-variable-plugin.js +19 -0
  74. package/addon/plugins/rdfa-date-plugin.js +26 -0
  75. package/addon/plugins/roadsign-regulation-plugin.js +24 -0
  76. package/addon/plugins/standard-template-plugin.js +33 -0
  77. package/addon/plugins/table-of-contents-plugin.js +27 -0
  78. package/addon/plugins/template-variable-plugin.js +21 -0
  79. package/addon/serializers/application.js +8 -0
  80. package/{dist → addon}/services/import-rdfa-snippet.js +28 -18
  81. package/{dist → addon}/services/roadsign-registry.js +67 -121
  82. package/addon/services/standard-template-plugin.js +45 -0
  83. package/addon/utils/fetchBesluitTypes.js +90 -0
  84. package/addon/utils/generate-template-plugin/default-resources.js +9 -0
  85. package/addon/utils/instantiate-uuids.js +34 -0
  86. package/addon/utils/legislation-types.js +32 -0
  87. package/addon/utils/memoize.js +8 -0
  88. package/addon/utils/processMatch.js +80 -0
  89. package/addon/utils/roadsign-regulation-plugin/fetchData.js +78 -0
  90. package/addon/utils/roadsign-regulation-plugin/includeInstructions.js +10 -0
  91. package/addon/utils/variable-plugins/default-variable-types.js +56 -0
  92. package/{dist/fetch-data-284bf106.js → addon/utils/variable-plugins/fetch-data.js} +36 -18
  93. package/{dist/vlaamse-codex-187fe526.js → addon/utils/vlaamse-codex.js} +159 -63
  94. package/app/components/besluit-type-plugin/besluit-type-select.js +1 -0
  95. package/app/components/besluit-type-plugin/toolbar-dropdown.js +1 -0
  96. package/app/components/citaten-plugin/citaat-card.js +1 -0
  97. package/app/components/citaten-plugin/citaat-insert.js +1 -0
  98. package/app/components/citaten-plugin/citations/article-list.js +1 -0
  99. package/app/components/citaten-plugin/citations/article-preview.js +1 -0
  100. package/app/components/citaten-plugin/citations/decision-detail.js +1 -0
  101. package/app/components/citaten-plugin/citations/decision-list.js +1 -0
  102. package/app/components/citaten-plugin/citations/decision-preview.js +1 -0
  103. package/app/components/citaten-plugin/citations/modal.js +1 -0
  104. package/app/components/citaten-plugin/citations/search-modal.js +1 -0
  105. package/app/components/citaten-plugin/helpers/alert-load-error.js +1 -0
  106. package/app/components/citaten-plugin/helpers/alert-no-items.js +1 -0
  107. package/app/components/import-snippet-plugin/card.js +1 -0
  108. package/app/components/insert-variable-plugin/insert-variable-card.js +1 -0
  109. package/app/components/rdfa-date-plugin/rdfa-date-plugin-card.js +1 -0
  110. package/app/components/rdfa-date-plugin/rdfa-date-plugin-insert.js +1 -0
  111. package/app/components/rdfa-date-plugin/rdfa-date-time-picker.js +1 -0
  112. package/app/components/roadsign-regulation-plugin/expanded-measure.js +1 -0
  113. package/app/components/roadsign-regulation-plugin/measure-template.js +1 -0
  114. package/app/components/roadsign-regulation-plugin/roadsign-regulation-card.js +1 -0
  115. package/app/components/roadsign-regulation-plugin/roadsigns-modal.js +1 -0
  116. package/app/components/roadsign-regulation-plugin/roadsigns-pagination.js +1 -0
  117. package/app/components/roadsign-regulation-plugin/roadsigns-table.js +1 -0
  118. package/app/components/standard-template-plugin/template-card.js +1 -0
  119. package/app/components/standard-template-plugin/template-provider.js +1 -0
  120. package/app/components/table-of-contents-plugin/card.js +1 -0
  121. package/app/components/table-of-contents-plugin/inline-components/outline.js +1 -0
  122. package/app/components/table-of-contents-plugin/inline-components/table-of-contents.js +1 -0
  123. package/app/components/template-variable-plugin/template-variable-card.js +1 -0
  124. package/app/helpers/limit-text.js +4 -0
  125. package/app/initializers/plugin-initializer.js +4 -0
  126. package/app/models/instruction.js +1 -0
  127. package/app/models/measure.js +1 -0
  128. package/app/models/sign.js +1 -0
  129. package/app/models/template.js +1 -0
  130. package/app/serializers/application.js +1 -0
  131. package/app/services/import-rdfa-snippet.js +1 -0
  132. package/app/services/rdfa-editor-roadsign-regulation-plugin.js +1 -0
  133. package/app/services/roadsign-registry.js +1 -0
  134. package/app/services/standard-template-plugin.js +1 -0
  135. package/{dist → app}/styles/citaten-plugin.scss +0 -0
  136. package/config/environment.js +0 -1
  137. package/index.js +8 -0
  138. package/package.json +110 -106
  139. package/tsconfig.json +42 -0
  140. package/types/dummy/index.d.ts +1 -0
  141. package/types/ember-data/types/registries/model.d.ts +6 -0
  142. package/types/global.d.ts +7 -0
  143. package/addon-main.js +0 -4
  144. package/dist/_app_/components/besluit-type-plugin/besluit-type-select.js +0 -1
  145. package/dist/_app_/components/besluit-type-plugin/toolbar-dropdown.js +0 -1
  146. package/dist/_app_/components/citaten-plugin/citaat-card.js +0 -1
  147. package/dist/_app_/components/citaten-plugin/citaat-insert.js +0 -1
  148. package/dist/_app_/components/citaten-plugin/citations/article-list.js +0 -1
  149. package/dist/_app_/components/citaten-plugin/citations/article-preview.js +0 -1
  150. package/dist/_app_/components/citaten-plugin/citations/decision-detail.js +0 -1
  151. package/dist/_app_/components/citaten-plugin/citations/decision-list.js +0 -1
  152. package/dist/_app_/components/citaten-plugin/citations/decision-preview.js +0 -1
  153. package/dist/_app_/components/citaten-plugin/citations/search-modal.js +0 -1
  154. package/dist/_app_/components/citaten-plugin/helpers/alert-load-error.js +0 -1
  155. package/dist/_app_/components/citaten-plugin/helpers/alert-no-items.js +0 -1
  156. package/dist/_app_/components/import-snippet-plugin/card.js +0 -1
  157. package/dist/_app_/components/insert-variable-plugin/insert-variable-card.js +0 -1
  158. package/dist/_app_/components/rdfa-date-plugin/rdfa-date-plugin-card.js +0 -1
  159. package/dist/_app_/components/rdfa-date-plugin/rdfa-date-plugin-insert.js +0 -1
  160. package/dist/_app_/components/rdfa-date-plugin/rdfa-date-time-picker.js +0 -1
  161. package/dist/_app_/components/roadsign-regulation-plugin/expanded-measure.js +0 -1
  162. package/dist/_app_/components/roadsign-regulation-plugin/measure-template.js +0 -1
  163. package/dist/_app_/components/roadsign-regulation-plugin/roadsign-regulation-card.js +0 -1
  164. package/dist/_app_/components/roadsign-regulation-plugin/roadsigns-modal.js +0 -1
  165. package/dist/_app_/components/roadsign-regulation-plugin/roadsigns-pagination.js +0 -1
  166. package/dist/_app_/components/roadsign-regulation-plugin/roadsigns-table.js +0 -1
  167. package/dist/_app_/components/standard-template-plugin/template-card.js +0 -1
  168. package/dist/_app_/components/standard-template-plugin/template-provider.js +0 -1
  169. package/dist/_app_/components/table-of-contents-plugin/card.js +0 -1
  170. package/dist/_app_/components/table-of-contents-plugin/inline-components/outline.js +0 -1
  171. package/dist/_app_/components/table-of-contents-plugin/inline-components/table-of-contents.js +0 -1
  172. package/dist/_app_/components/template-variable-plugin/template-variable-card.js +0 -1
  173. package/dist/_app_/helpers/limit-text.js +0 -1
  174. package/dist/_app_/initializers/plugin-initializer.js +0 -1
  175. package/dist/_app_/models/instruction.js +0 -1
  176. package/dist/_app_/models/measure.js +0 -1
  177. package/dist/_app_/models/sign.js +0 -1
  178. package/dist/_app_/models/template.js +0 -1
  179. package/dist/_app_/serializers/application.js +0 -1
  180. package/dist/_app_/services/import-rdfa-snippet.js +0 -1
  181. package/dist/_app_/services/roadsign-registry.js +0 -1
  182. package/dist/_app_/services/standard-template-plugin.js +0 -1
  183. package/dist/_rollupPluginBabelHelpers-537ad14b.js +0 -48
  184. package/dist/_rollupPluginBabelHelpers-537ad14b.js.map +0 -1
  185. package/dist/components/besluit-type-plugin/besluit-type-select.js +0 -30
  186. package/dist/components/besluit-type-plugin/besluit-type-select.js.map +0 -1
  187. package/dist/components/besluit-type-plugin/toolbar-dropdown.js +0 -292
  188. package/dist/components/besluit-type-plugin/toolbar-dropdown.js.map +0 -1
  189. package/dist/components/citaten-plugin/citaat-card.js +0 -367
  190. package/dist/components/citaten-plugin/citaat-card.js.map +0 -1
  191. package/dist/components/citaten-plugin/citaat-insert.js +0 -84
  192. package/dist/components/citaten-plugin/citaat-insert.js.map +0 -1
  193. package/dist/components/citaten-plugin/citations/article-list.js +0 -10
  194. package/dist/components/citaten-plugin/citations/article-list.js.map +0 -1
  195. package/dist/components/citaten-plugin/citations/article-preview.js +0 -10
  196. package/dist/components/citaten-plugin/citations/article-preview.js.map +0 -1
  197. package/dist/components/citaten-plugin/citations/decision-detail.js +0 -123
  198. package/dist/components/citaten-plugin/citations/decision-detail.js.map +0 -1
  199. package/dist/components/citaten-plugin/citations/decision-list.js +0 -10
  200. package/dist/components/citaten-plugin/citations/decision-list.js.map +0 -1
  201. package/dist/components/citaten-plugin/citations/decision-preview.js +0 -10
  202. package/dist/components/citaten-plugin/citations/decision-preview.js.map +0 -1
  203. package/dist/components/citaten-plugin/citations/search-modal.js +0 -282
  204. package/dist/components/citaten-plugin/citations/search-modal.js.map +0 -1
  205. package/dist/components/citaten-plugin/helpers/alert-load-error.js +0 -10
  206. package/dist/components/citaten-plugin/helpers/alert-load-error.js.map +0 -1
  207. package/dist/components/citaten-plugin/helpers/alert-no-items.js +0 -10
  208. package/dist/components/citaten-plugin/helpers/alert-no-items.js.map +0 -1
  209. package/dist/components/import-snippet-plugin/card.js +0 -99
  210. package/dist/components/import-snippet-plugin/card.js.map +0 -1
  211. package/dist/components/insert-variable-plugin/insert-variable-card.js +0 -190
  212. package/dist/components/insert-variable-plugin/insert-variable-card.js.map +0 -1
  213. package/dist/components/rdfa-date-plugin/rdfa-date-plugin-card.js +0 -85
  214. package/dist/components/rdfa-date-plugin/rdfa-date-plugin-card.js.map +0 -1
  215. package/dist/components/rdfa-date-plugin/rdfa-date-plugin-insert.js +0 -23
  216. package/dist/components/rdfa-date-plugin/rdfa-date-plugin-insert.js.map +0 -1
  217. package/dist/components/rdfa-date-plugin/rdfa-date-time-picker.js +0 -91
  218. package/dist/components/rdfa-date-plugin/rdfa-date-time-picker.js.map +0 -1
  219. package/dist/components/roadsign-regulation-plugin/expanded-measure.js +0 -52
  220. package/dist/components/roadsign-regulation-plugin/expanded-measure.js.map +0 -1
  221. package/dist/components/roadsign-regulation-plugin/measure-template.js +0 -42
  222. package/dist/components/roadsign-regulation-plugin/measure-template.js.map +0 -1
  223. package/dist/components/roadsign-regulation-plugin/roadsign-regulation-card.js +0 -82
  224. package/dist/components/roadsign-regulation-plugin/roadsign-regulation-card.js.map +0 -1
  225. package/dist/components/roadsign-regulation-plugin/roadsigns-modal.js +0 -251
  226. package/dist/components/roadsign-regulation-plugin/roadsigns-modal.js.map +0 -1
  227. package/dist/components/roadsign-regulation-plugin/roadsigns-pagination.js +0 -71
  228. package/dist/components/roadsign-regulation-plugin/roadsigns-pagination.js.map +0 -1
  229. package/dist/components/roadsign-regulation-plugin/roadsigns-table.js +0 -36
  230. package/dist/components/roadsign-regulation-plugin/roadsigns-table.js.map +0 -1
  231. package/dist/components/standard-template-plugin/template-card.js +0 -15
  232. package/dist/components/standard-template-plugin/template-card.js.map +0 -1
  233. package/dist/components/standard-template-plugin/template-provider.js +0 -109
  234. package/dist/components/standard-template-plugin/template-provider.js.map +0 -1
  235. package/dist/components/table-of-contents-plugin/card.js +0 -52
  236. package/dist/components/table-of-contents-plugin/card.js.map +0 -1
  237. package/dist/components/table-of-contents-plugin/inline-components/outline.js +0 -10
  238. package/dist/components/table-of-contents-plugin/inline-components/outline.js.map +0 -1
  239. package/dist/components/table-of-contents-plugin/inline-components/table-of-contents.js +0 -92
  240. package/dist/components/table-of-contents-plugin/inline-components/table-of-contents.js.map +0 -1
  241. package/dist/components/template-variable-plugin/template-variable-card.js +0 -178
  242. package/dist/components/template-variable-plugin/template-variable-card.js.map +0 -1
  243. package/dist/constants-c77fd478.js +0 -16
  244. package/dist/constants-c77fd478.js.map +0 -1
  245. package/dist/fetch-data-284bf106.js.map +0 -1
  246. package/dist/helpers/limit-text.js.map +0 -1
  247. package/dist/includeInstructions-a32c24e6.js +0 -10
  248. package/dist/includeInstructions-a32c24e6.js.map +0 -1
  249. package/dist/index.js +0 -2
  250. package/dist/index.js.map +0 -1
  251. package/dist/initializers/plugin-initializer.js +0 -401
  252. package/dist/initializers/plugin-initializer.js.map +0 -1
  253. package/dist/legislation-types-4d487cb9.js +0 -26
  254. package/dist/legislation-types-4d487cb9.js.map +0 -1
  255. package/dist/models/instruction.js +0 -18
  256. package/dist/models/instruction.js.map +0 -1
  257. package/dist/models/measure.js +0 -41
  258. package/dist/models/measure.js.map +0 -1
  259. package/dist/models/sign.js.map +0 -1
  260. package/dist/models/template.js +0 -48
  261. package/dist/models/template.js.map +0 -1
  262. package/dist/serializers/application.js +0 -10
  263. package/dist/serializers/application.js.map +0 -1
  264. package/dist/services/import-rdfa-snippet.js.map +0 -1
  265. package/dist/services/roadsign-registry.js.map +0 -1
  266. package/dist/services/standard-template-plugin.js +0 -53
  267. package/dist/services/standard-template-plugin.js.map +0 -1
  268. package/dist/styles/test.css +0 -0
  269. package/dist/vlaamse-codex-187fe526.js.map +0 -1
@@ -1,99 +0,0 @@
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
@@ -1 +0,0 @@
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","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AA,EAAA;AAvCmC,oBAAA,CAAA,QAAA,EAAA,uBAAA,CAAA;;;;"}
@@ -1,190 +0,0 @@
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
- import { task } from 'ember-concurrency';
8
- import { v4 } from 'uuid';
9
- import { INVISIBLE_SPACE } from '@lblod/ember-rdfa-editor/model/util/constants';
10
- import { f as fetchCodeListsByPublisher } from '../../fetch-data-284bf106.js';
11
-
12
- var TEMPLATE = hbs("{{#if this.showCard}}\n <AuCard @flex={{true}} @divided={{true}} @isOpenInitially={{true}} @expandable={{true}} @shadow={{true}} @size=\"small\" as |c|>\n <c.header>\n <AuHeading @level=\"3\" @skin=\"6\">\n {{t \"insert-variable-plugin.variable\"}}\n </AuHeading>\n </c.header>\n <c.content>\n <PowerSelect\n @allowClear={{false}}\n @searchEnabled={{false}}\n @options={{this.variablesArray}}\n @selected={{this.selectedVariable}}\n @onChange={{this.updateSelectedVariable}} as |variable|\n >\n {{variable.label}}\n </PowerSelect>\n {{#if this.hasSubtype}}\n <PowerSelect\n @allowClear={{false}}\n @searchEnabled={{false}}\n @options={{this.subtypes}}\n @selected={{this.selectedSubtype}}\n @onChange={{this.updateSubtype}} as |subtype|\n >\n {{subtype.label}}\n </PowerSelect>\n {{/if}}\n <AuButton {{on \'click\' this.insert}} @disabled={{or (not this.selectedVariable) (and this.hasSubtype (not this.selectedSubtype))}}>{{t \"insert-variable-plugin.button\"}}</AuButton>\n </c.content>\n </AuCard>\n{{/if}}\n\n");
13
-
14
- const defaultVariableTypes = {
15
- text: {
16
- label: 'text',
17
- template: `
18
- <span property="dct:type" content="text"></span>
19
- <span property="ext:content">
20
- <span class="mark-highlight-manual">\${text}</span>
21
- </span>
22
- `
23
- },
24
- number: {
25
- label: 'number',
26
- template: `
27
- <span property="dct:type" content="number"></span>
28
- <span property="ext:content" datatype="xsd:integer">
29
- <span class="mark-highlight-manual">\${number}</span>
30
- </span>
31
- `
32
- },
33
- date: {
34
- label: 'date',
35
- template: `
36
- <span property="dct:type" content="date"></span>
37
- <span property="ext:content" datatype="xsd:date">
38
- <span class="mark-highlight-manual">\${date}</span>
39
- </span>
40
- `
41
- },
42
- location: {
43
- label: 'location',
44
- template: endpoint => `
45
- <span property="dct:type" content="location"></span>
46
- <span property="dct:source" resource="${endpoint}"></span>
47
- <span property="ext:content">
48
- <span class="mark-highlight-manual">\${location}</span>
49
- </span>
50
- `
51
- },
52
- codelist: {
53
- label: 'codelist',
54
- fetchSubtypes: async (endpoint, publisher) => {
55
- const codelists = fetchCodeListsByPublisher(endpoint, publisher);
56
- return codelists;
57
- },
58
- template: (endpoint, selectedCodelist) => `
59
- <span property="ext:codelist" resource="${selectedCodelist.uri}"></span>
60
- <span property="dct:type" content="codelist"></span>
61
- <span property="dct:source" resource="${endpoint}"></span>
62
- <span property="ext:content">
63
- <span class="mark-highlight-manual">\${${selectedCodelist.label}}</span>
64
- </span>
65
- `
66
- }
67
- };
68
-
69
- var _class, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6;
70
- let EditorPluginsInsertCodelistCardComponent = (_class = class EditorPluginsInsertCodelistCardComponent extends Component {
71
- constructor() {
72
- super(...arguments);
73
- _initializerDefineProperty(this, "variablesArray", _descriptor, this);
74
- _initializerDefineProperty(this, "selectedVariable", _descriptor2, this);
75
- _initializerDefineProperty(this, "showCard", _descriptor3, this);
76
- _initializerDefineProperty(this, "hasSubtype", _descriptor4, this);
77
- _initializerDefineProperty(this, "selectedSubtype", _descriptor5, this);
78
- _initializerDefineProperty(this, "subtypes", _descriptor6, this);
79
- const {
80
- publisher,
81
- variableTypes,
82
- defaultEndpoint
83
- } = this.args.widgetArgs.options || {};
84
- this.publisher = publisher;
85
- this.endpoint = defaultEndpoint;
86
- let variableTypesSelectedByUser = variableTypes ?? ['text', 'number', 'date', 'location', 'codelist'];
87
- const variablesArray = [];
88
- for (let type of variableTypesSelectedByUser) {
89
- if (typeof type === 'string') {
90
- const defaultVariable = defaultVariableTypes[type];
91
- if (defaultVariable) {
92
- variablesArray.push(defaultVariable);
93
- } else {
94
- console.warn(`Template Variable Plugin: variable type ${type} not found in the default variable types`);
95
- }
96
- } else {
97
- variablesArray.push(type);
98
- }
99
- }
100
- this.variablesArray = variablesArray;
101
- this.args.controller.onEvent('selectionChanged', this.selectionChanged);
102
- }
103
- insert() {
104
- const uri = `http://data.lblod.info/mappings/${v4()}`;
105
- let variableContent;
106
- if (typeof this.selectedVariable.template === 'function') {
107
- variableContent = this.selectedVariable.template(this.endpoint, this.selectedSubtype);
108
- } else {
109
- variableContent = this.selectedVariable.template;
110
- }
111
- const htmlToInsert = `
112
- <span resource="${uri}" typeof="ext:Mapping">
113
- ${variableContent}
114
- </span>
115
- `;
116
- this.args.controller.executeCommand('insert-html', htmlToInsert, this.args.controller.selection.lastRange);
117
- this.args.controller.executeCommand('insert-text', INVISIBLE_SPACE, this.args.controller.selection.lastRange);
118
- this.selectedVariableType = undefined;
119
- this.selectedCodelist = undefined;
120
- this.isCodelist = false;
121
- }
122
- updateSelectedVariable(variable) {
123
- this.selectedVariable = variable;
124
- if (variable.fetchSubtypes) {
125
- this.fetchSubtypes.perform(variable.fetchSubtypes);
126
- this.hasSubtype = true;
127
- } else {
128
- this.hasSubtype = false;
129
- }
130
- }
131
- *fetchSubtypes(fetchFunction) {
132
- const subtypes = yield fetchFunction(this.endpoint, this.publisher);
133
- this.subtypes = subtypes;
134
- }
135
- updateSubtype(subtype) {
136
- this.selectedSubtype = subtype;
137
- }
138
- selectionChanged() {
139
- const currentSelection = this.args.controller.selection.lastRange;
140
- if (!currentSelection) {
141
- return;
142
- }
143
- this.showCard = false;
144
- const limitedDatastore = this.args.controller.datastore.limitToRange(currentSelection, 'rangeIsInside');
145
- const mapping = limitedDatastore.match(null, 'a', 'ext:Mapping').asQuads().next().value;
146
- if (mapping) {
147
- this.showCard = false;
148
- } else {
149
- this.showCard = true;
150
- }
151
- }
152
- }, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "variablesArray", [tracked], {
153
- configurable: true,
154
- enumerable: true,
155
- writable: true,
156
- initializer: null
157
- }), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "selectedVariable", [tracked], {
158
- configurable: true,
159
- enumerable: true,
160
- writable: true,
161
- initializer: null
162
- }), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, "showCard", [tracked], {
163
- configurable: true,
164
- enumerable: true,
165
- writable: true,
166
- initializer: function () {
167
- return true;
168
- }
169
- }), _descriptor4 = _applyDecoratedDescriptor(_class.prototype, "hasSubtype", [tracked], {
170
- configurable: true,
171
- enumerable: true,
172
- writable: true,
173
- initializer: function () {
174
- return false;
175
- }
176
- }), _descriptor5 = _applyDecoratedDescriptor(_class.prototype, "selectedSubtype", [tracked], {
177
- configurable: true,
178
- enumerable: true,
179
- writable: true,
180
- initializer: null
181
- }), _descriptor6 = _applyDecoratedDescriptor(_class.prototype, "subtypes", [tracked], {
182
- configurable: true,
183
- enumerable: true,
184
- writable: true,
185
- initializer: null
186
- }), _applyDecoratedDescriptor(_class.prototype, "insert", [action], Object.getOwnPropertyDescriptor(_class.prototype, "insert"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "updateSelectedVariable", [action], Object.getOwnPropertyDescriptor(_class.prototype, "updateSelectedVariable"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "fetchSubtypes", [task], Object.getOwnPropertyDescriptor(_class.prototype, "fetchSubtypes"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "updateSubtype", [action], Object.getOwnPropertyDescriptor(_class.prototype, "updateSubtype"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "selectionChanged", [action], Object.getOwnPropertyDescriptor(_class.prototype, "selectionChanged"), _class.prototype)), _class);
187
- setComponentTemplate(TEMPLATE, EditorPluginsInsertCodelistCardComponent);
188
-
189
- export { EditorPluginsInsertCodelistCardComponent as default };
190
- //# sourceMappingURL=insert-variable-card.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"insert-variable-card.js","sources":["../../../src/components/insert-variable-plugin/insert-variable-card.hbs.js","../../../src/utils/variable-plugins/default-variable-types.js","../../../src/components/insert-variable-plugin/insert-variable-card.js"],"sourcesContent":["import { hbs } from 'ember-cli-htmlbars';\nexport default hbs(\"{{#if this.showCard}}\\n <AuCard @flex={{true}} @divided={{true}} @isOpenInitially={{true}} @expandable={{true}} @shadow={{true}} @size=\\\"small\\\" as |c|>\\n <c.header>\\n <AuHeading @level=\\\"3\\\" @skin=\\\"6\\\">\\n {{t \\\"insert-variable-plugin.variable\\\"}}\\n </AuHeading>\\n </c.header>\\n <c.content>\\n <PowerSelect\\n @allowClear={{false}}\\n @searchEnabled={{false}}\\n @options={{this.variablesArray}}\\n @selected={{this.selectedVariable}}\\n @onChange={{this.updateSelectedVariable}} as |variable|\\n >\\n {{variable.label}}\\n </PowerSelect>\\n {{#if this.hasSubtype}}\\n <PowerSelect\\n @allowClear={{false}}\\n @searchEnabled={{false}}\\n @options={{this.subtypes}}\\n @selected={{this.selectedSubtype}}\\n @onChange={{this.updateSubtype}} as |subtype|\\n >\\n {{subtype.label}}\\n </PowerSelect>\\n {{/if}}\\n <AuButton {{on \\'click\\' this.insert}} @disabled={{or (not this.selectedVariable) (and this.hasSubtype (not this.selectedSubtype))}}>{{t \\\"insert-variable-plugin.button\\\"}}</AuButton>\\n </c.content>\\n </AuCard>\\n{{/if}}\\n\\n\")","import { fetchCodeListsByPublisher } from './fetch-data';\n\nexport const defaultVariableTypes = {\n text: {\n label: 'text',\n template: `\n <span property=\"dct:type\" content=\"text\"></span>\n <span property=\"ext:content\">\n <span class=\"mark-highlight-manual\">\\${text}</span>\n </span>\n `,\n },\n number: {\n label: 'number',\n template: `\n <span property=\"dct:type\" content=\"number\"></span>\n <span property=\"ext:content\" datatype=\"xsd:integer\">\n <span class=\"mark-highlight-manual\">\\${number}</span>\n </span>\n `,\n },\n date: {\n label: 'date',\n template: `\n <span property=\"dct:type\" content=\"date\"></span>\n <span property=\"ext:content\" datatype=\"xsd:date\">\n <span class=\"mark-highlight-manual\">\\${date}</span>\n </span>\n `,\n },\n location: {\n label: 'location',\n template: (endpoint) => `\n <span property=\"dct:type\" content=\"location\"></span>\n <span property=\"dct:source\" resource=\"${endpoint}\"></span>\n <span property=\"ext:content\">\n <span class=\"mark-highlight-manual\">\\${location}</span>\n </span>\n `,\n },\n codelist: {\n label: 'codelist',\n fetchSubtypes: async (endpoint, publisher) => {\n const codelists = fetchCodeListsByPublisher(endpoint, publisher);\n return codelists;\n },\n template: (endpoint, selectedCodelist) => `\n <span property=\"ext:codelist\" resource=\"${selectedCodelist.uri}\"></span>\n <span property=\"dct:type\" content=\"codelist\"></span>\n <span property=\"dct:source\" resource=\"${endpoint}\"></span>\n <span property=\"ext:content\">\n <span class=\"mark-highlight-manual\">\\${${selectedCodelist.label}}</span>\n </span>\n `,\n },\n};\n","import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { task } from 'ember-concurrency';\nimport { v4 as uuidv4 } from 'uuid';\nimport { INVISIBLE_SPACE } from '@lblod/ember-rdfa-editor/model/util/constants';\nimport { defaultVariableTypes } from '../../utils/variable-plugins/default-variable-types';\n\nexport default class EditorPluginsInsertCodelistCardComponent extends Component {\n @tracked variablesArray;\n @tracked selectedVariable;\n @tracked showCard = true;\n @tracked hasSubtype = false;\n @tracked selectedSubtype;\n @tracked subtypes;\n\n constructor() {\n super(...arguments);\n const { publisher, variableTypes, defaultEndpoint } =\n this.args.widgetArgs.options || {};\n this.publisher = publisher;\n this.endpoint = defaultEndpoint;\n let variableTypesSelectedByUser = variableTypes ?? [\n 'text',\n 'number',\n 'date',\n 'location',\n 'codelist',\n ];\n\n const variablesArray = [];\n for (let type of variableTypesSelectedByUser) {\n if (typeof type === 'string') {\n const defaultVariable = defaultVariableTypes[type];\n if (defaultVariable) {\n variablesArray.push(defaultVariable);\n } else {\n console.warn(\n `Template Variable Plugin: variable type ${type} not found in the default variable types`\n );\n }\n } else {\n variablesArray.push(type);\n }\n }\n this.variablesArray = variablesArray;\n this.args.controller.onEvent('selectionChanged', this.selectionChanged);\n }\n\n @action\n insert() {\n const uri = `http://data.lblod.info/mappings/${uuidv4()}`;\n let variableContent;\n if (typeof this.selectedVariable.template === 'function') {\n variableContent = this.selectedVariable.template(\n this.endpoint,\n this.selectedSubtype\n );\n } else {\n variableContent = this.selectedVariable.template;\n }\n const htmlToInsert = `\n <span resource=\"${uri}\" typeof=\"ext:Mapping\">\n ${variableContent}\n </span>\n `;\n this.args.controller.executeCommand(\n 'insert-html',\n htmlToInsert,\n this.args.controller.selection.lastRange\n );\n this.args.controller.executeCommand(\n 'insert-text',\n INVISIBLE_SPACE,\n this.args.controller.selection.lastRange\n );\n this.selectedVariableType = undefined;\n this.selectedCodelist = undefined;\n this.isCodelist = false;\n }\n\n @action\n updateSelectedVariable(variable) {\n this.selectedVariable = variable;\n if (variable.fetchSubtypes) {\n this.fetchSubtypes.perform(variable.fetchSubtypes);\n this.hasSubtype = true;\n } else {\n this.hasSubtype = false;\n }\n }\n\n @task\n *fetchSubtypes(fetchFunction) {\n const subtypes = yield fetchFunction(this.endpoint, this.publisher);\n this.subtypes = subtypes;\n }\n\n @action\n updateSubtype(subtype) {\n this.selectedSubtype = subtype;\n }\n\n @action\n selectionChanged() {\n const currentSelection = this.args.controller.selection.lastRange;\n if (!currentSelection) {\n return;\n }\n this.showCard = false;\n const limitedDatastore = this.args.controller.datastore.limitToRange(\n currentSelection,\n 'rangeIsInside'\n );\n const mapping = limitedDatastore\n .match(null, 'a', 'ext:Mapping')\n .asQuads()\n .next().value;\n if (mapping) {\n this.showCard = false;\n } else {\n this.showCard = true;\n }\n }\n}\n"],"names":["hbs","defaultVariableTypes","text","label","template","number","date","location","endpoint","codelist","fetchSubtypes","publisher","codelists","fetchCodeListsByPublisher","selectedCodelist","uri","EditorPluginsInsertCodelistCardComponent","Component","constructor","arguments","variableTypes","defaultEndpoint","args","widgetArgs","options","variableTypesSelectedByUser","variablesArray","type","defaultVariable","push","console","warn","controller","onEvent","selectionChanged","insert","uuidv4","variableContent","selectedVariable","selectedSubtype","htmlToInsert","executeCommand","selection","lastRange","INVISIBLE_SPACE","selectedVariableType","undefined","isCodelist","updateSelectedVariable","variable","perform","hasSubtype","fetchFunction","subtypes","updateSubtype","subtype","currentSelection","showCard","limitedDatastore","datastore","limitToRange","mapping","match","asQuads","next","value","tracked","action","task"],"mappings":";;;;;;;;;;;AACA,eAAeA,GAAG,CAAC,yqCAAyqC,CAAC;;ACCtrC,MAAMC,oBAAoB,GAAG;AAClCC,EAAAA,IAAI,EAAE;AACJC,IAAAA,KAAK,EAAE,MAAM;AACbC,IAAAA,QAAQ,EAAG,CAAA;AACf;AACA;AACA;AACA;AACA,IAAA,CAAA;GACG;AACDC,EAAAA,MAAM,EAAE;AACNF,IAAAA,KAAK,EAAE,QAAQ;AACfC,IAAAA,QAAQ,EAAG,CAAA;AACf;AACA;AACA;AACA;AACA,IAAA,CAAA;GACG;AACDE,EAAAA,IAAI,EAAE;AACJH,IAAAA,KAAK,EAAE,MAAM;AACbC,IAAAA,QAAQ,EAAG,CAAA;AACf;AACA;AACA;AACA;AACA,IAAA,CAAA;GACG;AACDG,EAAAA,QAAQ,EAAE;AACRJ,IAAAA,KAAK,EAAE,UAAU;IACjBC,QAAQ,EAAGI,QAAQ,IAAM,CAAA;AAC7B;AACA,4CAAA,EAA8CA,QAAS,CAAA;AACvD;AACA;AACA;AACA,IAAA,CAAA;GACG;AACDC,EAAAA,QAAQ,EAAE;AACRN,IAAAA,KAAK,EAAE,UAAU;AACjBO,IAAAA,aAAa,EAAE,OAAOF,QAAQ,EAAEG,SAAS,KAAK;AAC5C,MAAA,MAAMC,SAAS,GAAGC,yBAAyB,CAAC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,2JAKNA,MAAM,CAAA,EAAA,MAAA,CAAA,wBAAA,CAAA,MAAA,CAAA,SAAA,EAAA,kBAAA,CAAA,EAAA,MAAA,CAAA,SAAA,CAAA,GAAA,MAAA,EAAA;AA/FoD,oBAAA,CAAA,QAAA,EAAA,wCAAA,CAAA;;;;"}
@@ -1,85 +0,0 @@
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
@@ -1 +0,0 @@
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,C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A,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;;;;"}
@@ -1,23 +0,0 @@
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
@@ -1 +0,0 @@
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;;;;"}
@@ -1,91 +0,0 @@
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
@@ -1 +0,0 @@
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,CAAC,YAAY,CAAC,GAAA,MAAA,GAFX,MAAMD,kBAAkB,SAASE,SAAS,CAAC;AAAA,EAAA,WAAA,CAAA,GAAA,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAA,IAAA,CAAA,CAAA;AAAA,IAAA,0BAAA,CAAA,IAAA,EAAA,MAAA,EAAA,WAAA,EAAA,IAAA,CAAA,CAAA;AAAA,IAAA,0BAAA,CAAA,IAAA,EAAA,MAAA,EAAA,YAAA,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA;AAIxD,E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