@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,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface SnkConfigModal extends Components.SnkConfigModal, HTMLElement {}
4
+ export const SnkConfigModal: {
5
+ prototype: SnkConfigModal;
6
+ new (): SnkConfigModal;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { S as SnkConfigModal$1, d as defineCustomElement$1 } from './snk-config-modal2.js';
2
+
3
+ const SnkConfigModal = SnkConfigModal$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { SnkConfigModal, defineCustomElement };
@@ -0,0 +1,91 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
+ import { ApplicationContext } from '@sankhyalabs/core';
3
+ import { V as VIEW_MODE } from './constants.js';
4
+
5
+ class ConfigurableElementsStorage {
6
+ static setGrid(id, grid) {
7
+ this._gridById.set(id, grid);
8
+ }
9
+ static setForm(id, form) {
10
+ this._formById.set(id, form);
11
+ }
12
+ static getGrid(id) {
13
+ return this._gridById.get(id);
14
+ }
15
+ static getForm(id) {
16
+ return this._formById.get(id);
17
+ }
18
+ }
19
+ ConfigurableElementsStorage._gridById = new Map();
20
+ ConfigurableElementsStorage._formById = new Map();
21
+
22
+ const snkConfigModalCss = ".sc-snk-config-modal-h{--snk-config-modal__button-close--padding-left:var(--space--medium, 12px);--snk-config-modal__title--color:var(--title--primary, #2B3A54);--snk-config-modal__title--font-family:var(--font-pattern, \"Sora\");--snk-config-modal__title--font-size:var(--title--large, 20px);--snk-config-modal__title--font-weight:var(--text-weight--extra-large, 700);--snk-config-modal__subtitle--color:var(--title--primary, #2B3A54);--snk-config-modal__subtitle--font-family:var(--font-pattern, \"Sora\");--snk-config-modal__subtitle--font-size:var(--text--medium, 14px);--snk-config-modal__subtitle--font-weight:var(--text-weight--large, 600);--snk-config-modal__scrollbar--border-radius:var(--border--radius-small, 6px);--snk-config-modal__scrollbar--width:var(--space--medium, 12px);--snk-config-modal__scrollbar--background-color-primary:var(--scrollbar--primary, #2B3A54);--snk-config-modal__scrollbar--background-color-secondary:var(--scrollbar--secondary, #E5EAF0);display:grid;grid-template-rows:auto 1fr auto;max-height:100%;width:100%}@media screen and (min-width: 480px){.sc-snk-config-modal-h{width:359px;max-width:359px}}.snk-config-modal__button-config.sc-snk-config-modal{--ez-button--min-width:100%}.snk-config-modal__header.sc-snk-config-modal{display:flex;justify-content:space-between;align-items:center;width:100%}.snk-config-modal__title.sc-snk-config-modal{display:flex;margin:0;line-height:normal;letter-spacing:0em;text-align:left;color:var(--snk-config-modal__title--color);font-size:var(--snk-config-modal__title--font-size);font-family:var(--snk-config-modal__title--font-family);font-weight:var(--snk-config-modal__title--font-weight)}.snk-config-modal__subtitle.sc-snk-config-modal{display:flex;margin:0;padding-top:var(--space--medium);padding-bottom:var(--space--small);color:var(--snk-config-modal__subtitle--color);font-size:var(--snk-config-modal__subtitle--font-size);font-family:var(--snk-config-modal__subtitle--font-family);font-weight:var(--snk-config-modal__subtitle--font-weight)}.snk-config-modal__button-close.sc-snk-config-modal{padding-left:var(--snk-config-modal__button-close--padding-left)}.snk-config-modal__main.sc-snk-config-modal{overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--snk-config-modal__scrollbar--background-color-primary) var(--snk-config-modal__scrollbar--background-color-secondary)}.snk-config-modal__main.sc-snk-config-modal::-webkit-scrollbar-track{background-color:var(--snk-config-modal__scrollbar--background-color-secondary)}.snk-config-modal__main.sc-snk-config-modal::-webkit-scrollbar-thumb{background-color:var(--snk-config-modal__scrollbar--background-color-primary);border-radius:var(--snk-config-modal__scrollbar--border-radius)}.snk-config-modal__main.sc-snk-config-modal::-webkit-scrollbar{background-color:var(--snk-config-modal__scrollbar--background-color-secondary);width:var(--snk-config-modal__scrollbar--width);max-width:var(--snk-config-modal__scrollbar--width);min-width:var(--snk-config-modal__scrollbar--width)}";
23
+
24
+ const GRID_MODE = VIEW_MODE.grid;
25
+ const FORM_MODE = VIEW_MODE.form;
26
+ const SnkConfigModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
27
+ constructor() {
28
+ super();
29
+ this.__registerHost();
30
+ this.cancelConfig = createEvent(this, "cancelConfig", 7);
31
+ this.changeConfig = createEvent(this, "changeConfig", 7);
32
+ /**
33
+ * Define se o modo grid está ativo.
34
+ */
35
+ this.gridMode = true;
36
+ }
37
+ dispatchChange(openConfig = false) {
38
+ const data = {
39
+ viewMode: this.gridMode ? GRID_MODE.index : FORM_MODE.index,
40
+ openConfig
41
+ };
42
+ this.changeConfig.emit(data);
43
+ }
44
+ closeConfig() {
45
+ this.cancelConfig.emit();
46
+ }
47
+ onChecked(evt) {
48
+ const value = evt === null || evt === void 0 ? void 0 : evt.detail;
49
+ this.gridMode = value === "G" ? true : false;
50
+ this.dispatchChange();
51
+ }
52
+ onClicked() {
53
+ this.dispatchChange(true);
54
+ }
55
+ /**
56
+ * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
57
+ * através de um pequeno modulo na estrutura da aplicação:
58
+ * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
59
+ * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-configurator.msg.ts"
60
+ */
61
+ getMessage(key) {
62
+ return this._application.messagesBuilder.getMessage(key, {});
63
+ }
64
+ componentWillLoad() {
65
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
66
+ }
67
+ render() {
68
+ return (h(Host, null, h("div", { class: "snk-config-modal__header" }, h("label", { class: "snk-config-modal__title" }, this.getMessage("snkConfigModal.titleConfigurations")), h("div", { class: "snk-config-modal__button-close" }, h("ez-button", { mode: 'icon', iconName: "close", size: 'medium', onClick: () => this.closeConfig() }))), h("div", { class: "snk-config-modal__main" }, h("ez-radio-button", { class: "ez-margin-top--medium", label: this.getMessage("snkConfigModal.subTitleModeConfig"), value: this.gridMode ? "G" : "F", onEzChange: (evt) => this.onChecked(evt) }, ConfigurableElementsStorage.getForm(this.configName) && h("ez-radio-button-option", { label: this.getMessage("snkConfigModal.labelGrid"), value: "G" }), ConfigurableElementsStorage.getGrid(this.configName) && h("ez-radio-button-option", { label: this.getMessage("snkConfigModal.labelForm"), value: "F" })), h("ez-button", { mode: "slim", label: this.gridMode
69
+ ? this.getMessage("snkConfigModal.labelConfigGrid")
70
+ : this.getMessage("snkConfigModal.labelConfigForm"), class: "snk-config-modal__button-config ez-button--primary", onClick: () => this.onClicked() }), h("hr", { class: "ez-divider-horizontal ez-margin-vertical--medium" }))));
71
+ }
72
+ static get style() { return snkConfigModalCss; }
73
+ }, [2, "snk-config-modal", {
74
+ "configName": [1, "config-name"],
75
+ "gridMode": [4, "grid-mode"]
76
+ }]);
77
+ function defineCustomElement() {
78
+ if (typeof customElements === "undefined") {
79
+ return;
80
+ }
81
+ const components = ["snk-config-modal"];
82
+ components.forEach(tagName => { switch (tagName) {
83
+ case "snk-config-modal":
84
+ if (!customElements.get(tagName)) {
85
+ customElements.define(tagName, SnkConfigModal);
86
+ }
87
+ break;
88
+ } });
89
+ }
90
+
91
+ export { ConfigurableElementsStorage as C, SnkConfigModal as S, defineCustomElement as d };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface SnkConfigOptions extends Components.SnkConfigOptions, HTMLElement {}
4
+ export const SnkConfigOptions: {
5
+ prototype: SnkConfigOptions;
6
+ new (): SnkConfigOptions;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { S as SnkConfigOptions$1, d as defineCustomElement$1 } from './snk-config-options2.js';
2
+
3
+ const SnkConfigOptions = SnkConfigOptions$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { SnkConfigOptions, defineCustomElement };
@@ -0,0 +1,245 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
+ import { UserInterface, ObjectUtils, ApplicationContext } from '@sankhyalabs/core';
3
+ import { DataType, getConvertedValue } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
4
+ import { CheckMode } from '@sankhyalabs/ezui/dist/collection/utils';
5
+ import { a as VARS_BY_TYPE, D as DEFAULT_TYPE, T as TAGS_BY_TYPE } from './constants.js';
6
+
7
+ const snkConfigOptionsCss = ".sc-snk-config-options-h{width:100%;border:2px solid var(--color--secondary-200);border-radius:15px}.config-options__switch-row.sc-snk-config-options{margin-top:-30px}";
8
+
9
+ const SnkConfigOptions = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
10
+ constructor() {
11
+ super();
12
+ this.__registerHost();
13
+ this.configOptionsChanged = createEvent(this, "configOptionsChanged", 7);
14
+ /**
15
+ * Armazena as propriedades do campo
16
+ */
17
+ this.fieldConfig = {};
18
+ }
19
+ onConfigDefault(optionSelected) {
20
+ if (optionSelected != undefined) {
21
+ this._defaultType = optionSelected;
22
+ this.fieldConfig.defaultValue = {
23
+ type: this._defaultType
24
+ };
25
+ this.configOptionsChanged.emit(this.fieldConfig);
26
+ }
27
+ }
28
+ buildOptions() {
29
+ var _a, _b, _c;
30
+ const interfaceField = (_c = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.name)) === null || _c === void 0 ? void 0 : _c.userInterface;
31
+ return VARS_BY_TYPE.UserInterface[interfaceField];
32
+ }
33
+ enabledValueDefault() {
34
+ var _a, _b, _c;
35
+ const field = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.name);
36
+ const allowDefault = (_c = field === null || field === void 0 ? void 0 : field.properties) === null || _c === void 0 ? void 0 : _c.allowDefault;
37
+ const hasVariableVar = VARS_BY_TYPE.UserInterface.hasOwnProperty(field === null || field === void 0 ? void 0 : field.userInterface);
38
+ if ((allowDefault == undefined || allowDefault === "true") && hasVariableVar) {
39
+ return true;
40
+ }
41
+ return false;
42
+ }
43
+ isAllowDefault() {
44
+ var _a, _b;
45
+ const allowDefault = (_b = (_a = this._fieldProperties) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.allowDefault;
46
+ if (allowDefault == undefined) {
47
+ return true;
48
+ }
49
+ return allowDefault === "true";
50
+ }
51
+ loadDefaultValue() {
52
+ var _a;
53
+ if (this.fieldConfig == undefined) {
54
+ this._defaultType = DEFAULT_TYPE.fixed;
55
+ this.fieldConfig = {
56
+ defaultValue: {
57
+ type: this._defaultType
58
+ }
59
+ };
60
+ }
61
+ else if (((_a = this.fieldConfig.defaultValue) === null || _a === void 0 ? void 0 : _a.type) == undefined) {
62
+ this._defaultType = DEFAULT_TYPE.fixed;
63
+ this.fieldConfig.defaultValue = {
64
+ type: this._defaultType
65
+ };
66
+ }
67
+ else {
68
+ this._defaultType = this.fieldConfig.defaultValue.type;
69
+ }
70
+ }
71
+ getFieldProperties(field) {
72
+ var _a;
73
+ if (field != undefined) {
74
+ return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(field);
75
+ }
76
+ }
77
+ getMessage(key, params) {
78
+ return this._application.messagesBuilder.getMessage(key, params);
79
+ }
80
+ getDefaultType() {
81
+ var _a;
82
+ return (_a = this.fieldConfig.defaultValue.type) !== null && _a !== void 0 ? _a : DEFAULT_TYPE.fixed;
83
+ }
84
+ getEnabledByProperty(property) {
85
+ const properties = this._fieldProperties;
86
+ if (properties != undefined && properties[property] === true) {
87
+ return false;
88
+ }
89
+ return true;
90
+ }
91
+ getValueByProperty(property) {
92
+ const properties = this._fieldProperties;
93
+ if (properties != undefined && properties[property] === true) {
94
+ return true;
95
+ }
96
+ return this.fieldConfig[property];
97
+ }
98
+ getValidatedValue(fieldValue) {
99
+ var _a, _b;
100
+ if (fieldValue == undefined) {
101
+ return;
102
+ }
103
+ const field = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.name);
104
+ const dataType = field === null || field === void 0 ? void 0 : field.dataType;
105
+ if (dataType == undefined) {
106
+ return;
107
+ }
108
+ const value = (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.waitmessage) != undefined ? undefined :
109
+ dataType !== DataType.OBJECT && dataType !== DataType.DATE
110
+ && typeof fieldValue === "object"
111
+ ? fieldValue.value
112
+ : fieldValue;
113
+ return dataType === DataType.OBJECT ? JSON.stringify(value) : value;
114
+ }
115
+ buildInputDefault({ value, enabled, label, name, required, userInterface }, properties = undefined, mode = undefined) {
116
+ let options;
117
+ let precision = 0;
118
+ let prettyPrecision = 0;
119
+ const TagName = userInterface == undefined || TAGS_BY_TYPE[userInterface] == undefined
120
+ ? TAGS_BY_TYPE.DEFAULT
121
+ : TAGS_BY_TYPE[userInterface];
122
+ if (userInterface === UserInterface.OPTIONSELECTOR) {
123
+ const prop = properties === null || properties === void 0 ? void 0 : properties.options;
124
+ if (typeof prop === "string") {
125
+ const parsed = ObjectUtils.stringToObject(prop);
126
+ options = Object.keys(parsed).map(key => { return { value: key, label: parsed[key] }; });
127
+ }
128
+ else {
129
+ options = prop;
130
+ }
131
+ }
132
+ else if (userInterface === UserInterface.DECIMALNUMBER) {
133
+ precision = Number((properties === null || properties === void 0 ? void 0 : properties.precision) || 2);
134
+ prettyPrecision = Number((properties === null || properties === void 0 ? void 0 : properties.prettyPrecision) || precision);
135
+ }
136
+ return h(TagName, Object.assign({ value: value, enabled: enabled, label: label, "data-field-name": name, key: name, onEzChange: (evt) => this.onChange(evt === null || evt === void 0 ? void 0 : evt.detail) }, (this.getConditionalAttributes(userInterface, required, options, precision, prettyPrecision, mode))));
137
+ }
138
+ getConditionalAttributes(userInterface, required, options, precision, prettyPrecision, mode) {
139
+ switch (userInterface) {
140
+ case UserInterface.SEARCH:
141
+ return {
142
+ suppressEmptyOption: required,
143
+ optionLoader: (searchArgument) => this.onSearch(searchArgument)
144
+ };
145
+ case UserInterface.OPTIONSELECTOR:
146
+ return {
147
+ suppressEmptyOption: required,
148
+ options
149
+ };
150
+ case UserInterface.CHECKBOX:
151
+ case UserInterface.SWITCH:
152
+ return {
153
+ mode
154
+ };
155
+ case UserInterface.INTEGERNUMBER:
156
+ case UserInterface.DECIMALNUMBER:
157
+ return {
158
+ precision,
159
+ prettyPrecision,
160
+ onEzStartChange: (evt) => this.onChange(evt === null || evt === void 0 ? void 0 : evt.detail)
161
+ };
162
+ case UserInterface.DATE:
163
+ case UserInterface.DATETIME:
164
+ case UserInterface.TIME:
165
+ return {
166
+ onEzStartChange: (evt) => this.onChange(evt === null || evt === void 0 ? void 0 : evt.detail)
167
+ };
168
+ default:
169
+ return {};
170
+ }
171
+ }
172
+ onChange(fieldValue) {
173
+ this.fieldConfig.defaultValue.value = this.getValidatedValue(fieldValue);
174
+ this.configOptionsChanged.emit(this.fieldConfig);
175
+ }
176
+ onSearch(searchArgument) {
177
+ if (this._application != undefined && this.fieldConfig != undefined) {
178
+ return this._application.executeSearch(searchArgument, this.fieldConfig.name, this.dataUnit);
179
+ }
180
+ }
181
+ buildField(field) {
182
+ const { config, descriptor } = field;
183
+ const { name, label, readOnly, required, defaultValue } = config;
184
+ const { userInterface, properties } = descriptor;
185
+ const enabled = (properties === null || properties === void 0 ? void 0 : properties.allowDefault) != undefined ? properties.allowDefault === "true" : !readOnly;
186
+ let value;
187
+ if (enabled) {
188
+ value = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.value;
189
+ if (value != undefined) {
190
+ value = getConvertedValue(descriptor === null || descriptor === void 0 ? void 0 : descriptor.dataType, value);
191
+ }
192
+ }
193
+ const configField = { value, enabled, label, name, required, userInterface };
194
+ switch (userInterface) {
195
+ case UserInterface.SWITCH:
196
+ return this.buildInputDefault(configField, undefined, CheckMode.SWITCH);
197
+ case UserInterface.CHECKBOX:
198
+ return this.buildInputDefault(configField, undefined, CheckMode.REGULAR);
199
+ case UserInterface.OPTIONSELECTOR:
200
+ case UserInterface.DECIMALNUMBER:
201
+ return this.buildInputDefault(configField, properties);
202
+ default:
203
+ return this.buildInputDefault(configField);
204
+ }
205
+ }
206
+ componentWillLoad() {
207
+ var _a;
208
+ this.loadDefaultValue();
209
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
210
+ this._fieldProperties = this.getFieldProperties((_a = this.fieldConfig) === null || _a === void 0 ? void 0 : _a.name);
211
+ }
212
+ render() {
213
+ var _a, _b;
214
+ return (h(Host, null, h("div", { id: this.idConfig }, h("div", { class: "ez-row ez-padding--medium" }, h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-text-input", { label: this.getMessage("snkConfigOptions.label.nameField"), value: (_a = this.fieldConfig) === null || _a === void 0 ? void 0 : _a.label, onEzChange: (evt) => { this.fieldConfig.label = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } })), h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-combo-box", { label: this.getMessage("snkConfigOptions.label.typeValueDefault"), suppressEmptyOption: true, enabled: this.enabledValueDefault(), onEzChange: (evt) => { var _a; return this.onConfigDefault((_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value); }, value: this.getDefaultType() }, h("option", { value: DEFAULT_TYPE.fixed }, this.getMessage("snkConfigOptions.options.valueFixed")), h("option", { value: DEFAULT_TYPE.variable }, this.getMessage("snkConfigOptions.options.variable")))), h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, this._defaultType === DEFAULT_TYPE.variable ?
215
+ h("ez-combo-box", { label: this.getMessage("snkConfigOptions.label.valueDefault"), enabled: this.isAllowDefault(), onEzChange: (evt) => { var _a; this.fieldConfig.defaultValue.value = (_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value; this.configOptionsChanged.emit(this.fieldConfig); }, value: this.fieldConfig.defaultValue.value, options: this.buildOptions() })
216
+ :
217
+ ((_b = this._fieldProperties) === null || _b === void 0 ? void 0 : _b.userInterface) &&
218
+ this.buildField({
219
+ descriptor: this._fieldProperties,
220
+ config: this.fieldConfig
221
+ }))), h("div", { class: "ez-row ez-padding--medium config-options__switch-row" }, h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-check", { mode: CheckMode.SWITCH, label: this.getMessage("snkConfigOptions.label.clearDuplicate"), value: this.fieldConfig.cleanOnCopy, onEzChange: (evt) => { this.fieldConfig.cleanOnCopy = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } })), h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-check", { mode: CheckMode.SWITCH, label: this.getMessage("snkConfigOptions.label.requiredField"), enabled: this.getEnabledByProperty("required"), value: this.getValueByProperty("required"), onEzChange: (evt) => { this.fieldConfig.required = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } })), h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-check", { mode: CheckMode.SWITCH, label: this.getMessage("snkConfigOptions.label.protectedField"), enabled: this.getEnabledByProperty("readOnly"), value: this.getValueByProperty("readOnly"), onEzChange: (evt) => { this.fieldConfig.readOnly = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } }))))));
222
+ }
223
+ get _element() { return this; }
224
+ static get style() { return snkConfigOptionsCss; }
225
+ }, [2, "snk-config-options", {
226
+ "fieldConfig": [16],
227
+ "idConfig": [513, "id-config"],
228
+ "dataUnit": [16],
229
+ "_defaultType": [32]
230
+ }]);
231
+ function defineCustomElement() {
232
+ if (typeof customElements === "undefined") {
233
+ return;
234
+ }
235
+ const components = ["snk-config-options"];
236
+ components.forEach(tagName => { switch (tagName) {
237
+ case "snk-config-options":
238
+ if (!customElements.get(tagName)) {
239
+ customElements.define(tagName, SnkConfigOptions);
240
+ }
241
+ break;
242
+ } });
243
+ }
244
+
245
+ export { SnkConfigOptions as S, defineCustomElement as d };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface SnkConfigurator extends Components.SnkConfigurator, HTMLElement {}
4
+ export const SnkConfigurator: {
5
+ prototype: SnkConfigurator;
6
+ new (): SnkConfigurator;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { S as SnkConfigurator$1, d as defineCustomElement$1 } from './snk-configurator2.js';
2
+
3
+ const SnkConfigurator = SnkConfigurator$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { SnkConfigurator, defineCustomElement };
@@ -0,0 +1,212 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
+ import { ObjectUtils, ApplicationContext } from '@sankhyalabs/core';
3
+ import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
4
+ import { C as CONFIG_EVENTS, V as VIEW_MODE } from './constants.js';
5
+ import { C as ConfigurableElementsStorage, d as defineCustomElement$1 } from './snk-config-modal2.js';
6
+
7
+ const GRID_MODE = VIEW_MODE.grid;
8
+ const FORM_MODE = VIEW_MODE.form;
9
+ const SnkConfigurator = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
10
+ constructor() {
11
+ super();
12
+ this.__registerHost();
13
+ this.changeViewMode = createEvent(this, "changeViewMode", 7);
14
+ /**
15
+ * Nome do componente que será vinculado ao `data-configurator-parent` para controlar o modal de configurações.
16
+ */
17
+ this.name = "snkConfigurator";
18
+ /**
19
+ * Define se o campo está habilitado.
20
+ */
21
+ this.enabled = true;
22
+ }
23
+ /**
24
+ * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
25
+ * através de um pequeno modulo na estrutura da aplicação:
26
+ * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
27
+ * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-configurator.msg.ts"
28
+ */
29
+ getMessage(key) {
30
+ return this._application.messagesBuilder.getMessage(key, {});
31
+ }
32
+ controlConfigModal(opened) {
33
+ var _a;
34
+ if (this._modal != undefined) {
35
+ this._modal.opened = opened;
36
+ if (this._configModal != undefined) {
37
+ this._configModal.gridMode = ((_a = this._grid) === null || _a === void 0 ? void 0 : _a.offsetParent) != undefined;
38
+ }
39
+ }
40
+ }
41
+ changeConfigModal(evt) {
42
+ const data = evt === null || evt === void 0 ? void 0 : evt.detail;
43
+ if (data === null || data === void 0 ? void 0 : data.openConfig) {
44
+ this.controlConfigModal(false);
45
+ this.callShowConfig(data === null || data === void 0 ? void 0 : data.viewMode);
46
+ }
47
+ else if ((data === null || data === void 0 ? void 0 : data.viewMode) === GRID_MODE.index) {
48
+ this.changeViewMode.emit(GRID_MODE.name);
49
+ }
50
+ else if ((data === null || data === void 0 ? void 0 : data.viewMode) === FORM_MODE.index) {
51
+ this.changeViewMode.emit(FORM_MODE.name);
52
+ }
53
+ }
54
+ callShowConfig(viewMode) {
55
+ if (viewMode === GRID_MODE.index) {
56
+ if (this._grid == undefined) {
57
+ this.findGrid();
58
+ }
59
+ if (this._grid != undefined) {
60
+ this._grid.setShowGridConfig(true);
61
+ }
62
+ }
63
+ else if (viewMode === FORM_MODE.index) {
64
+ if (this._form == undefined) {
65
+ this.findForm();
66
+ }
67
+ if (this._form != undefined) {
68
+ this._form.setShowFormConfig(true);
69
+ }
70
+ }
71
+ }
72
+ getConfigModal() {
73
+ const modalContainer = document.createElement("ez-modal");
74
+ modalContainer.modalSize = "small";
75
+ modalContainer.opened = false;
76
+ modalContainer.closeEsc = false;
77
+ modalContainer.closeOutsideClick = false;
78
+ modalContainer.dataset.configuratorModal = this.name;
79
+ modalContainer.addEventListener(CONFIG_EVENTS.closeModal, () => {
80
+ this.controlConfigModal(false);
81
+ });
82
+ const modalContent = document.createElement("snk-config-modal");
83
+ modalContent.addEventListener(CONFIG_EVENTS.cancelConfig, () => {
84
+ this.controlConfigModal(false);
85
+ });
86
+ modalContent.addEventListener(CONFIG_EVENTS.changeConfig, (evt) => {
87
+ this.changeConfigModal(evt);
88
+ });
89
+ modalContent.configName = this.configName;
90
+ modalContainer.append(modalContent);
91
+ return modalContainer;
92
+ }
93
+ findConfigModal() {
94
+ let modalContainer = document.body.querySelector(`[data-configurator-modal="${this.name}"]`);
95
+ if (modalContainer == undefined) {
96
+ modalContainer = this.getConfigModal();
97
+ document.body.appendChild(modalContainer);
98
+ }
99
+ this._modal = modalContainer;
100
+ this._configModal = modalContainer.querySelector("snk-config-modal");
101
+ }
102
+ findGrid() {
103
+ if (this._grid != undefined) {
104
+ return;
105
+ }
106
+ this._grid = ConfigurableElementsStorage.getGrid(this.configName);
107
+ if (this._grid != undefined && this._grid.dataset.eventConfigChanged == undefined) {
108
+ this._grid.dataset.eventConfigChanged = "true";
109
+ this._grid.addEventListener(CONFIG_EVENTS.configChanged, (evt) => {
110
+ this.saveConfig(evt);
111
+ });
112
+ }
113
+ }
114
+ findForm() {
115
+ if (this._form != undefined) {
116
+ return;
117
+ }
118
+ this._form = ConfigurableElementsStorage.getForm(this.configName);
119
+ if (this._form != undefined && this._form.dataset.eventConfigChanged == undefined) {
120
+ this._form.dataset.eventConfigChanged = "true";
121
+ this._form.addEventListener(CONFIG_EVENTS.configChanged, (evt) => {
122
+ this.saveConfig(evt);
123
+ });
124
+ }
125
+ }
126
+ saveConfig(evt) {
127
+ const config = evt === null || evt === void 0 ? void 0 : evt.detail;
128
+ if (this._application != undefined && config != undefined) {
129
+ if ((config === null || config === void 0 ? void 0 : config.fields) != undefined) {
130
+ this._application.saveFormConfig(config, this.configName)
131
+ .then((response) => {
132
+ if ((response === null || response === void 0 ? void 0 : response.resource) != undefined) {
133
+ this.loadFormConfig(true);
134
+ }
135
+ });
136
+ }
137
+ else if ((config === null || config === void 0 ? void 0 : config.columns) != undefined) {
138
+ this._application.saveGridConfig(config)
139
+ .then((response) => {
140
+ if ((response === null || response === void 0 ? void 0 : response.resource) != undefined) {
141
+ this.setGridConfig(response.resource);
142
+ }
143
+ });
144
+ }
145
+ }
146
+ }
147
+ setGridConfig(strConfig) {
148
+ if (this._grid != undefined) {
149
+ const config = ObjectUtils.stringToObject(strConfig);
150
+ this._grid.setConfig(config).then(() => {
151
+ ApplicationUtils.info(this.getMessage("snkConfigurator.msgSaveSuccessfully"), { iconName: "check" });
152
+ });
153
+ }
154
+ }
155
+ loadGridConfig() {
156
+ if (this._application != undefined && this.configName != undefined && this._grid != undefined) {
157
+ this._application.loadGridConfig(this.configName).then((config) => {
158
+ this._grid.setConfig(config);
159
+ });
160
+ }
161
+ }
162
+ loadFormConfig(showInfoSuccess = false) {
163
+ if (this._application != undefined && this.configName != undefined && this._form != undefined) {
164
+ this._application.loadFormConfig(this.configName).then((config) => {
165
+ this._form.setConfig(config).then(() => {
166
+ if (showInfoSuccess) {
167
+ ApplicationUtils.info(this.getMessage("snkConfigurator.msgSaveSuccessfully"), { iconName: "check" });
168
+ }
169
+ });
170
+ });
171
+ }
172
+ }
173
+ loadConfig() {
174
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
175
+ this.loadGridConfig();
176
+ this.loadFormConfig();
177
+ }
178
+ componentDidLoad() {
179
+ this.findConfigModal();
180
+ this.findGrid();
181
+ this.findForm();
182
+ this.loadConfig();
183
+ }
184
+ render() {
185
+ return (h("ez-button", { mode: "icon", iconName: "settings-inverted", size: "small", enabled: this.enabled, onClick: () => this.controlConfigModal(true) }));
186
+ }
187
+ get _element() { return this; }
188
+ }, [2, "snk-configurator", {
189
+ "configName": [1, "config-name"],
190
+ "name": [1],
191
+ "enabled": [4]
192
+ }]);
193
+ function defineCustomElement() {
194
+ if (typeof customElements === "undefined") {
195
+ return;
196
+ }
197
+ const components = ["snk-configurator", "snk-config-modal"];
198
+ components.forEach(tagName => { switch (tagName) {
199
+ case "snk-configurator":
200
+ if (!customElements.get(tagName)) {
201
+ customElements.define(tagName, SnkConfigurator);
202
+ }
203
+ break;
204
+ case "snk-config-modal":
205
+ if (!customElements.get(tagName)) {
206
+ defineCustomElement$1();
207
+ }
208
+ break;
209
+ } });
210
+ }
211
+
212
+ export { SnkConfigurator as S, defineCustomElement as d };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface SnkCrud extends Components.SnkCrud, HTMLElement {}
4
+ export const SnkCrud: {
5
+ prototype: SnkCrud;
6
+ new (): SnkCrud;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;