@startinblox/core 0.17.21-beta.9 → 0.17.22

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 (260) hide show
  1. package/package.json +2 -2
  2. package/dist/_snowpack/env.js +0 -3
  3. package/dist/_snowpack/pkg/autolinker.js +0 -4281
  4. package/dist/_snowpack/pkg/autolinker.js.map +0 -1
  5. package/dist/_snowpack/pkg/autolinker.js.map.proxy.js +0 -1
  6. package/dist/_snowpack/pkg/common/_baseUnary-217dffb2.js +0 -377
  7. package/dist/_snowpack/pkg/common/_baseUnary-217dffb2.js.map +0 -1
  8. package/dist/_snowpack/pkg/common/_baseUnary-217dffb2.js.map.proxy.js +0 -1
  9. package/dist/_snowpack/pkg/common/_commonjsHelpers-8c19dec8.js +0 -22
  10. package/dist/_snowpack/pkg/common/_commonjsHelpers-8c19dec8.js.map +0 -1
  11. package/dist/_snowpack/pkg/common/_commonjsHelpers-8c19dec8.js.map.proxy.js +0 -1
  12. package/dist/_snowpack/pkg/common/decode-a4c334cf.js +0 -216
  13. package/dist/_snowpack/pkg/common/decode-a4c334cf.js.map +0 -1
  14. package/dist/_snowpack/pkg/common/decode-a4c334cf.js.map.proxy.js +0 -1
  15. package/dist/_snowpack/pkg/common/lit-html-babd44cd.js +0 -1119
  16. package/dist/_snowpack/pkg/common/lit-html-babd44cd.js.map +0 -1
  17. package/dist/_snowpack/pkg/common/lit-html-babd44cd.js.map.proxy.js +0 -1
  18. package/dist/_snowpack/pkg/delta-markdown-for-quill.js +0 -25677
  19. package/dist/_snowpack/pkg/delta-markdown-for-quill.js.map +0 -1
  20. package/dist/_snowpack/pkg/delta-markdown-for-quill.js.map.proxy.js +0 -1
  21. package/dist/_snowpack/pkg/dialog-polyfill.js +0 -859
  22. package/dist/_snowpack/pkg/dialog-polyfill.js.map +0 -1
  23. package/dist/_snowpack/pkg/dialog-polyfill.js.map.proxy.js +0 -1
  24. package/dist/_snowpack/pkg/fusejs.js +0 -1783
  25. package/dist/_snowpack/pkg/fusejs.js.map +0 -1
  26. package/dist/_snowpack/pkg/fusejs.js.map.proxy.js +0 -1
  27. package/dist/_snowpack/pkg/import-map.json +0 -23
  28. package/dist/_snowpack/pkg/jsonld-context-parser.js +0 -804
  29. package/dist/_snowpack/pkg/jsonld-context-parser.js.map +0 -1
  30. package/dist/_snowpack/pkg/jsonld-context-parser.js.map.proxy.js +0 -1
  31. package/dist/_snowpack/pkg/leaflet/dist/leaflet.css +0 -640
  32. package/dist/_snowpack/pkg/leaflet/dist/leaflet.css.proxy.js +0 -10
  33. package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.Default.css +0 -60
  34. package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.Default.css.proxy.js +0 -10
  35. package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.css +0 -14
  36. package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.css.proxy.js +0 -10
  37. package/dist/_snowpack/pkg/lit-html/directives/if-defined.js +0 -40
  38. package/dist/_snowpack/pkg/lit-html/directives/if-defined.js.map +0 -1
  39. package/dist/_snowpack/pkg/lit-html/directives/if-defined.js.map.proxy.js +0 -1
  40. package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js +0 -46
  41. package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js.map +0 -1
  42. package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js.map.proxy.js +0 -1
  43. package/dist/_snowpack/pkg/lit-html/directives/until.js +0 -88
  44. package/dist/_snowpack/pkg/lit-html/directives/until.js.map +0 -1
  45. package/dist/_snowpack/pkg/lit-html/directives/until.js.map.proxy.js +0 -1
  46. package/dist/_snowpack/pkg/lit-html.js +0 -92
  47. package/dist/_snowpack/pkg/lit-html.js.map +0 -1
  48. package/dist/_snowpack/pkg/lit-html.js.map.proxy.js +0 -1
  49. package/dist/_snowpack/pkg/markdown-it.js +0 -11860
  50. package/dist/_snowpack/pkg/markdown-it.js.map +0 -1
  51. package/dist/_snowpack/pkg/markdown-it.js.map.proxy.js +0 -1
  52. package/dist/_snowpack/pkg/quill/dist/quill.snow.css +0 -945
  53. package/dist/_snowpack/pkg/quill/dist/quill.snow.css.proxy.js +0 -10
  54. package/dist/_snowpack/pkg/quill-delta-to-markdown.js +0 -1029
  55. package/dist/_snowpack/pkg/quill-delta-to-markdown.js.map +0 -1
  56. package/dist/_snowpack/pkg/quill-delta-to-markdown.js.map.proxy.js +0 -1
  57. package/dist/_snowpack/pkg/quill.js +0 -13382
  58. package/dist/_snowpack/pkg/quill.js.map +0 -1
  59. package/dist/_snowpack/pkg/quill.js.map.proxy.js +0 -1
  60. package/dist/_snowpack/pkg/slim-select.js +0 -4
  61. package/dist/_snowpack/pkg/slim-select.js.map +0 -1
  62. package/dist/_snowpack/pkg/slim-select.js.map.proxy.js +0 -1
  63. package/dist/_snowpack/pkg/tui-calendar/dist/tui-calendar.css +0 -1164
  64. package/dist/_snowpack/pkg/tui-calendar/dist/tui-calendar.css.proxy.js +0 -10
  65. package/dist/_snowpack/pkg/tui-calendar.js +0 -42285
  66. package/dist/_snowpack/pkg/tui-calendar.js.map +0 -1
  67. package/dist/_snowpack/pkg/tui-calendar.js.map.proxy.js +0 -1
  68. package/dist/components/solid-ac-checker.js +0 -51
  69. package/dist/components/solid-ac-checker.js.map +0 -1
  70. package/dist/components/solid-calendar.js +0 -87
  71. package/dist/components/solid-calendar.js.map +0 -1
  72. package/dist/components/solid-delete.js +0 -111
  73. package/dist/components/solid-delete.js.map +0 -1
  74. package/dist/components/solid-display.js +0 -194
  75. package/dist/components/solid-display.js.map +0 -1
  76. package/dist/components/solid-form-search.js +0 -226
  77. package/dist/components/solid-form-search.js.map +0 -1
  78. package/dist/components/solid-form.js +0 -354
  79. package/dist/components/solid-form.js.map +0 -1
  80. package/dist/components/solid-lang.js +0 -46
  81. package/dist/components/solid-lang.js.map +0 -1
  82. package/dist/components/solid-map.js +0 -242
  83. package/dist/components/solid-map.js.map +0 -1
  84. package/dist/components/solid-table.js +0 -263
  85. package/dist/components/solid-table.js.map +0 -1
  86. package/dist/components/solid-widget.js +0 -94
  87. package/dist/components/solid-widget.js.map +0 -1
  88. package/dist/import.css +0 -4
  89. package/dist/index.js +0 -43
  90. package/dist/index.js.map +0 -1
  91. package/dist/libs/Component.js +0 -19
  92. package/dist/libs/Component.js.map +0 -1
  93. package/dist/libs/ComponentFactory.js +0 -196
  94. package/dist/libs/ComponentFactory.js.map +0 -1
  95. package/dist/libs/Compositor.js +0 -103
  96. package/dist/libs/Compositor.js.map +0 -1
  97. package/dist/libs/Sib.js +0 -58
  98. package/dist/libs/Sib.js.map +0 -1
  99. package/dist/libs/filter.js +0 -214
  100. package/dist/libs/filter.js.map +0 -1
  101. package/dist/libs/helpers.js +0 -219
  102. package/dist/libs/helpers.js.map +0 -1
  103. package/dist/libs/interfaces.js +0 -6
  104. package/dist/libs/interfaces.js.map +0 -1
  105. package/dist/libs/lit-helpers.js +0 -169
  106. package/dist/libs/lit-helpers.js.map +0 -1
  107. package/dist/libs/polyfills.js +0 -40
  108. package/dist/libs/polyfills.js.map +0 -1
  109. package/dist/libs/store/store.js +0 -863
  110. package/dist/libs/store/store.js.map +0 -1
  111. package/dist/locales/en.json +0 -10
  112. package/dist/locales/en.json.proxy.js +0 -2
  113. package/dist/locales/fr.json +0 -10
  114. package/dist/locales/fr.json.proxy.js +0 -2
  115. package/dist/mixins/attributeBinderMixin.js +0 -124
  116. package/dist/mixins/attributeBinderMixin.js.map +0 -1
  117. package/dist/mixins/contextMixin.js +0 -28
  118. package/dist/mixins/contextMixin.js.map +0 -1
  119. package/dist/mixins/counterMixin.js +0 -75
  120. package/dist/mixins/counterMixin.js.map +0 -1
  121. package/dist/mixins/federationMixin.js +0 -63
  122. package/dist/mixins/federationMixin.js.map +0 -1
  123. package/dist/mixins/filterMixin.js +0 -136
  124. package/dist/mixins/filterMixin.js.map +0 -1
  125. package/dist/mixins/grouperMixin.js +0 -80
  126. package/dist/mixins/grouperMixin.js.map +0 -1
  127. package/dist/mixins/highlighterMixin.js +0 -42
  128. package/dist/mixins/highlighterMixin.js.map +0 -1
  129. package/dist/mixins/interfaces.js +0 -8
  130. package/dist/mixins/interfaces.js.map +0 -1
  131. package/dist/mixins/listMixin.js +0 -136
  132. package/dist/mixins/listMixin.js.map +0 -1
  133. package/dist/mixins/nextMixin.js +0 -26
  134. package/dist/mixins/nextMixin.js.map +0 -1
  135. package/dist/mixins/paginateMixin.js +0 -110
  136. package/dist/mixins/paginateMixin.js.map +0 -1
  137. package/dist/mixins/requiredMixin.js +0 -34
  138. package/dist/mixins/requiredMixin.js.map +0 -1
  139. package/dist/mixins/sorterMixin.js +0 -149
  140. package/dist/mixins/sorterMixin.js.map +0 -1
  141. package/dist/mixins/storeMixin.js +0 -102
  142. package/dist/mixins/storeMixin.js.map +0 -1
  143. package/dist/mixins/translationMixin.js +0 -68
  144. package/dist/mixins/translationMixin.js.map +0 -1
  145. package/dist/mixins/validationMixin.js +0 -113
  146. package/dist/mixins/validationMixin.js.map +0 -1
  147. package/dist/mixins/widgetMixin.js +0 -447
  148. package/dist/mixins/widgetMixin.js.map +0 -1
  149. package/dist/new-widgets/attributeMixins/actionMixin.js +0 -14
  150. package/dist/new-widgets/attributeMixins/actionMixin.js.map +0 -1
  151. package/dist/new-widgets/attributeMixins/blankMixin.js +0 -10
  152. package/dist/new-widgets/attributeMixins/blankMixin.js.map +0 -1
  153. package/dist/new-widgets/attributeMixins/booleanMixin.js +0 -10
  154. package/dist/new-widgets/attributeMixins/booleanMixin.js.map +0 -1
  155. package/dist/new-widgets/attributeMixins/index.js +0 -20
  156. package/dist/new-widgets/attributeMixins/index.js.map +0 -1
  157. package/dist/new-widgets/attributeMixins/mailtoMixin.js +0 -10
  158. package/dist/new-widgets/attributeMixins/mailtoMixin.js.map +0 -1
  159. package/dist/new-widgets/attributeMixins/multipleMixin.js +0 -28
  160. package/dist/new-widgets/attributeMixins/multipleMixin.js.map +0 -1
  161. package/dist/new-widgets/attributeMixins/numberMixin.js +0 -10
  162. package/dist/new-widgets/attributeMixins/numberMixin.js.map +0 -1
  163. package/dist/new-widgets/attributeMixins/placeholderMixin.js +0 -19
  164. package/dist/new-widgets/attributeMixins/placeholderMixin.js.map +0 -1
  165. package/dist/new-widgets/attributeMixins/telMixin.js +0 -10
  166. package/dist/new-widgets/attributeMixins/telMixin.js.map +0 -1
  167. package/dist/new-widgets/baseWidgetMixin.js +0 -122
  168. package/dist/new-widgets/baseWidgetMixin.js.map +0 -1
  169. package/dist/new-widgets/callbackMixins/autocompletionMixin.js +0 -104
  170. package/dist/new-widgets/callbackMixins/autocompletionMixin.js.map +0 -1
  171. package/dist/new-widgets/callbackMixins/index.js +0 -8
  172. package/dist/new-widgets/callbackMixins/index.js.map +0 -1
  173. package/dist/new-widgets/callbackMixins/richtextMixin.js +0 -42
  174. package/dist/new-widgets/callbackMixins/richtextMixin.js.map +0 -1
  175. package/dist/new-widgets/callbackMixins/slimselect.css +0 -2
  176. package/dist/new-widgets/callbackMixins/slimselect.css.proxy.js +0 -10
  177. package/dist/new-widgets/new-widget-factory.js +0 -96
  178. package/dist/new-widgets/new-widget-factory.js.map +0 -1
  179. package/dist/new-widgets/templateAdditionMixins/addableMixin.js +0 -41
  180. package/dist/new-widgets/templateAdditionMixins/addableMixin.js.map +0 -1
  181. package/dist/new-widgets/templateAdditionMixins/index.js +0 -14
  182. package/dist/new-widgets/templateAdditionMixins/index.js.map +0 -1
  183. package/dist/new-widgets/templateAdditionMixins/labelLastMixin.js +0 -29
  184. package/dist/new-widgets/templateAdditionMixins/labelLastMixin.js.map +0 -1
  185. package/dist/new-widgets/templateAdditionMixins/labelMixin.js +0 -31
  186. package/dist/new-widgets/templateAdditionMixins/labelMixin.js.map +0 -1
  187. package/dist/new-widgets/templates/defaultTemplatesDirectory.js +0 -36
  188. package/dist/new-widgets/templates/defaultTemplatesDirectory.js.map +0 -1
  189. package/dist/new-widgets/templates/displayTemplatesDirectory.js +0 -90
  190. package/dist/new-widgets/templates/displayTemplatesDirectory.js.map +0 -1
  191. package/dist/new-widgets/templates/formTemplatesDirectory.js +0 -397
  192. package/dist/new-widgets/templates/formTemplatesDirectory.js.map +0 -1
  193. package/dist/new-widgets/templates/groupTemplatesDirectory.js +0 -21
  194. package/dist/new-widgets/templates/groupTemplatesDirectory.js.map +0 -1
  195. package/dist/new-widgets/templates/index.js +0 -7
  196. package/dist/new-widgets/templates/index.js.map +0 -1
  197. package/dist/new-widgets/templates/setTemplatesDirectory.js +0 -49
  198. package/dist/new-widgets/templates/setTemplatesDirectory.js.map +0 -1
  199. package/dist/new-widgets/templatesDependencies/altMixin.js +0 -13
  200. package/dist/new-widgets/templatesDependencies/altMixin.js.map +0 -1
  201. package/dist/new-widgets/templatesDependencies/editableMixin.js +0 -77
  202. package/dist/new-widgets/templatesDependencies/editableMixin.js.map +0 -1
  203. package/dist/new-widgets/templatesDependencies/filterRangeFormMixin.js +0 -38
  204. package/dist/new-widgets/templatesDependencies/filterRangeFormMixin.js.map +0 -1
  205. package/dist/new-widgets/templatesDependencies/formCheckboxMixin.js +0 -14
  206. package/dist/new-widgets/templatesDependencies/formCheckboxMixin.js.map +0 -1
  207. package/dist/new-widgets/templatesDependencies/formCheckboxesMixin.js +0 -51
  208. package/dist/new-widgets/templatesDependencies/formCheckboxesMixin.js.map +0 -1
  209. package/dist/new-widgets/templatesDependencies/formDropdownMixin.js +0 -66
  210. package/dist/new-widgets/templatesDependencies/formDropdownMixin.js.map +0 -1
  211. package/dist/new-widgets/templatesDependencies/formFileMixin.js +0 -81
  212. package/dist/new-widgets/templatesDependencies/formFileMixin.js.map +0 -1
  213. package/dist/new-widgets/templatesDependencies/formLengthMixin.js +0 -19
  214. package/dist/new-widgets/templatesDependencies/formLengthMixin.js.map +0 -1
  215. package/dist/new-widgets/templatesDependencies/formMinMaxMixin.js +0 -19
  216. package/dist/new-widgets/templatesDependencies/formMinMaxMixin.js.map +0 -1
  217. package/dist/new-widgets/templatesDependencies/formMixin.js +0 -66
  218. package/dist/new-widgets/templatesDependencies/formMixin.js.map +0 -1
  219. package/dist/new-widgets/templatesDependencies/formNumberMixin.js +0 -14
  220. package/dist/new-widgets/templatesDependencies/formNumberMixin.js.map +0 -1
  221. package/dist/new-widgets/templatesDependencies/formRadioMixin.js +0 -16
  222. package/dist/new-widgets/templatesDependencies/formRadioMixin.js.map +0 -1
  223. package/dist/new-widgets/templatesDependencies/formStepMixin.js +0 -13
  224. package/dist/new-widgets/templatesDependencies/formStepMixin.js.map +0 -1
  225. package/dist/new-widgets/templatesDependencies/linkTextMixin.js +0 -14
  226. package/dist/new-widgets/templatesDependencies/linkTextMixin.js.map +0 -1
  227. package/dist/new-widgets/templatesDependencies/multipleFormMixin.js +0 -125
  228. package/dist/new-widgets/templatesDependencies/multipleFormMixin.js.map +0 -1
  229. package/dist/new-widgets/templatesDependencies/multipleselectFormMixin.js +0 -74
  230. package/dist/new-widgets/templatesDependencies/multipleselectFormMixin.js.map +0 -1
  231. package/dist/new-widgets/templatesDependencies/patternMixin.js +0 -19
  232. package/dist/new-widgets/templatesDependencies/patternMixin.js.map +0 -1
  233. package/dist/new-widgets/templatesDependencies/rangeMixin.js +0 -110
  234. package/dist/new-widgets/templatesDependencies/rangeMixin.js.map +0 -1
  235. package/dist/new-widgets/templatesDependencies/setMixin.js +0 -12
  236. package/dist/new-widgets/templatesDependencies/setMixin.js.map +0 -1
  237. package/dist/new-widgets/templatesDependencies/valueRichtextMixin.js +0 -12
  238. package/dist/new-widgets/templatesDependencies/valueRichtextMixin.js.map +0 -1
  239. package/dist/new-widgets/valueTransformationMixins/autolinkMixin.js +0 -18
  240. package/dist/new-widgets/valueTransformationMixins/autolinkMixin.js.map +0 -1
  241. package/dist/new-widgets/valueTransformationMixins/dateMixin.js +0 -35
  242. package/dist/new-widgets/valueTransformationMixins/dateMixin.js.map +0 -1
  243. package/dist/new-widgets/valueTransformationMixins/dateTimeMixin.js +0 -16
  244. package/dist/new-widgets/valueTransformationMixins/dateTimeMixin.js.map +0 -1
  245. package/dist/new-widgets/valueTransformationMixins/index.js +0 -16
  246. package/dist/new-widgets/valueTransformationMixins/index.js.map +0 -1
  247. package/dist/new-widgets/valueTransformationMixins/markdownMixin.js +0 -25
  248. package/dist/new-widgets/valueTransformationMixins/markdownMixin.js.map +0 -1
  249. package/dist/new-widgets/valueTransformationMixins/multilineMixin.js +0 -17
  250. package/dist/new-widgets/valueTransformationMixins/multilineMixin.js.map +0 -1
  251. package/dist/new-widgets/valueTransformationMixins/oembedMixin.js +0 -27
  252. package/dist/new-widgets/valueTransformationMixins/oembedMixin.js.map +0 -1
  253. package/dist/solid-template-element.js +0 -164
  254. package/dist/solid-template-element.js.map +0 -1
  255. package/dist/style/default-theme.css +0 -24
  256. package/dist/style/default-theme.css.proxy.js +0 -10
  257. package/dist/widgets/baseWidget.js +0 -332
  258. package/dist/widgets/baseWidget.js.map +0 -1
  259. package/dist/widgets/widget-factory.js +0 -24
  260. package/dist/widgets/widget-factory.js.map +0 -1
