@startinblox/core 0.17.21-beta.1 → 0.17.21-beta.11

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 (264) hide show
  1. package/dist/_snowpack/env.js +3 -0
  2. package/dist/_snowpack/pkg/autolinker.js +4281 -0
  3. package/dist/_snowpack/pkg/autolinker.js.map +1 -0
  4. package/dist/_snowpack/pkg/autolinker.js.map.proxy.js +1 -0
  5. package/dist/_snowpack/pkg/common/_baseUnary-217dffb2.js +377 -0
  6. package/dist/_snowpack/pkg/common/_baseUnary-217dffb2.js.map +1 -0
  7. package/dist/_snowpack/pkg/common/_baseUnary-217dffb2.js.map.proxy.js +1 -0
  8. package/dist/_snowpack/pkg/common/_commonjsHelpers-8c19dec8.js +22 -0
  9. package/dist/_snowpack/pkg/common/_commonjsHelpers-8c19dec8.js.map +1 -0
  10. package/dist/_snowpack/pkg/common/_commonjsHelpers-8c19dec8.js.map.proxy.js +1 -0
  11. package/dist/_snowpack/pkg/common/decode-a4c334cf.js +216 -0
  12. package/dist/_snowpack/pkg/common/decode-a4c334cf.js.map +1 -0
  13. package/dist/_snowpack/pkg/common/decode-a4c334cf.js.map.proxy.js +1 -0
  14. package/dist/_snowpack/pkg/common/lit-html-babd44cd.js +1119 -0
  15. package/dist/_snowpack/pkg/common/lit-html-babd44cd.js.map +1 -0
  16. package/dist/_snowpack/pkg/common/lit-html-babd44cd.js.map.proxy.js +1 -0
  17. package/dist/_snowpack/pkg/delta-markdown-for-quill.js +25677 -0
  18. package/dist/_snowpack/pkg/delta-markdown-for-quill.js.map +1 -0
  19. package/dist/_snowpack/pkg/delta-markdown-for-quill.js.map.proxy.js +1 -0
  20. package/dist/_snowpack/pkg/dialog-polyfill.js +859 -0
  21. package/dist/_snowpack/pkg/dialog-polyfill.js.map +1 -0
  22. package/dist/_snowpack/pkg/dialog-polyfill.js.map.proxy.js +1 -0
  23. package/dist/_snowpack/pkg/fusejs.js +1783 -0
  24. package/dist/_snowpack/pkg/fusejs.js.map +1 -0
  25. package/dist/_snowpack/pkg/fusejs.js.map.proxy.js +1 -0
  26. package/dist/_snowpack/pkg/import-map.json +23 -0
  27. package/dist/_snowpack/pkg/jsonld-context-parser.js +804 -0
  28. package/dist/_snowpack/pkg/jsonld-context-parser.js.map +1 -0
  29. package/dist/_snowpack/pkg/jsonld-context-parser.js.map.proxy.js +1 -0
  30. package/dist/_snowpack/pkg/leaflet/dist/leaflet.css +640 -0
  31. package/dist/_snowpack/pkg/leaflet/dist/leaflet.css.proxy.js +10 -0
  32. package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.Default.css +60 -0
  33. package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.Default.css.proxy.js +10 -0
  34. package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.css +14 -0
  35. package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.css.proxy.js +10 -0
  36. package/dist/_snowpack/pkg/lit-html/directives/if-defined.js +40 -0
  37. package/dist/_snowpack/pkg/lit-html/directives/if-defined.js.map +1 -0
  38. package/dist/_snowpack/pkg/lit-html/directives/if-defined.js.map.proxy.js +1 -0
  39. package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js +46 -0
  40. package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js.map +1 -0
  41. package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js.map.proxy.js +1 -0
  42. package/dist/_snowpack/pkg/lit-html/directives/until.js +88 -0
  43. package/dist/_snowpack/pkg/lit-html/directives/until.js.map +1 -0
  44. package/dist/_snowpack/pkg/lit-html/directives/until.js.map.proxy.js +1 -0
  45. package/dist/_snowpack/pkg/lit-html.js +92 -0
  46. package/dist/_snowpack/pkg/lit-html.js.map +1 -0
  47. package/dist/_snowpack/pkg/lit-html.js.map.proxy.js +1 -0
  48. package/dist/_snowpack/pkg/markdown-it.js +11860 -0
  49. package/dist/_snowpack/pkg/markdown-it.js.map +1 -0
  50. package/dist/_snowpack/pkg/markdown-it.js.map.proxy.js +1 -0
  51. package/dist/_snowpack/pkg/quill/dist/quill.snow.css +945 -0
  52. package/dist/_snowpack/pkg/quill/dist/quill.snow.css.proxy.js +10 -0
  53. package/dist/_snowpack/pkg/quill-delta-to-markdown.js +1029 -0
  54. package/dist/_snowpack/pkg/quill-delta-to-markdown.js.map +1 -0
  55. package/dist/_snowpack/pkg/quill-delta-to-markdown.js.map.proxy.js +1 -0
  56. package/dist/_snowpack/pkg/quill.js +13382 -0
  57. package/dist/_snowpack/pkg/quill.js.map +1 -0
  58. package/dist/_snowpack/pkg/quill.js.map.proxy.js +1 -0
  59. package/dist/_snowpack/pkg/slim-select.js +4 -0
  60. package/dist/_snowpack/pkg/slim-select.js.map +1 -0
  61. package/dist/_snowpack/pkg/slim-select.js.map.proxy.js +1 -0
  62. package/dist/_snowpack/pkg/tui-calendar/dist/tui-calendar.css +1164 -0
  63. package/dist/_snowpack/pkg/tui-calendar/dist/tui-calendar.css.proxy.js +10 -0
  64. package/dist/_snowpack/pkg/tui-calendar.js +42285 -0
  65. package/dist/_snowpack/pkg/tui-calendar.js.map +1 -0
  66. package/dist/_snowpack/pkg/tui-calendar.js.map.proxy.js +1 -0
  67. package/dist/components/solid-ac-checker.js +51 -0
  68. package/dist/components/solid-ac-checker.js.map +1 -0
  69. package/dist/components/solid-calendar.js +87 -0
  70. package/dist/components/solid-calendar.js.map +1 -0
  71. package/dist/components/solid-delete.js +111 -0
  72. package/dist/components/solid-delete.js.map +1 -0
  73. package/dist/components/solid-display.js +194 -0
  74. package/dist/components/solid-display.js.map +1 -0
  75. package/dist/components/solid-form-search.js +226 -0
  76. package/dist/components/solid-form-search.js.map +1 -0
  77. package/dist/components/solid-form.js +358 -0
  78. package/dist/components/solid-form.js.map +1 -0
  79. package/dist/components/solid-lang.js +46 -0
  80. package/dist/components/solid-lang.js.map +1 -0
  81. package/dist/components/solid-map.js +242 -0
  82. package/dist/components/solid-map.js.map +1 -0
  83. package/dist/components/solid-table.js +263 -0
  84. package/dist/components/solid-table.js.map +1 -0
  85. package/dist/components/solid-widget.js +94 -0
  86. package/dist/components/solid-widget.js.map +1 -0
  87. package/dist/import.css +4 -0
  88. package/dist/index.js +43 -0
  89. package/dist/index.js.map +1 -0
  90. package/dist/libs/Component.js +19 -0
  91. package/dist/libs/Component.js.map +1 -0
  92. package/dist/libs/ComponentFactory.js +196 -0
  93. package/dist/libs/ComponentFactory.js.map +1 -0
  94. package/dist/libs/Compositor.js +103 -0
  95. package/dist/libs/Compositor.js.map +1 -0
  96. package/dist/libs/Sib.js +58 -0
  97. package/dist/libs/Sib.js.map +1 -0
  98. package/dist/libs/filter.js +214 -0
  99. package/dist/libs/filter.js.map +1 -0
  100. package/dist/libs/helpers.js +219 -0
  101. package/dist/libs/helpers.js.map +1 -0
  102. package/dist/libs/interfaces.js +6 -0
  103. package/dist/libs/interfaces.js.map +1 -0
  104. package/dist/libs/lit-helpers.js +169 -0
  105. package/dist/libs/lit-helpers.js.map +1 -0
  106. package/dist/libs/polyfills.js +40 -0
  107. package/dist/libs/polyfills.js.map +1 -0
  108. package/dist/libs/store/server-pagination.js +20 -0
  109. package/dist/libs/store/server-pagination.js.map +1 -0
  110. package/dist/libs/store/store.js +879 -0
  111. package/dist/libs/store/store.js.map +1 -0
  112. package/dist/locales/en.json +10 -0
  113. package/dist/locales/en.json.proxy.js +2 -0
  114. package/dist/locales/fr.json +10 -0
  115. package/dist/locales/fr.json.proxy.js +2 -0
  116. package/dist/mixins/attributeBinderMixin.js +126 -0
  117. package/dist/mixins/attributeBinderMixin.js.map +1 -0
  118. package/dist/mixins/contextMixin.js +28 -0
  119. package/dist/mixins/contextMixin.js.map +1 -0
  120. package/dist/mixins/counterMixin.js +75 -0
  121. package/dist/mixins/counterMixin.js.map +1 -0
  122. package/dist/mixins/federationMixin.js +65 -0
  123. package/dist/mixins/federationMixin.js.map +1 -0
  124. package/dist/mixins/filterMixin.js +136 -0
  125. package/dist/mixins/filterMixin.js.map +1 -0
  126. package/dist/mixins/grouperMixin.js +80 -0
  127. package/dist/mixins/grouperMixin.js.map +1 -0
  128. package/dist/mixins/highlighterMixin.js +42 -0
  129. package/dist/mixins/highlighterMixin.js.map +1 -0
  130. package/dist/mixins/interfaces.js +8 -0
  131. package/dist/mixins/interfaces.js.map +1 -0
  132. package/dist/mixins/listMixin.js +138 -0
  133. package/dist/mixins/listMixin.js.map +1 -0
  134. package/dist/mixins/nextMixin.js +26 -0
  135. package/dist/mixins/nextMixin.js.map +1 -0
  136. package/dist/mixins/paginateMixin.js +110 -0
  137. package/dist/mixins/paginateMixin.js.map +1 -0
  138. package/dist/mixins/requiredMixin.js +34 -0
  139. package/dist/mixins/requiredMixin.js.map +1 -0
  140. package/dist/mixins/serverPaginationMixin.js +130 -0
  141. package/dist/mixins/serverPaginationMixin.js.map +1 -0
  142. package/dist/mixins/sorterMixin.js +149 -0
  143. package/dist/mixins/sorterMixin.js.map +1 -0
  144. package/dist/mixins/storeMixin.js +111 -0
  145. package/dist/mixins/storeMixin.js.map +1 -0
  146. package/dist/mixins/translationMixin.js +68 -0
  147. package/dist/mixins/translationMixin.js.map +1 -0
  148. package/dist/mixins/validationMixin.js +113 -0
  149. package/dist/mixins/validationMixin.js.map +1 -0
  150. package/dist/mixins/widgetMixin.js +451 -0
  151. package/dist/mixins/widgetMixin.js.map +1 -0
  152. package/dist/new-widgets/attributeMixins/actionMixin.js +14 -0
  153. package/dist/new-widgets/attributeMixins/actionMixin.js.map +1 -0
  154. package/dist/new-widgets/attributeMixins/blankMixin.js +10 -0
  155. package/dist/new-widgets/attributeMixins/blankMixin.js.map +1 -0
  156. package/dist/new-widgets/attributeMixins/booleanMixin.js +10 -0
  157. package/dist/new-widgets/attributeMixins/booleanMixin.js.map +1 -0
  158. package/dist/new-widgets/attributeMixins/index.js +20 -0
  159. package/dist/new-widgets/attributeMixins/index.js.map +1 -0
  160. package/dist/new-widgets/attributeMixins/mailtoMixin.js +10 -0
  161. package/dist/new-widgets/attributeMixins/mailtoMixin.js.map +1 -0
  162. package/dist/new-widgets/attributeMixins/multipleMixin.js +28 -0
  163. package/dist/new-widgets/attributeMixins/multipleMixin.js.map +1 -0
  164. package/dist/new-widgets/attributeMixins/numberMixin.js +10 -0
  165. package/dist/new-widgets/attributeMixins/numberMixin.js.map +1 -0
  166. package/dist/new-widgets/attributeMixins/placeholderMixin.js +19 -0
  167. package/dist/new-widgets/attributeMixins/placeholderMixin.js.map +1 -0
  168. package/dist/new-widgets/attributeMixins/telMixin.js +10 -0
  169. package/dist/new-widgets/attributeMixins/telMixin.js.map +1 -0
  170. package/dist/new-widgets/baseWidgetMixin.js +122 -0
  171. package/dist/new-widgets/baseWidgetMixin.js.map +1 -0
  172. package/dist/new-widgets/callbackMixins/autocompletionMixin.js +104 -0
  173. package/dist/new-widgets/callbackMixins/autocompletionMixin.js.map +1 -0
  174. package/dist/new-widgets/callbackMixins/index.js +8 -0
  175. package/dist/new-widgets/callbackMixins/index.js.map +1 -0
  176. package/dist/new-widgets/callbackMixins/richtextMixin.js +42 -0
  177. package/dist/new-widgets/callbackMixins/richtextMixin.js.map +1 -0
  178. package/dist/new-widgets/callbackMixins/slimselect.css +2 -0
  179. package/dist/new-widgets/callbackMixins/slimselect.css.proxy.js +10 -0
  180. package/dist/new-widgets/new-widget-factory.js +96 -0
  181. package/dist/new-widgets/new-widget-factory.js.map +1 -0
  182. package/dist/new-widgets/templateAdditionMixins/addableMixin.js +41 -0
  183. package/dist/new-widgets/templateAdditionMixins/addableMixin.js.map +1 -0
  184. package/dist/new-widgets/templateAdditionMixins/index.js +14 -0
  185. package/dist/new-widgets/templateAdditionMixins/index.js.map +1 -0
  186. package/dist/new-widgets/templateAdditionMixins/labelLastMixin.js +29 -0
  187. package/dist/new-widgets/templateAdditionMixins/labelLastMixin.js.map +1 -0
  188. package/dist/new-widgets/templateAdditionMixins/labelMixin.js +31 -0
  189. package/dist/new-widgets/templateAdditionMixins/labelMixin.js.map +1 -0
  190. package/dist/new-widgets/templates/defaultTemplatesDirectory.js +36 -0
  191. package/dist/new-widgets/templates/defaultTemplatesDirectory.js.map +1 -0
  192. package/dist/new-widgets/templates/displayTemplatesDirectory.js +90 -0
  193. package/dist/new-widgets/templates/displayTemplatesDirectory.js.map +1 -0
  194. package/dist/new-widgets/templates/formTemplatesDirectory.js +397 -0
  195. package/dist/new-widgets/templates/formTemplatesDirectory.js.map +1 -0
  196. package/dist/new-widgets/templates/groupTemplatesDirectory.js +21 -0
  197. package/dist/new-widgets/templates/groupTemplatesDirectory.js.map +1 -0
  198. package/dist/new-widgets/templates/index.js +7 -0
  199. package/dist/new-widgets/templates/index.js.map +1 -0
  200. package/dist/new-widgets/templates/setTemplatesDirectory.js +49 -0
  201. package/dist/new-widgets/templates/setTemplatesDirectory.js.map +1 -0
  202. package/dist/new-widgets/templatesDependencies/altMixin.js +13 -0
  203. package/dist/new-widgets/templatesDependencies/altMixin.js.map +1 -0
  204. package/dist/new-widgets/templatesDependencies/editableMixin.js +77 -0
  205. package/dist/new-widgets/templatesDependencies/editableMixin.js.map +1 -0
  206. package/dist/new-widgets/templatesDependencies/filterRangeFormMixin.js +38 -0
  207. package/dist/new-widgets/templatesDependencies/filterRangeFormMixin.js.map +1 -0
  208. package/dist/new-widgets/templatesDependencies/formCheckboxMixin.js +14 -0
  209. package/dist/new-widgets/templatesDependencies/formCheckboxMixin.js.map +1 -0
  210. package/dist/new-widgets/templatesDependencies/formCheckboxesMixin.js +51 -0
  211. package/dist/new-widgets/templatesDependencies/formCheckboxesMixin.js.map +1 -0
  212. package/dist/new-widgets/templatesDependencies/formDropdownMixin.js +66 -0
  213. package/dist/new-widgets/templatesDependencies/formDropdownMixin.js.map +1 -0
  214. package/dist/new-widgets/templatesDependencies/formFileMixin.js +81 -0
  215. package/dist/new-widgets/templatesDependencies/formFileMixin.js.map +1 -0
  216. package/dist/new-widgets/templatesDependencies/formLengthMixin.js +19 -0
  217. package/dist/new-widgets/templatesDependencies/formLengthMixin.js.map +1 -0
  218. package/dist/new-widgets/templatesDependencies/formMinMaxMixin.js +19 -0
  219. package/dist/new-widgets/templatesDependencies/formMinMaxMixin.js.map +1 -0
  220. package/dist/new-widgets/templatesDependencies/formMixin.js +66 -0
  221. package/dist/new-widgets/templatesDependencies/formMixin.js.map +1 -0
  222. package/dist/new-widgets/templatesDependencies/formNumberMixin.js +14 -0
  223. package/dist/new-widgets/templatesDependencies/formNumberMixin.js.map +1 -0
  224. package/dist/new-widgets/templatesDependencies/formRadioMixin.js +16 -0
  225. package/dist/new-widgets/templatesDependencies/formRadioMixin.js.map +1 -0
  226. package/dist/new-widgets/templatesDependencies/formStepMixin.js +13 -0
  227. package/dist/new-widgets/templatesDependencies/formStepMixin.js.map +1 -0
  228. package/dist/new-widgets/templatesDependencies/linkTextMixin.js +14 -0
  229. package/dist/new-widgets/templatesDependencies/linkTextMixin.js.map +1 -0
  230. package/dist/new-widgets/templatesDependencies/multipleFormMixin.js +125 -0
  231. package/dist/new-widgets/templatesDependencies/multipleFormMixin.js.map +1 -0
  232. package/dist/new-widgets/templatesDependencies/multipleselectFormMixin.js +74 -0
  233. package/dist/new-widgets/templatesDependencies/multipleselectFormMixin.js.map +1 -0
  234. package/dist/new-widgets/templatesDependencies/patternMixin.js +19 -0
  235. package/dist/new-widgets/templatesDependencies/patternMixin.js.map +1 -0
  236. package/dist/new-widgets/templatesDependencies/rangeMixin.js +110 -0
  237. package/dist/new-widgets/templatesDependencies/rangeMixin.js.map +1 -0
  238. package/dist/new-widgets/templatesDependencies/setMixin.js +12 -0
  239. package/dist/new-widgets/templatesDependencies/setMixin.js.map +1 -0
  240. package/dist/new-widgets/templatesDependencies/valueRichtextMixin.js +12 -0
  241. package/dist/new-widgets/templatesDependencies/valueRichtextMixin.js.map +1 -0
  242. package/dist/new-widgets/valueTransformationMixins/autolinkMixin.js +18 -0
  243. package/dist/new-widgets/valueTransformationMixins/autolinkMixin.js.map +1 -0
  244. package/dist/new-widgets/valueTransformationMixins/dateMixin.js +35 -0
  245. package/dist/new-widgets/valueTransformationMixins/dateMixin.js.map +1 -0
  246. package/dist/new-widgets/valueTransformationMixins/dateTimeMixin.js +16 -0
  247. package/dist/new-widgets/valueTransformationMixins/dateTimeMixin.js.map +1 -0
  248. package/dist/new-widgets/valueTransformationMixins/index.js +16 -0
  249. package/dist/new-widgets/valueTransformationMixins/index.js.map +1 -0
  250. package/dist/new-widgets/valueTransformationMixins/markdownMixin.js +25 -0
  251. package/dist/new-widgets/valueTransformationMixins/markdownMixin.js.map +1 -0
  252. package/dist/new-widgets/valueTransformationMixins/multilineMixin.js +17 -0
  253. package/dist/new-widgets/valueTransformationMixins/multilineMixin.js.map +1 -0
  254. package/dist/new-widgets/valueTransformationMixins/oembedMixin.js +27 -0
  255. package/dist/new-widgets/valueTransformationMixins/oembedMixin.js.map +1 -0
  256. package/dist/solid-template-element.js +164 -0
  257. package/dist/solid-template-element.js.map +1 -0
  258. package/dist/style/default-theme.css +24 -0
  259. package/dist/style/default-theme.css.proxy.js +10 -0
  260. package/dist/widgets/baseWidget.js +334 -0
  261. package/dist/widgets/baseWidget.js.map +1 -0
  262. package/dist/widgets/widget-factory.js +24 -0
  263. package/dist/widgets/widget-factory.js.map +1 -0
  264. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["filterMixin.ts"],"names":["searchInResources","FilterMixin","name","use","initialState","searchCount","attributes","searchFields","type","String","default","filteredBy","callback","newValue","searchForm","getAttribute","component","detach","populate","created","Map","element","addEventListener","window","document","contains","updateAutoRanges","attached","listPostProcessors","push","filterCallback","bind","filters","value","filterList","resources","div","context","has","set","createFilter","filteredResources","fields","filter","_v","index","nextProcessor","shift","get","resource","empty","getValuesOfField","field","arrayOfDataObjects","arrayOfDataIds","obj","nextArrayOfObjects","console","warn","nextArrayOfIds","getElementById","createElement","attach","toggleAttribute","searchAttributes","Array","from","attr","startsWith","map","replace","forEach","setAttribute","insertBefore","firstChild"],"mappings":"AACA,SAASA,iBAAT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C,MAA1B,CAAiC,IAAjC;AACA,SAAKhD,UAAL,CAAgBQ,gBAAhB,CAAiC,YAAjC,EAA+C,MAAM;AACnD,WAAKY,UAAL,CAAgBG,OAAhB;AACD,KAFD;AAGA,SAAKvB,UAAL,CAAgBiD,eAAhB,CAAgC,OAAhC,EAAyC,IAAzC;AAEA,QAAIpD,UAAJ,EAAgB,OAdiC,CAgBjD;;AACA,UAAMqD,gBAAgB,GAAGC,KAAK,CAACC,IAAN,CAAY,KAAK7C,OAAN,CAA0Bf,UAArC,EACxBqC,MADwB,CACjBwB,IAAI,IAAIA,IAAI,CAAC,MAAD,CAAJ,CAAaC,UAAb,CAAwB,SAAxB,CADS,EAExBC,GAFwB,CAEpBF,IAAI,KAAK;AACZjE,MAAAA,IAAI,EAAEiE,IAAI,CAAC,MAAD,CAAJ,CAAaG,OAAb,CAAqB,SAArB,EAAgC,EAAhC,CADM;AAEZrC,MAAAA,KAAK,EAAEkC,IAAI,CAAC,OAAD;AAFC,KAAL,CAFgB,CAAzB;AAOAH,IAAAA,gBAAgB,CAACO,OAAjB,CAAyB,CAAC;AAACrE,MAAAA,IAAD;AAAO+B,MAAAA;AAAP,KAAD,KAAmB;AAC1C,WAAKnB,UAAL,CAAgB0D,YAAhB,CAA6BtE,IAA7B,EAAmC+B,KAAnC;AACD,KAFD;AAIA,SAAKZ,OAAL,CAAaoD,YAAb,CAA0B,KAAK3D,UAA/B,EAA2C,KAAKO,OAAL,CAAaqD,UAAxD;AACA,UAAM,KAAK5D,UAAL,CAAgBE,SAAhB,CAA0BE,QAA1B,EAAN;AACD;;AAtHiB,CAApB;AAyHA,SACEjB,WADF","sourcesContent":["import type { SearchQuery } from '../libs/interfaces';\nimport { searchInResources } from '../libs/filter';\n\nconst FilterMixin = {\n name: 'filter-mixin',\n use: [],\n initialState: {\n searchCount: null,\n },\n attributes: {\n searchFields: {\n type: String,\n default: null\n },\n filteredBy: {\n type: String,\n default: null,\n callback(newValue: string) {\n // if we change search form, re-populate\n if (newValue && this.searchForm && newValue !== this.searchForm.getAttribute('id')) {\n this.searchForm.component.detach(this);\n this.searchForm = null;\n this.populate();\n }\n }\n }\n },\n created() {\n this.searchCount = new Map();\n this.element.addEventListener('populate', () => {\n if (!window.document.contains(this.element)) return;\n this.searchForm?.component.updateAutoRanges();\n })\n },\n attached(): void {\n this.listPostProcessors.push(this.filterCallback.bind(this));\n },\n get filters(): SearchQuery {\n return this.searchForm?.component.value ?? {};\n },\n set filters(filters) {\n this.searchForm.component.value = filters;\n this.filterList();\n },\n async filterCallback(resources: object[], listPostProcessors: Function[], div: HTMLElement, context: string): Promise<void> {\n if (this.filteredBy || this.searchFields) {\n if (!this.searchCount.has(context)) this.searchCount.set(context, 1);\n if (!this.searchForm) await this.createFilter(context);\n const filteredResources = await searchInResources(\n resources,\n this.filters,\n this.fields,\n this.searchForm\n );\n resources =\tresources.filter((_v, index) => filteredResources[index]);\n }\n\n const nextProcessor = listPostProcessors.shift();\n if(nextProcessor) await nextProcessor(resources, listPostProcessors, div, context + (this.searchCount.get(context) || ''));\n },\n async filterList(context: string): Promise<void> {\n this.searchCount.set(context, this.searchCount.get(context) + 1);\n if (!this.resource) return;\n this.empty();\n await this.populate();\n },\n async getValuesOfField(field: string) {\n const arrayOfDataObjects = this.resource['ldp:contains'];\n const arrayOfDataIds: string[] = [];\n for (const obj of arrayOfDataObjects) {\n // for each element, if it's an object, catch all elements in 'ldp:contains' key\n const nextArrayOfObjects = await obj[field];\n if (!nextArrayOfObjects) continue;\n\n if (typeof nextArrayOfObjects !== \"object\") {\n console.warn(`The format value of ${field} is not suitable with auto-range-[field] attribute`);\n continue;\n }\n\n const nextArrayOfIds = nextArrayOfObjects['ldp:contains'];\n for (const obj of nextArrayOfIds) {\n // catch each element id\n arrayOfDataIds.push(obj['@id']);\n }\n if (nextArrayOfObjects['@type'] !== 'ldp:Container') {\n // if no element in 'ldp:contains', catch object id\n arrayOfDataIds.push(nextArrayOfObjects['@id']);\n }\n }\n return arrayOfDataIds;\n },\n async createFilter(context: string): Promise<void> {\n const filteredBy = this.filteredBy;\n if (filteredBy != null) {\n this.searchForm = document.getElementById(filteredBy)\n if (!this.searchForm) throw `#${filteredBy} is not in DOM`;\n } else {\n this.searchForm = document.createElement(`solid-form-search`);\n }\n this.searchForm.component.attach(this);\n this.searchForm.addEventListener('formChange', () => {\n this.filterList(context);\n });\n this.searchForm.toggleAttribute('naked', true);\n\n if (filteredBy) return;\n\n //pass attributes to search form\n const searchAttributes = Array.from((this.element as Element).attributes)\n .filter(attr => attr['name'].startsWith('search-'))\n .map(attr => ({\n name: attr['name'].replace('search-', ''),\n value: attr['value'],\n }));\n\n searchAttributes.forEach(({name, value}) => {\n this.searchForm.setAttribute(name, value);\n });\n\n this.element.insertBefore(this.searchForm, this.element.firstChild);\n await this.searchForm.component.populate();\n },\n}\n\nexport {\n FilterMixin\n}"]}
