@sankhyalabs/sankhyablocks 10.1.0-dev.18 → 10.1.0-dev.19

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 (197) hide show
  1. package/dist/cjs/{PersonalizedFilterUtils-7259cf65.js → PersonalizedFilterUtils-eccb267a.js} +13 -0
  2. package/dist/cjs/{SnkMultiSelectionListDataSource-72925620.js → SnkMultiSelectionListDataSource-03b58f5a.js} +1 -1
  3. package/dist/cjs/config-header.cjs.entry.js +1 -1
  4. package/dist/cjs/configs-button.cjs.entry.js +1 -1
  5. package/dist/cjs/css-shim-a27d231b.js +6 -0
  6. package/dist/cjs/dom-ff96a4bc.js +75 -0
  7. package/dist/cjs/field-config_2.cjs.entry.js +1 -1
  8. package/dist/cjs/fields-layout.cjs.entry.js +1 -1
  9. package/dist/cjs/fields-selector.cjs.entry.js +1 -1
  10. package/dist/cjs/guides-configurator.cjs.entry.js +1 -1
  11. package/dist/cjs/{index-dc83c596.js → index-1894343a.js} +1527 -170
  12. package/dist/cjs/{index-516250fa.js → index-f0fe7e6e.js} +90 -21
  13. package/dist/cjs/loader.cjs.js +15 -1
  14. package/dist/cjs/pesquisa-grid_2.cjs.entry.js +1 -1
  15. package/dist/cjs/sankhyablocks.cjs.js +131 -3
  16. package/dist/cjs/shadow-css-7e3e0ab1.js +389 -0
  17. package/dist/cjs/snk-actions-button_9.cjs.entry.js +1 -1
  18. package/dist/cjs/snk-actions-form.cjs.entry.js +1 -1
  19. package/dist/cjs/snk-application.cjs.entry.js +1 -1
  20. package/dist/cjs/snk-attach.cjs.entry.js +3 -3
  21. package/dist/cjs/snk-client-confirm.cjs.entry.js +1 -1
  22. package/dist/cjs/snk-configurator.cjs.entry.js +1 -1
  23. package/dist/cjs/snk-crud.cjs.entry.js +3 -3
  24. package/dist/cjs/snk-custom-slot-elements.cjs.entry.js +1 -1
  25. package/dist/cjs/snk-custom-slot-guide.cjs.entry.js +1 -1
  26. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  27. package/dist/cjs/{snk-data-unit-4f68458c.js → snk-data-unit-036ce58c.js} +1 -1
  28. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  29. package/dist/cjs/snk-default-filter.cjs.entry.js +1 -1
  30. package/dist/cjs/snk-detail-view.cjs.entry.js +4 -4
  31. package/dist/cjs/snk-entity-list.cjs.entry.js +1 -1
  32. package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +1 -1
  33. package/dist/cjs/snk-expression-group_2.cjs.entry.js +2 -2
  34. package/dist/cjs/snk-filter-advanced-mode_2.cjs.entry.js +2 -2
  35. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +22 -12
  36. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
  37. package/dist/cjs/snk-filter-checkbox-list.cjs.entry.js +1 -1
  38. package/dist/cjs/snk-filter-detail.cjs.entry.js +2 -2
  39. package/dist/cjs/snk-filter-field-search_2.cjs.entry.js +2 -2
  40. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +1 -1
  41. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +1 -1
  42. package/dist/cjs/snk-filter-number.cjs.entry.js +1 -1
  43. package/dist/cjs/snk-filter-period.cjs.entry.js +1 -1
  44. package/dist/cjs/snk-filter-search.cjs.entry.js +1 -1
  45. package/dist/cjs/snk-filter-text.cjs.entry.js +1 -1
  46. package/dist/cjs/snk-form-summary.cjs.entry.js +1 -1
  47. package/dist/cjs/snk-form-view.cjs.entry.js +1 -1
  48. package/dist/cjs/snk-form_2.cjs.entry.js +1 -1
  49. package/dist/cjs/snk-grid.cjs.entry.js +4 -4
  50. package/dist/cjs/{snk-guides-viewer-41c22d96.js → snk-guides-viewer-164c063e.js} +2 -2
  51. package/dist/cjs/snk-guides-viewer.cjs.entry.js +4 -4
  52. package/dist/cjs/snk-personalized-filter-editor.cjs.entry.js +1 -1
  53. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
  54. package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
  55. package/dist/cjs/snk-print-selector.cjs.entry.js +1 -1
  56. package/dist/cjs/snk-simple-bar.cjs.entry.js +1 -1
  57. package/dist/cjs/snk-simple-crud.cjs.entry.js +4 -4
  58. package/dist/cjs/snk-taskbar.cjs.entry.js +3 -3
  59. package/dist/cjs/{taskbar-elements-756fcbe7.js → taskbar-elements-8a80420e.js} +2 -2
  60. package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
  61. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +3 -1
  62. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +17 -9
  63. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.js +13 -0
  64. package/dist/components/PersonalizedFilterUtils.js +13 -0
  65. package/dist/components/index2.js +90 -21
  66. package/dist/components/snk-filter-bar2.js +17 -9
  67. package/dist/components/snk-filter-item2.js +3 -1
  68. package/dist/esm/{PersonalizedFilterUtils-2db38ff2.js → PersonalizedFilterUtils-d2439a9a.js} +13 -0
  69. package/dist/esm/{SnkMultiSelectionListDataSource-493ae8c8.js → SnkMultiSelectionListDataSource-01b3744b.js} +1 -1
  70. package/dist/esm/config-header.entry.js +1 -1
  71. package/dist/esm/configs-button.entry.js +1 -1
  72. package/dist/esm/css-shim-9f2d321e.js +4 -0
  73. package/dist/esm/dom-64053c71.js +73 -0
  74. package/dist/esm/field-config_2.entry.js +1 -1
  75. package/dist/esm/fields-layout.entry.js +1 -1
  76. package/dist/esm/fields-selector.entry.js +1 -1
  77. package/dist/esm/guides-configurator.entry.js +1 -1
  78. package/dist/esm/{index-7fd74680.js → index-04f73a26.js} +1519 -170
  79. package/dist/esm/{index-3355bd17.js → index-ea250be6.js} +90 -21
  80. package/dist/esm/loader.js +16 -2
  81. package/dist/esm/pesquisa-grid_2.entry.js +1 -1
  82. package/dist/esm/sankhyablocks.js +132 -4
  83. package/dist/esm/shadow-css-98135883.js +387 -0
  84. package/dist/esm/snk-actions-button_9.entry.js +1 -1
  85. package/dist/esm/snk-actions-form.entry.js +1 -1
  86. package/dist/esm/snk-application.entry.js +1 -1
  87. package/dist/esm/snk-attach.entry.js +3 -3
  88. package/dist/esm/snk-client-confirm.entry.js +1 -1
  89. package/dist/esm/snk-configurator.entry.js +1 -1
  90. package/dist/esm/snk-crud.entry.js +3 -3
  91. package/dist/esm/snk-custom-slot-elements.entry.js +1 -1
  92. package/dist/esm/snk-custom-slot-guide.entry.js +1 -1
  93. package/dist/esm/snk-data-exporter.entry.js +2 -2
  94. package/dist/esm/{snk-data-unit-a76aba10.js → snk-data-unit-130021b3.js} +1 -1
  95. package/dist/esm/snk-data-unit.entry.js +2 -2
  96. package/dist/esm/snk-default-filter.entry.js +1 -1
  97. package/dist/esm/snk-detail-view.entry.js +4 -4
  98. package/dist/esm/snk-entity-list.entry.js +1 -1
  99. package/dist/esm/snk-exporter-email-sender.entry.js +1 -1
  100. package/dist/esm/snk-expression-group_2.entry.js +2 -2
  101. package/dist/esm/snk-filter-advanced-mode_2.entry.js +2 -2
  102. package/dist/esm/snk-filter-bar_4.entry.js +22 -12
  103. package/dist/esm/snk-filter-binary-select.entry.js +1 -1
  104. package/dist/esm/snk-filter-checkbox-list.entry.js +1 -1
  105. package/dist/esm/snk-filter-detail.entry.js +2 -2
  106. package/dist/esm/snk-filter-field-search_2.entry.js +2 -2
  107. package/dist/esm/snk-filter-modal-item.entry.js +1 -1
  108. package/dist/esm/snk-filter-multi-select.entry.js +1 -1
  109. package/dist/esm/snk-filter-number.entry.js +1 -1
  110. package/dist/esm/snk-filter-period.entry.js +1 -1
  111. package/dist/esm/snk-filter-search.entry.js +1 -1
  112. package/dist/esm/snk-filter-text.entry.js +1 -1
  113. package/dist/esm/snk-form-summary.entry.js +1 -1
  114. package/dist/esm/snk-form-view.entry.js +1 -1
  115. package/dist/esm/snk-form_2.entry.js +1 -1
  116. package/dist/esm/snk-grid.entry.js +4 -4
  117. package/dist/esm/{snk-guides-viewer-31ef5fc6.js → snk-guides-viewer-3fd18298.js} +2 -2
  118. package/dist/esm/snk-guides-viewer.entry.js +4 -4
  119. package/dist/esm/snk-personalized-filter-editor.entry.js +1 -1
  120. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  121. package/dist/esm/snk-pesquisa.entry.js +1 -1
  122. package/dist/esm/snk-print-selector.entry.js +1 -1
  123. package/dist/esm/snk-simple-bar.entry.js +1 -1
  124. package/dist/esm/snk-simple-crud.entry.js +4 -4
  125. package/dist/esm/snk-taskbar.entry.js +3 -3
  126. package/dist/esm/{taskbar-elements-bf5b73f1.js → taskbar-elements-d1e63fb2.js} +2 -2
  127. package/dist/esm/teste-pesquisa.entry.js +1 -1
  128. package/dist/sankhyablocks/{p-c60d864f.entry.js → p-0a160fb5.entry.js} +1 -1
  129. package/dist/sankhyablocks/{p-0893a694.entry.js → p-12f595a6.entry.js} +1 -1
  130. package/dist/sankhyablocks/{p-522d36aa.entry.js → p-175c9576.entry.js} +1 -1
  131. package/dist/sankhyablocks/{p-8488fa7e.entry.js → p-18d66638.entry.js} +1 -1
  132. package/dist/sankhyablocks/{p-cfa4c183.entry.js → p-27e0cd68.entry.js} +1 -1
  133. package/dist/sankhyablocks/{p-8d84d6ab.entry.js → p-2b882835.entry.js} +1 -1
  134. package/dist/sankhyablocks/{p-7375bf6a.entry.js → p-2c6be187.entry.js} +1 -1
  135. package/dist/sankhyablocks/p-2c9d0870.js +2 -0
  136. package/dist/sankhyablocks/{p-8783d550.entry.js → p-2cc2526e.entry.js} +1 -1
  137. package/dist/sankhyablocks/{p-82b59a45.entry.js → p-2ebda226.entry.js} +1 -1
  138. package/dist/sankhyablocks/{p-301baf9c.entry.js → p-2f94cf87.entry.js} +1 -1
  139. package/dist/sankhyablocks/{p-35a26068.entry.js → p-3a35917e.entry.js} +1 -1
  140. package/dist/sankhyablocks/{p-8557e3f4.entry.js → p-3b6d8d33.entry.js} +1 -1
  141. package/dist/sankhyablocks/{p-0da30fd9.entry.js → p-3db72758.entry.js} +1 -1
  142. package/dist/sankhyablocks/p-560a9a68.entry.js +1 -0
  143. package/dist/sankhyablocks/{p-4575c4aa.entry.js → p-5aae5c74.entry.js} +1 -1
  144. package/dist/sankhyablocks/p-6564180d.entry.js +1 -0
  145. package/dist/sankhyablocks/p-68c1a093.js +1 -0
  146. package/dist/sankhyablocks/{p-907e96eb.js → p-6d322b0a.js} +1 -1
  147. package/dist/sankhyablocks/{p-cc68a0c1.entry.js → p-7150eacf.entry.js} +1 -1
  148. package/dist/sankhyablocks/{p-56b1b397.entry.js → p-752c57f4.entry.js} +1 -1
  149. package/dist/sankhyablocks/{p-670b8802.entry.js → p-752f4e29.entry.js} +1 -1
  150. package/dist/sankhyablocks/{p-939523b3.entry.js → p-76729994.entry.js} +1 -1
  151. package/dist/sankhyablocks/{p-357e10e0.entry.js → p-877d9614.entry.js} +1 -1
  152. package/dist/sankhyablocks/{p-497ece60.entry.js → p-8d946600.entry.js} +1 -1
  153. package/dist/sankhyablocks/{p-227e82b2.entry.js → p-90ae6c2e.entry.js} +1 -1
  154. package/dist/sankhyablocks/{p-b5832fa0.entry.js → p-94267a30.entry.js} +1 -1
  155. package/dist/sankhyablocks/{p-59158ba4.js → p-998a9d6f.js} +1 -1
  156. package/dist/sankhyablocks/{p-1e469905.entry.js → p-9c1ff75e.entry.js} +1 -1
  157. package/dist/sankhyablocks/{p-abfc9880.entry.js → p-9e109f5e.entry.js} +1 -1
  158. package/dist/sankhyablocks/p-a46ac091.js +1 -0
  159. package/dist/sankhyablocks/p-a73b6b00.js +1 -0
  160. package/dist/sankhyablocks/{p-4deb7f46.entry.js → p-acd2ba28.entry.js} +1 -1
  161. package/dist/sankhyablocks/{p-3671cdd4.entry.js → p-ae326d06.entry.js} +1 -1
  162. package/dist/sankhyablocks/{p-5c9bea92.entry.js → p-b471bfab.entry.js} +1 -1
  163. package/dist/sankhyablocks/{p-2624dfd2.entry.js → p-b533edab.entry.js} +1 -1
  164. package/dist/sankhyablocks/p-b555ce38.entry.js +1 -0
  165. package/dist/sankhyablocks/p-c3ec6642.js +19 -0
  166. package/dist/sankhyablocks/{p-613eb22e.entry.js → p-c8043a53.entry.js} +1 -1
  167. package/dist/sankhyablocks/{p-ce207f2a.entry.js → p-cc64239c.entry.js} +1 -1
  168. package/dist/sankhyablocks/{p-1be69fd4.js → p-cc9935af.js} +1 -1
  169. package/dist/sankhyablocks/{p-8d76a0ca.entry.js → p-cd00a3d1.entry.js} +1 -1
  170. package/dist/sankhyablocks/{p-7961c550.entry.js → p-cd40c8cf.entry.js} +1 -1
  171. package/dist/sankhyablocks/{p-d5d7fe52.entry.js → p-cd412add.entry.js} +1 -1
  172. package/dist/sankhyablocks/{p-959fe522.entry.js → p-d657f71f.entry.js} +1 -1
  173. package/dist/sankhyablocks/{p-c2bb0659.entry.js → p-d6dad5e4.entry.js} +1 -1
  174. package/dist/sankhyablocks/{p-ec45ede0.js → p-d714b6ca.js} +1 -1
  175. package/dist/sankhyablocks/{p-dcb096c4.entry.js → p-d8368b17.entry.js} +1 -1
  176. package/dist/sankhyablocks/p-da455c82.js +12 -0
  177. package/dist/sankhyablocks/{p-7a9b2c83.entry.js → p-dea58642.entry.js} +1 -1
  178. package/dist/sankhyablocks/p-e30acdca.entry.js +1 -0
  179. package/dist/sankhyablocks/{p-1dba30c9.entry.js → p-ec9027a7.entry.js} +1 -1
  180. package/dist/sankhyablocks/p-ef9343c3.entry.js +1 -0
  181. package/dist/sankhyablocks/{p-def17f0e.entry.js → p-f152ef98.entry.js} +1 -1
  182. package/dist/sankhyablocks/{p-98c70173.entry.js → p-f7170e10.entry.js} +1 -1
  183. package/dist/sankhyablocks/{p-9834ca90.entry.js → p-f8c5395a.entry.js} +1 -1
  184. package/dist/sankhyablocks/{p-98e3d0a1.entry.js → p-f8da8569.entry.js} +1 -1
  185. package/dist/sankhyablocks/{p-fd1a5a61.entry.js → p-f921270b.entry.js} +1 -1
  186. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  187. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +1 -1
  188. package/dist/types/components/snk-personalized-filter/interfaces/IParameter.d.ts +1 -0
  189. package/package.json +1 -1
  190. package/dist/sankhyablocks/p-1c31f314.entry.js +0 -1
  191. package/dist/sankhyablocks/p-465877ee.entry.js +0 -1
  192. package/dist/sankhyablocks/p-516411de.entry.js +0 -1
  193. package/dist/sankhyablocks/p-67137d7c.entry.js +0 -1
  194. package/dist/sankhyablocks/p-82bb3eda.js +0 -2
  195. package/dist/sankhyablocks/p-8336900b.js +0 -1
  196. package/dist/sankhyablocks/p-988afe78.js +0 -1
  197. package/dist/sankhyablocks/p-e47d6f17.entry.js +0 -1
