@startinblox/core 0.17.31 → 0.18.0-beta.1

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 (255) hide show
  1. package/dist/_snowpack/pkg/autolinker.js +3515 -3367
  2. package/dist/_snowpack/pkg/autolinker.js.map +1 -1
  3. package/dist/_snowpack/pkg/common/{_baseUnary-217dffb2.js → _baseUnary-c1edb653.js} +16 -40
  4. package/dist/_snowpack/pkg/common/{_baseUnary-217dffb2.js.map → _baseUnary-c1edb653.js.map} +1 -1
  5. package/dist/_snowpack/pkg/common/{_commonjsHelpers-8c19dec8.js → _commonjsHelpers-37fa8da4.js} +6 -2
  6. package/dist/_snowpack/pkg/common/_commonjsHelpers-37fa8da4.js.map +1 -0
  7. package/dist/_snowpack/pkg/common/{decode-a4c334cf.js → decode-26fbf385.js} +38 -69
  8. package/dist/_snowpack/pkg/common/decode-26fbf385.js.map +1 -0
  9. package/dist/_snowpack/pkg/common/lit-html-3647afce.js +1104 -0
  10. package/dist/_snowpack/pkg/common/lit-html-3647afce.js.map +1 -0
  11. package/dist/_snowpack/pkg/delta-markdown-for-quill.js +4767 -4246
  12. package/dist/_snowpack/pkg/delta-markdown-for-quill.js.map +1 -1
  13. package/dist/_snowpack/pkg/dialog-polyfill.js +107 -139
  14. package/dist/_snowpack/pkg/dialog-polyfill.js.map +1 -1
  15. package/dist/_snowpack/pkg/fusejs.js +411 -601
  16. package/dist/_snowpack/pkg/fusejs.js.map +1 -1
  17. package/dist/_snowpack/pkg/jsonld-context-parser.js +718 -686
  18. package/dist/_snowpack/pkg/jsonld-context-parser.js.map +1 -1
  19. package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.Default.css +59 -59
  20. package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.Default.css.proxy.js +1 -1
  21. package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.css +14 -14
  22. package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.css.proxy.js +1 -1
  23. package/dist/_snowpack/pkg/lit-html/directives/if-defined.js +13 -14
  24. package/dist/_snowpack/pkg/lit-html/directives/if-defined.js.map +1 -1
  25. package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js +17 -15
  26. package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js.map +1 -1
  27. package/dist/_snowpack/pkg/lit-html/directives/until.js +45 -46
  28. package/dist/_snowpack/pkg/lit-html/directives/until.js.map +1 -1
  29. package/dist/_snowpack/pkg/lit-html.js +37 -35
  30. package/dist/_snowpack/pkg/lit-html.js.map +1 -1
  31. package/dist/_snowpack/pkg/markdown-it-link-attributes.js +1 -20
  32. package/dist/_snowpack/pkg/markdown-it-link-attributes.js.map +1 -1
  33. package/dist/_snowpack/pkg/markdown-it.js +1731 -2284
  34. package/dist/_snowpack/pkg/markdown-it.js.map +1 -1
  35. package/dist/_snowpack/pkg/quill-delta-to-markdown.js +236 -294
  36. package/dist/_snowpack/pkg/quill-delta-to-markdown.js.map +1 -1
  37. package/dist/_snowpack/pkg/quill.js +12077 -11017
  38. package/dist/_snowpack/pkg/quill.js.map +1 -1
  39. package/dist/_snowpack/pkg/slim-select.js +711 -1
  40. package/dist/_snowpack/pkg/slim-select.js.map +1 -1
  41. package/dist/_snowpack/pkg/tui-calendar/dist/tui-calendar.css +1 -16
  42. package/dist/_snowpack/pkg/tui-calendar/dist/tui-calendar.css.proxy.js +1 -1
  43. package/dist/_snowpack/pkg/tui-calendar.js +44297 -40075
  44. package/dist/_snowpack/pkg/tui-calendar.js.map +1 -1
  45. package/dist/components/solid-ac-checker.js +4 -17
  46. package/dist/components/solid-calendar.js +5 -26
  47. package/dist/components/solid-delete.js +9 -24
  48. package/dist/components/solid-display.js +15 -59
  49. package/dist/components/solid-form-search.js +27 -79
  50. package/dist/components/solid-form.js +48 -143
  51. package/dist/components/solid-lang.js +8 -19
  52. package/dist/components/solid-map.js +26 -64
  53. package/dist/components/solid-table.js +51 -133
  54. package/dist/components/solid-widget.js +2 -24
  55. package/dist/index.js +17 -11
  56. package/dist/libs/Component.js +4 -10
  57. package/dist/libs/ComponentFactory.js +6 -34
  58. package/dist/libs/Compositor.js +8 -15
  59. package/dist/libs/Sib.js +7 -21
  60. package/dist/libs/filter.js +184 -0
  61. package/dist/libs/helpers.js +19 -47
  62. package/dist/libs/interfaces.js +1 -1
  63. package/dist/libs/lit-helpers.js +7 -34
  64. package/dist/libs/polyfills.js +7 -10
  65. package/dist/libs/store/server-pagination.js +22 -0
  66. package/dist/libs/store/server-search.js +35 -0
  67. package/dist/libs/store/store.js +212 -227
  68. package/dist/mixins/attributeBinderMixin.js +17 -25
  69. package/dist/mixins/contextMixin.js +5 -7
  70. package/dist/mixins/counterMixin.js +2 -23
  71. package/dist/mixins/federationMixin.js +2 -14
  72. package/dist/mixins/filterMixin.js +60 -100
  73. package/dist/mixins/grouperMixin.js +11 -18
  74. package/dist/mixins/highlighterMixin.js +2 -8
  75. package/dist/mixins/interfaces.js +3 -5
  76. package/dist/mixins/listMixin.js +12 -43
  77. package/dist/mixins/nextMixin.js +1 -4
  78. package/dist/mixins/paginateMixin.js +17 -30
  79. package/dist/mixins/requiredMixin.js +1 -9
  80. package/dist/mixins/serverPaginationMixin.js +122 -0
  81. package/dist/mixins/sorterMixin.js +26 -44
  82. package/dist/mixins/storeMixin.js +28 -21
  83. package/dist/mixins/translationMixin.js +2 -12
  84. package/dist/mixins/validationMixin.js +28 -46
  85. package/dist/mixins/widgetMixin.js +58 -154
  86. package/dist/new-widgets/attributeMixins/actionMixin.js +1 -2
  87. package/dist/new-widgets/attributeMixins/blankMixin.js +1 -4
  88. package/dist/new-widgets/attributeMixins/booleanMixin.js +1 -4
  89. package/dist/new-widgets/attributeMixins/index.js +1 -2
  90. package/dist/new-widgets/attributeMixins/mailtoMixin.js +1 -4
  91. package/dist/new-widgets/attributeMixins/multipleMixin.js +1 -2
  92. package/dist/new-widgets/attributeMixins/numberMixin.js +1 -4
  93. package/dist/new-widgets/attributeMixins/placeholderMixin.js +1 -4
  94. package/dist/new-widgets/attributeMixins/telMixin.js +1 -4
  95. package/dist/new-widgets/baseWidgetMixin.js +5 -18
  96. package/dist/new-widgets/callbackMixins/autocompletionMixin.js +3 -11
  97. package/dist/new-widgets/callbackMixins/index.js +1 -2
  98. package/dist/new-widgets/callbackMixins/richtextMixin.js +1 -6
  99. package/dist/new-widgets/interfaces.js +1 -0
  100. package/dist/new-widgets/new-widget-factory.js +14 -19
  101. package/dist/new-widgets/templateAdditionMixins/addableMixin.js +6 -21
  102. package/dist/new-widgets/templateAdditionMixins/index.js +2 -3
  103. package/dist/new-widgets/templateAdditionMixins/labelLastMixin.js +5 -18
  104. package/dist/new-widgets/templateAdditionMixins/labelMixin.js +5 -18
  105. package/dist/new-widgets/templates/defaultTemplatesDirectory.js +21 -27
  106. package/dist/new-widgets/templates/displayTemplatesDirectory.js +35 -70
  107. package/dist/new-widgets/templates/formTemplatesDirectory.js +350 -315
  108. package/dist/new-widgets/templates/groupTemplatesDirectory.js +5 -15
  109. package/dist/new-widgets/templates/index.js +1 -2
  110. package/dist/new-widgets/templates/setTemplatesDirectory.js +4 -37
  111. package/dist/new-widgets/templatesDependencies/altMixin.js +1 -2
  112. package/dist/new-widgets/templatesDependencies/editableMixin.js +9 -26
  113. package/dist/new-widgets/templatesDependencies/filterRangeFormMixin.js +3 -7
  114. package/dist/new-widgets/templatesDependencies/formCheckboxMixin.js +1 -5
  115. package/dist/new-widgets/templatesDependencies/formCheckboxesMixin.js +1 -11
  116. package/dist/new-widgets/templatesDependencies/formDropdownMixin.js +3 -13
  117. package/dist/new-widgets/templatesDependencies/formFileMixin.js +1 -13
  118. package/dist/new-widgets/templatesDependencies/formLengthMixin.js +1 -2
  119. package/dist/new-widgets/templatesDependencies/formMinMaxMixin.js +1 -2
  120. package/dist/new-widgets/templatesDependencies/formMixin.js +4 -14
  121. package/dist/new-widgets/templatesDependencies/formNumberMixin.js +1 -5
  122. package/dist/new-widgets/templatesDependencies/formRadioMixin.js +1 -5
  123. package/dist/new-widgets/templatesDependencies/formStepMixin.js +1 -2
  124. package/dist/new-widgets/templatesDependencies/linkTextMixin.js +13 -0
  125. package/dist/new-widgets/templatesDependencies/multipleFormMixin.js +23 -18
  126. package/dist/new-widgets/templatesDependencies/multipleselectFormMixin.js +1 -10
  127. package/dist/new-widgets/templatesDependencies/patternMixin.js +1 -2
  128. package/dist/new-widgets/templatesDependencies/rangeMixin.js +5 -15
  129. package/dist/new-widgets/templatesDependencies/setMixin.js +1 -4
  130. package/dist/new-widgets/templatesDependencies/valueRichtextMixin.js +1 -4
  131. package/dist/new-widgets/valueTransformationMixins/autolinkMixin.js +1 -5
  132. package/dist/new-widgets/valueTransformationMixins/dateMixin.js +5 -11
  133. package/dist/new-widgets/valueTransformationMixins/dateTimeMixin.js +1 -5
  134. package/dist/new-widgets/valueTransformationMixins/index.js +1 -2
  135. package/dist/new-widgets/valueTransformationMixins/markdownMixin.js +1 -7
  136. package/dist/new-widgets/valueTransformationMixins/multilineMixin.js +1 -5
  137. package/dist/new-widgets/valueTransformationMixins/oembedMixin.js +1 -7
  138. package/dist/solid-template-element.js +24 -44
  139. package/dist/widgets/baseWidget.js +21 -85
  140. package/dist/widgets/widget-factory.js +4 -6
  141. package/package.json +8 -6
  142. package/dist/_snowpack/env.js +0 -3
  143. package/dist/_snowpack/pkg/autolinker.js.map.proxy.js +0 -1
  144. package/dist/_snowpack/pkg/common/_baseUnary-217dffb2.js.map.proxy.js +0 -1
  145. package/dist/_snowpack/pkg/common/_commonjsHelpers-8c19dec8.js.map +0 -1
  146. package/dist/_snowpack/pkg/common/_commonjsHelpers-8c19dec8.js.map.proxy.js +0 -1
  147. package/dist/_snowpack/pkg/common/decode-a4c334cf.js.map +0 -1
  148. package/dist/_snowpack/pkg/common/decode-a4c334cf.js.map.proxy.js +0 -1
  149. package/dist/_snowpack/pkg/common/lit-html-babd44cd.js +0 -1119
  150. package/dist/_snowpack/pkg/common/lit-html-babd44cd.js.map +0 -1
  151. package/dist/_snowpack/pkg/common/lit-html-babd44cd.js.map.proxy.js +0 -1
  152. package/dist/_snowpack/pkg/delta-markdown-for-quill.js.map.proxy.js +0 -1
  153. package/dist/_snowpack/pkg/dialog-polyfill.js.map.proxy.js +0 -1
  154. package/dist/_snowpack/pkg/fusejs.js.map.proxy.js +0 -1
  155. package/dist/_snowpack/pkg/jsonld-context-parser.js.map.proxy.js +0 -1
  156. package/dist/_snowpack/pkg/lit-html/directives/if-defined.js.map.proxy.js +0 -1
  157. package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js.map.proxy.js +0 -1
  158. package/dist/_snowpack/pkg/lit-html/directives/until.js.map.proxy.js +0 -1
  159. package/dist/_snowpack/pkg/lit-html.js.map.proxy.js +0 -1
  160. package/dist/_snowpack/pkg/markdown-it-link-attributes.js.map.proxy.js +0 -1
  161. package/dist/_snowpack/pkg/markdown-it.js.map.proxy.js +0 -1
  162. package/dist/_snowpack/pkg/quill-delta-to-markdown.js.map.proxy.js +0 -1
  163. package/dist/_snowpack/pkg/quill.js.map.proxy.js +0 -1
  164. package/dist/_snowpack/pkg/slim-select.js.map.proxy.js +0 -1
  165. package/dist/_snowpack/pkg/tui-calendar.js.map.proxy.js +0 -1
  166. package/dist/components/solid-ac-checker.js.map +0 -1
  167. package/dist/components/solid-calendar.js.map +0 -1
  168. package/dist/components/solid-delete.js.map +0 -1
  169. package/dist/components/solid-display.js.map +0 -1
  170. package/dist/components/solid-form-search.js.map +0 -1
  171. package/dist/components/solid-form.js.map +0 -1
  172. package/dist/components/solid-lang.js.map +0 -1
  173. package/dist/components/solid-map.js.map +0 -1
  174. package/dist/components/solid-table.js.map +0 -1
  175. package/dist/components/solid-widget.js.map +0 -1
  176. package/dist/index.js.map +0 -1
  177. package/dist/libs/Component.js.map +0 -1
  178. package/dist/libs/ComponentFactory.js.map +0 -1
  179. package/dist/libs/Compositor.js.map +0 -1
  180. package/dist/libs/Sib.js.map +0 -1
  181. package/dist/libs/helpers.js.map +0 -1
  182. package/dist/libs/interfaces.js.map +0 -1
  183. package/dist/libs/lit-helpers.js.map +0 -1
  184. package/dist/libs/polyfills.js.map +0 -1
  185. package/dist/libs/store/store.js.map +0 -1
  186. package/dist/mixins/attributeBinderMixin.js.map +0 -1
  187. package/dist/mixins/contextMixin.js.map +0 -1
  188. package/dist/mixins/counterMixin.js.map +0 -1
  189. package/dist/mixins/federationMixin.js.map +0 -1
  190. package/dist/mixins/filterMixin.js.map +0 -1
  191. package/dist/mixins/grouperMixin.js.map +0 -1
  192. package/dist/mixins/highlighterMixin.js.map +0 -1
  193. package/dist/mixins/interfaces.js.map +0 -1
  194. package/dist/mixins/listMixin.js.map +0 -1
  195. package/dist/mixins/nextMixin.js.map +0 -1
  196. package/dist/mixins/paginateMixin.js.map +0 -1
  197. package/dist/mixins/requiredMixin.js.map +0 -1
  198. package/dist/mixins/sorterMixin.js.map +0 -1
  199. package/dist/mixins/storeMixin.js.map +0 -1
  200. package/dist/mixins/translationMixin.js.map +0 -1
  201. package/dist/mixins/validationMixin.js.map +0 -1
  202. package/dist/mixins/widgetMixin.js.map +0 -1
  203. package/dist/new-widgets/attributeMixins/actionMixin.js.map +0 -1
  204. package/dist/new-widgets/attributeMixins/blankMixin.js.map +0 -1
  205. package/dist/new-widgets/attributeMixins/booleanMixin.js.map +0 -1
  206. package/dist/new-widgets/attributeMixins/index.js.map +0 -1
  207. package/dist/new-widgets/attributeMixins/mailtoMixin.js.map +0 -1
  208. package/dist/new-widgets/attributeMixins/multipleMixin.js.map +0 -1
  209. package/dist/new-widgets/attributeMixins/numberMixin.js.map +0 -1
  210. package/dist/new-widgets/attributeMixins/placeholderMixin.js.map +0 -1
  211. package/dist/new-widgets/attributeMixins/telMixin.js.map +0 -1
  212. package/dist/new-widgets/baseWidgetMixin.js.map +0 -1
  213. package/dist/new-widgets/callbackMixins/autocompletionMixin.js.map +0 -1
  214. package/dist/new-widgets/callbackMixins/index.js.map +0 -1
  215. package/dist/new-widgets/callbackMixins/richtextMixin.js.map +0 -1
  216. package/dist/new-widgets/new-widget-factory.js.map +0 -1
  217. package/dist/new-widgets/templateAdditionMixins/addableMixin.js.map +0 -1
  218. package/dist/new-widgets/templateAdditionMixins/index.js.map +0 -1
  219. package/dist/new-widgets/templateAdditionMixins/labelLastMixin.js.map +0 -1
  220. package/dist/new-widgets/templateAdditionMixins/labelMixin.js.map +0 -1
  221. package/dist/new-widgets/templates/defaultTemplatesDirectory.js.map +0 -1
  222. package/dist/new-widgets/templates/displayTemplatesDirectory.js.map +0 -1
  223. package/dist/new-widgets/templates/formTemplatesDirectory.js.map +0 -1
  224. package/dist/new-widgets/templates/groupTemplatesDirectory.js.map +0 -1
  225. package/dist/new-widgets/templates/index.js.map +0 -1
  226. package/dist/new-widgets/templates/setTemplatesDirectory.js.map +0 -1
  227. package/dist/new-widgets/templatesDependencies/altMixin.js.map +0 -1
  228. package/dist/new-widgets/templatesDependencies/editableMixin.js.map +0 -1
  229. package/dist/new-widgets/templatesDependencies/filterRangeFormMixin.js.map +0 -1
  230. package/dist/new-widgets/templatesDependencies/formCheckboxMixin.js.map +0 -1
  231. package/dist/new-widgets/templatesDependencies/formCheckboxesMixin.js.map +0 -1
  232. package/dist/new-widgets/templatesDependencies/formDropdownMixin.js.map +0 -1
  233. package/dist/new-widgets/templatesDependencies/formFileMixin.js.map +0 -1
  234. package/dist/new-widgets/templatesDependencies/formLengthMixin.js.map +0 -1
  235. package/dist/new-widgets/templatesDependencies/formMinMaxMixin.js.map +0 -1
  236. package/dist/new-widgets/templatesDependencies/formMixin.js.map +0 -1
  237. package/dist/new-widgets/templatesDependencies/formNumberMixin.js.map +0 -1
  238. package/dist/new-widgets/templatesDependencies/formRadioMixin.js.map +0 -1
  239. package/dist/new-widgets/templatesDependencies/formStepMixin.js.map +0 -1
  240. package/dist/new-widgets/templatesDependencies/multipleFormMixin.js.map +0 -1
  241. package/dist/new-widgets/templatesDependencies/multipleselectFormMixin.js.map +0 -1
  242. package/dist/new-widgets/templatesDependencies/patternMixin.js.map +0 -1
  243. package/dist/new-widgets/templatesDependencies/rangeMixin.js.map +0 -1
  244. package/dist/new-widgets/templatesDependencies/setMixin.js.map +0 -1
  245. package/dist/new-widgets/templatesDependencies/valueRichtextMixin.js.map +0 -1
  246. package/dist/new-widgets/valueTransformationMixins/autolinkMixin.js.map +0 -1
  247. package/dist/new-widgets/valueTransformationMixins/dateMixin.js.map +0 -1
  248. package/dist/new-widgets/valueTransformationMixins/dateTimeMixin.js.map +0 -1
  249. package/dist/new-widgets/valueTransformationMixins/index.js.map +0 -1
  250. package/dist/new-widgets/valueTransformationMixins/markdownMixin.js.map +0 -1
  251. package/dist/new-widgets/valueTransformationMixins/multilineMixin.js.map +0 -1
  252. package/dist/new-widgets/valueTransformationMixins/oembedMixin.js.map +0 -1
  253. package/dist/solid-template-element.js.map +0 -1
  254. package/dist/widgets/baseWidget.js.map +0 -1
  255. package/dist/widgets/widget-factory.js.map +0 -1
