fleet-contractor/Site/js/lib/element.min.js
2024-03-26 15:56:31 +08:00

3 lines
8.9 KiB
JavaScript

(function(r,t){typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(r=typeof globalThis<"u"?globalThis:r||self,t(r["lib-element"]={}))})(this,function(r){"use strict";var v=Object.defineProperty;var g=(r,t,c)=>t in r?v(r,t,{enumerable:!0,configurable:!0,writable:!0,value:c}):r[t]=c;var y=(r,t,c)=>(g(r,typeof t!="symbol"?t+"":t,c),c);window["lib-ui"].Grid,window["lib-ui"].GridColumn;const t=window["lib-ui"].createElement;window["lib-ui"].setTooltip,window["lib-ui"].createIcon;const c=window["lib-ui"].createCheckbox,o=window["lib-ui"].createRadiobox;window["lib-ui"].showAlert,window["lib-ui"].showConfirm,window["lib-ui"].Popup;const p=window["lib-ui"].Dropdown,a=window["lib-ui"].validation;window["lib-utility"].r,window["lib-utility"].nullOrEmpty,window["lib-utility"].formatUrl,window["lib-utility"].escapeEmoji,window["lib-utility"].isEmail,window["lib-utility"].isPhone;function h(s){var n;return typeof((n=$==null?void 0:$.fn)==null?void 0:n.datepicker)=="function"&&$(s).datepicker({autoHide:!0,format:"m/dd/yyyy"}),s}class m{constructor(n){y(this,"_var",{});this._var.option=n??{},n==null||n.getText}get checkOccurOnce(){return this._var.container.querySelector(".schedule-id-box-occur-once>input")}get checkOccurEvery(){return this._var.container.querySelector(".schedule-id-box-occur-every>input")}get inputOccurOnce(){return this._var.container.querySelector(".schedule-id-occur-once")}get inputOccurEvery(){return this._var.container.querySelector(".schedule-id-occur-every")}get inputOccurStarting(){return this._var.container.querySelector(".schedule-id-occur-starting")}get inputOccurEnding(){return this._var.container.querySelector(".schedule-id-occur-ending")}changeDailyFrequency(n){this.inputOccurOnce.disabled=!n,this.inputOccurEvery.disabled=n,this.inputOccurStarting.disabled=n,this.inputOccurEnding.disabled=n}getParameters(){return{Enabled:this._var.container.querySelector(".schedule-id-enabled>input").checked,Schedule:{Frequency:Number(this.dropFrequency.selected.value),Daily:{OcurrsOnce:this.checkOccurOnce.checked,OcurrsOnceAt:this.inputOccurOnce.value,OcurrsInterval:Number(this.inputOccurEvery.value),StartingAt:this.inputOccurStarting.value,EndingAt:this.inputOccurEnding.value},Monday:this._var.container.querySelector(".schedule-id-1>input").checked,Tuesday:this._var.container.querySelector(".schedule-id-2>input").checked,Wednesday:this._var.container.querySelector(".schedule-id-3>input").checked,Thursday:this._var.container.querySelector(".schedule-id-4>input").checked,Friday:this._var.container.querySelector(".schedule-id-5>input").checked,Saturday:this._var.container.querySelector(".schedule-id-6>input").checked,Sunday:this._var.container.querySelector(".schedule-id-7>input").checked,DayOfMonth:Number(this._var.container.querySelector(".schedule-id-dayofmonth").value),StartDate:this._var.container.querySelector(".schedule-id-duration-start").value,EndDate:this._var.container.querySelector(".schedule-id-duration-end").value}}}getDateTime(n){if(typeof n=="string"){const i=new Date(n);return isNaN(i.getTime())?new Date:i}return n}getTimeString(n){const i=this.getDateTime(n);return String(i.getHours()).padStart(2,"0")+":"+String(i.getMinutes()).padStart(2,"0")}getDateString(n){const i=this.getDateTime(n);return String(i.getMonth()+1).padStart(2,"0")+"/"+String(i.getDate()).padStart(2,"0")+"/"+String(i.getFullYear())}setParameters(n){var l;this._var.container.querySelector(".schedule-id-enabled>input").checked=n.Enabled;const i=n.Schedule||{};this.dropFrequency.select(String(i.Frequency));let u=i.Daily.OcurrsOnce?this.checkOccurOnce:this.checkOccurEvery;u.checked=!0,u.dispatchEvent(new Event("change")),this.inputOccurOnce.value=this.getTimeString(i.Daily.OcurrsOnceAt),this.inputOccurEvery.value=String(i.Daily.OcurrsInterval),this.inputOccurStarting.value=this.getTimeString(i.Daily.StartingAt),this.inputOccurEnding.value=this.getTimeString(i.Daily.EndingAt),this._var.container.querySelector(".schedule-id-1>input").checked=i.Monday,this._var.container.querySelector(".schedule-id-2>input").checked=i.Tuesday,this._var.container.querySelector(".schedule-id-3>input").checked=i.Wednesday,this._var.container.querySelector(".schedule-id-4>input").checked=i.Thursday,this._var.container.querySelector(".schedule-id-5>input").checked=i.Friday,this._var.container.querySelector(".schedule-id-6>input").checked=i.Saturday,this._var.container.querySelector(".schedule-id-7>input").checked=i.Sunday,this._var.container.querySelector(".schedule-id-dayofmonth").value=String(i.DayOfMonth);const e=this.getDateString(i.StartDate),d=this.getDateString(i.EndDate);typeof((l=$==null?void 0:$.fn)==null?void 0:l.datepicker)=="function"?($(this._var.container.querySelector(".schedule-id-duration-start")).datepicker("setDate",new Date(e)),$(this._var.container.querySelector(".schedule-id-duration-end")).datepicker("setDate",new Date(d))):(this._var.container.querySelector(".schedule-id-duration-start").value=e,this._var.container.querySelector(".schedule-id-duration-end").value=d)}create(){const n=this._var.option,i=new p({selected:"0"});this.dropFrequency=i,i.source=[{value:"0",text:"Daily"},{value:"1",text:"Weekly"},{value:"2",text:"Monthly"}],i.onSelected=e=>{u.querySelector(".schedule-item-weekly").style.display=e.value==="1"?"":"none";const d=e.value==="2";if(u.querySelector(".schedule-item-monthly").style.display=d?"":"none",!d){const l=this._var.container.querySelector(".schedule-id-dayofmonth");l.classList.contains("validation-error")&&(l.value="1")}};const u=t("div","schedule-item-container",t("fieldset","schedule-item-frequency",t("legend",e=>e.innerText="Frequency"),t("div","schedule-item-line",t("span",e=>e.innerText="Occurs"),i.create()),t("div",e=>{e.className="schedule-item-panel schedule-item-weekly",e.style.display="none"},t("table","schedule-item-table",t("tr","schedule-item-tr",t("td",null,c({className:"schedule-id-1",label:"Monday"})),t("td",null,c({className:"schedule-id-3",label:"Wednesday"})),t("td",null,c({className:"schedule-id-5",label:"Friday"})),t("td",null,c({className:"schedule-id-6",label:"Saturday"}))),t("tr","schedule-item-tr",t("td",null,c({className:"schedule-id-2",label:"Tuesday"})),t("td",null,c({className:"schedule-id-4",label:"Thursday"})),t("td"),t("td",null,c({className:"schedule-id-7",label:"Sunday"}))))),t("div",e=>{e.className="schedule-item-panel schedule-item-monthly",e.style.display="none"},t("div","schedule-item-line",t("span",e=>e.innerText="On day"),a(t("input",e=>{e.type="text",e.className="ui-input schedule-id-dayofmonth",e.maxLength=2}),/^([0]?[1-9]|[12][0-9]|[3][01])$/),t("span",e=>e.innerText="of the month")))),t("fieldset","schedule-item-daily-frequency",t("legend",e=>e.innerText="Daily frequency"),t("div","schedule-item-line",o({name:"schedule-daily-occurs",checked:!0,className:"schedule-id-box-occur-once",label:"Occurs once at",onchange:e=>this.changeDailyFrequency(e.target.checked)}),a(t("input",e=>{e.type="text",e.className="ui-input schedule-id-occur-once",e.maxLength=5}),/^([01][0-9]|[2][0-3]):[0-5][0-9]$/)),t("div","schedule-item-line schedule-item-line-occur-every",o({name:"schedule-daily-occurs",className:"schedule-id-box-occur-every",label:"Occurs every",onchange:e=>this.changeDailyFrequency(!e.target.checked)}),a(t("input",e=>{e.type="text",e.className="ui-input schedule-id-occur-every",e.maxLength=5}),/^([0][1-9]+|[1-9][0-9]*)$/),t("span",e=>e.innerText="minute(s)"),t("div","schedule-item-placeholder"),t("div","schedule-item-block",t("div","scheldule-item-line",t("span",e=>e.innerText="Starting at"),a(t("input",e=>{e.type="text",e.className="ui-input schedule-id-occur-starting",e.maxLength=5}),/^([01][0-9]|[2][0-3]):[0-5][0-9]$/)),t("div","scheldule-item-line",t("span",e=>e.innerText="Ending at"),a(t("input",e=>{e.type="text",e.className="ui-input schedule-id-occur-ending",e.maxLength=5}),/^([01][0-9]|[2][0-3]):[0-5][0-9]$/))))),t("fieldset","schedule-item-duration",t("legend",e=>e.innerText="Duration"),t("div","schedule-item-line schedule-item-line-duration",t("span",e=>e.innerText="Start date"),h(a(t("input",e=>{e.type="text",e.className="ui-input schedule-id-duration-start",e.maxLength=10}),/^([0]?[1-9]|[1][0-2])\/([0]?[1-9]|[12][0-9]|[3][01])\/[0-9]{4}$/)),t("div","schedule-item-placeholder"),t("span",e=>e.innerText="End date"),h(a(t("input",e=>{e.type="text",e.className="ui-input schedule-id-duration-end",e.maxLength=10}),/^([0]?[1-9]|[1][0-2])\/([0]?[1-9]|[12][0-9]|[3][01])\/[0-9]{4}$/))),t("div","schedule-item-line",c({className:"schedule-id-enabled",checked:!0,label:"Enabled"}))));return this._var.container=u,n.parameter==null&&(n.parameter={Enabled:!0,Schedule:{Frequency:0,Daily:{OcurrsOnce:!0,OcurrsOnceAt:"00:00",OcurrsInterval:60,StartingAt:"00:00",EndingAt:"23:00"},Monday:!0,Tuesday:!1,Wednesday:!1,Thursday:!1,Friday:!1,Saturday:!1,Sunday:!1,DayOfMonth:1,StartDate:"",EndDate:""}}),this.setParameters(n.parameter),u}}r.ScheduleItem=m,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});
//# sourceMappingURL=element.min.js.map