@sankhyalabs/sankhyablocks 1.4.0-beta.1 → 1.4.0-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 (286) hide show
  1. package/dist/cjs/{SnkMessageBuilder-7717f1e4.js → SnkMessageBuilder-6c2f7bcd.js} +107 -131
  2. package/dist/cjs/_commonjsHelpers-537d719a.js +20 -0
  3. package/dist/cjs/configurableElementsStorage-93459c72.js +20 -0
  4. package/dist/cjs/constants-9056ca9e.js +84 -0
  5. package/dist/cjs/draggable.bundle-82a25c06.js +6886 -0
  6. package/dist/cjs/{filter-item-type.enum-e2e1bc5b.js → filter-item-type.enum-3daf58d3.js} +2 -0
  7. package/dist/cjs/form-config-fetcher-2de7c16a.js +6895 -0
  8. package/dist/cjs/{index-b0b676c5.js → index-20e8b68a.js} +165 -1473
  9. package/dist/cjs/loader.cjs.js +2 -18
  10. package/dist/cjs/sankhyablocks.cjs.js +4 -116
  11. package/dist/cjs/snk-application.cjs.entry.js +330 -7196
  12. package/dist/cjs/snk-config-modal.cjs.entry.js +62 -0
  13. package/dist/cjs/snk-config-options.cjs.entry.js +230 -0
  14. package/dist/cjs/snk-configurator_6.cjs.entry.js +1156 -0
  15. package/dist/cjs/snk-crud.cjs.entry.js +21 -13
  16. package/dist/cjs/snk-data-unit.cjs.entry.js +24 -32
  17. package/dist/cjs/snk-field-config_2.cjs.entry.js +135 -0
  18. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +5 -2
  19. package/dist/cjs/snk-filter-detail.cjs.entry.js +62 -5
  20. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +6 -3
  21. package/dist/cjs/snk-filter-number.cjs.entry.js +6 -3
  22. package/dist/cjs/snk-filter-period.cjs.entry.js +5 -2
  23. package/dist/cjs/snk-filter-personalized.cjs.entry.js +89 -0
  24. package/dist/cjs/snk-filter-search.cjs.entry.js +7 -13
  25. package/dist/cjs/snk-filter-text.cjs.entry.js +2 -2
  26. package/dist/cjs/snk-form-config.cjs.entry.js +957 -0
  27. package/dist/cjs/snk-form.cjs.entry.js +41 -28
  28. package/dist/cjs/snk-pesquisa.cjs.entry.js +5 -5
  29. package/dist/cjs/snk-tab-config.cjs.entry.js +321 -0
  30. package/dist/cjs/{taskbar-elements-283c737e.js → taskbar-elements-9a4b1e19.js} +10 -6
  31. package/dist/cjs/teste-pesquisa.cjs.entry.js +5 -5
  32. package/dist/collection/collection-manifest.json +29 -1
  33. package/dist/collection/components/snk-application/errorhandler/snk-error-handler.js +1 -1
  34. package/dist/collection/components/snk-application/snk-application.js +236 -37
  35. package/dist/collection/components/snk-configurator/snk-configurator.js +261 -0
  36. package/dist/collection/components/snk-configurator/subcomponents/configModalProvider/configurableElementsStorage.js +16 -0
  37. package/dist/collection/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.css +122 -0
  38. package/dist/collection/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.js +137 -0
  39. package/dist/collection/components/snk-crud/snk-crud.js +46 -17
  40. package/dist/collection/components/snk-data-unit/snk-data-unit.js +1 -28
  41. package/dist/collection/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.js +100 -0
  42. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +23 -0
  43. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +24 -1
  44. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +24 -1
  45. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +23 -0
  46. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +180 -0
  47. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +22 -38
  48. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +1 -1
  49. package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type.enum.js +2 -0
  50. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +80 -20
  51. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +65 -31
  52. package/dist/collection/components/snk-filter-bar/filter-list/snk-filter-list.js +85 -19
  53. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +222 -0
  54. package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +39 -4
  55. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +250 -141
  56. package/dist/collection/components/snk-form/snk-form.css +4 -0
  57. package/dist/collection/components/snk-form/snk-form.js +108 -30
  58. package/dist/collection/components/snk-form/subcomponents/snk-config-options/snk-config-options.css +9 -0
  59. package/dist/collection/components/snk-form/subcomponents/snk-config-options/snk-config-options.js +315 -0
  60. package/dist/collection/components/snk-form/subcomponents/snk-field-config/snk-field-config.css +164 -0
  61. package/dist/collection/components/snk-form/subcomponents/snk-field-config/snk-field-config.js +140 -0
  62. package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.css +185 -0
  63. package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +1062 -0
  64. package/dist/collection/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.css +272 -0
  65. package/dist/collection/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.js +476 -0
  66. package/dist/collection/components/snk-grid/snk-grid.js +94 -26
  67. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +9 -5
  68. package/dist/collection/components/snk-taskbar/snk-taskbar.js +35 -3
  69. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +3 -3
  70. package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +35 -0
  71. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +18 -10
  72. package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +106 -3
  73. package/dist/collection/lib/http/data-fetcher/fetchers/parameters-fecher.js +15 -15
  74. package/dist/collection/lib/http/data-fetcher/fetchers/resource-fetcher.js +9 -1
  75. package/dist/collection/lib/index.js +1 -0
  76. package/dist/collection/lib/message/SnkMessageBuilder.js +11 -2
  77. package/dist/collection/lib/message/resources/crud-utils.msg.js +4 -0
  78. package/dist/collection/lib/message/resources/snk-configurator.msg.js +11 -0
  79. package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +14 -2
  80. package/dist/collection/lib/message/resources/snk-form.msg.js +59 -2
  81. package/dist/collection/lib/message/resources/snk-taskbar.msg.js +1 -1
  82. package/dist/collection/lib/utils/CrudUtils.js +73 -0
  83. package/dist/collection/lib/utils/constants.js +72 -0
  84. package/dist/components/SnkMessageBuilder.js +108 -131
  85. package/dist/components/_commonjsHelpers.js +17 -0
  86. package/dist/components/constants.js +74 -0
  87. package/dist/components/filter-item-type.enum.js +2 -0
  88. package/dist/{sankhyablocks/snk-application.entry.js → components/form-config-fetcher.js} +88 -1347
  89. package/dist/components/index.d.ts +8 -0
  90. package/dist/components/index.js +8 -4
  91. package/dist/components/snk-application2.js +313 -7173
  92. package/dist/components/snk-config-modal.d.ts +11 -0
  93. package/dist/components/snk-config-modal.js +6 -0
  94. package/dist/components/snk-config-modal2.js +91 -0
  95. package/dist/components/snk-config-options.d.ts +11 -0
  96. package/dist/components/snk-config-options.js +6 -0
  97. package/dist/components/snk-config-options2.js +245 -0
  98. package/dist/components/snk-configurator.d.ts +11 -0
  99. package/dist/components/snk-configurator.js +6 -0
  100. package/dist/components/snk-configurator2.js +212 -0
  101. package/dist/components/snk-crud.js +76 -26
  102. package/dist/components/snk-data-unit.js +4 -13
  103. package/dist/components/snk-field-config.d.ts +11 -0
  104. package/dist/components/snk-field-config.js +6 -0
  105. package/dist/components/snk-field-config2.js +70 -0
  106. package/dist/components/snk-filter-bar2.js +354 -148
  107. package/dist/components/snk-filter-binary-select.js +5 -1
  108. package/dist/components/snk-filter-detail2.js +62 -5
  109. package/dist/components/snk-filter-item2.js +52 -33
  110. package/dist/components/snk-filter-list2.js +60 -22
  111. package/dist/components/snk-filter-modal.d.ts +11 -0
  112. package/dist/components/snk-filter-modal.js +6 -0
  113. package/dist/components/snk-filter-modal2.js +84 -0
  114. package/dist/components/snk-filter-multi-select.js +6 -2
  115. package/dist/components/snk-filter-number.js +6 -2
  116. package/dist/components/snk-filter-period.js +5 -1
  117. package/dist/components/snk-filter-personalized.d.ts +11 -0
  118. package/dist/components/snk-filter-personalized.js +108 -0
  119. package/dist/components/snk-filter-search.js +5 -12
  120. package/dist/components/snk-filter-text.js +1 -1
  121. package/dist/components/snk-form-config.d.ts +11 -0
  122. package/dist/components/snk-form-config.js +6 -0
  123. package/dist/components/snk-form-config2.js +996 -0
  124. package/dist/components/snk-form2.js +79 -29
  125. package/dist/components/snk-grid2.js +57 -32
  126. package/dist/components/snk-pesquisa2.js +1 -1
  127. package/dist/components/snk-tab-config.d.ts +11 -0
  128. package/dist/components/snk-tab-config.js +6 -0
  129. package/dist/components/snk-tab-config2.js +7220 -0
  130. package/dist/components/snk-taskbar2.js +28 -10
  131. package/dist/components/teste-pesquisa.js +1 -1
  132. package/dist/{sankhyablocks/SnkMessageBuilder-a7da466b.js → esm/SnkMessageBuilder-5792c260.js} +108 -131
  133. package/dist/esm/_commonjsHelpers-9943807e.js +17 -0
  134. package/dist/esm/configurableElementsStorage-cdc144b5.js +18 -0
  135. package/dist/esm/constants-c6039d3d.js +74 -0
  136. package/dist/esm/draggable.bundle-41d56f06.js +6884 -0
  137. package/dist/esm/{filter-item-type.enum-61fbf80a.js → filter-item-type.enum-a79b2fa8.js} +2 -0
  138. package/dist/esm/form-config-fetcher-96c6c2dc.js +6889 -0
  139. package/dist/{sankhyablocks/index-2b4d2d14.js → esm/index-e4121713.js} +165 -1466
  140. package/dist/esm/loader.js +2 -18
  141. package/dist/esm/sankhyablocks.js +4 -116
  142. package/dist/esm/snk-application.entry.js +308 -7174
  143. package/dist/esm/snk-config-modal.entry.js +58 -0
  144. package/dist/esm/snk-config-options.entry.js +226 -0
  145. package/dist/esm/snk-configurator_6.entry.js +1147 -0
  146. package/dist/esm/snk-crud.entry.js +20 -12
  147. package/dist/esm/snk-data-unit.entry.js +5 -13
  148. package/dist/esm/snk-field-config_2.entry.js +130 -0
  149. package/dist/esm/snk-filter-binary-select.entry.js +5 -2
  150. package/dist/esm/snk-filter-detail.entry.js +62 -5
  151. package/dist/esm/snk-filter-multi-select.entry.js +6 -3
  152. package/dist/esm/snk-filter-number.entry.js +6 -3
  153. package/dist/esm/snk-filter-period.entry.js +5 -2
  154. package/dist/esm/snk-filter-personalized.entry.js +85 -0
  155. package/dist/esm/snk-filter-search.entry.js +6 -12
  156. package/dist/esm/snk-filter-text.entry.js +2 -2
  157. package/dist/esm/snk-form-config.entry.js +953 -0
  158. package/dist/esm/snk-form.entry.js +40 -27
  159. package/dist/esm/snk-pesquisa.entry.js +2 -2
  160. package/dist/esm/snk-tab-config.entry.js +317 -0
  161. package/dist/{sankhyablocks/taskbar-elements-35d64ff9.js → esm/taskbar-elements-e2ed0536.js} +10 -6
  162. package/dist/esm/teste-pesquisa.entry.js +2 -2
  163. package/dist/sankhyablocks/index.esm.js +0 -1
  164. package/dist/sankhyablocks/p-029ae4e4.entry.js +1 -0
  165. package/dist/sankhyablocks/p-03f9c407.js +1 -0
  166. package/dist/sankhyablocks/p-112455b1.js +1 -0
  167. package/dist/sankhyablocks/p-12ad2a19.entry.js +1 -0
  168. package/dist/sankhyablocks/p-21c8929b.js +1 -0
  169. package/dist/sankhyablocks/p-2b891c4a.entry.js +1 -0
  170. package/dist/sankhyablocks/p-2dc76d79.entry.js +1 -0
  171. package/dist/sankhyablocks/p-361299e8.js +26 -0
  172. package/dist/sankhyablocks/p-3a276f3d.entry.js +1 -0
  173. package/dist/sankhyablocks/p-400cc777.entry.js +1 -0
  174. package/dist/sankhyablocks/p-44ce5b90.entry.js +1 -0
  175. package/dist/sankhyablocks/p-521c96f0.entry.js +1 -0
  176. package/dist/sankhyablocks/p-60eef7cd.entry.js +1 -0
  177. package/dist/sankhyablocks/p-6988f4a6.entry.js +1 -0
  178. package/dist/sankhyablocks/p-6a4162bd.entry.js +1 -0
  179. package/dist/sankhyablocks/p-776ff4d1.entry.js +1 -0
  180. package/dist/sankhyablocks/p-9ba3df4c.js +2 -0
  181. package/dist/sankhyablocks/p-9dc4426d.entry.js +1 -0
  182. package/dist/sankhyablocks/p-9dd2b8cb.js +1 -0
  183. package/dist/sankhyablocks/p-a17a4fca.entry.js +1 -0
  184. package/dist/sankhyablocks/p-a5b26df2.js +1 -0
  185. package/dist/sankhyablocks/p-b6d6b172.js +1 -0
  186. package/dist/sankhyablocks/p-cc4bef9f.entry.js +1 -0
  187. package/dist/sankhyablocks/p-d50651a3.js +1 -0
  188. package/dist/sankhyablocks/p-d690b6b5.entry.js +75 -0
  189. package/dist/sankhyablocks/p-d9fbb26f.js +1 -0
  190. package/dist/sankhyablocks/p-deb1f523.entry.js +1 -0
  191. package/dist/sankhyablocks/p-e871aa92.entry.js +1 -0
  192. package/dist/sankhyablocks/p-e9beab79.entry.js +1 -0
  193. package/dist/sankhyablocks/p-f37cdeb5.entry.js +1 -0
  194. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -129
  195. package/dist/types/components/snk-application/snk-application.d.ts +38 -16
  196. package/dist/types/components/snk-configurator/snk-configurator.d.ts +46 -0
  197. package/dist/types/components/snk-configurator/subcomponents/configModalProvider/configurableElementsStorage.d.ts +8 -0
  198. package/dist/types/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.d.ts +38 -0
  199. package/dist/types/components/snk-crud/snk-crud.d.ts +50 -0
  200. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +92 -0
  201. package/dist/types/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.d.ts +4 -0
  202. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +1 -0
  203. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.d.ts +2 -0
  204. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +2 -0
  205. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +1 -0
  206. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +24 -0
  207. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +4 -5
  208. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +1 -0
  209. package/dist/types/components/snk-filter-bar/filter-item/filter-item-type.enum.d.ts +3 -1
  210. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +7 -1
  211. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +40 -0
  212. package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +8 -3
  213. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +26 -0
  214. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +31 -17
  215. package/dist/types/components/snk-form/snk-form.d.ts +71 -0
  216. package/dist/types/components/snk-form/subcomponents/snk-config-options/snk-config-options.d.ts +51 -0
  217. package/dist/types/components/snk-form/subcomponents/snk-field-config/snk-field-config.d.ts +32 -0
  218. package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +139 -0
  219. package/dist/types/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.d.ts +97 -0
  220. package/dist/types/components/snk-grid/snk-grid.d.ts +59 -0
  221. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +6 -5
  222. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +11 -3
  223. package/dist/types/components.d.ts +424 -24
  224. package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +1 -0
  225. package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +21 -3
  226. package/dist/types/lib/http/data-fetcher/fetchers/parameters-fecher.d.ts +7 -7
  227. package/dist/types/lib/http/data-fetcher/fetchers/resource-fetcher.d.ts +1 -0
  228. package/dist/types/lib/index.d.ts +1 -0
  229. package/dist/types/lib/message/resources/crud-utils.msg.d.ts +2 -0
  230. package/dist/types/lib/message/resources/snk-configurator.msg.d.ts +2 -0
  231. package/dist/types/lib/message/resources/snk-form.msg.d.ts +5 -2
  232. package/dist/types/lib/utils/CrudUtils.d.ts +6 -0
  233. package/dist/types/lib/utils/constants.d.ts +76 -0
  234. package/dist/types/lib/utils/pesquisa.d.ts +2 -1
  235. package/package.json +4 -3
  236. package/react/components.d.ts +25 -0
  237. package/react/components.js +25 -0
  238. package/react/components.js.map +1 -1
  239. package/dist/cjs/app-globals-3a1e7e63.js +0 -5
  240. package/dist/cjs/css-shim-b8158822.js +0 -6
  241. package/dist/cjs/dom-36862b77.js +0 -75
  242. package/dist/cjs/index-02201bc9.js +0 -2397
  243. package/dist/cjs/shadow-css-346c0795.js +0 -389
  244. package/dist/cjs/snk-filter-bar.cjs.entry.js +0 -278
  245. package/dist/cjs/snk-filter-item.cjs.entry.js +0 -154
  246. package/dist/cjs/snk-filter-list.cjs.entry.js +0 -91
  247. package/dist/cjs/snk-grid.cjs.entry.js +0 -79
  248. package/dist/cjs/snk-taskbar.cjs.entry.js +0 -160
  249. package/dist/components/index2.js +0 -2384
  250. package/dist/esm/SnkMessageBuilder-a7da466b.js +0 -303
  251. package/dist/esm/app-globals-0f993ce5.js +0 -3
  252. package/dist/esm/css-shim-b3f2ee8d.js +0 -4
  253. package/dist/esm/dom-665d6011.js +0 -73
  254. package/dist/esm/index-2b4d2d14.js +0 -3262
  255. package/dist/esm/index-f1d3e4da.js +0 -2384
  256. package/dist/esm/shadow-css-b18e99d7.js +0 -387
  257. package/dist/esm/snk-filter-bar.entry.js +0 -274
  258. package/dist/esm/snk-filter-item.entry.js +0 -150
  259. package/dist/esm/snk-filter-list.entry.js +0 -87
  260. package/dist/esm/snk-grid.entry.js +0 -75
  261. package/dist/esm/snk-taskbar.entry.js +0 -156
  262. package/dist/esm/taskbar-elements-35d64ff9.js +0 -90
  263. package/dist/sankhyablocks/app-globals-0f993ce5.js +0 -3
  264. package/dist/sankhyablocks/css-shim-b3f2ee8d.js +0 -4
  265. package/dist/sankhyablocks/dom-665d6011.js +0 -73
  266. package/dist/sankhyablocks/filter-item-type.enum-61fbf80a.js +0 -12
  267. package/dist/sankhyablocks/index-f1d3e4da.js +0 -2384
  268. package/dist/sankhyablocks/shadow-css-b18e99d7.js +0 -387
  269. package/dist/sankhyablocks/snk-crud.entry.js +0 -66
  270. package/dist/sankhyablocks/snk-data-unit.entry.js +0 -276
  271. package/dist/sankhyablocks/snk-filter-bar.entry.js +0 -274
  272. package/dist/sankhyablocks/snk-filter-binary-select.entry.js +0 -43
  273. package/dist/sankhyablocks/snk-filter-detail.entry.js +0 -45
  274. package/dist/sankhyablocks/snk-filter-item.entry.js +0 -150
  275. package/dist/sankhyablocks/snk-filter-list.entry.js +0 -87
  276. package/dist/sankhyablocks/snk-filter-multi-select.entry.js +0 -19
  277. package/dist/sankhyablocks/snk-filter-number.entry.js +0 -20
  278. package/dist/sankhyablocks/snk-filter-period.entry.js +0 -33
  279. package/dist/sankhyablocks/snk-filter-search.entry.js +0 -40
  280. package/dist/sankhyablocks/snk-filter-text.entry.js +0 -18
  281. package/dist/sankhyablocks/snk-form.entry.js +0 -129
  282. package/dist/sankhyablocks/snk-grid.entry.js +0 -75
  283. package/dist/sankhyablocks/snk-pesquisa.entry.js +0 -311
  284. package/dist/sankhyablocks/snk-taskbar.entry.js +0 -156
  285. package/dist/sankhyablocks/taskbar-processor-aa6772c9.js +0 -45
  286. package/dist/sankhyablocks/teste-pesquisa.entry.js +0 -33
