@descope/web-components-ui 1.114.0 → 1.116.0
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/index.cjs.js +103 -65
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +103 -65
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/7092.js +1 -1
- package/dist/umd/7092.js.map +1 -1
- package/dist/umd/DescopeDev.js +1 -1
- package/dist/umd/DescopeDev.js.map +1 -1
- package/dist/umd/descope-date-field-descope-calendar-index-js.js +1 -1
- package/dist/umd/descope-date-field-descope-calendar-index-js.js.map +1 -1
- package/dist/umd/descope-date-field-index-js.js +1 -1
- package/dist/umd/descope-date-field-index-js.js.map +1 -1
- package/dist/umd/descope-multi-select-combo-box-index-js.js +1 -1
- package/dist/umd/descope-multi-select-combo-box-index-js.js.map +1 -1
- package/package.json +4 -4
- package/src/components/descope-date-field/DateFieldClass.js +47 -25
- package/src/components/descope-date-field/descope-calendar/CalendarClass.js +26 -26
- package/src/components/descope-date-field/descope-calendar/helpers.js +8 -8
- package/src/components/descope-date-field/helpers.js +14 -7
- package/src/components/descope-multi-select-combo-box/MultiSelectComboBoxClass.js +8 -4
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[9257],{6424:(e,t,i)=>{i.d(t,{A:()=>C});const{host:r,label:n,placeholder:o,requiredIndicator:s,inputField:a,input:l,inputMask:p,helperText:d,errorMessage:h,disabledPlaceholder:u,inputDisabled:c,inputIcon:g,externalInput:y,externalInputDisabled:m,externalPlaceholder:v,externalDisabledPlaceholder:b}={host:{selector:()=>":host"},label:{selector:"::part(label)"},requiredIndicator:{selector:"[required]::part(required-indicator)::after"},placeholder:[{selector:"> input:placeholder-shown"},{selector:()=>":host::slotted(input:placeholder-shown)"}],disabledPlaceholder:{selector:"> input:disabled::placeholder"},inputField:{selector:"::part(input-field)"},input:{selector:"input"},inputMask:{selector:"::part(input-field)::before"},inputDisabled:{selector:"input:disabled"},helperText:{selector:"::part(helper-text)"},errorMessage:{selector:"::part(error-message)"},inputIcon:{selector:"vaadin-icon"},externalInput:{selector:()=>"::slotted(input)"},externalInputDisabled:{selector:()=>"::slotted(input:disabled)"},externalPlaceholder:{selector:()=>"::slotted(input:placeholder-shown)"},externalDisabledPlaceholder:{selector:()=>"::slotted(input:disabled::placeholder)"}},C={fontSize:[{},r],fontFamily:[n,a,d,h],labelFontSize:{...n,property:"font-size"},labelFontWeight:{...n,property:"font-weight"},labelTextColor:[{...n,property:"color"},{...s,property:"color"},{...n,property:"-webkit-text-fill-color"},{...s,property:"-webkit-text-fill-color"}],hostWidth:{...r,property:"width"},hostMinWidth:{...r,property:"min-width"},hostDirection:{...r,property:"direction"},inputDirection:{...l,property:"direction"},inputBackgroundColor:[{...a,property:"background-color"},{...p,property:"background-color"}],errorMessageTextColor:{...h,property:"color"},errorMessageIcon:{...h,property:"background-image"},errorMessageIconSize:{...h,property:"background-size"},errorMessageIconPadding:{...h,property:"padding-inline-start"},errorMessageIconRepeat:{...h,property:"background-repeat"},errorMessageIconPosition:{...h,property:"background-position"},errorMessageFontSize:{...h,property:"font-size"},helperTextColor:{...d,property:"-webkit-text-fill-color"},inputValueTextColor:[{...a,property:"color"},{...c,property:"-webkit-text-fill-color"},{...m,property:"-webkit-text-fill-color"}],inputCaretTextColor:[{...l,property:"caret-color"},{...y,property:"caret-color"}],labelRequiredIndicator:{...s,property:"content"},inputBorderColor:{...a,property:"border-color"},inputBorderWidth:{...a,property:"border-width"},inputBorderStyle:{...a,property:"border-style"},inputBorderRadius:{...a,property:"border-radius"},inputHeight:{...a,property:"height"},inputHorizontalPadding:[{...l,property:"padding-left"},{...l,property:"padding-right"},{...y,property:"padding-left"},{...y,property:"padding-right"}],inputOutlineColor:{...a,property:"outline-color"},inputOutlineStyle:{...a,property:"outline-style"},inputOutlineWidth:{...a,property:"outline-width"},inputOutlineOffset:{...a,property:"outline-offset"},textAlign:{},inputTextAlign:[{...l,property:"text-align"},{...y,property:"text-align"}],inputPlaceholderColor:[{selector:()=>":host input:placeholder-shown",property:"color"},{...v,property:"color"},{...o,property:"color"},{...u,property:"-webkit-text-fill-color"},{...b,property:"-webkit-text-fill-color"}],labelPosition:{...n,property:"position"},labelTopPosition:{...n,property:"top"},labelHorizontalPosition:[{...n,property:"left"},{...n,property:"right"}],inputTransformY:{...n,property:"transform"},inputTransition:{...n,property:"transition"},marginInlineStart:{...n,property:"margin-inline-start"},placeholderOpacity:[{selector:"> input:placeholder-shown",property:"opacity"},{...v,property:"opacity"}],inputVerticalAlignment:[{...a,property:"align-items"},{...y,property:"align-items"}],valueInputHeight:[{...l,property:"height"},{...y,property:"height"}],valueInputMarginBottom:[{...l,property:"margin-bottom"},{...y,property:"margin-bottom"}],inputIconOffset:[{...g,property:"margin-right"},{...g,property:"margin-left"}],inputIconSize:{...g,property:"font-size"},inputIconColor:{...g,property:"color"}}},21374:(e,t,i)=>{i.r(t),i.d(t,{TextFieldClass:()=>r.w,componentName:()=>r.T}),i(11284),i(37182),i(95260);var r=i(79275);customElements.define(r.T,r.w)},79275:(e,t,i)=>{i.d(t,{T:()=>l,w:()=>d});var r=i(79365),n=i(6424),o=i(9696),s=i(97810),a=i(73551);const l=(0,s.xE)("text-field"),p=["type","label-type","copy-to-clipboard"],d=(0,o.Zz)((0,r.RF)({mappings:n.A}),r.VO,(0,r.OZ)({proxyProps:["value","selectionStart"],useProxyTargets:!0}),r.tQ,(e=>class extends e{static get observedAttributes(){return p.concat(e.observedAttributes||[])}icon;init(){super.init?.()}renderCopyToClipboard(e){if(!e)return void this.icon?.remove();const t={icon:"vaadin:copy-o",title:"Copy",style:"cursor: pointer"},i={icon:"vaadin:check-circle-o",title:"Copied",style:"cursor: initial"};this.icon=Object.assign(document.createElement("vaadin-icon"),{slot:"suffix",...t}),this.baseElement.appendChild(this.icon),this.icon.addEventListener("click",(()=>{navigator.clipboard.writeText(this.value),Object.assign(this.icon,i),setTimeout((()=>{Object.assign(this.icon,t)}),5e3)}))}onLabelClick(){this.focus()}attributeChangedCallback(e,t,i){super.attributeChangeCallback?.(e,t,i),"type"===e&&this.baseElement._setType(i),t!==i&&("label-type"===e?"floating"===i?this.addEventListener("click",this.onLabelClick):this.removeEventListener("click",this.onLabelClick):"copy-to-clipboard"===e&&this.renderCopyToClipboard("true"===i))}}))((0,r.tz)({slots:["prefix","suffix"],wrappedEleName:"vaadin-text-field",style:()=>`\n\t\t\t:host {\n\t\t\t\tdisplay: inline-block;\n\t\t\t\tmax-width: 100%;\n\t\t\t\tpadding: calc(var(${d.cssVarList.inputOutlineWidth}) + var(${d.cssVarList.inputOutlineOffset}));\n box-sizing: border-box;\n\t\t\t}\n :host(:is([readonly], [disabled])) ::slotted(:is(input, textarea):placeholder-shown) {\n opacity: 1;\n }\n\n vaadin-text-field[label-type="floating"]:not([focused])[readonly] > input:placeholder-shown {\n opacity: 0;\n }\n vaadin-text-field[label-type="floating"]:not([focused])[disabled] > input:placeholder-shown {\n opacity: 0;\n }\n ${(0,a.$J)("vaadin-text-field")}\n\t\t\t${(0,a.cy)(d.cssVarList)}\n\t\t\t${(0,a.LJ)("vaadin-text-field",d.cssVarList)}\n ${(0,a.Kl)()}\n\n vaadin-text-field vaadin-icon {\n align-self: center;\n }\n\t\t`,excludeAttrsSync:["tabindex","style"],componentName:l}))},79981:(e,t,i)=>{i.r(t),i.d(t,{DateFieldClass:()=>k,componentName:()=>g}),i(45992),i(88350),i(21374);var r=i(3393),n=i(79365),o=i(97810),s=i(9696),a=i(49224),l=i(77421),p=i(80071),d=i(64101);class h{#e=Object.freeze([]);constructor({id:e,min:t,max:i,placeholder:r},n){this.id=e,this.min=t,this.max=i,this.placeholder=r,this.onChange=n}get data(){return this.#e}set data(e){this.#e=Object.freeze(e),this.onChange?.()}get#t(){return this.data.length?this.numberValue:0}get numberValue(){return Number(this.stringValue)}get stringValue(){return(this.data.join("")||this.placeholder).padStart(this.length,"0")}get isFull(){return 10*this.numberValue>this.max||this.data.length===this.length}get isEmpty(){return this.stringValue===this.placeholder}get length(){return this.max.toString().length}set(e){this.data=e.toString().split("")}add(e){let t=this.data;return t=[...t,e],Number(t.join(""))>this.max?t=[e]:this.length<t.length&&(t=t.slice(1,t.length)),this.data=t,e}del(){this.data.filter((e=>"0"!==e)).filter(Boolean).length?this.data=this.data.slice(0,this.data.length-1):this.data=[]}clear(){this.data=[]}inc(e){this.replaceValue(this.#t<this.max?Math.max(this.#t+(e||1),this.min):this.min)}dec(e){this.replaceValue(this.#t>this.min?Math.min(this.#t-(e||1),this.max):this.max)}isInRange(e){return e>=this.min&&e<=this.max}replaceValue(e){this.isInRange(e)&&(this.data=e.toString().padStart(this.length,0).split(""))}setMin(e){this.min=Number(e)}setMax(e){this.max=Number(e)}}var u=i(79275),c=i(25964);const g=(0,o.xE)("date-field"),y=(0,r.y)({componentName:g,baseSelector:"vaadin-popover"}),m=["format","opened","initial-value","readonly","disable-calendar"],v=["years-range","calendar-months","calendar-weekdays"],b=[...m,...v],C=u.w.cssVarList,{host:f,input:x,inputEleRTL:E,toggleButton:w,overlay:I,backdrop:T,errorMessage:S}={host:{selector:()=>":host"},input:{selector:()=>"descope-text-field"},inputEleRTL:{selector:()=>':host([st-host-direction="rtl"]) descope-text-field'},toggleButton:{selector:()=>".toggle-calendar"},overlay:{selector:"vaadin-popover-overlay::part(overlay)"},backdrop:{selector:"vaadin-popover-overlay::part(backdrop)"}},k=(0,s.Zz)((0,n.RF)({componentNameOverride:(0,o.xE)("input-wrapper")}),(0,n.RF)({mappings:{iconMargin:{...w,property:"margin-inline-end"},hostWidth:{...f,property:"width"},hostDirection:{...f,property:"direction"},textAlign:{...x,property:"text-align"},rtlInputDirection:{...E,property:C.inputDirection},rtlInputAlignment:{...E,property:C.inputTextAlign},overlayGap:{property:()=>k.cssVarList.overlayGap},overlayBackgroundColor:{property:()=>k.cssVarList.overlayBackgroundColor},overlayPadding:{property:()=>k.cssVarList.overlayPadding},overlayBoxShadow:{property:()=>k.overlayBoxShadow},overlayOutlineWidth:{property:()=>k.cssVarList.overlayOutlineWidth},overlayOutlineColor:{property:()=>k.cssVarList.overlayOutlineColor},overlayOutlineStyle:{property:()=>k.cssVarList.overlayOutlineStyle},errorMessageIcon:{selector:u.w.componentName,property:u.w.cssVarList.errorMessageIcon},errorMessageIconSize:{selector:u.w.componentName,property:u.w.cssVarList.errorMessageIconSize},errorMessageIconPadding:{selector:u.w.componentName,property:u.w.cssVarList.errorMessageIconPadding},errorMessageIconRepeat:{selector:u.w.componentName,property:u.w.cssVarList.errorMessageIconRepeat},errorMessageIconPosition:{selector:u.w.componentName,property:u.w.cssVarList.errorMessageIconPosition},errorMessageFontSize:{selector:u.w.componentName,property:u.w.cssVarList.errorMessageFontSize}}}),(0,n.mA)({name:"overlay",selector:"",mappings:{marginTop:{...I,property:"margin-top"},backgroundColor:{...I},backdropBackgroundColor:{...T,property:"background-color"},backdropPointerEvents:{...T,property:"pointer-events"},padding:{...I},boxShadow:{...I},outlineWidth:{...I},outlineColor:{...I},outlineStyle:{...I}}}),n.VO,n.tQ)(class extends y{timestamp="";format=d.ui;selectedCounterIdx=0;updateCountersDisplay(){this.inputElement.value=this.countersValue}updateValue(){if(this.isCountersOutOfRange)this.updateTimestamp("");else{const e=l.F[this.format].getDate(this.inputElement.value);this.updateTimestamp(e.getTime())}}onDateCounterChange=()=>{this.updateCountersDisplay(),this.updateValue(),this.#i()};updateTimestamp(e){this.timestamp=e?(0,a.Nq)(e).getTime():""}dateCounters=[new h(d.rR.MONTH,this.onDateCounterChange.bind(this)),new h(d.rR.DAY,this.onDateCounterChange.bind(this)),new h(d.rR.YEAR,this.onDateCounterChange.bind(this))];static get observedAttributes(){return[].concat(y.observedAttributes||[],b)}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML=`\n <div>\n <descope-text-field inputmode="numeric">\n <span slot="suffix" class="toggle-calendar">\n ${p.ki}\n </span>\n </descope-text-field>\n <vaadin-popover></vaadin-popover>\n </div>\n `,(0,c.fz)('\n :host {\n display: inline-block;\n box-sizing: border-box;\n user-select: none;\n max-width: 100%;\n }\n\n :host ::slotted {\n padding: 0;\n }\n\n .toggle-calendar {\n cursor: pointer;\n display: flex;\n align-self: center;\n z-index: 1;\n height: 100%;\n align-items: center;\n }\n\n :host([readonly="true"]) .toggle-calendar {\n pointer-events: none;\n }\n\n .hidden {\n display: none;\n }\n ',this),this.inputElement=this.shadowRoot.querySelector("descope-text-field"),this.popoverToggleButton=this.inputElement.querySelector(".toggle-calendar")}get validationTarget(){return this.inputElement}get opened(){return"true"===this.getAttribute("opened")}get displayValueEpoch(){const e=l.F[this.format].getDate(this.inputElement.value);return(0,a.xP)(e?.getTime())?e.getTime():null}get sortedCounters(){return this.format.split(d.eT).map((e=>this.dateCounters.find((t=>t.placeholder===e))))}get activeCounter(){return this.sortedCounters[this.selectedCounterIdx]}get countersValue(){return this.sortedCounters.map((e=>e.stringValue)).join(d.eT)}get overlay(){return this.baseElement.shadowRoot?.querySelector("vaadin-popover-overlay")}get backdrop(){return this.overlay.shadowRoot?.querySelector("#backdrop")}get calendar(){return this.overlay?.querySelector("descope-calendar")}get isRTL(){const e=getComputedStyle(this.baseElement).getPropertyValue("direction");return e?"rtl"===e:"rtl"===this.getAttribute("st-host-direction")}get value(){return this.isInvalidDate()?"":this.timestamp}set value(e){e?(this.updateTimestamp(e),this.updateDateCounters((0,a.Nq)(e))):this.updateTimestamp("")}get isCountersEmpty(){return this.dateCounters.every((e=>e.isEmpty))}get isCountersOutOfRange(){return this.dateCounters.some((e=>!e.isInRange(e.numberValue)))}get disableCalendar(){return"true"===this.getAttribute("disable-calendar")}get isSelectAll(){const e=this.inputElement.baseElement.inputElement;return e.value.length===e.selectionStart+e.selectionEnd}reportValidity(){this.inputElement.reportValidity()}#i(){this.inputElement.baseElement.dispatchEvent(new Event("input",{bubbles:!0}))}updateInputDisplay(){this.inputElement.value=(0,a.Ey)((0,a.Nq)(this.countersValue).getTime(),this.format)}init(){super.init?.(),this.updateFormatPattern(),this.initPopover(),this.onDateCounterChange(),this.initInputElement(),setTimeout((()=>{this.#r()}),0)}initInputElement(){this.inputElement.getValidity=this.getValidity.bind(this),this.inputElement.baseElement.checkValidity=this.checkValidity.bind(this),this.popoverToggleButton.addEventListener("click",this.onPopoverToggle.bind(this)),this.inputElement.addEventListener("focus",this.onFocus.bind(this)),this.inputElement.addEventListener("blur",this.onBlur.bind(this)),this.inputElement.addEventListener("click",this.handleMouseCaretPositionChange.bind(this)),this.inputElement.addEventListener("keydown",this.handleKeyboard.bind(this)),this.inputElement.addEventListener("beforeinput",this.handleInput.bind(this)),this.inputElement.addEventListener("pointerdown",this.onPointerDown.bind(this)),this.inputElement.addEventListener("paste",this.onPaste.bind(this)),(0,o.EA)(this,this.inputElement,{includeAttrs:["label","label-type","placeholder","disabled","readonly","bordered","required","full-width","st-host-direction","pattern","bordered","data-errormessage-value-missing","data-errormessage-pattern-mismatch","data-errormessage-range-underflow","data-errormessage-range-overflow","st-error-message-icon","st-error-message-icon-size","st-error-message-icon-padding"]})}handleInput(e){e.preventDefault(),this.handleSelectAll(),e.data&&(0,a.Et)(e.data)?(this.parseDigits(e.data),this.updateCountersDisplay()):e.inputType&&this.handleNavKeys(e)}initPopover(){this.baseElement.trigger=["click"],this.baseElement.withBackdrop=!0,this.baseElement.renderer=this.#n.bind(this),this.baseElement.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation()}))}handleSelectAll(){this.isSelectAll&&this.selectFirstCounter()}#o;#n(e){e.firstChild||(this.overlay.positionTarget=this.shadowRoot.querySelector(".toggle-calendar"),e.appendChild(this.#s()),(0,a.Xs)(this.baseElement),this.backdrop.addEventListener("click",this.closePopover.bind(this))),e.style.setProperty("visibility","hidden"),setTimeout((()=>{this.#a(e),e.style.setProperty("visibility","visible"),this.updateCalendarView(e)}),100)}#a(){const e=this.shadowRoot.querySelector("vaadin-popover").shadowRoot;this.#o?.remove();const t=document.body.getBoundingClientRect(),i=this.getBoundingClientRect(),r=this.calendar.getBoundingClientRect(),n=this.isRTL?"right":"left",o=i[n]-r[n],s=r.left,a=t.width-r.right;let l;l=o>0?Math.min(o,a):-1*Math.min(Math.abs(o),s),(0,c.fz)(`\n vaadin-popover-overlay::part(overlay) {\n transform: translateX(${l}px);\n }\n `,e)}#s(){const e=document.createElement("span");e.innerHTML="<descope-calendar></descope-calendar>";const t=e.querySelector("descope-calendar");return t.addEventListener("date-submit",this.onCalendarSubmit.bind(this)),t.addEventListener("cancel",this.closePopover.bind(this)),e}#r(){this.overlay._attachOverlay=()=>this.overlay.bringToFront(),this.overlay._detachOverlay=()=>{},this.overlay._enterModalState=()=>{}}onPopoverToggle(){this.opened?this.closePopover():this.openPopover()}openPopover(){this.disableCalendar||this.setAttribute("opened","true")}closePopover(){this.removeAttribute("opened"),this.inputElement.focus()}getCounterById(e){return this.dateCounters.find((t=>t.id===e))}onCalendarSubmit(){if(!this.isReadOnly){if(!this.calendar.value)return;const e=(0,a.Nq)(this.calendar.value);this.value=e.getTime(),this.getCounterById("year").replaceValue(e.getFullYear()),this.getCounterById("month").replaceValue(e.getMonth()+1),this.getCounterById("day").replaceValue(e.getDate()),this.#i()}this.closePopover()}updateCalendarView(){const e=(0,a.xP)((0,a.Nq)(this.inputElement.value||"").getTime())&&l.F[this.format].validate(this.inputElement.value);this.displayValueEpoch||e?this.calendar.setAttribute("initial-value",(0,a.Ey)(this.displayValueEpoch||this.timestamp,d.wJ)):(this.calendar.clearValue(),this.calendar.setAttribute("preview",(0,a.Ey)((0,a.Ln)(),d.wJ))),(0,o.EA)(this,this.calendar,{includeAttrs:["st-host-direction","readonly","initial-month","initial-year","years-range","calendar-label-submit","calendar-label-cancel","calendar-months","calendar-weekdays","calendar-weekdays-short"]})}onPointerDown(e){setTimeout((()=>this.handleMouseCaretPositionChange(e)),d.SZ)}onFocus(){this.isReadOnly||setTimeout((()=>this.resetDisplay()))}resetDisplay(){this.inputElement.value||(this.inputElement.value=this.format),this.selectFirstCounter(),this.inputElement.setSelectionRange(0,this.sortedCounters[0].length)}onBlur(){this.opened||this.inputElement.value===this.format&&(this.inputElement.value="")}onFormatUpdate(e){Object.keys(l.F).includes(e)&&(this.format=e,this.updateFormatPattern())}updateFormatPattern(){const e=this.getAttribute("format")||this.format||d.ui;this.setAttribute("type","date"),this.setAttribute("pattern",l.F[e].pattern)}parseDigits(e){this.activeCounter.add(e),this.activeCounter.isFull&&this.selectNextCounter(),this.setInputSelectionRange()}getCounterIdx(e){const[t,i]=this.sortedCounters.map((e=>e.length));return[e<=t,e>=t&&e<=t+i+1,e>=t+i+2].indexOf(!0)}setSelectedCounterByCaretPosition(e){this.selectedCounterIdx=this.getCounterIdx(e.target?.selectionStart||this.inputElement.selectionStart)}selectFirstCounter(){this.selectedCounterIdx=0}selectNextCounter(){this.selectedCounterIdx<this.dateCounters.length&&(this.selectedCounterIdx=Math.min(this.selectedCounterIdx+1,2))}selectPrevCounter(){this.selectedCounterIdx>0&&(this.selectedCounterIdx=Math.min(this.selectedCounterIdx-1,1))}setInputSelectionRange(){this.selectedCounterIdx<0||setTimeout((()=>{const e=this.sortedCounters.slice(0,this.selectedCounterIdx).reduce(((e,t)=>e+t.length),this.selectedCounterIdx);this.inputElement.setSelectionRange(e,e+this.sortedCounters[this.selectedCounterIdx].length)}))}resetDateCounters(){this.dateCounters.forEach((e=>e.clear()))}updateDateCounters(e){this.dateCounters.forEach((t=>{switch(t.id){case d.rR.MONTH.id:t.set(e.getMonth()+1);break;case d.rR.YEAR.id:t.set(e.getFullYear());break;case d.rR.DAY.id:t.set(e.getDate())}}))}handleKeyboard(e){e.metaKey||e.ctrlKey?"x"===e.key.toLowerCase()&&this.onCut(e):(this.handleSelectAll(),"ArrowUp"===e.key?this.activeCounter.inc():"ArrowDown"===e.key?this.activeCounter.dec():"ArrowRight"===e.key?this.selectNextCounter():"ArrowLeft"===e.key&&this.selectPrevCounter(),this.setInputSelectionRange())}handleNavKeys(e){this.isReadOnly||(this.opened&&this.closePopover(),this.activeCounter&&("deleteContentBackward"===e.inputType&&this.handleBackspace(),this.setInputSelectionRange()))}handleBackspace(){if(this.isSelectAll)return void this.resetToInitialState();const e=this.activeCounter;e.isEmpty?(this.selectPrevCounter(),this.setInputSelectionRange()):e.set(""),setTimeout((()=>{this.updateCountersDisplay(),this.setInputSelectionRange()}))}handleMouseCaretPositionChange(e){this.opened||(e.preventDefault(),this.setSelectedCounterByCaretPosition(e),this.setInputSelectionRange())}onInitialValueChange(e){this.value||setTimeout((()=>{this.value=e}))}togglePopoverAccess(e){e?this.popoverToggleButton.classList.remove("hidden"):this.popoverToggleButton.classList.add("hidden")}attributeChangedCallback(e,t,i){super.attributeChangedCallback?.(e,t,i),t!==i&&("disable-calendar"===e&&this.togglePopoverAccess("true"!==i),m.includes(e)?(i&&"format"===e&&this.onFormatUpdate(i),"initial-value"===e&&this.onInitialValueChange(i)):v.includes(e)&&(i?this.calendar?.setAttribute(e,i):this.calendar?.removeAttribute(e)))}isInvalidDate(){const e=this.getCounterById("year"),t=e.numberValue>d.nr.year.max||e.numberValue<d.nr.year.min,i=Object.entries(this.getDateVals()).some((([e,t])=>{const i=this.getCounterById(e);return!t||i.numberValue!==t}));return t||i}getValidity(){return this.isRequired&&this.isCountersEmpty?{valueMissing:!0}:this.isCountersOutOfRange||this.isInvalidDate()?{patternMismatch:!0}:{}}getDateVals(){const e={day:"",month:"",year:""};try{const t=(0,a.Nq)(this.timestamp);e.month=t.getMonth()+1,e.day=t.getDate(),e.year=t.getFullYear()}catch(e){}return e}resetToInitialState(){this.resetDateCounters(),this.selectFirstCounter(),this.resetDisplay()}onCut(e){e.preventDefault(),this.isSelectAll?(this.#l(this.countersValue),this.resetToInitialState()):(this.#l(this.activeCounter.stringValue),this.activeCounter.set("")),this.setInputSelectionRange()}#l(e){try{navigator.clipboard.writeText(e)}catch(e){console.error("Failed to copy date value:",e)}}onPaste(e){e.preventDefault();const t=(e.clipboardData||window.clipboardData).getData("Text"),i=(0,a.Rm)(t,this.format);if(i)this.value=i.getTime(),this.onDateCounterChange(),setTimeout((()=>this.inputElement.setSelectionRange(0,this.inputElement.value.length)));else{const e=Number(t);e&&this.activeCounter.min<=e&&this.activeCounter.max>=e&&(this.activeCounter.set(String(e)),setTimeout((()=>this.setInputSelectionRange())))}}});customElements.define(g,k)}}]);
|
1
|
+
"use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[9257],{6424:(e,t,i)=>{i.d(t,{A:()=>C});const{host:r,label:n,placeholder:o,requiredIndicator:s,inputField:a,input:l,inputMask:p,helperText:d,errorMessage:h,disabledPlaceholder:c,inputDisabled:u,inputIcon:g,externalInput:y,externalInputDisabled:m,externalPlaceholder:v,externalDisabledPlaceholder:b}={host:{selector:()=>":host"},label:{selector:"::part(label)"},requiredIndicator:{selector:"[required]::part(required-indicator)::after"},placeholder:[{selector:"> input:placeholder-shown"},{selector:()=>":host::slotted(input:placeholder-shown)"}],disabledPlaceholder:{selector:"> input:disabled::placeholder"},inputField:{selector:"::part(input-field)"},input:{selector:"input"},inputMask:{selector:"::part(input-field)::before"},inputDisabled:{selector:"input:disabled"},helperText:{selector:"::part(helper-text)"},errorMessage:{selector:"::part(error-message)"},inputIcon:{selector:"vaadin-icon"},externalInput:{selector:()=>"::slotted(input)"},externalInputDisabled:{selector:()=>"::slotted(input:disabled)"},externalPlaceholder:{selector:()=>"::slotted(input:placeholder-shown)"},externalDisabledPlaceholder:{selector:()=>"::slotted(input:disabled::placeholder)"}},C={fontSize:[{},r],fontFamily:[n,a,d,h],labelFontSize:{...n,property:"font-size"},labelFontWeight:{...n,property:"font-weight"},labelTextColor:[{...n,property:"color"},{...s,property:"color"},{...n,property:"-webkit-text-fill-color"},{...s,property:"-webkit-text-fill-color"}],hostWidth:{...r,property:"width"},hostMinWidth:{...r,property:"min-width"},hostDirection:{...r,property:"direction"},inputDirection:{...l,property:"direction"},inputBackgroundColor:[{...a,property:"background-color"},{...p,property:"background-color"}],errorMessageTextColor:{...h,property:"color"},errorMessageIcon:{...h,property:"background-image"},errorMessageIconSize:{...h,property:"background-size"},errorMessageIconPadding:{...h,property:"padding-inline-start"},errorMessageIconRepeat:{...h,property:"background-repeat"},errorMessageIconPosition:{...h,property:"background-position"},errorMessageFontSize:{...h,property:"font-size"},helperTextColor:{...d,property:"-webkit-text-fill-color"},inputValueTextColor:[{...a,property:"color"},{...u,property:"-webkit-text-fill-color"},{...m,property:"-webkit-text-fill-color"}],inputCaretTextColor:[{...l,property:"caret-color"},{...y,property:"caret-color"}],labelRequiredIndicator:{...s,property:"content"},inputBorderColor:{...a,property:"border-color"},inputBorderWidth:{...a,property:"border-width"},inputBorderStyle:{...a,property:"border-style"},inputBorderRadius:{...a,property:"border-radius"},inputHeight:{...a,property:"height"},inputHorizontalPadding:[{...l,property:"padding-left"},{...l,property:"padding-right"},{...y,property:"padding-left"},{...y,property:"padding-right"}],inputOutlineColor:{...a,property:"outline-color"},inputOutlineStyle:{...a,property:"outline-style"},inputOutlineWidth:{...a,property:"outline-width"},inputOutlineOffset:{...a,property:"outline-offset"},textAlign:{},inputTextAlign:[{...l,property:"text-align"},{...y,property:"text-align"}],inputPlaceholderColor:[{selector:()=>":host input:placeholder-shown",property:"color"},{...v,property:"color"},{...o,property:"color"},{...c,property:"-webkit-text-fill-color"},{...b,property:"-webkit-text-fill-color"}],labelPosition:{...n,property:"position"},labelTopPosition:{...n,property:"top"},labelHorizontalPosition:[{...n,property:"left"},{...n,property:"right"}],inputTransformY:{...n,property:"transform"},inputTransition:{...n,property:"transition"},marginInlineStart:{...n,property:"margin-inline-start"},placeholderOpacity:[{selector:"> input:placeholder-shown",property:"opacity"},{...v,property:"opacity"}],inputVerticalAlignment:[{...a,property:"align-items"},{...y,property:"align-items"}],valueInputHeight:[{...l,property:"height"},{...y,property:"height"}],valueInputMarginBottom:[{...l,property:"margin-bottom"},{...y,property:"margin-bottom"}],inputIconOffset:[{...g,property:"margin-right"},{...g,property:"margin-left"}],inputIconSize:{...g,property:"font-size"},inputIconColor:{...g,property:"color"}}},21374:(e,t,i)=>{i.r(t),i.d(t,{TextFieldClass:()=>r.w,componentName:()=>r.T}),i(11284),i(37182),i(95260);var r=i(79275);customElements.define(r.T,r.w)},79275:(e,t,i)=>{i.d(t,{T:()=>l,w:()=>d});var r=i(79365),n=i(6424),o=i(9696),s=i(97810),a=i(73551);const l=(0,s.xE)("text-field"),p=["type","label-type","copy-to-clipboard"],d=(0,o.Zz)((0,r.RF)({mappings:n.A}),r.VO,(0,r.OZ)({proxyProps:["value","selectionStart"],useProxyTargets:!0}),r.tQ,(e=>class extends e{static get observedAttributes(){return p.concat(e.observedAttributes||[])}icon;init(){super.init?.()}renderCopyToClipboard(e){if(!e)return void this.icon?.remove();const t={icon:"vaadin:copy-o",title:"Copy",style:"cursor: pointer"},i={icon:"vaadin:check-circle-o",title:"Copied",style:"cursor: initial"};this.icon=Object.assign(document.createElement("vaadin-icon"),{slot:"suffix",...t}),this.baseElement.appendChild(this.icon),this.icon.addEventListener("click",(()=>{navigator.clipboard.writeText(this.value),Object.assign(this.icon,i),setTimeout((()=>{Object.assign(this.icon,t)}),5e3)}))}onLabelClick(){this.focus()}attributeChangedCallback(e,t,i){super.attributeChangeCallback?.(e,t,i),"type"===e&&this.baseElement._setType(i),t!==i&&("label-type"===e?"floating"===i?this.addEventListener("click",this.onLabelClick):this.removeEventListener("click",this.onLabelClick):"copy-to-clipboard"===e&&this.renderCopyToClipboard("true"===i))}}))((0,r.tz)({slots:["prefix","suffix"],wrappedEleName:"vaadin-text-field",style:()=>`\n\t\t\t:host {\n\t\t\t\tdisplay: inline-block;\n\t\t\t\tmax-width: 100%;\n\t\t\t\tpadding: calc(var(${d.cssVarList.inputOutlineWidth}) + var(${d.cssVarList.inputOutlineOffset}));\n box-sizing: border-box;\n\t\t\t}\n :host(:is([readonly], [disabled])) ::slotted(:is(input, textarea):placeholder-shown) {\n opacity: 1;\n }\n\n vaadin-text-field[label-type="floating"]:not([focused])[readonly] > input:placeholder-shown {\n opacity: 0;\n }\n vaadin-text-field[label-type="floating"]:not([focused])[disabled] > input:placeholder-shown {\n opacity: 0;\n }\n ${(0,a.$J)("vaadin-text-field")}\n\t\t\t${(0,a.cy)(d.cssVarList)}\n\t\t\t${(0,a.LJ)("vaadin-text-field",d.cssVarList)}\n ${(0,a.Kl)()}\n\n vaadin-text-field vaadin-icon {\n align-self: center;\n }\n\t\t`,excludeAttrsSync:["tabindex","style"],componentName:l}))},79981:(e,t,i)=>{i.r(t),i.d(t,{DateFieldClass:()=>k,componentName:()=>g}),i(45992),i(88350),i(21374);var r=i(3393),n=i(79365),o=i(97810),s=i(9696),a=i(49224),l=i(77421),p=i(80071),d=i(64101);class h{#e=Object.freeze([]);constructor({id:e,min:t,max:i,placeholder:r},n){this.id=e,this.min=t,this.max=i,this.placeholder=r,this.onChange=n}get data(){return this.#e}set data(e){this.#e=Object.freeze(e),this.onChange?.()}get#t(){return this.data.length?this.numberValue:0}get numberValue(){return Number(this.stringValue)}get stringValue(){return(this.data.join("")||this.placeholder).padStart(this.length,"0")}get isFull(){return 10*this.numberValue>this.max||this.data.length===this.length}get isEmpty(){return this.stringValue===this.placeholder}get length(){return this.max.toString().length}set(e){this.data=e.toString().split("")}add(e){let t=this.data;return t=[...t,e],Number(t.join(""))>this.max?t=[e]:this.length<t.length&&(t=t.slice(1,t.length)),this.data=t,e}del(){this.data.filter((e=>"0"!==e)).filter(Boolean).length?this.data=this.data.slice(0,this.data.length-1):this.data=[]}clear(){this.data=[]}inc(e){this.replaceValue(this.#t<this.max?Math.max(this.#t+(e||1),this.min):this.min)}dec(e){this.replaceValue(this.#t>this.min?Math.min(this.#t-(e||1),this.max):this.max)}isInRange(e){return e>=this.min&&e<=this.max}replaceValue(e){this.isInRange(e)&&(this.data=e.toString().padStart(this.length,0).split(""))}setMin(e){this.min=Number(e)}setMax(e){this.max=Number(e)}}var c=i(79275),u=i(25964);const g=(0,o.xE)("date-field"),y=(0,r.y)({componentName:g,baseSelector:"vaadin-popover"}),m=["format","opened","initial-value","readonly","disable-calendar","utc-time"],v=["years-range","calendar-months","calendar-weekdays"],b=[...m,...v],C=c.w.cssVarList,{host:f,input:x,inputEleRTL:E,toggleButton:w,overlay:I,backdrop:T,errorMessage:S}={host:{selector:()=>":host"},input:{selector:()=>"descope-text-field"},inputEleRTL:{selector:()=>':host([st-host-direction="rtl"]) descope-text-field'},toggleButton:{selector:()=>".toggle-calendar"},overlay:{selector:"vaadin-popover-overlay::part(overlay)"},backdrop:{selector:"vaadin-popover-overlay::part(backdrop)"}},k=(0,s.Zz)((0,n.RF)({componentNameOverride:(0,o.xE)("input-wrapper")}),(0,n.RF)({mappings:{iconMargin:{...w,property:"margin-inline-end"},hostWidth:{...f,property:"width"},hostDirection:{...f,property:"direction"},textAlign:{...x,property:"text-align"},rtlInputDirection:{...E,property:C.inputDirection},rtlInputAlignment:{...E,property:C.inputTextAlign},overlayGap:{property:()=>k.cssVarList.overlayGap},overlayBackgroundColor:{property:()=>k.cssVarList.overlayBackgroundColor},overlayPadding:{property:()=>k.cssVarList.overlayPadding},overlayBoxShadow:{property:()=>k.overlayBoxShadow},overlayOutlineWidth:{property:()=>k.cssVarList.overlayOutlineWidth},overlayOutlineColor:{property:()=>k.cssVarList.overlayOutlineColor},overlayOutlineStyle:{property:()=>k.cssVarList.overlayOutlineStyle},errorMessageIcon:{selector:c.w.componentName,property:c.w.cssVarList.errorMessageIcon},errorMessageIconSize:{selector:c.w.componentName,property:c.w.cssVarList.errorMessageIconSize},errorMessageIconPadding:{selector:c.w.componentName,property:c.w.cssVarList.errorMessageIconPadding},errorMessageIconRepeat:{selector:c.w.componentName,property:c.w.cssVarList.errorMessageIconRepeat},errorMessageIconPosition:{selector:c.w.componentName,property:c.w.cssVarList.errorMessageIconPosition},errorMessageFontSize:{selector:c.w.componentName,property:c.w.cssVarList.errorMessageFontSize}}}),(0,n.mA)({name:"overlay",selector:"",mappings:{marginTop:{...I,property:"margin-top"},backgroundColor:{...I},backdropBackgroundColor:{...T,property:"background-color"},backdropPointerEvents:{...T,property:"pointer-events"},padding:{...I},boxShadow:{...I},outlineWidth:{...I},outlineColor:{...I},outlineStyle:{...I}}}),n.VO,n.tQ)(class extends y{epoch="";format=d.ui;selectedCounterIdx=0;updateCountersDisplay(){this.inputElement.value=this.countersValue}updateValue(){if(this.isCountersOutOfRange)this.updateEpoch("");else{const e=l.F[this.format].getDate(this.inputElement.value);this.updateEpoch((0,a.xq)(e,this.isUtcTime))}}onDateCounterChange=()=>{this.updateCountersDisplay(),this.updateValue(),this.#i()};updateEpoch(e){this.epoch=e?(0,a.Nq)(e).getTime():""}dateCounters=[new h(d.rR.MONTH,this.onDateCounterChange.bind(this)),new h(d.rR.DAY,this.onDateCounterChange.bind(this)),new h(d.rR.YEAR,this.onDateCounterChange.bind(this))];static get observedAttributes(){return[].concat(y.observedAttributes||[],b)}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML=`\n <div>\n <descope-text-field inputmode="numeric">\n <span slot="suffix" class="toggle-calendar">\n ${p.ki}\n </span>\n </descope-text-field>\n <vaadin-popover></vaadin-popover>\n </div>\n `,(0,u.fz)('\n :host {\n display: inline-block;\n box-sizing: border-box;\n user-select: none;\n max-width: 100%;\n }\n\n :host ::slotted {\n padding: 0;\n }\n\n .toggle-calendar {\n cursor: pointer;\n display: flex;\n align-self: center;\n z-index: 1;\n height: 100%;\n align-items: center;\n }\n\n :host([readonly="true"]) .toggle-calendar {\n pointer-events: none;\n }\n\n .hidden {\n display: none;\n }\n ',this),this.inputElement=this.shadowRoot.querySelector("descope-text-field"),this.popoverToggleButton=this.inputElement.querySelector(".toggle-calendar")}get validationTarget(){return this.inputElement}get opened(){return"true"===this.getAttribute("opened")}get displayValueEpoch(){const e=l.F[this.format].getDate(this.inputElement.value);return(0,a.mZ)(e?.getTime())?e.getTime():null}get sortedCounters(){return this.format.split(d.eT).map((e=>this.dateCounters.find((t=>t.placeholder===e))))}get activeCounter(){return this.sortedCounters[this.selectedCounterIdx]}get countersValue(){return this.sortedCounters.map((e=>e.stringValue)).join(d.eT)}get overlay(){return this.baseElement.shadowRoot?.querySelector("vaadin-popover-overlay")}get backdrop(){return this.overlay.shadowRoot?.querySelector("#backdrop")}get calendar(){return this.overlay?.querySelector("descope-calendar")}get isRTL(){const e=getComputedStyle(this.baseElement).getPropertyValue("direction");return e?"rtl"===e:"rtl"===this.getAttribute("st-host-direction")}get value(){return this.isInvalidDate()?"":this.epoch}set value(e){e?(this.updateEpoch(e),this.updateDateCounters((0,a.Nq)(e))):this.updateEpoch("")}get isCountersEmpty(){return this.dateCounters.every((e=>e.isEmpty))}get isCountersOutOfRange(){return this.dateCounters.some((e=>!e.isInRange(e.numberValue)))}get disableCalendar(){return"true"===this.getAttribute("disable-calendar")}get isUtcTime(){return"true"===this.getAttribute("utc-time")}get isSelectAll(){const e=this.inputElement.baseElement.inputElement;return e.value.length===e.selectionStart+e.selectionEnd}reportValidity(){this.inputElement.reportValidity()}#i(){this.inputElement.baseElement.dispatchEvent(new Event("input",{bubbles:!0}))}updateInputDisplay(){this.inputElement.value=(0,a.jO)((0,a.Nq)(this.countersValue).getTime(),this.format)}init(){super.init?.(),this.updateFormatPattern(),this.initPopover(),this.onDateCounterChange(),this.initInputElement(),setTimeout((()=>{this.#r()}),0)}initInputElement(){this.inputElement.getValidity=this.getValidity.bind(this),this.inputElement.baseElement.checkValidity=this.checkValidity.bind(this),this.popoverToggleButton.addEventListener("click",this.onPopoverToggle.bind(this)),this.inputElement.addEventListener("focus",this.onFocus.bind(this)),this.inputElement.addEventListener("blur",this.onBlur.bind(this)),this.inputElement.addEventListener("click",this.handleMouseCaretPositionChange.bind(this)),this.inputElement.addEventListener("keydown",this.handleKeyboard.bind(this)),this.inputElement.addEventListener("beforeinput",this.handleInput.bind(this)),this.inputElement.addEventListener("pointerdown",this.onPointerDown.bind(this)),this.inputElement.addEventListener("paste",this.onPaste.bind(this)),(0,o.EA)(this,this.inputElement,{includeAttrs:["label","label-type","placeholder","disabled","readonly","bordered","required","full-width","st-host-direction","pattern","bordered","data-errormessage-value-missing","data-errormessage-pattern-mismatch","data-errormessage-range-underflow","data-errormessage-range-overflow","st-error-message-icon","st-error-message-icon-size","st-error-message-icon-padding"]})}handleInput(e){e.preventDefault(),this.handleSelectAll(),e.data&&(0,a.Et)(e.data)?(this.parseDigits(e.data),this.updateCountersDisplay()):e.inputType&&this.handleNavKeys(e)}initPopover(){this.baseElement.trigger=["click"],this.baseElement.withBackdrop=!0,this.baseElement.renderer=this.#n.bind(this),this.baseElement.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation()}))}handleSelectAll(){this.isSelectAll&&this.selectFirstCounter()}#o;#n(e){e.firstChild||(this.overlay.positionTarget=this.shadowRoot.querySelector(".toggle-calendar"),e.appendChild(this.#s()),(0,a.Xs)(this.baseElement),this.backdrop.addEventListener("click",this.closePopover.bind(this))),e.style.setProperty("visibility","hidden"),setTimeout((()=>{this.#a(e),e.style.setProperty("visibility","visible"),this.updateCalendarView(e)}),100)}#a(){const e=this.shadowRoot.querySelector("vaadin-popover").shadowRoot;this.#o?.remove();const t=document.body.getBoundingClientRect(),i=this.getBoundingClientRect(),r=this.calendar.getBoundingClientRect(),n=this.isRTL?"right":"left",o=i[n]-r[n],s=r.left,a=t.width-r.right;let l;l=o>0?Math.min(o,a):-1*Math.min(Math.abs(o),s),(0,u.fz)(`\n vaadin-popover-overlay::part(overlay) {\n transform: translateX(${l}px);\n }\n `,e)}#s(){const e=document.createElement("span");e.innerHTML="<descope-calendar></descope-calendar>";const t=e.querySelector("descope-calendar");return t.addEventListener("date-submit",this.onCalendarSubmit.bind(this)),t.addEventListener("cancel",this.closePopover.bind(this)),e}#r(){this.overlay._attachOverlay=()=>this.overlay.bringToFront(),this.overlay._detachOverlay=()=>{},this.overlay._enterModalState=()=>{}}onPopoverToggle(){this.opened?this.closePopover():this.openPopover()}openPopover(){this.disableCalendar||this.setAttribute("opened","true")}closePopover(){this.removeAttribute("opened"),this.inputElement.focus()}getCounterById(e){return this.dateCounters.find((t=>t.id===e))}onCalendarSubmit(){if(!this.isReadOnly){if(!this.calendar.value)return;const e=(0,a.Nq)(this.calendar.value);this.value=(0,a.xq)(e,this.isUtcTime),this.getCounterById("year").replaceValue(e.getFullYear()),this.getCounterById("month").replaceValue(e.getMonth()+1),this.getCounterById("day").replaceValue(e.getDate()),this.#i()}this.closePopover()}updateCalendarView(){const e=(0,a.mZ)((0,a.Nq)(this.inputElement.value||"").getTime())&&l.F[this.format].validate(this.inputElement.value);this.displayValueEpoch||e?this.calendar.setAttribute("initial-value",(0,a.jO)(this.displayValueEpoch||this.epoch,d.wJ)):(this.calendar.clearValue(),this.calendar.setAttribute("preview",(0,a.jO)((0,a.Ln)(),d.wJ))),(0,o.EA)(this,this.calendar,{includeAttrs:["st-host-direction","readonly","initial-month","initial-year","years-range","calendar-label-submit","calendar-label-cancel","calendar-months","calendar-weekdays","calendar-weekdays-short"]})}onPointerDown(e){setTimeout((()=>this.handleMouseCaretPositionChange(e)),d.SZ)}onFocus(){this.isReadOnly||setTimeout((()=>this.resetDisplay()))}resetDisplay(){this.inputElement.value||(this.inputElement.value=this.format),this.selectFirstCounter(),this.inputElement.setSelectionRange(0,this.sortedCounters[0].length)}onBlur(){this.opened||this.inputElement.value===this.format&&(this.inputElement.value="")}onFormatUpdate(e){Object.keys(l.F).includes(e)&&(this.format=e,this.updateFormatPattern())}updateFormatPattern(){const e=this.getAttribute("format")||this.format||d.ui;this.setAttribute("type","date"),this.setAttribute("pattern",l.F[e].pattern)}parseDigits(e){this.activeCounter.add(e),this.activeCounter.isFull&&this.selectNextCounter(),this.setInputSelectionRange()}getCounterIdx(e){const[t,i]=this.sortedCounters.map((e=>e.length));return[e<=t,e>=t&&e<=t+i+1,e>=t+i+2].indexOf(!0)}setSelectedCounterByCaretPosition(e){this.selectedCounterIdx=this.getCounterIdx(e.target?.selectionStart||this.inputElement.selectionStart)}selectFirstCounter(){this.selectedCounterIdx=0}selectNextCounter(){this.selectedCounterIdx<this.dateCounters.length&&(this.selectedCounterIdx=Math.min(this.selectedCounterIdx+1,2))}selectPrevCounter(){this.selectedCounterIdx>0&&(this.selectedCounterIdx=Math.min(this.selectedCounterIdx-1,1))}setInputSelectionRange(){this.selectedCounterIdx<0||setTimeout((()=>{const e=this.sortedCounters.slice(0,this.selectedCounterIdx).reduce(((e,t)=>e+t.length),this.selectedCounterIdx);this.inputElement.setSelectionRange(e,e+this.sortedCounters[this.selectedCounterIdx].length)}))}resetDateCounters(){this.dateCounters.forEach((e=>e.clear()))}updateDateCounters(e){this.dateCounters.forEach((t=>{switch(t.id){case d.rR.MONTH.id:t.set(e.getMonth()+1);break;case d.rR.YEAR.id:t.set(e.getFullYear());break;case d.rR.DAY.id:t.set(e.getDate())}}))}handleKeyboard(e){e.metaKey||e.ctrlKey?"x"===e.key.toLowerCase()&&this.onCut(e):(this.handleSelectAll(),"ArrowUp"===e.key?this.activeCounter.inc():"ArrowDown"===e.key?this.activeCounter.dec():"ArrowRight"===e.key?this.selectNextCounter():"ArrowLeft"===e.key&&this.selectPrevCounter(),this.setInputSelectionRange())}handleNavKeys(e){this.isReadOnly||(this.opened&&this.closePopover(),this.activeCounter&&("deleteContentBackward"===e.inputType&&this.handleBackspace(),this.setInputSelectionRange()))}handleBackspace(){if(this.isSelectAll)return void this.resetToInitialState();const e=this.activeCounter;e.isEmpty?(this.selectPrevCounter(),this.setInputSelectionRange()):e.set(""),setTimeout((()=>{this.updateCountersDisplay(),this.setInputSelectionRange()}))}handleMouseCaretPositionChange(e){this.opened||(e.preventDefault(),this.setSelectedCounterByCaretPosition(e),this.setInputSelectionRange())}onInitialValueChange(e){this.value||setTimeout((()=>{this.value=e}))}togglePopoverAccess(e){e?this.popoverToggleButton.classList.remove("hidden"):this.popoverToggleButton.classList.add("hidden")}attributeChangedCallback(e,t,i){super.attributeChangedCallback?.(e,t,i),t!==i&&("disable-calendar"===e&&this.togglePopoverAccess("true"!==i),m.includes(e)?(i&&"format"===e&&this.onFormatUpdate(i),"initial-value"===e&&this.onInitialValueChange(i)):v.includes(e)&&(i?this.calendar?.setAttribute(e,i):this.calendar?.removeAttribute(e)))}isInvalidDate(){const e=this.getCounterById("year"),t=e.numberValue>d.nr.year.max||e.numberValue<d.nr.year.min,i=Object.entries(this.getDateVals()).some((([e,t])=>{const i=this.getCounterById(e);return!t||i.numberValue!==t}));return t||i}getValidity(){return this.isRequired&&this.isCountersEmpty?{valueMissing:!0}:this.isCountersOutOfRange||this.isInvalidDate()?{patternMismatch:!0}:{}}getDateVals(){const e={day:"",month:"",year:""};if(!this.epoch)return e;try{const t=(0,a.Nq)(this.epoch);this.isUtcTime?(e.month=t.getUTCMonth()+1,e.day=t.getUTCDate(),e.year=t.getUTCFullYear()):(e.month=t.getMonth()+1,e.day=t.getDate(),e.year=t.getFullYear())}catch(e){}return e}resetToInitialState(){this.resetDateCounters(),this.selectFirstCounter(),this.resetDisplay()}onCut(e){e.preventDefault(),this.isSelectAll?(this.#l(this.countersValue),this.resetToInitialState()):(this.#l(this.activeCounter.stringValue),this.activeCounter.set("")),this.setInputSelectionRange()}#l(e){try{navigator.clipboard.writeText(e)}catch(e){console.error("Failed to copy date value:",e)}}onPaste(e){e.preventDefault();const t=(e.clipboardData||window.clipboardData).getData("Text"),i=(0,a.Rm)(t,this.format);if(i)this.value=(0,a.xq)(i,this.isUtcTime),this.onDateCounterChange(),setTimeout((()=>this.inputElement.setSelectionRange(0,this.inputElement.value.length)));else{const e=Number(t);e&&this.activeCounter.min<=e&&this.activeCounter.max>=e&&(this.activeCounter.set(String(e)),setTimeout((()=>this.setInputSelectionRange())))}}});customElements.define(g,k)}}]);
|
2
2
|
//# sourceMappingURL=descope-date-field-index-js.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"descope-date-field-index-js.js","mappings":"yJAAA,MAAM,KACJA,EAAI,MACJC,EAAK,YACLC,EAAW,kBACXC,EAAiB,WACjBC,EAAU,MACVC,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,eACfE,QAAQ,QAGnCC,GAAY,QAAgBJ,EAAY5Q,KAAKqG,QAEnD,GAAI2K,EACFhR,KAAKiB,MAAQ+P,EAAUhK,UACvBhH,KAAKiH,sBAGL/F,YAAW,IAAMlB,KAAKwG,aAAamH,kBAAkB,EAAG3N,KAAKwG,aAAavF,MAAMwB,cAC3E,CACL,MAAMxB,EAAQ0B,OAAOiO,GAGjB3P,GAASjB,KAAKsI,cAAclG,KAAOnB,GAASjB,KAAKsI,cAAcjG,KAAOpB,IAExEjB,KAAKsI,cAAcpF,IAAI+N,OAAOhQ,IAE9BC,YAAW,IAAMlB,KAAKiO,2BAE1B,CACF,IC7zBFjP,eAAeC,OAAOC,EAAe4F,E","sources":["webpack://@descope/web-components-ui/./src/components/descope-text-field/textFieldMappings.js","webpack://@descope/web-components-ui/./src/components/descope-text-field/index.js","webpack://@descope/web-components-ui/./src/components/descope-text-field/TextFieldClass.js","webpack://@descope/web-components-ui/./src/components/descope-date-field/DateCounterClass.js","webpack://@descope/web-components-ui/./src/components/descope-date-field/DateFieldClass.js","webpack://@descope/web-components-ui/./src/components/descope-date-field/index.js"],"sourcesContent":["const {\n host,\n label,\n placeholder,\n requiredIndicator,\n inputField,\n input,\n inputMask,\n helperText,\n errorMessage,\n disabledPlaceholder,\n inputDisabled,\n inputIcon,\n externalInput,\n externalInputDisabled,\n externalPlaceholder,\n externalDisabledPlaceholder,\n} = {\n host: { selector: () => ':host' },\n label: { selector: '::part(label)' },\n requiredIndicator: { selector: '[required]::part(required-indicator)::after' },\n placeholder: [\n { selector: '> input:placeholder-shown' },\n { selector: () => ':host::slotted(input:placeholder-shown)' },\n ],\n disabledPlaceholder: { selector: '> input:disabled::placeholder' },\n inputField: { selector: '::part(input-field)' },\n input: { selector: 'input' },\n inputMask: { selector: '::part(input-field)::before' },\n inputDisabled: { selector: 'input:disabled' },\n helperText: { selector: '::part(helper-text)' },\n errorMessage: { selector: '::part(error-message)' },\n inputIcon: { selector: 'vaadin-icon' },\n externalInput: { selector: () => '::slotted(input)' },\n externalInputDisabled: { selector: () => '::slotted(input:disabled)' },\n externalPlaceholder: { selector: () => '::slotted(input:placeholder-shown)' },\n externalDisabledPlaceholder: { selector: () => '::slotted(input:disabled::placeholder)' },\n};\n\nexport default {\n // we apply font-size also on the host so we can set its width with em\n fontSize: [{}, host],\n fontFamily: [label, inputField, helperText, errorMessage],\n\n labelFontSize: { ...label, property: 'font-size' },\n labelFontWeight: { ...label, property: 'font-weight' },\n\n labelTextColor: [\n { ...label, property: 'color' },\n { ...requiredIndicator, property: 'color' },\n { ...label, property: '-webkit-text-fill-color' },\n { ...requiredIndicator, property: '-webkit-text-fill-color' },\n ],\n\n hostWidth: { ...host, property: 'width' },\n hostMinWidth: { ...host, property: 'min-width' },\n hostDirection: { ...host, property: 'direction' },\n inputDirection: { ...input, property: 'direction' },\n\n inputBackgroundColor: [\n { ...inputField, property: 'background-color' },\n { ...inputMask, property: 'background-color' },\n ],\n\n errorMessageTextColor: { ...errorMessage, property: 'color' },\n errorMessageIcon: { ...errorMessage, property: 'background-image' },\n errorMessageIconSize: { ...errorMessage, property: 'background-size' },\n errorMessageIconPadding: { ...errorMessage, property: 'padding-inline-start' },\n errorMessageIconRepeat: { ...errorMessage, property: 'background-repeat' },\n errorMessageIconPosition: { ...errorMessage, property: 'background-position' },\n errorMessageFontSize: { ...errorMessage, property: 'font-size' },\n\n helperTextColor: { ...helperText, property: '-webkit-text-fill-color' },\n\n inputValueTextColor: [\n { ...inputField, property: 'color' },\n { ...inputDisabled, property: '-webkit-text-fill-color' },\n { ...externalInputDisabled, property: '-webkit-text-fill-color' },\n ],\n inputCaretTextColor: [\n { ...input, property: 'caret-color' },\n { ...externalInput, property: 'caret-color' },\n ],\n\n labelRequiredIndicator: { ...requiredIndicator, property: 'content' },\n\n inputBorderColor: { ...inputField, property: 'border-color' },\n inputBorderWidth: { ...inputField, property: 'border-width' },\n inputBorderStyle: { ...inputField, property: 'border-style' },\n inputBorderRadius: { ...inputField, property: 'border-radius' },\n\n inputHeight: { ...inputField, property: 'height' },\n inputHorizontalPadding: [\n { ...input, property: 'padding-left' },\n { ...input, property: 'padding-right' },\n { ...externalInput, property: 'padding-left' },\n { ...externalInput, property: 'padding-right' },\n ],\n\n inputOutlineColor: { ...inputField, property: 'outline-color' },\n inputOutlineStyle: { ...inputField, property: 'outline-style' },\n inputOutlineWidth: { ...inputField, property: 'outline-width' },\n inputOutlineOffset: { ...inputField, property: 'outline-offset' },\n\n textAlign: {},\n\n inputTextAlign: [\n { ...input, property: 'text-align' },\n { ...externalInput, property: 'text-align' },\n ],\n\n inputPlaceholderColor: [\n { selector: () => ':host input:placeholder-shown', property: 'color' },\n { ...externalPlaceholder, property: 'color' },\n { ...placeholder, property: 'color' },\n { ...disabledPlaceholder, property: '-webkit-text-fill-color' },\n { ...externalDisabledPlaceholder, property: '-webkit-text-fill-color' },\n ],\n\n labelPosition: { ...label, property: 'position' },\n labelTopPosition: { ...label, property: 'top' },\n labelHorizontalPosition: [\n { ...label, property: 'left' },\n { ...label, property: 'right' },\n ],\n inputTransformY: { ...label, property: 'transform' },\n inputTransition: { ...label, property: 'transition' },\n marginInlineStart: { ...label, property: 'margin-inline-start' },\n placeholderOpacity: [\n { selector: '> input:placeholder-shown', property: 'opacity' },\n { ...externalPlaceholder, property: 'opacity' },\n ],\n inputVerticalAlignment: [\n { ...inputField, property: 'align-items' },\n { ...externalInput, property: 'align-items' },\n ],\n valueInputHeight: [\n { ...input, property: 'height' },\n { ...externalInput, property: 'height' },\n ],\n valueInputMarginBottom: [\n { ...input, property: 'margin-bottom' },\n { ...externalInput, property: 'margin-bottom' },\n ],\n\n inputIconOffset: [\n { ...inputIcon, property: 'margin-right' },\n { ...inputIcon, property: 'margin-left' },\n ],\n inputIconSize: { ...inputIcon, property: 'font-size' },\n inputIconColor: { ...inputIcon, property: 'color' },\n};\n","import '@vaadin/text-field';\nimport '@vaadin/icons';\nimport '@vaadin/icon';\n\nimport { componentName, TextFieldClass } from './TextFieldClass';\n\ncustomElements.define(componentName, TextFieldClass);\n\nexport { TextFieldClass, componentName };\n","import {\n createStyleMixin,\n draggableMixin,\n createProxy,\n proxyInputMixin,\n componentNameValidationMixin,\n} from '../../mixins';\nimport textFieldMappings from './textFieldMappings';\nimport { compose } from '../../helpers';\nimport { getComponentName } from '../../helpers/componentHelpers';\nimport {\n inputFloatingLabelStyle,\n resetInputLabelPosition,\n resetInputOverrides,\n useHostExternalPadding,\n} from '../../helpers/themeHelpers/resetHelpers';\n\nexport const componentName = getComponentName('text-field');\n\nconst observedAttrs = ['type', 'label-type', 'copy-to-clipboard'];\n\nconst customMixin = (superclass) =>\n class TextFieldClass extends superclass {\n static get observedAttributes() {\n return observedAttrs.concat(superclass.observedAttributes || []);\n }\n\n icon;\n\n init() {\n super.init?.();\n }\n\n renderCopyToClipboard(shouldRender) {\n if (!shouldRender) {\n this.icon?.remove();\n return;\n }\n\n const iconInitConfig = {\n icon: 'vaadin:copy-o',\n title: 'Copy',\n style: 'cursor: pointer',\n };\n\n const iconCopiedConfig = {\n icon: 'vaadin:check-circle-o',\n title: 'Copied',\n style: 'cursor: initial',\n };\n\n this.icon = Object.assign(document.createElement('vaadin-icon'), {\n slot: 'suffix',\n ...iconInitConfig,\n });\n\n this.baseElement.appendChild(this.icon);\n this.icon.addEventListener('click', () => {\n navigator.clipboard.writeText(this.value);\n Object.assign(this.icon, iconCopiedConfig);\n\n // we want the icon to go back to the initial state after 5 seconds\n setTimeout(() => {\n Object.assign(this.icon, iconInitConfig);\n }, 5000);\n });\n }\n\n onLabelClick() {\n this.focus();\n }\n\n attributeChangedCallback(attrName, oldVal, newVal) {\n super.attributeChangeCallback?.(attrName, oldVal, newVal);\n\n // Vaadin doesn't allow to change the input type attribute.\n // We need the ability to do that, so we're overriding their\n // behavior with their private API.\n // When receiving a `type` attribute, we use their private API\n // to set it on the input.\n if (attrName === 'type') {\n this.baseElement._setType(newVal);\n }\n\n if (oldVal !== newVal) {\n if (attrName === 'label-type') {\n if (newVal === 'floating') {\n this.addEventListener('click', this.onLabelClick);\n } else {\n this.removeEventListener('click', this.onLabelClick);\n }\n } else if (attrName === 'copy-to-clipboard') {\n this.renderCopyToClipboard(newVal === 'true');\n }\n }\n }\n };\n\nexport const TextFieldClass = compose(\n createStyleMixin({\n mappings: textFieldMappings,\n }),\n draggableMixin,\n proxyInputMixin({ proxyProps: ['value', 'selectionStart'], useProxyTargets: true }),\n componentNameValidationMixin,\n customMixin\n)(\n createProxy({\n slots: ['prefix', 'suffix'],\n wrappedEleName: 'vaadin-text-field',\n style: () => `\n\t\t\t:host {\n\t\t\t\tdisplay: inline-block;\n\t\t\t\tmax-width: 100%;\n\t\t\t\tpadding: calc(var(${TextFieldClass.cssVarList.inputOutlineWidth}) + var(${\n TextFieldClass.cssVarList.inputOutlineOffset\n }));\n box-sizing: border-box;\n\t\t\t}\n :host(:is([readonly], [disabled])) ::slotted(:is(input, textarea):placeholder-shown) {\n opacity: 1;\n }\n\n vaadin-text-field[label-type=\"floating\"]:not([focused])[readonly] > input:placeholder-shown {\n opacity: 0;\n }\n vaadin-text-field[label-type=\"floating\"]:not([focused])[disabled] > input:placeholder-shown {\n opacity: 0;\n }\n ${resetInputLabelPosition('vaadin-text-field')}\n\t\t\t${useHostExternalPadding(TextFieldClass.cssVarList)}\n\t\t\t${resetInputOverrides('vaadin-text-field', TextFieldClass.cssVarList)}\n ${inputFloatingLabelStyle()}\n\n vaadin-text-field vaadin-icon {\n align-self: center;\n }\n\t\t`,\n excludeAttrsSync: ['tabindex', 'style'],\n componentName,\n })\n);\n","// DateCounterClass allows us to add several counters to the input, and use them seperately.\n// For examele, we have a DayCounter, MonthCounter and YearCounter, which can each separately navigate\n// between different ranges.\nexport class DateCounter {\n #data = Object.freeze([]);\n\n constructor({ id, min, max, placeholder }, onChange) {\n this.id = id;\n this.min = min;\n this.max = max;\n this.placeholder = placeholder;\n this.onChange = onChange;\n }\n\n get data() {\n return this.#data;\n }\n\n set data(val) {\n this.#data = Object.freeze(val);\n this.onChange?.();\n }\n\n get #initialNumValue() {\n return this.data.length ? this.numberValue : 0;\n }\n\n get numberValue() {\n return Number(this.stringValue);\n }\n\n get stringValue() {\n return (this.data.join('') || this.placeholder).padStart(this.length, '0');\n }\n\n get isFull() {\n return this.numberValue * 10 > this.max || this.data.length === this.length;\n }\n\n get isEmpty() {\n return this.stringValue === this.placeholder;\n }\n\n get length() {\n return this.max.toString().length;\n }\n\n set(val) {\n this.data = val.toString().split('');\n }\n\n add(num) {\n // use local var to avoid triggering onChange\n let data = this.data;\n\n data = [...data, num];\n\n // we need to re-evaluate the number value\n const numVal = Number(data.join(''));\n\n if (numVal > this.max) {\n data = [num];\n } else if (this.length < data.length) {\n data = data.slice(1, data.length);\n }\n\n this.data = data;\n\n return num;\n }\n\n del() {\n if (!this.data.filter((d) => d !== '0').filter(Boolean).length) {\n this.data = [];\n } else {\n this.data = this.data.slice(0, this.data.length - 1);\n }\n }\n\n clear() {\n this.data = [];\n }\n\n inc(gap) {\n this.replaceValue(\n this.#initialNumValue < this.max\n ? Math.max(this.#initialNumValue + (gap || 1), this.min)\n : this.min\n );\n }\n\n dec(gap) {\n this.replaceValue(\n this.#initialNumValue > this.min\n ? Math.min(this.#initialNumValue - (gap || 1), this.max)\n : this.max\n );\n }\n\n isInRange(val) {\n return val >= this.min && val <= this.max;\n }\n\n replaceValue(val) {\n if (this.isInRange(val)) {\n this.data = val.toString().padStart(this.length, 0).split('');\n }\n }\n\n setMin(val) {\n this.min = Number(val);\n }\n\n setMax(val) {\n this.max = Number(val);\n }\n}\n","import { createBaseInputClass } from '../../baseClasses/createBaseInputClass';\nimport {\n createStyleMixin,\n draggableMixin,\n componentNameValidationMixin,\n portalMixin,\n} from '../../mixins';\nimport { forwardAttrs, getComponentName } from '../../helpers/componentHelpers';\nimport { compose } from '../../helpers';\nimport {\n newDate,\n isValidTimestamp,\n formatTimestamp,\n isNumber,\n getCurrentTime,\n overrideConstructedStylesheet,\n} from './helpers';\nimport { formats } from './formats';\nimport { calendarIcon } from './icons';\nimport {\n counterConfig,\n DEFAULT_FORMAT,\n DIVIDER,\n MOBILE_DEVICE_INTERACTION_TIMEOUT_MS,\n NATIVE_FORMAT,\n valRange,\n} from './consts';\nimport { DateCounter } from './DateCounterClass';\nimport { TextFieldClass } from '../descope-text-field/TextFieldClass';\nimport { injectStyle } from '@descope-ui/common/components-helpers';\nimport { parseDateString } from './helpers';\n\nexport const componentName = getComponentName('date-field');\n\n// we set baseSelector to `vaadin-popover` as a temporary hack, so our portalMixin will\n// be able to process this component's overlay. The whole process needs refactoring as soon as possible.\nconst BASE_SELECTOR = 'vaadin-popover';\nconst BaseInputClass = createBaseInputClass({ componentName, baseSelector: BASE_SELECTOR });\n\nconst dateFieldAttrs = ['format', 'opened', 'initial-value', 'readonly', 'disable-calendar'];\nconst calendarAttrs = ['years-range', 'calendar-months', 'calendar-weekdays'];\nconst observedAttrs = [...dateFieldAttrs, ...calendarAttrs];\n\nclass RawDateFieldClass extends BaseInputClass {\n timestamp = '';\n\n format = DEFAULT_FORMAT;\n\n selectedCounterIdx = 0;\n\n updateCountersDisplay() {\n this.inputElement.value = this.countersValue;\n }\n\n updateValue() {\n if (this.isCountersOutOfRange) {\n this.updateTimestamp('');\n } else {\n const date = formats[this.format].getDate(this.inputElement.value);\n this.updateTimestamp(date.getTime());\n }\n }\n\n onDateCounterChange = () => {\n this.updateCountersDisplay();\n this.updateValue();\n // update validity\n this.#dispatchInput();\n };\n\n updateTimestamp(epochOrDate) {\n if (!epochOrDate) {\n this.timestamp = '';\n } else {\n this.timestamp = newDate(epochOrDate).getTime();\n }\n }\n\n dateCounters = [\n new DateCounter(counterConfig.MONTH, this.onDateCounterChange.bind(this)),\n new DateCounter(counterConfig.DAY, this.onDateCounterChange.bind(this)),\n new DateCounter(counterConfig.YEAR, this.onDateCounterChange.bind(this)),\n ];\n\n static get observedAttributes() {\n return [].concat(BaseInputClass.observedAttributes || [], observedAttrs);\n }\n\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n <div>\n <descope-text-field inputmode=\"numeric\">\n <span slot=\"suffix\" class=\"toggle-calendar\">\n ${calendarIcon}\n </span>\n </descope-text-field>\n <vaadin-popover></vaadin-popover>\n </div>\n `;\n\n injectStyle(\n `\n :host {\n display: inline-block;\n box-sizing: border-box;\n user-select: none;\n max-width: 100%;\n }\n\n :host ::slotted {\n padding: 0;\n }\n\n .toggle-calendar {\n cursor: pointer;\n display: flex;\n align-self: center;\n z-index: 1;\n height: 100%;\n align-items: center;\n }\n\n :host([readonly=\"true\"]) .toggle-calendar {\n pointer-events: none;\n }\n\n .hidden {\n display: none;\n }\n `,\n this\n );\n\n this.inputElement = this.shadowRoot.querySelector('descope-text-field');\n this.popoverToggleButton = this.inputElement.querySelector('.toggle-calendar');\n }\n\n get validationTarget() {\n return this.inputElement;\n }\n\n get opened() {\n return this.getAttribute('opened') === 'true';\n }\n\n // returns the input's value as a timestamp\n get displayValueEpoch() {\n const date = formats[this.format].getDate(this.inputElement.value);\n\n if (!isValidTimestamp(date?.getTime())) {\n return null;\n }\n\n return date.getTime();\n }\n\n get sortedCounters() {\n return this.format\n .split(DIVIDER)\n .map((placeholder) => this.dateCounters.find((dc) => dc.placeholder === placeholder));\n }\n\n get activeCounter() {\n return this.sortedCounters[this.selectedCounterIdx];\n }\n\n get countersValue() {\n return this.sortedCounters.map((dc) => dc.stringValue).join(DIVIDER);\n }\n\n get overlay() {\n return this.baseElement.shadowRoot?.querySelector('vaadin-popover-overlay');\n }\n\n get backdrop() {\n return this.overlay.shadowRoot?.querySelector('#backdrop');\n }\n\n get calendar() {\n return this.overlay?.querySelector('descope-calendar');\n }\n\n get isRTL() {\n const computedStyleDirection = getComputedStyle(this.baseElement).getPropertyValue('direction');\n\n if (computedStyleDirection) {\n return computedStyleDirection === 'rtl';\n }\n\n // Fallback: If for some reason computed style was not calculated in time, fallback to check on attribute\n return this.getAttribute('st-host-direction') === 'rtl';\n }\n\n get value() {\n if (this.isInvalidDate()) {\n return '';\n }\n return this.timestamp;\n }\n\n set value(val) {\n if (val) {\n this.updateTimestamp(val);\n this.updateDateCounters(newDate(val));\n } else {\n this.updateTimestamp('');\n }\n }\n\n get isCountersEmpty() {\n return this.dateCounters.every((dc) => dc.isEmpty);\n }\n\n get isCountersOutOfRange() {\n return this.dateCounters.some((dc) => !dc.isInRange(dc.numberValue));\n }\n\n get disableCalendar() {\n return this.getAttribute('disable-calendar') === 'true';\n }\n\n get isSelectAll() {\n const inputEle = this.inputElement.baseElement.inputElement;\n return inputEle.value.length === inputEle.selectionStart + inputEle.selectionEnd;\n }\n\n reportValidity() {\n this.inputElement.reportValidity();\n }\n\n #dispatchInput() {\n this.inputElement.baseElement.dispatchEvent(new Event('input', { bubbles: true }));\n }\n\n updateInputDisplay() {\n this.inputElement.value = formatTimestamp(newDate(this.countersValue).getTime(), this.format);\n }\n\n init() {\n super.init?.();\n\n this.updateFormatPattern();\n this.initPopover();\n this.onDateCounterChange();\n this.initInputElement();\n\n setTimeout(() => {\n this.#overrideOverlaySettings();\n }, 0);\n }\n\n initInputElement() {\n this.inputElement.getValidity = this.getValidity.bind(this);\n this.inputElement.baseElement.checkValidity = this.checkValidity.bind(this);\n\n this.popoverToggleButton.addEventListener('click', this.onPopoverToggle.bind(this));\n\n this.inputElement.addEventListener('focus', this.onFocus.bind(this));\n this.inputElement.addEventListener('blur', this.onBlur.bind(this));\n this.inputElement.addEventListener('click', this.handleMouseCaretPositionChange.bind(this));\n this.inputElement.addEventListener('keydown', this.handleKeyboard.bind(this));\n this.inputElement.addEventListener('beforeinput', this.handleInput.bind(this));\n this.inputElement.addEventListener('pointerdown', this.onPointerDown.bind(this));\n this.inputElement.addEventListener('paste', this.onPaste.bind(this));\n\n forwardAttrs(this, this.inputElement, {\n includeAttrs: [\n 'label',\n 'label-type',\n 'placeholder',\n 'disabled',\n 'readonly',\n 'bordered',\n 'required',\n 'full-width',\n 'st-host-direction',\n 'pattern',\n 'bordered',\n 'data-errormessage-value-missing',\n 'data-errormessage-pattern-mismatch',\n 'data-errormessage-range-underflow',\n 'data-errormessage-range-overflow',\n 'st-error-message-icon',\n 'st-error-message-icon-size',\n 'st-error-message-icon-padding',\n ],\n });\n }\n\n handleInput(e) {\n e.preventDefault();\n\n this.handleSelectAll();\n\n if (e.data && isNumber(e.data)) {\n this.parseDigits(e.data);\n this.updateCountersDisplay();\n } else if (e.inputType) {\n this.handleNavKeys(e);\n }\n }\n\n initPopover() {\n this.baseElement.trigger = ['click'];\n this.baseElement.withBackdrop = true;\n this.baseElement.renderer = this.#popoverRenderer.bind(this);\n\n // block popover events from focusing/blurring the text-field\n this.baseElement.addEventListener('click', (e) => {\n e.preventDefault();\n e.stopPropagation();\n });\n }\n\n handleSelectAll() {\n if (this.isSelectAll) {\n this.selectFirstCounter();\n }\n }\n\n #popoverPosStylesheet;\n\n #popoverRenderer(root) {\n // popoverRenderer should run only once, when the popover is first rendering.\n if (!root.firstChild) {\n this.overlay.positionTarget = this.shadowRoot.querySelector('.toggle-calendar');\n\n root.appendChild(this.#getPopoverContent());\n\n // override vaadin's constructed stylesheet which hides the host element\n overrideConstructedStylesheet(this.baseElement);\n\n this.backdrop.addEventListener('click', this.closePopover.bind(this));\n }\n\n // Hide overlay before adjusting position to prevent flickering\n root.style.setProperty('visibility', 'hidden');\n\n // Wait until overlay is ready\n setTimeout(() => {\n this.#adjustPopoverPosition(root);\n\n // Show adjusted overlay\n root.style.setProperty('visibility', 'visible');\n this.updateCalendarView(root);\n }, 100);\n }\n\n #adjustPopoverPosition() {\n const popover = this.shadowRoot.querySelector('vaadin-popover').shadowRoot;\n\n // Remove previously added stylesheets\n this.#popoverPosStylesheet?.remove();\n\n const windowRect = document.body.getBoundingClientRect();\n const inputRect = this.getBoundingClientRect();\n const calendarRect = this.calendar.getBoundingClientRect();\n\n const side = this.isRTL ? 'right' : 'left';\n const offset = inputRect[side] - calendarRect[side];\n const availableLeft = calendarRect.left;\n const availableRight = windowRect.width - calendarRect.right;\n\n let newOffset;\n if (offset > 0) {\n newOffset = Math.min(offset, availableRight);\n } else {\n newOffset = Math.min(Math.abs(offset), availableLeft) * -1;\n }\n\n injectStyle(\n `\n vaadin-popover-overlay::part(overlay) {\n transform: translateX(${newOffset}px);\n }\n `,\n popover\n );\n }\n\n #getPopoverContent() {\n const ele = document.createElement('span');\n\n ele.innerHTML = `<descope-calendar></descope-calendar>`;\n\n const calendar = ele.querySelector('descope-calendar');\n\n calendar.addEventListener('date-submit', this.onCalendarSubmit.bind(this));\n calendar.addEventListener('cancel', this.closePopover.bind(this));\n\n return ele;\n }\n\n // the default vaadin behavior is to attach the overlay to the body when opened\n // we do not want that because it's difficult to style the overlay in this way\n // so we override it to open inside the shadow DOM\n #overrideOverlaySettings() {\n this.overlay._attachOverlay = () => this.overlay.bringToFront();\n this.overlay._detachOverlay = () => {};\n this.overlay._enterModalState = () => {};\n }\n\n onPopoverToggle() {\n this.opened ? this.closePopover() : this.openPopover();\n }\n\n openPopover() {\n if (this.disableCalendar) return;\n this.setAttribute('opened', 'true');\n }\n\n closePopover() {\n this.removeAttribute('opened');\n this.inputElement.focus();\n }\n\n getCounterById(id) {\n return this.dateCounters.find((dc) => dc.id === id);\n }\n\n onCalendarSubmit() {\n if (!this.isReadOnly) {\n if (!this.calendar.value) return;\n\n const calendarDate = newDate(this.calendar.value);\n\n this.value = calendarDate.getTime();\n\n this.getCounterById('year').replaceValue(calendarDate.getFullYear());\n this.getCounterById('month').replaceValue(calendarDate.getMonth() + 1);\n this.getCounterById('day').replaceValue(calendarDate.getDate());\n\n this.#dispatchInput();\n }\n\n this.closePopover();\n }\n\n updateCalendarView() {\n const validInputVal =\n isValidTimestamp(newDate(this.inputElement.value || '').getTime()) &&\n formats[this.format].validate(this.inputElement.value);\n\n if (this.displayValueEpoch || validInputVal) {\n this.calendar.setAttribute(\n 'initial-value',\n formatTimestamp(this.displayValueEpoch || this.timestamp, NATIVE_FORMAT)\n );\n } else {\n this.calendar.clearValue();\n this.calendar.setAttribute('preview', formatTimestamp(getCurrentTime(), NATIVE_FORMAT));\n }\n\n forwardAttrs(this, this.calendar, {\n includeAttrs: [\n 'st-host-direction',\n 'readonly',\n 'initial-month',\n 'initial-year',\n 'years-range',\n 'calendar-label-submit',\n 'calendar-label-cancel',\n 'calendar-months',\n 'calendar-weekdays',\n 'calendar-weekdays-short',\n ],\n });\n }\n\n // In mobile devices, there are cases were `pointerdown` is triggered\n // instead of `click`.\n onPointerDown(e) {\n setTimeout(() => this.handleMouseCaretPositionChange(e), MOBILE_DEVICE_INTERACTION_TIMEOUT_MS);\n }\n\n onFocus() {\n if (this.isReadOnly) {\n return;\n }\n\n // We need to wait for focus to end before we set selection\n setTimeout(() => this.resetDisplay());\n }\n\n resetDisplay() {\n if (!this.inputElement.value) {\n this.inputElement.value = this.format;\n }\n\n // On focus select the first counter\n this.selectFirstCounter();\n // set selection on first counter\n this.inputElement.setSelectionRange(0, this.sortedCounters[0].length);\n }\n\n onBlur() {\n if (this.opened) {\n return;\n }\n\n if (this.inputElement.value === this.format) {\n this.inputElement.value = '';\n }\n }\n\n onFormatUpdate(format) {\n if (Object.keys(formats).includes(format)) {\n this.format = format;\n this.updateFormatPattern();\n }\n }\n\n updateFormatPattern() {\n const format = this.getAttribute('format') || this.format || DEFAULT_FORMAT;\n this.setAttribute('type', 'date');\n this.setAttribute('pattern', formats[format].pattern);\n }\n\n parseDigits(value) {\n this.activeCounter.add(value);\n\n if (this.activeCounter.isFull) {\n this.selectNextCounter();\n }\n\n // We wait for the digit to be parsed, and only then set the selection.\n // Failing to do so results in unexpected \"jump\" of the screen in mobile devices.\n this.setInputSelectionRange();\n }\n\n getCounterIdx(caretPos) {\n const [counter1ln, counter2ln] = this.sortedCounters.map((dc) => dc.length);\n\n const c1 = caretPos <= counter1ln;\n const c2 = caretPos >= counter1ln && caretPos <= counter1ln + counter2ln + 1;\n const c3 = caretPos >= counter1ln + counter2ln + 2;\n\n return [c1, c2, c3].indexOf(true);\n }\n\n setSelectedCounterByCaretPosition(e) {\n this.selectedCounterIdx = this.getCounterIdx(\n // if triggered by touch event, target might not include `selectionStart`\n // in that case we fall back to the inputElement's `selectionStart` value.\n // Therefore, it is recommended to run this function with setTimeout,\n // at least for mobile events.\n e.target?.selectionStart || this.inputElement.selectionStart\n );\n }\n\n selectFirstCounter() {\n this.selectedCounterIdx = 0;\n }\n\n selectNextCounter() {\n if (this.selectedCounterIdx < this.dateCounters.length) {\n this.selectedCounterIdx = Math.min(this.selectedCounterIdx + 1, 2);\n }\n }\n\n selectPrevCounter() {\n if (this.selectedCounterIdx > 0) {\n this.selectedCounterIdx = Math.min(this.selectedCounterIdx - 1, 1);\n }\n }\n\n // Sets the text selection range in the input element based on the selected counter.\n // The function calculates the starting position of the selection by summing the lengths\n // of all counters before the currently selected counter (`selectedCounterIdx`).\n // It then selects the entire length of the current counter in the input element.\n setInputSelectionRange() {\n // For preview/readonly state we don't have a caret or a caretIdx, so we skip setting input selection range\n if (this.selectedCounterIdx < 0) {\n return;\n }\n\n // We wait for before setting the selection, otherwise there's an\n // unexpected \"jump\" of the screen in mobile devices.\n setTimeout(() => {\n const caretStart = this.sortedCounters\n .slice(0, this.selectedCounterIdx)\n .reduce((acc, counter) => acc + counter.length, this.selectedCounterIdx);\n\n this.inputElement.setSelectionRange(\n caretStart,\n caretStart + this.sortedCounters[this.selectedCounterIdx].length\n );\n });\n }\n\n resetDateCounters() {\n this.dateCounters.forEach((dc) => dc.clear());\n }\n\n // in case value is set from external source we need to update date counters\n updateDateCounters(date) {\n this.dateCounters.forEach((dc) => {\n switch (dc.id) {\n case counterConfig.MONTH.id:\n dc.set(date.getMonth() + 1);\n break;\n case counterConfig.YEAR.id:\n dc.set(date.getFullYear());\n break;\n case counterConfig.DAY.id:\n dc.set(date.getDate());\n break;\n default:\n break;\n }\n });\n }\n\n handleKeyboard(e) {\n if (e.metaKey || e.ctrlKey) {\n if (e.key.toLowerCase() === 'x') {\n this.onCut(e);\n }\n\n return;\n }\n\n this.handleSelectAll();\n\n if (e.key === 'ArrowUp') {\n this.activeCounter.inc();\n } else if (e.key === 'ArrowDown') {\n this.activeCounter.dec();\n } else if (e.key === 'ArrowRight') {\n this.selectNextCounter();\n } else if (e.key === 'ArrowLeft') {\n this.selectPrevCounter();\n }\n\n this.setInputSelectionRange();\n }\n\n handleNavKeys(e) {\n if (this.isReadOnly) {\n return;\n }\n\n if (this.opened) {\n this.closePopover();\n }\n\n if (!this.activeCounter) return;\n\n if (e.inputType === 'deleteContentBackward') {\n this.handleBackspace();\n }\n\n this.setInputSelectionRange();\n }\n\n handleBackspace() {\n if (this.isSelectAll) {\n this.resetToInitialState();\n return;\n }\n\n const counter = this.activeCounter;\n\n if (counter.isEmpty) {\n this.selectPrevCounter();\n this.setInputSelectionRange();\n } else {\n counter.set('');\n }\n\n // To support keyboards like SwiftKey, we need to re-render the counters display and selection,\n // otherwise we get an unexpected behavior, where the format is deleted.\n setTimeout(() => {\n this.updateCountersDisplay();\n this.setInputSelectionRange();\n });\n }\n\n handleMouseCaretPositionChange(e) {\n if (this.opened) {\n return;\n }\n\n e.preventDefault();\n\n this.setSelectedCounterByCaretPosition(e);\n this.setInputSelectionRange();\n }\n\n onInitialValueChange(val) {\n // if component already has a value don't re-set value\n if (this.value) return;\n\n // we need to wait for the text-field to init\n setTimeout(() => {\n this.value = val;\n });\n }\n\n togglePopoverAccess(visibility) {\n if (visibility) {\n this.popoverToggleButton.classList.remove('hidden');\n } else {\n this.popoverToggleButton.classList.add('hidden');\n }\n }\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n super.attributeChangedCallback?.(attrName, oldValue, newValue);\n\n if (oldValue !== newValue) {\n if (attrName === 'disable-calendar') {\n this.togglePopoverAccess(newValue !== 'true');\n }\n if (dateFieldAttrs.includes(attrName)) {\n if (newValue && attrName === 'format') {\n this.onFormatUpdate(newValue);\n }\n if (attrName === 'initial-value') {\n this.onInitialValueChange(newValue);\n }\n } else if (calendarAttrs.includes(attrName)) {\n if (newValue) {\n this.calendar?.setAttribute(attrName, newValue);\n } else {\n this.calendar?.removeAttribute(attrName);\n }\n }\n }\n }\n\n // we want to validate the date supplied actually exists. For example: Feb 31 is not an actual date,\n // but in JS when create a `new Date('1999-02-31') we get March 2nd 1999.\n // To prevent this error from being submitted, we evaluate the\n // date parts against their generated Date value.\n isInvalidDate() {\n const yearCounter = this.getCounterById('year');\n const isYearOutOfRange =\n yearCounter.numberValue > valRange['year'].max ||\n yearCounter.numberValue < valRange['year'].min;\n\n const isDateDisplayMismatch = Object.entries(this.getDateVals()).some(([key, val]) => {\n const counter = this.getCounterById(key);\n return !val || counter.numberValue !== val;\n });\n\n return isYearOutOfRange || isDateDisplayMismatch;\n }\n\n getValidity() {\n if (this.isRequired && this.isCountersEmpty) {\n return { valueMissing: true };\n }\n\n if (this.isCountersOutOfRange || this.isInvalidDate()) {\n return { patternMismatch: true };\n }\n\n return {};\n }\n\n getDateVals() {\n const ret = {\n day: '',\n month: '',\n year: '',\n };\n\n try {\n const date = newDate(this.timestamp);\n\n ret.month = date.getMonth() + 1;\n ret.day = date.getDate();\n ret.year = date.getFullYear();\n } catch (e) {}\n\n return ret;\n }\n\n resetToInitialState() {\n this.resetDateCounters();\n this.selectFirstCounter();\n this.resetDisplay();\n }\n\n onCut(e) {\n e.preventDefault();\n\n if (this.isSelectAll) {\n this.#copyToClipboard(this.countersValue);\n this.resetToInitialState();\n } else {\n this.#copyToClipboard(this.activeCounter.stringValue);\n this.activeCounter.set('');\n }\n\n this.setInputSelectionRange();\n }\n\n #copyToClipboard(value) {\n try {\n navigator.clipboard.writeText(value);\n } catch (err) {\n console.error('Failed to copy date value:', err);\n }\n }\n\n onPaste(e) {\n e.preventDefault();\n\n const clipboardData = e.clipboardData || window.clipboardData;\n const pastedData = clipboardData.getData('Text');\n\n // try paste entire date if valid\n const validDate = parseDateString(pastedData, this.format);\n\n if (validDate) {\n this.value = validDate.getTime();\n this.onDateCounterChange();\n\n // select all\n setTimeout(() => this.inputElement.setSelectionRange(0, this.inputElement.value.length));\n } else {\n const value = Number(pastedData);\n\n // try paste in counter if possible\n if (value && this.activeCounter.min <= value && this.activeCounter.max >= value) {\n // use String to get rid of any zero padding\n this.activeCounter.set(String(value));\n\n setTimeout(() => this.setInputSelectionRange());\n }\n }\n }\n}\n\nconst textVars = TextFieldClass.cssVarList;\nconst { host, input, inputEleRTL, toggleButton, overlay, backdrop, errorMessage } = {\n host: { selector: () => ':host' },\n input: { selector: () => 'descope-text-field' },\n inputEleRTL: { selector: () => ':host([st-host-direction=\"rtl\"]) descope-text-field' },\n toggleButton: { selector: () => '.toggle-calendar' },\n overlay: { selector: 'vaadin-popover-overlay::part(overlay)' },\n backdrop: { selector: 'vaadin-popover-overlay::part(backdrop)' },\n};\n\nexport const DateFieldClass = compose(\n createStyleMixin({ componentNameOverride: getComponentName('input-wrapper') }),\n createStyleMixin({\n mappings: {\n iconMargin: { ...toggleButton, property: 'margin-inline-end' },\n hostWidth: { ...host, property: 'width' },\n hostDirection: { ...host, property: 'direction' },\n textAlign: { ...input, property: 'text-align' },\n rtlInputDirection: { ...inputEleRTL, property: textVars.inputDirection },\n rtlInputAlignment: { ...inputEleRTL, property: textVars.inputTextAlign },\n overlayGap: {\n property: () => DateFieldClass.cssVarList.overlayGap,\n },\n overlayBackgroundColor: {\n property: () => DateFieldClass.cssVarList.overlayBackgroundColor,\n },\n overlayPadding: {\n property: () => DateFieldClass.cssVarList.overlayPadding,\n },\n overlayBoxShadow: { property: () => DateFieldClass.overlayBoxShadow },\n overlayOutlineWidth: {\n property: () => DateFieldClass.cssVarList.overlayOutlineWidth,\n },\n overlayOutlineColor: {\n property: () => DateFieldClass.cssVarList.overlayOutlineColor,\n },\n overlayOutlineStyle: {\n property: () => DateFieldClass.cssVarList.overlayOutlineStyle,\n },\n errorMessageIcon: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageIcon,\n },\n errorMessageIconSize: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageIconSize,\n },\n errorMessageIconPadding: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageIconPadding,\n },\n errorMessageIconRepeat: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageIconRepeat,\n },\n errorMessageIconPosition: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageIconPosition,\n },\n errorMessageFontSize: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageFontSize,\n },\n },\n }),\n portalMixin({\n name: 'overlay',\n selector: '',\n mappings: {\n marginTop: { ...overlay, property: 'margin-top' },\n backgroundColor: { ...overlay },\n backdropBackgroundColor: { ...backdrop, property: 'background-color' },\n backdropPointerEvents: { ...backdrop, property: 'pointer-events' },\n padding: { ...overlay },\n boxShadow: { ...overlay },\n outlineWidth: { ...overlay },\n outlineColor: { ...overlay },\n outlineStyle: { ...overlay },\n },\n }),\n draggableMixin,\n componentNameValidationMixin\n)(RawDateFieldClass);\n","import '@vaadin/popover/src/vaadin-popover';\nimport './descope-calendar';\nimport '../descope-text-field';\n\nimport { componentName, DateFieldClass } from './DateFieldClass';\n\ncustomElements.define(componentName, DateFieldClass);\n\nexport { DateFieldClass, componentName };\n"],"names":["host","label","placeholder","requiredIndicator","inputField","input","inputMask","helperText","errorMessage","disabledPlaceholder","inputDisabled","inputIcon","externalInput","externalInputDisabled","externalPlaceholder","externalDisabledPlaceholder","selector","fontSize","fontFamily","labelFontSize","property","labelFontWeight","labelTextColor","hostWidth","hostMinWidth","hostDirection","inputDirection","inputBackgroundColor","errorMessageTextColor","errorMessageIcon","errorMessageIconSize","errorMessageIconPadding","errorMessageIconRepeat","errorMessageIconPosition","errorMessageFontSize","helperTextColor","inputValueTextColor","inputCaretTextColor","labelRequiredIndicator","inputBorderColor","inputBorderWidth","inputBorderStyle","inputBorderRadius","inputHeight","inputHorizontalPadding","inputOutlineColor","inputOutlineStyle","inputOutlineWidth","inputOutlineOffset","textAlign","inputTextAlign","inputPlaceholderColor","labelPosition","labelTopPosition","labelHorizontalPosition","inputTransformY","inputTransition","marginInlineStart","placeholderOpacity","inputVerticalAlignment","valueInputHeight","valueInputMarginBottom","inputIconOffset","inputIconSize","inputIconColor","customElements","define","componentName","observedAttrs","TextFieldClass","mappings","proxyProps","useProxyTargets","superclass","observedAttributes","concat","icon","init","super","renderCopyToClipboard","shouldRender","this","remove","iconInitConfig","title","style","iconCopiedConfig","Object","assign","document","createElement","slot","baseElement","appendChild","addEventListener","navigator","clipboard","writeText","value","setTimeout","onLabelClick","focus","attributeChangedCallback","attrName","oldVal","newVal","attributeChangeCallback","_setType","removeEventListener","slots","wrappedEleName","cssVarList","excludeAttrsSync","DateCounter","freeze","constructor","id","min","max","onChange","data","val","length","numberValue","Number","stringValue","join","padStart","isFull","isEmpty","toString","set","split","add","num","slice","del","filter","d","Boolean","clear","inc","gap","replaceValue","Math","dec","isInRange","setMin","setMax","BaseInputClass","createBaseInputClass","baseSelector","dateFieldAttrs","calendarAttrs","textVars","inputEleRTL","toggleButton","overlay","backdrop","DateFieldClass","componentNameOverride","iconMargin","rtlInputDirection","rtlInputAlignment","overlayGap","overlayBackgroundColor","overlayPadding","overlayBoxShadow","overlayOutlineWidth","overlayOutlineColor","overlayOutlineStyle","name","marginTop","backgroundColor","backdropBackgroundColor","backdropPointerEvents","padding","boxShadow","outlineWidth","outlineColor","outlineStyle","timestamp","format","selectedCounterIdx","updateCountersDisplay","inputElement","countersValue","updateValue","isCountersOutOfRange","updateTimestamp","date","formats","getDate","getTime","onDateCounterChange","epochOrDate","dateCounters","MONTH","bind","DAY","YEAR","attachShadow","mode","innerHTML","shadowRoot","querySelector","popoverToggleButton","validationTarget","opened","getAttribute","displayValueEpoch","sortedCounters","map","find","dc","activeCounter","calendar","isRTL","computedStyleDirection","getComputedStyle","getPropertyValue","isInvalidDate","updateDateCounters","isCountersEmpty","every","some","disableCalendar","isSelectAll","inputEle","selectionStart","selectionEnd","reportValidity","dispatchEvent","Event","bubbles","updateInputDisplay","updateFormatPattern","initPopover","initInputElement","getValidity","checkValidity","onPopoverToggle","onFocus","onBlur","handleMouseCaretPositionChange","handleKeyboard","handleInput","onPointerDown","onPaste","includeAttrs","e","preventDefault","handleSelectAll","parseDigits","inputType","handleNavKeys","trigger","withBackdrop","renderer","stopPropagation","selectFirstCounter","root","firstChild","positionTarget","closePopover","setProperty","updateCalendarView","popover","windowRect","body","getBoundingClientRect","inputRect","calendarRect","side","offset","availableLeft","left","availableRight","width","right","newOffset","abs","ele","onCalendarSubmit","_attachOverlay","bringToFront","_detachOverlay","_enterModalState","openPopover","setAttribute","removeAttribute","getCounterById","isReadOnly","calendarDate","getFullYear","getMonth","validInputVal","validate","clearValue","resetDisplay","setSelectionRange","onFormatUpdate","keys","includes","pattern","selectNextCounter","setInputSelectionRange","getCounterIdx","caretPos","counter1ln","counter2ln","indexOf","setSelectedCounterByCaretPosition","target","selectPrevCounter","caretStart","reduce","acc","counter","resetDateCounters","forEach","metaKey","ctrlKey","key","toLowerCase","onCut","handleBackspace","resetToInitialState","onInitialValueChange","togglePopoverAccess","visibility","classList","oldValue","newValue","yearCounter","isYearOutOfRange","isDateDisplayMismatch","entries","getDateVals","isRequired","valueMissing","patternMismatch","ret","day","month","year","err","console","error","pastedData","clipboardData","window","getData","validDate","String"],"sourceRoot":""}
|
1
|
+
{"version":3,"file":"descope-date-field-index-js.js","mappings":"yJAAA,MAAM,KACJA,EAAI,MACJC,EAAK,YACLC,EAAW,kBACXC,EAAiB,WACjBC,EAAU,MACVC,EAAK,UACLC,EAAS,WACTC,EAAU,aACVC,EAAY,oBACZC,EAAmB,cACnBC,EAAa,UACbC,EAAS,cACTC,EAAa,sBACbC,EAAqB,oBACrBC,EAAmB,4BACnBC,GACE,CACFf,KAAM,CAAEgB,SAAU,IAAM,SACxBf,MAAO,CAAEe,SAAU,iBACnBb,kBAAmB,CAAEa,SAAU,+CAC/Bd,YAAa,CACX,CAAEc,SAAU,6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AgBJ,EAAYhR,KAAKqG,QAEnD,GAAI+K,EACFpR,KAAKiB,OAAQ,QAAYmQ,EAAWpR,KAAKgH,WACzChH,KAAKiH,sBAGL/F,YAAW,IAAMlB,KAAKwG,aAAaoH,kBAAkB,EAAG5N,KAAKwG,aAAavF,MAAMwB,cAC3E,CACL,MAAMxB,EAAQ0B,OAAOqO,GAGjB/P,GAASjB,KAAKuI,cAAcnG,KAAOnB,GAASjB,KAAKuI,cAAclG,KAAOpB,IAExEjB,KAAKuI,cAAcrF,IAAImO,OAAOpQ,IAE9BC,YAAW,IAAMlB,KAAKkO,2BAE1B,CACF,ICn1BFlP,eAAeC,OAAOC,EAAe4F,E","sources":["webpack://@descope/web-components-ui/./src/components/descope-text-field/textFieldMappings.js","webpack://@descope/web-components-ui/./src/components/descope-text-field/index.js","webpack://@descope/web-components-ui/./src/components/descope-text-field/TextFieldClass.js","webpack://@descope/web-components-ui/./src/components/descope-date-field/DateCounterClass.js","webpack://@descope/web-components-ui/./src/components/descope-date-field/DateFieldClass.js","webpack://@descope/web-components-ui/./src/components/descope-date-field/index.js"],"sourcesContent":["const {\n host,\n label,\n placeholder,\n requiredIndicator,\n inputField,\n input,\n inputMask,\n helperText,\n errorMessage,\n disabledPlaceholder,\n inputDisabled,\n inputIcon,\n externalInput,\n externalInputDisabled,\n externalPlaceholder,\n externalDisabledPlaceholder,\n} = {\n host: { selector: () => ':host' },\n label: { selector: '::part(label)' },\n requiredIndicator: { selector: '[required]::part(required-indicator)::after' },\n placeholder: [\n { selector: '> input:placeholder-shown' },\n { selector: () => ':host::slotted(input:placeholder-shown)' },\n ],\n disabledPlaceholder: { selector: '> input:disabled::placeholder' },\n inputField: { selector: '::part(input-field)' },\n input: { selector: 'input' },\n inputMask: { selector: '::part(input-field)::before' },\n inputDisabled: { selector: 'input:disabled' },\n helperText: { selector: '::part(helper-text)' },\n errorMessage: { selector: '::part(error-message)' },\n inputIcon: { selector: 'vaadin-icon' },\n externalInput: { selector: () => '::slotted(input)' },\n externalInputDisabled: { selector: () => '::slotted(input:disabled)' },\n externalPlaceholder: { selector: () => '::slotted(input:placeholder-shown)' },\n externalDisabledPlaceholder: { selector: () => '::slotted(input:disabled::placeholder)' },\n};\n\nexport default {\n // we apply font-size also on the host so we can set its width with em\n fontSize: [{}, host],\n fontFamily: [label, inputField, helperText, errorMessage],\n\n labelFontSize: { ...label, property: 'font-size' },\n labelFontWeight: { ...label, property: 'font-weight' },\n\n labelTextColor: [\n { ...label, property: 'color' },\n { ...requiredIndicator, property: 'color' },\n { ...label, property: '-webkit-text-fill-color' },\n { ...requiredIndicator, property: '-webkit-text-fill-color' },\n ],\n\n hostWidth: { ...host, property: 'width' },\n hostMinWidth: { ...host, property: 'min-width' },\n hostDirection: { ...host, property: 'direction' },\n inputDirection: { ...input, property: 'direction' },\n\n inputBackgroundColor: [\n { ...inputField, property: 'background-color' },\n { ...inputMask, property: 'background-color' },\n ],\n\n errorMessageTextColor: { ...errorMessage, property: 'color' },\n errorMessageIcon: { ...errorMessage, property: 'background-image' },\n errorMessageIconSize: { ...errorMessage, property: 'background-size' },\n errorMessageIconPadding: { ...errorMessage, property: 'padding-inline-start' },\n errorMessageIconRepeat: { ...errorMessage, property: 'background-repeat' },\n errorMessageIconPosition: { ...errorMessage, property: 'background-position' },\n errorMessageFontSize: { ...errorMessage, property: 'font-size' },\n\n helperTextColor: { ...helperText, property: '-webkit-text-fill-color' },\n\n inputValueTextColor: [\n { ...inputField, property: 'color' },\n { ...inputDisabled, property: '-webkit-text-fill-color' },\n { ...externalInputDisabled, property: '-webkit-text-fill-color' },\n ],\n inputCaretTextColor: [\n { ...input, property: 'caret-color' },\n { ...externalInput, property: 'caret-color' },\n ],\n\n labelRequiredIndicator: { ...requiredIndicator, property: 'content' },\n\n inputBorderColor: { ...inputField, property: 'border-color' },\n inputBorderWidth: { ...inputField, property: 'border-width' },\n inputBorderStyle: { ...inputField, property: 'border-style' },\n inputBorderRadius: { ...inputField, property: 'border-radius' },\n\n inputHeight: { ...inputField, property: 'height' },\n inputHorizontalPadding: [\n { ...input, property: 'padding-left' },\n { ...input, property: 'padding-right' },\n { ...externalInput, property: 'padding-left' },\n { ...externalInput, property: 'padding-right' },\n ],\n\n inputOutlineColor: { ...inputField, property: 'outline-color' },\n inputOutlineStyle: { ...inputField, property: 'outline-style' },\n inputOutlineWidth: { ...inputField, property: 'outline-width' },\n inputOutlineOffset: { ...inputField, property: 'outline-offset' },\n\n textAlign: {},\n\n inputTextAlign: [\n { ...input, property: 'text-align' },\n { ...externalInput, property: 'text-align' },\n ],\n\n inputPlaceholderColor: [\n { selector: () => ':host input:placeholder-shown', property: 'color' },\n { ...externalPlaceholder, property: 'color' },\n { ...placeholder, property: 'color' },\n { ...disabledPlaceholder, property: '-webkit-text-fill-color' },\n { ...externalDisabledPlaceholder, property: '-webkit-text-fill-color' },\n ],\n\n labelPosition: { ...label, property: 'position' },\n labelTopPosition: { ...label, property: 'top' },\n labelHorizontalPosition: [\n { ...label, property: 'left' },\n { ...label, property: 'right' },\n ],\n inputTransformY: { ...label, property: 'transform' },\n inputTransition: { ...label, property: 'transition' },\n marginInlineStart: { ...label, property: 'margin-inline-start' },\n placeholderOpacity: [\n { selector: '> input:placeholder-shown', property: 'opacity' },\n { ...externalPlaceholder, property: 'opacity' },\n ],\n inputVerticalAlignment: [\n { ...inputField, property: 'align-items' },\n { ...externalInput, property: 'align-items' },\n ],\n valueInputHeight: [\n { ...input, property: 'height' },\n { ...externalInput, property: 'height' },\n ],\n valueInputMarginBottom: [\n { ...input, property: 'margin-bottom' },\n { ...externalInput, property: 'margin-bottom' },\n ],\n\n inputIconOffset: [\n { ...inputIcon, property: 'margin-right' },\n { ...inputIcon, property: 'margin-left' },\n ],\n inputIconSize: { ...inputIcon, property: 'font-size' },\n inputIconColor: { ...inputIcon, property: 'color' },\n};\n","import '@vaadin/text-field';\nimport '@vaadin/icons';\nimport '@vaadin/icon';\n\nimport { componentName, TextFieldClass } from './TextFieldClass';\n\ncustomElements.define(componentName, TextFieldClass);\n\nexport { TextFieldClass, componentName };\n","import {\n createStyleMixin,\n draggableMixin,\n createProxy,\n proxyInputMixin,\n componentNameValidationMixin,\n} from '../../mixins';\nimport textFieldMappings from './textFieldMappings';\nimport { compose } from '../../helpers';\nimport { getComponentName } from '../../helpers/componentHelpers';\nimport {\n inputFloatingLabelStyle,\n resetInputLabelPosition,\n resetInputOverrides,\n useHostExternalPadding,\n} from '../../helpers/themeHelpers/resetHelpers';\n\nexport const componentName = getComponentName('text-field');\n\nconst observedAttrs = ['type', 'label-type', 'copy-to-clipboard'];\n\nconst customMixin = (superclass) =>\n class TextFieldClass extends superclass {\n static get observedAttributes() {\n return observedAttrs.concat(superclass.observedAttributes || []);\n }\n\n icon;\n\n init() {\n super.init?.();\n }\n\n renderCopyToClipboard(shouldRender) {\n if (!shouldRender) {\n this.icon?.remove();\n return;\n }\n\n const iconInitConfig = {\n icon: 'vaadin:copy-o',\n title: 'Copy',\n style: 'cursor: pointer',\n };\n\n const iconCopiedConfig = {\n icon: 'vaadin:check-circle-o',\n title: 'Copied',\n style: 'cursor: initial',\n };\n\n this.icon = Object.assign(document.createElement('vaadin-icon'), {\n slot: 'suffix',\n ...iconInitConfig,\n });\n\n this.baseElement.appendChild(this.icon);\n this.icon.addEventListener('click', () => {\n navigator.clipboard.writeText(this.value);\n Object.assign(this.icon, iconCopiedConfig);\n\n // we want the icon to go back to the initial state after 5 seconds\n setTimeout(() => {\n Object.assign(this.icon, iconInitConfig);\n }, 5000);\n });\n }\n\n onLabelClick() {\n this.focus();\n }\n\n attributeChangedCallback(attrName, oldVal, newVal) {\n super.attributeChangeCallback?.(attrName, oldVal, newVal);\n\n // Vaadin doesn't allow to change the input type attribute.\n // We need the ability to do that, so we're overriding their\n // behavior with their private API.\n // When receiving a `type` attribute, we use their private API\n // to set it on the input.\n if (attrName === 'type') {\n this.baseElement._setType(newVal);\n }\n\n if (oldVal !== newVal) {\n if (attrName === 'label-type') {\n if (newVal === 'floating') {\n this.addEventListener('click', this.onLabelClick);\n } else {\n this.removeEventListener('click', this.onLabelClick);\n }\n } else if (attrName === 'copy-to-clipboard') {\n this.renderCopyToClipboard(newVal === 'true');\n }\n }\n }\n };\n\nexport const TextFieldClass = compose(\n createStyleMixin({\n mappings: textFieldMappings,\n }),\n draggableMixin,\n proxyInputMixin({ proxyProps: ['value', 'selectionStart'], useProxyTargets: true }),\n componentNameValidationMixin,\n customMixin\n)(\n createProxy({\n slots: ['prefix', 'suffix'],\n wrappedEleName: 'vaadin-text-field',\n style: () => `\n\t\t\t:host {\n\t\t\t\tdisplay: inline-block;\n\t\t\t\tmax-width: 100%;\n\t\t\t\tpadding: calc(var(${TextFieldClass.cssVarList.inputOutlineWidth}) + var(${\n TextFieldClass.cssVarList.inputOutlineOffset\n }));\n box-sizing: border-box;\n\t\t\t}\n :host(:is([readonly], [disabled])) ::slotted(:is(input, textarea):placeholder-shown) {\n opacity: 1;\n }\n\n vaadin-text-field[label-type=\"floating\"]:not([focused])[readonly] > input:placeholder-shown {\n opacity: 0;\n }\n vaadin-text-field[label-type=\"floating\"]:not([focused])[disabled] > input:placeholder-shown {\n opacity: 0;\n }\n ${resetInputLabelPosition('vaadin-text-field')}\n\t\t\t${useHostExternalPadding(TextFieldClass.cssVarList)}\n\t\t\t${resetInputOverrides('vaadin-text-field', TextFieldClass.cssVarList)}\n ${inputFloatingLabelStyle()}\n\n vaadin-text-field vaadin-icon {\n align-self: center;\n }\n\t\t`,\n excludeAttrsSync: ['tabindex', 'style'],\n componentName,\n })\n);\n","// DateCounterClass allows us to add several counters to the input, and use them seperately.\n// For examele, we have a DayCounter, MonthCounter and YearCounter, which can each separately navigate\n// between different ranges.\nexport class DateCounter {\n #data = Object.freeze([]);\n\n constructor({ id, min, max, placeholder }, onChange) {\n this.id = id;\n this.min = min;\n this.max = max;\n this.placeholder = placeholder;\n this.onChange = onChange;\n }\n\n get data() {\n return this.#data;\n }\n\n set data(val) {\n this.#data = Object.freeze(val);\n this.onChange?.();\n }\n\n get #initialNumValue() {\n return this.data.length ? this.numberValue : 0;\n }\n\n get numberValue() {\n return Number(this.stringValue);\n }\n\n get stringValue() {\n return (this.data.join('') || this.placeholder).padStart(this.length, '0');\n }\n\n get isFull() {\n return this.numberValue * 10 > this.max || this.data.length === this.length;\n }\n\n get isEmpty() {\n return this.stringValue === this.placeholder;\n }\n\n get length() {\n return this.max.toString().length;\n }\n\n set(val) {\n this.data = val.toString().split('');\n }\n\n add(num) {\n // use local var to avoid triggering onChange\n let data = this.data;\n\n data = [...data, num];\n\n // we need to re-evaluate the number value\n const numVal = Number(data.join(''));\n\n if (numVal > this.max) {\n data = [num];\n } else if (this.length < data.length) {\n data = data.slice(1, data.length);\n }\n\n this.data = data;\n\n return num;\n }\n\n del() {\n if (!this.data.filter((d) => d !== '0').filter(Boolean).length) {\n this.data = [];\n } else {\n this.data = this.data.slice(0, this.data.length - 1);\n }\n }\n\n clear() {\n this.data = [];\n }\n\n inc(gap) {\n this.replaceValue(\n this.#initialNumValue < this.max\n ? Math.max(this.#initialNumValue + (gap || 1), this.min)\n : this.min\n );\n }\n\n dec(gap) {\n this.replaceValue(\n this.#initialNumValue > this.min\n ? Math.min(this.#initialNumValue - (gap || 1), this.max)\n : this.max\n );\n }\n\n isInRange(val) {\n return val >= this.min && val <= this.max;\n }\n\n replaceValue(val) {\n if (this.isInRange(val)) {\n this.data = val.toString().padStart(this.length, 0).split('');\n }\n }\n\n setMin(val) {\n this.min = Number(val);\n }\n\n setMax(val) {\n this.max = Number(val);\n }\n}\n","import { createBaseInputClass } from '../../baseClasses/createBaseInputClass';\nimport {\n createStyleMixin,\n draggableMixin,\n componentNameValidationMixin,\n portalMixin,\n} from '../../mixins';\nimport { forwardAttrs, getComponentName } from '../../helpers/componentHelpers';\nimport { compose } from '../../helpers';\nimport {\n newDate,\n isValidEpoch,\n formatEpoch,\n isNumber,\n getCurrentTime,\n overrideConstructedStylesheet,\n dateToEpoch,\n} from './helpers';\nimport { formats } from './formats';\nimport { calendarIcon } from './icons';\nimport {\n counterConfig,\n DEFAULT_FORMAT,\n DIVIDER,\n MOBILE_DEVICE_INTERACTION_TIMEOUT_MS,\n NATIVE_FORMAT,\n valRange,\n} from './consts';\nimport { DateCounter } from './DateCounterClass';\nimport { TextFieldClass } from '../descope-text-field/TextFieldClass';\nimport { injectStyle } from '@descope-ui/common/components-helpers';\nimport { parseDateString } from './helpers';\n\nexport const componentName = getComponentName('date-field');\n\n// we set baseSelector to `vaadin-popover` as a temporary hack, so our portalMixin will\n// be able to process this component's overlay. The whole process needs refactoring as soon as possible.\nconst BASE_SELECTOR = 'vaadin-popover';\nconst BaseInputClass = createBaseInputClass({ componentName, baseSelector: BASE_SELECTOR });\n\nconst dateFieldAttrs = [\n 'format',\n 'opened',\n 'initial-value',\n 'readonly',\n 'disable-calendar',\n 'utc-time',\n];\nconst calendarAttrs = ['years-range', 'calendar-months', 'calendar-weekdays'];\nconst observedAttrs = [...dateFieldAttrs, ...calendarAttrs];\n\nclass RawDateFieldClass extends BaseInputClass {\n epoch = '';\n\n format = DEFAULT_FORMAT;\n\n selectedCounterIdx = 0;\n\n updateCountersDisplay() {\n this.inputElement.value = this.countersValue;\n }\n\n updateValue() {\n if (this.isCountersOutOfRange) {\n this.updateEpoch('');\n } else {\n const date = formats[this.format].getDate(this.inputElement.value);\n this.updateEpoch(dateToEpoch(date, this.isUtcTime));\n }\n }\n\n onDateCounterChange = () => {\n this.updateCountersDisplay();\n this.updateValue();\n // update validity\n this.#dispatchInput();\n };\n\n updateEpoch(epochOrDate) {\n if (!epochOrDate) {\n this.epoch = '';\n } else {\n this.epoch = newDate(epochOrDate).getTime();\n }\n }\n\n dateCounters = [\n new DateCounter(counterConfig.MONTH, this.onDateCounterChange.bind(this)),\n new DateCounter(counterConfig.DAY, this.onDateCounterChange.bind(this)),\n new DateCounter(counterConfig.YEAR, this.onDateCounterChange.bind(this)),\n ];\n\n static get observedAttributes() {\n return [].concat(BaseInputClass.observedAttributes || [], observedAttrs);\n }\n\n constructor() {\n super();\n\n this.attachShadow({ mode: 'open' }).innerHTML = `\n <div>\n <descope-text-field inputmode=\"numeric\">\n <span slot=\"suffix\" class=\"toggle-calendar\">\n ${calendarIcon}\n </span>\n </descope-text-field>\n <vaadin-popover></vaadin-popover>\n </div>\n `;\n\n injectStyle(\n `\n :host {\n display: inline-block;\n box-sizing: border-box;\n user-select: none;\n max-width: 100%;\n }\n\n :host ::slotted {\n padding: 0;\n }\n\n .toggle-calendar {\n cursor: pointer;\n display: flex;\n align-self: center;\n z-index: 1;\n height: 100%;\n align-items: center;\n }\n\n :host([readonly=\"true\"]) .toggle-calendar {\n pointer-events: none;\n }\n\n .hidden {\n display: none;\n }\n `,\n this\n );\n\n this.inputElement = this.shadowRoot.querySelector('descope-text-field');\n this.popoverToggleButton = this.inputElement.querySelector('.toggle-calendar');\n }\n\n get validationTarget() {\n return this.inputElement;\n }\n\n get opened() {\n return this.getAttribute('opened') === 'true';\n }\n\n // returns the input's value as a epoch\n get displayValueEpoch() {\n const date = formats[this.format].getDate(this.inputElement.value);\n\n if (!isValidEpoch(date?.getTime())) {\n return null;\n }\n\n return date.getTime();\n }\n\n get sortedCounters() {\n return this.format\n .split(DIVIDER)\n .map((placeholder) => this.dateCounters.find((dc) => dc.placeholder === placeholder));\n }\n\n get activeCounter() {\n return this.sortedCounters[this.selectedCounterIdx];\n }\n\n get countersValue() {\n return this.sortedCounters.map((dc) => dc.stringValue).join(DIVIDER);\n }\n\n get overlay() {\n return this.baseElement.shadowRoot?.querySelector('vaadin-popover-overlay');\n }\n\n get backdrop() {\n return this.overlay.shadowRoot?.querySelector('#backdrop');\n }\n\n get calendar() {\n return this.overlay?.querySelector('descope-calendar');\n }\n\n get isRTL() {\n const computedStyleDirection = getComputedStyle(this.baseElement).getPropertyValue('direction');\n\n if (computedStyleDirection) {\n return computedStyleDirection === 'rtl';\n }\n\n // Fallback: If for some reason computed style was not calculated in time, fallback to check on attribute\n return this.getAttribute('st-host-direction') === 'rtl';\n }\n\n get value() {\n if (this.isInvalidDate()) {\n return '';\n }\n return this.epoch;\n }\n\n set value(val) {\n if (val) {\n this.updateEpoch(val);\n this.updateDateCounters(newDate(val));\n } else {\n this.updateEpoch('');\n }\n }\n\n get isCountersEmpty() {\n return this.dateCounters.every((dc) => dc.isEmpty);\n }\n\n get isCountersOutOfRange() {\n return this.dateCounters.some((dc) => !dc.isInRange(dc.numberValue));\n }\n\n get disableCalendar() {\n return this.getAttribute('disable-calendar') === 'true';\n }\n\n get isUtcTime() {\n return this.getAttribute('utc-time') === 'true';\n }\n\n get isSelectAll() {\n const inputEle = this.inputElement.baseElement.inputElement;\n return inputEle.value.length === inputEle.selectionStart + inputEle.selectionEnd;\n }\n\n reportValidity() {\n this.inputElement.reportValidity();\n }\n\n #dispatchInput() {\n this.inputElement.baseElement.dispatchEvent(new Event('input', { bubbles: true }));\n }\n\n updateInputDisplay() {\n this.inputElement.value = formatEpoch(newDate(this.countersValue).getTime(), this.format);\n }\n\n init() {\n super.init?.();\n\n this.updateFormatPattern();\n this.initPopover();\n this.onDateCounterChange();\n this.initInputElement();\n\n setTimeout(() => {\n this.#overrideOverlaySettings();\n }, 0);\n }\n\n initInputElement() {\n this.inputElement.getValidity = this.getValidity.bind(this);\n this.inputElement.baseElement.checkValidity = this.checkValidity.bind(this);\n\n this.popoverToggleButton.addEventListener('click', this.onPopoverToggle.bind(this));\n\n this.inputElement.addEventListener('focus', this.onFocus.bind(this));\n this.inputElement.addEventListener('blur', this.onBlur.bind(this));\n this.inputElement.addEventListener('click', this.handleMouseCaretPositionChange.bind(this));\n this.inputElement.addEventListener('keydown', this.handleKeyboard.bind(this));\n this.inputElement.addEventListener('beforeinput', this.handleInput.bind(this));\n this.inputElement.addEventListener('pointerdown', this.onPointerDown.bind(this));\n this.inputElement.addEventListener('paste', this.onPaste.bind(this));\n\n forwardAttrs(this, this.inputElement, {\n includeAttrs: [\n 'label',\n 'label-type',\n 'placeholder',\n 'disabled',\n 'readonly',\n 'bordered',\n 'required',\n 'full-width',\n 'st-host-direction',\n 'pattern',\n 'bordered',\n 'data-errormessage-value-missing',\n 'data-errormessage-pattern-mismatch',\n 'data-errormessage-range-underflow',\n 'data-errormessage-range-overflow',\n 'st-error-message-icon',\n 'st-error-message-icon-size',\n 'st-error-message-icon-padding',\n ],\n });\n }\n\n handleInput(e) {\n e.preventDefault();\n\n this.handleSelectAll();\n\n if (e.data && isNumber(e.data)) {\n this.parseDigits(e.data);\n this.updateCountersDisplay();\n } else if (e.inputType) {\n this.handleNavKeys(e);\n }\n }\n\n initPopover() {\n this.baseElement.trigger = ['click'];\n this.baseElement.withBackdrop = true;\n this.baseElement.renderer = this.#popoverRenderer.bind(this);\n\n // block popover events from focusing/blurring the text-field\n this.baseElement.addEventListener('click', (e) => {\n e.preventDefault();\n e.stopPropagation();\n });\n }\n\n handleSelectAll() {\n if (this.isSelectAll) {\n this.selectFirstCounter();\n }\n }\n\n #popoverPosStylesheet;\n\n #popoverRenderer(root) {\n // popoverRenderer should run only once, when the popover is first rendering.\n if (!root.firstChild) {\n this.overlay.positionTarget = this.shadowRoot.querySelector('.toggle-calendar');\n\n root.appendChild(this.#getPopoverContent());\n\n // override vaadin's constructed stylesheet which hides the host element\n overrideConstructedStylesheet(this.baseElement);\n\n this.backdrop.addEventListener('click', this.closePopover.bind(this));\n }\n\n // Hide overlay before adjusting position to prevent flickering\n root.style.setProperty('visibility', 'hidden');\n\n // Wait until overlay is ready\n setTimeout(() => {\n this.#adjustPopoverPosition(root);\n\n // Show adjusted overlay\n root.style.setProperty('visibility', 'visible');\n this.updateCalendarView(root);\n }, 100);\n }\n\n #adjustPopoverPosition() {\n const popover = this.shadowRoot.querySelector('vaadin-popover').shadowRoot;\n\n // Remove previously added stylesheets\n this.#popoverPosStylesheet?.remove();\n\n const windowRect = document.body.getBoundingClientRect();\n const inputRect = this.getBoundingClientRect();\n const calendarRect = this.calendar.getBoundingClientRect();\n\n const side = this.isRTL ? 'right' : 'left';\n const offset = inputRect[side] - calendarRect[side];\n const availableLeft = calendarRect.left;\n const availableRight = windowRect.width - calendarRect.right;\n\n let newOffset;\n if (offset > 0) {\n newOffset = Math.min(offset, availableRight);\n } else {\n newOffset = Math.min(Math.abs(offset), availableLeft) * -1;\n }\n\n injectStyle(\n `\n vaadin-popover-overlay::part(overlay) {\n transform: translateX(${newOffset}px);\n }\n `,\n popover\n );\n }\n\n #getPopoverContent() {\n const ele = document.createElement('span');\n\n ele.innerHTML = `<descope-calendar></descope-calendar>`;\n\n const calendar = ele.querySelector('descope-calendar');\n\n calendar.addEventListener('date-submit', this.onCalendarSubmit.bind(this));\n calendar.addEventListener('cancel', this.closePopover.bind(this));\n\n return ele;\n }\n\n // the default vaadin behavior is to attach the overlay to the body when opened\n // we do not want that because it's difficult to style the overlay in this way\n // so we override it to open inside the shadow DOM\n #overrideOverlaySettings() {\n this.overlay._attachOverlay = () => this.overlay.bringToFront();\n this.overlay._detachOverlay = () => {};\n this.overlay._enterModalState = () => {};\n }\n\n onPopoverToggle() {\n this.opened ? this.closePopover() : this.openPopover();\n }\n\n openPopover() {\n if (this.disableCalendar) return;\n this.setAttribute('opened', 'true');\n }\n\n closePopover() {\n this.removeAttribute('opened');\n this.inputElement.focus();\n }\n\n getCounterById(id) {\n return this.dateCounters.find((dc) => dc.id === id);\n }\n\n onCalendarSubmit() {\n if (!this.isReadOnly) {\n if (!this.calendar.value) return;\n\n const calendarDate = newDate(this.calendar.value);\n\n this.value = dateToEpoch(calendarDate, this.isUtcTime);\n\n this.getCounterById('year').replaceValue(calendarDate.getFullYear());\n this.getCounterById('month').replaceValue(calendarDate.getMonth() + 1);\n this.getCounterById('day').replaceValue(calendarDate.getDate());\n\n this.#dispatchInput();\n }\n\n this.closePopover();\n }\n\n updateCalendarView() {\n const validInputVal =\n isValidEpoch(newDate(this.inputElement.value || '').getTime()) &&\n formats[this.format].validate(this.inputElement.value);\n\n if (this.displayValueEpoch || validInputVal) {\n this.calendar.setAttribute(\n 'initial-value',\n formatEpoch(this.displayValueEpoch || this.epoch, NATIVE_FORMAT)\n );\n } else {\n this.calendar.clearValue();\n this.calendar.setAttribute('preview', formatEpoch(getCurrentTime(), NATIVE_FORMAT));\n }\n\n forwardAttrs(this, this.calendar, {\n includeAttrs: [\n 'st-host-direction',\n 'readonly',\n 'initial-month',\n 'initial-year',\n 'years-range',\n 'calendar-label-submit',\n 'calendar-label-cancel',\n 'calendar-months',\n 'calendar-weekdays',\n 'calendar-weekdays-short',\n ],\n });\n }\n\n // In mobile devices, there are cases were `pointerdown` is triggered\n // instead of `click`.\n onPointerDown(e) {\n setTimeout(() => this.handleMouseCaretPositionChange(e), MOBILE_DEVICE_INTERACTION_TIMEOUT_MS);\n }\n\n onFocus() {\n if (this.isReadOnly) {\n return;\n }\n\n // We need to wait for focus to end before we set selection\n setTimeout(() => this.resetDisplay());\n }\n\n resetDisplay() {\n if (!this.inputElement.value) {\n this.inputElement.value = this.format;\n }\n\n // On focus select the first counter\n this.selectFirstCounter();\n // set selection on first counter\n this.inputElement.setSelectionRange(0, this.sortedCounters[0].length);\n }\n\n onBlur() {\n if (this.opened) {\n return;\n }\n\n if (this.inputElement.value === this.format) {\n this.inputElement.value = '';\n }\n }\n\n onFormatUpdate(format) {\n if (Object.keys(formats).includes(format)) {\n this.format = format;\n this.updateFormatPattern();\n }\n }\n\n updateFormatPattern() {\n const format = this.getAttribute('format') || this.format || DEFAULT_FORMAT;\n this.setAttribute('type', 'date');\n this.setAttribute('pattern', formats[format].pattern);\n }\n\n parseDigits(value) {\n this.activeCounter.add(value);\n\n if (this.activeCounter.isFull) {\n this.selectNextCounter();\n }\n\n // We wait for the digit to be parsed, and only then set the selection.\n // Failing to do so results in unexpected \"jump\" of the screen in mobile devices.\n this.setInputSelectionRange();\n }\n\n getCounterIdx(caretPos) {\n const [counter1ln, counter2ln] = this.sortedCounters.map((dc) => dc.length);\n\n const c1 = caretPos <= counter1ln;\n const c2 = caretPos >= counter1ln && caretPos <= counter1ln + counter2ln + 1;\n const c3 = caretPos >= counter1ln + counter2ln + 2;\n\n return [c1, c2, c3].indexOf(true);\n }\n\n setSelectedCounterByCaretPosition(e) {\n this.selectedCounterIdx = this.getCounterIdx(\n // if triggered by touch event, target might not include `selectionStart`\n // in that case we fall back to the inputElement's `selectionStart` value.\n // Therefore, it is recommended to run this function with setTimeout,\n // at least for mobile events.\n e.target?.selectionStart || this.inputElement.selectionStart\n );\n }\n\n selectFirstCounter() {\n this.selectedCounterIdx = 0;\n }\n\n selectNextCounter() {\n if (this.selectedCounterIdx < this.dateCounters.length) {\n this.selectedCounterIdx = Math.min(this.selectedCounterIdx + 1, 2);\n }\n }\n\n selectPrevCounter() {\n if (this.selectedCounterIdx > 0) {\n this.selectedCounterIdx = Math.min(this.selectedCounterIdx - 1, 1);\n }\n }\n\n // Sets the text selection range in the input element based on the selected counter.\n // The function calculates the starting position of the selection by summing the lengths\n // of all counters before the currently selected counter (`selectedCounterIdx`).\n // It then selects the entire length of the current counter in the input element.\n setInputSelectionRange() {\n // For preview/readonly state we don't have a caret or a caretIdx, so we skip setting input selection range\n if (this.selectedCounterIdx < 0) {\n return;\n }\n\n // We wait for before setting the selection, otherwise there's an\n // unexpected \"jump\" of the screen in mobile devices.\n setTimeout(() => {\n const caretStart = this.sortedCounters\n .slice(0, this.selectedCounterIdx)\n .reduce((acc, counter) => acc + counter.length, this.selectedCounterIdx);\n\n this.inputElement.setSelectionRange(\n caretStart,\n caretStart + this.sortedCounters[this.selectedCounterIdx].length\n );\n });\n }\n\n resetDateCounters() {\n this.dateCounters.forEach((dc) => dc.clear());\n }\n\n // in case value is set from external source we need to update date counters\n updateDateCounters(date) {\n this.dateCounters.forEach((dc) => {\n switch (dc.id) {\n case counterConfig.MONTH.id:\n dc.set(date.getMonth() + 1);\n break;\n case counterConfig.YEAR.id:\n dc.set(date.getFullYear());\n break;\n case counterConfig.DAY.id:\n dc.set(date.getDate());\n break;\n default:\n break;\n }\n });\n }\n\n handleKeyboard(e) {\n if (e.metaKey || e.ctrlKey) {\n if (e.key.toLowerCase() === 'x') {\n this.onCut(e);\n }\n\n return;\n }\n\n this.handleSelectAll();\n\n if (e.key === 'ArrowUp') {\n this.activeCounter.inc();\n } else if (e.key === 'ArrowDown') {\n this.activeCounter.dec();\n } else if (e.key === 'ArrowRight') {\n this.selectNextCounter();\n } else if (e.key === 'ArrowLeft') {\n this.selectPrevCounter();\n }\n\n this.setInputSelectionRange();\n }\n\n handleNavKeys(e) {\n if (this.isReadOnly) {\n return;\n }\n\n if (this.opened) {\n this.closePopover();\n }\n\n if (!this.activeCounter) return;\n\n if (e.inputType === 'deleteContentBackward') {\n this.handleBackspace();\n }\n\n this.setInputSelectionRange();\n }\n\n handleBackspace() {\n if (this.isSelectAll) {\n this.resetToInitialState();\n return;\n }\n\n const counter = this.activeCounter;\n\n if (counter.isEmpty) {\n this.selectPrevCounter();\n this.setInputSelectionRange();\n } else {\n counter.set('');\n }\n\n // To support keyboards like SwiftKey, we need to re-render the counters display and selection,\n // otherwise we get an unexpected behavior, where the format is deleted.\n setTimeout(() => {\n this.updateCountersDisplay();\n this.setInputSelectionRange();\n });\n }\n\n handleMouseCaretPositionChange(e) {\n if (this.opened) {\n return;\n }\n\n e.preventDefault();\n\n this.setSelectedCounterByCaretPosition(e);\n this.setInputSelectionRange();\n }\n\n onInitialValueChange(val) {\n // if component already has a value don't re-set value\n if (this.value) return;\n\n // we need to wait for the text-field to init\n setTimeout(() => {\n this.value = val;\n });\n }\n\n togglePopoverAccess(visibility) {\n if (visibility) {\n this.popoverToggleButton.classList.remove('hidden');\n } else {\n this.popoverToggleButton.classList.add('hidden');\n }\n }\n\n attributeChangedCallback(attrName, oldValue, newValue) {\n super.attributeChangedCallback?.(attrName, oldValue, newValue);\n\n if (oldValue !== newValue) {\n if (attrName === 'disable-calendar') {\n this.togglePopoverAccess(newValue !== 'true');\n }\n if (dateFieldAttrs.includes(attrName)) {\n if (newValue && attrName === 'format') {\n this.onFormatUpdate(newValue);\n }\n if (attrName === 'initial-value') {\n this.onInitialValueChange(newValue);\n }\n } else if (calendarAttrs.includes(attrName)) {\n if (newValue) {\n this.calendar?.setAttribute(attrName, newValue);\n } else {\n this.calendar?.removeAttribute(attrName);\n }\n }\n }\n }\n\n // we want to validate the date supplied actually exists. For example: Feb 31 is not an actual date,\n // but in JS when create a `new Date('1999-02-31') we get March 2nd 1999.\n // To prevent this error from being submitted, we evaluate the\n // date parts against their generated Date value.\n isInvalidDate() {\n const yearCounter = this.getCounterById('year');\n const isYearOutOfRange =\n yearCounter.numberValue > valRange['year'].max ||\n yearCounter.numberValue < valRange['year'].min;\n\n const isDateDisplayMismatch = Object.entries(this.getDateVals()).some(([key, val]) => {\n const counter = this.getCounterById(key);\n return !val || counter.numberValue !== val;\n });\n\n return isYearOutOfRange || isDateDisplayMismatch;\n }\n\n getValidity() {\n if (this.isRequired && this.isCountersEmpty) {\n return { valueMissing: true };\n }\n\n if (this.isCountersOutOfRange || this.isInvalidDate()) {\n return { patternMismatch: true };\n }\n\n return {};\n }\n\n getDateVals() {\n const ret = {\n day: '',\n month: '',\n year: '',\n };\n\n if (!this.epoch) {\n return ret;\n }\n\n try {\n const date = newDate(this.epoch);\n\n if (this.isUtcTime) {\n ret.month = date.getUTCMonth() + 1;\n ret.day = date.getUTCDate();\n ret.year = date.getUTCFullYear();\n } else {\n ret.month = date.getMonth() + 1;\n ret.day = date.getDate();\n ret.year = date.getFullYear();\n }\n } catch (e) {}\n\n return ret;\n }\n\n resetToInitialState() {\n this.resetDateCounters();\n this.selectFirstCounter();\n this.resetDisplay();\n }\n\n onCut(e) {\n e.preventDefault();\n\n if (this.isSelectAll) {\n this.#copyToClipboard(this.countersValue);\n this.resetToInitialState();\n } else {\n this.#copyToClipboard(this.activeCounter.stringValue);\n this.activeCounter.set('');\n }\n\n this.setInputSelectionRange();\n }\n\n #copyToClipboard(value) {\n try {\n navigator.clipboard.writeText(value);\n } catch (err) {\n console.error('Failed to copy date value:', err);\n }\n }\n\n onPaste(e) {\n e.preventDefault();\n\n const clipboardData = e.clipboardData || window.clipboardData;\n const pastedData = clipboardData.getData('Text');\n\n // try paste entire date if valid\n const validDate = parseDateString(pastedData, this.format);\n\n if (validDate) {\n this.value = dateToEpoch(validDate, this.isUtcTime);\n this.onDateCounterChange();\n\n // select all\n setTimeout(() => this.inputElement.setSelectionRange(0, this.inputElement.value.length));\n } else {\n const value = Number(pastedData);\n\n // try paste in counter if possible\n if (value && this.activeCounter.min <= value && this.activeCounter.max >= value) {\n // use String to get rid of any zero padding\n this.activeCounter.set(String(value));\n\n setTimeout(() => this.setInputSelectionRange());\n }\n }\n }\n}\n\nconst textVars = TextFieldClass.cssVarList;\nconst { host, input, inputEleRTL, toggleButton, overlay, backdrop, errorMessage } = {\n host: { selector: () => ':host' },\n input: { selector: () => 'descope-text-field' },\n inputEleRTL: { selector: () => ':host([st-host-direction=\"rtl\"]) descope-text-field' },\n toggleButton: { selector: () => '.toggle-calendar' },\n overlay: { selector: 'vaadin-popover-overlay::part(overlay)' },\n backdrop: { selector: 'vaadin-popover-overlay::part(backdrop)' },\n};\n\nexport const DateFieldClass = compose(\n createStyleMixin({ componentNameOverride: getComponentName('input-wrapper') }),\n createStyleMixin({\n mappings: {\n iconMargin: { ...toggleButton, property: 'margin-inline-end' },\n hostWidth: { ...host, property: 'width' },\n hostDirection: { ...host, property: 'direction' },\n textAlign: { ...input, property: 'text-align' },\n rtlInputDirection: { ...inputEleRTL, property: textVars.inputDirection },\n rtlInputAlignment: { ...inputEleRTL, property: textVars.inputTextAlign },\n overlayGap: {\n property: () => DateFieldClass.cssVarList.overlayGap,\n },\n overlayBackgroundColor: {\n property: () => DateFieldClass.cssVarList.overlayBackgroundColor,\n },\n overlayPadding: {\n property: () => DateFieldClass.cssVarList.overlayPadding,\n },\n overlayBoxShadow: { property: () => DateFieldClass.overlayBoxShadow },\n overlayOutlineWidth: {\n property: () => DateFieldClass.cssVarList.overlayOutlineWidth,\n },\n overlayOutlineColor: {\n property: () => DateFieldClass.cssVarList.overlayOutlineColor,\n },\n overlayOutlineStyle: {\n property: () => DateFieldClass.cssVarList.overlayOutlineStyle,\n },\n errorMessageIcon: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageIcon,\n },\n errorMessageIconSize: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageIconSize,\n },\n errorMessageIconPadding: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageIconPadding,\n },\n errorMessageIconRepeat: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageIconRepeat,\n },\n errorMessageIconPosition: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageIconPosition,\n },\n errorMessageFontSize: {\n selector: TextFieldClass.componentName,\n property: TextFieldClass.cssVarList.errorMessageFontSize,\n },\n },\n }),\n portalMixin({\n name: 'overlay',\n selector: '',\n mappings: {\n marginTop: { ...overlay, property: 'margin-top' },\n backgroundColor: { ...overlay },\n backdropBackgroundColor: { ...backdrop, property: 'background-color' },\n backdropPointerEvents: { ...backdrop, property: 'pointer-events' },\n padding: { ...overlay },\n boxShadow: { ...overlay },\n outlineWidth: { ...overlay },\n outlineColor: { ...overlay },\n outlineStyle: { ...overlay },\n },\n }),\n draggableMixin,\n componentNameValidationMixin\n)(RawDateFieldClass);\n","import '@vaadin/popover/src/vaadin-popover';\nimport './descope-calendar';\nimport '../descope-text-field';\n\nimport { componentName, DateFieldClass } from './DateFieldClass';\n\ncustomElements.define(componentName, DateFieldClass);\n\nexport { DateFieldClass, componentName };\n"],"names":["host","label","placeholder","requiredIndicator","inputField","input","inputMask","helperText","errorMessage","disabledPlaceholder","inputDisabled","inputIcon","externalInput","externalInputDisabled","externalPlaceholder","externalDisabledPlaceholder","selector","fontSize","fontFamily","labelFontSize","property","labelFontWeight","labelTextColor","hostWidth","hostMinWidth","hostDirection","inputDirection","inputBackgroundColor","errorMessageTextColor","errorMessageIcon","errorMessageIconSize","errorMessageIconPadding","errorMessageIconRepeat","errorMessageIconPosition","errorMessageFontSize","helperTextColor","inputValueTextColor","inputCaretTextColor","labelRequiredIndicator","inputBorderColor","inputBorderWidth","inputBorderStyle","inputBorderRadius","inputHeight","inputHorizontalPadding","inputOutlineColor","inputOutlineStyle","inputOutlineWidth","inputOutlineOffset","textAlign","inputTextAlign","inputPlaceholderColor","labelPosition","labelTopPosition","labelHorizontalPosition","inputTransformY","inputTransition","marginInlineStart","placeholderOpacity","inputVerticalAlignment","valueInputHeight","valueInputMarginBottom","inputIconOffset","inputIconSize","inputIconColor","customElements","define","componentName","observedAttrs","TextFieldClass","mappings","proxyProps","useProxyTargets","superclass","observedAttributes","concat","icon","init","super","renderCopyToClipboard","shouldRender","this","remove","iconInitConfig","title","style","iconCopiedConfig","Object","assign","document","createElement","slot","baseElement","appendChild","addEventListener","navigator","clipboard","writeText","value","setTimeout","onLabelClick","focus","attributeChangedCallback","attrName","oldVal","newVal","attributeChangeCallback","_setType","removeEventListener","slots","wrappedEleName","cssVarList","excludeAttrsSync","DateCounter","freeze","constructor","id","min","max","onChange","data","val","length","numberValue","Number","stringValue","join","padStart","isFull","isEmpty","toString","set","split","add","num","slice","del","filter","d","Boolean","clear","inc","gap","replaceValue","Math","dec","isInRange","setMin","setMax","BaseInputClass","createBaseInputClass","baseSelector","dateFieldAttrs","calendarAttrs","textVars","inputEleRTL","toggleButton","overlay","backdrop","DateFieldClass","componentNameOverride","iconMargin","rtlInputDirection","rtlInputAlignment","overlayGap","overlayBackgroundColor","overlayPadding","overlayBoxShadow","overlayOutlineWidth","overlayOutlineColor","overlayOutlineStyle","name","marginTop","backgroundColor","backdropBackgroundColor","backdropPointerEvents","padding","boxShadow","outlineWidth","outlineColor","outlineStyle","epoch","format","selectedCounterIdx","updateCountersDisplay","inputElement","countersValue","updateValue","isCountersOutOfRange","updateEpoch","date","formats","getDate","isUtcTime","onDateCounterChange","epochOrDate","getTime","dateCounters","MONTH","bind","DAY","YEAR","attachShadow","mode","innerHTML","shadowRoot","querySelector","popoverToggleButton","validationTarget","opened","getAttribute","displayValueEpoch","sortedCounters","map","find","dc","activeCounter","calendar","isRTL","computedStyleDirection","getComputedStyle","getPropertyValue","isInvalidDate","updateDateCounters","isCountersEmpty","every","some","disableCalendar","isSelectAll","inputEle","selectionStart","selectionEnd","reportValidity","dispatchEvent","Event","bubbles","updateInputDisplay","updateFormatPattern","initPopover","initInputElement","getValidity","checkValidity","onPopoverToggle","onFocus","onBlur","handleMouseCaretPositionChange","handleKeyboard","handleInput","onPointerDown","onPaste","includeAttrs","e","preventDefault","handleSelectAll","parseDigits","inputType","handleNavKeys","trigger","withBackdrop","renderer","stopPropagation","selectFirstCounter","root","firstChild","positionTarget","closePopover","setProperty","updateCalendarView","popover","windowRect","body","getBoundingClientRect","inputRect","calendarRect","side","offset","availableLeft","left","availableRight","width","right","newOffset","abs","ele","onCalendarSubmit","_attachOverlay","bringToFront","_detachOverlay","_enterModalState","openPopover","setAttribute","removeAttribute","getCounterById","isReadOnly","calendarDate","getFullYear","getMonth","validInputVal","validate","clearValue","resetDisplay","setSelectionRange","onFormatUpdate","keys","includes","pattern","selectNextCounter","setInputSelectionRange","getCounterIdx","caretPos","counter1ln","counter2ln","indexOf","setSelectedCounterByCaretPosition","target","selectPrevCounter","caretStart","reduce","acc","counter","resetDateCounters","forEach","metaKey","ctrlKey","key","toLowerCase","onCut","handleBackspace","resetToInitialState","onInitialValueChange","togglePopoverAccess","visibility","classList","oldValue","newValue","yearCounter","isYearOutOfRange","isDateDisplayMismatch","entries","getDateVals","isRequired","valueMissing","patternMismatch","ret","day","month","year","getUTCMonth","getUTCDate","getUTCFullYear","err","console","error","pastedData","clipboardData","window","getData","validDate","String"],"sourceRoot":""}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[1331],{12848:(t,e,o)=>{o.r(e),o.d(e,{MultiSelectComboBoxClass:()=>I,componentName:()=>l}),o(51408);var r=o(9696),n=o(97810),i=o(73551),a=o(79365);const l=(0,n.xE)("multi-select-combo-box"),{host:s,inputField:d,inputElement:p,placeholder:c,toggle:u,clearButton:m,label:b,requiredIndicator:h,helperText:g,errorMessage:y,chip:v,chipLabel:f,overflowChipFirstBorder:x,overflowChipSecondBorder:w}={host:{selector:()=>":host"},inputField:{selector:"::part(input-field)"},inputElement:{selector:"input"},placeholder:{selector:"> input:placeholder-shown"},toggle:{selector:"::part(toggle-button)"},clearButton:{selector:"::part(clear-button)"},label:{selector:"::part(label)"},requiredIndicator:{selector:"[required]::part(required-indicator)::after"},helperText:{selector:"::part(helper-text)"},errorMessage:{selector:"::part(error-message)"},chip:{selector:"vaadin-multi-select-combo-box-chip"},chipLabel:{selector:"vaadin-multi-select-combo-box-chip::part(label)"},overflowChipFirstBorder:{selector:"vaadin-multi-select-combo-box-chip[slot='overflow']::before"},overflowChipSecondBorder:{selector:"vaadin-multi-select-combo-box-chip[slot='overflow']::after"}},I=(0,r.Zz)((0,a.RF)({mappings:{hostWidth:{...s,property:"width"},hostDirection:{...s,property:"direction"},fontSize:[{},s],chipFontSize:{...f,property:"font-size"},fontFamily:[b,c,d,g,y,f],labelFontSize:{...b,property:"font-size"},labelFontWeight:{...b,property:"font-weight"},labelTextColor:[{...b,property:"color"},{...h,property:"color"}],errorMessageTextColor:{...y,property:"color"},errorMessageIcon:{...y,property:"background-image"},errorMessageIconSize:{...y,property:"background-size"},errorMessageIconPadding:{...y,property:"padding-inline-start"},errorMessageIconRepeat:{...y,property:"background-repeat"},errorMessageIconPosition:{...y,property:"background-position"},errorMessageFontSize:{...y,property:"font-size"},inputHeight:{...d,property:"min-height"},inputBackgroundColor:{...d,property:"background-color"},inputBorderColor:{...d,property:"border-color"},inputBorderWidth:{...d,property:"border-width"},inputBorderStyle:{...d,property:"border-style"},inputBorderRadius:{...d,property:"border-radius"},labelRequiredIndicator:{...h,property:"content"},inputValueTextColor:{...d,property:"color"},inputPlaceholderTextColor:{...c,property:"color"},inputDropdownButtonCursor:[{...u,property:"cursor"},{...m,property:"cursor"}],inputDropdownButtonColor:[{...u,property:"color"},{...m,property:"color"}],inputDropdownButtonSize:[{...u,property:"font-size"},{...m,property:"font-size"}],inputDropdownButtonOffset:[{...u,property:"margin-right"},{...u,property:"margin-left"}],inputOutlineColor:{...d,property:"outline-color"},inputOutlineWidth:{...d,property:"outline-width"},inputOutlineStyle:{...d,property:"outline-style"},inputOutlineOffset:{...d,property:"outline-offset"},inputHorizontalPadding:[{...p,property:"padding-left"},{...p,property:"padding-right"},{...d,property:"padding-inline-start"}],inputVerticalPadding:[{...d,property:"padding-top"},{...d,property:"padding-bottom"}],chipTextColor:{...f,property:"color"},chipBackgroundColor:[{...v,property:"background-color"},{...x,property:"border-color"},{...w,property:"border-color"}],labelPosition:{...b,property:"position"},labelTopPosition:{...b,property:"top"},labelLeftPosition:{...b,property:"left"},labelHorizontalPosition:[{...b,property:"left"},{...b,property:"right"}],inputTransformY:{...b,property:"transform"},inputTransition:{...b,property:"transition"},marginInlineStart:{...b,property:"margin-inline-start"},placeholderOpacity:{...c,property:"opacity"},inputVerticalAlignment:{...d,property:"align-items"},overlayBackground:{property:()=>I.cssVarList.overlay.backgroundColor},overlayTextColor:{property:()=>I.cssVarList.overlay.textColor},overlayBorder:{property:()=>I.cssVarList.overlay.border},overlayFontSize:{property:()=>I.cssVarList.overlay.fontSize},overlayFontFamily:{property:()=>I.cssVarList.overlay.fontFamily},overlayCursor:{property:()=>I.cssVarList.overlay.cursor},overlayItemBoxShadow:{property:()=>I.cssVarList.overlay.itemBoxShadow},overlayItemPaddingInlineStart:{property:()=>I.cssVarList.overlay.itemPaddingInlineStart},overlayItemPaddingInlineEnd:{property:()=>I.cssVarList.overlay.itemPaddingInlineEnd}}}),a.VO,(0,a.mA)({name:"overlay",selector:"vaadin-multi-select-combo-box-internal",mappings:{backgroundColor:{selector:"vaadin-multi-select-combo-box-scroller"},minHeight:{selector:"vaadin-multi-select-combo-box-overlay"},margin:{selector:"vaadin-multi-select-combo-box-overlay"},cursor:{selector:"vaadin-multi-select-combo-box-item"},fontFamily:{selector:"vaadin-multi-select-combo-box-item"},textColor:{selector:"vaadin-multi-select-combo-box-item",property:"color"},fontSize:{selector:"vaadin-multi-select-combo-box-item"},itemBoxShadow:{selector:"vaadin-multi-select-combo-box-item",property:"box-shadow"},itemPaddingInlineStart:{selector:"vaadin-multi-select-combo-box-item",property:"padding-inline-start"},itemPaddingInlineEnd:{selector:"vaadin-multi-select-combo-box-item",property:"padding-inline-end"}},forward:{include:!1,attributes:["size"]}}),(0,a.OZ)({proxyProps:["selectionStart"],inputEvent:"selected-items-changed"}),a._$,a.tQ,(t=>class extends t{static get observedAttributes(){return["readonly"]}#t=({displayName:t,value:e,label:o})=>{const r=document.createElement("span");return r.setAttribute("data-name",o),r.setAttribute("data-id",e),r.textContent=t||o,r.outerHTML};#e;#o=[];get defaultValues(){const t=this.getAttribute("default-values");if(t)try{const e=JSON.parse(t);if(this.isValidDataType(e))return e}catch(t){console.error('could not parse data string from attribute "default-values" -',t.message)}return[]}get renderItem(){return this.#t}set renderItem(t){this.#t=t,this.renderItems()}get data(){if(this.#e)return this.#e;const t=this.getAttribute("data");if(t)try{const e=JSON.parse(t);if(this.isValidDataType(e))return e}catch(t){console.error('could not parse data string from attribute "data" -',t.message)}return[]}set data(t){this.isValidDataType(t)&&(this.#e=t,this.renderItems())}get allowCustomValues(){return"true"===this.getAttribute("allow-custom-value")}get minItemsSelection(){return parseInt(this.getAttribute("min-items-selection"),10)||0}get maxItemsSelection(){return parseInt(this.getAttribute("max-items-selection"),10)||0}isValidDataType(t){const e=Array.isArray(t);return e||console.error("data and default-values must be an array, received:",t),e}getItemsTemplate(){return this.data?.reduce?.(((t,e)=>t+(this.renderItem?.(e||{})||"")),"")}renderItems(){const t=this.getItemsTemplate();t&&(this.innerHTML=t)}updateSelectedItems(){const t=this.baseElement.selectedItems?.map((t=>t.getAttribute("data-id")))||[];t.length>0&&(this.value=t),0===this.value.length&&this.setDefaultValues()}customValueTransformFn(t){return t}setComboBoxDescriptor(){const t=Object.getOwnPropertyDescriptor(this.inputElement.constructor.prototype,"value"),e=this;Object.defineProperties(this.inputElement,{value:{...t,set(o){const r=e.customValueTransformFn(o)||"";r!==this.value&&t.set.call(this,r)}}})}#r(t){return Array.from(new Map(t.map((t=>[t.getAttribute("data-id"),t]))).values())}#n(){const t=Array.from(this.children),e=this.#r(t);t.length?(this.removeAttribute("has-no-options"),e.forEach((t=>{Object.defineProperty(t,"data-name",{value:t.getAttribute("data-name"),configurable:!0,writable:!0}),Object.defineProperty(t,"data-id",{value:t.getAttribute("data-id"),configurable:!0,writable:!0})})),this.baseElement.items=e,setTimeout((()=>{this.updateSelectedItems()}),0)):(this.baseElement.items=[],this.setAttribute("has-no-options","")),this.baseElement.renderer=(t,e,o)=>{t.innerHTML=o.item.outerHTML}}#i(){const t=this.baseElement.shadowRoot.querySelector("vaadin-multi-select-combo-box-internal").shadowRoot.querySelector("vaadin-multi-select-combo-box-overlay");t._attachOverlay=()=>{t.bringToFront()},t._detachOverlay=()=>{},t._enterModalState=()=>{}}#a(){this.allowCustomValues&&this.baseElement.addEventListener("custom-value-set",(t=>{const e=this.#t({label:t.detail,displayName:t.detail,value:t.detail});this.innerHTML+=e,this.baseElement._lastFilter="",setTimeout((()=>{this.value=[...this.value,t.detail]}),0)}))}setGetValidity(){this.getValidity=function(){if(this.pattern){const t=new RegExp(this.pattern);if(this.value.some((e=>!t.test(e))))return{patternMismatch:!0}}return this.isRequired&&!this.value.length?{valueMissing:!0}:this.isRequired&&this.minItemsSelection&&this.value.length<this.minItemsSelection?{rangeUnderflow:!0}:this.maxItemsSelection&&this.value.length>this.maxItemsSelection?{rangeOverflow:!0}:{}};const t=this;this.baseElement.checkValidity=()=>t.validity.valid}init(){super.init?.(),this.setGetValidity(),this.setComboBoxDescriptor(),this.#i(),this.#a(),this.renderItems(),(0,n.mx)(this,this.renderItems.bind(this),{includeAttrs:["data"]}),(0,n.Ge)(this,this.#n.bind(this)),(0,n.EA)(this,this.baseElement,{includeAttrs:["placeholder"]}),this.setDefaultValues(),this.baseElement.addEventListener("selected-items-changed",(()=>{this.#l(),this.dispatchEvent(new CustomEvent("input",{bubbles:!0}))}))}setDefaultValues(){this.defaultValues.length>0&&(this.value=this.defaultValues)}#l(){this.#o=this.baseElement.selectedItems?.map((t=>t.getAttribute("data-id")))||[]}set value(t){if(t&&t.length>0){const e=this.baseElement.items?.filter((e=>t.includes(e["data-id"])));if(this.allowCustomValues){const o=e?.map((t=>t.getAttribute("data-id")))||[],r=t.filter((t=>!o.includes(t)));if(r.length){const e=r.reduce(((t,e)=>t+this.#t({label:e,displayName:e,value:e})),"");return this.innerHTML+=e,void setTimeout((()=>{this.value=t}),0)}}const o=e?.map((t=>t.getAttribute("data-id")))||[];(0,r.AG)(this.#o,o)||(this.baseElement.selectedItems=e)}else this.baseElement.selectedItems=[]}get value(){return this.#o}attributeChangedCallback(t,e,o){super.attributeChangedCallback?.(t,e,o),"readonly"===t&&this.onReadOnlyChange(null!==o&&"true"===o)}onReadOnlyChange(t){t?this.baseElement?.shadowRoot?.querySelector("vaadin-multi-select-combo-box-internal")?.setAttribute("inert",t):this.baseElement?.shadowRoot?.querySelector("vaadin-multi-select-combo-box-internal")?.removeAttribute("inert")}}))((0,a.tz)({slots:["","prefix"],wrappedEleName:"vaadin-multi-select-combo-box",style:()=>`\n\t\t:host {\n\t\t\tdisplay: inline-flex;\n\t\t\tbox-sizing: border-box;\n\t\t\t-webkit-mask-image: none;\n\t\t}\n\t\t${(0,i.cy)(I.cssVarList)}\n\t\t${(0,i.fu)("vaadin-multi-select-combo-box")}\n\t\t${(0,i.lS)("vaadin-multi-select-combo-box")}\n\t\t${(0,i.I4)("vaadin-multi-select-combo-box")}\n\n\t\tvaadin-multi-select-combo-box {\n\t\t\tpadding: 0;\n\t\t\twidth: 100%;\n\t\t}\n\t\tvaadin-multi-select-combo-box::before {\n\t\t\theight: initial;\n\t\t}\n\t\tvaadin-multi-select-combo-box [slot="input"] {\n\t\t\t-webkit-mask-image: none;\n\t\t\tmin-height: 0;\n align-self: center;\n\t\t\tbox-sizing: border-box;\n\t\t}\n\t\tvaadin-multi-select-combo-box[readonly] [slot="input"] {\n flex-grow: 1;\n flex-basis: 4em;\n\t\t}\n\n\t\t::part(input-field) {\n padding: 0;\n\t\t\tbox-shadow: none;\n\t\t}\n ${(0,i.$J)("vaadin-multi-select-combo-box")}\n :host([has-label]) vaadin-multi-select-combo-box-chip::part(label) {\n display: block;\n }\n\n vaadin-multi-select-combo-box vaadin-multi-select-combo-box-chip[slot='overflow']::before,\n vaadin-multi-select-combo-box vaadin-multi-select-combo-box-chip[slot='overflow']::after {\n left: -4px;\n right: -4px;\n border-left-width: 0;\n border-inline-start-style: solid;\n border-inline-start-width: 2px;\n }\n vaadin-multi-select-combo-box vaadin-multi-select-combo-box-chip[slot='overflow']::after {\n left: -8px;\n right: -8px;\n }\n\n :host([has-no-options][allow-custom-value='true']) ::part(toggle-button) {\n display: none;\n }\n\n ${(0,i.Kl)()}\n\n vaadin-multi-select-combo-box::part(toggle-button),\n vaadin-multi-select-combo-box::part(clear-button) {\n align-self: center;\n }\n\n vaadin-multi-select-combo-box[label-type="floating"]:not([focused])[readonly] > input:placeholder-shown {\n opacity: 0;\n }\n vaadin-multi-select-combo-box[label-type="floating"]:not([focused])[disabled] > input:placeholder-shown {\n opacity: 0;\n }\n\n\t\t`,excludeAttrsSync:["tabindex","size","data","placeholder"],componentName:l,includeForwardProps:["items","renderer","selectedItems"]}));customElements.define(l,I)},73551:(t,e,o)=>{o.d(e,{$J:()=>u,I4:()=>a,Kl:()=>m,LJ:()=>c,Qv:()=>i,X6:()=>s,cy:()=>r,fu:()=>d,kG:()=>p,lS:()=>l,zm:()=>n});const r=t=>`\n :host {\n padding: calc(var(${t.inputOutlineWidth}) + var(${t.inputOutlineOffset}))\n }\n`,n=t=>`\n ${t} {\n margin: 0;\n padding: 0;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n }\n`,i=t=>`\n ${t}::part(input-field) {\n overflow: hidden;\n padding: 0;\n box-shadow: none;\n }\n`,a=t=>`\n ${t} > label,\n ${t}::part(label),\n ${t}::part(required-indicator) {\n cursor: pointer;\n }\n`,l=(t,e="input")=>`\n ${t}[disabled] > ${e}:placeholder-shown,\n\t${t}[readonly] > ${e}:placeholder-shown {\n\t\topacity: 1;\n\t}\n`,s=()=>"\n :host {\n --vaadin-field-default-width: auto;\n box-sizing: border-box;\n }\n",d=t=>`\n ${t}::part(input-field)::after {\n opacity: 0;\n }\n`,p=t=>`\n ${t}::part(input-field)::after {\n background: none;\n }\n`,c=(t,e)=>`\n ${n(t)}\n ${a(t)}\n ${l(t)}\n ${i(t)}\n ${((t,e)=>`\n ${t} input:-webkit-autofill,\n ${t} input:-webkit-autofill::first-line,\n ${t} input:-webkit-autofill:hover,\n ${t} input:-webkit-autofill:active,\n ${t} input:-webkit-autofill:focus {\n -webkit-text-fill-color: var(${e.inputValueTextColor});\n box-shadow: 0 0 0 var(${e.inputHeight}) var(${e.inputBackgroundColor}) inset;\n }\n`)(t,e)}\n ${p(t)}\n ${(t=>`\n ${t}::before {\n\t\theight: unset;\n\t}\n`)(t)}\n ${(t=>`\n ${t} > input {\n -webkit-mask-image: none;\n min-height: 0;\n box-sizing: border-box;\n }\n`)(t)}\n ${(t=>`\n ${t}::part(input-field)::after {\n border: none;\n }\n`)(t)}\n`,u=t=>`\n :host ::part(error-message) {\n direction: ltr;\n }\n :host([required]) ::part(required-indicator) {\n width: 1em;\n display: inline-flex;\n }\n :host([required]) ::part(required-indicator)::after {\n position: static;\n }\n :host([has-label]) ::part(label) {\n padding-right: 0;\n padding-bottom: 0;\n display: flex;\n width: 100%;\n }\n ${t} [slot="label"] {\n max-width: calc(100% - 1em);\n overflow: hidden;\n text-overflow: ellipsis;\n padding-bottom: 0.5em;\n }\n`,m=()=>'\n :host([label-type="floating"]) {\n position: relative;\n }\n :host([label-type="floating"][has-label]) > ::part(label) {\n z-index: 1;\n padding: 0;\n width: auto;\n }\n '}}]);
|
1
|
+
"use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[1331],{12848:(t,e,o)=>{o.r(e),o.d(e,{MultiSelectComboBoxClass:()=>I,componentName:()=>l}),o(51408);var r=o(9696),n=o(97810),i=o(73551),a=o(79365);const l=(0,n.xE)("multi-select-combo-box"),{host:s,inputField:d,inputElement:p,placeholder:c,toggle:u,clearButton:m,label:b,requiredIndicator:h,helperText:g,errorMessage:y,chip:v,chipLabel:f,overflowChipFirstBorder:x,overflowChipSecondBorder:w}={host:{selector:()=>":host"},inputField:{selector:"::part(input-field)"},inputElement:{selector:"input"},placeholder:{selector:"> input:placeholder-shown"},toggle:{selector:"::part(toggle-button)"},clearButton:{selector:"::part(clear-button)"},label:{selector:"::part(label)"},requiredIndicator:{selector:"[required]::part(required-indicator)::after"},helperText:{selector:"::part(helper-text)"},errorMessage:{selector:"::part(error-message)"},chip:{selector:"vaadin-multi-select-combo-box-chip"},chipLabel:{selector:"vaadin-multi-select-combo-box-chip::part(label)"},overflowChipFirstBorder:{selector:"vaadin-multi-select-combo-box-chip[slot='overflow']::before"},overflowChipSecondBorder:{selector:"vaadin-multi-select-combo-box-chip[slot='overflow']::after"}},I=(0,r.Zz)((0,a.RF)({mappings:{hostWidth:{...s,property:"width"},hostDirection:{...s,property:"direction"},fontSize:[{},s],chipFontSize:{...f,property:"font-size"},fontFamily:[b,c,d,g,y,f],labelFontSize:{...b,property:"font-size"},labelFontWeight:{...b,property:"font-weight"},labelTextColor:[{...b,property:"color"},{...h,property:"color"}],errorMessageTextColor:{...y,property:"color"},errorMessageIcon:{...y,property:"background-image"},errorMessageIconSize:{...y,property:"background-size"},errorMessageIconPadding:{...y,property:"padding-inline-start"},errorMessageIconRepeat:{...y,property:"background-repeat"},errorMessageIconPosition:{...y,property:"background-position"},errorMessageFontSize:{...y,property:"font-size"},inputHeight:{...d,property:"min-height"},inputBackgroundColor:{...d,property:"background-color"},inputBorderColor:{...d,property:"border-color"},inputBorderWidth:{...d,property:"border-width"},inputBorderStyle:{...d,property:"border-style"},inputBorderRadius:{...d,property:"border-radius"},labelRequiredIndicator:{...h,property:"content"},inputValueTextColor:{...d,property:"color"},inputPlaceholderTextColor:{...c,property:"color"},inputDropdownButtonCursor:[{...u,property:"cursor"},{...m,property:"cursor"}],inputDropdownButtonColor:[{...u,property:"color"},{...m,property:"color"}],inputDropdownButtonSize:[{...u,property:"font-size"},{...m,property:"font-size"}],inputDropdownButtonOffset:[{...u,property:"margin-right"},{...u,property:"margin-left"}],inputOutlineColor:{...d,property:"outline-color"},inputOutlineWidth:{...d,property:"outline-width"},inputOutlineStyle:{...d,property:"outline-style"},inputOutlineOffset:{...d,property:"outline-offset"},inputHorizontalPadding:[{...p,property:"padding-left"},{...p,property:"padding-right"},{...d,property:"padding-inline-start"}],inputVerticalPadding:[{...d,property:"padding-top"},{...d,property:"padding-bottom"}],chipTextColor:{...f,property:"color"},chipBackgroundColor:[{...v,property:"background-color"},{...x,property:"border-color"},{...w,property:"border-color"}],labelPosition:{...b,property:"position"},labelTopPosition:{...b,property:"top"},labelLeftPosition:{...b,property:"left"},labelHorizontalPosition:[{...b,property:"left"},{...b,property:"right"}],inputTransformY:{...b,property:"transform"},inputTransition:{...b,property:"transition"},marginInlineStart:{...b,property:"margin-inline-start"},placeholderOpacity:{...c,property:"opacity"},inputVerticalAlignment:{...d,property:"align-items"},overlayBackground:{property:()=>I.cssVarList.overlay.backgroundColor},overlayTextColor:{property:()=>I.cssVarList.overlay.textColor},overlayBorder:{property:()=>I.cssVarList.overlay.border},overlayFontSize:{property:()=>I.cssVarList.overlay.fontSize},overlayFontFamily:{property:()=>I.cssVarList.overlay.fontFamily},overlayCursor:{property:()=>I.cssVarList.overlay.cursor},overlayItemBoxShadow:{property:()=>I.cssVarList.overlay.itemBoxShadow},overlayItemPaddingInlineStart:{property:()=>I.cssVarList.overlay.itemPaddingInlineStart},overlayItemPaddingInlineEnd:{property:()=>I.cssVarList.overlay.itemPaddingInlineEnd}}}),a.VO,(0,a.mA)({name:"overlay",selector:"vaadin-multi-select-combo-box-internal",mappings:{backgroundColor:{selector:"vaadin-multi-select-combo-box-scroller"},minHeight:{selector:"vaadin-multi-select-combo-box-overlay"},margin:{selector:"vaadin-multi-select-combo-box-overlay"},cursor:{selector:"vaadin-multi-select-combo-box-item"},fontFamily:{selector:"vaadin-multi-select-combo-box-item"},textColor:{selector:"vaadin-multi-select-combo-box-item",property:"color"},fontSize:{selector:"vaadin-multi-select-combo-box-item"},itemBoxShadow:{selector:"vaadin-multi-select-combo-box-item",property:"box-shadow"},itemPaddingInlineStart:{selector:"vaadin-multi-select-combo-box-item",property:"padding-inline-start"},itemPaddingInlineEnd:{selector:"vaadin-multi-select-combo-box-item",property:"padding-inline-end"}},forward:{include:!1,attributes:["size"]}}),(0,a.OZ)({proxyProps:["selectionStart"],inputEvent:"selected-items-changed"}),a._$,a.tQ,(t=>class extends t{static get observedAttributes(){return["readonly"]}#t=({displayName:t,value:e,label:o})=>{const r=document.createElement("span");return r.setAttribute("data-name",o),r.setAttribute("data-id",e),r.textContent=t||o,r.outerHTML};#e;#o=[];get defaultValues(){const t=this.getAttribute("default-values");if(t)try{const e=JSON.parse(t);if(this.isValidDataType(e))return e}catch(t){console.error('could not parse data string from attribute "default-values" -',t.message)}return[]}get renderItem(){return this.#t}set renderItem(t){this.#t=t,this.renderItems()}get data(){if(this.#e)return this.#e;const t=this.getAttribute("data");if(t)try{const e=JSON.parse(t);if(this.isValidDataType(e))return e}catch(t){console.error('could not parse data string from attribute "data" -',t.message)}return[]}set data(t){this.isValidDataType(t)&&(this.#e=t,this.renderItems())}get allowCustomValues(){return"true"===this.getAttribute("allow-custom-value")}get minItemsSelection(){return parseInt(this.getAttribute("min-items-selection"),10)||0}get maxItemsSelection(){return parseInt(this.getAttribute("max-items-selection"),10)||0}isValidDataType(t){const e=Array.isArray(t);return e||console.error("data and default-values must be an array, received:",t),e}getItemsTemplate(){return this.data?.reduce?.(((t,e)=>t+(this.renderItem?.(e||{})||"")),"")}renderItems(){const t=this.getItemsTemplate();t&&(this.innerHTML=t)}updateSelectedItems(){const t=this.baseElement.selectedItems?.map((t=>t.getAttribute("data-id")))||[];t.length>0&&(this.value=t),0===this.value.length&&this.setDefaultValues()}customValueTransformFn(t){return t}setComboBoxDescriptor(){const t=Object.getOwnPropertyDescriptor(this.inputElement.constructor.prototype,"value"),e=this;Object.defineProperties(this.inputElement,{value:{...t,set(o){const r=e.customValueTransformFn(o)||"";r!==this.value&&t.set.call(this,r)}}})}#r(t){return Array.from(new Map(t.map((t=>[t.getAttribute("data-id"),t]))).values())}#n(){const t=Array.from(this.children),e=this.#r(t);t.length?(this.removeAttribute("has-no-options"),e.forEach((t=>{Object.defineProperty(t,"data-name",{value:t.getAttribute("data-name"),configurable:!0,writable:!0}),Object.defineProperty(t,"data-id",{value:t.getAttribute("data-id"),configurable:!0,writable:!0})})),this.baseElement.items=e,setTimeout((()=>{this.updateSelectedItems()}),0)):(this.baseElement.items=[],this.setAttribute("has-no-options","")),this.baseElement.renderer=(t,e,o)=>{t.innerHTML=o.item.outerHTML}}#i(){const t=this.baseElement.shadowRoot.querySelector("vaadin-multi-select-combo-box-internal").shadowRoot.querySelector("vaadin-multi-select-combo-box-overlay");t._attachOverlay=()=>{t.bringToFront()},t._detachOverlay=()=>{},t._enterModalState=()=>{}}#a(){this.allowCustomValues&&this.baseElement.addEventListener("custom-value-set",(t=>{const e=this.#t({label:t.detail,displayName:t.detail,value:t.detail});this.innerHTML+=e,this.baseElement._lastFilter="",setTimeout((()=>{this.value=[...this.value,t.detail]}),0)}))}setGetValidity(){this.getValidity=function(){if(this.pattern){const t=new RegExp(this.pattern);if(this.value.some((e=>!t.test(e))))return{patternMismatch:!0}}return this.isRequired&&!this.value.length?{valueMissing:!0}:this.isRequired&&this.minItemsSelection&&this.value.length<this.minItemsSelection?{rangeUnderflow:!0}:this.maxItemsSelection&&this.value.length>this.maxItemsSelection?{rangeOverflow:!0}:{}};const t=this;this.baseElement.checkValidity=()=>t.validity.valid}init(){super.init?.(),this.setGetValidity(),this.#a(),this.renderItems(),(0,n.mx)(this,this.renderItems.bind(this),{includeAttrs:["data"]}),(0,n.Ge)(this,this.#n.bind(this)),(0,n.EA)(this,this.baseElement,{includeAttrs:["placeholder"]}),setTimeout((()=>{this.setComboBoxDescriptor(),this.#i()})),this.setDefaultValues(),this.baseElement.addEventListener("selected-items-changed",(()=>{this.#l(),this.dispatchEvent(new CustomEvent("input",{bubbles:!0}))}))}setDefaultValues(){this.defaultValues.length>0&&(this.value=this.defaultValues)}#l(){this.#o=this.baseElement.selectedItems?.map((t=>t.getAttribute("data-id")))||[]}set value(t){if(t&&t.length>0){const e=this.baseElement.items?.filter((e=>t.includes(e["data-id"])));if(this.allowCustomValues){const o=e?.map((t=>t.getAttribute("data-id")))||[],r=t.filter((t=>!o.includes(t)));if(r.length){const e=r.reduce(((t,e)=>t+this.#t({label:e,displayName:e,value:e})),"");return this.innerHTML+=e,void setTimeout((()=>{this.value=t}),0)}}const o=e?.map((t=>t.getAttribute("data-id")))||[];(0,r.AG)(this.#o,o)||(this.baseElement.selectedItems=e)}else this.baseElement.selectedItems=[]}get value(){return this.#o}attributeChangedCallback(t,e,o){super.attributeChangedCallback?.(t,e,o),"readonly"===t&&this.onReadOnlyChange(null!==o&&"true"===o)}onReadOnlyChange(t){t?this.baseElement?.shadowRoot?.querySelector("vaadin-multi-select-combo-box-internal")?.setAttribute("inert",t):this.baseElement?.shadowRoot?.querySelector("vaadin-multi-select-combo-box-internal")?.removeAttribute("inert")}}))((0,a.tz)({slots:["","prefix"],wrappedEleName:"vaadin-multi-select-combo-box",style:()=>`\n\t\t:host {\n\t\t\tdisplay: inline-flex;\n\t\t\tbox-sizing: border-box;\n\t\t\t-webkit-mask-image: none;\n\t\t}\n\t\t${(0,i.cy)(I.cssVarList)}\n\t\t${(0,i.fu)("vaadin-multi-select-combo-box")}\n\t\t${(0,i.lS)("vaadin-multi-select-combo-box")}\n\t\t${(0,i.I4)("vaadin-multi-select-combo-box")}\n\n\t\tvaadin-multi-select-combo-box {\n\t\t\tpadding: 0;\n\t\t\twidth: 100%;\n\t\t}\n\t\tvaadin-multi-select-combo-box::before {\n\t\t\theight: initial;\n\t\t}\n\t\tvaadin-multi-select-combo-box [slot="input"] {\n\t\t\t-webkit-mask-image: none;\n\t\t\tmin-height: 0;\n align-self: center;\n\t\t\tbox-sizing: border-box;\n\t\t}\n\t\tvaadin-multi-select-combo-box[readonly] [slot="input"] {\n flex-grow: 1;\n flex-basis: 4em;\n\t\t}\n\n\t\t::part(input-field) {\n padding: 0;\n\t\t\tbox-shadow: none;\n\t\t}\n ${(0,i.$J)("vaadin-multi-select-combo-box")}\n :host([has-label]) vaadin-multi-select-combo-box-chip::part(label) {\n display: block;\n }\n\n vaadin-multi-select-combo-box vaadin-multi-select-combo-box-chip[slot='overflow']::before,\n vaadin-multi-select-combo-box vaadin-multi-select-combo-box-chip[slot='overflow']::after {\n left: -4px;\n right: -4px;\n border-left-width: 0;\n border-inline-start-style: solid;\n border-inline-start-width: 2px;\n }\n vaadin-multi-select-combo-box vaadin-multi-select-combo-box-chip[slot='overflow']::after {\n left: -8px;\n right: -8px;\n }\n\n :host([has-no-options][allow-custom-value='true']) ::part(toggle-button) {\n display: none;\n }\n\n ${(0,i.Kl)()}\n\n vaadin-multi-select-combo-box::part(toggle-button),\n vaadin-multi-select-combo-box::part(clear-button) {\n align-self: center;\n }\n\n vaadin-multi-select-combo-box[label-type="floating"]:not([focused])[readonly] > input:placeholder-shown {\n opacity: 0;\n }\n vaadin-multi-select-combo-box[label-type="floating"]:not([focused])[disabled] > input:placeholder-shown {\n opacity: 0;\n }\n\n\t\t`,excludeAttrsSync:["tabindex","size","data","placeholder"],componentName:l,includeForwardProps:["items","renderer","selectedItems"]}));customElements.define(l,I)},73551:(t,e,o)=>{o.d(e,{$J:()=>u,I4:()=>a,Kl:()=>m,LJ:()=>c,Qv:()=>i,X6:()=>s,cy:()=>r,fu:()=>d,kG:()=>p,lS:()=>l,zm:()=>n});const r=t=>`\n :host {\n padding: calc(var(${t.inputOutlineWidth}) + var(${t.inputOutlineOffset}))\n }\n`,n=t=>`\n ${t} {\n margin: 0;\n padding: 0;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n }\n`,i=t=>`\n ${t}::part(input-field) {\n overflow: hidden;\n padding: 0;\n box-shadow: none;\n }\n`,a=t=>`\n ${t} > label,\n ${t}::part(label),\n ${t}::part(required-indicator) {\n cursor: pointer;\n }\n`,l=(t,e="input")=>`\n ${t}[disabled] > ${e}:placeholder-shown,\n\t${t}[readonly] > ${e}:placeholder-shown {\n\t\topacity: 1;\n\t}\n`,s=()=>"\n :host {\n --vaadin-field-default-width: auto;\n box-sizing: border-box;\n }\n",d=t=>`\n ${t}::part(input-field)::after {\n opacity: 0;\n }\n`,p=t=>`\n ${t}::part(input-field)::after {\n background: none;\n }\n`,c=(t,e)=>`\n ${n(t)}\n ${a(t)}\n ${l(t)}\n ${i(t)}\n ${((t,e)=>`\n ${t} input:-webkit-autofill,\n ${t} input:-webkit-autofill::first-line,\n ${t} input:-webkit-autofill:hover,\n ${t} input:-webkit-autofill:active,\n ${t} input:-webkit-autofill:focus {\n -webkit-text-fill-color: var(${e.inputValueTextColor});\n box-shadow: 0 0 0 var(${e.inputHeight}) var(${e.inputBackgroundColor}) inset;\n }\n`)(t,e)}\n ${p(t)}\n ${(t=>`\n ${t}::before {\n\t\theight: unset;\n\t}\n`)(t)}\n ${(t=>`\n ${t} > input {\n -webkit-mask-image: none;\n min-height: 0;\n box-sizing: border-box;\n }\n`)(t)}\n ${(t=>`\n ${t}::part(input-field)::after {\n border: none;\n }\n`)(t)}\n`,u=t=>`\n :host ::part(error-message) {\n direction: ltr;\n }\n :host([required]) ::part(required-indicator) {\n width: 1em;\n display: inline-flex;\n }\n :host([required]) ::part(required-indicator)::after {\n position: static;\n }\n :host([has-label]) ::part(label) {\n padding-right: 0;\n padding-bottom: 0;\n display: flex;\n width: 100%;\n }\n ${t} [slot="label"] {\n max-width: calc(100% - 1em);\n overflow: hidden;\n text-overflow: ellipsis;\n padding-bottom: 0.5em;\n }\n`,m=()=>'\n :host([label-type="floating"]) {\n position: relative;\n }\n :host([label-type="floating"][has-label]) > ::part(label) {\n z-index: 1;\n padding: 0;\n width: auto;\n }\n '}}]);
|
2
2
|
//# sourceMappingURL=descope-multi-select-combo-box-index-js.js.map
|