@sankhyalabs/sankhyablocks 1.3.34 → 1.4.0-beta.10

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 (285) hide show
  1. package/dist/cjs/SnkMessageBuilder-6c2f7bcd.js +302 -0
  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-3daf58d3.js +16 -0
  7. package/dist/cjs/form-config-fetcher-2de7c16a.js +6895 -0
  8. package/dist/cjs/{index-1133bc2a.js → index-20e8b68a.js} +964 -209
  9. package/dist/cjs/loader.cjs.js +3 -3
  10. package/dist/cjs/sankhyablocks.cjs.js +3 -3
  11. package/dist/cjs/snk-application.cjs.entry.js +680 -6994
  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 +78 -0
  16. package/dist/cjs/snk-data-unit.cjs.entry.js +272 -0
  17. package/dist/cjs/snk-field-config_2.cjs.entry.js +135 -0
  18. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +50 -0
  19. package/dist/cjs/snk-filter-detail.cjs.entry.js +106 -0
  20. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +26 -0
  21. package/dist/cjs/snk-filter-number.cjs.entry.js +27 -0
  22. package/dist/cjs/snk-filter-period.cjs.entry.js +40 -0
  23. package/dist/cjs/snk-filter-personalized.cjs.entry.js +89 -0
  24. package/dist/cjs/snk-filter-search.cjs.entry.js +38 -0
  25. package/dist/cjs/snk-filter-text.cjs.entry.js +22 -0
  26. package/dist/cjs/snk-form-config.cjs.entry.js +957 -0
  27. package/dist/cjs/snk-form.cjs.entry.js +146 -0
  28. package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
  29. package/dist/cjs/snk-tab-config.cjs.entry.js +321 -0
  30. package/dist/cjs/taskbar-elements-9a4b1e19.js +97 -0
  31. package/dist/cjs/taskbar-processor-6bd0d35c.js +47 -0
  32. package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
  33. package/dist/collection/collection-manifest.json +45 -2
  34. package/dist/collection/components/snk-application/errorhandler/snk-error-handler.js +9 -2
  35. package/dist/collection/components/snk-application/snk-application.js +1346 -642
  36. package/dist/collection/components/snk-configurator/snk-configurator.js +261 -0
  37. package/dist/collection/components/snk-configurator/subcomponents/configModalProvider/configurableElementsStorage.js +16 -0
  38. package/dist/collection/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.css +122 -0
  39. package/dist/collection/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.js +137 -0
  40. package/dist/collection/components/snk-crud/snk-crud.css +6 -0
  41. package/dist/collection/components/snk-crud/snk-crud.js +232 -0
  42. package/dist/collection/components/snk-data-unit/snk-data-unit.css +6 -0
  43. package/dist/collection/components/snk-data-unit/snk-data-unit.js +517 -0
  44. package/dist/collection/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.js +100 -0
  45. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +111 -0
  46. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +87 -0
  47. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +88 -0
  48. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +101 -0
  49. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +180 -0
  50. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +102 -0
  51. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +63 -0
  52. package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type.enum.js +12 -0
  53. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +178 -0
  54. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +289 -0
  55. package/dist/collection/components/snk-filter-bar/filter-list/snk-filter-list.js +299 -0
  56. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +222 -0
  57. package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +149 -0
  58. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +462 -0
  59. package/dist/collection/components/snk-form/snk-form.css +38 -0
  60. package/dist/collection/components/snk-form/snk-form.js +336 -0
  61. package/dist/collection/components/snk-form/subcomponents/snk-config-options/snk-config-options.css +9 -0
  62. package/dist/collection/components/snk-form/subcomponents/snk-config-options/snk-config-options.js +315 -0
  63. package/dist/collection/components/snk-form/subcomponents/snk-field-config/snk-field-config.css +164 -0
  64. package/dist/collection/components/snk-form/subcomponents/snk-field-config/snk-field-config.js +140 -0
  65. package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.css +185 -0
  66. package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +1062 -0
  67. package/dist/collection/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.css +272 -0
  68. package/dist/collection/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.js +476 -0
  69. package/dist/collection/components/snk-grid/snk-grid.css +18 -0
  70. package/dist/collection/components/snk-grid/snk-grid.js +273 -0
  71. package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +80 -79
  72. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +90 -0
  73. package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +43 -0
  74. package/dist/collection/components/snk-taskbar/snk-taskbar.css +3 -0
  75. package/dist/collection/components/snk-taskbar/snk-taskbar.js +339 -0
  76. package/dist/collection/components/teste-pesquisa/teste-pesquisa.js +12 -9
  77. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +39 -14
  78. package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +87 -21
  79. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +62 -0
  80. package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +106 -3
  81. package/dist/collection/lib/http/data-fetcher/fetchers/grid-config-fetcher.js +4 -3
  82. package/dist/collection/lib/http/data-fetcher/fetchers/parameters-fecher.js +15 -15
  83. package/dist/collection/lib/http/data-fetcher/fetchers/resource-fetcher.js +9 -1
  84. package/dist/collection/lib/http/data-fetcher/fetchers/totals-fetcher.js +47 -0
  85. package/dist/collection/lib/index.js +2 -0
  86. package/dist/collection/lib/message/SnkMessageBuilder.js +130 -0
  87. package/dist/collection/lib/message/resources/crud-utils.msg.js +4 -0
  88. package/dist/collection/lib/message/resources/snk-configurator.msg.js +11 -0
  89. package/dist/collection/lib/message/resources/snk-data-unit.msg.js +23 -0
  90. package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +30 -0
  91. package/dist/collection/lib/message/resources/snk-form.msg.js +67 -0
  92. package/dist/collection/lib/message/resources/snk-taskbar.msg.js +17 -0
  93. package/dist/collection/lib/utils/CrudUtils.js +73 -0
  94. package/dist/collection/lib/utils/constants.js +72 -0
  95. package/dist/components/SnkMessageBuilder.js +280 -0
  96. package/dist/components/_commonjsHelpers.js +17 -0
  97. package/dist/components/constants.js +74 -0
  98. package/dist/components/filter-item-type.enum.js +14 -0
  99. package/dist/components/form-config-fetcher.js +6889 -0
  100. package/dist/components/index.d.ts +26 -5
  101. package/dist/components/index.js +26 -0
  102. package/dist/components/snk-application2.js +681 -6980
  103. package/dist/components/snk-config-modal.d.ts +11 -0
  104. package/dist/components/snk-config-modal.js +6 -0
  105. package/dist/components/snk-config-modal2.js +91 -0
  106. package/dist/components/snk-config-options.d.ts +11 -0
  107. package/dist/components/snk-config-options.js +6 -0
  108. package/dist/components/snk-config-options2.js +245 -0
  109. package/dist/components/snk-configurator.d.ts +11 -0
  110. package/dist/components/snk-configurator.js +6 -0
  111. package/dist/components/snk-configurator2.js +212 -0
  112. package/dist/components/snk-crud.d.ts +11 -0
  113. package/dist/components/snk-crud.js +183 -0
  114. package/dist/components/snk-data-unit.d.ts +11 -0
  115. package/dist/components/snk-data-unit.js +294 -0
  116. package/dist/components/snk-field-config.d.ts +11 -0
  117. package/dist/components/snk-field-config.js +6 -0
  118. package/dist/components/snk-field-config2.js +70 -0
  119. package/dist/components/snk-filter-bar.d.ts +11 -0
  120. package/dist/components/snk-filter-bar.js +6 -0
  121. package/dist/components/snk-filter-bar2.js +516 -0
  122. package/dist/components/snk-filter-binary-select.d.ts +11 -0
  123. package/dist/components/snk-filter-binary-select.js +67 -0
  124. package/dist/components/snk-filter-detail.d.ts +11 -0
  125. package/dist/components/snk-filter-detail.js +6 -0
  126. package/dist/components/snk-filter-detail2.js +120 -0
  127. package/dist/components/snk-filter-item.d.ts +11 -0
  128. package/dist/components/snk-filter-item.js +6 -0
  129. package/dist/components/snk-filter-item2.js +194 -0
  130. package/dist/components/snk-filter-list.d.ts +11 -0
  131. package/dist/components/snk-filter-list.js +6 -0
  132. package/dist/components/snk-filter-list2.js +149 -0
  133. package/dist/components/snk-filter-modal.d.ts +11 -0
  134. package/dist/components/snk-filter-modal.js +6 -0
  135. package/dist/components/snk-filter-modal2.js +84 -0
  136. package/dist/components/snk-filter-multi-select.d.ts +11 -0
  137. package/dist/components/snk-filter-multi-select.js +43 -0
  138. package/dist/components/snk-filter-number.d.ts +11 -0
  139. package/dist/components/snk-filter-number.js +44 -0
  140. package/dist/components/snk-filter-period.d.ts +11 -0
  141. package/dist/components/snk-filter-period.js +57 -0
  142. package/dist/components/snk-filter-personalized.d.ts +11 -0
  143. package/dist/components/snk-filter-personalized.js +108 -0
  144. package/dist/components/snk-filter-search.d.ts +11 -0
  145. package/dist/components/snk-filter-search.js +55 -0
  146. package/dist/components/snk-filter-text.d.ts +11 -0
  147. package/dist/components/snk-filter-text.js +38 -0
  148. package/dist/components/snk-form-config.d.ts +11 -0
  149. package/dist/components/snk-form-config.js +6 -0
  150. package/dist/components/snk-form-config2.js +996 -0
  151. package/dist/components/snk-form.d.ts +11 -0
  152. package/dist/components/snk-form.js +6 -0
  153. package/dist/components/snk-form2.js +209 -0
  154. package/dist/components/snk-grid.d.ts +11 -0
  155. package/dist/components/snk-grid.js +6 -0
  156. package/dist/components/snk-grid2.js +152 -0
  157. package/dist/components/snk-tab-config.d.ts +11 -0
  158. package/dist/components/snk-tab-config.js +6 -0
  159. package/dist/components/snk-tab-config2.js +7220 -0
  160. package/dist/components/snk-taskbar.d.ts +11 -0
  161. package/dist/components/snk-taskbar.js +6 -0
  162. package/dist/components/snk-taskbar2.js +282 -0
  163. package/dist/components/taskbar-processor.js +45 -0
  164. package/dist/esm/SnkMessageBuilder-5792c260.js +280 -0
  165. package/dist/esm/_commonjsHelpers-9943807e.js +17 -0
  166. package/dist/esm/configurableElementsStorage-cdc144b5.js +18 -0
  167. package/dist/esm/constants-c6039d3d.js +74 -0
  168. package/dist/esm/draggable.bundle-41d56f06.js +6884 -0
  169. package/dist/esm/filter-item-type.enum-a79b2fa8.js +14 -0
  170. package/dist/esm/form-config-fetcher-96c6c2dc.js +6889 -0
  171. package/dist/esm/{index-ffda6382.js → index-e4121713.js} +963 -210
  172. package/dist/esm/loader.js +3 -3
  173. package/dist/esm/polyfills/css-shim.js +1 -1
  174. package/dist/esm/sankhyablocks.js +3 -3
  175. package/dist/esm/snk-application.entry.js +667 -6981
  176. package/dist/esm/snk-config-modal.entry.js +58 -0
  177. package/dist/esm/snk-config-options.entry.js +226 -0
  178. package/dist/esm/snk-configurator_6.entry.js +1147 -0
  179. package/dist/esm/snk-crud.entry.js +74 -0
  180. package/dist/esm/snk-data-unit.entry.js +268 -0
  181. package/dist/esm/snk-field-config_2.entry.js +130 -0
  182. package/dist/esm/snk-filter-binary-select.entry.js +46 -0
  183. package/dist/esm/snk-filter-detail.entry.js +102 -0
  184. package/dist/esm/snk-filter-multi-select.entry.js +22 -0
  185. package/dist/esm/snk-filter-number.entry.js +23 -0
  186. package/dist/esm/snk-filter-period.entry.js +36 -0
  187. package/dist/esm/snk-filter-personalized.entry.js +85 -0
  188. package/dist/esm/snk-filter-search.entry.js +34 -0
  189. package/dist/esm/snk-filter-text.entry.js +18 -0
  190. package/dist/esm/snk-form-config.entry.js +953 -0
  191. package/dist/esm/snk-form.entry.js +142 -0
  192. package/dist/esm/snk-pesquisa.entry.js +1 -1
  193. package/dist/esm/snk-tab-config.entry.js +317 -0
  194. package/dist/esm/taskbar-elements-e2ed0536.js +94 -0
  195. package/dist/esm/taskbar-processor-aa6772c9.js +45 -0
  196. package/dist/esm/teste-pesquisa.entry.js +1 -1
  197. package/dist/sankhyablocks/p-029ae4e4.entry.js +1 -0
  198. package/dist/sankhyablocks/p-03f9c407.js +1 -0
  199. package/dist/sankhyablocks/p-112455b1.js +1 -0
  200. package/dist/sankhyablocks/p-12ad2a19.entry.js +1 -0
  201. package/dist/sankhyablocks/p-1feabfc7.entry.js +1 -0
  202. package/dist/sankhyablocks/p-21c8929b.js +1 -0
  203. package/dist/sankhyablocks/p-2284c850.entry.js +1 -0
  204. package/dist/sankhyablocks/p-2b891c4a.entry.js +1 -0
  205. package/dist/sankhyablocks/p-2dc76d79.entry.js +1 -0
  206. package/dist/sankhyablocks/p-361299e8.js +26 -0
  207. package/dist/sankhyablocks/p-3a276f3d.entry.js +1 -0
  208. package/dist/sankhyablocks/p-400cc777.entry.js +1 -0
  209. package/dist/sankhyablocks/{p-2a7b4cb3.entry.js → p-44ce5b90.entry.js} +1 -1
  210. package/dist/sankhyablocks/p-521c96f0.entry.js +1 -0
  211. package/dist/sankhyablocks/{p-9520d78a.entry.js → p-6988f4a6.entry.js} +1 -1
  212. package/dist/sankhyablocks/p-776ff4d1.entry.js +1 -0
  213. package/dist/sankhyablocks/p-7b4a4a50.entry.js +1 -0
  214. package/dist/sankhyablocks/p-9ba3df4c.js +2 -0
  215. package/dist/sankhyablocks/p-9dc4426d.entry.js +1 -0
  216. package/dist/sankhyablocks/p-9dd2b8cb.js +1 -0
  217. package/dist/sankhyablocks/p-a17a4fca.entry.js +1 -0
  218. package/dist/sankhyablocks/p-a5b26df2.js +1 -0
  219. package/dist/sankhyablocks/p-b6d6b172.js +1 -0
  220. package/dist/sankhyablocks/p-cc4bef9f.entry.js +1 -0
  221. package/dist/sankhyablocks/p-d50651a3.js +1 -0
  222. package/dist/sankhyablocks/p-d690b6b5.entry.js +75 -0
  223. package/dist/sankhyablocks/p-d9fbb26f.js +1 -0
  224. package/dist/sankhyablocks/p-deb1f523.entry.js +1 -0
  225. package/dist/sankhyablocks/p-e871aa92.entry.js +1 -0
  226. package/dist/sankhyablocks/p-e9beab79.entry.js +1 -0
  227. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  228. package/dist/types/components/snk-application/errorhandler/snk-error-handler.d.ts +1 -0
  229. package/dist/types/components/snk-application/snk-application.d.ts +178 -26
  230. package/dist/types/components/snk-configurator/snk-configurator.d.ts +46 -0
  231. package/dist/types/components/snk-configurator/subcomponents/configModalProvider/configurableElementsStorage.d.ts +8 -0
  232. package/dist/types/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.d.ts +38 -0
  233. package/dist/types/components/snk-crud/snk-crud.d.ts +50 -0
  234. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +92 -0
  235. package/dist/types/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.d.ts +4 -0
  236. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +13 -0
  237. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.d.ts +9 -0
  238. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +9 -0
  239. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +15 -0
  240. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +24 -0
  241. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +11 -0
  242. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +8 -0
  243. package/dist/types/components/snk-filter-bar/filter-item/filter-item-type.enum.d.ts +11 -0
  244. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +20 -0
  245. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +40 -0
  246. package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +45 -0
  247. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +26 -0
  248. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +65 -0
  249. package/dist/types/components/snk-form/snk-form.d.ts +71 -0
  250. package/dist/types/components/snk-form/subcomponents/snk-config-options/snk-config-options.d.ts +51 -0
  251. package/dist/types/components/snk-form/subcomponents/snk-field-config/snk-field-config.d.ts +32 -0
  252. package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +139 -0
  253. package/dist/types/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.d.ts +97 -0
  254. package/dist/types/components/snk-grid/snk-grid.d.ts +59 -0
  255. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +30 -0
  256. package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +12 -0
  257. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +92 -0
  258. package/dist/types/components.d.ts +1100 -12
  259. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +7 -6
  260. package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +3 -0
  261. package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +6 -0
  262. package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +21 -3
  263. package/dist/types/lib/http/data-fetcher/fetchers/grid-config-fetcher.d.ts +1 -1
  264. package/dist/types/lib/http/data-fetcher/fetchers/parameters-fecher.d.ts +7 -7
  265. package/dist/types/lib/http/data-fetcher/fetchers/resource-fetcher.d.ts +1 -0
  266. package/dist/types/lib/http/data-fetcher/fetchers/totals-fetcher.d.ts +8 -0
  267. package/dist/types/lib/index.d.ts +2 -0
  268. package/dist/types/lib/message/SnkMessageBuilder.d.ts +42 -0
  269. package/dist/types/lib/message/resources/crud-utils.msg.d.ts +2 -0
  270. package/dist/types/lib/message/resources/snk-configurator.msg.d.ts +2 -0
  271. package/dist/types/lib/message/resources/snk-data-unit.msg.d.ts +2 -0
  272. package/dist/types/lib/message/resources/snk-filter-bar.msg.d.ts +2 -0
  273. package/dist/types/lib/message/resources/snk-form.msg.d.ts +5 -0
  274. package/dist/types/lib/message/resources/snk-taskbar.msg.d.ts +2 -0
  275. package/dist/types/lib/utils/CrudUtils.d.ts +6 -0
  276. package/dist/types/lib/utils/constants.d.ts +76 -0
  277. package/dist/types/lib/utils/pesquisa.d.ts +2 -1
  278. package/dist/types/stencil-public-runtime.d.ts +15 -4
  279. package/loader/package.json +1 -0
  280. package/package.json +6 -5
  281. package/react/components.d.ts +23 -0
  282. package/react/components.js +23 -0
  283. package/react/components.js.map +1 -1
  284. package/dist/sankhyablocks/p-98e8490d.entry.js +0 -69
  285. package/dist/sankhyablocks/p-edcb9d8e.js +0 -2
