adp-web-components 0.0.11
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/LICENSE +21 -0
- package/dist/cjs/Loading-ee1a2ceb.js +16 -0
- package/dist/cjs/app-globals-3813fb46.js +9 -0
- package/dist/cjs/cn-f559f9e5.js +2588 -0
- package/dist/cjs/dead-stock-lookup.cjs.entry.js +103 -0
- package/dist/cjs/distributor-lookup.cjs.entry.js +109 -0
- package/dist/cjs/dynamic-claim.cjs.entry.js +306 -0
- package/dist/cjs/dynamic-redeem.cjs.entry.js +145 -0
- package/dist/cjs/form-input.cjs.entry.js +36 -0
- package/dist/cjs/general-inquiry-form.cjs.entry.js +2280 -0
- package/dist/cjs/image-expansion-a9c9c6f7.js +77 -0
- package/dist/cjs/index-d4b5214c.js +1331 -0
- package/dist/cjs/index.cjs.js +6 -0
- package/dist/cjs/loader-baf2418b.js +9 -0
- package/dist/cjs/loader.cjs.js +19 -0
- package/dist/cjs/manufacturer-lookup.cjs.entry.js +109 -0
- package/dist/cjs/paint-thickness.cjs.entry.js +131 -0
- package/dist/cjs/partInformation-2a6a018b.js +34 -0
- package/dist/cjs/service-history.cjs.entry.js +116 -0
- package/dist/cjs/shift-components.cjs.js +29 -0
- package/dist/cjs/vehicle-accessories.cjs.entry.js +135 -0
- package/dist/cjs/vehicle-specification.cjs.entry.js +111 -0
- package/dist/cjs/vehicleInformation-4c1dcaf2.js +52 -0
- package/dist/cjs/warranty-details.cjs.entry.js +281 -0
- package/dist/collection/collection-manifest.json +23 -0
- package/dist/collection/components/dynamic-claim/dynamic-claim.css +1 -0
- package/dist/collection/components/dynamic-claim/dynamic-claim.js +521 -0
- package/dist/collection/components/dynamic-claim/icons/cancelled.svg +8 -0
- package/dist/collection/components/dynamic-claim/icons/expired.svg +9 -0
- package/dist/collection/components/dynamic-claim/icons/pending.svg +9 -0
- package/dist/collection/components/dynamic-claim/icons/processed.svg +9 -0
- package/dist/collection/components/dynamic-redeem/dynamic-redeem.css +1 -0
- package/dist/collection/components/dynamic-redeem/dynamic-redeem.js +334 -0
- package/dist/collection/components/form-input/form-input.css +1 -0
- package/dist/collection/components/form-input/form-input.js +209 -0
- package/dist/collection/components/general-inquiry-form/general-inquiry-form.css +1 -0
- package/dist/collection/components/general-inquiry-form/general-inquiry-form.js +46 -0
- package/dist/collection/components/paint-thickness/paint-thickness.css +1 -0
- package/dist/collection/components/paint-thickness/paint-thickness.js +323 -0
- package/dist/collection/components/part-lookup/dead-stock-lookup.css +1 -0
- package/dist/collection/components/part-lookup/dead-stock-lookup.js +294 -0
- package/dist/collection/components/part-lookup/distributor-lookup.css +1 -0
- package/dist/collection/components/part-lookup/distributor-lookup.js +299 -0
- package/dist/collection/components/part-lookup/manufacturer-lookup.css +1 -0
- package/dist/collection/components/part-lookup/manufacturer-lookup.js +317 -0
- package/dist/collection/components/parts/Loading.js +10 -0
- package/dist/collection/components/service-history/service-history.css +1 -0
- package/dist/collection/components/service-history/service-history.js +306 -0
- package/dist/collection/components/vehicle-accessories/vehicle-accessories.css +1 -0
- package/dist/collection/components/vehicle-accessories/vehicle-accessories.js +327 -0
- package/dist/collection/components/vehicle-specification/vehicle-specification.css +1 -0
- package/dist/collection/components/vehicle-specification/vehicle-specification.js +301 -0
- package/dist/collection/components/warranty-details/assets/check.svg +4 -0
- package/dist/collection/components/warranty-details/assets/loader.svg +11 -0
- package/dist/collection/components/warranty-details/assets/x-mark.svg +4 -0
- package/dist/collection/components/warranty-details/components/CardsContainer.js +9 -0
- package/dist/collection/components/warranty-details/components/Loading.js +10 -0
- package/dist/collection/components/warranty-details/components/SSCTable.js +13 -0
- package/dist/collection/components/warranty-details/components/StatusCard.js +11 -0
- package/dist/collection/components/warranty-details/warranty-details.css +1 -0
- package/dist/collection/components/warranty-details/warranty-details.js +709 -0
- package/dist/collection/global/api/partInformation.js +30 -0
- package/dist/collection/global/api/vehicleInformation.js +48 -0
- package/dist/collection/global/assets/eye.svg +5 -0
- package/dist/collection/global/assets/loader.svg +11 -0
- package/dist/collection/global/lib/cn.js +9 -0
- package/dist/collection/global/lib/form-hook.js +118 -0
- package/dist/collection/global/lib/image-expansion.js +69 -0
- package/dist/collection/global/lib/utils.js +7 -0
- package/dist/collection/global/types/components.js +1 -0
- package/dist/collection/global/types/part-information.js +1 -0
- package/dist/collection/global/types/vehicle-information.js +5 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/templates/mock-data.js +4132 -0
- package/dist/collection/templates/parts/mock-data.js +221 -0
- package/dist/collection/templates/vehicle-lookup.js +218 -0
- package/dist/collection/templates/warranty-mock-data.js +2982 -0
- package/dist/components/dead-stock-lookup.d.ts +11 -0
- package/dist/components/dead-stock-lookup.js +5 -0
- package/dist/components/distributor-lookup.d.ts +11 -0
- package/dist/components/distributor-lookup.js +5 -0
- package/dist/components/dynamic-claim.d.ts +11 -0
- package/dist/components/dynamic-claim.js +5 -0
- package/dist/components/dynamic-redeem.d.ts +11 -0
- package/dist/components/dynamic-redeem.js +5 -0
- package/dist/components/form-input.d.ts +11 -0
- package/dist/components/form-input.js +5 -0
- package/dist/components/general-inquiry-form.d.ts +11 -0
- package/dist/components/general-inquiry-form.js +5 -0
- package/dist/components/index.d.ts +33 -0
- package/dist/components/index.js +5 -0
- package/dist/components/manufacturer-lookup.d.ts +11 -0
- package/dist/components/manufacturer-lookup.js +5 -0
- package/dist/components/p-2b0cc0c6.js +5 -0
- package/dist/components/p-4dc47f5f.js +5 -0
- package/dist/components/p-50f73226.js +5 -0
- package/dist/components/p-5df9bc5f.js +5 -0
- package/dist/components/p-8375923d.js +5 -0
- package/dist/components/p-98d9e7ab.js +5 -0
- package/dist/components/p-a454210b.js +5 -0
- package/dist/components/p-d265c109.js +5 -0
- package/dist/components/p-d5ff7544.js +5 -0
- package/dist/components/paint-thickness.d.ts +11 -0
- package/dist/components/paint-thickness.js +5 -0
- package/dist/components/service-history.d.ts +11 -0
- package/dist/components/service-history.js +5 -0
- package/dist/components/vehicle-accessories.d.ts +11 -0
- package/dist/components/vehicle-accessories.js +5 -0
- package/dist/components/vehicle-specification.d.ts +11 -0
- package/dist/components/vehicle-specification.js +5 -0
- package/dist/components/warranty-details.d.ts +11 -0
- package/dist/components/warranty-details.js +5 -0
- package/dist/esm/Loading-61648252.js +14 -0
- package/dist/esm/app-globals-8befa224.js +7 -0
- package/dist/esm/cn-cc419b94.js +2586 -0
- package/dist/esm/dead-stock-lookup.entry.js +99 -0
- package/dist/esm/distributor-lookup.entry.js +105 -0
- package/dist/esm/dynamic-claim.entry.js +302 -0
- package/dist/esm/dynamic-redeem.entry.js +141 -0
- package/dist/esm/form-input.entry.js +32 -0
- package/dist/esm/general-inquiry-form.entry.js +2276 -0
- package/dist/esm/image-expansion-08c4bf0d.js +73 -0
- package/dist/esm/index-ef54644b.js +1302 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/loader-027b88af.js +7 -0
- package/dist/esm/loader.js +15 -0
- package/dist/esm/manufacturer-lookup.entry.js +105 -0
- package/dist/esm/paint-thickness.entry.js +127 -0
- package/dist/esm/partInformation-73ece994.js +32 -0
- package/dist/esm/service-history.entry.js +112 -0
- package/dist/esm/shift-components.js +24 -0
- package/dist/esm/vehicle-accessories.entry.js +131 -0
- package/dist/esm/vehicle-specification.entry.js +107 -0
- package/dist/esm/vehicleInformation-f1081f83.js +50 -0
- package/dist/esm/warranty-details.entry.js +277 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/shift-components/index.esm.js +4 -0
- package/dist/shift-components/p-15f86441.entry.js +5 -0
- package/dist/shift-components/p-1ae3a61f.entry.js +5 -0
- package/dist/shift-components/p-517b3e04.js +5 -0
- package/dist/shift-components/p-5df9bc5f.js +5 -0
- package/dist/shift-components/p-65e6ab8e.js +5 -0
- package/dist/shift-components/p-894e7518.entry.js +5 -0
- package/dist/shift-components/p-8c261972.entry.js +5 -0
- package/dist/shift-components/p-8e818568.entry.js +5 -0
- package/dist/shift-components/p-98d9e7ab.js +5 -0
- package/dist/shift-components/p-9bd4471c.entry.js +5 -0
- package/dist/shift-components/p-9f790b14.entry.js +5 -0
- package/dist/shift-components/p-a21e2e2e.js +5 -0
- package/dist/shift-components/p-c113792c.entry.js +5 -0
- package/dist/shift-components/p-d265c109.js +5 -0
- package/dist/shift-components/p-d5ff7544.js +5 -0
- package/dist/shift-components/p-dc9845ed.entry.js +5 -0
- package/dist/shift-components/p-e32b0798.entry.js +5 -0
- package/dist/shift-components/p-e97316d2.js +6 -0
- package/dist/shift-components/p-f759c597.entry.js +5 -0
- package/dist/shift-components/p-feb3df85.entry.js +5 -0
- package/dist/shift-components/shift-components.esm.js +5 -0
- package/dist/types/components/dynamic-claim/dynamic-claim.d.ts +48 -0
- package/dist/types/components/dynamic-redeem/dynamic-redeem.d.ts +34 -0
- package/dist/types/components/form-input/form-input.d.ts +14 -0
- package/dist/types/components/general-inquiry-form/general-inquiry-form.d.ts +21 -0
- package/dist/types/components/paint-thickness/paint-thickness.d.ts +28 -0
- package/dist/types/components/part-lookup/dead-stock-lookup.d.ts +25 -0
- package/dist/types/components/part-lookup/distributor-lookup.d.ts +23 -0
- package/dist/types/components/part-lookup/manufacturer-lookup.d.ts +24 -0
- package/dist/types/components/parts/Loading.d.ts +5 -0
- package/dist/types/components/service-history/service-history.d.ts +23 -0
- package/dist/types/components/vehicle-accessories/vehicle-accessories.d.ts +28 -0
- package/dist/types/components/vehicle-specification/vehicle-specification.d.ts +22 -0
- package/dist/types/components/warranty-details/components/CardsContainer.d.ts +8 -0
- package/dist/types/components/warranty-details/components/Loading.d.ts +5 -0
- package/dist/types/components/warranty-details/components/SSCTable.d.ts +6 -0
- package/dist/types/components/warranty-details/components/StatusCard.d.ts +10 -0
- package/dist/types/components/warranty-details/warranty-details.d.ts +51 -0
- package/dist/types/components.d.ts +388 -0
- package/dist/types/global/api/partInformation.d.ts +19 -0
- package/dist/types/global/api/vehicleInformation.d.ts +33 -0
- package/dist/types/global/lib/cn.d.ts +2 -0
- package/dist/types/global/lib/form-hook.d.ts +54 -0
- package/dist/types/global/lib/image-expansion.d.ts +9 -0
- package/dist/types/global/lib/utils.d.ts +1 -0
- package/dist/types/global/types/components.d.ts +4 -0
- package/dist/types/global/types/part-information.d.ts +30 -0
- package/dist/types/global/types/vehicle-information.d.ts +162 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/stencil-public-runtime.d.ts +1680 -0
- package/loader/cdn.js +5 -0
- package/loader/index.cjs.js +5 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +5 -0
- package/loader/index.js +6 -0
- package/loader/package.json +11 -0
- package/package.json +61 -0
- package/readme.md +104 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by ShiftSoftware
|
|
3
|
+
* Copyright (c)
|
|
4
|
+
*/
|
|
5
|
+
export const getPartInformation = async (component, generalProps) => {
|
|
6
|
+
const { notAvailableMessage, mockData, partNumber, scopedTimeoutRef, middlewareCallback } = generalProps;
|
|
7
|
+
const { isDev, baseUrl, queryString, abortController, networkTimeoutRef, loadedResponse } = component;
|
|
8
|
+
const handleResult = (newPartInformation) => {
|
|
9
|
+
if (networkTimeoutRef === scopedTimeoutRef) {
|
|
10
|
+
if (!newPartInformation && partNumber)
|
|
11
|
+
throw new Error(notAvailableMessage || 'Wrong response format');
|
|
12
|
+
if (loadedResponse)
|
|
13
|
+
loadedResponse(newPartInformation);
|
|
14
|
+
if (middlewareCallback)
|
|
15
|
+
middlewareCallback(newPartInformation);
|
|
16
|
+
return newPartInformation;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
if (isDev) {
|
|
20
|
+
const newData = mockData[partNumber];
|
|
21
|
+
return handleResult(newData);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
if (!baseUrl)
|
|
25
|
+
throw new Error('Please provide base-url');
|
|
26
|
+
const response = await fetch(`${baseUrl}${partNumber}?${queryString}`, { signal: abortController.signal });
|
|
27
|
+
const newData = (await response.json());
|
|
28
|
+
return handleResult(newData);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by ShiftSoftware
|
|
3
|
+
* Copyright (c)
|
|
4
|
+
*/
|
|
5
|
+
const vehicleRequestHeaders = {
|
|
6
|
+
cityId: 'City-Id',
|
|
7
|
+
userId: 'User-Id',
|
|
8
|
+
companyId: 'Company-Id',
|
|
9
|
+
customerName: 'Customer-Name',
|
|
10
|
+
customerPhone: 'Customer-Phone',
|
|
11
|
+
customerEmail: 'Customer-Email',
|
|
12
|
+
companyBranchId: 'Company-Branch-Id',
|
|
13
|
+
cityIntegrationId: 'City-Integration-Id',
|
|
14
|
+
brandIntegrationId: 'Brand-Integration-Id',
|
|
15
|
+
companyIntegrationId: 'Company-Integration-Id',
|
|
16
|
+
companyBranchIntegrationId: 'Company-Branch-Integration-Id',
|
|
17
|
+
};
|
|
18
|
+
export const getVehicleInformation = async (component, generalProps) => {
|
|
19
|
+
const { notAvailableMessage, mockData, vin, scopedTimeoutRef, middlewareCallback } = generalProps;
|
|
20
|
+
const { isDev, baseUrl, queryString, abortController, networkTimeoutRef, loadedResponse } = component;
|
|
21
|
+
const handleResult = (newVehicleInformation) => {
|
|
22
|
+
if (networkTimeoutRef === scopedTimeoutRef) {
|
|
23
|
+
if (!newVehicleInformation && vin)
|
|
24
|
+
throw new Error(notAvailableMessage || 'Wrong response format');
|
|
25
|
+
if (loadedResponse)
|
|
26
|
+
loadedResponse(newVehicleInformation);
|
|
27
|
+
if (middlewareCallback)
|
|
28
|
+
middlewareCallback(newVehicleInformation);
|
|
29
|
+
return newVehicleInformation;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
if (isDev) {
|
|
33
|
+
const newData = mockData[vin];
|
|
34
|
+
return handleResult(newData);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
if (!baseUrl)
|
|
38
|
+
throw new Error('Please provide base-url');
|
|
39
|
+
const headers = {};
|
|
40
|
+
Object.entries(vehicleRequestHeaders).forEach(([componentHeaderKey, headerField]) => {
|
|
41
|
+
if (component[componentHeaderKey])
|
|
42
|
+
headers[headerField] = component[componentHeaderKey];
|
|
43
|
+
});
|
|
44
|
+
const response = await fetch(`${baseUrl}${vin}?${queryString}`, { signal: abortController.signal, headers: headers });
|
|
45
|
+
const newData = (await response.json());
|
|
46
|
+
return handleResult(newData);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white"
|
|
2
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-eye">
|
|
3
|
+
<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" />
|
|
4
|
+
<circle cx="12" cy="12" r="3" />
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
2
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-loader">
|
|
3
|
+
<path d="M12 2v4" />
|
|
4
|
+
<path d="m16.2 7.8 2.9-2.9" />
|
|
5
|
+
<path d="M18 12h4" />
|
|
6
|
+
<path d="m16.2 16.2 2.9 2.9" />
|
|
7
|
+
<path d="M12 18v4" />
|
|
8
|
+
<path d="m4.9 19.1 2.9-2.9" />
|
|
9
|
+
<path d="M2 12h4" />
|
|
10
|
+
<path d="m4.9 4.9 2.9 2.9" />
|
|
11
|
+
</svg>
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by ShiftSoftware
|
|
3
|
+
* Copyright (c)
|
|
4
|
+
*/
|
|
5
|
+
export class FormHook {
|
|
6
|
+
constructor(context, schemaObject, formStateOptions) {
|
|
7
|
+
this.isSubmitted = false;
|
|
8
|
+
this.validationType = 'onSubmit';
|
|
9
|
+
this.subscribedFields = {};
|
|
10
|
+
this.formErrors = {};
|
|
11
|
+
this.getFormErrors = () => this.formErrors;
|
|
12
|
+
this.getValues = () => {
|
|
13
|
+
const form = this.context.el.shadowRoot.querySelector('form');
|
|
14
|
+
const formData = new FormData(form);
|
|
15
|
+
const formObject = Object.fromEntries(formData.entries());
|
|
16
|
+
return formObject;
|
|
17
|
+
};
|
|
18
|
+
this.focusFirstInput = (errorFields) => {
|
|
19
|
+
if (errorFields.length) {
|
|
20
|
+
const domElements = errorFields.map(field => this.context.el.shadowRoot.querySelector(`input[name="${field.name}"]`)).filter(dom => dom);
|
|
21
|
+
const sortedDomElements = domElements.sort((a, b) => {
|
|
22
|
+
if (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING)
|
|
23
|
+
return -1; // a comes before b
|
|
24
|
+
if (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_PRECEDING)
|
|
25
|
+
return 1; // b comes before a
|
|
26
|
+
return 0; // They are the same
|
|
27
|
+
});
|
|
28
|
+
if (sortedDomElements[0])
|
|
29
|
+
sortedDomElements[0].focus();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
this.onSubmit = (formEvent) => {
|
|
33
|
+
formEvent.preventDefault();
|
|
34
|
+
(async () => {
|
|
35
|
+
try {
|
|
36
|
+
this.isSubmitted = true;
|
|
37
|
+
this.context.isLoading = true;
|
|
38
|
+
this.signal({ isError: false });
|
|
39
|
+
const formObject = this.getValues();
|
|
40
|
+
const values = await this.schemaObject.validate(formObject, { abortEarly: false, strict: true });
|
|
41
|
+
await this.context.formSubmit(values);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
if (error.name === 'ValidationError') {
|
|
45
|
+
this.formErrors = {};
|
|
46
|
+
const errorFields = [];
|
|
47
|
+
error.inner.forEach((element) => {
|
|
48
|
+
if (element.path) {
|
|
49
|
+
this.formErrors[element.path] = element.message;
|
|
50
|
+
if (!errorFields.find(field => field.name === element.path))
|
|
51
|
+
errorFields.push({
|
|
52
|
+
isError: true,
|
|
53
|
+
name: element.path,
|
|
54
|
+
errorMessage: element.message,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
this.signal(errorFields);
|
|
59
|
+
this.focusFirstInput(errorFields);
|
|
60
|
+
}
|
|
61
|
+
else
|
|
62
|
+
console.error('Unexpected Error:', error);
|
|
63
|
+
}
|
|
64
|
+
finally {
|
|
65
|
+
this.context.isLoading = false;
|
|
66
|
+
}
|
|
67
|
+
})();
|
|
68
|
+
};
|
|
69
|
+
this.newController = (name, fieldType) => {
|
|
70
|
+
if (fieldType === 'text')
|
|
71
|
+
this.subscribedFields[name] = {
|
|
72
|
+
name,
|
|
73
|
+
isError: false,
|
|
74
|
+
disabled: false,
|
|
75
|
+
errorMessage: '',
|
|
76
|
+
onInput: (event) => {
|
|
77
|
+
const value = event.target.value;
|
|
78
|
+
this.onChanges(name, value);
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
return this.subscribedFields[name];
|
|
82
|
+
};
|
|
83
|
+
this.signal = (partialSignal) => {
|
|
84
|
+
if (Array.isArray(partialSignal)) {
|
|
85
|
+
partialSignal.forEach(field => {
|
|
86
|
+
if (this.subscribedFields[field.name])
|
|
87
|
+
Object.assign(this.subscribedFields[field.name], field);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
Object.values(this.subscribedFields).forEach(field => Object.assign(field, partialSignal));
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
this.onChanges = async (name, value) => {
|
|
95
|
+
if (!this.isSubmitted && this.validationType !== 'always')
|
|
96
|
+
return;
|
|
97
|
+
const wasError = this.subscribedFields[name].isError;
|
|
98
|
+
try {
|
|
99
|
+
// @ts-ignore
|
|
100
|
+
this.schemaObject.fields[name].validateSync(value);
|
|
101
|
+
this.signal([{ name, isError: false }]);
|
|
102
|
+
if (wasError !== false)
|
|
103
|
+
this.context.renderControl = {};
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
if (error.message) {
|
|
107
|
+
this.signal([{ name, isError: true, errorMessage: error.message }]);
|
|
108
|
+
this.context.renderControl = {};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
this.context = context;
|
|
113
|
+
this.schemaObject = schemaObject;
|
|
114
|
+
this.formController = { onSubmit: this.onSubmit };
|
|
115
|
+
if (formStateOptions === null || formStateOptions === void 0 ? void 0 : formStateOptions.validationType)
|
|
116
|
+
this.validationType = formStateOptions.validationType;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by ShiftSoftware
|
|
3
|
+
* Copyright (c)
|
|
4
|
+
*/
|
|
5
|
+
export function openImageViewer(context, target, imageSrc) {
|
|
6
|
+
if (context.expandedImage === imageSrc)
|
|
7
|
+
return;
|
|
8
|
+
context.originalImage = target;
|
|
9
|
+
const expandedImageRef = context.el.shadowRoot.getElementById('expanded-image');
|
|
10
|
+
expandedImageRef.src = target.src;
|
|
11
|
+
document.addEventListener('keydown', context.closeImageListener);
|
|
12
|
+
const rect = target.getBoundingClientRect();
|
|
13
|
+
document.body.style.overflow = 'hidden';
|
|
14
|
+
Object.assign(expandedImageRef.style, {
|
|
15
|
+
top: `${rect.top}px`,
|
|
16
|
+
pointerEvents: 'auto',
|
|
17
|
+
left: `${rect.left}px`,
|
|
18
|
+
transitionDuration: '0s',
|
|
19
|
+
width: `${rect.width}px`,
|
|
20
|
+
height: `${rect.height}px`,
|
|
21
|
+
});
|
|
22
|
+
setTimeout(() => {
|
|
23
|
+
const naturalWidth = target.naturalWidth;
|
|
24
|
+
const naturalHeight = target.naturalHeight;
|
|
25
|
+
const maxWidth = window.innerWidth - 160;
|
|
26
|
+
const maxHeight = window.innerHeight - 32;
|
|
27
|
+
const aspectRatio = naturalWidth / naturalHeight;
|
|
28
|
+
let width, height;
|
|
29
|
+
if (maxWidth / aspectRatio <= maxHeight) {
|
|
30
|
+
width = maxWidth;
|
|
31
|
+
height = maxWidth / aspectRatio;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
height = maxHeight;
|
|
35
|
+
width = maxHeight * aspectRatio;
|
|
36
|
+
}
|
|
37
|
+
expandedImageRef.style.transitionDuration = '0.3s';
|
|
38
|
+
Object.assign(expandedImageRef.style, {
|
|
39
|
+
opacity: '1',
|
|
40
|
+
width: `${width}px`,
|
|
41
|
+
height: `${height}px`,
|
|
42
|
+
top: `${(window.innerHeight - height) / 2}px`,
|
|
43
|
+
left: `${(window.innerWidth - width) / 2}px`,
|
|
44
|
+
});
|
|
45
|
+
context.expandedImage = imageSrc;
|
|
46
|
+
}, 200);
|
|
47
|
+
}
|
|
48
|
+
export function closeImageViewer(context, event) {
|
|
49
|
+
if (event && event.key !== 'Escape')
|
|
50
|
+
return;
|
|
51
|
+
document.removeEventListener('keydown', context.closeImageListener);
|
|
52
|
+
const expandedImageRef = context.el.shadowRoot.getElementById('expanded-image');
|
|
53
|
+
const rect = context.originalImage.getBoundingClientRect();
|
|
54
|
+
Object.assign(expandedImageRef.style, {
|
|
55
|
+
top: `${rect.top}px`,
|
|
56
|
+
pointerEvents: 'none',
|
|
57
|
+
left: `${rect.left}px`,
|
|
58
|
+
width: `${rect.width}px`,
|
|
59
|
+
height: `${rect.height}px`,
|
|
60
|
+
transitionDuration: '0.3s',
|
|
61
|
+
});
|
|
62
|
+
setTimeout(() => {
|
|
63
|
+
expandedImageRef.src = '';
|
|
64
|
+
expandedImageRef.style.opacity = '0';
|
|
65
|
+
expandedImageRef.style.transitionDuration = '0s';
|
|
66
|
+
}, 300);
|
|
67
|
+
document.body.style.overflow = '';
|
|
68
|
+
context.expandedImage = null;
|
|
69
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|