@sankhyalabs/ezui 5.22.0-dev.64 → 5.22.0-dev.65

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 (192) hide show
  1. package/dist/cjs/ez-actions-button.cjs.entry.js +1 -1
  2. package/dist/cjs/ez-alert-list.cjs.entry.js +1 -1
  3. package/dist/cjs/ez-alert.cjs.entry.js +1 -1
  4. package/dist/cjs/ez-application.cjs.entry.js +1 -1
  5. package/dist/cjs/ez-badge.cjs.entry.js +1 -1
  6. package/dist/cjs/ez-breadcrumb.cjs.entry.js +1 -1
  7. package/dist/cjs/ez-button.cjs.entry.js +1 -1
  8. package/dist/cjs/ez-calendar.cjs.entry.js +1 -1
  9. package/dist/cjs/{ez-card-item_3.cjs.entry.js → ez-card-item_2.cjs.entry.js} +1 -124
  10. package/dist/cjs/ez-chart.cjs.entry.js +1 -1
  11. package/dist/cjs/ez-check.cjs.entry.js +1 -1
  12. package/dist/cjs/ez-chip.cjs.entry.js +1 -1
  13. package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -1
  14. package/dist/cjs/ez-combo-box.cjs.entry.js +1 -1
  15. package/dist/cjs/ez-custom-form-input_2.cjs.entry.js +2 -2
  16. package/dist/cjs/ez-date-input.cjs.entry.js +1 -1
  17. package/dist/cjs/ez-date-time-input.cjs.entry.js +1 -1
  18. package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
  19. package/dist/cjs/ez-double-list.cjs.entry.js +285 -0
  20. package/dist/cjs/ez-dropdown_2.cjs.entry.js +1 -1
  21. package/dist/cjs/ez-file-item.cjs.entry.js +1 -1
  22. package/dist/cjs/ez-filter-input.cjs.entry.js +130 -0
  23. package/dist/cjs/ez-form-view.cjs.entry.js +1 -1
  24. package/dist/cjs/ez-form.cjs.entry.js +1 -1
  25. package/dist/cjs/ez-grid.cjs.entry.js +1 -1
  26. package/dist/cjs/ez-guide-navigator.cjs.entry.js +1 -1
  27. package/dist/cjs/ez-icon.cjs.entry.js +1 -1
  28. package/dist/cjs/ez-list.cjs.entry.js +247 -206
  29. package/dist/cjs/ez-loading-bar.cjs.entry.js +1 -1
  30. package/dist/cjs/ez-modal-container.cjs.entry.js +1 -1
  31. package/dist/cjs/ez-modal.cjs.entry.js +1 -1
  32. package/dist/cjs/ez-multi-selection-list.cjs.entry.js +1 -1
  33. package/dist/cjs/ez-number-input.cjs.entry.js +1 -1
  34. package/dist/cjs/ez-popover.cjs.entry.js +1 -1
  35. package/dist/cjs/ez-popup.cjs.entry.js +5 -2
  36. package/dist/cjs/ez-radio-button.cjs.entry.js +1 -1
  37. package/dist/cjs/ez-scroller_2.cjs.entry.js +1 -1
  38. package/dist/cjs/ez-search.cjs.entry.js +1 -1
  39. package/dist/cjs/ez-sidebar-navigator.cjs.entry.js +1 -1
  40. package/dist/cjs/ez-split-button.cjs.entry.js +1 -1
  41. package/dist/cjs/ez-split-item.cjs.entry.js +1 -1
  42. package/dist/cjs/ez-split-panel.cjs.entry.js +1 -1
  43. package/dist/cjs/ez-tabselector.cjs.entry.js +1 -1
  44. package/dist/cjs/ez-text-area.cjs.entry.js +1 -1
  45. package/dist/cjs/ez-text-input.cjs.entry.js +1 -1
  46. package/dist/cjs/ez-time-input.cjs.entry.js +1 -1
  47. package/dist/cjs/ez-toast.cjs.entry.js +1 -1
  48. package/dist/cjs/ez-tooltip.cjs.entry.js +1 -1
  49. package/dist/cjs/ez-tree.cjs.entry.js +1 -1
  50. package/dist/cjs/ez-upload.cjs.entry.js +1 -1
  51. package/dist/cjs/ez-view-stack.cjs.entry.js +1 -1
  52. package/dist/cjs/ezListHelper-0d3970b4.js +90 -0
  53. package/dist/cjs/ezui.cjs.js +2 -2
  54. package/dist/cjs/filter-column.cjs.entry.js +1 -1
  55. package/dist/cjs/{index-9e5554cb.js → index-a7b0c73d.js} +10 -5
  56. package/dist/cjs/loader.cjs.js +2 -2
  57. package/dist/collection/collection-manifest.json +1 -0
  58. package/dist/collection/components/ez-double-list/doubleListHelper.js +82 -0
  59. package/dist/collection/components/ez-double-list/ez-double-list.css +62 -0
  60. package/dist/collection/components/ez-double-list/ez-double-list.js +418 -0
  61. package/dist/collection/components/ez-list/ez-list.js +273 -208
  62. package/dist/collection/components/ez-list/ezListHelper.js +85 -0
  63. package/dist/collection/components/ez-popup/ez-popup.css +1 -0
  64. package/dist/collection/components/ez-popup/ez-popup.js +5 -2
  65. package/dist/custom-elements/index.d.ts +6 -0
  66. package/dist/custom-elements/index.js +623 -216
  67. package/dist/esm/ez-actions-button.entry.js +1 -1
  68. package/dist/esm/ez-alert-list.entry.js +1 -1
  69. package/dist/esm/ez-alert.entry.js +1 -1
  70. package/dist/esm/ez-application.entry.js +1 -1
  71. package/dist/esm/ez-badge.entry.js +1 -1
  72. package/dist/esm/ez-breadcrumb.entry.js +1 -1
  73. package/dist/esm/ez-button.entry.js +1 -1
  74. package/dist/esm/ez-calendar.entry.js +1 -1
  75. package/dist/esm/{ez-card-item_3.entry.js → ez-card-item_2.entry.js} +2 -124
  76. package/dist/esm/ez-chart.entry.js +1 -1
  77. package/dist/esm/ez-check.entry.js +1 -1
  78. package/dist/esm/ez-chip.entry.js +1 -1
  79. package/dist/esm/ez-collapsible-box.entry.js +1 -1
  80. package/dist/esm/ez-combo-box.entry.js +1 -1
  81. package/dist/esm/ez-custom-form-input_2.entry.js +2 -2
  82. package/dist/esm/ez-date-input.entry.js +1 -1
  83. package/dist/esm/ez-date-time-input.entry.js +1 -1
  84. package/dist/esm/ez-dialog.entry.js +1 -1
  85. package/dist/esm/ez-double-list.entry.js +281 -0
  86. package/dist/esm/ez-dropdown_2.entry.js +1 -1
  87. package/dist/esm/ez-file-item.entry.js +1 -1
  88. package/dist/esm/ez-filter-input.entry.js +126 -0
  89. package/dist/esm/ez-form-view.entry.js +1 -1
  90. package/dist/esm/ez-form.entry.js +1 -1
  91. package/dist/esm/ez-grid.entry.js +1 -1
  92. package/dist/esm/ez-guide-navigator.entry.js +1 -1
  93. package/dist/esm/ez-icon.entry.js +1 -1
  94. package/dist/esm/ez-list.entry.js +247 -206
  95. package/dist/esm/ez-loading-bar.entry.js +1 -1
  96. package/dist/esm/ez-modal-container.entry.js +1 -1
  97. package/dist/esm/ez-modal.entry.js +1 -1
  98. package/dist/esm/ez-multi-selection-list.entry.js +1 -1
  99. package/dist/esm/ez-number-input.entry.js +1 -1
  100. package/dist/esm/ez-popover.entry.js +1 -1
  101. package/dist/esm/ez-popup.entry.js +5 -2
  102. package/dist/esm/ez-radio-button.entry.js +1 -1
  103. package/dist/esm/ez-scroller_2.entry.js +1 -1
  104. package/dist/esm/ez-search.entry.js +1 -1
  105. package/dist/esm/ez-sidebar-navigator.entry.js +1 -1
  106. package/dist/esm/ez-split-button.entry.js +1 -1
  107. package/dist/esm/ez-split-item.entry.js +1 -1
  108. package/dist/esm/ez-split-panel.entry.js +1 -1
  109. package/dist/esm/ez-tabselector.entry.js +1 -1
  110. package/dist/esm/ez-text-area.entry.js +1 -1
  111. package/dist/esm/ez-text-input.entry.js +1 -1
  112. package/dist/esm/ez-time-input.entry.js +1 -1
  113. package/dist/esm/ez-toast.entry.js +1 -1
  114. package/dist/esm/ez-tooltip.entry.js +1 -1
  115. package/dist/esm/ez-tree.entry.js +1 -1
  116. package/dist/esm/ez-upload.entry.js +1 -1
  117. package/dist/esm/ez-view-stack.entry.js +1 -1
  118. package/dist/esm/ezListHelper-00fb9b8d.js +87 -0
  119. package/dist/esm/ezui.js +3 -3
  120. package/dist/esm/filter-column.entry.js +1 -1
  121. package/dist/esm/{index-5a720e56.js → index-baa5e267.js} +11 -5
  122. package/dist/esm/loader.js +3 -3
  123. package/dist/ezui/ezui.esm.js +1 -1
  124. package/dist/ezui/{p-e6b38ade.entry.js → p-0306dff7.entry.js} +1 -1
  125. package/dist/ezui/{p-91ccae0c.entry.js → p-09de35a2.entry.js} +1 -1
  126. package/dist/ezui/p-13165bb1.entry.js +1 -0
  127. package/dist/ezui/{p-c7d1333c.entry.js → p-14b769d7.entry.js} +1 -1
  128. package/dist/ezui/{p-b2f6bc0a.entry.js → p-17be134a.entry.js} +1 -1
  129. package/dist/ezui/p-17eabf46.entry.js +1 -0
  130. package/dist/ezui/{p-319d36b7.entry.js → p-181b5ae8.entry.js} +1 -1
  131. package/dist/ezui/{p-81461d2f.entry.js → p-1e7a8633.entry.js} +1 -1
  132. package/dist/ezui/{p-6b51c9cc.entry.js → p-1f50fa05.entry.js} +1 -1
  133. package/dist/ezui/{p-e4c7eb39.js → p-23a36bb6.js} +2 -2
  134. package/dist/ezui/p-2475fd6e.entry.js +1 -0
  135. package/dist/ezui/{p-3c10cd94.entry.js → p-2b46b37b.entry.js} +1 -1
  136. package/dist/ezui/{p-6d31c43c.entry.js → p-2bb2a0c4.entry.js} +1 -1
  137. package/dist/ezui/{p-efbe0b73.entry.js → p-3175fe8c.entry.js} +1 -1
  138. package/dist/ezui/p-31d1fab6.entry.js +1 -0
  139. package/dist/ezui/{p-fad4f1dd.entry.js → p-35d467a8.entry.js} +1 -1
  140. package/dist/ezui/{p-5d01d189.entry.js → p-3f2dd525.entry.js} +1 -1
  141. package/dist/ezui/{p-0378416a.entry.js → p-44caad9a.entry.js} +1 -1
  142. package/dist/ezui/{p-aa543378.entry.js → p-50d83a46.entry.js} +1 -1
  143. package/dist/ezui/{p-7567ccdd.entry.js → p-555c9018.entry.js} +1 -1
  144. package/dist/ezui/{p-044d46d5.entry.js → p-5b205c80.entry.js} +1 -1
  145. package/dist/ezui/{p-6fc26622.entry.js → p-5ed81457.entry.js} +1 -1
  146. package/dist/ezui/{p-f1c2c19e.entry.js → p-650e4b6d.entry.js} +1 -1
  147. package/dist/ezui/{p-aee8d615.entry.js → p-654b3f99.entry.js} +1 -1
  148. package/dist/ezui/p-65f471bc.entry.js +1 -0
  149. package/dist/ezui/{p-6d8b3298.entry.js → p-6cdd3e0a.entry.js} +1 -1
  150. package/dist/ezui/{p-554522db.entry.js → p-6d79930d.entry.js} +1 -1
  151. package/dist/ezui/{p-fc194825.entry.js → p-6e429cff.entry.js} +1 -1
  152. package/dist/ezui/{p-def75121.entry.js → p-6f22a385.entry.js} +1 -1
  153. package/dist/ezui/{p-2f53435e.entry.js → p-7409eeaa.entry.js} +1 -1
  154. package/dist/ezui/{p-11bfeca3.entry.js → p-77a4bd35.entry.js} +1 -1
  155. package/dist/ezui/{p-397e3026.entry.js → p-7ed30844.entry.js} +1 -1
  156. package/dist/ezui/{p-e18d9e6a.entry.js → p-7fdd479f.entry.js} +1 -1
  157. package/dist/ezui/p-80dfc50b.js +1 -0
  158. package/dist/ezui/{p-1b08bf3c.entry.js → p-8888d9ed.entry.js} +1 -1
  159. package/dist/ezui/{p-82fa4b09.entry.js → p-8df1ca33.entry.js} +1 -1
  160. package/dist/ezui/{p-e7395eae.entry.js → p-90bcd2ba.entry.js} +1 -1
  161. package/dist/ezui/{p-a921e3e7.entry.js → p-990b4318.entry.js} +1 -1
  162. package/dist/ezui/{p-c2b20f78.entry.js → p-9f5fa3f9.entry.js} +1 -1
  163. package/dist/ezui/{p-b6241ea3.entry.js → p-a6fe527a.entry.js} +1 -1
  164. package/dist/ezui/{p-dfca5946.entry.js → p-a80b1287.entry.js} +1 -1
  165. package/dist/ezui/{p-18a2a28a.entry.js → p-b6a4e6de.entry.js} +1 -1
  166. package/dist/ezui/p-bc2f844e.entry.js +1 -0
  167. package/dist/ezui/{p-92748142.entry.js → p-c0d9c4f8.entry.js} +1 -1
  168. package/dist/ezui/{p-b858fc6e.entry.js → p-c3045972.entry.js} +1 -1
  169. package/dist/ezui/{p-a563df31.entry.js → p-c4320a39.entry.js} +1 -1
  170. package/dist/ezui/{p-ec5f987d.entry.js → p-ca6340a9.entry.js} +1 -1
  171. package/dist/ezui/{p-16e21a40.entry.js → p-d0ca26fe.entry.js} +1 -1
  172. package/dist/ezui/{p-cce6c015.entry.js → p-d520839d.entry.js} +1 -1
  173. package/dist/ezui/p-dc8b36c3.entry.js +1 -0
  174. package/dist/ezui/{p-bef7daac.entry.js → p-e347df9c.entry.js} +1 -1
  175. package/dist/ezui/{p-35d0b2fb.entry.js → p-e3e3fd7a.entry.js} +1 -1
  176. package/dist/ezui/{p-469b2619.entry.js → p-e82d122c.entry.js} +1 -1
  177. package/dist/ezui/{p-6bda82d1.entry.js → p-fec696ab.entry.js} +1 -1
  178. package/dist/types/components/ez-double-list/doubleListHelper.d.ts +10 -0
  179. package/dist/types/components/ez-double-list/ez-double-list.d.ts +86 -0
  180. package/dist/types/components/ez-list/ez-list.d.ts +19 -3
  181. package/dist/types/components/ez-list/ezListHelper.d.ts +20 -0
  182. package/dist/types/components/ez-popup/ez-popup.d.ts +1 -1
  183. package/dist/types/components.d.ts +97 -6
  184. package/package.json +1 -1
  185. package/react/components.d.ts +1 -0
  186. package/react/components.js +1 -0
  187. package/react/components.js.map +1 -1
  188. package/dist/ezui/p-3af64edd.entry.js +0 -1
  189. package/dist/ezui/p-46a46507.entry.js +0 -1
  190. package/dist/ezui/p-6ec40dec.entry.js +0 -1
  191. package/dist/ezui/p-7f5afb1f.entry.js +0 -1
  192. package/dist/ezui/p-a1c0eadf.entry.js +0 -1
