@sankhyalabs/ezui 5.22.0-dev.109 → 5.22.0-dev.110

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 (248) hide show
  1. package/dist/cjs/{DataBinder-e92314c2.js → DataBinder-c2060474.js} +3 -2
  2. package/dist/cjs/{constants-2714478b.js → constants-569271bc.js} +4 -0
  3. package/dist/cjs/ez-actions-button.cjs.entry.js +2 -2
  4. package/dist/cjs/ez-alert-list.cjs.entry.js +1 -1
  5. package/dist/cjs/ez-alert.cjs.entry.js +1 -1
  6. package/dist/cjs/ez-application.cjs.entry.js +1 -1
  7. package/dist/cjs/ez-badge.cjs.entry.js +1 -1
  8. package/dist/cjs/ez-breadcrumb.cjs.entry.js +1 -1
  9. package/dist/cjs/ez-button.cjs.entry.js +1 -1
  10. package/dist/cjs/ez-calendar.cjs.entry.js +1 -1
  11. package/dist/cjs/ez-card-item_2.cjs.entry.js +4 -1218
  12. package/dist/cjs/ez-chart.cjs.entry.js +1 -1
  13. package/dist/cjs/ez-check.cjs.entry.js +1 -1
  14. package/dist/cjs/ez-chip.cjs.entry.js +1 -1
  15. package/dist/cjs/ez-collapsible-box.cjs.entry.js +2 -2
  16. package/dist/cjs/ez-combo-box-list_3.cjs.entry.js +4 -4
  17. package/dist/cjs/ez-combo-box.cjs.entry.js +2 -8
  18. package/dist/cjs/ez-date-input.cjs.entry.js +1 -1
  19. package/dist/cjs/ez-date-time-input.cjs.entry.js +1 -1
  20. package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
  21. package/dist/cjs/ez-double-list.cjs.entry.js +1 -1
  22. package/dist/cjs/ez-dropdown_2.cjs.entry.js +1 -1
  23. package/dist/cjs/ez-file-item.cjs.entry.js +1 -1
  24. package/dist/cjs/ez-filter-input.cjs.entry.js +1 -1
  25. package/dist/cjs/ez-form-view.cjs.entry.js +15 -8
  26. package/dist/cjs/ez-form.cjs.entry.js +2 -2
  27. package/dist/cjs/ez-grid.cjs.entry.js +161 -21
  28. package/dist/cjs/ez-guide-navigator.cjs.entry.js +1 -1
  29. package/dist/cjs/ez-icon.cjs.entry.js +1 -1
  30. package/dist/cjs/ez-list.cjs.entry.js +1 -1
  31. package/dist/cjs/ez-loading-bar.cjs.entry.js +1 -1
  32. package/dist/cjs/ez-modal-container.cjs.entry.js +1 -1
  33. package/dist/cjs/ez-modal.cjs.entry.js +1 -1
  34. package/dist/cjs/ez-multi-selection-list.cjs.entry.js +1 -1
  35. package/dist/cjs/ez-number-input.cjs.entry.js +1 -1
  36. package/dist/cjs/ez-popover-plus_3.cjs.entry.js +1 -1
  37. package/dist/cjs/ez-popover.cjs.entry.js +1 -1
  38. package/dist/cjs/ez-popup.cjs.entry.js +1 -1
  39. package/dist/cjs/ez-radio-button.cjs.entry.js +1 -1
  40. package/dist/cjs/ez-scroller_2.cjs.entry.js +1 -1
  41. package/dist/cjs/ez-search-plus.cjs.entry.js +369 -0
  42. package/dist/cjs/ez-search-result-list.cjs.entry.js +98 -0
  43. package/dist/cjs/ez-search.cjs.entry.js +3 -3
  44. package/dist/cjs/ez-sidebar-navigator.cjs.entry.js +1 -1
  45. package/dist/cjs/ez-split-button.cjs.entry.js +1 -1
  46. package/dist/cjs/ez-split-item.cjs.entry.js +2 -2
  47. package/dist/cjs/ez-split-panel.cjs.entry.js +1 -1
  48. package/dist/cjs/ez-tabselector.cjs.entry.js +1 -1
  49. package/dist/cjs/ez-text-area.cjs.entry.js +1 -1
  50. package/dist/cjs/ez-text-input.cjs.entry.js +21 -88
  51. package/dist/cjs/ez-time-input.cjs.entry.js +1 -1
  52. package/dist/cjs/ez-toast.cjs.entry.js +1 -1
  53. package/dist/cjs/ez-tooltip.cjs.entry.js +105 -30
  54. package/dist/cjs/ez-tree.cjs.entry.js +1 -1
  55. package/dist/cjs/ez-upload.cjs.entry.js +1 -1
  56. package/dist/cjs/ez-view-stack.cjs.entry.js +1 -1
  57. package/dist/cjs/ezui.cjs.js +2 -2
  58. package/dist/cjs/filter-column.cjs.entry.js +1 -1
  59. package/dist/cjs/floating-ui.dom.esm-017acce4.js +1404 -0
  60. package/dist/cjs/{index-9e5554cb.js → index-a7b0c73d.js} +8 -3
  61. package/dist/cjs/loader.cjs.js +2 -2
  62. package/dist/cjs/{ICustomRender-6fafffce.js → types-6a5df0c7.js} +8 -0
  63. package/dist/collection/collection-manifest.json +12 -0
  64. package/dist/collection/components/ez-combo-box/ez-combo-box.js +1 -8
  65. package/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder.js +3 -1
  66. package/dist/collection/components/ez-form-view/fieldbuilder/templates/SearchInputPlus.tpl.js +6 -0
  67. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +92 -8
  68. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +21 -4
  69. package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +31 -7
  70. package/dist/collection/components/ez-grid/controller/ag-grid/editor/EzCellEditor.js +2 -0
  71. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/SearchPlus.tpl.js +15 -0
  72. package/dist/collection/components/ez-search-plus/ez-search-plus.css +373 -0
  73. package/dist/collection/components/ez-search-plus/ez-search-plus.js +952 -0
  74. package/dist/collection/components/ez-search-plus/subcomponent/ez-search-result-list/ez-search-result-list.css +227 -0
  75. package/dist/collection/components/ez-search-plus/subcomponent/ez-search-result-list/ez-search-result-list.js +279 -0
  76. package/dist/collection/components/ez-text-input/ez-text-input.css +18 -2
  77. package/dist/collection/components/ez-text-input/ez-text-input.js +39 -60
  78. package/dist/collection/components/ez-tooltip/ez-tooltip.css +52 -12
  79. package/dist/collection/components/ez-tooltip/ez-tooltip.js +217 -46
  80. package/dist/collection/utils/constants.js +2 -0
  81. package/dist/collection/utils/form/DataBinder.js +3 -2
  82. package/dist/collection/utils/index.js +1 -0
  83. package/dist/collection/utils/search/types.js +7 -0
  84. package/dist/custom-elements/index.d.ts +12 -0
  85. package/dist/custom-elements/index.js +942 -148
  86. package/dist/esm/{DataBinder-9c877244.js → DataBinder-89946126.js} +3 -2
  87. package/dist/esm/constants-b036528f.js +7 -0
  88. package/dist/esm/ez-actions-button.entry.js +2 -2
  89. package/dist/esm/ez-alert-list.entry.js +1 -1
  90. package/dist/esm/ez-alert.entry.js +1 -1
  91. package/dist/esm/ez-application.entry.js +1 -1
  92. package/dist/esm/ez-badge.entry.js +1 -1
  93. package/dist/esm/ez-breadcrumb.entry.js +1 -1
  94. package/dist/esm/ez-button.entry.js +1 -1
  95. package/dist/esm/ez-calendar.entry.js +1 -1
  96. package/dist/esm/ez-card-item_2.entry.js +2 -1216
  97. package/dist/esm/ez-chart.entry.js +1 -1
  98. package/dist/esm/ez-check.entry.js +1 -1
  99. package/dist/esm/ez-chip.entry.js +1 -1
  100. package/dist/esm/ez-collapsible-box.entry.js +2 -2
  101. package/dist/esm/ez-combo-box-list_3.entry.js +3 -3
  102. package/dist/esm/ez-combo-box.entry.js +2 -8
  103. package/dist/esm/ez-date-input.entry.js +1 -1
  104. package/dist/esm/ez-date-time-input.entry.js +1 -1
  105. package/dist/esm/ez-dialog.entry.js +1 -1
  106. package/dist/esm/ez-double-list.entry.js +1 -1
  107. package/dist/esm/ez-dropdown_2.entry.js +1 -1
  108. package/dist/esm/ez-file-item.entry.js +1 -1
  109. package/dist/esm/ez-filter-input.entry.js +1 -1
  110. package/dist/esm/ez-form-view.entry.js +16 -9
  111. package/dist/esm/ez-form.entry.js +2 -2
  112. package/dist/esm/ez-grid.entry.js +160 -20
  113. package/dist/esm/ez-guide-navigator.entry.js +1 -1
  114. package/dist/esm/ez-icon.entry.js +1 -1
  115. package/dist/esm/ez-list.entry.js +1 -1
  116. package/dist/esm/ez-loading-bar.entry.js +1 -1
  117. package/dist/esm/ez-modal-container.entry.js +1 -1
  118. package/dist/esm/ez-modal.entry.js +1 -1
  119. package/dist/esm/ez-multi-selection-list.entry.js +1 -1
  120. package/dist/esm/ez-number-input.entry.js +1 -1
  121. package/dist/esm/ez-popover-plus_3.entry.js +1 -1
  122. package/dist/esm/ez-popover.entry.js +1 -1
  123. package/dist/esm/ez-popup.entry.js +1 -1
  124. package/dist/esm/ez-radio-button.entry.js +1 -1
  125. package/dist/esm/ez-scroller_2.entry.js +1 -1
  126. package/dist/esm/ez-search-plus.entry.js +365 -0
  127. package/dist/esm/ez-search-result-list.entry.js +94 -0
  128. package/dist/esm/ez-search.entry.js +3 -3
  129. package/dist/esm/ez-sidebar-navigator.entry.js +1 -1
  130. package/dist/esm/ez-split-button.entry.js +1 -1
  131. package/dist/esm/ez-split-item.entry.js +2 -2
  132. package/dist/esm/ez-split-panel.entry.js +1 -1
  133. package/dist/esm/ez-tabselector.entry.js +1 -1
  134. package/dist/esm/ez-text-area.entry.js +1 -1
  135. package/dist/esm/ez-text-input.entry.js +21 -88
  136. package/dist/esm/ez-time-input.entry.js +1 -1
  137. package/dist/esm/ez-toast.entry.js +1 -1
  138. package/dist/esm/ez-tooltip.entry.js +105 -30
  139. package/dist/esm/ez-tree.entry.js +1 -1
  140. package/dist/esm/ez-upload.entry.js +1 -1
  141. package/dist/esm/ez-view-stack.entry.js +1 -1
  142. package/dist/esm/ezui.js +3 -3
  143. package/dist/esm/filter-column.entry.js +1 -1
  144. package/dist/esm/floating-ui.dom.esm-5d3da819.js +1398 -0
  145. package/dist/esm/{index-5a720e56.js → index-baa5e267.js} +9 -3
  146. package/dist/esm/loader.js +3 -3
  147. package/dist/esm/{ICustomRender-875b5a40.js → types-6f6b2650.js} +9 -1
  148. package/dist/ezui/ezui.esm.js +1 -1
  149. package/dist/ezui/{p-e6b38ade.entry.js → p-0306dff7.entry.js} +1 -1
  150. package/dist/ezui/{p-91ccae0c.entry.js → p-09de35a2.entry.js} +1 -1
  151. package/dist/ezui/{p-1f7241cd.entry.js → p-0bffeffc.entry.js} +1 -1
  152. package/dist/ezui/{p-88c615f0.entry.js → p-0fa52b0f.entry.js} +1 -1
  153. package/dist/ezui/{p-c96fbbef.entry.js → p-17de16e5.entry.js} +1 -1
  154. package/dist/ezui/p-1a060042.entry.js +1 -0
  155. package/dist/ezui/{p-81461d2f.entry.js → p-1e7a8633.entry.js} +1 -1
  156. package/dist/ezui/{p-a8c7473b.entry.js → p-1ec8bdd2.entry.js} +46 -46
  157. package/dist/ezui/{p-6b51c9cc.entry.js → p-1f50fa05.entry.js} +1 -1
  158. package/dist/ezui/{p-cf33bc48.entry.js → p-20c024f7.entry.js} +1 -1
  159. package/dist/ezui/{p-e4c7eb39.js → p-23a36bb6.js} +2 -2
  160. package/dist/ezui/{p-a537a117.entry.js → p-248d4f54.entry.js} +1 -1
  161. package/dist/ezui/{p-8f49705f.entry.js → p-2872fd16.entry.js} +1 -1
  162. package/dist/ezui/{p-06f1b8e4.entry.js → p-288631d1.entry.js} +1 -1
  163. package/dist/ezui/{p-ca8936df.entry.js → p-2f45506d.entry.js} +1 -1
  164. package/dist/ezui/p-3176a6ef.entry.js +1 -0
  165. package/dist/ezui/{p-23dab72f.entry.js → p-31b71e50.entry.js} +1 -1
  166. package/dist/ezui/{p-0378416a.entry.js → p-44caad9a.entry.js} +1 -1
  167. package/dist/ezui/{p-b8b5e643.entry.js → p-4e0628a7.entry.js} +1 -1
  168. package/dist/ezui/{p-7567ccdd.entry.js → p-555c9018.entry.js} +1 -1
  169. package/dist/ezui/{p-9066b0b0.entry.js → p-56fe5341.entry.js} +1 -1
  170. package/dist/ezui/p-5895e687.js +1 -0
  171. package/dist/ezui/p-5a14f506.entry.js +1 -0
  172. package/dist/ezui/{p-044d46d5.entry.js → p-5b205c80.entry.js} +1 -1
  173. package/dist/ezui/{p-33b720aa.entry.js → p-5ec0ae79.entry.js} +1 -1
  174. package/dist/ezui/{p-6fc26622.entry.js → p-5ed81457.entry.js} +1 -1
  175. package/dist/ezui/p-5eea9886.js +1 -0
  176. package/dist/ezui/{p-fc194825.entry.js → p-6e429cff.entry.js} +1 -1
  177. package/dist/ezui/{p-11bfeca3.entry.js → p-77a4bd35.entry.js} +1 -1
  178. package/dist/ezui/{p-2069c78a.entry.js → p-7e677b7b.entry.js} +1 -1
  179. package/dist/ezui/{p-e18d9e6a.entry.js → p-7fdd479f.entry.js} +1 -1
  180. package/dist/ezui/p-81145609.entry.js +1 -0
  181. package/dist/ezui/{p-e6ebc6a9.entry.js → p-84b1c99e.entry.js} +1 -1
  182. package/dist/ezui/{p-22ea800a.entry.js → p-8ac8093c.entry.js} +1 -1
  183. package/dist/ezui/{p-82fa4b09.entry.js → p-8df1ca33.entry.js} +1 -1
  184. package/dist/ezui/p-9142b27a.entry.js +1 -0
  185. package/dist/ezui/p-9567b31a.entry.js +1 -0
  186. package/dist/ezui/{p-017aafe1.entry.js → p-9f22e1dc.entry.js} +1 -1
  187. package/dist/ezui/{p-c2b20f78.entry.js → p-9f5fa3f9.entry.js} +1 -1
  188. package/dist/ezui/{p-0cfbbe82.entry.js → p-a4cee65d.entry.js} +1 -1
  189. package/dist/ezui/{p-acddfb2e.js → p-a64cfcfc.js} +1 -1
  190. package/dist/ezui/{p-dfca5946.entry.js → p-a80b1287.entry.js} +1 -1
  191. package/dist/ezui/p-bc2f844e.entry.js +1 -0
  192. package/dist/ezui/p-bf9dec89.entry.js +1 -0
  193. package/dist/ezui/{p-92748142.entry.js → p-c0d9c4f8.entry.js} +1 -1
  194. package/dist/ezui/{p-4818b8ce.entry.js → p-c1527804.entry.js} +1 -1
  195. package/dist/ezui/p-c5df78be.entry.js +1 -0
  196. package/dist/ezui/{p-a79f3789.entry.js → p-cd07f8be.entry.js} +1 -1
  197. package/dist/ezui/{p-708b196e.entry.js → p-da1b4a38.entry.js} +1 -1
  198. package/dist/ezui/{p-c7035d65.entry.js → p-dc73e1fe.entry.js} +1 -1
  199. package/dist/ezui/{p-2f351332.entry.js → p-e06a9886.entry.js} +1 -1
  200. package/dist/ezui/p-e07e4671.js +1 -0
  201. package/dist/ezui/{p-1bb62d6b.entry.js → p-e3544d23.entry.js} +1 -1
  202. package/dist/ezui/{p-9e95bfeb.entry.js → p-e6a9041d.entry.js} +1 -1
  203. package/dist/ezui/{p-000159dc.entry.js → p-e75c7a23.entry.js} +1 -1
  204. package/dist/ezui/{p-68b2e579.entry.js → p-ea54d056.entry.js} +1 -1
  205. package/dist/ezui/{p-ba25a351.entry.js → p-ecaac11f.entry.js} +1 -1
  206. package/dist/ezui/{p-9e45446f.entry.js → p-f4861c6a.entry.js} +1 -1
  207. package/dist/ezui/{p-3eaa0f67.entry.js → p-f5a30e35.entry.js} +1 -1
  208. package/dist/ezui/{p-44b39e81.entry.js → p-fa6732f2.entry.js} +1 -1
  209. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +0 -2
  210. package/dist/types/components/ez-form-view/fieldbuilder/templates/SearchInputPlus.tpl.d.ts +2 -0
  211. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +4 -0
  212. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +5 -0
  213. package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +1 -0
  214. package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +1 -0
  215. package/dist/types/components/ez-grid/controller/ag-grid/editor/templates/SearchPlus.tpl.d.ts +3 -0
  216. package/dist/types/components/ez-search-plus/ez-search-plus.d.ts +184 -0
  217. package/dist/types/components/ez-search-plus/subcomponent/ez-search-result-list/ez-search-result-list.d.ts +26 -0
  218. package/dist/types/components/ez-text-input/ez-text-input.d.ts +6 -9
  219. package/dist/types/components/ez-tooltip/ez-tooltip.d.ts +37 -5
  220. package/dist/types/components.d.ts +330 -12
  221. package/dist/types/utils/constants.d.ts +2 -0
  222. package/dist/types/utils/index.d.ts +1 -0
  223. package/dist/types/utils/search/types.d.ts +12 -0
  224. package/package.json +2 -2
  225. package/react/components.d.ts +62 -60
  226. package/react/components.js +2 -0
  227. package/react/components.js.map +1 -1
  228. package/react/react-component-lib/createComponent.d.ts +1 -1
  229. package/react/react-component-lib/createComponent.js.map +1 -1
  230. package/react/react-component-lib/createOverlayComponent.js.map +1 -1
  231. package/react/react-component-lib/interfaces.js +1 -0
  232. package/react/react-component-lib/utils/attachProps.d.ts +1 -1
  233. package/react/react-component-lib/utils/attachProps.js.map +1 -1
  234. package/react/react-component-lib/utils/dev.js.map +1 -1
  235. package/react/react-component-lib/utils/index.d.ts +2 -2
  236. package/react/react-component-lib/utils/index.js.map +1 -1
  237. package/dist/collection/utils/ResponsiveInputUtils.js +0 -26
  238. package/dist/esm/constants-4e0d35b7.js +0 -5
  239. package/dist/ezui/p-05e1f4e7.js +0 -1
  240. package/dist/ezui/p-0cd9d4ec.entry.js +0 -1
  241. package/dist/ezui/p-37c840e8.entry.js +0 -1
  242. package/dist/ezui/p-4607fb89.js +0 -1
  243. package/dist/ezui/p-6d8b3298.entry.js +0 -1
  244. package/dist/ezui/p-6ec40dec.entry.js +0 -1
  245. package/dist/ezui/p-7ebbee50.entry.js +0 -1
  246. package/dist/ezui/p-e3f8660b.entry.js +0 -1
  247. package/dist/ezui/p-ede42942.entry.js +0 -1
  248. package/dist/types/utils/ResponsiveInputUtils.d.ts +0 -6
