@sankhyalabs/ezui 2.7.4 → 2.7.6
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 +31 -16
- package/dist/cjs/ez-date-time-input.cjs.entry.js +10 -3
- package/dist/cjs/ez-grid.cjs.entry.js +2 -2
- package/dist/cjs/ez-scroller.cjs.entry.js +48 -50
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ez-actions-button/ez-actions-button.js +31 -16
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +10 -3
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +2 -2
- package/dist/collection/components/ez-scroller/ez-scroller.css +99 -72
- package/dist/collection/components/ez-scroller/ez-scroller.js +49 -55
- package/dist/custom-elements/index.js +93 -73
- package/dist/esm/ez-actions-button.entry.js +31 -16
- package/dist/esm/ez-date-time-input.entry.js +10 -3
- package/dist/esm/ez-grid.entry.js +2 -2
- package/dist/esm/ez-scroller.entry.js +49 -51
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-25e83e46.entry.js +1 -0
- package/dist/ezui/p-37335c51.entry.js +1 -0
- package/dist/ezui/{p-56381ff2.entry.js → p-6fd5e142.entry.js} +1 -1
- package/dist/ezui/p-99218a07.entry.js +1 -0
- package/dist/types/components/ez-actions-button/ez-actions-button.d.ts +3 -0
- package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +1 -0
- package/dist/types/components/ez-scroller/ez-scroller.d.ts +5 -7
- package/package.json +1 -1
- package/dist/ezui/p-5e3306bc.entry.js +0 -1
- package/dist/ezui/p-7b906805.entry.js +0 -1
- package/dist/ezui/p-a34b52f8.entry.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as i,h as o,H as n,g as s}from"./p-3c7ea91b.js";import{FloatingManager as a,ElementIDUtils as e}from"@sankhyalabs/core";import"./p-0b44cf1c.js";import{C as c}from"./p-4a5e37a7.js";import"./p-e1148f5c.js";import"./p-b853763b.js";let r=class{constructor(o){t(this,o),this.ezAction=i(this,"ezAction",7),this._arrowOffset=5,this.enabled=!0,this.size="medium",this.showLabel=!1,this.checkOption=!1,this.isTransparent=!1,this.arrowActive=!1,this.innerClickCheck=(t,i)=>{var o;if(i&&t){if(i===t)return!0;const n=t.children;for(let t=0;t<n.length;t++)if(null===(o=n[t].shadowRoot)||void 0===o?void 0:o.contains(i))return!0}return!1}}async hideActions(){null!=this._floatingID&&a.close(this._floatingID),this._floatingID=void 0}async isOpened(){return null!=this._floatingID}getFloatOptions(){return{autoClose:!0,innerClickTest:this.innerClickCheck,isFixed:!0,top:this.getPositionTop(),left:this.getPositionLeft()}}getSideLimit(){var t;const i=document.body.clientWidth,o=null===(t=this._actionsList)||void 0===t?void 0:t.getBoundingClientRect();if((null==o?void 0:o.right)>i)return i-o.width+"px"}showActions(){if(!this.enabled)return;const t=this.getFloatOptions();this._floatingID=a.float(this._actionsList,this._listContainer,t);const i=this.getSideLimit();null!=i&&(t.left=i,a.updateFloatPosition(this._actionsList,this._listContainer,t)),window.requestAnimationFrame((()=>{this._actionsList.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}))}updatePosition(){if(!this.enabled||null==this._floatingID)return;const t=this.getFloatOptions(),i=this.getSideLimit();null!=i&&(t.left=i),a.updateFloatPosition(this._actionsList,this._listContainer,t)}getPositionTop(){var t;const i=null===(t=this._element)||void 0===t?void 0:t.getBoundingClientRect();return null==i?null:i.y+i.height+"px"}getBoundingLeft(){var t;const i=null===(t=this._element)||void 0===t?void 0:t.getBoundingClientRect();return null==i?null:i.x-(this.arrowActive?this._arrowOffset:0)+"px"}getPositionLeft(){return this.getBoundingLeft()||(this.arrowActive?`-${this._arrowOffset}px`:null)}hasLabelOrCheckOption(){var t;return(this.showLabel||this.checkOption)&&(null===(t=this.actions)||void 0===t?void 0:t.length)>0}hasIconName(){var t;return null===(t=this.actions)||void 0===t?void 0:t.some((t=>null!=t.iconName))}controlScrollPage(){window.removeEventListener("scroll",this.updatePosition.bind(this)),window.addEventListener("scroll",this.updatePosition.bind(this))}handlerButtonClick(){this.showActions()}actionClick(t){this._selectedAction=t,this.hideActions(),this.ezAction.emit(t)}componentWillLoad(){if(null==this.actions){this.actions=[];const t=this._element.querySelectorAll("action");t&&t.forEach((t=>{let i=t.innerText,o=t.getAttribute("value");o||(o=i),this.actions.push({label:i,value:o}),t.hidden=!0}))}}componentDidLoad(){c.applyVarsButton(this._element,this._button),e.addIDInfo(this._element),this.controlScrollPage()}componentDidRender(){null==this._floatingID&&this._actionsList.remove(),this.hasLabelOrCheckOption()&&(this.value?this._selectedAction=this.actions.find((t=>t.value===this.value)):this._selectedAction||(this._selectedAction=this.actions[0]))}render(){var t;return o(n,null,o("ez-button",{ref:t=>this._button=t,class:(this.isTransparent?"ez-actions-button__btn-transparent":"")+(this.showLabel?" ez-actions-button__btn-label":""),label:this.showLabel&&(null===(t=this._selectedAction)||void 0===t?void 0:t.label),enabled:this.enabled,mode:this.showLabel?void 0:"icon",iconName:this.showLabel?"":this.displayIcon||"dots-vertical",size:this.size,onClick:()=>this.handlerButtonClick()},this.showLabel&&o("ez-icon",{class:"ez-actions-button__icon-right",slot:"rightIcon",iconName:this.displayIcon||"dots-vertical"})),o("section",{class:"ez-actions-button__list-container",ref:t=>this._listContainer=t},this.arrowActive&&o("div",{class:"ez-actions-button__arrow ez-actions-button__arrow--"+(this.size||"small")+(this.isTransparent?" ez-actions-button__arrow--upped":"")}),o("div",{ref:t=>this._actionsList=t,class:"ez-actions-button__actions-list"+(this.arrowActive&&!this.isTransparent?" ez-actions-button__actions-list--lowered":"")},this.actions.map((t=>{var i;return o("ez-button",{size:"small",label:t.label,onClick:()=>this.actionClick(t),class:"ez-actions-button__btn-action"+(this.checkOption||this.hasIconName()?" ez-actions-button__btn-action--spaced":"")},this.checkOption&&(null===(i=this._selectedAction)||void 0===i?void 0:i.value)===t.value&&o("ez-icon",{class:"ez-actions-button__icon-check",slot:"leftIcon",size:"small",iconName:"check"}),!this.checkOption&&t.iconName&&o("ez-icon",{class:"ez-actions-button__icon-item",slot:"leftIcon",size:"small",iconName:t.iconName}))})))))}get _element(){return s(this)}};r.style=":host{--ez-actions-button__actions-list--border-radius:var(--border--radius-medium, 12px);--ez-actions-button__actions-list--box-shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-actions-button__actions-list--background-color:var(--background--xlight, #fff);--ez-actions-button__actions-list--padding:var(--space--small, 6px);--ez-actions-button__actions-list--top-margin:var(--space-small, 6px);--ez-actions-button__btn-action--min-width:'auto';--ez-actions-button__btn-action--background-color:var(--background--xlight, #fff);display:flex;flex-direction:column;height:fit-content;user-select:none}.ez-actions-button__actions-list{display:flex;flex-direction:column;position:fixed;width:fit-content;height:fit-content;z-index:var(--more-visible, 2);padding:var(--ez-actions-button__actions-list--padding);margin-top:var(--ez-actions-button__actions-list--top-margin);background-color:var(--ez-actions-button__actions-list--background-color);border-radius:var(--ez-actions-button__actions-list--border-radius);box-shadow:var(--ez-actions-button__actions-list--box-shadow)}.ez-actions-button__actions-list--lowered{margin-top:calc(var(--ez-actions-button__actions-list--top-margin) + 6px)}.ez-actions-button__btn-action{--ez-button--justify-content:flex-start;--ez-button--width:100%;--ez-button--min-width:var(--ez-actions-button__btn-action--min-width);--ez-button--background-color:var(--ez-actions-button__btn-action--background-color);--ez-button--font-weight:var(--text-weight--medium, 400);--ez-button--padding-left:var(--space--medium, 12px);--ez-button--padding-right:var(--space--medium, 12px)}.ez-actions-button__btn-action--spaced{--ez-button--padding-left:calc(var(--space--medium, 12px) + 24px)}.ez-actions-button__icon-right{margin-left:var(--space--small, 6px)}.ez-actions-button__icon-check,.ez-actions-button__icon-item{position:absolute;left:var(--space--medium, 12px)}.ez-actions-button__icon-check{color:var(--ez-button--hover-color)}.ez-actions-button__arrow{position:absolute;border-left:10px solid transparent;border-right:10px solid transparent;width:0;height:0;z-index:calc(var(--more-visible, 2) + 1);border-bottom:15px solid var(--ez-actions-button__btn-action--background-color)}.ez-actions-button__arrow--upped{margin-top:calc((var(--ez-actions-button__actions-list--top-margin) + 2px) * -1)}.ez-actions-button__arrow--small{margin-left:6px}.ez-actions-button__arrow--medium{margin-left:11px}.ez-actions-button__arrow--large{margin-left:13px}.ez-actions-button__arrow:only-child{display:none}.ez-actions-button__btn-transparent{--ez-button--background-color:transparent;--ez-button--hover--background-color:transparent;--ez-button--active--background-color:transparent;--ez-button--focus--border:none}.ez-actions-button__btn-label{--ez-button--padding-left:var(--space--medium, 12px);--ez-button--padding-right:var(--space--medium, 12px)}.ez-actions-button__list-container{position:relative}";export{r as ez_actions_button}
|
|
@@ -57,7 +57,10 @@ export declare class EzActionsButton {
|
|
|
57
57
|
*/
|
|
58
58
|
isOpened(): Promise<boolean>;
|
|
59
59
|
innerClickCheck: (floatingContainer: HTMLElement, node: HTMLElement) => boolean;
|
|
60
|
+
private getFloatOptions;
|
|
61
|
+
private getSideLimit;
|
|
60
62
|
private showActions;
|
|
63
|
+
private updatePosition;
|
|
61
64
|
private getPositionTop;
|
|
62
65
|
private getBoundingLeft;
|
|
63
66
|
private getPositionLeft;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { EzScrollDirection } from './EzScrollDirection';
|
|
2
2
|
export declare class EzScroller {
|
|
3
3
|
private _container;
|
|
4
|
-
private
|
|
5
|
-
private _shadowEnd;
|
|
4
|
+
private _wrapper;
|
|
6
5
|
private _controller;
|
|
7
6
|
private _startHidden;
|
|
8
7
|
private _endHidden;
|
|
9
8
|
private _resizeObserver;
|
|
10
|
-
private
|
|
11
|
-
|
|
9
|
+
private _shadowStart;
|
|
10
|
+
private _shadowEnd;
|
|
12
11
|
isActive: boolean;
|
|
13
12
|
/**
|
|
14
13
|
* Define a direção em que haverá scroll.
|
|
@@ -23,16 +22,15 @@ export declare class EzScroller {
|
|
|
23
22
|
*/
|
|
24
23
|
activeShadow: boolean;
|
|
25
24
|
private getContainerClass;
|
|
26
|
-
private
|
|
27
|
-
private getShadowEndClass;
|
|
25
|
+
private getWrapperClass;
|
|
28
26
|
private finishDrag;
|
|
29
27
|
private updateShadow;
|
|
30
28
|
private configResize;
|
|
29
|
+
private getContainerElement;
|
|
31
30
|
clickListener(evt: MouseEvent): void;
|
|
32
31
|
mouseDownHandler(evt: MouseEvent): void;
|
|
33
32
|
mouseUpHandler(): void;
|
|
34
33
|
mouseMoveHandler(evt: MouseEvent): void;
|
|
35
|
-
componentDidLoad(): void;
|
|
36
34
|
componentDidRender(): void;
|
|
37
35
|
render(): any;
|
|
38
36
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r,h as o,H as l}from"./p-3c7ea91b.js";import{JSUtils as e,UserAgentUtils as s}from"@sankhyalabs/core";var t;!function(r){r.HORIZONTAL="horizontal",r.VERTICAL="vertical",r.BOTH="both"}(t||(t={}));let i=class{constructor(o){r(this,o),this._classHidden="ez-scroller__shadow--hidden",this.isFirefox=!1,this.isActive=!1,this.locked=!1,this.activeShadow=!1}getContainerClass(){return`ez-scroller__container ez-scroller__container--${this.direction}\n ${this.locked?" ez-scroller__container--locked":""}\n ${this.isFirefox&&this.isActive?" ez-scroller__container--no-overlay":""}\n `}getShadowStartClass(){return`ez-scroller__shadow-start ez-scroller__shadow-start--${this.direction}`}getShadowEndClass(){return`ez-scroller__shadow-end ez-scroller__shadow-end--${this.direction}`}finishDrag(){this._controller&&this._container.classList.remove("dragging")}updateShadow(){const r=this._container;if(r){let o;if(this.direction===t.HORIZONTAL){const{scrollWidth:l,clientWidth:e,scrollLeft:s}=r;o=l-e-Math.ceil(s),this._startHidden=r.scrollLeft>0}else if(this.direction===t.VERTICAL){const{scrollHeight:l,clientHeight:e,scrollTop:s}=r;o=l-e-Math.ceil(s),this._startHidden=r.scrollTop>0}this._endHidden=o>0,this.isActive=this._startHidden||this._endHidden;const l=["","start","end","middle"][Number(this._startHidden)|Number(this._endHidden)<<1];"start"===l?(this._shadowStart.classList.remove(this._classHidden),this._shadowEnd.classList.add(this._classHidden)):"end"===l?(this._shadowStart.classList.add(this._classHidden),this._shadowEnd.classList.remove(this._classHidden)):"middle"===l?(this._shadowStart.classList.remove(this._classHidden),this._shadowEnd.classList.remove(this._classHidden)):(this._shadowStart.classList.add(this._classHidden),this._shadowEnd.classList.add(this._classHidden))}}configResize(){const r=this._container;null!=r&&(null!=this._resizeObserver&&this._resizeObserver.unobserve(r),this._resizeObserver=new ResizeObserver(e.debounce(this.updateShadow.bind(this),200)),this._resizeObserver.observe(r))}clickListener(r){this._controller&&this._controller.didScroll()&&(r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation())}mouseDownHandler(r){this.locked?this.finishDrag():(this._controller||(this._controller=new a(this._container)),this._controller.startDragg(r),this._container.classList.add("dragging"))}mouseUpHandler(){this.finishDrag()}mouseMoveHandler(r){this.locked?this.finishDrag():this._controller&&(0===r.buttons?this.finishDrag():this._controller.doScroll(r))}componentDidLoad(){this.isFirefox=s.isFirefox()}componentDidRender(){var r,o;if(this.direction===t.BOTH)return null===(r=this._shadowStart)||void 0===r||r.classList.add(this._classHidden),void(null===(o=this._shadowEnd)||void 0===o||o.classList.add(this._classHidden));this._container&&this.activeShadow&&(this._container.onscroll=this.updateShadow.bind(this),this.configResize(),this.updateShadow())}render(){return o(l,null,this.activeShadow&&o("span",{ref:r=>this._shadowStart=r,class:this.getShadowStartClass()}),o("div",{ref:r=>this._container=r,class:this.getContainerClass()},o("slot",null)),this.activeShadow&&o("span",{ref:r=>this._shadowEnd=r,class:this.getShadowEndClass()}))}};class a{constructor(r){this.scrollablePanel=r}startDragg(r){this.startX=this.measureX(r),this.startY=this.measureY(r),this.scrollWidth=0,this.scrollHeight=0}measureX(r){return r.pageX-this.scrollablePanel.offsetLeft}measureY(r){return r.pageY-this.scrollablePanel.offsetTop}doScroll(r){const o=this.measureX(r),l=this.measureY(r);if(o!=this.startX||l!=this.startY){const r=o-this.startX,e=l-this.startY;this.startX+=r,this.startY+=e,this.scrollWidth+=Math.abs(r),this.scrollHeight+=Math.abs(e),this.scrollablePanel.scrollLeft=Math.max(0,this.scrollablePanel.scrollLeft-r),this.scrollablePanel.scrollTop=Math.max(0,this.scrollablePanel.scrollTop-e)}}didScroll(){return this.scrollHeight>5||this.scrollWidth>5}}i.style=":host{--ez-scroller--box-shadow-color:var(--background--body, #fafcff);--ez-scroller__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-scroller__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-scroller__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-scroller__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-scroller__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-scroller__scrollbar--width:var(--space--small, 6px);display:flex;cursor:grab;width:100%}.dragging{cursor:grabbing}.ez-scroller__container{display:flex;flex-direction:column;overflow-y:hidden;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:var(--ez-scroller__scrollbar--color-clicked) var(--ez-scroller__scrollbar--color-background)}.ez-scroller__container--horizontal{flex-direction:row;overflow-y:hidden;overflow-x:hidden;padding-bottom:var(--ez-scroller__scrollbar--width);margin-bottom:calc(var(--ez-scroller__scrollbar--width) * -1)}.ez-scroller__container--horizontal:not(.ez-scroller__container--no-overlay):not(.ez-scroller__container--locked):hover{overflow-x:overlay}.ez-scroller__container--horizontal.ez-scroller__container--no-overlay{padding-bottom:8px;margin-bottom:-8px}.ez-scroller__container--horizontal.ez-scroller__container--no-overlay:not(.ez-scroller__container--locked):hover{overflow-x:auto;padding-bottom:0px}.ez-scroller__container--vertical{overflow-y:hidden;overflow-x:hidden;padding-right:var(--ez-scroller__scrollbar--width);margin-right:calc(var(--ez-scroller__scrollbar--width) * -1)}.ez-scroller__container--vertical:not(.ez-scroller__container--no-overlay):not(.ez-scroller__container--locked):hover{overflow-y:overlay}.ez-scroller__container--vertical.ez-scroller__container--no-overlay{padding-right:8px;margin-right:-8px}.ez-scroller__container--vertical.ez-scroller__container--no-overlay:not(.ez-scroller__container--locked):hover{overflow-y:auto;padding-right:0px}.ez-scroller__container--both{overflow:auto}.ez-scroller__container::-webkit-scrollbar{background-color:var(--ez-scroller__scrollbar--color-background);width:var(--ez-scroller__scrollbar--width);height:var(--ez-scroller__scrollbar--width);max-width:var(--ez-scroller__scrollbar--width);min-width:var(--ez-scroller__scrollbar--width)}.ez-scroller__container::-webkit-scrollbar-track{visibility:hidden;background-color:var(--ez-scroller__scrollbar--color-background);border-radius:var(--ez-scroller__scrollbar--border-radius)}.ez-scroller__container::-webkit-scrollbar-thumb{background-color:var(--ez-scroller__scrollbar--color-default);border-radius:var(--ez-scroller__scrollbar--border-radius)}.ez-scroller__container::-webkit-scrollbar-thumb:vertical:hover,.ez-scroller__container::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-scroller__scrollbar--color-hover)}.ez-scroller__container::-webkit-scrollbar-thumb:vertical:active,.ez-scroller__container::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-scroller__scrollbar--color-clicked)}.ez-scroller__shadow-start,.ez-scroller__shadow-end{display:flex;position:relative;z-index:0;background:var(--ez-scroller--box-shadow-color)}.ez-scroller__shadow-start--horizontal,.ez-scroller__shadow-end--horizontal{width:10px;min-height:100%;top:-13px}.ez-scroller__shadow-start--horizontal{box-shadow:var(--ez-scroller--box-shadow-color) -4px 0px 6px 10px;margin-right:-10px}.ez-scroller__shadow-end--horizontal{box-shadow:var(--ez-scroller--box-shadow-color) 4px 0px 6px 10px;margin-left:-10px}.ez-scroller__shadow-start--vertical,.ez-scroller__shadow-end--vertical{min-width:100%;height:10px;left:-13px}.ez-scroller__shadow-start--vertical{box-shadow:var(--ez-scroller--box-shadow-color) 0px -4px 6px 10px;margin-bottom:-10px}.ez-scroller__shadow-end--vertical{box-shadow:var(--ez-scroller--box-shadow-color) 0px 4px 6px 10px;margin-top:-10px}.ez-scroller__shadow--hidden{display:none}";export{i as ez_scroller}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as e,h as i,H as s,g as n}from"./p-3c7ea91b.js";import{DateUtils as a,TimeFormatter as o,ElementIDUtils as r}from"@sankhyalabs/core";import{C as h}from"./p-4a5e37a7.js";let 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._focused=!1,this.enabled=!0,this.showSeconds=!1,this.mode="regular"}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=a.validateDate(t,!0),s=a.validateDate(e,!0);if((null==i?void 0:i.getTime())!==(null==s?void 0:s.getTime())){const t=this.getTextValue(i)||"";!this.getParsedDateTime(t)&&this._focused||(this._textInput.value||"")===t||(this._textInput.value=t,this._focused=!1,this.errorMessage=""),this.ezChange.emit(null===i?void 0:i)}}}async setFocus(){this._textInput.setFocus()}async setBlur(){this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}handleKeyDown(t){const e=this._textInput.shadowRoot.querySelector("input");if(t.shiftKey&&"Tab"===t.key){if(e.selectionStart>0){let i=e.value.lastIndexOf(" ",e.selectionStart);-1!==i&&(e.setSelectionRange(0,i),t.preventDefault())}}else if("Tab"===t.key&&e.value.length!==e.selectionEnd){let i=e.value.indexOf(" ",e.selectionEnd);i=-1===i?e.selectionEnd:i+1,e.setSelectionRange(i,e.value.length),t.preventDefault()}}handleFocus(){const t=this._textInput.shadowRoot.querySelector("input");if(t.selectionStart!==t.selectionEnd){let e=t.value.indexOf(" ",t.selectionStart);e=-1===e?t.value.length:e,t.setSelectionRange(0,e)}}handleClick(){const t=this._textInput.shadowRoot.querySelector("input");let e=t.value.lastIndexOf(" ",t.selectionEnd);e=-1===e?0:e+1,e=e>t.selectionEnd?0:e;let i=0===e?t.value.indexOf(" "):t.value.length;t.setSelectionRange(e,i)}changeValue(t){const e=a.validateDate(this.value,!0),i=a.validateDate(t,!0);(null==e?void 0:e.getTime())!==(null==i?void 0:i.getTime())&&(this.value=i)}showCalendar(){this._calendar.fitVertical(this.errorMessage||"slim"===this.mode?6:-13,this._elem.clientHeight),this._calendar.style.visibility="inherit"}getParsedDateTime(t){var e,i;if(void 0===t&&(t=(null===(i=null===(e=this._textInput)||void 0===e?void 0:e.value)||void 0===i?void 0:i.trim())||""),!t)return;const s=t.split(" "),n=s.length>0?s[0]:t,r=o.prepareValue(s[1]?s[1]:"",this.showSeconds);return a.strToDate(n+(r&&" "+r))}handleBlur(){var t,e;const i=(null===(e=null===(t=this._textInput)||void 0===t?void 0:t.value)||void 0===e?void 0:e.trim())||"",s=this.getParsedDateTime();if(s||!i){this.errorMessage="";const t=a.validateDate(this.value,!0),e=a.validateDate(s,!0);(null==t?void 0:t.getTime())===(null==e?void 0:e.getTime())?(e&&(this._textInput.value=this.getTextValue(e)||"",this._focused=!1),this.ezCancelWaitingChange.emit()):this.changeValue(e)}else this.changeValue(void 0),this.ezCancelWaitingChange.emit(),this.errorMessage="O valor digitado não é uma data válida"}getTextValue(t){return t?new Intl.DateTimeFormat("pt-BR",this.showSeconds?{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}:{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric"}).format(t):void 0}handleInput(t){const e=this.getParsedDateTime(),i=a.validateDate(this.value,!0),s=a.validateDate(e,!0);(null==i?void 0:i.getTime())!==(null==s?void 0:s.getTime())&&(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)}componentDidLoad(){h.applyVarsTextInput(this._elem,this._textInput),this.setInputValue()}render(){return r.addIDInfoIfNotExists(this._elem,"input"),i(s,null,i("ez-text-input",{"data-element-id":r.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()},i("button",{disabled:!this.enabled,tabindex:-1,class:"btn-open-cal",onClick:()=>this.showCalendar(),slot:"leftIcon"})),i("ez-calendar",{"data-element-id":r.getInternalIDInfo("calendar"),onEzChange:t=>{this.changeValue(this._calendar.value),t.stopPropagation()},floating:!0,ref:t=>this._calendar=t,time:!0,showSeconds:this.showSeconds}))}get _elem(){return n(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:unset}.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_time_input}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as i,h as o,H as n,g as s}from"./p-3c7ea91b.js";import{FloatingManager as a,ElementIDUtils as e}from"@sankhyalabs/core";import"./p-0b44cf1c.js";import{C as c}from"./p-4a5e37a7.js";import"./p-e1148f5c.js";import"./p-b853763b.js";let r=class{constructor(o){t(this,o),this.ezAction=i(this,"ezAction",7),this._arrowOffset=5,this.enabled=!0,this.size="medium",this.showLabel=!1,this.checkOption=!1,this.isTransparent=!1,this.arrowActive=!1,this.innerClickCheck=(t,i)=>{var o;if(i&&t){if(i===t)return!0;const n=t.children;for(let t=0;t<n.length;t++)if(null===(o=n[t].shadowRoot)||void 0===o?void 0:o.contains(i))return!0}return!1}}async hideActions(){null!=this._floatingID&&a.close(this._floatingID),this._floatingID=void 0}async isOpened(){return null!=this._floatingID}showActions(){var t;if(!this.enabled)return;let i={autoClose:!0,innerClickTest:this.innerClickCheck,isFixed:!0,top:this.getPositionTop(),left:this.getPositionLeft()};this._floatingID=a.float(this._actionsList,this._listContainer,i);const o=document.body.clientWidth,n=null===(t=this._actionsList)||void 0===t?void 0:t.getBoundingClientRect();(null==n?void 0:n.right)>o&&(i={autoClose:!0,innerClickTest:this.innerClickCheck,isFixed:!0,top:this.getPositionTop(),left:o-n.width+"px"},a.updateFloatPosition(this._actionsList,this._listContainer,i)),window.requestAnimationFrame((()=>{this._actionsList.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}))}getPositionTop(){var t;const i=null===(t=this._element)||void 0===t?void 0:t.getBoundingClientRect();return null==i?null:i.y+i.height+"px"}getBoundingLeft(){var t;const i=null===(t=this._element)||void 0===t?void 0:t.getBoundingClientRect();return null==i?null:i.x-(this.arrowActive?this._arrowOffset:0)+"px"}getPositionLeft(){return this.getBoundingLeft()||(this.arrowActive?`-${this._arrowOffset}px`:null)}hasLabelOrCheckOption(){var t;return(this.showLabel||this.checkOption)&&(null===(t=this.actions)||void 0===t?void 0:t.length)>0}hasIconName(){var t;return null===(t=this.actions)||void 0===t?void 0:t.some((t=>null!=t.iconName))}controlScrollPage(){window.removeEventListener("scroll",this.hideActions.bind(this)),window.addEventListener("scroll",this.hideActions.bind(this))}handlerButtonClick(){this.showActions()}actionClick(t){this._selectedAction=t,this.hideActions(),this.ezAction.emit(t)}componentWillLoad(){if(null==this.actions){this.actions=[];const t=this._element.querySelectorAll("action");t&&t.forEach((t=>{let i=t.innerText,o=t.getAttribute("value");o||(o=i),this.actions.push({label:i,value:o}),t.hidden=!0}))}}componentDidLoad(){c.applyVarsButton(this._element,this._button),e.addIDInfo(this._element),this.controlScrollPage()}componentDidRender(){null==this._floatingID&&this._actionsList.remove(),this.hasLabelOrCheckOption()&&(this.value?this._selectedAction=this.actions.find((t=>t.value===this.value)):this._selectedAction||(this._selectedAction=this.actions[0]))}render(){var t;return o(n,null,o("ez-button",{ref:t=>this._button=t,class:(this.isTransparent?"ez-actions-button__btn-transparent":"")+(this.showLabel?" ez-actions-button__btn-label":""),label:this.showLabel&&(null===(t=this._selectedAction)||void 0===t?void 0:t.label),enabled:this.enabled,mode:this.showLabel?void 0:"icon",iconName:this.showLabel?"":this.displayIcon||"dots-vertical",size:this.size,onClick:()=>this.handlerButtonClick()},this.showLabel&&o("ez-icon",{class:"ez-actions-button__icon-right",slot:"rightIcon",iconName:this.displayIcon||"dots-vertical"})),o("section",{class:"ez-actions-button__list-container",ref:t=>this._listContainer=t},this.arrowActive&&o("div",{class:"ez-actions-button__arrow ez-actions-button__arrow--"+(this.size||"small")+(this.isTransparent?" ez-actions-button__arrow--upped":"")}),o("div",{ref:t=>this._actionsList=t,class:"ez-actions-button__actions-list"+(this.arrowActive&&!this.isTransparent?" ez-actions-button__actions-list--lowered":"")},this.actions.map((t=>{var i;return o("ez-button",{size:"small",label:t.label,onClick:()=>this.actionClick(t),class:"ez-actions-button__btn-action"+(this.checkOption||this.hasIconName()?" ez-actions-button__btn-action--spaced":"")},this.checkOption&&(null===(i=this._selectedAction)||void 0===i?void 0:i.value)===t.value&&o("ez-icon",{class:"ez-actions-button__icon-check",slot:"leftIcon",size:"small",iconName:"check"}),!this.checkOption&&t.iconName&&o("ez-icon",{class:"ez-actions-button__icon-item",slot:"leftIcon",size:"small",iconName:t.iconName}))})))))}get _element(){return s(this)}};r.style=":host{--ez-actions-button__actions-list--border-radius:var(--border--radius-medium, 12px);--ez-actions-button__actions-list--box-shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-actions-button__actions-list--background-color:var(--background--xlight, #fff);--ez-actions-button__actions-list--padding:var(--space--small, 6px);--ez-actions-button__actions-list--top-margin:var(--space-small, 6px);--ez-actions-button__btn-action--min-width:'auto';--ez-actions-button__btn-action--background-color:var(--background--xlight, #fff);display:flex;flex-direction:column;height:fit-content;user-select:none}.ez-actions-button__actions-list{display:flex;flex-direction:column;position:fixed;width:fit-content;height:fit-content;z-index:var(--more-visible, 2);padding:var(--ez-actions-button__actions-list--padding);margin-top:var(--ez-actions-button__actions-list--top-margin);background-color:var(--ez-actions-button__actions-list--background-color);border-radius:var(--ez-actions-button__actions-list--border-radius);box-shadow:var(--ez-actions-button__actions-list--box-shadow)}.ez-actions-button__actions-list--lowered{margin-top:calc(var(--ez-actions-button__actions-list--top-margin) + 6px)}.ez-actions-button__btn-action{--ez-button--justify-content:flex-start;--ez-button--width:100%;--ez-button--min-width:var(--ez-actions-button__btn-action--min-width);--ez-button--background-color:var(--ez-actions-button__btn-action--background-color);--ez-button--font-weight:var(--text-weight--medium, 400);--ez-button--padding-left:var(--space--medium, 12px);--ez-button--padding-right:var(--space--medium, 12px)}.ez-actions-button__btn-action--spaced{--ez-button--padding-left:calc(var(--space--medium, 12px) + 24px)}.ez-actions-button__icon-right{margin-left:var(--space--small, 6px)}.ez-actions-button__icon-check,.ez-actions-button__icon-item{position:absolute;left:var(--space--medium, 12px)}.ez-actions-button__icon-check{color:var(--ez-button--hover-color)}.ez-actions-button__arrow{position:absolute;border-left:10px solid transparent;border-right:10px solid transparent;width:0;height:0;z-index:calc(var(--more-visible, 2) + 1);border-bottom:15px solid var(--ez-actions-button__btn-action--background-color)}.ez-actions-button__arrow--upped{margin-top:calc((var(--ez-actions-button__actions-list--top-margin) + 2px) * -1)}.ez-actions-button__arrow--small{margin-left:6px}.ez-actions-button__arrow--medium{margin-left:11px}.ez-actions-button__arrow--large{margin-left:13px}.ez-actions-button__arrow:only-child{display:none}.ez-actions-button__btn-transparent{--ez-button--background-color:transparent;--ez-button--hover--background-color:transparent;--ez-button--active--background-color:transparent;--ez-button--focus--border:none}.ez-actions-button__btn-label{--ez-button--padding-left:var(--space--medium, 12px);--ez-button--padding-right:var(--space--medium, 12px)}.ez-actions-button__list-container{position:relative}";export{r as ez_actions_button}
|