@sankhyalabs/ezui 5.22.0-dev.58 → 5.22.0-dev.59

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 (195) 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 +3 -2
  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 +3 -2
  15. package/dist/cjs/ez-custom-form-input_2.cjs.entry.js +2 -2
  16. package/dist/cjs/ez-date-input.cjs.entry.js +3 -2
  17. package/dist/cjs/ez-date-time-input.cjs.entry.js +3 -2
  18. package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
  19. package/dist/cjs/ez-dropdown_2.cjs.entry.js +1 -1
  20. package/dist/cjs/ez-file-item.cjs.entry.js +1 -1
  21. package/dist/cjs/ez-form-view.cjs.entry.js +9 -9
  22. package/dist/cjs/ez-form.cjs.entry.js +1 -1
  23. package/dist/cjs/ez-grid.cjs.entry.js +1 -1
  24. package/dist/cjs/ez-guide-navigator.cjs.entry.js +1 -1
  25. package/dist/cjs/ez-icon.cjs.entry.js +1 -1
  26. package/dist/cjs/ez-list.cjs.entry.js +1 -1
  27. package/dist/cjs/ez-loading-bar.cjs.entry.js +1 -1
  28. package/dist/cjs/ez-modal-container.cjs.entry.js +1 -1
  29. package/dist/cjs/ez-modal.cjs.entry.js +1 -1
  30. package/dist/cjs/ez-multi-selection-list.cjs.entry.js +2 -2
  31. package/dist/cjs/ez-number-input.cjs.entry.js +3 -2
  32. package/dist/cjs/ez-popover.cjs.entry.js +1 -1
  33. package/dist/cjs/ez-popup.cjs.entry.js +1 -1
  34. package/dist/cjs/ez-radio-button.cjs.entry.js +1 -1
  35. package/dist/cjs/ez-scroller_2.cjs.entry.js +1 -1
  36. package/dist/cjs/ez-search.cjs.entry.js +3 -2
  37. package/dist/cjs/ez-sidebar-navigator.cjs.entry.js +1 -1
  38. package/dist/cjs/ez-split-button.cjs.entry.js +1 -1
  39. package/dist/cjs/ez-split-item.cjs.entry.js +1 -1
  40. package/dist/cjs/ez-split-panel.cjs.entry.js +1 -1
  41. package/dist/cjs/ez-tabselector.cjs.entry.js +1 -1
  42. package/dist/cjs/ez-text-area.cjs.entry.js +1 -1
  43. package/dist/cjs/ez-text-input.cjs.entry.js +4 -3
  44. package/dist/cjs/ez-time-input.cjs.entry.js +3 -2
  45. package/dist/cjs/ez-toast.cjs.entry.js +1 -1
  46. package/dist/cjs/ez-tooltip.cjs.entry.js +1 -1
  47. package/dist/cjs/ez-tree.cjs.entry.js +1 -1
  48. package/dist/cjs/ez-upload.cjs.entry.js +1 -1
  49. package/dist/cjs/ez-view-stack.cjs.entry.js +1 -1
  50. package/dist/cjs/ezui.cjs.js +2 -2
  51. package/dist/cjs/filter-column.cjs.entry.js +1 -1
  52. package/dist/cjs/{index-9e5554cb.js → index-a7b0c73d.js} +0 -3
  53. package/dist/cjs/loader.cjs.js +2 -2
  54. package/dist/collection/components/ez-combo-box/ez-combo-box.js +20 -1
  55. package/dist/collection/components/ez-date-input/ez-date-input.js +20 -1
  56. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +20 -1
  57. package/dist/collection/components/ez-filter-input/ez-filter-input.js +20 -1
  58. package/dist/collection/components/ez-form-view/fieldbuilder/templates/CheckBox.tpl.js +1 -1
  59. package/dist/collection/components/ez-form-view/fieldbuilder/templates/ComboBox.tpl.js +1 -1
  60. package/dist/collection/components/ez-form-view/fieldbuilder/templates/DateInput.tpl.js +3 -3
  61. package/dist/collection/components/ez-form-view/fieldbuilder/templates/NumberInput.tpl.js +1 -1
  62. package/dist/collection/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.js +1 -1
  63. package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.js +1 -1
  64. package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.css +0 -1
  65. package/dist/collection/components/ez-number-input/ez-number-input.js +20 -1
  66. package/dist/collection/components/ez-search/ez-search.js +20 -1
  67. package/dist/collection/components/ez-text-input/ez-text-input.css +7 -0
  68. package/dist/collection/components/ez-text-input/ez-text-input.js +20 -1
  69. package/dist/collection/components/ez-time-input/ez-time-input.js +20 -1
  70. package/dist/custom-elements/index.js +34 -26
  71. package/dist/esm/ez-actions-button.entry.js +1 -1
  72. package/dist/esm/ez-alert-list.entry.js +1 -1
  73. package/dist/esm/ez-alert.entry.js +1 -1
  74. package/dist/esm/ez-application.entry.js +1 -1
  75. package/dist/esm/ez-badge.entry.js +1 -1
  76. package/dist/esm/ez-breadcrumb.entry.js +1 -1
  77. package/dist/esm/ez-button.entry.js +1 -1
  78. package/dist/esm/ez-calendar.entry.js +1 -1
  79. package/dist/esm/ez-card-item_3.entry.js +3 -2
  80. package/dist/esm/ez-chart.entry.js +1 -1
  81. package/dist/esm/ez-check.entry.js +1 -1
  82. package/dist/esm/ez-chip.entry.js +1 -1
  83. package/dist/esm/ez-collapsible-box.entry.js +1 -1
  84. package/dist/esm/ez-combo-box.entry.js +3 -2
  85. package/dist/esm/ez-custom-form-input_2.entry.js +2 -2
  86. package/dist/esm/ez-date-input.entry.js +3 -2
  87. package/dist/esm/ez-date-time-input.entry.js +3 -2
  88. package/dist/esm/ez-dialog.entry.js +1 -1
  89. package/dist/esm/ez-dropdown_2.entry.js +1 -1
  90. package/dist/esm/ez-file-item.entry.js +1 -1
  91. package/dist/esm/ez-form-view.entry.js +9 -9
  92. package/dist/esm/ez-form.entry.js +1 -1
  93. package/dist/esm/ez-grid.entry.js +1 -1
  94. package/dist/esm/ez-guide-navigator.entry.js +1 -1
  95. package/dist/esm/ez-icon.entry.js +1 -1
  96. package/dist/esm/ez-list.entry.js +1 -1
  97. package/dist/esm/ez-loading-bar.entry.js +1 -1
  98. package/dist/esm/ez-modal-container.entry.js +1 -1
  99. package/dist/esm/ez-modal.entry.js +1 -1
  100. package/dist/esm/ez-multi-selection-list.entry.js +2 -2
  101. package/dist/esm/ez-number-input.entry.js +3 -2
  102. package/dist/esm/ez-popover.entry.js +1 -1
  103. package/dist/esm/ez-popup.entry.js +1 -1
  104. package/dist/esm/ez-radio-button.entry.js +1 -1
  105. package/dist/esm/ez-scroller_2.entry.js +1 -1
  106. package/dist/esm/ez-search.entry.js +3 -2
  107. package/dist/esm/ez-sidebar-navigator.entry.js +1 -1
  108. package/dist/esm/ez-split-button.entry.js +1 -1
  109. package/dist/esm/ez-split-item.entry.js +1 -1
  110. package/dist/esm/ez-split-panel.entry.js +1 -1
  111. package/dist/esm/ez-tabselector.entry.js +1 -1
  112. package/dist/esm/ez-text-area.entry.js +1 -1
  113. package/dist/esm/ez-text-input.entry.js +4 -3
  114. package/dist/esm/ez-time-input.entry.js +3 -2
  115. package/dist/esm/ez-toast.entry.js +1 -1
  116. package/dist/esm/ez-tooltip.entry.js +1 -1
  117. package/dist/esm/ez-tree.entry.js +1 -1
  118. package/dist/esm/ez-upload.entry.js +1 -1
  119. package/dist/esm/ez-view-stack.entry.js +1 -1
  120. package/dist/esm/ezui.js +3 -3
  121. package/dist/esm/filter-column.entry.js +1 -1
  122. package/dist/esm/{index-5a720e56.js → index-baa5e267.js} +1 -3
  123. package/dist/esm/loader.js +3 -3
  124. package/dist/ezui/ezui.esm.js +1 -1
  125. package/dist/ezui/{p-e6b38ade.entry.js → p-0306dff7.entry.js} +1 -1
  126. package/dist/ezui/{p-91ccae0c.entry.js → p-09de35a2.entry.js} +1 -1
  127. package/dist/ezui/p-14b769d7.entry.js +1 -0
  128. package/dist/ezui/{p-b2f6bc0a.entry.js → p-17be134a.entry.js} +1 -1
  129. package/dist/ezui/p-181b5ae8.entry.js +1 -0
  130. package/dist/ezui/{p-81461d2f.entry.js → p-1e7a8633.entry.js} +1 -1
  131. package/dist/ezui/{p-6b51c9cc.entry.js → p-1f50fa05.entry.js} +1 -1
  132. package/dist/ezui/{p-e4c7eb39.js → p-23a36bb6.js} +2 -2
  133. package/dist/ezui/{p-3c10cd94.entry.js → p-2b46b37b.entry.js} +1 -1
  134. package/dist/ezui/{p-6d31c43c.entry.js → p-2bb2a0c4.entry.js} +1 -1
  135. package/dist/ezui/{p-efbe0b73.entry.js → p-3175fe8c.entry.js} +1 -1
  136. package/dist/ezui/p-3f2dd525.entry.js +1 -0
  137. package/dist/ezui/{p-0378416a.entry.js → p-44caad9a.entry.js} +1 -1
  138. package/dist/ezui/{p-46a46507.entry.js → p-4575d511.entry.js} +1 -1
  139. package/dist/ezui/p-50d83a46.entry.js +1 -0
  140. package/dist/ezui/{p-7567ccdd.entry.js → p-555c9018.entry.js} +1 -1
  141. package/dist/ezui/{p-6fc26622.entry.js → p-5ed81457.entry.js} +1 -1
  142. package/dist/ezui/{p-f1c2c19e.entry.js → p-650e4b6d.entry.js} +1 -1
  143. package/dist/ezui/p-654b3f99.entry.js +1 -0
  144. package/dist/ezui/{p-6d8b3298.entry.js → p-6cdd3e0a.entry.js} +1 -1
  145. package/dist/ezui/{p-554522db.entry.js → p-6d79930d.entry.js} +1 -1
  146. package/dist/ezui/{p-fc194825.entry.js → p-6e429cff.entry.js} +1 -1
  147. package/dist/ezui/p-6f22a385.entry.js +1 -0
  148. package/dist/ezui/{p-2f53435e.entry.js → p-7409eeaa.entry.js} +1 -1
  149. package/dist/ezui/{p-11bfeca3.entry.js → p-77a4bd35.entry.js} +1 -1
  150. package/dist/ezui/{p-397e3026.entry.js → p-7ed30844.entry.js} +1 -1
  151. package/dist/ezui/{p-e18d9e6a.entry.js → p-7fdd479f.entry.js} +1 -1
  152. package/dist/ezui/{p-1b08bf3c.entry.js → p-8888d9ed.entry.js} +1 -1
  153. package/dist/ezui/{p-82fa4b09.entry.js → p-8df1ca33.entry.js} +1 -1
  154. package/dist/ezui/{p-e7395eae.entry.js → p-90bcd2ba.entry.js} +1 -1
  155. package/dist/ezui/{p-a921e3e7.entry.js → p-990b4318.entry.js} +1 -1
  156. package/dist/ezui/{p-c2b20f78.entry.js → p-9f5fa3f9.entry.js} +1 -1
  157. package/dist/ezui/{p-dfca5946.entry.js → p-a80b1287.entry.js} +1 -1
  158. package/dist/ezui/{p-70f1c812.entry.js → p-b36542d8.entry.js} +1 -1
  159. package/dist/ezui/p-b6a4e6de.entry.js +1 -0
  160. package/dist/ezui/{p-30951bd7.entry.js → p-baf80b13.entry.js} +1 -1
  161. package/dist/ezui/p-bc2f844e.entry.js +1 -0
  162. package/dist/ezui/{p-7f5afb1f.entry.js → p-bfad39eb.entry.js} +1 -1
  163. package/dist/ezui/{p-92748142.entry.js → p-c0d9c4f8.entry.js} +1 -1
  164. package/dist/ezui/{p-b858fc6e.entry.js → p-c3045972.entry.js} +1 -1
  165. package/dist/ezui/{p-a563df31.entry.js → p-c4320a39.entry.js} +1 -1
  166. package/dist/ezui/{p-3cc9b84a.entry.js → p-c806f32f.entry.js} +1 -1
  167. package/dist/ezui/{p-ec5f987d.entry.js → p-ca6340a9.entry.js} +1 -1
  168. package/dist/ezui/{p-8f026744.entry.js → p-cd2e78f0.entry.js} +1 -1
  169. package/dist/ezui/{p-16e21a40.entry.js → p-d0ca26fe.entry.js} +1 -1
  170. package/dist/ezui/{p-cce6c015.entry.js → p-d520839d.entry.js} +1 -1
  171. package/dist/ezui/p-dc8b36c3.entry.js +1 -0
  172. package/dist/ezui/{p-aa6ad24d.entry.js → p-df0a9320.entry.js} +1 -1
  173. package/dist/ezui/{p-bef7daac.entry.js → p-e347df9c.entry.js} +1 -1
  174. package/dist/ezui/p-e78e0843.entry.js +1 -0
  175. package/dist/ezui/{p-6bda82d1.entry.js → p-fec696ab.entry.js} +1 -1
  176. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +4 -0
  177. package/dist/types/components/ez-date-input/ez-date-input.d.ts +4 -0
  178. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +4 -0
  179. package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +4 -0
  180. package/dist/types/components/ez-number-input/ez-number-input.d.ts +4 -0
  181. package/dist/types/components/ez-search/ez-search.d.ts +4 -0
  182. package/dist/types/components/ez-text-input/ez-text-input.d.ts +4 -0
  183. package/dist/types/components/ez-time-input/ez-time-input.d.ts +4 -0
  184. package/dist/types/components.d.ts +64 -0
  185. package/package.json +1 -1
  186. package/dist/ezui/p-3af64edd.entry.js +0 -1
  187. package/dist/ezui/p-3d38bfea.entry.js +0 -1
  188. package/dist/ezui/p-66c982c6.entry.js +0 -1
  189. package/dist/ezui/p-6ec40dec.entry.js +0 -1
  190. package/dist/ezui/p-78feb299.entry.js +0 -1
  191. package/dist/ezui/p-9c3ba1ae.entry.js +0 -1
  192. package/dist/ezui/p-bfc30e61.entry.js +0 -1
  193. package/dist/ezui/p-bfc59380.entry.js +0 -1
  194. package/dist/ezui/p-d27b4b3e.entry.js +0 -1
  195. package/dist/ezui/p-d85a0835.entry.js +0 -1