@@ -1,25 +1,3 @@
1
- function _templateObject2() {
2
- const data = _taggedTemplateLiteral([""]);
3
-
4
- _templateObject2 = function () {
5
- return data;
6
- };
7
-
8
- return data;
9
- }
10
-
11
- function _templateObject() {
12
- const data = _taggedTemplateLiteral(["\n <", " value=", "></", ">\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
1
  import { html, render } from '../_snowpack/pkg/lit-html.js';
24
2
  import { preHTML } from '../libs/lit-helpers.js';
25
3
  import { ifDefined } from '../_snowpack/pkg/lit-html/directives/if-defined.js';
@@ -42,20 +20,16 @@ const ListMixin = {
42
20
  // Rendering to execute after all the processors have been executed
43
21
  renderCallbacks: []
44
22
  },
45
-
46
23
  created() {
47
24
  this.listPostProcessors = [];
48
25
  this.renderCallbacks = [];
49
26
  },
50
-
51
27
  appendSingleElt(parent) {
52
28
  this.appendChildElt(this.resource['@id'], parent);
53
29
  },
54
-
55
30
  setElementAttribute(attr) {
56
31
  const containerAttribute = "solid-container";
57
32
  const resourceAttribute = "solid-resource";
58
-
59
33
  if (attr === "resource") {
60
34
  this.element.removeAttribute(containerAttribute);
61
35
  this.element.setAttribute(resourceAttribute, "");
@@ -64,32 +38,32 @@ const ListMixin = {
64
38
  this.element.setAttribute(containerAttribute, "");
65
39
  }
66
40
  },
67
-
68
41
  async populate() {
69
42
  const div = this.div;
70
- if (!this.resource) return; // Not a container but a single resource
43
+ if (!this.resource) return;
71
44
 
72
- if (!this.resource.isContainer()) {
45
+ // Not a container but a single resource
46
+ if (!this.resource.isContainer?.()) {
73
47
  this.setElementAttribute("resource");
74
48
  this.appendSingleElt(div);
75
49
  return;
76
50
  }
77
-
78
51
  this.setElementAttribute("container");
79
52
  const listPostProcessors = [...this.listPostProcessors];
80
53
  this.renderCallbacks = [];
81
54
  listPostProcessors.push(this.renderDOM.bind(this));
82
- listPostProcessors.push(this.handleEmptyWidget.bind(this)); // Execute the first post-processor of the list
55
+ listPostProcessors.push(this.handleEmptyWidget.bind(this));
83
56
 
57
+ // Execute the first post-processor of the list
84
58
  const nextProcessor = listPostProcessors.shift();
85
- await nextProcessor(this.resource['ldp:contains'], listPostProcessors, div, this.dataSrc); // Execute the render callbacks
59
+ await nextProcessor(this.resource['ldp:contains'], listPostProcessors, div, this.dataSrc);
86
60
 
61
+ // Execute the render callbacks
87
62
  for (const renderCallback of this.renderCallbacks) {
88
63
  // Render the template in the given parent element
89
64
  render(renderCallback.template, renderCallback.parent);
90
65
  }
91
66
  },
92
-
93
67
  /**
94
68
  * Render resources in the DOM
95
69
  * @param resources
@@ -103,11 +77,9 @@ const ListMixin = {
103
77
  if (!resource) continue;
104
78
  this.appendChildElt(resource['@id'], div);
105
79
  }
106
-
107
80
  const nextProcessor = listPostProcessors.shift();
108
81
  if (nextProcessor) await nextProcessor(resources, listPostProcessors, div, context);
109
82
  },
110
-
111
83
  /**
112
84
  * Show empty widget if no resources in the list
113
85
  * @param resources
@@ -117,20 +89,17 @@ const ListMixin = {
117
89
  */
118
90
  async handleEmptyWidget(resources, listPostProcessors, div, context) {
119
91
  if (this.emptyWidget) {
120
- const emptyWidgetTemplate = preHTML(_templateObject(), this.emptyWidget, ifDefined(this.emptyValue), this.emptyWidget);
121
-
92
+ const emptyWidgetTemplate = preHTML`
93
+ <${this.emptyWidget} value=${ifDefined(this.emptyValue)}></${this.emptyWidget}>
94
+ `;
122
95
  if (!this.emptyWrapper) {
123
96
  this.emptyWrapper = document.createElement('span');
124
97
  this.element.appendChild(this.emptyWrapper);
125
98
  }
126
-
127
- render(resources.length > 0 ? html(_templateObject2()) : emptyWidgetTemplate, this.emptyWrapper);
99
+ render(resources.length > 0 ? html`` : emptyWidgetTemplate, this.emptyWrapper);
128
100
  }
129
-
130
101
  const nextProcessor = listPostProcessors.shift();
131
102
  if (nextProcessor) await nextProcessor(resources, listPostProcessors, div, context);
132
103
  }
133
-
134
104
  };
135
- export { ListMixin };
136
- //# sourceMappingURL=listMixin.js.map
105
+ export { ListMixin };
@@ -7,7 +7,6 @@ const NextMixin = {
7
7
  default: ''
8
8
  }
9
9
  },
10
-
11
10
  // Here "even.target" points to the content of the widgets of the children of solid-display
12
11
  goToNext(resource) {
13
12
  if (this.next) {
@@ -20,7 +19,5 @@ const NextMixin = {
20
19
  }));
21
20
  }
22
21
  }
23
-
24
22
  };