@@ -0,0 +1,80 @@
1
+ const GrouperMixin = {
2
+ name: 'grouper-mixin',
3
+ use: [],
4
+ attributes: {
5
+ groupBy: {
6
+ type: String,
7
+ default: null
8
+ },
9
+ groupWidget: {
10
+ type: String,
11
+ default: 'solid-group-default'
12
+ },
13
+ groupClass: {
14
+ type: String,
15
+ default: ''
16
+ }
17
+ },
18
+
19
+ attached() {
20
+ this.listPostProcessors.push(this.groupResources.bind(this));
21
+ },
22
+
23
+ async groupResources(resources, listPostProcessors, div, context) {
24
+ const nextProcessor = listPostProcessors.shift();
25
+
26
+ if (this.groupBy) {
27
+ let groups = {};
28
+
29
+ for (let resource of resources) {
30
+ const valueGroup = await resource[this.groupBy];
31
+ if (valueGroup == null) continue;
32
+ if (!groups[valueGroup]) groups[valueGroup] = {
33
+ resources: []
34
+ }; // if no group yet, we create one...
35
+
36
+ groups[valueGroup].resources.push(resource); // ...and push corresponding resource into it
37
+ } // For each group, get group widget and call next processors
38
+
39
+
40
+ const parents = Object.keys(groups).map(g => ({
41
+ group: g,
42
+ parent: this.renderGroup(g, div)
43
+ }));
44
+
45
+ for (let {
46
+ group,
47
+ parent
48
+ } of parents) {
49
+ if (nextProcessor) await nextProcessor(groups[group].resources, // give only resources from group
50
+ [...listPostProcessors], // copy post processors
51
+ parent, // parent is group widget
52
+ context + "_" + group);
53
+ }
54
+ } else {
55
+ if (nextProcessor) await nextProcessor(resources, listPostProcessors, div, context);
56
+ }
57
+ },
58
+
59
+ /**
60
+ * Create a group widget or find if it already exists
61
+ * @param groupName
62
+ */
63
+ renderGroup(groupName, div) {
64
+ let groupElt = this.element.querySelector("".concat(this.groupWidget, "[value=\"").concat(groupName, "\"]"));
65
+
66
+ if (!groupElt) {
67
+ groupElt = document.createElement(this.groupWidget);
68
+ groupElt.setAttribute('value', groupName);
69
+ if (this.groupClass) groupElt.setAttribute('class', this.groupClass);
70
+ if (groupElt.component) groupElt.component.render(); // Force the rendering of the widget
71
+
72
+ div.appendChild(groupElt); // and append it to the parent div
73
+ }
74
+
75
+ return groupElt.querySelector('[data-content]') || groupElt; // return the node where to insert content
76
+ }
77
+
78
+ };
79
+ export { GrouperMixin };
80
+ //# sourceMappingURL=grouperMixin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["grouperMixin.ts"],"names":["GrouperMixin","name","use","attributes","groupBy","type","String","default","groupWidget","groupClass","attached","listPostProcessors","push","groupResources","bind","resources","div","context","nextProcessor","shift","groups","resource","valueGroup","parents","Object","keys","map","g","group","parent","renderGroup","groupName","groupElt","element","querySelector","document","createElement","setAttribute","component","render","appendChild"],"mappings":"AAAA,MAAMA,YAAY,GAAG;AACnBC,EAAAA,IAAI,EAAE,eADa;AAEnBC,EAAAA,GAAG,EAAE,EAFc;AAGnBC,EAAAA,UAAU,EAAE;AACVC,IAAAA,OAAO,EAAE;AACPC,MAAAA,IAAI,EAAEC,MADC;AAEPC,MAAAA,OAAO,EAAE;AAFF,KADC;AAKVC,IAAAA,WAAW,EAAE;AACXH,MAAAA,IAAI,EAAEC,MADK;AAEXC,MAAAA,OAAO,EAAE;AAFE,KALH;AASVE,IAAAA,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CAAcb,SADsB,EACX;AACzB,SAAC,GAAGJ,kBAAJ,CAFoC,EAEX;AACzBkB,QAAAA,MAHoC,EAG5B;AACRZ,QAAAA,OAAO,GAAG,GAAV,GAAgBW,KAJoB,CAAnB;AAMpB;AACF,KAnBD,MAmBO;AACL,UAAIV,aAAJ,EAAmB,MAAMA,aAAa,CACpCH,SADoC,EAEpCJ,kBAFoC,EAGpCK,GAHoC,EAIpCC,OAJoC,CAAnB;AAMpB;AACF,GAjDkB;;AAkDnB;AACF;AACA;AACA;AACEa,EAAAA,WAAW,CAACC,SAAD,EAAoBf,GAApB,EAAsC;AAC/C,QAAIgB,QAAQ,GAAG,KAAKC,OAAL,CAAaC,aAAb,WAA8B,KAAK1B,WAAnC,sBAAyDuB,SAAzD,SAAf;;AACA,QAAI,CAACC,QAAL,EAAe;AACbA,MAAAA,QAAQ,GAAGG,QAAQ,CAACC,aAAT,CAAuB,KAAK5B,WAA5B,CAAX;AACAwB,MAAAA,QAAQ,CAACK,YAAT,CAAsB,OAAtB,EAA+BN,SAA/B;AACA,UAAI,KAAKtB,UAAT,EAAqBuB,QAAQ,CAACK,YAAT,CAAsB,OAAtB,EAA+B,KAAK5B,UAApC;AACrB,UAAIuB,QAAQ,CAACM,SAAb,EAAwBN,QAAQ,CAACM,SAAT,CAAmBC,MAAnB,GAJX,CAIwC;;AACrDvB,MAAAA,GAAG,CAACwB,WAAJ,CAAgBR,QAAhB,EALa,CAKc;AAC5B;;AACD,WAAOA,QAAQ,CAACE,aAAT,CAAuB,gBAAvB,KAA4CF,QAAnD,CAT+C,CASc;AAC9D;;AAhEkB,CAArB;AAmEA,SACEhC,YADF","sourcesContent":["const GrouperMixin = {\n name: 'grouper-mixin',\n use: [],\n attributes: {\n groupBy: {\n type: String,\n default: null,\n },\n groupWidget: {\n type: String,\n default: 'solid-group-default'\n },\n groupClass: {\n type: String,\n default: ''\n }\n },\n attached() {\n this.listPostProcessors.push(this.groupResources.bind(this));\n },\n async groupResources(resources: object[], listPostProcessors: Function[], div: HTMLElement, context: string) {\n const nextProcessor = listPostProcessors.shift();\n if (this.groupBy) {\n let groups = {};\n for (let resource of resources) {\n const valueGroup = await resource[this.groupBy];\n if (valueGroup == null) continue;\n if (!groups[valueGroup]) groups[valueGroup] = { resources: [] }; // if no group yet, we create one...\n groups[valueGroup].resources.push(resource) // ...and push corresponding resource into it\n }\n\n // For each group, get group widget and call next processors\n const parents = Object.keys(groups).map(g => ({ group: g, parent: this.renderGroup(g, div) }));\n for (let { group, parent } of parents) {\n if (nextProcessor) await nextProcessor(\n groups[group].resources, // give only resources from group\n [...listPostProcessors], // copy post processors\n parent, // parent is group widget\n context + \"_\" + group\n );\n }\n } else {\n if (nextProcessor) await nextProcessor(\n resources,\n listPostProcessors,\n div,\n context\n );\n }\n },\n /**\n * Create a group widget or find if it already exists\n * @param groupName\n */\n renderGroup(groupName: string, div: HTMLElement) {\n let groupElt = this.element.querySelector(`${this.groupWidget}[value=\"${groupName}\"]`);\n if (!groupElt) {\n groupElt = document.createElement(this.groupWidget);\n groupElt.setAttribute('value', groupName);\n if (this.groupClass) groupElt.setAttribute('class', this.groupClass);\n if (groupElt.component) groupElt.component.render(); // Force the rendering of the widget\n div.appendChild(groupElt); // and append it to the parent div\n }\n return groupElt.querySelector('[data-content]') || groupElt; // return the node where to insert content\n }\n}\n\nexport {\n GrouperMixin\n}"]}
@@ -0,0 +1,42 @@
1
+ const HighlighterMixin = {
2
+ name: 'highlighter-mixin',
3
+ use: [],
4
+
5
+ attached() {
6
+ this.listPostProcessors.push(this.hightlightCallback.bind(this));
7
+ },
8
+
9
+ async hightlightCallback(resources, listPostProcessors, div, context) {
10
+ for (let attr of this.element.attributes) {
11
+ if (attr.name.startsWith('highlight-')) {
12
+ const field = attr.name.split('highlight-')[1];
13
+ resources = await Promise.all(resources.map(async resource => ({
14
+ sortingKey: await resource[field],
15
+ // fetch sorting value
16
+ proxy: resource // and keep proxy
17
+
18
+ })));
19
+ resources = this.sortHighlighted(resources, "sortingKey", attr.value); // highlight element
20
+
21
+ resources = resources.map(resource => resource.proxy); // and re-transform in arra of resources
22
+ }
23
+ }
24
+
25
+ const nextProcessor = listPostProcessors.shift();
26
+ if (nextProcessor) await nextProcessor(resources, listPostProcessors, div, context);
27
+ },
28
+
29
+ sortHighlighted(resources, field, value) {
30
+ for (let [index, res] of resources.entries()) {
31
+ if (res[field] && res[field] == value) {
32
+ // put the current element at the beginning of the array
33
+ resources.splice(0, 0, resources.splice(index, 1)[0]); // TODO : test with sort
34
+ }
35
+ }
36
+
37
+ return resources;
38
+ }
39
+
40
+ };
41
+ export { HighlighterMixin };
42
+ //# sourceMappingURL=highlighterMixin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["highlighterMixin.ts"],"names":["HighlighterMixin","name","use","attached","listPostProcessors","push","hightlightCallback","bind","resources","div","context","attr","element","attributes","startsWith","field","split","Promise","all","map","resource","sortingKey","proxy","sortHighlighted","value","nextProcessor","shift","index","res","entries","splice"],"mappings":"AAAA,MAAMA,gBAAgB,GAAG;AACvBC,EAAAA,IAAI,EAAE,mBADiB;AAEvBC,EAAAA,GAAG,EAAE,EAFkB;;AAGvBC,EAAAA,QAAQ,GAAS;AACf,SAAKC,kBAAL,CAAwBC,IAAxB,CAA6B,KAAKC,kBAAL,CAAwBC,IAAxB,CAA6B,IAA7B,CAA7B;AACD,GALsB;;AAMvB,QAAMD,kBAAN,CAAyBE,SAAzB,EAA8CJ,kBAA9C,EAA8EK,GAA9E,EAAgGC,OAAhG,EAAgI;AAC9H,SAAK,IAAIC,IAAT,IAAiB,KAAKC,OAAL,CAAaC,UAA9B,EAA0C;AACxC,UAAIF,IAAI,CAACV,IAAL,CAAUa,UAAV,CAAqB,YAArB,CAAJ,EAAwC;AACtC,cAAMC,KAAK,GAAGJ,IAAI,CAACV,IAAL,CAAUe,KAAV,CAAgB,YAAhB,EAA8B,CAA9B,CAAd;AACAR,QAAAA,SAAS,GAAG,MAAMS,OAAO,CAACC,GAAR,CAAYV,SAAS,CAACW,GAAV,CAAc,MAAOC,QAAP,KAAqB;AAC/DC,UAAAA,UAAU,EAAE,MAAMD,QAAQ,CAACL,KAAD,CADqC;AAC5B;AACnCO,UAAAA,KAAK,EAAEF,QAFwD,CAE/C;;AAF+C,SAArB,CAAd,CAAZ,CAAlB;AAIAZ,QAAAA,SAAS,GAAG,KAAKe,eAAL,CAAqBf,SAArB,EAAgC,YAAhC,EAA8CG,IAAI,CAACa,KAAnD,CAAZ,CANsC,CAMiC;;AACvEhB,QAAAA,SAAS,GAAGA,SAAS,CAACW,GAAV,CAAcC,QAAQ,IAAUA,QAAN,CAAgBE,KAA1C,CAAZ,CAPsC,CAOwB;AAC/D;AACF;;AAED,UAAMG,aAAa,GAAGrB,kBAAkB,CAACsB,KAAnB,EAAtB;AACA,QAAID,aAAJ,EAAmB,MAAMA,aAAa,CAACjB,SAAD,EAAYJ,kBAAZ,EAAgCK,GAAhC,EAAqCC,OAArC,CAAnB;AACpB,GArBsB;;AAuBvBa,EAAAA,eAAe,CAACf,SAAD,EAAYO,KAAZ,EAAmBS,KAAnB,EAA0B;AACvC,SAAK,IAAI,CAACG,KAAD,EAAQC,GAAR,CAAT,IAAyBpB,SAAS,CAACqB,OAAV,EAAzB,EAA8C;AAC5C,UAAID,GAAG,CAACb,KAAD,CAAH,IAAca,GAAG,CAACb,KAAD,CAAH,IAAcS,KAAhC,EAAuC;AACrC;AACAhB,QAAAA,SAAS,CAACsB,MAAV,CAAiB,CAAjB,EAAoB,CAApB,EAAuBtB,SAAS,CAACsB,MAAV,CAAiBH,KAAjB,EAAwB,CAAxB,EAA2B,CAA3B,CAAvB,EAFqC,CAEkB;AACxD;AACF;;AACD,WAAOnB,SAAP;AACD;;AA/BsB,CAAzB;AAkCA,SACER,gBADF","sourcesContent":["const HighlighterMixin = {\n name: 'highlighter-mixin',\n use: [],\n attached(): void {\n this.listPostProcessors.push(this.hightlightCallback.bind(this));\n },\n async hightlightCallback(resources: object[], listPostProcessors: Function[], div: HTMLElement, context: string): Promise<void> {\n for (let attr of this.element.attributes) {\n if (attr.name.startsWith('highlight-')) {\n const field = attr.name.split('highlight-')[1];\n resources = await Promise.all(resources.map(async (resource) => ({\n sortingKey: await resource[field], // fetch sorting value\n proxy: resource // and keep proxy\n })));\n resources = this.sortHighlighted(resources, \"sortingKey\", attr.value); // highlight element\n resources = resources.map(resource => (<any>resource).proxy); // and re-transform in arra of resources\n }\n }\n\n const nextProcessor = listPostProcessors.shift();\n if (nextProcessor) await nextProcessor(resources, listPostProcessors, div, context);\n },\n\n sortHighlighted(resources, field, value) {\n for (let [index, res] of resources.entries()) {\n if (res[field] && res[field] == value) {\n // put the current element at the beginning of the array\n resources.splice(0, 0, resources.splice(index, 1)[0]); // TODO : test with sort\n }\n }\n return resources\n }\n}\n\nexport {\n HighlighterMixin\n}"]}
@@ -0,0 +1,8 @@
1
+ export let WidgetType;
2
+
3
+ (function (WidgetType) {
4
+ WidgetType["CUSTOM"] = "custom";
5
+ WidgetType["USER"] = "user";
6
+ WidgetType["NATIVE"] = "native";
7
+ })(WidgetType || (WidgetType = {}));
8
+ //# sourceMappingURL=interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["interfaces.ts"],"names":["WidgetType"],"mappings":"AAAA,WAAYA,UAAZ;;WAAYA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;GAAAA,U,KAAAA,U","sourcesContent":["export enum WidgetType {\n CUSTOM = \"custom\",\n USER = \"user\",\n NATIVE = \"native\",\n}\n\nexport interface WidgetInterface {\n tagName: String\n type: WidgetType\n}\n\nexport interface Resource {\n '@id': string\n clientContext: object\n isContainer: Function\n isFullResource: Function\n properties: string[],\n serverPagination: object\n}"]}
@@ -0,0 +1,138 @@
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
+ import { html, render } from '../_snowpack/pkg/lit-html.js';
24
+ import { preHTML } from '../libs/lit-helpers.js';
25
+ import { ifDefined } from '../_snowpack/pkg/lit-html/directives/if-defined.js';
26
+ const ListMixin = {
27
+ name: 'list-mixin',
28
+ use: [],
29
+ attributes: {
30
+ emptyWidget: {
31
+ type: String,
32
+ default: null
33
+ },
34
+ emptyValue: {
35
+ type: String,
36
+ default: ''
37
+ }
38
+ },
39
+ initialState: {
40
+ // Processors functions to execute on the list before rendering
41
+ listPostProcessors: [],
42
+ // Rendering to execute after all the processors have been executed
43
+ renderCallbacks: []
44
+ },
45
+
46
+ created() {
47
+ this.listPostProcessors = [];
48
+ this.renderCallbacks = [];
49
+ },
50
+
51
+ appendSingleElt(parent) {
52
+ this.appendChildElt(this.resource['@id'], parent);
53
+ },
54
+
55
+ setElementAttribute(attr) {
56
+ const containerAttribute = "solid-container";
57
+ const resourceAttribute = "solid-resource";
58
+
59
+ if (attr === "resource") {
60
+ this.element.removeAttribute(containerAttribute);
61
+ this.element.setAttribute(resourceAttribute, "");
62
+ } else {
63
+ this.element.removeAttribute(resourceAttribute);
64
+ this.element.setAttribute(containerAttribute, "");
65
+ }
66
+ },
67
+
68
+ async populate() {
69
+ var _this$resource$isCont, _this$resource;
70
+
71
+ const div = this.div;
72
+ if (!this.resource) return; // Not a container but a single resource
73
+
74
+ if (!((_this$resource$isCont = (_this$resource = this.resource).isContainer) !== null && _this$resource$isCont !== void 0 && _this$resource$isCont.call(_this$resource))) {
75
+ this.setElementAttribute("resource");
76
+ this.appendSingleElt(div);
77
+ return;
78
+ }
79
+
80
+ this.setElementAttribute("container");
81
+ const listPostProcessors = [...this.listPostProcessors];
82
+ this.renderCallbacks = [];
83
+ listPostProcessors.push(this.renderDOM.bind(this));
84
+ listPostProcessors.push(this.handleEmptyWidget.bind(this)); // Execute the first post-processor of the list
85
+
86
+ const nextProcessor = listPostProcessors.shift();
87
+ await nextProcessor(this.resource['ldp:contains'], listPostProcessors, div, this.dataSrc); // Execute the render callbacks
88
+
89
+ for (const renderCallback of this.renderCallbacks) {
90
+ // Render the template in the given parent element
91
+ render(renderCallback.template, renderCallback.parent);
92
+ }
93
+ },
94
+
95
+ /**
96
+ * Render resources in the DOM
97
+ * @param resources
98
+ * @param listPostProcessors
99
+ * @param div
100
+ * @param context
101
+ */
102
+ async renderDOM(resources, listPostProcessors, div, context) {
103
+ // Create child components
104
+ for (let resource of resources) {
105
+ if (!resource) continue;
106
+ this.appendChildElt(resource['@id'], div);
107
+ }
108
+
109
+ const nextProcessor = listPostProcessors.shift();
110
+ if (nextProcessor) await nextProcessor(resources, listPostProcessors, div, context);
111
+ },
112
+
113
+ /**
114
+ * Show empty widget if no resources in the list
115
+ * @param resources
116
+ * @param listPostProcessors
117
+ * @param div
118
+ * @param context
119
+ */
120
+ async handleEmptyWidget(resources, listPostProcessors, div, context) {
121
+ if (this.emptyWidget) {
122
+ const emptyWidgetTemplate = preHTML(_templateObject(), this.emptyWidget, ifDefined(this.emptyValue), this.emptyWidget);
123
+
124
+ if (!this.emptyWrapper) {
125
+ this.emptyWrapper = document.createElement('span');
126
+ this.element.appendChild(this.emptyWrapper);
127
+ }
128
+
129
+ render(resources.length > 0 ? html(_templateObject2()) : emptyWidgetTemplate, this.emptyWrapper);
130
+ }
131
+
132
+ const nextProcessor = listPostProcessors.shift();
133
+ if (nextProcessor) await nextProcessor(resources, listPostProcessors, div, context);
134
+ }
135
+
136
+ };
137
+ export { ListMixin };
138
+ //# sourceMappingURL=listMixin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["listMixin.ts"],"names":["html","render","preHTML","ifDefined","ListMixin","name","use","attributes","emptyWidget","type","String","default","emptyValue","initialState","listPostProcessors","renderCallbacks","created","appendSingleElt","parent","appendChildElt","resource","setElementAttribute","attr","containerAttribute","resourceAttribute","element","removeAttribute","setAttribute","populate","div","isContainer","push","renderDOM","bind","handleEmptyWidget","nextProcessor","shift","dataSrc","renderCallback","template","resources","context","emptyWidgetTemplate","emptyWrapper","document","createElement","appendChild","length"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,IAAT,EAAeC,MAAf,QAA6B,UAA7B;AACA,SAASC,OAAT,QAAwB,qBAAxB;AACA,SAASC,SAAT,QAA0B,gCAA1B;AAEA,MAAMC,SAAS,GAAG;AAChBC,EAAAA,IAAI,EAAE,YADU;AAEhBC,EAAAA,GAAG,EAAE,EAFW;AAGhBC,EAAAA,UAAU,EAAE;AACVC,IAAAA,WAAW,EAAE;AACXC,MAAAA,IAAI,EAAEC,MADK;AAEXC,MAAAA,OAAO,EAAE;AAFE,KADH;AAKVC,IAAAA,UAAU,EAAE;AACVH,MAAAA,IAAI,EAAEC,MADI;AAEVC,MAAAA,OAAO,EAAE;AAFC;AALF,GAHI;AAahBE,EAAAA,YAAY,EAAE;AACZ;AACAC,IAAAA,kBAAkB,EAAE,EAFR;AAGZ;AACAC,IAAAA,eAAe,EAAE;AAJL,GAbE;;AAmBhBC,EAAAA,OAAO,GAAG;AACR,SAAKF,kBAAL,GAA0B,EAA1B;AACA,SAAKC,eAAL,GAAuB,EAAvB;AACD,GAtBe;;AAuBhBE,EAAAA,eAAe,CAACC,MAAD,EAA4B;AACzC,SAAKC,cAAL,CAAoB,KAAKC,QAAL,CAAc,KAAd,CAApB,EAA0CF,MAA1C;AACD,GAzBe;;AA0BhBG,EAAAA,mBAAmB,CAACC,IAAD,EAAiC;AAClD,UAAMC,kBAAkB,GAAG,iBAA3B;AACA,UAAMC,iBAAiB,GAAG,gBAA1B;;AACA,QAAIF,IAAI,KAAK,UAAb,EAAyB;AACvB,WAAKG,OAAL,CAAaC,eAAb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c,SAAN,CACEQ,SADF,EAEE1B,kBAFF,EAGEe,GAHF,EAIEY,OAJF,EAKE;AACA;AACA,SAAK,IAAIrB,QAAT,IAAqBoB,SAArB,EAAgC;AAC9B,UAAI,CAACpB,QAAL,EAAe;AACf,WAAKD,cAAL,CAAoBC,QAAQ,CAAC,KAAD,CAA5B,EAAqCS,GAArC;AACD;;AAED,UAAMM,aAAa,GAAGrB,kBAAkB,CAACsB,KAAnB,EAAtB;AACA,QAAID,aAAJ,EACE,MAAMA,aAAa,CACjBK,SADiB,EAEjB1B,kBAFiB,EAGjBe,GAHiB,EAIjBY,OAJiB,CAAnB;AAMH,GAjGe;;AAmGhB;AACF;AACA;AACA;AACA;AACA;AACA;AACE,QAAMP,iBAAN,CACEM,SADF,EAEE1B,kBAFF,EAGEe,GAHF,EAIEY,OAJF,EAKE;AACA,QAAI,KAAKjC,WAAT,EAAsB;AACpB,YAAMkC,mBAAmB,GAAGxC,OAAH,oBACpB,KAAKM,WADe,EACML,SAAS,CAAC,KAAKS,UAAN,CADf,EACsC,KAAKJ,WAD3C,CAAzB;;AAGA,UAAI,CAAC,KAAKmC,YAAV,EAAwB;AACtB,aAAKA,YAAL,GAAoBC,QAAQ,CAACC,aAAT,CAAuB,MAAvB,CAApB;AACA,aAAKpB,OAAL,CAAaqB,WAAb,CAAyB,KAAKH,YAA9B;AACD;;AAED1C,MAAAA,MAAM,CAACuC,SAAS,CAACO,MAAV,GAAmB,CAAnB,GAAuB/C,IAAvB,uBAAgC0C,mBAAjC,EAAsD,KAAKC,YAA3D,CAAN;AACD;;AAED,UAAMR,aAAa,GAAGrB,kBAAkB,CAACsB,KAAnB,EAAtB;AACA,QAAID,aAAJ,EACE,MAAMA,aAAa,CACjBK,SADiB,EAEjB1B,kBAFiB,EAGjBe,GAHiB,EAIjBY,OAJiB,CAAnB;AAMH;;AApIe,CAAlB;AAuIA,SAASrC,SAAT","sourcesContent":["import { html, render } from 'lit-html';\nimport { preHTML } from '../libs/lit-helpers';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nconst ListMixin = {\n name: 'list-mixin',\n use: [],\n attributes: {\n emptyWidget: {\n type: String,\n default: null,\n },\n emptyValue: {\n type: String,\n default: '',\n },\n },\n initialState: {\n // Processors functions to execute on the list before rendering\n listPostProcessors: [],\n // Rendering to execute after all the processors have been executed\n renderCallbacks: [],\n },\n created() {\n this.listPostProcessors = [];\n this.renderCallbacks = [];\n },\n appendSingleElt(parent: HTMLElement): void {\n this.appendChildElt(this.resource['@id'], parent);\n },\n setElementAttribute(attr: 'resource' | 'container') {\n const containerAttribute = \"solid-container\";\n const resourceAttribute = \"solid-resource\";\n if (attr === \"resource\") {\n this.element.removeAttribute(containerAttribute);\n this.element.setAttribute(resourceAttribute, \"\");\n } else {\n this.element.removeAttribute(resourceAttribute);\n this.element.setAttribute(containerAttribute, \"\")\n }\n },\n async populate(): Promise<void> {\n const div = this.div;\n if (!this.resource) return;\n\n // Not a container but a single resource\n if (!this.resource.isContainer?.()) {\n this.setElementAttribute(\"resource\");\n this.appendSingleElt(div);\n return;\n }\n\n this.setElementAttribute(\"container\");\n const listPostProcessors = [...this.listPostProcessors];\n this.renderCallbacks = [];\n listPostProcessors.push(this.renderDOM.bind(this));\n listPostProcessors.push(this.handleEmptyWidget.bind(this));\n\n // Execute the first post-processor of the list\n const nextProcessor = listPostProcessors.shift();\n await nextProcessor(\n this.resource['ldp:contains'],\n listPostProcessors,\n div,\n this.dataSrc,\n );\n\n // Execute the render callbacks\n for (const renderCallback of this.renderCallbacks) {\n // Render the template in the given parent element\n render(renderCallback.template, renderCallback.parent);\n }\n },\n\n /**\n * Render resources in the DOM\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 // Create child components\n for (let resource of resources) {\n if (!resource) continue;\n this.appendChildElt(resource['@id'], div);\n }\n\n const nextProcessor = listPostProcessors.shift();\n if (nextProcessor)\n await nextProcessor(\n resources,\n listPostProcessors,\n div,\n context\n );\n },\n\n /**\n * Show empty widget if no resources in the list\n * @param resources\n * @param listPostProcessors\n * @param div\n * @param context\n */\n async handleEmptyWidget(\n resources: object[],\n listPostProcessors: Function[],\n div: HTMLElement,\n context: string,\n ) {\n if (this.emptyWidget) {\n const emptyWidgetTemplate = preHTML`\n <${this.emptyWidget} value=${ifDefined(this.emptyValue)}></${this.emptyWidget}>\n `\n if (!this.emptyWrapper) {\n this.emptyWrapper = document.createElement('span')\n this.element.appendChild(this.emptyWrapper)\n }\n \n render(resources.length > 0 ? html`` : emptyWidgetTemplate, this.emptyWrapper);\n }\n\n const nextProcessor = listPostProcessors.shift();\n if (nextProcessor)\n await nextProcessor(\n resources,\n listPostProcessors,\n div,\n context\n );\n },\n};\n\nexport { ListMixin };\n"]}
@@ -0,0 +1,26 @@
1
+ const NextMixin = {
2
+ name: 'next-mixin',
3
+ use: [],
4
+ attributes: {
5
+ next: {
6
+ type: String,
7
+ default: ''
8
+ }
9
+ },
10
+
11
+ // Here "even.target" points to the content of the widgets of the children of solid-display
12
+ goToNext(resource) {
13
+ if (this.next) {
14
+ this.element.dispatchEvent(new CustomEvent('requestNavigation', {
15
+ bubbles: true,
16
+ detail: {
17
+ route: this.next,
18
+ resource: resource
19
+ }
20
+ }));
21
+ }
22
+ }
23
+
24
+ };
25
+ export { NextMixin };
26
+ //# sourceMappingURL=nextMixin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["nextMixin.ts"],"names":["NextMixin","name","use","attributes","next","type","String","default","goToNext","resource","element","dispatchEvent","CustomEvent","bubbles","detail","route"],"mappings":"AAEA,MAAMA,SAAS,GAAG;AAChBC,EAAAA,IAAI,EAAE,YADU;AAEhBC,EAAAA,GAAG,EAAE,EAFW;AAGhBC,EAAAA,UAAU,EAAE;AACVC,IAAAA,IAAI,EAAE;AACJC,MAAAA,IAAI,EAAEC,MADF;AAEJC,MAAAA,OAAO,EAAC;AAFJ;AADI,GAHI;;AAUhB;AACAC,EAAAA,QAAQ,CAACC,QAAD,EAA2B;AACjC,QAAI,KAAKL,IAAT,EAAe;AACb,WAAKM,OAAL,CAAaC,aAAb,CACE,IAAIC,WAAJ,CAAgB,mBAAhB,EAAqC;AACnCC,QAAAA,OAAO,EAAE,IAD0B;AAEnCC,QAAAA,MAAM,EAAE;AAAEC,UAAAA,KAAK,EAAE,KAAKX,IAAd;AAAoBK,UAAAA,QAAQ,EAAEA;AAA9B;AAF2B,OAArC,CADF;AAMD;AACF;;AApBe,CAAlB;AAuBA,SACET,SADF","sourcesContent":["import type { Resource } from \"./interfaces.js\";\n\nconst NextMixin = {\n name: 'next-mixin',\n use: [],\n attributes: {\n next: {\n type: String,\n default:''\n },\n },\n\n // Here \"even.target\" points to the content of the widgets of the children of solid-display\n goToNext(resource: Resource): void {\n if (this.next) {\n this.element.dispatchEvent(\n new CustomEvent('requestNavigation', {\n bubbles: true,\n detail: { route: this.next, resource: resource },\n }),\n );\n }\n }\n}\n\nexport {\n NextMixin\n}"]}
@@ -0,0 +1,110 @@
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
+ import { html } from "../_snowpack/pkg/lit-html.js";
14
+ const PaginateMixin = {
15
+ name: 'paginate-mixin',
16
+ use: [],
17
+ attributes: {
18
+ paginateBy: {
19
+ type: Number,
20
+ default: 0
21
+ },
22
+ paginateLoop: {
23
+ type: String,
24
+ default: null
25
+ }
26
+ },
27
+ initialState: {
28
+ currentPage: []
29
+ },
30
+
31
+ created() {
32
+ this.currentPage = [];
33
+ },
34
+
35
+ attached() {
36
+ this.listPostProcessors.push(this.paginateCallback.bind(this));
37
+ },
38
+
39
+ async paginateCallback(resources, listPostProcessors, div, context) {
40
+ if (this.paginateBy > 0) {
41
+ if (!this.currentPage[context]) this.currentPage[context] = 1;
42
+ const parentDiv = this.initParentPaginationDiv(div, context);
43
+ this.renderCallbacks.push({
44
+ template: this.renderPaginationNav(this.getPageCount(resources.length), context, div),
45
+ parent: parentDiv
46
+ });
47
+ const firstElementIndex = (this.getCurrentPage(context) - 1) * this.paginateBy;
48
+ resources = resources.slice(firstElementIndex, firstElementIndex + this.paginateBy);
49
+ }
50
+
51
+ const nextProcessor = listPostProcessors.shift();
52
+ if (nextProcessor) await nextProcessor(resources, listPostProcessors, div, context);
53
+ },
54
+
55
+ getNavElement(div) {
56
+ const insertNode = div.parentNode || div;
57
+ return insertNode.querySelector("nav[data-id=\"nav\"]");
58
+ },
59
+
60
+ /**
61
+ * Find nav element or create it if not existing
62
+ * @param div - insert nav next to this div
63
+ */
64
+ initParentPaginationDiv(div) {
65
+ let nav = this.getNavElement(div);
66
+
67
+ if (!nav) {
68
+ nav = document.createElement('nav');
69
+ nav.setAttribute('data-id', 'nav');
70
+ const insertNode = div.parentNode || div;
71
+ insertNode.appendChild(nav);
72
+ }
73
+
74
+ return nav;
75
+ },
76
+
77
+ getCurrentPage(context) {
78
+ return this.currentPage[context];
79
+ },
80
+
81
+ setCurrentPage(page, context, pageCount) {
82
+ if (page < 1) page = !this.shouldLoop() ? 1 : pageCount;
83
+ if (page > pageCount) page = !this.shouldLoop() ? pageCount : 1;
84
+ this.currentPage[context] = page;
85
+ this.empty();
86
+ this.populate();
87
+ },
88
+
89
+ getPageCount(size) {
90
+ return Math.max(1, Math.ceil(size / this.paginateBy));
91
+ },
92
+
93
+ shouldLoop() {
94
+ return this.paginateLoop !== null;
95
+ },
96
+
97
+ /**
98
+ * Create pagination template
99
+ * @param pageCount
100
+ * @param context
101
+ */
102
+ renderPaginationNav(pageCount, context, div) {
103
+ this.getNavElement(div).toggleAttribute('hidden', pageCount <= 1);
104
+ 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));
106
+ }
107
+
108
+ };
109
+ export { PaginateMixin };
110
+ //# sourceMappingURL=paginateMixin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["paginateMixin.ts"],"names":["html","PaginateMixin","name","use","attributes","paginateBy","type","Number","default","paginateLoop","String","initialState","currentPage","created","attached","listPostProcessors","push","paginateCallback","bind","resources","div","context","parentDiv","initParentPaginationDiv","renderCallbacks","template","renderPaginationNav","getPageCount","length","parent","firstElementIndex","getCurrentPage","slice","nextProcessor","shift","getNavElement","insertNode","parentNode","querySelector","nav","document","createElement","setAttribute","appendChild","setCurrentPage","page","pageCount","shouldLoop","empty","populate","size","Math","max","ceil","toggleAttribute"],"mappings":";;;;;;;;;;;;AAAA,SAASA,IAAT,QAAqC,UAArC;AAEA,MAAMC,aAAa,GAAG;AACpBC,EAAAA,IAAI,EAAE,gBADc;AAEpBC,EAAAA,GAAG,EAAE,EAFe;AAGpBC,EAAAA,UAAU,EAAE;AACVC,IAAAA,UAAU,EAAE;AACVC,MAAAA,IAAI,EAAEC,MADI;AAEVC,MAAAA,OAAO,EAAE;AAFC,KADF;AAKVC,IAAAA,YAAY,EAAE;AACZH,MAAAA,IAAI,EAAEI,MADM;AAEZF,MAAAA,OAAO,EAAE;AAFG;AALJ,GAHQ;AAapBG,EAAAA,YAAY,EAAE;AACZC,IAAAA,WAAW,EAAE;AADD,GAbM;;AAgBpBC,EAAAA,OAAO,GAAG;AACR,SAAKD,WAAL,GAAmB,EAAnB;AACD,GAlBmB;;AAmBpBE,EAAAA,QAAQ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ApB,EAAqCD,GAArC,EAAuE;AACxF,SAAKe,aAAL,CAAmBf,GAAnB,EAAwBkC,eAAxB,CAAwC,QAAxC,EAAkDR,SAAS,IAAI,CAA/D;AACA,UAAMlC,WAAW,GAAG,KAAKmB,cAAL,CAAoBV,OAApB,CAApB;AAEA,WAAOrB,IAAP,oBAGgB,CAAC,KAAK+C,UAAL,EAAD,IAAsBnC,WAAW,IAAI,CAHrD,EAIa,MAAM,KAAKgC,cAAL,CAAoBhC,WAAW,GAAG,CAAlC,EAAqCS,OAArC,EAA8CyB,SAA9C,CAJnB,EAQgB,CAAC,KAAKC,UAAL,EAAD,IAAsBnC,WAAW,IAAIkC,SARrD,EASc,MAAM,KAAKF,cAAL,CAAoBhC,WAAW,GAAG,CAAlC,EAAqCS,OAArC,EAA8CyB,SAA9C,CATpB,EAY8BlC,WAZ9B,EAY4EF,MAAM,CAACoC,SAAD,CAZlF;AAeD;;AAjGmB,CAAtB;AAoGA,SACE7C,aADF","sourcesContent":["import { html, TemplateResult } from \"lit-html\";\n\nconst PaginateMixin = {\n name: 'paginate-mixin',\n use: [],\n attributes: {\n paginateBy: {\n type: Number,\n default: 0\n },\n paginateLoop: {\n type: String,\n default: null\n }\n },\n initialState: {\n currentPage: [],\n },\n created() {\n this.currentPage = [];\n },\n attached(): void {\n this.listPostProcessors.push(this.paginateCallback.bind(this));\n },\n async paginateCallback(resources: object[], listPostProcessors: Function[], div: HTMLElement, context: string) {\n if (this.paginateBy > 0) {\n if (!this.currentPage[context]) this.currentPage[context] = 1;\n const parentDiv = this.initParentPaginationDiv(div, context);\n this.renderCallbacks.push({\n template: this.renderPaginationNav(this.getPageCount(resources.length),context,div),\n parent: parentDiv\n });\n\n const firstElementIndex = (this.getCurrentPage(context) - 1) * this.paginateBy;\n resources = resources.slice(firstElementIndex, firstElementIndex + this.paginateBy);\n }\n\n const nextProcessor = listPostProcessors.shift();\n if (nextProcessor) await nextProcessor(resources, listPostProcessors, div,context);\n },\n getNavElement(div: HTMLElement) {\n const insertNode = div.parentNode || div;\n return insertNode.querySelector(`nav[data-id=\"nav\"]`);\n },\n /**\n * Find nav element or create it if not existing\n * @param div - insert nav next to this div\n */\n initParentPaginationDiv(div: HTMLElement) {\n let nav = this.getNavElement(div);\n if (!nav) {\n nav = document.createElement('nav');\n nav.setAttribute('data-id', 'nav');\n const insertNode = div.parentNode || div;\n insertNode.appendChild(nav);\n }\n return nav;\n },\n getCurrentPage(context: string) {\n return this.currentPage[context];\n },\n setCurrentPage(page: number, context: string, pageCount: number): void {\n if (page < 1) page = !this.shouldLoop() ? 1 : pageCount;\n if (page > pageCount) page = !this.shouldLoop() ? pageCount : 1;\n this.currentPage[context] = page;\n this.empty();\n this.populate();\n },\n getPageCount(size: number): number {\n return Math.max(1, Math.ceil(size / this.paginateBy));\n },\n shouldLoop(): boolean {\n return this.paginateLoop !== null;\n },\n\n /**\n * Create pagination template\n * @param pageCount\n * @param context\n */\n renderPaginationNav(pageCount: number, context: string, div: HTMLElement): TemplateResult {\n this.getNavElement(div).toggleAttribute('hidden', pageCount <= 1);\n const currentPage = this.getCurrentPage(context);\n\n return html`\n <button\n data-id=\"prev\"\n ?disabled=${!this.shouldLoop() && currentPage <= 1}\n @click=${() => this.setCurrentPage(currentPage - 1, context, pageCount)}\n >←</button>\n <button\n data-id=\"next\"\n ?disabled=${!this.shouldLoop() && currentPage >= pageCount}\n @click=${ () => this.setCurrentPage(currentPage + 1, context, pageCount)}\n >→</button>\n <span>\n <span data-id=\"current\">${currentPage}</span> / <span data-id=\"count\">${String(pageCount)}</span>\n </span>\n `;\n },\n}\n\nexport {\n PaginateMixin\n}"]}
@@ -0,0 +1,34 @@
1
+ const RequiredMixin = {
2
+ name: 'required-mixin',
3
+ use: [],
4
+
5
+ attached() {
6
+ this.listPostProcessors.push(this.requiredResources.bind(this));
7
+ },
8
+
9
+ async requiredResources(resources, listPostProcessors, div, context) {
10
+ const displays = [];
11
+ const requiredFields = Array.from(this.element.attributes).filter(attr => attr.name.startsWith('required-')).map(attr => attr['name'].replace('required-', ''));
12
+
13
+ if (requiredFields.length) {
14
+ for (let resource of resources) {
15
+ let hasProps = true;
16
+
17
+ for (let field of requiredFields) {
18
+ if ((await resource[field]) == null || (await resource[field]) == "") {
19
+ hasProps = false;
20
+ continue;
21
+ }
22
+ }
23
+
24
+ if (hasProps) displays.push(resource);
25
+ }
26
+ }
27
+
28
+ const nextProcessor = listPostProcessors.shift();
29
+ if (nextProcessor) await nextProcessor(requiredFields.length ? displays : resources, listPostProcessors, div, context);
30
+ }
31
+
32
+ };
33
+ export { RequiredMixin };
34
+ //# sourceMappingURL=requiredMixin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["requiredMixin.ts"],"names":["RequiredMixin","name","use","attached","listPostProcessors","push","requiredResources","bind","resources","div","context","displays","requiredFields","Array","from","element","attributes","filter","attr","startsWith","map","replace","length","resource","hasProps","field","nextProcessor","shift"],"mappings":"AAAA,MAAMA,aAAa,GAAG;AACpBC,EAAAA,IAAI,EAAE,gBADc;AAEpBC,EAAAA,GAAG,EAAE,EAFe;;AAGpBC,EAAAA,QAAQ,GAAS;AACf,SAAKC,kBAAL,CAAwBC,IAAxB,CAA6B,KAAKC,iBAAL,CAAuBC,IAAvB,CAA4B,IAA5B,CAA7B;AACD,GALmB;;AAMpB,QAAMD,iBAAN,CAAwBE,SAAxB,EAA6CJ,kBAA7C,EAA6EK,GAA7E,EAA+FC,OAA/F,EAA+H;AAC7H,UAAMC,QAAe,GAAG,EAAxB;AACA,UAAMC,cAAc,GAAGC,KAAK,CAACC,IAAN,CAAY,KAAKC,OAAN,CAA0BC,UAArC,EAAiDC,MAAjD,CAAwDC,IAAI,IAAIA,IAAI,CAACjB,IAAL,CAAUkB,UAAV,CAAqB,WAArB,CAAhE,EACpBC,GADoB,CAChBF,IAAI,IAAIA,IAAI,CAAC,MAAD,CAAJ,CAAaG,OAAb,CAAqB,WAArB,EAAkC,EAAlC,CADQ,CAAvB;;AAGA,QAAIT,cAAc,CAACU,MAAnB,EAA2B;AACzB,WAAK,IAAIC,QAAT,IAAqBf,SAArB,EAAgC;AAC9B,YAAIgB,QAAQ,GAAG,IAAf;;AACA,aAAI,IAAIC,KAAR,IAAiBb,cAAjB,EAAiC;AAC/B,cAAI,OAAMW,QAAQ,CAACE,KAAD,CAAd,KAAyB,IAAzB,IAAiC,OAAMF,QAAQ,CAACE,KAAD,CAAd,KAAyB,EAA9D,EAAkE;AAChED,YAAAA,QAAQ,GAAG,KAAX;AACA;AACD;AACF;;AACD,YAAIA,QAAJ,EAAcb,QAAQ,CAACN,IAAT,CAAckB,QAAd;AACf;AACF;;AACD,UAAMG,aAAa,GAAGtB,kBAAkB,CAACuB,KAAnB,EAAtB;AACA,QAAID,aAAJ,EAAmB,MAAMA,aAAa,CAACd,cAAc,CAACU,MAAf,GAAwBX,QAAxB,GAAmCH,SAApC,EAA+CJ,kBAA/C,EAAmEK,GAAnE,EAAwEC,OAAxE,CAAnB;AACpB;;AAzBmB,CAAtB;AA4BA,SACEV,aADF","sourcesContent":["const RequiredMixin = {\n name: 'required-mixin',\n use: [],\n attached(): void {\n this.listPostProcessors.push(this.requiredResources.bind(this));\n },\n async requiredResources(resources: object[], listPostProcessors: Function[], div: HTMLElement, context: string): Promise<void> {\n const displays: any[] = [];\n const requiredFields = Array.from((this.element as Element).attributes).filter(attr => attr.name.startsWith('required-'))\n .map(attr => attr['name'].replace('required-', ''));\n\n if (requiredFields.length) {\n for (let resource of resources) {\n let hasProps = true;\n for(let field of requiredFields) {\n if (await resource[field] == null || await resource[field] == \"\") {\n hasProps = false;\n continue\n }\n }\n if (hasProps) displays.push(resource);\n }\n }\n const nextProcessor = listPostProcessors.shift();\n if (nextProcessor) await nextProcessor(requiredFields.length ? displays : resources, listPostProcessors, div, context);\n }\n}\n\nexport {\n RequiredMixin\n}\n"]}