@@ -1 +0,0 @@
1
- import{r as t,c as i,h as e,H as o,g as r}from"./p-e4c7eb39.js";import{MaskFormatter as n,ElementIDUtils as s}from"@sankhyalabs/core";const a=class{constructor(e){t(this,e),this.ezChange=i(this,"ezChange",7),this.label=void 0,this.value=void 0,this.enabled=!0,this.errorMessage=void 0,this.mask=void 0,this.cleanValueMask=!1,this.canShowError=!0,this.restrict=void 0,this.mode="regular",this.noBorder=!1,this.password=!1,this.autoFocus=!1,this.hasRightSlotContent=!1}observeErrorMessage(){this._inputElem&&this.isInvalid().then((t=>{var i;t?(this._inputElem.classList.add("hasError"),null===(i=this._tooltipPositioningObserver)||void 0===i||i.observe(this._inputElem)):(this._inputElem.classList.remove("hasError"),this.removeGlobalTooltip())}))}observeMask(){this.mask&&(null==this._maskFormatter?this._maskFormatter=new n(this.mask):this._maskFormatter.mask=this.mask)}observeValue(t,i){this._inputElem&&t!=i&&(this._inputElem.value=this.value||"",this.handleChange(),this.adjustFloatingLabel(),this.isSlaveMode()||(this.errorMessage="",this.ezChange.emit(this.value)))}adjustFloatingLabel(){if(this.label&&this._labelElem){this._inputElem&&!this._inputElem.classList.contains("input--with--label")&&this._inputElem.classList.add("input--with--label");const t=this.value&&this.value.toString().length>0,i=this._labelElem.classList.contains("input__label--floated");t||this.isFocused()?i||this._labelElem.classList.add("input__label--floated"):i&&this._labelElem.classList.remove("input__label--floated")}}isFocused(){return null!==this._hostElement.shadowRoot.activeElement}isSlaveMode(){var t,i;return"true"===(null===(i=null===(t=this._hostElement)||void 0===t?void 0:t.dataset)||void 0===i?void 0:i.slaveMode)}adjustColorContentSlot(t=""){this._contentLeftSlot&&(this._contentLeftSlot.style.color=t)}adjustBorderInput(){this.noBorder&&this._inputElem.classList.add("input__slim--noborder")}async setFocus(t){const{selectText:i}=t||{};i&&this._inputElem.select(),this._inputElem.focus()}async setBlur(){this._inputElem.blur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}handleFocusout(){const t=this._inputElem.value;if(t&&this._maskFormatter)try{this.cleanValueMask?this.applyMask(t):this._inputElem.value=this._maskFormatter.format(t)}catch(t){this.errorMessage=t.message}this.controlChangeValue(),this.adjustFloatingLabel(),this.adjustColorContentSlot()}isValidValue(t){return!this.restrict||Array.from(t).reduce(((t,i)=>t&&this.restrict.indexOf(i)>-1),!0)}controlChangeValue(){this._inputElem&&(this.value||"")!==this._inputElem.value&&(this.value=this.cleanValueMask?this._maskFormatter.removeMask(this._inputElem.value):this._inputElem.value)}applyMask(t){if(!t||""===t)return t;if(this._maskFormatter)try{const i=this._maskFormatter.applyMask(this._maskFormatter.removeMask(t));return this._inputElem?(this._inputElem.value=i,this._inputElem.value):(this.value=i,this.value)}catch(t){this.errorMessage=t.message}return t}handleChange(){if(!this._inputElem)return;const t=this._inputElem.value;this.isValidValue(t)?this._lastValidValue=t:this._inputElem.value=null==this._lastValidValue?"":this._lastValidValue,this.controlChangeValue()}handleSlotChange(t){var i;const e=t.target,o=e.assignedElements()[0];this.hasRightSlotContent=!1,o&&(o.style.position="absolute",o.style.display="flex",o.style.alignItems="center",o.style.justifyContent="center",o.style.overflow="hidden",o.style.top="0px",o.style.width="var(--ez-text-input__icon--width)",o.style.height="slim"!=this.mode?"var(--ez-text-input--height)":"var(--ez-text-input--height--slim)","leftIcon"==e.name?(o.style.left="0px",o.style.borderRadius="var(--ez-text-input--border-radius) 0 0 var(--ez-text-input--border-radius)",this._inputElem.classList.add("icon--left"),this._labelElem&&this._labelElem.classList.add("input__label--left"),this._contentLeftSlot=o):"rightIcon"==e.name&&(o.style.right="0px",o.style.borderRadius="0 var(--ez-text-input--border-radius) var(--ez-text-input--border-radius) 0",this._inputElem.classList.add("icon--right"),this._labelElem&&this._labelElem.classList.add("input__label--right"),this._tooltipIconElem&&this._tooltipIconElem.classList.add("rightIconSlot"),this.hasRightSlotContent=(null===(i=o.children)||void 0===i?void 0:i.length)>0),e.name&&s.addIDInfo(o,e.name)),this.observeErrorMessage()}doFocus(){this.label&&this._labelElem&&!this._labelElem.classList.contains("input__label--floated")&&this._labelElem.classList.add("input__label--floated"),this.adjustColorContentSlot("var(--ez-text-input__input--focus--icon-color)")}renderGlobalTooltip(){const t=document.createElement("ez-tooltip");t.errorMessage=this.errorMessage,t.anchoringElement=this._tooltipIconElem,document.body.appendChild(t),this._tooltipElem=t}removeGlobalTooltip(){var t;this._tooltipElem&&(this._tooltipElem.remove(),this._tooltipElem=void 0,null===(t=this._tooltipPositioningObserver)||void 0===t||t.unobserve(this._inputElem))}createTooltipPositioningObserver(){const t=new ResizeObserver((()=>{this._tooltipElem&&this._tooltipIconElem&&(clearTimeout(this._observerDebounceTimeout),this._observerDebounceTimeout=setTimeout((async()=>{this._tooltipElem&&await this._tooltipElem.positionTooltip()}),200))}));this._tooltipPositioningObserver=t}componentWillLoad(){if(this.observeMask(),this.value){if(this._maskFormatter)try{this.cleanValueMask?this.applyMask(this.value):this.value=this._maskFormatter.format(this.value)}catch(t){this.errorMessage=t.message}this.isValidValue(this.value)||(this._lastValidValue="",this.value="")}}componentDidLoad(){var t,i;this.observeErrorMessage(),this.observeMask(),this.adjustFloatingLabel(),this.adjustBorderInput(),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})})),null===(t=this._inputElem)||void 0===t||t.addEventListener("focus",(()=>{var t;this._inputElem.setSelectionRange(0,null===(t=this._inputElem)||void 0===t?void 0:t.value.length)})),this.createTooltipPositioningObserver(),this._inputElem&&(null===(i=this._tooltipPositioningObserver)||void 0===i||i.observe(this._inputElem),(t=>{if(!t||!t.style)return void console.error("[applyEllipsisToInput] Referência ao elemento input é inválida.");t.style.textOverflow="ellipsis",t.style.overflow="hidden",t.style.whiteSpace="nowrap";const i=()=>{t.scrollWidth>t.clientWidth?t.setAttribute("title",t.value||""):t.removeAttribute("title")};t.addEventListener("input",i),i()})(this._inputElem))}componentDidRender(){this._tooltipIconElem&&!this._tooltipElem&&this.renderGlobalTooltip()}componentDidUpdate(){this._tooltipIconElem&&this._tooltipElem&&this._tooltipElem.positionTooltip()}disconnectedCallback(){this._tooltipPositioningObserver&&this._tooltipPositioningObserver.disconnect(),this._observerDebounceTimeout&&clearTimeout(this._observerDebounceTimeout),this.removeGlobalTooltip()}render(){return s.addIDInfoIfNotExists(this._hostElement,"input"),e(o,{style:this._hostElement.classList.contains("grid_editor")?{height:"100%"}:null},e("slot",{name:"leftIcon",onSlotchange:t=>{this.handleSlotChange(t)}}),this.label&&"slim"!=this.mode?e("label",{ref:t=>this._labelElem=t,class:`${this.enabled?"input__label":"input__label input__label--disabled"} ${this.errorMessage?"hasError":""}`,onClick:()=>this._inputElem.focus(),title:this.label},this.label):null,e("input",{"data-element-id":s.getInternalIDInfo("input"),onFocus:()=>this.doFocus(),ref:t=>this._inputElem=t,type:this.password?"password":"text",class:"slim"===this.mode?"input--slim":"",placeholder:"slim"===this.mode&&this.label?this.label:"",value:this.mask&&this.cleanValueMask?this.applyMask(this.value):this.value,disabled:!this.enabled,onInput:()=>{this.handleChange()},onFocusout:()=>{this.handleFocusout()}}),this.canShowError&&"slim"!=this.mode&&this.errorMessage&&e("ez-icon",{class:`tooltip-icon ${this.errorMessage?"hasError":""} ${this.hasRightSlotContent?"rightIconSlot":""}`,"data-element-id":s.getInternalIDInfo("tooltip-icon"),ref:t=>this._tooltipIconElem=t,iconName:"alert-circle"}),e("slot",{name:"rightIcon",onSlotchange:t=>{this.handleSlotChange(t)}}," "))}get _hostElement(){return r(this)}static get watchers(){return{errorMessage:["observeErrorMessage"],mask:["observeMask"],value:["observeValue"]}}};a.style=":host{--ez-text-input--height:42px;--ez-text-input--width:100%;--ez-text-input__icon--width:48px;--ez-text-input--height--slim:32px;--ez-text-input__min-width:0px;--ez-text-input__max-width:100%;--ez-text-input--border-radius:var(--border--radius-medium, 12px);--ez-text-input--font-size:var(--text--medium, 14px);--ez-text-input--font-family:var(--font-pattern, Arial);--ez-text-input--font-weight:var(--text-weight--medium, 400);--ez-text-input--color:var(--title--primary, #2B3A54);--ez-text-input__input--background-color:var(--background--light, #ffffff);--ez-text-input__input--border:var(--border--small, 1px solid);--ez-text-input__input--border-color:var(--color--strokes,#DCE0E8);--ez-text-input__input--focus--border-color:var(--color--primary, #008561);--ez-text-input__input--disabled--background-color:var(--background--medium, #F0F3F7);--ez-text-input__input--disabled--color:var(--text--primary, #626E82);--ez-text-input__input--error--border-color:var(--color-alert--error-800,#BD0025);--ez-text-input__input--noborder-color:white;--ez-text-input__input--padding:var(--space--medium, 6px);--ez-text-input__placeholder--color:var(--text--secondary, #a2abb9);--ez-text-input__tooltip_icon--error--color:var(--color-alert--error-800,#BD0025);--ez-text-input__label--floating--top:6px;--ez-text-input__label--padding-top:12px;--ez-text-input__label--padding-left:14px;--ez-text-input__label--padding-right:12px;--ez-text-input__input--focus--icon-color:var(--title--primary, #2B3A54);--ez-text-input__input--disabled--focus--icon-color:var(--text--primary, #626E82);--ez-text-input__tooltip-icon--spacing:var(--space--large);--ez-text-input__tooltip-icon---width:var(--space--large);--ez-text-input__tooltip-icon---horizontal-margin:var(--space--medium, 12px);--ez-text-input__tooltip-icon---vertical-margin:10px;display:flex;flex-wrap:wrap;position:relative;width:var(--ez-text-input--width);min-width:var(--ez-text-input__min-width);max-width:var(--ez-text-input__max-width)}:host(.grid_editor){--ez-text-input--height--slim:25px}input{width:100%;box-sizing:border-box;height:var(--ez-text-input--height);border-radius:var(--ez-text-input--border-radius);font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);border:var(--ez-text-input__input--border);border-color:var(--ez-text-input__input--border-color);background-color:var(--ez-text-input__input--background-color);color:var(--ez-text-input--color);font-weight:var(--ez-text-input--font-weight);padding:var(--ez-text-input__input--padding)}input:disabled{background-color:var(--ez-text-input__input--disabled--background-color);color:var(--ez-text-input__input--disabled--color);cursor:not-allowed}input:focus{outline:none;border-color:var(--ez-text-input__input--focus--border-color)}input.icon--left{padding-left:var(--ez-text-input__icon--width)}input.icon--left.hasError{padding-right:var(--ez-text-input__icon--width)}input.icon--right{padding-right:var(--ez-text-input__icon--width)}input.icon--right.hasError{padding-right:calc(var(--ez-text-input__icon--width) + var(--ez-text-input__tooltip-icon--spacing))}input.hasError{color:var(--ez-text-input--color);border-color:var(--ez-text-input__input--error--border-color);padding-right:calc(var(--ez-text-input__tooltip-icon---width) + (2*var(--ez-text-input__tooltip-icon---horizontal-margin)))}input:disabled.hasError{color:var(--ez-text-input__input--disabled--color)}input.text--right{text-align:right}input:disabled,input:read-only{cursor:not-allowed}.hasError{color:var(--ez-text-input__tooltip_icon--error--color)}.input__label{box-sizing:border-box;position:absolute;z-index:var(--visible);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-transition:font-size .05s, top .05s;transition:font-size .05s, top .05s;width:calc(100% - var(--ez-text-input__label--padding-right));left:var(--ez-text-input--space--medium);font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color);top:var(--ez-text-input__label--padding-top);left:var(--ez-text-input__label--padding-left);padding-right:var(--ez-text-input__label--padding-right)}.input__label.hasError{width:calc(100% - 2*(var(--ez-text-input__tooltip-icon--spacing)))}.input__label--floated{font-family:var(--ez-text-input--font-family);font-size:var(--text--extra-small);color:var(--text--primary);top:var(--ez-text-input__label--floating--top)}.input__label--disabled{color:var(--ez-text-input__input--disabled--color);cursor:not-allowed}.input__label--left{text-align:left;left:calc(var(--ez-text-input__icon--width) + 2px);width:calc(100% - var(--ez-text-input__icon--width))}.input__label--left.hasError{width:calc(100% - var(--ez-text-input__icon--width) - var(--ez-text-input__tooltip-icon--spacing))}.input__label--right{right:var(--ez-text-input__icon--width);width:calc(100% - var(--ez-text-input__icon--width))}.input__label--right.hasError{width:calc(100% - var(--ez-text-input__icon--width) - var(--ez-text-input__tooltip-icon--spacing))}.input__label--left.input__label--right{left:calc(var(--ez-text-input__icon--width) + 2px);width:calc(100% - var(--ez-text-input__icon--width) * 2)}.input--with--label{padding-bottom:0}.input--slim{padding-top:var(--space--small, 3px);padding-bottom:var(--space--small, 3px);height:var(--ez-text-input--height--slim)}.input__slim--title{font-size:16px;font-weight:bold}.input--slim::-webkit-input-placeholder,.input--slim:-moz-placeholder,.input--slim::-moz-placeholder,.input--slim:-ms-input-placeholder,.input--slim::placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input__placeholder--color)}.input--slim:disabled::-webkit-input-placeholder,.input--slim:disabled:-moz-placeholder,.input--slim:disabled::-moz-placeholder,.input--slim:disabled:-ms-input-placeholder,.input--slim:disabled::placeholder{color:var(--ez-text-input__input--disabled--color)}input.input__slim--noborder{box-shadow:0 0 0 0;border:0 none;outline:0;background:var(--ez-text-input__input--noborder-color)}ez-icon.tooltip-icon{position:absolute;display:flex;align-items:center;justify-content:center;overflow:hidden;width:var(--ez-text-input__tooltip-icon---width);height:22px;margin:var(--ez-text-input__tooltip-icon---vertical-margin) var(--ez-text-input__tooltip-icon---horizontal-margin);top:0;right:0;z-index:var(--elevation--4);border-radius:var(--ez-text-input--border-radius)}ez-icon.tooltip-icon.rightIconSlot{right:var(--ez-text-input__tooltip-icon--spacing)}ez-icon.tooltip-icon.hasError{--ez-icon--color:var(--ez-text-input__tooltip_icon--error--color)}";export{a as ez_text_input}
@@ -1 +0,0 @@
1
- import{r as t,c as i,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){t(this,o),this.ezChange=i(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}observeErrorMessage(){var t;this._textInput&&(this._textInput.errorMessage=this.errorMessage,(null===(t=this.errorMessage)||void 0===t?void 0:t.trim())||this.setInputValue())}observeValue(t,i){if(this._textInput&&t!=i)try{if("string"==typeof t)return void this.setInputValue();const o=this.getSelectedOption(t),e=this.getSelectedOption(i),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(t,i){r.equals(t,i)||this.loadOptions(c.PRELOAD)}async getValueAsync(){return new Promise(this._showLoading?t=>{let i=setInterval((()=>{this._showLoading||(clearInterval(i),t(this.value))}),100)}:t=>t(this.value))}async setFocus(t){this._textInput&&this._textInput.setFocus(t)}async setBlur(){this._textInput&&this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async clearValue(){this.clearSearch()}scrollListener(){var t;null!=this._floatingID&&((null===(t=this.listOptionsPosition)||void 0===t?void 0:t.hardPosition)?this.hideOptions():window.requestAnimationFrame((()=>{this.updateListPosition()})))}updateListPosition(){let{verticalPosition:t,horizontalPosition:i,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||(t=t||0,i=i||0,o?t=window.innerHeight-n.top+t:t+=a.top,e?i=window.innerWidth-n.right+i:i+=a.left),null!=t&&(this._listWrapper.style[o?"bottom":"top"]=`${t}px`,this._listWrapper.style[o?"top":"bottom"]=""),null!=i&&(this._listWrapper.style[e?"right":"left"]=`${i}px`,this._listWrapper.style[e?"left":"right"]="")}getListPosition(){return this.listOptionsPosition?this.listOptionsPosition:{verticalPosition:6}}isDifferentValues(t,i){return r.objectToString(t||{})!==r.objectToString(i||{})}getFormattedText(t){if(null!=t)return this.showSelectedValue&&null!=t.value?t.label?`${t.value} - ${t.label}`:t.value:t.label}getText(){const t=this.getSelectedOption(this.value),i=this.getFormattedText(t);if(null!=i)return String(i).replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"')}getSelectedOption(t){return"string"==typeof t||t instanceof String?this._visibleOptions.find((i=>i.value===t)):t}updateVisibleOptions(){let t=this._source||[];if(this._criteria){const i=this._criteria.toUpperCase();t=t.filter((t=>t.label.toLocaleUpperCase().indexOf(i)>-1))}this.hasToAddEmptyoption(t)&&(t=[{value:void 0,label:""}].concat(t)),this._visibleOptions=t,this._maxWidthValue=this.getMaxWidthValue()}hasToAddEmptyoption(t){return!this.suppressEmptyOption&&!t.filter((t=>!t.value)).length}getMaxWidthValue(){var t;if(this.showOptionValue){const i=[];return null===(t=this._visibleOptions)||void 0===t||t.forEach((t=>{const o=this.getWidthValue(t.value);i.includes(o)||i.push(o)})),i.length>1?Math.max(...i):0}return 0}getWidthValue(t){if(null!=this._itemValueBasis){const i=this._itemValueBasis;if(null!=t)return i.innerHTML=t,i.clientWidth>0?i.clientWidth+2:0;i.innerHTML=""}return 0}buildItem(t,i){const e=this.showOptionValue&&this._maxWidthValue>0?`${this._maxWidthValue}px`:"";return t.label=t.label||t.value,o("li",{class:i===this._preSelection?"item preselected":"item",id:`item_${t.value}`,onMouseDown:()=>this.selectOption(t),onMouseOver:()=>this._preSelection=i},this.showOptionValue?o("span",{class:"item__value",title:t.value,style:{width:e,minWidth:e,maxWidth:e}},t.value):void 0,o("span",{class:"item__label "+(this.showOptionValue?"item__label--bold":""),title:t.label},t.label))}showOptions(){var t,i;if(!this.enabled)return;if(this.isOptionsVisible())return;const o=null!==(i=null===(t=this.value)||void 0===t?void 0:t.value)&&void 0!==i?i:this.value,e=this._visibleOptions.findIndex((t=>t.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(t){window.requestAnimationFrame((()=>{const i=(null==t?void 0:t.value)?this._optionsList.querySelector(`li#item_${t.value.replace(/[<>\[\]#=]/g,"\\$&").replace(/:/g,"\\:")}`):void 0;i&&i.scrollIntoView({behavior:"smooth",block:"nearest"})}))}selectCurrentOption(t=!0){void 0!==this._preSelection?(this.selectOption(this._visibleOptions[this._preSelection],t),this._preSelection=void 0):this.controlListWithOnlyOne(t)}controlListWithOnlyOne(t=!0){var i;const o=null===(i=this._visibleOptions)||void 0===i?void 0:i.filter((t=>""!==t.label&&null!=t.value));if((null==o?void 0:o.length)>0){let i=a.decodeHtmlEntities(o[0].label);this.selectOption({value:o[0].value,label:i},t)}}updateSource(t){this._startLoading=!1,t instanceof Promise?(this._showLoading=!0,t.then((t=>{this._showLoading=!1,this.updateSource(t)})).catch((()=>this._showLoading=!1)),this.updateVisibleOptions()):(this._showLoading=!1,Array.isArray(t)?(this._source=t,this.updateVisibleOptions(),this._tabPressed&&(this._tabPressed=!1)):this.selectOption(t))}selectOption(t,i=!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==t?void 0:t.value)||void 0===e?void 0:e.toString())||null==s&&null!=t&&"value"in t?this.value=(null==t?void 0:t.value)?t:void 0:this.resetOptions(),i&&setTimeout((()=>{this.setFocus()}),0)}loadOptions(t,i=""){this._criteria=i,this._startLoading=!0,this.updateSource(this.optionLoader?this.optionLoader({mode:t,argument:i}):this.options)}cancelPreselection(){!this._textInput.value&&this.value?this.selectOption(void 0):window.setTimeout((()=>{this.setInputValue(!1)}),this._deboucingTime)}setInputValue(t=!0){const i=this.getText();(this._textInput.value||"")!==i&&(this._textInput.value=i,t&&(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 t=this.el.querySelectorAll("option");t&&t.forEach((t=>{let i=t.innerText,o=t.getAttribute("value");o||(o=i),this.options.push({label:i,value:o}),t.hidden=!0}))}this.loadOptions(c.PRELOAD)}componentDidRender(){var t;void 0===this._floatingID&&this._listWrapper.remove(),null===(t=this._optionsList)||void 0===t||t.querySelectorAll(".item").forEach((t=>{n.addIDInfoIfNotExists(t,"itemComboBox")}))}componentDidLoad(){h.applyVarsTextInput(this.el,this._textInput),this.setInputValue(!1),this._resizeObserver=new ResizeObserver((t=>{window.requestAnimationFrame((()=>{if(!Array.isArray(t)||!t.length)return;const{clientWidth:i}=this._listContainer;i>0&&this._listWrapper&&(this._listWrapper.style.width=`${i}px`)}))})),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}handlerIconClick(){this.showOptions()}onTextInputChangeHandler(t){var i;if(this.clearDeboucingTimeout(),this._startLoading)return void(this._changeDeboucingTimeout=window.setTimeout((()=>{this.onTextInputChangeHandler(t)}),this._deboucingTime));const o=null===(i=t.target.value)||void 0===i?void 0:i.trim();this._criteria||(this._textInput.value=t.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(t){switch(this._tabPressed=!1,t.ctrlKey&&("f"!==t.key&&"F"!==t.key||(this.loadOptions(c.ADVANCED),t.stopPropagation(),t.stopImmediatePropagation(),t.preventDefault())),t.key){case"ArrowDown":t.stopPropagation(),this.canShowListOptions()&&t.preventDefault(),this.showOptions(),this.nextOption();break;case"ArrowUp":t.stopPropagation(),this.canShowListOptions()&&t.preventDefault(),this.showOptions(),this.previousOption();break;case"Enter":this.handleEventPropagation(t),this.isOptionsVisible()&&this.selectCurrentOption();break;case"Escape":this.isOptionsVisible()&&t.stopPropagation(),this.cancelPreselection(),this.resetOptions();break;case"Tab":this._tabPressed=!0,this.isOptionsVisible()&&this.selectCurrentOption(!1),this.resetOptions()}}handleEventPropagation(t){this._listContainer.hasChildNodes()&&this.stopPropagateEnterKeyEvent&&t.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:t=>this._textInput=t,"data-slave-mode":"true",enabled:this.enabled&&!this.suppressSearch,onInput:t=>this.onTextInputChangeHandler(t),onClick:()=>this.onTextInputClickHandler(),onFocusout:()=>this.onTextInputFocusOutHandler(),onKeyDown:t=>this.keyDownHandler(t),label:this.label,canShowError:this.canShowError,errorMessage:this.errorMessage,mode:this.mode},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:t=>this._listContainer=t},o("div",{class:"list-wrapper",ref:t=>this._listWrapper=t},o("ul",{class:"list-options",ref:t=>this._optionsList=t},!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:t=>this._itemValueBasis=t}):void 0,this.canShowListOptions()&&this._visibleOptions.map(((t,i)=>this.buildItem(t,i)))))))}get el(){return s(this)}static get watchers(){return{errorMessage:["observeErrorMessage"],value:["observeValue"],options:["observeOptions"]}}};var c;!function(t){t.ADVANCED="ADVANCED",t.PRELOAD="PRELOAD",t.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 +0,0 @@
1
- import{r as t,c as i,h as e,H as s,g as n}from"./p-e4c7eb39.js";import{DateUtils as a,TimeFormatter as o,ElementIDUtils as h}from"@sankhyalabs/core";import{C as r}from"./p-9e11fc7b.js";const l=class{constructor(e){t(this,e),this.ezChange=i(this,"ezChange",7),this.ezStartChange=i(this,"ezStartChange",7),this.ezCancelWaitingChange=i(this,"ezCancelWaitingChange",7),this._changePending=!1,this._focused=!1,this._valuePromiseCallbacks=[],this.label=void 0,this.value=void 0,this.enabled=!0,this.errorMessage=void 0,this.showSeconds=!1,this.mode="regular",this.canShowError=!0,this.autoFocus=!1}observeLabel(){this._textInput&&(this._textInput.label=this.label)}observeErrorMessage(){var t;this._textInput&&(this._textInput.errorMessage=this.errorMessage,(null===(t=this.errorMessage)||void 0===t?void 0:t.trim())||this.setInputValue())}observeValue(t,i){if(this._textInput&&t!=i){const e=a.validateDate(t,!0),s=a.validateDate(i,!0);if((null==e?void 0:e.getTime())!==(null==s?void 0:s.getTime())){const t=this.getTextValue(e)||"";!this.getParsedDateTime(t)&&this._focused||(this._textInput.value||"")===t||(this._textInput.value=t,this._focused=!1,this.errorMessage=""),this.ezChange.emit(null===e?void 0:e)}}this._changePending=!1}async setFocus(t){this._textInput.setFocus(t)}async setBlur(){this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async getValueAsync(){return this._changePending?new Promise((t=>{this._valuePromiseCallbacks.push(t)})):Promise.resolve(this.value)}handleKeyDown(t){const i=this._textInput.shadowRoot.querySelector("input");if(t.shiftKey&&"Tab"===t.key){if(i.selectionStart>0){let e=i.value.lastIndexOf(" ",i.selectionStart);-1!==e&&(i.setSelectionRange(0,e),t.preventDefault())}}else if("Tab"===t.key&&i.value.length!==i.selectionEnd){let e=i.value.indexOf(" ",i.selectionEnd);e=-1===e?i.selectionEnd:e+1,i.setSelectionRange(e,i.value.length),t.preventDefault()}}handleFocus(){const t=this._textInput.shadowRoot.querySelector("input");if(t.selectionStart!==t.selectionEnd){let i=t.value.indexOf(" ",t.selectionStart);i=-1===i?t.value.length:i,t.setSelectionRange(0,i)}}handleClick(){const t=this._textInput.shadowRoot.querySelector("input");let i=t.value.lastIndexOf(" ",t.selectionEnd);i=-1===i?0:i+1,i=i>t.selectionEnd?0:i;let e=0===i?t.value.indexOf(" "):t.value.length;t.setSelectionRange(i,e)}changeValue(t){const i=a.validateDate(this.value,!0),e=a.validateDate(t,!0);(null==i?void 0:i.getTime())!==(null==e?void 0:e.getTime())&&(this.value=e)}showCalendar(){let t;this.isFixed()?(t=29,this._calendar.fitHorizontal(0)):t=this.errorMessage||"slim"===this.mode?6:-13,this._calendar.fitVertical(t,this._elem.clientHeight),this._calendar.style.visibility="inherit"}hideCalendar(){this.changeValue(this._calendar.value),this._calendar.hide()}getParsedDateTime(t){var i,e;if(void 0===t&&(t=(null===(e=null===(i=this._textInput)||void 0===i?void 0:i.value)||void 0===e?void 0:e.trim())||""),!t)return;const s=t.split(" "),n=s.length>0?s[0]:t,h=o.prepareValue(s[1]?s[1]:"",this.showSeconds);return a.strToDate(n+(h&&" "+h))}handleBlur(){var t,i;if(this._changePending)try{const e=(null===(i=null===(t=this._textInput)||void 0===t?void 0:t.value)||void 0===i?void 0:i.trim())||"",s=this.getParsedDateTime();if(s||!e){this.errorMessage="";const t=a.validateDate(this.value,!0),i=a.validateDate(s,!0);(null==t?void 0:t.getTime())===(null==i?void 0:i.getTime())?(i&&(this._textInput.value=this.getTextValue(i)||"",this._focused=!1),this.ezCancelWaitingChange.emit()):this.changeValue(i)}else this.changeValue(void 0),this.ezCancelWaitingChange.emit(),this.errorMessage="O valor digitado não é uma data válida"}finally{for(const t of this._valuePromiseCallbacks)t(this.value);this._valuePromiseCallbacks=[]}}getTextValue(t){if(t)return a.formatDateTime(t,this.showSeconds)}handleInput(t){const i=this.getParsedDateTime(),e=a.validateDate(this.value,!0),s=a.validateDate(i,!0);(null==e?void 0:e.getTime())!==(null==s?void 0:s.getTime())&&(this._changePending=!0,this._focused=!0,this.ezStartChange.emit({waitmessage:"",blocking:!1})),"H"!==t.data&&"h"!==t.data||this.changeValue(new Date)}setInputValue(){const t=this.getTextValue(this.value)||"";(this._textInput.value||"")!==t&&(this._textInput.value=t)}isFixed(){return"true"===this._elem.dataset.isFixed}componentDidLoad(){r.applyVarsTextInput(this._elem,this._textInput),this.setInputValue(),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}render(){return h.addIDInfoIfNotExists(this._elem,"input"),e(s,null,e("ez-text-input",{"data-element-id":h.getInternalIDInfo("textInput"),ref:t=>this._textInput=t,"data-slave-mode":"true",label:this.label,restrict:"0123456789/: ",enabled:this.enabled,errorMessage:this.errorMessage,mode:this.mode,onKeyDown:t=>{this.handleKeyDown(t)},onBlur:()=>this.handleBlur(),onInput:t=>this.handleInput(t),onFocus:()=>this.handleFocus(),onClick:()=>this.handleClick(),canShowError:this.canShowError},e("button",{disabled:!this.enabled,tabindex:-1,class:"btn-open-cal",onClick:()=>this.showCalendar(),slot:"leftIcon"})),e("ez-calendar",{ref:t=>this._calendar=t,"data-element-id":h.getInternalIDInfo("calendar"),onEzChange:t=>{this.hideCalendar(),t.stopPropagation()},floating:!0,time:!0,showSeconds:this.showSeconds,"data-is-fixed":this._elem.dataset.isFixed}))}get _elem(){return n(this)}static get watchers(){return{label:["observeLabel"],errorMessage:["observeErrorMessage"],value:["observeValue"]}}};l.style=':host{display:block;width:100%;--ez-date-input__input--background-color:var(--background--medium, #e0e0e0);--ez-date-input__input--border-color:var(--ez-date-input__input--background-color);--ez-date-input__calendar-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="15px"><path d="M 3.171875,5.25 C 2.6485088,5.25 2.21875,5.6797588 2.21875,6.203125 2.21875,6.7264912 2.6485088,7.15625 3.171875,7.15625 3.6952412,7.15625 4.125,6.7264912 4.125,6.203125 4.125,5.6797588 3.6952412,5.25 3.171875,5.25 Z m 2.875,0 C 5.5235088,5.25 5.09375,5.6797588 5.09375,6.203125 5.09375,6.7264912 5.5235088,7.15625 6.046875,7.15625 6.5702412,7.15625 7,6.7264912 7,6.203125 7,5.6797588 6.5702412,5.25 6.046875,5.25 Z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.9511719,-0.4297588 0.9511719,-0.953125 C 9.8730469,5.6797588 9.4452412,5.25 8.921875,5.25 Z m 2.873047,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.953125 0.953125,0.953125 0.523366,0 0.953125,-0.4297588 0.953125,-0.953125 C 12.748047,5.6797588 12.318288,5.25 11.794922,5.25 Z M 3.171875,8.1230469 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 0.5233662,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 C 6.5702412,10.029297 7,9.5995381 7,9.0761719 7,8.5528057 6.5702412,8.1230469 6.046875,8.1230469 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297587,0.9531251 0.953125,0.9531251 0.5233661,0 0.9531249,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.9531251 0.953125,0.9531251 0.523367,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.171875,10.998047 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 C 6.5702412,12.904297 7,12.474538 7,11.951172 7,11.427806 6.5702412,10.998047 6.046875,10.998047 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297587,0.953125 0.953125,0.953125 0.5233661,0 0.9531249,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.429759,0.953125 0.953125,0.953125 0.523367,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.5,0 c -0.554,0 -1,0.446 -1,1 v 0.050781 C 1.0853217,1.2909766 0,2.5186658 0,4 v 9 c 0,1.652487 1.3475134,3 3,3 h 9 c 1.652487,0 3,-1.347513 3,-3 V 4 C 15,2.5186658 13.914678,1.2909766 12.5,1.0507812 V 1 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 C 4.5,0.446 4.054,0 3.5,0 Z m 1,2.0996094 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 v -0.640625 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 2.1738281 C 13.311725,2.3905225 13.900391,3.11278 13.900391,4 v 9 c 0,1.062113 -0.838278,1.900391 -1.900391,1.900391 H 3 C 1.9378864,14.900391 1.0996094,14.062113 1.0996094,13 V 4 C 1.0996094,3.11278 1.6882747,2.3905225 2.5,2.1738281 v 0.5664063 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 z"/></svg>\')}.btn-open-cal{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-cal:disabled{cursor:not-allowed}.btn-open-cal::after{content:\'\';display:flex;background-color:var(--text--primary, #008561);width:15px;height:16px;-webkit-mask-image:var(--ez-date-input__calendar-image);mask-image:var(--ez-date-input__calendar-image)}.btn-open-cal:disabled:after{background-color:var(--text--disable, #AFB6C0)}.btn-open-cal:enabled:hover::after{background-color:var(--color--primary, #4e4e4e)}ez-text-input{--text-input__input--background-color:var(--ez-date-input__input--background-color, #FFFFFF);--text-input__input--border-color:var(--ez-date-input__input--border-color, #DCE0E8)}';export{l as ez_date_time_input}
@@ -1 +0,0 @@
1
- import{r as t,c as s,h as i,H as e,g as h}from"./p-e4c7eb39.js";import{TimeFormatter as r,MaskFormatter as o,NumberUtils as a,ElementIDUtils as n}from"@sankhyalabs/core";import{C as l}from"./p-9e11fc7b.js";const u=class{constructor(i){t(this,i),this.ezChange=s(this,"ezChange",7),this.ezStartChange=s(this,"ezStartChange",7),this.ezCancelWaitingChange=s(this,"ezCancelWaitingChange",7),this.label=void 0,this.value=void 0,this.enabled=!0,this.errorMessage=void 0,this.showSeconds=!1,this.mode="regular",this.canShowError=!0,this.autoFocus=!1}observeErrorMessage(){var t;this._textInput&&(this._textInput.errorMessage=this.errorMessage,(null===(t=this.errorMessage)||void 0===t?void 0:t.trim())||(this.prepareValue(this._viewValue),(this._textInput.value||"")!==this._viewValue&&(this._textInput.value=this._viewValue)))}observeShowSeconds(){this.prepareMask(this.showSeconds?"##:##:##":"##:##")}observeValue(t,s){if(this._textInput&&t!=s){let i=this.validateValue(t);i!=this.validateValue(s)&&(this._viewValue=null==i?"":i.toString(),this.prepareValue(this._viewValue),this._viewValue&&!r.validateTime(this._viewValue,this.showSeconds)?(this.setError("Favor inserir um horário válido."),i=void 0):this.setError(""),this.ezChange.emit(null===i?void 0:i))}}prepareMask(t){null==this._maskFormatter?this._maskFormatter=new o(t):this._maskFormatter.mask=t}validateValue(t){return isNaN(t)||void 0===t?null:t}setError(t){this.errorMessage=t,this._textInput&&(null==t?void 0:t.trim())&&this.ezCancelWaitingChange.emit()}getViewValue(){return this._viewValue}prepareValue(t){try{this._viewValue=r.prepareValue(t,this.showSeconds),this._textInput&&this._textInput.value!==this._viewValue&&(this._textInput.value=this._viewValue)}catch(t){this.setError(t.message)}}async setFocus({selectText:t}){this._textInput.setFocus({selectText:t})}async setBlur(){this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}handleBlur(){if(this._textInput){this._viewValue=this._textInput.value,this.prepareValue(this._viewValue);const t=a.stringToNumber(this._viewValue.replace(/\D/g,""));this.value=["string","number"].includes(typeof t)?t:null}}handleInput(){const t=this._textInput.value;["string","number"].includes(typeof t)&&a.stringToNumber(t.replace(/\D/g,""))!==this.value&&this.ezStartChange.emit({waitmessage:"",blocking:!1})}componentDidLoad(){l.applyVarsTextInput(this._elem,this._textInput),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}componentWillLoad(){this.observeShowSeconds(),this.value?this.prepareValue(this.value.toString()):this._viewValue&&this.prepareValue(this._viewValue)}render(){return n.addIDInfoIfNotExists(this._elem,"input"),i(e,null,i("ez-text-input",{class:"time__input","data-element-id":n.getInternalIDInfo("textInput"),ref:t=>this._textInput=t,"data-slave-mode":"true",value:this._viewValue,enabled:this.enabled,label:this.label,restrict:"0123456789:",onBlur:()=>this.handleBlur(),onInput:()=>this.handleInput(),errorMessage:this.errorMessage,mode:this.mode,canShowError:this.canShowError},i("ez-icon",{slot:"leftIcon",iconName:"timer-outline"})))}static get assetsDirs(){return["../assets"]}get _elem(){return h(this)}static get watchers(){return{errorMessage:["observeErrorMessage"],showSeconds:["observeShowSeconds"],value:["observeValue"]}}};u.style=":host{display:flex;flex-wrap:wrap;position:relative;width:100%}.time__input{height:100%}";export{u as ez_time_input}
@@ -1 +0,0 @@
1
- import{r as t,c as i,h as s,g as e}from"./p-e4c7eb39.js";import{NumberUtils as h,StringUtils as r,ElementIDUtils as n}from"@sankhyalabs/core";import{C as o}from"./p-9e11fc7b.js";const a=class{constructor(s){t(this,s),this.ezChange=i(this,"ezChange",7),this.ezStartChange=i(this,"ezStartChange",7),this.ezCancelWaitingChange=i(this,"ezCancelWaitingChange",7),this._focused=!1,this._changePending=!1,this._valuePromiseCallbacks=[],this._value=void 0,this.label=void 0,this.value=void 0,this.enabled=!0,this.canShowError=!0,this.errorMessage=void 0,this.allowNegative=!0,this.precision=void 0,this.prettyPrecision=void 0,this.mode="regular",this.autoFocus=!1}async setFocus(t){this._textInput.setFocus(t)}async setBlur(){this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async getValueAsync(){return this._changePending?new Promise((t=>{this._valuePromiseCallbacks.push(t)})):Promise.resolve(this.value)}observeLabel(){this._textInput&&(this._textInput.label=this.label)}observeErrorMessage(){var t;this._textInput&&(this._textInput.errorMessage=this.errorMessage,(null===(t=this.errorMessage)||void 0===t?void 0:t.trim())||this.setInputValue())}observeValue(t,i){this._textInput&&t!=i&&this.handleNewValue(t,i),this._changePending=!1}observePrecision(){this._textInput&&this.setInputValue()}handleNewValue(t,i){const s=this.validateValue(t),e=this.validateValue(i);if(null===s&&(this._value=""),s===e)return;const h=this.getTextValue(s)||"",r=this.getParsedNumber(h);(this._value||"")===h||void 0===r&&this._focused||(this._value=h,this._focused=!1,this.errorMessage=""),this.ezChange.emit(null===s?void 0:s)}validateValue(t){return isNaN(t)||void 0===t?null:t}getTextValue(t){if(null==t)return;let i=this.precision>=0?h.format(t.toString(),Number(this.precision),Number(this.prettyPrecision)):t.toString();return 0===this.precision?r.replaceAll(i,".",""):i}changeValue(t){this.errorMessage="",this.value!=t?this.value=void 0===t?null:t:(this.setInputValue(),this.ezCancelWaitingChange.emit())}setError(t){this.value=null,this.errorMessage=t,this.ezCancelWaitingChange.emit()}handleBlur(){if(this._changePending)try{const t=this.getParsedNumber();if(void 0!==t&&isNaN(t))this.setError("O valor digitado não é um número válido");else try{this.changeValue(t)}catch(t){return void this.setError(t.message)}}finally{for(const t of this._valuePromiseCallbacks)t(this.value);this._valuePromiseCallbacks=[]}}handleInput(){this.getParsedNumber()!==this.value&&(this._focused=!0,this._changePending=!0,this.ezStartChange.emit({waitmessage:"",blocking:!1}))}getParsedNumber(t=this._textInput.value){return(null==t?void 0:t.trim())?h.stringToNumber(t):void 0}setInputValue(){const t=this.getTextValue(this.value)||"";(this._value||"")!==t&&(this._value=t,this._textInput.value=this._value)}componentDidLoad(){o.applyVarsTextInput(this._elem,this._textInput),this.setInputValue(),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}render(){n.addIDInfoIfNotExists(this._elem,"input");let t=this.precision>0?"0123456789,.":"0123456789";return this.allowNegative&&(t+="-"),s("ez-text-input",{class:"number__input","data-element-id":n.getInternalIDInfo("textInput"),ref:t=>this._textInput=t,"data-slave-mode":"true",label:this.label,onBlur:()=>this.handleBlur(),onInput:()=>this.handleInput(),restrict:t,enabled:this.enabled,errorMessage:this.errorMessage,mode:this.mode,canShowError:this.canShowError,value:this._value})}get _elem(){return e(this)}static get watchers(){return{label:["observeLabel"],errorMessage:["observeErrorMessage"],value:["observeValue"],precision:["observePrecision"],prettyPrecision:["observePrecision"]}}};a.style=":host{--ez-number-input__min-width:0px;--ez-number-input__max-width:100%;display:block;width:100%}.number__input{height:100%;min-width:var(--ez-number-input__min-width);max-width:var(--ez-number-input__max-width)}";export{a as ez_number_input}
@@ -1 +0,0 @@
1
- import{h as e,r as t,c as a,g as r,H as l}from"./p-e4c7eb39.js";import{ObjectUtils as o,UserInterface as n,ElementIDUtils as i}from"@sankhyalabs/core";import{R as s}from"./p-05e1f4e7.js";import{C as d}from"./p-b853763b.js";function c(t,a,r,l,o){return e("div",{class:"ez-col ez-col--sd-12 ez-align--middle ez-padding-bottom--large"},e("ez-check",{enabled:!r,label:a,mode:o?d.SWITCH:d.REGULAR,"data-field-name":t,"data-context-name":l,key:t}))}function m(t,a,r,l,o,n,i){return e("div",{class:"ez-col ez-col--sd-12 "},e("ez-number-input",{enabled:!r,label:a,precision:l,prettyPrecision:o,"data-field-name":t,"data-context-name":n,key:t,canShowError:i}))}const h=({name:t,label:a,readOnly:r,contextName:l,canShowError:o,props:n})=>e("div",{class:"ez-col ez-col--sd-12"},e("ez-text-input",{label:a,"data-field-name":t,"data-context-name":l,key:t,enabled:!r,canShowError:o,mask:null==n?void 0:n.mask,"clean-value-mask":null==n?void 0:n.cleanValueMask})),u=new Map;u.set(n.CHECKBOX,(e=>c(e.name,e.label,e.readOnly,e.contextName,!1))),u.set(n.SWITCH,(e=>c(e.name,e.label,e.readOnly,e.contextName,!0))),u.set(n.OPTIONSELECTOR,(({name:t,label:a,readOnly:r,required:l,props:o,contextName:n,canShowError:i})=>{const s=null==o?void 0:o.options;let d;if("string"==typeof s){const e=JSON.parse(s);d=Object.keys(e).map((t=>({value:t,label:e[t]})))}else d=s;return e("div",{class:"ez-col ez-col--sd-12"},e("ez-combo-box",{enabled:!r,suppressEmptyOption:l,label:a,"data-field-name":t,"data-context-name":n,key:t,options:d,canShowError:i}))})),u.set(n.DATE,(({name:t,label:a,readOnly:r,canShowError:l})=>e("div",{class:"ez-col ez-col--sd-12"},e("ez-date-input",{enabled:!r,label:a,"data-field-name":t,key:t,canShowError:l})))),u.set(n.TIME,(({name:t,label:a,readOnly:r,canShowError:l})=>e("div",{class:"ez-col ez-col--sd-12"},e("ez-time-input",{enabled:!r,label:a,"data-field-name":t,key:t,canShowError:l})))),u.set(n.DATETIME,(({name:t,label:a,readOnly:r,contextName:l,canShowError:o})=>e("div",{class:"ez-col ez-col--sd-12"},e("ez-date-time-input",{enabled:!r,label:a,"data-field-name":t,"data-context-name":l,key:t,canShowError:o})))),u.set(n.FILE,(({name:t,label:a,readOnly:r,contextName:l,props:n})=>{const i=o.removeEmptyValues({subTitle:n.subTitle,requestHeaders:Object.assign(Object.assign({},n.STORAGESTRATEGY&&{STORAGESTRATEGY:n.STORAGESTRATEGY}),n.INTERNAL_FILENAME&&{INTERNAL_FILENAME:n.INTERNAL_FILENAME})});return e("div",{class:"ez-col ez-col--sd-12"},e("ez-upload",Object.assign({enabled:!r,label:a,"data-field-name":t,"data-context-name":l,key:t},i)))})),u.set(n.DECIMALNUMBER,(({name:e,label:t,readOnly:a,props:r,contextName:l,canShowError:o})=>{var n,i;const s=Number(null!==(n=null==r?void 0:r.precision)&&void 0!==n?n:2);return m(e,t,a,s,Number(null!==(i=null==r?void 0:r.prettyPrecision)&&void 0!==i?i:s),l,o)})),u.set(n.INTEGERNUMBER,(({name:e,label:t,readOnly:a,contextName:r,canShowError:l})=>m(e,t,a,0,0,r,l))),u.set(n.SEARCH,(({name:t,label:a,readOnly:r,required:l,contextName:o,canShowError:n,optionLoader:i,props:s})=>{var d;return e("div",{class:"ez-col ez-col--sd-12"},e("ez-search",{enabled:!r,suppressEmptyOption:l,label:a,"data-field-name":t,"data-context-name":o,key:t,canShowError:n,optionLoader:i,ignoreLimitCharsToSearch:null!==(d=s.ignoreLimitCharsToSearch)&&void 0!==d&&d}))})),u.set(n.LONGTEXT,(({name:t,label:a,readOnly:r,contextName:l,rows:o,canShowError:n})=>e("div",{class:"ez-col ez-col--sd-12",key:t},e("ez-text-area",{enabled:!r,label:a,"data-field-name":t,"data-context-name":l,rows:o,canShowError:n}))));const p=e=>{const t=u.get(e.userInterface)||h,a=e.required?`${e.label}${s}`:e.label,r=t(Object.assign(Object.assign({},e),{label:a}));return r.t["data-form-item"]=e.name,r};class b{constructor(e){this.elem=e}addRightElement(e){this.removeRightElement(),e.classList.add("ez-padding-left--small"),e.setAttribute("data-custom-item","true"),this.elem.classList.add("ez-col--nowrap"),this.elem.appendChild(e)}removeRightElement(){Array.from(this.elem.querySelectorAll('[data-custom-item="true"]')).forEach((e=>e.remove()))}get fieldName(){return this.elem.getAttribute("data-form-item")}}class w{constructor(e,t){this.items=new Map,this.formId=t,e.forEach((e=>{const t=new b(e);this.items.set(t.fieldName,t)}))}getItem(e){return this.items.get(e)}get formName(){return this.formId}}const v=class{constructor(e){t(this,e),this.ezContentReady=a(this,"ezContentReady",7),this.formItemsReady=a(this,"formItemsReady",7),this._customEditors=new Map,this.fields=void 0,this.selectedRecord=void 0}async showUp(){this._element.scrollIntoView({behavior:"smooth",block:"start"})}async addCustomEditor(e,t,a){const r=new Map(this._customEditors);r.set(e,{customEditor:t,detailContext:a}),this._customEditors=r}async setFieldProp(e,t,a){const r=this.fields.map((r=>(r.name!==e||!a&&0!==a||(r.props=r.props||{},r.props[t]=a),r)));this.fields=[...r]}groupFields(e){const t=new Map;return e.forEach((e=>{const a=e.group;if(a){let r=t.get(a);null==r&&(r=[],t.set(a,r)),r.push(e)}else t.set(e.name,e)})),t}componentDidRender(){this._formElements=Array.from(this._element.querySelectorAll("[data-field-name]")),this.ezContentReady.emit(this._formElements);const e=new w(Array.from(this._element.querySelectorAll("[data-form-item]")));this.formItemsReady.emit(e)}isItemFullWidth(e){return[n.FILE,n.LONGTEXT].includes(e)}buildFormItemElement(t,a=""){var r;if(this.isItemFullWidth(t.userInterface)&&(a+=" input-full_width"),this._customEditors.has(t.name)){const l=null===(r=this._formElements.map((e=>({name:e.dataset.fieldName,value:e.value}))).find((e=>e.name===t.name)))||void 0===r?void 0:r.value,o=this._customEditors.get(t.name).customEditor;return e("div",{class:a},e("ez-custom-form-input",{"data-field-name":t.name,customEditor:o,formViewField:t,builderFallback:p,value:l,selectedRecord:this.selectedRecord}))}return e("div",{class:a},p(t))}render(){if(i.addIDInfoIfNotExists(this._element,"ezFormView"),null==this.fields)return;let t=[],a=Array.from(this.groupFields(this.fields).entries()).map((([a,r])=>{if(Array.isArray(r))return e("ez-collapsible-box",{id:`group-${a}`,label:a,"header-size":"large",key:a},e("div",{class:"form-view__content"},r.map((e=>this.buildFormItemElement(e)))));t.push(r)})),r=t.map((e=>this.buildFormItemElement(e))),o=e("div",{class:"form-view__content"},r);return e(l,null,o,a)}get _element(){return r(this)}};v.style=".sc-ez-form-view-h{display:flex;flex-wrap:wrap;width:100%;--ez-form-view__item--min-width:220px;--ez-form-view__item--width:var(--space--small);--ez-form-view__item--padding:var(--space--small)}.form-view__content.sc-ez-form-view{display:grid;grid-template-columns:repeat(auto-fill, minmax(var(--ez-form-view__item--min-width), 1fr));gap:var(--ez-form-view__item--width);padding-inline:var(--ez-form-view__item--padding);width:100%}.input-full_width.sc-ez-form-view{grid-column:1 / -1;width:100%}";export{v as ez_form_view}