@sankhyalabs/ezui 7.1.0-dev.10 → 7.1.0-dev.11
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/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 +1 -1
- package/dist/cjs/ez-classic-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-classic-text-area.cjs.entry.js +1 -1
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -1
- package/dist/cjs/ez-combo-box-list_4.cjs.entry.js +2 -2
- 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 +1 -1
- 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 +16 -8
- 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 +1 -1
- 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 +1 -1
- 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-a7b0c73d.js → index-9e5554cb.js} +3 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{search-column-8bfee733.js → search-column-540f3925.js} +1 -1
- package/dist/collection/components/ez-modal-container/ez-modal-container.css +1 -0
- package/dist/collection/components/ez-modal-container/ez-modal-container.js +32 -6
- package/dist/custom-elements/index.js +16 -8
- 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 +1 -1
- package/dist/esm/ez-classic-input.entry.js +1 -1
- package/dist/esm/ez-classic-text-area.entry.js +1 -1
- package/dist/esm/ez-collapsible-box.entry.js +1 -1
- package/dist/esm/ez-combo-box-list_4.entry.js +2 -2
- 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 +1 -1
- 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 +16 -8
- 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 +1 -1
- 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 +1 -1
- 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-baa5e267.js → index-5a720e56.js} +3 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{search-column-c00119ae.js → search-column-4e827a95.js} +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-e75c7a23.entry.js → p-000159dc.entry.js} +1 -1
- package/dist/ezui/{p-7f8c1fce.entry.js → p-0391f255.entry.js} +1 -1
- package/dist/ezui/{p-93e1c917.entry.js → p-05e68ab3.entry.js} +1 -1
- package/dist/ezui/{p-1730ee24.entry.js → p-06ca9d9a.entry.js} +1 -1
- package/dist/ezui/{p-288631d1.entry.js → p-06f1b8e4.entry.js} +1 -1
- package/dist/ezui/{p-6d596a5a.entry.js → p-0b531233.entry.js} +1 -1
- package/dist/ezui/{p-5ab08b60.entry.js → p-129fea99.entry.js} +1 -1
- package/dist/ezui/{p-1bfef8e5.entry.js → p-13949839.entry.js} +1 -1
- package/dist/ezui/p-14d6aeb8.entry.js +1 -0
- package/dist/ezui/{p-2528e988.entry.js → p-169d460d.entry.js} +1 -1
- package/dist/ezui/{p-6f77a359.entry.js → p-1723f728.entry.js} +1 -1
- package/dist/ezui/{p-0c0eb410.entry.js → p-1d846a77.entry.js} +1 -1
- package/dist/ezui/{p-8bb3aeb0.entry.js → p-1d8ea7d2.entry.js} +1 -1
- package/dist/ezui/{p-ff4bde07.entry.js → p-231cf227.entry.js} +1 -1
- package/dist/ezui/{p-1266fe78.entry.js → p-26077a43.entry.js} +1 -1
- package/dist/ezui/{p-3fe05d6b.entry.js → p-2d803ee6.entry.js} +1 -1
- package/dist/ezui/{p-6f119d5f.entry.js → p-30513f10.entry.js} +1 -1
- package/dist/ezui/{p-2a70f094.entry.js → p-3136f418.entry.js} +1 -1
- package/dist/ezui/{p-ef8bd3e8.entry.js → p-35e3715c.entry.js} +1 -1
- package/dist/ezui/{p-1adf7139.entry.js → p-3b5bafe4.entry.js} +1 -1
- package/dist/ezui/p-3be7d8d8.entry.js +1 -0
- package/dist/ezui/{p-4f0632b4.js → p-4296e9f9.js} +1 -1
- package/dist/ezui/{p-a7eab406.entry.js → p-43106b79.entry.js} +1 -1
- package/dist/ezui/{p-fa6732f2.entry.js → p-44b39e81.entry.js} +1 -1
- package/dist/ezui/{p-e46a4d06.entry.js → p-4815ddbf.entry.js} +1 -1
- package/dist/ezui/{p-d0e6911e.entry.js → p-4a530109.entry.js} +1 -1
- package/dist/ezui/{p-4d30b703.entry.js → p-4a876b8b.entry.js} +1 -1
- package/dist/ezui/{p-1cde96f9.entry.js → p-4cc79a52.entry.js} +1 -1
- package/dist/ezui/{p-e882635e.entry.js → p-4dc07e01.entry.js} +1 -1
- package/dist/ezui/{p-6369a0cd.entry.js → p-51e34317.entry.js} +1 -1
- package/dist/ezui/{p-eee3c7ff.entry.js → p-53412766.entry.js} +1 -1
- package/dist/ezui/{p-8dc267ff.entry.js → p-53e773a4.entry.js} +1 -1
- package/dist/ezui/{p-48effc69.entry.js → p-570cf58a.entry.js} +1 -1
- package/dist/ezui/p-580f5fb8.entry.js +1 -0
- package/dist/ezui/{p-0b333f09.entry.js → p-5d1adf13.entry.js} +1 -1
- package/dist/ezui/{p-dee18824.entry.js → p-5f4a66ec.entry.js} +1 -1
- package/dist/ezui/{p-1f50fa05.entry.js → p-6b51c9cc.entry.js} +1 -1
- package/dist/ezui/p-6ec40dec.entry.js +1 -0
- package/dist/ezui/{p-5ed81457.entry.js → p-6fc26622.entry.js} +1 -1
- package/dist/ezui/{p-e27d7dc2.entry.js → p-74f08ec9.entry.js} +1 -1
- package/dist/ezui/{p-d6f50207.entry.js → p-770cf2b8.entry.js} +1 -1
- package/dist/ezui/{p-124699e0.entry.js → p-77e738d5.entry.js} +1 -1
- package/dist/ezui/{p-91c9d50e.entry.js → p-78e975b4.entry.js} +1 -1
- package/dist/ezui/{p-59a98e31.entry.js → p-78f18973.entry.js} +1 -1
- package/dist/ezui/{p-957d08cd.entry.js → p-7fdf1f2b.entry.js} +1 -1
- package/dist/ezui/{p-1e7a8633.entry.js → p-81461d2f.entry.js} +1 -1
- package/dist/ezui/{p-8df1ca33.entry.js → p-82fa4b09.entry.js} +1 -1
- package/dist/ezui/{p-59092a66.entry.js → p-8aa7d60b.entry.js} +1 -1
- package/dist/ezui/{p-a3075f52.entry.js → p-9bcfa689.entry.js} +1 -1
- package/dist/ezui/{p-ba7e908a.entry.js → p-a48979a8.entry.js} +1 -1
- package/dist/ezui/{p-e8c6c973.entry.js → p-a859ea2e.entry.js} +1 -1
- package/dist/ezui/{p-d6742c1e.entry.js → p-a9432878.entry.js} +1 -1
- package/dist/ezui/{p-e8c57463.entry.js → p-b21efe83.entry.js} +1 -1
- package/dist/ezui/{p-6a9a20a0.entry.js → p-b3530711.entry.js} +1 -1
- package/dist/ezui/{p-4e1df756.entry.js → p-b5b33be8.entry.js} +1 -1
- package/dist/ezui/{p-2ba2d792.entry.js → p-b77a0ce4.entry.js} +1 -1
- package/dist/ezui/{p-7fe97ef5.entry.js → p-b7c6ce20.entry.js} +1 -1
- package/dist/ezui/{p-c82acfc6.entry.js → p-b81d19c7.entry.js} +1 -1
- package/dist/ezui/{p-294f54fe.entry.js → p-bb7cf512.entry.js} +1 -1
- package/dist/ezui/{p-a0bf1fc7.entry.js → p-bc693db6.entry.js} +1 -1
- package/dist/ezui/{p-9f5fa3f9.entry.js → p-c2b20f78.entry.js} +1 -1
- package/dist/ezui/{p-a401041c.entry.js → p-c73964f8.entry.js} +1 -1
- package/dist/ezui/{p-6020f3d5.entry.js → p-c754774e.entry.js} +1 -1
- package/dist/ezui/{p-d2645bdf.entry.js → p-c96e536d.entry.js} +1 -1
- package/dist/ezui/{p-8c57ffa4.entry.js → p-cb4f1ee9.entry.js} +1 -1
- package/dist/ezui/{p-20c024f7.entry.js → p-cf33bc48.entry.js} +1 -1
- package/dist/ezui/{p-0e49c0ff.entry.js → p-cf4e2a35.entry.js} +1 -1
- package/dist/ezui/{p-ae5f64cd.entry.js → p-cff2434d.entry.js} +1 -1
- package/dist/ezui/{p-9b2e6438.entry.js → p-d3779449.entry.js} +1 -1
- package/dist/ezui/{p-a80b1287.entry.js → p-dfca5946.entry.js} +1 -1
- package/dist/ezui/{p-7f792043.entry.js → p-e195eaad.entry.js} +1 -1
- package/dist/ezui/{p-79277e43.entry.js → p-e2eb894a.entry.js} +1 -1
- package/dist/ezui/{p-23a36bb6.js → p-e4c7eb39.js} +2 -2
- package/dist/ezui/{p-e7a7c594.entry.js → p-e9b409c1.entry.js} +1 -1
- package/dist/ezui/{p-e99cbb51.entry.js → p-f17e7182.entry.js} +1 -1
- package/dist/ezui/{p-a3ada561.entry.js → p-f26b97e9.entry.js} +1 -1
- package/dist/ezui/{p-411c0222.entry.js → p-f7ca8634.entry.js} +1 -1
- package/dist/types/components/ez-modal-container/ez-modal-container.d.ts +6 -0
- package/dist/types/components.d.ts +8 -0
- package/package.json +1 -1
- package/dist/ezui/p-bc2f844e.entry.js +0 -1
- package/dist/ezui/p-d8cc640d.entry.js +0 -1
- package/dist/ezui/p-e03b2f19.entry.js +0 -1
- package/dist/ezui/p-e77610ef.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,c as e,f as r,h as t,g as l}from"./p-23a36bb6.js";import{FloatingManager as i}from"@sankhyalabs/core";import{i as s}from"./p-641ee538.js";const n=class{constructor(r){a(this,r),this.ezChange=e(this,"ezChange",7),this._firstRender=!0,this._hoursLabel=["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23"],this._minutosLabel=["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59"],this.value=new Date,this.floating=!1,this.time=!1,this.showSeconds=!1}async show(a,e,r,t){this.floating&&(this._floatingID=i.float(this._box,this._container,{isFixed:this.isFixed(),autoClose:!0,top:a,left:e,bottom:r,right:t}),this.isFixed()||(window.requestAnimationFrame((()=>{this._box.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})})),this.scroll()))}async fitVertical(a,e){const r=this._container.getBoundingClientRect().bottom+this._calendarHeight;(window.innerHeight||document.documentElement.clientHeight)>r?this.show(a+"px",void 0,"unset"):this.show("unset",void 0,e+"px")}async fitHorizontal(a){const e=this._container.getBoundingClientRect().right+this._calendarWidth;(window.innerWidth||document.documentElement.clientWidth)>e||this.show(void 0,"unset",void 0,a+"px")}async hide(){void 0!==this._floatingID&&(i.close(this._floatingID),this._floatingID=void 0)}observeValue(){this.value&&(this._currentPosition.setTime(this.value.getTime()),this._currentPosition.setDate(1))}scrollListener(){this.floating&&this.isFixed()&&this.hide()}isFixed(){return"true"===this._hostElem.dataset.isFixed}getMonthLabel(){return this.i18n(`ez-calendar.month.${this._currentPosition.getMonth()}`)+" "+this._currentPosition.getFullYear()}isSelectedDate(a){return!!this.value&&this.value.getDate()==a.getDate()&&this.value.getMonth()==a.getMonth()&&this.value.getFullYear()==a.getFullYear()}changeMonth(a){this._currentPosition.setMonth(this._currentPosition.getMonth()+a),r(this)}selectDate(a){let e=a;this.value&&(this.time||this.showSeconds)&&(e.setHours(this.value.getHours()),e.setMinutes(this.value.getMinutes()),e.setSeconds(this.showSeconds?this.value.getSeconds():0)),this.value=e,this.ezChange.emit(this.value)}selectHours(a){this.value||(this.value=new Date),this.value=new Date(this.value.getFullYear(),this.value.getMonth(),this.value.getDate(),a,this.value.getMinutes(),this.value.getSeconds()),this.ezChange.emit(this.value)}selectMinutes(a){this.value||(this.value=new Date),this.value=new Date(this.value.getFullYear(),this.value.getMonth(),this.value.getDate(),this.value.getHours(),a,this.value.getSeconds()),this.ezChange.emit(this.value)}selectSeconds(a){this.value||(this.value=new Date),this.value=new Date(this.value.getFullYear(),this.value.getMonth(),this.value.getDate(),this.value.getHours(),this.value.getMinutes(),a),this.ezChange.emit(this.value)}updateScroll(a){if(a){const{scrollHeight:e,clientHeight:r,scrollTop:t}=a;e-r-Math.ceil(t)>0?a.classList.add("endHidden"):a.classList.remove("endHidden")}}async componentWillLoad(){this.i18n=await s()}componentDidRender(){this.floating&&this._firstRender&&(this._calendarHeight=this._box.clientHeight,this._calendarWidth=this._box.clientWidth,this._box.remove(),this._firstRender=!1),this.updateScroll(this._hoursScroll),this.updateScroll(this._minutesScroll),this.updateScroll(this._secondsScroll)}componentDidLoad(){this.scroll()}scroll(){(this.time||this.showSeconds)&&(this._hoursScroll.scrollTop=this._hoursSelect.offsetTop-64,this._minutesScroll.scrollTop=this._minutesSelect.offsetTop-64,this.updateScroll(this._hoursScroll),this.updateScroll(this._minutesScroll),this.showSeconds&&(this._secondsScroll.scrollTop=this._secondsSelect.offsetTop-64,this.updateScroll(this._secondsScroll)))}render(){null==this._currentPosition&&(this._currentPosition=new Date,this.value&&this._currentPosition.setTime(this.value.getTime()),this._currentPosition.setDate(1));const a=new Date;return a.setTime(this._currentPosition.getTime()),a.setDate(1-a.getDay()),t("section",{ref:a=>this._container=a},t("div",{ref:a=>this._box=a,class:"calendar__container"},t("div",{class:"calendar"},t("div",{class:"calendar__header"},t("button",{class:"calendar__btn-previous",onClick:()=>this.changeMonth(-1)}),t("label",{class:"calendar__lbl-month"},this.getMonthLabel()),t("button",{class:"calendar__btn-next",onClick:()=>this.changeMonth(1)})),t("div",{class:"calendar__body"},t("div",{class:"calendar__line"},[...Array(7).keys()].map((a=>t("div",{"data-day":this.i18n(`ez-calendar.weekDay.${a}`),class:"calendar__cell calendar__cell--unselectable"},this.i18n(`ez-calendar.weekDay.${a}`))))),[0,7,14,21,28,35].map((e=>t("div",{class:"calendar__line"},[0,1,2,3,4,5,6].map((r=>{const l=new Date;l.setTime(a.getTime()),l.setDate(l.getDate()+e+r);let i=`${l.getMonth()+1}-${l.getDate()}-${l.getFullYear()}`,s="calendar__cell";return this._currentPosition.getMonth()!=l.getMonth()?s+=" calendar__cell--secondary":this.isSelectedDate(l)&&(s+=" calendar__cell--selected"),t("div",{"data-day-month":i,class:s,onClick:()=>this.selectDate(l)},l.getDate())})))))),t("div",{class:"calendar__footer"},t("button",{class:"calendar__btn-today",onClick:()=>this.selectDate(new Date)},this.i18n("ez-calendar.today")))),(this.time||this.showSeconds)&&t("div",{class:"calendar-time"},t("div",{class:"calendar-time__header"},t("div",null,"H"),t("div",{class:"separatorTime"},":"),t("div",null,"M"),this.showSeconds&&t("div",{class:"separatorTime"},":"),this.showSeconds&&t("div",null,"S")),t("div",{class:"calendar__body ",style:{display:"flex",paddingLeft:"12px",paddingRight:"12px"}},t("div",{class:"calendar__column",ref:a=>this._hoursScroll=a,onScroll:()=>this.updateScroll(this._hoursScroll)},this._hoursLabel.map(((a,e)=>e===this.value.getHours()?t("div",{style:{display:"flex"},ref:a=>this._hoursSelect=a},t("div",{"data-hour":a,class:"calendar__cell calendar__cell--selected",onClick:()=>this.selectHours(e)},a),t("div",{class:"separatorTime"},":")):t("div",{style:{display:"flex"}},t("div",{"data-hour":a,class:"calendar__cell",onClick:()=>this.selectHours(e)},a),t("div",{class:"separatorTime"},":"))))),t("div",{class:"calendar__column",ref:a=>this._minutesScroll=a,onScroll:()=>this.updateScroll(this._minutesScroll)},this._minutosLabel.map(((a,e)=>e===this.value.getMinutes()?t("div",{style:{display:"flex"},ref:a=>this._minutesSelect=a},t("div",{"data-minute":a,class:"calendar__cell calendar__cell--selected",onClick:()=>this.selectMinutes(e)},a),this.showSeconds&&t("div",{class:"separatorTime"},":")):t("div",{style:{display:"flex"}},t("div",{"data-minute":a,class:"calendar__cell",onClick:()=>this.selectMinutes(e)},a),this.showSeconds&&t("div",{class:"separatorTime"},":"))))),this.showSeconds&&t("div",{class:"calendar__column",ref:a=>this._secondsScroll=a,onScroll:()=>this.updateScroll(this._secondsScroll)},this._minutosLabel.map(((a,e)=>e===this.value.getSeconds()?t("div",{"data-second":a,class:"calendar__cell calendar__cell--selected",onClick:()=>this.selectSeconds(e),ref:a=>this._secondsSelect=a},a):t("div",{"data-second":a,class:"calendar__cell",onClick:()=>this.selectSeconds(e)},a))))))))}get _hostElem(){return l(this)}static get watchers(){return{value:["observeValue"]}}};n.style=':host{--ez-calendar--font-family:var(--font-pattern, Arial);--ez-calendar--color:var(--title--primary, #626e82);--ez-calendar--text-shadow:var(--text-shadow, 0 0 0 #353535, 0 0 1px transparent);--ez-calendar__body--background-color:var(--background--xlight, #FFF);--ez-calendar__time--background-color:var(--background--xlight, #FAFAFA);--ez-calendar__body--padding:var(--space--medium, 12px) var(--space--small, 6px);--ez-calendar__body--border-radius:var(--border--radius-medium, 12px);--ez-calendar__body--shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-container--z-index:var(--more-visible, 2);--ez-calendar__header-line--stroke:1px;--ez-calendar__header-line--color:var(--color--strokes, #C0C0C0);--ez-calendar__nav-btn--fill:var(--text--primary, #008561);--ez-calendar__nav-btn--hover--fill:var(--color--primary, #350404);--ez-calendar__nav-btn--width:10px;--ez-calendar__nav-btn--height:16px;--ez-calendar__nav-btn--previous-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="10px"><path d="M 9.7808475,13.860393 3.9204526,8.0000004 9.7808475,2.0624965 7.9301965,0.28895552 0.21915255,8.0000004 7.9301965,15.711044 Z"/></svg>\');--ez-calendar__nav-btn--next-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="10px"><path d="M 0.21915251,13.860393 6.0795475,8.0000007 0.21915251,2.0624968 2.0698036,0.28895588 9.7808475,8.0000007 2.0698036,15.711044 Z"/></svg>\');--ez-calendar__cell--margin:0px 1.5px;--ez-calendar__cell--width:var(--space--large, 24px);--ez-calendar__cell--padding:1.5px 0px;--ez-calendar__cell--border-radius:var(--border--radius-small, 6px);--ez-calendar__cell--over--background-color:var(--color--primary, #E2F4EF);--ez-calendar__cell--over--color:var(--color--primary-300, #008561);--ez-calendar__cell--outset--color:var(--color--disable-primary, #E5EAF0);--ez-calendar__cell--selected--background-color:var(--color--primary, #008561);--ez-calendar__cell--selected--color:var(--color--inverted, #FFF);--ez-calendar__btn-today--color:var(--color--primary);--ez-calendar__btn-today--hover--background-color:var(--color--primary-300, #E2F4EF);--ez-calendar__btn-today--border-radius:var(--border--radius-small, 6px);position:relative;display:flex;user-select:none}.calendar__container{display:flex;z-index:var(--more-visible, 2)}.calendar{display:flex;flex-direction:column;z-index:var(--more-visible, 2);background-color:var(--ez-calendar__body--background-color);padding:var(--ez-calendar__body--padding);border-radius:var(--ez-calendar__body--border-radius);box-shadow:var(--ez-calendar__body--shadow)}.calendar__header{display:flex;justify-content:space-between;padding-bottom:var(--space--small, 6px);margin:0px var(--space--, 12px) var(--space--small, 6px) var(--space--, 12px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);border-bottom:solid var(--ez-calendar__header-line--stroke) var(--ez-calendar__header-line--color)}.calendar__btn-next,.calendar__btn-previous{outline:none;border:none;background-color:unset;cursor:pointer;padding:0px}.calendar__btn-next::after,.calendar__btn-previous::after{content:\'\';display:flex;background-color:var(--ez-calendar__nav-btn--fill);width:var(--ez-calendar__nav-btn--width);height:var(--ez-calendar__nav-btn--height)}.calendar__btn-previous::after{-webkit-mask-image:var(--ez-calendar__nav-btn--previous-image);mask-image:var(--ez-calendar__nav-btn--previous-image)}.calendar__btn-next::after{-webkit-mask-image:var(--ez-calendar__nav-btn--next-image);mask-image:var(--ez-calendar__nav-btn--next-image)}.calendar__btn-next:hover::after,.calendar__btn-previous:hover::after{background-color:var(--ez-calendar__nav-btn--hover--fill)}.calendar__lbl-month{font-weight:var(--text-weight--extra-large, 700);font-size:var(--title--small, 14px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.calendar__line{display:flex;padding:0px;margin:0px}.calendar__cell{display:flex;justify-content:center;align-content:center;cursor:pointer;font-size:var(--text--extra-small, 10px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);padding:var(--ez-calendar__cell--padding);margin:var(--ez-calendar__cell--margin);min-width:var(--ez-calendar__cell--width);border-radius:var(--ez-calendar__cell--border-radius)}.calendar__cell:hover{background-color:var(--ez-calendar__cell--over--background-color);color:var(--ez-calendar__cell--over--color)}.calendar__cell--secondary{color:var(--ez-calendar__cell--outset--color)}.calendar__cell--unselectable:hover{background-color:unset;border-radius:unset;cursor:unset;color:var(--ez-calendar--color)}.calendar__cell--unselectable{font-weight:var(--text-weight--large, 600);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.calendar__cell--selected,.calendar__cell--selected:hover{background-color:var(--ez-calendar__cell--selected--background-color);color:var(--ez-calendar__cell--selected--color)}.calendar__footer{display:flex;flex-direction:column}.calendar__btn-today{border:none;background-color:unset;cursor:pointer;padding:0px;font-weight:var(--text-weight--large, 600);font-size:var(--title--extra-small, 12px);font-family:var(--ez-calendar--font-family);text-shadow:var(--ez-calendar--text-shadow);color:var(--ez-calendar__btn-today--color);border-radius:var(--ez-calendar__btn-today--border-radius)}.calendar__btn-today:hover{background-color:var(--ez-calendar__btn-today--hover--background-color)}section{display:flex}.calendar-time{margin-left:-10px;display:flex;flex-direction:column;padding:12px 0px 0px 10px;background-color:var(--ez-calendar__time--background-color);border-top-right-radius:var(--ez-calendar__body--border-radius);border-bottom-right-radius:var(--ez-calendar__body--border-radius);box-shadow:var(--ez-calendar__body--shadow)}.calendar__column{height:136px;padding:0px;margin:0px;overflow:auto;scrollbar-width:none}.calendar__column::-webkit-scrollbar{width:0px;max-width:0px;min-width:0px}.calendar-time__header{display:flex;justify-content:space-between;padding-left:var(--space--small, 6px);padding-right:var(--space--small, 6px);padding-bottom:var(--space--small, 6px);margin:0px var(--space--, 12px) var(--space--small, 6px) var(--space--, 12px);font-weight:var(--text-weight--extra-large, 700);font-size:var(--title--small, 14px);text-shadow:var(--ez-calendar--text-shadow);border-bottom:solid var(--ez-calendar__header-line--stroke) var(--ez-calendar__header-line--color);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.separatorTime{color:#A2ABB9;padding:0px 1px;line-height:16px;font-size:17px;font-weight:normal}.endHidden{-webkit-mask-image:linear-gradient(180deg, #000 calc(100% - 48px), transparent 100%)}.calendar__column .calendar__cell{margin:0px;padding:1.5px 1.5px}';export{n as ez_calendar}
|
|
1
|
+
import{r as a,c as e,f as r,h as t,g as l}from"./p-e4c7eb39.js";import{FloatingManager as i}from"@sankhyalabs/core";import{i as s}from"./p-641ee538.js";const n=class{constructor(r){a(this,r),this.ezChange=e(this,"ezChange",7),this._firstRender=!0,this._hoursLabel=["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23"],this._minutosLabel=["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59"],this.value=new Date,this.floating=!1,this.time=!1,this.showSeconds=!1}async show(a,e,r,t){this.floating&&(this._floatingID=i.float(this._box,this._container,{isFixed:this.isFixed(),autoClose:!0,top:a,left:e,bottom:r,right:t}),this.isFixed()||(window.requestAnimationFrame((()=>{this._box.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})})),this.scroll()))}async fitVertical(a,e){const r=this._container.getBoundingClientRect().bottom+this._calendarHeight;(window.innerHeight||document.documentElement.clientHeight)>r?this.show(a+"px",void 0,"unset"):this.show("unset",void 0,e+"px")}async fitHorizontal(a){const e=this._container.getBoundingClientRect().right+this._calendarWidth;(window.innerWidth||document.documentElement.clientWidth)>e||this.show(void 0,"unset",void 0,a+"px")}async hide(){void 0!==this._floatingID&&(i.close(this._floatingID),this._floatingID=void 0)}observeValue(){this.value&&(this._currentPosition.setTime(this.value.getTime()),this._currentPosition.setDate(1))}scrollListener(){this.floating&&this.isFixed()&&this.hide()}isFixed(){return"true"===this._hostElem.dataset.isFixed}getMonthLabel(){return this.i18n(`ez-calendar.month.${this._currentPosition.getMonth()}`)+" "+this._currentPosition.getFullYear()}isSelectedDate(a){return!!this.value&&this.value.getDate()==a.getDate()&&this.value.getMonth()==a.getMonth()&&this.value.getFullYear()==a.getFullYear()}changeMonth(a){this._currentPosition.setMonth(this._currentPosition.getMonth()+a),r(this)}selectDate(a){let e=a;this.value&&(this.time||this.showSeconds)&&(e.setHours(this.value.getHours()),e.setMinutes(this.value.getMinutes()),e.setSeconds(this.showSeconds?this.value.getSeconds():0)),this.value=e,this.ezChange.emit(this.value)}selectHours(a){this.value||(this.value=new Date),this.value=new Date(this.value.getFullYear(),this.value.getMonth(),this.value.getDate(),a,this.value.getMinutes(),this.value.getSeconds()),this.ezChange.emit(this.value)}selectMinutes(a){this.value||(this.value=new Date),this.value=new Date(this.value.getFullYear(),this.value.getMonth(),this.value.getDate(),this.value.getHours(),a,this.value.getSeconds()),this.ezChange.emit(this.value)}selectSeconds(a){this.value||(this.value=new Date),this.value=new Date(this.value.getFullYear(),this.value.getMonth(),this.value.getDate(),this.value.getHours(),this.value.getMinutes(),a),this.ezChange.emit(this.value)}updateScroll(a){if(a){const{scrollHeight:e,clientHeight:r,scrollTop:t}=a;e-r-Math.ceil(t)>0?a.classList.add("endHidden"):a.classList.remove("endHidden")}}async componentWillLoad(){this.i18n=await s()}componentDidRender(){this.floating&&this._firstRender&&(this._calendarHeight=this._box.clientHeight,this._calendarWidth=this._box.clientWidth,this._box.remove(),this._firstRender=!1),this.updateScroll(this._hoursScroll),this.updateScroll(this._minutesScroll),this.updateScroll(this._secondsScroll)}componentDidLoad(){this.scroll()}scroll(){(this.time||this.showSeconds)&&(this._hoursScroll.scrollTop=this._hoursSelect.offsetTop-64,this._minutesScroll.scrollTop=this._minutesSelect.offsetTop-64,this.updateScroll(this._hoursScroll),this.updateScroll(this._minutesScroll),this.showSeconds&&(this._secondsScroll.scrollTop=this._secondsSelect.offsetTop-64,this.updateScroll(this._secondsScroll)))}render(){null==this._currentPosition&&(this._currentPosition=new Date,this.value&&this._currentPosition.setTime(this.value.getTime()),this._currentPosition.setDate(1));const a=new Date;return a.setTime(this._currentPosition.getTime()),a.setDate(1-a.getDay()),t("section",{ref:a=>this._container=a},t("div",{ref:a=>this._box=a,class:"calendar__container"},t("div",{class:"calendar"},t("div",{class:"calendar__header"},t("button",{class:"calendar__btn-previous",onClick:()=>this.changeMonth(-1)}),t("label",{class:"calendar__lbl-month"},this.getMonthLabel()),t("button",{class:"calendar__btn-next",onClick:()=>this.changeMonth(1)})),t("div",{class:"calendar__body"},t("div",{class:"calendar__line"},[...Array(7).keys()].map((a=>t("div",{"data-day":this.i18n(`ez-calendar.weekDay.${a}`),class:"calendar__cell calendar__cell--unselectable"},this.i18n(`ez-calendar.weekDay.${a}`))))),[0,7,14,21,28,35].map((e=>t("div",{class:"calendar__line"},[0,1,2,3,4,5,6].map((r=>{const l=new Date;l.setTime(a.getTime()),l.setDate(l.getDate()+e+r);let i=`${l.getMonth()+1}-${l.getDate()}-${l.getFullYear()}`,s="calendar__cell";return this._currentPosition.getMonth()!=l.getMonth()?s+=" calendar__cell--secondary":this.isSelectedDate(l)&&(s+=" calendar__cell--selected"),t("div",{"data-day-month":i,class:s,onClick:()=>this.selectDate(l)},l.getDate())})))))),t("div",{class:"calendar__footer"},t("button",{class:"calendar__btn-today",onClick:()=>this.selectDate(new Date)},this.i18n("ez-calendar.today")))),(this.time||this.showSeconds)&&t("div",{class:"calendar-time"},t("div",{class:"calendar-time__header"},t("div",null,"H"),t("div",{class:"separatorTime"},":"),t("div",null,"M"),this.showSeconds&&t("div",{class:"separatorTime"},":"),this.showSeconds&&t("div",null,"S")),t("div",{class:"calendar__body ",style:{display:"flex",paddingLeft:"12px",paddingRight:"12px"}},t("div",{class:"calendar__column",ref:a=>this._hoursScroll=a,onScroll:()=>this.updateScroll(this._hoursScroll)},this._hoursLabel.map(((a,e)=>e===this.value.getHours()?t("div",{style:{display:"flex"},ref:a=>this._hoursSelect=a},t("div",{"data-hour":a,class:"calendar__cell calendar__cell--selected",onClick:()=>this.selectHours(e)},a),t("div",{class:"separatorTime"},":")):t("div",{style:{display:"flex"}},t("div",{"data-hour":a,class:"calendar__cell",onClick:()=>this.selectHours(e)},a),t("div",{class:"separatorTime"},":"))))),t("div",{class:"calendar__column",ref:a=>this._minutesScroll=a,onScroll:()=>this.updateScroll(this._minutesScroll)},this._minutosLabel.map(((a,e)=>e===this.value.getMinutes()?t("div",{style:{display:"flex"},ref:a=>this._minutesSelect=a},t("div",{"data-minute":a,class:"calendar__cell calendar__cell--selected",onClick:()=>this.selectMinutes(e)},a),this.showSeconds&&t("div",{class:"separatorTime"},":")):t("div",{style:{display:"flex"}},t("div",{"data-minute":a,class:"calendar__cell",onClick:()=>this.selectMinutes(e)},a),this.showSeconds&&t("div",{class:"separatorTime"},":"))))),this.showSeconds&&t("div",{class:"calendar__column",ref:a=>this._secondsScroll=a,onScroll:()=>this.updateScroll(this._secondsScroll)},this._minutosLabel.map(((a,e)=>e===this.value.getSeconds()?t("div",{"data-second":a,class:"calendar__cell calendar__cell--selected",onClick:()=>this.selectSeconds(e),ref:a=>this._secondsSelect=a},a):t("div",{"data-second":a,class:"calendar__cell",onClick:()=>this.selectSeconds(e)},a))))))))}get _hostElem(){return l(this)}static get watchers(){return{value:["observeValue"]}}};n.style=':host{--ez-calendar--font-family:var(--font-pattern, Arial);--ez-calendar--color:var(--title--primary, #626e82);--ez-calendar--text-shadow:var(--text-shadow, 0 0 0 #353535, 0 0 1px transparent);--ez-calendar__body--background-color:var(--background--xlight, #FFF);--ez-calendar__time--background-color:var(--background--xlight, #FAFAFA);--ez-calendar__body--padding:var(--space--medium, 12px) var(--space--small, 6px);--ez-calendar__body--border-radius:var(--border--radius-medium, 12px);--ez-calendar__body--shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-container--z-index:var(--more-visible, 2);--ez-calendar__header-line--stroke:1px;--ez-calendar__header-line--color:var(--color--strokes, #C0C0C0);--ez-calendar__nav-btn--fill:var(--text--primary, #008561);--ez-calendar__nav-btn--hover--fill:var(--color--primary, #350404);--ez-calendar__nav-btn--width:10px;--ez-calendar__nav-btn--height:16px;--ez-calendar__nav-btn--previous-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="10px"><path d="M 9.7808475,13.860393 3.9204526,8.0000004 9.7808475,2.0624965 7.9301965,0.28895552 0.21915255,8.0000004 7.9301965,15.711044 Z"/></svg>\');--ez-calendar__nav-btn--next-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="10px"><path d="M 0.21915251,13.860393 6.0795475,8.0000007 0.21915251,2.0624968 2.0698036,0.28895588 9.7808475,8.0000007 2.0698036,15.711044 Z"/></svg>\');--ez-calendar__cell--margin:0px 1.5px;--ez-calendar__cell--width:var(--space--large, 24px);--ez-calendar__cell--padding:1.5px 0px;--ez-calendar__cell--border-radius:var(--border--radius-small, 6px);--ez-calendar__cell--over--background-color:var(--color--primary, #E2F4EF);--ez-calendar__cell--over--color:var(--color--primary-300, #008561);--ez-calendar__cell--outset--color:var(--color--disable-primary, #E5EAF0);--ez-calendar__cell--selected--background-color:var(--color--primary, #008561);--ez-calendar__cell--selected--color:var(--color--inverted, #FFF);--ez-calendar__btn-today--color:var(--color--primary);--ez-calendar__btn-today--hover--background-color:var(--color--primary-300, #E2F4EF);--ez-calendar__btn-today--border-radius:var(--border--radius-small, 6px);position:relative;display:flex;user-select:none}.calendar__container{display:flex;z-index:var(--more-visible, 2)}.calendar{display:flex;flex-direction:column;z-index:var(--more-visible, 2);background-color:var(--ez-calendar__body--background-color);padding:var(--ez-calendar__body--padding);border-radius:var(--ez-calendar__body--border-radius);box-shadow:var(--ez-calendar__body--shadow)}.calendar__header{display:flex;justify-content:space-between;padding-bottom:var(--space--small, 6px);margin:0px var(--space--, 12px) var(--space--small, 6px) var(--space--, 12px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);border-bottom:solid var(--ez-calendar__header-line--stroke) var(--ez-calendar__header-line--color)}.calendar__btn-next,.calendar__btn-previous{outline:none;border:none;background-color:unset;cursor:pointer;padding:0px}.calendar__btn-next::after,.calendar__btn-previous::after{content:\'\';display:flex;background-color:var(--ez-calendar__nav-btn--fill);width:var(--ez-calendar__nav-btn--width);height:var(--ez-calendar__nav-btn--height)}.calendar__btn-previous::after{-webkit-mask-image:var(--ez-calendar__nav-btn--previous-image);mask-image:var(--ez-calendar__nav-btn--previous-image)}.calendar__btn-next::after{-webkit-mask-image:var(--ez-calendar__nav-btn--next-image);mask-image:var(--ez-calendar__nav-btn--next-image)}.calendar__btn-next:hover::after,.calendar__btn-previous:hover::after{background-color:var(--ez-calendar__nav-btn--hover--fill)}.calendar__lbl-month{font-weight:var(--text-weight--extra-large, 700);font-size:var(--title--small, 14px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.calendar__line{display:flex;padding:0px;margin:0px}.calendar__cell{display:flex;justify-content:center;align-content:center;cursor:pointer;font-size:var(--text--extra-small, 10px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);padding:var(--ez-calendar__cell--padding);margin:var(--ez-calendar__cell--margin);min-width:var(--ez-calendar__cell--width);border-radius:var(--ez-calendar__cell--border-radius)}.calendar__cell:hover{background-color:var(--ez-calendar__cell--over--background-color);color:var(--ez-calendar__cell--over--color)}.calendar__cell--secondary{color:var(--ez-calendar__cell--outset--color)}.calendar__cell--unselectable:hover{background-color:unset;border-radius:unset;cursor:unset;color:var(--ez-calendar--color)}.calendar__cell--unselectable{font-weight:var(--text-weight--large, 600);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.calendar__cell--selected,.calendar__cell--selected:hover{background-color:var(--ez-calendar__cell--selected--background-color);color:var(--ez-calendar__cell--selected--color)}.calendar__footer{display:flex;flex-direction:column}.calendar__btn-today{border:none;background-color:unset;cursor:pointer;padding:0px;font-weight:var(--text-weight--large, 600);font-size:var(--title--extra-small, 12px);font-family:var(--ez-calendar--font-family);text-shadow:var(--ez-calendar--text-shadow);color:var(--ez-calendar__btn-today--color);border-radius:var(--ez-calendar__btn-today--border-radius)}.calendar__btn-today:hover{background-color:var(--ez-calendar__btn-today--hover--background-color)}section{display:flex}.calendar-time{margin-left:-10px;display:flex;flex-direction:column;padding:12px 0px 0px 10px;background-color:var(--ez-calendar__time--background-color);border-top-right-radius:var(--ez-calendar__body--border-radius);border-bottom-right-radius:var(--ez-calendar__body--border-radius);box-shadow:var(--ez-calendar__body--shadow)}.calendar__column{height:136px;padding:0px;margin:0px;overflow:auto;scrollbar-width:none}.calendar__column::-webkit-scrollbar{width:0px;max-width:0px;min-width:0px}.calendar-time__header{display:flex;justify-content:space-between;padding-left:var(--space--small, 6px);padding-right:var(--space--small, 6px);padding-bottom:var(--space--small, 6px);margin:0px var(--space--, 12px) var(--space--small, 6px) var(--space--, 12px);font-weight:var(--text-weight--extra-large, 700);font-size:var(--title--small, 14px);text-shadow:var(--ez-calendar--text-shadow);border-bottom:solid var(--ez-calendar__header-line--stroke) var(--ez-calendar__header-line--color);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.separatorTime{color:#A2ABB9;padding:0px 1px;line-height:16px;font-size:17px;font-weight:normal}.endHidden{-webkit-mask-image:linear-gradient(180deg, #000 calc(100% - 48px), transparent 100%)}.calendar__column .calendar__cell{margin:0px;padding:1.5px 1.5px}';export{n as ez_calendar}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as i,h as s,F as e,H as l}from"./p-
|
|
1
|
+
import{r as t,c as i,h as s,F as e,H as l}from"./p-e4c7eb39.js";import{i as h}from"./p-641ee538.js";import{ArrayUtils as n}from"@sankhyalabs/core";var o;!function(t){t.DATASOURCE_RESULTS="DATASOURCE_RESULTS",t.DATASOURCE_RESULTS_EMPTY="DATASOURCE_RESULTS_EMPTY",t.DATASOURCE_INIT="DATASOURCE_INIT",t.OPTIONS_EMPTY="OPTIONS_EMPTY",t.OPTIONS="OPTIONS"}(o||(o={}));const a=class{constructor(s){t(this,s),this.changeFilteredOptions=i(this,"changeFilteredOptions",7),this.columnName=void 0,this.dataSource=void 0,this.useOptions=!1,this.options=void 0,this.isTextSearch=!1,this.filteredOptions=void 0,this.displayOptions=void 0,this.viewScenario=void 0,this.displayOptionToCheckAllItems=!0}async componentWillLoad(){this.i18n=await h()}async clearFilteredOptions(){this.setInitialScenario(),this.filteredOptions=[],this.searchInput&&await this.searchInput.clearValue(),this.filterInput&&(this.filterInput.value="")}onChangeUseOptions(){this.setInitialScenario()}onChangeOptions(){this.options&&(this.filteredOptions=this.ordenationByCheckStateAndAlphabetically(this.options)),this.checkInput&&this.changeCheckAllValeuFromFilteredOptions(),this.setInitialScenario()}onChangeFilteredOptions(t){this.displayOptions=this.filteredOptions,this.displayOptionToCheckAllItems=this.filteredOptions.length>1,this.checkInput&&this.changeCheckAllValeuFromFilteredOptions(),this.changeFilteredOptions.emit(t)}componentDidLoad(){this.onChangeOptions()}componentDidRender(){this.changeCheckAllValeuFromFilteredOptions()}ordenationByCheckStateAndAlphabetically(t){const i=[],s=[];let e;return t.forEach((t=>{null==t.value||""===t.label?e=Object.assign(Object.assign({},t),{label:this.i18n("ez-multi-selection-list.empty")}):t.check?i.push(t):s.push(t)})),(null==e?[]:[e]).concat(null==this.dataSource?n.sortAlphabetically(i):this.dataSource.sortItems(this.columnName,i)).concat(null==this.dataSource?n.sortAlphabetically(s):this.dataSource.sortItems(this.columnName,s))}changeCheckAllValeuFromFilteredOptions(){var t,i,s,e;const l=null===(t=this.filteredOptions)||void 0===t?void 0:t.every((t=>!0===t.check)),h=null===(i=this.filteredOptions)||void 0===i?void 0:i.every((t=>!1===t.check)),n=(null===(s=this.filteredOptions)||void 0===s?void 0:s.some((t=>!1===t.check)))&&(null===(e=this.filteredOptions)||void 0===e?void 0:e.some((t=>!0===t.check)))&&(!l||!h);return this.checkInput&&l?(this.checkInput.indeterminate=!1,void(this.checkInput.value=!0)):this.checkInput&&n?(this.checkInput.indeterminate=!0,void(this.checkInput.value=!1)):this.checkInput&&h?(this.checkInput.indeterminate=!1,void(this.checkInput.value=!1)):void 0}setInitialScenario(){if(this.useOptions)return this.viewScenario=o.OPTIONS,void this.changeCheckAllValeuFromFilteredOptions();this.viewScenario=this.options&&this.options.length>0?o.DATASOURCE_RESULTS:o.DATASOURCE_INIT}async searchWithDataSource(t,i){const{argument:s,mode:e}=t;if("PRELOAD"!==e&&i)return this.dataSource.fetchData(s,i)}async handleSearchOnDataSource(t){var i;const s=null!==(i=this.filteredOptions)&&void 0!==i?i:[];t.detail&&!s.some((i=>i.value==t.detail.value))&&(this.filteredOptions=this.ordenationByCheckStateAndAlphabetically([...s,t.detail])),this.viewScenario=o.DATASOURCE_RESULTS,await this.searchInput.clearValue()}async handleRemoveItemFromOptions(t){this.filteredOptions=this.ordenationByCheckStateAndAlphabetically(this.filteredOptions.filter((i=>i.value!==t.value))),0===this.filteredOptions.length&&(this.viewScenario=o.DATASOURCE_INIT),this.searchInput&&await this.searchInput.clearValue()}handleSearchOnOption(t){if(t.detail)return this.displayOptions=n.applyStringFilter(t.detail,this.filteredOptions,!0),void(this.viewScenario=0===this.displayOptions.length?o.OPTIONS_EMPTY:o.OPTIONS);this.displayOptions=this.filteredOptions,this.viewScenario=o.OPTIONS}handleChangeSelectAllItems(t){this.filteredOptions=this.ordenationByCheckStateAndAlphabetically([...this.filteredOptions.map((i=>(i.check=!!t.detail,i)))])}handleChangeSelectedItem(t){const{detail:i}=t;this.filteredOptions.find((t=>t.label===i.label)).check=i.check,this.changeFilteredOptions.emit(this.filteredOptions)}buildViewList(t){return s(e,null,this.displayOptionToCheckAllItems&&s("ez-check",{ref:t=>this.checkInput=t,label:this.i18n("ez-multi-selection-list.selectAll"),class:"multi-selection__select-all",onEzChange:this.handleChangeSelectAllItems.bind(this)}),s("ez-list",{class:"multi-selection__list",dataSource:this.displayOptions.map((t=>Object.assign(Object.assign({},t),{id:t.value}))),listMode:"check",hoverFeedback:!0,onEzCheckChange:this.handleChangeSelectedItem.bind(this),itemSlotBuilder:t?this.buildDeleteIconSlot.bind(this):null}))}buildDeleteIconSlot(t){return s("ez-icon",{style:{cursor:"pointer"},iconName:"delete",onClick:()=>this.handleRemoveItemFromOptions(t)})}buildInitViewWithDataSource(){return s("multi-selection-box-message",{message:this.i18n("ez-multi-selection-list.initMessage")})}buildViewEmptyResults(){return s("multi-selection-box-message",{message:this.i18n("ez-multi-selection-list.emptyResults")})}scenarioToDisplay(t){const i={[o.DATASOURCE_INIT]:()=>this.buildInitViewWithDataSource(),[o.DATASOURCE_RESULTS]:()=>this.buildViewList(!0),[o.DATASOURCE_RESULTS_EMPTY]:()=>this.buildViewEmptyResults(),[o.OPTIONS_EMPTY]:()=>this.buildViewEmptyResults(),[o.OPTIONS]:()=>this.buildViewList(!1)}[t];return i?i():void 0}render(){return s(l,null,s("div",{class:"multi-selection"},this.useOptions?s("ez-filter-input",{ref:t=>this.filterInput=t,label:this.i18n("ez-multi-selection-list.search"),onEzChange:this.handleSearchOnOption.bind(this)}):s("ez-search",{class:"multi-selection__input",label:this.i18n("ez-multi-selection-list.search"),ref:t=>this.searchInput=t,suppressEmptyOption:!0,showOptionValue:!1,showSelectedValue:!1,optionLoader:t=>this.searchWithDataSource(t,this.columnName),onEzChange:this.handleSearchOnDataSource.bind(this),isTextSearch:this.isTextSearch}),s("ez-scroll",{class:"multi-selection__content-options"},this.scenarioToDisplay(this.viewScenario))))}static get watchers(){return{useOptions:["onChangeUseOptions"],options:["onChangeOptions"],filteredOptions:["onChangeFilteredOptions"]}}};a.style=".sc-ez-multi-selection-list-h{--ez-check--outter-gap:0px;--ez-multi-selection-default-height:322px;display:block;width:304px;height:var(--ez-multi-selection-default-height);min-height:fit-content;max-height:calc(100vh - 350px)}.multi-selection__input.sc-ez-multi-selection-list{margin-bottom:var(--space--2xs, 8px)}.multi-selection__content-options.sc-ez-multi-selection-list{position:relative;left:-4px}.multi-selection__select-all.sc-ez-multi-selection-list{height:var(--space--xl);margin:0 var(--space--small, 6px)}.multi-selection__list.sc-ez-multi-selection-list{max-height:calc(100vh - 435px);overflow-y:auto;overflow-x:clip}.multi-selection__list.sc-ez-multi-selection-list::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}";export{a as ez_multi_selection_list}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as i,h as o,H as e,g as s}from"./p-
|
|
1
|
+
import{r as t,c as i,h as o,H as e,g as s}from"./p-e4c7eb39.js";import{c as r,f as h,s as n}from"./p-2a806303.js";const a=class{constructor(o){t(this,o),this.ezVisibilityChange=i(this,"ezVisibilityChange",7),this.autoClose=!0,this.boxWidth="fit-content",this.opened=!1,this.overlayType="light",this.anchorElement=void 0,this.options={horizontalGap:0,verticalGap:0,fromRight:!1},this.useAnchorSize=!1,this.minWidth=150}observeOpened(t,i){t!==i&&(t?this.openPopover():this.hidePopover())}async updatePosition(t,i){this.updateOptionPosition(t,i),await this.updatePositionPopover()}async show(t,i){this.updateOptionPosition(t,i),this.opened=!0}async showUnder(t,i){i&&(this.options=i),this.anchorElement=t,this.opened=!0}async hide(){this.opened=!1}async setOptions(t){Object.assign(this.options,t)}async setAnchorElement(t){this.anchorElement=t}parseSizePixel(t,i){return t?"string"==typeof t?Number(t.replace("px","")):null!=t?t:0:null!=i?i:0}updateOptionPosition(t,i){Object.assign(this.options,{horizontalGap:this.parseSizePixel(i,this.options.horizontalGap),verticalGap:this.parseSizePixel(t,this.options.verticalGap)})}getElement(t){return"string"==typeof t?document.getElementById(t):t}getAnchorElement(){if(!this.anchorElement)return this._host;if(Array.isArray(this.anchorElement)){for(const t of this.anchorElement){const i=this.getElement(t);if(i)return i}return this._host}return this.getElement(this.anchorElement)}async updatePositionPopover(){if(!this._box||!this.opened)return;const t=this.getAnchorElement();await r(t,this._box,{placement:this.options.fromRight?"bottom-end":"bottom-start",middleware:[h(),n({padding:5})],strategy:"fixed"}).then((({x:t,y:i,placement:o})=>{const e=o.includes("bottom")?i+this.options.verticalGap:i-this.options.verticalGap,s=o.includes("start")?t+this.options.horizontalGap:t-this.options.horizontalGap;Object.assign(this._box.style,{top:`${e}px`,left:`${s}px`})}))}hidePopover(){this._box&&(this._box.style.display="",this.hideOverlay(),this.ezVisibilityChange.emit(!1))}async openPopover(){if(this._box&&this.opened){if(this._box.style.display="flex",this._box.style.visibility="hidden",this.useAnchorSize){const t=this.getAnchorElement().getBoundingClientRect().width;this._box.style.width=`${t<this.minWidth?this.minWidth:t}px`}await this.updatePositionPopover(),this.openOverlay(),this.ezVisibilityChange.emit(!0),this._box.style.visibility="visible"}}openOverlay(){this._overlay&&this._overlayIsActive&&(this._overlay.style.display="block")}hideOverlay(){this._overlay&&(this._overlay.style.display="none")}checkStatusOverlay(){return"none"!==this.overlayType||!("none"!==this.overlayType||!this.autoClose)}handlePositionUpdate(){this.opened&&this.updatePositionPopover()}componentWillLoad(){window.addEventListener("scroll",this.handlePositionUpdate.bind(this),!0),window.addEventListener("resize",this.handlePositionUpdate.bind(this),!0)}componentDidLoad(){this._overlayIsActive=this.checkStatusOverlay(),this._resizeObserver=new ResizeObserver(this.updatePositionPopover.bind(this)),this._resizeObserver.observe(this._box),this.openPopover()}disconnectedCallback(){window.removeEventListener("scroll",this.handlePositionUpdate.bind(this),!0),window.removeEventListener("resize",this.handlePositionUpdate.bind(this),!0),this._resizeObserver.disconnect()}render(){return o(e,null,o("div",{ref:t=>this._overlay=t,onClick:()=>this.hide(),class:`popover__overlay popover__overlay--${this.overlayType}`}),o("section",{ref:t=>this._box=t,class:{popover__box:!0,"popover__box--fit-content":"fit-content"===this.boxWidth,"popover__box--full-width":"fit-content"!==this.boxWidth}},o("slot",null)))}get _host(){return s(this)}static get watchers(){return{opened:["observeOpened"]}}};a.style=":host{--ez-popover__box--border-radius:var(--border--radius-medium, 12px);--ez-popover__box--box-shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-popover__box--background-color:var(--background--xlight, #fff);--ez-popover__box--z-index:var(--elevation--100, 100);--ez-popover__box--overlay-z-index:var(--elevation--24, 24);position:relative;display:flex;user-select:none}.popover__overlay{display:none;position:fixed;padding:0;top:0px;left:0px;width:100%;height:100vh;box-sizing:border-box;z-index:var(--ez-popover__box--overlay-z-index)}.popover__overlay--light{background-color:rgba(var(--rgb-background--overlay), var(--opacity--bright))}.popover__overlay--medium{background-color:rgba(var(--rgb-background--overlay), var(--opacity--soft));backdrop-filter:blur(var(--background-blur--medium))}.popover__box{display:none;position:fixed;top:0;left:0;z-index:var(--ez-popover__box--z-index);flex-direction:column;height:fit-content;background-color:var(--ez-popover__box--background-color);border-radius:var(--ez-popover__box--border-radius);box-shadow:var(--ez-popover__box--box-shadow)}.popover__box--fit-content{width:fit-content}.popover__box--full-width{width:calc(100% - 10px)}";export{a as ez_popover_core}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as i,h as e,H as s,g as n}from"./p-23a36bb6.js";import{DateUtils as o,TimeFormatter as a,ElementIDUtils as h}from"@sankhyalabs/core";import{C as r}from"./p-ec7db713.js";import{i as l}from"./p-641ee538.js";const c=class{constructor(e){t(this,e),this.ezChange=i(this,"ezChange",7),this.ezStartChange=i(this,"ezStartChange",7),this.ezCancelWaitingChange=i(this,"ezCancelWaitingChange",7),this._changePending=!1,this._focused=!1,this._valuePromiseCallbacks=[],this.label=void 0,this.value=void 0,this.enabled=!0,this.errorMessage=void 0,this.showSeconds=!1,this.mode="regular",this.canShowError=!0,this.autoFocus=!1,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=o.validateDate(t,!0),s=o.validateDate(i,!0);if((null==e?void 0:e.getTime())!==(null==s?void 0:s.getTime())){const t=this.getTextValue(e)||"";!this.getParsedDateTime(t)&&this._focused||(this._textInput.value||"")===t||(this._textInput.value=t,this._focused=!1,this.errorMessage=""),this.ezChange.emit(null===e?void 0:e)}}this._changePending=!1}async setFocus(t){this._textInput.setFocus(t)}async setBlur(){this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async getValueAsync(){return this._changePending?new Promise((t=>{this._valuePromiseCallbacks.push(t)})):Promise.resolve(this.value)}handleKeyDown(t){const i=this._textInput.shadowRoot.querySelector("input");if(t.shiftKey&&"Tab"===t.key){if(i.selectionStart>0){let e=i.value.lastIndexOf(" ",i.selectionStart);-1!==e&&(i.setSelectionRange(0,e),t.preventDefault())}}else if("Tab"===t.key&&i.value.length!==i.selectionEnd){let e=i.value.indexOf(" ",i.selectionEnd);e=-1===e?i.selectionEnd:e+1,i.setSelectionRange(e,i.value.length),t.preventDefault()}}handleFocus(){const t=this._textInput.shadowRoot.querySelector("input");if(t.selectionStart!==t.selectionEnd){let i=t.value.indexOf(" ",t.selectionStart);i=-1===i?t.value.length:i,t.setSelectionRange(0,i)}}handleClick(){const t=this._textInput.shadowRoot.querySelector("input");let i=t.value.lastIndexOf(" ",t.selectionEnd);i=-1===i?0:i+1,i=i>t.selectionEnd?0:i;let e=0===i?t.value.indexOf(" "):t.value.length;t.setSelectionRange(i,e)}changeValue(t){const i=o.validateDate(this.value,!0),e=o.validateDate(t,!0);(null==i?void 0:i.getTime())!==(null==e?void 0:e.getTime())&&(this.value=e)}hideCalendar(){this.changeValue(this._calendar.value),this._popover.hide()}getParsedDateTime(t){var i,e;if(void 0===t&&(t=(null===(e=null===(i=this._textInput)||void 0===i?void 0:i.value)||void 0===e?void 0:e.trim())||""),!t)return;const s=t.split(" "),n=s.length>0?s[0]:t,h=a.prepareValue(s[1]?s[1]:"",this.showSeconds);return o.strToDate(n+(h&&" "+h))}handleBlur(){var t,i;if(this._changePending)try{const e=(null===(i=null===(t=this._textInput)||void 0===t?void 0:t.value)||void 0===i?void 0:i.trim())||"",s=this.getParsedDateTime();if(s||!e){this.errorMessage="";const t=o.validateDate(this.value,!0),i=o.validateDate(s,!0);(null==t?void 0:t.getTime())===(null==i?void 0:i.getTime())?(i&&(this._textInput.value=this.getTextValue(i)||"",this._focused=!1),this.ezCancelWaitingChange.emit()):this.changeValue(i)}else this.changeValue(void 0),this.ezCancelWaitingChange.emit(),this.errorMessage=this.i18n("ez-date-time-input.invalidDate")}finally{for(const t of this._valuePromiseCallbacks)t(this.value);this._valuePromiseCallbacks=[]}}getTextValue(t){if(t)return o.formatDateTime(t,this.showSeconds)}handleInput(t){const i=this.getParsedDateTime(),e=o.validateDate(this.value,!0),s=o.validateDate(i,!0);(null==e?void 0:e.getTime())!==(null==s?void 0:s.getTime())&&(this._changePending=!0,this._focused=!0,this.ezStartChange.emit({waitmessage:"",blocking:!1})),"H"!==t.data&&"h"!==t.data||this.changeValue(new Date)}setInputValue(){const t=this.getTextValue(this.value)||"";(this._textInput.value||"")!==t&&(this._textInput.value=t)}disconnectedCallback(){this._popover.hide()}async componentWillLoad(){this.i18n=await l()}componentDidLoad(){r.applyVarsTextInput(this._elem,this._textInput),this.setInputValue(),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}render(){return h.addIDInfoIfNotExists(this._elem,"input"),e(s,null,e("ez-text-input",{"data-element-id":h.getInternalIDInfo("textInput"),ref:t=>this._textInput=t,"data-slave-mode":"true",label:this.label,restrict:"0123456789/: ",enabled:this.enabled,errorMessage:this.errorMessage,mode:this.mode,onKeyDown:t=>{this.handleKeyDown(t)},onBlur:()=>this.handleBlur(),onInput:t=>this.handleInput(t),onFocus:()=>this.handleFocus(),onClick:()=>this.handleClick(),canShowError:this.canShowError,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")},e("ez-calendar",{ref:t=>this._calendar=t,"data-element-id":h.getInternalIDInfo("calendar"),onEzChange:t=>{this.hideCalendar(),t.stopPropagation()},time:!0,showSeconds:this.showSeconds})))}get _elem(){return n(this)}static get watchers(){return{label:["observeLabel"],errorMessage:["observeErrorMessage"],value:["observeValue"]}}};c.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{c as ez_date_time_input}
|
|
1
|
+
import{r as t,c as i,h as e,H as s,g as n}from"./p-e4c7eb39.js";import{DateUtils as o,TimeFormatter as a,ElementIDUtils as h}from"@sankhyalabs/core";import{C as r}from"./p-ec7db713.js";import{i as l}from"./p-641ee538.js";const c=class{constructor(e){t(this,e),this.ezChange=i(this,"ezChange",7),this.ezStartChange=i(this,"ezStartChange",7),this.ezCancelWaitingChange=i(this,"ezCancelWaitingChange",7),this._changePending=!1,this._focused=!1,this._valuePromiseCallbacks=[],this.label=void 0,this.value=void 0,this.enabled=!0,this.errorMessage=void 0,this.showSeconds=!1,this.mode="regular",this.canShowError=!0,this.autoFocus=!1,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=o.validateDate(t,!0),s=o.validateDate(i,!0);if((null==e?void 0:e.getTime())!==(null==s?void 0:s.getTime())){const t=this.getTextValue(e)||"";!this.getParsedDateTime(t)&&this._focused||(this._textInput.value||"")===t||(this._textInput.value=t,this._focused=!1,this.errorMessage=""),this.ezChange.emit(null===e?void 0:e)}}this._changePending=!1}async setFocus(t){this._textInput.setFocus(t)}async setBlur(){this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async getValueAsync(){return this._changePending?new Promise((t=>{this._valuePromiseCallbacks.push(t)})):Promise.resolve(this.value)}handleKeyDown(t){const i=this._textInput.shadowRoot.querySelector("input");if(t.shiftKey&&"Tab"===t.key){if(i.selectionStart>0){let e=i.value.lastIndexOf(" ",i.selectionStart);-1!==e&&(i.setSelectionRange(0,e),t.preventDefault())}}else if("Tab"===t.key&&i.value.length!==i.selectionEnd){let e=i.value.indexOf(" ",i.selectionEnd);e=-1===e?i.selectionEnd:e+1,i.setSelectionRange(e,i.value.length),t.preventDefault()}}handleFocus(){const t=this._textInput.shadowRoot.querySelector("input");if(t.selectionStart!==t.selectionEnd){let i=t.value.indexOf(" ",t.selectionStart);i=-1===i?t.value.length:i,t.setSelectionRange(0,i)}}handleClick(){const t=this._textInput.shadowRoot.querySelector("input");let i=t.value.lastIndexOf(" ",t.selectionEnd);i=-1===i?0:i+1,i=i>t.selectionEnd?0:i;let e=0===i?t.value.indexOf(" "):t.value.length;t.setSelectionRange(i,e)}changeValue(t){const i=o.validateDate(this.value,!0),e=o.validateDate(t,!0);(null==i?void 0:i.getTime())!==(null==e?void 0:e.getTime())&&(this.value=e)}hideCalendar(){this.changeValue(this._calendar.value),this._popover.hide()}getParsedDateTime(t){var i,e;if(void 0===t&&(t=(null===(e=null===(i=this._textInput)||void 0===i?void 0:i.value)||void 0===e?void 0:e.trim())||""),!t)return;const s=t.split(" "),n=s.length>0?s[0]:t,h=a.prepareValue(s[1]?s[1]:"",this.showSeconds);return o.strToDate(n+(h&&" "+h))}handleBlur(){var t,i;if(this._changePending)try{const e=(null===(i=null===(t=this._textInput)||void 0===t?void 0:t.value)||void 0===i?void 0:i.trim())||"",s=this.getParsedDateTime();if(s||!e){this.errorMessage="";const t=o.validateDate(this.value,!0),i=o.validateDate(s,!0);(null==t?void 0:t.getTime())===(null==i?void 0:i.getTime())?(i&&(this._textInput.value=this.getTextValue(i)||"",this._focused=!1),this.ezCancelWaitingChange.emit()):this.changeValue(i)}else this.changeValue(void 0),this.ezCancelWaitingChange.emit(),this.errorMessage=this.i18n("ez-date-time-input.invalidDate")}finally{for(const t of this._valuePromiseCallbacks)t(this.value);this._valuePromiseCallbacks=[]}}getTextValue(t){if(t)return o.formatDateTime(t,this.showSeconds)}handleInput(t){const i=this.getParsedDateTime(),e=o.validateDate(this.value,!0),s=o.validateDate(i,!0);(null==e?void 0:e.getTime())!==(null==s?void 0:s.getTime())&&(this._changePending=!0,this._focused=!0,this.ezStartChange.emit({waitmessage:"",blocking:!1})),"H"!==t.data&&"h"!==t.data||this.changeValue(new Date)}setInputValue(){const t=this.getTextValue(this.value)||"";(this._textInput.value||"")!==t&&(this._textInput.value=t)}disconnectedCallback(){this._popover.hide()}async componentWillLoad(){this.i18n=await l()}componentDidLoad(){r.applyVarsTextInput(this._elem,this._textInput),this.setInputValue(),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}render(){return h.addIDInfoIfNotExists(this._elem,"input"),e(s,null,e("ez-text-input",{"data-element-id":h.getInternalIDInfo("textInput"),ref:t=>this._textInput=t,"data-slave-mode":"true",label:this.label,restrict:"0123456789/: ",enabled:this.enabled,errorMessage:this.errorMessage,mode:this.mode,onKeyDown:t=>{this.handleKeyDown(t)},onBlur:()=>this.handleBlur(),onInput:t=>this.handleInput(t),onFocus:()=>this.handleFocus(),onClick:()=>this.handleClick(),canShowError:this.canShowError,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")},e("ez-calendar",{ref:t=>this._calendar=t,"data-element-id":h.getInternalIDInfo("calendar"),onEzChange:t=>{this.hideCalendar(),t.stopPropagation()},time:!0,showSeconds:this.showSeconds})))}get _elem(){return n(this)}static get watchers(){return{label:["observeLabel"],errorMessage:["observeErrorMessage"],value:["observeValue"]}}};c.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{c as ez_date_time_input}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as i,a as e,H as s,c as o,g as a}from"./p-e4c7eb39.js";import{ElementIDUtils as r,ObjectUtils as h,HTMLBuilder as l,StringUtils as n,KeyboardManager as c}from"@sankhyalabs/core";import{i as d}from"./p-641ee538.js";import{C as b}from"./p-30ffb9ed.js";import{R as m,a as u}from"./p-3e767a74.js";import{p as v}from"./p-bb409cba.js";import{A as p}from"./p-5a11cf56.js";import"./p-ab574d59.js";import"./p-b853763b.js";import"./p-112455b1.js";const x=class{constructor(i){t(this,i),this.showLoading=void 0,this.visibleOptions=void 0,this.textEmptyList=void 0,this.showOptionValue=void 0,this.preSelection=void 0,this.maxWidth=void 0,this.width=void 0,this.onOptionSelect=void 0,this.onOptionHover=void 0}async nextOption(){var t,i;(null===(t=this.visibleOptions)||void 0===t?void 0:t.length)&&(void 0!==this.preSelection&&this.preSelection>=this.visibleOptions.length-1||(this.preSelection=void 0===this.preSelection?0:this.preSelection+1,this.scrollToOption(this.visibleOptions[this.preSelection]),null===(i=this.onOptionHover)||void 0===i||i.call(this,this.preSelection)))}async previousOption(){var t,i;(null===(t=this.visibleOptions)||void 0===t?void 0:t.length)&&(void 0!==this.preSelection&&this.preSelection<=0||(this.preSelection=void 0===this.preSelection?this.visibleOptions.length-1:this.preSelection-1,this.scrollToOption(this.visibleOptions[this.preSelection]),null===(i=this.onOptionHover)||void 0===i||i.call(this,this.preSelection)))}async selectCurrentOption(){void 0!==this.preSelection&&(this.onOptionSelect(this.visibleOptions[this.preSelection]),this.preSelection=void 0)}observeWidth(t,i){t!==i&&this._listWrapper&&(this._listWrapper.style.width=`${this.width}px`)}observeMaxWidth(t,i){t!==i&&this._listWrapper&&(this._listWrapper.style.maxWidth=this.maxWidth?`${this.maxWidth}px`:"")}handleKeyDown(t){switch(t.key){case"ArrowDown":t.preventDefault(),t.stopPropagation(),this.nextOption();break;case"ArrowUp":t.preventDefault(),t.stopPropagation(),this.previousOption();break;case"Enter":this.selectCurrentOption();break;case"Escape":this.preSelection=void 0}}buildItem(t,e){const s=this.showOptionValue&&this.maxWidth>0?`${this.maxWidth}px`:"";return t.label=t.label||t.value,i("li",{tabIndex:1,class:e===this.preSelection?"item preselected":"item",id:`item_${t.value}_${e}`,key:`item_${t.value}_${e}`,onMouseDown:()=>this.onOptionSelect(t),onMouseOver:()=>this.preSelection=e},this.showOptionValue?i("span",{class:"item__value",title:t.value,style:{width:s,minWidth:s,maxWidth:s}},t.value):void 0,i("span",{class:"item__label "+(this.showOptionValue?"item__label--bold":""),title:t.label},t.label))}scrollToOption(t){if(!(null==t?void 0:t.value)||!this._optionsList)return;const i=this.visibleOptions.indexOf(t);if(-1===i)return;const e=this._optionsList.querySelector(`li#item_${CSS.escape(t.value)}_${CSS.escape(String(i))}`);e&&e.scrollIntoView({behavior:"smooth",block:"nearest"})}async componentWillLoad(){this.i18n=await d()}componentDidLoad(){this._listWrapper.style.width=`${this.width}px`,this._listWrapper.style.maxWidth=this.maxWidth?`${this.maxWidth}px`:""}componentDidRender(){var t;null===(t=this._optionsList)||void 0===t||t.querySelectorAll(".item").forEach((t=>{r.addIDInfoIfNotExists(t,"itemComboBox")}))}render(){return i("section",{class:"list-container"},i("div",{class:"list-wrapper",ref:t=>this._listWrapper=t},i("ul",{class:"list-options",ref:t=>this._optionsList=t},!this.showLoading&&0===this.visibleOptions.length&&i("div",{class:"message"},i("span",{class:"message__no-result"},this.textEmptyList||this.i18n("ez-combo-box.noResults"))),this.showLoading&&i("div",{class:"message"},i("div",{class:"message__loading"})),this.showOptionValue&&i("span",{class:"item__value item__value--hidden"}),!this.showLoading&&this.visibleOptions.length>0&&this.visibleOptions.map(((t,i)=>this.buildItem(t,i))))))}static get watchers(){return{width:["observeWidth"],maxWidth:["observeMaxWidth"]}}};x.style=":host{--ez-combo-box--border-radius:var(--border--radius-medium, 12px);--ez-combo-box--font-size:var(--text--medium, 14px);--ez-combo-box--font-family:var(--font-pattern, Arial);--ez-combo-box--font-weight--large:var(--text-weight--large, 500);--ez-combo-box--font-weight--medium:var(--text-weight--medium, 400);--ez-combo-box--background-color--xlight:var(--background--xlight, #fff);--ez-combo-box--background-medium:var(--background--medium, #f0f3f7);--ez-combo-box--line-height:calc(var(--text--medium, 14px) + 4px);--ez-combo-box__list-title--primary:var(--title--primary, #2B3A54);--ez-combo-box__list-text--primary:var(--text--primary, #626e82);--ez-combo-box__list-height:calc(var(--ez-combo-box--font-size) + var(--ez-combo-box--space--medium) + 4px);--ez-combo-box--space--medium:var(--space--medium, 12px);--ez-combo-box--space--small:var(--space--small, 6px);--ez-combo-box__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-combo-box__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-combo-box__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-combo-box__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-combo-box__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-combo-box__scrollbar--width:var(--space--medium, 12px);--ez-combo-box__list-container--padding:var(--space--extra-small, 3px)}.list-container{padding-top:var(--ez-combo-box__list-container--padding)}.list-wrapper{display:flex;flex-direction:column;box-sizing:border-box;width:0;z-index:var(--more-visible, 2);max-height:calc(4*var(--ez-combo-box__list-height) + 2*var(--ez-combo-box--space--small) + 9px);background-color:var(--ez-combo-box--background-color--xlight);border-radius:var(--ez-combo-box--border-radius);box-shadow:var(--shadow--medium, 0 8px 24px 0 rgba(43, 58, 84, 0.10));padding:var(--ez-combo-box--space--small)}.list-options{box-sizing:border-box;width:100%;height:100%;padding:0;margin:0;display:flex;flex-direction:column;scroll-behavior:smooth;overflow:auto;scrollbar-width:thin;gap:3px;scrollbar-color:var(--ez-combo-box__scrollbar--color-clicked) var(--ez-combo-box__scrollbar--color-background)}.list-options::-webkit-scrollbar{background-color:var(--ez-combo-box__scrollbar--color-background);width:var(--ez-combo-box__scrollbar--width);max-width:var(--ez-combo-box__scrollbar--width);min-width:var(--ez-combo-box__scrollbar--width)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-combo-box__scrollbar--color-background);border-radius:var(--ez-combo-box__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-combo-box__scrollbar--color-default);border-radius:var(--ez-combo-box__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb:vertical:hover,.list-options::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-combo-box__scrollbar--color-hover)}.list-options::-webkit-scrollbar-thumb:vertical:active,.list-options::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-combo-box__scrollbar--color-clicked)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-combo-box--border-radius-small);padding:var(--ez-combo-box--space--small);min-height:var(--ez-combo-box__list-height);gap:var(--space--small, 6px)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-combo-box__list-title--primary);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size);line-height:var(--ez-combo-box--line-height)}.item__label{font-weight:var(--ez-combo-box--font-weight--medium)}.item__label--bold{font-weight:var(--ez-combo-box--font-weight--large)}.item__value{text-align:center;color:var(--ez-combo-box__list-text--primary);font-weight:var(--ez-combo-box--font-weight--large)}.item__value--hidden{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}.item__label{text-align:left}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;min-height:var(--ez-combo-box__list-height)}.message__no-result{color:var(--ez-combo-box__list-title--primary);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size)}.message__loading{border-radius:50%;width:14px;height:14px;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:3px solid var(--ez-combo-box__list-title--primary);border-top:3px solid transparent}li:hover{background-color:var(--ez-combo-box--background-medium)}.preselected{background-color:var(--background--medium)}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";const w=class{constructor(i){t(this,i),this.gui=void 0,this.customEditor=void 0,this.formViewField=void 0,this.value=void 0,this.detailContext=void 0,this.builderFallback=void 0,this.selectedRecord=void 0}async setFocus(){var t,i;null===(i=null===(t=this.gui)||void 0===t?void 0:t.setFocus)||void 0===i||i.call(t)}async setBlur(){var t,i;null===(i=null===(t=this.gui)||void 0===t?void 0:t.setBlur)||void 0===i||i.call(t)}async isInvalid(){var t,i;return(null===(i=null===(t=this.gui)||void 0===t?void 0:t.isInvalid)||void 0===i?void 0:i.call(t))||!1}watchValue(){this.handleValue(this.gui)}watchCustomEditor(){this.getContent()}watchFormViewField(t,i){h.equals(t,i)||this.getContent()}watchDetailContext(){this.getContent()}watchBuilderFallback(){this.getContent()}watchSelectedRecord(t,i){(null==t?void 0:t.__record__id__)!==(null==i?void 0:i.__record__id__)&&this.getContent()}getContent(){var t,s,o,a,r;const h=new Map;for(const t in this.formViewField.props)h.set(t,this.formViewField.props[t]);const c={value:this.value,name:this.formViewField.name,currentEditor:this.builderFallback(this.formViewField),setValue:t=>this.setValue(t),getValue:this.getValue,record:this.selectedRecord,editorMetadata:{label:this.formViewField.label,hidden:!1===(null===(t=this.formViewField.props)||void 0===t?void 0:t.visible),userInterface:this.formViewField.userInterface,options:null===(s=this.formViewField.props)||void 0===s?void 0:s.options,props:this.formViewField.props?h:void 0,optionLoader:this.formViewField.optionLoader},source:b.FORM,detailContext:this.detailContext};let d=this.customEditor.getEditorElement(c);if(!d)return d=this.builderFallback(this.formViewField),this.handleValue(d),void(this.gui=d);if(!(d instanceof e)&&"string"!=typeof d)return this.handleValue(d),void(this.gui=d);"string"==typeof d&&(d=l.parseElement(d));const m=null!==(r=null!==(a=null===(o=this.value)||void 0===o?void 0:o.value)&&void 0!==a?a:this.value)&&void 0!==r?r:"";d.setAttribute("value",m),this.gui=i("div",{key:n.generateUUID(),ref:t=>t&&t.appendChild(d)})}setValue(t){this.value=t}getValue(){return this.value}handleValue(t){var i;null===(i=t.t)||void 0===i||i.forEach((t=>{t.i.value=this.value}))}componentWillLoad(){this.getContent()}render(){return i(s,null,this.gui)}static get watchers(){return{value:["watchValue"],customEditor:["watchCustomEditor"],formViewField:["watchFormViewField"],detailContext:["watchDetailContext"],builderFallback:["watchBuilderFallback"],selectedRecord:["watchSelectedRecord"]}}},_=class{constructor(i){t(this,i),this.ezChange=o(this,"ezChange",7),this.historyStack=[],this.historyIndex=-1,this.previewMode=!1,this.showPreview=!0,this.value="",this.label=void 0,this.mode="regular",this.enabled=!0,this.rows=6,this.errorMessage=void 0,this.canShowError=!0,this.showConfigs=!0,this.showTextFormat=!0,this.showUndoRedo=!0}observeValue(t,i){h.equals(t,i)||this.ezChange.emit(t)}observeErrorMessage(t){t&&this.previewMode&&(this.previewMode=!1)}async handleExecuteToolbarCommand(t){const{command:i,value:e}=t.detail;await this.executeCommand(i,e)}async setFocus(){this.handleFocus()}async setBlur(){var t;await(null===(t=this.textAreaRef)||void 0===t?void 0:t.setBlur())}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}bindPreview(){this._keyboardManager&&this.showPreview&&this._keyboardManager.bind("ctrl + p",(async()=>{await this.togglePreview()}),{description:"Entra em modo de pré visualização.",element:this.element})}bindConfigs(){this._keyboardManager&&this.showConfigs&&this._keyboardManager.bind("ctrl + l",(async()=>{await this.handleFormatSelection(m.LIST)}),{description:this.i18n("ez-rich-text.listShortcut"),element:this.element}).bind("ctrl + k",(async()=>{await this.handleLink()}),{description:this.i18n("ez-rich-text.linkShortcut"),element:this.element}).bind("ctrl + o",(async()=>{await this.handleImage()}),{description:this.i18n("ez-rich-text.imageShortcut"),element:this.element})}bindTextFormat(){this._keyboardManager&&this.showTextFormat&&this._keyboardManager.bind("ctrl + b",(async()=>{await this.handleFormatSelection(m.BOLD)}),{description:this.i18n("ez-rich-text.boldShortcut"),element:this.element}).bind("ctrl + i",(async()=>{await this.handleFormatSelection(m.ITALIC)}),{description:this.i18n("ez-rich-text.italicShortcut"),element:this.element}).bind("ctrl + u",(async()=>{await this.handleFormatSelection(m.UNDERLINE)}),{description:this.i18n("ez-rich-text.underlineShortcut"),element:this.element})}initKeyboardManager(){this._keyboardManager=new c({propagate:!1,element:this.element}),this._keyboardManager.bind("ctrl + Enter",(async()=>{await this.handleFormatSelection(m.BREAK_LINE)}),{description:this.i18n("ez-rich-text.breakLineShortcut"),element:this.element}).bind("ctrl + z",(async()=>{await this.handleUndo()}),{description:this.i18n("ez-rich-text.undoShortcut"),element:this.element}).bind("ctrl + x",(async()=>{await this.handleRedo()}),{description:this.i18n("ez-rich-text.redoShortcut"),element:this.element}),this.bindPreview(),this.bindConfigs(),this.bindTextFormat()}async executeCommand(t,i){switch(t){case u.FOCUS:this.handleFocus();break;case u.PREVIEW:await this.togglePreview();break;case u.FORMAT:await this.handleFormatSelection(i);break;case u.UNDO:await this.handleUndo();break;case u.REDO:await this.handleRedo();break;case u.LINK:await this.handleLink();break;case u.IMAGE:await this.handleImage()}}handleFocus(){this.previewMode=!1,requestAnimationFrame((async()=>{await this.textAreaRef.setFocus()}))}async handleLink(){this.previewMode=!1,requestAnimationFrame((async()=>{await this.linkBuilderRef.show(this.getSelectedText())}))}async handleImage(){this.previewMode=!1,await this.imageUploaderRef.show()}async handleRedo(){this.previewMode=!1,requestAnimationFrame((async()=>{this.redo(),await this.textAreaRef.setFocus()}))}async handleUndo(){this.previewMode=!1,requestAnimationFrame((async()=>{this.undo(),await this.textAreaRef.setFocus()}))}async handleFormatSelection(t){t&&(this.previewMode=!1,requestAnimationFrame((async()=>{await this.formatSelection(t),await this.textAreaRef.setFocus()})))}async togglePreview(){this.previewMode=!this.previewMode,this.previewMode&&await this.textAreaRef.setFocus()}getSelectedText(){const t=this.getTextAreaElement();if(t)return(this.textAreaRef.value||"").substring(t.selectionStart,t.selectionEnd)}getTextAreaElement(){return this.element.querySelector("ez-text-area").shadowRoot.querySelector("textarea")}async formatSelection(t){if(!this.textAreaRef)return;const i=t.replace("$selection",this.getSelectedText()||"");await this.textAreaRef.appendTextToSelection(i),this.value=this.textAreaRef.value,this.addToHistory(this.value)}addToHistory(t){this.historyIndex>=0&&t===this.historyStack[this.historyIndex]||(this.historyStack.length>=50&&this.historyStack.splice(0,this.historyStack.length-49),this.historyStack.push(t),this.historyIndex=this.historyStack.length-1)}undo(){if(!this.canExecuteUndo())return;this.historyIndex--;const t=this.historyStack[this.historyIndex];this.value=t,this.textAreaRef.value=t}canExecuteUndo(){return this.historyIndex>0}redo(){this.canExecuteRedo()&&(this.historyIndex++,this.getValueFromHistory())}canExecuteRedo(){return this.historyIndex<this.historyStack.length-1}getValueFromHistory(){const t=this.historyStack[this.historyIndex];this.value=t,this.textAreaRef.value=t}handleTextAreaChanged(t){this.value=t.detail,this.addToHistory(this.value)}async removeShortcuts(){var t;null===(t=this._keyboardManager)||void 0===t||t.unbindAllShortcutKeys()}async componentWillLoad(){this.i18n=await d()}componentDidLoad(){this.initKeyboardManager(),this.addToHistory(this.value)}async disconnectedCallback(){await this.removeShortcuts()}getSanitizedValue(){return v.sanitize(this.value,{ADD_ATTR:["target","rel"]})}renderContent(){return this.previewMode?i("div",{id:"rich-text-preview-container",class:"preview",innerHTML:this.getSanitizedValue()}):i("ez-text-area",{ref:t=>this.textAreaRef=t,label:this.label,value:this.value,enabled:this.enabled,rows:this.rows,mode:this.mode,canShowError:this.canShowError,errorMessage:this.errorMessage,onEzChange:this.handleTextAreaChanged.bind(this)})}render(){return i(s,null,i("div",{class:"editor-container bordered"},i("ez-rich-toolbar",{isPreviewMode:this.previewMode,showPreview:this.showPreview,showConfigs:this.showConfigs&&this.enabled,showTextFormat:this.showTextFormat&&this.enabled,showUndoRedo:this.showUndoRedo&&this.enabled}),this.renderContent()),i("ez-link-builder",{ref:t=>this.linkBuilderRef=t}),i("ez-simple-image-uploader",{ref:t=>this.imageUploaderRef=t}))}get element(){return a(this)}static get watchers(){return{value:["observeValue"],errorMessage:["observeErrorMessage"]}}};_.style=".sc-ez-rich-text-h{display:block;width:100%;font-family:Roboto;--ez-rich-text--box-shadow:0 0 3px 0 #DCE0E8;--ez-rich-text--shadow--outline:var(--shadow--outline) var(--color--strokes)}.editor-container.sc-ez-rich-text{width:100%;overflow:hidden;border-radius:12px;border:1px solid #DCE0E8}ez-text-area.sc-ez-rich-text{--text-area__input--border:1px solid}.preview.sc-ez-rich-text{min-height:20px;padding:12px;resize:both;overflow:auto;max-width:100%;border-top:1px solid #DCE0E8}";const g=class{constructor(i){t(this,i),this.saveEdition=o(this,"saveEdition",7),this.cancelEdition=o(this,"cancelEdition",7),this._newValue=void 0,this.value=void 0,this.styled=void 0}async applyFocusSelect(){this.calcSizeInput(this.value,!0)}calcSizeInput(t,i=!1){var e,s;const o=null===(s=null===(e=this._inputElement)||void 0===e?void 0:e.shadowRoot)||void 0===s?void 0:s.querySelector("input");if(null!=o){const e=this.getWidthValue(t);o.style.width=e+"px",i&&setTimeout((()=>o.select()),100)}}getWidthValue(t){if(null!=this._valueBasis){const i=this._valueBasis;if(null!=t){const e=2;return i.innerHTML=t,i.clientWidth>0?i.clientWidth+e:e}i.innerHTML=""}return 0}setStyledInput(){var t,i;let e="",s="",o="";null!=this.styled&&(e=this.styled.fontSize,s=this.styled.fontWeight,o=this.styled.fontFamily);const a=null===(i=null===(t=this._inputElement)||void 0===t?void 0:t.shadowRoot)||void 0===i?void 0:i.querySelector("input");null!=a&&(a.style.fontSize=e,a.style.fontWeight=s,a.style.fontFamily=o);const r=this._valueBasis;null!=r&&(r.style.fontSize=e,r.style.fontWeight=s,r.style.fontFamily=o)}handleSaveEdition(){this._newValue?this.saveEdition.emit({value:this.value,newValue:this._newValue}):p.alert(this.i18n("app.warning"),this.i18n("ez-text-edit.emptyFieldWarning")).then((()=>{this.setNewValue(this.value,!0)}))}handleCancelEdition(){this.cancelEdition.emit()}setNewValue(t,i=!1){this._newValue=t,this.calcSizeInput(this._newValue,i)}async componentWillLoad(){this.i18n=await d()}componentDidLoad(){this.applyFocusSelect(),this.setNewValue(this.value)}componentDidRender(){this.setStyledInput()}render(){return r.addIDInfoIfNotExists(this._element,"input"),i(s,null,i("span",{class:"text-edit__hidden-value",ref:t=>this._valueBasis=t}),i("ez-text-input",{"data-element-id":r.getInternalIDInfo("textInput"),onInput:()=>{this.calcSizeInput(this._newValue)},class:"text-edit__form-input",value:this._newValue,ref:t=>this._inputElement=t,mode:"slim",onEzChange:t=>this.setNewValue(null==t?void 0:t.detail),noBorder:!0}),i("ez-button",{class:"text-edit__icon-check",mode:"icon",iconName:"check",size:"small",onClick:()=>{this.handleSaveEdition()}}),i("ez-button",{class:"text-edit__icon-close",mode:"icon",iconName:"close",size:"small",onClick:()=>{this.handleCancelEdition()}}))}get _element(){return a(this)}};g.style=":host{display:flex;align-items:center;gap:5px}.text-edit__form-input{width:auto;--ez-text-input__input--padding:0px}.text-edit__hidden-value{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}";export{x as ez_combo_box_list,w as ez_custom_form_input,_ as ez_rich_text,g as ez_text_edit}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{UserInterface as t,Action as s,StringUtils as i,ApplicationContext as e,ObjectUtils as n,WaitingChangeException as a,DataUnitAction as h}from"@sankhyalabs/core";import{A as r}from"./p-5a11cf56.js";import{g as o}from"./p-641ee538.js";import{h as l}from"./p-23a36bb6.js";const c=(s,i)=>{var e,n;let a,h,{name:r,label:o,group:l}=Object.assign({},i),{readOnly:c,required:d}=Object.assign({},i);return s&&(o=o||s.label,r=r||s.name,d=null!==(e=s.required)&&void 0!==e?e:null==i?void 0:i.required,c=null!==(n=s.readOnly)&&void 0!==n?n:null==i?void 0:i.readOnly,a=s.properties,h=s.userInterface),{name:r,label:o,group:l,readOnly:c,required:d,props:a,userInterface:h||t.SHORTTEXT}};class d{constructor(t,s,i){this._dataUnit=t,this._validationSource=s,this._validator=i,this._i18n=o()}validate(t=!0){return new Promise(((s,i)=>{const e=this._dataUnit.getModifiedRecords();for(let s=0;s<e.length;s++){const n=e[s],a=[];let h=this.validateRequired(n);if(h&&!h.isValid&&a.push(h),this._validator&&(h=this._validator.validateRecord(n),h&&!h.isValid&&a.push(h)),a.length>0){if(!t&&a[0].invalidFields.length>0){this._validationSource.markAsInvalid(a[0].invalidFields[0],n.__record__id__),i();break}this.processValidationResult(a,n.__record__id__),i();break}}return s()}))}validateRequired(t){const s=this._validationSource.getRequiredFields(),i=[];if(new Set(s).forEach((s=>{const e=t[s];if(null==e||""===e){const e=this._validationSource.getMessageForField(s,t.__record__id__);i.push(e?{name:s,message:e}:{name:s,message:this._i18n("utils.requiredField")})}})),i.length>0)return{isValid:!1,invalidFields:i,infoMessage:this._i18n("utils.requiredFieldMessage")}}processValidationResult(t,s){t.forEach((t=>{const i=t.invalidFields;if(this._dataUnit.savingCanceled(i,s),i&&i.forEach((t=>{this.markAsInvalid(t,s)})),t.infoMessage&&r.info(t.infoMessage),t.errorMessage){const{errorTitle:s,errorMessage:i}=t;r.error(s,i)}}))}markAsInvalid(t,s){this._dataUnit.setInvalidField(t.name,t.message,s),this._validationSource.markAsInvalid(t,s)}}class u{constructor(t){this.onDataUnitEvent=t=>{var i;switch(t.type){case s.MULTIPLE_EDITION_CHANGED:this.clearInvalid(),this.updateAllFieldsValues();break;case s.DATA_LOADED:case s.DATA_SAVED:case s.RECORDS_REMOVED:case s.RECORDS_ADDED:case s.RECORDS_COPIED:case s.EDITION_CANCELED:case s.SELECTION_CHANGED:case s.NEXT_SELECTED:case s.PREVIOUS_SELECTED:this.clearInvalid();case s.DATA_CHANGED:case s.CHANGE_UNDONE:case s.CHANGE_REDONE:case s.RECORD_LOADED:this.updateAllFieldsValues(),this.clearFieldError(Object.keys(t.payload)[0]);break;case s.FIELD_INVALIDATED:null===(i=this._fields)||void 0===i||i.forEach((t=>{this.updateErrorMessage(t.fieldName,t.field)}))}},this._uuid=i.generateUUID(),this._fields=new Map,this._dataUnit=t,this.applyDefaultValues(),this._dataUnit.subscribe(this.onDataUnitEvent),this._dataUnit.addInterceptor(this),this.setContextDataBinder(t)}get dataBinderId(){return this._uuid}setContextDataBinder(t){const s=e.getContextValue("__DATABINDER_BY_DATAUNIT__")||new Map,i=[...s.get(t.dataUnitId)||[],this];s.set(t.dataUnitId,i),e.setContextValue("__DATABINDER_BY_DATAUNIT__",s)}applyDefaultValues(){const t=(this._dataUnit.getAddedRecords()||[]).map((t=>t.__record__id__));if(t.length>0){const s=this.getDefaultValues();s&&Object.keys(s).forEach((i=>{this._dataUnit.setFieldValue(i,s[i],t)}))}}bind(t,s,i,e){t.forEach((t=>{const{fieldName:i,contextName:e}=t.dataset;null!=e&&e!==s||this.updateBind(i,t)})),this._formMetadata=i,this._recordValidatorProcessor=new d(this._dataUnit,{getRequiredFields:()=>this.getFormRequiredFields(),markAsInvalid:t=>this.markInvalid(t),getMessageForField:t=>this.getErrorMessage(t)},e)}getFormRequiredFields(){return this._formMetadata.getRequiredFields()}disconnectDataUnit(){const t=e.getContextValue("__DATABINDER_BY_DATAUNIT__")||new Map,s=t.get(this._dataUnit.dataUnitId).filter((t=>t.dataBinderId!==this.dataBinderId));t.set(this._dataUnit.dataUnitId,s),e.setContextValue("__DATABINDER_BY_DATAUNIT__",t)}onDisconnectedCallback(){this._dataUnit.unsubscribe(this.onDataUnitEvent),this._dataUnit.removeInterceptor(this),this.disconnectDataUnit()}getCurrentRecordId(){const t=this._dataUnit.getSelectedRecord();return null==t?void 0:t.__record__id__}markInvalid(t){if(this._fields.has(t.name)){const s=this._fields.get(t.name).field;this.updateErrorMessage(t.name,s,t.message)}}setFocus(t){if(!this._fields.has(t))return;const s=this._fields.get(t).field;"function"==typeof s.setFocus&&s.setFocus()}clearInvalid(t){this._dataUnit.clearInvalid(t),this._fields.forEach((t=>{t.field.errorMessage=""}))}clearFieldError(t){var s;const i=null===(s=this._fields.get(t))||void 0===s?void 0:s.field;i&&i.errorMessage&&(i.errorMessage="",this._dataUnit.clearInvalid(this.getCurrentRecordId(),t))}updateFieldValue(t,s){const i=this._fields.get(t);try{i&&(i.listen=!1),this._dataUnit.isMultipleEdition&&this.hasMultipleValuesBetweenRecords(t)?(s.value=void 0,s.alternativePlaceholder="Múltiplos Valores"):(s.value=this._dataUnit.getFieldValue(t),s.alternativePlaceholder=void 0),this.updateErrorMessage(t,s)}finally{i&&(i.listen=!0)}}hasMultipleValuesBetweenRecords(t){var s,i;const e=null!==(i=null===(s=this._dataUnit.getSelectionInfo())||void 0===s?void 0:s.records)&&void 0!==i?i:[];if(e.length<=1)return!1;const a=e[0][t];return!e.every((s=>n.equals(s[t],a)))}validate(){return this._recordValidatorProcessor.validate()}static async validateByDataunit(t){try{const s=this.getDataBindersByDataUnit(t);return await Promise.all(s.map((t=>t.validate()))),!0}catch(t){return!1}}static getDataBindersByDataUnit(t){const s=e.getContextValue("__DATABINDER_BY_DATAUNIT__");return(null==s?void 0:s.get(t.dataUnitId))||[]}updateErrorMessage(t,s,i){null==i&&(i=this._dataUnit.getInvalidMessage(this.getCurrentRecordId(),t)),s.errorMessage||(s.errorMessage=i)}getErrorMessage(t){if(this._fields.has(t))return this._fields.get(t).field.errorMessage}updateBind(t,s){const i=this._fields.get(t);i&&i.destroy(),this.bindSearchOptionsLoader(t,s),this.updateFieldValue(t,s),this.updateErrorMessage(t,s),this._fields.set(t,_.create(t,s,((t,s)=>this.changeStarted(t,s)),(t=>this.cancelWaitingChange(t)),((t,s)=>this.setFieldValue(t,s)))),this.applyEzUploadContext(t,s)}changeStarted(t,s){if(0===this._dataUnit.records.length&&this._dataUnit.addRecord(),!s.blocking&&null==s.promise){const i=this._fields.get(t);i&&(s.promise=new Promise(((t,s)=>{i.waitingChangePromiseResolve=t,i.waitingChangePromiseReject=s})))}this._dataUnit.startChange(t,s)}cancelWaitingChange(t){if(this._dataUnit.waitingForChange(t)){this._dataUnit.cancelWaitingChange(t);const s=this._fields.get(t);s&&s.rejectWaitingChange(new a("Change canceled",t))}}setFieldValue(t,s){if(0===this._dataUnit.records.length&&this._dataUnit.addRecord(),this._dataUnit.clearInvalid(this.getCurrentRecordId(),t),this._dataUnit.isMultipleEdition){const i=this._dataUnit.getSelectionInfo();this._dataUnit.setFieldValue(t,s,i.recordIds)}else{const i=this._dataUnit.getSelectedRecord();this._dataUnit.setFieldValue(t,s,i?[i.__record__id__]:void 0)}if(this._dataUnit.waitingForChange(t)){const s=this._fields.get(t);s&&s.acceptWaitingChange()}}bindSearchOptionsLoader(t,s){if(("EZ-SEARCH"===s.nodeName||"EZ-SEARCH-PLUS"===s.nodeName)&&null==s.optionLoader){const i=e.getContextValue("EZ-SEARCH-PLUS"===s.nodeName?"__EZUI__SEARCH__PLUS__OPTION__LOADER__":"__EZUI__SEARCH__OPTION__LOADER__");i&&(s.optionLoader=(s,e)=>i(s,t,this._dataUnit,e))}}applyEzUploadContext(t,s){var i,n;if("EZ-UPLOAD"===s.nodeName){s.urlUpload=e.getContextValue("__EZUI__UPLOAD__ADD__URL__"),s.urlDelete=e.getContextValue("__EZUI__UPLOAD__DEL__URL__");const a=this._dataUnit.getField(t),h=null===(i=a.properties)||void 0===i?void 0:i.DESTINATION;h&&(s.requestHeaders={XTRAINF:`{"destination": "${h}"}`}),s.maxFiles=(null===(n=a.properties)||void 0===n?void 0:n.MAX_FILES)||0}}updateAllFieldsValues(){var t;null===(t=this._fields)||void 0===t||t.forEach((t=>{this.updateFieldValue(t.fieldName,t.field)}))}interceptAction(t){if(t.type===s.RECORDS_COPIED){const i=this._formMetadata.getCleanOnCopyFields();if(i)return new h(s.RECORDS_COPIED,t.payload.map((t=>{const s=Object.assign({},t);return i.forEach((t=>delete s[t])),s})))}if(t.type===s.SAVING_DATA)return new Promise((s=>{this.validate().then((()=>s(t))).catch((()=>{}))}));if(t.type===s.RECORDS_ADDED){const i=this.getDefaultValues();if(i)return new h(s.RECORDS_ADDED,t.payload.map((t=>Object.assign(Object.assign({},t),i))))}return t}getDefaultValues(){var t;const s=null===(t=this._formMetadata)||void 0===t?void 0:t.getDefaultValues();if(s){const t={};for(const i in s)t[i]=this._dataUnit.valueFromString(i,s[i]);return t}}}class _{constructor(){this.listen=!0,this.startChangeEventName="ezStartChange",this.cancelWaitingChangeEventName="ezCancelWaitingChange",this.changeEventName="ezChange"}destroy(){this.field.removeEventListener(this.startChangeEventName,this.startChangeListener),this.field.removeEventListener(this.cancelWaitingChangeEventName,this.cancelWaitingChangeListener),this.field.removeEventListener(this.changeEventName,this.changeListener)}acceptWaitingChange(){this.waitingChangePromiseResolve&&(this.waitingChangePromiseResolve(),this.waitingChangePromiseReject=void 0,this.waitingChangePromiseResolve=void 0)}rejectWaitingChange(t){this.waitingChangePromiseReject&&(this.waitingChangePromiseReject(t),this.waitingChangePromiseReject=void 0,this.waitingChangePromiseResolve=void 0)}static create(t,s,i,e,n){const a=new _;return a.field=s,a.fieldName=t,a.startChangeListener=s=>{a.listen&&i(t,s.detail)},a.field.addEventListener(a.startChangeEventName,a.startChangeListener),a.cancelWaitingChangeListener=()=>{a.listen&&e(t)},a.field.addEventListener(a.cancelWaitingChangeEventName,a.cancelWaitingChangeListener),a.changeListener=s=>{a.listen&&n(t,s.detail)},a.field.addEventListener(a.changeEventName,a.changeListener),a}}const v="ctrl+f",f=240,p=String(210)+"px",A=(t,s,i)=>l("ez-search",{class:"ez-padding--small ez-margin--none",style:{"--ez-text-input__margin-bottom":"0px","--ez-search--width":p},canShowError:!1,showSelectedValue:!1,showOptionValue:!1,suppressEmptyOption:!0,label:t.label,value:null,optionLoader:s,onEzChange:t=>i(t.detail),ignoreLimitCharsToSearch:!0}),g=async t=>{requestAnimationFrame((async()=>{if(t){const s=t.t;if(!s)return;s.value=null,await s.setFocus()}}))};export{u as D,d as R,v as S,A as a,c as b,f as c,g as f}
|
|
1
|
+
import{UserInterface as t,Action as s,StringUtils as i,ApplicationContext as e,ObjectUtils as n,WaitingChangeException as a,DataUnitAction as h}from"@sankhyalabs/core";import{A as r}from"./p-5a11cf56.js";import{g as o}from"./p-641ee538.js";import{h as l}from"./p-e4c7eb39.js";const c=(s,i)=>{var e,n;let a,h,{name:r,label:o,group:l}=Object.assign({},i),{readOnly:c,required:d}=Object.assign({},i);return s&&(o=o||s.label,r=r||s.name,d=null!==(e=s.required)&&void 0!==e?e:null==i?void 0:i.required,c=null!==(n=s.readOnly)&&void 0!==n?n:null==i?void 0:i.readOnly,a=s.properties,h=s.userInterface),{name:r,label:o,group:l,readOnly:c,required:d,props:a,userInterface:h||t.SHORTTEXT}};class d{constructor(t,s,i){this._dataUnit=t,this._validationSource=s,this._validator=i,this._i18n=o()}validate(t=!0){return new Promise(((s,i)=>{const e=this._dataUnit.getModifiedRecords();for(let s=0;s<e.length;s++){const n=e[s],a=[];let h=this.validateRequired(n);if(h&&!h.isValid&&a.push(h),this._validator&&(h=this._validator.validateRecord(n),h&&!h.isValid&&a.push(h)),a.length>0){if(!t&&a[0].invalidFields.length>0){this._validationSource.markAsInvalid(a[0].invalidFields[0],n.__record__id__),i();break}this.processValidationResult(a,n.__record__id__),i();break}}return s()}))}validateRequired(t){const s=this._validationSource.getRequiredFields(),i=[];if(new Set(s).forEach((s=>{const e=t[s];if(null==e||""===e){const e=this._validationSource.getMessageForField(s,t.__record__id__);i.push(e?{name:s,message:e}:{name:s,message:this._i18n("utils.requiredField")})}})),i.length>0)return{isValid:!1,invalidFields:i,infoMessage:this._i18n("utils.requiredFieldMessage")}}processValidationResult(t,s){t.forEach((t=>{const i=t.invalidFields;if(this._dataUnit.savingCanceled(i,s),i&&i.forEach((t=>{this.markAsInvalid(t,s)})),t.infoMessage&&r.info(t.infoMessage),t.errorMessage){const{errorTitle:s,errorMessage:i}=t;r.error(s,i)}}))}markAsInvalid(t,s){this._dataUnit.setInvalidField(t.name,t.message,s),this._validationSource.markAsInvalid(t,s)}}class u{constructor(t){this.onDataUnitEvent=t=>{var i;switch(t.type){case s.MULTIPLE_EDITION_CHANGED:this.clearInvalid(),this.updateAllFieldsValues();break;case s.DATA_LOADED:case s.DATA_SAVED:case s.RECORDS_REMOVED:case s.RECORDS_ADDED:case s.RECORDS_COPIED:case s.EDITION_CANCELED:case s.SELECTION_CHANGED:case s.NEXT_SELECTED:case s.PREVIOUS_SELECTED:this.clearInvalid();case s.DATA_CHANGED:case s.CHANGE_UNDONE:case s.CHANGE_REDONE:case s.RECORD_LOADED:this.updateAllFieldsValues(),this.clearFieldError(Object.keys(t.payload)[0]);break;case s.FIELD_INVALIDATED:null===(i=this._fields)||void 0===i||i.forEach((t=>{this.updateErrorMessage(t.fieldName,t.field)}))}},this._uuid=i.generateUUID(),this._fields=new Map,this._dataUnit=t,this.applyDefaultValues(),this._dataUnit.subscribe(this.onDataUnitEvent),this._dataUnit.addInterceptor(this),this.setContextDataBinder(t)}get dataBinderId(){return this._uuid}setContextDataBinder(t){const s=e.getContextValue("__DATABINDER_BY_DATAUNIT__")||new Map,i=[...s.get(t.dataUnitId)||[],this];s.set(t.dataUnitId,i),e.setContextValue("__DATABINDER_BY_DATAUNIT__",s)}applyDefaultValues(){const t=(this._dataUnit.getAddedRecords()||[]).map((t=>t.__record__id__));if(t.length>0){const s=this.getDefaultValues();s&&Object.keys(s).forEach((i=>{this._dataUnit.setFieldValue(i,s[i],t)}))}}bind(t,s,i,e){t.forEach((t=>{const{fieldName:i,contextName:e}=t.dataset;null!=e&&e!==s||this.updateBind(i,t)})),this._formMetadata=i,this._recordValidatorProcessor=new d(this._dataUnit,{getRequiredFields:()=>this.getFormRequiredFields(),markAsInvalid:t=>this.markInvalid(t),getMessageForField:t=>this.getErrorMessage(t)},e)}getFormRequiredFields(){return this._formMetadata.getRequiredFields()}disconnectDataUnit(){const t=e.getContextValue("__DATABINDER_BY_DATAUNIT__")||new Map,s=t.get(this._dataUnit.dataUnitId).filter((t=>t.dataBinderId!==this.dataBinderId));t.set(this._dataUnit.dataUnitId,s),e.setContextValue("__DATABINDER_BY_DATAUNIT__",t)}onDisconnectedCallback(){this._dataUnit.unsubscribe(this.onDataUnitEvent),this._dataUnit.removeInterceptor(this),this.disconnectDataUnit()}getCurrentRecordId(){const t=this._dataUnit.getSelectedRecord();return null==t?void 0:t.__record__id__}markInvalid(t){if(this._fields.has(t.name)){const s=this._fields.get(t.name).field;this.updateErrorMessage(t.name,s,t.message)}}setFocus(t){if(!this._fields.has(t))return;const s=this._fields.get(t).field;"function"==typeof s.setFocus&&s.setFocus()}clearInvalid(t){this._dataUnit.clearInvalid(t),this._fields.forEach((t=>{t.field.errorMessage=""}))}clearFieldError(t){var s;const i=null===(s=this._fields.get(t))||void 0===s?void 0:s.field;i&&i.errorMessage&&(i.errorMessage="",this._dataUnit.clearInvalid(this.getCurrentRecordId(),t))}updateFieldValue(t,s){const i=this._fields.get(t);try{i&&(i.listen=!1),this._dataUnit.isMultipleEdition&&this.hasMultipleValuesBetweenRecords(t)?(s.value=void 0,s.alternativePlaceholder="Múltiplos Valores"):(s.value=this._dataUnit.getFieldValue(t),s.alternativePlaceholder=void 0),this.updateErrorMessage(t,s)}finally{i&&(i.listen=!0)}}hasMultipleValuesBetweenRecords(t){var s,i;const e=null!==(i=null===(s=this._dataUnit.getSelectionInfo())||void 0===s?void 0:s.records)&&void 0!==i?i:[];if(e.length<=1)return!1;const a=e[0][t];return!e.every((s=>n.equals(s[t],a)))}validate(){return this._recordValidatorProcessor.validate()}static async validateByDataunit(t){try{const s=this.getDataBindersByDataUnit(t);return await Promise.all(s.map((t=>t.validate()))),!0}catch(t){return!1}}static getDataBindersByDataUnit(t){const s=e.getContextValue("__DATABINDER_BY_DATAUNIT__");return(null==s?void 0:s.get(t.dataUnitId))||[]}updateErrorMessage(t,s,i){null==i&&(i=this._dataUnit.getInvalidMessage(this.getCurrentRecordId(),t)),s.errorMessage||(s.errorMessage=i)}getErrorMessage(t){if(this._fields.has(t))return this._fields.get(t).field.errorMessage}updateBind(t,s){const i=this._fields.get(t);i&&i.destroy(),this.bindSearchOptionsLoader(t,s),this.updateFieldValue(t,s),this.updateErrorMessage(t,s),this._fields.set(t,_.create(t,s,((t,s)=>this.changeStarted(t,s)),(t=>this.cancelWaitingChange(t)),((t,s)=>this.setFieldValue(t,s)))),this.applyEzUploadContext(t,s)}changeStarted(t,s){if(0===this._dataUnit.records.length&&this._dataUnit.addRecord(),!s.blocking&&null==s.promise){const i=this._fields.get(t);i&&(s.promise=new Promise(((t,s)=>{i.waitingChangePromiseResolve=t,i.waitingChangePromiseReject=s})))}this._dataUnit.startChange(t,s)}cancelWaitingChange(t){if(this._dataUnit.waitingForChange(t)){this._dataUnit.cancelWaitingChange(t);const s=this._fields.get(t);s&&s.rejectWaitingChange(new a("Change canceled",t))}}setFieldValue(t,s){if(0===this._dataUnit.records.length&&this._dataUnit.addRecord(),this._dataUnit.clearInvalid(this.getCurrentRecordId(),t),this._dataUnit.isMultipleEdition){const i=this._dataUnit.getSelectionInfo();this._dataUnit.setFieldValue(t,s,i.recordIds)}else{const i=this._dataUnit.getSelectedRecord();this._dataUnit.setFieldValue(t,s,i?[i.__record__id__]:void 0)}if(this._dataUnit.waitingForChange(t)){const s=this._fields.get(t);s&&s.acceptWaitingChange()}}bindSearchOptionsLoader(t,s){if(("EZ-SEARCH"===s.nodeName||"EZ-SEARCH-PLUS"===s.nodeName)&&null==s.optionLoader){const i=e.getContextValue("EZ-SEARCH-PLUS"===s.nodeName?"__EZUI__SEARCH__PLUS__OPTION__LOADER__":"__EZUI__SEARCH__OPTION__LOADER__");i&&(s.optionLoader=(s,e)=>i(s,t,this._dataUnit,e))}}applyEzUploadContext(t,s){var i,n;if("EZ-UPLOAD"===s.nodeName){s.urlUpload=e.getContextValue("__EZUI__UPLOAD__ADD__URL__"),s.urlDelete=e.getContextValue("__EZUI__UPLOAD__DEL__URL__");const a=this._dataUnit.getField(t),h=null===(i=a.properties)||void 0===i?void 0:i.DESTINATION;h&&(s.requestHeaders={XTRAINF:`{"destination": "${h}"}`}),s.maxFiles=(null===(n=a.properties)||void 0===n?void 0:n.MAX_FILES)||0}}updateAllFieldsValues(){var t;null===(t=this._fields)||void 0===t||t.forEach((t=>{this.updateFieldValue(t.fieldName,t.field)}))}interceptAction(t){if(t.type===s.RECORDS_COPIED){const i=this._formMetadata.getCleanOnCopyFields();if(i)return new h(s.RECORDS_COPIED,t.payload.map((t=>{const s=Object.assign({},t);return i.forEach((t=>delete s[t])),s})))}if(t.type===s.SAVING_DATA)return new Promise((s=>{this.validate().then((()=>s(t))).catch((()=>{}))}));if(t.type===s.RECORDS_ADDED){const i=this.getDefaultValues();if(i)return new h(s.RECORDS_ADDED,t.payload.map((t=>Object.assign(Object.assign({},t),i))))}return t}getDefaultValues(){var t;const s=null===(t=this._formMetadata)||void 0===t?void 0:t.getDefaultValues();if(s){const t={};for(const i in s)t[i]=this._dataUnit.valueFromString(i,s[i]);return t}}}class _{constructor(){this.listen=!0,this.startChangeEventName="ezStartChange",this.cancelWaitingChangeEventName="ezCancelWaitingChange",this.changeEventName="ezChange"}destroy(){this.field.removeEventListener(this.startChangeEventName,this.startChangeListener),this.field.removeEventListener(this.cancelWaitingChangeEventName,this.cancelWaitingChangeListener),this.field.removeEventListener(this.changeEventName,this.changeListener)}acceptWaitingChange(){this.waitingChangePromiseResolve&&(this.waitingChangePromiseResolve(),this.waitingChangePromiseReject=void 0,this.waitingChangePromiseResolve=void 0)}rejectWaitingChange(t){this.waitingChangePromiseReject&&(this.waitingChangePromiseReject(t),this.waitingChangePromiseReject=void 0,this.waitingChangePromiseResolve=void 0)}static create(t,s,i,e,n){const a=new _;return a.field=s,a.fieldName=t,a.startChangeListener=s=>{a.listen&&i(t,s.detail)},a.field.addEventListener(a.startChangeEventName,a.startChangeListener),a.cancelWaitingChangeListener=()=>{a.listen&&e(t)},a.field.addEventListener(a.cancelWaitingChangeEventName,a.cancelWaitingChangeListener),a.changeListener=s=>{a.listen&&n(t,s.detail)},a.field.addEventListener(a.changeEventName,a.changeListener),a}}const v="ctrl+f",f=240,p=String(210)+"px",A=(t,s,i)=>l("ez-search",{class:"ez-padding--small ez-margin--none",style:{"--ez-text-input__margin-bottom":"0px","--ez-search--width":p},canShowError:!1,showSelectedValue:!1,showOptionValue:!1,suppressEmptyOption:!0,label:t.label,value:null,optionLoader:s,onEzChange:t=>i(t.detail),ignoreLimitCharsToSearch:!0}),g=async t=>{requestAnimationFrame((async()=>{if(t){const s=t.t;if(!s)return;s.value=null,await s.setFocus()}}))};export{u as D,d as R,v as S,A as a,c as b,f as c,g as f}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,h as n,H as r,g as s}from"./p-
|
|
1
|
+
import{r as e,h as n,H as r,g as s}from"./p-e4c7eb39.js";import{ElementIDUtils as i}from"@sankhyalabs/core";import{g as a}from"./p-641ee538.js";const t=class{constructor(n){e(this,n),this.size="small"}addInfoId(){this._element&&i.addIDInfo(this._element)}async componentWillLoad(){this.i18n=a()}componentDidLoad(){this.addInfoId()}render(){return n(r,null,n("div",{class:"spinner__container","data-size":this.size,role:"status","aria-label":this.i18n?this.i18n("spinner.loading"):"Carregando..."},n("svg",{viewBox:"0 0 24 24",class:"spinner__svg"},n("circle",{cx:"12",cy:"12",r:"10",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round",class:"spinner__path"}))))}get _element(){return s(this)}};t.style=':host{--ez-spinner--color:var(--color--ocean-green-600, #008561);--ez-spinner--size-default:24px;--ez-spinner--size-medium:32px;--ez-spinner--size-large:42px;--ez-spinner--animation-duration:1.4s;display:inline-flex;align-items:center;justify-content:center}.spinner__container{display:inline-flex;align-items:center;justify-content:center}.spinner__svg{color:var(--ez-spinner--color);width:var(--ez-spinner--size-default);height:var(--ez-spinner--size-default)}.spinner__container[data-size="medium"] .spinner__svg{width:var(--ez-spinner--size-medium);height:var(--ez-spinner--size-medium)}.spinner__container[data-size="large"] .spinner__svg{width:var(--ez-spinner--size-large);height:var(--ez-spinner--size-large)}.spinner__path{animation:spinner-dash var(--ez-spinner--animation-duration) ease-in-out infinite,\n spinner-rotate var(--ez-spinner--animation-duration) linear infinite;transform-origin:center;will-change:stroke-dasharray, stroke-dashoffset}@keyframes spinner-rotate{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes spinner-dash{0%{stroke-dasharray:1, 63;stroke-dashoffset:0}50%{stroke-dasharray:32, 63;stroke-dashoffset:-16}100%{stroke-dasharray:1, 63;stroke-dashoffset:-63}}';export{t as ez_spinner}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as i,h as s,H as h,g as n}from"./p-23a36bb6.js";import{StringUtils as r}from"@sankhyalabs/core";var e=function(t,i){return Number(t.slice(0,-1*i.length))},o=function(t){return t.endsWith("px")?{value:t,type:"px",numeric:e(t,"px")}:t.endsWith("fr")?{value:t,type:"fr",numeric:e(t,"fr")}:t.endsWith("%")?{value:t,type:"%",numeric:e(t,"%")}:"auto"===t?{value:t,type:"auto"}:null},u=function(t){return t.split(" ").map(o)},c=function(t,i,s){return i.concat(s).map((function(i){return i.style[t]})).filter((function(t){return void 0!==t&&""!==t}))},a=function(t){for(var i=0;i<t.length;i++)if(t[i].numeric>0)return i;return null},l=function(){return!1},d=function(t,i,s){t.style[i]=s},f=function(t,i,s){var h=t[i];return void 0!==h?h:s};function m(t){var i;return(i=[]).concat.apply(i,Array.from(t.ownerDocument.styleSheets).map((function(t){var i=[];try{i=Array.from(t.cssRules||[])}catch(t){}return i}))).filter((function(i){var s=!1;try{s=t.matches(i.selectorText)}catch(t){}return s}))}var w=function(t,i,s){this.direction=t,this.element=i.element,this.track=i.track,"column"===t?(this.gridTemplateProp="grid-template-columns",this.gridGapProp="grid-column-gap",this.cursor=f(s,"columnCursor",f(s,"cursor","col-resize")),this.snapOffset=f(s,"columnSnapOffset",f(s,"snapOffset",30)),this.dragInterval=f(s,"columnDragInterval",f(s,"dragInterval",1)),this.clientAxis="clientX",this.optionStyle=f(s,"gridTemplateColumns")):"row"===t&&(this.gridTemplateProp="grid-template-rows",this.gridGapProp="grid-row-gap",this.cursor=f(s,"rowCursor",f(s,"cursor","row-resize")),this.snapOffset=f(s,"rowSnapOffset",f(s,"snapOffset",30)),this.dragInterval=f(s,"rowDragInterval",f(s,"dragInterval",1)),this.clientAxis="clientY",this.optionStyle=f(s,"gridTemplateRows")),this.onDragStart=f(s,"onDragStart",l),this.onDragEnd=f(s,"onDragEnd",l),this.onDrag=f(s,"onDrag",l),this.writeStyle=f(s,"writeStyle",d),this.startDragging=this.startDragging.bind(this),this.stopDragging=this.stopDragging.bind(this),this.drag=this.drag.bind(this),this.minSizeStart=i.minSizeStart,this.minSizeEnd=i.minSizeEnd,i.element&&(this.element.addEventListener("mousedown",this.startDragging),this.element.addEventListener("touchstart",this.startDragging))};w.prototype.getDimensions=function(){var t=this.grid.getBoundingClientRect(),i=t.width,s=t.height,h=t.bottom,n=t.left,r=t.right;"column"===this.direction?(this.start=t.top,this.end=h,this.size=s):"row"===this.direction&&(this.start=n,this.end=r,this.size=i)},w.prototype.getSizeAtTrack=function(t,i){return function(t,i,s,h){return void 0===s&&(s=0),void 0===h&&(h=!1),i.slice(0,h?t+1:t).reduce((function(t,i){return t+i.numeric}),0)+(s?t*s:0)}(t,this.computedPixels,this.computedGapPixels,i)},w.prototype.getSizeOfTrack=function(t){return this.computedPixels[t].numeric},w.prototype.getRawTracks=function(){var t=c(this.gridTemplateProp,[this.grid],m(this.grid));if(!t.length){if(this.optionStyle)return this.optionStyle;throw Error("Unable to determine grid template tracks from styles.")}return t[0]},w.prototype.getGap=function(){var t=c(this.gridGapProp,[this.grid],m(this.grid));return t.length?t[0]:null},w.prototype.getRawComputedTracks=function(){return window.getComputedStyle(this.grid)[this.gridTemplateProp]},w.prototype.getRawComputedGap=function(){return window.getComputedStyle(this.grid)[this.gridGapProp]},w.prototype.setTracks=function(t){this.tracks=t.split(" "),this.trackValues=u(t)},w.prototype.setComputedTracks=function(t){this.computedTracks=t.split(" "),this.computedPixels=u(t)},w.prototype.setGap=function(t){this.gap=t},w.prototype.setComputedGap=function(t){var i;this.computedGap=t,this.computedGapPixels=((i=this.computedGap).endsWith("px")?Number(i.slice(0,-1*"px".length)):null)||0},w.prototype.getMousePosition=function(t){return"touches"in t?t.touches[0][this.clientAxis]:t[this.clientAxis]},w.prototype.startDragging=function(t){if(!("button"in t)||0===t.button){t.preventDefault(),this.grid=this.element?this.element.parentNode:t.target.parentNode,this.getDimensions(),this.setTracks(this.getRawTracks()),this.setComputedTracks(this.getRawComputedTracks()),this.setGap(this.getGap()),this.setComputedGap(this.getRawComputedGap());var i=this.trackValues.filter((function(t){return"%"===t.type})),s=this.trackValues.filter((function(t){return"fr"===t.type}));if(this.totalFrs=s.length,this.totalFrs){var h=a(s);null!==h&&(this.frToPixels=this.computedPixels[h].numeric/s[h].numeric)}if(i.length){var n=a(i);null!==n&&(this.percentageToPixels=this.computedPixels[n].numeric/i[n].numeric)}var r=this.getSizeAtTrack(this.track,!1)+this.start;if(this.dragStartOffset=this.getMousePosition(t)-r,this.aTrack=this.track-1,!(this.track<this.tracks.length-1))throw Error("Invalid track index: "+this.track+". Track must be between two other tracks and only "+this.tracks.length+" tracks were found.");this.bTrack=this.track+1,this.aTrackStart=this.getSizeAtTrack(this.aTrack,!1)+this.start,this.bTrackEnd=this.getSizeAtTrack(this.bTrack,!0)+this.start,this.dragging=!0,window.addEventListener("mouseup",this.stopDragging),window.addEventListener("touchend",this.stopDragging),window.addEventListener("touchcancel",this.stopDragging),window.addEventListener("mousemove",this.drag),window.addEventListener("touchmove",this.drag),this.grid.addEventListener("selectstart",l),this.grid.addEventListener("dragstart",l),this.grid.style.userSelect="none",this.grid.style.webkitUserSelect="none",this.grid.style.MozUserSelect="none",this.grid.style.pointerEvents="none",this.grid.style.cursor=this.cursor,window.document.body.style.cursor=this.cursor,this.onDragStart(this.direction,this.track)}},w.prototype.stopDragging=function(){this.dragging=!1,this.cleanup(),this.onDragEnd(this.direction,this.track),this.needsDestroy&&(this.element&&(this.element.removeEventListener("mousedown",this.startDragging),this.element.removeEventListener("touchstart",this.startDragging)),this.destroyCb(),this.needsDestroy=!1,this.destroyCb=null)},w.prototype.drag=function(t){var i=this.getMousePosition(t),s=this.getSizeOfTrack(this.track),h=this.aTrackStart+this.minSizeStart+this.dragStartOffset+this.computedGapPixels,n=this.bTrackEnd-this.minSizeEnd-this.computedGapPixels-(s-this.dragStartOffset);i<h+this.snapOffset&&(i=h),i>n-this.snapOffset&&(i=n),i<h?i=h:i>n&&(i=n);var r=i-this.aTrackStart-this.dragStartOffset-this.computedGapPixels,e=this.bTrackEnd-i+this.dragStartOffset-s-this.computedGapPixels;if(this.dragInterval>1){var o=Math.round(r/this.dragInterval)*this.dragInterval;e-=o-r,r=o}r<this.minSizeStart&&(r=this.minSizeStart),e<this.minSizeEnd&&(e=this.minSizeEnd),"px"===this.trackValues[this.aTrack].type?this.tracks[this.aTrack]=r+"px":"fr"===this.trackValues[this.aTrack].type?this.tracks[this.aTrack]=1===this.totalFrs?"1fr":r/this.frToPixels+"fr":"%"===this.trackValues[this.aTrack].type&&(this.tracks[this.aTrack]=r/this.percentageToPixels+"%"),"px"===this.trackValues[this.bTrack].type?this.tracks[this.bTrack]=e+"px":"fr"===this.trackValues[this.bTrack].type?this.tracks[this.bTrack]=1===this.totalFrs?"1fr":e/this.frToPixels+"fr":"%"===this.trackValues[this.bTrack].type&&(this.tracks[this.bTrack]=e/this.percentageToPixels+"%");var u=this.tracks.join(" ");this.writeStyle(this.grid,this.gridTemplateProp,u),this.onDrag(this.direction,this.track,u)},w.prototype.cleanup=function(){window.removeEventListener("mouseup",this.stopDragging),window.removeEventListener("touchend",this.stopDragging),window.removeEventListener("touchcancel",this.stopDragging),window.removeEventListener("mousemove",this.drag),window.removeEventListener("touchmove",this.drag),this.grid&&(this.grid.removeEventListener("selectstart",l),this.grid.removeEventListener("dragstart",l),this.grid.style.userSelect="",this.grid.style.webkitUserSelect="",this.grid.style.MozUserSelect="",this.grid.style.pointerEvents="",this.grid.style.cursor=""),window.document.body.style.cursor=""},w.prototype.destroy=function(t,i){void 0===t&&(t=!0),t||!1===this.dragging?(this.cleanup(),this.element&&(this.element.removeEventListener("mousedown",this.startDragging),this.element.removeEventListener("touchstart",this.startDragging)),i&&i()):(this.needsDestroy=!0,i&&(this.destroyCb=i))};var v=function(t,i,s){return i in t?t[i]:s},p=function(t,i){return function(s){if(s.track<1)throw Error("Invalid track index: "+s.track+". Track must be between two other tracks.");var h="column"===t?i.columnMinSizes||{}:i.rowMinSizes||{},n="column"===t?"columnMinSize":"rowMinSize";return new w(t,Object.assign({},{minSizeStart:v(h,s.track-1,f(i,n,f(i,"minSize",0))),minSizeEnd:v(h,s.track+1,f(i,n,f(i,"minSize",0)))},s),i)}},g=function(t){var i=this;this.columnGutters={},this.rowGutters={},this.options=Object.assign({},{columnGutters:t.columnGutters||[],rowGutters:t.rowGutters||[],columnMinSizes:t.columnMinSizes||{},rowMinSizes:t.rowMinSizes||{}},t),this.options.columnGutters.forEach((function(t){i.columnGutters[t.track]=p("column",i.options)(t)})),this.options.rowGutters.forEach((function(t){i.rowGutters[t.track]=p("row",i.options)(t)}))};g.prototype.addColumnGutter=function(t,i){this.columnGutters[i]&&this.columnGutters[i].destroy(),this.columnGutters[i]=p("column",this.options)({element:t,track:i})},g.prototype.addRowGutter=function(t,i){this.rowGutters[i]&&this.rowGutters[i].destroy(),this.rowGutters[i]=p("row",this.options)({element:t,track:i})},g.prototype.removeColumnGutter=function(t,i){var s=this;void 0===i&&(i=!0),this.columnGutters[t]&&this.columnGutters[t].destroy(i,(function(){delete s.columnGutters[t]}))},g.prototype.removeRowGutter=function(t,i){var s=this;void 0===i&&(i=!0),this.rowGutters[t]&&this.rowGutters[t].destroy(i,(function(){delete s.rowGutters[t]}))},g.prototype.handleDragStart=function(t,i,s){"column"===i?(this.columnGutters[s]&&this.columnGutters[s].destroy(),this.columnGutters[s]=p("column",this.options)({track:s}),this.columnGutters[s].startDragging(t)):"row"===i&&(this.rowGutters[s]&&this.rowGutters[s].destroy(),this.rowGutters[s]=p("row",this.options)({track:s}),this.rowGutters[s].startDragging(t))},g.prototype.destroy=function(t){var i=this;void 0===t&&(t=!0),Object.keys(this.columnGutters).forEach((function(s){return i.columnGutters[s].destroy(t,(function(){delete i.columnGutters[s]}))})),Object.keys(this.rowGutters).forEach((function(s){return i.rowGutters[s].destroy(t,(function(){delete i.rowGutters[s]}))}))};const b=class{constructor(s){t(this,s),this.resizeEnd=i(this,"resizeEnd",7),this._items=[],this._buildInProgress=!1,this.direction="column",this.anchorToExpand=!1,this.structural=!1}rebuildLayout(){Array.from(this._element.querySelectorAll(".ez-split-gutter")).reverse().forEach((t=>{t.remove()})),Array.from(this._element.getElementsByTagName("EzSplitPanel")).reverse().forEach((t=>{t.rebuildLayout()})),this.buildItems(),this.initSplit()}buildItems(){this._panelID=r.generateUUID(),this._element.dataset.panelId=this._panelID,this._element.dataset.uniqueId="EzSplitPanel";let t=Array.from(this._element.children);this._items=t.filter((t=>{var i;return"EZ-SPLIT-ITEM"===(null===(i=t.tagName)||void 0===i?void 0:i.toUpperCase())}));let i=1;this._items.forEach(((t,s)=>{t.dataset.trackNumber=i.toString(),this._items.length>1&&s!=this._items.length-1&&this.addItemGutter(t),i+=2}))}componentDidLoad(){this.buildItems(),this.initSplit(),this._mutationObserver=new MutationObserver((t=>{for(const i of t)if("childList"===i.type&&!this._buildInProgress){this._buildInProgress=!0,window.requestAnimationFrame((()=>{this.rebuildLayout()})),window.requestAnimationFrame((()=>this._buildInProgress=!1));break}})),this._mutationObserver.observe(this._element,{childList:!0,subtree:!1})}disconnectedCallback(){null!=this._mutationObserver&&this._mutationObserver.disconnect()}initSplit(){var t;this._items.length&&(this._element.style["row"===this.direction?"grid-template-rows":"grid-template-columns"]=this.getGridTemplate(),this.removeGuttersMargin(),t=this.getGutters(),new g(t))}handlePanelDragEnd(){const t=this._items.map((t=>({id:t.id,height:t.clientHeight,width:t.clientWidth})));this.resizeEnd.emit({panelId:this._element.id,items:t})}getGutters(){const t={columnGutters:[],rowGutters:[],onDragEnd:()=>this.handlePanelDragEnd()};if(!this._items.length)return t;const i="row"===this.direction?"rowGutters":"columnGutters";return this._items.forEach(((s,h)=>{if(h===this._items.length-1)return;let n=s.dataset.trackNumber;h===this._items.length-1&&(n=this._items.length.toString()),t[i].push({track:Number(n),element:this._element.querySelector(`ez-split-panel[data-panel-id="${this._panelID}"] > [data-item-track="${s.dataset.trackNumber}"]`)})})),t}addItemGutter(t){const i=document.createElement("div");i.classList.add("ez-split-gutter"),i.classList.add(this.direction),i.classList.add("row"===this.direction?"ez-split-gutter__row":"ez-split-gutter__column"),i.dataset.itemTrack=`${t.dataset.trackNumber}`,i.dataset.trackNumber=(Number(t.dataset.trackNumber)+1).toString(),t.parentNode.insertBefore(i,t.nextSibling)}getElementStyle(){return{display:"grid",height:"100%",width:"100%",position:this.anchorToExpand?"relative":"unset"}}calcFreeSpacePercentage(){const t=this._items.reduce(((t,i)=>{var s;return t+((null===(s=i.size)||void 0===s?void 0:s.includes("%"))?Number(i.size.replace("%","")):0)}),0),i=this._items.filter((t=>void 0===t.size)).length;return i&&t?(100-t)/i:null}getGridTemplate(){let t="";const i=this.calcFreeSpacePercentage();return this._items.forEach(((s,h)=>{let n=s.size||"1fr";!s.size&&i&&(n=`${i}%`),t+=h!==this._items.length-1?0!==h?` ${n} 5px`:`${n} 5px`:` ${n}`})),t}removeGuttersMargin(){this._items.length<=1||("column"!=this.direction?"row"!=this.direction||this.removeGuttersMarginRow():this.removeGuttersMarginColumn())}removeGuttersMarginColumn(){this._items.forEach(((t,i)=>{0!=i?i!==this._items.length-1?(t.style.marginRight="0",t.style.marginLeft="0"):t.style.marginLeft="0":t.style.marginRight="0"}))}removeGuttersMarginRow(){this._items.length<=1||this._items.forEach(((t,i)=>{0!=i?i!==this._items.length-1?(t.style.marginBottom="0",t.style.marginTop="0"):t.style.marginTop="0":t.style.marginBottom="0"}))}render(){return s(h,{class:this.structural?"structural__panel":"content__panel",style:this.getElementStyle()})}get _element(){return n(this)}};b.style=".ez-split-gutter{cursor:grab;background-color:transparent;max-width:100%}.ez-split-gutter__row{cursor:ns-resize}.ez-split-gutter__column{cursor:ew-resize}.structural__panel{background:none;box-shadow:none;outline:none;padding:0;margin:0;border:0}";export{b as ez_split_panel}
|
|
1
|
+
import{r as t,c as i,h as s,H as h,g as n}from"./p-e4c7eb39.js";import{StringUtils as r}from"@sankhyalabs/core";var e=function(t,i){return Number(t.slice(0,-1*i.length))},o=function(t){return t.endsWith("px")?{value:t,type:"px",numeric:e(t,"px")}:t.endsWith("fr")?{value:t,type:"fr",numeric:e(t,"fr")}:t.endsWith("%")?{value:t,type:"%",numeric:e(t,"%")}:"auto"===t?{value:t,type:"auto"}:null},u=function(t){return t.split(" ").map(o)},c=function(t,i,s){return i.concat(s).map((function(i){return i.style[t]})).filter((function(t){return void 0!==t&&""!==t}))},a=function(t){for(var i=0;i<t.length;i++)if(t[i].numeric>0)return i;return null},l=function(){return!1},d=function(t,i,s){t.style[i]=s},f=function(t,i,s){var h=t[i];return void 0!==h?h:s};function m(t){var i;return(i=[]).concat.apply(i,Array.from(t.ownerDocument.styleSheets).map((function(t){var i=[];try{i=Array.from(t.cssRules||[])}catch(t){}return i}))).filter((function(i){var s=!1;try{s=t.matches(i.selectorText)}catch(t){}return s}))}var w=function(t,i,s){this.direction=t,this.element=i.element,this.track=i.track,"column"===t?(this.gridTemplateProp="grid-template-columns",this.gridGapProp="grid-column-gap",this.cursor=f(s,"columnCursor",f(s,"cursor","col-resize")),this.snapOffset=f(s,"columnSnapOffset",f(s,"snapOffset",30)),this.dragInterval=f(s,"columnDragInterval",f(s,"dragInterval",1)),this.clientAxis="clientX",this.optionStyle=f(s,"gridTemplateColumns")):"row"===t&&(this.gridTemplateProp="grid-template-rows",this.gridGapProp="grid-row-gap",this.cursor=f(s,"rowCursor",f(s,"cursor","row-resize")),this.snapOffset=f(s,"rowSnapOffset",f(s,"snapOffset",30)),this.dragInterval=f(s,"rowDragInterval",f(s,"dragInterval",1)),this.clientAxis="clientY",this.optionStyle=f(s,"gridTemplateRows")),this.onDragStart=f(s,"onDragStart",l),this.onDragEnd=f(s,"onDragEnd",l),this.onDrag=f(s,"onDrag",l),this.writeStyle=f(s,"writeStyle",d),this.startDragging=this.startDragging.bind(this),this.stopDragging=this.stopDragging.bind(this),this.drag=this.drag.bind(this),this.minSizeStart=i.minSizeStart,this.minSizeEnd=i.minSizeEnd,i.element&&(this.element.addEventListener("mousedown",this.startDragging),this.element.addEventListener("touchstart",this.startDragging))};w.prototype.getDimensions=function(){var t=this.grid.getBoundingClientRect(),i=t.width,s=t.height,h=t.bottom,n=t.left,r=t.right;"column"===this.direction?(this.start=t.top,this.end=h,this.size=s):"row"===this.direction&&(this.start=n,this.end=r,this.size=i)},w.prototype.getSizeAtTrack=function(t,i){return function(t,i,s,h){return void 0===s&&(s=0),void 0===h&&(h=!1),i.slice(0,h?t+1:t).reduce((function(t,i){return t+i.numeric}),0)+(s?t*s:0)}(t,this.computedPixels,this.computedGapPixels,i)},w.prototype.getSizeOfTrack=function(t){return this.computedPixels[t].numeric},w.prototype.getRawTracks=function(){var t=c(this.gridTemplateProp,[this.grid],m(this.grid));if(!t.length){if(this.optionStyle)return this.optionStyle;throw Error("Unable to determine grid template tracks from styles.")}return t[0]},w.prototype.getGap=function(){var t=c(this.gridGapProp,[this.grid],m(this.grid));return t.length?t[0]:null},w.prototype.getRawComputedTracks=function(){return window.getComputedStyle(this.grid)[this.gridTemplateProp]},w.prototype.getRawComputedGap=function(){return window.getComputedStyle(this.grid)[this.gridGapProp]},w.prototype.setTracks=function(t){this.tracks=t.split(" "),this.trackValues=u(t)},w.prototype.setComputedTracks=function(t){this.computedTracks=t.split(" "),this.computedPixels=u(t)},w.prototype.setGap=function(t){this.gap=t},w.prototype.setComputedGap=function(t){var i;this.computedGap=t,this.computedGapPixels=((i=this.computedGap).endsWith("px")?Number(i.slice(0,-1*"px".length)):null)||0},w.prototype.getMousePosition=function(t){return"touches"in t?t.touches[0][this.clientAxis]:t[this.clientAxis]},w.prototype.startDragging=function(t){if(!("button"in t)||0===t.button){t.preventDefault(),this.grid=this.element?this.element.parentNode:t.target.parentNode,this.getDimensions(),this.setTracks(this.getRawTracks()),this.setComputedTracks(this.getRawComputedTracks()),this.setGap(this.getGap()),this.setComputedGap(this.getRawComputedGap());var i=this.trackValues.filter((function(t){return"%"===t.type})),s=this.trackValues.filter((function(t){return"fr"===t.type}));if(this.totalFrs=s.length,this.totalFrs){var h=a(s);null!==h&&(this.frToPixels=this.computedPixels[h].numeric/s[h].numeric)}if(i.length){var n=a(i);null!==n&&(this.percentageToPixels=this.computedPixels[n].numeric/i[n].numeric)}var r=this.getSizeAtTrack(this.track,!1)+this.start;if(this.dragStartOffset=this.getMousePosition(t)-r,this.aTrack=this.track-1,!(this.track<this.tracks.length-1))throw Error("Invalid track index: "+this.track+". Track must be between two other tracks and only "+this.tracks.length+" tracks were found.");this.bTrack=this.track+1,this.aTrackStart=this.getSizeAtTrack(this.aTrack,!1)+this.start,this.bTrackEnd=this.getSizeAtTrack(this.bTrack,!0)+this.start,this.dragging=!0,window.addEventListener("mouseup",this.stopDragging),window.addEventListener("touchend",this.stopDragging),window.addEventListener("touchcancel",this.stopDragging),window.addEventListener("mousemove",this.drag),window.addEventListener("touchmove",this.drag),this.grid.addEventListener("selectstart",l),this.grid.addEventListener("dragstart",l),this.grid.style.userSelect="none",this.grid.style.webkitUserSelect="none",this.grid.style.MozUserSelect="none",this.grid.style.pointerEvents="none",this.grid.style.cursor=this.cursor,window.document.body.style.cursor=this.cursor,this.onDragStart(this.direction,this.track)}},w.prototype.stopDragging=function(){this.dragging=!1,this.cleanup(),this.onDragEnd(this.direction,this.track),this.needsDestroy&&(this.element&&(this.element.removeEventListener("mousedown",this.startDragging),this.element.removeEventListener("touchstart",this.startDragging)),this.destroyCb(),this.needsDestroy=!1,this.destroyCb=null)},w.prototype.drag=function(t){var i=this.getMousePosition(t),s=this.getSizeOfTrack(this.track),h=this.aTrackStart+this.minSizeStart+this.dragStartOffset+this.computedGapPixels,n=this.bTrackEnd-this.minSizeEnd-this.computedGapPixels-(s-this.dragStartOffset);i<h+this.snapOffset&&(i=h),i>n-this.snapOffset&&(i=n),i<h?i=h:i>n&&(i=n);var r=i-this.aTrackStart-this.dragStartOffset-this.computedGapPixels,e=this.bTrackEnd-i+this.dragStartOffset-s-this.computedGapPixels;if(this.dragInterval>1){var o=Math.round(r/this.dragInterval)*this.dragInterval;e-=o-r,r=o}r<this.minSizeStart&&(r=this.minSizeStart),e<this.minSizeEnd&&(e=this.minSizeEnd),"px"===this.trackValues[this.aTrack].type?this.tracks[this.aTrack]=r+"px":"fr"===this.trackValues[this.aTrack].type?this.tracks[this.aTrack]=1===this.totalFrs?"1fr":r/this.frToPixels+"fr":"%"===this.trackValues[this.aTrack].type&&(this.tracks[this.aTrack]=r/this.percentageToPixels+"%"),"px"===this.trackValues[this.bTrack].type?this.tracks[this.bTrack]=e+"px":"fr"===this.trackValues[this.bTrack].type?this.tracks[this.bTrack]=1===this.totalFrs?"1fr":e/this.frToPixels+"fr":"%"===this.trackValues[this.bTrack].type&&(this.tracks[this.bTrack]=e/this.percentageToPixels+"%");var u=this.tracks.join(" ");this.writeStyle(this.grid,this.gridTemplateProp,u),this.onDrag(this.direction,this.track,u)},w.prototype.cleanup=function(){window.removeEventListener("mouseup",this.stopDragging),window.removeEventListener("touchend",this.stopDragging),window.removeEventListener("touchcancel",this.stopDragging),window.removeEventListener("mousemove",this.drag),window.removeEventListener("touchmove",this.drag),this.grid&&(this.grid.removeEventListener("selectstart",l),this.grid.removeEventListener("dragstart",l),this.grid.style.userSelect="",this.grid.style.webkitUserSelect="",this.grid.style.MozUserSelect="",this.grid.style.pointerEvents="",this.grid.style.cursor=""),window.document.body.style.cursor=""},w.prototype.destroy=function(t,i){void 0===t&&(t=!0),t||!1===this.dragging?(this.cleanup(),this.element&&(this.element.removeEventListener("mousedown",this.startDragging),this.element.removeEventListener("touchstart",this.startDragging)),i&&i()):(this.needsDestroy=!0,i&&(this.destroyCb=i))};var v=function(t,i,s){return i in t?t[i]:s},p=function(t,i){return function(s){if(s.track<1)throw Error("Invalid track index: "+s.track+". Track must be between two other tracks.");var h="column"===t?i.columnMinSizes||{}:i.rowMinSizes||{},n="column"===t?"columnMinSize":"rowMinSize";return new w(t,Object.assign({},{minSizeStart:v(h,s.track-1,f(i,n,f(i,"minSize",0))),minSizeEnd:v(h,s.track+1,f(i,n,f(i,"minSize",0)))},s),i)}},g=function(t){var i=this;this.columnGutters={},this.rowGutters={},this.options=Object.assign({},{columnGutters:t.columnGutters||[],rowGutters:t.rowGutters||[],columnMinSizes:t.columnMinSizes||{},rowMinSizes:t.rowMinSizes||{}},t),this.options.columnGutters.forEach((function(t){i.columnGutters[t.track]=p("column",i.options)(t)})),this.options.rowGutters.forEach((function(t){i.rowGutters[t.track]=p("row",i.options)(t)}))};g.prototype.addColumnGutter=function(t,i){this.columnGutters[i]&&this.columnGutters[i].destroy(),this.columnGutters[i]=p("column",this.options)({element:t,track:i})},g.prototype.addRowGutter=function(t,i){this.rowGutters[i]&&this.rowGutters[i].destroy(),this.rowGutters[i]=p("row",this.options)({element:t,track:i})},g.prototype.removeColumnGutter=function(t,i){var s=this;void 0===i&&(i=!0),this.columnGutters[t]&&this.columnGutters[t].destroy(i,(function(){delete s.columnGutters[t]}))},g.prototype.removeRowGutter=function(t,i){var s=this;void 0===i&&(i=!0),this.rowGutters[t]&&this.rowGutters[t].destroy(i,(function(){delete s.rowGutters[t]}))},g.prototype.handleDragStart=function(t,i,s){"column"===i?(this.columnGutters[s]&&this.columnGutters[s].destroy(),this.columnGutters[s]=p("column",this.options)({track:s}),this.columnGutters[s].startDragging(t)):"row"===i&&(this.rowGutters[s]&&this.rowGutters[s].destroy(),this.rowGutters[s]=p("row",this.options)({track:s}),this.rowGutters[s].startDragging(t))},g.prototype.destroy=function(t){var i=this;void 0===t&&(t=!0),Object.keys(this.columnGutters).forEach((function(s){return i.columnGutters[s].destroy(t,(function(){delete i.columnGutters[s]}))})),Object.keys(this.rowGutters).forEach((function(s){return i.rowGutters[s].destroy(t,(function(){delete i.rowGutters[s]}))}))};const b=class{constructor(s){t(this,s),this.resizeEnd=i(this,"resizeEnd",7),this._items=[],this._buildInProgress=!1,this.direction="column",this.anchorToExpand=!1,this.structural=!1}rebuildLayout(){Array.from(this._element.querySelectorAll(".ez-split-gutter")).reverse().forEach((t=>{t.remove()})),Array.from(this._element.getElementsByTagName("EzSplitPanel")).reverse().forEach((t=>{t.rebuildLayout()})),this.buildItems(),this.initSplit()}buildItems(){this._panelID=r.generateUUID(),this._element.dataset.panelId=this._panelID,this._element.dataset.uniqueId="EzSplitPanel";let t=Array.from(this._element.children);this._items=t.filter((t=>{var i;return"EZ-SPLIT-ITEM"===(null===(i=t.tagName)||void 0===i?void 0:i.toUpperCase())}));let i=1;this._items.forEach(((t,s)=>{t.dataset.trackNumber=i.toString(),this._items.length>1&&s!=this._items.length-1&&this.addItemGutter(t),i+=2}))}componentDidLoad(){this.buildItems(),this.initSplit(),this._mutationObserver=new MutationObserver((t=>{for(const i of t)if("childList"===i.type&&!this._buildInProgress){this._buildInProgress=!0,window.requestAnimationFrame((()=>{this.rebuildLayout()})),window.requestAnimationFrame((()=>this._buildInProgress=!1));break}})),this._mutationObserver.observe(this._element,{childList:!0,subtree:!1})}disconnectedCallback(){null!=this._mutationObserver&&this._mutationObserver.disconnect()}initSplit(){var t;this._items.length&&(this._element.style["row"===this.direction?"grid-template-rows":"grid-template-columns"]=this.getGridTemplate(),this.removeGuttersMargin(),t=this.getGutters(),new g(t))}handlePanelDragEnd(){const t=this._items.map((t=>({id:t.id,height:t.clientHeight,width:t.clientWidth})));this.resizeEnd.emit({panelId:this._element.id,items:t})}getGutters(){const t={columnGutters:[],rowGutters:[],onDragEnd:()=>this.handlePanelDragEnd()};if(!this._items.length)return t;const i="row"===this.direction?"rowGutters":"columnGutters";return this._items.forEach(((s,h)=>{if(h===this._items.length-1)return;let n=s.dataset.trackNumber;h===this._items.length-1&&(n=this._items.length.toString()),t[i].push({track:Number(n),element:this._element.querySelector(`ez-split-panel[data-panel-id="${this._panelID}"] > [data-item-track="${s.dataset.trackNumber}"]`)})})),t}addItemGutter(t){const i=document.createElement("div");i.classList.add("ez-split-gutter"),i.classList.add(this.direction),i.classList.add("row"===this.direction?"ez-split-gutter__row":"ez-split-gutter__column"),i.dataset.itemTrack=`${t.dataset.trackNumber}`,i.dataset.trackNumber=(Number(t.dataset.trackNumber)+1).toString(),t.parentNode.insertBefore(i,t.nextSibling)}getElementStyle(){return{display:"grid",height:"100%",width:"100%",position:this.anchorToExpand?"relative":"unset"}}calcFreeSpacePercentage(){const t=this._items.reduce(((t,i)=>{var s;return t+((null===(s=i.size)||void 0===s?void 0:s.includes("%"))?Number(i.size.replace("%","")):0)}),0),i=this._items.filter((t=>void 0===t.size)).length;return i&&t?(100-t)/i:null}getGridTemplate(){let t="";const i=this.calcFreeSpacePercentage();return this._items.forEach(((s,h)=>{let n=s.size||"1fr";!s.size&&i&&(n=`${i}%`),t+=h!==this._items.length-1?0!==h?` ${n} 5px`:`${n} 5px`:` ${n}`})),t}removeGuttersMargin(){this._items.length<=1||("column"!=this.direction?"row"!=this.direction||this.removeGuttersMarginRow():this.removeGuttersMarginColumn())}removeGuttersMarginColumn(){this._items.forEach(((t,i)=>{0!=i?i!==this._items.length-1?(t.style.marginRight="0",t.style.marginLeft="0"):t.style.marginLeft="0":t.style.marginRight="0"}))}removeGuttersMarginRow(){this._items.length<=1||this._items.forEach(((t,i)=>{0!=i?i!==this._items.length-1?(t.style.marginBottom="0",t.style.marginTop="0"):t.style.marginTop="0":t.style.marginBottom="0"}))}render(){return s(h,{class:this.structural?"structural__panel":"content__panel",style:this.getElementStyle()})}get _element(){return n(this)}};b.style=".ez-split-gutter{cursor:grab;background-color:transparent;max-width:100%}.ez-split-gutter__row{cursor:ns-resize}.ez-split-gutter__column{cursor:ew-resize}.structural__panel{background:none;box-shadow:none;outline:none;padding:0;margin:0;border:0}";export{b as ez_split_panel}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,c as t,h as i,H as r,g as s}from"./p-23a36bb6.js";import{StringUtils as a,KeyboardManager as o,ElementIDUtils as l}from"@sankhyalabs/core";import"./p-5a11cf56.js";import{C as n}from"./p-ec7db713.js";import"./p-ab574d59.js";import"./p-b853763b.js";import{i as h}from"./p-641ee538.js";import{S as c}from"./p-30ffb9ed.js";const d=class{constructor(i){e(this,i),this.ezChange=t(this,"ezChange",7),this.SEARCH_DESCRIPTION_TIMEOUT=300,this.INTERVAL_TO_RETRY_ASYNC_VALUE=100,this.value=void 0,this.enabled=!0,this.disableCodeInput=!1,this.disableDescriptionInput=!1,this.label=void 0,this.codLabel=void 0,this.hideDescriptionInput=!1,this.canShowError=!0,this.errorMessage=void 0,this.mode="regular",this.contextProperties=void 0,this.optionLoader=void 0,this.showOptionValue=!0,this.stopPropagateEnterKeyEvent=!1,this.autoFocus=!1,this.showSelectedValue=!0,this.suppressEmptyOption=!1,this.hideErrorOnFocusOut=!0,this.listOptionsPosition=void 0,this.isTextSearch=!1,this.ignoreLimitCharsToSearch=!1,this.suppressSearch=!1,this.suppressPreLoad=!0,this.ensureClearButtonVisible=!1,this.descriptionValue="",this.codeValue="",this.isLoadingDescription=!1,this.searchDescriptionIsOpen=!1,this.visibleOptions=void 0,this.showLoading=!0}async observeValue(e,t){const i=this.normalizeValueToCodeValue(e);if(i!==this.normalizeValueToCodeValue(t)){if(void 0===i)return this.codeValue=void 0,this.descriptionValue=void 0,void this.ezChange.emit(void 0);this.codeValue=i;try{if(this.descriptionValue=await this.normalizeCodeToDescriptionValue(e),null==this.descriptionValue)throw new Error("Valor não encontrado!")}catch(e){throw this.value=void 0,console.warn("[EzSearchPlus] Erro ao obter descrição do registro.",e),e}this.value=this.buildCurrentValue(),this.ezChange.emit(this.value)}}canShowLoadSpinDescription(){return this.isLoadingDescription}async setFocus(e){var t;this.disableCodeInput?null===(t=this._textInputDescriptionValue)||void 0===t||t.setFocus(e):this._latestFocusedInputElement?this._latestFocusedInputElement.setFocus(e):this._textInputCodeValue.setFocus(e)}async getValueAsync(){if(!this.isLoadingDescription){const e=this.buildCurrentValue();return new Promise((t=>t(e)))}return new Promise((e=>{let t=setInterval((()=>{if(!this.isLoadingDescription){clearInterval(t);const i=this.buildCurrentValue();e(i)}}),this.INTERVAL_TO_RETRY_ASYNC_VALUE)}))}async clearValue(){this.clearSearch()}async setBlur(){var e,t;null===(e=this._textInputCodeValue)||void 0===e||e.setBlur(),null===(t=this._textInputDescriptionValue)||void 0===t||t.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async componentWillLoad(){this.i18n=await h(),this.value&&a.isEmpty(this.codeValue)&&await this.observeValue(this.value,void 0)}componentDidLoad(){n.applyVarsTextInput(this.el,this._textInputCodeValue),n.applyVarsTextInput(this.el,this._textInputDescriptionValue)}connectedCallback(){this.initKeyboardManager(),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}clearSearch(){this.value=null,this.descriptionValue=null,this._textInputDescriptionValue.value=null}getCodLabel(){var e;return this.hideDescriptionInput?this.label:null!==(e=this.codLabel)&&void 0!==e?e:this.i18n("ez-search-plus.defaultCodeLabel")}async normalizeCodeToDescriptionValue(e){if(!e)return"";if("string"==typeof e)try{if((null==(e=JSON.parse(e))?void 0:e.value)&&!(null==e?void 0:e.label))return await this.loadDescriptionValueByCode(null==e?void 0:e.value)}catch(t){return await this.loadDescriptionValueByCode(e)}return"object"!=typeof e?await this.loadDescriptionValueByCode(e):null==e?void 0:e.label}normalizeValueToCodeValue(e){if(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(t){return e}return"object"!=typeof e?"number"==typeof e?String(e):e:null==e?void 0:e.value}}async loadDescriptionValueByCode(e){if(!this.optionLoader)return console.warn(this.i18n("ez-search-plus.optionLoaderNotDefined")),"";try{this.isLoadingDescription=!0;const t={mode:c.LOAD_DESCRIPTION,argument:e},i=await this.optionLoader(t);return i?Array.isArray(i)?i[0].label:i.label:""}finally{this.isLoadingDescription=!1}}handleCodeInputFocusOut(){this.cancelSelection(),this.codeValue!=this._textInputCodeValue.value&&(this.value=this._textInputCodeValue.value)}handleSearchClick(){this.loadAdvancedSearch()}async loadAdvancedSearch(){if(!this.optionLoader)return void console.warn(this.i18n("ez-search-plus.optionLoaderNotDefined"));const e={mode:c.ADVANCED,argument:""};let t;try{t=await this.optionLoader(e,this.contextProperties)}catch(e){}t&&(this.value=t)}buildCurrentValue(){if(!a.isEmpty(this.codeValue))return{value:this.codeValue,label:this.descriptionValue}}async handleTextInputChangeHandler(e){this.searchDescriptionIsOpen||this._popover.showUnder(this.el);const t=e.target.value;await this.debounceLoaderOptions(t)}async debounceLoaderOptions(e){return this._debounceSearch&&clearTimeout(this._debounceSearch),new Promise((t=>{this._debounceSearch=setTimeout((async()=>{await this.processOptionsLoader(e),t()}),this.SEARCH_DESCRIPTION_TIMEOUT)}))}updateKeyOption(e){return Object.assign(Object.assign({},e),{presentationValue:e.value,presentationLabel:e.label})}parseSearchOptions(e=[]){if(Array.isArray(e)){const t=e[0];return t?"label"in t||"value"in t?e.map((e=>this.updateKeyOption(e))):e:[]}return("label"in e||"value"in e)&&this.updateKeyOption(e),[e]}async processOptionsLoader(e){try{this.showLoading=!0;const t={mode:c.PREDICTIVE,argument:e},i=await this.optionLoader(t);this.visibleOptions=this.parseSearchOptions(i)}finally{this.showLoading=!1}}handleSelectItem(e){this.value=e.detail,this._popover.hide(),window.requestAnimationFrame((()=>{var e;null===(e=this._textInputDescriptionValue)||void 0===e||e.setFocus({selectText:!0})}))}async handleArrowUp(){this.isOptionsVisible()&&await this._searchList.previousOption()}async handleArrowDown(){this.isOptionsVisible()&&await this._searchList.nextOption()}async selectCurrentItem(){var e;await(null===(e=this._searchList)||void 0===e?void 0:e.selectCurrentItem())}async cancelSelection(){var e,t,i;const r="object"==typeof this.value?null===(e=this.value)||void 0===e?void 0:e.label:"";this._textInputDescriptionValue&&r&&this._textInputDescriptionValue.value!=r&&(this._textInputDescriptionValue.value=r),await(null===(t=this._searchList)||void 0===t?void 0:t.cancelSelection()),null===(i=this._popover)||void 0===i||i.hide()}async handleInputTab(){await this.cancelSelection()}async handleInputEsc(){var e;await this.cancelSelection(),await(null===(e=this._latestFocusedInputElement)||void 0===e?void 0:e.setFocus({selectText:!0}))}async initKeyboardManager(){this._keyboardManager=new o;const e={element:this.el,propagate:!0};this._keyboardManager.bind("ArrowUp",(()=>this.handleArrowUp()),Object.assign(Object.assign({},e),{propagate:!1})).bind("ArrowDown",(()=>this.handleArrowDown()),Object.assign(Object.assign({},e),{propagate:!1})).bind("Enter",(()=>this.selectCurrentItem()),Object.assign(Object.assign({},e),{propagate:!this.stopPropagateEnterKeyEvent})).bind("Tab",(()=>this.handleInputTab()),e).bind("Escape",(()=>this.handleInputEsc()),e)}disconnectedCallback(){this._keyboardManager.unbind("ArrowUp").unbind("ArrowDown").unbind("Enter").unbind("Tab").unbind("Escape")}isOptionsVisible(){return this._popover.opened}setLatestFocusedInputElement(e){this._latestFocusedInputElement=e}handleCodeInputFocus(){this.setLatestFocusedInputElement(this._textInputCodeValue)}handleDescriptionInputFocus(){this.setLatestFocusedInputElement(this._textInputDescriptionValue)}getRightIconElement(){var e,t;return this.ensureClearButtonVisible||this.value||(null===(e=this._textInputCodeValue)||void 0===e?void 0:e.value)||(null===(t=this._textInputDescriptionValue)||void 0===t?void 0:t.value)?i("button",{class:"btn btn__close",slot:"rightIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.clearSearch()},i("ez-icon",{iconName:"close"})):null}getLeftIconElement(){return i("button",{class:"btn",slot:"leftIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.handleSearchClick()},this.canShowLoadSpinDescription()?i("div",{class:"message__loading"}):i("ez-icon",{iconName:"search"}))}handleOnEzVisibilityChange(e){e.stopPropagation(),this.searchDescriptionIsOpen=e.detail}render(){return l.addIDInfoIfNotExists(this.el,"input"),i(r,null,i("div",{class:"ez-search-plus__container"},i("ez-text-input",{ref:e=>this._textInputCodeValue=e,class:{"ez-search-plus__code-input":!this.hideDescriptionInput,"ez-search-plus__code-input-no-border":!this.hideDescriptionInput,"ez-search-plus__code-input-full":this.hideDescriptionInput},"data-element-id":l.getInternalIDInfo("codeInput"),"data-slave-mode":"true",enabled:!this.disableCodeInput&&this.enabled,mode:this.mode,label:this.getCodLabel(),canShowError:this.canShowError,hasInvalid:!a.isEmpty(this.errorMessage),errorMessage:this.hideDescriptionInput?this.errorMessage:"",value:this.codeValue,onFocusout:()=>this.handleCodeInputFocusOut(),onFocus:()=>this.handleCodeInputFocus()},this.getLeftIconElement()),!this.hideDescriptionInput&&i("div",{class:"description-input-container"},i("ez-text-input",{ref:e=>this._textInputDescriptionValue=e,tabIndex:-1,class:"ez-search-plus__text-input","data-element-id":l.getInternalIDInfo("textInput"),"data-slave-mode":"true",enabled:!this.disableDescriptionInput&&this.enabled,label:this.label,canShowError:this.canShowError,errorMessage:this.errorMessage,mode:this.mode,value:this.descriptionValue,onInput:e=>this.handleTextInputChangeHandler(e),onFocus:()=>this.handleDescriptionInputFocus()},this.getRightIconElement()),i("ez-popover-plus",{ref:e=>this._popover=e,anchorElement:this.el,autoClose:!0,boxWidth:"fit-content",overlayType:"none",useAnchorSize:!0,onEzVisibilityChange:e=>this.handleOnEzVisibilityChange(e),"data-element-id":this.el.getAttribute("data-element-id")},i("ez-search-result-list",{ref:e=>this._searchList=e,showLoading:this.showLoading,visibleOptions:this.visibleOptions,value:this.value,showOptionValue:this.showOptionValue,onChangeValue:e=>this.handleSelectItem(e)})))))}get el(){return s(this)}static get watchers(){return{value:["observeValue"]}}};d.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__list-title--primary:var(--title--primary, #2B3A54);--ez-search__list-text--primary:var(--text--primary, #626e82);--ez-search__list-height:calc(var(--ez-search--font-size) + var(--ez-search--space--medium) + 4px);--ez-search__list-min-width:64px;--ez-search--space--medium:var(--space--medium, 12px);--ez-search--space--small:var(--space--small, 6px);--ez-search__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-search__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-search__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-search__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-search__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-search__scrollbar--width:var(--space--medium, 12px);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)}.list-container{min-width:var(--ez-search__list-min-width);overflow:auto;position:relative;width:100%}.list-wrapper{display:flex;flex-direction:column;box-sizing:border-box;width:0;z-index:var(--more-visible, 2);max-height:350px;min-width:150px;background-color:var(--ez-search--background-color--xlight);border-radius:var(--ez-search--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.list-options{margin-top:0px;box-sizing:border-box;width:100%;height:100%;padding:0;display:flex;flex-direction:column;scroll-behavior:smooth;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:var(--ez-search__scrollbar--color-clicked) var(--ez-search__scrollbar--color-background)}.list-options::-webkit-scrollbar{background-color:var(--scrollbar--background);width:var(--space--small);max-width:var(--space--small);min-width:var(--space--small);height:var(--space--small);max-height:var(--space--small);min-height:var(--space--small)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-search__scrollbar--color-background);border-radius:var(--ez-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-search__scrollbar--color-default);border-radius:var(--ez-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb:vertical:hover,.list-options::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-search__scrollbar--color-hover)}.list-options::-webkit-scrollbar-thumb:vertical:active,.list-options::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-search__scrollbar--color-clicked)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-search--border-radius-small);gap:var(--space--small, 6px)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-search__list-title--primary);font-family:var(--ez-search--font-family);font-size:var(--ez-search--font-size);line-height:var(--ez-search--line-height)}.item__label{font-weight:var(--ez-search--font-weight--medium)}.item__label--bold{font-weight:var(--ez-search--font-weight--large)}.item__value{text-align:center;color:var(--ez-search__list-text--primary);font-weight:var(--ez-search--font-weight--large)}.item__value--hidden{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}.item__label{text-align:left}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;min-height:var(--ez-search__list-height)}.message__no-result{color:var(--ez-search__list-title--primary);font-family:var(--ez-search--font-family);font-size:var(--ez-search--font-size)}.message__loading{border-radius:50%;width:14px;height:14px;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:3px solid var(--ez-search__list-title--primary);border-top:3px solid transparent}.item__list>li:hover{background-color:var(--ez-search--background-medium)}.preselected{background-color:var(--background--medium)}.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}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@supports not (scrollbar-width: thin){.item{padding-right:8px}}.ez-search-plus__container{display:flex;flex-grow:1;gap:3px}.ez-search-plus__text-input{--ez-text-input--border-top-left-radius:0px;--ez-text-input--border-bottom-left-radius:0px;outline:none}.ez-search-plus__code-input-no-border{--ez-text-input--border-top-right-radius:0px;--ez-text-input--border-bottom-right-radius:0px}.ez-search-plus__code-input{max-width:85px}.ez-search-plus__code-input-full{width:100%}.description-input-container{width:100%;outline:none}";export{d as ez_search_plus}
|
|
1
|
+
import{r as e,c as t,h as i,H as r,g as s}from"./p-e4c7eb39.js";import{StringUtils as a,KeyboardManager as o,ElementIDUtils as l}from"@sankhyalabs/core";import"./p-5a11cf56.js";import{C as n}from"./p-ec7db713.js";import"./p-ab574d59.js";import"./p-b853763b.js";import{i as h}from"./p-641ee538.js";import{S as c}from"./p-30ffb9ed.js";const d=class{constructor(i){e(this,i),this.ezChange=t(this,"ezChange",7),this.SEARCH_DESCRIPTION_TIMEOUT=300,this.INTERVAL_TO_RETRY_ASYNC_VALUE=100,this.value=void 0,this.enabled=!0,this.disableCodeInput=!1,this.disableDescriptionInput=!1,this.label=void 0,this.codLabel=void 0,this.hideDescriptionInput=!1,this.canShowError=!0,this.errorMessage=void 0,this.mode="regular",this.contextProperties=void 0,this.optionLoader=void 0,this.showOptionValue=!0,this.stopPropagateEnterKeyEvent=!1,this.autoFocus=!1,this.showSelectedValue=!0,this.suppressEmptyOption=!1,this.hideErrorOnFocusOut=!0,this.listOptionsPosition=void 0,this.isTextSearch=!1,this.ignoreLimitCharsToSearch=!1,this.suppressSearch=!1,this.suppressPreLoad=!0,this.ensureClearButtonVisible=!1,this.descriptionValue="",this.codeValue="",this.isLoadingDescription=!1,this.searchDescriptionIsOpen=!1,this.visibleOptions=void 0,this.showLoading=!0}async observeValue(e,t){const i=this.normalizeValueToCodeValue(e);if(i!==this.normalizeValueToCodeValue(t)){if(void 0===i)return this.codeValue=void 0,this.descriptionValue=void 0,void this.ezChange.emit(void 0);this.codeValue=i;try{if(this.descriptionValue=await this.normalizeCodeToDescriptionValue(e),null==this.descriptionValue)throw new Error("Valor não encontrado!")}catch(e){throw this.value=void 0,console.warn("[EzSearchPlus] Erro ao obter descrição do registro.",e),e}this.value=this.buildCurrentValue(),this.ezChange.emit(this.value)}}canShowLoadSpinDescription(){return this.isLoadingDescription}async setFocus(e){var t;this.disableCodeInput?null===(t=this._textInputDescriptionValue)||void 0===t||t.setFocus(e):this._latestFocusedInputElement?this._latestFocusedInputElement.setFocus(e):this._textInputCodeValue.setFocus(e)}async getValueAsync(){if(!this.isLoadingDescription){const e=this.buildCurrentValue();return new Promise((t=>t(e)))}return new Promise((e=>{let t=setInterval((()=>{if(!this.isLoadingDescription){clearInterval(t);const i=this.buildCurrentValue();e(i)}}),this.INTERVAL_TO_RETRY_ASYNC_VALUE)}))}async clearValue(){this.clearSearch()}async setBlur(){var e,t;null===(e=this._textInputCodeValue)||void 0===e||e.setBlur(),null===(t=this._textInputDescriptionValue)||void 0===t||t.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async componentWillLoad(){this.i18n=await h(),this.value&&a.isEmpty(this.codeValue)&&await this.observeValue(this.value,void 0)}componentDidLoad(){n.applyVarsTextInput(this.el,this._textInputCodeValue),n.applyVarsTextInput(this.el,this._textInputDescriptionValue)}connectedCallback(){this.initKeyboardManager(),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}clearSearch(){this.value=null,this.descriptionValue=null,this._textInputDescriptionValue.value=null}getCodLabel(){var e;return this.hideDescriptionInput?this.label:null!==(e=this.codLabel)&&void 0!==e?e:this.i18n("ez-search-plus.defaultCodeLabel")}async normalizeCodeToDescriptionValue(e){if(!e)return"";if("string"==typeof e)try{if((null==(e=JSON.parse(e))?void 0:e.value)&&!(null==e?void 0:e.label))return await this.loadDescriptionValueByCode(null==e?void 0:e.value)}catch(t){return await this.loadDescriptionValueByCode(e)}return"object"!=typeof e?await this.loadDescriptionValueByCode(e):null==e?void 0:e.label}normalizeValueToCodeValue(e){if(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(t){return e}return"object"!=typeof e?"number"==typeof e?String(e):e:null==e?void 0:e.value}}async loadDescriptionValueByCode(e){if(!this.optionLoader)return console.warn(this.i18n("ez-search-plus.optionLoaderNotDefined")),"";try{this.isLoadingDescription=!0;const t={mode:c.LOAD_DESCRIPTION,argument:e},i=await this.optionLoader(t);return i?Array.isArray(i)?i[0].label:i.label:""}finally{this.isLoadingDescription=!1}}handleCodeInputFocusOut(){this.cancelSelection(),this.codeValue!=this._textInputCodeValue.value&&(this.value=this._textInputCodeValue.value)}handleSearchClick(){this.loadAdvancedSearch()}async loadAdvancedSearch(){if(!this.optionLoader)return void console.warn(this.i18n("ez-search-plus.optionLoaderNotDefined"));const e={mode:c.ADVANCED,argument:""};let t;try{t=await this.optionLoader(e,this.contextProperties)}catch(e){}t&&(this.value=t)}buildCurrentValue(){if(!a.isEmpty(this.codeValue))return{value:this.codeValue,label:this.descriptionValue}}async handleTextInputChangeHandler(e){this.searchDescriptionIsOpen||this._popover.showUnder(this.el);const t=e.target.value;await this.debounceLoaderOptions(t)}async debounceLoaderOptions(e){return this._debounceSearch&&clearTimeout(this._debounceSearch),new Promise((t=>{this._debounceSearch=setTimeout((async()=>{await this.processOptionsLoader(e),t()}),this.SEARCH_DESCRIPTION_TIMEOUT)}))}updateKeyOption(e){return Object.assign(Object.assign({},e),{presentationValue:e.value,presentationLabel:e.label})}parseSearchOptions(e=[]){if(Array.isArray(e)){const t=e[0];return t?"label"in t||"value"in t?e.map((e=>this.updateKeyOption(e))):e:[]}return("label"in e||"value"in e)&&this.updateKeyOption(e),[e]}async processOptionsLoader(e){try{this.showLoading=!0;const t={mode:c.PREDICTIVE,argument:e},i=await this.optionLoader(t);this.visibleOptions=this.parseSearchOptions(i)}finally{this.showLoading=!1}}handleSelectItem(e){this.value=e.detail,this._popover.hide(),window.requestAnimationFrame((()=>{var e;null===(e=this._textInputDescriptionValue)||void 0===e||e.setFocus({selectText:!0})}))}async handleArrowUp(){this.isOptionsVisible()&&await this._searchList.previousOption()}async handleArrowDown(){this.isOptionsVisible()&&await this._searchList.nextOption()}async selectCurrentItem(){var e;await(null===(e=this._searchList)||void 0===e?void 0:e.selectCurrentItem())}async cancelSelection(){var e,t,i;const r="object"==typeof this.value?null===(e=this.value)||void 0===e?void 0:e.label:"";this._textInputDescriptionValue&&r&&this._textInputDescriptionValue.value!=r&&(this._textInputDescriptionValue.value=r),await(null===(t=this._searchList)||void 0===t?void 0:t.cancelSelection()),null===(i=this._popover)||void 0===i||i.hide()}async handleInputTab(){await this.cancelSelection()}async handleInputEsc(){var e;await this.cancelSelection(),await(null===(e=this._latestFocusedInputElement)||void 0===e?void 0:e.setFocus({selectText:!0}))}async initKeyboardManager(){this._keyboardManager=new o;const e={element:this.el,propagate:!0};this._keyboardManager.bind("ArrowUp",(()=>this.handleArrowUp()),Object.assign(Object.assign({},e),{propagate:!1})).bind("ArrowDown",(()=>this.handleArrowDown()),Object.assign(Object.assign({},e),{propagate:!1})).bind("Enter",(()=>this.selectCurrentItem()),Object.assign(Object.assign({},e),{propagate:!this.stopPropagateEnterKeyEvent})).bind("Tab",(()=>this.handleInputTab()),e).bind("Escape",(()=>this.handleInputEsc()),e)}disconnectedCallback(){this._keyboardManager.unbind("ArrowUp").unbind("ArrowDown").unbind("Enter").unbind("Tab").unbind("Escape")}isOptionsVisible(){return this._popover.opened}setLatestFocusedInputElement(e){this._latestFocusedInputElement=e}handleCodeInputFocus(){this.setLatestFocusedInputElement(this._textInputCodeValue)}handleDescriptionInputFocus(){this.setLatestFocusedInputElement(this._textInputDescriptionValue)}getRightIconElement(){var e,t;return this.ensureClearButtonVisible||this.value||(null===(e=this._textInputCodeValue)||void 0===e?void 0:e.value)||(null===(t=this._textInputDescriptionValue)||void 0===t?void 0:t.value)?i("button",{class:"btn btn__close",slot:"rightIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.clearSearch()},i("ez-icon",{iconName:"close"})):null}getLeftIconElement(){return i("button",{class:"btn",slot:"leftIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.handleSearchClick()},this.canShowLoadSpinDescription()?i("div",{class:"message__loading"}):i("ez-icon",{iconName:"search"}))}handleOnEzVisibilityChange(e){e.stopPropagation(),this.searchDescriptionIsOpen=e.detail}render(){return l.addIDInfoIfNotExists(this.el,"input"),i(r,null,i("div",{class:"ez-search-plus__container"},i("ez-text-input",{ref:e=>this._textInputCodeValue=e,class:{"ez-search-plus__code-input":!this.hideDescriptionInput,"ez-search-plus__code-input-no-border":!this.hideDescriptionInput,"ez-search-plus__code-input-full":this.hideDescriptionInput},"data-element-id":l.getInternalIDInfo("codeInput"),"data-slave-mode":"true",enabled:!this.disableCodeInput&&this.enabled,mode:this.mode,label:this.getCodLabel(),canShowError:this.canShowError,hasInvalid:!a.isEmpty(this.errorMessage),errorMessage:this.hideDescriptionInput?this.errorMessage:"",value:this.codeValue,onFocusout:()=>this.handleCodeInputFocusOut(),onFocus:()=>this.handleCodeInputFocus()},this.getLeftIconElement()),!this.hideDescriptionInput&&i("div",{class:"description-input-container"},i("ez-text-input",{ref:e=>this._textInputDescriptionValue=e,tabIndex:-1,class:"ez-search-plus__text-input","data-element-id":l.getInternalIDInfo("textInput"),"data-slave-mode":"true",enabled:!this.disableDescriptionInput&&this.enabled,label:this.label,canShowError:this.canShowError,errorMessage:this.errorMessage,mode:this.mode,value:this.descriptionValue,onInput:e=>this.handleTextInputChangeHandler(e),onFocus:()=>this.handleDescriptionInputFocus()},this.getRightIconElement()),i("ez-popover-plus",{ref:e=>this._popover=e,anchorElement:this.el,autoClose:!0,boxWidth:"fit-content",overlayType:"none",useAnchorSize:!0,onEzVisibilityChange:e=>this.handleOnEzVisibilityChange(e),"data-element-id":this.el.getAttribute("data-element-id")},i("ez-search-result-list",{ref:e=>this._searchList=e,showLoading:this.showLoading,visibleOptions:this.visibleOptions,value:this.value,showOptionValue:this.showOptionValue,onChangeValue:e=>this.handleSelectItem(e)})))))}get el(){return s(this)}static get watchers(){return{value:["observeValue"]}}};d.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__list-title--primary:var(--title--primary, #2B3A54);--ez-search__list-text--primary:var(--text--primary, #626e82);--ez-search__list-height:calc(var(--ez-search--font-size) + var(--ez-search--space--medium) + 4px);--ez-search__list-min-width:64px;--ez-search--space--medium:var(--space--medium, 12px);--ez-search--space--small:var(--space--small, 6px);--ez-search__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-search__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-search__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-search__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-search__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-search__scrollbar--width:var(--space--medium, 12px);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)}.list-container{min-width:var(--ez-search__list-min-width);overflow:auto;position:relative;width:100%}.list-wrapper{display:flex;flex-direction:column;box-sizing:border-box;width:0;z-index:var(--more-visible, 2);max-height:350px;min-width:150px;background-color:var(--ez-search--background-color--xlight);border-radius:var(--ez-search--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.list-options{margin-top:0px;box-sizing:border-box;width:100%;height:100%;padding:0;display:flex;flex-direction:column;scroll-behavior:smooth;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:var(--ez-search__scrollbar--color-clicked) var(--ez-search__scrollbar--color-background)}.list-options::-webkit-scrollbar{background-color:var(--scrollbar--background);width:var(--space--small);max-width:var(--space--small);min-width:var(--space--small);height:var(--space--small);max-height:var(--space--small);min-height:var(--space--small)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-search__scrollbar--color-background);border-radius:var(--ez-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-search__scrollbar--color-default);border-radius:var(--ez-search__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb:vertical:hover,.list-options::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-search__scrollbar--color-hover)}.list-options::-webkit-scrollbar-thumb:vertical:active,.list-options::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-search__scrollbar--color-clicked)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-search--border-radius-small);gap:var(--space--small, 6px)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-search__list-title--primary);font-family:var(--ez-search--font-family);font-size:var(--ez-search--font-size);line-height:var(--ez-search--line-height)}.item__label{font-weight:var(--ez-search--font-weight--medium)}.item__label--bold{font-weight:var(--ez-search--font-weight--large)}.item__value{text-align:center;color:var(--ez-search__list-text--primary);font-weight:var(--ez-search--font-weight--large)}.item__value--hidden{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}.item__label{text-align:left}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;min-height:var(--ez-search__list-height)}.message__no-result{color:var(--ez-search__list-title--primary);font-family:var(--ez-search--font-family);font-size:var(--ez-search--font-size)}.message__loading{border-radius:50%;width:14px;height:14px;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:3px solid var(--ez-search__list-title--primary);border-top:3px solid transparent}.item__list>li:hover{background-color:var(--ez-search--background-medium)}.preselected{background-color:var(--background--medium)}.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}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@supports not (scrollbar-width: thin){.item{padding-right:8px}}.ez-search-plus__container{display:flex;flex-grow:1;gap:3px}.ez-search-plus__text-input{--ez-text-input--border-top-left-radius:0px;--ez-text-input--border-bottom-left-radius:0px;outline:none}.ez-search-plus__code-input-no-border{--ez-text-input--border-top-right-radius:0px;--ez-text-input--border-bottom-right-radius:0px}.ez-search-plus__code-input{max-width:85px}.ez-search-plus__code-input-full{width:100%}.description-input-container{width:100%;outline:none}";export{d as ez_search_plus}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as e,h as i,H as s,g as a}from"./p-
|
|
1
|
+
import{r as t,c as e,h as i,H as s,g as a}from"./p-e4c7eb39.js";import{DateUtils as n,ElementIDUtils as o}from"@sankhyalabs/core";import{C as r}from"./p-ec7db713.js";import{i as h}from"./p-641ee538.js";const l=class{constructor(i){t(this,i),this.ezChange=e(this,"ezChange",7),this.ezStartChange=e(this,"ezStartChange",7),this.ezCancelWaitingChange=e(this,"ezCancelWaitingChange",7),this._changePending=!1,this._focused=!1,this._valuePromiseCallbacks=[],this.label=void 0,this.value=void 0,this.enabled=!0,this.errorMessage=void 0,this.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,e){if(this._textInput&&t!=e){const i=n.validateDate(t),s=n.validateDate(e);if((null==i?void 0:i.getTime())!==(null==s?void 0:s.getTime())){const t=this.getTextValue(i)||"";!n.strToDate(t)&&this._focused||(this._textInput.value||"")===t||(this._textInput.value=t,this._focused=!1,this.errorMessage=""),this.ezChange.emit(null===i?void 0:i)}}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 e=n.validateDate(this.value),i=n.validateDate(t);(null==e?void 0:e.getTime())!==(null==i?void 0:i.getTime())?this.value=i:this._changePending=!1}hideCalendar(){this.changeValue(this._calendar.value),this._popover.hide()}handleBlur(){if(this._changePending)try{const t=this._textInput.value,e=n.strToDate(t);if(e||!t){this.errorMessage="";const t=n.validateDate(this.value),i=n.validateDate(e);(null==t?void 0:t.getTime())===(null==i?void 0:i.getTime())?(i&&(this._textInput.value=this.getTextValue(i)||"",this._focused=!1),this.ezCancelWaitingChange.emit()):(this._focused=!1,this.changeValue(i))}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 e=n.strToDate(this._textInput.value),i=n.validateDate(this.value),s=n.validateDate(e);(null==i?void 0:i.getTime())!==(null==s?void 0:s.getTime())&&(this._changePending=!0,this._focused=!0,this.ezStartChange.emit({waitmessage:"",blocking:!1})),"H"!==t.data&&"h"!==t.data||this.changeValue(new Date)}setInputValue(){const t=this.getTextValue(this.value)||"";(this._textInput.value||"")!==t&&(this._textInput.value=t)}disconnectedCallback(){this._popover.hide()}async componentWillLoad(){this.i18n=await h()}componentDidLoad(){r.applyVarsTextInput(this._elem,this._textInput),this.setInputValue(),this.autoFocus&&requestAnimationFrame((()=>{this.setFocus({selectText:!0})}))}render(){return o.addIDInfoIfNotExists(this._elem,"input"),i(s,null,i("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},i("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"})),i("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()},i("ez-calendar",{ref:t=>this._calendar=t,"data-element-id":o.getInternalIDInfo("calendar"),onEzChange:t=>{this.hideCalendar(),t.stopPropagation()}})))}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}
|