diff --git a/Site/Inspection/Report.aspx b/Site/Inspection/Report.aspx index a27c42f..89a4209 100644 --- a/Site/Inspection/Report.aspx +++ b/Site/Inspection/Report.aspx @@ -81,8 +81,8 @@ } .question { - min-height: 24px; - line-height: 24px; + /*min-height: 24px;*/ + /*line-height: 24px;*/ padding-left: 70px; padding-right: 10px; font-size: 14px; @@ -92,8 +92,8 @@ } .answer { - min-height: 24px; - line-height: 24px; + /*min-height: 24px;*/ + /*line-height: 24px;*/ padding-left: 90px; padding-right: 10px; } @@ -186,12 +186,19 @@ } } - .question_line { - border-collapse: collapse; + .question_line tr { border-top: 1px solid #dbdbdb; border-bottom: 1px solid #dbdbdb; } + .question_line { + border-collapse: collapse; + } + + .answer_line { + border-collapse: collapse; + } + .question_table_grid { border-collapse: collapse; } @@ -200,10 +207,20 @@ border: 1px solid #dbdbdb; } - .question_div_grid { + .question_standard_table_line { + border-top: 1px solid #dbdbdb; + border-bottom: 1px solid #dbdbdb; + } + + .question_standard_table_grid { border: 1px solid #dbdbdb; } + .answer_div_grid { + border-left: 1px solid #dbdbdb; + border-right: 1px solid #dbdbdb; + } + .mediacaption { text-align: center; clear: both; diff --git a/Site/Inspection/ReportForWorkOrder.aspx b/Site/Inspection/ReportForWorkOrder.aspx index b0ac4c3..58adef1 100644 --- a/Site/Inspection/ReportForWorkOrder.aspx +++ b/Site/Inspection/ReportForWorkOrder.aspx @@ -60,7 +60,7 @@ .page { /*background-color: #d3d3d3;*/ /*height: 52px;*/ - line-height: 52px; + line-height: 25px; margin-top: 8px; padding-left: 10px; padding-right: 10px; @@ -72,7 +72,7 @@ .section { /*background-color: #eaeaea;*/ /*height: 40px;*/ - line-height: 40px; + line-height: 20px; padding-left: 30px; padding-right: 10px; font-size: 20px; @@ -81,8 +81,8 @@ } .question { - min-height: 30px; - line-height: 30px; + min-height: 24px; + line-height: 24px; padding-left: 70px; padding-right: 10px; font-size: 14px; @@ -92,12 +92,21 @@ } .answer { - min-height: 30px; - line-height: 30px; + min-height: 24px; + line-height: 24px; padding-left: 90px; padding-right: 10px; } + .table_content { + padding-left: 3px; + padding-right: 3px; + } + + .pagedoublespace { + line-height: 50px; + } + .media { width: 120px; height: 120px; @@ -176,6 +185,50 @@ display: block; } } + + .question_line tr { + border-top: 1px solid #dbdbdb; + border-bottom: 1px solid #dbdbdb; + } + + .question_line { + border-collapse: collapse; + } + + .answer_line { + border-collapse: collapse; + } + + .question_table_grid { + border-collapse: collapse; + } + + .question_table_grid td { + border: 1px solid #dbdbdb; + } + + .question_standard_table_line { + border-top: 1px solid #dbdbdb; + border-bottom: 1px solid #dbdbdb; + } + + .question_standard_table_grid { + border: 1px solid #dbdbdb; + } + + .answer_div_grid { + border-left: 1px solid #dbdbdb; + border-right: 1px solid #dbdbdb; + } + + .mediacaption { + text-align: center; + clear: both; + height: 25px; + width: 120px; + overflow: hidden; + text-overflow: ellipsis; + } @@ -249,6 +302,19 @@ Print
+ |
+
+ |
+
+ |
+
=0&&t>=0&&(i=l[o],!(i==null||i.className!=="column"));o-=1){if(ti.offsetWidth/2?o:o+1;break}t-=i.offsetWidth}r??(r=0)}else{const o=l.length;for(let c=e;c =0;c+=1){if(i=l[c],i==null||i.className!=="column"){r=c;break}if(t i.offsetWidth/2?c+1:c;break}t-=i.offsetWidth}r??(r=o-1)}if(r!==a(this,A).__orderIndex){if(a(this,A).__orderIndex=r,i=l[r],i==null)return;a(this,v).draggerCursor.style.left=`${i.offsetLeft-n}px`,a(this,v).draggerCursor.style.display="block"}},ht=new WeakSet,ri=function(e){a(this,v).dragger.style.display="",a(this,v).draggerCursor.style.display="";const t=a(this,A).__orderIndex;if(t>=0&&t!==e){let s=t-e;if(s>=0&&s<=1)return;const n=a(this,v).header,l=n.children,i=a(this,v).bodyContent.children,r=this.columns;if(s>1){s=t-1;const o=r.splice(e,1)[0];r.splice(s,0,o),n.insertBefore(l[e],l[s].nextElementSibling);for(let c of i)c.insertBefore(c.children[e],c.children[s].nextElementSibling)}else{s=t;const o=r.splice(e,1)[0];r.splice(s,0,o),n.insertBefore(l[e],l[s]);for(let c of i)c.insertBefore(c.children[e],c.children[s])}[...l].forEach((o,c)=>{const u=o.querySelector(".arrow");u!=null&&u.className!=="arrow"&&(this.sortIndex=c)}),typeof this.columnChanged=="function"&&this.columnChanged(it.Reorder,e,s)}},Me=new WeakSet,Ot=function(e,t){const s=this.rowHeight+1;if(e-=e%(s*2)+Kt*s,e<0)e=0;else{let n=a(this,ue)-(t?0:a(this,Z)*s);n<0&&(n=0),e>n&&(e=n)}return a(this,Le)!==e?(x(this,Le,e),this.virtual&&x(this,K,e/s),this.refresh(),this.virtual&&(a(this,v).bodyContent.style.top=`${e}px`)):t&&this.refresh(),e},$=new WeakSet,X=function(e,t){const s=a(this,A)[e];return s==null?null:s[t]},se=new WeakSet,Ne=function(e,t,s){const n=a(this,A)[e];n==null?a(this,A)[e]={[t]:s}:n[t]=s},pe=new WeakSet,Ze=function(e,t,s){let n;return typeof s=="function"?n=s(e):n=e[t],(n==null?void 0:n.value)??n},We=new WeakSet,$t=function(e){let t;for(;(t=e.parentElement)!=null&&!t.classList.contains("ui-grid-row");)e=t;return[t,e]},De=new WeakSet,Pt=function(e){return/^(input|label|layer|svg|use)$/i.test(e)},Fe=new WeakSet,Vt=function(e,t,s){if(!(!s&&(y(this,$,X).call(this,t.key,"resizing")||y(this,$,X).call(this,t.key,"dragging")))&&!y(this,De,Pt).call(this,e.target.tagName)){const n=this.columns.indexOf(t);if(n<0)return;this.sortIndex===n?this.sortDirection=this.sortDirection===1?-1:1:this.sortIndex=n,this.sortColumn(!0),typeof this.columnChanged=="function"&&this.columnChanged(it.Sort,n,this.sortDirection)}},ye=new WeakSet,Je=function(){const e=a(this,V).querySelectorAll(".filter-panel.active");if(e.length>0){e.forEach(s=>s.classList.remove("active")),setTimeout(()=>a(this,V).querySelectorAll(".filter-panel").forEach(s=>s.remove()),120);const t=a(this,A).__filtering;return t instanceof HTMLElement&&t.classList.remove("hover"),delete a(this,A).__filtering,!0}return!1},ft=new WeakSet,oi=function(e,t){if(y(this,ye,Je).call(this))return;const s=h=>{h.target.tagName==="LAYER"&&h.target.classList.contains("filter")||h.target.tagName==="use"||y(this,ye,Je).call(this)&&document.removeEventListener("mousedown",s)};document.addEventListener("mousedown",s);const n=p("div","filter-panel");n.addEventListener("mousedown",h=>h.stopPropagation());const l=e.currentTarget,i=l.parentElement,r=i.offsetWidth;n.style.top=`${i.offsetHeight}px`,n.style.left=i.offsetLeft+(r>Gt?r-Gt:0)+"px";let o;if(t.allowSearch!==!1){const h=p("div","filter-search-holder");o=p("input","filter-search-box ui-text"),o.type="text";const m=P("fa-regular","search");m.addEventListener("mousedown",k=>{o.focus(),k.preventDefault()}),h.append(o,m),n.append(h)}const c=p("div","filter-item-list");c.addEventListener("scroll",h=>qe(y(this,pt,ai),st,this,t,c,h.target.scrollTop),{passive:!0});const u=p("div","filter-item filter-all");u.appendChild(ne({label:this.langs.all,onchange:h=>{const m=h.target.checked;c.querySelectorAll(".filter-content input").forEach(k=>k.checked=m)}})),c.appendChild(u);let f;if(Array.isArray(t.filterSource))f=t.filterSource;else if(typeof t.filterSource=="function")f=t.filterSource.call(this,t);else{const h=Object.create(null);for(let m of a(this,F)){const k=y(this,pe,Ze).call(this,m.values,t.key,t.filter);if(!Object.hasOwnProperty.call(h,k)){const E=m.values[t.key];h[k]={value:k,displayValue:typeof t.filter=="function"?t.filter(m.values):(E==null?void 0:E.displayValue)??E}}}f=Object.values(h).sort((m,k)=>(m=(m==null?void 0:m.value)??m,k=(k==null?void 0:k.value)??k,m>k?1:m Object.prototype.hasOwnProperty.call(h,"value")&&Object.prototype.hasOwnProperty.call(h,"displayValue")?h:{value:h,displayValue:h??""}),y(this,je,Mt).call(this,t,c,f,u),u.querySelector("input").checked=![...c.querySelectorAll(".filter-content input")].some(h=>!h.checked),n.appendChild(c),o!=null&&o.addEventListener("input",h=>{const m=h.currentTarget.value.toLowerCase(),k=m.length===0?f:f.filter(E=>{const _=(E==null?void 0:E.displayValue)??E;return String(_??"").indexOf(m)>=0});y(this,je,Mt).call(this,t,c,k,u)});const b=p("div","filter-function");b.append(p("button",h=>{h.innerText=this.langs.ok,h.addEventListener("click",()=>{const m=y(this,$,X).call(this,t.key,"filterSource").filter(k=>k.__checked!==!1);typeof t.onFilterOk=="function"?t.onFilterOk.call(this,t,m):t.filterValues=m.map(k=>k.value),a(this,A).__filtered=!0,y(this,Te,Ct).call(this),typeof t.onFiltered=="function"&&t.onFiltered.call(this,t),l.classList.add("active"),y(this,ye,Je).call(this)})}),p("button",h=>{h.innerText=this.langs.reset,h.addEventListener("click",()=>{delete t.filterValues,a(this,A).__filtered=this.columns.some(m=>t.filterValues!=null),y(this,Te,Ct).call(this),typeof t.onFiltered=="function"&&t.onFiltered.call(this,t),l.classList.remove("active"),y(this,ye,Je).call(this)})})),n.appendChild(b),a(this,V).appendChild(n),setTimeout(()=>n.classList.add("active"),0),a(this,A).__filtering=l,l.classList.add("hover")},je=new WeakSet,Mt=function(e,t,s,n){var c,u;(c=t.querySelector(".filter-holder"))==null||c.remove(),(u=t.querySelector(".filter-content"))==null||u.remove();const l=this.filterRowHeight,i=s.length*l;y(this,se,Ne).call(this,e.key,"filterHeight",i);const r=p("div","filter-holder");r.style.height=`${i}px`;const o=p("div","filter-content");o.style.top=`${l}px`,y(this,se,Ne).call(this,e.key,"filterSource",s);for(let f of s)f.__checked=!Array.isArray(e.filterValues)||e.filterValues.indexOf(f.value??f)>=0;s.length>12&&(s=s.slice(0,12)),y(this,Be,Wt).call(this,o,s,n),t.append(r,o)},Be=new WeakSet,Wt=function(e,t,s){for(let n of t){const l=p("div","filter-item");l.appendChild(ne({checked:n.__checked,label:(n==null?void 0:n.displayValue)??n,onchange:i=>{n.__checked=i.target.checked,s.querySelector("input").checked=![...e.querySelectorAll("input")].some(r=>!r.checked)}})),e.appendChild(l)}},pt=new WeakSet,ai=function(e,t,s){const n=this.filterRowHeight;if(s-=s%(n*2)+n,s<0)s=0;else{let l=y(this,$,X).call(this,e.key,"filterHeight")-12*n;l<0&&(l=0),s>l&&(s=l)}if(y(this,$,X).call(this,e.key,"filterTop")!==s){y(this,se,Ne).call(this,e.key,"filterTop",s);const l=s/n;let i=y(this,$,X).call(this,e.key,"filterSource");l+12 input")),r.style.top=`${s+n}px`}},yt=new WeakSet,ci=function(e,t){if(y(this,De,Pt).call(this,e.target.tagName))return;const s=nt(e),n=ze(e.currentTarget),l=c=>{for(let u of["mousemove","mouseup"])c.hasOwnProperty(u)&&(window.removeEventListener(u,c[u]),delete c[u])};let i=a(this,A)[t.key];i==null?i=a(this,A)[t.key]={}:l(i),i.dragging=!0;const r=a(this,v).header.querySelector("th:last-child").offsetLeft,o=c=>{const u=nt(c),f=u-s;let b=i.offset,h;(b==null&&(f>Ut||f<-Ut)||b!==f)&&(h=!0),h&&(y(this,ut,li).call(this,n,f,u,r),i.offset=f)};i.mousemove=c=>qe(o,st,this,c),i.mouseup=()=>{l(i),i.offset==null?delete i.dragging:(setTimeout(()=>{delete i.dragging,delete i.offset}),y(this,ht,ri).call(this,n))},["mousemove","mouseup"].forEach(c=>window.addEventListener(c,i[c]))},gt=new WeakSet,di=function(e,t){const s=nt(e),n=t.width,l=ze(e.currentTarget.parentElement),i=this.window??le,r=u=>{for(let f of["mousemove","mouseup"])u.hasOwnProperty(f)&&(i.removeEventListener(f,u[f]),delete u[f])};let o=a(this,A)[t.key];o==null?o=a(this,A)[t.key]={}:r(o),o.resizing=n;const c=u=>{const f=nt(u),b=n+(f-s);b<_e||(o.resizing=b,o.sizing=!0,y(this,fe,Ge).call(this,l,b))};o.mousemove=u=>qe(c,st,this,u),o.mouseup=u=>{r(o);const f=o.resizing;f!=null&&(setTimeout(()=>delete o.resizing),o.sizing&&(delete o.sizing,delete o.autoResize,y(this,fe,Ge).call(this,l,f),typeof this.columnChanged=="function"&&this.columnChanged(it.Resize,l,f))),u.stopPropagation(),u.preventDefault()},["mousemove","mouseup"].forEach(u=>i.addEventListener(u,o[u]))},mt=new WeakSet,ui=function(e,t){const s=e.currentTarget.parentElement,n=ze(s);let l=s.querySelector("div:first-child").scrollWidth;for(let i of a(this,v).bodyContent.children){const o=i.children[n].children[0].scrollWidth;o>l&&(l=o)}l<_e&&(l=_e),l>0&&l!==t.width&&(l+=12,y(this,fe,Ge).call(this,n,l),typeof this.columnChanged=="function"&&this.columnChanged(it.Resize,n,l))},bt=new WeakSet,hi=function(e,t){if(a(this,H)==null)return;const s=e.key,n=typeof e.enabled=="function",l=typeof e.enabled=="string";if(typeof e.onallchecked=="function")e.onallchecked.call(this,e,t);else{for(let i of a(this,H)){const r=i.values;if(r==null)continue;(n?e.enabled(r):l?r[e.enabled]:e.enabled)!==!1&&(r[s]=t,i.__changed=!0,typeof e.onchanged=="function"&&e.onchanged.call(this,r,t))}this.refresh()}},vt=new WeakSet,fi=function(e){const t=e.target.scrollLeft;if(a(this,he)!==t&&(x(this,he,t),a(this,v).header.style.left=`${-t}px`),!this.virtual)return;const s=e.target.scrollTop;y(this,Me,Ot).call(this,s)},xt=new WeakSet,pi=function(e,t){if(e.target.classList.contains("ui-grid-hover-holder"))return;let[s,n]=y(this,We,$t).call(this,e.target);if(s==null){delete t.dataset.row,delete t.dataset.col,t.classList.contains("active")&&t.classList.remove("active");return}const l=n.children[0];if((l==null?void 0:l.tagName)!=="SPAN"){t.classList.contains("active")&&(delete t.dataset.row,delete t.dataset.col,t.classList.remove("active"));return}const i=n.dataset.row,r=n.dataset.col;if(!(t.dataset.row===i&&t.dataset.col===r))if(l.scrollWidth>l.offsetWidth){t.dataset.row=i,t.dataset.col=r,t.innerText=l.innerText;const o=a(this,v).bodyContent.offsetTop+n.offsetTop;let c=n.offsetLeft,u=t.offsetWidth;u>a(this,ie)&&(u=a(this,ie));const f=a(this,ie)+a(this,he)-u;c>f&&(c=f);const b=n.offsetHeight;t.style.cssText=`top: ${o}px; left: ${c}px; max-width: ${a(this,ie)}px; height: ${b-2}px`,t.classList.add("active")}else t.classList.contains("active")&&(delete t.dataset.row,delete t.dataset.col,t.classList.remove("active"))},Xe=new WeakSet,Dt=function(e,t,s){const n=a(this,K),l=n+t;if(typeof this.willSelect=="function"&&!this.willSelect(l,s))return;let i=!1;const r=a(this,M);if(this.multiSelect){if(e.ctrlKey){const o=r.indexOf(l);o<0?r.push(l):r.splice(o,1),i=!0}else if(e.shiftKey&&r.length>0&&(r.length>1||r[0]!==l)){let o=r[r.length-1],c;o>l?(c=o,o=l):c=l,r.splice(0);for(let u=o;u<=c;u+=1)r.push(u);i=!0}}(!i&&r.length!==1||r[0]!==l)&&(r.splice(0,r.length,l),i=!0),i&&(this.readonly!==!0?this.refresh():[...a(this,v).bodyContent.children].forEach((o,c)=>{r.indexOf(n+c)>=0?o.classList.add("selected"):o.classList.contains("selected")&&o.classList.remove("selected")}),typeof this.selectedRowChanged=="function"&&this.selectedRowChanged(l)),x(this,Ce,s),(this.fullrowClick||s>=0)&&e.buttons===1&&typeof this.cellClicked=="function"&&this.cellClicked(l,s)===!1&&(e.stopPropagation(),e.preventDefault())},Ye=new WeakSet,Ft=function(e){if(e.target.tagName==="INPUT"||e.target.tagName==="TEXTAREA"||e.target.tagName==="LAYER"&&e.target.className==="ui-check-inner"||e.target.tagName==="LABEL"&&(e.target.className==="ui-drop-text"||e.target.className==="ui-drop-caret"))return;const t=this.selectedIndex;if(typeof this.rowDblClicked=="function"&&this.rowDblClicked(t),typeof this.cellDblClicked=="function"){const s=a(this,Ce);(this.fullrowClick||s>=0)&&this.cellDblClicked(t,s)}},Se=new WeakSet,Lt=function(e,t,s,n,l,i){var u;if(a(this,H)==null)return;const r=a(this,H)[a(this,K)+t],o=r.values;if(o==null)return;let c=s.enabled;if(typeof c=="function"?c=c.call(s,o):typeof c=="string"&&(c=o[c]),c!==!1){o[s.key]=n;let f=s.tooltip;typeof f=="function"&&(f=f.call(s,o)),ee(f)?(u=l.querySelector(".ui-tooltip-wrapper"))==null||u.remove():et(l.children[0],f,!1,this.element),r.__changed=!0,i?typeof s.oneditend=="function"&&s.oneditend.call(this,o,n):typeof s.onchanged=="function"&&s.onchanged.call(this,o,n)}},C(Re,"ColumnTypes",{Common:0,Input:1,Dropdown:2,Checkbox:3,Icon:4,Text:5,isCheckbox(e){return e===3}}),C(Re,"GridColumn",te);const Wi="",z={right:1,bottom:2,left:4,top:8,bottomRight:3,bottomLeft:6,topRight:9,topLeft:12};function lt(d){if(typeof d!="string")return d;if(d.endsWith("px")){const e=Number(d.substring(0,d.length-2));return isNaN(e)?d:e}return d}class rt{constructor(e={}){g(this,B);g(this,j,void 0);g(this,U,void 0);g(this,J,void 0);x(this,U,e)}get container(){return a(this,j).querySelector(".ui-popup-container")}get rect(){const e=this.container;if(e==null)return null;const t=le.getComputedStyle(e),s=e.classList.contains("ui-popup-collapse"),n=a(this,J);return{collapsed:s,left:lt(t.left),top:lt(t.top),width:s===!0&&n!=null?n.width:lt(t.width),height:s===!0&&n!=null?n.height:lt(t.height)}}set rect(e){const t=this.container;if(t==null)return;const s=[];isNaN(e.left)||s.push(`left: ${e.left}px`),isNaN(e.top)||s.push(`top: ${e.top}px`);const n=t.querySelector(".ui-popup-header>.icon-expand");e.collapsed===!0?(s.push("width: 160px","height: 40px"),x(this,J,e),t.classList.add("ui-popup-collapse"),n!=null&&Ie(n,"fa-regular","expand-alt")):(!isNaN(e.width)&&e.width>0&&s.push(`width: ${e.width}px`),!isNaN(e.height)&&e.height>0&&s.push(`height: ${e.height}px`),t.classList.remove("ui-popup-collapse"),x(this,J,null),n!=null&&Ie(n,"fa-regular","compress-alt")),s.length>0&&(t.style.cssText+=s.join("; "))}close(e=!0){const t=a(this,j);e?(t.classList.add("ui-popup-active"),t.style.opacity=0,setTimeout(()=>{t.remove()},120)):t.remove(),typeof a(this,U).onMasking=="function"&&a(this,U).onMasking.call(this,!1)}create(){const e=p("div","ui-popup-mask"),t=a(this,U);t.mask===!1?e.classList.add("ui-popup-transparent"):typeof t.onMasking=="function"&&a(this,U).onMasking.call(this,!0),isNaN(t.zIndex)||(e.style.zIndex=String(t.zIndex));const s=p("div","ui-popup-container");t.changeZIndex===!0&&s.addEventListener("mousedown",()=>{const i=[...a(this,j).parentElement.children].filter(o=>o.classList.contains("ui-popup-mask"));let r=200;i.forEach(o=>{let c;o.dataset.zindex!=null?(c=parseInt(o.dataset.zindex),o.style.zIndex=isNaN(c)?"":String(c),delete o.dataset.zindex):c=parseInt(o.style.zIndex),c>r&&(r=c)}),e.dataset.zindex=e.style.zIndex,e.style.zIndex=r+1});let n=Math.max.apply(null,[...document.querySelectorAll("[tabindex]")].map(i=>i.tabIndex??0));n<0&&(n=0),s.tabIndex=n+1;let l=t.content;if(l instanceof HTMLElement||(l=p("div",i=>i.innerText=l)),s.append(p("div",i=>{i.className="ui-popup-header";let r=t.title;if(r instanceof HTMLElement||(r=p("div",c=>{c.className="ui-popup-header-title",c.innerText=r})),i.appendChild(r),t.movable!==!1&&(r.querySelector(".ui-popup-move")??r).addEventListener("mousedown",u=>{if(u.buttons!==1)return;const f=u.clientX-s.offsetLeft,b=u.clientY-s.offsetTop;let h;const m=E=>{E.buttons===1?(s.style.left=`${E.clientX-f}px`,s.style.top=`${E.clientY-b}px`,h=!0):e.dispatchEvent(new MouseEvent("mouseup"))};e.addEventListener("mousemove",m,{passive:!1});const k=()=>{e.removeEventListener("mousemove",m,{passive:!1}),e.removeEventListener("mouseup",k),h===!0&&typeof t.onMoveEnded=="function"&&t.onMoveEnded.call(this),h=!1};e.addEventListener("mouseup",k)}),t.collapsable===!0){const c=P("fa-regular","compress-alt");c.tabIndex=n+2,c.classList.add("icon-expand"),c.addEventListener("keypress",u=>{(u.key===" "||u.key==="Enter")&&c.dispatchEvent(new MouseEvent("click"))}),c.addEventListener("click",()=>{if(s.classList.contains("ui-popup-collapse")){const u=a(this,J);u!=null&&(s.style.cssText+=`width: ${u.width}px; height: ${u.height}px`,x(this,J,null)),s.classList.remove("ui-popup-collapse"),Ie(c,"fa-regular","compress-alt")}else{const u=this.rect;x(this,J,u),s.style.cssText+="width: 160px; height: 40px",s.classList.add("ui-popup-collapse"),Ie(c,"fa-regular","expand-alt")}typeof t.onResizeEnded=="function"&&t.onResizeEnded.call(this)}),i.appendChild(c)}const o=P("fa-regular","times");o.tabIndex=n+3,o.addEventListener("keypress",c=>{(c.key===" "||c.key==="Enter")&&this.close()}),o.addEventListener("click",()=>this.close()),i.appendChild(o)}),p("div","ui-popup-body",l,p("div","ui-popup-loading",p("div",null,P("fa-regular","spinner-third"))))),Array.isArray(t.buttons)&&t.buttons.length>0){n=Math.max.apply(null,[...s.querySelectorAll("[tabindex]")].map(u=>u.tabIndex??0)),s.appendChild(p("div","ui-popup-footer",...t.buttons.map((u,f)=>{const b=p("button","ui-popup-button");return u.tabIndex>0?b.tabIndex=u.tabIndex:b.tabIndex=n+f+1,b.innerText=u.text,b.addEventListener("click",()=>{if(typeof u.trigger=="function"){const h=u.trigger(this);typeof(h==null?void 0:h.then)=="function"?h.then(m=>{m!==!1&&this.close()}).catch(m=>console.warn(m)):h!==!1&&this.close()}else this.close()}),b})));const i=[...s.querySelectorAll("[tabindex]")].map(u=>u.tabIndex??0),r=Math.min.apply(null,i),o=Math.max.apply(null,i),c=s.querySelector(`[tabindex="${o}"]`);c!=null&&c.addEventListener("keydown",u=>{if(u.key==="Tab"){const f=s.querySelector(`[tabindex="${r}"]`);f==null||f.focus(),u.preventDefault()}})}else s.querySelector(".ui-popup-body>.ui-popup-loading").classList.add("ui-popup-loading-content");return t.resizable===!0&&s.append(p("layer",i=>{i.className="ui-popup-border ui-popup-border-right",i.addEventListener("mousedown",r=>y(this,B,Q).call(this,z.right,r))}),p("layer",i=>{i.className="ui-popup-border ui-popup-border-bottom",i.addEventListener("mousedown",r=>y(this,B,Q).call(this,z.bottom,r))}),p("layer",i=>{i.className="ui-popup-border ui-popup-border-left",i.addEventListener("mousedown",r=>y(this,B,Q).call(this,z.left,r))}),p("layer",i=>{i.className="ui-popup-border ui-popup-border-top",i.addEventListener("mousedown",r=>y(this,B,Q).call(this,z.top,r))}),p("layer",i=>{i.className="ui-popup-border ui-popup-border-bottom-right",i.addEventListener("mousedown",r=>y(this,B,Q).call(this,z.bottomRight,r))}),p("layer",i=>{i.className="ui-popup-border ui-popup-border-bottom-left",i.addEventListener("mousedown",r=>y(this,B,Q).call(this,z.bottomLeft,r))}),p("layer",i=>{i.className="ui-popup-border ui-popup-border-top-left",i.addEventListener("mousedown",r=>y(this,B,Q).call(this,z.topLeft,r))}),p("layer",i=>{i.className="ui-popup-border ui-popup-border-top-right",i.addEventListener("mousedown",r=>y(this,B,Q).call(this,z.topRight,r))})),e.appendChild(s),x(this,j,e),e}show(e=document.body){if(e==null)return;let t=a(this,j)??this.create();const s=[...e.children].filter(l=>l.classList.contains("ui-popup-mask"));let n=0;for(let l of s){let i=parseInt(l.style.zIndex);!isNaN(i)&&i>n&&(n=i)}if(n>0&&(t.style.zIndex=String(n+1)),e.appendChild(t),a(this,U).mask===!1){const l=this.container;l.style.left=String((e.offsetWidth-l.offsetWidth)/2)+"px",l.style.top=String((e.offsetHeight-l.offsetHeight)/2)+"px"}return new Promise(l=>{setTimeout(()=>{t.style.opacity=1,this.container.focus(),l(t)},0)})}get loading(){var e,t,s;return((s=(t=(e=a(this,j))==null?void 0:e.querySelector(".ui-popup-body>.ui-popup-loading"))==null?void 0:t.style)==null?void 0:s.visibility)==="visible"}set loading(e){var s;let t=(s=a(this,j))==null?void 0:s.querySelector(".ui-popup-body>.ui-popup-loading");t!=null&&(e===!1?(t.style.visibility="hidden",t.style.opacity=0):(t.style.visibility="visible",t.style.opacity=1))}}j=new WeakMap,U=new WeakMap,J=new WeakMap,B=new WeakSet,Q=function(e,t){if(t.buttons!==1)return;const s=this.container,n=a(this,U);typeof n.onResizeStarted=="function"&&n.onResizeStarted.call(this);const l=a(this,j),i=t.clientX,r=t.clientY,o={width:s.offsetWidth,height:s.offsetHeight,left:s.offsetLeft,top:s.offsetTop},c=n.minWidth??200,u=n.minHeight??200;let f;const b=n.mask===!1?l.parentElement:l,h=k=>{if(k.buttons!==1){b.dispatchEvent(new MouseEvent("mouseup"));return}const E=k.clientX-i,_=k.clientY-r;let T=o.width,S=o.height,G=o.left,ge=o.top;(e&z.right)===z.right&&(T+=E,T {b.removeEventListener("mousemove",h,{passive:!1}),b.removeEventListener("mouseup",m),f===!0&&typeof n.onResizeEnded=="function"&&n.onResizeEnded.call(this),f=!1};b.addEventListener("mouseup",m)};function Ai(d,e,...t){return new rt({title:d,content:e,buttons:t})}const Zt={info:"info-circle",information:"info-circle",warn:"exclamation-triangle",warning:"exclamation-triangle",question:"question-circle",error:"times-circle"};function qi(d,e,t="info",s=document.body){return new Promise(n=>{new rt({title:d,content:p("div","message-wrapper",P("fa-solid",Zt[t]??"info-circle"),p("span",i=>i.innerText=e)),buttons:[{text:W("ok","OK"),trigger:n}]}).show(s).then(i=>{const r=i.querySelector(".ui-popup-container .ui-popup-footer .ui-popup-button:last-child");r==null||r.focus()})})}function _i(d,e,t,s="question",n=document.body){return new Promise(l=>{const i=p("div","message-wrapper");ee(s)||i.appendChild(P("fa-solid",Zt[s]??"question-circle")),i.appendChild(e instanceof HTMLElement?e:p("span",o=>o.innerText=e)),new rt({title:d,content:i,buttons:(t==null?void 0:t.map(o=>({text:o.text,trigger:c=>{let u;if(typeof o.trigger=="function"){if(u=o.trigger(c,o),typeof(u==null?void 0:u.then)=="function")return u.then(f=>(f!==!1&&l(f),f));u!==!1&&l(u)}else u={key:o.key,popup:c},l(u);return u}})))??[{text:W("yes","Yes"),trigger:o=>l({key:"yes",popup:o})},{text:W("no","No"),trigger:o=>l({key:"no",popup:o})}]}).show(n).then(o=>{const c=o.querySelector(".ui-popup-container .ui-popup-footer .ui-popup-button:last-child");c==null||c.focus()})})}w.Dropdown=tt,w.Grid=Re,w.Popup=rt,w.changeIcon=Ie,w.createCheckbox=ne,w.createElement=p,w.createIcon=P,w.createPopup=Ai,w.createRadiobox=gi,w.resolveCheckbox=mi,w.resolveIcon=yi,w.resolveTooltip=bi,w.setTooltip=et,w.showAlert=qi,w.showConfirm=_i,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})}); +(function(w,L){typeof exports=="object"&&typeof module<"u"?L(exports):typeof define=="function"&&define.amd?define(["exports"],L):(w=typeof globalThis<"u"?globalThis:w||self,L(w["lib-ui"]={}))})(this,function(w){var I,D,R,O,Y,be,He,oe,ae,ce,Ue,ve,wt,xe,kt,Oe,_t,Pe,zt,$e,Rt,Ve,Ht,F,H,we,V,v,ke,Ce,M,K,de,ue,ie,Z,Le,he,Ee,q,At,Te,Ct,ot,ti,at,ii,ct,si,dt,ni,fe,Ge,ut,li,ht,ri,Me,Ot,P,X,se,Ne,pe,Ze,We,Pt,De,$t,Fe,Vt,ye,Je,ft,oi,je,Mt,Be,Wt,pt,ai,yt,ci,gt,di,mt,ui,bt,hi,vt,fi,xt,pi,Xe,Dt,Ye,Ft,Se,Lt,j,U,J,B,Q;"use strict";var zi=Object.defineProperty;var Ri=Object.getPrototypeOf;var Hi=Reflect.get;var Oi=(w,L,N)=>L in w?zi(w,L,{enumerable:!0,configurable:!0,writable:!0,value:N}):w[L]=N;var C=(w,L,N)=>(Oi(w,typeof L!="symbol"?L+"":L,N),N),qt=(w,L,N)=>{if(!L.has(w))throw TypeError("Cannot "+N)};var a=(w,L,N)=>(qt(w,L,"read from private field"),N?N.call(w):L.get(w)),b=(w,L,N)=>{if(L.has(w))throw TypeError("Cannot add the same private member more than once");L instanceof WeakSet?L.add(w):L.set(w,N)},x=(w,L,N,p)=>(qt(w,L,"write to private field"),p?p.call(w,N):L.set(w,N),N);var y=(w,L,N)=>(qt(w,L,"access private method"),N),ei=(w,L,N)=>Hi(Ri(w),N,L);const L="",N="";function p(d,e,...t){const s=document.createElement(d);return typeof e=="function"?e(s):e!=null&&(s.className=e),t.length>0&&s.append(...t),s}const jt="http://www.w3.org/2000/svg";function Et(d,e){const t=typeof consts<"u"?consts:{},s=t.path||"",n=t.resver==null?"":`?${t.resver}`,r=document.createElementNS(jt,"use");return r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",`${s}fonts/${d}.svg${n}#${e}`),r}function Ie(d,e,t){return d instanceof SVGElement&&d.replaceChildren(Et(e,t)),d}function $(d,e,t){const s=document.createElementNS(jt,"svg");if(s.appendChild(Et(d,e)),t!=null)for(let n of Object.entries(t))s.style.setProperty(n[0],n[1]);return s}function yi(d){const e=d.querySelectorAll("svg[data-id]");for(let t of e){const s=t.dataset.type,n=t.dataset.id;t.replaceChildren(Et(s,n)),t.removeAttribute("data-type"),t.removeAttribute("data-id")}return d}const Pi="";function Qe(d,e="fa-regular",t,s=-1,n="check"){d.appendChild(p("layer",r=>{r.className="ui-check-inner",r.addEventListener("keypress",i=>{if(i.key===" "||i.key==="Enter"){const l=d.querySelector("input");l!=null&&(l.checked=!l.checked,l.dispatchEvent(new Event("change")))}}),s>=0&&(r.tabIndex=s)},$(e,n))),t instanceof Element?d.appendChild(t):(t==null?void 0:t.length)>0&&d.appendChild(p("span",r=>r.innerText=t))}function gi(d={}){const e=p("label","ui-check-wrapper ui-radio-wrapper",p("input",t=>{if(t.setAttribute("type","radio"),t.name=d.name,d.checked===!0&&(t.checked=!0),d.enabled===!1&&(t.disabled=!0),d.customerAttributes!=null)for(let s of Object.entries(d.customerAttributes))t.setAttribute(s[0],s[1]);typeof d.onchange=="function"&&t.addEventListener("change",d.onchange)}));return d.className&&e.classList.add(d.className),Qe(e,d.type,d.label,d.tabIndex,"circle"),e}function ne(d={}){const e=p("label","ui-check-wrapper",p("input",t=>{if(t.setAttribute("type","checkbox"),d.checked===!0&&(t.checked=!0),d.enabled===!1&&(t.disabled=!0),d.customerAttributes!=null)for(let s of Object.entries(d.customerAttributes))t.setAttribute(s[0],s[1]);typeof d.onchange=="function"&&t.addEventListener("change",d.onchange)}));return d.className&&e.classList.add(d.className),d.enabled===!1&&e.classList.add("disabled"),d.checkedNode!=null&&d.uncheckedNode!=null?(e.classList.add("ui-check-image-wrapper"),d.imageHeight,d.checkedNode.classList.add("checked"),e.appendChild(d.checkedNode),d.uncheckedNode.classList.add("unchecked"),e.appendChild(d.uncheckedNode)):Qe(e,d.type,d.label,d.tabIndex),e}function mi(d=document.body,e){if(e){const s=d.querySelectorAll('input[type="checkbox"]');for(let n of s){if(n.parentElement.classList.contains("ui-check-wrapper"))continue;const r=n.id;let i,l;if(r!=null&&(i=d.querySelector(`label[for="${r}"]`)),i==null){const o=n.nextElementSibling;o!=null&&(o.tagName==="LABEL"?i=o:o.tagName==="SPAN"&&o.dataset.lgid!=null&&(l=o.innerText,o.style.display="none"))}if(i==null){const o=n.previousElementSibling;o!=null&&(o.tagName==="LABEL"?i=o:l==null&&o.tagName==="SPAN"&&o.dataset.lgid!=null&&(l=o.innerText,o.style.display="none"))}i==null?(i=p("label"),n.parentElement.insertBefore(i,n)):l=i.innerText,n.disabled?i.className="ui-check-wrapper disabled":i.className="ui-check-wrapper",i.replaceChildren(),Qe(i,"fa-regular",l,n.tabIndex),i.insertBefore(n,i.firstChild)}}const t=d.querySelectorAll("label[data-checkbox]");for(let s of t){s.classList.contains("ui-check-wrapper")||s.classList.add("ui-check-wrapper"),s.hasChildNodes()?s.classList.contains("ui-check-image-wrapper")||s.classList.add("ui-check-image-wrapper"):(Qe(s,s.dataset.type,s.dataset.label,s.dataset.tabIndex),s.removeAttribute("data-type"),s.removeAttribute("data-label"));const n=p("input"),r=s.dataset.id;(r==null?void 0:r.length)>0&&(n.id=r),s.dataset.checked!=null&&(n.checked=!0),n.setAttribute("type","checkbox"),s.insertBefore(n,s.firstChild)}return d}const $i="";function et(d,e,t=!1,s=null){const n=s instanceof HTMLElement;if(n){const l=d.dataset.tipId,o=s.querySelector(`.ui-tooltip-wrapper[data-tip-id="${l}"]`);o==null||o.remove()}else{const l=d.querySelector(".ui-tooltip-wrapper");l==null||l.remove()}const r=p("div",l=>{l.className="ui-tooltip-wrapper ui-tooltip-color",l.style.visibility="hidden",l.style.opacity=0,l.style.top="0",l.style.left="0"},p("div","ui-tooltip-pointer ui-tooltip-color"),p("div","ui-tooltip-curtain ui-tooltip-color"),p("div",l=>{l.className="ui-tooltip-content",e instanceof Element?l.appendChild(e):l.innerText=e}));if(n){const l=String(Math.random()).substring(2);d.dataset.tipId=l,r.dataset.tipId=l,s.appendChild(r)}else d.appendChild(r);let i;return d.addEventListener("mouseenter",()=>{i&&clearTimeout(i);let l=d;for(;(l==null?void 0:l.offsetWidth)==null;)l=l.parentElement;l!=null&&(!t||l.scrollWidth>l.offsetWidth)&&(i=setTimeout(()=>{let o,c,u;if(c=l.offsetLeft,u=l.offsetTop,n)for(o=l.offsetParent;o!=null&&o!==s;)c+=o.offsetLeft,u+=o.offsetTop,o=o.offsetParent;o=l.parentElement;const h=n?s:l.offsetParent;for(;o!=null&&o!==h;)c-=o.scrollLeft,u-=o.scrollTop,o=o.parentElement;c+=(l.offsetWidth-r.offsetWidth)/2,r.style.left=`${c}px`;let g=l.offsetTop;for(o=l.offsetParent;o!=null&&window.getComputedStyle(o).overflow==="visible";)g+=o.offsetTop,o=o.offsetParent;const f=r.offsetHeight+14;g+u-f<0?(u+=l.parentElement.offsetHeight+14,r.classList.add("ui-tooltip-down")):(u-=f,r.classList.remove("ui-tooltip-down")),r.style.top=`${u}px`,r.style.visibility="visible",r.style.opacity=1},100))}),d.addEventListener("mouseleave",()=>{i&&clearTimeout(i),i=setTimeout(()=>{r.style.visibility="hidden",r.style.opacity=0},300)}),d}function bi(d=document.body){const e=d.querySelectorAll("[title]");for(let t of e){const s=t.getAttribute("title");s!=null&&(t.removeAttribute("title"),et(t,s))}return d}const Vi="";function ee(d){return d==null||typeof d!="string"||d.length===0}function vi(d,e,t){return ee(d)||e==null?!1:(typeof e!="string"&&(e=String(e)),t?d.toLowerCase().indexOf(e.toLowerCase())>=0:d.indexOf(e)>=0)}function W(d,e){return e}let le=typeof globalThis<"u"?globalThis:self;function Ae(d){return!isNaN(d)&&d>0}function xi(){return/mobile/i.test(navigator.userAgent)}function qe(d,e=100,t=le,...s){if(d==null)return;d.tiid&&clearTimeout(d.tiid);const n=new Date;d.tdate==null||n-d.tdate>e?(d.apply(t,s),d.tdate=n):d.tiid=setTimeout(()=>d.apply(t,s),e)}function wi(d){return(d>0?Math.floor:Math.ceil)(d)}const Bt=Symbol.for("ui-dropdown"),ki=26,Ci=30;let re=le[Bt];re==null&&(re={},Object.defineProperty(re,"clear",{writable:!1,configurable:!1,enumerable:!1,value:function(){const d=document.querySelector(".ui-drop-wrapper .ui-drop-box.active");if(d==null)return;d.classList.remove("active");const e=d.parentElement.dataset.dropId;if(e==null)return;const t=this[e];t!=null&&t.multiselect&&typeof t.oncollapsed=="function"&&t.oncollapsed()}}),le[Bt]=re,document.addEventListener("mousedown",d=>{let e=d.target;for(;e!=null;){if(e.classList.contains("ui-drop-box")){d.stopPropagation();return}e=e.parentElement}re.clear()}));function Xt(d,e,t,s){const n=e.map(r=>r[t]);if(n.some(r=>r instanceof HTMLElement))d.replaceChildren(...n.filter(r=>r!=null).map(r=>r.cloneNode(!0)));else{let r=e.map(i=>i[s]).join(", ");ee(r)&&(r=W("noneItem","( None )")),d.innerText=r}}function Tt(d,e,t,s){return(!Array.isArray(d)||d.length===0)&&(d=[e]),t.length>0&&(s=s.filter(n=>{for(let r of d)if(vi(n[r].toLowerCase(),t))return!0;return!1})),s}const Nt=class{constructor(e={}){b(this,ce);b(this,ve);b(this,xe);b(this,Oe);b(this,I,void 0);b(this,D,void 0);b(this,R,void 0);b(this,O,void 0);b(this,Y,void 0);b(this,be,void 0);b(this,He,void 0);b(this,oe,void 0);b(this,ae,void 0);C(this,"sourceFilter");C(this,"onselectedlist");C(this,"onselected");C(this,"onexpanded");e.searchplaceholder??(e.searchplaceholder=W("searchHolder","Search...")),e.textkey??(e.textkey="text"),e.valuekey??(e.valuekey="value"),e.htmlkey??(e.htmlkey="html"),e.maxlength??(e.maxlength=500),x(this,I,e)}create(){const e=a(this,I),t=p("div","ui-drop-wrapper"),s=String(Math.random()).substring(2);t.dataset.dropId=s,re[s]=this,x(this,D,t);const n=p("div","ui-drop-header");n.addEventListener("keypress",i=>{(i.key===" "||i.key==="Enter")&&n.dispatchEvent(new MouseEvent("click"))}),n.addEventListener("keydown",i=>{var c;const l=i.key==="ArrowUp",o=i.key==="ArrowDown";if(l||o){const u=this.source,h=u.length,g=a(this,I).valuekey;let f=u==null?void 0:u.indexOf(a(this,oe));isNaN(f)||f<-1?f=-1:f>=h&&(f=h-1),l?f>0?f--:f=0:o&&(f<0?f=0:f {if(this.disabled)return;const i=a(this,ce,Ue),l=a(this,O);i&&l.ownerDocument.activeElement===l||(y(this,ve,wt).call(this,!i),!i&&typeof this.onexpanded=="function"&&setTimeout(()=>this.onexpanded(),120))});let r;return e.input?(r=p("input","ui-drop-text"),r.setAttribute("type","text"),e.placeholder&&r.setAttribute("placeholder",e.placeholder),Ae(e.maxlength)&&r.setAttribute("maxlength",e.maxlength),Ae(e.tabIndex)&&r.setAttribute("tabindex",e.tabIndex),r.addEventListener("input",i=>{const l=i.target.value.toLowerCase(),o=Tt(e.searchkeys,e.textkey,l,this.source);y(this,xe,kt).call(this,o),a(this,R).classList.add("active")}),r.addEventListener("blur",i=>this.select(i.target.value)),r.addEventListener("mousedown",i=>a(this,ce,Ue)&&i.stopPropagation())):(Ae(e.tabIndex)&&n.setAttribute("tabindex",e.tabIndex),r=p("label","ui-drop-text")),x(this,O,r),e.multiselect?Array.isArray(e.selectedlist)?this.selectlist(e.selectedlist,!0):(x(this,Y,!0),r.innerText=W("allItem","( All )")):e.selected!=null&&this.select(e.selected,!0),n.append(r,p("label","ui-drop-caret")),t.appendChild(n),this.disabled=e.disabled||!1,t}get multiselect(){return a(this,I).multiselect}get disabled(){return a(this,D)==null||a(this,D).querySelector(".ui-drop-header.disabled")!=null}set disabled(e){a(this,D)!=null&&(e?a(this,D).querySelector(".ui-drop-header").classList.add("disabled"):a(this,D).querySelector(".ui-drop-header").classList.remove("disabled"))}get source(){let e=a(this,be);return(e==null||!Array.isArray(e))&&(typeof this.sourceFilter=="function"&&(e=this.sourceFilter()),Array.isArray(e)||(e=[]),x(this,be,e)),e}set source(e){Array.isArray(e)&&(x(this,be,e),a(this,ce,Ue)&&setTimeout(()=>y(this,ve,wt).call(this),120))}get selected(){return a(this,oe)}get selectedlist(){return a(this,ae)||[]}select(e,t){if(a(this,He)===e)return!1;x(this,He,e);const s=a(this,I).valuekey,n=a(this,I).textkey,r=a(this,I).htmlkey;let i=this.source.find(l=>l[s]===e);if(a(this,I).input)i==null&&(i={[s]:e}),a(this,O).value=e;else{const l=a(this,ce,Ue);if(l&&a(this,R).querySelectorAll("li[data-value].selected").forEach(c=>c.classList.remove("selected")),i==null)return x(this,oe,null),a(this,O).innerText=" ",!1;const o=i[r];if(o instanceof HTMLElement)a(this,O).replaceChildren(o.cloneNode(!0));else{let c=i[n];ee(c)&&(c=" "),a(this,O).innerText=c}if(l){const c=e.replace(/"/g,'\\"'),u=a(this,R).querySelector(`li[data-value="${c}"]`);u!=null&&u.classList.add("selected")}}x(this,oe,i),!t&&typeof this.onselected=="function"&&this.onselected(i)}selectlist(e,t){const s=this.source,n=a(this,I).valuekey,r=a(this,I).textkey,i=a(this,I).htmlkey,l=e.map(o=>{let c=s.find(u=>u[n]===o);return c==null&&(c={[n]:o,[r]:o}),c});if(l.length===0)return x(this,ae,null),a(this,O).innerText=none,!1;Xt(a(this,O),l,i,r),x(this,ae,l),!t&&typeof this.onselectedlist=="function"&&this.onselectedlist(l)}static resolve(e=document.body){const t=e.querySelectorAll("select");for(let s of t){const n=[...s.children].map(i=>({value:i.value,text:i.innerText})),r=new Nt({selected:s.value,disabled:s.disabled,tabIndex:s.tabIndex});r.source=n,s.parentElement.replaceChild(r.create(),s)}return e}};let tt=Nt;I=new WeakMap,D=new WeakMap,R=new WeakMap,O=new WeakMap,Y=new WeakMap,be=new WeakMap,He=new WeakMap,oe=new WeakMap,ae=new WeakMap,ce=new WeakSet,Ue=function(){var e,t;return(t=(e=a(this,R))==null?void 0:e.classList)==null?void 0:t.contains("active")},ve=new WeakSet,wt=function(e=!0){const t=a(this,I);let s=a(this,R);if(s==null){if(s=p("div","ui-drop-box"),!t.input&&t.search){const r=p("div","ui-drop-search"),i=p("input");i.setAttribute("type","text"),Ae(t.tabIndex)&&i.setAttribute("tabindex",t.tabIndex),!ee(t.searchplaceholder)&&i.setAttribute("placeholder",t.searchplaceholder),i.addEventListener("input",l=>{const o=l.target.value.toLowerCase(),c=Tt(t.searchkeys,t.textkey,o,this.source);y(this,xe,kt).call(this,c)}),r.append(i,$("fa-light","search")),s.appendChild(r)}const n=p("ul","ui-drop-list");this.multiselect||n.addEventListener("click",r=>{let i=r.target;for(;i.tagName!=="LI";)if(i=i.parentElement,i==null)return;const l=i.dataset.value;this.select(l)!==!1&&re.clear()}),s.appendChild(n),x(this,R,s),a(this,D).appendChild(s)}if(e){let n=this.source;if(!t.input&&t.search){const r=s.querySelector(".ui-drop-search > input");ee(r==null?void 0:r.value)||(n=Tt(t.searchkeys,t.textkey,r.value,n))}if(y(this,xe,kt).call(this,n),!t.slidefixed){let r=t.parent??document.body,i=a(this,D),l=i.offsetTop;for(;(i=i.parentElement)!=null&&i!==r;)l-=i.scrollTop;l-r.offsetTop+ki+s.offsetHeight>=r.offsetHeight?s.classList.add("slide-up"):s.classList.remove("slide-up")}s.classList.add("active")}else s.classList.remove("active")},xe=new WeakSet,kt=function(e){const t=a(this,R).querySelector(".ui-drop-list");t.replaceChildren();const s=this.multiselect,n=a(this,Y);s&&t.appendChild(p("li",null,ne({label:W("allItem","( All )"),checked:n,customerAttributes:{isall:"1"},onchange:h=>y(this,Oe,_t).call(this,h.target)})));const r=a(this,I).valuekey,i=a(this,I).textkey,l=a(this,I).htmlkey,o=this.selected,c=this.selectedlist;let u;e.slice(0,200).forEach((h,g)=>{const f=h[r],m=p("li");m.dataset.value=f,m.setAttribute("title",h[i]);let k;const T=h[l];if(T instanceof HTMLElement&&(k=T),s){const A=c.some(S=>S[r]===f);k==null&&(k=p("span"),k.innerText=h[i]);const E=ne({label:k,checked:n||A,customerAttributes:{class:"dataitem","data-value":f},onchange:S=>y(this,Oe,_t).call(this,S.target)});m.appendChild(E)}else k==null?m.innerText=h[i]:m.appendChild(k),o!=null&&o[r]===f&&(u=Ci*g,m.classList.add("selected"));t.appendChild(m)}),u!=null&&setTimeout(()=>t.scrollTop=u,10)},Oe=new WeakSet,_t=function(e){let t;const s=a(this,I).valuekey,n=a(this,I).textkey,r=a(this,I).htmlkey;if(e.getAttribute("isall")==="1"){const i=x(this,Y,e.checked);a(this,R).querySelectorAll("input.dataitem").forEach(o=>o.checked=i),t=[]}else if(e.checked)if(a(this,R).querySelectorAll("input.dataitem:not(:checked)").length===0)x(this,Y,!0),a(this,R).querySelector('input[isall="1"]').checked=!0,t=[];else{const i=this.source;t=[...a(this,R).querySelectorAll("input.dataitem:checked")].map(l=>i.find(o=>o[s]===l.dataset.value)).filter(l=>l!=null)}else{const i=e.dataset.value;a(this,Y)?(x(this,Y,!1),a(this,R).querySelector('input[isall="1"]').checked=!1,t=this.source.filter(l=>l[s]!==i)):t=this.selectedlist.filter(l=>l[s]!==i)}a(this,Y)?a(this,O).innerText=W("allItem","( All )"):Xt(a(this,O),t,r,n),x(this,ae,t),typeof this.onselectedlist=="function"&&this.onselectedlist(itemlist)};const Mi="";class te{static create(){return p("span")}static setValue(e,t){e.innerText=t}static setStyle(e,t){for(let s of Object.entries(t))e.style.setProperty(s[0],s[1])}static setEnabled(e,t){const s=e.querySelector(".ui-tooltip-wrapper");s!=null&&(s.style.display=t===!1?"none":"")}}class Yt extends te{static get editing(){return!0}static createEdit(e,t,s,n){const r=p("input");return r.setAttribute("type","text"),typeof e=="function"&&r.addEventListener("change",e),r.addEventListener("input",()=>{n.__editing==null?n.__editing={[t.key]:!0}:n.__editing[t.key]=!0}),r}static setValue(e,t){e.tagName!=="INPUT"?super.setValue(e,t):e.value=t}static getValue(e){return e.target.value}static setEnabled(e,t){super.setEnabled(e,t),e.disabled=t===!1}}class Li extends Yt{static createEdit(e,t,s,n){const r=p("textarea");return typeof e=="function"&&r.addEventListener("change",e),r.addEventListener("input",()=>{n.__editing==null?n.__editing={[t.key]:!0}:n.__editing[t.key]=!0}),r}static setValue(e,t,s,n,r){if(e.tagName!=="TEXTAREA")super.setValue(e,t);else if(e.value=t,t!=null){const i=String(t).split(` +`).length;e.style.height=`${i*r.lineHeight+12}px`}}}const Ei=Symbol.for("ui-dropdown"),It=class extends te{static createEdit(e,t,s){const n=new tt({...t.dropOptions,parent:s});return n.onselected=e,n.create()}static setValue(e,t,s,n){if(e.tagName!=="DIV"){let i=y(this,$e,Rt).call(this,s,n);i instanceof Promise?i.then(l=>y(this,Ve,Ht).call(this,l,e,t)):y(this,Ve,Ht).call(this,i,e,t);return}const r=y(this,Pe,zt).call(this,e);if(r!=null){if(r.source==null||r.source.length===0){let i=y(this,$e,Rt).call(this,s,n);if(i instanceof Promise){i.then(l=>{r.source=l,r.select(t,!0)});return}else i!=null&&(r.source=i)}r.select(t,!0)}}static getValue(e){return e.value}static setEnabled(e,t){super.setEnabled(e,t);const s=y(this,Pe,zt).call(this,e);s!=null&&(s.disabled=t===!1)}};let me=It;Pe=new WeakSet,zt=function(e){const t=le[Ei];if(t==null)return null;const s=e.dataset.dropId,n=t[s];return n??null},$e=new WeakSet,Rt=function(e,t){let s=t.source;return typeof s=="function"&&(s=s(e)),s},Ve=new WeakSet,Ht=function(e,t,s){const n=e==null?void 0:e.find(r=>r.value===s);n!=null&&(s=n.text),ei(It,this,"setValue").call(this,t,s)},b(me,Pe),b(me,$e),b(me,Ve);class St extends te{static createEdit(e){return ne({onchange:typeof e=="function"?e:null})}static setValue(e,t){e.querySelector("input").checked=t}static getValue(e){return e.target.checked}static setEnabled(e,t){super.setEnabled(e,t),e.querySelector("input").disabled=t===!1}}class Ti extends te{static create(){return p("span","col-icon")}static setValue(e,t,s,n,r){let i=n.className;typeof i=="function"&&(i=i.call(n,s)),i==null?e.className="col-icon":e.className=`col-icon ${i}`;let l=n.iconType;if(typeof l=="function"&&(l=l.call(n,s)),l??(l="fa-regular"),e.dataset.type!==l||e.dataset.icon!==t){const o=$(l,t);e.replaceChildren(o),e.dataset.type=l,e.dataset.icon=t}}static setEnabled(e,t){super.setEnabled(e,t),t===!1?e.classList.add("disabled"):e.classList.remove("disabled")}}const it={Reorder:"reorder",Resize:"resize",Sort:"sort"},st=xi()?32:0,Si=200,Kt=4,Ut=4,_e=50,Gt=200;function nt(d){var t;return d==null?null:(d.touches&&((t=d.touches[0])==null?void 0:t.clientX))??d.clientX}function Ni(d){let e=0;for(;d!=null;)e+=d.offsetLeft,d=d.offsetParent;return e}function ze(d){return Array.prototype.indexOf.call(d.parentElement.children,d)}const Ii={0:te,1:Yt,2:me,3:St,4:Ti,5:Li},Ke=class{constructor(e){b(this,Te);b(this,ot);b(this,at);b(this,ct);b(this,dt);b(this,fe);b(this,ut);b(this,ht);b(this,Me);b(this,P);b(this,se);b(this,pe);b(this,We);b(this,De);b(this,Fe);b(this,ye);b(this,ft);b(this,je);b(this,Be);b(this,pt);b(this,yt);b(this,gt);b(this,mt);b(this,bt);b(this,vt);b(this,xt);b(this,Xe);b(this,Ye);b(this,Se);b(this,F,void 0);b(this,H,void 0);b(this,we,void 0);b(this,V,void 0);b(this,v,void 0);b(this,ke,void 0);b(this,Ce,-1);b(this,M,void 0);b(this,K,0);b(this,de,void 0);b(this,ue,void 0);b(this,ie,void 0);b(this,Z,-1);b(this,Le,void 0);b(this,he,void 0);b(this,Ee,{});b(this,q,{});b(this,At,[]);C(this,"columns",[]);C(this,"langs",{all:W("allItem","( All )"),ok:W("ok","OK"),reset:W("reset","Reset")});C(this,"virtualCount",100);C(this,"rowHeight",36);C(this,"lineHeight",24);C(this,"extraRows",0);C(this,"filterRowHeight",30);C(this,"height");C(this,"readonly");C(this,"multiSelect",!1);C(this,"fullrowClick",!0);C(this,"allowHtml",!1);C(this,"holderDisabled",!1);C(this,"headerVisible",!0);C(this,"window",le);C(this,"sortIndex",-1);C(this,"sortDirection",1);C(this,"willSelect");C(this,"selectedRowChanged");C(this,"cellDblClicked");C(this,"cellClicked");C(this,"rowDblClicked");C(this,"columnChanged");x(this,we,e)}get element(){return a(this,V)}get source(){var e;return(e=a(this,F))==null?void 0:e.map(t=>t.values)}set source(e){if(a(this,V)==null)throw new Error("grid has not been initialized.");if(!Array.isArray(e))throw new Error("source is not an Array.");e=e.map(t=>({values:t})),x(this,F,e),y(this,Te,Ct).call(this,e)}get virtual(){var e;return((e=a(this,H))==null?void 0:e.length)>this.virtualCount}get sortKey(){var e;return this.columns==null?null:(e=this.columns[this.sortIndex])==null?void 0:e.key}get selectedIndexes(){return a(this,M)}set selectedIndexes(e){const t=a(this,K);a(this,M).splice(0,a(this,M).length,...e),this.readonly!==!0?this.refresh():[...a(this,v).bodyContent.children].forEach((s,n)=>{e.indexOf(t+n)>=0?s.classList.add("selected"):s.classList.contains("selected")&&s.classList.remove("selected")}),typeof this.selectedRowChanged=="function"&&this.selectedRowChanged()}get selectedIndex(){return(a(this,M)&&a(this,M)[0])??-1}get loading(){var e,t;return((t=(e=a(this,v).loading)==null?void 0:e.style)==null?void 0:t.visibility)==="visible"}set loading(e){a(this,v).loading!=null&&(e===!1?(a(this,v).loading.style.visibility="hidden",a(this,v).loading.style.opacity=0):(a(this,v).loading.style.visibility="visible",a(this,v).loading.style.opacity=1))}get scrollTop(){var e;return(e=a(this,v).body)==null?void 0:e.scrollTop}set scrollTop(e){a(this,v).body!=null&&(a(this,v).body.scrollTop=e,this.reload())}init(e=a(this,we)){if(x(this,V,null),x(this,v,{}),x(this,ke,!0),!(e instanceof HTMLElement))throw new Error("no specified parent.");x(this,we,e);const t=p("div","ui-grid");t.setAttribute("tabindex",0),t.addEventListener("keydown",l=>{var u;let o=this.selectedIndex,c=!1;if(l.key==="ArrowUp")o>0&&(c=!0,o-=1);else if(l.key==="ArrowDown"){const h=((u=a(this,H))==null?void 0:u.length)??0;o =0&&this.sortColumn()}scrollToIndex(e){const t=y(this,Me,Ot).call(this,e*(this.rowHeight+1),!0);a(this,v).body.scrollTop=t}resize(e){if(a(this,ke)||a(this,V)==null)return;const t=a(this,v).body,s=this.headerVisible===!1?0:a(this,v).header.offsetHeight;let n=this.height;n===0?n=a(this,ue):(isNaN(n)||n<0)&&(n=a(this,V).offsetHeight-s);const r=wi((n-1)/(this.rowHeight+1))+Kt*2+1;(e||r!==a(this,Z))&&(x(this,Z,r),this.reload()),x(this,ie,t.clientWidth)}reload(){let e=a(this,H).length;this.extraRows>0&&(e+=this.extraRows),x(this,ue,e*(this.rowHeight+1)),a(this,v).body.scrollTop=0,a(this,v).body.scrollLeft=0,a(this,v).bodyContent.style.top="0px",a(this,v).bodyContainer.style.height=`${a(this,ue)}px`,y(this,ct,si).call(this,a(this,v).bodyContent),this.refresh()}refresh(){if(a(this,v).bodyContent==null)throw new Error("body has not been created.");const e=a(this,v).bodyContent.children,t={};y(this,dt,ni).call(this,e,this.columns,t),a(this,de)&&t.flag&&(x(this,de,!1),this.columns.forEach((s,n)=>{if(!y(this,P,X).call(this,s.key,"autoResize"))return;let r=t[n];r 0&&y(this,fe,Ge).call(this,n,r)}))}resetChange(){if(a(this,F)!=null)for(let e of a(this,F))delete e.__changed}sortColumn(e){const t=this.sortIndex,s=this.columns[t];if(s==null)return;const n=this.sortDirection;[...a(this,v).header.children].forEach((i,l)=>{const o=i.querySelector(".arrow");o!=null&&(l===t?o.className=`arrow ${n!==1?"desc":"asc"}`:o.className!=="arrow"&&(o.className="arrow"))});let r;if(typeof s.sortFilter!="function"){const i=this.sortDirection;isNaN(i)&&(i=1),r=(l,o)=>{if(l=y(this,pe,Ze).call(this,l.values,s.key,s.filter),o=y(this,pe,Ze).call(this,o.values,s.key,s.filter),l==null&&typeof o=="number")l=0;else if(typeof l=="number"&&o==null)o=0;else{if(l!=null&&o==null)return i;typeof l=="string"&&typeof o=="string"&&(l=l.toLowerCase(),o=o.toLowerCase())}return l===o?0:(l>o?1:-1)*i}}else r=(i,l)=>s.sortFilter(i.values,l.values)*n;a(this,F).sort(r),a(this,q).__filtered===!0&&a(this,H).sort(r),!(a(this,Z)<0)&&(e?this.reload():this.refresh())}};let Re=Ke;F=new WeakMap,H=new WeakMap,we=new WeakMap,V=new WeakMap,v=new WeakMap,ke=new WeakMap,Ce=new WeakMap,M=new WeakMap,K=new WeakMap,de=new WeakMap,ue=new WeakMap,ie=new WeakMap,Z=new WeakMap,Le=new WeakMap,he=new WeakMap,Ee=new WeakMap,q=new WeakMap,At=new WeakMap,Te=new WeakSet,Ct=function(e){e??(e=a(this,F)),a(this,q).__filtered===!0?x(this,H,e.filter(t=>{for(let s of this.columns)if(Array.isArray(s.filterValues)){const n=y(this,pe,Ze).call(this,t.values,s.key,s.filter);if(s.filterValues.indexOf(n)<0)return!1}return!0})):x(this,H,e),x(this,Ce,-1),x(this,M,[]),x(this,K,0),x(this,Le,0),x(this,he,0),x(this,Z,-1),this.sortIndex>=0&&this.sortColumn(),this.resize()},ot=new WeakSet,ti=function(){const e=p("table","ui-grid-header");this.headerVisible===!1&&(e.style.display="none");const t=p("tr");e.appendChild(t);const s=a(this,v).sizer;for(let i of this.columns){if(i.visible===!1){const f=p("th");f.style.display="none",i.sortable!==!1&&(f.dataset.key=i.key,f.addEventListener("click",m=>y(this,Fe,Vt).call(this,m,i,!0))),t.appendChild(f);continue}const l=Ke.ColumnTypes.isCheckbox(i.type);if(!(i.width>0)){y(this,se,Ne).call(this,i.key,"autoResize",!0),x(this,de,!0),s.innerText=i.caption??"";let f=s.offsetWidth+22;!this.readonly&&i.enabled!==!1&&i.allcheck&&l&&(f+=32),i.allowFilter===!0&&(f+=14),f<_e&&(f=_e),i.width=f}i.align??(i.align=l?"center":"left"),i.sortable!==!1&&(i.sortable=!0);const o=`${i.width}px`,c={width:o,"max-width":o,"min-width":o,"text-align":i.align};y(this,se,Ne).call(this,i.key,"style",c);const u=p("th","column");u.dataset.key=i.key;for(let f of Object.entries(c))u.style.setProperty(f[0],f[1]);i.sortable&&(u.style.cursor="pointer",u.addEventListener("click",f=>y(this,Fe,Vt).call(this,f,i))),i.orderable!==!1&&(i.orderable=!0,u.addEventListener("mousedown",f=>y(this,yt,ci).call(this,f,i)));const h=p("div");if(u.appendChild(h),!this.readonly&&i.enabled!==!1&&i.allcheck&&l){const f=ne({onchange:m=>y(this,bt,hi).call(this,i,m.target.checked)});h.appendChild(f)}const g=p("span");if(i.textStyle!=null)for(let f of Object.entries(i.textStyle))g.style.setProperty(f[0],f[1]);if(g.innerText=i.caption??"",h.appendChild(g),i.sortable&&u.appendChild(p("layer","arrow")),i.allowFilter===!0){const f=p("layer","filter");f.appendChild($("fa-solid","filter")),f.addEventListener("mousedown",m=>y(this,ft,oi).call(this,m,i)),u.classList.add("header-filter"),u.appendChild(f)}if(i.resizable!==!1){const f=p("layer","spliter");f.addEventListener("mousedown",m=>y(this,gt,di).call(this,m,i)),f.addEventListener("dblclick",m=>y(this,mt,ui).call(this,m,i)),u.appendChild(f)}t.appendChild(u)}const n=p("div","dragger"),r=p("layer","dragger-cursor");return t.appendChild(p("th",null,n,r)),s.replaceChildren(),a(this,v).header=t,a(this,v).dragger=n,a(this,v).draggerCursor=r,e},at=new WeakSet,ii=function(){const e=p("div","ui-grid-body");e.addEventListener("scroll",i=>qe(y(this,vt,fi),st,this,i),{passive:!0});const t=this.columns;let s=1;for(let i of t)i.visible!==!1&&!isNaN(i.width)&&(s+=i.width+1);const n=p("div");n.style.position="relative",n.style.minWidth="100%",n.style.minHeight="1px",s>0&&(n.style.width=`${s}px`),e.appendChild(n);const r=p("table","ui-grid-body-content");if(r.addEventListener("mousedown",i=>{let[l,o]=y(this,We,Pt).call(this,i.target);const c=ze(l);let u=ze(o);u>=this.columns.length&&(u=-1),y(this,Xe,Dt).call(this,i,c,u)}),r.addEventListener("dblclick",i=>y(this,Ye,Ft).call(this,i)),n.appendChild(r),!this.holderDisabled){const i=p("div","ui-grid-hover-holder");i.addEventListener("mousedown",l=>{const o=l.currentTarget,c=Number(o.dataset.row),u=Number(o.dataset.col);return o.classList.contains("active")&&o.classList.remove("active"),y(this,Xe,Dt).call(this,l,c+a(this,K),u)}),i.addEventListener("dblclick",l=>y(this,Ye,Ft).call(this,l)),n.appendChild(i),e.addEventListener("mousemove",l=>qe(y(this,xt,pi),Si,this,l,i),{passive:!0})}return a(this,v).body=e,a(this,v).bodyContainer=n,a(this,v).bodyContent=r,e},ct=new WeakSet,si=function(){let e=a(this,Z);(isNaN(e)||e<0||!this.virtual)&&(e=a(this,H).length);const t=this.columns,s=a(this,v).bodyContent,n=s.children.length;if(e-=n,e>0)for(let r=0;r {const c=p("td");if(l.visible!==!1){c.dataset.row=String(n+r),c.dataset.col=String(o);const u=y(this,P,X).call(this,l.key,"style");if(u!=null)for(let h of Object.entries(u))c.style.setProperty(h[0],h[1]);if(l.css!=null)for(let h of Object.entries(l.css))c.style.setProperty(h[0],h[1]);if(Ke.ColumnTypes.isCheckbox(l.type))c.appendChild(St.createEdit(h=>y(this,Se,Lt).call(this,h,n+r,l,h.target.checked,c)));else{let h=a(this,Ee)[l.key];h==null&&(isNaN(l.type)?this.allowHtml&&l.type!=null&&(h=l.type):h=Ii[l.type],h??(h=te),a(this,Ee)[l.key]=h),c.appendChild(h.create(l))}}i.appendChild(c)}),i.appendChild(p("td")),s.appendChild(i)}else if(e<0)for(let r=-1;r>=e;r-=1)s.children[n+r].remove()},dt=new WeakSet,ni=function(e,t,s){const n=a(this,K),r=a(this,M);[...e].forEach((i,l)=>{const o=a(this,H)[n+l];if(o==null||!Ae(i.children.length))return;const c=o.values,u=r.indexOf(n+l)>=0;u?i.classList.add("selected"):i.classList.contains("selected")&&i.classList.remove("selected");const h=o.__selected^u;u?o.__selected=!0:delete o.__selected,t.forEach((g,f)=>{var ge,Jt;if(g.visible===!1)return;let m;g.text!=null?m=g.text:typeof g.filter=="function"?m=g.filter(c):(m=c[g.key],(m==null?void 0:m.displayValue)!=null&&(m=m.displayValue)),m??(m="");const k=i.children[f];if(typeof g.bgFilter=="function"){const _=g.bgFilter(c);k.style.backgroundColor=_??""}const T=Ke.ColumnTypes.isCheckbox(g.type),A=T?St:a(this,Ee)[g.key]??te;let E;!T&&h&&typeof A.createEdit=="function"?((ge=o.__editing)!=null&&ge[g.key]&&A.editing&&(m=A.getValue({target:k.children[0]}),y(this,Se,Lt).call(this,null,n+l,g,m,k,!0)),E=u?A.createEdit(_=>y(this,Se,Lt).call(this,_,n+l,g,A.getValue(_),k),g,a(this,v).bodyContent,o):A.create(g),k.replaceChildren(E)):E=k.children[0];let S;this.readonly?S=!1:(S=g.enabled,typeof S=="function"?S=S.call(g,c):typeof S=="string"&&(S=c[S])),A.setValue(E,m,c,g,this);let G=g.tooltip;if(typeof G=="function"&&(G=G.call(g,c)),ee(G)?(Jt=E.querySelector(".ui-tooltip-wrapper"))==null||Jt.remove():et(E,G,!1,this.element),typeof A.setEnabled=="function"&&A.setEnabled(E,S),a(this,de)&&y(this,P,X).call(this,g.key,"autoResize")){const _=E.scrollWidth+12;_>0&&s!=null&&(isNaN(s[f])||s[f]<_)&&(s[f]=_,s.flag=!0)}if(typeof g.styleFilter=="function"){const _=g.styleFilter(c);_!=null&&A.setStyle(E,_)}if(g.events!=null)for(let _ of Object.entries(g.events))E[_[0]]=_[1].bind(c);if(g.attrs!=null){let _=g.attrs;typeof _=="function"&&(_=_(c));for(let Qt of Object.entries(_))E.setAttribute(Qt[0],Qt[1])}}),o.__editing!=null&&delete o.__editing})},fe=new WeakSet,Ge=function(e,t){const s=this.columns[e],n=`${t}px`;s.width=t;const r=y(this,P,X).call(this,s.key,"style");r.width=n,r["max-width"]=n,r["min-width"]=n;let i=a(this,v).header.children[e];i.style.width=n,i.style.maxWidth=n,i.style.minWidth=n;const l=a(this,v).bodyContent;for(let o of l.children)i=o.children[e],i!=null&&(i.style.width=n,i.style.maxWidth=n,i.style.minWidth=n)},ut=new WeakSet,li=function(e,t,s,n){const r=a(this,v).header.children;let i=r[e];a(this,v).dragger.style.left=`${i.offsetLeft-n+t}px`,a(this,v).dragger.style.width=i.style.width,a(this,v).dragger.style.display="block",t=s-Ni(i);let l;if(t<0){t=-t;for(let o=e-1;o>=0&&t>=0&&(i=r[o],!(i==null||i.className!=="column"));o-=1){if(t i.offsetWidth/2?o:o+1;break}t-=i.offsetWidth}l??(l=0)}else{const o=r.length;for(let c=e;c =0;c+=1){if(i=r[c],i==null||i.className!=="column"){l=c;break}if(t i.offsetWidth/2?c+1:c;break}t-=i.offsetWidth}l??(l=o-1)}if(l!==a(this,q).__orderIndex){if(a(this,q).__orderIndex=l,i=r[l],i==null)return;a(this,v).draggerCursor.style.left=`${i.offsetLeft-n}px`,a(this,v).draggerCursor.style.display="block"}},ht=new WeakSet,ri=function(e){a(this,v).dragger.style.display="",a(this,v).draggerCursor.style.display="";const t=a(this,q).__orderIndex;if(t>=0&&t!==e){let s=t-e;if(s>=0&&s<=1)return;const n=a(this,v).header,r=n.children,i=a(this,v).bodyContent.children,l=this.columns;if(s>1){s=t-1;const o=l.splice(e,1)[0];l.splice(s,0,o),n.insertBefore(r[e],r[s].nextElementSibling);for(let c of i)c.insertBefore(c.children[e],c.children[s].nextElementSibling)}else{s=t;const o=l.splice(e,1)[0];l.splice(s,0,o),n.insertBefore(r[e],r[s]);for(let c of i)c.insertBefore(c.children[e],c.children[s])}[...r].forEach((o,c)=>{const u=o.querySelector(".arrow");u!=null&&u.className!=="arrow"&&(this.sortIndex=c)}),typeof this.columnChanged=="function"&&this.columnChanged(it.Reorder,e,s)}},Me=new WeakSet,Ot=function(e,t){const s=this.rowHeight+1;if(e-=e%(s*2)+Kt*s,e<0)e=0;else{let n=a(this,ue)-(t?0:a(this,Z)*s);n<0&&(n=0),e>n&&(e=n)}return a(this,Le)!==e?(x(this,Le,e),this.virtual&&x(this,K,e/s),this.refresh(),this.virtual&&(a(this,v).bodyContent.style.top=`${e}px`)):t&&this.refresh(),e},P=new WeakSet,X=function(e,t){const s=a(this,q)[e];return s==null?null:s[t]},se=new WeakSet,Ne=function(e,t,s){const n=a(this,q)[e];n==null?a(this,q)[e]={[t]:s}:n[t]=s},pe=new WeakSet,Ze=function(e,t,s){let n;return typeof s=="function"?n=s(e):n=e[t],(n==null?void 0:n.value)??n},We=new WeakSet,Pt=function(e){let t;for(;(t=e.parentElement)!=null&&!t.classList.contains("ui-grid-row");)e=t;return[t,e]},De=new WeakSet,$t=function(e){return/^(input|label|layer|svg|use)$/i.test(e)},Fe=new WeakSet,Vt=function(e,t,s){if(!(!s&&(y(this,P,X).call(this,t.key,"resizing")||y(this,P,X).call(this,t.key,"dragging")))&&!y(this,De,$t).call(this,e.target.tagName)){const n=this.columns.indexOf(t);if(n<0)return;this.sortIndex===n?this.sortDirection=this.sortDirection===1?-1:1:this.sortIndex=n,this.sortColumn(!0),typeof this.columnChanged=="function"&&this.columnChanged(it.Sort,n,this.sortDirection)}},ye=new WeakSet,Je=function(){const e=a(this,V).querySelectorAll(".filter-panel.active");if(e.length>0){e.forEach(s=>s.classList.remove("active")),setTimeout(()=>a(this,V).querySelectorAll(".filter-panel").forEach(s=>s.remove()),120);const t=a(this,q).__filtering;return t instanceof HTMLElement&&t.classList.remove("hover"),delete a(this,q).__filtering,!0}return!1},ft=new WeakSet,oi=function(e,t){if(y(this,ye,Je).call(this))return;const s=f=>{f.target.tagName==="LAYER"&&f.target.classList.contains("filter")||f.target.tagName==="use"||y(this,ye,Je).call(this)&&document.removeEventListener("mousedown",s)};document.addEventListener("mousedown",s);const n=p("div","filter-panel");n.addEventListener("mousedown",f=>f.stopPropagation());const r=e.currentTarget,i=r.parentElement,l=i.offsetWidth;n.style.top=`${i.offsetHeight}px`,n.style.left=i.offsetLeft+(l>Gt?l-Gt:0)+"px";let o;if(t.allowSearch!==!1){const f=p("div","filter-search-holder");o=p("input","filter-search-box ui-text"),o.type="text";const m=$("fa-regular","search");m.addEventListener("mousedown",k=>{o.focus(),k.preventDefault()}),f.append(o,m),n.append(f)}const c=p("div","filter-item-list");c.addEventListener("scroll",f=>qe(y(this,pt,ai),st,this,t,c,f.target.scrollTop),{passive:!0});const u=p("div","filter-item filter-all");u.appendChild(ne({label:this.langs.all,onchange:f=>{const m=f.target.checked;c.querySelectorAll(".filter-content input").forEach(k=>k.checked=m)}})),c.appendChild(u);let h;if(Array.isArray(t.filterSource))h=t.filterSource;else if(typeof t.filterSource=="function")h=t.filterSource.call(this,t);else{const f=Object.create(null);for(let m of a(this,F)){const k=y(this,pe,Ze).call(this,m.values,t.key,t.filter);if(!Object.hasOwnProperty.call(f,k)){const T=m.values[t.key];f[k]={value:k,displayValue:typeof t.filter=="function"?t.filter(m.values):(T==null?void 0:T.displayValue)??T}}}h=Object.values(f).sort((m,k)=>(m=(m==null?void 0:m.value)??m,k=(k==null?void 0:k.value)??k,m>k?1:m Object.prototype.hasOwnProperty.call(f,"value")&&Object.prototype.hasOwnProperty.call(f,"displayValue")?f:{value:f,displayValue:f??""}),y(this,je,Mt).call(this,t,c,h,u),u.querySelector("input").checked=![...c.querySelectorAll(".filter-content input")].some(f=>!f.checked),n.appendChild(c),o!=null&&o.addEventListener("input",f=>{const m=f.currentTarget.value.toLowerCase(),k=m.length===0?h:h.filter(T=>{const A=(T==null?void 0:T.displayValue)??T;return String(A??"").indexOf(m)>=0});y(this,je,Mt).call(this,t,c,k,u)});const g=p("div","filter-function");g.append(p("button",f=>{f.innerText=this.langs.ok,f.addEventListener("click",()=>{const m=y(this,P,X).call(this,t.key,"filterSource").filter(k=>k.__checked!==!1);typeof t.onFilterOk=="function"?t.onFilterOk.call(this,t,m):t.filterValues=m.map(k=>k.value),a(this,q).__filtered=!0,y(this,Te,Ct).call(this),typeof t.onFiltered=="function"&&t.onFiltered.call(this,t),r.classList.add("active"),y(this,ye,Je).call(this)})}),p("button",f=>{f.innerText=this.langs.reset,f.addEventListener("click",()=>{delete t.filterValues,a(this,q).__filtered=this.columns.some(m=>t.filterValues!=null),y(this,Te,Ct).call(this),typeof t.onFiltered=="function"&&t.onFiltered.call(this,t),r.classList.remove("active"),y(this,ye,Je).call(this)})})),n.appendChild(g),a(this,V).appendChild(n),setTimeout(()=>n.classList.add("active"),0),a(this,q).__filtering=r,r.classList.add("hover")},je=new WeakSet,Mt=function(e,t,s,n){var c,u;(c=t.querySelector(".filter-holder"))==null||c.remove(),(u=t.querySelector(".filter-content"))==null||u.remove();const r=this.filterRowHeight,i=s.length*r;y(this,se,Ne).call(this,e.key,"filterHeight",i);const l=p("div","filter-holder");l.style.height=`${i}px`;const o=p("div","filter-content");o.style.top=`${r}px`,y(this,se,Ne).call(this,e.key,"filterSource",s);for(let h of s)h.__checked=!Array.isArray(e.filterValues)||e.filterValues.indexOf(h.value??h)>=0;s.length>12&&(s=s.slice(0,12)),y(this,Be,Wt).call(this,o,s,n),t.append(l,o)},Be=new WeakSet,Wt=function(e,t,s){for(let n of t){const r=p("div","filter-item");r.appendChild(ne({checked:n.__checked,label:(n==null?void 0:n.displayValue)??n,onchange:i=>{n.__checked=i.target.checked,s.querySelector("input").checked=![...e.querySelectorAll("input")].some(l=>!l.checked)}})),e.appendChild(r)}},pt=new WeakSet,ai=function(e,t,s){const n=this.filterRowHeight;if(s-=s%(n*2)+n,s<0)s=0;else{let r=y(this,P,X).call(this,e.key,"filterHeight")-12*n;r<0&&(r=0),s>r&&(s=r)}if(y(this,P,X).call(this,e.key,"filterTop")!==s){y(this,se,Ne).call(this,e.key,"filterTop",s);const r=s/n;let i=y(this,P,X).call(this,e.key,"filterSource");r+12 input")),l.style.top=`${s+n}px`}},yt=new WeakSet,ci=function(e,t){if(y(this,De,$t).call(this,e.target.tagName))return;const s=nt(e),n=ze(e.currentTarget),r=c=>{for(let u of["mousemove","mouseup"])c.hasOwnProperty(u)&&(window.removeEventListener(u,c[u]),delete c[u])};let i=a(this,q)[t.key];i==null?i=a(this,q)[t.key]={}:r(i),i.dragging=!0;const l=a(this,v).header.querySelector("th:last-child").offsetLeft,o=c=>{const u=nt(c),h=u-s;let g=i.offset,f;(g==null&&(h>Ut||h<-Ut)||g!==h)&&(f=!0),f&&(y(this,ut,li).call(this,n,h,u,l),i.offset=h)};i.mousemove=c=>qe(o,st,this,c),i.mouseup=()=>{r(i),i.offset==null?delete i.dragging:(setTimeout(()=>{delete i.dragging,delete i.offset}),y(this,ht,ri).call(this,n))},["mousemove","mouseup"].forEach(c=>window.addEventListener(c,i[c]))},gt=new WeakSet,di=function(e,t){const s=nt(e),n=t.width,r=ze(e.currentTarget.parentElement),i=this.window??le,l=u=>{for(let h of["mousemove","mouseup"])u.hasOwnProperty(h)&&(i.removeEventListener(h,u[h]),delete u[h])};let o=a(this,q)[t.key];o==null?o=a(this,q)[t.key]={}:l(o),o.resizing=n;const c=u=>{const h=nt(u),g=n+(h-s);g<_e||(o.resizing=g,o.sizing=!0,y(this,fe,Ge).call(this,r,g))};o.mousemove=u=>qe(c,st,this,u),o.mouseup=u=>{l(o);const h=o.resizing;h!=null&&(setTimeout(()=>delete o.resizing),o.sizing&&(delete o.sizing,delete o.autoResize,y(this,fe,Ge).call(this,r,h),typeof this.columnChanged=="function"&&this.columnChanged(it.Resize,r,h))),u.stopPropagation(),u.preventDefault()},["mousemove","mouseup"].forEach(u=>i.addEventListener(u,o[u]))},mt=new WeakSet,ui=function(e,t){const s=e.currentTarget.parentElement,n=ze(s);let r=s.querySelector("div:first-child").scrollWidth;for(let i of a(this,v).bodyContent.children){const o=i.children[n].children[0].scrollWidth;o>r&&(r=o)}r<_e&&(r=_e),r>0&&r!==t.width&&(r+=12,y(this,fe,Ge).call(this,n,r),typeof this.columnChanged=="function"&&this.columnChanged(it.Resize,n,r))},bt=new WeakSet,hi=function(e,t){if(a(this,H)==null)return;const s=e.key,n=typeof e.enabled=="function",r=typeof e.enabled=="string";if(typeof e.onallchecked=="function")e.onallchecked.call(this,e,t);else{for(let i of a(this,H)){const l=i.values;if(l==null)continue;(n?e.enabled(l):r?l[e.enabled]:e.enabled)!==!1&&(l[s]=t,i.__changed=!0,typeof e.onchanged=="function"&&e.onchanged.call(this,l,t))}this.refresh()}},vt=new WeakSet,fi=function(e){const t=e.target.scrollLeft;if(a(this,he)!==t&&(x(this,he,t),a(this,v).header.style.left=`${-t}px`),!this.virtual)return;const s=e.target.scrollTop;y(this,Me,Ot).call(this,s)},xt=new WeakSet,pi=function(e,t){if(e.target.classList.contains("ui-grid-hover-holder"))return;let[s,n]=y(this,We,Pt).call(this,e.target);if(s==null){delete t.dataset.row,delete t.dataset.col,t.classList.contains("active")&&t.classList.remove("active");return}const r=n.children[0];if((r==null?void 0:r.tagName)!=="SPAN"){t.classList.contains("active")&&(delete t.dataset.row,delete t.dataset.col,t.classList.remove("active"));return}const i=n.dataset.row,l=n.dataset.col;if(!(t.dataset.row===i&&t.dataset.col===l))if(r.scrollWidth>r.offsetWidth){t.dataset.row=i,t.dataset.col=l,t.innerText=r.innerText;const o=a(this,v).bodyContent.offsetTop+n.offsetTop;let c=n.offsetLeft,u=t.offsetWidth;u>a(this,ie)&&(u=a(this,ie));const h=a(this,ie)+a(this,he)-u;c>h&&(c=h);const g=n.offsetHeight;t.style.cssText=`top: ${o}px; left: ${c}px; max-width: ${a(this,ie)}px; height: ${g-2}px`,t.classList.add("active")}else t.classList.contains("active")&&(delete t.dataset.row,delete t.dataset.col,t.classList.remove("active"))},Xe=new WeakSet,Dt=function(e,t,s){const n=a(this,K),r=n+t;if(typeof this.willSelect=="function"&&!this.willSelect(r,s))return;let i=!1;const l=a(this,M);if(this.multiSelect){if(e.ctrlKey){const o=l.indexOf(r);o<0?l.push(r):l.splice(o,1),i=!0}else if(e.shiftKey&&l.length>0&&(l.length>1||l[0]!==r)){let o=l[l.length-1],c;o>r?(c=o,o=r):c=r,l.splice(0);for(let u=o;u<=c;u+=1)l.push(u);i=!0}}(!i&&l.length!==1||l[0]!==r)&&(l.splice(0,l.length,r),i=!0),i&&(this.readonly!==!0?this.refresh():[...a(this,v).bodyContent.children].forEach((o,c)=>{l.indexOf(n+c)>=0?o.classList.add("selected"):o.classList.contains("selected")&&o.classList.remove("selected")}),typeof this.selectedRowChanged=="function"&&this.selectedRowChanged(r)),x(this,Ce,s),(this.fullrowClick||s>=0)&&e.buttons===1&&typeof this.cellClicked=="function"&&this.cellClicked(r,s)===!1&&(e.stopPropagation(),e.preventDefault())},Ye=new WeakSet,Ft=function(e){if(e.target.tagName==="INPUT"||e.target.tagName==="TEXTAREA"||e.target.tagName==="LAYER"&&e.target.className==="ui-check-inner"||e.target.tagName==="LABEL"&&(e.target.className==="ui-drop-text"||e.target.className==="ui-drop-caret"))return;const t=this.selectedIndex;if(typeof this.rowDblClicked=="function"&&this.rowDblClicked(t),typeof this.cellDblClicked=="function"){const s=a(this,Ce);(this.fullrowClick||s>=0)&&this.cellDblClicked(t,s)}},Se=new WeakSet,Lt=function(e,t,s,n,r,i){var u;if(a(this,H)==null)return;const l=a(this,H)[a(this,K)+t],o=l.values;if(o==null)return;let c=s.enabled;if(typeof c=="function"?c=c.call(s,o):typeof c=="string"&&(c=o[c]),c!==!1){o[s.key]=n;let h=s.tooltip;typeof h=="function"&&(h=h.call(s,o)),ee(h)?(u=r.querySelector(".ui-tooltip-wrapper"))==null||u.remove():et(r.children[0],h,!1,this.element),l.__changed=!0,i?typeof s.oneditend=="function"&&s.oneditend.call(this,o,n):typeof s.onchanged=="function"&&s.onchanged.call(this,o,n)}},C(Re,"ColumnTypes",{Common:0,Input:1,Dropdown:2,Checkbox:3,Icon:4,Text:5,isCheckbox(e){return e===3}}),C(Re,"GridColumn",te);const Wi="",z={right:1,bottom:2,left:4,top:8,bottomRight:3,bottomLeft:6,topRight:9,topLeft:12};function lt(d){if(typeof d!="string")return d;if(d.endsWith("px")){const e=Number(d.substring(0,d.length-2));return isNaN(e)?d:e}return d}class rt{constructor(e={}){b(this,B);b(this,j,void 0);b(this,U,void 0);b(this,J,void 0);x(this,U,e)}get container(){return a(this,j).querySelector(".ui-popup-container")}get rect(){const e=this.container;if(e==null)return null;const t=le.getComputedStyle(e),s=e.classList.contains("ui-popup-collapse"),n=a(this,J);return{collapsed:s,left:lt(t.left),top:lt(t.top),width:s===!0&&n!=null?n.width:lt(t.width),height:s===!0&&n!=null?n.height:lt(t.height)}}set rect(e){const t=this.container;if(t==null)return;const s=[];isNaN(e.left)||s.push(`left: ${e.left}px`),isNaN(e.top)||s.push(`top: ${e.top}px`);const n=t.querySelector(".ui-popup-header-icons>.icon-expand");e.collapsed===!0?(s.push("width: 160px","height: 40px"),x(this,J,e),t.classList.add("ui-popup-collapse"),n!=null&&Ie(n,"fa-regular","expand-alt")):(!isNaN(e.width)&&e.width>0&&s.push(`width: ${e.width}px`),!isNaN(e.height)&&e.height>0&&s.push(`height: ${e.height}px`),t.classList.remove("ui-popup-collapse"),x(this,J,null),n!=null&&Ie(n,"fa-regular","compress-alt")),s.length>0&&(t.style.cssText+=s.join("; "))}close(e=!0){const t=a(this,j);e?(t.classList.add("ui-popup-active"),t.style.opacity=0,setTimeout(()=>{t.remove()},120)):t.remove(),typeof a(this,U).onMasking=="function"&&a(this,U).onMasking.call(this,!1)}create(){const e=p("div","ui-popup-mask"),t=a(this,U);t.mask===!1?e.classList.add("ui-popup-transparent"):typeof t.onMasking=="function"&&a(this,U).onMasking.call(this,!0),isNaN(t.zIndex)||(e.style.zIndex=String(t.zIndex));const s=p("div","ui-popup-container");t.changeZIndex===!0&&s.addEventListener("mousedown",()=>{const i=[...a(this,j).parentElement.children].filter(o=>o.classList.contains("ui-popup-mask"));let l=200;i.forEach(o=>{let c;o.dataset.zindex!=null?(c=parseInt(o.dataset.zindex),o.style.zIndex=isNaN(c)?"":String(c),delete o.dataset.zindex):c=parseInt(o.style.zIndex),c>l&&(l=c)}),e.dataset.zindex=e.style.zIndex,e.style.zIndex=l+1});let n=Math.max.apply(null,[...document.querySelectorAll("[tabindex]")].map(i=>i.tabIndex??0));n<0&&(n=0),s.tabIndex=n+1;let r=t.content;if(r instanceof HTMLElement||(r=p("div",i=>i.innerText=r)),s.append(p("div",i=>{i.className="ui-popup-header";let l=t.title;l instanceof HTMLElement||(l=p("div",c=>{c.className="ui-popup-header-title",c.innerText=l})),i.appendChild(l),t.movable!==!1&&i.addEventListener("mousedown",u=>{var A;if(["svg","use"].includes((A=u.target)==null?void 0:A.tagName)||u.buttons!==1)return;const h=t.mask===!1?e.parentElement:e,g=u.clientX-s.offsetLeft,f=u.clientY-s.offsetTop;let m;const k=E=>{E.buttons===1?(s.style.left=`${E.clientX-g}px`,s.style.top=`${E.clientY-f}px`,m=!0):h.dispatchEvent(new MouseEvent("mouseup"))};h.addEventListener("mousemove",k,{passive:!1});const T=()=>{h.removeEventListener("mousemove",k,{passive:!1}),h.removeEventListener("mouseup",T),m===!0&&typeof t.onMoveEnded=="function"&&t.onMoveEnded.call(this),m=!1};h.addEventListener("mouseup",T)});const o=p("div",c=>{if(c.className="ui-popup-header-icons",t.collapsable===!0){const h=$("fa-regular","compress-alt");h.tabIndex=n+2,h.classList.add("icon-expand"),h.addEventListener("keypress",g=>{(g.key===" "||g.key==="Enter")&&h.dispatchEvent(new MouseEvent("click"))}),h.addEventListener("click",()=>{if(s.classList.contains("ui-popup-collapse")){const g=a(this,J);g!=null&&(s.style.cssText+=`width: ${g.width}px; height: ${g.height}px`,x(this,J,null)),s.classList.remove("ui-popup-collapse"),Ie(h,"fa-regular","compress-alt")}else{const g=this.rect;x(this,J,g),s.style.cssText+="width: 160px; height: 40px",s.classList.add("ui-popup-collapse"),Ie(h,"fa-regular","expand-alt")}typeof t.onResizeEnded=="function"&&t.onResizeEnded.call(this)}),c.appendChild(h)}const u=$("fa-regular","times");u.tabIndex=n+3,u.addEventListener("keypress",h=>{(h.key===" "||h.key==="Enter")&&this.close()}),u.addEventListener("click",()=>this.close()),c.appendChild(u)});i.appendChild(o)}),p("div","ui-popup-body",r,p("div","ui-popup-loading",p("div",null,$("fa-regular","spinner-third"))))),Array.isArray(t.buttons)&&t.buttons.length>0){n=Math.max.apply(null,[...s.querySelectorAll("[tabindex]")].map(u=>u.tabIndex??0)),s.appendChild(p("div","ui-popup-footer",...t.buttons.map((u,h)=>{const g=p("button","ui-popup-button");return u.tabIndex>0?g.tabIndex=u.tabIndex:g.tabIndex=n+h+1,g.innerText=u.text,g.addEventListener("click",()=>{if(typeof u.trigger=="function"){const f=u.trigger(this);typeof(f==null?void 0:f.then)=="function"?f.then(m=>{m!==!1&&this.close()}).catch(m=>console.warn(m)):f!==!1&&this.close()}else this.close()}),g})));const i=[...s.querySelectorAll("[tabindex]")].map(u=>u.tabIndex??0),l=Math.min.apply(null,i),o=Math.max.apply(null,i),c=s.querySelector(`[tabindex="${o}"]`);c!=null&&c.addEventListener("keydown",u=>{if(u.key==="Tab"){const h=s.querySelector(`[tabindex="${l}"]`);h==null||h.focus(),u.preventDefault()}})}else s.querySelector(".ui-popup-body>.ui-popup-loading").classList.add("ui-popup-loading-content");return t.resizable===!0&&s.append(p("layer",i=>{i.className="ui-popup-border ui-popup-border-right",i.addEventListener("mousedown",l=>y(this,B,Q).call(this,z.right,l))}),p("layer",i=>{i.className="ui-popup-border ui-popup-border-bottom",i.addEventListener("mousedown",l=>y(this,B,Q).call(this,z.bottom,l))}),p("layer",i=>{i.className="ui-popup-border ui-popup-border-left",i.addEventListener("mousedown",l=>y(this,B,Q).call(this,z.left,l))}),p("layer",i=>{i.className="ui-popup-border ui-popup-border-top",i.addEventListener("mousedown",l=>y(this,B,Q).call(this,z.top,l))}),p("layer",i=>{i.className="ui-popup-border ui-popup-border-bottom-right",i.addEventListener("mousedown",l=>y(this,B,Q).call(this,z.bottomRight,l))}),p("layer",i=>{i.className="ui-popup-border ui-popup-border-bottom-left",i.addEventListener("mousedown",l=>y(this,B,Q).call(this,z.bottomLeft,l))}),p("layer",i=>{i.className="ui-popup-border ui-popup-border-top-left",i.addEventListener("mousedown",l=>y(this,B,Q).call(this,z.topLeft,l))}),p("layer",i=>{i.className="ui-popup-border ui-popup-border-top-right",i.addEventListener("mousedown",l=>y(this,B,Q).call(this,z.topRight,l))})),e.appendChild(s),x(this,j,e),e}show(e=document.body){if(e==null)return;let t=a(this,j)??this.create();const s=e.querySelectorAll(".ui-popup-mask");let n=0;for(let r of s){let i=parseInt(r.style.zIndex);!isNaN(i)&&i>n&&(n=i)}if(n>0&&(t.style.zIndex=String(n+1)),e.appendChild(t),a(this,U).mask===!1){const r=this.container;r.style.left=String((e.offsetWidth-r.offsetWidth)/2)+"px",r.style.top=String((e.offsetHeight-r.offsetHeight)/2)+"px"}return new Promise(r=>{setTimeout(()=>{t.style.opacity=1,this.container.focus(),r(t)},0)})}get loading(){var e,t,s;return((s=(t=(e=a(this,j))==null?void 0:e.querySelector(".ui-popup-body>.ui-popup-loading"))==null?void 0:t.style)==null?void 0:s.visibility)==="visible"}set loading(e){var s;let t=(s=a(this,j))==null?void 0:s.querySelector(".ui-popup-body>.ui-popup-loading");t!=null&&(e===!1?(t.style.visibility="hidden",t.style.opacity=0):(t.style.visibility="visible",t.style.opacity=1))}}j=new WeakMap,U=new WeakMap,J=new WeakMap,B=new WeakSet,Q=function(e,t){if(t.buttons!==1)return;const s=this.container,n=a(this,U);typeof n.onResizeStarted=="function"&&n.onResizeStarted.call(this);const r=a(this,j),i=t.clientX,l=t.clientY,o={width:s.offsetWidth,height:s.offsetHeight,left:s.offsetLeft,top:s.offsetTop},c=n.minWidth??200,u=n.minHeight??200;let h;const g=n.mask===!1?r.parentElement:r,f=k=>{if(k.buttons!==1){g.dispatchEvent(new MouseEvent("mouseup"));return}const T=k.clientX-i,A=k.clientY-l;let E=o.width,S=o.height,G=o.left,ge=o.top;(e&z.right)===z.right&&(E+=T,E {g.removeEventListener("mousemove",f,{passive:!1}),g.removeEventListener("mouseup",m),h===!0&&typeof n.onResizeEnded=="function"&&n.onResizeEnded.call(this),h=!1};g.addEventListener("mouseup",m)};function Ai(d,e,...t){return new rt({title:d,content:e,buttons:t})}const Zt={info:"info-circle",information:"info-circle",warn:"exclamation-triangle",warning:"exclamation-triangle",question:"question-circle",error:"times-circle"};function qi(d,e,t="info",s=document.body){return new Promise(n=>{new rt({title:d,content:p("div","message-wrapper",$("fa-solid",Zt[t]??"info-circle"),p("span",i=>i.innerText=e)),buttons:[{text:W("ok","OK"),trigger:n}]}).show(s).then(i=>{const l=i.querySelector(".ui-popup-container .ui-popup-footer .ui-popup-button:last-child");l==null||l.focus()})})}function _i(d,e,t,s="question",n=document.body){return new Promise(r=>{const i=p("div","message-wrapper");ee(s)||i.appendChild($("fa-solid",Zt[s]??"question-circle")),i.appendChild(e instanceof HTMLElement?e:p("span",o=>o.innerText=e)),new rt({title:d,content:i,buttons:(t==null?void 0:t.map(o=>({text:o.text,trigger:c=>{let u;if(typeof o.trigger=="function"){if(u=o.trigger(c,o),typeof(u==null?void 0:u.then)=="function")return u.then(h=>(h!==!1&&r(h),h));u!==!1&&r(u)}else u={key:o.key,popup:c},r(u);return u}})))??[{text:W("yes","Yes"),trigger:o=>r({key:"yes",popup:o})},{text:W("no","No"),trigger:o=>r({key:"no",popup:o})}]}).show(n).then(o=>{const c=o.querySelector(".ui-popup-container .ui-popup-footer .ui-popup-button:last-child");c==null||c.focus()})})}w.Dropdown=tt,w.Grid=Re,w.Popup=rt,w.changeIcon=Ie,w.createCheckbox=ne,w.createElement=p,w.createIcon=$,w.createPopup=Ai,w.createRadiobox=gi,w.resolveCheckbox=mi,w.resolveIcon=yi,w.resolveTooltip=bi,w.setTooltip=et,w.showAlert=qi,w.showConfirm=_i,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})}); //# sourceMappingURL=ui.min.js.map diff --git a/Site/js/lib/ui.min.js.map b/Site/js/lib/ui.min.js.map index 92d4812..6a86912 100644 --- a/Site/js/lib/ui.min.js.map +++ b/Site/js/lib/ui.min.js.map @@ -1 +1 @@ -{"version":3,"file":"ui.min.js","sources":["../lib/functions.js","../lib/ui/icon.js","../lib/ui/checkbox.js","../lib/ui/tooltip.js","../lib/utility/strings.js","../lib/utility/lgres.js","../lib/utility.js","../lib/ui/dropdown.js","../lib/ui/grid/column.js","../lib/ui/grid/grid.js","../lib/ui/popup.js"],"sourcesContent":["export function createElement(tagName, init, ...children) {\r\n const element = document.createElement(tagName);\r\n if (typeof init === 'function') {\r\n init(element);\r\n } else if (init != null) {\r\n element.className = init;\r\n }\r\n if (children.length > 0) {\r\n element.append(...children);\r\n }\r\n return element;\r\n}\r\n","const svgns = 'http://www.w3.org/2000/svg';\r\n\r\nfunction createUse(type, id) {\r\n const c = typeof consts !== 'undefined' ? consts : {};\r\n const path = c.path || '';\r\n const ver = c.resver == null ? '' : `?${c.resver}`;\r\n const use = document.createElementNS(svgns, 'use');\r\n use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', `${path}fonts/${type}.svg${ver}#${id}`);\r\n return use;\r\n}\r\n\r\nfunction changeIcon(svg, type, id) {\r\n if (svg instanceof SVGElement) {\r\n svg.replaceChildren(createUse(type, id));\r\n }\r\n return svg;\r\n}\r\n\r\nfunction createIcon(type, id, style) {\r\n const svg = document.createElementNS(svgns, 'svg');\r\n svg.appendChild(createUse(type, id));\r\n if (style != null) {\r\n for (let css of Object.entries(style)) {\r\n svg.style.setProperty(css[0], css[1]);\r\n }\r\n }\r\n return svg;\r\n}\r\n\r\nfunction resolveIcon(container) {\r\n const svgs = container.querySelectorAll('svg[data-id]');\r\n for (let icon of svgs) {\r\n const type = icon.dataset.type;\r\n const id = icon.dataset.id;\r\n icon.replaceChildren(createUse(type, id));\r\n icon.removeAttribute('data-type');\r\n icon.removeAttribute('data-id');\r\n }\r\n return container;\r\n}\r\n\r\nexport {\r\n createIcon,\r\n changeIcon,\r\n resolveIcon\r\n}","import './css/checkbox.scss';\r\nimport { createElement } from \"../functions\";\r\nimport { createIcon } from \"./icon\";\r\n\r\nfunction fillCheckbox(container, type = 'fa-regular', label, tabindex = -1, charactor = 'check') {\r\n container.appendChild(\r\n createElement('layer', layer => {\r\n layer.className = 'ui-check-inner';\r\n layer.addEventListener('keypress', e => {\r\n if (e.key === ' ' || e.key === 'Enter') {\r\n const input = container.querySelector('input');\r\n if (input != null) {\r\n input.checked = !input.checked;\r\n input.dispatchEvent(new Event('change'));\r\n }\r\n }\r\n });\r\n if (tabindex >= 0) {\r\n layer.tabIndex = tabindex;\r\n }\r\n }, createIcon(type, charactor))\r\n );\r\n if (label instanceof Element) {\r\n container.appendChild(label);\r\n } else if (label?.length > 0) {\r\n container.appendChild(\r\n createElement('span', span => span.innerText = label)\r\n );\r\n }\r\n}\r\n\r\nfunction createRadiobox(opts = {}) {\r\n const container = createElement('label', 'ui-check-wrapper ui-radio-wrapper',\r\n createElement('input', input => {\r\n input.setAttribute('type', 'radio');\r\n input.name = opts.name;\r\n if (opts.checked === true) {\r\n input.checked = true;\r\n }\r\n if (opts.enabled === false) {\r\n input.disabled = true;\r\n }\r\n if (opts.customerAttributes != null) {\r\n for (let entry of Object.entries(opts.customerAttributes)) {\r\n input.setAttribute(entry[0], entry[1]);\r\n }\r\n }\r\n if (typeof opts.onchange === 'function') {\r\n input.addEventListener('change', opts.onchange);\r\n }\r\n }));\r\n if (opts.className) {\r\n container.classList.add(opts.className);\r\n }\r\n fillCheckbox(container, opts.type, opts.label, opts.tabIndex, 'circle');\r\n return container;\r\n}\r\n\r\nfunction createCheckbox(opts = {}) {\r\n const container = createElement('label', 'ui-check-wrapper',\r\n createElement('input', input => {\r\n input.setAttribute('type', 'checkbox');\r\n if (opts.checked === true) {\r\n input.checked = true;\r\n }\r\n if (opts.enabled === false) {\r\n input.disabled = true;\r\n }\r\n if (opts.customerAttributes != null) {\r\n for (let entry of Object.entries(opts.customerAttributes)) {\r\n input.setAttribute(entry[0], entry[1]);\r\n }\r\n }\r\n if (typeof opts.onchange === 'function') {\r\n input.addEventListener('change', opts.onchange);\r\n }\r\n }));\r\n if (opts.className) {\r\n container.classList.add(opts.className);\r\n }\r\n if (opts.enabled === false) {\r\n container.classList.add('disabled');\r\n }\r\n if (opts.checkedNode != null && opts.uncheckedNode != null) {\r\n container.classList.add('ui-check-image-wrapper');\r\n let height = opts.imageHeight;\r\n if (isNaN(height) || height <= 0) {\r\n height = 14;\r\n }\r\n opts.checkedNode.classList.add('checked');\r\n container.appendChild(opts.checkedNode);\r\n opts.uncheckedNode.classList.add('unchecked');\r\n container.appendChild(opts.uncheckedNode);\r\n } else {\r\n fillCheckbox(container, opts.type, opts.label, opts.tabIndex);\r\n }\r\n return container;\r\n}\r\n\r\nfunction resolveCheckbox(container = document.body, legacy) {\r\n if (legacy) {\r\n const checks = container.querySelectorAll('input[type=\"checkbox\"]');\r\n for (let chk of checks) {\r\n if (chk.parentElement.classList.contains('ui-check-wrapper')) {\r\n // skip\r\n continue;\r\n }\r\n const id = chk.id;\r\n let label, text;\r\n if (id != null) {\r\n label = container.querySelector(`label[for=\"${id}\"]`);\r\n }\r\n if (label == null) {\r\n const e = chk.nextElementSibling;\r\n if (e != null) {\r\n if (e.tagName === 'LABEL') {\r\n label = e;\r\n } else if (e.tagName === 'SPAN' && e.dataset.lgid != null) {\r\n text = e.innerText;\r\n e.style.display = 'none';\r\n }\r\n }\r\n }\r\n if (label == null) {\r\n const e = chk.previousElementSibling;\r\n if (e != null) {\r\n if (e.tagName === 'LABEL') {\r\n label = e;\r\n } else if (text == null && e.tagName === 'SPAN' && e.dataset.lgid != null) {\r\n text = e.innerText;\r\n e.style.display = 'none';\r\n }\r\n }\r\n }\r\n if (label == null) {\r\n label = createElement('label');\r\n chk.parentElement.insertBefore(label, chk);\r\n } else {\r\n text = label.innerText;\r\n }\r\n if (chk.disabled) {\r\n label.className = 'ui-check-wrapper disabled';\r\n } else {\r\n label.className = 'ui-check-wrapper';\r\n }\r\n label.replaceChildren();\r\n fillCheckbox(label, 'fa-regular', text, chk.tabIndex);\r\n label.insertBefore(chk, label.firstChild);\r\n }\r\n }\r\n const boxes = container.querySelectorAll('label[data-checkbox]');\r\n for (let box of boxes) {\r\n if (!box.classList.contains('ui-check-wrapper')) {\r\n box.classList.add('ui-check-wrapper');\r\n }\r\n if (box.hasChildNodes()) {\r\n if (!box.classList.contains('ui-check-image-wrapper')) {\r\n box.classList.add('ui-check-image-wrapper');\r\n }\r\n } else {\r\n fillCheckbox(box,\r\n box.dataset.type,\r\n box.dataset.label,\r\n box.dataset.tabIndex)\r\n box.removeAttribute('data-type');\r\n box.removeAttribute('data-label');\r\n }\r\n const input = createElement('input');\r\n const id = box.dataset.id;\r\n if (id?.length > 0) {\r\n input.id = id;\r\n }\r\n if (box.dataset.checked != null) {\r\n input.checked = true;\r\n }\r\n input.setAttribute('type', 'checkbox');\r\n box.insertBefore(input, box.firstChild);\r\n }\r\n return container;\r\n}\r\n\r\nexport {\r\n createCheckbox,\r\n resolveCheckbox,\r\n createRadiobox\r\n}","import './css/tooltip.scss';\r\nimport { createElement } from \"../functions\";\r\n// import { global } from \"../utility\";\r\n\r\nfunction setTooltip(container, content, flag = false, parent = null) {\r\n const isParent = parent instanceof HTMLElement;\r\n if (isParent) {\r\n const tipid = container.dataset.tipId;\r\n const tip = parent.querySelector(`.ui-tooltip-wrapper[data-tip-id=\"${tipid}\"]`);\r\n tip?.remove();\r\n } else {\r\n const tip = container.querySelector('.ui-tooltip-wrapper');\r\n tip?.remove();\r\n }\r\n const wrapper = createElement('div', wrapper => {\r\n wrapper.className = 'ui-tooltip-wrapper ui-tooltip-color';\r\n wrapper.style.visibility = 'hidden';\r\n wrapper.style.opacity = 0;\r\n wrapper.style.top = '0';\r\n wrapper.style.left = '0';\r\n },\r\n createElement('div', 'ui-tooltip-pointer ui-tooltip-color'),\r\n createElement('div', 'ui-tooltip-curtain ui-tooltip-color'),\r\n createElement('div', cnt => {\r\n cnt.className = 'ui-tooltip-content';\r\n if (content instanceof Element) {\r\n cnt.appendChild(content);\r\n } else {\r\n cnt.innerText = content;\r\n }\r\n })\r\n );\r\n // container.insertAdjacentElement('afterend', wrapper);\r\n if (isParent) {\r\n const tipId = String(Math.random()).substring(2);\r\n container.dataset.tipId = tipId;\r\n wrapper.dataset.tipId = tipId;\r\n parent.appendChild(wrapper);\r\n } else {\r\n container.appendChild(wrapper);\r\n }\r\n\r\n let tid;\r\n container.addEventListener('mouseenter', () => {\r\n tid && clearTimeout(tid);\r\n let c = container;\r\n while (c?.offsetWidth == null) {\r\n c = c.parentElement;\r\n }\r\n if (c == null) {\r\n return;\r\n }\r\n if (!flag || c.scrollWidth > c.offsetWidth) {\r\n tid = setTimeout(() => {\r\n let p;\r\n let left;\r\n let top;\r\n left = c.offsetLeft;\r\n top = c.offsetTop;\r\n if (isParent) {\r\n p = c.offsetParent;\r\n while (p != null && p !== parent) {\r\n left += p.offsetLeft;\r\n top += p.offsetTop;\r\n p = p.offsetParent;\r\n }\r\n }\r\n p = c.parentElement;\r\n const offsetParent = c.offsetParent;\r\n while (p != null && p !== (isParent ? parent : offsetParent)) {\r\n left -= p.scrollLeft;\r\n top -= p.scrollTop;\r\n p = p.parentElement;\r\n }\r\n left += (c.offsetWidth - wrapper.offsetWidth) / 2;\r\n top -= wrapper.offsetHeight + 14;\r\n wrapper.style.left = `${left}px`;\r\n wrapper.style.top = `${top}px`;\r\n wrapper.style.visibility = 'visible';\r\n wrapper.style.opacity = 1;\r\n }, 100);\r\n }\r\n });\r\n container.addEventListener('mouseleave', () => {\r\n tid && clearTimeout(tid);\r\n tid = setTimeout(() => {\r\n wrapper.style.visibility = 'hidden';\r\n wrapper.style.opacity = 0;\r\n }, 300);\r\n });\r\n return container;\r\n}\r\n\r\nfunction resolveTooltip(container = document.body) {\r\n const tips = container.querySelectorAll('[title]');\r\n for (let tip of tips) {\r\n const title = tip.getAttribute('title');\r\n if (title != null) {\r\n tip.removeAttribute('title');\r\n setTooltip(tip, title);\r\n }\r\n }\r\n return container;\r\n}\r\n\r\nexport {\r\n setTooltip,\r\n resolveTooltip\r\n}","function nullOrEmpty(s) {\r\n return s == null || typeof s !== 'string' || s.length === 0;\r\n}\r\n\r\nfunction contains(s, key, ignoreCase) {\r\n if (nullOrEmpty(s) || key == null) {\r\n return false;\r\n }\r\n if (typeof key !== 'string') {\r\n key = String(key);\r\n }\r\n if (ignoreCase) {\r\n return s.toLowerCase().indexOf(key.toLowerCase()) >= 0;\r\n }\r\n return s.indexOf(key) >= 0;\r\n}\r\n\r\nfunction endsWith(s, suffix) {\r\n if (nullOrEmpty(s) || nullOrEmpty(suffix)) {\r\n return false;\r\n }\r\n return s.indexOf(suffix) === s.length - suffix.length;\r\n}\r\n\r\nfunction padStart(s, num, char) {\r\n if (nullOrEmpty(s) || isNaN(num) || num <= s.length) {\r\n return s;\r\n }\r\n return (char ?? ' ').repeat(num - s.length);\r\n}\r\n\r\nfunction formatUrl(msg) {\r\n //const urlReg = /(https?:\\/\\/)?([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/\\w \\.-]*)*\\/?/ig;\r\n //const urlArrray = str.match(urlReg);\r\n const p = /(http|ftp|https):\\/\\/.+?(\\s|\\r\\n|\\r|\\n|\\\"|\\'|\\*|$)/g;\r\n const r = msg.match(p);\r\n msg = escapeHtml(msg);\r\n\r\n if (r?.length > 0) {\r\n const rs = [];\r\n for (let t of r) {\r\n t = t.replace(/[\"'\\r\\n ]/g, '');\r\n if (rs.indexOf(t) < 0) {\r\n rs.push(t);\r\n }\r\n }\r\n\r\n for (let r of rs) {\r\n msg = msg.replaceAll(r, '');\r\n }\r\n }\r\n\r\n return msg;\r\n}\r\n\r\nfunction escapeHtml(text) {\r\n if (text == null) {\r\n return '';\r\n }\r\n return String(text)\r\n .replaceAll('&', '&')\r\n .replaceAll('<', '<')\r\n .replaceAll('>', '>')\r\n .replaceAll('\\r\\n', '
')\r\n .replaceAll('\\n', '
')\r\n .replaceAll(' ', ' ');\r\n}\r\n\r\nexport {\r\n nullOrEmpty,\r\n contains,\r\n endsWith,\r\n padStart,\r\n formatUrl,\r\n escapeHtml\r\n}","import { getCookie } from \"./cookie\";\r\nimport { get } from \"./request\";\r\nimport { nullOrEmpty } from \"./strings\";\r\n\r\nlet cache;\r\n\r\nfunction getCurrentLgId() {\r\n let lgid;\r\n if (typeof consts !== 'undefined') {\r\n lgid = getCookie(consts.cookie?.lang);\r\n if (nullOrEmpty(lgid)) {\r\n lgid = consts.user?.language;\r\n }\r\n }\r\n if (nullOrEmpty(lgid)) {\r\n lgid = getCookie('lgid');\r\n }\r\n if (nullOrEmpty(lgid)) {\r\n lgid = navigator.language || 'en-us';\r\n }\r\n lgid = lgid.toLowerCase().replace(/-/g, '_');\r\n if (nullOrEmpty(lgid)) {\r\n lgid = 'en';\r\n }\r\n switch (lgid) {\r\n case 'en':\r\n case 'en_au':\r\n case 'fr':\r\n case 'zh_cn':\r\n return lgid;\r\n }\r\n const lang = lgid.split('_')[0];\r\n switch (lang) {\r\n case 'en':\r\n case 'fr':\r\n return lang;\r\n }\r\n return 'en';\r\n}\r\n\r\nfunction getStorageKey(lgid) {\r\n if (typeof consts !== 'undefined') {\r\n return (consts.prefix || '') + `res_${lgid}`;\r\n }\r\n return `res_${lgid}`;\r\n}\r\n\r\nasync function doRefreshLgres(template = '') {\r\n const lgid = getCurrentLgId();\r\n const r = await get(`language/${lgid}${template}`);\r\n const dict = await r.json();\r\n localStorage.setItem(getStorageKey(lgid), JSON.stringify(dict));\r\n return dict;\r\n}\r\n\r\nasync function refreshLgres(template, lgres) {\r\n if (lgres == null || typeof consts === 'undefined') {\r\n lgres = await doRefreshLgres(template);\r\n }\r\n const ver = Number(consts.resver);\r\n if (isNaN(lgres.ver) || isNaN(ver) || ver > lgres.ver) {\r\n console.log(`found new language res version: ${lgres.ver} => ${ver}`);\r\n lgres = await doRefreshLgres(template);\r\n }\r\n Object.defineProperty(lgres, 'r', {\r\n writable: false,\r\n configurable: false,\r\n enumerable: false,\r\n value: function (key, defaultValue) {\r\n return getLanguage(this, key, defaultValue);\r\n }\r\n });\r\n cache = lgres;\r\n return lgres;\r\n}\r\n\r\nfunction getLanguage(lgres, key, defaultValue) {\r\n let value = lgres[key];\r\n return value ?? defaultValue;\r\n}\r\n\r\nfunction applyLanguage(dom, result) {\r\n for (let text of dom.querySelectorAll('[data-lgid]')) {\r\n const key = text.dataset.lgid;\r\n if (text.tagName === 'INPUT') {\r\n text.value = getLanguage(result, key, text.value);\r\n } else {\r\n text.innerText = getLanguage(result, key, text.innerText);\r\n }\r\n }\r\n for (let title of dom.querySelectorAll('[data-title-lgid]')) {\r\n const key = title.dataset.titleLgid;\r\n title.setAttribute('title', getLanguage(result, key, title.getAttribute('title')));\r\n }\r\n for (let holder of dom.querySelectorAll('[data-placeholder-lgid]')) {\r\n const key = holder.dataset.placeholderLgid;\r\n holder.setAttribute('placeholder', getLanguage(result, key, holder.getAttribute('placeholder')));\r\n }\r\n}\r\n\r\nasync function init(dom = document.body, options = {}) {\r\n const lgid = getCurrentLgId();\r\n let lgres = localStorage.getItem(getStorageKey(lgid));\r\n let result;\r\n if (lgres != null) {\r\n try {\r\n lgres = JSON.parse(lgres);\r\n result = await refreshLgres(options.template, lgres);\r\n } catch (e) {\r\n console.error('error while parsing lgres, try refresh ...', e);\r\n result = await refreshLgres(options.template);\r\n }\r\n } else {\r\n result = await refreshLgres(options.template);\r\n }\r\n\r\n try {\r\n if (document.readyState === 'loading') {\r\n return await new Promise((resolve, reject) => {\r\n let tid = setTimeout(() => reject('timeout'), 30000);\r\n document.addEventListener('DOMContentLoaded', () => {\r\n clearTimeout(tid);\r\n tid = void 0;\r\n if (typeof options.callback === 'function') {\r\n options.callback(result);\r\n }\r\n applyLanguage(dom, result);\r\n resolve(result);\r\n });\r\n });\r\n }\r\n if (typeof options.callback === 'function') {\r\n options.callback(result);\r\n }\r\n applyLanguage(dom, result);\r\n return result;\r\n } catch (err) {\r\n console.error('error while loading language res ...', err);\r\n }\r\n}\r\n\r\nfunction r(key, defaultValue) {\r\n if (cache != null) {\r\n return getLanguage(cache, key, defaultValue);\r\n }\r\n return defaultValue;\r\n}\r\n\r\nconst lang = {\r\n get current() {\r\n return getCurrentLgId();\r\n },\r\n get unknownError() {\r\n return r('unknownError', 'An unknown error occurred, please contact the administrator.');\r\n },\r\n get savedSuccessfully() {\r\n return r('savedSuccessfully', 'Saved successfully.');\r\n }\r\n}\r\n\r\nexport {\r\n init,\r\n r,\r\n lang\r\n}","import { getCookie, setCookie, deleteCookie } from \"./utility/cookie\";\r\nimport { init, r, lang } from \"./utility/lgres\";\r\nimport { get, post, upload } from \"./utility/request\";\r\nimport { nullOrEmpty, contains, endsWith, padStart, formatUrl, escapeHtml } from \"./utility/strings\";\r\n\r\nlet g = typeof globalThis !== 'undefined' ? globalThis : self;\r\n\r\nfunction isPositive(n) {\r\n return !isNaN(n) && n > 0;\r\n}\r\n\r\nfunction isMobile() {\r\n return /mobile/i.test(navigator.userAgent);\r\n}\r\n\r\nfunction throttle(method, delay = 100, context = g, ...args) {\r\n if (method == null) {\r\n return;\r\n }\r\n method.tiid && clearTimeout(method.tiid);\r\n const current = new Date();\r\n if (method.tdate == null || current - method.tdate > delay) {\r\n method.apply(context, args);\r\n method.tdate = current;\r\n } else {\r\n method.tiid = setTimeout(() => method.apply(context, args), delay);\r\n }\r\n}\r\n\r\nfunction debounce(method, delay = 100, context = g, ...args) {\r\n if (method == null) {\r\n return;\r\n }\r\n method.tiid && clearTimeout(method.tiid);\r\n method.tiid = setTimeout(() => method.apply(context, args), delay);\r\n}\r\n\r\nfunction truncate(v) {\r\n return (v > 0 ? Math.floor : Math.ceil)(v);\r\n}\r\n\r\nfunction isEmail(text) {\r\n return /^\\w[-\\w.+]*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$/.test(text);\r\n}\r\n\r\nfunction isPhone(text) {\r\n if (/^[1-9]\\d{9,}$/.test(text)) {\r\n return true;\r\n }\r\n if (/^\\+?[1-9][\\d-]{9,}\\d$/.test(text) && /^[1-9]\\d{9,}$/.test(text.replace('+', '').replace(new RegExp('-', 'g'), ''))) {\r\n return true;\r\n }\r\n return false;\r\n}\r\n\r\nexport {\r\n // cookie\r\n getCookie,\r\n setCookie,\r\n deleteCookie,\r\n // lgres\r\n init,\r\n r,\r\n lang,\r\n // request\r\n get,\r\n post,\r\n upload,\r\n // strings\r\n nullOrEmpty,\r\n contains,\r\n endsWith,\r\n padStart,\r\n formatUrl,\r\n escapeHtml,\r\n // variables\r\n g as global,\r\n isPositive,\r\n isMobile,\r\n // functions\r\n throttle,\r\n debounce,\r\n truncate,\r\n isEmail,\r\n isPhone\r\n}","// import { r, global, contains, isPositive, nullOrEmpty } from \"../utility\";\r\nimport './css/dropdown.scss';\r\nimport { r } from \"../utility/lgres\";\r\nimport { contains, nullOrEmpty } from \"../utility/strings\";\r\nimport { global, isPositive } from \"../utility\";\r\nimport { createElement } from \"../functions\";\r\nimport { createCheckbox } from \"./checkbox\";\r\nimport { createIcon } from \"./icon\"\r\n\r\nconst SymbolDropdown = Symbol.for('ui-dropdown');\r\nconst DropdownTitleHeight = 26;\r\nconst DropdownItemHeight = 30;\r\n\r\nlet dropdownGlobal = global[SymbolDropdown];\r\n\r\nif (dropdownGlobal == null) {\r\n // init\r\n dropdownGlobal = {};\r\n Object.defineProperty(dropdownGlobal, 'clear', {\r\n writable: false,\r\n configurable: false,\r\n enumerable: false,\r\n value: function () {\r\n const panel = document.querySelector('.ui-drop-wrapper .ui-drop-box.active');\r\n if (panel == null) {\r\n return;\r\n }\r\n panel.classList.remove('active');\r\n const dropId = panel.parentElement.dataset.dropId;\r\n if (dropId == null) {\r\n return;\r\n }\r\n const dropdown = this[dropId];\r\n if (dropdown?.multiselect && typeof dropdown.oncollapsed === 'function') {\r\n dropdown.oncollapsed();\r\n }\r\n }\r\n })\r\n global[SymbolDropdown] = dropdownGlobal;\r\n\r\n document.addEventListener('mousedown', e => {\r\n let parent = e.target;\r\n while (parent != null) {\r\n if (parent.classList.contains('ui-drop-box')) {\r\n e.stopPropagation();\r\n return;\r\n }\r\n parent = parent.parentElement;\r\n }\r\n dropdownGlobal.clear();\r\n });\r\n}\r\n\r\nfunction selectItems(label, itemlist, htmlkey, textkey) {\r\n const htmls = itemlist.map(it => it[htmlkey]);\r\n if (htmls.some(it => it instanceof HTMLElement)) {\r\n label.replaceChildren(...htmls.filter(it => it != null).map(it => it.cloneNode(true)));\r\n } else {\r\n let text = itemlist.map(it => it[textkey]).join(', ');\r\n if (nullOrEmpty(text)) {\r\n text = r('noneItem', '( None )');\r\n }\r\n label.innerText = text;\r\n }\r\n}\r\n\r\nfunction filterSource(searchkeys, textkey, key, source) {\r\n if (!Array.isArray(searchkeys) || searchkeys.length === 0) {\r\n searchkeys = [textkey];\r\n }\r\n if (key.length > 0) {\r\n source = source.filter(it => {\r\n for (let k of searchkeys) {\r\n if (contains(it[k].toLowerCase(), key)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n });\r\n }\r\n return source;\r\n}\r\n\r\nclass Dropdown {\r\n #options;\r\n\r\n #wrapper;\r\n #container;\r\n #label;\r\n\r\n #allChecked;\r\n #source;\r\n #lastSelected;\r\n #selected;\r\n #selectedList;\r\n\r\n sourceFilter;\r\n onselectedlist;\r\n onselected;\r\n onexpanded;\r\n\r\n constructor(options = {}) {\r\n options.searchplaceholder ??= r('searchHolder', 'Search...');\r\n options.textkey ??= 'text';\r\n options.valuekey ??= 'value';\r\n options.htmlkey ??= 'html';\r\n options.maxlength ??= 500;\r\n this.#options = options;\r\n }\r\n\r\n create() {\r\n const options = this.#options;\r\n\r\n // wrapper\r\n const wrapper = createElement('div', 'ui-drop-wrapper');\r\n const dropId = String(Math.random()).substring(2);\r\n wrapper.dataset.dropId = dropId;\r\n dropdownGlobal[dropId] = this;\r\n this.#wrapper = wrapper;\r\n\r\n // header\r\n const header = createElement('div', 'ui-drop-header');\r\n header.addEventListener('keypress', e => {\r\n if (e.key === ' ' || e.key === 'Enter') {\r\n header.dispatchEvent(new MouseEvent('click'));\r\n }\r\n });\r\n header.addEventListener('keydown', e => {\r\n const up = e.key === 'ArrowUp';\r\n const down = e.key === 'ArrowDown';\r\n if (up || down) {\r\n const source = this.source;\r\n const count = source.length;\r\n const valuekey = this.#options.valuekey;\r\n let index = source?.indexOf(this.#selected);\r\n if (isNaN(index) || index < -1) {\r\n index = -1;\r\n } else if (index >= count) {\r\n index = count - 1;\r\n }\r\n if (up) {\r\n if (index > 0) {\r\n index--;\r\n } else {\r\n index = 0;\r\n }\r\n } else if (down) {\r\n if (index < 0) {\r\n index = 0;\r\n } else if (index < count) {\r\n index++;\r\n } else {\r\n index = count - 1;\r\n }\r\n }\r\n const target = source[index]?.[valuekey];\r\n if (target != null) {\r\n this.select(target);\r\n }\r\n } else if (e.key === 'Tab') {\r\n this.#dropdown(false);\r\n }\r\n });\r\n header.addEventListener('click', () => {\r\n if (this.disabled) {\r\n return;\r\n }\r\n const active = this.#expanded;\r\n const label = this.#label;\r\n if (active && label.ownerDocument.activeElement === label) {\r\n return;\r\n }\r\n this.#dropdown(!active);\r\n if (!active && typeof this.onexpanded === 'function') {\r\n setTimeout(() => this.onexpanded(), 120);\r\n }\r\n });\r\n\r\n // label or input\r\n let label;\r\n if (options.input) {\r\n label = createElement('input', 'ui-drop-text');\r\n label.setAttribute('type', 'text');\r\n options.placeholder && label.setAttribute('placeholder', options.placeholder);\r\n isPositive(options.maxlength) && label.setAttribute('maxlength', options.maxlength);\r\n isPositive(options.tabIndex) && label.setAttribute('tabindex', options.tabIndex);\r\n label.addEventListener('input', e => {\r\n const key = e.target.value.toLowerCase();\r\n const source = filterSource(options.searchkeys, options.textkey, key, this.source);\r\n this.#filllist(source);\r\n this.#container.classList.add('active');\r\n });\r\n label.addEventListener('blur', e => this.select(e.target.value));\r\n label.addEventListener('mousedown', e => this.#expanded && e.stopPropagation());\r\n } else {\r\n isPositive(options.tabIndex) && header.setAttribute('tabindex', options.tabIndex);\r\n label = createElement('label', 'ui-drop-text');\r\n }\r\n this.#label = label;\r\n if (options.multiselect) {\r\n if (Array.isArray(options.selectedlist)) {\r\n this.selectlist(options.selectedlist, true);\r\n } else {\r\n this.#allChecked = true;\r\n label.innerText = r('allItem', '( All )');\r\n }\r\n } else if (options.selected != null) {\r\n this.select(options.selected, true);\r\n }\r\n header.append(label, createElement('label', 'ui-drop-caret'));\r\n wrapper.appendChild(header);\r\n\r\n this.disabled = options.disabled || false;\r\n return wrapper;\r\n }\r\n\r\n get multiselect() { return this.#options.multiselect }\r\n\r\n get disabled() { return this.#wrapper == null || this.#wrapper.querySelector('.ui-drop-header.disabled') != null }\r\n\r\n set disabled(flag) {\r\n if (this.#wrapper == null) {\r\n return;\r\n }\r\n if (flag) {\r\n this.#wrapper.querySelector('.ui-drop-header').classList.add('disabled');\r\n } else {\r\n this.#wrapper.querySelector('.ui-drop-header').classList.remove('disabled');\r\n }\r\n }\r\n\r\n get source() {\r\n let source = this.#source;\r\n if (source == null || !Array.isArray(source)) {\r\n if (typeof this.sourceFilter === 'function') {\r\n source = this.sourceFilter();\r\n }\r\n if (!Array.isArray(source)) {\r\n source = [];\r\n }\r\n this.#source = source;\r\n }\r\n return source;\r\n }\r\n\r\n set source(list) {\r\n if (!Array.isArray(list)) {\r\n return;\r\n }\r\n this.#source = list;\r\n if (this.#expanded) {\r\n setTimeout(() => this.#dropdown(), 120);\r\n }\r\n }\r\n\r\n get selected() { return this.#selected }\r\n\r\n get selectedlist() { return this.#selectedList || [] }\r\n\r\n select(selected, silence) {\r\n if (this.#lastSelected === selected) {\r\n return false;\r\n }\r\n this.#lastSelected = selected;\r\n const valuekey = this.#options.valuekey;\r\n const textkey = this.#options.textkey;\r\n const htmlkey = this.#options.htmlkey;\r\n let item = this.source.find(it => it[valuekey] === selected);\r\n if (this.#options.input) {\r\n if (item == null) {\r\n item = { [valuekey]: selected };\r\n }\r\n this.#label.value = selected;\r\n } else {\r\n const expanded = this.#expanded;\r\n if (expanded) {\r\n this.#container.querySelectorAll('li[data-value].selected').forEach(li => li.classList.remove('selected'));\r\n }\r\n if (item == null) {\r\n this.#selected = null;\r\n this.#label.innerText = ' ';\r\n return false;\r\n }\r\n const html = item[htmlkey];\r\n if (html instanceof HTMLElement) {\r\n this.#label.replaceChildren(html.cloneNode(true));\r\n } else {\r\n let text = item[textkey];\r\n if (nullOrEmpty(text)) {\r\n text = ' ';\r\n }\r\n this.#label.innerText = text;\r\n }\r\n if (expanded) {\r\n const val = selected.replace(/\"/g, '\\\\\"');\r\n const li = this.#container.querySelector(`li[data-value=\"${val}\"]`);\r\n if (li != null) {\r\n li.classList.add('selected');\r\n }\r\n }\r\n }\r\n this.#selected = item;\r\n if (!silence && typeof this.onselected === 'function') {\r\n this.onselected(item);\r\n }\r\n }\r\n\r\n selectlist(selectedlist, silence) {\r\n const source = this.source;\r\n const valuekey = this.#options.valuekey;\r\n const textkey = this.#options.textkey;\r\n const htmlkey = this.#options.htmlkey;\r\n const itemlist = selectedlist.map(v => {\r\n let item = source.find(it => it[valuekey] === v);\r\n if (item == null) {\r\n item = { [valuekey]: v, [textkey]: v };\r\n }\r\n return item;\r\n });\r\n if (itemlist.length === 0) {\r\n this.#selectedList = null;\r\n this.#label.innerText = none;\r\n return false;\r\n }\r\n selectItems(this.#label, itemlist, htmlkey, textkey);\r\n this.#selectedList = itemlist;\r\n if (!silence && typeof this.onselectedlist === 'function') {\r\n this.onselectedlist(itemlist);\r\n }\r\n }\r\n\r\n get #expanded() { return this.#container?.classList?.contains('active') }\r\n\r\n #dropdown(flag = true) {\r\n const options = this.#options;\r\n let panel = this.#container;\r\n if (panel == null) {\r\n panel = createElement('div', 'ui-drop-box');\r\n // search box\r\n if (!options.input && options.search) {\r\n const search = createElement('div', 'ui-drop-search');\r\n const input = createElement('input');\r\n input.setAttribute('type', 'text');\r\n isPositive(options.tabIndex) && input.setAttribute('tabindex', options.tabIndex);\r\n !nullOrEmpty(options.searchplaceholder) && input.setAttribute('placeholder', options.searchplaceholder);\r\n input.addEventListener('input', e => {\r\n const key = e.target.value.toLowerCase();\r\n const source = filterSource(options.searchkeys, options.textkey, key, this.source);\r\n this.#filllist(source);\r\n })\r\n search.append(input, createIcon('fa-light', 'search'));\r\n panel.appendChild(search);\r\n }\r\n // list\r\n const list = createElement('ul', 'ui-drop-list');\r\n if (!this.multiselect) {\r\n list.addEventListener('click', e => {\r\n let li = e.target;\r\n while (li.tagName !== 'LI') {\r\n li = li.parentElement;\r\n if (li == null) {\r\n return;\r\n }\r\n }\r\n const value = li.dataset.value;\r\n if (this.select(value) !== false) {\r\n dropdownGlobal.clear();\r\n }\r\n });\r\n }\r\n panel.appendChild(list);\r\n this.#container = panel;\r\n this.#wrapper.appendChild(panel);\r\n }\r\n if (flag) {\r\n let source = this.source;\r\n if (!options.input && options.search) {\r\n const search = panel.querySelector('.ui-drop-search > input');\r\n if (!nullOrEmpty(search?.value)) {\r\n source = filterSource(options.searchkeys, options.textkey, search.value, source);\r\n }\r\n }\r\n this.#filllist(source);\r\n // slide direction\r\n if (!options.slidefixed) {\r\n let parent = options.parent ?? document.body;\r\n let p = this.#wrapper;\r\n let top = p.offsetTop;\r\n while ((p = p.parentElement) != null && p !== parent) {\r\n top -= p.scrollTop;\r\n }\r\n if (top - parent.offsetTop + DropdownTitleHeight + panel.offsetHeight >= parent.offsetHeight) {\r\n panel.classList.add('slide-up');\r\n } else {\r\n panel.classList.remove('slide-up');\r\n }\r\n }\r\n panel.classList.add('active');\r\n } else {\r\n panel.classList.remove('active');\r\n }\r\n }\r\n\r\n #filllist(source) {\r\n const list = this.#container.querySelector('.ui-drop-list');\r\n list.replaceChildren();\r\n const multiselect = this.multiselect;\r\n const allchecked = this.#allChecked;\r\n if (multiselect) {\r\n list.appendChild(\r\n createElement('li', null,\r\n createCheckbox({\r\n label: r('allItem', '( All )'),\r\n checked: allchecked,\r\n customerAttributes: { 'isall': '1' },\r\n onchange: e => this.#triggerselect(e.target)\r\n })\r\n )\r\n );\r\n }\r\n // TODO: virtual mode\r\n const valuekey = this.#options.valuekey;\r\n const textkey = this.#options.textkey;\r\n const htmlkey = this.#options.htmlkey;\r\n const selected = this.selected;\r\n const selectedlist = this.selectedlist;\r\n let scrolled;\r\n source.slice(0, 200).forEach((item, i) => {\r\n const val = item[valuekey];\r\n const li = createElement('li');\r\n li.dataset.value = val;\r\n li.setAttribute('title', item[textkey]);\r\n let label;\r\n const html = item[htmlkey];\r\n if (html instanceof HTMLElement) {\r\n label = html;\r\n }\r\n if (multiselect) {\r\n const selected = selectedlist.some(s => s[valuekey] === val);\r\n if (label == null) {\r\n label = createElement('span');\r\n label.innerText = item[textkey];\r\n }\r\n const box = createCheckbox({\r\n label,\r\n checked: allchecked || selected,\r\n customerAttributes: {\r\n 'class': 'dataitem',\r\n 'data-value': val\r\n },\r\n onchange: e => this.#triggerselect(e.target)\r\n });\r\n li.appendChild(box);\r\n } else {\r\n if (label == null) {\r\n li.innerText = item[textkey];\r\n } else {\r\n li.appendChild(label);\r\n }\r\n if (selected != null && selected[valuekey] === val) {\r\n scrolled = DropdownItemHeight * i;\r\n li.classList.add('selected');\r\n }\r\n }\r\n list.appendChild(li);\r\n });\r\n if (scrolled != null) {\r\n setTimeout(() => list.scrollTop = scrolled, 10);\r\n }\r\n }\r\n\r\n #triggerselect(checkbox) {\r\n let list;\r\n const valuekey = this.#options.valuekey;\r\n const textkey = this.#options.textkey;\r\n const htmlkey = this.#options.htmlkey;\r\n if (checkbox.getAttribute('isall') === '1') {\r\n const allchecked = this.#allChecked = checkbox.checked;\r\n const boxes = this.#container.querySelectorAll('input.dataitem');\r\n boxes.forEach(box => box.checked = allchecked);\r\n list = [];\r\n } else if (checkbox.checked) {\r\n if (this.#container.querySelectorAll('input.dataitem:not(:checked)').length === 0) {\r\n this.#allChecked = true;\r\n this.#container.querySelector('input[isall=\"1\"]').checked = true;\r\n list = [];\r\n } else {\r\n const source = this.source;\r\n list = [...this.#container.querySelectorAll('input.dataitem:checked')]\r\n .map(c => source.find(it => it[valuekey] === c.dataset.value))\r\n .filter(it => it != null);\r\n }\r\n } else {\r\n const val = checkbox.dataset.value;\r\n if (this.#allChecked) {\r\n this.#allChecked = false;\r\n this.#container.querySelector('input[isall=\"1\"]').checked = false;\r\n list = this.source.filter(it => it[valuekey] !== val);\r\n } else {\r\n list = this.selectedlist.filter(it => it[valuekey] !== val);\r\n }\r\n }\r\n if (this.#allChecked) {\r\n this.#label.innerText = r('allItem', '( All )');\r\n } else {\r\n selectItems(this.#label, list, htmlkey, textkey);\r\n }\r\n this.#selectedList = list;\r\n if (typeof this.onselectedlist === 'function') {\r\n this.onselectedlist(itemlist);\r\n }\r\n }\r\n\r\n static resolve(dom = document.body) {\r\n const selects = dom.querySelectorAll('select');\r\n for (let sel of selects) {\r\n const source = [...sel.children].map(it => {\r\n return { value: it.value, text: it.innerText }\r\n });\r\n const drop = new Dropdown({\r\n selected: sel.value,\r\n disabled: sel.disabled,\r\n tabIndex: sel.tabIndex\r\n });\r\n drop.source = source;\r\n sel.parentElement.replaceChild(drop.create(), sel);\r\n }\r\n return dom;\r\n }\r\n}\r\n\r\nexport default Dropdown;","import { global } from \"../../utility\";\r\n// import { nullOrEmpty } from \"../../utility/strings\";\r\nimport { createElement } from \"../../functions\";\r\nimport { createIcon } from \"../icon\";\r\nimport { createCheckbox } from \"../checkbox\";\r\n// import { setTooltip } from \"../tooltip\";\r\nimport Dropdown from \"../dropdown\";\r\n\r\nclass GridColumn {\r\n static create() {\r\n return createElement('span');\r\n }\r\n\r\n static setValue(element, val) {\r\n element.innerText = val;\r\n }\r\n\r\n static setStyle(element, style) {\r\n for (let css of Object.entries(style)) {\r\n element.style.setProperty(css[0], css[1]);\r\n }\r\n }\r\n\r\n static setEnabled(element, enabled) {\r\n const tooltip = element.querySelector('.ui-tooltip-wrapper');\r\n if (tooltip != null) {\r\n tooltip.style.display = enabled === false ? 'none' : '';\r\n }\r\n }\r\n}\r\n\r\nclass GridInputColumn extends GridColumn {\r\n static get editing() { return true };\r\n\r\n static createEdit(trigger, col, _parent, vals) {\r\n const input = createElement('input');\r\n input.setAttribute('type', 'text');\r\n if (typeof trigger === 'function') {\r\n input.addEventListener('change', trigger);\r\n }\r\n input.addEventListener('input', () => {\r\n if (vals.__editing == null) {\r\n vals.__editing = {\r\n [col.key]: true\r\n }\r\n } else {\r\n vals.__editing[col.key] = true;\r\n }\r\n });\r\n return input;\r\n }\r\n\r\n static setValue(element, val) {\r\n if (element.tagName !== 'INPUT') {\r\n super.setValue(element, val);\r\n } else {\r\n element.value = val;\r\n }\r\n }\r\n\r\n static getValue(e) { return e.target.value }\r\n\r\n static setEnabled(element, enabled) {\r\n super.setEnabled(element , enabled);\r\n element.disabled = enabled === false;\r\n }\r\n}\r\n\r\nclass GridTextColumn extends GridInputColumn {\r\n static createEdit(trigger, col, _parent, vals) {\r\n const input = createElement('textarea');\r\n if (typeof trigger === 'function') {\r\n input.addEventListener('change', trigger);\r\n }\r\n input.addEventListener('input', () => {\r\n if (vals.__editing == null) {\r\n vals.__editing = {\r\n [col.key]: true\r\n }\r\n } else {\r\n vals.__editing[col.key] = true;\r\n }\r\n });\r\n return input;\r\n }\r\n\r\n static setValue(element, val, _item, _col, grid) {\r\n if (element.tagName !== 'TEXTAREA') {\r\n super.setValue(element, val);\r\n } else {\r\n element.value = val;\r\n if (val != null) {\r\n const lines = String(val).split('\\n').length;\r\n element.style.height = `${lines * grid.lineHeight + 12}px`;\r\n }\r\n // TODO: bad performance\r\n }\r\n }\r\n}\r\n\r\nconst SymbolDropdown = Symbol.for('ui-dropdown');\r\n\r\nclass GridDropdownColumn extends GridColumn {\r\n static createEdit(trigger, col, parent) {\r\n const drop = new Dropdown({ ...col.dropOptions, parent });\r\n drop.onselected = trigger;\r\n return drop.create();\r\n }\r\n\r\n static #getDrop(element) {\r\n const dropGlobal = global[SymbolDropdown];\r\n if (dropGlobal == null) {\r\n return null;\r\n }\r\n const dropId = element.dataset.dropId;\r\n const drop = dropGlobal[dropId];\r\n if (drop == null) {\r\n return null;\r\n }\r\n return drop;\r\n }\r\n\r\n static #getSource(item, col) {\r\n let source = col.source;\r\n if (typeof source === 'function') {\r\n source = source(item);\r\n }\r\n return source;\r\n }\r\n\r\n static #setValue(source, element, val) {\r\n const data = source?.find(v => v.value === val);\r\n if (data != null) {\r\n val = data.text;\r\n }\r\n super.setValue(element, val);\r\n }\r\n\r\n static setValue(element, val, item, col) {\r\n if (element.tagName !== 'DIV') {\r\n let source = this.#getSource(item, col);\r\n if (source instanceof Promise) {\r\n source.then(s => this.#setValue(s, element, val));\r\n } else {\r\n this.#setValue(source, element, val);\r\n }\r\n return;\r\n }\r\n const drop = this.#getDrop(element);\r\n if (drop == null) {\r\n return;\r\n }\r\n if (drop.source == null || drop.source.length === 0) {\r\n let source = this.#getSource(item, col);\r\n if (source instanceof Promise) {\r\n source.then(s => {\r\n drop.source = s;\r\n drop.select(val, true);\r\n })\r\n return;\r\n } else if (source != null) {\r\n drop.source = source;\r\n }\r\n }\r\n drop.select(val, true);\r\n }\r\n\r\n static getValue(e) {\r\n return e.value;\r\n }\r\n\r\n static setEnabled(element, enabled) {\r\n super.setEnabled(element , enabled);\r\n const drop = this.#getDrop(element);\r\n if (drop == null) {\r\n return;\r\n }\r\n drop.disabled = enabled === false;\r\n }\r\n}\r\n\r\nclass GridCheckboxColumn extends GridColumn {\r\n static createEdit(trigger) {\r\n const check = createCheckbox({\r\n onchange: typeof trigger === 'function' ? trigger : null\r\n });\r\n return check;\r\n }\r\n\r\n static setValue(element, val) {\r\n element.querySelector('input').checked = val;\r\n }\r\n\r\n static getValue(e) { return e.target.checked }\r\n\r\n static setEnabled(element, enabled) {\r\n super.setEnabled(element , enabled);\r\n element.querySelector('input').disabled = enabled === false;\r\n }\r\n}\r\n\r\nclass GridIconColumn extends GridColumn {\r\n static create() { return createElement('span', 'col-icon') }\r\n\r\n static setValue(element, val, item, col, grid) {\r\n let className = col.className;\r\n if (typeof className === 'function') {\r\n className = className.call(col, item);\r\n }\r\n if (className == null) {\r\n element.className = 'col-icon';\r\n } else {\r\n element.className = `col-icon ${className}`;\r\n }\r\n let type = col.iconType;\r\n if (typeof type === 'function') {\r\n type = type.call(col, item);\r\n }\r\n type ??= 'fa-regular';\r\n if (element.dataset.type !== type || element.dataset.icon !== val) {\r\n const icon = createIcon(type, val);\r\n // const layer = element.children[0];\r\n element.replaceChildren(icon);\r\n // !nullOrEmpty(col.tooltip) && setTooltip(element, col.tooltip, false, grid.element);\r\n element.dataset.type = type;\r\n element.dataset.icon = val;\r\n }\r\n }\r\n\r\n static setEnabled(element, enabled) {\r\n super.setEnabled(element , enabled);\r\n if (enabled === false) {\r\n element.classList.add('disabled');\r\n } else {\r\n element.classList.remove('disabled');\r\n }\r\n }\r\n}\r\n\r\nexport {\r\n GridColumn,\r\n GridInputColumn,\r\n GridTextColumn,\r\n GridDropdownColumn,\r\n GridCheckboxColumn,\r\n GridIconColumn\r\n}","import '../css/grid.scss';\r\nimport { global, isPositive, isMobile, throttle, truncate } from \"../../utility\";\r\nimport { r } from \"../../utility/lgres\";\r\nimport { nullOrEmpty } from \"../../utility/strings\";\r\nimport { createElement } from \"../../functions\";\r\nimport { createIcon } from \"../icon\";\r\nimport { createCheckbox } from \"../checkbox\";\r\nimport { setTooltip } from \"../tooltip\";\r\nimport { GridColumn, GridInputColumn, GridTextColumn, GridDropdownColumn, GridCheckboxColumn, GridIconColumn } from \"./column\";\r\n\r\nconst ColumnChangedType = {\r\n Reorder: 'reorder',\r\n Resize: 'resize',\r\n Sort: 'sort'\r\n};\r\nconst RefreshInterval = isMobile() ? 32 : 0;\r\nconst HoverInternal = 200;\r\nconst RedumCount = 4;\r\nconst MiniDragOffset = 4;\r\nconst MiniColumnWidth = 50;\r\nconst FilterPanelWidth = 200;\r\n\r\nfunction getClientX(e) {\r\n if (e == null) {\r\n return null;\r\n }\r\n const cx = e.touches && e.touches[0]?.clientX;\r\n return cx ?? e.clientX;\r\n}\r\n\r\nfunction getOffsetLeftFromWindow(element) {\r\n let left = 0;\r\n while (element != null) {\r\n left += element.offsetLeft;\r\n element = element.offsetParent;\r\n }\r\n return left;\r\n}\r\n\r\nfunction indexOfParent(target) {\r\n // return [...target.parentElement.children].indexOf(target);\r\n return Array.prototype.indexOf.call(target.parentElement.children, target);\r\n}\r\n\r\nconst ColumnTypes = {\r\n 0: GridColumn,\r\n 1: GridInputColumn,\r\n 2: GridDropdownColumn,\r\n 3: GridCheckboxColumn,\r\n 4: GridIconColumn,\r\n 5: GridTextColumn\r\n};\r\n\r\nclass Grid {\r\n #source;\r\n #currentSource;\r\n #parent;\r\n #el;\r\n #refs;\r\n #rendering;\r\n #selectedColumnIndex = -1;\r\n #selectedIndexes;\r\n #startIndex = 0;\r\n #needResize;\r\n #containerHeight;\r\n #bodyClientWidth;\r\n #rowCount = -1;\r\n #scrollTop;\r\n #scrollLeft;\r\n #colTypes = {};\r\n #colAttrs = {};\r\n #vtable = [];\r\n\r\n columns = [];\r\n langs = {\r\n all: r('allItem', '( All )'),\r\n ok: r('ok', 'OK'),\r\n reset: r('reset', 'Reset')\r\n };\r\n virtualCount = 100;\r\n rowHeight = 36;\r\n lineHeight = 24;\r\n extraRows = 0;\r\n filterRowHeight = 30;\r\n height;\r\n readonly;\r\n multiSelect = false;\r\n fullrowClick = true;\r\n allowHtml = false;\r\n holderDisabled = false;\r\n headerVisible = true;\r\n window = global;\r\n sortIndex = -1;\r\n sortDirection = 1;\r\n\r\n willSelect;\r\n selectedRowChanged;\r\n cellDblClicked;\r\n cellClicked;\r\n rowDblClicked;\r\n columnChanged;\r\n\r\n static ColumnTypes = {\r\n Common: 0,\r\n Input: 1,\r\n Dropdown: 2,\r\n Checkbox: 3,\r\n Icon: 4,\r\n Text: 5,\r\n isCheckbox(type) { return type === 3 }\r\n };\r\n\r\n static GridColumn = GridColumn;\r\n\r\n constructor(container) {\r\n this.#parent = container;\r\n }\r\n\r\n get element() { return this.#el }\r\n\r\n get source() { return this.#source?.map(s => s.values) }\r\n set source(list) {\r\n if (this.#el == null) {\r\n throw new Error('grid has not been initialized.')\r\n }\r\n if (!Array.isArray(list)) {\r\n throw new Error('source is not an Array.')\r\n }\r\n list = list.map(i => { return { values: i } });\r\n this.#source = list;\r\n this.#refreshSource(list);\r\n }\r\n\r\n #refreshSource(list) {\r\n list ??= this.#source;\r\n if (this.#colAttrs.__filtered === true) {\r\n this.#currentSource = list.filter(it => {\r\n for (let col of this.columns) {\r\n if (Array.isArray(col.filterValues)) {\r\n const v = this.#getItemValue(it.values, col.key, col.filter);\r\n if (col.filterValues.indexOf(v) < 0) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n });\r\n } else {\r\n this.#currentSource = list;\r\n }\r\n this.#selectedColumnIndex = -1;\r\n this.#selectedIndexes = [];\r\n this.#startIndex = 0;\r\n this.#scrollTop = 0;\r\n this.#scrollLeft = 0;\r\n this.#rowCount = -1;\r\n\r\n if (this.sortIndex >= 0) {\r\n this.sortColumn();\r\n }\r\n this.resize();\r\n }\r\n\r\n get virtual() { return this.#currentSource?.length > this.virtualCount }\r\n\r\n get sortKey() {\r\n if (this.columns == null) {\r\n return null;\r\n }\r\n return this.columns[this.sortIndex]?.key;\r\n }\r\n\r\n get selectedIndexes() { return this.#selectedIndexes }\r\n set selectedIndexes(indexes) {\r\n const startIndex = this.#startIndex;\r\n this.#selectedIndexes.splice(0, this.#selectedIndexes.length, ...indexes);\r\n if (this.readonly !== true) {\r\n this.refresh();\r\n } else {\r\n [...this.#refs.bodyContent.children].forEach((row, i) => {\r\n if (indexes.indexOf(startIndex + i) >= 0) {\r\n row.classList.add('selected');\r\n } else if (row.classList.contains('selected')) {\r\n row.classList.remove('selected');\r\n }\r\n });\r\n }\r\n if (typeof this.selectedRowChanged === 'function') {\r\n this.selectedRowChanged();\r\n }\r\n }\r\n\r\n get selectedIndex() { return (this.#selectedIndexes && this.#selectedIndexes[0]) ?? -1 }\r\n\r\n get loading() { return this.#refs.loading?.style?.visibility === 'visible' }\r\n set loading(flag) {\r\n if (this.#refs.loading == null) {\r\n return;\r\n }\r\n if (flag === false) {\r\n this.#refs.loading.style.visibility = 'hidden';\r\n this.#refs.loading.style.opacity = 0;\r\n } else {\r\n this.#refs.loading.style.visibility = 'visible';\r\n this.#refs.loading.style.opacity = 1;\r\n }\r\n }\r\n\r\n get scrollTop() { return this.#refs.body?.scrollTop; }\r\n set scrollTop(top) {\r\n if (this.#refs.body == null) {\r\n return;\r\n }\r\n this.#refs.body.scrollTop = top;\r\n this.reload();\r\n }\r\n\r\n init(container = this.#parent) {\r\n this.#el = null;\r\n this.#refs = {};\r\n this.#rendering = true;\r\n if (!(container instanceof HTMLElement)) {\r\n throw new Error('no specified parent.');\r\n }\r\n this.#parent = container;\r\n const grid = createElement('div', 'ui-grid');\r\n grid.setAttribute('tabindex', 0);\r\n grid.addEventListener('keydown', e => {\r\n let index = this.selectedIndex;\r\n let flag = false;\r\n if (e.key === 'ArrowUp') {\r\n // up\r\n if (index > 0) {\r\n flag = true;\r\n index -= 1;\r\n }\r\n } else if (e.key === 'ArrowDown') {\r\n // down\r\n const count = this.#currentSource?.length ?? 0;\r\n if (index < count - 1) {\r\n flag = true;\r\n index += 1;\r\n }\r\n }\r\n if (flag) {\r\n this.#selectedIndexes = [index];\r\n this.scrollToIndex(index);\r\n this.refresh();\r\n if (typeof this.selectedRowChanged === 'function') {\r\n this.selectedRowChanged(index);\r\n }\r\n e.stopPropagation();\r\n }\r\n });\r\n container.replaceChildren(grid);\r\n const sizer = createElement('span', 'ui-grid-sizer');\r\n grid.appendChild(sizer);\r\n this.#refs.sizer = sizer;\r\n\r\n // header & body\r\n const header = this.#createHeader();\r\n grid.appendChild(header);\r\n const body = this.#createBody();\r\n grid.appendChild(body);\r\n\r\n // loading\r\n const loading = createElement('div', 'ui-grid-loading',\r\n createElement('div', null, createIcon('fa-regular', 'spinner-third'))\r\n );\r\n this.#refs.loading = loading;\r\n grid.appendChild(loading);\r\n this.#el = grid;\r\n\r\n this.#rendering = false;\r\n if (this.#source != null && this.sortIndex >= 0) {\r\n this.sortColumn();\r\n }\r\n }\r\n\r\n scrollToIndex(index) {\r\n const top = this.#scrollToTop(index * (this.rowHeight + 1), true);\r\n this.#refs.body.scrollTop = top;\r\n }\r\n\r\n resize(force) {\r\n if (this.#rendering || this.#el == null) {\r\n return;\r\n }\r\n const body = this.#refs.body;\r\n // let height = this.#refs.header.offsetHeight + 2;\r\n // let top = body.offsetTop;\r\n // if (top !== height) {\r\n // body.style.top = `${height}px`;\r\n // top = height;\r\n // }\r\n const top = this.headerVisible === false ? 0 : this.#refs.header.offsetHeight;\r\n\r\n let height = this.height;\r\n if (height === 0) {\r\n height = this.#containerHeight;\r\n } else if (isNaN(height) || height < 0) {\r\n height = this.#el.offsetHeight - top;\r\n }\r\n const count = truncate((height - 1) / (this.rowHeight + 1)) + (RedumCount * 2) + 1;\r\n if (force || count !== this.#rowCount) {\r\n this.#rowCount = count;\r\n this.reload();\r\n }\r\n this.#bodyClientWidth = body.clientWidth;\r\n }\r\n\r\n reload() {\r\n let length = this.#currentSource.length;\r\n if (this.extraRows > 0) {\r\n length += this.extraRows;\r\n }\r\n this.#containerHeight = length * (this.rowHeight + 1);\r\n this.#refs.body.scrollTop = 0;\r\n this.#refs.body.scrollLeft = 0;\r\n this.#refs.bodyContent.style.top = '0px';\r\n this.#refs.bodyContainer.style.height = `${this.#containerHeight}px`;\r\n this.#adjustRows(this.#refs.bodyContent);\r\n this.refresh();\r\n }\r\n\r\n refresh() {\r\n if (this.#refs.bodyContent == null) {\r\n throw new Error('body has not been created.');\r\n }\r\n const rows = this.#refs.bodyContent.children;\r\n const widths = {};\r\n this.#fillRows(rows, this.columns, widths);\r\n if (this.#needResize && widths.flag) {\r\n this.#needResize = false;\r\n this.columns.forEach((col, i) => {\r\n if (!this.#get(col.key, 'autoResize')) {\r\n return;\r\n }\r\n let width = widths[i];\r\n if (width < col.width) {\r\n width = col.width;\r\n }\r\n if (width > 0) {\r\n this.#changeColumnWidth(i, width);\r\n }\r\n });\r\n }\r\n }\r\n\r\n resetChange() {\r\n if (this.#source == null) {\r\n return;\r\n }\r\n for (let row of this.#source) {\r\n delete row.__changed;\r\n }\r\n }\r\n\r\n sortColumn(reload) {\r\n const index = this.sortIndex;\r\n const col = this.columns[index];\r\n if (col == null) {\r\n return;\r\n }\r\n const direction = this.sortDirection;\r\n [...this.#refs.header.children].forEach((th, i) => {\r\n const arrow = th.querySelector('.arrow');\r\n if (arrow == null) {\r\n return;\r\n }\r\n if (i === index) {\r\n arrow.className = `arrow ${(direction !== 1 ? 'desc' : 'asc')}`;\r\n } else if (arrow.className !== 'arrow') {\r\n arrow.className = 'arrow';\r\n }\r\n });\r\n let comparer;\r\n if (typeof col.sortFilter !== 'function') {\r\n const direction = this.sortDirection;\r\n if (isNaN(direction)) {\r\n direction = 1;\r\n }\r\n comparer = (a, b) => {\r\n a = this.#getItemValue(a.values, col.key, col.filter);\r\n b = this.#getItemValue(b.values, col.key, col.filter);\r\n if (a == null && typeof b === 'number') {\r\n a = 0;\r\n } else if (typeof a === 'number' && b == null) {\r\n b = 0;\r\n } else if (a != null && b == null) {\r\n return direction;\r\n } else if (typeof a === 'string' && typeof b === 'string') {\r\n a = a.toLowerCase();\r\n b = b.toLowerCase();\r\n }\r\n return a === b ? 0 : (a > b ? 1 : -1) * direction;\r\n };\r\n } else {\r\n comparer = (a, b) => col.sortFilter(a.values, b.values) * direction;\r\n }\r\n this.#source.sort(comparer);\r\n if (this.#colAttrs.__filtered === true) {\r\n this.#currentSource.sort(comparer);\r\n }\r\n if (this.#rowCount < 0) {\r\n return;\r\n }\r\n if (reload) {\r\n this.reload();\r\n } else {\r\n this.refresh();\r\n }\r\n }\r\n\r\n #createHeader() {\r\n const thead = createElement('table', 'ui-grid-header');\r\n if (this.headerVisible === false) {\r\n thead.style.display = 'none';\r\n }\r\n const header = createElement('tr');\r\n thead.appendChild(header);\r\n const sizer = this.#refs.sizer;\r\n for (let col of this.columns) {\r\n if (col.visible === false) {\r\n const hidden = createElement('th');\r\n hidden.style.display = 'none';\r\n if (col.sortable !== false) {\r\n hidden.dataset.key = col.key;\r\n hidden.addEventListener('click', e => this.#onHeaderClicked(e, col, true));\r\n }\r\n header.appendChild(hidden);\r\n continue;\r\n }\r\n // style\r\n const isCheckbox = Grid.ColumnTypes.isCheckbox(col.type);\r\n if (col.width > 0) {\r\n // col.autoResize = false;\r\n } else {\r\n this.#set(col.key, 'autoResize', true);\r\n this.#needResize = true;\r\n sizer.innerText = col.caption ?? '';\r\n let width = sizer.offsetWidth + 22;\r\n if (!this.readonly && col.enabled !== false && col.allcheck && isCheckbox) {\r\n width += 32;\r\n }\r\n if (col.allowFilter === true) {\r\n width += 14;\r\n }\r\n if (width < MiniColumnWidth) {\r\n width = MiniColumnWidth;\r\n }\r\n col.width = width;\r\n }\r\n col.align ??= isCheckbox ? 'center' : 'left';\r\n if (col.sortable !== false) {\r\n col.sortable = true;\r\n }\r\n const w = `${col.width}px`;\r\n const style = {\r\n 'width': w,\r\n 'max-width': w,\r\n 'min-width': w,\r\n 'text-align': col.align\r\n };\r\n this.#set(col.key, 'style', style);\r\n // element\r\n const th = createElement('th', 'column');\r\n th.dataset.key = col.key;\r\n for (let css of Object.entries(style)) {\r\n th.style.setProperty(css[0], css[1]);\r\n }\r\n if (col.sortable) {\r\n th.style.cursor = 'pointer';\r\n th.addEventListener('click', e => this.#onHeaderClicked(e, col));\r\n }\r\n if (col.orderable !== false) {\r\n col.orderable = true;\r\n th.addEventListener('mousedown', e => this.#onDragStart(e, col));\r\n }\r\n const wrapper = createElement('div');\r\n th.appendChild(wrapper);\r\n if (!this.readonly && col.enabled !== false && col.allcheck && isCheckbox) {\r\n const check = createCheckbox({\r\n onchange: e => this.#onColumnAllChecked(col, e.target.checked)\r\n });\r\n wrapper.appendChild(check);\r\n }\r\n const caption = createElement('span');\r\n if (col.textStyle != null) {\r\n for (let css of Object.entries(col.textStyle)) {\r\n caption.style.setProperty(css[0], css[1]);\r\n }\r\n }\r\n caption.innerText = col.caption ?? '';\r\n wrapper.appendChild(caption);\r\n // order arrow\r\n if (col.sortable) {\r\n th.appendChild(createElement('layer', 'arrow'));\r\n }\r\n // filter\r\n if (col.allowFilter === true) {\r\n const filter = createElement('layer', 'filter');\r\n filter.appendChild(createIcon('fa-solid', 'filter'));\r\n filter.addEventListener('mousedown', e => this.#onFilter(e, col));\r\n th.classList.add('header-filter');\r\n th.appendChild(filter);\r\n }\r\n // resize spliter\r\n if (col.resizable !== false) {\r\n const spliter = createElement('layer', 'spliter');\r\n spliter.addEventListener('mousedown', e => this.#onResizeStart(e, col));\r\n spliter.addEventListener('dblclick', e => this.#onAutoResize(e, col));\r\n th.appendChild(spliter);\r\n }\r\n // tooltip\r\n // !nullOrEmpty(col.tooltip) && setTooltip(th, col.tooltip);\r\n header.appendChild(th);\r\n }\r\n const dragger = createElement('div', 'dragger');\r\n const draggerCursor = createElement('layer', 'dragger-cursor');\r\n header.appendChild(createElement('th', null, dragger, draggerCursor));\r\n\r\n sizer.replaceChildren();\r\n this.#refs.header = header;\r\n this.#refs.dragger = dragger;\r\n this.#refs.draggerCursor = draggerCursor;\r\n return thead;\r\n }\r\n\r\n #createBody() {\r\n const body = createElement('div', 'ui-grid-body');\r\n body.addEventListener('scroll', e => throttle(this.#onScroll, RefreshInterval, this, e), { passive: true });\r\n const cols = this.columns;\r\n let width = 1;\r\n for (let col of cols) {\r\n if (col.visible !== false && !isNaN(col.width)) {\r\n width += col.width + 1;\r\n }\r\n }\r\n // body container\r\n const bodyContainer = createElement('div');\r\n bodyContainer.style.position = 'relative';\r\n bodyContainer.style.minWidth = '100%';\r\n bodyContainer.style.minHeight = '1px';\r\n if (width > 0) {\r\n bodyContainer.style.width = `${width}px`;\r\n }\r\n body.appendChild(bodyContainer);\r\n // body content\r\n const bodyContent = createElement('table', 'ui-grid-body-content');\r\n bodyContent.addEventListener('mousedown', e => {\r\n let [parent, target] = this.#getRowTarget(e.target);\r\n const rowIndex = indexOfParent(parent);\r\n let colIndex = indexOfParent(target);\r\n if (colIndex >= this.columns.length) {\r\n colIndex = -1;\r\n }\r\n this.#onRowClicked(e, rowIndex, colIndex);\r\n });\r\n bodyContent.addEventListener('dblclick', e => this.#onRowDblClicked(e));\r\n bodyContainer.appendChild(bodyContent);\r\n // this.#adjustRows();\r\n // events\r\n if (!this.holderDisabled) {\r\n const holder = createElement('div', 'ui-grid-hover-holder');\r\n holder.addEventListener('mousedown', e => {\r\n const holder = e.currentTarget;\r\n const row = Number(holder.dataset.row);\r\n const col = Number(holder.dataset.col);\r\n if (holder.classList.contains('active')) {\r\n holder.classList.remove('active');\r\n }\r\n return this.#onRowClicked(e, row + this.#startIndex, col);\r\n });\r\n holder.addEventListener('dblclick', e => this.#onRowDblClicked(e));\r\n bodyContainer.appendChild(holder);\r\n body.addEventListener('mousemove', e => throttle(this.#onBodyMouseMove, HoverInternal, this, e, holder), { passive: true });\r\n }\r\n this.#refs.body = body;\r\n this.#refs.bodyContainer = bodyContainer;\r\n this.#refs.bodyContent = bodyContent;\r\n\r\n // this.refresh();\r\n return body;\r\n }\r\n\r\n #adjustRows() {\r\n let count = this.#rowCount;\r\n if (isNaN(count) || count < 0 || !this.virtual) {\r\n count = this.#currentSource.length;\r\n }\r\n const cols = this.columns;\r\n const content = this.#refs.bodyContent;\r\n const exists = content.children.length;\r\n count -= exists;\r\n if (count > 0) {\r\n for (let i = 0; i < count; i += 1) {\r\n const row = createElement('tr', 'ui-grid-row');\r\n // row.addEventListener('mousedown', e => this.#onRowClicked(e, exists + i));\r\n // row.addEventListener('dblclick', e => this.#onRowDblClicked(e));\r\n cols.forEach((col, j) => {\r\n const cell = createElement('td');\r\n if (col.visible !== false) {\r\n cell.dataset.row = String(exists + i);\r\n cell.dataset.col = String(j);\r\n const style = this.#get(col.key, 'style');\r\n if (style != null) {\r\n for (let css of Object.entries(style)) {\r\n cell.style.setProperty(css[0], css[1]);\r\n }\r\n }\r\n if (col.css != null) {\r\n for (let css of Object.entries(col.css)) {\r\n cell.style.setProperty(css[0], css[1]);\r\n }\r\n }\r\n if (Grid.ColumnTypes.isCheckbox(col.type)) {\r\n cell.appendChild(GridCheckboxColumn.createEdit(e => this.#onRowChanged(e, exists + i, col, e.target.checked, cell)));\r\n // this.#colTypes[col.key] = GridCheckboxColumn;\r\n } else {\r\n let type = this.#colTypes[col.key];\r\n if (type == null) {\r\n if (isNaN(col.type)) {\r\n if (this.allowHtml && col.type != null) {\r\n type = col.type;\r\n }\r\n } else {\r\n type = ColumnTypes[col.type];\r\n }\r\n type ??= GridColumn;\r\n this.#colTypes[col.key] = type;\r\n }\r\n cell.appendChild(type.create(col));\r\n }\r\n }\r\n row.appendChild(cell);\r\n });\r\n row.appendChild(createElement('td'));\r\n content.appendChild(row);\r\n }\r\n } else if (count < 0) {\r\n for (let i = -1; i >= count; i -= 1) {\r\n // content.removeChild(content.children[exists + i]);\r\n content.children[exists + i].remove();\r\n }\r\n }\r\n }\r\n\r\n #fillRows(rows, cols, widths) {\r\n const startIndex = this.#startIndex;\r\n const selectedIndexes = this.#selectedIndexes;\r\n [...rows].forEach((row, i) => {\r\n const vals = this.#currentSource[startIndex + i];\r\n if (vals == null) {\r\n return;\r\n }\r\n if (!isPositive(row.children.length)) {\r\n return;\r\n }\r\n const item = vals.values;\r\n const selected = selectedIndexes.indexOf(startIndex + i) >= 0;\r\n if (selected) {\r\n row.classList.add('selected');\r\n } else if (row.classList.contains('selected')) {\r\n row.classList.remove('selected');\r\n }\r\n // data\r\n const selectChanged = vals.__selected ^ selected;\r\n if (selected) {\r\n vals.__selected = true;\r\n } else {\r\n delete vals.__selected;\r\n }\r\n cols.forEach((col, j) => {\r\n if (col.visible === false) {\r\n return;\r\n }\r\n let val;\r\n if (col.text != null) {\r\n val = col.text;\r\n } else if (typeof col.filter === 'function') {\r\n val = col.filter(item);\r\n } else {\r\n val = item[col.key];\r\n if (val?.displayValue != null) {\r\n val = val.displayValue;\r\n }\r\n }\r\n val ??= '';\r\n // fill\r\n const cell = row.children[j];\r\n if (typeof col.bgFilter === 'function') {\r\n const bgColor = col.bgFilter(item);\r\n cell.style.backgroundColor = bgColor ?? '';\r\n }\r\n const isCheckbox = Grid.ColumnTypes.isCheckbox(col.type);\r\n const type = isCheckbox ? GridCheckboxColumn : this.#colTypes[col.key] ?? GridColumn;\r\n let element;\r\n if (!isCheckbox && selectChanged && typeof type.createEdit === 'function') {\r\n if (vals.__editing?.[col.key] && type.editing) {\r\n val = type.getValue({ target: cell.children[0] });\r\n this.#onRowChanged(null, startIndex + i, col, val, cell, true);\r\n }\r\n element = selected ?\r\n type.createEdit(e => this.#onRowChanged(e, startIndex + i, col, type.getValue(e), cell), col, this.#refs.bodyContent, vals) :\r\n type.create(col);\r\n cell.replaceChildren(element);\r\n } else {\r\n element = cell.children[0];\r\n }\r\n let enabled;\r\n if (this.readonly) {\r\n enabled = false;\r\n } else {\r\n enabled = col.enabled;\r\n if (typeof enabled === 'function') {\r\n enabled = enabled.call(col, item);\r\n } else if (typeof enabled === 'string') {\r\n enabled = item[enabled];\r\n }\r\n }\r\n type.setValue(element, val, item, col, this);\r\n let tip = col.tooltip;\r\n if (typeof tip === 'function') {\r\n tip = tip.call(col, item);\r\n }\r\n if (nullOrEmpty(tip)) {\r\n element.querySelector('.ui-tooltip-wrapper')?.remove();\r\n } else {\r\n setTooltip(element, tip, false, this.element);\r\n }\r\n if (typeof type.setEnabled === 'function') {\r\n type.setEnabled(element, enabled);\r\n }\r\n // auto resize\r\n if (this.#needResize && this.#get(col.key, 'autoResize')) {\r\n const width = element.scrollWidth + 12;\r\n if (width > 0 && widths != null && (isNaN(widths[j]) || widths[j] < width)) {\r\n widths[j] = width;\r\n widths.flag = true;\r\n }\r\n }\r\n if (typeof col.styleFilter === 'function') {\r\n const style = col.styleFilter(item);\r\n if (style != null) {\r\n type.setStyle(element, style);\r\n }\r\n }\r\n if (col.events != null) {\r\n for (let ev of Object.entries(col.events)) {\r\n element[ev[0]] = ev[1].bind(item);\r\n }\r\n }\r\n if (col.attrs != null) {\r\n let attrs = col.attrs;\r\n if (typeof attrs === 'function') {\r\n attrs = attrs(item);\r\n }\r\n for (let attr of Object.entries(attrs)) {\r\n element.setAttribute(attr[0], attr[1]);\r\n }\r\n }\r\n });\r\n if (vals.__editing != null) {\r\n delete vals.__editing;\r\n }\r\n });\r\n }\r\n\r\n #changeColumnWidth(index, width) {\r\n const col = this.columns[index];\r\n // const oldwidth = col.width;\r\n const w = `${width}px`;\r\n col.width = width;\r\n const style = this.#get(col.key, 'style');\r\n style.width = w;\r\n style['max-width'] = w;\r\n style['min-width'] = w;\r\n let element = this.#refs.header.children[index];\r\n element.style.width = w;\r\n element.style.maxWidth = w;\r\n element.style.minWidth = w;\r\n const body = this.#refs.bodyContent;\r\n for (let row of body.children) {\r\n element = row.children[index];\r\n if (element != null) {\r\n element.style.width = w;\r\n element.style.maxWidth = w;\r\n element.style.minWidth = w;\r\n }\r\n }\r\n // } else {\r\n // width = this.#refs.bodyContainer.offsetWidth - oldwidth + width;\r\n // this.#refs.bodyContainer.style.width = `${width}px`;\r\n // }\r\n }\r\n\r\n #changingColumnOrder(index, offset, x, offsetLeft) {\r\n const children = this.#refs.header.children;\r\n let element = children[index];\r\n this.#refs.dragger.style.left = `${element.offsetLeft - offsetLeft + offset}px`;\r\n this.#refs.dragger.style.width = element.style.width;\r\n this.#refs.dragger.style.display = 'block';\r\n offset = x - getOffsetLeftFromWindow(element);\r\n let idx;\r\n if (offset < 0) {\r\n offset = -offset;\r\n for (let i = index - 1; i >= 0 && offset >= 0; i -= 1) {\r\n element = children[i];\r\n if (element == null || element.className !== 'column') {\r\n break;\r\n }\r\n if (offset < element.offsetWidth) {\r\n idx = (offset > element.offsetWidth / 2) ? i : i + 1;\r\n break;\r\n }\r\n offset -= element.offsetWidth;\r\n }\r\n idx ??= 0;\r\n } else {\r\n const count = children.length;\r\n for (let i = index; i < count - 1 && offset >= 0; i += 1) {\r\n element = children[i];\r\n if (element == null || element.className !== 'column') {\r\n idx = i;\r\n break;\r\n }\r\n if (offset < element.offsetWidth) {\r\n idx = (offset > element.offsetWidth / 2) ? i + 1 : i;\r\n break;\r\n }\r\n offset -= element.offsetWidth;\r\n }\r\n idx ??= count - 1;\r\n }\r\n if (idx !== this.#colAttrs.__orderIndex) {\r\n this.#colAttrs.__orderIndex = idx;\r\n element = children[idx];\r\n if (element == null) {\r\n return;\r\n }\r\n this.#refs.draggerCursor.style.left = `${element.offsetLeft - offsetLeft}px`;\r\n this.#refs.draggerCursor.style.display = 'block';\r\n }\r\n }\r\n\r\n #changeColumnOrder(index) {\r\n this.#refs.dragger.style.display = '';\r\n this.#refs.draggerCursor.style.display = '';\r\n const orderIndex = this.#colAttrs.__orderIndex;\r\n if (orderIndex >= 0 && orderIndex !== index) {\r\n let targetIndex = orderIndex - index;\r\n if (targetIndex >= 0 && targetIndex <= 1) {\r\n return;\r\n }\r\n const header = this.#refs.header;\r\n const children = header.children;\r\n const rows = this.#refs.bodyContent.children;\r\n const columns = this.columns;\r\n if (targetIndex > 1) {\r\n targetIndex = orderIndex - 1;\r\n // const current = columns[index];\r\n // for (let i = index; i < targetIndex; i += 1) {\r\n // columns[i] = columns[i + 1];\r\n // }\r\n // columns[targetIndex] = current;\r\n const current = columns.splice(index, 1)[0];\r\n columns.splice(targetIndex, 0, current);\r\n header.insertBefore(children[index], children[targetIndex].nextElementSibling);\r\n for (let row of rows) {\r\n row.insertBefore(row.children[index], row.children[targetIndex].nextElementSibling);\r\n }\r\n } else {\r\n targetIndex = orderIndex;\r\n // const current = columns[index];\r\n // for (let i = index; i > targetIndex; i -= 1) {\r\n // columns[i] = columns[i - 1];\r\n // }\r\n // columns[targetIndex] = current;\r\n const current = columns.splice(index, 1)[0];\r\n columns.splice(targetIndex, 0, current);\r\n header.insertBefore(children[index], children[targetIndex]);\r\n for (let row of rows) {\r\n row.insertBefore(row.children[index], row.children[targetIndex]);\r\n }\r\n }\r\n // refresh sortIndex\r\n [...children].forEach((th, i) => {\r\n const arrow = th.querySelector('.arrow');\r\n if (arrow == null) {\r\n return;\r\n }\r\n if (arrow.className !== 'arrow') {\r\n this.sortIndex = i;\r\n }\r\n });\r\n\r\n if (typeof this.columnChanged === 'function') {\r\n this.columnChanged(ColumnChangedType.Reorder, index, targetIndex);\r\n }\r\n }\r\n }\r\n\r\n #scrollToTop(top, reload) {\r\n const rowHeight = (this.rowHeight + 1);\r\n top -= (top % (rowHeight * 2)) + (RedumCount * rowHeight);\r\n if (top < 0) {\r\n top = 0;\r\n } else {\r\n let bottomTop = this.#containerHeight - (reload ? 0 : this.#rowCount * rowHeight);\r\n if (bottomTop < 0) {\r\n bottomTop = 0;\r\n }\r\n if (top > bottomTop) {\r\n top = bottomTop;\r\n }\r\n }\r\n if (this.#scrollTop !== top) {\r\n this.#scrollTop = top;\r\n if (this.virtual) {\r\n this.#startIndex = top / rowHeight;\r\n }\r\n this.refresh();\r\n if (this.virtual) {\r\n this.#refs.bodyContent.style.top = `${top}px`;\r\n }\r\n } else if (reload) {\r\n this.refresh();\r\n }\r\n\r\n return top;\r\n }\r\n\r\n #get(key, name) {\r\n const attr = this.#colAttrs[key];\r\n if (attr == null) {\r\n return null;\r\n }\r\n return attr[name];\r\n }\r\n\r\n #set(key, name, value) {\r\n const attr = this.#colAttrs[key];\r\n if (attr == null) {\r\n this.#colAttrs[key] = { [name]: value };\r\n } else {\r\n attr[name] = value;\r\n }\r\n }\r\n\r\n #getItemValue(item, key, filter) {\r\n let value;\r\n if (typeof filter === 'function') {\r\n value = filter(item);\r\n } else {\r\n value = item[key];\r\n }\r\n return value?.value ?? value;\r\n }\r\n\r\n #getRowTarget(target) {\r\n let parent;\r\n while ((parent = target.parentElement) != null && !parent.classList.contains('ui-grid-row')) {\r\n target = parent;\r\n }\r\n return [parent, target];\r\n }\r\n\r\n #notHeader(tagName) {\r\n return /^(input|label|layer|svg|use)$/i.test(tagName);\r\n }\r\n\r\n #onHeaderClicked(e, col, force) {\r\n if (!force && (this.#get(col.key, 'resizing') || this.#get(col.key, 'dragging'))) {\r\n return;\r\n }\r\n if (!this.#notHeader(e.target.tagName)) {\r\n const index = this.columns.indexOf(col);\r\n if (index < 0) {\r\n return;\r\n }\r\n if (this.sortIndex === index) {\r\n this.sortDirection = this.sortDirection === 1 ? -1 : 1;\r\n } else {\r\n this.sortIndex = index;\r\n }\r\n this.sortColumn(true);\r\n if (typeof this.columnChanged === 'function') {\r\n this.columnChanged(ColumnChangedType.Sort, index, this.sortDirection);\r\n }\r\n }\r\n }\r\n\r\n #onCloseFilter() {\r\n const panels = this.#el.querySelectorAll('.filter-panel.active');\r\n if (panels.length > 0) {\r\n panels.forEach(el => el.classList.remove('active'));\r\n setTimeout(() => this.#el.querySelectorAll('.filter-panel').forEach(el => el.remove()), 120);\r\n const filtering = this.#colAttrs.__filtering;\r\n if (filtering instanceof HTMLElement) {\r\n filtering.classList.remove('hover');\r\n }\r\n delete this.#colAttrs.__filtering;\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n #onFilter(e, col) {\r\n if (this.#onCloseFilter()) {\r\n return;\r\n }\r\n const close = e => {\r\n if ((e.target.tagName === 'LAYER' && e.target.classList.contains('filter')) ||\r\n e.target.tagName === 'use') {\r\n return;\r\n }\r\n if (this.#onCloseFilter()) {\r\n document.removeEventListener('mousedown', close);\r\n }\r\n }\r\n document.addEventListener('mousedown', close);\r\n const panel = createElement('div', 'filter-panel');\r\n panel.addEventListener('mousedown', e => e.stopPropagation());\r\n const filter = e.currentTarget;\r\n const th = filter.parentElement;\r\n const width = th.offsetWidth;\r\n panel.style.top = `${th.offsetHeight}px`;\r\n panel.style.left = (th.offsetLeft + (width > FilterPanelWidth ? width - FilterPanelWidth : 0)) + 'px';\r\n\r\n // search\r\n let searchbox;\r\n if (col.allowSearch !== false) {\r\n const searchholder = createElement('div', 'filter-search-holder');\r\n searchbox = createElement('input', 'filter-search-box ui-text');\r\n searchbox.type = 'text';\r\n const searchicon = createIcon('fa-regular', 'search');\r\n searchicon.addEventListener('mousedown', e => {\r\n searchbox.focus();\r\n e.preventDefault();\r\n });\r\n searchholder.append(searchbox, searchicon);\r\n panel.append(searchholder);\r\n }\r\n // list\r\n const itemlist = createElement('div', 'filter-item-list');\r\n itemlist.addEventListener('scroll', e => throttle(this.#onFilterScroll, RefreshInterval, this, col, itemlist, e.target.scrollTop), { passive: true });\r\n // - all\r\n const itemall = createElement('div', 'filter-item filter-all');\r\n itemall.appendChild(createCheckbox({\r\n label: this.langs.all,\r\n onchange: e => {\r\n const checked = e.target.checked;\r\n itemlist.querySelectorAll('.filter-content input').forEach(box => box.checked = checked);\r\n }\r\n }));\r\n itemlist.appendChild(itemall);\r\n // - items\r\n let array;\r\n if (Array.isArray(col.filterSource)) {\r\n array = col.filterSource;\r\n } else if (typeof col.filterSource === 'function') {\r\n array = col.filterSource.call(this, col);\r\n } else {\r\n const dict = Object.create(null);\r\n for (let item of this.#source) {\r\n const val = this.#getItemValue(item.values, col.key, col.filter);\r\n if (!Object.hasOwnProperty.call(dict, val)) {\r\n const v = item.values[col.key];\r\n dict[val] = {\r\n value: val,\r\n displayValue: typeof col.filter === 'function' ? col.filter(item.values) : v?.displayValue ?? v\r\n };\r\n }\r\n }\r\n array = Object.values(dict)\r\n .sort((a, b) => {\r\n a = a?.value ?? a;\r\n b = b?.value ?? b;\r\n return a > b ? 1 : a < b ? -1 : 0;\r\n });\r\n }\r\n array = array.map(i => {\r\n if (Object.prototype.hasOwnProperty.call(i, 'value') &&\r\n Object.prototype.hasOwnProperty.call(i, 'displayValue')) {\r\n return i;\r\n }\r\n return {\r\n value: i,\r\n displayValue: i == null ? '' : i\r\n };\r\n });\r\n this.#fillFilterList(col, itemlist, array, itemall);\r\n itemall.querySelector('input').checked = ![...itemlist.querySelectorAll('.filter-content input')].some(i => !i.checked);\r\n panel.appendChild(itemlist);\r\n if (searchbox != null) {\r\n searchbox.addEventListener('input', e => {\r\n const key = e.currentTarget.value.toLowerCase();\r\n const items = key.length === 0 ? array : array.filter(i => {\r\n const displayValue = i?.displayValue ?? i;\r\n return String(displayValue ?? '').indexOf(key) >= 0;\r\n });\r\n this.#fillFilterList(col, itemlist, items, itemall);\r\n });\r\n }\r\n // function\r\n const functions = createElement('div', 'filter-function');\r\n functions.append(\r\n createElement('button', ok => {\r\n ok.innerText = this.langs.ok;\r\n ok.addEventListener('click', () => {\r\n const array = this.#get(col.key, 'filterSource').filter(i => i.__checked !== false);\r\n if (typeof col.onFilterOk === 'function') {\r\n col.onFilterOk.call(this, col, array);\r\n } else {\r\n col.filterValues = array.map(a => a.value);\r\n }\r\n this.#colAttrs.__filtered = true;\r\n this.#refreshSource();\r\n if (typeof col.onFiltered === 'function') {\r\n col.onFiltered.call(this, col);\r\n }\r\n filter.classList.add('active');\r\n this.#onCloseFilter();\r\n });\r\n }),\r\n createElement('button', reset => {\r\n reset.innerText = this.langs.reset;\r\n reset.addEventListener('click', () => {\r\n delete col.filterValues;\r\n this.#colAttrs.__filtered = this.columns.some(c => col.filterValues != null)\r\n this.#refreshSource();\r\n if (typeof col.onFiltered === 'function') {\r\n col.onFiltered.call(this, col);\r\n }\r\n filter.classList.remove('active');\r\n this.#onCloseFilter();\r\n });\r\n })\r\n );\r\n panel.appendChild(functions);\r\n\r\n this.#el.appendChild(panel);\r\n setTimeout(() => panel.classList.add('active'), 0);\r\n this.#colAttrs.__filtering = filter;\r\n filter.classList.add('hover');\r\n }\r\n\r\n #fillFilterList(col, list, array, all) {\r\n list.querySelector('.filter-holder')?.remove();\r\n list.querySelector('.filter-content')?.remove();\r\n const rowHeight = this.filterRowHeight;\r\n const height = array.length * rowHeight;\r\n this.#set(col.key, 'filterHeight', height);\r\n const holder = createElement('div', 'filter-holder');\r\n holder.style.height = `${height}px`;\r\n const content = createElement('div', 'filter-content');\r\n content.style.top = `${rowHeight}px`;\r\n this.#set(col.key, 'filterSource', array);\r\n for (let item of array) {\r\n item.__checked = !Array.isArray(col.filterValues) || col.filterValues.indexOf(item.value ?? item) >= 0;\r\n }\r\n if (array.length > 12) {\r\n array = array.slice(0, 12);\r\n }\r\n this.#doFillFilterList(content, array, all);\r\n list.append(holder, content);\r\n }\r\n\r\n #doFillFilterList(content, array, all) {\r\n for (let item of array) {\r\n const div = createElement('div', 'filter-item');\r\n div.appendChild(createCheckbox({\r\n checked: item.__checked,\r\n label: item?.displayValue ?? item,\r\n onchange: e => {\r\n item.__checked = e.target.checked;\r\n all.querySelector('input').checked = ![...content.querySelectorAll('input')].some(i => !i.checked);\r\n }\r\n }));\r\n content.appendChild(div);\r\n }\r\n }\r\n\r\n #onFilterScroll(col, list, top) {\r\n const rowHeight = this.filterRowHeight;\r\n top -= (top % (rowHeight * 2)) + rowHeight;\r\n if (top < 0) {\r\n top = 0;\r\n } else {\r\n let bottomTop = this.#get(col.key, 'filterHeight') - (12 * rowHeight);\r\n if (bottomTop < 0) {\r\n bottomTop = 0;\r\n }\r\n if (top > bottomTop) {\r\n top = bottomTop;\r\n }\r\n }\r\n if (this.#get(col.key, 'filterTop') !== top) {\r\n this.#set(col.key, 'filterTop', top);\r\n const startIndex = top / rowHeight;\r\n let array = this.#get(col.key, 'filterSource');\r\n if (startIndex + 12 < array.length) {\r\n array = array.slice(startIndex, startIndex + 12);\r\n } else {\r\n array = array.slice(-12);\r\n }\r\n const content = list.querySelector('.filter-content');\r\n content.replaceChildren();\r\n this.#doFillFilterList(content, array, list.querySelector('.filter-all>input'));\r\n content.style.top = `${top + rowHeight}px`;\r\n }\r\n }\r\n\r\n #onDragStart(e, col) {\r\n if (this.#notHeader(e.target.tagName)) {\r\n return;\r\n }\r\n const cx = getClientX(e);\r\n const index = indexOfParent(e.currentTarget);\r\n const clearEvents = attr => {\r\n for (let event of ['mousemove', 'mouseup']) {\r\n if (attr.hasOwnProperty(event)) {\r\n window.removeEventListener(event, attr[event]);\r\n delete attr[event];\r\n }\r\n }\r\n };\r\n let attr = this.#colAttrs[col.key];\r\n if (attr == null) {\r\n attr = this.#colAttrs[col.key] = {};\r\n } else {\r\n clearEvents(attr);\r\n }\r\n attr.dragging = true;\r\n const offsetLeft = this.#refs.header.querySelector('th:last-child').offsetLeft;\r\n const dragmove = e => {\r\n const cx2 = getClientX(e);\r\n const offset = cx2 - cx;\r\n let pos = attr.offset;\r\n let dragging;\r\n if (pos == null && (offset > MiniDragOffset || offset < -MiniDragOffset)) {\r\n dragging = true;\r\n } else if (pos !== offset) {\r\n dragging = true;\r\n }\r\n if (dragging) {\r\n this.#changingColumnOrder(index, offset, cx2, offsetLeft);\r\n attr.offset = offset;\r\n }\r\n };\r\n attr.mousemove = e => throttle(dragmove, RefreshInterval, this, e);\r\n attr.mouseup = () => {\r\n clearEvents(attr);\r\n if (attr.offset == null) {\r\n delete attr.dragging;\r\n } else {\r\n setTimeout(() => {\r\n delete attr.dragging;\r\n delete attr.offset;\r\n });\r\n this.#changeColumnOrder(index);\r\n }\r\n };\r\n ['mousemove', 'mouseup'].forEach(event => window.addEventListener(event, attr[event]));\r\n }\r\n\r\n #onResizeStart(e, col) {\r\n const cx = getClientX(e);\r\n const width = col.width;\r\n const index = indexOfParent(e.currentTarget.parentElement);\r\n const window = this.window ?? global;\r\n const clearEvents = attr => {\r\n for (let event of ['mousemove', 'mouseup']) {\r\n if (attr.hasOwnProperty(event)) {\r\n window.removeEventListener(event, attr[event]);\r\n delete attr[event];\r\n }\r\n }\r\n };\r\n let attr = this.#colAttrs[col.key];\r\n if (attr == null) {\r\n attr = this.#colAttrs[col.key] = {};\r\n } else {\r\n clearEvents(attr);\r\n }\r\n attr.resizing = width;\r\n const resizemove = e => {\r\n const cx2 = getClientX(e);\r\n const val = width + (cx2 - cx);\r\n if (val < MiniColumnWidth) {\r\n return;\r\n }\r\n attr.resizing = val;\r\n attr.sizing = true;\r\n this.#changeColumnWidth(index, val);\r\n };\r\n attr.mousemove = e => throttle(resizemove, RefreshInterval, this, e);\r\n attr.mouseup = e => {\r\n clearEvents(attr);\r\n const width = attr.resizing;\r\n if (width != null) {\r\n setTimeout(() => delete attr.resizing);\r\n if (attr.sizing) {\r\n delete attr.sizing;\r\n delete attr.autoResize;\r\n this.#changeColumnWidth(index, width);\r\n if (typeof this.columnChanged === 'function') {\r\n this.columnChanged(ColumnChangedType.Resize, index, width);\r\n }\r\n }\r\n }\r\n e.stopPropagation();\r\n e.preventDefault();\r\n };\r\n ['mousemove', 'mouseup'].forEach(event => window.addEventListener(event, attr[event]));\r\n }\r\n\r\n #onAutoResize(e, col) {\r\n const th = e.currentTarget.parentElement;\r\n const index = indexOfParent(th);\r\n let width = th.querySelector('div:first-child').scrollWidth;\r\n for (let row of this.#refs.bodyContent.children) {\r\n const element = row.children[index].children[0];\r\n const w = element.scrollWidth;\r\n if (w > width) {\r\n width = w;\r\n }\r\n }\r\n if (width < MiniColumnWidth) {\r\n width = MiniColumnWidth;\r\n }\r\n if (width > 0 && width !== col.width) {\r\n width += 12;\r\n this.#changeColumnWidth(index, width);\r\n if (typeof this.columnChanged === 'function') {\r\n this.columnChanged(ColumnChangedType.Resize, index, width);\r\n }\r\n }\r\n }\r\n\r\n #onColumnAllChecked(col, flag) {\r\n if (this.#currentSource == null) {\r\n return;\r\n }\r\n const key = col.key;\r\n const isFunction = typeof col.enabled === 'function';\r\n const isString = typeof col.enabled === 'string';\r\n if (typeof col.onallchecked === 'function') {\r\n col.onallchecked.call(this, col, flag);\r\n } else {\r\n for (let row of this.#currentSource) {\r\n const item = row.values;\r\n if (item == null) {\r\n continue;\r\n }\r\n const enabled = isFunction ? col.enabled(item) : isString ? item[col.enabled] : col.enabled;\r\n if (enabled !== false) {\r\n item[key] = flag;\r\n row.__changed = true;\r\n if (typeof col.onchanged === 'function') {\r\n col.onchanged.call(this, item, flag);\r\n }\r\n }\r\n }\r\n this.refresh();\r\n }\r\n }\r\n\r\n #onScroll(e) {\r\n const left = e.target.scrollLeft;\r\n if (this.#scrollLeft !== left) {\r\n this.#scrollLeft = left;\r\n this.#refs.header.style.left = `${-left}px`;\r\n }\r\n if (!this.virtual) {\r\n return;\r\n }\r\n const top = e.target.scrollTop;\r\n this.#scrollToTop(top);\r\n }\r\n\r\n #onBodyMouseMove(e, holder) {\r\n if (e.target.classList.contains('ui-grid-hover-holder')) {\r\n return;\r\n }\r\n let [parent, target] = this.#getRowTarget(e.target);\r\n if (parent == null) {\r\n delete holder.dataset.row;\r\n delete holder.dataset.col;\r\n if (holder.classList.contains('active')) {\r\n holder.classList.remove('active');\r\n }\r\n return;\r\n }\r\n const element = target.children[0];\r\n if (element?.tagName !== 'SPAN') {\r\n if (holder.classList.contains('active')) {\r\n delete holder.dataset.row;\r\n delete holder.dataset.col;\r\n holder.classList.remove('active');\r\n }\r\n return;\r\n }\r\n const row = target.dataset.row;\r\n const col = target.dataset.col;\r\n if (holder.dataset.row === row &&\r\n holder.dataset.col === col) {\r\n return;\r\n }\r\n if (element.scrollWidth > element.offsetWidth) {\r\n holder.dataset.row = row;\r\n holder.dataset.col = col;\r\n holder.innerText = element.innerText;\r\n const top = this.#refs.bodyContent.offsetTop + target.offsetTop;\r\n let left = target.offsetLeft;\r\n let width = holder.offsetWidth;\r\n if (width > this.#bodyClientWidth) {\r\n width = this.#bodyClientWidth;\r\n }\r\n const maxleft = this.#bodyClientWidth + this.#scrollLeft - width;\r\n if (left > maxleft) {\r\n left = maxleft;\r\n }\r\n const height = target.offsetHeight;\r\n holder.style.cssText = `top: ${top}px; left: ${left}px; max-width: ${this.#bodyClientWidth}px; height: ${height - 2}px`;\r\n holder.classList.add('active');\r\n } else if (holder.classList.contains('active')) {\r\n delete holder.dataset.row;\r\n delete holder.dataset.col;\r\n holder.classList.remove('active');\r\n }\r\n }\r\n\r\n #onRowClicked(e, index, colIndex) {\r\n const startIndex = this.#startIndex;\r\n const selectedIndex = startIndex + index;\r\n if (typeof this.willSelect === 'function' && !this.willSelect(selectedIndex, colIndex)) {\r\n return;\r\n }\r\n // multi-select\r\n let flag = false;\r\n const selectedIndexes = this.#selectedIndexes;\r\n if (this.multiSelect) {\r\n if (e.ctrlKey) {\r\n const i = selectedIndexes.indexOf(selectedIndex);\r\n if (i < 0) {\r\n selectedIndexes.push(selectedIndex);\r\n } else {\r\n selectedIndexes.splice(i, 1);\r\n }\r\n flag = true;\r\n } else if (e.shiftKey && selectedIndexes.length > 0) {\r\n if (selectedIndexes.length > 1 || selectedIndexes[0] !== selectedIndex) {\r\n let start = selectedIndexes[selectedIndexes.length - 1];\r\n let end;\r\n if (start > selectedIndex) {\r\n end = start;\r\n start = selectedIndex;\r\n } else {\r\n end = selectedIndex;\r\n }\r\n selectedIndexes.splice(0);\r\n for (let i = start; i <= end; i += 1) {\r\n selectedIndexes.push(i);\r\n }\r\n flag = true;\r\n }\r\n }\r\n }\r\n if (!flag && selectedIndexes.length !== 1 || selectedIndexes[0] !== selectedIndex) {\r\n selectedIndexes.splice(0, selectedIndexes.length, selectedIndex);\r\n flag = true;\r\n }\r\n // apply style\r\n if (flag) {\r\n if (this.readonly !== true) {\r\n this.refresh();\r\n } else {\r\n [...this.#refs.bodyContent.children].forEach((row, i) => {\r\n if (selectedIndexes.indexOf(startIndex + i) >= 0) {\r\n row.classList.add('selected');\r\n } else if (row.classList.contains('selected')) {\r\n row.classList.remove('selected');\r\n }\r\n });\r\n }\r\n if (typeof this.selectedRowChanged === 'function') {\r\n this.selectedRowChanged(selectedIndex);\r\n }\r\n }\r\n this.#selectedColumnIndex = colIndex;\r\n if ((this.fullrowClick || colIndex >= 0) && e.buttons === 1 && typeof this.cellClicked === 'function') {\r\n if (this.cellClicked(selectedIndex, colIndex) === false) {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n }\r\n }\r\n }\r\n\r\n #onRowDblClicked(e) {\r\n if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA' || e.target.tagName === 'LAYER' && e.target.className === 'ui-check-inner' || e.target.tagName === 'LABEL' && (e.target.className === 'ui-drop-text' || e.target.className === 'ui-drop-caret')) {\r\n return;\r\n }\r\n const index = this.selectedIndex;\r\n if (typeof this.rowDblClicked === 'function') {\r\n this.rowDblClicked(index);\r\n }\r\n if (typeof this.cellDblClicked === 'function') {\r\n const colIndex = this.#selectedColumnIndex;\r\n if (this.fullrowClick || colIndex >= 0) {\r\n this.cellDblClicked(index, colIndex);\r\n }\r\n }\r\n }\r\n\r\n #onRowChanged(_e, index, col, value, cell, blur) {\r\n if (this.#currentSource == null) {\r\n return;\r\n }\r\n const row = this.#currentSource[this.#startIndex + index];\r\n const item = row.values;\r\n if (item == null) {\r\n return;\r\n }\r\n let enabled = col.enabled;\r\n if (typeof enabled === 'function') {\r\n enabled = enabled.call(col, item);\r\n } else if (typeof enabled === 'string') {\r\n enabled = item[enabled];\r\n }\r\n if (enabled !== false) {\r\n item[col.key] = value;\r\n let tip = col.tooltip;\r\n if (typeof tip === 'function') {\r\n tip = tip.call(col, item);\r\n }\r\n if (nullOrEmpty(tip)) {\r\n cell.querySelector('.ui-tooltip-wrapper')?.remove();\r\n } else {\r\n setTooltip(cell.children[0], tip, false, this.element);\r\n }\r\n row.__changed = true;\r\n if (blur) {\r\n if (typeof col.oneditend === 'function') {\r\n col.oneditend.call(this, item, value);\r\n }\r\n } else {\r\n if (typeof col.onchanged === 'function') {\r\n col.onchanged.call(this, item, value);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default Grid;","import \"./css/popup.scss\";\r\nimport { r } from \"../utility/lgres\";\r\nimport { nullOrEmpty } from \"../utility/strings\";\r\nimport { global } from \"../utility\";\r\nimport { createElement } from \"../functions\";\r\nimport { createIcon, changeIcon } from \"./icon\";\r\n\r\nconst ResizeMods = {\r\n right: 1,\r\n bottom: 2,\r\n left: 4,\r\n top: 8,\r\n bottomRight: 2 | 1,\r\n bottomLeft: 2 | 4,\r\n topRight: 8 | 1,\r\n topLeft: 8 | 4\r\n}\r\n\r\n// const Cursors = {\r\n// [ResizeMods.right]: 'ew-resize',\r\n// [ResizeMods.bottom]: 'ns-resize',\r\n// [ResizeMods.bottomRight]: 'nwse-resize',\r\n// [ResizeMods.left]: 'ew-resize',\r\n// [ResizeMods.bottomLeft]: 'nesw-resize',\r\n// [ResizeMods.top]: 'ns-resize',\r\n// [ResizeMods.topRight]: 'nesw-resize',\r\n// [ResizeMods.topLeft]: 'nwse-resize'\r\n// }\r\n\r\nfunction trimPx(px) {\r\n if (typeof px !== 'string') {\r\n return px;\r\n }\r\n if (px.endsWith('px')) {\r\n const size = Number(px.substring(0, px.length - 2));\r\n return isNaN(size) ? px : size;\r\n }\r\n return px;\r\n}\r\n\r\nclass Popup {\r\n #mask;\r\n #option;\r\n #bounds;\r\n // #cursor;\r\n\r\n constructor(opts = {}) {\r\n this.#option = opts;\r\n }\r\n\r\n get container() { return this.#mask.querySelector('.ui-popup-container') }\r\n\r\n get rect() {\r\n const container = this.container;\r\n if (container == null) {\r\n return null;\r\n }\r\n const style = global.getComputedStyle(container);\r\n const collapsed = container.classList.contains('ui-popup-collapse');\r\n const bounds = this.#bounds;\r\n return {\r\n collapsed,\r\n left: trimPx(style.left),\r\n top: trimPx(style.top),\r\n width: collapsed === true && bounds != null ? bounds.width : trimPx(style.width),\r\n height: collapsed === true && bounds != null ? bounds.height : trimPx(style.height)\r\n };\r\n }\r\n set rect(r) {\r\n const container = this.container;\r\n if (container == null) {\r\n return;\r\n }\r\n const css = [];\r\n if (!isNaN(r.left)) {\r\n css.push(`left: ${r.left}px`);\r\n }\r\n if (!isNaN(r.top)) {\r\n css.push(`top: ${r.top}px`);\r\n }\r\n const collapse = container.querySelector('.ui-popup-header>.icon-expand');\r\n if (r.collapsed === true) {\r\n css.push('width: 160px', 'height: 40px');\r\n this.#bounds = r;\r\n container.classList.add('ui-popup-collapse');\r\n if (collapse != null) {\r\n changeIcon(collapse, 'fa-regular', 'expand-alt');\r\n }\r\n } else {\r\n if (!isNaN(r.width) && r.width > 0) {\r\n css.push(`width: ${r.width}px`);\r\n }\r\n if (!isNaN(r.height) && r.height > 0) {\r\n css.push(`height: ${r.height}px`);\r\n }\r\n container.classList.remove('ui-popup-collapse');\r\n this.#bounds = null;\r\n if (collapse != null) {\r\n changeIcon(collapse, 'fa-regular', 'compress-alt');\r\n }\r\n }\r\n if (css.length > 0) {\r\n container.style.cssText += css.join('; ');\r\n }\r\n }\r\n\r\n close(animation = true) {\r\n const mask = this.#mask;\r\n if (animation) {\r\n mask.classList.add('ui-popup-active');\r\n mask.style.opacity = 0;\r\n setTimeout(() => { mask.remove(); }, 120);\r\n } else {\r\n mask.remove();\r\n }\r\n if (typeof this.#option.onMasking === 'function') {\r\n this.#option.onMasking.call(this, false);\r\n }\r\n }\r\n\r\n create() {\r\n const mask = createElement('div', 'ui-popup-mask');\r\n const option = this.#option;\r\n if (option.mask === false) {\r\n mask.classList.add('ui-popup-transparent');\r\n } else if (typeof option.onMasking === 'function') {\r\n this.#option.onMasking.call(this, true);\r\n }\r\n if (!isNaN(option.zIndex)) {\r\n mask.style.zIndex = String(option.zIndex);\r\n }\r\n const container = createElement('div', 'ui-popup-container');\r\n if (option.changeZIndex === true) {\r\n container.addEventListener('mousedown', () => {\r\n const masks = [...this.#mask.parentElement.children].filter(e => e.classList.contains('ui-popup-mask'));\r\n let max = 200;\r\n masks.forEach(m => {\r\n let index;\r\n if (m.dataset.zindex != null) {\r\n index = parseInt(m.dataset.zindex);\r\n m.style.zIndex = isNaN(index) ? '' : String(index);\r\n delete m.dataset.zindex;\r\n } else {\r\n index = parseInt(m.style.zIndex);\r\n }\r\n if (index > max) {\r\n max = index;\r\n }\r\n });\r\n mask.dataset.zindex = mask.style.zIndex;\r\n mask.style.zIndex = max + 1;\r\n });\r\n }\r\n let tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0));\r\n if (tabIndex < 0) {\r\n tabIndex = 0;\r\n }\r\n container.tabIndex = tabIndex + 1;\r\n let content = option.content;\r\n if (!(content instanceof HTMLElement)) {\r\n content = createElement('div', d => d.innerText = content);\r\n }\r\n container.append(\r\n createElement('div', header => {\r\n header.className = 'ui-popup-header';\r\n let title = option.title;\r\n if (!(title instanceof HTMLElement)) {\r\n title = createElement('div', t => {\r\n t.className = 'ui-popup-header-title';\r\n t.innerText = title;\r\n });\r\n }\r\n header.appendChild(title);\r\n if (option.movable !== false) {\r\n const move = title.querySelector('.ui-popup-move') ?? title;\r\n move.addEventListener('mousedown', e => {\r\n if (e.buttons !== 1) {\r\n return;\r\n }\r\n const x = e.clientX - container.offsetLeft;\r\n const y = e.clientY - container.offsetTop;\r\n let moved;\r\n const move = e => {\r\n if (e.buttons === 1) {\r\n container.style.left = `${e.clientX - x}px`;\r\n container.style.top = `${e.clientY - y}px`;\r\n moved = true;\r\n } else {\r\n mask.dispatchEvent(new MouseEvent('mouseup'));\r\n }\r\n };\r\n mask.addEventListener('mousemove', move, { passive: false });\r\n const up = () => {\r\n mask.removeEventListener('mousemove', move, { passive: false });\r\n mask.removeEventListener('mouseup', up);\r\n if (moved === true && typeof option.onMoveEnded === 'function') {\r\n option.onMoveEnded.call(this);\r\n }\r\n moved = false;\r\n };\r\n mask.addEventListener('mouseup', up);\r\n });\r\n }\r\n if (option.collapsable === true) {\r\n const collapse = createIcon('fa-regular', 'compress-alt');\r\n collapse.tabIndex = tabIndex + 2;\r\n collapse.classList.add('icon-expand');\r\n collapse.addEventListener('keypress', e => {\r\n if (e.key === ' ' || e.key === 'Enter') {\r\n collapse.dispatchEvent(new MouseEvent('click'));\r\n }\r\n });\r\n collapse.addEventListener('click', () => {\r\n if (container.classList.contains('ui-popup-collapse')) {\r\n const bounds = this.#bounds;\r\n if (bounds != null) {\r\n container.style.cssText += `width: ${bounds.width}px; height: ${bounds.height}px`;\r\n this.#bounds = null;\r\n }\r\n container.classList.remove('ui-popup-collapse');\r\n changeIcon(collapse, 'fa-regular', 'compress-alt');\r\n } else {\r\n const rect = this.rect;\r\n this.#bounds = rect;\r\n container.style.cssText += `width: 160px; height: 40px`;\r\n container.classList.add('ui-popup-collapse');\r\n changeIcon(collapse, 'fa-regular', 'expand-alt');\r\n }\r\n if (typeof option.onResizeEnded === 'function') {\r\n option.onResizeEnded.call(this);\r\n }\r\n });\r\n header.appendChild(collapse);\r\n }\r\n const cancel = createIcon('fa-regular', 'times');\r\n cancel.tabIndex = tabIndex + 3;\r\n cancel.addEventListener('keypress', e => {\r\n if (e.key === ' ' || e.key === 'Enter') {\r\n this.close();\r\n }\r\n });\r\n cancel.addEventListener('click', () => this.close());\r\n header.appendChild(cancel);\r\n }),\r\n createElement('div', 'ui-popup-body', content, createElement('div', 'ui-popup-loading',\r\n createElement('div', null, createIcon('fa-regular', 'spinner-third'))\r\n ))\r\n );\r\n if (Array.isArray(option.buttons) && option.buttons.length > 0) {\r\n tabIndex = Math.max.apply(null, [...container.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0));\r\n container.appendChild(\r\n createElement('div', 'ui-popup-footer', ...option.buttons.map((b, i) => {\r\n const button = createElement('button', 'ui-popup-button');\r\n if (b.tabIndex > 0) {\r\n button.tabIndex = b.tabIndex;\r\n } else {\r\n button.tabIndex = tabIndex + i + 1;\r\n }\r\n button.innerText = b.text;\r\n button.addEventListener('click', () => {\r\n if (typeof b.trigger === 'function') {\r\n const result = b.trigger(this);\r\n if (typeof result?.then === 'function') {\r\n result.then(r => {\r\n if (r !== false) {\r\n this.close();\r\n }\r\n }).catch(reason => console.warn(reason));\r\n } else if (result !== false) {\r\n this.close();\r\n }\r\n } else {\r\n this.close();\r\n }\r\n });\r\n return button;\r\n }))\r\n );\r\n const tabs = [...container.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0);\r\n const tabMin = Math.min.apply(null, tabs);\r\n const tabMax = Math.max.apply(null, tabs);\r\n const last = container.querySelector(`[tabindex=\"${tabMax}\"]`);\r\n if (last != null) {\r\n last.addEventListener('keydown', e => {\r\n if (e.key === 'Tab') {\r\n const first = container.querySelector(`[tabindex=\"${tabMin}\"]`);\r\n first?.focus();\r\n e.preventDefault();\r\n }\r\n });\r\n }\r\n } else {\r\n container.querySelector('.ui-popup-body>.ui-popup-loading').classList.add('ui-popup-loading-content');\r\n }\r\n // resizable\r\n if (option.resizable === true) {\r\n container.append(\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-right';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.right, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-bottom';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.bottom, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-left';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.left, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-top';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.top, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-bottom-right';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.bottomRight, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-bottom-left';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.bottomLeft, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-top-left';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.topLeft, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-top-right';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.topRight, e));\r\n })\r\n )\r\n }\r\n mask.appendChild(container);\r\n this.#mask = mask;\r\n return mask;\r\n }\r\n\r\n show(parent = document.body) {\r\n if (parent == null) {\r\n return;\r\n }\r\n let mask = this.#mask ?? this.create();\r\n const exists = [...parent.children].filter(e => e.classList.contains('ui-popup-mask'));\r\n let zindex = 0;\r\n for (let ex of exists) {\r\n let z = parseInt(ex.style.zIndex);\r\n if (!isNaN(z) && z > zindex) {\r\n zindex = z;\r\n }\r\n }\r\n if (zindex > 0) {\r\n mask.style.zIndex = String(zindex + 1);\r\n }\r\n parent.appendChild(mask);\r\n if (this.#option.mask === false) {\r\n // calculator position\r\n const container = this.container;\r\n container.style.left = String((parent.offsetWidth - container.offsetWidth) / 2) + 'px';\r\n container.style.top = String((parent.offsetHeight - container.offsetHeight) / 2) + 'px';\r\n }\r\n return new Promise(resolve => {\r\n setTimeout(() => {\r\n mask.style.opacity = 1;\r\n this.container.focus();\r\n resolve(mask);\r\n }, 0);\r\n });\r\n }\r\n\r\n get loading() { return this.#mask?.querySelector('.ui-popup-body>.ui-popup-loading')?.style?.visibility === 'visible' }\r\n set loading(flag) {\r\n let loading = this.#mask?.querySelector('.ui-popup-body>.ui-popup-loading');\r\n if (loading == null) {\r\n return;\r\n }\r\n if (flag === false) {\r\n loading.style.visibility = 'hidden';\r\n loading.style.opacity = 0;\r\n } else {\r\n loading.style.visibility = 'visible';\r\n loading.style.opacity = 1;\r\n }\r\n }\r\n\r\n #resize(mod, e) {\r\n if (e.buttons !== 1) {\r\n return;\r\n }\r\n const container = this.container;\r\n const option = this.#option;\r\n if (typeof option.onResizeStarted === 'function') {\r\n option.onResizeStarted.call(this);\r\n }\r\n const mask = this.#mask;\r\n // this.#cursor = mask.style.cursor;\r\n // mask.style.cursor = Cursors[mod];\r\n const originalX = e.clientX;\r\n const originalY = e.clientY;\r\n const original = {\r\n width: container.offsetWidth,\r\n height: container.offsetHeight,\r\n left: container.offsetLeft,\r\n top: container.offsetTop\r\n };\r\n const minWidth = option.minWidth ?? 200;\r\n const minHeight = option.minHeight ?? 200;\r\n let resized;\r\n const parent = option.mask === false ? mask.parentElement : mask;\r\n const move = e => {\r\n if (e.buttons !== 1) {\r\n parent.dispatchEvent(new MouseEvent('mouseup'));\r\n return;\r\n }\r\n const offsetX = e.clientX - originalX;\r\n const offsetY = e.clientY - originalY;\r\n let width = original.width;\r\n let height = original.height;\r\n let x = original.left;\r\n let y = original.top;\r\n if ((mod & ResizeMods.right) === ResizeMods.right) {\r\n width += offsetX;\r\n if (width < minWidth) {\r\n width = minWidth;\r\n }\r\n }\r\n if ((mod & ResizeMods.bottom) === ResizeMods.bottom) {\r\n height += offsetY;\r\n if (height < minHeight) {\r\n height = minHeight;\r\n }\r\n }\r\n if ((mod & ResizeMods.left) === ResizeMods.left) {\r\n width -= offsetX;\r\n if (width < minWidth) {\r\n width = minWidth;\r\n x = originalX + original.width - minWidth;\r\n } else {\r\n x += offsetX;\r\n }\r\n }\r\n if ((mod & ResizeMods.top) === ResizeMods.top) {\r\n height -= offsetY;\r\n if (height < minHeight) {\r\n height = minHeight;\r\n y = originalY + original.height - minHeight;\r\n } else {\r\n y += offsetY;\r\n }\r\n }\r\n if (typeof option.onResizing === 'function') {\r\n option.onResizing.call(this, x, y, width, height);\r\n } else {\r\n container.style.cssText += `left: ${x}px; top: ${y}px; width: ${width}px; height: ${height}px`;\r\n }\r\n resized = true;\r\n }\r\n parent.addEventListener('mousemove', move, { passive: false });\r\n const up = () => {\r\n parent.removeEventListener('mousemove', move, { passive: false });\r\n parent.removeEventListener('mouseup', up);\r\n // mask.style.cursor = this.#cursor;\r\n if (resized === true && typeof option.onResizeEnded === 'function') {\r\n option.onResizeEnded.call(this);\r\n }\r\n resized = false;\r\n };\r\n parent.addEventListener('mouseup', up);\r\n }\r\n}\r\n\r\nexport default Popup;\r\n\r\nexport function createPopup(title, content, ...buttons) {\r\n const popup = new Popup({\r\n title,\r\n content,\r\n buttons\r\n });\r\n return popup;\r\n}\r\n\r\nconst iconTypes = {\r\n 'info': 'info-circle',\r\n 'information': 'info-circle',\r\n 'warn': 'exclamation-triangle',\r\n 'warning': 'exclamation-triangle',\r\n 'question': 'question-circle',\r\n 'error': 'times-circle'\r\n}\r\n\r\nexport function showAlert(title, message, iconType = 'info', parent = document.body) {\r\n return new Promise(resolve => {\r\n const popup = new Popup({\r\n title,\r\n content: createElement('div', 'message-wrapper',\r\n createIcon('fa-solid', iconTypes[iconType] ?? 'info-circle'),\r\n createElement('span', span => span.innerText = message)\r\n ),\r\n buttons: [\r\n { text: r('ok', 'OK'), trigger: resolve }\r\n ]\r\n });\r\n popup.show(parent).then(mask => {\r\n const button = mask.querySelector('.ui-popup-container .ui-popup-footer .ui-popup-button:last-child');\r\n button?.focus();\r\n });\r\n });\r\n}\r\n\r\nexport function showConfirm(title, content, buttons, iconType = 'question', parent = document.body) {\r\n return new Promise(resolve => {\r\n const wrapper = createElement('div', 'message-wrapper');\r\n if (!nullOrEmpty(iconType)) {\r\n wrapper.appendChild(createIcon('fa-solid', iconTypes[iconType] ?? 'question-circle'));\r\n }\r\n wrapper.appendChild(content instanceof HTMLElement ?\r\n content :\r\n createElement('span', span => span.innerText = content));\r\n const popup = new Popup({\r\n title,\r\n content: wrapper,\r\n buttons: buttons?.map(b => {\r\n return {\r\n text: b.text,\r\n trigger: p => {\r\n let result;\r\n if (typeof b.trigger === 'function') {\r\n result = b.trigger(p, b);\r\n if (typeof result?.then === 'function') {\r\n return result.then(r => {\r\n r !== false && resolve(r);\r\n return r;\r\n });\r\n }\r\n result !== false && resolve(result);\r\n } else {\r\n result = {\r\n key: b.key,\r\n popup: p\r\n };\r\n resolve(result);\r\n }\r\n return result;\r\n }\r\n };\r\n }) ??\r\n [\r\n { text: r('yes', 'Yes'), trigger: p => resolve({ key: 'yes', popup: p }) },\r\n { text: r('no', 'No'), trigger: p => resolve({ key: 'no', popup: p }) }\r\n ]\r\n });\r\n popup.show(parent).then(mask => {\r\n const button = mask.querySelector('.ui-popup-container .ui-popup-footer .ui-popup-button:last-child');\r\n button?.focus();\r\n });\r\n });\r\n}"],"names":["createElement","tagName","init","children","element","svgns","createUse","type","id","c","path","ver","use","changeIcon","svg","createIcon","style","css","resolveIcon","container","svgs","icon","fillCheckbox","label","tabindex","charactor","layer","e","input","span","createRadiobox","opts","entry","createCheckbox","resolveCheckbox","legacy","checks","chk","text","boxes","box","setTooltip","content","flag","parent","isParent","tipid","tip","wrapper","cnt","tipId","tid","p","left","top","offsetParent","resolveTooltip","tips","title","nullOrEmpty","s","contains","key","ignoreCase","r","defaultValue","g","isPositive","n","isMobile","throttle","method","delay","context","args","current","truncate","v","SymbolDropdown","DropdownTitleHeight","DropdownItemHeight","dropdownGlobal","global","panel","dropId","dropdown","selectItems","itemlist","htmlkey","textkey","htmls","it","filterSource","searchkeys","source","k","_Dropdown","options","__privateAdd","_expanded","_dropdown","_filllist","_triggerselect","_options","_wrapper","_container","_label","_allChecked","_source","_lastSelected","_selected","_selectedList","__publicField","__privateSet","__privateGet","header","up","down","count","valuekey","index","target","_a","__privateMethod","dropdown_fn","active","expanded_get","filllist_fn","list","selected","silence","item","expanded","li","html","val","selectedlist","dom","selects","sel","drop","Dropdown","_b","search","value","multiselect","allchecked","triggerselect_fn","scrolled","i","checkbox","GridColumn","enabled","tooltip","GridInputColumn","trigger","col","_parent","vals","GridTextColumn","_item","_col","grid","lines","_GridDropdownColumn","_getSource","getSource_fn","_setValue","setValue_fn","_getDrop","getDrop_fn","GridDropdownColumn","dropGlobal","data","__superGet","GridCheckboxColumn","GridIconColumn","className","ColumnChangedType","RefreshInterval","HoverInternal","RedumCount","MiniDragOffset","MiniColumnWidth","FilterPanelWidth","getClientX","getOffsetLeftFromWindow","indexOfParent","ColumnTypes","_Grid","_refreshSource","_createHeader","_createBody","_adjustRows","_fillRows","_changeColumnWidth","_changingColumnOrder","_changeColumnOrder","_scrollToTop","_get","_set","_getItemValue","_getRowTarget","_notHeader","_onHeaderClicked","_onCloseFilter","_onFilter","_fillFilterList","_doFillFilterList","_onFilterScroll","_onDragStart","_onResizeStart","_onAutoResize","_onColumnAllChecked","_onScroll","_onBodyMouseMove","_onRowClicked","_onRowDblClicked","_onRowChanged","_currentSource","_el","_refs","_rendering","_selectedColumnIndex","_selectedIndexes","_startIndex","_needResize","_containerHeight","_bodyClientWidth","_rowCount","_scrollTop","_scrollLeft","_colTypes","_colAttrs","_vtable","refreshSource_fn","indexes","startIndex","row","sizer","createHeader_fn","body","createBody_fn","loading","scrollToTop_fn","force","height","length","adjustRows_fn","rows","widths","fillRows_fn","get_fn","width","changeColumnWidth_fn","reload","direction","th","arrow","comparer","a","b","getItemValue_fn","Grid","thead","hidden","onHeaderClicked_fn","isCheckbox","set_fn","w","onDragStart_fn","check","onColumnAllChecked_fn","caption","filter","onFilter_fn","spliter","onResizeStart_fn","onAutoResize_fn","dragger","draggerCursor","onScroll_fn","cols","bodyContainer","bodyContent","getRowTarget_fn","rowIndex","colIndex","onRowClicked_fn","onRowDblClicked_fn","holder","onBodyMouseMove_fn","exists","j","cell","onRowChanged_fn","selectedIndexes","selectChanged","bgColor","ev","attrs","attr","changingColumnOrder_fn","offset","x","offsetLeft","idx","changeColumnOrder_fn","orderIndex","targetIndex","columns","rowHeight","bottomTop","name","notHeader_fn","onCloseFilter_fn","panels","el","filtering","close","searchbox","searchholder","searchicon","onFilterScroll_fn","itemall","checked","array","dict","fillFilterList_fn","items","displayValue","functions","ok","reset","all","doFillFilterList_fn","div","cx","clearEvents","event","dragmove","cx2","pos","dragging","window","resizemove","isFunction","isString","maxleft","selectedIndex","start","end","_e","blur","ResizeMods","trimPx","px","size","Popup","_resize","_mask","_option","_bounds","collapsed","bounds","collapse","animation","mask","option","masks","max","m","tabIndex","d","t","y","moved","move","rect","cancel","button","result","reason","tabs","tabMin","tabMax","last","first","resize_fn","zindex","ex","z","resolve","_c","mod","originalX","originalY","original","minWidth","minHeight","resized","offsetX","offsetY","createPopup","buttons","iconTypes","showAlert","message","iconType","showConfirm"],"mappings":"opCAAO,SAASA,EAAcC,EAASC,KAASC,EAAU,CACtD,MAAMC,EAAU,SAAS,cAAcH,CAAO,EAC9C,OAAI,OAAOC,GAAS,WAChBA,EAAKE,CAAO,EACLF,GAAQ,OACfE,EAAQ,UAAYF,GAEpBC,EAAS,OAAS,GAClBC,EAAQ,OAAO,GAAGD,CAAQ,EAEvBC,CACX,CCXA,MAAMC,GAAQ,6BAEd,SAASC,GAAUC,EAAMC,EAAI,CACzB,MAAMC,EAAI,OAAO,OAAW,IAAc,OAAS,CAAA,EAC7CC,EAAOD,EAAE,MAAQ,GACjBE,EAAMF,EAAE,QAAU,KAAO,GAAK,IAAIA,EAAE,SACpCG,EAAM,SAAS,gBAAgBP,GAAO,KAAK,EACjD,OAAAO,EAAI,eAAe,+BAAgC,aAAc,GAAGF,UAAaH,QAAWI,KAAOH,GAAI,EAChGI,CACX,CAEA,SAASC,GAAWC,EAAKP,EAAMC,EAAI,CAC/B,OAAIM,aAAe,YACfA,EAAI,gBAAgBR,GAAUC,EAAMC,CAAE,CAAC,EAEpCM,CACX,CAEA,SAASC,EAAWR,EAAMC,EAAIQ,EAAO,CACjC,MAAMF,EAAM,SAAS,gBAAgBT,GAAO,KAAK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OA,EAAO,KAAK7T,IACfA,IAAM,IAASwU,EAAQxU,CAAC,EACjBA,EACV,EAEL6T,IAAW,IAASW,EAAQX,CAAM,OAElCA,EAAS,CACL,IAAKxH,EAAE,IACP,MAAOjN,CACvC,EAC4BoV,EAAQX,CAAM,EAElB,OAAOA,CACV,CACrB,MAEgB,CACI,CAAE,KAAM7T,EAAE,MAAO,KAAK,EAAG,QAASZ,GAAKoV,EAAQ,CAAE,IAAK,MAAO,MAAOpV,CAAG,CAAA,CAAG,EAC1E,CAAE,KAAMY,EAAE,KAAM,IAAI,EAAG,QAASZ,GAAKoV,EAAQ,CAAE,IAAK,KAAM,MAAOpV,CAAG,CAAA,CAAG,CAC1E,CACjB,CAAS,EACK,KAAKR,CAAM,EAAE,KAAKmU,GAAQ,CAC5B,MAAMa,EAASb,EAAK,cAAc,kEAAkE,EACpGa,GAAA,MAAAA,EAAQ,OACpB,CAAS,CACT,CAAK,CACL"} \ No newline at end of file +{"version":3,"file":"ui.min.js","sources":["../lib/functions.js","../lib/ui/icon.js","../lib/ui/checkbox.js","../lib/ui/tooltip.js","../lib/utility/strings.js","../lib/utility/lgres.js","../lib/utility.js","../lib/ui/dropdown.js","../lib/ui/grid/column.js","../lib/ui/grid/grid.js","../lib/ui/popup.js"],"sourcesContent":["export function createElement(tagName, init, ...children) {\r\n const element = document.createElement(tagName);\r\n if (typeof init === 'function') {\r\n init(element);\r\n } else if (init != null) {\r\n element.className = init;\r\n }\r\n if (children.length > 0) {\r\n element.append(...children);\r\n }\r\n return element;\r\n}\r\n","const svgns = 'http://www.w3.org/2000/svg';\r\n\r\nfunction createUse(type, id) {\r\n const c = typeof consts !== 'undefined' ? consts : {};\r\n const path = c.path || '';\r\n const ver = c.resver == null ? '' : `?${c.resver}`;\r\n const use = document.createElementNS(svgns, 'use');\r\n use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', `${path}fonts/${type}.svg${ver}#${id}`);\r\n return use;\r\n}\r\n\r\nfunction changeIcon(svg, type, id) {\r\n if (svg instanceof SVGElement) {\r\n svg.replaceChildren(createUse(type, id));\r\n }\r\n return svg;\r\n}\r\n\r\nfunction createIcon(type, id, style) {\r\n const svg = document.createElementNS(svgns, 'svg');\r\n svg.appendChild(createUse(type, id));\r\n if (style != null) {\r\n for (let css of Object.entries(style)) {\r\n svg.style.setProperty(css[0], css[1]);\r\n }\r\n }\r\n return svg;\r\n}\r\n\r\nfunction resolveIcon(container) {\r\n const svgs = container.querySelectorAll('svg[data-id]');\r\n for (let icon of svgs) {\r\n const type = icon.dataset.type;\r\n const id = icon.dataset.id;\r\n icon.replaceChildren(createUse(type, id));\r\n icon.removeAttribute('data-type');\r\n icon.removeAttribute('data-id');\r\n }\r\n return container;\r\n}\r\n\r\nexport {\r\n createIcon,\r\n changeIcon,\r\n resolveIcon\r\n}","import './css/checkbox.scss';\r\nimport { createElement } from \"../functions\";\r\nimport { createIcon } from \"./icon\";\r\n\r\nfunction fillCheckbox(container, type = 'fa-regular', label, tabindex = -1, charactor = 'check') {\r\n container.appendChild(\r\n createElement('layer', layer => {\r\n layer.className = 'ui-check-inner';\r\n layer.addEventListener('keypress', e => {\r\n if (e.key === ' ' || e.key === 'Enter') {\r\n const input = container.querySelector('input');\r\n if (input != null) {\r\n input.checked = !input.checked;\r\n input.dispatchEvent(new Event('change'));\r\n }\r\n }\r\n });\r\n if (tabindex >= 0) {\r\n layer.tabIndex = tabindex;\r\n }\r\n }, createIcon(type, charactor))\r\n );\r\n if (label instanceof Element) {\r\n container.appendChild(label);\r\n } else if (label?.length > 0) {\r\n container.appendChild(\r\n createElement('span', span => span.innerText = label)\r\n );\r\n }\r\n}\r\n\r\nfunction createRadiobox(opts = {}) {\r\n const container = createElement('label', 'ui-check-wrapper ui-radio-wrapper',\r\n createElement('input', input => {\r\n input.setAttribute('type', 'radio');\r\n input.name = opts.name;\r\n if (opts.checked === true) {\r\n input.checked = true;\r\n }\r\n if (opts.enabled === false) {\r\n input.disabled = true;\r\n }\r\n if (opts.customerAttributes != null) {\r\n for (let entry of Object.entries(opts.customerAttributes)) {\r\n input.setAttribute(entry[0], entry[1]);\r\n }\r\n }\r\n if (typeof opts.onchange === 'function') {\r\n input.addEventListener('change', opts.onchange);\r\n }\r\n }));\r\n if (opts.className) {\r\n container.classList.add(opts.className);\r\n }\r\n fillCheckbox(container, opts.type, opts.label, opts.tabIndex, 'circle');\r\n return container;\r\n}\r\n\r\nfunction createCheckbox(opts = {}) {\r\n const container = createElement('label', 'ui-check-wrapper',\r\n createElement('input', input => {\r\n input.setAttribute('type', 'checkbox');\r\n if (opts.checked === true) {\r\n input.checked = true;\r\n }\r\n if (opts.enabled === false) {\r\n input.disabled = true;\r\n }\r\n if (opts.customerAttributes != null) {\r\n for (let entry of Object.entries(opts.customerAttributes)) {\r\n input.setAttribute(entry[0], entry[1]);\r\n }\r\n }\r\n if (typeof opts.onchange === 'function') {\r\n input.addEventListener('change', opts.onchange);\r\n }\r\n }));\r\n if (opts.className) {\r\n container.classList.add(opts.className);\r\n }\r\n if (opts.enabled === false) {\r\n container.classList.add('disabled');\r\n }\r\n if (opts.checkedNode != null && opts.uncheckedNode != null) {\r\n container.classList.add('ui-check-image-wrapper');\r\n let height = opts.imageHeight;\r\n if (isNaN(height) || height <= 0) {\r\n height = 14;\r\n }\r\n opts.checkedNode.classList.add('checked');\r\n container.appendChild(opts.checkedNode);\r\n opts.uncheckedNode.classList.add('unchecked');\r\n container.appendChild(opts.uncheckedNode);\r\n } else {\r\n fillCheckbox(container, opts.type, opts.label, opts.tabIndex);\r\n }\r\n return container;\r\n}\r\n\r\nfunction resolveCheckbox(container = document.body, legacy) {\r\n if (legacy) {\r\n const checks = container.querySelectorAll('input[type=\"checkbox\"]');\r\n for (let chk of checks) {\r\n if (chk.parentElement.classList.contains('ui-check-wrapper')) {\r\n // skip\r\n continue;\r\n }\r\n const id = chk.id;\r\n let label, text;\r\n if (id != null) {\r\n label = container.querySelector(`label[for=\"${id}\"]`);\r\n }\r\n if (label == null) {\r\n const e = chk.nextElementSibling;\r\n if (e != null) {\r\n if (e.tagName === 'LABEL') {\r\n label = e;\r\n } else if (e.tagName === 'SPAN' && e.dataset.lgid != null) {\r\n text = e.innerText;\r\n e.style.display = 'none';\r\n }\r\n }\r\n }\r\n if (label == null) {\r\n const e = chk.previousElementSibling;\r\n if (e != null) {\r\n if (e.tagName === 'LABEL') {\r\n label = e;\r\n } else if (text == null && e.tagName === 'SPAN' && e.dataset.lgid != null) {\r\n text = e.innerText;\r\n e.style.display = 'none';\r\n }\r\n }\r\n }\r\n if (label == null) {\r\n label = createElement('label');\r\n chk.parentElement.insertBefore(label, chk);\r\n } else {\r\n text = label.innerText;\r\n }\r\n if (chk.disabled) {\r\n label.className = 'ui-check-wrapper disabled';\r\n } else {\r\n label.className = 'ui-check-wrapper';\r\n }\r\n label.replaceChildren();\r\n fillCheckbox(label, 'fa-regular', text, chk.tabIndex);\r\n label.insertBefore(chk, label.firstChild);\r\n }\r\n }\r\n const boxes = container.querySelectorAll('label[data-checkbox]');\r\n for (let box of boxes) {\r\n if (!box.classList.contains('ui-check-wrapper')) {\r\n box.classList.add('ui-check-wrapper');\r\n }\r\n if (box.hasChildNodes()) {\r\n if (!box.classList.contains('ui-check-image-wrapper')) {\r\n box.classList.add('ui-check-image-wrapper');\r\n }\r\n } else {\r\n fillCheckbox(box,\r\n box.dataset.type,\r\n box.dataset.label,\r\n box.dataset.tabIndex)\r\n box.removeAttribute('data-type');\r\n box.removeAttribute('data-label');\r\n }\r\n const input = createElement('input');\r\n const id = box.dataset.id;\r\n if (id?.length > 0) {\r\n input.id = id;\r\n }\r\n if (box.dataset.checked != null) {\r\n input.checked = true;\r\n }\r\n input.setAttribute('type', 'checkbox');\r\n box.insertBefore(input, box.firstChild);\r\n }\r\n return container;\r\n}\r\n\r\nexport {\r\n createCheckbox,\r\n resolveCheckbox,\r\n createRadiobox\r\n}","import './css/tooltip.scss';\r\nimport { createElement } from \"../functions\";\r\n// import { global } from \"../utility\";\r\n\r\nfunction setTooltip(container, content, flag = false, parent = null) {\r\n const isParent = parent instanceof HTMLElement;\r\n if (isParent) {\r\n const tipid = container.dataset.tipId;\r\n const tip = parent.querySelector(`.ui-tooltip-wrapper[data-tip-id=\"${tipid}\"]`);\r\n tip?.remove();\r\n } else {\r\n const tip = container.querySelector('.ui-tooltip-wrapper');\r\n tip?.remove();\r\n }\r\n const wrapper = createElement('div', wrapper => {\r\n wrapper.className = 'ui-tooltip-wrapper ui-tooltip-color';\r\n wrapper.style.visibility = 'hidden';\r\n wrapper.style.opacity = 0;\r\n wrapper.style.top = '0';\r\n wrapper.style.left = '0';\r\n },\r\n createElement('div', 'ui-tooltip-pointer ui-tooltip-color'),\r\n createElement('div', 'ui-tooltip-curtain ui-tooltip-color'),\r\n createElement('div', cnt => {\r\n cnt.className = 'ui-tooltip-content';\r\n if (content instanceof Element) {\r\n cnt.appendChild(content);\r\n } else {\r\n cnt.innerText = content;\r\n }\r\n })\r\n );\r\n // container.insertAdjacentElement('afterend', wrapper);\r\n if (isParent) {\r\n const tipId = String(Math.random()).substring(2);\r\n container.dataset.tipId = tipId;\r\n wrapper.dataset.tipId = tipId;\r\n parent.appendChild(wrapper);\r\n } else {\r\n container.appendChild(wrapper);\r\n }\r\n\r\n let tid;\r\n container.addEventListener('mouseenter', () => {\r\n tid && clearTimeout(tid);\r\n let c = container;\r\n while (c?.offsetWidth == null) {\r\n c = c.parentElement;\r\n }\r\n if (c == null) {\r\n return;\r\n }\r\n if (!flag || c.scrollWidth > c.offsetWidth) {\r\n tid = setTimeout(() => {\r\n let p;\r\n let left;\r\n let top;\r\n left = c.offsetLeft;\r\n top = c.offsetTop;\r\n if (isParent) {\r\n p = c.offsetParent;\r\n while (p != null && p !== parent) {\r\n left += p.offsetLeft;\r\n top += p.offsetTop;\r\n p = p.offsetParent;\r\n }\r\n }\r\n p = c.parentElement;\r\n const offsetParent = isParent ? parent : c.offsetParent;\r\n while (p != null && p !== offsetParent) {\r\n left -= p.scrollLeft;\r\n top -= p.scrollTop;\r\n p = p.parentElement;\r\n }\r\n left += (c.offsetWidth - wrapper.offsetWidth) / 2;\r\n wrapper.style.left = `${left}px`;\r\n // check overflow\r\n let t = c.offsetTop;\r\n p = c.offsetParent;\r\n while (p != null) {\r\n const overflow = window.getComputedStyle(p).overflow;\r\n if (overflow !== 'visible') {\r\n break;\r\n }\r\n t += p.offsetTop;\r\n p = p.offsetParent;\r\n }\r\n const offsetHeight = wrapper.offsetHeight + 14;\r\n if (t + top - offsetHeight < 0) {\r\n top += c.parentElement.offsetHeight + 14;\r\n wrapper.classList.add('ui-tooltip-down');\r\n } else {\r\n top -= offsetHeight;\r\n wrapper.classList.remove('ui-tooltip-down');\r\n }\r\n wrapper.style.top = `${top}px`;\r\n wrapper.style.visibility = 'visible';\r\n wrapper.style.opacity = 1;\r\n }, 100);\r\n }\r\n });\r\n container.addEventListener('mouseleave', () => {\r\n tid && clearTimeout(tid);\r\n tid = setTimeout(() => {\r\n wrapper.style.visibility = 'hidden';\r\n wrapper.style.opacity = 0;\r\n }, 300);\r\n });\r\n return container;\r\n}\r\n\r\nfunction resolveTooltip(container = document.body) {\r\n const tips = container.querySelectorAll('[title]');\r\n for (let tip of tips) {\r\n const title = tip.getAttribute('title');\r\n if (title != null) {\r\n tip.removeAttribute('title');\r\n setTooltip(tip, title);\r\n }\r\n }\r\n return container;\r\n}\r\n\r\nexport {\r\n setTooltip,\r\n resolveTooltip\r\n}","function nullOrEmpty(s) {\r\n return s == null || typeof s !== 'string' || s.length === 0;\r\n}\r\n\r\nfunction contains(s, key, ignoreCase) {\r\n if (nullOrEmpty(s) || key == null) {\r\n return false;\r\n }\r\n if (typeof key !== 'string') {\r\n key = String(key);\r\n }\r\n if (ignoreCase) {\r\n return s.toLowerCase().indexOf(key.toLowerCase()) >= 0;\r\n }\r\n return s.indexOf(key) >= 0;\r\n}\r\n\r\nfunction endsWith(s, suffix) {\r\n if (nullOrEmpty(s) || nullOrEmpty(suffix)) {\r\n return false;\r\n }\r\n return s.indexOf(suffix) === s.length - suffix.length;\r\n}\r\n\r\nfunction padStart(s, num, char) {\r\n if (nullOrEmpty(s) || isNaN(num) || num <= s.length) {\r\n return s;\r\n }\r\n return (char ?? ' ').repeat(num - s.length);\r\n}\r\n\r\nfunction formatUrl(msg) {\r\n //const urlReg = /(https?:\\/\\/)?([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/\\w \\.-]*)*\\/?/ig;\r\n //const urlArrray = str.match(urlReg);\r\n const p = /(http|ftp|https):\\/\\/.+?(\\s|\\r\\n|\\r|\\n|\\\"|\\'|\\*|$)/g;\r\n const r = msg.match(p);\r\n msg = escapeHtml(msg);\r\n\r\n if (r?.length > 0) {\r\n const rs = [];\r\n for (let t of r) {\r\n t = t.replace(/[\"'\\r\\n ]/g, '');\r\n if (rs.indexOf(t) < 0) {\r\n rs.push(t);\r\n }\r\n }\r\n\r\n for (let r of rs) {\r\n msg = msg.replaceAll(r, '');\r\n }\r\n }\r\n\r\n return msg;\r\n}\r\n\r\nfunction escapeHtml(text) {\r\n if (text == null) {\r\n return '';\r\n }\r\n return String(text)\r\n .replaceAll('&', '&')\r\n .replaceAll('<', '<')\r\n .replaceAll('>', '>')\r\n .replaceAll('\\r\\n', '
')\r\n .replaceAll('\\n', '
')\r\n .replaceAll(' ', ' ');\r\n}\r\n\r\nexport {\r\n nullOrEmpty,\r\n contains,\r\n endsWith,\r\n padStart,\r\n formatUrl,\r\n escapeHtml\r\n}","import { getCookie } from \"./cookie\";\r\nimport { get } from \"./request\";\r\nimport { nullOrEmpty } from \"./strings\";\r\n\r\nlet cache;\r\n\r\nfunction getCurrentLgId() {\r\n let lgid;\r\n if (typeof consts !== 'undefined') {\r\n lgid = getCookie(consts.cookie?.lang);\r\n if (nullOrEmpty(lgid)) {\r\n lgid = consts.user?.language;\r\n }\r\n }\r\n if (nullOrEmpty(lgid)) {\r\n lgid = getCookie('lgid');\r\n }\r\n if (nullOrEmpty(lgid)) {\r\n lgid = navigator.language || 'en-us';\r\n }\r\n lgid = lgid.toLowerCase().replace(/-/g, '_');\r\n if (nullOrEmpty(lgid)) {\r\n lgid = 'en';\r\n }\r\n switch (lgid) {\r\n case 'en':\r\n case 'en_au':\r\n case 'fr':\r\n case 'zh_cn':\r\n return lgid;\r\n }\r\n const lang = lgid.split('_')[0];\r\n switch (lang) {\r\n case 'en':\r\n case 'fr':\r\n return lang;\r\n }\r\n return 'en';\r\n}\r\n\r\nfunction getStorageKey(lgid) {\r\n if (typeof consts !== 'undefined') {\r\n return (consts.prefix || '') + `res_${lgid}`;\r\n }\r\n return `res_${lgid}`;\r\n}\r\n\r\nasync function doRefreshLgres(template = '') {\r\n const lgid = getCurrentLgId();\r\n const r = await get(`language/${lgid}${template}`);\r\n const dict = await r.json();\r\n localStorage.setItem(getStorageKey(lgid), JSON.stringify(dict));\r\n return dict;\r\n}\r\n\r\nasync function refreshLgres(template, lgres) {\r\n if (lgres == null || typeof consts === 'undefined') {\r\n lgres = await doRefreshLgres(template);\r\n }\r\n const ver = Number(consts.resver);\r\n if (isNaN(lgres.ver) || isNaN(ver) || ver > lgres.ver) {\r\n console.log(`found new language res version: ${lgres.ver} => ${ver}`);\r\n lgres = await doRefreshLgres(template);\r\n }\r\n Object.defineProperty(lgres, 'r', {\r\n writable: false,\r\n configurable: false,\r\n enumerable: false,\r\n value: function (key, defaultValue) {\r\n return getLanguage(this, key, defaultValue);\r\n }\r\n });\r\n cache = lgres;\r\n return lgres;\r\n}\r\n\r\nfunction getLanguage(lgres, key, defaultValue) {\r\n let value = lgres[key];\r\n return value ?? defaultValue;\r\n}\r\n\r\nfunction applyLanguage(dom, result) {\r\n for (let text of dom.querySelectorAll('[data-lgid]')) {\r\n const key = text.dataset.lgid;\r\n if (text.tagName === 'INPUT') {\r\n text.value = getLanguage(result, key, text.value);\r\n } else {\r\n text.innerText = getLanguage(result, key, text.innerText);\r\n }\r\n }\r\n for (let title of dom.querySelectorAll('[data-title-lgid]')) {\r\n const key = title.dataset.titleLgid;\r\n title.setAttribute('title', getLanguage(result, key, title.getAttribute('title')));\r\n }\r\n for (let holder of dom.querySelectorAll('[data-placeholder-lgid]')) {\r\n const key = holder.dataset.placeholderLgid;\r\n holder.setAttribute('placeholder', getLanguage(result, key, holder.getAttribute('placeholder')));\r\n }\r\n}\r\n\r\nasync function init(dom = document.body, options = {}) {\r\n const lgid = getCurrentLgId();\r\n let lgres = localStorage.getItem(getStorageKey(lgid));\r\n let result;\r\n if (lgres != null) {\r\n try {\r\n lgres = JSON.parse(lgres);\r\n result = await refreshLgres(options.template, lgres);\r\n } catch (e) {\r\n console.error('error while parsing lgres, try refresh ...', e);\r\n result = await refreshLgres(options.template);\r\n }\r\n } else {\r\n result = await refreshLgres(options.template);\r\n }\r\n\r\n try {\r\n if (document.readyState === 'loading') {\r\n return await new Promise((resolve, reject) => {\r\n let tid = setTimeout(() => reject('timeout'), 30000);\r\n document.addEventListener('DOMContentLoaded', () => {\r\n clearTimeout(tid);\r\n tid = void 0;\r\n if (typeof options.callback === 'function') {\r\n options.callback(result);\r\n }\r\n applyLanguage(dom, result);\r\n resolve(result);\r\n });\r\n });\r\n }\r\n if (typeof options.callback === 'function') {\r\n options.callback(result);\r\n }\r\n applyLanguage(dom, result);\r\n return result;\r\n } catch (err) {\r\n console.error('error while loading language res ...', err);\r\n }\r\n}\r\n\r\nfunction r(key, defaultValue) {\r\n if (cache != null) {\r\n return getLanguage(cache, key, defaultValue);\r\n }\r\n return defaultValue;\r\n}\r\n\r\nconst lang = {\r\n get current() {\r\n return getCurrentLgId();\r\n },\r\n get unknownError() {\r\n return r('unknownError', 'An unknown error occurred, please contact the administrator.');\r\n },\r\n get savedSuccessfully() {\r\n return r('savedSuccessfully', 'Saved successfully.');\r\n }\r\n}\r\n\r\nexport {\r\n init,\r\n r,\r\n lang\r\n}","import { getCookie, setCookie, deleteCookie } from \"./utility/cookie\";\r\nimport { init, r, lang } from \"./utility/lgres\";\r\nimport { get, post, upload } from \"./utility/request\";\r\nimport { nullOrEmpty, contains, endsWith, padStart, formatUrl, escapeHtml } from \"./utility/strings\";\r\n\r\nlet g = typeof globalThis !== 'undefined' ? globalThis : self;\r\n\r\nfunction isPositive(n) {\r\n return !isNaN(n) && n > 0;\r\n}\r\n\r\nfunction isMobile() {\r\n return /mobile/i.test(navigator.userAgent);\r\n}\r\n\r\nfunction throttle(method, delay = 100, context = g, ...args) {\r\n if (method == null) {\r\n return;\r\n }\r\n method.tiid && clearTimeout(method.tiid);\r\n const current = new Date();\r\n if (method.tdate == null || current - method.tdate > delay) {\r\n method.apply(context, args);\r\n method.tdate = current;\r\n } else {\r\n method.tiid = setTimeout(() => method.apply(context, args), delay);\r\n }\r\n}\r\n\r\nfunction debounce(method, delay = 100, context = g, ...args) {\r\n if (method == null) {\r\n return;\r\n }\r\n method.tiid && clearTimeout(method.tiid);\r\n method.tiid = setTimeout(() => method.apply(context, args), delay);\r\n}\r\n\r\nfunction truncate(v) {\r\n return (v > 0 ? Math.floor : Math.ceil)(v);\r\n}\r\n\r\nfunction isEmail(text) {\r\n return /^\\w[-\\w.+]*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$/.test(text);\r\n}\r\n\r\nfunction isPhone(text) {\r\n if (/^[1-9]\\d{9,}$/.test(text)) {\r\n return true;\r\n }\r\n if (/^\\+?[1-9][\\d-]{9,}\\d$/.test(text) && /^[1-9]\\d{9,}$/.test(text.replace('+', '').replace(new RegExp('-', 'g'), ''))) {\r\n return true;\r\n }\r\n return false;\r\n}\r\n\r\nexport {\r\n // cookie\r\n getCookie,\r\n setCookie,\r\n deleteCookie,\r\n // lgres\r\n init,\r\n r,\r\n lang,\r\n // request\r\n get,\r\n post,\r\n upload,\r\n // strings\r\n nullOrEmpty,\r\n contains,\r\n endsWith,\r\n padStart,\r\n formatUrl,\r\n escapeHtml,\r\n // variables\r\n g as global,\r\n isPositive,\r\n isMobile,\r\n // functions\r\n throttle,\r\n debounce,\r\n truncate,\r\n isEmail,\r\n isPhone\r\n}","// import { r, global, contains, isPositive, nullOrEmpty } from \"../utility\";\r\nimport './css/dropdown.scss';\r\nimport { r } from \"../utility/lgres\";\r\nimport { contains, nullOrEmpty } from \"../utility/strings\";\r\nimport { global, isPositive } from \"../utility\";\r\nimport { createElement } from \"../functions\";\r\nimport { createCheckbox } from \"./checkbox\";\r\nimport { createIcon } from \"./icon\"\r\n\r\nconst SymbolDropdown = Symbol.for('ui-dropdown');\r\nconst DropdownTitleHeight = 26;\r\nconst DropdownItemHeight = 30;\r\n\r\nlet dropdownGlobal = global[SymbolDropdown];\r\n\r\nif (dropdownGlobal == null) {\r\n // init\r\n dropdownGlobal = {};\r\n Object.defineProperty(dropdownGlobal, 'clear', {\r\n writable: false,\r\n configurable: false,\r\n enumerable: false,\r\n value: function () {\r\n const panel = document.querySelector('.ui-drop-wrapper .ui-drop-box.active');\r\n if (panel == null) {\r\n return;\r\n }\r\n panel.classList.remove('active');\r\n const dropId = panel.parentElement.dataset.dropId;\r\n if (dropId == null) {\r\n return;\r\n }\r\n const dropdown = this[dropId];\r\n if (dropdown?.multiselect && typeof dropdown.oncollapsed === 'function') {\r\n dropdown.oncollapsed();\r\n }\r\n }\r\n })\r\n global[SymbolDropdown] = dropdownGlobal;\r\n\r\n document.addEventListener('mousedown', e => {\r\n let parent = e.target;\r\n while (parent != null) {\r\n if (parent.classList.contains('ui-drop-box')) {\r\n e.stopPropagation();\r\n return;\r\n }\r\n parent = parent.parentElement;\r\n }\r\n dropdownGlobal.clear();\r\n });\r\n}\r\n\r\nfunction selectItems(label, itemlist, htmlkey, textkey) {\r\n const htmls = itemlist.map(it => it[htmlkey]);\r\n if (htmls.some(it => it instanceof HTMLElement)) {\r\n label.replaceChildren(...htmls.filter(it => it != null).map(it => it.cloneNode(true)));\r\n } else {\r\n let text = itemlist.map(it => it[textkey]).join(', ');\r\n if (nullOrEmpty(text)) {\r\n text = r('noneItem', '( None )');\r\n }\r\n label.innerText = text;\r\n }\r\n}\r\n\r\nfunction filterSource(searchkeys, textkey, key, source) {\r\n if (!Array.isArray(searchkeys) || searchkeys.length === 0) {\r\n searchkeys = [textkey];\r\n }\r\n if (key.length > 0) {\r\n source = source.filter(it => {\r\n for (let k of searchkeys) {\r\n if (contains(it[k].toLowerCase(), key)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n });\r\n }\r\n return source;\r\n}\r\n\r\nclass Dropdown {\r\n #options;\r\n\r\n #wrapper;\r\n #container;\r\n #label;\r\n\r\n #allChecked;\r\n #source;\r\n #lastSelected;\r\n #selected;\r\n #selectedList;\r\n\r\n sourceFilter;\r\n onselectedlist;\r\n onselected;\r\n onexpanded;\r\n\r\n constructor(options = {}) {\r\n options.searchplaceholder ??= r('searchHolder', 'Search...');\r\n options.textkey ??= 'text';\r\n options.valuekey ??= 'value';\r\n options.htmlkey ??= 'html';\r\n options.maxlength ??= 500;\r\n this.#options = options;\r\n }\r\n\r\n create() {\r\n const options = this.#options;\r\n\r\n // wrapper\r\n const wrapper = createElement('div', 'ui-drop-wrapper');\r\n const dropId = String(Math.random()).substring(2);\r\n wrapper.dataset.dropId = dropId;\r\n dropdownGlobal[dropId] = this;\r\n this.#wrapper = wrapper;\r\n\r\n // header\r\n const header = createElement('div', 'ui-drop-header');\r\n header.addEventListener('keypress', e => {\r\n if (e.key === ' ' || e.key === 'Enter') {\r\n header.dispatchEvent(new MouseEvent('click'));\r\n }\r\n });\r\n header.addEventListener('keydown', e => {\r\n const up = e.key === 'ArrowUp';\r\n const down = e.key === 'ArrowDown';\r\n if (up || down) {\r\n const source = this.source;\r\n const count = source.length;\r\n const valuekey = this.#options.valuekey;\r\n let index = source?.indexOf(this.#selected);\r\n if (isNaN(index) || index < -1) {\r\n index = -1;\r\n } else if (index >= count) {\r\n index = count - 1;\r\n }\r\n if (up) {\r\n if (index > 0) {\r\n index--;\r\n } else {\r\n index = 0;\r\n }\r\n } else if (down) {\r\n if (index < 0) {\r\n index = 0;\r\n } else if (index < count) {\r\n index++;\r\n } else {\r\n index = count - 1;\r\n }\r\n }\r\n const target = source[index]?.[valuekey];\r\n if (target != null) {\r\n this.select(target);\r\n }\r\n } else if (e.key === 'Tab') {\r\n this.#dropdown(false);\r\n }\r\n });\r\n header.addEventListener('click', () => {\r\n if (this.disabled) {\r\n return;\r\n }\r\n const active = this.#expanded;\r\n const label = this.#label;\r\n if (active && label.ownerDocument.activeElement === label) {\r\n return;\r\n }\r\n this.#dropdown(!active);\r\n if (!active && typeof this.onexpanded === 'function') {\r\n setTimeout(() => this.onexpanded(), 120);\r\n }\r\n });\r\n\r\n // label or input\r\n let label;\r\n if (options.input) {\r\n label = createElement('input', 'ui-drop-text');\r\n label.setAttribute('type', 'text');\r\n options.placeholder && label.setAttribute('placeholder', options.placeholder);\r\n isPositive(options.maxlength) && label.setAttribute('maxlength', options.maxlength);\r\n isPositive(options.tabIndex) && label.setAttribute('tabindex', options.tabIndex);\r\n label.addEventListener('input', e => {\r\n const key = e.target.value.toLowerCase();\r\n const source = filterSource(options.searchkeys, options.textkey, key, this.source);\r\n this.#filllist(source);\r\n this.#container.classList.add('active');\r\n });\r\n label.addEventListener('blur', e => this.select(e.target.value));\r\n label.addEventListener('mousedown', e => this.#expanded && e.stopPropagation());\r\n } else {\r\n isPositive(options.tabIndex) && header.setAttribute('tabindex', options.tabIndex);\r\n label = createElement('label', 'ui-drop-text');\r\n }\r\n this.#label = label;\r\n if (options.multiselect) {\r\n if (Array.isArray(options.selectedlist)) {\r\n this.selectlist(options.selectedlist, true);\r\n } else {\r\n this.#allChecked = true;\r\n label.innerText = r('allItem', '( All )');\r\n }\r\n } else if (options.selected != null) {\r\n this.select(options.selected, true);\r\n }\r\n header.append(label, createElement('label', 'ui-drop-caret'));\r\n wrapper.appendChild(header);\r\n\r\n this.disabled = options.disabled || false;\r\n return wrapper;\r\n }\r\n\r\n get multiselect() { return this.#options.multiselect }\r\n\r\n get disabled() { return this.#wrapper == null || this.#wrapper.querySelector('.ui-drop-header.disabled') != null }\r\n\r\n set disabled(flag) {\r\n if (this.#wrapper == null) {\r\n return;\r\n }\r\n if (flag) {\r\n this.#wrapper.querySelector('.ui-drop-header').classList.add('disabled');\r\n } else {\r\n this.#wrapper.querySelector('.ui-drop-header').classList.remove('disabled');\r\n }\r\n }\r\n\r\n get source() {\r\n let source = this.#source;\r\n if (source == null || !Array.isArray(source)) {\r\n if (typeof this.sourceFilter === 'function') {\r\n source = this.sourceFilter();\r\n }\r\n if (!Array.isArray(source)) {\r\n source = [];\r\n }\r\n this.#source = source;\r\n }\r\n return source;\r\n }\r\n\r\n set source(list) {\r\n if (!Array.isArray(list)) {\r\n return;\r\n }\r\n this.#source = list;\r\n if (this.#expanded) {\r\n setTimeout(() => this.#dropdown(), 120);\r\n }\r\n }\r\n\r\n get selected() { return this.#selected }\r\n\r\n get selectedlist() { return this.#selectedList || [] }\r\n\r\n select(selected, silence) {\r\n if (this.#lastSelected === selected) {\r\n return false;\r\n }\r\n this.#lastSelected = selected;\r\n const valuekey = this.#options.valuekey;\r\n const textkey = this.#options.textkey;\r\n const htmlkey = this.#options.htmlkey;\r\n let item = this.source.find(it => it[valuekey] === selected);\r\n if (this.#options.input) {\r\n if (item == null) {\r\n item = { [valuekey]: selected };\r\n }\r\n this.#label.value = selected;\r\n } else {\r\n const expanded = this.#expanded;\r\n if (expanded) {\r\n this.#container.querySelectorAll('li[data-value].selected').forEach(li => li.classList.remove('selected'));\r\n }\r\n if (item == null) {\r\n this.#selected = null;\r\n this.#label.innerText = ' ';\r\n return false;\r\n }\r\n const html = item[htmlkey];\r\n if (html instanceof HTMLElement) {\r\n this.#label.replaceChildren(html.cloneNode(true));\r\n } else {\r\n let text = item[textkey];\r\n if (nullOrEmpty(text)) {\r\n text = ' ';\r\n }\r\n this.#label.innerText = text;\r\n }\r\n if (expanded) {\r\n const val = selected.replace(/\"/g, '\\\\\"');\r\n const li = this.#container.querySelector(`li[data-value=\"${val}\"]`);\r\n if (li != null) {\r\n li.classList.add('selected');\r\n }\r\n }\r\n }\r\n this.#selected = item;\r\n if (!silence && typeof this.onselected === 'function') {\r\n this.onselected(item);\r\n }\r\n }\r\n\r\n selectlist(selectedlist, silence) {\r\n const source = this.source;\r\n const valuekey = this.#options.valuekey;\r\n const textkey = this.#options.textkey;\r\n const htmlkey = this.#options.htmlkey;\r\n const itemlist = selectedlist.map(v => {\r\n let item = source.find(it => it[valuekey] === v);\r\n if (item == null) {\r\n item = { [valuekey]: v, [textkey]: v };\r\n }\r\n return item;\r\n });\r\n if (itemlist.length === 0) {\r\n this.#selectedList = null;\r\n this.#label.innerText = none;\r\n return false;\r\n }\r\n selectItems(this.#label, itemlist, htmlkey, textkey);\r\n this.#selectedList = itemlist;\r\n if (!silence && typeof this.onselectedlist === 'function') {\r\n this.onselectedlist(itemlist);\r\n }\r\n }\r\n\r\n get #expanded() { return this.#container?.classList?.contains('active') }\r\n\r\n #dropdown(flag = true) {\r\n const options = this.#options;\r\n let panel = this.#container;\r\n if (panel == null) {\r\n panel = createElement('div', 'ui-drop-box');\r\n // search box\r\n if (!options.input && options.search) {\r\n const search = createElement('div', 'ui-drop-search');\r\n const input = createElement('input');\r\n input.setAttribute('type', 'text');\r\n isPositive(options.tabIndex) && input.setAttribute('tabindex', options.tabIndex);\r\n !nullOrEmpty(options.searchplaceholder) && input.setAttribute('placeholder', options.searchplaceholder);\r\n input.addEventListener('input', e => {\r\n const key = e.target.value.toLowerCase();\r\n const source = filterSource(options.searchkeys, options.textkey, key, this.source);\r\n this.#filllist(source);\r\n })\r\n search.append(input, createIcon('fa-light', 'search'));\r\n panel.appendChild(search);\r\n }\r\n // list\r\n const list = createElement('ul', 'ui-drop-list');\r\n if (!this.multiselect) {\r\n list.addEventListener('click', e => {\r\n let li = e.target;\r\n while (li.tagName !== 'LI') {\r\n li = li.parentElement;\r\n if (li == null) {\r\n return;\r\n }\r\n }\r\n const value = li.dataset.value;\r\n if (this.select(value) !== false) {\r\n dropdownGlobal.clear();\r\n }\r\n });\r\n }\r\n panel.appendChild(list);\r\n this.#container = panel;\r\n this.#wrapper.appendChild(panel);\r\n }\r\n if (flag) {\r\n let source = this.source;\r\n if (!options.input && options.search) {\r\n const search = panel.querySelector('.ui-drop-search > input');\r\n if (!nullOrEmpty(search?.value)) {\r\n source = filterSource(options.searchkeys, options.textkey, search.value, source);\r\n }\r\n }\r\n this.#filllist(source);\r\n // slide direction\r\n if (!options.slidefixed) {\r\n let parent = options.parent ?? document.body;\r\n let p = this.#wrapper;\r\n let top = p.offsetTop;\r\n while ((p = p.parentElement) != null && p !== parent) {\r\n top -= p.scrollTop;\r\n }\r\n if (top - parent.offsetTop + DropdownTitleHeight + panel.offsetHeight >= parent.offsetHeight) {\r\n panel.classList.add('slide-up');\r\n } else {\r\n panel.classList.remove('slide-up');\r\n }\r\n }\r\n panel.classList.add('active');\r\n } else {\r\n panel.classList.remove('active');\r\n }\r\n }\r\n\r\n #filllist(source) {\r\n const list = this.#container.querySelector('.ui-drop-list');\r\n list.replaceChildren();\r\n const multiselect = this.multiselect;\r\n const allchecked = this.#allChecked;\r\n if (multiselect) {\r\n list.appendChild(\r\n createElement('li', null,\r\n createCheckbox({\r\n label: r('allItem', '( All )'),\r\n checked: allchecked,\r\n customerAttributes: { 'isall': '1' },\r\n onchange: e => this.#triggerselect(e.target)\r\n })\r\n )\r\n );\r\n }\r\n // TODO: virtual mode\r\n const valuekey = this.#options.valuekey;\r\n const textkey = this.#options.textkey;\r\n const htmlkey = this.#options.htmlkey;\r\n const selected = this.selected;\r\n const selectedlist = this.selectedlist;\r\n let scrolled;\r\n source.slice(0, 200).forEach((item, i) => {\r\n const val = item[valuekey];\r\n const li = createElement('li');\r\n li.dataset.value = val;\r\n li.setAttribute('title', item[textkey]);\r\n let label;\r\n const html = item[htmlkey];\r\n if (html instanceof HTMLElement) {\r\n label = html;\r\n }\r\n if (multiselect) {\r\n const selected = selectedlist.some(s => s[valuekey] === val);\r\n if (label == null) {\r\n label = createElement('span');\r\n label.innerText = item[textkey];\r\n }\r\n const box = createCheckbox({\r\n label,\r\n checked: allchecked || selected,\r\n customerAttributes: {\r\n 'class': 'dataitem',\r\n 'data-value': val\r\n },\r\n onchange: e => this.#triggerselect(e.target)\r\n });\r\n li.appendChild(box);\r\n } else {\r\n if (label == null) {\r\n li.innerText = item[textkey];\r\n } else {\r\n li.appendChild(label);\r\n }\r\n if (selected != null && selected[valuekey] === val) {\r\n scrolled = DropdownItemHeight * i;\r\n li.classList.add('selected');\r\n }\r\n }\r\n list.appendChild(li);\r\n });\r\n if (scrolled != null) {\r\n setTimeout(() => list.scrollTop = scrolled, 10);\r\n }\r\n }\r\n\r\n #triggerselect(checkbox) {\r\n let list;\r\n const valuekey = this.#options.valuekey;\r\n const textkey = this.#options.textkey;\r\n const htmlkey = this.#options.htmlkey;\r\n if (checkbox.getAttribute('isall') === '1') {\r\n const allchecked = this.#allChecked = checkbox.checked;\r\n const boxes = this.#container.querySelectorAll('input.dataitem');\r\n boxes.forEach(box => box.checked = allchecked);\r\n list = [];\r\n } else if (checkbox.checked) {\r\n if (this.#container.querySelectorAll('input.dataitem:not(:checked)').length === 0) {\r\n this.#allChecked = true;\r\n this.#container.querySelector('input[isall=\"1\"]').checked = true;\r\n list = [];\r\n } else {\r\n const source = this.source;\r\n list = [...this.#container.querySelectorAll('input.dataitem:checked')]\r\n .map(c => source.find(it => it[valuekey] === c.dataset.value))\r\n .filter(it => it != null);\r\n }\r\n } else {\r\n const val = checkbox.dataset.value;\r\n if (this.#allChecked) {\r\n this.#allChecked = false;\r\n this.#container.querySelector('input[isall=\"1\"]').checked = false;\r\n list = this.source.filter(it => it[valuekey] !== val);\r\n } else {\r\n list = this.selectedlist.filter(it => it[valuekey] !== val);\r\n }\r\n }\r\n if (this.#allChecked) {\r\n this.#label.innerText = r('allItem', '( All )');\r\n } else {\r\n selectItems(this.#label, list, htmlkey, textkey);\r\n }\r\n this.#selectedList = list;\r\n if (typeof this.onselectedlist === 'function') {\r\n this.onselectedlist(itemlist);\r\n }\r\n }\r\n\r\n static resolve(dom = document.body) {\r\n const selects = dom.querySelectorAll('select');\r\n for (let sel of selects) {\r\n const source = [...sel.children].map(it => {\r\n return { value: it.value, text: it.innerText }\r\n });\r\n const drop = new Dropdown({\r\n selected: sel.value,\r\n disabled: sel.disabled,\r\n tabIndex: sel.tabIndex\r\n });\r\n drop.source = source;\r\n sel.parentElement.replaceChild(drop.create(), sel);\r\n }\r\n return dom;\r\n }\r\n}\r\n\r\nexport default Dropdown;","import { global } from \"../../utility\";\r\n// import { nullOrEmpty } from \"../../utility/strings\";\r\nimport { createElement } from \"../../functions\";\r\nimport { createIcon } from \"../icon\";\r\nimport { createCheckbox } from \"../checkbox\";\r\n// import { setTooltip } from \"../tooltip\";\r\nimport Dropdown from \"../dropdown\";\r\n\r\nclass GridColumn {\r\n static create() {\r\n return createElement('span');\r\n }\r\n\r\n static setValue(element, val) {\r\n element.innerText = val;\r\n }\r\n\r\n static setStyle(element, style) {\r\n for (let css of Object.entries(style)) {\r\n element.style.setProperty(css[0], css[1]);\r\n }\r\n }\r\n\r\n static setEnabled(element, enabled) {\r\n const tooltip = element.querySelector('.ui-tooltip-wrapper');\r\n if (tooltip != null) {\r\n tooltip.style.display = enabled === false ? 'none' : '';\r\n }\r\n }\r\n}\r\n\r\nclass GridInputColumn extends GridColumn {\r\n static get editing() { return true };\r\n\r\n static createEdit(trigger, col, _parent, vals) {\r\n const input = createElement('input');\r\n input.setAttribute('type', 'text');\r\n if (typeof trigger === 'function') {\r\n input.addEventListener('change', trigger);\r\n }\r\n input.addEventListener('input', () => {\r\n if (vals.__editing == null) {\r\n vals.__editing = {\r\n [col.key]: true\r\n }\r\n } else {\r\n vals.__editing[col.key] = true;\r\n }\r\n });\r\n return input;\r\n }\r\n\r\n static setValue(element, val) {\r\n if (element.tagName !== 'INPUT') {\r\n super.setValue(element, val);\r\n } else {\r\n element.value = val;\r\n }\r\n }\r\n\r\n static getValue(e) { return e.target.value }\r\n\r\n static setEnabled(element, enabled) {\r\n super.setEnabled(element , enabled);\r\n element.disabled = enabled === false;\r\n }\r\n}\r\n\r\nclass GridTextColumn extends GridInputColumn {\r\n static createEdit(trigger, col, _parent, vals) {\r\n const input = createElement('textarea');\r\n if (typeof trigger === 'function') {\r\n input.addEventListener('change', trigger);\r\n }\r\n input.addEventListener('input', () => {\r\n if (vals.__editing == null) {\r\n vals.__editing = {\r\n [col.key]: true\r\n }\r\n } else {\r\n vals.__editing[col.key] = true;\r\n }\r\n });\r\n return input;\r\n }\r\n\r\n static setValue(element, val, _item, _col, grid) {\r\n if (element.tagName !== 'TEXTAREA') {\r\n super.setValue(element, val);\r\n } else {\r\n element.value = val;\r\n if (val != null) {\r\n const lines = String(val).split('\\n').length;\r\n element.style.height = `${lines * grid.lineHeight + 12}px`;\r\n }\r\n // TODO: bad performance\r\n }\r\n }\r\n}\r\n\r\nconst SymbolDropdown = Symbol.for('ui-dropdown');\r\n\r\nclass GridDropdownColumn extends GridColumn {\r\n static createEdit(trigger, col, parent) {\r\n const drop = new Dropdown({ ...col.dropOptions, parent });\r\n drop.onselected = trigger;\r\n return drop.create();\r\n }\r\n\r\n static #getDrop(element) {\r\n const dropGlobal = global[SymbolDropdown];\r\n if (dropGlobal == null) {\r\n return null;\r\n }\r\n const dropId = element.dataset.dropId;\r\n const drop = dropGlobal[dropId];\r\n if (drop == null) {\r\n return null;\r\n }\r\n return drop;\r\n }\r\n\r\n static #getSource(item, col) {\r\n let source = col.source;\r\n if (typeof source === 'function') {\r\n source = source(item);\r\n }\r\n return source;\r\n }\r\n\r\n static #setValue(source, element, val) {\r\n const data = source?.find(v => v.value === val);\r\n if (data != null) {\r\n val = data.text;\r\n }\r\n super.setValue(element, val);\r\n }\r\n\r\n static setValue(element, val, item, col) {\r\n if (element.tagName !== 'DIV') {\r\n let source = this.#getSource(item, col);\r\n if (source instanceof Promise) {\r\n source.then(s => this.#setValue(s, element, val));\r\n } else {\r\n this.#setValue(source, element, val);\r\n }\r\n return;\r\n }\r\n const drop = this.#getDrop(element);\r\n if (drop == null) {\r\n return;\r\n }\r\n if (drop.source == null || drop.source.length === 0) {\r\n let source = this.#getSource(item, col);\r\n if (source instanceof Promise) {\r\n source.then(s => {\r\n drop.source = s;\r\n drop.select(val, true);\r\n })\r\n return;\r\n } else if (source != null) {\r\n drop.source = source;\r\n }\r\n }\r\n drop.select(val, true);\r\n }\r\n\r\n static getValue(e) {\r\n return e.value;\r\n }\r\n\r\n static setEnabled(element, enabled) {\r\n super.setEnabled(element , enabled);\r\n const drop = this.#getDrop(element);\r\n if (drop == null) {\r\n return;\r\n }\r\n drop.disabled = enabled === false;\r\n }\r\n}\r\n\r\nclass GridCheckboxColumn extends GridColumn {\r\n static createEdit(trigger) {\r\n const check = createCheckbox({\r\n onchange: typeof trigger === 'function' ? trigger : null\r\n });\r\n return check;\r\n }\r\n\r\n static setValue(element, val) {\r\n element.querySelector('input').checked = val;\r\n }\r\n\r\n static getValue(e) { return e.target.checked }\r\n\r\n static setEnabled(element, enabled) {\r\n super.setEnabled(element , enabled);\r\n element.querySelector('input').disabled = enabled === false;\r\n }\r\n}\r\n\r\nclass GridIconColumn extends GridColumn {\r\n static create() { return createElement('span', 'col-icon') }\r\n\r\n static setValue(element, val, item, col, grid) {\r\n let className = col.className;\r\n if (typeof className === 'function') {\r\n className = className.call(col, item);\r\n }\r\n if (className == null) {\r\n element.className = 'col-icon';\r\n } else {\r\n element.className = `col-icon ${className}`;\r\n }\r\n let type = col.iconType;\r\n if (typeof type === 'function') {\r\n type = type.call(col, item);\r\n }\r\n type ??= 'fa-regular';\r\n if (element.dataset.type !== type || element.dataset.icon !== val) {\r\n const icon = createIcon(type, val);\r\n // const layer = element.children[0];\r\n element.replaceChildren(icon);\r\n // !nullOrEmpty(col.tooltip) && setTooltip(element, col.tooltip, false, grid.element);\r\n element.dataset.type = type;\r\n element.dataset.icon = val;\r\n }\r\n }\r\n\r\n static setEnabled(element, enabled) {\r\n super.setEnabled(element , enabled);\r\n if (enabled === false) {\r\n element.classList.add('disabled');\r\n } else {\r\n element.classList.remove('disabled');\r\n }\r\n }\r\n}\r\n\r\nexport {\r\n GridColumn,\r\n GridInputColumn,\r\n GridTextColumn,\r\n GridDropdownColumn,\r\n GridCheckboxColumn,\r\n GridIconColumn\r\n}","import '../css/grid.scss';\r\nimport { global, isPositive, isMobile, throttle, truncate } from \"../../utility\";\r\nimport { r } from \"../../utility/lgres\";\r\nimport { nullOrEmpty } from \"../../utility/strings\";\r\nimport { createElement } from \"../../functions\";\r\nimport { createIcon } from \"../icon\";\r\nimport { createCheckbox } from \"../checkbox\";\r\nimport { setTooltip } from \"../tooltip\";\r\nimport { GridColumn, GridInputColumn, GridTextColumn, GridDropdownColumn, GridCheckboxColumn, GridIconColumn } from \"./column\";\r\n\r\nconst ColumnChangedType = {\r\n Reorder: 'reorder',\r\n Resize: 'resize',\r\n Sort: 'sort'\r\n};\r\nconst RefreshInterval = isMobile() ? 32 : 0;\r\nconst HoverInternal = 200;\r\nconst RedumCount = 4;\r\nconst MiniDragOffset = 4;\r\nconst MiniColumnWidth = 50;\r\nconst FilterPanelWidth = 200;\r\n\r\nfunction getClientX(e) {\r\n if (e == null) {\r\n return null;\r\n }\r\n const cx = e.touches && e.touches[0]?.clientX;\r\n return cx ?? e.clientX;\r\n}\r\n\r\nfunction getOffsetLeftFromWindow(element) {\r\n let left = 0;\r\n while (element != null) {\r\n left += element.offsetLeft;\r\n element = element.offsetParent;\r\n }\r\n return left;\r\n}\r\n\r\nfunction indexOfParent(target) {\r\n // return [...target.parentElement.children].indexOf(target);\r\n return Array.prototype.indexOf.call(target.parentElement.children, target);\r\n}\r\n\r\nconst ColumnTypes = {\r\n 0: GridColumn,\r\n 1: GridInputColumn,\r\n 2: GridDropdownColumn,\r\n 3: GridCheckboxColumn,\r\n 4: GridIconColumn,\r\n 5: GridTextColumn\r\n};\r\n\r\nclass Grid {\r\n #source;\r\n #currentSource;\r\n #parent;\r\n #el;\r\n #refs;\r\n #rendering;\r\n #selectedColumnIndex = -1;\r\n #selectedIndexes;\r\n #startIndex = 0;\r\n #needResize;\r\n #containerHeight;\r\n #bodyClientWidth;\r\n #rowCount = -1;\r\n #scrollTop;\r\n #scrollLeft;\r\n #colTypes = {};\r\n #colAttrs = {};\r\n #vtable = [];\r\n\r\n columns = [];\r\n langs = {\r\n all: r('allItem', '( All )'),\r\n ok: r('ok', 'OK'),\r\n reset: r('reset', 'Reset')\r\n };\r\n virtualCount = 100;\r\n rowHeight = 36;\r\n lineHeight = 24;\r\n extraRows = 0;\r\n filterRowHeight = 30;\r\n height;\r\n readonly;\r\n multiSelect = false;\r\n fullrowClick = true;\r\n allowHtml = false;\r\n holderDisabled = false;\r\n headerVisible = true;\r\n window = global;\r\n sortIndex = -1;\r\n sortDirection = 1;\r\n\r\n willSelect;\r\n selectedRowChanged;\r\n cellDblClicked;\r\n cellClicked;\r\n rowDblClicked;\r\n columnChanged;\r\n\r\n static ColumnTypes = {\r\n Common: 0,\r\n Input: 1,\r\n Dropdown: 2,\r\n Checkbox: 3,\r\n Icon: 4,\r\n Text: 5,\r\n isCheckbox(type) { return type === 3 }\r\n };\r\n\r\n static GridColumn = GridColumn;\r\n\r\n constructor(container) {\r\n this.#parent = container;\r\n }\r\n\r\n get element() { return this.#el }\r\n\r\n get source() { return this.#source?.map(s => s.values) }\r\n set source(list) {\r\n if (this.#el == null) {\r\n throw new Error('grid has not been initialized.')\r\n }\r\n if (!Array.isArray(list)) {\r\n throw new Error('source is not an Array.')\r\n }\r\n list = list.map(i => { return { values: i } });\r\n this.#source = list;\r\n this.#refreshSource(list);\r\n }\r\n\r\n #refreshSource(list) {\r\n list ??= this.#source;\r\n if (this.#colAttrs.__filtered === true) {\r\n this.#currentSource = list.filter(it => {\r\n for (let col of this.columns) {\r\n if (Array.isArray(col.filterValues)) {\r\n const v = this.#getItemValue(it.values, col.key, col.filter);\r\n if (col.filterValues.indexOf(v) < 0) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n });\r\n } else {\r\n this.#currentSource = list;\r\n }\r\n this.#selectedColumnIndex = -1;\r\n this.#selectedIndexes = [];\r\n this.#startIndex = 0;\r\n this.#scrollTop = 0;\r\n this.#scrollLeft = 0;\r\n this.#rowCount = -1;\r\n\r\n if (this.sortIndex >= 0) {\r\n this.sortColumn();\r\n }\r\n this.resize();\r\n }\r\n\r\n get virtual() { return this.#currentSource?.length > this.virtualCount }\r\n\r\n get sortKey() {\r\n if (this.columns == null) {\r\n return null;\r\n }\r\n return this.columns[this.sortIndex]?.key;\r\n }\r\n\r\n get selectedIndexes() { return this.#selectedIndexes }\r\n set selectedIndexes(indexes) {\r\n const startIndex = this.#startIndex;\r\n this.#selectedIndexes.splice(0, this.#selectedIndexes.length, ...indexes);\r\n if (this.readonly !== true) {\r\n this.refresh();\r\n } else {\r\n [...this.#refs.bodyContent.children].forEach((row, i) => {\r\n if (indexes.indexOf(startIndex + i) >= 0) {\r\n row.classList.add('selected');\r\n } else if (row.classList.contains('selected')) {\r\n row.classList.remove('selected');\r\n }\r\n });\r\n }\r\n if (typeof this.selectedRowChanged === 'function') {\r\n this.selectedRowChanged();\r\n }\r\n }\r\n\r\n get selectedIndex() { return (this.#selectedIndexes && this.#selectedIndexes[0]) ?? -1 }\r\n\r\n get loading() { return this.#refs.loading?.style?.visibility === 'visible' }\r\n set loading(flag) {\r\n if (this.#refs.loading == null) {\r\n return;\r\n }\r\n if (flag === false) {\r\n this.#refs.loading.style.visibility = 'hidden';\r\n this.#refs.loading.style.opacity = 0;\r\n } else {\r\n this.#refs.loading.style.visibility = 'visible';\r\n this.#refs.loading.style.opacity = 1;\r\n }\r\n }\r\n\r\n get scrollTop() { return this.#refs.body?.scrollTop; }\r\n set scrollTop(top) {\r\n if (this.#refs.body == null) {\r\n return;\r\n }\r\n this.#refs.body.scrollTop = top;\r\n this.reload();\r\n }\r\n\r\n init(container = this.#parent) {\r\n this.#el = null;\r\n this.#refs = {};\r\n this.#rendering = true;\r\n if (!(container instanceof HTMLElement)) {\r\n throw new Error('no specified parent.');\r\n }\r\n this.#parent = container;\r\n const grid = createElement('div', 'ui-grid');\r\n grid.setAttribute('tabindex', 0);\r\n grid.addEventListener('keydown', e => {\r\n let index = this.selectedIndex;\r\n let flag = false;\r\n if (e.key === 'ArrowUp') {\r\n // up\r\n if (index > 0) {\r\n flag = true;\r\n index -= 1;\r\n }\r\n } else if (e.key === 'ArrowDown') {\r\n // down\r\n const count = this.#currentSource?.length ?? 0;\r\n if (index < count - 1) {\r\n flag = true;\r\n index += 1;\r\n }\r\n }\r\n if (flag) {\r\n this.#selectedIndexes = [index];\r\n this.scrollToIndex(index);\r\n this.refresh();\r\n if (typeof this.selectedRowChanged === 'function') {\r\n this.selectedRowChanged(index);\r\n }\r\n e.stopPropagation();\r\n }\r\n });\r\n container.replaceChildren(grid);\r\n const sizer = createElement('span', 'ui-grid-sizer');\r\n grid.appendChild(sizer);\r\n this.#refs.sizer = sizer;\r\n\r\n // header & body\r\n const header = this.#createHeader();\r\n grid.appendChild(header);\r\n const body = this.#createBody();\r\n grid.appendChild(body);\r\n\r\n // loading\r\n const loading = createElement('div', 'ui-grid-loading',\r\n createElement('div', null, createIcon('fa-regular', 'spinner-third'))\r\n );\r\n this.#refs.loading = loading;\r\n grid.appendChild(loading);\r\n this.#el = grid;\r\n\r\n this.#rendering = false;\r\n if (this.#source != null && this.sortIndex >= 0) {\r\n this.sortColumn();\r\n }\r\n }\r\n\r\n scrollToIndex(index) {\r\n const top = this.#scrollToTop(index * (this.rowHeight + 1), true);\r\n this.#refs.body.scrollTop = top;\r\n }\r\n\r\n resize(force) {\r\n if (this.#rendering || this.#el == null) {\r\n return;\r\n }\r\n const body = this.#refs.body;\r\n // let height = this.#refs.header.offsetHeight + 2;\r\n // let top = body.offsetTop;\r\n // if (top !== height) {\r\n // body.style.top = `${height}px`;\r\n // top = height;\r\n // }\r\n const top = this.headerVisible === false ? 0 : this.#refs.header.offsetHeight;\r\n\r\n let height = this.height;\r\n if (height === 0) {\r\n height = this.#containerHeight;\r\n } else if (isNaN(height) || height < 0) {\r\n height = this.#el.offsetHeight - top;\r\n }\r\n const count = truncate((height - 1) / (this.rowHeight + 1)) + (RedumCount * 2) + 1;\r\n if (force || count !== this.#rowCount) {\r\n this.#rowCount = count;\r\n this.reload();\r\n }\r\n this.#bodyClientWidth = body.clientWidth;\r\n }\r\n\r\n reload() {\r\n let length = this.#currentSource.length;\r\n if (this.extraRows > 0) {\r\n length += this.extraRows;\r\n }\r\n this.#containerHeight = length * (this.rowHeight + 1);\r\n this.#refs.body.scrollTop = 0;\r\n this.#refs.body.scrollLeft = 0;\r\n this.#refs.bodyContent.style.top = '0px';\r\n this.#refs.bodyContainer.style.height = `${this.#containerHeight}px`;\r\n this.#adjustRows(this.#refs.bodyContent);\r\n this.refresh();\r\n }\r\n\r\n refresh() {\r\n if (this.#refs.bodyContent == null) {\r\n throw new Error('body has not been created.');\r\n }\r\n const rows = this.#refs.bodyContent.children;\r\n const widths = {};\r\n this.#fillRows(rows, this.columns, widths);\r\n if (this.#needResize && widths.flag) {\r\n this.#needResize = false;\r\n this.columns.forEach((col, i) => {\r\n if (!this.#get(col.key, 'autoResize')) {\r\n return;\r\n }\r\n let width = widths[i];\r\n if (width < col.width) {\r\n width = col.width;\r\n }\r\n if (width > 0) {\r\n this.#changeColumnWidth(i, width);\r\n }\r\n });\r\n }\r\n }\r\n\r\n resetChange() {\r\n if (this.#source == null) {\r\n return;\r\n }\r\n for (let row of this.#source) {\r\n delete row.__changed;\r\n }\r\n }\r\n\r\n sortColumn(reload) {\r\n const index = this.sortIndex;\r\n const col = this.columns[index];\r\n if (col == null) {\r\n return;\r\n }\r\n const direction = this.sortDirection;\r\n [...this.#refs.header.children].forEach((th, i) => {\r\n const arrow = th.querySelector('.arrow');\r\n if (arrow == null) {\r\n return;\r\n }\r\n if (i === index) {\r\n arrow.className = `arrow ${(direction !== 1 ? 'desc' : 'asc')}`;\r\n } else if (arrow.className !== 'arrow') {\r\n arrow.className = 'arrow';\r\n }\r\n });\r\n let comparer;\r\n if (typeof col.sortFilter !== 'function') {\r\n const direction = this.sortDirection;\r\n if (isNaN(direction)) {\r\n direction = 1;\r\n }\r\n comparer = (a, b) => {\r\n a = this.#getItemValue(a.values, col.key, col.filter);\r\n b = this.#getItemValue(b.values, col.key, col.filter);\r\n if (a == null && typeof b === 'number') {\r\n a = 0;\r\n } else if (typeof a === 'number' && b == null) {\r\n b = 0;\r\n } else if (a != null && b == null) {\r\n return direction;\r\n } else if (typeof a === 'string' && typeof b === 'string') {\r\n a = a.toLowerCase();\r\n b = b.toLowerCase();\r\n }\r\n return a === b ? 0 : (a > b ? 1 : -1) * direction;\r\n };\r\n } else {\r\n comparer = (a, b) => col.sortFilter(a.values, b.values) * direction;\r\n }\r\n this.#source.sort(comparer);\r\n if (this.#colAttrs.__filtered === true) {\r\n this.#currentSource.sort(comparer);\r\n }\r\n if (this.#rowCount < 0) {\r\n return;\r\n }\r\n if (reload) {\r\n this.reload();\r\n } else {\r\n this.refresh();\r\n }\r\n }\r\n\r\n #createHeader() {\r\n const thead = createElement('table', 'ui-grid-header');\r\n if (this.headerVisible === false) {\r\n thead.style.display = 'none';\r\n }\r\n const header = createElement('tr');\r\n thead.appendChild(header);\r\n const sizer = this.#refs.sizer;\r\n for (let col of this.columns) {\r\n if (col.visible === false) {\r\n const hidden = createElement('th');\r\n hidden.style.display = 'none';\r\n if (col.sortable !== false) {\r\n hidden.dataset.key = col.key;\r\n hidden.addEventListener('click', e => this.#onHeaderClicked(e, col, true));\r\n }\r\n header.appendChild(hidden);\r\n continue;\r\n }\r\n // style\r\n const isCheckbox = Grid.ColumnTypes.isCheckbox(col.type);\r\n if (col.width > 0) {\r\n // col.autoResize = false;\r\n } else {\r\n this.#set(col.key, 'autoResize', true);\r\n this.#needResize = true;\r\n sizer.innerText = col.caption ?? '';\r\n let width = sizer.offsetWidth + 22;\r\n if (!this.readonly && col.enabled !== false && col.allcheck && isCheckbox) {\r\n width += 32;\r\n }\r\n if (col.allowFilter === true) {\r\n width += 14;\r\n }\r\n if (width < MiniColumnWidth) {\r\n width = MiniColumnWidth;\r\n }\r\n col.width = width;\r\n }\r\n col.align ??= isCheckbox ? 'center' : 'left';\r\n if (col.sortable !== false) {\r\n col.sortable = true;\r\n }\r\n const w = `${col.width}px`;\r\n const style = {\r\n 'width': w,\r\n 'max-width': w,\r\n 'min-width': w,\r\n 'text-align': col.align\r\n };\r\n this.#set(col.key, 'style', style);\r\n // element\r\n const th = createElement('th', 'column');\r\n th.dataset.key = col.key;\r\n for (let css of Object.entries(style)) {\r\n th.style.setProperty(css[0], css[1]);\r\n }\r\n if (col.sortable) {\r\n th.style.cursor = 'pointer';\r\n th.addEventListener('click', e => this.#onHeaderClicked(e, col));\r\n }\r\n if (col.orderable !== false) {\r\n col.orderable = true;\r\n th.addEventListener('mousedown', e => this.#onDragStart(e, col));\r\n }\r\n const wrapper = createElement('div');\r\n th.appendChild(wrapper);\r\n if (!this.readonly && col.enabled !== false && col.allcheck && isCheckbox) {\r\n const check = createCheckbox({\r\n onchange: e => this.#onColumnAllChecked(col, e.target.checked)\r\n });\r\n wrapper.appendChild(check);\r\n }\r\n const caption = createElement('span');\r\n if (col.textStyle != null) {\r\n for (let css of Object.entries(col.textStyle)) {\r\n caption.style.setProperty(css[0], css[1]);\r\n }\r\n }\r\n caption.innerText = col.caption ?? '';\r\n wrapper.appendChild(caption);\r\n // order arrow\r\n if (col.sortable) {\r\n th.appendChild(createElement('layer', 'arrow'));\r\n }\r\n // filter\r\n if (col.allowFilter === true) {\r\n const filter = createElement('layer', 'filter');\r\n filter.appendChild(createIcon('fa-solid', 'filter'));\r\n filter.addEventListener('mousedown', e => this.#onFilter(e, col));\r\n th.classList.add('header-filter');\r\n th.appendChild(filter);\r\n }\r\n // resize spliter\r\n if (col.resizable !== false) {\r\n const spliter = createElement('layer', 'spliter');\r\n spliter.addEventListener('mousedown', e => this.#onResizeStart(e, col));\r\n spliter.addEventListener('dblclick', e => this.#onAutoResize(e, col));\r\n th.appendChild(spliter);\r\n }\r\n // tooltip\r\n // !nullOrEmpty(col.tooltip) && setTooltip(th, col.tooltip);\r\n header.appendChild(th);\r\n }\r\n const dragger = createElement('div', 'dragger');\r\n const draggerCursor = createElement('layer', 'dragger-cursor');\r\n header.appendChild(createElement('th', null, dragger, draggerCursor));\r\n\r\n sizer.replaceChildren();\r\n this.#refs.header = header;\r\n this.#refs.dragger = dragger;\r\n this.#refs.draggerCursor = draggerCursor;\r\n return thead;\r\n }\r\n\r\n #createBody() {\r\n const body = createElement('div', 'ui-grid-body');\r\n body.addEventListener('scroll', e => throttle(this.#onScroll, RefreshInterval, this, e), { passive: true });\r\n const cols = this.columns;\r\n let width = 1;\r\n for (let col of cols) {\r\n if (col.visible !== false && !isNaN(col.width)) {\r\n width += col.width + 1;\r\n }\r\n }\r\n // body container\r\n const bodyContainer = createElement('div');\r\n bodyContainer.style.position = 'relative';\r\n bodyContainer.style.minWidth = '100%';\r\n bodyContainer.style.minHeight = '1px';\r\n if (width > 0) {\r\n bodyContainer.style.width = `${width}px`;\r\n }\r\n body.appendChild(bodyContainer);\r\n // body content\r\n const bodyContent = createElement('table', 'ui-grid-body-content');\r\n bodyContent.addEventListener('mousedown', e => {\r\n let [parent, target] = this.#getRowTarget(e.target);\r\n const rowIndex = indexOfParent(parent);\r\n let colIndex = indexOfParent(target);\r\n if (colIndex >= this.columns.length) {\r\n colIndex = -1;\r\n }\r\n this.#onRowClicked(e, rowIndex, colIndex);\r\n });\r\n bodyContent.addEventListener('dblclick', e => this.#onRowDblClicked(e));\r\n bodyContainer.appendChild(bodyContent);\r\n // this.#adjustRows();\r\n // events\r\n if (!this.holderDisabled) {\r\n const holder = createElement('div', 'ui-grid-hover-holder');\r\n holder.addEventListener('mousedown', e => {\r\n const holder = e.currentTarget;\r\n const row = Number(holder.dataset.row);\r\n const col = Number(holder.dataset.col);\r\n if (holder.classList.contains('active')) {\r\n holder.classList.remove('active');\r\n }\r\n return this.#onRowClicked(e, row + this.#startIndex, col);\r\n });\r\n holder.addEventListener('dblclick', e => this.#onRowDblClicked(e));\r\n bodyContainer.appendChild(holder);\r\n body.addEventListener('mousemove', e => throttle(this.#onBodyMouseMove, HoverInternal, this, e, holder), { passive: true });\r\n }\r\n this.#refs.body = body;\r\n this.#refs.bodyContainer = bodyContainer;\r\n this.#refs.bodyContent = bodyContent;\r\n\r\n // this.refresh();\r\n return body;\r\n }\r\n\r\n #adjustRows() {\r\n let count = this.#rowCount;\r\n if (isNaN(count) || count < 0 || !this.virtual) {\r\n count = this.#currentSource.length;\r\n }\r\n const cols = this.columns;\r\n const content = this.#refs.bodyContent;\r\n const exists = content.children.length;\r\n count -= exists;\r\n if (count > 0) {\r\n for (let i = 0; i < count; i += 1) {\r\n const row = createElement('tr', 'ui-grid-row');\r\n // row.addEventListener('mousedown', e => this.#onRowClicked(e, exists + i));\r\n // row.addEventListener('dblclick', e => this.#onRowDblClicked(e));\r\n cols.forEach((col, j) => {\r\n const cell = createElement('td');\r\n if (col.visible !== false) {\r\n cell.dataset.row = String(exists + i);\r\n cell.dataset.col = String(j);\r\n const style = this.#get(col.key, 'style');\r\n if (style != null) {\r\n for (let css of Object.entries(style)) {\r\n cell.style.setProperty(css[0], css[1]);\r\n }\r\n }\r\n if (col.css != null) {\r\n for (let css of Object.entries(col.css)) {\r\n cell.style.setProperty(css[0], css[1]);\r\n }\r\n }\r\n if (Grid.ColumnTypes.isCheckbox(col.type)) {\r\n cell.appendChild(GridCheckboxColumn.createEdit(e => this.#onRowChanged(e, exists + i, col, e.target.checked, cell)));\r\n // this.#colTypes[col.key] = GridCheckboxColumn;\r\n } else {\r\n let type = this.#colTypes[col.key];\r\n if (type == null) {\r\n if (isNaN(col.type)) {\r\n if (this.allowHtml && col.type != null) {\r\n type = col.type;\r\n }\r\n } else {\r\n type = ColumnTypes[col.type];\r\n }\r\n type ??= GridColumn;\r\n this.#colTypes[col.key] = type;\r\n }\r\n cell.appendChild(type.create(col));\r\n }\r\n }\r\n row.appendChild(cell);\r\n });\r\n row.appendChild(createElement('td'));\r\n content.appendChild(row);\r\n }\r\n } else if (count < 0) {\r\n for (let i = -1; i >= count; i -= 1) {\r\n // content.removeChild(content.children[exists + i]);\r\n content.children[exists + i].remove();\r\n }\r\n }\r\n }\r\n\r\n #fillRows(rows, cols, widths) {\r\n const startIndex = this.#startIndex;\r\n const selectedIndexes = this.#selectedIndexes;\r\n [...rows].forEach((row, i) => {\r\n const vals = this.#currentSource[startIndex + i];\r\n if (vals == null) {\r\n return;\r\n }\r\n if (!isPositive(row.children.length)) {\r\n return;\r\n }\r\n const item = vals.values;\r\n const selected = selectedIndexes.indexOf(startIndex + i) >= 0;\r\n if (selected) {\r\n row.classList.add('selected');\r\n } else if (row.classList.contains('selected')) {\r\n row.classList.remove('selected');\r\n }\r\n // data\r\n const selectChanged = vals.__selected ^ selected;\r\n if (selected) {\r\n vals.__selected = true;\r\n } else {\r\n delete vals.__selected;\r\n }\r\n cols.forEach((col, j) => {\r\n if (col.visible === false) {\r\n return;\r\n }\r\n let val;\r\n if (col.text != null) {\r\n val = col.text;\r\n } else if (typeof col.filter === 'function') {\r\n val = col.filter(item);\r\n } else {\r\n val = item[col.key];\r\n if (val?.displayValue != null) {\r\n val = val.displayValue;\r\n }\r\n }\r\n val ??= '';\r\n // fill\r\n const cell = row.children[j];\r\n if (typeof col.bgFilter === 'function') {\r\n const bgColor = col.bgFilter(item);\r\n cell.style.backgroundColor = bgColor ?? '';\r\n }\r\n const isCheckbox = Grid.ColumnTypes.isCheckbox(col.type);\r\n const type = isCheckbox ? GridCheckboxColumn : this.#colTypes[col.key] ?? GridColumn;\r\n let element;\r\n if (!isCheckbox && selectChanged && typeof type.createEdit === 'function') {\r\n if (vals.__editing?.[col.key] && type.editing) {\r\n val = type.getValue({ target: cell.children[0] });\r\n this.#onRowChanged(null, startIndex + i, col, val, cell, true);\r\n }\r\n element = selected ?\r\n type.createEdit(e => this.#onRowChanged(e, startIndex + i, col, type.getValue(e), cell), col, this.#refs.bodyContent, vals) :\r\n type.create(col);\r\n cell.replaceChildren(element);\r\n } else {\r\n element = cell.children[0];\r\n }\r\n let enabled;\r\n if (this.readonly) {\r\n enabled = false;\r\n } else {\r\n enabled = col.enabled;\r\n if (typeof enabled === 'function') {\r\n enabled = enabled.call(col, item);\r\n } else if (typeof enabled === 'string') {\r\n enabled = item[enabled];\r\n }\r\n }\r\n type.setValue(element, val, item, col, this);\r\n let tip = col.tooltip;\r\n if (typeof tip === 'function') {\r\n tip = tip.call(col, item);\r\n }\r\n if (nullOrEmpty(tip)) {\r\n element.querySelector('.ui-tooltip-wrapper')?.remove();\r\n } else {\r\n setTooltip(element, tip, false, this.element);\r\n }\r\n if (typeof type.setEnabled === 'function') {\r\n type.setEnabled(element, enabled);\r\n }\r\n // auto resize\r\n if (this.#needResize && this.#get(col.key, 'autoResize')) {\r\n const width = element.scrollWidth + 12;\r\n if (width > 0 && widths != null && (isNaN(widths[j]) || widths[j] < width)) {\r\n widths[j] = width;\r\n widths.flag = true;\r\n }\r\n }\r\n if (typeof col.styleFilter === 'function') {\r\n const style = col.styleFilter(item);\r\n if (style != null) {\r\n type.setStyle(element, style);\r\n }\r\n }\r\n if (col.events != null) {\r\n for (let ev of Object.entries(col.events)) {\r\n element[ev[0]] = ev[1].bind(item);\r\n }\r\n }\r\n if (col.attrs != null) {\r\n let attrs = col.attrs;\r\n if (typeof attrs === 'function') {\r\n attrs = attrs(item);\r\n }\r\n for (let attr of Object.entries(attrs)) {\r\n element.setAttribute(attr[0], attr[1]);\r\n }\r\n }\r\n });\r\n if (vals.__editing != null) {\r\n delete vals.__editing;\r\n }\r\n });\r\n }\r\n\r\n #changeColumnWidth(index, width) {\r\n const col = this.columns[index];\r\n // const oldwidth = col.width;\r\n const w = `${width}px`;\r\n col.width = width;\r\n const style = this.#get(col.key, 'style');\r\n style.width = w;\r\n style['max-width'] = w;\r\n style['min-width'] = w;\r\n let element = this.#refs.header.children[index];\r\n element.style.width = w;\r\n element.style.maxWidth = w;\r\n element.style.minWidth = w;\r\n const body = this.#refs.bodyContent;\r\n for (let row of body.children) {\r\n element = row.children[index];\r\n if (element != null) {\r\n element.style.width = w;\r\n element.style.maxWidth = w;\r\n element.style.minWidth = w;\r\n }\r\n }\r\n // } else {\r\n // width = this.#refs.bodyContainer.offsetWidth - oldwidth + width;\r\n // this.#refs.bodyContainer.style.width = `${width}px`;\r\n // }\r\n }\r\n\r\n #changingColumnOrder(index, offset, x, offsetLeft) {\r\n const children = this.#refs.header.children;\r\n let element = children[index];\r\n this.#refs.dragger.style.left = `${element.offsetLeft - offsetLeft + offset}px`;\r\n this.#refs.dragger.style.width = element.style.width;\r\n this.#refs.dragger.style.display = 'block';\r\n offset = x - getOffsetLeftFromWindow(element);\r\n let idx;\r\n if (offset < 0) {\r\n offset = -offset;\r\n for (let i = index - 1; i >= 0 && offset >= 0; i -= 1) {\r\n element = children[i];\r\n if (element == null || element.className !== 'column') {\r\n break;\r\n }\r\n if (offset < element.offsetWidth) {\r\n idx = (offset > element.offsetWidth / 2) ? i : i + 1;\r\n break;\r\n }\r\n offset -= element.offsetWidth;\r\n }\r\n idx ??= 0;\r\n } else {\r\n const count = children.length;\r\n for (let i = index; i < count - 1 && offset >= 0; i += 1) {\r\n element = children[i];\r\n if (element == null || element.className !== 'column') {\r\n idx = i;\r\n break;\r\n }\r\n if (offset < element.offsetWidth) {\r\n idx = (offset > element.offsetWidth / 2) ? i + 1 : i;\r\n break;\r\n }\r\n offset -= element.offsetWidth;\r\n }\r\n idx ??= count - 1;\r\n }\r\n if (idx !== this.#colAttrs.__orderIndex) {\r\n this.#colAttrs.__orderIndex = idx;\r\n element = children[idx];\r\n if (element == null) {\r\n return;\r\n }\r\n this.#refs.draggerCursor.style.left = `${element.offsetLeft - offsetLeft}px`;\r\n this.#refs.draggerCursor.style.display = 'block';\r\n }\r\n }\r\n\r\n #changeColumnOrder(index) {\r\n this.#refs.dragger.style.display = '';\r\n this.#refs.draggerCursor.style.display = '';\r\n const orderIndex = this.#colAttrs.__orderIndex;\r\n if (orderIndex >= 0 && orderIndex !== index) {\r\n let targetIndex = orderIndex - index;\r\n if (targetIndex >= 0 && targetIndex <= 1) {\r\n return;\r\n }\r\n const header = this.#refs.header;\r\n const children = header.children;\r\n const rows = this.#refs.bodyContent.children;\r\n const columns = this.columns;\r\n if (targetIndex > 1) {\r\n targetIndex = orderIndex - 1;\r\n // const current = columns[index];\r\n // for (let i = index; i < targetIndex; i += 1) {\r\n // columns[i] = columns[i + 1];\r\n // }\r\n // columns[targetIndex] = current;\r\n const current = columns.splice(index, 1)[0];\r\n columns.splice(targetIndex, 0, current);\r\n header.insertBefore(children[index], children[targetIndex].nextElementSibling);\r\n for (let row of rows) {\r\n row.insertBefore(row.children[index], row.children[targetIndex].nextElementSibling);\r\n }\r\n } else {\r\n targetIndex = orderIndex;\r\n // const current = columns[index];\r\n // for (let i = index; i > targetIndex; i -= 1) {\r\n // columns[i] = columns[i - 1];\r\n // }\r\n // columns[targetIndex] = current;\r\n const current = columns.splice(index, 1)[0];\r\n columns.splice(targetIndex, 0, current);\r\n header.insertBefore(children[index], children[targetIndex]);\r\n for (let row of rows) {\r\n row.insertBefore(row.children[index], row.children[targetIndex]);\r\n }\r\n }\r\n // refresh sortIndex\r\n [...children].forEach((th, i) => {\r\n const arrow = th.querySelector('.arrow');\r\n if (arrow == null) {\r\n return;\r\n }\r\n if (arrow.className !== 'arrow') {\r\n this.sortIndex = i;\r\n }\r\n });\r\n\r\n if (typeof this.columnChanged === 'function') {\r\n this.columnChanged(ColumnChangedType.Reorder, index, targetIndex);\r\n }\r\n }\r\n }\r\n\r\n #scrollToTop(top, reload) {\r\n const rowHeight = (this.rowHeight + 1);\r\n top -= (top % (rowHeight * 2)) + (RedumCount * rowHeight);\r\n if (top < 0) {\r\n top = 0;\r\n } else {\r\n let bottomTop = this.#containerHeight - (reload ? 0 : this.#rowCount * rowHeight);\r\n if (bottomTop < 0) {\r\n bottomTop = 0;\r\n }\r\n if (top > bottomTop) {\r\n top = bottomTop;\r\n }\r\n }\r\n if (this.#scrollTop !== top) {\r\n this.#scrollTop = top;\r\n if (this.virtual) {\r\n this.#startIndex = top / rowHeight;\r\n }\r\n this.refresh();\r\n if (this.virtual) {\r\n this.#refs.bodyContent.style.top = `${top}px`;\r\n }\r\n } else if (reload) {\r\n this.refresh();\r\n }\r\n\r\n return top;\r\n }\r\n\r\n #get(key, name) {\r\n const attr = this.#colAttrs[key];\r\n if (attr == null) {\r\n return null;\r\n }\r\n return attr[name];\r\n }\r\n\r\n #set(key, name, value) {\r\n const attr = this.#colAttrs[key];\r\n if (attr == null) {\r\n this.#colAttrs[key] = { [name]: value };\r\n } else {\r\n attr[name] = value;\r\n }\r\n }\r\n\r\n #getItemValue(item, key, filter) {\r\n let value;\r\n if (typeof filter === 'function') {\r\n value = filter(item);\r\n } else {\r\n value = item[key];\r\n }\r\n return value?.value ?? value;\r\n }\r\n\r\n #getRowTarget(target) {\r\n let parent;\r\n while ((parent = target.parentElement) != null && !parent.classList.contains('ui-grid-row')) {\r\n target = parent;\r\n }\r\n return [parent, target];\r\n }\r\n\r\n #notHeader(tagName) {\r\n return /^(input|label|layer|svg|use)$/i.test(tagName);\r\n }\r\n\r\n #onHeaderClicked(e, col, force) {\r\n if (!force && (this.#get(col.key, 'resizing') || this.#get(col.key, 'dragging'))) {\r\n return;\r\n }\r\n if (!this.#notHeader(e.target.tagName)) {\r\n const index = this.columns.indexOf(col);\r\n if (index < 0) {\r\n return;\r\n }\r\n if (this.sortIndex === index) {\r\n this.sortDirection = this.sortDirection === 1 ? -1 : 1;\r\n } else {\r\n this.sortIndex = index;\r\n }\r\n this.sortColumn(true);\r\n if (typeof this.columnChanged === 'function') {\r\n this.columnChanged(ColumnChangedType.Sort, index, this.sortDirection);\r\n }\r\n }\r\n }\r\n\r\n #onCloseFilter() {\r\n const panels = this.#el.querySelectorAll('.filter-panel.active');\r\n if (panels.length > 0) {\r\n panels.forEach(el => el.classList.remove('active'));\r\n setTimeout(() => this.#el.querySelectorAll('.filter-panel').forEach(el => el.remove()), 120);\r\n const filtering = this.#colAttrs.__filtering;\r\n if (filtering instanceof HTMLElement) {\r\n filtering.classList.remove('hover');\r\n }\r\n delete this.#colAttrs.__filtering;\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n #onFilter(e, col) {\r\n if (this.#onCloseFilter()) {\r\n return;\r\n }\r\n const close = e => {\r\n if ((e.target.tagName === 'LAYER' && e.target.classList.contains('filter')) ||\r\n e.target.tagName === 'use') {\r\n return;\r\n }\r\n if (this.#onCloseFilter()) {\r\n document.removeEventListener('mousedown', close);\r\n }\r\n }\r\n document.addEventListener('mousedown', close);\r\n const panel = createElement('div', 'filter-panel');\r\n panel.addEventListener('mousedown', e => e.stopPropagation());\r\n const filter = e.currentTarget;\r\n const th = filter.parentElement;\r\n const width = th.offsetWidth;\r\n panel.style.top = `${th.offsetHeight}px`;\r\n panel.style.left = (th.offsetLeft + (width > FilterPanelWidth ? width - FilterPanelWidth : 0)) + 'px';\r\n\r\n // search\r\n let searchbox;\r\n if (col.allowSearch !== false) {\r\n const searchholder = createElement('div', 'filter-search-holder');\r\n searchbox = createElement('input', 'filter-search-box ui-text');\r\n searchbox.type = 'text';\r\n const searchicon = createIcon('fa-regular', 'search');\r\n searchicon.addEventListener('mousedown', e => {\r\n searchbox.focus();\r\n e.preventDefault();\r\n });\r\n searchholder.append(searchbox, searchicon);\r\n panel.append(searchholder);\r\n }\r\n // list\r\n const itemlist = createElement('div', 'filter-item-list');\r\n itemlist.addEventListener('scroll', e => throttle(this.#onFilterScroll, RefreshInterval, this, col, itemlist, e.target.scrollTop), { passive: true });\r\n // - all\r\n const itemall = createElement('div', 'filter-item filter-all');\r\n itemall.appendChild(createCheckbox({\r\n label: this.langs.all,\r\n onchange: e => {\r\n const checked = e.target.checked;\r\n itemlist.querySelectorAll('.filter-content input').forEach(box => box.checked = checked);\r\n }\r\n }));\r\n itemlist.appendChild(itemall);\r\n // - items\r\n let array;\r\n if (Array.isArray(col.filterSource)) {\r\n array = col.filterSource;\r\n } else if (typeof col.filterSource === 'function') {\r\n array = col.filterSource.call(this, col);\r\n } else {\r\n const dict = Object.create(null);\r\n for (let item of this.#source) {\r\n const val = this.#getItemValue(item.values, col.key, col.filter);\r\n if (!Object.hasOwnProperty.call(dict, val)) {\r\n const v = item.values[col.key];\r\n dict[val] = {\r\n value: val,\r\n displayValue: typeof col.filter === 'function' ? col.filter(item.values) : v?.displayValue ?? v\r\n };\r\n }\r\n }\r\n array = Object.values(dict)\r\n .sort((a, b) => {\r\n a = a?.value ?? a;\r\n b = b?.value ?? b;\r\n return a > b ? 1 : a < b ? -1 : 0;\r\n });\r\n }\r\n array = array.map(i => {\r\n if (Object.prototype.hasOwnProperty.call(i, 'value') &&\r\n Object.prototype.hasOwnProperty.call(i, 'displayValue')) {\r\n return i;\r\n }\r\n return {\r\n value: i,\r\n displayValue: i == null ? '' : i\r\n };\r\n });\r\n this.#fillFilterList(col, itemlist, array, itemall);\r\n itemall.querySelector('input').checked = ![...itemlist.querySelectorAll('.filter-content input')].some(i => !i.checked);\r\n panel.appendChild(itemlist);\r\n if (searchbox != null) {\r\n searchbox.addEventListener('input', e => {\r\n const key = e.currentTarget.value.toLowerCase();\r\n const items = key.length === 0 ? array : array.filter(i => {\r\n const displayValue = i?.displayValue ?? i;\r\n return String(displayValue ?? '').indexOf(key) >= 0;\r\n });\r\n this.#fillFilterList(col, itemlist, items, itemall);\r\n });\r\n }\r\n // function\r\n const functions = createElement('div', 'filter-function');\r\n functions.append(\r\n createElement('button', ok => {\r\n ok.innerText = this.langs.ok;\r\n ok.addEventListener('click', () => {\r\n const array = this.#get(col.key, 'filterSource').filter(i => i.__checked !== false);\r\n if (typeof col.onFilterOk === 'function') {\r\n col.onFilterOk.call(this, col, array);\r\n } else {\r\n col.filterValues = array.map(a => a.value);\r\n }\r\n this.#colAttrs.__filtered = true;\r\n this.#refreshSource();\r\n if (typeof col.onFiltered === 'function') {\r\n col.onFiltered.call(this, col);\r\n }\r\n filter.classList.add('active');\r\n this.#onCloseFilter();\r\n });\r\n }),\r\n createElement('button', reset => {\r\n reset.innerText = this.langs.reset;\r\n reset.addEventListener('click', () => {\r\n delete col.filterValues;\r\n this.#colAttrs.__filtered = this.columns.some(c => col.filterValues != null)\r\n this.#refreshSource();\r\n if (typeof col.onFiltered === 'function') {\r\n col.onFiltered.call(this, col);\r\n }\r\n filter.classList.remove('active');\r\n this.#onCloseFilter();\r\n });\r\n })\r\n );\r\n panel.appendChild(functions);\r\n\r\n this.#el.appendChild(panel);\r\n setTimeout(() => panel.classList.add('active'), 0);\r\n this.#colAttrs.__filtering = filter;\r\n filter.classList.add('hover');\r\n }\r\n\r\n #fillFilterList(col, list, array, all) {\r\n list.querySelector('.filter-holder')?.remove();\r\n list.querySelector('.filter-content')?.remove();\r\n const rowHeight = this.filterRowHeight;\r\n const height = array.length * rowHeight;\r\n this.#set(col.key, 'filterHeight', height);\r\n const holder = createElement('div', 'filter-holder');\r\n holder.style.height = `${height}px`;\r\n const content = createElement('div', 'filter-content');\r\n content.style.top = `${rowHeight}px`;\r\n this.#set(col.key, 'filterSource', array);\r\n for (let item of array) {\r\n item.__checked = !Array.isArray(col.filterValues) || col.filterValues.indexOf(item.value ?? item) >= 0;\r\n }\r\n if (array.length > 12) {\r\n array = array.slice(0, 12);\r\n }\r\n this.#doFillFilterList(content, array, all);\r\n list.append(holder, content);\r\n }\r\n\r\n #doFillFilterList(content, array, all) {\r\n for (let item of array) {\r\n const div = createElement('div', 'filter-item');\r\n div.appendChild(createCheckbox({\r\n checked: item.__checked,\r\n label: item?.displayValue ?? item,\r\n onchange: e => {\r\n item.__checked = e.target.checked;\r\n all.querySelector('input').checked = ![...content.querySelectorAll('input')].some(i => !i.checked);\r\n }\r\n }));\r\n content.appendChild(div);\r\n }\r\n }\r\n\r\n #onFilterScroll(col, list, top) {\r\n const rowHeight = this.filterRowHeight;\r\n top -= (top % (rowHeight * 2)) + rowHeight;\r\n if (top < 0) {\r\n top = 0;\r\n } else {\r\n let bottomTop = this.#get(col.key, 'filterHeight') - (12 * rowHeight);\r\n if (bottomTop < 0) {\r\n bottomTop = 0;\r\n }\r\n if (top > bottomTop) {\r\n top = bottomTop;\r\n }\r\n }\r\n if (this.#get(col.key, 'filterTop') !== top) {\r\n this.#set(col.key, 'filterTop', top);\r\n const startIndex = top / rowHeight;\r\n let array = this.#get(col.key, 'filterSource');\r\n if (startIndex + 12 < array.length) {\r\n array = array.slice(startIndex, startIndex + 12);\r\n } else {\r\n array = array.slice(-12);\r\n }\r\n const content = list.querySelector('.filter-content');\r\n content.replaceChildren();\r\n this.#doFillFilterList(content, array, list.querySelector('.filter-all>input'));\r\n content.style.top = `${top + rowHeight}px`;\r\n }\r\n }\r\n\r\n #onDragStart(e, col) {\r\n if (this.#notHeader(e.target.tagName)) {\r\n return;\r\n }\r\n const cx = getClientX(e);\r\n const index = indexOfParent(e.currentTarget);\r\n const clearEvents = attr => {\r\n for (let event of ['mousemove', 'mouseup']) {\r\n if (attr.hasOwnProperty(event)) {\r\n window.removeEventListener(event, attr[event]);\r\n delete attr[event];\r\n }\r\n }\r\n };\r\n let attr = this.#colAttrs[col.key];\r\n if (attr == null) {\r\n attr = this.#colAttrs[col.key] = {};\r\n } else {\r\n clearEvents(attr);\r\n }\r\n attr.dragging = true;\r\n const offsetLeft = this.#refs.header.querySelector('th:last-child').offsetLeft;\r\n const dragmove = e => {\r\n const cx2 = getClientX(e);\r\n const offset = cx2 - cx;\r\n let pos = attr.offset;\r\n let dragging;\r\n if (pos == null && (offset > MiniDragOffset || offset < -MiniDragOffset)) {\r\n dragging = true;\r\n } else if (pos !== offset) {\r\n dragging = true;\r\n }\r\n if (dragging) {\r\n this.#changingColumnOrder(index, offset, cx2, offsetLeft);\r\n attr.offset = offset;\r\n }\r\n };\r\n attr.mousemove = e => throttle(dragmove, RefreshInterval, this, e);\r\n attr.mouseup = () => {\r\n clearEvents(attr);\r\n if (attr.offset == null) {\r\n delete attr.dragging;\r\n } else {\r\n setTimeout(() => {\r\n delete attr.dragging;\r\n delete attr.offset;\r\n });\r\n this.#changeColumnOrder(index);\r\n }\r\n };\r\n ['mousemove', 'mouseup'].forEach(event => window.addEventListener(event, attr[event]));\r\n }\r\n\r\n #onResizeStart(e, col) {\r\n const cx = getClientX(e);\r\n const width = col.width;\r\n const index = indexOfParent(e.currentTarget.parentElement);\r\n const window = this.window ?? global;\r\n const clearEvents = attr => {\r\n for (let event of ['mousemove', 'mouseup']) {\r\n if (attr.hasOwnProperty(event)) {\r\n window.removeEventListener(event, attr[event]);\r\n delete attr[event];\r\n }\r\n }\r\n };\r\n let attr = this.#colAttrs[col.key];\r\n if (attr == null) {\r\n attr = this.#colAttrs[col.key] = {};\r\n } else {\r\n clearEvents(attr);\r\n }\r\n attr.resizing = width;\r\n const resizemove = e => {\r\n const cx2 = getClientX(e);\r\n const val = width + (cx2 - cx);\r\n if (val < MiniColumnWidth) {\r\n return;\r\n }\r\n attr.resizing = val;\r\n attr.sizing = true;\r\n this.#changeColumnWidth(index, val);\r\n };\r\n attr.mousemove = e => throttle(resizemove, RefreshInterval, this, e);\r\n attr.mouseup = e => {\r\n clearEvents(attr);\r\n const width = attr.resizing;\r\n if (width != null) {\r\n setTimeout(() => delete attr.resizing);\r\n if (attr.sizing) {\r\n delete attr.sizing;\r\n delete attr.autoResize;\r\n this.#changeColumnWidth(index, width);\r\n if (typeof this.columnChanged === 'function') {\r\n this.columnChanged(ColumnChangedType.Resize, index, width);\r\n }\r\n }\r\n }\r\n e.stopPropagation();\r\n e.preventDefault();\r\n };\r\n ['mousemove', 'mouseup'].forEach(event => window.addEventListener(event, attr[event]));\r\n }\r\n\r\n #onAutoResize(e, col) {\r\n const th = e.currentTarget.parentElement;\r\n const index = indexOfParent(th);\r\n let width = th.querySelector('div:first-child').scrollWidth;\r\n for (let row of this.#refs.bodyContent.children) {\r\n const element = row.children[index].children[0];\r\n const w = element.scrollWidth;\r\n if (w > width) {\r\n width = w;\r\n }\r\n }\r\n if (width < MiniColumnWidth) {\r\n width = MiniColumnWidth;\r\n }\r\n if (width > 0 && width !== col.width) {\r\n width += 12;\r\n this.#changeColumnWidth(index, width);\r\n if (typeof this.columnChanged === 'function') {\r\n this.columnChanged(ColumnChangedType.Resize, index, width);\r\n }\r\n }\r\n }\r\n\r\n #onColumnAllChecked(col, flag) {\r\n if (this.#currentSource == null) {\r\n return;\r\n }\r\n const key = col.key;\r\n const isFunction = typeof col.enabled === 'function';\r\n const isString = typeof col.enabled === 'string';\r\n if (typeof col.onallchecked === 'function') {\r\n col.onallchecked.call(this, col, flag);\r\n } else {\r\n for (let row of this.#currentSource) {\r\n const item = row.values;\r\n if (item == null) {\r\n continue;\r\n }\r\n const enabled = isFunction ? col.enabled(item) : isString ? item[col.enabled] : col.enabled;\r\n if (enabled !== false) {\r\n item[key] = flag;\r\n row.__changed = true;\r\n if (typeof col.onchanged === 'function') {\r\n col.onchanged.call(this, item, flag);\r\n }\r\n }\r\n }\r\n this.refresh();\r\n }\r\n }\r\n\r\n #onScroll(e) {\r\n const left = e.target.scrollLeft;\r\n if (this.#scrollLeft !== left) {\r\n this.#scrollLeft = left;\r\n this.#refs.header.style.left = `${-left}px`;\r\n }\r\n if (!this.virtual) {\r\n return;\r\n }\r\n const top = e.target.scrollTop;\r\n this.#scrollToTop(top);\r\n }\r\n\r\n #onBodyMouseMove(e, holder) {\r\n if (e.target.classList.contains('ui-grid-hover-holder')) {\r\n return;\r\n }\r\n let [parent, target] = this.#getRowTarget(e.target);\r\n if (parent == null) {\r\n delete holder.dataset.row;\r\n delete holder.dataset.col;\r\n if (holder.classList.contains('active')) {\r\n holder.classList.remove('active');\r\n }\r\n return;\r\n }\r\n const element = target.children[0];\r\n if (element?.tagName !== 'SPAN') {\r\n if (holder.classList.contains('active')) {\r\n delete holder.dataset.row;\r\n delete holder.dataset.col;\r\n holder.classList.remove('active');\r\n }\r\n return;\r\n }\r\n const row = target.dataset.row;\r\n const col = target.dataset.col;\r\n if (holder.dataset.row === row &&\r\n holder.dataset.col === col) {\r\n return;\r\n }\r\n if (element.scrollWidth > element.offsetWidth) {\r\n holder.dataset.row = row;\r\n holder.dataset.col = col;\r\n holder.innerText = element.innerText;\r\n const top = this.#refs.bodyContent.offsetTop + target.offsetTop;\r\n let left = target.offsetLeft;\r\n let width = holder.offsetWidth;\r\n if (width > this.#bodyClientWidth) {\r\n width = this.#bodyClientWidth;\r\n }\r\n const maxleft = this.#bodyClientWidth + this.#scrollLeft - width;\r\n if (left > maxleft) {\r\n left = maxleft;\r\n }\r\n const height = target.offsetHeight;\r\n holder.style.cssText = `top: ${top}px; left: ${left}px; max-width: ${this.#bodyClientWidth}px; height: ${height - 2}px`;\r\n holder.classList.add('active');\r\n } else if (holder.classList.contains('active')) {\r\n delete holder.dataset.row;\r\n delete holder.dataset.col;\r\n holder.classList.remove('active');\r\n }\r\n }\r\n\r\n #onRowClicked(e, index, colIndex) {\r\n const startIndex = this.#startIndex;\r\n const selectedIndex = startIndex + index;\r\n if (typeof this.willSelect === 'function' && !this.willSelect(selectedIndex, colIndex)) {\r\n return;\r\n }\r\n // multi-select\r\n let flag = false;\r\n const selectedIndexes = this.#selectedIndexes;\r\n if (this.multiSelect) {\r\n if (e.ctrlKey) {\r\n const i = selectedIndexes.indexOf(selectedIndex);\r\n if (i < 0) {\r\n selectedIndexes.push(selectedIndex);\r\n } else {\r\n selectedIndexes.splice(i, 1);\r\n }\r\n flag = true;\r\n } else if (e.shiftKey && selectedIndexes.length > 0) {\r\n if (selectedIndexes.length > 1 || selectedIndexes[0] !== selectedIndex) {\r\n let start = selectedIndexes[selectedIndexes.length - 1];\r\n let end;\r\n if (start > selectedIndex) {\r\n end = start;\r\n start = selectedIndex;\r\n } else {\r\n end = selectedIndex;\r\n }\r\n selectedIndexes.splice(0);\r\n for (let i = start; i <= end; i += 1) {\r\n selectedIndexes.push(i);\r\n }\r\n flag = true;\r\n }\r\n }\r\n }\r\n if (!flag && selectedIndexes.length !== 1 || selectedIndexes[0] !== selectedIndex) {\r\n selectedIndexes.splice(0, selectedIndexes.length, selectedIndex);\r\n flag = true;\r\n }\r\n // apply style\r\n if (flag) {\r\n if (this.readonly !== true) {\r\n this.refresh();\r\n } else {\r\n [...this.#refs.bodyContent.children].forEach((row, i) => {\r\n if (selectedIndexes.indexOf(startIndex + i) >= 0) {\r\n row.classList.add('selected');\r\n } else if (row.classList.contains('selected')) {\r\n row.classList.remove('selected');\r\n }\r\n });\r\n }\r\n if (typeof this.selectedRowChanged === 'function') {\r\n this.selectedRowChanged(selectedIndex);\r\n }\r\n }\r\n this.#selectedColumnIndex = colIndex;\r\n if ((this.fullrowClick || colIndex >= 0) && e.buttons === 1 && typeof this.cellClicked === 'function') {\r\n if (this.cellClicked(selectedIndex, colIndex) === false) {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n }\r\n }\r\n }\r\n\r\n #onRowDblClicked(e) {\r\n if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA' || e.target.tagName === 'LAYER' && e.target.className === 'ui-check-inner' || e.target.tagName === 'LABEL' && (e.target.className === 'ui-drop-text' || e.target.className === 'ui-drop-caret')) {\r\n return;\r\n }\r\n const index = this.selectedIndex;\r\n if (typeof this.rowDblClicked === 'function') {\r\n this.rowDblClicked(index);\r\n }\r\n if (typeof this.cellDblClicked === 'function') {\r\n const colIndex = this.#selectedColumnIndex;\r\n if (this.fullrowClick || colIndex >= 0) {\r\n this.cellDblClicked(index, colIndex);\r\n }\r\n }\r\n }\r\n\r\n #onRowChanged(_e, index, col, value, cell, blur) {\r\n if (this.#currentSource == null) {\r\n return;\r\n }\r\n const row = this.#currentSource[this.#startIndex + index];\r\n const item = row.values;\r\n if (item == null) {\r\n return;\r\n }\r\n let enabled = col.enabled;\r\n if (typeof enabled === 'function') {\r\n enabled = enabled.call(col, item);\r\n } else if (typeof enabled === 'string') {\r\n enabled = item[enabled];\r\n }\r\n if (enabled !== false) {\r\n item[col.key] = value;\r\n let tip = col.tooltip;\r\n if (typeof tip === 'function') {\r\n tip = tip.call(col, item);\r\n }\r\n if (nullOrEmpty(tip)) {\r\n cell.querySelector('.ui-tooltip-wrapper')?.remove();\r\n } else {\r\n setTooltip(cell.children[0], tip, false, this.element);\r\n }\r\n row.__changed = true;\r\n if (blur) {\r\n if (typeof col.oneditend === 'function') {\r\n col.oneditend.call(this, item, value);\r\n }\r\n } else {\r\n if (typeof col.onchanged === 'function') {\r\n col.onchanged.call(this, item, value);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default Grid;","import \"./css/popup.scss\";\r\nimport { r } from \"../utility/lgres\";\r\nimport { nullOrEmpty } from \"../utility/strings\";\r\nimport { global } from \"../utility\";\r\nimport { createElement } from \"../functions\";\r\nimport { createIcon, changeIcon } from \"./icon\";\r\n\r\nconst ResizeMods = {\r\n right: 1,\r\n bottom: 2,\r\n left: 4,\r\n top: 8,\r\n bottomRight: 2 | 1,\r\n bottomLeft: 2 | 4,\r\n topRight: 8 | 1,\r\n topLeft: 8 | 4\r\n}\r\n\r\n// const Cursors = {\r\n// [ResizeMods.right]: 'ew-resize',\r\n// [ResizeMods.bottom]: 'ns-resize',\r\n// [ResizeMods.bottomRight]: 'nwse-resize',\r\n// [ResizeMods.left]: 'ew-resize',\r\n// [ResizeMods.bottomLeft]: 'nesw-resize',\r\n// [ResizeMods.top]: 'ns-resize',\r\n// [ResizeMods.topRight]: 'nesw-resize',\r\n// [ResizeMods.topLeft]: 'nwse-resize'\r\n// }\r\n\r\nfunction trimPx(px) {\r\n if (typeof px !== 'string') {\r\n return px;\r\n }\r\n if (px.endsWith('px')) {\r\n const size = Number(px.substring(0, px.length - 2));\r\n return isNaN(size) ? px : size;\r\n }\r\n return px;\r\n}\r\n\r\nclass Popup {\r\n #mask;\r\n #option;\r\n #bounds;\r\n // #cursor;\r\n\r\n constructor(opts = {}) {\r\n this.#option = opts;\r\n }\r\n\r\n get container() { return this.#mask.querySelector('.ui-popup-container') }\r\n\r\n get rect() {\r\n const container = this.container;\r\n if (container == null) {\r\n return null;\r\n }\r\n const style = global.getComputedStyle(container);\r\n const collapsed = container.classList.contains('ui-popup-collapse');\r\n const bounds = this.#bounds;\r\n return {\r\n collapsed,\r\n left: trimPx(style.left),\r\n top: trimPx(style.top),\r\n width: collapsed === true && bounds != null ? bounds.width : trimPx(style.width),\r\n height: collapsed === true && bounds != null ? bounds.height : trimPx(style.height)\r\n };\r\n }\r\n set rect(r) {\r\n const container = this.container;\r\n if (container == null) {\r\n return;\r\n }\r\n const css = [];\r\n if (!isNaN(r.left)) {\r\n css.push(`left: ${r.left}px`);\r\n }\r\n if (!isNaN(r.top)) {\r\n css.push(`top: ${r.top}px`);\r\n }\r\n const collapse = container.querySelector('.ui-popup-header-icons>.icon-expand');\r\n if (r.collapsed === true) {\r\n css.push('width: 160px', 'height: 40px');\r\n this.#bounds = r;\r\n container.classList.add('ui-popup-collapse');\r\n if (collapse != null) {\r\n changeIcon(collapse, 'fa-regular', 'expand-alt');\r\n }\r\n } else {\r\n if (!isNaN(r.width) && r.width > 0) {\r\n css.push(`width: ${r.width}px`);\r\n }\r\n if (!isNaN(r.height) && r.height > 0) {\r\n css.push(`height: ${r.height}px`);\r\n }\r\n container.classList.remove('ui-popup-collapse');\r\n this.#bounds = null;\r\n if (collapse != null) {\r\n changeIcon(collapse, 'fa-regular', 'compress-alt');\r\n }\r\n }\r\n if (css.length > 0) {\r\n container.style.cssText += css.join('; ');\r\n }\r\n }\r\n\r\n close(animation = true) {\r\n const mask = this.#mask;\r\n if (animation) {\r\n mask.classList.add('ui-popup-active');\r\n mask.style.opacity = 0;\r\n setTimeout(() => { mask.remove(); }, 120);\r\n } else {\r\n mask.remove();\r\n }\r\n if (typeof this.#option.onMasking === 'function') {\r\n this.#option.onMasking.call(this, false);\r\n }\r\n }\r\n\r\n create() {\r\n const mask = createElement('div', 'ui-popup-mask');\r\n const option = this.#option;\r\n if (option.mask === false) {\r\n mask.classList.add('ui-popup-transparent');\r\n } else if (typeof option.onMasking === 'function') {\r\n this.#option.onMasking.call(this, true);\r\n }\r\n if (!isNaN(option.zIndex)) {\r\n mask.style.zIndex = String(option.zIndex);\r\n }\r\n const container = createElement('div', 'ui-popup-container');\r\n if (option.changeZIndex === true) {\r\n container.addEventListener('mousedown', () => {\r\n const masks = [...this.#mask.parentElement.children].filter(e => e.classList.contains('ui-popup-mask'));\r\n let max = 200;\r\n masks.forEach(m => {\r\n let index;\r\n if (m.dataset.zindex != null) {\r\n index = parseInt(m.dataset.zindex);\r\n m.style.zIndex = isNaN(index) ? '' : String(index);\r\n delete m.dataset.zindex;\r\n } else {\r\n index = parseInt(m.style.zIndex);\r\n }\r\n if (index > max) {\r\n max = index;\r\n }\r\n });\r\n mask.dataset.zindex = mask.style.zIndex;\r\n mask.style.zIndex = max + 1;\r\n });\r\n } else {\r\n\r\n }\r\n let tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0));\r\n if (tabIndex < 0) {\r\n tabIndex = 0;\r\n }\r\n container.tabIndex = tabIndex + 1;\r\n let content = option.content;\r\n if (!(content instanceof HTMLElement)) {\r\n content = createElement('div', d => d.innerText = content);\r\n }\r\n container.append(\r\n createElement('div', header => {\r\n header.className = 'ui-popup-header';\r\n let title = option.title;\r\n if (!(title instanceof HTMLElement)) {\r\n title = createElement('div', t => {\r\n t.className = 'ui-popup-header-title';\r\n t.innerText = title;\r\n });\r\n }\r\n header.appendChild(title);\r\n if (option.movable !== false) {\r\n const move = header; // title.querySelector('.ui-popup-move') ?? title;\r\n move.addEventListener('mousedown', e => {\r\n if (['svg', 'use'].includes(e.target?.tagName)) {\r\n return;\r\n }\r\n if (e.buttons !== 1) {\r\n return;\r\n }\r\n const parent = option.mask === false ? mask.parentElement : mask;\r\n const x = e.clientX - container.offsetLeft;\r\n const y = e.clientY - container.offsetTop;\r\n let moved;\r\n const move = e => {\r\n if (e.buttons === 1) {\r\n container.style.left = `${e.clientX - x}px`;\r\n container.style.top = `${e.clientY - y}px`;\r\n moved = true;\r\n } else {\r\n parent.dispatchEvent(new MouseEvent('mouseup'));\r\n }\r\n };\r\n parent.addEventListener('mousemove', move, { passive: false });\r\n const up = () => {\r\n parent.removeEventListener('mousemove', move, { passive: false });\r\n parent.removeEventListener('mouseup', up);\r\n if (moved === true && typeof option.onMoveEnded === 'function') {\r\n option.onMoveEnded.call(this);\r\n }\r\n moved = false;\r\n };\r\n parent.addEventListener('mouseup', up);\r\n });\r\n }\r\n const icons = createElement('div', icons => {\r\n icons.className = 'ui-popup-header-icons';\r\n if (option.collapsable === true) {\r\n const collapse = createIcon('fa-regular', 'compress-alt');\r\n collapse.tabIndex = tabIndex + 2;\r\n collapse.classList.add('icon-expand');\r\n collapse.addEventListener('keypress', e => {\r\n if (e.key === ' ' || e.key === 'Enter') {\r\n collapse.dispatchEvent(new MouseEvent('click'));\r\n }\r\n });\r\n collapse.addEventListener('click', () => {\r\n if (container.classList.contains('ui-popup-collapse')) {\r\n const bounds = this.#bounds;\r\n if (bounds != null) {\r\n container.style.cssText += `width: ${bounds.width}px; height: ${bounds.height}px`;\r\n this.#bounds = null;\r\n }\r\n container.classList.remove('ui-popup-collapse');\r\n changeIcon(collapse, 'fa-regular', 'compress-alt');\r\n } else {\r\n const rect = this.rect;\r\n this.#bounds = rect;\r\n container.style.cssText += `width: 160px; height: 40px`;\r\n container.classList.add('ui-popup-collapse');\r\n changeIcon(collapse, 'fa-regular', 'expand-alt');\r\n }\r\n if (typeof option.onResizeEnded === 'function') {\r\n option.onResizeEnded.call(this);\r\n }\r\n });\r\n icons.appendChild(collapse);\r\n }\r\n const cancel = createIcon('fa-regular', 'times');\r\n cancel.tabIndex = tabIndex + 3;\r\n cancel.addEventListener('keypress', e => {\r\n if (e.key === ' ' || e.key === 'Enter') {\r\n this.close();\r\n }\r\n });\r\n cancel.addEventListener('click', () => this.close());\r\n icons.appendChild(cancel);\r\n });\r\n header.appendChild(icons);\r\n }),\r\n createElement('div', 'ui-popup-body', content, createElement('div', 'ui-popup-loading',\r\n createElement('div', null, createIcon('fa-regular', 'spinner-third'))\r\n ))\r\n );\r\n if (Array.isArray(option.buttons) && option.buttons.length > 0) {\r\n tabIndex = Math.max.apply(null, [...container.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0));\r\n container.appendChild(\r\n createElement('div', 'ui-popup-footer', ...option.buttons.map((b, i) => {\r\n const button = createElement('button', 'ui-popup-button');\r\n if (b.tabIndex > 0) {\r\n button.tabIndex = b.tabIndex;\r\n } else {\r\n button.tabIndex = tabIndex + i + 1;\r\n }\r\n button.innerText = b.text;\r\n button.addEventListener('click', () => {\r\n if (typeof b.trigger === 'function') {\r\n const result = b.trigger(this);\r\n if (typeof result?.then === 'function') {\r\n result.then(r => {\r\n if (r !== false) {\r\n this.close();\r\n }\r\n }).catch(reason => console.warn(reason));\r\n } else if (result !== false) {\r\n this.close();\r\n }\r\n } else {\r\n this.close();\r\n }\r\n });\r\n return button;\r\n }))\r\n );\r\n const tabs = [...container.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0);\r\n const tabMin = Math.min.apply(null, tabs);\r\n const tabMax = Math.max.apply(null, tabs);\r\n const last = container.querySelector(`[tabindex=\"${tabMax}\"]`);\r\n if (last != null) {\r\n last.addEventListener('keydown', e => {\r\n if (e.key === 'Tab') {\r\n const first = container.querySelector(`[tabindex=\"${tabMin}\"]`);\r\n first?.focus();\r\n e.preventDefault();\r\n }\r\n });\r\n }\r\n } else {\r\n container.querySelector('.ui-popup-body>.ui-popup-loading').classList.add('ui-popup-loading-content');\r\n }\r\n // resizable\r\n if (option.resizable === true) {\r\n container.append(\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-right';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.right, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-bottom';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.bottom, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-left';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.left, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-top';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.top, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-bottom-right';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.bottomRight, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-bottom-left';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.bottomLeft, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-top-left';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.topLeft, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-top-right';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.topRight, e));\r\n })\r\n )\r\n }\r\n mask.appendChild(container);\r\n this.#mask = mask;\r\n return mask;\r\n }\r\n\r\n show(parent = document.body) {\r\n if (parent == null) {\r\n return;\r\n }\r\n let mask = this.#mask ?? this.create();\r\n // const exists = [...parent.children].filter(e => e.classList.contains('ui-popup-mask'));\r\n const exists = parent.querySelectorAll('.ui-popup-mask');\r\n let zindex = 0;\r\n for (let ex of exists) {\r\n let z = parseInt(ex.style.zIndex);\r\n if (!isNaN(z) && z > zindex) {\r\n zindex = z;\r\n }\r\n }\r\n if (zindex > 0) {\r\n mask.style.zIndex = String(zindex + 1);\r\n }\r\n parent.appendChild(mask);\r\n if (this.#option.mask === false) {\r\n // calculator position\r\n const container = this.container;\r\n container.style.left = String((parent.offsetWidth - container.offsetWidth) / 2) + 'px';\r\n container.style.top = String((parent.offsetHeight - container.offsetHeight) / 2) + 'px';\r\n }\r\n return new Promise(resolve => {\r\n setTimeout(() => {\r\n mask.style.opacity = 1;\r\n this.container.focus();\r\n resolve(mask);\r\n }, 0);\r\n });\r\n }\r\n\r\n get loading() { return this.#mask?.querySelector('.ui-popup-body>.ui-popup-loading')?.style?.visibility === 'visible' }\r\n set loading(flag) {\r\n let loading = this.#mask?.querySelector('.ui-popup-body>.ui-popup-loading');\r\n if (loading == null) {\r\n return;\r\n }\r\n if (flag === false) {\r\n loading.style.visibility = 'hidden';\r\n loading.style.opacity = 0;\r\n } else {\r\n loading.style.visibility = 'visible';\r\n loading.style.opacity = 1;\r\n }\r\n }\r\n\r\n #resize(mod, e) {\r\n if (e.buttons !== 1) {\r\n return;\r\n }\r\n const container = this.container;\r\n const option = this.#option;\r\n if (typeof option.onResizeStarted === 'function') {\r\n option.onResizeStarted.call(this);\r\n }\r\n const mask = this.#mask;\r\n // this.#cursor = mask.style.cursor;\r\n // mask.style.cursor = Cursors[mod];\r\n const originalX = e.clientX;\r\n const originalY = e.clientY;\r\n const original = {\r\n width: container.offsetWidth,\r\n height: container.offsetHeight,\r\n left: container.offsetLeft,\r\n top: container.offsetTop\r\n };\r\n const minWidth = option.minWidth ?? 200;\r\n const minHeight = option.minHeight ?? 200;\r\n let resized;\r\n const parent = option.mask === false ? mask.parentElement : mask;\r\n const move = e => {\r\n if (e.buttons !== 1) {\r\n parent.dispatchEvent(new MouseEvent('mouseup'));\r\n return;\r\n }\r\n const offsetX = e.clientX - originalX;\r\n const offsetY = e.clientY - originalY;\r\n let width = original.width;\r\n let height = original.height;\r\n let x = original.left;\r\n let y = original.top;\r\n if ((mod & ResizeMods.right) === ResizeMods.right) {\r\n width += offsetX;\r\n if (width < minWidth) {\r\n width = minWidth;\r\n }\r\n }\r\n if ((mod & ResizeMods.bottom) === ResizeMods.bottom) {\r\n height += offsetY;\r\n if (height < minHeight) {\r\n height = minHeight;\r\n }\r\n }\r\n if ((mod & ResizeMods.left) === ResizeMods.left) {\r\n width -= offsetX;\r\n if (width < minWidth) {\r\n width = minWidth;\r\n x = originalX + original.width - minWidth;\r\n } else {\r\n x += offsetX;\r\n }\r\n }\r\n if ((mod & ResizeMods.top) === ResizeMods.top) {\r\n height -= offsetY;\r\n if (height < minHeight) {\r\n height = minHeight;\r\n y = originalY + original.height - minHeight;\r\n } else {\r\n y += offsetY;\r\n }\r\n }\r\n if (typeof option.onResizing === 'function') {\r\n option.onResizing.call(this, x, y, width, height);\r\n } else {\r\n container.style.cssText += `left: ${x}px; top: ${y}px; width: ${width}px; height: ${height}px`;\r\n }\r\n resized = true;\r\n }\r\n parent.addEventListener('mousemove', move, { passive: false });\r\n const up = () => {\r\n parent.removeEventListener('mousemove', move, { passive: false });\r\n parent.removeEventListener('mouseup', up);\r\n // mask.style.cursor = this.#cursor;\r\n if (resized === true && typeof option.onResizeEnded === 'function') {\r\n option.onResizeEnded.call(this);\r\n }\r\n resized = false;\r\n };\r\n parent.addEventListener('mouseup', up);\r\n }\r\n}\r\n\r\nexport default Popup;\r\n\r\nexport function createPopup(title, content, ...buttons) {\r\n const popup = new Popup({\r\n title,\r\n content,\r\n buttons\r\n });\r\n return popup;\r\n}\r\n\r\nconst iconTypes = {\r\n 'info': 'info-circle',\r\n 'information': 'info-circle',\r\n 'warn': 'exclamation-triangle',\r\n 'warning': 'exclamation-triangle',\r\n 'question': 'question-circle',\r\n 'error': 'times-circle'\r\n}\r\n\r\nexport function showAlert(title, message, iconType = 'info', parent = document.body) {\r\n return new Promise(resolve => {\r\n const popup = new Popup({\r\n title,\r\n content: createElement('div', 'message-wrapper',\r\n createIcon('fa-solid', iconTypes[iconType] ?? 'info-circle'),\r\n createElement('span', span => span.innerText = message)\r\n ),\r\n buttons: [\r\n { text: r('ok', 'OK'), trigger: resolve }\r\n ]\r\n });\r\n popup.show(parent).then(mask => {\r\n const button = mask.querySelector('.ui-popup-container .ui-popup-footer .ui-popup-button:last-child');\r\n button?.focus();\r\n });\r\n });\r\n}\r\n\r\nexport function showConfirm(title, content, buttons, iconType = 'question', parent = document.body) {\r\n return new Promise(resolve => {\r\n const wrapper = createElement('div', 'message-wrapper');\r\n if (!nullOrEmpty(iconType)) {\r\n wrapper.appendChild(createIcon('fa-solid', iconTypes[iconType] ?? 'question-circle'));\r\n }\r\n wrapper.appendChild(content instanceof HTMLElement ?\r\n content :\r\n createElement('span', span => span.innerText = content));\r\n const popup = new Popup({\r\n title,\r\n content: wrapper,\r\n buttons: buttons?.map(b => {\r\n return {\r\n text: b.text,\r\n trigger: p => {\r\n let result;\r\n if (typeof b.trigger === 'function') {\r\n result = b.trigger(p, b);\r\n if (typeof result?.then === 'function') {\r\n return result.then(r => {\r\n r !== false && resolve(r);\r\n return r;\r\n });\r\n }\r\n result !== false && resolve(result);\r\n } else {\r\n result = {\r\n key: b.key,\r\n popup: p\r\n };\r\n resolve(result);\r\n }\r\n return result;\r\n }\r\n };\r\n }) ??\r\n [\r\n { text: r('yes', 'Yes'), trigger: p => resolve({ key: 'yes', popup: p }) },\r\n { text: r('no', 'No'), trigger: p => resolve({ key: 'no', popup: p }) }\r\n ]\r\n });\r\n popup.show(parent).then(mask => {\r\n const button = mask.querySelector('.ui-popup-container .ui-popup-footer .ui-popup-button:last-child');\r\n button?.focus();\r\n });\r\n });\r\n}"],"names":["createElement","tagName","init","children","element","svgns","createUse","type","id","c","path","ver","use","changeIcon","svg","createIcon","style","css","resolveIcon","container","svgs","icon","fillCheckbox","label","tabindex","charactor","layer","e","input","span","createRadiobox","opts","entry","createCheckbox","resolveCheckbox","legacy","checks","chk","text","boxes","box","setTooltip","content","flag","parent","isParent","tipid","tip","wrapper","cnt","tipId","tid","p","left","top","offsetParent","t","offsetHeight","resolveTooltip","tips","title","nullOrEmpty","s","contains","key","ignoreCase","r","defaultValue","g","isPositive","n","isMobile","throttle","method","delay","context","args","current","truncate","v","SymbolDropdown","DropdownTitleHeight","DropdownItemHeight","dropdownGlobal","global","panel","dropId","dropdown","selectItems","itemlist","htmlkey","textkey","htmls","it","filterSource","searchkeys","source","k","_Dropdown","options","__privateAdd","_expanded","_dropdown","_filllist","_triggerselect","_options","_wrapper","_container","_label","_allChecked","_source","_lastSelected","_selected","_selectedList","__publicField","__privateSet","__privateGet","header","up","down","count","valuekey","index","target","_a","__privateMethod","dropdown_fn","active","expanded_get","filllist_fn","list","selected","silence","item","expanded","li","html","val","selectedlist","dom","selects","sel","drop","Dropdown","_b","search","value","multiselect","allchecked","triggerselect_fn","scrolled","i","checkbox","GridColumn","enabled","tooltip","GridInputColumn","trigger","col","_parent","vals","GridTextColumn","_item","_col","grid","lines","_GridDropdownColumn","_getSource","getSource_fn","_setValue","setValue_fn","_getDrop","getDrop_fn","GridDropdownColumn","dropGlobal","data","__superGet","GridCheckboxColumn","GridIconColumn","className","ColumnChangedType","RefreshInterval","HoverInternal","RedumCount","MiniDragOffset","MiniColumnWidth","FilterPanelWidth","getClientX","getOffsetLeftFromWindow","indexOfParent","ColumnTypes","_Grid","_refreshSource","_createHeader","_createBody","_adjustRows","_fillRows","_changeColumnWidth","_changingColumnOrder","_changeColumnOrder","_scrollToTop","_get","_set","_getItemValue","_getRowTarget","_notHeader","_onHeaderClicked","_onCloseFilter","_onFilter","_fillFilterList","_doFillFilterList","_onFilterScroll","_onDragStart","_onResizeStart","_onAutoResize","_onColumnAllChecked","_onScroll","_onBodyMouseMove","_onRowClicked","_onRowDblClicked","_onRowChanged","_currentSource","_el","_refs","_rendering","_selectedColumnIndex","_selectedIndexes","_startIndex","_needResize","_containerHeight","_bodyClientWidth","_rowCount","_scrollTop","_scrollLeft","_colTypes","_colAttrs","_vtable","refreshSource_fn","indexes","startIndex","row","sizer","createHeader_fn","body","createBody_fn","loading","scrollToTop_fn","force","height","length","adjustRows_fn","rows","widths","fillRows_fn","get_fn","width","changeColumnWidth_fn","reload","direction","th","arrow","comparer","a","b","getItemValue_fn","Grid","thead","hidden","onHeaderClicked_fn","isCheckbox","set_fn","w","onDragStart_fn","check","onColumnAllChecked_fn","caption","filter","onFilter_fn","spliter","onResizeStart_fn","onAutoResize_fn","dragger","draggerCursor","onScroll_fn","cols","bodyContainer","bodyContent","getRowTarget_fn","rowIndex","colIndex","onRowClicked_fn","onRowDblClicked_fn","holder","onBodyMouseMove_fn","exists","j","cell","onRowChanged_fn","selectedIndexes","selectChanged","bgColor","ev","attrs","attr","changingColumnOrder_fn","offset","x","offsetLeft","idx","changeColumnOrder_fn","orderIndex","targetIndex","columns","rowHeight","bottomTop","name","notHeader_fn","onCloseFilter_fn","panels","el","filtering","close","searchbox","searchholder","searchicon","onFilterScroll_fn","itemall","checked","array","dict","fillFilterList_fn","items","displayValue","functions","ok","reset","all","doFillFilterList_fn","div","cx","clearEvents","event","dragmove","cx2","pos","dragging","window","resizemove","isFunction","isString","maxleft","selectedIndex","start","end","_e","blur","ResizeMods","trimPx","px","size","Popup","_resize","_mask","_option","_bounds","collapsed","bounds","collapse","animation","mask","option","masks","max","m","tabIndex","d","y","moved","move","icons","rect","cancel","button","result","reason","tabs","tabMin","tabMax","last","first","resize_fn","zindex","ex","z","resolve","_c","mod","originalX","originalY","original","minWidth","minHeight","resized","offsetX","offsetY","createPopup","buttons","iconTypes","showAlert","message","iconType","showConfirm"],"mappings":"opCAAO,SAASA,EAAcC,EAASC,KAASC,EAAU,CACtD,MAAMC,EAAU,SAAS,cAAcH,CAAO,EAC9C,OAAI,OAAOC,GAAS,WAChBA,EAAKE,CAAO,EACLF,GAAQ,OACfE,EAAQ,UAAYF,GAEpBC,EAAS,OAAS,GAClBC,EAAQ,OAAO,GAAGD,CAAQ,EAEvBC,CACX,CCXA,MAAMC,GAAQ,6BAEd,SAASC,GAAUC,EAAMC,EAAI,CACzB,MAAMC,EAAI,OAAO,OAAW,IAAc,OAAS,CAAA,EAC7CC,EAAOD,EAAE,MAAQ,GACjBE,EAAMF,EAAE,QAAU,KAAO,GAAK,IAAIA,EAAE,SACpCG,EAAM,SAAS,gBAAgBP,GAAO,KAAK,EACjD,OAAAO,EAAI,eAAe,+BAAgC,aAAc,GAAGF,UAAaH,QAAWI,KAAOH,GAAI,EAChGI,CACX,CAEA,SAASC,GAAWC,EAAKP,EAAMC,EAAI,CAC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