@@ -0,0 +1,78 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-20e8b68a.js');
6
+ const core = require('@sankhyalabs/core');
7
+ const constants = require('./constants-9056ca9e.js');
8
+ const taskbarElements = require('./taskbar-elements-9a4b1e19.js');
9
+
10
+ const snkCrudCss = ".sc-snk-crud-h{display:flex;flex-direction:column;height:100%;width:100%}";
11
+
12
+ const GRID_MODE = constants.VIEW_MODE.grid;
13
+ const FORM_MODE = constants.VIEW_MODE.form;
14
+ const SnkCrud = class {
15
+ constructor(hostRef) {
16
+ index.registerInstance(this, hostRef);
17
+ this.actionClick = index.createEvent(this, "actionClick", 7);
18
+ }
19
+ /**
20
+ * Usado para alternar a visão entre GRID e FORM externamente.
21
+ */
22
+ async goToView(mode) {
23
+ this.executeAction(mode);
24
+ }
25
+ async gridToForm(keepFormMode = false) {
26
+ this._backToGrid = !keepFormMode && await this._viewStack.getSelectedIndex() === GRID_MODE.index;
27
+ this._viewStack.show(FORM_MODE.index);
28
+ }
29
+ async executeAction(act) {
30
+ if (act === taskbarElements.TaskbarElement.GRID_MODE) {
31
+ this._viewStack.show(GRID_MODE.index);
32
+ }
33
+ else if (act === taskbarElements.TaskbarElement.FORM_MODE || act === taskbarElements.TaskbarElement.UPDATE) {
34
+ this.gridToForm(act !== taskbarElements.TaskbarElement.UPDATE);
35
+ }
36
+ }
37
+ insertionModeHandler() {
38
+ this.gridToForm();
39
+ }
40
+ cancelHandler() {
41
+ if (this._backToGrid) {
42
+ this._viewStack.show(GRID_MODE.index);
43
+ }
44
+ }
45
+ componentWillLoad() {
46
+ let parent = this._element.parentElement;
47
+ while (parent) {
48
+ if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
49
+ this._snkDataUnit = parent;
50
+ this._snkDataUnit.addEventListener("insertionMode", () => this.insertionModeHandler());
51
+ this._snkDataUnit.addEventListener("cancelEdition", () => this.cancelHandler());
52
+ this._dataUnit = this._snkDataUnit.dataUnit;
53
+ this._dataState = this._snkDataUnit.dataState;
54
+ if (!this._dataUnit) {
55
+ this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
56
+ this._dataUnit = evt.detail;
57
+ });
58
+ }
59
+ this._snkDataUnit.addEventListener("dataStateChange", (evt) => {
60
+ this._dataState = evt.detail;
61
+ });
62
+ break;
63
+ }
64
+ parent = parent.parentElement;
65
+ }
66
+ if (!this.configName) {
67
+ const application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
68
+ this.configName = application.configName;
69
+ }
70
+ }
71
+ render() {
72
+ return (index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-configurator-parent": "snkConfigurator" }, index.h("stack-item", null, index.h("snk-grid", { configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), actionsList: this.actionsList, statusResolver: this.statusResolver }, index.h("slot", { name: "SnkGridHeader" }), index.h("slot", { name: "SnkGridFooter" }), index.h("slot", { name: "SnkGridTaskBar" }))), index.h("stack-item", null, index.h("snk-form", { configName: this.configName, actionsList: this.actionsList, onExit: () => this._viewStack.show(GRID_MODE.index), recordsValidator: this.recordsValidator, taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail) }, index.h("slot", { name: "SnkFormTaskBar" })))));
73
+ }
74
+ get _element() { return index.getElement(this); }
75
+ };
76
+ SnkCrud.style = snkCrudCss;
77
+
78
+ exports.snk_crud = SnkCrud;
@@ -0,0 +1,272 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-20e8b68a.js');
6
+ const core = require('@sankhyalabs/core');
7
+ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
8
+ const SnkMessageBuilder = require('./SnkMessageBuilder-6c2f7bcd.js');
9
+
10
+ const snkDataUnitCss = ".sc-snk-data-unit-h{display:flex;flex-direction:column;height:100%}";
11
+
12
+ const SnkDataUnit = class {
13
+ constructor(hostRef) {
14
+ index.registerInstance(this, hostRef);
15
+ this.dataStateChange = index.createEvent(this, "dataStateChange", 7);
16
+ this.dataUnitReady = index.createEvent(this, "dataUnitReady", 7);
17
+ this.insertionMode = index.createEvent(this, "insertionMode", 7);
18
+ this.cancelEdition = index.createEvent(this, "cancelEdition", 7);
19
+ this._onDataUnitResolve = [];
20
+ /**
21
+ * Determina quantas linhas são retornadas por página
22
+ */
23
+ this.pageSize = 150;
24
+ this._dataUnitObserver = (action) => {
25
+ const duState = {
26
+ insertionMode: false,
27
+ hasNext: this.dataUnit.hasNext(),
28
+ hasPrevious: this.dataUnit.hasPrevious(),
29
+ copyMode: false,
30
+ isDirty: this.dataUnit.isDirty(),
31
+ hasDirtyRecords: this.dataUnit.hasDirtyRecords(),
32
+ selectedRecords: this.dataUnit.getSelectedRecords()
33
+ };
34
+ this.dataUnit.records.forEach(r => {
35
+ if (r.__record__id__.startsWith('NEW_')) {
36
+ duState.insertionMode = true;
37
+ duState.copyMode || (duState.copyMode = r['__record__source__id__'] != undefined);
38
+ }
39
+ });
40
+ this.dataState = duState;
41
+ if (action.type === core.Action.DATA_SAVED) {
42
+ const msg = this.getMessage("snkDataUnit.saveInfo", action.payload.records[0]);
43
+ if (msg != undefined) {
44
+ this.showSuccessMessage(msg);
45
+ }
46
+ }
47
+ if (action.type === core.Action.RECORDS_ADDED || action.type === core.Action.RECORDS_COPIED) {
48
+ this.insertionMode.emit();
49
+ }
50
+ if (action.type === core.Action.EDITION_CANCELED) {
51
+ this.cancelEdition.emit();
52
+ const cancelFinishMsg = this.getMessage("snkDataUnit.cancelInfo");
53
+ if (cancelFinishMsg != undefined) {
54
+ this.showSuccessMessage(cancelFinishMsg);
55
+ }
56
+ }
57
+ if (action.type === core.Action.RECORDS_REMOVED) {
58
+ const removeFinishMsg = this.getMessage("snkDataUnit.removeInfo", action.payload.cachedRecords[0]);
59
+ if (removeFinishMsg != undefined) {
60
+ this.showSuccessMessage(removeFinishMsg);
61
+ }
62
+ }
63
+ this._application.messagesBuilder.currentOperation = this.getMessageOperation();
64
+ };
65
+ }
66
+ observePageSize() {
67
+ if (this.dataUnit) {
68
+ this.dataUnit.pageSize = this.pageSize;
69
+ }
70
+ }
71
+ observeDataUnitName(newValue, oldValue) {
72
+ if (oldValue != newValue) {
73
+ this.dataUnit = undefined;
74
+ this.dataUnitName = newValue;
75
+ this.loadDataUnit();
76
+ }
77
+ }
78
+ observeEntityName(newValue, oldValue) {
79
+ if (oldValue != newValue) {
80
+ this.dataUnit = undefined;
81
+ this.entityName = newValue;
82
+ this.loadDataUnit();
83
+ }
84
+ }
85
+ observeDataState(newValue, oldValue) {
86
+ if (oldValue != newValue) {
87
+ this.dataStateChange.emit(newValue);
88
+ }
89
+ }
90
+ observeDataUnit() {
91
+ this.dataUnitReady.emit(this.dataUnit);
92
+ }
93
+ /**
94
+ * Pode-se obter o dataUnit através desse método. Outra forma, é ouvir o evento de
95
+ *
96
+ * @returns dataUnit
97
+ */
98
+ async getDataUnit() {
99
+ return new Promise((resolve) => {
100
+ if (this.dataUnit) {
101
+ resolve(this.dataUnit);
102
+ }
103
+ else {
104
+ this._onDataUnitResolve.push(resolve);
105
+ }
106
+ });
107
+ }
108
+ async interceptAction(action) {
109
+ return new Promise(resolve => {
110
+ switch (action.type) {
111
+ case core.Action.RECORDS_ADDED:
112
+ if (this.isAllowed("INSERT")) {
113
+ resolve(action);
114
+ }
115
+ else {
116
+ utils.ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenInsert"));
117
+ }
118
+ break;
119
+ case core.Action.RECORDS_COPIED:
120
+ if (this.isAllowed("CLONE")) {
121
+ resolve(action);
122
+ }
123
+ else {
124
+ utils.ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenClone"));
125
+ }
126
+ break;
127
+ case core.Action.DATA_CHANGED:
128
+ case core.Action.CHANGING_DATA:
129
+ if (this.isAllowed("UPDATE")) {
130
+ resolve(action);
131
+ }
132
+ else {
133
+ this.dataUnit.cancelEdition();
134
+ utils.ApplicationUtils.alert(this.getMessage("snkDataUnit.forbidden"), this.getMessage("snkDataUnit.forbiddenUpdate"));
135
+ }
136
+ break;
137
+ case core.Action.SAVING_DATA:
138
+ if (this.beforeSave) {
139
+ const continueAction = this.beforeSave(this.dataUnit);
140
+ if (continueAction instanceof Promise) {
141
+ continueAction.then(result => resolve(result ? action : undefined));
142
+ }
143
+ else {
144
+ resolve(continueAction ? action : undefined);
145
+ }
146
+ }
147
+ else {
148
+ resolve(action);
149
+ }
150
+ break;
151
+ case core.Action.DATA_SAVED:
152
+ if (this.afterSave) {
153
+ this.afterSave(this.dataUnit);
154
+ }
155
+ else {
156
+ resolve(action);
157
+ }
158
+ break;
159
+ case core.Action.EDITION_CANCELED:
160
+ if (this.dataState.hasDirtyRecords) {
161
+ const cancelConfirmation = this.getMessage("snkDataUnit.cancelConfirmation");
162
+ if (cancelConfirmation == undefined) {
163
+ resolve(action);
164
+ }
165
+ else {
166
+ const cancelConfirmationTitle = this.getMessage("snkDataUnit.cancelConfirmationTitle");
167
+ utils.ApplicationUtils.confirm(cancelConfirmationTitle, cancelConfirmation)
168
+ .then((result) => resolve(result ? action : undefined));
169
+ }
170
+ }
171
+ else {
172
+ resolve(action);
173
+ }
174
+ break;
175
+ case core.Action.REMOVING_RECORDS:
176
+ if (this.isAllowed("REMOVE")) {
177
+ const removeConfirmation = this.getMessage("snkDataUnit.removeConfirmation");
178
+ if (removeConfirmation == undefined) {
179
+ resolve(action);
180
+ }
181
+ else {
182
+ const removeConfirmationTitle = this.getMessage("snkDataUnit.removeConfirmationTitle");
183
+ utils.ApplicationUtils.confirm(removeConfirmationTitle, removeConfirmation, "delete", utils.DialogType.WARN)
184
+ .then((result) => resolve(result ? action : undefined));
185
+ }
186
+ }
187
+ else {
188
+ utils.ApplicationUtils.info(this.getMessage("snkDataUnit.forbiddenRemove"));
189
+ }
190
+ break;
191
+ default:
192
+ resolve(action);
193
+ }
194
+ });
195
+ }
196
+ showSuccessMessage(message) {
197
+ utils.ApplicationUtils.info(message, { iconName: "check" });
198
+ }
199
+ isAllowed(flag) {
200
+ return this._permissions ? this._permissions.isSup || this._permissions[flag] : false;
201
+ }
202
+ /**
203
+ * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
204
+ * através de um pequeno modulo na estrutura da aplicação:
205
+ * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
206
+ * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-data-unit.msg.ts"
207
+ */
208
+ getMessage(key, params = undefined) {
209
+ if (!params) {
210
+ params = this.getMessageParams();
211
+ }
212
+ return this._application.messagesBuilder.getMessage(key, params);
213
+ }
214
+ getMessageParams() {
215
+ //TODO: Atualmente ainda não usamos o recurso de multiseleção do dataunit, mas no futuro
216
+ //precisaremos criar um mecanismo para oferecer todos os registros selecionados para a
217
+ //mensagem
218
+ return this.dataState.selectedRecords ? this.dataState.selectedRecords[0] : undefined;
219
+ }
220
+ getMessageOperation() {
221
+ if (this.dataState.copyMode) {
222
+ return SnkMessageBuilder.OperationMap.CLONE;
223
+ }
224
+ if (this.dataState.insertionMode) {
225
+ return SnkMessageBuilder.OperationMap.INSERT;
226
+ }
227
+ if (this.dataState.isDirty) {
228
+ return SnkMessageBuilder.OperationMap.UPDATE;
229
+ }
230
+ return SnkMessageBuilder.OperationMap.CLEAN;
231
+ }
232
+ async loadDataUnit() {
233
+ if (!this.dataUnit) {
234
+ if (this._application && this.entityName) {
235
+ const cacheName = this.dataUnitName ? this.dataUnitName : this.entityName;
236
+ this.dataUnit = await this._application.getDataUnit(this.entityName, cacheName);
237
+ this.dataUnit.pageSize = this.pageSize;
238
+ this.dataUnit.unsubscribe(this._dataUnitObserver);
239
+ this.dataUnit.addInterceptor(this);
240
+ this.dataUnit.subscribe(this._dataUnitObserver);
241
+ let resolver;
242
+ while (resolver = this._onDataUnitResolve.pop()) {
243
+ resolver(this.dataUnit);
244
+ }
245
+ }
246
+ }
247
+ }
248
+ //---------------------------------------------
249
+ // Lifecycle web component
250
+ //---------------------------------------------
251
+ componentWillLoad() {
252
+ this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
253
+ this._application.getAllAccess().then(access => this._permissions = access);
254
+ }
255
+ componentDidLoad() {
256
+ this.loadDataUnit();
257
+ }
258
+ render() {
259
+ return (index.h(index.Host, null));
260
+ }
261
+ get element() { return index.getElement(this); }
262
+ static get watchers() { return {
263
+ "pageSize": ["observePageSize"],
264
+ "dataUnitName": ["observeDataUnitName"],
265
+ "entityName": ["observeEntityName"],
266
+ "dataState": ["observeDataState"],
267
+ "dataUnit": ["observeDataUnit"]
268
+ }; }
269
+ };
270
+ SnkDataUnit.style = snkDataUnitCss;
271
+
272
+ exports.snk_data_unit = SnkDataUnit;
@@ -0,0 +1,135 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-20e8b68a.js');
6
+ const core = require('@sankhyalabs/core');
7
+ const constants = require('./constants-9056ca9e.js');
8
+ const taskbarProcessor = require('./taskbar-processor-6bd0d35c.js');
9
+ const configurableElementsStorage = require('./configurableElementsStorage-93459c72.js');
10
+
11
+ const snkFieldConfigCss = ".sc-snk-field-config-h{--snk-field-config--height:42px;--snk-field-config--width:100%;--snk-field-config__icon--width:48px;--snk-field-config--height--slim:32px;--snk-field-config--border-radius:var(--border--radius-medium, 12px);--snk-field-config--font-size:var(--text--medium, 14px);--snk-field-config--font-family:var(--font-pattern, Arial);--snk-field-config--font-weight:var(--text-weight--medium, 400);--snk-field-config--color:var(--title--primary, #000);--snk-field-config__input--background-color:var(--background--medium, #e0e0e0);--snk-field-config__input--border:var(--border--medium, 2px solid);--snk-field-config__input--border-color:var(--background--xlight, #fff);--snk-field-config__required--color:var(--color--error, #FF0000);--snk-field-config__transition--visibility:var(--transition, 0.2s linear);--snk-field-config__transition--opacity:var(--transition, 0.15s linear);display:flex;flex-wrap:wrap;position:relative;width:var(--snk-field-config--width)}.field-config.sc-snk-field-config{width:100%;box-sizing:border-box;display:flex;align-items:center;padding-left:var(--space--medium, 6px);font-weight:var(--snk-field-config--font-weight);height:var(--snk-field-config--height);border-radius:var(--snk-field-config--border-radius);font-family:var(--snk-field-config--font-family);font-size:var(--snk-field-config--font-size);border:var(--snk-field-config__input--border);border-color:var(--snk-field-config__input--border-color);background-color:var(--snk-field-config__input--background-color);color:var(--snk-field-config--color)}.field-config__config-popover.sc-snk-field-config{width:40px;margin-left:auto;z-index:var(--more-visible, 2)}.field-config__required-label.sc-snk-field-config{padding-left:var(--space--extra-small, 3px);color:var(--snk-field-config__required--color)}.field-config__add.sc-snk-field-config{display:flex;margin-left:auto;visibility:hidden;opacity:0;transition:visibility var(--snk-field-config__transition--visibility), opacity var(--snk-field-config__transition--opacity)}.field-config__options.sc-snk-field-config{display:flex;margin-left:auto;visibility:hidden;opacity:0;transition:visibility var(--snk-field-config__transition--visibility), opacity var(--snk-field-config__transition--opacity)}.field-config__options--is-active.sc-snk-field-config{display:flex;visibility:visible;opacity:1}.field-config__remove-icon.sc-snk-field-config{margin-right:-15px}.field-config.sc-snk-field-config:hover .field-config__options.sc-snk-field-config{display:flex;visibility:visible;opacity:1}.field-config.sc-snk-field-config:hover .field-config__add.sc-snk-field-config{visibility:visible;opacity:1}.field-config__draggable.sc-snk-field-config{padding-right:var(--space--small, 6px)}.field-config__config-outer-arrow.sc-snk-field-config{background-color:var(--color--secondary-200);clip-path:polygon(50% 0, 90% 100%, 10% 100%);border-radius:0.25em 0 0 0;width:30px;height:15px;padding-top:3px;border-bottom:1px solid #FFFFFF}.field-config__config-inner-arrow.sc-snk-field-config{background-color:#FFFFFF;clip-path:polygon(50% 0, 90% 100%, 10% 100%);border-radius:0.25em 0 0 0;width:30px;height:15px}.ez-box__container.sc-snk-field-config ez-collapsible-box.sc-snk-field-config{--snk-collapsible-box__header--padding-left:6px}ez-icon.sc-snk-field-config{--snk-icon--color:var(--snk-field-config--color)}ez-popover.sc-snk-field-config{--snk-popover__box--background-color:transparent;--snk-popover__box--box-shadow:none}.field-config__options.sc-snk-field-config ez-button.sc-snk-field-config{--snk-button--background-color:transparent;--snk-button--focus--border:none;--snk-button--focus--box-shadow:none}";
12
+
13
+ const SnkFieldConfig = class {
14
+ constructor(hostRef) {
15
+ index.registerInstance(this, hostRef);
16
+ this.ezClickIcon = index.createEvent(this, "ezClickIcon", 7);
17
+ /**
18
+ * Define se o popover de configuração está ativo.
19
+ */
20
+ this.isConfigActive = false;
21
+ /**
22
+ * Define se o componente está em modo de inserção
23
+ */
24
+ this.modeInsertion = true;
25
+ }
26
+ handleAction(evt, type) {
27
+ evt.preventDefault();
28
+ evt.stopPropagation();
29
+ const field = this.fieldConfig;
30
+ if (type !== constants.ACTION_CONFIG.configuration) {
31
+ field.group = undefined;
32
+ }
33
+ this.ezClickIcon.emit({ field, type });
34
+ }
35
+ /**
36
+ * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
37
+ * através de um pequeno modulo na estrutura da aplicação:
38
+ * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
39
+ * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-form.msg.ts"
40
+ */
41
+ getMessage(key) {
42
+ return this._application.messagesBuilder.getMessage(key, {});
43
+ }
44
+ componentWillLoad() {
45
+ this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
46
+ }
47
+ render() {
48
+ if (this.fieldConfig == undefined) {
49
+ return;
50
+ }
51
+ return (index.h(index.Host, null, index.h("div", { class: "field-config" }, index.h("div", { class: "field-config__draggable" }, index.h("ez-icon", { iconName: "drag-indicator", size: "small" })), index.h("div", null, this.fieldConfig.label, this.fieldConfig.required && index.h("span", { class: "field-config__required-label" }, "*")), this.modeInsertion ?
52
+ index.h("div", { class: "field-config__add" }, index.h("ez-button", { onClick: (evt) => this.handleAction(evt, constants.ACTION_CONFIG.add), mode: "icon", class: "ez-button--tertiary", iconName: "plus", size: "large", title: this.getMessage("snkFieldConfig.titleAdd") })) :
53
+ index.h("div", { class: "field-config__options" + (this.isConfigActive ? " field-config__options--is-active" : " ") }, index.h("ez-button", { mode: "icon", class: "ez-button--tertiary field-config__remove-icon", onClick: (evt) => this.handleAction(evt, constants.ACTION_CONFIG.remove), iconName: "minus", size: "large", title: this.getMessage("snkFieldConfig.titleRemove") }), index.h("ez-button", { id: "buttonConfig_" + this.fieldConfig.name, mode: "icon", class: "ez-button--tertiary", onClick: (evt) => this.handleAction(evt, constants.ACTION_CONFIG.configuration), iconName: this.isConfigActive ? "chevron-up" : "settings-inverted", size: "large", title: this.getMessage("snkFieldConfig.titleConfigurations") }))), this.isConfigActive && index.h("div", { class: "field-config__config-popover" }, index.h("div", { class: "field-config__config-outer-arrow" }, index.h("div", { class: "field-config__config-inner-arrow" })))));
54
+ }
55
+ };
56
+ SnkFieldConfig.style = snkFieldConfigCss;
57
+
58
+ const snkGridCss = ".snk-grid__container.sc-snk-grid{display:flex;height:100%;width:100%}.snk-grid__header.sc-snk-grid{display:flex;flex-wrap:nowrap;width:100%}.snk-grid__filter-bar.sc-snk-grid{width:100%}.snk-grid__header-divider.sc-snk-grid{margin-bottom:var(--space--small)}";
59
+
60
+ const SnkGrid = class {
61
+ constructor(hostRef) {
62
+ index.registerInstance(this, hostRef);
63
+ this.actionClick = index.createEvent(this, "actionClick", 7);
64
+ this.gridDoubleClick = index.createEvent(this, "gridDoubleClick", 7);
65
+ this.configChanged = index.createEvent(this, "configChanged", 7);
66
+ this._topTaskbarProcessor = new taskbarProcessor.TaskbarProcessor({
67
+ "snkGridTopTaskbar": ["FORM_MODE", "CONFIGURATOR", "INSERT"]
68
+ });
69
+ this._headerTaskbarProcessor = new taskbarProcessor.TaskbarProcessor({
70
+ "snkGridHeaderTaskbar.unselected": ["REFRESH"],
71
+ "snkGridHeaderTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "REFRESH"]
72
+ });
73
+ }
74
+ /**
75
+ * Método responsável em abrir ou fechar o modal de configurações da grade.
76
+ */
77
+ async setShowGridConfig(value) {
78
+ if (this._grid == undefined) {
79
+ return;
80
+ }
81
+ if (value === true) {
82
+ this._grid.openGridConfig();
83
+ }
84
+ else {
85
+ this._grid.closeGridConfig();
86
+ }
87
+ }
88
+ /**
89
+ * Método responsável por setar as configurações da grade.
90
+ */
91
+ async setConfig(config) {
92
+ this._gridConfig = config;
93
+ }
94
+ changeConfig(config) {
95
+ this.configChanged.emit(config);
96
+ }
97
+ componentDidRender() {
98
+ configurableElementsStorage.ConfigurableElementsStorage.setGrid(this.configName, this._element);
99
+ }
100
+ componentWillLoad() {
101
+ let parent = this._element.parentElement;
102
+ while (parent) {
103
+ if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
104
+ this._snkDataUnit = parent;
105
+ this._dataUnit = this._snkDataUnit.dataUnit;
106
+ if (!this._dataUnit) {
107
+ this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
108
+ this._dataUnit = evt.detail;
109
+ });
110
+ }
111
+ this._snkDataUnit.addEventListener("dataStateChange", (evt) => {
112
+ this._dataState = evt.detail;
113
+ });
114
+ break;
115
+ }
116
+ parent = parent.parentElement;
117
+ }
118
+ }
119
+ componentWillRender() {
120
+ const headerTaskbarId = this._dataState && this._dataState.selectedRecords.length > 0 ? "snkGridHeaderTaskbar.selected" : "snkGridHeaderTaskbar.unselected";
121
+ this._headerTaskbarProcessor.process(headerTaskbarId, this.taskbarManager, this._dataState);
122
+ this._topTaskbarProcessor.process("snkGridTopTaskbar", this.taskbarManager, this._dataState);
123
+ }
124
+ render() {
125
+ if (!this._dataUnit) {
126
+ return undefined;
127
+ }
128
+ return (index.h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, index.h("div", { class: "snk-grid__header ez-padding-bottom--medium ez-margin-bottom--medium" }, index.h("snk-filter-bar", { dataUnit: this._dataUnit, class: "snk-grid__filter-bar ez-align--top", configName: this.configName }), index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), index.h("snk-taskbar", { class: "ez-padding-left--medium", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: "INSERT" })), index.h("ez-grid", { ref: ref => this._grid = ref, dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.changeConfig(evt.detail); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver }, index.h("snk-taskbar", { dataUnit: this._dataUnit, buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList })), index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("slot", { name: "SnkGridFooter" }))));
129
+ }
130
+ get _element() { return index.getElement(this); }
131
+ };
132
+ SnkGrid.style = snkGridCss;
133
+
134
+ exports.snk_field_config = SnkFieldConfig;
135
+ exports.snk_grid = SnkGrid;
@@ -0,0 +1,50 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-20e8b68a.js');
6
+ const filterItemType_enum = require('./filter-item-type.enum-3daf58d3.js');
7
+
8
+ const SnkFilterBinarySelect = class {
9
+ constructor(hostRef) {
10
+ index.registerInstance(this, hostRef);
11
+ }
12
+ isSelected(option) {
13
+ return this.value == undefined || this.value === option;
14
+ }
15
+ ezChangeListener(evt) {
16
+ if (!evt.detail) {
17
+ this.assertCheckedOption(evt.target);
18
+ }
19
+ this.updateValue();
20
+ }
21
+ assertCheckedOption(updatingCheck) {
22
+ if (updatingCheck === this._checkOne) {
23
+ this._checkTwo.value = true;
24
+ }
25
+ else {
26
+ this._checkOne.value = true;
27
+ }
28
+ }
29
+ updateValue() {
30
+ if (!this._checkOne.value || !this._checkTwo.value) {
31
+ const [optOne, optTwo] = this.config.props.options;
32
+ this.value = this._checkOne.value ? optOne.name : optTwo.name;
33
+ }
34
+ else {
35
+ this.value = undefined;
36
+ }
37
+ }
38
+ async show() {
39
+ this._checkOne.setFocus();
40
+ }
41
+ render() {
42
+ if (!this.config || this.config.type !== filterItemType_enum.FilterItemType.BINARY_SELECT) {
43
+ return undefined;
44
+ }
45
+ const [optOne, optTwo] = this.config.props.options;
46
+ return (index.h(index.Host, null, index.h("ez-check", { label: optOne.label, class: "sc-snk-filter-bar editor__ez-check", ref: (ref) => this._checkOne = ref, value: this.isSelected(optOne.name) }), index.h("ez-check", { label: optTwo.label, class: "sc-snk-filter-bar editor__ez-check", ref: (ref) => this._checkTwo = ref, value: this.isSelected(optTwo.name) })));
47
+ }
48
+ };
49
+
50
+ exports.snk_filter_binary_select = SnkFilterBinarySelect;
@@ -0,0 +1,106 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-20e8b68a.js');
6
+ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
7
+ const filterItemType_enum = require('./filter-item-type.enum-3daf58d3.js');
8
+
9
+ const SnkFilterDetail = class {
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ this.filterChange = index.createEvent(this, "filterChange", 7);
13
+ }
14
+ async show() {
15
+ this._editor["show"]();
16
+ }
17
+ changeConfig(newConfig) {
18
+ this.filterChange.emit(newConfig);
19
+ }
20
+ getContentEditor() {
21
+ switch (this.config.type) {
22
+ case filterItemType_enum.FilterItemType.BINARY_SELECT:
23
+ return "snk-filter-binary-select";
24
+ case filterItemType_enum.FilterItemType.MULTI_SELECT:
25
+ return "snk-filter-multi-select";
26
+ case filterItemType_enum.FilterItemType.PERIOD:
27
+ return "snk-filter-period";
28
+ case filterItemType_enum.FilterItemType.SEARCH:
29
+ return "snk-filter-search";
30
+ case filterItemType_enum.FilterItemType.NUMBER:
31
+ return "snk-filter-number";
32
+ case filterItemType_enum.FilterItemType.PERSONALIZED:
33
+ return "snk-filter-personalized";
34
+ }
35
+ return "snk-filter-text";
36
+ }
37
+ removeItem() {
38
+ this.changeConfig(Object.assign(Object.assign({}, this.config), { visible: false, fixed: false, value: undefined }));
39
+ }
40
+ getPopUpHeaderButtons() {
41
+ if (this.config.hardFixed) {
42
+ return undefined;
43
+ }
44
+ return ([
45
+ this.buildIcon(this.getMessage("snkFilterBar.removeFilter"), "delete", () => this.removeItem()),
46
+ this.buildIcon(this.getMessage(this.config.fixed ? "snkFilterBar.unpinFilter" : "snkFilterBar.pinFilter"), this.config.fixed ? "un-pin" : "push-pin", () => this.changeConfig(Object.assign(Object.assign({}, this.config), { fixed: !this.config.fixed })))
47
+ ]);
48
+ }
49
+ buildIcon(title, iconName, action) {
50
+ return (index.h("button", { onClick: () => action(), class: "sc-snk-filter-bar snk-filter-item__editor-header-button" }, index.h("ez-icon", { title: title, iconName: iconName })));
51
+ }
52
+ apply() {
53
+ var _a;
54
+ let value = this._editor["value"];
55
+ let isValid = true;
56
+ if (this.config.type === filterItemType_enum.FilterItemType.PERSONALIZED) {
57
+ const params = ((_a = this.config.props.personalizedFilter) === null || _a === void 0 ? void 0 : _a.parameters) || [];
58
+ const paramsCount = params.length;
59
+ if (paramsCount === 0) {
60
+ //Valor do filtro personalizado sem parametros deve ser um array vazio
61
+ value = [];
62
+ }
63
+ else {
64
+ isValid = this.validateAllFilled(paramsCount, value);
65
+ }
66
+ }
67
+ if (isValid) {
68
+ this.changeConfig(Object.assign(Object.assign({}, this.config), { value: value }));
69
+ }
70
+ }
71
+ /* WARNING: Temporário. Isso só está sendo feito até desconsiderar os parametros não informados para PersonalizedFilter*/
72
+ validateAllFilled(paramsCount, value) {
73
+ let isValid = true;
74
+ if (value != undefined && paramsCount > 1) {
75
+ if (paramsCount > value.length) {
76
+ isValid = false;
77
+ }
78
+ else {
79
+ value.forEach(item => {
80
+ if (item == undefined) {
81
+ isValid = false;
82
+ }
83
+ });
84
+ }
85
+ }
86
+ if (!isValid) {
87
+ utils.ApplicationUtils.alert("Filtro parcialmente preenchido", "Favor completar todas as informações do filtro.");
88
+ }
89
+ return isValid;
90
+ }
91
+ /* WARNING: Temporário.*/
92
+ clear() {
93
+ this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined }));
94
+ }
95
+ onKeyDonwListener(event) {
96
+ if (event.key === "Enter") {
97
+ this._applyButton.setFocus().then(() => this.apply());
98
+ }
99
+ }
100
+ render() {
101
+ const ContentEditor = this.getContentEditor();
102
+ return (index.h(index.Host, null, index.h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, index.h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), index.h(ContentEditor, { ref: ref => this._editor = ref, value: this.config.value, config: this.config, onKeyDown: evt => this.onKeyDonwListener(evt) }), index.h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), index.h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, index.h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" }), index.h("ez-button", { ref: ref => this._applyButton = ref, label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
103
+ }
104
+ };
105
+
106
+ exports.snk_filter_detail = SnkFilterDetail;
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-20e8b68a.js');
6
+ const filterItemType_enum = require('./filter-item-type.enum-3daf58d3.js');
7
+
8
+ const SnkFilterMultiSelect = class {
9
+ constructor(hostRef) {
10
+ index.registerInstance(this, hostRef);
11
+ }
12
+ ezChangeListener(evt) {
13
+ this.value = evt.detail.value;
14
+ }
15
+ async show() {
16
+ this._comboElement.setFocus();
17
+ }
18
+ render() {
19
+ if (!this.config || this.config.type !== filterItemType_enum.FilterItemType.MULTI_SELECT) {
20
+ return undefined;
21
+ }
22
+ return (index.h("ez-combo-box", { ref: ref => this._comboElement = ref, label: this.config.label, value: this.config.value, options: this.config.props.options }));
23
+ }
24
+ };
25
+
26
+ exports.snk_filter_multi_select = SnkFilterMultiSelect;