adp-web-components 0.1.57 → 0.1.59
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 +7 -7
- package/dist/cjs/decode-time-offset-DqzP0mck.js +37 -0
- 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 +221 -0
- package/dist/cjs/form-dialog_8.cjs.entry.js +809 -0
- package/dist/cjs/{form-input-prefix-BEKoXMuK.js → form-input-label-meHUwu3m.js} +0 -9
- package/dist/cjs/form-input-prefix-RFgXEC1Q.js +18 -0
- package/dist/cjs/form-input_4.cjs.entry.js +31 -14
- package/dist/cjs/form-switch.cjs.entry.js +2 -2
- package/dist/cjs/form-time-picker.cjs.entry.js +165 -0
- package/dist/cjs/general-inquiry-form.cjs.entry.js +11 -9
- package/dist/cjs/{get-local-language-CLEoE4A4.js → get-local-language-CMptyFxH.js} +1 -1
- package/dist/cjs/index-D5c513Xn.js +22147 -0
- package/dist/cjs/information-table.cjs.entry.js +1 -1
- package/dist/cjs/{loader-icon-8WtBJ-H1.js → loader-icon-qrSyqpQO.js} +49 -26
- package/dist/cjs/loader.cjs.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 +3 -3
- package/dist/cjs/service-booking-form.cjs.entry.js +21 -194
- package/dist/cjs/shift-components.cjs.js +1 -1
- package/dist/cjs/shift-tab-content.cjs.entry.js +1 -1
- package/dist/cjs/shift-tabs_2.cjs.entry.js +10 -10
- package/dist/cjs/ssc-lookup-form.cjs.entry.js +11 -9
- package/dist/cjs/state-object-B_0-oj8G.js +243 -0
- package/dist/cjs/test-drive-form.cjs.entry.js +11 -9
- package/dist/cjs/{type-DlWZZ9uC.js → type-B8LchmnL.js} +1 -1
- package/dist/cjs/{type-VgtSVhXd.js → type-BqNpIYcE.js} +1 -1
- package/dist/cjs/{type-CG7yWUpY.js → type-BrzZ5GMr.js} +1 -1
- package/dist/cjs/vehicle-accessories_7.cjs.entry.js +24 -24
- package/dist/cjs/vehicle-lookup.cjs.entry.js +3 -3
- package/dist/cjs/vehicle-quotation-form.cjs.entry.js +14 -11
- package/dist/collection/collection-manifest.json +3 -0
- 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/VehicleImageViewer.js +50 -0
- package/dist/collection/components/form-elements/form-date-picker-legacy.js +498 -0
- package/dist/collection/components/form-elements/form-dialog.js +3 -3
- package/dist/collection/components/form-elements/form-input.js +95 -5
- package/dist/collection/components/form-elements/form-inputs.css +1 -1
- package/dist/collection/components/form-elements/form-phone-number.js +2 -2
- package/dist/collection/components/form-elements/form-picker-input.js +478 -0
- package/dist/collection/components/form-elements/form-shadow-input.js +24 -1
- package/dist/collection/components/form-elements/form-structure-error.js +1 -1
- package/dist/collection/components/form-elements/form-submit.js +2 -2
- package/dist/collection/components/form-elements/form-switch.js +1 -1
- package/dist/collection/components/form-elements/form-text-area.js +2 -2
- package/dist/collection/components/form-elements/form-time-picker-legacy.js +397 -0
- package/dist/collection/components/form-elements/form-vin-input.js +5 -4
- package/dist/collection/components/forms/defaults/mappers.js +72 -0
- package/dist/collection/components/forms/defaults/style.css +1 -1
- package/dist/collection/components/forms/defaults/validation.js +29 -1
- package/dist/collection/components/forms/general-inquiry.js +6 -6
- package/dist/collection/components/forms/service-booking.js +21 -21
- package/dist/collection/components/forms/ssc-lookup.js +6 -6
- package/dist/collection/components/forms/test-drive.js +6 -6
- package/dist/collection/components/forms/vehicle-quotation/VehicleImageViewer.js +1 -1
- package/dist/collection/components/forms/vehicle-quotation.js +11 -9
- package/dist/collection/components/part-lookup/dead-stock-lookup.js +2 -2
- package/dist/collection/components/part-lookup/distributor-lookup.js +2 -2
- package/dist/collection/components/part-lookup/manufacturer-part-lookup.js +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-accessories.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-accessories.js +2 -2
- package/dist/collection/components/vehicle-lookup/vehicle-claimable-items.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-claimable-items.js +4 -4
- package/dist/collection/components/vehicle-lookup/vehicle-item-claim-form.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-item-claim-form.js +8 -8
- 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-paint-thickness.js +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-sale-information.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-sale-information.js +2 -2
- package/dist/collection/components/vehicle-lookup/vehicle-service-history.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-service-history.js +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-specification.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-specification.js +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-warranty-details.css +1 -1
- package/dist/collection/components/vehicle-lookup/vehicle-warranty-details.js +4 -4
- package/dist/collection/components/vin-extractor/vin-extractor.css +1 -1
- package/dist/collection/components/vin-extractor/vin-extractor.js +1 -1
- package/dist/collection/features/form-hook/functions.js +37 -13
- package/dist/collection/global/assets/calendar-days-icon.js +6 -0
- package/dist/collection/global/assets/clock-8-icon.js +6 -0
- package/dist/collection/global/lib/decode-time-offset.js +32 -0
- 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.d.ts +11 -0
- package/dist/components/form-date-picker.js +5 -0
- package/dist/components/form-dialog.js +1 -1
- package/dist/components/form-input.js +1 -1
- package/dist/components/form-phone-number.js +1 -1
- package/dist/components/form-picker-input.d.ts +11 -0
- package/dist/components/form-picker-input.js +5 -0
- package/dist/components/form-select.js +1 -1
- package/dist/components/form-shadow-input.js +1 -1
- package/dist/components/form-structure-error.js +1 -1
- package/dist/components/form-structure.js +1 -1
- package/dist/components/form-submit.js +1 -1
- package/dist/components/form-switch.js +1 -1
- package/dist/components/form-text-area.js +1 -1
- package/dist/components/form-time-picker.d.ts +11 -0
- package/dist/components/form-time-picker.js +5 -0
- package/dist/components/form-vin-input.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-Bi75CV6R.js → p-3WjYFbnU.js} +1 -1
- package/dist/components/p-64G0Y_tC.js +5 -0
- package/dist/components/p-7y7dFWS-.js +5 -0
- package/dist/components/p-BEClgvwe.js +5 -0
- package/dist/components/p-BILW0yP6.js +5 -0
- package/dist/components/p-BTqv9A1K.js +5 -0
- package/dist/components/p-B_QEyJOO.js +5 -0
- package/dist/components/{p-F0WWPE_O.js → p-Bd2-gh8M.js} +1 -1
- package/dist/components/p-BffBGA_K.js +5 -0
- package/dist/components/p-Bon4whdT.js +5 -0
- package/dist/components/{p-CCGW3XAg.js → p-BsFKuBtC.js} +1 -1
- package/dist/components/p-C-4CT4ZF.js +5 -0
- package/dist/components/p-C6WhIy7O.js +5 -0
- package/dist/components/{p-CixlAlH4.js → p-CBXAxKky.js} +1 -1
- package/dist/components/p-CEM5EBP0.js +5 -0
- package/dist/components/p-CHdx52dw.js +5 -0
- package/dist/components/p-CwQEFAEF.js +5 -0
- package/dist/components/p-Cxfsh87m.js +5 -0
- package/dist/components/p-D-tlRZMk.js +5 -0
- package/dist/components/p-D930Q75B.js +5 -0
- package/dist/components/p-DA0taq65.js +5 -0
- package/dist/components/p-DJKERvsE.js +5 -0
- package/dist/components/p-DNn44A0I.js +5 -0
- package/dist/components/{p-DEDxfC7_.js → p-Df56BNKV.js} +1 -1
- package/dist/components/p-DjDUhW2q.js +5 -0
- package/dist/components/{p-Cv4B-c-D.js → p-DkA_i--O.js} +1 -1
- package/dist/components/{p-C9NbnDFD.js → p-DqNmAqS_.js} +1 -1
- package/dist/components/p-DuNp8sSh.js +5 -0
- package/dist/components/p-NEl9bwNq.js +5 -0
- package/dist/components/p-RInF2GNQ.js +5 -0
- package/dist/components/{p-BtR-iDdk.js → p-_C-vBKCe.js} +1 -1
- package/dist/components/p-eTLWmtnI.js +5 -0
- package/dist/components/{p-C3JyRnEg.js → p-vEsQVFLN.js} +1 -1
- package/dist/components/{p-CFfmHNjt.js → p-zofQKKfh.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/components/vin-extractor.js +1 -1
- package/dist/esm/dead-stock-lookup_3.entry.js +7 -7
- package/dist/esm/decode-time-offset-Cfi43WoV.js +35 -0
- 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 +219 -0
- package/dist/esm/form-dialog_8.entry.js +800 -0
- package/dist/esm/{form-input-prefix-uiMTBAZe.js → form-input-label-BhD_T_C5.js} +1 -9
- package/dist/esm/form-input-prefix-C48SfAOK.js +16 -0
- package/dist/esm/form-input_4.entry.js +30 -13
- package/dist/esm/form-switch.entry.js +2 -2
- package/dist/esm/form-time-picker.entry.js +163 -0
- package/dist/esm/general-inquiry-form.entry.js +11 -9
- package/dist/esm/{get-local-language-B3oLMQ7x.js → get-local-language-CCj6E27L.js} +1 -1
- package/dist/esm/index-BILW0yP6.js +22145 -0
- package/dist/esm/information-table.entry.js +1 -1
- package/dist/esm/{loader-icon-BT-MqKj_.js → loader-icon-DhBPTC5g.js} +39 -15
- package/dist/esm/loader.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 +3 -3
- package/dist/esm/service-booking-form.entry.js +21 -194
- package/dist/esm/shift-components.js +1 -1
- package/dist/esm/shift-tab-content.entry.js +1 -1
- package/dist/esm/shift-tabs_2.entry.js +10 -10
- package/dist/esm/ssc-lookup-form.entry.js +11 -9
- package/dist/esm/state-object-Cwph5K2Q.js +238 -0
- package/dist/esm/test-drive-form.entry.js +11 -9
- package/dist/esm/{type-B96smKVB.js → type-BluG_k1P.js} +1 -1
- package/dist/esm/{type-CJFFdz9f.js → type-D_rpjbuj.js} +1 -1
- package/dist/esm/{type-BymH_Reb.js → type-zroDKO0U.js} +1 -1
- package/dist/esm/vehicle-accessories_7.entry.js +24 -24
- package/dist/esm/vehicle-lookup.entry.js +3 -3
- package/dist/esm/vehicle-quotation-form.entry.js +14 -11
- package/dist/locales/vehicleLookup/saleInformation/ar.json +1 -1
- package/dist/locales/vehicleLookup/saleInformation/en.json +1 -1
- package/dist/locales/vehicleLookup/saleInformation/ku.json +1 -1
- package/dist/locales/vehicleLookup/saleInformation/ru.json +1 -1
- package/dist/shift-components/p-0a728fec.entry.js +5 -0
- package/dist/shift-components/p-0e630c66.entry.js +5 -0
- package/dist/shift-components/p-0f83786b.entry.js +5 -0
- package/dist/shift-components/p-1c93d5e6.entry.js +5 -0
- package/dist/shift-components/p-26f3e6da.entry.js +5 -0
- package/dist/shift-components/p-3a7196d4.entry.js +5 -0
- package/dist/shift-components/{p-ce1bf4af.entry.js → p-45670df9.entry.js} +1 -1
- package/dist/shift-components/{p-d9234e52.entry.js → p-4aa6f707.entry.js} +1 -1
- package/dist/shift-components/p-50fd9d29.entry.js +5 -0
- package/dist/shift-components/p-63e1e80e.entry.js +5 -0
- package/dist/shift-components/{p-c250576d.entry.js → p-67476178.entry.js} +1 -1
- package/dist/shift-components/p-683f3ab3.entry.js +5 -0
- package/dist/shift-components/p-8700e868.entry.js +5 -0
- package/dist/shift-components/p-90a6803f.entry.js +5 -0
- package/dist/shift-components/{p-DPJOLEPo.js → p-B-8v_CQL.js} +1 -1
- package/dist/shift-components/p-BILW0yP6.js +5 -0
- package/dist/shift-components/{p-C2E0OQuQ.js → p-BK4ZcuiW.js} +1 -1
- package/dist/shift-components/p-BVMG8UaH.js +5 -0
- package/dist/shift-components/{p-BQaoN4EI.js → p-Bfkguwb-.js} +1 -1
- package/dist/shift-components/p-BnQp2Q8E.js +5 -0
- package/dist/shift-components/{p-DitnhRjp.js → p-C3YLTa2J.js} +1 -1
- package/dist/shift-components/p-DXZTo2xz.js +5 -0
- package/dist/shift-components/p-Dgh-j_S7.js +5 -0
- package/dist/shift-components/p-XyQhTm0V.js +5 -0
- package/dist/shift-components/p-b4231e50.entry.js +5 -0
- package/dist/shift-components/p-c7eaf245.entry.js +5 -0
- package/dist/shift-components/{p-6f59eb5f.entry.js → p-d7da1152.entry.js} +1 -1
- package/dist/shift-components/p-f7692371.entry.js +5 -0
- package/dist/shift-components/p-f8ac59ee.entry.js +5 -0
- package/dist/shift-components/p-fac0fdb9.entry.js +5 -0
- package/dist/shift-components/p-fe02d5ed.entry.js +5 -0
- package/dist/shift-components/shift-components.esm.js +1 -1
- package/dist/types/components/form-elements/VehicleImageViewer.d.ts +7 -0
- package/dist/types/components/form-elements/form-date-picker-legacy.d.ts +44 -0
- package/dist/types/components/form-elements/form-input.d.ts +5 -0
- package/dist/types/components/form-elements/form-picker-input.d.ts +36 -0
- package/dist/types/components/form-elements/form-shadow-input.d.ts +1 -0
- package/dist/types/components/form-elements/form-time-picker-legacy.d.ts +38 -0
- package/dist/types/components/form-elements/form-vin-input.d.ts +1 -1
- package/dist/types/components/forms/defaults/mappers.d.ts +20 -0
- package/dist/types/components/forms/defaults/validation.d.ts +5 -1
- package/dist/types/components/forms/service-booking.d.ts +5 -7
- package/dist/types/components.d.ts +187 -6
- package/dist/types/features/form-hook/functions.d.ts +6 -6
- package/dist/types/global/assets/calendar-days-icon.d.ts +8 -0
- package/dist/types/global/assets/clock-8-icon.d.ts +8 -0
- package/dist/types/global/lib/decode-time-offset.d.ts +6 -0
- package/dist/types/locales/vehicleLookup/serviceHistory/type.d.ts +2 -2
- package/dist/types/locales/vehicleLookup/wrapper-type.d.ts +2 -2
- package/package.json +2 -1
- package/dist/cjs/form-dialog_2.cjs.entry.js +0 -80
- package/dist/cjs/form-phone-number_5.cjs.entry.js +0 -638
- package/dist/cjs/state-object-BKYoOET2.js +0 -84
- package/dist/components/p-0RPSruUw.js +0 -5
- package/dist/components/p-AXXIpFHS.js +0 -5
- package/dist/components/p-B6oAdbSG.js +0 -5
- package/dist/components/p-B8ficu-2.js +0 -5
- package/dist/components/p-BccOXbO6.js +0 -5
- package/dist/components/p-BiWhrVwg.js +0 -5
- package/dist/components/p-CCnpN4O6.js +0 -5
- package/dist/components/p-CMIWLyy-.js +0 -5
- package/dist/components/p-CTvhIyUe.js +0 -5
- package/dist/components/p-CVPVwYky.js +0 -5
- package/dist/components/p-CY-XNpVl.js +0 -5
- package/dist/components/p-Cfv1Ad7h.js +0 -5
- package/dist/components/p-CmZX4oFn.js +0 -5
- package/dist/components/p-DDwq6NYq.js +0 -5
- package/dist/components/p-DGmPDcfO.js +0 -5
- package/dist/components/p-DnDLOq--.js +0 -5
- package/dist/components/p-Dot72Ksm.js +0 -5
- package/dist/components/p-DwlUO-mQ.js +0 -5
- package/dist/components/p-Dy_xcj4e.js +0 -5
- package/dist/components/p-HU3XmNIl.js +0 -5
- package/dist/components/p-qgWJBcxw.js +0 -5
- package/dist/components/p-uhXr4495.js +0 -5
- package/dist/esm/form-dialog_2.entry.js +0 -77
- package/dist/esm/form-phone-number_5.entry.js +0 -632
- package/dist/esm/state-object-DKRL_FzI.js +0 -79
- package/dist/shift-components/p-0e2d3d93.entry.js +0 -5
- package/dist/shift-components/p-10da80aa.entry.js +0 -5
- package/dist/shift-components/p-1ff500c4.entry.js +0 -5
- package/dist/shift-components/p-361e8b06.entry.js +0 -5
- package/dist/shift-components/p-38bb86f3.entry.js +0 -5
- package/dist/shift-components/p-39914eb3.entry.js +0 -5
- package/dist/shift-components/p-76f94eb5.entry.js +0 -5
- package/dist/shift-components/p-830b1bea.entry.js +0 -5
- package/dist/shift-components/p-835b1234.entry.js +0 -5
- package/dist/shift-components/p-92551553.entry.js +0 -5
- package/dist/shift-components/p-9c01c8ff.entry.js +0 -5
- package/dist/shift-components/p-CaFQm1Ia.js +0 -5
- package/dist/shift-components/p-Cf1rwCRV.js +0 -5
- package/dist/shift-components/p-DpDKQYgQ.js +0 -5
- package/dist/shift-components/p-a2419627.entry.js +0 -5
- package/dist/shift-components/p-a9a116b5.entry.js +0 -5
- package/dist/shift-components/p-bb5c2961.entry.js +0 -5
- package/dist/shift-components/p-bcb6b13e.entry.js +0 -5
- package/dist/shift-components/p-e06782ee.entry.js +0 -5
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by ShiftSoftware
|
|
3
|
+
* Copyright (c)
|
|
4
|
+
*/
|
|
5
|
+
import { Host, h } from "@stencil/core";
|
|
6
|
+
import cn from "../../global/lib/cn";
|
|
7
|
+
import { getNestedValue } from "../../global/lib/get-nested-value";
|
|
8
|
+
import { FormInputLabel } from "./components/form-input-label";
|
|
9
|
+
import { FormErrorMessage } from "./components/form-error-message";
|
|
10
|
+
export class FormDatePicker {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.language = 'en';
|
|
13
|
+
this.firstDayOfWeek = 0; // 0=Sun, 1=Mon, 6=Sat
|
|
14
|
+
this.isOpen = false;
|
|
15
|
+
this.selectedValue = '';
|
|
16
|
+
this.openUpwards = false;
|
|
17
|
+
this.handleOutsideClick = (event) => {
|
|
18
|
+
if (!this.el.contains(event.target))
|
|
19
|
+
this.isOpen = false;
|
|
20
|
+
};
|
|
21
|
+
this.handleKeyDown = (event) => {
|
|
22
|
+
if (event.key === 'Escape' && this.isOpen)
|
|
23
|
+
this.isOpen = false;
|
|
24
|
+
};
|
|
25
|
+
this.toggleDropdown = () => {
|
|
26
|
+
if (this.isOpen) {
|
|
27
|
+
this.isOpen = false;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
this.adjustDropdownPosition();
|
|
31
|
+
};
|
|
32
|
+
this.selectDate = (year, month, day) => {
|
|
33
|
+
this.selectedValue = this.toDateString(year, month, day);
|
|
34
|
+
this.isOpen = false;
|
|
35
|
+
};
|
|
36
|
+
this.prevMonth = () => {
|
|
37
|
+
if (!this.canGoPrev())
|
|
38
|
+
return;
|
|
39
|
+
if (this.viewMonth === 0) {
|
|
40
|
+
this.viewMonth = 11;
|
|
41
|
+
this.viewYear--;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
this.viewMonth--;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
this.nextMonth = () => {
|
|
48
|
+
if (!this.canGoNext())
|
|
49
|
+
return;
|
|
50
|
+
if (this.viewMonth === 11) {
|
|
51
|
+
this.viewMonth = 0;
|
|
52
|
+
this.viewYear++;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
this.viewMonth++;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
async componentWillLoad() {
|
|
60
|
+
this.form.subscribe(this.name, this);
|
|
61
|
+
if (this.staticValue)
|
|
62
|
+
this.defaultValue = this.staticValue;
|
|
63
|
+
if (this.defaultValue)
|
|
64
|
+
this.selectedValue = this.defaultValue;
|
|
65
|
+
const initDate = this.selectedValue ? new Date(this.selectedValue + 'T00:00:00') : new Date();
|
|
66
|
+
this.viewYear = initDate.getFullYear();
|
|
67
|
+
this.viewMonth = initDate.getMonth();
|
|
68
|
+
}
|
|
69
|
+
async onStaticValueChange(newStaticValue) {
|
|
70
|
+
if (newStaticValue) {
|
|
71
|
+
this.selectedValue = newStaticValue;
|
|
72
|
+
const date = new Date(newStaticValue + 'T00:00:00');
|
|
73
|
+
this.viewYear = date.getFullYear();
|
|
74
|
+
this.viewMonth = date.getMonth();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async componentDidLoad() {
|
|
78
|
+
document.addEventListener('click', this.handleOutsideClick);
|
|
79
|
+
document.addEventListener('keydown', this.handleKeyDown);
|
|
80
|
+
}
|
|
81
|
+
async disconnectedCallback() {
|
|
82
|
+
this.form.unsubscribe(this.name);
|
|
83
|
+
document.removeEventListener('click', this.handleOutsideClick);
|
|
84
|
+
document.removeEventListener('keydown', this.handleKeyDown);
|
|
85
|
+
}
|
|
86
|
+
reset(newValue) {
|
|
87
|
+
this.selectedValue = newValue || this.defaultValue || '';
|
|
88
|
+
if (this.selectedValue) {
|
|
89
|
+
const date = new Date(this.selectedValue + 'T00:00:00');
|
|
90
|
+
this.viewYear = date.getFullYear();
|
|
91
|
+
this.viewMonth = date.getMonth();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
adjustDropdownPosition() {
|
|
95
|
+
requestAnimationFrame(() => {
|
|
96
|
+
const input = this.el.querySelector('.form-input-style');
|
|
97
|
+
if (!input)
|
|
98
|
+
return;
|
|
99
|
+
const rect = input.getBoundingClientRect();
|
|
100
|
+
const spaceBelow = window.innerHeight - rect.bottom - 20;
|
|
101
|
+
this.openUpwards = spaceBelow < 320;
|
|
102
|
+
setTimeout(() => {
|
|
103
|
+
this.isOpen = true;
|
|
104
|
+
}, 10);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
// Date utilities
|
|
108
|
+
toDateString(year, month, day) {
|
|
109
|
+
return `${year}-${String(month + 1).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
|
|
110
|
+
}
|
|
111
|
+
isDateDisabled(year, month, day) {
|
|
112
|
+
const dateStr = this.toDateString(year, month, day);
|
|
113
|
+
if (this.minDate && dateStr < this.minDate)
|
|
114
|
+
return true;
|
|
115
|
+
if (this.maxDate && dateStr > this.maxDate)
|
|
116
|
+
return true;
|
|
117
|
+
if (this.disabledDates)
|
|
118
|
+
return this.disabledDates(new Date(year, month, day));
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
getCalendarDays() {
|
|
122
|
+
const year = this.viewYear;
|
|
123
|
+
const month = this.viewMonth;
|
|
124
|
+
const firstDayOfMonth = new Date(year, month, 1).getDay();
|
|
125
|
+
const daysInMonth = new Date(year, month + 1, 0).getDate();
|
|
126
|
+
const daysInPrevMonth = new Date(year, month, 0).getDate();
|
|
127
|
+
const leadingDays = (firstDayOfMonth - this.firstDayOfWeek + 7) % 7;
|
|
128
|
+
const days = [];
|
|
129
|
+
for (let i = leadingDays - 1; i >= 0; i--) {
|
|
130
|
+
const prevMonth = month === 0 ? 11 : month - 1;
|
|
131
|
+
const prevYear = month === 0 ? year - 1 : year;
|
|
132
|
+
days.push({ day: daysInPrevMonth - i, month: prevMonth, year: prevYear, isCurrentMonth: false });
|
|
133
|
+
}
|
|
134
|
+
for (let i = 1; i <= daysInMonth; i++) {
|
|
135
|
+
days.push({ day: i, month, year, isCurrentMonth: true });
|
|
136
|
+
}
|
|
137
|
+
const remaining = 42 - days.length;
|
|
138
|
+
for (let i = 1; i <= remaining; i++) {
|
|
139
|
+
const nextMonth = month === 11 ? 0 : month + 1;
|
|
140
|
+
const nextYear = month === 11 ? year + 1 : year;
|
|
141
|
+
days.push({ day: i, month: nextMonth, year: nextYear, isCurrentMonth: false });
|
|
142
|
+
}
|
|
143
|
+
return days;
|
|
144
|
+
}
|
|
145
|
+
getWeekDayNames() {
|
|
146
|
+
const names = [];
|
|
147
|
+
const baseDate = new Date(2024, 0, 7); // known Sunday
|
|
148
|
+
for (let i = 0; i < 7; i++) {
|
|
149
|
+
const d = new Date(baseDate);
|
|
150
|
+
d.setDate(d.getDate() + ((this.firstDayOfWeek + i) % 7));
|
|
151
|
+
names.push(new Intl.DateTimeFormat(this.language, { weekday: 'short' }).format(d));
|
|
152
|
+
}
|
|
153
|
+
return names;
|
|
154
|
+
}
|
|
155
|
+
getMonthYearTitle() {
|
|
156
|
+
return new Intl.DateTimeFormat(this.language, { month: 'long', year: 'numeric' }).format(new Date(this.viewYear, this.viewMonth));
|
|
157
|
+
}
|
|
158
|
+
formatDisplayValue() {
|
|
159
|
+
if (!this.selectedValue)
|
|
160
|
+
return '';
|
|
161
|
+
try {
|
|
162
|
+
return new Intl.DateTimeFormat(this.language, { year: 'numeric', month: '2-digit', day: '2-digit' }).format(new Date(this.selectedValue + 'T00:00:00'));
|
|
163
|
+
}
|
|
164
|
+
catch (_a) {
|
|
165
|
+
return this.selectedValue;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
canGoPrev() {
|
|
169
|
+
if (!this.minDate)
|
|
170
|
+
return true;
|
|
171
|
+
const [minYear, minMonth] = this.minDate.split('-').map(Number);
|
|
172
|
+
return this.viewYear > minYear || (this.viewYear === minYear && this.viewMonth > minMonth - 1);
|
|
173
|
+
}
|
|
174
|
+
canGoNext() {
|
|
175
|
+
if (!this.maxDate)
|
|
176
|
+
return true;
|
|
177
|
+
const [maxYear, maxMonth] = this.maxDate.split('-').map(Number);
|
|
178
|
+
return this.viewYear < maxYear || (this.viewYear === maxYear && this.viewMonth < maxMonth - 1);
|
|
179
|
+
}
|
|
180
|
+
render() {
|
|
181
|
+
const { disabled, isRequired, meta, isError, errorMessage } = this.form.getInputState(this.name);
|
|
182
|
+
const [locale] = this.form.getFormLocale();
|
|
183
|
+
const label = getNestedValue(locale, meta === null || meta === void 0 ? void 0 : meta.label) || (meta === null || meta === void 0 ? void 0 : meta.label);
|
|
184
|
+
const placeholder = getNestedValue(locale, meta === null || meta === void 0 ? void 0 : meta.placeholder);
|
|
185
|
+
const isDisabled = disabled || this.isLoading || !!this.staticValue || this.isDisabled;
|
|
186
|
+
const displayValue = this.formatDisplayValue();
|
|
187
|
+
const weekDays = this.getWeekDayNames();
|
|
188
|
+
const days = this.getCalendarDays();
|
|
189
|
+
const monthTitle = this.getMonthYearTitle();
|
|
190
|
+
const now = new Date();
|
|
191
|
+
const todayStr = this.toDateString(now.getFullYear(), now.getMonth(), now.getDate());
|
|
192
|
+
return (h(Host, { key: '4db95c0c0381da76cfda97fdf70810808673d381' }, h("label", { key: 'cc816c07f4b85437a4b08f46e84c67acd6d6e804', part: this.name, id: this.wrapperId, class: cn('form-input-label-container', this.wrapperClass, { disabled: isDisabled }) }, h(FormInputLabel, { key: '8661150081ea4a8bbf98cdf8200b1467912715be', isRequired: isRequired, label: label }), h("form-shadow-input", { key: '70978796ac1617c54806c87963d772c0e2c2e50b', name: this.name, form: this.form, value: this.selectedValue }), h("div", { key: '9341f0d67eb4471d321124c9a9ee7ca8feb06e70', part: `${this.name}-container form-input-container`, class: cn('form-input-container', { open: this.isOpen }) }, h("input", { key: 'f8bfd2ea087a16ee69aa52d98d4ed02daa4b027f', type: "text", readOnly: true, disabled: isDisabled, value: displayValue, onClick: this.toggleDropdown, part: `${this.name}-input form-input`, placeholder: placeholder || (meta === null || meta === void 0 ? void 0 : meta.placeholder), class: cn('form-input-style form-input-select', {
|
|
193
|
+
'form-input-error-style': isError,
|
|
194
|
+
}) }), h("span", { key: 'b90d55597940d7265aa4a9da2bf62e2206c1a443', part: `${this.name}-icon form-date-picker-icon`, class: "form-input-icon form-input-icon-end" }, h("svg", { key: '44a9ffabb98b9fa353504f2e32714cfc4cc55c0a', "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", class: "size-full" }, h("path", { key: '65a36c47d6677d140bdd2732cc2a39cf0e1b4da0', d: "M8 2v4" }), h("path", { key: 'c8147da41710e22f6b9787f249140ad0a0b0e728', d: "M16 2v4" }), h("rect", { key: '05cecc8e5f7a1f7790cafd5bb55f3fce0909b359', width: "18", height: "18", x: "3", y: "4", rx: "2" }), h("path", { key: 'bad2f8467be0592c5878278845561d2d19c389c9', d: "M3 10h18" }))), h("div", { key: 'eab0aa136052e3fbe9d7b336f9214162ddc97167', part: `${this.name}-dropdown form-date-picker-dropdown`, class: cn('form-picker-dropdown', {
|
|
195
|
+
upwards: this.openUpwards,
|
|
196
|
+
downwards: !this.openUpwards,
|
|
197
|
+
}) }, h("div", { key: '58b349b2f93b3e6b144acb91462018175e8a2d4d', class: "form-date-picker-header" }, h("button", { key: '8bc1e5c9d917791c25a8abff82af6ed22ea2f840', type: "button", disabled: !this.canGoPrev(), part: `${this.name}-prev form-date-picker-nav`, onClick: this.prevMonth, class: "form-date-picker-nav" }, h("svg", { key: '4813e5358e8755f1fb8bd445182dd49706f72c51', "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", class: "size-4 rtl:rotate-180" }, h("path", { key: 'c135f860ca663d428dad92669f33510be4f72dda', d: "m15 18-6-6 6-6" }))), h("span", { key: '0ee9dda3778c4c32c0ac6b9c29fe1f145cc72e6c', part: `${this.name}-title form-date-picker-title`, class: "form-date-picker-title" }, monthTitle), h("button", { key: '9c4a0e263c81c080ae4886f30a89be182e4f403a', type: "button", disabled: !this.canGoNext(), part: `${this.name}-next form-date-picker-nav`, onClick: this.nextMonth, class: "form-date-picker-nav" }, h("svg", { key: 'b647449654ae66e719bf1c1c93d203bad6ca814a', "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", class: "size-4 rtl:rotate-180" }, h("path", { key: '6c3ab653e7eb383253f1696ace2e2d29c2a23d79', d: "m9 18 6-6-6-6" })))), h("div", { key: 'e650578c5e476e02f318f8a41ea3e4a5b4591bfb', class: "form-date-picker-grid" }, weekDays.map(day => (h("div", { class: "form-date-picker-weekday" }, day))), days.map(cell => {
|
|
198
|
+
const dateStr = this.toDateString(cell.year, cell.month, cell.day);
|
|
199
|
+
const isSelected = dateStr === this.selectedValue;
|
|
200
|
+
const isToday = dateStr === todayStr;
|
|
201
|
+
const dateDisabled = !cell.isCurrentMonth || this.isDateDisabled(cell.year, cell.month, cell.day);
|
|
202
|
+
return (h("button", { type: "button", disabled: dateDisabled, onClick: () => this.selectDate(cell.year, cell.month, cell.day), part: cn('form-date-picker-day', { 'form-date-picker-day-selected': isSelected, 'form-date-picker-day-today': isToday }), class: cn('form-date-picker-day', {
|
|
203
|
+
selected: isSelected,
|
|
204
|
+
today: isToday && !isSelected,
|
|
205
|
+
outside: !cell.isCurrentMonth,
|
|
206
|
+
}) }, cell.day));
|
|
207
|
+
})))), h(FormErrorMessage, { key: '04191c85e8dd2c23a3714c9f62c39ca0b5fa42d8', name: this.name, isError: isError, errorMessage: locale[errorMessage] || errorMessage }))));
|
|
208
|
+
}
|
|
209
|
+
static get is() { return "form-date-picker"; }
|
|
210
|
+
static get originalStyleUrls() {
|
|
211
|
+
return {
|
|
212
|
+
"$": ["form-inputs.css"]
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
static get styleUrls() {
|
|
216
|
+
return {
|
|
217
|
+
"$": ["form-inputs.css"]
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
static get properties() {
|
|
221
|
+
return {
|
|
222
|
+
"name": {
|
|
223
|
+
"type": "string",
|
|
224
|
+
"attribute": "name",
|
|
225
|
+
"mutable": false,
|
|
226
|
+
"complexType": {
|
|
227
|
+
"original": "string",
|
|
228
|
+
"resolved": "string",
|
|
229
|
+
"references": {}
|
|
230
|
+
},
|
|
231
|
+
"required": false,
|
|
232
|
+
"optional": false,
|
|
233
|
+
"docs": {
|
|
234
|
+
"tags": [],
|
|
235
|
+
"text": ""
|
|
236
|
+
},
|
|
237
|
+
"getter": false,
|
|
238
|
+
"setter": false,
|
|
239
|
+
"reflect": false
|
|
240
|
+
},
|
|
241
|
+
"wrapperId": {
|
|
242
|
+
"type": "string",
|
|
243
|
+
"attribute": "wrapper-id",
|
|
244
|
+
"mutable": false,
|
|
245
|
+
"complexType": {
|
|
246
|
+
"original": "string",
|
|
247
|
+
"resolved": "string",
|
|
248
|
+
"references": {}
|
|
249
|
+
},
|
|
250
|
+
"required": false,
|
|
251
|
+
"optional": false,
|
|
252
|
+
"docs": {
|
|
253
|
+
"tags": [],
|
|
254
|
+
"text": ""
|
|
255
|
+
},
|
|
256
|
+
"getter": false,
|
|
257
|
+
"setter": false,
|
|
258
|
+
"reflect": false
|
|
259
|
+
},
|
|
260
|
+
"isLoading": {
|
|
261
|
+
"type": "boolean",
|
|
262
|
+
"attribute": "is-loading",
|
|
263
|
+
"mutable": false,
|
|
264
|
+
"complexType": {
|
|
265
|
+
"original": "boolean",
|
|
266
|
+
"resolved": "boolean",
|
|
267
|
+
"references": {}
|
|
268
|
+
},
|
|
269
|
+
"required": false,
|
|
270
|
+
"optional": true,
|
|
271
|
+
"docs": {
|
|
272
|
+
"tags": [],
|
|
273
|
+
"text": ""
|
|
274
|
+
},
|
|
275
|
+
"getter": false,
|
|
276
|
+
"setter": false,
|
|
277
|
+
"reflect": false
|
|
278
|
+
},
|
|
279
|
+
"isDisabled": {
|
|
280
|
+
"type": "boolean",
|
|
281
|
+
"attribute": "is-disabled",
|
|
282
|
+
"mutable": false,
|
|
283
|
+
"complexType": {
|
|
284
|
+
"original": "boolean",
|
|
285
|
+
"resolved": "boolean",
|
|
286
|
+
"references": {}
|
|
287
|
+
},
|
|
288
|
+
"required": false,
|
|
289
|
+
"optional": true,
|
|
290
|
+
"docs": {
|
|
291
|
+
"tags": [],
|
|
292
|
+
"text": ""
|
|
293
|
+
},
|
|
294
|
+
"getter": false,
|
|
295
|
+
"setter": false,
|
|
296
|
+
"reflect": false
|
|
297
|
+
},
|
|
298
|
+
"form": {
|
|
299
|
+
"type": "unknown",
|
|
300
|
+
"attribute": "form",
|
|
301
|
+
"mutable": false,
|
|
302
|
+
"complexType": {
|
|
303
|
+
"original": "FormHook<any>",
|
|
304
|
+
"resolved": "FormHook<any>",
|
|
305
|
+
"references": {
|
|
306
|
+
"FormHook": {
|
|
307
|
+
"location": "import",
|
|
308
|
+
"path": "~features/form-hook/form-hook",
|
|
309
|
+
"id": "src/features/form-hook/form-hook.ts::FormHook"
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
"required": false,
|
|
314
|
+
"optional": false,
|
|
315
|
+
"docs": {
|
|
316
|
+
"tags": [],
|
|
317
|
+
"text": ""
|
|
318
|
+
},
|
|
319
|
+
"getter": false,
|
|
320
|
+
"setter": false
|
|
321
|
+
},
|
|
322
|
+
"wrapperClass": {
|
|
323
|
+
"type": "string",
|
|
324
|
+
"attribute": "wrapper-class",
|
|
325
|
+
"mutable": false,
|
|
326
|
+
"complexType": {
|
|
327
|
+
"original": "string",
|
|
328
|
+
"resolved": "string",
|
|
329
|
+
"references": {}
|
|
330
|
+
},
|
|
331
|
+
"required": false,
|
|
332
|
+
"optional": false,
|
|
333
|
+
"docs": {
|
|
334
|
+
"tags": [],
|
|
335
|
+
"text": ""
|
|
336
|
+
},
|
|
337
|
+
"getter": false,
|
|
338
|
+
"setter": false,
|
|
339
|
+
"reflect": false
|
|
340
|
+
},
|
|
341
|
+
"staticValue": {
|
|
342
|
+
"type": "string",
|
|
343
|
+
"attribute": "static-value",
|
|
344
|
+
"mutable": false,
|
|
345
|
+
"complexType": {
|
|
346
|
+
"original": "string",
|
|
347
|
+
"resolved": "string",
|
|
348
|
+
"references": {}
|
|
349
|
+
},
|
|
350
|
+
"required": false,
|
|
351
|
+
"optional": true,
|
|
352
|
+
"docs": {
|
|
353
|
+
"tags": [],
|
|
354
|
+
"text": ""
|
|
355
|
+
},
|
|
356
|
+
"getter": false,
|
|
357
|
+
"setter": false,
|
|
358
|
+
"reflect": false
|
|
359
|
+
},
|
|
360
|
+
"defaultValue": {
|
|
361
|
+
"type": "string",
|
|
362
|
+
"attribute": "default-value",
|
|
363
|
+
"mutable": true,
|
|
364
|
+
"complexType": {
|
|
365
|
+
"original": "string",
|
|
366
|
+
"resolved": "string",
|
|
367
|
+
"references": {}
|
|
368
|
+
},
|
|
369
|
+
"required": false,
|
|
370
|
+
"optional": true,
|
|
371
|
+
"docs": {
|
|
372
|
+
"tags": [],
|
|
373
|
+
"text": ""
|
|
374
|
+
},
|
|
375
|
+
"getter": false,
|
|
376
|
+
"setter": false,
|
|
377
|
+
"reflect": false
|
|
378
|
+
},
|
|
379
|
+
"language": {
|
|
380
|
+
"type": "string",
|
|
381
|
+
"attribute": "language",
|
|
382
|
+
"mutable": false,
|
|
383
|
+
"complexType": {
|
|
384
|
+
"original": "string",
|
|
385
|
+
"resolved": "string",
|
|
386
|
+
"references": {}
|
|
387
|
+
},
|
|
388
|
+
"required": false,
|
|
389
|
+
"optional": true,
|
|
390
|
+
"docs": {
|
|
391
|
+
"tags": [],
|
|
392
|
+
"text": ""
|
|
393
|
+
},
|
|
394
|
+
"getter": false,
|
|
395
|
+
"setter": false,
|
|
396
|
+
"reflect": false,
|
|
397
|
+
"defaultValue": "'en'"
|
|
398
|
+
},
|
|
399
|
+
"minDate": {
|
|
400
|
+
"type": "string",
|
|
401
|
+
"attribute": "min-date",
|
|
402
|
+
"mutable": false,
|
|
403
|
+
"complexType": {
|
|
404
|
+
"original": "string",
|
|
405
|
+
"resolved": "string",
|
|
406
|
+
"references": {}
|
|
407
|
+
},
|
|
408
|
+
"required": false,
|
|
409
|
+
"optional": true,
|
|
410
|
+
"docs": {
|
|
411
|
+
"tags": [],
|
|
412
|
+
"text": ""
|
|
413
|
+
},
|
|
414
|
+
"getter": false,
|
|
415
|
+
"setter": false,
|
|
416
|
+
"reflect": false
|
|
417
|
+
},
|
|
418
|
+
"maxDate": {
|
|
419
|
+
"type": "string",
|
|
420
|
+
"attribute": "max-date",
|
|
421
|
+
"mutable": false,
|
|
422
|
+
"complexType": {
|
|
423
|
+
"original": "string",
|
|
424
|
+
"resolved": "string",
|
|
425
|
+
"references": {}
|
|
426
|
+
},
|
|
427
|
+
"required": false,
|
|
428
|
+
"optional": true,
|
|
429
|
+
"docs": {
|
|
430
|
+
"tags": [],
|
|
431
|
+
"text": ""
|
|
432
|
+
},
|
|
433
|
+
"getter": false,
|
|
434
|
+
"setter": false,
|
|
435
|
+
"reflect": false
|
|
436
|
+
},
|
|
437
|
+
"disabledDates": {
|
|
438
|
+
"type": "unknown",
|
|
439
|
+
"attribute": "disabled-dates",
|
|
440
|
+
"mutable": false,
|
|
441
|
+
"complexType": {
|
|
442
|
+
"original": "(date: Date) => boolean",
|
|
443
|
+
"resolved": "(date: Date) => boolean",
|
|
444
|
+
"references": {
|
|
445
|
+
"Date": {
|
|
446
|
+
"location": "global",
|
|
447
|
+
"id": "global::Date"
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
},
|
|
451
|
+
"required": false,
|
|
452
|
+
"optional": true,
|
|
453
|
+
"docs": {
|
|
454
|
+
"tags": [],
|
|
455
|
+
"text": ""
|
|
456
|
+
},
|
|
457
|
+
"getter": false,
|
|
458
|
+
"setter": false
|
|
459
|
+
},
|
|
460
|
+
"firstDayOfWeek": {
|
|
461
|
+
"type": "number",
|
|
462
|
+
"attribute": "first-day-of-week",
|
|
463
|
+
"mutable": false,
|
|
464
|
+
"complexType": {
|
|
465
|
+
"original": "number",
|
|
466
|
+
"resolved": "number",
|
|
467
|
+
"references": {}
|
|
468
|
+
},
|
|
469
|
+
"required": false,
|
|
470
|
+
"optional": true,
|
|
471
|
+
"docs": {
|
|
472
|
+
"tags": [],
|
|
473
|
+
"text": ""
|
|
474
|
+
},
|
|
475
|
+
"getter": false,
|
|
476
|
+
"setter": false,
|
|
477
|
+
"reflect": false,
|
|
478
|
+
"defaultValue": "0"
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
static get states() {
|
|
483
|
+
return {
|
|
484
|
+
"isOpen": {},
|
|
485
|
+
"selectedValue": {},
|
|
486
|
+
"viewYear": {},
|
|
487
|
+
"viewMonth": {},
|
|
488
|
+
"openUpwards": {}
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
static get elementRef() { return "el"; }
|
|
492
|
+
static get watchers() {
|
|
493
|
+
return [{
|
|
494
|
+
"propName": "staticValue",
|
|
495
|
+
"methodName": "onStaticValueChange"
|
|
496
|
+
}];
|
|
497
|
+
}
|
|
498
|
+
}
|
|
@@ -33,12 +33,12 @@ export class FormInput {
|
|
|
33
33
|
}
|
|
34
34
|
render() {
|
|
35
35
|
const [locale] = this.form.getFormLocale();
|
|
36
|
-
return (h(Host, { key: '
|
|
36
|
+
return (h(Host, { key: 'c441c354ce115473f511a40781d24b7514b722d1' }, h("div", { key: 'f3569f94609f0306ab1ebcda3c6f6d248991b3a0', part: "form-dialog-modal", dir: locale.sharedFormLocales.direction, class: cn('dialog-drop-container', {
|
|
37
37
|
'opened-dialog-drop-container dialog-blur': this.isOpened,
|
|
38
38
|
'error': this.isError,
|
|
39
|
-
}) }, h("div", { key: '
|
|
39
|
+
}) }, h("div", { key: '1d0cdd5ebc72dd513bd504aba206d9013e06e532', part: "dialog-wrapper", class: cn('dialog-wrapper', {
|
|
40
40
|
'opened-dialog-wrapper': this.isOpened,
|
|
41
|
-
}) }, h("button", { key: '
|
|
41
|
+
}) }, h("button", { key: 'e20cbff0c28e88df61fb0fb9ba0648f5122bc9d1', "aria-label": "Close the dialog", part: "dialog-close-icon-button", onClick: this.closeDialog, type: "button", class: "dialog-close-icon-button" }, h(AddIcon, { key: '537d601ce25e20faa543f7be795310c7bf97cdbe' })), h("div", { key: '65c713967f31b1fab0c730d8b328a62cc2e319c1', part: "dialog-content", class: "dialog-content" }, this.isError && this.internalMessage, h("div", { key: 'fbc7477f1c2963081bd5026ac6ebefea68a17475', style: { display: this.isError ? 'none' : 'block' } }, h("slot", { key: '8127f5e16e326fc862cfac12910fde9a3aa45946' }))), h("button", { key: '7a36718edc3de3682201caeeaffee1ffc3cd9c9d', part: "dialog-close-button", type: "button", onClick: this.closeDialog, class: "dialog-close-button" }, this.closeText)))));
|
|
42
42
|
}
|
|
43
43
|
static get is() { return "form-dialog"; }
|
|
44
44
|
static get originalStyleUrls() {
|
|
@@ -12,7 +12,12 @@ const partKeyPrefix = 'form-input-';
|
|
|
12
12
|
export class FormInput {
|
|
13
13
|
constructor() {
|
|
14
14
|
this.inputProps = {};
|
|
15
|
+
this.iconPosition = 'end';
|
|
15
16
|
this.prefixWidth = 0;
|
|
17
|
+
this.onInputChange = (event) => {
|
|
18
|
+
const target = event.target;
|
|
19
|
+
target.value = this.formatter ? this.formatter(target.value) : target.value;
|
|
20
|
+
};
|
|
16
21
|
}
|
|
17
22
|
async componentWillLoad() {
|
|
18
23
|
this.form.subscribe(this.name, this);
|
|
@@ -20,8 +25,9 @@ export class FormInput {
|
|
|
20
25
|
}
|
|
21
26
|
async onStaticValueChange(newStaticValue, notInitialLoad = true) {
|
|
22
27
|
if (!!newStaticValue) {
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
28
|
+
const formatted = this.formatter ? this.formatter(newStaticValue) : newStaticValue;
|
|
29
|
+
this.defaultValue = formatted;
|
|
30
|
+
this.inputRef.value = formatted;
|
|
25
31
|
}
|
|
26
32
|
else if (notInitialLoad) {
|
|
27
33
|
this.defaultValue = '';
|
|
@@ -38,7 +44,7 @@ export class FormInput {
|
|
|
38
44
|
}
|
|
39
45
|
reset(newValue) {
|
|
40
46
|
const value = newValue || this.defaultValue || '';
|
|
41
|
-
this.inputRef.value = value;
|
|
47
|
+
this.inputRef.value = this.formatter ? this.formatter(value) : value;
|
|
42
48
|
}
|
|
43
49
|
render() {
|
|
44
50
|
var _a, _b;
|
|
@@ -48,9 +54,18 @@ export class FormInput {
|
|
|
48
54
|
const label = getNestedValue(locale, meta === null || meta === void 0 ? void 0 : meta.label) || (meta === null || meta === void 0 ? void 0 : meta.label);
|
|
49
55
|
const placeholder = getNestedValue(locale, meta === null || meta === void 0 ? void 0 : meta.placeholder);
|
|
50
56
|
const isDisabled = disabled || this.isLoading || !!this.staticValue || this.isDisabled;
|
|
51
|
-
|
|
57
|
+
const isRtl = ((_a = locale === null || locale === void 0 ? void 0 : locale.sharedFormLocales) === null || _a === void 0 ? void 0 : _a.direction) === 'rtl';
|
|
58
|
+
const isIconStart = this.iconPosition === 'start';
|
|
59
|
+
const iconPaddingSide = isIconStart ? (isRtl ? 'paddingRight' : 'paddingLeft') : isRtl ? 'paddingLeft' : 'paddingRight';
|
|
60
|
+
const iconClass = cn('form-input-icon', {
|
|
61
|
+
'form-input-icon-start': isIconStart,
|
|
62
|
+
'form-input-icon-end': !isIconStart,
|
|
63
|
+
'form-input-icon-interactive': !!this.iconAction,
|
|
64
|
+
});
|
|
65
|
+
const renderIcon = () => this.iconAction ? (h("button", { type: "button", disabled: isDisabled, onClick: this.iconAction, part: `${this.name}-icon form-input-icon`, class: iconClass }, this.icon)) : (h("span", { part: `${this.name}-icon form-input-icon`, class: iconClass }, this.icon));
|
|
66
|
+
return (h(Host, { key: '64e1dc935b2527d8264fd145b830533b244a3e06' }, h("label", { key: 'a3a03a65a13c1f64f3bc10236b26cdd9b0990250', part: this.name, id: this.wrapperId, class: cn('form-input-label-container', this.wrapperClass, { disabled: isDisabled }) }, h(FormInputLabel, { key: 'a650f865e2dc033dc611203b1c0bb02654c30c66', isRequired: isRequired, label: label }), h("div", { key: '21fc7153d4d1d8b1f66df3931deb3fe9467f1984', part: `${this.name}-container form-input-container`, class: "form-input-container" }, h(FormInputPrefix, { key: '2bcf38f42353f939603c2b6a9cced6962d1ba795', name: this.name, direction: (_b = locale === null || locale === void 0 ? void 0 : locale.sharedFormLocales) === null || _b === void 0 ? void 0 : _b.direction, prefix: this.inputPrefix }), h("input", Object.assign({ key: '056b29e97c4e784d824da863a12c6118d32c6b05' }, this.inputProps, { name: this.name, type: this === null || this === void 0 ? void 0 : this.type, disabled: isDisabled, onInput: this.onInputChange, defaultValue: this.formatter ? this.formatter(this.defaultValue || '') : this.defaultValue, part: `${this.name}-input form-input`, placeholder: placeholder || (meta === null || meta === void 0 ? void 0 : meta.placeholder), style: Object.assign(Object.assign({}, (this.prefixWidth ? { [isRtl ? 'paddingRight' : 'paddingLeft']: `${this.prefixWidth}px` } : {})), (this.icon ? { [iconPaddingSide]: '40px' } : {})), class: cn('form-input-style', part, {
|
|
52
67
|
'form-input-error-style': isError,
|
|
53
|
-
}) }))), h(FormErrorMessage, { key: '
|
|
68
|
+
}) })), this.icon && renderIcon()), h(FormErrorMessage, { key: 'd1f35267c7fb6348c456532042d922d56640c549', name: this.name, isError: isError, errorMessage: locale[errorMessage] || errorMessage }))));
|
|
54
69
|
}
|
|
55
70
|
static get is() { return "form-input"; }
|
|
56
71
|
static get originalStyleUrls() {
|
|
@@ -284,6 +299,81 @@ export class FormInput {
|
|
|
284
299
|
"getter": false,
|
|
285
300
|
"setter": false,
|
|
286
301
|
"reflect": false
|
|
302
|
+
},
|
|
303
|
+
"formatter": {
|
|
304
|
+
"type": "unknown",
|
|
305
|
+
"attribute": "formatter",
|
|
306
|
+
"mutable": false,
|
|
307
|
+
"complexType": {
|
|
308
|
+
"original": "(value: string) => string",
|
|
309
|
+
"resolved": "(value: string) => string",
|
|
310
|
+
"references": {}
|
|
311
|
+
},
|
|
312
|
+
"required": false,
|
|
313
|
+
"optional": true,
|
|
314
|
+
"docs": {
|
|
315
|
+
"tags": [],
|
|
316
|
+
"text": ""
|
|
317
|
+
},
|
|
318
|
+
"getter": false,
|
|
319
|
+
"setter": false
|
|
320
|
+
},
|
|
321
|
+
"icon": {
|
|
322
|
+
"type": "any",
|
|
323
|
+
"attribute": "icon",
|
|
324
|
+
"mutable": false,
|
|
325
|
+
"complexType": {
|
|
326
|
+
"original": "any",
|
|
327
|
+
"resolved": "any",
|
|
328
|
+
"references": {}
|
|
329
|
+
},
|
|
330
|
+
"required": false,
|
|
331
|
+
"optional": true,
|
|
332
|
+
"docs": {
|
|
333
|
+
"tags": [],
|
|
334
|
+
"text": ""
|
|
335
|
+
},
|
|
336
|
+
"getter": false,
|
|
337
|
+
"setter": false,
|
|
338
|
+
"reflect": false
|
|
339
|
+
},
|
|
340
|
+
"iconAction": {
|
|
341
|
+
"type": "unknown",
|
|
342
|
+
"attribute": "icon-action",
|
|
343
|
+
"mutable": false,
|
|
344
|
+
"complexType": {
|
|
345
|
+
"original": "() => void",
|
|
346
|
+
"resolved": "() => void",
|
|
347
|
+
"references": {}
|
|
348
|
+
},
|
|
349
|
+
"required": false,
|
|
350
|
+
"optional": true,
|
|
351
|
+
"docs": {
|
|
352
|
+
"tags": [],
|
|
353
|
+
"text": ""
|
|
354
|
+
},
|
|
355
|
+
"getter": false,
|
|
356
|
+
"setter": false
|
|
357
|
+
},
|
|
358
|
+
"iconPosition": {
|
|
359
|
+
"type": "string",
|
|
360
|
+
"attribute": "icon-position",
|
|
361
|
+
"mutable": false,
|
|
362
|
+
"complexType": {
|
|
363
|
+
"original": "'start' | 'end'",
|
|
364
|
+
"resolved": "\"end\" | \"start\"",
|
|
365
|
+
"references": {}
|
|
366
|
+
},
|
|
367
|
+
"required": false,
|
|
368
|
+
"optional": true,
|
|
369
|
+
"docs": {
|
|
370
|
+
"tags": [],
|
|
371
|
+
"text": ""
|
|
372
|
+
},
|
|
373
|
+
"getter": false,
|
|
374
|
+
"setter": false,
|
|
375
|
+
"reflect": false,
|
|
376
|
+
"defaultValue": "'end'"
|
|
287
377
|
}
|
|
288
378
|
};
|
|
289
379
|
}
|