This commit is contained in:
tsanie committed 2023-05-05 17:05:23 +08:00
1 parent d831a707ae
commit e728c66786
25 files changed
+150 -144

No files matched your search

+1 -1
View File
@@ -49,7 +49,7 @@
// checkbox
name: 'check',
key: 'Selected',
width: 30,
width: 40,
align: 'center',
sortable: false,
allcheck: true,
+1 -1
View File
@@ -1 +1 @@
.ui-popup-mask .wrapper-edit-method{width:100%}.ui-popup-mask .wrapper-edit-method .ui-check-wrapper{padding:0 28px}.comm{display:flex;flex-direction:column;width:320px;background-color:var(--dark-fore-color);border:1px solid var(--title-bg-color);margin-left:12px}.comm{--dark-fore-color: #fff;--dark-fore-opacity-color: rgba(255, 255, 255, .6);--strong-color: #333;--light-color: #ccc}.comm .roundbtn{width:30px;height:30px;display:inline-block;box-sizing:border-box;cursor:pointer;padding:7px;margin-left:10px;fill:var(--dark-fore-color);border-radius:15px;border:none;transition:background-color .2s;-webkit-user-select:none;-ms-user-select:none;user-select:none}.comm .roundbtn:focus,.comm .roundbtn:focus-visible{outline:none}.comm .roundbtn:hover{background-color:var(--dark-fore-opacity-color)}.comm .roundbtn:hover>svg{opacity:.6}.comm .roundbtn.disabled,.comm .roundbtn:disabled{background-color:transparent!important}.comm .roundbtn.disabled,.comm .roundbtn:disabled{fill:#d3d3d3}.comm .roundbtn.disabled:hover>svg,.comm .roundbtn:disabled:hover>svg{opacity:1;opacity:initial}.comm .roundbtn>svg{width:13px;height:14px;display:block;transition:opacity .2s}.comm .title-bar{flex:0 0 auto;padding:5px 0 5px 10px;color:var(--title-color);background-color:var(--title-bg-color);line-height:24px;display:flex;align-items:center;font-size:var(--font-larger-size)}.comm .title-bar>div{flex:1 1 auto}.comm .title-bar>.title-functions{flex:0 0 auto;display:flex;padding:4px}.comm .title-bar>.title-functions>label{margin:0 4px;box-sizing:border-box;cursor:pointer;width:30px;height:30px;background-color:var(--dark-fore-color);border-radius:15px;display:flex;align-items:center;justify-content:center;transition:background-color .2s}.comm .title-bar>.title-functions>label>svg{fill:var(--strong-color);width:14px;height:14px;transition:opacity .2s}.comm .title-bar>.title-functions>label:hover{background-color:var(--dark-fore-opacity-color)}.comm .title-bar>.title-functions>label:hover>svg{opacity:.6}.comm .title-bar>.title-functions>label.disabled{cursor:default;opacity:.6}.comm .title-bar>.title-functions>label.disabled:hover{background-color:var(--dark-fore-color)}.comm .title-bar>.title-functions>label.disabled:hover>svg{opacity:1;opacity:initial}.comm .contact-bar{flex:0 0 auto;padding:4px 0;display:flex;border-bottom:1px solid var(--title-bg-color)}.comm .contact-bar>.bar-icon{flex:0 0 auto}.comm .contact-bar>.bar-icon>svg{width:30px;height:30px;margin:0 8px}.comm .contact-bar>.bar-list{flex:1 1 auto;width:calc(100% - 46px)}.comm .contact-bar>.bar-list .contact-item{display:flex;align-items:center;line-height:22px}.comm .contact-bar>.bar-list .contact-item>svg{flex:0 0 auto;width:16px;height:16px;margin-right:6px;fill:var(--strong-color)}.comm .contact-bar>.bar-list .contact-item>span{color:var(--strong-color);font-size:var(--font-size);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-right:10px}.comm .contact-bar .roundbtn{float:right;margin:4px 10px 10px}.comm .contact-bar .roundbtn>svg{width:16px}.comm .message-bar{flex:0 0 auto;border-bottom:1px solid var(--title-bg-color);display:flex;flex-direction:column}.comm .message-bar>textarea{padding:10px 10px 0;border:none;height:70px;resize:none;font-size:var(--font-smaller-size);font-family:var(--font-family)}.comm .message-bar>textarea:focus,.comm .message-bar>textarea:focus-visible{outline:none}.comm .message-bar>div{padding:0 10px 10px}.comm .message-bar>div>.customer-name{float:left}.comm .message-bar>div>.customer-name>span{font-size:var(--font-smaller-size)}.comm .message-bar>div>.customer-name>.ui-input{margin-left:4px;width:150px;border-top:none;border-left:none;border-right:none}.comm .message-bar>div>.prompt-count{display:inline-block;color:var(--light-color);font-size:var(--font-smaller-size)}.comm .list-bar{flex:1 1 auto;overflow:auto;margin-top:8px}.comm .list-bar .item-div{margin-top:5px;border-bottom:solid 1px lightgray;padding:3px 10px 5px;line-height:1.5rem;white-space:normal;word-break:break-word;overflow:hidden;font-size:var(--font-size);color:#333;display:flex;flex-direction:column}.comm .list-bar .item-div:last-child{border-bottom:none}.comm .list-bar .item-div .item-poster{font-weight:700;font-size:var(--font-size);align-self:flex-start}.comm .list-bar .item-div .item-poster .ui-tooltip-wrapper>.ui-tooltip-content{font-weight:400}.comm .list-bar .item-div .item-content{line-height:1.2rem;padding:8px 20px;border-radius:5px;white-space:pre-wrap;word-break:break-word;max-width:240px;background-color:#f4f4f4}.comm .list-bar .item-div .item-content a>svg{width:13px;height:13px;fill:#2140fb}.comm .list-bar .item-div .item-content a>svg:hover{border-bottom:1px solid}.comm .list-bar .item-div .item-content>span:after{content:"";display:block}.comm .list-bar .item-div .item-content .item-status{text-align:right;margin-top:3px;font-weight:700;margin-right:-12px;font-size:.625rem;float:right}.comm .list-bar .item-div .item-time{align-self:flex-end;color:Line truncated
.ui-popup-mask .wrapper-edit-method{width:100%}.ui-popup-mask .wrapper-edit-method .ui-check-wrapper{padding:0 28px}.comm{display:flex;flex-direction:column;width:320px;background-color:var(--dark-fore-color);border:1px solid var(--title-bg-color);margin-left:12px}.comm{--dark-fore-color: #fff;--dark-fore-opacity-color: rgba(255, 255, 255, .6);--strong-color: #333;--light-color: #ccc}.comm .roundbtn{width:30px;height:30px;display:inline-block;box-sizing:border-box;cursor:pointer;padding:7px;margin-left:10px;fill:var(--dark-fore-color);border-radius:15px;border:none;transition:background-color .2s;-webkit-user-select:none;-ms-user-select:none;user-select:none}.comm .roundbtn:focus,.comm .roundbtn:focus-visible{outline:none}.comm .roundbtn:hover{background-color:var(--dark-fore-opacity-color)}.comm .roundbtn:hover>svg{opacity:.6}.comm .roundbtn.disabled,.comm .roundbtn:disabled{background-color:transparent!important}.comm .roundbtn.disabled,.comm .roundbtn:disabled{fill:#d3d3d3}.comm .roundbtn.disabled:hover>svg,.comm .roundbtn:disabled:hover>svg{opacity:1;opacity:initial}.comm .roundbtn>svg{width:13px;height:14px;display:block;transition:opacity .2s}.comm .title-bar{flex:0 0 auto;padding:5px 0 5px 10px;color:var(--title-color);background-color:var(--title-bg-color);line-height:24px;display:flex;align-items:center;font-size:var(--font-larger-size)}.comm .title-bar>div{flex:1 1 auto}.comm .title-bar>.title-functions{flex:0 0 auto;display:flex;padding:4px}.comm .title-bar>.title-functions>label{margin:0 4px;box-sizing:border-box;cursor:pointer;width:30px;height:30px;background-color:var(--dark-fore-color);border-radius:15px;display:flex;align-items:center;justify-content:center;transition:background-color .2s}.comm .title-bar>.title-functions>label>svg{fill:var(--strong-color);width:14px;height:14px;transition:opacity .2s}.comm .title-bar>.title-functions>label:hover{background-color:var(--dark-fore-opacity-color)}.comm .title-bar>.title-functions>label:hover>svg{opacity:.6}.comm .title-bar>.title-functions>label.disabled{cursor:default;opacity:.6}.comm .title-bar>.title-functions>label.disabled:hover{background-color:var(--dark-fore-color)}.comm .title-bar>.title-functions>label.disabled:hover>svg{opacity:1;opacity:initial}.comm .contact-bar{flex:0 0 auto;padding:4px 0;display:flex;border-bottom:1px solid var(--title-bg-color)}.comm .contact-bar>.bar-icon{flex:0 0 auto}.comm .contact-bar>.bar-icon>svg{width:30px;height:30px;margin:0 8px}.comm .contact-bar>.bar-list{flex:1 1 auto;width:calc(100% - 46px)}.comm .contact-bar>.bar-list .bar-list-container{max-height:120px;overflow:auto}.comm .contact-bar>.bar-list .contact-item{display:flex;align-items:center;line-height:22px}.comm .contact-bar>.bar-list .contact-item>svg{flex:0 0 auto;width:16px;height:16px;margin-right:6px;fill:var(--strong-color)}.comm .contact-bar>.bar-list .contact-item>span{color:var(--strong-color);font-size:var(--font-size);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-right:10px}.comm .contact-bar .roundbtn{float:right;margin:4px 10px 10px}.comm .contact-bar .roundbtn>svg{width:16px}.comm .message-bar{flex:0 0 auto;border-bottom:1px solid var(--title-bg-color);display:flex;flex-direction:column}.comm .message-bar>textarea{padding:10px 10px 0;border:1px solid var(--title-bg-color);border-radius:5px;height:70px;resize:none;font-size:var(--font-smaller-size);font-family:var(--font-family);margin:3px 5px;background:#f0f0f0}.comm .message-bar>textarea:focus,.comm .message-bar>textarea:focus-visible{outline:none}.comm .message-bar>div{padding:0 10px 10px}.comm .message-bar>div>.customer-name{float:left}.comm .message-bar>div>.customer-name>span{font-size:var(--font-smaller-size)}.comm .message-bar>div>.customer-name>.ui-input{margin-left:4px;width:150px;border-top:none;border-left:none;border-right:none}.comm .message-bar>div>.prompt-count{display:inline-block;color:var(--light-color);font-size:var(--font-smaller-size)}.comm .list-bar{flex:1 1 auto;overflow:auto;margin-top:8px}.comm .list-bar .item-div{margin-top:5px;border-bottom:solid 1px lightgray;padding:3px 10px 5px;line-height:1.5rem;white-space:normal;word-break:break-word;overflow:hidden;font-size:var(--font-size);color:#333;display:flex;flex-direction:column}.comm .list-bar .item-div:last-child{border-bottom:none}.comm .list-bar .item-div .item-poster{font-weight:700;font-size:var(--font-size);align-self:flex-start}.comm .list-bar .item-div .item-poster .ui-tooltip-wrapper>.ui-tooltip-content{font-weight:400}.comm .list-bar .item-div .item-content{line-height:1.2rem;padding:8px 20px;border-radius:5px;white-space:pre-wrap;word-break:break-word;max-width:240px;background-color:#f4f4f4}.comm .list-bar .item-div .item-content a>svg{width:13px;height:13px;fill:#2140fb}.comm .list-bar .item-div .item-content a>svg:hover{border-bottom:1px solid}.comm .list-bar .item-div .item-content>span:after{content:"";display:block}.comm .list-bar .item-div .item-content .item-status{tLine truncated
+8 -8
View File
@@ -1,12 +1,12 @@
(function(k,S){typeof exports=="object"&&typeof module<"u"?S(exports):typeof define=="function"&&define.amd?define(["exports"],S):(k=typeof globalThis<"u"?globalThis:k||self,S(k["lib-app"]={}))})(this,function(k){var A,L,z,Q,x,E,X,Z,ie,V,H,P,_,j,ue,ee,me,te,he,be,Le,ge,Pe,we,Fe,Y,F,G,ne;"use strict";var Se=(k,S,M)=>{if(!S.has(k))throw TypeError("Cannot "+M)};var t=(k,S,M)=>(Se(k,S,"read from private field"),M?M.call(k):S.get(k)),C=(k,S,M)=>{if(S.has(k))throw TypeError("Cannot add the same private member more than once");S instanceof WeakSet?S.add(k):S.set(k,M)},T=(k,S,M,ae)=>(Se(k,S,"write to private field"),ae?ae.call(k,M):S.set(k,M),M);var xe=(k,S,M)=>(Se(k,S,"access private method"),M);const S="",M=window["lib-ui"].createElement;function ae(se,e){const n=M("div","comm"),a=M("div","title-bar",se,M("div","title-functions",...e));return n.appendChild(a),n}const De=window["lib-ui"].Dropdown,O=window["lib-ui"].createElement,$e=window["lib-ui"].createCheckbox,Ae=window["lib-ui"].createPopup,Ce=window["lib-ui"].showAlert,Ue=window["lib-utility"].isEmail,re=window["lib-utility"].nullOrEmpty,N=window["lib-utility"].r;class Ee{constructor(e={}){C(this,A,void 0);C(this,L,void 0);T(this,A,e)}async show(e=document.body){const n=Math.max.apply(null,[...document.querySelectorAll("[tabindex]")].map(i=>i.tabIndex??0))+3,a=t(this,A).contact,y=O("input",i=>{i.type="text",i.className="ui-input",i.tabIndex=n+1,i.maxLength=200,i.autocomplete="off"}),m=new De({tabIndex:n+2});m.source=[{value:"0",text:N("text","Text")},{value:"1",text:N("email","Email")},{value:"2",text:N("phone","Phone")}];const o=O("input",i=>{i.type="email",i.className="ui-input",i.tabIndex=n+3,i.maxLength=100,i.autocomplete="off"}),r=O("input",i=>{i.type="tel",i.className="ui-input",i.tabIndex=n+4,i.maxLength=50,i.autocomplete="off"}),s=$e({tabIndex:n+5}),d=O("textarea",i=>{i.className="ui-text",i.tabIndex=n+6,i.maxLength=2e3,i.style.height="100px"}),b=[];t(this,A).company&&b.push({text:a==null?N("addContactRecord","Add Contact Record"):N("editContactRecord","Edit Contact Record"),trigger:()=>{const i=this.prepare();if(i==null)return!1;if(i.SaveToCustomer=1,typeof t(this,A).onSave=="function")return t(this,A).onSave.call(this,i,"customerrecord")}}),b.push({text:N("workOrderOnly","Work Order Only"),trigger:()=>{const i=this.prepare();if(i==null)return!1;if(i.Id=-1,i.SaveToCustomer=0,typeof t(this,A).onSave=="function")return t(this,A).onSave.call(this,i,"workorder")}},{text:N("cancel","Cancel")});const p=Ae(a==null?N("addContact","Add Contact"):N("editContact","Edit Contact"),O("div",i=>{i.className="setting-wrapper",i.style.width="500px"},O("div","setting-item",O("span","setting-label setting-required",N("contactNameColon","Contact Name:")),y),O("div","setting-item",O("span","setting-label",N("contactPreferencesColon","Contact Preferences:")),m.create()),O("div","setting-item",O("span","setting-label",N("contactEmailColon","Email Address:")),o),O("div","setting-item",O("span","setting-label",N("contactMobileColon","Mobile:")),r),O("div","setting-item",O("span","setting-label",N("contactOptColon","Opt Out:")),s),O("div","setting-item",O("span","setting-label",N("contactNotesColon","Notes:")),d)),...b);a!=null?(y.value=a.Name,m.select(String(a.ContactPreference)),o.value=a.Email,r.value=a.MobilePhone,s.querySelector("input").checked=a.OptOut,d.value=a.Notes):m.select("0"),T(this,L,{contactName:y,preferences:m,contactEmail:o,contactMobile:r,checkOpt:s,contactNotes:d});const g=await p.show(e);return setTimeout(()=>y.focus()),g}prepare(){const e=t(this,L).contactName.value,n=t(this,L).preferences.selected.value,a=t(this,L).contactEmail.value,y=t(this,L).contactMobile.value,m=t(this,L).checkOpt.querySelector("input").checked,o=t(this,L).contactNotes.value,r=t(this,A).contact==null?N("addContact","Add Contact"):N("editContact","Edit Contact");if(re(e))return Ce(r,N("contactNameRequired","Contact Name cannot be empty."),"warn").then(()=>t(this,L).contactName.focus()),null;if(re(a)&&re(y))return Ce(r,N("contactEmailPhoneRequired","Email and Mobile Phone cannot both be empty."),"warn").then(()=>re(a)?t(this,L).contactEmail.focus():t(this,L).contactMobile.focus()),null;if(!re(a)&&!Ue(a))return Ce(r,N("contactEmailInvalid","The email address is invalid."),"warn").then(()=>t(this,L).contactEmail.focus()),null;let s=t(this,A).contact;return s==null?s={}:s.OptOut!==m&&(m!==!1||s.OptOut_BC===!1)&&(s.selected=!m),s.Name=e,s.ContactPreference=n,s.Email=a,s.MobilePhone=y,s.OptOut=m,s.Notes=o,s}}A=new WeakMap,L=new WeakMap;const ke=window["lib-ui"].Grid,pe=window["lib-ui"].createElement,We=window["lib-ui"].createPopup,Te=window["lib-utility"].nullOrEmpty,J=window["lib-utility"].r,He=window["lib-utility"].contains;class _e{constructor(e={}){C(this,z,void 0);C(this,Q,void 0);T(this,z,e)}async show(e=document.body){const n=Math.max.apply(null,[...document.querySelectorAll("[tabindex]")].map(r=>r.tabIndex??0))+3,a=pe("div","follower-grid"),m=await We(J("addFollowers","Add FolloweLine truncated
${p}`),I(d,p)}t(this,H).scrollTop=t(this,H).scrollHeight}}set readonly(e){if(t(this,E).readonly=e,t(this,x)==null)return;const n=t(this,x).querySelector(".check-status-link");e===!0?n.classList.add("disabled"):n.classList.remove("disabled"),n.querySelector("input").disabled=e;const a=e===!0?"none":"";t(this,x).querySelector(".button-edit-contacts").style.display=a,t(this,x).querySelector(".button-edit-followers").style.display=a,t(this,x).querySelector(".message-bar").style.display=a}set recordReadonly(e){t(this,E).recordReadonly=e,t(this,x)!=null&&(t(this,x).querySelector(".button-edit-contacts").style.display=e===!0?"none":"",t(this,x).querySelector(".button-edit-followers").style.display=e===!0?"none":"")}set companyName(e){t(this,E).companyName=e;const n=t(this,x).querySelector(".title-company");v(e)?n.style.display="none":(n.innerText=e,n.style.display="")}set companyCode(e){t(this,E).companyCode=e;const n=t(this,x).querySelector(".title-company");v(t(this,E).companyName)?n.style.display="none":(n.innerText=t(this,E).companyName,v(e)||(n.innerText=t(this,E).companyName+"/"+e),n.style.display="")}get followers(){return[...t(this,Z).children].map(e=>{const n=e.querySelector("span");return{Email:n.dataset.email,MobilePhone:n.dataset.mp,Value:n.dataset.name}})}set followers(e){if(t(this,P).followers=e,t(this,Z).replaceChildren(),(e==null?void 0:e.length)>0){t(this,x).querySelector(".follower-bar").style.display="",t(this,x).querySelector(".follower-bar>.bar-list").appendChild(t(this,ie));for(let n of e){if(n.OptOut)continue;const a=String(n.MobilePhone).trim(),y=String(n.Email).trim(),m=[];n.SendEmail&&m.push(l("emailsToColon","Emails to:")+` ${y}`),n.SendText&&m.push(l("textsToColon",`Texts to: ${a}`));let o;n.SendText&&n.SendEmail?o="at":o=n.SendText?"comment-lines":"envelope";const r=h("span",d=>{n.SendEmail&&(d.dataset.email=y),n.SendText&&(d.dataset.mp=a),d.dataset.name=n.Name,d.innerText=n.Name}),s=h("div","contact-item",$("fa-light",o),r);t(this,Z).appendChild(s),r.scrollWidth>r.offsetWidth&&m.splice(0,0,l("nameColon","Name:")+` ${c.Name}`),I(r,m.join(`
`))}}else t(this,x).querySelector(".follower-bar").style.display="none",t(this,x).querySelector(".button-edit-contacts").insertAdjacentElement("beforebegin",t(this,ie));t(this,H).scrollTop=t(this,H).scrollHeight}setData(e,n){t(this,P)[e]=n}create(){const e=t(this,E),n=e.readonly,a=fe({className:"check-auto-update",checked:e.autoUpdates,checkedNode:$("fa-regular","redo-alt"),uncheckedNode:$("fa-regular","ban"),onchange:function(){I(a,this.checked?l("autoUpdateEnabled","Auto Updates Enabled"):l("autoUpdateDisabled","Auto Updates Disabled"))}});e.autoUpdatesVisible===!1&&(a.style.display="none");const y=fe({className:"check-status-link",enabled:!n,checked:e.statusLink,checkedNode:$("fa-regular","link"),uncheckedNode:$("fa-regular","unlink"),onchange:function(){I(y,this.checked?l("statusLinkIncluded","Status Link Included"):l("statusLinkExcluded","Status Link Excluded"))}});e.statusLinkVisible===!1&&(y.style.display="none");const m=ae(h("div",null,h("div",s=>{s.className="title-module",s.innerText=e.title??l("messages","Customer Communication")}),h("div",s=>{s.className="title-company",v(e.companyName)?s.style.display="none":v(e.companyCode)?s.innerText=e.companyName:s.innerText=e.companyName+"/"+e.companyCode})),[I(a,l("autoUpdateEnabled","Auto Updates Enabled")),I(y,l("statusLinkExcluded","Status Link Excluded"))]);T(this,X,xe(this,be,Le).call(this,m,e)),T(this,Z,xe(this,ge,Pe).call(this,m,e));const o=h("textarea","ui-text");o.placeholder=l("typeMessage","Enter Message Here"),e.maxLength??(e.maxLength=3e3),o.maxLength=e.maxLength,o.addEventListener("input",()=>{const s=t(this,V).value,d=String(v(s)?0:s.length)+"/"+String(e.maxLength);t(this,x).querySelector(".message-bar .prompt-count").innerText=d}),T(this,V,o),m.appendChild(h("div",s=>{s.className="message-bar",n===!0&&(s.style.display="none")},o,h("div",s=>s.style.textAlign="right",h("div",s=>{s.className="customer-name",e.customerNameVisible!==!0&&(s.style.display="none")},h("span",s=>s.innerText=l("nameColon","Name:")),h("input",s=>{s.type="text",s.className="ui-input"})),h("div","prompt-count"),h("button",s=>{s.className="roundbtn button-send-message",s.style.backgroundColor="rgb(19, 150, 204)",s.appendChild($("fa-solid","paper-plane")),I(s,l("sendMessage","Send Message")),s.addEventListener("click",()=>{const d=t(this,V).value;if(v(d==null?void 0:d.trim())){ce(l("error","Error"),l("messageRequired","Please input the message."),"warn");return}typeof t(this,E).onAddMessage=="function"&&t(this,E).onAddMessage(t(this,V).value)})}))));const r=h("div","list-bar");return T(this,H,r),m.appendChild(r),T(this,x,m)}load(e,n,a){var m;const y=[];if((e==null?void 0:e.length)>0){n??(n=t(this,P).contacts),a??(a=t(this,P).allfollowers);for(let o of e){const r=h("div","item-div");let s;if(o.IsReply&&(n==null?void 0:n.length)>0){const p=ye(o.Sender)?n.find(g=>g.Email===o.Sender):n.find(g=>g.MobilePhone===o.Sender);s=p==null?void 0:p.Name}s??(s=o.IsReply&&String(o.FormatSender)!==""?o.FormatSender:o.Sender);let d="";if(!o.IsReply&&((m=o.OriPhoneNumbers)==null?void 0:m.length)>0)for(let p of o.OriPhoneNumbers){let g;const i=ye(p);if((n==null?void 0:n.length)>0){let w=i?n.find(f=>f.Email===p):n.find(f=>f.MobilePhone===p);w!=null?g=`${i?w.Email:w.MobilePhoneDisplayText} - ${w.Name}`:(a==null?void 0:a.length)>0&&(w=i?a.find(f=>f.Email===p):a.find(f=>f.MobilePhone===p),w!=null&&(g=`${i?w.Email:w.MobilePhoneDisplayText} - ${w.Name}`))}d+=(g??p)+`
(function(k,E){typeof exports=="object"&&typeof module<"u"?E(exports):typeof define=="function"&&define.amd?define(["exports"],E):(k=typeof globalThis<"u"?globalThis:k||self,E(k["lib-app"]={}))})(this,function(k){var $,L,z,Q,x,v,X,Z,ie,B,W,V,H,j,ue,ee,me,te,he,be,Le,ge,Pe,we,Fe,Y,P,G,ne;"use strict";var Se=(k,E,M)=>{if(!E.has(k))throw TypeError("Cannot "+M)};var t=(k,E,M)=>(Se(k,E,"read from private field"),M?M.call(k):E.get(k)),C=(k,E,M)=>{if(E.has(k))throw TypeError("Cannot add the same private member more than once");E instanceof WeakSet?E.add(k):E.set(k,M)},T=(k,E,M,ae)=>(Se(k,E,"write to private field"),ae?ae.call(k,M):E.set(k,M),M);var xe=(k,E,M)=>(Se(k,E,"access private method"),M);const E="",M=window["lib-ui"].createElement;function ae(se,e){const n=M("div","comm"),a=M("div","title-bar",se,M("div","title-functions",...e));return n.appendChild(a),n}const De=window["lib-ui"].Dropdown,O=window["lib-ui"].createElement,$e=window["lib-ui"].createCheckbox,Ae=window["lib-ui"].createPopup,Ce=window["lib-ui"].showAlert,Ue=window["lib-utility"].isEmail,re=window["lib-utility"].nullOrEmpty,S=window["lib-utility"].r;class Ee{constructor(e={}){C(this,$,void 0);C(this,L,void 0);T(this,$,e)}async show(e=document.body){const n=Math.max.apply(null,[...document.querySelectorAll("[tabindex]")].map(i=>i.tabIndex??0))+3,a=t(this,$).contact,y=O("input",i=>{i.type="text",i.className="ui-input",i.tabIndex=n+1,i.maxLength=200,i.autocomplete="off"}),m=new De({tabIndex:n+2});m.source=[{value:"0",text:S("text","Text")},{value:"1",text:S("email","Email")},{value:"2",text:S("phone","Phone")}];const o=O("input",i=>{i.type="email",i.className="ui-input",i.tabIndex=n+3,i.maxLength=100,i.autocomplete="off"}),r=O("input",i=>{i.type="tel",i.className="ui-input",i.tabIndex=n+4,i.maxLength=50,i.autocomplete="off"}),s=$e({tabIndex:n+5}),d=O("textarea",i=>{i.className="ui-text",i.tabIndex=n+6,i.maxLength=2e3,i.style.height="100px"}),b=[];t(this,$).company&&b.push({text:a==null?S("addContactRecord","Add Contact Record"):S("editContactRecord","Edit Contact Record"),trigger:()=>{const i=this.prepare();if(i==null)return!1;if(i.SaveToCustomer=1,typeof t(this,$).onSave=="function")return t(this,$).onSave.call(this,i,"customerrecord")}}),b.push({text:S("workOrderOnly","Work Order Only"),trigger:()=>{const i=this.prepare();if(i==null)return!1;if(i.Id=-1,i.SaveToCustomer=0,typeof t(this,$).onSave=="function")return t(this,$).onSave.call(this,i,"workorder")}},{text:S("cancel","Cancel")});const p=Ae(a==null?S("addContact","Add Contact"):S("editContact","Edit Contact"),O("div",i=>{i.className="setting-wrapper",i.style.width="500px"},O("div","setting-item",O("span","setting-label setting-required",S("contactNameColon","Contact Name:")),y),O("div","setting-item",O("span","setting-label",S("contactPreferencesColon","Contact Preferences:")),m.create()),O("div","setting-item",O("span","setting-label",S("contactEmailColon","Email Address:")),o),O("div","setting-item",O("span","setting-label",S("contactMobileColon","Mobile:")),r),O("div","setting-item",O("span","setting-label",S("contactOptColon","Opt Out:")),s),O("div","setting-item",O("span","setting-label",S("contactNotesColon","Notes:")),d)),...b);a!=null?(y.value=a.Name,m.select(String(a.ContactPreference)),o.value=a.Email,r.value=a.MobilePhone,s.querySelector("input").checked=a.OptOut,d.value=a.Notes):m.select("0"),T(this,L,{contactName:y,preferences:m,contactEmail:o,contactMobile:r,checkOpt:s,contactNotes:d});const g=await p.show(e);return setTimeout(()=>y.focus()),g}prepare(){const e=t(this,L).contactName.value,n=t(this,L).preferences.selected.value,a=t(this,L).contactEmail.value,y=t(this,L).contactMobile.value,m=t(this,L).checkOpt.querySelector("input").checked,o=t(this,L).contactNotes.value,r=t(this,$).contact==null?S("addContact","Add Contact"):S("editContact","Edit Contact");if(re(e))return Ce(r,S("contactNameRequired","Contact Name cannot be empty."),"warn").then(()=>t(this,L).contactName.focus()),null;if(re(a)&&re(y))return Ce(r,S("contactEmailPhoneRequired","Email and Mobile Phone cannot both be empty."),"warn").then(()=>re(a)?t(this,L).contactEmail.focus():t(this,L).contactMobile.focus()),null;if(!re(a)&&!Ue(a))return Ce(r,S("contactEmailInvalid","The email address is invalid."),"warn").then(()=>t(this,L).contactEmail.focus()),null;let s=t(this,$).contact;return s==null?s={}:s.OptOut!==m&&(m!==!1||s.OptOut_BC===!1)&&(s.selected=!m),s.Name=e,s.ContactPreference=n,s.Email=a,s.MobilePhone=y,s.OptOut=m,s.Notes=o,s}}$=new WeakMap,L=new WeakMap;const ke=window["lib-ui"].Grid,pe=window["lib-ui"].createElement,We=window["lib-ui"].createPopup,Te=window["lib-utility"].nullOrEmpty,J=window["lib-utility"].r,He=window["lib-utility"].contains;class _e{constructor(e={}){C(this,z,void 0);C(this,Q,void 0);T(this,z,e)}async show(e=document.body){const n=Math.max.apply(null,[...document.querySelectorAll("[tabindex]")].map(r=>r.tabIndex??0))+3,a=pe("div","follower-grid"),m=await We(J("addFollowers","Add FolloweLine truncated
${p}`),I(d,p)}t(this,W).scrollTop=t(this,W).scrollHeight}}set readonly(e){if(t(this,v).readonly=e,t(this,x)==null)return;const n=t(this,x).querySelector(".check-status-link");e===!0?n.classList.add("disabled"):n.classList.remove("disabled"),n.querySelector("input").disabled=e;const a=e===!0?"none":"";t(this,x).querySelector(".button-edit-contacts").style.display=a,t(this,x).querySelector(".button-edit-followers").style.display=a,t(this,x).querySelector(".message-bar").style.display=a}set recordReadonly(e){t(this,v).recordReadonly=e,t(this,x)!=null&&(t(this,x).querySelector(".button-edit-contacts").style.display=e===!0?"none":"",t(this,x).querySelector(".button-edit-followers").style.display=e===!0?"none":"")}set companyName(e){t(this,v).companyName=e;const n=t(this,x).querySelector(".title-company");N(e)?n.style.display="none":(n.innerText=e,n.style.display="")}set companyCode(e){t(this,v).companyCode=e;const n=t(this,x).querySelector(".title-company");N(t(this,v).companyName)?n.style.display="none":(n.innerText=t(this,v).companyName,N(e)||(n.innerText=t(this,v).companyName+"/"+e),n.style.display="")}get followers(){return[...t(this,Z).children].map(e=>{const n=e.querySelector("span");return{Email:n.dataset.email,MobilePhone:n.dataset.mp,Value:n.dataset.name}})}set followers(e){if(t(this,V).followers=e,t(this,Z).replaceChildren(),(e==null?void 0:e.length)>0){t(this,x).querySelector(".follower-bar").style.display="",t(this,x).querySelector(".follower-bar>.bar-list").appendChild(t(this,ie));for(let n of e){if(n.OptOut)continue;const a=String(n.MobilePhone).trim(),y=String(n.Email).trim(),m=[];n.SendEmail&&m.push(l("emailsToColon","Emails to:")+` ${y}`),n.SendText&&m.push(l("textsToColon",`Texts to: ${a}`));let o;n.SendText&&n.SendEmail?o="at":o=n.SendText?"comment-lines":"envelope";const r=h("span",d=>{n.SendEmail&&(d.dataset.email=y),n.SendText&&(d.dataset.mp=a),d.dataset.name=n.Name,d.innerText=n.Name}),s=h("div","contact-item",D("fa-light",o),r);t(this,Z).appendChild(s),r.scrollWidth>r.offsetWidth&&m.splice(0,0,l("nameColon","Name:")+` ${c.Name}`),I(r,m.join(`
`))}}else t(this,x).querySelector(".follower-bar").style.display="none",t(this,x).querySelector(".button-edit-contacts").insertAdjacentElement("beforebegin",t(this,ie));t(this,W).scrollTop=t(this,W).scrollHeight}setData(e,n){t(this,V)[e]=n}create(){const e=t(this,v),n=e.readonly,a=fe({className:"check-auto-update",checked:e.autoUpdates,checkedNode:D("fa-regular","redo-alt"),uncheckedNode:D("fa-regular","ban"),onchange:function(){I(a,this.checked?l("autoUpdateEnabled","Auto Updates Enabled"):l("autoUpdateDisabled","Auto Updates Disabled"))}});e.autoUpdatesVisible===!1&&(a.style.display="none");const y=fe({className:"check-status-link",enabled:!n,checked:e.statusLink,checkedNode:D("fa-regular","link"),uncheckedNode:D("fa-regular","unlink"),onchange:function(){I(y,this.checked?l("statusLinkIncluded","Status Link Included"):l("statusLinkExcluded","Status Link Excluded"))}});e.statusLinkVisible===!1&&(y.style.display="none");const m=ae(h("div",null,h("div",s=>{s.className="title-module",s.innerText=e.title??l("messages","Customer Communication")}),h("div",s=>{s.className="title-company",N(e.companyName)?s.style.display="none":N(e.companyCode)?s.innerText=e.companyName:s.innerText=e.companyName+"/"+e.companyCode})),[I(a,l("autoUpdateEnabled","Auto Updates Enabled")),I(y,l("statusLinkExcluded","Status Link Excluded"))]);T(this,X,xe(this,be,Le).call(this,m,e)),T(this,Z,xe(this,ge,Pe).call(this,m,e));const o=h("textarea","ui-text");o.placeholder=l("typeMessage","Enter Message Here"),e.maxLength??(e.maxLength=3e3),o.maxLength=e.maxLength,o.addEventListener("input",()=>{const s=t(this,B).value,d=String(N(s)?0:s.length)+"/"+String(e.maxLength);t(this,x).querySelector(".message-bar .prompt-count").innerText=d}),T(this,B,o),m.appendChild(h("div",s=>{s.className="message-bar",n===!0&&(s.style.display="none")},o,h("div",s=>s.style.textAlign="right",h("div",s=>{s.className="customer-name",e.customerNameVisible!==!0&&(s.style.display="none")},h("span",s=>s.innerText=l("nameColon","Name:")),h("input",s=>{s.type="text",s.className="ui-input"})),h("div","prompt-count"),h("button",s=>{s.className="roundbtn button-send-message",s.style.backgroundColor="rgb(19, 150, 204)",s.appendChild(D("fa-solid","paper-plane")),I(s,l("sendMessage","Send Message")),s.addEventListener("click",()=>{const d=t(this,B).value;if(N(d==null?void 0:d.trim())){ce(l("error","Error"),l("messageRequired","Please input the message."),"warn");return}typeof t(this,v).onAddMessage=="function"&&t(this,v).onAddMessage(t(this,B).value)})}))));const r=h("div","list-bar");return T(this,W,r),m.appendChild(r),T(this,x,m)}load(e,n,a){var m;const y=[];if((e==null?void 0:e.length)>0){n??(n=t(this,V).contacts),a??(a=t(this,V).allfollowers);for(let o of e){const r=h("div","item-div");let s;if(o.IsReply&&(n==null?void 0:n.length)>0){const p=ye(o.Sender)?n.find(g=>g.Email===o.Sender):n.find(g=>g.MobilePhone===o.Sender);s=p==null?void 0:p.Name}s??(s=o.IsReply&&String(o.FormatSender)!==""?o.FormatSender:o.Sender);let d="";if(!o.IsReply&&((m=o.OriPhoneNumbers)==null?void 0:m.length)>0)for(let p of o.OriPhoneNumbers){let g;const i=ye(p);if((n==null?void 0:n.length)>0){let w=i?n.find(f=>f.Email===p):n.find(f=>f.MobilePhone===p);w!=null?g=`${i?w.Email:w.MobilePhoneDisplayText} - ${w.Name}`:(a==null?void 0:a.length)>0&&(w=i?a.find(f=>f.Email===p):a.find(f=>f.MobilePhone===p),w!=null&&(g=`${i?w.Email:w.MobilePhoneDisplayText} - ${w.Name}`))}d+=(g??p)+`
`}d!==""&&(d=l("sendToColon","Send To :")+`
${d}`),r.appendChild(h("div",p=>{p.className="item-poster",p.innerText=s,!o.IsReply&&(d==null?void 0:d.length)>0&&I(p,d)}));const b=h("div","item-content");if(b.appendChild(h("span",p=>{/https?:\/\//i.test(o.Message)?p.innerHTML=Be(o.Message):p.innerText=o.Message})),o.IsReply)r.classList.add("item-other");else{r.classList.add("item-self");const[p,g]=xe(this,we,Fe).call(this,o);if(p!==-100){let i;switch(p){case 0:i=l("pending","Pending"),b.style.backgroundColor="#ffc107";break;case 1:i=l("sent","Sent");break;case 9:i=l("failed","Failed"),b.style.backgroundColor="#ffc107";break;case 10:i=l("optOut","Opt-Out"),b.style.backgroundColor="#ffc107";break;case 412:i=l("landline","Landline"),b.style.backgroundColor="#ffc107";break;default:i=l("undelivered","Undelivered"),b.style.backgroundColor="#ffc107";break}const w=h("div",f=>{f.className="item-status",f.innerText=i,p==-10&&I(f,g)});b.appendChild(w)}}r.append(b,h("div",p=>{p.className="item-time",p.innerText=o.TimeStr})),y.push(r)}y[0].style.marginTop="0"}t(this,H).replaceChildren(...y),t(this,H).scrollTop=t(this,H).scrollHeight}}x=new WeakMap,E=new WeakMap,X=new WeakMap,Z=new WeakMap,ie=new WeakMap,V=new WeakMap,H=new WeakMap,P=new WeakMap,_=new WeakMap,j=new WeakMap,ue=new WeakMap,ee=new WeakSet,me=function(){return t(this,x).querySelector(".check-auto-update>input")},te=new WeakSet,he=function(){return t(this,x).querySelector(".check-status-link>input")},be=new WeakSet,Le=function(e,n){const a=n.readonly,y=n.recordReadonly,m=h("div");return e.append(h("div","contact-bar",h("div","bar-icon",$("fa-solid","user-circle",{fill:"lightgray"})),h("div","bar-list",m,h("button",o=>{o.className="roundbtn button-edit-contacts",o.style.backgroundColor="rgb(1, 199, 172)",a===!0&&(o.style.display="none"),o.appendChild($("fa-solid","user-edit")),I(o,l("editContacts","Edit Contacts")),o.addEventListener("click",()=>{const r=qe(h("div",s=>{s.style.display="flex",s.style.alignItems="center",s.append(h("div",d=>{d.className="ui-popup-move",d.style.flex="1 1 auto"},h("div",d=>d.innerText=l("editContacts","Edit Contacts")),h("div",d=>{d.className="title-company",v(n.companyName)?d.style.display="none":v(n.companyCode)?d.innerText=n.companyName:d.innerText=n.companyName+"/"+n.companyCode})),h("button",d=>{d.style.flex="0 0 auto",d.style.backgroundColor="rgb(1, 199, 172)",d.style.marginRight="10px",d.className="roundbtn button-add-contact",y&&(d.style.display="none"),d.appendChild($("fa-solid","user-plus",{width:"16px",height:"16px"})),d.addEventListener("click",()=>{new Ee({company:!v(t(this,P).companyCode),onSave:p=>{if(t(this,_).source.some(i=>i.Name===p.Name&&i.MobilePhone===p.MobilePhone))return ce(l("addContact","Add Contact"),l("contactUniqueRequired","Contact name and contact mobile must be a unique combination."),"warn"),!1;if(typeof n.onSave=="function"){const i=n.onSave(p,!0);return typeof(i==null?void 0:i.then)=="function"?i.then(w=>(t(this,_).source=w.filter(f=>f.Id>=0).map(f=>(f.OptOut||f.OptOut_BC||typeof f.selected>"u"&&(f.selected=!0),f)),t(this,j).source=w.filter(f=>f.Id<0).map(f=>(f.OptOut||f.OptOut_BC||typeof f.selected>"u"&&(f.selected=!0),f)),w)):!1}}}).show(e)}),I(d,l("addContact","Add Contact"))}))}),h("div",null,h("div",s=>{v(t(this,P).companyCode)&&(s.style.display="none"),s.style.fontWeight="bold",s.innerText=l("contactFromRecord","Contacts from Customer Record")}),h("div",s=>{v(t(this,P).companyCode)&&(s.style.display="none"),s.className="contacts-record",s.style.maxHeight="400px",s.style.width="660px"}),h("div",s=>{s.style.fontWeight="bold",s.innerText=l("contactFromWorkOrder","Contacts not on Customer Record")}),h("div",s=>{s.className="contacts-wo",s.style.maxHeight="200px",s.style.width="660px"})));r.show(e).then(()=>{const s=u=>({key:"selected",type:K.ColumnTypes.Checkbox,width:50,enabled:D=>!D.OptOut&&!D.OptOut_BC,onchanged:function(){typeof n.onChanged=="function"&&n.onChanged([...t(u,_).source,...t(u,j).source])}}),d={key:"type",type:K.ColumnTypes.Icon,width:50,filter:u=>{switch(String(u.ContactPreference)){case"0":return"comment-lines";case"2":return"mobile";default:return"envelope"}},className:"icon-contact-type",iconType:"fa-light"},b={key:"Name",type:je,width:160},p={type:K.ColumnTypes.Icon,width:40,visible:!y,align:"center",iconType:"fa-light"},g=u=>({key:"edit",...p,text:"edit",tooltip:l("edit","Edit"),events:{onclick:function(){new Ee({contact:this,company:!v(t(u,P).companyCode),onSave:(U,le)=>{if(t(u,_).source.some(W=>W!==this&&W.Name===U.Name&&W.MobilePhone===U.MobilePhone)||t(u,j).source.some(W=>W!==this&&W.Name===U.Name&&W.MobilePhone===U.MobilePhone))return ce(l("editContact","Edit Contact"),l("contactUniqueRequired","Contact name and contact mobile must be a unique combination."),"warn"),!1;if(typeof n.onSave=="function"){const W=n.onSave(U);return typeof(W==null?void 0:W.then)=="function"?W.then(Ne=>(t(u,_).source=Ne.filter(q=>q.Id>=0).map(q=>(q.OptOut||q.OptOut_BC||typeof q.selected>"u"&&(q.selected=!0),q)),t(u,j).source=Ne.filter(q Line truncated
${d}`),r.appendChild(h("div",p=>{p.className="item-poster",p.innerText=s,!o.IsReply&&(d==null?void 0:d.length)>0&&I(p,d)}));const b=h("div","item-content");if(b.appendChild(h("span",p=>{/https?:\/\//i.test(o.Message)?p.innerHTML=Be(o.Message):p.innerText=o.Message})),o.IsReply)r.classList.add("item-other");else{r.classList.add("item-self");const[p,g]=xe(this,we,Fe).call(this,o);if(p!==-100){let i;switch(p){case 0:i=l("pending","Pending"),b.style.backgroundColor="#ffc107";break;case 1:i=l("sent","Sent");break;case 9:i=l("failed","Failed"),b.style.backgroundColor="#ffc107";break;case 10:i=l("optOut","Opt-Out"),b.style.backgroundColor="#ffc107";break;case 412:i=l("landline","Landline"),b.style.backgroundColor="#ffc107";break;default:i=l("undelivered","Undelivered"),b.style.backgroundColor="#ffc107";break}const w=h("div",f=>{f.className="item-status",f.innerText=i,p==-10&&I(f,g)});b.appendChild(w)}}r.append(b,h("div",p=>{p.className="item-time",p.innerText=o.TimeStr})),y.push(r)}y[0].style.marginTop="0"}t(this,W).replaceChildren(...y),t(this,W).scrollTop=t(this,W).scrollHeight}}x=new WeakMap,v=new WeakMap,X=new WeakMap,Z=new WeakMap,ie=new WeakMap,B=new WeakMap,W=new WeakMap,V=new WeakMap,H=new WeakMap,j=new WeakMap,ue=new WeakMap,ee=new WeakSet,me=function(){return t(this,x).querySelector(".check-auto-update>input")},te=new WeakSet,he=function(){return t(this,x).querySelector(".check-status-link>input")},be=new WeakSet,Le=function(e,n){const a=n.readonly,y=n.recordReadonly,m=h("div","bar-list-container");return e.append(h("div","contact-bar",h("div","bar-icon",D("fa-solid","user-circle",{fill:"lightgray"})),h("div","bar-list",m,h("button",o=>{o.className="roundbtn button-edit-contacts",o.style.backgroundColor="rgb(1, 199, 172)",a===!0&&(o.style.display="none"),o.appendChild(D("fa-solid","user-edit")),I(o,l("editContacts","Edit Contacts")),o.addEventListener("click",()=>{const r=qe(h("div",s=>{s.style.display="flex",s.style.alignItems="center",s.append(h("div",d=>{d.className="ui-popup-move",d.style.flex="1 1 auto"},h("div",d=>d.innerText=l("editContacts","Edit Contacts")),h("div",d=>{d.className="title-company",N(n.companyName)?d.style.display="none":N(n.companyCode)?d.innerText=n.companyName:d.innerText=n.companyName+"/"+n.companyCode})),h("button",d=>{d.style.flex="0 0 auto",d.style.backgroundColor="rgb(1, 199, 172)",d.style.marginRight="10px",d.className="roundbtn button-add-contact",y&&(d.style.display="none"),d.appendChild(D("fa-solid","user-plus",{width:"16px",height:"16px"})),d.addEventListener("click",()=>{new Ee({company:!N(t(this,v).companyName),onSave:p=>{if(t(this,H).source.some(i=>i.Name===p.Name&&i.MobilePhone===p.MobilePhone))return ce(l("addContact","Add Contact"),l("contactUniqueRequired","Contact name and contact mobile must be a unique combination."),"warn"),!1;if(typeof n.onSave=="function"){const i=n.onSave(p,!0);return typeof(i==null?void 0:i.then)=="function"?i.then(w=>(t(this,H).source=w.filter(f=>f.Id>=0).map(f=>(f.OptOut||f.OptOut_BC||typeof f.selected>"u"&&(f.selected=!0),f)),t(this,j).source=w.filter(f=>f.Id<0).map(f=>(f.OptOut||f.OptOut_BC||typeof f.selected>"u"&&(f.selected=!0),f)),w)):!1}}}).show(e)}),I(d,l("addContact","Add Contact"))}))}),h("div",null,h("div",s=>{N(t(this,v).companyName)&&(s.style.display="none"),s.style.fontWeight="bold",s.innerText=l("contactFromRecord","Contacts from Customer Record")}),h("div",s=>{N(t(this,v).companyName)&&(s.style.display="none"),s.className="contacts-record",s.style.maxHeight="200px",s.style.width="675px",s.style.overflow="auto"}),h("div",s=>{s.style.fontWeight="bold",s.innerText=l("contactFromWorkOrder","Contacts not on Customer Record")}),h("div",s=>{s.className="contacts-wo",s.style.maxHeight="200px",s.style.width="675px",s.style.overflow="auto"})));r.show(e).then(()=>{const s=u=>({key:"selected",type:K.ColumnTypes.Checkbox,width:50,enabled:F=>!F.OptOut&&!F.OptOut_BC,onchanged:function(){typeof n.onChanged=="function"&&n.onChanged([...t(u,H).source,...t(u,j).source])}}),d={key:"type",type:K.ColumnTypes.Icon,width:50,filter:u=>{switch(String(u.ContactPreference)){case"0":return"comment-lines";case"2":return"mobile";default:return"envelope"}},className:"icon-contact-type",iconType:"fa-light"},b={key:"Name",type:je,width:160},p={type:K.ColumnTypes.Icon,width:40,visible:!y,align:"center",iconType:"fa-light"},g=u=>({key:"edit",...p,text:"edit",tooltip:l("edit","Edit"),events:{onclick:function(){new Ee({contact:this,company:!N(t(u,v).companyName),onSave:(A,le)=>{if(t(u,H).source.some(U=>U!==this&&U.Name===A.Name&&U.MobilePhone===A.MobilePhone)||t(u,j).source.some(U=>U!==this&&U.Name===A.Name&&U.MobilePhone===A.MobilePhone))return ce(l("editContact","Edit Contact"),l("contactUniqueRequired","Contact name and contact mobile must be a unique combination."),"warn"),!1;if(typeof n.onSave=="function"){const U=n.onSave(A);return typeof(U==null?void 0:U.then)=="function"?U.then(Ne=>(t(u,H).source=Ne.filter(q=>q.Id>=0).map(q=>(q.OptOut||q.OptOut_BC| Line truncated
Do you want to Continue?`).replace("{name}",this.Name),[{key:"continue",text:l("continue","Continue")},{key:"cancel",text:l("cancel","Cancel")}]).then(u=>{if((u==null?void 0:u.key)==="continue"){typeof n.onDelete=="function"&&n.onDelete(u.key,this);const D=f.source.indexOf(this);if(D>=0){const U=f.source;U.splice(D,1),f.extraRows=U.filter(le=>!v(le.Notes)).length,f.source=U}}})}}}],f.init(r.container.querySelector(".contacts-wo"));const B=t(this,P).contacts.filter(u=>u.Id<0).map(u=>(u.OptOut||u.OptOut_BC||typeof u.selected>"u"&&(u.selected=!0),u));f.extraRows=B.filter(u=>!v(u.Notes)).length,f.source=B,f.selectedRowChanged=u=>{var D;u>=0&&((D=t(this,_).selectedIndexes)==null?void 0:D.length)>0&&(t(this,_).selectedIndexes=[])},T(this,j,f)})})})))),m},ge=new WeakSet,Pe=function(e,n){const a=n.readonly,y=n.recordReadonly,m=h("div"),o=h("button",r=>{r.className="roundbtn button-edit-followers",r.style.backgroundColor="rgb(48, 107, 255)",(a===!0||y)&&(r.style.display="none"),r.appendChild($("fa-solid","pen")),I(r,l("editFollower","Edit Followers")),r.addEventListener("click",()=>{const s=qe(h("div",d=>{d.style.display="flex",d.style.alignItems="center",d.append(h("div",b=>{b.className="ui-popup-move",b.style.flex="1 1 auto",b.innerText=l("editContacts","Edit Contacts")+`
`+l("followers","Followers")}),h("button",b=>{b.style.flex="0 0 auto",b.style.backgroundColor="rgb(1, 199, 172)",b.style.marginRight="10px",b.className="roundbtn button-add-follower",b.appendChild($("fa-solid","user-plus",{width:"16px",height:"16px"})),b.addEventListener("click",()=>{typeof t(this,E).onInitFollower=="function"&&t(this,E).onInitFollower().then(p=>{if(typeof p=="string"){ce(l("customerRecord","Customer Record"),p,"warn");return}new _e({followers:p,onOk:i=>{if(typeof t(this,E).onAddFollower=="function"){const w=t(this,E).onAddFollower(i);return typeof(w==null?void 0:w.then)=="function"?w.then(f=>(t(this,ue).source=f,f)):!1}}}).show(e)})}),I(b,l("addFollower","Add Follower"))}))}),h("div",null,h("div",d=>{d.style.fontWeight="bold",d.innerText=l("contactFromRecord","Contacts from Customer Record")}),h("div",d=>{d.className="followers-record",d.style.maxHeight="400px",d.style.width="660px"})));s.show(e).then(()=>{const d={type:K.ColumnTypes.Icon,width:40,align:"center",iconType:"fa-light"},b=new K;b.height=0,b.allowHtml=!0,b.headerVisible=!1,b.columns=[{key:"type",type:K.ColumnTypes.Icon,width:50,filter:p=>p.SendText&&p.SendEmail?"at":p.SendText?"comment-lines":"envelope",className:"icon-contact-type",iconType:"fa-light"},{key:"Name",width:160},{key:"Email",width:180},{key:"MobilePhoneDisplayText",width:130},{key:"edit",...d,text:"edit",tooltip:l("edit","Edit"),events:{onclick:function(){typeof n.onInitFollower=="function"&&n.onInitFollower().then(p=>{if(typeof p=="string"){ce(l("customerRecord","Customer Record"),p,"warn");return}const g=p.find(i=>i.IID===this.UserIID);de(l("editContactMethod","Edit Contact Method"),h("div","wrapper-edit-method",h("div",i=>{i.style.display="flex",i.style.justifyContent="center",i.style.marginTop="20px"},fe({label:l("text","Text"),checked:this.SendText&&!v(g==null?void 0:g.Mobile),enabled:!v(g==null?void 0:g.Mobile),className:"check-method-text"}),fe({label:l("email","Email"),checked:this.SendEmail,className:"check-method-email"}))),[{key:"ok",text:l("ok","OK"),trigger:(i,w)=>{const f=i.container.querySelector(".check-method-text>input").checked,B=i.container.querySelector(".check-method-email>input").checked;return!f&&!B?de(l("editContactMethod","Edit Contact Method"),l("promptRemoveFollower","Contact method is required. If you continue, user will be removed as a follower."),[{key:"update",text:l("updateContactMethod","Update Contact Method")},{key:"remove",text:l("removeFollower","Remove Follower")}],"question").then(u=>(u==null?void 0:u.key)==="remove"?{key:u.key,popup:i}:!1):{key:w.key,popup:i}}},{key:"cancel",text:l("cancel","Cancel")}],null).then(i=>{const w=i==null?void 0:i.key;if(w==="remove"){typeof n.onDeleteFollower=="function"&&n.onDeleteFollower(i.key,this);const f=b.source.indexOf(this);if(f>=0){const B=b.source;B.splice(f,1),b.extraRows=B.filter(u=>!v(u.Notes)).length,b.source=B}}else if(w==="ok"){const f=i.popup.container.querySelector(".check-method-text>input").checked,B=i.popup.container.querySelector(".check-method-email>input").checked;typeof n.onChangeFollower=="function"&&n.onChangeFollower(i.key,this,f,B),this.SendText=f,this.SendEmail=B,b.refresh()}})})}}},{key:"delete",...d,text:"times",tooltip:l("delete","Delete"),events:{onclick:function(){de(l("deleteFollower","Delete Follower"),l("promptDeleteFollower","Do you want to delete this follower?")).then(p=>{if((p==null?void 0:p.key)==="yes"){typeof n.onDeleteFollower=="function"&&n.onDeleteFollower(p.key,this);const g=b.source.indexOf(this);if(g>=0){const i=b.source;i.splice(g,1),b.extraRows=i.filter(w=>!v(w.Notes)).length,b.source=i}}})}}}],b.init(s.container.querySelector(".followers-record")),b.source=t(this,P).followers,T(this,ue,b)})})});return T(this,ie,o),e.append(h("div",r=>{r.className="contact-bar follower-bar",r.style.display="none"},I(h("div","bar-icon",$("fa-solid","user-tag",{fill:"#fff","background-color":"lightgray","box-sizing":"border-box","border-radius":"15px",padding:"4px"})),l("copied","Copied")),h("div","bar-list",m,o))),m},we=new WeakSet,Fe=function(e){var m;let n=-100;const a=[];let y="";if(!e.StatusIncorrect&&((m=e.Participator)==null?void 0:m.length)>0){for(let o of e.Participator)if(!ye(o.CustomerNumber)){a.indexOf(o.Status)<0&&a.push(o.Status),y.length>0&&(y+=`
`),y+=`${o.CustomerNumber}: `;const r={0:l("undelivered","Undelivered"),1:l("sent","Sent"),9:l("failed","Failed")}[o.Status];r!=null&&(y+=r)}}return a.length===1?n=a[0]:a.length>1&&(n=-10),[n,y]};const R=window["lib-ui"].createElement,ve=window["lib-ui"].setTooltip,Me=window["lib-ui"].createIcon,oe=window["lib-utility"].r,Ie=window["lib-utility"].nullOrEmpty,Ke=window["lib-utility"].escapeHtml;class ze{constructor(e){C(this,Y,void 0);C(this,F,void 0);C(this,G,void 0);C(this,ne,void 0);T(this,F,e??{})}get text(){var e;return(e=t(this,G))==null?void 0:e.value}set text(e){const n=t(this,G);n!=null&&(n.value=e,e=String(Ie(e)?0:val.length)+"/"+String(t(this,F).maxLength),t(this,Y).querySelector(".message-bar .prompt-count").innerText=e)}set readonly(e){t(this,F).readonly=e,t(this,Y)!=null&&(t(this,G).disabled=e===!0,t(this,Y).querySelector(".button-send-message").style.display=e===!0?"none":"",t(this,Y).querySelector(".button-post-note").style.display=e===!0?"none":"")}create(){var m;const e=ae(R("div",null,R("div",o=>{o.className="title-module",o.innerText=oe("internalComments","Internal Comments")})),[]),n=t(this,F).readonly,a=R("textarea","ui-text");a.placeholder=oe("typeComment","Enter Comment Here"),a.maxLength=(m=t(this,F)).maxLength??(m.maxLength=3e3),a.addEventListener("input",()=>{const o=t(this,G).value,r=String(Ie(o)?0:o.length)+"/"+String(t(this,F).maxLength);t(this,Y).querySelector(".message-bar .prompt-count").innerText=r}),n===!0&&(a.disabled=!0),T(this,G,a),e.appendChild(R("div","message-bar",a,R("div",o=>o.style.textAlign="right",R("div","prompt-count"),R("button",o=>{o.className="roundbtn button-send-message",o.style.backgroundColor="rgb(19, 150, 204)",(n===!0||t(this,F).noMessage===!0)&&(o.style.display="none"),o.appendChild(Me("fa-solid","paper-plane")),ve(o,oe("sendMessage","Send Message")),o.addEventListener("click",()=>{typeof t(this,F).onAddMessage=="function"&&t(this,F).onAddMessage(t(this,G).value)})}),R("button",o=>{o.className="roundbtn button-post-note",o.style.border="1px solid rgb(19, 150, 204)",o.style.fill="rgb(19, 150, 204)",n===!0&&(o.style.display="none"),o.appendChild(Me("fa-solid","comment-alt-lines")),ve(o,oe("postNote","Post Note")),o.addEventListener("click",()=>{typeof t(this,F).onAddComment=="function"&&t(this,F).onAddComment(t(this,G).value)})}))));const y=R("div","list-bar");return T(this,ne,y),e.appendChild(y),T(this,Y,e)}load(e){var a;const n=[];if((e==null?void 0:e.length)>0){for(let y of e){const m=R("div","item-div");m.appendChild(R("div",r=>{r.className="item-poster",r.innerText=y.UserName}));const o=R("div","item-content");if(o.appendChild(R("span",r=>r.innerHTML=Ke(y.Comment))),((a=y.FollowUp)==null?void 0:a.length)>0){m.classList.add("item-sent");const r=oe("sendToColon","Send To :")+`\r
Do you want to Continue?`).replace("{name}",this.Name),[{key:"continue",text:l("continue","Continue")},{key:"cancel",text:l("cancel","Cancel")}]).then(u=>{if((u==null?void 0:u.key)==="continue"){typeof n.onDelete=="function"&&n.onDelete(u.key,this);const F=f.source.indexOf(this);if(F>=0){const A=f.source;A.splice(F,1),f.extraRows=A.filter(le=>!N(le.Notes)).length,f.source=A}}})}}}],f.init(r.container.querySelector(".contacts-wo"));const _=t(this,V).contacts.filter(u=>u.Id<0).map(u=>(u.OptOut||u.OptOut_BC||typeof u.selected>"u"&&(u.selected=!0),u));f.extraRows=_.filter(u=>!N(u.Notes)).length,f.source=_,f.selectedRowChanged=u=>{var F;u>=0&&((F=t(this,H).selectedIndexes)==null?void 0:F.length)>0&&(t(this,H).selectedIndexes=[])},T(this,j,f)})})})))),m},ge=new WeakSet,Pe=function(e,n){const a=n.readonly,y=n.recordReadonly,m=h("div","bar-list-container"),o=h("button",r=>{r.className="roundbtn button-edit-followers",r.style.backgroundColor="rgb(48, 107, 255)",(a===!0||y)&&(r.style.display="none"),r.appendChild(D("fa-solid","pen")),I(r,l("editFollower","Edit Followers")),r.addEventListener("click",()=>{const s=qe(h("div",d=>{d.style.display="flex",d.style.alignItems="center",d.append(h("div",b=>{b.className="ui-popup-move",b.style.flex="1 1 auto",b.innerText=l("editContacts","Edit Contacts")+`
`+l("followers","Followers")}),h("button",b=>{b.style.flex="0 0 auto",b.style.backgroundColor="rgb(1, 199, 172)",b.style.marginRight="10px",b.className="roundbtn button-add-follower",b.appendChild(D("fa-solid","user-plus",{width:"16px",height:"16px"})),b.addEventListener("click",()=>{typeof t(this,v).onInitFollower=="function"&&t(this,v).onInitFollower().then(p=>{if(typeof p=="string"){ce(l("customerRecord","Customer Record"),p,"warn");return}new _e({followers:p,onOk:i=>{if(typeof t(this,v).onAddFollower=="function"){const w=t(this,v).onAddFollower(i);return typeof(w==null?void 0:w.then)=="function"?w.then(f=>(t(this,ue).source=f,f)):!1}}}).show(e)})}),I(b,l("addFollower","Add Follower"))}))}),h("div",null,h("div",d=>{d.style.fontWeight="bold",d.innerText=l("contactFromRecord","Contacts from Customer Record")}),h("div",d=>{d.className="followers-record",d.style.maxHeight="400px",d.style.width="675px",d.style.overflow="auto"})));s.show(e).then(()=>{const d={type:K.ColumnTypes.Icon,width:40,align:"center",iconType:"fa-light"},b=new K;b.height=0,b.allowHtml=!0,b.headerVisible=!1,b.columns=[{key:"type",type:K.ColumnTypes.Icon,width:50,filter:p=>p.SendText&&p.SendEmail?"at":p.SendText?"comment-lines":"envelope",className:"icon-contact-type",iconType:"fa-light"},{key:"Name",width:160},{key:"Email",width:180},{key:"MobilePhoneDisplayText",width:130},{key:"edit",...d,text:"edit",tooltip:l("edit","Edit"),events:{onclick:function(){typeof n.onInitFollower=="function"&&n.onInitFollower().then(p=>{if(typeof p=="string"){ce(l("customerRecord","Customer Record"),p,"warn");return}const g=p.find(i=>i.IID===this.UserIID);de(l("editContactMethod","Edit Contact Method"),h("div","wrapper-edit-method",h("div",i=>{i.style.display="flex",i.style.justifyContent="center",i.style.marginTop="20px"},fe({label:l("text","Text"),checked:this.SendText&&!N(g==null?void 0:g.Mobile),enabled:!N(g==null?void 0:g.Mobile),className:"check-method-text"}),fe({label:l("email","Email"),checked:this.SendEmail,className:"check-method-email"}))),[{key:"ok",text:l("ok","OK"),trigger:(i,w)=>{const f=i.container.querySelector(".check-method-text>input").checked,_=i.container.querySelector(".check-method-email>input").checked;return!f&&!_?de(l("editContactMethod","Edit Contact Method"),l("promptRemoveFollower","Contact method is required. If you continue, user will be removed as a follower."),[{key:"update",text:l("updateContactMethod","Update Contact Method")},{key:"remove",text:l("removeFollower","Remove Follower")}],"question").then(u=>(u==null?void 0:u.key)==="remove"?{key:u.key,popup:i}:!1):{key:w.key,popup:i}}},{key:"cancel",text:l("cancel","Cancel")}],null).then(i=>{const w=i==null?void 0:i.key;if(w==="remove"){typeof n.onDeleteFollower=="function"&&n.onDeleteFollower(i.key,this);const f=b.source.indexOf(this);if(f>=0){const _=b.source;_.splice(f,1),b.extraRows=_.filter(u=>!N(u.Notes)).length,b.source=_}}else if(w==="ok"){const f=i.popup.container.querySelector(".check-method-text>input").checked,_=i.popup.container.querySelector(".check-method-email>input").checked;typeof n.onChangeFollower=="function"&&n.onChangeFollower(i.key,this,f,_),this.SendText=f,this.SendEmail=_,b.refresh()}})})}}},{key:"delete",...d,text:"times",tooltip:l("delete","Delete"),events:{onclick:function(){de(l("deleteFollower","Delete Follower"),l("promptDeleteFollower","Do you want to delete this follower?")).then(p=>{if((p==null?void 0:p.key)==="yes"){typeof n.onDeleteFollower=="function"&&n.onDeleteFollower(p.key,this);const g=b.source.indexOf(this);if(g>=0){const i=b.source;i.splice(g,1),b.extraRows=i.filter(w=>!N(w.Notes)).length,b.source=i}}})}}}],b.init(s.container.querySelector(".followers-record")),b.source=t(this,V).followers,T(this,ue,b)})})});return T(this,ie,o),e.append(h("div",r=>{r.className="contact-bar follower-bar",r.style.display="none"},I(h("div","bar-icon",D("fa-solid","user-tag",{fill:"#fff","background-color":"lightgray","box-sizing":"border-box","border-radius":"15px",padding:"4px"})),l("copied","Copied")),h("div","bar-list",m,o))),m},we=new WeakSet,Fe=function(e){var m;let n=-100;const a=[];let y="";if(!e.StatusIncorrect&&((m=e.Participator)==null?void 0:m.length)>0){for(let o of e.Participator)if(!ye(o.CustomerNumber)){a.indexOf(o.Status)<0&&a.push(o.Status),y.length>0&&(y+=`
`),y+=`${o.CustomerNumber}: `;const r={0:l("undelivered","Undelivered"),1:l("sent","Sent"),9:l("failed","Failed")}[o.Status];r!=null&&(y+=r)}}return a.length===1?n=a[0]:a.length>1&&(n=-10),[n,y]};const R=window["lib-ui"].createElement,ve=window["lib-ui"].setTooltip,Me=window["lib-ui"].createIcon,oe=window["lib-utility"].r,Ie=window["lib-utility"].nullOrEmpty,Ke=window["lib-utility"].escapeHtml;class ze{constructor(e){C(this,Y,void 0);C(this,P,void 0);C(this,G,void 0);C(this,ne,void 0);T(this,P,e??{})}get text(){var e;return(e=t(this,G))==null?void 0:e.value}set text(e){const n=t(this,G);n!=null&&(n.value=e,e=String(Ie(e)?0:val.length)+"/"+String(t(this,P).maxLength),t(this,Y).querySelector(".message-bar .prompt-count").innerText=e)}set readonly(e){t(this,P).readonly=e,t(this,Y)!=null&&(t(this,G).disabled=e===!0,t(this,Y).querySelector(".button-send-message").style.display=e===!0?"none":"",t(this,Y).querySelector(".button-post-note").style.display=e===!0?"none":"")}create(){var m;const e=ae(R("div",null,R("div",o=>{o.className="title-module",o.innerText=oe("internalComments","Internal Comments")})),[]),n=t(this,P).readonly,a=R("textarea","ui-text");a.placeholder=oe("typeComment","Enter Comment Here"),a.maxLength=(m=t(this,P)).maxLength??(m.maxLength=3e3),a.addEventListener("input",()=>{const o=t(this,G).value,r=String(Ie(o)?0:o.length)+"/"+String(t(this,P).maxLength);t(this,Y).querySelector(".message-bar .prompt-count").innerText=r}),n===!0&&(a.disabled=!0),T(this,G,a),e.appendChild(R("div","message-bar",a,R("div",o=>o.style.textAlign="right",R("div","prompt-count"),R("button",o=>{o.className="roundbtn button-send-message",o.style.backgroundColor="rgb(19, 150, 204)",(n===!0||t(this,P).noMessage===!0)&&(o.style.display="none"),o.appendChild(Me("fa-solid","paper-plane")),ve(o,oe("sendMessage","Send Message")),o.addEventListener("click",()=>{typeof t(this,P).onAddMessage=="function"&&t(this,P).onAddMessage(t(this,G).value)})}),R("button",o=>{o.className="roundbtn button-post-note",o.style.border="1px solid rgb(19, 150, 204)",o.style.fill="rgb(19, 150, 204)",n===!0&&(o.style.display="none"),o.appendChild(Me("fa-solid","comment-alt-lines")),ve(o,oe("postNote","Post Note")),o.addEventListener("click",()=>{typeof t(this,P).onAddComment=="function"&&t(this,P).onAddComment(t(this,G).value)})}))));const y=R("div","list-bar");return T(this,ne,y),e.appendChild(y),T(this,Y,e)}load(e){var a;const n=[];if((e==null?void 0:e.length)>0){for(let y of e){const m=R("div","item-div");m.appendChild(R("div",r=>{r.className="item-poster",r.innerText=y.UserName}));const o=R("div","item-content");if(o.appendChild(R("span",r=>r.innerHTML=Ke(y.Comment))),((a=y.FollowUp)==null?void 0:a.length)>0){m.classList.add("item-sent");const r=oe("sendToColon","Send To :")+`\r
`+y.FollowUp.split(";").join(`\r
`);o.appendChild(R("div",s=>{s.className="item-status",s.innerText=oe("sent","Sent"),ve(s,r)}))}m.append(o,R("div",r=>{r.className="item-time",r.innerText=y.SubmitDateStr})),n.push(m)}n[0].style.marginTop="0"}t(this,ne).replaceChildren(...n),t(this,ne).scrollTop=t(this,ne).scrollHeight}}Y=new WeakMap,F=new WeakMap,G=new WeakMap,ne=new WeakMap,k.CustomerCommunication=Ge,k.InternalComment=ze,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})});
`);o.appendChild(R("div",s=>{s.className="item-status",s.innerText=oe("sent","Sent"),ve(s,r)}))}m.append(o,R("div",r=>{r.className="item-time",r.innerText=y.SubmitDateStr})),n.push(m)}n[0].style.marginTop="0"}t(this,ne).replaceChildren(...n),t(this,ne).scrollTop=t(this,ne).scrollHeight}}Y=new WeakMap,P=new WeakMap,G=new WeakMap,ne=new WeakMap,k.CustomerCommunication=Ge,k.InternalComment=ze,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})});
//# sourceMappingURL=app.min.js.map
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"app.min.js","sources":["../../../../../../UILib/ui-lib/lib/app/communications/lib.js","../../../../../../UILib/ui-lib/lib/app/communications/contact.js","../../../../../../UILib/ui-lib/lib/app/communications/follower.js","../../../../../../UILib/ui-lib/lib/app/communications/customer.js","../../../../../../UILib/ui-lib/lib/app/communications/internal.js"],"sourcesContent":["import { createElement } from \"../../ui\";\r\n\r\nfunction createBox(title, functions) {\r\n const container = createElement('div', 'comm');\r\n const header = createElement('div', 'title-bar',\r\n title,\r\n createElement('div', 'title-functions', ...functions)\r\n );\r\n container.appendChild(header);\r\n return container;\r\n}\r\n\r\nexport {\r\n createBox\r\n}","import { Dropdown, createElement, createCheckbox, createPopup, showAlert } from \"../../ui\";\r\nimport { isEmail, nullOrEmpty, r } from \"../../utility\";\r\n\r\nclass Contact {\r\n #option;\r\n #refs;\r\n\r\n constructor(option = {}) {\r\n this.#option = option;\r\n }\r\n\r\n async show(parent = document.body) {\r\n const tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0)) + 3;\r\n\r\n const c = this.#option.contact;\r\n const contactName = createElement('input', input => {\r\n input.type = 'text';\r\n input.className = 'ui-input';\r\n input.tabIndex = tabIndex + 1;\r\n input.maxLength = 200;\r\n input.autocomplete = 'off';\r\n });\r\n const preferences = new Dropdown({ tabIndex: tabIndex + 2 });\r\n preferences.source = [\r\n { value: '0', text: r('text', 'Text') },\r\n { value: '1', text: r('email', 'Email') },\r\n { value: '2', text: r('phone', 'Phone') }\r\n ];\r\n const contactEmail = createElement('input', input => {\r\n input.type = 'email';\r\n input.className = 'ui-input';\r\n input.tabIndex = tabIndex + 3;\r\n input.maxLength = 100;\r\n input.autocomplete = 'off';\r\n });\r\n const contactMobile = createElement('input', input => {\r\n input.type = 'tel';\r\n input.className = 'ui-input';\r\n input.tabIndex = tabIndex + 4;\r\n input.maxLength = 50;\r\n input.autocomplete = 'off';\r\n });\r\n const checkOpt = createCheckbox({ tabIndex: tabIndex + 5 });\r\n const contactNotes = createElement('textarea', txt => {\r\n txt.className = 'ui-text';\r\n txt.tabIndex = tabIndex + 6;\r\n txt.maxLength = 2000;\r\n txt.style.height = '100px';\r\n });\r\n const buttons = [];\r\n if (this.#option.company) {\r\n buttons.push({\r\n text: c == null ? r('addContactRecord', 'Add Contact Record') : r('editContactRecord', 'Edit Contact Record'),\r\n // tabIndex: tabIndex + 7,\r\n trigger: () => {\r\n const item = this.prepare();\r\n if (item == null) {\r\n return false;\r\n }\r\n item.SaveToCustomer = 1;\r\n if (typeof this.#option.onSave === 'function') {\r\n return this.#option.onSave.call(this, item, 'customerrecord');\r\n }\r\n }\r\n });\r\n }\r\n buttons.push(\r\n {\r\n text: r('workOrderOnly', 'Work Order Only'),\r\n // tabIndex: tabIndex + 8,\r\n trigger: () => {\r\n const item = this.prepare();\r\n if (item == null) {\r\n return false;\r\n }\r\n item.Id = -1;\r\n item.SaveToCustomer = 0;\r\n if (typeof this.#option.onSave === 'function') {\r\n return this.#option.onSave.call(this, item, 'workorder');\r\n }\r\n }\r\n },\r\n {\r\n text: r('cancel', 'Cancel'),\r\n // tabIndex: tabIndex + 9\r\n }\r\n );\r\n const popup = createPopup(\r\n c == null ? r('addContact', 'Add Contact') : r('editContact', 'Edit Contact'),\r\n createElement('div', wrapper => {\r\n wrapper.className = 'setting-wrapper';\r\n wrapper.style.width = '500px';\r\n },\r\n createElement('div', 'setting-item',\r\n createElement('span', 'setting-label setting-required', r('contactNameColon', 'Contact Name:')),\r\n contactName\r\n ),\r\n createElement('div', 'setting-item',\r\n createElement('span', 'setting-labLine truncated
{"version":3,"file":"app.min.js","sources":["../../../../../UILib/ui-lib/lib/app/communications/lib.js","../../../../../UILib/ui-lib/lib/app/communications/contact.js","../../../../../UILib/ui-lib/lib/app/communications/follower.js","../../../../../UILib/ui-lib/lib/app/communications/customer.js","../../../../../UILib/ui-lib/lib/app/communications/internal.js"],"sourcesContent":["import { createElement } from \"../../ui\";\r\n\r\nfunction createBox(title, functions) {\r\n const container = createElement('div', 'comm');\r\n const header = createElement('div', 'title-bar',\r\n title,\r\n createElement('div', 'title-functions', ...functions)\r\n );\r\n container.appendChild(header);\r\n return container;\r\n}\r\n\r\nexport {\r\n createBox\r\n}","import { Dropdown, createElement, createCheckbox, createPopup, showAlert } from \"../../ui\";\r\nimport { isEmail, nullOrEmpty, r } from \"../../utility\";\r\n\r\nclass Contact {\r\n #option;\r\n #refs;\r\n\r\n constructor(option = {}) {\r\n this.#option = option;\r\n }\r\n\r\n async show(parent = document.body) {\r\n const tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0)) + 3;\r\n\r\n const c = this.#option.contact;\r\n const contactName = createElement('input', input => {\r\n input.type = 'text';\r\n input.className = 'ui-input';\r\n input.tabIndex = tabIndex + 1;\r\n input.maxLength = 200;\r\n input.autocomplete = 'off';\r\n });\r\n const preferences = new Dropdown({ tabIndex: tabIndex + 2 });\r\n preferences.source = [\r\n { value: '0', text: r('text', 'Text') },\r\n { value: '1', text: r('email', 'Email') },\r\n { value: '2', text: r('phone', 'Phone') }\r\n ];\r\n const contactEmail = createElement('input', input => {\r\n input.type = 'email';\r\n input.className = 'ui-input';\r\n input.tabIndex = tabIndex + 3;\r\n input.maxLength = 100;\r\n input.autocomplete = 'off';\r\n });\r\n const contactMobile = createElement('input', input => {\r\n input.type = 'tel';\r\n input.className = 'ui-input';\r\n input.tabIndex = tabIndex + 4;\r\n input.maxLength = 50;\r\n input.autocomplete = 'off';\r\n });\r\n const checkOpt = createCheckbox({ tabIndex: tabIndex + 5 });\r\n const contactNotes = createElement('textarea', txt => {\r\n txt.className = 'ui-text';\r\n txt.tabIndex = tabIndex + 6;\r\n txt.maxLength = 2000;\r\n txt.style.height = '100px';\r\n });\r\n const buttons = [];\r\n if (this.#option.company) {\r\n buttons.push({\r\n text: c == null ? r('addContactRecord', 'Add Contact Record') : r('editContactRecord', 'Edit Contact Record'),\r\n // tabIndex: tabIndex + 7,\r\n trigger: () => {\r\n const item = this.prepare();\r\n if (item == null) {\r\n return false;\r\n }\r\n item.SaveToCustomer = 1;\r\n if (typeof this.#option.onSave === 'function') {\r\n return this.#option.onSave.call(this, item, 'customerrecord');\r\n }\r\n }\r\n });\r\n }\r\n buttons.push(\r\n {\r\n text: r('workOrderOnly', 'Work Order Only'),\r\n // tabIndex: tabIndex + 8,\r\n trigger: () => {\r\n const item = this.prepare();\r\n if (item == null) {\r\n return false;\r\n }\r\n item.Id = -1;\r\n item.SaveToCustomer = 0;\r\n if (typeof this.#option.onSave === 'function') {\r\n return this.#option.onSave.call(this, item, 'workorder');\r\n }\r\n }\r\n },\r\n {\r\n text: r('cancel', 'Cancel'),\r\n // tabIndex: tabIndex + 9\r\n }\r\n );\r\n const popup = createPopup(\r\n c == null ? r('addContact', 'Add Contact') : r('editContact', 'Edit Contact'),\r\n createElement('div', wrapper => {\r\n wrapper.className = 'setting-wrapper';\r\n wrapper.style.width = '500px';\r\n },\r\n createElement('div', 'setting-item',\r\n createElement('span', 'setting-label setting-required', r('contactNameColon', 'Contact Name:')),\r\n contactName\r\n ),\r\n createElement('div', 'setting-item',\r\n createElement('span', 'setting-label', r('contactLine truncated
+1 -1
View File
@@ -1 +1 @@
@-webkit-keyframes loading-spinner{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes loading-spinner{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}:root{color-scheme:light dark;--color: #201f1e;--bg-color: #fff;--border-color: #b9b9b9;--focus-border-color: #666;--shadow-color: rgba(0, 0, 0,.11);--disabled-color: #aaa;--disabled-bg-color: #e9e9e9;--disabled-border-color: #d9d9d9;--red-color: red;--title-color: #fff;--title-bg-color: rgb(68, 114, 196);--hover-bg-color: #eee;--link-color: #1890ff;--primary-color: rgb(123, 28, 33);--loading-bg-color: hsla(0, 0%, 100%, .4);--loading-fore-color: rgba(0, 0, 0, .2);--border-radius: 2px;--text-indent: 4px;--line-height: 24px;--font-size: .8125rem;--font-smaller-size: .75rem;--font-larger-size: .875rem;--font-family: "Franklin Gothic Book", "San Francisco", "Segoe UI", "Open Sans", "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei UI", sans-serif}@media (prefers-color-scheme: dark){:root{--color: rgba(255, 255, 255,.87);--bg-color: #141414;--border-color: #464646;--focus-border-color: #999;--shadow-color: rgba(128, 128, 128,.08);--disabled-color: #555;--disabled-bg-color: #161616;--disabled-border-color: #262626;--red-color: #c80000;--title-color: #ddd;--title-bg-color: rgb(40, 89, 173);--hover-bg-color: #222;--link-color: #0177e6;--primary-color: rgb(123, 28, 33);--loading-bg-color: rgba(20, 20, 20,.4);--loading-fore-color: rgba(255, 255, 255,.2)}}.ui-text,.ui-input[type]{font-size:var(--font-size);font-family:var(--font-family);border:1px solid var(--border-color);border-radius:var(--border-radius);transition:border-color .12s ease}.ui-text:focus,.ui-text:focus-visible,.ui-input[type]:focus,.ui-input[type]:focus-visible{outline:none}.ui-text:focus,.ui-text:hover,.ui-input[type]:focus,.ui-input[type]:hover{border-color:var(--focus-border-color)}.ui-text:disabled,.ui-input[type]:disabled{border-color:var(--disabled-border-color);color:var(--disabled-color);background-color:var(--disabled-bg-color)}.ui-input{text-indent:var(--text-indent);line-height:var(--line-height)}.ui-check-image-wrapper>input[type=checkbox]{display:none}.ui-check-image-wrapper>input[type=checkbox]:checked~.checked{display:inline}.ui-check-image-wrapper>input[type=checkbox]:checked~.unchecked{display:none}.ui-check-image-wrapper>.checked{display:none}.ui-check-image-wrapper>.unchecked{display:inline}.ui-check-wrapper{display:inline-flex;align-items:center;padding:0 8px;height:36px}.ui-check-wrapper .ui-check-inner{position:relative;display:inline-block;padding:0;width:14px;height:14px;background-color:#fff;-webkit-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;border:1px solid var(--border-color);border-radius:var(--border-radius);transition:border-color .12s ease}.ui-check-wrapper .ui-check-inner:focus,.ui-check-wrapper .ui-check-inner:focus-visible{outline:none}.ui-check-wrapper .ui-check-inner:focus,.ui-check-wrapper .ui-check-inner:hover{border-color:var(--focus-border-color)}.ui-check-wrapper .ui-check-inner:disabled{border-color:var(--disabled-border-color);color:var(--disabled-color);background-color:var(--disabled-bg-color)}.ui-check-wrapper .ui-check-inner>svg{position:absolute;top:0;left:0;width:100%;height:100%;fill:#fff;-webkit-transform:scale(0);transform:scale(0);opacity:0;transition:all .08s cubic-bezier(.78,.14,.15,.86)}.ui-check-wrapper.ui-radio-wrapper .ui-check-inner{box-sizing:border-box;border-radius:8px;width:16px;height:16px}.ui-check-wrapper>input[type=checkbox],.ui-check-wrapper>input[type=radio]{display:none}.ui-check-wrapper>input[type=checkbox]:checked+.ui-check-inner,.ui-check-wrapper>input[type=radio]:checked+.ui-check-inner{border-color:var(--link-color);background-color:var(--link-color)}.ui-check-wrapper>input[type=checkbox]:checked+.ui-check-inner>svg,.ui-check-wrapper>input[type=radio]:checked+.ui-check-inner>svg{-webkit-transform:scale(1);transform:scale(1);opacity:1}.ui-check-wrapper>input[type=checkbox]:disabled:checked+.ui-check-inner,.ui-check-wrapper>input[type=radio]:disabled:checked+.ui-check-inner{border-color:var(--disabled-border-color);background-color:var(--disabled-border-color)}.ui-check-wrapper>input[type=checkbox]:disabled+.ui-check-inner,.ui-check-wrapper>input[type=radio]:disabled+.ui-check-inner{border-color:var(--disabled-border-color);background-color:var(--disabled-bg-color);cursor:default}.ui-check-wrapper>input[type=checkbox]:disabled~span,.ui-check-wrapper>input[type=radio]:disabled~span{color:var(--disabled-border-color);cursor:default}.ui-check-wrapper .ui-check-inner{flex:0 0 auto}.ui-check-wrapper .ui-check-inner+*{flex:1 1 auto;font-weight:400;font-size:var(--font-size);padding-left:8px;padding-right:6px;align-self:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer;color:var(--color)}.ui-tooltip-color{background-color:#fff;colorLine truncated
@-webkit-keyframes loading-spinner{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes loading-spinner{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}:root{--color: #201f1e;--bg-color: #fff;--border-color: #b9b9b9;--focus-border-color: #666;--shadow-color: rgba(0, 0, 0,.11);--disabled-color: #aaa;--disabled-bg-color: #e9e9e9;--disabled-border-color: #d9d9d9;--red-color: red;--title-color: #fff;--title-bg-color: rgb(68, 114, 196);--hover-bg-color: #eee;--link-color: #1890ff;--primary-color: rgb(123, 28, 33);--loading-bg-color: hsla(0, 0%, 100%, .4);--loading-fore-color: rgba(0, 0, 0, .2);--border-radius: 2px;--text-indent: 4px;--line-height: 24px;--font-size: .8125rem;--font-smaller-size: .75rem;--font-larger-size: .875rem;--font-family: "Franklin Gothic Book", "San Francisco", "Segoe UI", "Open Sans", "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei UI", sans-serif}.ui-text,.ui-input[type]{font-size:var(--font-size);font-family:var(--font-family);border:1px solid var(--border-color);border-radius:var(--border-radius);transition:border-color .12s ease}.ui-text:focus,.ui-text:focus-visible,.ui-input[type]:focus,.ui-input[type]:focus-visible{outline:none}.ui-text:focus,.ui-text:hover,.ui-input[type]:focus,.ui-input[type]:hover{border-color:var(--focus-border-color)}.ui-text:disabled,.ui-input[type]:disabled{border-color:var(--disabled-border-color);color:var(--disabled-color);background-color:var(--disabled-bg-color)}.ui-input{text-indent:var(--text-indent);line-height:var(--line-height)}.ui-check-image-wrapper>input[type=checkbox]{display:none}.ui-check-image-wrapper>input[type=checkbox]:checked~.checked{display:inline}.ui-check-image-wrapper>input[type=checkbox]:checked~.unchecked{display:none}.ui-check-image-wrapper>.checked{display:none}.ui-check-image-wrapper>.unchecked{display:inline}.ui-check-wrapper{display:inline-flex;align-items:center;padding:0 8px;height:36px}.ui-check-wrapper .ui-check-inner{position:relative;display:inline-block;padding:0;width:14px;height:14px;background-color:#fff;-webkit-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;border:1px solid var(--border-color);border-radius:var(--border-radius);transition:border-color .12s ease}.ui-check-wrapper .ui-check-inner:focus,.ui-check-wrapper .ui-check-inner:focus-visible{outline:none}.ui-check-wrapper .ui-check-inner:focus,.ui-check-wrapper .ui-check-inner:hover{border-color:var(--focus-border-color)}.ui-check-wrapper .ui-check-inner:disabled{border-color:var(--disabled-border-color);color:var(--disabled-color);background-color:var(--disabled-bg-color)}.ui-check-wrapper .ui-check-inner>svg{position:absolute;top:0;left:0;width:100%;height:100%;fill:#fff;-webkit-transform:scale(0);transform:scale(0);opacity:0;transition:all .08s cubic-bezier(.78,.14,.15,.86)}.ui-check-wrapper.ui-radio-wrapper .ui-check-inner{box-sizing:border-box;border-radius:8px;width:16px;height:16px}.ui-check-wrapper>input[type=checkbox],.ui-check-wrapper>input[type=radio]{display:none}.ui-check-wrapper>input[type=checkbox]:checked+.ui-check-inner,.ui-check-wrapper>input[type=radio]:checked+.ui-check-inner{border-color:var(--link-color);background-color:var(--link-color)}.ui-check-wrapper>input[type=checkbox]:checked+.ui-check-inner>svg,.ui-check-wrapper>input[type=radio]:checked+.ui-check-inner>svg{-webkit-transform:scale(1);transform:scale(1);opacity:1}.ui-check-wrapper>input[type=checkbox]:disabled:checked+.ui-check-inner,.ui-check-wrapper>input[type=radio]:disabled:checked+.ui-check-inner{border-color:var(--disabled-border-color);background-color:var(--disabled-border-color)}.ui-check-wrapper>input[type=checkbox]:disabled+.ui-check-inner,.ui-check-wrapper>input[type=radio]:disabled+.ui-check-inner{border-color:var(--disabled-border-color);background-color:var(--disabled-bg-color);cursor:default}.ui-check-wrapper>input[type=checkbox]:disabled~span,.ui-check-wrapper>input[type=radio]:disabled~span{color:var(--disabled-border-color);cursor:default}.ui-check-wrapper .ui-check-inner{flex:0 0 auto}.ui-check-wrapper .ui-check-inner+*{flex:1 1 auto;font-weight:400;font-size:var(--font-size);padding-left:8px;padding-right:6px;align-self:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer;color:var(--color)}.ui-tooltip-color{background-color:#fff;color:#323130;border-color:#cccc}.ui-tooltip-color:focus,.ui-tooltip-color:focus-visible{outline:none}.ui-tooltip-wrapper{position:absolute;word-wrap:break-word;height:auto;text-align:left;z-index:250;min-width:45px;max-width:480px;min-height:32px;border-radius:2px;box-shadow:0 3.2px 7.2px #00000021,0 .6px 1.8px #0000001c;transition:visibility 0s linear .12s,opacity .12s ease}.ui-tooltip-wrapper>.ui-tooltip-pointer{box-sizing:border-box;box-shadow:0 5px 15px 2px #0000004d;border:1px solid #fff;z-index:-1;width:16px;height:16px;positionLine truncated
+2 -2
View File
@@ -1,3 +1,3 @@
(function(k,T){typeof exports=="object"&&typeof module<"u"?T(exports):typeof define=="function"&&define.amd?define(["exports"],T):(k=typeof globalThis<"u"?globalThis:k||self,T(k["lib-ui"]={}))})(this,function(k){var N,j,H,z,K,we,Pe,ce,de,ue,Qe,ke,kt,Ce,Ct,ze,Rt,Ve,Ht,We,Ot,Me,$t,B,O,Le,M,b,Ee,Te,D,U,he,fe,se,G,Se,pe,Ne,A,De,Ae,Lt,ct,ii,dt,si,ut,ni,ye,Ze,ht,li,ft,ri,Fe,Pt,V,Y,ne,_e,ge,et,je,zt,Be,Vt,Xe,Wt,me,tt,pt,oi,Ye,Mt,Ke,Dt,yt,ai,gt,ci,mt,di,bt,ui,vt,hi,xt,fi,wt,pi,Ue,Ft,Ge,jt,Ie,Et,J,R,Q,X,te;"use strict";var Ri=Object.defineProperty;var Hi=Object.getPrototypeOf;var Oi=Reflect.get;var $i=(k,T,S)=>T in k?Ri(k,T,{enumerable:!0,configurable:!0,writable:!0,value:S}):k[T]=S;var E=(k,T,S)=>($i(k,typeof T!="symbol"?T+"":T,S),S),qt=(k,T,S)=>{if(!T.has(k))throw TypeError("Cannot "+S)};var o=(k,T,S)=>(qt(k,T,"read from private field"),S?S.call(k):T.get(k)),m=(k,T,S)=>{if(T.has(k))throw TypeError("Cannot add the same private member more than once");T instanceof WeakSet?T.add(k):T.set(k,S)},x=(k,T,S,f)=>(qt(k,T,"write to private field"),f?f.call(k,S):T.set(k,S),S);var p=(k,T,S)=>(qt(k,T,"access private method"),S),ti=(k,T,S)=>Oi(Hi(k),S,T);const T="",S="";function f(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 Bt="http://www.w3.org/2000/svg";function Tt(d,e){const t=typeof consts<"u"?consts:{},s=t.path||"",n=t.resver==null?"":`?${t.resver}`,r=document.createElementNS(Bt,"use");return r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",`${s}fonts/${d}.svg${n}#${e}`),r}function qe(d,e,t){return d instanceof SVGElement&&d.replaceChildren(Tt(e,t)),d}function W(d,e,t){const s=document.createElementNS(Bt,"svg");if(s.appendChild(Tt(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(Tt(s,n)),t.removeAttribute("data-type"),t.removeAttribute("data-id")}return d}const Pi="";function it(d,e="fa-regular",t,s=-1,n="check"){d.appendChild(f("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)},W(e,n))),t instanceof Element?d.appendChild(t):(t==null?void 0:t.length)>0&&d.appendChild(f("span",r=>r.innerText=t))}function gi(d={}){const e=f("label","ui-check-wrapper ui-radio-wrapper",f("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),it(e,d.type,d.label,d.tabIndex,"circle"),e}function le(d={}){const e=f("label","ui-check-wrapper",f("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)):it(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 a=n.nextElementSibling;a!=null&&(a.tagName==="LABEL"?i=a:a.tagName==="SPAN"&&a.dataset.lgid!=null&&(l=a.innerText,a.style.display="none"))}if(i==null){const a=n.previousElementSibling;a!=null&&(a.tagName==="LABEL"?i=a:l==null&&a.tagName==="SPAN"&&a.dataset.lgid!=null&&(l=a.innerText,a.style.display="none"))}i==null?(i=f("label"),n.parentElement.insertBefore(i,n)):l=i.innerText,n.disabled?i.className="ui-check-wrapper disabled":i.className="ui-check-wrapper",i.replaceChildren(),it(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"):(it(s,s.dataset.type,s.dataset.label,s.dataset.tabIndex),s.removeAttribute("data-type"),s.removeAttribute("data-label"));const n=f("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.fiLine truncated
`).length;e.style.height=`${i*r.lineHeight+12}px`}}}const Ei=Symbol.for("ui-dropdown"),_t=class extends ie{static createEdit(e,t,s){const n=new st({...t.dropOptions,parent:s});return n.onselected=e,n.create()}static setValue(e,t,s,n){if(e.tagName!=="DIV"){let i=p(this,We,Ot).call(this,s,n);i instanceof Promise?i.then(l=>p(this,Me,$t).call(this,l,e,t)):p(this,Me,$t).call(this,i,e,t);return}const r=p(this,Ve,Ht).call(this,e);if(r!=null){if(r.source==null||r.source.length===0){let i=p(this,We,Ot).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){const s=p(this,Ve,Ht).call(this,e);s!=null&&(s.disabled=t===!1)}};let xe=_t;Ve=new WeakSet,Ht=function(e){const t=oe[Ei];if(t==null)return null;const s=e.dataset.dropId,n=t[s];return n??null},We=new WeakSet,Ot=function(e,t){let s=t.source;return typeof s=="function"&&(s=s(e)),s},Me=new WeakSet,$t=function(e,t,s){const n=e==null?void 0:e.find(r=>r.value===s);n!=null&&(s=n.text),ti(_t,this,"setValue").call(this,t,s)},m(xe,Ve),m(xe,We),m(xe,Me);class At extends ie{static createEdit(e){return le({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){e.querySelector("input").disabled=t===!1}}class Ti extends ie{static create(){return f("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 a=W(l,t);e.replaceChildren(a),!re(n.tooltip)&&St(e,n.tooltip,!1,r.element),e.dataset.type=l,e.dataset.icon=t}}static setEnabled(e,t){t===!1?e.classList.add("disabled"):e.classList.remove("disabled");const s=e.querySelector(".ui-tooltip-wrapper");s!=null&&(s.style.display=t===!1?"none":"")}}const nt={Reorder:"reorder",Resize:"resize",Sort:"sort"},lt=xi()?32:0,Si=200,Ut=4,Gt=4,He=50,Jt=200;function rt(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 Oe(d){return Array.prototype.indexOf.call(d.parentElement.children,d)}const Ai={0:ie,1:Kt,2:xe,3:At,4:Ti,5:Li},Je=class{constructor(e){m(this,Ae);m(this,ct);m(this,dt);m(this,ut);m(this,ye);m(this,ht);m(this,ft);m(this,Fe);m(this,V);m(this,ne);m(this,ge);m(this,je);m(this,Be);m(this,Xe);m(this,me);m(this,pt);m(this,Ye);m(this,Ke);m(this,yt);m(this,gt);m(this,mt);m(this,bt);m(this,vt);m(this,xt);m(this,wt);m(this,Ue);m(this,Ge);m(this,Ie);m(this,B,void 0);m(this,O,void 0);m(this,Le,void 0);m(this,M,void 0);m(this,b,void 0);m(this,Ee,void 0);m(this,Te,-1);m(this,D,void 0);m(this,U,0);m(this,he,void 0);m(this,fe,void 0);m(this,se,void 0);m(this,G,-1);m(this,Se,void 0);m(this,pe,void 0);m(this,Ne,{});m(this,A,{});m(this,De,[]);E(this,"columns",[]);E(this,"langs",{all:F("allItem","( All )"),ok:F("ok","OK"),reset:F("reset","Reset")});E(this,"virtualCount",100);E(this,"rowHeight",36);E(this,"lineHeight",24);E(this,"extraRows",0);E(this,"filterRowHeight",30);E(this,"height");E(this,"readonly");E(this,"multiSelect",!1);E(this,"fullrowClick",!0);E(this,"allowHtml",!1);E(this,"holderDisabled",!1);E(this,"headerVisible",!0);E(this,"window",oe);E(this,"sortIndex",-1);E(this,"sortDirection",1);E(this,"willSelect");E(this,"selectedRowChanged");E(this,"cellDblClicked");E(this,"cellClicked");E(this,"rowDblClicked");E(this,"columnChanged");x(this,Le,e)}get element(){return o(this,M)}get source(){var e;return(e=o(this,B))==null?void 0:e.map(t=>t.values)}set source(e){if(o(this,M)==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,B,e),p(this,Ae,Lt).call(this,e)}get virtual(){var e;return((e=o(this,O))==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 o(this,D)}set selectedIndexes(e){const t=o(this,U);o(this,D).splice(0,o(this,D).length,...e),this.readonly!==!0?this.refresh():[...o(this,b).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(o(this,D)&&o(this,D)[0])??-1}get loading(){var e,t;return((t=(e=o(this,b).loading)==null?void 0:e.style)==null?void 0:t.visibility)==="visible"}set loading(e){o(this,b).loading!=null&&(e===!1?(o(this,b).loading.style.visibility="hidden",o(this,b).loading.style.opacity=0):(o(this,b).loading.style.visibility="visible",o(this,b).loading.style.opacity=1))}get scrollTop(){var e;return(e=o(this,b).body)==null?void 0:e.scrollTo Line truncated
(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 A,F,O,P,Y,me,He,re,oe,ae,Ke,be,vt,ve,xt,Oe,_t,$e,qt,Pe,Rt,ze,Ht,j,$,xe,W,v,we,ke,M,K,ce,de,ee,U,Ce,ue,Le,I,At,Ee,wt,lt,Zt,rt,ei,ot,ti,at,ii,he,Ue,ct,si,dt,ni,Ve,Ot,z,X,te,Se,fe,Ge,We,$t,Me,Pt,De,zt,pe,Je,ut,li,Fe,Vt,je,Wt,ht,ri,ft,oi,pt,ai,yt,ci,gt,di,mt,ui,bt,hi,Be,Mt,Xe,Dt,Te,kt,G,H,J,B,Q;"use strict";var _i=Object.defineProperty;var qi=Object.getPrototypeOf;var Ri=Reflect.get;var Hi=(w,L,N)=>L in w?_i(w,L,{enumerable:!0,configurable:!0,writable:!0,value:N}):w[L]=N;var C=(w,L,N)=>(Hi(w,typeof L!="symbol"?L+"":L,N),N),It=(w,L,N)=>{if(!L.has(w))throw TypeError("Cannot "+N)};var a=(w,L,N)=>(It(w,L,"read from private field"),N?N.call(w):L.get(w)),g=(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,f)=>(It(w,L,"write to private field"),f?f.call(w,N):L.set(w,N),N);var y=(w,L,N)=>(It(w,L,"access private method"),N),Qt=(w,L,N)=>Ri(qi(w),N,L);const L="",N="";function f(c,e,...t){const s=document.createElement(c);return typeof e=="function"?e(s):e!=null&&(s.className=e),t.length>0&&s.append(...t),s}const Ft="http://www.w3.org/2000/svg";function Ct(c,e){const t=typeof consts<"u"?consts:{},s=t.path||"",n=t.resver==null?"":`?${t.resver}`,r=document.createElementNS(Ft,"use");return r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",`${s}fonts/${c}.svg${n}#${e}`),r}function Ne(c,e,t){return c instanceof SVGElement&&c.replaceChildren(Ct(e,t)),c}function V(c,e,t){const s=document.createElementNS(Ft,"svg");if(s.appendChild(Ct(c,e)),t!=null)for(let n of Object.entries(t))s.style.setProperty(n[0],n[1]);return s}function fi(c){const e=c.querySelectorAll("svg[data-id]");for(let t of e){const s=t.dataset.type,n=t.dataset.id;t.replaceChildren(Ct(s,n)),t.removeAttribute("data-type"),t.removeAttribute("data-id")}return c}const Oi="";function Qe(c,e="fa-regular",t,s=-1,n="check"){c.appendChild(f("layer",r=>{r.className="ui-check-inner",r.addEventListener("keypress",i=>{if(i.key===" "||i.key==="Enter"){const l=c.querySelector("input");l!=null&&(l.checked=!l.checked,l.dispatchEvent(new Event("change")))}}),s>=0&&(r.tabIndex=s)},V(e,n))),t instanceof Element?c.appendChild(t):(t==null?void 0:t.length)>0&&c.appendChild(f("span",r=>r.innerText=t))}function pi(c={}){const e=f("label","ui-check-wrapper ui-radio-wrapper",f("input",t=>{if(t.setAttribute("type","radio"),t.name=c.name,c.checked===!0&&(t.checked=!0),c.enabled===!1&&(t.disabled=!0),c.customerAttributes!=null)for(let s of Object.entries(c.customerAttributes))t.setAttribute(s[0],s[1]);typeof c.onchange=="function"&&t.addEventListener("change",c.onchange)}));return c.className&&e.classList.add(c.className),Qe(e,c.type,c.label,c.tabIndex,"circle"),e}function ie(c={}){const e=f("label","ui-check-wrapper",f("input",t=>{if(t.setAttribute("type","checkbox"),c.checked===!0&&(t.checked=!0),c.enabled===!1&&(t.disabled=!0),c.customerAttributes!=null)for(let s of Object.entries(c.customerAttributes))t.setAttribute(s[0],s[1]);typeof c.onchange=="function"&&t.addEventListener("change",c.onchange)}));return c.className&&e.classList.add(c.className),c.enabled===!1&&e.classList.add("disabled"),c.checkedNode!=null&&c.uncheckedNode!=null?(e.classList.add("ui-check-image-wrapper"),c.imageHeight,c.checkedNode.classList.add("checked"),e.appendChild(c.checkedNode),c.uncheckedNode.classList.add("unchecked"),e.appendChild(c.uncheckedNode)):Qe(e,c.type,c.label,c.tabIndex),e}function yi(c=document.body,e){if(e){const s=c.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=c.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=f("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=c.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=f("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(nLine truncated
`).length;e.style.height=`${i*r.lineHeight+12}px`}}}const Ci=Symbol.for("ui-dropdown"),Nt=class extends Z{static createEdit(e,t,s){const n=new Ze({...t.dropOptions,parent:s});return n.onselected=e,n.create()}static setValue(e,t,s,n){if(e.tagName!=="DIV"){let i=y(this,Pe,Rt).call(this,s,n);i instanceof Promise?i.then(l=>y(this,ze,Ht).call(this,l,e,t)):y(this,ze,Ht).call(this,i,e,t);return}const r=y(this,$e,qt).call(this,e);if(r!=null){if(r.source==null||r.source.length===0){let i=y(this,Pe,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){const s=y(this,$e,qt).call(this,e);s!=null&&(s.disabled=t===!1)}};let ge=Nt;$e=new WeakSet,qt=function(e){const t=ne[Ci];if(t==null)return null;const s=e.dataset.dropId,n=t[s];return n??null},Pe=new WeakSet,Rt=function(e,t){let s=t.source;return typeof s=="function"&&(s=s(e)),s},ze=new WeakSet,Ht=function(e,t,s){const n=e==null?void 0:e.find(r=>r.value===s);n!=null&&(s=n.text),Qt(Nt,this,"setValue").call(this,t,s)},g(ge,$e),g(ge,Pe),g(ge,ze);class Tt extends Z{static createEdit(e){return ie({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){e.querySelector("input").disabled=t===!1}}class Li extends Z{static create(){return f("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=V(l,t);e.replaceChildren(o),!se(n.tooltip)&&Lt(e,n.tooltip,!1,r.element),e.dataset.type=l,e.dataset.icon=t}}static setEnabled(e,t){t===!1?e.classList.add("disabled"):e.classList.remove("disabled");const s=e.querySelector(".ui-tooltip-wrapper");s!=null&&(s.style.display=t===!1?"none":"")}}const et={Reorder:"reorder",Resize:"resize",Sort:"sort"},tt=bi()?32:0,Ei=200,Yt=4,Kt=4,_e=50,Ut=200;function it(c){var t;return c==null?null:(c.touches&&((t=c.touches[0])==null?void 0:t.clientX))??c.clientX}function Ti(c){let e=0;for(;c!=null;)e+=c.offsetLeft,c=c.offsetParent;return e}function qe(c){return Array.prototype.indexOf.call(c.parentElement.children,c)}const Si={0:Z,1:Xt,2:ge,3:Tt,4:Li,5:ki},Ye=class{constructor(e){g(this,Ee);g(this,lt);g(this,rt);g(this,ot);g(this,at);g(this,he);g(this,ct);g(this,dt);g(this,Ve);g(this,z);g(this,te);g(this,fe);g(this,We);g(this,Me);g(this,De);g(this,pe);g(this,ut);g(this,Fe);g(this,je);g(this,ht);g(this,ft);g(this,pt);g(this,yt);g(this,gt);g(this,mt);g(this,bt);g(this,Be);g(this,Xe);g(this,Te);g(this,j,void 0);g(this,$,void 0);g(this,xe,void 0);g(this,W,void 0);g(this,v,void 0);g(this,we,void 0);g(this,ke,-1);g(this,M,void 0);g(this,K,0);g(this,ce,void 0);g(this,de,void 0);g(this,ee,void 0);g(this,U,-1);g(this,Ce,void 0);g(this,ue,void 0);g(this,Le,{});g(this,I,{});g(this,At,[]);C(this,"columns",[]);C(this,"langs",{all:D("allItem","( All )"),ok:D("ok","OK"),reset:D("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",ne);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,xe,e)}get element(){return a(this,W)}get source(){var e;return(e=a(this,j))==null?void 0:e.map(t=>t.values)}set source(e){if(a(this,W)==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,j,e),y(this,Ee,wt).call(this,e)}get virtual(){var e;return((e=a(this,$))==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.s Line truncated
//# sourceMappingURL=ui.min.js.map
+1 -1
View File
@@ -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 Line truncated
{"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 Line truncated
+2 -2
View File
@@ -1,4 +1,4 @@
(function(i,c){typeof exports=="object"&&typeof module<"u"?c(exports):typeof define=="function"&&define.amd?define(["exports"],c):(i=typeof globalThis<"u"?globalThis:i||self,c(i["lib-utility"]={}))})(this,function(i){"use strict";function c(e,t,n){if(e==null)return;let r=`; domain=${location.host}; path=/`;if(n!=null){const l=new Date;l.setTime(l.getTime()+n*24*60*60*1e3),r+=`; expires=${l.toGMTString()}`}/^(https|wss):$/.test(location.protocol)&&(r+="; secure"),document.cookie=`${e}=${encodeURIComponent(t)}${r}`}function f(e){if(e==null)return null;e+="=";const t=document.cookie.split(";");for(let n of t)if(n=n.trim(),n.indexOf(e)===0)return decodeURIComponent(n.substring(e.length));return null}function $(e){c(e,"",-1)}function d(e){return/^(https?|wss?|ftp):/.test(e)||typeof consts>"u"?e:(consts.path||"")+e}function w(e,t={}){return fetch(d(e),{method:t.method||"GET",headers:{...t.customerHeaders,Accept:t.accept||"application/json"},signal:t.signal,cache:"default"})}function A(e,t,n={}){return t instanceof FormData||(typeof t!="string"&&(t=JSON.stringify(t)),n.customerHeaders==null&&(n.customerHeaders={}),n.customerHeaders["Content-Type"]==null&&(n.customerHeaders["Content-Type"]="application/json")),fetch(d(e),{method:n.method||"POST",headers:n.customerHeaders,body:t,signal:n.signal,cache:"no-cache"})}function O(e,t,n={}){return new Promise((r,l)=>{const a=new XMLHttpRequest;if(a.onreadystatechange=function(){this.readyState===XMLHttpRequest.DONE&&(this.status===200?r(this):l(`${this.status} ${this.statusText}: ${this.responseText}`))},typeof n.progress=="function"&&a.upload.addEventListener("progress",function(u){u.lengthComputable&&n.progress.call(this,u)},!1),a.open("POST",d(e)),n.customerHeaders!=null)for(let u of Object.entries(n.customerHeaders))a.setRequestHeader(u[0],u[1]);a.send(t)})}function o(e){return e==null||typeof e!="string"||e.length===0}function C(e,t,n){return o(e)||t==null?!1:(typeof t!="string"&&(t=String(t)),n?e.toLowerCase().indexOf(t.toLowerCase())>=0:e.indexOf(t)>=0)}function L(e,t){return o(e)||o(t)?!1:e.indexOf(t)===e.length-t.length}function N(e,t,n){return o(e)||isNaN(t)||t<=e.length?e:(n??" ").repeat(t-e.length)}function H(e){const t=/(http|ftp|https):\/\/.+?(\s|\r\n|\r|\n|\"|\'|\*|$)/g,n=e.match(t);if(e=m(e),(n==null?void 0:n.length)>0){const r=[];for(let l of n)l=l.replace(/["'\r\n ]/g,""),r.indexOf(l)<0&&r.push(l);for(let l of r)e=e.replaceAll(l,'<a target="_blank" href="'+l+'"><svg><use xlink:href="'+(typeof consts<"u"&&consts.path||"")+'fonts/fa-regular.svg#link"></use></svg></a>')}return e}function m(e){return e==null?"":String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll(`\r
(function(i,c){typeof exports=="object"&&typeof module<"u"?c(exports):typeof define=="function"&&define.amd?define(["exports"],c):(i=typeof globalThis<"u"?globalThis:i||self,c(i["lib-utility"]={}))})(this,function(i){"use strict";function c(e,t,n){if(e==null)return;let r=`; domain=${location.host}; path=/`;if(n!=null){const l=new Date;l.setTime(l.getTime()+n*24*60*60*1e3),r+=`; expires=${l.toGMTString()}`}/^(https|wss):$/.test(location.protocol)&&(r+="; secure"),document.cookie=`${e}=${encodeURIComponent(t)}${r}`}function f(e){if(e==null)return null;e+="=";const t=document.cookie.split(";");for(let n of t)if(n=n.trim(),n.indexOf(e)===0)return decodeURIComponent(n.substring(e.length));return null}function k(e){c(e,"",-1)}function d(e){return/^(https?|wss?|ftp):/.test(e)||typeof consts>"u"?e:(consts.path||"")+e}function w(e,t={}){return fetch(d(e),{method:t.method||"GET",headers:{...t.customerHeaders,Accept:t.accept||"application/json"},signal:t.signal,cache:"default"})}function A(e,t,n={}){return t instanceof FormData||(typeof t!="string"&&(t=JSON.stringify(t)),n.customerHeaders==null&&(n.customerHeaders={}),n.customerHeaders["Content-Type"]==null&&(n.customerHeaders["Content-Type"]="application/json")),fetch(d(e),{method:n.method||"POST",headers:n.customerHeaders,body:t,signal:n.signal,cache:"no-cache"})}function O(e,t,n={}){return new Promise((r,l)=>{const a=new XMLHttpRequest;if(a.onreadystatechange=function(){this.readyState===XMLHttpRequest.DONE&&(this.status===200?r(this):l(`${this.status} ${this.statusText}: ${this.responseText}`))},typeof n.progress=="function"&&a.upload.addEventListener("progress",function(u){u.lengthComputable&&n.progress.call(this,u)},!1),a.open("POST",d(e)),n.customerHeaders!=null)for(let u of Object.entries(n.customerHeaders))a.setRequestHeader(u[0],u[1]);a.send(t)})}function o(e){return e==null||typeof e!="string"||e.length===0}function C(e,t,n){return o(e)||t==null?!1:(typeof t!="string"&&(t=String(t)),n?e.toLowerCase().indexOf(t.toLowerCase())>=0:e.indexOf(t)>=0)}function L(e,t){return o(e)||o(t)?!1:e.indexOf(t)===e.length-t.length}function N(e,t,n){return o(e)||isNaN(t)||t<=e.length?e:(n??" ").repeat(t-e.length)}function H(e){const t=/(http|ftp|https):\/\/.+?(\s|\r\n|\r|\n|\"|\'|\*|$)/g,n=e.match(t);if(e=m(e),(n==null?void 0:n.length)>0){const r=[];for(let l of n)l=l.replace(/["'\r\n ]/g,""),r.indexOf(l)<0&&r.push(l);for(let l of r)e=e.replaceAll(l,'<a target="_blank" href="'+l+'"><svg><use xlink:href="'+(typeof consts<"u"&&consts.path||"")+'fonts/fa-regular.svg#link"></use></svg></a>')}return e}function m(e){return e==null?"":String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll(`\r
`,"<br/>").replaceAll(`
`,"<br/>").replaceAll(" ","&nbsp;")}let g;function h(){var n,r;let e;switch(typeof consts<"u"&&(e=f((n=consts.cookie)==null?void 0:n.lang),o(e)&&(e=(r=consts.user)==null?void 0:r.language)),o(e)&&(e=f("lgid")),o(e)&&(e=navigator.language||"en-us"),e=e.toLowerCase().replace(/-/g,"_"),o(e)&&(e="en"),e){case"en":case"en_au":case"fr":case"zh_cn":return e}const t=e.split("_")[0];switch(t){case"en":case"fr":return t}return"en"}function T(e){return typeof consts<"u"?(consts.prefix||"")+`res_${e}`:`res_${e}`}async function v(e=""){const t=h(),r=await(await w(`language/${t}${e}`)).json();return localStorage.setItem(T(t),JSON.stringify(r)),r}async function p(e,t){(t==null||typeof consts>"u")&&(t=await v(e));const n=Number(consts.resver);return(isNaN(t.ver)||isNaN(n)||n>t.ver)&&(console.log(`found new language res version: ${t.ver} => ${n}`),t=await v(e)),Object.defineProperty(t,"r",{writable:!1,configurable:!1,enumerable:!1,value:function(r,l){return s(this,r,l)}}),g=t,t}function s(e,t,n){return e[t]??n}function S(e,t){for(let n of e.querySelectorAll("[data-lgid]")){const r=n.dataset.lgid;n.tagName==="INPUT"?n.value=s(t,r,n.value):n.innerText=s(t,r,n.innerText)}for(let n of e.querySelectorAll("[data-title-lgid]")){const r=n.dataset.titleLgid;n.setAttribute("title",s(t,r,n.getAttribute("title")))}for(let n of e.querySelectorAll("[data-placeholder-lgid]")){const r=n.dataset.placeholderLgid;n.setAttribute("placeholder",s(t,r,n.getAttribute("placeholder")))}}async function P(e=document.body,t={}){const n=h();let r=localStorage.getItem(T(n)),l;if(r!=null)try{r=JSON.parse(r),l=await p(t.template,r)}catch(a){console.error("error while parsing lgres, try refresh ...",a),l=await p(t.template)}else l=await p(t.template);try{return document.readyState==="loading"?await new Promise((a,u)=>{let k=setTimeout(()=>u("timeout"),3e4);document.addEventListener("DOMContentLoaded",()=>{clearTimeout(k),k=void 0,typeof t.callback=="function"&&t.callback(l),S(e,l),a(l)})}):(typeof t.callback=="function"&&t.callback(l),S(e,l),l)}catch(a){console.error("error while loading language res ...",a)}}function y(e,t){return g!=null?s(g,e,t):t}const E={get current(){return h()},get unknownError(){return y("unknownError","An unknown error occurred, please contact the administrator.")},get savedSuccessfully(){return y("savedSuccessfully","Saved successfully.")}};let b=typeof globalThis<"u"?globalThis:self;function M(e){return!isNaN(e)&&e>0}function j(){return/mobile/i.test(navigator.userAgent)}function q(e,t=100,n=b,...r){if(e==null)return;e.tiid&&clearTimeout(e.tiid);const l=new Date;e.tdate==null||l-e.tdate>t?(e.apply(n,r),e.tdate=l):e.tiid=setTimeout(()=>e.apply(n,r),t)}function _(e,t=100,n=b,...r){e!=null&&(e.tiid&&clearTimeout(e.tiid),e.tiid=setTimeout(()=>e.apply(n,r),t))}function I(e){return(e>0?Math.floor:Math.ceil)(e)}function R(e){return/^\w[-\w.+]*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(e)}function U(e){return/^[1-9]\d{9,}$/.test(e)}i.contains=C,i.debounce=_,i.deleteCookie=$,i.endsWith=L,i.escapeHtml=m,i.formatUrl=H,i.get=w,i.getCookie=f,i.global=b,i.init=P,i.isEmail=R,i.isMobile=j,i.isPhone=U,i.isPositive=M,i.lang=E,i.nullOrEmpty=o,i.padStart=N,i.post=A,i.r=y,i.setCookie=c,i.throttle=q,i.truncate=I,i.upload=O,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
`,"<br/>").replaceAll(" ","&nbsp;")}let g;function h(){var n,r;let e;switch(typeof consts<"u"&&(e=f((n=consts.cookie)==null?void 0:n.lang),o(e)&&(e=(r=consts.user)==null?void 0:r.language)),o(e)&&(e=f("lgid")),o(e)&&(e=navigator.language||"en-us"),e=e.toLowerCase().replace(/-/g,"_"),o(e)&&(e="en"),e){case"en":case"en_au":case"fr":case"zh_cn":return e}const t=e.split("_")[0];switch(t){case"en":case"fr":return t}return"en"}function T(e){return typeof consts<"u"?(consts.prefix||"")+`res_${e}`:`res_${e}`}async function v(e=""){const t=h(),r=await(await w(`language/${t}${e}`)).json();return localStorage.setItem(T(t),JSON.stringify(r)),r}async function p(e,t){(t==null||typeof consts>"u")&&(t=await v(e));const n=Number(consts.resver);return(isNaN(t.ver)||isNaN(n)||n>t.ver)&&(console.log(`found new language res version: ${t.ver} => ${n}`),t=await v(e)),Object.defineProperty(t,"r",{writable:!1,configurable:!1,enumerable:!1,value:function(r,l){return s(this,r,l)}}),g=t,t}function s(e,t,n){return e[t]??n}function S(e,t){for(let n of e.querySelectorAll("[data-lgid]")){const r=n.dataset.lgid;n.tagName==="INPUT"?n.value=s(t,r,n.value):n.innerText=s(t,r,n.innerText)}for(let n of e.querySelectorAll("[data-title-lgid]")){const r=n.dataset.titleLgid;n.setAttribute("title",s(t,r,n.getAttribute("title")))}for(let n of e.querySelectorAll("[data-placeholder-lgid]")){const r=n.dataset.placeholderLgid;n.setAttribute("placeholder",s(t,r,n.getAttribute("placeholder")))}}async function E(e=document.body,t={}){const n=h();let r=localStorage.getItem(T(n)),l;if(r!=null)try{r=JSON.parse(r),l=await p(t.template,r)}catch(a){console.error("error while parsing lgres, try refresh ...",a),l=await p(t.template)}else l=await p(t.template);try{return document.readyState==="loading"?await new Promise((a,u)=>{let $=setTimeout(()=>u("timeout"),3e4);document.addEventListener("DOMContentLoaded",()=>{clearTimeout($),$=void 0,typeof t.callback=="function"&&t.callback(l),S(e,l),a(l)})}):(typeof t.callback=="function"&&t.callback(l),S(e,l),l)}catch(a){console.error("error while loading language res ...",a)}}function y(e,t){return g!=null?s(g,e,t):t}const P={get current(){return h()},get unknownError(){return y("unknownError","An unknown error occurred, please contact the administrator.")},get savedSuccessfully(){return y("savedSuccessfully","Saved successfully.")}};let b=typeof globalThis<"u"?globalThis:self;function M(e){return!isNaN(e)&&e>0}function j(){return/mobile/i.test(navigator.userAgent)}function q(e,t=100,n=b,...r){if(e==null)return;e.tiid&&clearTimeout(e.tiid);const l=new Date;e.tdate==null||l-e.tdate>t?(e.apply(n,r),e.tdate=l):e.tiid=setTimeout(()=>e.apply(n,r),t)}function R(e,t=100,n=b,...r){e!=null&&(e.tiid&&clearTimeout(e.tiid),e.tiid=setTimeout(()=>e.apply(n,r),t))}function _(e){return(e>0?Math.floor:Math.ceil)(e)}function I(e){return/^\w[-\w.+]*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(e)}function U(e){return!!(/^[1-9]\d{9,}$/.test(e)||/^\+?[1-9][\d-]{9,}\d$/.test(e)&&/^[1-9]\d{9,}$/.test(e.replace("+","").replace(new RegExp("-","g"),"")))}i.contains=C,i.debounce=R,i.deleteCookie=k,i.endsWith=L,i.escapeHtml=m,i.formatUrl=H,i.get=w,i.getCookie=f,i.global=b,i.init=E,i.isEmail=I,i.isMobile=j,i.isPhone=U,i.isPositive=M,i.lang=P,i.nullOrEmpty=o,i.padStart=N,i.post=A,i.r=y,i.setCookie=c,i.throttle=q,i.truncate=_,i.upload=O,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
//# sourceMappingURL=utility.min.js.map
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"utility.min.js","sources":["../lib/utility/cookie.js","../lib/utility/request.js","../lib/utility/strings.js","../lib/utility/lgres.js","../lib/utility.js"],"sourcesContent":["function setCookie(name, value, expireDays) {\r\n if (name == null) {\r\n return;\r\n }\r\n let extra = `; domain=${location.host}; path=/`;\r\n if (expireDays != null) {\r\n const d = new Date();\r\n d.setTime(d.getTime() + (expireDays * 24 * 60 * 60 * 1000));\r\n extra += `; expires=${d.toGMTString()}`;\r\n }\r\n if (/^(https|wss):$/.test(location.protocol)) {\r\n extra += '; secure';\r\n }\r\n document.cookie = `${name}=${encodeURIComponent(value)}${extra}`;\r\n}\r\n\r\nfunction getCookie(name) {\r\n if (name == null) {\r\n return null;\r\n }\r\n name += '=';\r\n const cookies = document.cookie.split(';');\r\n for (let cookie of cookies) {\r\n cookie = cookie.trim();\r\n if (cookie.indexOf(name) === 0) {\r\n return decodeURIComponent(cookie.substring(name.length));\r\n }\r\n }\r\n return null;\r\n}\r\n\r\nfunction deleteCookie(name) {\r\n setCookie(name, '', -1);\r\n}\r\n\r\nexport {\r\n getCookie,\r\n setCookie,\r\n deleteCookie\r\n}","function combineUrl(url) {\r\n if (/^(https?|wss?|ftp):/.test(url)) {\r\n return url;\r\n }\r\n if (typeof consts === 'undefined') {\r\n return url;\r\n }\r\n return (consts.path || '') + url;\r\n}\r\n\r\nfunction get(url, options = {}) {\r\n return fetch(combineUrl(url), {\r\n method: options.method || 'GET',\r\n headers: {\r\n ...options.customerHeaders,\r\n 'Accept': options.accept || 'application/json'\r\n },\r\n signal: options.signal,\r\n cache: 'default'\r\n });\r\n}\r\n\r\nfunction post(url, data, options = {}) {\r\n // let contentType;\r\n if (data instanceof FormData) {\r\n // contentType = 'multipart/form-data';\r\n } else {\r\n if (typeof data !== 'string') {\r\n data = JSON.stringify(data);\r\n }\r\n // contentType = 'application/json';\r\n if (options.customerHeaders == null) {\r\n options.customerHeaders = {};\r\n }\r\n if (options.customerHeaders['Content-Type'] == null) {\r\n options.customerHeaders['Content-Type'] = 'application/json';\r\n }\r\n }\r\n return fetch(combineUrl(url), {\r\n method: options.method || 'POST',\r\n headers: options.customerHeaders,\r\n body: data,\r\n signal: options.signal,\r\n cache: 'no-cache'\r\n });\r\n}\r\n\r\nfunction upload(url, data, options = {}) {\r\n return new Promise((resolve, reject) => {\r\n const request = new XMLHttpRequest();\r\n request.onreadystatechange = function () {\r\n if (this.readyState === XMLHttpRequest.DONE) {\r\n if (this.status === 200) {\r\n resolve(this);\r\n } else {\r\n reject(`${this.status} ${this.statusText}: ${this.responseText}`);\r\n }\r\n }\r\n };\r\n if (typeof options.progress === 'function') {\r\n request.upload.addEventListener('progress', function (ev) {\r\n if (ev.lengthComputable) {\r\n options.progress.call(this, ev);\r\n }\r\n }, false);\r\n }\r\n request.open('POST', combineUrl(url));\r\n if (options.customerHeaders != null) {\r\n for (let header of Object.entries(options.customerHeaders)) {\r\n request.setRequestHeader(header[0], header[1]);\r\n }\r\n }\r\n request.send(data);\r\n });\r\n}\r\n\r\nexport {\r\n get,\r\n post,\r\n upload\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);\rLine truncated
{"version":3,"file":"utility.min.js","sources":["../lib/utility/cookie.js","../lib/utility/request.js","../lib/utility/strings.js","../lib/utility/lgres.js","../lib/utility.js"],"sourcesContent":["function setCookie(name, value, expireDays) {\r\n if (name == null) {\r\n return;\r\n }\r\n let extra = `; domain=${location.host}; path=/`;\r\n if (expireDays != null) {\r\n const d = new Date();\r\n d.setTime(d.getTime() + (expireDays * 24 * 60 * 60 * 1000));\r\n extra += `; expires=${d.toGMTString()}`;\r\n }\r\n if (/^(https|wss):$/.test(location.protocol)) {\r\n extra += '; secure';\r\n }\r\n document.cookie = `${name}=${encodeURIComponent(value)}${extra}`;\r\n}\r\n\r\nfunction getCookie(name) {\r\n if (name == null) {\r\n return null;\r\n }\r\n name += '=';\r\n const cookies = document.cookie.split(';');\r\n for (let cookie of cookies) {\r\n cookie = cookie.trim();\r\n if (cookie.indexOf(name) === 0) {\r\n return decodeURIComponent(cookie.substring(name.length));\r\n }\r\n }\r\n return null;\r\n}\r\n\r\nfunction deleteCookie(name) {\r\n setCookie(name, '', -1);\r\n}\r\n\r\nexport {\r\n getCookie,\r\n setCookie,\r\n deleteCookie\r\n}","function combineUrl(url) {\r\n if (/^(https?|wss?|ftp):/.test(url)) {\r\n return url;\r\n }\r\n if (typeof consts === 'undefined') {\r\n return url;\r\n }\r\n return (consts.path || '') + url;\r\n}\r\n\r\nfunction get(url, options = {}) {\r\n return fetch(combineUrl(url), {\r\n method: options.method || 'GET',\r\n headers: {\r\n ...options.customerHeaders,\r\n 'Accept': options.accept || 'application/json'\r\n },\r\n signal: options.signal,\r\n cache: 'default'\r\n });\r\n}\r\n\r\nfunction post(url, data, options = {}) {\r\n // let contentType;\r\n if (data instanceof FormData) {\r\n // contentType = 'multipart/form-data';\r\n } else {\r\n if (typeof data !== 'string') {\r\n data = JSON.stringify(data);\r\n }\r\n // contentType = 'application/json';\r\n if (options.customerHeaders == null) {\r\n options.customerHeaders = {};\r\n }\r\n if (options.customerHeaders['Content-Type'] == null) {\r\n options.customerHeaders['Content-Type'] = 'application/json';\r\n }\r\n }\r\n return fetch(combineUrl(url), {\r\n method: options.method || 'POST',\r\n headers: options.customerHeaders,\r\n body: data,\r\n signal: options.signal,\r\n cache: 'no-cache'\r\n });\r\n}\r\n\r\nfunction upload(url, data, options = {}) {\r\n return new Promise((resolve, reject) => {\r\n const request = new XMLHttpRequest();\r\n request.onreadystatechange = function () {\r\n if (this.readyState === XMLHttpRequest.DONE) {\r\n if (this.status === 200) {\r\n resolve(this);\r\n } else {\r\n reject(`${this.status} ${this.statusText}: ${this.responseText}`);\r\n }\r\n }\r\n };\r\n if (typeof options.progress === 'function') {\r\n request.upload.addEventListener('progress', function (ev) {\r\n if (ev.lengthComputable) {\r\n options.progress.call(this, ev);\r\n }\r\n }, false);\r\n }\r\n request.open('POST', combineUrl(url));\r\n if (options.customerHeaders != null) {\r\n for (let header of Object.entries(options.customerHeaders)) {\r\n request.setRequestHeader(header[0], header[1]);\r\n }\r\n }\r\n request.send(data);\r\n });\r\n}\r\n\r\nexport {\r\n get,\r\n post,\r\n upload\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);\rLine truncated
+1 -1
View File
@@ -370,7 +370,7 @@ if (typeof (MapObject) !== "function") {
this.showWeatherLayer = function (state) {
if (state) {
if (!this.WeatherLayer)
this.WeatherLayer = new ArcGISDynamicMapServiceLayerC("https://nowcoast.noaa.gov/arcgis/rest/services/nowcoast/radar_meteo_imagery_nexrad_time/MapServer");
this.WeatherLayer = new ArcGISDynamicMapServiceLayerC("https://new.nowcoast.noaa.gov/arcgis/rest/services/nowcoast/radar_meteo_imagery_nexrad_time/MapServer");
this.WeatherLayer.refreshInterval = 5;
this.MyMap.addLayer(this.WeatherLayer);
}
+1 -1
View File
@@ -34,7 +34,7 @@ var default_page;
fcancel();
}
mask.fadeOut(100);
}, true);
}, null, true);
}
window.showalert = function (msg, title, icon, next) {
_dialog.showAlert(msg, title, icon, next, true);