@sankhyalabs/sankhyablocks 8.3.1 → 8.4.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. package/dist/cjs/{ConfigStorage-c9ca6658.js → ConfigStorage-f0f89379.js} +163 -51
  2. package/dist/cjs/{DataFetcher-7694daf2.js → DataFetcher-4798bac3.js} +78 -234
  3. package/dist/cjs/ISave-d68ce3cd.js +8 -0
  4. package/dist/cjs/PrintUtils-bcaeb82f.js +215 -0
  5. package/dist/cjs/ResourceIDUtils-5ff86aa7.js +12 -0
  6. package/dist/cjs/{SnkFormConfigManager-fb684c0e.js → SnkFormConfigManager-d5fd8800.js} +19 -21
  7. package/dist/cjs/{auth-fetcher-80818a0f.js → auth-fetcher-f2967437.js} +2 -2
  8. package/dist/cjs/{dataunit-fetcher-1acab20d.js → dataunit-fetcher-959c9a00.js} +1 -1
  9. package/dist/cjs/{form-config-fetcher-f10017bf.js → form-config-fetcher-5e3d3b87.js} +66 -3
  10. package/dist/cjs/index-f9e81701.js +4 -0
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/cjs/{pesquisa-fetcher-c9d99342.js → pesquisa-fetcher-7973c081.js} +1 -1
  13. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  14. package/dist/cjs/snk-actions-button.cjs.entry.js +19 -11
  15. package/dist/cjs/snk-application.cjs.entry.js +60 -44
  16. package/dist/cjs/snk-attach.cjs.entry.js +9 -14
  17. package/dist/cjs/snk-configurator.cjs.entry.js +2 -1
  18. package/dist/cjs/snk-crud.cjs.entry.js +28 -11
  19. package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -2
  20. package/dist/cjs/{snk-data-unit-e89e07bd.js → snk-data-unit-7cc1846d.js} +5 -5
  21. package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
  22. package/dist/cjs/snk-detail-view.cjs.entry.js +17 -13
  23. package/dist/cjs/snk-entity-list.cjs.entry.js +0 -4
  24. package/dist/cjs/snk-filter-bar.cjs.entry.js +15 -17
  25. package/dist/cjs/snk-filter-detail.cjs.entry.js +7 -16
  26. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +6 -19
  27. package/dist/cjs/snk-form-config.cjs.entry.js +7 -17
  28. package/dist/cjs/snk-form-view.cjs.entry.js +6 -1
  29. package/dist/cjs/snk-form.cjs.entry.js +13 -8
  30. package/dist/cjs/snk-grid-config.cjs.entry.js +6 -6
  31. package/dist/cjs/snk-grid.cjs.entry.js +23 -22
  32. package/dist/cjs/{snk-guides-viewer-5da253af.js → snk-guides-viewer-b7b680d2.js} +19 -8
  33. package/dist/cjs/snk-guides-viewer.cjs.entry.js +10 -9
  34. package/dist/cjs/snk-personalized-filter.cjs.entry.js +14 -16
  35. package/dist/cjs/snk-print-selector.cjs.entry.js +2 -4
  36. package/dist/cjs/snk-simple-crud.cjs.entry.js +43 -85
  37. package/dist/cjs/snk-taskbar-custom-elements.cjs.entry.js +20 -0
  38. package/dist/cjs/snk-taskbar.cjs.entry.js +71 -5
  39. package/dist/cjs/{taskbar-elements-b98dd6e9.js → taskbar-elements-39949c7a.js} +4 -4
  40. package/dist/collection/collection-manifest.json +1 -0
  41. package/dist/collection/components/snk-actions-button/actions/index.js +3 -4
  42. package/dist/collection/components/snk-actions-button/snk-actions-button.js +8 -4
  43. package/dist/collection/components/snk-application/snk-application.js +120 -65
  44. package/dist/collection/components/snk-configurator/snk-configurator.js +19 -1
  45. package/dist/collection/components/snk-crud/snk-crud.js +44 -8
  46. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +60 -2
  47. package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +27 -1
  48. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +65 -28
  49. package/dist/collection/components/snk-data-unit/snk-data-unit.js +22 -6
  50. package/dist/collection/components/snk-entity-list/snk-entity-list.js +0 -23
  51. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +8 -13
  52. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +1 -1
  53. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +21 -16
  54. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +28 -12
  55. package/dist/collection/components/snk-form/SnkFormConfigManager.js +17 -19
  56. package/dist/collection/components/snk-form/snk-form.js +46 -2
  57. package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +5 -15
  58. package/dist/collection/components/snk-grid/snk-grid.js +108 -16
  59. package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js +19 -1
  60. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +28 -12
  61. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +23 -1
  62. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +4 -4
  63. package/dist/collection/components/snk-taskbar/snk-taskbar-custom-elements.js +43 -0
  64. package/dist/collection/components/snk-taskbar/snk-taskbar.css +4 -0
  65. package/dist/collection/components/snk-taskbar/snk-taskbar.js +126 -5
  66. package/dist/collection/lib/configs/ConfigStorage.js +33 -44
  67. package/dist/collection/lib/dataUnit/InMemoryLoader.js +23 -71
  68. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +47 -32
  69. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +0 -24
  70. package/dist/collection/lib/index.js +10 -0
  71. package/dist/collection/lib/resourceid/ResourceIDUtils.js +7 -0
  72. package/dist/collection/lib/utils/PrintUtils.js +18 -9
  73. package/dist/collection/lib/utils/urlutils.js +29 -0
  74. package/dist/components/ConfigStorage.js +161 -48
  75. package/dist/components/DataFetcher.js +79 -234
  76. package/dist/components/PrintUtils.js +213 -0
  77. package/dist/components/ResourceIDUtils.js +10 -0
  78. package/dist/components/SnkFormConfigManager.js +17 -19
  79. package/dist/components/auth-fetcher.js +1 -1
  80. package/dist/components/form-config-fetcher.js +64 -2
  81. package/dist/components/index.d.ts +1 -0
  82. package/dist/components/index.js +1 -0
  83. package/dist/components/snk-actions-button2.js +23 -9
  84. package/dist/components/snk-application2.js +145 -129
  85. package/dist/components/snk-attach2.js +1 -8
  86. package/dist/components/snk-configurator2.js +3 -1
  87. package/dist/components/snk-crud.js +27 -8
  88. package/dist/components/snk-data-unit2.js +6 -5
  89. package/dist/components/snk-detail-view2.js +26 -10
  90. package/dist/components/snk-entity-list.js +0 -4
  91. package/dist/components/snk-filter-bar2.js +12 -12
  92. package/dist/components/snk-filter-detail2.js +8 -13
  93. package/dist/components/snk-filter-modal-item2.js +5 -16
  94. package/dist/components/snk-form-config2.js +5 -15
  95. package/dist/components/snk-form-view2.js +6 -1
  96. package/dist/components/snk-form.js +9 -2
  97. package/dist/components/snk-grid-config2.js +4 -2
  98. package/dist/components/snk-grid2.js +24 -17
  99. package/dist/components/snk-personalized-filter2.js +11 -11
  100. package/dist/components/snk-print-selector.js +1 -1
  101. package/dist/components/snk-simple-crud2.js +30 -73
  102. package/dist/components/snk-taskbar-custom-elements.d.ts +11 -0
  103. package/dist/components/snk-taskbar-custom-elements.js +35 -0
  104. package/dist/components/snk-taskbar2.js +81 -9
  105. package/dist/esm/{ConfigStorage-6887ede4.js → ConfigStorage-4441aa3d.js} +162 -49
  106. package/dist/esm/{DataFetcher-731430d9.js → DataFetcher-1618bffe.js} +79 -234
  107. package/dist/esm/ISave-4412b20c.js +8 -0
  108. package/dist/esm/PrintUtils-3e4ff0f5.js +213 -0
  109. package/dist/esm/ResourceIDUtils-a114189a.js +10 -0
  110. package/dist/esm/{SnkFormConfigManager-6acecf9f.js → SnkFormConfigManager-5a5f85a3.js} +19 -21
  111. package/dist/esm/{auth-fetcher-82d89fe6.js → auth-fetcher-7861187e.js} +1 -1
  112. package/dist/esm/{dataunit-fetcher-ad7a1a3e.js → dataunit-fetcher-53c007be.js} +1 -1
  113. package/dist/esm/{form-config-fetcher-9560730a.js → form-config-fetcher-2fe67341.js} +65 -3
  114. package/dist/esm/index-a7d3d3f1.js +4 -0
  115. package/dist/esm/loader.js +1 -1
  116. package/dist/esm/{pesquisa-fetcher-27dc20ed.js → pesquisa-fetcher-19e81fc8.js} +1 -1
  117. package/dist/esm/sankhyablocks.js +1 -1
  118. package/dist/esm/snk-actions-button.entry.js +19 -11
  119. package/dist/esm/snk-application.entry.js +60 -44
  120. package/dist/esm/snk-attach.entry.js +5 -10
  121. package/dist/esm/snk-configurator.entry.js +2 -1
  122. package/dist/esm/snk-crud.entry.js +30 -13
  123. package/dist/esm/snk-data-exporter.entry.js +3 -2
  124. package/dist/esm/{snk-data-unit-8c4d944d.js → snk-data-unit-1715d2f1.js} +5 -5
  125. package/dist/esm/snk-data-unit.entry.js +1 -1
  126. package/dist/esm/snk-detail-view.entry.js +17 -13
  127. package/dist/esm/snk-entity-list.entry.js +0 -4
  128. package/dist/esm/snk-filter-bar.entry.js +15 -17
  129. package/dist/esm/snk-filter-detail.entry.js +8 -17
  130. package/dist/esm/snk-filter-modal-item.entry.js +7 -20
  131. package/dist/esm/snk-form-config.entry.js +8 -18
  132. package/dist/esm/snk-form-view.entry.js +6 -1
  133. package/dist/esm/snk-form.entry.js +13 -8
  134. package/dist/esm/snk-grid-config.entry.js +6 -6
  135. package/dist/esm/snk-grid.entry.js +23 -22
  136. package/dist/esm/{snk-guides-viewer-d3623a1f.js → snk-guides-viewer-e4fe884d.js} +19 -8
  137. package/dist/esm/snk-guides-viewer.entry.js +10 -9
  138. package/dist/esm/snk-personalized-filter.entry.js +14 -16
  139. package/dist/esm/snk-print-selector.entry.js +1 -3
  140. package/dist/esm/snk-simple-crud.entry.js +34 -76
  141. package/dist/esm/snk-taskbar-custom-elements.entry.js +16 -0
  142. package/dist/esm/snk-taskbar.entry.js +71 -5
  143. package/dist/esm/{taskbar-elements-2c761819.js → taskbar-elements-0a6b8b95.js} +4 -4
  144. package/dist/sankhyablocks/p-0b99a775.entry.js +1 -0
  145. package/dist/sankhyablocks/p-1e30c376.entry.js +1 -0
  146. package/dist/sankhyablocks/p-1fa3acbe.entry.js +1 -0
  147. package/dist/sankhyablocks/p-27dbbb3a.entry.js +1 -0
  148. package/dist/sankhyablocks/p-29b1d77b.entry.js +11 -0
  149. package/dist/sankhyablocks/p-324ce41e.entry.js +1 -0
  150. package/dist/sankhyablocks/p-34604220.entry.js +1 -0
  151. package/dist/sankhyablocks/p-41820e28.entry.js +1 -0
  152. package/dist/sankhyablocks/p-4352324d.entry.js +1 -0
  153. package/dist/sankhyablocks/{p-f6b98398.js → p-449d25e0.js} +2 -2
  154. package/dist/sankhyablocks/p-5051a23a.entry.js +1 -0
  155. package/dist/sankhyablocks/p-5526ab67.js +1 -0
  156. package/dist/sankhyablocks/p-5b2ee1d3.js +1 -0
  157. package/dist/sankhyablocks/p-5da848bb.js +26 -0
  158. package/dist/sankhyablocks/p-6098d844.entry.js +1 -0
  159. package/dist/sankhyablocks/p-648a7c72.entry.js +1 -0
  160. package/dist/sankhyablocks/p-688dcb4c.js +1 -0
  161. package/dist/sankhyablocks/p-72fc257b.entry.js +1 -0
  162. package/dist/sankhyablocks/p-7d6eca73.entry.js +1 -0
  163. package/dist/sankhyablocks/p-81a7f74c.js +1 -0
  164. package/dist/sankhyablocks/p-8d884fab.js +1 -0
  165. package/dist/sankhyablocks/p-90b5d1af.entry.js +1 -0
  166. package/dist/sankhyablocks/p-989937ee.entry.js +1 -0
  167. package/dist/sankhyablocks/p-9a270401.entry.js +1 -0
  168. package/dist/sankhyablocks/p-9e7d65a4.js +1 -0
  169. package/dist/sankhyablocks/{p-1bed2c42.js → p-a75e892a.js} +1 -1
  170. package/dist/sankhyablocks/p-a81996df.js +1 -0
  171. package/dist/sankhyablocks/p-c555075c.entry.js +1 -0
  172. package/dist/sankhyablocks/{p-a2493d11.js → p-c9841939.js} +1 -1
  173. package/dist/sankhyablocks/p-ca1522bc.entry.js +1 -0
  174. package/dist/sankhyablocks/p-cbed6235.entry.js +1 -0
  175. package/dist/sankhyablocks/p-d4f9ee17.entry.js +1 -0
  176. package/dist/sankhyablocks/p-daa687aa.js +56 -0
  177. package/dist/sankhyablocks/p-e1cb1f0b.js +1 -0
  178. package/dist/sankhyablocks/p-eb1a650a.entry.js +1 -0
  179. package/dist/sankhyablocks/p-f784010c.entry.js +1 -0
  180. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  181. package/dist/types/components/snk-actions-button/actions/index.d.ts +2 -1
  182. package/dist/types/components/snk-application/snk-application.d.ts +9 -22
  183. package/dist/types/components/snk-configurator/snk-configurator.d.ts +4 -0
  184. package/dist/types/components/snk-crud/snk-crud.d.ts +6 -0
  185. package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +12 -0
  186. package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +5 -0
  187. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +13 -2
  188. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +4 -0
  189. package/dist/types/components/snk-entity-list/snk-entity-list.d.ts +0 -4
  190. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +0 -3
  191. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +1 -1
  192. package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +5 -4
  193. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
  194. package/dist/types/components/snk-form/SnkFormConfigManager.d.ts +5 -4
  195. package/dist/types/components/snk-form/snk-form.d.ts +9 -1
  196. package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +0 -2
  197. package/dist/types/components/snk-grid/snk-grid.d.ts +17 -1
  198. package/dist/types/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.d.ts +4 -0
  199. package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +5 -1
  200. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +4 -0
  201. package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +2 -2
  202. package/dist/types/components/snk-taskbar/snk-taskbar-custom-elements.d.ts +7 -0
  203. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +27 -0
  204. package/dist/types/components.d.ts +203 -22
  205. package/dist/types/lib/configs/ConfigStorage.d.ts +11 -13
  206. package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +2 -8
  207. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -1
  208. package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +0 -1
  209. package/dist/types/lib/index.d.ts +11 -0
  210. package/dist/types/lib/resourceid/ResourceIDUtils.d.ts +3 -0
  211. package/dist/types/lib/utils/PrintUtils.d.ts +1 -0
  212. package/dist/types/lib/utils/urlutils.d.ts +14 -0
  213. package/package.json +2 -2
  214. package/react/components.d.ts +1 -0
  215. package/react/components.js +1 -0
  216. package/react/components.js.map +1 -1
  217. package/dist/cjs/filter-bar-config-fetcher-f13a1aff.js +0 -155
  218. package/dist/cjs/resource-fetcher-a6e6c5fd.js +0 -68
  219. package/dist/components/filter-bar-config-fetcher.js +0 -153
  220. package/dist/components/resource-fetcher.js +0 -66
  221. package/dist/esm/filter-bar-config-fetcher-553c5463.js +0 -153
  222. package/dist/esm/resource-fetcher-0586b1fc.js +0 -66
  223. package/dist/sankhyablocks/p-000d073b.entry.js +0 -1
  224. package/dist/sankhyablocks/p-162f5d21.entry.js +0 -1
  225. package/dist/sankhyablocks/p-1dc76c50.js +0 -1
  226. package/dist/sankhyablocks/p-216f081a.entry.js +0 -1
  227. package/dist/sankhyablocks/p-24b18442.entry.js +0 -1
  228. package/dist/sankhyablocks/p-301d4e34.js +0 -1
  229. package/dist/sankhyablocks/p-4374bc89.entry.js +0 -1
  230. package/dist/sankhyablocks/p-564efc43.js +0 -1
  231. package/dist/sankhyablocks/p-5fe223c9.entry.js +0 -1
  232. package/dist/sankhyablocks/p-61651a40.entry.js +0 -1
  233. package/dist/sankhyablocks/p-70d4a90a.entry.js +0 -1
  234. package/dist/sankhyablocks/p-7bd353de.entry.js +0 -1
  235. package/dist/sankhyablocks/p-837831c2.js +0 -56
  236. package/dist/sankhyablocks/p-85ec10c9.entry.js +0 -1
  237. package/dist/sankhyablocks/p-89d46727.entry.js +0 -1
  238. package/dist/sankhyablocks/p-8e8b5fc7.js +0 -1
  239. package/dist/sankhyablocks/p-8e96581f.js +0 -17
  240. package/dist/sankhyablocks/p-9b2af526.entry.js +0 -1
  241. package/dist/sankhyablocks/p-9db7e50a.js +0 -10
  242. package/dist/sankhyablocks/p-a2f32d4e.entry.js +0 -1
  243. package/dist/sankhyablocks/p-a7eaea51.entry.js +0 -1
  244. package/dist/sankhyablocks/p-a84b1ca2.entry.js +0 -1
  245. package/dist/sankhyablocks/p-befbc9ee.entry.js +0 -1
  246. package/dist/sankhyablocks/p-c32b9d7c.entry.js +0 -1
  247. package/dist/sankhyablocks/p-c3943e7e.entry.js +0 -11
  248. package/dist/sankhyablocks/p-c6380ea2.entry.js +0 -1
  249. package/dist/sankhyablocks/p-c7d1e26a.js +0 -1
  250. package/dist/sankhyablocks/p-cd40ab53.entry.js +0 -1
  251. package/dist/sankhyablocks/p-d41198ff.js +0 -1
  252. package/dist/sankhyablocks/p-de69b4b0.entry.js +0 -1
  253. package/dist/sankhyablocks/p-f9f385eb.entry.js +0 -1
