@sankhyalabs/ezui 7.1.0-dev.22 → 7.1.0-dev.25
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.
- package/dist/cjs/classic-search-list_7.cjs.entry.js +2 -2
- package/dist/cjs/ez-actions-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-alert-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-alert.cjs.entry.js +1 -1
- package/dist/cjs/ez-application.cjs.entry.js +1 -1
- package/dist/cjs/ez-avatar.cjs.entry.js +1 -1
- package/dist/cjs/ez-badge.cjs.entry.js +1 -1
- package/dist/cjs/ez-breadcrumb.cjs.entry.js +1 -1
- package/dist/cjs/ez-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-calendar.cjs.entry.js +1 -1
- package/dist/cjs/ez-card-item.cjs.entry.js +1 -1
- package/dist/cjs/ez-chart.cjs.entry.js +1 -1
- package/dist/cjs/ez-check.cjs.entry.js +1 -1
- package/dist/cjs/ez-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-classic-combo-box.cjs.entry.js +3 -2
- package/dist/cjs/ez-classic-date-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-classic-date-time-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-classic-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-classic-number-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-classic-search-plus.cjs.entry.js +1 -1
- package/dist/cjs/ez-classic-search.cjs.entry.js +1 -1
- package/dist/cjs/ez-classic-text-area.cjs.entry.js +13 -2
- package/dist/cjs/ez-classic-time-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -1
- package/dist/cjs/ez-combo-box.cjs.entry.js +1 -1
- package/dist/cjs/ez-date-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-date-time-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ez-double-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/ez-empty-card.cjs.entry.js +1 -1
- package/dist/cjs/ez-file-item.cjs.entry.js +1 -1
- package/dist/cjs/ez-filter-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-form-view.cjs.entry.js +2 -2
- package/dist/cjs/ez-form.cjs.entry.js +2 -2
- package/dist/cjs/ez-grid-view.cjs.entry.js +1 -1
- package/dist/cjs/ez-grid.cjs.entry.js +2 -2
- package/dist/cjs/ez-guide-navigator.cjs.entry.js +1 -1
- package/dist/cjs/ez-icon.cjs.entry.js +1 -1
- package/dist/cjs/ez-link-builder_6.cjs.entry.js +1 -1
- package/dist/cjs/ez-list-item.cjs.entry.js +1 -1
- package/dist/cjs/ez-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-loading-bar.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal-container.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal.cjs.entry.js +1 -1
- package/dist/cjs/ez-multi-selection-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-number-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-pagination.cjs.entry.js +1 -1
- package/dist/cjs/ez-popover-core.cjs.entry.js +1 -1
- package/dist/cjs/ez-popover-plus_3.cjs.entry.js +1 -1
- package/dist/cjs/ez-popover.cjs.entry.js +1 -1
- package/dist/cjs/ez-popup.cjs.entry.js +1 -1
- package/dist/cjs/ez-progress-bar.cjs.entry.js +1 -1
- package/dist/cjs/ez-radio-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-rich-toolbar-item.cjs.entry.js +1 -1
- package/dist/cjs/ez-scroller_2.cjs.entry.js +1 -1
- package/dist/cjs/ez-search-plus.cjs.entry.js +3 -3
- package/dist/cjs/ez-search-result-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-search.cjs.entry.js +1 -1
- package/dist/cjs/ez-sidebar-navigator.cjs.entry.js +1 -1
- package/dist/cjs/ez-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/ez-sortable-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-spinner.cjs.entry.js +1 -1
- package/dist/cjs/ez-split-button.cjs.entry.js +13 -14
- package/dist/cjs/ez-split-item.cjs.entry.js +1 -1
- package/dist/cjs/ez-split-panel.cjs.entry.js +1 -1
- package/dist/cjs/ez-tabselector.cjs.entry.js +1 -1
- package/dist/cjs/ez-tag-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-tag.cjs.entry.js +1 -1
- package/dist/cjs/ez-text-area.cjs.entry.js +1 -1
- package/dist/cjs/ez-text-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-tile-medium.cjs.entry.js +1 -1
- package/dist/cjs/ez-tile.cjs.entry.js +1 -1
- package/dist/cjs/ez-time-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-toast.cjs.entry.js +1 -1
- package/dist/cjs/ez-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/ez-tree.cjs.entry.js +1 -1
- package/dist/cjs/ez-underface.cjs.entry.js +1 -1
- package/dist/cjs/ez-upload.cjs.entry.js +1 -1
- package/dist/cjs/ez-view-stack.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +2 -2
- package/dist/cjs/filter-column.cjs.entry.js +1 -1
- package/dist/cjs/{index-9e5554cb.js → index-a7b0c73d.js} +0 -3
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{search-column-9654bf26.js → search-column-fbf680d7.js} +7 -2
- package/dist/collection/components/ez-classic-combo-box/ez-classic-combo-box.js +19 -1
- package/dist/collection/components/ez-classic-text-area/ez-classic-text-area.js +32 -1
- package/dist/collection/components/ez-form-view/ez-form-view.css +8 -4
- package/dist/collection/components/ez-search-plus/ez-search-plus.js +2 -2
- package/dist/collection/components/ez-split-button/ez-split-button.js +18 -13
- package/dist/collection/utils/searchColumn/search-column.js +6 -1
- package/dist/custom-elements/index.js +38 -22
- package/dist/esm/classic-search-list_7.entry.js +2 -2
- package/dist/esm/ez-actions-button.entry.js +1 -1
- package/dist/esm/ez-alert-list.entry.js +1 -1
- package/dist/esm/ez-alert.entry.js +1 -1
- package/dist/esm/ez-application.entry.js +1 -1
- package/dist/esm/ez-avatar.entry.js +1 -1
- package/dist/esm/ez-badge.entry.js +1 -1
- package/dist/esm/ez-breadcrumb.entry.js +1 -1
- package/dist/esm/ez-button.entry.js +1 -1
- package/dist/esm/ez-calendar.entry.js +1 -1
- package/dist/esm/ez-card-item.entry.js +1 -1
- package/dist/esm/ez-chart.entry.js +1 -1
- package/dist/esm/ez-check.entry.js +1 -1
- package/dist/esm/ez-chip.entry.js +1 -1
- package/dist/esm/ez-classic-combo-box.entry.js +3 -2
- package/dist/esm/ez-classic-date-input.entry.js +1 -1
- package/dist/esm/ez-classic-date-time-input.entry.js +1 -1
- package/dist/esm/ez-classic-input.entry.js +1 -1
- package/dist/esm/ez-classic-number-input.entry.js +1 -1
- package/dist/esm/ez-classic-search-plus.entry.js +1 -1
- package/dist/esm/ez-classic-search.entry.js +1 -1
- package/dist/esm/ez-classic-text-area.entry.js +13 -2
- package/dist/esm/ez-classic-time-input.entry.js +1 -1
- package/dist/esm/ez-collapsible-box.entry.js +1 -1
- package/dist/esm/ez-combo-box.entry.js +1 -1
- package/dist/esm/ez-date-input.entry.js +1 -1
- package/dist/esm/ez-date-time-input.entry.js +1 -1
- package/dist/esm/ez-dialog.entry.js +1 -1
- package/dist/esm/ez-double-list.entry.js +1 -1
- package/dist/esm/ez-dropdown.entry.js +1 -1
- package/dist/esm/ez-empty-card.entry.js +1 -1
- package/dist/esm/ez-file-item.entry.js +1 -1
- package/dist/esm/ez-filter-input.entry.js +1 -1
- package/dist/esm/ez-form-view.entry.js +2 -2
- package/dist/esm/ez-form.entry.js +2 -2
- package/dist/esm/ez-grid-view.entry.js +1 -1
- package/dist/esm/ez-grid.entry.js +2 -2
- package/dist/esm/ez-guide-navigator.entry.js +1 -1
- package/dist/esm/ez-icon.entry.js +1 -1
- package/dist/esm/ez-link-builder_6.entry.js +1 -1
- package/dist/esm/ez-list-item.entry.js +1 -1
- package/dist/esm/ez-list.entry.js +1 -1
- package/dist/esm/ez-loading-bar.entry.js +1 -1
- package/dist/esm/ez-modal-container.entry.js +1 -1
- package/dist/esm/ez-modal.entry.js +1 -1
- package/dist/esm/ez-multi-selection-list.entry.js +1 -1
- package/dist/esm/ez-number-input.entry.js +1 -1
- package/dist/esm/ez-pagination.entry.js +1 -1
- package/dist/esm/ez-popover-core.entry.js +1 -1
- package/dist/esm/ez-popover-plus_3.entry.js +1 -1
- package/dist/esm/ez-popover.entry.js +1 -1
- package/dist/esm/ez-popup.entry.js +1 -1
- package/dist/esm/ez-progress-bar.entry.js +1 -1
- package/dist/esm/ez-radio-button.entry.js +1 -1
- package/dist/esm/ez-rich-toolbar-item.entry.js +1 -1
- package/dist/esm/ez-scroller_2.entry.js +1 -1
- package/dist/esm/ez-search-plus.entry.js +3 -3
- package/dist/esm/ez-search-result-list.entry.js +1 -1
- package/dist/esm/ez-search.entry.js +1 -1
- package/dist/esm/ez-sidebar-navigator.entry.js +1 -1
- package/dist/esm/ez-skeleton.entry.js +1 -1
- package/dist/esm/ez-sortable-list.entry.js +1 -1
- package/dist/esm/ez-spinner.entry.js +1 -1
- package/dist/esm/ez-split-button.entry.js +13 -14
- package/dist/esm/ez-split-item.entry.js +1 -1
- package/dist/esm/ez-split-panel.entry.js +1 -1
- package/dist/esm/ez-tabselector.entry.js +1 -1
- package/dist/esm/ez-tag-input.entry.js +1 -1
- package/dist/esm/ez-tag.entry.js +1 -1
- package/dist/esm/ez-text-area.entry.js +1 -1
- package/dist/esm/ez-text-input.entry.js +1 -1
- package/dist/esm/ez-tile-medium.entry.js +1 -1
- package/dist/esm/ez-tile.entry.js +1 -1
- package/dist/esm/ez-time-input.entry.js +1 -1
- package/dist/esm/ez-toast.entry.js +1 -1
- package/dist/esm/ez-tooltip.entry.js +1 -1
- package/dist/esm/ez-tree.entry.js +1 -1
- package/dist/esm/ez-underface.entry.js +1 -1
- package/dist/esm/ez-upload.entry.js +1 -1
- package/dist/esm/ez-view-stack.entry.js +1 -1
- package/dist/esm/ezui.js +3 -3
- package/dist/esm/filter-column.entry.js +1 -1
- package/dist/esm/{index-5a720e56.js → index-baa5e267.js} +1 -3
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{search-column-c3df6285.js → search-column-40a78cac.js} +7 -2
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-e275353b.entry.js → p-0248846f.entry.js} +1 -1
- package/dist/ezui/{p-34d596a3.entry.js → p-0625743b.entry.js} +1 -1
- package/dist/ezui/p-07fb22c3.entry.js +1 -0
- package/dist/ezui/{p-81461d2f.entry.js → p-1e7a8633.entry.js} +1 -1
- package/dist/ezui/{p-6b51c9cc.entry.js → p-1f50fa05.entry.js} +1 -1
- package/dist/ezui/{p-cf33bc48.entry.js → p-20c024f7.entry.js} +1 -1
- package/dist/ezui/{p-e4c7eb39.js → p-23a36bb6.js} +2 -2
- package/dist/ezui/{p-169d460d.entry.js → p-2528e988.entry.js} +1 -1
- package/dist/ezui/{p-d57ea090.entry.js → p-26cd4c2e.entry.js} +1 -1
- package/dist/ezui/{p-06f1b8e4.entry.js → p-288631d1.entry.js} +1 -1
- package/dist/ezui/{p-e0380234.entry.js → p-2da9faf1.entry.js} +1 -1
- package/dist/ezui/p-2de94faf.entry.js +1 -0
- package/dist/ezui/{p-f32d5a82.entry.js → p-34d459e4.entry.js} +1 -1
- package/dist/ezui/{p-f7ca8634.entry.js → p-411c0222.entry.js} +1 -1
- package/dist/ezui/{p-87739608.entry.js → p-44183c39.entry.js} +1 -1
- package/dist/ezui/{p-2c123fdf.entry.js → p-4af745e1.entry.js} +1 -1
- package/dist/ezui/p-4bb92e0a.entry.js +1 -0
- package/dist/ezui/{p-0820f8c3.entry.js → p-4c2a4435.entry.js} +1 -1
- package/dist/ezui/{p-fe0bca65.entry.js → p-4c76b365.entry.js} +1 -1
- package/dist/ezui/{p-4a876b8b.entry.js → p-4d30b703.entry.js} +1 -1
- package/dist/ezui/{p-4d909730.entry.js → p-4e576bb9.entry.js} +1 -1
- package/dist/ezui/{p-2fa490f1.entry.js → p-4e869617.entry.js} +1 -1
- package/dist/ezui/{p-55a9e4ba.entry.js → p-4f7ad3ee.entry.js} +1 -1
- package/dist/ezui/{p-3453dad5.entry.js → p-544605c4.entry.js} +1 -1
- package/dist/ezui/{p-05bcbe61.entry.js → p-556bf329.entry.js} +1 -1
- package/dist/ezui/{p-be2e39c5.entry.js → p-56565777.entry.js} +1 -1
- package/dist/ezui/{p-12cc95dc.entry.js → p-5abb220b.entry.js} +1 -1
- package/dist/ezui/{p-6fc26622.entry.js → p-5ed81457.entry.js} +1 -1
- package/dist/ezui/{p-c754774e.entry.js → p-6020f3d5.entry.js} +1 -1
- package/dist/ezui/{p-f0425f87.entry.js → p-619225ce.entry.js} +1 -1
- package/dist/ezui/{p-51e34317.entry.js → p-6369a0cd.entry.js} +1 -1
- package/dist/ezui/{p-27c8a9b7.entry.js → p-639a2692.entry.js} +1 -1
- package/dist/ezui/{p-29341f74.js → p-6a794336.js} +1 -1
- package/dist/ezui/{p-458027b5.entry.js → p-6ac056d7.entry.js} +1 -1
- package/dist/ezui/{p-0b531233.entry.js → p-6d596a5a.entry.js} +1 -1
- package/dist/ezui/{p-1723f728.entry.js → p-6f77a359.entry.js} +1 -1
- package/dist/ezui/{p-82e1d7fc.entry.js → p-7134726a.entry.js} +1 -1
- package/dist/ezui/{p-e039e049.entry.js → p-729bd1be.entry.js} +1 -1
- package/dist/ezui/{p-70f30bfe.entry.js → p-7953ecb9.entry.js} +1 -1
- package/dist/ezui/p-7df45688.entry.js +1 -0
- package/dist/ezui/{p-636ea910.entry.js → p-7edc3ef7.entry.js} +1 -1
- package/dist/ezui/{p-e195eaad.entry.js → p-7f792043.entry.js} +1 -1
- package/dist/ezui/{p-82fa4b09.entry.js → p-8df1ca33.entry.js} +1 -1
- package/dist/ezui/{p-75443a91.entry.js → p-8e5f1c74.entry.js} +1 -1
- package/dist/ezui/{p-78e975b4.entry.js → p-91c9d50e.entry.js} +1 -1
- package/dist/ezui/{p-05e68ab3.entry.js → p-93e1c917.entry.js} +1 -1
- package/dist/ezui/{p-0ba284cd.entry.js → p-97312709.entry.js} +1 -1
- package/dist/ezui/{p-d3aca6aa.entry.js → p-987185c4.entry.js} +1 -1
- package/dist/ezui/{p-c2b20f78.entry.js → p-9f5fa3f9.entry.js} +1 -1
- package/dist/ezui/{p-bc693db6.entry.js → p-a0bf1fc7.entry.js} +1 -1
- package/dist/ezui/{p-27421015.entry.js → p-a0f51b99.entry.js} +1 -1
- package/dist/ezui/{p-9bcfa689.entry.js → p-a3075f52.entry.js} +1 -1
- package/dist/ezui/{p-f26b97e9.entry.js → p-a3ada561.entry.js} +1 -1
- package/dist/ezui/{p-71b341cc.entry.js → p-a3bad8f8.entry.js} +1 -1
- package/dist/ezui/{p-e94d3af5.entry.js → p-a4351519.entry.js} +1 -1
- package/dist/ezui/{p-dfca5946.entry.js → p-a80b1287.entry.js} +1 -1
- package/dist/ezui/{p-534209bf.entry.js → p-a872c642.entry.js} +1 -1
- package/dist/ezui/{p-e963cb3f.entry.js → p-b0a716ef.entry.js} +1 -1
- package/dist/ezui/p-b36475f9.entry.js +1 -0
- package/dist/ezui/{p-9fb7131e.entry.js → p-b705b342.entry.js} +1 -1
- package/dist/ezui/{p-f1b54699.entry.js → p-b8078832.entry.js} +1 -1
- package/dist/ezui/p-bc2f844e.entry.js +1 -0
- package/dist/ezui/{p-75e8862c.entry.js → p-c0ae79fa.entry.js} +1 -1
- package/dist/ezui/{p-75e650ff.entry.js → p-c56ee8c0.entry.js} +1 -1
- package/dist/ezui/{p-25748a4e.entry.js → p-cd8be0c7.entry.js} +1 -1
- package/dist/ezui/{p-24993171.entry.js → p-ce0a0036.entry.js} +1 -1
- package/dist/ezui/{p-ce2614fc.entry.js → p-cfa26133.entry.js} +1 -1
- package/dist/ezui/{p-c96e536d.entry.js → p-d2645bdf.entry.js} +1 -1
- package/dist/ezui/{p-a9432878.entry.js → p-d6742c1e.entry.js} +1 -1
- package/dist/ezui/{p-770cf2b8.entry.js → p-d6f50207.entry.js} +1 -1
- package/dist/ezui/p-d8cc640d.entry.js +1 -0
- package/dist/ezui/{p-9d515e5b.entry.js → p-df802548.entry.js} +1 -1
- package/dist/ezui/{p-e0fd2ce5.entry.js → p-e2972977.entry.js} +1 -1
- package/dist/ezui/{p-181cb82f.entry.js → p-e3a42f47.entry.js} +1 -1
- package/dist/ezui/{p-29f0de90.entry.js → p-e3cd5080.entry.js} +1 -1
- package/dist/ezui/{p-4df2edb5.entry.js → p-e493ad57.entry.js} +1 -1
- package/dist/ezui/{p-000159dc.entry.js → p-e75c7a23.entry.js} +1 -1
- package/dist/ezui/{p-e9b409c1.entry.js → p-e7a7c594.entry.js} +1 -1
- package/dist/ezui/{p-b21efe83.entry.js → p-e8c57463.entry.js} +1 -1
- package/dist/ezui/{p-35e3715c.entry.js → p-ef8bd3e8.entry.js} +1 -1
- package/dist/ezui/{p-980f1f18.entry.js → p-f34ec732.entry.js} +1 -1
- package/dist/ezui/{p-a6ea8da3.entry.js → p-f5552540.entry.js} +1 -1
- package/dist/ezui/{p-44b39e81.entry.js → p-fa6732f2.entry.js} +1 -1
- package/dist/types/components/ez-classic-combo-box/ez-classic-combo-box.d.ts +2 -0
- package/dist/types/components/ez-classic-text-area/ez-classic-text-area.d.ts +3 -0
- package/dist/types/components/ez-split-button/ez-split-button.d.ts +1 -2
- package/dist/types/components.d.ts +16 -0
- package/package.json +1 -1
- package/dist/ezui/p-0d393a5d.entry.js +0 -1
- package/dist/ezui/p-14d6aeb8.entry.js +0 -1
- package/dist/ezui/p-2b51d5a9.entry.js +0 -1
- package/dist/ezui/p-6ec40dec.entry.js +0 -1
- package/dist/ezui/p-81a98a7c.entry.js +0 -1
- package/dist/ezui/p-892e7326.entry.js +0 -1
- package/dist/ezui/p-8f7373ab.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as o,r,c as e,H as d,g as n}from"./p-e4c7eb39.js";import{ElementIDUtils as i,ObjectUtils as t}from"@sankhyalabs/core";const l=({item:r,hasIcon:e,hasChildren:d,isLockedLevels:n,onSubActionClick:i})=>o("div",{class:"ez-dropdown__item-wrapper",title:r.label},a(r,e),o("span",{class:"ez-dropdown__item-label"},r.label),s(r,d,n,i)),a=(r,e)=>{if(null!=r&&e)return o("ez-icon",r.iconName?Object.assign({class:"ez-dropdown__icon-left",iconName:r.iconName,size:"medium"},{[i.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${r.id}_ezDropdownItemIcon`}):{class:"ez-dropdown__icon-left ez-dropdown__hidden",size:"medium"})},s=(r,e,d,n)=>{var t,l;if(null!=r){if(!(null===(t=r.children)||void 0===t?void 0:t.length)&&null!=r.subAction&&Object.keys(r.subAction).length>0)return o("span",Object.assign({onClick:()=>n(r),title:r.subAction.label,class:`ez-dropdown__link ez-dropdown__link--${r.subAction.type||"primary"}`},{[i.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${r.subAction.id}_ezDropdownItemSubAction`}),r.subAction.label);if(!d&&e)return(null===(l=r.children)||void 0===l?void 0:l.length)>0?o("ez-icon",Object.assign({class:"ez-dropdown__icon-right",iconName:"chevron-right",size:"medium"},{[i.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${r.id}_ezDropdownIconOpenChildren`})):o("ez-icon",{class:"ez-dropdown__icon-right ez-dropdown__hidden",size:"medium"})}};class p{constructor(){}show(o){const r=null==o?void 0:o.querySelector(".ez-dropdown__submenu");null!=o&&null!=r&&(r.classList.remove("ez-dropdown__submenu--hide"),this.setPosition(o),this.setScrollContainer(o),this.setMaxHeight(r))}hide(o){if(null==o)return;const r=o.querySelector(".ez-dropdown__submenu:not(.ez-dropdown__submenu--hide)");this.reset(r),this.hideChild(r)}hideChild(o){null!=o&&o.querySelectorAll(".ez-dropdown__submenu").forEach((o=>{this.reset(o)}))}setPosition(o){const r=null==o?void 0:o.querySelector(".ez-dropdown__submenu"),e=null==o?void 0:o.closest(".ez-dropdown");if(null==r||null==e)return;r.style.top=this.getPositionTop(o),r.style.left=this.getPositionRight(e);const d=null==r?void 0:r.getBoundingClientRect(),n=document.body.clientWidth;(null==d?void 0:d.right)>n&&this.updatePosition(e,r)}setMaxHeight(o){var r;const e=(null==o?void 0:o.shadowRoot)||o,d=null==e?void 0:e.querySelector(".ez-dropdown"),n=document.body.clientHeight;let i,t;if(null!=(null==e?void 0:e.tagName)?(i=e,t=null==i?void 0:i.getBoundingClientRect()):t=null==d?void 0:d.getBoundingClientRect(),null!=d&&null!=t){if(t.y+t.height>n)if(null!=i){const o=i.closest(".ez-dropdown"),e=null==o?void 0:o.getBoundingClientRect(),l=parseFloat((null===(r=getComputedStyle(i))||void 0===r?void 0:r.marginTop)||"0");if(null==o||null==e)return;e.y+t.height>n?(i.style.top=e.y-l+"px",d.style.maxHeight=n-e.y+"px"):i.style.top=n-t.height-l+"px"}else{let o=n-t.y;o<0&&(o=t.height-n),d.style.maxHeight=o+"px"}this.setSpacerContainer(d)}}setSpacerContainer(o){const r=null==o?void 0:o.querySelector(".ez-dropdown__container");null!=r&&(r.scrollHeight>r.clientHeight?r.classList.add("ez-dropdown__container--spacer"):r.classList.remove("ez-dropdown__container--spacer"))}reset(o){if(null==o)return;o.classList.add("ez-dropdown__submenu--hide"),o.style.left="",o.style.top="";const r=o.querySelector(".ez-dropdown");this.resetDropdown(r)}resetDropdown(o){null!=o&&(o.style.maxHeight="",this.setSpacerContainer(o))}setScrollContainer(o){const r=null==o?void 0:o.closest(".ez-dropdown__container");null!=r&&(r.onscroll=this.onScrollContainer.bind(this))}onScrollContainer(o){this.hideChild(null==o?void 0:o.target)}getPositionTop(o){const r=null==o?void 0:o.getBoundingClientRect();if(null!=r)return r.y+"px"}getPositionRight(o){const r=null==o?void 0:o.getBoundingClientRect();if(null!=r)return r.x+r.width+"px"}getPositionLeft(o,r){const e=null==o?void 0:o.getBoundingClientRect(),d=null==r?void 0:r.getBoundingClientRect();if(null!=e&&null!=d)return e.x-d.width+"px"}updatePosition(o,r){const e=null==o?void 0:o.getBoundingClientRect(),d=null==r?void 0:r.getBoundingClientRect();null!=e&&null!=d&&e.x<d.right&&(r.style.left=this.getPositionLeft(o,r),this.updatePosition(o,r))}}const c=class{constructor(o){r(this,o),this.ezClick=e(this,"ezClick",7),this.ezSubActionClick=e(this,"ezSubActionClick",7),this.ezOutsideClick=e(this,"ezOutsideClick",7),this.ezHover=e(this,"ezHover",7),this._itemList={},this._submenuList=[],this._openedMenuList={},this._levelLimits=3,this.items=[],this.value=void 0,this.itemBuilder=void 0}handleClickOutside(o){this._element.contains(o.target)||this.ezOutsideClick.emit()}defaultItemBuilder(r,e,d,n){return o(l,{item:r,hasIcon:d,hasChildren:n,isLockedLevels:e,onSubActionClick:this.onSubActionClick.bind(this)})}getMaxOrder(o){return null==o||0===o.length?-1:Math.max(...o.map((o=>{var r;const e=null===(r=o.group)||void 0===r?void 0:r.order;return null!=e&&e>=0?e:-1})))}hasIcon(o){return null==o?void 0:o.some((o=>""!==(o.iconName||"")))}hasGroup(o){return null==o?void 0:o.some((o=>""!==(o.group||"")))}hasChildren(o){return null==o?void 0:o.some((o=>(o.children||[]).length>0))}isLockedLevels(o){return!!this._levelLimits&&o===this._levelLimits+1}getItemsByGroup(o,r){let e={};const d=this.getMaxOrder(o);return o.forEach((o=>{const n=o.group&&null!=o.group.label?o.group.label||"noGroup":o.group||"noGroup";let i=e[n];null==i&&(i={items:[],order:o.group&&null!=o.group.order?o.group.order:o.group?d+1:d+2}),this.validateItem(o,r),i.items.push(o),e[n]=i})),t.sortByProperty(e,"order")}validateItem(o,r){if(null==this._itemList&&(this._itemList={}),null==o.type&&(o.type="item"),null==o.id){const e=`level_${r}_${o.type}`,d=Object.keys(this._itemList).filter((o=>o.includes(e))).length;o.id=`${e}_${d+1}`}null==o.label&&(o.label=""),null!=o.subAction&&(null==o.subAction.id&&(o.subAction.id=`subAction_${o.id}`),null==o.subAction.label&&(o.subAction.label="")),null==this._itemList[o.id]&&(this._itemList[o.id]={})}getContainerItemBuilder(r,e,d,n,i){if(null==this.itemBuilder)return;const t=this.itemBuilder(r,e);return null==t?this.defaultItemBuilder(r,d,n,i):"string"!=typeof t?o("div",{class:"ez-dropdown__item-builder"},t):o("div",{class:"ez-dropdown__item-builder",innerHTML:t})}getItemsRender(r,e,d,n){if(null==r)return;let t=e,l=!1;return n&&(t++,l=this.isLockedLevels(t)),r.map((r=>{var a;switch(r.type){case"loading":return o("div",{class:"ez-dropdown__item"},o("ez-skeleton",{width:"200px"}));case"divider":return o("hr",Object.assign({class:"ez-dropdown__divider"},{[i.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:i.getInternalIDInfo(`${r.id}_ezDropdownDivider`)}));default:return o("div",Object.assign({ref:o=>this._itemList[r.id]=o,class:"ez-dropdown__item","data-level":e},{[i.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:i.getInternalIDInfo(`${r.id}_ezDropdownItem`)}),o("div",{class:"ez-dropdown__item-content",onClick:o=>this.onItemClick(o,r),onMouseOver:o=>this.onShowSubmenu(o,r),onMouseEnter:()=>this.ezHover.emit(r)},this.itemBuilder?this.getContainerItemBuilder(r,e,l,d,n):this.defaultItemBuilder(r,l,d,n)),(null===(a=r.children)||void 0===a?void 0:a.length)>0&&!l&&n&&o("div",{ref:o=>this._submenuList.push(o),class:"ez-dropdown__submenu ez-dropdown__submenu--hide"},this.renderDropdown(r.children,t)))}}))}renderDropdown(r=this.items,e=1){if(null==r||this.isLockedLevels(e))return;const d=this.getItemsByGroup(r,e),n=this.hasGroup(r),t=this.hasIcon(r),l=this.hasChildren(r);return o("div",{class:"ez-dropdown ez-dropdown__max-height","data-level":e},o("div",{class:"ez-dropdown__container"},Object.keys(d).map((r=>o("div",Object.assign({class:"ez-dropdown__group"},{[i.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:i.getInternalIDInfo(`${r}_ezDropdownGroup`)}),"noGroup"!==r&&o("label",{class:"ez-dropdown__group-label",title:r},r),n&&"noGroup"===r&&o("hr",Object.assign({class:"ez-dropdown__divider"},{[i.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:i.getInternalIDInfo(`${r}_ezDropdownDivider`)})),this.getItemsRender(d[r].items,e,t,l))))))}hasOpenedSubmenu(o){const r=Object.keys(this._openedMenuList);return r.includes(o.toString())||r.some((r=>Number(r)>o))}hasSubmenuOpened(){var o;return null===(o=this._submenuList)||void 0===o?void 0:o.some((o=>!o.classList.contains("ez-dropdown__submenu--hide")))}setEvents(){document.removeEventListener("click",this.onHideAllSubmenu.bind(this)),document.addEventListener("click",this.onHideAllSubmenu.bind(this)),document.removeEventListener("scroll",this.onSubmenuReposition.bind(this)),document.addEventListener("scroll",this.onSubmenuReposition.bind(this))}onShowSubmenu(o,r){var e;if(null==o)return;const d=this._itemList[r.id];if(!(null==d?void 0:d.classList.contains("ez-dropdown__item")))return;const n=Number(d.dataset.level||"0");this.hasOpenedSubmenu(n)&&(this._submenuControl.hide(this._openedMenuList[n]),delete this._openedMenuList[n]),(null===(e=r.children)||void 0===e?void 0:e.length)&&(this._openedMenuList[d.dataset.level]=d,this._submenuControl.show(d))}onItemClick(o,r){const e=null==o?void 0:o.target;(null==e?void 0:e.classList.contains("ez-dropdown__link"))||(this.value=r,this.ezClick.emit(r))}onSubActionClick(o){this.ezSubActionClick.emit(o.subAction)}onHideAllSubmenu(o){const r=null==o?void 0:o.target;this.hasSubmenuOpened()&&(null==r||!r.closest(".ez-dropdown")&&"EZ-DROPDOWN"!==r.tagName)&&(this._openedMenuList={},this._submenuList.forEach(this._submenuControl.reset.bind(this._submenuControl)))}onSubmenuReposition(){null!=this._openedMenuList&&Object.keys(this._openedMenuList).forEach((o=>{this._submenuControl.setPosition(this._openedMenuList[o])}))}componentDidLoad(){i.addIDInfo(this._element),this._submenuControl=new p,this._submenuControl.setMaxHeight(this._element)}componentDidUpdate(){this._submenuControl.setMaxHeight(this._element)}componentDidRender(){this.setEvents()}render(){return o(d,null,this.renderDropdown())}get _element(){return n(this)}};c.style=":host{--ez-dropdown--z-index:var(--more-visible, 2);--ez-dropdown--padding:var(--space--small, 6px);--ez-dropdown--box-shadow:var(--shadow--medium, 0px 8px 24px rgba(0, 38, 111, 0.1));--ez-dropdown--border-radius:var(--border--radius-medium, 12px);--ez-dropdown--background-color:var(--background--xlight, #fff);--ez-dropdown--font-family:var(--font-pattern, 'Roboto');--ez-dropdown--max-height:415px;--ez-dropdown__item--padding:var(--space--small, 6px);--ez-dropdown__item--gap:var(--space--small, 6px);--ez-dropdown__item--border-radius:var(--border--radius-small, 6px);--ez-dropdown__item--color:var(--title--primary, #2b3a54);--ez-dropdown__item--font-weight:var(--text-weight--medium, 400);--ez-dropdown__item--font-size:var(--text--medium, 14px);--ez-dropdown__item--line-height:calc(var(--ez-dropdown__item--font-size) + 4px);--ez-dropdown__item--background-color:var(--background--medium, #f0f3f7);--ez-dropdown__item--transition:var(--transition, .2s linear);--ez-dropdown__item-label--margin-right:var(--space--medium, 12px);--ez-dropdown__icon--size:var(--icon--medium, 18px);--ez-dropdown__divider--background-color:var(--color--disable-secondary, #f2f5f8);--ez-dropdown__divider--margin:var(--space--extra-small, 3px) 0;--ez-dropdown__group-label--color:var(--text--secondary, #A2ABB9);--ez-dropdown__group-label--font-weight:var(--text-weight--large, 600);--ez-dropdown__group-label--font-size:var(--text--small, 12px);--ez-dropdown__group-label--line-height:var(--text--medium, 14px);--ez-dropdown__group-label--padding:var(--space--small, 6px);--ez-dropdown__submenu--z-index:var(--most-visible, 3);--ez-dropdown__link--font-weight:var(--text-weight--large, 600);--ez-dropdown__link--primary--color:var(--color--primary, #008561);--ez-dropdown__link--critical--color:var(--color-alert--error-800, #BD0025);--ez-dropdown__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-dropdown__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-dropdown__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-dropdown__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-dropdown__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-dropdown__scrollbar--width:var(--space--small, 6px);--ez-dropdown__scrollbar--padding-right:var(--space--extra-small, 3px);display:flex;flex-direction:column;height:fit-content;user-select:none;box-sizing:border-box;position:fixed;z-index:var(--ez-dropdown--z-index)}:host *{box-sizing:border-box}.ez-dropdown{display:flex;padding:var(--ez-dropdown--padding);box-shadow:var(--ez-dropdown--box-shadow);border-radius:var(--ez-dropdown--border-radius);background-color:var(--ez-dropdown--background-color);max-width:var(--ez-dropdown--max-width)}.ez-dropdown__max-height{max-height:var(--ez-dropdown--max-height)}.ez-dropdown *{font-family:var(--ez-dropdown--font-family)}.ez-dropdown__container{display:flex;flex-direction:column;overflow-y:auto;scrollbar-width:thin;flex:auto;scrollbar-color:var(--ez-dropdown__scrollbar--color-clicked) var(--ez-dropdown__scrollbar--color-background)}.ez-dropdown__container::-webkit-scrollbar{background-color:var(--ez-dropdown__scrollbar--color-background);width:var(--ez-dropdown__scrollbar--width);max-width:var(--ez-dropdown__scrollbar--width);min-width:var(--ez-dropdown__scrollbar--width)}.ez-dropdown__container::-webkit-scrollbar-track{background-color:var(--ez-dropdown__scrollbar--color-background);border-radius:var(--ez-dropdown__scrollbar--border-radius)}.ez-dropdown__container::-webkit-scrollbar-thumb{background-color:var(--ez-dropdown__scrollbar--color-default);border-radius:var(--ez-dropdown__scrollbar--border-radius)}.ez-dropdown__container::-webkit-scrollbar-thumb:vertical:hover,.ez-dropdown__container::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-dropdown__scrollbar--color-hover)}.ez-dropdown__container::-webkit-scrollbar-thumb:vertical:active,.ez-dropdown__container::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-dropdown__scrollbar--color-clicked)}.ez-dropdown__container--spacer{padding-right:var(--ez-dropdown__scrollbar--padding-right)}.ez-dropdown__item{display:flex;align-items:center;background-color:transparent;border-radius:var(--ez-dropdown__item--border-radius);transition:var(--ez-dropdown__item--transition)}.ez-dropdown__item:hover{background-color:var(--ez-dropdown__item--background-color)}.ez-dropdown__item-wrapper{display:flex;align-items:center;position:relative;cursor:pointer;width:100%;margin:0;white-space:nowrap;gap:var(--ez-dropdown__item--gap);color:var(--ez-dropdown__item--color);font-weight:var(--ez-dropdown__item--font-weight);font-size:var(--ez-dropdown__item--font-size);line-height:var(--ez-dropdown__item--line-height);padding:var(--ez-dropdown__item--padding)}.ez-dropdown__item-wrapper ez-icon{display:flex;justify-content:center;align-items:center;width:var(--ez-dropdown__icon--size);height:var(--ez-dropdown__icon--size);min-width:var(--ez-dropdown__icon--size);min-height:var(--ez-dropdown__icon--size)}.ez-dropdown__item-content{display:flex;align-items:center;flex:auto;overflow:hidden;gap:var(--ez-dropdown__item--gap)}.ez-dropdown__item-label{text-align:left;text-overflow:ellipsis;overflow:hidden;flex:auto}.ez-dropdown__item-label:not(:last-child){margin-right:var(--ez-dropdown__item-label--margin-right)}.ez-dropdown__item-content+.ez-dropdown__link{margin-left:var(--ez-dropdown__item-label--margin-right);margin-right:var(--ez-dropdown__item--padding)}.ez-dropdown__item-builder{flex:auto}.ez-dropdown__divider{width:100%;height:2px;border-radius:1px;border:none;display:block;background-color:var(--ez-dropdown__divider--background-color);margin:var(--ez-dropdown__divider--margin)}.ez-dropdown__hidden{visibility:hidden}.ez-dropdown__group{display:flex;flex-direction:column}.ez-dropdown__group-label{display:block;width:100%;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--ez-dropdown__group-label--color);font-weight:var(--ez-dropdown__group-label--font-weight);font-size:var(--ez-dropdown__group-label--font-size);line-height:var(--ez-dropdown__group-label--line-height);padding:var(--ez-dropdown__group-label--padding)}.ez-dropdown__icon-right{margin-left:auto}.ez-dropdown__submenu{position:fixed;z-index:var(--ez-dropdown__submenu--z-index);margin-top:calc(var(--ez-dropdown__item--padding) * -1)}.ez-dropdown__submenu--hide{display:none}.ez-dropdown__link{display:block;margin-left:auto;cursor:pointer;text-overflow:ellipsis;overflow:hidden;font-weight:var(--ez-dropdown__link--font-weight);max-width:calc(var(--ez-dropdown--max-width) * 0.43)}.ez-dropdown__link--primary{color:var(--ez-dropdown__link--primary--color)}.ez-dropdown__link--critical{color:var(--ez-dropdown__link--critical--color)}.ez-dropdown__link:hover{text-decoration:underline}";export{c as ez_dropdown}
|
|
1
|
+
import{h as o,r,c as e,H as d,g as n}from"./p-23a36bb6.js";import{ElementIDUtils as i,ObjectUtils as t}from"@sankhyalabs/core";const l=({item:r,hasIcon:e,hasChildren:d,isLockedLevels:n,onSubActionClick:i})=>o("div",{class:"ez-dropdown__item-wrapper",title:r.label},a(r,e),o("span",{class:"ez-dropdown__item-label"},r.label),s(r,d,n,i)),a=(r,e)=>{if(null!=r&&e)return o("ez-icon",r.iconName?Object.assign({class:"ez-dropdown__icon-left",iconName:r.iconName,size:"medium"},{[i.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${r.id}_ezDropdownItemIcon`}):{class:"ez-dropdown__icon-left ez-dropdown__hidden",size:"medium"})},s=(r,e,d,n)=>{var t,l;if(null!=r){if(!(null===(t=r.children)||void 0===t?void 0:t.length)&&null!=r.subAction&&Object.keys(r.subAction).length>0)return o("span",Object.assign({onClick:()=>n(r),title:r.subAction.label,class:`ez-dropdown__link ez-dropdown__link--${r.subAction.type||"primary"}`},{[i.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${r.subAction.id}_ezDropdownItemSubAction`}),r.subAction.label);if(!d&&e)return(null===(l=r.children)||void 0===l?void 0:l.length)>0?o("ez-icon",Object.assign({class:"ez-dropdown__icon-right",iconName:"chevron-right",size:"medium"},{[i.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${r.id}_ezDropdownIconOpenChildren`})):o("ez-icon",{class:"ez-dropdown__icon-right ez-dropdown__hidden",size:"medium"})}};class p{constructor(){}show(o){const r=null==o?void 0:o.querySelector(".ez-dropdown__submenu");null!=o&&null!=r&&(r.classList.remove("ez-dropdown__submenu--hide"),this.setPosition(o),this.setScrollContainer(o),this.setMaxHeight(r))}hide(o){if(null==o)return;const r=o.querySelector(".ez-dropdown__submenu:not(.ez-dropdown__submenu--hide)");this.reset(r),this.hideChild(r)}hideChild(o){null!=o&&o.querySelectorAll(".ez-dropdown__submenu").forEach((o=>{this.reset(o)}))}setPosition(o){const r=null==o?void 0:o.querySelector(".ez-dropdown__submenu"),e=null==o?void 0:o.closest(".ez-dropdown");if(null==r||null==e)return;r.style.top=this.getPositionTop(o),r.style.left=this.getPositionRight(e);const d=null==r?void 0:r.getBoundingClientRect(),n=document.body.clientWidth;(null==d?void 0:d.right)>n&&this.updatePosition(e,r)}setMaxHeight(o){var r;const e=(null==o?void 0:o.shadowRoot)||o,d=null==e?void 0:e.querySelector(".ez-dropdown"),n=document.body.clientHeight;let i,t;if(null!=(null==e?void 0:e.tagName)?(i=e,t=null==i?void 0:i.getBoundingClientRect()):t=null==d?void 0:d.getBoundingClientRect(),null!=d&&null!=t){if(t.y+t.height>n)if(null!=i){const o=i.closest(".ez-dropdown"),e=null==o?void 0:o.getBoundingClientRect(),l=parseFloat((null===(r=getComputedStyle(i))||void 0===r?void 0:r.marginTop)||"0");if(null==o||null==e)return;e.y+t.height>n?(i.style.top=e.y-l+"px",d.style.maxHeight=n-e.y+"px"):i.style.top=n-t.height-l+"px"}else{let o=n-t.y;o<0&&(o=t.height-n),d.style.maxHeight=o+"px"}this.setSpacerContainer(d)}}setSpacerContainer(o){const r=null==o?void 0:o.querySelector(".ez-dropdown__container");null!=r&&(r.scrollHeight>r.clientHeight?r.classList.add("ez-dropdown__container--spacer"):r.classList.remove("ez-dropdown__container--spacer"))}reset(o){if(null==o)return;o.classList.add("ez-dropdown__submenu--hide"),o.style.left="",o.style.top="";const r=o.querySelector(".ez-dropdown");this.resetDropdown(r)}resetDropdown(o){null!=o&&(o.style.maxHeight="",this.setSpacerContainer(o))}setScrollContainer(o){const r=null==o?void 0:o.closest(".ez-dropdown__container");null!=r&&(r.onscroll=this.onScrollContainer.bind(this))}onScrollContainer(o){this.hideChild(null==o?void 0:o.target)}getPositionTop(o){const r=null==o?void 0:o.getBoundingClientRect();if(null!=r)return r.y+"px"}getPositionRight(o){const r=null==o?void 0:o.getBoundingClientRect();if(null!=r)return r.x+r.width+"px"}getPositionLeft(o,r){const e=null==o?void 0:o.getBoundingClientRect(),d=null==r?void 0:r.getBoundingClientRect();if(null!=e&&null!=d)return e.x-d.width+"px"}updatePosition(o,r){const e=null==o?void 0:o.getBoundingClientRect(),d=null==r?void 0:r.getBoundingClientRect();null!=e&&null!=d&&e.x<d.right&&(r.style.left=this.getPositionLeft(o,r),this.updatePosition(o,r))}}const c=class{constructor(o){r(this,o),this.ezClick=e(this,"ezClick",7),this.ezSubActionClick=e(this,"ezSubActionClick",7),this.ezOutsideClick=e(this,"ezOutsideClick",7),this.ezHover=e(this,"ezHover",7),this._itemList={},this._submenuList=[],this._openedMenuList={},this._levelLimits=3,this.items=[],this.value=void 0,this.itemBuilder=void 0}handleClickOutside(o){this._element.contains(o.target)||this.ezOutsideClick.emit()}defaultItemBuilder(r,e,d,n){return o(l,{item:r,hasIcon:d,hasChildren:n,isLockedLevels:e,onSubActionClick:this.onSubActionClick.bind(this)})}getMaxOrder(o){return null==o||0===o.length?-1:Math.max(...o.map((o=>{var r;const e=null===(r=o.group)||void 0===r?void 0:r.order;return null!=e&&e>=0?e:-1})))}hasIcon(o){return null==o?void 0:o.some((o=>""!==(o.iconName||"")))}hasGroup(o){return null==o?void 0:o.some((o=>""!==(o.group||"")))}hasChildren(o){return null==o?void 0:o.some((o=>(o.children||[]).length>0))}isLockedLevels(o){return!!this._levelLimits&&o===this._levelLimits+1}getItemsByGroup(o,r){let e={};const d=this.getMaxOrder(o);return o.forEach((o=>{const n=o.group&&null!=o.group.label?o.group.label||"noGroup":o.group||"noGroup";let i=e[n];null==i&&(i={items:[],order:o.group&&null!=o.group.order?o.group.order:o.group?d+1:d+2}),this.validateItem(o,r),i.items.push(o),e[n]=i})),t.sortByProperty(e,"order")}validateItem(o,r){if(null==this._itemList&&(this._itemList={}),null==o.type&&(o.type="item"),null==o.id){const e=`level_${r}_${o.type}`,d=Object.keys(this._itemList).filter((o=>o.includes(e))).length;o.id=`${e}_${d+1}`}null==o.label&&(o.label=""),null!=o.subAction&&(null==o.subAction.id&&(o.subAction.id=`subAction_${o.id}`),null==o.subAction.label&&(o.subAction.label="")),null==this._itemList[o.id]&&(this._itemList[o.id]={})}getContainerItemBuilder(r,e,d,n,i){if(null==this.itemBuilder)return;const t=this.itemBuilder(r,e);return null==t?this.defaultItemBuilder(r,d,n,i):"string"!=typeof t?o("div",{class:"ez-dropdown__item-builder"},t):o("div",{class:"ez-dropdown__item-builder",innerHTML:t})}getItemsRender(r,e,d,n){if(null==r)return;let t=e,l=!1;return n&&(t++,l=this.isLockedLevels(t)),r.map((r=>{var a;switch(r.type){case"loading":return o("div",{class:"ez-dropdown__item"},o("ez-skeleton",{width:"200px"}));case"divider":return o("hr",Object.assign({class:"ez-dropdown__divider"},{[i.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:i.getInternalIDInfo(`${r.id}_ezDropdownDivider`)}));default:return o("div",Object.assign({ref:o=>this._itemList[r.id]=o,class:"ez-dropdown__item","data-level":e},{[i.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:i.getInternalIDInfo(`${r.id}_ezDropdownItem`)}),o("div",{class:"ez-dropdown__item-content",onClick:o=>this.onItemClick(o,r),onMouseOver:o=>this.onShowSubmenu(o,r),onMouseEnter:()=>this.ezHover.emit(r)},this.itemBuilder?this.getContainerItemBuilder(r,e,l,d,n):this.defaultItemBuilder(r,l,d,n)),(null===(a=r.children)||void 0===a?void 0:a.length)>0&&!l&&n&&o("div",{ref:o=>this._submenuList.push(o),class:"ez-dropdown__submenu ez-dropdown__submenu--hide"},this.renderDropdown(r.children,t)))}}))}renderDropdown(r=this.items,e=1){if(null==r||this.isLockedLevels(e))return;const d=this.getItemsByGroup(r,e),n=this.hasGroup(r),t=this.hasIcon(r),l=this.hasChildren(r);return o("div",{class:"ez-dropdown ez-dropdown__max-height","data-level":e},o("div",{class:"ez-dropdown__container"},Object.keys(d).map((r=>o("div",Object.assign({class:"ez-dropdown__group"},{[i.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:i.getInternalIDInfo(`${r}_ezDropdownGroup`)}),"noGroup"!==r&&o("label",{class:"ez-dropdown__group-label",title:r},r),n&&"noGroup"===r&&o("hr",Object.assign({class:"ez-dropdown__divider"},{[i.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:i.getInternalIDInfo(`${r}_ezDropdownDivider`)})),this.getItemsRender(d[r].items,e,t,l))))))}hasOpenedSubmenu(o){const r=Object.keys(this._openedMenuList);return r.includes(o.toString())||r.some((r=>Number(r)>o))}hasSubmenuOpened(){var o;return null===(o=this._submenuList)||void 0===o?void 0:o.some((o=>!o.classList.contains("ez-dropdown__submenu--hide")))}setEvents(){document.removeEventListener("click",this.onHideAllSubmenu.bind(this)),document.addEventListener("click",this.onHideAllSubmenu.bind(this)),document.removeEventListener("scroll",this.onSubmenuReposition.bind(this)),document.addEventListener("scroll",this.onSubmenuReposition.bind(this))}onShowSubmenu(o,r){var e;if(null==o)return;const d=this._itemList[r.id];if(!(null==d?void 0:d.classList.contains("ez-dropdown__item")))return;const n=Number(d.dataset.level||"0");this.hasOpenedSubmenu(n)&&(this._submenuControl.hide(this._openedMenuList[n]),delete this._openedMenuList[n]),(null===(e=r.children)||void 0===e?void 0:e.length)&&(this._openedMenuList[d.dataset.level]=d,this._submenuControl.show(d))}onItemClick(o,r){const e=null==o?void 0:o.target;(null==e?void 0:e.classList.contains("ez-dropdown__link"))||(this.value=r,this.ezClick.emit(r))}onSubActionClick(o){this.ezSubActionClick.emit(o.subAction)}onHideAllSubmenu(o){const r=null==o?void 0:o.target;this.hasSubmenuOpened()&&(null==r||!r.closest(".ez-dropdown")&&"EZ-DROPDOWN"!==r.tagName)&&(this._openedMenuList={},this._submenuList.forEach(this._submenuControl.reset.bind(this._submenuControl)))}onSubmenuReposition(){null!=this._openedMenuList&&Object.keys(this._openedMenuList).forEach((o=>{this._submenuControl.setPosition(this._openedMenuList[o])}))}componentDidLoad(){i.addIDInfo(this._element),this._submenuControl=new p,this._submenuControl.setMaxHeight(this._element)}componentDidUpdate(){this._submenuControl.setMaxHeight(this._element)}componentDidRender(){this.setEvents()}render(){return o(d,null,this.renderDropdown())}get _element(){return n(this)}};c.style=":host{--ez-dropdown--z-index:var(--more-visible, 2);--ez-dropdown--padding:var(--space--small, 6px);--ez-dropdown--box-shadow:var(--shadow--medium, 0px 8px 24px rgba(0, 38, 111, 0.1));--ez-dropdown--border-radius:var(--border--radius-medium, 12px);--ez-dropdown--background-color:var(--background--xlight, #fff);--ez-dropdown--font-family:var(--font-pattern, 'Roboto');--ez-dropdown--max-height:415px;--ez-dropdown__item--padding:var(--space--small, 6px);--ez-dropdown__item--gap:var(--space--small, 6px);--ez-dropdown__item--border-radius:var(--border--radius-small, 6px);--ez-dropdown__item--color:var(--title--primary, #2b3a54);--ez-dropdown__item--font-weight:var(--text-weight--medium, 400);--ez-dropdown__item--font-size:var(--text--medium, 14px);--ez-dropdown__item--line-height:calc(var(--ez-dropdown__item--font-size) + 4px);--ez-dropdown__item--background-color:var(--background--medium, #f0f3f7);--ez-dropdown__item--transition:var(--transition, .2s linear);--ez-dropdown__item-label--margin-right:var(--space--medium, 12px);--ez-dropdown__icon--size:var(--icon--medium, 18px);--ez-dropdown__divider--background-color:var(--color--disable-secondary, #f2f5f8);--ez-dropdown__divider--margin:var(--space--extra-small, 3px) 0;--ez-dropdown__group-label--color:var(--text--secondary, #A2ABB9);--ez-dropdown__group-label--font-weight:var(--text-weight--large, 600);--ez-dropdown__group-label--font-size:var(--text--small, 12px);--ez-dropdown__group-label--line-height:var(--text--medium, 14px);--ez-dropdown__group-label--padding:var(--space--small, 6px);--ez-dropdown__submenu--z-index:var(--most-visible, 3);--ez-dropdown__link--font-weight:var(--text-weight--large, 600);--ez-dropdown__link--primary--color:var(--color--primary, #008561);--ez-dropdown__link--critical--color:var(--color-alert--error-800, #BD0025);--ez-dropdown__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-dropdown__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-dropdown__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-dropdown__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-dropdown__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-dropdown__scrollbar--width:var(--space--small, 6px);--ez-dropdown__scrollbar--padding-right:var(--space--extra-small, 3px);display:flex;flex-direction:column;height:fit-content;user-select:none;box-sizing:border-box;position:fixed;z-index:var(--ez-dropdown--z-index)}:host *{box-sizing:border-box}.ez-dropdown{display:flex;padding:var(--ez-dropdown--padding);box-shadow:var(--ez-dropdown--box-shadow);border-radius:var(--ez-dropdown--border-radius);background-color:var(--ez-dropdown--background-color);max-width:var(--ez-dropdown--max-width)}.ez-dropdown__max-height{max-height:var(--ez-dropdown--max-height)}.ez-dropdown *{font-family:var(--ez-dropdown--font-family)}.ez-dropdown__container{display:flex;flex-direction:column;overflow-y:auto;scrollbar-width:thin;flex:auto;scrollbar-color:var(--ez-dropdown__scrollbar--color-clicked) var(--ez-dropdown__scrollbar--color-background)}.ez-dropdown__container::-webkit-scrollbar{background-color:var(--ez-dropdown__scrollbar--color-background);width:var(--ez-dropdown__scrollbar--width);max-width:var(--ez-dropdown__scrollbar--width);min-width:var(--ez-dropdown__scrollbar--width)}.ez-dropdown__container::-webkit-scrollbar-track{background-color:var(--ez-dropdown__scrollbar--color-background);border-radius:var(--ez-dropdown__scrollbar--border-radius)}.ez-dropdown__container::-webkit-scrollbar-thumb{background-color:var(--ez-dropdown__scrollbar--color-default);border-radius:var(--ez-dropdown__scrollbar--border-radius)}.ez-dropdown__container::-webkit-scrollbar-thumb:vertical:hover,.ez-dropdown__container::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-dropdown__scrollbar--color-hover)}.ez-dropdown__container::-webkit-scrollbar-thumb:vertical:active,.ez-dropdown__container::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-dropdown__scrollbar--color-clicked)}.ez-dropdown__container--spacer{padding-right:var(--ez-dropdown__scrollbar--padding-right)}.ez-dropdown__item{display:flex;align-items:center;background-color:transparent;border-radius:var(--ez-dropdown__item--border-radius);transition:var(--ez-dropdown__item--transition)}.ez-dropdown__item:hover{background-color:var(--ez-dropdown__item--background-color)}.ez-dropdown__item-wrapper{display:flex;align-items:center;position:relative;cursor:pointer;width:100%;margin:0;white-space:nowrap;gap:var(--ez-dropdown__item--gap);color:var(--ez-dropdown__item--color);font-weight:var(--ez-dropdown__item--font-weight);font-size:var(--ez-dropdown__item--font-size);line-height:var(--ez-dropdown__item--line-height);padding:var(--ez-dropdown__item--padding)}.ez-dropdown__item-wrapper ez-icon{display:flex;justify-content:center;align-items:center;width:var(--ez-dropdown__icon--size);height:var(--ez-dropdown__icon--size);min-width:var(--ez-dropdown__icon--size);min-height:var(--ez-dropdown__icon--size)}.ez-dropdown__item-content{display:flex;align-items:center;flex:auto;overflow:hidden;gap:var(--ez-dropdown__item--gap)}.ez-dropdown__item-label{text-align:left;text-overflow:ellipsis;overflow:hidden;flex:auto}.ez-dropdown__item-label:not(:last-child){margin-right:var(--ez-dropdown__item-label--margin-right)}.ez-dropdown__item-content+.ez-dropdown__link{margin-left:var(--ez-dropdown__item-label--margin-right);margin-right:var(--ez-dropdown__item--padding)}.ez-dropdown__item-builder{flex:auto}.ez-dropdown__divider{width:100%;height:2px;border-radius:1px;border:none;display:block;background-color:var(--ez-dropdown__divider--background-color);margin:var(--ez-dropdown__divider--margin)}.ez-dropdown__hidden{visibility:hidden}.ez-dropdown__group{display:flex;flex-direction:column}.ez-dropdown__group-label{display:block;width:100%;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--ez-dropdown__group-label--color);font-weight:var(--ez-dropdown__group-label--font-weight);font-size:var(--ez-dropdown__group-label--font-size);line-height:var(--ez-dropdown__group-label--line-height);padding:var(--ez-dropdown__group-label--padding)}.ez-dropdown__icon-right{margin-left:auto}.ez-dropdown__submenu{position:fixed;z-index:var(--ez-dropdown__submenu--z-index);margin-top:calc(var(--ez-dropdown__item--padding) * -1)}.ez-dropdown__submenu--hide{display:none}.ez-dropdown__link{display:block;margin-left:auto;cursor:pointer;text-overflow:ellipsis;overflow:hidden;font-weight:var(--ez-dropdown__link--font-weight);max-width:calc(var(--ez-dropdown--max-width) * 0.43)}.ez-dropdown__link--primary{color:var(--ez-dropdown__link--primary--color)}.ez-dropdown__link--critical{color:var(--ez-dropdown__link--critical--color)}.ez-dropdown__link:hover{text-decoration:underline}";export{c as ez_dropdown}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as i,h as s,H as e,g as h}from"./p-e4c7eb39.js";import{C as o}from"./p-ec7db713.js";import{ObjectUtils as r,StringUtils as n,ElementIDUtils as a}from"@sankhyalabs/core";import{A as l}from"./p-9825c1d2.js";import"./p-ab574d59.js";import"./p-b853763b.js";import{i as c}from"./p-c178730b.js";import{S as d}from"./p-5895e687.js";import"./p-47e4a8ce.js";import{r as u,a as v}from"./p-40a60148.js";const p=class{constructor(s){t(this,s),this.ezChange=i(this,"ezChange",7),this._changeDeboucingTimeout=null,this._limitCharsToSearch=3,this._deboucingTime=300,this._maxWidthValue=0,this._tabPressed=!1,this._startHighlightTag="<span class='card-item__highlight'>",this._endHighlightTag="</span>",this._preSelection=void 0,this._visibleOptions=void 0,this._startLoading=!1,this._showLoading=!0,this._showLoadingDescription=!1,this._criteria=void 0,this.value=void 0,this.label=void 0,this.enabled=!0,this.errorMessage=void 0,this.optionLoader=void 0,this.contextProperties=void 0,this.showSelectedValue=!0,this.showOptionValue=!0,this.suppressEmptyOption=!1,this.stopPropagateEnterKeyEvent=!1,this.mode="regular",this.canShowError=!0,this.hideErrorOnFocusOut=!0,this.listOptionsPosition=void 0,this.isTextSearch=!1,this.ignoreLimitCharsToSearch=!1,this.options=void 0,this.suppressSearch=!1,this.ensureClearButtonVisible=!1,this.suppressPreLoad=!0,this.autoFocus=!1,this.alternativePlaceholder=void 0,this.showMore=void 0,this.suppressInputPersist=!1,this.hideDescriptionInput=!1}observeErrorMessage(){var t;this._textInput&&(this._textInput.errorMessage=this.errorMessage,!(null===(t=this.errorMessage)||void 0===t?void 0:t.trim())&&this.errorMessage&&this.setInputValue())}getValue(t){return"object"==typeof t?null==t?void 0:t.value:t}validateNewValue(t,i){const s=this.getValue(t),e=this.getValue(i);return!("[object Object]"===s||s===e)}async observeValue(t,i){if(this._textInput&&this.validateNewValue(t,i)){if("string"==typeof t)return void await this.handleValueAsString(t);const i=this.getSelectedOption(t),s=this.getSelectedOption(this._currentValue);this.isDifferentValues(s,i)&&(this._currentValue=i,this.setInputValue(),this.ezChange.emit(null!=i?i:void 0)),this.resetOptions()}}observeOptions(t,i){!t.length&&this.suppressPreLoad||(null==t?void 0:t.join(""))!==(null==i?void 0:i.join(""))&&this.loadOptions(d.PRELOAD)}async getValueAsync(){return new Promise(this._showLoading?t=>{let i=setInterval((()=>{this._showLoading||(clearInterval(i),t(this.value))}),100)}:t=>t(this.value))}async setFocus(t){this._textInput&&this._textInput.setFocus(t)}async setBlur(){this._textInput&&this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async clearValue(){this.clearSearch()}async handleValueAsString(t){this.getSelectedOption(t)?this.setInputValue():(await this.loadDescriptionValue(t),this._currentValue&&(this.setInputValue(),this.ezChange.emit(this.value),this._currentValue=this.value))}isDifferentValues(t,i){return r.objectToString(t||{})!==r.objectToString(i||{})}getFormattedText(t){if(null==t)return;let i=this.showSelectedValue&&null!=t.value?t.label?`${t.value} - ${t.label}`:t.value:t.label;return i=null==i?void 0:i.replace(new RegExp(this._startHighlightTag,"g"),"").replace(new RegExp(this._endHighlightTag,"g"),""),i}getText(){const t=this.getSelectedOption(this._currentValue),i=this.getFormattedText(t);return u(i)}getSelectedOption(t){return"string"==typeof t||t instanceof String?this._visibleOptions.find((i=>i.value===t)):t?Object.assign(Object.assign({},t),{value:v(null==t?void 0:t.value),label:v(null==t?void 0:t.label)}):t}updateVisibleOptions(){let t=this._source||[];this._visibleOptions=this.suppressEmptyOption?t:[{value:void 0,label:""}].concat(t),this._maxWidthValue=this.getMaxWidthValue()}getMaxWidthValue(){var t;const i=[];return null===(t=this._visibleOptions)||void 0===t||t.forEach((t=>{const s=this.getWidthValue(t.value);i.includes(s)||i.push(s)})),i.length>1?Math.max(...i):0}getWidthValue(t){if(null!=this._itemValueBasis){const i=this._itemValueBasis;if(null!=t)return i.innerHTML=t,i.clientWidth>0?i.clientWidth+2:0;i.innerHTML=""}return 0}showOptions(){this.enabled&&(this.isOptionsVisible()||this._ezPopOverPlusElement.showUnder(this._textInput))}hideOptions(){this._ezPopOverPlusElement.hide()}isOptionsVisible(){return this._ezPopOverPlusElement.opened}selectCurrentOption(t=!0){void 0!==this._preSelection?(this.selectOption(this._visibleOptions[this._preSelection],t),this._preSelection=void 0):this.controlListWithOnlyOne()}updateSource(t){this._startLoading=!1,t instanceof Promise?(this._showLoading=!0,this._showLoadingDescription=!0,t.then((t=>{this.updateSource(t)})).finally((()=>{this._showLoading=!1,this._showLoadingDescription=!1})),this.updateVisibleOptions()):(this._showLoading=!1,Array.isArray(t)?(this._source=t,this.updateVisibleOptions(),this._tabPressed&&(this._tabPressed=!1,this.controlEmptySearch(!1))):this.selectOption(t))}clearSource(){this._source=[],this.updateVisibleOptions()}selectOption(t,i=!0){var s,e;const h=this.getSelectedOption(this.value),o=Object.assign(Object.assign({},t),{value:v(null==t?void 0:t.value),label:v(null==t?void 0:t.label)}),r=Object.assign(Object.assign({},o),{value:u(null==o?void 0:o.value),label:u(null==o?void 0:o.label)});if((null===(s=null==h?void 0:h.value)||void 0===s?void 0:s.toString())!==(null===(e=null==r?void 0:r.value)||void 0===e?void 0:e.toString())||null==h&&null!=r&&"value"in r){const t=(null==r?void 0:r.value)?r:void 0;this.value=t,this._currentValue=t}else this.setInputValue(),this.resetOptions();this._visibleOptions=[],this.clearSource(),i&&setTimeout((()=>{this.setFocus()}),0)}loadOptions(t,i=""){this._criteria=i,this._startLoading=!0,this.updateSource(this.optionLoader?this.optionLoader({mode:t,argument:i},this.contextProperties):this.options)}cancelPreselection(){!this._textInput.value&&this._currentValue&&this._source.length>0?this.selectOption(void 0):window.setTimeout((()=>{this.setInputValue()}),this._deboucingTime),this.resetOptions()}setInputValue(t=!0){if(this.suppressInputPersist)return void this.clearSearch();const i=this.getText();(this._textInput.value||"")!==i&&(this._textInput.value=i,t&&(this.errorMessage=null))}clearSearch(){this.value=null,this._currentValue=null,this._textInput.value=""}controlListWithOnlyOne(t=!0){var i,s;const e=null===(i=this._visibleOptions)||void 0===i?void 0:i.filter((t=>""!==t.label&&null!=t.value));if((null==e?void 0:e.length)>0){const i=new RegExp(this._startHighlightTag,"g"),h=new RegExp(this._endHighlightTag,"g");let o=n.decodeHtmlEntities(e[0].label);const r={value:null===(s=e[0].value)||void 0===s?void 0:s.replace(i,"").replace(h,""),label:null==o?void 0:o.replace(i,"").replace(h,"")};this.selectOption(r,t)}}controlEmptySearch(t=!0){var i;(null===(i=this._visibleOptions)||void 0===i?void 0:i.length)?this.controlListWithOnlyOne(t):(this.clearSearch(),l.info(this.i18n("ez-search.emptyList")))}async loadDescriptionValue(t){var i,s,e;if(null==t)return;if((null===(i=this.options)||void 0===i?void 0:i.length)>0)return void this.loadOptionValue(t);const h={mode:this.hideDescriptionInput?d.LOAD_DESCRIPTION:d.PREDICTIVE,argument:t};try{const t=await(null===(s=this.optionLoader)||void 0===s?void 0:s.call(this,h,this.contextProperties));if(null==t)return;t instanceof Promise?t.then((t=>{this.setDescriptionValue(t)})):this.setDescriptionValue(t)}catch(t){throw"WarningException"===(null===(e=null==t?void 0:t.constructor)||void 0===e?void 0:e.name)&&(this.errorMessage=t.message),t}}setDescriptionValue(t){const i=(null==t?void 0:t[0])||t;null!=i&&Object.keys(i).length?(this._currentValue=i?Object.assign(Object.assign({},i),{value:v(i.value),label:v(i.label)}):i,this.value=this._currentValue,this.setTextInputValue()):this.showNoResultMessage()}setTextInputValue(){if(this._textInput&&null==this._textInput.value){if(null==this.value)return;const t="string"==typeof this.value?this.value:this.getFormattedText(this.value);this._textInput.value=u(t)}}loadOptionValue(t){var i;const s=null===(i=this.options)||void 0===i?void 0:i.find((i=>i.value===t));null!=s?this.selectOption(s):this.showNoResultMessage()}async showNoResultMessage(){this.clearSearch(),l.info(this.i18n("ez-search.emptySearch",{field:this.getFieldLabel()}))}getFieldLabel(){var t;return null===(t=this.label)||void 0===t?void 0:t.replace(this.i18n("app.requiredInfo"),"").toUpperCase()}resetOptions(){this.showMore?this.handleResetOptionsWithShowMoreVisible():(this.hideOptions(),this._criteria=void 0,this._preSelection=void 0,this.updateVisibleOptions())}handleResetOptionsWithShowMoreVisible(){setTimeout((()=>{this.hideOptions(),this._criteria=void 0,this._preSelection=void 0,this.updateVisibleOptions()}),100)}async handleInitialValue(){if(!this.getValue(this.value))return;if("string"==typeof this.value)return void await this.handleValueAsString(this.value);let t=this.getFormattedText(this.value);t=u(t),this._textInput.value=t}async componentWillLoad(){if(this.i18n=await c(),void 0===this.options){this.options=[];const t=this.el.querySelectorAll("option");t&&t.forEach((t=>{let i=t.innerText,s=t.getAttribute("value"),e=t.getAttribute("details");s||(s=i),this.options.push({label:i,value:s,details:e}),t.hidden=!0}))}this.updateSource([])}componentDidRender(){var t;null===(t=this._optionsList)||void 0===t||t.querySelectorAll(".item").forEach((t=>{a.addIDInfoIfNotExists(t,"itemSearch")}))}async componentDidLoad(){this._currentValue=this.value,o.applyVarsTextInput(this.el,this._textInput),this._resizeObserver=new ResizeObserver((t=>{window.requestAnimationFrame((()=>{Array.isArray(t)}))})),this._intersectionObserver=new IntersectionObserver((t=>{t.forEach((t=>{!t.isIntersecting&&this._ezPopOverPlusElement&&this._ezPopOverPlusElement.hide()}))}),{threshold:.1}),this._textInput&&this._intersectionObserver.observe(this._textInput),await this.handleInitialValue(),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}disconnectedCallback(){var t,i;null===(t=this._resizeObserver)||void 0===t||t.disconnect(),null===(i=this._intersectionObserver)||void 0===i||i.disconnect()}handlerIconClick(){this.loadOptions(d.ADVANCED)}buildNumberArgument(t){return this.isTextSearch?NaN:Number(t||void 0)}onTextInputChangeHandler(t){var i;if(this.clearDeboucingTimeout(),this._startLoading)return void(this._changeDeboucingTimeout=window.setTimeout((()=>{this.onTextInputChangeHandler(t)}),this._deboucingTime));const s=null===(i=t.target.value)||void 0===i?void 0:i.trim(),e=this.buildNumberArgument(s);this._criteria||(this._textInput.value=t.data||s),this._criteria=s,s?(this._showLoading=!1,this.clearSource(),this.ignoreLimitCharsToSearch||!isNaN(e)||s.length>=this._limitCharsToSearch?(this._showLoading=!0,this._changeDeboucingTimeout=window.setTimeout((()=>{this.loadOptions(d.PREDICTIVE,isNaN(e)?s:e.toString())}),this._deboucingTime),this.showOptions()):this.hideOptions()):(this.hideOptions(),this._showLoading=!1,this.clearSource())}clearDeboucingTimeout(){this._changeDeboucingTimeout&&(window.clearTimeout(this._changeDeboucingTimeout),this._changeDeboucingTimeout=null)}async keyDownHandler(t){switch(this._tabPressed=!1,t.ctrlKey&&("f"!==t.key&&"F"!==t.key||(this.loadOptions(d.ADVANCED),t.stopPropagation(),t.stopImmediatePropagation(),t.preventDefault())),t.key){case"ArrowDown":t.stopPropagation(),this.canShowListOptions()&&t.preventDefault(),this.isOptionsVisible()||this.showOptions(),await this._searchList.nextOption();break;case"ArrowUp":t.stopPropagation(),this.canShowListOptions()&&t.preventDefault(),await this._searchList.previousOption();break;case"Enter":this.handleEventPropagation(t),this.selectCurrentOption();break;case"Escape":this.cancelPreselection();break;case"Tab":this._tabPressed=!0,this.selectCurrentOption(!1)}}handleEventPropagation(t){this._ezPopOverPlusElement.opened&&this.stopPropagateEnterKeyEvent&&t.stopPropagation()}onTextInputFocusOutHandler(){this.hideErrorOnFocusOut&&this.cancelPreselection()}canShowListOptions(){return!this._showLoading&&this._visibleOptions.length>0}canShowLoadSpinDescription(){return this._showLoadingDescription&&!this._ezPopOverPlusElement.opened}onChangePreSelection(t){this._preSelection=t}async handleClickShowMore(){var t,i;if(!this.optionLoader)return;const s=null!==(i=null===(t=this._textInput)||void 0===t?void 0:t.value)&&void 0!==i?i:"",e={mode:d.ADVANCED,argument:s},h=await this.optionLoader(e,this.contextProperties);h&&!Array.isArray(h)&&this.selectOption(h)}renderShowMore(){if(this.showMore&&!this._showLoading)return s("div",{style:{display:"flex",justifyContent:"center"},"data-element-id":a.getInternalIDInfo("showMore")},s("ez-button",{onClick:async()=>await this.handleClickShowMore(),variant:"tertiary",style:{width:"100%",justifyContent:"center"},label:this.i18n("ez-search.showMore")}))}render(){var t;return a.addIDInfoIfNotExists(this.el,"input"),s(e,null,s("ez-text-input",{"data-element-id":a.getInternalIDInfo("textInput"),class:this.suppressSearch?"suppressed-search-input":"",ref:t=>this._textInput=t,"data-slave-mode":"true",enabled:this.enabled&&!this.suppressSearch,onInput:t=>this.onTextInputChangeHandler(t),onFocusout:()=>this.onTextInputFocusOutHandler(),onKeyDown:t=>this.keyDownHandler(t),label:this.label,canShowError:this.canShowError,errorMessage:this.errorMessage,mode:this.mode,alternativePlaceholder:this.alternativePlaceholder},s("button",{class:"btn",slot:"leftIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.handlerIconClick()},this.canShowLoadSpinDescription()?s("div",{class:"message__loading"}):s("ez-icon",{iconName:"search"})),(null===(t=this._textInput)||void 0===t?void 0:t.value)&&(this._criteria||this.value)||this.ensureClearButtonVisible?s("button",{class:"btn btn__close",slot:"rightIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.clearSearch()},s("ez-icon",{iconName:"close"})):void 0),s("ez-popover-plus",{ref:t=>this._ezPopOverPlusElement=t,autoClose:!1,overlayType:"none",useAnchorSize:!0,anchorElement:[this._textInput,this.el],"data-element-id":this.el.getAttribute("data-element-id"),onEzVisibilityChange:t=>t.stopPropagation()},s("div",null,s("search-list",{ref:t=>this._searchList=t,showLoading:this._showLoading,visibleOptions:this._visibleOptions,textEmptyList:this.i18n("ez-search.emptyList"),canShowListOptions:this.canShowListOptions(),value:this.value,showOptionValue:this.showOptionValue,preSelection:this._preSelection,onChangeValue:({detail:t})=>this.selectOption(t),onChangePreSelection:({detail:t})=>this.onChangePreSelection(t)}),this.renderShowMore())))}get el(){return h(this)}static get watchers(){return{errorMessage:["observeErrorMessage"],value:["observeValue"],options:["observeOptions"]}}};p.style=":host{--ez-search--height:42px;--ez-search--width:100%;--ez-search__icon--width:48px;--ez-search--border-radius:var(--border--radius-medium, 12px);--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-color--xlight:var(--background--xlight, #fff);--ez-search--background-medium:var(--background--medium, #f0f3f7);--ez-search--line-height:calc(var(--text--medium, 14px) + 4px);--ez-search__input--background-color:var(--background--medium, #e0e0e0);--ez-search__input--border:var(--border--medium, 2px solid);--ez-search__input--border-color:var(--ez-search__input--background-color);--ez-search__input--focus--border-color:var(--color--primary, #008561);--ez-search__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-search__input--disabled--color:var(--text--disable, #AFB6C0);--ez-search__input--error--border-color:#CC2936;--ez-search__btn--color:var(--title--primary, #2B3A54);--ez-search__btn-disabled--color:var(--text--disable, #AFB6C0);--ez-search__btn-hover--color:var(--color--primary, #4e4e4e);--ez-search__label--color:var(--title--primary, #2B3A54);--ez-search--space--medium:var(--space--medium, 12px);--ez-search--space--small:var(--space--small, 6px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-search--width)}ez-icon{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.suppressed-search-input{--ez-text-input__input--border-color:var(--color--strokes, #dce0e8);--ez-text-input__input--disabled--background-color:var(--background--xlight, #fff);--ez-text-input__input--disabled--color:var(--title--primary, #2B3A54)}.btn{outline:none;border:none;background:none;cursor:pointer;color:var(--ez-search__btn--color)}.btn:disabled{cursor:not-allowed;color:var(--ez-search__btn-disabled--color)}.btn:disabled:hover{cursor:not-allowed;color:var(--ez-search__btn-disabled--color)}.btn:hover{color:var(--ez-search__btn-hover--color)}.btn__close{visibility:hidden}ez-text-input:hover .btn__close,ez-text-input:focus .btn__close{visibility:visible}";export{p as ez_search}
|
|
1
|
+
import{r as t,c as i,h as s,H as e,g as h}from"./p-23a36bb6.js";import{C as o}from"./p-ec7db713.js";import{ObjectUtils as r,StringUtils as n,ElementIDUtils as a}from"@sankhyalabs/core";import{A as l}from"./p-9825c1d2.js";import"./p-ab574d59.js";import"./p-b853763b.js";import{i as c}from"./p-c178730b.js";import{S as d}from"./p-5895e687.js";import"./p-47e4a8ce.js";import{r as u,a as v}from"./p-40a60148.js";const p=class{constructor(s){t(this,s),this.ezChange=i(this,"ezChange",7),this._changeDeboucingTimeout=null,this._limitCharsToSearch=3,this._deboucingTime=300,this._maxWidthValue=0,this._tabPressed=!1,this._startHighlightTag="<span class='card-item__highlight'>",this._endHighlightTag="</span>",this._preSelection=void 0,this._visibleOptions=void 0,this._startLoading=!1,this._showLoading=!0,this._showLoadingDescription=!1,this._criteria=void 0,this.value=void 0,this.label=void 0,this.enabled=!0,this.errorMessage=void 0,this.optionLoader=void 0,this.contextProperties=void 0,this.showSelectedValue=!0,this.showOptionValue=!0,this.suppressEmptyOption=!1,this.stopPropagateEnterKeyEvent=!1,this.mode="regular",this.canShowError=!0,this.hideErrorOnFocusOut=!0,this.listOptionsPosition=void 0,this.isTextSearch=!1,this.ignoreLimitCharsToSearch=!1,this.options=void 0,this.suppressSearch=!1,this.ensureClearButtonVisible=!1,this.suppressPreLoad=!0,this.autoFocus=!1,this.alternativePlaceholder=void 0,this.showMore=void 0,this.suppressInputPersist=!1,this.hideDescriptionInput=!1}observeErrorMessage(){var t;this._textInput&&(this._textInput.errorMessage=this.errorMessage,!(null===(t=this.errorMessage)||void 0===t?void 0:t.trim())&&this.errorMessage&&this.setInputValue())}getValue(t){return"object"==typeof t?null==t?void 0:t.value:t}validateNewValue(t,i){const s=this.getValue(t),e=this.getValue(i);return!("[object Object]"===s||s===e)}async observeValue(t,i){if(this._textInput&&this.validateNewValue(t,i)){if("string"==typeof t)return void await this.handleValueAsString(t);const i=this.getSelectedOption(t),s=this.getSelectedOption(this._currentValue);this.isDifferentValues(s,i)&&(this._currentValue=i,this.setInputValue(),this.ezChange.emit(null!=i?i:void 0)),this.resetOptions()}}observeOptions(t,i){!t.length&&this.suppressPreLoad||(null==t?void 0:t.join(""))!==(null==i?void 0:i.join(""))&&this.loadOptions(d.PRELOAD)}async getValueAsync(){return new Promise(this._showLoading?t=>{let i=setInterval((()=>{this._showLoading||(clearInterval(i),t(this.value))}),100)}:t=>t(this.value))}async setFocus(t){this._textInput&&this._textInput.setFocus(t)}async setBlur(){this._textInput&&this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async clearValue(){this.clearSearch()}async handleValueAsString(t){this.getSelectedOption(t)?this.setInputValue():(await this.loadDescriptionValue(t),this._currentValue&&(this.setInputValue(),this.ezChange.emit(this.value),this._currentValue=this.value))}isDifferentValues(t,i){return r.objectToString(t||{})!==r.objectToString(i||{})}getFormattedText(t){if(null==t)return;let i=this.showSelectedValue&&null!=t.value?t.label?`${t.value} - ${t.label}`:t.value:t.label;return i=null==i?void 0:i.replace(new RegExp(this._startHighlightTag,"g"),"").replace(new RegExp(this._endHighlightTag,"g"),""),i}getText(){const t=this.getSelectedOption(this._currentValue),i=this.getFormattedText(t);return u(i)}getSelectedOption(t){return"string"==typeof t||t instanceof String?this._visibleOptions.find((i=>i.value===t)):t?Object.assign(Object.assign({},t),{value:v(null==t?void 0:t.value),label:v(null==t?void 0:t.label)}):t}updateVisibleOptions(){let t=this._source||[];this._visibleOptions=this.suppressEmptyOption?t:[{value:void 0,label:""}].concat(t),this._maxWidthValue=this.getMaxWidthValue()}getMaxWidthValue(){var t;const i=[];return null===(t=this._visibleOptions)||void 0===t||t.forEach((t=>{const s=this.getWidthValue(t.value);i.includes(s)||i.push(s)})),i.length>1?Math.max(...i):0}getWidthValue(t){if(null!=this._itemValueBasis){const i=this._itemValueBasis;if(null!=t)return i.innerHTML=t,i.clientWidth>0?i.clientWidth+2:0;i.innerHTML=""}return 0}showOptions(){this.enabled&&(this.isOptionsVisible()||this._ezPopOverPlusElement.showUnder(this._textInput))}hideOptions(){this._ezPopOverPlusElement.hide()}isOptionsVisible(){return this._ezPopOverPlusElement.opened}selectCurrentOption(t=!0){void 0!==this._preSelection?(this.selectOption(this._visibleOptions[this._preSelection],t),this._preSelection=void 0):this.controlListWithOnlyOne()}updateSource(t){this._startLoading=!1,t instanceof Promise?(this._showLoading=!0,this._showLoadingDescription=!0,t.then((t=>{this.updateSource(t)})).finally((()=>{this._showLoading=!1,this._showLoadingDescription=!1})),this.updateVisibleOptions()):(this._showLoading=!1,Array.isArray(t)?(this._source=t,this.updateVisibleOptions(),this._tabPressed&&(this._tabPressed=!1,this.controlEmptySearch(!1))):this.selectOption(t))}clearSource(){this._source=[],this.updateVisibleOptions()}selectOption(t,i=!0){var s,e;const h=this.getSelectedOption(this.value),o=Object.assign(Object.assign({},t),{value:v(null==t?void 0:t.value),label:v(null==t?void 0:t.label)}),r=Object.assign(Object.assign({},o),{value:u(null==o?void 0:o.value),label:u(null==o?void 0:o.label)});if((null===(s=null==h?void 0:h.value)||void 0===s?void 0:s.toString())!==(null===(e=null==r?void 0:r.value)||void 0===e?void 0:e.toString())||null==h&&null!=r&&"value"in r){const t=(null==r?void 0:r.value)?r:void 0;this.value=t,this._currentValue=t}else this.setInputValue(),this.resetOptions();this._visibleOptions=[],this.clearSource(),i&&setTimeout((()=>{this.setFocus()}),0)}loadOptions(t,i=""){this._criteria=i,this._startLoading=!0,this.updateSource(this.optionLoader?this.optionLoader({mode:t,argument:i},this.contextProperties):this.options)}cancelPreselection(){!this._textInput.value&&this._currentValue&&this._source.length>0?this.selectOption(void 0):window.setTimeout((()=>{this.setInputValue()}),this._deboucingTime),this.resetOptions()}setInputValue(t=!0){if(this.suppressInputPersist)return void this.clearSearch();const i=this.getText();(this._textInput.value||"")!==i&&(this._textInput.value=i,t&&(this.errorMessage=null))}clearSearch(){this.value=null,this._currentValue=null,this._textInput.value=""}controlListWithOnlyOne(t=!0){var i,s;const e=null===(i=this._visibleOptions)||void 0===i?void 0:i.filter((t=>""!==t.label&&null!=t.value));if((null==e?void 0:e.length)>0){const i=new RegExp(this._startHighlightTag,"g"),h=new RegExp(this._endHighlightTag,"g");let o=n.decodeHtmlEntities(e[0].label);const r={value:null===(s=e[0].value)||void 0===s?void 0:s.replace(i,"").replace(h,""),label:null==o?void 0:o.replace(i,"").replace(h,"")};this.selectOption(r,t)}}controlEmptySearch(t=!0){var i;(null===(i=this._visibleOptions)||void 0===i?void 0:i.length)?this.controlListWithOnlyOne(t):(this.clearSearch(),l.info(this.i18n("ez-search.emptyList")))}async loadDescriptionValue(t){var i,s,e;if(null==t)return;if((null===(i=this.options)||void 0===i?void 0:i.length)>0)return void this.loadOptionValue(t);const h={mode:this.hideDescriptionInput?d.LOAD_DESCRIPTION:d.PREDICTIVE,argument:t};try{const t=await(null===(s=this.optionLoader)||void 0===s?void 0:s.call(this,h,this.contextProperties));if(null==t)return;t instanceof Promise?t.then((t=>{this.setDescriptionValue(t)})):this.setDescriptionValue(t)}catch(t){throw"WarningException"===(null===(e=null==t?void 0:t.constructor)||void 0===e?void 0:e.name)&&(this.errorMessage=t.message),t}}setDescriptionValue(t){const i=(null==t?void 0:t[0])||t;null!=i&&Object.keys(i).length?(this._currentValue=i?Object.assign(Object.assign({},i),{value:v(i.value),label:v(i.label)}):i,this.value=this._currentValue,this.setTextInputValue()):this.showNoResultMessage()}setTextInputValue(){if(this._textInput&&null==this._textInput.value){if(null==this.value)return;const t="string"==typeof this.value?this.value:this.getFormattedText(this.value);this._textInput.value=u(t)}}loadOptionValue(t){var i;const s=null===(i=this.options)||void 0===i?void 0:i.find((i=>i.value===t));null!=s?this.selectOption(s):this.showNoResultMessage()}async showNoResultMessage(){this.clearSearch(),l.info(this.i18n("ez-search.emptySearch",{field:this.getFieldLabel()}))}getFieldLabel(){var t;return null===(t=this.label)||void 0===t?void 0:t.replace(this.i18n("app.requiredInfo"),"").toUpperCase()}resetOptions(){this.showMore?this.handleResetOptionsWithShowMoreVisible():(this.hideOptions(),this._criteria=void 0,this._preSelection=void 0,this.updateVisibleOptions())}handleResetOptionsWithShowMoreVisible(){setTimeout((()=>{this.hideOptions(),this._criteria=void 0,this._preSelection=void 0,this.updateVisibleOptions()}),100)}async handleInitialValue(){if(!this.getValue(this.value))return;if("string"==typeof this.value)return void await this.handleValueAsString(this.value);let t=this.getFormattedText(this.value);t=u(t),this._textInput.value=t}async componentWillLoad(){if(this.i18n=await c(),void 0===this.options){this.options=[];const t=this.el.querySelectorAll("option");t&&t.forEach((t=>{let i=t.innerText,s=t.getAttribute("value"),e=t.getAttribute("details");s||(s=i),this.options.push({label:i,value:s,details:e}),t.hidden=!0}))}this.updateSource([])}componentDidRender(){var t;null===(t=this._optionsList)||void 0===t||t.querySelectorAll(".item").forEach((t=>{a.addIDInfoIfNotExists(t,"itemSearch")}))}async componentDidLoad(){this._currentValue=this.value,o.applyVarsTextInput(this.el,this._textInput),this._resizeObserver=new ResizeObserver((t=>{window.requestAnimationFrame((()=>{Array.isArray(t)}))})),this._intersectionObserver=new IntersectionObserver((t=>{t.forEach((t=>{!t.isIntersecting&&this._ezPopOverPlusElement&&this._ezPopOverPlusElement.hide()}))}),{threshold:.1}),this._textInput&&this._intersectionObserver.observe(this._textInput),await this.handleInitialValue(),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}disconnectedCallback(){var t,i;null===(t=this._resizeObserver)||void 0===t||t.disconnect(),null===(i=this._intersectionObserver)||void 0===i||i.disconnect()}handlerIconClick(){this.loadOptions(d.ADVANCED)}buildNumberArgument(t){return this.isTextSearch?NaN:Number(t||void 0)}onTextInputChangeHandler(t){var i;if(this.clearDeboucingTimeout(),this._startLoading)return void(this._changeDeboucingTimeout=window.setTimeout((()=>{this.onTextInputChangeHandler(t)}),this._deboucingTime));const s=null===(i=t.target.value)||void 0===i?void 0:i.trim(),e=this.buildNumberArgument(s);this._criteria||(this._textInput.value=t.data||s),this._criteria=s,s?(this._showLoading=!1,this.clearSource(),this.ignoreLimitCharsToSearch||!isNaN(e)||s.length>=this._limitCharsToSearch?(this._showLoading=!0,this._changeDeboucingTimeout=window.setTimeout((()=>{this.loadOptions(d.PREDICTIVE,isNaN(e)?s:e.toString())}),this._deboucingTime),this.showOptions()):this.hideOptions()):(this.hideOptions(),this._showLoading=!1,this.clearSource())}clearDeboucingTimeout(){this._changeDeboucingTimeout&&(window.clearTimeout(this._changeDeboucingTimeout),this._changeDeboucingTimeout=null)}async keyDownHandler(t){switch(this._tabPressed=!1,t.ctrlKey&&("f"!==t.key&&"F"!==t.key||(this.loadOptions(d.ADVANCED),t.stopPropagation(),t.stopImmediatePropagation(),t.preventDefault())),t.key){case"ArrowDown":t.stopPropagation(),this.canShowListOptions()&&t.preventDefault(),this.isOptionsVisible()||this.showOptions(),await this._searchList.nextOption();break;case"ArrowUp":t.stopPropagation(),this.canShowListOptions()&&t.preventDefault(),await this._searchList.previousOption();break;case"Enter":this.handleEventPropagation(t),this.selectCurrentOption();break;case"Escape":this.cancelPreselection();break;case"Tab":this._tabPressed=!0,this.selectCurrentOption(!1)}}handleEventPropagation(t){this._ezPopOverPlusElement.opened&&this.stopPropagateEnterKeyEvent&&t.stopPropagation()}onTextInputFocusOutHandler(){this.hideErrorOnFocusOut&&this.cancelPreselection()}canShowListOptions(){return!this._showLoading&&this._visibleOptions.length>0}canShowLoadSpinDescription(){return this._showLoadingDescription&&!this._ezPopOverPlusElement.opened}onChangePreSelection(t){this._preSelection=t}async handleClickShowMore(){var t,i;if(!this.optionLoader)return;const s=null!==(i=null===(t=this._textInput)||void 0===t?void 0:t.value)&&void 0!==i?i:"",e={mode:d.ADVANCED,argument:s},h=await this.optionLoader(e,this.contextProperties);h&&!Array.isArray(h)&&this.selectOption(h)}renderShowMore(){if(this.showMore&&!this._showLoading)return s("div",{style:{display:"flex",justifyContent:"center"},"data-element-id":a.getInternalIDInfo("showMore")},s("ez-button",{onClick:async()=>await this.handleClickShowMore(),variant:"tertiary",style:{width:"100%",justifyContent:"center"},label:this.i18n("ez-search.showMore")}))}render(){var t;return a.addIDInfoIfNotExists(this.el,"input"),s(e,null,s("ez-text-input",{"data-element-id":a.getInternalIDInfo("textInput"),class:this.suppressSearch?"suppressed-search-input":"",ref:t=>this._textInput=t,"data-slave-mode":"true",enabled:this.enabled&&!this.suppressSearch,onInput:t=>this.onTextInputChangeHandler(t),onFocusout:()=>this.onTextInputFocusOutHandler(),onKeyDown:t=>this.keyDownHandler(t),label:this.label,canShowError:this.canShowError,errorMessage:this.errorMessage,mode:this.mode,alternativePlaceholder:this.alternativePlaceholder},s("button",{class:"btn",slot:"leftIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.handlerIconClick()},this.canShowLoadSpinDescription()?s("div",{class:"message__loading"}):s("ez-icon",{iconName:"search"})),(null===(t=this._textInput)||void 0===t?void 0:t.value)&&(this._criteria||this.value)||this.ensureClearButtonVisible?s("button",{class:"btn btn__close",slot:"rightIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.clearSearch()},s("ez-icon",{iconName:"close"})):void 0),s("ez-popover-plus",{ref:t=>this._ezPopOverPlusElement=t,autoClose:!1,overlayType:"none",useAnchorSize:!0,anchorElement:[this._textInput,this.el],"data-element-id":this.el.getAttribute("data-element-id"),onEzVisibilityChange:t=>t.stopPropagation()},s("div",null,s("search-list",{ref:t=>this._searchList=t,showLoading:this._showLoading,visibleOptions:this._visibleOptions,textEmptyList:this.i18n("ez-search.emptyList"),canShowListOptions:this.canShowListOptions(),value:this.value,showOptionValue:this.showOptionValue,preSelection:this._preSelection,onChangeValue:({detail:t})=>this.selectOption(t),onChangePreSelection:({detail:t})=>this.onChangePreSelection(t)}),this.renderShowMore())))}get el(){return h(this)}static get watchers(){return{errorMessage:["observeErrorMessage"],value:["observeValue"],options:["observeOptions"]}}};p.style=":host{--ez-search--height:42px;--ez-search--width:100%;--ez-search__icon--width:48px;--ez-search--border-radius:var(--border--radius-medium, 12px);--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-color--xlight:var(--background--xlight, #fff);--ez-search--background-medium:var(--background--medium, #f0f3f7);--ez-search--line-height:calc(var(--text--medium, 14px) + 4px);--ez-search__input--background-color:var(--background--medium, #e0e0e0);--ez-search__input--border:var(--border--medium, 2px solid);--ez-search__input--border-color:var(--ez-search__input--background-color);--ez-search__input--focus--border-color:var(--color--primary, #008561);--ez-search__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-search__input--disabled--color:var(--text--disable, #AFB6C0);--ez-search__input--error--border-color:#CC2936;--ez-search__btn--color:var(--title--primary, #2B3A54);--ez-search__btn-disabled--color:var(--text--disable, #AFB6C0);--ez-search__btn-hover--color:var(--color--primary, #4e4e4e);--ez-search__label--color:var(--title--primary, #2B3A54);--ez-search--space--medium:var(--space--medium, 12px);--ez-search--space--small:var(--space--small, 6px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-search--width)}ez-icon{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.suppressed-search-input{--ez-text-input__input--border-color:var(--color--strokes, #dce0e8);--ez-text-input__input--disabled--background-color:var(--background--xlight, #fff);--ez-text-input__input--disabled--color:var(--title--primary, #2B3A54)}.btn{outline:none;border:none;background:none;cursor:pointer;color:var(--ez-search__btn--color)}.btn:disabled{cursor:not-allowed;color:var(--ez-search__btn-disabled--color)}.btn:disabled:hover{cursor:not-allowed;color:var(--ez-search__btn-disabled--color)}.btn:hover{color:var(--ez-search__btn-hover--color)}.btn__close{visibility:hidden}ez-text-input:hover .btn__close,ez-text-input:focus .btn__close{visibility:visible}";export{p as ez_search}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,c as i,h as a,H as t,g as r}from"./p-
|
|
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-c178730b.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,c as i,h as t,g as r}from"./p-
|
|
1
|
+
import{r as e,c as i,h as t,g as r}from"./p-23a36bb6.js";import{StringUtils as o,ElementIDUtils as l}from"@sankhyalabs/core";import{i as s}from"./p-c178730b.js";const a=class{constructor(t){e(this,t),this.ezClick=i(this,"ezClick",7),this.ezRemove=i(this,"ezRemove",7),this.canRemove=!0,this.fileName=void 0,this.iconName=void 0,this.fileSize=void 0,this.progress=100}observeProgress(e){if(e<0||e>100)throw new Error(this.i18n("ez-file-item.invalidProgress"));this._element.style.setProperty("--ez-file-item--upload-progress",100-e+"%")}getFileSize(){return this.fileSize&&0!==this.fileSize?`(${o.formatBytes(this.fileSize)})`:""}getIconName(){let e;if(this.iconName)return this.iconName;if(this.fileName.indexOf(".")>-1){const i=this.fileName.lastIndexOf(".");e=this.fileName.substring(i)}return n[e]||f}async componentWillLoad(){this.i18n=await s()}render(){return this._element.title=`${this.fileName} ${this.getFileSize()}`,l.addIDInfoIfNotExists(this._element,"ezFileIcon"),t("div",{class:"box",onClick:()=>this.ezClick.emit(this.fileName)},t("div",{class:"content"},t("ez-icon",{"data-element-id":l.getInternalIDInfo("fileIcon"),class:"file-type-icon",size:"medium","icon-name":this.getIconName()}),t("label",{class:"file-name"},this.fileName),t("label",{class:"file-size"},this.getFileSize())),this.canRemove?t("ez-icon",{"data-element-id":l.getInternalIDInfo("remove"),class:"btn-remove",size:"medium","icon-name":"close",title:this.i18n("app.remove"),onClick:e=>{this.ezRemove.emit(this.fileName),e.stopPropagation()}}):void 0)}get _element(){return r(this)}static get watchers(){return{progress:["observeProgress"]}}},n={".exe":"exe",".gif":"gif",".mp3":"mp3",".mp4":"mp4",".pdf":"pdf",".png":"png",".txt":"txt",".zip":"zip",".docx":"docx",".xlsx":"xlsx",".pptx":"pptx"},f="generic";a.style=':host{display:flex;width:100%;--ez-file-item--height:42px;--ez-file-item--padding:9px;--ez-file-item--border-radius:var(--border--radius-medium, 12px);--ez-file-item--border-color:var(--color--strokes, #DCE0E8);--ez-file-item--border-style:var(--border--small, 1px solid);--ez-file-item--font-family:var(--font-pattern, Arial);--ez-file-item--font-size:var(--text--medium, 14px);--ez-file-item--font-weight:var(--text-weight--medium, 400);--ez-file-item--color:var(--title--primary, #2B3A54);--ez-file-item__file-size--font-weight:var(--text-weight--large, 600);--ez-file-item__file-size--color:var(--color--primary, #008561);--ez-file-item__background-progress--color:var(--color--primary-300, E2F4EF);--ez-file-item--icon-color:var(--title--primary, #2B3A54)}.box{display:flex;box-sizing:border-box;position:relative;align-items:center;justify-content:space-between;width:100%;padding:var(--ez-file-item--padding);border:var(--ez-file-item--border-color) var(--ez-file-item--border-style);border-radius:var(--ez-file-item--border-radius);height:var(--ez-file-item--height)}.box::before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;clip-path:inset(2px calc(var(--ez-file-item--upload-progress, 0%) + 2px) 2px 2px round calc(var(--ez-file-item--border-radius) - 4px));background-color:var(--ez-file-item__background-progress--color)}.content{display:flex;align-items:center;z-index:0;overflow:hidden}.file-name{text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-family:var(--ez-file-item--font-family);font-size:var(--ez-file-item--font-size);font-weight:var(--ez-file-item--font-weight);color:var(--ez-file-item--color)}.file-type-icon{flex-shrink:0;--ez-icon--color:var(--ez-file-item--icon-color);padding-right:var(--ez-file-item--padding)}.file-size{padding-left:2px;overflow:hidden;flex-shrink:0;white-space:nowrap;font-family:var(--ez-file-item--font-family);font-size:var(--ez-file-item--font-size);font-weight:var(--ez-file-item__file-size--font-weight);color:var(--ez-file-item__file-size--color)}.btn-remove{cursor:pointer;flex-shrink:0;--ez-icon--color:var(--ez-file-item--icon-color)}';export{a as ez_file_item}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as i,h as e,H as s,g as a}from"./p-
|
|
1
|
+
import{r as t,c as i,h as e,H as s,g as a}from"./p-23a36bb6.js";import{DateUtils as n,ElementIDUtils as o}from"@sankhyalabs/core";import{C as h}from"./p-ec7db713.js";import{i as r}from"./p-c178730b.js";const l=class{constructor(e){t(this,e),this.ezChange=i(this,"ezChange",7),this.ezStartChange=i(this,"ezStartChange",7),this.ezCancelWaitingChange=i(this,"ezCancelWaitingChange",7),this.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.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 e=n.validateDate(t),s=n.validateDate(i);if((null==e?void 0:e.getTime())!==(null==s?void 0:s.getTime())){const t=this.getTextValue(e)||"";!n.strToDate(t)&&this._focused||(this._textInput.value||"")===t||(this._textInput.value=t,this._focused=!1,this.errorMessage=""),this.ezChange.emit(null===e?void 0:e)}}this._changePending=!1}async setFocus(t){this._textInput.setFocus(t)}async setBlur(){this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async getValueAsync(){return this._changePending?new Promise((t=>{this._valuePromiseCallbacks.push(t)})):Promise.resolve(this.value)}changeValue(t){const i=n.validateDate(this.value),e=n.validateDate(t);(null==i?void 0:i.getTime())!==(null==e?void 0:e.getTime())?this.value=e: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),e=n.validateDate(i);(null==t?void 0:t.getTime())===(null==e?void 0:e.getTime())?(e&&(this._textInput.value=this.getTextValue(e)||"",this._focused=!1),this.ezCancelWaitingChange.emit()):(this._focused=!1,this.changeValue(e))}else this.changeValue(void 0),this.ezCancelWaitingChange.emit(),this.errorMessage=this.i18n("ez-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),e=n.validateDate(this.value),s=n.validateDate(i);if((null==e?void 0:e.getTime())!==(null==s?void 0:s.getTime())&&(this._changePending=!0,this._focused=!0,this.ezInput.emit(s),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(){h.applyVarsTextInput(this._elem,this._textInput),this.setInputValue(),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}render(){return o.addIDInfoIfNotExists(this._elem,"input"),e(s,null,e("ez-text-input",{"data-element-id":o.getInternalIDInfo("textInput"),ref:t=>this._textInput=t,"data-slave-mode":"true",label:this.label,onBlur:()=>this.handleBlur(),onInput:t=>this.handleInput(t),restrict:"0123456789/",enabled:this.enabled,errorMessage:this.errorMessage,mode:this.mode,canShowError:this.canShowError,alternativePlaceholder:this.alternativePlaceholder},e("button",{disabled:!this.enabled,tabindex:-1,class:"btn-open-cal",onClick:()=>{var t;return null===(t=this._popover)||void 0===t?void 0:t.showUnder(this._textInput)},slot:"leftIcon"})),e("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()},e("ez-calendar",{ref:t=>this._calendar=t,"data-element-id":o.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-date-input__input--background-color:var(--background--medium, #e0e0e0);--ez-date-input__input--border-color:var(--ez-date-input__input--background-color);--ez-date-input__calendar-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="15px"><path d="M 3.171875,5.25 C 2.6485088,5.25 2.21875,5.6797588 2.21875,6.203125 2.21875,6.7264912 2.6485088,7.15625 3.171875,7.15625 3.6952412,7.15625 4.125,6.7264912 4.125,6.203125 4.125,5.6797588 3.6952412,5.25 3.171875,5.25 Z m 2.875,0 C 5.5235088,5.25 5.09375,5.6797588 5.09375,6.203125 5.09375,6.7264912 5.5235088,7.15625 6.046875,7.15625 6.5702412,7.15625 7,6.7264912 7,6.203125 7,5.6797588 6.5702412,5.25 6.046875,5.25 Z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.9511719,-0.4297588 0.9511719,-0.953125 C 9.8730469,5.6797588 9.4452412,5.25 8.921875,5.25 Z m 2.873047,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.953125 0.953125,0.953125 0.523366,0 0.953125,-0.4297588 0.953125,-0.953125 C 12.748047,5.6797588 12.318288,5.25 11.794922,5.25 Z M 3.171875,8.1230469 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 0.5233662,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 C 6.5702412,10.029297 7,9.5995381 7,9.0761719 7,8.5528057 6.5702412,8.1230469 6.046875,8.1230469 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297587,0.9531251 0.953125,0.9531251 0.5233661,0 0.9531249,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.9531251 0.953125,0.9531251 0.523367,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.171875,10.998047 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 C 6.5702412,12.904297 7,12.474538 7,11.951172 7,11.427806 6.5702412,10.998047 6.046875,10.998047 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297587,0.953125 0.953125,0.953125 0.5233661,0 0.9531249,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.429759,0.953125 0.953125,0.953125 0.523367,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.5,0 c -0.554,0 -1,0.446 -1,1 v 0.050781 C 1.0853217,1.2909766 0,2.5186658 0,4 v 9 c 0,1.652487 1.3475134,3 3,3 h 9 c 1.652487,0 3,-1.347513 3,-3 V 4 C 15,2.5186658 13.914678,1.2909766 12.5,1.0507812 V 1 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 C 4.5,0.446 4.054,0 3.5,0 Z m 1,2.0996094 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 v -0.640625 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 2.1738281 C 13.311725,2.3905225 13.900391,3.11278 13.900391,4 v 9 c 0,1.062113 -0.838278,1.900391 -1.900391,1.900391 H 3 C 1.9378864,14.900391 1.0996094,14.062113 1.0996094,13 V 4 C 1.0996094,3.11278 1.6882747,2.3905225 2.5,2.1738281 v 0.5664063 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 z"/></svg>\')}.btn-open-cal{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-cal:disabled{cursor:not-allowed}.btn-open-cal::after{content:\'\';display:flex;background-color:var(--text--primary, #008561);width:15px;height:16px;-webkit-mask-image:var(--ez-date-input__calendar-image);mask-image:var(--ez-date-input__calendar-image)}.btn-open-cal:disabled:after{background-color:var(--text--disable, #AFB6C0)}.btn-open-cal:enabled:hover::after{background-color:var(--color--primary, #4e4e4e)}ez-text-input{--text-input__input--background-color:var(--ez-date-input__input--background-color, #FFFFFF);--text-input__input--border-color:var(--ez-date-input__input--border-color, #DCE0E8)}';export{l as ez_date_input}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,c as i,h as o,g as e}from"./p-
|
|
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-9825c1d2.js";import"./p-ab574d59.js";import"./p-b853763b.js";import{i as a}from"./p-c178730b.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 +1 @@
|
|
|
1
|
-
import{r as i,c as t,f as e,h as a,g as o}from"./p-e4c7eb39.js";import{ElementIDUtils as s}from"@sankhyalabs/core";import{A as d}from"./p-9825c1d2.js";import{i as l}from"./p-c178730b.js";import"./p-ab574d59.js";class r{constructor(i){this.file=i,this.size=i.size,this.name=i.name}abortUpload(){this._uploadingXhr&&(this._aborted=!0,this._uploadingXhr.abort(),this._uploadingXhr=void 0)}isUploading(){return void 0!==this._uploadingXhr}async upload(i,t,e){return new Promise(((a,o)=>{const s=new XMLHttpRequest;this._uploadingXhr=s,this._aborted=!1,this.progress=0,s.upload.onprogress=i=>{const t=i.loaded,a=i.total;this.progress=~~(t/a*100),e(this,t,a)},s.onreadystatechange=()=>{if(4==s.readyState){this._uploadingXhr=void 0;const i=s.status;this._aborted||(0===i?o("Servidor indisponível"):i>=500?o("Erro inesperado no servidor"):i>=400&&o("Operação não permitida"));const t=s.response;if(t)try{a(JSON.parse(t))}catch(i){o(`Servidor não retornou um objeto válido: ${t}.\n${i}`)}}},s.ontimeout=()=>{o("Tempo limite de transferência atingido.")};const d=new FormData;d.append("ARQUIVO",this.file,this.file.name),s.open("POST",i,!0),t&&t.forEach(((i,t)=>s.setRequestHeader(t,i))),s.send(d)}))}async delete(i,t,e){return new Promise(((a,o)=>{const s=new XMLHttpRequest;s.onreadystatechange=()=>{4==s.readyState&&(0===s.status?o("Servidor indisponível"):s.status>=500?o("Erro inesperado no servidor"):s.status>=400&&o("Operação não permitida"),a(!0))},s.ontimeout=()=>{o("Tempo limite de remoção atingido.")},s.open("DELETE",t,!0),e&&e.forEach(((i,t)=>s.setRequestHeader(t,i))),s.send(JSON.stringify(i))}))}}const n=class{constructor(e){i(this,e),this.ezChange=t(this,"ezChange",7),this.ezStartChange=t(this,"ezStartChange",7),this.ezCancelWaitingChange=t(this,"ezCancelWaitingChange",7),this._filePointers=new Map,this.label=void 0,this.subtitle=void 0,this.enabled=!0,this.maxFileSize=void 0,this.maxFiles=void 0,this.requestHeaders=void 0,this.urlUpload=void 0,this.urlDelete=void 0,this.value=void 0}observeValue(i,t){(i!==this._updatingValue||null==i&&null!=t)&&(this._filePointers.forEach((i=>{this.isRemoteFile(i)&&i.abortUpload()})),this._filePointers=new Map,this.updateFilePointers(),this._updatingValue=void 0)}updateFilePointers(){Array.isArray(this.value)&&this.value.forEach((i=>this._filePointers.set(i.name,i)))}observeRequestHeaders(){if(this._requestHeaders=new Map,"string"==typeof this.requestHeaders)try{this.requestHeaders=JSON.parse(this.requestHeaders)}catch(i){this.requestHeaders=void 0}for(var i in this.requestHeaders)this._requestHeaders.set(i,this.requestHeaders[i])}async addFiles(i){if(this.maxFiles>0){let t=this._filePointers.size;if(i.forEach((i=>{this._filePointers.has(i.name)||t++})),t>this.maxFiles)return void this.showError(this.i18n("ez-upload.maxFilesError",{maxFiles:this.maxFiles}))}Array.prototype.forEach.call(i,this.addFile.bind(this))}async setFocus(){this._fileInput.focus()}async setBlur(){this._fileInput.blur()}async addFile(i){const t=this._filePointers.get(i.name);t?d.confirm(this.i18n("ez-upload.replaceFileTitle"),this.i18n("ez-upload.replaceFileMessage",{fileName:i.name})).then((e=>{e&&(this.isRemoteFile(t)&&t.abortUpload(),this.doAddFile(i))})):this.doAddFile(i)}async doAddFile(i){try{if(this.validateFile(i)){this.ezStartChange.emit({waitmessage:this.i18n("ez-upload.uploadingMessage"),blocking:!0});const t=new r(i),a=this._filePointers.get(i.name);a&&this.isRemoteFile(a)&&a.abortUpload(),this._filePointers.set(i.name,t),t.upload(this.urlUpload,this._requestHeaders,(i=>this.updateFeedback(i))).then((i=>i.forEach((i=>this.finishUpload(t.name,i))))).catch((i=>{this.ezCancelWaitingChange.emit(),this.showError(i)})),e(this)}}catch(i){throw this.ezCancelWaitingChange.emit(),i}}finishUpload(i,t){this._filePointers.set(i,t),this.updateValue()}updateValue(){this._updatingValue=[],this._filePointers.forEach((i=>{this.isRemoteFile(i)||this._updatingValue.push(i)})),this._filePointers.size===this._updatingValue.length&&(this.value=this._updatingValue,this.ezChange.emit(this.value))}buildProgressId(i){return`PROGRESS_${i.name.replace(/[^a-z0-9_]/gi,"_")}_${i.file.lastModified}`}updateFeedback(i){window.requestAnimationFrame((()=>{if(this._host){const t=this._host.shadowRoot.querySelector("#"+this.buildProgressId(i));t&&(t.value=i.progress)}}))}validateFile(i){return!this._filePointers.has(i.name)&&this.maxFiles>0&&this._filePointers.size>=this.maxFiles?(this.showError(this.i18n("ez-upload.maxFilesError",{maxFiles:this.maxFiles})),!1):0===i.size?(this.showError(this.i18n("ez-upload.emptyFileError",{fileName:i.name})),!1):this.urlUpload?!(this.maxFileSize>=0&&i.size>this.maxFileSize&&(this.showError(this.i18n("ez-upload.maxFileSizeError",{maxSize:this.formatBytes(this.maxFileSize)})),1)):(this.showError(this.i18n("ez-upload.missingUploadUrlError")),!1)}showError(i){d.alert(this.i18n("ez-upload.uploadErrorTitle"),i)}formatBytes(i,t=1){if(0===i)return"0 Bytes";const e=t<0?0:t,a=Math.floor(Math.log(i)/Math.log(1024));return parseFloat((i/Math.pow(1024,a)).toFixed(e))+" "+["B","KB","MB","GB","TB","PB","EB","ZB","YB"][a]}onFileInputChange(i){this.addFiles(Array.from(i.target.files)),this._fileInput.value=""}isRemoteFile(i){return"file"in i}removeFromList(i){this._filePointers.delete(i),this.updateValue()}removeFile(i){const t=this._filePointers.get(i);if(this.isRemoteFile(t))t.abortUpload(),this.removeFromList(i);else if(this.urlDelete){const e=new r(null);this._filePointers.set(t.name,e),e.delete(t,this.urlDelete,null).then((()=>this.removeFromList(i))).catch((i=>this.showError(i)))}else this.removeFromList(i)}openFilesDialog(){this.enabled&&this._fileInput.click()}componentDidLoad(){this.enabled&&this._dropZone&&window.FileList&&window.File&&(this._dropZone.addEventListener("dragover",(i=>{i.stopPropagation(),i.preventDefault(),i.dataTransfer.dropEffect="copy",this._dropZone.style.background="#c2dbff"})),this._dropZone.addEventListener("drop",(i=>{i.stopPropagation(),i.preventDefault(),this.addFiles(Array.from(i.dataTransfer.files)),this._dropZone.style.background=""})),this._dropZone.addEventListener("dragleave",(()=>{this._dropZone.style.background=""}))),this._host&&s.addIDInfo(this._host,"input"),this.observeRequestHeaders()}componentWillRender(){this.value&&this._filePointers.size<this.value.length&&this.updateFilePointers()}async componentWillLoad(){this.i18n=await l()}render(){return a("div",{ref:i=>this._dropZone=i,class:this.evalDisabledClass("iu","background--disabled")},a("div",{class:"iu__container",onClick:()=>this.openFilesDialog()},a("div",{class:"iu_header"},this.label?a("label",{class:this.evalDisabledClass("iu__label","text--disabled"),title:this.label},this.label):null,a("div",{class:"padding-large"},a("div",{class:this.evalDisabledClass("iu__icon-label","mouse-pointer--disabled")},a("button",{class:"iu__file-icon",disabled:!this.enabled}),a("div",{class:this.evalDisabledClass("text text--center text--medium text--primary","text--disabled")},this.i18n(this.enabled?"ez-upload.enable":"ez-upload.disable"))),this.subtitle&&a("div",{class:this.evalDisabledClass("padding-extra-small text text--center text--small text--secondary","text--disabled")},this.subtitle))),this.buildFooter()),a("input",{ref:i=>this._fileInput=i,onChange:i=>this.onFileInputChange(i),type:"file",multiple:!0,class:"appearanceNone"}))}buildFooter(){if(0===this._filePointers.size)return null;const i=[];return this._filePointers.forEach((t=>i.push(this.buildFileItem(t)))),a("div",{class:"iu__footer"},i)}buildFileItem(i){const t=i.name,e=Number(i.progress),o=i.downloadURL,s=i.size>0?`(${this.formatBytes(i.size)})`:"",d=`${t} ${s}`;return a("div",{class:"iu__item",key:t,onClick:i=>i.stopPropagation()},a("div",{class:"iu__item-label modificador"},a("div",{title:d,class:"col--stretch align--middle file__name text text--primary text--small text--ellipsis align--middle"},o?a("a",{href:o,download:!0},d):d)),isNaN(e)?null:a("div",{class:"col col--sd-4 col--stretch align--middle"},a("progress",{id:this.buildProgressId(i),value:e,max:"100"})),this.enabled?a("div",{class:"col col--stretch align--middle"},a("button",{class:"btn-cancel ",onClick:()=>this.removeFile(t)})):null)}evalDisabledClass(i,t){return this.enabled?i:`${i} ${t}`}get _host(){return o(this)}static get watchers(){return{value:["observeValue"],requestHeaders:["observeRequestHeaders"]}}};n.style=':host{--ez-upload--height:42px;--ez-upload--width:100%;--ez-upload__icon--width:48px;--ez-upload__container--background-color:var(--background--medium, #d2dce9);--ez-upload__color--primary:var(--color--primary, #008561);--ez-upload--padding--extra-small:var(--space--extra-small, 3px);--ez-upload--padding--small:var(--space--small, 6px);--ez-upload--padding--medium:var(--space--medium, 12px);--ez-upload--padding--large:var(--space--large, 24px);--ez-upload__border--color:var(--color-strokes, #DCE0E8);--ez-upload--text-shadow:var(--text-shadow, 0 0 0 #353535, 0 0 1px transparent);--ez-upload--text--primary:var(--text-primary, #626e82);--ez-upload--text--secondary:var(--text-secondary, #a2abb9);--ez-upload--font-size:var(--text--medium, 14px);--ez-upload--font-family:var(--font-pattern, Arial);--ez-upload--font-weight:var(--text-weight--large, 500);--ez-upload__btn__cancel-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="8x" width="8px"><path d="M 8,0.8 7.2,0 4,3.2 0.8,0 0,0.8 3.2,4 0,7.2 0.8,8 4,4.8 7.2,8 8,7.2 4.8,4 Z"/></svg>\');--ez-upload__file-icon-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="11x" width="9px"><path d="M 1.2272719,8.4999999 V 2.75 c 0,-1.1045695 1.4652499,-2 3.2727273,-2 1.8074777,0 3.2727281,0.8954305 3.2727281,2 V 8.9999999 C 7.7727273,9.690356 6.8569456,10.25 5.7272719,10.25 4.5975985,10.25 3.6818174,9.690356 3.6818174,8.9999999 V 3.75 c 0,-0.2761425 0.3663125,-0.5 0.8181818,-0.5 0.4518694,0 0.8181818,0.2238575 0.8181818,0.5 V 8.4999999 H 6.5454537 V 3.75 C 6.5454537,3.059644 5.6296725,2.5 4.4999992,2.5 3.3703258,2.5 2.4545446,3.059644 2.4545446,3.75 V 8.9999999 C 2.4545446,10.10457 3.9197945,11 5.7272719,11 7.5347496,11 9,10.10457 9,8.9999999 V 2.75 C 9,1.231217 6.9852809,0 4.4999992,0 2.0147181,5e-7 0,1.231217 0,2.75 v 5.7499999 z"/></svg>\');display:flex;flex-wrap:wrap;position:relative;padding-bottom:16px;font-family:var(--ez-upload--font-family);font-size:var(--ez-upload--font-size);width:var(--ez-upload--width);font-weight:var(--ez-upload--font-weight)}.iu{display:flex;flex-wrap:wrap;background-color:var(--ez-upload__container--background-color);padding:var(--ez-upload--padding--small);width:100%;border-radius:12px;box-sizing:border-box}.iu__container{width:100%;display:flex;flex-wrap:wrap;justify-content:center;align-items:center;border:2px dashed var(--ez-upload__border--color);border-radius:6px;box-sizing:border-box}.iu__footer{display:flex;flex-wrap:wrap;justify-content:flex-start;width:100%;padding:0 var(--ez-upload--padding--medium) var(--ez-upload--padding--medium) var(--ez-upload--padding--medium);box-sizing:border-box}.iu__item{display:flex;width:100%;justify-content:flex-start;align-items:center;align-self:center;padding-bottom:var(--ez-upload--padding--extra-small);box-sizing:border-box;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.iu__item-label{display:flex;max-width:80%;align-self:stretch;align-items:center}.file__name{font-weight:200}.box__content{width:100%;justify-content:center;align-items:center;height:100%;border:1px dashed var(--ez-upload__border--color);border-radius:6px;box-sizing:border-box}.box__container{display:flex;flex-wrap:wrap;background-color:var(--ez-upload__container--background-color);padding:6px;width:100%;border-radius:12px}a:-webkit-any-link{color:#008561;fill:#008561;cursor:pointer;text-decoration:none}progress[value]{display:flex;width:100%;appearance:none;border:1px solid var(--ez-upload__border--color);height:12px;justify-content:flex-start;align-items:center;border-radius:3px;position:relative}progress[value]::-webkit-progress-bar{display:flex;-webkit-appearance:none;width:100%;background-color:rgb(255, 255, 255);border-radius:2px;padding:2px}progress[value]::-webkit-progress-value{display:flex;width:100%;background-color:var(--ez-upload__color--primary)}.text--center{text-align:center}.align--middle{align-self:center;align-items:center}.padding-large{padding:var(--ez-upload--padding--large) 0px}.padding-extra-small{padding:var(--ez-upload--padding--extra-small) 0px}.text{font-family:var(--font-pattern, "Roboto");text-shadow:0 0 0 #353535, 0 0 1px transparent}.text--primary{color:var(--ez-upload--text--primary);text-shadow:var(--ez-upload--text-shadow)}.text--secondary{color:var(--ez-upload--text--secondary);text-shadow:var(--ez-upload--text-shadow)}.text--ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.text--medium{font-size:14px}.text--small{font-size:12px}.btn-cancel{outline:none;border:none;background-color:unset;cursor:pointer}.btn-cancel::after{content:\'\';display:flex;background-color:var(--text--primary, #008561);width:8px;height:8px;-webkit-mask-image:var(--ez-upload__btn__cancel-image);mask-image:var(--ez-upload__btn__cancel-image)}.iu_header{display:flex;flex-direction:column;width:100%}.iu__label{padding:var(--space--small);box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--ez-upload--font-family);font-size:var(--text--extra-small);font-weight:var(--ez-upload--font-weight);color:var(--ez-upload--text--primary);text-shadow:var(--ez-upload--text-shadow)}.iu__file-icon{outline:none;border:none;background-color:unset;cursor:pointer}.iu__file-icon:disabled{cursor:unset}.iu__file-icon::after{content:\'\';display:flex;background-color:var(--text--primary, #626e82);width:9px;height:11px;-webkit-mask-image:var(--ez-upload__file-icon-image);mask-image:var(--ez-upload__file-icon-image)}.iu__file-icon:disabled::after{background-color:var(--text--disable, #AFB6C0)}.iu__icon-label{justify-content:center;display:flex;cursor:pointer;box-sizing:border-box}.background--disabled{background-color:var(--color--disable-secondary, #F2F5F8)}.text--disabled{color:var(--text--disable, #AFB6C0)}.mouse-pointer--disabled{cursor:unset}.appearanceNone{width:0px;height:0px}.row{width:100%;display:flex;flex-wrap:wrap}.col{display:flex;flex-wrap:wrap;align-self:flex-start;box-sizing:border-box}.col--stretch{align-self:stretch}.col--undefined{width:unset}.col--nowrap{flex-wrap:nowrap}@media screen and (min-width: 320px){.col--sd-1{width:8.33333%}.col--sd-2{width:16.66667%}.col--sd-3{width:25%}.col--sd-4{width:33.33333%}.col--sd-5{width:41.66667%}.col--sd-6{width:50%}.col--sd-7{width:58.33333%}.col--sd-8{width:66.66667%}.col--sd-9{width:75%}.col--sd-10{width:83.33333%}.col--sd-11{width:91.66667%}.col--sd-12{width:100%}}@media screen and (min-width: 480px){.col--pn-1{width:8.33333%}.col--pn-2{width:16.66667%}.col--pn-3{width:25%}.col--pn-4{width:33.33333%}.col--pn-5{width:41.66667%}.col--pn-6{width:50%}.col--pn-7{width:58.33333%}.col--pn-8{width:66.66667%}.col--pn-9{width:75%}.col--pn-10{width:83.33333%}.col--pn-11{width:91.66667%}.col--pn-12{width:100%}}@media screen and (min-width: 768px){.col--tb-1{width:8.33333%}.col--tb-2{width:16.66667%}.col--tb-3{width:25%}.col--tb-4{width:33.33333%}.col--tb-5{width:41.66667%}.col--tb-6{width:50%}.col--tb-7{width:58.33333%}.col--tb-8{width:66.66667%}.col--tb-9{width:75%}.col--tb-10{width:83.33333%}.col--tb-11{width:91.66667%}.col--tb-12{width:100%}}@media screen and (min-width: 992px){.col--md-1{width:8.33333%}.col--md-2{width:16.66667%}.col--md-3{width:25%}.col--md-4{width:33.33333%}.col--md-5{width:41.66667%}.col--md-6{width:50%}.col--md-7{width:58.33333%}.col--md-8{width:66.66667%}.col--md-9{width:75%}.col--md-10{width:83.33333%}.col--md-11{width:91.66667%}.col--md-12{width:100%}}@media screen and (min-width: 1200px){.col--ld-1{width:8.33333%}.col--ld-2{width:16.66667%}.col--ld-3{width:25%}.col--ld-4{width:33.33333%}.col--ld-5{width:41.66667%}.col--ld-6{width:50%}.col--ld-7{width:58.33333%}.col--ld-8{width:66.66667%}.col--ld-9{width:75%}.col--ld-10{width:83.33333%}.col--ld-11{width:91.66667%}.col--ld-12{width:100%}}';export{n as ez_upload}
|
|
1
|
+
import{r as i,c as t,f as e,h as a,g as o}from"./p-23a36bb6.js";import{ElementIDUtils as s}from"@sankhyalabs/core";import{A as d}from"./p-9825c1d2.js";import{i as l}from"./p-c178730b.js";import"./p-ab574d59.js";class r{constructor(i){this.file=i,this.size=i.size,this.name=i.name}abortUpload(){this._uploadingXhr&&(this._aborted=!0,this._uploadingXhr.abort(),this._uploadingXhr=void 0)}isUploading(){return void 0!==this._uploadingXhr}async upload(i,t,e){return new Promise(((a,o)=>{const s=new XMLHttpRequest;this._uploadingXhr=s,this._aborted=!1,this.progress=0,s.upload.onprogress=i=>{const t=i.loaded,a=i.total;this.progress=~~(t/a*100),e(this,t,a)},s.onreadystatechange=()=>{if(4==s.readyState){this._uploadingXhr=void 0;const i=s.status;this._aborted||(0===i?o("Servidor indisponível"):i>=500?o("Erro inesperado no servidor"):i>=400&&o("Operação não permitida"));const t=s.response;if(t)try{a(JSON.parse(t))}catch(i){o(`Servidor não retornou um objeto válido: ${t}.\n${i}`)}}},s.ontimeout=()=>{o("Tempo limite de transferência atingido.")};const d=new FormData;d.append("ARQUIVO",this.file,this.file.name),s.open("POST",i,!0),t&&t.forEach(((i,t)=>s.setRequestHeader(t,i))),s.send(d)}))}async delete(i,t,e){return new Promise(((a,o)=>{const s=new XMLHttpRequest;s.onreadystatechange=()=>{4==s.readyState&&(0===s.status?o("Servidor indisponível"):s.status>=500?o("Erro inesperado no servidor"):s.status>=400&&o("Operação não permitida"),a(!0))},s.ontimeout=()=>{o("Tempo limite de remoção atingido.")},s.open("DELETE",t,!0),e&&e.forEach(((i,t)=>s.setRequestHeader(t,i))),s.send(JSON.stringify(i))}))}}const n=class{constructor(e){i(this,e),this.ezChange=t(this,"ezChange",7),this.ezStartChange=t(this,"ezStartChange",7),this.ezCancelWaitingChange=t(this,"ezCancelWaitingChange",7),this._filePointers=new Map,this.label=void 0,this.subtitle=void 0,this.enabled=!0,this.maxFileSize=void 0,this.maxFiles=void 0,this.requestHeaders=void 0,this.urlUpload=void 0,this.urlDelete=void 0,this.value=void 0}observeValue(i,t){(i!==this._updatingValue||null==i&&null!=t)&&(this._filePointers.forEach((i=>{this.isRemoteFile(i)&&i.abortUpload()})),this._filePointers=new Map,this.updateFilePointers(),this._updatingValue=void 0)}updateFilePointers(){Array.isArray(this.value)&&this.value.forEach((i=>this._filePointers.set(i.name,i)))}observeRequestHeaders(){if(this._requestHeaders=new Map,"string"==typeof this.requestHeaders)try{this.requestHeaders=JSON.parse(this.requestHeaders)}catch(i){this.requestHeaders=void 0}for(var i in this.requestHeaders)this._requestHeaders.set(i,this.requestHeaders[i])}async addFiles(i){if(this.maxFiles>0){let t=this._filePointers.size;if(i.forEach((i=>{this._filePointers.has(i.name)||t++})),t>this.maxFiles)return void this.showError(this.i18n("ez-upload.maxFilesError",{maxFiles:this.maxFiles}))}Array.prototype.forEach.call(i,this.addFile.bind(this))}async setFocus(){this._fileInput.focus()}async setBlur(){this._fileInput.blur()}async addFile(i){const t=this._filePointers.get(i.name);t?d.confirm(this.i18n("ez-upload.replaceFileTitle"),this.i18n("ez-upload.replaceFileMessage",{fileName:i.name})).then((e=>{e&&(this.isRemoteFile(t)&&t.abortUpload(),this.doAddFile(i))})):this.doAddFile(i)}async doAddFile(i){try{if(this.validateFile(i)){this.ezStartChange.emit({waitmessage:this.i18n("ez-upload.uploadingMessage"),blocking:!0});const t=new r(i),a=this._filePointers.get(i.name);a&&this.isRemoteFile(a)&&a.abortUpload(),this._filePointers.set(i.name,t),t.upload(this.urlUpload,this._requestHeaders,(i=>this.updateFeedback(i))).then((i=>i.forEach((i=>this.finishUpload(t.name,i))))).catch((i=>{this.ezCancelWaitingChange.emit(),this.showError(i)})),e(this)}}catch(i){throw this.ezCancelWaitingChange.emit(),i}}finishUpload(i,t){this._filePointers.set(i,t),this.updateValue()}updateValue(){this._updatingValue=[],this._filePointers.forEach((i=>{this.isRemoteFile(i)||this._updatingValue.push(i)})),this._filePointers.size===this._updatingValue.length&&(this.value=this._updatingValue,this.ezChange.emit(this.value))}buildProgressId(i){return`PROGRESS_${i.name.replace(/[^a-z0-9_]/gi,"_")}_${i.file.lastModified}`}updateFeedback(i){window.requestAnimationFrame((()=>{if(this._host){const t=this._host.shadowRoot.querySelector("#"+this.buildProgressId(i));t&&(t.value=i.progress)}}))}validateFile(i){return!this._filePointers.has(i.name)&&this.maxFiles>0&&this._filePointers.size>=this.maxFiles?(this.showError(this.i18n("ez-upload.maxFilesError",{maxFiles:this.maxFiles})),!1):0===i.size?(this.showError(this.i18n("ez-upload.emptyFileError",{fileName:i.name})),!1):this.urlUpload?!(this.maxFileSize>=0&&i.size>this.maxFileSize&&(this.showError(this.i18n("ez-upload.maxFileSizeError",{maxSize:this.formatBytes(this.maxFileSize)})),1)):(this.showError(this.i18n("ez-upload.missingUploadUrlError")),!1)}showError(i){d.alert(this.i18n("ez-upload.uploadErrorTitle"),i)}formatBytes(i,t=1){if(0===i)return"0 Bytes";const e=t<0?0:t,a=Math.floor(Math.log(i)/Math.log(1024));return parseFloat((i/Math.pow(1024,a)).toFixed(e))+" "+["B","KB","MB","GB","TB","PB","EB","ZB","YB"][a]}onFileInputChange(i){this.addFiles(Array.from(i.target.files)),this._fileInput.value=""}isRemoteFile(i){return"file"in i}removeFromList(i){this._filePointers.delete(i),this.updateValue()}removeFile(i){const t=this._filePointers.get(i);if(this.isRemoteFile(t))t.abortUpload(),this.removeFromList(i);else if(this.urlDelete){const e=new r(null);this._filePointers.set(t.name,e),e.delete(t,this.urlDelete,null).then((()=>this.removeFromList(i))).catch((i=>this.showError(i)))}else this.removeFromList(i)}openFilesDialog(){this.enabled&&this._fileInput.click()}componentDidLoad(){this.enabled&&this._dropZone&&window.FileList&&window.File&&(this._dropZone.addEventListener("dragover",(i=>{i.stopPropagation(),i.preventDefault(),i.dataTransfer.dropEffect="copy",this._dropZone.style.background="#c2dbff"})),this._dropZone.addEventListener("drop",(i=>{i.stopPropagation(),i.preventDefault(),this.addFiles(Array.from(i.dataTransfer.files)),this._dropZone.style.background=""})),this._dropZone.addEventListener("dragleave",(()=>{this._dropZone.style.background=""}))),this._host&&s.addIDInfo(this._host,"input"),this.observeRequestHeaders()}componentWillRender(){this.value&&this._filePointers.size<this.value.length&&this.updateFilePointers()}async componentWillLoad(){this.i18n=await l()}render(){return a("div",{ref:i=>this._dropZone=i,class:this.evalDisabledClass("iu","background--disabled")},a("div",{class:"iu__container",onClick:()=>this.openFilesDialog()},a("div",{class:"iu_header"},this.label?a("label",{class:this.evalDisabledClass("iu__label","text--disabled"),title:this.label},this.label):null,a("div",{class:"padding-large"},a("div",{class:this.evalDisabledClass("iu__icon-label","mouse-pointer--disabled")},a("button",{class:"iu__file-icon",disabled:!this.enabled}),a("div",{class:this.evalDisabledClass("text text--center text--medium text--primary","text--disabled")},this.i18n(this.enabled?"ez-upload.enable":"ez-upload.disable"))),this.subtitle&&a("div",{class:this.evalDisabledClass("padding-extra-small text text--center text--small text--secondary","text--disabled")},this.subtitle))),this.buildFooter()),a("input",{ref:i=>this._fileInput=i,onChange:i=>this.onFileInputChange(i),type:"file",multiple:!0,class:"appearanceNone"}))}buildFooter(){if(0===this._filePointers.size)return null;const i=[];return this._filePointers.forEach((t=>i.push(this.buildFileItem(t)))),a("div",{class:"iu__footer"},i)}buildFileItem(i){const t=i.name,e=Number(i.progress),o=i.downloadURL,s=i.size>0?`(${this.formatBytes(i.size)})`:"",d=`${t} ${s}`;return a("div",{class:"iu__item",key:t,onClick:i=>i.stopPropagation()},a("div",{class:"iu__item-label modificador"},a("div",{title:d,class:"col--stretch align--middle file__name text text--primary text--small text--ellipsis align--middle"},o?a("a",{href:o,download:!0},d):d)),isNaN(e)?null:a("div",{class:"col col--sd-4 col--stretch align--middle"},a("progress",{id:this.buildProgressId(i),value:e,max:"100"})),this.enabled?a("div",{class:"col col--stretch align--middle"},a("button",{class:"btn-cancel ",onClick:()=>this.removeFile(t)})):null)}evalDisabledClass(i,t){return this.enabled?i:`${i} ${t}`}get _host(){return o(this)}static get watchers(){return{value:["observeValue"],requestHeaders:["observeRequestHeaders"]}}};n.style=':host{--ez-upload--height:42px;--ez-upload--width:100%;--ez-upload__icon--width:48px;--ez-upload__container--background-color:var(--background--medium, #d2dce9);--ez-upload__color--primary:var(--color--primary, #008561);--ez-upload--padding--extra-small:var(--space--extra-small, 3px);--ez-upload--padding--small:var(--space--small, 6px);--ez-upload--padding--medium:var(--space--medium, 12px);--ez-upload--padding--large:var(--space--large, 24px);--ez-upload__border--color:var(--color-strokes, #DCE0E8);--ez-upload--text-shadow:var(--text-shadow, 0 0 0 #353535, 0 0 1px transparent);--ez-upload--text--primary:var(--text-primary, #626e82);--ez-upload--text--secondary:var(--text-secondary, #a2abb9);--ez-upload--font-size:var(--text--medium, 14px);--ez-upload--font-family:var(--font-pattern, Arial);--ez-upload--font-weight:var(--text-weight--large, 500);--ez-upload__btn__cancel-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="8x" width="8px"><path d="M 8,0.8 7.2,0 4,3.2 0.8,0 0,0.8 3.2,4 0,7.2 0.8,8 4,4.8 7.2,8 8,7.2 4.8,4 Z"/></svg>\');--ez-upload__file-icon-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="11x" width="9px"><path d="M 1.2272719,8.4999999 V 2.75 c 0,-1.1045695 1.4652499,-2 3.2727273,-2 1.8074777,0 3.2727281,0.8954305 3.2727281,2 V 8.9999999 C 7.7727273,9.690356 6.8569456,10.25 5.7272719,10.25 4.5975985,10.25 3.6818174,9.690356 3.6818174,8.9999999 V 3.75 c 0,-0.2761425 0.3663125,-0.5 0.8181818,-0.5 0.4518694,0 0.8181818,0.2238575 0.8181818,0.5 V 8.4999999 H 6.5454537 V 3.75 C 6.5454537,3.059644 5.6296725,2.5 4.4999992,2.5 3.3703258,2.5 2.4545446,3.059644 2.4545446,3.75 V 8.9999999 C 2.4545446,10.10457 3.9197945,11 5.7272719,11 7.5347496,11 9,10.10457 9,8.9999999 V 2.75 C 9,1.231217 6.9852809,0 4.4999992,0 2.0147181,5e-7 0,1.231217 0,2.75 v 5.7499999 z"/></svg>\');display:flex;flex-wrap:wrap;position:relative;padding-bottom:16px;font-family:var(--ez-upload--font-family);font-size:var(--ez-upload--font-size);width:var(--ez-upload--width);font-weight:var(--ez-upload--font-weight)}.iu{display:flex;flex-wrap:wrap;background-color:var(--ez-upload__container--background-color);padding:var(--ez-upload--padding--small);width:100%;border-radius:12px;box-sizing:border-box}.iu__container{width:100%;display:flex;flex-wrap:wrap;justify-content:center;align-items:center;border:2px dashed var(--ez-upload__border--color);border-radius:6px;box-sizing:border-box}.iu__footer{display:flex;flex-wrap:wrap;justify-content:flex-start;width:100%;padding:0 var(--ez-upload--padding--medium) var(--ez-upload--padding--medium) var(--ez-upload--padding--medium);box-sizing:border-box}.iu__item{display:flex;width:100%;justify-content:flex-start;align-items:center;align-self:center;padding-bottom:var(--ez-upload--padding--extra-small);box-sizing:border-box;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.iu__item-label{display:flex;max-width:80%;align-self:stretch;align-items:center}.file__name{font-weight:200}.box__content{width:100%;justify-content:center;align-items:center;height:100%;border:1px dashed var(--ez-upload__border--color);border-radius:6px;box-sizing:border-box}.box__container{display:flex;flex-wrap:wrap;background-color:var(--ez-upload__container--background-color);padding:6px;width:100%;border-radius:12px}a:-webkit-any-link{color:#008561;fill:#008561;cursor:pointer;text-decoration:none}progress[value]{display:flex;width:100%;appearance:none;border:1px solid var(--ez-upload__border--color);height:12px;justify-content:flex-start;align-items:center;border-radius:3px;position:relative}progress[value]::-webkit-progress-bar{display:flex;-webkit-appearance:none;width:100%;background-color:rgb(255, 255, 255);border-radius:2px;padding:2px}progress[value]::-webkit-progress-value{display:flex;width:100%;background-color:var(--ez-upload__color--primary)}.text--center{text-align:center}.align--middle{align-self:center;align-items:center}.padding-large{padding:var(--ez-upload--padding--large) 0px}.padding-extra-small{padding:var(--ez-upload--padding--extra-small) 0px}.text{font-family:var(--font-pattern, "Roboto");text-shadow:0 0 0 #353535, 0 0 1px transparent}.text--primary{color:var(--ez-upload--text--primary);text-shadow:var(--ez-upload--text-shadow)}.text--secondary{color:var(--ez-upload--text--secondary);text-shadow:var(--ez-upload--text-shadow)}.text--ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.text--medium{font-size:14px}.text--small{font-size:12px}.btn-cancel{outline:none;border:none;background-color:unset;cursor:pointer}.btn-cancel::after{content:\'\';display:flex;background-color:var(--text--primary, #008561);width:8px;height:8px;-webkit-mask-image:var(--ez-upload__btn__cancel-image);mask-image:var(--ez-upload__btn__cancel-image)}.iu_header{display:flex;flex-direction:column;width:100%}.iu__label{padding:var(--space--small);box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--ez-upload--font-family);font-size:var(--text--extra-small);font-weight:var(--ez-upload--font-weight);color:var(--ez-upload--text--primary);text-shadow:var(--ez-upload--text-shadow)}.iu__file-icon{outline:none;border:none;background-color:unset;cursor:pointer}.iu__file-icon:disabled{cursor:unset}.iu__file-icon::after{content:\'\';display:flex;background-color:var(--text--primary, #626e82);width:9px;height:11px;-webkit-mask-image:var(--ez-upload__file-icon-image);mask-image:var(--ez-upload__file-icon-image)}.iu__file-icon:disabled::after{background-color:var(--text--disable, #AFB6C0)}.iu__icon-label{justify-content:center;display:flex;cursor:pointer;box-sizing:border-box}.background--disabled{background-color:var(--color--disable-secondary, #F2F5F8)}.text--disabled{color:var(--text--disable, #AFB6C0)}.mouse-pointer--disabled{cursor:unset}.appearanceNone{width:0px;height:0px}.row{width:100%;display:flex;flex-wrap:wrap}.col{display:flex;flex-wrap:wrap;align-self:flex-start;box-sizing:border-box}.col--stretch{align-self:stretch}.col--undefined{width:unset}.col--nowrap{flex-wrap:nowrap}@media screen and (min-width: 320px){.col--sd-1{width:8.33333%}.col--sd-2{width:16.66667%}.col--sd-3{width:25%}.col--sd-4{width:33.33333%}.col--sd-5{width:41.66667%}.col--sd-6{width:50%}.col--sd-7{width:58.33333%}.col--sd-8{width:66.66667%}.col--sd-9{width:75%}.col--sd-10{width:83.33333%}.col--sd-11{width:91.66667%}.col--sd-12{width:100%}}@media screen and (min-width: 480px){.col--pn-1{width:8.33333%}.col--pn-2{width:16.66667%}.col--pn-3{width:25%}.col--pn-4{width:33.33333%}.col--pn-5{width:41.66667%}.col--pn-6{width:50%}.col--pn-7{width:58.33333%}.col--pn-8{width:66.66667%}.col--pn-9{width:75%}.col--pn-10{width:83.33333%}.col--pn-11{width:91.66667%}.col--pn-12{width:100%}}@media screen and (min-width: 768px){.col--tb-1{width:8.33333%}.col--tb-2{width:16.66667%}.col--tb-3{width:25%}.col--tb-4{width:33.33333%}.col--tb-5{width:41.66667%}.col--tb-6{width:50%}.col--tb-7{width:58.33333%}.col--tb-8{width:66.66667%}.col--tb-9{width:75%}.col--tb-10{width:83.33333%}.col--tb-11{width:91.66667%}.col--tb-12{width:100%}}@media screen and (min-width: 992px){.col--md-1{width:8.33333%}.col--md-2{width:16.66667%}.col--md-3{width:25%}.col--md-4{width:33.33333%}.col--md-5{width:41.66667%}.col--md-6{width:50%}.col--md-7{width:58.33333%}.col--md-8{width:66.66667%}.col--md-9{width:75%}.col--md-10{width:83.33333%}.col--md-11{width:91.66667%}.col--md-12{width:100%}}@media screen and (min-width: 1200px){.col--ld-1{width:8.33333%}.col--ld-2{width:16.66667%}.col--ld-3{width:25%}.col--ld-4{width:33.33333%}.col--ld-5{width:41.66667%}.col--ld-6{width:50%}.col--ld-7{width:58.33333%}.col--ld-8{width:66.66667%}.col--ld-9{width:75%}.col--ld-10{width:83.33333%}.col--ld-11{width:91.66667%}.col--ld-12{width:100%}}';export{n as ez_upload}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as e,h as i,H as s}from"./p-e4c7eb39.js";import{ObjectUtils as o}from"@sankhyalabs/core";import{i as l}from"./p-80dfc50b.js";import{i as n}from"./p-c178730b.js";function h(t,e,i){if(!t.length)return[...e];if(!e.length)return[];const s=function(t,e){return t.map((t=>e.findIndex((e=>e.id===t))))}(t,e),o=0===(l=s).length?0:l.reduce(((t,e)=>e<t?e:t),l[0]);var l;const n=function(t){return 0===t.length?0:t.reduce(((t,e)=>e>t?e:t),t[0])}(s);return function(t,e,i,s){return t<0||e>=s.length||t>e?s:i?function(t,e,i){if(t===i.length-1)return i;const s=i.slice(0,e),o=i.slice(e,t+1),l=i.slice(t+1),n=l.shift();return n?[...s,n,...o,...l]:i}(e,t,s):function(t,e,i){if(0===t)return i;const s=i.slice(0,t-1),o=i.slice(t,e+1),l=i.slice(e+1);return[...s,...o,i[t-1],...l]}(t,e,s)}(o,n,i,e)}function r({from:t,to:e,selectedFrom:i,selectedTo:s}){return e=[...e.map((t=>d(t,!1))),...t.map((t=>d(t,!0)))],i=[],s=[...t.map((({id:t})=>t))],{from:t=[],to:e,selectedFrom:i,selectedTo:s}}function a({from:t,to:e,selectedFrom:i,selectedTo:s,insertIndex:o=e.length}){if(!t.length)return{from:t,to:e,selectedFrom:i,selectedTo:s};const l=function(t,e,i){const s=t.map((t=>t.id)),o=e.filter((t=>!s.includes(t)));return i.filter((({id:t})=>o.includes(t)))}(e,i,t);if(!l.length)return{from:t,to:e,selectedFrom:i,selectedTo:s};let n=e.map((t=>d(t,!1)));return n.splice(o,0,...l.map((t=>d(t,!0)))),{from:t.filter((t=>!i.includes(t.id))),to:n,selectedFrom:[],selectedTo:[...i]}}function d(t,e){return Object.assign(Object.assign({},t),{selected:e})}const c=class{constructor(i){t(this,i),this.ezLeftListChanged=e(this,"ezLeftListChanged",7),this.ezRightListChanged=e(this,"ezRightListChanged",7),this.LEFT_LIST_ID="LEFT-LIST-ID",this.RIGHT_LIST_ID="RIGHT-LIST-ID",this.leftList=[],this.leftTitle=void 0,this.rightList=[],this.entityLabel="item",this.entityLabelPlural="itens",this.leftListLabel="disponíveis",this.rightListLabel="selecionados",this.useOnlyRightList=!1,this.rightTitle=void 0,this.emptyMessage=void 0,this.slotsListBuilder=void 0,this.leftFilteredList=[],this.rightFilteredList=[],this.selectedLeftList=[],this.selectedRightList=[],this.isFilteringLeft=!1,this.isFilteringRight=!1}async resetSelectedLists(){this.selectedLeftList=[],this.selectedRightList=[]}observeLeftList(t,e){o.equals(t,e)||this.ezLeftListChanged.emit(t)}observeRightList(t,e){o.equals(t,e)||this.ezRightListChanged.emit(t)}async componentWillLoad(){this.i18n=await n()}async handleChangeLeft({detail:t}){t.to.getAttribute("id")&&t.to.getAttribute("id")===this.RIGHT_LIST_ID?(t.selectItens=t.selectItens.filter((t=>this.rightList.every((e=>e.id!==t)))),this.leftList=[...t.dataSource],this.selectedLeftList=[...t.selectItens],this.transferToRight(null==t?void 0:t.newIndex)):this.leftList=[...this.reorderArray(t.dataSource,t.selectItens,t.newIndex)]}async handleChangeRight({detail:t}){t.to.getAttribute("id")&&t.to.getAttribute("id")===this.LEFT_LIST_ID?(t.selectItens=t.selectItens.filter((t=>this.leftList.every((e=>e.id!==t)))),this.rightList=[...t.dataSource],this.selectedRightList=[...t.selectItens],this.transferToLeft(null==t?void 0:t.newIndex)):this.rightList=[...this.reorderArray(t.dataSource,t.selectItens,t.newIndex)]}reorderArray(t,e,i){const s=t.filter((t=>!e.includes(t.id))),o=t.filter((t=>e.includes(t.id)));return s.splice(i,0,...o),s}enableTransferAllToRight(){return this.leftList.length>0}enableTransferAllToLeft(){return this.rightList.length>0}enableTransferToRight(){return this.selectedLeftList.length>0}enableTransferToLeft(){return this.selectedRightList.length>0}enableMoveUp(t){if(this.isFilteringRight)return!1;const e=this.getRightSelectedItemsIndex();return this.selectedRightList.length>0&&!e.includes(0)&&(!!t||l(e))}enableMoveDown(t){if(this.isFilteringRight)return!1;const e=this.getRightSelectedItemsIndex();return this.selectedRightList.length>0&&!e.includes(this.rightList.length-1)&&(!!t||l(e))}getRightSelectedItemsIndex(){return this.selectedRightList.map((t=>this.rightList.findIndex((e=>e.id===t))))}transferToRight(t){const{from:e,to:i,selectedFrom:s,selectedTo:o}=a(Object.assign(Object.assign({},this.buildTransferToRightConfig()),{insertIndex:null!=t?t:0}));this.leftList=[],requestAnimationFrame((()=>this.leftList=[...e])),this.rightList=[...i],this.selectedLeftList=[...s],this.selectedRightList=[...o]}transferToLeft(t){const{from:e,to:i,selectedFrom:s,selectedTo:o}=a(Object.assign(Object.assign({},this.buildTransferToLeftConfig()),{insertIndex:null!=t?t:0}));this.rightList=[],requestAnimationFrame((()=>this.rightList=[...e])),this.leftList=[...i],this.selectedRightList=[...s],this.selectedLeftList=[...o]}async handleTransferAllToRight(){const{from:t,to:e,selectedFrom:i,selectedTo:s}=r(this.buildTransferToRightConfig());this.leftList=[...t],this.rightList=[...e],this.selectedLeftList=[...i],this.selectedRightList=[...s],requestAnimationFrame((async()=>{await this.clearSelectionAll()}))}async handleTransferAllToLeft(){const{from:t,to:e,selectedFrom:i,selectedTo:s}=r(this.buildTransferToLeftConfig());this.rightList=[...t],this.leftList=[...e],this.selectedRightList=[...i],this.selectedLeftList=[...s],requestAnimationFrame((async()=>{await this.clearSelectionAll()}))}buildTransferToRightConfig(){return{from:this.leftList,to:this.rightList,selectedFrom:this.selectedLeftList,selectedTo:this.selectedRightList}}buildTransferToLeftConfig(){return{from:this.rightList,to:this.leftList,selectedFrom:this.selectedRightList,selectedTo:this.selectedLeftList}}handleMoveUp(){this.rightList=[...h(this.selectedRightList,this.rightList,!1)]}handleMoveDown(){this.rightList=[...h(this.selectedRightList,this.rightList,!0)]}handleMoveToTop(){const{itemsToKeep:t,itemsToMove:e}=this.getItemsToKeepAndToMove();this.rightList=[...e,...t]}handleMoveToBottom(){const{itemsToKeep:t,itemsToMove:e}=this.getItemsToKeepAndToMove();this.rightList=[...t,...e]}handleSelectLeftItem({detail:t}){this.selectedLeftList=[...t.map((({id:t})=>t))]}handleSelectRightItem({detail:t}){this.selectedRightList=[...t.map((({id:t})=>t))]}getItemsToKeepAndToMove(){return{itemsToKeep:this.rightList.filter((t=>!this.selectedRightList.includes(t.id))),itemsToMove:this.rightList.filter((t=>this.selectedRightList.includes(t.id)))}}async handleTransferToRight(){this.transferToRight(),this.leftFilteredList=[],await this.leftEzListInstance.clearSelection()}async handleTransferToLeft(){this.transferToLeft(),this.rightFilteredList=[],await this.rightEzListInstance.clearSelection()}async clearSelectionAll(){await this.rightEzListInstance.clearSelection(),await this.leftEzListInstance.clearSelection()}handleChooseLeft(){requestAnimationFrame((async()=>{await this.rightEzListInstance.clearSelection()}))}handleChooseRight(){this.useOnlyRightList||requestAnimationFrame((async()=>{await this.leftEzListInstance.clearSelection()}))}renderList(t){const{idSortableList:e,list:s,isFiltering:o,filteredList:l,emptyMessage:n,slotConfig:h,callbacks:r,title:a}=t;return i("ez-sortable-list",{ref:null==r?void 0:r.setRef,title:a,idSortableList:e,emptyMessage:n,class:"ez-size-height--full",dataSource:o?l:s,hoverFeedback:!0,enableMultipleSelection:!0,removeItensMoved:!0,entityLabel:this.entityLabel,entityLabelPlural:this.entityLabelPlural,itemRightSlotBuilder:null==h?void 0:h.itemRightSlotBuilder,itemLeftSlotBuilder:null==h?void 0:h.itemLeftSlotBuilder,onItemsReordered:null==r?void 0:r.onChange.bind(this),onEzSelectItens:null==r?void 0:r.onSelect.bind(this),onEzDoubleClick:null==r?void 0:r.onDoubleClick.bind(this),onEzChoose:null==r?void 0:r.onChoose.bind(this)})}render(){var t,e,o,l,n,h,r,a,d,c;return i(s,null,!this.useOnlyRightList&&i("div",{class:"list__container"},this.leftList&&this.renderList({idSortableList:this.LEFT_LIST_ID,list:this.leftList,title:this.leftTitle,isFiltering:this.isFilteringLeft,filteredList:this.leftFilteredList,emptyMessage:(null===(t=this.emptyMessage)||void 0===t?void 0:t.LEFT_LIST)?this.emptyMessage.LEFT_LIST:this.i18n("ez-double-list.noItemsAvailable",{entity:this.entityLabel}),slotConfig:{itemRightSlotBuilder:null===(o=null===(e=this.slotsListBuilder)||void 0===e?void 0:e.LEFT_LIST)||void 0===o?void 0:o.itemRightSlotBuilder,itemLeftSlotBuilder:null===(n=null===(l=this.slotsListBuilder)||void 0===l?void 0:l.LEFT_LIST)||void 0===n?void 0:n.itemLeftSlotBuilder},callbacks:{setRef:t=>this.leftEzListInstance=t,onChange:t=>this.handleChangeLeft(t),onSelect:this.handleSelectLeftItem.bind(this),onDoubleClick:this.handleTransferToRight.bind(this),onChoose:this.handleChooseLeft.bind(this)}})),!this.useOnlyRightList&&i("div",{class:"actions__column"},i("ez-button",{mode:"icon",iconName:"dual-chevron-right",enabled:this.enableTransferAllToRight(),title:this.i18n("ez-double-list.moveAllTo",{list:this.rightListLabel}),size:"small",onClick:this.handleTransferAllToRight.bind(this)}),i("ez-button",{mode:"icon",iconName:"chevron-right",enabled:this.enableTransferToRight(),title:this.i18n("ez-double-list.moveTo",{list:this.rightListLabel}),size:"small",onClick:this.handleTransferToRight.bind(this)}),i("ez-button",{mode:"icon",iconName:"chevron-left",enabled:this.enableTransferToLeft(),title:this.i18n("ez-double-list.moveTo",{list:this.leftListLabel}),size:"small",onClick:this.handleTransferToLeft.bind(this)}),i("ez-button",{mode:"icon",iconName:"dual-chevron-left",enabled:this.enableTransferAllToLeft(),title:this.i18n("ez-double-list.moveAllTo",{list:this.leftListLabel}),size:"small",onClick:this.handleTransferAllToLeft.bind(this)})),i("div",{class:"list__container"},this.rightList&&this.renderList({idSortableList:this.RIGHT_LIST_ID,list:this.rightList,title:this.rightTitle,isFiltering:this.isFilteringRight,filteredList:this.rightFilteredList,emptyMessage:(null===(h=this.emptyMessage)||void 0===h?void 0:h.RIGHT_LIST)?this.emptyMessage.RIGHT_LIST:this.i18n("ez-double-list.noItemsSelected",{entity:this.entityLabel}),slotConfig:{itemRightSlotBuilder:null===(a=null===(r=this.slotsListBuilder)||void 0===r?void 0:r.RIGHT_LIST)||void 0===a?void 0:a.itemRightSlotBuilder,itemLeftSlotBuilder:null===(c=null===(d=this.slotsListBuilder)||void 0===d?void 0:d.RIGHT_LIST)||void 0===c?void 0:c.itemLeftSlotBuilder},callbacks:{setRef:t=>this.rightEzListInstance=t,onChange:t=>this.handleChangeRight(t),onSelect:this.handleSelectRightItem.bind(this),onDoubleClick:this.handleTransferToLeft.bind(this),onChoose:this.handleChooseRight.bind(this)}})),i("div",{class:"actions__column"},i("ez-button",{mode:"icon",iconName:"dual-chevron-up",enabled:this.enableMoveUp(!0),title:this.i18n("ez-double-list.moveToFirstPosition"),size:"small",onClick:this.handleMoveToTop.bind(this)}),i("ez-button",{mode:"icon",iconName:"chevron-up",enabled:this.enableMoveUp(),title:this.i18n("ez-double-list.moveUp"),size:"small",onClick:this.handleMoveUp.bind(this)}),i("ez-button",{mode:"icon",iconName:"chevron-down",enabled:this.enableMoveDown(),title:this.i18n("ez-double-list.moveDown"),size:"small",onClick:this.handleMoveDown.bind(this)}),i("ez-button",{mode:"icon",iconName:"dual-chevron-down",enabled:this.enableMoveDown(!0),title:this.i18n("ez-double-list.moveToLastPosition"),size:"small",onClick:this.handleMoveToBottom.bind(this)})))}static get watchers(){return{leftList:["observeLeftList"],rightList:["observeRightList"]}}};c.style='.sc-ez-double-list-h{display:flex;flex-direction:row;gap:8px;align-items:center;font-family:var(--font-pattern, "Roboto");width:100%}@media screen and (max-width: 1366px){.group.sc-ez-double-list{height:350px}}.list__container.sc-ez-double-list{height:100%;width:100%;min-height:150px;overflow:auto;display:flex}.actions__column.sc-ez-double-list{display:flex;flex-direction:column;gap:4px}';export{c as ez_double_list}
|
|
1
|
+
import{r as t,c as e,h as i,H as s}from"./p-23a36bb6.js";import{ObjectUtils as o}from"@sankhyalabs/core";import{i as l}from"./p-80dfc50b.js";import{i as n}from"./p-c178730b.js";function h(t,e,i){if(!t.length)return[...e];if(!e.length)return[];const s=function(t,e){return t.map((t=>e.findIndex((e=>e.id===t))))}(t,e),o=0===(l=s).length?0:l.reduce(((t,e)=>e<t?e:t),l[0]);var l;const n=function(t){return 0===t.length?0:t.reduce(((t,e)=>e>t?e:t),t[0])}(s);return function(t,e,i,s){return t<0||e>=s.length||t>e?s:i?function(t,e,i){if(t===i.length-1)return i;const s=i.slice(0,e),o=i.slice(e,t+1),l=i.slice(t+1),n=l.shift();return n?[...s,n,...o,...l]:i}(e,t,s):function(t,e,i){if(0===t)return i;const s=i.slice(0,t-1),o=i.slice(t,e+1),l=i.slice(e+1);return[...s,...o,i[t-1],...l]}(t,e,s)}(o,n,i,e)}function r({from:t,to:e,selectedFrom:i,selectedTo:s}){return e=[...e.map((t=>d(t,!1))),...t.map((t=>d(t,!0)))],i=[],s=[...t.map((({id:t})=>t))],{from:t=[],to:e,selectedFrom:i,selectedTo:s}}function a({from:t,to:e,selectedFrom:i,selectedTo:s,insertIndex:o=e.length}){if(!t.length)return{from:t,to:e,selectedFrom:i,selectedTo:s};const l=function(t,e,i){const s=t.map((t=>t.id)),o=e.filter((t=>!s.includes(t)));return i.filter((({id:t})=>o.includes(t)))}(e,i,t);if(!l.length)return{from:t,to:e,selectedFrom:i,selectedTo:s};let n=e.map((t=>d(t,!1)));return n.splice(o,0,...l.map((t=>d(t,!0)))),{from:t.filter((t=>!i.includes(t.id))),to:n,selectedFrom:[],selectedTo:[...i]}}function d(t,e){return Object.assign(Object.assign({},t),{selected:e})}const c=class{constructor(i){t(this,i),this.ezLeftListChanged=e(this,"ezLeftListChanged",7),this.ezRightListChanged=e(this,"ezRightListChanged",7),this.LEFT_LIST_ID="LEFT-LIST-ID",this.RIGHT_LIST_ID="RIGHT-LIST-ID",this.leftList=[],this.leftTitle=void 0,this.rightList=[],this.entityLabel="item",this.entityLabelPlural="itens",this.leftListLabel="disponíveis",this.rightListLabel="selecionados",this.useOnlyRightList=!1,this.rightTitle=void 0,this.emptyMessage=void 0,this.slotsListBuilder=void 0,this.leftFilteredList=[],this.rightFilteredList=[],this.selectedLeftList=[],this.selectedRightList=[],this.isFilteringLeft=!1,this.isFilteringRight=!1}async resetSelectedLists(){this.selectedLeftList=[],this.selectedRightList=[]}observeLeftList(t,e){o.equals(t,e)||this.ezLeftListChanged.emit(t)}observeRightList(t,e){o.equals(t,e)||this.ezRightListChanged.emit(t)}async componentWillLoad(){this.i18n=await n()}async handleChangeLeft({detail:t}){t.to.getAttribute("id")&&t.to.getAttribute("id")===this.RIGHT_LIST_ID?(t.selectItens=t.selectItens.filter((t=>this.rightList.every((e=>e.id!==t)))),this.leftList=[...t.dataSource],this.selectedLeftList=[...t.selectItens],this.transferToRight(null==t?void 0:t.newIndex)):this.leftList=[...this.reorderArray(t.dataSource,t.selectItens,t.newIndex)]}async handleChangeRight({detail:t}){t.to.getAttribute("id")&&t.to.getAttribute("id")===this.LEFT_LIST_ID?(t.selectItens=t.selectItens.filter((t=>this.leftList.every((e=>e.id!==t)))),this.rightList=[...t.dataSource],this.selectedRightList=[...t.selectItens],this.transferToLeft(null==t?void 0:t.newIndex)):this.rightList=[...this.reorderArray(t.dataSource,t.selectItens,t.newIndex)]}reorderArray(t,e,i){const s=t.filter((t=>!e.includes(t.id))),o=t.filter((t=>e.includes(t.id)));return s.splice(i,0,...o),s}enableTransferAllToRight(){return this.leftList.length>0}enableTransferAllToLeft(){return this.rightList.length>0}enableTransferToRight(){return this.selectedLeftList.length>0}enableTransferToLeft(){return this.selectedRightList.length>0}enableMoveUp(t){if(this.isFilteringRight)return!1;const e=this.getRightSelectedItemsIndex();return this.selectedRightList.length>0&&!e.includes(0)&&(!!t||l(e))}enableMoveDown(t){if(this.isFilteringRight)return!1;const e=this.getRightSelectedItemsIndex();return this.selectedRightList.length>0&&!e.includes(this.rightList.length-1)&&(!!t||l(e))}getRightSelectedItemsIndex(){return this.selectedRightList.map((t=>this.rightList.findIndex((e=>e.id===t))))}transferToRight(t){const{from:e,to:i,selectedFrom:s,selectedTo:o}=a(Object.assign(Object.assign({},this.buildTransferToRightConfig()),{insertIndex:null!=t?t:0}));this.leftList=[],requestAnimationFrame((()=>this.leftList=[...e])),this.rightList=[...i],this.selectedLeftList=[...s],this.selectedRightList=[...o]}transferToLeft(t){const{from:e,to:i,selectedFrom:s,selectedTo:o}=a(Object.assign(Object.assign({},this.buildTransferToLeftConfig()),{insertIndex:null!=t?t:0}));this.rightList=[],requestAnimationFrame((()=>this.rightList=[...e])),this.leftList=[...i],this.selectedRightList=[...s],this.selectedLeftList=[...o]}async handleTransferAllToRight(){const{from:t,to:e,selectedFrom:i,selectedTo:s}=r(this.buildTransferToRightConfig());this.leftList=[...t],this.rightList=[...e],this.selectedLeftList=[...i],this.selectedRightList=[...s],requestAnimationFrame((async()=>{await this.clearSelectionAll()}))}async handleTransferAllToLeft(){const{from:t,to:e,selectedFrom:i,selectedTo:s}=r(this.buildTransferToLeftConfig());this.rightList=[...t],this.leftList=[...e],this.selectedRightList=[...i],this.selectedLeftList=[...s],requestAnimationFrame((async()=>{await this.clearSelectionAll()}))}buildTransferToRightConfig(){return{from:this.leftList,to:this.rightList,selectedFrom:this.selectedLeftList,selectedTo:this.selectedRightList}}buildTransferToLeftConfig(){return{from:this.rightList,to:this.leftList,selectedFrom:this.selectedRightList,selectedTo:this.selectedLeftList}}handleMoveUp(){this.rightList=[...h(this.selectedRightList,this.rightList,!1)]}handleMoveDown(){this.rightList=[...h(this.selectedRightList,this.rightList,!0)]}handleMoveToTop(){const{itemsToKeep:t,itemsToMove:e}=this.getItemsToKeepAndToMove();this.rightList=[...e,...t]}handleMoveToBottom(){const{itemsToKeep:t,itemsToMove:e}=this.getItemsToKeepAndToMove();this.rightList=[...t,...e]}handleSelectLeftItem({detail:t}){this.selectedLeftList=[...t.map((({id:t})=>t))]}handleSelectRightItem({detail:t}){this.selectedRightList=[...t.map((({id:t})=>t))]}getItemsToKeepAndToMove(){return{itemsToKeep:this.rightList.filter((t=>!this.selectedRightList.includes(t.id))),itemsToMove:this.rightList.filter((t=>this.selectedRightList.includes(t.id)))}}async handleTransferToRight(){this.transferToRight(),this.leftFilteredList=[],await this.leftEzListInstance.clearSelection()}async handleTransferToLeft(){this.transferToLeft(),this.rightFilteredList=[],await this.rightEzListInstance.clearSelection()}async clearSelectionAll(){await this.rightEzListInstance.clearSelection(),await this.leftEzListInstance.clearSelection()}handleChooseLeft(){requestAnimationFrame((async()=>{await this.rightEzListInstance.clearSelection()}))}handleChooseRight(){this.useOnlyRightList||requestAnimationFrame((async()=>{await this.leftEzListInstance.clearSelection()}))}renderList(t){const{idSortableList:e,list:s,isFiltering:o,filteredList:l,emptyMessage:n,slotConfig:h,callbacks:r,title:a}=t;return i("ez-sortable-list",{ref:null==r?void 0:r.setRef,title:a,idSortableList:e,emptyMessage:n,class:"ez-size-height--full",dataSource:o?l:s,hoverFeedback:!0,enableMultipleSelection:!0,removeItensMoved:!0,entityLabel:this.entityLabel,entityLabelPlural:this.entityLabelPlural,itemRightSlotBuilder:null==h?void 0:h.itemRightSlotBuilder,itemLeftSlotBuilder:null==h?void 0:h.itemLeftSlotBuilder,onItemsReordered:null==r?void 0:r.onChange.bind(this),onEzSelectItens:null==r?void 0:r.onSelect.bind(this),onEzDoubleClick:null==r?void 0:r.onDoubleClick.bind(this),onEzChoose:null==r?void 0:r.onChoose.bind(this)})}render(){var t,e,o,l,n,h,r,a,d,c;return i(s,null,!this.useOnlyRightList&&i("div",{class:"list__container"},this.leftList&&this.renderList({idSortableList:this.LEFT_LIST_ID,list:this.leftList,title:this.leftTitle,isFiltering:this.isFilteringLeft,filteredList:this.leftFilteredList,emptyMessage:(null===(t=this.emptyMessage)||void 0===t?void 0:t.LEFT_LIST)?this.emptyMessage.LEFT_LIST:this.i18n("ez-double-list.noItemsAvailable",{entity:this.entityLabel}),slotConfig:{itemRightSlotBuilder:null===(o=null===(e=this.slotsListBuilder)||void 0===e?void 0:e.LEFT_LIST)||void 0===o?void 0:o.itemRightSlotBuilder,itemLeftSlotBuilder:null===(n=null===(l=this.slotsListBuilder)||void 0===l?void 0:l.LEFT_LIST)||void 0===n?void 0:n.itemLeftSlotBuilder},callbacks:{setRef:t=>this.leftEzListInstance=t,onChange:t=>this.handleChangeLeft(t),onSelect:this.handleSelectLeftItem.bind(this),onDoubleClick:this.handleTransferToRight.bind(this),onChoose:this.handleChooseLeft.bind(this)}})),!this.useOnlyRightList&&i("div",{class:"actions__column"},i("ez-button",{mode:"icon",iconName:"dual-chevron-right",enabled:this.enableTransferAllToRight(),title:this.i18n("ez-double-list.moveAllTo",{list:this.rightListLabel}),size:"small",onClick:this.handleTransferAllToRight.bind(this)}),i("ez-button",{mode:"icon",iconName:"chevron-right",enabled:this.enableTransferToRight(),title:this.i18n("ez-double-list.moveTo",{list:this.rightListLabel}),size:"small",onClick:this.handleTransferToRight.bind(this)}),i("ez-button",{mode:"icon",iconName:"chevron-left",enabled:this.enableTransferToLeft(),title:this.i18n("ez-double-list.moveTo",{list:this.leftListLabel}),size:"small",onClick:this.handleTransferToLeft.bind(this)}),i("ez-button",{mode:"icon",iconName:"dual-chevron-left",enabled:this.enableTransferAllToLeft(),title:this.i18n("ez-double-list.moveAllTo",{list:this.leftListLabel}),size:"small",onClick:this.handleTransferAllToLeft.bind(this)})),i("div",{class:"list__container"},this.rightList&&this.renderList({idSortableList:this.RIGHT_LIST_ID,list:this.rightList,title:this.rightTitle,isFiltering:this.isFilteringRight,filteredList:this.rightFilteredList,emptyMessage:(null===(h=this.emptyMessage)||void 0===h?void 0:h.RIGHT_LIST)?this.emptyMessage.RIGHT_LIST:this.i18n("ez-double-list.noItemsSelected",{entity:this.entityLabel}),slotConfig:{itemRightSlotBuilder:null===(a=null===(r=this.slotsListBuilder)||void 0===r?void 0:r.RIGHT_LIST)||void 0===a?void 0:a.itemRightSlotBuilder,itemLeftSlotBuilder:null===(c=null===(d=this.slotsListBuilder)||void 0===d?void 0:d.RIGHT_LIST)||void 0===c?void 0:c.itemLeftSlotBuilder},callbacks:{setRef:t=>this.rightEzListInstance=t,onChange:t=>this.handleChangeRight(t),onSelect:this.handleSelectRightItem.bind(this),onDoubleClick:this.handleTransferToLeft.bind(this),onChoose:this.handleChooseRight.bind(this)}})),i("div",{class:"actions__column"},i("ez-button",{mode:"icon",iconName:"dual-chevron-up",enabled:this.enableMoveUp(!0),title:this.i18n("ez-double-list.moveToFirstPosition"),size:"small",onClick:this.handleMoveToTop.bind(this)}),i("ez-button",{mode:"icon",iconName:"chevron-up",enabled:this.enableMoveUp(),title:this.i18n("ez-double-list.moveUp"),size:"small",onClick:this.handleMoveUp.bind(this)}),i("ez-button",{mode:"icon",iconName:"chevron-down",enabled:this.enableMoveDown(),title:this.i18n("ez-double-list.moveDown"),size:"small",onClick:this.handleMoveDown.bind(this)}),i("ez-button",{mode:"icon",iconName:"dual-chevron-down",enabled:this.enableMoveDown(!0),title:this.i18n("ez-double-list.moveToLastPosition"),size:"small",onClick:this.handleMoveToBottom.bind(this)})))}static get watchers(){return{leftList:["observeLeftList"],rightList:["observeRightList"]}}};c.style='.sc-ez-double-list-h{display:flex;flex-direction:row;gap:8px;align-items:center;font-family:var(--font-pattern, "Roboto");width:100%}@media screen and (max-width: 1366px){.group.sc-ez-double-list{height:350px}}.list__container.sc-ez-double-list{height:100%;width:100%;min-height:150px;overflow:auto;display:flex}.actions__column.sc-ez-double-list{display:flex;flex-direction:column;gap:4px}';export{c as ez_double_list}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,h as i,H as o}from"./p-
|
|
1
|
+
import{r as t,h as i,H as o}from"./p-23a36bb6.js";const r=class{constructor(i){t(this,i),this._showLoading=!0}async hide(){this._showLoading=!1}async show(){this._showLoading=!0}render(){return i(o,null,this._showLoading&&i("div",{class:"loading-bar"},i("div",{class:"loading-bar__container"})))}};r.style=":host{position:fixed;top:0px;width:100%}.loading-bar{width:100%;margin:0 auto;position:absolute;background-color:var(--color--primary-300, #e2f4ef);height:5px}.loading-bar:before{content:'';position:absolute}.loading-bar__container{position:absolute;top:0;right:100%;bottom:0;left:0;background-color:var(--color--primary, #008561);width:0;animation:loading 2s linear infinite}@keyframes loading{0%{left:0%;right:100%;width:0%}25%{left:0%;right:75%;width:25%}50%{left:0%;right:50%;width:90%}70%{right:0%;left:75%;width:25%}100%{left:100%;right:0%;width:0%}}@-webkit-keyframes loading{0%{left:0%;right:100%;width:0%}25%{left:0%;right:75%;width:25%}50%{left:0%;right:50%;width:90%}70%{right:0%;left:75%;width:25%}100%{left:100%;right:0%;width:0%}}";export{r as ez_loading_bar}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as i,h as s,H as e,g as a}from"./p-
|
|
1
|
+
import{r as t,c as i,h as s,H as e,g as a}from"./p-23a36bb6.js";import{ElementIDUtils as o,StringUtils as r}from"@sankhyalabs/core";const n=class{constructor(s){t(this,s),this.ezChange=i(this,"ezChange",7),this.setFocusedParam=t=>{if("Enter"===t.key){const i=this._processedTabs[this._focusedIndex];this.handleTabClick(i),t.preventDefault(),this.setFocusedTab(i.index)}else if("ArrowLeft"===t.key||"ArrowRight"===t.key){let i;if("ArrowLeft"===t.key)i=!1;else{if("ArrowRight"!==t.key)return;i=!0}this._focusedIndex=void 0===this._focusedIndex?!1===i?void 0!==this.selectedIndex?this.selectedIndex-1:void 0:void 0!==this.selectedIndex?this.selectedIndex+1:void 0:!1===i?this._focusedIndex-1:this._focusedIndex+1,this._focusedIndex<0?this._focusedIndex=0:this._focusedIndex>this._processedTabs.length-1&&(this._focusedIndex=this._processedTabs.length-1),this.setFocusedBtn(!0,this._focusedIndex),this.setFocusedTab(this._focusedIndex)}else if("Tab"===t.key||"Escape"===t.key){const i=this._processedTabs[this.selectedIndex];this._focusedIndex=void 0,this.handleTabClick(i),t.preventDefault(),this.setFocusedTab(this.selectedIndex)}},this._processedTabs=void 0,this.selectedIndex=void 0,this.selectedTab=void 0,this.tabs=void 0}observeTabs(t,i){t&&"string"!=typeof t?this._processedTabs=t:t!==i&&this.processesTabs()}async goToTab(t,i=!1){const s=this._processedTabs.find((i=>i.index===t));this.handleTabClick(s,!i)}handleTabClick(t,i=!0){this.selectedIndex=t.index,this._focusedIndex=void 0,this.selectedTab=t.tabKey,i&&this.ezChange.emit(t),this.setFocusedBtn(!1,t.index)}componentWillLoad(){this.processesTabs()}processesTabs(){this.tabs&&(Array.isArray(this.tabs)?this._processedTabs=[...this.tabs]:(this._processedTabs=[],this.tabs.split(",").forEach((t=>{t=t.trim(),this._processedTabs.push({label:t,tabKey:t,index:this._processedTabs.length}),this.buildElementIdTab(this._processedTabs)})))),this._hostElem.querySelectorAll("ez-tab").forEach((t=>{const i=t.getAttribute("tabKey"),s={label:t.getAttribute("label"),tabKey:i,leftIcon:t.getAttribute("leftIcon"),rightIcon:t.getAttribute("rightIcon"),index:this._processedTabs.length},e=t.firstChild;e&&(e.setAttribute("slot","tab"+s.index),this._hostElem.appendChild(e)),this._processedTabs.push(s),this.buildElementIdTab(this._processedTabs)}))}componentDidRender(){this.updateScroll()}componentDidLoad(){o.addIDInfo(this._hostElem,"itemsSelector"),this._hostElem.shadowRoot.querySelectorAll('button[name="tab-button"]').forEach((t=>{var i;const s=null===(i=t.querySelector("span.tab-label"))||void 0===i?void 0:i.innerText,e={id:`${r.toCamelCase(s)}`};o.addIDInfo(t,"itemSelector",e)}))}handleSlotChange(t){const i=t.target.assignedElements()[0];i&&(i.style.marginLeft="6px")}scrollBackward(){const t=this._scrollContainer;t&&(t.scrollLeft-=t.clientWidth)}scrollFoward(){const t=this._scrollContainer;if(t){let i=null;t.querySelectorAll(".tab").forEach((s=>{s.getBoundingClientRect().right<t.clientWidth&&(i=s)})),t.scrollLeft=i.offsetLeft+i.offsetWidth}}updateScroll(){const t=this._scrollContainer;if(t){const{scrollWidth:i,clientWidth:s,scrollLeft:e}=t,a=i-s-Math.ceil(e);this._startHidden=t.scrollLeft>0,this._endHidden=a>0,this._startHidden?this._backwardButton.classList.remove("hidden"):this._backwardButton.classList.add("hidden"),this._endHidden?this._forwardButton.classList.remove("hidden"):this._forwardButton.classList.add("hidden");const o=["","startHidden","endHidden","middle"],r=o[Number(this._startHidden)|Number(this._endHidden)<<1];o.forEach((i=>{i!==r&&t.classList.contains(i)&&t.classList.remove(i)})),r&&!t.classList.contains(r)&&t.classList.add(r)}}domScrollHandler(){window.clearTimeout(this._scrollCallBack),this._scrollCallBack=window.setTimeout((()=>{this.updateScroll()}),200)}setFocusedTab(t){window.clearTimeout(this._scrollCallBackTest),this._scrollCallBackTest=window.setTimeout((()=>{this._scrollContainer.querySelector(`#tab${t}`).scrollIntoView()}),200)}setFocusedBtn(t,i){this._scrollContainer.querySelectorAll(".tab").forEach((s=>{s.classList.remove("is-focused"),s.id==="tab"+i&&t&&s.classList.add("is-focused")}))}buildElementIdTab(t){t.forEach((t=>{if(!t.hasOwnProperty(o.DATA_ELEMENT_ID_ATTRIBUTE_NAME)){const i=`${this._hostElem.getAttribute(o.DATA_ELEMENT_ID_ATTRIBUTE_NAME)}_${r.toCamelCase(t.tabKey)}`;t[o.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=i}}))}render(){return s(e,null,s("button",{class:"backward-button",ref:t=>this._backwardButton=t,onClick:()=>this.scrollBackward()}),s("div",{class:"scroll",ref:t=>this._scrollContainer=t,onScroll:()=>this.domScrollHandler(),onKeyDown:t=>this.setFocusedParam(t)},this._processedTabs.map(((t,i)=>{const e="tab"+i,a=i===this.selectedIndex||this.selectedTab&&t.tabKey===this.selectedTab;return a&&(this.selectedTab=t.tabKey,this.selectedIndex=i),s("button",{id:e,name:"tab-button",class:"tab"+(a?" is-active":""),onClick:()=>this.handleTabClick(t)},t.leftIcon&&s("ez-icon",{iconName:t.leftIcon,class:"left-icon"}),s("span",{class:"tab-label",title:t.label},t.label),t.rightIcon&&s("ez-icon",{iconName:t.rightIcon,class:"right-icon"}),s("slot",{name:e,onSlotchange:t=>{this.handleSlotChange(t)}}))}))),s("button",{class:"forward-button",ref:t=>this._forwardButton=t,onClick:()=>this.scrollFoward()}))}get _hostElem(){return a(this)}static get watchers(){return{tabs:["observeTabs"]}}};n.style='@keyframes activate{0%{clip-path:inset(calc(100% - 3px) 50% 0px 50%)}100%{clip-path:inset(calc(100% - 3px) 0px 0px 0px)}}:host{display:flex;position:relative;width:100%;overflow:hidden;--tabselector--backward-icon: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>\');--tabselector--forward-icon: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>\')}.scroll{display:flex;width:100%;scroll-behavior:smooth;overflow-x:auto;scrollbar-width:none}.scroll.startHidden{-webkit-mask-image:linear-gradient(90deg, transparent 20px, #000 48px)}.scroll.middle{-webkit-mask-image:linear-gradient(90deg, transparent 20px, #000 48px, #000 calc(100% - 48px), transparent calc(100% - 20px))}.scroll.endHidden{-webkit-mask-image:linear-gradient(90deg, #000 calc(100% - 48px), transparent calc(100% - 20px))}.tab{display:flex;border:none;background-color:unset;min-width:100px;max-width:260px;cursor:pointer;padding:6px 12px;align-items:center;justify-content:center;color:var(--text--primary, #626e82);font-family:var(--font-pattern, "Roboto");font-size:var(--title--small, 14px);flex-shrink:0;margin-bottom:var(--space--extra-small, 3px)}.tab:focus,.forward-button,.backward-button{outline:none}.is-active{position:relative;color:var(--color--primary, #008561)}.is-active ez-icon{--ez-icon--color:var(--color--primary, #008561)}.is-active::after{content:"";position:absolute;width:100%;height:100%;background-color:var(--color--primary, #008561);clip-path:inset(calc(100% - 3px) 0px 0px 0px);animation:activate 0.25s ease-in-out}.is-focused{border:1px dashed var(--color--primary, #000000c5)}.tab-label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-shadow:var(--text-shadow)}.forward-button,.backward-button{position:absolute;z-index:1;display:flex;box-sizing:border-box;padding:0px;top:0px;right:0px;width:16px;height:100%;border:none;background-color:unset;cursor:pointer;justify-content:center;align-items:center}.backward-button{left:0px}.forward-button::after,.backward-button::after{content:\'\';display:flex;background-color:var(--text--primary, #008561);width:10px;height:16px}.forward-button::after{-webkit-mask-image:var(--tabselector--forward-icon);mask-image:var(--tabselector--forward-icon)}.backward-button::after{-webkit-mask-image:var(--tabselector--backward-icon);mask-image:var(--tabselector--backward-icon)}.forward-button:hover::after,.backward-button:hover::after{background-color:var(--color--primary, #4e4e4e)}.hidden{display:none}.scroll::-webkit-scrollbar{display:none}.left-icon{padding-right:var(--space--small)}.right-icon{padding-left:var(--space--small)}';export{n as ez_tabselector}
|