@@ -1 +0,0 @@
1
- import{r as i,c as e,f as t,h as s,H as l}from"./p-82bb3eda.js";import{UserInterface as n,StringUtils as a,ObjectUtils as o,ApplicationContext as h}from"@sankhyalabs/core";import{b as d,D as r,c as u}from"./p-9019a32f.js";import{getConvertedValue as c}from"@sankhyalabs/core/dist/dataunit/metadata/DataType";import{CheckMode as f}from"@sankhyalabs/ezui/dist/collection/utils";import{h as p,i as v,j as b,k as g}from"./p-8b4d6719.js";const m=class{constructor(t){i(this,t),this.fieldConfigChanged=e(this,"fieldConfigChanged",7),this.fieldLabel=void 0,this.fieldLabelErrorMessage=void 0,this.fieldDefaultValue=void 0,this.fieldCleanOnCopy=void 0,this.fieldRequired=void 0,this.fieldReadOnly=void 0,this._defaultType=void 0,this.dataUnit=void 0,this.fieldConfig=void 0,this.fieldDescriptor=void 0,this.messagesBuilder=void 0}observeFieldLabel(){this.validateFieldLabel&&(this.fieldLabelErrorMessage=void 0)}async show(i){this._popoupElement.opened=!0,this.initializeValues(),t(this)}validateFieldLabel(){var i;return!!(null===(i=this.fieldLabel)||void 0===i?void 0:i.trim())||(this.applyErrorMessage(),!1)}getMessage(i,e){return this.messagesBuilder.getMessage(i,e)}isAllowDefault(){var i;const e=null===(i=this.fieldDescriptor.properties)||void 0===i?void 0:i.allowDefault;return null==e||"true"===e}enabledValueDefault(){var i,e,t;const s=null===(i=this.fieldDescriptor.properties)||void 0===i?void 0:i.allowDefault;return(d.UserInterface.hasOwnProperty(null===(e=this.fieldDescriptor)||void 0===e?void 0:e.userInterface)||(null===(t=this.fieldDescriptor)||void 0===t?void 0:t.userInterface)===n.SEARCH)&&(null==s||"true"===s)}getDefaultType(){var i,e;return null!==(e=null===(i=this.fieldDefaultValue)||void 0===i?void 0:i.type)&&void 0!==e?e:r.fixed}emitFieldChanged(){this.fieldConfigChanged.emit(this.fieldConfig)}handleLabelChanged({detail:i}){this.fieldLabel=i}handleDefaultTypeChanged({detail:i}){const e=i.value;null!=e&&(this._defaultType=e,this.fieldDefaultValue={type:this._defaultType})}handleDefaultValueChanged({detail:i}){this.fieldDefaultValue.value=null==i?void 0:i.value}onChangeDefaultValue(i){this.fieldDefaultValue.value=p(i,this.dataUnit,this.fieldConfig.name)}handleClearDuplicateChanged({detail:i}){this.fieldCleanOnCopy=i}handleRequiredChanged({detail:i}){this.fieldRequired=i}handleReadOnlyChanged({detail:i}){this.fieldReadOnly=i}loadDefaultValue(){var i;(null===(i=this.fieldConfig.defaultValue)||void 0===i?void 0:i.type)?this._defaultType=this.fieldConfig.defaultValue.type:(this._defaultType=r.fixed,this.fieldConfig.defaultValue={type:this._defaultType})}buildOptions(){let i=this.fieldDescriptor.userInterface;return i===n.SEARCH&&(i=n.INTEGERNUMBER),d.UserInterface[i]}renderDefaultValueEditor(){return this._defaultType===r.variable?s("ez-combo-box",{label:this.getMessage("snkConfigOptions.label.valueDefault"),enabled:this.isAllowDefault(),onEzChange:i=>this.handleDefaultValueChanged(i),value:this.fieldDefaultValue.value,options:this.buildOptions()}):this.fieldDescriptor.userInterface&&this.buildFieldDefaultValueElement()}buildFieldDefaultValueElement(){var i;const{userInterface:e,properties:t,dataType:s}=this.fieldDescriptor;let l,o=a.getBooleanValue(null==t?void 0:t.allowDefault,!this.fieldReadOnly);e===n.FILE&&(o=!1),o&&(l=null===(i=this.fieldDefaultValue)||void 0===i?void 0:i.value,null!=l&&(l=c(s,l)));const h={value:l,enabled:o,label:this.fieldConfig.label,name:this.fieldConfig.name,required:this.fieldRequired,userInterface:e};switch(e){case n.SWITCH:return this.buildInputDefault(h,void 0,f.SWITCH);case n.CHECKBOX:return this.buildInputDefault(h,void 0,f.REGULAR);case n.OPTIONSELECTOR:case n.DECIMALNUMBER:return this.buildInputDefault(h,t);default:return this.buildInputDefault(h)}}buildInputDefault({value:i,enabled:e,label:t,name:l,required:a,userInterface:h},d,r){let c,f=0,p=0;const v=null==h||null==u[h]?u.DEFAULT:u[h];if(h===n.OPTIONSELECTOR){const i=null==d?void 0:d.options;if("string"==typeof i){const e=o.stringToObject(i);c=Object.keys(e).map((i=>({value:i,label:e[i]})))}else c=i}else h===n.DECIMALNUMBER&&(f=Number((null==d?void 0:d.precision)||2),p=Number((null==d?void 0:d.prettyPrecision)||f));return s(v,Object.assign({value:i,enabled:e,label:t,"data-field-name":l,key:l,onEzChange:i=>this.onChangeDefaultValue(null==i?void 0:i.detail)},this.getConditionalAttributes(h,a,c,f,p,r)))}getConditionalAttributes(i,e,t,s,l,a){const o=i==n.SEARCHPLUS;switch(i){case n.SEARCH:case n.SEARCHPLUS:return{suppressEmptyOption:e,optionLoader:i=>this.onSearchDefaultValue(i,{useSearchPlus:o})};case n.OPTIONSELECTOR:return{suppressEmptyOption:e,options:t};case n.CHECKBOX:case n.SWITCH:return{mode:a};case n.INTEGERNUMBER:case n.DECIMALNUMBER:return{precision:s,prettyPrecision:l,onEzStartChange:i=>this.onChangeDefaultValue(null==i?void 0:i.detail)};case n.DATE:case n.DATETIME:case n.TIME:return{onEzStartChange:i=>this.onChangeDefaultValue(null==i?void 0:i.detail)};default:return{}}}onSearchDefaultValue(i,e){if(this._application&&this.fieldConfig)return this._application.executeSearch(i,this.fieldConfig.name,this.dataUnit,e)}initializeValues(){this.fieldLabel=this.fieldConfig.label,this.fieldDefaultValue=this.fieldConfig.defaultValue,this.fieldRequired=this.fieldConfig.required,this.fieldReadOnly=this.fieldConfig.readOnly,this.fieldCleanOnCopy=this.fieldConfig.cleanOnCopy}handleApplyChanges(){this.validateFieldLabel()&&(this.fieldConfig.label=this.fieldLabel,this.fieldConfig.defaultValue=this.fieldDefaultValue,this.fieldConfig.required=this.fieldRequired,this.fieldConfig.readOnly=this.fieldReadOnly,this.fieldConfig.cleanOnCopy=this.fieldCleanOnCopy,this.emitFieldChanged(),this._popoupElement.opened=!1)}applyErrorMessage(){this.fieldLabelErrorMessage=`${this.getMessage("snkConfigOptions.validation.requiredField")} ${this.getMessage("snkConfigOptions.label.nameField")}`}handleDiscardChanges(){this.initializeValues(),this._popoupElement.opened=!1}componentWillLoad(){this.loadDefaultValue(),this._application=h.getContextValue("__SNK__APPLICATION__")}render(){return s("ez-popup",{heightMode:"auto",size:"auto","ez-title":this.getMessage("snkConfigOptions.fieldConfig.title"),onEzClosePopup:()=>this.handleDiscardChanges(),ref:i=>this._popoupElement=i},s("div",{class:"field-config-container"},s("ez-text-input",{label:this.getMessage("snkConfigOptions.label.nameField"),value:this.fieldLabel,errorMessage:this.fieldLabelErrorMessage,hasInvalid:!!this.fieldLabelErrorMessage,onEzChange:i=>this.handleLabelChanged(i)}),s("ez-combo-box",{label:this.getMessage("snkConfigOptions.label.typeValueDefault"),suppressEmptyOption:!0,enabled:this.enabledValueDefault(),onEzChange:i=>this.handleDefaultTypeChanged(i),value:this.getDefaultType()},s("option",{value:r.fixed},this.getMessage("snkConfigOptions.options.valueFixed")),s("option",{value:r.variable},this.getMessage("snkConfigOptions.options.variable"))),this.renderDefaultValueEditor(),s("ez-check",{label:this.getMessage("snkConfigOptions.label.clearDuplicate"),value:this.fieldCleanOnCopy,onEzChange:i=>this.handleClearDuplicateChanged(i)}),s("ez-check",{label:this.getMessage("snkConfigOptions.label.requiredField"),enabled:v("required","systemRequired",this.fieldDescriptor),value:b("required",this.fieldDescriptor,this.fieldRequired),onEzChange:i=>this.handleRequiredChanged(i)}),s("ez-check",{label:this.getMessage("snkConfigOptions.label.protectedField"),enabled:v("readOnly","systemReadOnly",this.fieldDescriptor),value:b("readOnly",this.fieldDescriptor,this.fieldReadOnly),onEzChange:i=>this.handleReadOnlyChanged(i)}),s("div",{class:"actions"},s("ez-button",{label:this.getMessage("snkConfigOptions.fieldConfig.buttons.cancel"),onClick:()=>this.handleDiscardChanges()}),s("ez-button",{label:this.getMessage("snkConfigOptions.fieldConfig.buttons.confirm"),class:"ez-button--primary",onClick:()=>this.handleApplyChanges()}))))}static get watchers(){return{fieldLabel:["observeFieldLabel"]}}};m.style=".field-config-container.sc-field-config{font-family:'Roboto';color:#2b3a54;display:flex;flex-direction:column;gap:10px;width:330px;justify-content:space-between}.header.sc-field-config{display:flex;font-weight:500;font-size:16px}.actions.sc-field-config{display:flex;align-items:flex-end;justify-content:flex-end;gap:12px}";const C=class{constructor(t){i(this,t),this.setFieldAsAvailable=e(this,"setFieldAsAvailable",7),this.addFieldToGuide=e(this,"addFieldToGuide",7),this.fieldDescriptor=void 0,this.fieldConfig=void 0,this.onLayoutConfig=!1,this.dataUnit=void 0,this.messagesBuilder=void 0}observeDataUnit(){this.loadFieldDescriptor()}isRequired(){var i,e;const t=this.dataUnit&&this.dataUnit.getField(null===(i=this.fieldConfig)||void 0===i?void 0:i.name);return!0===(null==t?void 0:t.required)||!0===(null===(e=this.fieldConfig)||void 0===e?void 0:e.required)}async showFieldConfig(){var i;await(null===(i=this._refFieldConfig)||void 0===i?void 0:i.show(this._editIconRef))}renderFieldConfig(){if(this.onLayoutConfig&&this.dataUnit&&this.messagesBuilder)return s("field-config",{ref:i=>this._refFieldConfig=i,fieldConfig:this.fieldConfig,dataUnit:this.dataUnit,fieldDescriptor:this.fieldDescriptor,messagesBuilder:this.messagesBuilder,onFieldConfigChanged:()=>t(this)})}getMessage(i,e){return this.messagesBuilder.getMessage(i,e)}renderActions(){return this.onLayoutConfig?s("div",{class:"actions hiddeble"},s("ez-button",{mode:"icon",class:"ez-button--tertiary",onClick:()=>this.setFieldAsAvailable.emit(this.fieldConfig),size:"medium",iconName:"minus",title:this.getMessage("snkFieldConfig.titleRemove")}),s("ez-button",{ref:i=>this._editIconRef=i,mode:"icon",class:"ez-button--tertiary",onClick:this.showFieldConfig.bind(this),iconName:"edit",size:"medium",title:this.getMessage("snkFieldConfig.titleEdit")})):s("div",{class:"actions hiddeble"},s("ez-button",{mode:"icon",class:"ez-button--tertiary",onClick:()=>this.addFieldToGuide.emit(this.fieldConfig),iconName:"plus",size:"medium",title:this.getMessage("snkFieldConfig.titleAddToLayout")}))}loadFieldDescriptor(){this.dataUnit&&(this.fieldDescriptor=this.dataUnit.getField(this.fieldConfig.name))}renderRequiredMark(){if(this.isRequired())return s("span",{class:"required-mark"},"*")}componentWillLoad(){this.loadFieldDescriptor()}getFieldLabel(){var i,e;return(null===(i=this.fieldConfig)||void 0===i?void 0:i.label)?this.fieldConfig.label:null===(e=this.fieldDescriptor)||void 0===e?void 0:e.label}render(){var i;return s(l,{class:this.onLayoutConfig?"":"full-width"},s("div",{class:"icons"},s("ez-icon",{iconName:"drag-indicator"}),s("ez-icon",{iconName:g(null===(i=this.fieldDescriptor)||void 0===i?void 0:i.userInterface)})),s("span",{class:"label"},s("span",{class:"label-text",title:this.getFieldLabel()},this.getFieldLabel()),this.renderRequiredMark()),this.renderActions(),this.renderFieldConfig())}static get watchers(){return{dataUnit:["observeDataUnit"]}}};C.style=".sc-field-item-h{width:100%;display:flex;padding:12px 8px;border-radius:var(--border--radius-small, 4px);border:1px solid #dce0e8;cursor:grab;align-items:center;height:42px;max-height:42px;background:#FAFCFF}.full-width.sc-field-item-h{width:100%}ez-icon.sc-field-item{--ez-icon--color:#A2ABB9}.icons.sc-field-item{display:flex}.label.sc-field-item{display:flex;flex-grow:1;padding-left:8px;font-size:14px;align-items:center;gap:4px;height:22px}.label-text.sc-field-item{overflow:hidden;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;height:auto;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;display:-webkit-box;-o-text-overflow:ellipsis;text-overflow:ellipsis;word-break:break-word}.required-mark.sc-field-item{color:#cf3105;background:#F7E0E5;width:12px;height:12px;border-radius:50%;display:flex;align-items:center;justify-content:center;padding-top:5px;font-size:16px;align-self:self-start}.actions.sc-field-item{display:flex;flex-direction:row;align-content:center;gap:4px}ez-button.sc-field-item{width:24px;align-items:center;justify-content:center;display:flex}.sc-field-item-h .hiddeble.sc-field-item{transition:0.2s ease-in-out;visibility:hidden;opacity:0}.sc-field-item-h:hover .hiddeble.sc-field-item{visibility:visible;opacity:1}";export{m as field_config,C as field_item}
@@ -1 +0,0 @@
1
- import{r as t,c as i,h as e,H as s,g as r,f as l}from"./p-82bb3eda.js";import{DataType as a,StringUtils as n,ObjectUtils as o,ElementIDUtils as h,ErrorException as d,ApplicationContext as c,LockManager as u,LockManagerOperation as f,DateUtils as m,MaskFormatter as p,KeyboardManager as v,FloatingManager as b,ArrayUtils as g}from"@sankhyalabs/core";import{EzScrollDirection as k}from"@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection";import{C as _}from"./p-1f310bc6.js";import{P as F}from"./p-988afe78.js";import{toString as z}from"@sankhyalabs/core/dist/dataunit/metadata/DataType";import{F as y}from"./p-ff1990ad.js";import{F as x,D as w}from"./p-84345e7a.js";import{F as C}from"./p-fa80e546.js";import{ModalAction as I}from"@sankhyalabs/ezui/dist/collection/components/ez-modal-container";import{ApplicationUtils as $}from"@sankhyalabs/ezui/dist/collection/utils";import{A as N}from"./p-6a4b21dd.js";import{F as T}from"./p-b568c1d4.js";import{g as L}from"./p-76e66fd9.js";import"./p-7ee6b1bf.js";import"./p-6768f176.js";import"./p-8d884fab.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";function A(t){let i="";return t.forEach(((t,e)=>{var s;i+=` ${e>0?null!==(s=t.operand)&&void 0!==s?s:"OR":""} ${t.expression}`})),i.trim()}const P=class{constructor(e){t(this,e),this.configUpdated=i(this,"configUpdated",7),this._updateSequence=[],this._loadingPending=!1,this._configUpdated=!1,this._firstLoad=!0,this._pendingVariables=!1,this._isDefaultFilter=!1,this._customfiltersToBeUpdated=[],this._resolveLoading=void 0,this._calculateSortIndex=t=>{if(!t.visible)return 0;if(t.hardFixed)return 1e6;let i=t.fixed?1e5:0;return i+=this.hasValidValue(t)?1e4:0,i+=this._updateSequence.lastIndexOf(t.id)+1,i},this._filtersComparator=(t,i)=>this._calculateSortIndex(i)-this._calculateSortIndex(t),this.enableLockManagerLoadingComp=!1,this.customFilterBarConfig=void 0,this.dataUnit=void 0,this.title=void 0,this.configName=void 0,this.resourceID=void 0,this.mode="regular",this.filterConfig=void 0,this.messagesBuilder=void 0,this.disablePersonalizedFilter=void 0,this.filterBarLegacyConfigName=void 0,this.autoLoad=void 0,this.afterApplyConfig=void 0,this.filterCustomConfig=void 0,this.filterCustomConfigInterceptor=void 0,this.allowDefault=void 0,this.scrollerLocked=!1,this.showPersonalizedFilter=!1,this.personalizedFilterId=void 0,this.isFilterModalOpen=!1}hasValidValue(t){var i,e;return null!=t.value&&(t.type===y.PERIOD?!!(null===(i=t.value)||void 0===i?void 0:i.start)||!!(null===(e=t.value)||void 0===e?void 0:e.end):!!t.groupedItems||!Array.isArray(t.value)||t.value.some((t=>!0===t.check)))}observeFilterConfig(t,i){o.equals(t,i)||this.handleFilterConfigsChanged(i,t)}handleFilterConfigsChanged(t,i){if(null!=t&&null==i)this._loadingPending=!0,this._configUpdated=!0;else{const e=new Map(t?t.map((t=>[t.id,t])):void 0);0===e.size&&i.length>0?(this._loadingPending=!0,this._configUpdated=!1):i.forEach((t=>{const i=e.get(t.id);if(null!=i){if(this._configUpdated=this._configUpdated||o.objectToString(i)!=o.objectToString(t),this._loadingPending=this._loadingPending||o.objectToString(i.value)!==o.objectToString(t.value),!this._loadingPending){const e=o.objectToString(i.groupedItems)!=o.objectToString(t.groupedItems);this._configUpdated=this._configUpdated||e,this._loadingPending=this._loadingPending||e}}else this._configUpdated=!0,this._loadingPending=this._loadingPending||null!=t.value}))}(this._loadingPending||this._configUpdated)&&this.configUpdated.emit(i),this.processAfterUpdateConfig()}async reload(){this.loadConfigFromStorage(!0)}async getFilterItem(t){const i=this.filterConfig.find((i=>i.id===t));return Promise.resolve(o.copy(i))}async updateFilterItem(t){return-1==this.filterConfig.findIndex((i=>i.id===t.id))?(console.warn("[SnkFilterBar.updateFilterItem] "+this.getMessage("snkFilterBar.filterItem.updateFilterItemNotFound")),Promise.resolve()):(this._loadingPending=!0,this.updateFilter(t),Promise.resolve())}async addFilterItem(t){return this.filterConfig.findIndex((i=>i.id===t.id))>-1?(console.warn("[SnkFilterBar.addFilterItem] "+this.getMessage("snkFilterBar.filterItem.addFilterItemExists")),Promise.resolve()):(this.filterConfig.push(t),this._loadingPending=!0,this.updateFilter(t),Promise.resolve())}async removeFilterItem(t){const i=this.filterConfig.findIndex((i=>i.id===t));if(-1==i)return console.warn("[SnkFilterBar.removeFilterItem] "+this.getMessage("snkFilterBar.filterItem.removeFilterItemNotFound")),Promise.resolve(void 0);const e=this.filterConfig[i];return this.filterConfig=this.filterConfig.filter((i=>i.id!==t)),Promise.resolve(e)}componentDidLoad(){this._element&&h.addIDInfo(this._element,null,{dataUnit:this.dataUnit})}processPendingFilter(){if(this._pendingVariables){const t=this._element.querySelector("#filter-PERSONALIZED_FILTER_GROUP");t&&t.showUp(!0).then((()=>{this.processAfterUpdateConfig()}))}else this.processAfterUpdateConfig()}getPersonalizedFilterItem(){return this.filterConfig.find((t=>t.type===y.PERSONALIZED))}async processAfterUpdateConfig(){var t;if(this._loadingPending){if(await this._application.isLoadedByPk()&&!this._configUpdated)return;const t=this.getPersonalizedFilterItem();if(this._pendingVariables=!F.validateVariableValues(t),this._pendingVariables)return;this._loadingPending=!1,this.doLoadData()}this._configUpdated&&(this._configUpdated=!1,_.saveFilterBarConfig(this.filterConfig,this.configName,this.resourceID),null===(t=this.afterApplyConfig)||void 0===t||t.call(this))}async doLoadData(t=!1){try{if(this._firstLoad&&!1===this.autoLoad)return;if(this._firstLoad&&!t&&void 0===this.autoLoad&&!await this._application.getBooleanParam("global.carregar.registros.iniciar.tela"))return;this.dataUnit.loadData(void 0,void 0,!0)}finally{this._firstLoad=!1}}getMessage(t,i,e){var s;return null==this.messagesBuilder&&this._application&&(this.messagesBuilder=this._application.messagesBuilder),(null===(s=this.messagesBuilder)||void 0===s?void 0:s.getMessage(t,i))||e}async getFilters(){return this.getFilter(null)}getFilter(t){var i;const e=[];return null===(i=this.filterConfig)||void 0===i||i.filter((t=>this.isActiveFilter(t))).forEach((t=>{const i=(t=>{switch(t.type){case y.DEFAULT_FILTER:return function(t){return{name:t.id,expression:t.props.expression,params:[]}}(t);case y.BINARY_SELECT:return function(t){const{id:i,value:e,props:s}=t;return{name:i,expression:s.options.find((t=>t.name===e)).expression,params:[]}}(t);case y.MULTI_SELECT:return function(t){const{id:i,value:e,props:s}=t;return{name:i,expression:s.expression,params:[{name:i,dataType:a.TEXT,value:e}]}}(t);case y.MULTI_LIST:return function(t){const{id:i,value:e,props:s}=t,r=(null!==(o=null!==(n=null==(l=e)?void 0:l.elements)&&void 0!==n?n:null==l?void 0:l.members)&&void 0!==o?o:l).filter((t=>null==t?void 0:t.check)).map((({id:t})=>Number.isNaN(+t)?String(t):Number(t)));var l,n,o;if(r.length>0)return{name:i,expression:s.expression,params:[{name:i,dataType:a.TEXT,value:JSON.stringify(r)}]}}(t);case y.PERIOD:return function(t){const{id:i,value:e,props:s}=t;let{end:r,start:l}=e;"string"==typeof r&&(r=new Date(r)),"string"==typeof l&&(l=new Date(l));const n=[];let o;return r&&l?(o=s.expression.fullfill,n.push({name:`${i}.START`,dataType:a.DATE,value:z(a.DATE,l)},{name:`${i}.END`,dataType:a.DATE,value:z(a.DATE,r)})):l?(o=s.expression.onlystart,n.push({name:i,dataType:a.DATE,value:z(a.DATE,l)})):(o=s.expression.onlyend,n.push({name:i,dataType:a.DATE,value:z(a.DATE,r)})),{name:i,expression:o,params:n}}(t);case y.SEARCH:return function(t){const{id:i,value:e,props:s}=t;return{name:i,expression:s.expression,params:[{name:i,dataType:a.TEXT,value:z(a.TEXT,null==e?void 0:e.value)}]}}(t);case y.TEXT:return function(t){let{id:i,value:e,props:s}=t;const r=s.expression;var l,o;return n.isEmpty(s.likeAs)||(l=e,e="CONTANIS"===(o=s.likeAs)?`%${l}%`:"STARTS_WITH"===o?`${l}%`:"ENDS_WITH"===o?`%${l}`:l),{name:i,expression:r,params:[{name:i,dataType:a.TEXT,value:z(a.TEXT,e)}]}}(t);case y.NUMBER:return function(t){const{id:i,value:e,props:s}=t;if(s.variation===C.INTERVAL){const{start:t,end:r}=null!=e?e:{start:0,end:0};if(!isNaN(t)&&!isNaN(r))return{name:i,expression:s.intervalExpression.fullfill,params:[{name:`${i}.START`,dataType:a.NUMBER,value:z(a.NUMBER,t)},{name:`${i}.END`,dataType:a.NUMBER,value:z(a.NUMBER,r)}]};if(!isNaN(t))return{name:i,expression:s.intervalExpression.onlystart,params:[{name:i,dataType:a.NUMBER,value:z(a.NUMBER,t)}]};if(!isNaN(r))return{name:i,expression:s.intervalExpression.onlyend,params:[{name:i,dataType:a.NUMBER,value:z(a.NUMBER,r)}]}}return{name:i,expression:s.expression,params:[{name:i,dataType:a.NUMBER,value:z(a.NUMBER,e)}]}}(t);case y.PERSONALIZED:return function(t){const{id:i,groupedItems:e=[]}=t,s=e.filter((t=>!!t.visible)).map((t=>{var i;const e=t.props.expression,s=((null===(i=t.props.personalizedFilter)||void 0===i?void 0:i.parameters)||[]).map(((i,e)=>{const s=Array.from(t.value||0),r=i.dataType;let l=e>=0&&e<s.length?s[e]:null;return null!=l&&"object"==typeof l&&"value"in l&&(l=l.value),null==l&&r===a.BOOLEAN&&(l=!1),{name:i.name,dataType:r,value:"string"==typeof l?l:z(r,l)}}));return{expression:e,name:t.id,params:s}}));return{name:i,expression:s.map((t=>`(${t.expression})`)).join(` ${x.AND} `),params:s.flatMap((t=>t.params))}}(t);case y.CHECK_BOX_LIST:return function(t){var i;const{id:e,value:s,props:r}=t,l=Object.entries(null!=s?s:{}).filter((([t,i])=>!0===i)).map((([t,i])=>t));return{name:e,expression:A(null===(i=r.options)||void 0===i?void 0:i.filter((t=>l.includes(t.name)))),params:[]}}(t);default:return}})(t);i&&e.push(i)})),e}isActiveFilter(t){return t.type===y.DEFAULT_FILTER||this.filterActiveFilter(t)&&this.hasValidValue(t)}async registryFilterProvider(){this.dataUnit.addFilterProvider(this),this.filterConfig&&await this.doLoadData()}itemFocused(t){this._element.querySelectorAll("snk-filter-item,snk-filter-list").forEach((i=>{i.id===t?"snk-filter-item"===i.tagName.toLowerCase()&&i.getClientRects()[0].x<0&&i.scrollIntoView({behavior:"auto",inline:"nearest"}):i.hideDetail()}))}filterActiveFilter(t){return t.visible||t.removalBlocked}filterPersonalizedItems(t){return t.type===y.PERSONALIZED}getPersonalizedFilterVariableItems(){return this.filterConfig.filter(this.filterPersonalizedItems).map((t=>{const i=`filter-${t.id}`;return e("snk-filter-item",{key:t.id,id:i,config:Object.assign({},t),onFocusin:()=>this.itemFocused(i),onVisibleChanged:t=>this.scrollerLocked=t.detail,onFilterChange:t=>this.updateFilter(t.detail),getMessage:(t,i)=>this.getMessage(t,i),showChips:!1})}))}getFilterItems(){const t=[],i=[];this.filterConfig.sort(((t,i)=>this._filtersComparator(t,i))).filter(this.filterActiveFilter).forEach((s=>{const r=`filter-${(s=o.copy(s)).id}`,l=e("snk-filter-item",{onVisibleChanged:t=>this.scrollerLocked=t.detail,onFilterChange:t=>this.updateFilter(t.detail),onFocusin:()=>this.itemFocused(r),id:r,config:s,class:"ez-margin-horizontal--extra-small",getMessage:(t,i)=>this.getMessage(t,i),key:s.id});return s.fixed||s.hardFixed||s.required?t.push(l):i.push(l),l}));const s=[];return s.push(...t.reverse()),t.length>0&&i.length>0&&s.push(e("hr",{class:"ez-margin-horizontal--small ez-margin-vertical--auto ez-divider-vertical ez-divider--dark snk-filter-bar__divider"})),s.push(...i),s}calculateUpdateSequence(t){t&&(this._updateSequence=this._updateSequence.filter((i=>t.id!==i)),this._updateSequence.push(t.id))}normalizeItem(t){const i=Object.assign({},t);return["props","value","hardFixed","fixed"].forEach((t=>{null==i[t]&&delete i[t]})),""===t.value&&delete t.value,i}updateFilter(t){let i=this.filterConfig.map((i=>(t=this.normalizeItem(t),i.id===t.id?(o.objectToString(i)!=o.objectToString(t)&&this.calculateUpdateSequence(t),t):i))).sort(((t,i)=>this._filtersComparator(t,i)));this.filterCustomConfigInterceptor&&(i=this.filterCustomConfigInterceptor(i)),this.filterConfig=i}loadPermitions(){this._application.isUserSup().then((t=>this.allowDefault=t))}addFilterBarLegacyConfigName(){this.filterBarLegacyConfigName&&_.addFilterBarLegacyConfig(this.configName,this.filterBarLegacyConfigName)}async loadConfigFromStorage(t){try{let i;t&&await _.deleteFilterBarConfigCache(this.configName,this.resourceID),i=this.customFilterBarConfig?await this.customFilterBarConfig(this.configName,this.resourceID,{contextURI:this.dataUnit.name}):await _.loadFilterBarConfig(this.configName,this.resourceID,{contextURI:this.dataUnit.name}),this.filterCustomConfig&&(i=[...this.filterCustomConfig,...i]),this.filterCustomConfigInterceptor&&(i=this.filterCustomConfigInterceptor(i)),this.filterConfig=i.map((t=>this.normalizeItem(t))),this.filterConfig.sort(((t,i)=>this._filtersComparator(t,i)))}catch(t){throw new d(this.getMessage("snkFilterBar.failToLoadConfig"),t)}}async attachDataUnit(){if(null==this.dataUnit){let t=this._element.parentElement;for(;t;)if("SNK-DATA-UNIT"===t.tagName.toUpperCase()){const i=t;this.dataUnit=i.dataUnit,this.dataUnit?await this.registryFilterProvider():i.addEventListener("dataUnitReady",(async t=>{this.dataUnit=t.detail,await this.registryFilterProvider()}));break}t=t.parentElement}else await this.registryFilterProvider()}filterChangeListener(t){this.updateFilter(t.detail)}async showFilterModal(){this.isFilterModalOpen||(this.isFilterModalOpen=!0)}addPersonalizedFilter(t=!1){this.isFilterModalOpen=!1,this._isDefaultFilter=t,this.personalizedFilterId=void 0,this.showPersonalizedFilter=!0,window.requestAnimationFrame((()=>{this._elPersonalizedFilter.createPersonalizedFilter()}))}editPersonalizedFilter(t,i=!1){this.isFilterModalOpen=!1,this._isDefaultFilter=i,this.showPersonalizedFilter=!0,this.personalizedFilterId=t}deletePersonalizedFilter(t,i,e,s=!1){if(s)return _.removeDefaultFilter(t,this.resourceID,e),void(this._isDefaultFilter=!1);i===y.PERSONALIZED&&_.removePersonalizedFilter(t,this.resourceID,e)}closeFilterModal(){this.isFilterModalOpen=!1}applyFiltersFromModal(t){var i;this.filterConfig=t.map(this.normalizeItem).sort(((t,i)=>this._filtersComparator(t,i))),null===(i=this.afterApplyConfig)||void 0===i||i.call(this),this.isFilterModalOpen=!1}handleHidePersonalizedFilter(t){t?this.loadConfigFromStorage().then((()=>{this.hidePersonalizedFilter()})):this.hidePersonalizedFilter()}hidePersonalizedFilter(){this.personalizedFilterId=void 0,this.showPersonalizedFilter=!1,this._isDefaultFilter=!1}async componentWillLoad(){var t;try{if(this._application=c.getContextValue("__SNK__APPLICATION__"),await this.attachDataUnit(),this._application){if(this._application.enableLockManagerLoadingApp&&this.enableLockManagerLoadingComp){const t=u.addLockManagerCtxId(this._element);this._resolveLoading=u.lock(t,f.APP_LOADING)}await Promise.all([this.loadPermitions(),this.addFilterBarLegacyConfigName(),this.loadConfigFromStorage()])}}finally{null===(t=this._resolveLoading)||void 0===t||t.call(this)}}componentDidRender(){this.processPendingFilter()}render(){if(!this.dataUnit||!this.filterConfig||0===this.filterConfig.length)return;if(this.showPersonalizedFilter)return e("snk-personalized-filter",{class:"filter-bar__personalized-filter",filterId:this.personalizedFilterId,ref:t=>this._elPersonalizedFilter=t,isDefaultFilter:this._isDefaultFilter,onEzCancel:()=>this.handleHidePersonalizedFilter(!1),onEzAfterSave:()=>this.handleHidePersonalizedFilter(!0),entityUri:this.dataUnit.name,configName:this.configName,resourceID:this.resourceID});let t=o.copy(this.filterConfig);return t=t.sort(((t,i)=>t.originOrder-i.originOrder)),"regular"!==this.mode?e(s,{"data-mode":this.mode},this.getPersonalizedFilterVariableItems(),"button"===this.mode&&e("ez-button",{class:"ez-margin-left--medium",size:"small",label:this.getMessage("snkFilterBar.filters",void 0,this.getMessage("snkFilterBar.filters")),onClick:this.showFilterModal.bind(this)}),e("snk-filter-modal",{opened:this.isFilterModalOpen,filterConfig:this.filterConfig,configName:this.configName,disablePersonalizedFilter:this.disablePersonalizedFilter,getMessage:(t,i)=>this.getMessage(t,i),applyFilters:t=>this.applyFiltersFromModal(t),closeModal:()=>this.closeFilterModal(),addPersonalizedFilter:t=>this.addPersonalizedFilter(t),editPersonalizedFilter:(t,i)=>this.editPersonalizedFilter(t,i),deletePersonalizedFilter:(t,i,e)=>this.deletePersonalizedFilter(t,y.PERSONALIZED,i,e),filterCustomConfigInterceptor:this.filterCustomConfigInterceptor})):e(s,null,e("div",null,e("span",{class:"snk-filter-bar__title",title:this.title,"data-tooltip":this.title,"data-flow":"bottom"},this.title)),e("ez-scroller",{class:"snk-filter-bar__scroller",direction:k.HORIZONTAL,activeShadow:!0,locked:this.scrollerLocked},e("section",{class:"snk-filter-bar__filter-item-container"},this.getFilterItems())),e("ez-button",{class:"ez-padding-left--medium ez-margin-top--extra-small",size:"small",label:this.getMessage("snkFilterBar.filters",void 0,this.getMessage("snkFilterBar.filters")),onClick:this.showFilterModal.bind(this)},e("ez-icon",{slot:"leftIcon",iconName:"plus",class:"ez-padding-right--small"})),e("snk-filter-modal",{opened:this.isFilterModalOpen,filterConfig:this.filterConfig,configName:this.configName,disablePersonalizedFilter:this.disablePersonalizedFilter,getMessage:(t,i)=>this.getMessage(t,i),applyFilters:t=>this.applyFiltersFromModal(t),closeModal:()=>this.closeFilterModal(),addPersonalizedFilter:t=>this.addPersonalizedFilter(t),editPersonalizedFilter:(t,i)=>this.editPersonalizedFilter(t,i),deletePersonalizedFilter:(t,i,e)=>this.deletePersonalizedFilter(t,y.PERSONALIZED,i,e),filterCustomConfigInterceptor:this.filterCustomConfigInterceptor}))}get _element(){return r(this)}static get watchers(){return{filterConfig:["observeFilterConfig"]}}};P.style='.sc-snk-filter-bar-h{display:grid;grid-template-columns:1fr minmax(100px, 100%) 1fr 1fr;--snk-personalized-filter--z-index:var(--elevation--20, 20);--snk-personalized-filter--background-color:var(--background--xlight, #fff)}.snk-filter-bar__title.sc-snk-filter-bar{max-width:260px;display:inline-block;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:16px;font-family:var(--font-pattern, Arial);font-weight:var(--text-weight--large, 600);color:var(--color--title-primary, #2B3A54);margin-top:12px}[data-mode="hidden"].sc-snk-filter-bar-h{width:0px;height:0px}[data-mode="button"].sc-snk-filter-bar-h{grid-template-columns:1fr;width:fit-content}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.filter-bar__personalized-filter.sc-snk-filter-bar{display:flex;flex-direction:column;position:fixed;top:0;left:0;width:100%;height:100%;overflow:auto;z-index:var(--snk-personalized-filter--z-index);background-color:var(--snk-personalized-filter--background-color)}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;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);height:80%}.snk-filter-bar__filter-item-container.sc-snk-filter-bar{display:flex;align-items:start;margin:var(--space--2, 2px) 0}.snk-filter-bar__scroller.sc-snk-filter-bar .sc-snk-filter-bar:first-child{margin-left:var(--space-extra-small, 3px)}.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%}';const D=class{constructor(e){t(this,e),this.visibleChanged=i(this,"visibleChanged",7),this.filterChange=i(this,"filterChange",3),this._keyboardManager=void 0,this.detailIsVisible=void 0,this.config=void 0,this.getMessage=void 0,this.showChips=!0}observeDetailIsVisible(t){this.visibleChanged.emit(t)}filterChangeListener(){this.hideDetail()}async showUp(t=!1){var i;this._filterItemElement.scrollIntoView({behavior:"auto",block:"nearest",inline:"nearest"}),t&&(await(null===(i=this._chipElement)||void 0===i?void 0:i.setBlur()),await this._popover.showUnder(this._chipElement),await this._filterDetail.setFocusField())}async hideDetail(){var t;await(null===(t=this._popover)||void 0===t?void 0:t.hide())}getConfigChanges(){var t;const i=this.config;(null===(t=i.groupedItems)||void 0===t?void 0:t.length)&&(i.visible=!1,i.groupedItems=i.groupedItems.map((t=>Object.assign(Object.assign({},t),{visible:!1}))));const e=i.type===y.MULTI_LIST&&Array.isArray(i.value)?i.value.map((t=>Object.assign(Object.assign({},t),{check:!1}))):void 0;return Object.assign(Object.assign({},i),{value:e})}clearFilter(t){if(null==t||t.stopPropagation(),this.canClearFilter()){const t=this.getConfigChanges();this.filterChange.emit(t)}else this.togglePopover(t)}async togglePopover(t){null==t||t.preventDefault(),null==t||t.stopPropagation(),!1!==this.config.enabled&&(this.detailIsVisible?await this.hideDetail():await this.showUp(!0))}getLabel(t=!1){var i,e;const{type:s,value:r,label:l,props:a,groupedItems:n=[]}=this.config;if(r||n.length){if(s===y.BINARY_SELECT){const[i,e]=a.options,s=this.getMessage("snkFilterBar.binarySelectTooltip");if(i.name===r)return t?`${s} ${String(i.label).toLowerCase()}`:i.label;if(e.name===r)return t?`${s} ${String(e.label).toLowerCase()}`:e.label}if(s===y.MULTI_SELECT)return`${l}: ${a.options.find((t=>t.value===r)).label}`;if(s===y.PERIOD){let{end:i,start:e}=r;"string"==typeof i&&(i=new Date(i),i.setMinutes(i.getMinutes()+i.getTimezoneOffset())),"string"==typeof e&&(e=new Date(e),e.setMinutes(e.getMinutes()+e.getTimezoneOffset()));const s=new Intl.DateTimeFormat("pt-BR");if(i&&e){const s=e.getFullYear()===i.getFullYear(),r=Object.assign({day:"2-digit",month:"2-digit"},(!s||t)&&{year:"2-digit"}),a=m.formatDate(e,r),n=m.formatDate(i,r);return t?this.getMessage("snkFilterBar.fullPeriodTooltip",{LABEL:l,START_LABEL:a,END_LABEL:n}):`${l}: ${a} → ${n}`}return e?`${l}: ${this.getMessage("snkFilterBar.onlyStartToltip")} ${s.format(e)}`:i?`${l}: ${this.getMessage("snkFilterBar.onlyEndToltip")} ${s.format(i)}`:l}if(s===y.SEARCH)return`${l}: ${r.value} - ${r.label}`;if(s===y.PERSONALIZED){const t=this.calculateActiveCount(n);return t<=0?l:`${l}: ${this.getMessage("snkFilterBar.personalizedCount",{activeCount:t})}`}if(s===y.MULTI_LIST){const e=(null!==(i=r.elements)&&void 0!==i?i:r).filter((t=>null==t?void 0:t.check));return this.getLabelFromCheckedOptions(e,l,t)}if(s===y.CHECK_BOX_LIST){const i=Object.entries(null!=r?r:{}).filter((([t,i])=>!0===i)).map((([t,i])=>t)),s=(null!==(e=a.options)&&void 0!==e?e:[]).filter((t=>i.includes(t.name)));return this.getLabelFromCheckedOptions(s,l,t)}if(s===y.NUMBER&&a.variation===C.INTERVAL){const{start:t,end:i}=r;if(!isNaN(t)&&!isNaN(i))return this.getMessage("snkFilterBar.fullIntervalTooltip",{LABEL:l,START_LABEL:t,END_LABEL:i});if(!isNaN(t))return`${l}: ${this.getMessage("snkFilterBar.onlyStartToltip")} ${Number(t)}`;if(!isNaN(i))return`${l}: ${this.getMessage("snkFilterBar.onlyEndToltip")} ${Number(i)}`}return this.config.mask?`${l}: ${new p(this.config.mask).format(r)}`:`${l}: ${r}`}return l}getLabelFromCheckedOptions(t,i,e){const s=t.length;return 0===s?`${i}`:s>1?e?`${i}: ${t.map((t=>t.label)).join(",")}`:`${i}: ${s} ${this.getMessage("snkFilterBar.multiListToltip")}`:`${i}: ${t[0].label}`}calculateActiveCount(t){return t.reduce(((t,i)=>i.visible?t+1:t),0)}componentDidLoad(){this._filterItemElement&&(h.addIDInfo(this._filterItemElement),this._idSnkFilterDetail=`filterDetail_${this.config.id}`)}canClearFilter(){const{value:t,groupedItems:i=[]}=this.config;return null!=t&&this.config.type===y.MULTI_LIST?t.some((t=>t.check)):void 0!==t||i.some((t=>t.visible))}getRightIconName(){return this.canClearFilter()?"close":this.detailIsVisible?"chevron-up":"chevron-down"}getLeftIconName(){switch(this.config.type){case y.PERIOD:return"calendar";case y.PERSONALIZED:return"tune"}}hasActiveElements(t){var i;const e=Array.isArray(t)?t:null==t?void 0:t.elements;return(null===(i=null==e?void 0:e.filter((t=>null==t?void 0:t.check)))||void 0===i?void 0:i.length)>0}hasActiveValue(t){var i,e;return t.type===y.PERIOD?!!(null===(i=t.value)||void 0===i?void 0:i.start)||!!(null===(e=t.value)||void 0===e?void 0:e.end):t.type!==y.MULTI_LIST&&void 0!==t.value||this.hasActiveElements(t.value)}getEnabledChip(){if(this.detailIsVisible)return!0;if(this.config.type===y.PERSONALIZED){const{groupedItems:t=[]}=this.config;return t.some((t=>t.visible))}return this.hasActiveValue(this.config)}async handleVisibilityPopover(t){this.detailIsVisible=t.detail,this.detailIsVisible||await this._filterDetail.clearValue()}getCustomMessage(t,i){var e;return null===(e=this.getMessage)||void 0===e?void 0:e.call(this,`snkFilterBar.filterModal.${t}`,i)}hasValue(){return this.config.type===y.MULTI_LIST?this.hasActiveElements(this.config.value):null!=this.config.value}getTooltipMessage(){var t,i;return this.config.required&&!this.hasValue()?{message:null!==(t=this.config.requiredMessage)&&void 0!==t?t:this.getCustomMessage("validations.requiredFilter"),type:"error"}:!1===this.config.enabled&&this.config.disabledMessage?{message:this.config.disabledMessage,type:"warning"}:{message:null!==(i=this.config.defaultMessage)&&void 0!==i?i:this.getLabel(!0),type:"default"}}getTypeChip(t){switch(t){case"default":return"secondary";case"warning":return"warning-light";case"error":return"error-light";case"success":return"success-light";default:return t}}initKeyboardManager(){this._keyboardManager=new v({element:this._filterItemElement,propagate:!0}),this._keyboardManager.bind("Escape",(()=>this.hideDetail()))}connectedCallback(){this.initKeyboardManager()}disconnectedCallback(){this._keyboardManager.unbindAllShortcutKeys()}render(){const t=this.getLeftIconName(),{type:i,message:r}=this.getTooltipMessage();return e(s,null,this.showChips&&e("ez-tooltip",{id:this.config.id,message:r,type:i,active:!this.detailIsVisible,strategy:"fixed"},e("ez-chip",{id:this.config.id,ref:t=>this._chipElement=t,label:this.getLabel(),value:this.getEnabledChip(),onClick:t=>this.togglePopover(t),disableAutoUpdateValue:!0,type:this.getTypeChip(i),enabled:this.config.enabled},t&&e("ez-icon",{ref:t=>this._leftIconElement=t,iconName:t,slot:"leftIcon"}),e("ez-icon",{ref:t=>this._rightIconElement=t,iconName:this.getRightIconName(),slot:"rightIcon",id:"removeFilter",onClick:t=>this.clearFilter(t)}))),e("ez-popover-core",{ref:t=>this._popover=t,onEzVisibilityChange:t=>this.handleVisibilityPopover(t)},e("snk-filter-detail",{ref:t=>this._filterDetail=t,key:this.config.id,config:this.config,getMessage:this.getMessage,class:"sc-snk-filter-bar snk-filter__popover ez-padding--small ez-elevation--16","data-element-id":this._idSnkFilterDetail,showHardFixed:this.showChips&&!this.config.required,removalBlocked:this.config.required})))}get _filterItemElement(){return r(this)}static get watchers(){return{detailIsVisible:["observeDetailIsVisible"]}}};D.style="ez-popover-core.sc-snk-filter-item{--ez-popover__box--z-index:var(--elevation--20, 20);--ez-popover__box--overlay-z-index:var(--elevation--16, 16)}ez-chip.sc-snk-filter-item{--ez-label-chip__label__container--margin:var(--space--2, 2px)}";const S="__SHOWMORE__",B=class{constructor(e){t(this,e),this.snkItemSelected=i(this,"snkItemSelected",7),this._preselection=-1,this.innerClickCheck=(t,i)=>i.id!=b.MODAL_ELEMENT_ID||(this._detailIsVisible=!1,!1),this._filterArgument=void 0,this._showAll=void 0,this.label=void 0,this.iconName=void 0,this.items=void 0,this.getMessage=void 0,this.emptyText=void 0,this.findFilterText=void 0,this.buttonClass=void 0}showDetail(){this._preselection=-1,this._floatingID=b.float(this._popover,this._popoverContainer,{autoClose:!0,innerClickTest:this.innerClickCheck,backClickListener:()=>this.onListCloseCallback(),useOverlay:!0}),this._detailIsVisible=!0,this._showAll=!1,this._filterArgument="",this._filterInput.setFocus()}async hideDetail(){null!=this._floatingID&&b.close(this._floatingID)}onListCloseCallback(){this._floatingID=void 0,this._detailIsVisible=!1}buttonClick(){this._detailIsVisible?this.hideDetail():this.showDetail()}componentDidLoad(){this._element&&h.addIDInfo(this._element)}componentDidRender(){null==this._floatingID&&this._popover&&this._popover.remove()}buildIdElement(t,i){if(!t)return;const e={id:i};t.removeAttribute(h.DATA_ELEMENT_ID_ATTRIBUTE_NAME),h.addIDInfoIfNotExists(t,"filterItemList",e)}buildItemElement(t){const i=++this._selectableItemsCount;return e("button",{ref:i=>i&&this.buildIdElement(i,t.label),id:`filter-item${i}`,onFocusin:()=>this._preselection=i,class:"ez-col ez-col--sd-12 ez-align--middle ez-padding--small sc-snk-filter-bar snk-filter-bar__filter-list-item",onClick:()=>this.itemSelected(t.name),name:t.label,key:i},t.iconName?e("ez-icon",{iconName:t.iconName,size:"small",class:`ez-padding-right--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__icon ${t.iconClass||""}`}):void 0,e("div",{class:`ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__label ${t.labelClass||""}`},t.label))}itemSelected(t){t===S?this._showAll=!0:(this.hideDetail(),this.snkItemSelected.emit(t))}getFilterItems(){const t=this.items?g.applyStringFilter(this._filterArgument,this.items.filter((t=>"FILTER"===t.kind))):[];return 0===t.length?e("div",{class:"ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-items-container--empty"},this.emptyText):(!this._filterArgument&&!this._showAll&&t.length>6&&(t.splice(5),t.push({kind:"INTERNAL",label:this.getMessage("snkFilterList.showMore"),iconName:"dots-horizontal",name:S,iconClass:"snk-filter-bar__filter-list-item__icon--secondary",labelClass:"snk-filter-bar__filter-list-item__label--secondary"})),this._selectableItemsCount=0,e("div",{class:"sc-snk-filter-bar snk-filter-bar__filter-list-items-container"},t.map((t=>this.buildItemElement(t)))))}getFooterItems(){return this.items.filter((t=>"FOOTER"===t.kind))}keyDownHandler(t){switch(t.key){case"ArrowDown":this.changePreselection(this._preselection+1),t.stopImmediatePropagation(),t.stopPropagation(),t.preventDefault();break;case"ArrowUp":this.changePreselection(this._preselection-1),t.stopImmediatePropagation(),t.stopPropagation(),t.preventDefault()}}changePreselection(t){if(t<0&&(t=this._selectableItemsCount),this._preselection=t>this._selectableItemsCount?0:t,0===this._preselection)this._filterInput.setFocus();else{const t=this._element.querySelector(`#filter-item${this._preselection}`);t&&t.focus()}}render(){return e(s,{class:"ez-flex ez-flex--column"},e("ez-button",{class:this.buttonClass,label:this.label,onClick:()=>this.buttonClick(),mode:this.iconName?"icon":void 0,iconName:this.iconName,size:"small"},e("slot",{name:"leftIcon"})),e("section",{class:"ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container",ref:t=>this._popoverContainer=t},e("div",{class:"sc-snk-filter-bar snk-filter__popover ez-padding--small ez-elevation--4",ref:t=>this._popover=t},e("ez-filter-input",{ref:t=>this._filterInput=t,"data-element-id":"serachFilters",mode:"slim",label:this.findFilterText,value:this._filterArgument,onEzChange:t=>this._filterArgument=t.detail,onFocus:()=>this._preselection=0}),this.getFilterItems(),e("hr",{class:"sc-snk-filter-bar snk-filter__popover-rule"}),this.items?this.getFooterItems().map((t=>this.buildItemElement(t))):void 0)))}get _element(){return r(this)}},E=class{constructor(i){t(this,i),this._isUserSup=!1,this.filters=[],this.filtersWithError=[],this.getMessage=void 0,this.configName=void 0,this.filterConfig=void 0,this.opened=!1,this.applyFilters=void 0,this.closeModal=void 0,this.addPersonalizedFilter=void 0,this.editPersonalizedFilter=void 0,this.deletePersonalizedFilter=void 0,this.filtersToDelete=[],this.filterDefaultToDelete=void 0,this.disablePersonalizedFilter=void 0,this.filterCustomConfigInterceptor=void 0}filterConfigChangeHandler(t){this.filters=o.copy(t),this.validateFilters()}deletePersonalizedFilterListener(t){this.filtersToDelete.push(t.detail)}getCustomMessage(t,i){var e;return null===(e=this.getMessage)||void 0===e?void 0:e.call(this,`snkFilterBar.filterModal.${t}`,i)}handleClearAll(){const{customFilters:t,quickFilters:i,otherFilters:e,multiListFilters:s}=this.filters.reduce(((t,i)=>i.type===y.MULTI_LIST?(t.multiListFilters.push(i),t):i.filterType===T.QUICK_FILTER?(t.quickFilters.push(i),t):i.filterType===T.CUSTOM_FILTER?(t.customFilters.push(i),t):i.filterType===T.OTHER_FILTERS?(t.otherFilters.push(i),t):t),{quickFilters:[],customFilters:[],otherFilters:[],multiListFilters:[]});this.handleClearFilterList(i),this.handleClearCustomFilters(t),this.handleClearOthersFilters(e),s.forEach((t=>this.handleClearSigleFilter(t))),l(this)}handleClearOthersFilters(t){this.filters=this.filters.map((i=>t.includes(i)?Object.assign(Object.assign({},i),{value:void 0}):i))}handleClearCustomFilters(t){this.filters.forEach(((i,e)=>{i.filterType===T.CUSTOM_FILTER&&(this.filters[e]=this.clearAllCustomFilter(t).shift())}))}clearAllCustomFilter(t){return t.map((t=>{const i=Object.assign({},t);return delete i.value,i.visible=!1,i.groupedItems&&(i.groupedItems=this.clearAllCustomFilter(i.groupedItems)),i}))}hasChangeToSave(){return o.objectToString(this.filters)!=o.objectToString(this.filters)}handleClose(){if(this.hasChangeToSave())return $.confirm(this.getCustomMessage("validations.notSaved.title"),this.getCustomMessage("validations.notSaved.message")).then((t=>{t&&this.closeModal()}));this.closeModal()}handleApplyFilters(){if(!this.validateFilters())return;const t=this.filters.find((t=>t.filterType===T.CUSTOM_FILTER||t.filterType===T.DEFAULT_FILTER));this.isValidCustomFilter(t)&&this.applyFilters(this.filters),this.filtersToDelete.length>0&&(this.filtersToDelete.forEach((t=>{this.deletePersonalizedFilter(t,this.configName)})),this.filtersToDelete=[]),this.filterDefaultToDelete&&(this.deletePersonalizedFilter(this.filterDefaultToDelete,this.configName,!0),this._defaultFilter=void 0,this.filterDefaultToDelete=void 0)}isValidCustomFilter(t){return!!F.validateVariableValues(t)||($.alert(this.getCustomMessage("validations.notFullFilled.title"),this.getCustomMessage("validations.notFullFilled.message")),!1)}modalActionListener(t){switch(t.detail){case I.CANCEL:this.handleClearAll();break;case I.OK:this.handleApplyFilters();break;case I.CLOSE:this.handleClose()}}handleFilterChange(t){t.stopPropagation();const i=t.detail;let e=this.filters.map((t=>t.id===i.id?i:t));this.filterCustomConfigInterceptor&&(e=this.filterCustomConfigInterceptor(e)),this.filters=o.copy(e)}handleClearFilterList(t){this.filters=this.filters.map((i=>t.includes(i)?Object.assign(Object.assign({},i),{value:void 0}):i))}handleClearSigleFilter(t){if(y.MULTI_LIST===t.type){let i=o.copy(t);this.uncheckFilterValues(i.value);const e=o.copy(this.filters),s=e.findIndex((i=>i.id===t.id));return e.splice(s,1,i),void(this.filters=o.copy(e))}if(y.CHECK_BOX_LIST===t.type){const i=o.copy(this.filters);return i.find((i=>i.id===t.id)).value=void 0,void(this.filters=o.copy(i))}this.filters.find((i=>i.id===t.id)).value=void 0,this.filters=o.copy(this.filters)}uncheckFilterValues(t){return t.forEach((t=>{t&&(t.check=!1)})),t}validateFilters(){const t=L(this.filters);return this.filtersWithError=t.map((t=>t.id)),0===t.length||(t.forEach((t=>{const i=this._element.querySelector(`#filter-item-${t.id}`);i&&(i.errorMessage=t.requiredMessage||this.getCustomMessage("validations.requiredFilter"))})),!1)}renderFilterItem(t,i){return e("snk-filter-modal-item",{key:`modal-item-${t.id}`,class:i?"ez-col ez-col--sd-12":"ez-col ez-col--sd-6 ez-padding--small",filterItem:t,configName:this.configName,onFilterChange:t=>this.handleFilterChange(t),onEditPersonalizedFilter:t=>this.editPersonalizedFilter(t.detail),onAddPersonalizedFilter:()=>this.addPersonalizedFilter()})}isDefaultFilterNumberVariation(t){var i;return t.type===y.NUMBER&&(!t.props.variation||(null===(i=t.props)||void 0===i?void 0:i.variation)===C.DEFAULT)}mountFiltersLines(t){let i=0,e=!1;const s={};for(let r=0;r<t.length;r++){s[i]=s[i]||[];const l=t[r],a=r===t.length-1,n=l.type===y.TEXT||this.isDefaultFilterNumberVariation(l),o=!a&&(t[r+1].type===y.TEXT||this.isDefaultFilterNumberVariation(t[r+1]));n&&o||e?(s[i].push(l),e=s[i].length<2,2===s[i].length&&++i):(s[i]=s[i]||[],s[i].push(l),++i)}return Object.values(s)}renderFilterLine(t){const i=1===t.length;return t.map((t=>this.renderFilterItem(t,i)))}getIformedFiltersCount(t){let i=0;return t.forEach((t=>{var e,s,r,l,a,n,o,h;const d=this.filterConfig.find((i=>i.id===t.id));y.MULTI_LIST!==d.type?y.CHECK_BOX_LIST!==d.type?y.PERIOD!==d.type?null==d.groupedItems?d.value&&i++:i=d.groupedItems.filter((t=>t.visible)).length:((null===(o=d.value)||void 0===o?void 0:o.start)||(null===(h=d.value)||void 0===h?void 0:h.end))&&i++:i+=Object.entries(null!==(n=d.value)&&void 0!==n?n:{}).filter((([t,i])=>!0===i)).map((([t,i])=>t)).length:i+=null!==(a=null===(l=null===(r=null!==(s=null===(e=d.value)||void 0===e?void 0:e.elements)&&void 0!==s?s:d.value)||void 0===r?void 0:r.filter((t=>null==t?void 0:t.check)))||void 0===l?void 0:l.length)&&void 0!==a?a:0})),i}renderCollapsibleFilterBox(t,i,s,r=!0){if(!i.length)return null;const l=this.getIformedFiltersCount(i),a=this.mountFiltersLines(i),n=this.filtersWithError.filter((t=>i.some((i=>i.id===t)))).length;return e("ez-collapsible-box",{class:"snk-filter-modal__collapsible-box",headerSize:"medium",value:!0,label:t},e("div",{class:"ez-flex ez-flex--justify-end grow",slot:"rightSlot"},!!l&&e("ez-badge",{class:"ez-badge--primary-subtle",label:null==l?void 0:l.toString()}),!!n&&e("ez-badge",{class:"ez-badge--error-subtle",label:null==n?void 0:n.toString()})),e("div",{class:"ez-row snk-filter-modal__rendered-items"},a.map(this.renderFilterLine.bind(this))),r&&e("div",{class:"ez-flex ez-flex--justify-end grow"},e("ez-button",{class:"ez-button--tertiary",size:"medium",label:this.getCustomMessage("clearModal"),onClick:()=>s?this.handleClearSigleFilter(i[0]):this.handleClearFilterList(i)})))}handleDeleteFilter(){this._application.confirm(this.getMessage("snkPersonalizedFilter.deleteConfirm.title"),this.getMessage("snkPersonalizedFilter.info.deleteDefaultFilterConfirm"),"alert-circle-inverted","critical").then((t=>{t&&(this.filterDefaultToDelete=this._defaultFilter,this.filters=this.filters.filter((t=>t.id!==T.DEFAULT_FILTER)))}))}handleActionSelectedDefaultFilter({detail:t}){switch(t){case N.CREATE:this.addPersonalizedFilter(!0);break;case N.EDIT:this.editPersonalizedFilter(this._defaultFilter.id,!0);break;case N.REMOVE:this.handleDeleteFilter()}}getCustomFilter(t){return t.filter((t=>t.filterType===T.CUSTOM_FILTER))}getDefaultFilter(t){return t.find((t=>t.id===w.id))}async componentWillLoad(){this._application=c.getContextValue("__SNK__APPLICATION__"),this._isUserSup=await this._application.isUserSup(),this.filters=o.copy(this.filterConfig)}componentWillRender(){this._modalTitle=this.getCustomMessage("title"),this._okButtonLabel=this.getCustomMessage("okButtonLabel"),this._cancelButtonLabel=this.getCustomMessage("cancelButtonLabel")}componentDidLoad(){this.validateFilters()}render(){this._defaultFilter=this._isUserSup?this.getDefaultFilter(this.filters):void 0;const t=this.getCustomFilter(this.filters),i=this.filters.filter((t=>t.filterType===T.QUICK_FILTER)),s=this.filters.filter((t=>t.filterType===T.OTHER_FILTERS));return e("ez-modal",{opened:this.opened,modalSize:"col--sd-3",align:"right",heightMode:"full",closeEsc:!0},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 ez-col--sd-12"},this._isUserSup&&e("snk-default-filter",{getMessage:this.getCustomMessage.bind(this),hasDefaultFilter:!!this._defaultFilter,onActionSelected:this.handleActionSelectedDefaultFilter.bind(this)}),!this.disablePersonalizedFilter&&this.renderCollapsibleFilterBox(this.getCustomMessage("customFilters"),t,!1,!1),this.renderCollapsibleFilterBox(this.getCustomMessage("quickFilters"),i,!1),s.map((t=>this.renderCollapsibleFilterBox(t.label,[t],!0))))))}get _element(){return r(this)}static get watchers(){return{filterConfig:["filterConfigChangeHandler"]}}};E.style="ez-modal{--ez-modal-content-padding:24px 12px}.snk-filter-modal__container{min-width:344px;overflow:hidden}.snk-filter-modal__content{display:flex;flex-direction:column;gap:var(--space--medium, 12px);padding-right:var(--space--3xs, 4px)}.snk-filter-modal__collapsible-box{border:var(--border--small, 1px solid) var(--color--strokes, #DCE0E8);border-radius:var(--border--radius-medium);padding:var(--space--medium, 12px) var(--space--small, 6px)}.snk-filter-modal__rendered-items{max-height:760px}.snk-filter-modal__rendered-items::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}";export{P as snk_filter_bar,D as snk_filter_item,B as snk_filter_list,E as snk_filter_modal}
@@ -1 +0,0 @@
1
- import{r as i,c as e,h as t,g as s}from"./p-82bb3eda.js";import{ObjectUtils as o,ArrayUtils as n}from"@sankhyalabs/core";import{ApplicationUtils as a}from"@sankhyalabs/ezui/dist/collection/utils";import{S as r}from"./p-51833248.js";import{a as d}from"./p-9019a32f.js";const l=class{constructor(t){i(this,t),this.guideSelected=e(this,"guideSelected",7),this.guideListChanged=e(this,"guideListChanged",7),this.guideDeleted=e(this,"guideDeleted",7),this.createNewGuide=e(this,"createNewGuide",7),this.ID_VISIBLE_GUIDES="container-visible-guides",this.ID_HIDDEN_GUIDES="container-hidden-guides",this.sortLogic=(i,e)=>{var t,s;return(null!==(t=i.order)&&void 0!==t?t:Number.MAX_VALUE)-(null!==(s=e.order)&&void 0!==s?s:Number.MAX_VALUE)},this.mainGuide=void 0,this.filterTerm="",this.visibleGuides=[],this.hiddenGuides=[],this.guidesList=[],this.selectedGuide=void 0,this.messagesBuilder=void 0}onMessagesBuilderChange(){this.setCustomCSSProperties()}observeVisibleGuides(i){this.initGuidesConfig(i)}observeSelectedGuide(i){this.guideSelected.emit(i)}getMessage(i,e){return this.messagesBuilder.getMessage(i,e)}initGuidesConfig(i){const e=[...i.filter((i=>i.visible&&i.name!==d.main))],t=[...i.filter((i=>!i.visible&&i.name!==d.main))];this.visibleGuides=[...e.sort(this.sortLogic)],this.hiddenGuides=[...t.sort(this.sortLogic)],this.mainGuide=i.find((i=>i.name===d.main))}handleAddGuide(){this.createNewGuide.emit()}handleSelectGuide(i,e){e.stopPropagation(),this.selectedGuide=i}toggleGuideVisibility(i,e){e.stopPropagation();const t=Object.assign(Object.assign({},i),{visible:!i.visible});let s,o;i.visible?(s=[...this.visibleGuides.filter((e=>e.name!==i.name))],o=[...this.hiddenGuides,t]):(s=[...this.visibleGuides,t],o=[...this.hiddenGuides.filter((e=>e.name!==i.name))]);const n=[...s,...o];this.applyGuidesUpdate(n)}adjustListOrder(i){return i.map(((i,e)=>Object.assign(Object.assign({},i),{order:e})))}applyGuidesUpdate(i){let e=this.adjustListOrder(i);e=[this.mainGuide,...e],o.equals(e,this.guidesList)||this.guideListChanged.emit(e)}async handleDeleteGuide(i,e){e.stopPropagation();const t=this.getMessage("snkFormConfig.confirm.title"),s=this.getMessage("snkFormConfig.confirm.deleteGuide").replace("{0}",i.label);if(!await a.confirm(t,s))return;this.guideDeleted.emit(i);const o=this.getMessage("snkFormConfig.info.successfullyGuideDeleted").replace("{0}",i.label);a.info(o)}renderItems(i){return n.applyStringFilter(this.filterTerm,i).map((i=>{var e;return t("div",{key:i.name,"data-guide-name":i.name,title:i.label,class:`guide-item ${(null===(e=this.selectedGuide)||void 0===e?void 0:e.label)===i.label?"selected":""} ${this.filterTerm.length?"disable-sort":""}`,onClick:e=>this.handleSelectGuide(i,e)},t("span",null,t("ez-icon",{iconName:"drag-indicator",class:"ez-margin-right--small"})),t("span",{class:"item-label"},i.label),t("div",{class:"actions"},t("ez-button",{mode:"icon",class:"ez-button--tertiary",onClick:e=>this.toggleGuideVisibility(i,e),size:"medium",iconName:i.visible?"eye-off":"eye",title:this.getMessage(i.visible?"snkFormConfig.guidesConfigurator.actions.hide":"snkFormConfig.guidesConfigurator.actions.show")}),t("ez-button",{mode:"icon",class:"ez-button--tertiary",onClick:e=>this.handleDeleteGuide(i,e),size:"medium",isDisabled:i.isCustom||i.isDetail,iconName:"delete",title:this.getMessage(i.isCustom||i.isDetail?"snkFormConfig.guidesConfigurator.canNotDeleteCustomGuide":"snkFormConfig.guidesConfigurator.actions.delete")})))}))}getContainerElement(i){return this.el.querySelector(`[id="${i}"]`)}handleSortGuide(){const i=[...this.getGuidesFromStatus(!0),...this.getGuidesFromStatus(!1)];this.applyGuidesUpdate(i)}getGuidesFromStatus(i){let e=[];return this.getOrderedGuideNames(i?this.ID_VISIBLE_GUIDES:this.ID_HIDDEN_GUIDES).forEach((t=>{const s=this.guidesList.find((i=>i.name===t));s&&e.push(Object.assign(Object.assign({},s),{visible:i}))})),e}getOrderedGuideNames(i){var e;const t=null===(e=this.getContainerElement(i))||void 0===e?void 0:e.children;return Array.from(t).map((i=>i.getAttribute("data-guide-name")))}initializeDraggableContainers(){this._sortableVisibleGuides=new r(this.getContainerElement(this.ID_VISIBLE_GUIDES),{group:"guides",ghostClass:"ghost",direction:"vertical",filter:".disable-sort",animation:15,onSort:()=>this.handleSortGuide()}),this._sortableInvisibleGuides=new r(this.getContainerElement(this.ID_HIDDEN_GUIDES),{group:"guides",ghostClass:"ghost",animation:15,filter:".disable-sort",onSort:()=>this.handleSortGuide()})}handleSelectMainGuide(){this.guideSelected.emit(this.mainGuide)}setCustomCSSProperties(){document.documentElement.style.setProperty("--no-hidden-guides-message",`"${this.getMessage("snkFormConfig.guidesConfigurator.noHiddenGuides")}"`),document.documentElement.style.setProperty("--no-visible-guides-message",`"${this.getMessage("snkFormConfig.guidesConfigurator.noVisibleGuides")}"`)}componentDidLoad(){this.initializeDraggableContainers(),this.initGuidesConfig(this.guidesList),this.setCustomCSSProperties()}render(){var i,e,s;return t("ez-sidebar-navigator",{class:"ezSidebarNavigator",type:"fixed",size:"md",titleMenu:this.getMessage("snkFormConfig.guidesConfigurator.title")},t("div",{class:"navigator-container"},t("ez-filter-input",{slot:"content",mode:"slim",label:this.getMessage("snkFormConfig.guidesConfigurator.searchGuide"),onEzChange:i=>this.filterTerm=i.detail}),t("div",{onClick:this.handleSelectMainGuide.bind(this),class:"main-guide "+((null===(i=this.selectedGuide)||void 0===i?void 0:i.name)===(null===(e=this.mainGuide)||void 0===e?void 0:e.name)?"selected":"")},t("span",null,null===(s=this.mainGuide)||void 0===s?void 0:s.label)),t("div",{class:"collapsible-container"},t("div",{class:"collapsible-item"},t("ez-collapsible-box",{label:this.getMessage("snkFormConfig.guidesConfigurator.visibleGuides"),headerSize:"large"},t("div",{id:this.ID_VISIBLE_GUIDES,class:"guide-list "+(this.visibleGuides.length?"":"visible-empty-content")},this.renderItems(this.visibleGuides)))),t("div",{class:"collapsible-item"},t("ez-collapsible-box",{label:this.getMessage("snkFormConfig.guidesConfigurator.hiddenGuides"),headerSize:"large"},t("div",{id:this.ID_HIDDEN_GUIDES,class:"guide-list "+(this.hiddenGuides.length?"":"hidden-empty-content")},this.renderItems(this.hiddenGuides))))),t("div",{class:"add-button-container",onClick:this.handleAddGuide.bind(this)},t("ez-icon",{slot:"leftIcon",iconName:"plus"}),t("span",null,this.getMessage("snkFormConfig.guidesConfigurator.createNewGuide")))))}get el(){return s(this)}static get watchers(){return{messagesBuilder:["onMessagesBuilderChange"],guidesList:["observeVisibleGuides"],selectedGuide:["observeSelectedGuide"]}}};l.style='.ezSidebarNavigator.sc-guides-configurator{--ez-sidebar-navigator--height:calc(100vh - 118px)}.navigator-container.sc-guides-configurator{height:calc(100vh - 175px);display:flex;flex-direction:column;justify-content:space-between}.collapsible-container.sc-guides-configurator{display:flex;flex-direction:column;gap:12px;flex-grow:1;max-height:calc(100vh - 240px);overflow:auto}.collapsible-item.sc-guides-configurator{padding:6px;border-radius:6px;border:1px solid #dce0e8}.add-button-container.sc-guides-configurator{display:flex;align-items:center;border-top:1px solid #dce0e8;padding-top:22px;gap:6px;cursor:pointer;justify-content:center}.add-button-container.sc-guides-configurator span.sc-guides-configurator{display:block}.guide-list.sc-guides-configurator{display:flex;flex-direction:column;width:100%;min-height:10px}.guide-list.hidden-empty-content.sc-guides-configurator::before{content:var(--no-hidden-guides-message, "Nenhuma guia oculta");display:block;font-size:16px;font-weight:400;color:#AFB6C0;margin:auto;padding:8px}.guide-list.visible-empty-content.sc-guides-configurator::before{content:var(--no-visible-guides-message, "Nenhuma guia visível");display:block;font-size:16px;font-weight:400;color:#AFB6C0;margin:auto;padding:8px}.item-label.sc-guides-configurator{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex-grow:1}.guide-item.sc-guides-configurator{margin:0 3px;display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:5px 10px;border-radius:6px;transition:all 0.2s ease-in-out;height:32px}.guide-item.sc-guides-configurator .actions.sc-guides-configurator{display:flex;gap:8px;transition:opacity 0.2s ease-in-out;display:none;opacity:0}.guide-item.sc-guides-configurator:hover .actions.sc-guides-configurator{display:flex;opacity:1}ez-button.sc-guides-configurator{width:24px;align-items:center;justify-content:center;display:flex}.ghost.sc-guides-configurator{opacity:.5;background:#e2eaf4}.main-guide.sc-guides-configurator{padding:12px;margin:12px 0;border:1px solid #dce0e8;border-radius:6px;transition:all 0.2s ease-in-out}.guide-item.selected.sc-guides-configurator,.main-guide.selected.sc-guides-configurator{background:#E2F4EF}.guide-item.sc-guides-configurator:hover,.main-guide.sc-guides-configurator:hover{background:#f5fcfa}';export{l as guides_configurator}
@@ -1 +0,0 @@
1
- import{r as t,c as e,h as i,H as s}from"./p-82bb3eda.js";import{A as r}from"./p-6a4b21dd.js";const l=class{constructor(i){t(this,i),this.actionSelected=e(this,"actionSelected",7),this.OFFSET_HEIGHT=5,this.getMessage=void 0,this.hasDefaultFilter=!1,this._opened=!1}repositionDropDown(){if(!this._refIcon||!this._refDropdown)return;const t=this._refIcon.getBoundingClientRect(),e=this._refDropdown.getBoundingClientRect();this._refDropdown.style.top=t.y+t.height+this.OFFSET_HEIGHT+"px",this._refDropdown.style.left=t.x+t.width/2-e.width+"px"}toggleDropdown(){this._opened=!this._opened}closeDropdown(t){const e=null==t?void 0:t.target;e&&(e.closest("#dropdown-parent-demo")||(this._opened=!1))}buildItems(){return[{id:r.EDIT,label:this.getMessage("defaultFilter.edit")},{id:r.REMOVE,label:this.getMessage("defaultFilter.remove")}]}onValueSelected({detail:t}){this._opened=!1,this.actionSelected.emit(t.id)}openCreateNewFilter(){this.actionSelected.emit(r.CREATE)}componentDidRender(){this.repositionDropDown()}componentWillLoad(){this._items=this.buildItems(),document.removeEventListener("scroll",this.repositionDropDown.bind(this)),document.addEventListener("scroll",this.repositionDropDown.bind(this))}render(){return this.hasDefaultFilter?i(s,null,i("button",{class:"default_container",onClick:this.toggleDropdown.bind(this)},i("span",null,this.getMessage("defaultFilter.title")),i("ez-icon",{ref:t=>this._refIcon=t,iconName:"dots-vertical"})),this._opened&&i("ez-dropdown",{ref:t=>this._refDropdown=t,items:this._items,onEzClick:this.onValueSelected.bind(this),onEzOutsideClick:this.closeDropdown.bind(this)})):i(s,null,i("button",{class:"default_container new_filter",onClick:this.openCreateNewFilter.bind(this)},i("span",null,this.getMessage("defaultFilter.create"))))}};l.style=".sc-snk-default-filter-h{display:flex;justify-content:flex-end}.default_container.sc-snk-default-filter{border:none;background:none;display:flex;align-items:center;gap:var(--space--3xs, 4px);font-family:var(--font-pattern);color:var(--title--primary, #2b3a54);font-size:var(--text--medium, 14px);padding:0;outline:none}.default_container.sc-snk-default-filter ez-icon.sc-snk-default-filter{cursor:pointer}.default_container.sc-snk-default-filter ez-icon.sc-snk-default-filter:hover{color:var(--color--primary-600)}.new_filter.sc-snk-default-filter{cursor:pointer;margin:0 var(--space--3xs, 4px)}.new_filter.sc-snk-default-filter:hover{color:var(--color--primary-600)}";export{l as snk_default_filter}
@@ -1,2 +0,0 @@
1
- let e,t,n,l=!1,o=!1,s=!1,c=null,i=!1;const r="http://www.w3.org/1999/xlink",f={},u=e=>"object"==(e=typeof e)||"function"===e,a=(e,t,...n)=>{let l=null,o=null,s=null,c=!1,i=!1;const r=[],f=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?f(l):null!=l&&"boolean"!=typeof l&&((c="function"!=typeof e&&!u(l))&&(l+=""),c&&i?r[r.length-1].t+=l:r.push(c?d(null,l):l),i=c)};if(f(n),t){t.key&&(o=t.key),t.name&&(s=t.name);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}}if("function"==typeof e)return e(null===t?{}:t,r,$);const a=d(e,null);return a.l=t,r.length>0&&(a.o=r),a.i=o,a.u=s,a},d=(e,t)=>({p:0,$:e,t,m:null,o:null,l:null,i:null,u:null}),p={},$={forEach:(e,t)=>e.map(m).forEach(t),map:(e,t)=>e.map(m).map(t).map(h)},m=e=>({vattrs:e.l,vchildren:e.o,vkey:e.i,vname:e.u,vtag:e.$,vtext:e.t}),h=e=>{if("function"==typeof e.vtag){const t=Object.assign({},e.vattrs);return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),a(e.vtag,t,...e.vchildren||[])}const t=d(e.vtag,e.vtext);return t.l=e.vattrs,t.o=e.vchildren,t.i=e.vkey,t.u=e.vname,t},y=e=>ie(e).h,b=(e,t,n)=>{const l=y(e);return{emit:e=>w(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},w=(e,t,n)=>{const l=ye.ce(t,n);return e.dispatchEvent(l),l},v=new WeakMap,k=e=>"sc-"+e.v,g=(e,t,n,l,o,s)=>{if(n!==l){let c=ue(e,t),i=t.toLowerCase();if("class"===t){const t=e.classList,o=j(n),s=j(l);t.remove(...o.filter((e=>e&&!s.includes(e)))),t.add(...s.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in n)l&&null!=l[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in l)n&&l[t]===n[t]||(t.includes("-")?e.style.setProperty(t,l[t]):e.style[t]=l[t])}else if("key"===t);else if("ref"===t)l&&l(e);else if(c||"o"!==t[0]||"n"!==t[1]){const f=u(l);if((c||f&&null!==l)&&!o)try{if(e.tagName.includes("-"))e[t]=l;else{const o=null==l?"":l;"list"===t?c=!1:null!=n&&e[t]==o||(e[t]=o)}}catch(e){}let a=!1;i!==(i=i.replace(/^xlink\:?/,""))&&(t=i,a=!0),null==l||!1===l?!1===l&&""!==e.getAttribute(t)||(a?e.removeAttributeNS(r,t):e.removeAttribute(t)):(!c||4&s||o)&&!f&&(l=!0===l?"":l,a?e.setAttributeNS(r,t,l):e.setAttribute(t,l))}else t="-"===t[2]?t.slice(3):ue(me,i)?i.slice(2):i[2]+t.slice(3),n&&ye.rel(e,t,n,!1),l&&ye.ael(e,t,l,!1)}},S=/\s/,j=e=>e?e.split(S):[],C=(e,t,n,l)=>{const o=11===t.m.nodeType&&t.m.host?t.m.host:t.m,s=e&&e.l||f,c=t.l||f;for(l in s)l in c||g(o,l,s[l],void 0,n,t.p);for(l in c)g(o,l,s[l],c[l],n,t.p)},M=(o,c,i,r)=>{const f=c.o[i];let u,a,d,p=0;if(l||(s=!0,"slot"===f.$&&(e&&r.classList.add(e+"-s"),f.p|=f.o?2:1)),null!==f.t)u=f.m=he.createTextNode(f.t);else if(1&f.p)u=f.m=he.createTextNode("");else if(u=f.m=he.createElement(2&f.p?"slot-fb":f.$),C(null,f,!1),null!=e&&u["s-si"]!==e&&u.classList.add(u["s-si"]=e),f.o)for(p=0;p<f.o.length;++p)a=M(o,f,p,u),a&&u.appendChild(a);return u["s-hn"]=n,3&f.p&&(u["s-sr"]=!0,u["s-cr"]=t,u["s-sn"]=f.u||"",d=o&&o.o&&o.o[i],d&&d.$===f.$&&o.m&&O(o.m,!1)),u},O=(e,t)=>{ye.p|=1;const l=e.childNodes;for(let e=l.length-1;e>=0;e--){const o=l[e];o["s-hn"]!==n&&o["s-ol"]&&(W(o).insertBefore(o,T(o)),o["s-ol"].remove(),o["s-ol"]=void 0,s=!0),t&&O(o,t)}ye.p&=-2},R=(e,t,l,o,s,c)=>{let i,r=e["s-cr"]&&e["s-cr"].parentNode||e;for(r.shadowRoot&&r.tagName===n&&(r=r.shadowRoot);s<=c;++s)o[s]&&(i=M(null,l,s,e),i&&(o[s].m=i,r.insertBefore(i,T(t))))},x=(e,t,n,l,s)=>{for(;t<=n;++t)(l=e[t])&&(s=l.m,F(l),o=!0,s["s-ol"]?s["s-ol"].remove():O(s,!0),s.remove())},P=(e,t)=>e.$===t.$&&("slot"===e.$?e.u===t.u:e.i===t.i),T=e=>e&&e["s-ol"]||e,W=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,E=(e,t)=>{const n=t.m=e.m,l=e.o,o=t.o,s=t.t;let c;null===s?("slot"===t.$||C(e,t,!1),null!==l&&null!==o?((e,t,n,l)=>{let o,s,c=0,i=0,r=0,f=0,u=t.length-1,a=t[0],d=t[u],p=l.length-1,$=l[0],m=l[p];for(;c<=u&&i<=p;)if(null==a)a=t[++c];else if(null==d)d=t[--u];else if(null==$)$=l[++i];else if(null==m)m=l[--p];else if(P(a,$))E(a,$),a=t[++c],$=l[++i];else if(P(d,m))E(d,m),d=t[--u],m=l[--p];else if(P(a,m))"slot"!==a.$&&"slot"!==m.$||O(a.m.parentNode,!1),E(a,m),e.insertBefore(a.m,d.m.nextSibling),a=t[++c],m=l[--p];else if(P(d,$))"slot"!==a.$&&"slot"!==m.$||O(d.m.parentNode,!1),E(d,$),e.insertBefore(d.m,a.m),d=t[--u],$=l[++i];else{for(r=-1,f=c;f<=u;++f)if(t[f]&&null!==t[f].i&&t[f].i===$.i){r=f;break}r>=0?(s=t[r],s.$!==$.$?o=M(t&&t[i],n,r,e):(E(s,$),t[r]=void 0,o=s.m),$=l[++i]):(o=M(t&&t[i],n,i,e),$=l[++i]),o&&W(a.m).insertBefore(o,T(a.m))}c>u?R(e,null==l[p+1]?null:l[p+1].m,n,l,i,p):i>p&&x(t,c,u)})(n,l,t,o):null!==o?(null!==e.t&&(n.textContent=""),R(n,null,t,o,0,o.length-1)):null!==l&&x(l,0,l.length-1)):(c=n["s-cr"])?c.parentNode.textContent=s:e.t!==s&&(n.data=s)},L=e=>{const t=e.childNodes;let n,l,o,s,c,i;for(l=0,o=t.length;l<o;l++)if(n=t[l],1===n.nodeType){if(n["s-sr"])for(c=n["s-sn"],n.hidden=!1,s=0;s<o;s++)if(i=t[s].nodeType,t[s]["s-hn"]!==n["s-hn"]||""!==c){if(1===i&&c===t[s].getAttribute("slot")){n.hidden=!0;break}}else if(1===i||3===i&&""!==t[s].textContent.trim()){n.hidden=!0;break}L(n)}},N=[],U=e=>{let t,n,l,s,c,i,r=0;const f=e.childNodes,u=f.length;for(;r<u;r++){if(t=f[r],t["s-sr"]&&(n=t["s-cr"])&&n.parentNode)for(l=n.parentNode.childNodes,s=t["s-sn"],i=l.length-1;i>=0;i--)n=l[i],n["s-cn"]||n["s-nr"]||n["s-hn"]===t["s-hn"]||(D(n,s)?(c=N.find((e=>e.k===n)),o=!0,n["s-sn"]=n["s-sn"]||s,c?c.g=t:N.push({g:t,k:n}),n["s-sr"]&&N.map((e=>{D(e.k,n["s-sn"])&&(c=N.find((e=>e.k===n)),c&&!e.g&&(e.g=c.g))}))):N.some((e=>e.k===n))||N.push({k:n}));1===t.nodeType&&U(t)}},D=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,F=e=>{e.l&&e.l.ref&&e.l.ref(null),e.o&&e.o.map(F)},A=(e,t)=>{t&&!e.S&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.S=t)))},H=(e,t)=>{if(e.p|=16,!(4&e.p))return A(e,e.j),Me((()=>q(e,t)));e.p|=512},q=(e,t)=>{const n=e.C;let l;return t?(e.p|=256,e.M&&(e.M.map((([e,t])=>J(n,e,t))),e.M=null),l=J(n,"componentWillLoad")):l=J(n,"componentWillUpdate"),l=K(l,(()=>J(n,"componentWillRender"))),K(l,(()=>V(e,n,t)))},V=async(e,t,n)=>{const l=e.h,o=l["s-rc"];n&&(e=>{const t=e.O,n=e.h,l=t.p,o=((e,t)=>{var n;let l=k(t);const o=$e.get(l);if(e=11===e.nodeType?e:he,o)if("string"==typeof o){let t,s=v.get(e=e.head||e);if(s||v.set(e,s=new Set),!s.has(l)){{t=he.createElement("style"),t.innerHTML=o;const l=null!==(n=ye.R)&&void 0!==n?n:function(e){var t,n,l;return null!==(l=null===(n=null===(t=e.head)||void 0===t?void 0:t.querySelector('meta[name="csp-nonce"]'))||void 0===n?void 0:n.getAttribute("content"))&&void 0!==l?l:void 0}(he);null!=l&&t.setAttribute("nonce",l),e.insertBefore(t,e.querySelector("link"))}s&&s.add(l)}}else e.adoptedStyleSheets.includes(o)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,o]);return l})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"),2&l&&n.classList.add(o+"-s"))})(e);_(e,t),o&&(o.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>B(e);0===t.length?n():(Promise.all(t).then(n),e.p|=4,t.length=0)}},_=(i,r)=>{try{c=r,r=r.render(),i.p&=-17,i.p|=2,((c,i)=>{const r=c.h,f=c.O,u=c.P||d(null,null),$=(e=>e&&e.$===p)(i)?i:a(null,null,i);if(n=r.tagName,f.T&&($.l=$.l||{},f.T.map((([e,t])=>$.l[t]=r[e]))),$.$=null,$.p|=4,c.P=$,$.m=u.m=r.shadowRoot||r,e=r["s-sc"],t=r["s-cr"],l=0!=(1&f.p),o=!1,E(u,$),ye.p|=1,s){let e,t,n,l,o,s;U($.m);let c=0;for(;c<N.length;c++)e=N[c],t=e.k,t["s-ol"]||(n=he.createTextNode(""),n["s-nr"]=t,t.parentNode.insertBefore(t["s-ol"]=n,t));for(c=0;c<N.length;c++)if(e=N[c],t=e.k,e.g){for(l=e.g.parentNode,o=e.g.nextSibling,n=t["s-ol"];n=n.previousSibling;)if(s=n["s-nr"],s&&s["s-sn"]===t["s-sn"]&&l===s.parentNode&&(s=s.nextSibling,!s||!s["s-nr"])){o=s;break}(!o&&l!==t.parentNode||t.nextSibling!==o)&&t!==o&&(!t["s-hn"]&&t["s-ol"]&&(t["s-hn"]=t["s-ol"].parentNode.nodeName),l.insertBefore(t,o))}else 1===t.nodeType&&(t.hidden=!0)}o&&L($.m),ye.p&=-2,N.length=0})(i,r)}catch(e){ae(e,i.h)}return c=null,null},z=()=>c,B=e=>{const t=e.h,n=e.C,l=e.j;J(n,"componentDidRender"),64&e.p?J(n,"componentDidUpdate"):(e.p|=64,Q(t),J(n,"componentDidLoad"),e.W(t),l||I()),e.L(t),e.S&&(e.S(),e.S=void 0),512&e.p&&Ce((()=>H(e,!1))),e.p&=-517},G=e=>{{const t=ie(e),n=t.h.isConnected;return n&&2==(18&t.p)&&H(t,!1),n}},I=()=>{Q(he.documentElement),Ce((()=>w(me,"appload",{detail:{namespace:"sankhyablocks"}})))},J=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){ae(e)}},K=(e,t)=>e&&e.then?e.then(t):t(),Q=e=>e.classList.add("hydrated"),X=(e,t,n)=>{if(t.N){e.watchers&&(t.U=e.watchers);const l=Object.entries(t.N),o=e.prototype;if(l.map((([e,[l]])=>{31&l||2&n&&32&l?Object.defineProperty(o,e,{get(){return((e,t)=>ie(this).D.get(t))(0,e)},set(n){((e,t,n,l)=>{const o=ie(e),s=o.h,c=o.D.get(t),i=o.p,r=o.C;if(n=((e,t)=>null==e||u(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(n,l.N[t][0]),(!(8&i)||void 0===c)&&n!==c&&(!Number.isNaN(c)||!Number.isNaN(n))&&(o.D.set(t,n),r)){if(l.U&&128&i){const e=l.U[t];e&&e.map((e=>{try{r[e](n,c,t)}catch(e){ae(e,s)}}))}if(2==(18&i)){if(r.componentShouldUpdate&&!1===r.componentShouldUpdate(n,c,t))return;H(o,!1)}}})(this,e,n,t)},configurable:!0,enumerable:!0}):1&n&&64&l&&Object.defineProperty(o,e,{value(...t){const n=ie(this);return n.F.then((()=>n.C[e](...t)))}})})),1&n){const n=new Map;o.attributeChangedCallback=function(e,t,l){ye.jmp((()=>{const t=n.get(e);if(this.hasOwnProperty(t))l=this[t],delete this[t];else if(o.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==l)return;this[t]=(null!==l||"boolean"!=typeof this[t])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,l])=>{const o=l[1]||e;return n.set(o,e),512&l[0]&&t.T.push([e,o]),o}))}}return e},Y=e=>{J(e,"connectedCallback")},Z=(e,t={})=>{const n=t.exclude||[],l=me.customElements,o=[];let s,c=!0;Object.assign(ye,t),ye.A=new URL(t.resourcesUrl||"./",he.baseURI).href,e.map((e=>{e[1].map((t=>{const i={p:t[0],v:t[1],N:t[2],H:t[3]};i.N=t[2],i.H=t[3],i.T=[],i.U={};const r=i.v,f=class extends HTMLElement{constructor(e){super(e),fe(e=this,i),1&i.p&&e.attachShadow({mode:"open"})}connectedCallback(){s&&(clearTimeout(s),s=null),c?o.push(this):ye.jmp((()=>(e=>{if(0==(1&ye.p)){const t=ie(e),n=t.O,l=()=>{};if(1&t.p)te(e,t,n.H),Y(t.C);else{t.p|=1,12&n.p&&(e=>{const t=e["s-cr"]=he.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)})(e);{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){A(t,t.j=n);break}}n.N&&Object.entries(n.N).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,l,o)=>{if(0==(32&t.p)){{if(t.p|=32,(o=pe(n)).then){const e=()=>{};o=await o,e()}o.isProxied||(n.U=o.watchers,X(o,n,2),o.isProxied=!0);const e=()=>{};t.p|=8;try{new o(t)}catch(e){ae(e)}t.p&=-9,t.p|=128,e(),Y(t.C)}if(o.style){let e=o.style;const t=k(n);if(!$e.has(t)){const l=()=>{};((e,t,n)=>{let l=$e.get(e);we&&n?(l=l||new CSSStyleSheet,"string"==typeof l?l=t:l.replaceSync(t)):l=t,$e.set(e,l)})(t,e,!!(1&n.p)),l()}}}const s=t.j,c=()=>H(t,!0);s&&s["s-rc"]?s["s-rc"].push(c):c()})(0,t,n)}l()}})(this)))}disconnectedCallback(){ye.jmp((()=>(()=>{if(0==(1&ye.p)){const e=ie(this),t=e.C;e.q&&(e.q.map((e=>e())),e.q=void 0),J(t,"disconnectedCallback")}})()))}componentOnReady(){return ie(this).V}};i._=e[0],n.includes(r)||l.get(r)||l.define(r,X(f,i,1))}))})),c=!1,o.length?o.map((e=>e.connectedCallback())):ye.jmp((()=>s=setTimeout(I,30)))},ee=(e,t)=>t,te=(e,t,n)=>{n&&n.map((([n,l,o])=>{const s=le(e,n),c=ne(t,o),i=oe(n);ye.ael(s,l,c,i),(t.q=t.q||[]).push((()=>ye.rel(s,l,c,i)))}))},ne=(e,t)=>n=>{try{256&e.p?e.C[t](n):(e.M=e.M||[]).push([t,n])}catch(e){ae(e)}},le=(e,t)=>8&t?me:16&t?he.body:e,oe=e=>0!=(2&e),se=e=>ye.R=e,ce=new WeakMap,ie=e=>ce.get(e),re=(e,t)=>ce.set(t.C=e,t),fe=(e,t)=>{const n={p:0,h:e,O:t,D:new Map};return n.F=new Promise((e=>n.L=e)),n.V=new Promise((e=>n.W=e)),e["s-p"]=[],e["s-rc"]=[],te(e,n,t.H),ce.set(e,n)},ue=(e,t)=>t in e,ae=(e,t)=>(0,console.error)(e,t),de=new Map,pe=e=>{const t=e.v.replace(/-/g,"_"),n=e._,l=de.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(de.set(n,e),e[t])),ae)
2
- /*!__STENCIL_STATIC_IMPORT_SWITCH__*/},$e=new Map,me="undefined"!=typeof window?window:{},he=me.document||{head:{}},ye={p:0,A:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},be=e=>Promise.resolve(e),we=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),ve=[],ke=[],ge=(e,t)=>n=>{e.push(n),i||(i=!0,t&&4&ye.p?Ce(je):ye.raf(je))},Se=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){ae(e)}e.length=0},je=()=>{Se(ve),Se(ke),(i=ve.length>0)&&ye.raf(je)},Ce=e=>be().then(e),Me=ge(ke,!0);export{ee as F,p as H,z as a,Z as b,b as c,G as f,y as g,a as h,be as p,re as r,se as s}
@@ -1 +0,0 @@
1
- import{a as e,f as t}from"./p-82bb3eda.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)}})(),r=e=>"function"==typeof e?e():e,n=(e,t)=>{const s=e.indexOf(t);s>=0&&(e[s]=e[e.length-1],e.length--)},c=(()=>{const s=((e,t=((e,t)=>e!==t))=>{const s=r(e);let o=new Map(Object.entries(s??{}));const c={dispose:[],get:[],set:[],reset:[]},a=new Map,i=()=>{o=new Map(Object.entries(r(e)??{})),c.reset.forEach((e=>e()))},p=e=>(c.get.forEach((t=>t(e))),o.get(e)),u=(e,s)=>{const r=o.get(e);t(s,r,e)&&(o.set(e,s),c.set.forEach((t=>t(e,s,r))))},d="undefined"==typeof Proxy?{}:new Proxy(s,{get:(e,t)=>p(t),ownKeys:()=>Array.from(o.keys()),getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0}),has:(e,t)=>o.has(t),set:(e,t,s)=>(u(t,s),!0)}),f=(e,t)=>(c[e].push(t),()=>{n(c[e],t)});return{state:d,get:p,set:u,on:f,onChange:(t,s)=>{const o=(e,o)=>{e===t&&s(o)},n=()=>s(r(e)[t]),c=f("set",o),i=f("reset",n);return a.set(s,{setHandler:o,resetHandler:n,propName:t}),()=>{c(),i(),a.delete(s)}},use:(...e)=>{const t=e.reduce(((e,t)=>(t.set&&e.push(f("set",t.set)),t.get&&e.push(f("get",t.get)),t.reset&&e.push(f("reset",t.reset)),t.dispose&&e.push(f("dispose",t.dispose)),e)),[]);return()=>t.forEach((e=>e()))},dispose:()=>{c.dispose.forEach((e=>e())),i()},reset:i,forceUpdate:e=>{const t=o.get(e);c.set.forEach((s=>s(e,t,t)))},removeListener:(e,t)=>{const s=a.get(t);s&&s.propName===e&&(n(c.set,s.setHandler),n(c.reset,s.resetHandler),a.delete(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 r=s.get(e);r&&s.set(e,r.filter(t)),o(s)},reset:()=>{s.forEach((e=>e.forEach(t))),o(s)}}})()),s})();export{c as s}
@@ -1 +0,0 @@
1
- import{DataType as r,NumberUtils as t,DateUtils as e,UserInterface as i}from"@sankhyalabs/core";import{F as a}from"./p-ff1990ad.js";import{F as n}from"./p-84345e7a.js";class l{static buildFilterExpression(r){var t;if(null==r)return;let e=null!==(t=this.buildVariableParameterValue(r))&&void 0!==t?t:void 0,i=r.expression||"",a="'";switch(r.paramVariable&&(a=""),r.operand){case"IN":i+=` ${n[r.operand]} (${e})`;break;case"NULL":case"NOT_NULL":i+=` IS ${n[r.operand]}`;break;case"LIKE":i+=` LIKE '%${e}%'`;break;case"START_WITH":i+=` LIKE '${e}%'`;break;case"FINISHED_WITH":i+=` LIKE '%${e}'`;break;default:r.operand&&(i+=` ${n[r.operand]}`),["string","number"].includes(typeof e)&&(e=isNaN(e)?`${a}${e}${a}`:e,i+=` ${e}`)}return i}static buildVariableParameterValue(e){var a;if(null!=e){if(e.paramVariable)return this.proccessVarialbeParameter(e);if(e.operand!==n.NULL&&"NOT_NULL"!==e.operand){let n=e.value;const l=e.type;return i.SEARCH!==e.userInterface&&e.userInterface!==i.OPTIONSELECTOR&&r.OBJECT!=l||(n=null!==(a=null==n?void 0:n.value)&&void 0!==a?a:n),r.NUMBER==l&&null!=n?(n=t.stringToNumber(n),this.checkIsValidNumber(n)):r.DATE==l?n=this.convertDataValue(n):r.BOOLEAN==l&&(n=n?"S":"N"),n}return e.operand}}static checkIsValidNumber(r){if(isNaN(r))throw new Error("O valor informado não é um número válido.")}static proccessVarialbeParameter(r){if(null!=r.systemConfig){const t=r.systemConfig;return`?:{entidade=${t.entity||""};campo=${t.fieldName||""}}`}if(null!=r.userConfig){const t=r.userConfig;return`?:{desc=${t.description||""};tipo=${t.type||""}}`}return`?:{entidade=${r.entityName||""};campo=${r.fieldName||""}}`}static convertDataValue(r){return"string"==typeof r&&(r=new Date(r)),e.formatDate(r)}static buildGroupExpression(r){var t,e;if(!(null===(t=null==r?void 0:r.items)||void 0===t?void 0:t.length))return"";const i=r.items.map((r=>this.buildFilterExpression(r))).join(` ${r.operand} `);if((null===(e=null==r?void 0:r.childrenGroups)||void 0===e?void 0:e.length)>0){const t=r.childrenGroups.map((r=>this.buildGroupExpression(r))).join(` ${r.operand} `);return`(${i} ${r.operand} (${t}))`}return`(${i})`}static validateFields(r){const t=this.buildPlainExpressionItems(r);for(const r of t)if(!this.validateExpressionItem(r))return!1;return!0}static buildPlainExpressionItems(r){const{items:t=[],childrenGroups:e=[]}=r||{},i=r=>r.reduce(((r,t)=>{var e;return t.items&&(r=r.concat(t.items)),(null===(e=t.childrenGroups)||void 0===e?void 0:e.length)&&(r=r.concat(i(t.childrenGroups))),r}),[]);return t.concat(i(e))}static validateExpressionItem(r){return Object.entries({fieldName:r=>!!r,value:(r,t)=>!!t||null!=r,operand:r=>!!r}).every((t=>{const[e,i]=t,a=r.paramVariable||"SWITCH"===r.userInterface||["NULL","NOT_NULL"].includes(r.operand);return i(r[e],a)}))}static getNormalizedValue(t,e){return t.reduce(((t,e,i)=>(e.dataType!==r.BOOLEAN||null!=t&&null!=t[i]||((t=t&&!Array.isArray(t)?[t]:t||[])[i]=!1),t)),e)}static validateVariableValues(t,e){if(!t)return!0;let i=e||t.value,n=!0;if(t.type===a.PERSONALIZED){const e=(t.groupedItems||[]).filter((r=>r.visible)).filter((r=>{var t,e,i;return!!(null===(i=null===(e=null===(t=r.props)||void 0===t?void 0:t.personalizedFilter)||void 0===e?void 0:e.parameters)||void 0===i?void 0:i.length)})),a=e.flatMap((r=>{var t;return null===(t=r.props.personalizedFilter)||void 0===t?void 0:t.parameters})),l=e.flatMap((t=>t.props.personalizedFilter.parameters.flatMap(((e,i)=>t.value?(void 0!==t.value[i]||e.dataType!==r.BOOLEAN)&&t.value[i]:null))));i=this.getNormalizedValue(a,i),n=a.length===l.length&&l.every((r=>null!=r))}return n}static buildVariableParameters(r){const t=this.buildPlainExpressionItems(r),e=[];for(const r of t)r.paramVariable&&e.push({entityName:r.entityName,fieldName:r.fieldName});return e}}export{l as P}
@@ -1 +0,0 @@
1
- import{r as i,c as e,h as s,H as t,g as l}from"./p-82bb3eda.js";import{S as a}from"./p-51833248.js";import{I as o}from"./p-8b4d6719.js";import{ArrayUtils as d}from"@sankhyalabs/core";import"./p-9019a32f.js";const r=class{constructor(s){i(this,s),this.fieldListChanged=e(this,"fieldListChanged",7),this.availableFields=[],this.dataUnit=void 0,this.filterTerm="",this.messagesBuilder=void 0}onAddField(i){const e=this.addItemInPosition(i.newIndex,i.item.fieldConfig);this.fieldListChanged.emit(e)}addItemInPosition(i,e){return[...this.availableFields.slice(0,i),e,...this.availableFields.slice(i)]}onRemoveField(i){const e=i.item,s=e.fieldConfig.name,t=[...this.availableFields.filter((i=>i.name!==s))];this.fieldListChanged.emit(t),requestAnimationFrame((()=>e.remove()))}renderFields(){return d.applyStringFilter(this.filterTerm,this.availableFields).map((i=>s("field-item",{key:i.name,dataUnit:this.dataUnit,fieldConfig:i,messagesBuilder:this.messagesBuilder})))}getCountText(){return this.availableFields.length?1===this.availableFields.length?this.getMessage("snkFormConfig.availableFields.labelOneField"):`${this.availableFields.length} ${this.getMessage("snkFormConfig.availableFields.labelAvailableFields")}`:this.getMessage("snkFormConfig.availableFields.labelNoFields")}initializeDraggableContainer(){new a(this.el.querySelector(`#${o}`),{group:"fields",direction:"vertical",ghostClass:"ghost",animation:15,onAdd:i=>this.onAddField(i),onRemove:i=>this.onRemoveField(i)})}getMessage(i,e){var s;return null===(s=this.messagesBuilder)||void 0===s?void 0:s.getMessage(i,e)}componentDidRender(){this.initializeDraggableContainer()}render(){return s(t,{class:"ez-col ez-col--sd-4 ez-col--tb-4 ez-padding--medium"},s("span",{class:"fields-label ez-padding-bottom--small"},this.getMessage("snkFormConfig.availableFields.title")),s("ez-filter-input",{class:"filter-input",slot:"content",mode:"slim",label:this.getMessage("snkFormConfig.availableFields.labelSearchField"),onEzChange:i=>this.filterTerm=i.detail}),s("span",{class:"fields-count"},this.getCountText()),s("ez-scroller",{direction:"vertical",activeShadow:!0},s("div",{id:o,class:"fields-container"},this.renderFields())))}get el(){return l(this)}};r.style=".sc-fields-selector-h{width:33.33333%;display:flex;box-shadow:var(--shadow--small, 0 0 16px rgba(0, 38, 111, 0.07));border-radius:var(--border--radius-medium, 6px);height:var(--snk-form-config-container-height);max-width:260px}.fields-label.sc-fields-selector{display:block;font-size:16px;font-weight:500;width:100%}.fields-count.sc-fields-selector{display:block;color:#AFB6C0;font-size:14px;padding:12px 0;font-weight:400;width:100%}.fields-container.sc-fields-selector{display:flex;flex-direction:column;gap:12px;height:calc(100vh - 220px);width:100%}.ghost.sc-fields-selector{opacity:.5;background:#c8fbe2}.filter-input.sc-fields-selector{padding-right:var(--space--2xs, 8px)}";export{r as fields_selector}