@sankhyalabs/ezui 7.2.0-dev.7 → 7.2.0-dev.8

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 (171) hide show
  1. package/dist/cjs/{ApplicationUtils-dc653b57.js → ApplicationUtils-50f74c38.js} +1 -1
  2. package/dist/cjs/{app-globals-16ec1ff7.js → app-globals-18e8b9df.js} +1 -1
  3. package/dist/cjs/classic-search-list_7.cjs.entry.js +2 -2
  4. package/dist/cjs/ez-actions-button.cjs.entry.js +2 -2
  5. package/dist/cjs/ez-alert-list.cjs.entry.js +1 -1
  6. package/dist/cjs/ez-avatar.cjs.entry.js +1 -1
  7. package/dist/cjs/ez-calendar.cjs.entry.js +1 -1
  8. package/dist/cjs/ez-classic-date-input.cjs.entry.js +1 -1
  9. package/dist/cjs/ez-classic-date-time-input.cjs.entry.js +1 -1
  10. package/dist/cjs/ez-classic-number-input.cjs.entry.js +1 -1
  11. package/dist/cjs/ez-classic-search-plus.cjs.entry.js +25 -12
  12. package/dist/cjs/ez-classic-search.cjs.entry.js +2 -2
  13. package/dist/cjs/ez-classic-time-input.cjs.entry.js +1 -1
  14. package/dist/cjs/ez-collapsible-box.cjs.entry.js +2 -2
  15. package/dist/cjs/ez-combo-box.cjs.entry.js +2 -2
  16. package/dist/cjs/ez-date-input.cjs.entry.js +1 -1
  17. package/dist/cjs/ez-date-time-input.cjs.entry.js +1 -1
  18. package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
  19. package/dist/cjs/ez-double-list.cjs.entry.js +1 -1
  20. package/dist/cjs/ez-file-item.cjs.entry.js +1 -1
  21. package/dist/cjs/ez-form-view.cjs.entry.js +1 -1
  22. package/dist/cjs/ez-form.cjs.entry.js +3 -3
  23. package/dist/cjs/ez-grid-pagination.cjs.entry.js +1 -1
  24. package/dist/cjs/ez-grid.cjs.entry.js +3 -3
  25. package/dist/cjs/ez-guide-navigator.cjs.entry.js +1 -1
  26. package/dist/cjs/ez-link-builder_6.cjs.entry.js +1 -1
  27. package/dist/cjs/ez-list.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 +1 -1
  31. package/dist/cjs/ez-number-input.cjs.entry.js +1 -1
  32. package/dist/cjs/ez-pagination.cjs.entry.js +1 -1
  33. package/dist/cjs/ez-popup.cjs.entry.js +1 -1
  34. package/dist/cjs/ez-record-navigation.cjs.entry.js +1 -1
  35. package/dist/cjs/ez-scroller_2.cjs.entry.js +1 -1
  36. package/dist/cjs/ez-search-plus.cjs.entry.js +11 -2
  37. package/dist/cjs/ez-search-result-list.cjs.entry.js +1 -1
  38. package/dist/cjs/ez-search.cjs.entry.js +2 -2
  39. package/dist/cjs/ez-sidebar-navigator.cjs.entry.js +1 -1
  40. package/dist/cjs/ez-skeleton.cjs.entry.js +1 -1
  41. package/dist/cjs/ez-sortable-list.cjs.entry.js +1 -1
  42. package/dist/cjs/ez-spinner.cjs.entry.js +1 -1
  43. package/dist/cjs/ez-split-button.cjs.entry.js +1 -1
  44. package/dist/cjs/ez-split-item.cjs.entry.js +2 -2
  45. package/dist/cjs/ez-time-input.cjs.entry.js +1 -1
  46. package/dist/cjs/ez-tree.cjs.entry.js +1 -1
  47. package/dist/cjs/ez-upload.cjs.entry.js +2 -2
  48. package/dist/cjs/ezui.cjs.js +3 -3
  49. package/dist/cjs/filter-column.cjs.entry.js +1 -1
  50. package/dist/cjs/{index-a8537087.js → index-8faf8416.js} +3 -0
  51. package/dist/cjs/loader.cjs.js +3 -3
  52. package/dist/cjs/{search-column-cd0e44be.js → search-column-1c884d08.js} +2 -2
  53. package/dist/collection/components/ez-classic-search-plus/ez-classic-search-plus.js +26 -11
  54. package/dist/collection/components/ez-search-plus/ez-search-plus.js +9 -0
  55. package/dist/collection/utils/i18n/locales/en-us.js +1 -0
  56. package/dist/collection/utils/i18n/locales/es-es.js +1 -0
  57. package/dist/collection/utils/i18n/locales/pt-br.js +1 -0
  58. package/dist/custom-elements/index.js +36 -11
  59. package/dist/esm/{ApplicationUtils-e99e53c8.js → ApplicationUtils-7eb5d339.js} +1 -1
  60. package/dist/esm/{app-globals-6e27b3bb.js → app-globals-94e67ab2.js} +1 -1
  61. package/dist/esm/classic-search-list_7.entry.js +2 -2
  62. package/dist/esm/ez-actions-button.entry.js +2 -2
  63. package/dist/esm/ez-alert-list.entry.js +1 -1
  64. package/dist/esm/ez-avatar.entry.js +1 -1
  65. package/dist/esm/ez-calendar.entry.js +1 -1
  66. package/dist/esm/ez-classic-date-input.entry.js +1 -1
  67. package/dist/esm/ez-classic-date-time-input.entry.js +1 -1
  68. package/dist/esm/ez-classic-number-input.entry.js +1 -1
  69. package/dist/esm/ez-classic-search-plus.entry.js +25 -12
  70. package/dist/esm/ez-classic-search.entry.js +2 -2
  71. package/dist/esm/ez-classic-time-input.entry.js +1 -1
  72. package/dist/esm/ez-collapsible-box.entry.js +2 -2
  73. package/dist/esm/ez-combo-box.entry.js +2 -2
  74. package/dist/esm/ez-date-input.entry.js +1 -1
  75. package/dist/esm/ez-date-time-input.entry.js +1 -1
  76. package/dist/esm/ez-dialog.entry.js +1 -1
  77. package/dist/esm/ez-double-list.entry.js +1 -1
  78. package/dist/esm/ez-file-item.entry.js +1 -1
  79. package/dist/esm/ez-form-view.entry.js +1 -1
  80. package/dist/esm/ez-form.entry.js +3 -3
  81. package/dist/esm/ez-grid-pagination.entry.js +1 -1
  82. package/dist/esm/ez-grid.entry.js +3 -3
  83. package/dist/esm/ez-guide-navigator.entry.js +1 -1
  84. package/dist/esm/ez-link-builder_6.entry.js +1 -1
  85. package/dist/esm/ez-list.entry.js +1 -1
  86. package/dist/esm/ez-modal-container.entry.js +1 -1
  87. package/dist/esm/ez-modal.entry.js +1 -1
  88. package/dist/esm/ez-multi-selection-list.entry.js +1 -1
  89. package/dist/esm/ez-number-input.entry.js +1 -1
  90. package/dist/esm/ez-pagination.entry.js +1 -1
  91. package/dist/esm/ez-popup.entry.js +1 -1
  92. package/dist/esm/ez-record-navigation.entry.js +1 -1
  93. package/dist/esm/ez-scroller_2.entry.js +1 -1
  94. package/dist/esm/ez-search-plus.entry.js +11 -2
  95. package/dist/esm/ez-search-result-list.entry.js +1 -1
  96. package/dist/esm/ez-search.entry.js +2 -2
  97. package/dist/esm/ez-sidebar-navigator.entry.js +1 -1
  98. package/dist/esm/ez-skeleton.entry.js +1 -1
  99. package/dist/esm/ez-sortable-list.entry.js +1 -1
  100. package/dist/esm/ez-spinner.entry.js +1 -1
  101. package/dist/esm/ez-split-button.entry.js +1 -1
  102. package/dist/esm/ez-split-item.entry.js +2 -2
  103. package/dist/esm/ez-time-input.entry.js +1 -1
  104. package/dist/esm/ez-tree.entry.js +1 -1
  105. package/dist/esm/ez-upload.entry.js +2 -2
  106. package/dist/esm/ezui.js +3 -3
  107. package/dist/esm/filter-column.entry.js +1 -1
  108. package/dist/esm/{index-a031816b.js → index-4dc8ed82.js} +3 -0
  109. package/dist/esm/loader.js +3 -3
  110. package/dist/esm/{search-column-33d72c20.js → search-column-e79eb0f3.js} +2 -2
  111. package/dist/ezui/ezui.esm.js +1 -1
  112. package/dist/ezui/{p-318d4dc9.entry.js → p-00162042.entry.js} +1 -1
  113. package/dist/ezui/{p-91ff4511.entry.js → p-0298252e.entry.js} +1 -1
  114. package/dist/ezui/{p-510eccc7.entry.js → p-05ee4e45.entry.js} +1 -1
  115. package/dist/ezui/{p-8980b477.entry.js → p-159f4beb.entry.js} +1 -1
  116. package/dist/ezui/{p-b5f45319.entry.js → p-19a60062.entry.js} +1 -1
  117. package/dist/ezui/{p-4991931a.entry.js → p-1b01db47.entry.js} +1 -1
  118. package/dist/ezui/{p-caf3cd8f.entry.js → p-1ec7f65c.entry.js} +1 -1
  119. package/dist/ezui/{p-8a5efec5.entry.js → p-1f1ba5b9.entry.js} +1 -1
  120. package/dist/ezui/{p-ea0f78d1.entry.js → p-2490ff37.entry.js} +1 -1
  121. package/dist/ezui/{p-a4911d89.entry.js → p-28658422.entry.js} +1 -1
  122. package/dist/ezui/{p-0fc981e9.entry.js → p-2a1c1daf.entry.js} +1 -1
  123. package/dist/ezui/{p-2e07f3d5.entry.js → p-361a4bfa.entry.js} +1 -1
  124. package/dist/ezui/{p-879cee4d.entry.js → p-373a7b4e.entry.js} +1 -1
  125. package/dist/ezui/{p-3311e7ef.entry.js → p-377125c7.entry.js} +1 -1
  126. package/dist/ezui/{p-4f76dc28.entry.js → p-39e1c05d.entry.js} +1 -1
  127. package/dist/ezui/{p-473a397f.entry.js → p-3a167b3f.entry.js} +1 -1
  128. package/dist/ezui/{p-24582dd6.js → p-46b0b0c7.js} +1 -1
  129. package/dist/ezui/{p-1244fac0.entry.js → p-4cf0ed43.entry.js} +1 -1
  130. package/dist/ezui/{p-ab41edab.entry.js → p-4dca017c.entry.js} +1 -1
  131. package/dist/ezui/p-517498c1.js +1 -0
  132. package/dist/ezui/{p-54975948.entry.js → p-57bf1a88.entry.js} +1 -1
  133. package/dist/ezui/{p-4ca4e8d1.entry.js → p-61e11a7a.entry.js} +1 -1
  134. package/dist/ezui/{p-3d772561.entry.js → p-6fde1c11.entry.js} +1 -1
  135. package/dist/ezui/{p-c8584e28.entry.js → p-714f2b21.entry.js} +1 -1
  136. package/dist/ezui/{p-700af412.entry.js → p-77f112e0.entry.js} +1 -1
  137. package/dist/ezui/{p-c33d46e0.entry.js → p-78c8a5e7.entry.js} +1 -1
  138. package/dist/ezui/{p-ab4da973.entry.js → p-78d2b5a5.entry.js} +1 -1
  139. package/dist/ezui/{p-93097edc.entry.js → p-854fa107.entry.js} +1 -1
  140. package/dist/ezui/{p-1ab5ba19.entry.js → p-8c0ad73d.entry.js} +1 -1
  141. package/dist/ezui/{p-2887cbf9.entry.js → p-96120941.entry.js} +1 -1
  142. package/dist/ezui/{p-d98dd01a.entry.js → p-9883faa0.entry.js} +1 -1
  143. package/dist/ezui/{p-f1390be9.entry.js → p-9f58cc27.entry.js} +1 -1
  144. package/dist/ezui/{p-0bc16f75.entry.js → p-b39b7880.entry.js} +1 -1
  145. package/dist/ezui/{p-69344c23.js → p-b6579f86.js} +1 -1
  146. package/dist/ezui/{p-a8f807ed.entry.js → p-b72322ad.entry.js} +1 -1
  147. package/dist/ezui/{p-adee66db.entry.js → p-b8a83790.entry.js} +1 -1
  148. package/dist/ezui/{p-32b8f057.entry.js → p-bce082cf.entry.js} +1 -1
  149. package/dist/ezui/{p-2b65728f.entry.js → p-c626a0e4.entry.js} +1 -1
  150. package/dist/ezui/{p-ed6b6e0f.entry.js → p-d5c2d721.entry.js} +1 -1
  151. package/dist/ezui/{p-ddc6432d.entry.js → p-dce34f38.entry.js} +1 -1
  152. package/dist/ezui/{p-84be1391.entry.js → p-dd522434.entry.js} +1 -1
  153. package/dist/ezui/{p-96e5eaa2.entry.js → p-dfe374b1.entry.js} +1 -1
  154. package/dist/ezui/{p-a383fbc5.entry.js → p-e5df0199.entry.js} +1 -1
  155. package/dist/ezui/{p-dd5326e6.entry.js → p-f01c3171.entry.js} +1 -1
  156. package/dist/ezui/{p-c2d44132.entry.js → p-f678b330.entry.js} +1 -1
  157. package/dist/ezui/p-f8e18112.entry.js +1 -0
  158. package/dist/ezui/{p-f71a4d97.js → p-fc57648e.js} +1 -1
  159. package/dist/ezui/{p-7f475884.entry.js → p-fd784a7f.entry.js} +1 -1
  160. package/dist/ezui/p-fda563e0.entry.js +1 -0
  161. package/dist/ezui/{p-39d2bce5.entry.js → p-ffffdccf.entry.js} +1 -1
  162. package/dist/types/components/ez-classic-search-plus/ez-classic-search-plus.d.ts +3 -0
  163. package/dist/types/components/ez-search-plus/ez-search-plus.d.ts +1 -0
  164. package/dist/types/utils/i18n/locales/en-us.d.ts +1 -0
  165. package/dist/types/utils/i18n/locales/es-es.d.ts +1 -0
  166. package/dist/types/utils/i18n/locales/pt-br.d.ts +1 -0
  167. package/dist/types/utils/i18n/translations.d.ts +3 -0
  168. package/package.json +1 -1
  169. package/dist/ezui/p-2241dea1.js +0 -1
  170. package/dist/ezui/p-6bb36afc.entry.js +0 -1
  171. package/dist/ezui/p-fcdd861e.entry.js +0 -1
