@sankhyalabs/ezui 7.2.0-dev.15 → 7.2.0-dev.16

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 (267) hide show
  1. package/dist/cjs/classic-search-list_7.cjs.entry.js +2 -2
  2. package/dist/cjs/ez-actions-button.cjs.entry.js +1 -1
  3. package/dist/cjs/ez-alert-list.cjs.entry.js +1 -1
  4. package/dist/cjs/ez-alert.cjs.entry.js +1 -1
  5. package/dist/cjs/ez-application.cjs.entry.js +1 -1
  6. package/dist/cjs/ez-avatar.cjs.entry.js +1 -1
  7. package/dist/cjs/ez-badge.cjs.entry.js +1 -1
  8. package/dist/cjs/ez-breadcrumb.cjs.entry.js +1 -1
  9. package/dist/cjs/ez-button.cjs.entry.js +1 -1
  10. package/dist/cjs/ez-calendar.cjs.entry.js +1 -1
  11. package/dist/cjs/ez-card-item.cjs.entry.js +1 -1
  12. package/dist/cjs/ez-chart.cjs.entry.js +1 -1
  13. package/dist/cjs/ez-check.cjs.entry.js +1 -1
  14. package/dist/cjs/ez-chip.cjs.entry.js +1 -1
  15. package/dist/cjs/ez-classic-combo-box.cjs.entry.js +1 -1
  16. package/dist/cjs/ez-classic-date-input.cjs.entry.js +1 -1
  17. package/dist/cjs/ez-classic-date-time-input.cjs.entry.js +1 -1
  18. package/dist/cjs/ez-classic-input.cjs.entry.js +1 -1
  19. package/dist/cjs/ez-classic-number-input.cjs.entry.js +1 -1
  20. package/dist/cjs/ez-classic-search-plus.cjs.entry.js +1 -1
  21. package/dist/cjs/ez-classic-search.cjs.entry.js +1 -1
  22. package/dist/cjs/ez-classic-text-area.cjs.entry.js +1 -1
  23. package/dist/cjs/ez-classic-time-input.cjs.entry.js +1 -1
  24. package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -1
  25. package/dist/cjs/ez-combo-box.cjs.entry.js +1 -1
  26. package/dist/cjs/ez-date-input.cjs.entry.js +1 -1
  27. package/dist/cjs/ez-date-time-input.cjs.entry.js +1 -1
  28. package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
  29. package/dist/cjs/ez-double-list.cjs.entry.js +1 -1
  30. package/dist/cjs/ez-dropdown.cjs.entry.js +1 -1
  31. package/dist/cjs/ez-empty-card.cjs.entry.js +1 -1
  32. package/dist/cjs/ez-file-item.cjs.entry.js +1 -1
  33. package/dist/cjs/ez-filter-input.cjs.entry.js +1 -1
  34. package/dist/cjs/ez-form-view.cjs.entry.js +1 -1
  35. package/dist/cjs/ez-form.cjs.entry.js +2 -2
  36. package/dist/cjs/ez-grid-pagination.cjs.entry.js +1 -1
  37. package/dist/cjs/ez-grid-view.cjs.entry.js +1 -1
  38. package/dist/cjs/ez-grid.cjs.entry.js +2 -2
  39. package/dist/cjs/ez-guide-navigator.cjs.entry.js +1 -1
  40. package/dist/cjs/ez-icon.cjs.entry.js +1 -1
  41. package/dist/cjs/ez-link-builder_6.cjs.entry.js +1 -1
  42. package/dist/cjs/ez-list-item.cjs.entry.js +1 -1
  43. package/dist/cjs/ez-list.cjs.entry.js +1 -1
  44. package/dist/cjs/ez-loading-bar.cjs.entry.js +1 -1
  45. package/dist/cjs/ez-modal-container.cjs.entry.js +1 -1
  46. package/dist/cjs/ez-modal.cjs.entry.js +1 -1
  47. package/dist/cjs/ez-multi-selection-list.cjs.entry.js +1 -1
  48. package/dist/cjs/ez-number-input.cjs.entry.js +1 -1
  49. package/dist/cjs/ez-pagination.cjs.entry.js +1 -1
  50. package/dist/cjs/ez-popover-core.cjs.entry.js +1 -1
  51. package/dist/cjs/ez-popover-plus_3.cjs.entry.js +1 -1
  52. package/dist/cjs/ez-popover.cjs.entry.js +1 -1
  53. package/dist/cjs/ez-popup.cjs.entry.js +1 -1
  54. package/dist/cjs/ez-progress-bar.cjs.entry.js +1 -1
  55. package/dist/cjs/ez-radio-button.cjs.entry.js +1 -1
  56. package/dist/cjs/ez-record-navigation.cjs.entry.js +1 -1
  57. package/dist/cjs/ez-rich-toolbar-item.cjs.entry.js +1 -1
  58. package/dist/cjs/ez-scroller_2.cjs.entry.js +1 -1
  59. package/dist/cjs/ez-search-plus.cjs.entry.js +1 -1
  60. package/dist/cjs/ez-search-result-list.cjs.entry.js +1 -1
  61. package/dist/cjs/ez-search.cjs.entry.js +1 -1
  62. package/dist/cjs/ez-sidebar-navigator.cjs.entry.js +1 -1
  63. package/dist/cjs/ez-skeleton.cjs.entry.js +1 -1
  64. package/dist/cjs/ez-sortable-list.cjs.entry.js +1 -1
  65. package/dist/cjs/ez-spinner.cjs.entry.js +1 -1
  66. package/dist/cjs/ez-split-button.cjs.entry.js +1 -1
  67. package/dist/cjs/ez-split-item.cjs.entry.js +1 -1
  68. package/dist/cjs/ez-split-panel.cjs.entry.js +1 -1
  69. package/dist/cjs/ez-tabselector.cjs.entry.js +1 -1
  70. package/dist/cjs/ez-tag-input.cjs.entry.js +1 -1
  71. package/dist/cjs/ez-tag.cjs.entry.js +1 -1
  72. package/dist/cjs/ez-text-area.cjs.entry.js +1 -1
  73. package/dist/cjs/ez-text-input.cjs.entry.js +8 -6
  74. package/dist/cjs/ez-tile-medium.cjs.entry.js +1 -1
  75. package/dist/cjs/ez-tile.cjs.entry.js +1 -1
  76. package/dist/cjs/ez-time-input.cjs.entry.js +1 -1
  77. package/dist/cjs/ez-toast.cjs.entry.js +1 -1
  78. package/dist/cjs/ez-tooltip.cjs.entry.js +1 -1
  79. package/dist/cjs/ez-tree.cjs.entry.js +1 -1
  80. package/dist/cjs/ez-underface.cjs.entry.js +1 -1
  81. package/dist/cjs/ez-upload.cjs.entry.js +1 -1
  82. package/dist/cjs/ez-view-stack.cjs.entry.js +1 -1
  83. package/dist/cjs/ezui.cjs.js +1 -1
  84. package/dist/cjs/filter-column.cjs.entry.js +1 -1
  85. package/dist/cjs/{index-a7b0c73d.js → index-9e5554cb.js} +3 -0
  86. package/dist/cjs/loader.cjs.js +1 -1
  87. package/dist/cjs/{search-column-9612bd3a.js → search-column-67b641dc.js} +1 -1
  88. package/dist/collection/components/ez-text-input/ez-text-input.js +7 -5
  89. package/dist/custom-elements/index.js +7 -5
  90. package/dist/esm/classic-search-list_7.entry.js +2 -2
  91. package/dist/esm/ez-actions-button.entry.js +1 -1
  92. package/dist/esm/ez-alert-list.entry.js +1 -1
  93. package/dist/esm/ez-alert.entry.js +1 -1
  94. package/dist/esm/ez-application.entry.js +1 -1
  95. package/dist/esm/ez-avatar.entry.js +1 -1
  96. package/dist/esm/ez-badge.entry.js +1 -1
  97. package/dist/esm/ez-breadcrumb.entry.js +1 -1
  98. package/dist/esm/ez-button.entry.js +1 -1
  99. package/dist/esm/ez-calendar.entry.js +1 -1
  100. package/dist/esm/ez-card-item.entry.js +1 -1
  101. package/dist/esm/ez-chart.entry.js +1 -1
  102. package/dist/esm/ez-check.entry.js +1 -1
  103. package/dist/esm/ez-chip.entry.js +1 -1
  104. package/dist/esm/ez-classic-combo-box.entry.js +1 -1
  105. package/dist/esm/ez-classic-date-input.entry.js +1 -1
  106. package/dist/esm/ez-classic-date-time-input.entry.js +1 -1
  107. package/dist/esm/ez-classic-input.entry.js +1 -1
  108. package/dist/esm/ez-classic-number-input.entry.js +1 -1
  109. package/dist/esm/ez-classic-search-plus.entry.js +1 -1
  110. package/dist/esm/ez-classic-search.entry.js +1 -1
  111. package/dist/esm/ez-classic-text-area.entry.js +1 -1
  112. package/dist/esm/ez-classic-time-input.entry.js +1 -1
  113. package/dist/esm/ez-collapsible-box.entry.js +1 -1
  114. package/dist/esm/ez-combo-box.entry.js +1 -1
  115. package/dist/esm/ez-date-input.entry.js +1 -1
  116. package/dist/esm/ez-date-time-input.entry.js +1 -1
  117. package/dist/esm/ez-dialog.entry.js +1 -1
  118. package/dist/esm/ez-double-list.entry.js +1 -1
  119. package/dist/esm/ez-dropdown.entry.js +1 -1
  120. package/dist/esm/ez-empty-card.entry.js +1 -1
  121. package/dist/esm/ez-file-item.entry.js +1 -1
  122. package/dist/esm/ez-filter-input.entry.js +1 -1
  123. package/dist/esm/ez-form-view.entry.js +1 -1
  124. package/dist/esm/ez-form.entry.js +2 -2
  125. package/dist/esm/ez-grid-pagination.entry.js +1 -1
  126. package/dist/esm/ez-grid-view.entry.js +1 -1
  127. package/dist/esm/ez-grid.entry.js +2 -2
  128. package/dist/esm/ez-guide-navigator.entry.js +1 -1
  129. package/dist/esm/ez-icon.entry.js +1 -1
  130. package/dist/esm/ez-link-builder_6.entry.js +1 -1
  131. package/dist/esm/ez-list-item.entry.js +1 -1
  132. package/dist/esm/ez-list.entry.js +1 -1
  133. package/dist/esm/ez-loading-bar.entry.js +1 -1
  134. package/dist/esm/ez-modal-container.entry.js +1 -1
  135. package/dist/esm/ez-modal.entry.js +1 -1
  136. package/dist/esm/ez-multi-selection-list.entry.js +1 -1
  137. package/dist/esm/ez-number-input.entry.js +1 -1
  138. package/dist/esm/ez-pagination.entry.js +1 -1
  139. package/dist/esm/ez-popover-core.entry.js +1 -1
  140. package/dist/esm/ez-popover-plus_3.entry.js +1 -1
  141. package/dist/esm/ez-popover.entry.js +1 -1
  142. package/dist/esm/ez-popup.entry.js +1 -1
  143. package/dist/esm/ez-progress-bar.entry.js +1 -1
  144. package/dist/esm/ez-radio-button.entry.js +1 -1
  145. package/dist/esm/ez-record-navigation.entry.js +1 -1
  146. package/dist/esm/ez-rich-toolbar-item.entry.js +1 -1
  147. package/dist/esm/ez-scroller_2.entry.js +1 -1
  148. package/dist/esm/ez-search-plus.entry.js +1 -1
  149. package/dist/esm/ez-search-result-list.entry.js +1 -1
  150. package/dist/esm/ez-search.entry.js +1 -1
  151. package/dist/esm/ez-sidebar-navigator.entry.js +1 -1
  152. package/dist/esm/ez-skeleton.entry.js +1 -1
  153. package/dist/esm/ez-sortable-list.entry.js +1 -1
  154. package/dist/esm/ez-spinner.entry.js +1 -1
  155. package/dist/esm/ez-split-button.entry.js +1 -1
  156. package/dist/esm/ez-split-item.entry.js +1 -1
  157. package/dist/esm/ez-split-panel.entry.js +1 -1
  158. package/dist/esm/ez-tabselector.entry.js +1 -1
  159. package/dist/esm/ez-tag-input.entry.js +1 -1
  160. package/dist/esm/ez-tag.entry.js +1 -1
  161. package/dist/esm/ez-text-area.entry.js +1 -1
  162. package/dist/esm/ez-text-input.entry.js +8 -6
  163. package/dist/esm/ez-tile-medium.entry.js +1 -1
  164. package/dist/esm/ez-tile.entry.js +1 -1
  165. package/dist/esm/ez-time-input.entry.js +1 -1
  166. package/dist/esm/ez-toast.entry.js +1 -1
  167. package/dist/esm/ez-tooltip.entry.js +1 -1
  168. package/dist/esm/ez-tree.entry.js +1 -1
  169. package/dist/esm/ez-underface.entry.js +1 -1
  170. package/dist/esm/ez-upload.entry.js +1 -1
  171. package/dist/esm/ez-view-stack.entry.js +1 -1
  172. package/dist/esm/ezui.js +2 -2
  173. package/dist/esm/filter-column.entry.js +1 -1
  174. package/dist/esm/{index-baa5e267.js → index-5a720e56.js} +3 -1
  175. package/dist/esm/loader.js +2 -2
  176. package/dist/esm/{search-column-dba4853a.js → search-column-88d17d2f.js} +1 -1
  177. package/dist/ezui/ezui.esm.js +1 -1
  178. package/dist/ezui/{p-e75c7a23.entry.js → p-000159dc.entry.js} +1 -1
  179. package/dist/ezui/{p-e2b3970c.entry.js → p-03cbd900.entry.js} +1 -1
  180. package/dist/ezui/{p-93e1c917.entry.js → p-05e68ab3.entry.js} +1 -1
  181. package/dist/ezui/{p-6d596a5a.entry.js → p-0b531233.entry.js} +1 -1
  182. package/dist/ezui/{p-3fae7072.entry.js → p-0c8aee78.entry.js} +1 -1
  183. package/dist/ezui/{p-b06294c9.entry.js → p-0fc00cfe.entry.js} +1 -1
  184. package/dist/ezui/p-14d6aeb8.entry.js +1 -0
  185. package/dist/ezui/{p-108503ed.entry.js → p-1516f24d.entry.js} +1 -1
  186. package/dist/ezui/{p-b8cd501a.entry.js → p-16947cdc.entry.js} +1 -1
  187. package/dist/ezui/{p-2528e988.entry.js → p-169d460d.entry.js} +1 -1
  188. package/dist/ezui/{p-6f77a359.entry.js → p-1723f728.entry.js} +1 -1
  189. package/dist/ezui/{p-0ac8bd66.entry.js → p-1a4d64f1.entry.js} +1 -1
  190. package/dist/ezui/{p-fc72aeb8.entry.js → p-1b7d0c1c.entry.js} +1 -1
  191. package/dist/ezui/{p-fc11f5b9.entry.js → p-1c9eba36.entry.js} +1 -1
  192. package/dist/ezui/{p-83bddbbb.js → p-27add1a3.js} +1 -1
  193. package/dist/ezui/{p-be953397.entry.js → p-280f0a4e.entry.js} +1 -1
  194. package/dist/ezui/{p-2ebd7383.entry.js → p-2d429965.entry.js} +1 -1
  195. package/dist/ezui/{p-b986da95.entry.js → p-37e1b560.entry.js} +1 -1
  196. package/dist/ezui/{p-7dad8018.entry.js → p-3d3345e5.entry.js} +1 -1
  197. package/dist/ezui/{p-45245c32.entry.js → p-4019bd3c.entry.js} +1 -1
  198. package/dist/ezui/{p-cb00863d.entry.js → p-43835ea6.entry.js} +1 -1
  199. package/dist/ezui/{p-fa6732f2.entry.js → p-44b39e81.entry.js} +1 -1
  200. package/dist/ezui/{p-9bd3e28b.entry.js → p-468e30b0.entry.js} +1 -1
  201. package/dist/ezui/{p-0d80e3ec.entry.js → p-49eb13ea.entry.js} +1 -1
  202. package/dist/ezui/{p-d70805e4.entry.js → p-4cb3e520.entry.js} +1 -1
  203. package/dist/ezui/{p-7424d520.entry.js → p-4d11704d.entry.js} +1 -1
  204. package/dist/ezui/{p-f2e0acf5.entry.js → p-5041efd4.entry.js} +1 -1
  205. package/dist/ezui/{p-6369a0cd.entry.js → p-51e34317.entry.js} +1 -1
  206. package/dist/ezui/{p-cf66ace0.entry.js → p-55d2be5c.entry.js} +1 -1
  207. package/dist/ezui/{p-881abc22.entry.js → p-5c0b784f.entry.js} +1 -1
  208. package/dist/ezui/{p-9bd78d39.entry.js → p-5ed0d633.entry.js} +1 -1
  209. package/dist/ezui/{p-1f50fa05.entry.js → p-6b51c9cc.entry.js} +1 -1
  210. package/dist/ezui/{p-2ae127bc.entry.js → p-6b6f9589.entry.js} +1 -1
  211. package/dist/ezui/{p-d8b69419.entry.js → p-6df315ac.entry.js} +1 -1
  212. package/dist/ezui/p-6ec40dec.entry.js +1 -0
  213. package/dist/ezui/{p-5ed81457.entry.js → p-6fc26622.entry.js} +1 -1
  214. package/dist/ezui/{p-99556756.entry.js → p-7137d19f.entry.js} +1 -1
  215. package/dist/ezui/{p-d6f50207.entry.js → p-770cf2b8.entry.js} +1 -1
  216. package/dist/ezui/{p-91c9d50e.entry.js → p-78e975b4.entry.js} +1 -1
  217. package/dist/ezui/{p-0592535f.entry.js → p-7c02817b.entry.js} +1 -1
  218. package/dist/ezui/{p-c25a4d30.entry.js → p-7c38cce4.entry.js} +1 -1
  219. package/dist/ezui/{p-66455069.entry.js → p-7d229c1d.entry.js} +1 -1
  220. package/dist/ezui/{p-1e7a8633.entry.js → p-81461d2f.entry.js} +1 -1
  221. package/dist/ezui/{p-8df1ca33.entry.js → p-82fa4b09.entry.js} +1 -1
  222. package/dist/ezui/{p-a4735a12.entry.js → p-894392ca.entry.js} +1 -1
  223. package/dist/ezui/{p-cfe41b07.entry.js → p-8da3753c.entry.js} +1 -1
  224. package/dist/ezui/{p-fb27b98d.entry.js → p-9002ffd2.entry.js} +1 -1
  225. package/dist/ezui/p-93c142dc.entry.js +1 -0
  226. package/dist/ezui/{p-7b078125.entry.js → p-95f45fc3.entry.js} +1 -1
  227. package/dist/ezui/{p-f34ec732.entry.js → p-980f1f18.entry.js} +1 -1
  228. package/dist/ezui/{p-7a07c50f.entry.js → p-9820e95f.entry.js} +1 -1
  229. package/dist/ezui/{p-73461028.entry.js → p-99aacd56.entry.js} +1 -1
  230. package/dist/ezui/{p-a3075f52.entry.js → p-9bcfa689.entry.js} +1 -1
  231. package/dist/ezui/{p-7df45688.entry.js → p-a6df6cdc.entry.js} +1 -1
  232. package/dist/ezui/{p-ed790867.entry.js → p-a8379365.entry.js} +1 -1
  233. package/dist/ezui/{p-d6742c1e.entry.js → p-a9432878.entry.js} +1 -1
  234. package/dist/ezui/{p-2856c545.entry.js → p-ac004c0c.entry.js} +1 -1
  235. package/dist/ezui/{p-312bd3c6.entry.js → p-acc2625d.entry.js} +1 -1
  236. package/dist/ezui/{p-72e77b45.entry.js → p-ad63415f.entry.js} +1 -1
  237. package/dist/ezui/{p-e3d6b544.entry.js → p-b08ed58c.entry.js} +1 -1
  238. package/dist/ezui/{p-1166b2d5.entry.js → p-b14959bf.entry.js} +1 -1
  239. package/dist/ezui/{p-e8c57463.entry.js → p-b21efe83.entry.js} +1 -1
  240. package/dist/ezui/{p-063bb342.entry.js → p-b457f321.entry.js} +1 -1
  241. package/dist/ezui/{p-d5684cdc.entry.js → p-b9ebe8b7.entry.js} +1 -1
  242. package/dist/ezui/{p-a0bf1fc7.entry.js → p-bc693db6.entry.js} +1 -1
  243. package/dist/ezui/{p-c37fb359.entry.js → p-c06cf215.entry.js} +1 -1
  244. package/dist/ezui/{p-9f5fa3f9.entry.js → p-c2b20f78.entry.js} +1 -1
  245. package/dist/ezui/{p-178cb9df.entry.js → p-c6021712.entry.js} +1 -1
  246. package/dist/ezui/{p-6020f3d5.entry.js → p-c754774e.entry.js} +1 -1
  247. package/dist/ezui/{p-e8cd003b.entry.js → p-cb951410.entry.js} +1 -1
  248. package/dist/ezui/p-cf22810f.entry.js +1 -0
  249. package/dist/ezui/{p-20c024f7.entry.js → p-cf33bc48.entry.js} +1 -1
  250. package/dist/ezui/{p-d75f583b.entry.js → p-d0021f0f.entry.js} +1 -1
  251. package/dist/ezui/{p-46b1b2ac.entry.js → p-dc8874b8.entry.js} +1 -1
  252. package/dist/ezui/{p-54af1af0.entry.js → p-dccb427d.entry.js} +1 -1
  253. package/dist/ezui/{p-a80b1287.entry.js → p-dfca5946.entry.js} +1 -1
  254. package/dist/ezui/{p-7f792043.entry.js → p-e195eaad.entry.js} +1 -1
  255. package/dist/ezui/{p-e692c2a7.entry.js → p-e25bc610.entry.js} +1 -1
  256. package/dist/ezui/{p-23a36bb6.js → p-e4c7eb39.js} +2 -2
  257. package/dist/ezui/{p-e7a7c594.entry.js → p-e9b409c1.entry.js} +1 -1
  258. package/dist/ezui/{p-f498f6b5.entry.js → p-eaa54dab.entry.js} +1 -1
  259. package/dist/ezui/{p-dfced8c7.entry.js → p-f25873c9.entry.js} +1 -1
  260. package/dist/ezui/{p-a3ada561.entry.js → p-f26b97e9.entry.js} +1 -1
  261. package/dist/ezui/{p-411c0222.entry.js → p-f7ca8634.entry.js} +1 -1
  262. package/dist/ezui/{p-160a268d.entry.js → p-f9a7255c.entry.js} +1 -1
  263. package/package.json +1 -1
  264. package/dist/ezui/p-30c5f48a.entry.js +0 -1
  265. package/dist/ezui/p-60c28299.entry.js +0 -1
  266. package/dist/ezui/p-bc2f844e.entry.js +0 -1
  267. package/dist/ezui/p-d8cc640d.entry.js +0 -1
