diff --git a/index.bundle.js b/index.bundle.js index 7629ef6..a096597 100644 --- a/index.bundle.js +++ b/index.bundle.js @@ -1,7 +1,7 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.elsciUi=e():t.elsciUi=e()}(self,(()=>(()=>{"use strict";var t={d:(e,i)=>{for(var s in i)t.o(i,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:i[s]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{EditText:()=>u,SelectInput:()=>o,TextInput:()=>a,TypeAheadInput:()=>h});class i{#t;#e;#i;#s;constructor(t){this.#t=t,this.#e=t.querySelector("input"),this.#i=!0,this.#s=""}get isValid(){return this.#i}get errorMessage(){return this.#s}checkValidity(){this.setCustomValidity(""),this.#e.checkValidity();let t=this.#e.validity;return t.valid&&(t=this.#n()),this.#i=t.valid,this.#s=this.#l(t),this.isValid}setCustomValidity(t){this.#e.setCustomValidity(t),this.#i=this.#e.validity.valid,this.#s=t}#n(){const{badInput:t,customError:e,patternMismatch:i,typeMismatch:s,valid:n,rangeOverflow:l,rangeUnderflow:a,tooLong:r,tooShort:h,valueMissing:o,stepMismatch:u}=this.#e.validity,d=Object.assign({},{badInput:t,customError:e,patternMismatch:i,typeMismatch:s,valid:n,rangeOverflow:l,rangeUnderflow:a,tooLong:r,tooShort:h,valueMissing:o,stepMismatch:u},this.#a(),this.#r(),this.#h());return d.valid=!(d.valueMissing||d.rangeUnderflow||d.rangeOverflow||d.stepMismatch),d}#a(){const t=this.#e.value.trim();return{valueMissing:this.#t.hasAttribute("required")&&""===t}}#r(){if("number"!==this.#e.type)return{rangeUnderflow:!1,rangeOverflow:!1};const{min:t,max:e,value:i}=this.#e;return{rangeUnderflow:""!==t&&+i<+t,rangeOverflow:""!==e&&+i>+e}}#h(){if("number"!==this.#e.type)return{stepMismatch:!1};const t=this.#t.getAttribute("number-type");return t&&"integer"===t?{stepMismatch:!Number.isInteger(this.#e.valueAsNumber)}:{stepMismatch:!1}}#l(t){const e="number"===this.#e.type,{badInput:i,rangeOverflow:s,rangeUnderflow:n,tooLong:l,tooShort:a,valueMissing:r,stepMismatch:h}=t;if(e&&i)return"Invalid number";if(e&&h){if("1"===this.#e.step)return"Must be an integer";const t=this.#t.getAttribute("number-type");if(t&&"integer"===t)return"Must be an integer"}return s?"Greater than "+this.#e.max:n?"Less than "+this.#e.min:l?"Max length is "+this.#e.maxLength:a?"Min length is "+this.#e.minLength:!i&&r?"Required":this.#e.validationMessage}}const s=Object.freeze({Shift:"ShiftLeft",Esc:"Escape",Enter:"Enter",Up:"ArrowUp",Down:"ArrowDown"}),n=(t,...e)=>{let i=t[0];for(let n=0;n/g,">").replace(/"/g,""").replace(/'/g,"'"):"",i+=t[n+1];var s;return i};function l(t){const e=document.createElement("span");document.body.appendChild(e),e.textContent=t,e.style.fontSize="1rem",e.style.visibility="hidden",e.style.position="absolute";const i=Math.ceil(e.getBoundingClientRect().width)+1;return e.remove(),i}class a extends HTMLElement{static#o=new Set(["autocomplete","autofocus","disabled","max","maxlength","min","minlength","name","pattern","readonly","step","type","value","placeholder"]);#e;#u;#d;#p={onTrailingIconClick:[],onChangeValue:[],onInput:[]};#c;#m=[];connectedCallback(){this.innerHTML=this.#g(),this.#e=this.querySelector("input"),this.#u=this.querySelector(".text-input__error"),this.#d=new i(this),this.#b(),this.#E(),this.hasAttribute("value")&&(this.value=this.getAttribute("value"))}disconnectedCallback(){this.setAttribute("value",this.value),window.removeEventListener("visibilitychange",this.#v.bind(this),{capture:!0})}addValidator(t){this.#m.push(t)}get value(){return this.rawValue.trim()}get rawValue(){return this.#e.value}set value(t){this.#e.value=function(t){return!(void 0===t||!Number.isFinite(t))}(t)||"string"==typeof t?t:"",this.#c=this.#e.value,this.checkValidity()}checkValidity(){if(!this.#d.checkValidity())return this.errorMessage=this.#d.errorMessage,!1;this.errorMessage=this.#d.errorMessage;for(const t of this.#m){const e=t.validate(this,this.value);if(!e.isValid)return this.errorMessage=e.errorMessage,this.focus(),!1}return!0}get errorMessage(){return this.#u.textContent}set errorMessage(t){t&&(this.#c=null),this.#d.setCustomValidity(t),this.#u.textContent=this.#d.errorMessage}onTrailingIconClick(t){this.#p.onTrailingIconClick.push(t)}onInput(t){this.#p.onInput.push(t)}onChangeValue(t){this.#p.onChangeValue.push(t)}focus(t){this.#e.focus(t)}setDisabled(t){this.toggleAttribute("disabled",t),this.#e.toggleAttribute("disabled",t)}#w(t){"number"!==this.#e.type||t.key!==s.Up&&t.key!==s.Down||t.preventDefault(),t.key!==s.Enter||t.repeat||this.#y()}#f(){const t=this.checkValidity();this.#p.onInput.forEach((e=>e(this.value,t)))}#y(){this.#c!==this.value&&this.#V()}#x(){this.#p.onTrailingIconClick.forEach((t=>t()))}#V(){this.checkValidity()&&(this.#c=this.value,this.#p.onChangeValue.forEach((t=>t(this.value))))}#b(){for(const t of this.attributes)a.#o.has(t.name)&&this.#e.setAttribute(t.name,t.value);"number"!==this.getAttribute("type")||this.hasAttribute("step")||this.#e.setAttribute("step","any"),this.hasAttribute("placeholder")&&this.classList.add("placeholder-shown")}#E(){this.#e.addEventListener("keydown",this.#w.bind(this)),this.#e.addEventListener("input",this.#f.bind(this)),this.#e.addEventListener("focusout",this.#y.bind(this)),this.querySelector(".text-input__trailing-icon").addEventListener("click",this.#x.bind(this)),window.addEventListener("visibilitychange",this.#v.bind(this),{capture:!0})}#v(){document.activeElement===this.#e&&this.#e.blur()}#g(){const t=this.getAttribute("data-icon")||"";return n` +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.elsciUi=e():t.elsciUi=e()}(self,(()=>(()=>{"use strict";var t={d:(e,i)=>{for(var s in i)t.o(i,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:i[s]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{EditText:()=>d,SelectInput:()=>u,TextInput:()=>r,TypeAheadInput:()=>o});class i{#t;#e;#i;#s;constructor(t){this.#t=t,this.#e=t.querySelector("input"),this.#i=!0,this.#s=""}get isValid(){return this.#i}get errorMessage(){return this.#s}checkValidity(){this.setCustomValidity(""),this.#e.checkValidity();let t=this.#e.validity;return t.valid&&(t=this.#n()),this.#i=t.valid,this.#s=this.#l(t),this.isValid}setCustomValidity(t){this.#e.setCustomValidity(t),this.#i=this.#e.validity.valid,this.#s=t}#n(){const{badInput:t,customError:e,patternMismatch:i,typeMismatch:s,valid:n,rangeOverflow:l,rangeUnderflow:a,tooLong:r,tooShort:h,valueMissing:o,stepMismatch:u}=this.#e.validity,d=Object.assign({},{badInput:t,customError:e,patternMismatch:i,typeMismatch:s,valid:n,rangeOverflow:l,rangeUnderflow:a,tooLong:r,tooShort:h,valueMissing:o,stepMismatch:u},this.#a(),this.#r(),this.#h());return d.valid=!(d.valueMissing||d.rangeUnderflow||d.rangeOverflow||d.stepMismatch),d}#a(){const t=this.#e.value.trim();return{valueMissing:this.#t.hasAttribute("required")&&""===t}}#r(){if("number"!==this.#e.type)return{rangeUnderflow:!1,rangeOverflow:!1};const{min:t,max:e,value:i}=this.#e;return{rangeUnderflow:""!==t&&+i<+t,rangeOverflow:""!==e&&+i>+e}}#h(){if("number"!==this.#e.type)return{stepMismatch:!1};const t=this.#t.getAttribute("number-type");return t&&"integer"===t?{stepMismatch:!Number.isInteger(this.#e.valueAsNumber)}:{stepMismatch:!1}}#l(t){const e="number"===this.#e.type,{badInput:i,rangeOverflow:s,rangeUnderflow:n,tooLong:l,tooShort:a,valueMissing:r,stepMismatch:h}=t;if(e&&i)return"Invalid number";if(e&&h){if("1"===this.#e.step)return"Must be an integer";const t=this.#t.getAttribute("number-type");if(t&&"integer"===t)return"Must be an integer"}return s?"Greater than "+this.#e.max:n?"Less than "+this.#e.min:l?"Max length is "+this.#e.maxLength:a?"Min length is "+this.#e.minLength:!i&&r?"Required":this.#e.validationMessage}}const s=Object.freeze({Shift:"ShiftLeft",Esc:"Escape",Enter:"Enter",Up:"ArrowUp",Down:"ArrowDown"}),n=t=>t?t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"):"",l=(t,...e)=>{let i=t[0];for(let s=0;se(this.value,t)))}#y(){this.#c!==this.value&&this.#V()}#x(){this.#p.onTrailingIconClick.forEach((t=>t()))}#V(){this.checkValidity()&&(this.#c=this.value,this.#p.onChangeValue.forEach((t=>t(this.value))))}#b(){for(const t of this.attributes)r.#o.has(t.name)&&this.#e.setAttribute(t.name,t.value);"number"!==this.getAttribute("type")||this.hasAttribute("step")||this.#e.setAttribute("step","any"),this.hasAttribute("placeholder")&&this.classList.add("placeholder-shown")}#E(){this.#e.addEventListener("keydown",this.#w.bind(this)),this.#e.addEventListener("input",this.#f.bind(this)),this.#e.addEventListener("focusout",this.#y.bind(this)),this.querySelector(".text-input__trailing-icon").addEventListener("click",this.#x.bind(this)),window.addEventListener("visibilitychange",this.#v.bind(this),{capture:!0})}#v(){document.activeElement===this.#e&&this.#e.blur()}#g(){const t=this.getAttribute("data-icon")||"";return l` ${t} -

`}static get is(){return"text-input"}}window.customElements.get(a.is)||window.customElements.define(a.is,a);class r extends HTMLElement{#A;#C=[];#k=0;#S=-1;#M=(t,e)=>t.displayName.localeCompare(e.displayName);#p={onOptionClick:[]};#I;get options(){return this.#C}set options(t){this.#T(t),this.innerHTML=this.#g(),this.#A=this.querySelector("ul"),this.#L(),this.#E()}set comparator(t){this.#M=t}set filter(t){const e=t.toLowerCase();for(const t of this.querySelectorAll("li")){const{displayName:i}=this.#C[t.dataset.index],s=i.toLowerCase().indexOf(e);t.innerHTML=this.#D(i,s,e.length),t.toggleAttribute("hidden",-1===s)}const i=this.#O();i&&(i.hasAttribute("hidden")?this.#$():i.scrollIntoView({block:"nearest"}))}show(){document.addEventListener("wheel",this.#I,{capture:!0,passive:!1}),this.toggleAttribute("open",!0),this.#L()}hide(){document.removeEventListener("wheel",this.#I,{capture:!0,passive:!1}),this.toggleAttribute("open",!1),this.#$()}selectNextItem(){const t=this.#N();if(this.hasSelectedElement()){const e=t.indexOf(this.#O());if(t.length-1<=e)return;this.#q(t[e+1].dataset.index)}else{if(0===t.length)return;this.#q(t[0].dataset.index)}}selectPrevItem(){const t=this.#N();if(this.hasSelectedElement()){const e=t.indexOf(this.#O());if(0===e)return;this.#q(t[e-1].dataset.index)}else{if(0===t.length)return;this.#q(t[t.length-1].dataset.index)}}triggerClickOnSelectedItem(){this.hasSelectedElement()&&this.#O().dispatchEvent(new MouseEvent("mousedown"))}hasSelectedElement(){return null!=this.#O()}isVisible(){return this.hasAttribute("open")}onOptionClick(t){this.#p.onOptionClick.push(t)}connectedCallback(){this.innerHTML=this.#g(),this.#A=this.querySelector("ul"),this.#E(),this.#I=t=>{if(this.contains(t.target)){const e=t.deltaY<0,i=t.deltaY>0,s=0===this.#A.scrollTop,n=this.#A.scrollTop+this.#A.clientHeight>=this.#A.scrollHeight;(e&s||i&n)&&(t.stopPropagation(),t.preventDefault())}else t.stopPropagation(),t.preventDefault()}}#T(t){"function"==typeof this.#M?this.#C=[...t].sort(this.#M):this.#C=t}#N(){return[...this.#A.querySelectorAll("li:not([hidden])")]}#E(){this.#A.addEventListener("mousedown",(t=>{t.preventDefault()}));for(const t of this.querySelectorAll("li"))t.addEventListener("mousedown",(()=>{const e=this.#C[t.dataset.index];this.#p.onOptionClick.forEach((t=>t(e)))}))}#g(){return`\n `}#L(){const t=this.parentElement.getBoundingClientRect();0===this.#k&&(this.#k=Math.max(...this.#C.map((t=>l(t.displayName))),0));const e=Math.max(this.#k+24+22,t.width),i=document.documentElement.clientWidth-t.left;this.#A.style.right=e>i?0:null,this.#A.style.width=`${Math.min(e,document.documentElement.clientWidth)}px`,this.style.width=`${Math.min(e,document.documentElement.clientWidth)}px`,this.style.top=`${t.top}px`}#O(){return this.querySelector(`li[data-index="${this.#S}"]`)}#q(t){this.#$(),this.#S=t;const e=this.#O();e.classList.add("list-box__item--active"),e.scrollIntoView({block:"nearest"})}#$(){this.#S>=0&&(this.#O().classList.remove("list-box__item--active"),this.#S=-1)}#D(t,e,i){if(e>=0){const s=t.substring(0,e),l=t.substring(e,e+i),a=t.substring(e+i);return n`${s}${l}${a}`}return t}static get is(){return"list-box"}}window.customElements.get(r.is)||window.customElements.define(r.is,r);class h extends HTMLElement{#e;#_;#P;#U=null;#H;#p={onChangeValue:[]};connectedCallback(){this.innerHTML=this.#g(),this.#e=this.querySelector("text-input"),this.#_=this.querySelector("list-box"),this.#H=this.hasAttribute("shouldMatchOptions"),this.#E()}get value(){return this.#P}get rawValue(){return this.#e.value}set value(t){this.#P=t,this.#e.value=t&&t.displayName?t.displayName:""}set initialValue(t){this.value=t,this.#U=t}set options(t){this.#_.options=t,this.#j()}set errorMessage(t){this.#e.errorMessage=t}checkValidity(){return this.#R()&&this.#e.checkValidity()}onChangeValue(t){this.#p.onChangeValue.push(t)}setDisabled(t){this.toggleAttribute("disabled",t),this.#e.setDisabled(t)}#f(){this.errorMessage="",this.#j(),this.#_.isVisible()||this.#_.show()}#B(){this.#j(),this.#_.show()}#F(){this.#K()}#W(t){this.value=t,this.#K()}#z(){this.value={displayName:""},this.#e.querySelector("input").focus()}#Y(t){switch([s.Up,s.Down].includes(t.code)&&(t.preventDefault(),t.stopImmediatePropagation()),t.key){case s.Esc:this.#K();break;case s.Enter:this.#_.isVisible()&&(this.#_.hasSelectedElement()?this.#_.triggerClickOnSelectedItem():this.#K());break;case s.Down:this.#_.isVisible()||this.#_.show(),this.#_.selectNextItem();break;case s.Up:this.#_.isVisible()||this.#_.show(),this.#_.selectPrevItem()}}#G(){this.#V()}#K(){this.#_.hide(),this.#V()}#V(){this.#R()&&this.#X()&&(this.#U=this.value,this.#p.onChangeValue.forEach((t=>t(this.value))))}#R(){const t=this.#e.value;if(""===t)return this.#P=null,!0;if(this.value&&this.value.displayName===t)return this.errorMessage="",!0;if(!this.#H)return this.errorMessage="",this.#P={displayName:t},!0;for(const e of this.#_.options)if(e.displayName===t)return this.errorMessage="",this.#P=e,this.#e.value=e.displayName,!0;return this.#P=null,this.errorMessage="Select from list",!1}#j(){this.hasAttribute("nofiltering")||(this.#_.filter=this.#e.value)}#X(){return this.#U!==this.value}#E(){const t=this.#e.querySelector("input");this.addEventListener("keydown",this.#Y.bind(this)),this.addEventListener("keyup",(t=>{t.stopPropagation()})),t.addEventListener("input",this.#f.bind(this)),t.addEventListener("blur",this.#F.bind(this)),t.addEventListener("focus",this.#B.bind(this)),this.#e.onTrailingIconClick(this.#z.bind(this)),this.#e.onChangeValue(this.#G.bind(this)),this.#_.onOptionClick(this.#W.bind(this))}#g(){const t=this.hasAttribute("required")?"required":"",e=this.hasAttribute("disabled")?"disabled":"",i=this.hasAttribute("no-icon")?"":"close";return n` +

`}static get is(){return"text-input"}}window.customElements.get(r.is)||window.customElements.define(r.is,r);class h extends HTMLElement{#A;#C=[];#k=0;#S=-1;#M=(t,e)=>t.displayName.localeCompare(e.displayName);#p={onOptionClick:[]};#I;get options(){return this.#C}set options(t){this.#T(t),this.innerHTML=this.#g(),this.#A=this.querySelector("ul"),this.#L(),this.#E()}set comparator(t){this.#M=t}set filter(t){const e=t.toLowerCase();for(const t of this.querySelectorAll("li")){const{displayName:i}=this.#C[t.dataset.index],s=i.toLowerCase().indexOf(e);t.innerHTML=this.#D(i,s,e.length),t.toggleAttribute("hidden",-1===s)}const i=this.#O();i&&(i.hasAttribute("hidden")?this.#$():i.scrollIntoView({block:"nearest"}))}show(){document.addEventListener("wheel",this.#I,{capture:!0,passive:!1}),this.toggleAttribute("open",!0),this.#L()}hide(){document.removeEventListener("wheel",this.#I,{capture:!0,passive:!1}),this.toggleAttribute("open",!1),this.#$()}selectNextItem(){const t=this.#N();if(this.hasSelectedElement()){const e=t.indexOf(this.#O());if(t.length-1<=e)return;this.#q(t[e+1].dataset.index)}else{if(0===t.length)return;this.#q(t[0].dataset.index)}}selectPrevItem(){const t=this.#N();if(this.hasSelectedElement()){const e=t.indexOf(this.#O());if(0===e)return;this.#q(t[e-1].dataset.index)}else{if(0===t.length)return;this.#q(t[t.length-1].dataset.index)}}triggerClickOnSelectedItem(){this.hasSelectedElement()&&this.#O().dispatchEvent(new MouseEvent("mousedown"))}hasSelectedElement(){return null!=this.#O()}isVisible(){return this.hasAttribute("open")}onOptionClick(t){this.#p.onOptionClick.push(t)}connectedCallback(){this.innerHTML=this.#g(),this.#A=this.querySelector("ul"),this.#E(),this.#I=t=>{if(this.contains(t.target)){const e=t.deltaY<0,i=t.deltaY>0,s=0===this.#A.scrollTop,n=this.#A.scrollTop+this.#A.clientHeight>=this.#A.scrollHeight;(e&s||i&n)&&(t.stopPropagation(),t.preventDefault())}else t.stopPropagation(),t.preventDefault()}}#T(t){"function"==typeof this.#M?this.#C=[...t].sort(this.#M):this.#C=t}#N(){return[...this.#A.querySelectorAll("li:not([hidden])")]}#E(){this.#A.addEventListener("mousedown",(t=>{t.preventDefault()}));for(const t of this.querySelectorAll("li"))t.addEventListener("mousedown",(()=>{const e=this.#C[t.dataset.index];this.#p.onOptionClick.forEach((t=>t(e)))}))}#g(){return`\n `}#L(){const t=this.parentElement.getBoundingClientRect();0===this.#k&&(this.#k=Math.max(...this.#C.map((t=>a(t.displayName))),0));const e=Math.max(this.#k+24+22,t.width),i=document.documentElement.clientWidth-t.left;this.#A.style.right=e>i?0:null,this.#A.style.width=`${Math.min(e,document.documentElement.clientWidth)}px`,this.style.width=`${Math.min(e,document.documentElement.clientWidth)}px`,this.style.top=`${t.top}px`}#O(){return this.querySelector(`li[data-index="${this.#S}"]`)}#q(t){this.#$(),this.#S=t;const e=this.#O();e.classList.add("list-box__item--active"),e.scrollIntoView({block:"nearest"})}#$(){this.#S>=0&&(this.#O().classList.remove("list-box__item--active"),this.#S=-1)}#D(t,e,i){if(e>=0){const s=t.substring(0,e),n=t.substring(e,e+i),a=t.substring(e+i);return l`${s}${n}${a}`}return t}static get is(){return"list-box"}}window.customElements.get(h.is)||window.customElements.define(h.is,h);class o extends HTMLElement{#e;#P;#_;#U=null;#H;#p={onChangeValue:[]};connectedCallback(){this.innerHTML=this.#g(),this.#e=this.querySelector("text-input"),this.#P=this.querySelector("list-box"),this.#H=this.hasAttribute("shouldMatchOptions"),this.#E()}get value(){return this.#_}get rawValue(){return this.#e.value}set value(t){this.#_=t,this.#e.value=t&&t.displayName?t.displayName:""}set initialValue(t){this.value=t,this.#U=t}set options(t){this.#P.options=t,this.#j()}set errorMessage(t){this.#e.errorMessage=t}checkValidity(){return this.#R()&&this.#e.checkValidity()}onChangeValue(t){this.#p.onChangeValue.push(t)}setDisabled(t){this.toggleAttribute("disabled",t),this.#e.setDisabled(t)}#f(){this.errorMessage="",this.#j(),this.#P.isVisible()||this.#P.show()}#B(){this.#j(),this.#P.show()}#F(){this.#K()}#W(t){this.value=t,this.#K()}#z(){this.value={displayName:""},this.#e.querySelector("input").focus()}#Y(t){switch([s.Up,s.Down].includes(t.code)&&(t.preventDefault(),t.stopImmediatePropagation()),t.key){case s.Esc:this.#K();break;case s.Enter:this.#P.isVisible()&&(this.#P.hasSelectedElement()?this.#P.triggerClickOnSelectedItem():this.#K());break;case s.Down:this.#P.isVisible()||this.#P.show(),this.#P.selectNextItem();break;case s.Up:this.#P.isVisible()||this.#P.show(),this.#P.selectPrevItem()}}#G(){this.#V()}#K(){this.#P.hide(),this.#V()}#V(){this.#R()&&this.#X()&&(this.#U=this.value,this.#p.onChangeValue.forEach((t=>t(this.value))))}#R(){const t=this.#e.value;if(""===t)return this.#_=null,!0;if(this.value&&this.value.displayName===t)return this.errorMessage="",!0;if(!this.#H)return this.errorMessage="",this.#_={displayName:t},!0;for(const e of this.#P.options)if(e.displayName===t)return this.errorMessage="",this.#_=e,this.#e.value=e.displayName,!0;return this.#_=null,this.errorMessage="Select from list",!1}#j(){this.hasAttribute("nofiltering")||(this.#P.filter=this.#e.value)}#X(){return this.#U!==this.value}#E(){const t=this.#e.querySelector("input");this.addEventListener("keydown",this.#Y.bind(this)),this.addEventListener("keyup",(t=>{t.stopPropagation()})),t.addEventListener("input",this.#f.bind(this)),t.addEventListener("blur",this.#F.bind(this)),t.addEventListener("focus",this.#B.bind(this)),this.#e.onTrailingIconClick(this.#z.bind(this)),this.#e.onChangeValue(this.#G.bind(this)),this.#P.onOptionClick(this.#W.bind(this))}#g(){const t=this.hasAttribute("required")?"required":"",e=this.hasAttribute("disabled")?"disabled":"",i=this.hasAttribute("no-icon")?"":"close";return l` - `}static get is(){return"typeahead-input"}}window.customElements.get(h.is)||window.customElements.define(h.is,h);class o extends HTMLElement{#e;#_;#P;#U=null;#p={onShowDropdown:[],onChangeValue:[]};get value(){return this.#P}set value(t){this.#e.value=t&&t.displayName?t.displayName:"",this.#P=t}set options(t){this.#_.options=t}set comparator(t){this.#_.comparator=t}setDisabled(t){this.toggleAttribute("disabled",t),this.#e.setDisabled(t)}showDropdown(){this.#_.show(),this.#p.onShowDropdown.forEach((t=>t()))}onShowDropdown(t){this.#p.onShowDropdown.push(t)}onChangeValue(t){this.#p.onChangeValue.push(t)}checkValidity(){return this.#R()}connectedCallback(){this.innerHTML=this.#g(),this.#e=this.querySelector("text-input"),this.#_=this.querySelector("list-box"),this.#E()}#E(){this.addEventListener("keydown",this.#Y.bind(this));const t=this.#e.querySelector("input");t.addEventListener("focusout",this.#J.bind(this)),t.addEventListener("click",this.#Q.bind(this)),this.#_.onOptionClick(this.#W.bind(this))}#J(){this.#K()}#W(t){this.#e.value=t.displayName,this.#P=t,this.#K()}#Q(){this.#_.isVisible()?this.#_.hide():this.showDropdown()}#Y(t){switch([s.Up,s.Down].includes(t.code)&&(t.preventDefault(),t.stopImmediatePropagation()),t.key){case s.Esc:t.preventDefault(),this.#K(),this.#e.focus();break;case s.Enter:this.#_.isVisible()&&(t.stopPropagation(),this.#_.hasSelectedElement()?this.#_.triggerClickOnSelectedItem():this.#_.hide());break;case s.Down:this.#_.isVisible()||this.#_.show(),this.#_.selectNextItem();break;case s.Up:this.#_.isVisible()||this.#_.show(),this.#_.selectPrevItem()}}#K(){this.#_.hide(),this.#V()}#V(){this.#R()&&this.#U!==this.value&&(this.#U=this.value,this.#p.onChangeValue.forEach((t=>t(this.value))))}#R(){return this.#e.hasAttribute("required")&&!this.#e.value?this.#e.errorMessage="Required":this.#e.errorMessage="",this.#e.checkValidity()}#g(){const t=this.hasAttribute("required")?"required":"",e=this.hasAttribute("disabled")?"disabled":"";return n` + `}static get is(){return"typeahead-input"}}window.customElements.get(o.is)||window.customElements.define(o.is,o);class u extends HTMLElement{#e;#P;#_;#U=null;#p={onShowDropdown:[],onChangeValue:[]};get value(){return this.#_}set value(t){this.#e.value=t&&t.displayName?t.displayName:"",this.#_=t}set options(t){this.#P.options=t}set comparator(t){this.#P.comparator=t}setDisabled(t){this.toggleAttribute("disabled",t),this.#e.setDisabled(t)}setPlaceholder(t){this.#e.setPlaceholder(t)}showDropdown(){this.#P.show(),this.#p.onShowDropdown.forEach((t=>t()))}onShowDropdown(t){this.#p.onShowDropdown.push(t)}onChangeValue(t){this.#p.onChangeValue.push(t)}checkValidity(){return this.#R()}connectedCallback(){this.innerHTML=this.#g(),this.#e=this.querySelector("text-input"),this.#P=this.querySelector("list-box"),this.#E()}#E(){this.addEventListener("keydown",this.#Y.bind(this));const t=this.#e.querySelector("input");t.addEventListener("focusout",this.#J.bind(this)),t.addEventListener("click",this.#Q.bind(this)),this.#P.onOptionClick(this.#W.bind(this))}#J(){this.#K()}#W(t){this.#e.value=t.displayName,this.#_=t,this.#K()}#Q(){this.#P.isVisible()?this.#P.hide():this.showDropdown()}#Y(t){switch([s.Up,s.Down].includes(t.code)&&(t.preventDefault(),t.stopImmediatePropagation()),t.key){case s.Esc:t.preventDefault(),this.#K(),this.#e.focus();break;case s.Enter:this.#P.isVisible()&&(t.stopPropagation(),this.#P.hasSelectedElement()?this.#P.triggerClickOnSelectedItem():this.#P.hide());break;case s.Down:this.#P.isVisible()||this.#P.show(),this.#P.selectNextItem();break;case s.Up:this.#P.isVisible()||this.#P.show(),this.#P.selectPrevItem()}}#K(){this.#P.hide(),this.#V()}#V(){this.#R()&&this.#U!==this.value&&(this.#U=this.value,this.#p.onChangeValue.forEach((t=>t(this.value))))}#R(){return this.#e.hasAttribute("required")&&!this.#e.value?this.#e.errorMessage="Required":this.#e.errorMessage="",this.#e.checkValidity()}#g(){const t=this.hasAttribute("required")?"required":"",e=this.hasAttribute("disabled")?"disabled":"";return safeHtml` - `}static get is(){return"select-input"}}window.customElements.get(o.is)||window.customElements.define(o.is,o);class u extends HTMLElement{#Z;#i=!0;#tt;#et="";#it="";#st=t=>t;#nt=new ResizeObserver(this.#lt.bind(this));#p={onChangeValue:[]};connectedCallback(){this.innerHTML=this.#g(),this.#Z={text:this.querySelector(".edit-text__text"),popup:this.querySelector(".edit-text__popup"),input:this.querySelector("text-input")},this.#E(),this.#nt.observe(document.body),this.#at(),this.#rt()}disconnectedCallback(){this.#nt.unobserve(document.body)}onChange(t){this.#p.onChangeValue.push(t)}checkValidity(){return this.#Z.input.checkValidity()}toggleIncorrectAttribute(t){this.toggleAttribute("incorrect",t)}addExternalValidator(t){this.#Z.input.addValidator(t)}addValidator(t){this.#Z.input.addValidator(t)}get value(){return this.#Z.input.value}set value(t){this.#Z.input.value=t,this.#rt()}set displayTextTransformer(t){this.#st=t}#ht(){return this.getAttribute("value")}#ot(){let t=this.#st(this.#ht());return this.#ut()&&(t=+t),`${this.#it}${t}${this.#et}`}#E(){this.#Z.text.addEventListener("click",this.#dt.bind(this)),this.addEventListener("click",this.#pt.bind(this)),this.#Z.popup.addEventListener("keydown",this.#Y.bind(this)),this.#Z.input.onInput(this.#f.bind(this)),this.#Z.popup.addEventListener("cancel",this.#ct.bind(this))}#dt(){this.toggleIncorrectAttribute(!1),this.#mt(),this.#lt(),this.#Z.popup.showModal(),this.#Z.input.focus()}#f(t,e){this.#i=e}#ct(){this.#Z.input.value=this.#tt}#gt(){this.checkValidity()&&(this.#Z.popup.close(),this.#bt())}#pt(t){t.preventDefault(),t.stopPropagation(),t.target===this.#Z.popup&&(this.#Z.popup.close(),this.#bt())}#bt(){if(!this.#i)return void(this.#Z.input.value=this.#ht());this.#ht()!==this.#Z.input.value&&this.#Z.input.value.length&&(this.#rt(),this.#p.onChangeValue.forEach((t=>t(this.#ht()))));const t=this.#Z.input.rawValue;0!==t.length||this.#Z.input.hasAttribute("required")?(this.#tt=t,this.#Z.text.toggleAttribute("empty-value",!1)):this.#Et()}#Et(){this.#Z.text.textContent="set",this.#Z.text.toggleAttribute("empty-value",!0),this.removeAttribute("value"),this.removeAttribute("title")}#Y(t){t.stopPropagation(),t.repeat||t.key===s.Enter&&!t.repeat&&this.#i&&this.#gt()}#mt(){this.hasAttribute("value")&&(this.#tt=this.getAttribute("value"),this.#Z.input.value=this.#tt)}#rt(){this.setAttribute("value",this.#Z.input.value),this.setAttribute("title",this.#Z.input.value),this.#Z.text.toggleAttribute("empty-value",!1);let t=this.#ht();"string"==typeof t&&t.length>0?this.#Z.text.textContent=this.#ot():this.#Et()}#lt(){let{top:t,left:e}=this.getBoundingClientRect();this.#Z.popup.style.top=t+window.scrollY+"px",this.#Z.popup.style.left=e+window.scrollX+"px",this.hasAttribute("max-width")?this.#Z.popup.style.width=l(this.#Z.input.rawValue)+16+"px":this.#Z.popup.style["max-width"]=Math.max(this.offsetWidth+16,128)+"px"}#ut(){return"number"===this.getAttribute("type")}#at(){this.hasAttribute("suffix")&&(this.#et=this.getAttribute("suffix")),this.hasAttribute("prefix")&&(this.#it=this.getAttribute("prefix")),this.hasAttribute("max-width")&&(this.#Z.popup.style["max-width"]=this.getAttribute("max-width")+"px",this.#Z.input.style["max-width"]=this.getAttribute("max-width")-16+"px"),this.hasAttribute("min-width")&&(this.#Z.popup.style["min-width"]=this.getAttribute("min-width")+"px",this.#Z.input.style["min-width"]=this.getAttribute("min-width")-16+"px"),this.#Z.input.value=this.#ht(),this.hasAttribute("scale")&&(this.displayTextTransformer=t=>function(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}(t,parseInt(this.getAttribute("scale"))))}#g(){const t=this.hasAttribute("required")?"required":"",e=this.getAttribute("type")||"text";let i="";this.hasAttribute("step")&&(i=`step="${this.getAttribute("step")}"`);let s="";this.hasAttribute("min")&&(s=`min="${this.getAttribute("min")}"`);let n="";this.hasAttribute("max")&&(n=`max="${this.getAttribute("max")}"`);let l="";this.hasAttribute("minlength")&&(l=`minlength="${this.getAttribute("minlength")}"`);let a="";this.hasAttribute("maxlength")&&(a=`maxlength="${this.getAttribute("maxlength")}"`);let r="";this.hasAttribute("pattern")&&(r=`pattern="${this.getAttribute("pattern")}"`);let h="";return this.hasAttribute("number-type")&&(h=`number-type="${this.getAttribute("number-type")}"`),`\n \n \n `}static get is(){return"edit-text"}}return window.customElements.get(u.is)||window.customElements.define(u.is,u),e})())); + `}static get is(){return"select-input"}}window.customElements.get(u.is)||window.customElements.define(u.is,u);class d extends HTMLElement{#Z;#i=!0;#tt;#et="";#it="";#st=t=>t;#nt=new ResizeObserver(this.#lt.bind(this));#p={onChangeValue:[]};connectedCallback(){this.innerHTML=this.#g(),this.#Z={text:this.querySelector(".edit-text__text"),popup:this.querySelector(".edit-text__popup"),input:this.querySelector("text-input")},this.#E(),this.#nt.observe(document.body),this.#at(),this.#rt()}disconnectedCallback(){this.#nt.unobserve(document.body)}onChange(t){this.#p.onChangeValue.push(t)}checkValidity(){return this.#Z.input.checkValidity()}toggleIncorrectAttribute(t){this.toggleAttribute("incorrect",t)}addExternalValidator(t){this.#Z.input.addValidator(t)}addValidator(t){this.#Z.input.addValidator(t)}get value(){return this.#Z.input.value}set value(t){this.#Z.input.value=t,this.#rt()}set displayTextTransformer(t){this.#st=t}#ht(){return this.getAttribute("value")}#ot(){let t=this.#st(this.#ht());return this.#ut()&&(t=+t),`${this.#it}${t}${this.#et}`}#E(){this.#Z.text.addEventListener("click",this.#dt.bind(this)),this.addEventListener("click",this.#pt.bind(this)),this.#Z.popup.addEventListener("keydown",this.#Y.bind(this)),this.#Z.input.onInput(this.#f.bind(this)),this.#Z.popup.addEventListener("cancel",this.#ct.bind(this))}#dt(){this.toggleIncorrectAttribute(!1),this.#mt(),this.#lt(),this.#Z.popup.showModal(),this.#Z.input.focus()}#f(t,e){this.#i=e}#ct(){this.#Z.input.value=this.#tt}#gt(){this.checkValidity()&&(this.#Z.popup.close(),this.#bt())}#pt(t){t.preventDefault(),t.stopPropagation(),t.target===this.#Z.popup&&(this.#Z.popup.close(),this.#bt())}#bt(){if(!this.#i)return void(this.#Z.input.value=this.#ht());this.#ht()!==this.#Z.input.value&&this.#Z.input.value.length&&(this.#rt(),this.#p.onChangeValue.forEach((t=>t(this.#ht()))));const t=this.#Z.input.rawValue;0!==t.length||this.#Z.input.hasAttribute("required")?(this.#tt=t,this.#Z.text.toggleAttribute("empty-value",!1)):this.#Et()}#Et(){this.#Z.text.textContent="set",this.#Z.text.toggleAttribute("empty-value",!0),this.removeAttribute("value"),this.removeAttribute("title")}#Y(t){t.stopPropagation(),t.repeat||t.key===s.Enter&&!t.repeat&&this.#i&&this.#gt()}#mt(){this.hasAttribute("value")&&(this.#tt=this.getAttribute("value"),this.#Z.input.value=this.#tt)}#rt(){this.setAttribute("value",this.#Z.input.value),this.setAttribute("title",this.#Z.input.value),this.#Z.text.toggleAttribute("empty-value",!1);let t=this.#ht();"string"==typeof t&&t.length>0?this.#Z.text.textContent=this.#ot():this.#Et()}#lt(){let{top:t,left:e}=this.getBoundingClientRect();this.#Z.popup.style.top=t+window.scrollY+"px",this.#Z.popup.style.left=e+window.scrollX+"px",this.hasAttribute("max-width")?this.#Z.popup.style.width=a(this.#Z.input.rawValue)+16+"px":this.#Z.popup.style["max-width"]=Math.max(this.offsetWidth+16,128)+"px"}#ut(){return"number"===this.getAttribute("type")}#at(){this.hasAttribute("suffix")&&(this.#et=this.getAttribute("suffix")),this.hasAttribute("prefix")&&(this.#it=this.getAttribute("prefix")),this.hasAttribute("max-width")&&(this.#Z.popup.style["max-width"]=this.getAttribute("max-width")+"px",this.#Z.input.style["max-width"]=this.getAttribute("max-width")-16+"px"),this.hasAttribute("min-width")&&(this.#Z.popup.style["min-width"]=this.getAttribute("min-width")+"px",this.#Z.input.style["min-width"]=this.getAttribute("min-width")-16+"px"),this.#Z.input.value=this.#ht(),this.hasAttribute("scale")&&(this.displayTextTransformer=t=>function(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}(t,parseInt(this.getAttribute("scale"))))}#g(){const t=this.hasAttribute("required")?"required":"",e=this.getAttribute("type")||"text";let i="";this.hasAttribute("step")&&(i=`step="${this.getAttribute("step")}"`);let s="";this.hasAttribute("min")&&(s=`min="${this.getAttribute("min")}"`);let n="";this.hasAttribute("max")&&(n=`max="${this.getAttribute("max")}"`);let l="";this.hasAttribute("minlength")&&(l=`minlength="${this.getAttribute("minlength")}"`);let a="";this.hasAttribute("maxlength")&&(a=`maxlength="${this.getAttribute("maxlength")}"`);let r="";this.hasAttribute("pattern")&&(r=`pattern="${this.getAttribute("pattern")}"`);let h="";return this.hasAttribute("number-type")&&(h=`number-type="${this.getAttribute("number-type")}"`),`\n \n \n `}static get is(){return"edit-text"}}return window.customElements.get(d.is)||window.customElements.define(d.is,d),e})())); //# sourceMappingURL=index.bundle.js.map \ No newline at end of file diff --git a/index.bundle.js.map b/index.bundle.js.map index dd77dca..37dcc5e 100644 --- a/index.bundle.js.map +++ b/index.bundle.js.map @@ -1 +1 @@ -{"version":3,"file":"index.bundle.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GAC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KqIoDG,CAAqBpK,EAAMqK,SAASvN,KAAK4B,aAAa,WACtG,CAEA,KACI,MAAM4L,EAAexN,KAAKuB,aAAa,YAAc,WAAa,GAC5DkM,EAAWzN,KAAK4B,aAAa,SAAW,OAC9C,IAAI8L,EAAW,GACX1N,KAAKuB,aAAa,UAClBmM,EAAW,SAAS1N,KAAK4B,aAAa,YAC1C,IAAI+L,EAAU,GACV3N,KAAKuB,aAAa,SAClBoM,EAAU,QAAQ3N,KAAK4B,aAAa,WACxC,IAAIgM,EAAU,GACV5N,KAAKuB,aAAa,SAClBqM,EAAU,QAAQ5N,KAAK4B,aAAa,WACxC,IAAIiM,EAAgB,GAChB7N,KAAKuB,aAAa,eAClBsM,EAAgB,cAAc7N,KAAK4B,aAAa,iBACpD,IAAIkM,EAAgB,GAChB9N,KAAKuB,aAAa,eAClBuM,EAAgB,cAAc9N,KAAK4B,aAAa,iBACpD,IAAImM,EAAc,GACd/N,KAAKuB,aAAa,aAClBwM,EAAc,YAAY/N,KAAK4B,aAAa,eAChD,IAAIoM,EAAiB,GAGrB,OAFIhO,KAAKuB,aAAa,iBAClByM,EAAiB,gBAAgBhO,KAAK4B,aAAa,mBAChD,qUAMe4L,kCACAE,kCACAC,kCACAC,kCACAC,kCACAC,kCACAC,kCACAC,wCACMP,uEAGhC,CAEA,aAAW1G,GACP,MAAO,WACX,E,OAIClC,OAAOmC,eAAe5H,IAAI0M,EAAS/E,KACpClC,OAAOmC,eAAetI,OAAOoN,EAAS/E,GAAI+E,G","sources":["webpack://elsciUi/webpack/universalModuleDefinition","webpack://elsciUi/webpack/bootstrap","webpack://elsciUi/webpack/runtime/define property getters","webpack://elsciUi/webpack/runtime/hasOwnProperty shorthand","webpack://elsciUi/webpack/runtime/make namespace object","webpack://elsciUi/./src/TextInput/TextInputValidityState.js","webpack://elsciUi/./src/utils.js","webpack://elsciUi/./src/TextInput/TextInput.js","webpack://elsciUi/./src/ListBox/ListBox.js","webpack://elsciUi/./src/TypeAheadInput/TypeAheadInput.js","webpack://elsciUi/./src/SelectInput/SelectInput.js","webpack://elsciUi/./src/EditText/EditText.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"elsciUi\"] = factory();\n\telse\n\t\troot[\"elsciUi\"] = factory();\n})(self, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export default class TextInputValidityState {\n\t#textInput;\n\t#inputElement;\n\t#isValid;\n\t#errorMessage;\n\n\tconstructor(textInput) {\n\t\tthis.#textInput = textInput\n\t\tthis.#inputElement = textInput.querySelector('input');\n\t\tthis.#isValid = true;\n\t\tthis.#errorMessage = \"\";\n\t}\n\n\tget isValid() {\n\t\treturn this.#isValid;\n\t}\n\n\tget errorMessage() {\n\t\treturn this.#errorMessage;\n\t}\n\n\tcheckValidity() {\n\t\t// reset custom validity\n\t\tthis.setCustomValidity(\"\");\n\t\tthis.#inputElement.checkValidity();\n\t\t// if the input element is valid, then check custom validity\n\t\tlet validity = this.#inputElement.validity;\n\t\tif (validity.valid) {\n\t\t\tvalidity = this.#getCustomValidity();\n\t\t}\n\t\tthis.#isValid = validity.valid;\n\t\tthis.#errorMessage = this.#getValidationMessage(validity);\n\t\treturn this.isValid;\n\t}\n\n\tsetCustomValidity(message) {\n\t\tthis.#inputElement.setCustomValidity(message);\n\t\tthis.#isValid = this.#inputElement.validity.valid;\n\t\tthis.#errorMessage = message;\n\t}\n\n\t/**\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/ValidityState\n\t * Here we add our own validation steps, and update the validity state properties.\n\t * - valueMissing: if the input element is required and the trimmed text is empty (contains only whitespaces).\n\t * - rangeUnderflow: if the input element is a number and the value is less than the min attribute.\n\t * - rangeOverflow: if the input element is a number and the value is greater than the max attribute.\n\t */\n\t#getCustomValidity() {\n\t\tconst {badInput, customError, patternMismatch, typeMismatch, valid, rangeOverflow, rangeUnderflow, tooLong,\n\t\t\ttooShort, valueMissing, stepMismatch} = this.#inputElement.validity;\n\t\tconst cv = Object.assign({},\n\t\t\t{badInput, customError, patternMismatch, typeMismatch, valid, rangeOverflow, rangeUnderflow, tooLong,\n\t\t\t\ttooShort, valueMissing, stepMismatch},\n\t\t\tthis.#isBlanknessConstraintViolated(),\n\t\t\tthis.#isRangeConstraintViolated(),\n\t\t\tthis.#isStepConstraintViolated()\n\t\t);\n\t\tcv.valid = !cv.valueMissing && !cv.rangeUnderflow && !cv.rangeOverflow && !cv.stepMismatch;\n\t\treturn cv;\n\t}\n\n\t/**\n\t * Checks if the input element is required and the trimmed text is empty (contains only whitespaces).\n\t * @returns {{valueMissing: (*|boolean)}}\n\t */\n\t#isBlanknessConstraintViolated() {\n\t\tconst trimmedText = this.#inputElement.value.trim();\n\t\treturn {valueMissing: this.#textInput.hasAttribute(\"required\") && trimmedText === \"\"};\n\t}\n\n\t/**\n\t * This is a workaround for the fact that the browser does not validate decimals properly. It takes only\n\t * first 18 digits of the decimal number and then compares it with the min and max attributes.\n\t * So if the min attribute is 0 and the value is -0.0000000000000000001, then the browser will not\n\t * consider it as a range underflow (after conversion it becomes -0 => 0).\n\t * This is why we have to check the value manually.\n\t */\n\t#isRangeConstraintViolated() {\n\t\tif (this.#inputElement.type !== \"number\")\n\t\t\treturn {rangeUnderflow: false, rangeOverflow: false};\n\t\tconst {min, max, value} = this.#inputElement;\n\t\treturn {rangeUnderflow: (min !== \"\" && +value < +min), rangeOverflow: (max !== \"\" && +value > +max)};\n\t}\n\n\t/**\n\t * This method serves to supplement internal validation to determine whether a float qualifies as an integer.\n\t * The internal validation for an input type=\"number\" step=\"1\" doesn't consistently cover all cases.\n\t * For example, the number 2.00000001 might be considered an integer by the internal validator.\n\t * So we are using attribute 'number-type=\"integer\"'\n\t * The aim is to widen this validation range. Now, the comparison for an integer works correctly when a number\n\t * has no more than 16 digits. However, if a number has 17 digits or more, this function returns incorrect result.\n\t *\n\t * We use StepMismatch property because internal validation writes this error to this property\n\t * StepMismatch property of a ValidityState object indicates if the value of an , after having been edited\n\t * by the user, does not conform to the constraints set by the element's step attribute.\n\t *\n\t * @return {{stepMismatch: boolean}}\n\t */\n\t#isStepConstraintViolated() {\n\t\tif (this.#inputElement.type !== \"number\")\n\t\t\treturn {stepMismatch: false};\n\t\tconst numberType = this.#textInput.getAttribute('number-type');\n\t\tif (!numberType || numberType !== \"integer\")\n\t\t\treturn {stepMismatch: false};\n\t\tconst stepMismatch = !Number.isInteger(this.#inputElement.valueAsNumber);\n\t\treturn {stepMismatch: stepMismatch};\n\t}\n\n\t#getValidationMessage(validityState) {\n\t\tconst isTypeNumber = this.#inputElement.type === \"number\";\n\t\tconst {badInput, rangeOverflow, rangeUnderflow, tooLong, tooShort, valueMissing, stepMismatch} = validityState;\n\t\tif (isTypeNumber && badInput)\n\t\t\treturn \"Invalid number\";\n\t\tif (isTypeNumber && stepMismatch) {\n\t\t\tif (this.#inputElement.step === \"1\" ){\n\t\t\t\t// Here we checked floats because if step is 1, then the value must be an integer.\n\t\t\t\t// Now we can use attribute 'number-type=\"integer\"', but we have previously written inputs,\n\t\t\t\t// that's why don't want to remove this code\n\t\t\t\treturn \"Must be an integer\";\n\t\t\t}\n\t\t\tconst numberType = this.#textInput.getAttribute('number-type');\n\t\t\tif (numberType && numberType === \"integer\") {\n\t\t\t\treturn \"Must be an integer\";\n\t\t\t}\n\t\t}\n\t\tif (rangeOverflow)\n\t\t\treturn \"Greater than \" + this.#inputElement.max;\n\t\tif (rangeUnderflow)\n\t\t\treturn \"Less than \" + this.#inputElement.min;\n\t\tif (tooLong)\n\t\t\treturn \"Max length is \" + this.#inputElement.maxLength;\n\t\tif (tooShort)\n\t\t\treturn \"Min length is \" + this.#inputElement.minLength;\n\t\tif (!badInput && valueMissing)\n\t\t\treturn \"Required\";\n\t\treturn this.#inputElement.validationMessage;\n\t}\n}","export const KeyCode = Object.freeze({\n \"Shift\": \"ShiftLeft\",\n \"Esc\": \"Escape\",\n \"Enter\": \"Enter\",\n \"Up\": \"ArrowUp\",\n \"Down\": \"ArrowDown\"\n});\n\n/**\n * @param {string} unsafe\n * @returns {string}\n */\nexport const safeText = (unsafe) => {\n if (!unsafe)\n return ''\n return unsafe\n .replace(/&/g, \"&\")\n .replace(//g, \">\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\");\n}\n\n/**\n * To be used when generating HTML via string interpolation e.g. {@code safeHtml`
${variables}
`} -\n * these variables will go through this function and have to be escaped should such string be shown on UI.\n *\n * @param {TemplateStringsArray} strings\n * @param {string[]} values\n * @returns {string}\n */\nexport const safeHtml = (strings, ...values) => {\n let result = strings[0];\n for (let i = 0; i < values.length; i++) {\n result += safeText(String(values[i]));\n result += strings[i + 1];\n }\n return result;\n}\n\n/* @param {String} text */\nexport function getTextWidth(text) {\n const span = document.createElement(\"span\");\n document.body.appendChild(span)\n span.textContent = text;\n span.style.fontSize = '1rem';\n span.style.visibility = 'hidden';\n span.style.position = 'absolute';\n const width = Math.ceil(span.getBoundingClientRect().width) + 1;\n span.remove();\n return width;\n}\n\nfunction getCssStyle(element, prop) {\n return window.getComputedStyle(element, null).getPropertyValue(prop);\n}\n\nexport function isFiniteNumber (value) {\n if (typeof value !== 'undefined' && Number.isFinite(value)) {\n return true\n }\n else return false\n}\n\n/**\n * Function that rounds a number to a specified number of decimal places.\n * @param {number} number\n * @param {number} decimalPlaces\n * @return {number}\n */\nexport function roundToDecimalPlaces(number, decimalPlaces) {\n const multiplier = Math.pow(10, decimalPlaces);\n return Math.round(number * multiplier) / multiplier;\n}","// @ts-check\nimport TextInputValidityState from \"./TextInputValidityState.js\";\nimport {isFiniteNumber, KeyCode, safeHtml} from \"../utils.js\"\n\n/**\n * @typedef {import(\"../InputValidator.js\").default} InputValidator\n */\nexport default class TextInput extends HTMLElement {\n static #INPUT_ATTRIBUTES = new Set([\"autocomplete\", \"autofocus\", \"disabled\", \"max\", \"maxlength\",\n \"min\", \"minlength\", \"name\", \"pattern\", \"readonly\", \"step\", \"type\", \"value\", \"placeholder\"\n /* \"required\" - we do not want to set attribute required when render text-input, because in this case all\n required inputs becomes red, as solution we just leave it in the root element and do this validation manually */]);\n /** @type {HTMLInputElement} */\n #inputElement;\n /** @type {HTMLElement} */\n #errorElement;\n /** @type {TextInputValidityState} */\n #validityState;\n #callbacks = {\n /** @type {Function[]} */\n onTrailingIconClick: [],\n /** @type {Function[]} */\n onChangeValue: [],\n /** @type {Function[]} */\n onInput: []\n };\n /** @type {string} */\n #lastChangedValue;\n /** @type {InputValidator[]} */\n #validators = [];\n\n connectedCallback() {\n this.innerHTML = this.#htmlTemplate();\n this.#inputElement = this.querySelector(\"input\");\n this.#errorElement = this.querySelector(\".text-input__error\");\n this.#validityState = new TextInputValidityState(this);\n this.#fillInputAttributes();\n this.#addListeners();\n if (this.hasAttribute(\"value\"))\n this.value = this.getAttribute(\"value\");\n }\n\n disconnectedCallback() {\n // Save value to attribute, because it will be lost after element is removed from DOM and reinserted.\n // The case is happening when user adds new element to the table and then sorts it by reinserting rows.\n this.setAttribute(\"value\", this.value);\n window.removeEventListener(\"visibilitychange\", this.#onVisibilityChange.bind(this), { capture: true });\n }\n\n /** @param {InputValidator} validator */\n addValidator(validator) {\n this.#validators.push(validator);\n }\n\n /**\n * Returns trimmed value of the input.\n * @returns {string}\n */\n get value() {\n return this.rawValue.trim();\n }\n\n /**\n * Returns raw value of the input.\n * @returns {string}\n */\n get rawValue() {\n return this.#inputElement.value;\n }\n\n /** @param {string | null} value */\n set value(value) {\n this.#inputElement.value = (isFiniteNumber(value) || typeof value == \"string\")? value : '';\n this.#lastChangedValue = this.#inputElement.value\n this.checkValidity();\n }\n\n checkValidity() {\n if (!this.#validityState.checkValidity()){\n this.errorMessage = this.#validityState.errorMessage;\n return false;\n }\n this.errorMessage = this.#validityState.errorMessage;\n for (const validator of this.#validators) {\n const result = validator.validate(this, this.value);\n if (!result.isValid) {\n this.errorMessage = result.errorMessage;\n this.focus()\n return false;\n }\n }\n return true;\n }\n\n get errorMessage() {\n return this.#errorElement.textContent;\n }\n\n set errorMessage(message) {\n // We reset lastChangedValue because if the same invalid value is entered again, we want to validate this value\n if (message){\n this.#lastChangedValue = null;\n }\n this.#validityState.setCustomValidity(message);\n this.#errorElement.textContent = this.#validityState.errorMessage;\n }\n\n /** @param {Function} callback */\n onTrailingIconClick(callback) {\n this.#callbacks.onTrailingIconClick.push(callback);\n }\n /** @param {Function} callback */\n onInput(callback) {\n this.#callbacks.onInput.push(callback);\n }\n /** @param {Function} callback */\n onChangeValue(callback) {\n this.#callbacks.onChangeValue.push(callback);\n }\n\n // @ts-ignore\n focus(options) {\n this.#inputElement.focus(options)\n }\n\n /** @param {boolean} isDisabled */\n setDisabled(isDisabled) {\n this.toggleAttribute(\"disabled\", isDisabled);\n this.#inputElement.toggleAttribute(\"disabled\", isDisabled);\n }\n\n /** @param {KeyboardEvent} event */\n #onKeyDown(event) {\n if (this.#inputElement.type === \"number\" && (event.key === KeyCode.Up || event.key === KeyCode.Down))\n event.preventDefault();\n if (event.key === KeyCode.Enter && !event.repeat)\n this.#onChange();\n }\n\n #onInput() {\n const isValid = this.checkValidity();\n this.#callbacks.onInput.forEach(callback => callback(this.value, isValid));\n }\n\n #onChange() {\n // We validate if the current value is not equal to the last changed value\n if (this.#lastChangedValue !== this.value)\n this.#validateAndNotify();\n }\n\n #onTrailingIconClick() {\n this.#callbacks.onTrailingIconClick.forEach(callback => callback());\n }\n\n #validateAndNotify() {\n if (this.checkValidity()) {\n this.#lastChangedValue = this.value;\n this.#callbacks.onChangeValue.forEach(callback => callback(this.value));\n }\n }\n\n #fillInputAttributes() {\n for (const attribute of this.attributes)\n if (TextInput.#INPUT_ATTRIBUTES.has(attribute.name))\n this.#inputElement.setAttribute(attribute.name, attribute.value)\n // For number inputs, if step is not specified then it is set to 1 by default, and it is not possible to enter\n // decimal w/o validation error. So, if step is not specified, then we set it to \"any\" to allow decimal values.\n if (this.getAttribute(\"type\") === \"number\" && !this.hasAttribute(\"step\"))\n this.#inputElement.setAttribute(\"step\", \"any\");\n if (this.hasAttribute(\"placeholder\"))\n this.classList.add(\"placeholder-shown\");\n }\n\n #addListeners() {\n this.#inputElement.addEventListener(\"keydown\", this.#onKeyDown.bind(this));\n this.#inputElement.addEventListener(\"input\", this.#onInput.bind(this));\n this.#inputElement.addEventListener(\"focusout\", this.#onChange.bind(this));\n this.querySelector('.text-input__trailing-icon').addEventListener(\"click\", this.#onTrailingIconClick.bind(this));\n window.addEventListener(\"visibilitychange\", this.#onVisibilityChange.bind(this), { capture: true });\n }\n\n /**\n * This method is called when user:\n * - closes the tab\n * - closes browser window\n * - refreshes the page\n * - navigates to another page\n * - navigates to another tab\n * - minimizes the browser window\n *\n * It is needed to blur the input element, because if it is focused, then it might be not saved to the database.\n * Blurring the input element will trigger the change event, if the value was changed.\n *\n * Note: If the user closes the tab or browser window, then there is no guarantee that asynchronous requests\n * (XHR or fetch) will be sent. So, if the user closes the tab or browser window, then the value\n * of the input element might not be saved to the database.\n */\n #onVisibilityChange() {\n if (document.activeElement === this.#inputElement)\n this.#inputElement.blur();\n }\n\n #htmlTemplate() {\n const trailingIconName = this.getAttribute(\"data-icon\") || \"\";\n return safeHtml`\n \n ${trailingIconName}\n

`;\n }\n\n static get is() {\n return 'text-input';\n }\n}\n\n// Checking, is a custom element already defined\nif(!window.customElements.get(TextInput.is)){\n window.customElements.define(TextInput.is, TextInput);\n}\n","import {getTextWidth, safeHtml} from \"../utils.js\";\n\nexport default class ListBox extends HTMLElement {\n #listElement;\n #values = [];\n #maxItemWidth = 0;\n #selectedElementIndex = -1;\n /** @type {function|null} */\n #comparator = (a, b) => a.displayName.localeCompare(b.displayName);\n #callbacks = {\n onOptionClick: []\n }\n #preventScrollFunction;\n\n /**\n * @returns {{displayName:string}[]}\n */\n get options() {\n return this.#values;\n }\n\n /**\n * @param {{displayName:string}[]}values\n */\n set options(values) {\n this.#setValues(values);\n this.innerHTML = this.#htmlTemplate();\n this.#listElement = this.querySelector(\"ul\");\n this.#updatePosition();\n this.#addListeners();\n }\n\n /** @param {function|null} comparator */\n set comparator(comparator) {\n this.#comparator = comparator;\n }\n\n /**\n * @param {string} filter\n */\n set filter(filter) {\n const searchString = filter.toLowerCase();\n for (const li of this.querySelectorAll(\"li\")) {\n const {displayName} = this.#values[li.dataset.index];\n const indexOf = displayName.toLowerCase().indexOf(searchString);\n li.innerHTML = this.#getMarkedText(displayName, indexOf, searchString.length);\n li.toggleAttribute('hidden', indexOf === -1);\n }\n const selectedElement = this.#getSelectedElement();\n if (selectedElement) {\n if (selectedElement.hasAttribute('hidden'))\n this.#resetCurrentSelection();\n else\n selectedElement.scrollIntoView({block: \"nearest\"});\n }\n }\n\n show() {\n document.addEventListener(\"wheel\", this.#preventScrollFunction, {capture: true, passive: false});\n this.toggleAttribute('open', true)\n this.#updatePosition();\n }\n\n hide() {\n document.removeEventListener(\"wheel\", this.#preventScrollFunction, {capture: true, passive: false});\n this.toggleAttribute('open', false)\n this.#resetCurrentSelection();\n }\n\n selectNextItem() {\n const visibleElements = this.#getVisibleElements();\n if (!this.hasSelectedElement()) {\n if (visibleElements.length === 0)\n return;\n this.#setSelectedElement(visibleElements[0].dataset.index);\n } else {\n const indexOf = visibleElements.indexOf(this.#getSelectedElement());\n if (visibleElements.length - 1 <= indexOf) // is last item?\n return;\n this.#setSelectedElement(visibleElements[indexOf + 1].dataset.index);\n }\n }\n\n selectPrevItem() {\n const visibleElements = this.#getVisibleElements();\n if (!this.hasSelectedElement()) {\n if (visibleElements.length === 0)\n return;\n this.#setSelectedElement(visibleElements[visibleElements.length - 1].dataset.index);\n } else {\n const indexOf = visibleElements.indexOf(this.#getSelectedElement());\n if (indexOf === 0) // is first item?\n return;\n this.#setSelectedElement(visibleElements[indexOf - 1].dataset.index);\n }\n }\n\n triggerClickOnSelectedItem() {\n if (this.hasSelectedElement())\n this.#getSelectedElement().dispatchEvent(new MouseEvent('mousedown'));\n }\n\n hasSelectedElement() {\n return this.#getSelectedElement() != null;\n }\n\n isVisible() {\n return this.hasAttribute('open')\n }\n\n onOptionClick(cb) {\n this.#callbacks.onOptionClick.push(cb);\n }\n\n connectedCallback() {\n this.innerHTML = this.#htmlTemplate();\n this.#listElement = this.querySelector(\"ul\");\n this.#addListeners();\n // This function is needed to stop scrolling all page, except of list-box\n // Otherwise select and typeahead inputs can be scrolled, but list-box fixed in the page\n this.#preventScrollFunction = (evt)=> {\n if (!this.contains(evt.target)) {\n // When scrolling outside the list-box\n evt.stopPropagation();\n evt.preventDefault();\n } else {\n const isScrollingUp = evt.deltaY < 0;\n const isScrollingDown = evt.deltaY > 0;\n const isListScrolledToItsTop = this.#listElement.scrollTop === 0;\n const isListScrolledToItsBottom = this.#listElement.scrollTop + this.#listElement.clientHeight >= this.#listElement.scrollHeight;\n const nothingToScrollUp = isScrollingUp & isListScrolledToItsTop;\n const nothingToScrollDown = isScrollingDown & isListScrolledToItsBottom;\n if (nothingToScrollUp || nothingToScrollDown){\n evt.stopPropagation();\n evt.preventDefault();\n }\n }\n };\n }\n\n /**\n * @param {{displayName:string}[]}values\n */\n #setValues(values) {\n if (typeof this.#comparator === \"function\") {\n this.#values = [...values].sort(this.#comparator);\n } else {\n this.#values = values\n }\n }\n\n #getVisibleElements() {\n return [...this.#listElement.querySelectorAll('li:not([hidden])')];\n }\n\n #addListeners() {\n this.#listElement.addEventListener(\"mousedown\", (evt)=>{\n // When we use TypeAhead Input or Select Input in dialog and click on scroll bar, dialog takes focus\n // and list box is closed. So we need to prevent the default behavior of the mousedown event\n evt.preventDefault();\n })\n for (const li of this.querySelectorAll(\"li\")) {\n li.addEventListener('mousedown', () => {\n const option = this.#values[li.dataset.index];\n this.#callbacks.onOptionClick.forEach(cb => cb(option));\n });\n }\n }\n\n #htmlTemplate() {\n return `\n `;\n }\n\n #updatePosition() {\n const parentClientRect = this.parentElement.getBoundingClientRect();\n if (this.#maxItemWidth === 0) // calculate max item width only once\n this.#maxItemWidth = Math.max(...this.#values.map(value => getTextWidth(value.displayName)), 0);\n // if parent element width is greater than max item width, set list width to parent width\n const widthToBe = Math.max(this.#maxItemWidth + 24/*paddings*/ + 22/*scrollbar*/, parentClientRect.width);\n // max allowed width is the distance from the left side of parent element to the right side of the page\n const maxAllowedWidth = document.documentElement.clientWidth - parentClientRect.left\n if (widthToBe > maxAllowedWidth) { // can't fit to the right side, so put it to the left side\n this.#listElement.style.right = 0;\n } else {\n this.#listElement.style.right = null;\n }\n this.#listElement.style.width = `${Math.min(widthToBe, document.documentElement.clientWidth)}px`;\n this.style.width = `${Math.min(widthToBe, document.documentElement.clientWidth)}px`;\n this.style.top = `${parentClientRect.top}px`;\n }\n\n #getSelectedElement() {\n return this.querySelector(`li[data-index=\"${this.#selectedElementIndex}\"]`);\n }\n\n #setSelectedElement(elementIndex) {\n this.#resetCurrentSelection();\n this.#selectedElementIndex = elementIndex;\n const element = this.#getSelectedElement();\n element.classList.add('list-box__item--active');\n element.scrollIntoView({block: \"nearest\"});\n }\n\n #resetCurrentSelection() {\n if (this.#selectedElementIndex >= 0) {\n const selectedElement = this.#getSelectedElement();\n selectedElement.classList.remove('list-box__item--active');\n this.#selectedElementIndex = -1;\n }\n }\n\n #getMarkedText(text, startIndex, length) {\n if (startIndex >= 0) {\n const before = text.substring(0, startIndex);\n const match = text.substring(startIndex, startIndex + length);\n const after = text.substring(startIndex + length);\n // wrap whole text in span to prevent swallowing spaces\n return safeHtml`${before}${match}${after}`;\n } else {\n return text;\n }\n }\n\n static get is() {\n return 'list-box';\n }\n}\n\n// Checking, is a custom element already defined\nif(!window.customElements.get(ListBox.is)){\n window.customElements.define(ListBox.is, ListBox);\n}\n","import '../TextInput/TextInput.js';\nimport '../ListBox/ListBox.js';\nimport { KeyCode, safeHtml } from \"../utils.js\"\n\nexport default class TypeAheadInput extends HTMLElement {\n /**\n * @type {TextInput}\n */\n #inputElement;\n /**\n * @type {ListBox}\n */\n #dropdownElement;\n #currentValue;\n #lastValidValue = null;\n #shouldMatchOptions;\n #callbacks = {\n onChangeValue: []\n }\n\n connectedCallback() {\n this.innerHTML = this.#htmlTemplate();\n this.#inputElement = this.querySelector(\"text-input\");\n this.#dropdownElement = this.querySelector(\"list-box\");\n this.#shouldMatchOptions = this.hasAttribute(\"shouldMatchOptions\")\n this.#addListeners();\n }\n\n get value() {\n return this.#currentValue;\n }\n\n get rawValue() {\n return this.#inputElement.value;\n }\n\n set value(value) {\n this.#currentValue = value;\n this.#inputElement.value = value && value.displayName ? value.displayName : \"\";\n }\n\n /**\n * Sets the initial value of the input, as well as the last valid value.\n */\n set initialValue(value) {\n this.value = value;\n this.#lastValidValue = value;\n }\n\n set options(options) {\n this.#dropdownElement.options = options;\n this.#filterDatalist();\n }\n\n set errorMessage(message) {\n this.#inputElement.errorMessage = message;\n }\n\n checkValidity() {\n return this.#validate() && this.#inputElement.checkValidity();\n }\n\n onChangeValue(callback) {\n this.#callbacks.onChangeValue.push(callback);\n }\n\n /** @param {boolean} isDisabled */\n setDisabled(isDisabled) {\n this.toggleAttribute(\"disabled\", isDisabled);\n this.#inputElement.setDisabled(isDisabled);\n }\n\n\n #onInput() {\n this.errorMessage = \"\";\n this.#filterDatalist();\n if (!this.#dropdownElement.isVisible())\n this.#dropdownElement.show();\n }\n\n #onFocus() {\n this.#filterDatalist();\n this.#dropdownElement.show();\n }\n\n #onBlur() {\n this.#hideDropdownAndValidate();\n }\n\n #onOptionClick(option) {\n this.value = option;\n this.#hideDropdownAndValidate();\n }\n\n #onClearIconClick() {\n this.value = {displayName: \"\"};\n this.#inputElement.querySelector('input').focus();\n }\n\n #onKeydown(event) {\n if ([KeyCode.Up, KeyCode.Down].includes(event.code)) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n switch (event.key) {\n case KeyCode.Esc: {\n this.#hideDropdownAndValidate();\n break;\n }\n case KeyCode.Enter: {\n if (this.#dropdownElement.isVisible())\n if (this.#dropdownElement.hasSelectedElement())\n this.#dropdownElement.triggerClickOnSelectedItem();\n else\n this.#hideDropdownAndValidate();\n break;\n }\n case KeyCode.Down: {\n if (!this.#dropdownElement.isVisible())\n this.#dropdownElement.show();\n this.#dropdownElement.selectNextItem();\n break;\n }\n case KeyCode.Up: {\n if (!this.#dropdownElement.isVisible())\n this.#dropdownElement.show();\n this.#dropdownElement.selectPrevItem();\n break;\n }\n }\n }\n\n #onInputValueChange() {\n this.#validateAndNotify();\n }\n\n #hideDropdownAndValidate() {\n this.#dropdownElement.hide();\n this.#validateAndNotify();\n }\n\n #validateAndNotify() {\n if (this.#validate() && this.#isValueChanged()) {\n this.#lastValidValue = this.value;\n this.#callbacks.onChangeValue.forEach(callback => callback(this.value));\n }\n }\n\n #validate() {\n const inputText = this.#inputElement.value;\n if (inputText === \"\") {\n this.#currentValue = null;\n return true; // assume that value is valid if it is empty, otherwise required attribute should be set\n }\n if (this.value && this.value.displayName === inputText) {\n this.errorMessage = \"\";\n return true; // assume that value is valid if it is the same as the initial value\n }\n if (!this.#shouldMatchOptions) {\n this.errorMessage = \"\";\n this.#currentValue = {displayName: inputText};\n return true; // assume that value is valid if it should not match to any option\n }\n for (const option of this.#dropdownElement.options) {\n if (option.displayName === inputText) {\n this.errorMessage = \"\";\n this.#currentValue = option;\n this.#inputElement.value = option.displayName;\n return true;\n }\n }\n this.#currentValue = null;\n this.errorMessage = \"Select from list\";\n return false;\n }\n\n #filterDatalist() {\n // We use attribute \"nofiltering\" when make filtration ourselves\n if (this.hasAttribute('nofiltering'))\n return\n this.#dropdownElement.filter = this.#inputElement.value;\n }\n\n #isValueChanged() {\n return this.#lastValidValue !== this.value;\n }\n\n #addListeners() {\n const input = this.#inputElement.querySelector(\"input\");\n this.addEventListener(\"keydown\", this.#onKeydown.bind(this));\n this.addEventListener(\"keyup\", (event)=>{event.stopPropagation()});\n input.addEventListener(\"input\", this.#onInput.bind(this));\n input.addEventListener(\"blur\", this.#onBlur.bind(this));\n input.addEventListener('focus', this.#onFocus.bind(this));\n this.#inputElement.onTrailingIconClick(this.#onClearIconClick.bind(this));\n this.#inputElement.onChangeValue(this.#onInputValueChange.bind(this));\n this.#dropdownElement.onOptionClick(this.#onOptionClick.bind(this));\n }\n\n #htmlTemplate() {\n const requiredAttribute = this.hasAttribute(\"required\") ? \"required\" : \"\";\n const disabledAttribute = this.hasAttribute(\"disabled\") ? \"disabled\" : \"\";\n const iconName = this.hasAttribute(\"no-icon\") ? \"\" : \"close\";\n return safeHtml`\n \n `;\n }\n\n static get is() {\n return 'typeahead-input';\n }\n}\n\n// Checking, is a custom element already defined\nif(!window.customElements.get(TypeAheadInput.is)){\n window.customElements.define(TypeAheadInput.is, TypeAheadInput);\n}\n","import {KeyCode, safeHtml} from \"../utils.js\";\n\nexport default class SelectInput extends HTMLElement {\n #inputElement;\n #dropdownElement;\n #currentValue;\n #lastValidValue = null;\n\n #callbacks = {\n onShowDropdown: [],\n onChangeValue: []\n }\n\n get value() {\n return this.#currentValue;\n }\n\n set value(value) {\n this.#inputElement.value = value && value.displayName ? value.displayName : \"\";\n this.#currentValue = value;\n }\n\n set options(options) {\n this.#dropdownElement.options = options;\n }\n\n /** @param {function|null} comparator */\n set comparator(comparator) {\n this.#dropdownElement.comparator = comparator;\n }\n\n /** @param {boolean} isDisabled */\n setDisabled(isDisabled) {\n this.toggleAttribute(\"disabled\", isDisabled);\n this.#inputElement.setDisabled(isDisabled);\n }\n\n showDropdown() {\n this.#dropdownElement.show();\n this.#callbacks.onShowDropdown.forEach(callback => callback());\n }\n\n onShowDropdown(callback) {\n this.#callbacks.onShowDropdown.push(callback);\n }\n\n onChangeValue(callback) {\n this.#callbacks.onChangeValue.push(callback);\n }\n\n checkValidity() {\n return this.#validate();\n }\n\n connectedCallback() {\n this.innerHTML = this.#htmlTemplate();\n this.#inputElement = this.querySelector(\"text-input\");\n this.#dropdownElement = this.querySelector(\"list-box\");\n this.#addListeners();\n }\n\n #addListeners() {\n this.addEventListener(\"keydown\", this.#onKeydown.bind(this));\n const input = this.#inputElement.querySelector(\"input\");\n input.addEventListener(\"focusout\", this.#onFocusout.bind(this));\n input.addEventListener(\"click\", this.#onInputClick.bind(this));\n this.#dropdownElement.onOptionClick(this.#onOptionClick.bind(this));\n }\n\n #onFocusout() {\n this.#hideDropdownAndValidate();\n }\n\n #onOptionClick(option) {\n this.#inputElement.value = option.displayName;\n this.#currentValue = option;\n this.#hideDropdownAndValidate();\n }\n\n #onInputClick() {\n if (this.#dropdownElement.isVisible())\n this.#dropdownElement.hide()\n else this.showDropdown();\n }\n\n #onKeydown(event) {\n if ([KeyCode.Up, KeyCode.Down].includes(event.code)) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n switch (event.key) {\n case KeyCode.Esc: {\n event.preventDefault();\n this.#hideDropdownAndValidate();\n this.#inputElement.focus();\n break;\n }\n case KeyCode.Enter: {\n if (this.#dropdownElement.isVisible()) {\n event.stopPropagation();\n if (this.#dropdownElement.hasSelectedElement())\n this.#dropdownElement.triggerClickOnSelectedItem();\n else\n this.#dropdownElement.hide();\n }\n break;\n }\n case KeyCode.Down: {\n if (!this.#dropdownElement.isVisible())\n this.#dropdownElement.show();\n this.#dropdownElement.selectNextItem();\n break;\n }\n case KeyCode.Up: {\n if (!this.#dropdownElement.isVisible())\n this.#dropdownElement.show();\n this.#dropdownElement.selectPrevItem();\n break;\n }\n }\n }\n\n #hideDropdownAndValidate() {\n this.#dropdownElement.hide();\n this.#validateAndNotify();\n }\n\n #validateAndNotify() {\n if (this.#validate() && this.#lastValidValue !== this.value) {\n this.#lastValidValue = this.value;\n this.#callbacks.onChangeValue.forEach(callback => callback(this.value))\n }\n }\n\n #validate() {\n if (this.#inputElement.hasAttribute(\"required\") && !this.#inputElement.value)\n this.#inputElement.errorMessage = \"Required\";\n else\n this.#inputElement.errorMessage = \"\";\n return this.#inputElement.checkValidity();\n }\n\n #htmlTemplate() {\n const requiredAttribute = this.hasAttribute(\"required\") ? \"required\" : \"\";\n const disabledAttribute = this.hasAttribute(\"disabled\") ? \"disabled\" : \"\";\n return safeHtml`\n \n `;\n }\n\n static get is() {\n return 'select-input';\n }\n}\n\n// Checking, is a custom element already defined\nif(!window.customElements.get(SelectInput.is)){\n window.customElements.define(SelectInput.is, SelectInput);\n}\n","import {getTextWidth, KeyCode, roundToDecimalPlaces} from \"../utils.js\";\n\nexport default class EditText extends HTMLElement {\n #children;\n #isValid = true;\n #lastEnteredValue;\n #suffix = \"\";\n #prefix = \"\";\n #displayTextTransformer = (value) => value;\n\n #resizeObserver = new ResizeObserver(this.#updatePopupPosition.bind(this));\n\n #callbacks = {\n onChangeValue: []\n }\n\n connectedCallback() {\n this.innerHTML = this.#htmlTemplate();\n this.#children = {\n text: this.querySelector(\".edit-text__text\"),\n popup: this.querySelector(\".edit-text__popup\"),\n input: this.querySelector('text-input')\n };\n this.#addListeners();\n this.#resizeObserver.observe(document.body);\n this.#initAttributes();\n this.#updateTextValue();\n }\n\n disconnectedCallback() {\n this.#resizeObserver.unobserve(document.body);\n }\n\n onChange(cb) {\n this.#callbacks.onChangeValue.push(cb);\n }\n\n checkValidity() {\n return this.#children.input.checkValidity();\n }\n\n /** @param {boolean} isIncorrect */\n toggleIncorrectAttribute(isIncorrect) {\n this.toggleAttribute('incorrect', isIncorrect)\n }\n\n /**\n * @deprecated\n * @param {InputValidator} validator\n * */\n addExternalValidator(validator) {\n this.#children.input.addValidator(validator);\n }\n\n /** @param {InputValidator} validator */\n addValidator(validator) {\n this.#children.input.addValidator(validator);\n }\n\n get value() {\n return this.#children.input.value;\n }\n\n set value(value) {\n this.#children.input.value = value;\n this.#updateTextValue();\n }\n\n set displayTextTransformer(f) {\n this.#displayTextTransformer = f;\n }\n\n #getValueAttr() {\n return this.getAttribute(\"value\");\n }\n\n #getDisplayName() {\n let val = this.#displayTextTransformer(this.#getValueAttr());\n if (this.#isNumberType())\n val = +val;\n return `${this.#prefix}${val}${this.#suffix}`\n }\n\n #addListeners() {\n this.#children.text.addEventListener(\"click\", this.#showPopup.bind(this));\n // Beware of \"mousedown\" because click event still could be triggered on the element below edit-text\n this.addEventListener('click', this.#onClickOutsideOfInput.bind(this));\n this.#children.popup.addEventListener('keydown', this.#onKeydown.bind(this));\n this.#children.input.onInput(this.#onInput.bind(this));\n this.#children.popup.addEventListener(\"cancel\", this.#onEscape.bind(this));\n }\n\n #showPopup() {\n this.toggleIncorrectAttribute(false);\n this.#updateInputValue();\n this.#updatePopupPosition();\n this.#children.popup.showModal();\n this.#children.input.focus();\n }\n\n #onInput(_, isValid) {\n this.#isValid = isValid;\n }\n\n #onEscape() {\n this.#children.input.value = this.#lastEnteredValue;\n }\n\n #onEnter() {\n if (this.checkValidity()) {\n this.#children.popup.close();\n this.#updateDisplayTextAndNotifyIfChanged();\n }\n }\n\n #onClickOutsideOfInput(event) {\n event.preventDefault();\n event.stopPropagation();\n if (event.target !== this.#children.popup)\n return;\n this.#children.popup.close();\n this.#updateDisplayTextAndNotifyIfChanged();\n }\n\n #updateDisplayTextAndNotifyIfChanged() {\n if (!this.#isValid){\n this.#children.input.value = this.#getValueAttr();\n return\n }\n if (this.#getValueAttr() !== this.#children.input.value && this.#children.input.value.length) {\n this.#updateTextValue();\n this.#callbacks.onChangeValue.forEach(cb => cb(this.#getValueAttr()));\n }\n const value = this.#children.input.rawValue;\n if (value.length === 0 && !this.#children.input.hasAttribute(\"required\")) {\n this.#setEmptyValue();\n } else {\n this.#lastEnteredValue = value;\n this.#children.text.toggleAttribute('empty-value', false)\n }\n }\n\n #setEmptyValue() {\n this.#children.text.textContent = \"set\";\n this.#children.text.toggleAttribute('empty-value', true)\n this.removeAttribute('value');\n this.removeAttribute('title');\n }\n\n #onKeydown(evt) {\n evt.stopPropagation();\n if (evt.repeat) return\n if (evt.key === KeyCode.Enter && !evt.repeat && this.#isValid)\n this.#onEnter();\n }\n\n #updateInputValue() {\n if (this.hasAttribute('value')) {\n this.#lastEnteredValue = this.getAttribute(\"value\");\n this.#children.input.value = this.#lastEnteredValue;\n }\n }\n\n #updateTextValue() {\n this.setAttribute(\"value\", this.#children.input.value);\n this.setAttribute('title', this.#children.input.value);\n this.#children.text.toggleAttribute('empty-value', false)\n let value = this.#getValueAttr();\n if (typeof value === \"string\" && value.length > 0) {\n this.#children.text.textContent = this.#getDisplayName();\n } else {\n this.#setEmptyValue();\n }\n }\n\n #updatePopupPosition() {\n let {top, left} = this.getBoundingClientRect();\n this.#children.popup.style.top = top + window.scrollY + \"px\";\n this.#children.popup.style.left = left + window.scrollX + \"px\";\n if (!this.hasAttribute('max-width')) {\n this.#children.popup.style['max-width'] = Math.max(this.offsetWidth + 16, 128) + \"px\";\n } else {\n this.#children.popup.style.width = getTextWidth(this.#children.input.rawValue) + 16 + \"px\";\n }\n }\n\n #isNumberType() {\n return this.getAttribute(\"type\") === \"number\"\n }\n\n #initAttributes() {\n if (this.hasAttribute(\"suffix\"))\n this.#suffix = this.getAttribute(\"suffix\");\n if (this.hasAttribute(\"prefix\"))\n this.#prefix = this.getAttribute(\"prefix\");\n if (this.hasAttribute(\"max-width\")) {\n this.#children.popup.style['max-width'] = this.getAttribute(\"max-width\") + 'px';\n this.#children.input.style['max-width'] = this.getAttribute(\"max-width\") - 16 + 'px';\n }\n if (this.hasAttribute(\"min-width\")) {\n this.#children.popup.style['min-width'] = this.getAttribute(\"min-width\") + 'px';\n this.#children.input.style['min-width'] = this.getAttribute(\"min-width\") - 16 + 'px';\n }\n\n this.#children.input.value = this.#getValueAttr();\n if (this.hasAttribute(\"scale\"))\n this.displayTextTransformer = (text) => roundToDecimalPlaces(text, parseInt(this.getAttribute(\"scale\")));\n }\n\n #htmlTemplate() {\n const requiredAttr = this.hasAttribute(\"required\") ? \"required\" : \"\";\n const typeAttr = this.getAttribute(\"type\") || \"text\";\n let stepAttr = \"\";\n if (this.hasAttribute(\"step\"))\n stepAttr = `step=\"${this.getAttribute(\"step\")}\"`\n let minAttr = \"\";\n if (this.hasAttribute(\"min\"))\n minAttr = `min=\"${this.getAttribute(\"min\")}\"`\n let maxAttr = \"\";\n if (this.hasAttribute(\"max\"))\n maxAttr = `max=\"${this.getAttribute(\"max\")}\"`\n let minLengthAttr = \"\";\n if (this.hasAttribute(\"minlength\"))\n minLengthAttr = `minlength=\"${this.getAttribute(\"minlength\")}\"`\n let maxLengthAttr = \"\";\n if (this.hasAttribute(\"maxlength\"))\n maxLengthAttr = `maxlength=\"${this.getAttribute(\"maxlength\")}\"`\n let patternAttr = \"\";\n if (this.hasAttribute(\"pattern\"))\n patternAttr = `pattern=\"${this.getAttribute(\"pattern\")}\"`\n let numberTypeAttr = \"\";\n if (this.hasAttribute(\"number-type\"))\n numberTypeAttr = `number-type=\"${this.getAttribute(\"number-type\")}\"`\n return `\n \n \n `;\n }\n\n static get is() {\n return 'edit-text';\n }\n}\n\n// Checking, is a custom element already defined\nif (!window.customElements.get(EditText.is)) {\n window.customElements.define(EditText.is, EditText);\n}\n"],"names":["root","factory","exports","module","define","amd","self","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","TextInputValidityState","constructor","textInput","this","querySelector","isValid","errorMessage","checkValidity","setCustomValidity","validity","valid","message","badInput","customError","patternMismatch","typeMismatch","rangeOverflow","rangeUnderflow","tooLong","tooShort","valueMissing","stepMismatch","cv","assign","trimmedText","trim","hasAttribute","type","min","max","numberType","getAttribute","Number","isInteger","valueAsNumber","validityState","isTypeNumber","step","maxLength","minLength","validationMessage","KeyCode","freeze","safeHtml","strings","values","result","i","length","unsafe","String","replace","getTextWidth","text","span","document","createElement","body","appendChild","textContent","style","fontSize","visibility","position","width","Math","ceil","getBoundingClientRect","remove","TextInput","HTMLElement","static","Set","onTrailingIconClick","onChangeValue","onInput","connectedCallback","innerHTML","disconnectedCallback","setAttribute","window","removeEventListener","bind","capture","addValidator","validator","push","rawValue","isFinite","isFiniteNumber","validate","focus","callback","options","setDisabled","isDisabled","toggleAttribute","event","Up","Down","preventDefault","Enter","repeat","forEach","attribute","attributes","has","name","classList","add","addEventListener","activeElement","blur","trailingIconName","is","customElements","ListBox","a","b","displayName","localeCompare","onOptionClick","comparator","filter","searchString","toLowerCase","li","querySelectorAll","dataset","index","indexOf","selectedElement","scrollIntoView","block","show","passive","hide","selectNextItem","visibleElements","hasSelectedElement","selectPrevItem","triggerClickOnSelectedItem","dispatchEvent","MouseEvent","isVisible","cb","evt","contains","target","isScrollingUp","deltaY","isScrollingDown","isListScrolledToItsTop","scrollTop","isListScrolledToItsBottom","clientHeight","scrollHeight","stopPropagation","sort","option","map","title","join","parentClientRect","parentElement","widthToBe","maxAllowedWidth","documentElement","clientWidth","left","right","top","elementIndex","element","startIndex","before","substring","match","after","TypeAheadInput","initialValue","includes","code","stopImmediatePropagation","Esc","inputText","input","requiredAttribute","disabledAttribute","iconName","SelectInput","onShowDropdown","showDropdown","EditText","ResizeObserver","popup","observe","unobserve","onChange","toggleIncorrectAttribute","isIncorrect","addExternalValidator","displayTextTransformer","f","val","showModal","_","close","removeAttribute","scrollY","scrollX","offsetWidth","number","decimalPlaces","multiplier","pow","round","roundToDecimalPlaces","parseInt","requiredAttr","typeAttr","stepAttr","minAttr","maxAttr","minLengthAttr","maxLengthAttr","patternAttr","numberTypeAttr"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.bundle.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAA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pF5B,MAAK,EAAUyL,MAAM7L,MAAQI,MAAK,KAC9BA,KAAKuB,aAAa,WAClBvB,KAAK0M,uBAA0BxJ,GLxIpC,SAA8BkK,EAAQC,GACzC,MAAMC,EAAaxJ,KAAKyJ,IAAI,GAAIF,GAChC,OAAOvJ,KAAK0J,MAAMJ,EAASE,GAAcA,CAC7C,CKqIoDG,CAAqBvK,EAAMwK,SAAS1N,KAAK4B,aAAa,WACtG,CAEA,KACI,MAAM+L,EAAe3N,KAAKuB,aAAa,YAAc,WAAa,GAC5DqM,EAAW5N,KAAK4B,aAAa,SAAW,OAC9C,IAAIiM,EAAW,GACX7N,KAAKuB,aAAa,UAClBsM,EAAW,SAAS7N,KAAK4B,aAAa,YAC1C,IAAIkM,EAAU,GACV9N,KAAKuB,aAAa,SAClBuM,EAAU,QAAQ9N,KAAK4B,aAAa,WACxC,IAAImM,EAAU,GACV/N,KAAKuB,aAAa,SAClBwM,EAAU,QAAQ/N,KAAK4B,aAAa,WACxC,IAAIoM,EAAgB,GAChBhO,KAAKuB,aAAa,eAClByM,EAAgB,cAAchO,KAAK4B,aAAa,iBACpD,IAAIqM,EAAgB,GAChBjO,KAAKuB,aAAa,eAClB0M,EAAgB,cAAcjO,KAAK4B,aAAa,iBACpD,IAAIsM,EAAc,GACdlO,KAAKuB,aAAa,aAClB2M,EAAc,YAAYlO,KAAK4B,aAAa,eAChD,IAAIuM,EAAiB,GAGrB,OAFInO,KAAKuB,aAAa,iBAClB4M,EAAiB,gBAAgBnO,KAAK4B,aAAa,mBAChD,qUAMe+L,kCACAE,kCACAC,kCACAC,kCACAC,kCACAC,kCACAC,kCACAC,wCACMP,uEAGhC,CAEA,aAAW3G,GACP,MAAO,WACX,E,OAICpC,OAAOqC,eAAe9H,IAAI6M,EAAShF,KACpCpC,OAAOqC,eAAexI,OAAOuN,EAAShF,GAAIgF,G","sources":["webpack://elsciUi/webpack/universalModuleDefinition","webpack://elsciUi/webpack/bootstrap","webpack://elsciUi/webpack/runtime/define property getters","webpack://elsciUi/webpack/runtime/hasOwnProperty shorthand","webpack://elsciUi/webpack/runtime/make namespace object","webpack://elsciUi/./src/TextInput/TextInputValidityState.js","webpack://elsciUi/./src/utils.js","webpack://elsciUi/./src/TextInput/TextInput.js","webpack://elsciUi/./src/ListBox/ListBox.js","webpack://elsciUi/./src/TypeAheadInput/TypeAheadInput.js","webpack://elsciUi/./src/SelectInput/SelectInput.js","webpack://elsciUi/./src/EditText/EditText.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"elsciUi\"] = factory();\n\telse\n\t\troot[\"elsciUi\"] = factory();\n})(self, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export default class TextInputValidityState {\n\t#textInput;\n\t#inputElement;\n\t#isValid;\n\t#errorMessage;\n\n\tconstructor(textInput) {\n\t\tthis.#textInput = textInput\n\t\tthis.#inputElement = textInput.querySelector('input');\n\t\tthis.#isValid = true;\n\t\tthis.#errorMessage = \"\";\n\t}\n\n\tget isValid() {\n\t\treturn this.#isValid;\n\t}\n\n\tget errorMessage() {\n\t\treturn this.#errorMessage;\n\t}\n\n\tcheckValidity() {\n\t\t// reset custom validity\n\t\tthis.setCustomValidity(\"\");\n\t\tthis.#inputElement.checkValidity();\n\t\t// if the input element is valid, then check custom validity\n\t\tlet validity = this.#inputElement.validity;\n\t\tif (validity.valid) {\n\t\t\tvalidity = this.#getCustomValidity();\n\t\t}\n\t\tthis.#isValid = validity.valid;\n\t\tthis.#errorMessage = this.#getValidationMessage(validity);\n\t\treturn this.isValid;\n\t}\n\n\tsetCustomValidity(message) {\n\t\tthis.#inputElement.setCustomValidity(message);\n\t\tthis.#isValid = this.#inputElement.validity.valid;\n\t\tthis.#errorMessage = message;\n\t}\n\n\t/**\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/ValidityState\n\t * Here we add our own validation steps, and update the validity state properties.\n\t * - valueMissing: if the input element is required and the trimmed text is empty (contains only whitespaces).\n\t * - rangeUnderflow: if the input element is a number and the value is less than the min attribute.\n\t * - rangeOverflow: if the input element is a number and the value is greater than the max attribute.\n\t */\n\t#getCustomValidity() {\n\t\tconst {badInput, customError, patternMismatch, typeMismatch, valid, rangeOverflow, rangeUnderflow, tooLong,\n\t\t\ttooShort, valueMissing, stepMismatch} = this.#inputElement.validity;\n\t\tconst cv = Object.assign({},\n\t\t\t{badInput, customError, patternMismatch, typeMismatch, valid, rangeOverflow, rangeUnderflow, tooLong,\n\t\t\t\ttooShort, valueMissing, stepMismatch},\n\t\t\tthis.#isBlanknessConstraintViolated(),\n\t\t\tthis.#isRangeConstraintViolated(),\n\t\t\tthis.#isStepConstraintViolated()\n\t\t);\n\t\tcv.valid = !cv.valueMissing && !cv.rangeUnderflow && !cv.rangeOverflow && !cv.stepMismatch;\n\t\treturn cv;\n\t}\n\n\t/**\n\t * Checks if the input element is required and the trimmed text is empty (contains only whitespaces).\n\t * @returns {{valueMissing: (*|boolean)}}\n\t */\n\t#isBlanknessConstraintViolated() {\n\t\tconst trimmedText = this.#inputElement.value.trim();\n\t\treturn {valueMissing: this.#textInput.hasAttribute(\"required\") && trimmedText === \"\"};\n\t}\n\n\t/**\n\t * This is a workaround for the fact that the browser does not validate decimals properly. It takes only\n\t * first 18 digits of the decimal number and then compares it with the min and max attributes.\n\t * So if the min attribute is 0 and the value is -0.0000000000000000001, then the browser will not\n\t * consider it as a range underflow (after conversion it becomes -0 => 0).\n\t * This is why we have to check the value manually.\n\t */\n\t#isRangeConstraintViolated() {\n\t\tif (this.#inputElement.type !== \"number\")\n\t\t\treturn {rangeUnderflow: false, rangeOverflow: false};\n\t\tconst {min, max, value} = this.#inputElement;\n\t\treturn {rangeUnderflow: (min !== \"\" && +value < +min), rangeOverflow: (max !== \"\" && +value > +max)};\n\t}\n\n\t/**\n\t * This method serves to supplement internal validation to determine whether a float qualifies as an integer.\n\t * The internal validation for an input type=\"number\" step=\"1\" doesn't consistently cover all cases.\n\t * For example, the number 2.00000001 might be considered an integer by the internal validator.\n\t * So we are using attribute 'number-type=\"integer\"'\n\t * The aim is to widen this validation range. Now, the comparison for an integer works correctly when a number\n\t * has no more than 16 digits. However, if a number has 17 digits or more, this function returns incorrect result.\n\t *\n\t * We use StepMismatch property because internal validation writes this error to this property\n\t * StepMismatch property of a ValidityState object indicates if the value of an , after having been edited\n\t * by the user, does not conform to the constraints set by the element's step attribute.\n\t *\n\t * @return {{stepMismatch: boolean}}\n\t */\n\t#isStepConstraintViolated() {\n\t\tif (this.#inputElement.type !== \"number\")\n\t\t\treturn {stepMismatch: false};\n\t\tconst numberType = this.#textInput.getAttribute('number-type');\n\t\tif (!numberType || numberType !== \"integer\")\n\t\t\treturn {stepMismatch: false};\n\t\tconst stepMismatch = !Number.isInteger(this.#inputElement.valueAsNumber);\n\t\treturn {stepMismatch: stepMismatch};\n\t}\n\n\t#getValidationMessage(validityState) {\n\t\tconst isTypeNumber = this.#inputElement.type === \"number\";\n\t\tconst {badInput, rangeOverflow, rangeUnderflow, tooLong, tooShort, valueMissing, stepMismatch} = validityState;\n\t\tif (isTypeNumber && badInput)\n\t\t\treturn \"Invalid number\";\n\t\tif (isTypeNumber && stepMismatch) {\n\t\t\tif (this.#inputElement.step === \"1\" ){\n\t\t\t\t// Here we checked floats because if step is 1, then the value must be an integer.\n\t\t\t\t// Now we can use attribute 'number-type=\"integer\"', but we have previously written inputs,\n\t\t\t\t// that's why don't want to remove this code\n\t\t\t\treturn \"Must be an integer\";\n\t\t\t}\n\t\t\tconst numberType = this.#textInput.getAttribute('number-type');\n\t\t\tif (numberType && numberType === \"integer\") {\n\t\t\t\treturn \"Must be an integer\";\n\t\t\t}\n\t\t}\n\t\tif (rangeOverflow)\n\t\t\treturn \"Greater than \" + this.#inputElement.max;\n\t\tif (rangeUnderflow)\n\t\t\treturn \"Less than \" + this.#inputElement.min;\n\t\tif (tooLong)\n\t\t\treturn \"Max length is \" + this.#inputElement.maxLength;\n\t\tif (tooShort)\n\t\t\treturn \"Min length is \" + this.#inputElement.minLength;\n\t\tif (!badInput && valueMissing)\n\t\t\treturn \"Required\";\n\t\treturn this.#inputElement.validationMessage;\n\t}\n}","export const KeyCode = Object.freeze({\n \"Shift\": \"ShiftLeft\",\n \"Esc\": \"Escape\",\n \"Enter\": \"Enter\",\n \"Up\": \"ArrowUp\",\n \"Down\": \"ArrowDown\"\n});\n\n/**\n * @param {string} unsafe\n * @returns {string}\n */\nexport const safeText = (unsafe) => {\n if (!unsafe)\n return ''\n return unsafe\n .replace(/&/g, \"&\")\n .replace(//g, \">\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\");\n}\n\n/**\n * To be used when generating HTML via string interpolation e.g. {@code safeHtml`
${variables}
`} -\n * these variables will go through this function and have to be escaped should such string be shown on UI.\n *\n * @param {TemplateStringsArray} strings\n * @param {string[]} values\n * @returns {string}\n */\nexport const safeHtml = (strings, ...values) => {\n let result = strings[0];\n for (let i = 0; i < values.length; i++) {\n result += safeText(String(values[i]));\n result += strings[i + 1];\n }\n return result;\n}\n\n/* @param {String} text */\nexport function getTextWidth(text) {\n const span = document.createElement(\"span\");\n document.body.appendChild(span)\n span.textContent = text;\n span.style.fontSize = '1rem';\n span.style.visibility = 'hidden';\n span.style.position = 'absolute';\n const width = Math.ceil(span.getBoundingClientRect().width) + 1;\n span.remove();\n return width;\n}\n\nfunction getCssStyle(element, prop) {\n return window.getComputedStyle(element, null).getPropertyValue(prop);\n}\n\nexport function isFiniteNumber (value) {\n if (typeof value !== 'undefined' && Number.isFinite(value)) {\n return true\n }\n else return false\n}\n\n/**\n * Function that rounds a number to a specified number of decimal places.\n * @param {number} number\n * @param {number} decimalPlaces\n * @return {number}\n */\nexport function roundToDecimalPlaces(number, decimalPlaces) {\n const multiplier = Math.pow(10, decimalPlaces);\n return Math.round(number * multiplier) / multiplier;\n}","// @ts-check\nimport TextInputValidityState from \"./TextInputValidityState.js\";\nimport {isFiniteNumber, KeyCode, safeHtml, safeText} from \"../utils.js\"\n\n/**\n * @typedef {import(\"../InputValidator.js\").default} InputValidator\n */\nexport default class TextInput extends HTMLElement {\n static #INPUT_ATTRIBUTES = new Set([\"autocomplete\", \"autofocus\", \"disabled\", \"max\", \"maxlength\",\n \"min\", \"minlength\", \"name\", \"pattern\", \"readonly\", \"step\", \"type\", \"value\", \"placeholder\"\n /* \"required\" - we do not want to set attribute required when render text-input, because in this case all\n required inputs becomes red, as solution we just leave it in the root element and do this validation manually */]);\n /** @type {HTMLInputElement} */\n #inputElement;\n /** @type {HTMLElement} */\n #errorElement;\n /** @type {TextInputValidityState} */\n #validityState;\n #callbacks = {\n /** @type {Function[]} */\n onTrailingIconClick: [],\n /** @type {Function[]} */\n onChangeValue: [],\n /** @type {Function[]} */\n onInput: []\n };\n /** @type {string} */\n #lastChangedValue;\n /** @type {InputValidator[]} */\n #validators = [];\n\n connectedCallback() {\n this.innerHTML = this.#htmlTemplate();\n this.#inputElement = this.querySelector(\"input\");\n this.#errorElement = this.querySelector(\".text-input__error\");\n this.#validityState = new TextInputValidityState(this);\n this.#fillInputAttributes();\n this.#addListeners();\n if (this.hasAttribute(\"value\"))\n this.value = this.getAttribute(\"value\");\n }\n\n disconnectedCallback() {\n // Save value to attribute, because it will be lost after element is removed from DOM and reinserted.\n // The case is happening when user adds new element to the table and then sorts it by reinserting rows.\n this.setAttribute(\"value\", this.value);\n window.removeEventListener(\"visibilitychange\", this.#onVisibilityChange.bind(this), { capture: true });\n }\n\n /** @param {InputValidator} validator */\n addValidator(validator) {\n this.#validators.push(validator);\n }\n\n /**\n * Returns trimmed value of the input.\n * @returns {string}\n */\n get value() {\n return this.rawValue.trim();\n }\n\n /**\n * Returns raw value of the input.\n * @returns {string}\n */\n get rawValue() {\n return this.#inputElement.value;\n }\n\n /** @param {string | null} value */\n set value(value) {\n this.#inputElement.value = (isFiniteNumber(value) || typeof value == \"string\")? value : '';\n this.#lastChangedValue = this.#inputElement.value\n this.checkValidity();\n }\n\n checkValidity() {\n if (!this.#validityState.checkValidity()){\n this.errorMessage = this.#validityState.errorMessage;\n return false;\n }\n this.errorMessage = this.#validityState.errorMessage;\n for (const validator of this.#validators) {\n const result = validator.validate(this, this.value);\n if (!result.isValid) {\n this.errorMessage = result.errorMessage;\n this.focus()\n return false;\n }\n }\n return true;\n }\n\n get errorMessage() {\n return this.#errorElement.textContent;\n }\n\n set errorMessage(message) {\n // We reset lastChangedValue because if the same invalid value is entered again, we want to validate this value\n if (message){\n this.#lastChangedValue = null;\n }\n this.#validityState.setCustomValidity(message);\n this.#errorElement.textContent = this.#validityState.errorMessage;\n }\n\n /** @param {Function} callback */\n onTrailingIconClick(callback) {\n this.#callbacks.onTrailingIconClick.push(callback);\n }\n /** @param {Function} callback */\n onInput(callback) {\n this.#callbacks.onInput.push(callback);\n }\n /** @param {Function} callback */\n onChangeValue(callback) {\n this.#callbacks.onChangeValue.push(callback);\n }\n\n // @ts-ignore\n focus(options) {\n this.#inputElement.focus(options)\n }\n\n /** @param {boolean} isDisabled */\n setDisabled(isDisabled) {\n this.toggleAttribute(\"disabled\", isDisabled);\n this.#inputElement.toggleAttribute(\"disabled\", isDisabled);\n }\n\n /** @param {string} placeholderText */\n setPlaceholder(placeholderText){\n this.#inputElement.setAttribute('placeholder', safeText(placeholderText));\n this.classList.add(\"placeholder-shown\");\n }\n\n /** @param {KeyboardEvent} event */\n #onKeyDown(event) {\n if (this.#inputElement.type === \"number\" && (event.key === KeyCode.Up || event.key === KeyCode.Down))\n event.preventDefault();\n if (event.key === KeyCode.Enter && !event.repeat)\n this.#onChange();\n }\n\n #onInput() {\n const isValid = this.checkValidity();\n this.#callbacks.onInput.forEach(callback => callback(this.value, isValid));\n }\n\n #onChange() {\n // We validate if the current value is not equal to the last changed value\n if (this.#lastChangedValue !== this.value)\n this.#validateAndNotify();\n }\n\n #onTrailingIconClick() {\n this.#callbacks.onTrailingIconClick.forEach(callback => callback());\n }\n\n #validateAndNotify() {\n if (this.checkValidity()) {\n this.#lastChangedValue = this.value;\n this.#callbacks.onChangeValue.forEach(callback => callback(this.value));\n }\n }\n\n #fillInputAttributes() {\n for (const attribute of this.attributes)\n if (TextInput.#INPUT_ATTRIBUTES.has(attribute.name))\n this.#inputElement.setAttribute(attribute.name, attribute.value)\n // For number inputs, if step is not specified then it is set to 1 by default, and it is not possible to enter\n // decimal w/o validation error. So, if step is not specified, then we set it to \"any\" to allow decimal values.\n if (this.getAttribute(\"type\") === \"number\" && !this.hasAttribute(\"step\"))\n this.#inputElement.setAttribute(\"step\", \"any\");\n if (this.hasAttribute(\"placeholder\"))\n this.classList.add(\"placeholder-shown\");\n }\n\n #addListeners() {\n this.#inputElement.addEventListener(\"keydown\", this.#onKeyDown.bind(this));\n this.#inputElement.addEventListener(\"input\", this.#onInput.bind(this));\n this.#inputElement.addEventListener(\"focusout\", this.#onChange.bind(this));\n this.querySelector('.text-input__trailing-icon').addEventListener(\"click\", this.#onTrailingIconClick.bind(this));\n window.addEventListener(\"visibilitychange\", this.#onVisibilityChange.bind(this), { capture: true });\n }\n\n /**\n * This method is called when user:\n * - closes the tab\n * - closes browser window\n * - refreshes the page\n * - navigates to another page\n * - navigates to another tab\n * - minimizes the browser window\n *\n * It is needed to blur the input element, because if it is focused, then it might be not saved to the database.\n * Blurring the input element will trigger the change event, if the value was changed.\n *\n * Note: If the user closes the tab or browser window, then there is no guarantee that asynchronous requests\n * (XHR or fetch) will be sent. So, if the user closes the tab or browser window, then the value\n * of the input element might not be saved to the database.\n */\n #onVisibilityChange() {\n if (document.activeElement === this.#inputElement)\n this.#inputElement.blur();\n }\n\n #htmlTemplate() {\n const trailingIconName = this.getAttribute(\"data-icon\") || \"\";\n return safeHtml`\n \n ${trailingIconName}\n

`;\n }\n\n static get is() {\n return 'text-input';\n }\n}\n\n// Checking, is a custom element already defined\nif(!window.customElements.get(TextInput.is)){\n window.customElements.define(TextInput.is, TextInput);\n}\n","import {getTextWidth, safeHtml} from \"../utils.js\";\n\nexport default class ListBox extends HTMLElement {\n #listElement;\n #values = [];\n #maxItemWidth = 0;\n #selectedElementIndex = -1;\n /** @type {function|null} */\n #comparator = (a, b) => a.displayName.localeCompare(b.displayName);\n #callbacks = {\n onOptionClick: []\n }\n #preventScrollFunction;\n\n /**\n * @returns {{displayName:string}[]}\n */\n get options() {\n return this.#values;\n }\n\n /**\n * @param {{displayName:string}[]}values\n */\n set options(values) {\n this.#setValues(values);\n this.innerHTML = this.#htmlTemplate();\n this.#listElement = this.querySelector(\"ul\");\n this.#updatePosition();\n this.#addListeners();\n }\n\n /** @param {function|null} comparator */\n set comparator(comparator) {\n this.#comparator = comparator;\n }\n\n /**\n * @param {string} filter\n */\n set filter(filter) {\n const searchString = filter.toLowerCase();\n for (const li of this.querySelectorAll(\"li\")) {\n const {displayName} = this.#values[li.dataset.index];\n const indexOf = displayName.toLowerCase().indexOf(searchString);\n li.innerHTML = this.#getMarkedText(displayName, indexOf, searchString.length);\n li.toggleAttribute('hidden', indexOf === -1);\n }\n const selectedElement = this.#getSelectedElement();\n if (selectedElement) {\n if (selectedElement.hasAttribute('hidden'))\n this.#resetCurrentSelection();\n else\n selectedElement.scrollIntoView({block: \"nearest\"});\n }\n }\n\n show() {\n document.addEventListener(\"wheel\", this.#preventScrollFunction, {capture: true, passive: false});\n this.toggleAttribute('open', true)\n this.#updatePosition();\n }\n\n hide() {\n document.removeEventListener(\"wheel\", this.#preventScrollFunction, {capture: true, passive: false});\n this.toggleAttribute('open', false)\n this.#resetCurrentSelection();\n }\n\n selectNextItem() {\n const visibleElements = this.#getVisibleElements();\n if (!this.hasSelectedElement()) {\n if (visibleElements.length === 0)\n return;\n this.#setSelectedElement(visibleElements[0].dataset.index);\n } else {\n const indexOf = visibleElements.indexOf(this.#getSelectedElement());\n if (visibleElements.length - 1 <= indexOf) // is last item?\n return;\n this.#setSelectedElement(visibleElements[indexOf + 1].dataset.index);\n }\n }\n\n selectPrevItem() {\n const visibleElements = this.#getVisibleElements();\n if (!this.hasSelectedElement()) {\n if (visibleElements.length === 0)\n return;\n this.#setSelectedElement(visibleElements[visibleElements.length - 1].dataset.index);\n } else {\n const indexOf = visibleElements.indexOf(this.#getSelectedElement());\n if (indexOf === 0) // is first item?\n return;\n this.#setSelectedElement(visibleElements[indexOf - 1].dataset.index);\n }\n }\n\n triggerClickOnSelectedItem() {\n if (this.hasSelectedElement())\n this.#getSelectedElement().dispatchEvent(new MouseEvent('mousedown'));\n }\n\n hasSelectedElement() {\n return this.#getSelectedElement() != null;\n }\n\n isVisible() {\n return this.hasAttribute('open')\n }\n\n onOptionClick(cb) {\n this.#callbacks.onOptionClick.push(cb);\n }\n\n connectedCallback() {\n this.innerHTML = this.#htmlTemplate();\n this.#listElement = this.querySelector(\"ul\");\n this.#addListeners();\n // This function is needed to stop scrolling all page, except of list-box\n // Otherwise select and typeahead inputs can be scrolled, but list-box fixed in the page\n this.#preventScrollFunction = (evt)=> {\n if (!this.contains(evt.target)) {\n // When scrolling outside the list-box\n evt.stopPropagation();\n evt.preventDefault();\n } else {\n const isScrollingUp = evt.deltaY < 0;\n const isScrollingDown = evt.deltaY > 0;\n const isListScrolledToItsTop = this.#listElement.scrollTop === 0;\n const isListScrolledToItsBottom = this.#listElement.scrollTop + this.#listElement.clientHeight >= this.#listElement.scrollHeight;\n const nothingToScrollUp = isScrollingUp & isListScrolledToItsTop;\n const nothingToScrollDown = isScrollingDown & isListScrolledToItsBottom;\n if (nothingToScrollUp || nothingToScrollDown){\n evt.stopPropagation();\n evt.preventDefault();\n }\n }\n };\n }\n\n /**\n * @param {{displayName:string}[]}values\n */\n #setValues(values) {\n if (typeof this.#comparator === \"function\") {\n this.#values = [...values].sort(this.#comparator);\n } else {\n this.#values = values\n }\n }\n\n #getVisibleElements() {\n return [...this.#listElement.querySelectorAll('li:not([hidden])')];\n }\n\n #addListeners() {\n this.#listElement.addEventListener(\"mousedown\", (evt)=>{\n // When we use TypeAhead Input or Select Input in dialog and click on scroll bar, dialog takes focus\n // and list box is closed. So we need to prevent the default behavior of the mousedown event\n evt.preventDefault();\n })\n for (const li of this.querySelectorAll(\"li\")) {\n li.addEventListener('mousedown', () => {\n const option = this.#values[li.dataset.index];\n this.#callbacks.onOptionClick.forEach(cb => cb(option));\n });\n }\n }\n\n #htmlTemplate() {\n return `\n
    \n ${this.#values.map((value, i) =>\n safeHtml`
  • ${value.displayName}
  • `\n ).join('')}\n
`;\n }\n\n #updatePosition() {\n const parentClientRect = this.parentElement.getBoundingClientRect();\n if (this.#maxItemWidth === 0) // calculate max item width only once\n this.#maxItemWidth = Math.max(...this.#values.map(value => getTextWidth(value.displayName)), 0);\n // if parent element width is greater than max item width, set list width to parent width\n const widthToBe = Math.max(this.#maxItemWidth + 24/*paddings*/ + 22/*scrollbar*/, parentClientRect.width);\n // max allowed width is the distance from the left side of parent element to the right side of the page\n const maxAllowedWidth = document.documentElement.clientWidth - parentClientRect.left\n if (widthToBe > maxAllowedWidth) { // can't fit to the right side, so put it to the left side\n this.#listElement.style.right = 0;\n } else {\n this.#listElement.style.right = null;\n }\n this.#listElement.style.width = `${Math.min(widthToBe, document.documentElement.clientWidth)}px`;\n this.style.width = `${Math.min(widthToBe, document.documentElement.clientWidth)}px`;\n this.style.top = `${parentClientRect.top}px`;\n }\n\n #getSelectedElement() {\n return this.querySelector(`li[data-index=\"${this.#selectedElementIndex}\"]`);\n }\n\n #setSelectedElement(elementIndex) {\n this.#resetCurrentSelection();\n this.#selectedElementIndex = elementIndex;\n const element = this.#getSelectedElement();\n element.classList.add('list-box__item--active');\n element.scrollIntoView({block: \"nearest\"});\n }\n\n #resetCurrentSelection() {\n if (this.#selectedElementIndex >= 0) {\n const selectedElement = this.#getSelectedElement();\n selectedElement.classList.remove('list-box__item--active');\n this.#selectedElementIndex = -1;\n }\n }\n\n #getMarkedText(text, startIndex, length) {\n if (startIndex >= 0) {\n const before = text.substring(0, startIndex);\n const match = text.substring(startIndex, startIndex + length);\n const after = text.substring(startIndex + length);\n // wrap whole text in span to prevent swallowing spaces\n return safeHtml`${before}${match}${after}`;\n } else {\n return text;\n }\n }\n\n static get is() {\n return 'list-box';\n }\n}\n\n// Checking, is a custom element already defined\nif(!window.customElements.get(ListBox.is)){\n window.customElements.define(ListBox.is, ListBox);\n}\n","import '../TextInput/TextInput.js';\nimport '../ListBox/ListBox.js';\nimport { KeyCode, safeHtml } from \"../utils.js\"\n\nexport default class TypeAheadInput extends HTMLElement {\n /**\n * @type {TextInput}\n */\n #inputElement;\n /**\n * @type {ListBox}\n */\n #dropdownElement;\n #currentValue;\n #lastValidValue = null;\n #shouldMatchOptions;\n #callbacks = {\n onChangeValue: []\n }\n\n connectedCallback() {\n this.innerHTML = this.#htmlTemplate();\n this.#inputElement = this.querySelector(\"text-input\");\n this.#dropdownElement = this.querySelector(\"list-box\");\n this.#shouldMatchOptions = this.hasAttribute(\"shouldMatchOptions\")\n this.#addListeners();\n }\n\n get value() {\n return this.#currentValue;\n }\n\n get rawValue() {\n return this.#inputElement.value;\n }\n\n set value(value) {\n this.#currentValue = value;\n this.#inputElement.value = value && value.displayName ? value.displayName : \"\";\n }\n\n /**\n * Sets the initial value of the input, as well as the last valid value.\n */\n set initialValue(value) {\n this.value = value;\n this.#lastValidValue = value;\n }\n\n set options(options) {\n this.#dropdownElement.options = options;\n this.#filterDatalist();\n }\n\n set errorMessage(message) {\n this.#inputElement.errorMessage = message;\n }\n\n checkValidity() {\n return this.#validate() && this.#inputElement.checkValidity();\n }\n\n onChangeValue(callback) {\n this.#callbacks.onChangeValue.push(callback);\n }\n\n /** @param {boolean} isDisabled */\n setDisabled(isDisabled) {\n this.toggleAttribute(\"disabled\", isDisabled);\n this.#inputElement.setDisabled(isDisabled);\n }\n\n\n #onInput() {\n this.errorMessage = \"\";\n this.#filterDatalist();\n if (!this.#dropdownElement.isVisible())\n this.#dropdownElement.show();\n }\n\n #onFocus() {\n this.#filterDatalist();\n this.#dropdownElement.show();\n }\n\n #onBlur() {\n this.#hideDropdownAndValidate();\n }\n\n #onOptionClick(option) {\n this.value = option;\n this.#hideDropdownAndValidate();\n }\n\n #onClearIconClick() {\n this.value = {displayName: \"\"};\n this.#inputElement.querySelector('input').focus();\n }\n\n #onKeydown(event) {\n if ([KeyCode.Up, KeyCode.Down].includes(event.code)) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n switch (event.key) {\n case KeyCode.Esc: {\n this.#hideDropdownAndValidate();\n break;\n }\n case KeyCode.Enter: {\n if (this.#dropdownElement.isVisible())\n if (this.#dropdownElement.hasSelectedElement())\n this.#dropdownElement.triggerClickOnSelectedItem();\n else\n this.#hideDropdownAndValidate();\n break;\n }\n case KeyCode.Down: {\n if (!this.#dropdownElement.isVisible())\n this.#dropdownElement.show();\n this.#dropdownElement.selectNextItem();\n break;\n }\n case KeyCode.Up: {\n if (!this.#dropdownElement.isVisible())\n this.#dropdownElement.show();\n this.#dropdownElement.selectPrevItem();\n break;\n }\n }\n }\n\n #onInputValueChange() {\n this.#validateAndNotify();\n }\n\n #hideDropdownAndValidate() {\n this.#dropdownElement.hide();\n this.#validateAndNotify();\n }\n\n #validateAndNotify() {\n if (this.#validate() && this.#isValueChanged()) {\n this.#lastValidValue = this.value;\n this.#callbacks.onChangeValue.forEach(callback => callback(this.value));\n }\n }\n\n #validate() {\n const inputText = this.#inputElement.value;\n if (inputText === \"\") {\n this.#currentValue = null;\n return true; // assume that value is valid if it is empty, otherwise required attribute should be set\n }\n if (this.value && this.value.displayName === inputText) {\n this.errorMessage = \"\";\n return true; // assume that value is valid if it is the same as the initial value\n }\n if (!this.#shouldMatchOptions) {\n this.errorMessage = \"\";\n this.#currentValue = {displayName: inputText};\n return true; // assume that value is valid if it should not match to any option\n }\n for (const option of this.#dropdownElement.options) {\n if (option.displayName === inputText) {\n this.errorMessage = \"\";\n this.#currentValue = option;\n this.#inputElement.value = option.displayName;\n return true;\n }\n }\n this.#currentValue = null;\n this.errorMessage = \"Select from list\";\n return false;\n }\n\n #filterDatalist() {\n // We use attribute \"nofiltering\" when make filtration ourselves\n if (this.hasAttribute('nofiltering'))\n return\n this.#dropdownElement.filter = this.#inputElement.value;\n }\n\n #isValueChanged() {\n return this.#lastValidValue !== this.value;\n }\n\n #addListeners() {\n const input = this.#inputElement.querySelector(\"input\");\n this.addEventListener(\"keydown\", this.#onKeydown.bind(this));\n this.addEventListener(\"keyup\", (event)=>{event.stopPropagation()});\n input.addEventListener(\"input\", this.#onInput.bind(this));\n input.addEventListener(\"blur\", this.#onBlur.bind(this));\n input.addEventListener('focus', this.#onFocus.bind(this));\n this.#inputElement.onTrailingIconClick(this.#onClearIconClick.bind(this));\n this.#inputElement.onChangeValue(this.#onInputValueChange.bind(this));\n this.#dropdownElement.onOptionClick(this.#onOptionClick.bind(this));\n }\n\n #htmlTemplate() {\n const requiredAttribute = this.hasAttribute(\"required\") ? \"required\" : \"\";\n const disabledAttribute = this.hasAttribute(\"disabled\") ? \"disabled\" : \"\";\n const iconName = this.hasAttribute(\"no-icon\") ? \"\" : \"close\";\n return safeHtml`\n \n `;\n }\n\n static get is() {\n return 'typeahead-input';\n }\n}\n\n// Checking, is a custom element already defined\nif(!window.customElements.get(TypeAheadInput.is)){\n window.customElements.define(TypeAheadInput.is, TypeAheadInput);\n}\n","import {KeyCode} from \"../utils.js\";\n\nexport default class SelectInput extends HTMLElement {\n #inputElement;\n #dropdownElement;\n #currentValue;\n #lastValidValue = null;\n\n #callbacks = {\n onShowDropdown: [],\n onChangeValue: []\n }\n\n get value() {\n return this.#currentValue;\n }\n\n set value(value) {\n this.#inputElement.value = value && value.displayName ? value.displayName : \"\";\n this.#currentValue = value;\n }\n\n set options(options) {\n this.#dropdownElement.options = options;\n }\n\n /** @param {function|null} comparator */\n set comparator(comparator) {\n this.#dropdownElement.comparator = comparator;\n }\n\n /** @param {boolean} isDisabled */\n setDisabled(isDisabled) {\n this.toggleAttribute(\"disabled\", isDisabled);\n this.#inputElement.setDisabled(isDisabled);\n }\n\n /** @param {string} placeholderText */\n setPlaceholder(placeholderText){\n this.#inputElement.setPlaceholder(placeholderText);\n }\n\n showDropdown() {\n this.#dropdownElement.show();\n this.#callbacks.onShowDropdown.forEach(callback => callback());\n }\n\n onShowDropdown(callback) {\n this.#callbacks.onShowDropdown.push(callback);\n }\n\n onChangeValue(callback) {\n this.#callbacks.onChangeValue.push(callback);\n }\n\n checkValidity() {\n return this.#validate();\n }\n\n connectedCallback() {\n this.innerHTML = this.#htmlTemplate();\n this.#inputElement = this.querySelector(\"text-input\");\n this.#dropdownElement = this.querySelector(\"list-box\");\n this.#addListeners();\n }\n\n #addListeners() {\n this.addEventListener(\"keydown\", this.#onKeydown.bind(this));\n const input = this.#inputElement.querySelector(\"input\");\n input.addEventListener(\"focusout\", this.#onFocusout.bind(this));\n input.addEventListener(\"click\", this.#onInputClick.bind(this));\n this.#dropdownElement.onOptionClick(this.#onOptionClick.bind(this));\n }\n\n #onFocusout() {\n this.#hideDropdownAndValidate();\n }\n\n #onOptionClick(option) {\n this.#inputElement.value = option.displayName;\n this.#currentValue = option;\n this.#hideDropdownAndValidate();\n }\n\n #onInputClick() {\n if (this.#dropdownElement.isVisible())\n this.#dropdownElement.hide()\n else this.showDropdown();\n }\n\n #onKeydown(event) {\n if ([KeyCode.Up, KeyCode.Down].includes(event.code)) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n switch (event.key) {\n case KeyCode.Esc: {\n event.preventDefault();\n this.#hideDropdownAndValidate();\n this.#inputElement.focus();\n break;\n }\n case KeyCode.Enter: {\n if (this.#dropdownElement.isVisible()) {\n event.stopPropagation();\n if (this.#dropdownElement.hasSelectedElement())\n this.#dropdownElement.triggerClickOnSelectedItem();\n else\n this.#dropdownElement.hide();\n }\n break;\n }\n case KeyCode.Down: {\n if (!this.#dropdownElement.isVisible())\n this.#dropdownElement.show();\n this.#dropdownElement.selectNextItem();\n break;\n }\n case KeyCode.Up: {\n if (!this.#dropdownElement.isVisible())\n this.#dropdownElement.show();\n this.#dropdownElement.selectPrevItem();\n break;\n }\n }\n }\n\n #hideDropdownAndValidate() {\n this.#dropdownElement.hide();\n this.#validateAndNotify();\n }\n\n #validateAndNotify() {\n if (this.#validate() && this.#lastValidValue !== this.value) {\n this.#lastValidValue = this.value;\n this.#callbacks.onChangeValue.forEach(callback => callback(this.value))\n }\n }\n\n #validate() {\n if (this.#inputElement.hasAttribute(\"required\") && !this.#inputElement.value)\n this.#inputElement.errorMessage = \"Required\";\n else\n this.#inputElement.errorMessage = \"\";\n return this.#inputElement.checkValidity();\n }\n\n #htmlTemplate() {\n const requiredAttribute = this.hasAttribute(\"required\") ? \"required\" : \"\";\n const disabledAttribute = this.hasAttribute(\"disabled\") ? \"disabled\" : \"\";\n return safeHtml`\n \n `;\n }\n\n static get is() {\n return 'select-input';\n }\n}\n\n// Checking, is a custom element already defined\nif(!window.customElements.get(SelectInput.is)){\n window.customElements.define(SelectInput.is, SelectInput);\n}\n","import {getTextWidth, KeyCode, roundToDecimalPlaces} from \"../utils.js\";\n\nexport default class EditText extends HTMLElement {\n #children;\n #isValid = true;\n #lastEnteredValue;\n #suffix = \"\";\n #prefix = \"\";\n #displayTextTransformer = (value) => value;\n\n #resizeObserver = new ResizeObserver(this.#updatePopupPosition.bind(this));\n\n #callbacks = {\n onChangeValue: []\n }\n\n connectedCallback() {\n this.innerHTML = this.#htmlTemplate();\n this.#children = {\n text: this.querySelector(\".edit-text__text\"),\n popup: this.querySelector(\".edit-text__popup\"),\n input: this.querySelector('text-input')\n };\n this.#addListeners();\n this.#resizeObserver.observe(document.body);\n this.#initAttributes();\n this.#updateTextValue();\n }\n\n disconnectedCallback() {\n this.#resizeObserver.unobserve(document.body);\n }\n\n onChange(cb) {\n this.#callbacks.onChangeValue.push(cb);\n }\n\n checkValidity() {\n return this.#children.input.checkValidity();\n }\n\n /** @param {boolean} isIncorrect */\n toggleIncorrectAttribute(isIncorrect) {\n this.toggleAttribute('incorrect', isIncorrect)\n }\n\n /**\n * @deprecated\n * @param {InputValidator} validator\n * */\n addExternalValidator(validator) {\n this.#children.input.addValidator(validator);\n }\n\n /** @param {InputValidator} validator */\n addValidator(validator) {\n this.#children.input.addValidator(validator);\n }\n\n get value() {\n return this.#children.input.value;\n }\n\n set value(value) {\n this.#children.input.value = value;\n this.#updateTextValue();\n }\n\n set displayTextTransformer(f) {\n this.#displayTextTransformer = f;\n }\n\n #getValueAttr() {\n return this.getAttribute(\"value\");\n }\n\n #getDisplayName() {\n let val = this.#displayTextTransformer(this.#getValueAttr());\n if (this.#isNumberType())\n val = +val;\n return `${this.#prefix}${val}${this.#suffix}`\n }\n\n #addListeners() {\n this.#children.text.addEventListener(\"click\", this.#showPopup.bind(this));\n // Beware of \"mousedown\" because click event still could be triggered on the element below edit-text\n this.addEventListener('click', this.#onClickOutsideOfInput.bind(this));\n this.#children.popup.addEventListener('keydown', this.#onKeydown.bind(this));\n this.#children.input.onInput(this.#onInput.bind(this));\n this.#children.popup.addEventListener(\"cancel\", this.#onEscape.bind(this));\n }\n\n #showPopup() {\n this.toggleIncorrectAttribute(false);\n this.#updateInputValue();\n this.#updatePopupPosition();\n this.#children.popup.showModal();\n this.#children.input.focus();\n }\n\n #onInput(_, isValid) {\n this.#isValid = isValid;\n }\n\n #onEscape() {\n this.#children.input.value = this.#lastEnteredValue;\n }\n\n #onEnter() {\n if (this.checkValidity()) {\n this.#children.popup.close();\n this.#updateDisplayTextAndNotifyIfChanged();\n }\n }\n\n #onClickOutsideOfInput(event) {\n event.preventDefault();\n event.stopPropagation();\n if (event.target !== this.#children.popup)\n return;\n this.#children.popup.close();\n this.#updateDisplayTextAndNotifyIfChanged();\n }\n\n #updateDisplayTextAndNotifyIfChanged() {\n if (!this.#isValid){\n this.#children.input.value = this.#getValueAttr();\n return\n }\n if (this.#getValueAttr() !== this.#children.input.value && this.#children.input.value.length) {\n this.#updateTextValue();\n this.#callbacks.onChangeValue.forEach(cb => cb(this.#getValueAttr()));\n }\n const value = this.#children.input.rawValue;\n if (value.length === 0 && !this.#children.input.hasAttribute(\"required\")) {\n this.#setEmptyValue();\n } else {\n this.#lastEnteredValue = value;\n this.#children.text.toggleAttribute('empty-value', false)\n }\n }\n\n #setEmptyValue() {\n this.#children.text.textContent = \"set\";\n this.#children.text.toggleAttribute('empty-value', true)\n this.removeAttribute('value');\n this.removeAttribute('title');\n }\n\n #onKeydown(evt) {\n evt.stopPropagation();\n if (evt.repeat) return\n if (evt.key === KeyCode.Enter && !evt.repeat && this.#isValid)\n this.#onEnter();\n }\n\n #updateInputValue() {\n if (this.hasAttribute('value')) {\n this.#lastEnteredValue = this.getAttribute(\"value\");\n this.#children.input.value = this.#lastEnteredValue;\n }\n }\n\n #updateTextValue() {\n this.setAttribute(\"value\", this.#children.input.value);\n this.setAttribute('title', this.#children.input.value);\n this.#children.text.toggleAttribute('empty-value', false)\n let value = this.#getValueAttr();\n if (typeof value === \"string\" && value.length > 0) {\n this.#children.text.textContent = this.#getDisplayName();\n } else {\n this.#setEmptyValue();\n }\n }\n\n #updatePopupPosition() {\n let {top, left} = this.getBoundingClientRect();\n this.#children.popup.style.top = top + window.scrollY + \"px\";\n this.#children.popup.style.left = left + window.scrollX + \"px\";\n if (!this.hasAttribute('max-width')) {\n this.#children.popup.style['max-width'] = Math.max(this.offsetWidth + 16, 128) + \"px\";\n } else {\n this.#children.popup.style.width = getTextWidth(this.#children.input.rawValue) + 16 + \"px\";\n }\n }\n\n #isNumberType() {\n return this.getAttribute(\"type\") === \"number\"\n }\n\n #initAttributes() {\n if (this.hasAttribute(\"suffix\"))\n this.#suffix = this.getAttribute(\"suffix\");\n if (this.hasAttribute(\"prefix\"))\n this.#prefix = this.getAttribute(\"prefix\");\n if (this.hasAttribute(\"max-width\")) {\n this.#children.popup.style['max-width'] = this.getAttribute(\"max-width\") + 'px';\n this.#children.input.style['max-width'] = this.getAttribute(\"max-width\") - 16 + 'px';\n }\n if (this.hasAttribute(\"min-width\")) {\n this.#children.popup.style['min-width'] = this.getAttribute(\"min-width\") + 'px';\n this.#children.input.style['min-width'] = this.getAttribute(\"min-width\") - 16 + 'px';\n }\n\n this.#children.input.value = this.#getValueAttr();\n if (this.hasAttribute(\"scale\"))\n this.displayTextTransformer = (text) => roundToDecimalPlaces(text, parseInt(this.getAttribute(\"scale\")));\n }\n\n #htmlTemplate() {\n const requiredAttr = this.hasAttribute(\"required\") ? \"required\" : \"\";\n const typeAttr = this.getAttribute(\"type\") || \"text\";\n let stepAttr = \"\";\n if (this.hasAttribute(\"step\"))\n stepAttr = `step=\"${this.getAttribute(\"step\")}\"`\n let minAttr = \"\";\n if (this.hasAttribute(\"min\"))\n minAttr = `min=\"${this.getAttribute(\"min\")}\"`\n let maxAttr = \"\";\n if (this.hasAttribute(\"max\"))\n maxAttr = `max=\"${this.getAttribute(\"max\")}\"`\n let minLengthAttr = \"\";\n if (this.hasAttribute(\"minlength\"))\n minLengthAttr = `minlength=\"${this.getAttribute(\"minlength\")}\"`\n let maxLengthAttr = \"\";\n if (this.hasAttribute(\"maxlength\"))\n maxLengthAttr = `maxlength=\"${this.getAttribute(\"maxlength\")}\"`\n let patternAttr = \"\";\n if (this.hasAttribute(\"pattern\"))\n patternAttr = `pattern=\"${this.getAttribute(\"pattern\")}\"`\n let numberTypeAttr = \"\";\n if (this.hasAttribute(\"number-type\"))\n numberTypeAttr = `number-type=\"${this.getAttribute(\"number-type\")}\"`\n return `\n \n \n `;\n }\n\n static get is() {\n return 'edit-text';\n }\n}\n\n// Checking, is a custom element already defined\nif (!window.customElements.get(EditText.is)) {\n window.customElements.define(EditText.is, EditText);\n}\n"],"names":["root","factory","exports","module","define","amd","self","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","TextInputValidityState","constructor","textInput","this","querySelector","isValid","errorMessage","checkValidity","setCustomValidity","validity","valid","message","badInput","customError","patternMismatch","typeMismatch","rangeOverflow","rangeUnderflow","tooLong","tooShort","valueMissing","stepMismatch","cv","assign","trimmedText","trim","hasAttribute","type","min","max","numberType","getAttribute","Number","isInteger","valueAsNumber","validityState","isTypeNumber","step","maxLength","minLength","validationMessage","KeyCode","freeze","safeText","unsafe","replace","strings","values","result","i","length","String","getTextWidth","text","span","document","createElement","body","appendChild","textContent","style","fontSize","visibility","position","width","Math","ceil","getBoundingClientRect","remove","TextInput","HTMLElement","static","Set","onTrailingIconClick","onChangeValue","onInput","connectedCallback","innerHTML","disconnectedCallback","setAttribute","window","removeEventListener","bind","capture","addValidator","validator","push","rawValue","isFinite","isFiniteNumber","validate","focus","callback","options","setDisabled","isDisabled","toggleAttribute","setPlaceholder","placeholderText","classList","add","event","Up","Down","preventDefault","Enter","repeat","forEach","attribute","attributes","has","name","addEventListener","activeElement","blur","trailingIconName","is","customElements","ListBox","a","b","displayName","localeCompare","onOptionClick","comparator","filter","searchString","toLowerCase","li","querySelectorAll","dataset","index","indexOf","selectedElement","scrollIntoView","block","show","passive","hide","selectNextItem","visibleElements","hasSelectedElement","selectPrevItem","triggerClickOnSelectedItem","dispatchEvent","MouseEvent","isVisible","cb","evt","contains","target","isScrollingUp","deltaY","isScrollingDown","isListScrolledToItsTop","scrollTop","isListScrolledToItsBottom","clientHeight","scrollHeight","stopPropagation","sort","option","map","title","join","parentClientRect","parentElement","widthToBe","maxAllowedWidth","documentElement","clientWidth","left","right","top","elementIndex","element","startIndex","before","substring","match","after","TypeAheadInput","initialValue","includes","code","stopImmediatePropagation","Esc","inputText","input","requiredAttribute","disabledAttribute","iconName","SelectInput","onShowDropdown","showDropdown","safeHtml","EditText","ResizeObserver","popup","observe","unobserve","onChange","toggleIncorrectAttribute","isIncorrect","addExternalValidator","displayTextTransformer","f","val","showModal","_","close","removeAttribute","scrollY","scrollX","offsetWidth","number","decimalPlaces","multiplier","pow","round","roundToDecimalPlaces","parseInt","requiredAttr","typeAttr","stepAttr","minAttr","maxAttr","minLengthAttr","maxLengthAttr","patternAttr","numberTypeAttr"],"sourceRoot":""} \ No newline at end of file diff --git a/tmp_tsoutput/SelectInput/SelectInput.d.ts b/tmp_tsoutput/SelectInput/SelectInput.d.ts index 1302461..d24dc4d 100644 --- a/tmp_tsoutput/SelectInput/SelectInput.d.ts +++ b/tmp_tsoutput/SelectInput/SelectInput.d.ts @@ -7,6 +7,8 @@ export default class SelectInput extends HTMLElement { set comparator(arg: Function); /** @param {boolean} isDisabled */ setDisabled(isDisabled: boolean): void; + /** @param {string} placeholderText */ + setPlaceholder(placeholderText: string): void; showDropdown(): void; onShowDropdown(callback: any): void; onChangeValue(callback: any): void; diff --git a/tmp_tsoutput/SelectInput/SelectInput.js b/tmp_tsoutput/SelectInput/SelectInput.js index 168fbad..4fc04da 100644 --- a/tmp_tsoutput/SelectInput/SelectInput.js +++ b/tmp_tsoutput/SelectInput/SelectInput.js @@ -1,4 +1,4 @@ -import { KeyCode, safeHtml } from "../utils.js"; +import { KeyCode } from "../utils.js"; export default class SelectInput extends HTMLElement { #inputElement; #dropdownElement; @@ -27,6 +27,10 @@ export default class SelectInput extends HTMLElement { this.toggleAttribute("disabled", isDisabled); this.#inputElement.setDisabled(isDisabled); } + /** @param {string} placeholderText */ + setPlaceholder(placeholderText) { + this.#inputElement.setPlaceholder(placeholderText); + } showDropdown() { this.#dropdownElement.show(); this.#callbacks.onShowDropdown.forEach(callback => callback()); diff --git a/tmp_tsoutput/TextInput/TextInput.d.ts b/tmp_tsoutput/TextInput/TextInput.d.ts index b7f1c47..35ae14b 100644 --- a/tmp_tsoutput/TextInput/TextInput.d.ts +++ b/tmp_tsoutput/TextInput/TextInput.d.ts @@ -32,6 +32,8 @@ export default class TextInput extends HTMLElement { focus(options: any): void; /** @param {boolean} isDisabled */ setDisabled(isDisabled: boolean): void; + /** @param {string} placeholderText */ + setPlaceholder(placeholderText: string): void; #private; } export type InputValidator = import("../InputValidator.js").default; diff --git a/tmp_tsoutput/TextInput/TextInput.js b/tmp_tsoutput/TextInput/TextInput.js index 25d33a4..8b96dc7 100644 --- a/tmp_tsoutput/TextInput/TextInput.js +++ b/tmp_tsoutput/TextInput/TextInput.js @@ -1,6 +1,6 @@ // @ts-check import TextInputValidityState from "./TextInputValidityState.js"; -import { isFiniteNumber, KeyCode, safeHtml } from "../utils.js"; +import { isFiniteNumber, KeyCode, safeHtml, safeText } from "../utils.js"; /** * @typedef {import("../InputValidator.js").default} InputValidator */ @@ -116,6 +116,11 @@ export default class TextInput extends HTMLElement { this.toggleAttribute("disabled", isDisabled); this.#inputElement.toggleAttribute("disabled", isDisabled); } + /** @param {string} placeholderText */ + setPlaceholder(placeholderText) { + this.#inputElement.setAttribute('placeholder', safeText(placeholderText)); + this.classList.add("placeholder-shown"); + } /** @param {KeyboardEvent} event */ #onKeyDown(event) { if (this.#inputElement.type === "number" && (event.key === KeyCode.Up || event.key === KeyCode.Down))