adp-web-components 0.1.79 → 0.1.80
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.
- package/dist/cjs/dead-stock-lookup_3.cjs.entry.js +4 -4
- package/dist/cjs/flexible-container.cjs.entry.js +1 -1
- package/dist/cjs/form-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/form-date-picker.cjs.entry.js +4 -4
- package/dist/cjs/form-dialog_13.cjs.entry.js +9 -6
- package/dist/cjs/general-form.cjs.entry.js +4 -4
- package/dist/cjs/general-inquiry-form.cjs.entry.js +4 -4
- package/dist/cjs/{get-language-from-url-Cr3n1fd0.js → get-language-from-url-D5rCyA1u.js} +6 -1
- package/dist/cjs/{get-local-language-Ch0JsFp-.js → get-local-language-D02WksZl.js} +1 -1
- package/dist/cjs/information-table.cjs.entry.js +1 -1
- package/dist/cjs/loading-spinner.cjs.entry.js +1 -1
- package/dist/cjs/manufacturer-part-lookup.cjs.entry.js +3 -3
- package/dist/cjs/part-lookup.cjs.entry.js +2 -2
- package/dist/cjs/{phone-validator-BUa89UAk.js → phone-validator-D6nzYTs8.js} +2 -2
- package/dist/cjs/service-booking-form.cjs.entry.js +4 -4
- package/dist/cjs/shift-tab-content.cjs.entry.js +1 -1
- package/dist/cjs/shift-tabs_2.cjs.entry.js +2 -2
- package/dist/cjs/ssc-lookup-form.cjs.entry.js +4 -4
- package/dist/cjs/{state-object-DY2MVbpe.js → state-object-B2D8PkT8.js} +1 -1
- package/dist/cjs/test-drive-form.cjs.entry.js +4 -4
- package/dist/cjs/vehicle-accessories_7.cjs.entry.js +8 -8
- package/dist/cjs/vehicle-lookup.cjs.entry.js +2 -2
- package/dist/cjs/vehicle-quotation-form.cjs.entry.js +3 -3
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/components/flexible-container.css +1 -1
- package/dist/collection/components/components/information-table.css +1 -1
- package/dist/collection/components/components/loading-spinner.css +1 -1
- package/dist/collection/components/components/shift-tab-content.css +1 -1
- package/dist/collection/components/components/shift-tabs.css +1 -1
- package/dist/collection/components/form-elements/form-checkbox.js +1 -1
- package/dist/collection/components/form-elements/form-date-picker-legacy.js +4 -4
- package/dist/collection/components/form-elements/form-dialog.js +3 -3
- package/dist/collection/components/form-elements/form-file.js +5 -2
- package/dist/collection/components/part-lookup/dead-stock-lookup.css +1 -1
- package/dist/collection/components/part-lookup/distributor-lookup.css +1 -1
- package/dist/collection/components/part-lookup/manufacturer-lookup.css +1 -1
- package/dist/collection/components/part-lookup/manufacturer-part-lookup.css +1 -1
- package/dist/collection/components/part-lookup/part-lookup.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-accessories.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-claimable-items.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-item-claim-form.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-lookup.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-paint-thickness.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-sale-information.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-service-history.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-specification.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-warranty-details.css +1 -1
- package/dist/collection/features/form-hook/form-hook.js +6 -1
- package/dist/components/dead-stock-lookup.js +1 -1
- package/dist/components/distributor-lookup.js +1 -1
- package/dist/components/flexible-container.js +1 -1
- package/dist/components/form-checkbox.js +1 -1
- package/dist/components/form-date-picker.js +1 -1
- package/dist/components/form-dialog.js +1 -1
- package/dist/components/form-file.js +1 -1
- package/dist/components/form-structure-error.js +1 -1
- package/dist/components/form-structure.js +1 -1
- package/dist/components/general-form.js +1 -1
- package/dist/components/general-inquiry-form.js +1 -1
- package/dist/components/information-table.js +1 -1
- package/dist/components/loading-spinner.js +1 -1
- package/dist/components/manufacturer-lookup.js +1 -1
- package/dist/components/manufacturer-part-lookup.js +1 -1
- package/dist/components/{p-uy_bFOsR.js → p-8IdtkeX1.js} +1 -1
- package/dist/components/{p-LsPt2IQQ.js → p-B68P3DtP.js} +1 -1
- package/dist/components/p-B807sG0U.js +5 -0
- package/dist/components/{p-CEnsN9BF.js → p-B9Kquvk4.js} +1 -1
- package/dist/components/{p-B-XBWavF.js → p-BFaCcwNv.js} +1 -1
- package/dist/components/{p-DIx4B8Yb.js → p-BiRjebkj.js} +1 -1
- package/dist/components/p-CPGswmtd.js +5 -0
- package/dist/components/{p-DD8S-FqN.js → p-CXoG03EM.js} +1 -1
- package/dist/components/{p-DndpWsL0.js → p-CXzb5oyt.js} +1 -1
- package/dist/components/{p-Ch14UUZ8.js → p-CZ_bF39p.js} +1 -1
- package/dist/components/{p-D7IQ_tmq.js → p-CeUdMJED.js} +1 -1
- package/dist/components/{p-BLhi8bD5.js → p-CjZxWPIE.js} +1 -1
- package/dist/components/{p-BWfCJC3Q.js → p-CqTxdwgo.js} +1 -1
- package/dist/components/{p-7Ml46qau.js → p-CvoSPdhp.js} +1 -1
- package/dist/components/{p-yQwcy8rT.js → p-D7ZYsC-o.js} +1 -1
- package/dist/components/{p-ClKZfnwN.js → p-DKzEP2g4.js} +1 -1
- package/dist/components/{p-pckxVoM8.js → p-DOS_lP0E.js} +1 -1
- package/dist/components/{p-B20yJV8N.js → p-D_bnut2e.js} +1 -1
- package/dist/components/{p-aMPZ6-pL.js → p-DhQjm81u.js} +1 -1
- package/dist/components/{p-DATl4ttx.js → p-Dj3_tuTX.js} +1 -1
- package/dist/components/p-DtCTkfsR.js +5 -0
- package/dist/components/{p-8XSbLgc1.js → p-QsYqPaPW.js} +1 -1
- package/dist/components/{p-B74EVzB0.js → p-VufjPJkT.js} +1 -1
- package/dist/components/{p-B1HbKT92.js → p-dM4PJkDk.js} +1 -1
- package/dist/components/{p-CQSAEcTB.js → p-gEeo-RSf.js} +1 -1
- package/dist/components/{p-B-MZjoBg.js → p-zyFVlTck.js} +1 -1
- package/dist/components/part-lookup.js +1 -1
- package/dist/components/service-booking-form.js +1 -1
- package/dist/components/shift-accordion.js +1 -1
- package/dist/components/shift-slider.js +1 -1
- package/dist/components/shift-tab-content.js +1 -1
- package/dist/components/shift-tabs.js +1 -1
- package/dist/components/ssc-lookup-form.js +1 -1
- package/dist/components/test-drive-form.js +1 -1
- package/dist/components/vehicle-accessories.js +1 -1
- package/dist/components/vehicle-claimable-items.js +1 -1
- package/dist/components/vehicle-item-claim-form.js +1 -1
- package/dist/components/vehicle-lookup.js +1 -1
- package/dist/components/vehicle-paint-thickness.js +1 -1
- package/dist/components/vehicle-quotation-form.js +1 -1
- package/dist/components/vehicle-sale-information.js +1 -1
- package/dist/components/vehicle-service-history.js +1 -1
- package/dist/components/vehicle-specification.js +1 -1
- package/dist/components/vehicle-warranty-details.js +1 -1
- package/dist/esm/dead-stock-lookup_3.entry.js +4 -4
- package/dist/esm/flexible-container.entry.js +1 -1
- package/dist/esm/form-checkbox.entry.js +1 -1
- package/dist/esm/form-date-picker.entry.js +4 -4
- package/dist/esm/form-dialog_13.entry.js +9 -6
- package/dist/esm/general-form.entry.js +4 -4
- package/dist/esm/general-inquiry-form.entry.js +4 -4
- package/dist/esm/{get-language-from-url-OJporG8v.js → get-language-from-url-fGWv4JfI.js} +6 -1
- package/dist/esm/{get-local-language-Ce9BLJNB.js → get-local-language-DtdpsfQH.js} +1 -1
- package/dist/esm/information-table.entry.js +1 -1
- package/dist/esm/loading-spinner.entry.js +1 -1
- package/dist/esm/manufacturer-part-lookup.entry.js +3 -3
- package/dist/esm/part-lookup.entry.js +2 -2
- package/dist/esm/{phone-validator-DuWpgjxr.js → phone-validator-CW0vHN1w.js} +2 -2
- package/dist/esm/service-booking-form.entry.js +4 -4
- package/dist/esm/shift-tab-content.entry.js +1 -1
- package/dist/esm/shift-tabs_2.entry.js +2 -2
- package/dist/esm/ssc-lookup-form.entry.js +4 -4
- package/dist/esm/{state-object-BYbNPk-P.js → state-object-D__N3A52.js} +1 -1
- package/dist/esm/test-drive-form.entry.js +4 -4
- package/dist/esm/vehicle-accessories_7.entry.js +8 -8
- package/dist/esm/vehicle-lookup.entry.js +2 -2
- package/dist/esm/vehicle-quotation-form.entry.js +3 -3
- package/dist/shift-components/{p-45232ee9.entry.js → p-00514dfd.entry.js} +1 -1
- package/dist/shift-components/{p-39128baf.entry.js → p-136ce48d.entry.js} +1 -1
- package/dist/shift-components/p-16eb4c57.entry.js +5 -0
- package/dist/shift-components/{p-74392ec2.entry.js → p-2cb2cf2c.entry.js} +1 -1
- package/dist/shift-components/{p-b58252b3.entry.js → p-31193ab5.entry.js} +1 -1
- package/dist/shift-components/{p-a4abc248.entry.js → p-3eb1890a.entry.js} +1 -1
- package/dist/shift-components/{p-971f2432.entry.js → p-49803ea5.entry.js} +1 -1
- package/dist/shift-components/{p-95496452.entry.js → p-6f563241.entry.js} +1 -1
- package/dist/shift-components/{p-ea04ef58.entry.js → p-9b910889.entry.js} +1 -1
- package/dist/shift-components/{p-19b5c5da.entry.js → p-9d25df8c.entry.js} +1 -1
- package/dist/shift-components/{p-Dfy8LG6W.js → p-DCHyQw_L.js} +1 -1
- package/dist/shift-components/{p-CCt3VwsZ.js → p-DFsecEMm.js} +1 -1
- package/dist/shift-components/p-DOaMIJLj.js +5 -0
- package/dist/shift-components/{p-DgArUiaY.js → p-D_IVXzoK.js} +1 -1
- package/dist/shift-components/{p-30d616e8.entry.js → p-a6ad0fdf.entry.js} +1 -1
- package/dist/shift-components/{p-0174f4a6.entry.js → p-b1f9f6e3.entry.js} +1 -1
- package/dist/shift-components/{p-7ce7efb2.entry.js → p-baa868f8.entry.js} +1 -1
- package/dist/shift-components/{p-8c4579f1.entry.js → p-d26ff83d.entry.js} +1 -1
- package/dist/shift-components/p-d915cd1c.entry.js +5 -0
- package/dist/shift-components/{p-fd8cce34.entry.js → p-dcde6026.entry.js} +1 -1
- package/dist/shift-components/{p-d9491f0a.entry.js → p-e2d72fb9.entry.js} +1 -1
- package/dist/shift-components/{p-b73dc0eb.entry.js → p-fa57b412.entry.js} +1 -1
- package/dist/shift-components/{p-600141c0.entry.js → p-fd8ec358.entry.js} +1 -1
- package/dist/shift-components/shift-components.esm.js +1 -1
- package/dist/types/components/form-elements/form-file.d.ts +1 -0
- package/package.json +1 -1
- package/dist/components/p-CjrMk4Te.js +0 -5
- package/dist/components/p-DQqF8boi.js +0 -5
- package/dist/components/p-DldJIun-.js +0 -5
- package/dist/shift-components/p-6b9c8723.entry.js +0 -5
- package/dist/shift-components/p-9270fdea.entry.js +0 -5
- package/dist/shift-components/p-yjI-v4gh.js +0 -5
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Built by ShiftSoftware
|
|
3
|
-
* Copyright (c)
|
|
4
|
-
*/
|
|
5
|
-
import{f as i}from"./p-Bf4Ol6Qt.js";class t{constructor(t,s,h){this.haltValidation=!1,this.isSubmitted=!1,this.stepFormValues={},this.watchers={},this.cachedValues={},this.subscribers=[],this.validationType="onSubmit",this.subscribedFields={},this.formErrors={},this.backButtonContexts=[],this.pendingRequests={},this.openDialog=()=>{},this.subscribe=(i,t)=>{var s,h,o,r;if(this.subscribers.push({name:i,context:t}),null==t?void 0:t.partialValidation){const e=(null===(h=null===(s=this.schemaObject)||void 0===s?void 0:s.fields)||void 0===h?void 0:h[i])||(null===(r=null===(o=this.basicSchemaObject)||void 0===o?void 0:o.fields)||void 0===r?void 0:r[i]);if(e){const s=t.partialValidation(e);s&&(this.schemaObject=this.schemaObject.shape({[i]:s}))}}(null==t?void 0:t.validate)&&(this.schemaObject=this.schemaObject.shape({[i]:null==t?void 0:t.validate()}))},this.unsubscribe=i=>{var t,s;this.schemaObject=this.schemaObject.shape({[i]:(null===(t=this.basicSchemaObject)||void 0===t?void 0:t.fields[i])?null===(s=this.basicSchemaObject)||void 0===s?void 0:s.fields[i]:void 0}),this.subscribers=this.subscribers.filter((({name:t})=>t!==i))},this.getStepLabels=(i="en",t)=>{var s,h,o,r;t||(t=null===(s=this.formStructure)||void 0===s?void 0:s.currentStep);let e={back:"",title:"",stepCell:"",stepTitle:"",submitButton:""};try{e=null===(r=null===(o=null===(h=this.context.structure)||void 0===h?void 0:h.steps)||void 0===o?void 0:o[t-1])||void 0===r?void 0:r[i]}catch(i){}return e},this.addWatcher=(i,t)=>{this.watchers[i]||((null==i?void 0:i.trim())?this.watchers[i]=t||(({form:i})=>{i.rerender({rerenderForm:!0})}):this.watchers.all=({form:i})=>{i.rerender({rerenderForm:!0})})},this.removeWatcher=i=>{delete this.watchers[i]},this.onInput=i=>{const t=i.target;let s=t.value;"checkbox"===t.type&&(s=t.checked);const h=Object.assign(Object.assign({},this.getValues()),{[t.name]:s});this.onValuesUpdate&&this.onValuesUpdate(h),this.validateForm(t.name,s)},this.resetFormErrorMessage=()=>this.context.errorMessage="",this.getFormErrors=()=>this.formErrors,this.getFormLocale=()=>[this.context.locale,this.context.language],this.setCachedValues=i=>{this.cachedValues=i},this.getValue=i=>this.getValues()[i],this.getValues=()=>{const i=(this.context.el.shadowRoot||this.context.el).querySelector("form");if(!i)return{};const t=new FormData(i),s=Object.fromEntries(t.entries());return i.querySelectorAll("[name]").forEach((i=>{i.disabled?s[i.name]=i.value:"file"===i.type&&(s[i.name]=Array.from((null==i?void 0:i.files)||[]))})),Object.assign(Object.assign({},this.cachedValues),s)},this.focusFirstInput=i=>{if(i.length){const t=this.context.el.shadowRoot||this.context.el,s=i.map((i=>t.querySelector(`*[name="${i.name}"]`))).filter((i=>i)).sort(((i,t)=>i.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:i.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING?1:0));s[0]&&(s[0].hidden?s[0].parentElement.scrollIntoView({behavior:"smooth",block:"center"}):s[0].focus())}},this.hasItemInStructure=(i,t=this.context.structure)=>{var s;if(!t)return!0;if("string"==typeof t)return t===i;const{tag:h,name:o,children:r,isHidden:e,step:n}=t;return(!n||n==(null===(s=this.formStructure)||void 0===s?void 0:s.currentStep))&&(!(h!==i&&o!==i||e)||!!Array.isArray(r)&&r.some((t=>this.hasItemInStructure(i,t))))},this.updateStep=(t,s=!1)=>{var h,o,r,e,n,l;let d=this.formStructure.currentStep;s?d=t:d+=t,d<1&&(d=1),d>(null===(r=null===(o=null===(h=this.context)||void 0===h?void 0:h.structure)||void 0===o?void 0:o.steps)||void 0===r?void 0:r.length)&&(t=null===(l=null===(n=null===(e=this.context)||void 0===e?void 0:e.structure)||void 0===n?void 0:n.steps)||void 0===l?void 0:l.length),this.formStructure.currentStep=d,this.backButtonContexts.forEach((t=>i(t))),this.rerender({rerenderAll:!0})},this.submitForm=async()=>{var i,t,s,h,o,r,e,n,l,d,u,v,a,c;try{this.isSubmitted=!0,this.context.isLoading=!0,this.signal({isError:!1,disabled:!0});const m=Object.assign(Object.assign({},this.cachedValues),this.getValues()),f=this.schemaObject.describe();Object.entries(f.fields).filter((([i,t])=>"boolean"===t.type)).forEach((([i])=>{m[i]="string"==typeof m[i]&&"true"===m[i]}));const b=Object.keys(this.schemaObject.fields).filter((i=>!this.hasItemInStructure(i))),j=await this.schemaObject.omit(b).validate(m,{abortEarly:!1,context:this.requiredContext});(null===(t=null===(i=this.context)||void 0===i?void 0:i.structure)||void 0===t?void 0:t.steps)?(this.stepFormValues=Object.assign(Object.assign({},null==this?void 0:this.stepFormValues),j),console.log(null===(o=null===(h=null===(s=this.context)||void 0===s?void 0:s.structure)||void 0===h?void 0:h.steps)||void 0===o?void 0:o.length),console.log(null===(r=this.formStructure)||void 0===r?void 0:r.currentStep),console.log((null===(l=null===(n=null===(e=this.context)||void 0===e?void 0:e.structure)||void 0===n?void 0:n.steps)||void 0===l?void 0:l.length)===(null===(d=this.formStructure)||void 0===d?void 0:d.currentStep)),(null===(a=null===(v=null===(u=this.context)||void 0===u?void 0:u.structure)||void 0===v?void 0:v.steps)||void 0===a?void 0:a.length)===(null===(c=this.formStructure)||void 0===c?void 0:c.currentStep)?await this.context.formSubmit(this.stepFormValues):this.updateStep(1)):await this.context.formSubmit(j)}catch(i){if("ValidationError"===i.name){this.formErrors={};const t=[];i.inner.forEach((i=>{i.path&&(this.formErrors[i.path]=i.message,t.find((t=>t.name===i.path))||t.push({isError:!0,name:i.path,errorMessage:i.message}))})),console.log(this.formErrors),this.signal(t),this.focusFirstInput(t),this.rerender({rerenderAll:!0,rerenderForm:!0})}else console.error("Unexpected Error:",i)}finally{this.signal({disabled:!1}),this.context.isLoading=!1}},this.onSubmit=i=>{i.preventDefault(),this.submitForm()},this.submit=()=>{this.submitForm()},this.getRequiredContext=()=>{var i,t;const s={};try{return(null===(i=this.context.structure)||void 0===i?void 0:i.requiredContext)?(Object.entries(null===(t=this.context.structure)||void 0===t?void 0:t.requiredContext).forEach((([i,t])=>{s[`${i}Required`]=t})),s):s}catch(i){return s}},this.getInputState=i=>{const t=this.schemaObject.resolve({context:this.requiredContext}),s=t.describe().fields[i];let h=!1;try{t.validateSyncAt(i,{[i]:void 0},{context:this.requiredContext})}catch(i){h=!0}return this.subscribedFields[i]||(this.subscribedFields[i]={name:i,isRequired:h,isError:!1,disabled:!1,errorMessage:"",continuousValidation:!1,meta:null==s?void 0:s.meta}),this.subscribedFields[i]},this.signal=i=>{Array.isArray(i)?i.forEach((i=>{this.subscribedFields[i.name]&&Object.assign(this.subscribedFields[i.name],i)})):Object.values(this.subscribedFields).forEach((t=>Object.assign(t,i)))},this.validateInput=i=>{const t=this.getValues()[i]||"";return this.validateForm(i,t,!1)},this.rerender=({inputName:t,rerenderAll:s,rerenderForm:h})=>{var o;if(h&&(i(this.context),(null==this?void 0:this.formStructure)&&i(null==this?void 0:this.formStructure)),s)this.subscribers.forEach((t=>i(t.context)));else if(t){const s=null===(o=this.subscribers.find((i=>i.name===t)))||void 0===o?void 0:o.context;i(s)}},this.validateForm=(i,t,s=!0)=>{var h;if(setTimeout((()=>{const s=Object.assign(Object.assign({},this.getValues()),{[i]:t}),h=this.watchers[i];h&&h({form:this,values:s}),this.watchers.all&&this.watchers.all({form:this,values:s})}),50),s){if(this.haltValidation)return;if(!this.isSubmitted&&"always"!==this.validationType&&!(null===(h=this.subscribedFields[i])||void 0===h?void 0:h.continuousValidation))return}const o=this.subscribedFields[i].isError;try{return this.schemaObject.fields[i].validateSync(t,{context:this.requiredContext}),this.signal([{name:i,isError:!1}]),!1!==o&&this.rerender({inputName:i||"",rerenderForm:!0}),{isError:!1,errorMessage:""}}catch(t){if(t.message)return this.signal([{name:i,isError:!0,errorMessage:t.message}]),this.rerender({inputName:i||"",rerenderForm:!0}),{isError:!0,errorMessage:t.message}}finally{try{this.subscribedFields[i].continuousValidation=!0}catch(i){}}},this.context=t,this.schemaObject=s,this.basicSchemaObject=s,this.formController={onSubmit:this.onSubmit,onInput:this.onInput},(null==h?void 0:h.validationType)&&(this.validationType=h.validationType),this.requiredContext=this.getRequiredContext()}reset(){this.haltValidation=!0,this.updateStep(1,!0),this.stepFormValues={},this.subscribers.forEach((i=>{var t;null===(t=i.context)||void 0===t||t.reset()})),this.pendingRequests={},this.isSubmitted=!1,this.signal({isError:!1,disabled:!1}),setTimeout((()=>{this.haltValidation=!1,setTimeout((()=>{this.rerender({rerenderForm:!0,rerenderAll:!0})}),50)}),50)}}const s={en:"en",english:"en",ar:"ar",arabic:"ar",ku:"ku",ckb:"ku",kurdish:"ku",sorani:"ku",ru:"ru",russian:"ru"};function h(){if("undefined"==typeof window)return"en";const{pathname:i,search:t}=window.location,h=new URLSearchParams(t),o=h.get("lang")||h.get("lng")||h.get("language");if(o){const i=o.toLowerCase();if(s[i])return s[i]}const r=i.toLowerCase();for(const i in s)if(r.includes(`/${i}`))return s[i];return"en"}export{t as F,h as g}
|