@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(mo.keys()).map((e=>Xt`<div class="col-3">
225
225
  </div>
226
226
  </footer>
227
227
  </dialog>
228
- `:Xt``}`}};function cs(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 fs(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 ps(t,e=" "){return t.filter(Boolean).join(e)}function ms(t,e=null){if(null==t||isNaN(new Date(t).getTime()))return null;const o=e??fs("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))}ls([ve({type:Object}),ss("design:type",Object)],ds.prototype,"preferences",void 0),ls([ve(),ss("design:type",String)],ds.prototype,"key",void 0),ls([he(),ss("design:type",Object)],ds.prototype,"isEditing",void 0),ds=ls([me("qbo-user-preferences"),ss("design:paramtypes",[])],ds);var gs=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},us=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let vs=class extends fe{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=O.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(R),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 Xt``}};function hs(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 xs(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 ys(t){return t&&""!=t.trim()?new Date(t).toISOString().slice(0,10):""}function ws(t){return t&&""!=t.trim()?new Date(t).toLocaleString().replace(",",""):""}gs([ve({type:Boolean}),us("design:type",Object)],vs.prototype,"renderInHost",void 0),gs([ve({type:String}),us("design:type",Object)],vs.prototype,"autoComplete",void 0),gs([ve({type:String}),us("design:type",Object)],vs.prototype,"validatedClass",void 0),gs([ve({converter:{fromAttribute:(t,e)=>t?.split(" "),toAttribute:(t,e)=>t.join(" ")}}),us("design:type",Object)],vs.prototype,"workingClass",void 0),vs=gs([me("qbo-validate"),us("design:paramtypes",[])],vs);var qs=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},ks=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let _s=class extends Te{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")??""}))}};qs([ve({type:Boolean}),ks("design:type",Object)],_s.prototype,"loading",void 0),qs([ve(),ks("design:type",Object)],_s.prototype,"target",void 0),qs([ve(),ks("design:type",Array)],_s.prototype,"values",void 0),qs([ve(),ks("design:type",Object)],_s.prototype,"selector",void 0),_s=qs([me("qbo-badge")],_s);var zs=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},js=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ss=class extends fe{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=O.container.isRegistered(this.apiEndpoint)?O.container.resolve(this.apiEndpoint):new M(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?Xt`<p>Loading...</p>`:Xt`<slot>
228
+ `:Xt``}`}};function cs(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 fs(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 ps(t,e=" "){return t.filter(Boolean).join(e)}function ms(t,e=null){if(null==t||isNaN(new Date(t).getTime()))return null;const o=e??fs("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))}ls([ve({type:Object}),ss("design:type",Object)],ds.prototype,"preferences",void 0),ls([ve(),ss("design:type",String)],ds.prototype,"key",void 0),ls([he(),ss("design:type",Object)],ds.prototype,"isEditing",void 0),ds=ls([me("qbo-user-preferences"),ss("design:paramtypes",[])],ds);var gs=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},us=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let vs=class extends fe{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=O.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(R),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 Xt``}};function hs(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 xs(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 ys(t){return t&&""!=t.trim()?new Date(t).toISOString().slice(0,10):""}function ws(t){return t&&""!=t.trim()?new Date(t).toLocaleString().replace(",",""):""}gs([ve({type:Boolean}),us("design:type",Object)],vs.prototype,"renderInHost",void 0),gs([ve({type:String}),us("design:type",Object)],vs.prototype,"autoComplete",void 0),gs([ve({type:String}),us("design:type",Object)],vs.prototype,"validatedClass",void 0),gs([ve({converter:{fromAttribute:(t,e)=>t?.split(" "),toAttribute:(t,e)=>t.join(" ")}}),us("design:type",Object)],vs.prototype,"workingClass",void 0),vs=gs([me("qbo-validate"),us("design:paramtypes",[])],vs);var qs=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},ks=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let _s=class extends Te{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")??""}))}};qs([ve({type:Boolean}),ks("design:type",Object)],_s.prototype,"loading",void 0),qs([ve(),ks("design:type",Object)],_s.prototype,"target",void 0),qs([ve(),ks("design:type",Array)],_s.prototype,"values",void 0),qs([ve(),ks("design:type",Object)],_s.prototype,"selector",void 0),_s=qs([me("qbo-badge")],_s);var zs=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},js=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ss=class extends fe{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=O.container.isRegistered(this.apiEndpoint)?O.container.resolve(this.apiEndpoint):new M(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?Xt`<p>Loading...</p>`:Xt`<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>