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,123 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
methods: {
|
|
5
|
+
genTHead: function genTHead() {
|
|
6
|
+
var _this = this;
|
|
7
|
+
|
|
8
|
+
if (this.hideHeaders) return; // Exit Early since no headers are needed.
|
|
9
|
+
|
|
10
|
+
var children = [];
|
|
11
|
+
|
|
12
|
+
if (this.$scopedSlots.headers) {
|
|
13
|
+
var row = this.$scopedSlots.headers({
|
|
14
|
+
headers: this.headers,
|
|
15
|
+
indeterminate: this.indeterminate,
|
|
16
|
+
all: this.all
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
children = this.needsTR(row) ? this.genTR(row) : row;
|
|
20
|
+
} else {
|
|
21
|
+
var _row = this.headers.map(function (o) {
|
|
22
|
+
return _this.genHeader(o);
|
|
23
|
+
});
|
|
24
|
+
var checkbox = this.$createElement('k-checkbox', {
|
|
25
|
+
props: {
|
|
26
|
+
dark: this.dark,
|
|
27
|
+
light: this.light,
|
|
28
|
+
color: this.selectAll === true ? '' : this.selectAll,
|
|
29
|
+
hideDetails: true,
|
|
30
|
+
inputValue: this.all,
|
|
31
|
+
indeterminate: this.indeterminate
|
|
32
|
+
},
|
|
33
|
+
on: { change: this.toggle }
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
this.hasSelectAll && _row.unshift(this.$createElement('th', [checkbox]));
|
|
37
|
+
|
|
38
|
+
children = this.genTR(_row);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return this.$createElement('thead', [children]);
|
|
42
|
+
},
|
|
43
|
+
genHeader: function genHeader(header) {
|
|
44
|
+
var array = [this.$scopedSlots.headerCell ? this.$scopedSlots.headerCell({ header: header }) : header[this.headerText]];
|
|
45
|
+
|
|
46
|
+
return this.$createElement.apply(this, ['th'].concat(_toConsumableArray(this.genHeaderData(header, array))));
|
|
47
|
+
},
|
|
48
|
+
genHeaderData: function genHeaderData(header, children) {
|
|
49
|
+
var classes = ['column'];
|
|
50
|
+
var data = {
|
|
51
|
+
attrs: {
|
|
52
|
+
role: 'columnheader',
|
|
53
|
+
scope: 'col',
|
|
54
|
+
'aria-label': header[this.headerText] || '',
|
|
55
|
+
'aria-sort': 'none'
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
if ('sortable' in header && header.sortable || !('sortable' in header)) {
|
|
60
|
+
this.genHeaderSortingData(header, children, data, classes);
|
|
61
|
+
} else {
|
|
62
|
+
data.attrs['aria-label'] += ': Not sorted.'; // TODO: Localization
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
classes.push('text-xs-' + (header.align || 'right'));
|
|
66
|
+
if (Array.isArray(header.class)) {
|
|
67
|
+
classes.push.apply(classes, _toConsumableArray(header.class));
|
|
68
|
+
} else if (header.class) {
|
|
69
|
+
classes.push(header.class);
|
|
70
|
+
}
|
|
71
|
+
data.class = classes;
|
|
72
|
+
|
|
73
|
+
return [data, children];
|
|
74
|
+
},
|
|
75
|
+
genHeaderSortingData: function genHeaderSortingData(header, children, data, classes) {
|
|
76
|
+
var _this2 = this;
|
|
77
|
+
|
|
78
|
+
if (!('value' in header)) {
|
|
79
|
+
console.warn('Data table headers must have a value property that corresponds to a value in the k-model array');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
data.attrs.tabIndex = 0;
|
|
83
|
+
data.on = {
|
|
84
|
+
click: function click() {
|
|
85
|
+
_this2.expanded = [];
|
|
86
|
+
_this2.sort(header.value);
|
|
87
|
+
},
|
|
88
|
+
keydown: function keydown(e) {
|
|
89
|
+
// check for space
|
|
90
|
+
if (e.keyCode === 32) {
|
|
91
|
+
e.preventDefault();
|
|
92
|
+
_this2.sort(header.value);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
classes.push('sortable');
|
|
98
|
+
var icon = this.$createElement('k-icon', { attrs: { 'aria-hidden': true } }, 'arrow_upward');
|
|
99
|
+
if (header.align && header.align === 'left') {
|
|
100
|
+
children.push(icon);
|
|
101
|
+
} else {
|
|
102
|
+
children.unshift(icon);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
var pagination = this.computedPagination;
|
|
106
|
+
var beingSorted = pagination.sortBy === header.value;
|
|
107
|
+
if (beingSorted) {
|
|
108
|
+
classes.push('active');
|
|
109
|
+
if (pagination.descending) {
|
|
110
|
+
classes.push('desc');
|
|
111
|
+
data.attrs['aria-sort'] = 'descending';
|
|
112
|
+
data.attrs['aria-label'] += ': Sorted descending. Activate to remove sorting.'; // TODO: Localization
|
|
113
|
+
} else {
|
|
114
|
+
classes.push('asc');
|
|
115
|
+
data.attrs['aria-sort'] = 'ascending';
|
|
116
|
+
data.attrs['aria-label'] += ': Sorted ascending. Activate to sort descending.'; // TODO: Localization
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
data.attrs['aria-label'] += ': Not sorted. Activate to sort ascending.'; // TODO: Localization
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
methods: {
|
|
3
|
+
genTProgress: function genTProgress() {
|
|
4
|
+
var col = this.$createElement('th', {
|
|
5
|
+
staticClass: 'column',
|
|
6
|
+
attrs: {
|
|
7
|
+
colspan: '100%'
|
|
8
|
+
}
|
|
9
|
+
}, [this.genProgress()]);
|
|
10
|
+
|
|
11
|
+
return this.$createElement('thead', {
|
|
12
|
+
staticClass: 'datatable__progress'
|
|
13
|
+
}, [this.genTR([col])]);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
2
|
+
|
|
3
|
+
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
|
4
|
+
|
|
5
|
+
require('../../../src/stylus/components/_pickers.styl');
|
|
6
|
+
require('../../../src/stylus/components/_date-picker.styl');
|
|
7
|
+
|
|
8
|
+
import { createRange } from '../../util/helpers';
|
|
9
|
+
|
|
10
|
+
import Picker from '../../mixins/picker';
|
|
11
|
+
import DateYears from './mixins/date-years';
|
|
12
|
+
import DateTitle from './mixins/date-title';
|
|
13
|
+
import DateHeader from './mixins/date-header';
|
|
14
|
+
import DateTable from './mixins/date-table';
|
|
15
|
+
import MonthTable from './mixins/month-table';
|
|
16
|
+
import KBtn from '../KBtn';
|
|
17
|
+
import KCard from '../KCard';
|
|
18
|
+
import KIcon from '../KIcon';
|
|
19
|
+
|
|
20
|
+
import Touch from '../../directives/touch';
|
|
21
|
+
|
|
22
|
+
var createDefaultDateFormat = function createDefaultDateFormat(type) {
|
|
23
|
+
return function (date) {
|
|
24
|
+
var pad = function pad(n) {
|
|
25
|
+
return n < 10 ? '0' + n : '' + n;
|
|
26
|
+
};
|
|
27
|
+
var isoString = date.getFullYear() + '-' + pad(date.getMonth() + 1) + '-' + pad(date.getDate());
|
|
28
|
+
return isoString.substr(0, { date: 10, month: 7, year: 4 }[type]);
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default {
|
|
33
|
+
name: 'k-date-picker',
|
|
34
|
+
|
|
35
|
+
components: {
|
|
36
|
+
KBtn: KBtn,
|
|
37
|
+
KCard: KCard,
|
|
38
|
+
KIcon: KIcon
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
mixins: [Picker, DateYears, DateTitle, DateHeader, DateTable, MonthTable],
|
|
42
|
+
|
|
43
|
+
directives: { Touch: Touch },
|
|
44
|
+
|
|
45
|
+
data: function data() {
|
|
46
|
+
return {
|
|
47
|
+
tableDate: new Date(),
|
|
48
|
+
originalDate: this.value,
|
|
49
|
+
currentDay: null,
|
|
50
|
+
currentMonth: null,
|
|
51
|
+
currentYear: null,
|
|
52
|
+
isReversing: false,
|
|
53
|
+
narrowDays: [],
|
|
54
|
+
activePicker: this.type.toUpperCase()
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
props: {
|
|
60
|
+
locale: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: 'en-us'
|
|
63
|
+
},
|
|
64
|
+
type: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: 'date',
|
|
67
|
+
validator: function validator(type) {
|
|
68
|
+
return ['date', 'month' /*, 'year'*/].includes(type);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
dateFormat: {
|
|
72
|
+
type: Function,
|
|
73
|
+
default: null
|
|
74
|
+
},
|
|
75
|
+
titleDateFormat: {
|
|
76
|
+
type: [Object, Function],
|
|
77
|
+
default: null
|
|
78
|
+
},
|
|
79
|
+
headerDateFormat: {
|
|
80
|
+
type: [Object, Function],
|
|
81
|
+
default: function _default() {
|
|
82
|
+
return { month: 'long', year: 'numeric' };
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
monthFormat: {
|
|
86
|
+
type: [Object, Function],
|
|
87
|
+
default: function _default() {
|
|
88
|
+
return { month: 'short' };
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
formattedValue: {
|
|
92
|
+
required: false
|
|
93
|
+
},
|
|
94
|
+
allowedDates: {
|
|
95
|
+
type: [Array, Object, Function],
|
|
96
|
+
default: function _default() {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
firstDayOfWeek: {
|
|
101
|
+
type: [String, Number],
|
|
102
|
+
default: 0
|
|
103
|
+
},
|
|
104
|
+
yearIcon: String
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
computed: {
|
|
108
|
+
timeZone: function timeZone() {
|
|
109
|
+
try {
|
|
110
|
+
var timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
111
|
+
new Date('2000-01-15').toLocaleDateString('en', {
|
|
112
|
+
day: 'numeric',
|
|
113
|
+
timeZone: timeZone
|
|
114
|
+
});
|
|
115
|
+
return timeZone;
|
|
116
|
+
} catch (e) {
|
|
117
|
+
return 'UTC';
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
supportsLocaleFormat: function supportsLocaleFormat() {
|
|
121
|
+
return 'toLocaleDateString' in Date.prototype && new Date('2000-01-15').toLocaleDateString('en', {
|
|
122
|
+
day: 'numeric',
|
|
123
|
+
timeZone: 'UTC'
|
|
124
|
+
}) === '15';
|
|
125
|
+
},
|
|
126
|
+
firstAllowedDate: function firstAllowedDate() {
|
|
127
|
+
var date = new Date();
|
|
128
|
+
|
|
129
|
+
if (this.type === 'month') {
|
|
130
|
+
date.setDate(1);
|
|
131
|
+
date.setHours(1);
|
|
132
|
+
|
|
133
|
+
if (this.allowedDates) {
|
|
134
|
+
var valid = new Date(date);
|
|
135
|
+
for (var month = 0; month < 12; month++) {
|
|
136
|
+
valid.setMonth(month);
|
|
137
|
+
if (this.isAllowed(valid)) {
|
|
138
|
+
return valid;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
} else if (this.type === 'date') {
|
|
143
|
+
date.setHours(1);
|
|
144
|
+
var _month = date.getMonth();
|
|
145
|
+
|
|
146
|
+
if (this.allowedDates) {
|
|
147
|
+
var _valid = new Date(date);
|
|
148
|
+
for (var i = 0; i < 31; i++) {
|
|
149
|
+
if (date.getMonth() === _month && this.isAllowed(_valid)) return _valid;
|
|
150
|
+
_valid.setDate(i);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return date;
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
inputDate: {
|
|
159
|
+
get: function get() {
|
|
160
|
+
var date = this.makeDate(this.value);
|
|
161
|
+
return date == null ? this.firstAllowedDate : date;
|
|
162
|
+
},
|
|
163
|
+
set: function set(value) {
|
|
164
|
+
var date = this.makeDate(value);
|
|
165
|
+
var pickerDateFormat = createDefaultDateFormat(this.type);
|
|
166
|
+
this.$emit('input', date == null ? this.originalDate : pickerDateFormat(date));
|
|
167
|
+
this.$emit('update:formattedValue', (this.dateFormat || pickerDateFormat)(date == null ? this.makeDate(this.originalDate) || this.firstAllowedDate : date));
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
day: function day() {
|
|
171
|
+
return this.inputDate.getDate();
|
|
172
|
+
},
|
|
173
|
+
month: function month() {
|
|
174
|
+
return this.inputDate.getMonth();
|
|
175
|
+
},
|
|
176
|
+
year: function year() {
|
|
177
|
+
return this.inputDate.getFullYear();
|
|
178
|
+
},
|
|
179
|
+
tableMonth: function tableMonth() {
|
|
180
|
+
return this.tableDate.getMonth();
|
|
181
|
+
},
|
|
182
|
+
tableYear: function tableYear() {
|
|
183
|
+
return this.tableDate.getFullYear();
|
|
184
|
+
},
|
|
185
|
+
computedTransition: function computedTransition() {
|
|
186
|
+
return this.isReversing ? 'tab-reverse-transition' : 'tab-transition';
|
|
187
|
+
},
|
|
188
|
+
titleText: function titleText() {
|
|
189
|
+
var date = this.normalizeDate(this.year, this.month, this.day);
|
|
190
|
+
|
|
191
|
+
var defaultTitleDateFormat = this.type === 'year' ? {
|
|
192
|
+
year: 'numeric'
|
|
193
|
+
} : this.type === 'month' ? {
|
|
194
|
+
month: 'long'
|
|
195
|
+
} : {
|
|
196
|
+
weekday: 'short',
|
|
197
|
+
month: 'short',
|
|
198
|
+
day: 'numeric'
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
var titleText = void 0;
|
|
202
|
+
if (typeof this.titleDateFormat === 'function') {
|
|
203
|
+
titleText = this.titleDateFormat(date);
|
|
204
|
+
} else if (this.supportsLocaleFormat) {
|
|
205
|
+
titleText = date.toLocaleDateString(this.locale, Object.assign(this.titleDateFormat || defaultTitleDateFormat, {
|
|
206
|
+
timeZone: this.timeZone
|
|
207
|
+
}));
|
|
208
|
+
} else if ('toLocaleDateString' in Date.prototype) {
|
|
209
|
+
titleText = createDefaultDateFormat(this.type)(date);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (this.landscape) {
|
|
213
|
+
if (titleText.indexOf(',') > -1) titleText = titleText.replace(',', ',<br>');else if (titleText.indexOf(' ') > -1) titleText = titleText.replace(' ', '<br>');
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return titleText;
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
|
|
220
|
+
watch: {
|
|
221
|
+
activePicker: function activePicker(val, prev) {
|
|
222
|
+
var _this = this;
|
|
223
|
+
|
|
224
|
+
if (val !== 'YEAR') return;
|
|
225
|
+
|
|
226
|
+
// That's a quirk, setting timeout stopped working after fixing #1649
|
|
227
|
+
// It worked but for timeouts significantly longer than the transition duration
|
|
228
|
+
var interval = setInterval(function () {
|
|
229
|
+
if (_this.$refs.years) {
|
|
230
|
+
_this.$refs.years.scrollTop = _this.$refs.years.scrollHeight / 2 - 125;
|
|
231
|
+
clearInterval(interval);
|
|
232
|
+
}
|
|
233
|
+
}, 100);
|
|
234
|
+
},
|
|
235
|
+
tableDate: function tableDate(val, prev) {
|
|
236
|
+
this.isReversing = val < prev;
|
|
237
|
+
},
|
|
238
|
+
value: function value(val) {
|
|
239
|
+
if (val) this.tableDate = this.inputDate;
|
|
240
|
+
},
|
|
241
|
+
type: function type(val) {
|
|
242
|
+
if (val === 'month' && this.activePicker === 'DATE') {
|
|
243
|
+
this.activePicker = 'MONTH';
|
|
244
|
+
} else if (val === 'year') {
|
|
245
|
+
this.activePicker = 'YEAR';
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
firstDayOfWeek: function firstDayOfWeek() {
|
|
249
|
+
this.getWeekDays();
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
|
|
253
|
+
methods: {
|
|
254
|
+
save: function save() {
|
|
255
|
+
if (this.originalDate) {
|
|
256
|
+
this.originalDate = this.value;
|
|
257
|
+
} else {
|
|
258
|
+
this.originalDate = this.inputDate;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
if (this.$parent && this.$parent.isActive) this.$parent.isActive = false;
|
|
262
|
+
},
|
|
263
|
+
cancel: function cancel() {
|
|
264
|
+
this.inputDate = this.originalDate;
|
|
265
|
+
if (this.$parent && this.$parent.isActive) this.$parent.isActive = false;
|
|
266
|
+
},
|
|
267
|
+
getWeekDays: function getWeekDays() {
|
|
268
|
+
var _this2 = this;
|
|
269
|
+
|
|
270
|
+
var first = parseInt(this.firstDayOfWeek, 10);
|
|
271
|
+
if (this.supportsLocaleFormat) {
|
|
272
|
+
var date = this.normalizeDate(2000, 1, 7);
|
|
273
|
+
var day = date.getDate() - date.getDay() + first;
|
|
274
|
+
var format = { weekday: 'narrow' };
|
|
275
|
+
this.narrowDays = createRange(7).map(function (i) {
|
|
276
|
+
return _this2.normalizeDate(2000, 1, day + i).toLocaleDateString(_this2.locale, format);
|
|
277
|
+
});
|
|
278
|
+
} else {
|
|
279
|
+
this.narrowDays = createRange(7).map(function (i) {
|
|
280
|
+
return ['S', 'M', 'T', 'W', 'T', 'F', 'S'][(i + first) % 7];
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
isAllowed: function isAllowed(date) {
|
|
285
|
+
var _this3 = this;
|
|
286
|
+
|
|
287
|
+
if (!this.allowedDates) return true;
|
|
288
|
+
|
|
289
|
+
if (Array.isArray(this.allowedDates)) {
|
|
290
|
+
var format = createDefaultDateFormat(this.activePicker === 'MONTH' ? 'month' : 'date');
|
|
291
|
+
date = format(this.makeDate(date));
|
|
292
|
+
return !!this.allowedDates.find(function (allowedDate) {
|
|
293
|
+
allowedDate = _this3.makeDate(allowedDate);
|
|
294
|
+
return allowedDate && format(allowedDate) === date;
|
|
295
|
+
});
|
|
296
|
+
} else if (this.allowedDates instanceof Function) {
|
|
297
|
+
return this.allowedDates(date);
|
|
298
|
+
} else if (this.allowedDates instanceof Object) {
|
|
299
|
+
var _format = createDefaultDateFormat(this.activePicker === 'MONTH' ? 'month' : 'date');
|
|
300
|
+
var min = _format(this.makeDate(this.allowedDates.min));
|
|
301
|
+
var max = _format(this.makeDate(this.allowedDates.max));
|
|
302
|
+
date = _format(date);
|
|
303
|
+
return (!min || min <= date) && (!max || max >= date);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return true;
|
|
307
|
+
},
|
|
308
|
+
genTableTouch: function genTableTouch(touchCallback) {
|
|
309
|
+
return {
|
|
310
|
+
name: 'touch',
|
|
311
|
+
value: {
|
|
312
|
+
left: function left(e) {
|
|
313
|
+
return e.offsetX < -15 && touchCallback(1);
|
|
314
|
+
},
|
|
315
|
+
right: function right(e) {
|
|
316
|
+
return e.offsetX > 15 && touchCallback(-1);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
},
|
|
321
|
+
genTable: function genTable(tableChildren, touchCallback) {
|
|
322
|
+
var wheel = this.activePicker === 'MONTH' ? this.monthWheelScroll : this.dateWheelScroll;
|
|
323
|
+
var options = {
|
|
324
|
+
staticClass: 'picker--date__table',
|
|
325
|
+
'class': {
|
|
326
|
+
'picker--month__table': this.activePicker === 'MONTH'
|
|
327
|
+
},
|
|
328
|
+
on: this.scrollable ? { wheel: wheel } : undefined,
|
|
329
|
+
directives: [this.genTableTouch(touchCallback)]
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
var table = this.$createElement('table', {
|
|
333
|
+
key: this.activePicker === 'MONTH' ? this.tableYear : this.tableMonth
|
|
334
|
+
}, tableChildren);
|
|
335
|
+
|
|
336
|
+
return this.$createElement('div', options, [this.$createElement('transition', {
|
|
337
|
+
props: { name: this.computedTransition }
|
|
338
|
+
}, [table])]);
|
|
339
|
+
},
|
|
340
|
+
genPickerBody: function genPickerBody(h) {
|
|
341
|
+
var _this4 = this;
|
|
342
|
+
|
|
343
|
+
var pickerBodyChildren = [];
|
|
344
|
+
if (this.activePicker === 'DATE') {
|
|
345
|
+
pickerBodyChildren.push(h('div', { staticClass: 'picker--date__header' }, [this.genSelector()]));
|
|
346
|
+
pickerBodyChildren.push(this.genTable([this.dateGenTHead(), this.dateGenTBody()], function (value) {
|
|
347
|
+
return _this4.tableDate = _this4.normalizeDate(_this4.tableYear, _this4.tableMonth + value);
|
|
348
|
+
}));
|
|
349
|
+
} else if (this.activePicker === 'MONTH') {
|
|
350
|
+
pickerBodyChildren.push(h('div', { staticClass: 'picker--date__header' }, [this.genSelector()]));
|
|
351
|
+
pickerBodyChildren.push(this.genTable([this.monthGenTBody()], function (value) {
|
|
352
|
+
return _this4.tableDate = _this4.normalizeDate(_this4.tableYear + value);
|
|
353
|
+
}));
|
|
354
|
+
} else if (this.activePicker === 'YEAR') {
|
|
355
|
+
pickerBodyChildren.push(this.genYears());
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
return pickerBodyChildren;
|
|
359
|
+
},
|
|
360
|
+
makeDate: function makeDate(val) {
|
|
361
|
+
if (val == null) return val;
|
|
362
|
+
if (val instanceof Date) return val;
|
|
363
|
+
if (!isNaN(val)) return new Date(val);
|
|
364
|
+
|
|
365
|
+
var _val$trim$split$0$spl = val.trim().split(' ')[0].split('-'),
|
|
366
|
+
_val$trim$split$0$spl2 = _slicedToArray(_val$trim$split$0$spl, 3),
|
|
367
|
+
year = _val$trim$split$0$spl2[0],
|
|
368
|
+
month = _val$trim$split$0$spl2[1],
|
|
369
|
+
date = _val$trim$split$0$spl2[2];
|
|
370
|
+
|
|
371
|
+
return this.normalizeDate(year, month ? month - 1 : 0, date ? date * 1 : 1);
|
|
372
|
+
},
|
|
373
|
+
normalizeDate: function normalizeDate(year) {
|
|
374
|
+
var month = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
375
|
+
var date = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
376
|
+
|
|
377
|
+
return new Date(year, month, date, 1 /* Workaround for #1409 */);
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
|
|
381
|
+
created: function created() {
|
|
382
|
+
this.getWeekDays();
|
|
383
|
+
this.tableDate = this.inputDate;
|
|
384
|
+
},
|
|
385
|
+
mounted: function mounted() {
|
|
386
|
+
var date = new Date();
|
|
387
|
+
this.currentDay = date.getDate();
|
|
388
|
+
this.currentMonth = date.getMonth();
|
|
389
|
+
this.currentYear = date.getFullYear();
|
|
390
|
+
},
|
|
391
|
+
render: function render(h) {
|
|
392
|
+
var children = [];
|
|
393
|
+
|
|
394
|
+
!this.noTitle && children.push(this.genTitle(this.titleText));
|
|
395
|
+
|
|
396
|
+
children.push(h('transition', {
|
|
397
|
+
props: {
|
|
398
|
+
origin: 'center center',
|
|
399
|
+
mode: 'out-in',
|
|
400
|
+
name: 'scale-transition'
|
|
401
|
+
}
|
|
402
|
+
}, [h('div', {
|
|
403
|
+
staticClass: 'picker__body',
|
|
404
|
+
key: this.activePicker
|
|
405
|
+
}, this.genPickerBody(h))]));
|
|
406
|
+
|
|
407
|
+
this.$scopedSlots.default && children.push(this.genSlot());
|
|
408
|
+
|
|
409
|
+
return h('k-card', {
|
|
410
|
+
staticClass: 'picker picker--date',
|
|
411
|
+
'class': _extends({
|
|
412
|
+
'picker--landscape': this.landscape
|
|
413
|
+
}, this.themeClasses)
|
|
414
|
+
}, children);
|
|
415
|
+
}
|
|
416
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
methods: {
|
|
3
|
+
genBtn: function genBtn(change, children) {
|
|
4
|
+
var _this = this;
|
|
5
|
+
|
|
6
|
+
return this.$createElement('k-btn', {
|
|
7
|
+
props: {
|
|
8
|
+
dark: this.dark,
|
|
9
|
+
icon: true
|
|
10
|
+
},
|
|
11
|
+
nativeOn: {
|
|
12
|
+
click: function click(e) {
|
|
13
|
+
e.stopPropagation();
|
|
14
|
+
if (_this.activePicker === 'DATE') {
|
|
15
|
+
_this.tableDate = _this.normalizeDate(_this.tableYear, change);
|
|
16
|
+
} else if (_this.activePicker === 'MONTH') {
|
|
17
|
+
_this.tableDate = _this.normalizeDate(change, _this.tableMonth);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}, children);
|
|
22
|
+
},
|
|
23
|
+
genHeader: function genHeader(keyValue, selectorText) {
|
|
24
|
+
var _this2 = this;
|
|
25
|
+
|
|
26
|
+
var header = this.$createElement('strong', {
|
|
27
|
+
key: keyValue,
|
|
28
|
+
on: {
|
|
29
|
+
click: function click() {
|
|
30
|
+
return _this2.activePicker = _this2.activePicker === 'DATE' ? 'MONTH' : 'YEAR';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}, selectorText);
|
|
34
|
+
|
|
35
|
+
var transition = this.$createElement('transition', {
|
|
36
|
+
props: { name: this.computedTransition }
|
|
37
|
+
}, [header]);
|
|
38
|
+
|
|
39
|
+
return this.$createElement('div', {
|
|
40
|
+
'class': 'picker--date__header-selector-date'
|
|
41
|
+
}, [transition]);
|
|
42
|
+
},
|
|
43
|
+
genSelector: function genSelector() {
|
|
44
|
+
var keyValue = this.activePicker === 'DATE' ? this.tableMonth : this.tableYear;
|
|
45
|
+
var selectorDate = this.normalizeDate(this.tableYear, this.tableMonth);
|
|
46
|
+
|
|
47
|
+
var selectorText = '';
|
|
48
|
+
if (typeof this.headerDateFormat === 'function' && this.activePicker === 'DATE') {
|
|
49
|
+
selectorText = this.headerDateFormat(selectorDate, this.activePicker);
|
|
50
|
+
} else if (this.supportsLocaleFormat) {
|
|
51
|
+
var format = this.activePicker === 'DATE' ? this.headerDateFormat : { year: 'numeric' };
|
|
52
|
+
selectorText = selectorDate.toLocaleDateString(this.locale, Object.assign(format, {
|
|
53
|
+
timeZone: this.timeZone
|
|
54
|
+
}));
|
|
55
|
+
} else if (this.activePicker === 'DATE') {
|
|
56
|
+
selectorText = selectorDate.getFullYear() + '/';
|
|
57
|
+
if (selectorDate.getMonth() < 9) selectorText += '0';
|
|
58
|
+
selectorText += 1 + selectorDate.getMonth();
|
|
59
|
+
} else if (this.activePicker === 'MONTH') {
|
|
60
|
+
selectorText = selectorDate.getFullYear();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return this.$createElement('div', {
|
|
64
|
+
'class': 'picker--date__header-selector'
|
|
65
|
+
}, [this.genBtn(keyValue - 1, [this.$createElement('k-icon', 'chevron_left')]), this.genHeader(keyValue, selectorText), this.genBtn(keyValue + 1, [this.$createElement('k-icon', 'chevron_right')])]);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|