@sankhyalabs/sankhyablocks 5.5.0 → 5.7.0

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 (224) hide show
  1. package/dist/cjs/{SnkMessageBuilder-26da04f7.js → SnkMessageBuilder-056d1c24.js} +23 -1
  2. package/dist/cjs/{filter-item-type.enum-3daf58d3.js → filter-item-type.enum-aa823a00.js} +1 -0
  3. package/dist/cjs/filter-type.enum-b14ce507.js +11 -0
  4. package/dist/cjs/index-8d94b7e0.js +7 -0
  5. package/dist/cjs/index-de79181a.js +201 -0
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/presentationMode-52ec3bdd.js +7 -0
  8. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  9. package/dist/cjs/snk-application.cjs.entry.js +1 -1
  10. package/dist/cjs/snk-attach.cjs.entry.js +2 -1
  11. package/dist/cjs/snk-crud.cjs.entry.js +2 -1
  12. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  13. package/dist/cjs/{snk-data-unit-c43df27b.js → snk-data-unit-289081c4.js} +1 -1
  14. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  15. package/dist/cjs/snk-detail-view.cjs.entry.js +4 -3
  16. package/dist/cjs/snk-expression-item.cjs.entry.js +213 -0
  17. package/dist/cjs/snk-filter-bar.cjs.entry.js +52 -140
  18. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +8 -1
  19. package/dist/cjs/snk-filter-detail.cjs.entry.js +1 -1
  20. package/dist/cjs/snk-filter-field-search_2.cjs.entry.js +435 -0
  21. package/dist/cjs/snk-filter-item.cjs.entry.js +1 -1
  22. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +66 -0
  23. package/dist/cjs/snk-filter-modal.cjs.entry.js +72 -49
  24. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +3 -1
  25. package/dist/cjs/snk-filter-number.cjs.entry.js +3 -1
  26. package/dist/cjs/snk-filter-period.cjs.entry.js +11 -2
  27. package/dist/cjs/snk-filter-personalized.cjs.entry.js +3 -1
  28. package/dist/cjs/snk-filter-search.cjs.entry.js +3 -1
  29. package/dist/cjs/snk-filter-text.cjs.entry.js +2 -0
  30. package/dist/cjs/snk-grid.cjs.entry.js +3 -2
  31. package/dist/cjs/{snk-guides-viewer-e6a65393.js → snk-guides-viewer-9784c527.js} +1 -1
  32. package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -2
  33. package/dist/cjs/snk-personalized-filter.cjs.entry.js +126 -0
  34. package/dist/cjs/snk-simple-bar_2.cjs.entry.js +2 -1
  35. package/dist/cjs/snk-taskbar.cjs.entry.js +2 -1
  36. package/dist/cjs/taskbar-elements-bc2598f9.js +118 -0
  37. package/dist/collection/collection-manifest.json +3 -0
  38. package/dist/collection/components/snk-filter-bar/filter-item/editors/enum/presentationMode.js +5 -0
  39. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +47 -0
  40. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +19 -0
  41. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +19 -0
  42. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +50 -1
  43. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +19 -0
  44. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +19 -0
  45. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +19 -0
  46. package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type.enum.js +1 -0
  47. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.css +31 -2
  48. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +116 -156
  49. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.css +4 -0
  50. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +115 -0
  51. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +19 -142
  52. package/dist/collection/components/snk-filter-bar/types/filter-type.enum.js +7 -0
  53. package/dist/collection/components/snk-filter-bar/utils/SnkFilterModalFactory.js +36 -0
  54. package/dist/collection/components/snk-filter-bar/utils/filters-mock.js +315 -0
  55. package/dist/collection/components/snk-filter-field-search/snk-filter-field-search.js +62 -69
  56. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.css +4 -0
  57. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +87 -0
  58. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/filter-operands/filter-operands.js +34 -0
  59. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.css +97 -0
  60. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.js +298 -0
  61. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.js +2 -2
  62. package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +63 -0
  63. package/dist/collection/lib/message/SnkMessageBuilder.js +2 -0
  64. package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +9 -1
  65. package/dist/collection/lib/message/resources/snk-personalized-filter.msg.js +12 -0
  66. package/dist/collection/lib/store/index.js +2 -1
  67. package/dist/components/SnkMessageBuilder.js +23 -1
  68. package/dist/components/filter-item-type.enum.js +1 -0
  69. package/dist/components/index.d.ts +3 -0
  70. package/dist/components/index.js +3 -0
  71. package/dist/components/index2.js +1 -1
  72. package/dist/components/index3.js +199 -0
  73. package/dist/components/presentationMode.js +7 -0
  74. package/dist/components/snk-crud.js +22 -34
  75. package/dist/components/snk-data-exporter2.js +1 -1
  76. package/dist/components/snk-detail-view2.js +24 -46
  77. package/dist/components/snk-expression-item.d.ts +11 -0
  78. package/dist/components/snk-expression-item.js +6 -0
  79. package/dist/components/snk-expression-item2.js +241 -0
  80. package/dist/components/snk-filter-bar2.js +57 -157
  81. package/dist/components/snk-filter-binary-select.js +9 -1
  82. package/dist/components/snk-filter-field-search.js +1 -200
  83. package/dist/{esm/snk-filter-field-search.entry.js → components/snk-filter-field-search2.js} +65 -38
  84. package/dist/components/snk-filter-list.js +171 -1
  85. package/dist/components/snk-filter-modal-item.d.ts +11 -0
  86. package/dist/components/snk-filter-modal-item.js +6 -0
  87. package/dist/components/snk-filter-modal-item2.js +85 -0
  88. package/dist/components/snk-filter-modal.js +118 -1
  89. package/dist/components/snk-filter-multi-select.js +3 -1
  90. package/dist/components/snk-filter-number.js +3 -1
  91. package/dist/components/snk-filter-param-config.js +1 -273
  92. package/dist/{esm/snk-filter-param-config.entry.js → components/snk-filter-param-config2.js} +35 -11
  93. package/dist/components/snk-filter-period.js +12 -2
  94. package/dist/components/snk-filter-personalized.js +3 -1
  95. package/dist/components/snk-filter-search.js +3 -1
  96. package/dist/components/snk-filter-text.js +3 -1
  97. package/dist/components/snk-grid2.js +12 -23
  98. package/dist/components/snk-personalized-filter.d.ts +11 -0
  99. package/dist/components/snk-personalized-filter.js +158 -0
  100. package/dist/components/snk-taskbar2.js +3 -197
  101. package/dist/esm/{SnkMessageBuilder-7a9392e6.js → SnkMessageBuilder-23272e07.js} +23 -1
  102. package/dist/esm/{filter-item-type.enum-a79b2fa8.js → filter-item-type.enum-5028ed3f.js} +1 -0
  103. package/dist/esm/filter-type.enum-a80c1b6b.js +9 -0
  104. package/dist/esm/{index-6519a79e.js → index-507e19ec.js} +1 -1
  105. package/dist/esm/index-620ac460.js +7 -0
  106. package/dist/esm/index-8efbf198.js +199 -0
  107. package/dist/esm/loader.js +1 -1
  108. package/dist/esm/presentationMode-783bbf9d.js +7 -0
  109. package/dist/esm/sankhyablocks.js +1 -1
  110. package/dist/esm/snk-application.entry.js +1 -1
  111. package/dist/esm/snk-attach.entry.js +3 -2
  112. package/dist/esm/snk-crud.entry.js +3 -2
  113. package/dist/esm/snk-data-exporter.entry.js +3 -3
  114. package/dist/esm/{snk-data-unit-f9e4c694.js → snk-data-unit-34dc5371.js} +1 -1
  115. package/dist/esm/snk-data-unit.entry.js +2 -2
  116. package/dist/esm/snk-detail-view.entry.js +5 -4
  117. package/dist/esm/snk-expression-item.entry.js +209 -0
  118. package/dist/esm/snk-filter-bar.entry.js +53 -141
  119. package/dist/esm/snk-filter-binary-select.entry.js +9 -2
  120. package/dist/esm/snk-filter-detail.entry.js +1 -1
  121. package/dist/esm/snk-filter-field-search_2.entry.js +430 -0
  122. package/dist/esm/snk-filter-item.entry.js +1 -1
  123. package/dist/esm/snk-filter-modal-item.entry.js +62 -0
  124. package/dist/esm/snk-filter-modal.entry.js +73 -50
  125. package/dist/esm/snk-filter-multi-select.entry.js +4 -2
  126. package/dist/esm/snk-filter-number.entry.js +4 -2
  127. package/dist/esm/snk-filter-period.entry.js +12 -3
  128. package/dist/esm/snk-filter-personalized.entry.js +4 -2
  129. package/dist/esm/snk-filter-search.entry.js +4 -2
  130. package/dist/esm/snk-filter-text.entry.js +3 -1
  131. package/dist/esm/snk-grid.entry.js +3 -2
  132. package/dist/esm/{snk-guides-viewer-62a9f74d.js → snk-guides-viewer-4d12f268.js} +2 -2
  133. package/dist/esm/snk-guides-viewer.entry.js +4 -3
  134. package/dist/esm/snk-personalized-filter.entry.js +122 -0
  135. package/dist/esm/snk-simple-bar_2.entry.js +3 -2
  136. package/dist/esm/snk-taskbar.entry.js +3 -2
  137. package/dist/esm/taskbar-elements-e6af3e93.js +115 -0
  138. package/dist/sankhyablocks/p-0110b7da.entry.js +1 -0
  139. package/dist/sankhyablocks/p-1a68fb59.js +1 -0
  140. package/dist/sankhyablocks/p-27e264d9.entry.js +1 -0
  141. package/dist/sankhyablocks/p-343699ad.entry.js +1 -0
  142. package/dist/sankhyablocks/{p-f2223502.js → p-3db1d3de.js} +1 -1
  143. package/dist/sankhyablocks/p-433dfa63.entry.js +1 -0
  144. package/dist/sankhyablocks/p-45ee8b22.entry.js +1 -0
  145. package/dist/sankhyablocks/{p-f132e371.js → p-4c2015a9.js} +1 -1
  146. package/dist/sankhyablocks/p-4ce96831.entry.js +1 -0
  147. package/dist/sankhyablocks/p-4eefe631.entry.js +1 -0
  148. package/dist/sankhyablocks/{p-9dd2b8cb.js → p-584d7212.js} +1 -1
  149. package/dist/sankhyablocks/{p-a412992c.entry.js → p-64b03506.entry.js} +1 -1
  150. package/dist/sankhyablocks/p-6a02e236.js +1 -0
  151. package/dist/sankhyablocks/p-7695c404.entry.js +1 -0
  152. package/dist/sankhyablocks/p-786ae316.entry.js +1 -0
  153. package/dist/sankhyablocks/p-82bc97da.entry.js +1 -0
  154. package/dist/sankhyablocks/p-8bdf5e57.entry.js +1 -0
  155. package/dist/sankhyablocks/p-8efb0f47.entry.js +1 -0
  156. package/dist/sankhyablocks/p-9af04fc7.entry.js +1 -0
  157. package/dist/sankhyablocks/{p-3a2ce158.entry.js → p-a1c58536.entry.js} +1 -1
  158. package/dist/sankhyablocks/{p-afba9bbe.entry.js → p-bdbb2672.entry.js} +1 -1
  159. package/dist/sankhyablocks/{p-b2523981.entry.js → p-c1ab16d0.entry.js} +2 -2
  160. package/dist/sankhyablocks/{p-aeffd219.js → p-ccd26e3a.js} +1 -1
  161. package/dist/sankhyablocks/p-d410f45a.js +1 -0
  162. package/dist/sankhyablocks/p-d9804798.js +1 -0
  163. package/dist/sankhyablocks/p-df8f13b4.entry.js +1 -0
  164. package/dist/sankhyablocks/p-e2bb9c9a.entry.js +1 -0
  165. package/dist/sankhyablocks/p-e9f42525.entry.js +1 -0
  166. package/dist/sankhyablocks/p-ed3d6ab4.entry.js +1 -0
  167. package/dist/sankhyablocks/p-ee1381f4.entry.js +1 -0
  168. package/dist/sankhyablocks/p-f4184ce7.js +1 -0
  169. package/dist/sankhyablocks/p-f5f36fbb.js +1 -0
  170. package/dist/sankhyablocks/p-fd4ed40a.entry.js +1 -0
  171. package/dist/sankhyablocks/p-ff96b509.entry.js +27 -0
  172. package/dist/sankhyablocks/p-ffac37d5.entry.js +1 -0
  173. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  174. package/dist/types/components/snk-filter-bar/filter-item/editors/enum/presentationMode.d.ts +4 -0
  175. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +5 -0
  176. package/dist/types/components/snk-filter-bar/filter-item/filter-item-type.enum.d.ts +2 -1
  177. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +3 -0
  178. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +37 -0
  179. package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +17 -0
  180. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +2 -11
  181. package/dist/types/components/snk-filter-bar/types/filter-type.enum.d.ts +6 -0
  182. package/dist/types/components/snk-filter-bar/utils/SnkFilterModalFactory.d.ts +20 -0
  183. package/dist/types/components/snk-filter-bar/utils/filters-mock.d.ts +186 -0
  184. package/dist/types/components/snk-filter-field-search/interfaces/index.d.ts +14 -4
  185. package/dist/types/components/snk-filter-field-search/snk-filter-field-search.d.ts +13 -10
  186. package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +20 -0
  187. package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-item/filter-operands/filter-operands.d.ts +9 -0
  188. package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.d.ts +54 -0
  189. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IExpressionItem.d.ts +4 -2
  190. package/dist/types/components.d.ts +196 -63
  191. package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +7 -0
  192. package/dist/types/lib/message/resources/snk-personalized-filter.msg.d.ts +1 -0
  193. package/dist/types/lib/store/index.d.ts +1 -0
  194. package/package.json +1 -1
  195. package/react/components.d.ts +3 -0
  196. package/react/components.js +3 -0
  197. package/react/components.js.map +1 -1
  198. package/dist/cjs/snk-filter-field-search.cjs.entry.js +0 -185
  199. package/dist/cjs/snk-filter-param-config.cjs.entry.js +0 -256
  200. package/dist/cjs/taskbar-elements-80285601.js +0 -313
  201. package/dist/components/snk-filter-list2.js +0 -173
  202. package/dist/components/snk-filter-modal2.js +0 -97
  203. package/dist/esm/taskbar-elements-055ba1ad.js +0 -309
  204. package/dist/sankhyablocks/p-4512cc6c.entry.js +0 -1
  205. package/dist/sankhyablocks/p-5cbbe1f7.entry.js +0 -1
  206. package/dist/sankhyablocks/p-5e62a17b.entry.js +0 -1
  207. package/dist/sankhyablocks/p-5fc55684.entry.js +0 -1
  208. package/dist/sankhyablocks/p-63d01871.entry.js +0 -1
  209. package/dist/sankhyablocks/p-73e830cf.entry.js +0 -1
  210. package/dist/sankhyablocks/p-741b00ef.entry.js +0 -1
  211. package/dist/sankhyablocks/p-79d22df0.entry.js +0 -1
  212. package/dist/sankhyablocks/p-86d29b6f.entry.js +0 -1
  213. package/dist/sankhyablocks/p-92a0fca4.js +0 -1
  214. package/dist/sankhyablocks/p-93d8fe00.entry.js +0 -1
  215. package/dist/sankhyablocks/p-999d1953.entry.js +0 -1
  216. package/dist/sankhyablocks/p-ad51bf1c.entry.js +0 -1
  217. package/dist/sankhyablocks/p-c336170d.entry.js +0 -1
  218. package/dist/sankhyablocks/p-c3efd4eb.entry.js +0 -1
  219. package/dist/sankhyablocks/p-d5c9c1f8.entry.js +0 -1
  220. package/dist/sankhyablocks/p-ebe876f5.entry.js +0 -1
  221. package/dist/sankhyablocks/p-ed438690.js +0 -1
  222. package/dist/sankhyablocks/p-ee82c157.entry.js +0 -1
  223. package/dist/sankhyablocks/p-f3d0c744.entry.js +0 -1
  224. package/dist/sankhyablocks/p-fac37198.entry.js +0 -1