@@ -1 +1 @@
1
- import{r as i,c as t,h as e,H as s,g as a}from"./p-23a36bb6.js";import{StringUtils as r,ElementIDUtils as o,ObjectUtils as l,HTMLBuilder as c,KeyboardManager as n}from"@sankhyalabs/core";import{a as h,r as d}from"./p-88a115b3.js";import{i as m}from"./p-69344c23.js";import{C as b}from"./p-5895e687.js";import{R as u,a as p}from"./p-3e767a74.js";import{p as v}from"./p-dff9862b.js";import{A as g}from"./p-24582dd6.js";import"./p-ab574d59.js";import"./p-b853763b.js";import"./p-47e4a8ce.js";import"./p-112455b1.js";const _=class{constructor(e){i(this,e),this.changeValue=t(this,"changeValue",7),this.changePreSelection=t(this,"changePreSelection",7),this._startHighlightTag="<span class='card-item__highlight'>",this._endHighlightTag="</span>",this.MAX_HEIGHT=350,this.HEADER_MENU_HEIGHT=60,this.showLoading=void 0,this.visibleOptions=[],this.textEmptyList=void 0,this.canShowListOptions=void 0,this.value=void 0,this.showOptionValue=!0,this.preSelection=void 0}async nextOption(){const i=void 0===this.preSelection?0:Math.min(this.preSelection+1,this.visibleOptions.length-1);this.changePreSelection.emit(i),this.scrollToOption(this.visibleOptions[i])}async previousOption(){const i=void 0===this.preSelection?0:Math.max(this.preSelection-1,0);this.changePreSelection.emit(i),this.scrollToOption(this.visibleOptions[i])}selectOption(i){const t=Object.assign(Object.assign({},i),{value:h(null==i?void 0:i.value),label:h(null==i?void 0:i.label)}),e=Object.assign(Object.assign({},t),{value:d(null==t?void 0:t.value),label:d(null==t?void 0:t.label)});this.changeValue.emit(e)}createOption(i){let{key:t,title:e}=i;const s=new RegExp(this._startHighlightTag,"g"),a=new RegExp(this._endHighlightTag,"g");e=r.decodeHtmlEntities(e);const o={value:null==t?void 0:t.replace(s,"").replace(a,""),label:null==e?void 0:e.replace(s,"").replace(a,"")};this.selectOption(o)}scrollToOption(i){window.requestAnimationFrame((()=>{const t=(null==i?void 0:i.value)?this._optionsList.querySelector(`div#item_${i.value.replace(/([ #;&,.+*~':"!^$[\]()=<>|/\\])/g,"\\$1")}`):void 0;t&&t.scrollIntoView({behavior:"smooth",block:"nearest"})}))}buildItem(i,t){i.label=i.label||i.value;const s={key:i.value,title:i.label,details:i.details};return e("div",{style:{height:"100%"},class:t===this.preSelection?"item preselected":"item",id:`item_${i.value}`,onMouseDown:()=>this.createOption(s),onMouseOver:()=>this.changePreSelection.emit(t)},e("ez-card-item",{item:s,compacted:!0,enableKey:this.showOptionValue}))}componentDidLoad(){this._optionsList&&(this._optionsList.style.maxHeight=`${this.MAX_HEIGHT}px`)}componentDidUpdate(){if(this._optionsList){const i=this._optionsList.getBoundingClientRect();window.innerHeight-i.bottom<0&&this.adjustMaxHeight(i)}}adjustMaxHeight(i){if(this._optionsList){const t=Math.min(i.top-this.HEADER_MENU_HEIGHT,this.MAX_HEIGHT);this._optionsList.style.maxHeight=`${t}px`}}cleanEmptyObjectArray(i){return i.filter((i=>void 0!==(null==i?void 0:i.value)))}render(){return e(s,null,e("ul",{class:"list-options",ref:i=>this._optionsList=i},!this.showLoading&&0===this.cleanEmptyObjectArray(this.visibleOptions).length&&e("div",{class:"message"},e("span",{class:"message__no-result"},this.textEmptyList)),this.showLoading&&e("div",{class:"message"},e("div",{class:"message__loading"})),this.canShowListOptions&&this.visibleOptions.map(((i,t)=>this.buildItem(i,t)))))}};_.style=":host{--ez-classic-search__list-title--primary:var(--title--primary, #2B3A54);--ez-classic-search__list-text--primary:var(--text--primary, #626e82);--ez-classic-search__list-height:calc(var(--ez-classic-search--font-size) + var(--ez-classic-search--space--medium) + 4px);--ez-classic-search__list-min-width:64px;--ez-classic-search__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-classic-search__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-classic-search__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-classic-search__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-classic-search__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-classic-search__scrollbar--width:var(--space--small, 6px);--ez-classic-search--border-radius-small:var(--border--radius-small, 6px);--ez-classic-search--font-size:var(--text--medium, 14px);--ez-classic-search--font-family:var(--font-pattern, Arial);--ez-classic-search--font-weight--large:var(--text-weight--large, 500);--ez-classic-search--font-weight--medium:var(--text-weight--medium, 400);--ez-classic-search--background-medium:var(--background--medium, #f0f3f7);--ez-classic-search--line-height:calc(var(--text--medium, 14px) + 4px)}.list-options{position:relative;z-index:var(--more-visible, 2);margin:var(--space--small) 0px;padding:0px;padding-inline-start:0px;box-sizing:border-box;width:100%;height:100%;max-height:350px;min-width:150px;display:flex;flex-direction:column;scroll-behavior:smooth;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:var(--ez-classic-search__scrollbar--color-clicked) var(--ez-classic-search__scrollbar--color-background)}.list-options::-webkit-scrollbar{background-color:var(--scrollbar--background);width:var(--space--small);max-width:var(--space--small);min-width:var(--space--small);height:var(--space--small);max-height:var(--space--small);min-height:var(--space--small)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-classic-search__scrollbar--color-background);border-radius:var(--ez-classic-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-classic-search__scrollbar--color-default);border-radius:var(--ez-classic-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb:vertical:hover,.list-options::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-classic-search__scrollbar--color-hover)}.list-options::-webkit-scrollbar-thumb:vertical:active,.list-options::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-classic-search__scrollbar--color-clicked)}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;margin:var(--space--medium) 0px;min-height:var(--ez-classic-search__list-height)}.message__no-result{color:var(--ez-classic-search__list-title--primary);font-family:var(--ez-classic-search--font-family);font-size:var(--ez-classic-search--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-classic-search__list-title--primary);border-top:3px solid transparent}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-classic-search__list-title--primary);font-family:var(--ez-classic-search--font-family);font-size:var(--ez-classic-search--font-size);line-height:var(--ez-classic-search--line-height)}.item__label{font-weight:var(--ez-classic-search--font-weight--medium)}.item__label--bold{font-weight:var(--ez-classic-search--font-weight--large)}.item__value{text-align:center;color:var(--ez-classic-search__list-text--primary);font-weight:var(--ez-classic-search--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}.item__list>li:hover{background-color:var(--ez-classic-search--background-medium)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-classic-search--border-radius-small);gap:var(--space--small, 6px)}.preselected{background-color:var(--background--medium)}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@supports not (scrollbar-width: thin){.item{padding-right:8px}}";const x=class{constructor(e){i(this,e),this.changeValue=t(this,"changeValue",7),this._startHighlightTag="<span class='card-item__highlight'>",this._endHighlightTag="</span>",this.showLoading=void 0,this.visibleOptions=[],this.value=void 0,this.showOptionValue=!0,this._preSelection=void 0}observerVisivleOptions(i){i.length&&this.preSelectItemByIndex(0)}async nextOption(){const i=void 0===this._preSelection?0:Math.min(this._preSelection+1,this.visibleOptions.length-1);this.preSelectItemByIndex(i)}async previousOption(){const i=void 0===this._preSelection?0:Math.max(this._preSelection-1,0);this.preSelectItemByIndex(i)}preSelectItemByIndex(i){this._preSelection=i,this.scrollToOption(this.visibleOptions[i])}selectOption(i){const t=Object.assign(Object.assign({},i),{value:null==i?void 0:i.value,label:null==i?void 0:i.label}),e=Object.assign(Object.assign({},t),{value:this.removeHighLight(null==t?void 0:t.value),label:this.removeHighLight(null==t?void 0:t.label)});this.changeValue.emit(e)}removeHighLight(i){if(!i||"string"!=typeof i)return i;const t=new RegExp(this._startHighlightTag,"g"),e=new RegExp(this._endHighlightTag,"g");return i.replace(t,"").replace(e,"")}createAndSelectOption(i){let{key:t,title:e}=i;t=String(null!=t?t:""),e=r.decodeHtmlEntities(e);const s={value:this.removeHighLight(t),label:this.removeHighLight(e)};this.selectOption(s)}scrollToOption(i){(null==i?void 0:i.value)&&this._optionsList&&window.requestAnimationFrame((()=>{var t;const e=String(null!==(t=null==i?void 0:i.value)&&void 0!==t?t:""),s=e?this._optionsList.querySelector(`div#item_${e.replace(/([ #;&,.+*~':"!^$[\]()=<>|/\\])/g,"\\$1")}`):void 0;s&&s.scrollIntoView({behavior:"smooth",block:"nearest"})}))}buildItem(i,t){var s;i.label=i.label||i.value;const a={key:String(null!==(s=i.presentationValue)&&void 0!==s?s:""),title:i.presentationLabel,details:i.details};return e("div",{style:{height:"100%"},class:t===this._preSelection?"item preselected":"item",id:`item_${i.value}`,onMouseDown:()=>this.createAndSelectOption(a),onMouseOver:()=>{this._preSelection=t}},e("ez-card-item",{item:a,compacted:!0,enableKey:this.showOptionValue}))}async selectCurrentItem(){this.selectOption(this.visibleOptions[this._preSelection])}async cancelSelection(){this.cancelPreselection()}cancelPreselection(){this._preSelection=void 0}canShowListOptions(){return!this.showLoading&&this.visibleOptions.length>0}async componentWillLoad(){this.i18n=await m()}render(){return e(s,null,e("ul",{class:"list-options",ref:i=>this._optionsList=i},!this.showLoading&&0===this.visibleOptions.length&&e("div",{class:"message"},e("span",{class:"message__no-result"},this.i18n("ez-classic-search-plus.emptyList"))),this.showLoading&&e("div",{class:"loading__container"},e("ez-skeleton",{count:4,height:"20px"})),this.canShowListOptions()&&this.visibleOptions.map(((i,t)=>this.buildItem(i,t)))))}static get watchers(){return{visibleOptions:["observerVisivleOptions"]}}};x.style=":host{--ez-classic-search__list-title--primary:var(--title--primary, #2B3A54);--ez-classic-search__list-text--primary:var(--text--primary, #626e82);--ez-classic-search__list-height:calc(var(--ez-classic-search--font-size) + var(--ez-classic-search--space--medium) + 4px);--ez-classic-search__list-min-width:64px;--ez-classic-search__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-classic-search__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-classic-search__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-classic-search__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-classic-search__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-classic-search__scrollbar--width:var(--space--small, 6px);--ez-classic-search--border-radius-small:var(--border--radius-small, 6px);--ez-classic-search--font-size:var(--text--medium, 14px);--ez-classic-search--font-family:var(--font-pattern, Arial);--ez-classic-search--font-weight--large:var(--text-weight--large, 500);--ez-classic-search--font-weight--medium:var(--text-weight--medium, 400);--ez-classic-search--background-medium:var(--background--medium, #f0f3f7);--ez-classic-search--line-height:calc(var(--text--medium, 14px) + 4px)}.list-options{position:relative;z-index:var(--more-visible, 2);margin:var(--space--small) 0px;padding:0px;padding-inline-start:0px;box-sizing:border-box;width:100%;height:100%;max-height:350px;min-width:150px;display:flex;flex-direction:column;scroll-behavior:smooth;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:var(--ez-classic-search__scrollbar--color-clicked) var(--ez-classic-search__scrollbar--color-background)}.list-options::-webkit-scrollbar{background-color:var(--scrollbar--background);width:var(--space--small);max-width:var(--space--small);min-width:var(--space--small);height:var(--space--small);max-height:var(--space--small);min-height:var(--space--small)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-classic-search__scrollbar--color-background);border-radius:var(--ez-classic-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-classic-search__scrollbar--color-default);border-radius:var(--ez-classic-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb:vertical:hover,.list-options::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-classic-search__scrollbar--color-hover)}.list-options::-webkit-scrollbar-thumb:vertical:active,.list-options::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-classic-search__scrollbar--color-clicked)}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;margin:var(--space--medium) 0px;min-height:var(--ez-classic-search__list-height)}.message__no-result{color:var(--ez-classic-search__list-title--primary);font-family:var(--ez-classic-search--font-family);font-size:var(--ez-classic-search--font-size)}.loading__container{display:flex;flex-direction:column;margin:var(--space--small)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-classic-search__list-title--primary);font-family:var(--ez-classic-search--font-family);font-size:var(--ez-classic-search--font-size);line-height:var(--ez-classic-search--line-height)}.item__label{font-weight:var(--ez-classic-search--font-weight--medium)}.item__label--bold{font-weight:var(--ez-classic-search--font-weight--large)}.item__value{text-align:center;color:var(--ez-classic-search__list-text--primary);font-weight:var(--ez-classic-search--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}.item__list>li:hover{background-color:var(--ez-classic-search--background-medium)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-classic-search--border-radius-small);gap:var(--space--small, 6px)}.preselected{background-color:var(--background--medium)}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@supports not (scrollbar-width: thin){.item{padding-right:8px}}";const z=class{constructor(t){i(this,t),this.showLoading=void 0,this.visibleOptions=void 0,this.textEmptyList=void 0,this.showOptionValue=void 0,this.preSelection=void 0,this.maxWidth=void 0,this.width=void 0,this.onOptionSelect=void 0,this.onOptionHover=void 0}async nextOption(){var i,t;(null===(i=this.visibleOptions)||void 0===i?void 0:i.length)&&(void 0!==this.preSelection&&this.preSelection>=this.visibleOptions.length-1||(this.preSelection=void 0===this.preSelection?0:this.preSelection+1,this.scrollToOption(this.visibleOptions[this.preSelection]),null===(t=this.onOptionHover)||void 0===t||t.call(this,this.preSelection)))}async previousOption(){var i,t;(null===(i=this.visibleOptions)||void 0===i?void 0:i.length)&&(void 0!==this.preSelection&&this.preSelection<=0||(this.preSelection=void 0===this.preSelection?this.visibleOptions.length-1:this.preSelection-1,this.scrollToOption(this.visibleOptions[this.preSelection]),null===(t=this.onOptionHover)||void 0===t||t.call(this,this.preSelection)))}async selectCurrentOption(){void 0!==this.preSelection&&(this.onOptionSelect(this.visibleOptions[this.preSelection]),this.preSelection=void 0)}observeWidth(i,t){i!==t&&this._listWrapper&&(this._listWrapper.style.width=`${this.width}px`)}observeMaxWidth(i,t){i!==t&&this._listWrapper&&(this._listWrapper.style.maxWidth=this.maxWidth?`${this.maxWidth}px`:"")}handleKeyDown(i){switch(i.key){case"ArrowDown":i.preventDefault(),i.stopPropagation(),this.nextOption();break;case"ArrowUp":i.preventDefault(),i.stopPropagation(),this.previousOption();break;case"Enter":this.selectCurrentOption();break;case"Escape":this.preSelection=void 0}}buildItem(i,t){const s=this.showOptionValue&&this.maxWidth>0?`${this.maxWidth}px`:"";return i.label=i.label||i.value,e("li",{tabIndex:1,class:t===this.preSelection?"item preselected":"item",id:`item_${i.value}_${t}`,key:`item_${i.value}_${t}`,onMouseDown:()=>this.onOptionSelect(i),onMouseOver:()=>this.preSelection=t},this.showOptionValue?e("span",{class:"item__value",title:i.value,style:{width:s,minWidth:s,maxWidth:s}},i.value):void 0,e("span",{class:"item__label "+(this.showOptionValue?"item__label--bold":""),title:i.label},i.label))}scrollToOption(i){if(!(null==i?void 0:i.value)||!this._optionsList)return;const t=this.visibleOptions.indexOf(i);if(-1===t)return;const e=this._optionsList.querySelector(`li#item_${CSS.escape(i.value)}_${CSS.escape(String(t))}`);e&&e.scrollIntoView({behavior:"smooth",block:"nearest"})}async componentWillLoad(){this.i18n=await m()}componentDidLoad(){this._listWrapper.style.width=`${this.width}px`,this._listWrapper.style.maxWidth=this.maxWidth?`${this.maxWidth}px`:""}componentDidRender(){var i;null===(i=this._optionsList)||void 0===i||i.querySelectorAll(".item").forEach((i=>{o.addIDInfoIfNotExists(i,"itemComboBox")}))}render(){return e("section",{class:"list-container"},e("div",{class:"list-wrapper",ref:i=>this._listWrapper=i},e("ul",{class:"list-options",ref:i=>this._optionsList=i},!this.showLoading&&0===this.visibleOptions.length&&e("div",{class:"message"},e("span",{class:"message__no-result"},this.textEmptyList||this.i18n("ez-combo-box.noResults"))),this.showLoading&&e("div",{class:"message"},e("div",{class:"message__loading"})),this.showOptionValue&&e("span",{class:"item__value item__value--hidden"}),!this.showLoading&&this.visibleOptions.length>0&&this.visibleOptions.map(((i,t)=>this.buildItem(i,t))))))}static get watchers(){return{width:["observeWidth"],maxWidth:["observeMaxWidth"]}}};z.style=":host{--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--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__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--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);--ez-combo-box__list-container--padding:var(--space--extra-small, 3px)}.list-container{padding-top:var(--ez-combo-box__list-container--padding)}.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--medium, 0 8px 24px 0 rgba(43, 58, 84, 0.10));padding:var(--ez-combo-box--space--small)}.list-options{box-sizing:border-box;width:100%;height:100%;padding:0;margin: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)}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";const f=class{constructor(t){i(this,t),this.gui=void 0,this.customEditor=void 0,this.formViewField=void 0,this.value=void 0,this.detailContext=void 0,this.builderFallback=void 0,this.selectedRecord=void 0}async setFocus(){var i,t;null===(t=null===(i=this.gui)||void 0===i?void 0:i.setFocus)||void 0===t||t.call(i)}async setBlur(){var i,t;null===(t=null===(i=this.gui)||void 0===i?void 0:i.setBlur)||void 0===t||t.call(i)}async isInvalid(){var i,t;return(null===(t=null===(i=this.gui)||void 0===i?void 0:i.isInvalid)||void 0===t?void 0:t.call(i))||!1}watchValue(){this.handleValue(this.gui)}watchCustomEditor(){this.getContent()}watchFormViewField(i,t){l.equals(i,t)||this.getContent()}watchDetailContext(){this.getContent()}watchBuilderFallback(){this.getContent()}watchSelectedRecord(i,t){(null==i?void 0:i.__record__id__)!==(null==t?void 0:t.__record__id__)&&this.getContent()}getContent(){var i,t,s,a,o;const l=new Map;for(const i in this.formViewField.props)l.set(i,this.formViewField.props[i]);const n={value:this.value,name:this.formViewField.name,currentEditor:this.builderFallback(this.formViewField),setValue:i=>this.setValue(i),getValue:this.getValue,record:this.selectedRecord,editorMetadata:{label:this.formViewField.label,hidden:!1===(null===(i=this.formViewField.props)||void 0===i?void 0:i.visible),userInterface:this.formViewField.userInterface,options:null===(t=this.formViewField.props)||void 0===t?void 0:t.options,props:this.formViewField.props?l:void 0,optionLoader:this.formViewField.optionLoader},source:b.FORM,detailContext:this.detailContext};let h=this.customEditor.getEditorElement(n);if(!h)return h=this.builderFallback(this.formViewField),this.handleValue(h),void(this.gui=h);if(!(h instanceof HTMLElement)&&"string"!=typeof h)return this.handleValue(h),void(this.gui=h);"string"==typeof h&&(h=c.parseElement(h));const d=null!==(o=null!==(a=null===(s=this.value)||void 0===s?void 0:s.value)&&void 0!==a?a:this.value)&&void 0!==o?o:"";h.setAttribute("value",d),this.gui=e("div",{key:r.generateUUID(),ref:i=>i&&i.appendChild(h)})}setValue(i){this.value=i}getValue(){return this.value}handleValue(i){var t;null===(t=i.i)||void 0===t||t.forEach((i=>{i.t.value=this.value}))}componentWillLoad(){this.getContent()}render(){return e(s,null,this.gui)}static get watchers(){return{value:["watchValue"],customEditor:["watchCustomEditor"],formViewField:["watchFormViewField"],detailContext:["watchDetailContext"],builderFallback:["watchBuilderFallback"],selectedRecord:["watchSelectedRecord"]}}},w=class{constructor(e){i(this,e),this.ezChange=t(this,"ezChange",7),this.ezError=t(this,"ezError",7),this.handleFileSelect=i=>{const t=i.target;t.files&&t.files[0]&&this.processFile(t.files[0])},this.handleDrop=i=>{var t;if(i.preventDefault(),i.stopPropagation(),this._isDragging=!1,!this.enabled)return;const e=null===(t=i.dataTransfer)||void 0===t?void 0:t.files;e&&e[0]&&this.processFile(e[0])},this.handleDragOver=i=>{i.preventDefault(),i.stopPropagation(),this.enabled&&(this._isDragging=!0)},this.handleDragLeave=i=>{i.preventDefault(),i.stopPropagation(),this._isDragging=!1},this.handleRemoveImage=i=>{i.stopPropagation(),this.value=void 0,this._hasImage=!1,this._inputElem&&(this._inputElem.value=""),this.ezChange.emit("")},this.handleClickDropZone=()=>{var i;this.enabled&&!this._hasImage&&(null===(i=this._inputElem)||void 0===i||i.click())},this.handleImageClick=i=>{i.stopPropagation(),this._hasImage&&this.value&&(this._showImagePopup=!0)},this.handlePopupAction=i=>{const t=i.detail;"CANCEL"!==t&&"OK"!==t||this.handleClosePopup()},this.handleClosePopup=()=>{this._showImagePopup=!1},this.enabled=!0,this.label=void 0,this.name=void 0,this.value=void 0,this.maxFileSize=20971520,this.accept="image/*",this.loading=!1,this._hasImage=!1,this._isDragging=!1,this._showImagePopup=!1}onValueChange(i,t){i!==t&&(this._hasImage=!!i),!i&&this._inputElem&&(this._inputElem.value="")}addInfoId(){this._element&&o.addIDInfo(this._element),this._inputElem&&o.addIDInfo(this._inputElem,"image-input",{id:"embedded"})}processFile(i){if(!i.type.startsWith("image/")){const i=this.i18n("ez-image-input.invalidFileType");return void this.ezError.emit(i)}if(this.maxFileSize&&i.size>this.maxFileSize){const i=(this.maxFileSize/1048576).toFixed(2),t=this.i18n("ez-image-input.fileTooLarge",{maxSize:`${i}MB`});return void this.ezError.emit(t)}const t=new FileReader;t.onload=i=>{var t;const e=null===(t=i.target)||void 0===t?void 0:t.result;this.value=e,this._hasImage=!0,this.ezChange.emit(e)},t.readAsDataURL(i)}async componentWillLoad(){this.i18n=await m(),this._hasImage=!!this.value}componentDidLoad(){this.addInfoId()}render(){if(this.loading)return e(s,null,e("ez-skeleton",{width:"280px",height:"200px"}));const i=this.label||this.i18n("ez-image-input.defaultLabel");return e(s,null,e("div",{class:{"image-input__container":!0,"image-input__container--disabled":!this.enabled,"image-input__container--dragging":this._isDragging,"image-input__container--has-image":this._hasImage},"data-enabled":this.enabled.toString(),"data-has-image":this._hasImage.toString(),onClick:this.handleClickDropZone,onDrop:this.handleDrop,onDragOver:this.handleDragOver,onDragLeave:this.handleDragLeave,role:"button","aria-label":i,tabindex:this.enabled?0:-1},e("input",{ref:i=>this._inputElem=i,type:"file",accept:this.accept,name:this.name,disabled:!this.enabled,onChange:this.handleFileSelect,class:"image-input__file-input","aria-hidden":"true"}),this._hasImage&&this.value?e("div",{class:"image-input__preview"},e("img",{src:this.value,alt:this.i18n("ez-image-input.imageAlt"),class:"image-input__image",onClick:this.handleImageClick}),this.enabled&&e("ez-button",{class:"image-input__remove-button",variant:"primary",type:"button",mode:"icon",size:"small",iconName:"trash-alt",onClick:this.handleRemoveImage,"aria-label":this.i18n("ez-image-input.removeImage"),title:this.i18n("ez-image-input.removeImage")})):e("div",{class:"image-input__dropzone"},e("ez-icon",{iconName:"image",size:"x-large"}),e("span",{class:"image-input__label"},i))),e("ez-popup",{opened:this._showImagePopup,ezTitle:this.i18n("ez-image-input.imagePreview"),size:"large",heightMode:"auto",onEzPopupAction:this.handlePopupAction,onEzClosePopup:this.handleClosePopup},e("div",{class:"image-input__popup-content"},e("img",{src:this.value,alt:this.i18n("ez-image-input.imageAlt"),class:"image-input__popup-image"}))))}get _element(){return a(this)}static get watchers(){return{value:["onValueChange"]}}};w.style=":host{display:block;--ez-image-input--container-height:200px;--ez-image-input--container-width:280px;--ez-image-input--background-color:var(--color--gray-80);--ez-image-input--border-color:var(--color--gray-200);--ez-image-input--border-color-hover:var(--color--ocean-green-600);--ez-image-input--border-color-dragging:var(--color--ocean-green-500);--ez-image-input--border-color-disabled:var(--color--gray-200);--ez-image-input--label-color:var(--color--petroleum-900);--ez-image-input--icon-color:var(--color--gray-400);--ez-image-input--border-radius:var(--border--radius-24);--ez-image-input--border-width:2px;--ez-image-input--remove-button-bg:var(--color--red-600);--ez-image-input--remove-button-bg-hover:var(--color--red-700);--ez-image-input--remove-button-color:var(--color--gray-70);--ez-image-input--remove-button-border:1px solid var(--color--red-700)}.image-input__container{display:flex;align-items:center;justify-content:center;position:relative;height:var(--ez-image-input--container-height);width:var(--ez-image-input--container-width);border:var(--ez-image-input--border-width) dashed var(--ez-image-input--border-color);border-radius:var(--ez-image-input--border-radius);background-color:var(--ez-image-input--background-color);cursor:pointer;transition:all 0.3s ease;overflow:hidden}.image-input__container:hover:not(.image-input__container--disabled){border-color:var(--ez-image-input--border-color-hover)}.image-input__container--dragging{border-color:var(--ez-image-input--border-color-dragging);background-color:var(--color--ocean-green-90)}.image-input__container--disabled{cursor:not-allowed;opacity:0.6;border-color:var(--ez-image-input--border-color-disabled)}.image-input__container--has-image{border-style:solid;padding:var(--space--0)}.image-input__file-input{display:none}.image-input__dropzone{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--space--16);padding:var(--space--24);text-align:center}.image-input__dropzone ez-icon{color:var(--ez-image-input--icon-color)}.image-input__label{font-family:var(--font--pattern);font-size:var(--font-size--default);font-weight:var(--font-weight--medium);color:var(--ez-image-input--label-color);line-height:var(--line-height--20)}.image-input__preview{position:relative;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.image-input__image{height:100%;object-fit:cover;border-radius:calc(var(--ez-image-input--border-radius) - var(--ez-image-input--border-width))}ez-button{--ez-button--background-color:var(--ez-image-input--remove-button-bg);--ez-button--hover--background-color:var(--ez-image-input--remove-button-bg-hover);--ez-button--color:var(--ez-image-input--remove-button-color);--ez-button--border:var(--ez-image-input--remove-button-border);--ez-button--hover--border:var(--ez-image-input--remove-button-border)}.image-input__remove-button{position:absolute;top:var(--space--8);right:var(--space--8);display:flex;align-items:center;justify-content:center}.image-input__popup-content{display:flex;align-items:center;justify-content:center;padding:var(--space--16);height:100%}.image-input__popup-image{max-width:100%;max-height:70vh;object-fit:contain;border-radius:var(--border--radius-8)}.image-input__image{height:100%;object-fit:cover;border-radius:calc(var(--ez-image-input--border-radius) - var(--ez-image-input--border-width));cursor:pointer;transition:transform 0.2s ease}.image-input__image:hover{transform:scale(1.02)}ez-skeleton{--skeleton-width:var(--ez-image-input--container-width);--skeleton-height:var(--ez-image-input--container-height)}";const y=class{constructor(e){i(this,e),this.ezChange=t(this,"ezChange",7),this.historyStack=[],this.historyIndex=-1,this.previewMode=!1,this.showPreview=!0,this.value=void 0,this.label=void 0,this.mode="regular",this.enabled=!0,this.rows=6,this.errorMessage=void 0,this.canShowError=!0,this.showConfigs=!0,this.showTextFormat=!0,this.showUndoRedo=!0}observeValue(i,t){l.equals(i,t)||this.ezChange.emit(i)}observeErrorMessage(i){i&&this.previewMode&&(this.previewMode=!1)}async handleExecuteToolbarCommand(i){const{command:t,value:e}=i.detail;await this.executeCommand(t,e)}async setFocus(){this.handleFocus()}async setBlur(){var i;await(null===(i=this.textAreaRef)||void 0===i?void 0:i.setBlur())}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}bindPreview(){this._keyboardManager&&this.showPreview&&this._keyboardManager.bind("ctrl + p",(async()=>{await this.togglePreview()}),{description:"Entra em modo de pré visualização.",element:this.element})}bindConfigs(){this._keyboardManager&&this.showConfigs&&this._keyboardManager.bind("ctrl + l",(async()=>{await this.handleFormatSelection(u.LIST)}),{description:this.i18n("ez-rich-text.listShortcut"),element:this.element}).bind("ctrl + k",(async()=>{await this.handleLink()}),{description:this.i18n("ez-rich-text.linkShortcut"),element:this.element}).bind("ctrl + o",(async()=>{await this.handleImage()}),{description:this.i18n("ez-rich-text.imageShortcut"),element:this.element})}bindTextFormat(){this._keyboardManager&&this.showTextFormat&&this._keyboardManager.bind("ctrl + b",(async()=>{await this.handleFormatSelection(u.BOLD)}),{description:this.i18n("ez-rich-text.boldShortcut"),element:this.element}).bind("ctrl + i",(async()=>{await this.handleFormatSelection(u.ITALIC)}),{description:this.i18n("ez-rich-text.italicShortcut"),element:this.element}).bind("ctrl + u",(async()=>{await this.handleFormatSelection(u.UNDERLINE)}),{description:this.i18n("ez-rich-text.underlineShortcut"),element:this.element})}initKeyboardManager(){this._keyboardManager=new n({propagate:!1,element:this.element}),this._keyboardManager.bind("ctrl + Enter",(async()=>{await this.handleFormatSelection(u.BREAK_LINE)}),{description:this.i18n("ez-rich-text.breakLineShortcut"),element:this.element}).bind("ctrl + z",(async()=>{await this.handleUndo()}),{description:this.i18n("ez-rich-text.undoShortcut"),element:this.element}).bind("ctrl + x",(async()=>{await this.handleRedo()}),{description:this.i18n("ez-rich-text.redoShortcut"),element:this.element}),this.bindPreview(),this.bindConfigs(),this.bindTextFormat()}async executeCommand(i,t){switch(i){case p.FOCUS:this.handleFocus();break;case p.PREVIEW:await this.togglePreview();break;case p.FORMAT:await this.handleFormatSelection(t);break;case p.UNDO:await this.handleUndo();break;case p.REDO:await this.handleRedo();break;case p.LINK:await this.handleLink();break;case p.IMAGE:await this.handleImage()}}handleFocus(){this.previewMode=!1,requestAnimationFrame((async()=>{await this.textAreaRef.setFocus()}))}async handleLink(){this.previewMode=!1,requestAnimationFrame((async()=>{await this.linkBuilderRef.show(this.getSelectedText())}))}async handleImage(){this.previewMode=!1,await this.imageUploaderRef.show()}async handleRedo(){this.previewMode=!1,requestAnimationFrame((async()=>{this.redo(),await this.textAreaRef.setFocus()}))}async handleUndo(){this.previewMode=!1,requestAnimationFrame((async()=>{this.undo(),await this.textAreaRef.setFocus()}))}async handleFormatSelection(i){i&&(this.previewMode=!1,requestAnimationFrame((async()=>{await this.formatSelection(i),await this.textAreaRef.setFocus()})))}async togglePreview(){this.previewMode=!this.previewMode,this.previewMode&&await this.textAreaRef.setFocus()}getSelectedText(){const i=this.getTextAreaElement();if(i)return(this.textAreaRef.value||"").substring(i.selectionStart,i.selectionEnd)}getTextAreaElement(){return this.element.querySelector("ez-text-area").shadowRoot.querySelector("textarea")}async formatSelection(i){if(!this.textAreaRef)return;const t=i.replace("$selection",this.getSelectedText()||"");await this.textAreaRef.appendTextToSelection(t),this.value=this.textAreaRef.value,this.addToHistory(this.value)}addToHistory(i){this.historyIndex>=0&&i===this.historyStack[this.historyIndex]||(this.historyStack.length>=50&&this.historyStack.splice(0,this.historyStack.length-49),this.historyStack.push(i),this.historyIndex=this.historyStack.length-1)}undo(){if(!this.canExecuteUndo())return;this.historyIndex--;const i=this.historyStack[this.historyIndex];this.value=i,this.textAreaRef.value=i}canExecuteUndo(){return this.historyIndex>0}redo(){this.canExecuteRedo()&&(this.historyIndex++,this.getValueFromHistory())}canExecuteRedo(){return this.historyIndex<this.historyStack.length-1}getValueFromHistory(){const i=this.historyStack[this.historyIndex];this.value=i,this.textAreaRef.value=i}handleTextAreaChanged(i){this.value=i.detail,this.addToHistory(this.value)}async removeShortcuts(){var i;null===(i=this._keyboardManager)||void 0===i||i.unbindAllShortcutKeys()}async componentWillLoad(){this.i18n=await m()}componentDidLoad(){this.initKeyboardManager(),this.addToHistory(this.value)}async disconnectedCallback(){await this.removeShortcuts()}getSanitizedValue(){return v.sanitize(this.value,{ADD_ATTR:["target","rel"]})}renderContent(){return this.previewMode?e("div",{id:"rich-text-preview-container",class:"preview",innerHTML:this.getSanitizedValue()}):e("ez-text-area",{ref:i=>this.textAreaRef=i,label:this.label,value:this.value,enabled:this.enabled,rows:this.rows,mode:this.mode,canShowError:this.canShowError,errorMessage:this.errorMessage,onEzChange:this.handleTextAreaChanged.bind(this)})}render(){return e(s,null,e("div",{class:"editor-container bordered"},e("ez-rich-toolbar",{isPreviewMode:this.previewMode,showPreview:this.showPreview,showConfigs:this.showConfigs&&this.enabled,showTextFormat:this.showTextFormat&&this.enabled,showUndoRedo:this.showUndoRedo&&this.enabled}),this.renderContent()),e("ez-link-builder",{ref:i=>this.linkBuilderRef=i}),e("ez-simple-image-uploader",{ref:i=>this.imageUploaderRef=i}))}get element(){return a(this)}static get watchers(){return{value:["observeValue"],errorMessage:["observeErrorMessage"]}}};y.style=".sc-ez-rich-text-h{display:block;width:100%;font-family:Roboto;--ez-rich-text--box-shadow:0 0 3px 0 #DCE0E8;--ez-rich-text--shadow--outline:var(--shadow--outline) var(--color--strokes)}.editor-container.sc-ez-rich-text{width:100%;overflow:hidden;border-radius:12px;border:1px solid #DCE0E8}ez-text-area.sc-ez-rich-text{--text-area__input--border:1px solid}.preview.sc-ez-rich-text{min-height:20px;padding:12px;resize:both;overflow:auto;max-width:100%;border-top:1px solid #DCE0E8}";const k=class{constructor(e){i(this,e),this.saveEdition=t(this,"saveEdition",7),this.cancelEdition=t(this,"cancelEdition",7),this._newValue=void 0,this.value=void 0,this.styled=void 0}async applyFocusSelect(){this.calcSizeInput(this.value,!0)}calcSizeInput(i,t=!1){var e,s;const a=null===(s=null===(e=this._inputElement)||void 0===e?void 0:e.shadowRoot)||void 0===s?void 0:s.querySelector("input");if(null!=a){const e=this.getWidthValue(i);a.style.width=e+"px",t&&setTimeout((()=>a.select()),100)}}getWidthValue(i){if(null!=this._valueBasis){const t=this._valueBasis;if(null!=i){const e=2;return t.innerHTML=i,t.clientWidth>0?t.clientWidth+e:e}t.innerHTML=""}return 0}setStyledInput(){var i,t;let e="",s="",a="";null!=this.styled&&(e=this.styled.fontSize,s=this.styled.fontWeight,a=this.styled.fontFamily);const r=null===(t=null===(i=this._inputElement)||void 0===i?void 0:i.shadowRoot)||void 0===t?void 0:t.querySelector("input");null!=r&&(r.style.fontSize=e,r.style.fontWeight=s,r.style.fontFamily=a);const o=this._valueBasis;null!=o&&(o.style.fontSize=e,o.style.fontWeight=s,o.style.fontFamily=a)}handleSaveEdition(){this._newValue?this.saveEdition.emit({value:this.value,newValue:this._newValue}):g.alert(this.i18n("app.warning"),this.i18n("ez-text-edit.emptyFieldWarning")).then((()=>{this.setNewValue(this.value,!0)}))}handleCancelEdition(){this.cancelEdition.emit()}setNewValue(i,t=!1){this._newValue=i,this.calcSizeInput(this._newValue,t)}async componentWillLoad(){this.i18n=await m()}componentDidLoad(){this.applyFocusSelect(),this.setNewValue(this.value)}componentDidRender(){this.setStyledInput()}render(){return o.addIDInfoIfNotExists(this._element,"input"),e(s,null,e("span",{class:"text-edit__hidden-value",ref:i=>this._valueBasis=i}),e("ez-text-input",{"data-element-id":o.getInternalIDInfo("textInput"),onInput:()=>{this.calcSizeInput(this._newValue)},class:"text-edit__form-input",value:this._newValue,ref:i=>this._inputElement=i,mode:"slim",onEzChange:i=>this.setNewValue(null==i?void 0:i.detail),noBorder:!0}),e("ez-button",{class:"text-edit__icon-check",mode:"icon",iconName:"check",size:"small",onClick:()=>{this.handleSaveEdition()}}),e("ez-button",{class:"text-edit__icon-close",mode:"icon",iconName:"close",size:"small",onClick:()=>{this.handleCancelEdition()}}))}get _element(){return a(this)}};k.style=":host{display:flex;align-items:center;gap:5px}.text-edit__form-input{width:auto;--ez-text-input__input--padding:0px}.text-edit__hidden-value{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}";export{_ as classic_search_list,x as ez_classic_search_result_list,z as ez_combo_box_list,f as ez_custom_form_input,w as ez_image_input,y as ez_rich_text,k as ez_text_edit}
1
+ import{r as i,c as t,h as e,H as s,g as a}from"./p-23a36bb6.js";import{StringUtils as r,ElementIDUtils as o,ObjectUtils as l,HTMLBuilder as c,KeyboardManager as n}from"@sankhyalabs/core";import{a as h,r as d}from"./p-88a115b3.js";import{i as m}from"./p-b6579f86.js";import{C as b}from"./p-5895e687.js";import{R as u,a as p}from"./p-3e767a74.js";import{p as v}from"./p-dff9862b.js";import{A as g}from"./p-46b0b0c7.js";import"./p-ab574d59.js";import"./p-b853763b.js";import"./p-47e4a8ce.js";import"./p-112455b1.js";const _=class{constructor(e){i(this,e),this.changeValue=t(this,"changeValue",7),this.changePreSelection=t(this,"changePreSelection",7),this._startHighlightTag="<span class='card-item__highlight'>",this._endHighlightTag="</span>",this.MAX_HEIGHT=350,this.HEADER_MENU_HEIGHT=60,this.showLoading=void 0,this.visibleOptions=[],this.textEmptyList=void 0,this.canShowListOptions=void 0,this.value=void 0,this.showOptionValue=!0,this.preSelection=void 0}async nextOption(){const i=void 0===this.preSelection?0:Math.min(this.preSelection+1,this.visibleOptions.length-1);this.changePreSelection.emit(i),this.scrollToOption(this.visibleOptions[i])}async previousOption(){const i=void 0===this.preSelection?0:Math.max(this.preSelection-1,0);this.changePreSelection.emit(i),this.scrollToOption(this.visibleOptions[i])}selectOption(i){const t=Object.assign(Object.assign({},i),{value:h(null==i?void 0:i.value),label:h(null==i?void 0:i.label)}),e=Object.assign(Object.assign({},t),{value:d(null==t?void 0:t.value),label:d(null==t?void 0:t.label)});this.changeValue.emit(e)}createOption(i){let{key:t,title:e}=i;const s=new RegExp(this._startHighlightTag,"g"),a=new RegExp(this._endHighlightTag,"g");e=r.decodeHtmlEntities(e);const o={value:null==t?void 0:t.replace(s,"").replace(a,""),label:null==e?void 0:e.replace(s,"").replace(a,"")};this.selectOption(o)}scrollToOption(i){window.requestAnimationFrame((()=>{const t=(null==i?void 0:i.value)?this._optionsList.querySelector(`div#item_${i.value.replace(/([ #;&,.+*~':"!^$[\]()=<>|/\\])/g,"\\$1")}`):void 0;t&&t.scrollIntoView({behavior:"smooth",block:"nearest"})}))}buildItem(i,t){i.label=i.label||i.value;const s={key:i.value,title:i.label,details:i.details};return e("div",{style:{height:"100%"},class:t===this.preSelection?"item preselected":"item",id:`item_${i.value}`,onMouseDown:()=>this.createOption(s),onMouseOver:()=>this.changePreSelection.emit(t)},e("ez-card-item",{item:s,compacted:!0,enableKey:this.showOptionValue}))}componentDidLoad(){this._optionsList&&(this._optionsList.style.maxHeight=`${this.MAX_HEIGHT}px`)}componentDidUpdate(){if(this._optionsList){const i=this._optionsList.getBoundingClientRect();window.innerHeight-i.bottom<0&&this.adjustMaxHeight(i)}}adjustMaxHeight(i){if(this._optionsList){const t=Math.min(i.top-this.HEADER_MENU_HEIGHT,this.MAX_HEIGHT);this._optionsList.style.maxHeight=`${t}px`}}cleanEmptyObjectArray(i){return i.filter((i=>void 0!==(null==i?void 0:i.value)))}render(){return e(s,null,e("ul",{class:"list-options",ref:i=>this._optionsList=i},!this.showLoading&&0===this.cleanEmptyObjectArray(this.visibleOptions).length&&e("div",{class:"message"},e("span",{class:"message__no-result"},this.textEmptyList)),this.showLoading&&e("div",{class:"message"},e("div",{class:"message__loading"})),this.canShowListOptions&&this.visibleOptions.map(((i,t)=>this.buildItem(i,t)))))}};_.style=":host{--ez-classic-search__list-title--primary:var(--title--primary, #2B3A54);--ez-classic-search__list-text--primary:var(--text--primary, #626e82);--ez-classic-search__list-height:calc(var(--ez-classic-search--font-size) + var(--ez-classic-search--space--medium) + 4px);--ez-classic-search__list-min-width:64px;--ez-classic-search__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-classic-search__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-classic-search__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-classic-search__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-classic-search__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-classic-search__scrollbar--width:var(--space--small, 6px);--ez-classic-search--border-radius-small:var(--border--radius-small, 6px);--ez-classic-search--font-size:var(--text--medium, 14px);--ez-classic-search--font-family:var(--font-pattern, Arial);--ez-classic-search--font-weight--large:var(--text-weight--large, 500);--ez-classic-search--font-weight--medium:var(--text-weight--medium, 400);--ez-classic-search--background-medium:var(--background--medium, #f0f3f7);--ez-classic-search--line-height:calc(var(--text--medium, 14px) + 4px)}.list-options{position:relative;z-index:var(--more-visible, 2);margin:var(--space--small) 0px;padding:0px;padding-inline-start:0px;box-sizing:border-box;width:100%;height:100%;max-height:350px;min-width:150px;display:flex;flex-direction:column;scroll-behavior:smooth;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:var(--ez-classic-search__scrollbar--color-clicked) var(--ez-classic-search__scrollbar--color-background)}.list-options::-webkit-scrollbar{background-color:var(--scrollbar--background);width:var(--space--small);max-width:var(--space--small);min-width:var(--space--small);height:var(--space--small);max-height:var(--space--small);min-height:var(--space--small)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-classic-search__scrollbar--color-background);border-radius:var(--ez-classic-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-classic-search__scrollbar--color-default);border-radius:var(--ez-classic-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb:vertical:hover,.list-options::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-classic-search__scrollbar--color-hover)}.list-options::-webkit-scrollbar-thumb:vertical:active,.list-options::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-classic-search__scrollbar--color-clicked)}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;margin:var(--space--medium) 0px;min-height:var(--ez-classic-search__list-height)}.message__no-result{color:var(--ez-classic-search__list-title--primary);font-family:var(--ez-classic-search--font-family);font-size:var(--ez-classic-search--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-classic-search__list-title--primary);border-top:3px solid transparent}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-classic-search__list-title--primary);font-family:var(--ez-classic-search--font-family);font-size:var(--ez-classic-search--font-size);line-height:var(--ez-classic-search--line-height)}.item__label{font-weight:var(--ez-classic-search--font-weight--medium)}.item__label--bold{font-weight:var(--ez-classic-search--font-weight--large)}.item__value{text-align:center;color:var(--ez-classic-search__list-text--primary);font-weight:var(--ez-classic-search--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}.item__list>li:hover{background-color:var(--ez-classic-search--background-medium)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-classic-search--border-radius-small);gap:var(--space--small, 6px)}.preselected{background-color:var(--background--medium)}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@supports not (scrollbar-width: thin){.item{padding-right:8px}}";const x=class{constructor(e){i(this,e),this.changeValue=t(this,"changeValue",7),this._startHighlightTag="<span class='card-item__highlight'>",this._endHighlightTag="</span>",this.showLoading=void 0,this.visibleOptions=[],this.value=void 0,this.showOptionValue=!0,this._preSelection=void 0}observerVisivleOptions(i){i.length&&this.preSelectItemByIndex(0)}async nextOption(){const i=void 0===this._preSelection?0:Math.min(this._preSelection+1,this.visibleOptions.length-1);this.preSelectItemByIndex(i)}async previousOption(){const i=void 0===this._preSelection?0:Math.max(this._preSelection-1,0);this.preSelectItemByIndex(i)}preSelectItemByIndex(i){this._preSelection=i,this.scrollToOption(this.visibleOptions[i])}selectOption(i){const t=Object.assign(Object.assign({},i),{value:null==i?void 0:i.value,label:null==i?void 0:i.label}),e=Object.assign(Object.assign({},t),{value:this.removeHighLight(null==t?void 0:t.value),label:this.removeHighLight(null==t?void 0:t.label)});this.changeValue.emit(e)}removeHighLight(i){if(!i||"string"!=typeof i)return i;const t=new RegExp(this._startHighlightTag,"g"),e=new RegExp(this._endHighlightTag,"g");return i.replace(t,"").replace(e,"")}createAndSelectOption(i){let{key:t,title:e}=i;t=String(null!=t?t:""),e=r.decodeHtmlEntities(e);const s={value:this.removeHighLight(t),label:this.removeHighLight(e)};this.selectOption(s)}scrollToOption(i){(null==i?void 0:i.value)&&this._optionsList&&window.requestAnimationFrame((()=>{var t;const e=String(null!==(t=null==i?void 0:i.value)&&void 0!==t?t:""),s=e?this._optionsList.querySelector(`div#item_${e.replace(/([ #;&,.+*~':"!^$[\]()=<>|/\\])/g,"\\$1")}`):void 0;s&&s.scrollIntoView({behavior:"smooth",block:"nearest"})}))}buildItem(i,t){var s;i.label=i.label||i.value;const a={key:String(null!==(s=i.presentationValue)&&void 0!==s?s:""),title:i.presentationLabel,details:i.details};return e("div",{style:{height:"100%"},class:t===this._preSelection?"item preselected":"item",id:`item_${i.value}`,onMouseDown:()=>this.createAndSelectOption(a),onMouseOver:()=>{this._preSelection=t}},e("ez-card-item",{item:a,compacted:!0,enableKey:this.showOptionValue}))}async selectCurrentItem(){this.selectOption(this.visibleOptions[this._preSelection])}async cancelSelection(){this.cancelPreselection()}cancelPreselection(){this._preSelection=void 0}canShowListOptions(){return!this.showLoading&&this.visibleOptions.length>0}async componentWillLoad(){this.i18n=await m()}render(){return e(s,null,e("ul",{class:"list-options",ref:i=>this._optionsList=i},!this.showLoading&&0===this.visibleOptions.length&&e("div",{class:"message"},e("span",{class:"message__no-result"},this.i18n("ez-classic-search-plus.emptyList"))),this.showLoading&&e("div",{class:"loading__container"},e("ez-skeleton",{count:4,height:"20px"})),this.canShowListOptions()&&this.visibleOptions.map(((i,t)=>this.buildItem(i,t)))))}static get watchers(){return{visibleOptions:["observerVisivleOptions"]}}};x.style=":host{--ez-classic-search__list-title--primary:var(--title--primary, #2B3A54);--ez-classic-search__list-text--primary:var(--text--primary, #626e82);--ez-classic-search__list-height:calc(var(--ez-classic-search--font-size) + var(--ez-classic-search--space--medium) + 4px);--ez-classic-search__list-min-width:64px;--ez-classic-search__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-classic-search__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-classic-search__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-classic-search__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-classic-search__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-classic-search__scrollbar--width:var(--space--small, 6px);--ez-classic-search--border-radius-small:var(--border--radius-small, 6px);--ez-classic-search--font-size:var(--text--medium, 14px);--ez-classic-search--font-family:var(--font-pattern, Arial);--ez-classic-search--font-weight--large:var(--text-weight--large, 500);--ez-classic-search--font-weight--medium:var(--text-weight--medium, 400);--ez-classic-search--background-medium:var(--background--medium, #f0f3f7);--ez-classic-search--line-height:calc(var(--text--medium, 14px) + 4px)}.list-options{position:relative;z-index:var(--more-visible, 2);margin:var(--space--small) 0px;padding:0px;padding-inline-start:0px;box-sizing:border-box;width:100%;height:100%;max-height:350px;min-width:150px;display:flex;flex-direction:column;scroll-behavior:smooth;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:var(--ez-classic-search__scrollbar--color-clicked) var(--ez-classic-search__scrollbar--color-background)}.list-options::-webkit-scrollbar{background-color:var(--scrollbar--background);width:var(--space--small);max-width:var(--space--small);min-width:var(--space--small);height:var(--space--small);max-height:var(--space--small);min-height:var(--space--small)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-classic-search__scrollbar--color-background);border-radius:var(--ez-classic-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-classic-search__scrollbar--color-default);border-radius:var(--ez-classic-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb:vertical:hover,.list-options::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-classic-search__scrollbar--color-hover)}.list-options::-webkit-scrollbar-thumb:vertical:active,.list-options::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-classic-search__scrollbar--color-clicked)}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;margin:var(--space--medium) 0px;min-height:var(--ez-classic-search__list-height)}.message__no-result{color:var(--ez-classic-search__list-title--primary);font-family:var(--ez-classic-search--font-family);font-size:var(--ez-classic-search--font-size)}.loading__container{display:flex;flex-direction:column;margin:var(--space--small)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-classic-search__list-title--primary);font-family:var(--ez-classic-search--font-family);font-size:var(--ez-classic-search--font-size);line-height:var(--ez-classic-search--line-height)}.item__label{font-weight:var(--ez-classic-search--font-weight--medium)}.item__label--bold{font-weight:var(--ez-classic-search--font-weight--large)}.item__value{text-align:center;color:var(--ez-classic-search__list-text--primary);font-weight:var(--ez-classic-search--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}.item__list>li:hover{background-color:var(--ez-classic-search--background-medium)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-classic-search--border-radius-small);gap:var(--space--small, 6px)}.preselected{background-color:var(--background--medium)}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@supports not (scrollbar-width: thin){.item{padding-right:8px}}";const z=class{constructor(t){i(this,t),this.showLoading=void 0,this.visibleOptions=void 0,this.textEmptyList=void 0,this.showOptionValue=void 0,this.preSelection=void 0,this.maxWidth=void 0,this.width=void 0,this.onOptionSelect=void 0,this.onOptionHover=void 0}async nextOption(){var i,t;(null===(i=this.visibleOptions)||void 0===i?void 0:i.length)&&(void 0!==this.preSelection&&this.preSelection>=this.visibleOptions.length-1||(this.preSelection=void 0===this.preSelection?0:this.preSelection+1,this.scrollToOption(this.visibleOptions[this.preSelection]),null===(t=this.onOptionHover)||void 0===t||t.call(this,this.preSelection)))}async previousOption(){var i,t;(null===(i=this.visibleOptions)||void 0===i?void 0:i.length)&&(void 0!==this.preSelection&&this.preSelection<=0||(this.preSelection=void 0===this.preSelection?this.visibleOptions.length-1:this.preSelection-1,this.scrollToOption(this.visibleOptions[this.preSelection]),null===(t=this.onOptionHover)||void 0===t||t.call(this,this.preSelection)))}async selectCurrentOption(){void 0!==this.preSelection&&(this.onOptionSelect(this.visibleOptions[this.preSelection]),this.preSelection=void 0)}observeWidth(i,t){i!==t&&this._listWrapper&&(this._listWrapper.style.width=`${this.width}px`)}observeMaxWidth(i,t){i!==t&&this._listWrapper&&(this._listWrapper.style.maxWidth=this.maxWidth?`${this.maxWidth}px`:"")}handleKeyDown(i){switch(i.key){case"ArrowDown":i.preventDefault(),i.stopPropagation(),this.nextOption();break;case"ArrowUp":i.preventDefault(),i.stopPropagation(),this.previousOption();break;case"Enter":this.selectCurrentOption();break;case"Escape":this.preSelection=void 0}}buildItem(i,t){const s=this.showOptionValue&&this.maxWidth>0?`${this.maxWidth}px`:"";return i.label=i.label||i.value,e("li",{tabIndex:1,class:t===this.preSelection?"item preselected":"item",id:`item_${i.value}_${t}`,key:`item_${i.value}_${t}`,onMouseDown:()=>this.onOptionSelect(i),onMouseOver:()=>this.preSelection=t},this.showOptionValue?e("span",{class:"item__value",title:i.value,style:{width:s,minWidth:s,maxWidth:s}},i.value):void 0,e("span",{class:"item__label "+(this.showOptionValue?"item__label--bold":""),title:i.label},i.label))}scrollToOption(i){if(!(null==i?void 0:i.value)||!this._optionsList)return;const t=this.visibleOptions.indexOf(i);if(-1===t)return;const e=this._optionsList.querySelector(`li#item_${CSS.escape(i.value)}_${CSS.escape(String(t))}`);e&&e.scrollIntoView({behavior:"smooth",block:"nearest"})}async componentWillLoad(){this.i18n=await m()}componentDidLoad(){this._listWrapper.style.width=`${this.width}px`,this._listWrapper.style.maxWidth=this.maxWidth?`${this.maxWidth}px`:""}componentDidRender(){var i;null===(i=this._optionsList)||void 0===i||i.querySelectorAll(".item").forEach((i=>{o.addIDInfoIfNotExists(i,"itemComboBox")}))}render(){return e("section",{class:"list-container"},e("div",{class:"list-wrapper",ref:i=>this._listWrapper=i},e("ul",{class:"list-options",ref:i=>this._optionsList=i},!this.showLoading&&0===this.visibleOptions.length&&e("div",{class:"message"},e("span",{class:"message__no-result"},this.textEmptyList||this.i18n("ez-combo-box.noResults"))),this.showLoading&&e("div",{class:"message"},e("div",{class:"message__loading"})),this.showOptionValue&&e("span",{class:"item__value item__value--hidden"}),!this.showLoading&&this.visibleOptions.length>0&&this.visibleOptions.map(((i,t)=>this.buildItem(i,t))))))}static get watchers(){return{width:["observeWidth"],maxWidth:["observeMaxWidth"]}}};z.style=":host{--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--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__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--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);--ez-combo-box__list-container--padding:var(--space--extra-small, 3px)}.list-container{padding-top:var(--ez-combo-box__list-container--padding)}.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--medium, 0 8px 24px 0 rgba(43, 58, 84, 0.10));padding:var(--ez-combo-box--space--small)}.list-options{box-sizing:border-box;width:100%;height:100%;padding:0;margin: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)}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";const f=class{constructor(t){i(this,t),this.gui=void 0,this.customEditor=void 0,this.formViewField=void 0,this.value=void 0,this.detailContext=void 0,this.builderFallback=void 0,this.selectedRecord=void 0}async setFocus(){var i,t;null===(t=null===(i=this.gui)||void 0===i?void 0:i.setFocus)||void 0===t||t.call(i)}async setBlur(){var i,t;null===(t=null===(i=this.gui)||void 0===i?void 0:i.setBlur)||void 0===t||t.call(i)}async isInvalid(){var i,t;return(null===(t=null===(i=this.gui)||void 0===i?void 0:i.isInvalid)||void 0===t?void 0:t.call(i))||!1}watchValue(){this.handleValue(this.gui)}watchCustomEditor(){this.getContent()}watchFormViewField(i,t){l.equals(i,t)||this.getContent()}watchDetailContext(){this.getContent()}watchBuilderFallback(){this.getContent()}watchSelectedRecord(i,t){(null==i?void 0:i.__record__id__)!==(null==t?void 0:t.__record__id__)&&this.getContent()}getContent(){var i,t,s,a,o;const l=new Map;for(const i in this.formViewField.props)l.set(i,this.formViewField.props[i]);const n={value:this.value,name:this.formViewField.name,currentEditor:this.builderFallback(this.formViewField),setValue:i=>this.setValue(i),getValue:this.getValue,record:this.selectedRecord,editorMetadata:{label:this.formViewField.label,hidden:!1===(null===(i=this.formViewField.props)||void 0===i?void 0:i.visible),userInterface:this.formViewField.userInterface,options:null===(t=this.formViewField.props)||void 0===t?void 0:t.options,props:this.formViewField.props?l:void 0,optionLoader:this.formViewField.optionLoader},source:b.FORM,detailContext:this.detailContext};let h=this.customEditor.getEditorElement(n);if(!h)return h=this.builderFallback(this.formViewField),this.handleValue(h),void(this.gui=h);if(!(h instanceof HTMLElement)&&"string"!=typeof h)return this.handleValue(h),void(this.gui=h);"string"==typeof h&&(h=c.parseElement(h));const d=null!==(o=null!==(a=null===(s=this.value)||void 0===s?void 0:s.value)&&void 0!==a?a:this.value)&&void 0!==o?o:"";h.setAttribute("value",d),this.gui=e("div",{key:r.generateUUID(),ref:i=>i&&i.appendChild(h)})}setValue(i){this.value=i}getValue(){return this.value}handleValue(i){var t;null===(t=i.i)||void 0===t||t.forEach((i=>{i.t.value=this.value}))}componentWillLoad(){this.getContent()}render(){return e(s,null,this.gui)}static get watchers(){return{value:["watchValue"],customEditor:["watchCustomEditor"],formViewField:["watchFormViewField"],detailContext:["watchDetailContext"],builderFallback:["watchBuilderFallback"],selectedRecord:["watchSelectedRecord"]}}},w=class{constructor(e){i(this,e),this.ezChange=t(this,"ezChange",7),this.ezError=t(this,"ezError",7),this.handleFileSelect=i=>{const t=i.target;t.files&&t.files[0]&&this.processFile(t.files[0])},this.handleDrop=i=>{var t;if(i.preventDefault(),i.stopPropagation(),this._isDragging=!1,!this.enabled)return;const e=null===(t=i.dataTransfer)||void 0===t?void 0:t.files;e&&e[0]&&this.processFile(e[0])},this.handleDragOver=i=>{i.preventDefault(),i.stopPropagation(),this.enabled&&(this._isDragging=!0)},this.handleDragLeave=i=>{i.preventDefault(),i.stopPropagation(),this._isDragging=!1},this.handleRemoveImage=i=>{i.stopPropagation(),this.value=void 0,this._hasImage=!1,this._inputElem&&(this._inputElem.value=""),this.ezChange.emit("")},this.handleClickDropZone=()=>{var i;this.enabled&&!this._hasImage&&(null===(i=this._inputElem)||void 0===i||i.click())},this.handleImageClick=i=>{i.stopPropagation(),this._hasImage&&this.value&&(this._showImagePopup=!0)},this.handlePopupAction=i=>{const t=i.detail;"CANCEL"!==t&&"OK"!==t||this.handleClosePopup()},this.handleClosePopup=()=>{this._showImagePopup=!1},this.enabled=!0,this.label=void 0,this.name=void 0,this.value=void 0,this.maxFileSize=20971520,this.accept="image/*",this.loading=!1,this._hasImage=!1,this._isDragging=!1,this._showImagePopup=!1}onValueChange(i,t){i!==t&&(this._hasImage=!!i),!i&&this._inputElem&&(this._inputElem.value="")}addInfoId(){this._element&&o.addIDInfo(this._element),this._inputElem&&o.addIDInfo(this._inputElem,"image-input",{id:"embedded"})}processFile(i){if(!i.type.startsWith("image/")){const i=this.i18n("ez-image-input.invalidFileType");return void this.ezError.emit(i)}if(this.maxFileSize&&i.size>this.maxFileSize){const i=(this.maxFileSize/1048576).toFixed(2),t=this.i18n("ez-image-input.fileTooLarge",{maxSize:`${i}MB`});return void this.ezError.emit(t)}const t=new FileReader;t.onload=i=>{var t;const e=null===(t=i.target)||void 0===t?void 0:t.result;this.value=e,this._hasImage=!0,this.ezChange.emit(e)},t.readAsDataURL(i)}async componentWillLoad(){this.i18n=await m(),this._hasImage=!!this.value}componentDidLoad(){this.addInfoId()}render(){if(this.loading)return e(s,null,e("ez-skeleton",{width:"280px",height:"200px"}));const i=this.label||this.i18n("ez-image-input.defaultLabel");return e(s,null,e("div",{class:{"image-input__container":!0,"image-input__container--disabled":!this.enabled,"image-input__container--dragging":this._isDragging,"image-input__container--has-image":this._hasImage},"data-enabled":this.enabled.toString(),"data-has-image":this._hasImage.toString(),onClick:this.handleClickDropZone,onDrop:this.handleDrop,onDragOver:this.handleDragOver,onDragLeave:this.handleDragLeave,role:"button","aria-label":i,tabindex:this.enabled?0:-1},e("input",{ref:i=>this._inputElem=i,type:"file",accept:this.accept,name:this.name,disabled:!this.enabled,onChange:this.handleFileSelect,class:"image-input__file-input","aria-hidden":"true"}),this._hasImage&&this.value?e("div",{class:"image-input__preview"},e("img",{src:this.value,alt:this.i18n("ez-image-input.imageAlt"),class:"image-input__image",onClick:this.handleImageClick}),this.enabled&&e("ez-button",{class:"image-input__remove-button",variant:"primary",type:"button",mode:"icon",size:"small",iconName:"trash-alt",onClick:this.handleRemoveImage,"aria-label":this.i18n("ez-image-input.removeImage"),title:this.i18n("ez-image-input.removeImage")})):e("div",{class:"image-input__dropzone"},e("ez-icon",{iconName:"image",size:"x-large"}),e("span",{class:"image-input__label"},i))),e("ez-popup",{opened:this._showImagePopup,ezTitle:this.i18n("ez-image-input.imagePreview"),size:"large",heightMode:"auto",onEzPopupAction:this.handlePopupAction,onEzClosePopup:this.handleClosePopup},e("div",{class:"image-input__popup-content"},e("img",{src:this.value,alt:this.i18n("ez-image-input.imageAlt"),class:"image-input__popup-image"}))))}get _element(){return a(this)}static get watchers(){return{value:["onValueChange"]}}};w.style=":host{display:block;--ez-image-input--container-height:200px;--ez-image-input--container-width:280px;--ez-image-input--background-color:var(--color--gray-80);--ez-image-input--border-color:var(--color--gray-200);--ez-image-input--border-color-hover:var(--color--ocean-green-600);--ez-image-input--border-color-dragging:var(--color--ocean-green-500);--ez-image-input--border-color-disabled:var(--color--gray-200);--ez-image-input--label-color:var(--color--petroleum-900);--ez-image-input--icon-color:var(--color--gray-400);--ez-image-input--border-radius:var(--border--radius-24);--ez-image-input--border-width:2px;--ez-image-input--remove-button-bg:var(--color--red-600);--ez-image-input--remove-button-bg-hover:var(--color--red-700);--ez-image-input--remove-button-color:var(--color--gray-70);--ez-image-input--remove-button-border:1px solid var(--color--red-700)}.image-input__container{display:flex;align-items:center;justify-content:center;position:relative;height:var(--ez-image-input--container-height);width:var(--ez-image-input--container-width);border:var(--ez-image-input--border-width) dashed var(--ez-image-input--border-color);border-radius:var(--ez-image-input--border-radius);background-color:var(--ez-image-input--background-color);cursor:pointer;transition:all 0.3s ease;overflow:hidden}.image-input__container:hover:not(.image-input__container--disabled){border-color:var(--ez-image-input--border-color-hover)}.image-input__container--dragging{border-color:var(--ez-image-input--border-color-dragging);background-color:var(--color--ocean-green-90)}.image-input__container--disabled{cursor:not-allowed;opacity:0.6;border-color:var(--ez-image-input--border-color-disabled)}.image-input__container--has-image{border-style:solid;padding:var(--space--0)}.image-input__file-input{display:none}.image-input__dropzone{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--space--16);padding:var(--space--24);text-align:center}.image-input__dropzone ez-icon{color:var(--ez-image-input--icon-color)}.image-input__label{font-family:var(--font--pattern);font-size:var(--font-size--default);font-weight:var(--font-weight--medium);color:var(--ez-image-input--label-color);line-height:var(--line-height--20)}.image-input__preview{position:relative;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.image-input__image{height:100%;object-fit:cover;border-radius:calc(var(--ez-image-input--border-radius) - var(--ez-image-input--border-width))}ez-button{--ez-button--background-color:var(--ez-image-input--remove-button-bg);--ez-button--hover--background-color:var(--ez-image-input--remove-button-bg-hover);--ez-button--color:var(--ez-image-input--remove-button-color);--ez-button--border:var(--ez-image-input--remove-button-border);--ez-button--hover--border:var(--ez-image-input--remove-button-border)}.image-input__remove-button{position:absolute;top:var(--space--8);right:var(--space--8);display:flex;align-items:center;justify-content:center}.image-input__popup-content{display:flex;align-items:center;justify-content:center;padding:var(--space--16);height:100%}.image-input__popup-image{max-width:100%;max-height:70vh;object-fit:contain;border-radius:var(--border--radius-8)}.image-input__image{height:100%;object-fit:cover;border-radius:calc(var(--ez-image-input--border-radius) - var(--ez-image-input--border-width));cursor:pointer;transition:transform 0.2s ease}.image-input__image:hover{transform:scale(1.02)}ez-skeleton{--skeleton-width:var(--ez-image-input--container-width);--skeleton-height:var(--ez-image-input--container-height)}";const y=class{constructor(e){i(this,e),this.ezChange=t(this,"ezChange",7),this.historyStack=[],this.historyIndex=-1,this.previewMode=!1,this.showPreview=!0,this.value=void 0,this.label=void 0,this.mode="regular",this.enabled=!0,this.rows=6,this.errorMessage=void 0,this.canShowError=!0,this.showConfigs=!0,this.showTextFormat=!0,this.showUndoRedo=!0}observeValue(i,t){l.equals(i,t)||this.ezChange.emit(i)}observeErrorMessage(i){i&&this.previewMode&&(this.previewMode=!1)}async handleExecuteToolbarCommand(i){const{command:t,value:e}=i.detail;await this.executeCommand(t,e)}async setFocus(){this.handleFocus()}async setBlur(){var i;await(null===(i=this.textAreaRef)||void 0===i?void 0:i.setBlur())}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}bindPreview(){this._keyboardManager&&this.showPreview&&this._keyboardManager.bind("ctrl + p",(async()=>{await this.togglePreview()}),{description:"Entra em modo de pré visualização.",element:this.element})}bindConfigs(){this._keyboardManager&&this.showConfigs&&this._keyboardManager.bind("ctrl + l",(async()=>{await this.handleFormatSelection(u.LIST)}),{description:this.i18n("ez-rich-text.listShortcut"),element:this.element}).bind("ctrl + k",(async()=>{await this.handleLink()}),{description:this.i18n("ez-rich-text.linkShortcut"),element:this.element}).bind("ctrl + o",(async()=>{await this.handleImage()}),{description:this.i18n("ez-rich-text.imageShortcut"),element:this.element})}bindTextFormat(){this._keyboardManager&&this.showTextFormat&&this._keyboardManager.bind("ctrl + b",(async()=>{await this.handleFormatSelection(u.BOLD)}),{description:this.i18n("ez-rich-text.boldShortcut"),element:this.element}).bind("ctrl + i",(async()=>{await this.handleFormatSelection(u.ITALIC)}),{description:this.i18n("ez-rich-text.italicShortcut"),element:this.element}).bind("ctrl + u",(async()=>{await this.handleFormatSelection(u.UNDERLINE)}),{description:this.i18n("ez-rich-text.underlineShortcut"),element:this.element})}initKeyboardManager(){this._keyboardManager=new n({propagate:!1,element:this.element}),this._keyboardManager.bind("ctrl + Enter",(async()=>{await this.handleFormatSelection(u.BREAK_LINE)}),{description:this.i18n("ez-rich-text.breakLineShortcut"),element:this.element}).bind("ctrl + z",(async()=>{await this.handleUndo()}),{description:this.i18n("ez-rich-text.undoShortcut"),element:this.element}).bind("ctrl + x",(async()=>{await this.handleRedo()}),{description:this.i18n("ez-rich-text.redoShortcut"),element:this.element}),this.bindPreview(),this.bindConfigs(),this.bindTextFormat()}async executeCommand(i,t){switch(i){case p.FOCUS:this.handleFocus();break;case p.PREVIEW:await this.togglePreview();break;case p.FORMAT:await this.handleFormatSelection(t);break;case p.UNDO:await this.handleUndo();break;case p.REDO:await this.handleRedo();break;case p.LINK:await this.handleLink();break;case p.IMAGE:await this.handleImage()}}handleFocus(){this.previewMode=!1,requestAnimationFrame((async()=>{await this.textAreaRef.setFocus()}))}async handleLink(){this.previewMode=!1,requestAnimationFrame((async()=>{await this.linkBuilderRef.show(this.getSelectedText())}))}async handleImage(){this.previewMode=!1,await this.imageUploaderRef.show()}async handleRedo(){this.previewMode=!1,requestAnimationFrame((async()=>{this.redo(),await this.textAreaRef.setFocus()}))}async handleUndo(){this.previewMode=!1,requestAnimationFrame((async()=>{this.undo(),await this.textAreaRef.setFocus()}))}async handleFormatSelection(i){i&&(this.previewMode=!1,requestAnimationFrame((async()=>{await this.formatSelection(i),await this.textAreaRef.setFocus()})))}async togglePreview(){this.previewMode=!this.previewMode,this.previewMode&&await this.textAreaRef.setFocus()}getSelectedText(){const i=this.getTextAreaElement();if(i)return(this.textAreaRef.value||"").substring(i.selectionStart,i.selectionEnd)}getTextAreaElement(){return this.element.querySelector("ez-text-area").shadowRoot.querySelector("textarea")}async formatSelection(i){if(!this.textAreaRef)return;const t=i.replace("$selection",this.getSelectedText()||"");await this.textAreaRef.appendTextToSelection(t),this.value=this.textAreaRef.value,this.addToHistory(this.value)}addToHistory(i){this.historyIndex>=0&&i===this.historyStack[this.historyIndex]||(this.historyStack.length>=50&&this.historyStack.splice(0,this.historyStack.length-49),this.historyStack.push(i),this.historyIndex=this.historyStack.length-1)}undo(){if(!this.canExecuteUndo())return;this.historyIndex--;const i=this.historyStack[this.historyIndex];this.value=i,this.textAreaRef.value=i}canExecuteUndo(){return this.historyIndex>0}redo(){this.canExecuteRedo()&&(this.historyIndex++,this.getValueFromHistory())}canExecuteRedo(){return this.historyIndex<this.historyStack.length-1}getValueFromHistory(){const i=this.historyStack[this.historyIndex];this.value=i,this.textAreaRef.value=i}handleTextAreaChanged(i){this.value=i.detail,this.addToHistory(this.value)}async removeShortcuts(){var i;null===(i=this._keyboardManager)||void 0===i||i.unbindAllShortcutKeys()}async componentWillLoad(){this.i18n=await m()}componentDidLoad(){this.initKeyboardManager(),this.addToHistory(this.value)}async disconnectedCallback(){await this.removeShortcuts()}getSanitizedValue(){return v.sanitize(this.value,{ADD_ATTR:["target","rel"]})}renderContent(){return this.previewMode?e("div",{id:"rich-text-preview-container",class:"preview",innerHTML:this.getSanitizedValue()}):e("ez-text-area",{ref:i=>this.textAreaRef=i,label:this.label,value:this.value,enabled:this.enabled,rows:this.rows,mode:this.mode,canShowError:this.canShowError,errorMessage:this.errorMessage,onEzChange:this.handleTextAreaChanged.bind(this)})}render(){return e(s,null,e("div",{class:"editor-container bordered"},e("ez-rich-toolbar",{isPreviewMode:this.previewMode,showPreview:this.showPreview,showConfigs:this.showConfigs&&this.enabled,showTextFormat:this.showTextFormat&&this.enabled,showUndoRedo:this.showUndoRedo&&this.enabled}),this.renderContent()),e("ez-link-builder",{ref:i=>this.linkBuilderRef=i}),e("ez-simple-image-uploader",{ref:i=>this.imageUploaderRef=i}))}get element(){return a(this)}static get watchers(){return{value:["observeValue"],errorMessage:["observeErrorMessage"]}}};y.style=".sc-ez-rich-text-h{display:block;width:100%;font-family:Roboto;--ez-rich-text--box-shadow:0 0 3px 0 #DCE0E8;--ez-rich-text--shadow--outline:var(--shadow--outline) var(--color--strokes)}.editor-container.sc-ez-rich-text{width:100%;overflow:hidden;border-radius:12px;border:1px solid #DCE0E8}ez-text-area.sc-ez-rich-text{--text-area__input--border:1px solid}.preview.sc-ez-rich-text{min-height:20px;padding:12px;resize:both;overflow:auto;max-width:100%;border-top:1px solid #DCE0E8}";const k=class{constructor(e){i(this,e),this.saveEdition=t(this,"saveEdition",7),this.cancelEdition=t(this,"cancelEdition",7),this._newValue=void 0,this.value=void 0,this.styled=void 0}async applyFocusSelect(){this.calcSizeInput(this.value,!0)}calcSizeInput(i,t=!1){var e,s;const a=null===(s=null===(e=this._inputElement)||void 0===e?void 0:e.shadowRoot)||void 0===s?void 0:s.querySelector("input");if(null!=a){const e=this.getWidthValue(i);a.style.width=e+"px",t&&setTimeout((()=>a.select()),100)}}getWidthValue(i){if(null!=this._valueBasis){const t=this._valueBasis;if(null!=i){const e=2;return t.innerHTML=i,t.clientWidth>0?t.clientWidth+e:e}t.innerHTML=""}return 0}setStyledInput(){var i,t;let e="",s="",a="";null!=this.styled&&(e=this.styled.fontSize,s=this.styled.fontWeight,a=this.styled.fontFamily);const r=null===(t=null===(i=this._inputElement)||void 0===i?void 0:i.shadowRoot)||void 0===t?void 0:t.querySelector("input");null!=r&&(r.style.fontSize=e,r.style.fontWeight=s,r.style.fontFamily=a);const o=this._valueBasis;null!=o&&(o.style.fontSize=e,o.style.fontWeight=s,o.style.fontFamily=a)}handleSaveEdition(){this._newValue?this.saveEdition.emit({value:this.value,newValue:this._newValue}):g.alert(this.i18n("app.warning"),this.i18n("ez-text-edit.emptyFieldWarning")).then((()=>{this.setNewValue(this.value,!0)}))}handleCancelEdition(){this.cancelEdition.emit()}setNewValue(i,t=!1){this._newValue=i,this.calcSizeInput(this._newValue,t)}async componentWillLoad(){this.i18n=await m()}componentDidLoad(){this.applyFocusSelect(),this.setNewValue(this.value)}componentDidRender(){this.setStyledInput()}render(){return o.addIDInfoIfNotExists(this._element,"input"),e(s,null,e("span",{class:"text-edit__hidden-value",ref:i=>this._valueBasis=i}),e("ez-text-input",{"data-element-id":o.getInternalIDInfo("textInput"),onInput:()=>{this.calcSizeInput(this._newValue)},class:"text-edit__form-input",value:this._newValue,ref:i=>this._inputElement=i,mode:"slim",onEzChange:i=>this.setNewValue(null==i?void 0:i.detail),noBorder:!0}),e("ez-button",{class:"text-edit__icon-check",mode:"icon",iconName:"check",size:"small",onClick:()=>{this.handleSaveEdition()}}),e("ez-button",{class:"text-edit__icon-close",mode:"icon",iconName:"close",size:"small",onClick:()=>{this.handleCancelEdition()}}))}get _element(){return a(this)}};k.style=":host{display:flex;align-items:center;gap:5px}.text-edit__form-input{width:auto;--ez-text-input__input--padding:0px}.text-edit__hidden-value{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}";export{_ as classic_search_list,x as ez_classic_search_result_list,z as ez_combo_box_list,f as ez_custom_form_input,w as ez_image_input,y as ez_rich_text,k as ez_text_edit}
@@ -1 +1 @@
1
- import{r as t,c as e,h as i,H as s}from"./p-23a36bb6.js";import{ObjectUtils as o}from"@sankhyalabs/core";import{i as l}from"./p-80dfc50b.js";import{i as n}from"./p-69344c23.js";function h(t,e,i){if(!t.length)return[...e];if(!e.length)return[];const s=function(t,e){return t.map((t=>e.findIndex((e=>e.id===t))))}(t,e),o=0===(l=s).length?0:l.reduce(((t,e)=>e<t?e:t),l[0]);var l;const n=function(t){return 0===t.length?0:t.reduce(((t,e)=>e>t?e:t),t[0])}(s);return function(t,e,i,s){return t<0||e>=s.length||t>e?s:i?function(t,e,i){if(t===i.length-1)return i;const s=i.slice(0,e),o=i.slice(e,t+1),l=i.slice(t+1),n=l.shift();return n?[...s,n,...o,...l]:i}(e,t,s):function(t,e,i){if(0===t)return i;const s=i.slice(0,t-1),o=i.slice(t,e+1),l=i.slice(e+1);return[...s,...o,i[t-1],...l]}(t,e,s)}(o,n,i,e)}function r({from:t,to:e,selectedFrom:i,selectedTo:s}){return e=[...e.map((t=>d(t,!1))),...t.map((t=>d(t,!0)))],i=[],s=[...t.map((({id:t})=>t))],{from:t=[],to:e,selectedFrom:i,selectedTo:s}}function a({from:t,to:e,selectedFrom:i,selectedTo:s,insertIndex:o=e.length}){if(!t.length)return{from:t,to:e,selectedFrom:i,selectedTo:s};const l=function(t,e,i){const s=t.map((t=>t.id)),o=e.filter((t=>!s.includes(t)));return i.filter((({id:t})=>o.includes(t)))}(e,i,t);if(!l.length)return{from:t,to:e,selectedFrom:i,selectedTo:s};let n=e.map((t=>d(t,!1)));return n.splice(o,0,...l.map((t=>d(t,!0)))),{from:t.filter((t=>!i.includes(t.id))),to:n,selectedFrom:[],selectedTo:[...i]}}function d(t,e){return Object.assign(Object.assign({},t),{selected:e})}const c=class{constructor(i){t(this,i),this.ezLeftListChanged=e(this,"ezLeftListChanged",7),this.ezRightListChanged=e(this,"ezRightListChanged",7),this.LEFT_LIST_ID="LEFT-LIST-ID",this.RIGHT_LIST_ID="RIGHT-LIST-ID",this.leftList=[],this.leftTitle=void 0,this.rightList=[],this.entityLabel="item",this.entityLabelPlural="itens",this.leftListLabel="disponíveis",this.rightListLabel="selecionados",this.useOnlyRightList=!1,this.rightTitle=void 0,this.emptyMessage=void 0,this.slotsListBuilder=void 0,this.leftFilteredList=[],this.rightFilteredList=[],this.selectedLeftList=[],this.selectedRightList=[],this.isFilteringLeft=!1,this.isFilteringRight=!1}async resetSelectedLists(){this.selectedLeftList=[],this.selectedRightList=[]}observeLeftList(t,e){o.equals(t,e)||this.ezLeftListChanged.emit(t)}observeRightList(t,e){o.equals(t,e)||this.ezRightListChanged.emit(t)}async componentWillLoad(){this.i18n=await n()}async handleChangeLeft({detail:t}){t.to.getAttribute("id")&&t.to.getAttribute("id")===this.RIGHT_LIST_ID?(t.selectItens=t.selectItens.filter((t=>this.rightList.every((e=>e.id!==t)))),this.leftList=[...t.dataSource],this.selectedLeftList=[...t.selectItens],this.transferToRight(null==t?void 0:t.newIndex)):this.leftList=[...this.reorderArray(t.dataSource,t.selectItens,t.newIndex)]}async handleChangeRight({detail:t}){t.to.getAttribute("id")&&t.to.getAttribute("id")===this.LEFT_LIST_ID?(t.selectItens=t.selectItens.filter((t=>this.leftList.every((e=>e.id!==t)))),this.rightList=[...t.dataSource],this.selectedRightList=[...t.selectItens],this.transferToLeft(null==t?void 0:t.newIndex)):this.rightList=[...this.reorderArray(t.dataSource,t.selectItens,t.newIndex)]}reorderArray(t,e,i){const s=t.filter((t=>!e.includes(t.id))),o=t.filter((t=>e.includes(t.id)));return s.splice(i,0,...o),s}enableTransferAllToRight(){return this.leftList.length>0}enableTransferAllToLeft(){return this.rightList.length>0}enableTransferToRight(){return this.selectedLeftList.length>0}enableTransferToLeft(){return this.selectedRightList.length>0}enableMoveUp(t){if(this.isFilteringRight)return!1;const e=this.getRightSelectedItemsIndex();return this.selectedRightList.length>0&&!e.includes(0)&&(!!t||l(e))}enableMoveDown(t){if(this.isFilteringRight)return!1;const e=this.getRightSelectedItemsIndex();return this.selectedRightList.length>0&&!e.includes(this.rightList.length-1)&&(!!t||l(e))}getRightSelectedItemsIndex(){return this.selectedRightList.map((t=>this.rightList.findIndex((e=>e.id===t))))}transferToRight(t){const{from:e,to:i,selectedFrom:s,selectedTo:o}=a(Object.assign(Object.assign({},this.buildTransferToRightConfig()),{insertIndex:null!=t?t:0}));this.leftList=[],requestAnimationFrame((()=>this.leftList=[...e])),this.rightList=[...i],this.selectedLeftList=[...s],this.selectedRightList=[...o]}transferToLeft(t){const{from:e,to:i,selectedFrom:s,selectedTo:o}=a(Object.assign(Object.assign({},this.buildTransferToLeftConfig()),{insertIndex:null!=t?t:0}));this.rightList=[],requestAnimationFrame((()=>this.rightList=[...e])),this.leftList=[...i],this.selectedRightList=[...s],this.selectedLeftList=[...o]}async handleTransferAllToRight(){const{from:t,to:e,selectedFrom:i,selectedTo:s}=r(this.buildTransferToRightConfig());this.leftList=[...t],this.rightList=[...e],this.selectedLeftList=[...i],this.selectedRightList=[...s],requestAnimationFrame((async()=>{await this.clearSelectionAll()}))}async handleTransferAllToLeft(){const{from:t,to:e,selectedFrom:i,selectedTo:s}=r(this.buildTransferToLeftConfig());this.rightList=[...t],this.leftList=[...e],this.selectedRightList=[...i],this.selectedLeftList=[...s],requestAnimationFrame((async()=>{await this.clearSelectionAll()}))}buildTransferToRightConfig(){return{from:this.leftList,to:this.rightList,selectedFrom:this.selectedLeftList,selectedTo:this.selectedRightList}}buildTransferToLeftConfig(){return{from:this.rightList,to:this.leftList,selectedFrom:this.selectedRightList,selectedTo:this.selectedLeftList}}handleMoveUp(){this.rightList=[...h(this.selectedRightList,this.rightList,!1)]}handleMoveDown(){this.rightList=[...h(this.selectedRightList,this.rightList,!0)]}handleMoveToTop(){const{itemsToKeep:t,itemsToMove:e}=this.getItemsToKeepAndToMove();this.rightList=[...e,...t]}handleMoveToBottom(){const{itemsToKeep:t,itemsToMove:e}=this.getItemsToKeepAndToMove();this.rightList=[...t,...e]}handleSelectLeftItem({detail:t}){this.selectedLeftList=[...t.map((({id:t})=>t))]}handleSelectRightItem({detail:t}){this.selectedRightList=[...t.map((({id:t})=>t))]}getItemsToKeepAndToMove(){return{itemsToKeep:this.rightList.filter((t=>!this.selectedRightList.includes(t.id))),itemsToMove:this.rightList.filter((t=>this.selectedRightList.includes(t.id)))}}async handleTransferToRight(){this.transferToRight(),this.leftFilteredList=[],await this.leftEzListInstance.clearSelection()}async handleTransferToLeft(){this.transferToLeft(),this.rightFilteredList=[],await this.rightEzListInstance.clearSelection()}async clearSelectionAll(){await this.rightEzListInstance.clearSelection(),await this.leftEzListInstance.clearSelection()}handleChooseLeft(){requestAnimationFrame((async()=>{await this.rightEzListInstance.clearSelection()}))}handleChooseRight(){this.useOnlyRightList||requestAnimationFrame((async()=>{await this.leftEzListInstance.clearSelection()}))}renderList(t){const{idSortableList:e,list:s,isFiltering:o,filteredList:l,emptyMessage:n,slotConfig:h,callbacks:r,title:a}=t;return i("ez-sortable-list",{ref:null==r?void 0:r.setRef,title:a,idSortableList:e,emptyMessage:n,class:"ez-size-height--full",dataSource:o?l:s,hoverFeedback:!0,enableMultipleSelection:!0,removeItensMoved:!0,entityLabel:this.entityLabel,entityLabelPlural:this.entityLabelPlural,itemRightSlotBuilder:null==h?void 0:h.itemRightSlotBuilder,itemLeftSlotBuilder:null==h?void 0:h.itemLeftSlotBuilder,onItemsReordered:null==r?void 0:r.onChange.bind(this),onEzSelectItens:null==r?void 0:r.onSelect.bind(this),onEzDoubleClick:null==r?void 0:r.onDoubleClick.bind(this),onEzChoose:null==r?void 0:r.onChoose.bind(this)})}render(){var t,e,o,l,n,h,r,a,d,c;return i(s,null,!this.useOnlyRightList&&i("div",{class:"list__container"},this.leftList&&this.renderList({idSortableList:this.LEFT_LIST_ID,list:this.leftList,title:this.leftTitle,isFiltering:this.isFilteringLeft,filteredList:this.leftFilteredList,emptyMessage:(null===(t=this.emptyMessage)||void 0===t?void 0:t.LEFT_LIST)?this.emptyMessage.LEFT_LIST:this.i18n("ez-double-list.noItemsAvailable",{entity:this.entityLabel}),slotConfig:{itemRightSlotBuilder:null===(o=null===(e=this.slotsListBuilder)||void 0===e?void 0:e.LEFT_LIST)||void 0===o?void 0:o.itemRightSlotBuilder,itemLeftSlotBuilder:null===(n=null===(l=this.slotsListBuilder)||void 0===l?void 0:l.LEFT_LIST)||void 0===n?void 0:n.itemLeftSlotBuilder},callbacks:{setRef:t=>this.leftEzListInstance=t,onChange:t=>this.handleChangeLeft(t),onSelect:this.handleSelectLeftItem.bind(this),onDoubleClick:this.handleTransferToRight.bind(this),onChoose:this.handleChooseLeft.bind(this)}})),!this.useOnlyRightList&&i("div",{class:"actions__column"},i("ez-button",{mode:"icon",iconName:"dual-chevron-right",enabled:this.enableTransferAllToRight(),title:this.i18n("ez-double-list.moveAllTo",{list:this.rightListLabel}),size:"small",onClick:this.handleTransferAllToRight.bind(this)}),i("ez-button",{mode:"icon",iconName:"chevron-right",enabled:this.enableTransferToRight(),title:this.i18n("ez-double-list.moveTo",{list:this.rightListLabel}),size:"small",onClick:this.handleTransferToRight.bind(this)}),i("ez-button",{mode:"icon",iconName:"chevron-left",enabled:this.enableTransferToLeft(),title:this.i18n("ez-double-list.moveTo",{list:this.leftListLabel}),size:"small",onClick:this.handleTransferToLeft.bind(this)}),i("ez-button",{mode:"icon",iconName:"dual-chevron-left",enabled:this.enableTransferAllToLeft(),title:this.i18n("ez-double-list.moveAllTo",{list:this.leftListLabel}),size:"small",onClick:this.handleTransferAllToLeft.bind(this)})),i("div",{class:"list__container"},this.rightList&&this.renderList({idSortableList:this.RIGHT_LIST_ID,list:this.rightList,title:this.rightTitle,isFiltering:this.isFilteringRight,filteredList:this.rightFilteredList,emptyMessage:(null===(h=this.emptyMessage)||void 0===h?void 0:h.RIGHT_LIST)?this.emptyMessage.RIGHT_LIST:this.i18n("ez-double-list.noItemsSelected",{entity:this.entityLabel}),slotConfig:{itemRightSlotBuilder:null===(a=null===(r=this.slotsListBuilder)||void 0===r?void 0:r.RIGHT_LIST)||void 0===a?void 0:a.itemRightSlotBuilder,itemLeftSlotBuilder:null===(c=null===(d=this.slotsListBuilder)||void 0===d?void 0:d.RIGHT_LIST)||void 0===c?void 0:c.itemLeftSlotBuilder},callbacks:{setRef:t=>this.rightEzListInstance=t,onChange:t=>this.handleChangeRight(t),onSelect:this.handleSelectRightItem.bind(this),onDoubleClick:this.handleTransferToLeft.bind(this),onChoose:this.handleChooseRight.bind(this)}})),i("div",{class:"actions__column"},i("ez-button",{mode:"icon",iconName:"dual-chevron-up",enabled:this.enableMoveUp(!0),title:this.i18n("ez-double-list.moveToFirstPosition"),size:"small",onClick:this.handleMoveToTop.bind(this)}),i("ez-button",{mode:"icon",iconName:"chevron-up",enabled:this.enableMoveUp(),title:this.i18n("ez-double-list.moveUp"),size:"small",onClick:this.handleMoveUp.bind(this)}),i("ez-button",{mode:"icon",iconName:"chevron-down",enabled:this.enableMoveDown(),title:this.i18n("ez-double-list.moveDown"),size:"small",onClick:this.handleMoveDown.bind(this)}),i("ez-button",{mode:"icon",iconName:"dual-chevron-down",enabled:this.enableMoveDown(!0),title:this.i18n("ez-double-list.moveToLastPosition"),size:"small",onClick:this.handleMoveToBottom.bind(this)})))}static get watchers(){return{leftList:["observeLeftList"],rightList:["observeRightList"]}}};c.style='.sc-ez-double-list-h{display:flex;flex-direction:row;gap:8px;align-items:center;font-family:var(--font-pattern, "Roboto");width:100%}@media screen and (max-width: 1366px){.group.sc-ez-double-list{height:350px}}.list__container.sc-ez-double-list{height:100%;width:100%;min-height:150px;overflow:auto;display:flex}.actions__column.sc-ez-double-list{display:flex;flex-direction:column;gap:4px}';export{c as ez_double_list}
1
+ import{r as t,c as e,h as i,H as s}from"./p-23a36bb6.js";import{ObjectUtils as o}from"@sankhyalabs/core";import{i as l}from"./p-80dfc50b.js";import{i as n}from"./p-b6579f86.js";function h(t,e,i){if(!t.length)return[...e];if(!e.length)return[];const s=function(t,e){return t.map((t=>e.findIndex((e=>e.id===t))))}(t,e),o=0===(l=s).length?0:l.reduce(((t,e)=>e<t?e:t),l[0]);var l;const n=function(t){return 0===t.length?0:t.reduce(((t,e)=>e>t?e:t),t[0])}(s);return function(t,e,i,s){return t<0||e>=s.length||t>e?s:i?function(t,e,i){if(t===i.length-1)return i;const s=i.slice(0,e),o=i.slice(e,t+1),l=i.slice(t+1),n=l.shift();return n?[...s,n,...o,...l]:i}(e,t,s):function(t,e,i){if(0===t)return i;const s=i.slice(0,t-1),o=i.slice(t,e+1),l=i.slice(e+1);return[...s,...o,i[t-1],...l]}(t,e,s)}(o,n,i,e)}function r({from:t,to:e,selectedFrom:i,selectedTo:s}){return e=[...e.map((t=>d(t,!1))),...t.map((t=>d(t,!0)))],i=[],s=[...t.map((({id:t})=>t))],{from:t=[],to:e,selectedFrom:i,selectedTo:s}}function a({from:t,to:e,selectedFrom:i,selectedTo:s,insertIndex:o=e.length}){if(!t.length)return{from:t,to:e,selectedFrom:i,selectedTo:s};const l=function(t,e,i){const s=t.map((t=>t.id)),o=e.filter((t=>!s.includes(t)));return i.filter((({id:t})=>o.includes(t)))}(e,i,t);if(!l.length)return{from:t,to:e,selectedFrom:i,selectedTo:s};let n=e.map((t=>d(t,!1)));return n.splice(o,0,...l.map((t=>d(t,!0)))),{from:t.filter((t=>!i.includes(t.id))),to:n,selectedFrom:[],selectedTo:[...i]}}function d(t,e){return Object.assign(Object.assign({},t),{selected:e})}const c=class{constructor(i){t(this,i),this.ezLeftListChanged=e(this,"ezLeftListChanged",7),this.ezRightListChanged=e(this,"ezRightListChanged",7),this.LEFT_LIST_ID="LEFT-LIST-ID",this.RIGHT_LIST_ID="RIGHT-LIST-ID",this.leftList=[],this.leftTitle=void 0,this.rightList=[],this.entityLabel="item",this.entityLabelPlural="itens",this.leftListLabel="disponíveis",this.rightListLabel="selecionados",this.useOnlyRightList=!1,this.rightTitle=void 0,this.emptyMessage=void 0,this.slotsListBuilder=void 0,this.leftFilteredList=[],this.rightFilteredList=[],this.selectedLeftList=[],this.selectedRightList=[],this.isFilteringLeft=!1,this.isFilteringRight=!1}async resetSelectedLists(){this.selectedLeftList=[],this.selectedRightList=[]}observeLeftList(t,e){o.equals(t,e)||this.ezLeftListChanged.emit(t)}observeRightList(t,e){o.equals(t,e)||this.ezRightListChanged.emit(t)}async componentWillLoad(){this.i18n=await n()}async handleChangeLeft({detail:t}){t.to.getAttribute("id")&&t.to.getAttribute("id")===this.RIGHT_LIST_ID?(t.selectItens=t.selectItens.filter((t=>this.rightList.every((e=>e.id!==t)))),this.leftList=[...t.dataSource],this.selectedLeftList=[...t.selectItens],this.transferToRight(null==t?void 0:t.newIndex)):this.leftList=[...this.reorderArray(t.dataSource,t.selectItens,t.newIndex)]}async handleChangeRight({detail:t}){t.to.getAttribute("id")&&t.to.getAttribute("id")===this.LEFT_LIST_ID?(t.selectItens=t.selectItens.filter((t=>this.leftList.every((e=>e.id!==t)))),this.rightList=[...t.dataSource],this.selectedRightList=[...t.selectItens],this.transferToLeft(null==t?void 0:t.newIndex)):this.rightList=[...this.reorderArray(t.dataSource,t.selectItens,t.newIndex)]}reorderArray(t,e,i){const s=t.filter((t=>!e.includes(t.id))),o=t.filter((t=>e.includes(t.id)));return s.splice(i,0,...o),s}enableTransferAllToRight(){return this.leftList.length>0}enableTransferAllToLeft(){return this.rightList.length>0}enableTransferToRight(){return this.selectedLeftList.length>0}enableTransferToLeft(){return this.selectedRightList.length>0}enableMoveUp(t){if(this.isFilteringRight)return!1;const e=this.getRightSelectedItemsIndex();return this.selectedRightList.length>0&&!e.includes(0)&&(!!t||l(e))}enableMoveDown(t){if(this.isFilteringRight)return!1;const e=this.getRightSelectedItemsIndex();return this.selectedRightList.length>0&&!e.includes(this.rightList.length-1)&&(!!t||l(e))}getRightSelectedItemsIndex(){return this.selectedRightList.map((t=>this.rightList.findIndex((e=>e.id===t))))}transferToRight(t){const{from:e,to:i,selectedFrom:s,selectedTo:o}=a(Object.assign(Object.assign({},this.buildTransferToRightConfig()),{insertIndex:null!=t?t:0}));this.leftList=[],requestAnimationFrame((()=>this.leftList=[...e])),this.rightList=[...i],this.selectedLeftList=[...s],this.selectedRightList=[...o]}transferToLeft(t){const{from:e,to:i,selectedFrom:s,selectedTo:o}=a(Object.assign(Object.assign({},this.buildTransferToLeftConfig()),{insertIndex:null!=t?t:0}));this.rightList=[],requestAnimationFrame((()=>this.rightList=[...e])),this.leftList=[...i],this.selectedRightList=[...s],this.selectedLeftList=[...o]}async handleTransferAllToRight(){const{from:t,to:e,selectedFrom:i,selectedTo:s}=r(this.buildTransferToRightConfig());this.leftList=[...t],this.rightList=[...e],this.selectedLeftList=[...i],this.selectedRightList=[...s],requestAnimationFrame((async()=>{await this.clearSelectionAll()}))}async handleTransferAllToLeft(){const{from:t,to:e,selectedFrom:i,selectedTo:s}=r(this.buildTransferToLeftConfig());this.rightList=[...t],this.leftList=[...e],this.selectedRightList=[...i],this.selectedLeftList=[...s],requestAnimationFrame((async()=>{await this.clearSelectionAll()}))}buildTransferToRightConfig(){return{from:this.leftList,to:this.rightList,selectedFrom:this.selectedLeftList,selectedTo:this.selectedRightList}}buildTransferToLeftConfig(){return{from:this.rightList,to:this.leftList,selectedFrom:this.selectedRightList,selectedTo:this.selectedLeftList}}handleMoveUp(){this.rightList=[...h(this.selectedRightList,this.rightList,!1)]}handleMoveDown(){this.rightList=[...h(this.selectedRightList,this.rightList,!0)]}handleMoveToTop(){const{itemsToKeep:t,itemsToMove:e}=this.getItemsToKeepAndToMove();this.rightList=[...e,...t]}handleMoveToBottom(){const{itemsToKeep:t,itemsToMove:e}=this.getItemsToKeepAndToMove();this.rightList=[...t,...e]}handleSelectLeftItem({detail:t}){this.selectedLeftList=[...t.map((({id:t})=>t))]}handleSelectRightItem({detail:t}){this.selectedRightList=[...t.map((({id:t})=>t))]}getItemsToKeepAndToMove(){return{itemsToKeep:this.rightList.filter((t=>!this.selectedRightList.includes(t.id))),itemsToMove:this.rightList.filter((t=>this.selectedRightList.includes(t.id)))}}async handleTransferToRight(){this.transferToRight(),this.leftFilteredList=[],await this.leftEzListInstance.clearSelection()}async handleTransferToLeft(){this.transferToLeft(),this.rightFilteredList=[],await this.rightEzListInstance.clearSelection()}async clearSelectionAll(){await this.rightEzListInstance.clearSelection(),await this.leftEzListInstance.clearSelection()}handleChooseLeft(){requestAnimationFrame((async()=>{await this.rightEzListInstance.clearSelection()}))}handleChooseRight(){this.useOnlyRightList||requestAnimationFrame((async()=>{await this.leftEzListInstance.clearSelection()}))}renderList(t){const{idSortableList:e,list:s,isFiltering:o,filteredList:l,emptyMessage:n,slotConfig:h,callbacks:r,title:a}=t;return i("ez-sortable-list",{ref:null==r?void 0:r.setRef,title:a,idSortableList:e,emptyMessage:n,class:"ez-size-height--full",dataSource:o?l:s,hoverFeedback:!0,enableMultipleSelection:!0,removeItensMoved:!0,entityLabel:this.entityLabel,entityLabelPlural:this.entityLabelPlural,itemRightSlotBuilder:null==h?void 0:h.itemRightSlotBuilder,itemLeftSlotBuilder:null==h?void 0:h.itemLeftSlotBuilder,onItemsReordered:null==r?void 0:r.onChange.bind(this),onEzSelectItens:null==r?void 0:r.onSelect.bind(this),onEzDoubleClick:null==r?void 0:r.onDoubleClick.bind(this),onEzChoose:null==r?void 0:r.onChoose.bind(this)})}render(){var t,e,o,l,n,h,r,a,d,c;return i(s,null,!this.useOnlyRightList&&i("div",{class:"list__container"},this.leftList&&this.renderList({idSortableList:this.LEFT_LIST_ID,list:this.leftList,title:this.leftTitle,isFiltering:this.isFilteringLeft,filteredList:this.leftFilteredList,emptyMessage:(null===(t=this.emptyMessage)||void 0===t?void 0:t.LEFT_LIST)?this.emptyMessage.LEFT_LIST:this.i18n("ez-double-list.noItemsAvailable",{entity:this.entityLabel}),slotConfig:{itemRightSlotBuilder:null===(o=null===(e=this.slotsListBuilder)||void 0===e?void 0:e.LEFT_LIST)||void 0===o?void 0:o.itemRightSlotBuilder,itemLeftSlotBuilder:null===(n=null===(l=this.slotsListBuilder)||void 0===l?void 0:l.LEFT_LIST)||void 0===n?void 0:n.itemLeftSlotBuilder},callbacks:{setRef:t=>this.leftEzListInstance=t,onChange:t=>this.handleChangeLeft(t),onSelect:this.handleSelectLeftItem.bind(this),onDoubleClick:this.handleTransferToRight.bind(this),onChoose:this.handleChooseLeft.bind(this)}})),!this.useOnlyRightList&&i("div",{class:"actions__column"},i("ez-button",{mode:"icon",iconName:"dual-chevron-right",enabled:this.enableTransferAllToRight(),title:this.i18n("ez-double-list.moveAllTo",{list:this.rightListLabel}),size:"small",onClick:this.handleTransferAllToRight.bind(this)}),i("ez-button",{mode:"icon",iconName:"chevron-right",enabled:this.enableTransferToRight(),title:this.i18n("ez-double-list.moveTo",{list:this.rightListLabel}),size:"small",onClick:this.handleTransferToRight.bind(this)}),i("ez-button",{mode:"icon",iconName:"chevron-left",enabled:this.enableTransferToLeft(),title:this.i18n("ez-double-list.moveTo",{list:this.leftListLabel}),size:"small",onClick:this.handleTransferToLeft.bind(this)}),i("ez-button",{mode:"icon",iconName:"dual-chevron-left",enabled:this.enableTransferAllToLeft(),title:this.i18n("ez-double-list.moveAllTo",{list:this.leftListLabel}),size:"small",onClick:this.handleTransferAllToLeft.bind(this)})),i("div",{class:"list__container"},this.rightList&&this.renderList({idSortableList:this.RIGHT_LIST_ID,list:this.rightList,title:this.rightTitle,isFiltering:this.isFilteringRight,filteredList:this.rightFilteredList,emptyMessage:(null===(h=this.emptyMessage)||void 0===h?void 0:h.RIGHT_LIST)?this.emptyMessage.RIGHT_LIST:this.i18n("ez-double-list.noItemsSelected",{entity:this.entityLabel}),slotConfig:{itemRightSlotBuilder:null===(a=null===(r=this.slotsListBuilder)||void 0===r?void 0:r.RIGHT_LIST)||void 0===a?void 0:a.itemRightSlotBuilder,itemLeftSlotBuilder:null===(c=null===(d=this.slotsListBuilder)||void 0===d?void 0:d.RIGHT_LIST)||void 0===c?void 0:c.itemLeftSlotBuilder},callbacks:{setRef:t=>this.rightEzListInstance=t,onChange:t=>this.handleChangeRight(t),onSelect:this.handleSelectRightItem.bind(this),onDoubleClick:this.handleTransferToLeft.bind(this),onChoose:this.handleChooseRight.bind(this)}})),i("div",{class:"actions__column"},i("ez-button",{mode:"icon",iconName:"dual-chevron-up",enabled:this.enableMoveUp(!0),title:this.i18n("ez-double-list.moveToFirstPosition"),size:"small",onClick:this.handleMoveToTop.bind(this)}),i("ez-button",{mode:"icon",iconName:"chevron-up",enabled:this.enableMoveUp(),title:this.i18n("ez-double-list.moveUp"),size:"small",onClick:this.handleMoveUp.bind(this)}),i("ez-button",{mode:"icon",iconName:"chevron-down",enabled:this.enableMoveDown(),title:this.i18n("ez-double-list.moveDown"),size:"small",onClick:this.handleMoveDown.bind(this)}),i("ez-button",{mode:"icon",iconName:"dual-chevron-down",enabled:this.enableMoveDown(!0),title:this.i18n("ez-double-list.moveToLastPosition"),size:"small",onClick:this.handleMoveToBottom.bind(this)})))}static get watchers(){return{leftList:["observeLeftList"],rightList:["observeRightList"]}}};c.style='.sc-ez-double-list-h{display:flex;flex-direction:row;gap:8px;align-items:center;font-family:var(--font-pattern, "Roboto");width:100%}@media screen and (max-width: 1366px){.group.sc-ez-double-list{height:350px}}.list__container.sc-ez-double-list{height:100%;width:100%;min-height:150px;overflow:auto;display:flex}.actions__column.sc-ez-double-list{display:flex;flex-direction:column;gap:4px}';export{c as ez_double_list}
@@ -1 +1 @@
1
- import{r as i,c as t,h as e}from"./p-23a36bb6.js";import{i as n}from"./p-69344c23.js";import"@sankhyalabs/core";const a=class{constructor(e){i(this,e),this.ezPageChange=t(this,"ezPageChange",7),this.handlePreviousPage=()=>{this.currentPage>1&&(this.currentPage--,this.ezPageChange.emit(this.currentPage))},this.handleNextPage=()=>{this.currentPage<this.getTotalPages()&&(this.currentPage++,this.ezPageChange.emit(this.currentPage))},this.handlePageClick=i=>{this.currentPage=i,this.ezPageChange.emit(this.currentPage)},this.type="default",this.currentPage=1,this.totalItems=0,this.pageSize=10,this.hideInfoLabel=!1,this.pageLimit=10}async componentWillLoad(){this.i18n=await n()}getTotalPages(){return Math.ceil(this.totalItems/this.pageSize)}renderNextBtn(){return e("ez-button",{"aria-label":this.i18n("ez-pagination.nextPage"),label:this.i18n("ez-pagination.nextPage"),"data-element-id":"pagination-next-button",size:"small",iconName:"arrow-right",class:"ez-button--primary",mode:"icon",enabled:this.currentPage<this.getTotalPages(),onClick:()=>this.handleNextPage()})}renderPreviousBtn(){return e("ez-button",{label:this.i18n("ez-pagination.previousPage"),"aria-label":this.i18n("ez-pagination.previousPage"),"data-element-id":"pagination-previous-button",size:"small",iconName:"arrow-left",mode:"icon",enabled:this.currentPage>1,onClick:()=>this.handlePreviousPage()})}renderPageButton(i){return e("button",{"aria-label":`page-${i}`,class:{"page-button":!0,"current-page":this.currentPage===i},onClick:()=>this.handlePageClick(i)},i)}renderEllipsis(){return e("span",{"aria-label":"page-ellipsis",class:"ellipsis"},"...")}renderPageButtons(i){return i.map((i=>"..."===i?this.renderEllipsis():this.renderPageButton(i)))}renderInfoLabel(i,t){return!this.hideInfoLabel&&e("div",{class:"info"},e("span",{class:"info-range"},i," até ",t)," de ",this.totalItems)}renderDefault(){const i=(this.currentPage-1)*this.pageSize+1,t=Math.min(this.currentPage*this.pageSize,this.totalItems);return e("div",{class:"pagination-container"},this.renderInfoLabel(i,t),e("div",{class:"controls controls-compact"},this.renderPreviousBtn(),this.renderNextBtn()))}renderNumber(){const i=this.getTotalPages(),{currentPage:t,pageLimit:n}=this,a=[];if(i<=n)for(let t=1;t<=i;t++)a.push(t);else{const e=(i,t)=>Array.from({length:t-i+1},((t,e)=>i+e)),o=n-2;if(t>o)if(t<i-o+1){const o=n-4,s=Math.floor((o-1)/2),r=t-s,p=t+(o-1-s);a.push(1),a.push("..."),a.push(...e(r,p)),a.push("..."),a.push(i)}else a.push(1),a.push("..."),a.push(...e(i-(n-3),i));else a.push(...e(1,n-2)),a.push("..."),a.push(i)}return e("div",{class:"pagination-container"},e("div",{class:"controls"},this.renderPreviousBtn(),e("div",{class:"pages-options"},this.renderPageButtons(a)),this.renderNextBtn()))}render(){return"number"===this.type?this.renderNumber():this.renderDefault()}};a.style=".sc-ez-pagination-h{--ez-pagination__info--color:var(--color--petroleum-500);--ez-pagination__info--margin-right:var(--space--sm);--ez-pagination__info--text-weight:var(--text-weight--medium);--ez-pagination__info--font-size:var(--text--medium);--ez-pagination__info-range--font-weight:var(--font-weight--bold);--ez-pagination__pages-option-padding:var(--space--nano);--ez-pagination__pages-option-color:var(--color--petroleum-500);--ez-pagination__pages-option-weight:var(--text-weight--medium);--ez-pagination__pages-option-size:var(--text--medium)}.pagination-container.sc-ez-pagination{display:flex;align-items:center;justify-content:flex-start;overflow:hidden}.info.sc-ez-pagination{color:var(--ez-pagination__info--color);margin-right:var(--ez-pagination__info--margin-right);font-weight:var(--ez-pagination__info--text-weight);font-size:var(--ez-pagination__info--font-size);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}.info-range.sc-ez-pagination{font-weight:var(--ez-pagination__info-range--font-weight)}.controls.sc-ez-pagination{display:flex;align-items:center;flex-shrink:0}.controls-compact.sc-ez-pagination{gap:var(--space--2xs)}.pages-options.sc-ez-pagination{display:flex;align-items:center;padding:0 var(--ez-pagination__pages-option-padding)}.page-button.sc-ez-pagination{color:var(--ez-pagination__pages-option-color);font-weight:var(--ez-pagination__pages-option-weight);font-size:var(--ez-pagination__pages-option-size);background-color:transparent;padding:0;border:none;cursor:pointer;min-width:24px;height:24px;display:flex;align-items:center;justify-content:center}.current-page.sc-ez-pagination{color:var(--color--primary)}.page-info.sc-ez-pagination{margin:0 8px}.ellipsis.sc-ez-pagination{color:var(--ez-pagination__pages-option-color);font-weight:var(--ez-pagination__pages-option-weight);font-size:var(--ez-pagination__pages-option-size);min-width:24px;height:24px;display:flex;align-items:center;justify-content:center}";export{a as ez_pagination}
1
+ import{r as i,c as t,h as e}from"./p-23a36bb6.js";import{i as n}from"./p-b6579f86.js";import"@sankhyalabs/core";const a=class{constructor(e){i(this,e),this.ezPageChange=t(this,"ezPageChange",7),this.handlePreviousPage=()=>{this.currentPage>1&&(this.currentPage--,this.ezPageChange.emit(this.currentPage))},this.handleNextPage=()=>{this.currentPage<this.getTotalPages()&&(this.currentPage++,this.ezPageChange.emit(this.currentPage))},this.handlePageClick=i=>{this.currentPage=i,this.ezPageChange.emit(this.currentPage)},this.type="default",this.currentPage=1,this.totalItems=0,this.pageSize=10,this.hideInfoLabel=!1,this.pageLimit=10}async componentWillLoad(){this.i18n=await n()}getTotalPages(){return Math.ceil(this.totalItems/this.pageSize)}renderNextBtn(){return e("ez-button",{"aria-label":this.i18n("ez-pagination.nextPage"),label:this.i18n("ez-pagination.nextPage"),"data-element-id":"pagination-next-button",size:"small",iconName:"arrow-right",class:"ez-button--primary",mode:"icon",enabled:this.currentPage<this.getTotalPages(),onClick:()=>this.handleNextPage()})}renderPreviousBtn(){return e("ez-button",{label:this.i18n("ez-pagination.previousPage"),"aria-label":this.i18n("ez-pagination.previousPage"),"data-element-id":"pagination-previous-button",size:"small",iconName:"arrow-left",mode:"icon",enabled:this.currentPage>1,onClick:()=>this.handlePreviousPage()})}renderPageButton(i){return e("button",{"aria-label":`page-${i}`,class:{"page-button":!0,"current-page":this.currentPage===i},onClick:()=>this.handlePageClick(i)},i)}renderEllipsis(){return e("span",{"aria-label":"page-ellipsis",class:"ellipsis"},"...")}renderPageButtons(i){return i.map((i=>"..."===i?this.renderEllipsis():this.renderPageButton(i)))}renderInfoLabel(i,t){return!this.hideInfoLabel&&e("div",{class:"info"},e("span",{class:"info-range"},i," até ",t)," de ",this.totalItems)}renderDefault(){const i=(this.currentPage-1)*this.pageSize+1,t=Math.min(this.currentPage*this.pageSize,this.totalItems);return e("div",{class:"pagination-container"},this.renderInfoLabel(i,t),e("div",{class:"controls controls-compact"},this.renderPreviousBtn(),this.renderNextBtn()))}renderNumber(){const i=this.getTotalPages(),{currentPage:t,pageLimit:n}=this,a=[];if(i<=n)for(let t=1;t<=i;t++)a.push(t);else{const e=(i,t)=>Array.from({length:t-i+1},((t,e)=>i+e)),o=n-2;if(t>o)if(t<i-o+1){const o=n-4,s=Math.floor((o-1)/2),r=t-s,p=t+(o-1-s);a.push(1),a.push("..."),a.push(...e(r,p)),a.push("..."),a.push(i)}else a.push(1),a.push("..."),a.push(...e(i-(n-3),i));else a.push(...e(1,n-2)),a.push("..."),a.push(i)}return e("div",{class:"pagination-container"},e("div",{class:"controls"},this.renderPreviousBtn(),e("div",{class:"pages-options"},this.renderPageButtons(a)),this.renderNextBtn()))}render(){return"number"===this.type?this.renderNumber():this.renderDefault()}};a.style=".sc-ez-pagination-h{--ez-pagination__info--color:var(--color--petroleum-500);--ez-pagination__info--margin-right:var(--space--sm);--ez-pagination__info--text-weight:var(--text-weight--medium);--ez-pagination__info--font-size:var(--text--medium);--ez-pagination__info-range--font-weight:var(--font-weight--bold);--ez-pagination__pages-option-padding:var(--space--nano);--ez-pagination__pages-option-color:var(--color--petroleum-500);--ez-pagination__pages-option-weight:var(--text-weight--medium);--ez-pagination__pages-option-size:var(--text--medium)}.pagination-container.sc-ez-pagination{display:flex;align-items:center;justify-content:flex-start;overflow:hidden}.info.sc-ez-pagination{color:var(--ez-pagination__info--color);margin-right:var(--ez-pagination__info--margin-right);font-weight:var(--ez-pagination__info--text-weight);font-size:var(--ez-pagination__info--font-size);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}.info-range.sc-ez-pagination{font-weight:var(--ez-pagination__info-range--font-weight)}.controls.sc-ez-pagination{display:flex;align-items:center;flex-shrink:0}.controls-compact.sc-ez-pagination{gap:var(--space--2xs)}.pages-options.sc-ez-pagination{display:flex;align-items:center;padding:0 var(--ez-pagination__pages-option-padding)}.page-button.sc-ez-pagination{color:var(--ez-pagination__pages-option-color);font-weight:var(--ez-pagination__pages-option-weight);font-size:var(--ez-pagination__pages-option-size);background-color:transparent;padding:0;border:none;cursor:pointer;min-width:24px;height:24px;display:flex;align-items:center;justify-content:center}.current-page.sc-ez-pagination{color:var(--color--primary)}.page-info.sc-ez-pagination{margin:0 8px}.ellipsis.sc-ez-pagination{color:var(--ez-pagination__pages-option-color);font-weight:var(--ez-pagination__pages-option-weight);font-size:var(--ez-pagination__pages-option-size);min-width:24px;height:24px;display:flex;align-items:center;justify-content:center}";export{a as ez_pagination}
@@ -1 +1 @@
1
- import{r as t,c as i,h as e,f as n,H as s,g as r}from"./p-23a36bb6.js";import{DateUtils as o,ApplicationContext as l,Action as a,StringUtils as u,KeyboardManager as h,DataUnit as c,ElementIDUtils as d}from"@sankhyalabs/core";import{b as f,a as v,S as m,f as p,c as b,D as y}from"./p-f71a4d97.js";import{g as w,i as g}from"./p-69344c23.js";import{F as _}from"./p-47e4a8ce.js";import"./p-24582dd6.js";import"./p-ab574d59.js";import"./p-b853763b.js";import"./p-5895e687.js";const O=/child\[([^\]]+)\]/,C=/\$\{.+\}/;class j{constructor(){this._sheets=new Map,this._requiredFields=[],this._cleanOnCopyFields=[],this._defaultValues={}}static getDetailName(t){const i=O.exec(t);return i?i[1]:void 0}getSheet(t){return this._sheets.get(t)}getAllSheets(){return this._sheets}addSheet(t){this._sheets.set(t.name,t)}addRequiredFields(t){this._requiredFields=this._requiredFields.concat(t)}getRequiredFields(){return this._requiredFields}addCleanOnCopyFields(t){this._cleanOnCopyFields=this._cleanOnCopyFields.concat(t)}getCleanOnCopyFields(){return this._cleanOnCopyFields}addDefaultValues(t){return this._defaultValues=Object.assign(Object.assign({},this._defaultValues),t)}getDefaultValues(){const t={};return Object.entries(this._defaultValues).forEach((([i,e])=>{if("string"==typeof e){const t=C.exec(e);t&&(e=this.getDefaultVar(t[0]))}t[i]=e})),t}getDefaultVar(t){return"${data}"===t?o.getToday():"${datahora}"===t?o.getToday(!0):this._defaultVars?this._defaultVars.get(t):void 0}setDefaultVars(t){this._defaultVars=t}}const E=(t,i)=>{var e;if(i)return null===(e=i.tabs)||void 0===e?void 0:e.find((i=>i.label===t))},F=(t,i,e)=>{if("string"!=typeof t)return t;if(e){const i=E(t,e);if(i)return i}return Array.from(i.keys()).find((i=>i.label===t))||{label:t,visible:!0}};function z(t,i){var e,n;return"__main"===t[0].label&&"__main"!==i[0].label?-1:"__main"!==t[0].label&&"__main"===i[0].label?1:(null!==(e=t[0].order)&&void 0!==e?e:Number.MAX_VALUE)-(null!==(n=i[0].order)&&void 0!==n?n:Number.MAX_VALUE)}const x=t=>`child[${t.name}]`,A=t=>({name:x(t),label:t.label,fields:[]});function N(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var S="function"==typeof Symbol&&Symbol.observable||"@@observable",M=function(){return Math.random().toString(36).substring(7).split("").join(".")},D={INIT:"@@redux/INIT"+M(),REPLACE:"@@redux/REPLACE"+M(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+M()}};function R(t){if("object"!=typeof t||null===t)return!1;for(var i=t;null!==Object.getPrototypeOf(i);)i=Object.getPrototypeOf(i);return Object.getPrototypeOf(t)===i}function T(t,i,e){var n;if("function"==typeof i&&"function"==typeof e||"function"==typeof e&&"function"==typeof arguments[3])throw new Error(N(0));if("function"==typeof i&&void 0===e&&(e=i,i=void 0),void 0!==e){if("function"!=typeof e)throw new Error(N(1));return e(T)(t,i)}if("function"!=typeof t)throw new Error(N(2));var s=t,r=i,o=[],l=o,a=!1;function u(){l===o&&(l=o.slice())}function h(){if(a)throw new Error(N(3));return r}function c(t){if("function"!=typeof t)throw new Error(N(4));if(a)throw new Error(N(5));var i=!0;return u(),l.push(t),function(){if(i){if(a)throw new Error(N(6));i=!1,u();var e=l.indexOf(t);l.splice(e,1),o=null}}}function d(t){if(!R(t))throw new Error(N(7));if(void 0===t.type)throw new Error(N(8));if(a)throw new Error(N(9));try{a=!0,r=s(r,t)}finally{a=!1}for(var i=o=l,e=0;e<i.length;e++)(0,i[e])();return t}function f(t){if("function"!=typeof t)throw new Error(N(10));s=t,d({type:D.REPLACE})}function v(){var t,i=c;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new Error(N(11));function e(){t.next&&t.next(h())}return e(),{unsubscribe:i(e)}}})[S]=function(){return this},t}return d({type:D.INIT}),(n={dispatch:d,subscribe:c,getState:h,replaceReducer:f})[S]=v,n}const P={};function I(t=P,i){switch(i.type){case K.METADATA_LOADED:return Object.assign(Object.assign({},t),{formMetadata:i.payload,currentSheet:void 0});case K.CHANGE_TAB:return Object.assign(Object.assign({},t),{currentSheet:i.payload});default:return t}}function L(t){return t.formMetadata}function V(t){const i=function(t){return t.currentSheet}(t);return i?t.formMetadata.getSheet(i):Array.from(t.formMetadata.getAllSheets().values())[0]}var K;!function(t){t.METADATA_LOADED="FORM/METADATA_LOADED",t.CHANGE_TAB="FORM/CHANGE_TAB"}(K||(K={}));const $=class{constructor(e){t(this,e),this.ezFormRequestClearFieldToFocus=i(this,"ezFormRequestClearFieldToFocus",7),this.ezFormSetFields=i(this,"ezFormSetFields",7),this.ezReady=i(this,"ezReady",7),this.formItemsReady=i(this,"formItemsReady",7),this._customEditors=new Map,this._application=l.getContextValue("__SNK__APPLICATION__"),this.onDataUnitAction=t=>{t.type===a.METADATA_LOADED&&this.processMetadata()},this._fieldsProps=new Map,this._singleColumn=!1,this._formLayout=void 0,this.dataUnit=void 0,this.config=void 0,this.recordsValidator=void 0,this.fieldToFocus=void 0,this.onlyStaticFields=!1,this.useSearchField=!0,this.elementFocusSearchField=void 0,this.customUiBuilders=new Map}validate(){return this._dataBinder.validate()}async addCustomEditor(t,i,e){if(this._formView)return void this._formView.addCustomEditor(t,i,e);const n=new Map(this._customEditors);n.set(t,{customEditor:i,detailContext:e}),this._customEditors=n}observeConfig(){this.processMetadata()}async setFieldProp(t,i,e){const n=new Map(this._fieldsProps),s=this._fieldsProps.get(t);n.set(t,Object.assign(Object.assign({},s),{[i]:e})),this._fieldsProps=n}getDynamicContent(){var t;const i=L(this._store.getState());if(!i)return null;const n=Array.from(i.getAllSheets().values()),s=V(null===(t=this._store)||void 0===t?void 0:t.getState());let r=[];if(n.length>1){const t=n.map(((t,i)=>({tabKey:t.name,label:t.label,index:i}))),i="selector";r.push(e("ez-tabselector",{tabs:this.buildIdTabSelector(t),onEzChange:t=>this._store.dispatch(function(t){return{type:K.CHANGE_TAB,payload:"string"==typeof t?t:t.tabKey}}(t.detail)),selectedTab:s.name,"data-element-id":i}))}return r=r.concat(this.buildFormContent(s)),r}buildFormContent(t){const i=null==t?void 0:t.fields;if(null==t)return;this.ezFormSetFields.emit(i);const n=`${u.replaceAccentuatedChars(u.toCamelCase(null==t?void 0:t.label),!1)}_selectorContainer`;return e("div",{class:"dynamic-content ez-box--no-outline","data-element-id":n,ref:t=>this._container=t,tabindex:"0"},e("ez-popover",{ref:t=>this._ezPopoverSearchField=t,overlayType:"none"},this.renderFieldColumn()),e("ez-form-view",{ref:t=>this._formView=t,class:"ez-row ez-padding-vertical--small",fields:i,singleColumn:this._singleColumn,formLayout:this._formLayout,selectedRecord:this.dataUnit.getSelectedRecord(),customUiBuilders:this.customUiBuilders}))}renderFieldColumn(){return null!=this._fieldSearch||(this._fieldSearch=v({value:u.generateUUID(),label:this._i18n("ez-form.labelSearchField")},(({argument:t})=>this.fieldsOptionLoader(t)),(t=>this.onSelectField(t)))),this._fieldSearch}getFormFields(){var t;return null===(t=this.config)||void 0===t?void 0:t.fields}fieldsOptionLoader(t){const i=null==t?void 0:t.toLowerCase(),e=this.getFormFields().map((t=>{var i;return null===(i=this.dataUnit)||void 0===i?void 0:i.getField(t.name)})).filter((t=>{var e,n;return(null===(e=t.name)||void 0===e?void 0:e.toLowerCase().includes(i))||(null===(n=t.label)||void 0===n?void 0:n.toLowerCase().includes(i))})).map((t=>({value:t.name,label:t.label})));return Promise.resolve(e)}onSelectField(t){null!=t&&null!=t.value?(this.fieldToFocus=t.value,this._ezPopoverSearchField.hide()):this.fieldToFocus=""}async initKeyboardManager(){var t,i;this._keyboardManager=new h({propagate:!1,element:null!==(t=this.elementFocusSearchField)&&void 0!==t?t:this._element}),this.useSearchField&&this._keyboardManager.bind(m,(async()=>{if(!this._container||!this._ezPopoverSearchField)return;const t=this._container.getBoundingClientRect();await p(this._fieldSearch),this._ezPopoverSearchField.showUnder(this._container,{horizontalGap:t.width-b,verticalGap:-1*t.height})}),{description:this._i18n("ez-form.labelSearchField"),element:null!==(i=this.elementFocusSearchField)&&void 0!==i?i:this._element})}componentDidLoad(){this.initKeyboardManager()}processMetadata(){if(this.bindFields()&&this.dataUnit&&this._store){const t=((t,i,e=!1,n)=>{var s;null!=t&&!0!==(null==t?void 0:t.emptyConfig)||(t=(t=>{const i=t.metadata;let e;return i&&(e=i.fields.filter((t=>!1!==t.visible)).map((t=>({name:t.name,defaultValue:t.defaultValue})))),{emptyConfig:!1,fields:e}})(i));const r=new Map,o=new Map,l=[],a=[],u={};(null!==(s=null==t?void 0:t.tabs)&&void 0!==s?s:[]).forEach((t=>{o.has(t.label)||!1!==t.visible||o.set(t.label,t)})),function(t,i,e,n,s,r,o){var l;null===(l=null==t?void 0:t.fields)||void 0===l||l.forEach((l=>{var a,u,h;if(!1!==l.visible){const c=F(l.tab||"__main",i,t);if(e.has(c.label))return;const d=n.getField(l.name);if(d&&(null==(null==d?void 0:d.visible)||!0===(null==d?void 0:d.visible))&&c.visible){i.has(c)||i.set(c,[]);const t=f(d,l);i.get(c).push(t),t.required&&s.push(l.name),((null==l.cleanOnCopy?null===(a=d.properties)||void 0===a?void 0:a.cleanOnCopy:l.cleanOnCopy)||(null===(u=d.properties)||void 0===u?void 0:u.cleanOnCopy))&&r.push(l.name);let e=null==l.defaultValue?null===(h=d.properties)||void 0===h?void 0:h.defaultValue:l.defaultValue;if(e&&null!=e.value){const{type:t,value:i}=e;if(t)if("V"===t)e=i;else try{const t=JSON.parse(i);e=t&&"value"in t?t:i}catch(t){}o[l.name]=e}}}}))}(t,r,o,i,l,a,u);const h=new j;return h.setDefaultVars(t.defaultVars),e&&function(t,i,e){const n=t.metadata;void 0!==n&&void 0!==n.children&&n.children.forEach((t=>{const n=E(t.label,i);if(n)return void e.set(Object.assign(n,{name:x(t),isDetail:!0}),[]);const{label:s,name:r,fields:o}=A(t);e.set({name:r,label:s,isDetail:!0},o)}))}(i,t,r),n&&function(t,i,e){t.forEach((t=>{const n=E(t.label,i),s={};Object.entries(t).forEach((([t,i])=>{(function(t){return["id","label"].includes(t)})(t)||(s[t]=i)})),e.set(n?Object.assign(n,{name:t.id,isCustom:!0,ctxProps:s}):{label:t.label,name:t.id,isCustom:!0,visible:!0,ctxProps:s},[])}))}(n,t,r),Array.from(r.entries()).sort(z).forEach((([t,i])=>{o.has(t.label)||h.addSheet(function(t,i){const e=w();return{label:"__main"===t.label?e("ez-form.mainTab"):t.label,name:t.name||t.label,isCustom:t.isCustom,isDetail:t.isDetail,ctxProps:t.ctxProps,fields:i}}(t,i))})),h.addRequiredFields(l),h.addCleanOnCopyFields(a),h.addDefaultValues(u),h})(this.config,this.dataUnit);this._store.dispatch({type:K.METADATA_LOADED,payload:t})}}isStatic(){var t;return(null===(t=this._staticFields)||void 0===t?void 0:t.length)>0}bindFields(){return!this.isStatic()||!1===this.onlyStaticFields}async componentWillLoad(){var t;void 0===this.dataUnit&&(this.dataUnit=new c("ez-form")),this.dataUnit.unsubscribe(this.onDataUnitAction),this.dataUnit.subscribe(this.onDataUnitAction),this._dataBinder=new y(this.dataUnit),this._store=T(I),this._store.subscribe((()=>n(this))),this._staticFields=Array.from(this._element.querySelectorAll("[data-field-name]")),this.processMetadata(),d.addIDInfo(this._element,null,{dataUnit:this.dataUnit});const i=await(null===(t=this._application)||void 0===t?void 0:t.getLayoutFormConfig());this.setSingleColumn(i),this.registerNotifyListeners(i),this._i18n=await g()}async setSingleColumn(t){this._singleColumn=(null==t?void 0:t.config)===_.CASCADE||(null==t?void 0:t.config)===_.CLASSIC_CASCADE,this._formLayout=null==t?void 0:t.config}async registerNotifyListeners(t){t&&t.onConfigChange((t=>{this._singleColumn=t===_.CASCADE||t===_.CLASSIC_CASCADE,this._formLayout=t}))}componentDidRender(){const t=L(this._store.getState());t.addRequiredFields(this._staticFields.filter((t=>t.dataset.required)).map((t=>t.dataset.fieldName))),this._dataBinder.bind(Array.from(this._element.querySelectorAll("[data-field-name]")),this.dataUnit.dataUnitId,t,this.recordsValidator),this.ezReady.emit(),this.handleFieldToFocus(),this.setCustomEditors(),this.setFieldsProps()}setCustomEditors(){if(this._formView)for(const[t,i]of this._customEditors)this._formView.addCustomEditor(t,i.customEditor,i.detailContext),this._customEditors.delete(t)}handleFieldToFocus(){var t;if(null==this.fieldToFocus)return;const i=V(null===(t=this._store)||void 0===t?void 0:t.getState());(null==i?void 0:i.fields).some((t=>t.name===this.fieldToFocus))&&requestAnimationFrame((()=>{this._dataBinder.setFocus(this.fieldToFocus),this.ezFormRequestClearFieldToFocus.emit(),this.fieldToFocus=null}))}setFieldsProps(){if(this._formView)for(const[t,i]of this._fieldsProps){for(const e in i)this._formView.setFieldProp(t,e,i[e]);this._fieldsProps.delete(t)}}disconnectedCallback(){var t;this.dataUnit.unsubscribe(this.onDataUnitAction),this._dataBinder.onDisconnectedCallback(),null===(t=this._keyboardManager)||void 0===t||t.unbindAllShortcutKeys()}buildIdTabSelector(t){return t&&t.forEach((t=>t[d.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=u.toCamelCase(t.label))),t}render(){return e(s,null,this.isStatic()?null:this.getDynamicContent())}get _element(){return r(this)}static get watchers(){return{config:["observeConfig"]}}};$.style=".sc-ez-form-h{display:flex;flex-direction:column;width:100%}.dynamic-content.sc-ez-form ez-collapsible-box.sc-ez-form{--ez-collapsible-box__header--padding-right:var(--space-small, 6px);--ez-collapsible-box__header--padding-left:var(--space-small, 6px)}";export{$ as ez_form}
1
+ import{r as t,c as i,h as e,f as n,H as s,g as r}from"./p-23a36bb6.js";import{DateUtils as o,ApplicationContext as l,Action as a,StringUtils as u,KeyboardManager as h,DataUnit as c,ElementIDUtils as d}from"@sankhyalabs/core";import{b as f,a as v,S as m,f as p,c as b,D as y}from"./p-fc57648e.js";import{g as w,i as g}from"./p-b6579f86.js";import{F as _}from"./p-47e4a8ce.js";import"./p-46b0b0c7.js";import"./p-ab574d59.js";import"./p-b853763b.js";import"./p-5895e687.js";const O=/child\[([^\]]+)\]/,C=/\$\{.+\}/;class j{constructor(){this._sheets=new Map,this._requiredFields=[],this._cleanOnCopyFields=[],this._defaultValues={}}static getDetailName(t){const i=O.exec(t);return i?i[1]:void 0}getSheet(t){return this._sheets.get(t)}getAllSheets(){return this._sheets}addSheet(t){this._sheets.set(t.name,t)}addRequiredFields(t){this._requiredFields=this._requiredFields.concat(t)}getRequiredFields(){return this._requiredFields}addCleanOnCopyFields(t){this._cleanOnCopyFields=this._cleanOnCopyFields.concat(t)}getCleanOnCopyFields(){return this._cleanOnCopyFields}addDefaultValues(t){return this._defaultValues=Object.assign(Object.assign({},this._defaultValues),t)}getDefaultValues(){const t={};return Object.entries(this._defaultValues).forEach((([i,e])=>{if("string"==typeof e){const t=C.exec(e);t&&(e=this.getDefaultVar(t[0]))}t[i]=e})),t}getDefaultVar(t){return"${data}"===t?o.getToday():"${datahora}"===t?o.getToday(!0):this._defaultVars?this._defaultVars.get(t):void 0}setDefaultVars(t){this._defaultVars=t}}const E=(t,i)=>{var e;if(i)return null===(e=i.tabs)||void 0===e?void 0:e.find((i=>i.label===t))},F=(t,i,e)=>{if("string"!=typeof t)return t;if(e){const i=E(t,e);if(i)return i}return Array.from(i.keys()).find((i=>i.label===t))||{label:t,visible:!0}};function z(t,i){var e,n;return"__main"===t[0].label&&"__main"!==i[0].label?-1:"__main"!==t[0].label&&"__main"===i[0].label?1:(null!==(e=t[0].order)&&void 0!==e?e:Number.MAX_VALUE)-(null!==(n=i[0].order)&&void 0!==n?n:Number.MAX_VALUE)}const x=t=>`child[${t.name}]`,A=t=>({name:x(t),label:t.label,fields:[]});function N(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var S="function"==typeof Symbol&&Symbol.observable||"@@observable",M=function(){return Math.random().toString(36).substring(7).split("").join(".")},D={INIT:"@@redux/INIT"+M(),REPLACE:"@@redux/REPLACE"+M(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+M()}};function R(t){if("object"!=typeof t||null===t)return!1;for(var i=t;null!==Object.getPrototypeOf(i);)i=Object.getPrototypeOf(i);return Object.getPrototypeOf(t)===i}function T(t,i,e){var n;if("function"==typeof i&&"function"==typeof e||"function"==typeof e&&"function"==typeof arguments[3])throw new Error(N(0));if("function"==typeof i&&void 0===e&&(e=i,i=void 0),void 0!==e){if("function"!=typeof e)throw new Error(N(1));return e(T)(t,i)}if("function"!=typeof t)throw new Error(N(2));var s=t,r=i,o=[],l=o,a=!1;function u(){l===o&&(l=o.slice())}function h(){if(a)throw new Error(N(3));return r}function c(t){if("function"!=typeof t)throw new Error(N(4));if(a)throw new Error(N(5));var i=!0;return u(),l.push(t),function(){if(i){if(a)throw new Error(N(6));i=!1,u();var e=l.indexOf(t);l.splice(e,1),o=null}}}function d(t){if(!R(t))throw new Error(N(7));if(void 0===t.type)throw new Error(N(8));if(a)throw new Error(N(9));try{a=!0,r=s(r,t)}finally{a=!1}for(var i=o=l,e=0;e<i.length;e++)(0,i[e])();return t}function f(t){if("function"!=typeof t)throw new Error(N(10));s=t,d({type:D.REPLACE})}function v(){var t,i=c;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new Error(N(11));function e(){t.next&&t.next(h())}return e(),{unsubscribe:i(e)}}})[S]=function(){return this},t}return d({type:D.INIT}),(n={dispatch:d,subscribe:c,getState:h,replaceReducer:f})[S]=v,n}const P={};function I(t=P,i){switch(i.type){case K.METADATA_LOADED:return Object.assign(Object.assign({},t),{formMetadata:i.payload,currentSheet:void 0});case K.CHANGE_TAB:return Object.assign(Object.assign({},t),{currentSheet:i.payload});default:return t}}function L(t){return t.formMetadata}function V(t){const i=function(t){return t.currentSheet}(t);return i?t.formMetadata.getSheet(i):Array.from(t.formMetadata.getAllSheets().values())[0]}var K;!function(t){t.METADATA_LOADED="FORM/METADATA_LOADED",t.CHANGE_TAB="FORM/CHANGE_TAB"}(K||(K={}));const $=class{constructor(e){t(this,e),this.ezFormRequestClearFieldToFocus=i(this,"ezFormRequestClearFieldToFocus",7),this.ezFormSetFields=i(this,"ezFormSetFields",7),this.ezReady=i(this,"ezReady",7),this.formItemsReady=i(this,"formItemsReady",7),this._customEditors=new Map,this._application=l.getContextValue("__SNK__APPLICATION__"),this.onDataUnitAction=t=>{t.type===a.METADATA_LOADED&&this.processMetadata()},this._fieldsProps=new Map,this._singleColumn=!1,this._formLayout=void 0,this.dataUnit=void 0,this.config=void 0,this.recordsValidator=void 0,this.fieldToFocus=void 0,this.onlyStaticFields=!1,this.useSearchField=!0,this.elementFocusSearchField=void 0,this.customUiBuilders=new Map}validate(){return this._dataBinder.validate()}async addCustomEditor(t,i,e){if(this._formView)return void this._formView.addCustomEditor(t,i,e);const n=new Map(this._customEditors);n.set(t,{customEditor:i,detailContext:e}),this._customEditors=n}observeConfig(){this.processMetadata()}async setFieldProp(t,i,e){const n=new Map(this._fieldsProps),s=this._fieldsProps.get(t);n.set(t,Object.assign(Object.assign({},s),{[i]:e})),this._fieldsProps=n}getDynamicContent(){var t;const i=L(this._store.getState());if(!i)return null;const n=Array.from(i.getAllSheets().values()),s=V(null===(t=this._store)||void 0===t?void 0:t.getState());let r=[];if(n.length>1){const t=n.map(((t,i)=>({tabKey:t.name,label:t.label,index:i}))),i="selector";r.push(e("ez-tabselector",{tabs:this.buildIdTabSelector(t),onEzChange:t=>this._store.dispatch(function(t){return{type:K.CHANGE_TAB,payload:"string"==typeof t?t:t.tabKey}}(t.detail)),selectedTab:s.name,"data-element-id":i}))}return r=r.concat(this.buildFormContent(s)),r}buildFormContent(t){const i=null==t?void 0:t.fields;if(null==t)return;this.ezFormSetFields.emit(i);const n=`${u.replaceAccentuatedChars(u.toCamelCase(null==t?void 0:t.label),!1)}_selectorContainer`;return e("div",{class:"dynamic-content ez-box--no-outline","data-element-id":n,ref:t=>this._container=t,tabindex:"0"},e("ez-popover",{ref:t=>this._ezPopoverSearchField=t,overlayType:"none"},this.renderFieldColumn()),e("ez-form-view",{ref:t=>this._formView=t,class:"ez-row ez-padding-vertical--small",fields:i,singleColumn:this._singleColumn,formLayout:this._formLayout,selectedRecord:this.dataUnit.getSelectedRecord(),customUiBuilders:this.customUiBuilders}))}renderFieldColumn(){return null!=this._fieldSearch||(this._fieldSearch=v({value:u.generateUUID(),label:this._i18n("ez-form.labelSearchField")},(({argument:t})=>this.fieldsOptionLoader(t)),(t=>this.onSelectField(t)))),this._fieldSearch}getFormFields(){var t;return null===(t=this.config)||void 0===t?void 0:t.fields}fieldsOptionLoader(t){const i=null==t?void 0:t.toLowerCase(),e=this.getFormFields().map((t=>{var i;return null===(i=this.dataUnit)||void 0===i?void 0:i.getField(t.name)})).filter((t=>{var e,n;return(null===(e=t.name)||void 0===e?void 0:e.toLowerCase().includes(i))||(null===(n=t.label)||void 0===n?void 0:n.toLowerCase().includes(i))})).map((t=>({value:t.name,label:t.label})));return Promise.resolve(e)}onSelectField(t){null!=t&&null!=t.value?(this.fieldToFocus=t.value,this._ezPopoverSearchField.hide()):this.fieldToFocus=""}async initKeyboardManager(){var t,i;this._keyboardManager=new h({propagate:!1,element:null!==(t=this.elementFocusSearchField)&&void 0!==t?t:this._element}),this.useSearchField&&this._keyboardManager.bind(m,(async()=>{if(!this._container||!this._ezPopoverSearchField)return;const t=this._container.getBoundingClientRect();await p(this._fieldSearch),this._ezPopoverSearchField.showUnder(this._container,{horizontalGap:t.width-b,verticalGap:-1*t.height})}),{description:this._i18n("ez-form.labelSearchField"),element:null!==(i=this.elementFocusSearchField)&&void 0!==i?i:this._element})}componentDidLoad(){this.initKeyboardManager()}processMetadata(){if(this.bindFields()&&this.dataUnit&&this._store){const t=((t,i,e=!1,n)=>{var s;null!=t&&!0!==(null==t?void 0:t.emptyConfig)||(t=(t=>{const i=t.metadata;let e;return i&&(e=i.fields.filter((t=>!1!==t.visible)).map((t=>({name:t.name,defaultValue:t.defaultValue})))),{emptyConfig:!1,fields:e}})(i));const r=new Map,o=new Map,l=[],a=[],u={};(null!==(s=null==t?void 0:t.tabs)&&void 0!==s?s:[]).forEach((t=>{o.has(t.label)||!1!==t.visible||o.set(t.label,t)})),function(t,i,e,n,s,r,o){var l;null===(l=null==t?void 0:t.fields)||void 0===l||l.forEach((l=>{var a,u,h;if(!1!==l.visible){const c=F(l.tab||"__main",i,t);if(e.has(c.label))return;const d=n.getField(l.name);if(d&&(null==(null==d?void 0:d.visible)||!0===(null==d?void 0:d.visible))&&c.visible){i.has(c)||i.set(c,[]);const t=f(d,l);i.get(c).push(t),t.required&&s.push(l.name),((null==l.cleanOnCopy?null===(a=d.properties)||void 0===a?void 0:a.cleanOnCopy:l.cleanOnCopy)||(null===(u=d.properties)||void 0===u?void 0:u.cleanOnCopy))&&r.push(l.name);let e=null==l.defaultValue?null===(h=d.properties)||void 0===h?void 0:h.defaultValue:l.defaultValue;if(e&&null!=e.value){const{type:t,value:i}=e;if(t)if("V"===t)e=i;else try{const t=JSON.parse(i);e=t&&"value"in t?t:i}catch(t){}o[l.name]=e}}}}))}(t,r,o,i,l,a,u);const h=new j;return h.setDefaultVars(t.defaultVars),e&&function(t,i,e){const n=t.metadata;void 0!==n&&void 0!==n.children&&n.children.forEach((t=>{const n=E(t.label,i);if(n)return void e.set(Object.assign(n,{name:x(t),isDetail:!0}),[]);const{label:s,name:r,fields:o}=A(t);e.set({name:r,label:s,isDetail:!0},o)}))}(i,t,r),n&&function(t,i,e){t.forEach((t=>{const n=E(t.label,i),s={};Object.entries(t).forEach((([t,i])=>{(function(t){return["id","label"].includes(t)})(t)||(s[t]=i)})),e.set(n?Object.assign(n,{name:t.id,isCustom:!0,ctxProps:s}):{label:t.label,name:t.id,isCustom:!0,visible:!0,ctxProps:s},[])}))}(n,t,r),Array.from(r.entries()).sort(z).forEach((([t,i])=>{o.has(t.label)||h.addSheet(function(t,i){const e=w();return{label:"__main"===t.label?e("ez-form.mainTab"):t.label,name:t.name||t.label,isCustom:t.isCustom,isDetail:t.isDetail,ctxProps:t.ctxProps,fields:i}}(t,i))})),h.addRequiredFields(l),h.addCleanOnCopyFields(a),h.addDefaultValues(u),h})(this.config,this.dataUnit);this._store.dispatch({type:K.METADATA_LOADED,payload:t})}}isStatic(){var t;return(null===(t=this._staticFields)||void 0===t?void 0:t.length)>0}bindFields(){return!this.isStatic()||!1===this.onlyStaticFields}async componentWillLoad(){var t;void 0===this.dataUnit&&(this.dataUnit=new c("ez-form")),this.dataUnit.unsubscribe(this.onDataUnitAction),this.dataUnit.subscribe(this.onDataUnitAction),this._dataBinder=new y(this.dataUnit),this._store=T(I),this._store.subscribe((()=>n(this))),this._staticFields=Array.from(this._element.querySelectorAll("[data-field-name]")),this.processMetadata(),d.addIDInfo(this._element,null,{dataUnit:this.dataUnit});const i=await(null===(t=this._application)||void 0===t?void 0:t.getLayoutFormConfig());this.setSingleColumn(i),this.registerNotifyListeners(i),this._i18n=await g()}async setSingleColumn(t){this._singleColumn=(null==t?void 0:t.config)===_.CASCADE||(null==t?void 0:t.config)===_.CLASSIC_CASCADE,this._formLayout=null==t?void 0:t.config}async registerNotifyListeners(t){t&&t.onConfigChange((t=>{this._singleColumn=t===_.CASCADE||t===_.CLASSIC_CASCADE,this._formLayout=t}))}componentDidRender(){const t=L(this._store.getState());t.addRequiredFields(this._staticFields.filter((t=>t.dataset.required)).map((t=>t.dataset.fieldName))),this._dataBinder.bind(Array.from(this._element.querySelectorAll("[data-field-name]")),this.dataUnit.dataUnitId,t,this.recordsValidator),this.ezReady.emit(),this.handleFieldToFocus(),this.setCustomEditors(),this.setFieldsProps()}setCustomEditors(){if(this._formView)for(const[t,i]of this._customEditors)this._formView.addCustomEditor(t,i.customEditor,i.detailContext),this._customEditors.delete(t)}handleFieldToFocus(){var t;if(null==this.fieldToFocus)return;const i=V(null===(t=this._store)||void 0===t?void 0:t.getState());(null==i?void 0:i.fields).some((t=>t.name===this.fieldToFocus))&&requestAnimationFrame((()=>{this._dataBinder.setFocus(this.fieldToFocus),this.ezFormRequestClearFieldToFocus.emit(),this.fieldToFocus=null}))}setFieldsProps(){if(this._formView)for(const[t,i]of this._fieldsProps){for(const e in i)this._formView.setFieldProp(t,e,i[e]);this._fieldsProps.delete(t)}}disconnectedCallback(){var t;this.dataUnit.unsubscribe(this.onDataUnitAction),this._dataBinder.onDisconnectedCallback(),null===(t=this._keyboardManager)||void 0===t||t.unbindAllShortcutKeys()}buildIdTabSelector(t){return t&&t.forEach((t=>t[d.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=u.toCamelCase(t.label))),t}render(){return e(s,null,this.isStatic()?null:this.getDynamicContent())}get _element(){return r(this)}static get watchers(){return{config:["observeConfig"]}}};$.style=".sc-ez-form-h{display:flex;flex-direction:column;width:100%}.dynamic-content.sc-ez-form ez-collapsible-box.sc-ez-form{--ez-collapsible-box__header--padding-right:var(--space-small, 6px);--ez-collapsible-box__header--padding-left:var(--space-small, 6px)}";export{$ as ez_form}
@@ -1 +1 @@
1
- import{r as i,c as t,h as s,H as e,g as h}from"./p-23a36bb6.js";import{C as a}from"./p-ec7db713.js";import{ObjectUtils as r,StringUtils as o,ElementIDUtils as l}from"@sankhyalabs/core";import{A as n}from"./p-24582dd6.js";import"./p-ab574d59.js";import"./p-b853763b.js";import{i as c}from"./p-69344c23.js";import{S as d}from"./p-5895e687.js";import"./p-47e4a8ce.js";import{r as u,a as v}from"./p-88a115b3.js";const p=class{constructor(s){i(this,s),this.ezChange=t(this,"ezChange",7),this._changeDeboucingTimeout=null,this._limitCharsToSearch=3,this._deboucingTime=300,this._maxWidthValue=0,this._tabPressed=!1,this._startHighlightTag="<span class='card-item__highlight'>",this._endHighlightTag="</span>",this._preSelection=void 0,this._visibleOptions=void 0,this._startLoading=!1,this._showLoading=!0,this._criteria=void 0,this.value=void 0,this.label=void 0,this.enabled=!0,this.errorMessage=void 0,this.size="default",this.optionLoader=void 0,this.contextProperties=void 0,this.showSelectedValue=!0,this.showOptionValue=!0,this.suppressEmptyOption=!1,this.stopPropagateEnterKeyEvent=!1,this.mode="regular",this.classic=!1,this.required=!1,this.canShowError=!0,this.hideErrorOnFocusOut=!0,this.listOptionsPosition=void 0,this.isTextSearch=!1,this.ignoreLimitCharsToSearch=!1,this.options=void 0,this.suppressSearch=!1,this.ensureClearButtonVisible=!1,this.suppressPreLoad=!0,this.autoFocus=!1,this.alternativePlaceholder=void 0,this.showMore=void 0,this.suppressInputPersist=!1,this.hideDescriptionInput=!1}observeErrorMessage(){var i;this._textInput&&(this._textInput.errorMessage=this.errorMessage,!(null===(i=this.errorMessage)||void 0===i?void 0:i.trim())&&this.errorMessage&&this.setInputValue())}getValue(i){return"object"==typeof i?null==i?void 0:i.value:i}validateNewValue(i,t){const s=this.getValue(i),e=this.getValue(t);return!("[object Object]"===s||s===e)}async observeValue(i,t){if(this._textInput&&this.validateNewValue(i,t)){if("string"==typeof i)return void await this.handleValueAsString(i);const t=this.getSelectedOption(i),s=this.getSelectedOption(this._currentValue);this.isDifferentValues(s,t)&&(this._currentValue=t,this.setInputValue(),this.ezChange.emit(null!=t?t:void 0)),this.resetOptions()}}observeOptions(i,t){!i.length&&this.suppressPreLoad||(null==i?void 0:i.join(""))!==(null==t?void 0:t.join(""))&&this.loadOptions(d.PRELOAD)}async getValueAsync(){return new Promise(this._showLoading?i=>{let t=setInterval((()=>{this._showLoading||(clearInterval(t),i(this.value))}),100)}:i=>i(this.value))}async setFocus(i){this._textInput&&this._textInput.setFocus(i)}async setBlur(){this._textInput&&this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async clearValue(){this.clearSearch()}async handleValueAsString(i){this.getSelectedOption(i)?this.setInputValue():(await this.loadDescriptionValue(i),this._currentValue&&(this.setInputValue(),this.ezChange.emit(this.value),this._currentValue=this.value))}isDifferentValues(i,t){return r.objectToString(i||{})!==r.objectToString(t||{})}getFormattedText(i){if(null==i)return;let t=this.showSelectedValue&&null!=i.value?i.label?`${i.value} - ${i.label}`:i.value:i.label;return t=null==t?void 0:t.replace(new RegExp(this._startHighlightTag,"g"),"").replace(new RegExp(this._endHighlightTag,"g"),""),t}getText(){const i=this.getSelectedOption(this._currentValue),t=this.getFormattedText(i);return u(t)}getSelectedOption(i){return"string"==typeof i||i instanceof String?this._visibleOptions.find((t=>t.value===i)):i?Object.assign(Object.assign({},i),{value:v(null==i?void 0:i.value),label:v(null==i?void 0:i.label)}):i}updateVisibleOptions(){let i=this._source||[];this._visibleOptions=this.suppressEmptyOption?i:[{value:void 0,label:""}].concat(i),this._maxWidthValue=this.getMaxWidthValue()}getMaxWidthValue(){var i;const t=[];return null===(i=this._visibleOptions)||void 0===i||i.forEach((i=>{const s=this.getWidthValue(i.value);t.includes(s)||t.push(s)})),t.length>1?Math.max(...t):0}getWidthValue(i){if(null!=this._itemValueBasis){const t=this._itemValueBasis;if(null!=i)return t.innerHTML=i,t.clientWidth>0?t.clientWidth+2:0;t.innerHTML=""}return 0}showOptions(){this.enabled&&(this.isOptionsVisible()||this._ezPopOverPlusElement.showUnder(this._textInput))}hideOptions(){this._ezPopOverPlusElement.hide()}isOptionsVisible(){return this._ezPopOverPlusElement.opened}selectCurrentOption(i=!0){void 0!==this._preSelection?(this.selectOption(this._visibleOptions[this._preSelection],i),this._preSelection=void 0):this.controlListWithOnlyOne()}updateSource(i){this._startLoading=!1,i instanceof Promise?(this._showLoading=!0,i.then((i=>{this.updateSource(i)})).finally((()=>{this._showLoading=!1})),this.updateVisibleOptions()):(this._showLoading=!1,Array.isArray(i)?(this._source=i,this.updateVisibleOptions(),this._tabPressed&&(this._tabPressed=!1,this.controlEmptySearch(!1))):this.selectOption(i))}clearSource(){this._source=[],this.updateVisibleOptions()}selectOption(i,t=!0){var s,e;const h=this.getSelectedOption(this.value),a=Object.assign(Object.assign({},i),{value:v(null==i?void 0:i.value),label:v(null==i?void 0:i.label)}),r=Object.assign(Object.assign({},a),{value:u(null==a?void 0:a.value),label:u(null==a?void 0:a.label)});if((null===(s=null==h?void 0:h.value)||void 0===s?void 0:s.toString())!==(null===(e=null==r?void 0:r.value)||void 0===e?void 0:e.toString())||null==h&&null!=r&&"value"in r){const i=(null==r?void 0:r.value)?r:void 0;this.value=i,this._currentValue=i}else this.setInputValue(),this.resetOptions();this._visibleOptions=[],this.clearSource(),t&&setTimeout((()=>{this.setFocus()}),0)}loadOptions(i,t=""){this._criteria=t,this._startLoading=!0,this.updateSource(this.optionLoader?this.optionLoader({mode:i,argument:t},this.contextProperties):this.options)}cancelPreselection(){!this._textInput.value&&this._currentValue&&this._source.length>0?this.selectOption(void 0):window.setTimeout((()=>{this.setInputValue()}),this._deboucingTime),this.resetOptions()}setInputValue(i=!0){if(this.suppressInputPersist)return void this.clearSearch();const t=this.getText();(this._textInput.value||"")!==t&&(this._textInput.value=t,i&&(this.errorMessage=null))}clearSearch(){this.value=null,this._currentValue=null,this._textInput.value=""}controlListWithOnlyOne(i=!0){var t,s;const e=null===(t=this._visibleOptions)||void 0===t?void 0:t.filter((i=>""!==i.label&&null!=i.value));if((null==e?void 0:e.length)>0){const t=new RegExp(this._startHighlightTag,"g"),h=new RegExp(this._endHighlightTag,"g");let a=o.decodeHtmlEntities(e[0].label);const r={value:null===(s=e[0].value)||void 0===s?void 0:s.replace(t,"").replace(h,""),label:null==a?void 0:a.replace(t,"").replace(h,"")};this.selectOption(r,i)}}controlEmptySearch(i=!0){var t;(null===(t=this._visibleOptions)||void 0===t?void 0:t.length)?this.controlListWithOnlyOne(i):(this.clearSearch(),n.info(this.i18n("ez-classic-search.emptyList")))}async loadDescriptionValue(i){var t,s,e;if(null==i)return;if((null===(t=this.options)||void 0===t?void 0:t.length)>0)return void this.loadOptionValue(i);const h={mode:this.hideDescriptionInput?d.LOAD_DESCRIPTION:d.PREDICTIVE,argument:i};try{const i=await(null===(s=this.optionLoader)||void 0===s?void 0:s.call(this,h,this.contextProperties));if(null==i)return;i instanceof Promise?i.then((i=>{this.setDescriptionValue(i)})):this.setDescriptionValue(i)}catch(i){throw"WarningException"===(null===(e=null==i?void 0:i.constructor)||void 0===e?void 0:e.name)&&(this.errorMessage=i.message),i}}setDescriptionValue(i){const t=(null==i?void 0:i[0])||i;null!=t&&Object.keys(t).length?(this._currentValue=t?Object.assign(Object.assign({},t),{value:v(t.value),label:v(t.label)}):t,this.value=this._currentValue,this.setTextInputValue()):this.showNoResultMessage()}setTextInputValue(){if(this._textInput&&null==this._textInput.value){if(null==this.value)return;const i="string"==typeof this.value?this.value:this.getFormattedText(this.value);this._textInput.value=u(i)}}loadOptionValue(i){var t;const s=null===(t=this.options)||void 0===t?void 0:t.find((t=>t.value===i));null!=s?this.selectOption(s):this.showNoResultMessage()}async showNoResultMessage(){this.clearSearch(),n.info(this.i18n("ez-classic-search.emptySearch",{field:this.getFieldLabel()}))}getFieldLabel(){var i;return null===(i=this.label)||void 0===i?void 0:i.replace(this.i18n("app.requiredInfo"),"").toUpperCase()}resetOptions(){this.showMore?this.handleResetOptionsWithShowMoreVisible():(this.hideOptions(),this._criteria=void 0,this._preSelection=void 0,this.updateVisibleOptions())}handleResetOptionsWithShowMoreVisible(){setTimeout((()=>{this.hideOptions(),this._criteria=void 0,this._preSelection=void 0,this.updateVisibleOptions()}),100)}async handleInitialValue(){if(!this.getValue(this.value))return;if("string"==typeof this.value)return void await this.handleValueAsString(this.value);let i=this.getFormattedText(this.value);i=u(i),this._textInput.value=i}async componentWillLoad(){if(this.i18n=await c(),void 0===this.options){this.options=[];const i=this.el.querySelectorAll("option");i&&i.forEach((i=>{let t=i.innerText,s=i.getAttribute("value"),e=i.getAttribute("details");s||(s=t),this.options.push({label:t,value:s,details:e}),i.hidden=!0}))}this.updateSource([])}componentDidRender(){var i;null===(i=this._optionsList)||void 0===i||i.querySelectorAll(".item").forEach((i=>{l.addIDInfoIfNotExists(i,"itemSearch")}))}async componentDidLoad(){this._currentValue=this.value,a.applyVarsTextInput(this.el,this._textInput),this._resizeObserver=new ResizeObserver((i=>{window.requestAnimationFrame((()=>{Array.isArray(i)}))})),this._intersectionObserver=new IntersectionObserver((i=>{i.forEach((i=>{!i.isIntersecting&&this._ezPopOverPlusElement&&this._ezPopOverPlusElement.hide()}))}),{threshold:.1}),this._textInput&&this._intersectionObserver.observe(this._textInput),await this.handleInitialValue(),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}disconnectedCallback(){var i,t;null===(i=this._resizeObserver)||void 0===i||i.disconnect(),null===(t=this._intersectionObserver)||void 0===t||t.disconnect()}handleClassicIconClick(i){const{icon:t}=i.detail;"left"!==t?this.clearSearch():this.loadOptions(d.ADVANCED)}buildNumberArgument(i){return this.isTextSearch?NaN:Number(i||void 0)}onTextInputChangeHandler(i){var t;if(this.clearDeboucingTimeout(),this._startLoading)return void(this._changeDeboucingTimeout=window.setTimeout((()=>{this.onTextInputChangeHandler(i)}),this._deboucingTime));const s=null===(t=i.target.value)||void 0===t?void 0:t.trim(),e=this.buildNumberArgument(s);this._criteria||(this._textInput.value=i.data||s),this._criteria=s,s?(this._showLoading=!1,this.clearSource(),this.ignoreLimitCharsToSearch||!isNaN(e)||s.length>=this._limitCharsToSearch?(this._showLoading=!0,this._changeDeboucingTimeout=window.setTimeout((()=>{this.loadOptions(d.PREDICTIVE,isNaN(e)?s:e.toString())}),this._deboucingTime),this.showOptions()):this.hideOptions()):(this.hideOptions(),this._showLoading=!1,this.clearSource())}clearDeboucingTimeout(){this._changeDeboucingTimeout&&(window.clearTimeout(this._changeDeboucingTimeout),this._changeDeboucingTimeout=null)}async keyDownHandler(i){switch(this._tabPressed=!1,i.ctrlKey&&("f"!==i.key&&"F"!==i.key||(this.loadOptions(d.ADVANCED),i.stopPropagation(),i.stopImmediatePropagation(),i.preventDefault())),i.key){case"ArrowDown":i.stopPropagation(),this.canShowListOptions()&&i.preventDefault(),this.isOptionsVisible()||this.showOptions(),await this._classicSearchList.nextOption();break;case"ArrowUp":i.stopPropagation(),this.canShowListOptions()&&i.preventDefault(),await this._classicSearchList.previousOption();break;case"Enter":this.handleEventPropagation(i),this.selectCurrentOption();break;case"Escape":this.cancelPreselection();break;case"Tab":this._tabPressed=!0,this.selectCurrentOption(!1)}}handleEventPropagation(i){this._ezPopOverPlusElement.opened&&this.stopPropagateEnterKeyEvent&&i.stopPropagation()}onTextInputFocusOutHandler(){this.hideErrorOnFocusOut&&this.cancelPreselection()}canShowListOptions(){return!this._showLoading&&this._visibleOptions.length>0}onChangePreSelection(i){this._preSelection=i}async handleClickShowMore(){var i,t;if(!this.optionLoader)return;const s=null!==(t=null===(i=this._textInput)||void 0===i?void 0:i.value)&&void 0!==t?t:"",e={mode:d.ADVANCED,argument:s},h=await this.optionLoader(e,this.contextProperties);h&&!Array.isArray(h)&&this.selectOption(h)}renderShowMore(){if(this.showMore&&!this._showLoading)return s("div",{style:{display:"flex",justifyContent:"center"},"data-element-id":l.getInternalIDInfo("showMore")},s("ez-button",{onClick:async()=>await this.handleClickShowMore(),variant:"tertiary",style:{width:"100%",justifyContent:"center"},label:this.i18n("ez-classic-search.showMore")}))}render(){var i;l.addIDInfoIfNotExists(this.el,"input");const t=!(!(null===(i=this._textInput)||void 0===i?void 0:i.value)||!this._criteria&&!this.value)||this.ensureClearButtonVisible;return s(e,null,s("ez-classic-input",{"data-element-id":l.getInternalIDInfo("textInput"),class:this.suppressSearch?"suppressed-search-input":"",ref:i=>this._textInput=i,"data-slave-mode":"true",enabled:this.enabled&&!this.suppressSearch,onInput:i=>this.onTextInputChangeHandler(i),onFocusout:()=>this.onTextInputFocusOutHandler(),onKeyDown:i=>this.keyDownHandler(i),label:this.label,helpText:this.canShowError?this.errorMessage:void 0,state:this.errorMessage&&this.canShowError?"error":"default",size:this.size,placeholder:this.alternativePlaceholder,leftIconName:"search",leftIconClickable:!0,rightIconName:t?"close":null,rightIconClickable:!0,required:this.required,onIconClick:i=>this.handleClassicIconClick(i),onEzChange:i=>i.stopPropagation()}),s("ez-popover-plus",{ref:i=>this._ezPopOverPlusElement=i,autoClose:!1,overlayType:"none",useAnchorSize:!0,anchorElement:[this._textInput,this.el],"data-element-id":this.el.getAttribute("data-element-id"),onEzVisibilityChange:i=>i.stopPropagation()},s("div",null,s("classic-search-list",{ref:i=>this._classicSearchList=i,showLoading:this._showLoading,visibleOptions:this._visibleOptions,textEmptyList:this.i18n("ez-classic-search.emptyList"),canShowListOptions:this.canShowListOptions(),value:this.value,showOptionValue:this.showOptionValue,preSelection:this._preSelection,onChangeValue:({detail:i})=>this.selectOption(i),onChangePreSelection:({detail:i})=>this.onChangePreSelection(i)}),this.renderShowMore())))}get el(){return h(this)}static get watchers(){return{errorMessage:["observeErrorMessage"],value:["observeValue"],options:["observeOptions"]}}};p.style=":host{--ez-classic-search--height:42px;--ez-classic-search--width:100%;--ez-classic-search__icon--width:48px;--ez-classic-search--border-radius:var(--border--radius-medium, 12px);--ez-classic-search--border-radius-small:var(--border--radius-small, 6px);--ez-classic-search--font-size:var(--text--medium, 14px);--ez-classic-search--font-family:var(--font-pattern, Arial);--ez-classic-search--font-weight--large:var(--text-weight--large, 500);--ez-classic-search--font-weight--medium:var(--text-weight--medium, 400);--ez-classic-search--background-color--xlight:var(--background--xlight, #fff);--ez-classic-search--background-medium:var(--background--medium, #f0f3f7);--ez-classic-search--line-height:calc(var(--text--medium, 14px) + 4px);--ez-classic-search__input--background-color:var(--background--medium, #e0e0e0);--ez-classic-search__input--border:var(--border--medium, 2px solid);--ez-classic-search__input--border-color:var(--ez-classic-search__input--background-color);--ez-classic-search__input--focus--border-color:var(--color--primary, #008561);--ez-classic-search__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-classic-search__input--disabled--color:var(--text--disable, #AFB6C0);--ez-classic-search__input--error--border-color:#CC2936;--ez-classic-search__btn--color:var(--title--primary, #2B3A54);--ez-classic-search__btn-disabled--color:var(--text--disable, #AFB6C0);--ez-classic-search__btn-hover--color:var(--color--primary, #4e4e4e);--ez-classic-search__label--color:var(--title--primary, #2B3A54);--ez-classic-search--space--medium:var(--space--medium, 12px);--ez-classic-search--space--small:var(--space--small, 6px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-classic-search--width)}ez-icon{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.suppressed-search-input{--ez-classic-input__input--border-color:var(--color--strokes, #dce0e8);--ez-classic-input__input--disabled--background-color:var(--background--xlight, #fff);--ez-classic-input__input--disabled--color:var(--title--primary, #2B3A54)}.btn{outline:none;border:none;background:none;cursor:pointer;color:var(--ez-classic-search__btn--color)}.btn:disabled{cursor:not-allowed;color:var(--ez-classic-search__btn-disabled--color)}.btn:disabled:hover{cursor:not-allowed;color:var(--ez-classic-search__btn-disabled--color)}.btn:hover{color:var(--ez-classic-search__btn-hover--color)}.btn__close{visibility:hidden}ez-classic-input:hover .btn__close,ez-classic-input:focus .btn__close{visibility:visible}";export{p as ez_classic_search}
1
+ import{r as i,c as t,h as s,H as e,g as h}from"./p-23a36bb6.js";import{C as a}from"./p-ec7db713.js";import{ObjectUtils as r,StringUtils as o,ElementIDUtils as l}from"@sankhyalabs/core";import{A as n}from"./p-46b0b0c7.js";import"./p-ab574d59.js";import"./p-b853763b.js";import{i as c}from"./p-b6579f86.js";import{S as d}from"./p-5895e687.js";import"./p-47e4a8ce.js";import{r as u,a as v}from"./p-88a115b3.js";const p=class{constructor(s){i(this,s),this.ezChange=t(this,"ezChange",7),this._changeDeboucingTimeout=null,this._limitCharsToSearch=3,this._deboucingTime=300,this._maxWidthValue=0,this._tabPressed=!1,this._startHighlightTag="<span class='card-item__highlight'>",this._endHighlightTag="</span>",this._preSelection=void 0,this._visibleOptions=void 0,this._startLoading=!1,this._showLoading=!0,this._criteria=void 0,this.value=void 0,this.label=void 0,this.enabled=!0,this.errorMessage=void 0,this.size="default",this.optionLoader=void 0,this.contextProperties=void 0,this.showSelectedValue=!0,this.showOptionValue=!0,this.suppressEmptyOption=!1,this.stopPropagateEnterKeyEvent=!1,this.mode="regular",this.classic=!1,this.required=!1,this.canShowError=!0,this.hideErrorOnFocusOut=!0,this.listOptionsPosition=void 0,this.isTextSearch=!1,this.ignoreLimitCharsToSearch=!1,this.options=void 0,this.suppressSearch=!1,this.ensureClearButtonVisible=!1,this.suppressPreLoad=!0,this.autoFocus=!1,this.alternativePlaceholder=void 0,this.showMore=void 0,this.suppressInputPersist=!1,this.hideDescriptionInput=!1}observeErrorMessage(){var i;this._textInput&&(this._textInput.errorMessage=this.errorMessage,!(null===(i=this.errorMessage)||void 0===i?void 0:i.trim())&&this.errorMessage&&this.setInputValue())}getValue(i){return"object"==typeof i?null==i?void 0:i.value:i}validateNewValue(i,t){const s=this.getValue(i),e=this.getValue(t);return!("[object Object]"===s||s===e)}async observeValue(i,t){if(this._textInput&&this.validateNewValue(i,t)){if("string"==typeof i)return void await this.handleValueAsString(i);const t=this.getSelectedOption(i),s=this.getSelectedOption(this._currentValue);this.isDifferentValues(s,t)&&(this._currentValue=t,this.setInputValue(),this.ezChange.emit(null!=t?t:void 0)),this.resetOptions()}}observeOptions(i,t){!i.length&&this.suppressPreLoad||(null==i?void 0:i.join(""))!==(null==t?void 0:t.join(""))&&this.loadOptions(d.PRELOAD)}async getValueAsync(){return new Promise(this._showLoading?i=>{let t=setInterval((()=>{this._showLoading||(clearInterval(t),i(this.value))}),100)}:i=>i(this.value))}async setFocus(i){this._textInput&&this._textInput.setFocus(i)}async setBlur(){this._textInput&&this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async clearValue(){this.clearSearch()}async handleValueAsString(i){this.getSelectedOption(i)?this.setInputValue():(await this.loadDescriptionValue(i),this._currentValue&&(this.setInputValue(),this.ezChange.emit(this.value),this._currentValue=this.value))}isDifferentValues(i,t){return r.objectToString(i||{})!==r.objectToString(t||{})}getFormattedText(i){if(null==i)return;let t=this.showSelectedValue&&null!=i.value?i.label?`${i.value} - ${i.label}`:i.value:i.label;return t=null==t?void 0:t.replace(new RegExp(this._startHighlightTag,"g"),"").replace(new RegExp(this._endHighlightTag,"g"),""),t}getText(){const i=this.getSelectedOption(this._currentValue),t=this.getFormattedText(i);return u(t)}getSelectedOption(i){return"string"==typeof i||i instanceof String?this._visibleOptions.find((t=>t.value===i)):i?Object.assign(Object.assign({},i),{value:v(null==i?void 0:i.value),label:v(null==i?void 0:i.label)}):i}updateVisibleOptions(){let i=this._source||[];this._visibleOptions=this.suppressEmptyOption?i:[{value:void 0,label:""}].concat(i),this._maxWidthValue=this.getMaxWidthValue()}getMaxWidthValue(){var i;const t=[];return null===(i=this._visibleOptions)||void 0===i||i.forEach((i=>{const s=this.getWidthValue(i.value);t.includes(s)||t.push(s)})),t.length>1?Math.max(...t):0}getWidthValue(i){if(null!=this._itemValueBasis){const t=this._itemValueBasis;if(null!=i)return t.innerHTML=i,t.clientWidth>0?t.clientWidth+2:0;t.innerHTML=""}return 0}showOptions(){this.enabled&&(this.isOptionsVisible()||this._ezPopOverPlusElement.showUnder(this._textInput))}hideOptions(){this._ezPopOverPlusElement.hide()}isOptionsVisible(){return this._ezPopOverPlusElement.opened}selectCurrentOption(i=!0){void 0!==this._preSelection?(this.selectOption(this._visibleOptions[this._preSelection],i),this._preSelection=void 0):this.controlListWithOnlyOne()}updateSource(i){this._startLoading=!1,i instanceof Promise?(this._showLoading=!0,i.then((i=>{this.updateSource(i)})).finally((()=>{this._showLoading=!1})),this.updateVisibleOptions()):(this._showLoading=!1,Array.isArray(i)?(this._source=i,this.updateVisibleOptions(),this._tabPressed&&(this._tabPressed=!1,this.controlEmptySearch(!1))):this.selectOption(i))}clearSource(){this._source=[],this.updateVisibleOptions()}selectOption(i,t=!0){var s,e;const h=this.getSelectedOption(this.value),a=Object.assign(Object.assign({},i),{value:v(null==i?void 0:i.value),label:v(null==i?void 0:i.label)}),r=Object.assign(Object.assign({},a),{value:u(null==a?void 0:a.value),label:u(null==a?void 0:a.label)});if((null===(s=null==h?void 0:h.value)||void 0===s?void 0:s.toString())!==(null===(e=null==r?void 0:r.value)||void 0===e?void 0:e.toString())||null==h&&null!=r&&"value"in r){const i=(null==r?void 0:r.value)?r:void 0;this.value=i,this._currentValue=i}else this.setInputValue(),this.resetOptions();this._visibleOptions=[],this.clearSource(),t&&setTimeout((()=>{this.setFocus()}),0)}loadOptions(i,t=""){this._criteria=t,this._startLoading=!0,this.updateSource(this.optionLoader?this.optionLoader({mode:i,argument:t},this.contextProperties):this.options)}cancelPreselection(){!this._textInput.value&&this._currentValue&&this._source.length>0?this.selectOption(void 0):window.setTimeout((()=>{this.setInputValue()}),this._deboucingTime),this.resetOptions()}setInputValue(i=!0){if(this.suppressInputPersist)return void this.clearSearch();const t=this.getText();(this._textInput.value||"")!==t&&(this._textInput.value=t,i&&(this.errorMessage=null))}clearSearch(){this.value=null,this._currentValue=null,this._textInput.value=""}controlListWithOnlyOne(i=!0){var t,s;const e=null===(t=this._visibleOptions)||void 0===t?void 0:t.filter((i=>""!==i.label&&null!=i.value));if((null==e?void 0:e.length)>0){const t=new RegExp(this._startHighlightTag,"g"),h=new RegExp(this._endHighlightTag,"g");let a=o.decodeHtmlEntities(e[0].label);const r={value:null===(s=e[0].value)||void 0===s?void 0:s.replace(t,"").replace(h,""),label:null==a?void 0:a.replace(t,"").replace(h,"")};this.selectOption(r,i)}}controlEmptySearch(i=!0){var t;(null===(t=this._visibleOptions)||void 0===t?void 0:t.length)?this.controlListWithOnlyOne(i):(this.clearSearch(),n.info(this.i18n("ez-classic-search.emptyList")))}async loadDescriptionValue(i){var t,s,e;if(null==i)return;if((null===(t=this.options)||void 0===t?void 0:t.length)>0)return void this.loadOptionValue(i);const h={mode:this.hideDescriptionInput?d.LOAD_DESCRIPTION:d.PREDICTIVE,argument:i};try{const i=await(null===(s=this.optionLoader)||void 0===s?void 0:s.call(this,h,this.contextProperties));if(null==i)return;i instanceof Promise?i.then((i=>{this.setDescriptionValue(i)})):this.setDescriptionValue(i)}catch(i){throw"WarningException"===(null===(e=null==i?void 0:i.constructor)||void 0===e?void 0:e.name)&&(this.errorMessage=i.message),i}}setDescriptionValue(i){const t=(null==i?void 0:i[0])||i;null!=t&&Object.keys(t).length?(this._currentValue=t?Object.assign(Object.assign({},t),{value:v(t.value),label:v(t.label)}):t,this.value=this._currentValue,this.setTextInputValue()):this.showNoResultMessage()}setTextInputValue(){if(this._textInput&&null==this._textInput.value){if(null==this.value)return;const i="string"==typeof this.value?this.value:this.getFormattedText(this.value);this._textInput.value=u(i)}}loadOptionValue(i){var t;const s=null===(t=this.options)||void 0===t?void 0:t.find((t=>t.value===i));null!=s?this.selectOption(s):this.showNoResultMessage()}async showNoResultMessage(){this.clearSearch(),n.info(this.i18n("ez-classic-search.emptySearch",{field:this.getFieldLabel()}))}getFieldLabel(){var i;return null===(i=this.label)||void 0===i?void 0:i.replace(this.i18n("app.requiredInfo"),"").toUpperCase()}resetOptions(){this.showMore?this.handleResetOptionsWithShowMoreVisible():(this.hideOptions(),this._criteria=void 0,this._preSelection=void 0,this.updateVisibleOptions())}handleResetOptionsWithShowMoreVisible(){setTimeout((()=>{this.hideOptions(),this._criteria=void 0,this._preSelection=void 0,this.updateVisibleOptions()}),100)}async handleInitialValue(){if(!this.getValue(this.value))return;if("string"==typeof this.value)return void await this.handleValueAsString(this.value);let i=this.getFormattedText(this.value);i=u(i),this._textInput.value=i}async componentWillLoad(){if(this.i18n=await c(),void 0===this.options){this.options=[];const i=this.el.querySelectorAll("option");i&&i.forEach((i=>{let t=i.innerText,s=i.getAttribute("value"),e=i.getAttribute("details");s||(s=t),this.options.push({label:t,value:s,details:e}),i.hidden=!0}))}this.updateSource([])}componentDidRender(){var i;null===(i=this._optionsList)||void 0===i||i.querySelectorAll(".item").forEach((i=>{l.addIDInfoIfNotExists(i,"itemSearch")}))}async componentDidLoad(){this._currentValue=this.value,a.applyVarsTextInput(this.el,this._textInput),this._resizeObserver=new ResizeObserver((i=>{window.requestAnimationFrame((()=>{Array.isArray(i)}))})),this._intersectionObserver=new IntersectionObserver((i=>{i.forEach((i=>{!i.isIntersecting&&this._ezPopOverPlusElement&&this._ezPopOverPlusElement.hide()}))}),{threshold:.1}),this._textInput&&this._intersectionObserver.observe(this._textInput),await this.handleInitialValue(),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}disconnectedCallback(){var i,t;null===(i=this._resizeObserver)||void 0===i||i.disconnect(),null===(t=this._intersectionObserver)||void 0===t||t.disconnect()}handleClassicIconClick(i){const{icon:t}=i.detail;"left"!==t?this.clearSearch():this.loadOptions(d.ADVANCED)}buildNumberArgument(i){return this.isTextSearch?NaN:Number(i||void 0)}onTextInputChangeHandler(i){var t;if(this.clearDeboucingTimeout(),this._startLoading)return void(this._changeDeboucingTimeout=window.setTimeout((()=>{this.onTextInputChangeHandler(i)}),this._deboucingTime));const s=null===(t=i.target.value)||void 0===t?void 0:t.trim(),e=this.buildNumberArgument(s);this._criteria||(this._textInput.value=i.data||s),this._criteria=s,s?(this._showLoading=!1,this.clearSource(),this.ignoreLimitCharsToSearch||!isNaN(e)||s.length>=this._limitCharsToSearch?(this._showLoading=!0,this._changeDeboucingTimeout=window.setTimeout((()=>{this.loadOptions(d.PREDICTIVE,isNaN(e)?s:e.toString())}),this._deboucingTime),this.showOptions()):this.hideOptions()):(this.hideOptions(),this._showLoading=!1,this.clearSource())}clearDeboucingTimeout(){this._changeDeboucingTimeout&&(window.clearTimeout(this._changeDeboucingTimeout),this._changeDeboucingTimeout=null)}async keyDownHandler(i){switch(this._tabPressed=!1,i.ctrlKey&&("f"!==i.key&&"F"!==i.key||(this.loadOptions(d.ADVANCED),i.stopPropagation(),i.stopImmediatePropagation(),i.preventDefault())),i.key){case"ArrowDown":i.stopPropagation(),this.canShowListOptions()&&i.preventDefault(),this.isOptionsVisible()||this.showOptions(),await this._classicSearchList.nextOption();break;case"ArrowUp":i.stopPropagation(),this.canShowListOptions()&&i.preventDefault(),await this._classicSearchList.previousOption();break;case"Enter":this.handleEventPropagation(i),this.selectCurrentOption();break;case"Escape":this.cancelPreselection();break;case"Tab":this._tabPressed=!0,this.selectCurrentOption(!1)}}handleEventPropagation(i){this._ezPopOverPlusElement.opened&&this.stopPropagateEnterKeyEvent&&i.stopPropagation()}onTextInputFocusOutHandler(){this.hideErrorOnFocusOut&&this.cancelPreselection()}canShowListOptions(){return!this._showLoading&&this._visibleOptions.length>0}onChangePreSelection(i){this._preSelection=i}async handleClickShowMore(){var i,t;if(!this.optionLoader)return;const s=null!==(t=null===(i=this._textInput)||void 0===i?void 0:i.value)&&void 0!==t?t:"",e={mode:d.ADVANCED,argument:s},h=await this.optionLoader(e,this.contextProperties);h&&!Array.isArray(h)&&this.selectOption(h)}renderShowMore(){if(this.showMore&&!this._showLoading)return s("div",{style:{display:"flex",justifyContent:"center"},"data-element-id":l.getInternalIDInfo("showMore")},s("ez-button",{onClick:async()=>await this.handleClickShowMore(),variant:"tertiary",style:{width:"100%",justifyContent:"center"},label:this.i18n("ez-classic-search.showMore")}))}render(){var i;l.addIDInfoIfNotExists(this.el,"input");const t=!(!(null===(i=this._textInput)||void 0===i?void 0:i.value)||!this._criteria&&!this.value)||this.ensureClearButtonVisible;return s(e,null,s("ez-classic-input",{"data-element-id":l.getInternalIDInfo("textInput"),class:this.suppressSearch?"suppressed-search-input":"",ref:i=>this._textInput=i,"data-slave-mode":"true",enabled:this.enabled&&!this.suppressSearch,onInput:i=>this.onTextInputChangeHandler(i),onFocusout:()=>this.onTextInputFocusOutHandler(),onKeyDown:i=>this.keyDownHandler(i),label:this.label,helpText:this.canShowError?this.errorMessage:void 0,state:this.errorMessage&&this.canShowError?"error":"default",size:this.size,placeholder:this.alternativePlaceholder,leftIconName:"search",leftIconClickable:!0,rightIconName:t?"close":null,rightIconClickable:!0,required:this.required,onIconClick:i=>this.handleClassicIconClick(i),onEzChange:i=>i.stopPropagation()}),s("ez-popover-plus",{ref:i=>this._ezPopOverPlusElement=i,autoClose:!1,overlayType:"none",useAnchorSize:!0,anchorElement:[this._textInput,this.el],"data-element-id":this.el.getAttribute("data-element-id"),onEzVisibilityChange:i=>i.stopPropagation()},s("div",null,s("classic-search-list",{ref:i=>this._classicSearchList=i,showLoading:this._showLoading,visibleOptions:this._visibleOptions,textEmptyList:this.i18n("ez-classic-search.emptyList"),canShowListOptions:this.canShowListOptions(),value:this.value,showOptionValue:this.showOptionValue,preSelection:this._preSelection,onChangeValue:({detail:i})=>this.selectOption(i),onChangePreSelection:({detail:i})=>this.onChangePreSelection(i)}),this.renderShowMore())))}get el(){return h(this)}static get watchers(){return{errorMessage:["observeErrorMessage"],value:["observeValue"],options:["observeOptions"]}}};p.style=":host{--ez-classic-search--height:42px;--ez-classic-search--width:100%;--ez-classic-search__icon--width:48px;--ez-classic-search--border-radius:var(--border--radius-medium, 12px);--ez-classic-search--border-radius-small:var(--border--radius-small, 6px);--ez-classic-search--font-size:var(--text--medium, 14px);--ez-classic-search--font-family:var(--font-pattern, Arial);--ez-classic-search--font-weight--large:var(--text-weight--large, 500);--ez-classic-search--font-weight--medium:var(--text-weight--medium, 400);--ez-classic-search--background-color--xlight:var(--background--xlight, #fff);--ez-classic-search--background-medium:var(--background--medium, #f0f3f7);--ez-classic-search--line-height:calc(var(--text--medium, 14px) + 4px);--ez-classic-search__input--background-color:var(--background--medium, #e0e0e0);--ez-classic-search__input--border:var(--border--medium, 2px solid);--ez-classic-search__input--border-color:var(--ez-classic-search__input--background-color);--ez-classic-search__input--focus--border-color:var(--color--primary, #008561);--ez-classic-search__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-classic-search__input--disabled--color:var(--text--disable, #AFB6C0);--ez-classic-search__input--error--border-color:#CC2936;--ez-classic-search__btn--color:var(--title--primary, #2B3A54);--ez-classic-search__btn-disabled--color:var(--text--disable, #AFB6C0);--ez-classic-search__btn-hover--color:var(--color--primary, #4e4e4e);--ez-classic-search__label--color:var(--title--primary, #2B3A54);--ez-classic-search--space--medium:var(--space--medium, 12px);--ez-classic-search--space--small:var(--space--small, 6px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-classic-search--width)}ez-icon{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.suppressed-search-input{--ez-classic-input__input--border-color:var(--color--strokes, #dce0e8);--ez-classic-input__input--disabled--background-color:var(--background--xlight, #fff);--ez-classic-input__input--disabled--color:var(--title--primary, #2B3A54)}.btn{outline:none;border:none;background:none;cursor:pointer;color:var(--ez-classic-search__btn--color)}.btn:disabled{cursor:not-allowed;color:var(--ez-classic-search__btn-disabled--color)}.btn:disabled:hover{cursor:not-allowed;color:var(--ez-classic-search__btn-disabled--color)}.btn:hover{color:var(--ez-classic-search__btn-hover--color)}.btn__close{visibility:hidden}ez-classic-input:hover .btn__close,ez-classic-input:focus .btn__close{visibility:visible}";export{p as ez_classic_search}
@@ -1 +1 @@
1
- import{r as e,c as r,h as t,H as i}from"./p-23a36bb6.js";import{StringUtils as a}from"@sankhyalabs/core";import{i as s}from"./p-69344c23.js";const l=class{constructor(t){e(this,t),this.changeValue=r(this,"changeValue",7),this._startHighlightTag="<span class='card-item__highlight'>",this._endHighlightTag="</span>",this.showLoading=void 0,this.visibleOptions=[],this.value=void 0,this.showOptionValue=!0,this._preSelection=void 0}observerVisivleOptions(e){e.length&&this.preSelectItemByIndex(0)}async nextOption(){const e=void 0===this._preSelection?0:Math.min(this._preSelection+1,this.visibleOptions.length-1);this.preSelectItemByIndex(e)}async previousOption(){const e=void 0===this._preSelection?0:Math.max(this._preSelection-1,0);this.preSelectItemByIndex(e)}preSelectItemByIndex(e){this._preSelection=e,this.scrollToOption(this.visibleOptions[e])}selectOption(e){const r=Object.assign(Object.assign({},e),{value:null==e?void 0:e.value,label:null==e?void 0:e.label}),t=Object.assign(Object.assign({},r),{value:this.removeHighLight(null==r?void 0:r.value),label:this.removeHighLight(null==r?void 0:r.label)});this.changeValue.emit(t)}removeHighLight(e){if(!e||"string"!=typeof e)return e;const r=new RegExp(this._startHighlightTag,"g"),t=new RegExp(this._endHighlightTag,"g");return e.replace(r,"").replace(t,"")}createAndSelectOption(e){let{key:r,title:t}=e;r=String(null!=r?r:""),t=a.decodeHtmlEntities(t);const i={value:this.removeHighLight(r),label:this.removeHighLight(t)};this.selectOption(i)}scrollToOption(e){(null==e?void 0:e.value)&&this._optionsList&&window.requestAnimationFrame((()=>{var r;const t=String(null!==(r=null==e?void 0:e.value)&&void 0!==r?r:""),i=t?this._optionsList.querySelector(`div#item_${t.replace(/([ #;&,.+*~':"!^$[\]()=<>|/\\])/g,"\\$1")}`):void 0;i&&i.scrollIntoView({behavior:"smooth",block:"nearest"})}))}buildItem(e,r){var i;e.label=e.label||e.value;const a={key:String(null!==(i=e.presentationValue)&&void 0!==i?i:""),title:e.presentationLabel,details:e.details};return t("div",{style:{height:"100%"},class:r===this._preSelection?"item preselected":"item",id:`item_${e.value}`,onMouseDown:()=>this.createAndSelectOption(a),onMouseOver:()=>{this._preSelection=r}},t("ez-card-item",{item:a,compacted:!0,enableKey:this.showOptionValue}))}async selectCurrentItem(){this.selectOption(this.visibleOptions[this._preSelection])}async cancelSelection(){this.cancelPreselection()}cancelPreselection(){this._preSelection=void 0}canShowListOptions(){return!this.showLoading&&this.visibleOptions.length>0}async componentWillLoad(){this.i18n=await s()}render(){return t(i,null,t("ul",{class:"list-options",ref:e=>this._optionsList=e},!this.showLoading&&0===this.visibleOptions.length&&t("div",{class:"message"},t("span",{class:"message__no-result"},this.i18n("ez-search-plus.emptyList"))),this.showLoading&&t("div",{class:"loading__container"},t("ez-skeleton",{count:4,height:"20px"})),this.canShowListOptions()&&this.visibleOptions.map(((e,r)=>this.buildItem(e,r)))))}static get watchers(){return{visibleOptions:["observerVisivleOptions"]}}};l.style=":host{--ez-search__list-title--primary:var(--title--primary, #2B3A54);--ez-search__list-text--primary:var(--text--primary, #626e82);--ez-search__list-height:calc(var(--ez-search--font-size) + var(--ez-search--space--medium) + 4px);--ez-search__list-min-width:64px;--ez-search__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-search__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-search__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-search__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-search__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-search__scrollbar--width:var(--space--small, 6px);--ez-search--border-radius-small:var(--border--radius-small, 6px);--ez-search--font-size:var(--text--medium, 14px);--ez-search--font-family:var(--font-pattern, Arial);--ez-search--font-weight--large:var(--text-weight--large, 500);--ez-search--font-weight--medium:var(--text-weight--medium, 400);--ez-search--background-medium:var(--background--medium, #f0f3f7);--ez-search--line-height:calc(var(--text--medium, 14px) + 4px)}.list-options{position:relative;z-index:var(--more-visible, 2);margin:var(--space--small) 0px;padding:0px;padding-inline-start:0px;box-sizing:border-box;width:100%;height:100%;max-height:350px;min-width:150px;display:flex;flex-direction:column;scroll-behavior:smooth;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:var(--ez-search__scrollbar--color-clicked) var(--ez-search__scrollbar--color-background)}.list-options::-webkit-scrollbar{background-color:var(--scrollbar--background);width:var(--space--small);max-width:var(--space--small);min-width:var(--space--small);height:var(--space--small);max-height:var(--space--small);min-height:var(--space--small)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-search__scrollbar--color-background);border-radius:var(--ez-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-search__scrollbar--color-default);border-radius:var(--ez-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb:vertical:hover,.list-options::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-search__scrollbar--color-hover)}.list-options::-webkit-scrollbar-thumb:vertical:active,.list-options::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-search__scrollbar--color-clicked)}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;margin:var(--space--medium) 0px;min-height:var(--ez-search__list-height)}.message__no-result{color:var(--ez-search__list-title--primary);font-family:var(--ez-search--font-family);font-size:var(--ez-search--font-size)}.loading__container{display:flex;flex-direction:column;margin:var(--space--small)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-search__list-title--primary);font-family:var(--ez-search--font-family);font-size:var(--ez-search--font-size);line-height:var(--ez-search--line-height)}.item__label{font-weight:var(--ez-search--font-weight--medium)}.item__label--bold{font-weight:var(--ez-search--font-weight--large)}.item__value{text-align:center;color:var(--ez-search__list-text--primary);font-weight:var(--ez-search--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}.item__list>li:hover{background-color:var(--ez-search--background-medium)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-search--border-radius-small);gap:var(--space--small, 6px)}.preselected{background-color:var(--background--medium)}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@supports not (scrollbar-width: thin){.item{padding-right:8px}}";export{l as ez_search_result_list}
1
+ import{r as e,c as r,h as t,H as i}from"./p-23a36bb6.js";import{StringUtils as a}from"@sankhyalabs/core";import{i as s}from"./p-b6579f86.js";const l=class{constructor(t){e(this,t),this.changeValue=r(this,"changeValue",7),this._startHighlightTag="<span class='card-item__highlight'>",this._endHighlightTag="</span>",this.showLoading=void 0,this.visibleOptions=[],this.value=void 0,this.showOptionValue=!0,this._preSelection=void 0}observerVisivleOptions(e){e.length&&this.preSelectItemByIndex(0)}async nextOption(){const e=void 0===this._preSelection?0:Math.min(this._preSelection+1,this.visibleOptions.length-1);this.preSelectItemByIndex(e)}async previousOption(){const e=void 0===this._preSelection?0:Math.max(this._preSelection-1,0);this.preSelectItemByIndex(e)}preSelectItemByIndex(e){this._preSelection=e,this.scrollToOption(this.visibleOptions[e])}selectOption(e){const r=Object.assign(Object.assign({},e),{value:null==e?void 0:e.value,label:null==e?void 0:e.label}),t=Object.assign(Object.assign({},r),{value:this.removeHighLight(null==r?void 0:r.value),label:this.removeHighLight(null==r?void 0:r.label)});this.changeValue.emit(t)}removeHighLight(e){if(!e||"string"!=typeof e)return e;const r=new RegExp(this._startHighlightTag,"g"),t=new RegExp(this._endHighlightTag,"g");return e.replace(r,"").replace(t,"")}createAndSelectOption(e){let{key:r,title:t}=e;r=String(null!=r?r:""),t=a.decodeHtmlEntities(t);const i={value:this.removeHighLight(r),label:this.removeHighLight(t)};this.selectOption(i)}scrollToOption(e){(null==e?void 0:e.value)&&this._optionsList&&window.requestAnimationFrame((()=>{var r;const t=String(null!==(r=null==e?void 0:e.value)&&void 0!==r?r:""),i=t?this._optionsList.querySelector(`div#item_${t.replace(/([ #;&,.+*~':"!^$[\]()=<>|/\\])/g,"\\$1")}`):void 0;i&&i.scrollIntoView({behavior:"smooth",block:"nearest"})}))}buildItem(e,r){var i;e.label=e.label||e.value;const a={key:String(null!==(i=e.presentationValue)&&void 0!==i?i:""),title:e.presentationLabel,details:e.details};return t("div",{style:{height:"100%"},class:r===this._preSelection?"item preselected":"item",id:`item_${e.value}`,onMouseDown:()=>this.createAndSelectOption(a),onMouseOver:()=>{this._preSelection=r}},t("ez-card-item",{item:a,compacted:!0,enableKey:this.showOptionValue}))}async selectCurrentItem(){this.selectOption(this.visibleOptions[this._preSelection])}async cancelSelection(){this.cancelPreselection()}cancelPreselection(){this._preSelection=void 0}canShowListOptions(){return!this.showLoading&&this.visibleOptions.length>0}async componentWillLoad(){this.i18n=await s()}render(){return t(i,null,t("ul",{class:"list-options",ref:e=>this._optionsList=e},!this.showLoading&&0===this.visibleOptions.length&&t("div",{class:"message"},t("span",{class:"message__no-result"},this.i18n("ez-search-plus.emptyList"))),this.showLoading&&t("div",{class:"loading__container"},t("ez-skeleton",{count:4,height:"20px"})),this.canShowListOptions()&&this.visibleOptions.map(((e,r)=>this.buildItem(e,r)))))}static get watchers(){return{visibleOptions:["observerVisivleOptions"]}}};l.style=":host{--ez-search__list-title--primary:var(--title--primary, #2B3A54);--ez-search__list-text--primary:var(--text--primary, #626e82);--ez-search__list-height:calc(var(--ez-search--font-size) + var(--ez-search--space--medium) + 4px);--ez-search__list-min-width:64px;--ez-search__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-search__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-search__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-search__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-search__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-search__scrollbar--width:var(--space--small, 6px);--ez-search--border-radius-small:var(--border--radius-small, 6px);--ez-search--font-size:var(--text--medium, 14px);--ez-search--font-family:var(--font-pattern, Arial);--ez-search--font-weight--large:var(--text-weight--large, 500);--ez-search--font-weight--medium:var(--text-weight--medium, 400);--ez-search--background-medium:var(--background--medium, #f0f3f7);--ez-search--line-height:calc(var(--text--medium, 14px) + 4px)}.list-options{position:relative;z-index:var(--more-visible, 2);margin:var(--space--small) 0px;padding:0px;padding-inline-start:0px;box-sizing:border-box;width:100%;height:100%;max-height:350px;min-width:150px;display:flex;flex-direction:column;scroll-behavior:smooth;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:var(--ez-search__scrollbar--color-clicked) var(--ez-search__scrollbar--color-background)}.list-options::-webkit-scrollbar{background-color:var(--scrollbar--background);width:var(--space--small);max-width:var(--space--small);min-width:var(--space--small);height:var(--space--small);max-height:var(--space--small);min-height:var(--space--small)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-search__scrollbar--color-background);border-radius:var(--ez-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-search__scrollbar--color-default);border-radius:var(--ez-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb:vertical:hover,.list-options::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-search__scrollbar--color-hover)}.list-options::-webkit-scrollbar-thumb:vertical:active,.list-options::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-search__scrollbar--color-clicked)}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;margin:var(--space--medium) 0px;min-height:var(--ez-search__list-height)}.message__no-result{color:var(--ez-search__list-title--primary);font-family:var(--ez-search--font-family);font-size:var(--ez-search--font-size)}.loading__container{display:flex;flex-direction:column;margin:var(--space--small)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-search__list-title--primary);font-family:var(--ez-search--font-family);font-size:var(--ez-search--font-size);line-height:var(--ez-search--line-height)}.item__label{font-weight:var(--ez-search--font-weight--medium)}.item__label--bold{font-weight:var(--ez-search--font-weight--large)}.item__value{text-align:center;color:var(--ez-search__list-text--primary);font-weight:var(--ez-search--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}.item__list>li:hover{background-color:var(--ez-search--background-medium)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-search--border-radius-small);gap:var(--space--small, 6px)}.preselected{background-color:var(--background--medium)}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@supports not (scrollbar-width: thin){.item{padding-right:8px}}";export{l as ez_search_result_list}