@quandis/qbo4.ui-bridge 4.0.1-CI-20241031-130254 → 4.0.1-CI-20241031-205224

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -225,7 +225,7 @@ ${Array.from(fo.keys()).map((e=>Ut`<div class="col-3">
225
225
  </div>
226
226
  </footer>
227
227
  </dialog>
228
- `:Ut``}`}};function ss(t,e,o="qbo4.ui.preferences"){const r=localStorage.getItem(o);let n={};if(r)try{n=JSON.parse(r)}catch(t){console.error(`Error parsing ${o} from localStorage:`,t,r)}n[t]=e;try{localStorage.setItem(o,JSON.stringify(n))}catch(t){console.error(`Error saving ${o} to localStorage:`,t)}}function ds(t,e="qbo4.ui.preferences"){const o=localStorage.getItem(e);if(o)try{return JSON.parse(o)[t]}catch(t){console.error(`Error parsing ${e} from localStorage:`,t,o)}}function cs(t,e=" "){return t.filter(Boolean).join(e)}function fs(t,e=null){if(null==t||isNaN(new Date(t).getTime()))return null;const o=e??ds("dateFormat")??"MM/dd/yyyy",r={};return o.includes("yyyy")&&(r.year="numeric"),o.includes("MM")&&(r.month=o.includes("MMM")?"short":"2-digit"),o.includes("dd")&&(r.day="2-digit"),o.includes("HH")&&(r.hour="2-digit"),o.includes("mm")&&(r.minute="2-digit"),o.includes("ss")&&(r.second="2-digit"),o.includes("tt")&&(r.hour12=!0),o.includes("dddd")&&(r.weekday="long"),o.includes("ddd")&&(r.weekday="short"),new Intl.DateTimeFormat(void 0,r).format(new Date(t))}as([ge({type:Object}),bs("design:type",Object)],ls.prototype,"preferences",void 0),as([ge(),bs("design:type",String)],ls.prototype,"key",void 0),as([ue(),bs("design:type",Object)],ls.prototype,"isEditing",void 0),ls=as([fe("qbo-user-preferences"),bs("design:paramtypes",[])],ls);var ps=function(t,e,o,r){var n,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,r);else for(var b=t.length-1;b>=0;b--)(n=t[b])&&(a=(i<3?n(a):i>3?n(e,o,a):n(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},ms=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let gs=class extends de{constructor(){super(),this.renderInHost=!1,this.autoComplete="off",this.validatedClass="was-validated",this.workingClass=["bg-light","text-secondary"],this.form=null,this.validators=[],this.validate=async t=>{console.trace("validating form"),t.preventDefault();const e=Array.from(this.form?.querySelectorAll("*"));for(const t of e)t instanceof HTMLInputElement||t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement?(console.trace("validating element ",t),await this.validateElement(t)):console.trace("ignoring element ",t);this.form?.checkValidity()?console.trace("form is valid, js submit"):(console.trace("form is invalid"),t.preventDefault(),t.stopPropagation()),this.form?.classList.add(this.validatedClass),this.dispatchEvent(new Event("qbo-form-validated",{bubbles:!0}))},this.validateElement=async t=>{const e=t instanceof Event?t.target:t;if(console.trace("validateElement start ",e),e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement){if(e.setCustomValidity(""),!e.checkValidity())return;for(const t of this.validators)if(e.matches(t.selector)){if(console.trace("element matches selector ",t.selector," for ",e.matches(t.selector)?"true":"false"),!e.checkValidity())break;this.workingClass.forEach((t=>e.classList.add(t)));const o=await t.validate(e);this.workingClass.forEach((t=>e.classList.remove(t))),e.setCustomValidity(o?"":t.message),console.trace("input validity is ",e.checkValidity()," message is ",e.validationMessage)}else console.trace("element does not match selector ",t.selector," for ",e.matches(t.selector)?"true":"false")}console.trace("validateElement end ",e),e?.dispatchEvent(new Event("qbo-input-validated",{bubbles:!0}))},this.childContainer=$.container.createChildContainer()}async connectedCallback(){super.connectedCallback(),this.form=this.closest("form"),null!=this.form&&(this.form?.addEventListener("submit",this.validate),this.form?.addEventListener("change",this.validateElement),this.childContainer.registerInstance(HTMLFormElement,this.form),this.validators=this.childContainer.resolveAll(O),this.validators.forEach((t=>t.connect(this.form))))}async disconnectedCallback(){super.disconnectedCallback(),this.validators.forEach((t=>t.disconnect())),this.form?.removeEventListener("change",this.validateElement),this.form?.removeEventListener("submit",this.validate)}render(){return Ut``}};function us(t,e,o="*",r=!0){return e=(e=e.replace(/([.+^${}()|[\]\\])/g,"\\$1")).replace(new RegExp("\\"+o,"g"),".*"),new RegExp("^"+e+"$",r?"i":"").test(t)}function vs(t){const e=t.dataset,o={};for(const t in e)e.hasOwnProperty(t)&&void 0!==e[t]&&(o[t]=e[t]);return o}function hs(t){return t&&""!=t.trim()?new Date(t).toISOString().slice(0,10):""}function xs(t){return t&&""!=t.trim()?new Date(t).toLocaleString().replace(",",""):""}ps([ge({type:Boolean}),ms("design:type",Object)],gs.prototype,"renderInHost",void 0),ps([ge({type:String}),ms("design:type",Object)],gs.prototype,"autoComplete",void 0),ps([ge({type:String}),ms("design:type",Object)],gs.prototype,"validatedClass",void 0),ps([ge({converter:{fromAttribute:(t,e)=>t?.split(" "),toAttribute:(t,e)=>t.join(" ")}}),ms("design:type",Object)],gs.prototype,"workingClass",void 0),gs=ps([fe("qbo-validate"),ms("design:paramtypes",[])],gs);var ys=function(t,e,o,r){var n,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,r);else for(var b=t.length-1;b>=0;b--)(n=t[b])&&(a=(i<3?n(a):i>3?n(e,o,a):n(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},ws=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let qs=class extends Ee{constructor(){super(...arguments),this.loading=!1,this.target=null,this.values=[],this.targetElement=null,this.selector="*[data-badge]"}async connectedCallback(){this.targetElement=null!=this.target?this.closest(this.target):this,null!=this.targetElement?(this.targetElement.addEventListener("qbo-updated",this.getIds.bind(this)),super.connectedCallback()):console.error(`Could not find target element ${this.target}`)}disconnectedCallback(){this.targetElement?.removeEventListener("qbo-updated",this.getIds)}getPayload(t){(super.getPayload(t)??{}).idList=this.values.join(",")}getIds(){if(console.log("reacting to target qbo-updated"),null==this.targetElement)return;const t=[];this.targetElement.querySelectorAll(this.selector).forEach((e=>{const o=e.getAttribute("data-badge");null!==o&&t.push(o)})),this.values=t}async fetchData(t,e){super.fetchData(t,e)}render(){this.targetElement.querySelectorAll(this.selector).forEach((t=>{t.innerHTML=t.getAttribute("data-badge")??""}))}};ys([ge({type:Boolean}),ws("design:type",Object)],qs.prototype,"loading",void 0),ys([ge(),ws("design:type",Object)],qs.prototype,"target",void 0),ys([ge(),ws("design:type",Array)],qs.prototype,"values",void 0),ys([ge(),ws("design:type",Object)],qs.prototype,"selector",void 0),qs=ys([fe("qbo-badge")],qs);var ks=function(t,e,o,r){var n,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,r);else for(var b=t.length-1;b>=0;b--)(n=t[b])&&(a=(i<3?n(a):i>3?n(e,o,a):n(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},_s=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let zs=class extends de{constructor(){super(...arguments),this.apiEndpoint="qbo",this.colFourClass="qbo-col-4",this.colSixClass="qbo-col-6",this.colThreeClass="qbo-col-3",this.colTwelveClass="qbo-col-12",this.contactId=null,this.contactLabel="Contact",this.contactName="Contact",this.disabled=!0,this.divSectionHeaderClass="qbo-header",this.formControlSmallClass="qbo-sm",this.formLabelSmallClass="qbo-sm",this.formSelectSmallClass="qbo-sm",this.renderInHost=!0,this.jsonData={}}createRenderRoot(){return this.renderInHost?this:super.createRenderRoot()}async connectedCallback(){super.connectedCallback();const t=$.container.isRegistered(this.apiEndpoint)?$.container.resolve(this.apiEndpoint):new L(this.apiEndpoint);this.jsonData=await t.fetch(`contact/summary/${this.contactId}`)}render(){return null==this.jsonData||null==this.jsonData.Root||null==this.jsonData.Root.ContactItem&&null!=this.contactId?Ut`<p>Loading...</p>`:Ut`<slot>
228
+ `:Ut``}`}};function ss(t,e,o="qbo4.ui.preferences"){const r=localStorage.getItem(o);let n={};if(r)try{n=JSON.parse(r)}catch(t){console.error(`Error parsing ${o} from localStorage:`,t,r)}n[t]=e;try{localStorage.setItem(o,JSON.stringify(n))}catch(t){console.error(`Error saving ${o} to localStorage:`,t)}}function ds(t,e="qbo4.ui.preferences"){const o=localStorage.getItem(e);if(o)try{return JSON.parse(o)[t]}catch(t){console.error(`Error parsing ${e} from localStorage:`,t,o)}}function cs(t,e=" "){return t.filter(Boolean).join(e)}function fs(t,e=null){if(null==t||isNaN(new Date(t).getTime()))return null;const o=e??ds("dateFormat")??"MM/dd/yyyy",r={};return o.includes("yyyy")&&(r.year="numeric"),o.includes("MM")&&(r.month=o.includes("MMM")?"short":"2-digit"),o.includes("dd")&&(r.day="2-digit"),o.includes("HH")&&(r.hour="2-digit"),o.includes("mm")&&(r.minute="2-digit"),o.includes("ss")&&(r.second="2-digit"),o.includes("tt")&&(r.hour12=!0),o.includes("dddd")&&(r.weekday="long"),o.includes("ddd")&&(r.weekday="short"),new Intl.DateTimeFormat(void 0,r).format(new Date(t))}as([ge({type:Object}),bs("design:type",Object)],ls.prototype,"preferences",void 0),as([ge(),bs("design:type",String)],ls.prototype,"key",void 0),as([ue(),bs("design:type",Object)],ls.prototype,"isEditing",void 0),ls=as([fe("qbo-user-preferences"),bs("design:paramtypes",[])],ls);var ps=function(t,e,o,r){var n,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,r);else for(var b=t.length-1;b>=0;b--)(n=t[b])&&(a=(i<3?n(a):i>3?n(e,o,a):n(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},ms=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let gs=class extends de{constructor(){super(),this.renderInHost=!1,this.autoComplete="off",this.validatedClass="was-validated",this.workingClass=["bg-light","text-secondary"],this.form=null,this.validators=[],this.validate=async t=>{console.trace("validating form"),t.preventDefault();const e=Array.from(this.form?.querySelectorAll("*"));for(const t of e)t instanceof HTMLInputElement||t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement?(console.trace("validating element ",t),await this.validateElement(t)):console.trace("ignoring element ",t);this.form?.checkValidity()?console.trace("form is valid, js submit"):(console.trace("form is invalid"),t.preventDefault(),t.stopPropagation()),this.form?.classList.add(this.validatedClass),this.dispatchEvent(new Event("qbo-form-validated",{bubbles:!0}))},this.validateElement=async t=>{const e=t instanceof Event?t.target:t;if(console.trace("validateElement start ",e),e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement){if(e.setCustomValidity(""),!e.checkValidity())return;for(const t of this.validators)if(e.matches(t.selector)){if(console.trace("element matches selector ",t.selector," for ",e.matches(t.selector)?"true":"false"),!e.checkValidity())break;this.workingClass.forEach((t=>e.classList.add(t)));const o=await t.validate(e);this.workingClass.forEach((t=>e.classList.remove(t))),e.setCustomValidity(o?"":t.message),console.trace("input validity is ",e.checkValidity()," message is ",e.validationMessage)}else console.trace("element does not match selector ",t.selector," for ",e.matches(t.selector)?"true":"false")}console.trace("validateElement end ",e),e?.dispatchEvent(new Event("qbo-input-validated",{bubbles:!0}))},this.childContainer=$.container.createChildContainer()}async connectedCallback(){super.connectedCallback(),this.form=this.closest("form"),null!=this.form&&(this.form?.addEventListener("submit",this.validate),this.form?.addEventListener("change",this.validateElement),this.childContainer.registerInstance(HTMLFormElement,this.form),this.validators=this.childContainer.resolveAll(O),this.validators.forEach((t=>t.connect(this.form))))}async disconnectedCallback(){super.disconnectedCallback(),this.validators.forEach((t=>t.disconnect())),this.form?.removeEventListener("change",this.validateElement),this.form?.removeEventListener("submit",this.validate)}render(){return Ut``}};function us(t,e,o="*",r=!0){return e=(e=e.replace(/([.+^${}()|[\]\\])/g,"\\$1")).replace(new RegExp("\\"+o,"g"),".*"),new RegExp("^"+e+"$",r?"i":"").test(t)}function vs(t){const e=t.dataset,o={};for(const t in e)e.hasOwnProperty(t)&&void 0!==e[t]&&(o[t]=e[t]);return o}function hs(t){return t&&""!=t.trim()?new Date(t).toISOString().slice(0,10):""}function xs(t){return t&&""!=t.trim()?new Date(t).toLocaleString().replace(",",""):""}ps([ge({type:Boolean}),ms("design:type",Object)],gs.prototype,"renderInHost",void 0),ps([ge({type:String}),ms("design:type",Object)],gs.prototype,"autoComplete",void 0),ps([ge({type:String}),ms("design:type",Object)],gs.prototype,"validatedClass",void 0),ps([ge({converter:{fromAttribute:(t,e)=>t?.split(" "),toAttribute:(t,e)=>t.join(" ")}}),ms("design:type",Object)],gs.prototype,"workingClass",void 0),gs=ps([fe("qbo-validate"),ms("design:paramtypes",[])],gs);var ys=function(t,e,o,r){var n,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,r);else for(var b=t.length-1;b>=0;b--)(n=t[b])&&(a=(i<3?n(a):i>3?n(e,o,a):n(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},ws=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let qs=class extends Ee{constructor(){super(...arguments),this.loading=!1,this.target=null,this.values=[],this.targetElement=null,this.selector="*[data-badge]"}async connectedCallback(){this.targetElement=null!=this.target?this.closest(this.target):this,null!=this.targetElement?(this.targetElement.addEventListener("qbo-updated",this.getIds.bind(this)),super.connectedCallback()):console.error(`Could not find target element ${this.target}`)}disconnectedCallback(){this.targetElement?.removeEventListener("qbo-updated",this.getIds)}getPayload(t){(super.getPayload(t)??{}).idList=this.values.join(",")}getIds(){if(console.log("reacting to target qbo-updated"),null==this.targetElement)return;const t=[];this.targetElement.querySelectorAll(this.selector).forEach((e=>{const o=e.getAttribute("data-badge");null!==o&&t.push(o)})),this.values=t}async fetchData(t,e){super.fetchData(t,e)}render(){this.targetElement.querySelectorAll(this.selector).forEach((t=>{t.innerHTML=t.getAttribute("data-badge")??""}))}};ys([ge({type:Boolean}),ws("design:type",Object)],qs.prototype,"loading",void 0),ys([ge(),ws("design:type",Object)],qs.prototype,"target",void 0),ys([ge(),ws("design:type",Array)],qs.prototype,"values",void 0),ys([ge(),ws("design:type",Object)],qs.prototype,"selector",void 0),qs=ys([fe("qbo-badge")],qs);var ks=function(t,e,o,r){var n,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,r);else for(var b=t.length-1;b>=0;b--)(n=t[b])&&(a=(i<3?n(a):i>3?n(e,o,a):n(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},_s=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let zs=class extends de{constructor(){super(...arguments),this.apiEndpoint="qbo",this.colFourClass="qbo-col-4",this.colSixClass="qbo-col-6",this.colThreeClass="qbo-col-3",this.colTwelveClass="qbo-col-12",this.contactId=null,this.contactLabel="Contact",this.contactName="Contact",this.disabled=!0,this.divSectionHeaderClass="qbo-header",this.formControlSmallClass="qbo-sm",this.formLabelSmallClass="qbo-sm",this.formSelectSmallClass="qbo-sm",this.renderInHost=!0,this.jsonData={}}createRenderRoot(){return this.renderInHost?this:super.createRenderRoot()}async connectedCallback(){super.connectedCallback();const t=$.container.isRegistered(this.apiEndpoint)?$.container.resolve(this.apiEndpoint):new L(this.apiEndpoint),e=Object.keys(this.dataset).length>0?{...this.dataset}:null;this.jsonData=await t.fetch(`contact/summary/${this.contactId}`,e)}render(){return null==this.jsonData||null==this.jsonData.Root||null==this.jsonData.Root.ContactItem&&null!=this.contactId?Ut`<p>Loading...</p>`:Ut`<slot>
229
229
  <div class="${this.colSixClass}">
230
230
  <label for="${this.contactName}" class="${this.formLabelSmallClass}">${this.contactLabel}</label>
231
231
  <qbo-contact-name class="${this.formControlSmallClass}" name="${this.contactName}" .data="${this.jsonData.Root.ContactItem}"></qbo-contact-name>