@@ -0,0 +1 @@
1
+ import{r as s,c as t,h as i,g as e}from"./p-b9667fbe.js";import{ElementIDUtils as r,ApplicationContext as h}from"@sankhyalabs/core";import{F as o}from"./p-584d7212.js";const n=class{constructor(i){s(this,i),this.valueChanged=t(this,"valueChanged",7),this.config=void 0,this.value=void 0}ezChangeListener(s){this.value=this._searchInput.value,this.valueChanged.emit(this.value)}componentDidLoad(){this._element&&r.addIDInfo(this._element,"filterContentEditor")}doSearch(s,t){const i=h.getContextValue("__SNK__APPLICATION__");return new Promise(((e,r)=>{i.executePreparedSearch(s,t,this.config.props.searchContext).then((s=>{e(s)})).catch((s=>{r(s)}))}))}async show(){this._searchInput.setFocus()}render(){if(this.config&&this.config.type===o.SEARCH)return i("ez-search",{id:this.config.id,suppressEmptyOption:!0,value:this.config.value,label:this.config.label,ref:s=>this._searchInput=s,optionLoader:({mode:s,argument:t})=>this.doSearch(s,t)})}get _element(){return e(this)}};export{n as snk_filter_search}
@@ -0,0 +1 @@
1
+ import{r as t,c as e,h as i}from"./p-b9667fbe.js";import{ApplicationContext as s,DataType as n,Action as a}from"@sankhyalabs/core";import{D as r}from"./p-41d92871.js";import{c as o}from"./p-17375123.js";import{D as h}from"./p-f821768b.js";import{T as l}from"./p-d410f45a.js";import"./p-112455b1.js";import"./p-4c2015a9.js";import"./p-6a02e236.js";var d;!function(t){t.LINK_AND_FILE_AT_THE_SAME_TIME="LINK_AND_FILE_AT_THE_SAME_TIME",t.ANY_LINK_OR_FILE_FILLED="ANY_LINK_OR_FILE_FILLED",t.UNKNOWN="UNKNOWN"}(d||(d={}));class c{constructor(t,e,i){var s;this.entityName=t,this.registerKey=e,this.dataUnitName=i,this.validateFields=t=>{if(t.LINK&&t.NOMEARQUIVO)throw new Error(d.LINK_AND_FILE_AT_THE_SAME_TIME);if(!t.LINK&&!t.NOMEARQUIVO)throw new Error(d.ANY_LINK_OR_FILE_FILLED);if(!this.registerKey)throw new Error("Register key can not be null")},this.resourceID=window.resourceID||(null===(s=window.workspace)||void 0===s?void 0:s.resourceID)}async save(t){var e,i;const s="AnexoSistemaSP.salvar";let{updatingFields:n}=t;n=Object.assign(Object.assign({},n),{NOMEARQUIVO:null===(e=n.NOMEARQUIVO)||void 0===e?void 0:e[0]});try{this.validateFields(n);const t=n.LINK?null:n.NOMEARQUIVO,e={serviceName:s,requestBody:{params:{resourceID:this.resourceID,description:n.DESCRICAO,fileSelect:t?1:0,keySession:null===(i=null==t?void 0:t.properties)||void 0===i?void 0:i.fileNameTmp,nameAttach:null==t?void 0:t.name,link:n.LINK,nameEntity:this.entityName,pkEntity:this.registerKey,typeAcess:n.TIPOACESSO,typeApres:n.TIPOAPRES}}},a=await r.get().callServiceBroker(s,JSON.stringify(e));return Promise.resolve([Object.assign(Object.assign(Object.assign({},a),n),{ARQUIVOOULINK:n.LINK?n.LINK:null==t?void 0:t.name,__owner__dataunit__name__:this.dataUnitName})])}catch(t){return Promise.reject(t)}}async edit(t){var e,i,s;const n="AnexoSistemaSP.salvar";let{updatingFields:a,record:o}=t;const h=t=>void 0!==a[t]?a[t]:o[t],l=h("NOMEARQUIVO"),d=null===(i=null===(e=a.NOMEARQUIVO)||void 0===e?void 0:e[0])||void 0===i?void 0:i.downloadURL;a=Object.assign(Object.assign({},a),{DESCRICAO:h("DESCRICAO"),LINK:h("LINK"),TIPOACESSO:h("TIPOACESSO"),TIPOAPRES:h("TIPOAPRES"),CHAVEARQUIVO:o.CHAVEARQUIVO,NOMEARQUIVO:null==l?void 0:l[0]});const c=a.LINK?null:a.NOMEARQUIVO;try{this.validateFields(a);const t={serviceName:n,requestBody:{params:{resourceID:this.resourceID,nuAttach:null==o?void 0:o.NUATTACH,description:a.DESCRICAO,fileSelect:d?1:0,keySession:null===(s=null==c?void 0:c.properties)||void 0===s?void 0:s.fileNameTmp,keyAttach:a.CHAVEARQUIVO,nameAttach:null==c?void 0:c.name,link:a.LINK,nameEntity:this.entityName,pkEntity:this.registerKey,typeAcess:a.TIPOACESSO,typeApres:a.TIPOAPRES}}},e=await r.get().callServiceBroker(n,JSON.stringify(t));return Promise.resolve([Object.assign(Object.assign(Object.assign({},e),a),{ARQUIVOOULINK:a.LINK?a.LINK:null==c?void 0:c.name,__owner__dataunit__name__:this.dataUnitName})])}catch(t){return Promise.reject(t)}}delete(t){var e;const i="AnexoSistemaSP.excluir",s=(null===(e=t.NOMEARQUIVO)||void 0===e?void 0:e[0])||{},n={serviceName:i,requestBody:{paramsDelete:{keyAttach:t.CHAVEARQUIVO,nameAttach:null==s?void 0:s.name,nameEntity:t.NOMEINSTANCIA,nuAttach:t.NUATTACH,pkEntity:t.PKREGISTRO}}};return new Promise(((t,e)=>{r.get().callServiceBroker(i,JSON.stringify(n)).then((e=>t(e))).catch((t=>e(t)))}))}getDownloadKey(t){var e;const i="AnexoSistemaSP.baixar",s=(null===(e=t.NOMEARQUIVO)||void 0===e?void 0:e[0])||{},n={serviceName:i,requestBody:{paramsDown:{nameAttach:null==s?void 0:s.name,nameEntity:t.NOMEINSTANCIA,nuAttach:t.NUATTACH,pkEntity:t.PKREGISTRO,keyAttach:t.CHAVEARQUIVO}}};return new Promise(((t,e)=>{r.get().callServiceBroker(i,JSON.stringify(n)).then((e=>t(e))).catch((t=>e(t)))}))}}class m{constructor(t,e){this.entityName=t,this.getMessage=e,this._application=s.getContextValue("__SNK__APPLICATION__")}initLoaders(t,e,i){this.loader||(this.loader=t.dataLoader),t.dataLoader=(t,e)=>this.dataLoader(t,e),t.saveLoader=(t,s)=>this.saveLoader(s,e).then((t=>(t.length&&i(),t))),t.removeLoader=(t,s)=>this.removeLoader(t,s,e).then((t=>(t.length&&i(),t)))}dataLoader(t,e){return new Promise((i=>{this.loader(t,e).then((t=>{const e=((null==t?void 0:t.records)||[]).map((t=>{let e;return t.LINK||(e=[{name:t.NOMEARQUIVO}]),Object.assign(Object.assign({},t),{ARQUIVOOULINK:t.LINK?t.LINK:t.NOMEARQUIVO,NOMEARQUIVO:e})}));i(Object.assign(Object.assign({},t),{records:e}))}))}))}saveLoader(t,e){return new Promise((i=>{var s;const n=Array.isArray(t)?t[0]:{};((null===(s=null==n?void 0:n.record)||void 0===s?void 0:s.NUATTACH)>=0?e.edit.bind(e):e.save.bind(e))(n).then((t=>{i(t)})).catch((t=>t.message===d.LINK_AND_FILE_AT_THE_SAME_TIME?(this._application.alert(this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.title"),this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.message")),i([])):t.message===d.ANY_LINK_OR_FILE_FILLED?(this._application.alert(this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.title"),this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.message")),i([])):t.message?(this._application.error(t.title||t.name,t.message),i([])):void i([])))}))}removeLoader(t,e,i){return new Promise((s=>{const{records:n}=t.getSelectionInfo();i.delete(n[0]).then((()=>{s(e)})),s([])}))}getFilters(t){return[{name:"AttachmentsByPK",expression:"this.PKREGISTRO = :PKREGISTRO",params:[{name:"PKREGISTRO",dataType:n.TEXT,value:`${t}_${this.entityName}`}]}]}getInterceptions(t,e,i){return new Promise((s=>e.type===a.EDITION_CANCELED?t.isDirty()?this._application.confirm(this.getMessage("snkAttach.cancelConfirmation.title"),this.getMessage("snkAttach.cancelConfirmation.message")).then((t=>t?(i.goToView(o.GRID),s(e)):s(void 0))):s(e):e.type===a.DATA_SAVED?(t.loadData(),s(e)):void s(e)))}}const u=s.getContextValue("__SNK__APPLICATION__"),v=t=>{var e,i;return null===(i=null===(e=null==u?void 0:u.messagesBuilder)||void 0===e?void 0:e.getMessage)||void 0===i?void 0:i.call(e,t,null)},A={DOWNLOAD:{hint:v("snkAttach.taskbar.titleDownload"),name:"DOWNLOAD",iconName:"file-download"},LINK:{hint:v("snkAttach.taskbar.titleLink"),name:"LINK",iconName:"launch"}},O=()=>{const t=[l.REMOVE,"DOWNLOAD","LINK"];return{getButtons:(t,e,i)=>{if((null==e?void 0:e.insertionMode)||(null==e?void 0:e.isDirty))return i.reverse();i.splice(i.indexOf(l.REFRESH),1);const{selectedRecord:s}=e||{},n=(null==s?void 0:s.LINK)?A.LINK:A.DOWNLOAD;i.splice(i.indexOf(l.DIVIDER)+1,0,l.REMOVE,n,l.DIVIDER);const a=Array.from(new Set(i.filter((t=>t!==l.CLONE))));return a.splice(a.indexOf(n)+1,0,l.DIVIDER),a},isEnabled:(e,i,s)=>{const n=void 0!==(null==i?void 0:i.selectedRecord);return!(t.includes(s)&&!n)}}},I={grid:{columns:[{name:"ARQUIVOOULINK",orderIndex:0,width:0},{name:"DESCRICAO",orderIndex:1,width:0},{name:"DHCAD",orderIndex:2,width:0},{name:"DHALTER",orderIndex:3,width:0},{name:"TIPOAPRES",orderIndex:4,width:0},{name:"TIPOACESSO",orderIndex:5,width:0},{name:"CODUSU",orderIndex:6,width:0},{name:"CODUSUALT",orderIndex:7,width:0}]},form:{emptyConfig:!1,fields:[{name:"DESCRICAO",required:!0},{name:"TIPOAPRES",required:!0},{name:"TIPOACESSO",required:!0},{name:"LINK"},{name:"NOMEARQUIVO"}]}},_=class{constructor(i){t(this,i),this.back=e(this,"back",7),this.handleTaskbarClick=({detail:t})=>{if(["DOWNLOAD","LINK"].includes(t))return this.downloadAttachment(this.dataUnit.getSelectedRecord())},this.handleBack=()=>{this.dataUnit.cancelEdition().then((t=>{t&&this.back.emit()}))},this.handleFinish=()=>{if(!this.dataUnit.isDirty())return this.back.emit();this.dataUnit.saveData().then((()=>{this.showFinishedToast(),this.back.emit()}))},this.registerKey=void 0,this.entityName=void 0,this.messagesBuilder=void 0,this.dataUnit=void 0,this.crudConfig={}}registerKeyWatcher(t,e){var i;e!==t&&(this.returnToGridMode(),this._attachFetcher=new c(this.entityName,this.registerKey,null===(i=this.dataUnit)||void 0===i?void 0:i.name),this._dataUnitBuilder.initLoaders(this.dataUnit,this._attachFetcher,(()=>{this.returnToGridMode()})),this.dataUnit.loadData())}getMessage(t,e){if(this.messagesBuilder)return this.messagesBuilder.getMessage(t,e)}showFinishedToast(){this._application.info(this.getMessage("snkAttach.finishedMessage"),{iconName:"check"})}downloadAttachment(t){if(!t)throw new Error("Nenhum registro selecionado");t.LINK?window.open(`${t.LINK}`):this._attachFetcher.getDownloadKey(t).then((({chave:t})=>{window.open(`/mge/visualizadorArquivos.mge?chaveArquivo=${t.valor}&forcarDownload=S`)}))}returnToGridMode(){this.dataUnit.clearSelection(),this._crudElement&&this._crudElement.goToView(o.GRID)}loadAttachmentDataUnit(){var t;try{const e=this.dataUnit||(new h).getDataUnit("AnexoSistema","br.com.sankhya.core.v3.anexoSistema");return this._attachFetcher=new c(this.entityName,this.registerKey,null===(t=this.dataUnit)||void 0===t?void 0:t.name),e.metadata||e.loadMetadata().then((()=>{this.crudConfig=I})),this._dataUnitBuilder=new m(this.entityName,this.getMessage.bind(this)),e.addFilterProvider({getFilter:()=>this._dataUnitBuilder.getFilters(this.registerKey)}),e.addInterceptor({interceptAction:t=>this._dataUnitBuilder.getInterceptions(e,t,this._crudElement)}),this.dataUnit=e,this.dataUnit.loadData(),this.dataUnit}catch(t){throw new Error("There was an error while creating the data unit")}}componentWillLoad(){this._application=s.getContextValue("__SNK__APPLICATION__"),this.loadAttachmentDataUnit()}render(){return this.dataUnit?i("main",null,i("header",{class:"snk-attach__header"},i("snk-simple-bar",{onExit:this.handleBack,messagesBuilder:this.messagesBuilder},i("div",{slot:"rightSlot"},i("ez-button",{class:"ez-button--primary",label:this.getMessage("snkAttach.finish"),onClick:this.handleFinish})))),i("div",{class:"snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column"},i("div",{class:"ez-box__container"},i("snk-simple-crud",{ref:t=>this._crudElement=t,dataUnit:this.dataUnit,taskbarManager:O(),gridConfig:this.crudConfig.grid,formConfig:this.crudConfig.form,useCancelConfirm:!1,onActionClick:this.handleTaskbarClick},i("div",{slot:"snkSimpleCrudHeader"},i("div",{class:"ez-flex ez-flex--column"},i("span",{class:"ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium"},this.getMessage("snkAttach.title")),i("span",{class:"ez-text ez-text--medium ez-text--secondary"},this.getMessage("snkAttach.description")))))))):null}static get watchers(){return{registerKey:["registerKeyWatcher"]}}};_.style=".snk-attach__header.sc-snk-attach,.snk-attach__crud-section.sc-snk-attach{padding:0 var(--space--lg)}.snk-attach__file-info.sc-snk-attach{padding:var(--space--small);max-width:50%}";export{_ as snk_attach}
@@ -1 +1 @@
1
- var E;!function(E){E.MULTI_SELECT="MULTI_SELECT",E.BINARY_SELECT="BINARY_SELECT",E.PERIOD="PERIOD",E.SEARCH="SEARCH",E.TEXT="TEXT",E.NUMBER="NUMBER",E.DEFAULT_FILTER="DEFAULT_FILTER",E.PERSONALIZED="PERSONALIZED"}(E||(E={}));const T=E;export{T as F}
1
+ var E;!function(E){E.MULTI_SELECT="MULTI_SELECT",E.BINARY_SELECT="BINARY_SELECT",E.PERIOD="PERIOD",E.SEARCH="SEARCH",E.TEXT="TEXT",E.NUMBER="NUMBER",E.DEFAULT_FILTER="DEFAULT_FILTER",E.PERSONALIZED="PERSONALIZED",E.MULTI_LIST="MULTI_LIST"}(E||(E={}));const T=E;export{T as F}
@@ -1 +1 @@
1
- import{r as t,h as e,H as i,g as s}from"./p-b9667fbe.js";import{ObjectUtils as o,ApplicationContext as r,ElementIDUtils as n}from"@sankhyalabs/core";import{ApplicationUtils as l,DialogType as a}from"@sankhyalabs/ezui/dist/collection/utils";import{D as d,a as h,b as c}from"./p-f132e371.js";import{d as p,W as u,R as m}from"./p-17375123.js";import{D as v}from"./p-41d92871.js";import{S as x}from"./p-f2223502.js";import"./p-112455b1.js";import"./p-92a0fca4.js";class f{constructor(t,e){this._selectedNumber=0,this._getMessage=t,this._selectedNumber=e}setExportOption(t,e){const i=this.getExportGroupName();t===d.EXPORT_TO_PDF&&e.push(this.getExportToPDF(i)),t===d.EXPORT_TO_XLS&&e.push(this.getExportToXLS(i)),this.setExportCurrentPage(t,e),this.setExportByEmail(t,e)}setExportCurrentPage(t,e){var i;const s=[d.EXPORT_PAGE_TO_PDF,d.EXPORT_PAGE_TO_XLS];if(t===d.EXPORT_CURRENT_PAGE&&e.push(this.getCurrentPage()),s.includes(t)){let s=e.find((t=>t.id===d.EXPORT_CURRENT_PAGE));null==s&&(e.push(this.getCurrentPage()),s=e.find((t=>t.id===d.EXPORT_CURRENT_PAGE))),(null===(i=null==s?void 0:s.children)||void 0===i?void 0:i.length)||(s.children=[]),t===d.EXPORT_PAGE_TO_PDF&&s.children.push(this.getExportPageToPDF()),t===d.EXPORT_PAGE_TO_XLS&&s.children.push(this.getExportPageToXLS())}}setExportByEmail(t,e){t===d.EXPORT_BY_EMAIL&&e.push(this.getExportByEmail())}getExportToPDF(t){return{id:d.EXPORT_TO_PDF,label:"PDF (.pdf)",group:t}}getExportToXLS(t){return{id:d.EXPORT_TO_XLS,label:`${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`,group:t}}getCurrentPage(){return{id:d.EXPORT_CURRENT_PAGE,label:this._getMessage("snkDataExporter.label.currentPage"),group:this._getMessage("snkDataExporter.group.custom")}}getExportPageToPDF(){return{id:d.EXPORT_PAGE_TO_PDF,label:"PDF (.pdf)"}}getExportPageToXLS(){return{id:d.EXPORT_PAGE_TO_XLS,label:`${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`}}getExportByEmail(){return{id:d.EXPORT_BY_EMAIL,label:`${this._getMessage("snkDataExporter.label.sendByEmail")}...`}}getExportGroupName(){return 1===this._selectedNumber?this._getMessage("snkDataExporter.group.export.selectedLine"):this._selectedNumber>1?this._getMessage("snkDataExporter.group.export.multiSelected").replace("{0}",this._selectedNumber.toString()):this._getMessage("snkDataExporter.group.export.default")}}function E(t){var{methodName:e}=t,i=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(s=Object.getOwnPropertySymbols(t);o<s.length;o++)e.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(t,s[o])&&(i[s[o]]=t[s[o]])}return i}(t,["methodName"]);const s=`mgefin-bff@DataExporterSPBean.${e}`,r={serviceName:s,requestBody:i};return new Promise(((t,e)=>{v.get().callServiceBroker(s,o.objectToString(r)).then((e=>t(function(t){var e;const i=null===(e=null==t?void 0:t.json)||void 0===e?void 0:e.$;if(null!=i)return o.stringToObject(i)}(e)))).catch((t=>e(t)))}))}const b=5e3,k=class{constructor(e){t(this,e),this._selectedNumber=0,this._customPrefix="$custom$",this._items=[],this._showDropdown=!1,this._releasedToExport=[d.EXPORT_TO_PDF,d.EXPORT_TO_XLS,d.EXPORT_BY_EMAIL,d.EXPORT_PDF_TO_EMAIL,d.EXPORT_XLS_TO_EMAIL,d.EXPORT_PAGE_TO_PDF,d.EXPORT_PAGE_TO_XLS],this.provider=null,this.messagesBuilder=void 0}async exportByEmail(){const t=this._selectedNumber;this._snkEmailSender.open({type:t>0?"selection":"all",selectedRows:t,email:{attachments:[{name:this._appLabel}]},resolver:({type:t,format:e,email:{to:i,subject:s,message:o}})=>{var r;const n=null!==(r=h[null==e?void 0:e.toUpperCase()])&&void 0!==r?r:h.PDF;this.resolveExporter({type:t,methodName:n,to:i,subject:s,message:o,fileName:this._appLabel,titleGrid:this._appLabel},(()=>{this._snkEmailSender.close(),l.info(this.getMessage("snkDataExporter.message.emailSuccess"),{iconName:"check"})}))}})}getMessage(t,e){if(null==this.messagesBuilder){const t=x.getNearestInstance(this._element);t&&(this.messagesBuilder=t.messagesBuilder)}return this.messagesBuilder.getMessage(t,e)}positionDropdown(){var t;const e=null===(t=this._ezButton)||void 0===t?void 0:t.getBoundingClientRect();null!=e&&null!=this._dropdownParent&&(this._dropdownParent.style.top=e.y+e.height+5+"px",this._dropdownParent.style.left=e.x+"px")}closeDropdown(t){const e=null==t?void 0:t.target;null!=e&&(e.closest(".snk-data-exporter")||(this._showDropdown=!1))}setEvents(){document.removeEventListener("click",this.closeDropdown.bind(this)),document.addEventListener("click",this.closeDropdown.bind(this)),document.removeEventListener("scroll",this.positionDropdown.bind(this)),document.addEventListener("scroll",this.positionDropdown.bind(this))}controlDropdown(){this._showDropdown=!this._showDropdown}resolveExporter(t,e){if(null==this.provider||null==t||null==e)return;const i=this.provider.getFilters(),s=this.provider.getColumnsMetadata(),o=this.provider.getOrders(),r=this.provider.getResourceURI(),n=this.provider.getSelectedIDs(),a=t.exportOption,h=[d.EXPORT_PAGE_TO_PDF,d.EXPORT_PAGE_TO_XLS];delete t.exportOption;let c=Object.assign({filters:i,columns:s,sort:o,resourceURI:r,selectedIDs:n.slice(0,b)},t);if(h.includes(a)||"page"==t.type){const t=this.provider.getOffset(),e=this.provider.getLimit();c=Object.assign(Object.assign({},c),{offset:t,limit:e,selectedIDs:[]})}else"all"==t.type&&(c=Object.assign(Object.assign({},c),{offset:0,limit:b,selectedIDs:[]}));E(c).then((t=>e(t))).catch((t=>l.error(this.getMessage("snkDataExporter.message.exportError"),t?t.statusMessage:this.getMessage("snkDataExporter.message.exportError"))))}getOptionKey(t){return Object.keys(d).find((e=>d[e]===t))}dispatchExporter(t){var e;const i=this.getOptionKey(t),s=null!==(e=c[i])&&void 0!==e?e:c.EXPORT_TO_PDF,o=c[i]===c.EXPORT_TO_XLS;this.resolveExporter({methodName:d[`EXPORT_TO_${s}`],fileName:this._appLabel,titleGrid:this._appLabel,exportOption:t,limit:b},(t=>{!function({fileSessionKey:t,canPrint:e,canExport:i,useAppPrint:s,isDownload:o}){const n=r.getContextValue("__SNK__APPLICATION__");if(s&&!o)return function(t,e,i,s){null==s||s.webConnection(p,u.methods.PDF_VIEWER,{chaveArquivo:t,permiteImprimir:e?"S":"N",permiteExportar:i?"S":"N",contentType:"S"})}(t,e,i,n);window.open(`${window.location.protocol}//${window.location.hostname}:${window.location.port}/mge/visualizadorArquivos.mge?chaveArquivo=${t}${o?"&download=S":""}`),l.info(function(t){var e;return null===(e=null==t?void 0:t.messagesBuilder)||void 0===e?void 0:e.getMessage("fileViewer.message.exportSuccess",void 0)}(n),{iconName:"check"})}(Object.assign(Object.assign({},t),{fileType:s,isDownload:o}))}))}async processExporter(t){var e,i,s,o;const r=null==t?void 0:t.detail,n=[d.EXPORT_PAGE_TO_PDF,d.EXPORT_PAGE_TO_XLS],h=null===(e=null==r?void 0:r.id)||void 0===e?void 0:e.includes(this._customPrefix);if((null==r?void 0:r.id)===d.EXPORT_CURRENT_PAGE)return;const c=null===(i=this.provider)||void 0===i?void 0:i.getSelectedIDs(),p=null===(s=this.provider)||void 0===s?void 0:s.getTotalRecords(),u=null===(o=this.provider)||void 0===o?void 0:o.getLimit();let m=!1;if(n.includes(null==r?void 0:r.id)&&u<=b||h?m=!1:(null==c?void 0:c.length)?m=c.length>b:p>b&&(m=!0),m){const t=b.toLocaleString("pt-BR",{minimumFractionDigits:0}),e={title:this.getMessage("snkDataExporter.limitExceeded.title"),description:`\n ${this.getMessage("snkDataExporter.limitExceeded.description",{limit:t})}\n <br/><br/>\n <b>\n ${this.getMessage("snkDataExporter.limitExceeded.subdescription")}\n </b>\n `,cancel:this.getMessage("snkDataExporter.limitExceeded.cancel"),confirm:this.getMessage("snkDataExporter.limitExceeded.continue")};if(!await l.confirm(e.title,e.description,null,a.WARN,{labelCancel:e.cancel,labelConfirm:e.confirm}))return}if(h)return this.openPersonalizedReports(r.id),void(this._showDropdown=!1);this._releasedToExport.includes(null==r?void 0:r.id)&&(r.id===d.EXPORT_BY_EMAIL?this.exportByEmail():this.dispatchExporter(r.id),this._showDropdown=!1)}loadItems(){const t=[];this._releasedToExport.forEach((e=>{var i;null===(i=this._itemBuilder)||void 0===i||i.setExportOption(e,t)})),this.loadPersonalizedItems(t)}async loadPersonalizedItems(t){var e;const i=null===(e=this.provider)||void 0===e?void 0:e.getRecordID();if(null==i)return void(this._items=t);const s=await function(t){const e="mgefin-bff@DataExporterSPBean.getPersonalizedReports",i={serviceName:e,requestBody:t};return new Promise(((t,s)=>v.get().callServiceBroker(e,o.objectToString(i)).then((e=>t(function(t){var e;const i=null===(e=null==t?void 0:t.json)||void 0===e?void 0:e.$;if(null!=i)return o.stringToObject(i)}(e)))).catch((t=>s(t)))))}({recordID:i});null==s||s.forEach((e=>{t.push({id:`${this._customPrefix}_${e.ID}`,label:e.label,group:this.getMessage("snkDataExporter.group.custom")})})),this._items=t}openPersonalizedReports(t){var e;const i=[],s=(null==t?void 0:t.replace(this._customPrefix,""))||"";null===(e=this.provider)||void 0===e||e.getSelectedIDs().forEach((({name:t,type:e,value:s},o)=>{const r=[];r.fields=[],0===o&&(i[`PK_${t}`]={type:e,value:s},i.pks=[]),r.fields.push({nome:t,tipo:e,valor:s}),i.pks.push(r)})),this._application.openApp(`${m}${s}`,i)}loadDropdown(){var t,e;this._selectedNumber=(null===(e=null===(t=this.provider)||void 0===t?void 0:t.getSelectedIDs())||void 0===e?void 0:e.length)||0,this._itemBuilder=new f(this.getMessage.bind(this),this._selectedNumber),this.loadItems()}getElementID(t){return{[n.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:n.getInternalIDInfo(t)}}canShowDropdown(){var t;return this._showDropdown&&(null===(t=this._items)||void 0===t?void 0:t.length)>0}componentWillLoad(){var t;this._application=r.getContextValue("__SNK__APPLICATION__"),null===(t=this._application)||void 0===t||t.getAppLabel().then((t=>this._appLabel=t)),this.setEvents()}componentDidLoad(){null!=this._element&&(n.addIDInfo(this._element),this.positionDropdown())}componentWillUpdate(){var t;this._showDropdown&&!(null===(t=this._items)||void 0===t?void 0:t.length)&&this.loadDropdown()}componentDidUpdate(){var t;this._showDropdown?this.positionDropdown():(null===(t=this._items)||void 0===t?void 0:t.length)>0&&(this._items=[])}render(){return e(i,null,e("div",{class:`snk-data-exporter\n ${this.canShowDropdown()?" snk-data-exporter--overlap":""}\n `},e("ez-button",Object.assign({ref:t=>this._ezButton=t,iconName:"file-download",size:"small",mode:"icon",title:this.getMessage("snkDataExporter.group.export.title"),onClick:()=>this.controlDropdown()},this.getElementID("button"))),e("div",Object.assign({ref:t=>this._dropdownParent=t,class:`snk-data-exporter__dropdown\n ${this.canShowDropdown()?"snk-data-exporter__dropdown--show":""}\n `},this.getElementID("dropdown")),this.canShowDropdown()&&e("ez-dropdown",Object.assign({items:this._items,onEzClick:t=>this.processExporter(t)},this.getElementID("dropdown"))))),this.canShowDropdown()&&e("div",Object.assign({class:"ez-scrim ez-scrim--light"},this.getElementID("ezScrim"))),e("snk-exporter-email-sender",Object.assign({ref:t=>this._snkEmailSender=t,getMessage:(t,e)=>this.getMessage(t,e)},this.getElementID("snkExporterEmailSender"))))}get _element(){return s(this)}};k.style=".sc-snk-data-exporter-h{--snk-data-exporter--z-index:var(--most-visible, 3);display:flex;width:fit-content;height:fit-content}.snk-data-exporter.sc-snk-data-exporter{display:flex;width:fit-content;height:fit-content}.snk-data-exporter--overlap.sc-snk-data-exporter{z-index:var(--snk-data-exporter--z-index)}.snk-data-exporter__dropdown.sc-snk-data-exporter{display:none}.snk-data-exporter__dropdown--show.sc-snk-data-exporter{display:flex;flex-direction:column;position:fixed}.snk-data-exporter__dropdown.sc-snk-data-exporter>ez-dropdown.sc-snk-data-exporter{position:relative}";export{k as snk_data_exporter}
1
+ import{r as t,h as e,H as i,g as s}from"./p-b9667fbe.js";import{ObjectUtils as o,ApplicationContext as r,ElementIDUtils as n}from"@sankhyalabs/core";import{ApplicationUtils as l,DialogType as a}from"@sankhyalabs/ezui/dist/collection/utils";import{D as d,a as h,b as c}from"./p-4c2015a9.js";import{d as p,W as u,R as m}from"./p-17375123.js";import{D as v}from"./p-41d92871.js";import{S as x}from"./p-3db1d3de.js";import"./p-112455b1.js";import"./p-f5f36fbb.js";class f{constructor(t,e){this._selectedNumber=0,this._getMessage=t,this._selectedNumber=e}setExportOption(t,e){const i=this.getExportGroupName();t===d.EXPORT_TO_PDF&&e.push(this.getExportToPDF(i)),t===d.EXPORT_TO_XLS&&e.push(this.getExportToXLS(i)),this.setExportCurrentPage(t,e),this.setExportByEmail(t,e)}setExportCurrentPage(t,e){var i;const s=[d.EXPORT_PAGE_TO_PDF,d.EXPORT_PAGE_TO_XLS];if(t===d.EXPORT_CURRENT_PAGE&&e.push(this.getCurrentPage()),s.includes(t)){let s=e.find((t=>t.id===d.EXPORT_CURRENT_PAGE));null==s&&(e.push(this.getCurrentPage()),s=e.find((t=>t.id===d.EXPORT_CURRENT_PAGE))),(null===(i=null==s?void 0:s.children)||void 0===i?void 0:i.length)||(s.children=[]),t===d.EXPORT_PAGE_TO_PDF&&s.children.push(this.getExportPageToPDF()),t===d.EXPORT_PAGE_TO_XLS&&s.children.push(this.getExportPageToXLS())}}setExportByEmail(t,e){t===d.EXPORT_BY_EMAIL&&e.push(this.getExportByEmail())}getExportToPDF(t){return{id:d.EXPORT_TO_PDF,label:"PDF (.pdf)",group:t}}getExportToXLS(t){return{id:d.EXPORT_TO_XLS,label:`${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`,group:t}}getCurrentPage(){return{id:d.EXPORT_CURRENT_PAGE,label:this._getMessage("snkDataExporter.label.currentPage"),group:this._getMessage("snkDataExporter.group.custom")}}getExportPageToPDF(){return{id:d.EXPORT_PAGE_TO_PDF,label:"PDF (.pdf)"}}getExportPageToXLS(){return{id:d.EXPORT_PAGE_TO_XLS,label:`${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`}}getExportByEmail(){return{id:d.EXPORT_BY_EMAIL,label:`${this._getMessage("snkDataExporter.label.sendByEmail")}...`}}getExportGroupName(){return 1===this._selectedNumber?this._getMessage("snkDataExporter.group.export.selectedLine"):this._selectedNumber>1?this._getMessage("snkDataExporter.group.export.multiSelected").replace("{0}",this._selectedNumber.toString()):this._getMessage("snkDataExporter.group.export.default")}}function b(t){var{methodName:e}=t,i=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(s=Object.getOwnPropertySymbols(t);o<s.length;o++)e.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(t,s[o])&&(i[s[o]]=t[s[o]])}return i}(t,["methodName"]);const s=`mgefin-bff@DataExporterSPBean.${e}`,r={serviceName:s,requestBody:i};return new Promise(((t,e)=>{v.get().callServiceBroker(s,o.objectToString(r)).then((e=>t(function(t){var e;const i=null===(e=null==t?void 0:t.json)||void 0===e?void 0:e.$;if(null!=i)return o.stringToObject(i)}(e)))).catch((t=>e(t)))}))}const E=5e3,k=class{constructor(e){t(this,e),this._selectedNumber=0,this._customPrefix="$custom$",this._items=[],this._showDropdown=!1,this._releasedToExport=[d.EXPORT_TO_PDF,d.EXPORT_TO_XLS,d.EXPORT_BY_EMAIL,d.EXPORT_PDF_TO_EMAIL,d.EXPORT_XLS_TO_EMAIL,d.EXPORT_PAGE_TO_PDF,d.EXPORT_PAGE_TO_XLS],this.provider=null,this.messagesBuilder=void 0}async exportByEmail(){const t=this._selectedNumber;this._snkEmailSender.open({type:t>0?"selection":"all",selectedRows:t,email:{attachments:[{name:this._appLabel}]},resolver:({type:t,format:e,email:{to:i,subject:s,message:o}})=>{var r;const n=null!==(r=h[null==e?void 0:e.toUpperCase()])&&void 0!==r?r:h.PDF;this.resolveExporter({type:t,methodName:n,to:i,subject:s,message:o,fileName:this._appLabel,titleGrid:this._appLabel},(()=>{this._snkEmailSender.close(),l.info(this.getMessage("snkDataExporter.message.emailSuccess"),{iconName:"check"})}))}})}getMessage(t,e){if(null==this.messagesBuilder){const t=x.getNearestInstance(this._element);t&&(this.messagesBuilder=t.messagesBuilder)}return this.messagesBuilder.getMessage(t,e)}positionDropdown(){var t;const e=null===(t=this._ezButton)||void 0===t?void 0:t.getBoundingClientRect();null!=e&&null!=this._dropdownParent&&(this._dropdownParent.style.top=e.y+e.height+5+"px",this._dropdownParent.style.left=e.x+"px")}closeDropdown(t){const e=null==t?void 0:t.target;null!=e&&(e.closest(".snk-data-exporter")||(this._showDropdown=!1))}setEvents(){document.removeEventListener("click",this.closeDropdown.bind(this)),document.addEventListener("click",this.closeDropdown.bind(this)),document.removeEventListener("scroll",this.positionDropdown.bind(this)),document.addEventListener("scroll",this.positionDropdown.bind(this))}controlDropdown(){this._showDropdown=!this._showDropdown}resolveExporter(t,e){if(null==this.provider||null==t||null==e)return;const i=this.provider.getFilters(),s=this.provider.getColumnsMetadata(),o=this.provider.getOrders(),r=this.provider.getResourceURI(),n=this.provider.getSelectedIDs(),a=t.exportOption,h=[d.EXPORT_PAGE_TO_PDF,d.EXPORT_PAGE_TO_XLS];delete t.exportOption;let c=Object.assign({filters:i,columns:s,sort:o,resourceURI:r,selectedIDs:n.slice(0,E)},t);if(h.includes(a)||"page"==t.type){const t=this.provider.getOffset(),e=this.provider.getLimit();c=Object.assign(Object.assign({},c),{offset:t,limit:e,selectedIDs:[]})}else"all"==t.type&&(c=Object.assign(Object.assign({},c),{offset:0,limit:E,selectedIDs:[]}));b(c).then((t=>e(t))).catch((t=>l.error(this.getMessage("snkDataExporter.message.exportError"),t?t.statusMessage:this.getMessage("snkDataExporter.message.exportError"))))}getOptionKey(t){return Object.keys(d).find((e=>d[e]===t))}dispatchExporter(t){var e;const i=this.getOptionKey(t),s=null!==(e=c[i])&&void 0!==e?e:c.EXPORT_TO_PDF,o=c[i]===c.EXPORT_TO_XLS;this.resolveExporter({methodName:d[`EXPORT_TO_${s}`],fileName:this._appLabel,titleGrid:this._appLabel,exportOption:t,limit:E},(t=>{!function({fileSessionKey:t,canPrint:e,canExport:i,useAppPrint:s,isDownload:o}){const n=r.getContextValue("__SNK__APPLICATION__");if(s&&!o)return function(t,e,i,s){null==s||s.webConnection(p,u.methods.PDF_VIEWER,{chaveArquivo:t,permiteImprimir:e?"S":"N",permiteExportar:i?"S":"N",contentType:"S"})}(t,e,i,n);window.open(`${window.location.protocol}//${window.location.hostname}:${window.location.port}/mge/visualizadorArquivos.mge?chaveArquivo=${t}${o?"&download=S":""}`),l.info(function(t){var e;return null===(e=null==t?void 0:t.messagesBuilder)||void 0===e?void 0:e.getMessage("fileViewer.message.exportSuccess",void 0)}(n),{iconName:"check"})}(Object.assign(Object.assign({},t),{fileType:s,isDownload:o}))}))}async processExporter(t){var e,i,s,o;const r=null==t?void 0:t.detail,n=[d.EXPORT_PAGE_TO_PDF,d.EXPORT_PAGE_TO_XLS],h=null===(e=null==r?void 0:r.id)||void 0===e?void 0:e.includes(this._customPrefix);if((null==r?void 0:r.id)===d.EXPORT_CURRENT_PAGE)return;const c=null===(i=this.provider)||void 0===i?void 0:i.getSelectedIDs(),p=null===(s=this.provider)||void 0===s?void 0:s.getTotalRecords(),u=null===(o=this.provider)||void 0===o?void 0:o.getLimit();let m=!1;if(n.includes(null==r?void 0:r.id)&&u<=E||h?m=!1:(null==c?void 0:c.length)?m=c.length>E:p>E&&(m=!0),m){const t=E.toLocaleString("pt-BR",{minimumFractionDigits:0}),e={title:this.getMessage("snkDataExporter.limitExceeded.title"),description:`\n ${this.getMessage("snkDataExporter.limitExceeded.description",{limit:t})}\n <br/><br/>\n <b>\n ${this.getMessage("snkDataExporter.limitExceeded.subdescription")}\n </b>\n `,cancel:this.getMessage("snkDataExporter.limitExceeded.cancel"),confirm:this.getMessage("snkDataExporter.limitExceeded.continue")};if(!await l.confirm(e.title,e.description,null,a.WARN,{labelCancel:e.cancel,labelConfirm:e.confirm}))return}if(h)return this.openPersonalizedReports(r.id),void(this._showDropdown=!1);this._releasedToExport.includes(null==r?void 0:r.id)&&(r.id===d.EXPORT_BY_EMAIL?this.exportByEmail():this.dispatchExporter(r.id),this._showDropdown=!1)}loadItems(){const t=[];this._releasedToExport.forEach((e=>{var i;null===(i=this._itemBuilder)||void 0===i||i.setExportOption(e,t)})),this.loadPersonalizedItems(t)}async loadPersonalizedItems(t){var e;const i=null===(e=this.provider)||void 0===e?void 0:e.getRecordID();if(null==i)return void(this._items=t);const s=await function(t){const e="mgefin-bff@DataExporterSPBean.getPersonalizedReports",i={serviceName:e,requestBody:t};return new Promise(((t,s)=>v.get().callServiceBroker(e,o.objectToString(i)).then((e=>t(function(t){var e;const i=null===(e=null==t?void 0:t.json)||void 0===e?void 0:e.$;if(null!=i)return o.stringToObject(i)}(e)))).catch((t=>s(t)))))}({recordID:i});null==s||s.forEach((e=>{t.push({id:`${this._customPrefix}_${e.ID}`,label:e.label,group:this.getMessage("snkDataExporter.group.custom")})})),this._items=t}openPersonalizedReports(t){var e;const i=[],s=(null==t?void 0:t.replace(this._customPrefix,""))||"";null===(e=this.provider)||void 0===e||e.getSelectedIDs().forEach((({name:t,type:e,value:s},o)=>{const r=[];r.fields=[],0===o&&(i[`PK_${t}`]={type:e,value:s},i.pks=[]),r.fields.push({nome:t,tipo:e,valor:s}),i.pks.push(r)})),this._application.openApp(`${m}${s}`,i)}loadDropdown(){var t,e;this._selectedNumber=(null===(e=null===(t=this.provider)||void 0===t?void 0:t.getSelectedIDs())||void 0===e?void 0:e.length)||0,this._itemBuilder=new f(this.getMessage.bind(this),this._selectedNumber),this.loadItems()}getElementID(t){return{[n.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:n.getInternalIDInfo(t)}}canShowDropdown(){var t;return this._showDropdown&&(null===(t=this._items)||void 0===t?void 0:t.length)>0}componentWillLoad(){var t;this._application=r.getContextValue("__SNK__APPLICATION__"),null===(t=this._application)||void 0===t||t.getAppLabel().then((t=>this._appLabel=t)),this.setEvents()}componentDidLoad(){null!=this._element&&(n.addIDInfo(this._element),this.positionDropdown())}componentWillUpdate(){var t;this._showDropdown&&!(null===(t=this._items)||void 0===t?void 0:t.length)&&this.loadDropdown()}componentDidUpdate(){var t;this._showDropdown?this.positionDropdown():(null===(t=this._items)||void 0===t?void 0:t.length)>0&&(this._items=[])}render(){return e(i,null,e("div",{class:`snk-data-exporter\n ${this.canShowDropdown()?" snk-data-exporter--overlap":""}\n `},e("ez-button",Object.assign({ref:t=>this._ezButton=t,iconName:"file-download",size:"small",mode:"icon",title:this.getMessage("snkDataExporter.group.export.title"),onClick:()=>this.controlDropdown()},this.getElementID("button"))),e("div",Object.assign({ref:t=>this._dropdownParent=t,class:`snk-data-exporter__dropdown\n ${this.canShowDropdown()?"snk-data-exporter__dropdown--show":""}\n `},this.getElementID("dropdown")),this.canShowDropdown()&&e("ez-dropdown",Object.assign({items:this._items,onEzClick:t=>this.processExporter(t)},this.getElementID("dropdown"))))),this.canShowDropdown()&&e("div",Object.assign({class:"ez-scrim ez-scrim--light"},this.getElementID("ezScrim"))),e("snk-exporter-email-sender",Object.assign({ref:t=>this._snkEmailSender=t,getMessage:(t,e)=>this.getMessage(t,e)},this.getElementID("snkExporterEmailSender"))))}get _element(){return s(this)}};k.style=".sc-snk-data-exporter-h{--snk-data-exporter--z-index:var(--most-visible, 3);display:flex;width:fit-content;height:fit-content}.snk-data-exporter.sc-snk-data-exporter{display:flex;width:fit-content;height:fit-content}.snk-data-exporter--overlap.sc-snk-data-exporter{z-index:var(--snk-data-exporter--z-index)}.snk-data-exporter__dropdown.sc-snk-data-exporter{display:none}.snk-data-exporter__dropdown--show.sc-snk-data-exporter{display:flex;flex-direction:column;position:fixed}.snk-data-exporter__dropdown.sc-snk-data-exporter>ez-dropdown.sc-snk-data-exporter{position:relative}";export{k as snk_data_exporter}
@@ -0,0 +1 @@
1
+ import{a as e,f as t}from"./p-b9667fbe.js";const s=e=>!("isConnected"in e)||e.isConnected,o=(()=>{let e;return(...t)=>{e&&clearTimeout(e),e=setTimeout((()=>{e=0,(e=>{for(let t of e.keys())e.set(t,e.get(t).filter(s))})(...t)}),2e3)}})(),n=e=>"function"==typeof e?e():e,r=(()=>{const s=((e,t=((e,t)=>e!==t))=>{const s=n(e);let o=new Map(Object.entries(null!=s?s:{}));const r={dispose:[],get:[],set:[],reset:[]},c=()=>{var t;o=new Map(Object.entries(null!==(t=n(e))&&void 0!==t?t:{})),r.reset.forEach((e=>e()))},i=e=>(r.get.forEach((t=>t(e))),o.get(e)),a=(e,s)=>{const n=o.get(e);t(s,n,e)&&(o.set(e,s),r.set.forEach((t=>t(e,s,n))))},u="undefined"==typeof Proxy?{}:new Proxy(s,{get:(e,t)=>i(t),ownKeys:()=>Array.from(o.keys()),getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0}),has:(e,t)=>o.has(t),set:(e,t,s)=>(a(t,s),!0)}),p=(e,t)=>(r[e].push(t),()=>{((e,t)=>{const s=e.indexOf(t);s>=0&&(e[s]=e[e.length-1],e.length--)})(r[e],t)});return{state:u,get:i,set:a,on:p,onChange:(t,s)=>{const o=p("set",((e,o)=>{e===t&&s(o)})),r=p("reset",(()=>s(n(e)[t])));return()=>{o(),r()}},use:(...e)=>{const t=e.reduce(((e,t)=>(t.set&&e.push(p("set",t.set)),t.get&&e.push(p("get",t.get)),t.reset&&e.push(p("reset",t.reset)),t.dispose&&e.push(p("dispose",t.dispose)),e)),[]);return()=>t.forEach((e=>e()))},dispose:()=>{r.dispose.forEach((e=>e())),c()},reset:c,forceUpdate:e=>{const t=o.get(e);r.set.forEach((s=>s(e,t,t)))}}})({exporterProviders:{},filterFieldsDataSource:void 0},void 0);return s.use((()=>{if("function"!=typeof e)return{};const s=new Map;return{dispose:()=>s.clear(),get:t=>{const o=e();o&&((e,t,s)=>{const o=e.get(t);o?o.includes(s)||o.push(s):e.set(t,[s])})(s,t,o)},set:e=>{const n=s.get(e);n&&s.set(e,n.filter(t)),o(s)},reset:()=>{s.forEach((e=>e.forEach(t))),o(s)}}})()),s})();export{r as s}
@@ -0,0 +1 @@
1
+ import{r as t,h as e,H as i,g as r}from"./p-b9667fbe.js";import{DataType as s,ObjectUtils as a,ElementIDUtils as n,ErrorException as o,ApplicationContext as l}from"@sankhyalabs/core";import{EzScrollDirection as d}from"@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection";import{C as c}from"./p-52ed2a18.js";import{toString as h}from"@sankhyalabs/core/dist/dataunit/metadata/DataType";import{F as f}from"./p-584d7212.js";import{ApplicationUtils as u}from"@sankhyalabs/ezui/dist/collection/utils";import"./p-0d81236c.js";import"./p-41d92871.js";import"./p-112455b1.js";class m{constructor({filterConfig:t,onComplete:e,getMessage:i}){this._filterConfig=t,this._onComplete=e,this._getMessage=i}applyFilters(t){this._onComplete(t),this._closeModal()}clearAll(t){return t.map((t=>Object.assign(Object.assign({},t),{value:void 0})))}buildFilterModal(){const t=document.createElement("snk-filter-modal");return t.filters=this._filterConfig,t.getMessage=this._getMessage.bind(this),t.applyFilters=this.applyFilters.bind(this),t.clearAll=this.clearAll.bind(this),t.closeModal=()=>this._closeModal(),t}async showModal(){const t={content:this.buildFilterModal(),position:"left",heightMode:"full",closeOutsideClick:!1,useScrimLight:!0};this._closeModal=await u.showModal(t)}}const p=class{constructor(e){t(this,e),this._updateSequence=[],this._loadingPending=!1,this._configUpdated=!1,this._pendingFilters=[],this._calculateSortIndex=t=>{let e=t.hardFixed?1e6:0;return t.hardFixed||(e+=t.fixed?1e5:0,e+=null==t.value?0:1e4,e+=this._updateSequence.lastIndexOf(t.id)+1),e},this._filtersComparator=(t,e)=>this._calculateSortIndex(e)-this._calculateSortIndex(t),this.dataUnit=void 0,this.configName=void 0,this.filterConfig=void 0,this.messagesBuilder=void 0,this.allowDefault=void 0,this.scrollerLocked=!1}observeFilterConfig(t,e){if(null!=e&&null==t)this._loadingPending=!0,this._configUpdated=!0;else{const i=new Map(e?e.map((t=>[t.id,t])):void 0);t.forEach((t=>{const e=i.get(t.id);null!=e?(this._configUpdated=this._configUpdated||a.objectToString(e)!=a.objectToString(t),this._loadingPending=this._loadingPending||a.objectToString(e.value)!==a.objectToString(t.value)):(this._configUpdated=!0,this._loadingPending=this._loadingPending||null!=t.value)}))}this.processAfterUpdateConfig()}componentDidLoad(){this._element&&n.addIDInfo(this._element,null,{dataUnit:this.dataUnit})}processPendingFilter(){this._pendingFilters.length>0&&null==this._currentPendingFilter&&(this._currentPendingFilter=this._element.querySelector("#filter-"+this._pendingFilters.pop()),this._currentPendingFilter&&this._currentPendingFilter.showUp(!0).then((()=>{this._currentPendingFilter=void 0,this.processPendingFilter()}))),null==this._currentPendingFilter&&this.processAfterUpdateConfig()}processAfterUpdateConfig(){this._pendingFilters.length>0||(this._loadingPending&&(this._loadingPending=!1,this.dataUnit.loadData()),this._configUpdated&&(this._configUpdated=!1,c.saveFilterBarConfig(this.filterConfig,this.configName)))}getMessage(t,e,i){var r;return(null===(r=this.messagesBuilder)||void 0===r?void 0:r.getMessage(t,e))||i}getFilter(t){var e;const i=[];return null===(e=this.filterConfig)||void 0===e||e.filter((t=>this.isActiveFilter(t))).forEach((t=>{const e=(t=>{switch(t.type){case f.DEFAULT_FILTER:return function(t){return{name:t.id,expression:t.props.expression,params:[]}}(t);case f.BINARY_SELECT:return function(t){const{id:e,value:i,props:r}=t;return{name:e,expression:r.options.find((t=>t.name===i)).expression,params:[]}}(t);case f.MULTI_SELECT:return function(t){const{id:e,value:i,props:r}=t;return{name:e,expression:r.expression,params:[{name:e,dataType:s.TEXT,value:i}]}}(t);case f.PERIOD:return function(t){const{id:e,value:i,props:r}=t;let{end:a,start:n}=i;"string"==typeof a&&(a=new Date(a)),"string"==typeof n&&(n=new Date(n));const o=[];let l;return a&&n?(l=r.expression.fullfill,o.push({name:`${e}.START`,dataType:s.DATE,value:h(s.DATE,n)},{name:`${e}.END`,dataType:s.DATE,value:h(s.DATE,a)})):n?(l=r.expression.onlystart,o.push({name:e,dataType:s.DATE,value:h(s.DATE,n)})):(l=r.expression.onlyend,o.push({name:e,dataType:s.DATE,value:h(s.DATE,a)})),{name:e,expression:l,params:o}}(t);case f.SEARCH:return function(t){const{id:e,value:i,props:r}=t;return{name:e,expression:r.expression,params:[{name:e,dataType:s.TEXT,value:h(s.TEXT,i.value)}]}}(t);case f.TEXT:return function(t){const{id:e,value:i,props:r}=t;return{name:e,expression:r.expression,params:[{name:e,dataType:s.TEXT,value:h(s.TEXT,i)}]}}(t);case f.NUMBER:return function(t){const{id:e,value:i,props:r}=t;return{name:e,expression:r.expression,params:[{name:e,dataType:s.NUMBER,value:h(s.NUMBER,i)}]}}(t);case f.PERSONALIZED:return function(t){var e;const{id:i,value:r,props:a}=t;return{name:i,expression:a.expression,params:((null===(e=a.personalizedFilter)||void 0===e?void 0:e.parameters)||[]).map(((t,e)=>{const i=Array.from(r),a=t.dataType;let n=e>=0&&e<i.length?i[e]:null;return null!=n&&"object"==typeof n&&"value"in n&&(n=n.value),null==n&&a===s.BOOLEAN&&(n=!1),{name:t.name,dataType:a,value:"string"==typeof n?n:h(a,n)}}))}}(t);default:return}})(t);e&&i.push(e)})),i}isActiveFilter(t){return t.visible&&null!=t.value||t.type===f.DEFAULT_FILTER}registryFilterProvider(){this.dataUnit.addFilterProvider(this),this.filterConfig&&this.dataUnit.loadData()}itemFocused(t){this._element.querySelectorAll("snk-filter-item,snk-filter-list").forEach((e=>{e.id===t?"snk-filter-item"===e.tagName.toLowerCase()&&e.getClientRects()[0].x<0&&e.scrollIntoView({behavior:"auto",inline:"nearest"}):e.hideDetail()}))}getFilterItems(){const t=[],i=[];this.filterConfig.filter((t=>t.visible)).forEach(((r,s)=>{const a=`filter-${r.id}`,n=e("snk-filter-item",{onVisibleChanged:t=>this.scrollerLocked=t.detail,onFocusin:()=>this.itemFocused(a),id:a,config:r,class:s>0?"ez-padding-left--medium":"",getMessage:(t,e)=>this.getMessage(t,e),key:r.id});return r.fixed||r.hardFixed?t.push(n):i.push(n),n}));const r=[];return r.push(...t),t.length>0&&i.length>0&&r.push(e("hr",{class:"ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-filter-bar__divider"})),r.push(...i),r}calculateUpdateSequence(t){t&&(this._updateSequence=this._updateSequence.filter((e=>t.id!==e)),this._updateSequence.push(t.id))}normalizeItem(t){const e=Object.assign({},t);return["props","value","hardFixed","fixed"].forEach((t=>{null==e[t]&&delete e[t]})),""===t.value&&delete t.value,e}updateFilter(t){this.filterConfig=this.filterConfig.map((e=>(t=this.normalizeItem(t),e.id===t.id?(a.objectToString(e)!=a.objectToString(t)&&this.calculateUpdateSequence(t),t):e))).sort(((t,e)=>this._filtersComparator(t,e)))}loadPermitions(){this._application.isUserSup().then((t=>this.allowDefault=t))}loadConfigFromStorage(){c.get().then((t=>{t.loadFilterBarConfig(this.configName).then((t=>{this.filterConfig=t.map((t=>this.normalizeItem(t))),this.dataUnit&&this.dataUnit.loadData(void 0,void 0,!0)})).catch((t=>{throw new o(this.getMessage("snkFilterBar.failToLoadConfig"),t)}))}))}attachDataUnit(){if(null==this.dataUnit){let t=this._element.parentElement;for(;t;)if("SNK-DATA-UNIT"===t.tagName.toUpperCase()){const e=t;this.dataUnit=e.dataUnit,this.dataUnit?this.registryFilterProvider():e.addEventListener("dataUnitReady",(t=>{this.dataUnit=t.detail,this.registryFilterProvider()}));break}t=t.parentElement}else this.registryFilterProvider()}filterChangeListener(t){this.updateFilter(t.detail)}async showFilterModal(){const t=new m({filterConfig:this.filterConfig,onComplete:t=>{this.filterConfig=t.map(this.normalizeItem)},getMessage:(t,e)=>this.getMessage(t,e)});await t.showModal()}componentWillLoad(){this._application=l.getContextValue("__SNK__APPLICATION__"),this._application&&(this.loadPermitions(),this.loadConfigFromStorage()),this.attachDataUnit()}componentDidRender(){this.processPendingFilter()}render(){if(this.dataUnit&&this.filterConfig&&0!==this.filterConfig.length)return e(i,null,e("ez-scroller",{direction:d.HORIZONTAL,activeShadow:!0,locked:this.scrollerLocked},this.getFilterItems()),e("ez-button",{class:"ez-padding-left--medium",size:"small",label:this.getMessage("snkFilterBar.filters",void 0,"Filtros"),onClick:this.showFilterModal.bind(this)},e("ez-icon",{slot:"leftIcon",iconName:"plus",class:"ez-padding-right--small"})))}get _element(){return r(this)}static get watchers(){return{filterConfig:["observeFilterConfig"]}}};p.style='.sc-snk-filter-bar-h{display:grid;grid-template-columns:minmax(100px, 100%) 1fr 1fr}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;z-index:var(--most-visible, 3);background-color:var(--background--xlight, #fff);border-radius:var(--border--radius-medium, 12px);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.snk-filter-item__editor-header.sc-snk-filter-bar{flex-grow:1;font-weight:var(--text-weight--medium, 400);color:var(--color--title-primary, #2B3A54)}.snk-filter__popover-rule.sc-snk-filter-bar{border-style:solid;border-color:var(--color--disable-secondary, #F2F5F8);border-radius:1px;border-width:1px;width:100%}.editor__ez-check.sc-snk-filter-bar{--ez-check__label--padding-left:0}.snk-filter-item__editor-header-button.sc-snk-filter-bar{cursor:pointer;background-color:transparent;border:none;padding:3px;outline-color:var(--color--primary)}.snk-filter-bar__divider.sc-snk-filter-bar{margin-bottom:var(--space--small)}.snk-filter-bar__filter-list-items-container.sc-snk-filter-bar{overflow-y:auto;max-height:360px;margin-top:var(--space--small, 6px)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar{cursor:pointer;border-radius:var(--border--radius-small, 6px);border:none;background-color:transparent}.snk-filter-bar__filter-list-item__label.sc-snk-filter-bar{color:var(--title--primary)}.snk-filter-bar__filter-list-item__label--secondary.sc-snk-filter-bar{color:var(--text--primary)}.snk-filter-bar__filter-list-item__icon.sc-snk-filter-bar{--ez-icon--color:var(--title--primary)}.snk-filter-bar__filter-list-item__icon--secondary.sc-snk-filter-bar{--ez-icon--color:var(--text--secondary)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:focus-visible{outline:none;background-color:var(--background--medium)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:hover{background-color:var(--background--medium)}.snk-filter-bar__filter-list-items-container--empty.sc-snk-filter-bar{width:100%;height:100px;display:flex;justify-content:center;align-self:center;align-items:center}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar{position:relative}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar::after{display:flex;position:absolute;content:"";width:8px;height:8px;top:7px;left:17px;background-color:var(--icon--alert--color, #008561);border-radius:50%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar{--modal-item-border-width:2px;display:flex;flex-direction:row;margin-left:var(--modal-item-border-width);border-radius:var(--border--radius-medium, 12px);background-color:var(--background--medium, #f0f3f7);border:none;width:100%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar:focus-visible{outline:var(--color--primary) solid var(--modal-item-border-width)}.snk-filter-bar__filter-modal-item__check.sc-snk-filter-bar{width:auto}.snk-filter-bar__filter-modal-item__label.sc-snk-filter-bar{font-weight:var(--text-weight--medium)}.snk-filter-bar__filter-modal-content.sc-snk-filter-bar{display:grid;grid-template-rows:auto auto 1fr auto;width:99%;height:100%}';export{p as snk_filter_bar}
@@ -0,0 +1 @@
1
+ import{r as t,c as s,h as i,g as e}from"./p-b9667fbe.js";import{ElementIDUtils as o}from"@sankhyalabs/core";import{F as h}from"./p-584d7212.js";const r=class{constructor(i){t(this,i),this.valueChanged=s(this,"valueChanged",7),this.value=void 0,this.config=void 0}ezChangeListener(t){this.value=t.detail.value,this.valueChanged.emit(this.value)}async show(){this._comboElement.setFocus()}componentDidLoad(){this._element&&o.addIDInfo(this._element,"filterContentEditor")}render(){if(this.config&&this.config.type===h.MULTI_SELECT)return i("ez-combo-box",{id:this.config.id,ref:t=>this._comboElement=t,label:this.config.label,value:this.config.value,options:this.config.props.options})}get _element(){return e(this)}};export{r as snk_filter_multi_select}
@@ -0,0 +1 @@
1
+ import{r as t,h as e}from"./p-b9667fbe.js";import{ModalAction as i}from"@sankhyalabs/ezui/dist/collection/components/ez-modal-container";import{F as s}from"./p-d9804798.js";import{F as l}from"./p-584d7212.js";const o=class{constructor(e){t(this,e),this.getMessage=void 0,this.filters=void 0,this.applyFilters=void 0,this.clearAll=void 0,this.closeModal=void 0}getCustomMessage(t,e){var i;return null===(i=this.getMessage)||void 0===i?void 0:i.call(this,`snkFilterBar.filterModal.${t}`,e)}handleClearAll(){const t=this.clearAll(this.filters);this.filters=t}modalActionListener(t){switch(t.detail){case i.CANCEL:this.handleClearAll();break;case i.OK:this.applyFilters(this.filters);case i.CLOSE:this.closeModal()}}handleFilterChange(t){this.filters=this.filters.map((e=>e.id===t.id?t:e))}handleClearFilters(t){this.filters=this.filters.map((e=>t.includes(e)?Object.assign(Object.assign({},e),{value:void 0}):e))}renderFilterItem(t,i){return e("snk-filter-modal-item",{class:i?"ez-col ez-col--sd-12":"ez-col ez-col--sd-6 ez-padding--small",filterItem:t,onFilterChange:t=>this.handleFilterChange(t.detail)})}mountFiltersLines(t){let e=0,i=!1;const s={};for(let o=0;o<t.length;o++){s[e]=s[e]||[];const a=t[o],r=o===t.length-1,n=[l.TEXT,l.NUMBER].includes(a.type),d=!r&&[l.TEXT,l.NUMBER].includes(t[o+1].type);n&&d||i?(s[e].push(a),i=s[e].length<2,2===s[e].length&&++e):(s[e]=s[e]||[],s[e].push(a),++e)}return Object.values(s)}renderFilterLine(t){const i=1===t.length;return e("div",{class:"ez-row"},t.map((t=>this.renderFilterItem(t,i))))}renderCollapsibleFilterBox(t,i){if(!i.length)return null;const s=i.filter((t=>!!t.value)).length,l=this.mountFiltersLines(i);return e("ez-collapsible-box",{className:"snk-filter__modal-collapsible-box ez-padding--medium",headerSize:"medium",value:!0,label:t},!!s&&e("ez-badge",{className:"ez-badge--primary-subtle",slot:"rightSlot",label:s}),l.map(this.renderFilterLine.bind(this)),e("div",{class:"ez-flex ez-flex--justify-end grow"},e("ez-button",{className:"ez-button--tertiary",size:"medium",label:"Limpar",onClick:()=>this.handleClearFilters(i)})))}componentWillRender(){this._modalTitle=this.getCustomMessage("title"),this._okButtonLabel=this.getCustomMessage("okButtonLabel"),this._cancelButtonLabel=this.getCustomMessage("cancelButtonLabel")}render(){const t=this.filters.filter((t=>t.filterType===s.CUSTOM_FILTER)),i=this.filters.filter((t=>t.filterType===s.QUICK_FILTER)),l=this.filters.filter((t=>t.filterType===s.OTHER_FILTERS));return e("ez-modal-container",{class:"snk-filter__modal-container",modalTitle:this._modalTitle,cancelButtonLabel:this._cancelButtonLabel,okButtonLabel:this._okButtonLabel,onEzModalAction:this.modalActionListener.bind(this)},e("div",{class:"snk-filter__modal-content"},this.renderCollapsibleFilterBox(this.getCustomMessage("customFilters"),t),this.renderCollapsibleFilterBox(this.getCustomMessage("quickFilters"),i),l.map((t=>this.renderCollapsibleFilterBox(t.label,[t])))))}};o.style="ez-modal{--ez-modal-content-padding:24px 12px}.snk-filter__modal-container{width:344px;max-width:344px;overflow:hidden}.snk-filter__modal-content{display:flex;flex-direction:column;gap:12px;max-height:760px;overflow-x:clip;overflow-y:auto;padding-right:4px}.snk-filter__modal-content::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}.snk-filter__modal-collapsible-box{border:1px solid #DCE0E8;border-radius:var(--border--radius-medium)}";export{o as snk_filter_modal}
@@ -0,0 +1 @@
1
+ import{r as t,c as s,h as i,H as e,g as a}from"./p-b9667fbe.js";import{StringUtils as r,ApplicationContext as h,ElementIDUtils as n}from"@sankhyalabs/core";import{A as o}from"./p-dc36cfbf.js";import{T as l,V as k,A as d,b,a as c}from"./p-d410f45a.js";import{P as m}from"./p-4c2015a9.js";import"./p-6a02e236.js";const u=class{constructor(i){t(this,i),this.actionClick=s(this,"actionClick",7),this._titleKeyByElement={[l.UPDATE]:"snkTaskbar.titleUpdate",[l.PREVIOUS]:"snkTaskbar.titlePrevious",[l.NEXT]:"snkTaskbar.titleNext",[l.REFRESH]:"snkTaskbar.titleRefresh",[l.CLONE]:"snkTaskbar.titleClone",[l.REMOVE]:"snkTaskbar.titleRemove",[l.MORE_OPTIONS]:"snkTaskbar.titleMoreOptions",[l.INSERT]:"snkTaskbar.titleInsert",[l.CANCEL]:"snkTaskbar.titleCancel",[l.SAVE]:"snkTaskbar.titleSave",[l.GRID_MODE]:"snkTaskbar.titleGridMode",[l.FORM_MODE]:"snkTaskbar.titleFormMode",[l.CONFIGURATOR]:"snkTaskbar.titleConfigurator",[l.ATTACH]:"snkTaskbar.titleAttach"},this._permissions=void 0,this.configName=void 0,this.buttons=void 0,this.customButtons=void 0,this.actionsList=void 0,this.primaryButton=void 0,this.disabledButtons=void 0,this.dataUnit=void 0,this.presentationMode=m.PRIMARY,this.messagesBuilder=void 0}observeButtons(){this._definitions=void 0}elementsFromString(t){const s=[];return null==t||t.split(",").forEach((t=>{t=t.trim(),(k[t]||this.isAllowed(t))&&s.push(t.trim())})),s}isAllowed(t){return t===d.CONFIGURATOR?!!this._permissions&&(this._permissions.isSup||this._permissions[o.CONFIG_GRID]||this._permissions[o.CONFIG]):!d[t]||!!this._permissions&&(this._permissions.isSup||this._permissions[t])}getTitle(t){var s;let i;return i=this.isAllowed(t)?this._titleKeyByElement[t]:"snkTaskbar.forbidden",i?null===(s=this.messagesBuilder)||void 0===s?void 0:s.getMessage(i,{}):""}elementClick(t){if(this.dataUnit)switch(t){case l.PREVIOUS:this.dataUnit.previousRecord();break;case l.NEXT:this.dataUnit.nextRecord();break;case l.REFRESH:this.dataUnit.loadData();break;case l.CLONE:this.dataUnit.copySelected();break;case l.REMOVE:this.dataUnit.removeSelectedRecords();break;case l.INSERT:this.dataUnit.addRecord();break;case l.CANCEL:this.dataUnit.cancelEdition();break;case l.SAVE:this.dataUnit.saveData()}this.actionClick.emit(t)}isEnabled(t){return!(!this.isAllowed(t)||this.disabledButtons&&this.disabledButtons.includes(t))}validatePresentationMode(){Object.values(m).includes(this.presentationMode)||(this.presentationMode=m.PRIMARY)}getElement(t,s){let i=s===this.primaryButton?"ez-button--primary ":"";return t>1&&(i+="ez-padding-left--medium"),l[s.toString()]?b(s,i,this.getIdElemBtnNative(s),(t=>this.getTitle(t)),(t=>this.elementClick(t)),(t=>this.isEnabled(t)),this.actionsList,this.configName,this.presentationMode):c(s,i,this.getIdElemBtnCustom(s),(t=>this.elementClick(t)),(t=>this.isEnabled(t)))}getIdElemBtnNative(t){return r.toCamelCase(t)}getIdElemBtnCustom(t){return r.toCamelCase(t.name)}isDivider(t){var s;return void 0!==t&&(null===(s=t.t)||void 0===s?void 0:s["data-taskbar-divider"])}removeEmpty(t){let s;return t.filter((t=>!(null==t||this.isDivider(s)&&this.isDivider(t)||(s=t,0))))}componentWillLoad(){this._application=h.getContextValue("__SNK__APPLICATION__"),this._application?this._application.getAllAccess().then((t=>this._permissions=t)):this._permissions={}}componentWillRender(){null==this._definitions&&this._permissions&&(this._definitions=this.elementsFromString(this.buttons)),this.validatePresentationMode()}componentDidLoad(){n.addIDInfo(this._element,null,{dataUnit:this.dataUnit})}render(){if(void 0===this._definitions)return;let t=0;return i(e,null,this.removeEmpty(this._definitions.map((s=>(s===l.DIVIDER?t=0:t++,l[s]?this.getElement(t,l[s]):this.customButtons.has(s)?this.getElement(t,this.customButtons.get(s)):i("slot",{name:s}))))))}get _element(){return a(this)}static get watchers(){return{buttons:["observeButtons"]}}};u.style=".sc-snk-taskbar-h{display:flex}";export{u as snk_taskbar}
@@ -0,0 +1 @@
1
+ import{r as t,c as e,h as i,H as s,g as a}from"./p-b9667fbe.js";import{ElementIDUtils as n,UserInterface as o,ApplicationContext as r}from"@sankhyalabs/core";import{convertType as l}from"@sankhyalabs/core/dist/dataunit/metadata/DataType";import{CheckMode as h}from"@sankhyalabs/ezui/dist/collection/utils";import{F as u}from"./p-584d7212.js";const d=class{constructor(i){t(this,i),this.valueChanged=e(this,"valueChanged",7),this.config=void 0,this.value=void 0,this.fix=void 0,this.unfix=void 0}componentDidLoad(){this._element&&n.addIDInfo(this._element,"filterContentEditor")}getValue(t,e){if(this.value&&e>=0&&e<this.value.length){const i=this.value[e];return t.type===o.SEARCH?i:l(t.dataType,i)}}setValue(t,e){this.value=null==this.value?Array(t).fill(null):[...this.value],this.value[t]=e,0==this.value.filter((t=>null!=t)).length&&(this.value=null),this.valueChanged.emit(this.value||[])}doSearch(t,e,i){const s=r.getContextValue("__SNK__APPLICATION__");return new Promise(((a,n)=>{s.executePreparedSearch(t,e,i.searchContext).then((t=>{a(t)})).catch((t=>{n(t)}))}))}getParamsInterface(){var t,e,s;return(null===(s=null===(e=null===(t=this.config)||void 0===t?void 0:t.props)||void 0===e?void 0:e.personalizedFilter)||void 0===s?void 0:s.parameters).map(((t,e)=>{var s;const a="param_"+e;switch(t.type){case o.SEARCH:return i("ez-search",{id:a,suppressEmptyOption:!0,value:this.getValue(t,e),onEzChange:t=>this.setValue(e,t.detail),label:t.label,optionLoader:({mode:e,argument:i})=>this.doSearch(e,i,t)});case o.SWITCH:case o.CHECKBOX:return i("ez-check",{id:a,class:"ez-padding-bottom--medium",mode:o.SWITCH===t.type?h.SWITCH:h.REGULAR,value:this.getValue(t,e),label:t.label,onEzChange:t=>this.setValue(e,t.detail)});case o.DECIMALNUMBER:case o.INTEGERNUMBER:return i("ez-number-input",{id:a,label:t.label,value:this.getValue(t,e),precision:null===(s=t.props)||void 0===s?void 0:s.precision,onEzChange:t=>this.setValue(e,t.detail)});case o.OPTIONSELECTOR:return i("ez-combo-box",{id:a,label:t.label,value:this.getValue(t,e),options:t.options,onEzChange:t=>{var i;return this.setValue(e,null===(i=t.detail)||void 0===i?void 0:i.value)}});case o.DATE:return i("ez-date-input",{id:a,label:t.label,value:this.getValue(t,e),onEzChange:t=>this.setValue(e,t.detail)});case o.DATETIME:return i("ez-date-time-input",{id:a,label:t.label,value:this.getValue(t,e),onEzChange:t=>this.setValue(e,t.detail)});default:return i("ez-text-input",{id:a,label:t.label,value:this.getValue(t,e),onEzChange:t=>this.setValue(e,t.detail)})}}))}async show(){const t=document.querySelector("#param_0");t&&t.setFocus()}render(){if(this.config&&this.config.type===u.PERSONALIZED)return i(s,null,this.getParamsInterface())}get _element(){return a(this)}};export{d as snk_filter_personalized}
@@ -0,0 +1 @@
1
+ import{r as t,c as s,h as i,g as e}from"./p-b9667fbe.js";import{ElementIDUtils as r}from"@sankhyalabs/core";const h=class{constructor(i){t(this,i),this.valueChanged=s(this,"valueChanged",7),this.config=void 0,this.value=void 0}ezChangeListener(t){this.value=t.detail,this.valueChanged.emit(this.value)}componentDidLoad(){this._element&&r.addIDInfo(this._element,"filterContentEditor")}render(){if(this.config)return i("ez-text-input",{id:this.config.id,ref:t=>this._textInputElement=t,label:this.config.label,value:this.config.value})}get _element(){return e(this)}};export{h as snk_filter_text}
@@ -1 +1 @@
1
- import{r as t,c as i,h as s,H as e,g as r}from"./p-b9667fbe.js";import{FloatingManager as h,ElementIDUtils as n}from"@sankhyalabs/core";import{F as l}from"./p-9dd2b8cb.js";const o=class{constructor(s){t(this,s),this.visibleChanged=i(this,"visibleChanged",7),this.filterChange=i(this,"filterChange",7),this.innerClickCheck=(t,i)=>i.id!=h.MODAL_ELEMENT_ID||(this.detailIsVisible=!1,!1),this.detailIsVisible=void 0,this.config=void 0,this.getMessage=void 0}observeDetailIsVisible(t){this.visibleChanged.emit(t)}async showUp(t=!1){return new Promise((i=>{this._filterItemElement.scrollIntoView({behavior:"auto",block:"nearest",inline:"nearest"}),t&&(this._closeCallback=i,window.requestAnimationFrame((()=>{this._floatingID=h.float(this._popover,this._popoverContainer,this.getFloatOptions()),this._popover.show(),this.detailIsVisible=!0})))}))}updatePosition(){null!=this._floatingID&&h.updateFloatPosition(this._popover,this._popoverContainer,this.getFloatOptions())}getFloatOptions(){return{autoClose:!0,innerClickTest:this.innerClickCheck,backClickListener:()=>this.onDetailCloseCallback(),left:this.getScrollOffsetLeft(),top:this.getScrollOffsetTop(),useOverlay:!0,overlayClassName:"ez-scrim ez-scrim--light",isFixed:!0}}getScrollOffsetLeft(){const t=getComputedStyle(this._filterItemElement).getPropertyValue("padding-left");return`calc(${this._filterItemElement.getBoundingClientRect().x}px + ${t})`}getScrollOffsetTop(){const t=this._filterItemElement.getBoundingClientRect();return t.y+t.height+"px"}controlScrollPage(){window.removeEventListener("scroll",this.updatePosition.bind(this)),window.addEventListener("scroll",this.updatePosition.bind(this))}async hideDetail(){this.detailIsVisible&&null!=this._floatingID&&h.close(this._floatingID)}onDetailCloseCallback(){this._floatingID=void 0,this.detailIsVisible=!1,this._closeCallback&&(this._closeCallback(),this._closeCallback=void 0)}clickListener(t){[this._chipElement,this._leftIconElement,this._rightIconElement].includes(t.target)&&(t.target===this._rightIconElement&&null!=this.config.value?this.filterChange.emit(Object.assign(Object.assign({},this.config),{value:void 0})):this.detailIsVisible?this.hideDetail():this.showUp(!0),t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation())}mouseDownListener(t){this.detailIsVisible&&[this._chipElement,this._leftIconElement,this._rightIconElement].includes(t.target)&&(t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation())}getLabel(){const{type:t,value:i,label:s,props:e}=this.config;if(i){if(t===l.BINARY_SELECT){const[t,s]=e.options;if(t.name===i)return t.label;if(s.name===i)return s.label}if(t===l.MULTI_SELECT)return`${s}: ${e.options.find((t=>t.value===i)).label}`;if(t===l.PERIOD){let{end:t,start:e}=i;"string"==typeof t&&(t=new Date(t),t.setMinutes(t.getMinutes()+t.getTimezoneOffset())),"string"==typeof e&&(e=new Date(e),e.setMinutes(e.getMinutes()+e.getTimezoneOffset()));const r=new Intl.DateTimeFormat("pt-BR");return t&&e?`${s}: ${r.format(e)} a ${r.format(t)}`:e?`${s}: A partir de ${r.format(e)}`:t?`${s}: Até ${r.format(t)}`:s}return t===l.SEARCH?`${s}: ${i.value} - ${i.label}`:t===l.PERSONALIZED?s:`${s}: ${i}`}return s}componentDidLoad(){this._filterItemElement&&(n.addIDInfo(this._filterItemElement),this._idSnkFilterDetail=`filterDetail_${this.config.id}`),this.controlScrollPage()}componentDidRender(){null==this._floatingID&&this._popover&&this._popover.remove()}filterChangeListener(){this.hideDetail()}getRightIconName(){return null!=this.config.value?"close":this.detailIsVisible?"chevron-up":"chevron-down"}getLeftIconName(){switch(this.config.type){case l.PERIOD:return"calendar";case l.PERSONALIZED:return"tune"}}render(){const t=this.getLeftIconName();return s(e,null,s("ez-chip",{ref:t=>this._chipElement=t,label:this.getLabel(),value:null!=this.config.value,id:this.config.id},t?s("ez-icon",{ref:t=>this._leftIconElement=t,iconName:t,class:"ez-padding-right--small",slot:"leftIcon"}):void 0,s("ez-icon",{ref:t=>this._rightIconElement=t,iconName:this.getRightIconName(),class:"ez-padding-left--small",slot:"rightIcon",id:"removeFilter"})),s("section",{class:"ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container",ref:t=>this._popoverContainer=t},s("snk-filter-detail",{config:this.config,getMessage:this.getMessage,class:"sc-snk-filter-bar snk-filter__popover ez-padding--small",ref:t=>this._popover=t,key:this.config.id,"data-element-id":this._idSnkFilterDetail})))}get _filterItemElement(){return r(this)}static get watchers(){return{detailIsVisible:["observeDetailIsVisible"]}}};export{o as snk_filter_item}
1
+ import{r as t,c as i,h as s,H as e,g as r}from"./p-b9667fbe.js";import{FloatingManager as h,ElementIDUtils as n}from"@sankhyalabs/core";import{F as l}from"./p-584d7212.js";const o=class{constructor(s){t(this,s),this.visibleChanged=i(this,"visibleChanged",7),this.filterChange=i(this,"filterChange",7),this.innerClickCheck=(t,i)=>i.id!=h.MODAL_ELEMENT_ID||(this.detailIsVisible=!1,!1),this.detailIsVisible=void 0,this.config=void 0,this.getMessage=void 0}observeDetailIsVisible(t){this.visibleChanged.emit(t)}async showUp(t=!1){return new Promise((i=>{this._filterItemElement.scrollIntoView({behavior:"auto",block:"nearest",inline:"nearest"}),t&&(this._closeCallback=i,window.requestAnimationFrame((()=>{this._floatingID=h.float(this._popover,this._popoverContainer,this.getFloatOptions()),this._popover.show(),this.detailIsVisible=!0})))}))}updatePosition(){null!=this._floatingID&&h.updateFloatPosition(this._popover,this._popoverContainer,this.getFloatOptions())}getFloatOptions(){return{autoClose:!0,innerClickTest:this.innerClickCheck,backClickListener:()=>this.onDetailCloseCallback(),left:this.getScrollOffsetLeft(),top:this.getScrollOffsetTop(),useOverlay:!0,overlayClassName:"ez-scrim ez-scrim--light",isFixed:!0}}getScrollOffsetLeft(){const t=getComputedStyle(this._filterItemElement).getPropertyValue("padding-left");return`calc(${this._filterItemElement.getBoundingClientRect().x}px + ${t})`}getScrollOffsetTop(){const t=this._filterItemElement.getBoundingClientRect();return t.y+t.height+"px"}controlScrollPage(){window.removeEventListener("scroll",this.updatePosition.bind(this)),window.addEventListener("scroll",this.updatePosition.bind(this))}async hideDetail(){this.detailIsVisible&&null!=this._floatingID&&h.close(this._floatingID)}onDetailCloseCallback(){this._floatingID=void 0,this.detailIsVisible=!1,this._closeCallback&&(this._closeCallback(),this._closeCallback=void 0)}clickListener(t){[this._chipElement,this._leftIconElement,this._rightIconElement].includes(t.target)&&(t.target===this._rightIconElement&&null!=this.config.value?this.filterChange.emit(Object.assign(Object.assign({},this.config),{value:void 0})):this.detailIsVisible?this.hideDetail():this.showUp(!0),t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation())}mouseDownListener(t){this.detailIsVisible&&[this._chipElement,this._leftIconElement,this._rightIconElement].includes(t.target)&&(t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation())}getLabel(){const{type:t,value:i,label:s,props:e}=this.config;if(i){if(t===l.BINARY_SELECT){const[t,s]=e.options;if(t.name===i)return t.label;if(s.name===i)return s.label}if(t===l.MULTI_SELECT)return`${s}: ${e.options.find((t=>t.value===i)).label}`;if(t===l.PERIOD){let{end:t,start:e}=i;"string"==typeof t&&(t=new Date(t),t.setMinutes(t.getMinutes()+t.getTimezoneOffset())),"string"==typeof e&&(e=new Date(e),e.setMinutes(e.getMinutes()+e.getTimezoneOffset()));const r=new Intl.DateTimeFormat("pt-BR");return t&&e?`${s}: ${r.format(e)} a ${r.format(t)}`:e?`${s}: A partir de ${r.format(e)}`:t?`${s}: Até ${r.format(t)}`:s}return t===l.SEARCH?`${s}: ${i.value} - ${i.label}`:t===l.PERSONALIZED?s:`${s}: ${i}`}return s}componentDidLoad(){this._filterItemElement&&(n.addIDInfo(this._filterItemElement),this._idSnkFilterDetail=`filterDetail_${this.config.id}`),this.controlScrollPage()}componentDidRender(){null==this._floatingID&&this._popover&&this._popover.remove()}filterChangeListener(){this.hideDetail()}getRightIconName(){return null!=this.config.value?"close":this.detailIsVisible?"chevron-up":"chevron-down"}getLeftIconName(){switch(this.config.type){case l.PERIOD:return"calendar";case l.PERSONALIZED:return"tune"}}render(){const t=this.getLeftIconName();return s(e,null,s("ez-chip",{ref:t=>this._chipElement=t,label:this.getLabel(),value:null!=this.config.value,id:this.config.id},t?s("ez-icon",{ref:t=>this._leftIconElement=t,iconName:t,class:"ez-padding-right--small",slot:"leftIcon"}):void 0,s("ez-icon",{ref:t=>this._rightIconElement=t,iconName:this.getRightIconName(),class:"ez-padding-left--small",slot:"rightIcon",id:"removeFilter"})),s("section",{class:"ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container",ref:t=>this._popoverContainer=t},s("snk-filter-detail",{config:this.config,getMessage:this.getMessage,class:"sc-snk-filter-bar snk-filter__popover ez-padding--small",ref:t=>this._popover=t,key:this.config.id,"data-element-id":this._idSnkFilterDetail})))}get _filterItemElement(){return r(this)}static get watchers(){return{detailIsVisible:["observeDetailIsVisible"]}}};export{o as snk_filter_item}
@@ -1 +1 @@
1
- import{r as t,c as e,h as i,H as s,g as r}from"./p-b9667fbe.js";import{ApplicationUtils as l}from"@sankhyalabs/ezui/dist/collection/utils";import{F as n}from"./p-9dd2b8cb.js";import{ElementIDUtils as a,DataType as o}from"@sankhyalabs/core";const h=class{constructor(i){t(this,i),this.filterChange=e(this,"filterChange",7),this.config=void 0,this.getMessage=void 0}async show(){this._editor.show()}componentDidLoad(){if(this._element){a.addIDInfo(this._element);const t=this._element.getAttribute(a.DATA_ELEMENT_ID_ATTRIBUTE_NAME);this._idContentEditor=`${t}_${this.config.id}`}}changeConfig(t){this.filterChange.emit(t)}getContentEditor(){switch(this.config.type){case n.BINARY_SELECT:return"snk-filter-binary-select";case n.MULTI_SELECT:return"snk-filter-multi-select";case n.PERIOD:return"snk-filter-period";case n.SEARCH:return"snk-filter-search";case n.NUMBER:return"snk-filter-number";case n.PERSONALIZED:return"snk-filter-personalized"}return"snk-filter-text"}removeItem(){this.changeConfig(Object.assign(Object.assign({},this.config),{visible:!1,fixed:!1,value:void 0}))}getPopUpHeaderButtons(){if(!this.config.hardFixed)return[this.buildIcon(this.getMessage("snkFilterBar.removeFilter"),"delete",(()=>this.removeItem())),this.buildIcon(this.getMessage(this.config.fixed?"snkFilterBar.unpinFilter":"snkFilterBar.pinFilter"),this.config.fixed?"un-pin":"push-pin",(()=>this.changeConfig(Object.assign(Object.assign({},this.config),{fixed:!this.config.fixed}))))]}buildIcon(t,e,s){return i("button",{onClick:()=>s(),class:"sc-snk-filter-bar snk-filter-item__editor-header-button",ref:e=>e&&this.buildIdButton(e,t)},i("ez-icon",Object.assign({title:t,iconName:e},{[a.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${a.getInternalIDInfo(`_${t}`)}`})))}buildIdButton(t,e){if(!t)return;const i={id:e};t.removeAttribute(a.DATA_ELEMENT_ID_ATTRIBUTE_NAME),a.addIDInfoIfNotExists(t,"button",i)}getNormalizedValue(t,e){return t.reduce(((t,e,i)=>(e.dataType!==o.BOOLEAN||null!=t&&null!=t[i]||((t=t||[])[i]=!1),t)),e)}apply(){var t;let e=this._editor.value,i=!0;if(this.config.type===n.PERSONALIZED){const s=(null===(t=this.config.props.personalizedFilter)||void 0===t?void 0:t.parameters)||[];e=this.getNormalizedValue(s,e);const r=s.length;0===r?e=[]:i=this.validateAllFilled(r,e)}i&&this.changeConfig(Object.assign(Object.assign({},this.config),{value:e}))}validateAllFilled(t,e){let i=!0;return null!=e&&t>1&&(t>e.length?i=!1:e.forEach((t=>{null==t&&(i=!1)}))),i||l.alert("Filtro parcialmente preenchido","Favor completar todas as informações do filtro."),i}clear(){this.changeConfig(Object.assign(Object.assign({},this.config),{value:void 0}))}onKeyDonwListener(t){"Enter"===t.key&&this._applyButton.setFocus().then((()=>this.apply()))}render(){const t=this.getContentEditor();return i(s,null,i("div",{class:"col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center"},i("div",{class:"ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header"},this.config.detailTitle),this.getPopUpHeaderButtons()),i(t,{ref:t=>this._editor=t,value:this.config.value,config:this.config,onKeyDown:t=>this.onKeyDonwListener(t),"data-element-id":this._idContentEditor}),i("hr",{class:"sc-snk-filter-bar snk-filter__popover-rule"}),i("div",{class:"ez-col ez-col--sd-12 ez-align--right"},i("ez-button",{label:this.getMessage("snkFilterBar.cleanFilter"),onClick:()=>this.clear(),size:"small"}),i("ez-button",{ref:t=>this._applyButton=t,label:this.getMessage("snkFilterBar.applyFilter"),onClick:()=>this.apply(),size:"small",class:"ez-button--primary ez-padding-left--medium"})))}get _element(){return r(this)}};export{h as snk_filter_detail}
1
+ import{r as t,c as e,h as i,H as s,g as r}from"./p-b9667fbe.js";import{ApplicationUtils as l}from"@sankhyalabs/ezui/dist/collection/utils";import{F as n}from"./p-584d7212.js";import{ElementIDUtils as a,DataType as o}from"@sankhyalabs/core";const h=class{constructor(i){t(this,i),this.filterChange=e(this,"filterChange",7),this.config=void 0,this.getMessage=void 0}async show(){this._editor.show()}componentDidLoad(){if(this._element){a.addIDInfo(this._element);const t=this._element.getAttribute(a.DATA_ELEMENT_ID_ATTRIBUTE_NAME);this._idContentEditor=`${t}_${this.config.id}`}}changeConfig(t){this.filterChange.emit(t)}getContentEditor(){switch(this.config.type){case n.BINARY_SELECT:return"snk-filter-binary-select";case n.MULTI_SELECT:return"snk-filter-multi-select";case n.PERIOD:return"snk-filter-period";case n.SEARCH:return"snk-filter-search";case n.NUMBER:return"snk-filter-number";case n.PERSONALIZED:return"snk-filter-personalized"}return"snk-filter-text"}removeItem(){this.changeConfig(Object.assign(Object.assign({},this.config),{visible:!1,fixed:!1,value:void 0}))}getPopUpHeaderButtons(){if(!this.config.hardFixed)return[this.buildIcon(this.getMessage("snkFilterBar.removeFilter"),"delete",(()=>this.removeItem())),this.buildIcon(this.getMessage(this.config.fixed?"snkFilterBar.unpinFilter":"snkFilterBar.pinFilter"),this.config.fixed?"un-pin":"push-pin",(()=>this.changeConfig(Object.assign(Object.assign({},this.config),{fixed:!this.config.fixed}))))]}buildIcon(t,e,s){return i("button",{onClick:()=>s(),class:"sc-snk-filter-bar snk-filter-item__editor-header-button",ref:e=>e&&this.buildIdButton(e,t)},i("ez-icon",Object.assign({title:t,iconName:e},{[a.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${a.getInternalIDInfo(`_${t}`)}`})))}buildIdButton(t,e){if(!t)return;const i={id:e};t.removeAttribute(a.DATA_ELEMENT_ID_ATTRIBUTE_NAME),a.addIDInfoIfNotExists(t,"button",i)}getNormalizedValue(t,e){return t.reduce(((t,e,i)=>(e.dataType!==o.BOOLEAN||null!=t&&null!=t[i]||((t=t||[])[i]=!1),t)),e)}apply(){var t;let e=this._editor.value,i=!0;if(this.config.type===n.PERSONALIZED){const s=(null===(t=this.config.props.personalizedFilter)||void 0===t?void 0:t.parameters)||[];e=this.getNormalizedValue(s,e);const r=s.length;0===r?e=[]:i=this.validateAllFilled(r,e)}i&&this.changeConfig(Object.assign(Object.assign({},this.config),{value:e}))}validateAllFilled(t,e){let i=!0;return null!=e&&t>1&&(t>e.length?i=!1:e.forEach((t=>{null==t&&(i=!1)}))),i||l.alert("Filtro parcialmente preenchido","Favor completar todas as informações do filtro."),i}clear(){this.changeConfig(Object.assign(Object.assign({},this.config),{value:void 0}))}onKeyDonwListener(t){"Enter"===t.key&&this._applyButton.setFocus().then((()=>this.apply()))}render(){const t=this.getContentEditor();return i(s,null,i("div",{class:"col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center"},i("div",{class:"ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header"},this.config.detailTitle),this.getPopUpHeaderButtons()),i(t,{ref:t=>this._editor=t,value:this.config.value,config:this.config,onKeyDown:t=>this.onKeyDonwListener(t),"data-element-id":this._idContentEditor}),i("hr",{class:"sc-snk-filter-bar snk-filter__popover-rule"}),i("div",{class:"ez-col ez-col--sd-12 ez-align--right"},i("ez-button",{label:this.getMessage("snkFilterBar.cleanFilter"),onClick:()=>this.clear(),size:"small"}),i("ez-button",{ref:t=>this._applyButton=t,label:this.getMessage("snkFilterBar.applyFilter"),onClick:()=>this.apply(),size:"small",class:"ez-button--primary ez-padding-left--medium"})))}get _element(){return r(this)}};export{h as snk_filter_detail}
@@ -1,4 +1,4 @@
1
- import{r as t,c as s,h as e,g as n}from"./p-b9667fbe.js";import{WaitingChangeException as i,WarningException as r,ErrorException as a,ObjectUtils as o,DateUtils as c,StringUtils as h,DependencyType as u,ElementIDUtils as l,ApplicationContext as p,ErrorTracking as d,DataType as m}from"@sankhyalabs/core";import{d as f,D as w,U as y}from"./p-41d92871.js";import{ApplicationUtils as g}from"@sankhyalabs/ezui/dist/collection/utils";import{P as I}from"./p-11028eba.js";import{G as P,C as v}from"./p-52ed2a18.js";import{D as _}from"./p-f821768b.js";import{R as A}from"./p-0d81236c.js";import{S as E}from"./p-92a0fca4.js";import"./p-112455b1.js";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 i||(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 i||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 S(){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(S=function(){return t})()}const T=D;function D(t,s){const e=S();return(D=function(t){return e[t-=392]})(t,s)}!function(){const t=D,s=S();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 N=T(396);class b{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchTotals",f.gql`query($filters: [InputFilter!] $name: String!) {
1
+ import{r as t,c as s,h as e,g as n}from"./p-b9667fbe.js";import{WaitingChangeException as i,WarningException as r,ErrorException as a,ObjectUtils as o,DateUtils as c,StringUtils as h,DependencyType as u,ElementIDUtils as l,ApplicationContext as p,ErrorTracking as d,DataType as m}from"@sankhyalabs/core";import{d as f,D as w,U as y}from"./p-41d92871.js";import{ApplicationUtils as g}from"@sankhyalabs/ezui/dist/collection/utils";import{P as I}from"./p-11028eba.js";import{G as P,C as v}from"./p-52ed2a18.js";import{D as _}from"./p-f821768b.js";import{R as A}from"./p-0d81236c.js";import{S as E}from"./p-f5f36fbb.js";import"./p-112455b1.js";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 i||(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 i||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 S(){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(S=function(){return t})()}const T=D;function D(t,s){const e=S();return(D=function(t){return e[t-=392]})(t,s)}!function(){const t=D,s=S();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=T(396);class N{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchTotals",f.gql`query($filters: [InputFilter!] $name: String!) {
2
2
  $queryAlias$: fetchTotals(name: $name, filters: $filters ){
3
3
  name
4
4
  value
@@ -8,4 +8,4 @@ import{r as t,c as s,h as e,g as n}from"./p-b9667fbe.js";import{WaitingChangeExc
8
8
  name
9
9
  resource
10
10
  }
11
- }`)}async getParam(t){const s=`param://application?params=${t}`;return w.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 k=R;function R(t,s){const e=$();return(R=function(t){return e[t-=378]})(t,s)}function $(){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($=function(){return t})()}!function(){const t=R,s=$();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 F{[k(397)](t){const s=k;if(typeof(t=utxt(t[s(390)]))==s(392)&&(t=JSON[s(400)](t)),null==t)throw Error(s(395));const e=new M("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 M{constructor(t){const s=k;this.isSup=t,this[s(384)]={}}[k(378)](t,s){this[k(384)][t]=s}[k(393)](t){const s=k;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}}class q extends A{getData(t){const s=`cfg://auth/${t}`;return new Promise(((t,e)=>{this.loadResource(s).then((s=>{let e=o.stringToObject(s);e&&"object"==typeof e&&t(e)})).catch((t=>{e(t)}))}))}}var x;!function(t){t.INSERT="I",t.UPDATE="A",t.REMOVE="E",t.SHOW="C",t.CONFIG="F",t.CONFIG_NUMBER="N",t.CLONE="D",t.CONFIG_GRID="G"}(x||(x={}));const z=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 G,this.messagesBuilder=void 0,this.configName=void 0}get parameters(){return this._parameters||(this._parameters=new U),this._parameters}get resourceID(){return this._resourceID||(this._resourceID=this.urlParams.get("workspaceResourceID")||this.urlParams.get("resourceID")||O.resourceID||"unknown.resource.id"),this._resourceID}get auth(){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.resourceID).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.auth.then((e=>{this.getAuthList(e).then((s=>{t(s.isSup)})).catch((t=>s(t)))}))}))}async hasAccess(t){return new Promise(((s,e)=>{this.auth.then((n=>{this.getAuthList(n).then((e=>{s(e.isSup||e.actions[t])})).catch((t=>e(t)))}))}))}async getAllAccess(){return new Promise(((t,s)=>{this.auth.then((e=>{this.getAuthList(e).then((s=>{const e={};e.isSup=s.isSup,Object.entries(x).forEach((t=>{e[t[0]]=s.actions[t[1]]||!1})),t(e)})).catch((t=>s(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((n=>{"1"===n?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)=>{w.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)=>{w.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){O.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){return new Promise(((n,i)=>{const r=this.getDuPromissesStack(s),a=r.length>0;if(r.push(new H(n,i)),!a){const n=this.dataUnitFetcher.getDataUnit(t,this.resourceID,e);n.loadMetadata().then((()=>{for(s&&this.updateDataunitCache(void 0,s,n);r.length>0;)r.pop().resolve(n)})).catch((t=>{for(;r.length>0;)r.pop().reject(t)}))}}))}async updateDataunitCache(t,s,e){t&&this._duCache.delete(t),this._duCache.set(s,e)}async getDataUnit(t,s,e){return new Promise(((n,i)=>{const r=this._duCache.get(s);r?n(r):this.createDataunit(t,s,e).then((t=>{n(t)})).catch((t=>i(t)))}))}async addClientEvent(t,s){return new Promise((e=>{w.addClientEvent(t,s),e()}))}async removeClientEvent(t){return new Promise((s=>{w.removeClientEvent(t),s()}))}async hasClientEvent(t){return new Promise((s=>{s(w.hasClientEvent(t))}))}async getResourceID(){return Promise.resolve(this.resourceID)}async getUserID(){return Promise.resolve(window.UID)}async alert(t,s,e,n){return g.alert(t,s,e,n)}async error(t,s,e,n){return g.error(t,s,e,n)}async success(t,s,e,n){return g.success(t,s,e,n)}async message(t,s,e,n){return g.message(t,s,e,n)}async confirm(t,s,e,n,i){return g.confirm(t,s,e,n,i)}async info(t,s){return g.info(t,s)}async loadGridConfig(t){return this.gridConfigFetcher.getConfig(t,this.resourceID)}async loadTotals(t,s,e){return this.totalsFetcher.fetchTotals(t,s,e)}async getAuthList(t){return await(new F).parseFromJSON(t)}get urlParams(){return this._urlParams||(this._urlParams=y.getQueryParams(location.search)),this._urlParams}get dataUnitFetcher(){return this._dataUnitFetcher||(this._dataUnitFetcher=new _),this._dataUnitFetcher}get gridConfigFetcher(){return this._gridConfigFetcher||(this._gridConfigFetcher=new P),this._gridConfigFetcher}get totalsFetcher(){return this._totalsFetcher||(this._totalsFetcher=new b),this._totalsFetcher}get pesquisaFetcher(){return this._pesquisaFetcher||(this._pesquisaFetcher=new I),this._pesquisaFetcher}get authFetcher(){return this._authFetcher||(this._authFetcher=new q),this._authFetcher}async executeSearch(t,s,e){const n=null==e?void 0:e.getField(s);if(n){const{mode:s,argument:i}=t,{ENTITYNAME:r,CODEFIELD:a,DESCRIPTIONFIELD:o,ROOTENTITY:c,DESCRIPTIONENTITY:h}=n.properties,l=n.dependencies;let p;const d={rootEntity:c,descriptionFieldName:o,codeFieldName:a,showInactives:!1,dataUnitId:e.dataUnitId};return null==l||l.filter((t=>t.masterFields)).forEach((t=>{var s;t.type===u.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),n=(null==s?void 0:s.dataType)||m.TEXT,i=e.getFieldValue(t);if(null==i)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:i,dataType:n}}))})})),this.executePreparedSearch(s,i,{entity:r,entityDescription:h,criteria:p,searchOptions:d})}}async executePreparedSearch(t,s,e){const{entity:n,entityDescription:i,criteria:r,searchOptions:a}=e;return"ADVANCED"===t?new Promise((t=>{const e=document.createElement("snk-pesquisa");e[l.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=`entity_${n}`,e.argument=s,e.searchLoader=t=>this.pesquisaFetcher.loadAdvancedSearch(n,t,r,a),e.selectItem=s=>{t(s),this.clearPopUpTitle(),this.closePopUp()},this.setPopUpTitle(i),this.showPopUp(e)})):this.pesquisaFetcher.loadSearchOptions(n,s,r,a)}async isDebugMode(){return new Promise((t=>{t(window.isDebugMode)}))}async getAppLabel(){return O.getAppLabel(this._resourceID)}addSearchListener(t,s,e){return new Promise((n=>{n(this.pesquisaFetcher.addSearchListener(t,s.dataUnitId,e))}))}clearContent(t){t&&Array.from(t.children).forEach((s=>{t.removeChild(s)}))}clearPopUpTitle(){this._popUp.ezTitle=""}setPopUpTitle(t){this._popUp.ezTitle=t}componentWillLoad(){this._errorHandler=new C(this),this.messagesBuilder=new E,p.setContextValue("__EZUI__UPLOAD__ADD__URL__",`${y.getUrlBase()}/mge/upload/file`),p.setContextValue("__EZUI__SEARCH__OPTION__LOADER__",((t,s,e)=>this.executeSearch(t,s,e))),p.setContextValue("__EZUI__GRID_LICENSE__",N),d.init(),v.get()}connectedCallback(){p.setContextValue("__SNK__APPLICATION__",this),w.addRequestListener(this._requestListener)}disconnectedCallback(){w.removeRequestListener(this._requestListener)}componentDidLoad(){this.applicationLoading.emit(!0),window.requestAnimationFrame((()=>{this.applicationLoaded.emit(!0)})),l.addIDInfo(this._element,`resource_${this._resourceID}`)}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 n(this)}};class G{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}}z.style=".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";export{z as snk_application}
11
+ }`)}async getParam(t){const s=`param://application?params=${t}`;return w.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 k=R;function R(t,s){const e=$();return(R=function(t){return e[t-=378]})(t,s)}function $(){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($=function(){return t})()}!function(){const t=R,s=$();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 F{[k(397)](t){const s=k;if(typeof(t=utxt(t[s(390)]))==s(392)&&(t=JSON[s(400)](t)),null==t)throw Error(s(395));const e=new M("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 M{constructor(t){const s=k;this.isSup=t,this[s(384)]={}}[k(378)](t,s){this[k(384)][t]=s}[k(393)](t){const s=k;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}}class q extends A{getData(t){const s=`cfg://auth/${t}`;return new Promise(((t,e)=>{this.loadResource(s).then((s=>{let e=o.stringToObject(s);e&&"object"==typeof e&&t(e)})).catch((t=>{e(t)}))}))}}var x;!function(t){t.INSERT="I",t.UPDATE="A",t.REMOVE="E",t.SHOW="C",t.CONFIG="F",t.CONFIG_NUMBER="N",t.CLONE="D",t.CONFIG_GRID="G"}(x||(x={}));const z=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 G,this.messagesBuilder=void 0,this.configName=void 0}get parameters(){return this._parameters||(this._parameters=new U),this._parameters}get resourceID(){return this._resourceID||(this._resourceID=this.urlParams.get("workspaceResourceID")||this.urlParams.get("resourceID")||O.resourceID||"unknown.resource.id"),this._resourceID}get auth(){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.resourceID).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.auth.then((e=>{this.getAuthList(e).then((s=>{t(s.isSup)})).catch((t=>s(t)))}))}))}async hasAccess(t){return new Promise(((s,e)=>{this.auth.then((n=>{this.getAuthList(n).then((e=>{s(e.isSup||e.actions[t])})).catch((t=>e(t)))}))}))}async getAllAccess(){return new Promise(((t,s)=>{this.auth.then((e=>{this.getAuthList(e).then((s=>{const e={};e.isSup=s.isSup,Object.entries(x).forEach((t=>{e[t[0]]=s.actions[t[1]]||!1})),t(e)})).catch((t=>s(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((n=>{"1"===n?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)=>{w.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)=>{w.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){O.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){return new Promise(((n,i)=>{const r=this.getDuPromissesStack(s),a=r.length>0;if(r.push(new H(n,i)),!a){const n=this.dataUnitFetcher.getDataUnit(t,this.resourceID,e);n.loadMetadata().then((()=>{for(s&&this.updateDataunitCache(void 0,s,n);r.length>0;)r.pop().resolve(n)})).catch((t=>{for(;r.length>0;)r.pop().reject(t)}))}}))}async updateDataunitCache(t,s,e){t&&this._duCache.delete(t),this._duCache.set(s,e)}async getDataUnit(t,s,e){return new Promise(((n,i)=>{const r=this._duCache.get(s);r?n(r):this.createDataunit(t,s,e).then((t=>{n(t)})).catch((t=>i(t)))}))}async addClientEvent(t,s){return new Promise((e=>{w.addClientEvent(t,s),e()}))}async removeClientEvent(t){return new Promise((s=>{w.removeClientEvent(t),s()}))}async hasClientEvent(t){return new Promise((s=>{s(w.hasClientEvent(t))}))}async getResourceID(){return Promise.resolve(this.resourceID)}async getUserID(){return Promise.resolve(window.UID)}async alert(t,s,e,n){return g.alert(t,s,e,n)}async error(t,s,e,n){return g.error(t,s,e,n)}async success(t,s,e,n){return g.success(t,s,e,n)}async message(t,s,e,n){return g.message(t,s,e,n)}async confirm(t,s,e,n,i){return g.confirm(t,s,e,n,i)}async info(t,s){return g.info(t,s)}async loadGridConfig(t){return this.gridConfigFetcher.getConfig(t,this.resourceID)}async loadTotals(t,s,e){return this.totalsFetcher.fetchTotals(t,s,e)}async getAuthList(t){return await(new F).parseFromJSON(t)}get urlParams(){return this._urlParams||(this._urlParams=y.getQueryParams(location.search)),this._urlParams}get dataUnitFetcher(){return this._dataUnitFetcher||(this._dataUnitFetcher=new _),this._dataUnitFetcher}get gridConfigFetcher(){return this._gridConfigFetcher||(this._gridConfigFetcher=new P),this._gridConfigFetcher}get totalsFetcher(){return this._totalsFetcher||(this._totalsFetcher=new N),this._totalsFetcher}get pesquisaFetcher(){return this._pesquisaFetcher||(this._pesquisaFetcher=new I),this._pesquisaFetcher}get authFetcher(){return this._authFetcher||(this._authFetcher=new q),this._authFetcher}async executeSearch(t,s,e){const n=null==e?void 0:e.getField(s);if(n){const{mode:s,argument:i}=t,{ENTITYNAME:r,CODEFIELD:a,DESCRIPTIONFIELD:o,ROOTENTITY:c,DESCRIPTIONENTITY:h}=n.properties,l=n.dependencies;let p;const d={rootEntity:c,descriptionFieldName:o,codeFieldName:a,showInactives:!1,dataUnitId:e.dataUnitId};return null==l||l.filter((t=>t.masterFields)).forEach((t=>{var s;t.type===u.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),n=(null==s?void 0:s.dataType)||m.TEXT,i=e.getFieldValue(t);if(null==i)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:i,dataType:n}}))})})),this.executePreparedSearch(s,i,{entity:r,entityDescription:h,criteria:p,searchOptions:d})}}async executePreparedSearch(t,s,e){const{entity:n,entityDescription:i,criteria:r,searchOptions:a}=e;return"ADVANCED"===t?new Promise((t=>{const e=document.createElement("snk-pesquisa");e[l.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=`entity_${n}`,e.argument=s,e.searchLoader=t=>this.pesquisaFetcher.loadAdvancedSearch(n,t,r,a),e.selectItem=s=>{t(s),this.clearPopUpTitle(),this.closePopUp()},this.setPopUpTitle(i),this.showPopUp(e)})):this.pesquisaFetcher.loadSearchOptions(n,s,r,a)}async isDebugMode(){return new Promise((t=>{t(window.isDebugMode)}))}async getAppLabel(){return O.getAppLabel(this._resourceID)}addSearchListener(t,s,e){return new Promise((n=>{n(this.pesquisaFetcher.addSearchListener(t,s.dataUnitId,e))}))}clearContent(t){t&&Array.from(t.children).forEach((s=>{t.removeChild(s)}))}clearPopUpTitle(){this._popUp.ezTitle=""}setPopUpTitle(t){this._popUp.ezTitle=t}componentWillLoad(){this._errorHandler=new C(this),this.messagesBuilder=new E,p.setContextValue("__EZUI__UPLOAD__ADD__URL__",`${y.getUrlBase()}/mge/upload/file`),p.setContextValue("__EZUI__SEARCH__OPTION__LOADER__",((t,s,e)=>this.executeSearch(t,s,e))),p.setContextValue("__EZUI__GRID_LICENSE__",b),d.init(),v.get()}connectedCallback(){p.setContextValue("__SNK__APPLICATION__",this),w.addRequestListener(this._requestListener)}disconnectedCallback(){w.removeRequestListener(this._requestListener)}componentDidLoad(){this.applicationLoading.emit(!0),window.requestAnimationFrame((()=>{this.applicationLoaded.emit(!0)})),l.addIDInfo(this._element,`resource_${this._resourceID}`)}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 n(this)}};class G{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}}z.style=".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";export{z as snk_application}
@@ -1 +1 @@
1
- import{r as i,c as e,h as s,F as t}from"./p-b9667fbe.js";import{ElementIDUtils as a}from"@sankhyalabs/core";import{S as r}from"./p-e0aa5838.js";import{buildFormMetadata as n,FormMetadata as d}from"@sankhyalabs/ezui/dist/collection/utils/form";import{T as o}from"./p-c2beb95c.js";import{T as h}from"./p-ed438690.js";import{c as l}from"./p-17375123.js";import"./p-41d92871.js";import"./p-11028eba.js";import{P as u}from"./p-f132e371.js";const v="__FORM:",g=class{constructor(s){i(this,s),this.exit=e(this,"exit",7),this.actionClick=e(this,"actionClick",7),this._guideBuilders=new Map,this.dataUnit=void 0,this.dataState=void 0,this.configName=void 0,this.entityPath=void 0,this.actionsList=void 0,this.recordsValidator=void 0,this.masterFormConfig=void 0,this.selectedGuide=void 0,this.taskbarManager=void 0,this.messagesBuilder=void 0,this.presentationMode=void 0,this._breadcrumbItems=[],this._guides=void 0,this._formEditorConfigManager=void 0,this._formEditorDataUnit=void 0}observeDataUnit(){this.loadGuides(!0)}observeDataState(i,e){const s=null==i?void 0:i.selectedRecord,t=null==e?void 0:e.selectedRecord;(null==s?void 0:s.__record__id__)!==(null==t?void 0:t.__record__id__)&&this.loadGuides((null==e?void 0:e.insertionMode)!=(null==i?void 0:i.insertionMode))}observeMasterFormConfig(){this.loadGuides(this.noGuideSelected())}async showFormConfig(i=!1){const e=!i||null==this._currentDetail;this._formEditorConfigManager=e?this._configManager:this._currentDetail.formConfigManager,this._formEditorDataUnit=e?this.dataUnit:this._currentDetail.dataUnit}exitViewer(){this.dataUnit.isDirty()?this.dataUnit.cancelEdition({after:()=>this.exit.emit()}):this.exit.emit()}onActionClick(i){i.detail===h.CONFIGURATOR&&"master"!=i.target.dataset.taskbarOwner&&(this._snkConfigurator.open(),i.stopImmediatePropagation(),i.stopPropagation())}onContentCardChanged(i){g.updateContentCard(i.detail.formName,i.detail.cardConfig,i.detail.propertyChanged,this._configManager).then((()=>this.masterFormConfig=this._configManager.getConfig(this.dataState.insertionMode,this.dataUnit)))}getMessage(i){return this.messagesBuilder.getMessage(i,this.dataUnit.getSelectedRecord())}loadGuides(i){if(!this.dataUnit)return;if(!this._configManager.isLoaded)return;this._masterFormMetadata=n(this.masterFormConfig,this.dataUnit,!0);const e=this._masterFormMetadata.getAllSheets(),s=this.dataUnit.getSelectedRecord(),t=!s||this.dataUnit.isNewRecord(s.__record__id__),a=[];Array.from(e.values()).forEach((i=>{const e={id:i.name,label:i.label};this.isDetail(i.name)&&t&&(e.tooltip="Para alterar detalhes é necessário estar com um registro selecionado.",e.disabled=!0),a.push(e)})),this._guides=a,this._guideNavigator&&this._guideNavigator.updateItem(this._guides),i&&(this.selectedGuide=this._guides.length>0?this._guides[0]:void 0)}isDetail(i){return null!=d.getDetailName(i)}updateGuide(i){this._guideBuilders.set(i.id,i);const e=i.buildGuideItem(this._guideBuilders);this._guideNavigator&&this._guideNavigator.updateItem(e).then((()=>{this._guideNavigator.getCurrentPath().then((i=>{this._breadcrumbItems=i}))}))}loadTaskbarProcessor(){var i,e;const s=(null===(i=this.dataState)||void 0===i?void 0:i.isDirty)?"snkGuideViewer.finish_edition":"snkGuideViewer.regular",t=[];this.dataState&&this.dataState.hasPrevious||t.push("PREVIOUS"),this.dataState&&this.dataState.hasNext||t.push("NEXT"),(null===(e=this.dataState)||void 0===e?void 0:e.selectionInfo)&&(this.dataState.selectionInfo.length>1&&t.push("CLONE"),this.dataState.selectionInfo.isAllRecords()&&t.push("REMOVE"));const a=["PREVIOUS","NEXT","DIVIDER","CLONE","REMOVE","MORE_OPTIONS","DIVIDER","GRID_MODE","CONFIGURATOR"];this.presentationMode==u.SECONDARY?a.unshift("INSERT"):a.push("INSERT"),this._taskbarProcessor=new o({"snkGuideViewer.regular":a,"snkGuideViewer.finish_edition":["CANCEL","SAVE"]}),this._taskbarProcessor.process(s,this.taskbarManager,this.dataState,t)}static updateContentCard(i,e,s,t){return t.saveCardState(i,e,s)}static buildFixedForms(i,e,a,r,n,d){const o=null==i?void 0:i.cardsState;if(null!=o)return s(t,null,Array.from(o.entries()).filter((([i,e])=>(null==e?void 0:e.fixed)&&i!=a)).sort((([,i],[,e])=>((null==i?void 0:i.fixSequence)||0)-((null==e?void 0:e.fixSequence)||0))).map((([t,a])=>{var o;const h=e.getSheet(t);if(null!=h)return s("snk-form-view",{levelPath:d,label:h.label,name:t,fields:h.fields,formMetadata:e,dataUnit:r,recordsValidator:n,contracted:"CONTRACTED"===(null==a?void 0:a.presentation),fixed:null==a?void 0:a.fixed,summaryFields:null===(o=null==i?void 0:i.summary)||void 0===o?void 0:o.get(t),key:t})})))}wrapDetail(i,e){if(0===i.length)return e;const t=i.pop(),a=d.getDetailName(t);return a?this.wrapDetail(i,s("snk-data-unit",{dataUnitName:`${this.getDataUnitName(i,a)}`,entityName:a},e)):void 0}getDataUnitName(i,e){if(i.length>0){const s=i.map((i=>d.getDetailName(i)));return`${this.entityPath}/${s.join("/")}/${e}`}return`${this.entityPath}/${e}`}getContent(){var i,e,t,a,r;if(!this.selectedGuide)return;const n=this.selectedGuide.id;let o;const h=n.split("::"),l=h.pop(),g=d.getDetailName(l);let c=n;if(g||h.length>0){let e,t;if(n.includes(v)){[c,e]=n.split(v);const s=(null===(i=this._breadcrumbItems)||void 0===i?void 0:i.length)||0;t=s>1?this._breadcrumbItems[s-2]:this.selectedGuide}else t=this.selectedGuide;o=this.wrapDetail(h,s("snk-detail-view",{ref:i=>this._currentDetail=i,dataUnitName:this.getDataUnitName(h,g),onSnkDetailGuidesChange:i=>this.updateGuide(i.detail),entityName:g,selectedForm:e,branchGuide:t,guideItemPath:this._breadcrumbItems,key:`detail${c}`,onSnkSwitchGuide:i=>this._guideNavigator.selectGuide(i.detail)}))}else{const i=this.selectedGuide.id,d=this._masterFormMetadata.getSheet(i);if(d){const h=null===(t=null===(e=this.masterFormConfig)||void 0===e?void 0:e.cardsState)||void 0===t?void 0:t.get(i);o=s("snk-form-view",{ref:i=>this._mainForm=i,fixed:null==h?void 0:h.fixed,summaryFields:null===(r=null===(a=this.masterFormConfig)||void 0===a?void 0:a.summary)||void 0===r?void 0:r.get(i),name:i,label:d.label,fields:d.fields,dataUnit:this.dataUnit,formMetadata:this._masterFormMetadata,recordsValidator:this.recordsValidator,key:n},this.presentationMode==u.SECONDARY&&this.buildTaskBar())}}return o}onBreadcrumbClickHandler(i){null!=(null==i?void 0:i.id)&&this._guideNavigator.selectGuide(i.id)}updateSelectedGuideHandler(i){this._guideHasChanged=this.selectedGuide!=i,this.selectedGuide=i,this._guideNavigator.getCurrentPath().then((i=>{this._breadcrumbItems=i}))}getConfigViewMode(){return l.GRID}changeConfigViewMode(i){this._currentDetail&&this._currentDetail.changeViewMode(i)}openConfig(i){this._snkConfigurator.close(),this._currentDetail&&(i===l.FORM?this.showFormConfig(!0):this._currentDetail.configGrid())}noGuideSelected(){var i;return void 0===this.selectedGuide||"__main"===(null===(i=this.selectedGuide)||void 0===i?void 0:i.id)}componentWillLoad(){this._configManager=new r(this.configName,(i=>this.masterFormConfig=i)),this._configManager.loadConfig()}componentDidRender(){this._guideHasChanged&&(this._currentDetail?this._currentDetail.showUp():this._mainForm&&this._mainForm.showUp(),this._guideHasChanged=!1)}buildTaskBar(){var i;return s("div",{class:"ez-col ez-flex-item--align-center ez-col--sd-6 ez-col--tb-6 "+(this.presentationMode!=u.SECONDARY?"ez-align--right":"ez-padding-bottom--medium")},s("snk-taskbar",{key:"guideViewerTaskbar","data-element-id":"guideViewer",configName:this.configName,buttons:this._taskbarProcessor.buttons,disabledButtons:this._taskbarProcessor.disabledButtons,customButtons:this._taskbarProcessor.customButtons,actionsList:this.actionsList,messagesBuilder:this.messagesBuilder,presentationMode:this.presentationMode,primaryButton:(null===(i=this.dataState)||void 0===i?void 0:i.isDirty)?"SAVE":"INSERT","data-taskbar-owner":"master",dataUnit:this.dataUnit}))}render(){var i,e;if(null!=this._formEditorConfigManager)return s("snk-form-config",{dataUnit:this._formEditorDataUnit,messagesBuilder:this.messagesBuilder,configManager:this._formEditorConfigManager,onConfigClose:()=>this._formEditorConfigManager=null});if(!this.dataUnit)return;if(!this._configManager.isLoaded)return;this.loadTaskbarProcessor();const t=this._guides&&this._guides.length>1;return s("section",{class:"snk-guides-viewer"},s("div",{class:"ez-row snk-guides-viewer__header"},s("div",{class:"ez-col ez-col--sd-6 ez-col--tb-6 ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large",key:"header"},s("ez-button",{onClick:()=>this.exitViewer(),title:this.getMessage("snkCrud.goBackTitle"),mode:"icon",iconName:"arrow_back",class:"ez-padding-right--medium",size:"small"}),s("div",{class:"ez-flex ez-flex--column ez-flex-item--auto"},s("h1",{class:"ez-title ez-title--primary ez-title--xlarge"},this.getMessage("snkCrud.title")),(null===(i=this._breadcrumbItems)||void 0===i?void 0:i.length)>1&&s("div",{class:"ez-margin-top--extra-small"},s("ez-breadcrumb",Object.assign({items:this._breadcrumbItems,onSelectedItem:i=>this.onBreadcrumbClickHandler(null==i?void 0:i.detail)},{[a.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${a.getInternalIDInfo("breadcrumb")}`}))))),this.presentationMode!=u.SECONDARY&&this.buildTaskBar()),s("div",{class:"snk-guides-viewer__container"},t?s("ez-guide-navigator",{ref:i=>this._guideNavigator=i,class:"snk-guides-viewer__guide-navigator",items:this._guides,selectedId:this.selectedGuide?this.selectedGuide.id:void 0,onEzChange:i=>this.updateSelectedGuideHandler(i.detail)}):s("div",null),s("div",{class:"snk-guides-viewer__detail-container"},g.buildFixedForms(this.masterFormConfig,this._masterFormMetadata,null===(e=this.selectedGuide)||void 0===e?void 0:e.id,this.dataUnit,this.recordsValidator),this.getContent())),s("snk-configurator",{ref:i=>this._snkConfigurator=i,viewMode:this.getConfigViewMode(),onConfigSelected:i=>this.changeConfigViewMode(i.detail),messagesBuilder:this.messagesBuilder,onOpenConfig:i=>this.openConfig(i.detail)}))}static get watchers(){return{dataUnit:["observeDataUnit"],dataState:["observeDataState"],masterFormConfig:["observeMasterFormConfig"]}}};g.style=".sc-snk-guides-viewer-h{--snk-guides-viewer--space-large:var(--space--large, 24px);--snk-guides-viewer--space-medium:var(--space--medium, 12px);--snk-guides-viewer__header--min-height:94px;--snk-guides-viewer__header--z-index:var(--more-visible, 2);--snk-guides-viewer__header--background-color:var(--background--body, #fafcff);--snk-guides-viewer__guide-navigator--width:340px;display:block}snk-form-view.sc-snk-guides-viewer{width:100%}.snk-guides-viewer.sc-snk-guides-viewer{position:relative;padding-left:0px;padding-top:0px;padding-right:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__detail-container.sc-snk-guides-viewer{display:flex;row-gap:24px;flex-direction:column}.snk-guides-viewer__header.sc-snk-guides-viewer{position:sticky;align-items:center;top:0;z-index:var(--snk-guides-viewer__header--z-index);background-color:var(--snk-guides-viewer__header--background-color);min-height:var(--snk-guides-viewer__header--min-height);width:calc(100% + (var(--snk-guides-viewer--space-large) * 2));padding-left:var(--snk-guides-viewer--space-large);padding-right:var(--snk-guides-viewer--space-large);padding-top:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-medium);margin-left:calc(var(--snk-guides-viewer--space-large) * -1);margin-right:calc(var(--snk-guides-viewer--space-large) * -1);margin-bottom:var(--snk-guides-viewer--space-medium)}.snk-guides-viewer__container.sc-snk-guides-viewer{display:grid;grid-template-columns:minmax(0, auto) minmax(0, 100%);height:100%;column-gap:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__guide-navigator.sc-snk-guides-viewer{position:sticky;top:calc(var(--snk-guides-viewer__header--min-height) + var(--snk-guides-viewer--space-medium));height:calc(100vh - var(--snk-guides-viewer__header--min-height) - var(--snk-guides-viewer--space-large) - var(--snk-guides-viewer--space-medium))}.snk-guides-viewer__guide-navigator[open].sc-snk-guides-viewer{width:var(--snk-guides-viewer__guide-navigator--width);max-width:var(--snk-guides-viewer__guide-navigator--width);min-width:var(--snk-guides-viewer__guide-navigator--width)}.snk-guides-viewer__detail-content.sc-snk-guides-viewer{min-height:100%;align-items:flex-start;align-content:flex-start}";export{g as S}
1
+ import{r as i,c as e,h as s,F as t}from"./p-b9667fbe.js";import{ElementIDUtils as a}from"@sankhyalabs/core";import{S as r}from"./p-e0aa5838.js";import{buildFormMetadata as n,FormMetadata as d}from"@sankhyalabs/ezui/dist/collection/utils/form";import{T as o}from"./p-c2beb95c.js";import{T as h}from"./p-d410f45a.js";import{c as l}from"./p-17375123.js";import"./p-41d92871.js";import"./p-11028eba.js";import{P as u}from"./p-4c2015a9.js";const v="__FORM:",g=class{constructor(s){i(this,s),this.exit=e(this,"exit",7),this.actionClick=e(this,"actionClick",7),this._guideBuilders=new Map,this.dataUnit=void 0,this.dataState=void 0,this.configName=void 0,this.entityPath=void 0,this.actionsList=void 0,this.recordsValidator=void 0,this.masterFormConfig=void 0,this.selectedGuide=void 0,this.taskbarManager=void 0,this.messagesBuilder=void 0,this.presentationMode=void 0,this._breadcrumbItems=[],this._guides=void 0,this._formEditorConfigManager=void 0,this._formEditorDataUnit=void 0}observeDataUnit(){this.loadGuides(!0)}observeDataState(i,e){const s=null==i?void 0:i.selectedRecord,t=null==e?void 0:e.selectedRecord;(null==s?void 0:s.__record__id__)!==(null==t?void 0:t.__record__id__)&&this.loadGuides((null==e?void 0:e.insertionMode)!=(null==i?void 0:i.insertionMode))}observeMasterFormConfig(){this.loadGuides(this.noGuideSelected())}async showFormConfig(i=!1){const e=!i||null==this._currentDetail;this._formEditorConfigManager=e?this._configManager:this._currentDetail.formConfigManager,this._formEditorDataUnit=e?this.dataUnit:this._currentDetail.dataUnit}exitViewer(){this.dataUnit.isDirty()?this.dataUnit.cancelEdition({after:()=>this.exit.emit()}):this.exit.emit()}onActionClick(i){i.detail===h.CONFIGURATOR&&"master"!=i.target.dataset.taskbarOwner&&(this._snkConfigurator.open(),i.stopImmediatePropagation(),i.stopPropagation())}onContentCardChanged(i){g.updateContentCard(i.detail.formName,i.detail.cardConfig,i.detail.propertyChanged,this._configManager).then((()=>this.masterFormConfig=this._configManager.getConfig(this.dataState.insertionMode,this.dataUnit)))}getMessage(i){return this.messagesBuilder.getMessage(i,this.dataUnit.getSelectedRecord())}loadGuides(i){if(!this.dataUnit)return;if(!this._configManager.isLoaded)return;this._masterFormMetadata=n(this.masterFormConfig,this.dataUnit,!0);const e=this._masterFormMetadata.getAllSheets(),s=this.dataUnit.getSelectedRecord(),t=!s||this.dataUnit.isNewRecord(s.__record__id__),a=[];Array.from(e.values()).forEach((i=>{const e={id:i.name,label:i.label};this.isDetail(i.name)&&t&&(e.tooltip="Para alterar detalhes é necessário estar com um registro selecionado.",e.disabled=!0),a.push(e)})),this._guides=a,this._guideNavigator&&this._guideNavigator.updateItem(this._guides),i&&(this.selectedGuide=this._guides.length>0?this._guides[0]:void 0)}isDetail(i){return null!=d.getDetailName(i)}updateGuide(i){this._guideBuilders.set(i.id,i);const e=i.buildGuideItem(this._guideBuilders);this._guideNavigator&&this._guideNavigator.updateItem(e).then((()=>{this._guideNavigator.getCurrentPath().then((i=>{this._breadcrumbItems=i}))}))}loadTaskbarProcessor(){var i,e;const s=(null===(i=this.dataState)||void 0===i?void 0:i.isDirty)?"snkGuideViewer.finish_edition":"snkGuideViewer.regular",t=[];this.dataState&&this.dataState.hasPrevious||t.push("PREVIOUS"),this.dataState&&this.dataState.hasNext||t.push("NEXT"),(null===(e=this.dataState)||void 0===e?void 0:e.selectionInfo)&&(this.dataState.selectionInfo.length>1&&t.push("CLONE"),this.dataState.selectionInfo.isAllRecords()&&t.push("REMOVE"));const a=["PREVIOUS","NEXT","DIVIDER","CLONE","REMOVE","MORE_OPTIONS","DIVIDER","GRID_MODE","CONFIGURATOR"];this.presentationMode==u.SECONDARY?a.unshift("INSERT"):a.push("INSERT"),this._taskbarProcessor=new o({"snkGuideViewer.regular":a,"snkGuideViewer.finish_edition":["CANCEL","SAVE"]}),this._taskbarProcessor.process(s,this.taskbarManager,this.dataState,t)}static updateContentCard(i,e,s,t){return t.saveCardState(i,e,s)}static buildFixedForms(i,e,a,r,n,d){const o=null==i?void 0:i.cardsState;if(null!=o)return s(t,null,Array.from(o.entries()).filter((([i,e])=>(null==e?void 0:e.fixed)&&i!=a)).sort((([,i],[,e])=>((null==i?void 0:i.fixSequence)||0)-((null==e?void 0:e.fixSequence)||0))).map((([t,a])=>{var o;const h=e.getSheet(t);if(null!=h)return s("snk-form-view",{levelPath:d,label:h.label,name:t,fields:h.fields,formMetadata:e,dataUnit:r,recordsValidator:n,contracted:"CONTRACTED"===(null==a?void 0:a.presentation),fixed:null==a?void 0:a.fixed,summaryFields:null===(o=null==i?void 0:i.summary)||void 0===o?void 0:o.get(t),key:t})})))}wrapDetail(i,e){if(0===i.length)return e;const t=i.pop(),a=d.getDetailName(t);return a?this.wrapDetail(i,s("snk-data-unit",{dataUnitName:`${this.getDataUnitName(i,a)}`,entityName:a},e)):void 0}getDataUnitName(i,e){if(i.length>0){const s=i.map((i=>d.getDetailName(i)));return`${this.entityPath}/${s.join("/")}/${e}`}return`${this.entityPath}/${e}`}getContent(){var i,e,t,a,r;if(!this.selectedGuide)return;const n=this.selectedGuide.id;let o;const h=n.split("::"),l=h.pop(),g=d.getDetailName(l);let c=n;if(g||h.length>0){let e,t;if(n.includes(v)){[c,e]=n.split(v);const s=(null===(i=this._breadcrumbItems)||void 0===i?void 0:i.length)||0;t=s>1?this._breadcrumbItems[s-2]:this.selectedGuide}else t=this.selectedGuide;o=this.wrapDetail(h,s("snk-detail-view",{ref:i=>this._currentDetail=i,dataUnitName:this.getDataUnitName(h,g),onSnkDetailGuidesChange:i=>this.updateGuide(i.detail),entityName:g,selectedForm:e,branchGuide:t,guideItemPath:this._breadcrumbItems,key:`detail${c}`,onSnkSwitchGuide:i=>this._guideNavigator.selectGuide(i.detail)}))}else{const i=this.selectedGuide.id,d=this._masterFormMetadata.getSheet(i);if(d){const h=null===(t=null===(e=this.masterFormConfig)||void 0===e?void 0:e.cardsState)||void 0===t?void 0:t.get(i);o=s("snk-form-view",{ref:i=>this._mainForm=i,fixed:null==h?void 0:h.fixed,summaryFields:null===(r=null===(a=this.masterFormConfig)||void 0===a?void 0:a.summary)||void 0===r?void 0:r.get(i),name:i,label:d.label,fields:d.fields,dataUnit:this.dataUnit,formMetadata:this._masterFormMetadata,recordsValidator:this.recordsValidator,key:n},this.presentationMode==u.SECONDARY&&this.buildTaskBar())}}return o}onBreadcrumbClickHandler(i){null!=(null==i?void 0:i.id)&&this._guideNavigator.selectGuide(i.id)}updateSelectedGuideHandler(i){this._guideHasChanged=this.selectedGuide!=i,this.selectedGuide=i,this._guideNavigator.getCurrentPath().then((i=>{this._breadcrumbItems=i}))}getConfigViewMode(){return l.GRID}changeConfigViewMode(i){this._currentDetail&&this._currentDetail.changeViewMode(i)}openConfig(i){this._snkConfigurator.close(),this._currentDetail&&(i===l.FORM?this.showFormConfig(!0):this._currentDetail.configGrid())}noGuideSelected(){var i;return void 0===this.selectedGuide||"__main"===(null===(i=this.selectedGuide)||void 0===i?void 0:i.id)}componentWillLoad(){this._configManager=new r(this.configName,(i=>this.masterFormConfig=i)),this._configManager.loadConfig()}componentDidRender(){this._guideHasChanged&&(this._currentDetail?this._currentDetail.showUp():this._mainForm&&this._mainForm.showUp(),this._guideHasChanged=!1)}buildTaskBar(){var i;return s("div",{class:"ez-col ez-flex-item--align-center ez-col--sd-6 ez-col--tb-6 "+(this.presentationMode!=u.SECONDARY?"ez-align--right":"ez-padding-bottom--medium")},s("snk-taskbar",{key:"guideViewerTaskbar","data-element-id":"guideViewer",configName:this.configName,buttons:this._taskbarProcessor.buttons,disabledButtons:this._taskbarProcessor.disabledButtons,customButtons:this._taskbarProcessor.customButtons,actionsList:this.actionsList,messagesBuilder:this.messagesBuilder,presentationMode:this.presentationMode,primaryButton:(null===(i=this.dataState)||void 0===i?void 0:i.isDirty)?"SAVE":"INSERT","data-taskbar-owner":"master",dataUnit:this.dataUnit}))}render(){var i,e;if(null!=this._formEditorConfigManager)return s("snk-form-config",{dataUnit:this._formEditorDataUnit,messagesBuilder:this.messagesBuilder,configManager:this._formEditorConfigManager,onConfigClose:()=>this._formEditorConfigManager=null});if(!this.dataUnit)return;if(!this._configManager.isLoaded)return;this.loadTaskbarProcessor();const t=this._guides&&this._guides.length>1;return s("section",{class:"snk-guides-viewer"},s("div",{class:"ez-row snk-guides-viewer__header"},s("div",{class:"ez-col ez-col--sd-6 ez-col--tb-6 ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large",key:"header"},s("ez-button",{onClick:()=>this.exitViewer(),title:this.getMessage("snkCrud.goBackTitle"),mode:"icon",iconName:"arrow_back",class:"ez-padding-right--medium",size:"small"}),s("div",{class:"ez-flex ez-flex--column ez-flex-item--auto"},s("h1",{class:"ez-title ez-title--primary ez-title--xlarge"},this.getMessage("snkCrud.title")),(null===(i=this._breadcrumbItems)||void 0===i?void 0:i.length)>1&&s("div",{class:"ez-margin-top--extra-small"},s("ez-breadcrumb",Object.assign({items:this._breadcrumbItems,onSelectedItem:i=>this.onBreadcrumbClickHandler(null==i?void 0:i.detail)},{[a.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${a.getInternalIDInfo("breadcrumb")}`}))))),this.presentationMode!=u.SECONDARY&&this.buildTaskBar()),s("div",{class:"snk-guides-viewer__container"},t?s("ez-guide-navigator",{ref:i=>this._guideNavigator=i,class:"snk-guides-viewer__guide-navigator",items:this._guides,selectedId:this.selectedGuide?this.selectedGuide.id:void 0,onEzChange:i=>this.updateSelectedGuideHandler(i.detail)}):s("div",null),s("div",{class:"snk-guides-viewer__detail-container"},g.buildFixedForms(this.masterFormConfig,this._masterFormMetadata,null===(e=this.selectedGuide)||void 0===e?void 0:e.id,this.dataUnit,this.recordsValidator),this.getContent())),s("snk-configurator",{ref:i=>this._snkConfigurator=i,viewMode:this.getConfigViewMode(),onConfigSelected:i=>this.changeConfigViewMode(i.detail),messagesBuilder:this.messagesBuilder,onOpenConfig:i=>this.openConfig(i.detail)}))}static get watchers(){return{dataUnit:["observeDataUnit"],dataState:["observeDataState"],masterFormConfig:["observeMasterFormConfig"]}}};g.style=".sc-snk-guides-viewer-h{--snk-guides-viewer--space-large:var(--space--large, 24px);--snk-guides-viewer--space-medium:var(--space--medium, 12px);--snk-guides-viewer__header--min-height:94px;--snk-guides-viewer__header--z-index:var(--more-visible, 2);--snk-guides-viewer__header--background-color:var(--background--body, #fafcff);--snk-guides-viewer__guide-navigator--width:340px;display:block}snk-form-view.sc-snk-guides-viewer{width:100%}.snk-guides-viewer.sc-snk-guides-viewer{position:relative;padding-left:0px;padding-top:0px;padding-right:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__detail-container.sc-snk-guides-viewer{display:flex;row-gap:24px;flex-direction:column}.snk-guides-viewer__header.sc-snk-guides-viewer{position:sticky;align-items:center;top:0;z-index:var(--snk-guides-viewer__header--z-index);background-color:var(--snk-guides-viewer__header--background-color);min-height:var(--snk-guides-viewer__header--min-height);width:calc(100% + (var(--snk-guides-viewer--space-large) * 2));padding-left:var(--snk-guides-viewer--space-large);padding-right:var(--snk-guides-viewer--space-large);padding-top:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-medium);margin-left:calc(var(--snk-guides-viewer--space-large) * -1);margin-right:calc(var(--snk-guides-viewer--space-large) * -1);margin-bottom:var(--snk-guides-viewer--space-medium)}.snk-guides-viewer__container.sc-snk-guides-viewer{display:grid;grid-template-columns:minmax(0, auto) minmax(0, 100%);height:100%;column-gap:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__guide-navigator.sc-snk-guides-viewer{position:sticky;top:calc(var(--snk-guides-viewer__header--min-height) + var(--snk-guides-viewer--space-medium));height:calc(100vh - var(--snk-guides-viewer__header--min-height) - var(--snk-guides-viewer--space-large) - var(--snk-guides-viewer--space-medium))}.snk-guides-viewer__guide-navigator[open].sc-snk-guides-viewer{width:var(--snk-guides-viewer__guide-navigator--width);max-width:var(--snk-guides-viewer__guide-navigator--width);min-width:var(--snk-guides-viewer__guide-navigator--width)}.snk-guides-viewer__detail-content.sc-snk-guides-viewer{min-height:100%;align-items:flex-start;align-content:flex-start}";export{g as S}
@@ -0,0 +1 @@
1
+ import{h as e}from"./p-b9667fbe.js";import{P as t}from"./p-4c2015a9.js";import{s as a}from"./p-6a02e236.js";var n,r,s;!function(e){e.PREVIOUS="PREVIOUS",e.NEXT="NEXT",e.REFRESH="REFRESH",e.UPDATE="UPDATE",e.CLONE="CLONE",e.REMOVE="REMOVE",e.INSERT="INSERT",e.CANCEL="CANCEL",e.SAVE="SAVE",e.GRID_MODE="GRID_MODE",e.FORM_MODE="FORM_MODE",e.MORE_OPTIONS="MORE_OPTIONS",e.DIVIDER="DIVIDER",e.CONFIGURATOR="CONFIGURATOR",e.DATA_EXPORTER="DATA_EXPORTER",e.ATTACH="ATTACH"}(n||(n={})),function(e){e.UPDATE="UPDATE",e.CLONE="CLONE",e.REMOVE="REMOVE",e.INSERT="INSERT",e.CONFIGURATOR="CONFIGURATOR"}(r||(r={})),function(e){e.CONFIGURATOR="CONFIGURATOR"}(s||(s={}));const i=(e,t,a,n,r)=>{const{hint:s,text:i,iconName:c}=e;return c?i?u(c,e.name,t,a,s,i,n,r):l(c,e.name,t,a,s,n,r):o(e.name,t,a,i,s,n,r)},c=(r,s,i,c,d,m,E,R,O)=>{var v;const b=c(r);switch(r){case n.PREVIOUS:return l("chevron-left",r,s,i,b,d,m);case n.NEXT:return l("chevron-right",r,s,i,b,d,m);case n.REFRESH:return l("sync",r,s,i,b,d,m);case n.UPDATE:return l("edit",r,s,i,b,d,m);case n.CLONE:return l("copy",r,s,i,b,d,m);case n.REMOVE:return l("delete",r,s,i,b,d,m);case n.INSERT:return O===t.PRIMARY?u("plus",r,s,i,b,b,d,m):l("plus",r,s,i,b,d,m);case n.CANCEL:return o(r,s,i,b,b,d,m);case n.SAVE:return O===t.PRIMARY?u("save",r,s,i,b,b,d,m):l("save",r,s,i,b,d,m);case n.GRID_MODE:return l("table",r,s,i,b,d,m);case n.FORM_MODE:return l("list",r,s,i,b,d,m);case n.CONFIGURATOR:return l("settings-inverted",r,s,i,b,d,m);case n.MORE_OPTIONS:return function(t,a,n,r,s,i,c){return c&&c.length>0?e("ez-actions-button",{title:r,size:"small","data-element-id":n,arrowActive:!0,class:a,enabled:i(t),onEzAction:e=>s(e.detail.value),actions:c}):void 0}(r,s,i,b,d,m,E);case n.DIVIDER:return e("hr",{class:"ez-divider-vertical ez-divider--dark ez-margin-horizontal--medium","data-taskbar-divider":!0});case n.DATA_EXPORTER:const c=null===(v=a.get("exporterProviders"))||void 0===v?void 0:v[R];return e("snk-data-exporter",{class:s,provider:c,"data-element-id":i});case n.ATTACH:return l("anexo",r,s,i,b,d,m)}};function o(t,a,n,r,s,i,c){return e("ez-button",{title:s,label:r,size:"small",class:a,"data-element-id":n,enabled:c(t),onClick:()=>i(t)})}function l(t,a,n,r,s,i,c){return e("ez-button",{title:s,mode:"icon",size:"small",class:n,"data-element-id":r,iconName:t,enabled:c(a),onClick:()=>i(a)})}function u(t,a,n,r,s,i,c,o){return e("ez-button",{title:i,label:s,size:"small",class:n,"data-element-id":r,enabled:o(a),onClick:()=>c(a)},e("ez-icon",{class:"ez-padding-right--small",slot:"leftIcon",iconName:t}))}export{r as A,n as T,s as V,i as a,c as b}
@@ -0,0 +1 @@
1
+ var T;!function(T){T.QUICK_FILTER="QUICK_FILTER",T.CUSTOM_FILTER="CUSTOM_FILTER",T.OTHER_FILTERS="OTHER_FILTERS"}(T||(T={}));const E=T;export{E as F}
@@ -0,0 +1 @@
1
+ import{r as i,c as t,h as s,g as e}from"./p-b9667fbe.js";import{VersionUtils as d,ElementIDUtils as r,ApplicationContext as a,DataType as n}from"@sankhyalabs/core";import{UserInterface as o}from"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import{T as l}from"./p-d410f45a.js";import{C as h}from"./p-52ed2a18.js";import{P as u}from"./p-4c2015a9.js";import{T as c}from"./p-c2beb95c.js";import{s as v}from"./p-6a02e236.js";import"./p-0d81236c.js";import"./p-41d92871.js";import"./p-112455b1.js";const g=class{constructor(s){i(this,s),this.actionClick=t(this,"actionClick",7),this.gridDoubleClick=t(this,"gridDoubleClick",7),this._topTaskbarProcessor=new c({"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 c({"snkGridHeaderTaskbar.unselected":["REFRESH","DATA_EXPORTER"],"snkGridHeaderTaskbar.selected":["UPDATE","CLONE","REMOVE","MORE_OPTIONS","DIVIDER",this.getAttachAvailable(),"REFRESH","DATA_EXPORTER"],"snkGridHeaderTaskbar.detail.unselected":["REFRESH"],"snkGridHeaderTaskbar.detail.selected":["UPDATE","CLONE","REMOVE","MORE_OPTIONS","DIVIDER","REFRESH"]}),this._dataUnit=void 0,this._dataState=void 0,this._gridConfig=void 0,this._popUpGridConfig=!1,this.configName=void 0,this.actionsList=void 0,this.isDetail=void 0,this.taskbarManager=void 0,this.statusResolver=void 0,this.multipleSelection=void 0,this.presentationMode=u.PRIMARY,this.messagesBuilder=void 0}async showConfig(){null!=this._grid&&this.openGridConfig()}async hideConfig(){null!=this._grid&&this.closeGridConfig()}async setConfig(i){this.setGridConfig(i)}getAttachAvailable(){var i;return d.isRequiredVersion(null===(i=window.envContext)||void 0===i?void 0:i.sysVersion,"4.22")?l.ATTACH:""}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.get().then((i=>{i.loadGridConfig(this.configName).then((i=>{this.setGridConfig(i)})).catch((i=>{console.warn(i)}))}))}gridConfigChangeHandler(i){h.saveGridConfig(i.detail,this.configName),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,t){return null==t||t.forEach((t=>{var s,e;if(t.hidden&&"RECDESP"!==t.name)return;const d=null===(s=this._dataUnit)||void 0===s?void 0:s.getField(t.name);if(i.push({label:t.label,id:t.name,width:t.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 t=d.properties.mergedFrom;i.push({label:d.properties.DESCRIPTIONENTITY,id:`${t?t+".":""}${d.properties.ENTITYNAME}.${d.properties.DESCRIPTIONFIELD}`,width:200,type:n.TEXT,userInterface:o.LONGTEXT})}})),i||[]}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,t;const s=[],e=await(null===(i=this._snkDataUnit)||void 0===i?void 0:i.getSelectedRecordsIDsInfo());await(null===(t=this._grid)||void 0===t?void 0:t.getColumnsState().then(this.buildColumnsMetadata.bind(this,s)));const d={getFilters:()=>{var i;return null===(i=this._dataUnit)||void 0===i?void 0:i.getAppliedFilters()},getColumnsMetadata:()=>s,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:()=>e||[],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__}};v.set("exporterProviders",Object.assign(Object.assign({},v.get("exporterProviders")),{[this.configName]:d}))}addElementID(){r.addIDInfo(this._element,null,{dataUnit:this._dataUnit})}componentWillLoad(){this._application=a.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.addElementID():this._snkDataUnit.addEventListener("dataUnitReady",(i=>{this._dataUnit=i.detail,this.addElementID()})),this._snkDataUnit.addEventListener("dataStateChange",(i=>{this._dataState=i.detail}));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(l.CLONE,"ATTACH"),this._dataState.selectionInfo.isAllRecords()&&t.push("REMOVE")),t}componentWillRender(){var i;const t=this._dataUnit&&this._dataUnit.records.length>0?[]:["DATA_EXPORTER"];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===u.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===u.PRIMARY?"INSERT":""}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}),(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()})),s("ez-grid",{ref:i=>this._grid=i,class:(this.presentationMode===u.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},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})),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(r.DATA_ELEMENT_ID_ATTRIBUTE_NAME),application:this._application,selectedIndex:0,configName:this.configName,onConfigChange:i=>this.modalConfigChangeHandler(i),onConfigCancel:()=>this.closeGridConfig()})))}get _element(){return e(this)}};g.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{g as snk_grid}
@@ -0,0 +1 @@
1
+ import{r as t,c as s,h as i,g as e}from"./p-b9667fbe.js";import{ElementIDUtils as r}from"@sankhyalabs/core";import{F as h}from"./p-584d7212.js";const o=class{constructor(i){t(this,i),this.valueChanged=s(this,"valueChanged",7),this.config=void 0,this.value=void 0}ezChangeListener(t){this.value=t.detail,this.valueChanged.emit(this.value)}async show(){this._numberElement.setFocus()}componentDidLoad(){this._element&&r.addIDInfo(this._element,"filterContentEditor")}render(){var t;if(this.config&&this.config.type===h.NUMBER)return i("ez-number-input",{id:this.config.id,ref:t=>this._numberElement=t,label:this.config.label,value:this.config.value,precision:null===(t=this.config.props)||void 0===t?void 0:t.precision})}get _element(){return e(this)}};export{o as snk_filter_number}
@@ -0,0 +1 @@
1
+ import{h as e,r as i,c as t,g as s}from"./p-b9667fbe.js";import{S as l}from"./p-f4184ce7.js";import{UserInterface as a,JSUtils as n,ElementIDUtils as r,ApplicationContext as o,StringUtils as h,DataType as c}from"@sankhyalabs/core";import{ModalAction as d}from"@sankhyalabs/ezui/dist/collection/components/ez-modal-container";import{c as u,d as f,e as p,F as m}from"./p-4c2015a9.js";const v={[a.SHORTTEXT]:"text",[a.LONGTEXT]:"text",[a.INTEGERNUMBER]:"number",[a.DECIMALNUMBER]:"number",[a.DATE]:"calendar",[a.DATETIME]:"calendar",[a.SWITCH]:"boolean",[a.CHECKBOX]:"check-circle-inverted",[a.OPTIONSELECTOR]:"list",[a.SEARCH]:"search",[a.HTML]:"tag_code",[a.IMAGE]:"png",[a.FILE]:"edit-file",[a.TIME]:"timer-outline",[a.ELAPSEDTIME]:"timer",[a.MASKEDTEXT]:"text",[a.PASSWORD]:"email"},b=({userInterface:i,description:t})=>e("ez-icon",{iconName:v[i],className:"ez-padding-left--small",title:t}),g="__SNK__APPLICATION__",k=class{constructor(e){i(this,e),this.ezSelectFilterItem=t(this,"ezSelectFilterItem",7),this._filterMetadataStorage=new Map,this._currentMetadata=null,this._filterText="",this._isLoading=!1,this.searchable=!0,this.fieldsDataSource=void 0,this.breadcrumbItems=[],this.linkItems=[],this.fieldItems=[]}async show(){var e;return null===(e=this._ezPopover)||void 0===e||e.show(),this.loadData()}async applyFilter(e){if(this.searchable)throw new Error("This method is not available when searchable is true");this.handleFilterChange(e)}async loadData(){let e;this._isLoading=!0,null!=this._currentLink&&(e=this._filterMetadataStorage.get(this._currentLink.uri)),e||(e=await this.fieldsDataSource.fetchData(this._currentLink),this._currentLink=e.currentLink,this._filterMetadataStorage.set(this._currentLink.uri,e));const{fields:i,links:t}=e||{};if(!Array.isArray(i)||!Array.isArray(t))throw new Error("Invalid metadata");this._currentMetadata=e,this.mapDataSourceToLinkItems(),this.mapDataSourceToFieldItems(),this._isLoading=!1,this._ezFieldList.scrollToTop(),this._ezLinkList.scrollToTop()}mapDataSourceToLinkItems(){var e;const{links:i}=this._currentMetadata,t=this.getMessage("snkFilterFieldSearch.linkLabel",{link:null===(e=this._currentLink)||void 0===e?void 0:e.description}),s=i.map((e=>Object.assign({label:e.description},e)));this.linkItems=[{group:t,items:s}],0===this.breadcrumbItems.length&&(this.breadcrumbItems=[Object.assign({id:n.generateUUID(),label:this._currentLink.description},this._currentLink)])}mapDataSourceToFieldItems(){var e;const{fields:i}=this._currentMetadata,t=this.getMessage("snkFilterFieldSearch.fieldLabel",{link:null===(e=this._currentLink)||void 0===e?void 0:e.description}),s=i.filter((e=>{if(!this._currentLink)return!0;const i=e.description.toLowerCase().includes(this._filterText.toLowerCase()),t=e.name.toLowerCase().includes(this._filterText.toLowerCase());return i||t})).map((e=>Object.assign({label:e.description},e)));this.fieldItems=[{group:t,items:s}]}handleFilterChange(e){this._isLoading||(this._filterText=e,this.mapDataSourceToFieldItems())}handleSelectLink({detail:e}){if(this._isLoading)return;const i=this.breadcrumbItems.findIndex((i=>i.id===e.id));e.cache=this._filterMetadataStorage.has(e.uri),this.breadcrumbItems=i>-1?this.breadcrumbItems.slice(0,i+1):[...this.breadcrumbItems,Object.assign({id:n.generateUUID(),label:e.description},e)];const t=Object.assign(Object.assign({},e),{type:l.LINK});this._currentLink=t,this.ezSelectFilterItem.emit(t),this.loadData()}handleSelectField({detail:e}){var i;const t=this.breadcrumbItems.map((e=>e.label)).join(">>"),s=Object.assign(Object.assign({},e),{type:l.FIELD,path:`${t} >> ${e.description}`});this.ezSelectFilterItem.emit(s),null===(i=this._ezPopover)||void 0===i||i.hide()}getElementID(e){return{[r.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:r.getInternalIDInfo(e)}}getMessage(e,i){var t,s,l;return this._application||(this._application=o.getContextValue(g)),null===(l=null===(s=null===(t=this._application)||void 0===t?void 0:t.messagesBuilder)||void 0===s?void 0:s.getMessage)||void 0===l?void 0:l.call(s,e,i)}componentWillLoad(){this._application=o.getContextValue(g)}componentDidLoad(){r.addIDInfoIfNotExists(this._ezPopover,"popover")}disconnectedCallback(){var e;this._filterMetadataStorage.clear(),null===(e=this._ezPopover)||void 0===e||e.hide()}render(){var i;const t=this.getMessage("snkFilterFieldSearch.searchLabel");return e("ez-popover",Object.assign({ref:e=>this._ezPopover=e,role:"dialog",overlayType:"none","aria-hidden":!(null===(i=this._ezPopover)||void 0===i?void 0:i.opened)},this.getElementID("EzPopover")),e("div",{class:"snk-filter-field-search__container"},e("header",{class:"snk-filter-field-search__header"},this.searchable&&!!t&&e("ez-filter-input",Object.assign({class:"snk-filter-field-search__input",label:t,asyncSearch:!0,canShowError:!1,onEzSearching:e=>this.handleFilterChange.bind(this)(e.detail),"aria-label":t,"aria-required":"false","aria-invalid":"false"},this.getElementID("EzFilterInput"))),this.breadcrumbItems.length>0&&e("ez-breadcrumb",Object.assign({items:this.breadcrumbItems,onSelectedItem:this.handleSelectLink.bind(this),role:"navigation","aria-current":"step"},this.getElementID("EzBreadcrumb"))),e("hr",{class:"ez-divider-horizontal ez-margin-vertical--medium"})),e("section",{class:"snk-filter-field-search__section"},e("ez-list",Object.assign({ref:e=>this._ezLinkList=e,class:"snk-filter-field-search__list",id:"filterLinkList",useGroups:!0,dataSource:this.linkItems,onEzSelectItem:this.handleSelectLink.bind(this),hoverFeedback:!0,ezSelectable:!0,itemSlotBuilder:({fieldCount:i})=>e("ez-badge",{label:i}),"aria-describedby":"filterLinkLabel"},this.getElementID("EzListLinks"))),e("ez-list",Object.assign({ref:e=>this._ezFieldList=e,class:"snk-filter-field-search__list",id:"filterFieldList",useGroups:!0,dataSource:this.fieldItems,onEzSelectItem:this.handleSelectField.bind(this),hoverFeedback:!0,ezSelectable:!0,itemSlotBuilder:b,"aria-describedby":"filterFieldLabel"},this.getElementID("EzListFields"))))))}};k.style=".sc-snk-filter-field-search-h{--snk-filter-field-search--container-width:468px;--snk-filter-field-search--container-height:322px}.snk-filter-field-search__container.sc-snk-filter-field-search{display:flex;flex-direction:column;padding:var(--space--medium);width:var(--snk-filter-field-search--container-width);height:var(--snk-filter-field-search--container-height)}.snk-filter-field-search__section.sc-snk-filter-field-search{display:grid;grid-template-columns:1fr 1fr;place-items:flex-start;overflow:hidden;gap:var(--space--small)}.snk-filter-field-search__input.sc-snk-filter-field-search{margin-bottom:var(--space--medium)}.snk-filter-field-search__list_container.sc-snk-filter-field-search{display:flex;flex-direction:column}.snk-filter-field-search__list.sc-snk-filter-field-search{overflow-y:auto}";class z{static buildFilterExpression(e){if(null==e)return;const i=this.buildVariableParameterValue(e);let t=e.expression||"";switch(e.operand){case u.IN:t+=` ${e.operand} (${i})`;break;case u.NULL:case u.NOT_NULL:t+=` IS ${i}`;break;case u.LIKE:t+=` LIKE '%${i}%'`;break;case u.START_WITH:t+=` LIKE '${i}%'`;break;case u.FINISHED_WITH:t+=` LIKE '%${i}'`;break;default:t+=` ${e.operand} ${i}`}return t}static buildVariableParameterValue(e){if(null!=e){if(null!=e.systemConfig){const i=e.systemConfig;return`?:{entidade=${i.entity||""};campo=${i.fieldName||""}}`}if(null!=e.userConfig){const i=e.userConfig;return`?:{desc=${i.description||""};tipo=${i.type||""}}`}return`?:{entidade=${e.entityName||""};campo=${e.fieldName||""}}`}}}const C=class{constructor(e){i(this,e),this._opened=!1,this._configType=f.SYSTEM_CONFIG,this._expressionItem=void 0,this._informedInstance=!1,this._canSave=!1,this.messagesBuilder=void 0}open(e){return this._opened=!0,this._expressionItem=e,this.loadValues(),new Promise((e=>{this._promiseResolver=e}))}close(){return this._opened=!1,new Promise((e=>{this._promiseResolver=e}))}getMessage(e,i){var t;return null===(t=this.messagesBuilder)||void 0===t?void 0:t.getMessage(e,i)}getConfigValue(e,i,t=""){var s,l,a;return(null===(l=null===(s=this._expressionItem)||void 0===s?void 0:s[e])||void 0===l?void 0:l[i])||(null===(a=this._expressionItem)||void 0===a?void 0:a[t||i])}loadValues(){var e;const i=this.getConfigValue("systemConfig","entity","entityName"),t=this.getConfigValue("systemConfig","fieldName"),s=this.getConfigValue("userConfig","description"),l=this.getConfigValue("userConfig","type");this._configType=null!=(null===(e=this._expressionItem)||void 0===e?void 0:e.userConfig)?f.USER_CONFIG:f.SYSTEM_CONFIG,h.isEmpty(i)||h.isEmpty(t)||(this._instanceElement.value={value:i,label:""},this._fieldElement.value={value:t,label:""}),h.isEmpty(s)||h.isEmpty(l)||(this._descriptionElement.value=s,this._typeElement.value=l),this.buildFilterExpression()}changeDefinitionUsed(e){if(this._configType=null!=e?e:f.SYSTEM_CONFIG,this._configType===f.SYSTEM_CONFIG){const e=this.getConfigValue("systemConfig","entity","entityName"),i=this.getConfigValue("systemConfig","fieldName");this._instanceElement.value=this._instanceElement.value||{value:e,label:""},this._fieldElement.value=this._fieldElement.value||{value:i,label:""}}else if(this._configType===f.USER_CONFIG){const e=this.getConfigValue("userConfig","description"),i=this.getConfigValue("userConfig","type");this._descriptionElement.value=this._descriptionElement.value||e,this._typeElement.value=this._typeElement.value||i}this.buildFilterExpression()}getTypeValue(){var e;const i=null===(e=this._typeElement)||void 0===e?void 0:e.value;return(null==i?void 0:i.value)||i}getExpressionValues(){var e,i,t,s,l;let a,n;return this._configType===f.SYSTEM_CONFIG?a={entity:null===(i=null===(e=this._instanceElement)||void 0===e?void 0:e.value)||void 0===i?void 0:i.value,fieldName:null===(s=null===(t=this._fieldElement)||void 0===t?void 0:t.value)||void 0===s?void 0:s.value}:this._configType===f.USER_CONFIG&&(n={description:null===(l=this._descriptionElement)||void 0===l?void 0:l.value,type:this.getTypeValue()}),Object.assign(Object.assign(Object.assign({},this._expressionItem),{systemConfig:a}),{userConfig:n})}isEnabled(e){return this._configType===e}isInformedInstance(){var e,i;return!h.isEmpty(null===(i=null===(e=this._instanceElement)||void 0===e?void 0:e.value)||void 0===i?void 0:i.value)}save(){var e;this._expressionItem=Object.assign(Object.assign({},this.getExpressionValues()),{expression:null===(e=this._expressionElement)||void 0===e?void 0:e.value}),this._promiseResolver(this._expressionItem),this._opened=!1}buildFilterExpression(){var e;this._informedInstance=this.isInformedInstance();const i=z.buildFilterExpression(this.getExpressionValues());this._expressionElement.value=i||(null===(e=this._expressionItem)||void 0===e?void 0:e.expression),this._canSave=this.getCanSave()}handleChangeInstance(){this._informedInstance=this.isInformedInstance(),null==this._fieldElement||h.isEmpty(this._fieldElement.value)||(this._fieldElement.value=null),this.buildFilterExpression()}getInstanceCriteria(){var e,i;const t=null===(i=null===(e=this._instanceElement)||void 0===e?void 0:e.value)||void 0===i?void 0:i.value;return{expression:"this.NOMETAB = (SELECT NOMETAB FROM TDDINS WHERE NOMEINSTANCIA = ?)",params:[{name:"NOMEINSTANCIA",dataType:c.TEXT,value:t}]}}onSearch({mode:e,argument:i},t){if(null==this._application)return;const s=t===p.FIELD,l=s?this.getInstanceCriteria():void 0,a=this.getMessage("snkFilterParamConfig.label"+(s?"Field":"Instance"));return this._application.executePreparedSearch(e,i,{entity:t,entityDescription:a,criteria:l,searchOptions:{descriptionFieldName:s?"DESCRCAMPO":"DESCRINSTANCIA",codeFieldName:s?"NOMECAMPO":"NOMEINSTANCIA",showInactives:!1}})}getElementID(e){return{[r.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:r.getInternalIDInfo(e)}}getCanSave(){var e;if(this._configType===f.USER_CONFIG){const i=null===(e=this._descriptionElement)||void 0===e?void 0:e.value,t=this.getTypeValue();return!h.isEmpty(i)&&!h.isEmpty(t)}return!0}componentWillLoad(){this._application=o.getContextValue("__SNK__APPLICATION__")}render(){return r.addIDInfoIfNotExists(this._element,"snkFilterParamConfig"),e("ez-popup",Object.assign({useHeader:!1,size:"small",heightMode:"auto",opened:this._opened},this.getElementID("popup")),e("ez-modal-container",Object.assign({onEzModalAction:e=>{e.detail===d.CLOSE&&this.close()},modalTitle:this.getMessage("snkFilterParamConfig.modalTitle")},this.getElementID("modalContainer")),e("div",{class:"ez-flex"},e("div",{class:"ez-col ez-col--sd-6 ez-flex--column"},e("ez-radio-button",Object.assign({value:this._configType,onEzChange:e=>this.changeDefinitionUsed(e.detail)},this.getElementID("systemConfigOption")),e("ez-radio-button-option",{label:this.getMessage("snkFilterParamConfig.labelSystemConfig"),value:f.SYSTEM_CONFIG})),e("ez-search",Object.assign({ref:e=>this._instanceElement=e,label:this.getMessage("snkFilterParamConfig.labelInstance"),enabled:this.isEnabled(f.SYSTEM_CONFIG),suppressEmptyOption:!0,showOptionValue:!1,showSelectedValue:!1,onEzChange:()=>this.handleChangeInstance(),optionLoader:e=>this.onSearch(e,p.INSTANCE)},this.getElementID("configFindEntity"))),e("ez-search",Object.assign({ref:e=>this._fieldElement=e,label:this.getMessage("snkFilterParamConfig.labelField"),enabled:this.isEnabled(f.SYSTEM_CONFIG)&&this._informedInstance,suppressEmptyOption:!0,showOptionValue:!1,showSelectedValue:!1,onEzChange:()=>this.buildFilterExpression(),optionLoader:e=>this.onSearch(e,p.FIELD)},this.getElementID("configFindField")))),e("div",{class:"ez-flex ez-padding--medium"},e("hr",{class:"ez-divider-vertical"})),e("div",{class:"ez-col ez-col--sd-6 ez-flex--column"},e("ez-radio-button",Object.assign({value:this._configType,onEzChange:e=>this.changeDefinitionUsed(e.detail)},this.getElementID("userConfigOption")),e("ez-radio-button-option",{label:this.getMessage("snkFilterParamConfig.labelUserConfig"),value:f.USER_CONFIG})),e("ez-text-input",Object.assign({ref:e=>this._descriptionElement=e,label:this.getMessage("snkFilterParamConfig.labelDescription"),enabled:this.isEnabled(f.USER_CONFIG),onEzChange:()=>this.buildFilterExpression()},this.getElementID("configParamLabel"))),e("ez-combo-box",Object.assign({ref:e=>this._typeElement=e,label:this.getMessage("snkFilterParamConfig.labelType"),enabled:this.isEnabled(f.USER_CONFIG),suppressEmptyOption:!0,onEzChange:()=>this.buildFilterExpression()},this.getElementID("configParamType")),Object.keys(m).map((i=>e("option",{value:m[i]},this.getMessage(`snkFilterParamConfig.labelTypeValues.${i.toLowerCase()}`))))))),e("ez-text-area",Object.assign({ref:e=>this._expressionElement=e,class:"snk-filter-param-config__expression",label:this.getMessage("snkFilterParamConfig.labelExpression"),enabled:!1},this.getElementID("presentationExpression"))),e("div",{class:"ez-col ez-col--sd-12 ez-flex--justify-end ez-margin-vertical--small"},e("ez-button",Object.assign({class:"ez-padding-right--medium",label:this.getMessage("snkFilterParamConfig.labelCancel"),onClick:()=>this.close()},this.getElementID("cancelEditParam"))),e("ez-button",Object.assign({class:"ez-button--primary",label:this.getMessage("snkFilterParamConfig.labelSave"),onClick:()=>this.save(),enabled:this._canSave},this.getElementID("saveEditParam"))))))}get _element(){return s(this)}};C.style=":host{--snk-filter-param-config__expression--color:var(--title--primary, #2b3a54);display:flex;position:relative}.snk-filter-param-config__expression{--text-area__input--disabled--color:var(--snk-filter-param-config__expression--color)}";export{k as snk_filter_field_search,C as snk_filter_param_config}
@@ -0,0 +1 @@
1
+ export{S as snk_data_unit}from"./p-3db1d3de.js";import"./p-b9667fbe.js";import"@sankhyalabs/core";import"@sankhyalabs/ezui/dist/collection/utils";import"./p-f5f36fbb.js";
@@ -0,0 +1 @@
1
+ import{r as t,c as e,h as s,H as i,g as r}from"./p-b9667fbe.js";import{ElementIDUtils as a}from"@sankhyalabs/core";import{F as n}from"./p-584d7212.js";import{F as l}from"./p-d9804798.js";import{E as o}from"./p-1a68fb59.js";const c=class{constructor(s){t(this,s),this.filterChange=e(this,"filterChange",7),this.filterItem=void 0}observeFilterItem(t){this.filterChange.emit(t)}getContentEditorConfig(){const t={presentationMode:o.MODAL};switch(this.filterItem.type){case n.BINARY_SELECT:return{tag:"snk-filter-binary-select",variations:t};case n.MULTI_SELECT:return{tag:"snk-filter-multi-select"};case n.PERIOD:return{tag:"snk-filter-period",variations:t};case n.SEARCH:return{tag:"snk-filter-search"};case n.NUMBER:return{tag:"snk-filter-number"};case n.PERSONALIZED:return{tag:"snk-filter-personalized"};case n.MULTI_LIST:return{tag:"snk-entity-list"}}return{tag:"snk-filter-text"}}updateFilterValue(t){this.filterItem=Object.assign(Object.assign({},this.filterItem),{value:t})}canShowDetailModal(){return this.filterItem.filterType!==l.OTHER_FILTERS&&this.filterItem.type!==n.BINARY_SELECT}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}`}}render(){const{tag:t,variations:e}=this.getContentEditorConfig();return s(i,null,s("div",{class:"ez-flex ez-flex--column grow"},this.canShowDetailModal()&&s("div",{class:"col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center"},s("div",{class:"ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header"},this.filterItem.detailModal)),s(t,Object.assign({config:this.filterItem,value:this.filterItem.value,onValueChanged:t=>this.updateFilterValue(t.detail),"data-element-id":this._idContentEditor},e))))}get _element(){return r(this)}static get watchers(){return{filterItem:["observeFilterItem"]}}};c.style=".grow{flex-grow:1}";export{c as snk_filter_modal_item}
@@ -0,0 +1 @@
1
+ var a;!function(a){a.LINK="LINK",a.FIELD="FIELD"}(a||(a={}));export{a as S}
@@ -0,0 +1 @@
1
+ const e={saveInfo:{clone:"Duplicação realizada!",insert:"Inclusão realizada!",update:"Alteração realizada!"},cancelInfo:{clone:"Duplicação descartada!",insert:"A inclusão descartada!",update:"A edição foi descartada!"},confirm:{cancel:"Cancelar",delete:"Excluir",yes:"Sim",no:"Não"},removeInfo:"Registro removido com sucesso!",cancelConfirmationTitle:"Aviso",cancelConfirmation:"As alterações realizadas serão descartadas<br/><br/><b>Você realmente gostaria de cancelar?",removeConfirmationTitle:"Aviso",removeConfirmation:"Deseja realmente excluir o registro atual?",forbidden:"Sem permissão",forbiddenUpdate:"Não é possível fazer alterações. Verifique as permissões de acesso.",forbiddenInsert:"Não é possível incluir. Verifique as permissões de acesso.",forbiddenClone:"Não é possível duplicar. Verifique as permissões de acesso.",forbiddenRemove:"Não é possível remover. Verifique as permissões de acesso.",removeAllConfirmation:"Os <strong>{{size}} registros selecionados</strong> serão excluídos.<br/><br/><strong>Você realmente gostaria de continuar?</strong>",removeAllInfo:"Os {{size}} registros foram removidos com sucesso!"},a={addFilter:"Adicionar filtro",pinFilter:"Fixar filtro",unpinFilter:"Desfixar filtro",removeFilter:"Remover filtro",cleanFilter:"Limpar",applyFilter:"Aplicar",findFilter:"Buscar filtros...",findField:"Buscar filtros...",modalFindFilter:"Buscar filtro",emptyFiltersList:"Não há filtros disponíveis",emptyAppliedFiltersList:"Não há filtros aplicados",customFilter:"Filtro personalizado",defaultFilter:"Filtro padrão",failToLoadConfig:"Falha ao buscar configuração de filtros",clearAllFilters:"Limpar todos os filtros",successfullyCleaned:"Filtro limpo com sucesso!",activeFilter:"{{ACTIVE_FILTERS}} filtro aplicado",activeFilters:"{{ACTIVE_FILTERS}} filtros aplicados",noActiveFilters:"Nenhum filtro aplicado",modalDefaultFilterTitle:"Filtro padrão",modalInfoTextEditDefault:"Use o layout antigo para editar o seu filtro padrão, em breve traremos uma nova experiência.",modalInfoTextCreateDefault:"Use o layout antigo para criar o seu filtro padrão, em breve traremos uma nova experiência.",modalPersonalizedFilterTitle:"Filtro personalizado",modalPersonalizedFilterSubTitle:"Gerencie seus filtros",modalInfoTextCreateEditPersonalized:"Use o layout antigo para criar ou editar filtros, em breve traremos uma nova experiência",modalOkButtonLabel:"Aplicar",modalCancelButtonLabel:"Limpar",filters:"Filtros",filterModal:{title:"Filtros",okButtonLabel:"Aplicar",cancelButtonLabel:"Limpar tudo",customFilters:"Filtros personalizados",quickFilters:"Filtros rápidos"}},r={titleUpdate:"Editar",titlePrevious:"Anterior",titleNext:"Próximo",titleRefresh:"Atualizar",titleClone:"Duplicar",titleRemove:"Excluir",titleMoreOptions:"Mais Opções",titleInsert:"Cadastrar",titleCancel:"Cancelar",titleSave:"Salvar",titleGridMode:"Modo Grade",titleFormMode:"Modo Formulário",titleConfigurator:"Configurações",titleAttach:"Anexar",forbidden:"Permissão não liberada"},o={errorArray:"CrudUtils.find deve receber um array de fields, ou uma lista separada por virgula."},i={emailSenderTitle:"Enviar por email",emailSenderBackButton:"Voltar",emailSenderNextButton:"Avançar",emailSenderCancelButton:"Cancelar",emailSenderSendButton:"Enviar",emailSenderOptStep_subtitle:"Primeiro, escolha o formato do arquivo",emailSenderOptStep_lblFormat:"Formato:",emailSenderOptStep_formatPDF:"PDF (.pdf)",emailSenderOptStep_formatXLSX:"Planilha (.xlsx)",emailSenderOptStep_export:"Exportar:",emailSenderOptStep_allData:"Toda a grade",emailSenderOptStep_currentPage:"Somente a página atual",emailSenderOptStep_someRecords:"{{SELECTION_COUNT}} linhas selecionadas",emailSenderOptStep_oneRecord:"Somente a linha selecionada",emailSenderInfoStep_subtitle:"Informações de email",emailSenderInfoStep_sendTo:"Enviar para",emailSenderInfoStep_subject:"Assunto",emailSenderInfoStep_message:"Mensagem"},l={title:{clone:"Duplicar registro",insert:"Cadastrar registro",update:"Alterar registro",clean:"{{ENTITY_NAME}}"},goBackTitle:"Voltar"},s={error:{title:"Erro na Exportação",message:"O usuário não possui permissão para exportar o arquivo."},message:{exportSuccess:"Exportado com sucesso!"}},t={label:{nameField:"Nome do Campo *",typeValueDefault:"Tipo de valor padrão *",valueDefault:"Valor Padrão",clearDuplicate:"Limpar ao Duplicar",requiredField:"Campo Obrigatório",protectedField:"Campo Protegido"},options:{valueFixed:"Valor Fixo",variable:"Variável"}},n={title:"Configuração do formulário",goBackTitle:"Voltar",applyConfig:"Aplicar configuração",availableFields:{title:"Campos disponíveis",labelNoFields:"Nenhum campo disponível",labelOneField:"1 campo disponível",labelAvailableFields:"Campos disponíveis",labelSearchField:"Procurar campo"},form:{subTitleInfo:"Inclua estes campos nos grupos ou deixe-os separados no topo do formulário!",labelDropField:"Arraste e solte um campo aqui",labelNewGroup:"Adicionar novo grupo",mainArea:"Área principal",tabGeneral:"Geral"},confirm:{title:"Aviso",deleteTab:"Você realmente deseja excluir a aba",cancel:"As alterações realizadas serão descartadas.<br/><br/><b>Gostaria de continuar?</b>",exit:"Ao sair as alterações serão descartadas.<br/><br/><b>Você realmente gostaria de sair?</b>",apply:"A <b>{0}</b> irá substituir a sua configuração {1}!<br/><br/><b>Deseja continuar?</b>",group:"Não é possível salvar as configurações com um grupo vazio!",labelCancel:"Cancelar",labelDelete:"Excluir"},alert:{titleGroupExists:"Já existe um grupo com título",infoValidTitle:"Por favor, digite um título válido.",inTab:"na aba"},info:{successfullyConfigSaved:"As configurações foram salvas com sucesso!"}},d={titleRemove:"Remover",titleConfigurations:"Configurações",titleAdd:"Adicionar"},c={labelRename:"Renomear",labelHide:"Ocultar",labelShow:"Exibir",labelDelete:"Excluir"},u={titleConfigurations:"Configurações",subTitleModeConfig:"Modo de visualização",labelConfigGrid:"Configurar grade",labelConfigForm:"Configurar formulário",labelGrid:"Grade",labelForm:"Formulário"},m={},p={gridConfiguration:"Configuração da Grade",columnVisibilityOrder:"Defina visibilidade e ordem das colunas.",sortingSequence:"Sequência da ordenação",findColumn:"Localizar coluna",cancel:"Cancelar",complete:"Concluir",tab:{columns:"Colunas",lineOrdering:"Ordenação das linhas"},info:{successfullyConfigSaved:"As configurações foram salvas com sucesso!"},confirm:{cancel:"Descartar",save:"Salvar",alert:"Aviso",msgCancel:"As alterações realizadas serão descartadas. Gostaria de salvar antes de sair?"},group:{visible:"Visíveis",hidden:"Ocultas"}},f={group:{export:{default:"Exportar para",multiSelected:"Exportar {0} linhas selecionadas",selectedLine:"Exportar somente 1 linha selecionada",title:"Exportar"},custom:"Personalizado"},label:{currentPage:"Somente a página atual",spreadsheet:"Planilha",cube:"Cubo",sendByEmail:"Enviar por email"},message:{emailSuccess:"E-mail enviado com sucesso",exportError:"Usuário sem permissão",exportPermission:"O usuário não possui permissão para exportar o arquivo."},title:{error:"Erro"},limitExceeded:{title:"Atenção",description:"Apenas os {{limit}} primeiros registros serão exportados. Deseja continuar?",subdescription:"Caso seja necessária uma quantidade maior de registros exportados, utilize o Extrator de Dados através de um Relatório Personalizado.",cancel:"Cancelar",continue:"Continuar"}},b={modalTitle:"Configuração de valor variável",labelSystemConfig:"Usar definições do sistema",labelUserConfig:"Usar definições personalizadas",labelInstance:"Categoria",labelField:"Campo",labelDescription:"Descrição (obrigatório) *",labelType:"Tipo (obrigatório) *",labelTypeValues:{date:"Data",text:"Texto",integer:"Número Inteiro",decimal:"Número com Decimal"},labelExpression:"Expressão",labelCancel:"Cancelar",labelSave:"Salvar"},g={searchLabel:"Buscar campo",fieldLabel:"Campos de {{link}}",linkLabel:"Categorias de {{link}}"},v={backTitle:"Voltar"},C={title:"Anexar arquivos",description:"Faça o upload dos arquivos ou informe links que deseja anexar ao título",attachHint:"Fazer download do arquivo",breadcrumbTitle:"Anexar",finishedMessage:"O anexo foi finalizado com sucesso",finish:"Finalizar",cancelConfirmation:{title:"Atenção",message:"As alterações realizadas não serão aplicadas.<br/><br/><b>Deseja mesmo continuar?</b>"},alertValidation:{fileAndLinkAtTheSameTime:{title:"Atenção",message:"Não é permitido inserir o arquivo e o link ao mesmo tempo."},anyLinkOrFileFilled:{title:"Atenção",message:'É necessário preencher o campo "Link" ou anexar um arquivo.'}},taskbar:{titleDownload:"Fazer download",titleLink:"Abrir link"}},F={info:{labelSearchField:"Buscar campo",labelOperator:"Operador",labelValueVarible:"Valor variável",titleTooltip:"Ao ativar um valor variável, é possível inserir um valor diferente sempre que o filtro for aplicado"},confirm:{title:"Aviso",description:"As informações da condição serão descartadas.</br></br><b>Gostaria de continuar?</b>"}};class S{constructor(S){this._defaults={snkDataUnit:e,snkFormConfig:n,snkConfigOptions:t,snkTaskbar:r,snkFieldConfig:d,snkFilterBar:a,snkConfigurator:u,snkTabConfig:c,crudUtils:o,snkGrid:m,snkGridConfig:p,snkExporter:i,snkDataExporter:f,snkCrud:l,fileViewer:s,snkFilterParamConfig:b,snkFilterFieldSearch:g,snkSimpleBar:v,snkAttach:C,snkPersonalizedFilter:F},this._currentOperation=x.CLEAN,this._domainName=S,this.loadAppMessages().then((e=>{this._appMessages=e}),(e=>{console.info("O arquivo de mensagens personalizadas não foi encontrado no caminho /messages/appmessages.js",e)}))}set currentOperation(e){this._currentOperation=e}getMessage(e,a){if(null==e)return;var r=e.split(".");let o=this.resolveMessage(r,this.getDomainMessages());if(null==o&&(o=this.resolveMessage(r,this._defaults)),this.customMessageBuilder){const r=this.customMessageBuilder(e,o,a);o=r.message,a=r.params}return this.postProcess(o,a)}getDomainMessages(){return null==this._domainName?this._appMessages.Global||this._appMessages:null==this._appMessages?void 0:this._appMessages[this._domainName]}resolveMessage(e,a){if(null==a)return;const r=a[e[0]];return r?this.isOperationSensitive(r)?r[this._currentOperation]:1===e.length||null==r||"string"==typeof r?r:this.resolveMessage(e.slice(1),r):void 0}isOperationSensitive(e){return null!=e[x.CLONE]||null!=e[x.INSERT]||null!=e[x.UPDATE]||null!=e[x.CLEAN]}postProcess(e,a){if(e){const r=/(.*?)\{\{(.+?)\}\}/g;let o,i="",l=e;for(;null!==(o=r.exec(e));){const[r,s,t]=o,n=o.index+r.length;l=n<e.length?e.substring(n):"";let d=a?a[t]:void 0;null==d&&(d=""),i+=s+d}return i+l}return e}loadAppMessages(){return new Promise(((e,a)=>{const r="dev"!==window.applicationenv?`/${window.MGE_MODULE_NAME}/labsApps/${window.APPLICATION_NAME}/build/messages/appmessages.js`:"/messages/appmessages.js";import(r).then((a=>{e(a.default)})).catch((e=>{a(e)}))}))}}var x;!function(e){e.CLONE="clone",e.INSERT="insert",e.UPDATE="update",e.CLEAN="clean"}(x||(x={}));export{x as O,S}
@@ -0,0 +1 @@
1
+ export{S as snk_guides_viewer}from"./p-ccd26e3a.js";import"./p-b9667fbe.js";import"@sankhyalabs/core";import"./p-e0aa5838.js";import"./p-52ed2a18.js";import"./p-0d81236c.js";import"./p-41d92871.js";import"./p-112455b1.js";import"@sankhyalabs/ezui/dist/collection/utils/form";import"./p-c2beb95c.js";import"./p-d410f45a.js";import"./p-4c2015a9.js";import"./p-6a02e236.js";import"./p-17375123.js";import"./p-11028eba.js";
@@ -0,0 +1,27 @@
1
+ import{r as e,h as i,H as s}from"./p-b9667fbe.js";import{d as t,D as r}from"./p-41d92871.js";import{F as n,c as o}from"./p-4c2015a9.js";import{s as a}from"./p-6a02e236.js";import{StringUtils as l,ApplicationContext as c}from"@sankhyalabs/core";import"./p-112455b1.js";class d{constructor(){this.templateByQuery=new Map,this.buildTemplates()}buildTemplates(){const e=t.gql`
2
+ query($name: String!) {
3
+ $queryAlias$: fetchFilterFields(name: $name){
4
+ currentLink {
5
+ description
6
+ uri
7
+ }
8
+ links {
9
+ description
10
+ uri
11
+ fieldCount
12
+ }
13
+ fields {
14
+ name
15
+ description
16
+ uri
17
+ onlyDate
18
+ dataType
19
+ userInterface
20
+ properties {
21
+ name
22
+ value
23
+ }
24
+ }
25
+ }
26
+ }
27
+ `;this.templateByQuery.set("fetchFilterFields",e)}loadFields(e){return new Promise(((i,s)=>{r.get().callGraphQL({values:{name:e},query:this.templateByQuery.get("fetchFilterFields")}).then((e=>{let s=e.fields;for(const e of s)if(Array.isArray(e.properties)&&e.properties.length>0&&"SEARCH"===e.userInterface){const i=e.properties.reduce(((e,i)=>(e[i.name]=i.value,e)),{});e.properties=i}i(Object.assign(Object.assign({},e),{fields:s}))})).catch((e=>{s(e)}))}))}}const m=class{constructor(i){e(this,i),this._personalizedFilterFetcher=new d,this._dataSourceFetcher={fetchData:async e=>{let i=null==e?void 0:e.uri;return l.isEmpty(i)&&(i="dd://Financeiro/br.com.sankhya.fin.cad.receber"),await this._personalizedFilterFetcher.loadFields(i)}},this.items={entityName:"Financeiro",fieldName:"CODBCO",description:"Financeiro >> Banco",type:n.DECIMAL,expression:"Financeiro.CODBCO",operand:o.EQUAL,paramVariable:!1,value:"61",systemConfig:null,userConfig:null},this.handleFilterItemChange=e=>{console.log("Campo do ExpressionItem alterado"),console.log(e)},this.handleFilterItemRemove=e=>{console.log("Event de deleção disparado"),console.log(e)},this.messagesBuilder=void 0}componentWillLoad(){if(null==a.get("filterFieldsDataSource")&&a.set("filterFieldsDataSource",this._dataSourceFetcher),!this.messagesBuilder){const e=c.getContextValue("__SNK__APPLICATION__");this.messagesBuilder=null==e?void 0:e.messagesBuilder}}render(){return i(s,null,i("div",null,i("snk-expression-item",{expression:this.items,canRemove:!0,onEzFilterItemChange:e=>this.handleFilterItemChange(e.detail),onEzFilterItemRemove:e=>this.handleFilterItemRemove(e.detail),messagesBuilder:this.messagesBuilder})))}};m.style=":host{display:flex}";export{m as snk_personalized_filter}
@@ -0,0 +1 @@
1
+ import{r as t,c as e,h as s,H as i,g as h}from"./p-b9667fbe.js";import{ElementIDUtils as l}from"@sankhyalabs/core";import{F as r}from"./p-584d7212.js";import{E as a}from"./p-1a68fb59.js";const c=class{constructor(s){t(this,s),this.valueChanged=e(this,"valueChanged",7),this.value=void 0,this.config=void 0,this.presentationMode=a.CHIP}isSelected(t){return null==this.value||this.value===t}ezChangeListener(t){t.detail||this.assertCheckedOption(t.target),this.updateValue()}componentDidLoad(){this._element&&l.addIDInfo(this._element,"filterContentEditor")}assertCheckedOption(t){t===this._checkOne?this._checkTwo.value=!0:this._checkOne.value=!0}updateValue(){if(this._checkOne.value&&this._checkTwo.value)this.value=void 0;else{const[t,e]=this.config.props.options;this.value=this._checkOne.value?t.name:e.name}this.valueChanged.emit(this.value)}async show(){this._checkOne.setFocus()}render(){if(!this.config||this.config.type!==r.BINARY_SELECT)return;const[t,e]=this.config.props.options;return this.presentationMode===a.MODAL?s(i,null,s("div",{class:"ez-flex ez-flex--row ez-flex--align-items-center"},s("label",{class:"ez-text ez-text--medium ez-text--primary",style:{flex:"1 1 0",width:"0px"}},this.config.detailModal),s("ez-check",{compact:!0,style:{flex:"1 1 0",width:"0px"},id:`${this.config.id}_${t.name||"option1"}`,label:t.label,class:"sc-snk-filter-bar editor__ez-check",ref:t=>this._checkOne=t,value:this.isSelected(t.name)}),s("ez-check",{compact:!0,style:{flex:"1 1 0",width:"0px"},id:`${this.config.id}_${e.name||"option2"}`,label:e.label,class:"sc-snk-filter-bar editor__ez-check",ref:t=>this._checkTwo=t,value:this.isSelected(e.name)}))):s(i,null,s("ez-check",{id:`${this.config.id}_${t.name||"option1"}`,label:t.label,class:"sc-snk-filter-bar editor__ez-check",ref:t=>this._checkOne=t,value:this.isSelected(t.name)}),s("ez-check",{id:`${this.config.id}_${e.name||"option2"}`,label:e.label,class:"sc-snk-filter-bar editor__ez-check",ref:t=>this._checkTwo=t,value:this.isSelected(e.name)}))}get _element(){return h(this)}};export{c as snk_filter_binary_select}