25
- export { NextMixin };
26
- //# sourceMappingURL=nextMixin.js.map
23
+ export { NextMixin };
@@ -1,15 +1,3 @@
1
- function _templateObject() {
2
- const data = _taggedTemplateLiteral(["\n <button\n data-id=\"prev\"\n ?disabled=", "\n @click=", "\n >\u2190</button>\n <button\n data-id=\"next\"\n ?disabled=", "\n @click=", "\n >\u2192</button>\n <span>\n <span data-id=\"current\">", "</span> / <span data-id=\"count\">", "</span>\n </span>\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
1
  import { html } from "../_snowpack/pkg/lit-html.js";
14
2
  const PaginateMixin = {
15
3
  name: 'paginate-mixin',
@@ -27,15 +15,12 @@ const PaginateMixin = {
27
15
  initialState: {
28
16
  currentPage: []
29
17
  },
30
-
31
18
  created() {
32
19
  this.currentPage = [];
33
20
  },
34
-
35
21
  attached() {
36
22
  this.listPostProcessors.push(this.paginateCallback.bind(this));
37
23
  },
38
-
39
24
  async paginateCallback(resources, listPostProcessors, div, context) {
40
25
  if (this.paginateBy > 0) {
41
26
  if (!this.currentPage[context]) this.currentPage[context] = 1;
@@ -47,37 +32,30 @@ const PaginateMixin = {
47
32
  const firstElementIndex = (this.getCurrentPage(context) - 1) * this.paginateBy;
48
33
  resources = resources.slice(firstElementIndex, firstElementIndex + this.paginateBy);
49
34
  }
50
-
51
35
  const nextProcessor = listPostProcessors.shift();
52
36
  if (nextProcessor) await nextProcessor(resources, listPostProcessors, div, context);
53
37
  },
54
-
55
38
  getNavElement(div) {
56
39
  const insertNode = div.parentNode || div;
57
- return insertNode.querySelector("nav[data-id=\"nav\"]");
40
+ return insertNode.querySelector(`nav[data-id="nav"]`);
58
41
  },
59
-
60
42
  /**
61
43
  * Find nav element or create it if not existing
62
44
  * @param div - insert nav next to this div
63
45
  */
64
46
  initParentPaginationDiv(div) {
65
47
  let nav = this.getNavElement(div);
66
-
67
48
  if (!nav) {
68
49
  nav = document.createElement('nav');
69
50
  nav.setAttribute('data-id', 'nav');
70
51
  const insertNode = div.parentNode || div;
71
52
  insertNode.appendChild(nav);
72
53
  }
73
-
74
54
  return nav;
75
55
  },
76
-
77
56
  getCurrentPage(context) {
78
57
  return this.currentPage[context];
79
58
  },
80
-
81
59
  setCurrentPage(page, context, pageCount) {
82
60
  if (page < 1) page = !this.shouldLoop() ? 1 : pageCount;
83
61
  if (page > pageCount) page = !this.shouldLoop() ? pageCount : 1;
@@ -85,15 +63,12 @@ const PaginateMixin = {
85
63
  this.empty();
86
64
  this.populate();
87
65
  },
88
-
89
66
  getPageCount(size) {
90
67
  return Math.max(1, Math.ceil(size / this.paginateBy));
91
68
  },
92
-
93
69
  shouldLoop() {
94
70
  return this.paginateLoop !== null;
95
71
  },
96
-
97
72
  /**
98
73
  * Create pagination template
99
74
  * @param pageCount
@@ -102,9 +77,21 @@ const PaginateMixin = {
102
77
  renderPaginationNav(pageCount, context, div) {
103
78
  this.getNavElement(div).toggleAttribute('hidden', pageCount <= 1);
104
79
  const currentPage = this.getCurrentPage(context);
105
- return html(_templateObject(), !this.shouldLoop() && currentPage <= 1, () => this.setCurrentPage(currentPage - 1, context, pageCount), !this.shouldLoop() && currentPage >= pageCount, () => this.setCurrentPage(currentPage + 1, context, pageCount), currentPage, String(pageCount));
80
+ return html`
81
+ <button
82
+ data-id="prev"
83
+ ?disabled=${!this.shouldLoop() && currentPage <= 1}
84
+ @click=${() => this.setCurrentPage(currentPage - 1, context, pageCount)}
85
+ >←</button>
86
+ <button
87
+ data-id="next"
88
+ ?disabled=${!this.shouldLoop() && currentPage >= pageCount}
89
+ @click=${() => this.setCurrentPage(currentPage + 1, context, pageCount)}
90
+ >→</button>
91
+ <span>
92
+ <span data-id="current">${currentPage}</span> / <span data-id="count">${String(pageCount)}</span>
93
+ </span>
94
+ `;
106
95
  }
107
-
108
96
  };
109
- export { PaginateMixin };
110
- //# sourceMappingURL=paginateMixin.js.map
97
+ export { PaginateMixin };
@@ -1,34 +1,26 @@
1
1
  const RequiredMixin = {
2
2
  name: 'required-mixin',
3
3
  use: [],
4
-
5
4
  attached() {
6
5
  this.listPostProcessors.push(this.requiredResources.bind(this));
7
6
  },
8
-
9
7
  async requiredResources(resources, listPostProcessors, div, context) {
10
8
  const displays = [];
11
9
  const requiredFields = Array.from(this.element.attributes).filter(attr => attr.name.startsWith('required-')).map(attr => attr['name'].replace('required-', ''));
12
-
13
10
  if (requiredFields.length) {
14
11
  for (let resource of resources) {
15
12
  let hasProps = true;
16
-
17
13
  for (let field of requiredFields) {
18
14
  if ((await resource[field]) == null || (await resource[field]) == "") {
19
15
  hasProps = false;
20
16
  continue;
21
17
  }
22
18
  }
23
-
24
19
  if (hasProps) displays.push(resource);
25
20
  }
26
21
  }
27
-
28
22
  const nextProcessor = listPostProcessors.shift();
29
23
  if (nextProcessor) await nextProcessor(requiredFields.length ? displays : resources, listPostProcessors, div, context);
30
24
  }
31
-
32
25
  };
33
- export { RequiredMixin };
34
- //# sourceMappingURL=requiredMixin.js.map
26
+ export { RequiredMixin };
@@ -0,0 +1,122 @@
1
+ import { html, render } from "../_snowpack/pkg/lit-html.js";
2
+ const ServerPaginationMixin = {
3
+ name: 'server-pagination-mixin',
4
+ use: [],
5
+ attributes: {
6
+ limit: {
7
+ type: Number,
8
+ default: undefined
9
+ },
10
+ offset: {
11
+ type: Number,
12
+ default: undefined
13
+ },
14
+ pageCount: {
15
+ type: Number,
16
+ default: 1000
17
+ },
18
+ pageNumber: {
19
+ type: Number,
20
+ default: 0
21
+ }
22
+ },
23
+ initialState: {
24
+ currentOffset: []
25
+ },
26
+ attached() {
27
+ if (this.limit) {
28
+ this.setCurrentOffset(this.resourceId, 0);
29
+ const parentDiv = this.initServerPaginationDiv(this.div);
30
+ this.renderCallbacks.push({
31
+ template: this.renderServerPaginationNav(this.resourceId, parentDiv),
32
+ parent: parentDiv
33
+ });
34
+ }
35
+ },
36
+ getCurrentOffset(resourceId, limit) {
37
+ return this.currentOffset[resourceId + "#p" + limit];
38
+ },
39
+ async setCurrentOffset(resourceId, offset) {
40
+ let index = resourceId + "#p" + this.limit;
41
+ this.currentOffset[index] = this.offset = offset;
42
+ this.pageNumber = Number(this.offset / this.limit);
43
+ this.currentPage[resourceId] = this.pageNumber;
44
+ await this.fetchData(this.dataSrc);
45
+ },
46
+ async decreaseCurrentOffset(resourceId) {
47
+ let index = resourceId + "#p" + this.limit;
48
+ this.currentOffset[index] = this.offset = this.offset - this.limit;
49
+ this.currentPage[index] = this.offset / this.limit;
50
+ this.pageNumber = this.offset / this.limit;
51
+ this.updateNavButtons(resourceId, index, -1);
52
+ await this.fetchData(this.dataSrc);
53
+ },
54
+ async increaseCurrentOffset(resourceId) {
55
+ let index = resourceId + "#p" + this.limit;
56
+ this.currentOffset[index] = this.offset = this.offset + this.limit;
57
+ this.currentPage[index] = this.offset / this.limit;
58
+ this.updateNavButtons(resourceId, index, 1);
59
+ await this.fetchData(this.dataSrc);
60
+ },
61
+ updateNavButtons(resourceId, index, variance) {
62
+ this.element.querySelector("[data-id='prev']").disabled = this.currentOffset[index] <= 0;
63
+ this.element.querySelector("[data-id='next']").disabled = this.currentOffset[index] * this.limit >= this.pageCount;
64
+ this.element.querySelector("[data-id='current']").innerText = this.getCurrentServedPage(resourceId, variance);
65
+ },
66
+ getServerNavElement(div) {
67
+ if (div) {
68
+ const insertNode = div.parentNode || div;
69
+ return insertNode.querySelector(`nav[data-id="nav"]`);
70
+ }
71
+ return null;
72
+ },
73
+ getCurrentServedPage(context, variance) {
74
+ this.currentPage[context] = Number(this.currentPage[context]) + variance;
75
+ return this.currentPage[context];
76
+ },
77
+ /**
78
+ * Find nav element or create it if not existing
79
+ * @param div - insert nav next to this div
80
+ */
81
+ initServerPaginationDiv(div) {
82
+ let nav = this.getServerNavElement(div);
83
+ if (!nav) {
84
+ nav = document.createElement('nav');
85
+ nav.setAttribute('data-id', 'nav');
86
+ const insertNode = div.parentNode || div;
87
+ insertNode.appendChild(nav);
88
+ }
89
+ return nav;
90
+ },
91
+ /**
92
+ * Create pagination template
93
+ */
94
+ renderServerPaginationNav(resourceId, div) {
95
+ if (this.limit) {
96
+ const currentOffset = this.getCurrentOffset(resourceId, this.limit);
97
+ var currentPageNumber = this.getCurrentServedPage(resourceId, 1);
98
+ const pageCount = Math.ceil(this.pageCount / this.limit);
99
+ render(html`
100
+ <button
101
+ data-id="prev"
102
+ ?disabled=${currentOffset <= 0}
103
+ @click=${() => this.decreaseCurrentOffset(resourceId)}
104
+ >←</button>
105
+ <button
106
+ data-id="next"
107
+ ?disabled=${currentOffset >= (pageCount - 1) * this.limit}
108
+ @click=${() => this.increaseCurrentOffset(resourceId)}
109
+ >→</button>
110
+ <span>
111
+ <span data-id="current">
112
+ ${currentPageNumber}
113
+ </span> /
114
+ <span data-id="count">
115
+ ${this.pageCount}
116
+ </span>
117
+ </span>
118
+ `, div);
119
+ }
120
+ }
121
+ };
122
+ export { ServerPaginationMixin };
@@ -21,7 +21,6 @@ const SorterMixin = {
21
21
  sortedBy: {
22
22
  type: String,
23
23
  default: null,
24
-
25
24
  callback(newValue) {
26
25
  // if we change search form, re-populate
27
26
  if (newValue && this.sortForm && newValue !== this.sortForm.getAttribute('id')) {
@@ -29,88 +28,76 @@ const SorterMixin = {
29
28
  this.populate();
30
29
  }
31
30
  }
32
-
33
31
  }
34
32
  },
35
33
  initialState: {
36
34
  randomOrder: null
37
35
  },
38
-
39
36
  attached() {
40
37
  this.listPostProcessors.push(this.orderCallback.bind(this));
41
38
  },
42
-
43
39
  created() {
44
40
  this.randomOrder = [];
45
41
  },
46
-
47
42
  async sorterList() {
48
43
  if (!this.resource) return;
49
44
  this.empty();
50
45
  await this.populate();
51
46
  },
52
-
53
47
  linkSorterForm() {
54
48
  this.sortForm.addEventListener('formChange', () => {
55
49
  this.sorterList();
56
50
  });
57
51
  },
58
-
59
52
  async orderCallback(resources, listPostProcessors, div, context) {
60
53
  if (this.orderBy) this.orderAsc = this.orderBy; // retrocompatibility. remove in 0.15
61
-
62
54
  let sortingKey = '';
63
- let orderValueToSort = ''; // if order-asc or order-desc attribute
55
+ let orderValueToSort = '';
64
56
 
57
+ // if order-asc or order-desc attribute
65
58
  if (this.orderAsc || this.orderDesc) {
66
59
  sortingKey = this.orderAsc || this.orderDesc;
67
- } // if sorted-by attribute (solid-form-search data used)
60
+ }
61
+ // if sorted-by attribute (solid-form-search data used)
68
62
  else if (this.sortedBy) {
69
- const sortedBy = this.sortedBy;
70
-
71
- if (sortedBy != null) {
72
- if (!this.sortForm) {
73
- this.sortForm = document.getElementById(sortedBy);
74
- if (!this.sortForm) throw "#".concat(sortedBy, " is not in DOM");
75
- this.linkSorterForm();
76
- }
77
-
78
- if (!this.sortForm.component.value.field) {
79
- console.warn('The attribute field does not exist');
80
- } else {
81
- sortingKey = this.sortForm.component.value.field['value'];
82
- }
83
-
84
- const orderField = this.sortForm.component.value.order;
85
- orderValueToSort = orderField && orderField.value ? orderField.value : 'asc';
63
+ const sortedBy = this.sortedBy;
64
+ if (sortedBy != null) {
65
+ if (!this.sortForm) {
66
+ this.sortForm = document.getElementById(sortedBy);
67
+ if (!this.sortForm) throw `#${sortedBy} is not in DOM`;
68
+ this.linkSorterForm();
86
69
  }
87
- } // sorting data according to the defined value of sortingKey
88
-
89
-
70
+ if (!this.sortForm.component.value.field) {
71
+ console.warn('The attribute field does not exist');
72
+ } else {
73
+ sortingKey = this.sortForm.component.value.field['value'];
74
+ }
75
+ const orderField = this.sortForm.component.value.order;
76
+ orderValueToSort = orderField && orderField.value ? orderField.value : 'asc';
77
+ }
78
+ }
79
+ // sorting data according to the defined value of sortingKey
90
80
  if (sortingKey) {
91
81
  let orderToSort = true; // set 'asc' by default
92
-
93
82
  if (this.orderDesc || orderValueToSort == "desc") orderToSort = false;
94
83
  resources = (await Promise.all(resources.map(async resource => ({
95
84
  sortingKey: await resource[sortingKey],
96
85
  // fetch sorting value
97
86
  proxy: resource // and keep proxy
98
-
99
87
  })))).sort(this.sortValuesByKey("sortingKey", orderToSort)) // sort this array
100
88
  .map(r => r.proxy); // re-create array
101
- } // if order-by-random attribute
89
+ }
90
+ // if order-by-random attribute
102
91
  else if (this.isRandomSorted()) {
103
- resources = this.shuffleResources(resources); // shuffle resources
104
- }
92
+ resources = this.shuffleResources(resources); // shuffle resources
93
+ }
105
94
 
106
95
  const nextProcessor = listPostProcessors.shift();
107
96
  if (nextProcessor) await nextProcessor(resources, listPostProcessors, div, context);
108
97
  },
109
-
110
98
  isRandomSorted() {
111
99
  return this.orderByRandom !== null;
112
100
  },
113
-
114
101
  sortValuesByKey(key, asc) {
115
102
  return function (a, b) {
116
103
  if (!a[key]) return 1;
@@ -122,16 +109,13 @@ const SorterMixin = {
122
109
  return comparison;
123
110
  };
124
111
  },
125
-
126
112
  shuffleResources(array) {
127
113
  let currentIndex = array.length;
128
114
  let temporaryValue;
129
115
  let randomIndex;
130
-
131
116
  if (this.randomOrder.length !== array.length) {
132
117
  // if no random order existing
133
118
  this.randomOrder = [...Array(array.length).keys()]; // generate array of indexes
134
-
135
119
  while (0 !== currentIndex) {
136
120
  randomIndex = Math.floor(Math.random() * currentIndex);
137
121
  currentIndex -= 1;
@@ -140,10 +124,8 @@ const SorterMixin = {
140
124
  this.randomOrder[randomIndex] = temporaryValue;
141
125
  }
142
126
  }
143
-
144
127
  return this.randomOrder.map(i => array[i]); // rebuild array with random order
145
128
  }
146
-
147
129
  };
148
- export { SorterMixin };
149
- //# sourceMappingURL=sorterMixin.js.map
130
+
131
+ export { SorterMixin };
@@ -1,9 +1,12 @@
1
1
  import { store } from '../libs/store/store.js';
2
+ import { formatAttributesToServerSearchOptions, mergeServerSearchOptions } from '../libs/store/server-search.js';
2
3
  import { AttributeBinderMixin } from './attributeBinderMixin.js';
3
4
  import { ContextMixin } from './contextMixin.js';
5
+ import { ServerPaginationMixin } from './serverPaginationMixin.js';
6
+ import { formatAttributesToServerPaginationOptions } from '../libs/store/server-pagination.js';
4
7
  const StoreMixin = {
5
8
  name: 'store-mixin',
6
- use: [AttributeBinderMixin, ContextMixin],
9
+ use: [AttributeBinderMixin, ContextMixin, ServerPaginationMixin],
7
10
  attributes: {
8
11
  noRender: {
9
12
  type: String,
@@ -16,7 +19,13 @@ const StoreMixin = {
16
19
  type: String,
17
20
  default: null,
18
21
  callback: async function (value) {
19
- if (this.noRender === null) await this.fetchData(value);
22
+ const filteredOnServer = this.element.attributes['filtered-on']?.value === 'server';
23
+ const limited = this.element.attributes['limit']?.value !== undefined;
24
+ if (this.noRender === null && !filteredOnServer && !limited) {
25
+ await this.fetchData(value);
26
+ } else if (this.noRender === null && !filteredOnServer) {
27
+ this.resourceId = value;
28
+ }
20
29
  }
21
30
  },
22
31
  loaderId: {
@@ -32,7 +41,6 @@ const StoreMixin = {
32
41
  resourceId: null,
33
42
  subscription: null
34
43
  },
35
-
36
44
  created() {
37
45
  if (this.element.closest('[no-render]')) this.noRender = ''; // if embedded in no-render, apply no-render to himself
38
46
  },
@@ -40,47 +48,50 @@ const StoreMixin = {
40
48
  detached() {
41
49
  if (this.subscription) PubSub.unsubscribe(this.subscription);
42
50
  },
43
-
44
51
  get resource() {
45
- return this.resourceId ? store.get(this.resourceId) : null;
46
- },
52
+ let id = this.resourceId;
53
+ if (this.limit) {
54
+ id = this.resourceId + "#p" + this.limit + "?o" + this.offset;
55
+ }
56
+ const serverSearch = mergeServerSearchOptions(formatAttributesToServerSearchOptions(this.element.attributes), this.getDynamicServerSearch?.() // from `filterMixin`
57
+ );
47
58
 
59
+ return id ? store.get(id, serverSearch) : null;
60
+ },
48
61
  get loader() {
49
62
  return this.loaderId ? document.getElementById(this.loaderId) : null;
50
63
  },
51
-
52
64
  async fetchData(value) {
53
65
  this.empty();
54
66
  if (this.subscription) PubSub.unsubscribe(this.subscription);
55
67
  if (!value || value == "undefined") return;
56
68
  this.resourceId = value;
57
-
58
69
  if (this.nestedField) {
59
70
  const resource = await store.getData(value, this.context);
60
71
  const nestedResource = resource ? await resource[this.nestedField] : null;
61
72
  this.resourceId = nestedResource ? nestedResource['@id'] : null;
62
- if (!this.resourceId) throw "Error: the key \"".concat(this.nestedField, "\" does not exist on the resource");
73
+ if (!this.resourceId) throw `Error: the key "${this.nestedField}" does not exist on the resource`;
63
74
  }
64
-
65
75
  this.updateNavigateSubscription();
66
76
  this.subscription = PubSub.subscribe(this.resourceId, this.updateDOM.bind(this));
67
- await store.getData(this.resourceId, this.context);
77
+ const serverPagination = formatAttributesToServerPaginationOptions(this.element.attributes);
78
+ const dynamicServerSearch = this.getDynamicServerSearch?.(); // from `filterMixin`
79
+ const serverSearch = mergeServerSearchOptions(formatAttributesToServerSearchOptions(this.element.attributes), dynamicServerSearch);
80
+ const forceRefetch = !!dynamicServerSearch;
81
+ await store.getData(this.resourceId, this.context, undefined, undefined, forceRefetch, serverPagination, serverSearch);
68
82
  this.updateDOM();
69
83
  },
70
-
71
84
  toggleLoaderHidden(toggle) {
72
85
  if (this.loader) this.loader.toggleAttribute('hidden', toggle);
73
86
  },
74
-
75
87
  updateNavigateSubscription() {},
76
-
77
88
  async updateDOM() {
78
89
  this.toggleLoaderHidden(false); // brings a loader out if the attribute is set
79
-
80
90
  this.empty();
81
91
  await this.replaceAttributesData();
82
92
  await this.populate();
83
- setTimeout(() => // Brings the dispatchEvent at the end of the queue
93
+ setTimeout(() =>
94
+ // Brings the dispatchEvent at the end of the queue
84
95
  this.element.dispatchEvent(new CustomEvent('populate', {
85
96
  detail: {
86
97
  resource: {
@@ -90,13 +101,9 @@ const StoreMixin = {
90
101
  })));
91
102
  this.toggleLoaderHidden(true);
92
103
  },
93
-
94
104
  empty() {},
95
-
96
105
  update() {
97
106
  if (this.noRender === null) this.updateDOM();
98
107
  }
99
-
100
108
  };
101
- export { StoreMixin };
102
- //# sourceMappingURL=storeMixin.js.map
109
+ export { StoreMixin };