@@ -1,20 +1,21 @@
1
- export { S as snk_guides_viewer } from './snk-guides-viewer-d3623a1f.js';
1
+ export { S as snk_guides_viewer } from './snk-guides-viewer-e4fe884d.js';
2
2
  import './index-a7d3d3f1.js';
3
3
  import '@sankhyalabs/core';
4
- import './SnkFormConfigManager-6acecf9f.js';
5
- import './ConfigStorage-6887ede4.js';
6
- import './form-config-fetcher-9560730a.js';
7
- import './DataFetcher-731430d9.js';
4
+ import './SnkFormConfigManager-5a5f85a3.js';
5
+ import './ConfigStorage-4441aa3d.js';
6
+ import './form-config-fetcher-2fe67341.js';
7
+ import './DataFetcher-1618bffe.js';
8
8
  import './_commonjsHelpers-9943807e.js';
9
9
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
10
- import './resource-fetcher-0586b1fc.js';
11
- import './filter-bar-config-fetcher-553c5463.js';
10
+ import './PrintUtils-3e4ff0f5.js';
12
11
  import './filter-item-type.enum-5028ed3f.js';
13
12
  import '@sankhyalabs/ezui/dist/collection/utils/form';
14
13
  import './taskbar-processor-94402e6e.js';
15
- import './taskbar-elements-2c761819.js';
14
+ import './taskbar-elements-0a6b8b95.js';
16
15
  import './index-1564817d.js';
17
16
  import './index-bdf75557.js';
18
17
  import './constants-3644f1b6.js';
19
- import './pesquisa-fetcher-27dc20ed.js';
18
+ import './pesquisa-fetcher-19e81fc8.js';
19
+ import './ISave-4412b20c.js';
20
+ import '@sankhyalabs/ezui/dist/collection/utils/constants';
20
21
  import '@sankhyalabs/core/dist/dataunit/DataUnit';
@@ -1,17 +1,16 @@
1
1
  import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host } from './index-a7d3d3f1.js';