@@ -1 +1 @@
1
- import{r as t,h as i,g as s,H as e}from"./p-e4c7eb39.js";import{JSUtils as h,ElementIDUtils as o}from"@sankhyalabs/core";const l=class{constructor(i){t(this,i),this._dataKey=""}async show(t){t!==this._focusedIndex&&0<=t&&t<this._totalStackItems&&(this.policyHideRemove(),this.policyShowAppend(t),this._focusedIndex=t)}async getSelectedIndex(){return this._focusedIndex}policyHideRemove(){let t=this._hostElem.querySelector(`#${this._dataKey}_el_${this._focusedIndex}`);this.checkElementVisibility(t)}policyShowAppend(t){let i=this._hostElem.querySelector(`#${this._dataKey}_el_${t}`);i?i.removeAttribute("style"):this._hostElem.append(this._elemList[t])}checkElementVisibility(t){"hide"!==t.getAttribute("hidePolicy")&&t.getAttribute("hidePolicy")?"remove"===t.getAttribute("hidePolicy")&&t.remove():t.setAttribute("style","display: none")}componentWillRender(){this._dataKey="id_".concat(h.generateUUID()),this._elemList||(this._elemList=[],this._focusedIndex=0,this._totalStackItems=0,this._hostElem.classList.add("ez-view-stack__container"),this._hostElem.querySelectorAll(":scope > stack-item").forEach(((t,i)=>{t.setAttribute("id",`${this._dataKey}_el_${i}`),0!==i&&this.checkElementVisibility(t),this._totalStackItems++,this._elemList.push(t)})))}componentDidLoad(){o.addIDInfo(this._hostElem)}disconectCallback(){this._hostElem=null,this._elemList=null}render(){return i(e,null)}get _hostElem(){return s(this)}};l.style=":host{width:100%;height:100%}.ez-view-stack__container{width:100%;height:100%}";export{l as ez_view_stack}
1
+ import{r as t,h as i,g as s,H as e}from"./p-23a36bb6.js";import{JSUtils as h,ElementIDUtils as o}from"@sankhyalabs/core";const l=class{constructor(i){t(this,i),this._dataKey=""}async show(t){t!==this._focusedIndex&&0<=t&&t<this._totalStackItems&&(this.policyHideRemove(),this.policyShowAppend(t),this._focusedIndex=t)}async getSelectedIndex(){return this._focusedIndex}policyHideRemove(){let t=this._hostElem.querySelector(`#${this._dataKey}_el_${this._focusedIndex}`);this.checkElementVisibility(t)}policyShowAppend(t){let i=this._hostElem.querySelector(`#${this._dataKey}_el_${t}`);i?i.removeAttribute("style"):this._hostElem.append(this._elemList[t])}checkElementVisibility(t){"hide"!==t.getAttribute("hidePolicy")&&t.getAttribute("hidePolicy")?"remove"===t.getAttribute("hidePolicy")&&t.remove():t.setAttribute("style","display: none")}componentWillRender(){this._dataKey="id_".concat(h.generateUUID()),this._elemList||(this._elemList=[],this._focusedIndex=0,this._totalStackItems=0,this._hostElem.classList.add("ez-view-stack__container"),this._hostElem.querySelectorAll(":scope > stack-item").forEach(((t,i)=>{t.setAttribute("id",`${this._dataKey}_el_${i}`),0!==i&&this.checkElementVisibility(t),this._totalStackItems++,this._elemList.push(t)})))}componentDidLoad(){o.addIDInfo(this._hostElem)}disconectCallback(){this._hostElem=null,this._elemList=null}render(){return i(e,null)}get _hostElem(){return s(this)}};l.style=":host{width:100%;height:100%}.ez-view-stack__container{width:100%;height:100%}";export{l as ez_view_stack}
@@ -1 +1 @@
1
- import{r as i,c as t,h as o,H as e,g as s}from"./p-e4c7eb39.js";import{ObjectUtils as r,FloatingManager as l,StringUtils as a,ElementIDUtils as n}from"@sankhyalabs/core";import"./p-2187f86c.js";import{C as h}from"./p-9e11fc7b.js";import"./p-ab574d59.js";import"./p-b853763b.js";import"./p-4607fb89.js";const b=class{constructor(o){i(this,o),this.ezChange=t(this,"ezChange",7),this._changeDeboucingTimeout=null,this._deboucingTime=300,this._maxWidthValue=0,this._tabPressed=!1,this._textEmptyList="Nenhum resultado encontrado",this._lookupMode=!1,this._preSelection=void 0,this._visibleOptions=void 0,this._startLoading=!1,this._showLoading=!0,this._criteria=void 0,this.limitCharsToSearch=3,this.value=void 0,this.label=void 0,this.enabled=!0,this.options=void 0,this.errorMessage=void 0,this.showSelectedValue=!1,this.showOptionValue=!1,this.suppressSearch=!1,this.optionLoader=void 0,this.suppressEmptyOption=!1,this.stopPropagateEnterKeyEvent=!0,this.canShowError=!0,this.mode="regular",this.hideErrorOnFocusOut=!0,this.listOptionsPosition=void 0,this.isTextSearch=!1,this.autoFocus=!1,this.noMargin=!1}observeErrorMessage(){var i;this._textInput&&(this._textInput.errorMessage=this.errorMessage,(null===(i=this.errorMessage)||void 0===i?void 0:i.trim())||this.setInputValue())}observeValue(i,t){if(this._textInput&&i!=t)try{if("string"==typeof i)return void this.setInputValue();const o=this.getSelectedOption(i),e=this.getSelectedOption(t),s=this.getSelectedOption(this.value);this.isDifferentValues(s,o)&&(this.value=o),this.isDifferentValues(o,e)&&(this.setInputValue(),this._lookupMode||this.ezChange.emit(null===o?void 0:o)),this.resetOptions()}finally{this._lookupMode=!1}}observeOptions(i,t){r.equals(i,t)||this.loadOptions(c.PRELOAD)}async getValueAsync(){return new Promise(this._showLoading?i=>{let t=setInterval((()=>{this._showLoading||(clearInterval(t),i(this.value))}),100)}:i=>i(this.value))}async setFocus(i){this._textInput&&this._textInput.setFocus(i)}async setBlur(){this._textInput&&this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async clearValue(){this.clearSearch()}scrollListener(){var i;null!=this._floatingID&&((null===(i=this.listOptionsPosition)||void 0===i?void 0:i.hardPosition)?this.hideOptions():window.requestAnimationFrame((()=>{this.updateListPosition()})))}updateListPosition(){let{verticalPosition:i,horizontalPosition:t,fromBottom:o,fromRight:e,bottomLimit:s,hardPosition:r}=this.getListPosition();const l=this._listWrapper.getBoundingClientRect(),a=this._listContainer.getBoundingClientRect(),n=this._textInput.getBoundingClientRect(),h=s||window.innerHeight;!o&&(l.top<0||a.bottom+l.height>h)&&(o=!0),r||(i=i||0,t=t||0,o?i=window.innerHeight-n.top+i:i+=a.top,e?t=window.innerWidth-n.right+t:t+=a.left),null!=i&&(this._listWrapper.style[o?"bottom":"top"]=`${i}px`,this._listWrapper.style[o?"top":"bottom"]=""),null!=t&&(this._listWrapper.style[e?"right":"left"]=`${t}px`,this._listWrapper.style[e?"left":"right"]="")}getListPosition(){return this.listOptionsPosition?this.listOptionsPosition:{verticalPosition:6}}isDifferentValues(i,t){return r.objectToString(i||{})!==r.objectToString(t||{})}getFormattedText(i){if(null!=i)return this.showSelectedValue&&null!=i.value?i.label?`${i.value} - ${i.label}`:i.value:i.label}getText(){const i=this.getSelectedOption(this.value),t=this.getFormattedText(i);if(null!=t)return String(t).replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"')}getSelectedOption(i){return"string"==typeof i||i instanceof String?this._visibleOptions.find((t=>t.value===i)):i}updateVisibleOptions(){let i=this._source||[];if(this._criteria){const t=this._criteria.toUpperCase();i=i.filter((i=>i.label.toLocaleUpperCase().indexOf(t)>-1))}this.hasToAddEmptyoption(i)&&(i=[{value:void 0,label:""}].concat(i)),this._visibleOptions=i,this._maxWidthValue=this.getMaxWidthValue()}hasToAddEmptyoption(i){return!this.suppressEmptyOption&&!i.filter((i=>!i.value)).length}getMaxWidthValue(){var i;if(this.showOptionValue){const t=[];return null===(i=this._visibleOptions)||void 0===i||i.forEach((i=>{const o=this.getWidthValue(i.value);t.includes(o)||t.push(o)})),t.length>1?Math.max(...t):0}return 0}getWidthValue(i){if(null!=this._itemValueBasis){const t=this._itemValueBasis;if(null!=i)return t.innerHTML=i,t.clientWidth>0?t.clientWidth+2:0;t.innerHTML=""}return 0}buildItem(i,t){const e=this.showOptionValue&&this._maxWidthValue>0?`${this._maxWidthValue}px`:"";return i.label=i.label||i.value,o("li",{class:t===this._preSelection?"item preselected":"item",id:`item_${i.value}`,onMouseDown:()=>this.selectOption(i),onMouseOver:()=>this._preSelection=t},this.showOptionValue?o("span",{class:"item__value",title:i.value,style:{width:e,minWidth:e,maxWidth:e}},i.value):void 0,o("span",{class:"item__label "+(this.showOptionValue?"item__label--bold":""),title:i.label},i.label))}showOptions(){var i,t;if(!this.enabled)return;if(this.isOptionsVisible())return;const o=null!==(t=null===(i=this.value)||void 0===i?void 0:i.value)&&void 0!==t?t:this.value,e=this._visibleOptions.findIndex((i=>i.value===o));this._preSelection=-1===e?0:e,this._resizeObserver&&this._resizeObserver.observe(this._textInput),this._floatingID=l.float(this._listWrapper,this._listContainer,{autoClose:!0,isFixed:!0,backClickListener:()=>this.hideOptions()}),this.setFocus(),window.requestAnimationFrame((()=>{this.updateListPosition(),this.listOptionsPosition||this._listWrapper.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}))}hideOptions(){void 0!==this._floatingID&&l.close(this._floatingID),this._floatingID=void 0,this._resizeObserver&&this._resizeObserver.unobserve(this._textInput)}isOptionsVisible(){return void 0!==this._floatingID&&l.isFloating(this._floatingID)}nextOption(){this.isOptionsVisible()&&(this.showOptions(),this._preSelection=void 0===this._preSelection?0:Math.min(this._preSelection+1,this._visibleOptions.length-1),this.scrollToOption(this._visibleOptions[this._preSelection]))}previousOption(){this._preSelection=void 0===this._preSelection?0:Math.max(this._preSelection-1,0),this.scrollToOption(this._visibleOptions[this._preSelection])}scrollToOption(i){window.requestAnimationFrame((()=>{const t=(null==i?void 0:i.value)?this._optionsList.querySelector(`li#item_${i.value.replace(/[<>\[\]#=]/g,"\\$&").replace(/:/g,"\\:")}`):void 0;t&&t.scrollIntoView({behavior:"smooth",block:"nearest"})}))}selectCurrentOption(i=!0){void 0!==this._preSelection?(this.selectOption(this._visibleOptions[this._preSelection],i),this._preSelection=void 0):this.controlListWithOnlyOne(i)}controlListWithOnlyOne(i=!0){var t;const o=null===(t=this._visibleOptions)||void 0===t?void 0:t.filter((i=>""!==i.label&&null!=i.value));if((null==o?void 0:o.length)>0){let t=a.decodeHtmlEntities(o[0].label);this.selectOption({value:o[0].value,label:t},i)}}updateSource(i){this._startLoading=!1,i instanceof Promise?(this._showLoading=!0,i.then((i=>{this._showLoading=!1,this.updateSource(i)})).catch((()=>this._showLoading=!1)),this.updateVisibleOptions()):(this._showLoading=!1,Array.isArray(i)?(this._source=i,this.updateVisibleOptions(),this._tabPressed&&(this._tabPressed=!1)):this.selectOption(i))}selectOption(i,t=!0){var o,e;const s=this.getSelectedOption(this.value);(null===(o=null==s?void 0:s.value)||void 0===o?void 0:o.toString())!==(null===(e=null==i?void 0:i.value)||void 0===e?void 0:e.toString())||null==s&&null!=i&&"value"in i?this.value=(null==i?void 0:i.value)?i:void 0:this.resetOptions(),t&&setTimeout((()=>{this.setFocus()}),0)}loadOptions(i,t=""){this._criteria=t,this._startLoading=!0,this.updateSource(this.optionLoader?this.optionLoader({mode:i,argument:t}):this.options)}cancelPreselection(){!this._textInput.value&&this.value?this.selectOption(void 0):window.setTimeout((()=>{this.setInputValue(!1)}),this._deboucingTime)}setInputValue(i=!0){const t=this.getText();(this._textInput.value||"")!==t&&(this._textInput.value=t,i&&(this.errorMessage=null))}clearSearch(){this.value=null}resetOptions(){this.hideOptions(),this._criteria=void 0,this._preSelection=void 0,this.updateVisibleOptions()}componentWillLoad(){if(void 0===this.options){this.options=[];const i=this.el.querySelectorAll("option");i&&i.forEach((i=>{let t=i.innerText,o=i.getAttribute("value");o||(o=t),this.options.push({label:t,value:o}),i.hidden=!0}))}this.loadOptions(c.PRELOAD)}componentDidRender(){var i;void 0===this._floatingID&&this._listWrapper.remove(),null===(i=this._optionsList)||void 0===i||i.querySelectorAll(".item").forEach((i=>{n.addIDInfoIfNotExists(i,"itemComboBox")}))}componentDidLoad(){h.applyVarsTextInput(this.el,this._textInput),this.setInputValue(!1),this._resizeObserver=new ResizeObserver((i=>{window.requestAnimationFrame((()=>{if(!Array.isArray(i)||!i.length)return;const{clientWidth:t}=this._listContainer;t>0&&this._listWrapper&&(this._listWrapper.style.width=`${t}px`)}))})),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}handlerIconClick(){this.showOptions()}onTextInputChangeHandler(i){var t;if(this.clearDeboucingTimeout(),this._startLoading)return void(this._changeDeboucingTimeout=window.setTimeout((()=>{this.onTextInputChangeHandler(i)}),this._deboucingTime));const o=null===(t=i.target.value)||void 0===t?void 0:t.trim();this._criteria||(this._textInput.value=i.data||o),this._criteria=o,o?(this.updateVisibleOptions(),this.showOptions()):(this._preSelection=void 0,this.updateVisibleOptions())}clearDeboucingTimeout(){this._changeDeboucingTimeout&&(window.clearTimeout(this._changeDeboucingTimeout),this._changeDeboucingTimeout=null)}onTextInputClickHandler(){this.showOptions()}keyDownHandler(i){switch(this._tabPressed=!1,i.ctrlKey&&("f"!==i.key&&"F"!==i.key||(this.loadOptions(c.ADVANCED),i.stopPropagation(),i.stopImmediatePropagation(),i.preventDefault())),i.key){case"ArrowDown":i.stopPropagation(),this.canShowListOptions()&&i.preventDefault(),this.showOptions(),this.nextOption();break;case"ArrowUp":i.stopPropagation(),this.canShowListOptions()&&i.preventDefault(),this.showOptions(),this.previousOption();break;case"Enter":this.handleEventPropagation(i),this.isOptionsVisible()&&this.selectCurrentOption();break;case"Escape":this.isOptionsVisible()&&i.stopPropagation(),this.cancelPreselection(),this.resetOptions();break;case"Tab":this._tabPressed=!0,this.isOptionsVisible()&&this.selectCurrentOption(!1),this.resetOptions()}}handleEventPropagation(i){this._listContainer.hasChildNodes()&&this.stopPropagateEnterKeyEvent&&i.stopPropagation()}onTextInputFocusOutHandler(){this.hideErrorOnFocusOut&&this.cancelPreselection()}canShowListOptions(){return!this._showLoading&&this._visibleOptions.length>0}render(){return n.addIDInfoIfNotExists(this.el,"input"),o(e,null,o("ez-text-input",{"data-element-id":n.getInternalIDInfo("textInput"),class:"text-input-slot-container "+(this.suppressSearch?"suppressed-search-input":""),ref:i=>this._textInput=i,"data-slave-mode":"true",enabled:this.enabled&&!this.suppressSearch,onInput:i=>this.onTextInputChangeHandler(i),onClick:()=>this.onTextInputClickHandler(),onFocusout:()=>this.onTextInputFocusOutHandler(),onKeyDown:i=>this.keyDownHandler(i),label:this.label,canShowError:this.canShowError,errorMessage:this.errorMessage,mode:this.mode,noMargin:this.noMargin},o("button",{class:"btn",slot:"rightIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.handlerIconClick()},o("ez-icon",{iconName:"chevron-down"}))),o("section",{class:"list-container",ref:i=>this._listContainer=i},o("div",{class:"list-wrapper",ref:i=>this._listWrapper=i},o("ul",{class:"list-options",ref:i=>this._optionsList=i},!this._showLoading&&0===this._visibleOptions.length&&o("div",{class:"message"},o("span",{class:"message__no-result"},this._textEmptyList)),this._showLoading&&o("div",{class:"message"},o("div",{class:"message__loading"})),this.showOptionValue?o("span",{class:"item__value item__value--hidden",ref:i=>this._itemValueBasis=i}):void 0,this.canShowListOptions()&&this._visibleOptions.map(((i,t)=>this.buildItem(i,t)))))))}get el(){return s(this)}static get watchers(){return{errorMessage:["observeErrorMessage"],value:["observeValue"],options:["observeOptions"]}}};var c;!function(i){i.ADVANCED="ADVANCED",i.PRELOAD="PRELOAD",i.PREDICTIVE="PREDICTIVE"}(c||(c={})),b.style=":host{--ez-combo-box--height:42px;--ez-combo-box--width:100%;--ez-combo-box__icon--width:48px;--ez-combo-box__min-width:0px;--ez-combo-box__max-width:100%;--ez-combo-box--border-radius:var(--border--radius-medium, 12px);--ez-combo-box--border-radius-small:var(--border--radius-small, 6px);--ez-combo-box--font-size:var(--text--medium, 14px);--ez-combo-box--font-family:var(--font-pattern, Arial);--ez-combo-box--font-weight--large:var(--text-weight--large, 500);--ez-combo-box--font-weight--medium:var(--text-weight--medium, 400);--ez-combo-box--background-color--xlight:var(--background--xlight, #fff);--ez-combo-box--background-medium:var(--background--medium, #f0f3f7);--ez-combo-box--line-height:calc(var(--text--medium, 14px) + 4px);--ez-combo-box__input--background-color:var(--background--medium, #e0e0e0);--ez-combo-box__input--border:var(--border--medium, 2px solid);--ez-combo-box__input--border-color:var(--ez-combo-box__input--background-color);--ez-combo-box__input--focus--border-color:var(--color--primary, #008561);--ez-combo-box__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-combo-box__input--disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__input--error--border-color:#CC2936;--ez-combo-box__btn--color:var(--title--primary, #2B3A54);--ez-combo-box__btn-disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__btn-hover--color:var(--color--primary, #4e4e4e);--ez-combo-box__label--color:var(--title--primary, #2B3A54);--ez-combo-box__list-title--primary:var(--title--primary, #2B3A54);--ez-combo-box__list-text--primary:var(--text--primary, #626e82);--ez-combo-box__list-height:calc(var(--ez-combo-box--font-size) + var(--ez-combo-box--space--medium) + 4px);--ez-combo-box__list-min-width:64px;--ez-combo-box--space--medium:var(--space--medium, 12px);--ez-combo-box--space--small:var(--space--small, 6px);--ez-combo-box__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-combo-box__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-combo-box__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-combo-box__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-combo-box__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-combo-box__scrollbar--width:var(--space--medium, 12px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-combo-box--width)}ez-icon{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.suppressed-search-input{--ez-text-input__input--border-color:var(--color--strokes, #dce0e8);--ez-text-input__input--disabled--background-color:var(--background--xlight, #fff);--ez-text-input__input--disabled--color:var(--title--primary, #2B3A54)}.list-container{min-width:var(--ez-combo-box__list-min-width);position:relative;width:100%}.list-wrapper{display:flex;flex-direction:column;box-sizing:border-box;width:0;z-index:var(--more-visible, 2);max-height:calc(4*var(--ez-combo-box__list-height) + 2*var(--ez-combo-box--space--small) + 9px);background-color:var(--ez-combo-box--background-color--xlight);border-radius:var(--ez-combo-box--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000);padding:var(--ez-combo-box--space--small)}.list-options{box-sizing:border-box;width:100%;height:100%;padding:0;display:flex;flex-direction:column;scroll-behavior:smooth;overflow:auto;scrollbar-width:thin;gap:3px;scrollbar-color:var(--ez-combo-box__scrollbar--color-clicked) var(--ez-combo-box__scrollbar--color-background)}.list-options::-webkit-scrollbar{background-color:var(--ez-combo-box__scrollbar--color-background);width:var(--ez-combo-box__scrollbar--width);max-width:var(--ez-combo-box__scrollbar--width);min-width:var(--ez-combo-box__scrollbar--width)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-combo-box__scrollbar--color-background);border-radius:var(--ez-combo-box__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-combo-box__scrollbar--color-default);border-radius:var(--ez-combo-box__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb:vertical:hover,.list-options::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-combo-box__scrollbar--color-hover)}.list-options::-webkit-scrollbar-thumb:vertical:active,.list-options::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-combo-box__scrollbar--color-clicked)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-combo-box--border-radius-small);padding:var(--ez-combo-box--space--small);min-height:var(--ez-combo-box__list-height);gap:var(--space--small, 6px)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-combo-box__list-title--primary);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size);line-height:var(--ez-combo-box--line-height)}.item__label{font-weight:var(--ez-combo-box--font-weight--medium)}.item__label--bold{font-weight:var(--ez-combo-box--font-weight--large)}.item__value{text-align:center;color:var(--ez-combo-box__list-text--primary);font-weight:var(--ez-combo-box--font-weight--large)}.item__value--hidden{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}.item__label{text-align:left}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;min-height:var(--ez-combo-box__list-height)}.message__no-result{color:var(--ez-combo-box__list-title--primary);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size)}.message__loading{border-radius:50%;width:14px;height:14px;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:3px solid var(--ez-combo-box__list-title--primary);border-top:3px solid transparent}li:hover{background-color:var(--ez-combo-box--background-medium)}.preselected{background-color:var(--background--medium)}.btn{outline:none;border:none;background:none;cursor:pointer;padding:0px;color:var(--ez-combo-box__btn--color)}.btn:disabled{cursor:unset;color:var(--ez-combo-box__btn-disabled--color)}.btn:disabled:hover{cursor:not-allowed;color:var(--ez-combo-box__btn-disabled--color)}.btn:hover{color:var(--ez-combo-box__btn-hover--color)}.btn__close{visibility:hidden}ez-text-input:hover .btn__close,ez-text-input:focus .btn__close{visibility:visible}.text-input-slot-container{--ez-text-input__icon--width:32px;--ez-text-input__min-width:var(--ez-combo-box__min-width);--ez-text-input__max-width:var(--ez-combo-box__max-width)}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";export{b as ez_combo_box}
1
+ import{r as i,c as t,h as o,H as e,g as s}from"./p-23a36bb6.js";import{ObjectUtils as r,FloatingManager as l,StringUtils as a,ElementIDUtils as n}from"@sankhyalabs/core";import"./p-2187f86c.js";import{C as h}from"./p-9e11fc7b.js";import"./p-ab574d59.js";import"./p-b853763b.js";import"./p-4607fb89.js";const b=class{constructor(o){i(this,o),this.ezChange=t(this,"ezChange",7),this._changeDeboucingTimeout=null,this._deboucingTime=300,this._maxWidthValue=0,this._tabPressed=!1,this._textEmptyList="Nenhum resultado encontrado",this._lookupMode=!1,this._preSelection=void 0,this._visibleOptions=void 0,this._startLoading=!1,this._showLoading=!0,this._criteria=void 0,this.limitCharsToSearch=3,this.value=void 0,this.label=void 0,this.enabled=!0,this.options=void 0,this.errorMessage=void 0,this.showSelectedValue=!1,this.showOptionValue=!1,this.suppressSearch=!1,this.optionLoader=void 0,this.suppressEmptyOption=!1,this.stopPropagateEnterKeyEvent=!0,this.canShowError=!0,this.mode="regular",this.hideErrorOnFocusOut=!0,this.listOptionsPosition=void 0,this.isTextSearch=!1,this.autoFocus=!1,this.noMargin=!1}observeErrorMessage(){var i;this._textInput&&(this._textInput.errorMessage=this.errorMessage,(null===(i=this.errorMessage)||void 0===i?void 0:i.trim())||this.setInputValue())}observeValue(i,t){if(this._textInput&&i!=t)try{if("string"==typeof i)return void this.setInputValue();const o=this.getSelectedOption(i),e=this.getSelectedOption(t),s=this.getSelectedOption(this.value);this.isDifferentValues(s,o)&&(this.value=o),this.isDifferentValues(o,e)&&(this.setInputValue(),this._lookupMode||this.ezChange.emit(null===o?void 0:o)),this.resetOptions()}finally{this._lookupMode=!1}}observeOptions(i,t){r.equals(i,t)||this.loadOptions(c.PRELOAD)}async getValueAsync(){return new Promise(this._showLoading?i=>{let t=setInterval((()=>{this._showLoading||(clearInterval(t),i(this.value))}),100)}:i=>i(this.value))}async setFocus(i){this._textInput&&this._textInput.setFocus(i)}async setBlur(){this._textInput&&this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async clearValue(){this.clearSearch()}scrollListener(){var i;null!=this._floatingID&&((null===(i=this.listOptionsPosition)||void 0===i?void 0:i.hardPosition)?this.hideOptions():window.requestAnimationFrame((()=>{this.updateListPosition()})))}updateListPosition(){let{verticalPosition:i,horizontalPosition:t,fromBottom:o,fromRight:e,bottomLimit:s,hardPosition:r}=this.getListPosition();const l=this._listWrapper.getBoundingClientRect(),a=this._listContainer.getBoundingClientRect(),n=this._textInput.getBoundingClientRect(),h=s||window.innerHeight;!o&&(l.top<0||a.bottom+l.height>h)&&(o=!0),r||(i=i||0,t=t||0,o?i=window.innerHeight-n.top+i:i+=a.top,e?t=window.innerWidth-n.right+t:t+=a.left),null!=i&&(this._listWrapper.style[o?"bottom":"top"]=`${i}px`,this._listWrapper.style[o?"top":"bottom"]=""),null!=t&&(this._listWrapper.style[e?"right":"left"]=`${t}px`,this._listWrapper.style[e?"left":"right"]="")}getListPosition(){return this.listOptionsPosition?this.listOptionsPosition:{verticalPosition:6}}isDifferentValues(i,t){return r.objectToString(i||{})!==r.objectToString(t||{})}getFormattedText(i){if(null!=i)return this.showSelectedValue&&null!=i.value?i.label?`${i.value} - ${i.label}`:i.value:i.label}getText(){const i=this.getSelectedOption(this.value),t=this.getFormattedText(i);if(null!=t)return String(t).replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"')}getSelectedOption(i){return"string"==typeof i||i instanceof String?this._visibleOptions.find((t=>t.value===i)):i}updateVisibleOptions(){let i=this._source||[];if(this._criteria){const t=this._criteria.toUpperCase();i=i.filter((i=>i.label.toLocaleUpperCase().indexOf(t)>-1))}this.hasToAddEmptyoption(i)&&(i=[{value:void 0,label:""}].concat(i)),this._visibleOptions=i,this._maxWidthValue=this.getMaxWidthValue()}hasToAddEmptyoption(i){return!this.suppressEmptyOption&&!i.filter((i=>!i.value)).length}getMaxWidthValue(){var i;if(this.showOptionValue){const t=[];return null===(i=this._visibleOptions)||void 0===i||i.forEach((i=>{const o=this.getWidthValue(i.value);t.includes(o)||t.push(o)})),t.length>1?Math.max(...t):0}return 0}getWidthValue(i){if(null!=this._itemValueBasis){const t=this._itemValueBasis;if(null!=i)return t.innerHTML=i,t.clientWidth>0?t.clientWidth+2:0;t.innerHTML=""}return 0}buildItem(i,t){const e=this.showOptionValue&&this._maxWidthValue>0?`${this._maxWidthValue}px`:"";return i.label=i.label||i.value,o("li",{class:t===this._preSelection?"item preselected":"item",id:`item_${i.value}`,onMouseDown:()=>this.selectOption(i),onMouseOver:()=>this._preSelection=t},this.showOptionValue?o("span",{class:"item__value",title:i.value,style:{width:e,minWidth:e,maxWidth:e}},i.value):void 0,o("span",{class:"item__label "+(this.showOptionValue?"item__label--bold":""),title:i.label},i.label))}showOptions(){var i,t;if(!this.enabled)return;if(this.isOptionsVisible())return;const o=null!==(t=null===(i=this.value)||void 0===i?void 0:i.value)&&void 0!==t?t:this.value,e=this._visibleOptions.findIndex((i=>i.value===o));this._preSelection=-1===e?0:e,this._resizeObserver&&this._resizeObserver.observe(this._textInput),this._floatingID=l.float(this._listWrapper,this._listContainer,{autoClose:!0,isFixed:!0,backClickListener:()=>this.hideOptions()}),this.setFocus(),window.requestAnimationFrame((()=>{this.updateListPosition(),this.listOptionsPosition||this._listWrapper.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}))}hideOptions(){void 0!==this._floatingID&&l.close(this._floatingID),this._floatingID=void 0,this._resizeObserver&&this._resizeObserver.unobserve(this._textInput)}isOptionsVisible(){return void 0!==this._floatingID&&l.isFloating(this._floatingID)}nextOption(){this.isOptionsVisible()&&(this.showOptions(),this._preSelection=void 0===this._preSelection?0:Math.min(this._preSelection+1,this._visibleOptions.length-1),this.scrollToOption(this._visibleOptions[this._preSelection]))}previousOption(){this._preSelection=void 0===this._preSelection?0:Math.max(this._preSelection-1,0),this.scrollToOption(this._visibleOptions[this._preSelection])}scrollToOption(i){window.requestAnimationFrame((()=>{const t=(null==i?void 0:i.value)?this._optionsList.querySelector(`li#item_${i.value.replace(/[<>\[\]#=]/g,"\\$&").replace(/:/g,"\\:")}`):void 0;t&&t.scrollIntoView({behavior:"smooth",block:"nearest"})}))}selectCurrentOption(i=!0){void 0!==this._preSelection?(this.selectOption(this._visibleOptions[this._preSelection],i),this._preSelection=void 0):this.controlListWithOnlyOne(i)}controlListWithOnlyOne(i=!0){var t;const o=null===(t=this._visibleOptions)||void 0===t?void 0:t.filter((i=>""!==i.label&&null!=i.value));if((null==o?void 0:o.length)>0){let t=a.decodeHtmlEntities(o[0].label);this.selectOption({value:o[0].value,label:t},i)}}updateSource(i){this._startLoading=!1,i instanceof Promise?(this._showLoading=!0,i.then((i=>{this._showLoading=!1,this.updateSource(i)})).catch((()=>this._showLoading=!1)),this.updateVisibleOptions()):(this._showLoading=!1,Array.isArray(i)?(this._source=i,this.updateVisibleOptions(),this._tabPressed&&(this._tabPressed=!1)):this.selectOption(i))}selectOption(i,t=!0){var o,e;const s=this.getSelectedOption(this.value);(null===(o=null==s?void 0:s.value)||void 0===o?void 0:o.toString())!==(null===(e=null==i?void 0:i.value)||void 0===e?void 0:e.toString())||null==s&&null!=i&&"value"in i?this.value=(null==i?void 0:i.value)?i:void 0:this.resetOptions(),t&&setTimeout((()=>{this.setFocus()}),0)}loadOptions(i,t=""){this._criteria=t,this._startLoading=!0,this.updateSource(this.optionLoader?this.optionLoader({mode:i,argument:t}):this.options)}cancelPreselection(){!this._textInput.value&&this.value?this.selectOption(void 0):window.setTimeout((()=>{this.setInputValue(!1)}),this._deboucingTime)}setInputValue(i=!0){const t=this.getText();(this._textInput.value||"")!==t&&(this._textInput.value=t,i&&(this.errorMessage=null))}clearSearch(){this.value=null}resetOptions(){this.hideOptions(),this._criteria=void 0,this._preSelection=void 0,this.updateVisibleOptions()}componentWillLoad(){if(void 0===this.options){this.options=[];const i=this.el.querySelectorAll("option");i&&i.forEach((i=>{let t=i.innerText,o=i.getAttribute("value");o||(o=t),this.options.push({label:t,value:o}),i.hidden=!0}))}this.loadOptions(c.PRELOAD)}componentDidRender(){var i;void 0===this._floatingID&&this._listWrapper.remove(),null===(i=this._optionsList)||void 0===i||i.querySelectorAll(".item").forEach((i=>{n.addIDInfoIfNotExists(i,"itemComboBox")}))}componentDidLoad(){h.applyVarsTextInput(this.el,this._textInput),this.setInputValue(!1),this._resizeObserver=new ResizeObserver((i=>{window.requestAnimationFrame((()=>{if(!Array.isArray(i)||!i.length)return;const{clientWidth:t}=this._listContainer;t>0&&this._listWrapper&&(this._listWrapper.style.width=`${t}px`)}))})),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}handlerIconClick(){this.showOptions()}onTextInputChangeHandler(i){var t;if(this.clearDeboucingTimeout(),this._startLoading)return void(this._changeDeboucingTimeout=window.setTimeout((()=>{this.onTextInputChangeHandler(i)}),this._deboucingTime));const o=null===(t=i.target.value)||void 0===t?void 0:t.trim();this._criteria||(this._textInput.value=i.data||o),this._criteria=o,o?(this.updateVisibleOptions(),this.showOptions()):(this._preSelection=void 0,this.updateVisibleOptions())}clearDeboucingTimeout(){this._changeDeboucingTimeout&&(window.clearTimeout(this._changeDeboucingTimeout),this._changeDeboucingTimeout=null)}onTextInputClickHandler(){this.showOptions()}keyDownHandler(i){switch(this._tabPressed=!1,i.ctrlKey&&("f"!==i.key&&"F"!==i.key||(this.loadOptions(c.ADVANCED),i.stopPropagation(),i.stopImmediatePropagation(),i.preventDefault())),i.key){case"ArrowDown":i.stopPropagation(),this.canShowListOptions()&&i.preventDefault(),this.showOptions(),this.nextOption();break;case"ArrowUp":i.stopPropagation(),this.canShowListOptions()&&i.preventDefault(),this.showOptions(),this.previousOption();break;case"Enter":this.handleEventPropagation(i),this.isOptionsVisible()&&this.selectCurrentOption();break;case"Escape":this.isOptionsVisible()&&i.stopPropagation(),this.cancelPreselection(),this.resetOptions();break;case"Tab":this._tabPressed=!0,this.isOptionsVisible()&&this.selectCurrentOption(!1),this.resetOptions()}}handleEventPropagation(i){this._listContainer.hasChildNodes()&&this.stopPropagateEnterKeyEvent&&i.stopPropagation()}onTextInputFocusOutHandler(){this.hideErrorOnFocusOut&&this.cancelPreselection()}canShowListOptions(){return!this._showLoading&&this._visibleOptions.length>0}render(){return n.addIDInfoIfNotExists(this.el,"input"),o(e,null,o("ez-text-input",{"data-element-id":n.getInternalIDInfo("textInput"),class:"text-input-slot-container "+(this.suppressSearch?"suppressed-search-input":""),ref:i=>this._textInput=i,"data-slave-mode":"true",enabled:this.enabled&&!this.suppressSearch,onInput:i=>this.onTextInputChangeHandler(i),onClick:()=>this.onTextInputClickHandler(),onFocusout:()=>this.onTextInputFocusOutHandler(),onKeyDown:i=>this.keyDownHandler(i),label:this.label,canShowError:this.canShowError,errorMessage:this.errorMessage,mode:this.mode,noMargin:this.noMargin},o("button",{class:"btn",slot:"rightIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.handlerIconClick()},o("ez-icon",{iconName:"chevron-down"}))),o("section",{class:"list-container",ref:i=>this._listContainer=i},o("div",{class:"list-wrapper",ref:i=>this._listWrapper=i},o("ul",{class:"list-options",ref:i=>this._optionsList=i},!this._showLoading&&0===this._visibleOptions.length&&o("div",{class:"message"},o("span",{class:"message__no-result"},this._textEmptyList)),this._showLoading&&o("div",{class:"message"},o("div",{class:"message__loading"})),this.showOptionValue?o("span",{class:"item__value item__value--hidden",ref:i=>this._itemValueBasis=i}):void 0,this.canShowListOptions()&&this._visibleOptions.map(((i,t)=>this.buildItem(i,t)))))))}get el(){return s(this)}static get watchers(){return{errorMessage:["observeErrorMessage"],value:["observeValue"],options:["observeOptions"]}}};var c;!function(i){i.ADVANCED="ADVANCED",i.PRELOAD="PRELOAD",i.PREDICTIVE="PREDICTIVE"}(c||(c={})),b.style=":host{--ez-combo-box--height:42px;--ez-combo-box--width:100%;--ez-combo-box__icon--width:48px;--ez-combo-box__min-width:0px;--ez-combo-box__max-width:100%;--ez-combo-box--border-radius:var(--border--radius-medium, 12px);--ez-combo-box--border-radius-small:var(--border--radius-small, 6px);--ez-combo-box--font-size:var(--text--medium, 14px);--ez-combo-box--font-family:var(--font-pattern, Arial);--ez-combo-box--font-weight--large:var(--text-weight--large, 500);--ez-combo-box--font-weight--medium:var(--text-weight--medium, 400);--ez-combo-box--background-color--xlight:var(--background--xlight, #fff);--ez-combo-box--background-medium:var(--background--medium, #f0f3f7);--ez-combo-box--line-height:calc(var(--text--medium, 14px) + 4px);--ez-combo-box__input--background-color:var(--background--medium, #e0e0e0);--ez-combo-box__input--border:var(--border--medium, 2px solid);--ez-combo-box__input--border-color:var(--ez-combo-box__input--background-color);--ez-combo-box__input--focus--border-color:var(--color--primary, #008561);--ez-combo-box__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-combo-box__input--disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__input--error--border-color:#CC2936;--ez-combo-box__btn--color:var(--title--primary, #2B3A54);--ez-combo-box__btn-disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__btn-hover--color:var(--color--primary, #4e4e4e);--ez-combo-box__label--color:var(--title--primary, #2B3A54);--ez-combo-box__list-title--primary:var(--title--primary, #2B3A54);--ez-combo-box__list-text--primary:var(--text--primary, #626e82);--ez-combo-box__list-height:calc(var(--ez-combo-box--font-size) + var(--ez-combo-box--space--medium) + 4px);--ez-combo-box__list-min-width:64px;--ez-combo-box--space--medium:var(--space--medium, 12px);--ez-combo-box--space--small:var(--space--small, 6px);--ez-combo-box__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-combo-box__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-combo-box__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-combo-box__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-combo-box__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-combo-box__scrollbar--width:var(--space--medium, 12px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-combo-box--width)}ez-icon{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.suppressed-search-input{--ez-text-input__input--border-color:var(--color--strokes, #dce0e8);--ez-text-input__input--disabled--background-color:var(--background--xlight, #fff);--ez-text-input__input--disabled--color:var(--title--primary, #2B3A54)}.list-container{min-width:var(--ez-combo-box__list-min-width);position:relative;width:100%}.list-wrapper{display:flex;flex-direction:column;box-sizing:border-box;width:0;z-index:var(--more-visible, 2);max-height:calc(4*var(--ez-combo-box__list-height) + 2*var(--ez-combo-box--space--small) + 9px);background-color:var(--ez-combo-box--background-color--xlight);border-radius:var(--ez-combo-box--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000);padding:var(--ez-combo-box--space--small)}.list-options{box-sizing:border-box;width:100%;height:100%;padding:0;display:flex;flex-direction:column;scroll-behavior:smooth;overflow:auto;scrollbar-width:thin;gap:3px;scrollbar-color:var(--ez-combo-box__scrollbar--color-clicked) var(--ez-combo-box__scrollbar--color-background)}.list-options::-webkit-scrollbar{background-color:var(--ez-combo-box__scrollbar--color-background);width:var(--ez-combo-box__scrollbar--width);max-width:var(--ez-combo-box__scrollbar--width);min-width:var(--ez-combo-box__scrollbar--width)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-combo-box__scrollbar--color-background);border-radius:var(--ez-combo-box__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-combo-box__scrollbar--color-default);border-radius:var(--ez-combo-box__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb:vertical:hover,.list-options::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-combo-box__scrollbar--color-hover)}.list-options::-webkit-scrollbar-thumb:vertical:active,.list-options::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-combo-box__scrollbar--color-clicked)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-combo-box--border-radius-small);padding:var(--ez-combo-box--space--small);min-height:var(--ez-combo-box__list-height);gap:var(--space--small, 6px)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-combo-box__list-title--primary);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size);line-height:var(--ez-combo-box--line-height)}.item__label{font-weight:var(--ez-combo-box--font-weight--medium)}.item__label--bold{font-weight:var(--ez-combo-box--font-weight--large)}.item__value{text-align:center;color:var(--ez-combo-box__list-text--primary);font-weight:var(--ez-combo-box--font-weight--large)}.item__value--hidden{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}.item__label{text-align:left}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;min-height:var(--ez-combo-box__list-height)}.message__no-result{color:var(--ez-combo-box__list-title--primary);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size)}.message__loading{border-radius:50%;width:14px;height:14px;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:3px solid var(--ez-combo-box__list-title--primary);border-top:3px solid transparent}li:hover{background-color:var(--ez-combo-box--background-medium)}.preselected{background-color:var(--background--medium)}.btn{outline:none;border:none;background:none;cursor:pointer;padding:0px;color:var(--ez-combo-box__btn--color)}.btn:disabled{cursor:unset;color:var(--ez-combo-box__btn-disabled--color)}.btn:disabled:hover{cursor:not-allowed;color:var(--ez-combo-box__btn-disabled--color)}.btn:hover{color:var(--ez-combo-box__btn-hover--color)}.btn__close{visibility:hidden}ez-text-input:hover .btn__close,ez-text-input:focus .btn__close{visibility:visible}.text-input-slot-container{--ez-text-input__icon--width:32px;--ez-text-input__min-width:var(--ez-combo-box__min-width);--ez-text-input__max-width:var(--ez-combo-box__max-width)}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";export{b as ez_combo_box}
@@ -1 +1 @@
1
- import{r as e,c as i,h as t,g as r}from"./p-e4c7eb39.js";import{StringUtils as o,ElementIDUtils as l}from"@sankhyalabs/core";const s=class{constructor(t){e(this,t),this.ezClick=i(this,"ezClick",7),this.ezRemove=i(this,"ezRemove",7),this.canRemove=!0,this.fileName=void 0,this.iconName=void 0,this.fileSize=void 0,this.progress=100}observeProgress(e){if(e<0||e>100)throw new Error("O progresso de upload deve ser um número entre 0 e 100.");this._element.style.setProperty("--ez-file-item--upload-progress",100-e+"%")}getFileSize(){return this.fileSize&&0!==this.fileSize?`(${o.formatBytes(this.fileSize)})`:""}getIconName(){let e;if(this.iconName)return this.iconName;if(this.fileName.indexOf(".")>-1){const i=this.fileName.lastIndexOf(".");e=this.fileName.substring(i)}return a[e]||n}render(){return this._element.title=`${this.fileName} ${this.getFileSize()}`,l.addIDInfoIfNotExists(this._element,"ezFileIcon"),t("div",{class:"box",onClick:()=>this.ezClick.emit(this.fileName)},t("div",{class:"content"},t("ez-icon",{"data-element-id":l.getInternalIDInfo("fileIcon"),class:"file-type-icon",size:"medium","icon-name":this.getIconName()}),t("label",{class:"file-name"},this.fileName),t("label",{class:"file-size"},this.getFileSize())),this.canRemove?t("ez-icon",{"data-element-id":l.getInternalIDInfo("remove"),class:"btn-remove",size:"medium","icon-name":"close",onClick:e=>{this.ezRemove.emit(this.fileName),e.stopPropagation()}}):void 0)}get _element(){return r(this)}static get watchers(){return{progress:["observeProgress"]}}},a={".exe":"exe",".gif":"gif",".mp3":"mp3",".mp4":"mp4",".pdf":"pdf",".png":"png",".txt":"txt",".zip":"zip",".docx":"docx",".xlsx":"xlsx",".pptx":"pptx"},n="generic";s.style=':host{display:flex;width:100%;--ez-file-item--height:42px;--ez-file-item--padding:9px;--ez-file-item--border-radius:var(--border--radius-medium, 12px);--ez-file-item--border-color:var(--color--strokes, #DCE0E8);--ez-file-item--border-style:var(--border--small, 1px solid);--ez-file-item--font-family:var(--font-pattern, Arial);--ez-file-item--font-size:var(--text--medium, 14px);--ez-file-item--font-weight:var(--text-weight--medium, 400);--ez-file-item--color:var(--title--primary, #2B3A54);--ez-file-item__file-size--font-weight:var(--text-weight--large, 600);--ez-file-item__file-size--color:var(--color--primary, #008561);--ez-file-item__background-progress--color:var(--color--primary-300, E2F4EF);--ez-file-item--icon-color:var(--title--primary, #2B3A54)}.box{display:flex;box-sizing:border-box;position:relative;align-items:center;justify-content:space-between;width:100%;padding:var(--ez-file-item--padding);border:var(--ez-file-item--border-color) var(--ez-file-item--border-style);border-radius:var(--ez-file-item--border-radius);height:var(--ez-file-item--height)}.box::before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;clip-path:inset(2px calc(var(--ez-file-item--upload-progress, 0%) + 2px) 2px 2px round calc(var(--ez-file-item--border-radius) - 4px));background-color:var(--ez-file-item__background-progress--color)}.content{display:flex;align-items:center;z-index:0;overflow:hidden}.file-name{text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-family:var(--ez-file-item--font-family);font-size:var(--ez-file-item--font-size);font-weight:var(--ez-file-item--font-weight);color:var(--ez-file-item--color)}.file-type-icon{flex-shrink:0;--ez-icon--color:var(--ez-file-item--icon-color);padding-right:var(--ez-file-item--padding)}.file-size{padding-left:2px;overflow:hidden;flex-shrink:0;white-space:nowrap;font-family:var(--ez-file-item--font-family);font-size:var(--ez-file-item--font-size);font-weight:var(--ez-file-item__file-size--font-weight);color:var(--ez-file-item__file-size--color)}.btn-remove{cursor:pointer;flex-shrink:0;--ez-icon--color:var(--ez-file-item--icon-color)}';export{s as ez_file_item}
1
+ import{r as e,c as i,h as t,g as r}from"./p-23a36bb6.js";import{StringUtils as o,ElementIDUtils as l}from"@sankhyalabs/core";const s=class{constructor(t){e(this,t),this.ezClick=i(this,"ezClick",7),this.ezRemove=i(this,"ezRemove",7),this.canRemove=!0,this.fileName=void 0,this.iconName=void 0,this.fileSize=void 0,this.progress=100}observeProgress(e){if(e<0||e>100)throw new Error("O progresso de upload deve ser um número entre 0 e 100.");this._element.style.setProperty("--ez-file-item--upload-progress",100-e+"%")}getFileSize(){return this.fileSize&&0!==this.fileSize?`(${o.formatBytes(this.fileSize)})`:""}getIconName(){let e;if(this.iconName)return this.iconName;if(this.fileName.indexOf(".")>-1){const i=this.fileName.lastIndexOf(".");e=this.fileName.substring(i)}return a[e]||n}render(){return this._element.title=`${this.fileName} ${this.getFileSize()}`,l.addIDInfoIfNotExists(this._element,"ezFileIcon"),t("div",{class:"box",onClick:()=>this.ezClick.emit(this.fileName)},t("div",{class:"content"},t("ez-icon",{"data-element-id":l.getInternalIDInfo("fileIcon"),class:"file-type-icon",size:"medium","icon-name":this.getIconName()}),t("label",{class:"file-name"},this.fileName),t("label",{class:"file-size"},this.getFileSize())),this.canRemove?t("ez-icon",{"data-element-id":l.getInternalIDInfo("remove"),class:"btn-remove",size:"medium","icon-name":"close",onClick:e=>{this.ezRemove.emit(this.fileName),e.stopPropagation()}}):void 0)}get _element(){return r(this)}static get watchers(){return{progress:["observeProgress"]}}},a={".exe":"exe",".gif":"gif",".mp3":"mp3",".mp4":"mp4",".pdf":"pdf",".png":"png",".txt":"txt",".zip":"zip",".docx":"docx",".xlsx":"xlsx",".pptx":"pptx"},n="generic";s.style=':host{display:flex;width:100%;--ez-file-item--height:42px;--ez-file-item--padding:9px;--ez-file-item--border-radius:var(--border--radius-medium, 12px);--ez-file-item--border-color:var(--color--strokes, #DCE0E8);--ez-file-item--border-style:var(--border--small, 1px solid);--ez-file-item--font-family:var(--font-pattern, Arial);--ez-file-item--font-size:var(--text--medium, 14px);--ez-file-item--font-weight:var(--text-weight--medium, 400);--ez-file-item--color:var(--title--primary, #2B3A54);--ez-file-item__file-size--font-weight:var(--text-weight--large, 600);--ez-file-item__file-size--color:var(--color--primary, #008561);--ez-file-item__background-progress--color:var(--color--primary-300, E2F4EF);--ez-file-item--icon-color:var(--title--primary, #2B3A54)}.box{display:flex;box-sizing:border-box;position:relative;align-items:center;justify-content:space-between;width:100%;padding:var(--ez-file-item--padding);border:var(--ez-file-item--border-color) var(--ez-file-item--border-style);border-radius:var(--ez-file-item--border-radius);height:var(--ez-file-item--height)}.box::before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;clip-path:inset(2px calc(var(--ez-file-item--upload-progress, 0%) + 2px) 2px 2px round calc(var(--ez-file-item--border-radius) - 4px));background-color:var(--ez-file-item__background-progress--color)}.content{display:flex;align-items:center;z-index:0;overflow:hidden}.file-name{text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-family:var(--ez-file-item--font-family);font-size:var(--ez-file-item--font-size);font-weight:var(--ez-file-item--font-weight);color:var(--ez-file-item--color)}.file-type-icon{flex-shrink:0;--ez-icon--color:var(--ez-file-item--icon-color);padding-right:var(--ez-file-item--padding)}.file-size{padding-left:2px;overflow:hidden;flex-shrink:0;white-space:nowrap;font-family:var(--ez-file-item--font-family);font-size:var(--ez-file-item--font-size);font-weight:var(--ez-file-item__file-size--font-weight);color:var(--ez-file-item__file-size--color)}.btn-remove{cursor:pointer;flex-shrink:0;--ez-icon--color:var(--ez-file-item--icon-color)}';export{s as ez_file_item}