@@ -1 +1 @@
1
- import{r as t,c as i,h as s,H as e,g as r}from"./p-23a36bb6.js";import{ElementIDUtils as o,MaskFormatter as a}from"@sankhyalabs/core";class n{constructor(t){this.mask=t,this.maskChars={"#":t=>/\d/.test(t),U:t=>/[a-zA-Z]/.test(t),L:t=>/[a-zA-Z]/.test(t),A:t=>/[a-zA-Z0-9]/.test(t),Z:t=>/[a-zA-Z0-9]/.test(t),"?":t=>/[a-zA-Z]/.test(t),"*":()=>!0}}format(t){if(!t||!this.mask)return t;const i=this.removeIncompatibleChars(t);let s="",e=0,r=0;for(;r<this.mask.length&&e<i.length;){const t=this.mask[r],o=i[e];if("'"!==t){if(this.maskChars[t]){if(!this.maskChars[t](o)){e++;continue}s+="U"===t||"Z"===t?o.toUpperCase():"L"===t?o.toLowerCase():o,e++}else s+=t,o===t&&e++;r++}else r++,r<this.mask.length&&(s+=this.mask[r],r++)}return s}removeIncompatibleChars(t){let i="";for(let s=0;s<t.length;s++){const e=t[s];let r=!1;for(const t in this.maskChars)if(this.maskChars[t](e)){r=!0;break}if(!r)for(let t=0;t<this.mask.length;t++)if(this.mask[t]===e&&!this.maskChars[this.mask[t]]){r=!0;break}r&&(i+=e)}return i}removeMask(t){if(!t||!this.mask)return t;let i="",s=0,e=0;for(;s<t.length&&e<this.mask.length;){const r=this.mask[e],o=t[s];"'"!==r?(this.maskChars[r]?(this.maskChars[r](o)&&(i+=o),s++):o===r&&s++,e++):(e++,e<this.mask.length&&(o===this.mask[e]&&s++,e++))}for(;s<t.length;){const e=t[s];/[a-zA-Z0-9]/.test(e)&&(i+=e),s++}return i}getMask(){return this.mask}generatePlaceholder(){if(!this.mask)return"";let t="",i=0;for(;i<this.mask.length;){const s=this.mask[i];if("'"!==s){if(this.maskChars[s])switch(s){case"#":case"~":t+="0";break;case"U":case"L":case"?":case"A":t+="A";break;default:t+="_"}else t+=s;i++}else i++,i<this.mask.length&&(t+=this.mask[i],i++)}return t}}const c=class{constructor(s){t(this,s),this.ezChange=i(this,"ezChange",7),this.ezBlur=i(this,"ezBlur",7),this.ezFocus=i(this,"ezFocus",7),this.iconClick=i(this,"iconClick",7),this._internalValueChange=!1,this.type="text",this.value=void 0,this.label=void 0,this.helpText=void 0,this.errorMessage=void 0,this.placeholder=void 0,this.enabled=!0,this.readonly=!1,this.required=!1,this.name=void 0,this.size="default",this.minlength=void 0,this.maxlength=void 0,this.leftIconName=void 0,this.rightIconName=void 0,this.rightIconTooltip=void 0,this.leftIconTooltip=void 0,this.state="default",this.leftIconClickable=!1,this.rightIconClickable=!1,this.mask=void 0,this.emitMaskedValue=!1}async setFocus(t){(null==t?void 0:t.selectText)&&this._inputElem.select(),(null==t?void 0:t.preventScroll)||this._inputElem.scrollIntoView({behavior:"smooth",block:"center"}),this._inputElem.focus({preventScroll:!0})}async setBlur(){this._inputElem.blur()}async syncValue(){if(this._internalValueChange)this._internalValueChange=!1;else if(this.value&&this._maskFormatter&&this._inputElem){const t=this._maskFormatter.format(this.value);this._inputElem.value=t}else this._inputElem&&(this._inputElem.value=this.value||"")}async observeErrorMessage(t){this.state=t&&""!==t.trim()?"error":"default"}onInput(t){try{const i=t.target,s=i.value;if(this._maskFormatter){const{formattedValue:t,cleanValue:e}=this.processInputWithMask(s);this.updateInputValue(i,t,e)}else this.updateInputValueWithoutMask(s)}catch(t){console.error("Error processing input event:",t)}}processInputWithMask(t){return"cgc_cpf"===this.mask?this.processCgcCpfMask(t):this.processRegularMask(t)}processCgcCpfMask(t){const i=t.replace(/\D/g,"");return 11===i.length||14===i.length?(this._maskFormatter=new n(11===i.length?a.DEFAULT_MASKS.cpf:a.DEFAULT_MASKS.cnpj),{formattedValue:this._maskFormatter.format(i),cleanValue:i}):{formattedValue:i,cleanValue:i}}processRegularMask(t){const i=this._maskFormatter.format(t);return{formattedValue:i,cleanValue:this._maskFormatter.removeMask(i)}}updateInputValue(t,i,s){t.value=i,this._internalValueChange=!0,this.value=s,this.ezChange.emit(this.emitMaskedValue?i:s)}updateInputValueWithoutMask(t){this._internalValueChange=!0,this.value=t,this.ezChange.emit(t)}onBlur(){this.ezBlur.emit(this.value)}onFocus(){this.ezFocus.emit(this.value)}handleIconClick(t,i){this.enabled&&("left"===i&&!this.leftIconClickable||"right"===i&&!this.rightIconClickable?this.setFocus({preventScroll:!0}):(t.stopPropagation(),this.iconClick.emit({icon:i})))}addInfoId(){this._element&&o.addIDInfo(this._element),this._inputElem&&o.addIDInfo(this._inputElem,"classic-input",{id:"embedded"})}buildPlaceholder(){!this.placeholder&&this._maskFormatter&&(this.placeholder=this._maskFormatter.generatePlaceholder())}buildMaskFormatter(){if(this.mask&&(!this._maskFormatter||"cgc_cpf"===this.mask)){const t=this.getMaskToBuilder();this._maskFormatter=t?new n(t):void 0}}getMaskToBuilder(){return"cgc_cpf"===this.mask?this.getCGCCpfMask():"phone"===this.mask?this.getPhoneMask():this.mask in a.DEFAULT_MASKS?a.DEFAULT_MASKS[this.mask]:this.mask}getPhoneMask(){return this.value&&10===this.value.length?n.DEFAULT_MASKS?n.DEFAULT_MASKS.phone:void 0:this.value&&11===this.value.length&&n.DEFAULT_MASKS?n.DEFAULT_MASKS.phone_mobile:void 0}getCGCCpfMask(){var t,i;return 11===(null===(t=this.value)||void 0===t?void 0:t.length)?a.DEFAULT_MASKS.cpf:14===(null===(i=this.value)||void 0===i?void 0:i.length)?a.DEFAULT_MASKS.cnpj:void 0}componentDidRender(){this.buildMaskFormatter(),this.buildPlaceholder(),this.syncValue()}componentDidLoad(){this.syncValue(),this.addInfoId()}render(){return s(e,null,s("label",{title:this.label,htmlFor:this.name},this.label,this.required&&s("span",{class:"required-indicator"},"*")),s("div",{class:"input-container "+(this.size?`input-container--${this.size}`:""),"data-state":this.state,"data-disabled":(!this.enabled).toString(),onClick:()=>this.setFocus({preventScroll:!0})},this.leftIconName&&s("ez-icon",{iconName:this.leftIconName,title:this.leftIconTooltip,onClick:t=>this.handleIconClick(t,"left"),class:{"icon-clickable":this.leftIconClickable}}),s("input",{ref:t=>this._inputElem=t,id:this.name,type:this.type,title:this.value,placeholder:this.placeholder,disabled:!this.enabled,readonly:this.readonly,name:this.name,minlength:this.minlength,maxlength:this.maxlength,onInput:t=>this.onInput(t),onBlur:this.onBlur.bind(this),onFocus:this.onFocus.bind(this)}),this.rightIconName&&s("ez-icon",{iconName:this.rightIconName,title:this.rightIconTooltip,onClick:t=>this.handleIconClick(t,"right"),class:{"icon-clickable":this.rightIconClickable}})),(this.helpText||this.errorMessage)&&s("span",{id:"input_helpText",title:this.errorMessage||this.helpText},this.errorMessage||this.helpText))}get _element(){return r(this)}static get watchers(){return{value:["syncValue"],errorMessage:["observeErrorMessage"]}}};c.style=':host{display:flex;flex-direction:column;align-items:flex-start;box-sizing:border-box;font-family:var(--font--pattern, Arial, sans-serif);font-size:var(--font-size--default, 14px);color:var(--color--ocean-green-1000, #00281D);border:none;padding:0;padding-inline:var(--space--2, 2px);width:100%;--ez-classic-input--label-color:var(--color--ocean-green-1000, #00281D);--ez-classic-input--border-color-default:var(--color--gray-200, #D2D2D3);--ez-classic-input--border-color-focus:var(--color--gray-300, #A4A5A7);--ez-classic-input--border-color-success:var(--color--green-600, #157A00);--ez-classic-input--border-color-error:var(--color--red-600, #BD0025);--ez-classic-input--border-color-warning:var(--color--yellow-600, #EFB103);--ez-classic-input--background-color:var(--color--gray-70, #FFFFFF);--ez-classic-input--background-color-disabled:var(--color--gray-90, #EAEAEA);--ez-classic-input--text-color:var(--color--ocean-green-1000, #00281D);--ez-classic-input--placeholder-color:#bdbdbd;--ez-classic-input--icon-color:var(--color--gray-400, #77777A);--ez-classic-input--helptext-color:var(--color--ocean-green-1000, #00281D);--ez-classic-input--height:var(--space--56, 56px);--ez-classic-input--height-small:var(--space--48, 48px);--ez-classic-input--height-xsmall:var(--space--40, 40px);--ez-classic-input--gap:var(--space--10, 10px);--ez-classic-input--padding-inline:var(--space--16, 16px)}.input-container{display:flex;flex-direction:row;align-items:center;width:100%;border:none;border-radius:var(--border--radius-8, 8px);padding-inline:var(--ez-classic-input--padding-inline);box-sizing:border-box;gap:var(--ez-classic-input--gap);margin-block:var(--space--4, 4px);transition:box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);height:var(--ez-classic-input--height);background-color:var(--ez-classic-input--background-color)}.input-container--small{height:var(--ez-classic-input--height-small)}.input-container--xsmall{height:var(--ez-classic-input--height-xsmall)}.input-container,.input-container[data-state="default"]{box-shadow:0 0 0 1px var(--ez-classic-input--border-color-default)}.input-container[data-state="success"]{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-input--border-color-success)}.input-container[data-state="error"]{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-input--border-color-error)}.input-container[data-state="warning"]{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-input--border-color-warning)}.input-container:focus-within{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-input--border-color-focus)}ez-icon{min-width:var(--space--24, 24px);color:var(--ez-classic-input--icon-color)}input{flex:1;border:none;outline:none;background:transparent;height:100%;width:100%;padding:0;font-family:var(--font--pattern, Arial, sans-serif);font-size:var(--font-size--default, 14px);color:var(--color--ocean-green-1000, #00281D);text-overflow:ellipsis;color:var(--ez-classic-input--text-color)}input::placeholder{color:var(--ez-classic-input--placeholder-color)}.input-container[data-disabled="true"]{cursor:not-allowed;background:var(--ez-classic-input--background-color-disabled);border-color:var(--ez-classic-input--border-color-default)}.input-container[data-disabled="true"]>*{cursor:not-allowed}.input-container input:read-only{cursor:default}@keyframes ez-helptext-fadein{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}span{font-size:var(--font-size--xsmall, 10px);line-height:var(--line-height--16, 16px);overflow:hidden;text-overflow:ellipsis;animation:ez-helptext-fadein 0.3s ease;color:var(--ez-classic-input--helptext-color)}label{display:block;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-classic-input--label-color)}.icon-clickable{cursor:pointer}.required-indicator{font-size:var(--font--size--default, 14px);font-family:var(--font--pattern, \'Roboto\');color:var(--color--red-600, #BD0025);margin-left:var(--space--4, 4px);vertical-align:top}';export{c as ez_classic_input}
1
+ import{r as t,c as i,h as s,H as e,g as r}from"./p-e4c7eb39.js";import{ElementIDUtils as o,MaskFormatter as a}from"@sankhyalabs/core";class n{constructor(t){this.mask=t,this.maskChars={"#":t=>/\d/.test(t),U:t=>/[a-zA-Z]/.test(t),L:t=>/[a-zA-Z]/.test(t),A:t=>/[a-zA-Z0-9]/.test(t),Z:t=>/[a-zA-Z0-9]/.test(t),"?":t=>/[a-zA-Z]/.test(t),"*":()=>!0}}format(t){if(!t||!this.mask)return t;const i=this.removeIncompatibleChars(t);let s="",e=0,r=0;for(;r<this.mask.length&&e<i.length;){const t=this.mask[r],o=i[e];if("'"!==t){if(this.maskChars[t]){if(!this.maskChars[t](o)){e++;continue}s+="U"===t||"Z"===t?o.toUpperCase():"L"===t?o.toLowerCase():o,e++}else s+=t,o===t&&e++;r++}else r++,r<this.mask.length&&(s+=this.mask[r],r++)}return s}removeIncompatibleChars(t){let i="";for(let s=0;s<t.length;s++){const e=t[s];let r=!1;for(const t in this.maskChars)if(this.maskChars[t](e)){r=!0;break}if(!r)for(let t=0;t<this.mask.length;t++)if(this.mask[t]===e&&!this.maskChars[this.mask[t]]){r=!0;break}r&&(i+=e)}return i}removeMask(t){if(!t||!this.mask)return t;let i="",s=0,e=0;for(;s<t.length&&e<this.mask.length;){const r=this.mask[e],o=t[s];"'"!==r?(this.maskChars[r]?(this.maskChars[r](o)&&(i+=o),s++):o===r&&s++,e++):(e++,e<this.mask.length&&(o===this.mask[e]&&s++,e++))}for(;s<t.length;){const e=t[s];/[a-zA-Z0-9]/.test(e)&&(i+=e),s++}return i}getMask(){return this.mask}generatePlaceholder(){if(!this.mask)return"";let t="",i=0;for(;i<this.mask.length;){const s=this.mask[i];if("'"!==s){if(this.maskChars[s])switch(s){case"#":case"~":t+="0";break;case"U":case"L":case"?":case"A":t+="A";break;default:t+="_"}else t+=s;i++}else i++,i<this.mask.length&&(t+=this.mask[i],i++)}return t}}const c=class{constructor(s){t(this,s),this.ezChange=i(this,"ezChange",7),this.ezBlur=i(this,"ezBlur",7),this.ezFocus=i(this,"ezFocus",7),this.iconClick=i(this,"iconClick",7),this._internalValueChange=!1,this.type="text",this.value=void 0,this.label=void 0,this.helpText=void 0,this.errorMessage=void 0,this.placeholder=void 0,this.enabled=!0,this.readonly=!1,this.required=!1,this.name=void 0,this.size="default",this.minlength=void 0,this.maxlength=void 0,this.leftIconName=void 0,this.rightIconName=void 0,this.rightIconTooltip=void 0,this.leftIconTooltip=void 0,this.state="default",this.leftIconClickable=!1,this.rightIconClickable=!1,this.mask=void 0,this.emitMaskedValue=!1}async setFocus(t){(null==t?void 0:t.selectText)&&this._inputElem.select(),(null==t?void 0:t.preventScroll)||this._inputElem.scrollIntoView({behavior:"smooth",block:"center"}),this._inputElem.focus({preventScroll:!0})}async setBlur(){this._inputElem.blur()}async syncValue(){if(this._internalValueChange)this._internalValueChange=!1;else if(this.value&&this._maskFormatter&&this._inputElem){const t=this._maskFormatter.format(this.value);this._inputElem.value=t}else this._inputElem&&(this._inputElem.value=this.value||"")}async observeErrorMessage(t){this.state=t&&""!==t.trim()?"error":"default"}onInput(t){try{const i=t.target,s=i.value;if(this._maskFormatter){const{formattedValue:t,cleanValue:e}=this.processInputWithMask(s);this.updateInputValue(i,t,e)}else this.updateInputValueWithoutMask(s)}catch(t){console.error("Error processing input event:",t)}}processInputWithMask(t){return"cgc_cpf"===this.mask?this.processCgcCpfMask(t):this.processRegularMask(t)}processCgcCpfMask(t){const i=t.replace(/\D/g,"");return 11===i.length||14===i.length?(this._maskFormatter=new n(11===i.length?a.DEFAULT_MASKS.cpf:a.DEFAULT_MASKS.cnpj),{formattedValue:this._maskFormatter.format(i),cleanValue:i}):{formattedValue:i,cleanValue:i}}processRegularMask(t){const i=this._maskFormatter.format(t);return{formattedValue:i,cleanValue:this._maskFormatter.removeMask(i)}}updateInputValue(t,i,s){t.value=i,this._internalValueChange=!0,this.value=s,this.ezChange.emit(this.emitMaskedValue?i:s)}updateInputValueWithoutMask(t){this._internalValueChange=!0,this.value=t,this.ezChange.emit(t)}onBlur(){this.ezBlur.emit(this.value)}onFocus(){this.ezFocus.emit(this.value)}handleIconClick(t,i){this.enabled&&("left"===i&&!this.leftIconClickable||"right"===i&&!this.rightIconClickable?this.setFocus({preventScroll:!0}):(t.stopPropagation(),this.iconClick.emit({icon:i})))}addInfoId(){this._element&&o.addIDInfo(this._element),this._inputElem&&o.addIDInfo(this._inputElem,"classic-input",{id:"embedded"})}buildPlaceholder(){!this.placeholder&&this._maskFormatter&&(this.placeholder=this._maskFormatter.generatePlaceholder())}buildMaskFormatter(){if(this.mask&&(!this._maskFormatter||"cgc_cpf"===this.mask)){const t=this.getMaskToBuilder();this._maskFormatter=t?new n(t):void 0}}getMaskToBuilder(){return"cgc_cpf"===this.mask?this.getCGCCpfMask():"phone"===this.mask?this.getPhoneMask():this.mask in a.DEFAULT_MASKS?a.DEFAULT_MASKS[this.mask]:this.mask}getPhoneMask(){return this.value&&10===this.value.length?n.DEFAULT_MASKS?n.DEFAULT_MASKS.phone:void 0:this.value&&11===this.value.length&&n.DEFAULT_MASKS?n.DEFAULT_MASKS.phone_mobile:void 0}getCGCCpfMask(){var t,i;return 11===(null===(t=this.value)||void 0===t?void 0:t.length)?a.DEFAULT_MASKS.cpf:14===(null===(i=this.value)||void 0===i?void 0:i.length)?a.DEFAULT_MASKS.cnpj:void 0}componentDidRender(){this.buildMaskFormatter(),this.buildPlaceholder(),this.syncValue()}componentDidLoad(){this.syncValue(),this.addInfoId()}render(){return s(e,null,s("label",{title:this.label,htmlFor:this.name},this.label,this.required&&s("span",{class:"required-indicator"},"*")),s("div",{class:"input-container "+(this.size?`input-container--${this.size}`:""),"data-state":this.state,"data-disabled":(!this.enabled).toString(),onClick:()=>this.setFocus({preventScroll:!0})},this.leftIconName&&s("ez-icon",{iconName:this.leftIconName,title:this.leftIconTooltip,onClick:t=>this.handleIconClick(t,"left"),class:{"icon-clickable":this.leftIconClickable}}),s("input",{ref:t=>this._inputElem=t,id:this.name,type:this.type,title:this.value,placeholder:this.placeholder,disabled:!this.enabled,readonly:this.readonly,name:this.name,minlength:this.minlength,maxlength:this.maxlength,onInput:t=>this.onInput(t),onBlur:this.onBlur.bind(this),onFocus:this.onFocus.bind(this)}),this.rightIconName&&s("ez-icon",{iconName:this.rightIconName,title:this.rightIconTooltip,onClick:t=>this.handleIconClick(t,"right"),class:{"icon-clickable":this.rightIconClickable}})),(this.helpText||this.errorMessage)&&s("span",{id:"input_helpText",title:this.errorMessage||this.helpText},this.errorMessage||this.helpText))}get _element(){return r(this)}static get watchers(){return{value:["syncValue"],errorMessage:["observeErrorMessage"]}}};c.style=':host{display:flex;flex-direction:column;align-items:flex-start;box-sizing:border-box;font-family:var(--font--pattern, Arial, sans-serif);font-size:var(--font-size--default, 14px);color:var(--color--ocean-green-1000, #00281D);border:none;padding:0;padding-inline:var(--space--2, 2px);width:100%;--ez-classic-input--label-color:var(--color--ocean-green-1000, #00281D);--ez-classic-input--border-color-default:var(--color--gray-200, #D2D2D3);--ez-classic-input--border-color-focus:var(--color--gray-300, #A4A5A7);--ez-classic-input--border-color-success:var(--color--green-600, #157A00);--ez-classic-input--border-color-error:var(--color--red-600, #BD0025);--ez-classic-input--border-color-warning:var(--color--yellow-600, #EFB103);--ez-classic-input--background-color:var(--color--gray-70, #FFFFFF);--ez-classic-input--background-color-disabled:var(--color--gray-90, #EAEAEA);--ez-classic-input--text-color:var(--color--ocean-green-1000, #00281D);--ez-classic-input--placeholder-color:#bdbdbd;--ez-classic-input--icon-color:var(--color--gray-400, #77777A);--ez-classic-input--helptext-color:var(--color--ocean-green-1000, #00281D);--ez-classic-input--height:var(--space--56, 56px);--ez-classic-input--height-small:var(--space--48, 48px);--ez-classic-input--height-xsmall:var(--space--40, 40px);--ez-classic-input--gap:var(--space--10, 10px);--ez-classic-input--padding-inline:var(--space--16, 16px)}.input-container{display:flex;flex-direction:row;align-items:center;width:100%;border:none;border-radius:var(--border--radius-8, 8px);padding-inline:var(--ez-classic-input--padding-inline);box-sizing:border-box;gap:var(--ez-classic-input--gap);margin-block:var(--space--4, 4px);transition:box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);height:var(--ez-classic-input--height);background-color:var(--ez-classic-input--background-color)}.input-container--small{height:var(--ez-classic-input--height-small)}.input-container--xsmall{height:var(--ez-classic-input--height-xsmall)}.input-container,.input-container[data-state="default"]{box-shadow:0 0 0 1px var(--ez-classic-input--border-color-default)}.input-container[data-state="success"]{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-input--border-color-success)}.input-container[data-state="error"]{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-input--border-color-error)}.input-container[data-state="warning"]{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-input--border-color-warning)}.input-container:focus-within{box-shadow:0 0 0 var(--space--2, 2px) var(--ez-classic-input--border-color-focus)}ez-icon{min-width:var(--space--24, 24px);color:var(--ez-classic-input--icon-color)}input{flex:1;border:none;outline:none;background:transparent;height:100%;width:100%;padding:0;font-family:var(--font--pattern, Arial, sans-serif);font-size:var(--font-size--default, 14px);color:var(--color--ocean-green-1000, #00281D);text-overflow:ellipsis;color:var(--ez-classic-input--text-color)}input::placeholder{color:var(--ez-classic-input--placeholder-color)}.input-container[data-disabled="true"]{cursor:not-allowed;background:var(--ez-classic-input--background-color-disabled);border-color:var(--ez-classic-input--border-color-default)}.input-container[data-disabled="true"]>*{cursor:not-allowed}.input-container input:read-only{cursor:default}@keyframes ez-helptext-fadein{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}span{font-size:var(--font-size--xsmall, 10px);line-height:var(--line-height--16, 16px);overflow:hidden;text-overflow:ellipsis;animation:ez-helptext-fadein 0.3s ease;color:var(--ez-classic-input--helptext-color)}label{display:block;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-classic-input--label-color)}.icon-clickable{cursor:pointer}.required-indicator{font-size:var(--font--size--default, 14px);font-family:var(--font--pattern, \'Roboto\');color:var(--color--red-600, #BD0025);margin-left:var(--space--4, 4px);vertical-align:top}';export{c as ez_classic_input}
@@ -1 +1 @@
1
- import{r as l,c as i,h as o,g as e}from"./p-23a36bb6.js";import{ElementIDUtils as t}from"@sankhyalabs/core";import{A as s}from"./p-ad5e263d.js";import"./p-ab574d59.js";import"./p-b853763b.js";import{i as a}from"./p-42e1e733.js";import"./p-5895e687.js";import"./p-47e4a8ce.js";const r=class{constructor(o){l(this,o),this.ezChange=i(this,"ezChange",7),this.ezRemove=i(this,"ezRemove",7),this.ezSaveEditLabel=i(this,"ezSaveEditLabel",7),this.ezEditLabelMode=i(this,"ezEditLabelMode",7),this._activeEditText=!1,this.value=!1,this.boxBordered=!1,this.label=void 0,this.subtitle=void 0,this.headerSize="small",this.iconPlacement="left",this.headerAlign="left",this.removable=!1,this.editable=!1,this.conditionalSave=void 0}async showHide(){this.value=!this.value}async applyFocusTextEdit(){var l;null===(l=this._refTextEdit)||void 0===l||l.applyFocusSelect()}async cancelEdition(){this._activeEditText=!1,this.ezEditLabelMode.emit(this._activeEditText)}observeCollapsedValue(){this.ezChange.emit(this.value)}getHeaderSize(){const l=this.headerSize&&this.headerSize.toLowerCase(),i=["xsmall","xlarge"].includes(l)?l.replace("x","x-"):l;return["x-small","small","medium","large","x-large"].includes(i)?i:"small"}removeElement(){this._hostElement&&this._hostElement.remove(),this.ezRemove.emit(this)}editLabel(l){l.preventDefault(),l.stopPropagation(),this._activeEditText=!0,this.ezEditLabelMode.emit(this._activeEditText)}async confirmRemove(l){l.stopPropagation();const i=this.i18n("ez-collapsible-box.confirmRemove",{label:this.label});await s.confirm(this.i18n("app.warning"),i)&&this.removeElement()}saveEditionText(l){const{value:i,newValue:o}=l.detail;if(i===o)return void this.cancelEdition();let e=!0;this.conditionalSave&&(e=this.conditionalSave(o)),this.label!==o&&e&&(this.label=o,this._activeEditText=!1,this.ezSaveEditLabel.emit(l.detail),this.ezEditLabelMode.emit(this._activeEditText))}getStyledLabel(){if(null!=this._refLabel)return{fontSize:window.getComputedStyle(this._refLabel).getPropertyValue("font-size"),fontWeight:window.getComputedStyle(this._refLabel).getPropertyValue("font-weight"),fontFamily:window.getComputedStyle(this._refLabel).getPropertyValue("font-family")}}async componentWillLoad(){this.i18n=await a()}componentDidLoad(){t.addIDInfo(this._hostElement)}render(){return o("div",{class:`collapsible-box ${this.boxBordered&&"collapsable-box--bordered"}`},o("div",{class:"collapsible-box__header"},o("button",Object.assign({},this._activeEditText?null:{onClick:()=>{this.showHide()}},{class:"collapsible-box__title collapsible-box__title--"+(this.headerAlign||"left")+("right"===this.iconPlacement?" collapsible-box__title--icon-right":"")+(this.value?" collapsible-box__title--no-margin":"")}),o("ez-icon",{slot:"icon","icon-name":"chevron-right",size:this.getHeaderSize(),class:"collapsible-box__icon collapsible-box__icon--"+this.getHeaderSize()+(this.value?" collapsible-box__icon--collapsed":""),id:"toggleCollapsible"}),this._activeEditText?o("ez-text-edit",{class:"collapsible-box__text-edit",ref:l=>this._refTextEdit=l,value:this.label,styled:this.getStyledLabel(),onSaveEdition:l=>this.saveEditionText(l),onCancelEdition:()=>this.cancelEdition()}):o("label",{class:"collapsible-box__label font--"+this.getHeaderSize(),title:this.label,ref:l=>this._refLabel=l},o("span",null,this.label),this.editable&&o("ez-icon",{slot:"icon","icon-name":"edit",onClick:l=>this.editLabel(l),title:this.i18n("app.edit")}),this.removable&&o("ez-icon",{slot:"icon","icon-name":"delete",onClick:l=>this.confirmRemove(l),title:this.i18n("app.remove")}))),o("slot",{name:"rightSlot"})),o("div",{class:"collapsible-box__content"+(this.value?"":" collapsible-box__content--show")},this.subtitle&&o("div",{class:"subtitle-box__content"},o("label",{class:"subtitle-box__label",title:this.subtitle},o("span",null,this.subtitle))),o("slot",null)))}get _hostElement(){return e(this)}static get watchers(){return{value:["observeCollapsedValue"]}}};r.style=":host{--ez-collapsible-box--font-size:var(--title--medium, 14px);--ez-collapsible-box--font-family:var(--font-pattern, Arial);--ez-collapsible-box--font-weight:var(--text-weight--large, 600);--ez-collapsible-box--color:var(--title--primary);--ez-collapsible-box--subtitle--font-size:var(--text--medium, 14px);--ez-collapsible-box--subtitle--font-family:var(--font-pattern, 'Roboto');--ez-collapsible-box--subtitle--font-weight:var(--text-weight--medium, 400);--ez-collapsible-box--subtitle--color:var(--text--primary);--ez-collapsible-box--subtitle--margin-bottom:var(--space--medium, 12px);--ez-collapsible-box--focus--color:var(--color--primary-600);--ez-collapsible-box__icon--color:var(--ez-collapsible-box--color);--ez-collapsible-box__header--padding-top:0px;--ez-collapsible-box__header--padding-bottom:0px;--ez-collapsible-box__header--padding-right:0px;--ez-collapsible-box__header--padding-left:0px;display:flex;flex-wrap:wrap;width:100%}ez-icon{--ez-icon--color:inherit}.collapsible-box{display:flex;flex-direction:column;width:100%;overflow:hidden}.collapsable-box--bordered{border:var(--border--small);border-color:var(--color--strokes);border-radius:var(--border--radius-medium);padding:var(--space--xs)}.collapsible-box__header{display:flex;box-sizing:border-box;padding-top:var(--ez-collapsible-box__header--padding-top);padding-bottom:var(--ez-collapsible-box__header--padding-bottom);padding-right:var(--ez-collapsible-box__header--padding-right);padding-left:var(--ez-collapsible-box__header--padding-left)}.collapsible-box__title{position:relative;width:100%;display:flex;box-sizing:border-box;align-items:center;outline:none;border:none;background-color:unset;cursor:pointer;padding:0px;text-align:left;color:var(--ez-collapsible-box--color);--ez-icon--color:var(--ez-collapsible-box__icon--color);margin-bottom:var(--space--medium, 12px)}.collapsible-box__title:focus{color:var(--ez-collapsible-box--focus--color);--ez-icon--color:var(--ez-collapsible-box--focus--color)}.collapsible-box__label{display:flex;white-space:nowrap;overflow:hidden;cursor:pointer;text-overflow:ellipsis;box-sizing:border-box;margin-left:6px;gap:6px;font-family:var(--ez-collapsible-box--font-family);font-size:var(--ez-collapsible-box--font-size);font-weight:var(--ez-collapsible-box--font-weight)}.subtitle-box__label{display:flex;overflow:hidden;text-overflow:ellipsis;box-sizing:border-box;font-family:var(--ez-collapsible-box--subtitle--font-family);font-size:var(--ez-collapsible-box--subtitle--font-size);font-weight:var(--ez-collapsible-box--subtitle--font-weight);color:var(--ez-collapsible-box--subtitle--color);margin-bottom:var(--ez-collapsible-box--subtitle--margin-bottom)}.subtitle-box__content{width:100%}.collapsible-box__label ez-icon{visibility:hidden;transition:2s all ease-in-out}.collapsible-box__label:hover ez-icon{visibility:visible}.collapsible-box__text-edit{margin-left:6px}.collapsible-box__icon{transform:rotate(90deg) translate(0px, 14%);transition:transform var(--transition)}.collapsible-box__icon--collapsed{transform:rotate(0deg) translate(-14%, 0px)}.collapsible-box__title--icon-right{flex-direction:row-reverse}.collapsible-box__title--icon-right .collapsible-box__icon{transform:rotate(90deg) translate(0px, -14%)}.collapsible-box__title--icon-right .collapsible-box__icon--collapsed{transform:rotate(0deg) translate(14%, 0px)}.collapsible-box__title--icon-right .collapsible-box__label{margin-left:0px;margin-right:6px}.collapsible-box__title--left{margin-right:auto}.collapsible-box__title--right{margin-left:auto}.collapsible-box__title--center{margin-left:auto;margin-right:auto}.collapsible-box__title--stretch{justify-content:space-between;width:100%}.collapsible-box__title--no-margin{margin-bottom:0}.collapsible-box__content{display:flex;flex-wrap:wrap;width:100%;height:0px;max-height:0px;opacity:0;overflow:hidden;transition:all var(--transition, 0.5s)}.collapsible-box__content--show{height:100%;max-height:none;opacity:1;overflow:visible;transition:all var(--transition, 0.5s)}.font--x-small{font-size:10px}.font--small{font-size:12px}.font--medium{font-size:14px}.font--large{font-size:16px}.font--x-large{font-size:20px}";export{r as ez_collapsible_box}
1
+ import{r as l,c as i,h as e,g as o}from"./p-e4c7eb39.js";import{ElementIDUtils as t}from"@sankhyalabs/core";import{A as s}from"./p-ad5e263d.js";import"./p-ab574d59.js";import"./p-b853763b.js";import{i as a}from"./p-42e1e733.js";import"./p-5895e687.js";import"./p-47e4a8ce.js";const r=class{constructor(e){l(this,e),this.ezChange=i(this,"ezChange",7),this.ezRemove=i(this,"ezRemove",7),this.ezSaveEditLabel=i(this,"ezSaveEditLabel",7),this.ezEditLabelMode=i(this,"ezEditLabelMode",7),this._activeEditText=!1,this.value=!1,this.boxBordered=!1,this.label=void 0,this.subtitle=void 0,this.headerSize="small",this.iconPlacement="left",this.headerAlign="left",this.removable=!1,this.editable=!1,this.conditionalSave=void 0}async showHide(){this.value=!this.value}async applyFocusTextEdit(){var l;null===(l=this._refTextEdit)||void 0===l||l.applyFocusSelect()}async cancelEdition(){this._activeEditText=!1,this.ezEditLabelMode.emit(this._activeEditText)}observeCollapsedValue(){this.ezChange.emit(this.value)}getHeaderSize(){const l=this.headerSize&&this.headerSize.toLowerCase(),i=["xsmall","xlarge"].includes(l)?l.replace("x","x-"):l;return["x-small","small","medium","large","x-large"].includes(i)?i:"small"}removeElement(){this._hostElement&&this._hostElement.remove(),this.ezRemove.emit(this)}editLabel(l){l.preventDefault(),l.stopPropagation(),this._activeEditText=!0,this.ezEditLabelMode.emit(this._activeEditText)}async confirmRemove(l){l.stopPropagation();const i=this.i18n("ez-collapsible-box.confirmRemove",{label:this.label});await s.confirm(this.i18n("app.warning"),i)&&this.removeElement()}saveEditionText(l){const{value:i,newValue:e}=l.detail;if(i===e)return void this.cancelEdition();let o=!0;this.conditionalSave&&(o=this.conditionalSave(e)),this.label!==e&&o&&(this.label=e,this._activeEditText=!1,this.ezSaveEditLabel.emit(l.detail),this.ezEditLabelMode.emit(this._activeEditText))}getStyledLabel(){if(null!=this._refLabel)return{fontSize:window.getComputedStyle(this._refLabel).getPropertyValue("font-size"),fontWeight:window.getComputedStyle(this._refLabel).getPropertyValue("font-weight"),fontFamily:window.getComputedStyle(this._refLabel).getPropertyValue("font-family")}}async componentWillLoad(){this.i18n=await a()}componentDidLoad(){t.addIDInfo(this._hostElement)}render(){return e("div",{class:`collapsible-box ${this.boxBordered&&"collapsable-box--bordered"}`},e("div",{class:"collapsible-box__header"},e("button",Object.assign({},this._activeEditText?null:{onClick:()=>{this.showHide()}},{class:"collapsible-box__title collapsible-box__title--"+(this.headerAlign||"left")+("right"===this.iconPlacement?" collapsible-box__title--icon-right":"")+(this.value?" collapsible-box__title--no-margin":"")}),e("ez-icon",{slot:"icon","icon-name":"chevron-right",size:this.getHeaderSize(),class:"collapsible-box__icon collapsible-box__icon--"+this.getHeaderSize()+(this.value?" collapsible-box__icon--collapsed":""),id:"toggleCollapsible"}),this._activeEditText?e("ez-text-edit",{class:"collapsible-box__text-edit",ref:l=>this._refTextEdit=l,value:this.label,styled:this.getStyledLabel(),onSaveEdition:l=>this.saveEditionText(l),onCancelEdition:()=>this.cancelEdition()}):e("label",{class:"collapsible-box__label font--"+this.getHeaderSize(),title:this.label,ref:l=>this._refLabel=l},e("span",null,this.label),this.editable&&e("ez-icon",{slot:"icon","icon-name":"edit",onClick:l=>this.editLabel(l),title:this.i18n("app.edit")}),this.removable&&e("ez-icon",{slot:"icon","icon-name":"delete",onClick:l=>this.confirmRemove(l),title:this.i18n("app.remove")}))),e("slot",{name:"rightSlot"})),e("div",{class:"collapsible-box__content"+(this.value?"":" collapsible-box__content--show")},this.subtitle&&e("div",{class:"subtitle-box__content"},e("label",{class:"subtitle-box__label",title:this.subtitle},e("span",null,this.subtitle))),e("slot",null)))}get _hostElement(){return o(this)}static get watchers(){return{value:["observeCollapsedValue"]}}};r.style=":host{--ez-collapsible-box--font-size:var(--title--medium, 14px);--ez-collapsible-box--font-family:var(--font-pattern, Arial);--ez-collapsible-box--font-weight:var(--text-weight--large, 600);--ez-collapsible-box--color:var(--title--primary);--ez-collapsible-box--subtitle--font-size:var(--text--medium, 14px);--ez-collapsible-box--subtitle--font-family:var(--font-pattern, 'Roboto');--ez-collapsible-box--subtitle--font-weight:var(--text-weight--medium, 400);--ez-collapsible-box--subtitle--color:var(--text--primary);--ez-collapsible-box--subtitle--margin-bottom:var(--space--medium, 12px);--ez-collapsible-box--focus--color:var(--color--primary-600);--ez-collapsible-box__icon--color:var(--ez-collapsible-box--color);--ez-collapsible-box__header--padding-top:0px;--ez-collapsible-box__header--padding-bottom:0px;--ez-collapsible-box__header--padding-right:0px;--ez-collapsible-box__header--padding-left:0px;display:flex;flex-wrap:wrap;width:100%}ez-icon{--ez-icon--color:inherit}.collapsible-box{display:flex;flex-direction:column;width:100%;overflow:hidden}.collapsable-box--bordered{border:var(--border--small);border-color:var(--color--strokes);border-radius:var(--border--radius-medium);padding:var(--space--xs)}.collapsible-box__header{display:flex;box-sizing:border-box;padding-top:var(--ez-collapsible-box__header--padding-top);padding-bottom:var(--ez-collapsible-box__header--padding-bottom);padding-right:var(--ez-collapsible-box__header--padding-right);padding-left:var(--ez-collapsible-box__header--padding-left)}.collapsible-box__title{position:relative;width:100%;display:flex;box-sizing:border-box;align-items:center;outline:none;border:none;background-color:unset;cursor:pointer;padding:0px;text-align:left;color:var(--ez-collapsible-box--color);--ez-icon--color:var(--ez-collapsible-box__icon--color);margin-bottom:var(--space--medium, 12px)}.collapsible-box__title:focus{color:var(--ez-collapsible-box--focus--color);--ez-icon--color:var(--ez-collapsible-box--focus--color)}.collapsible-box__label{display:flex;white-space:nowrap;overflow:hidden;cursor:pointer;text-overflow:ellipsis;box-sizing:border-box;margin-left:6px;gap:6px;font-family:var(--ez-collapsible-box--font-family);font-size:var(--ez-collapsible-box--font-size);font-weight:var(--ez-collapsible-box--font-weight)}.subtitle-box__label{display:flex;overflow:hidden;text-overflow:ellipsis;box-sizing:border-box;font-family:var(--ez-collapsible-box--subtitle--font-family);font-size:var(--ez-collapsible-box--subtitle--font-size);font-weight:var(--ez-collapsible-box--subtitle--font-weight);color:var(--ez-collapsible-box--subtitle--color);margin-bottom:var(--ez-collapsible-box--subtitle--margin-bottom)}.subtitle-box__content{width:100%}.collapsible-box__label ez-icon{visibility:hidden;transition:2s all ease-in-out}.collapsible-box__label:hover ez-icon{visibility:visible}.collapsible-box__text-edit{margin-left:6px}.collapsible-box__icon{transform:rotate(90deg) translate(0px, 14%);transition:transform var(--transition)}.collapsible-box__icon--collapsed{transform:rotate(0deg) translate(-14%, 0px)}.collapsible-box__title--icon-right{flex-direction:row-reverse}.collapsible-box__title--icon-right .collapsible-box__icon{transform:rotate(90deg) translate(0px, -14%)}.collapsible-box__title--icon-right .collapsible-box__icon--collapsed{transform:rotate(0deg) translate(14%, 0px)}.collapsible-box__title--icon-right .collapsible-box__label{margin-left:0px;margin-right:6px}.collapsible-box__title--left{margin-right:auto}.collapsible-box__title--right{margin-left:auto}.collapsible-box__title--center{margin-left:auto;margin-right:auto}.collapsible-box__title--stretch{justify-content:space-between;width:100%}.collapsible-box__title--no-margin{margin-bottom:0}.collapsible-box__content{display:flex;flex-wrap:wrap;width:100%;height:0px;max-height:0px;opacity:0;overflow:hidden;transition:all var(--transition, 0.5s)}.collapsible-box__content--show{height:100%;max-height:none;opacity:1;overflow:visible;transition:all var(--transition, 0.5s)}.font--x-small{font-size:10px}.font--small{font-size:12px}.font--medium{font-size:14px}.font--large{font-size:16px}.font--x-large{font-size:20px}";export{r as ez_collapsible_box}
@@ -1,4 +1,4 @@
1
- import{r as t,c as e,h as i,g as n}from"./p-23a36bb6.js";import{ArrayUtils as r}from"@sankhyalabs/core";import{i as o}from"./p-42e1e733.js";
1
+ import{r as t,c as e,h as i,g as n}from"./p-e4c7eb39.js";import{ArrayUtils as r}from"@sankhyalabs/core";import{i as o}from"./p-42e1e733.js";
2
2
  /**!
3
3
  * Sortable 1.15.7
4
4
  * @author RubaXa <trash@rubaxa.org>
@@ -1 +1 @@
1
- import{h as e,r as a,c as l,g as n,H as i}from"./p-23a36bb6.js";import{ObjectUtils as t,StringUtils as o,UserInterface as r,ElementIDUtils as s}from"@sankhyalabs/core";import{F as d}from"./p-47e4a8ce.js";import{C as c}from"./p-b853763b.js";import{g as m}from"./p-42e1e733.js";function u(a,l,n,i,t,o){return e("div",{class:"ez-col ez-col--sd-12 ez-align--middle ez-padding-top--medium ez-padding-bottom--medium ez-size-height--full "+((null==o?void 0:o.formLayout)===d.CLASSIC_CASCADE||(null==o?void 0:o.formLayout)===d.CLASSIC_SIDE_BY_SIDE?"ez-margin-top--small":"")},e("ez-check",{enabled:!n,label:l,mode:t?c.SWITCH:c.REGULAR,"data-field-name":a,"data-context-name":i,key:a}))}function p(a,l,n,i,t,o,r,s,c,m){var u;return e("div",{class:"ez-col ez-col--sd-12"},(null==m?void 0:m.formLayout)===d.CLASSIC_CASCADE||(null==m?void 0:m.formLayout)===d.CLASSIC_SIDE_BY_SIDE?e("ez-classic-number-input",{class:"ez-input__no-margin",enabled:!n,label:l,precision:i,prettyPrecision:t,"data-field-name":a,"data-context-name":o,key:a,canShowError:r,size:null!==(u=null==m?void 0:m.size)&&void 0!==u?u:"small",required:c}):e("ez-number-input",{class:"ez-input__no-margin",enabled:!n,label:l,precision:i,prettyPrecision:t,"data-field-name":a,"data-context-name":o,key:a,canShowError:r}))}const v=({name:a,label:l,readOnly:n,contextName:i,canShowError:t,props:o,required:r},s)=>{var c;return e("div",{class:"ez-col ez-col--sd-12"},(null==s?void 0:s.formLayout)===d.CLASSIC_CASCADE||(null==s?void 0:s.formLayout)===d.CLASSIC_SIDE_BY_SIDE?e("ez-classic-input",{class:"ez-input__no-margin",label:l,"data-field-name":a,"data-context-name":i,key:a,enabled:!n,mask:null==o?void 0:o.mask,"clean-value-mask":null==o?void 0:o.cleanValueMask,size:null!==(c=null==s?void 0:s.size)&&void 0!==c?c:"small",required:r}):e("ez-text-input",{class:"ez-input__no-margin",label:l,"data-field-name":a,"data-context-name":i,key:a,enabled:!n,canShowError:t,mask:null==o?void 0:o.mask,"clean-value-mask":null==o?void 0:o.cleanValueMask}))},h=new Map;h.set(r.CHECKBOX,((e,a)=>u(e.name,e.label,e.readOnly,e.contextName,!1,a))),h.set(r.SWITCH,((e,a)=>u(e.name,e.label,e.readOnly,e.contextName,!0,a))),h.set(r.OPTIONSELECTOR,(({name:a,label:l,readOnly:n,required:i,props:t,contextName:o,canShowError:r},s)=>{var c;const m=(null==s?void 0:s.formLayout)===d.CLASSIC_CASCADE||(null==s?void 0:s.formLayout)===d.CLASSIC_SIDE_BY_SIDE,u=null==t?void 0:t.options;let p;if("string"==typeof u){const e=JSON.parse(u);p=Object.keys(e).map((a=>({value:a,label:e[a]})))}else p=u;return e("div",{class:"ez-col ez-col--sd-12"},m?e("ez-classic-combo-box",{class:"ez-input__no-margin",enabled:!n,suppressEmptyOption:i,label:l,"data-field-name":a,"data-context-name":o,key:a,options:p,size:null!==(c=null==s?void 0:s.size)&&void 0!==c?c:"small",required:i}):e("ez-combo-box",{class:"ez-input__no-margin",enabled:!n,suppressEmptyOption:i,label:l,"data-field-name":a,"data-context-name":o,key:a,options:p,canShowError:r}))})),h.set(r.DATE,(({name:a,label:l,readOnly:n,canShowError:i,required:t},o)=>{var r;return e("div",{class:"ez-col ez-col--sd-12"},(null==o?void 0:o.formLayout)===d.CLASSIC_CASCADE||(null==o?void 0:o.formLayout)===d.CLASSIC_SIDE_BY_SIDE?e("ez-classic-date-input",{class:"ez-input__no-margin",enabled:!n,label:l,"data-field-name":a,key:a,canShowError:i,size:null!==(r=null==o?void 0:o.size)&&void 0!==r?r:"small",required:t}):e("ez-date-input",{class:"ez-input__no-margin",enabled:!n,label:l,"data-field-name":a,key:a,canShowError:i}))})),h.set(r.TIME,(({name:a,label:l,readOnly:n,canShowError:i,props:t,required:o},r)=>{var s,c,m;return e("div",{class:"ez-col ez-col--sd-12"},(null==r?void 0:r.formLayout)===d.CLASSIC_CASCADE||(null==r?void 0:r.formLayout)===d.CLASSIC_SIDE_BY_SIDE?e("ez-classic-time-input",{class:"ez-input__no-margin",enabled:!n,label:l,"data-field-name":a,key:a,canShowError:i,"show-seconds":null!==(s=null==t?void 0:t.showSeconds)&&void 0!==s&&s,size:null!==(c=null==r?void 0:r.size)&&void 0!==c?c:"small",required:o}):e("ez-time-input",{class:"ez-input__no-margin",enabled:!n,label:l,"data-field-name":a,key:a,canShowError:i,"show-seconds":null!==(m=null==t?void 0:t.showSeconds)&&void 0!==m&&m}))})),h.set(r.ELAPSEDTIME,(({name:a,label:l,readOnly:n,canShowError:i,required:t},o)=>{var r;return e("div",{class:"ez-col ez-col--sd-12"},(null==o?void 0:o.formLayout)===d.CLASSIC_CASCADE||(null==o?void 0:o.formLayout)===d.CLASSIC_SIDE_BY_SIDE?e("ez-classic-time-input",{class:"ez-input__no-margin",enabled:!n,label:l,"data-field-name":a,key:a,canShowError:i,showSeconds:!0,size:null!==(r=null==o?void 0:o.size)&&void 0!==r?r:"small",required:t}):e("ez-time-input",{class:"ez-input__no-margin",enabled:!n,label:l,"data-field-name":a,key:a,canShowError:i,showSeconds:!0}))})),h.set(r.DATETIME,(({name:a,label:l,readOnly:n,contextName:i,canShowError:t,required:o},r)=>{var s;return e("div",{class:"ez-col ez-col--sd-12"},(null==r?void 0:r.formLayout)===d.CLASSIC_CASCADE||(null==r?void 0:r.formLayout)===d.CLASSIC_SIDE_BY_SIDE?e("ez-classic-date-time-input",{class:"ez-input__no-margin",enabled:!n,label:l,"data-field-name":a,"data-context-name":i,key:a,canShowError:t,size:null!==(s=null==r?void 0:r.size)&&void 0!==s?s:"small",required:o}):e("ez-date-time-input",{class:"ez-input__no-margin",enabled:!n,label:l,"data-field-name":a,"data-context-name":i,key:a,canShowError:t}))})),h.set(r.FILE,(({name:a,label:l,readOnly:n,contextName:i,props:o})=>{const r=t.removeEmptyValues({subTitle:o.subTitle,requestHeaders:Object.assign(Object.assign({},o.STORAGESTRATEGY&&{STORAGESTRATEGY:o.STORAGESTRATEGY}),o.INTERNAL_FILENAME&&{INTERNAL_FILENAME:o.INTERNAL_FILENAME})});return e("div",{class:"ez-col ez-col--sd-12"},e("ez-upload",Object.assign({enabled:!n,label:l,"data-field-name":a,"data-context-name":i,key:a},r)))})),h.set(r.DECIMALNUMBER,(({name:e,label:a,readOnly:l,props:n,contextName:i,canShowError:t,required:o},r)=>{var s,d;const c=Number(null!==(s=null==n?void 0:n.precision)&&void 0!==s?s:2);return p(e,a,l,c,Number(null!==(d=null==n?void 0:n.prettyPrecision)&&void 0!==d?d:c),i,t,0,o,r)})),h.set(r.INTEGERNUMBER,(({name:e,label:a,readOnly:l,contextName:n,canShowError:i,props:t,required:o},r)=>p(e,a,l,0,0,n,i,0,o,r))),h.set(r.SEARCH,(({name:a,label:l,readOnly:n,required:i,contextName:t,canShowError:r,optionLoader:s,props:c},m)=>{var u,p,v;const h=!o.isEmpty(null==c?void 0:c.DESCRIPTIONFIELD);return e("div",{class:"ez-col ez-col--sd-12"},(null==m?void 0:m.formLayout)===d.CLASSIC_CASCADE||(null==m?void 0:m.formLayout)===d.CLASSIC_SIDE_BY_SIDE?e("ez-classic-search",{class:"ez-input__no-margin",enabled:!n,suppressEmptyOption:i,label:l,"data-field-name":a,"data-context-name":t,key:a,canShowError:r,optionLoader:s,ignoreLimitCharsToSearch:null!==(u=null==c?void 0:c.ignoreLimitCharsToSearch)&&void 0!==u&&u,hideDescriptionInput:!h,size:null!==(p=null==m?void 0:m.size)&&void 0!==p?p:"small",required:i}):e("ez-search",{class:"ez-input__no-margin",enabled:!n,suppressEmptyOption:i,label:l,"data-field-name":a,"data-context-name":t,key:a,canShowError:r,optionLoader:s,ignoreLimitCharsToSearch:null!==(v=null==c?void 0:c.ignoreLimitCharsToSearch)&&void 0!==v&&v,hideDescriptionInput:!h}))})),h.set(r.SEARCHPLUS,(({name:a,label:l,readOnly:n,contextName:i,canShowError:t,optionLoader:r,props:s,required:c},m)=>{var u;const p=(null==m?void 0:m.formLayout)===d.CLASSIC_CASCADE||(null==m?void 0:m.formLayout)===d.CLASSIC_SIDE_BY_SIDE,v=!o.isEmpty(null==s?void 0:s.DESCRIPTIONFIELD);return e("div",{class:"ez-col ez-col--sd-12"},p?e("ez-classic-search-plus",{class:"ez-input__no-margin",enabled:!n,label:l,"data-field-name":a,"data-context-name":i,key:a,canShowError:t,optionLoader:r,hideDescriptionInput:!v,size:null!==(u=null==m?void 0:m.size)&&void 0!==u?u:"small",required:c}):e("ez-search-plus",{class:"ez-input__no-margin",enabled:!n,label:l,"data-field-name":a,"data-context-name":i,key:a,canShowError:t,optionLoader:r,hideDescriptionInput:!v}))})),h.set(r.LONGTEXT,(({name:a,label:l,readOnly:n,rows:i,contextName:t,canShowError:o},r)=>e("div",{class:"ez-col ez-col--sd-12",key:a},(null==r?void 0:r.formLayout)===d.CLASSIC_CASCADE||(null==r?void 0:r.formLayout)===d.CLASSIC_SIDE_BY_SIDE?e("ez-classic-text-area",{enabled:!n,label:l,"data-field-name":a,"data-context-name":t,rows:i}):e("ez-text-area",{enabled:!n,label:l,"data-field-name":a,"data-context-name":t,rows:i,canShowError:o})))),h.set(r.HTML,(({name:a,label:l,readOnly:n,contextName:i,rows:t,canShowError:o})=>e("div",{class:"ez-col ez-col--sd-12"},e("ez-rich-text",{key:a,enabled:!n,label:l,"data-field-name":a,"data-context-name":i,rows:t,canShowError:o})))),h.set(r.IMAGE,(({name:a,label:l,readOnly:n,contextName:i,props:t})=>e("div",{class:"ez-col ez-col--sd-12"},e("ez-image-input",Object.assign({enabled:!n,label:l,"data-field-name":a,"data-context-name":i,key:a,maxFileSize:1/0},t)))));const z=(e,a=new Map,l)=>{const n=m(),i=(null==l?void 0:l.formLayout)===d.CLASSIC_CASCADE||(null==l?void 0:l.formLayout)===d.CLASSIC_SIDE_BY_SIDE,t=a.get(e.userInterface)||h.get(e.userInterface)||v,o=!i&&e.required?`${e.label}${n("app.requiredInfo")}`:e.label,r=t(Object.assign(Object.assign({},e),{label:o}),l);return r.l["data-form-item"]=e.name,r};class w{constructor(e){this.elem=e}addRightElement(e){this.removeRightElement(),e.classList.add("ez-padding-left--small","ez-margin-top--auto","ez-margin-bottom--extra-small"),e.setAttribute("data-custom-item","true"),this.elem.classList.add("ez-col--nowrap"),this.elem.appendChild(e)}removeRightElement(){Array.from(this.elem.querySelectorAll('[data-custom-item="true"]')).forEach((e=>e.remove()))}get fieldName(){return this.elem.getAttribute("data-form-item")}}class b{constructor(e,a){this.items=new Map,this.formId=a,e.forEach((e=>{const a=new w(e);this.items.set(a.fieldName,a)}))}getItem(e){return this.items.get(e)}get formName(){return this.formId}}const f=class{constructor(e){a(this,e),this.ezContentReady=l(this,"ezContentReady",7),this.formItemsReady=l(this,"formItemsReady",7),this.MAIN_GROUP_NAME="__main",this._customEditors=new Map,this.fields=void 0,this.selectedRecord=void 0,this.singleColumn=!1,this.formLayout=void 0,this.customUiBuilders=new Map}async showUp(){this.singleColumn||this._element.scrollIntoView({behavior:"smooth",block:"start"})}async addCustomEditor(e,a,l){const n=new Map(this._customEditors);n.set(e,{customEditor:a,detailContext:l}),this._customEditors=n}async setFieldProp(e,a,l){const n=this.fields.map((n=>(n.name!==e||!l&&0!==l||(n.props=n.props||{},n.props[a]=l),n)));this.fields=[...n]}getGroupByField(e){var a,l;const n=null!==(a=e.group)&&void 0!==a?a:null===(l=e.props)||void 0===l?void 0:l.UITabName;if(n&&n!==this.MAIN_GROUP_NAME)return n}groupFields(e){const a=new Map;return e.forEach((e=>{const l=this.getGroupByField(e);if(l){let n=a.get(l);null==n&&(n=[],a.set(l,n)),n.push(e)}else a.set(e.name,e)})),a}componentDidRender(){this._formElements=Array.from(this._element.querySelectorAll("[data-field-name]")),this.ezContentReady.emit(this._formElements);const e=new b(Array.from(this._element.querySelectorAll("[data-form-item]")));this.formItemsReady.emit(e)}isItemFullWidth(e){return[r.FILE,r.LONGTEXT,r.HTML].includes(e)}buildFormItemElement(a,l=""){var n;this.isItemFullWidth(a.userInterface)&&(l+=` input-full_width ${this.singleColumn&&"single-column"}`);const i={formLayout:this.formLayout,size:"xsmall"};if(this._customEditors.has(a.name)){const t=null===(n=this._formElements.map((e=>({name:e.dataset.fieldName,value:e.value}))).find((e=>e.name===a.name)))||void 0===n?void 0:n.value,o=this._customEditors.get(a.name).customEditor;return e("div",{class:l},e("ez-custom-form-input",{"data-field-name":a.name,customEditor:o,formViewField:a,builderFallback:e=>z(e,this.customUiBuilders,i),value:t,selectedRecord:this.selectedRecord}))}return e("div",{class:l},z(a,this.customUiBuilders,i))}render(){if(s.addIDInfoIfNotExists(this._element,"ezFormView"),null==this.fields)return;let a=[],l=Array.from(this.groupFields(this.fields).entries()).map((([l,n])=>{if(Array.isArray(n))return e("ez-collapsible-box",{id:`group-${l}`,label:l,"header-size":"large",key:l},e("div",{class:`form-view__content ${this.singleColumn&&"form-view__content--single-column"}`},n.map((e=>this.buildFormItemElement(e)))));a.push(n)})),n=a.map((e=>this.buildFormItemElement(e))),t=e("div",{class:`form-view__content ${this.singleColumn&&"form-view__content--single-column"}`},n);return e(i,null,t,l)}get _element(){return n(this)}};f.style=".sc-ez-form-view-h{display:flex;flex-wrap:wrap;width:100%;--ez-form-view__item--min-width:250px;--ez-form-view__long-item--min-width:530px;--ez-form-view__item--max-width:512px;--ez-form-view__long-item--max-width:100%;--ez-form-view__item--gap:var(--space--14, 14px);--ez-form-view__item--padding:var(--space--small)}.form-view__content.sc-ez-form-view{display:grid;grid-template-columns:repeat(auto-fill, minmax(var(--ez-form-view__item--min-width), 1fr));gap:var(--ez-form-view__item--gap);padding-inline:var(--ez-form-view__item--padding);width:100%}.form-view__content--single-column.sc-ez-form-view{grid-template-columns:1fr}.form-view__content--single-column.sc-ez-form-view>div.sc-ez-form-view:not(.input-full_width){width:clamp(var(--ez-form-view__item--min-width), 70%, var(--ez-form-view__item--max-width))}.input-full_width.sc-ez-form-view{grid-column:1/-1;width:clamp(var(--ez-form-view__long-item--min-width), 100%, var(--ez-form-view__long-item--max-width))}.single-column.sc-ez-form-view{--ez-form-view__long-item--max-width:1024px}*.sc-ez-form-view:has(*)+ez-collapsible-box.sc-ez-form-view{margin-top:var(--space--16, 16px)}";export{f as ez_form_view}
1
+ import{h as e,r as a,c as l,g as n,H as i}from"./p-e4c7eb39.js";import{ObjectUtils as t,StringUtils as o,UserInterface as r,ElementIDUtils as s}from"@sankhyalabs/core";import{F as d}from"./p-47e4a8ce.js";import{C as c}from"./p-b853763b.js";import{g as m}from"./p-42e1e733.js";function u(a,l,n,i,t,o){return e("div",{class:"ez-col ez-col--sd-12 ez-align--middle ez-padding-top--medium ez-padding-bottom--medium ez-size-height--full "+((null==o?void 0:o.formLayout)===d.CLASSIC_CASCADE||(null==o?void 0:o.formLayout)===d.CLASSIC_SIDE_BY_SIDE?"ez-margin-top--small":"")},e("ez-check",{enabled:!n,label:l,mode:t?c.SWITCH:c.REGULAR,"data-field-name":a,"data-context-name":i,key:a}))}function p(a,l,n,i,t,o,r,s,c,m){var u;return e("div",{class:"ez-col ez-col--sd-12"},(null==m?void 0:m.formLayout)===d.CLASSIC_CASCADE||(null==m?void 0:m.formLayout)===d.CLASSIC_SIDE_BY_SIDE?e("ez-classic-number-input",{class:"ez-input__no-margin",enabled:!n,label:l,precision:i,prettyPrecision:t,"data-field-name":a,"data-context-name":o,key:a,canShowError:r,size:null!==(u=null==m?void 0:m.size)&&void 0!==u?u:"small",required:c}):e("ez-number-input",{class:"ez-input__no-margin",enabled:!n,label:l,precision:i,prettyPrecision:t,"data-field-name":a,"data-context-name":o,key:a,canShowError:r}))}const v=({name:a,label:l,readOnly:n,contextName:i,canShowError:t,props:o,required:r},s)=>{var c;return e("div",{class:"ez-col ez-col--sd-12"},(null==s?void 0:s.formLayout)===d.CLASSIC_CASCADE||(null==s?void 0:s.formLayout)===d.CLASSIC_SIDE_BY_SIDE?e("ez-classic-input",{class:"ez-input__no-margin",label:l,"data-field-name":a,"data-context-name":i,key:a,enabled:!n,mask:null==o?void 0:o.mask,"clean-value-mask":null==o?void 0:o.cleanValueMask,size:null!==(c=null==s?void 0:s.size)&&void 0!==c?c:"small",required:r}):e("ez-text-input",{class:"ez-input__no-margin",label:l,"data-field-name":a,"data-context-name":i,key:a,enabled:!n,canShowError:t,mask:null==o?void 0:o.mask,"clean-value-mask":null==o?void 0:o.cleanValueMask}))},h=new Map;h.set(r.CHECKBOX,((e,a)=>u(e.name,e.label,e.readOnly,e.contextName,!1,a))),h.set(r.SWITCH,((e,a)=>u(e.name,e.label,e.readOnly,e.contextName,!0,a))),h.set(r.OPTIONSELECTOR,(({name:a,label:l,readOnly:n,required:i,props:t,contextName:o,canShowError:r},s)=>{var c;const m=(null==s?void 0:s.formLayout)===d.CLASSIC_CASCADE||(null==s?void 0:s.formLayout)===d.CLASSIC_SIDE_BY_SIDE,u=null==t?void 0:t.options;let p;if("string"==typeof u){const e=JSON.parse(u);p=Object.keys(e).map((a=>({value:a,label:e[a]})))}else p=u;return e("div",{class:"ez-col ez-col--sd-12"},m?e("ez-classic-combo-box",{class:"ez-input__no-margin",enabled:!n,suppressEmptyOption:i,label:l,"data-field-name":a,"data-context-name":o,key:a,options:p,size:null!==(c=null==s?void 0:s.size)&&void 0!==c?c:"small",required:i}):e("ez-combo-box",{class:"ez-input__no-margin",enabled:!n,suppressEmptyOption:i,label:l,"data-field-name":a,"data-context-name":o,key:a,options:p,canShowError:r}))})),h.set(r.DATE,(({name:a,label:l,readOnly:n,canShowError:i,required:t},o)=>{var r;return e("div",{class:"ez-col ez-col--sd-12"},(null==o?void 0:o.formLayout)===d.CLASSIC_CASCADE||(null==o?void 0:o.formLayout)===d.CLASSIC_SIDE_BY_SIDE?e("ez-classic-date-input",{class:"ez-input__no-margin",enabled:!n,label:l,"data-field-name":a,key:a,canShowError:i,size:null!==(r=null==o?void 0:o.size)&&void 0!==r?r:"small",required:t}):e("ez-date-input",{class:"ez-input__no-margin",enabled:!n,label:l,"data-field-name":a,key:a,canShowError:i}))})),h.set(r.TIME,(({name:a,label:l,readOnly:n,canShowError:i,props:t,required:o},r)=>{var s,c,m;return e("div",{class:"ez-col ez-col--sd-12"},(null==r?void 0:r.formLayout)===d.CLASSIC_CASCADE||(null==r?void 0:r.formLayout)===d.CLASSIC_SIDE_BY_SIDE?e("ez-classic-time-input",{class:"ez-input__no-margin",enabled:!n,label:l,"data-field-name":a,key:a,canShowError:i,"show-seconds":null!==(s=null==t?void 0:t.showSeconds)&&void 0!==s&&s,size:null!==(c=null==r?void 0:r.size)&&void 0!==c?c:"small",required:o}):e("ez-time-input",{class:"ez-input__no-margin",enabled:!n,label:l,"data-field-name":a,key:a,canShowError:i,"show-seconds":null!==(m=null==t?void 0:t.showSeconds)&&void 0!==m&&m}))})),h.set(r.ELAPSEDTIME,(({name:a,label:l,readOnly:n,canShowError:i,required:t},o)=>{var r;return e("div",{class:"ez-col ez-col--sd-12"},(null==o?void 0:o.formLayout)===d.CLASSIC_CASCADE||(null==o?void 0:o.formLayout)===d.CLASSIC_SIDE_BY_SIDE?e("ez-classic-time-input",{class:"ez-input__no-margin",enabled:!n,label:l,"data-field-name":a,key:a,canShowError:i,showSeconds:!0,size:null!==(r=null==o?void 0:o.size)&&void 0!==r?r:"small",required:t}):e("ez-time-input",{class:"ez-input__no-margin",enabled:!n,label:l,"data-field-name":a,key:a,canShowError:i,showSeconds:!0}))})),h.set(r.DATETIME,(({name:a,label:l,readOnly:n,contextName:i,canShowError:t,required:o},r)=>{var s;return e("div",{class:"ez-col ez-col--sd-12"},(null==r?void 0:r.formLayout)===d.CLASSIC_CASCADE||(null==r?void 0:r.formLayout)===d.CLASSIC_SIDE_BY_SIDE?e("ez-classic-date-time-input",{class:"ez-input__no-margin",enabled:!n,label:l,"data-field-name":a,"data-context-name":i,key:a,canShowError:t,size:null!==(s=null==r?void 0:r.size)&&void 0!==s?s:"small",required:o}):e("ez-date-time-input",{class:"ez-input__no-margin",enabled:!n,label:l,"data-field-name":a,"data-context-name":i,key:a,canShowError:t}))})),h.set(r.FILE,(({name:a,label:l,readOnly:n,contextName:i,props:o})=>{const r=t.removeEmptyValues({subTitle:o.subTitle,requestHeaders:Object.assign(Object.assign({},o.STORAGESTRATEGY&&{STORAGESTRATEGY:o.STORAGESTRATEGY}),o.INTERNAL_FILENAME&&{INTERNAL_FILENAME:o.INTERNAL_FILENAME})});return e("div",{class:"ez-col ez-col--sd-12"},e("ez-upload",Object.assign({enabled:!n,label:l,"data-field-name":a,"data-context-name":i,key:a},r)))})),h.set(r.DECIMALNUMBER,(({name:e,label:a,readOnly:l,props:n,contextName:i,canShowError:t,required:o},r)=>{var s,d;const c=Number(null!==(s=null==n?void 0:n.precision)&&void 0!==s?s:2);return p(e,a,l,c,Number(null!==(d=null==n?void 0:n.prettyPrecision)&&void 0!==d?d:c),i,t,0,o,r)})),h.set(r.INTEGERNUMBER,(({name:e,label:a,readOnly:l,contextName:n,canShowError:i,props:t,required:o},r)=>p(e,a,l,0,0,n,i,0,o,r))),h.set(r.SEARCH,(({name:a,label:l,readOnly:n,required:i,contextName:t,canShowError:r,optionLoader:s,props:c},m)=>{var u,p,v;const h=!o.isEmpty(null==c?void 0:c.DESCRIPTIONFIELD);return e("div",{class:"ez-col ez-col--sd-12"},(null==m?void 0:m.formLayout)===d.CLASSIC_CASCADE||(null==m?void 0:m.formLayout)===d.CLASSIC_SIDE_BY_SIDE?e("ez-classic-search",{class:"ez-input__no-margin",enabled:!n,suppressEmptyOption:i,label:l,"data-field-name":a,"data-context-name":t,key:a,canShowError:r,optionLoader:s,ignoreLimitCharsToSearch:null!==(u=null==c?void 0:c.ignoreLimitCharsToSearch)&&void 0!==u&&u,hideDescriptionInput:!h,size:null!==(p=null==m?void 0:m.size)&&void 0!==p?p:"small",required:i}):e("ez-search",{class:"ez-input__no-margin",enabled:!n,suppressEmptyOption:i,label:l,"data-field-name":a,"data-context-name":t,key:a,canShowError:r,optionLoader:s,ignoreLimitCharsToSearch:null!==(v=null==c?void 0:c.ignoreLimitCharsToSearch)&&void 0!==v&&v,hideDescriptionInput:!h}))})),h.set(r.SEARCHPLUS,(({name:a,label:l,readOnly:n,contextName:i,canShowError:t,optionLoader:r,props:s,required:c},m)=>{var u;const p=(null==m?void 0:m.formLayout)===d.CLASSIC_CASCADE||(null==m?void 0:m.formLayout)===d.CLASSIC_SIDE_BY_SIDE,v=!o.isEmpty(null==s?void 0:s.DESCRIPTIONFIELD);return e("div",{class:"ez-col ez-col--sd-12"},p?e("ez-classic-search-plus",{class:"ez-input__no-margin",enabled:!n,label:l,"data-field-name":a,"data-context-name":i,key:a,canShowError:t,optionLoader:r,hideDescriptionInput:!v,size:null!==(u=null==m?void 0:m.size)&&void 0!==u?u:"small",required:c}):e("ez-search-plus",{class:"ez-input__no-margin",enabled:!n,label:l,"data-field-name":a,"data-context-name":i,key:a,canShowError:t,optionLoader:r,hideDescriptionInput:!v}))})),h.set(r.LONGTEXT,(({name:a,label:l,readOnly:n,rows:i,contextName:t,canShowError:o},r)=>e("div",{class:"ez-col ez-col--sd-12",key:a},(null==r?void 0:r.formLayout)===d.CLASSIC_CASCADE||(null==r?void 0:r.formLayout)===d.CLASSIC_SIDE_BY_SIDE?e("ez-classic-text-area",{enabled:!n,label:l,"data-field-name":a,"data-context-name":t,rows:i}):e("ez-text-area",{enabled:!n,label:l,"data-field-name":a,"data-context-name":t,rows:i,canShowError:o})))),h.set(r.HTML,(({name:a,label:l,readOnly:n,contextName:i,rows:t,canShowError:o})=>e("div",{class:"ez-col ez-col--sd-12"},e("ez-rich-text",{key:a,enabled:!n,label:l,"data-field-name":a,"data-context-name":i,rows:t,canShowError:o})))),h.set(r.IMAGE,(({name:a,label:l,readOnly:n,contextName:i,props:t})=>e("div",{class:"ez-col ez-col--sd-12"},e("ez-image-input",Object.assign({enabled:!n,label:l,"data-field-name":a,"data-context-name":i,key:a,maxFileSize:1/0},t)))));const z=(e,a=new Map,l)=>{const n=m(),i=(null==l?void 0:l.formLayout)===d.CLASSIC_CASCADE||(null==l?void 0:l.formLayout)===d.CLASSIC_SIDE_BY_SIDE,t=a.get(e.userInterface)||h.get(e.userInterface)||v,o=!i&&e.required?`${e.label}${n("app.requiredInfo")}`:e.label,r=t(Object.assign(Object.assign({},e),{label:o}),l);return r.l["data-form-item"]=e.name,r};class w{constructor(e){this.elem=e}addRightElement(e){this.removeRightElement(),e.classList.add("ez-padding-left--small","ez-margin-top--auto","ez-margin-bottom--extra-small"),e.setAttribute("data-custom-item","true"),this.elem.classList.add("ez-col--nowrap"),this.elem.appendChild(e)}removeRightElement(){Array.from(this.elem.querySelectorAll('[data-custom-item="true"]')).forEach((e=>e.remove()))}get fieldName(){return this.elem.getAttribute("data-form-item")}}class b{constructor(e,a){this.items=new Map,this.formId=a,e.forEach((e=>{const a=new w(e);this.items.set(a.fieldName,a)}))}getItem(e){return this.items.get(e)}get formName(){return this.formId}}const f=class{constructor(e){a(this,e),this.ezContentReady=l(this,"ezContentReady",7),this.formItemsReady=l(this,"formItemsReady",7),this.MAIN_GROUP_NAME="__main",this._customEditors=new Map,this.fields=void 0,this.selectedRecord=void 0,this.singleColumn=!1,this.formLayout=void 0,this.customUiBuilders=new Map}async showUp(){this.singleColumn||this._element.scrollIntoView({behavior:"smooth",block:"start"})}async addCustomEditor(e,a,l){const n=new Map(this._customEditors);n.set(e,{customEditor:a,detailContext:l}),this._customEditors=n}async setFieldProp(e,a,l){const n=this.fields.map((n=>(n.name!==e||!l&&0!==l||(n.props=n.props||{},n.props[a]=l),n)));this.fields=[...n]}getGroupByField(e){var a,l;const n=null!==(a=e.group)&&void 0!==a?a:null===(l=e.props)||void 0===l?void 0:l.UITabName;if(n&&n!==this.MAIN_GROUP_NAME)return n}groupFields(e){const a=new Map;return e.forEach((e=>{const l=this.getGroupByField(e);if(l){let n=a.get(l);null==n&&(n=[],a.set(l,n)),n.push(e)}else a.set(e.name,e)})),a}componentDidRender(){this._formElements=Array.from(this._element.querySelectorAll("[data-field-name]")),this.ezContentReady.emit(this._formElements);const e=new b(Array.from(this._element.querySelectorAll("[data-form-item]")));this.formItemsReady.emit(e)}isItemFullWidth(e){return[r.FILE,r.LONGTEXT,r.HTML].includes(e)}buildFormItemElement(a,l=""){var n;this.isItemFullWidth(a.userInterface)&&(l+=` input-full_width ${this.singleColumn&&"single-column"}`);const i={formLayout:this.formLayout,size:"xsmall"};if(this._customEditors.has(a.name)){const t=null===(n=this._formElements.map((e=>({name:e.dataset.fieldName,value:e.value}))).find((e=>e.name===a.name)))||void 0===n?void 0:n.value,o=this._customEditors.get(a.name).customEditor;return e("div",{class:l},e("ez-custom-form-input",{"data-field-name":a.name,customEditor:o,formViewField:a,builderFallback:e=>z(e,this.customUiBuilders,i),value:t,selectedRecord:this.selectedRecord}))}return e("div",{class:l},z(a,this.customUiBuilders,i))}render(){if(s.addIDInfoIfNotExists(this._element,"ezFormView"),null==this.fields)return;let a=[],l=Array.from(this.groupFields(this.fields).entries()).map((([l,n])=>{if(Array.isArray(n))return e("ez-collapsible-box",{id:`group-${l}`,label:l,"header-size":"large",key:l},e("div",{class:`form-view__content ${this.singleColumn&&"form-view__content--single-column"}`},n.map((e=>this.buildFormItemElement(e)))));a.push(n)})),n=a.map((e=>this.buildFormItemElement(e))),t=e("div",{class:`form-view__content ${this.singleColumn&&"form-view__content--single-column"}`},n);return e(i,null,t,l)}get _element(){return n(this)}};f.style=".sc-ez-form-view-h{display:flex;flex-wrap:wrap;width:100%;--ez-form-view__item--min-width:250px;--ez-form-view__long-item--min-width:530px;--ez-form-view__item--max-width:512px;--ez-form-view__long-item--max-width:100%;--ez-form-view__item--gap:var(--space--14, 14px);--ez-form-view__item--padding:var(--space--small)}.form-view__content.sc-ez-form-view{display:grid;grid-template-columns:repeat(auto-fill, minmax(var(--ez-form-view__item--min-width), 1fr));gap:var(--ez-form-view__item--gap);padding-inline:var(--ez-form-view__item--padding);width:100%}.form-view__content--single-column.sc-ez-form-view{grid-template-columns:1fr}.form-view__content--single-column.sc-ez-form-view>div.sc-ez-form-view:not(.input-full_width){width:clamp(var(--ez-form-view__item--min-width), 70%, var(--ez-form-view__item--max-width))}.input-full_width.sc-ez-form-view{grid-column:1/-1;width:clamp(var(--ez-form-view__long-item--min-width), 100%, var(--ez-form-view__long-item--max-width))}.single-column.sc-ez-form-view{--ez-form-view__long-item--max-width:1024px}*.sc-ez-form-view:has(*)+ez-collapsible-box.sc-ez-form-view{margin-top:var(--space--16, 16px)}";export{f as ez_form_view}
@@ -1 +1 @@
1
- import{r as e,c as i,h as a,H as t,g as r}from"./p-23a36bb6.js";import{ElementIDUtils as s}from"@sankhyalabs/core";import{E as n}from"./p-98bb8b16.js";import{i as o}from"./p-42e1e733.js";const d=class{constructor(a){e(this,a),this.ezSelectionChange=i(this,"ezSelectionChange",7),this.open=!0,this.selectedId=void 0,this.items=[],this.tooltipResolver=void 0,this.filterText=""}async disableItem(e){[].concat(e).forEach((e=>this._tree.disableItem(e)))}async openGuideNavidator(){this.open=!0}async enableItem(e){[].concat(e).forEach((e=>this._tree.enableItem(e)))}async updateItem(e){[].concat(e).forEach((e=>this._tree.updateItem(e)))}async getItem(e){return this._tree.getItem(e)}async getCurrentPath(){var e;return null===(e=this._tree)||void 0===e?void 0:e.getCurrentPath()}async selectGuide(e){null!=this._tree&&null!=e&&(this._tree.selectItem(e),this.getCurrentPath().then((e=>{null==e||e.forEach((e=>{this._tree.openItem(e.id)}))})))}async getParent(e){return this._tree.getParent(e)}async componentWillLoad(){this.i18n=await o()}async handleToggleSidebar(){this.open=!this.open}handleFilterTree(e){"Enter"===e.key&&this._tree.applyFilter(this.filterText)}onFilterChanged(e){this.filterText=e.detail,e.stopPropagation()}render(){return s.addIDInfoIfNotExists(this._element),a(t,null,a("ez-sidebar-button",{class:this.open?"hidden":"",onEzClick:this.handleToggleSidebar.bind(this),"aria-controls":"navigator","aria-expanded":this.open,"data-element-id":s.getInternalIDInfo("openButton")}),a("aside",{tabIndex:-1,id:"navigator",class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-guide-navigator "+(this.open?"":"hidden"),"data-element-id":s.getInternalIDInfo("sidebar")},a("div",{role:"search",class:"ez-guide-navigator__actions"},a("ez-filter-input",{mode:"slim",value:this.filterText,onEzChange:e=>this.onFilterChanged(e),label:this.i18n("ez-guide-navigator.searchGuide"),"aria-placeholder":this.i18n("ez-guide-navigator.searchGuide"),onKeyUp:this.handleFilterTree.bind(this),"data-element-id":s.getInternalIDInfo("textinput")}),a("ez-button",{onClick:this.handleToggleSidebar.bind(this),class:"inverted",mode:"icon",size:"small",iconName:"show_menu",title:this.i18n("ez-guide-navigator.hideMenu"),"aria-label":this.i18n("ez-guide-navigator.hideMenu"),"aria-controls":"navigator","data-element-id":s.getInternalIDInfo("closeButton")})),a("ez-scroller",{direction:n.VERTICAL,activeShadow:!0},a("ez-tree",{ref:e=>this._tree=e,items:this.items,"data-element-id":s.getInternalIDInfo("tree"),tooltipResolver:this.tooltipResolver,onEzChange:e=>this.ezSelectionChange.emit(e.detail),selectedId:this.selectedId}))))}get _element(){return r(this)}};d.style=":host{--ez-guide-navigator--padding-left:var(--space--large);--ez-guide-navigator--padding-right:var(--space--small);--ez-guide-navigator--box-shadow:var(--shadow, 0px 0px 24px 0px #000);--ez-guide-navigator--background-color:var(--color--inverted);--ez-guide-navigator--border-radius:0px var(--border--radius-medium) var(--border--radius-medium) 0px;--ez-guide-navigator--actions-gap:var(--space--medium);--ez-guide-navigator--actions-margin:var(--space--large) 0 var(--space--medium);--ez-guide-navigator--actions-padding-right:calc(var(--space--medium, 12px) + var(--space--small, 6px))}.inverted{transform:rotate(180deg)}.ez-guide-navigator{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;height:100%;padding-left:var(--ez-guide-navigator--padding-left);padding-right:var(--ez-guide-navigator--padding-right);background-color:var(--ez-guide-navigator--background-color);-webkit-box-shadow:var(--ez-guide-navigator--box-shadow);box-shadow:var(--ez-guide-navigator--box-shadow);border-radius:var(--ez-guide-navigator--border-radius)}.ez-guide-navigator__actions{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:var(--ez-guide-navigator--actions-gap);margin:var(--ez-guide-navigator--actions-margin);padding-right:var(--ez-guide-navigator--actions-padding-right)}.hidden{display:none}";export{d as ez_guide_navigator}
1
+ import{r as e,c as i,h as a,H as t,g as r}from"./p-e4c7eb39.js";import{ElementIDUtils as s}from"@sankhyalabs/core";import{E as n}from"./p-98bb8b16.js";import{i as o}from"./p-42e1e733.js";const d=class{constructor(a){e(this,a),this.ezSelectionChange=i(this,"ezSelectionChange",7),this.open=!0,this.selectedId=void 0,this.items=[],this.tooltipResolver=void 0,this.filterText=""}async disableItem(e){[].concat(e).forEach((e=>this._tree.disableItem(e)))}async openGuideNavidator(){this.open=!0}async enableItem(e){[].concat(e).forEach((e=>this._tree.enableItem(e)))}async updateItem(e){[].concat(e).forEach((e=>this._tree.updateItem(e)))}async getItem(e){return this._tree.getItem(e)}async getCurrentPath(){var e;return null===(e=this._tree)||void 0===e?void 0:e.getCurrentPath()}async selectGuide(e){null!=this._tree&&null!=e&&(this._tree.selectItem(e),this.getCurrentPath().then((e=>{null==e||e.forEach((e=>{this._tree.openItem(e.id)}))})))}async getParent(e){return this._tree.getParent(e)}async componentWillLoad(){this.i18n=await o()}async handleToggleSidebar(){this.open=!this.open}handleFilterTree(e){"Enter"===e.key&&this._tree.applyFilter(this.filterText)}onFilterChanged(e){this.filterText=e.detail,e.stopPropagation()}render(){return s.addIDInfoIfNotExists(this._element),a(t,null,a("ez-sidebar-button",{class:this.open?"hidden":"",onEzClick:this.handleToggleSidebar.bind(this),"aria-controls":"navigator","aria-expanded":this.open,"data-element-id":s.getInternalIDInfo("openButton")}),a("aside",{tabIndex:-1,id:"navigator",class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-guide-navigator "+(this.open?"":"hidden"),"data-element-id":s.getInternalIDInfo("sidebar")},a("div",{role:"search",class:"ez-guide-navigator__actions"},a("ez-filter-input",{mode:"slim",value:this.filterText,onEzChange:e=>this.onFilterChanged(e),label:this.i18n("ez-guide-navigator.searchGuide"),"aria-placeholder":this.i18n("ez-guide-navigator.searchGuide"),onKeyUp:this.handleFilterTree.bind(this),"data-element-id":s.getInternalIDInfo("textinput")}),a("ez-button",{onClick:this.handleToggleSidebar.bind(this),class:"inverted",mode:"icon",size:"small",iconName:"show_menu",title:this.i18n("ez-guide-navigator.hideMenu"),"aria-label":this.i18n("ez-guide-navigator.hideMenu"),"aria-controls":"navigator","data-element-id":s.getInternalIDInfo("closeButton")})),a("ez-scroller",{direction:n.VERTICAL,activeShadow:!0},a("ez-tree",{ref:e=>this._tree=e,items:this.items,"data-element-id":s.getInternalIDInfo("tree"),tooltipResolver:this.tooltipResolver,onEzChange:e=>this.ezSelectionChange.emit(e.detail),selectedId:this.selectedId}))))}get _element(){return r(this)}};d.style=":host{--ez-guide-navigator--padding-left:var(--space--large);--ez-guide-navigator--padding-right:var(--space--small);--ez-guide-navigator--box-shadow:var(--shadow, 0px 0px 24px 0px #000);--ez-guide-navigator--background-color:var(--color--inverted);--ez-guide-navigator--border-radius:0px var(--border--radius-medium) var(--border--radius-medium) 0px;--ez-guide-navigator--actions-gap:var(--space--medium);--ez-guide-navigator--actions-margin:var(--space--large) 0 var(--space--medium);--ez-guide-navigator--actions-padding-right:calc(var(--space--medium, 12px) + var(--space--small, 6px))}.inverted{transform:rotate(180deg)}.ez-guide-navigator{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;height:100%;padding-left:var(--ez-guide-navigator--padding-left);padding-right:var(--ez-guide-navigator--padding-right);background-color:var(--ez-guide-navigator--background-color);-webkit-box-shadow:var(--ez-guide-navigator--box-shadow);box-shadow:var(--ez-guide-navigator--box-shadow);border-radius:var(--ez-guide-navigator--border-radius)}.ez-guide-navigator__actions{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:var(--ez-guide-navigator--actions-gap);margin:var(--ez-guide-navigator--actions-margin);padding-right:var(--ez-guide-navigator--actions-padding-right)}.hidden{display:none}";export{d as ez_guide_navigator}
@@ -1 +1 @@
1
- import{r as e,h as n,H as r,g as s}from"./p-23a36bb6.js";import{ElementIDUtils as i}from"@sankhyalabs/core";import{g as a}from"./p-42e1e733.js";const t=class{constructor(n){e(this,n),this.size="small"}addInfoId(){this._element&&i.addIDInfo(this._element)}async componentWillLoad(){this.i18n=a()}componentDidLoad(){this.addInfoId()}render(){return n(r,null,n("div",{class:"spinner__container","data-size":this.size,role:"status","aria-label":this.i18n?this.i18n("spinner.loading"):"Carregando..."},n("svg",{viewBox:"0 0 24 24",class:"spinner__svg"},n("circle",{cx:"12",cy:"12",r:"10",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round",class:"spinner__path"}))))}get _element(){return s(this)}};t.style=':host{--ez-spinner--color:var(--color--ocean-green-600, #008561);--ez-spinner--size-default:24px;--ez-spinner--size-medium:32px;--ez-spinner--size-large:42px;--ez-spinner--animation-duration:1.4s;display:inline-flex;align-items:center;justify-content:center}.spinner__container{display:inline-flex;align-items:center;justify-content:center}.spinner__svg{color:var(--ez-spinner--color);width:var(--ez-spinner--size-default);height:var(--ez-spinner--size-default)}.spinner__container[data-size="medium"] .spinner__svg{width:var(--ez-spinner--size-medium);height:var(--ez-spinner--size-medium)}.spinner__container[data-size="large"] .spinner__svg{width:var(--ez-spinner--size-large);height:var(--ez-spinner--size-large)}.spinner__path{animation:spinner-dash var(--ez-spinner--animation-duration) ease-in-out infinite,\n spinner-rotate var(--ez-spinner--animation-duration) linear infinite;transform-origin:center;will-change:stroke-dasharray, stroke-dashoffset}@keyframes spinner-rotate{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes spinner-dash{0%{stroke-dasharray:1, 63;stroke-dashoffset:0}50%{stroke-dasharray:32, 63;stroke-dashoffset:-16}100%{stroke-dasharray:1, 63;stroke-dashoffset:-63}}';export{t as ez_spinner}
1
+ import{r as e,h as n,H as r,g as s}from"./p-e4c7eb39.js";import{ElementIDUtils as i}from"@sankhyalabs/core";import{g as a}from"./p-42e1e733.js";const t=class{constructor(n){e(this,n),this.size="small"}addInfoId(){this._element&&i.addIDInfo(this._element)}async componentWillLoad(){this.i18n=a()}componentDidLoad(){this.addInfoId()}render(){return n(r,null,n("div",{class:"spinner__container","data-size":this.size,role:"status","aria-label":this.i18n?this.i18n("spinner.loading"):"Carregando..."},n("svg",{viewBox:"0 0 24 24",class:"spinner__svg"},n("circle",{cx:"12",cy:"12",r:"10",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round",class:"spinner__path"}))))}get _element(){return s(this)}};t.style=':host{--ez-spinner--color:var(--color--ocean-green-600, #008561);--ez-spinner--size-default:24px;--ez-spinner--size-medium:32px;--ez-spinner--size-large:42px;--ez-spinner--animation-duration:1.4s;display:inline-flex;align-items:center;justify-content:center}.spinner__container{display:inline-flex;align-items:center;justify-content:center}.spinner__svg{color:var(--ez-spinner--color);width:var(--ez-spinner--size-default);height:var(--ez-spinner--size-default)}.spinner__container[data-size="medium"] .spinner__svg{width:var(--ez-spinner--size-medium);height:var(--ez-spinner--size-medium)}.spinner__container[data-size="large"] .spinner__svg{width:var(--ez-spinner--size-large);height:var(--ez-spinner--size-large)}.spinner__path{animation:spinner-dash var(--ez-spinner--animation-duration) ease-in-out infinite,\n spinner-rotate var(--ez-spinner--animation-duration) linear infinite;transform-origin:center;will-change:stroke-dasharray, stroke-dashoffset}@keyframes spinner-rotate{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes spinner-dash{0%{stroke-dasharray:1, 63;stroke-dashoffset:0}50%{stroke-dasharray:32, 63;stroke-dashoffset:-16}100%{stroke-dasharray:1, 63;stroke-dashoffset:-63}}';export{t as ez_spinner}
@@ -1 +1 @@
1
- import{r as t,c as i,h as s,H as h,g as n}from"./p-23a36bb6.js";import{StringUtils as r}from"@sankhyalabs/core";var e=function(t,i){return Number(t.slice(0,-1*i.length))},o=function(t){return t.endsWith("px")?{value:t,type:"px",numeric:e(t,"px")}:t.endsWith("fr")?{value:t,type:"fr",numeric:e(t,"fr")}:t.endsWith("%")?{value:t,type:"%",numeric:e(t,"%")}:"auto"===t?{value:t,type:"auto"}:null},u=function(t){return t.split(" ").map(o)},c=function(t,i,s){return i.concat(s).map((function(i){return i.style[t]})).filter((function(t){return void 0!==t&&""!==t}))},a=function(t){for(var i=0;i<t.length;i++)if(t[i].numeric>0)return i;return null},l=function(){return!1},d=function(t,i,s){t.style[i]=s},f=function(t,i,s){var h=t[i];return void 0!==h?h:s};function m(t){var i;return(i=[]).concat.apply(i,Array.from(t.ownerDocument.styleSheets).map((function(t){var i=[];try{i=Array.from(t.cssRules||[])}catch(t){}return i}))).filter((function(i){var s=!1;try{s=t.matches(i.selectorText)}catch(t){}return s}))}var w=function(t,i,s){this.direction=t,this.element=i.element,this.track=i.track,"column"===t?(this.gridTemplateProp="grid-template-columns",this.gridGapProp="grid-column-gap",this.cursor=f(s,"columnCursor",f(s,"cursor","col-resize")),this.snapOffset=f(s,"columnSnapOffset",f(s,"snapOffset",30)),this.dragInterval=f(s,"columnDragInterval",f(s,"dragInterval",1)),this.clientAxis="clientX",this.optionStyle=f(s,"gridTemplateColumns")):"row"===t&&(this.gridTemplateProp="grid-template-rows",this.gridGapProp="grid-row-gap",this.cursor=f(s,"rowCursor",f(s,"cursor","row-resize")),this.snapOffset=f(s,"rowSnapOffset",f(s,"snapOffset",30)),this.dragInterval=f(s,"rowDragInterval",f(s,"dragInterval",1)),this.clientAxis="clientY",this.optionStyle=f(s,"gridTemplateRows")),this.onDragStart=f(s,"onDragStart",l),this.onDragEnd=f(s,"onDragEnd",l),this.onDrag=f(s,"onDrag",l),this.writeStyle=f(s,"writeStyle",d),this.startDragging=this.startDragging.bind(this),this.stopDragging=this.stopDragging.bind(this),this.drag=this.drag.bind(this),this.minSizeStart=i.minSizeStart,this.minSizeEnd=i.minSizeEnd,i.element&&(this.element.addEventListener("mousedown",this.startDragging),this.element.addEventListener("touchstart",this.startDragging))};w.prototype.getDimensions=function(){var t=this.grid.getBoundingClientRect(),i=t.width,s=t.height,h=t.bottom,n=t.left,r=t.right;"column"===this.direction?(this.start=t.top,this.end=h,this.size=s):"row"===this.direction&&(this.start=n,this.end=r,this.size=i)},w.prototype.getSizeAtTrack=function(t,i){return function(t,i,s,h){return void 0===s&&(s=0),void 0===h&&(h=!1),i.slice(0,h?t+1:t).reduce((function(t,i){return t+i.numeric}),0)+(s?t*s:0)}(t,this.computedPixels,this.computedGapPixels,i)},w.prototype.getSizeOfTrack=function(t){return this.computedPixels[t].numeric},w.prototype.getRawTracks=function(){var t=c(this.gridTemplateProp,[this.grid],m(this.grid));if(!t.length){if(this.optionStyle)return this.optionStyle;throw Error("Unable to determine grid template tracks from styles.")}return t[0]},w.prototype.getGap=function(){var t=c(this.gridGapProp,[this.grid],m(this.grid));return t.length?t[0]:null},w.prototype.getRawComputedTracks=function(){return window.getComputedStyle(this.grid)[this.gridTemplateProp]},w.prototype.getRawComputedGap=function(){return window.getComputedStyle(this.grid)[this.gridGapProp]},w.prototype.setTracks=function(t){this.tracks=t.split(" "),this.trackValues=u(t)},w.prototype.setComputedTracks=function(t){this.computedTracks=t.split(" "),this.computedPixels=u(t)},w.prototype.setGap=function(t){this.gap=t},w.prototype.setComputedGap=function(t){var i;this.computedGap=t,this.computedGapPixels=((i=this.computedGap).endsWith("px")?Number(i.slice(0,-1*"px".length)):null)||0},w.prototype.getMousePosition=function(t){return"touches"in t?t.touches[0][this.clientAxis]:t[this.clientAxis]},w.prototype.startDragging=function(t){if(!("button"in t)||0===t.button){t.preventDefault(),this.grid=this.element?this.element.parentNode:t.target.parentNode,this.getDimensions(),this.setTracks(this.getRawTracks()),this.setComputedTracks(this.getRawComputedTracks()),this.setGap(this.getGap()),this.setComputedGap(this.getRawComputedGap());var i=this.trackValues.filter((function(t){return"%"===t.type})),s=this.trackValues.filter((function(t){return"fr"===t.type}));if(this.totalFrs=s.length,this.totalFrs){var h=a(s);null!==h&&(this.frToPixels=this.computedPixels[h].numeric/s[h].numeric)}if(i.length){var n=a(i);null!==n&&(this.percentageToPixels=this.computedPixels[n].numeric/i[n].numeric)}var r=this.getSizeAtTrack(this.track,!1)+this.start;if(this.dragStartOffset=this.getMousePosition(t)-r,this.aTrack=this.track-1,!(this.track<this.tracks.length-1))throw Error("Invalid track index: "+this.track+". Track must be between two other tracks and only "+this.tracks.length+" tracks were found.");this.bTrack=this.track+1,this.aTrackStart=this.getSizeAtTrack(this.aTrack,!1)+this.start,this.bTrackEnd=this.getSizeAtTrack(this.bTrack,!0)+this.start,this.dragging=!0,window.addEventListener("mouseup",this.stopDragging),window.addEventListener("touchend",this.stopDragging),window.addEventListener("touchcancel",this.stopDragging),window.addEventListener("mousemove",this.drag),window.addEventListener("touchmove",this.drag),this.grid.addEventListener("selectstart",l),this.grid.addEventListener("dragstart",l),this.grid.style.userSelect="none",this.grid.style.webkitUserSelect="none",this.grid.style.MozUserSelect="none",this.grid.style.pointerEvents="none",this.grid.style.cursor=this.cursor,window.document.body.style.cursor=this.cursor,this.onDragStart(this.direction,this.track)}},w.prototype.stopDragging=function(){this.dragging=!1,this.cleanup(),this.onDragEnd(this.direction,this.track),this.needsDestroy&&(this.element&&(this.element.removeEventListener("mousedown",this.startDragging),this.element.removeEventListener("touchstart",this.startDragging)),this.destroyCb(),this.needsDestroy=!1,this.destroyCb=null)},w.prototype.drag=function(t){var i=this.getMousePosition(t),s=this.getSizeOfTrack(this.track),h=this.aTrackStart+this.minSizeStart+this.dragStartOffset+this.computedGapPixels,n=this.bTrackEnd-this.minSizeEnd-this.computedGapPixels-(s-this.dragStartOffset);i<h+this.snapOffset&&(i=h),i>n-this.snapOffset&&(i=n),i<h?i=h:i>n&&(i=n);var r=i-this.aTrackStart-this.dragStartOffset-this.computedGapPixels,e=this.bTrackEnd-i+this.dragStartOffset-s-this.computedGapPixels;if(this.dragInterval>1){var o=Math.round(r/this.dragInterval)*this.dragInterval;e-=o-r,r=o}r<this.minSizeStart&&(r=this.minSizeStart),e<this.minSizeEnd&&(e=this.minSizeEnd),"px"===this.trackValues[this.aTrack].type?this.tracks[this.aTrack]=r+"px":"fr"===this.trackValues[this.aTrack].type?this.tracks[this.aTrack]=1===this.totalFrs?"1fr":r/this.frToPixels+"fr":"%"===this.trackValues[this.aTrack].type&&(this.tracks[this.aTrack]=r/this.percentageToPixels+"%"),"px"===this.trackValues[this.bTrack].type?this.tracks[this.bTrack]=e+"px":"fr"===this.trackValues[this.bTrack].type?this.tracks[this.bTrack]=1===this.totalFrs?"1fr":e/this.frToPixels+"fr":"%"===this.trackValues[this.bTrack].type&&(this.tracks[this.bTrack]=e/this.percentageToPixels+"%");var u=this.tracks.join(" ");this.writeStyle(this.grid,this.gridTemplateProp,u),this.onDrag(this.direction,this.track,u)},w.prototype.cleanup=function(){window.removeEventListener("mouseup",this.stopDragging),window.removeEventListener("touchend",this.stopDragging),window.removeEventListener("touchcancel",this.stopDragging),window.removeEventListener("mousemove",this.drag),window.removeEventListener("touchmove",this.drag),this.grid&&(this.grid.removeEventListener("selectstart",l),this.grid.removeEventListener("dragstart",l),this.grid.style.userSelect="",this.grid.style.webkitUserSelect="",this.grid.style.MozUserSelect="",this.grid.style.pointerEvents="",this.grid.style.cursor=""),window.document.body.style.cursor=""},w.prototype.destroy=function(t,i){void 0===t&&(t=!0),t||!1===this.dragging?(this.cleanup(),this.element&&(this.element.removeEventListener("mousedown",this.startDragging),this.element.removeEventListener("touchstart",this.startDragging)),i&&i()):(this.needsDestroy=!0,i&&(this.destroyCb=i))};var v=function(t,i,s){return i in t?t[i]:s},p=function(t,i){return function(s){if(s.track<1)throw Error("Invalid track index: "+s.track+". Track must be between two other tracks.");var h="column"===t?i.columnMinSizes||{}:i.rowMinSizes||{},n="column"===t?"columnMinSize":"rowMinSize";return new w(t,Object.assign({},{minSizeStart:v(h,s.track-1,f(i,n,f(i,"minSize",0))),minSizeEnd:v(h,s.track+1,f(i,n,f(i,"minSize",0)))},s),i)}},g=function(t){var i=this;this.columnGutters={},this.rowGutters={},this.options=Object.assign({},{columnGutters:t.columnGutters||[],rowGutters:t.rowGutters||[],columnMinSizes:t.columnMinSizes||{},rowMinSizes:t.rowMinSizes||{}},t),this.options.columnGutters.forEach((function(t){i.columnGutters[t.track]=p("column",i.options)(t)})),this.options.rowGutters.forEach((function(t){i.rowGutters[t.track]=p("row",i.options)(t)}))};g.prototype.addColumnGutter=function(t,i){this.columnGutters[i]&&this.columnGutters[i].destroy(),this.columnGutters[i]=p("column",this.options)({element:t,track:i})},g.prototype.addRowGutter=function(t,i){this.rowGutters[i]&&this.rowGutters[i].destroy(),this.rowGutters[i]=p("row",this.options)({element:t,track:i})},g.prototype.removeColumnGutter=function(t,i){var s=this;void 0===i&&(i=!0),this.columnGutters[t]&&this.columnGutters[t].destroy(i,(function(){delete s.columnGutters[t]}))},g.prototype.removeRowGutter=function(t,i){var s=this;void 0===i&&(i=!0),this.rowGutters[t]&&this.rowGutters[t].destroy(i,(function(){delete s.rowGutters[t]}))},g.prototype.handleDragStart=function(t,i,s){"column"===i?(this.columnGutters[s]&&this.columnGutters[s].destroy(),this.columnGutters[s]=p("column",this.options)({track:s}),this.columnGutters[s].startDragging(t)):"row"===i&&(this.rowGutters[s]&&this.rowGutters[s].destroy(),this.rowGutters[s]=p("row",this.options)({track:s}),this.rowGutters[s].startDragging(t))},g.prototype.destroy=function(t){var i=this;void 0===t&&(t=!0),Object.keys(this.columnGutters).forEach((function(s){return i.columnGutters[s].destroy(t,(function(){delete i.columnGutters[s]}))})),Object.keys(this.rowGutters).forEach((function(s){return i.rowGutters[s].destroy(t,(function(){delete i.rowGutters[s]}))}))};const b=class{constructor(s){t(this,s),this.resizeEnd=i(this,"resizeEnd",7),this._items=[],this._buildInProgress=!1,this.direction="column",this.anchorToExpand=!1,this.structural=!1}rebuildLayout(){Array.from(this._element.querySelectorAll(".ez-split-gutter")).reverse().forEach((t=>{t.remove()})),Array.from(this._element.getElementsByTagName("EzSplitPanel")).reverse().forEach((t=>{t.rebuildLayout()})),this.buildItems(),this.initSplit()}buildItems(){this._panelID=r.generateUUID(),this._element.dataset.panelId=this._panelID,this._element.dataset.uniqueId="EzSplitPanel";let t=Array.from(this._element.children);this._items=t.filter((t=>{var i;return"EZ-SPLIT-ITEM"===(null===(i=t.tagName)||void 0===i?void 0:i.toUpperCase())}));let i=1;this._items.forEach(((t,s)=>{t.dataset.trackNumber=i.toString(),this._items.length>1&&s!=this._items.length-1&&this.addItemGutter(t),i+=2}))}componentDidLoad(){this.buildItems(),this.initSplit(),this._mutationObserver=new MutationObserver((t=>{for(const i of t)if("childList"===i.type&&!this._buildInProgress){this._buildInProgress=!0,window.requestAnimationFrame((()=>{this.rebuildLayout()})),window.requestAnimationFrame((()=>this._buildInProgress=!1));break}})),this._mutationObserver.observe(this._element,{childList:!0,subtree:!1})}disconnectedCallback(){null!=this._mutationObserver&&this._mutationObserver.disconnect()}initSplit(){var t;this._items.length&&(this._element.style["row"===this.direction?"grid-template-rows":"grid-template-columns"]=this.getGridTemplate(),this.removeGuttersMargin(),t=this.getGutters(),new g(t))}handlePanelDragEnd(){const t=this._items.map((t=>({id:t.id,height:t.clientHeight,width:t.clientWidth})));this.resizeEnd.emit({panelId:this._element.id,items:t})}getGutters(){const t={columnGutters:[],rowGutters:[],onDragEnd:()=>this.handlePanelDragEnd()};if(!this._items.length)return t;const i="row"===this.direction?"rowGutters":"columnGutters";return this._items.forEach(((s,h)=>{if(h===this._items.length-1)return;let n=s.dataset.trackNumber;h===this._items.length-1&&(n=this._items.length.toString()),t[i].push({track:Number(n),element:this._element.querySelector(`ez-split-panel[data-panel-id="${this._panelID}"] > [data-item-track="${s.dataset.trackNumber}"]`)})})),t}addItemGutter(t){const i=document.createElement("div");i.classList.add("ez-split-gutter"),i.classList.add(this.direction),i.classList.add("row"===this.direction?"ez-split-gutter__row":"ez-split-gutter__column"),i.dataset.itemTrack=`${t.dataset.trackNumber}`,i.dataset.trackNumber=(Number(t.dataset.trackNumber)+1).toString(),t.parentNode.insertBefore(i,t.nextSibling)}getElementStyle(){return{display:"grid",height:"100%",width:"100%",position:this.anchorToExpand?"relative":"unset"}}calcFreeSpacePercentage(){const t=this._items.reduce(((t,i)=>{var s;return t+((null===(s=i.size)||void 0===s?void 0:s.includes("%"))?Number(i.size.replace("%","")):0)}),0),i=this._items.filter((t=>void 0===t.size)).length;return i&&t?(100-t)/i:null}getGridTemplate(){let t="";const i=this.calcFreeSpacePercentage();return this._items.forEach(((s,h)=>{let n=s.size||"1fr";!s.size&&i&&(n=`${i}%`),t+=h!==this._items.length-1?0!==h?` ${n} 5px`:`${n} 5px`:` ${n}`})),t}removeGuttersMargin(){this._items.length<=1||("column"!=this.direction?"row"!=this.direction||this.removeGuttersMarginRow():this.removeGuttersMarginColumn())}removeGuttersMarginColumn(){this._items.forEach(((t,i)=>{0!=i?i!==this._items.length-1?(t.style.marginRight="0",t.style.marginLeft="0"):t.style.marginLeft="0":t.style.marginRight="0"}))}removeGuttersMarginRow(){this._items.length<=1||this._items.forEach(((t,i)=>{0!=i?i!==this._items.length-1?(t.style.marginBottom="0",t.style.marginTop="0"):t.style.marginTop="0":t.style.marginBottom="0"}))}render(){return s(h,{class:this.structural?"structural__panel":"content__panel",style:this.getElementStyle()})}get _element(){return n(this)}};b.style=".ez-split-gutter{cursor:grab;background-color:transparent;max-width:100%}.ez-split-gutter__row{cursor:ns-resize}.ez-split-gutter__column{cursor:ew-resize}.structural__panel{background:none;box-shadow:none;outline:none;padding:0;margin:0;border:0}";export{b as ez_split_panel}
1
+ import{r as t,c as i,h as s,H as h,g as n}from"./p-e4c7eb39.js";import{StringUtils as r}from"@sankhyalabs/core";var e=function(t,i){return Number(t.slice(0,-1*i.length))},o=function(t){return t.endsWith("px")?{value:t,type:"px",numeric:e(t,"px")}:t.endsWith("fr")?{value:t,type:"fr",numeric:e(t,"fr")}:t.endsWith("%")?{value:t,type:"%",numeric:e(t,"%")}:"auto"===t?{value:t,type:"auto"}:null},u=function(t){return t.split(" ").map(o)},c=function(t,i,s){return i.concat(s).map((function(i){return i.style[t]})).filter((function(t){return void 0!==t&&""!==t}))},a=function(t){for(var i=0;i<t.length;i++)if(t[i].numeric>0)return i;return null},l=function(){return!1},d=function(t,i,s){t.style[i]=s},f=function(t,i,s){var h=t[i];return void 0!==h?h:s};function m(t){var i;return(i=[]).concat.apply(i,Array.from(t.ownerDocument.styleSheets).map((function(t){var i=[];try{i=Array.from(t.cssRules||[])}catch(t){}return i}))).filter((function(i){var s=!1;try{s=t.matches(i.selectorText)}catch(t){}return s}))}var w=function(t,i,s){this.direction=t,this.element=i.element,this.track=i.track,"column"===t?(this.gridTemplateProp="grid-template-columns",this.gridGapProp="grid-column-gap",this.cursor=f(s,"columnCursor",f(s,"cursor","col-resize")),this.snapOffset=f(s,"columnSnapOffset",f(s,"snapOffset",30)),this.dragInterval=f(s,"columnDragInterval",f(s,"dragInterval",1)),this.clientAxis="clientX",this.optionStyle=f(s,"gridTemplateColumns")):"row"===t&&(this.gridTemplateProp="grid-template-rows",this.gridGapProp="grid-row-gap",this.cursor=f(s,"rowCursor",f(s,"cursor","row-resize")),this.snapOffset=f(s,"rowSnapOffset",f(s,"snapOffset",30)),this.dragInterval=f(s,"rowDragInterval",f(s,"dragInterval",1)),this.clientAxis="clientY",this.optionStyle=f(s,"gridTemplateRows")),this.onDragStart=f(s,"onDragStart",l),this.onDragEnd=f(s,"onDragEnd",l),this.onDrag=f(s,"onDrag",l),this.writeStyle=f(s,"writeStyle",d),this.startDragging=this.startDragging.bind(this),this.stopDragging=this.stopDragging.bind(this),this.drag=this.drag.bind(this),this.minSizeStart=i.minSizeStart,this.minSizeEnd=i.minSizeEnd,i.element&&(this.element.addEventListener("mousedown",this.startDragging),this.element.addEventListener("touchstart",this.startDragging))};w.prototype.getDimensions=function(){var t=this.grid.getBoundingClientRect(),i=t.width,s=t.height,h=t.bottom,n=t.left,r=t.right;"column"===this.direction?(this.start=t.top,this.end=h,this.size=s):"row"===this.direction&&(this.start=n,this.end=r,this.size=i)},w.prototype.getSizeAtTrack=function(t,i){return function(t,i,s,h){return void 0===s&&(s=0),void 0===h&&(h=!1),i.slice(0,h?t+1:t).reduce((function(t,i){return t+i.numeric}),0)+(s?t*s:0)}(t,this.computedPixels,this.computedGapPixels,i)},w.prototype.getSizeOfTrack=function(t){return this.computedPixels[t].numeric},w.prototype.getRawTracks=function(){var t=c(this.gridTemplateProp,[this.grid],m(this.grid));if(!t.length){if(this.optionStyle)return this.optionStyle;throw Error("Unable to determine grid template tracks from styles.")}return t[0]},w.prototype.getGap=function(){var t=c(this.gridGapProp,[this.grid],m(this.grid));return t.length?t[0]:null},w.prototype.getRawComputedTracks=function(){return window.getComputedStyle(this.grid)[this.gridTemplateProp]},w.prototype.getRawComputedGap=function(){return window.getComputedStyle(this.grid)[this.gridGapProp]},w.prototype.setTracks=function(t){this.tracks=t.split(" "),this.trackValues=u(t)},w.prototype.setComputedTracks=function(t){this.computedTracks=t.split(" "),this.computedPixels=u(t)},w.prototype.setGap=function(t){this.gap=t},w.prototype.setComputedGap=function(t){var i;this.computedGap=t,this.computedGapPixels=((i=this.computedGap).endsWith("px")?Number(i.slice(0,-1*"px".length)):null)||0},w.prototype.getMousePosition=function(t){return"touches"in t?t.touches[0][this.clientAxis]:t[this.clientAxis]},w.prototype.startDragging=function(t){if(!("button"in t)||0===t.button){t.preventDefault(),this.grid=this.element?this.element.parentNode:t.target.parentNode,this.getDimensions(),this.setTracks(this.getRawTracks()),this.setComputedTracks(this.getRawComputedTracks()),this.setGap(this.getGap()),this.setComputedGap(this.getRawComputedGap());var i=this.trackValues.filter((function(t){return"%"===t.type})),s=this.trackValues.filter((function(t){return"fr"===t.type}));if(this.totalFrs=s.length,this.totalFrs){var h=a(s);null!==h&&(this.frToPixels=this.computedPixels[h].numeric/s[h].numeric)}if(i.length){var n=a(i);null!==n&&(this.percentageToPixels=this.computedPixels[n].numeric/i[n].numeric)}var r=this.getSizeAtTrack(this.track,!1)+this.start;if(this.dragStartOffset=this.getMousePosition(t)-r,this.aTrack=this.track-1,!(this.track<this.tracks.length-1))throw Error("Invalid track index: "+this.track+". Track must be between two other tracks and only "+this.tracks.length+" tracks were found.");this.bTrack=this.track+1,this.aTrackStart=this.getSizeAtTrack(this.aTrack,!1)+this.start,this.bTrackEnd=this.getSizeAtTrack(this.bTrack,!0)+this.start,this.dragging=!0,window.addEventListener("mouseup",this.stopDragging),window.addEventListener("touchend",this.stopDragging),window.addEventListener("touchcancel",this.stopDragging),window.addEventListener("mousemove",this.drag),window.addEventListener("touchmove",this.drag),this.grid.addEventListener("selectstart",l),this.grid.addEventListener("dragstart",l),this.grid.style.userSelect="none",this.grid.style.webkitUserSelect="none",this.grid.style.MozUserSelect="none",this.grid.style.pointerEvents="none",this.grid.style.cursor=this.cursor,window.document.body.style.cursor=this.cursor,this.onDragStart(this.direction,this.track)}},w.prototype.stopDragging=function(){this.dragging=!1,this.cleanup(),this.onDragEnd(this.direction,this.track),this.needsDestroy&&(this.element&&(this.element.removeEventListener("mousedown",this.startDragging),this.element.removeEventListener("touchstart",this.startDragging)),this.destroyCb(),this.needsDestroy=!1,this.destroyCb=null)},w.prototype.drag=function(t){var i=this.getMousePosition(t),s=this.getSizeOfTrack(this.track),h=this.aTrackStart+this.minSizeStart+this.dragStartOffset+this.computedGapPixels,n=this.bTrackEnd-this.minSizeEnd-this.computedGapPixels-(s-this.dragStartOffset);i<h+this.snapOffset&&(i=h),i>n-this.snapOffset&&(i=n),i<h?i=h:i>n&&(i=n);var r=i-this.aTrackStart-this.dragStartOffset-this.computedGapPixels,e=this.bTrackEnd-i+this.dragStartOffset-s-this.computedGapPixels;if(this.dragInterval>1){var o=Math.round(r/this.dragInterval)*this.dragInterval;e-=o-r,r=o}r<this.minSizeStart&&(r=this.minSizeStart),e<this.minSizeEnd&&(e=this.minSizeEnd),"px"===this.trackValues[this.aTrack].type?this.tracks[this.aTrack]=r+"px":"fr"===this.trackValues[this.aTrack].type?this.tracks[this.aTrack]=1===this.totalFrs?"1fr":r/this.frToPixels+"fr":"%"===this.trackValues[this.aTrack].type&&(this.tracks[this.aTrack]=r/this.percentageToPixels+"%"),"px"===this.trackValues[this.bTrack].type?this.tracks[this.bTrack]=e+"px":"fr"===this.trackValues[this.bTrack].type?this.tracks[this.bTrack]=1===this.totalFrs?"1fr":e/this.frToPixels+"fr":"%"===this.trackValues[this.bTrack].type&&(this.tracks[this.bTrack]=e/this.percentageToPixels+"%");var u=this.tracks.join(" ");this.writeStyle(this.grid,this.gridTemplateProp,u),this.onDrag(this.direction,this.track,u)},w.prototype.cleanup=function(){window.removeEventListener("mouseup",this.stopDragging),window.removeEventListener("touchend",this.stopDragging),window.removeEventListener("touchcancel",this.stopDragging),window.removeEventListener("mousemove",this.drag),window.removeEventListener("touchmove",this.drag),this.grid&&(this.grid.removeEventListener("selectstart",l),this.grid.removeEventListener("dragstart",l),this.grid.style.userSelect="",this.grid.style.webkitUserSelect="",this.grid.style.MozUserSelect="",this.grid.style.pointerEvents="",this.grid.style.cursor=""),window.document.body.style.cursor=""},w.prototype.destroy=function(t,i){void 0===t&&(t=!0),t||!1===this.dragging?(this.cleanup(),this.element&&(this.element.removeEventListener("mousedown",this.startDragging),this.element.removeEventListener("touchstart",this.startDragging)),i&&i()):(this.needsDestroy=!0,i&&(this.destroyCb=i))};var v=function(t,i,s){return i in t?t[i]:s},p=function(t,i){return function(s){if(s.track<1)throw Error("Invalid track index: "+s.track+". Track must be between two other tracks.");var h="column"===t?i.columnMinSizes||{}:i.rowMinSizes||{},n="column"===t?"columnMinSize":"rowMinSize";return new w(t,Object.assign({},{minSizeStart:v(h,s.track-1,f(i,n,f(i,"minSize",0))),minSizeEnd:v(h,s.track+1,f(i,n,f(i,"minSize",0)))},s),i)}},g=function(t){var i=this;this.columnGutters={},this.rowGutters={},this.options=Object.assign({},{columnGutters:t.columnGutters||[],rowGutters:t.rowGutters||[],columnMinSizes:t.columnMinSizes||{},rowMinSizes:t.rowMinSizes||{}},t),this.options.columnGutters.forEach((function(t){i.columnGutters[t.track]=p("column",i.options)(t)})),this.options.rowGutters.forEach((function(t){i.rowGutters[t.track]=p("row",i.options)(t)}))};g.prototype.addColumnGutter=function(t,i){this.columnGutters[i]&&this.columnGutters[i].destroy(),this.columnGutters[i]=p("column",this.options)({element:t,track:i})},g.prototype.addRowGutter=function(t,i){this.rowGutters[i]&&this.rowGutters[i].destroy(),this.rowGutters[i]=p("row",this.options)({element:t,track:i})},g.prototype.removeColumnGutter=function(t,i){var s=this;void 0===i&&(i=!0),this.columnGutters[t]&&this.columnGutters[t].destroy(i,(function(){delete s.columnGutters[t]}))},g.prototype.removeRowGutter=function(t,i){var s=this;void 0===i&&(i=!0),this.rowGutters[t]&&this.rowGutters[t].destroy(i,(function(){delete s.rowGutters[t]}))},g.prototype.handleDragStart=function(t,i,s){"column"===i?(this.columnGutters[s]&&this.columnGutters[s].destroy(),this.columnGutters[s]=p("column",this.options)({track:s}),this.columnGutters[s].startDragging(t)):"row"===i&&(this.rowGutters[s]&&this.rowGutters[s].destroy(),this.rowGutters[s]=p("row",this.options)({track:s}),this.rowGutters[s].startDragging(t))},g.prototype.destroy=function(t){var i=this;void 0===t&&(t=!0),Object.keys(this.columnGutters).forEach((function(s){return i.columnGutters[s].destroy(t,(function(){delete i.columnGutters[s]}))})),Object.keys(this.rowGutters).forEach((function(s){return i.rowGutters[s].destroy(t,(function(){delete i.rowGutters[s]}))}))};const b=class{constructor(s){t(this,s),this.resizeEnd=i(this,"resizeEnd",7),this._items=[],this._buildInProgress=!1,this.direction="column",this.anchorToExpand=!1,this.structural=!1}rebuildLayout(){Array.from(this._element.querySelectorAll(".ez-split-gutter")).reverse().forEach((t=>{t.remove()})),Array.from(this._element.getElementsByTagName("EzSplitPanel")).reverse().forEach((t=>{t.rebuildLayout()})),this.buildItems(),this.initSplit()}buildItems(){this._panelID=r.generateUUID(),this._element.dataset.panelId=this._panelID,this._element.dataset.uniqueId="EzSplitPanel";let t=Array.from(this._element.children);this._items=t.filter((t=>{var i;return"EZ-SPLIT-ITEM"===(null===(i=t.tagName)||void 0===i?void 0:i.toUpperCase())}));let i=1;this._items.forEach(((t,s)=>{t.dataset.trackNumber=i.toString(),this._items.length>1&&s!=this._items.length-1&&this.addItemGutter(t),i+=2}))}componentDidLoad(){this.buildItems(),this.initSplit(),this._mutationObserver=new MutationObserver((t=>{for(const i of t)if("childList"===i.type&&!this._buildInProgress){this._buildInProgress=!0,window.requestAnimationFrame((()=>{this.rebuildLayout()})),window.requestAnimationFrame((()=>this._buildInProgress=!1));break}})),this._mutationObserver.observe(this._element,{childList:!0,subtree:!1})}disconnectedCallback(){null!=this._mutationObserver&&this._mutationObserver.disconnect()}initSplit(){var t;this._items.length&&(this._element.style["row"===this.direction?"grid-template-rows":"grid-template-columns"]=this.getGridTemplate(),this.removeGuttersMargin(),t=this.getGutters(),new g(t))}handlePanelDragEnd(){const t=this._items.map((t=>({id:t.id,height:t.clientHeight,width:t.clientWidth})));this.resizeEnd.emit({panelId:this._element.id,items:t})}getGutters(){const t={columnGutters:[],rowGutters:[],onDragEnd:()=>this.handlePanelDragEnd()};if(!this._items.length)return t;const i="row"===this.direction?"rowGutters":"columnGutters";return this._items.forEach(((s,h)=>{if(h===this._items.length-1)return;let n=s.dataset.trackNumber;h===this._items.length-1&&(n=this._items.length.toString()),t[i].push({track:Number(n),element:this._element.querySelector(`ez-split-panel[data-panel-id="${this._panelID}"] > [data-item-track="${s.dataset.trackNumber}"]`)})})),t}addItemGutter(t){const i=document.createElement("div");i.classList.add("ez-split-gutter"),i.classList.add(this.direction),i.classList.add("row"===this.direction?"ez-split-gutter__row":"ez-split-gutter__column"),i.dataset.itemTrack=`${t.dataset.trackNumber}`,i.dataset.trackNumber=(Number(t.dataset.trackNumber)+1).toString(),t.parentNode.insertBefore(i,t.nextSibling)}getElementStyle(){return{display:"grid",height:"100%",width:"100%",position:this.anchorToExpand?"relative":"unset"}}calcFreeSpacePercentage(){const t=this._items.reduce(((t,i)=>{var s;return t+((null===(s=i.size)||void 0===s?void 0:s.includes("%"))?Number(i.size.replace("%","")):0)}),0),i=this._items.filter((t=>void 0===t.size)).length;return i&&t?(100-t)/i:null}getGridTemplate(){let t="";const i=this.calcFreeSpacePercentage();return this._items.forEach(((s,h)=>{let n=s.size||"1fr";!s.size&&i&&(n=`${i}%`),t+=h!==this._items.length-1?0!==h?` ${n} 5px`:`${n} 5px`:` ${n}`})),t}removeGuttersMargin(){this._items.length<=1||("column"!=this.direction?"row"!=this.direction||this.removeGuttersMarginRow():this.removeGuttersMarginColumn())}removeGuttersMarginColumn(){this._items.forEach(((t,i)=>{0!=i?i!==this._items.length-1?(t.style.marginRight="0",t.style.marginLeft="0"):t.style.marginLeft="0":t.style.marginRight="0"}))}removeGuttersMarginRow(){this._items.length<=1||this._items.forEach(((t,i)=>{0!=i?i!==this._items.length-1?(t.style.marginBottom="0",t.style.marginTop="0"):t.style.marginTop="0":t.style.marginBottom="0"}))}render(){return s(h,{class:this.structural?"structural__panel":"content__panel",style:this.getElementStyle()})}get _element(){return n(this)}};b.style=".ez-split-gutter{cursor:grab;background-color:transparent;max-width:100%}.ez-split-gutter__row{cursor:ns-resize}.ez-split-gutter__column{cursor:ew-resize}.structural__panel{background:none;box-shadow:none;outline:none;padding:0;margin:0;border:0}";export{b as ez_split_panel}
@@ -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-83bddbbb.js";import{g as w,i as g}from"./p-42e1e733.js";import{F as _}from"./p-47e4a8ce.js";import"./p-ad5e263d.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-e4c7eb39.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-27add1a3.js";import{g as w,i as g}from"./p-42e1e733.js";import{F as _}from"./p-47e4a8ce.js";import"./p-ad5e263d.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,h as e,H as o,g as t}from"./p-23a36bb6.js";import{ElementIDUtils as a}from"@sankhyalabs/core";const d=class{constructor(e){r(this,e),this.color="default",this.height=void 0,this.width=void 0}componentDidRender(){this._element&&a.addIDInfo(this._element),this._container&&a.addIDInfo(this._container,"empty-card",{id:"container"})}render(){const r=Object.assign(Object.assign({},this.height?{"--ez-empty-card--custom-height":`${this.height}${"number"==typeof this.height?"px":""}`}:{}),this.width?{"--ez-empty-card--custom-width":`${this.width}${"number"==typeof this.width?"px":""}`}:{});return e(o,{style:r},e("div",{ref:r=>this._container=r,class:`card_container ${this.color}`},e("slot",null)))}get _element(){return t(this)}};d.style=":host{--ez-empty-card--width:335px;--ez-empty-card--height:155px;--ez-empty-card--padding:var(--space--24, 24px);--ez-empty-card--border-radius:var(--border--radius-24, 24px);--ez-empty-card--background-color:var(--color--gray-70, #ffffff)}div{width:var(--ez-empty-card--custom-width, var(--ez-empty-card--width));height:var(--ez-empty-card--custom-height, var(--ez-empty-card--height));border-radius:var(--ez-empty-card--border-radius);background-color:var(--ez-empty-card--background-color);padding:var(--ez-empty-card--padding);display:block;overflow:hidden;outline:none;box-shadow:none;border:none;box-sizing:border-box}.gray{--ez-empty-card--background-color:var(--color--gray-80)}.green{--ez-empty-card--background-color:var(--color--ocean-green-90)}.yellow{--ez-empty-card--background-color:var(--color--yellow-100)}.red{--ez-empty-card--background-color:var(--color--red-100)}.petroleum{--ez-empty-card--background-color:var(--color--petroleum-90)}";export{d as ez_empty_card}
1
+ import{r,h as e,H as o,g as t}from"./p-e4c7eb39.js";import{ElementIDUtils as a}from"@sankhyalabs/core";const d=class{constructor(e){r(this,e),this.color="default",this.height=void 0,this.width=void 0}componentDidRender(){this._element&&a.addIDInfo(this._element),this._container&&a.addIDInfo(this._container,"empty-card",{id:"container"})}render(){const r=Object.assign(Object.assign({},this.height?{"--ez-empty-card--custom-height":`${this.height}${"number"==typeof this.height?"px":""}`}:{}),this.width?{"--ez-empty-card--custom-width":`${this.width}${"number"==typeof this.width?"px":""}`}:{});return e(o,{style:r},e("div",{ref:r=>this._container=r,class:`card_container ${this.color}`},e("slot",null)))}get _element(){return t(this)}};d.style=":host{--ez-empty-card--width:335px;--ez-empty-card--height:155px;--ez-empty-card--padding:var(--space--24, 24px);--ez-empty-card--border-radius:var(--border--radius-24, 24px);--ez-empty-card--background-color:var(--color--gray-70, #ffffff)}div{width:var(--ez-empty-card--custom-width, var(--ez-empty-card--width));height:var(--ez-empty-card--custom-height, var(--ez-empty-card--height));border-radius:var(--ez-empty-card--border-radius);background-color:var(--ez-empty-card--background-color);padding:var(--ez-empty-card--padding);display:block;overflow:hidden;outline:none;box-shadow:none;border:none;box-sizing:border-box}.gray{--ez-empty-card--background-color:var(--color--gray-80)}.green{--ez-empty-card--background-color:var(--color--ocean-green-90)}.yellow{--ez-empty-card--background-color:var(--color--yellow-100)}.red{--ez-empty-card--background-color:var(--color--red-100)}.petroleum{--ez-empty-card--background-color:var(--color--petroleum-90)}";export{d as ez_empty_card}
@@ -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-42e1e733.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-e4c7eb39.js";import{StringUtils as a}from"@sankhyalabs/core";import{i as s}from"./p-42e1e733.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 +1 @@
1
- import{r as a,c as e,f as r,h as t,g as l}from"./p-23a36bb6.js";import{FloatingManager as i}from"@sankhyalabs/core";import{i as s}from"./p-42e1e733.js";const n=class{constructor(r){a(this,r),this.ezChange=e(this,"ezChange",7),this._firstRender=!0,this._hoursLabel=["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23"],this._minutosLabel=["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59"],this.value=new Date,this.floating=!1,this.time=!1,this.showSeconds=!1}async show(a,e,r,t){this.floating&&(this._floatingID=i.float(this._box,this._container,{isFixed:this.isFixed(),autoClose:!0,top:a,left:e,bottom:r,right:t}),this.isFixed()||(window.requestAnimationFrame((()=>{this._box.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})})),this.scroll()))}async fitVertical(a,e){const r=this._container.getBoundingClientRect().bottom+this._calendarHeight;(window.innerHeight||document.documentElement.clientHeight)>r?this.show(a+"px",void 0,"unset"):this.show("unset",void 0,e+"px")}async fitHorizontal(a){const e=this._container.getBoundingClientRect().right+this._calendarWidth;(window.innerWidth||document.documentElement.clientWidth)>e||this.show(void 0,"unset",void 0,a+"px")}async hide(){void 0!==this._floatingID&&(i.close(this._floatingID),this._floatingID=void 0)}observeValue(){this.value&&(this._currentPosition.setTime(this.value.getTime()),this._currentPosition.setDate(1))}scrollListener(){this.floating&&this.isFixed()&&this.hide()}isFixed(){return"true"===this._hostElem.dataset.isFixed}getMonthLabel(){return this.i18n(`ez-calendar.month.${this._currentPosition.getMonth()}`)+" "+this._currentPosition.getFullYear()}isSelectedDate(a){return!!this.value&&this.value.getDate()==a.getDate()&&this.value.getMonth()==a.getMonth()&&this.value.getFullYear()==a.getFullYear()}changeMonth(a){this._currentPosition.setMonth(this._currentPosition.getMonth()+a),r(this)}selectDate(a){let e=a;this.value&&(this.time||this.showSeconds)&&(e.setHours(this.value.getHours()),e.setMinutes(this.value.getMinutes()),e.setSeconds(this.showSeconds?this.value.getSeconds():0)),this.value=e,this.ezChange.emit(this.value)}selectHours(a){this.value||(this.value=new Date),this.value=new Date(this.value.getFullYear(),this.value.getMonth(),this.value.getDate(),a,this.value.getMinutes(),this.value.getSeconds()),this.ezChange.emit(this.value)}selectMinutes(a){this.value||(this.value=new Date),this.value=new Date(this.value.getFullYear(),this.value.getMonth(),this.value.getDate(),this.value.getHours(),a,this.value.getSeconds()),this.ezChange.emit(this.value)}selectSeconds(a){this.value||(this.value=new Date),this.value=new Date(this.value.getFullYear(),this.value.getMonth(),this.value.getDate(),this.value.getHours(),this.value.getMinutes(),a),this.ezChange.emit(this.value)}updateScroll(a){if(a){const{scrollHeight:e,clientHeight:r,scrollTop:t}=a;e-r-Math.ceil(t)>0?a.classList.add("endHidden"):a.classList.remove("endHidden")}}async componentWillLoad(){this.i18n=await s()}componentDidRender(){this.floating&&this._firstRender&&(this._calendarHeight=this._box.clientHeight,this._calendarWidth=this._box.clientWidth,this._box.remove(),this._firstRender=!1),this.updateScroll(this._hoursScroll),this.updateScroll(this._minutesScroll),this.updateScroll(this._secondsScroll)}componentDidLoad(){this.scroll()}scroll(){(this.time||this.showSeconds)&&(this._hoursScroll.scrollTop=this._hoursSelect.offsetTop-64,this._minutesScroll.scrollTop=this._minutesSelect.offsetTop-64,this.updateScroll(this._hoursScroll),this.updateScroll(this._minutesScroll),this.showSeconds&&(this._secondsScroll.scrollTop=this._secondsSelect.offsetTop-64,this.updateScroll(this._secondsScroll)))}render(){null==this._currentPosition&&(this._currentPosition=new Date,this.value&&this._currentPosition.setTime(this.value.getTime()),this._currentPosition.setDate(1));const a=new Date;return a.setTime(this._currentPosition.getTime()),a.setDate(1-a.getDay()),t("section",{ref:a=>this._container=a},t("div",{ref:a=>this._box=a,class:"calendar__container"},t("div",{class:"calendar"},t("div",{class:"calendar__header"},t("button",{class:"calendar__btn-previous",onClick:()=>this.changeMonth(-1)}),t("label",{class:"calendar__lbl-month"},this.getMonthLabel()),t("button",{class:"calendar__btn-next",onClick:()=>this.changeMonth(1)})),t("div",{class:"calendar__body"},t("div",{class:"calendar__line"},[...Array(7).keys()].map((a=>t("div",{"data-day":this.i18n(`ez-calendar.weekDay.${a}`),class:"calendar__cell calendar__cell--unselectable"},this.i18n(`ez-calendar.weekDay.${a}`))))),[0,7,14,21,28,35].map((e=>t("div",{class:"calendar__line"},[0,1,2,3,4,5,6].map((r=>{const l=new Date;l.setTime(a.getTime()),l.setDate(l.getDate()+e+r);let i=`${l.getMonth()+1}-${l.getDate()}-${l.getFullYear()}`,s="calendar__cell";return this._currentPosition.getMonth()!=l.getMonth()?s+=" calendar__cell--secondary":this.isSelectedDate(l)&&(s+=" calendar__cell--selected"),t("div",{"data-day-month":i,class:s,onClick:()=>this.selectDate(l)},l.getDate())})))))),t("div",{class:"calendar__footer"},t("button",{class:"calendar__btn-today",onClick:()=>this.selectDate(new Date)},this.i18n("ez-calendar.today")))),(this.time||this.showSeconds)&&t("div",{class:"calendar-time"},t("div",{class:"calendar-time__header"},t("div",null,"H"),t("div",{class:"separatorTime"},":"),t("div",null,"M"),this.showSeconds&&t("div",{class:"separatorTime"},":"),this.showSeconds&&t("div",null,"S")),t("div",{class:"calendar__body ",style:{display:"flex",paddingLeft:"12px",paddingRight:"12px"}},t("div",{class:"calendar__column",ref:a=>this._hoursScroll=a,onScroll:()=>this.updateScroll(this._hoursScroll)},this._hoursLabel.map(((a,e)=>e===this.value.getHours()?t("div",{style:{display:"flex"},ref:a=>this._hoursSelect=a},t("div",{"data-hour":a,class:"calendar__cell calendar__cell--selected",onClick:()=>this.selectHours(e)},a),t("div",{class:"separatorTime"},":")):t("div",{style:{display:"flex"}},t("div",{"data-hour":a,class:"calendar__cell",onClick:()=>this.selectHours(e)},a),t("div",{class:"separatorTime"},":"))))),t("div",{class:"calendar__column",ref:a=>this._minutesScroll=a,onScroll:()=>this.updateScroll(this._minutesScroll)},this._minutosLabel.map(((a,e)=>e===this.value.getMinutes()?t("div",{style:{display:"flex"},ref:a=>this._minutesSelect=a},t("div",{"data-minute":a,class:"calendar__cell calendar__cell--selected",onClick:()=>this.selectMinutes(e)},a),this.showSeconds&&t("div",{class:"separatorTime"},":")):t("div",{style:{display:"flex"}},t("div",{"data-minute":a,class:"calendar__cell",onClick:()=>this.selectMinutes(e)},a),this.showSeconds&&t("div",{class:"separatorTime"},":"))))),this.showSeconds&&t("div",{class:"calendar__column",ref:a=>this._secondsScroll=a,onScroll:()=>this.updateScroll(this._secondsScroll)},this._minutosLabel.map(((a,e)=>e===this.value.getSeconds()?t("div",{"data-second":a,class:"calendar__cell calendar__cell--selected",onClick:()=>this.selectSeconds(e),ref:a=>this._secondsSelect=a},a):t("div",{"data-second":a,class:"calendar__cell",onClick:()=>this.selectSeconds(e)},a))))))))}get _hostElem(){return l(this)}static get watchers(){return{value:["observeValue"]}}};n.style=':host{--ez-calendar--font-family:var(--font-pattern, Arial);--ez-calendar--color:var(--title--primary, #626e82);--ez-calendar--text-shadow:var(--text-shadow, 0 0 0 #353535, 0 0 1px transparent);--ez-calendar__body--background-color:var(--background--xlight, #FFF);--ez-calendar__time--background-color:var(--background--xlight, #FAFAFA);--ez-calendar__body--padding:var(--space--medium, 12px) var(--space--small, 6px);--ez-calendar__body--border-radius:var(--border--radius-medium, 12px);--ez-calendar__body--shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-container--z-index:var(--more-visible, 2);--ez-calendar__header-line--stroke:1px;--ez-calendar__header-line--color:var(--color--strokes, #C0C0C0);--ez-calendar__nav-btn--fill:var(--text--primary, #008561);--ez-calendar__nav-btn--hover--fill:var(--color--primary, #350404);--ez-calendar__nav-btn--width:10px;--ez-calendar__nav-btn--height:16px;--ez-calendar__nav-btn--previous-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="10px"><path d="M 9.7808475,13.860393 3.9204526,8.0000004 9.7808475,2.0624965 7.9301965,0.28895552 0.21915255,8.0000004 7.9301965,15.711044 Z"/></svg>\');--ez-calendar__nav-btn--next-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="10px"><path d="M 0.21915251,13.860393 6.0795475,8.0000007 0.21915251,2.0624968 2.0698036,0.28895588 9.7808475,8.0000007 2.0698036,15.711044 Z"/></svg>\');--ez-calendar__cell--margin:0px 1.5px;--ez-calendar__cell--width:var(--space--large, 24px);--ez-calendar__cell--padding:1.5px 0px;--ez-calendar__cell--border-radius:var(--border--radius-small, 6px);--ez-calendar__cell--over--background-color:var(--color--primary, #E2F4EF);--ez-calendar__cell--over--color:var(--color--primary-300, #008561);--ez-calendar__cell--outset--color:var(--color--disable-primary, #E5EAF0);--ez-calendar__cell--selected--background-color:var(--color--primary, #008561);--ez-calendar__cell--selected--color:var(--color--inverted, #FFF);--ez-calendar__btn-today--color:var(--color--primary);--ez-calendar__btn-today--hover--background-color:var(--color--primary-300, #E2F4EF);--ez-calendar__btn-today--border-radius:var(--border--radius-small, 6px);position:relative;display:flex;user-select:none}.calendar__container{display:flex;z-index:var(--more-visible, 2)}.calendar{display:flex;flex-direction:column;z-index:var(--more-visible, 2);background-color:var(--ez-calendar__body--background-color);padding:var(--ez-calendar__body--padding);border-radius:var(--ez-calendar__body--border-radius);box-shadow:var(--ez-calendar__body--shadow)}.calendar__header{display:flex;justify-content:space-between;padding-bottom:var(--space--small, 6px);margin:0px var(--space--, 12px) var(--space--small, 6px) var(--space--, 12px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);border-bottom:solid var(--ez-calendar__header-line--stroke) var(--ez-calendar__header-line--color)}.calendar__btn-next,.calendar__btn-previous{outline:none;border:none;background-color:unset;cursor:pointer;padding:0px}.calendar__btn-next::after,.calendar__btn-previous::after{content:\'\';display:flex;background-color:var(--ez-calendar__nav-btn--fill);width:var(--ez-calendar__nav-btn--width);height:var(--ez-calendar__nav-btn--height)}.calendar__btn-previous::after{-webkit-mask-image:var(--ez-calendar__nav-btn--previous-image);mask-image:var(--ez-calendar__nav-btn--previous-image)}.calendar__btn-next::after{-webkit-mask-image:var(--ez-calendar__nav-btn--next-image);mask-image:var(--ez-calendar__nav-btn--next-image)}.calendar__btn-next:hover::after,.calendar__btn-previous:hover::after{background-color:var(--ez-calendar__nav-btn--hover--fill)}.calendar__lbl-month{font-weight:var(--text-weight--extra-large, 700);font-size:var(--title--small, 14px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.calendar__line{display:flex;padding:0px;margin:0px}.calendar__cell{display:flex;justify-content:center;align-content:center;cursor:pointer;font-size:var(--text--extra-small, 10px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);padding:var(--ez-calendar__cell--padding);margin:var(--ez-calendar__cell--margin);min-width:var(--ez-calendar__cell--width);border-radius:var(--ez-calendar__cell--border-radius)}.calendar__cell:hover{background-color:var(--ez-calendar__cell--over--background-color);color:var(--ez-calendar__cell--over--color)}.calendar__cell--secondary{color:var(--ez-calendar__cell--outset--color)}.calendar__cell--unselectable:hover{background-color:unset;border-radius:unset;cursor:unset;color:var(--ez-calendar--color)}.calendar__cell--unselectable{font-weight:var(--text-weight--large, 600);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.calendar__cell--selected,.calendar__cell--selected:hover{background-color:var(--ez-calendar__cell--selected--background-color);color:var(--ez-calendar__cell--selected--color)}.calendar__footer{display:flex;flex-direction:column}.calendar__btn-today{border:none;background-color:unset;cursor:pointer;padding:0px;font-weight:var(--text-weight--large, 600);font-size:var(--title--extra-small, 12px);font-family:var(--ez-calendar--font-family);text-shadow:var(--ez-calendar--text-shadow);color:var(--ez-calendar__btn-today--color);border-radius:var(--ez-calendar__btn-today--border-radius)}.calendar__btn-today:hover{background-color:var(--ez-calendar__btn-today--hover--background-color)}section{display:flex}.calendar-time{margin-left:-10px;display:flex;flex-direction:column;padding:12px 0px 0px 10px;background-color:var(--ez-calendar__time--background-color);border-top-right-radius:var(--ez-calendar__body--border-radius);border-bottom-right-radius:var(--ez-calendar__body--border-radius);box-shadow:var(--ez-calendar__body--shadow)}.calendar__column{height:136px;padding:0px;margin:0px;overflow:auto;scrollbar-width:none}.calendar__column::-webkit-scrollbar{width:0px;max-width:0px;min-width:0px}.calendar-time__header{display:flex;justify-content:space-between;padding-left:var(--space--small, 6px);padding-right:var(--space--small, 6px);padding-bottom:var(--space--small, 6px);margin:0px var(--space--, 12px) var(--space--small, 6px) var(--space--, 12px);font-weight:var(--text-weight--extra-large, 700);font-size:var(--title--small, 14px);text-shadow:var(--ez-calendar--text-shadow);border-bottom:solid var(--ez-calendar__header-line--stroke) var(--ez-calendar__header-line--color);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.separatorTime{color:#A2ABB9;padding:0px 1px;line-height:16px;font-size:17px;font-weight:normal}.endHidden{-webkit-mask-image:linear-gradient(180deg, #000 calc(100% - 48px), transparent 100%)}.calendar__column .calendar__cell{margin:0px;padding:1.5px 1.5px}';export{n as ez_calendar}
1
+ import{r as a,c as e,f as r,h as t,g as l}from"./p-e4c7eb39.js";import{FloatingManager as i}from"@sankhyalabs/core";import{i as s}from"./p-42e1e733.js";const n=class{constructor(r){a(this,r),this.ezChange=e(this,"ezChange",7),this._firstRender=!0,this._hoursLabel=["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23"],this._minutosLabel=["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59"],this.value=new Date,this.floating=!1,this.time=!1,this.showSeconds=!1}async show(a,e,r,t){this.floating&&(this._floatingID=i.float(this._box,this._container,{isFixed:this.isFixed(),autoClose:!0,top:a,left:e,bottom:r,right:t}),this.isFixed()||(window.requestAnimationFrame((()=>{this._box.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})})),this.scroll()))}async fitVertical(a,e){const r=this._container.getBoundingClientRect().bottom+this._calendarHeight;(window.innerHeight||document.documentElement.clientHeight)>r?this.show(a+"px",void 0,"unset"):this.show("unset",void 0,e+"px")}async fitHorizontal(a){const e=this._container.getBoundingClientRect().right+this._calendarWidth;(window.innerWidth||document.documentElement.clientWidth)>e||this.show(void 0,"unset",void 0,a+"px")}async hide(){void 0!==this._floatingID&&(i.close(this._floatingID),this._floatingID=void 0)}observeValue(){this.value&&(this._currentPosition.setTime(this.value.getTime()),this._currentPosition.setDate(1))}scrollListener(){this.floating&&this.isFixed()&&this.hide()}isFixed(){return"true"===this._hostElem.dataset.isFixed}getMonthLabel(){return this.i18n(`ez-calendar.month.${this._currentPosition.getMonth()}`)+" "+this._currentPosition.getFullYear()}isSelectedDate(a){return!!this.value&&this.value.getDate()==a.getDate()&&this.value.getMonth()==a.getMonth()&&this.value.getFullYear()==a.getFullYear()}changeMonth(a){this._currentPosition.setMonth(this._currentPosition.getMonth()+a),r(this)}selectDate(a){let e=a;this.value&&(this.time||this.showSeconds)&&(e.setHours(this.value.getHours()),e.setMinutes(this.value.getMinutes()),e.setSeconds(this.showSeconds?this.value.getSeconds():0)),this.value=e,this.ezChange.emit(this.value)}selectHours(a){this.value||(this.value=new Date),this.value=new Date(this.value.getFullYear(),this.value.getMonth(),this.value.getDate(),a,this.value.getMinutes(),this.value.getSeconds()),this.ezChange.emit(this.value)}selectMinutes(a){this.value||(this.value=new Date),this.value=new Date(this.value.getFullYear(),this.value.getMonth(),this.value.getDate(),this.value.getHours(),a,this.value.getSeconds()),this.ezChange.emit(this.value)}selectSeconds(a){this.value||(this.value=new Date),this.value=new Date(this.value.getFullYear(),this.value.getMonth(),this.value.getDate(),this.value.getHours(),this.value.getMinutes(),a),this.ezChange.emit(this.value)}updateScroll(a){if(a){const{scrollHeight:e,clientHeight:r,scrollTop:t}=a;e-r-Math.ceil(t)>0?a.classList.add("endHidden"):a.classList.remove("endHidden")}}async componentWillLoad(){this.i18n=await s()}componentDidRender(){this.floating&&this._firstRender&&(this._calendarHeight=this._box.clientHeight,this._calendarWidth=this._box.clientWidth,this._box.remove(),this._firstRender=!1),this.updateScroll(this._hoursScroll),this.updateScroll(this._minutesScroll),this.updateScroll(this._secondsScroll)}componentDidLoad(){this.scroll()}scroll(){(this.time||this.showSeconds)&&(this._hoursScroll.scrollTop=this._hoursSelect.offsetTop-64,this._minutesScroll.scrollTop=this._minutesSelect.offsetTop-64,this.updateScroll(this._hoursScroll),this.updateScroll(this._minutesScroll),this.showSeconds&&(this._secondsScroll.scrollTop=this._secondsSelect.offsetTop-64,this.updateScroll(this._secondsScroll)))}render(){null==this._currentPosition&&(this._currentPosition=new Date,this.value&&this._currentPosition.setTime(this.value.getTime()),this._currentPosition.setDate(1));const a=new Date;return a.setTime(this._currentPosition.getTime()),a.setDate(1-a.getDay()),t("section",{ref:a=>this._container=a},t("div",{ref:a=>this._box=a,class:"calendar__container"},t("div",{class:"calendar"},t("div",{class:"calendar__header"},t("button",{class:"calendar__btn-previous",onClick:()=>this.changeMonth(-1)}),t("label",{class:"calendar__lbl-month"},this.getMonthLabel()),t("button",{class:"calendar__btn-next",onClick:()=>this.changeMonth(1)})),t("div",{class:"calendar__body"},t("div",{class:"calendar__line"},[...Array(7).keys()].map((a=>t("div",{"data-day":this.i18n(`ez-calendar.weekDay.${a}`),class:"calendar__cell calendar__cell--unselectable"},this.i18n(`ez-calendar.weekDay.${a}`))))),[0,7,14,21,28,35].map((e=>t("div",{class:"calendar__line"},[0,1,2,3,4,5,6].map((r=>{const l=new Date;l.setTime(a.getTime()),l.setDate(l.getDate()+e+r);let i=`${l.getMonth()+1}-${l.getDate()}-${l.getFullYear()}`,s="calendar__cell";return this._currentPosition.getMonth()!=l.getMonth()?s+=" calendar__cell--secondary":this.isSelectedDate(l)&&(s+=" calendar__cell--selected"),t("div",{"data-day-month":i,class:s,onClick:()=>this.selectDate(l)},l.getDate())})))))),t("div",{class:"calendar__footer"},t("button",{class:"calendar__btn-today",onClick:()=>this.selectDate(new Date)},this.i18n("ez-calendar.today")))),(this.time||this.showSeconds)&&t("div",{class:"calendar-time"},t("div",{class:"calendar-time__header"},t("div",null,"H"),t("div",{class:"separatorTime"},":"),t("div",null,"M"),this.showSeconds&&t("div",{class:"separatorTime"},":"),this.showSeconds&&t("div",null,"S")),t("div",{class:"calendar__body ",style:{display:"flex",paddingLeft:"12px",paddingRight:"12px"}},t("div",{class:"calendar__column",ref:a=>this._hoursScroll=a,onScroll:()=>this.updateScroll(this._hoursScroll)},this._hoursLabel.map(((a,e)=>e===this.value.getHours()?t("div",{style:{display:"flex"},ref:a=>this._hoursSelect=a},t("div",{"data-hour":a,class:"calendar__cell calendar__cell--selected",onClick:()=>this.selectHours(e)},a),t("div",{class:"separatorTime"},":")):t("div",{style:{display:"flex"}},t("div",{"data-hour":a,class:"calendar__cell",onClick:()=>this.selectHours(e)},a),t("div",{class:"separatorTime"},":"))))),t("div",{class:"calendar__column",ref:a=>this._minutesScroll=a,onScroll:()=>this.updateScroll(this._minutesScroll)},this._minutosLabel.map(((a,e)=>e===this.value.getMinutes()?t("div",{style:{display:"flex"},ref:a=>this._minutesSelect=a},t("div",{"data-minute":a,class:"calendar__cell calendar__cell--selected",onClick:()=>this.selectMinutes(e)},a),this.showSeconds&&t("div",{class:"separatorTime"},":")):t("div",{style:{display:"flex"}},t("div",{"data-minute":a,class:"calendar__cell",onClick:()=>this.selectMinutes(e)},a),this.showSeconds&&t("div",{class:"separatorTime"},":"))))),this.showSeconds&&t("div",{class:"calendar__column",ref:a=>this._secondsScroll=a,onScroll:()=>this.updateScroll(this._secondsScroll)},this._minutosLabel.map(((a,e)=>e===this.value.getSeconds()?t("div",{"data-second":a,class:"calendar__cell calendar__cell--selected",onClick:()=>this.selectSeconds(e),ref:a=>this._secondsSelect=a},a):t("div",{"data-second":a,class:"calendar__cell",onClick:()=>this.selectSeconds(e)},a))))))))}get _hostElem(){return l(this)}static get watchers(){return{value:["observeValue"]}}};n.style=':host{--ez-calendar--font-family:var(--font-pattern, Arial);--ez-calendar--color:var(--title--primary, #626e82);--ez-calendar--text-shadow:var(--text-shadow, 0 0 0 #353535, 0 0 1px transparent);--ez-calendar__body--background-color:var(--background--xlight, #FFF);--ez-calendar__time--background-color:var(--background--xlight, #FAFAFA);--ez-calendar__body--padding:var(--space--medium, 12px) var(--space--small, 6px);--ez-calendar__body--border-radius:var(--border--radius-medium, 12px);--ez-calendar__body--shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-container--z-index:var(--more-visible, 2);--ez-calendar__header-line--stroke:1px;--ez-calendar__header-line--color:var(--color--strokes, #C0C0C0);--ez-calendar__nav-btn--fill:var(--text--primary, #008561);--ez-calendar__nav-btn--hover--fill:var(--color--primary, #350404);--ez-calendar__nav-btn--width:10px;--ez-calendar__nav-btn--height:16px;--ez-calendar__nav-btn--previous-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="10px"><path d="M 9.7808475,13.860393 3.9204526,8.0000004 9.7808475,2.0624965 7.9301965,0.28895552 0.21915255,8.0000004 7.9301965,15.711044 Z"/></svg>\');--ez-calendar__nav-btn--next-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="10px"><path d="M 0.21915251,13.860393 6.0795475,8.0000007 0.21915251,2.0624968 2.0698036,0.28895588 9.7808475,8.0000007 2.0698036,15.711044 Z"/></svg>\');--ez-calendar__cell--margin:0px 1.5px;--ez-calendar__cell--width:var(--space--large, 24px);--ez-calendar__cell--padding:1.5px 0px;--ez-calendar__cell--border-radius:var(--border--radius-small, 6px);--ez-calendar__cell--over--background-color:var(--color--primary, #E2F4EF);--ez-calendar__cell--over--color:var(--color--primary-300, #008561);--ez-calendar__cell--outset--color:var(--color--disable-primary, #E5EAF0);--ez-calendar__cell--selected--background-color:var(--color--primary, #008561);--ez-calendar__cell--selected--color:var(--color--inverted, #FFF);--ez-calendar__btn-today--color:var(--color--primary);--ez-calendar__btn-today--hover--background-color:var(--color--primary-300, #E2F4EF);--ez-calendar__btn-today--border-radius:var(--border--radius-small, 6px);position:relative;display:flex;user-select:none}.calendar__container{display:flex;z-index:var(--more-visible, 2)}.calendar{display:flex;flex-direction:column;z-index:var(--more-visible, 2);background-color:var(--ez-calendar__body--background-color);padding:var(--ez-calendar__body--padding);border-radius:var(--ez-calendar__body--border-radius);box-shadow:var(--ez-calendar__body--shadow)}.calendar__header{display:flex;justify-content:space-between;padding-bottom:var(--space--small, 6px);margin:0px var(--space--, 12px) var(--space--small, 6px) var(--space--, 12px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);border-bottom:solid var(--ez-calendar__header-line--stroke) var(--ez-calendar__header-line--color)}.calendar__btn-next,.calendar__btn-previous{outline:none;border:none;background-color:unset;cursor:pointer;padding:0px}.calendar__btn-next::after,.calendar__btn-previous::after{content:\'\';display:flex;background-color:var(--ez-calendar__nav-btn--fill);width:var(--ez-calendar__nav-btn--width);height:var(--ez-calendar__nav-btn--height)}.calendar__btn-previous::after{-webkit-mask-image:var(--ez-calendar__nav-btn--previous-image);mask-image:var(--ez-calendar__nav-btn--previous-image)}.calendar__btn-next::after{-webkit-mask-image:var(--ez-calendar__nav-btn--next-image);mask-image:var(--ez-calendar__nav-btn--next-image)}.calendar__btn-next:hover::after,.calendar__btn-previous:hover::after{background-color:var(--ez-calendar__nav-btn--hover--fill)}.calendar__lbl-month{font-weight:var(--text-weight--extra-large, 700);font-size:var(--title--small, 14px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.calendar__line{display:flex;padding:0px;margin:0px}.calendar__cell{display:flex;justify-content:center;align-content:center;cursor:pointer;font-size:var(--text--extra-small, 10px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);padding:var(--ez-calendar__cell--padding);margin:var(--ez-calendar__cell--margin);min-width:var(--ez-calendar__cell--width);border-radius:var(--ez-calendar__cell--border-radius)}.calendar__cell:hover{background-color:var(--ez-calendar__cell--over--background-color);color:var(--ez-calendar__cell--over--color)}.calendar__cell--secondary{color:var(--ez-calendar__cell--outset--color)}.calendar__cell--unselectable:hover{background-color:unset;border-radius:unset;cursor:unset;color:var(--ez-calendar--color)}.calendar__cell--unselectable{font-weight:var(--text-weight--large, 600);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.calendar__cell--selected,.calendar__cell--selected:hover{background-color:var(--ez-calendar__cell--selected--background-color);color:var(--ez-calendar__cell--selected--color)}.calendar__footer{display:flex;flex-direction:column}.calendar__btn-today{border:none;background-color:unset;cursor:pointer;padding:0px;font-weight:var(--text-weight--large, 600);font-size:var(--title--extra-small, 12px);font-family:var(--ez-calendar--font-family);text-shadow:var(--ez-calendar--text-shadow);color:var(--ez-calendar__btn-today--color);border-radius:var(--ez-calendar__btn-today--border-radius)}.calendar__btn-today:hover{background-color:var(--ez-calendar__btn-today--hover--background-color)}section{display:flex}.calendar-time{margin-left:-10px;display:flex;flex-direction:column;padding:12px 0px 0px 10px;background-color:var(--ez-calendar__time--background-color);border-top-right-radius:var(--ez-calendar__body--border-radius);border-bottom-right-radius:var(--ez-calendar__body--border-radius);box-shadow:var(--ez-calendar__body--shadow)}.calendar__column{height:136px;padding:0px;margin:0px;overflow:auto;scrollbar-width:none}.calendar__column::-webkit-scrollbar{width:0px;max-width:0px;min-width:0px}.calendar-time__header{display:flex;justify-content:space-between;padding-left:var(--space--small, 6px);padding-right:var(--space--small, 6px);padding-bottom:var(--space--small, 6px);margin:0px var(--space--, 12px) var(--space--small, 6px) var(--space--, 12px);font-weight:var(--text-weight--extra-large, 700);font-size:var(--title--small, 14px);text-shadow:var(--ez-calendar--text-shadow);border-bottom:solid var(--ez-calendar__header-line--stroke) var(--ez-calendar__header-line--color);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.separatorTime{color:#A2ABB9;padding:0px 1px;line-height:16px;font-size:17px;font-weight:normal}.endHidden{-webkit-mask-image:linear-gradient(180deg, #000 calc(100% - 48px), transparent 100%)}.calendar__column .calendar__cell{margin:0px;padding:1.5px 1.5px}';export{n as ez_calendar}
@@ -1 +1 @@
1
- import{r as t,c as i,h as s,H as e,g as a}from"./p-23a36bb6.js";import{DateUtils as n,ElementIDUtils as h}from"@sankhyalabs/core";import{C as o}from"./p-ec7db713.js";import{i as r}from"./p-42e1e733.js";const l=class{constructor(s){t(this,s),this.ezChange=i(this,"ezChange",7),this.ezStartChange=i(this,"ezStartChange",7),this.ezCancelWaitingChange=i(this,"ezCancelWaitingChange",7),this.ezInput=i(this,"ezInput",7),this._changePending=!1,this._focused=!1,this._valuePromiseCallbacks=[],this.label=void 0,this.value=void 0,this.enabled=!0,this.errorMessage=void 0,this.mode="regular",this.size="default",this.required=!1,this.canShowError=!0,this.autoFocus=!1,this.alternativePlaceholder=void 0}observeLabel(){this._textInput&&(this._textInput.label=this.label)}observeErrorMessage(){var t;this._textInput&&(this._textInput.errorMessage=this.errorMessage,(null===(t=this.errorMessage)||void 0===t?void 0:t.trim())||this.setInputValue())}observeValue(t,i){if(this._textInput&&t!=i){const s=n.validateDate(t),e=n.validateDate(i);if((null==s?void 0:s.getTime())!==(null==e?void 0:e.getTime())){const t=this.getTextValue(s)||"";!n.strToDate(t)&&this._focused||(this._textInput.value||"")===t||(this._textInput.value=t,this._focused=!1,this.errorMessage=""),this.ezChange.emit(null===s?void 0:s)}}this._changePending=!1}async setFocus(t){this._textInput.setFocus(t)}async setBlur(){this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async getValueAsync(){return this._changePending?new Promise((t=>{this._valuePromiseCallbacks.push(t)})):Promise.resolve(this.value)}changeValue(t){const i=n.validateDate(this.value),s=n.validateDate(t);(null==i?void 0:i.getTime())!==(null==s?void 0:s.getTime())?this.value=s:this._changePending=!1}async handleChangeCalendar(t){this.changeValue(this._calendar.value),this.ezInput.emit(this._calendar.value),this._popover.hide(),await this.setFocus(),t.stopPropagation()}handleBlur(){if(this._changePending)try{const t=this._textInput.value,i=n.strToDate(t);if(i||!t){this.errorMessage="";const t=n.validateDate(this.value),s=n.validateDate(i);(null==t?void 0:t.getTime())===(null==s?void 0:s.getTime())?(s&&(this._textInput.value=this.getTextValue(s)||"",this._focused=!1),this.ezCancelWaitingChange.emit()):(this._focused=!1,this.changeValue(s))}else this.changeValue(void 0),this.ezCancelWaitingChange.emit(),this.errorMessage=this.i18n("ez-classic-date-input.invalidDate")}finally{for(const t of this._valuePromiseCallbacks)t(this.value);this._valuePromiseCallbacks=[]}}getTextValue(t){return t?n.formatDate(t):void 0}handleInput(t){const i=n.strToDate(this._textInput.value),s=n.validateDate(this.value),e=n.validateDate(i);if((null==s?void 0:s.getTime())!==(null==e?void 0:e.getTime())&&(this._changePending=!0,this._focused=!0,this.ezStartChange.emit({waitmessage:"",blocking:!1})),"H"===t.data||"h"===t.data){const t=new Date;this.ezInput.emit(t),this.changeValue(t)}}setInputValue(){const t=this.getTextValue(this.value)||"";(this._textInput.value||"")!==t&&(this._textInput.value=t)}disconnectedCallback(){this._popover.hide()}async componentWillLoad(){this.i18n=await r()}componentDidLoad(){o.applyVarsTextInput(this._elem,this._textInput),this.setInputValue(),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}render(){return h.addIDInfoIfNotExists(this._elem,"input"),s(e,null,s("ez-classic-input",{"data-element-id":h.getInternalIDInfo("textInput"),ref:t=>this._textInput=t,"data-slave-mode":"true",label:this.label,onBlur:()=>this.handleBlur(),onInput:t=>this.handleInput(t),mask:"##/##/####",enabled:this.enabled,errorMessage:this.errorMessage,mode:this.mode,size:this.size,canShowError:this.canShowError,alternativePlaceholder:this.alternativePlaceholder,required:this.required,leftIconName:"calendar",leftIconClickable:this.enabled,onIconClick:()=>{var t;return null===(t=this._popover)||void 0===t?void 0:t.showUnder(this._textInput)},onEzChange:t=>t.stopPropagation()}),s("ez-popover-plus",{ref:t=>this._popover=t,anchorElement:this._textInput,autoClose:!0,boxWidth:"fit-content",overlayType:"none","data-element-id":this._elem.getAttribute("data-element-id"),onEzVisibilityChange:t=>t.stopPropagation()},s("ez-calendar",{ref:t=>this._calendar=t,"data-element-id":h.getInternalIDInfo("calendar"),onEzChange:t=>this.handleChangeCalendar(t),value:this.value})))}get _elem(){return a(this)}static get watchers(){return{label:["observeLabel"],errorMessage:["observeErrorMessage"],value:["observeValue"]}}};l.style=':host{display:block;width:100%;--ez-classic-date-input__input--background-color:var(--background--medium, #e0e0e0);--ez-classic-date-input__input--border-color:var(--ez-classic-date-input__input--background-color);--ez-classic-date-input__calendar-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="15px"><path d="M 3.171875,5.25 C 2.6485088,5.25 2.21875,5.6797588 2.21875,6.203125 2.21875,6.7264912 2.6485088,7.15625 3.171875,7.15625 3.6952412,7.15625 4.125,6.7264912 4.125,6.203125 4.125,5.6797588 3.6952412,5.25 3.171875,5.25 Z m 2.875,0 C 5.5235088,5.25 5.09375,5.6797588 5.09375,6.203125 5.09375,6.7264912 5.5235088,7.15625 6.046875,7.15625 6.5702412,7.15625 7,6.7264912 7,6.203125 7,5.6797588 6.5702412,5.25 6.046875,5.25 Z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.9511719,-0.4297588 0.9511719,-0.953125 C 9.8730469,5.6797588 9.4452412,5.25 8.921875,5.25 Z m 2.873047,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.953125 0.953125,0.953125 0.523366,0 0.953125,-0.4297588 0.953125,-0.953125 C 12.748047,5.6797588 12.318288,5.25 11.794922,5.25 Z M 3.171875,8.1230469 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 0.5233662,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 C 6.5702412,10.029297 7,9.5995381 7,9.0761719 7,8.5528057 6.5702412,8.1230469 6.046875,8.1230469 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297587,0.9531251 0.953125,0.9531251 0.5233661,0 0.9531249,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.9531251 0.953125,0.9531251 0.523367,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.171875,10.998047 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 C 6.5702412,12.904297 7,12.474538 7,11.951172 7,11.427806 6.5702412,10.998047 6.046875,10.998047 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297587,0.953125 0.953125,0.953125 0.5233661,0 0.9531249,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.429759,0.953125 0.953125,0.953125 0.523367,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.5,0 c -0.554,0 -1,0.446 -1,1 v 0.050781 C 1.0853217,1.2909766 0,2.5186658 0,4 v 9 c 0,1.652487 1.3475134,3 3,3 h 9 c 1.652487,0 3,-1.347513 3,-3 V 4 C 15,2.5186658 13.914678,1.2909766 12.5,1.0507812 V 1 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 C 4.5,0.446 4.054,0 3.5,0 Z m 1,2.0996094 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 v -0.640625 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 2.1738281 C 13.311725,2.3905225 13.900391,3.11278 13.900391,4 v 9 c 0,1.062113 -0.838278,1.900391 -1.900391,1.900391 H 3 C 1.9378864,14.900391 1.0996094,14.062113 1.0996094,13 V 4 C 1.0996094,3.11278 1.6882747,2.3905225 2.5,2.1738281 v 0.5664063 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 z"/></svg>\')}.btn-open-cal{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-cal:disabled{cursor:not-allowed}.btn-open-cal::after{content:\'\';display:flex;background-color:var(--text--primary, #008561);width:15px;height:16px;-webkit-mask-image:var(--ez-classic-date-input__calendar-image);mask-image:var(--ez-classic-date-input__calendar-image)}.btn-open-cal:disabled:after{background-color:var(--text--disable, #AFB6C0)}.btn-open-cal:enabled:hover::after{background-color:var(--color--primary, #4e4e4e)}ez-classic-input{--text-input__input--background-color:var(--ez-classic-date-input__input--background-color, #FFFFFF);--text-input__input--border-color:var(--ez-classic-date-input__input--border-color, #DCE0E8)}';export{l as ez_classic_date_input}
1
+ import{r as t,c as i,h as s,H as e,g as a}from"./p-e4c7eb39.js";import{DateUtils as n,ElementIDUtils as h}from"@sankhyalabs/core";import{C as o}from"./p-ec7db713.js";import{i as r}from"./p-42e1e733.js";const l=class{constructor(s){t(this,s),this.ezChange=i(this,"ezChange",7),this.ezStartChange=i(this,"ezStartChange",7),this.ezCancelWaitingChange=i(this,"ezCancelWaitingChange",7),this.ezInput=i(this,"ezInput",7),this._changePending=!1,this._focused=!1,this._valuePromiseCallbacks=[],this.label=void 0,this.value=void 0,this.enabled=!0,this.errorMessage=void 0,this.mode="regular",this.size="default",this.required=!1,this.canShowError=!0,this.autoFocus=!1,this.alternativePlaceholder=void 0}observeLabel(){this._textInput&&(this._textInput.label=this.label)}observeErrorMessage(){var t;this._textInput&&(this._textInput.errorMessage=this.errorMessage,(null===(t=this.errorMessage)||void 0===t?void 0:t.trim())||this.setInputValue())}observeValue(t,i){if(this._textInput&&t!=i){const s=n.validateDate(t),e=n.validateDate(i);if((null==s?void 0:s.getTime())!==(null==e?void 0:e.getTime())){const t=this.getTextValue(s)||"";!n.strToDate(t)&&this._focused||(this._textInput.value||"")===t||(this._textInput.value=t,this._focused=!1,this.errorMessage=""),this.ezChange.emit(null===s?void 0:s)}}this._changePending=!1}async setFocus(t){this._textInput.setFocus(t)}async setBlur(){this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async getValueAsync(){return this._changePending?new Promise((t=>{this._valuePromiseCallbacks.push(t)})):Promise.resolve(this.value)}changeValue(t){const i=n.validateDate(this.value),s=n.validateDate(t);(null==i?void 0:i.getTime())!==(null==s?void 0:s.getTime())?this.value=s:this._changePending=!1}async handleChangeCalendar(t){this.changeValue(this._calendar.value),this.ezInput.emit(this._calendar.value),this._popover.hide(),await this.setFocus(),t.stopPropagation()}handleBlur(){if(this._changePending)try{const t=this._textInput.value,i=n.strToDate(t);if(i||!t){this.errorMessage="";const t=n.validateDate(this.value),s=n.validateDate(i);(null==t?void 0:t.getTime())===(null==s?void 0:s.getTime())?(s&&(this._textInput.value=this.getTextValue(s)||"",this._focused=!1),this.ezCancelWaitingChange.emit()):(this._focused=!1,this.changeValue(s))}else this.changeValue(void 0),this.ezCancelWaitingChange.emit(),this.errorMessage=this.i18n("ez-classic-date-input.invalidDate")}finally{for(const t of this._valuePromiseCallbacks)t(this.value);this._valuePromiseCallbacks=[]}}getTextValue(t){return t?n.formatDate(t):void 0}handleInput(t){const i=n.strToDate(this._textInput.value),s=n.validateDate(this.value),e=n.validateDate(i);if((null==s?void 0:s.getTime())!==(null==e?void 0:e.getTime())&&(this._changePending=!0,this._focused=!0,this.ezStartChange.emit({waitmessage:"",blocking:!1})),"H"===t.data||"h"===t.data){const t=new Date;this.ezInput.emit(t),this.changeValue(t)}}setInputValue(){const t=this.getTextValue(this.value)||"";(this._textInput.value||"")!==t&&(this._textInput.value=t)}disconnectedCallback(){this._popover.hide()}async componentWillLoad(){this.i18n=await r()}componentDidLoad(){o.applyVarsTextInput(this._elem,this._textInput),this.setInputValue(),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}render(){return h.addIDInfoIfNotExists(this._elem,"input"),s(e,null,s("ez-classic-input",{"data-element-id":h.getInternalIDInfo("textInput"),ref:t=>this._textInput=t,"data-slave-mode":"true",label:this.label,onBlur:()=>this.handleBlur(),onInput:t=>this.handleInput(t),mask:"##/##/####",enabled:this.enabled,errorMessage:this.errorMessage,mode:this.mode,size:this.size,canShowError:this.canShowError,alternativePlaceholder:this.alternativePlaceholder,required:this.required,leftIconName:"calendar",leftIconClickable:this.enabled,onIconClick:()=>{var t;return null===(t=this._popover)||void 0===t?void 0:t.showUnder(this._textInput)},onEzChange:t=>t.stopPropagation()}),s("ez-popover-plus",{ref:t=>this._popover=t,anchorElement:this._textInput,autoClose:!0,boxWidth:"fit-content",overlayType:"none","data-element-id":this._elem.getAttribute("data-element-id"),onEzVisibilityChange:t=>t.stopPropagation()},s("ez-calendar",{ref:t=>this._calendar=t,"data-element-id":h.getInternalIDInfo("calendar"),onEzChange:t=>this.handleChangeCalendar(t),value:this.value})))}get _elem(){return a(this)}static get watchers(){return{label:["observeLabel"],errorMessage:["observeErrorMessage"],value:["observeValue"]}}};l.style=':host{display:block;width:100%;--ez-classic-date-input__input--background-color:var(--background--medium, #e0e0e0);--ez-classic-date-input__input--border-color:var(--ez-classic-date-input__input--background-color);--ez-classic-date-input__calendar-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="15px"><path d="M 3.171875,5.25 C 2.6485088,5.25 2.21875,5.6797588 2.21875,6.203125 2.21875,6.7264912 2.6485088,7.15625 3.171875,7.15625 3.6952412,7.15625 4.125,6.7264912 4.125,6.203125 4.125,5.6797588 3.6952412,5.25 3.171875,5.25 Z m 2.875,0 C 5.5235088,5.25 5.09375,5.6797588 5.09375,6.203125 5.09375,6.7264912 5.5235088,7.15625 6.046875,7.15625 6.5702412,7.15625 7,6.7264912 7,6.203125 7,5.6797588 6.5702412,5.25 6.046875,5.25 Z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.9511719,-0.4297588 0.9511719,-0.953125 C 9.8730469,5.6797588 9.4452412,5.25 8.921875,5.25 Z m 2.873047,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.953125 0.953125,0.953125 0.523366,0 0.953125,-0.4297588 0.953125,-0.953125 C 12.748047,5.6797588 12.318288,5.25 11.794922,5.25 Z M 3.171875,8.1230469 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 0.5233662,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 C 6.5702412,10.029297 7,9.5995381 7,9.0761719 7,8.5528057 6.5702412,8.1230469 6.046875,8.1230469 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297587,0.9531251 0.953125,0.9531251 0.5233661,0 0.9531249,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.9531251 0.953125,0.9531251 0.523367,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.171875,10.998047 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 C 6.5702412,12.904297 7,12.474538 7,11.951172 7,11.427806 6.5702412,10.998047 6.046875,10.998047 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297587,0.953125 0.953125,0.953125 0.5233661,0 0.9531249,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.429759,0.953125 0.953125,0.953125 0.523367,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.5,0 c -0.554,0 -1,0.446 -1,1 v 0.050781 C 1.0853217,1.2909766 0,2.5186658 0,4 v 9 c 0,1.652487 1.3475134,3 3,3 h 9 c 1.652487,0 3,-1.347513 3,-3 V 4 C 15,2.5186658 13.914678,1.2909766 12.5,1.0507812 V 1 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 C 4.5,0.446 4.054,0 3.5,0 Z m 1,2.0996094 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 v -0.640625 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 2.1738281 C 13.311725,2.3905225 13.900391,3.11278 13.900391,4 v 9 c 0,1.062113 -0.838278,1.900391 -1.900391,1.900391 H 3 C 1.9378864,14.900391 1.0996094,14.062113 1.0996094,13 V 4 C 1.0996094,3.11278 1.6882747,2.3905225 2.5,2.1738281 v 0.5664063 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 z"/></svg>\')}.btn-open-cal{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-cal:disabled{cursor:not-allowed}.btn-open-cal::after{content:\'\';display:flex;background-color:var(--text--primary, #008561);width:15px;height:16px;-webkit-mask-image:var(--ez-classic-date-input__calendar-image);mask-image:var(--ez-classic-date-input__calendar-image)}.btn-open-cal:disabled:after{background-color:var(--text--disable, #AFB6C0)}.btn-open-cal:enabled:hover::after{background-color:var(--color--primary, #4e4e4e)}ez-classic-input{--text-input__input--background-color:var(--ez-classic-date-input__input--background-color, #FFFFFF);--text-input__input--border-color:var(--ez-classic-date-input__input--border-color, #DCE0E8)}';export{l as ez_classic_date_input}