2
2
  import { StringUtils, ObjectUtils, ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-75fb0106.js';
4
- import { P as PersonalizedFilterFetcher, C as ConfigStorage } from './ConfigStorage-6887ede4.js';
4
+ import { P as PersonalizedFilterFetcher, C as ConfigStorage } from './ConfigStorage-4441aa3d.js';
5
5
  import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
6
6
  import { a as FilterGroupCondition } from './index-ae591a44.js';
7
7
  import { s as store } from './index-bdf75557.js';
8
8
  import './filter-item-type.enum-5028ed3f.js';
9
- import './form-config-fetcher-9560730a.js';
10
- import './DataFetcher-731430d9.js';
9
+ import './form-config-fetcher-2fe67341.js';
10
+ import './DataFetcher-1618bffe.js';
11
11
  import './_commonjsHelpers-9943807e.js';
12
12
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
13
- import './resource-fetcher-0586b1fc.js';
14
- import './filter-bar-config-fetcher-553c5463.js';
13
+ import './PrintUtils-3e4ff0f5.js';
15
14
 
16
15
  const snkPersonalizedFilterCss = ".sc-snk-personalized-filter-h{display:flex;height:100%;padding:var(--space--large, 24px);--snk-personalized-filter--width:100%;--snk-personalized-filter--height:100%;--snk-personalized-filter--background-color-line:var(--color--disable-secondary);--snk-personalized-filter--margin-line:var(--border--radius-medium, 12px)}.snk-personalized-filter.sc-snk-personalized-filter{height:var(--snk-personalized-filter--width);width:var(--snk-personalized-filter--height)}.snk-personalized-filter__header-actions.sc-snk-personalized-filter{display:flex;gap:var(--space--medium)}.snk-personalized-filter__group.sc-snk-personalized-filter{flex:1}.snk-personalized-filter__expression-input--line.sc-snk-personalized-filter{width:100%;height:2px;background-color:var(--snk-personalized-filter--background-color-line);margin-top:var(--snk-personalized-filter--margin-line);margin-bottom:var(--snk-personalized-filter--margin-line)}.ez-box__main.sc-snk-personalized-filter{height:90%}.snk-personalized-filter__button-mode.sc-snk-personalized-filter{height:35px}";
17
16
 
@@ -41,6 +40,7 @@ const SnkPersonalizedFilter = class {
41
40
  this.entityUri = undefined;
42
41
  this.filterId = undefined;
43
42
  this.configName = undefined;
43
+ this.resourceID = undefined;
44
44
  }
45
45
  /*
46
46
  * Cria um novo filtro se não houver nenhum filtro existente
@@ -77,17 +77,15 @@ const SnkPersonalizedFilter = class {
77
77
  this._filterAssistent = ObjectUtils.copy(newPersonalizedFilter);
78
78
  }
79
79
  loadFilter(newValue, oldValue) {
80
- if (newValue == null || oldValue == newValue) {
80
+ if (newValue == null || oldValue == newValue || this.resourceID == undefined) {
81
81
  return;
82
82
  }
83
- ConfigStorage.get().then((_instance) => {
84
- ConfigStorage.loadPersonalizedFilter(newValue, this.configName)
85
- .then((resp) => {
86
- const personalizedFilter = this.addLabelToItems(resp);
87
- this._filterAssistent = personalizedFilter;
88
- this._originalFilterAssistent = ObjectUtils.copy(personalizedFilter);
89
- this._filterAssistentMode = this._filterAssistent.hasOwnProperty("assistent") && this._filterAssistent.assistent != undefined;
90
- });
83
+ ConfigStorage.loadPersonalizedFilter(newValue, this.resourceID, this.configName)
84
+ .then((resp) => {
85
+ const personalizedFilter = this.addLabelToItems(resp);
86
+ this._filterAssistent = personalizedFilter;
87
+ this._originalFilterAssistent = ObjectUtils.copy(personalizedFilter);
88
+ this._filterAssistentMode = this._filterAssistent.hasOwnProperty("assistent") && this._filterAssistent.assistent != undefined;
91
89
  });
92
90
  }
93
91
  componentWillLoad() {
@@ -112,7 +110,7 @@ const SnkPersonalizedFilter = class {
112
110
  return this._application.messagesBuilder.getMessage(key, params);
113
111
  }
114
112
  saveFilter() {
115
- ConfigStorage.savePersonalizedFilter(this._filterAssistent, this.configName).then((personalizedFilter) => {
113
+ ConfigStorage.savePersonalizedFilter(this._filterAssistent, this.resourceID, this.configName).then((personalizedFilter) => {
116
114
  this._elButtonSave.enabled = false;
117
115
  const messageToken = !!this._filterAssistent.id ? 'confirmEdit' : 'confirmSave';
118
116
  ApplicationUtils.info(this.getMessage(`snkPersonalizedFilter.${messageToken}.title`), { iconName: "check" });
@@ -123,7 +121,7 @@ const SnkPersonalizedFilter = class {
123
121
  });
124
122
  }
125
123
  removeFilter() {
126
- ConfigStorage.removePersonalizedFilter(this._filterAssistent, this.configName);
124
+ ConfigStorage.removePersonalizedFilter(this._filterAssistent, this.resourceID, this.configName);
127
125
  }
128
126
  hasChangesToSave() {
129
127
  return JSON.stringify(this._filterAssistent) === JSON.stringify(this._originalFilterAssistent);
@@ -1,10 +1,8 @@
1
1
  import { r as registerInstance, h, H as Host, g as getElement } from './index-a7d3d3f1.js';
2
- import { P as PrintUtils } from './DataFetcher-731430d9.js';
2
+ import { P as PrintUtils } from './PrintUtils-3e4ff0f5.js';
3
3
  import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  import { ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
5
5
  import ModalButtonStatus from '@sankhyalabs/ezui/dist/collection/components/ez-modal-container/modal-button-status';
6
- import './_commonjsHelpers-9943807e.js';
7
- import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
8
6
 
9
7
  const snkPrintSelectorCss = ".sc-snk-print-selector-h{max-height:100%}ez-modal-container.sc-snk-print-selector{--ez-modal-container-overflow-y:hidden}ez-list.sc-snk-print-selector{height:100%}.list-scroll.sc-snk-print-selector{height:100%;overflow-y:auto;padding-right:var(--snk-grid-config__main--padding-right)}.with-header.sc-snk-print-selector{max-height:calc(100% - 125px)}.without-header.sc-snk-print-selector{max-height:calc(100% - 85px)}.list-scroll.sc-snk-print-selector::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}.hidden.sc-snk-print-selector{display:none}";
10
8
 
@@ -1,43 +1,61 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement } from './index-a7d3d3f1.js';
2
- import { DataUnit, StringUtils, SortMode, DataType, ChangeOperation, ObjectUtils, ApplicationContext, UserInterface } from '@sankhyalabs/core';
2
+ import { DataUnit, defaultDataLoader, StringUtils, ChangeOperation, ObjectUtils, ApplicationContext, DataType, UserInterface } from '@sankhyalabs/core';
3
3
  import { c as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants-3644f1b6.js';
4
- import { T as TaskbarElement } from './taskbar-elements-2c761819.js';
5
- import './DataFetcher-731430d9.js';
6
- import './pesquisa-fetcher-27dc20ed.js';
4
+ import { T as TaskbarElement } from './taskbar-elements-0a6b8b95.js';
5
+ import './DataFetcher-1618bffe.js';
6
+ import './pesquisa-fetcher-19e81fc8.js';
7
7
  import { P as PresentationMode } from './index-1564817d.js';
8
+ import './ISave-4412b20c.js';
9
+ import '@sankhyalabs/ezui/dist/collection/utils/constants';
10
+ import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
11
+ import './filter-item-type.enum-5028ed3f.js';
12
+ import './form-config-fetcher-2fe67341.js';
8
13
  import { T as TaskbarProcessor } from './taskbar-processor-94402e6e.js';
9
- import { DISTINCT_FILTER_NAME_PREFIX } from '@sankhyalabs/ezui/dist/collection/utils/constants';
10
14
  import { S as SnkMultiSelectionListDataSource } from './SnkMultiSelectionListDataSource-892f37f9.js';
11
15
  import './index-bdf75557.js';
12
16
  import './_commonjsHelpers-9943807e.js';
13
- import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
17
+ import './PrintUtils-3e4ff0f5.js';
14
18
 
15
19
  class InMemoryLoader {
16
20
  constructor(metadata, records) {
17
- this.records = records || [];
21
+ this.records = records;
18
22
  this.metadata = metadata;
19
23
  this._dataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
20
24
  this._dataUnit.metadataLoader = () => this.metadaLoader();
21
- this._dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
25
+ this._dataUnit.dataLoader = (dataUnit, request) => defaultDataLoader(dataUnit, request, this.getRecordsToLoad());
22
26
  this._dataUnit.saveLoader = (_dataUnit, changes) => this.saveLoader(_dataUnit, changes);
23
27
  this._dataUnit.removeLoader = (_dataUnit, recordIds) => this.removeLoader(_dataUnit, recordIds);
24
28
  this.dataUnit.loadMetadata().then(() => this.dataUnit.loadData());
25
29
  }
30
+ getRecordsToLoad() {
31
+ if (this._initialRecords) {
32
+ try {
33
+ return this._initialRecords;
34
+ }
35
+ finally {
36
+ this._initialRecords = undefined;
37
+ }
38
+ }
39
+ return this.dataUnit.records;
40
+ }
26
41
  get dataUnit() {
27
42
  return this._dataUnit;
28
43
  }
29
44
  get records() {
30
- return this._records;
45
+ return this.dataUnit.records;
31
46
  }
32
47
  set records(records) {
33
- this._records = records === null || records === void 0 ? void 0 : records.map(record => {
48
+ const newRecords = records === null || records === void 0 ? void 0 : records.map(record => {
34
49
  if (!record["__record__id__"]) {
35
50
  record["__record__id__"] = this.generateUniqueId();
36
51
  }
37
52
  return record;
38
53
  });
39
54
  if (this._dataUnit) {
40
- this._dataUnit.records = [...this._records];
55
+ this._dataUnit.records = newRecords;
56
+ }
57
+ else {
58
+ this._initialRecords = newRecords;
41
59
  }
42
60
  }
43
61
  get metadata() {
@@ -55,76 +73,16 @@ class InMemoryLoader {
55
73
  metadaLoader() {
56
74
  return Promise.resolve(this._metadata);
57
75
  }
58
- dataLoader(dataUnit, request) {
59
- const filters = this.getColumnFilters(dataUnit);
60
- let records = this.applyFilters(filters);
61
- if (request.sort) {
62
- request.sort.forEach(sort => {
63
- records = records.sort((recordA, recordB) => {
64
- const fieldA = recordA[sort.field];
65
- const fieldB = recordB[sort.field];
66
- const sortFn = this.getSortFn(sort.dataType);
67
- return sortFn(fieldA, fieldB) * (sort.mode == SortMode.ASC ? 1 : -1);
68
- });
69
- });
70
- }
71
- return Promise.resolve({ records: records });
72
- }
73
- applyFilters(filters) {
74
- let records = [...this._records];
75
- filters.forEach(filter => {
76
- records = records.filter(record => { var _a; return filter.values.includes((_a = record[filter.column]) === null || _a === void 0 ? void 0 : _a.toString()); });
77
- });
78
- return records;
79
- }
80
- getColumnFilters(dataUnit) {
81
- var _a, _b;
82
- const allFilters = (_a = dataUnit.getFilters()) !== null && _a !== void 0 ? _a : [];
83
- const columnFilters = (_b = allFilters.filter(filter => { var _a; return (_a = filter.name) === null || _a === void 0 ? void 0 : _a.includes(DISTINCT_FILTER_NAME_PREFIX); })) !== null && _b !== void 0 ? _b : [];
84
- return columnFilters.map(filter => {
85
- var _a, _b;
86
- return {
87
- column: (_b = (_a = filter.name) === null || _a === void 0 ? void 0 : _a.replace(DISTINCT_FILTER_NAME_PREFIX, "")) !== null && _b !== void 0 ? _b : "",
88
- values: filter.params.map(param => param.value),
89
- };
90
- });
91
- }
92
- getSortFn(type) {
93
- switch (type) {
94
- case DataType.NUMBER:
95
- return this.sortNumber;
96
- case DataType.DATE:
97
- return this.sortDate;
98
- case DataType.OBJECT:
99
- return this.sortObject;
100
- default:
101
- return StringUtils.compare;
102
- }
103
- }
104
- sortObject(a, b) {
105
- return StringUtils.compare(a === null || a === void 0 ? void 0 : a["label"], b === null || b === void 0 ? void 0 : b["label"]);
106
- }
107
- sortNumber(a, b) {
108
- return a - b;
109
- }
110
- sortDate(a, b) {
111
- let timeA = a.getTime(), timeB = b.getTime();
112
- return timeA === timeB ? 0 : (timeA < timeB ? -1 : 1);
113
- }
114
76
  saveLoader(_dataUnit, changes) {
115
77
  return new Promise((resolve) => {
116
78
  let dataUnitRecords = [];
117
79
  changes.forEach(change => {
118
80
  let { record, updatingFields, operation } = change;
119
- let isAdd = false;
81
+ const changedRecord = Object.assign(Object.assign({}, record), updatingFields);
120
82
  if (operation === ChangeOperation.INSERT ||
121
83
  operation === ChangeOperation.COPY) {
122
- record["__old__id__"] = record["__record__id__"];
123
- record["__record__id__"] = this.generateUniqueId();
124
- isAdd = true;
125
- }
126
- const changedRecord = Object.assign(Object.assign({}, record), updatingFields);
127
- if (isAdd) {
84
+ changedRecord["__old__id__"] = record["__record__id__"];
85
+ changedRecord["__record__id__"] = this.generateUniqueId();
128
86
  this.records.push(changedRecord);
129
87
  }
130
88
  else {
@@ -138,7 +96,6 @@ class InMemoryLoader {
138
96
  }
139
97
  removeLoader(_dataUnit, recordIds) {
140
98
  return new Promise((resolve) => {
141
- this._records = this._records.filter(record => !recordIds.includes(record["__record__id__"]));
142
99
  resolve(recordIds);
143
100
  });
144
101
  }
@@ -153,6 +110,7 @@ const SnkSimpleCrud = class {
153
110
  this.dataStateChange = createEvent(this, "dataStateChange", 3);
154
111
  this.dataUnitReady = createEvent(this, "dataUnitReady", 3);
155
112
  this.actionClick = createEvent(this, "actionClick", 7);
113
+ this.formItemsReady = createEvent(this, "formItemsReady", 7);
156
114
  this.REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER"];
157
115
  this.REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER"];
158
116
  this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
@@ -319,7 +277,7 @@ const SnkSimpleCrud = class {
319
277
  }
320
278
  render() {
321
279
  var _a;
322
- return (h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-flex ez-box ez-box--shadow" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium ez-margin-bottom--large", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }), h("ez-view-stack", { class: "ez-flex ez-flex--column", ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), columnfilterDataSource: this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
280
+ return (h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-flex ez-box ez-box--shadow" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium ez-margin-bottom--large", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { class: "ez-flex ez-flex--column", ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), columnfilterDataSource: this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
323
281
  ? undefined
324
282
  : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { dataUnit: this.dataUnit, config: this.formConfig }))))));
325
283
  }
@@ -0,0 +1,16 @@
1
+ import { r as registerInstance, h, H as Host } from './index-a7d3d3f1.js';
2
+
3
+ const snkTaskbarCss = ".sc-snk-taskbar-custom-elements-h{display:flex}.taskbar-custom-elements-container.sc-snk-taskbar-custom-elements{display:none}";
4
+
5
+ const SnkTaskbarCustomElements = class {
6
+ constructor(hostRef) {
7
+ registerInstance(this, hostRef);
8
+ this.slot = 'TASKBAR_CUSTOM_ELEMENTS';
9
+ }
10
+ render() {
11
+ return (h(Host, { slot: this.slot }, h("div", { id: this.slot, class: "taskbar-custom-elements-container" }, h("slot", null))));
12
+ }
13
+ };
14
+ SnkTaskbarCustomElements.style = snkTaskbarCss;
15
+
16
+ export { SnkTaskbarCustomElements as snk_taskbar_custom_elements };
@@ -1,16 +1,17 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a7d3d3f1.js';
2
2
  import { StringUtils, ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { A as AuthorizationConfig } from './AuthorizationConfig-dcbd207a.js';
4
- import { T as TaskbarElement, V as VisibleWhenForbidden, A as AuthorizationElements, b as buildElem, a as buildCustomButton } from './taskbar-elements-2c761819.js';
4
+ import { T as TaskbarElement, V as VisibleWhenForbidden, A as AuthorizationElements, b as buildElem, a as buildCustomButton } from './taskbar-elements-0a6b8b95.js';
5
5
  import { P as PresentationMode } from './index-1564817d.js';
6
6
  import './index-bdf75557.js';
7
7
 
8
- const snkTaskbarCss = ".sc-snk-taskbar-h{display:flex}";
8
+ const snkTaskbarCss = ".sc-snk-taskbar-h{display:flex}.taskbar-custom-elements-container.sc-snk-taskbar{display:none}";
9
9
 
10
10
  const SnkTaskbar = class {
11
11
  constructor(hostRef) {
12
12
  registerInstance(this, hostRef);
13
13
  this.actionClick = createEvent(this, "actionClick", 7);
14
+ this.TASKBAR_ITEM_ID_PREFIX = 'TASKBAR_ITEM_';
14
15
  this._titleKeyByElement = {
15
16
  [TaskbarElement.UPDATE]: "snkTaskbar.titleUpdate",
16
17
  [TaskbarElement.PREVIOUS]: "snkTaskbar.titlePrevious",
@@ -28,7 +29,13 @@ const SnkTaskbar = class {
28
29
  [TaskbarElement.ATTACH]: "snkTaskbar.titleAttach",
29
30
  };
30
31
  this._permissions = undefined;
32
+ this._customElements = undefined;
33
+ this._customElementsId = undefined;
34
+ this._slotContainer = undefined;
35
+ this.customSlotId = "TASKBAR_CUSTOM_ELEMENTS";
36
+ this.customContainerId = undefined;
31
37
  this.configName = undefined;
38
+ this.resourceID = undefined;
32
39
  this.buttons = undefined;
33
40
  this.customButtons = undefined;
34
41
  this.actionsList = undefined;
@@ -167,14 +174,52 @@ const SnkTaskbar = class {
167
174
  return true;
168
175
  });
169
176
  }
177
+ appendCustomElementsInTaskbar() {
178
+ this._customElementsId.forEach(id => {
179
+ const elementId = id.replace(this.TASKBAR_ITEM_ID_PREFIX, '');
180
+ const customElement = this._customElements.get(elementId);
181
+ const container = this._element.querySelector(`#${id}`);
182
+ if (container) {
183
+ container === null || container === void 0 ? void 0 : container.appendChild(customElement);
184
+ }
185
+ else {
186
+ this.unlinkCustomElementFromTaskbar(customElement);
187
+ }
188
+ });
189
+ }
190
+ addCustomElementContainer(elem) {
191
+ const elementId = `${this.TASKBAR_ITEM_ID_PREFIX}${elem}`;
192
+ if (!this._customElementsId.includes(elementId)) {
193
+ this._customElementsId.push(elementId);
194
+ }
195
+ return h("span", { key: elementId, id: elementId });
196
+ }
197
+ getCustomElements() {
198
+ var _a, _b;
199
+ this._customElementsId = [];
200
+ this._customElements = new Map();
201
+ this._slotContainer = this.buildSlotContainer();
202
+ const customElementsArray = Array.from((_b = (_a = this._slotContainer) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : []);
203
+ customElementsArray.forEach(item => this._customElements.set(item.id, item));
204
+ }
205
+ buildSlotContainer() {
206
+ if (this.customContainerId) {
207
+ const container = document.querySelector(`#${this.customContainerId}`);
208
+ return container === null || container === void 0 ? void 0 : container.querySelector(`#${this.customSlotId}`);
209
+ }
210
+ else {
211
+ return this._element.querySelector(`#${this.customSlotId}`);
212
+ }
213
+ }
170
214
  componentWillLoad() {
171
215
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
172
216
  if (this._application) {
173
- this._application.getAllAccess().then(access => this._permissions = access);
217
+ this._application.getAllAccess(this.resourceID).then(access => this._permissions = access);
174
218
  }
175
219
  else {
176
220
  this._permissions = {};
177
221
  }
222
+ this.getCustomElements();
178
223
  }
179
224
  componentWillRender() {
180
225
  if (this._definitions == undefined && this._permissions) {
@@ -186,12 +231,30 @@ const SnkTaskbar = class {
186
231
  const dataInfo = { dataUnit: this.dataUnit };
187
232
  ElementIDUtils.addIDInfo(this._element, null, dataInfo);
188
233
  }
234
+ componentDidRender() {
235
+ this.appendCustomElementsInTaskbar();
236
+ }
237
+ disconnectedCallback() {
238
+ this.unlinkAllCustomElements();
239
+ }
240
+ unlinkAllCustomElements() {
241
+ var _a;
242
+ (_a = this._customElementsId) === null || _a === void 0 ? void 0 : _a.forEach(id => {
243
+ const elementId = id.replace(this.TASKBAR_ITEM_ID_PREFIX, '');
244
+ const customElement = this._customElements.get(elementId);
245
+ this.unlinkCustomElementFromTaskbar(customElement);
246
+ });
247
+ }
248
+ unlinkCustomElementFromTaskbar(customElement) {
249
+ this._slotContainer.appendChild(customElement);
250
+ }
189
251
  render() {
190
252
  if (this._definitions === undefined) {
191
253
  return undefined;
192
254
  }
193
255
  let index = 0;
194
256
  return (h(Host, null, this.removeEmpty(this._definitions.map((elem) => {
257
+ var _a;
195
258
  if (elem === TaskbarElement.DIVIDER) {
196
259
  index = 0;
197
260
  }
@@ -201,11 +264,14 @@ const SnkTaskbar = class {
201
264
  if (TaskbarElement[elem]) {
202
265
  return this.getElement(index, TaskbarElement[elem]);
203
266
  }
204
- if (this.customButtons.has(elem)) {
267
+ if ((_a = this.customButtons) === null || _a === void 0 ? void 0 : _a.has(elem)) {
205
268
  return this.getElement(index, this.customButtons.get(elem));
206
269
  }
270
+ if (this._customElements.has(elem)) {
271
+ return this.addCustomElementContainer(elem);
272
+ }
207
273
  return h("slot", { name: elem });
208
- }))));
274
+ })), h("div", { class: "taskbar-custom-elements-container" }, h("slot", { name: this.customSlotId }))));
209
275
  }
210
276
  get _element() { return getElement(this); }
211
277
  static get watchers() { return {
@@ -100,18 +100,18 @@ const buildElem = (element, className, dataElementId, getTitle, action, isEnable
100
100
  }
101
101
  };
102
102
  function textButton(name, className, dataElementId, text, title, action, isEnabled) {
103
- return h("ez-button", { title: title, label: text, size: "small", class: className, "data-element-id": dataElementId, enabled: isEnabled(name), onClick: () => action(name) });
103
+ return h("ez-button", { key: dataElementId, title: title, label: text, size: "small", class: className, "data-element-id": dataElementId, enabled: isEnabled(name), onClick: () => action(name) });
104
104
  }
105
105
  function iconButton(iconName, name, className, dataElementId, title, action, isEnabled) {
106
- return h("ez-button", { title: title, mode: "icon", size: "small", class: className, "data-element-id": dataElementId, iconName: iconName, enabled: isEnabled(name), onClick: () => action(name) });
106
+ return h("ez-button", { key: dataElementId, title: title, mode: "icon", size: "small", class: className, "data-element-id": dataElementId, iconName: iconName, enabled: isEnabled(name), onClick: () => action(name) });
107
107
  }
108
108
  function iconTextButton(iconName, name, className, dataElementId, text, title, action, isEnabled) {
109
- return h("ez-button", { title: title, label: text, size: "small", class: className, "data-element-id": dataElementId, enabled: isEnabled(name), onClick: () => action(name) },
109
+ return h("ez-button", { key: dataElementId, title: title, label: text, size: "small", class: className, "data-element-id": dataElementId, enabled: isEnabled(name), onClick: () => action(name) },
110
110
  h("ez-icon", { class: "ez-padding-right--small", slot: "leftIcon", iconName: iconName }));
111
111
  }
112
112
  function actionButton(element, className, dataElementId, title, action, isEnabled, actions) {
113
113
  return actions && actions.length > 0
114
- ? h("ez-actions-button", { title: title, size: "small", "data-element-id": dataElementId, arrowActive: true, class: className, enabled: isEnabled(element), onEzAction: (evt) => action(evt.detail.value), actions: actions })
114
+ ? h("ez-actions-button", { key: dataElementId, title: title, size: "small", "data-element-id": dataElementId, arrowActive: true, class: className, enabled: isEnabled(element), onEzAction: (evt) => action(evt.detail.value), actions: actions })
115
115
  : undefined;
116
116
  }
117
117
 
@@ -0,0 +1 @@
1
+ import{r as t,c as i,h as e,H as s,g as r}from"./p-d2d301a6.js";import{ElementIDUtils as a,ObjectUtils as l}from"@sankhyalabs/core";import{F as o}from"./p-584d7212.js";import{E as n}from"./p-1a68fb59.js";import{C as d}from"./p-daa687aa.js";import{F as h}from"./p-d9804798.js";import"./p-5da848bb.js";import"./p-a81996df.js";import"./p-112455b1.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-8d884fab.js";const p=class{constructor(e){t(this,e),this.filterChange=i(this,"filterChange",7),this.editPersonalizedFilter=i(this,"editPersonalizedFilter",7),this.addPersonalizedFilter=i(this,"addPersonalizedFilter",7),this.filterItem=void 0,this.configName=void 0,this.resourceID=void 0}observeFilterItem(t){var i,e;this._editor&&(this._editor.config=t),null===(e=null===(i=this._editor)||void 0===i?void 0:i.reloadList)||void 0===e||e.call(i),this.filterChange.emit(t)}getContentEditorConfig(){const t={presentationMode:n.MODAL};switch(this.filterItem.type){case o.BINARY_SELECT:return{tag:"snk-filter-binary-select",props:t};case o.MULTI_SELECT:return{tag:"snk-filter-multi-select"};case o.PERIOD:return{tag:"snk-filter-period",props:t};case o.SEARCH:return{tag:"snk-filter-search"};case o.NUMBER:return{tag:"snk-filter-number"};case o.PERSONALIZED:return this.buildSnkFilterPersonalizedProps();case o.MULTI_LIST:return{tag:"snk-entity-list",props:{maxHeightList:"640px",rightListSlotBuilder:t=>this.buildRightSlot(t)}}}return{tag:"snk-filter-text"}}buildSnkFilterPersonalizedProps(){return{tag:"snk-personalized-filter-editor",props:{onDeleteFilter:t=>this.handleDeleteFilter(t.detail,o.PERSONALIZED),onEditFilter:t=>this.editPersonalizedFilter.emit(t.detail),onAddFilter:()=>this.addPersonalizedFilter.emit()}}}isVisible(t){return!!this.filterItem.visible||void 0!==t}updateFilterValue(t){const i=void 0!==(null==t?void 0:t.value)?t.value:t;this.filterItem=Object.assign(Object.assign({},this.filterItem),null!=this.filterItem.groupedItems?{visible:i>0,value:i,groupedItems:t.items}:{value:this.filterItem.type===o.SEARCH?t:i,visible:this.isVisible(i)})}handleDeleteFilter(t,i){i===o.PERSONALIZED&&d.removePersonalizedFilter(t,this.resourceID,this.configName)}componentDidLoad(){if(this._element){a.addIDInfo(this._element);const t=this._element.getAttribute(a.DATA_ELEMENT_ID_ATTRIBUTE_NAME);this._idContentEditor=`${t}_${this.filterItem.id}`}}buildRightSlot(t){return e("ez-icon",{iconName:"delete",onClick:()=>this.removeValueFromConfig(t)})}removeValueFromConfig(t){var i,e,s;const r=null===(e=null===(i=this.filterItem)||void 0===i?void 0:i.value)||void 0===e?void 0:e.findIndex((({id:i})=>i===t.id)),a=l.copy(this.filterItem);null===(s=null==a?void 0:a.value)||void 0===s||s.splice(r,1),this.updateFilterValue(a.value)}canShowDetailModal(){const{CUSTOM_FILTER:t,OTHER_FILTERS:i}=h;return![t,i].includes(this.filterItem.filterType)&&this.filterItem.type!==o.BINARY_SELECT}render(){const{tag:t,props:i}=this.getContentEditorConfig();return e(s,null,e("div",{class:"ez-flex ez-flex--column grow"},this.canShowDetailModal()&&e("div",{class:"col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center"},e("div",{class:"ez-title ez-title--small ez-title--primary grow"},this.filterItem.detailModal)),e(t,Object.assign({ref:t=>this._editor=t,config:this.filterItem,value:this.filterItem.value,onValueChanged:t=>this.updateFilterValue(t.detail),"data-element-id":this._idContentEditor},i))))}get _element(){return r(this)}static get watchers(){return{filterItem:["observeFilterItem"]}}};p.style=".grow{flex-grow:1}.gap{gap:4px}";export{p as snk_filter_modal_item}
@@ -0,0 +1 @@
1
+ import{r as t,c as i,h as s,H as e,g as a}from"./p-d2d301a6.js";import{StringUtils as h,ElementIDUtils as o,ApplicationContext as n}from"@sankhyalabs/core";import{T as r}from"./p-c9841939.js";import"./p-a81996df.js";import"./p-449d25e0.js";import{P as d}from"./p-5534e08c.js";import"./p-9e7d65a4.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-584d7212.js";import"./p-5da848bb.js";import{c as l}from"./p-4a78e118.js";import{A as c}from"./p-81a7f74c.js";import"./p-6dc031de.js";import"./p-112455b1.js";import"./p-8d884fab.js";const m=class{constructor(s){t(this,s),this.actionClick=i(this,"actionClick",7),this.configuratorSave=i(this,"configuratorSave",7),this.configuratorCancel=i(this,"configuratorCancel",7),this.formItemsReady=i(this,"formItemsReady",7),this._viewHistory=[],this._dataUnit=void 0,this._dataState=void 0,this.attachmentRegisterKey=void 0,this._currentViewMode=l.GRID,this._canEdit=void 0,this._resourceID=void 0,this.configName=void 0,this.selectionToastConfig=void 0,this.showActionButtons=!1,this.actionsList=void 0,this.taskbarManager=void 0,this.recordsValidator=void 0,this.statusResolver=void 0,this.multipleSelection=!0,this.presentationMode=d.PRIMARY,this.messagesBuilder=void 0,this.useEnterLikeTab=!1,this.customContainerId=`SNK-CRUD-CUSTOM-CONTAINER-${h.generateUUID()}`}async goToView(t){this.executeAction(t)}async openConfigurator(){var t;null===(t=this._snkConfigurator)||void 0===t||t.open()}async closeConfigurator(){var t;null===(t=this._snkConfigurator)||void 0===t||t.close()}async reloadFilterBar(){var t;null===(t=this._snkGrid)||void 0===t||t.reloadFilterBar()}currentViewModeWatcher(t){this._viewHistory=[...this._viewHistory.slice(-1),t]}async gridToForm(t=!1){this._backToGrid=!t&&await this._viewStack.getSelectedIndex()===l.GRID,this.setViewMode(l.FORM)}async executeAction(t){return t===r.GRID_MODE?this.setViewMode(l.GRID):t===r.FORM_MODE||t===r.UPDATE?this.gridToForm(t!==r.UPDATE):t===r.CONFIGURATOR?this._snkConfigurator.open():"ATTACH"===t?this.setViewMode(l.ATTACHMENT):void 0}backView(){const t=this._viewHistory.at(-2)||l.GRID;this.setViewMode(t)}setViewMode(t){this._viewStack.show(t),this._currentViewMode=t}openConfig(t){this._snkConfigurator.close(),t===l.GRID?this._snkGrid.showConfig():t===l.FORM&&this._guidesViewer.showFormConfig()}addDataElementID(){o.addIDInfo(this._element,null,{dataUnit:this._dataUnit})}insertionModeHandler(){this.gridToForm()}cancelHandler(){this._backToGrid&&this.setViewMode(l.GRID)}async getAttachmentRegisterKey(){if(this._snkDataUnit)return(await this._snkDataUnit.getSelectedRecordsIDsInfo()).map((({value:t})=>t)).join("_")}componentWillLoad(){const t=n.getContextValue("__SNK__APPLICATION__");t.hasAccess(c.UPDATE,this._resourceID).then((t=>this._canEdit=t));let i=this._element.parentElement;for(;i;){if("SNK-DATA-UNIT"===i.tagName.toUpperCase()){this._snkDataUnit=i,this._snkDataUnit.addEventListener("insertionMode",(()=>this.insertionModeHandler())),this._snkDataUnit.addEventListener("cancelEdition",(()=>this.cancelHandler())),this._dataUnit=this._snkDataUnit.dataUnit,this._dataState=this._snkDataUnit.dataState,this._dataUnit?this.initDataUnit(t):this._snkDataUnit.addEventListener("dataUnitReady",(i=>{this._dataUnit=i.detail,this.initDataUnit(t)})),this._snkDataUnit.addEventListener("dataStateChange",(async({detail:t})=>{this._dataState=t,void 0!==t.selectedRecord&&(this.attachmentRegisterKey=await this.getAttachmentRegisterKey())}));break}i=i.parentElement}this.configName||(this.configName=t.configName)}async initDataUnit(t){this.addDataElementID(),this.messagesBuilder||(this.messagesBuilder=this._snkDataUnit.messagesBuilder),null==this._resourceID&&(this._resourceID=this._snkDataUnit.resourceID,null==this._resourceID&&(this._resourceID=await t.getResourceID()))}handleConfiguratorEvent(t,i){t.stopImmediatePropagation(),"SAVE"!==i?this.configuratorCancel.emit():this.configuratorSave.emit()}render(){if(null!=this._resourceID)return this._snkDataUnit.ignoreSaveMessage=this._currentViewMode===l.GRID,s(e,null,s("ez-view-stack",{ref:t=>this._viewStack=t,"data-element-id":"crud"},s("stack-item",null,s("snk-grid",{ref:t=>this._snkGrid=t,"data-element-id":"crud_grid",configName:this.configName,onGridDoubleClick:()=>this.gridToForm(!0),taskbarManager:this.taskbarManager,onActionClick:t=>this.executeAction(t.detail),messagesBuilder:this.messagesBuilder,actionsList:this.actionsList,statusResolver:this.statusResolver,multipleSelection:this.multipleSelection,presentationMode:this.presentationMode,selectionToastConfig:this.selectionToastConfig,useEnterLikeTab:this.useEnterLikeTab,canEdit:this._canEdit,resourceID:this._resourceID},s("slot",{name:"GRID_TASKBAR_CUSTOM_ELEMENTS"}),s("slot",{name:"GRID_HEADER_CUSTOM_ELEMENTS"}),s("slot",{name:"SnkGridHeader"}),s("slot",{name:"SnkGridFooter"}),s("slot",{name:"SnkGridTaskBar"}))),s("stack-item",null,s("snk-guides-viewer",{ref:t=>this._guidesViewer=t,entityPath:this._snkDataUnit.entityName,messagesBuilder:this.messagesBuilder,onExit:()=>this.setViewMode(l.GRID),dataState:this._dataState,dataUnit:this._dataUnit,actionsList:this.actionsList,taskbarManager:this.taskbarManager,configName:this.configName,onActionClick:t=>this.executeAction(t.detail),presentationMode:this.presentationMode,"data-element-id":"crud_form",canEdit:this._canEdit,resourceID:this._resourceID,detailTaskbarCustomContainerId:this.customContainerId},s("slot",{name:"GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS"}),s("slot",{name:"SnkFormTaskBar"}))),s("stack-item",null,s("snk-attach",{registerKey:this.attachmentRegisterKey,messagesBuilder:this.messagesBuilder,entityName:this._snkDataUnit.entityName,onBack:this.backView.bind(this)})),s("snk-configurator",{ref:t=>this._snkConfigurator=t,viewMode:this._currentViewMode,messagesBuilder:this.messagesBuilder,onConfigSelected:t=>this.setViewMode(t.detail),onOpenConfig:t=>this.openConfig(t.detail),showActionButtons:this.showActionButtons,onSave:t=>this.handleConfiguratorEvent(t,"SAVE"),onCancel:t=>this.handleConfiguratorEvent(t,"CANCEL"),resourceID:this._resourceID},s("div",{slot:"SnkConfigContainerSlot"},s("slot",{name:"SnkConfigContainerSlot"})))),s("div",{id:`${this.customContainerId}`},s("slot",{name:"DETAIL_GRID_HEADER_CUSTOM_ELEMENTS"}),s("slot",{name:"DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS"}),s("slot",{name:"DETAIL_TASKBAR_CUSTOM_ELEMENTS"})))}get _element(){return a(this)}static get watchers(){return{_currentViewMode:["currentViewModeWatcher"]}}};m.style=".sc-snk-crud-h{display:flex;flex-direction:column;height:100%;width:100%}";export{m as snk_crud}
@@ -0,0 +1 @@
1
+ import{r as t,c as i,h as s,g as e}from"./p-d2d301a6.js";import{DataUnit as a,defaultDataLoader as r,StringUtils as o,ChangeOperation as n,ObjectUtils as h,ApplicationContext as d,DataType as l,UserInterface as m}from"@sankhyalabs/core";import{c as u,S as c}from"./p-4a78e118.js";import{T as p}from"./p-c9841939.js";import"./p-a81996df.js";import"./p-449d25e0.js";import{P as g}from"./p-5534e08c.js";import"./p-9e7d65a4.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-584d7212.js";import"./p-5da848bb.js";import{T as b}from"./p-c2beb95c.js";import{S as v}from"./p-fa9d3f73.js";import"./p-6dc031de.js";import"./p-112455b1.js";import"./p-8d884fab.js";class f{constructor(t,i){this.records=i,this.metadata=t,this._dataUnit=new a(f.IN_MEMORY_DATA_UNIT_NAME),this._dataUnit.metadataLoader=()=>this.metadaLoader(),this._dataUnit.dataLoader=(t,i)=>r(t,i,this.getRecordsToLoad()),this._dataUnit.saveLoader=(t,i)=>this.saveLoader(t,i),this._dataUnit.removeLoader=(t,i)=>this.removeLoader(t,i),this.dataUnit.loadMetadata().then((()=>this.dataUnit.loadData()))}getRecordsToLoad(){if(this._initialRecords)try{return this._initialRecords}finally{this._initialRecords=void 0}return this.dataUnit.records}get dataUnit(){return this._dataUnit}get records(){return this.dataUnit.records}set records(t){const i=null==t?void 0:t.map((t=>(t.__record__id__||(t.__record__id__=this.generateUniqueId()),t)));this._dataUnit?this._dataUnit.records=i:this._initialRecords=i}get metadata(){return this._metadata}set metadata(t){this._metadata=t,this._dataUnit&&(this._dataUnit.metadata=this._metadata)}generateUniqueId(){return o.generateUUID()}metadaLoader(){return Promise.resolve(this._metadata)}saveLoader(t,i){return new Promise((t=>{let s=[];i.forEach((t=>{let{record:i,updatingFields:e,operation:a}=t;const r=Object.assign(Object.assign({},i),e);if(a===n.INSERT||a===n.COPY)r.__old__id__=i.__record__id__,r.__record__id__=this.generateUniqueId(),this.records.push(r);else{const t=this.records.findIndex((t=>t.__record__id__==r.__record__id__));this.records[t]=r}s.push(r)})),t(s)}))}removeLoader(t,i){return new Promise((t=>{t(i)}))}}f.IN_MEMORY_DATA_UNIT_NAME="InMemoryDataUnit";const k=class{constructor(s){t(this,s),this.dataStateChange=i(this,"dataStateChange",3),this.dataUnitReady=i(this,"dataUnitReady",3),this.actionClick=i(this,"actionClick",7),this.formItemsReady=i(this,"formItemsReady",7),this.REGULAR_DEFAULT_BTNS=["INSERT","REFRESH","PREVIOUS","NEXT","DIVIDER"],this.REGULAR_SELECTED_BTNS=["INSERT","REFRESH","PREVIOUS","NEXT","DIVIDER","CLONE","REMOVE","DIVIDER"],this._multiSelectionListDataSource=new v,this._taskbarProcessor=new b({"snkSimpleCrudTaskbar.form_regular":this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(p.GRID_MODE),"snkSimpleCrudTaskbar.grid_regular":this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(p.FORM_MODE),"snkSimpleCrudTaskbar.form_selected":this.resolveInMemoryBtns(this.REGULAR_SELECTED_BTNS).concat(p.GRID_MODE),"snkSimpleCrudTaskbar.grid_selected":this.resolveInMemoryBtns(this.REGULAR_SELECTED_BTNS).concat(p.FORM_MODE),"snkSimpleCrudTaskbar.finish_edition":["CANCEL","SAVE"]}),this._currentViewMode=u.GRID,this._config=void 0,this.dataState=void 0,this.dataUnit=void 0,this.mode=c.SERVER,this.gridConfig=void 0,this.formConfig=void 0,this.multipleSelection=void 0,this.useCancelConfirm=!0,this.taskbarManager=void 0,this.messagesBuilder=void 0,this.useEnterLikeTab=!1}resolveInMemoryBtns(t){const i=[...t];return this.mode===c.IN_MEMORY&&i.splice(1,1),i}async goToView(t){this._currentViewMode=t,this._viewStack&&this._viewStack.show(t)}actionClickListener(t){const i=t.detail;i===p.GRID_MODE?this.goToView(u.GRID):i===p.FORM_MODE&&this.goToView(u.FORM),t.stopPropagation()}onModeChange(){this.mode==c.IN_MEMORY&&this.initInMemoryDataUnit()}observeDataState(t,i){h.objectToString(i)!=h.objectToString(t)&&this.dataStateChange.emit(t)}componentWillRender(){this._taskbarProcessor.process(this.getTaskBarId(),this.taskbarManager,this.dataState,this.getTaskBarDisabledButtons())}componentWillLoad(){this.processMetadata(),this.onModeChange(),this.configDatasource()}configDatasource(){const t=d.getContextValue("__SNK__APPLICATION__");this._multiSelectionListDataSource.setApplication(t),this._multiSelectionListDataSource.setDataUnit(this.dataUnit)}getTaskBarId(){var t,i,s;return(null===(t=this.dataState)||void 0===t?void 0:t.isDirty)?"snkSimpleCrudTaskbar.finish_edition":(null===(i=this.dataState)||void 0===i?void 0:i.selectionInfo)&&!this.dataState.selectionInfo.isAllRecords()&&(null===(s=this.dataState.selectionInfo.records)||void 0===s?void 0:s.length)>0?this._currentViewMode===u.GRID?"snkSimpleCrudTaskbar.grid_selected":"snkSimpleCrudTaskbar.form_selected":this._currentViewMode===u.GRID?"snkSimpleCrudTaskbar.grid_regular":"snkSimpleCrudTaskbar.form_regular"}initInMemoryDataUnit(){this._inMemoryLoader=new f(this._metadata),this.dataUnit=this._inMemoryLoader.dataUnit,this.dataUnitReady.emit(this.dataUnit)}setMetadata(t){return this._inMemoryLoader?this._inMemoryLoader.metadata=t:this.dataUnit&&(this.dataUnit.metadata=t),Promise.resolve()}setRecords(t){return this._inMemoryLoader?this._inMemoryLoader.records=t:this.dataUnit&&(this.dataUnit.records=t),Promise.resolve()}getRecords(){return Promise.resolve(this.dataUnit.records)}processMetadata(){const t=this._element.querySelectorAll("snk-field-metadata"),i=[],s={fields:[],emptyConfig:!1};t.forEach((t=>{const e={name:t.getAttribute("name")||t.getAttribute("label"),label:t.getAttribute("label"),dataType:l[t.getAttribute("dataType")]||l.TEXT,userInterface:m[t.getAttribute("userInterface")]||m.SHORTTEXT,readOnly:"true"==t.getAttribute("readOnly"),required:"true"==t.getAttribute("required"),tab:t.getAttribute("tab")||void 0,visible:"false"!=t.getAttribute("visible")};s.fields.push({name:e.name,tab:e.tab,visible:e.visible}),i.push(e)})),i.length>0&&(this.formConfig||(this.formConfig=s),this._metadata={name:"SimpleCrud",label:"SimpleCrud",fields:i})}onDataStateChange(t){this.dataState=Object.assign({},t.detail)}getTaskBarDisabledButtons(){var t,i,s,e;const a=[];return(null===(t=this.dataState)||void 0===t?void 0:t.hasNext)||a.push(p.NEXT),(null===(i=this.dataState)||void 0===i?void 0:i.hasPrevious)||a.push(p.PREVIOUS),(null===(e=null===(s=this.dataState)||void 0===s?void 0:s.selectionInfo)||void 0===e?void 0:e.isEmpty())&&a.push(p.FORM_MODE),a}handleCancelEdit(){var t;(null===(t=this.dataState)||void 0===t?void 0:t.recordsIsEmpty)&&(this.goToView(u.GRID),this.dataUnit.clearSelection())}render(){var t;return s("snk-data-unit",{class:"simple-crud__container",dataUnit:this.dataUnit,useCancelConfirm:this.useCancelConfirm,onDataStateChange:t=>this.onDataStateChange(t),onCancelEdition:this.handleCancelEdit.bind(this),onInsertionMode:()=>this.goToView(u.FORM),onDataUnitReady:t=>this.dataUnitReady.emit(t.detail),ignoreSaveMessage:this._currentViewMode===u.GRID,onMessagesBuilderUpdated:t=>this.messagesBuilder=t.detail},s("header",null,s("slot",{name:"snkSimpleCrudHeader"})),s("section",{class:"ez-flex ez-box ez-box--shadow"},s("snk-taskbar",{class:"ez-box ez-box--shadow ez-padding--medium ez-margin-bottom--large",dataUnit:this.dataUnit,primaryButton:(null===(t=this.dataState)||void 0===t?void 0:t.isDirty)?"SAVE":"INSERT","data-element-id":"grid_left",messagesBuilder:this.messagesBuilder,buttons:this._taskbarProcessor.buttons,disabledButtons:this._taskbarProcessor.disabledButtons,customButtons:this._taskbarProcessor.customButtons,slot:"leftButtons",presentationMode:g.SECONDARY},s("slot",{name:"TASKBAR_CUSTOM_ELEMENTS"})),s("ez-view-stack",{class:"ez-flex ez-flex--column",ref:t=>this._viewStack=t,"data-element-id":"simple-crud"},s("stack-item",null,s("ez-grid",{dataUnit:this.dataUnit,config:this.gridConfig,"no-header":!0,multipleSelection:this.multipleSelection,onEzDoubleClick:()=>this.goToView(u.FORM),columnfilterDataSource:this.dataUnit.name.includes(f.IN_MEMORY_DATA_UNIT_NAME)?void 0:this._multiSelectionListDataSource,useEnterLikeTab:this.useEnterLikeTab},s("div",{slot:"footer"},s("slot",{name:"snkSimpleCrudFooter"})))),s("stack-item",null,s("ez-form",{dataUnit:this.dataUnit,config:this.formConfig})))))}get _element(){return e(this)}static get watchers(){return{mode:["onModeChange"],dataState:["observeDataState"]}}};k.style=".sc-snk-simple-crud-h{display:flex;height:100%;width:100%}.simple-crud__container.sc-snk-simple-crud{display:grid;grid-template-rows:auto;row-gap:12px;height:100%;width:100%}ez-grid.sc-snk-simple-crud{--ez-grid__container--shadow:none;min-height:300px}ez-form.sc-snk-simple-crud{min-height:300px}";export{k as snk_simple_crud}
@@ -0,0 +1 @@
1
+ import{r as i,c as t,h as s,g as e}from"./p-d2d301a6.js";import{ElementIDUtils as d,ApplicationContext as r,DataType as a}from"@sankhyalabs/core";import{UserInterface as o}from"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import{T as n}from"./p-c9841939.js";import{C as h}from"./p-daa687aa.js";import{P as l}from"./p-5534e08c.js";import{T as u}from"./p-c2beb95c.js";import{s as c}from"./p-6dc031de.js";import{S as v}from"./p-fa9d3f73.js";import{SelectionMode as g}from"@sankhyalabs/core/dist/dataunit/DataUnit";import"./p-5da848bb.js";import"./p-a81996df.js";import"./p-112455b1.js";import"./p-8d884fab.js";import"./p-584d7212.js";const m=class{constructor(s){i(this,s),this.actionClick=t(this,"actionClick",7),this.gridDoubleClick=t(this,"gridDoubleClick",7),this._topTaskbarProcessor=new u({"snkGridTopTaskbar.regular":["FORM_MODE","CONFIGURATOR","INSERT"],"snkGridTopTaskbar.regular.secondary":["FORM_MODE","CONFIGURATOR","INSERT"],"snkGridTopTaskbar.finish_edition":["CANCEL","SAVE"],"snkGridTopTaskbar.finish_edition.secondary":[]}),this._headerTaskbarProcessor=new u({"snkGridHeaderTaskbar.unselected":["REFRESH","DATA_EXPORTER","ACTIONS_BUTTON"],"snkGridHeaderTaskbar.selected":["UPDATE","CLONE","REMOVE","MORE_OPTIONS","DIVIDER","ATTACH","REFRESH","DATA_EXPORTER","ACTIONS_BUTTON"],"snkGridHeaderTaskbar.detail.unselected":["REFRESH"],"snkGridHeaderTaskbar.detail.selected":["UPDATE","ATTACH","CLONE","REMOVE","MORE_OPTIONS","DIVIDER","REFRESH"]}),this._dataUnit=void 0,this._dataState=void 0,this._gridConfig=void 0,this._popUpGridConfig=!1,this.columnFilterDataSource=new v,this.configName=void 0,this.resourceID=void 0,this.selectionToastConfig=void 0,this.actionsList=void 0,this.isDetail=void 0,this.taskbarManager=void 0,this.statusResolver=void 0,this.multipleSelection=void 0,this.presentationMode=l.PRIMARY,this.messagesBuilder=void 0,this.useEnterLikeTab=!1,this.recordsValidator=void 0,this.canEdit=!0,this.taskbarCustomContainerId=void 0,this.gridHeaderCustomSlotId="GRID_HEADER_CUSTOM_ELEMENTS",this.topTaskbarCustomSlotId="GRID_TASKBAR_CUSTOM_ELEMENTS"}async showConfig(){null!=this._grid&&this.openGridConfig()}async hideConfig(){null!=this._grid&&this.closeGridConfig()}async setConfig(i){this.setGridConfig(i)}async reloadFilterBar(){var i;null===(i=this._snkFilterBar)||void 0===i||i.reload()}openGridConfig(){this._grid.getColumnsState().then((i=>{this._snkGridConfig.columns=i.filter((i=>i.name)),this._snkGridConfig.selectedIndex=0,this._popUpGridConfig=!0}))}closeGridConfig(){this._popUpGridConfig=!1}setGridConfig(i){this._gridConfig=i}loadConfig(){h.loadGridConfig(this.configName,this.resourceID).then((i=>{this.setGridConfig(i)})).catch((i=>{console.warn(i)}))}gridConfigChangeHandler(i){h.saveGridConfig(i.detail,this.configName,this.resourceID),i.stopPropagation()}modalConfigChangeHandler(i){const t=i.detail;this._grid.setColumnsState(t.columns).then((()=>{this.setGridConfig(t),this.closeGridConfig(),this.dataExporterProviderStore()})),i.stopPropagation()}buildColumnsMetadata(i){const t=[];return null==i||i.forEach((i=>{var s,e;if(i.hidden&&"RECDESP"!==i.name)return;const d=null===(s=this._dataUnit)||void 0===s?void 0:s.getField(i.name);if(t.push({label:i.label,id:i.name,width:i.width,type:null==d?void 0:d.dataType,userInterface:null==d?void 0:d.userInterface}),null!=(null===(e=null==d?void 0:d.properties)||void 0===e?void 0:e.DESCRIPTIONFIELD)){const i=d.properties.mergedFrom;t.push({label:d.properties.DESCRIPTIONENTITY,id:`${i?i+".":""}${d.properties.ENTITYNAME}.${d.properties.DESCRIPTIONFIELD}`,width:200,type:a.TEXT,userInterface:o.LONGTEXT})}})),t||[]}getPaginationInfo(){var i;return null===(i=this._dataUnit)||void 0===i?void 0:i.getPaginationInfo()}getExporterOffset(i){if(null==i)return;const t=i.firstRecord;return t>0?t-1:t}async dataExporterProviderStore(){var i;const t=await(null===(i=this._snkDataUnit)||void 0===i?void 0:i.getSelectedRecordsIDsInfo()),s={getFilters:()=>{var i;return null===(i=this._dataUnit)||void 0===i?void 0:i.getAppliedFilters()},getColumnsMetadata:async()=>{var i;const t=await(null===(i=this._grid)||void 0===i?void 0:i.getColumnsState());return this.buildColumnsMetadata(t)},getOrders:()=>{var i;return null===(i=this._dataUnit)||void 0===i?void 0:i.getSort()},getResourceURI:()=>{var i;return null===(i=this._dataUnit)||void 0===i?void 0:i.name},getSelectedNumber:()=>{var i,t;return null===(t=null===(i=this._dataState)||void 0===i?void 0:i.selectionInfo)||void 0===t?void 0:t.length},getTotalRecords:()=>{var i,t,s;const{total:e}=(null===(i=this._dataUnit)||void 0===i?void 0:i.getPaginationInfo())||{};return null!=e?e:null===(s=null===(t=this._dataUnit)||void 0===t?void 0:t.records)||void 0===s?void 0:s.length},getSelectedIDs:()=>t||[],getOffset:()=>this.getExporterOffset(this.getPaginationInfo()),getLimit:()=>{var i;return null===(i=this._dataUnit)||void 0===i?void 0:i.pageSize},getRecordID:()=>{var i,t,s;return null===(s=null===(t=null===(i=this._dataUnit)||void 0===i?void 0:i.records)||void 0===t?void 0:t[0])||void 0===s?void 0:s.__record__id__}};c.set("exporterProviders",Object.assign(Object.assign({},c.get("exporterProviders")),{[this.configName]:s}))}addElementID(){d.addIDInfo(this._element,null,{dataUnit:this._dataUnit})}finshLoading(){var i,t;this._dataUnitLoadLockerResolver=this._dataUnit.addLoadingLocker(),this.addElementID(),null===(i=this.columnFilterDataSource)||void 0===i||i.setApplication(this._application),null===(t=this.columnFilterDataSource)||void 0===t||t.setDataUnit(this._dataUnit)}componentWillLoad(){this._application=r.getContextValue("__SNK__APPLICATION__");let i=this._element.parentElement;for(;i;){if("SNK-DATA-UNIT"===i.tagName.toUpperCase()){this._snkDataUnit=i,this._dataUnit=this._snkDataUnit.dataUnit,this._dataUnit?this.finshLoading():this._snkDataUnit.addEventListener("dataUnitReady",(i=>{this._dataUnit=i.detail,this.finshLoading()})),this.messagesBuilder||(this.messagesBuilder=this._snkDataUnit.messagesBuilder),this._snkDataUnit.addEventListener("dataStateChange",(i=>{this._dataState=i.detail})),this._snkDataUnit.addEventListener("cancelEdition",(()=>{var i;(null===(i=this._dataState)||void 0===i?void 0:i.recordsIsEmpty)&&this._dataUnit.clearSelection()}));break}i=i.parentElement}this.loadConfig()}getHeaderDisabledButtons(){var i;const t=[];return(null===(i=this._dataState)||void 0===i?void 0:i.selectionInfo)&&(this._dataState.selectionInfo.length>1&&t.push(n.CLONE,"ATTACH"),this._dataState.selectionInfo.isAllRecords()&&t.push("REMOVE")),t}getInvisibleButtons(){let i=[];return this._dataUnit&&0!==this._dataUnit.records.length||i.push("DATA_EXPORTER"),this._dataState&&this._dataState.selectionInfo.mode===g.ALL_RECORDS&&i.push("ACTIONS_BUTTON",n.UPDATE),i}componentWillRender(){var i;const t=this.getInvisibleButtons();let s;s=this._dataState&&(null===(i=this._dataState.selectionInfo)||void 0===i?void 0:i.length)?this.isDetail?"snkGridHeaderTaskbar.detail.selected":"snkGridHeaderTaskbar.selected":this.isDetail?"snkGridHeaderTaskbar.detail.unselected":"snkGridHeaderTaskbar.unselected",this._headerTaskbarProcessor.process(s,this.taskbarManager,this._dataState,this.getHeaderDisabledButtons(),t),this._topTaskbarProcessor.process(this.getTopTaskBarId(this.presentationMode===l.SECONDARY?".secondary":""),this.taskbarManager,this._dataState,void 0,t),this.dataExporterProviderStore()}getTopTaskBarId(i){var t;return(null===(t=this._dataState)||void 0===t?void 0:t.isDirty)?`snkGridTopTaskbar.finish_edition${i}`:`snkGridTopTaskbar.regular${i}`}getPrimaryButton(){return this.presentationMode===l.PRIMARY?"INSERT":""}onEzGridReady(){var i;null===(i=this._dataUnitLoadLockerResolver)||void 0===i||i.call(this),this._dataUnitLoadLockerResolver=void 0}render(){var i,t;if(this._dataUnit)return s("div",{class:"snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large"},s("div",{class:"snk-grid__header ez-margin-bottom--medium"},s("snk-filter-bar",{ref:i=>this._snkFilterBar=i,dataUnit:this._dataUnit,"data-element-id":"gridFilter",class:"snk-grid__filter-bar ez-align--top",configName:this.configName,messagesBuilder:this.messagesBuilder,resourceID:this.resourceID}),(null===(t=null===(i=this._snkFilterBar)||void 0===i?void 0:i.filterConfig)||void 0===t?void 0:t.length)>0&&s("hr",{class:"ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider"}),s("snk-taskbar",{class:"ez-padding-left--medium","data-element-id":"grid_top",key:"topTaskbar",configName:this.configName,dataUnit:this._dataUnit,messagesBuilder:this.messagesBuilder,buttons:this._topTaskbarProcessor.buttons,disabledButtons:this._topTaskbarProcessor.disabledButtons,customButtons:this._topTaskbarProcessor.customButtons,primaryButton:this.getPrimaryButton(),resourceID:this.resourceID,customContainerId:this.taskbarCustomContainerId,customSlotId:this.topTaskbarCustomSlotId},s("slot",{name:this.topTaskbarCustomSlotId}))),s("ez-grid",{ref:i=>this._grid=i,class:(this.presentationMode===l.SECONDARY?"snk-grid-container__without-shadow ":"")+"snk-grid__table","data-element-id":"embedded",dataUnit:this._dataUnit,key:"grid-"+this._snkDataUnit.entityName,config:this._gridConfig,onConfigChange:i=>{this.gridConfigChangeHandler(i)},onEzDoubleClick:()=>this.gridDoubleClick.emit(),statusResolver:this.statusResolver,multipleSelection:this.multipleSelection,onComponentReady:()=>this.onEzGridReady(),columnfilterDataSource:this.columnFilterDataSource,selectionToastConfig:this.selectionToastConfig,useEnterLikeTab:this.useEnterLikeTab,recordsValidator:this.recordsValidator,canEdit:this.canEdit},s("snk-taskbar",{dataUnit:this._dataUnit,configName:this.configName,messagesBuilder:this.messagesBuilder,"data-element-id":"grid_left",buttons:this._headerTaskbarProcessor.buttons,disabledButtons:this._headerTaskbarProcessor.disabledButtons,customButtons:this._headerTaskbarProcessor.customButtons,slot:"leftButtons",actionsList:this.actionsList,resourceID:this.resourceID,customContainerId:this.taskbarCustomContainerId,customSlotId:this.gridHeaderCustomSlotId},s("slot",{name:this.gridHeaderCustomSlotId}))),s("div",{class:"ez-col ez-col--sd-12"},s("slot",{name:"SnkGridFooter"})),s("ez-modal",{modalSize:"small",closeEsc:!1,closeOutsideClick:!1,opened:this._popUpGridConfig,onEzCloseModal:()=>this.closeGridConfig()},s("snk-grid-config",{ref:i=>this._snkGridConfig=i,config:this._gridConfig,"data-element-id":this._element.getAttribute(d.DATA_ELEMENT_ID_ATTRIBUTE_NAME),application:this._application,selectedIndex:0,configName:this.configName,onConfigChange:i=>this.modalConfigChangeHandler(i),onConfigCancel:()=>this.closeGridConfig(),resourceID:this.resourceID})))}get _element(){return e(this)}};m.style=".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--medium)}.snk-grid__table.sc-snk-grid{min-height:300px}.snk-grid-container__without-shadow.sc-snk-grid{--ezgrid__container--shadow:unset}";export{m as snk_grid}
@@ -0,0 +1,11 @@
1
+ import{r as t,c as s,h as e,g as i}from"./p-d2d301a6.js";import{WaitingChangeException as n,WarningException as r,ErrorException as a,ObjectUtils as o,DateUtils as c,StringUtils as h,OnboardingUtils as u,DependencyType as l,ElementIDUtils as p,ApplicationContext as d,ErrorTracking as m,DataType as w}from"@sankhyalabs/core";import{d as f,D as y,U as P}from"./p-a81996df.js";import{ApplicationUtils as g}from"@sankhyalabs/ezui/dist/collection/utils";import{P as I}from"./p-449d25e0.js";import{C as _}from"./p-daa687aa.js";import{D as v}from"./p-a75e892a.js";import{A,a as S}from"./p-81a7f74c.js";import{S as E}from"./p-ae6aff81.js";import"./p-112455b1.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-8d884fab.js";import"./p-5da848bb.js";import"./p-584d7212.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";class C{constructor(t){this._app=t,window.addEventListener("error",(t=>this.errorHandler(t))),window.addEventListener("unhandledrejection",(t=>this.rejectionHandler(t)))}rejectionHandler(t){const s=t.reason;s instanceof n||(s?this.processException(s):this._app.isDebugMode().then((t=>{t&&this._app.error("Promise rejeitada","Erro interno: Uma promise foi rejeitada sem razão determinada.")})))}errorHandler(t){this.processException(t.error)}buildErrorCodeHTML(t){return'<br><a href="#" onclick="try{window.workspace.openHelp(\'_tbcode:'+t+"')} catch(e){alert('Não é possível abrir a ajuda fora do workspace Sankhya');}\">Código: "+t+"</a>"}processException(t){t.errorCode&&(t.message+=this.buildErrorCodeHTML(t.errorCode)),t instanceof n||t instanceof r?this._app.alert(t.title,t.message):t instanceof a?this._app.error(t.title,t.message):this._app.isDebugMode().then((s=>{if(s)if(t instanceof Error)this._app.error(t.name,t.message);else{const s=(null==t?void 0:t.title)||"Erro detectado",e="string"==typeof t?t:t.message||`Erro interno "${o.objectToString(t)}"`;this._app.error(s,e)}}))}}function T(){const t=["2909523kXwted","CompanyName=Sankhya Jiva Tecnologia e Inovao Ltda,LicensedApplication=Sankhya Gestao,LicenseType=SingleApplication,LicensedConcurrentDeveloperCount=2,LicensedProductionInstancesCount=0,AssetReference=AG-019460,ExpiryDate=9_November_2022_[v2]_MTY2Nzk1MjAwMDAwMA==10487151e296ee4360f80961ca960869","1131048CARoeW","502909mLEPmu","447255iQEXuN","428UHbJwW","270AFTxAV","194369jhGqTI","1540nWuTrj","2044062GicUQI","30CkXPWg"];return(T=function(){return t})()}const D=N;function N(t,s){const e=T();return(N=function(t){return e[t-=392]})(t,s)}!function(){const t=N,s=T();for(;;)try{if(951926==-parseInt(t(398))/1+-parseInt(t(393))/2+parseInt(t(395))/3+-parseInt(t(400))/4*(parseInt(t(392))/5)+-parseInt(t(401))/6*(-parseInt(t(402))/7)+parseInt(t(397))/8+-parseInt(t(399))/9*(-parseInt(t(394))/10))break;s.push(s.shift())}catch(t){s.push(s.shift())}}();const b=D(396);class O{constructor(){this.templateByQuery=new Map,this.cancel=[],this.buildTemplates()}buildTemplates(){this.templateByQuery.set("fetchTotals",f.gql`query($filters: [InputFilter!] $name: String!) {
2
+ $queryAlias$: fetchTotals(name: $name, filters: $filters ){
3
+ name
4
+ value
5
+ }
6
+ }`)}fetchTotals(t,s,e=[]){const i=`${t}_${s}`,n=this.cancel.findIndex((t=>t[i]));return n>=0&&(this.cancel[n][i](),this.cancel.splice(n,1)),Promise.race([new Promise((t=>this.cancel.push({[i]:t}))),this.getTotals(t,s,e)]).then((t=>{let s=new Map;if(t){s=t;const e=this.cancel.findIndex((t=>t[i]));e>=0&&this.cancel.splice(e,1)}return s}))}getTotals(t,s,e=[]){return new Promise(((i,n)=>{y.get().callGraphQL({query:this.templateByQuery.get("fetchTotals"),values:{name:`totals://${t}/${s}`,filters:e}}).then((t=>{if(t.length>0){const s=new Map;return t.forEach((t=>s.set(t.name,parseFloat(t.value)))),i(s)}return n("Não foi possível recuperar os totalizadores")})).catch(n)}))}}var L;class k{static openAppActivity(t,s){var e;null===(e=window.workspace)||void 0===e||e.openAppActivity(t,s)}static getAppLabel(t){if(null!=(null===window||void 0===window?void 0:window.workspace))return null==window.workspace.getAppLabel&&(window.workspace.getAppLabel=t=>(t||"").split(".").pop()),window.workspace.getAppLabel(t)}}k.resourceID=null===(L=window.workspace)||void 0===L?void 0:L.resourceID;class j{static webConnectionCaller(t,s,e){var i;null===(i=window.AppletCaller)||void 0===i||i.webConnectionCaller(t,s,e)}}class U{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchParam",f.gql`query($name: String!) {
7
+ $queryAlias$: fetchResource(name: $name){
8
+ name
9
+ resource
10
+ }
11
+ }`)}async getParam(t){const s=`param://application?params=${t}`;return y.get().callGraphQL({values:{name:s},query:this.templateByQuery.get("fetchParam")})}async asString(t){const s=await this.getParam(t);return this.getValue(s)}async asInteger(t){const s=await this.getParam(t);return parseInt(this.getValue(s))}async asFloat(t){const s=await this.getParam(t);return parseFloat(this.getValue(s))}async asBoolean(t){const s=await this.getParam(t);return"S"===this.getValue(s)}async asDate(t){const s=await this.getParam(t);return c.strToDate(this.getValue(s))}async getBatchParams(t){const s=await this.getParam(t.join(",")),e={};return s.forEach((t=>e[t.name]=t.resource)),e}getValue(t={}){if(Array.isArray(t)&&t.length>0&&(t=t[0]),h.isEmpty(t.resource))return"";try{const s=o.stringToObject(t.resource),[e]=Object.keys(s);return s[e]}catch(t){console.warn("Erro ao converter string JSON.")}}}const $=R;function R(t,s){const e=M();return(R=function(t){return e[t-=378]})(t,s)}function M(){const t=["true","863GKWjmo","parse","56355fjjjAm","isSup","putAccess","4324480sjuCdS","hasOwnProperty","239748okvJLB","name","6055770tXeRaU","actions","forEach","7RPRvzn","1042CHxkUw","2988126NIwRMm","20MTNzmH","authorizationSf","item","string","hasAccess","isArray","Objeto não pode ser indefinido.","3071943fWslZp","parseFromJSON"];return(M=function(){return t})()}!function(){const t=R,s=M();for(;;)try{if(281287==parseInt(t(399))/1*(-parseInt(t(387))/2)+-parseInt(t(401))/3+parseInt(t(381))/4*(-parseInt(t(389))/5)+parseInt(t(388))/6*(-parseInt(t(386))/7)+parseInt(t(379))/8+parseInt(t(396))/9+parseInt(t(383))/10)break;s.push(s.shift())}catch(t){s.push(s.shift())}}();class q{[$(397)](t){const s=$;if(typeof(t=utxt(t[s(390)]))==s(392)&&(t=JSON[s(400)](t)),null==t)throw Error(s(395));const e=new F("S"===t[s(402)]||!0===t[s(402)]);return Array[s(394)](t[s(391)])&&t[s(391)][s(385)]((t=>e.putAccess(t[s(382)],String(t.status)==s(398)))),e}}class F{constructor(t){const s=$;this.isSup=t,this[s(384)]={}}[$(378)](t,s){this[$(384)][t]=s}[$(393)](t){const s=$;if(this[s(402)])return!0;let e=!0;return this[s(384)][s(380)](t)&&(e=this.actions[t]),e}isUserSup(){return this.isSup}}const x=class{constructor(e){t(this,e),this.applicationLoaded=s(this,"applicationLoaded",7),this.applicationLoading=s(this,"applicationLoading",7),this._authPromises=[],this._duCache=new Map,this._duPromises=new Map,this._requestListener=new z,this.messagesBuilder=void 0,this.configName=void 0}get parameters(){return this._parameters||(this._parameters=new U),this._parameters}async getAuth(t){return null==t?this.getApplicationAuth():new Promise(((s,e)=>{this.authFetcher.getData(t).then((t=>{s(t)})).catch((t=>{e(t)}))}))}async getApplicationAuth(){return this._auth?Promise.resolve(this._auth):new Promise(((t,s)=>{const e=this._authPromises.length>0;this._authPromises.push(new H(t,s)),e||this.authFetcher.getData(this.applicationResourceID).then((t=>{for(this._auth=t;this._authPromises.length>0;)this._authPromises.pop().resolve(this._auth)})).catch((t=>{for(;this._authPromises.length>0;)this._authPromises.pop().reject(t)}))}))}async isUserSup(){return new Promise(((t,s)=>{this.getAuth().then((e=>{this.getAuthList(e).then((s=>{t(s.isSup)})).catch((t=>s(t)))}))}))}async callServiceBroker(t,s,e){return y.get().callServiceBroker(t,s,e)}initOnboarding(t){return u.getInstance().init(t,window.envContext),Promise.resolve()}async hasAccess(t,s){return new Promise(((e,i)=>{this.getAuth(s).then((s=>{this.getAuthList(s).then((s=>{e(s.isSup||s.actions[t])})).catch((t=>i(t)))}))}))}async getAllAccess(t){return new Promise(((s,e)=>{this.getAuth(t).then((t=>{this.getAuthList(t).then((t=>{const e={};e.isSup=t.isSup,Object.entries(A).forEach((s=>{e[s[0]]=t.actions[s[1]]||!1})),s(e)})).catch((t=>e(t)))}))}))}async getStringParam(t){return this.parameters.asString(t)}async getIntParam(t){return this.parameters.asInteger(t)}async getFloatParam(t){return this.parameters.asFloat(t)}async getBooleanParam(t){return this.parameters.asBoolean(t)}async getDateParam(t){return this.parameters.asDate(t)}async showPopUp(t,s="full",e=!0){this.clearContent(this._popUp),this._popUp.appendChild(t),this._popUp.opened=!0,this._popUp.heightMode=s,this._popUp.useHeader=e,"EZ-MODAL-CONTAINER"===t.tagName&&(this._popUp.useHeader=!1)}async showModal(t){this.clearContent(this._rightModal),this._rightModal.appendChild(t),this._rightModal.opened=!0}async closeModal(){this.clearContent(this._rightModal),this._rightModal.opened=!1}async closePopUp(){this.clearContent(this._popUp),this._popUp.opened=!1,this._popUp.useHeader=!0,this._popUp.heightMode="full"}async temOpcional(t){const s=t.split(",");return new Promise(((t,e)=>{this.getAttributeFromHTMLWrapper("opc0009").then((i=>{"1"===i?t(!0):Promise.all(s.map((t=>this.getAttributeFromHTMLWrapper("opc"+t)))).then((s=>{t(s.includes("1"))})).catch((t=>{e(t)}))})).catch((t=>{e(t)}))}))}async getConfig(t){let s={serviceName:"SystemUtilsSP.getConf",requestBody:{config:{chave:t,tipo:"T"}}};return new Promise(((t,e)=>{y.get().callServiceBroker("SystemUtilsSP.getConf",JSON.stringify(s)).then((s=>{var e;return t(null===(e=s.config)||void 0===e?void 0:e.data)})).catch((t=>e(t)))}))}async saveConfig(t,s){let e={serviceName:"SystemUtilsSP.saveConf",requestBody:{config:{chave:t,tipo:"T",data:s}}};return new Promise(((t,s)=>{y.get().callServiceBroker("SystemUtilsSP.saveConf",JSON.stringify(e)).then((s=>t(s))).catch((t=>s(t)))}))}async getAttributeFromHTMLWrapper(t){return Promise.resolve(window[t])}async openApp(t,s){k.openAppActivity(t,s)}async webConnection(t,s,e){this.getStringParam(t).then((t=>{j.webConnectionCaller(t,s,e)}))}getDuPromissesStack(t){let s;return t&&(s=this._duPromises.get(t),s||(s=[],this._duPromises.set(t,s))),s||[]}async createDataunit(t,s,e,i,n){return null==n&&(n=this.applicationResourceID),new Promise(((r,a)=>{const o=this.getDuPromissesStack(s),c=o.length>0;if(o.push(new H(r,a)),!c){const r=this.dataUnitFetcher.getDataUnit(t,n,e,i);r.loadMetadata().then((()=>{for(s&&this.updateDataunitCache(void 0,s,r);o.length>0;)o.pop().resolve(r)})).catch((t=>{for(;o.length>0;)o.pop().reject(t)}))}}))}async updateDataunitCache(t,s,e){t&&this._duCache.delete(t),this._duCache.set(s,e)}async getDataUnit(t,s,e,i,n){return new Promise(((r,a)=>{const o=this._duCache.get(s);o?r(o):this.createDataunit(t,s,e,i,n).then((t=>{r(t)})).catch((t=>a(t)))}))}async addClientEvent(t,s){return new Promise((e=>{y.addClientEvent(t,s),e()}))}async removeClientEvent(t){return new Promise((s=>{y.removeClientEvent(t),s()}))}async hasClientEvent(t){return new Promise((s=>{s(y.hasClientEvent(t))}))}async callServiceBroker(t,s,e){return y.get().callServiceBroker(t,s,e)}get applicationResourceID(){return this._applicationResourceID||(this._applicationResourceID=this.urlParams.get("workspaceResourceID")||this.urlParams.get("resourceID")||k.resourceID||"unknown.resource.id"),this._applicationResourceID}async getResourceID(){return Promise.resolve(this.applicationResourceID)}async getUserID(){return Promise.resolve(window.UID)}async alert(t,s,e,i){return g.alert(t,s,e,i)}async error(t,s,e,i){return g.error(t,s,e,i)}async success(t,s,e,i){return g.success(t,s,e,i)}async message(t,s,e,i){return g.message(t,s,e,i)}async confirm(t,s,e,i,n){return g.confirm(t,s,e,i,n)}async info(t,s){return g.info(t,s)}async loadTotals(t,s,e){return this.totalsFetcher.fetchTotals(t,s,e)}async getAuthList(t){return await(new q).parseFromJSON(t)}get urlParams(){return this._urlParams||(this._urlParams=P.getQueryParams(location.search)),this._urlParams}get dataUnitFetcher(){return this._dataUnitFetcher||(this._dataUnitFetcher=new v),this._dataUnitFetcher}get totalsFetcher(){return this._totalsFetcher||(this._totalsFetcher=new O),this._totalsFetcher}get pesquisaFetcher(){return this._pesquisaFetcher||(this._pesquisaFetcher=new I),this._pesquisaFetcher}get authFetcher(){return this._authFetcher||(this._authFetcher=new S),this._authFetcher}async executeSearch(t,s,e){const i=null==e?void 0:e.getField(s);if(i){const{mode:s,argument:n}=t,{ENTITYNAME:r,CODEFIELD:a,DESCRIPTIONFIELD:o,ROOTENTITY:c,DESCRIPTIONENTITY:h}=i.properties,u=i.dependencies;let p;const d={rootEntity:c,descriptionFieldName:o,codeFieldName:a,showInactives:!1,dataUnitId:e.dataUnitId};return null==u||u.filter((t=>t.masterFields)).forEach((t=>{var s;t.type===l.SEARCHING&&(null===(s=t.masterFields)||void 0===s?void 0:s.length)>0&&(p={expression:t.expression,params:t.masterFields.map((t=>{const s=e.getField(t),i=(null==s?void 0:s.dataType)||w.TEXT,n=e.getFieldValue(t);if(null==n)throw this.alert("Erro ao pesquisar",`É necessario informar o campo ${s.label} para executar a pesquisa.`),new Error(`É necessario informar o campo ${s.label} para executar a pesquisa.`);return{name:t,value:n,dataType:i}}))})})),this.executePreparedSearch(s,n,{entity:r,entityDescription:h,criteria:p,searchOptions:d})}}async executePreparedSearch(t,s,e){const{entity:i,entityDescription:n,criteria:r,searchOptions:a}=e;return"ADVANCED"===t?new Promise((t=>{const e=document.createElement("snk-pesquisa");e[p.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=`entity_${i}`,e.argument=s,e.searchLoader=t=>this.pesquisaFetcher.loadAdvancedSearch(i,t,r,a),e.selectItem=s=>{t(s),this.clearPopUpTitle(),this.closePopUp()},this.setPopUpTitle(n),this.showPopUp(e)})):this.pesquisaFetcher.loadSearchOptions(i,s,r,a)}async isDebugMode(){return new Promise((t=>{t(window.isDebugMode)}))}async getAppLabel(){return k.getAppLabel(this.applicationResourceID)}addSearchListener(t,s,e){return new Promise((i=>{i(this.pesquisaFetcher.addSearchListener(t,s.dataUnitId,e))}))}importScript(t){return new Promise((s=>{this.getApplicationPath().then((e=>{let i=[];Array.isArray(t)||(i=[t]),i.forEach((t=>{const s=document.createElement("script");s.src=`${e}/${t}`,s.async=!0,document.body.appendChild(s)})),s()}))}))}getApplicationPath(){return new Promise((t=>{"dev"!==window.applicationenv&&t(`/${window.MGE_MODULE_NAME}/labsApps/${window.APPLICATION_NAME}/build`),t("")}))}executeSelectDistinct(t,s,e){return this.dataUnitFetcher.loadSelectDistinct(t,s,e)}getDataFetcher(){return Promise.resolve(y.get())}clearContent(t){t&&Array.from(t.children).forEach((s=>{t.removeChild(s)}))}clearPopUpTitle(){this._popUp.ezTitle=""}setPopUpTitle(t){this._popUp.ezTitle=t}componentWillLoad(){d.setContextValue("__SNK__APPLICATION__LOADING__",!0),this._errorHandler=new C(this),this.messagesBuilder=new E,d.setContextValue("__EZUI__UPLOAD__ADD__URL__",`${P.getUrlBase()}/mge/upload/file`),d.setContextValue("__EZUI__SEARCH__OPTION__LOADER__",((t,s,e)=>this.executeSearch(t,s,e))),d.setContextValue("__EZUI__GRID_LICENSE__",b),m.init(),_.preload(this.applicationResourceID,this.configName)}connectedCallback(){d.setContextValue("__SNK__APPLICATION__",this),y.addRequestListener(this._requestListener)}disconnectedCallback(){y.removeRequestListener(this._requestListener)}componentDidLoad(){this.applicationLoading.emit(!0),window.requestAnimationFrame((()=>{d.setContextValue("__SNK__APPLICATION__LOADING__",!1),this.applicationLoaded.emit(!0)})),p.addIDInfo(this._element,`resource_${this.applicationResourceID}`)}render(){return e("div",null,e("ez-loading-bar",{ref:t=>this._requestListener.loadingBar=t}),e("ez-popup",{opened:!1,ref:t=>this._popUp=t,onEzClosePopup:()=>this.closePopUp()}),e("ez-modal",{opened:!1,ref:t=>this._rightModal=t,"modal-size":"small",closeOutsideClick:!0,closeEsc:!0}))}get _element(){return i(this)}};class z{constructor(){this._debounceTime=1e3,this._ignoredNameTypes=["totals"],this._countRequest=0}onRequestStart(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest++,this.loadingBar.show(),this._timerLoading&&clearTimeout(this._timerLoading))}onRequestEnd(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest--,this._timerLoading=setTimeout((()=>{this._countRequest<=0&&this.loadingBar.hide()}),this._debounceTime))}isIgnoreLoadingOnRequest(t){var s;if(1==(null===(s=null==t?void 0:t.requestBody)||void 0===s?void 0:s.length)){const{name:s}=t.requestBody[0].variables;if(s){const t=s.split(":");return this._ignoredNameTypes.indexOf(t[0])>=0}}return!1}}class H{constructor(t,s){this.resolve=t,this.reject=s}}x.style=".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";export{x as snk_application}
@@ -0,0 +1 @@
1
+ export{S as snk_data_unit}from"./p-e1cb1f0b.js";import"./p-d2d301a6.js";import"@sankhyalabs/core";import"@sankhyalabs/ezui/dist/collection/utils";import"./p-ae6aff81.js";
@@ -0,0 +1 @@
1
+ import{r as s,h as t,H as e}from"./p-d2d301a6.js";const a=class{constructor(t){s(this,t),this.slot="TASKBAR_CUSTOM_ELEMENTS"}render(){return t(e,{slot:this.slot},t("div",{id:this.slot,class:"taskbar-custom-elements-container"},t("slot",null)))}};a.style=".sc-snk-taskbar-custom-elements-h{display:flex}.taskbar-custom-elements-container.sc-snk-taskbar-custom-elements{display:none}";export{a as snk_taskbar_custom_elements}