@@ -1,389 +0,0 @@
1
- 'use strict';
2
-
3
- /*
4
- Stencil Client Platform v2.18.1 | MIT Licensed | https://stenciljs.com
5
- */
6
- /**
7
- * @license
8
- * Copyright Google Inc. All Rights Reserved.
9
- *
10
- * Use of this source code is governed by an MIT-style license that can be
11
- * found in the LICENSE file at https://angular.io/license
12
- *
13
- * This file is a port of shadowCSS from webcomponents.js to TypeScript.
14
- * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
15
- * https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts
16
- */
17
- const safeSelector = (selector) => {
18
- const placeholders = [];
19
- let index = 0;
20
- // Replaces attribute selectors with placeholders.
21
- // The WS in [attr="va lue"] would otherwise be interpreted as a selector separator.
22
- selector = selector.replace(/(\[[^\]]*\])/g, (_, keep) => {
23
- const replaceBy = `__ph-${index}__`;
24
- placeholders.push(keep);
25
- index++;
26
- return replaceBy;
27
- });
28
- // Replaces the expression in `:nth-child(2n + 1)` with a placeholder.
29
- // WS and "+" would otherwise be interpreted as selector separators.
30
- const content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, (_, pseudo, exp) => {
31
- const replaceBy = `__ph-${index}__`;
32
- placeholders.push(exp);
33
- index++;
34
- return pseudo + replaceBy;
35
- });
36
- const ss = {
37
- content,
38
- placeholders,
39
- };
40
- return ss;
41
- };
42
- const restoreSafeSelector = (placeholders, content) => {
43
- return content.replace(/__ph-(\d+)__/g, (_, index) => placeholders[+index]);
44
- };
45
- const _polyfillHost = '-shadowcsshost';
46
- const _polyfillSlotted = '-shadowcssslotted';
47
- // note: :host-context pre-processed to -shadowcsshostcontext.
48
- const _polyfillHostContext = '-shadowcsscontext';
49
- const _parenSuffix = ')(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)';
50
- const _cssColonHostRe = new RegExp('(' + _polyfillHost + _parenSuffix, 'gim');
51
- const _cssColonHostContextRe = new RegExp('(' + _polyfillHostContext + _parenSuffix, 'gim');
52
- const _cssColonSlottedRe = new RegExp('(' + _polyfillSlotted + _parenSuffix, 'gim');
53
- const _polyfillHostNoCombinator = _polyfillHost + '-no-combinator';
54
- const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
55
- const _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
56
- const _selectorReSuffix = '([>\\s~+[.,{:][\\s\\S]*)?$';
57
- const _polyfillHostRe = /-shadowcsshost/gim;
58
- const _colonHostRe = /:host/gim;
59
- const _colonSlottedRe = /::slotted/gim;
60
- const _colonHostContextRe = /:host-context/gim;
61
- const _commentRe = /\/\*\s*[\s\S]*?\*\//g;
62
- const stripComments = (input) => {
63
- return input.replace(_commentRe, '');
64
- };
65
- const _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g;
66
- const extractCommentsWithHash = (input) => {
67
- return input.match(_commentWithHashRe) || [];
68
- };
69
- const _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
70
- const _curlyRe = /([{}])/g;
71
- const _selectorPartsRe = /(^.*?[^\\])??((:+)(.*)|$)/;
72
- const OPEN_CURLY = '{';
73
- const CLOSE_CURLY = '}';
74
- const BLOCK_PLACEHOLDER = '%BLOCK%';
75
- const processRules = (input, ruleCallback) => {
76
- const inputWithEscapedBlocks = escapeBlocks(input);
77
- let nextBlockIndex = 0;
78
- return inputWithEscapedBlocks.escapedString.replace(_ruleRe, (...m) => {
79
- const selector = m[2];
80
- let content = '';
81
- let suffix = m[4];
82
- let contentPrefix = '';
83
- if (suffix && suffix.startsWith('{' + BLOCK_PLACEHOLDER)) {
84
- content = inputWithEscapedBlocks.blocks[nextBlockIndex++];
85
- suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1);
86
- contentPrefix = '{';
87
- }
88
- const cssRule = {
89
- selector,
90
- content,
91
- };
92
- const rule = ruleCallback(cssRule);
93
- return `${m[1]}${rule.selector}${m[3]}${contentPrefix}${rule.content}${suffix}`;
94
- });
95
- };
96
- const escapeBlocks = (input) => {
97
- const inputParts = input.split(_curlyRe);
98
- const resultParts = [];
99
- const escapedBlocks = [];
100
- let bracketCount = 0;
101
- let currentBlockParts = [];
102
- for (let partIndex = 0; partIndex < inputParts.length; partIndex++) {
103
- const part = inputParts[partIndex];
104
- if (part === CLOSE_CURLY) {
105
- bracketCount--;
106
- }
107
- if (bracketCount > 0) {
108
- currentBlockParts.push(part);
109
- }
110
- else {
111
- if (currentBlockParts.length > 0) {
112
- escapedBlocks.push(currentBlockParts.join(''));
113
- resultParts.push(BLOCK_PLACEHOLDER);
114
- currentBlockParts = [];
115
- }
116
- resultParts.push(part);
117
- }
118
- if (part === OPEN_CURLY) {
119
- bracketCount++;
120
- }
121
- }
122
- if (currentBlockParts.length > 0) {
123
- escapedBlocks.push(currentBlockParts.join(''));
124
- resultParts.push(BLOCK_PLACEHOLDER);
125
- }
126
- const strEscapedBlocks = {
127
- escapedString: resultParts.join(''),
128
- blocks: escapedBlocks,
129
- };
130
- return strEscapedBlocks;
131
- };
132
- const insertPolyfillHostInCssText = (selector) => {
133
- selector = selector
134
- .replace(_colonHostContextRe, _polyfillHostContext)
135
- .replace(_colonHostRe, _polyfillHost)
136
- .replace(_colonSlottedRe, _polyfillSlotted);
137
- return selector;
138
- };
139
- const convertColonRule = (cssText, regExp, partReplacer) => {
140
- // m[1] = :host(-context), m[2] = contents of (), m[3] rest of rule
141
- return cssText.replace(regExp, (...m) => {
142
- if (m[2]) {
143
- const parts = m[2].split(',');
144
- const r = [];
145
- for (let i = 0; i < parts.length; i++) {
146
- const p = parts[i].trim();
147
- if (!p)
148
- break;
149
- r.push(partReplacer(_polyfillHostNoCombinator, p, m[3]));
150
- }
151
- return r.join(',');
152
- }
153
- else {
154
- return _polyfillHostNoCombinator + m[3];
155
- }
156
- });
157
- };
158
- const colonHostPartReplacer = (host, part, suffix) => {
159
- return host + part.replace(_polyfillHost, '') + suffix;
160
- };
161
- const convertColonHost = (cssText) => {
162
- return convertColonRule(cssText, _cssColonHostRe, colonHostPartReplacer);
163
- };
164
- const colonHostContextPartReplacer = (host, part, suffix) => {
165
- if (part.indexOf(_polyfillHost) > -1) {
166
- return colonHostPartReplacer(host, part, suffix);
167
- }
168
- else {
169
- return host + part + suffix + ', ' + part + ' ' + host + suffix;
170
- }
171
- };
172
- const convertColonSlotted = (cssText, slotScopeId) => {
173
- const slotClass = '.' + slotScopeId + ' > ';
174
- const selectors = [];
175
- cssText = cssText.replace(_cssColonSlottedRe, (...m) => {
176
- if (m[2]) {
177
- const compound = m[2].trim();
178
- const suffix = m[3];
179
- const slottedSelector = slotClass + compound + suffix;
180
- let prefixSelector = '';
181
- for (let i = m[4] - 1; i >= 0; i--) {
182
- const char = m[5][i];
183
- if (char === '}' || char === ',') {
184
- break;
185
- }
186
- prefixSelector = char + prefixSelector;
187
- }
188
- const orgSelector = prefixSelector + slottedSelector;
189
- const addedSelector = `${prefixSelector.trimRight()}${slottedSelector.trim()}`;
190
- if (orgSelector.trim() !== addedSelector.trim()) {
191
- const updatedSelector = `${addedSelector}, ${orgSelector}`;
192
- selectors.push({
193
- orgSelector,
194
- updatedSelector,
195
- });
196
- }
197
- return slottedSelector;
198
- }
199
- else {
200
- return _polyfillHostNoCombinator + m[3];
201
- }
202
- });
203
- return {
204
- selectors,
205
- cssText,
206
- };
207
- };
208
- const convertColonHostContext = (cssText) => {
209
- return convertColonRule(cssText, _cssColonHostContextRe, colonHostContextPartReplacer);
210
- };
211
- const convertShadowDOMSelectors = (cssText) => {
212
- return _shadowDOMSelectorsRe.reduce((result, pattern) => result.replace(pattern, ' '), cssText);
213
- };
214
- const makeScopeMatcher = (scopeSelector) => {
215
- const lre = /\[/g;
216
- const rre = /\]/g;
217
- scopeSelector = scopeSelector.replace(lre, '\\[').replace(rre, '\\]');
218
- return new RegExp('^(' + scopeSelector + ')' + _selectorReSuffix, 'm');
219
- };
220
- const selectorNeedsScoping = (selector, scopeSelector) => {
221
- const re = makeScopeMatcher(scopeSelector);
222
- return !re.test(selector);
223
- };
224
- const injectScopingSelector = (selector, scopingSelector) => {
225
- return selector.replace(_selectorPartsRe, (_, before = '', _colonGroup, colon = '', after = '') => {
226
- return before + scopingSelector + colon + after;
227
- });
228
- };
229
- const applySimpleSelectorScope = (selector, scopeSelector, hostSelector) => {
230
- // In Android browser, the lastIndex is not reset when the regex is used in String.replace()
231
- _polyfillHostRe.lastIndex = 0;
232
- if (_polyfillHostRe.test(selector)) {
233
- const replaceBy = `.${hostSelector}`;
234
- return selector
235
- .replace(_polyfillHostNoCombinatorRe, (_, selector) => injectScopingSelector(selector, replaceBy))
236
- .replace(_polyfillHostRe, replaceBy + ' ');
237
- }
238
- return scopeSelector + ' ' + selector;
239
- };
240
- const applyStrictSelectorScope = (selector, scopeSelector, hostSelector) => {
241
- const isRe = /\[is=([^\]]*)\]/g;
242
- scopeSelector = scopeSelector.replace(isRe, (_, ...parts) => parts[0]);
243
- const className = '.' + scopeSelector;
244
- const _scopeSelectorPart = (p) => {
245
- let scopedP = p.trim();
246
- if (!scopedP) {
247
- return '';
248
- }
249
- if (p.indexOf(_polyfillHostNoCombinator) > -1) {
250
- scopedP = applySimpleSelectorScope(p, scopeSelector, hostSelector);
251
- }
252
- else {
253
- // remove :host since it should be unnecessary
254
- const t = p.replace(_polyfillHostRe, '');
255
- if (t.length > 0) {
256
- scopedP = injectScopingSelector(t, className);
257
- }
258
- }
259
- return scopedP;
260
- };
261
- const safeContent = safeSelector(selector);
262
- selector = safeContent.content;
263
- let scopedSelector = '';
264
- let startIndex = 0;
265
- let res;
266
- const sep = /( |>|\+|~(?!=))\s*/g;
267
- // If a selector appears before :host it should not be shimmed as it
268
- // matches on ancestor elements and not on elements in the host's shadow
269
- // `:host-context(div)` is transformed to
270
- // `-shadowcsshost-no-combinatordiv, div -shadowcsshost-no-combinator`
271
- // the `div` is not part of the component in the 2nd selectors and should not be scoped.
272
- // Historically `component-tag:host` was matching the component so we also want to preserve
273
- // this behavior to avoid breaking legacy apps (it should not match).
274
- // The behavior should be:
275
- // - `tag:host` -> `tag[h]` (this is to avoid breaking legacy apps, should not match anything)
276
- // - `tag :host` -> `tag [h]` (`tag` is not scoped because it's considered part of a
277
- // `:host-context(tag)`)
278
- const hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;
279
- // Only scope parts after the first `-shadowcsshost-no-combinator` when it is present
280
- let shouldScope = !hasHost;
281
- while ((res = sep.exec(selector)) !== null) {
282
- const separator = res[1];
283
- const part = selector.slice(startIndex, res.index).trim();
284
- shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
285
- const scopedPart = shouldScope ? _scopeSelectorPart(part) : part;
286
- scopedSelector += `${scopedPart} ${separator} `;
287
- startIndex = sep.lastIndex;
288
- }
289
- const part = selector.substring(startIndex);
290
- shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
291
- scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;
292
- // replace the placeholders with their original values
293
- return restoreSafeSelector(safeContent.placeholders, scopedSelector);
294
- };
295
- const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector) => {
296
- return selector
297
- .split(',')
298
- .map((shallowPart) => {
299
- if (slotSelector && shallowPart.indexOf('.' + slotSelector) > -1) {
300
- return shallowPart.trim();
301
- }
302
- if (selectorNeedsScoping(shallowPart, scopeSelectorText)) {
303
- return applyStrictSelectorScope(shallowPart, scopeSelectorText, hostSelector).trim();
304
- }
305
- else {
306
- return shallowPart.trim();
307
- }
308
- })
309
- .join(', ');
310
- };
311
- const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
312
- return processRules(cssText, (rule) => {
313
- let selector = rule.selector;
314
- let content = rule.content;
315
- if (rule.selector[0] !== '@') {
316
- selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector);
317
- }
318
- else if (rule.selector.startsWith('@media') ||
319
- rule.selector.startsWith('@supports') ||
320
- rule.selector.startsWith('@page') ||
321
- rule.selector.startsWith('@document')) {
322
- content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector);
323
- }
324
- const cssRule = {
325
- selector: selector.replace(/\s{2,}/g, ' ').trim(),
326
- content,
327
- };
328
- return cssRule;
329
- });
330
- };
331
- const scopeCssText = (cssText, scopeId, hostScopeId, slotScopeId, commentOriginalSelector) => {
332
- cssText = insertPolyfillHostInCssText(cssText);
333
- cssText = convertColonHost(cssText);
334
- cssText = convertColonHostContext(cssText);
335
- const slotted = convertColonSlotted(cssText, slotScopeId);
336
- cssText = slotted.cssText;
337
- cssText = convertShadowDOMSelectors(cssText);
338
- if (scopeId) {
339
- cssText = scopeSelectors(cssText, scopeId, hostScopeId, slotScopeId);
340
- }
341
- cssText = cssText.replace(/-shadowcsshost-no-combinator/g, `.${hostScopeId}`);
342
- cssText = cssText.replace(/>\s*\*\s+([^{, ]+)/gm, ' $1 ');
343
- return {
344
- cssText: cssText.trim(),
345
- slottedSelectors: slotted.selectors,
346
- };
347
- };
348
- const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
349
- const hostScopeId = scopeId + '-h';
350
- const slotScopeId = scopeId + '-s';
351
- const commentsWithHash = extractCommentsWithHash(cssText);
352
- cssText = stripComments(cssText);
353
- const orgSelectors = [];
354
- if (commentOriginalSelector) {
355
- const processCommentedSelector = (rule) => {
356
- const placeholder = `/*!@___${orgSelectors.length}___*/`;
357
- const comment = `/*!@${rule.selector}*/`;
358
- orgSelectors.push({ placeholder, comment });
359
- rule.selector = placeholder + rule.selector;
360
- return rule;
361
- };
362
- cssText = processRules(cssText, (rule) => {
363
- if (rule.selector[0] !== '@') {
364
- return processCommentedSelector(rule);
365
- }
366
- else if (rule.selector.startsWith('@media') ||
367
- rule.selector.startsWith('@supports') ||
368
- rule.selector.startsWith('@page') ||
369
- rule.selector.startsWith('@document')) {
370
- rule.content = processRules(rule.content, processCommentedSelector);
371
- return rule;
372
- }
373
- return rule;
374
- });
375
- }
376
- const scoped = scopeCssText(cssText, scopeId, hostScopeId, slotScopeId);
377
- cssText = [scoped.cssText, ...commentsWithHash].join('\n');
378
- if (commentOriginalSelector) {
379
- orgSelectors.forEach(({ placeholder, comment }) => {
380
- cssText = cssText.replace(placeholder, comment);
381
- });
382
- }
383
- scoped.slottedSelectors.forEach((slottedSelector) => {
384
- cssText = cssText.replace(slottedSelector.orgSelector, slottedSelector.updatedSelector);
385
- });
386
- return cssText;
387
- };
388
-
389
- exports.scopeCss = scopeCss;
@@ -1,278 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-b0b676c5.js');
6
- const index$1 = require('./index-02201bc9.js');
7
- const filterItemType_enum = require('./filter-item-type.enum-e2e1bc5b.js');
8
-
9
- const snkFilterBarCss = ".sc-snk-filter-bar-h{display:grid;grid-template-columns:minmax(100px, 100%) 1fr 1fr}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;z-index:var(--more-visible, 1);background-color:var(--background--xlight, #fff);border-radius:var(--border--radius-medium, 12px);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.snk-filter-item__editor-header.sc-snk-filter-bar{flex-grow:1;font-weight:var(--text-weight--medium, 400);color:var(--color--title-primary, #2B3A54)}.snk-filter__popover-rule.sc-snk-filter-bar{border-style:solid;border-color:var(--color--disable-secondary, #F2F5F8);border-radius:1px;border-width:1px;width:100%}.editor__ez-check.sc-snk-filter-bar{--ez-check__label--padding-left:0}.snk-filter-item__editor-header-button.sc-snk-filter-bar{cursor:pointer;flex-grow:0}.snk-filter-bar__divider.sc-snk-filter-bar{margin-bottom:var(--space--small)}.snk-filter-bar__filter-list-items-container.sc-snk-filter-bar{overflow-y:auto;max-height:360px;margin-top:var(--space--small, 6px)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar{cursor:pointer;border-radius:var(--border--radius-small, 6px)}.snk-filter-bar__filter-list-item__label.sc-snk-filter-bar{color:var(--title--primary)}.snk-filter-bar__filter-list-item__label--secondary.sc-snk-filter-bar{color:var(--text--primary)}.snk-filter-bar__filter-list-item__icon.sc-snk-filter-bar{--ez-icon--color:var(--title--primary)}.snk-filter-bar__filter-list-item__icon--secondary.sc-snk-filter-bar{--ez-icon--color:var(--text--secondary)}.snk-filter-bar__filter-list-item.preselected.sc-snk-filter-bar{background-color:var(--background--medium)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:hover{background-color:var(--background--medium)}.snk-filter-bar__filter-list-items-container--empty.sc-snk-filter-bar{width:100%;height:100px;display:flex;justify-content:center;align-self:center;align-items:center}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar{position:relative}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar::after{display:flex;position:absolute;content:\"\";width:8px;height:8px;top:7px;left:17px;background-color:var(--icon--alert--color, #008561);border-radius:50%}";
10
-
11
- const PERSONALIZED_FILTER = "PERSONALIZED_FILTER";
12
- const DEFAULT_FILTER = "DEFAULT_FILTER";
13
- const CLEAR_ALL_FILTERS = "CLEAR_ALL_FILTERS";
14
- const SnkFilterBar = class {
15
- constructor(hostRef) {
16
- index.registerInstance(this, hostRef);
17
- this._updateSequence = [];
18
- this._calculateSortIndex = (item) => {
19
- let index = item.hardFixed ? 1000000 : 0;
20
- //campos Hard Fixed não variam a ordem
21
- if (!item.hardFixed) {
22
- index += item.fixed ? 100000 : 0;
23
- index += item.value == undefined ? 0 : 10000;
24
- index += this._updateSequence.lastIndexOf(item.id) + 1;
25
- }
26
- return index;
27
- };
28
- this._filtersComparator = (a, b) => {
29
- return this._calculateSortIndex(b) - this._calculateSortIndex(a);
30
- };
31
- }
32
- /**
33
- * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
34
- * através de um pequeno modulo na estrutura da aplicação:
35
- * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
36
- * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-bar.msg.ts"
37
- */
38
- getMessage(key, params) {
39
- return this._application.messagesBuilder.getMessage(key, params);
40
- }
41
- getFilter(_dataUnit) {
42
- var _a;
43
- const filters = [];
44
- (_a = this.filterConfig) === null || _a === void 0 ? void 0 : _a.filter(item => item.value).forEach(item => {
45
- const filter = this.buildDUFilter(item);
46
- if (filter) {
47
- filters.push(filter);
48
- }
49
- });
50
- return filters;
51
- }
52
- buildDUFilter(item) {
53
- const { id, value, type, props, visible } = item;
54
- if (value && visible) {
55
- if (type === filterItemType_enum.FilterItemType.BINARY_SELECT) {
56
- const options = props.options;
57
- const selectedOption = options.find(opt => opt.name === value);
58
- //FIXME: ajustar o backend para não exigir parametros
59
- return { name: id, expression: selectedOption.expression, params: [] };
60
- }
61
- if (type === filterItemType_enum.FilterItemType.MULTI_SELECT) {
62
- return { name: id, expression: props.expression, params: [{ name: id, dataType: index$1.DataType.TEXT, value }] };
63
- }
64
- if (type === filterItemType_enum.FilterItemType.PERIOD) {
65
- let { end, start } = value;
66
- if (typeof end === "string") {
67
- end = new Date(end);
68
- }
69
- if (typeof start === "string") {
70
- start = new Date(start);
71
- }
72
- const params = [];
73
- let expression;
74
- if (end && start) {
75
- expression = props.expression.fullfill;
76
- params.push({ name: `${id}.START`, dataType: index$1.DataType.DATE, value: index$1.toString(index$1.DataType.DATE, start) }, { name: `${id}.END`, dataType: index$1.DataType.DATE, value: index$1.toString(index$1.DataType.DATE, end) });
77
- }
78
- else {
79
- if (start) {
80
- expression = props.expression.onlystart;
81
- params.push({ name: id, dataType: index$1.DataType.DATE, value: index$1.toString(index$1.DataType.DATE, start) });
82
- }
83
- else {
84
- expression = props.expression.onlyend;
85
- params.push({ name: id, dataType: index$1.DataType.DATE, value: index$1.toString(index$1.DataType.DATE, end) });
86
- }
87
- }
88
- return { name: id, expression, params };
89
- }
90
- if (type === filterItemType_enum.FilterItemType.SEARCH) {
91
- const expression = props.expression;
92
- return { name: id, expression, params: [{ name: id, dataType: index$1.DataType.TEXT, value: index$1.toString(index$1.DataType.TEXT, value.value) }] };
93
- }
94
- if (type === filterItemType_enum.FilterItemType.TEXT) {
95
- const expression = props.expression;
96
- return { name: id, expression, params: [{ name: id, dataType: index$1.DataType.TEXT, value: index$1.toString(index$1.DataType.TEXT, value) }] };
97
- }
98
- if (type === filterItemType_enum.FilterItemType.NUMBER) {
99
- const expression = props.expression;
100
- return { name: id, expression, params: [{ name: id, dataType: index$1.DataType.NUMBER, value: index$1.toString(index$1.DataType.NUMBER, value) }] };
101
- }
102
- //No mapeamento dos outros tipos precisamos saber o tipo de dado.
103
- }
104
- return undefined;
105
- }
106
- componentWillLoad() {
107
- this._application = index$1.ApplicationContext.getContextValue("__SNK__APPLICATION__");
108
- if (this._application) {
109
- this._application.getFilterBarConfig(this.configName)
110
- .then((filters) => {
111
- this.filterConfig = filters;
112
- })
113
- .catch(reason => {
114
- throw new index$1.ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
115
- });
116
- }
117
- if (this.dataUnit == undefined) {
118
- let parent = this._element.parentElement;
119
- while (parent) {
120
- if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
121
- const snkDataUnit = parent;
122
- this.dataUnit = snkDataUnit.dataUnit;
123
- if (this.dataUnit) {
124
- this.dataUnit.addFilterProvider(this);
125
- }
126
- else {
127
- snkDataUnit.addEventListener("dataUnitReady", (evt) => {
128
- this.dataUnit = evt.detail;
129
- this.dataUnit.addFilterProvider(this);
130
- });
131
- }
132
- break;
133
- }
134
- }
135
- parent = parent.parentElement;
136
- }
137
- else {
138
- this.dataUnit.addFilterProvider(this);
139
- }
140
- }
141
- getFilterItems() {
142
- const pinnedItems = [];
143
- const unpinnedItems = [];
144
- this.filterConfig
145
- .filter(item => item.visible)
146
- .sort((a, b) => this._filtersComparator(a, b))
147
- .forEach((item, index$1) => {
148
- const filterItem = (index.h("snk-filter-item", { id: `filter-${item.id}`, config: this.normalizeItem(item), class: index$1 > 0 ? "ez-padding-left--medium" : "", getMessage: (key, props) => this.getMessage(key, props), key: item.id }));
149
- if (item.fixed || item.hardFixed) {
150
- pinnedItems.push(filterItem);
151
- }
152
- else {
153
- unpinnedItems.push(filterItem);
154
- }
155
- return filterItem;
156
- });
157
- const elements = [];
158
- elements.push(...pinnedItems);
159
- if (pinnedItems.length > 0 && unpinnedItems.length > 0) {
160
- elements.push(index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-filter-bar__divider" }));
161
- }
162
- elements.push(...unpinnedItems);
163
- return elements;
164
- }
165
- calculateUpdateSequence(item) {
166
- if (item) {
167
- this._updateSequence = this._updateSequence.filter(itemId => item.id !== itemId);
168
- this._updateSequence.push(item.id);
169
- }
170
- }
171
- filterChangeListener(evt) {
172
- this.updateFilter(evt.detail);
173
- }
174
- normalizeItem(item) {
175
- const normalized = Object.assign({}, item);
176
- const optionals = ["props", "value", "hardFixed", "fixed"];
177
- optionals.forEach(prop => {
178
- if (normalized[prop] == undefined) {
179
- delete normalized[prop];
180
- }
181
- });
182
- if (item.value === "") {
183
- delete item.value;
184
- }
185
- return normalized;
186
- }
187
- updateFilter(newItem, clear = false) {
188
- let needLoad = false;
189
- let updated = false;
190
- this.filterConfig = this.filterConfig.map(item => {
191
- if (clear) {
192
- if (item.value != undefined) {
193
- updated = true;
194
- needLoad = true;
195
- }
196
- return Object.assign(Object.assign({}, item), { value: undefined });
197
- }
198
- else {
199
- if (item.id === newItem.id) {
200
- const normalizedOne = this.normalizeItem(item);
201
- const normalizedTwo = this.normalizeItem(newItem);
202
- updated = index$1.ObjectUtils.objectToString(normalizedOne) != index$1.ObjectUtils.objectToString(normalizedTwo);
203
- needLoad = index$1.ObjectUtils.objectToString(normalizedOne.value) !== index$1.ObjectUtils.objectToString(normalizedTwo.value);
204
- return newItem;
205
- }
206
- }
207
- return item;
208
- });
209
- if (needLoad) {
210
- this.dataUnit.loadData();
211
- }
212
- if (updated) {
213
- this.calculateUpdateSequence(newItem);
214
- this._application.saveFilterBarConfig(this.filterConfig, this.configName);
215
- }
216
- return needLoad;
217
- }
218
- getAddListItems() {
219
- const hiddenItems = this.filterConfig
220
- .filter(item => !item.visible)
221
- .sort(this._filtersComparator);
222
- return hiddenItems.map(filter => {
223
- return { name: filter.id, label: filter.label, kind: "FILTER", iconName: null };
224
- }).concat([
225
- { name: PERSONALIZED_FILTER, label: this.getMessage("snkFilterBar.customFilter"), iconName: "tune", kind: "FOOTER" },
226
- { name: DEFAULT_FILTER, label: this.getMessage("snkFilterBar.defaultFilter"), iconName: "configuration", kind: "FOOTER" }
227
- ]);
228
- }
229
- getActiveClass() {
230
- const filterApplied = this.filterConfig.filter(item => item.value != undefined).length > 0;
231
- return filterApplied ? "sc-snk-filter-bar snk-filter-bar__filter-list-items-button--active" : "";
232
- }
233
- getAppliedListItems() {
234
- const appliedItems = this.filterConfig
235
- .filter(item => item.value != undefined)
236
- .sort(this._filtersComparator);
237
- return appliedItems.map(filter => {
238
- return { name: filter.id, label: filter.label, kind: "FILTER", iconName: null };
239
- }).concat([
240
- { name: CLEAR_ALL_FILTERS, label: this.getMessage("snkFilterBar.clearAllFilters"), iconName: "cleaning", kind: "FOOTER" }
241
- ]);
242
- }
243
- addFilterHandler(itemName) {
244
- const filterItem = this.filterConfig.find(currentFilter => currentFilter.id === itemName);
245
- if (filterItem) {
246
- this.updateFilter(Object.assign(Object.assign({}, filterItem), { visible: true }));
247
- window.requestAnimationFrame(() => {
248
- const itemElement = this._element.querySelector("#filter-" + itemName);
249
- if (itemElement) {
250
- itemElement.showUp();
251
- }
252
- });
253
- }
254
- }
255
- appliedFilterHandler(itemName) {
256
- if (itemName === CLEAR_ALL_FILTERS) {
257
- if (this.updateFilter(null, true)) {
258
- this._application.info(this.getMessage("snkFilterBar.successfullyCleaned"), { iconName: "check" });
259
- }
260
- }
261
- else {
262
- const itemElement = this._element.querySelector("#filter-" + itemName);
263
- if (itemElement) {
264
- itemElement.showUp(true);
265
- }
266
- }
267
- }
268
- render() {
269
- if (!this.dataUnit || !this.filterConfig || this.filterConfig.length === 0) {
270
- return undefined;
271
- }
272
- return (index.h(index.Host, null, index.h("ez-scroller", { direction: "horizontal" }, this.getFilterItems()), index.h("snk-filter-list", { items: this.getAppliedListItems(), getMessage: (key, params) => this.getMessage(key, params), emptyText: this.getMessage("snkFilterBar.emptyAppliedFiltersList"), findFilterText: this.getMessage("snkFilterBar.findFilter"), iconName: "filter", class: "ez-padding-left--medium", buttonClass: this.getActiveClass(), onSnkItemSelected: evt => this.appliedFilterHandler(evt.detail) }), index.h("snk-filter-list", { items: this.getAddListItems(), label: this.getMessage("snkFilterBar.addFilter"), getMessage: (key, params) => this.getMessage(key, params), emptyText: this.getMessage("snkFilterBar.emptyFiltersList"), findFilterText: this.getMessage("snkFilterBar.findField"), class: "ez-padding-left--medium", onSnkItemSelected: evt => this.addFilterHandler(evt.detail) }, index.h("ez-icon", { slot: "leftIcon", class: "ez-padding-right--small", iconName: "plus" }))));
273
- }
274
- get _element() { return index.getElement(this); }
275
- };
276
- SnkFilterBar.style = snkFilterBarCss;
277
-
278
- exports.snk_filter_bar = SnkFilterBar;