tsgrid-ui 2.7.0 → 2.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/dist/tsgrid-ui.css +2 -2
- package/dist/tsgrid-ui.es6.js +7 -8
- package/dist/tsgrid-ui.es6.js.map +1 -1
- package/dist/tsgrid-ui.es6.min.js +1 -1
- package/dist/tsgrid-ui.js +8 -9
- package/dist/tsgrid-ui.min.css +2 -2
- package/dist/tsgrid-ui.min.js +2 -2
- package/package.json +1 -1
|
@@ -24,7 +24,7 @@ var Ce={locale:"en-US",dateFormat:"m/d/yyyy",timeFormat:"hh:mi pm",datetimeForma
|
|
|
24
24
|
<label>${t.label} </label>
|
|
25
25
|
<input id="TsPrompt" class="tsg-input" ${t.attrs??""}
|
|
26
26
|
data-keydown="keydown|event" data-keyup="change|event">
|
|
27
|
-
</div>`),s.normButtons(t,{ok:s.lang("Ok"),cancel:s.lang("Cancel")});let i=s.message(n,t);return i&&(i.change=function(o){return i.self?.on?.("change.prom",o),i},i.action(o=>{o.detail?.self?.close?.()}).then(o=>{let l=o.detail;(l?.self).input=G(l?.box).find("#TsPrompt").get(0),G(l?.box).find("#TsPrompt").on("keydown",a=>{a.keyCode==13&&a.shiftKey===!1&&a.preventDefault()}).on("keyup",a=>{let r=l?.self,c=r?.trigger?.("change",{value:a.target.value,input:a.target,originalEvent:a});a.keyCode==13&&a.shiftKey===!1&&r?.action?.("Ok",a),c?.finish?.()})})),i}var K=j;function Ft(n,e,s,t){return new Promise((i,o)=>{let l=getComputedStyle(n),a=parseInt(l.width),r=parseInt(l.height),c=.5;if(!n||!e){console.log("ERROR: Cannot do transition when one of the divs is null");return}switch(n.parentNode.style.cssText+="perspective: 900px; overflow: hidden;",n.style.cssText+="; position: absolute; z-index: 1019; backface-visibility: hidden",e.style.cssText+="; position: absolute; z-index: 1020; backface-visibility: hidden",s){case"slide-left":n.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",e.style.cssText+="overflow: hidden; transform: translate3d("+a+"px, 0, 0)",K(e).show(),setTimeout(()=>{e.style.cssText+="transition: "+c+"s; transform: translate3d(0, 0, 0)",n.style.cssText+="transition: "+c+"s; transform: translate3d(-"+a+"px, 0, 0)"},1);break;case"slide-right":n.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",e.style.cssText+="overflow: hidden; transform: translate3d(-"+a+"px, 0, 0)",K(e).show(),setTimeout(()=>{e.style.cssText+="transition: "+c+"s; transform: translate3d(0px, 0, 0)",n.style.cssText+="transition: "+c+"s; transform: translate3d("+a+"px, 0, 0)"},1);break;case"slide-down":n.style.cssText+="overflow: hidden; z-index: 1; transform: translate3d(0, 0, 0)",e.style.cssText+="overflow: hidden; z-index: 0; transform: translate3d(0, 0, 0)",K(e).show(),setTimeout(()=>{e.style.cssText+="transition: "+c+"s; transform: translate3d(0, 0, 0)",n.style.cssText+="transition: "+c+"s; transform: translate3d(0, "+r+"px, 0)"},1);break;case"slide-up":n.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",e.style.cssText+="overflow: hidden; transform: translate3d(0, "+r+"px, 0)",K(e).show(),setTimeout(()=>{e.style.cssText+="transition: "+c+"s; transform: translate3d(0, 0, 0)",n.style.cssText+="transition: "+c+"s; transform: translate3d(0, 0, 0)"},1);break;case"flip-left":n.style.cssText+="overflow: hidden; transform: rotateY(0deg)",e.style.cssText+="overflow: hidden; transform: rotateY(-180deg)",K(e).show(),setTimeout(()=>{e.style.cssText+="transition: "+c+"s; transform: rotateY(0deg)",n.style.cssText+="transition: "+c+"s; transform: rotateY(180deg)"},1);break;case"flip-right":n.style.cssText+="overflow: hidden; transform: rotateY(0deg)",e.style.cssText+="overflow: hidden; transform: rotateY(180deg)",K(e).show(),setTimeout(()=>{e.style.cssText+="transition: "+c+"s; transform: rotateY(0deg)",n.style.cssText+="transition: "+c+"s; transform: rotateY(-180deg)"},1);break;case"flip-down":n.style.cssText+="overflow: hidden; transform: rotateX(0deg)",e.style.cssText+="overflow: hidden; transform: rotateX(180deg)",K(e).show(),setTimeout(()=>{e.style.cssText+="transition: "+c+"s; transform: rotateX(0deg)",n.style.cssText+="transition: "+c+"s; transform: rotateX(-180deg)"},1);break;case"flip-up":n.style.cssText+="overflow: hidden; transform: rotateX(0deg)",e.style.cssText+="overflow: hidden; transform: rotateX(-180deg)",K(e).show(),setTimeout(()=>{e.style.cssText+="transition: "+c+"s; transform: rotateX(0deg)",n.style.cssText+="transition: "+c+"s; transform: rotateX(180deg)"},1);break;case"pop-in":n.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",e.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); transform: scale(.8); opacity: 0;",K(e).show(),setTimeout(()=>{e.style.cssText+="transition: "+c+"s; transform: scale(1); opacity: 1;",n.style.cssText+="transition: "+c+"s;"},1);break;case"pop-out":n.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); transform: scale(1); opacity: 1;",e.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); opacity: 0;",K(e).show(),setTimeout(()=>{e.style.cssText+="transition: "+c+"s; opacity: 1;",n.style.cssText+="transition: "+c+"s; transform: scale(1.7); opacity: 0;"},1);break;default:n.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",e.style.cssText+="overflow: hidden; translate3d(0, 0, 0); opacity: 0;",K(e).show(),setTimeout(()=>{e.style.cssText+="transition: "+c+"s; opacity: 1;",n.style.cssText+="transition: "+c+"s"},1);break}setTimeout(()=>{s==="slide-down"&&(K(n).css("z-index","1019"),K(e).css("z-index","1020")),e&&K(e).css({opacity:"1"}).css({transition:"",transform:""}),n&&K(n).css({opacity:"1"}).css({transition:"",transform:""}),typeof t=="function"&&t(),i()},c*1e3)})}function Ht(n,e={},...s){if(n==null)return;let t=typeof e=="string"?{msg:e}:{...e};s[0]!=null&&(t.spinner=s[0]),t=te({spinner:!1},t);let i=n;n?.[0]instanceof Node&&(i=Array.isArray(n)?n:n.get()),!t.msg&&t.msg!==0&&(t.msg=""),Ke(i);let o=K(i).get(0),l=o.scrollWidth,r=`height: ${o.scrollHeight}px; width: ${l}px`;o.tagName=="BODY"&&(r="position: fixed; right: 0; bottom: 0;"),K(i).prepend(`<div class="tsg-lock" style="${r}"></div><div class="tsg-lock-msg"></div>`);let c=K(i).find(".tsg-lock"),d=K(i).find(".tsg-lock-msg");t.msg||d.css({"background-color":"transparent","background-image":"none",border:"0px","box-shadow":"none"}),t.spinner===!0&&(t.msg=`<div class="tsg-spinner" ${t.msg?"":'style="width: 35px; height: 35px"'}></div>`+t.msg),t.msg?d.html(String(t.msg)).css("display","block"):d.remove(),t.opacity!=null&&c.css("opacity",String(t.opacity)),c.css({display:"block"}),t.bgColor&&c.css({"background-color":t.bgColor});let h=getComputedStyle(c.get(0)).opacity??.15;c.on("mousedown",function(){typeof t.onClick=="function"?t.onClick():c.css({transition:".2s",opacity:String(Number(h)*1.5)})}).on("mouseup",function(){typeof t.onClick!="function"&&c.css({transition:".2s",opacity:String(h)})}).on("mousewheel",function(f){f&&(f.stopPropagation(),f.preventDefault())})}function Ke(n,e){if(n==null)return;clearTimeout(n._prevUnlock);let t=n;if(n?.[0]instanceof Node&&(t=Array.isArray(n)?n:n.get()),re(e)&&(e??0)>0){K(t).find(".tsg-lock").css({transition:(e??0)/1e3+"s",opacity:0});let i=K(t).get(0);clearTimeout(i._prevUnlock),i._prevUnlock=setTimeout(()=>{K(t).find(".tsg-lock").remove()},e),K(t).find(".tsg-lock-msg").remove()}else K(t).find(".tsg-lock").remove(),K(t).find(".tsg-lock-msg").remove()}function Nt(n,e){let s=K(n),t=0;if(s.length>0){let i=getComputedStyle(s[0]);switch(e){case"width":t=parseFloat(i.width),i.width==="auto"&&(t=0);break;case"height":t=parseFloat(i.height),i.height==="auto"&&(t=0);break;default:t=parseFloat(String(i[e]??""))||0;break}}return t}function Pt(n,e,s){let t=K("body > #_tmp_width");t.length===0&&(K("body").append('<div id="_tmp_width" style="position: absolute; top: -9000px;"></div>'),t=K("body > #_tmp_width")),s===void 0&&n.trim().startsWith("<")&&n.trim().endsWith(">")&&(s=!0),t.html(s?n:Ee(n??"")).attr("style",`position: absolute; top: -9000px; ${e||""}`);let i=t[0].clientWidth,o=t[0].clientHeight;return t.html(""),{width:i,height:o}}function jt(n,e){let s=n;if(s?.length==0)return;let t=n;s?.[0]instanceof Node&&(t=Array.isArray(n)?n:n.get()),K(t).each(i=>{let o=K(i).data();Object.keys(o).forEach(l=>{if(["click","dblclick","mouseenter","mouseleave","mouseover","mouseout","mousedown","mousemove","mouseup","contextmenu","focus","focusin","focusout","blur","input","change","keydown","keyup","keypress"].indexOf(String(l).toLowerCase())==-1)return;let r=Array.isArray(o[l])?o[l]:[o[l]];typeof o[l]=="string"&&(r=o[l].split("|").map(d=>{let u=d;d==="true"&&(u=!0),d==="false"&&(u=!1),d==="undefined"&&(u=void 0),d==="null"&&(u=null),typeof u=="string"&&parseFloat(u)==u&&(u=parseFloat(u));let h=["'",'"',"`"];return typeof u=="string"&&h.includes(u[0]??"")&&h.includes(u[u.length-1]??"")&&(u=u.substring(1,u.length-1)),u}));let c=String(r[0]);r=r.slice(1),K(i).off(l+".TsUtils-bind").on(l+".TsUtils-bind",function(d){switch(c){case"alert":alert(r[0]);break;case"stop":d.stopPropagation();break;case"prevent":d.preventDefault();break;case"stopPrevent":return d.stopPropagation(),d.preventDefault(),!1;break;default:if(e[c]==null)throw new Error(`Cannot dispatch event as the method "${c}" does not exist.`);e[c](...r.map((u,h)=>{switch(String(u).toLowerCase()){case"event":return d;case"this":return this;default:return u}}))}})})})}function Je(n,e,s,t){if(!n)return!1;let i="Invalid Date",o,l,a;if(e==null&&(e=t.dateFormat),n instanceof Date)a=n.getFullYear(),o=n.getMonth()+1,l=n.getDate();else if(typeof n=="number"||typeof n=="string"&&parseInt(n)==n&&parseInt(n)>0){let u=new Date(parseInt(String(n)));a=u.getFullYear(),o=u.getMonth()+1,l=u.getDate()}else{let u=String(n);if(new RegExp("mon","ig").test(e)){e=e.replace(/month/ig,"m").replace(/mon/ig,"m").replace(/dd/ig,"d").replace(/[, ]/ig,"/").replace(/\/\//g,"/").toLowerCase(),u=u.replace(/[, ]/ig,"/").replace(/\/\//g,"/").toLowerCase();for(let m=0,y=t.fullmonths.length;m<y;m++){let x=t.fullmonths[m]??"";u=u.replace(new RegExp(x,"ig"),String(m+1)).replace(new RegExp(x.substr(0,3),"ig"),String(m+1))}}let h=u.replace(/-/g,"/").replace(/\./g,"/").toLowerCase().split("/"),f=e.replace(/-/g,"/").replace(/\./g,"/").toLowerCase();f==="mm/dd/yyyy"&&(o=h[0],l=h[1],a=h[2]),f==="m/d/yyyy"&&(o=h[0],l=h[1],a=h[2]),f==="dd/mm/yyyy"&&(o=h[1],l=h[0],a=h[2]),f==="d/m/yyyy"&&(o=h[1],l=h[0],a=h[2]),f==="yyyy/dd/mm"&&(o=h[2],l=h[1],a=h[0]),f==="yyyy/d/m"&&(o=h[2],l=h[1],a=h[0]),f==="yyyy/mm/dd"&&(o=h[1],l=h[2],a=h[0]),f==="yyyy/m/d"&&(o=h[1],l=h[2],a=h[0]),f==="mm/dd/yy"&&(o=h[0],l=h[1],a=h[2]),f==="m/d/yy"&&(o=h[0],l=h[1],a=parseInt(h[2]??"0")+1900),f==="dd/mm/yy"&&(o=h[1],l=h[0],a=parseInt(h[2]??"0")+1900),f==="d/m/yy"&&(o=h[1],l=h[0],a=parseInt(h[2]??"0")+1900),f==="yy/dd/mm"&&(o=h[2],l=h[1],a=parseInt(h[0]??"0")+1900),f==="yy/d/m"&&(o=h[2],l=h[1],a=parseInt(h[0]??"0")+1900),f==="yy/mm/dd"&&(o=h[1],l=h[2],a=parseInt(h[0]??"0")+1900),f==="yy/m/d"&&(o=h[1],l=h[2],a=parseInt(h[0]??"0")+1900)}if(!re(a)||!re(o)||!re(l))return!1;let r=+(a??0),c=+(o??0),d=+(l??0);return i=new Date(r,c-1,d),i.setFullYear(r),c==null||String(i)==="Invalid Date"||i.getMonth()+1!==c||i.getDate()!==d||i.getFullYear()!==r?!1:s===!0?i:!0}function Me(n,e){if(n==null)return!1;let s,t=String(n).toUpperCase(),i=t.indexOf("AM")>=0,o=t.indexOf("PM")>=0,l=o||i;l?s=12:s=24,t=t.replace("AM","").replace("PM","").trim();let a=t.split(":"),r=a[0]??"",c=a[1]??"",d=a[2]??"",u=parseInt(r||"0"),h=parseInt(c||"0"),f=parseInt(d||"0");return(!l||a.length!==1)&&a.length!==2&&a.length!==3||r===""||u<0||u>s||!re(r)||r.length>2||a.length>1&&(c===""||h<0||h>59||!re(c)||c.length!==2)||a.length>2&&(d===""||f<0||f>59||!re(d)||d.length!==2)||!l&&s===u&&(h!==0||f!==0)||l&&a.length===1&&u===0?!1:e===!0?(o&&u!==12&&(u+=12),i&&u===12&&(u+=12),{hours:u,minutes:h,seconds:f}):!0}function Ut(n,e,s,t){if(n instanceof Date)return s!==!0?!0:n;let i=parseInt(String(n));if(i===n)return i<0?!1:s!==!0?!0:new Date(i);let o=String(n),l=o.indexOf(" ");if(l<0)return o.indexOf("T")<0||String(new Date(o))=="Invalid Date"?!1:s!==!0?!0:new Date(o);{e==null&&(e=t.datetimeFormat);let a=e.split("|"),r=[o.substr(0,l),o.substr(l).trim()];a[0]!=null&&(a[0]=a[0].trim()),a[1]&&(a[1]=a[1].trim());let c=Je(r[0],a[0],!0,t),d=Me(r[1],!0);if(c!==!1&&d!==!1){if(s!==!0)return!0;let u=c,h=d;return u.setHours(h.hours),u.setMinutes(h.minutes),u.setSeconds(h.seconds),u}else return!1}}function Gt(n){let e;if(n===""||n==null||(n instanceof Date?e=n:typeof n=="number"||typeof n=="string"&&parseInt(n)==n&&parseInt(n)>0?e=new Date(parseInt(String(n))):e=new Date(String(n)),String(e)==="Invalid Date"))return"";let t=(new Date().getTime()-e.getTime())/1e3,i=0,o="";return t<0?(i=0,o="sec"):t<60?(i=Math.floor(t),o="sec",t<0&&(i=0,o="sec")):t<3600?(i=Math.floor(t/60),o="min"):t<1440*60?(i=Math.floor(t/60/60),o="hour"):t<720*60*60?(i=Math.floor(t/24/60/60),o="day"):t<365*24*60*60?(i=Math.floor(t/30/24/60/60*10)/10,o="month"):t<365*4*24*60*60?(i=Math.floor(t/365/24/60/60*10)/10,o="year"):t>=365*4*24*60*60&&(i=Math.floor(t/365.25/24/60/60*10)/10,o="year"),i+" "+o+(i>1?"s":"")}function Bt(n){let e="";return n<100?e="< 0.01 sec":n<1e3?e=Math.floor(n/10)/100+" sec":n<1e4?e=Math.floor(n/100)/10+" sec":n<6e4?e=Math.floor(n/1e3)+" secs":n<36e5?e=Math.floor(n/6e4)+" mins":n<864e5?e=Math.floor(n/36e5*10)/10+" hours":n<2628e6?e=Math.floor(n/864e5*10)/10+" days":n<31536e6?e=Math.floor(n/2628e6*10)/10+" months":e=Math.floor(n/31536e5)/10+" years",e}function Ze(n,e,s){if(e||(e=s.dateFormat),n===""||n==null||typeof n=="object"&&!n.getMonth)return"";let t=new Date(n);if(re(n)&&(t=new Date(Number(n))),String(t)==="Invalid Date")return"";let i=t.getFullYear(),o=t.getMonth(),l=t.getDate();return e.toLowerCase().replace("month",s.fullmonths[o]??"").replace("mon",s.shortmonths[o]??"").replace(/yyyy/g,("000"+i).slice(-4)).replace(/yyy/g,("000"+i).slice(-4)).replace(/yy/g,("0"+i).slice(-2)).replace(/(^|[^a-z$])y/g,"$1"+i).replace(/mm/g,("0"+(o+1)).slice(-2)).replace(/dd/g,("0"+l).slice(-2)).replace(/th/g,l==1?"st":"th").replace(/th/g,l==2?"nd":"th").replace(/th/g,l==3?"rd":"th").replace(/(^|[^a-z$])m/g,"$1"+(o+1)).replace(/(^|[^a-z$])d/g,"$1"+l)}function et(n,e,s){if(e||(e=s.timeFormat),n===""||n==null||typeof n=="object"&&!n.getMonth)return"";let t=new Date(n);if(re(n)&&(t=new Date(Number(n))),Me(n)){let f=Me(n,!0);t=new Date,t.setHours(f.hours),t.setMinutes(f.minutes)}if(String(t)==="Invalid Date")return"";e=="h12"&&(e="hh:mi pm");let i="am",o=t.getHours(),l=t.getHours(),a=t.getMinutes(),r=t.getSeconds();a<10&&(a="0"+a),r<10&&(r="0"+r),(e.indexOf("am")!==-1||e.indexOf("pm")!==-1)&&(o>=12&&(i="pm"),o>12&&(o=o-12),o===0&&(o=12));let c=String(o),d=String(a),u=String(r),h=String(l);return e.toLowerCase().replace("am",i).replace("pm",i).replace("hhh",Number(o)<10?"0"+c:c).replace("hh24",l<10?"0"+h:h).replace("h24",h).replace("hh",c).replace("mm",d).replace("mi",d).replace("ss",u).replace(/(^|[^a-z$])h/g,"$1"+c).replace(/(^|[^a-z$])m/g,"$1"+d).replace(/(^|[^a-z$])s/g,"$1"+u)}function Qt(n,e,s){let t;return n===""||n==null||typeof n=="object"&&!n.getMonth?"":(typeof e!="string"?t=[s.dateFormat,s.timeFormat]:(t=e.split("|"),t[0]!=null&&(t[0]=t[0].trim()),t[1]=t.length>1?(t[1]??"").trim():s.timeFormat),t[1]==="h12"&&(t[1]="h:m pm"),t[1]==="h24"&&(t[1]="h24:m"),Ze(n,t[0],s)+" "+et(n,t[1],s))}function Vt(n,e,s){if(n===""||n==null||typeof n=="object"&&!n.getMonth)return"";let t=new Date(n);if(re(n)&&(t=new Date(Number(n))),String(t)==="Invalid Date")return"";let i=e.shortmonths,o=new Date,l=new Date;l.setTime(l.getTime()-864e5);let a=i[t.getMonth()]+" "+t.getDate()+", "+t.getFullYear(),r=i[o.getMonth()]+" "+o.getDate()+", "+o.getFullYear(),c=i[l.getMonth()]+" "+l.getDate()+", "+l.getFullYear(),d=t.getHours()-(t.getHours()>12?12:0)+":"+(t.getMinutes()<10?"0":"")+t.getMinutes()+" "+(t.getHours()>=12?"pm":"am"),u=t.getHours()-(t.getHours()>12?12:0)+":"+(t.getMinutes()<10?"0":"")+t.getMinutes()+":"+(t.getSeconds()<10?"0":"")+t.getSeconds()+" "+(t.getHours()>=12?"pm":"am"),h=a;return a===r&&(h=d),a===c&&(h=s.lang("Yesterday")),'<span title="'+a+" "+u+'">'+h+"</span>"}async function tt(n,e,s,t,i){if(Array.isArray(n)){let l=i.extend({},t,{phrases:{}}),a=n,r=[],c={};return a.forEach((u,h)=>{u.length===5&&(u="locale/"+u.toLowerCase()+".json",a[h]=u),r.push(tt(u,!0,!1,l,i))}),(await Promise.allSettled(r)).forEach(u=>{u.status==="fulfilled"&&u.value.kind==="load"&&(c[u.value.file]=u.value.data)}),a.forEach(u=>{l=i.extend({},l,c[u]??{})}),{kind:"void",settings:l}}if(n||(n="en-us"),typeof n=="object")return{kind:"merge",settings:i.extend({},t,Ce,n)};let o=n;o.length===5&&(o="locale/"+o.toLowerCase()+".json");try{let a=await(await i.fetch(o,{method:"GET"})).json();if(s!==!0)if(e){let r=i.extend({},t,a);return{kind:"load",file:o,data:a,settings:r}}else{let r=i.extend({},t,Ce,{phrases:{}},a);return{kind:"load",file:o,data:a,settings:r}}return{kind:"load",file:o,data:a}}catch(l){throw console.log("ERROR: Cannot load locale "+o),l}}var Se=j,st=class{version;tmp;settings;i18nCompare;hasLocalStorage;isMac;isMobile;isIOS;isAndroid;isSafari;isFirefox;formatters;constructor(){this.version="2.0.x",this.tmp={},this.settings=this.extend({},{dataType:"JSON",dateStartYear:1950,dateEndYear:2030,macButtonOrder:!1,warnNoPhrase:!1},Ce,{phrases:null}),this.i18nCompare=Intl.Collator().compare,this.hasLocalStorage=e(),this.isMac=/Mac/i.test(navigator.platform),this.isMobile=/(iphone|ipod|mobile|android)/i.test(navigator.userAgent),this.isIOS=/(iphone|ipod|ipad)/i.test(navigator.platform),this.isAndroid=/(android)/i.test(navigator.userAgent),this.isSafari=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),this.isFirefox=/(Firefox)/i.test(navigator.userAgent),this.formatters={number(s,t){t==null&&(t=s);let{value:i}=t,o=t.params;return parseInt(String(o))>20&&(o=20),parseInt(String(o))<0&&(o=0),i==null||i===""?"":p.formatNumber(parseFloat(String(i)),o,!0)},float(s,t){return p.formatters.number?.(s,t)??""},int(s,t){return p.formatters.number?.(s,t)??""},money(s,t){t==null&&(t=s);let{value:i}=t;if(i==null||i==="")return"";let o=p.formatNumber(Number(i),p.settings.currencyPrecision,!0);return(p.settings.currencyPrefix||"")+o+(p.settings.currencySuffix||"")},currency(s,t){return p.formatters.money?.(s,t)??""},percent(s,t){t==null&&(t=s);let{value:i,params:o}=t;return i==null||i===""?"":p.formatNumber(i,o||1)+"%"},size(s,t){t==null&&(t=s);let{value:i}=t;return i==null||i===""?"":String(p.formatSize(parseInt(String(i))))},date(s,t){t==null&&(t=s);let{value:i}=t,o=t.params;if(o===""&&(o=p.settings.dateFormat),i==null||i===0||i==="")return"";let l=p.isDateTime(i,o??null,!0);return l===!1&&(l=p.isDate(i,o??null,!0)),'<span title="'+(l instanceof Date?l:"")+'">'+p.formatDate(l instanceof Date?l:void 0,o)+"</span>"},datetime(s,t){t==null&&(t=s);let{value:i}=t,o=t.params;if(o===""&&(o=p.settings.datetimeFormat),i==null||i===0||i==="")return"";let l=p.isDateTime(i,o??null,!0);return l===!1&&(l=p.isDate(i,o??null,!0)),'<span title="'+(l instanceof Date?l:"")+'">'+p.formatDateTime(l instanceof Date?l:void 0,o)+"</span>"},time(s,t){t==null&&(t=s);let{value:i}=t,o=t.params;if(o===""&&(o=p.settings.timeFormat),o==="h12"&&(o="hh:mi pm"),o==="h24"&&(o="h24:mi"),i==null||i===0||i==="")return"";let l=p.isDateTime(i,o??null,!0);return l===!1&&(l=p.isDate(i,o??null,!0)),'<span title="'+(l instanceof Date?l:"")+'">'+p.formatTime(i,o)+"</span>"},timestamp(s,t){t==null&&(t=s);let{value:i}=t,o=t.params;if(o===""&&(o=p.settings.datetimeFormat),i==null||i===0||i==="")return"";let l=p.isDateTime(i,o??null,!0);return l===!1&&(l=p.isDate(i,o??null,!0)),l instanceof Date?l.toString():""},gmt(s,t){t==null&&(t=s);let{value:i}=t,o=t.params;if(o===""&&(o=p.settings.datetimeFormat),i==null||i===0||i==="")return"";let l=p.isDateTime(i,o??null,!0);return l===!1&&(l=p.isDate(i,o??null,!0)),l instanceof Date?l.toUTCString():""},age(s,t){t==null&&(t=s);let{value:i,params:o}=t;if(i==null||i===0||i==="")return"";let l=p.isDateTime(i,null,!0);return l===!1&&(l=p.isDate(i,null,!0)),'<span title="'+(l instanceof Date?l:"")+'">'+p.age(i)+(o?" "+o:"")+"</span>"},interval(s,t){t==null&&(t=s);let{value:i,params:o}=t;return i==null||i===0||i===""?"":p.interval(Number(i))+(o?" "+o:"")},toggle(s,t){t==null&&(t=s);let{value:i}=t;return i?p.lang("Yes"):""},password(s,t){t==null&&(t=s);let{value:i}=t,o="";if(!i)return o;let l=String(i);for(let a=0;a<l.length;a++)o+="*";return o}};return;function e(){let s="w2ui_test";try{return localStorage.setItem(s,s),localStorage.removeItem(s),!0}catch{return!1}}}isBin(e){return ft(e)}isInt(e){return re(e)}isFloat(e){return Qe(e,this.settings)}isMoney(e){return ht(e,this.settings)}isHex(e){return pt(e)}isAlphaNumeric(e){return ze(e)}isEmail(e){return mt(e)}isIpAddress(e){return gt(e)}isDate(e,s,t){return Je(e,s,t,this.settings)}isTime(e,s){return Me(e,s)}isDateTime(e,s,t){return Ut(e,s,t,this.settings)}age(e){return Gt(e)}interval(e){return Bt(e)}date(e){return Vt(e,this.settings,{lang:this.lang.bind(this)})}formatSize(e){if(!this.isFloat(e)||e==="")return"";let s=parseFloat(String(e));if(s===0)return 0;let t=["Bt","KB","MB","GB","TB","PB","EB","ZB"],i=parseInt(String(Math.floor(Math.log(s)/Math.log(1024))));return(Math.floor(s/Math.pow(1024,i)*10)/10).toFixed(i===0?0:1)+" "+(t[i]||"??")}formatNumber(e,s,t){if(e==null||e===""||typeof e=="object")return"";let i={minimumFractionDigits:s!=null?parseInt(String(s)):void 0,maximumFractionDigits:s!=null?parseInt(String(s)):void 0,useGrouping:!!t};return(s==null||Number(s)<0)&&(i.minimumFractionDigits=0,i.maximumFractionDigits=20),parseFloat(String(e)).toLocaleString(this.settings.locale,i)}formatDate(e,s){return Ze(e,s,this.settings)}formatTime(e,s){return et(e,s,this.settings)}formatDateTime(e,s){return Qt(e,s,this.settings)}stripSpaces(e){return Ae(e)}stripTags(e){return Fe(e)}encodeTags(e){return Ee(e)}decodeTags(e){return He(e)}escapeId(e){return Ct(e)}unescapeId(e){return Et(e)}base64encode(e){return St(e)}base64decode(e){return Rt(e)}sha256(e){return $t(e)}transition(e,s,t,i){return Ft(e,s,t,i)}lock(e,s={},...t){return Ht(e,s,...t)}unlock(e,s){return Ke(e,s)}_msgDeps(){return{extend:te,bindEvents:(e,s)=>this.bindEvents(e,s),lock:(e,s)=>this.lock(e,s),unlock:(e,s)=>this.unlock(e,s),ownerName:this.name,self:this}}_confirmDeps(){return{extend:te,normButtons:(e,s)=>je(e,s,{extend:te,lang:this.lang.bind(this),settings:this.settings}),message:(e,s)=>this.message(e,s),settings:this.settings,lang:this.lang.bind(this)}}_promptDeps(){return{extend:te,normButtons:(e,s)=>je(e,s,{extend:te,lang:this.lang.bind(this),settings:this.settings}),message:(e,s)=>this.message(e,s),settings:this.settings,lang:this.lang.bind(this)}}message(e,s){return Xe(e,s,this._msgDeps())}alert(e,s){return zt(e,s,this._msgDeps())}confirm(e,s){return Lt(e,s,this._confirmDeps())}prompt(e,s){return At(e,s,this._promptDeps())}normButtons(e,s){return je(e,s,{extend:te,lang:this.lang.bind(this),settings:this.settings})}notify(e,s){return Ot(e,s,{execTemplate:this.execTemplate.bind(this),tmpSlot:this.tmp})}getSize(e,s){return Nt(e,s)}getStrDimentions(e,s,t){return Pt(e,s,t)}getStrWidth(e,s,t){return this.getStrDimentions(e,s,t).width}getStrHeight(e,s,t){return this.getStrDimentions(e,s,t).height}execTemplate(e,s){return Mt(e,s)}marker(e,s,t){return It(e,s,t)}lang(e,s){if(!e||this.settings.phrases==null||typeof e!="string"||"<=>=".includes(e))return this.execTemplate(e,s);let t=this.settings.phrases[e];return t==null?(t=e,this.settings.warnNoPhrase&&(this.settings.missing||(this.settings.missing={}),this.settings.missing[e]="---",this.settings.phrases[e]="---",console.log(`Missing translation for "%c${e}%c", see %c TsUtils.settings.phrases %c with value "---"`,"color: orange","","color: #999",""))):t==="---"&&!this.settings.warnNoPhrase&&(t=e),t==="---"&&(t=`<span ${this.tooltip(e)}>---</span>`),this.execTemplate(t,s)}locale(e,s,t){let i={extend:this.extend.bind(this),fetch:globalThis.fetch.bind(globalThis)};return tt(e,s,t,this.settings,i).then(o=>(o.settings&&(this.settings=o.settings),o.kind==="load"?{file:o.file,data:o.data}:void 0))}scrollBarSize(){return this.tmp.scrollBarSize?this.tmp.scrollBarSize:(Se("body").append(`
|
|
27
|
+
</div>`),s.normButtons(t,{ok:s.lang("Ok"),cancel:s.lang("Cancel")});let i=s.message(n,t);return i&&(i.change=function(o){return i.self?.on?.("change.prom",o),i},i.action(o=>{o.detail?.self?.close?.()}).then(o=>{let l=o.detail;(l?.self).input=G(l?.box).find("#TsPrompt").get(0),G(l?.box).find("#TsPrompt").on("keydown",a=>{a.keyCode==13&&a.shiftKey===!1&&a.preventDefault()}).on("keyup",a=>{let r=l?.self,c=r?.trigger?.("change",{value:a.target.value,input:a.target,originalEvent:a});a.keyCode==13&&a.shiftKey===!1&&r?.action?.("Ok",a),c?.finish?.()})})),i}var K=j;function Ft(n,e,s,t){return new Promise((i,o)=>{let l=getComputedStyle(n),a=parseInt(l.width),r=parseInt(l.height),c=.5;if(!n||!e){console.log("ERROR: Cannot do transition when one of the divs is null");return}switch(n.parentNode.style.cssText+="perspective: 900px; overflow: hidden;",n.style.cssText+="; position: absolute; z-index: 1019; backface-visibility: hidden",e.style.cssText+="; position: absolute; z-index: 1020; backface-visibility: hidden",s){case"slide-left":n.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",e.style.cssText+="overflow: hidden; transform: translate3d("+a+"px, 0, 0)",K(e).show(),setTimeout(()=>{e.style.cssText+="transition: "+c+"s; transform: translate3d(0, 0, 0)",n.style.cssText+="transition: "+c+"s; transform: translate3d(-"+a+"px, 0, 0)"},1);break;case"slide-right":n.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",e.style.cssText+="overflow: hidden; transform: translate3d(-"+a+"px, 0, 0)",K(e).show(),setTimeout(()=>{e.style.cssText+="transition: "+c+"s; transform: translate3d(0px, 0, 0)",n.style.cssText+="transition: "+c+"s; transform: translate3d("+a+"px, 0, 0)"},1);break;case"slide-down":n.style.cssText+="overflow: hidden; z-index: 1; transform: translate3d(0, 0, 0)",e.style.cssText+="overflow: hidden; z-index: 0; transform: translate3d(0, 0, 0)",K(e).show(),setTimeout(()=>{e.style.cssText+="transition: "+c+"s; transform: translate3d(0, 0, 0)",n.style.cssText+="transition: "+c+"s; transform: translate3d(0, "+r+"px, 0)"},1);break;case"slide-up":n.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",e.style.cssText+="overflow: hidden; transform: translate3d(0, "+r+"px, 0)",K(e).show(),setTimeout(()=>{e.style.cssText+="transition: "+c+"s; transform: translate3d(0, 0, 0)",n.style.cssText+="transition: "+c+"s; transform: translate3d(0, 0, 0)"},1);break;case"flip-left":n.style.cssText+="overflow: hidden; transform: rotateY(0deg)",e.style.cssText+="overflow: hidden; transform: rotateY(-180deg)",K(e).show(),setTimeout(()=>{e.style.cssText+="transition: "+c+"s; transform: rotateY(0deg)",n.style.cssText+="transition: "+c+"s; transform: rotateY(180deg)"},1);break;case"flip-right":n.style.cssText+="overflow: hidden; transform: rotateY(0deg)",e.style.cssText+="overflow: hidden; transform: rotateY(180deg)",K(e).show(),setTimeout(()=>{e.style.cssText+="transition: "+c+"s; transform: rotateY(0deg)",n.style.cssText+="transition: "+c+"s; transform: rotateY(-180deg)"},1);break;case"flip-down":n.style.cssText+="overflow: hidden; transform: rotateX(0deg)",e.style.cssText+="overflow: hidden; transform: rotateX(180deg)",K(e).show(),setTimeout(()=>{e.style.cssText+="transition: "+c+"s; transform: rotateX(0deg)",n.style.cssText+="transition: "+c+"s; transform: rotateX(-180deg)"},1);break;case"flip-up":n.style.cssText+="overflow: hidden; transform: rotateX(0deg)",e.style.cssText+="overflow: hidden; transform: rotateX(-180deg)",K(e).show(),setTimeout(()=>{e.style.cssText+="transition: "+c+"s; transform: rotateX(0deg)",n.style.cssText+="transition: "+c+"s; transform: rotateX(180deg)"},1);break;case"pop-in":n.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",e.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); transform: scale(.8); opacity: 0;",K(e).show(),setTimeout(()=>{e.style.cssText+="transition: "+c+"s; transform: scale(1); opacity: 1;",n.style.cssText+="transition: "+c+"s;"},1);break;case"pop-out":n.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); transform: scale(1); opacity: 1;",e.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0); opacity: 0;",K(e).show(),setTimeout(()=>{e.style.cssText+="transition: "+c+"s; opacity: 1;",n.style.cssText+="transition: "+c+"s; transform: scale(1.7); opacity: 0;"},1);break;default:n.style.cssText+="overflow: hidden; transform: translate3d(0, 0, 0)",e.style.cssText+="overflow: hidden; translate3d(0, 0, 0); opacity: 0;",K(e).show(),setTimeout(()=>{e.style.cssText+="transition: "+c+"s; opacity: 1;",n.style.cssText+="transition: "+c+"s"},1);break}setTimeout(()=>{s==="slide-down"&&(K(n).css("z-index","1019"),K(e).css("z-index","1020")),e&&K(e).css({opacity:"1"}).css({transition:"",transform:""}),n&&K(n).css({opacity:"1"}).css({transition:"",transform:""}),typeof t=="function"&&t(),i()},c*1e3)})}function Ht(n,e={},...s){if(n==null)return;let t=typeof e=="string"?{msg:e}:{...e};s[0]!=null&&(t.spinner=s[0]),t=te({spinner:!1},t);let i=n;n?.[0]instanceof Node&&(i=Array.isArray(n)?n:n.get()),!t.msg&&t.msg!==0&&(t.msg=""),Ke(i);let o=K(i).get(0),l=o.scrollWidth,r=`height: ${o.scrollHeight}px; width: ${l}px`;o.tagName=="BODY"&&(r="position: fixed; right: 0; bottom: 0;"),K(i).prepend(`<div class="tsg-lock" style="${r}"></div><div class="tsg-lock-msg"></div>`);let c=K(i).find(".tsg-lock"),d=K(i).find(".tsg-lock-msg");t.msg||d.css({"background-color":"transparent","background-image":"none",border:"0px","box-shadow":"none"}),t.spinner===!0&&(t.msg=`<div class="tsg-spinner" ${t.msg?"":'style="width: 35px; height: 35px"'}></div>`+t.msg),t.msg?d.html(String(t.msg)).css("display","block"):d.remove(),t.opacity!=null&&c.css("opacity",String(t.opacity)),c.css({display:"block"}),t.bgColor&&c.css({"background-color":t.bgColor});let h=getComputedStyle(c.get(0)).opacity??.15;c.on("mousedown",function(){typeof t.onClick=="function"?t.onClick():c.css({transition:".2s",opacity:String(Number(h)*1.5)})}).on("mouseup",function(){typeof t.onClick!="function"&&c.css({transition:".2s",opacity:String(h)})}).on("mousewheel",function(f){f&&(f.stopPropagation(),f.preventDefault())})}function Ke(n,e){if(n==null)return;clearTimeout(n._prevUnlock);let t=n;if(n?.[0]instanceof Node&&(t=Array.isArray(n)?n:n.get()),re(e)&&(e??0)>0){K(t).find(".tsg-lock").css({transition:(e??0)/1e3+"s",opacity:0});let i=K(t).get(0);clearTimeout(i._prevUnlock),i._prevUnlock=setTimeout(()=>{K(t).find(".tsg-lock").remove()},e),K(t).find(".tsg-lock-msg").remove()}else K(t).find(".tsg-lock").remove(),K(t).find(".tsg-lock-msg").remove()}function Nt(n,e){let s=K(n),t=0;if(s.length>0){let i=getComputedStyle(s[0]);switch(e){case"width":t=parseFloat(i.width),i.width==="auto"&&(t=0);break;case"height":t=parseFloat(i.height),i.height==="auto"&&(t=0);break;default:t=parseFloat(String(i[e]??""))||0;break}}return t}function Pt(n,e,s){let t=K("body > #_tmp_width");t.length===0&&(K("body").append('<div id="_tmp_width" style="position: absolute; top: -9000px;"></div>'),t=K("body > #_tmp_width")),s===void 0&&n.trim().startsWith("<")&&n.trim().endsWith(">")&&(s=!0),t.html(s?n:Ee(n??"")).attr("style",`position: absolute; top: -9000px; ${e||""}`);let i=t[0].clientWidth,o=t[0].clientHeight;return t.html(""),{width:i,height:o}}function jt(n,e){let s=n;if(s?.length==0)return;let t=n;s?.[0]instanceof Node&&(t=Array.isArray(n)?n:n.get()),K(t).each(i=>{let o=K(i).data();Object.keys(o).forEach(l=>{if(["click","dblclick","mouseenter","mouseleave","mouseover","mouseout","mousedown","mousemove","mouseup","contextmenu","focus","focusin","focusout","blur","input","change","keydown","keyup","keypress"].indexOf(String(l).toLowerCase())==-1)return;let r=Array.isArray(o[l])?o[l]:[o[l]];typeof o[l]=="string"&&(r=o[l].split("|").map(d=>{let u=d;d==="true"&&(u=!0),d==="false"&&(u=!1),d==="undefined"&&(u=void 0),d==="null"&&(u=null),typeof u=="string"&&parseFloat(u)==u&&(u=parseFloat(u));let h=["'",'"',"`"];return typeof u=="string"&&h.includes(u[0]??"")&&h.includes(u[u.length-1]??"")&&(u=u.substring(1,u.length-1)),u}));let c=String(r[0]);r=r.slice(1),K(i).off(l+".TsUtils-bind").on(l+".TsUtils-bind",function(d){switch(c){case"alert":alert(r[0]);break;case"stop":d.stopPropagation();break;case"prevent":d.preventDefault();break;case"stopPrevent":return d.stopPropagation(),d.preventDefault(),!1;break;default:if(e[c]==null)throw new Error(`Cannot dispatch event as the method "${c}" does not exist.`);e[c](...r.map((u,h)=>{switch(String(u).toLowerCase()){case"event":return d;case"this":return this;default:return u}}))}})})})}function Je(n,e,s,t){if(!n)return!1;let i="Invalid Date",o,l,a;if(e==null&&(e=t.dateFormat),n instanceof Date)a=n.getFullYear(),o=n.getMonth()+1,l=n.getDate();else if(typeof n=="number"||typeof n=="string"&&parseInt(n)==n&&parseInt(n)>0){let u=new Date(parseInt(String(n)));a=u.getFullYear(),o=u.getMonth()+1,l=u.getDate()}else{let u=String(n);if(new RegExp("mon","ig").test(e)){e=e.replace(/month/ig,"m").replace(/mon/ig,"m").replace(/dd/ig,"d").replace(/[, ]/ig,"/").replace(/\/\//g,"/").toLowerCase(),u=u.replace(/[, ]/ig,"/").replace(/\/\//g,"/").toLowerCase();for(let m=0,y=t.fullmonths.length;m<y;m++){let x=t.fullmonths[m]??"";u=u.replace(new RegExp(x,"ig"),String(m+1)).replace(new RegExp(x.substr(0,3),"ig"),String(m+1))}}let h=u.replace(/-/g,"/").replace(/\./g,"/").toLowerCase().split("/"),f=e.replace(/-/g,"/").replace(/\./g,"/").toLowerCase();f==="mm/dd/yyyy"&&(o=h[0],l=h[1],a=h[2]),f==="m/d/yyyy"&&(o=h[0],l=h[1],a=h[2]),f==="dd/mm/yyyy"&&(o=h[1],l=h[0],a=h[2]),f==="d/m/yyyy"&&(o=h[1],l=h[0],a=h[2]),f==="yyyy/dd/mm"&&(o=h[2],l=h[1],a=h[0]),f==="yyyy/d/m"&&(o=h[2],l=h[1],a=h[0]),f==="yyyy/mm/dd"&&(o=h[1],l=h[2],a=h[0]),f==="yyyy/m/d"&&(o=h[1],l=h[2],a=h[0]),f==="mm/dd/yy"&&(o=h[0],l=h[1],a=h[2]),f==="m/d/yy"&&(o=h[0],l=h[1],a=parseInt(h[2]??"0")+1900),f==="dd/mm/yy"&&(o=h[1],l=h[0],a=parseInt(h[2]??"0")+1900),f==="d/m/yy"&&(o=h[1],l=h[0],a=parseInt(h[2]??"0")+1900),f==="yy/dd/mm"&&(o=h[2],l=h[1],a=parseInt(h[0]??"0")+1900),f==="yy/d/m"&&(o=h[2],l=h[1],a=parseInt(h[0]??"0")+1900),f==="yy/mm/dd"&&(o=h[1],l=h[2],a=parseInt(h[0]??"0")+1900),f==="yy/m/d"&&(o=h[1],l=h[2],a=parseInt(h[0]??"0")+1900)}if(!re(a)||!re(o)||!re(l))return!1;let r=+(a??0),c=+(o??0),d=+(l??0);return i=new Date(r,c-1,d),i.setFullYear(r),c==null||String(i)==="Invalid Date"||i.getMonth()+1!==c||i.getDate()!==d||i.getFullYear()!==r?!1:s===!0?i:!0}function Me(n,e){if(n==null)return!1;let s,t=String(n).toUpperCase(),i=t.indexOf("AM")>=0,o=t.indexOf("PM")>=0,l=o||i;l?s=12:s=24,t=t.replace("AM","").replace("PM","").trim();let a=t.split(":"),r=a[0]??"",c=a[1]??"",d=a[2]??"",u=parseInt(r||"0"),h=parseInt(c||"0"),f=parseInt(d||"0");return(!l||a.length!==1)&&a.length!==2&&a.length!==3||r===""||u<0||u>s||!re(r)||r.length>2||a.length>1&&(c===""||h<0||h>59||!re(c)||c.length!==2)||a.length>2&&(d===""||f<0||f>59||!re(d)||d.length!==2)||!l&&s===u&&(h!==0||f!==0)||l&&a.length===1&&u===0?!1:e===!0?(o&&u!==12&&(u+=12),i&&u===12&&(u+=12),{hours:u,minutes:h,seconds:f}):!0}function Ut(n,e,s,t){if(n instanceof Date)return s!==!0?!0:n;let i=parseInt(String(n));if(i===n)return i<0?!1:s!==!0?!0:new Date(i);let o=String(n),l=o.indexOf(" ");if(l<0)return o.indexOf("T")<0||String(new Date(o))=="Invalid Date"?!1:s!==!0?!0:new Date(o);{e==null&&(e=t.datetimeFormat);let a=e.split("|"),r=[o.substr(0,l),o.substr(l).trim()];a[0]!=null&&(a[0]=a[0].trim()),a[1]&&(a[1]=a[1].trim());let c=Je(r[0],a[0],!0,t),d=Me(r[1],!0);if(c!==!1&&d!==!1){if(s!==!0)return!0;let u=c,h=d;return u.setHours(h.hours),u.setMinutes(h.minutes),u.setSeconds(h.seconds),u}else return!1}}function Gt(n){let e;if(n===""||n==null||(n instanceof Date?e=n:typeof n=="number"||typeof n=="string"&&parseInt(n)==n&&parseInt(n)>0?e=new Date(parseInt(String(n))):e=new Date(String(n)),String(e)==="Invalid Date"))return"";let t=(new Date().getTime()-e.getTime())/1e3,i=0,o="";return t<0?(i=0,o="sec"):t<60?(i=Math.floor(t),o="sec",t<0&&(i=0,o="sec")):t<3600?(i=Math.floor(t/60),o="min"):t<1440*60?(i=Math.floor(t/60/60),o="hour"):t<720*60*60?(i=Math.floor(t/24/60/60),o="day"):t<365*24*60*60?(i=Math.floor(t/30/24/60/60*10)/10,o="month"):t<365*4*24*60*60?(i=Math.floor(t/365/24/60/60*10)/10,o="year"):t>=365*4*24*60*60&&(i=Math.floor(t/365.25/24/60/60*10)/10,o="year"),i+" "+o+(i>1?"s":"")}function Bt(n){let e="";return n<100?e="< 0.01 sec":n<1e3?e=Math.floor(n/10)/100+" sec":n<1e4?e=Math.floor(n/100)/10+" sec":n<6e4?e=Math.floor(n/1e3)+" secs":n<36e5?e=Math.floor(n/6e4)+" mins":n<864e5?e=Math.floor(n/36e5*10)/10+" hours":n<2628e6?e=Math.floor(n/864e5*10)/10+" days":n<31536e6?e=Math.floor(n/2628e6*10)/10+" months":e=Math.floor(n/31536e5)/10+" years",e}function Ze(n,e,s){if(e||(e=s.dateFormat),n===""||n==null||typeof n=="object"&&!n.getMonth)return"";let t=new Date(n);if(re(n)&&(t=new Date(Number(n))),String(t)==="Invalid Date")return"";let i=t.getFullYear(),o=t.getMonth(),l=t.getDate();return e.toLowerCase().replace("month",s.fullmonths[o]??"").replace("mon",s.shortmonths[o]??"").replace(/yyyy/g,("000"+i).slice(-4)).replace(/yyy/g,("000"+i).slice(-4)).replace(/yy/g,("0"+i).slice(-2)).replace(/(^|[^a-z$])y/g,"$1"+i).replace(/mm/g,("0"+(o+1)).slice(-2)).replace(/dd/g,("0"+l).slice(-2)).replace(/th/g,l==1?"st":"th").replace(/th/g,l==2?"nd":"th").replace(/th/g,l==3?"rd":"th").replace(/(^|[^a-z$])m/g,"$1"+(o+1)).replace(/(^|[^a-z$])d/g,"$1"+l)}function et(n,e,s){if(e||(e=s.timeFormat),n===""||n==null||typeof n=="object"&&!n.getMonth)return"";let t=new Date(n);if(re(n)&&(t=new Date(Number(n))),Me(n)){let f=Me(n,!0);t=new Date,t.setHours(f.hours),t.setMinutes(f.minutes)}if(String(t)==="Invalid Date")return"";e=="h12"&&(e="hh:mi pm");let i="am",o=t.getHours(),l=t.getHours(),a=t.getMinutes(),r=t.getSeconds();a<10&&(a="0"+a),r<10&&(r="0"+r),(e.indexOf("am")!==-1||e.indexOf("pm")!==-1)&&(o>=12&&(i="pm"),o>12&&(o=o-12),o===0&&(o=12));let c=String(o),d=String(a),u=String(r),h=String(l);return e.toLowerCase().replace("am",i).replace("pm",i).replace("hhh",Number(o)<10?"0"+c:c).replace("hh24",l<10?"0"+h:h).replace("h24",h).replace("hh",c).replace("mm",d).replace("mi",d).replace("ss",u).replace(/(^|[^a-z$])h/g,"$1"+c).replace(/(^|[^a-z$])m/g,"$1"+d).replace(/(^|[^a-z$])s/g,"$1"+u)}function Qt(n,e,s){let t;return n===""||n==null||typeof n=="object"&&!n.getMonth?"":(typeof e!="string"?t=[s.dateFormat,s.timeFormat]:(t=e.split("|"),t[0]!=null&&(t[0]=t[0].trim()),t[1]=t.length>1?(t[1]??"").trim():s.timeFormat),t[1]==="h12"&&(t[1]="h:m pm"),t[1]==="h24"&&(t[1]="h24:m"),Ze(n,t[0],s)+" "+et(n,t[1],s))}function Vt(n,e,s){if(n===""||n==null||typeof n=="object"&&!n.getMonth)return"";let t=new Date(n);if(re(n)&&(t=new Date(Number(n))),String(t)==="Invalid Date")return"";let i=e.shortmonths,o=new Date,l=new Date;l.setTime(l.getTime()-864e5);let a=i[t.getMonth()]+" "+t.getDate()+", "+t.getFullYear(),r=i[o.getMonth()]+" "+o.getDate()+", "+o.getFullYear(),c=i[l.getMonth()]+" "+l.getDate()+", "+l.getFullYear(),d=t.getHours()-(t.getHours()>12?12:0)+":"+(t.getMinutes()<10?"0":"")+t.getMinutes()+" "+(t.getHours()>=12?"pm":"am"),u=t.getHours()-(t.getHours()>12?12:0)+":"+(t.getMinutes()<10?"0":"")+t.getMinutes()+":"+(t.getSeconds()<10?"0":"")+t.getSeconds()+" "+(t.getHours()>=12?"pm":"am"),h=a;return a===r&&(h=d),a===c&&(h=s.lang("Yesterday")),'<span title="'+a+" "+u+'">'+h+"</span>"}async function tt(n,e,s,t,i){if(Array.isArray(n)){let l=i.extend({},{...t,phrases:{}}),a=n.map(u=>u.length===5?"locale/"+u.toLowerCase()+".json":u),r=[],c={};return a.forEach(u=>{r.push(tt(u,!0,!1,l,i))}),(await Promise.allSettled(r)).forEach(u=>{u.status==="fulfilled"&&u.value.kind==="load"&&(c[u.value.file]=u.value.data)}),a.forEach(u=>{l=i.extend({},l,c[u]??{})}),{kind:"void",settings:l}}if(n||(n="en-us"),typeof n=="object")return{kind:"merge",settings:i.extend({},t,Ce,n)};let o=n;o.length===5&&(o="locale/"+o.toLowerCase()+".json");try{let a=await(await i.fetch(o,{method:"GET"})).json();if(s!==!0)if(e){let r=i.extend({},t,a);return{kind:"load",file:o,data:a,settings:r}}else{let r={...t,phrases:{}},c=i.extend({},r,Ce,a);return{kind:"load",file:o,data:a,settings:c}}return{kind:"load",file:o,data:a}}catch(l){throw console.log("ERROR: Cannot load locale "+o),l}}var Se=j,st=class{version;tmp;settings;i18nCompare;hasLocalStorage;isMac;isMobile;isIOS;isAndroid;isSafari;isFirefox;formatters;constructor(){this.version="2.0.x",this.tmp={},this.settings=this.extend({},{dataType:"JSON",dateStartYear:1950,dateEndYear:2030,macButtonOrder:!1,warnNoPhrase:!1},Ce,{phrases:null}),this.i18nCompare=Intl.Collator().compare,this.hasLocalStorage=e(),this.isMac=/Mac/i.test(navigator.platform),this.isMobile=/(iphone|ipod|mobile|android)/i.test(navigator.userAgent),this.isIOS=/(iphone|ipod|ipad)/i.test(navigator.platform),this.isAndroid=/(android)/i.test(navigator.userAgent),this.isSafari=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),this.isFirefox=/(Firefox)/i.test(navigator.userAgent),this.formatters={number(s,t){t==null&&(t=s);let{value:i}=t,o=t.params;return parseInt(String(o))>20&&(o=20),parseInt(String(o))<0&&(o=0),i==null||i===""?"":p.formatNumber(parseFloat(String(i)),o,!0)},float(s,t){return p.formatters.number?.(s,t)??""},int(s,t){return p.formatters.number?.(s,t)??""},money(s,t){t==null&&(t=s);let{value:i}=t;if(i==null||i==="")return"";let o=p.formatNumber(Number(i),p.settings.currencyPrecision,!0);return(p.settings.currencyPrefix||"")+o+(p.settings.currencySuffix||"")},currency(s,t){return p.formatters.money?.(s,t)??""},percent(s,t){t==null&&(t=s);let{value:i,params:o}=t;return i==null||i===""?"":p.formatNumber(i,o||1)+"%"},size(s,t){t==null&&(t=s);let{value:i}=t;return i==null||i===""?"":String(p.formatSize(parseInt(String(i))))},date(s,t){t==null&&(t=s);let{value:i}=t,o=t.params;if(o===""&&(o=p.settings.dateFormat),i==null||i===0||i==="")return"";let l=p.isDateTime(i,o??null,!0);return l===!1&&(l=p.isDate(i,o??null,!0)),'<span title="'+(l instanceof Date?l:"")+'">'+p.formatDate(l instanceof Date?l:void 0,o)+"</span>"},datetime(s,t){t==null&&(t=s);let{value:i}=t,o=t.params;if(o===""&&(o=p.settings.datetimeFormat),i==null||i===0||i==="")return"";let l=p.isDateTime(i,o??null,!0);return l===!1&&(l=p.isDate(i,o??null,!0)),'<span title="'+(l instanceof Date?l:"")+'">'+p.formatDateTime(l instanceof Date?l:void 0,o)+"</span>"},time(s,t){t==null&&(t=s);let{value:i}=t,o=t.params;if(o===""&&(o=p.settings.timeFormat),o==="h12"&&(o="hh:mi pm"),o==="h24"&&(o="h24:mi"),i==null||i===0||i==="")return"";let l=p.isDateTime(i,o??null,!0);return l===!1&&(l=p.isDate(i,o??null,!0)),'<span title="'+(l instanceof Date?l:"")+'">'+p.formatTime(i,o)+"</span>"},timestamp(s,t){t==null&&(t=s);let{value:i}=t,o=t.params;if(o===""&&(o=p.settings.datetimeFormat),i==null||i===0||i==="")return"";let l=p.isDateTime(i,o??null,!0);return l===!1&&(l=p.isDate(i,o??null,!0)),l instanceof Date?l.toString():""},gmt(s,t){t==null&&(t=s);let{value:i}=t,o=t.params;if(o===""&&(o=p.settings.datetimeFormat),i==null||i===0||i==="")return"";let l=p.isDateTime(i,o??null,!0);return l===!1&&(l=p.isDate(i,o??null,!0)),l instanceof Date?l.toUTCString():""},age(s,t){t==null&&(t=s);let{value:i,params:o}=t;if(i==null||i===0||i==="")return"";let l=p.isDateTime(i,null,!0);return l===!1&&(l=p.isDate(i,null,!0)),'<span title="'+(l instanceof Date?l:"")+'">'+p.age(i)+(o?" "+o:"")+"</span>"},interval(s,t){t==null&&(t=s);let{value:i,params:o}=t;return i==null||i===0||i===""?"":p.interval(Number(i))+(o?" "+o:"")},toggle(s,t){t==null&&(t=s);let{value:i}=t;return i?p.lang("Yes"):""},password(s,t){t==null&&(t=s);let{value:i}=t,o="";if(!i)return o;let l=String(i);for(let a=0;a<l.length;a++)o+="*";return o}};return;function e(){let s="w2ui_test";try{return localStorage.setItem(s,s),localStorage.removeItem(s),!0}catch{return!1}}}isBin(e){return ft(e)}isInt(e){return re(e)}isFloat(e){return Qe(e,this.settings)}isMoney(e){return ht(e,this.settings)}isHex(e){return pt(e)}isAlphaNumeric(e){return ze(e)}isEmail(e){return mt(e)}isIpAddress(e){return gt(e)}isDate(e,s,t){return Je(e,s,t,this.settings)}isTime(e,s){return Me(e,s)}isDateTime(e,s,t){return Ut(e,s,t,this.settings)}age(e){return Gt(e)}interval(e){return Bt(e)}date(e){return Vt(e,this.settings,{lang:this.lang.bind(this)})}formatSize(e){if(!this.isFloat(e)||e==="")return"";let s=parseFloat(String(e));if(s===0)return 0;let t=["Bt","KB","MB","GB","TB","PB","EB","ZB"],i=parseInt(String(Math.floor(Math.log(s)/Math.log(1024))));return(Math.floor(s/Math.pow(1024,i)*10)/10).toFixed(i===0?0:1)+" "+(t[i]||"??")}formatNumber(e,s,t){if(e==null||e===""||typeof e=="object")return"";let i={minimumFractionDigits:s!=null?parseInt(String(s)):void 0,maximumFractionDigits:s!=null?parseInt(String(s)):void 0,useGrouping:!!t};return(s==null||Number(s)<0)&&(i.minimumFractionDigits=0,i.maximumFractionDigits=20),parseFloat(String(e)).toLocaleString(this.settings.locale,i)}formatDate(e,s){return Ze(e,s,this.settings)}formatTime(e,s){return et(e,s,this.settings)}formatDateTime(e,s){return Qt(e,s,this.settings)}stripSpaces(e){return Ae(e)}stripTags(e){return Fe(e)}encodeTags(e){return Ee(e)}decodeTags(e){return He(e)}escapeId(e){return Ct(e)}unescapeId(e){return Et(e)}base64encode(e){return St(e)}base64decode(e){return Rt(e)}sha256(e){return $t(e)}transition(e,s,t,i){return Ft(e,s,t,i)}lock(e,s={},...t){return Ht(e,s,...t)}unlock(e,s){return Ke(e,s)}_msgDeps(){return{extend:te,bindEvents:(e,s)=>this.bindEvents(e,s),lock:(e,s)=>this.lock(e,s),unlock:(e,s)=>this.unlock(e,s),ownerName:this.name,self:this}}_confirmDeps(){return{extend:te,normButtons:(e,s)=>je(e,s,{extend:te,lang:this.lang.bind(this),settings:this.settings}),message:(e,s)=>this.message(e,s),settings:this.settings,lang:this.lang.bind(this)}}_promptDeps(){return{extend:te,normButtons:(e,s)=>je(e,s,{extend:te,lang:this.lang.bind(this),settings:this.settings}),message:(e,s)=>this.message(e,s),settings:this.settings,lang:this.lang.bind(this)}}message(e,s){return Xe(e,s,this._msgDeps())}alert(e,s){return zt(e,s,this._msgDeps())}confirm(e,s){return Lt(e,s,this._confirmDeps())}prompt(e,s){return At(e,s,this._promptDeps())}normButtons(e,s){return je(e,s,{extend:te,lang:this.lang.bind(this),settings:this.settings})}notify(e,s){return Ot(e,s,{execTemplate:this.execTemplate.bind(this),tmpSlot:this.tmp})}getSize(e,s){return Nt(e,s)}getStrDimentions(e,s,t){return Pt(e,s,t)}getStrWidth(e,s,t){return this.getStrDimentions(e,s,t).width}getStrHeight(e,s,t){return this.getStrDimentions(e,s,t).height}execTemplate(e,s){return Mt(e,s)}marker(e,s,t){return It(e,s,t)}lang(e,s){if(!e||this.settings.phrases==null||typeof e!="string"||"<=>=".includes(e))return this.execTemplate(e,s);let t=this.settings.phrases[e];return t==null?(t=e,this.settings.warnNoPhrase&&(this.settings.missing||(this.settings.missing={}),this.settings.missing[e]="---",this.settings.phrases[e]="---",console.log(`Missing translation for "%c${e}%c", see %c TsUtils.settings.phrases %c with value "---"`,"color: orange","","color: #999",""))):t==="---"&&!this.settings.warnNoPhrase&&(t=e),t==="---"&&(t=`<span ${this.tooltip(e)}>---</span>`),this.execTemplate(t,s)}locale(e,s,t){let i={extend:this.extend.bind(this),fetch:globalThis.fetch.bind(globalThis)};return tt(e,s,t,this.settings,i).then(o=>(o.settings&&(this.settings=o.settings),o.kind==="load"?{file:o.file,data:o.data}:void 0))}scrollBarSize(){return this.tmp.scrollBarSize?this.tmp.scrollBarSize:(Se("body").append(`
|
|
28
28
|
<div id="_scrollbar_width" style="position: absolute; top: -300px; width: 100px; height: 100px; overflow-y: scroll;">
|
|
29
29
|
<div style="height: 120px">1</div>
|
|
30
30
|
</div>
|
package/dist/tsgrid-ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* tsgrid-ui 1.0.x (nightly) (5/14/2026,
|
|
1
|
+
/* tsgrid-ui 1.0.x (nightly) (5/14/2026, 1:17:35 AM) (c) 2014 vitmalina@gmail.com, (c) 2026 DaverSoGT — MIT */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -3045,15 +3045,13 @@ function _date(dateStr, settings, deps) {
|
|
|
3045
3045
|
// src/tsutils-locale.ts
|
|
3046
3046
|
async function _locale(locale, keepPhrases, noMerge, settings, deps) {
|
|
3047
3047
|
if (Array.isArray(locale)) {
|
|
3048
|
-
let mergedSettings = deps.extend({}, settings,
|
|
3049
|
-
const localeArr = locale
|
|
3048
|
+
let mergedSettings = deps.extend({}, { ...settings, phrases: {} });
|
|
3049
|
+
const localeArr = locale.map(
|
|
3050
|
+
(f) => f.length === 5 ? "locale/" + f.toLowerCase() + ".json" : f
|
|
3051
|
+
);
|
|
3050
3052
|
const proms = [];
|
|
3051
3053
|
const files = {};
|
|
3052
|
-
localeArr.forEach((file
|
|
3053
|
-
if (file.length === 5) {
|
|
3054
|
-
file = "locale/" + file.toLowerCase() + ".json";
|
|
3055
|
-
localeArr[ind] = file;
|
|
3056
|
-
}
|
|
3054
|
+
localeArr.forEach((file) => {
|
|
3057
3055
|
proms.push(_locale(file, true, false, mergedSettings, deps));
|
|
3058
3056
|
});
|
|
3059
3057
|
const res = await Promise.allSettled(proms);
|
|
@@ -3084,7 +3082,8 @@ async function _locale(locale, keepPhrases, noMerge, settings, deps) {
|
|
|
3084
3082
|
const newSettings = deps.extend({}, settings, data);
|
|
3085
3083
|
return { kind: "load", file: localeStr, data, settings: newSettings };
|
|
3086
3084
|
} else {
|
|
3087
|
-
const
|
|
3085
|
+
const phrasesCleared = { ...settings, phrases: {} };
|
|
3086
|
+
const newSettings = deps.extend({}, phrasesCleared, TsLocale, data);
|
|
3088
3087
|
return { kind: "load", file: localeStr, data, settings: newSettings };
|
|
3089
3088
|
}
|
|
3090
3089
|
}
|