kdutify 0.16.9-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +70 -0
- package/dist/kdutify.css +12850 -0
- package/dist/kdutify.css.map +1 -0
- package/dist/kdutify.js +16285 -0
- package/dist/kdutify.js.map +1 -0
- package/dist/kdutify.min.css +7 -0
- package/dist/kdutify.min.css.map +1 -0
- package/dist/kdutify.min.js +6 -0
- package/es5/components/KAlert/KAlert.js +80 -0
- package/es5/components/KAlert/index.js +7 -0
- package/es5/components/KApp/KApp.js +67 -0
- package/es5/components/KApp/index.js +7 -0
- package/es5/components/KAvatar/KAvatar.js +31 -0
- package/es5/components/KAvatar/index.js +7 -0
- package/es5/components/KBadge/KBadge.js +59 -0
- package/es5/components/KBadge/index.js +7 -0
- package/es5/components/KBottomNav/KBottomNav.js +50 -0
- package/es5/components/KBottomNav/index.js +7 -0
- package/es5/components/KBottomSheet/KBottomSheet.js +36 -0
- package/es5/components/KBottomSheet/index.js +7 -0
- package/es5/components/KBreadcrumbs/KBreadcrumbs.js +36 -0
- package/es5/components/KBreadcrumbs/KBreadcrumbsItem.js +38 -0
- package/es5/components/KBreadcrumbs/index.js +11 -0
- package/es5/components/KBtn/KBtn.js +153 -0
- package/es5/components/KBtn/index.js +7 -0
- package/es5/components/KBtnToggle/KBtnToggle.js +92 -0
- package/es5/components/KBtnToggle/index.js +7 -0
- package/es5/components/KCard/KCard.js +63 -0
- package/es5/components/KCard/KCardMedia.js +41 -0
- package/es5/components/KCard/KCardTitle.js +21 -0
- package/es5/components/KCard/index.js +19 -0
- package/es5/components/KCarousel/KCarousel.js +178 -0
- package/es5/components/KCarousel/KCarouselItem.js +63 -0
- package/es5/components/KCarousel/index.js +11 -0
- package/es5/components/KCheckbox/KCheckbox.js +89 -0
- package/es5/components/KCheckbox/index.js +7 -0
- package/es5/components/KChip/KChip.js +81 -0
- package/es5/components/KChip/index.js +7 -0
- package/es5/components/KDataTable/KDataTable.js +347 -0
- package/es5/components/KDataTable/KEditDialog.js +108 -0
- package/es5/components/KDataTable/index.js +14 -0
- package/es5/components/KDataTable/mixins/body.js +103 -0
- package/es5/components/KDataTable/mixins/foot.js +118 -0
- package/es5/components/KDataTable/mixins/head.js +123 -0
- package/es5/components/KDataTable/mixins/progress.js +16 -0
- package/es5/components/KDatePicker/KDatePicker.js +416 -0
- package/es5/components/KDatePicker/index.js +7 -0
- package/es5/components/KDatePicker/mixins/date-header.js +68 -0
- package/es5/components/KDatePicker/mixins/date-table.js +101 -0
- package/es5/components/KDatePicker/mixins/date-title.js +64 -0
- package/es5/components/KDatePicker/mixins/date-years.js +53 -0
- package/es5/components/KDatePicker/mixins/month-table.js +91 -0
- package/es5/components/KDialog/KDialog.js +181 -0
- package/es5/components/KDialog/index.js +7 -0
- package/es5/components/KDivider/KDivider.js +29 -0
- package/es5/components/KDivider/index.js +7 -0
- package/es5/components/KExpansionPanel/KExpansionPanel.js +60 -0
- package/es5/components/KExpansionPanel/KExpansionPanelContent.js +114 -0
- package/es5/components/KExpansionPanel/index.js +9 -0
- package/es5/components/KFooter/KFooter.js +61 -0
- package/es5/components/KFooter/index.js +7 -0
- package/es5/components/KForm/KForm.js +203 -0
- package/es5/components/KForm/index.js +7 -0
- package/es5/components/KGrid/KContainer.js +5 -0
- package/es5/components/KGrid/KContent.js +33 -0
- package/es5/components/KGrid/KFlex.js +5 -0
- package/es5/components/KGrid/KLayout.js +5 -0
- package/es5/components/KGrid/grid.js +43 -0
- package/es5/components/KGrid/index.js +20 -0
- package/es5/components/KIcon/KIcon.js +93 -0
- package/es5/components/KIcon/index.js +7 -0
- package/es5/components/KList/KList.js +82 -0
- package/es5/components/KList/KListGroup.js +100 -0
- package/es5/components/KList/KListTile.js +65 -0
- package/es5/components/KList/KListTileAction.js +15 -0
- package/es5/components/KList/index.js +27 -0
- package/es5/components/KMenu/KMenu.js +178 -0
- package/es5/components/KMenu/index.js +7 -0
- package/es5/components/KMenu/mixins/menu-activator.js +59 -0
- package/es5/components/KMenu/mixins/menu-generators.js +88 -0
- package/es5/components/KMenu/mixins/menu-keyable.js +64 -0
- package/es5/components/KMenu/mixins/menu-position.js +64 -0
- package/es5/components/KNavigationDrawer/KNavigationDrawer.js +238 -0
- package/es5/components/KNavigationDrawer/index.js +7 -0
- package/es5/components/KPagination/KPagination.js +167 -0
- package/es5/components/KPagination/index.js +7 -0
- package/es5/components/KParallax/KParallax.js +98 -0
- package/es5/components/KParallax/index.js +7 -0
- package/es5/components/KProgressCircular/KProgressCircular.js +145 -0
- package/es5/components/KProgressCircular/index.js +7 -0
- package/es5/components/KProgressLinear/KProgressLinear.js +146 -0
- package/es5/components/KProgressLinear/index.js +7 -0
- package/es5/components/KRadioGroup/KRadio.js +148 -0
- package/es5/components/KRadioGroup/KRadioGroup.js +139 -0
- package/es5/components/KRadioGroup/index.js +11 -0
- package/es5/components/KSelect/KSelect.js +635 -0
- package/es5/components/KSelect/index.js +7 -0
- package/es5/components/KSelect/mixins/select-autocomplete.js +125 -0
- package/es5/components/KSelect/mixins/select-generators.js +298 -0
- package/es5/components/KSlider/KSlider.js +306 -0
- package/es5/components/KSlider/index.js +7 -0
- package/es5/components/KSnackbar/KSnackbar.js +106 -0
- package/es5/components/KSnackbar/index.js +7 -0
- package/es5/components/KSpeedDial/KSpeedDial.js +89 -0
- package/es5/components/KSpeedDial/index.js +7 -0
- package/es5/components/KStepper/KStepper.js +112 -0
- package/es5/components/KStepper/KStepperContent.js +134 -0
- package/es5/components/KStepper/KStepperStep.js +105 -0
- package/es5/components/KStepper/index.js +17 -0
- package/es5/components/KSubheader/KSubheader.js +29 -0
- package/es5/components/KSubheader/index.js +7 -0
- package/es5/components/KSwitch/KSwitch.js +55 -0
- package/es5/components/KSwitch/index.js +7 -0
- package/es5/components/KSystemBar/KSystemBar.js +54 -0
- package/es5/components/KSystemBar/index.js +7 -0
- package/es5/components/KTabs/KTabs.js +272 -0
- package/es5/components/KTabs/KTabsBar.js +205 -0
- package/es5/components/KTabs/KTabsContent.js +86 -0
- package/es5/components/KTabs/KTabsItem.js +103 -0
- package/es5/components/KTabs/KTabsItems.js +40 -0
- package/es5/components/KTabs/KTabsSlider.js +14 -0
- package/es5/components/KTabs/index.js +17 -0
- package/es5/components/KTextField/KTextField.js +275 -0
- package/es5/components/KTextField/index.js +7 -0
- package/es5/components/KTimePicker/KTimePicker.js +302 -0
- package/es5/components/KTimePicker/index.js +7 -0
- package/es5/components/KTimePicker/mixins/time-body.js +207 -0
- package/es5/components/KTimePicker/mixins/time-title.js +55 -0
- package/es5/components/KToolbar/KToolbar.js +193 -0
- package/es5/components/KToolbar/KToolbarSideIcon.js +29 -0
- package/es5/components/KToolbar/index.js +17 -0
- package/es5/components/KTooltip/KTooltip.js +156 -0
- package/es5/components/KTooltip/index.js +7 -0
- package/es5/components/Kdutify/index.js +50 -0
- package/es5/components/index.js +45 -0
- package/es5/components/transitions/expand-transition.js +36 -0
- package/es5/components/transitions/index.js +47 -0
- package/es5/components/transitions/row-expand-transition.js +38 -0
- package/es5/directives/click-outside.js +100 -0
- package/es5/directives/index.js +15 -0
- package/es5/directives/resize.js +30 -0
- package/es5/directives/ripple.js +144 -0
- package/es5/directives/scroll.js +32 -0
- package/es5/directives/touch.js +102 -0
- package/es5/index.js +30 -0
- package/es5/mixins/applicationable.js +9 -0
- package/es5/mixins/bootable.js +31 -0
- package/es5/mixins/button-group.js +82 -0
- package/es5/mixins/colorable.js +24 -0
- package/es5/mixins/contextualable.js +10 -0
- package/es5/mixins/delayable.js +57 -0
- package/es5/mixins/dependent.js +121 -0
- package/es5/mixins/detachable.js +41 -0
- package/es5/mixins/filterable.js +8 -0
- package/es5/mixins/input.js +219 -0
- package/es5/mixins/loadable.js +31 -0
- package/es5/mixins/maskable.js +181 -0
- package/es5/mixins/menuable.js +293 -0
- package/es5/mixins/overlayable.js +202 -0
- package/es5/mixins/picker.js +36 -0
- package/es5/mixins/positionable.js +10 -0
- package/es5/mixins/rippleable.js +21 -0
- package/es5/mixins/routable.js +66 -0
- package/es5/mixins/selectable.js +79 -0
- package/es5/mixins/stackable.js +70 -0
- package/es5/mixins/tab-focusable.js +7 -0
- package/es5/mixins/themeable.js +15 -0
- package/es5/mixins/toggleable.js +31 -0
- package/es5/mixins/transitionable.js +7 -0
- package/es5/mixins/translatable.js +62 -0
- package/es5/mixins/validatable.js +138 -0
- package/es5/util/breakpoint.js +128 -0
- package/es5/util/helpers.js +139 -0
- package/es5/util/load.js +15 -0
- package/es5/util/mask.js +159 -0
- package/es5/util/testing.js +160 -0
- package/es5/util/to-have-been-warned.js +117 -0
- package/es5/util/touchSupport.js +14 -0
- package/index.d.ts +8 -0
- package/package.json +134 -0
- package/src/components/KAlert/KAlert.js +77 -0
- package/src/components/KAlert/index.js +7 -0
- package/src/components/KApp/KApp.js +64 -0
- package/src/components/KApp/index.js +7 -0
- package/src/components/KAvatar/KAvatar.js +27 -0
- package/src/components/KAvatar/index.js +7 -0
- package/src/components/KBadge/KBadge.js +62 -0
- package/src/components/KBadge/index.js +7 -0
- package/src/components/KBottomNav/KBottomNav.js +50 -0
- package/src/components/KBottomNav/index.js +7 -0
- package/src/components/KBottomSheet/KBottomSheet.js +41 -0
- package/src/components/KBottomSheet/index.js +7 -0
- package/src/components/KBreadcrumbs/KBreadcrumbs.js +35 -0
- package/src/components/KBreadcrumbs/KBreadcrumbsItem.js +38 -0
- package/src/components/KBreadcrumbs/index.js +11 -0
- package/src/components/KBtn/KBtn.js +163 -0
- package/src/components/KBtn/index.js +7 -0
- package/src/components/KBtnToggle/KBtnToggle.js +92 -0
- package/src/components/KBtnToggle/index.js +7 -0
- package/src/components/KCard/KCard.js +61 -0
- package/src/components/KCard/KCardMedia.js +41 -0
- package/src/components/KCard/KCardTitle.js +17 -0
- package/src/components/KCard/index.js +19 -0
- package/src/components/KCarousel/KCarousel.js +174 -0
- package/src/components/KCarousel/KCarouselItem.js +65 -0
- package/src/components/KCarousel/index.js +11 -0
- package/src/components/KCheckbox/KCheckbox.js +92 -0
- package/src/components/KCheckbox/index.js +7 -0
- package/src/components/KChip/KChip.js +83 -0
- package/src/components/KChip/index.js +7 -0
- package/src/components/KDataTable/KDataTable.js +346 -0
- package/src/components/KDataTable/KEditDialog.js +110 -0
- package/src/components/KDataTable/index.js +16 -0
- package/src/components/KDataTable/mixins/body.js +98 -0
- package/src/components/KDataTable/mixins/foot.js +128 -0
- package/src/components/KDataTable/mixins/head.js +119 -0
- package/src/components/KDataTable/mixins/progress.js +16 -0
- package/src/components/KDatePicker/KDatePicker.js +382 -0
- package/src/components/KDatePicker/index.js +7 -0
- package/src/components/KDatePicker/mixins/date-header.js +74 -0
- package/src/components/KDatePicker/mixins/date-table.js +95 -0
- package/src/components/KDatePicker/mixins/date-title.js +76 -0
- package/src/components/KDatePicker/mixins/date-years.js +42 -0
- package/src/components/KDatePicker/mixins/month-table.js +82 -0
- package/src/components/KDialog/KDialog.js +184 -0
- package/src/components/KDialog/index.js +7 -0
- package/src/components/KDivider/KDivider.js +25 -0
- package/src/components/KDivider/index.js +7 -0
- package/src/components/KExpansionPanel/KExpansionPanel.js +55 -0
- package/src/components/KExpansionPanel/KExpansionPanelContent.js +112 -0
- package/src/components/KExpansionPanel/index.js +9 -0
- package/src/components/KFooter/KFooter.js +67 -0
- package/src/components/KFooter/index.js +7 -0
- package/src/components/KForm/KForm.js +117 -0
- package/src/components/KForm/index.js +7 -0
- package/src/components/KGrid/KContainer.js +5 -0
- package/src/components/KGrid/KContent.js +29 -0
- package/src/components/KGrid/KFlex.js +5 -0
- package/src/components/KGrid/KLayout.js +5 -0
- package/src/components/KGrid/grid.js +40 -0
- package/src/components/KGrid/index.js +27 -0
- package/src/components/KIcon/KIcon.js +87 -0
- package/src/components/KIcon/index.js +7 -0
- package/src/components/KList/KList.js +75 -0
- package/src/components/KList/KListGroup.js +95 -0
- package/src/components/KList/KListTile.js +62 -0
- package/src/components/KList/KListTileAction.js +12 -0
- package/src/components/KList/index.js +27 -0
- package/src/components/KMenu/KMenu.js +207 -0
- package/src/components/KMenu/index.js +7 -0
- package/src/components/KMenu/mixins/menu-activator.js +51 -0
- package/src/components/KMenu/mixins/menu-generators.js +84 -0
- package/src/components/KMenu/mixins/menu-keyable.js +68 -0
- package/src/components/KMenu/mixins/menu-position.js +72 -0
- package/src/components/KNavigationDrawer/KNavigationDrawer.js +267 -0
- package/src/components/KNavigationDrawer/index.js +7 -0
- package/src/components/KPagination/KPagination.js +168 -0
- package/src/components/KPagination/index.js +7 -0
- package/src/components/KParallax/KParallax.js +99 -0
- package/src/components/KParallax/index.js +7 -0
- package/src/components/KProgressCircular/KProgressCircular.js +160 -0
- package/src/components/KProgressCircular/index.js +7 -0
- package/src/components/KProgressLinear/KProgressLinear.js +157 -0
- package/src/components/KProgressLinear/index.js +7 -0
- package/src/components/KRadioGroup/KRadio.js +153 -0
- package/src/components/KRadioGroup/KRadioGroup.js +118 -0
- package/src/components/KRadioGroup/index.js +11 -0
- package/src/components/KSelect/KSelect.js +641 -0
- package/src/components/KSelect/index.js +7 -0
- package/src/components/KSelect/mixins/select-autocomplete.js +125 -0
- package/src/components/KSelect/mixins/select-generators.js +300 -0
- package/src/components/KSlider/KSlider.js +311 -0
- package/src/components/KSlider/index.js +7 -0
- package/src/components/KSnackbar/KSnackbar.js +97 -0
- package/src/components/KSnackbar/index.js +7 -0
- package/src/components/KSpeedDial/KSpeedDial.js +80 -0
- package/src/components/KSpeedDial/index.js +7 -0
- package/src/components/KStepper/KStepper.js +95 -0
- package/src/components/KStepper/KStepperContent.js +138 -0
- package/src/components/KStepper/KStepperStep.js +100 -0
- package/src/components/KStepper/index.js +17 -0
- package/src/components/KSubheader/KSubheader.js +25 -0
- package/src/components/KSubheader/index.js +7 -0
- package/src/components/KSwitch/KSwitch.js +58 -0
- package/src/components/KSwitch/index.js +7 -0
- package/src/components/KSystemBar/KSystemBar.js +54 -0
- package/src/components/KSystemBar/index.js +7 -0
- package/src/components/KTabs/KTabs.js +240 -0
- package/src/components/KTabs/KTabsBar.js +202 -0
- package/src/components/KTabs/KTabsContent.js +90 -0
- package/src/components/KTabs/KTabsItem.js +99 -0
- package/src/components/KTabs/KTabsItems.js +40 -0
- package/src/components/KTabs/KTabsSlider.js +14 -0
- package/src/components/KTabs/index.js +17 -0
- package/src/components/KTextField/KTextField.js +246 -0
- package/src/components/KTextField/index.js +7 -0
- package/src/components/KTimePicker/KTimePicker.js +282 -0
- package/src/components/KTimePicker/index.js +7 -0
- package/src/components/KTimePicker/mixins/time-body.js +208 -0
- package/src/components/KTimePicker/mixins/time-title.js +51 -0
- package/src/components/KToolbar/KToolbar.js +206 -0
- package/src/components/KToolbar/KToolbarSideIcon.js +26 -0
- package/src/components/KToolbar/index.js +19 -0
- package/src/components/KTooltip/KTooltip.js +161 -0
- package/src/components/KTooltip/index.js +7 -0
- package/src/components/Kdutify/index.js +48 -0
- package/src/components/index.js +45 -0
- package/src/components/transitions/expand-transition.js +34 -0
- package/src/components/transitions/index.js +50 -0
- package/src/components/transitions/row-expand-transition.js +38 -0
- package/src/directives/click-outside.js +72 -0
- package/src/directives/index.js +21 -0
- package/src/directives/resize.js +30 -0
- package/src/directives/ripple.js +120 -0
- package/src/directives/scroll.js +31 -0
- package/src/directives/touch.js +90 -0
- package/src/index.js +30 -0
- package/src/mixins/applicationable.js +9 -0
- package/src/mixins/bootable.js +31 -0
- package/src/mixins/button-group.js +77 -0
- package/src/mixins/colorable.js +20 -0
- package/src/mixins/contextualable.js +10 -0
- package/src/mixins/delayable.js +54 -0
- package/src/mixins/dependent.js +55 -0
- package/src/mixins/detachable.js +44 -0
- package/src/mixins/filterable.js +8 -0
- package/src/mixins/input.js +220 -0
- package/src/mixins/loadable.js +33 -0
- package/src/mixins/maskable.js +117 -0
- package/src/mixins/menuable.js +299 -0
- package/src/mixins/overlayable.js +180 -0
- package/src/mixins/picker.js +35 -0
- package/src/mixins/positionable.js +10 -0
- package/src/mixins/rippleable.js +21 -0
- package/src/mixins/routable.js +66 -0
- package/src/mixins/selectable.js +84 -0
- package/src/mixins/stackable.js +44 -0
- package/src/mixins/tab-focusable.js +7 -0
- package/src/mixins/themeable.js +15 -0
- package/src/mixins/toggleable.js +28 -0
- package/src/mixins/transitionable.js +7 -0
- package/src/mixins/translatable.js +67 -0
- package/src/mixins/validatable.js +124 -0
- package/src/stylus/app.styl +6 -0
- package/src/stylus/bootstrap.styl +1 -0
- package/src/stylus/components/_alerts.styl +44 -0
- package/src/stylus/components/_app.styl +21 -0
- package/src/stylus/components/_avatars.styl +22 -0
- package/src/stylus/components/_badges.styl +49 -0
- package/src/stylus/components/_bottom-navs.styl +86 -0
- package/src/stylus/components/_bottom-sheets.styl +18 -0
- package/src/stylus/components/_breadcrumbs.styl +46 -0
- package/src/stylus/components/_button-toggle.styl +55 -0
- package/src/stylus/components/_buttons.styl +339 -0
- package/src/stylus/components/_cards.styl +85 -0
- package/src/stylus/components/_carousel.styl +76 -0
- package/src/stylus/components/_chips.styl +102 -0
- package/src/stylus/components/_content.styl +6 -0
- package/src/stylus/components/_data-table.styl +113 -0
- package/src/stylus/components/_date-picker.styl +214 -0
- package/src/stylus/components/_dialogs.styl +63 -0
- package/src/stylus/components/_dividers.styl +19 -0
- package/src/stylus/components/_expansion-panel.styl +85 -0
- package/src/stylus/components/_footer.styl +40 -0
- package/src/stylus/components/_grid.styl +171 -0
- package/src/stylus/components/_icons.styl +32 -0
- package/src/stylus/components/_input-groups.styl +310 -0
- package/src/stylus/components/_lists.styl +263 -0
- package/src/stylus/components/_menus.styl +87 -0
- package/src/stylus/components/_navigation-drawer.styl +150 -0
- package/src/stylus/components/_overlay.styl +42 -0
- package/src/stylus/components/_pagination.styl +95 -0
- package/src/stylus/components/_parallax.styl +35 -0
- package/src/stylus/components/_pickers.styl +66 -0
- package/src/stylus/components/_progress-circular.styl +58 -0
- package/src/stylus/components/_progress-linear.styl +104 -0
- package/src/stylus/components/_radio-group.styl +23 -0
- package/src/stylus/components/_ripples.styl +31 -0
- package/src/stylus/components/_select.styl +153 -0
- package/src/stylus/components/_selection-controls.styl +122 -0
- package/src/stylus/components/_sliders.styl +234 -0
- package/src/stylus/components/_small-dialog.styl +37 -0
- package/src/stylus/components/_snackbars.styl +110 -0
- package/src/stylus/components/_speed-dial.styl +78 -0
- package/src/stylus/components/_steppers.styl +216 -0
- package/src/stylus/components/_subheaders.styl +18 -0
- package/src/stylus/components/_switch.styl +89 -0
- package/src/stylus/components/_system-bars.styl +49 -0
- package/src/stylus/components/_tables.styl +103 -0
- package/src/stylus/components/_tabs.styl +159 -0
- package/src/stylus/components/_text-fields.styl +243 -0
- package/src/stylus/components/_time-picker.styl +199 -0
- package/src/stylus/components/_toolbar.styl +148 -0
- package/src/stylus/components/_tooltips.styl +25 -0
- package/src/stylus/elements/_blockquote.styl +5 -0
- package/src/stylus/elements/_code.styl +20 -0
- package/src/stylus/elements/_global.styl +31 -0
- package/src/stylus/elements/_headings.styl +17 -0
- package/src/stylus/elements/_lists.styl +2 -0
- package/src/stylus/elements/_typography.styl +54 -0
- package/src/stylus/generic/_bootstrap.styl +49 -0
- package/src/stylus/generic/_reset.styl +332 -0
- package/src/stylus/generic/_transitions.styl +116 -0
- package/src/stylus/main.styl +2 -0
- package/src/stylus/settings/_colors.styl +339 -0
- package/src/stylus/settings/_elevations.styl +111 -0
- package/src/stylus/settings/_theme.styl +201 -0
- package/src/stylus/settings/_variables.styl +396 -0
- package/src/stylus/theme.styl +24 -0
- package/src/stylus/tools/_animations.styl +9 -0
- package/src/stylus/tools/_colors.styl +17 -0
- package/src/stylus/tools/_elevations.styl +7 -0
- package/src/stylus/trumps/_display.styl +14 -0
- package/src/stylus/trumps/_helpers.styl +5 -0
- package/src/stylus/trumps/_spacing.styl +37 -0
- package/src/stylus/trumps/_text.styl +13 -0
- package/src/util/breakpoint.js +134 -0
- package/src/util/helpers.d.ts +21 -0
- package/src/util/helpers.js +125 -0
- package/src/util/load.js +13 -0
- package/src/util/mask.js +138 -0
- package/src/util/testing.js +154 -0
- package/src/util/to-have-been-warned.js +68 -0
- package/src/util/touchSupport.js +12 -0
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
require('../../stylus/components/_pickers.styl')
|
|
2
|
+
require('../../stylus/components/_date-picker.styl')
|
|
3
|
+
|
|
4
|
+
import { createRange } from '../../util/helpers'
|
|
5
|
+
|
|
6
|
+
import Picker from '../../mixins/picker'
|
|
7
|
+
import DateYears from './mixins/date-years'
|
|
8
|
+
import DateTitle from './mixins/date-title'
|
|
9
|
+
import DateHeader from './mixins/date-header'
|
|
10
|
+
import DateTable from './mixins/date-table'
|
|
11
|
+
import MonthTable from './mixins/month-table'
|
|
12
|
+
import KBtn from '../KBtn'
|
|
13
|
+
import KCard from '../KCard'
|
|
14
|
+
import KIcon from '../KIcon'
|
|
15
|
+
|
|
16
|
+
import Touch from '../../directives/touch'
|
|
17
|
+
|
|
18
|
+
const createDefaultDateFormat = type => date => {
|
|
19
|
+
const pad = n => n < 10 ? `0${n}` : `${n}`
|
|
20
|
+
const isoString = `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`
|
|
21
|
+
return isoString.substr(0, { date: 10, month: 7, year: 4 }[type])
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
name: 'k-date-picker',
|
|
26
|
+
|
|
27
|
+
components: {
|
|
28
|
+
KBtn,
|
|
29
|
+
KCard,
|
|
30
|
+
KIcon
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
mixins: [Picker, DateYears, DateTitle, DateHeader, DateTable, MonthTable],
|
|
34
|
+
|
|
35
|
+
directives: { Touch },
|
|
36
|
+
|
|
37
|
+
data () {
|
|
38
|
+
return {
|
|
39
|
+
tableDate: new Date(),
|
|
40
|
+
originalDate: this.value,
|
|
41
|
+
currentDay: null,
|
|
42
|
+
currentMonth: null,
|
|
43
|
+
currentYear: null,
|
|
44
|
+
isReversing: false,
|
|
45
|
+
narrowDays: [],
|
|
46
|
+
activePicker: this.type.toUpperCase()
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
props: {
|
|
51
|
+
locale: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: 'en-us'
|
|
54
|
+
},
|
|
55
|
+
type: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: 'date',
|
|
58
|
+
validator: type => ['date', 'month'/*, 'year'*/].includes(type)
|
|
59
|
+
},
|
|
60
|
+
dateFormat: {
|
|
61
|
+
type: Function,
|
|
62
|
+
default: null
|
|
63
|
+
},
|
|
64
|
+
titleDateFormat: {
|
|
65
|
+
type: [Object, Function],
|
|
66
|
+
default: null
|
|
67
|
+
},
|
|
68
|
+
headerDateFormat: {
|
|
69
|
+
type: [Object, Function],
|
|
70
|
+
default: () => ({ month: 'long', year: 'numeric' })
|
|
71
|
+
},
|
|
72
|
+
monthFormat: {
|
|
73
|
+
type: [Object, Function],
|
|
74
|
+
default: () => ({ month: 'short' })
|
|
75
|
+
},
|
|
76
|
+
formattedValue: {
|
|
77
|
+
required: false
|
|
78
|
+
},
|
|
79
|
+
allowedDates: {
|
|
80
|
+
type: [Array, Object, Function],
|
|
81
|
+
default: () => (null)
|
|
82
|
+
},
|
|
83
|
+
firstDayOfWeek: {
|
|
84
|
+
type: [String, Number],
|
|
85
|
+
default: 0
|
|
86
|
+
},
|
|
87
|
+
yearIcon: String
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
computed: {
|
|
91
|
+
timeZone () {
|
|
92
|
+
try {
|
|
93
|
+
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
94
|
+
new Date('2000-01-15').toLocaleDateString('en', {
|
|
95
|
+
day: 'numeric',
|
|
96
|
+
timeZone
|
|
97
|
+
})
|
|
98
|
+
return timeZone
|
|
99
|
+
} catch (e) {
|
|
100
|
+
return 'UTC'
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
supportsLocaleFormat () {
|
|
104
|
+
return ('toLocaleDateString' in Date.prototype) &&
|
|
105
|
+
new Date('2000-01-15').toLocaleDateString('en', {
|
|
106
|
+
day: 'numeric',
|
|
107
|
+
timeZone: 'UTC'
|
|
108
|
+
}) === '15'
|
|
109
|
+
},
|
|
110
|
+
firstAllowedDate () {
|
|
111
|
+
const date = new Date()
|
|
112
|
+
|
|
113
|
+
if (this.type === 'month') {
|
|
114
|
+
date.setDate(1)
|
|
115
|
+
date.setHours(1)
|
|
116
|
+
|
|
117
|
+
if (this.allowedDates) {
|
|
118
|
+
const valid = new Date(date)
|
|
119
|
+
for (let month = 0; month < 12; month++) {
|
|
120
|
+
valid.setMonth(month)
|
|
121
|
+
if (this.isAllowed(valid)) {
|
|
122
|
+
return valid
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
} else if (this.type === 'date') {
|
|
127
|
+
date.setHours(1)
|
|
128
|
+
const month = date.getMonth()
|
|
129
|
+
|
|
130
|
+
if (this.allowedDates) {
|
|
131
|
+
const valid = new Date(date)
|
|
132
|
+
for (let i = 0; i < 31; i++) {
|
|
133
|
+
if (date.getMonth() === month && this.isAllowed(valid)) return valid
|
|
134
|
+
valid.setDate(i)
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return date
|
|
140
|
+
},
|
|
141
|
+
inputDate: {
|
|
142
|
+
get () {
|
|
143
|
+
const date = this.makeDate(this.value)
|
|
144
|
+
return date == null ? this.firstAllowedDate : date
|
|
145
|
+
},
|
|
146
|
+
set (value) {
|
|
147
|
+
const date = this.makeDate(value)
|
|
148
|
+
const pickerDateFormat = createDefaultDateFormat(this.type)
|
|
149
|
+
this.$emit('input', date == null ? this.originalDate : pickerDateFormat(date))
|
|
150
|
+
this.$emit('update:formattedValue', (this.dateFormat || pickerDateFormat)(date == null ? (this.makeDate(this.originalDate) || this.firstAllowedDate) : date))
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
day () {
|
|
154
|
+
return this.inputDate.getDate()
|
|
155
|
+
},
|
|
156
|
+
month () {
|
|
157
|
+
return this.inputDate.getMonth()
|
|
158
|
+
},
|
|
159
|
+
year () {
|
|
160
|
+
return this.inputDate.getFullYear()
|
|
161
|
+
},
|
|
162
|
+
tableMonth () {
|
|
163
|
+
return this.tableDate.getMonth()
|
|
164
|
+
},
|
|
165
|
+
tableYear () {
|
|
166
|
+
return this.tableDate.getFullYear()
|
|
167
|
+
},
|
|
168
|
+
computedTransition () {
|
|
169
|
+
return this.isReversing ? 'tab-reverse-transition' : 'tab-transition'
|
|
170
|
+
},
|
|
171
|
+
titleText () {
|
|
172
|
+
const date = this.normalizeDate(this.year, this.month, this.day)
|
|
173
|
+
|
|
174
|
+
const defaultTitleDateFormat = this.type === 'year' ? {
|
|
175
|
+
year: 'numeric'
|
|
176
|
+
} : (this.type === 'month' ? {
|
|
177
|
+
month: 'long'
|
|
178
|
+
} : {
|
|
179
|
+
weekday: 'short',
|
|
180
|
+
month: 'short',
|
|
181
|
+
day: 'numeric'
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
let titleText
|
|
185
|
+
if (typeof this.titleDateFormat === 'function') {
|
|
186
|
+
titleText = this.titleDateFormat(date)
|
|
187
|
+
} else if (this.supportsLocaleFormat) {
|
|
188
|
+
titleText = date.toLocaleDateString(this.locale, Object.assign(this.titleDateFormat || defaultTitleDateFormat, {
|
|
189
|
+
timeZone: this.timeZone
|
|
190
|
+
}))
|
|
191
|
+
} else if ('toLocaleDateString' in Date.prototype) {
|
|
192
|
+
titleText = createDefaultDateFormat(this.type)(date)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (this.landscape) {
|
|
196
|
+
if (titleText.indexOf(',') > -1) titleText = titleText.replace(',', ',<br>')
|
|
197
|
+
else if (titleText.indexOf(' ') > -1) titleText = titleText.replace(' ', '<br>')
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return titleText
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
watch: {
|
|
205
|
+
activePicker (val, prev) {
|
|
206
|
+
if (val !== 'YEAR') return
|
|
207
|
+
|
|
208
|
+
// That's a quirk, setting timeout stopped working after fixing #1649
|
|
209
|
+
// It worked but for timeouts significantly longer than the transition duration
|
|
210
|
+
const interval = setInterval(() => {
|
|
211
|
+
if (this.$refs.years) {
|
|
212
|
+
this.$refs.years.scrollTop = this.$refs.years.scrollHeight / 2 - 125
|
|
213
|
+
clearInterval(interval)
|
|
214
|
+
}
|
|
215
|
+
}, 100)
|
|
216
|
+
},
|
|
217
|
+
tableDate (val, prev) {
|
|
218
|
+
this.isReversing = val < prev
|
|
219
|
+
},
|
|
220
|
+
value (val) {
|
|
221
|
+
if (val) this.tableDate = this.inputDate
|
|
222
|
+
},
|
|
223
|
+
type (val) {
|
|
224
|
+
if (val === 'month' && this.activePicker === 'DATE') {
|
|
225
|
+
this.activePicker = 'MONTH'
|
|
226
|
+
} else if (val === 'year') {
|
|
227
|
+
this.activePicker = 'YEAR'
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
firstDayOfWeek () {
|
|
231
|
+
this.getWeekDays()
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
methods: {
|
|
236
|
+
save () {
|
|
237
|
+
if (this.originalDate) {
|
|
238
|
+
this.originalDate = this.value
|
|
239
|
+
} else {
|
|
240
|
+
this.originalDate = this.inputDate
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (this.$parent && this.$parent.isActive) this.$parent.isActive = false
|
|
244
|
+
},
|
|
245
|
+
cancel () {
|
|
246
|
+
this.inputDate = this.originalDate
|
|
247
|
+
if (this.$parent && this.$parent.isActive) this.$parent.isActive = false
|
|
248
|
+
},
|
|
249
|
+
getWeekDays () {
|
|
250
|
+
const first = parseInt(this.firstDayOfWeek, 10)
|
|
251
|
+
if (this.supportsLocaleFormat) {
|
|
252
|
+
const date = this.normalizeDate(2000, 1, 7)
|
|
253
|
+
const day = date.getDate() - date.getDay() + first
|
|
254
|
+
const format = { weekday: 'narrow' }
|
|
255
|
+
this.narrowDays = createRange(7).map(i => this.normalizeDate(2000, 1, day + i).toLocaleDateString(this.locale, format))
|
|
256
|
+
} else {
|
|
257
|
+
this.narrowDays = createRange(7).map(i => ['S', 'M', 'T', 'W', 'T', 'F', 'S'][(i + first) % 7])
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
isAllowed (date) {
|
|
261
|
+
if (!this.allowedDates) return true
|
|
262
|
+
|
|
263
|
+
if (Array.isArray(this.allowedDates)) {
|
|
264
|
+
const format = createDefaultDateFormat(this.activePicker === 'MONTH' ? 'month' : 'date')
|
|
265
|
+
date = format(this.makeDate(date))
|
|
266
|
+
return !!this.allowedDates.find(allowedDate => {
|
|
267
|
+
allowedDate = this.makeDate(allowedDate)
|
|
268
|
+
return allowedDate && format(allowedDate) === date
|
|
269
|
+
})
|
|
270
|
+
} else if (this.allowedDates instanceof Function) {
|
|
271
|
+
return this.allowedDates(date)
|
|
272
|
+
} else if (this.allowedDates instanceof Object) {
|
|
273
|
+
const format = createDefaultDateFormat(this.activePicker === 'MONTH' ? 'month' : 'date')
|
|
274
|
+
const min = format(this.makeDate(this.allowedDates.min))
|
|
275
|
+
const max = format(this.makeDate(this.allowedDates.max))
|
|
276
|
+
date = format(date)
|
|
277
|
+
return (!min || min <= date) && (!max || max >= date)
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
return true
|
|
281
|
+
},
|
|
282
|
+
genTableTouch (touchCallback) {
|
|
283
|
+
return {
|
|
284
|
+
name: 'touch',
|
|
285
|
+
value: {
|
|
286
|
+
left: e => (e.offsetX < -15) && touchCallback(1),
|
|
287
|
+
right: e => (e.offsetX > 15) && touchCallback(-1)
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
genTable (tableChildren, touchCallback) {
|
|
292
|
+
const wheel = this.activePicker === 'MONTH' ? this.monthWheelScroll : this.dateWheelScroll
|
|
293
|
+
const options = {
|
|
294
|
+
staticClass: 'picker--date__table',
|
|
295
|
+
'class': {
|
|
296
|
+
'picker--month__table': this.activePicker === 'MONTH'
|
|
297
|
+
},
|
|
298
|
+
on: this.scrollable ? { wheel } : undefined,
|
|
299
|
+
directives: [this.genTableTouch(touchCallback)]
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
const table = this.$createElement('table', {
|
|
303
|
+
key: this.activePicker === 'MONTH' ? this.tableYear : this.tableMonth
|
|
304
|
+
}, tableChildren)
|
|
305
|
+
|
|
306
|
+
return this.$createElement('div', options, [
|
|
307
|
+
this.$createElement('transition', {
|
|
308
|
+
props: { name: this.computedTransition }
|
|
309
|
+
}, [table])
|
|
310
|
+
])
|
|
311
|
+
},
|
|
312
|
+
genPickerBody (h) {
|
|
313
|
+
const pickerBodyChildren = []
|
|
314
|
+
if (this.activePicker === 'DATE') {
|
|
315
|
+
pickerBodyChildren.push(h('div', { staticClass: 'picker--date__header' }, [this.genSelector()]))
|
|
316
|
+
pickerBodyChildren.push(this.genTable([
|
|
317
|
+
this.dateGenTHead(),
|
|
318
|
+
this.dateGenTBody()
|
|
319
|
+
], value => this.tableDate = this.normalizeDate(this.tableYear, this.tableMonth + value)))
|
|
320
|
+
} else if (this.activePicker === 'MONTH') {
|
|
321
|
+
pickerBodyChildren.push(h('div', { staticClass: 'picker--date__header' }, [this.genSelector()]))
|
|
322
|
+
pickerBodyChildren.push(this.genTable([
|
|
323
|
+
this.monthGenTBody()
|
|
324
|
+
], value => this.tableDate = this.normalizeDate(this.tableYear + value)))
|
|
325
|
+
} else if (this.activePicker === 'YEAR') {
|
|
326
|
+
pickerBodyChildren.push(this.genYears())
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
return pickerBodyChildren
|
|
330
|
+
},
|
|
331
|
+
makeDate (val) {
|
|
332
|
+
if (val == null) return val
|
|
333
|
+
if (val instanceof Date) return val
|
|
334
|
+
if (!isNaN(val)) return new Date(val)
|
|
335
|
+
const [year, month, date] = val.trim().split(' ')[0].split('-')
|
|
336
|
+
return this.normalizeDate(year, month ? (month - 1) : 0, date ? (date * 1) : 1)
|
|
337
|
+
},
|
|
338
|
+
normalizeDate (year, month = 0, date = 1) {
|
|
339
|
+
return new Date(year, month, date, 1 /* Workaround for #1409 */)
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
|
|
343
|
+
created () {
|
|
344
|
+
this.getWeekDays()
|
|
345
|
+
this.tableDate = this.inputDate
|
|
346
|
+
},
|
|
347
|
+
|
|
348
|
+
mounted () {
|
|
349
|
+
const date = new Date()
|
|
350
|
+
this.currentDay = date.getDate()
|
|
351
|
+
this.currentMonth = date.getMonth()
|
|
352
|
+
this.currentYear = date.getFullYear()
|
|
353
|
+
},
|
|
354
|
+
|
|
355
|
+
render (h) {
|
|
356
|
+
const children = []
|
|
357
|
+
|
|
358
|
+
!this.noTitle && children.push(this.genTitle(this.titleText))
|
|
359
|
+
|
|
360
|
+
children.push(h('transition', {
|
|
361
|
+
props: {
|
|
362
|
+
origin: 'center center',
|
|
363
|
+
mode: 'out-in',
|
|
364
|
+
name: 'scale-transition'
|
|
365
|
+
}
|
|
366
|
+
}, [h('div', {
|
|
367
|
+
staticClass: 'picker__body',
|
|
368
|
+
key: this.activePicker
|
|
369
|
+
}, this.genPickerBody(h))]))
|
|
370
|
+
|
|
371
|
+
this.$scopedSlots.default && children.push(this.genSlot())
|
|
372
|
+
|
|
373
|
+
return h('k-card', {
|
|
374
|
+
staticClass: 'picker picker--date',
|
|
375
|
+
'class': {
|
|
376
|
+
'picker--landscape': this.landscape,
|
|
377
|
+
...this.themeClasses
|
|
378
|
+
}
|
|
379
|
+
}, children)
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
methods: {
|
|
3
|
+
genBtn (change, children) {
|
|
4
|
+
return this.$createElement('k-btn', {
|
|
5
|
+
props: {
|
|
6
|
+
dark: this.dark,
|
|
7
|
+
icon: true
|
|
8
|
+
},
|
|
9
|
+
nativeOn: {
|
|
10
|
+
click: e => {
|
|
11
|
+
e.stopPropagation()
|
|
12
|
+
if (this.activePicker === 'DATE') {
|
|
13
|
+
this.tableDate = this.normalizeDate(this.tableYear, change)
|
|
14
|
+
} else if (this.activePicker === 'MONTH') {
|
|
15
|
+
this.tableDate = this.normalizeDate(change, this.tableMonth)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}, children)
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
genHeader (keyValue, selectorText) {
|
|
23
|
+
const header = this.$createElement('strong', {
|
|
24
|
+
key: keyValue,
|
|
25
|
+
on: {
|
|
26
|
+
click: () => this.activePicker = this.activePicker === 'DATE' ? 'MONTH' : 'YEAR'
|
|
27
|
+
}
|
|
28
|
+
}, selectorText)
|
|
29
|
+
|
|
30
|
+
const transition = this.$createElement('transition', {
|
|
31
|
+
props: { name: this.computedTransition }
|
|
32
|
+
}, [header])
|
|
33
|
+
|
|
34
|
+
return this.$createElement('div', {
|
|
35
|
+
'class': 'picker--date__header-selector-date'
|
|
36
|
+
}, [transition])
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
genSelector () {
|
|
40
|
+
const keyValue = this.activePicker === 'DATE' ? this.tableMonth : this.tableYear
|
|
41
|
+
const selectorDate = this.normalizeDate(this.tableYear, this.tableMonth)
|
|
42
|
+
|
|
43
|
+
let selectorText = ''
|
|
44
|
+
if (typeof this.headerDateFormat === 'function' && this.activePicker === 'DATE') {
|
|
45
|
+
selectorText = this.headerDateFormat(selectorDate, this.activePicker)
|
|
46
|
+
} else if (this.supportsLocaleFormat) {
|
|
47
|
+
const format = this.activePicker === 'DATE'
|
|
48
|
+
? this.headerDateFormat
|
|
49
|
+
: { year: 'numeric' }
|
|
50
|
+
selectorText = selectorDate.toLocaleDateString(this.locale, Object.assign(format, {
|
|
51
|
+
timeZone: this.timeZone
|
|
52
|
+
}))
|
|
53
|
+
} else if (this.activePicker === 'DATE') {
|
|
54
|
+
selectorText = selectorDate.getFullYear() + '/'
|
|
55
|
+
if (selectorDate.getMonth() < 9) selectorText += '0'
|
|
56
|
+
selectorText += (1 + selectorDate.getMonth())
|
|
57
|
+
} else if (this.activePicker === 'MONTH') {
|
|
58
|
+
selectorText = selectorDate.getFullYear()
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return this.$createElement('div', {
|
|
62
|
+
'class': 'picker--date__header-selector'
|
|
63
|
+
}, [
|
|
64
|
+
this.genBtn(keyValue - 1, [
|
|
65
|
+
this.$createElement('k-icon', 'chevron_left')
|
|
66
|
+
]),
|
|
67
|
+
this.genHeader(keyValue, selectorText),
|
|
68
|
+
this.genBtn(keyValue + 1, [
|
|
69
|
+
this.$createElement('k-icon', 'chevron_right')
|
|
70
|
+
])
|
|
71
|
+
])
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
methods: {
|
|
3
|
+
dateWheelScroll (e) {
|
|
4
|
+
e.preventDefault()
|
|
5
|
+
|
|
6
|
+
let month = this.tableMonth
|
|
7
|
+
|
|
8
|
+
if (e.deltaY < 0) month++
|
|
9
|
+
else month--
|
|
10
|
+
|
|
11
|
+
this.tableDate = this.normalizeDate(this.tableYear, month)
|
|
12
|
+
},
|
|
13
|
+
dateGenTHead () {
|
|
14
|
+
const days = this.narrowDays.map(day => this.$createElement('th', day))
|
|
15
|
+
return this.$createElement('thead', this.dateGenTR(days))
|
|
16
|
+
},
|
|
17
|
+
dateClick (day) {
|
|
18
|
+
this.inputDate = this.normalizeDate(this.tableYear, this.tableMonth, day)
|
|
19
|
+
this.$nextTick(() => (this.autosave && this.save()))
|
|
20
|
+
},
|
|
21
|
+
dateGenButtonText (date, day) {
|
|
22
|
+
return this.supportsLocaleFormat
|
|
23
|
+
? date.toLocaleDateString(this.locale, {
|
|
24
|
+
day: 'numeric',
|
|
25
|
+
timeZone: this.timeZone
|
|
26
|
+
})
|
|
27
|
+
: day
|
|
28
|
+
},
|
|
29
|
+
dateGenTD (day) {
|
|
30
|
+
const date = this.normalizeDate(this.tableYear, this.tableMonth, day)
|
|
31
|
+
const buttonText = this.dateGenButtonText(date, day)
|
|
32
|
+
const button = this.$createElement('button', {
|
|
33
|
+
staticClass: 'btn btn--date-picker btn--floating btn--small btn--flat',
|
|
34
|
+
'class': {
|
|
35
|
+
'btn--active': this.dateIsActive(day),
|
|
36
|
+
'btn--outline': this.dateIsCurrent(day) && !this.dateIsActive(day),
|
|
37
|
+
'btn--disabled': !this.isAllowed(date)
|
|
38
|
+
},
|
|
39
|
+
attrs: {
|
|
40
|
+
type: 'button'
|
|
41
|
+
},
|
|
42
|
+
domProps: {
|
|
43
|
+
innerHTML: `<span class="btn__content">${buttonText}</span>`
|
|
44
|
+
},
|
|
45
|
+
on: {
|
|
46
|
+
click: () => this.dateClick(day)
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
return this.$createElement('td', [button])
|
|
51
|
+
},
|
|
52
|
+
dateGenTBody () {
|
|
53
|
+
const children = []
|
|
54
|
+
const daysInMonth = this.normalizeDate(this.tableYear, this.tableMonth + 1, 0).getDate()
|
|
55
|
+
let rows = []
|
|
56
|
+
const day = (this.normalizeDate(this.tableYear, this.tableMonth).getDay() - parseInt(this.firstDayOfWeek) + 7) % 7
|
|
57
|
+
|
|
58
|
+
for (let i = 0; i < day; i++) {
|
|
59
|
+
rows.push(this.$createElement('td'))
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
for (let i = 1; i <= daysInMonth; i++) {
|
|
63
|
+
rows.push(this.dateGenTD(i))
|
|
64
|
+
|
|
65
|
+
if (rows.length % 7 === 0) {
|
|
66
|
+
children.push(this.dateGenTR(rows))
|
|
67
|
+
rows = []
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (rows.length) {
|
|
72
|
+
children.push(this.dateGenTR(rows))
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
children.length < 6 && children.push(this.dateGenTR([
|
|
76
|
+
this.$createElement('td', { domProps: { innerHTML: ' ' } })
|
|
77
|
+
]))
|
|
78
|
+
|
|
79
|
+
return this.$createElement('tbody', children)
|
|
80
|
+
},
|
|
81
|
+
dateGenTR (children = [], data = {}) {
|
|
82
|
+
return [this.$createElement('tr', data, children)]
|
|
83
|
+
},
|
|
84
|
+
dateIsActive (i) {
|
|
85
|
+
return this.tableYear === this.year &&
|
|
86
|
+
this.tableMonth === this.month &&
|
|
87
|
+
this.day === i
|
|
88
|
+
},
|
|
89
|
+
dateIsCurrent (i) {
|
|
90
|
+
return this.currentYear === this.tableYear &&
|
|
91
|
+
this.currentMonth === this.tableMonth &&
|
|
92
|
+
this.currentDay === i
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
|
|
2
|
+
export default {
|
|
3
|
+
methods: {
|
|
4
|
+
genYearIcon () {
|
|
5
|
+
return this.yearIcon
|
|
6
|
+
? this.$createElement('k-icon', {
|
|
7
|
+
props: {
|
|
8
|
+
dark: true
|
|
9
|
+
}
|
|
10
|
+
}, this.yearIcon)
|
|
11
|
+
: null
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
getYearBtn () {
|
|
15
|
+
const titleDate = this.normalizeDate(this.year, this.month, this.day)
|
|
16
|
+
return this.$createElement('div', {
|
|
17
|
+
'class': {
|
|
18
|
+
'picker--date__title-year': true,
|
|
19
|
+
'active': this.activePicker === 'YEAR'
|
|
20
|
+
},
|
|
21
|
+
on: {
|
|
22
|
+
click: e => {
|
|
23
|
+
e.stopPropagation()
|
|
24
|
+
this.activePicker = 'YEAR'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}, [
|
|
28
|
+
this.supportsLocaleFormat
|
|
29
|
+
? titleDate.toLocaleDateString(this.locale, {
|
|
30
|
+
year: 'numeric',
|
|
31
|
+
timeZone: this.timeZone
|
|
32
|
+
})
|
|
33
|
+
: this.year,
|
|
34
|
+
this.genYearIcon()
|
|
35
|
+
])
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
genTitleText (title) {
|
|
39
|
+
return this.$createElement('transition', {
|
|
40
|
+
props: {
|
|
41
|
+
name: 'slide-y-reverse-transition',
|
|
42
|
+
mode: 'out-in'
|
|
43
|
+
}
|
|
44
|
+
}, [
|
|
45
|
+
this.$createElement('div', {
|
|
46
|
+
domProps: { innerHTML: title },
|
|
47
|
+
key: title
|
|
48
|
+
})
|
|
49
|
+
])
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
genTitleDate (title) {
|
|
53
|
+
return this.$createElement('div', {
|
|
54
|
+
staticClass: 'picker--date__title-date',
|
|
55
|
+
'class': {
|
|
56
|
+
'active': this.activePicker === this.type.toUpperCase()
|
|
57
|
+
},
|
|
58
|
+
on: {
|
|
59
|
+
click: e => {
|
|
60
|
+
e.stopPropagation()
|
|
61
|
+
this.activePicker = this.type.toUpperCase()
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}, [this.genTitleText(title)])
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
genTitle (title) {
|
|
68
|
+
return this.$createElement('div', {
|
|
69
|
+
'class': 'picker__title'
|
|
70
|
+
}, [
|
|
71
|
+
this.getYearBtn(),
|
|
72
|
+
this.genTitleDate(title)
|
|
73
|
+
])
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
methods: {
|
|
3
|
+
genYears () {
|
|
4
|
+
return this.$createElement('ul', {
|
|
5
|
+
staticClass: 'picker--date__years',
|
|
6
|
+
key: 'year',
|
|
7
|
+
ref: 'years'
|
|
8
|
+
}, this.genYearItems())
|
|
9
|
+
},
|
|
10
|
+
yearClick (year) {
|
|
11
|
+
this.inputDate = this.normalizeDate(year, this.tableMonth, this.day)
|
|
12
|
+
|
|
13
|
+
if (this.type === 'year') {
|
|
14
|
+
this.$nextTick(() => (this.autosave && this.save()))
|
|
15
|
+
} else {
|
|
16
|
+
this.activePicker = 'MONTH'
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
genYearItems () {
|
|
20
|
+
const children = []
|
|
21
|
+
for (let year = this.year + 100, length = this.year - 100; year > length; year--) {
|
|
22
|
+
const date = this.normalizeDate(year, this.month, this.day)
|
|
23
|
+
const buttonText = this.supportsLocaleFormat
|
|
24
|
+
? date.toLocaleDateString(this.locale, {
|
|
25
|
+
year: 'numeric',
|
|
26
|
+
timeZone: this.timeZone
|
|
27
|
+
})
|
|
28
|
+
: year
|
|
29
|
+
|
|
30
|
+
children.push(this.$createElement('li', {
|
|
31
|
+
'class': {
|
|
32
|
+
active: this.year === year
|
|
33
|
+
},
|
|
34
|
+
on: {
|
|
35
|
+
click: () => this.yearClick(year)
|
|
36
|
+
}
|
|
37
|
+
}, buttonText))
|
|
38
|
+
}
|
|
39
|
+
return children
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|