@@ -1,46 +0,0 @@
1
- function _templateObject() {
2
- const data = _taggedTemplateLiteral(["\n <button\n @click=", "\n >\n ", "\n </button>\n "]);
3
-
4
- _templateObject = function () {
5
- return data;
6
- };
7
-
8
- return data;
9
- }
10
-
11
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
12
-
13
- import { Sib } from '../libs/Sib.js';
14
- import { store } from '../libs/store/store.js';
15
- import { html, render } from '../_snowpack/pkg/lit-html.js';
16
- export const SolidLang = {
17
- name: 'solid-lang',
18
- use: [],
19
- attributes: {
20
- lang: {
21
- type: String,
22
- default: null
23
- },
24
- dataLabel: {
25
- type: String,
26
- default: null
27
- }
28
- },
29
-
30
- created() {
31
- this.render();
32
- },
33
-
34
- languageLoader() {
35
- store.selectLanguage(this.lang);
36
- location.reload();
37
- },
38
-
39
- render() {
40
- let template = html(_templateObject(), this.languageLoader.bind(this), this.dataLabel);
41
- render(template, this.element);
42
- }
43
-
44
- };
45
- Sib.register(SolidLang);
46
- //# sourceMappingURL=solid-lang.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["solid-lang.ts"],"names":["Sib","store","html","render","SolidLang","name","use","attributes","lang","type","String","default","dataLabel","created","languageLoader","selectLanguage","location","reload","template","bind","element","register"],"mappings":";;;;;;;;;;;;AAAA,SAASA,GAAT,QAAoB,aAApB;AACA,SAASC,KAAT,QAAsB,qBAAtB;AAEA,SAASC,IAAT,EAAeC,MAAf,QAA6B,UAA7B;AAEA,OAAO,MAAMC,SAAS,GAAG;AACvBC,EAAAA,IAAI,EAAE,YADiB;AAEvBC,EAAAA,GAAG,EAAE,EAFkB;AAGvBC,EAAAA,UAAU,EAAE;AACVC,IAAAA,IAAI,EAAE;AACJC,MAAAA,IAAI,EAAEC,MADF;AAEJC,MAAAA,OAAO,EAAE;AAFL,KADI;AAKVC,IAAAA,SAAS,EAAE;AACTH,MAAAA,IAAI,EAAEC,MADG;AAETC,MAAAA,OAAO,EAAE;AAFA;AALD,GAHW;;AAcvBE,EAAAA,OAAO,GAAS;AACd,SAAKV,MAAL;AACD,GAhBsB;;AAkBvBW,EAAAA,cAAc,GAAI;AAChBb,IAAAA,KAAK,CAACc,cAAN,CAAqB,KAAKP,IAA1B;AACAQ,IAAAA,QAAQ,CAACC,MAAT;AACD,GArBsB;;AAuBvBd,EAAAA,MAAM,GAAG;AACP,QAAIe,QAAQ,GAAGhB,IAAH,oBAED,KAAKY,cAAL,CAAoBK,IAApB,CAAyB,IAAzB,CAFC,EAIR,KAAKP,SAJG,CAAZ;AAQAT,IAAAA,MAAM,CAACe,QAAD,EAAW,KAAKE,OAAhB,CAAN;AACD;;AAjCsB,CAAlB;AAoCPpB,GAAG,CAACqB,QAAJ,CAAajB,SAAb","sourcesContent":["import { Sib } from '../libs/Sib';\nimport { store } from '../libs/store/store';\n\nimport { html, render } from 'lit-html';\n\nexport const SolidLang = {\n name: 'solid-lang',\n use: [],\n attributes: {\n lang: {\n type: String,\n default: null\n },\n dataLabel: {\n type: String,\n default: null\n }\n },\n\n created(): void {\n this.render();\n },\n\n languageLoader () {\n store.selectLanguage(this.lang);\n location.reload();\n },\n\n render() {\n let template = html`\n <button\n @click=${this.languageLoader.bind(this)}\n >\n ${this.dataLabel}\n </button>\n `;\n\n render(template, this.element);\n }\n};\n\nSib.register(SolidLang);"]}
@@ -1,242 +0,0 @@
1
- function _templateObject2() {
2
- const data = _taggedTemplateLiteral(["\n <solid-display\n fields=\"", "\"\n data-src=\"", "\"\n ...=", "\n ></solid-display>\n "]);
3
-
4
- _templateObject2 = function () {
5
- return data;
6
- };
7
-
8
- return data;
9
- }
10
-
11
- function _templateObject() {
12
- const data = _taggedTemplateLiteral(["\n <div id=", " style=\"width:100%;height:100%;\"></div>\n "]);
13
-
14
- _templateObject = function () {
15
- return data;
16
- };
17
-
18
- return data;
19
- }
20
-
21
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
22
-
23
- import { Sib } from '../libs/Sib.js';
24
- import { ListMixin } from '../mixins/listMixin.js';
25
- import { StoreMixin } from '../mixins/storeMixin.js';
26
- import { WidgetMixin } from '../mixins/widgetMixin.js';
27
- import { CounterMixin } from '../mixins/counterMixin.js';
28
- import { FilterMixin } from '../mixins/filterMixin.js';
29
- import { FederationMixin } from '../mixins/federationMixin.js';
30
- import { GrouperMixin } from '../mixins/grouperMixin.js';
31
- import { NextMixin } from '../mixins/nextMixin.js';
32
- import { store } from '../libs/store/store.js';
33
- import { uniqID } from '../libs/helpers.js';
34
- import { spread } from '../libs/lit-helpers.js'; //@ts-ignore
35
-
36
- import L from 'https://cdn.skypack.dev/leaflet'; // TODO : revert to "leaflet" when apps up to date
37
-
38
- import 'https://cdn.skypack.dev/leaflet.markercluster'; // TODO : revert to "leaflet.markercluster" when apps up to date
39
-
40
- import { html, render } from '../_snowpack/pkg/lit-html.js';
41
- import { ifDefined } from '../_snowpack/pkg/lit-html/directives/if-defined.js';
42
- export const SolidMap = {
43
- name: 'solid-map',
44
- use: [WidgetMixin, ListMixin, StoreMixin, GrouperMixin, CounterMixin, FilterMixin, FederationMixin, NextMixin],
45
- attributes: {
46
- clustering: {
47
- type: Boolean,
48
- default: null
49
- }
50
- },
51
- initialState: {
52
- markers: {
53
- default: null
54
- },
55
- subscriptions: null,
56
- resetPlanned: false,
57
- hasBeenResetOnce: false
58
- },
59
-
60
- created() {
61
- //@ts-ignore
62
- import("../_snowpack/pkg/leaflet/dist/leaflet.css.proxy.js"); //@ts-ignore
63
-
64
- import("../style/default-theme.css.proxy.js"); //@ts-ignore
65
-
66
- import("../_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.css.proxy.js"); //@ts-ignore
67
-
68
- import("../_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.Default.css.proxy.js"); // reset when it becomes visible to prevent bug https://git.startinblox.com/framework/sib-core/issues/661
69
-
70
- document.body.addEventListener('navigate', () => setTimeout(() => this.isVisible && !this.hasBeenResetOnce && this.reset()));
71
- this.markers = [];
72
- this.subscriptions = new Map();
73
- },
74
-
75
- get isVisible() {
76
- return this.element.offsetParent !== null;
77
- },
78
-
79
- attached() {
80
- const id = uniqID();
81
- const template = html(_templateObject(), id);
82
- render(template, this.element);
83
- const div = this.element.querySelector("#".concat(id));
84
- this.map = L.map(div);
85
- L.tileLayer('https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png').addTo(this.map);
86
-
87
- if (this.clustering !== null) {
88
- this.markersCluster = L.markerClusterGroup();
89
- this.map.addLayer(this.markersCluster);
90
- }
91
- },
92
-
93
- reset() {
94
- if (this.isVisible) {
95
- // reset only if visible
96
- this.map.invalidateSize();
97
-
98
- if (this.markers.length) {
99
- this.map.fitBounds(L.featureGroup(this.markers).getBounds()); // Center map on markers if some available
100
- } else {
101
- this.map.fitWorld(); // ... or on the world if not
102
- }
103
-
104
- this.hasBeenResetOnce = true;
105
- }
106
- },
107
-
108
- /**
109
- * Execute a reset only if none is planned already
110
- */
111
- planReset() {
112
- if (!this.resetPlanned) {
113
- this.resetPlanned = true;
114
- setTimeout(() => {
115
- this.reset();
116
- this.resetPlanned = false;
117
- });
118
- }
119
- },
120
-
121
- dispatchSelect(event) {
122
- const target = event.target;
123
- const resource = target['options'].resource;
124
- this.element.dispatchEvent(new CustomEvent('resourceSelect', {
125
- detail: {
126
- resource: resource
127
- }
128
- }));
129
- this.goToNext(resource);
130
- },
131
-
132
- /**
133
- * Override listMixin method: initialize a marker on the map
134
- * @param resourceId: id of the resource to display
135
- * @param groupClass: class of the group of markers
136
- */
137
- async appendChildElt(resourceId, groupClass) {
138
- const resource = await store.getData(resourceId, this.context);
139
-
140
- if (!this.subscriptions.get(resourceId)) {
141
- this.subscriptions.set(resourceId, PubSub.subscribe(resourceId, () => this.updateDOM()));
142
- }
143
-
144
- if (!resource) return;
145
- const lat = await resource['lat'];
146
- const lng = await resource['lng'];
147
-
148
- if (lat && lng) {
149
- const icon = L.divIcon({
150
- // create the icon, doc here: https://leafletjs.com/reference-1.6.0.html#icon
151
- className: 'sib-custom-marker ' + groupClass,
152
- // default class used for styling
153
- iconSize: [8, 8],
154
- iconAnchor: [12, 34],
155
- popupAnchor: [0, -34]
156
- }); // create a marker, doc here: https://leafletjs.com/reference-1.6.0.html#marker
157
-
158
- const marker = L.marker([lat.toString(), lng.toString()], {
159
- resource,
160
- icon
161
- });
162
- if (this.clustering === null) marker.addTo(this.map);else this.markersCluster.addLayer(marker);
163
- marker.on('click', this.dispatchSelect.bind(this));
164
-
165
- if (this.fields !== null) {
166
- // show popups only if fields attribute
167
- marker.bindPopup(() => this.getPopupContent(resourceId), {
168
- minWidth: 150
169
- }); // re-generate popup solid-display
170
- }
171
-
172
- this.markers.push(marker);
173
- }
174
- },
175
-
176
- /**
177
- * Generate the solid-display of the popup
178
- * @param resourceId: id of the popup clicked
179
- */
180
- getPopupContent(resourceId) {
181
- const attributes = {};
182
-
183
- for (let attr of this.element.attributes) {
184
- //copy widget and value attributes
185
- if (attr.name.startsWith('value-') || attr.name.startsWith('label-') || attr.name.startsWith('widget-') || attr.name.startsWith('class-') || attr.name.startsWith('multiple-') || attr.name.startsWith('editable-') || attr.name.startsWith('action-') || attr.name.startsWith('default-') || attr.name == 'extra-context') attributes[attr.name] = attr.value;
186
- if (attr.name.startsWith('child-')) attributes[attr.name.replace(/^child-/, '')] = attr.value;
187
- }
188
-
189
- const div = document.createElement('div');
190
- const template = html(_templateObject2(), ifDefined(this.fields), resourceId, spread(attributes));
191
- render(template, div);
192
- return div.querySelector('solid-display');
193
- },
194
-
195
- /**
196
- * Override widgetMixin method: empty the map
197
- */
198
- empty() {
199
- if (!this.map) return;
200
- if (this.markersCluster) this.map.removeLayer(this.markersCluster);
201
-
202
- for (let marker of this.markers) this.map.removeLayer(marker);
203
-
204
- if (this.clustering !== null) {
205
- this.markersCluster = L.markerClusterGroup();
206
- this.map.addLayer(this.markersCluster);
207
- }
208
-
209
- this.markers = [];
210
- },
211
-
212
- /**
213
- * Override groupMixin method
214
- * @param groupName: value of the group
215
- */
216
- renderGroup(groupName) {
217
- const sanitizedGroupName = encodeURIComponent(groupName.toLowerCase()).replace(/%[0-9A-F]{2}/gi, '');
218
- const div = document.createElement('div'); // used to pass group info to renderDOM
219
-
220
- div.dataset.groupClass = 'group-' + sanitizedGroupName;
221
- return div;
222
- },
223
-
224
- /**
225
- * Override listMixin method: display all the resources
226
- * @param resources
227
- * @param listPostProcessors
228
- * @param div
229
- * @param context
230
- */
231
- async renderDOM(resources, listPostProcessors, div, context) {
232
- const groupClass = div.dataset.groupClass || ''; // get the group class from the useless div element
233
-
234
- await Promise.all(resources.map(resource => this.appendChildElt(resource['@id'], groupClass)));
235
- this.planReset();
236
- const nextProcessor = listPostProcessors.shift();
237
- if (nextProcessor) await nextProcessor(resources, listPostProcessors, div, context);
238
- }
239
-
240
- };
241
- Sib.register(SolidMap);
242
- //# sourceMappingURL=solid-map.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["solid-map.ts"],"names":["Sib","ListMixin","StoreMixin","WidgetMixin","CounterMixin","FilterMixin","FederationMixin","GrouperMixin","NextMixin","store","uniqID","spread","L","html","render","ifDefined","SolidMap","name","use","attributes","clustering","type","Boolean","default","initialState","markers","subscriptions","resetPlanned","hasBeenResetOnce","created","document","body","addEventListener","setTimeout","isVisible","reset","Map","element","offsetParent","attached","id","template","div","querySelector","map","tileLayer","addTo","markersCluster","markerClusterGroup","addLayer","invalidateSize","length","fitBounds","featureGroup","getBounds","fitWorld","planReset","dispatchSelect","event","target","resource","dispatchEvent","CustomEvent","detail","goToNext","appendChildElt","resourceId","groupClass","getData","context","get","set","PubSub","subscribe","updateDOM","lat","lng","icon","divIcon","className","iconSize","iconAnchor","popupAnchor","marker","toString","on","bind","fields","bindPopup","getPopupContent","minWidth","push","attr","startsWith","value","replace","createElement","empty","removeLayer","renderGroup","groupName","sanitizedGroupName","encodeURIComponent","toLowerCase","dataset","renderDOM","resources","listPostProcessors","Promise","all","nextProcessor","shift","register"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,GAAT,QAAoB,aAApB;AACA,SAASC,SAAT,QAA0B,qBAA1B;AACA,SAASC,UAAT,QAA2B,sBAA3B;AACA,SAASC,WAAT,QAA4B,uBAA5B;AACA,SAASC,YAAT,QAA6B,wBAA7B;AACA,SAASC,WAAT,QAA4B,uBAA5B;AACA,SAASC,eAAT,QAAgC,2BAAhC;AACA,SAASC,YAAT,QAA6B,wBAA7B;AACA,SAASC,SAAT,QAA0B,qBAA1B;AACA,SAASC,KAAT,QAAsB,qBAAtB;AACA,SAASC,MAAT,QAAuB,iBAAvB;AACA,SAASC,MAAT,QAAuB,qBAAvB,C,CAEA;;AACA,OAAOC,CAAP,MAAiC,iCAAjC,C,CAAoE;;AACpE,OAAO,+CAAP,C,CAAwD;;AAExD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SAAS,CAACG,WAAV,EAAD,CAAlB,CAA4CR,OAA5C,CAAoD,gBAApD,EAAsE,EAAtE,CAA3B;AACA,UAAMrD,GAAG,GAAGZ,QAAQ,CAACkE,aAAT,CAAuB,KAAvB,CAAZ,CAF6B,CAEc;;AAC3CtD,IAAAA,GAAG,CAAC8D,OAAJ,CAAYrC,UAAZ,GAAyB,WAAWkC,kBAApC;AACA,WAAO3D,GAAP;AACD,GAlMqB;;AAmMtB;AACF;AACA;AACA;AACA;AACA;AACA;AACE,QAAM+D,SAAN,CAAgBC,SAAhB,EAAqCC,kBAArC,EAAqEjE,GAArE,EAAuF2B,OAAvF,EAAwG;AACtG,UAAMF,UAAU,GAAGzB,GAAG,CAAC8D,OAAJ,CAAYrC,UAAZ,IAA0B,EAA7C,CADsG,CACrD;;AACjD,UAAMyC,OAAO,CAACC,GAAR,CAAYH,SAAS,CAAC9D,GAAV,CAAcgB,QAAQ,IAAI,KAAKK,cAAL,CAAoBL,QAAQ,CAAC,KAAD,CAA5B,EAAqCO,UAArC,CAA1B,CAAZ,CAAN;AACA,SAAKX,SAAL;AAEA,UAAMsD,aAAa,GAAGH,kBAAkB,CAACI,KAAnB,EAAtB;AACA,QAAGD,aAAH,EAAkB,MAAMA,aAAa,CAACJ,SAAD,EAAYC,kBAAZ,EAAgCjE,GAAhC,EAAqC2B,OAArC,CAAnB;AACnB;;AAjNqB,CAAjB;AAoNPrE,GAAG,CAACgH,QAAJ,CAAahG,QAAb","sourcesContent":["import { Sib } from '../libs/Sib';\nimport { ListMixin } from '../mixins/listMixin';\nimport { StoreMixin } from '../mixins/storeMixin';\nimport { WidgetMixin } from '../mixins/widgetMixin';\nimport { CounterMixin } from '../mixins/counterMixin';\nimport { FilterMixin } from '../mixins/filterMixin';\nimport { FederationMixin } from '../mixins/federationMixin';\nimport { GrouperMixin } from '../mixins/grouperMixin';\nimport { NextMixin } from '../mixins/nextMixin';\nimport { store } from '../libs/store/store';\nimport { uniqID } from '../libs/helpers';\nimport { spread } from '../libs/lit-helpers';\n\n//@ts-ignore\nimport L, { MarkerOptions } from 'https://cdn.skypack.dev/leaflet'; // TODO : revert to \"leaflet\" when apps up to date\nimport 'https://cdn.skypack.dev/leaflet.markercluster'; // TODO : revert to \"leaflet.markercluster\" when apps up to date\n\nimport { html, render } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nexport const SolidMap = {\n name: 'solid-map',\n use: [\n WidgetMixin,\n ListMixin,\n StoreMixin,\n GrouperMixin,\n CounterMixin,\n FilterMixin,\n FederationMixin,\n NextMixin,\n ],\n attributes: {\n clustering: {\n type: Boolean,\n default: null\n }\n },\n initialState: {\n markers: {\n default: null\n },\n subscriptions: null,\n resetPlanned: false,\n hasBeenResetOnce: false\n },\n created(): void {\n //@ts-ignore\n import('leaflet/dist/leaflet.css');\n //@ts-ignore\n import('../style/default-theme.css');\n //@ts-ignore\n import('leaflet.markercluster/dist/MarkerCluster.css');\n //@ts-ignore\n import('leaflet.markercluster/dist/MarkerCluster.Default.css');\n\n // reset when it becomes visible to prevent bug https://git.startinblox.com/framework/sib-core/issues/661\n document.body.addEventListener('navigate', () =>\n setTimeout(() => this.isVisible && !this.hasBeenResetOnce && this.reset())\n );\n this.markers = [];\n this.subscriptions = new Map();\n },\n get isVisible() {\n return this.element.offsetParent !== null\n },\n attached(): void {\n const id = uniqID();\n const template = html`\n <div id=${id} style=\"width:100%;height:100%;\"></div>\n `;\n render(template, this.element);\n\n const div = this.element.querySelector(`#${id}`);\n this.map = L.map(div);\n\n L.tileLayer(\n 'https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png'\n ).addTo(this.map);\n\n if (this.clustering !== null) {\n this.markersCluster = L.markerClusterGroup();\n this.map.addLayer(this.markersCluster);\n }\n },\n reset() {\n if (this.isVisible) { // reset only if visible\n this.map.invalidateSize();\n\n if (this.markers.length) {\n this.map.fitBounds(L.featureGroup(this.markers).getBounds()); // Center map on markers if some available\n } else {\n this.map.fitWorld(); // ... or on the world if not\n }\n this.hasBeenResetOnce = true;\n }\n },\n /**\n * Execute a reset only if none is planned already\n */\n planReset() {\n if (!this.resetPlanned) {\n this.resetPlanned = true;\n setTimeout(() => {\n this.reset();\n this.resetPlanned = false;\n })\n }\n },\n dispatchSelect(event: CustomEvent): void {\n const target = event.target as Element;\n const resource = target['options'].resource;\n this.element.dispatchEvent(\n new CustomEvent('resourceSelect', { detail: { resource: resource } })\n );\n this.goToNext(resource);\n },\n\n /**\n * Override listMixin method: initialize a marker on the map\n * @param resourceId: id of the resource to display\n * @param groupClass: class of the group of markers\n */\n async appendChildElt(resourceId: string, groupClass: string) {\n const resource = await store.getData(resourceId, this.context);\n if (!this.subscriptions.get(resourceId)) {\n this.subscriptions.set(resourceId, PubSub.subscribe(resourceId, () => this.updateDOM()))\n }\n if (!resource) return;\n const lat = await resource['lat'];\n const lng = await resource['lng'];\n\n if (lat && lng) {\n const icon = L.divIcon({ // create the icon, doc here: https://leafletjs.com/reference-1.6.0.html#icon\n className: 'sib-custom-marker ' + groupClass, // default class used for styling\n iconSize: [8, 8],\n iconAnchor: [12, 34],\n popupAnchor: [0,-34]\n });\n\n // create a marker, doc here: https://leafletjs.com/reference-1.6.0.html#marker\n const marker = L.marker(\n [lat.toString(), lng.toString()], \n {resource, icon} as MarkerOptions\n );\n if(this.clustering === null) marker.addTo(this.map);\n else this.markersCluster.addLayer(marker);\n marker.on('click', this.dispatchSelect.bind(this));\n\n if (this.fields !== null) { // show popups only if fields attribute\n marker.bindPopup(() => this.getPopupContent(resourceId), { minWidth: 150 }) // re-generate popup solid-display\n }\n\n this.markers.push(marker);\n }\n },\n /**\n * Generate the solid-display of the popup\n * @param resourceId: id of the popup clicked\n */\n getPopupContent(resourceId: string) {\n const attributes:{[key:string]: string} = {};\n\n for (let attr of this.element.attributes) {\n //copy widget and value attributes\n if (\n attr.name.startsWith('value-') ||\n attr.name.startsWith('label-') ||\n attr.name.startsWith('widget-') ||\n attr.name.startsWith('class-') ||\n attr.name.startsWith('multiple-') ||\n attr.name.startsWith('editable-') ||\n attr.name.startsWith('action-') ||\n attr.name.startsWith('default-') ||\n attr.name == 'extra-context'\n )\n attributes[attr.name] = attr.value;\n if (attr.name.startsWith('child-'))\n attributes[attr.name.replace(/^child-/, '')] = attr.value;\n }\n\n const div = document.createElement('div');\n const template = html`\n <solid-display\n fields=\"${ifDefined(this.fields)}\"\n data-src=\"${resourceId}\"\n ...=${spread(attributes)}\n ></solid-display>\n `;\n render(template, div);\n return div.querySelector('solid-display');\n },\n /**\n * Override widgetMixin method: empty the map\n */\n empty(): void {\n if (!this.map) return;\n if (this.markersCluster) this.map.removeLayer(this.markersCluster);\n for (let marker of this.markers) this.map.removeLayer(marker);\n if(this.clustering !== null) {\n this.markersCluster = L.markerClusterGroup();\n this.map.addLayer(this.markersCluster);\n }\n this.markers = [];\n },\n /**\n * Override groupMixin method\n * @param groupName: value of the group\n */\n renderGroup(groupName: string) {\n const sanitizedGroupName = encodeURIComponent(groupName.toLowerCase()).replace(/%[0-9A-F]{2}/gi, '');\n const div = document.createElement('div'); // used to pass group info to renderDOM\n div.dataset.groupClass = 'group-' + sanitizedGroupName;\n return div;\n },\n /**\n * Override listMixin method: display all the resources\n * @param resources\n * @param listPostProcessors\n * @param div\n * @param context\n */\n async renderDOM(resources: object[], listPostProcessors: Function[], div: HTMLElement, context: string) {\n const groupClass = div.dataset.groupClass || ''; // get the group class from the useless div element\n await Promise.all(resources.map(resource => this.appendChildElt(resource['@id'], groupClass)))\n this.planReset();\n\n const nextProcessor = listPostProcessors.shift();\n if(nextProcessor) await nextProcessor(resources, listPostProcessors, div, context);\n }\n};\n\nSib.register(SolidMap);"]}
@@ -1,263 +0,0 @@
1
- function _templateObject9() {
2
- const data = _taggedTemplateLiteral(["\n ", "\n ", "\n "]);
3
-
4
- _templateObject9 = function () {
5
- return data;
6
- };
7
-
8
- return data;
9
- }
10
-
11
- function _templateObject8() {
12
- const data = _taggedTemplateLiteral(["\n ", "\n ", "\n "]);
13
-
14
- _templateObject8 = function () {
15
- return data;
16
- };
17
-
18
- return data;
19
- }
20
-
21
- function _templateObject7() {
22
- const data = _taggedTemplateLiteral(["<td>", "</td>"]);
23
-
24
- _templateObject7 = function () {
25
- return data;
26
- };
27
-
28
- return data;
29
- }
30
-
31
- function _templateObject6() {
32
- const data = _taggedTemplateLiteral(["\n <td>\n <input type=\"checkbox\" data-selection />\n </td>"]);
33
-
34
- _templateObject6 = function () {
35
- return data;
36
- };
37
-
38
- return data;
39
- }
40
-
41
- function _templateObject5() {
42
- const data = _taggedTemplateLiteral(["\n <tr data-resource=\"", "\">\n ", "\n ", "\n </tr>\n "]);
43
-
44
- _templateObject5 = function () {
45
- return data;
46
- };
47
-
48
- return data;
49
- }
50
-
51
- function _templateObject4() {
52
- const data = _taggedTemplateLiteral(["\n <th>\n ", "\n </th>"]);
53
-
54
- _templateObject4 = function () {
55
- return data;
56
- };
57
-
58
- return data;
59
- }
60
-
61
- function _templateObject3() {
62
- const data = _taggedTemplateLiteral(["\n <th>\n <input type=\"checkbox\" @change=\"", "\" />\n </th>"]);
63
-
64
- _templateObject3 = function () {
65
- return data;
66
- };
67
-
68
- return data;
69
- }
70
-
71
- function _templateObject2() {
72
- const data = _taggedTemplateLiteral(["\n <tr>\n ", "\n ", "\n </tr>\n "]);
73
-
74
- _templateObject2 = function () {
75
- return data;
76
- };
77
-
78
- return data;
79
- }
80
-
81
- function _templateObject() {
82
- const data = _taggedTemplateLiteral(["\n <solid-form\n data-src=\"", "\"\n fields=\"", "\"\n partial\n autosave\n ...=", "\n ></solid-form>\n "]);
83
-
84
- _templateObject = function () {
85
- return data;
86
- };
87
-
88
- return data;
89
- }
90
-
91
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
92
-
93
- import { Sib } from '../libs/Sib.js';
94
- import { store } from '../libs/store/store.js';
95
- import { WidgetMixin } from '../mixins/widgetMixin.js';
96
- import { ListMixin } from '../mixins/listMixin.js';
97
- import { StoreMixin } from '../mixins/storeMixin.js';
98
- import { PaginateMixin } from '../mixins/paginateMixin.js';
99
- import { FilterMixin } from '../mixins/filterMixin.js';
100
- import { CounterMixin } from '../mixins/counterMixin.js';
101
- import { SorterMixin } from '../mixins/sorterMixin.js';
102
- import { GrouperMixin } from '../mixins/grouperMixin.js';
103
- import { FederationMixin } from '../mixins/federationMixin.js';
104
- import { HighlighterMixin } from '../mixins/highlighterMixin.js';
105
- import { RequiredMixin } from '../mixins/requiredMixin.js';
106
- import { html, render } from '../_snowpack/pkg/lit-html.js';
107
- import { until } from '../_snowpack/pkg/lit-html/directives/until.js';
108
- import { spread } from '../libs/lit-helpers.js';
109
- export const SolidTable = {
110
- name: 'solid-table',
111
- use: [WidgetMixin, ListMixin, StoreMixin, PaginateMixin, GrouperMixin, CounterMixin, HighlighterMixin, FilterMixin, SorterMixin, RequiredMixin, FederationMixin],
112
- attributes: {
113
- defaultWidget: {
114
- type: String,
115
- default: 'solid-display-value'
116
- },
117
- selectable: {
118
- type: String,
119
- default: null
120
- },
121
- header: {
122
- type: String,
123
- default: null
124
- }
125
- },
126
-
127
- get parentElement() {
128
- return 'table';
129
- },
130
-
131
- get defaultMultipleWidget() {
132
- return 'solid-multiple';
133
- },
134
-
135
- get defaultSetWidget() {
136
- return 'solid-set-default';
137
- },
138
-
139
- get selectedLines() {
140
- if (this.selectable === null) return [];
141
- return Array.from(this.element.querySelectorAll('input[data-selection]:checked')).map(e => {
142
- var _e$closest;
143
-
144
- return e === null || e === void 0 ? void 0 : (_e$closest = e.closest('[data-resource]')) === null || _e$closest === void 0 ? void 0 : _e$closest.getAttribute('data-resource');
145
- });
146
- },
147
-
148
- /**
149
- * Select all lines
150
- * @param e - event
151
- */
152
- selectAll(e) {
153
- if (this.selectable === null) return;
154
-
155
- for (const checkbox of Array.from(this.element.querySelectorAll('input[data-selection]'))) {
156
- checkbox.checked = e.target.checked;
157
- }
158
- },
159
-
160
- /**
161
- * Unselect all lines
162
- */
163
- unselectAll() {
164
- if (this.selectable === null) return;
165
-
166
- for (const checkbox of Array.from(this.element.querySelectorAll('input[data-selection]'))) {
167
- checkbox.checked = false;
168
- }
169
- },
170
-
171
- /**
172
- * Select specific lines
173
- * @param lines - array of selected lines
174
- */
175
- selectLines(lines) {
176
- if (this.selectable === null || lines.length === 0) return;
177
-
178
- for (const line of lines) {
179
- const checkbox = this.element.querySelector("[data-resource=\"".concat(line, "\"] input[data-selection]"));
180
- if (checkbox) checkbox.checked = true;
181
- }
182
- },
183
-
184
- /**
185
- * Create a widget for the field or a form if it's editable
186
- * @param field
187
- * @param resource
188
- */
189
- async createCellWidget(field, resource) {
190
- // if regular widget
191
- if (!this.element.hasAttribute('editable-' + field)) return this.createWidgetTemplate(field, resource, true); // if editable widget
192
-
193
- const attributes = {};
194
- const formWidgetAttributes = [// attributes to give to the form widget
195
- 'range', 'enum', 'placeholder', 'required', 'autocomplete', 'option-label', 'option-value', 'min', 'max', 'pattern', 'title', 'widget'];
196
-
197
- for (let attr of formWidgetAttributes) this.addToAttributes("".concat(attr, "-").concat(field), "".concat(attr, "-").concat(field), attributes);
198
-
199
- const formAttributes = [// attributes to give to the form
200
- 'class', 'submit-button', 'next'];
201
-
202
- for (let attr of formAttributes) this.addToAttributes("".concat(attr, "-").concat(field), attr, attributes);
203
-
204
- return html(_templateObject(), resource['@id'], field, spread(attributes));
205
- },
206
-
207
- /**
208
- * Creates a header line for the table
209
- * @param fields
210
- */
211
- getHeader(fields) {
212
- let template = html(_templateObject2(), this.selectable !== null ? html(_templateObject3(), this.selectAll.bind(this)) : '', fields.map(field => html(_templateObject4(), this.element.hasAttribute('label-' + field) ? this.element.getAttribute('label-' + field) : field)));
213
- return template;
214
- },
215
-
216
- /**
217
- * Returns template of a child element (resource)
218
- * @param resourceId
219
- * @param attributes
220
- */
221
- async getChildTemplate(resourceId, fields) {
222
- const resource = await store.getData(resourceId, this.context);
223
- let template = html(_templateObject5(), resourceId, this.selectable !== null ? html(_templateObject6()) : '', fields.map(field => html(_templateObject7(), until(this.createCellWidget(field, resource)))));
224
- return template;
225
- },
226
-
227
- /**
228
- * Creates and render the content of a single element (resource)
229
- * @param parent
230
- */
231
- async appendSingleElt(parent) {
232
- const fields = await this.getFields();
233
- const template = html(_templateObject8(), this.header !== null ? this.getHeader(fields) : '', until(this.getChildTemplate(this.resource['@id'], fields)));
234
- render(template, parent);
235
- },
236
-
237
- /**
238
- * @override listMixin method to use litHtml
239
- *
240
- * Render resources from a container
241
- * @param resources
242
- * @param listPostProcessors
243
- * @param div
244
- * @param context
245
- */
246
- async renderDOM(resources, listPostProcessors, div, context) {
247
- const selectedLines = [...this.selectedLines]; // save selected lines before moving them
248
-
249
- const fields = await this.getFields();
250
- const childTemplates = await Promise.all(resources.map(r => r ? this.getChildTemplate(r['@id'], fields) : null));
251
- const template = html(_templateObject9(), this.header !== null ? this.getHeader(fields) : '', childTemplates); // create a child template for each resource
252
-
253
- render(template, div); // Re-select the right lines
254
-
255
- this.unselectAll();
256
- this.selectLines(selectedLines);
257
- const nextProcessor = listPostProcessors.shift();
258
- if (nextProcessor) await nextProcessor(resources, listPostProcessors, div, context);
259
- }
260
-
261
- };
262
- Sib.register(SolidTable);
263
- //# sourceMappingURL=solid-table.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["solid-table.ts"],"names":["Sib","store","WidgetMixin","ListMixin","StoreMixin","PaginateMixin","FilterMixin","CounterMixin","SorterMixin","GrouperMixin","FederationMixin","HighlighterMixin","RequiredMixin","html","render","until","spread","SolidTable","name","use","attributes","defaultWidget","type","String","default","selectable","header","parentElement","defaultMultipleWidget","defaultSetWidget","selectedLines","Array","from","element","querySelectorAll","map","e","closest","getAttribute","selectAll","checkbox","checked","target","unselectAll","selectLines","lines","length","line","querySelector","createCellWidget","field","resource","hasAttribute","createWidgetTemplate","formWidgetAttributes","attr","addToAttributes","formAttributes","getHeader","fields","template","bind","getChildTemplate","resourceId","getData","context","appendSingleElt","parent","getFields","renderDOM","resources","listPostProcessors","div","childTemplates","Promise","all","r","nextProcessor","shift","register"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAASA,GAAT,QAAoB,aAApB;AACA,SAASC,KAAT,QAAsB,qBAAtB;AACA,SAASC,WAAT,QAA4B,uBAA5B;AACA,SAASC,SAAT,QAA0B,qBAA1B;AACA,SAASC,UAAT,QAA2B,sBAA3B;AACA,SAASC,aAAT,QAA8B,yBAA9B;AACA,SAASC,WAAT,QAA4B,uBAA5B;AACA,SAASC,YAAT,QAA6B,wBAA7B;AACA,SAASC,WAAT,QAA4B,uBAA5B;AACA,SAASC,YAAT,QAA6B,wBAA7B;AACA,SAASC,eAAT,QAAgC,2BAAhC;AACA,SAASC,gBAAT,QAAiC,4BAAjC;AACA,SAASC,aAAT,QAA8B,yBAA9B;AAEA,SAASC,IAAT,EAAeC,MAAf,QAA6B,UAA7B;AACA,SAASC,KAAT,QAAsB,2BAAtB;AACA,SAASC,MAAT,QAAuB,qBAAvB;AAEA,OAAO,MAAMC,UAAU,GAAG;AACxBC,EAAAA,IAAI,EAAE,aADkB;AAExBC,EAAAA,GAAG,EAAE,CACHjB,WADG,EAEHC,SAFG,EAGHC,UAHG,EAIHC,aAJG,EAKHI,YALG,EAMHF,YANG,EAOHI,gBAPG,EAQHL,WARG,EASHE,WATG,EAUHI,aAVG,EAWHF,eAXG,CAFmB;AAexBU,EAAAA,UAAU,EAAE;AACVC,IAAAA,aAAa,EAAE;AACbC,MAAAA,IAAI,EAAEC,MADO;AAEbC,MAAAA,OAAO,EAAE;AAFI,KADL;AAKVC,IAAAA,UAAU,EAAE;AACVH,MAAAA,IAAI,EAAEC,MADI;AAEVC,MAAAA,OAAO,EAAE;AAFC,KALF;AASVE,IAAAA,MAAM,EAAE;AACNJ,MAAAA,IAAI,EA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sib';\nimport { store } from '../libs/store/store';\nimport { WidgetMixin } from '../mixins/widgetMixin';\nimport { ListMixin } from '../mixins/listMixin';\nimport { StoreMixin } from '../mixins/storeMixin';\nimport { PaginateMixin } from '../mixins/paginateMixin';\nimport { FilterMixin } from '../mixins/filterMixin';\nimport { CounterMixin } from '../mixins/counterMixin';\nimport { SorterMixin } from '../mixins/sorterMixin';\nimport { GrouperMixin } from '../mixins/grouperMixin';\nimport { FederationMixin } from '../mixins/federationMixin';\nimport { HighlighterMixin } from '../mixins/highlighterMixin';\nimport { RequiredMixin } from '../mixins/requiredMixin';\n\nimport { html, render } from 'lit-html';\nimport { until } from 'lit-html/directives/until';\nimport { spread } from '../libs/lit-helpers';\n\nexport const SolidTable = {\n name: 'solid-table',\n use: [\n WidgetMixin,\n ListMixin,\n StoreMixin,\n PaginateMixin,\n GrouperMixin,\n CounterMixin,\n HighlighterMixin,\n FilterMixin,\n SorterMixin,\n RequiredMixin,\n FederationMixin,\n ],\n attributes: {\n defaultWidget: {\n type: String,\n default: 'solid-display-value',\n },\n selectable: {\n type: String,\n default: null,\n },\n header: {\n type: String,\n default: null,\n },\n },\n get parentElement(): string {\n return 'table';\n },\n get defaultMultipleWidget(): string {\n return 'solid-multiple';\n },\n get defaultSetWidget(): string {\n return 'solid-set-default';\n },\n get selectedLines() {\n if (this.selectable === null) return [];\n return (Array.from(this.element.querySelectorAll('input[data-selection]:checked')) as Element[])\n .map(e => e?.closest('[data-resource]')?.getAttribute('data-resource'));\n },\n /**\n * Select all lines\n * @param e - event\n */\n selectAll(e) {\n if (this.selectable === null) return;\n for (const checkbox of Array.from(this.element.querySelectorAll('input[data-selection]') as HTMLInputElement[])) {\n checkbox.checked = e.target.checked;\n }\n },\n /**\n * Unselect all lines\n */\n unselectAll(): void {\n if (this.selectable === null) return;\n for (const checkbox of Array.from(this.element.querySelectorAll('input[data-selection]') as HTMLInputElement[])) {\n checkbox.checked = false;\n }\n },\n /**\n * Select specific lines\n * @param lines - array of selected lines\n */\n selectLines(lines: string[]) {\n if (this.selectable === null || lines.length === 0) return;\n for (const line of lines) {\n const checkbox = this.element.querySelector(`[data-resource=\"${line}\"] input[data-selection]`);\n if (checkbox) checkbox.checked = true;\n }\n },\n /**\n * Create a widget for the field or a form if it's editable\n * @param field\n * @param resource\n */\n async createCellWidget(field: string, resource: Resource) {\n // if regular widget\n if (!this.element.hasAttribute('editable-' + field)) return this.createWidgetTemplate(field, resource, true);\n\n // if editable widget\n const attributes = {};\n const formWidgetAttributes = [ // attributes to give to the form widget\n 'range',\n 'enum',\n 'placeholder',\n 'required',\n 'autocomplete',\n 'option-label',\n 'option-value',\n 'min',\n 'max',\n 'pattern',\n 'title',\n 'widget'\n ];\n for (let attr of formWidgetAttributes) this.addToAttributes(`${attr}-${field}`, `${attr}-${field}`, attributes)\n\n const formAttributes = [ // attributes to give to the form\n 'class',\n 'submit-button',\n 'next'\n ];\n for (let attr of formAttributes) this.addToAttributes(`${attr}-${field}`, attr, attributes)\n\n return html`\n <solid-form\n data-src=\"${resource['@id']}\"\n fields=\"${field}\"\n partial\n autosave\n ...=${spread(attributes)}\n ></solid-form>\n `;\n },\n /**\n * Creates a header line for the table\n * @param fields\n */\n getHeader(fields: string[]) {\n let template = html`\n <tr>\n ${this.selectable !== null ? html`\n <th>\n <input type=\"checkbox\" @change=\"${this.selectAll.bind(this)}\" />\n </th>` : ''}\n ${fields.map((field: string) => html`\n <th>\n ${this.element.hasAttribute('label-'+field) ? this.element.getAttribute('label-'+field) : field}\n </th>`)}\n </tr>\n `\n return template;\n },\n /**\n * Returns template of a child element (resource)\n * @param resourceId\n * @param attributes\n */\n async getChildTemplate(resourceId: string, fields) {\n const resource = await store.getData(resourceId, this.context);\n let template = html`\n <tr data-resource=\"${resourceId}\">\n ${this.selectable !== null ? html`\n <td>\n <input type=\"checkbox\" data-selection />\n </td>` : ''}\n ${fields.map((field: string) => html`<td>${until(this.createCellWidget(field, resource))}</td>`)}\n </tr>\n `\n return template;\n },\n\n /**\n * Creates and render the content of a single element (resource)\n * @param parent\n */\n async appendSingleElt(parent: HTMLElement): Promise<void> {\n const fields = await this.getFields();\n\n const template = html`\n ${this.header !== null ? this.getHeader(fields) : ''}\n ${until(this.getChildTemplate(this.resource['@id'], fields))}\n `;\n render(template, parent);\n },\n\n /**\n * @override listMixin method to use litHtml\n *\n * Render resources from a container\n * @param resources\n * @param listPostProcessors\n * @param div\n * @param context\n */\n async renderDOM(\n resources: object[],\n listPostProcessors: Function[],\n div: HTMLElement,\n context: string,\n ) {\n const selectedLines = [...this.selectedLines]; // save selected lines before moving them\n const fields = await this.getFields();\n const childTemplates = await Promise.all(\n resources.map(r => r ? this.getChildTemplate(r['@id'], fields) : null)\n );\n const template = html`\n ${this.header !== null ? this.getHeader(fields) : ''}\n ${childTemplates}\n `; // create a child template for each resource\n render(template, div);\n\n // Re-select the right lines\n this.unselectAll();\n this.selectLines(selectedLines);\n\n const nextProcessor = listPostProcessors.shift();\n if (nextProcessor)\n await nextProcessor(\n resources,\n listPostProcessors,\n div,\n context\n );\n },\n};\n\nSib.register(SolidTable);\n"]}