@@ -1 +1 @@
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-ec7db713.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
+ import{r as t,c as i,h as s,g as e}from"./p-23a36bb6.js";import{NumberUtils as h,StringUtils as r,ElementIDUtils as n}from"@sankhyalabs/core";import{C as a}from"./p-ec7db713.js";const o=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(){a.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"]}}};o.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{o as ez_number_input}
@@ -0,0 +1 @@
1
+ import{r as t,c as i,h as s,H as o,g as e}from"./p-23a36bb6.js";import{ObjectUtils as r,ElementIDUtils as h}from"@sankhyalabs/core";import"./p-2187f86c.js";import{C as n}from"./p-ec7db713.js";import"./p-ab574d59.js";import"./p-b853763b.js";import"./p-5895e687.js";import"./p-173f68ea.js";const l=class{constructor(s){t(this,s),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.isOpen=!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 s=this.getSelectedOption(t),o=this.getSelectedOption(i),e=this.getSelectedOption(this.value);this.isDifferentValues(e,s)&&(this.value=s),this.isDifferentValues(s,o)&&(this.setInputValue(),this._lookupMode||this.ezChange.emit(null===s?void 0:s)),this.resetOptions()}finally{this._lookupMode=!1}}observeOptions(t,i){r.equals(t,i)||this.loadOptions(a.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()}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 s=this.getWidthValue(t.value);i.includes(s)||i.push(s)})),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}showOptions(){var t,i;if(!this.enabled)return;this.openPopover();const s=null!==(i=null===(t=this.value)||void 0===t?void 0:t.value)&&void 0!==i?i:this.value,o=this._visibleOptions.findIndex((t=>t.value===s));this._preSelection=-1===o?0:o,this._resizeObserver&&this._resizeObserver.observe(this._textInput),this.setFocus()}hideOptions(){var t;null===(t=this._popover)||void 0===t||t.hide(),this._resizeObserver&&this._resizeObserver.unobserve(this._textInput)}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 s,o,e;const r=this.getSelectedOption(this.value);(null===(s=null==r?void 0:r.value)||void 0===s?void 0:s.toString())!==(null===(o=null==t?void 0:t.value)||void 0===o?void 0:o.toString())||null==r&&null!=t&&"value"in t?(this.value=(null==t?void 0:t.value)?t:void 0,null===(e=this._popover)||void 0===e||e.hide()):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,s=t.getAttribute("value");s||(s=i),this.options.push({label:i,value:s}),t.hidden=!0}))}this.loadOptions(a.PRELOAD)}componentDidLoad(){n.applyVarsTextInput(this.el,this._textInput),this.setInputValue(!1),this._resizeObserver=new ResizeObserver((t=>{window.requestAnimationFrame((()=>{Array.isArray(t)&&t.length&&this._textInput&&this._comboBoxList&&(this._comboBoxList.width=this._textInput.clientWidth)}))})),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}disconnectedCallback(){var t;null===(t=this._popover)||void 0===t||t.remove(),this._resizeObserver&&this._resizeObserver.disconnect()}handlerIconClick(){this.showOptions()}onTextInputChangeHandler(t){var i;if(this.clearDeboucingTimeout(),this._startLoading)return void(this._changeDeboucingTimeout=window.setTimeout((()=>{this.onTextInputChangeHandler(t)}),this._deboucingTime));const s=null===(i=t.target.value)||void 0===i?void 0:i.trim();this._criteria||(this._textInput.value=t.data||s),this._criteria=s,s?(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){var i,s,o,e,r,h;if(t.ctrlKey&&("f"===t.key||"F"===t.key))return this.loadOptions(a.ADVANCED),t.preventDefault(),void t.stopPropagation();switch(t.key){case"ArrowDown":t.preventDefault(),this.canShowListOptions()&&(this.showOptions(),null===(i=this._comboBoxList)||void 0===i||i.nextOption());break;case"ArrowUp":t.preventDefault(),this.canShowListOptions()&&(this.showOptions(),null===(s=this._comboBoxList)||void 0===s||s.previousOption());break;case"Enter":this.isOpen&&(t.preventDefault(),null===(o=this._comboBoxList)||void 0===o||o.selectCurrentOption());break;case"Escape":this.isOpen&&(t.preventDefault(),null===(e=this._popover)||void 0===e||e.hide());break;case"Tab":this._tabPressed=!0,this.isOpen&&(null===(r=this._comboBoxList)||void 0===r||r.selectCurrentOption(),null===(h=this._popover)||void 0===h||h.hide())}}onTextInputFocusOutHandler(){this.hideErrorOnFocusOut&&this.cancelPreselection()}canShowListOptions(){return!this._showLoading&&this._visibleOptions.length>0}openPopover(){var t;this.isOpen=!0,null===(t=this._popover)||void 0===t||t.show()}render(){var t;return h.addIDInfoIfNotExists(this.el,"input"),s(o,null,s("ez-text-input",{"data-element-id":h.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},s("button",{class:"btn",slot:"rightIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.handlerIconClick()},s("ez-icon",{iconName:"chevron-down"}))),s("ez-popover-plus",{ref:t=>this._popover=t,anchorElement:this._textInput,autoClose:!0,boxWidth:"fit-content",overlayType:"none",onEzVisibilityChange:t=>this.isOpen=t.detail},s("ez-combo-box-list",{ref:t=>this._comboBoxList=t,showLoading:this._showLoading,visibleOptions:this._visibleOptions,textEmptyList:this._textEmptyList,showOptionValue:this.showOptionValue,preSelection:this._preSelection,maxWidth:this._maxWidthValue,width:null===(t=this._textInput)||void 0===t?void 0:t.clientWidth,onOptionSelect:t=>this.selectOption(t),onOptionHover:t=>this._preSelection=t})))}get el(){return e(this)}static get watchers(){return{errorMessage:["observeErrorMessage"],value:["observeValue"],options:["observeOptions"]}}};var a;!function(t){t.ADVANCED="ADVANCED",t.PRELOAD="PRELOAD",t.PREDICTIVE="PREDICTIVE"}(a||(a={})),l.style=":host{--ez-combo-box--height:42px;--ez-combo-box--width:100%;--ez-combo-box--border-radius:var(--border--radius-medium, 12px);--ez-combo-box--font-size:var(--text--medium, 14px);--ez-combo-box--font-family:var(--font-pattern, Arial);--ez-combo-box--background-color--xlight:var(--background--xlight, #fff);--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__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);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)}.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{l as ez_combo_box}
@@ -1 +1 @@
1
- import{h as t,r as i,c as e,g as s}from"./p-e4c7eb39.js";import{ElementIDUtils as r,ObjectUtils as o,JSUtils as h}from"@sankhyalabs/core";const l=i=>{const{items:e,selectedItem:s,itemsHidden:o,showDropdown:h,handleShowDropdown:l,collapseConfigPosition:a,ellipsesPositionedEnd:c}=i,n=i=>t("li",Object.assign({class:"breadcrumb__item",onClick:t=>(t=>{t.stopPropagation(),l(!h)})(t)},{[r.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:r.getInternalIDInfo("ezBreadcrumbItem_ellipsis")}),c&&t("ez-icon",Object.assign({class:"breadcrumb__item--chevron",size:"small",iconName:"chevron-right"},{[r.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${r.getInternalIDInfo(`iconPath${i.id}`)}`})),t("span",{class:"ellipses__item"},"..."),c||t("ez-icon",Object.assign({class:"breadcrumb__item--chevron",size:"small",iconName:"chevron-right"},{[r.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${r.getInternalIDInfo(`iconPath${i.id}`)}`})),h&&t("ez-dropdown",Object.assign({class:"dropdown-ellipsis",items:o.map((t=>Object.assign(Object.assign({},t),{type:"item",children:null,iconName:t.iconName||null,subAction:null,group:null}))),onEzClick:t=>s.emit(t.detail)},{[r.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${r.getInternalIDInfo("dropdown")}`})));return t("div",{class:"breadcrumb__items"},e.map(((i,o)=>{const h=o===e.length-1;return t("div",{class:"breadcrumb__group"},a===o&&n(i),t("li",Object.assign({class:"breadcrumb__item",id:i.id},{[r.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:r.getInternalIDInfo(`ezBreadcrumb_item_${i.id}_${i.label}`)}),i.iconName&&t("ez-icon",Object.assign({class:"breadcrumb__item--icon "+(h&&!c?"active-icon":""),size:"small",iconName:i.iconName},{[r.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${r.getInternalIDInfo(`iconItem${i.id}`)}`})),t("p",{class:"breadcrumb__item--label "+(h&&!c?"active":""),onClick:c||!h?()=>s.emit(i):void 0},i.label),!h&&t("ez-icon",Object.assign({class:"breadcrumb__item--chevron",size:"small",iconName:"chevron-right"},{[r.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${r.getInternalIDInfo(`iconPath${i.id}`)}`}))),a-1===o&&c&&n(i))})))},a=class{constructor(t){i(this,t),this.selectedItem=e(this,"selectedItem",7),this._ellipsesPositionedEnd=!1,this._renderSecond=!1,this.INDEX_ITEM_TO_REMOVE=1,this.CHEVRON_SIZE=28,this.handleShowDropdown=t=>{this.showDropdown=t},this.items=[],this.fillMode="auto",this.maxItems=4,this.positionEllipsis=1,this.visibleItems=void 0,this.hiddenItems=[],this.showDropdown=!1,this.collapseConfigPosition=-1}watchPropHandler(t,i){o.objectToString(t||[])!==o.objectToString(i||[])&&this.loadItems(),"auto"===this.fillMode&&this.handleResize()}watchPropHiddenItems(){"auto"===this.fillMode&&(this.collapseConfigPosition=this.hiddenItems.length>0?1:-1)}componentDidUpdate(){this.positionDropdown(),this.setEvents()}componentWillLoad(){this.loadItems()}loadItems(){this.visibleItems=[...this.items],this.hiddenItems=[],"regular"===this.fillMode?this.configModeRegular():"auto"===this.fillMode&&this.startResize(),this.setEvents()}closeDropdown(t){const i=null==t?void 0:t.target;null!=i&&i!==this._element.shadowRoot.querySelector(".ellipses__item")&&(this.showDropdown=!1)}setEvents(){document.removeEventListener("click",this.closeDropdown.bind(this)),document.addEventListener("click",this.closeDropdown.bind(this)),document.removeEventListener("scroll",this.positionDropdown.bind(this)),document.addEventListener("scroll",this.positionDropdown.bind(this))}componentDidLoad(){r.addIDInfo(this._element)}componentDidRender(){"auto"===this.fillMode&&this.configResize()}configResize(){null!=this._resizeObserver&&this._resizeObserver.unobserve(this._element.parentElement),this._resizeObserver=new ResizeObserver(h.debounce(this.handleResize.bind(this),200)),this._resizeObserver.observe(this._element.parentElement)}handleResize(){if(!this._renderSecond)return void(this._renderSecond=!0);if(null==this._element.parentElement)return;let{offsetWidth:t}=this._element.parentElement,i=0;this.visibleItems.forEach((t=>i+=t.width));const e=this.collapseConfigPosition>-1?39:0;t<i+e?this.handleCollapse(t,i):t>=i+e&&this.handleExpand(t)}handleCollapse(t,i){if(this.visibleItems.length<=2)return;let e=[...this.visibleItems],s=[...this.hiddenItems],r=e[this.INDEX_ITEM_TO_REMOVE],o=!1;for(;e.length>2&&null!=r&&i>t;)o=!0,e=e.filter(((t,i)=>i!==this.INDEX_ITEM_TO_REMOVE)),s=[...s,r],i-=r.width,r=e[this.INDEX_ITEM_TO_REMOVE];o&&(this.visibleItems=e,this.hiddenItems=s,this.showDropdown=!1)}handleExpand(t){if(!this.hiddenItems.length)return;let i=Math.abs(this._elBreadcrumbList.offsetWidth-t),e=[...this.visibleItems],s=[...this.hiddenItems],r=s[s.length-1],o=!1;for(;r&&i>=r.width;)i-=r.width,s.pop(),e.splice(this.INDEX_ITEM_TO_REMOVE,0,r),r=s[s.length-1],o=!0;o&&(this.visibleItems=e,this.hiddenItems=s,this.showDropdown=!1)}configModeRegular(){if(this.visibleItems.length>this.maxItems){const t=Math.abs(this.visibleItems.length-this.maxItems);if(0===this.positionEllipsis){const i=this.visibleItems.slice(0,t);this.hiddenItems.push(...i),this.visibleItems.splice(0,t)}else if(this.positionEllipsis>=this.maxItems){const t=this.visibleItems.slice(this.maxItems);this.hiddenItems.push(...t),this.visibleItems.splice(this.maxItems),this._ellipsesPositionedEnd=!0}else{const i=this.visibleItems.splice(this.positionEllipsis,t);this.hiddenItems.push(...i)}this.collapseConfigPosition=this.positionEllipsis}}positionDropdown(){var t;const i=null===(t=this._element.shadowRoot.querySelector(".ellipses__item"))||void 0===t?void 0:t.getBoundingClientRect(),e=this._element.shadowRoot.querySelector(".dropdown-ellipsis");null!=i&&null!=e&&(e.style.top=i.y+i.height+5+"px",e.style.left=i.x+"px")}async startResize(){const t=this._element.parentElement.offsetWidth,i=await Promise.all(this.visibleItems.map((async(t,i)=>(t.width=await this.measureSizeHTMLElement(t),i===this.visibleItems.length-1&&(t.width-=this.CHEVRON_SIZE),t))));if(i.reduce(((t,i)=>t+i.width),0)>t){const e=[],s=[...i],r=s.shift(),o=s.pop();o.width+=10,e.push(r,o);let h=e.reduce(((t,i)=>t+i.width),0),l=Math.abs(h-t);s.reverse().forEach((i=>{if(i.width<l){const i=s.shift();e.splice(1,0,i),h=e.reduce(((t,i)=>t+i.width),0),l=Math.abs(h-t)}})),this.visibleItems=[...e],this.hiddenItems=[...s.reverse()]}}measureSizeHTMLElement(t){return new Promise((i=>{this.waitFontLoad().then((()=>{void 0===this._textMesurement&&(this._textMesurement=this._element.shadowRoot.ownerDocument.createElement("canvas"));const e=this._textMesurement.getContext("2d");e.font="14px Roboto, Algerian",i((t.iconName?19:0)+this.CHEVRON_SIZE+e.measureText(t.label).width)}))}))}waitFontLoad(){return new Promise((t=>{document.fonts.load("14px Roboto").then((()=>t()),t())}))}getItemContent(){return t("nav",{class:"breadcrumb"},t("ol",{class:"breadcrumb__list",ref:t=>this._elBreadcrumbList=t},t(l,{items:this.visibleItems,selectedItem:this.selectedItem,itemsHidden:this.hiddenItems,showDropdown:this.showDropdown,handleShowDropdown:this.handleShowDropdown,collapseConfigPosition:this.collapseConfigPosition,ellipsesPositionedEnd:this._ellipsesPositionedEnd})))}render(){return this.getItemContent()}get _element(){return s(this)}static get watchers(){return{items:["watchPropHandler"],hiddenItems:["watchPropHiddenItems"]}}};a.style=":host{--breadcrumb__item--label--color--title-primary:var(--color--title-primary, #2B3A54);--breadcrumb__item--label--color--active:var(--color--primary, '#008561');--breadcrumb__item--label--font-weight:var(--text-weight--large, 600);display:block;font-size:var(--text--medium, 14px);font-family:var(--font-pattern, \"Roboto\");font-weight:var(--text-weight--medium, 400)}.breadcrumb{display:flex}.breadcrumb__group{display:flex}.breadcrumb__list{list-style-type:none;display:inline-block;margin:0;padding:0;overflow:hidden;white-space:nowrap}.breadcrumb__item{display:inline-flex;align-items:center;cursor:pointer}.breadcrumb__item--label{color:var(--breadcrumb__item--label--color--title-primary);margin:0px}.breadcrumb__item--icon{padding-right:3px;color:var(--breadcrumb__item--label--color--title-primary)}.breadcrumb__item--chevron{padding:0px 6px;cursor:default}.active{color:var(--breadcrumb__item--label--color--active);font-weight:var(--breadcrumb__item--label--font-weight);cursor:default}.active-icon{--icon--color:var(--breadcrumb__item--label--color--active);cursor:default}.breadcrumb__items{display:flex}";export{a as ez_breadcrumb}
1
+ import{h as t,r as i,c as e,g as s}from"./p-23a36bb6.js";import{ElementIDUtils as r,ObjectUtils as o,JSUtils as h}from"@sankhyalabs/core";const l=i=>{const{items:e,selectedItem:s,itemsHidden:o,showDropdown:h,handleShowDropdown:l,collapseConfigPosition:a,ellipsesPositionedEnd:c}=i,n=i=>t("li",Object.assign({class:"breadcrumb__item",onClick:t=>(t=>{t.stopPropagation(),l(!h)})(t)},{[r.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:r.getInternalIDInfo("ezBreadcrumbItem_ellipsis")}),c&&t("ez-icon",Object.assign({class:"breadcrumb__item--chevron",size:"small",iconName:"chevron-right"},{[r.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${r.getInternalIDInfo(`iconPath${i.id}`)}`})),t("span",{class:"ellipses__item"},"..."),c||t("ez-icon",Object.assign({class:"breadcrumb__item--chevron",size:"small",iconName:"chevron-right"},{[r.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${r.getInternalIDInfo(`iconPath${i.id}`)}`})),h&&t("ez-dropdown",Object.assign({class:"dropdown-ellipsis",items:o.map((t=>Object.assign(Object.assign({},t),{type:"item",children:null,iconName:t.iconName||null,subAction:null,group:null}))),onEzClick:t=>s.emit(t.detail)},{[r.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${r.getInternalIDInfo("dropdown")}`})));return t("div",{class:"breadcrumb__items"},e.map(((i,o)=>{const h=o===e.length-1;return t("div",{class:"breadcrumb__group"},a===o&&n(i),t("li",Object.assign({class:"breadcrumb__item",id:i.id},{[r.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:r.getInternalIDInfo(`ezBreadcrumb_item_${i.id}_${i.label}`)}),i.iconName&&t("ez-icon",Object.assign({class:"breadcrumb__item--icon "+(h&&!c?"active-icon":""),size:"small",iconName:i.iconName},{[r.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${r.getInternalIDInfo(`iconItem${i.id}`)}`})),t("p",{class:"breadcrumb__item--label "+(h&&!c?"active":""),onClick:c||!h?()=>s.emit(i):void 0},i.label),!h&&t("ez-icon",Object.assign({class:"breadcrumb__item--chevron",size:"small",iconName:"chevron-right"},{[r.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${r.getInternalIDInfo(`iconPath${i.id}`)}`}))),a-1===o&&c&&n(i))})))},a=class{constructor(t){i(this,t),this.selectedItem=e(this,"selectedItem",7),this._ellipsesPositionedEnd=!1,this._renderSecond=!1,this.INDEX_ITEM_TO_REMOVE=1,this.CHEVRON_SIZE=28,this.handleShowDropdown=t=>{this.showDropdown=t},this.items=[],this.fillMode="auto",this.maxItems=4,this.positionEllipsis=1,this.visibleItems=void 0,this.hiddenItems=[],this.showDropdown=!1,this.collapseConfigPosition=-1}watchPropHandler(t,i){o.objectToString(t||[])!==o.objectToString(i||[])&&this.loadItems(),"auto"===this.fillMode&&this.handleResize()}watchPropHiddenItems(){"auto"===this.fillMode&&(this.collapseConfigPosition=this.hiddenItems.length>0?1:-1)}componentDidUpdate(){this.positionDropdown(),this.setEvents()}componentWillLoad(){this.loadItems()}loadItems(){this.visibleItems=[...this.items],this.hiddenItems=[],"regular"===this.fillMode?this.configModeRegular():"auto"===this.fillMode&&this.startResize(),this.setEvents()}closeDropdown(t){const i=null==t?void 0:t.target;null!=i&&i!==this._element.shadowRoot.querySelector(".ellipses__item")&&(this.showDropdown=!1)}setEvents(){document.removeEventListener("click",this.closeDropdown.bind(this)),document.addEventListener("click",this.closeDropdown.bind(this)),document.removeEventListener("scroll",this.positionDropdown.bind(this)),document.addEventListener("scroll",this.positionDropdown.bind(this))}componentDidLoad(){r.addIDInfo(this._element)}componentDidRender(){"auto"===this.fillMode&&this.configResize()}configResize(){null!=this._resizeObserver&&this._resizeObserver.unobserve(this._element.parentElement),this._resizeObserver=new ResizeObserver(h.debounce(this.handleResize.bind(this),200)),this._resizeObserver.observe(this._element.parentElement)}handleResize(){if(!this._renderSecond)return void(this._renderSecond=!0);if(null==this._element.parentElement)return;let{offsetWidth:t}=this._element.parentElement,i=0;this.visibleItems.forEach((t=>i+=t.width));const e=this.collapseConfigPosition>-1?39:0;t<i+e?this.handleCollapse(t,i):t>=i+e&&this.handleExpand(t)}handleCollapse(t,i){if(this.visibleItems.length<=2)return;let e=[...this.visibleItems],s=[...this.hiddenItems],r=e[this.INDEX_ITEM_TO_REMOVE],o=!1;for(;e.length>2&&null!=r&&i>t;)o=!0,e=e.filter(((t,i)=>i!==this.INDEX_ITEM_TO_REMOVE)),s=[...s,r],i-=r.width,r=e[this.INDEX_ITEM_TO_REMOVE];o&&(this.visibleItems=e,this.hiddenItems=s,this.showDropdown=!1)}handleExpand(t){if(!this.hiddenItems.length)return;let i=Math.abs(this._elBreadcrumbList.offsetWidth-t),e=[...this.visibleItems],s=[...this.hiddenItems],r=s[s.length-1],o=!1;for(;r&&i>=r.width;)i-=r.width,s.pop(),e.splice(this.INDEX_ITEM_TO_REMOVE,0,r),r=s[s.length-1],o=!0;o&&(this.visibleItems=e,this.hiddenItems=s,this.showDropdown=!1)}configModeRegular(){if(this.visibleItems.length>this.maxItems){const t=Math.abs(this.visibleItems.length-this.maxItems);if(0===this.positionEllipsis){const i=this.visibleItems.slice(0,t);this.hiddenItems.push(...i),this.visibleItems.splice(0,t)}else if(this.positionEllipsis>=this.maxItems){const t=this.visibleItems.slice(this.maxItems);this.hiddenItems.push(...t),this.visibleItems.splice(this.maxItems),this._ellipsesPositionedEnd=!0}else{const i=this.visibleItems.splice(this.positionEllipsis,t);this.hiddenItems.push(...i)}this.collapseConfigPosition=this.positionEllipsis}}positionDropdown(){var t;const i=null===(t=this._element.shadowRoot.querySelector(".ellipses__item"))||void 0===t?void 0:t.getBoundingClientRect(),e=this._element.shadowRoot.querySelector(".dropdown-ellipsis");null!=i&&null!=e&&(e.style.top=i.y+i.height+5+"px",e.style.left=i.x+"px")}async startResize(){const t=this._element.parentElement.offsetWidth,i=await Promise.all(this.visibleItems.map((async(t,i)=>(t.width=await this.measureSizeHTMLElement(t),i===this.visibleItems.length-1&&(t.width-=this.CHEVRON_SIZE),t))));if(i.reduce(((t,i)=>t+i.width),0)>t){const e=[],s=[...i],r=s.shift(),o=s.pop();o.width+=10,e.push(r,o);let h=e.reduce(((t,i)=>t+i.width),0),l=Math.abs(h-t);s.reverse().forEach((i=>{if(i.width<l){const i=s.shift();e.splice(1,0,i),h=e.reduce(((t,i)=>t+i.width),0),l=Math.abs(h-t)}})),this.visibleItems=[...e],this.hiddenItems=[...s.reverse()]}}measureSizeHTMLElement(t){return new Promise((i=>{this.waitFontLoad().then((()=>{void 0===this._textMesurement&&(this._textMesurement=this._element.shadowRoot.ownerDocument.createElement("canvas"));const e=this._textMesurement.getContext("2d");e.font="14px Roboto, Algerian",i((t.iconName?19:0)+this.CHEVRON_SIZE+e.measureText(t.label).width)}))}))}waitFontLoad(){return new Promise((t=>{document.fonts.load("14px Roboto").then((()=>t()),t())}))}getItemContent(){return t("nav",{class:"breadcrumb"},t("ol",{class:"breadcrumb__list",ref:t=>this._elBreadcrumbList=t},t(l,{items:this.visibleItems,selectedItem:this.selectedItem,itemsHidden:this.hiddenItems,showDropdown:this.showDropdown,handleShowDropdown:this.handleShowDropdown,collapseConfigPosition:this.collapseConfigPosition,ellipsesPositionedEnd:this._ellipsesPositionedEnd})))}render(){return this.getItemContent()}get _element(){return s(this)}static get watchers(){return{items:["watchPropHandler"],hiddenItems:["watchPropHiddenItems"]}}};a.style=":host{--breadcrumb__item--label--color--title-primary:var(--color--title-primary, #2B3A54);--breadcrumb__item--label--color--active:var(--color--primary, '#008561');--breadcrumb__item--label--font-weight:var(--text-weight--large, 600);display:block;font-size:var(--text--medium, 14px);font-family:var(--font-pattern, \"Roboto\");font-weight:var(--text-weight--medium, 400)}.breadcrumb{display:flex}.breadcrumb__group{display:flex}.breadcrumb__list{list-style-type:none;display:inline-block;margin:0;padding:0;overflow:hidden;white-space:nowrap}.breadcrumb__item{display:inline-flex;align-items:center;cursor:pointer}.breadcrumb__item--label{color:var(--breadcrumb__item--label--color--title-primary);margin:0px}.breadcrumb__item--icon{padding-right:3px;color:var(--breadcrumb__item--label--color--title-primary)}.breadcrumb__item--chevron{padding:0px 6px;cursor:default}.active{color:var(--breadcrumb__item--label--color--active);font-weight:var(--breadcrumb__item--label--font-weight);cursor:default}.active-icon{--icon--color:var(--breadcrumb__item--label--color--active);cursor:default}.breadcrumb__items{display:flex}";export{a as ez_breadcrumb}