aloha-vue 2.66.0 → 2.66.2
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/CHANGELOG.md +1098 -1090
- package/dist/aloha-vue.es.js +15671 -15507
- package/dist/aloha-vue.umd.js +68 -68
- package/package.json +99 -99
- package/scss/_base.scss +62 -62
- package/scss/aloha-vue.scss +68 -68
- package/scss/components/AFilters.scss +304 -304
- package/scss/components/AFormElement/AValidatedJson.scss +6 -6
- package/scss/components/AMenu.scss +627 -627
- package/scss/components/AModal.scss +44 -44
- package/scss/components/APagination.scss +167 -167
- package/scss/components/ARate.scss +78 -78
- package/scss/components/AResizer.scss +63 -63
- package/scss/components/ATable.scss +819 -819
- package/scss/components/ATableForm.scss +307 -307
- package/scss/components/AVerticalScroll.scss +47 -47
- package/scss/components/AWizard.scss +669 -669
- package/scss/components/ui/ADatepicker.scss +342 -342
- package/scss/components/ui/ADatepickerRange.scss +45 -45
- package/scss/components/ui/AFieldset.scss +78 -78
- package/scss/components/ui/AInputNumber.scss +62 -62
- package/scss/components/ui/AInputNumberRange.scss +30 -30
- package/scss/components/ui/ASelect.scss +236 -236
- package/scss/components/ui/ASlider.scss +186 -186
- package/scss/components/ui/ASwitch.scss +148 -148
- package/scss/components/ui/ui.scss +254 -254
- package/scss/text/text_alignment.scss +39 -39
- package/scss/text/text_transform.scss +51 -51
- package/scss/text/text_wrapping.scss +40 -40
- package/scss/utils/badge.scss +45 -45
- package/scss/utils/checkbox_radio.scss +134 -134
- package/scss/utils/color.scss +46 -46
- package/scss/utils/dropdown.scss +185 -185
- package/scss/utils/list.scss +75 -75
- package/scss/utils/modal.scss +173 -173
- package/scss/utils/sizing.scss +137 -137
- package/scss/utils/spacing.scss +63 -63
- package/scss/utils/tooltip.scss +63 -63
- package/src/AAccordion/AAccordion.js +206 -206
- package/src/AAccordion/compositionAPI/IndexesForOpenAPI.js +63 -63
- package/src/AAccordion/compositionAPI/ToggleAPI.js +85 -85
- package/src/AAlert/AAlert.js +216 -216
- package/src/AAlert/compositionAPI/ClassAPI.js +21 -21
- package/src/AAlert/i18n/AAlertI18n.js +19 -19
- package/src/AAlert/i18n/ar.json +2 -2
- package/src/AAlert/i18n/de.json +2 -2
- package/src/AAlert/i18n/en.json +2 -2
- package/src/AAlert/i18n/es.json +2 -2
- package/src/AAlert/i18n/fr.json +2 -2
- package/src/AAlert/i18n/hr.json +2 -2
- package/src/AAlert/i18n/it.json +2 -2
- package/src/AAlert/i18n/ru.json +2 -2
- package/src/AButton/AButton.js +275 -275
- package/src/ACarousel/ACarousel.js +361 -361
- package/src/ACarousel/ACarouselBtn/ACarouselBtn.js +75 -75
- package/src/ACarousel/ACarouselBtn/compositionAPI/ClassAPI.js +16 -16
- package/src/ACarousel/ACarouselBtn/compositionAPI/TextAPI.js +25 -25
- package/src/ACarousel/ACarouselControls/ACarouselControls.js +114 -114
- package/src/ACarousel/ACarouselControls/ACarouselControlsIndicator/ACarouselControlsIndicator.js +146 -146
- package/src/ACarousel/ACarouselControls/ACarouselControlsIndicator/compositionAPI/ActiveAPI.js +33 -33
- package/src/ACarousel/ACarouselControls/ACarouselControlsIndicator/compositionAPI/AttributesAPI.js +40 -40
- package/src/ACarousel/ACarouselControls/ACarouselControlsIndicator/compositionAPI/EventsAPI.js +25 -25
- package/src/ACarousel/ACarouselControls/ACarouselControlsIndicator/compositionAPI/IconAPI.js +20 -20
- package/src/ACarousel/ACarouselControls/compositionAPI/AriaLabelAPI.js +20 -20
- package/src/ACarousel/ACarouselItem/ACarouselItem.js +83 -83
- package/src/ACarousel/ACarouselItem/compositionAPI/AttributesAPI.js +39 -39
- package/src/ACarousel/ACarouselItem/compositionAPI/IsActiveAPI.js +21 -21
- package/src/ACarousel/compositionAPI/ActiveAPI.js +111 -111
- package/src/ACarousel/compositionAPI/AriaLabelAPI.js +25 -25
- package/src/ACarousel/compositionAPI/ArrowsAPI.js +17 -17
- package/src/ACarousel/compositionAPI/ClassAPI.js +44 -44
- package/src/ACarousel/compositionAPI/DataAPI.js +41 -41
- package/src/ACarousel/compositionAPI/IndicatorsAPI.js +148 -148
- package/src/ACarousel/compositionAPI/TextsAPI.js +25 -25
- package/src/ACarousel/i18n/ACarouselI18n.js +19 -19
- package/src/ACarousel/i18n/ar.json +8 -8
- package/src/ACarousel/i18n/de.json +8 -8
- package/src/ACarousel/i18n/en.json +8 -8
- package/src/ACarousel/i18n/es.json +8 -8
- package/src/ACarousel/i18n/fr.json +8 -8
- package/src/ACarousel/i18n/hr.json +8 -8
- package/src/ACarousel/i18n/it.json +8 -8
- package/src/ACarousel/i18n/ru.json +8 -8
- package/src/ACollapse/ACollapse.js +103 -103
- package/src/ADropdown/ADropdown.js +544 -544
- package/src/ADropdown/ADropdownGroup.js +85 -85
- package/src/ADropdown/compositionAPI/ActionsAPI.js +147 -147
- package/src/ADropdown/compositionAPI/AttributesAPI.js +100 -100
- package/src/AElement/AElement.js +518 -518
- package/src/AElement/compositionAPI/AttributesAPI.js +51 -51
- package/src/AElement/compositionAPI/ClickAPI.js +30 -30
- package/src/AElement/compositionAPI/ComponentLocalAPI.js +23 -23
- package/src/AElement/compositionAPI/DisabledAPI.js +22 -22
- package/src/AElement/compositionAPI/HtmlTitleAPI.js +33 -33
- package/src/AElement/compositionAPI/KeydownAPI.js +35 -35
- package/src/AElement/compositionAPI/LoadingAPI.js +22 -22
- package/src/AElement/compositionAPI/RouterLinkAPI.js +20 -20
- package/src/AElement/compositionAPI/SwitchAPI.js +33 -33
- package/src/AElement/compositionAPI/TagAPI.js +34 -34
- package/src/AElement/compositionAPI/TextAPI.js +78 -78
- package/src/AElement/compositionAPI/TitleAPI.js +29 -29
- package/src/AFilters/AFilterCenter/AFilterCenter.js +154 -154
- package/src/AFilters/AFilterCenter/AFilterCenterItem/AFilterCenterItem.js +207 -207
- package/src/AFilters/AFilters/AFilters.js +282 -282
- package/src/AFilters/i18n/ar.json +30 -30
- package/src/AFilters/i18n/en.json +30 -30
- package/src/AFilters/i18n/es.json +30 -30
- package/src/AFilters/i18n/fr.json +30 -30
- package/src/AFilters/i18n/hr.json +30 -30
- package/src/AFilters/i18n/it.json +30 -30
- package/src/AFilters/i18n/ru.json +30 -30
- package/src/AGroupButtonDropdown/compositionAPI/ActionsAPI.js +143 -143
- package/src/ALink/ALink.js +253 -253
- package/src/AMenu/AMenu.js +578 -578
- package/src/AMenu/AMenuBreadcrumbs/compositionAPI/RenderTruncatedAPI.js +74 -74
- package/src/AMenu/AMenuButtonToggle/AMenuButtonToggle.js +94 -94
- package/src/AMenu/AMenuButtonToggle/compositionAPI/ToggleAPI.js +95 -95
- package/src/AMenu/AMenuPanelLink/AMenuPanelLink.js +250 -250
- package/src/AMenu/compositionAPI/BackdropAPI.js +42 -42
- package/src/AMenu/compositionAPI/KeydownAPI.js +197 -197
- package/src/AMenu/compositionAPI/LinkClickAPI.js +48 -48
- package/src/AMenu/compositionAPI/MenuAttributesAPI.js +51 -51
- package/src/AMenu/compositionAPI/PanelsAPI.js +78 -78
- package/src/AMenu/compositionAPI/ResizeAPI.js +74 -74
- package/src/AModal/AModal.js +530 -530
- package/src/AModalForm/AModalForm.js +383 -383
- package/src/AModalWizard/AModalWizard.js +563 -563
- package/src/ANotification/ANotification.js +60 -60
- package/src/APagination/APagination.js +111 -111
- package/src/APagination/APaginationCountPerPage/APaginationCountPerPage.js +209 -209
- package/src/APagination/APaginationCountPerPage/compositionAPI/MainAPI.js +40 -40
- package/src/APagination/APaginationCountPerPage/compositionAPI/TextsAPI.js +54 -54
- package/src/APagination/APaginationPages/APaginationPages.js +282 -282
- package/src/APagination/APaginationPages/compositionAPI/PaginationItemsAPI.js +102 -102
- package/src/APagination/APaginationPages/compositionAPI/TextsAPI.js +74 -74
- package/src/APagination/compositionAPI/ComponentsAPI.js +79 -79
- package/src/APagination/i18n/ar.json +12 -12
- package/src/APagination/i18n/es.json +12 -12
- package/src/APagination/i18n/fr.json +12 -12
- package/src/APagination/i18n/hr.json +12 -12
- package/src/APagination/i18n/it.json +12 -12
- package/src/APagination/i18n/ru.json +12 -12
- package/src/APopup/APopup.js +115 -115
- package/src/ATable/ATable.js +1159 -1157
- package/src/ATable/ATableHeaderThAction/ATableHeaderThAction.js +241 -241
- package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.ModelAPI.test.js +200 -200
- package/src/ATable/ATableSortingAdditional/compositionAPI/ModelAPI.js +152 -152
- package/src/ATable/ATableTd/ATableTd.js +145 -145
- package/src/ATable/ATableTdAction/ATableTdAction.js +223 -218
- package/src/ATable/ATableTopPanel/ATableTopPanel.js +433 -433
- package/src/ATable/ATableTr/ATableTr.js +8 -0
- package/src/ATable/ATableTr/compositionAPI/AttributesAPI.js +3 -1
- package/src/ATable/__tests__/ATable.RowIdsAPI.test.js +66 -0
- package/src/ATable/compositionAPI/ColumnActionAPI.js +105 -105
- package/src/ATable/compositionAPI/ColumnStylesAPI.js +50 -50
- package/src/ATable/compositionAPI/ColumnsGroupedAPI.js +187 -187
- package/src/ATable/compositionAPI/PaginationModesAPI.js +44 -44
- package/src/ATable/compositionAPI/PreviewAPI.js +201 -201
- package/src/ATable/compositionAPI/PreviewRightResizeAPI.js +135 -135
- package/src/ATable/compositionAPI/RowActionsAPI.js +3 -1
- package/src/ATable/compositionAPI/ScrollControlAPI.js +249 -249
- package/src/ATable/compositionAPI/SortAPI.js +86 -86
- package/src/ATable/compositionAPI/WidthAPI.js +73 -73
- package/src/ATableForm/ATableForm.js +595 -595
- package/src/ATableForm/ATableFormCell/ATableFormCell.js +204 -204
- package/src/ATableForm/ATableFormCell/compositionAPI/DisabledAPI.js +23 -23
- package/src/ATableForm/ATableFormCell/compositionAPI/ReadonlyAPI.js +31 -31
- package/src/ATableForm/ATableFormCellAction/ATableFormCellAction.js +282 -282
- package/src/ATableForm/ATableFormCellAction/compositionAPI/DeleteAPI.js +80 -80
- package/src/ATableForm/ATableFormCellAction/compositionAPI/DisabledAPI.js +60 -60
- package/src/ATableForm/ATableFormCellAction/compositionAPI/HiddenAPI.js +46 -46
- package/src/ATableForm/ATableFormCellAction/compositionAPI/IdsAPI.js +31 -31
- package/src/ATableForm/ATableFormCellAction/compositionAPI/StylesAPI.js +27 -27
- package/src/ATableForm/ATableFormCellAction/compositionAPI/TitleAPI.js +47 -47
- package/src/ATableForm/ATableFormCellDnd/compositionAPI/IdAPI.js +21 -21
- package/src/ATableForm/ATableFormCellList/ATableFormCellList.js +127 -127
- package/src/ATableForm/ATableFormCellList/compositionAPI/DataAPI.js +77 -77
- package/src/ATableForm/ATableFormRow/ATableFormRow.js +592 -592
- package/src/ATableForm/ATableFormRow/compositionAPI/ErrorsAPI.js +40 -40
- package/src/ATableForm/ATableFormRow/compositionAPI/FocusAPI.js +55 -55
- package/src/ATableForm/ATableFormRow/compositionAPI/IdAPI.js +19 -19
- package/src/ATableForm/__tests__/ATableForm.ListView.test.js +864 -864
- package/src/ATableForm/compositionAPI/ClassesAPI.js +23 -23
- package/src/ATableForm/compositionAPI/ColumnsGrowAPI.js +180 -180
- package/src/ATableForm/compositionAPI/DeleteAPI.js +9 -9
- package/src/ATableForm/compositionAPI/EditAPI.js +125 -125
- package/src/ATableForm/compositionAPI/RowsAPI.js +42 -42
- package/src/ATableForm/compositionAPI/StylesAPI.js +62 -62
- package/src/ATableForm/compositionAPI/WidthsAPI.js +20 -20
- package/src/ATableForm/i18n/ATableFormI18n.js +19 -19
- package/src/ATableForm/utils/getFormElement.js +32 -32
- package/src/ATabs/ATabsContent/ATabsContent.js +102 -102
- package/src/ATabs/ATabsTab/ATabsTab.js +185 -185
- package/src/ATooltip/ATooltip.js +221 -221
- package/src/ATranslation/compositionAPI/UtilsAPI.js +187 -187
- package/src/AVerticalScroll/compositionAPI/ScrollAPI.js +55 -55
- package/src/AWizard/AWizard.js +467 -467
- package/src/compositionAPI/AEventOutsideAPI.js +46 -46
- package/src/compositionAPI/AFiltersAPI.js +178 -178
- package/src/compositionAPI/AMobileAPI.js +32 -32
- package/src/compositionAPI/APageTabTitleAPI.js +84 -84
- package/src/compositionAPI/ARemPxAPI.js +47 -47
- package/src/compositionAPI/FocusByDestroyAPI.js +67 -67
- package/src/const/AKeys.js +9 -9
- package/src/directives/AOnHooks.js +0 -0
- package/src/filters/__tests__/filterValueByCondition.test.js +94 -94
- package/src/filters/filterValueByCondition.js +87 -87
- package/src/i18n/allLanguages.js +377 -377
- package/src/i18n/ar.json +4 -4
- package/src/i18n/de.json +4 -4
- package/src/i18n/en.json +4 -4
- package/src/i18n/es.json +4 -4
- package/src/i18n/fr.json +4 -4
- package/src/i18n/hr.json +4 -4
- package/src/i18n/it.json +4 -4
- package/src/i18n/ru.json +4 -4
- package/src/index.js +403 -403
- package/src/plugins/AAlertPlugin.js +53 -53
- package/src/plugins/ACarouselPlugin.js +34 -34
- package/src/plugins/ADatepickerPlugin.js +57 -57
- package/src/plugins/AFiltersPlugin.js +102 -102
- package/src/plugins/AInputCurrencyPlugin.js +31 -31
- package/src/plugins/AMobilePlugin.js +32 -32
- package/src/plugins/ARemPxPlugin.js +37 -37
- package/src/plugins/ASelectPlugin.js +51 -51
- package/src/plugins/ASelectStylesPlugin.js +2376 -2376
- package/src/temp/px_to_rem_mapping_1_to_800.md +802 -802
- package/src/ui/ACheckbox/ACheckbox.js +929 -929
- package/src/ui/ACheckbox/ACheckboxItem/ACheckboxItem.js +0 -0
- package/src/ui/ACheckboxRadioGroups/ACheckboxRadioGroups.js +0 -0
- package/src/ui/ADatepicker/ADatepicker.js +804 -803
- package/src/ui/ADatepicker/ADatepickerCalendarPanel/ADatepickerCalendarPanel.js +796 -796
- package/src/ui/ADatepicker/ADatepickerCalendarPanel/compositionAPI/CalendarAPI.js +51 -51
- package/src/ui/ADatepicker/compositionAPI/LanguagesAPI.js +92 -92
- package/src/ui/ADatepicker/compositionAPI/PlaceholderAPI.js +55 -55
- package/src/ui/ADatepicker/i18n/ADatepickerI18n.js +19 -19
- package/src/ui/ADatepicker/i18n/ar.json +47 -47
- package/src/ui/ADatepicker/i18n/de.json +48 -48
- package/src/ui/ADatepicker/i18n/en.json +48 -48
- package/src/ui/ADatepicker/i18n/es.json +47 -47
- package/src/ui/ADatepicker/i18n/fr.json +47 -47
- package/src/ui/ADatepicker/i18n/hr.json +47 -47
- package/src/ui/ADatepicker/i18n/it.json +47 -47
- package/src/ui/ADatepicker/i18n/ru.json +48 -48
- package/src/ui/ADatepicker/panel/APanelDate/APanelDate.js +196 -196
- package/src/ui/ADatepicker/panel/APanelDate/compositionAPI/DatesAPI.js +66 -66
- package/src/ui/ADatepicker/panel/APanelDate/compositionAPI/FocusAPI.js +96 -96
- package/src/ui/ADatepicker/panel/APanelDate/compositionAPI/FocusActiveAPI.js +27 -27
- package/src/ui/ADatepicker/panel/APanelDate/compositionAPI/SelectAPI.js +21 -21
- package/src/ui/ADatepicker/panel/APanelDate/compositionAPI/TableAPI.js +128 -128
- package/src/ui/ADatepicker/panel/APanelMonth/APanelMonth.js +129 -129
- package/src/ui/ADatepicker/panel/APanelMonth/compositionAPI/FocusAPI.js +94 -94
- package/src/ui/ADatepicker/panel/APanelMonth/compositionAPI/FocusActiveAPI.js +21 -21
- package/src/ui/ADatepicker/panel/APanelMonth/compositionAPI/MonthsAPI.js +51 -51
- package/src/ui/ADatepicker/panel/APanelMonth/compositionAPI/SelectAPI.js +29 -29
- package/src/ui/ADatepicker/panel/APanelYearItem/APanelYearItem.js +75 -75
- package/src/ui/ADatepicker/panel/APanelYearItem/compositionAPI/AttributesAPI.js +35 -35
- package/src/ui/ADatepicker/panel/APanelYearItem/compositionAPI/SelectAPI.js +35 -35
- package/src/ui/ADatepickerAlt/ADatepicker.js +1 -0
- package/src/ui/ADatepickerRange/ADatepickerRange.js +528 -525
- package/src/ui/AErrors/AErrors.js +149 -149
- package/src/ui/AErrors/AErrorsElement/AErrorsElement.js +0 -0
- package/src/ui/AErrors/i18n/AErrorsI18n.js +19 -19
- package/src/ui/AErrors/i18n/ar.json +3 -3
- package/src/ui/AErrors/i18n/de.json +2 -2
- package/src/ui/AErrors/i18n/en.json +3 -3
- package/src/ui/AErrors/i18n/es.json +3 -3
- package/src/ui/AErrors/i18n/fr.json +3 -3
- package/src/ui/AErrors/i18n/hr.json +3 -3
- package/src/ui/AErrors/i18n/it.json +3 -3
- package/src/ui/AErrors/i18n/ru.json +3 -3
- package/src/ui/AErrorsText/AErrorsText.js +62 -62
- package/src/ui/AFieldset/AFieldset.js +535 -535
- package/src/ui/AFieldset/compositionAPI/ModelAPI.js +54 -54
- package/src/ui/AForm/AForm.js +252 -252
- package/src/ui/AFormElement/AFormElement.js +160 -160
- package/src/ui/AFormElementBtnClear/AFormElementBtnClear.js +86 -86
- package/src/ui/AFormElementBtnClear/i18n/AFormElementBtnClearI18n.js +19 -19
- package/src/ui/AFormElementBtnClear/i18n/ar.json +2 -2
- package/src/ui/AFormElementBtnClear/i18n/de.json +2 -2
- package/src/ui/AFormElementBtnClear/i18n/en.json +2 -2
- package/src/ui/AFormElementBtnClear/i18n/es.json +2 -2
- package/src/ui/AFormElementBtnClear/i18n/fr.json +2 -2
- package/src/ui/AFormElementBtnClear/i18n/hr.json +2 -2
- package/src/ui/AFormElementBtnClear/i18n/it.json +2 -2
- package/src/ui/AFormElementBtnClear/i18n/ru.json +2 -2
- package/src/ui/AFormHelpText/AFormHelpText.js +37 -37
- package/src/ui/AFormLabelDescription/AFormLabelDescription.js +43 -43
- package/src/ui/AFormReadonly/AFormReadonly.js +193 -193
- package/src/ui/AGroup/AGroup.js +427 -427
- package/src/ui/AInput/AInput.js +516 -516
- package/src/ui/AInput/compositionAPI/ClassAPI.js +43 -43
- package/src/ui/AInputCurrency/AInputCurrency.js +620 -619
- package/src/ui/AInputCurrency/compositionAPI/IncreaseDecreaseAPI.js +76 -76
- package/src/ui/AInputCurrency/compositionAPI/InputEventsAPI.js +752 -752
- package/src/ui/AInputCurrency/compositionAPI/ModelAPI.js +88 -88
- package/src/ui/AInputCurrency/compositionAPI/UtilsAPI.js +67 -67
- package/src/ui/AInputFile/AInputFile.js +244 -243
- package/src/ui/AInputNumber/AInputNumber.js +491 -489
- package/src/ui/AInputNumber/compositionAPI/InputEventsAPI.js +196 -196
- package/src/ui/AInputNumber/compositionAPI/ModelAPI.js +72 -72
- package/src/ui/AInputNumberRange/AInputNumberRange.js +508 -505
- package/src/ui/AJson/AJson.js +434 -434
- package/src/ui/ALabel/ALabel.js +0 -0
- package/src/ui/AMultiselectOrdered/AMultiselectOrdered.js +935 -935
- package/src/ui/AOneCheckbox/AOneCheckbox.js +366 -366
- package/src/ui/ARadio/ARadio.js +924 -924
- package/src/ui/ARadio/ARadioItem/ARadioItem.js +0 -0
- package/src/ui/ARequired/ARequired.js +0 -0
- package/src/ui/ARouterLinkConfig/ARouterLinkConfig.js +391 -391
- package/src/ui/ARouterLinkConfig/compositionAPI/DataFormAPI.js +102 -102
- package/src/ui/ARouterLinkConfig/compositionAPI/ModelLocalAPI.js +96 -96
- package/src/ui/ARouterLinkConfig/compositionAPI/RouteAPI.js +51 -51
- package/src/ui/ASelect/ASelect.js +1210 -1209
- package/src/ui/ASelect/ASelectElement/ASelectElement.js +0 -0
- package/src/ui/ASelect/ASelectValueCloseable/compositionAPI/CloseAPI.js +28 -28
- package/src/ui/ASelect/compositionAPI/ToggleAPI.js +255 -255
- package/src/ui/ASelect/i18n/ar.json +6 -6
- package/src/ui/ASelect/i18n/de.json +7 -7
- package/src/ui/ASelect/i18n/en.json +6 -6
- package/src/ui/ASelect/i18n/es.json +6 -6
- package/src/ui/ASelect/i18n/fr.json +6 -6
- package/src/ui/ASelect/i18n/hr.json +6 -6
- package/src/ui/ASelect/i18n/it.json +6 -6
- package/src/ui/ASelect/i18n/ru.json +6 -6
- package/src/ui/ASelectIcon/ASelectIcon.js +386 -386
- package/src/ui/ASelectStyle/ASelectStyle.js +391 -391
- package/src/ui/ASelectStyle/compositionAPI/DataAPI.js +68 -68
- package/src/ui/ASelectStyle/compositionAPI/EventsAPI.js +24 -24
- package/src/ui/ASelectStyle/compositionAPI/KeyLabelCallbackAPI.js +15 -15
- package/src/ui/ASelectStyle/compositionAPI/TypeAPI.js +24 -24
- package/src/ui/ASelectStyle/i18n/ASelectStyleI18n.js +19 -19
- package/src/ui/ASelectStyle/i18n/ar.json +277 -277
- package/src/ui/ASelectStyle/i18n/de.json +277 -277
- package/src/ui/ASelectStyle/i18n/en.json +277 -277
- package/src/ui/ASelectStyle/i18n/es.json +277 -277
- package/src/ui/ASelectStyle/i18n/fr.json +277 -277
- package/src/ui/ASelectStyle/i18n/hr.json +277 -277
- package/src/ui/ASelectStyle/i18n/it.json +277 -277
- package/src/ui/ASelectStyle/i18n/ru.json +277 -277
- package/src/ui/ASlider/ASlider.js +672 -672
- package/src/ui/ASlider/compositionAPI/AriaAttributesAPI.js +121 -121
- package/src/ui/ASlider/compositionAPI/AttributesAPI.js +15 -15
- package/src/ui/ASlider/compositionAPI/DataAPI.js +115 -115
- package/src/ui/ASlider/compositionAPI/DragAndDropAPI.js +198 -198
- package/src/ui/ASlider/compositionAPI/LabelAPI.js +13 -13
- package/src/ui/ASlider/compositionAPI/MarksAPI.js +32 -32
- package/src/ui/ASlider/compositionAPI/SliderAPI.js +289 -289
- package/src/ui/ASlider/compositionAPI/StopsAPI.js +47 -47
- package/src/ui/ASlider/compositionAPI/StylesAPI.js +79 -79
- package/src/ui/ASlider/compositionAPI/TitleAPI.js +42 -42
- package/src/ui/ASlider/i18n/ASliderI18n.js +19 -19
- package/src/ui/ASlider/i18n/en.json +4 -4
- package/src/ui/ASwitch/ASwitch.js +439 -438
- package/src/ui/ATemplate/ATemplate.js +0 -0
- package/src/ui/ATextarea/ATextarea.js +437 -437
- package/src/ui/AUiComponents.js +59 -59
- package/src/ui/AUiContainerComponents.js +12 -12
- package/src/ui/AValidatedJson/AValidatedJson.js +594 -594
- package/src/ui/AValidatedJson/AValidatedJsonItem/compositionAPI/DeleteAPI.js +63 -63
- package/src/ui/AValidatedJson/AValidatedJsonItem/compositionAPI/DetailsAPI.js +59 -59
- package/src/ui/AValidatedJson/AValidatedJsonItem/compositionAPI/MoveAPI.js +50 -50
- package/src/ui/AValidatedJson/AValidatedJsonItem/compositionAPI/UpdateAPI.js +48 -48
- package/src/ui/AValidatedJson/AValidatedJsonModalCreateOrUpdate/composiitionAPI/DataFormAPI.js +69 -69
- package/src/ui/AValidatedJson/AValidatedJsonModalCreateOrUpdate/composiitionAPI/DisabledAPI.js +35 -35
- package/src/ui/AValidatedJson/AValidatedJsonModalCreateOrUpdate/composiitionAPI/ModelAPI.js +31 -31
- package/src/ui/AValidatedJson/AValidatedJsonModalCreateOrUpdate/composiitionAPI/SaveAPI.js +115 -115
- package/src/ui/AValidatedJson/AValidatedJsonModalCreateOrUpdate/composiitionAPI/TextAPI.js +25 -25
- package/src/ui/AValidatedJson/compositionAPI/AValidatedJsonErrorLabelsAPI.js +18 -18
- package/src/ui/AValidatedJson/compositionAPI/AttributesAPI.js +15 -15
- package/src/ui/AValidatedJson/compositionAPI/ChildrenAPI.js +70 -70
- package/src/ui/AValidatedJson/compositionAPI/EventsAPI.js +19 -19
- package/src/ui/AValidatedJson/compositionAPI/JsonModeAPI.js +119 -119
- package/src/ui/AValidatedJson/compositionAPI/ListModeAPI.js +144 -144
- package/src/ui/AValidatedJson/compositionAPI/ModelAPI.js +38 -38
- package/src/ui/AValidatedJson/compositionAPI/SingleModeAPI.js +112 -112
- package/src/ui/AValidatedJson/compositionAPI/TranslateAPI.js +22 -22
- package/src/ui/AValidatedJson/i18n/AValidatedJsonI18n.js +19 -19
- package/src/ui/AValidatedJson/i18n/ar.json +3 -3
- package/src/ui/AValidatedJson/i18n/de.json +22 -22
- package/src/ui/AValidatedJson/i18n/en.json +3 -3
- package/src/ui/AValidatedJson/i18n/es.json +3 -3
- package/src/ui/AValidatedJson/i18n/fr.json +3 -3
- package/src/ui/AValidatedJson/i18n/hr.json +3 -3
- package/src/ui/AValidatedJson/i18n/it.json +3 -3
- package/src/ui/AValidatedJson/i18n/ru.json +6 -6
- package/src/ui/compositionApi/UIDataGroupAPI.js +94 -94
- package/src/ui/compositionApi/UiAPI.js +185 -185
- package/src/ui/compositionApi/UiClearButtonAPI.js +19 -19
- package/src/ui/compositionApi/UiDataSortAPI.js +29 -29
- package/src/ui/compositionApi/UiDataWithKeyIdAndLabelAPI.js +155 -155
- package/src/ui/const/AUiTypes.js +69 -69
- package/src/ui/mixins/UiMixinProps.js +129 -129
- package/src/ui/utils/utils.js +79 -79
- package/src/utils/__tests__/utils.aOrderBy.test.js +237 -237
- package/src/utils/__tests__/utils.aSortBy.test.js +331 -331
- package/src/utils/__tests__/utilsArray.aFirst.test.js +54 -54
- package/src/utils/__tests__/utilsArray.aLast.test.js +54 -54
- package/src/utils/__tests__/utilsLang.isArguments.test.js +52 -52
- package/src/utils/__tests__/utilsLang.isArray.test.js +50 -50
- package/src/utils/__tests__/utilsLang.isArrayBuffer.test.js +48 -48
- package/src/utils/__tests__/utilsLang.isBoolean.test.js +56 -56
- package/src/utils/__tests__/utilsLang.isBuffer.test.js +47 -47
- package/src/utils/__tests__/utilsLang.isDate.test.js +54 -54
- package/src/utils/__tests__/utilsLang.isElement.test.js +53 -53
- package/src/utils/__tests__/utilsLang.isError.test.js +52 -52
- package/src/utils/__tests__/utilsLang.isFinite.test.js +57 -57
- package/src/utils/__tests__/utilsLang.isFunction.test.js +46 -46
- package/src/utils/__tests__/utilsLang.isInteger.test.js +58 -58
- package/src/utils/__tests__/utilsLang.isMap.test.js +50 -50
- package/src/utils/__tests__/utilsLang.isNaN.test.js +55 -55
- package/src/utils/__tests__/utilsLang.isNil.test.js +57 -57
- package/src/utils/__tests__/utilsLang.isNull.test.js +53 -53
- package/src/utils/__tests__/utilsLang.isNumber.test.js +54 -54
- package/src/utils/__tests__/utilsLang.isObject.test.js +49 -49
- package/src/utils/__tests__/utilsLang.isObjectLike.test.js +45 -45
- package/src/utils/__tests__/utilsLang.isPlainObject.test.js +60 -60
- package/src/utils/__tests__/utilsLang.isPromise.test.js +93 -93
- package/src/utils/__tests__/utilsLang.isRegExp.test.js +46 -46
- package/src/utils/__tests__/utilsLang.isSet.test.js +50 -50
- package/src/utils/__tests__/utilsLang.isString.test.js +50 -50
- package/src/utils/__tests__/utilsLang.isSymbol.test.js +45 -45
- package/src/utils/__tests__/utilsLang.isUndefined.test.js +57 -57
- package/src/utils/__tests__/utilsLang.isWeakMap.test.js +49 -49
- package/src/utils/__tests__/utilsLang.isWeakSet.test.js +49 -49
- package/src/utils/actions.js +67 -67
- package/src/utils/autosize.js +277 -277
- package/src/utils/isBrowser.js +12 -12
- package/src/utils/utils.js +253 -253
- package/src/utils/utilsArray.js +29 -29
- package/src/utils/utilsDOM.js +188 -188
- package/src/utils/utilsLang.js +346 -346
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
/* eslint vue/component-api-style: off */
|
|
2
|
-
import {
|
|
3
|
-
h,
|
|
4
|
-
} from "vue";
|
|
5
|
-
|
|
6
|
-
import APanelDate from "../panel/APanelDate/APanelDate";
|
|
7
|
-
import APanelMonth from "../panel/APanelMonth/APanelMonth";
|
|
8
|
-
import APanelTime from "../panel/APanelTime/APanelTime";
|
|
9
|
-
import APanelYear from "../panel/APanelYear/APanelYear";
|
|
10
|
-
|
|
11
|
-
import CalendarAPI from "./compositionAPI/CalendarAPI";
|
|
12
|
-
|
|
13
|
-
import AKeysCode from "../../../const/AKeysCode";
|
|
14
|
-
import PanelMixin from "../mixins/PanelMixin";
|
|
15
|
-
import scrollIntoView from "../utils/scroll-into-view";
|
|
16
|
-
import {
|
|
17
|
-
formatDate,
|
|
18
|
-
isDateObject,
|
|
19
|
-
isValidDate,
|
|
20
|
-
} from "../utils";
|
|
21
|
-
import {
|
|
22
|
-
forEach,
|
|
23
|
-
} from "lodash-es";
|
|
24
|
-
|
|
25
|
-
// @vue/component
|
|
26
|
-
export default {
|
|
27
|
-
name: "ADatepickerCalendarPanel",
|
|
28
|
-
components: {
|
|
29
|
-
APanelDate,
|
|
30
|
-
APanelMonth,
|
|
31
|
-
APanelTime,
|
|
32
|
-
APanelYear,
|
|
33
|
-
},
|
|
34
|
-
mixins: [
|
|
35
|
-
PanelMixin,
|
|
36
|
-
],
|
|
37
|
-
props: {
|
|
38
|
-
currentLanguage: {
|
|
39
|
-
type: Object,
|
|
40
|
-
required: true,
|
|
41
|
-
},
|
|
42
|
-
dateFormat: {
|
|
43
|
-
type: String,
|
|
44
|
-
default: "YYYY-MM-DD",
|
|
45
|
-
},
|
|
46
|
-
defaultValue: {
|
|
47
|
-
validator: function(val) {
|
|
48
|
-
return isValidDate(val);
|
|
49
|
-
},
|
|
50
|
-
default: undefined,
|
|
51
|
-
},
|
|
52
|
-
disabledDays: {
|
|
53
|
-
type: [Array, Function],
|
|
54
|
-
default: function() {
|
|
55
|
-
return [];
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
endAt: {
|
|
59
|
-
type: [String, Number, Boolean, Array, Object, Date, Function, Symbol],
|
|
60
|
-
required: false,
|
|
61
|
-
default: undefined,
|
|
62
|
-
},
|
|
63
|
-
firstDayOfWeek: {
|
|
64
|
-
default: 1,
|
|
65
|
-
type: Number,
|
|
66
|
-
validator: val => val >= 1 && val <= 7,
|
|
67
|
-
},
|
|
68
|
-
focusStartDate: {
|
|
69
|
-
type: Boolean,
|
|
70
|
-
required: false,
|
|
71
|
-
},
|
|
72
|
-
id: {
|
|
73
|
-
type: String,
|
|
74
|
-
required: true,
|
|
75
|
-
},
|
|
76
|
-
index: {
|
|
77
|
-
type: Number,
|
|
78
|
-
default: undefined,
|
|
79
|
-
},
|
|
80
|
-
maxDate: {
|
|
81
|
-
default: null,
|
|
82
|
-
validator: function(val) {
|
|
83
|
-
return !val || isValidDate(val);
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
minDate: {
|
|
87
|
-
default: null,
|
|
88
|
-
validator: function(val) {
|
|
89
|
-
return !val || isValidDate(val);
|
|
90
|
-
},
|
|
91
|
-
},
|
|
1
|
+
/* eslint vue/component-api-style: off */
|
|
2
|
+
import {
|
|
3
|
+
h,
|
|
4
|
+
} from "vue";
|
|
5
|
+
|
|
6
|
+
import APanelDate from "../panel/APanelDate/APanelDate";
|
|
7
|
+
import APanelMonth from "../panel/APanelMonth/APanelMonth";
|
|
8
|
+
import APanelTime from "../panel/APanelTime/APanelTime";
|
|
9
|
+
import APanelYear from "../panel/APanelYear/APanelYear";
|
|
10
|
+
|
|
11
|
+
import CalendarAPI from "./compositionAPI/CalendarAPI";
|
|
12
|
+
|
|
13
|
+
import AKeysCode from "../../../const/AKeysCode";
|
|
14
|
+
import PanelMixin from "../mixins/PanelMixin";
|
|
15
|
+
import scrollIntoView from "../utils/scroll-into-view";
|
|
16
|
+
import {
|
|
17
|
+
formatDate,
|
|
18
|
+
isDateObject,
|
|
19
|
+
isValidDate,
|
|
20
|
+
} from "../utils";
|
|
21
|
+
import {
|
|
22
|
+
forEach,
|
|
23
|
+
} from "lodash-es";
|
|
24
|
+
|
|
25
|
+
// @vue/component
|
|
26
|
+
export default {
|
|
27
|
+
name: "ADatepickerCalendarPanel",
|
|
28
|
+
components: {
|
|
29
|
+
APanelDate,
|
|
30
|
+
APanelMonth,
|
|
31
|
+
APanelTime,
|
|
32
|
+
APanelYear,
|
|
33
|
+
},
|
|
34
|
+
mixins: [
|
|
35
|
+
PanelMixin,
|
|
36
|
+
],
|
|
37
|
+
props: {
|
|
38
|
+
currentLanguage: {
|
|
39
|
+
type: Object,
|
|
40
|
+
required: true,
|
|
41
|
+
},
|
|
42
|
+
dateFormat: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: "YYYY-MM-DD",
|
|
45
|
+
},
|
|
46
|
+
defaultValue: {
|
|
47
|
+
validator: function(val) {
|
|
48
|
+
return isValidDate(val);
|
|
49
|
+
},
|
|
50
|
+
default: undefined,
|
|
51
|
+
},
|
|
52
|
+
disabledDays: {
|
|
53
|
+
type: [Array, Function],
|
|
54
|
+
default: function() {
|
|
55
|
+
return [];
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
endAt: {
|
|
59
|
+
type: [String, Number, Boolean, Array, Object, Date, Function, Symbol],
|
|
60
|
+
required: false,
|
|
61
|
+
default: undefined,
|
|
62
|
+
},
|
|
63
|
+
firstDayOfWeek: {
|
|
64
|
+
default: 1,
|
|
65
|
+
type: Number,
|
|
66
|
+
validator: val => val >= 1 && val <= 7,
|
|
67
|
+
},
|
|
68
|
+
focusStartDate: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
required: false,
|
|
71
|
+
},
|
|
72
|
+
id: {
|
|
73
|
+
type: String,
|
|
74
|
+
required: true,
|
|
75
|
+
},
|
|
76
|
+
index: {
|
|
77
|
+
type: Number,
|
|
78
|
+
default: undefined,
|
|
79
|
+
},
|
|
80
|
+
maxDate: {
|
|
81
|
+
default: null,
|
|
82
|
+
validator: function(val) {
|
|
83
|
+
return !val || isValidDate(val);
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
minDate: {
|
|
87
|
+
default: null,
|
|
88
|
+
validator: function(val) {
|
|
89
|
+
return !val || isValidDate(val);
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
92
|
minuteStep: {
|
|
93
93
|
type: Number,
|
|
94
94
|
default: 0,
|
|
@@ -100,74 +100,74 @@ export default {
|
|
|
100
100
|
default: undefined,
|
|
101
101
|
validator: value => ["hour", "minute", "second"].indexOf(value) !== -1,
|
|
102
102
|
},
|
|
103
|
-
startAt: {
|
|
104
|
-
type: [String, Number, Boolean, Array, Object, Date, Function, Symbol],
|
|
105
|
-
required: false,
|
|
106
|
-
default: undefined,
|
|
107
|
-
},
|
|
108
|
-
startDate: {
|
|
109
|
-
type: [String, Number, Boolean, Array, Object, Date, Function, Symbol],
|
|
110
|
-
required: false,
|
|
111
|
-
default: undefined,
|
|
112
|
-
},
|
|
113
|
-
type: {
|
|
114
|
-
type: String,
|
|
115
|
-
default: "date", // ["date", "datetime"]
|
|
116
|
-
},
|
|
117
|
-
value: {
|
|
118
|
-
default: null,
|
|
119
|
-
validator: function(val) {
|
|
120
|
-
return val === null || isValidDate(val);
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
visible: {
|
|
124
|
-
type: Boolean,
|
|
125
|
-
default: false,
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
emits: [
|
|
129
|
-
"closePopup",
|
|
130
|
-
"selectDate",
|
|
131
|
-
"selectTime",
|
|
132
|
-
],
|
|
133
|
-
setup(props) {
|
|
134
|
-
const {
|
|
135
|
-
calendarMonth,
|
|
136
|
-
calendarYear,
|
|
137
|
-
firstYear,
|
|
138
|
-
getNow,
|
|
139
|
-
initCalendarValues,
|
|
140
|
-
} = CalendarAPI(props);
|
|
141
|
-
|
|
142
|
-
initCalendarValues();
|
|
143
|
-
|
|
144
|
-
return {
|
|
145
|
-
calendarMonth,
|
|
146
|
-
calendarYear,
|
|
147
|
-
firstYear,
|
|
148
|
-
getNow,
|
|
149
|
-
};
|
|
150
|
-
},
|
|
151
|
-
data() {
|
|
152
|
-
return {
|
|
153
|
-
panel: "NONE",
|
|
154
|
-
dates: [],
|
|
155
|
-
isFocusPanelChild: false,
|
|
156
|
-
isWorkWithKeyboard: false,
|
|
157
|
-
};
|
|
158
|
-
},
|
|
103
|
+
startAt: {
|
|
104
|
+
type: [String, Number, Boolean, Array, Object, Date, Function, Symbol],
|
|
105
|
+
required: false,
|
|
106
|
+
default: undefined,
|
|
107
|
+
},
|
|
108
|
+
startDate: {
|
|
109
|
+
type: [String, Number, Boolean, Array, Object, Date, Function, Symbol],
|
|
110
|
+
required: false,
|
|
111
|
+
default: undefined,
|
|
112
|
+
},
|
|
113
|
+
type: {
|
|
114
|
+
type: String,
|
|
115
|
+
default: "date", // ["date", "datetime"]
|
|
116
|
+
},
|
|
117
|
+
value: {
|
|
118
|
+
default: null,
|
|
119
|
+
validator: function(val) {
|
|
120
|
+
return val === null || isValidDate(val);
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
visible: {
|
|
124
|
+
type: Boolean,
|
|
125
|
+
default: false,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
emits: [
|
|
129
|
+
"closePopup",
|
|
130
|
+
"selectDate",
|
|
131
|
+
"selectTime",
|
|
132
|
+
],
|
|
133
|
+
setup(props) {
|
|
134
|
+
const {
|
|
135
|
+
calendarMonth,
|
|
136
|
+
calendarYear,
|
|
137
|
+
firstYear,
|
|
138
|
+
getNow,
|
|
139
|
+
initCalendarValues,
|
|
140
|
+
} = CalendarAPI(props);
|
|
141
|
+
|
|
142
|
+
initCalendarValues();
|
|
143
|
+
|
|
144
|
+
return {
|
|
145
|
+
calendarMonth,
|
|
146
|
+
calendarYear,
|
|
147
|
+
firstYear,
|
|
148
|
+
getNow,
|
|
149
|
+
};
|
|
150
|
+
},
|
|
151
|
+
data() {
|
|
152
|
+
return {
|
|
153
|
+
panel: "NONE",
|
|
154
|
+
dates: [],
|
|
155
|
+
isFocusPanelChild: false,
|
|
156
|
+
isWorkWithKeyboard: false,
|
|
157
|
+
};
|
|
158
|
+
},
|
|
159
159
|
computed: {
|
|
160
|
-
now: {
|
|
161
|
-
get() {
|
|
162
|
-
return new Date(this.calendarYear, this.calendarMonth).getTime();
|
|
163
|
-
},
|
|
164
|
-
set(val) {
|
|
165
|
-
const now = new Date(val);
|
|
166
|
-
this.calendarYear = now.getFullYear();
|
|
167
|
-
this.calendarMonth = now.getMonth();
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
|
|
160
|
+
now: {
|
|
161
|
+
get() {
|
|
162
|
+
return new Date(this.calendarYear, this.calendarMonth).getTime();
|
|
163
|
+
},
|
|
164
|
+
set(val) {
|
|
165
|
+
const now = new Date(val);
|
|
166
|
+
this.calendarYear = now.getFullYear();
|
|
167
|
+
this.calendarMonth = now.getMonth();
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
|
|
171
171
|
formatForTimePanel() {
|
|
172
172
|
return typeof this.$parent.formatLocal === "string" ?
|
|
173
173
|
this.$parent.formatLocal :
|
|
@@ -187,227 +187,227 @@ export default {
|
|
|
187
187
|
|
|
188
188
|
return this.minuteStep === 0 ? "second" : "minute";
|
|
189
189
|
},
|
|
190
|
-
|
|
190
|
+
|
|
191
191
|
timeHeader() {
|
|
192
192
|
if (this.type === "time") {
|
|
193
193
|
return this.formatForTimePanel;
|
|
194
194
|
}
|
|
195
195
|
return this.value && formatDate(this.value, this.dateFormat);
|
|
196
196
|
},
|
|
197
|
-
|
|
198
|
-
yearHeader() {
|
|
199
|
-
const LAST_YEAR = this.firstYear + 9;
|
|
200
|
-
return this.currentLanguage.headerYears(this.firstYear, LAST_YEAR);
|
|
201
|
-
},
|
|
202
|
-
|
|
203
|
-
months() {
|
|
204
|
-
return this.currentLanguage.months;
|
|
205
|
-
},
|
|
206
|
-
|
|
207
|
-
minDateTime() {
|
|
208
|
-
return this.getCriticalTime(this.minDate);
|
|
209
|
-
},
|
|
210
|
-
|
|
211
|
-
maxDateTime() {
|
|
212
|
-
return this.getCriticalTime(this.maxDate);
|
|
213
|
-
},
|
|
214
|
-
|
|
215
|
-
suffixForHeader() {
|
|
216
|
-
if (this.panel === "TIME") {
|
|
217
|
-
return this.currentLanguage.placeholder.regionTime;
|
|
218
|
-
}
|
|
219
|
-
return this.currentLanguage.placeholder.regionDate;
|
|
220
|
-
},
|
|
221
|
-
|
|
222
|
-
idForHeaderParent() {
|
|
223
|
-
return `${ this.idForHeader }_parent`;
|
|
224
|
-
},
|
|
225
|
-
|
|
226
|
-
ariaLabelForButtonLastYear() {
|
|
227
|
-
if (this.panel === "YEAR") {
|
|
228
|
-
return this.currentLanguage.buttons.lastYears;
|
|
229
|
-
}
|
|
230
|
-
return this.currentLanguage.buttons.lastYear;
|
|
231
|
-
},
|
|
232
|
-
|
|
233
|
-
ariaLabelForButtonLastMonth() {
|
|
234
|
-
return this.currentLanguage.buttons.lastMonth;
|
|
235
|
-
},
|
|
236
|
-
|
|
237
|
-
ariaLabelForButtonNextMonth() {
|
|
238
|
-
return this.currentLanguage.buttons.nextMonth;
|
|
239
|
-
},
|
|
240
|
-
|
|
241
|
-
ariaLabelForButtonNextYear() {
|
|
242
|
-
if (this.panel === "YEAR") {
|
|
243
|
-
return this.currentLanguage.buttons.nextYears;
|
|
244
|
-
}
|
|
245
|
-
return this.currentLanguage.buttons.nextYear;
|
|
246
|
-
},
|
|
247
|
-
|
|
248
|
-
ariaLabelForButtonCurrentMonth() {
|
|
249
|
-
return this.currentLanguage.buttons.toMonthsView;
|
|
250
|
-
},
|
|
251
|
-
|
|
252
|
-
ariaLabelForButtonCurrentYear() {
|
|
253
|
-
return this.currentLanguage.buttons.toYearsView;
|
|
254
|
-
},
|
|
255
|
-
|
|
256
|
-
ariaLabelForButtonToDays() {
|
|
257
|
-
return this.currentLanguage.buttons.toDaysView;
|
|
258
|
-
},
|
|
259
|
-
},
|
|
260
|
-
watch: {
|
|
261
|
-
value: {
|
|
262
|
-
handler: "updateNow",
|
|
263
|
-
},
|
|
264
|
-
defaultValue: {
|
|
265
|
-
handler: "updateNow",
|
|
266
|
-
},
|
|
267
|
-
visible: {
|
|
268
|
-
immediate: true,
|
|
269
|
-
handler: "init",
|
|
270
|
-
},
|
|
271
|
-
panel: {
|
|
272
|
-
handler: "handelPanelChange",
|
|
273
|
-
},
|
|
274
|
-
},
|
|
275
|
-
beforeUnmount() {
|
|
276
|
-
this.destroyListenerForPressTabButton();
|
|
277
|
-
this.destroyListenerForPressEscapeButton();
|
|
278
|
-
},
|
|
279
|
-
methods: {
|
|
280
|
-
handelPanelChange(panel) {
|
|
281
|
-
if (panel === "YEAR") {
|
|
282
|
-
this.firstYear = Math.floor(this.calendarYear / 10) * 10;
|
|
283
|
-
} else if (panel === "TIME") {
|
|
284
|
-
this.$nextTick().then(() => {
|
|
285
|
-
const list = this.$el.querySelectorAll(".pux_datepicker__panel_time .pux_datepicker__time_list");
|
|
286
|
-
for (let i = 0, len = list.length; i < len; i++) {
|
|
287
|
-
const el = list[i];
|
|
288
|
-
scrollIntoView(el, el.querySelector(".actived"));
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
},
|
|
293
|
-
|
|
294
|
-
init(val) {
|
|
295
|
-
if (val) {
|
|
296
|
-
const type = this.type;
|
|
297
|
-
if (type === "month") {
|
|
298
|
-
this.showPanelMonth();
|
|
299
|
-
} else if (type === "year") {
|
|
300
|
-
this.showPanelYear();
|
|
301
|
-
} else if (type === "time") {
|
|
302
|
-
this.showPanelTime();
|
|
303
|
-
} else {
|
|
304
|
-
this.showPanelDate();
|
|
305
|
-
}
|
|
306
|
-
this.setListenerForPressEscapeButton();
|
|
307
|
-
} else {
|
|
308
|
-
this.showPanelNone();
|
|
309
|
-
this.updateNow(this.value);
|
|
310
|
-
this.destroyListenerForPressEscapeButton();
|
|
311
|
-
}
|
|
312
|
-
this.emitEventBusDestroyAllListenerForPressButtonsForPanels();
|
|
313
|
-
},
|
|
314
|
-
|
|
315
|
-
updateNow(value) {
|
|
316
|
-
this.now = this.getNow(value);
|
|
317
|
-
},
|
|
318
|
-
|
|
319
|
-
getCriticalTime(value) {
|
|
320
|
-
if (!value) {
|
|
321
|
-
return null;
|
|
322
|
-
}
|
|
323
|
-
const date = new Date(value);
|
|
324
|
-
if (this.type === "year") {
|
|
325
|
-
return new Date(date.getFullYear(), 0).getTime();
|
|
326
|
-
} else if (this.type === "month") {
|
|
327
|
-
return new Date(date.getFullYear(), date.getMonth()).getTime();
|
|
328
|
-
} else if (this.type === "date") {
|
|
329
|
-
return date.setHours(0, 0, 0, 0);
|
|
330
|
-
}
|
|
331
|
-
return date.getTime();
|
|
332
|
-
},
|
|
333
|
-
|
|
334
|
-
inBefore(time, startAt) {
|
|
335
|
-
if (startAt === undefined) {
|
|
336
|
-
startAt = this.startAt;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
return (
|
|
340
|
-
(this.minDateTime && time < this.minDateTime) ||
|
|
341
|
-
(startAt && time < this.getCriticalTime(startAt))
|
|
342
|
-
);
|
|
343
|
-
},
|
|
344
|
-
|
|
345
|
-
inAfter(time, endAt) {
|
|
346
|
-
if (endAt === undefined) {
|
|
347
|
-
endAt = this.endAt;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
return (
|
|
351
|
-
(this.maxDateTime && time > this.maxDateTime) ||
|
|
352
|
-
(endAt && time > this.getCriticalTime(endAt))
|
|
353
|
-
);
|
|
354
|
-
},
|
|
355
|
-
|
|
356
|
-
inDisabledDays(time) {
|
|
357
|
-
if (Array.isArray(this.disabledDays)) {
|
|
358
|
-
return this.disabledDays.some(v => this.getCriticalTime(v) === time);
|
|
359
|
-
}
|
|
360
|
-
if (typeof this.disabledDays === "function") {
|
|
361
|
-
return this.disabledDays(new Date(time));
|
|
362
|
-
}
|
|
363
|
-
return false;
|
|
364
|
-
},
|
|
365
|
-
|
|
366
|
-
isDisabledYear(year) {
|
|
367
|
-
const time = new Date(year, 0).getTime();
|
|
368
|
-
const maxTime = new Date(year + 1, 0).getTime() - 1;
|
|
369
|
-
return (
|
|
370
|
-
this.inBefore(maxTime) ||
|
|
371
|
-
this.inAfter(time) ||
|
|
372
|
-
(this.type === "year" && this.inDisabledDays(time))
|
|
373
|
-
);
|
|
374
|
-
},
|
|
375
|
-
|
|
376
|
-
isDisabledMonth(month) {
|
|
377
|
-
const time = new Date(this.calendarYear, month).getTime();
|
|
378
|
-
const maxTime = new Date(this.calendarYear, month + 1).getTime() - 1;
|
|
379
|
-
return (
|
|
380
|
-
this.inBefore(maxTime) ||
|
|
381
|
-
this.inAfter(time) ||
|
|
382
|
-
(this.type === "month" && this.inDisabledDays(time))
|
|
383
|
-
);
|
|
384
|
-
},
|
|
385
|
-
|
|
386
|
-
isDisabledDate(date) {
|
|
387
|
-
const time = new Date(date).getTime();
|
|
388
|
-
const maxTime = new Date(date).setHours(23, 59, 59, 999);
|
|
389
|
-
return (
|
|
390
|
-
this.inBefore(maxTime) ||
|
|
391
|
-
this.inAfter(time) ||
|
|
392
|
-
this.inDisabledDays(time)
|
|
393
|
-
);
|
|
394
|
-
},
|
|
395
|
-
|
|
396
|
-
isDisabledTime(date, startAt, endAt) {
|
|
397
|
-
const time = new Date(date).getTime();
|
|
398
|
-
return (
|
|
399
|
-
this.inBefore(time, startAt) ||
|
|
400
|
-
this.inAfter(time, endAt) ||
|
|
401
|
-
this.inDisabledDays(time)
|
|
402
|
-
);
|
|
403
|
-
},
|
|
404
|
-
|
|
197
|
+
|
|
198
|
+
yearHeader() {
|
|
199
|
+
const LAST_YEAR = this.firstYear + 9;
|
|
200
|
+
return this.currentLanguage.headerYears(this.firstYear, LAST_YEAR);
|
|
201
|
+
},
|
|
202
|
+
|
|
203
|
+
months() {
|
|
204
|
+
return this.currentLanguage.months;
|
|
205
|
+
},
|
|
206
|
+
|
|
207
|
+
minDateTime() {
|
|
208
|
+
return this.getCriticalTime(this.minDate);
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
maxDateTime() {
|
|
212
|
+
return this.getCriticalTime(this.maxDate);
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
suffixForHeader() {
|
|
216
|
+
if (this.panel === "TIME") {
|
|
217
|
+
return this.currentLanguage.placeholder.regionTime;
|
|
218
|
+
}
|
|
219
|
+
return this.currentLanguage.placeholder.regionDate;
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
idForHeaderParent() {
|
|
223
|
+
return `${ this.idForHeader }_parent`;
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
ariaLabelForButtonLastYear() {
|
|
227
|
+
if (this.panel === "YEAR") {
|
|
228
|
+
return this.currentLanguage.buttons.lastYears;
|
|
229
|
+
}
|
|
230
|
+
return this.currentLanguage.buttons.lastYear;
|
|
231
|
+
},
|
|
232
|
+
|
|
233
|
+
ariaLabelForButtonLastMonth() {
|
|
234
|
+
return this.currentLanguage.buttons.lastMonth;
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
ariaLabelForButtonNextMonth() {
|
|
238
|
+
return this.currentLanguage.buttons.nextMonth;
|
|
239
|
+
},
|
|
240
|
+
|
|
241
|
+
ariaLabelForButtonNextYear() {
|
|
242
|
+
if (this.panel === "YEAR") {
|
|
243
|
+
return this.currentLanguage.buttons.nextYears;
|
|
244
|
+
}
|
|
245
|
+
return this.currentLanguage.buttons.nextYear;
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
ariaLabelForButtonCurrentMonth() {
|
|
249
|
+
return this.currentLanguage.buttons.toMonthsView;
|
|
250
|
+
},
|
|
251
|
+
|
|
252
|
+
ariaLabelForButtonCurrentYear() {
|
|
253
|
+
return this.currentLanguage.buttons.toYearsView;
|
|
254
|
+
},
|
|
255
|
+
|
|
256
|
+
ariaLabelForButtonToDays() {
|
|
257
|
+
return this.currentLanguage.buttons.toDaysView;
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
watch: {
|
|
261
|
+
value: {
|
|
262
|
+
handler: "updateNow",
|
|
263
|
+
},
|
|
264
|
+
defaultValue: {
|
|
265
|
+
handler: "updateNow",
|
|
266
|
+
},
|
|
267
|
+
visible: {
|
|
268
|
+
immediate: true,
|
|
269
|
+
handler: "init",
|
|
270
|
+
},
|
|
271
|
+
panel: {
|
|
272
|
+
handler: "handelPanelChange",
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
beforeUnmount() {
|
|
276
|
+
this.destroyListenerForPressTabButton();
|
|
277
|
+
this.destroyListenerForPressEscapeButton();
|
|
278
|
+
},
|
|
279
|
+
methods: {
|
|
280
|
+
handelPanelChange(panel) {
|
|
281
|
+
if (panel === "YEAR") {
|
|
282
|
+
this.firstYear = Math.floor(this.calendarYear / 10) * 10;
|
|
283
|
+
} else if (panel === "TIME") {
|
|
284
|
+
this.$nextTick().then(() => {
|
|
285
|
+
const list = this.$el.querySelectorAll(".pux_datepicker__panel_time .pux_datepicker__time_list");
|
|
286
|
+
for (let i = 0, len = list.length; i < len; i++) {
|
|
287
|
+
const el = list[i];
|
|
288
|
+
scrollIntoView(el, el.querySelector(".actived"));
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
|
|
294
|
+
init(val) {
|
|
295
|
+
if (val) {
|
|
296
|
+
const type = this.type;
|
|
297
|
+
if (type === "month") {
|
|
298
|
+
this.showPanelMonth();
|
|
299
|
+
} else if (type === "year") {
|
|
300
|
+
this.showPanelYear();
|
|
301
|
+
} else if (type === "time") {
|
|
302
|
+
this.showPanelTime();
|
|
303
|
+
} else {
|
|
304
|
+
this.showPanelDate();
|
|
305
|
+
}
|
|
306
|
+
this.setListenerForPressEscapeButton();
|
|
307
|
+
} else {
|
|
308
|
+
this.showPanelNone();
|
|
309
|
+
this.updateNow(this.value);
|
|
310
|
+
this.destroyListenerForPressEscapeButton();
|
|
311
|
+
}
|
|
312
|
+
this.emitEventBusDestroyAllListenerForPressButtonsForPanels();
|
|
313
|
+
},
|
|
314
|
+
|
|
315
|
+
updateNow(value) {
|
|
316
|
+
this.now = this.getNow(value);
|
|
317
|
+
},
|
|
318
|
+
|
|
319
|
+
getCriticalTime(value) {
|
|
320
|
+
if (!value) {
|
|
321
|
+
return null;
|
|
322
|
+
}
|
|
323
|
+
const date = new Date(value);
|
|
324
|
+
if (this.type === "year") {
|
|
325
|
+
return new Date(date.getFullYear(), 0).getTime();
|
|
326
|
+
} else if (this.type === "month") {
|
|
327
|
+
return new Date(date.getFullYear(), date.getMonth()).getTime();
|
|
328
|
+
} else if (this.type === "date") {
|
|
329
|
+
return date.setHours(0, 0, 0, 0);
|
|
330
|
+
}
|
|
331
|
+
return date.getTime();
|
|
332
|
+
},
|
|
333
|
+
|
|
334
|
+
inBefore(time, startAt) {
|
|
335
|
+
if (startAt === undefined) {
|
|
336
|
+
startAt = this.startAt;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
return (
|
|
340
|
+
(this.minDateTime && time < this.minDateTime) ||
|
|
341
|
+
(startAt && time < this.getCriticalTime(startAt))
|
|
342
|
+
);
|
|
343
|
+
},
|
|
344
|
+
|
|
345
|
+
inAfter(time, endAt) {
|
|
346
|
+
if (endAt === undefined) {
|
|
347
|
+
endAt = this.endAt;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
return (
|
|
351
|
+
(this.maxDateTime && time > this.maxDateTime) ||
|
|
352
|
+
(endAt && time > this.getCriticalTime(endAt))
|
|
353
|
+
);
|
|
354
|
+
},
|
|
355
|
+
|
|
356
|
+
inDisabledDays(time) {
|
|
357
|
+
if (Array.isArray(this.disabledDays)) {
|
|
358
|
+
return this.disabledDays.some(v => this.getCriticalTime(v) === time);
|
|
359
|
+
}
|
|
360
|
+
if (typeof this.disabledDays === "function") {
|
|
361
|
+
return this.disabledDays(new Date(time));
|
|
362
|
+
}
|
|
363
|
+
return false;
|
|
364
|
+
},
|
|
365
|
+
|
|
366
|
+
isDisabledYear(year) {
|
|
367
|
+
const time = new Date(year, 0).getTime();
|
|
368
|
+
const maxTime = new Date(year + 1, 0).getTime() - 1;
|
|
369
|
+
return (
|
|
370
|
+
this.inBefore(maxTime) ||
|
|
371
|
+
this.inAfter(time) ||
|
|
372
|
+
(this.type === "year" && this.inDisabledDays(time))
|
|
373
|
+
);
|
|
374
|
+
},
|
|
375
|
+
|
|
376
|
+
isDisabledMonth(month) {
|
|
377
|
+
const time = new Date(this.calendarYear, month).getTime();
|
|
378
|
+
const maxTime = new Date(this.calendarYear, month + 1).getTime() - 1;
|
|
379
|
+
return (
|
|
380
|
+
this.inBefore(maxTime) ||
|
|
381
|
+
this.inAfter(time) ||
|
|
382
|
+
(this.type === "month" && this.inDisabledDays(time))
|
|
383
|
+
);
|
|
384
|
+
},
|
|
385
|
+
|
|
386
|
+
isDisabledDate(date) {
|
|
387
|
+
const time = new Date(date).getTime();
|
|
388
|
+
const maxTime = new Date(date).setHours(23, 59, 59, 999);
|
|
389
|
+
return (
|
|
390
|
+
this.inBefore(maxTime) ||
|
|
391
|
+
this.inAfter(time) ||
|
|
392
|
+
this.inDisabledDays(time)
|
|
393
|
+
);
|
|
394
|
+
},
|
|
395
|
+
|
|
396
|
+
isDisabledTime(date, startAt, endAt) {
|
|
397
|
+
const time = new Date(date).getTime();
|
|
398
|
+
return (
|
|
399
|
+
this.inBefore(time, startAt) ||
|
|
400
|
+
this.inAfter(time, endAt) ||
|
|
401
|
+
this.inDisabledDays(time)
|
|
402
|
+
);
|
|
403
|
+
},
|
|
404
|
+
|
|
405
405
|
selectDate(date) {
|
|
406
406
|
if (this.type === "datetime") {
|
|
407
407
|
let time = new Date(date);
|
|
408
408
|
if (isDateObject(this.value)) {
|
|
409
409
|
time.setHours(
|
|
410
|
-
this.value.getHours(),
|
|
410
|
+
this.value.getHours(),
|
|
411
411
|
this.value.getMinutes(),
|
|
412
412
|
this.value.getSeconds(),
|
|
413
413
|
);
|
|
@@ -415,20 +415,20 @@ export default {
|
|
|
415
415
|
time = this.normalizeTimeByPrecision(time);
|
|
416
416
|
if (this.isDisabledTime(time)) {
|
|
417
417
|
time.setHours(0, 0, 0, 0);
|
|
418
|
-
if (this.notBefore &&
|
|
419
|
-
time.getTime() < new Date(this.notBefore).getTime()) {
|
|
420
|
-
time = new Date(this.notBefore);
|
|
421
|
-
}
|
|
422
|
-
if (this.startAt &&
|
|
423
|
-
time.getTime() < new Date(this.startAt).getTime()) {
|
|
424
|
-
time = new Date(this.startAt);
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
this.selectTime(time);
|
|
428
|
-
this.showPanelTime();
|
|
429
|
-
return;
|
|
430
|
-
}
|
|
431
|
-
this.$emit("selectDate", date);
|
|
418
|
+
if (this.notBefore &&
|
|
419
|
+
time.getTime() < new Date(this.notBefore).getTime()) {
|
|
420
|
+
time = new Date(this.notBefore);
|
|
421
|
+
}
|
|
422
|
+
if (this.startAt &&
|
|
423
|
+
time.getTime() < new Date(this.startAt).getTime()) {
|
|
424
|
+
time = new Date(this.startAt);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
this.selectTime(time);
|
|
428
|
+
this.showPanelTime();
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
this.$emit("selectDate", date);
|
|
432
432
|
},
|
|
433
433
|
|
|
434
434
|
normalizeTimeByPrecision(time) {
|
|
@@ -442,422 +442,422 @@ export default {
|
|
|
442
442
|
|
|
443
443
|
return TIME_LOCAL;
|
|
444
444
|
},
|
|
445
|
-
|
|
446
|
-
selectYear({ year, isButtonClick }) {
|
|
447
|
-
this.changeCalendarYear(year);
|
|
448
|
-
if (this.type.toLowerCase() === "year") {
|
|
449
|
-
return this.selectDate(new Date(this.now));
|
|
450
|
-
}
|
|
451
|
-
this.showPanelMonth();
|
|
452
|
-
if (isButtonClick) {
|
|
453
|
-
this.setFocusToActivePanel();
|
|
454
|
-
}
|
|
455
|
-
},
|
|
456
|
-
|
|
457
|
-
selectMonth({ month, isButtonClick }) {
|
|
458
|
-
this.changeCalendarMonth(month);
|
|
459
|
-
if (this.type.toLowerCase() === "month") {
|
|
460
|
-
return this.selectDate(new Date(this.now));
|
|
461
|
-
}
|
|
462
|
-
this.showPanelDate();
|
|
463
|
-
if (isButtonClick) {
|
|
464
|
-
this.setFocusToActivePanel();
|
|
465
|
-
}
|
|
466
|
-
},
|
|
467
|
-
|
|
468
|
-
selectTime(time, statusClose = false) {
|
|
469
|
-
this.$emit("selectTime", time, statusClose);
|
|
470
|
-
},
|
|
471
|
-
|
|
472
|
-
changeCalendarYear(year) {
|
|
473
|
-
this.updateNow(new Date(year, this.calendarMonth));
|
|
474
|
-
},
|
|
475
|
-
|
|
476
|
-
changeCalendarMonth(month) {
|
|
477
|
-
this.updateNow(new Date(this.calendarYear, month));
|
|
478
|
-
},
|
|
479
|
-
|
|
480
|
-
getSibling() {
|
|
481
|
-
const PANELS = [
|
|
482
|
-
this.$parent.$refs.calendarPanelRef,
|
|
483
|
-
];
|
|
484
|
-
if (this.$parent.$refs.calendarPanel2Ref) {
|
|
485
|
-
PANELS.push(this.$parent.$refs.calendarPanel2Ref);
|
|
486
|
-
}
|
|
487
|
-
const calendars = PANELS.filter(
|
|
488
|
-
v => v.$options.name === this.$options.name,
|
|
489
|
-
);
|
|
490
|
-
const index = calendars.indexOf(this);
|
|
491
|
-
/* eslint-disable-next-line no-bitwise */
|
|
492
|
-
return calendars[index ^ 1];
|
|
493
|
-
},
|
|
494
|
-
|
|
495
|
-
handleIconMonth(flag) {
|
|
496
|
-
const month = this.calendarMonth;
|
|
497
|
-
this.changeCalendarMonth(month + flag);
|
|
498
|
-
this.$parent.$emit("changeCalendarMonth", {
|
|
499
|
-
month,
|
|
500
|
-
flag,
|
|
501
|
-
vm: this,
|
|
502
|
-
sibling: this.getSibling(),
|
|
503
|
-
});
|
|
504
|
-
},
|
|
505
|
-
|
|
506
|
-
handleIconYear(flag) {
|
|
507
|
-
if (this.panel === "YEAR") {
|
|
508
|
-
this.changePanelYears(flag);
|
|
509
|
-
} else {
|
|
510
|
-
const year = this.calendarYear;
|
|
511
|
-
this.changeCalendarYear(year + flag);
|
|
512
|
-
this.$parent.$emit("changeCalendarYear", {
|
|
513
|
-
year,
|
|
514
|
-
flag,
|
|
515
|
-
vm: this,
|
|
516
|
-
sibling: this.getSibling(),
|
|
517
|
-
});
|
|
518
|
-
}
|
|
519
|
-
},
|
|
520
|
-
|
|
521
|
-
handleBtnYear($event) {
|
|
522
|
-
$event.stopPropagation();
|
|
523
|
-
this.showPanelYear();
|
|
524
|
-
if (this.isWorkWithKeyboard) {
|
|
525
|
-
this.setFocusToActivePanel();
|
|
526
|
-
}
|
|
527
|
-
},
|
|
528
|
-
|
|
529
|
-
handleBtnMonth($event) {
|
|
530
|
-
$event.stopPropagation();
|
|
531
|
-
this.showPanelMonth();
|
|
532
|
-
if (this.isWorkWithKeyboard) {
|
|
533
|
-
this.setFocusToActivePanel();
|
|
534
|
-
}
|
|
535
|
-
},
|
|
536
|
-
|
|
537
|
-
handleTimeHeader($event) {
|
|
538
|
-
$event.stopPropagation();
|
|
539
|
-
if (this.type === "time") {
|
|
540
|
-
return;
|
|
541
|
-
}
|
|
542
|
-
this.showPanelDate();
|
|
543
|
-
if (this.isWorkWithKeyboard) {
|
|
544
|
-
this.setFocusToActivePanel();
|
|
545
|
-
}
|
|
546
|
-
},
|
|
547
|
-
|
|
548
|
-
changePanelYears(flag) {
|
|
549
|
-
this.firstYear = this.firstYear + flag * 10;
|
|
550
|
-
},
|
|
551
|
-
|
|
552
|
-
showPanelNone() {
|
|
553
|
-
this.panel = "NONE";
|
|
554
|
-
this.isFocusPanelChild = false;
|
|
555
|
-
this.destroyListenerForPressTabButton();
|
|
556
|
-
this.emitEventBusDestroyAllListenerForPressButtonsForPanels();
|
|
557
|
-
this.setWorkWithoutKeyboard();
|
|
558
|
-
},
|
|
559
|
-
|
|
560
|
-
showPanelTime() {
|
|
561
|
-
this.panel = "TIME";
|
|
562
|
-
},
|
|
563
|
-
|
|
564
|
-
showPanelDate() {
|
|
565
|
-
this.panel = "DATE";
|
|
566
|
-
},
|
|
567
|
-
|
|
568
|
-
showPanelYear() {
|
|
569
|
-
this.panel = "YEAR";
|
|
570
|
-
},
|
|
571
|
-
|
|
572
|
-
showPanelMonth() {
|
|
573
|
-
this.panel = "MONTH";
|
|
574
|
-
},
|
|
575
|
-
|
|
576
|
-
setFocusToActivePanelFromParent() {
|
|
577
|
-
this.setWorkWithKeyboard();
|
|
578
|
-
this.setFocusToActivePanel();
|
|
579
|
-
this.setListenerForPressTabButton();
|
|
580
|
-
},
|
|
581
|
-
|
|
582
|
-
setFocusToActivePanel() {
|
|
583
|
-
this.isFocusPanelChild = true;
|
|
584
|
-
this.setFocusToActiveElementInChild();
|
|
585
|
-
},
|
|
586
|
-
|
|
587
|
-
removeFocusFromActivePanel() {
|
|
588
|
-
if (this.isFocusPanelChild) {
|
|
589
|
-
this.isFocusPanelChild = false;
|
|
590
|
-
this.emitEventBusDestroyAllListenerForPressButtonsForPanels();
|
|
591
|
-
}
|
|
592
|
-
},
|
|
593
|
-
|
|
594
|
-
setFocusToActiveElementInChild() {
|
|
595
|
-
if (this.panel === "DATE") {
|
|
596
|
-
this.$refs?.panelDate?.setFocusToActiveDay();
|
|
597
|
-
} else if (this.panel === "TIME") {
|
|
598
|
-
this.$refs?.panelTime?.setFocusToActiveTime();
|
|
599
|
-
} else if (this.panel === "YEAR") {
|
|
600
|
-
this.$refs?.panelYear?.setFocusToActiveYear();
|
|
601
|
-
} else if (this.panel === "MONTH") {
|
|
602
|
-
this.$refs?.panelMonth?.setFocusToActiveMonth();
|
|
603
|
-
}
|
|
604
|
-
},
|
|
605
|
-
|
|
606
|
-
setListenerForPressTabButton() {
|
|
607
|
-
document.addEventListener("keydown", this.pressTabButton);
|
|
608
|
-
},
|
|
609
|
-
|
|
610
|
-
destroyListenerForPressTabButton() {
|
|
611
|
-
document.removeEventListener("keydown", this.pressTabButton);
|
|
612
|
-
},
|
|
613
|
-
|
|
614
|
-
pressTabButton($event) {
|
|
615
|
-
const KEY_CODE = $event.keyCode;
|
|
616
|
-
if (KEY_CODE === AKeysCode.tab) {
|
|
617
|
-
this.trapFocus($event);
|
|
618
|
-
this.stopCurrentEvent($event);
|
|
619
|
-
}
|
|
620
|
-
},
|
|
621
|
-
|
|
622
|
-
trapFocus(EVENT) {
|
|
623
|
-
const FOCUSABLE_ELEMENTS = this.$el.querySelectorAll(".pux_datepicker__calendar__tab");
|
|
624
|
-
if (FOCUSABLE_ELEMENTS.length <= 1) {
|
|
625
|
-
return;
|
|
626
|
-
}
|
|
627
|
-
let isFocused = false;
|
|
628
|
-
let isFocusedPanel = false;
|
|
629
|
-
forEach(FOCUSABLE_ELEMENTS, (element, elementIndex) => {
|
|
630
|
-
if (document.activeElement === element) {
|
|
631
|
-
if (EVENT.shiftKey) {
|
|
632
|
-
if (elementIndex === 0) {
|
|
633
|
-
FOCUSABLE_ELEMENTS[FOCUSABLE_ELEMENTS.length - 1].focus();
|
|
634
|
-
isFocusedPanel = true;
|
|
635
|
-
} else {
|
|
636
|
-
FOCUSABLE_ELEMENTS[elementIndex - 1].focus();
|
|
637
|
-
}
|
|
638
|
-
} else {
|
|
639
|
-
if (elementIndex === FOCUSABLE_ELEMENTS.length - 1) {
|
|
640
|
-
FOCUSABLE_ELEMENTS[0].focus();
|
|
641
|
-
} else {
|
|
642
|
-
FOCUSABLE_ELEMENTS[elementIndex + 1].focus();
|
|
643
|
-
}
|
|
644
|
-
if (elementIndex === FOCUSABLE_ELEMENTS.length - 2) {
|
|
645
|
-
isFocusedPanel = true;
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
isFocused = true;
|
|
649
|
-
return false;
|
|
650
|
-
}
|
|
651
|
-
});
|
|
652
|
-
if (!isFocused) {
|
|
653
|
-
if (EVENT.shiftKey) {
|
|
654
|
-
FOCUSABLE_ELEMENTS[FOCUSABLE_ELEMENTS.length - 2].focus();
|
|
655
|
-
} else {
|
|
656
|
-
FOCUSABLE_ELEMENTS[0].focus();
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
if (isFocusedPanel) {
|
|
660
|
-
this.setFocusToActivePanel();
|
|
661
|
-
} else {
|
|
662
|
-
this.removeFocusFromActivePanel();
|
|
663
|
-
}
|
|
664
|
-
},
|
|
665
|
-
|
|
666
|
-
setWorkWithKeyboard() {
|
|
667
|
-
this.isWorkWithKeyboard = true;
|
|
668
|
-
},
|
|
669
|
-
|
|
670
|
-
setWorkWithoutKeyboard() {
|
|
671
|
-
this.isWorkWithKeyboard = false;
|
|
672
|
-
},
|
|
673
|
-
|
|
674
|
-
setListenerForPressEscapeButton() {
|
|
675
|
-
document.addEventListener("keydown", this.pressEscapeButton);
|
|
676
|
-
},
|
|
677
|
-
|
|
678
|
-
destroyListenerForPressEscapeButton() {
|
|
679
|
-
document.removeEventListener("keydown", this.pressEscapeButton);
|
|
680
|
-
},
|
|
681
|
-
|
|
682
|
-
pressEscapeButton($event) {
|
|
683
|
-
const KEY_CODE = $event.keyCode;
|
|
684
|
-
if (KEY_CODE === AKeysCode.escape) {
|
|
685
|
-
this.$emit("closePopup", true);
|
|
686
|
-
}
|
|
687
|
-
},
|
|
688
|
-
},
|
|
689
|
-
render() {
|
|
690
|
-
return h("div", {
|
|
691
|
-
class: ["pux_datepicker__calendar", `pux_datepicker__calendar_${ this.panel.toLowerCase() }`],
|
|
692
|
-
role: "region",
|
|
693
|
-
"aria-labelledby": this.idForHeaderParent,
|
|
694
|
-
onClick: $event => $event.stopPropagation(),
|
|
695
|
-
}, [
|
|
696
|
-
h("div", {
|
|
697
|
-
id: this.idForHeaderParent,
|
|
698
|
-
class: "a_sr_only",
|
|
699
|
-
role: "header",
|
|
700
|
-
}, [
|
|
701
|
-
h("div", {
|
|
702
|
-
id: this.idForHeader,
|
|
703
|
-
"aria-live": "polite",
|
|
704
|
-
}, [
|
|
705
|
-
this.panel === "DATE" && h("span", null, this.months[this.calendarMonth]),
|
|
706
|
-
(this.panel === "DATE" || this.panel === "MONTH") && h("span", null, this.calendarYear),
|
|
707
|
-
this.panel === "YEAR" && h("span", null, this.yearHeader),
|
|
708
|
-
this.panel === "TIME" && h("span", null, this.timeHeader),
|
|
709
|
-
]),
|
|
710
|
-
h("div", null, this.suffixForHeader),
|
|
711
|
-
]),
|
|
712
|
-
h("div", {
|
|
713
|
-
class: "pux_datepicker__calendar__header",
|
|
714
|
-
}, [
|
|
715
|
-
h("div", null, [
|
|
716
|
-
this.panel !== "TIME" && h("button", {
|
|
717
|
-
class: "pux_datepicker__icon_last_year pux_datepicker__calendar__tab",
|
|
718
|
-
type: "button",
|
|
719
|
-
ariaLabel: this.ariaLabelForButtonLastYear,
|
|
720
|
-
innerHTML: "«",
|
|
721
|
-
onClick: $event => {
|
|
722
|
-
$event.stopPropagation();
|
|
723
|
-
this.handleIconYear(-1);
|
|
724
|
-
},
|
|
725
|
-
}),
|
|
726
|
-
this.panel === "DATE" && h("button", {
|
|
727
|
-
class: "pux_datepicker__icon_last_month pux_datepicker__calendar__tab",
|
|
728
|
-
type: "button",
|
|
729
|
-
ariaLabel: this.ariaLabelForButtonLastMonth,
|
|
730
|
-
innerHTML: "‹",
|
|
731
|
-
onClick: $event => {
|
|
732
|
-
$event.stopPropagation();
|
|
733
|
-
this.handleIconMonth(-1);
|
|
734
|
-
},
|
|
735
|
-
}),
|
|
736
|
-
]),
|
|
737
|
-
h("div", null, [
|
|
738
|
-
this.panel === "DATE" && h("button", {
|
|
739
|
-
class: "pux_datepicker__current_month pux_datepicker__calendar__tab",
|
|
740
|
-
type: "button",
|
|
741
|
-
ariaLabel: this.ariaLabelForButtonCurrentMonth,
|
|
742
|
-
onClick: this.handleBtnMonth,
|
|
743
|
-
}, this.months[this.calendarMonth]),
|
|
744
|
-
(this.panel === "DATE" || this.panel === "MONTH") && h("button", {
|
|
745
|
-
class: "pux_datepicker__current_year pux_datepicker__calendar__tab",
|
|
746
|
-
type: "button",
|
|
747
|
-
ariaLabel: this.ariaLabelForButtonCurrentYear,
|
|
748
|
-
onClick: this.handleBtnYear,
|
|
749
|
-
}, this.calendarYear),
|
|
750
|
-
this.panel === "YEAR" && h("span", {
|
|
751
|
-
class: "pux_datepicker__current_year",
|
|
752
|
-
}, this.yearHeader),
|
|
753
|
-
this.panel === "TIME" && h("span", null, [
|
|
754
|
-
this.type === "time" ?
|
|
755
|
-
h("span", {
|
|
756
|
-
class: "pux_datepicker__time_header",
|
|
757
|
-
}, this.timeHeader) :
|
|
758
|
-
h("button", {
|
|
759
|
-
class: "pux_datepicker__time_header pux_datepicker__calendar__tab",
|
|
760
|
-
type: "button",
|
|
761
|
-
ariaLabel: this.ariaLabelForButtonToDays,
|
|
762
|
-
onClick: this.handleTimeHeader,
|
|
763
|
-
}, this.timeHeader),
|
|
764
|
-
]),
|
|
765
|
-
]),
|
|
766
|
-
h("div", null, [
|
|
767
|
-
this.panel === "DATE" && h("button", {
|
|
768
|
-
class: "pux_datepicker__icon_next_month pux_datepicker__calendar__tab",
|
|
769
|
-
type: "button",
|
|
770
|
-
ariaLabel: this.ariaLabelForButtonNextMonth,
|
|
771
|
-
innerHTML: "›",
|
|
772
|
-
onClick: $event => {
|
|
773
|
-
$event.stopPropagation();
|
|
774
|
-
this.handleIconMonth(1);
|
|
775
|
-
},
|
|
776
|
-
}),
|
|
777
|
-
this.panel !== "TIME" && h("button", {
|
|
778
|
-
class: "pux_datepicker__icon_next_year pux_datepicker__calendar__tab",
|
|
779
|
-
type: "button",
|
|
780
|
-
ariaLabel: this.ariaLabelForButtonNextYear,
|
|
781
|
-
innerHTML: "»",
|
|
782
|
-
onClick: $event => {
|
|
783
|
-
$event.stopPropagation();
|
|
784
|
-
this.handleIconYear(1);
|
|
785
|
-
},
|
|
786
|
-
}),
|
|
787
|
-
]),
|
|
788
|
-
]),
|
|
789
|
-
h("div", {
|
|
790
|
-
class: "pux_datepicker__calendar__content",
|
|
791
|
-
role: "application",
|
|
792
|
-
}, [
|
|
793
|
-
h(APanelDate, {
|
|
794
|
-
ref: "panelDate",
|
|
795
|
-
id: this.id,
|
|
796
|
-
calendarMonth: this.calendarMonth,
|
|
797
|
-
calendarYear: this.calendarYear,
|
|
798
|
-
class: {
|
|
799
|
-
pux_datepicker__panel_focus: this.isFocusPanelChild,
|
|
800
|
-
pux_datepicker__calendar__tab: this.panel === "DATE",
|
|
801
|
-
},
|
|
802
|
-
currentLanguage: this.currentLanguage,
|
|
803
|
-
dateFormat: this.dateFormat,
|
|
804
|
-
disabledDate: this.isDisabledDate,
|
|
805
|
-
endAt: this.endAt,
|
|
806
|
-
firstDayOfWeek: this.firstDayOfWeek,
|
|
807
|
-
startAt: this.startAt,
|
|
808
|
-
startDate: this.startDate,
|
|
809
|
-
style: this.panel !== "DATE" ? "display: none;" : "",
|
|
810
|
-
tabindex: 0,
|
|
811
|
-
value: this.value,
|
|
812
|
-
onSelect: this.selectDate,
|
|
813
|
-
onHandleIconMonth: this.handleIconMonth,
|
|
814
|
-
}),
|
|
815
|
-
h(APanelYear, {
|
|
816
|
-
ref: "panelYear",
|
|
817
|
-
id: this.id,
|
|
818
|
-
style: this.panel !== "YEAR" ? "display: none;" : "",
|
|
819
|
-
class: {
|
|
820
|
-
pux_datepicker__panel_focus: this.isFocusPanelChild,
|
|
821
|
-
pux_datepicker__calendar__tab: this.panel === "YEAR",
|
|
822
|
-
},
|
|
823
|
-
value: this.value,
|
|
824
|
-
disabledYear: this.isDisabledYear,
|
|
825
|
-
firstYear: this.firstYear,
|
|
826
|
-
onSelect: this.selectYear,
|
|
827
|
-
onHandleIconYear: this.handleIconYear,
|
|
828
|
-
}),
|
|
829
|
-
h(APanelMonth, {
|
|
830
|
-
ref: "panelMonth",
|
|
831
|
-
id: this.id,
|
|
832
|
-
style: this.panel !== "MONTH" ? "display: none;" : "",
|
|
833
|
-
class: {
|
|
834
|
-
pux_datepicker__panel_focus: this.isFocusPanelChild,
|
|
835
|
-
pux_datepicker__calendar__tab: this.panel === "MONTH",
|
|
836
|
-
},
|
|
837
|
-
value: this.value,
|
|
838
|
-
disabledMonth: this.isDisabledMonth,
|
|
839
|
-
calendarYear: this.calendarYear,
|
|
840
|
-
currentLanguage: this.currentLanguage,
|
|
841
|
-
onSelect: this.selectMonth,
|
|
842
|
-
onHandleIconYear: this.handleIconYear,
|
|
843
|
-
}),
|
|
844
|
-
h(APanelTime, {
|
|
845
|
-
ref: "panelTime",
|
|
846
|
-
id: this.id,
|
|
847
|
-
style: this.panel !== "TIME" ? "display: none;" : "",
|
|
848
|
-
class: {
|
|
849
|
-
pux_datepicker__panel_focus: this.isFocusPanelChild,
|
|
850
|
-
pux_datepicker__calendar__tab: this.panel === "TIME",
|
|
851
|
-
},
|
|
445
|
+
|
|
446
|
+
selectYear({ year, isButtonClick }) {
|
|
447
|
+
this.changeCalendarYear(year);
|
|
448
|
+
if (this.type.toLowerCase() === "year") {
|
|
449
|
+
return this.selectDate(new Date(this.now));
|
|
450
|
+
}
|
|
451
|
+
this.showPanelMonth();
|
|
452
|
+
if (isButtonClick) {
|
|
453
|
+
this.setFocusToActivePanel();
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
|
|
457
|
+
selectMonth({ month, isButtonClick }) {
|
|
458
|
+
this.changeCalendarMonth(month);
|
|
459
|
+
if (this.type.toLowerCase() === "month") {
|
|
460
|
+
return this.selectDate(new Date(this.now));
|
|
461
|
+
}
|
|
462
|
+
this.showPanelDate();
|
|
463
|
+
if (isButtonClick) {
|
|
464
|
+
this.setFocusToActivePanel();
|
|
465
|
+
}
|
|
466
|
+
},
|
|
467
|
+
|
|
468
|
+
selectTime(time, statusClose = false) {
|
|
469
|
+
this.$emit("selectTime", time, statusClose);
|
|
470
|
+
},
|
|
471
|
+
|
|
472
|
+
changeCalendarYear(year) {
|
|
473
|
+
this.updateNow(new Date(year, this.calendarMonth));
|
|
474
|
+
},
|
|
475
|
+
|
|
476
|
+
changeCalendarMonth(month) {
|
|
477
|
+
this.updateNow(new Date(this.calendarYear, month));
|
|
478
|
+
},
|
|
479
|
+
|
|
480
|
+
getSibling() {
|
|
481
|
+
const PANELS = [
|
|
482
|
+
this.$parent.$refs.calendarPanelRef,
|
|
483
|
+
];
|
|
484
|
+
if (this.$parent.$refs.calendarPanel2Ref) {
|
|
485
|
+
PANELS.push(this.$parent.$refs.calendarPanel2Ref);
|
|
486
|
+
}
|
|
487
|
+
const calendars = PANELS.filter(
|
|
488
|
+
v => v.$options.name === this.$options.name,
|
|
489
|
+
);
|
|
490
|
+
const index = calendars.indexOf(this);
|
|
491
|
+
/* eslint-disable-next-line no-bitwise */
|
|
492
|
+
return calendars[index ^ 1];
|
|
493
|
+
},
|
|
494
|
+
|
|
495
|
+
handleIconMonth(flag) {
|
|
496
|
+
const month = this.calendarMonth;
|
|
497
|
+
this.changeCalendarMonth(month + flag);
|
|
498
|
+
this.$parent.$emit("changeCalendarMonth", {
|
|
499
|
+
month,
|
|
500
|
+
flag,
|
|
501
|
+
vm: this,
|
|
502
|
+
sibling: this.getSibling(),
|
|
503
|
+
});
|
|
504
|
+
},
|
|
505
|
+
|
|
506
|
+
handleIconYear(flag) {
|
|
507
|
+
if (this.panel === "YEAR") {
|
|
508
|
+
this.changePanelYears(flag);
|
|
509
|
+
} else {
|
|
510
|
+
const year = this.calendarYear;
|
|
511
|
+
this.changeCalendarYear(year + flag);
|
|
512
|
+
this.$parent.$emit("changeCalendarYear", {
|
|
513
|
+
year,
|
|
514
|
+
flag,
|
|
515
|
+
vm: this,
|
|
516
|
+
sibling: this.getSibling(),
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
},
|
|
520
|
+
|
|
521
|
+
handleBtnYear($event) {
|
|
522
|
+
$event.stopPropagation();
|
|
523
|
+
this.showPanelYear();
|
|
524
|
+
if (this.isWorkWithKeyboard) {
|
|
525
|
+
this.setFocusToActivePanel();
|
|
526
|
+
}
|
|
527
|
+
},
|
|
528
|
+
|
|
529
|
+
handleBtnMonth($event) {
|
|
530
|
+
$event.stopPropagation();
|
|
531
|
+
this.showPanelMonth();
|
|
532
|
+
if (this.isWorkWithKeyboard) {
|
|
533
|
+
this.setFocusToActivePanel();
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
|
|
537
|
+
handleTimeHeader($event) {
|
|
538
|
+
$event.stopPropagation();
|
|
539
|
+
if (this.type === "time") {
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
this.showPanelDate();
|
|
543
|
+
if (this.isWorkWithKeyboard) {
|
|
544
|
+
this.setFocusToActivePanel();
|
|
545
|
+
}
|
|
546
|
+
},
|
|
547
|
+
|
|
548
|
+
changePanelYears(flag) {
|
|
549
|
+
this.firstYear = this.firstYear + flag * 10;
|
|
550
|
+
},
|
|
551
|
+
|
|
552
|
+
showPanelNone() {
|
|
553
|
+
this.panel = "NONE";
|
|
554
|
+
this.isFocusPanelChild = false;
|
|
555
|
+
this.destroyListenerForPressTabButton();
|
|
556
|
+
this.emitEventBusDestroyAllListenerForPressButtonsForPanels();
|
|
557
|
+
this.setWorkWithoutKeyboard();
|
|
558
|
+
},
|
|
559
|
+
|
|
560
|
+
showPanelTime() {
|
|
561
|
+
this.panel = "TIME";
|
|
562
|
+
},
|
|
563
|
+
|
|
564
|
+
showPanelDate() {
|
|
565
|
+
this.panel = "DATE";
|
|
566
|
+
},
|
|
567
|
+
|
|
568
|
+
showPanelYear() {
|
|
569
|
+
this.panel = "YEAR";
|
|
570
|
+
},
|
|
571
|
+
|
|
572
|
+
showPanelMonth() {
|
|
573
|
+
this.panel = "MONTH";
|
|
574
|
+
},
|
|
575
|
+
|
|
576
|
+
setFocusToActivePanelFromParent() {
|
|
577
|
+
this.setWorkWithKeyboard();
|
|
578
|
+
this.setFocusToActivePanel();
|
|
579
|
+
this.setListenerForPressTabButton();
|
|
580
|
+
},
|
|
581
|
+
|
|
582
|
+
setFocusToActivePanel() {
|
|
583
|
+
this.isFocusPanelChild = true;
|
|
584
|
+
this.setFocusToActiveElementInChild();
|
|
585
|
+
},
|
|
586
|
+
|
|
587
|
+
removeFocusFromActivePanel() {
|
|
588
|
+
if (this.isFocusPanelChild) {
|
|
589
|
+
this.isFocusPanelChild = false;
|
|
590
|
+
this.emitEventBusDestroyAllListenerForPressButtonsForPanels();
|
|
591
|
+
}
|
|
592
|
+
},
|
|
593
|
+
|
|
594
|
+
setFocusToActiveElementInChild() {
|
|
595
|
+
if (this.panel === "DATE") {
|
|
596
|
+
this.$refs?.panelDate?.setFocusToActiveDay();
|
|
597
|
+
} else if (this.panel === "TIME") {
|
|
598
|
+
this.$refs?.panelTime?.setFocusToActiveTime();
|
|
599
|
+
} else if (this.panel === "YEAR") {
|
|
600
|
+
this.$refs?.panelYear?.setFocusToActiveYear();
|
|
601
|
+
} else if (this.panel === "MONTH") {
|
|
602
|
+
this.$refs?.panelMonth?.setFocusToActiveMonth();
|
|
603
|
+
}
|
|
604
|
+
},
|
|
605
|
+
|
|
606
|
+
setListenerForPressTabButton() {
|
|
607
|
+
document.addEventListener("keydown", this.pressTabButton);
|
|
608
|
+
},
|
|
609
|
+
|
|
610
|
+
destroyListenerForPressTabButton() {
|
|
611
|
+
document.removeEventListener("keydown", this.pressTabButton);
|
|
612
|
+
},
|
|
613
|
+
|
|
614
|
+
pressTabButton($event) {
|
|
615
|
+
const KEY_CODE = $event.keyCode;
|
|
616
|
+
if (KEY_CODE === AKeysCode.tab) {
|
|
617
|
+
this.trapFocus($event);
|
|
618
|
+
this.stopCurrentEvent($event);
|
|
619
|
+
}
|
|
620
|
+
},
|
|
621
|
+
|
|
622
|
+
trapFocus(EVENT) {
|
|
623
|
+
const FOCUSABLE_ELEMENTS = this.$el.querySelectorAll(".pux_datepicker__calendar__tab");
|
|
624
|
+
if (FOCUSABLE_ELEMENTS.length <= 1) {
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
627
|
+
let isFocused = false;
|
|
628
|
+
let isFocusedPanel = false;
|
|
629
|
+
forEach(FOCUSABLE_ELEMENTS, (element, elementIndex) => {
|
|
630
|
+
if (document.activeElement === element) {
|
|
631
|
+
if (EVENT.shiftKey) {
|
|
632
|
+
if (elementIndex === 0) {
|
|
633
|
+
FOCUSABLE_ELEMENTS[FOCUSABLE_ELEMENTS.length - 1].focus();
|
|
634
|
+
isFocusedPanel = true;
|
|
635
|
+
} else {
|
|
636
|
+
FOCUSABLE_ELEMENTS[elementIndex - 1].focus();
|
|
637
|
+
}
|
|
638
|
+
} else {
|
|
639
|
+
if (elementIndex === FOCUSABLE_ELEMENTS.length - 1) {
|
|
640
|
+
FOCUSABLE_ELEMENTS[0].focus();
|
|
641
|
+
} else {
|
|
642
|
+
FOCUSABLE_ELEMENTS[elementIndex + 1].focus();
|
|
643
|
+
}
|
|
644
|
+
if (elementIndex === FOCUSABLE_ELEMENTS.length - 2) {
|
|
645
|
+
isFocusedPanel = true;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
isFocused = true;
|
|
649
|
+
return false;
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
if (!isFocused) {
|
|
653
|
+
if (EVENT.shiftKey) {
|
|
654
|
+
FOCUSABLE_ELEMENTS[FOCUSABLE_ELEMENTS.length - 2].focus();
|
|
655
|
+
} else {
|
|
656
|
+
FOCUSABLE_ELEMENTS[0].focus();
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
if (isFocusedPanel) {
|
|
660
|
+
this.setFocusToActivePanel();
|
|
661
|
+
} else {
|
|
662
|
+
this.removeFocusFromActivePanel();
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
|
|
666
|
+
setWorkWithKeyboard() {
|
|
667
|
+
this.isWorkWithKeyboard = true;
|
|
668
|
+
},
|
|
669
|
+
|
|
670
|
+
setWorkWithoutKeyboard() {
|
|
671
|
+
this.isWorkWithKeyboard = false;
|
|
672
|
+
},
|
|
673
|
+
|
|
674
|
+
setListenerForPressEscapeButton() {
|
|
675
|
+
document.addEventListener("keydown", this.pressEscapeButton);
|
|
676
|
+
},
|
|
677
|
+
|
|
678
|
+
destroyListenerForPressEscapeButton() {
|
|
679
|
+
document.removeEventListener("keydown", this.pressEscapeButton);
|
|
680
|
+
},
|
|
681
|
+
|
|
682
|
+
pressEscapeButton($event) {
|
|
683
|
+
const KEY_CODE = $event.keyCode;
|
|
684
|
+
if (KEY_CODE === AKeysCode.escape) {
|
|
685
|
+
this.$emit("closePopup", true);
|
|
686
|
+
}
|
|
687
|
+
},
|
|
688
|
+
},
|
|
689
|
+
render() {
|
|
690
|
+
return h("div", {
|
|
691
|
+
class: ["pux_datepicker__calendar", `pux_datepicker__calendar_${ this.panel.toLowerCase() }`],
|
|
692
|
+
role: "region",
|
|
693
|
+
"aria-labelledby": this.idForHeaderParent,
|
|
694
|
+
onClick: $event => $event.stopPropagation(),
|
|
695
|
+
}, [
|
|
696
|
+
h("div", {
|
|
697
|
+
id: this.idForHeaderParent,
|
|
698
|
+
class: "a_sr_only",
|
|
699
|
+
role: "header",
|
|
700
|
+
}, [
|
|
701
|
+
h("div", {
|
|
702
|
+
id: this.idForHeader,
|
|
703
|
+
"aria-live": "polite",
|
|
704
|
+
}, [
|
|
705
|
+
this.panel === "DATE" && h("span", null, this.months[this.calendarMonth]),
|
|
706
|
+
(this.panel === "DATE" || this.panel === "MONTH") && h("span", null, this.calendarYear),
|
|
707
|
+
this.panel === "YEAR" && h("span", null, this.yearHeader),
|
|
708
|
+
this.panel === "TIME" && h("span", null, this.timeHeader),
|
|
709
|
+
]),
|
|
710
|
+
h("div", null, this.suffixForHeader),
|
|
711
|
+
]),
|
|
712
|
+
h("div", {
|
|
713
|
+
class: "pux_datepicker__calendar__header",
|
|
714
|
+
}, [
|
|
715
|
+
h("div", null, [
|
|
716
|
+
this.panel !== "TIME" && h("button", {
|
|
717
|
+
class: "pux_datepicker__icon_last_year pux_datepicker__calendar__tab",
|
|
718
|
+
type: "button",
|
|
719
|
+
ariaLabel: this.ariaLabelForButtonLastYear,
|
|
720
|
+
innerHTML: "«",
|
|
721
|
+
onClick: $event => {
|
|
722
|
+
$event.stopPropagation();
|
|
723
|
+
this.handleIconYear(-1);
|
|
724
|
+
},
|
|
725
|
+
}),
|
|
726
|
+
this.panel === "DATE" && h("button", {
|
|
727
|
+
class: "pux_datepicker__icon_last_month pux_datepicker__calendar__tab",
|
|
728
|
+
type: "button",
|
|
729
|
+
ariaLabel: this.ariaLabelForButtonLastMonth,
|
|
730
|
+
innerHTML: "‹",
|
|
731
|
+
onClick: $event => {
|
|
732
|
+
$event.stopPropagation();
|
|
733
|
+
this.handleIconMonth(-1);
|
|
734
|
+
},
|
|
735
|
+
}),
|
|
736
|
+
]),
|
|
737
|
+
h("div", null, [
|
|
738
|
+
this.panel === "DATE" && h("button", {
|
|
739
|
+
class: "pux_datepicker__current_month pux_datepicker__calendar__tab",
|
|
740
|
+
type: "button",
|
|
741
|
+
ariaLabel: this.ariaLabelForButtonCurrentMonth,
|
|
742
|
+
onClick: this.handleBtnMonth,
|
|
743
|
+
}, this.months[this.calendarMonth]),
|
|
744
|
+
(this.panel === "DATE" || this.panel === "MONTH") && h("button", {
|
|
745
|
+
class: "pux_datepicker__current_year pux_datepicker__calendar__tab",
|
|
746
|
+
type: "button",
|
|
747
|
+
ariaLabel: this.ariaLabelForButtonCurrentYear,
|
|
748
|
+
onClick: this.handleBtnYear,
|
|
749
|
+
}, this.calendarYear),
|
|
750
|
+
this.panel === "YEAR" && h("span", {
|
|
751
|
+
class: "pux_datepicker__current_year",
|
|
752
|
+
}, this.yearHeader),
|
|
753
|
+
this.panel === "TIME" && h("span", null, [
|
|
754
|
+
this.type === "time" ?
|
|
755
|
+
h("span", {
|
|
756
|
+
class: "pux_datepicker__time_header",
|
|
757
|
+
}, this.timeHeader) :
|
|
758
|
+
h("button", {
|
|
759
|
+
class: "pux_datepicker__time_header pux_datepicker__calendar__tab",
|
|
760
|
+
type: "button",
|
|
761
|
+
ariaLabel: this.ariaLabelForButtonToDays,
|
|
762
|
+
onClick: this.handleTimeHeader,
|
|
763
|
+
}, this.timeHeader),
|
|
764
|
+
]),
|
|
765
|
+
]),
|
|
766
|
+
h("div", null, [
|
|
767
|
+
this.panel === "DATE" && h("button", {
|
|
768
|
+
class: "pux_datepicker__icon_next_month pux_datepicker__calendar__tab",
|
|
769
|
+
type: "button",
|
|
770
|
+
ariaLabel: this.ariaLabelForButtonNextMonth,
|
|
771
|
+
innerHTML: "›",
|
|
772
|
+
onClick: $event => {
|
|
773
|
+
$event.stopPropagation();
|
|
774
|
+
this.handleIconMonth(1);
|
|
775
|
+
},
|
|
776
|
+
}),
|
|
777
|
+
this.panel !== "TIME" && h("button", {
|
|
778
|
+
class: "pux_datepicker__icon_next_year pux_datepicker__calendar__tab",
|
|
779
|
+
type: "button",
|
|
780
|
+
ariaLabel: this.ariaLabelForButtonNextYear,
|
|
781
|
+
innerHTML: "»",
|
|
782
|
+
onClick: $event => {
|
|
783
|
+
$event.stopPropagation();
|
|
784
|
+
this.handleIconYear(1);
|
|
785
|
+
},
|
|
786
|
+
}),
|
|
787
|
+
]),
|
|
788
|
+
]),
|
|
789
|
+
h("div", {
|
|
790
|
+
class: "pux_datepicker__calendar__content",
|
|
791
|
+
role: "application",
|
|
792
|
+
}, [
|
|
793
|
+
h(APanelDate, {
|
|
794
|
+
ref: "panelDate",
|
|
795
|
+
id: this.id,
|
|
796
|
+
calendarMonth: this.calendarMonth,
|
|
797
|
+
calendarYear: this.calendarYear,
|
|
798
|
+
class: {
|
|
799
|
+
pux_datepicker__panel_focus: this.isFocusPanelChild,
|
|
800
|
+
pux_datepicker__calendar__tab: this.panel === "DATE",
|
|
801
|
+
},
|
|
802
|
+
currentLanguage: this.currentLanguage,
|
|
803
|
+
dateFormat: this.dateFormat,
|
|
804
|
+
disabledDate: this.isDisabledDate,
|
|
805
|
+
endAt: this.endAt,
|
|
806
|
+
firstDayOfWeek: this.firstDayOfWeek,
|
|
807
|
+
startAt: this.startAt,
|
|
808
|
+
startDate: this.startDate,
|
|
809
|
+
style: this.panel !== "DATE" ? "display: none;" : "",
|
|
810
|
+
tabindex: 0,
|
|
811
|
+
value: this.value,
|
|
812
|
+
onSelect: this.selectDate,
|
|
813
|
+
onHandleIconMonth: this.handleIconMonth,
|
|
814
|
+
}),
|
|
815
|
+
h(APanelYear, {
|
|
816
|
+
ref: "panelYear",
|
|
817
|
+
id: this.id,
|
|
818
|
+
style: this.panel !== "YEAR" ? "display: none;" : "",
|
|
819
|
+
class: {
|
|
820
|
+
pux_datepicker__panel_focus: this.isFocusPanelChild,
|
|
821
|
+
pux_datepicker__calendar__tab: this.panel === "YEAR",
|
|
822
|
+
},
|
|
823
|
+
value: this.value,
|
|
824
|
+
disabledYear: this.isDisabledYear,
|
|
825
|
+
firstYear: this.firstYear,
|
|
826
|
+
onSelect: this.selectYear,
|
|
827
|
+
onHandleIconYear: this.handleIconYear,
|
|
828
|
+
}),
|
|
829
|
+
h(APanelMonth, {
|
|
830
|
+
ref: "panelMonth",
|
|
831
|
+
id: this.id,
|
|
832
|
+
style: this.panel !== "MONTH" ? "display: none;" : "",
|
|
833
|
+
class: {
|
|
834
|
+
pux_datepicker__panel_focus: this.isFocusPanelChild,
|
|
835
|
+
pux_datepicker__calendar__tab: this.panel === "MONTH",
|
|
836
|
+
},
|
|
837
|
+
value: this.value,
|
|
838
|
+
disabledMonth: this.isDisabledMonth,
|
|
839
|
+
calendarYear: this.calendarYear,
|
|
840
|
+
currentLanguage: this.currentLanguage,
|
|
841
|
+
onSelect: this.selectMonth,
|
|
842
|
+
onHandleIconYear: this.handleIconYear,
|
|
843
|
+
}),
|
|
844
|
+
h(APanelTime, {
|
|
845
|
+
ref: "panelTime",
|
|
846
|
+
id: this.id,
|
|
847
|
+
style: this.panel !== "TIME" ? "display: none;" : "",
|
|
848
|
+
class: {
|
|
849
|
+
pux_datepicker__panel_focus: this.isFocusPanelChild,
|
|
850
|
+
pux_datepicker__calendar__tab: this.panel === "TIME",
|
|
851
|
+
},
|
|
852
852
|
minuteStep: this.minuteStep,
|
|
853
853
|
timePrecision: this.timePrecision,
|
|
854
854
|
value: this.value,
|
|
855
855
|
disabledTime: this.isDisabledTime,
|
|
856
856
|
timeType: this.timeType,
|
|
857
|
-
currentLanguage: this.currentLanguage,
|
|
858
|
-
onSelect: this.selectTime,
|
|
859
|
-
}),
|
|
860
|
-
]),
|
|
861
|
-
]);
|
|
862
|
-
},
|
|
863
|
-
};
|
|
857
|
+
currentLanguage: this.currentLanguage,
|
|
858
|
+
onSelect: this.selectTime,
|
|
859
|
+
}),
|
|
860
|
+
]),
|
|
861
|
+
]);
|
|
862
|
+
},
|
|
863
|
+
};
|