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,275 @@
|
|
|
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
|
+
require('../../../src/stylus/components/_input-groups.styl');
|
|
4
|
+
require('../../../src/stylus/components/_text-fields.styl');
|
|
5
|
+
|
|
6
|
+
import Colorable from '../../mixins/colorable';
|
|
7
|
+
import Input from '../../mixins/input';
|
|
8
|
+
import Maskable from '../../mixins/maskable';
|
|
9
|
+
import { isMaskDelimiter } from '../../util/mask';
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
name: 'k-text-field',
|
|
13
|
+
|
|
14
|
+
mixins: [Colorable, Input, Maskable],
|
|
15
|
+
|
|
16
|
+
inheritAttrs: false,
|
|
17
|
+
|
|
18
|
+
data: function data() {
|
|
19
|
+
return {
|
|
20
|
+
initialValue: null,
|
|
21
|
+
inputHeight: null,
|
|
22
|
+
badInput: false,
|
|
23
|
+
lazySelection: 0
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
props: {
|
|
29
|
+
autofocus: Boolean,
|
|
30
|
+
autoGrow: Boolean,
|
|
31
|
+
box: Boolean,
|
|
32
|
+
clearable: Boolean,
|
|
33
|
+
color: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: 'primary'
|
|
36
|
+
},
|
|
37
|
+
counter: [Boolean, Number, String],
|
|
38
|
+
fullWidth: Boolean,
|
|
39
|
+
multiLine: Boolean,
|
|
40
|
+
placeholder: String,
|
|
41
|
+
prefix: String,
|
|
42
|
+
rows: {
|
|
43
|
+
default: 5
|
|
44
|
+
},
|
|
45
|
+
singleLine: Boolean,
|
|
46
|
+
solo: Boolean,
|
|
47
|
+
suffix: String,
|
|
48
|
+
textarea: Boolean,
|
|
49
|
+
type: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: 'text'
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
computed: {
|
|
56
|
+
classes: function classes() {
|
|
57
|
+
var classes = {
|
|
58
|
+
'input-group--text-field': true,
|
|
59
|
+
'input-group--text-field-box': this.box,
|
|
60
|
+
'input-group--single-line': this.singleLine || this.solo,
|
|
61
|
+
'input-group--solo': this.solo,
|
|
62
|
+
'input-group--multi-line': this.multiLine,
|
|
63
|
+
'input-group--full-width': this.fullWidth,
|
|
64
|
+
'input-group--prefix': this.prefix,
|
|
65
|
+
'input-group--suffix': this.suffix,
|
|
66
|
+
'input-group--textarea': this.textarea
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
if (this.hasError) {
|
|
70
|
+
classes['error--text'] = true;
|
|
71
|
+
} else {
|
|
72
|
+
return this.addTextColorClassChecks(classes);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return classes;
|
|
76
|
+
},
|
|
77
|
+
count: function count() {
|
|
78
|
+
var inputLength = void 0;
|
|
79
|
+
if (this.inputValue) inputLength = this.inputValue.toString().length;else inputLength = 0;
|
|
80
|
+
|
|
81
|
+
return inputLength + ' / ' + this.counterLength;
|
|
82
|
+
},
|
|
83
|
+
counterLength: function counterLength() {
|
|
84
|
+
var parsedLength = parseInt(this.counter, 10);
|
|
85
|
+
return isNaN(parsedLength) ? 25 : parsedLength;
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
inputValue: {
|
|
89
|
+
get: function get() {
|
|
90
|
+
return this.value;
|
|
91
|
+
},
|
|
92
|
+
set: function set(val) {
|
|
93
|
+
this.lazyValue = val;
|
|
94
|
+
this.mask && this.setSelectionRange();
|
|
95
|
+
this.$emit('input', val);
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
isDirty: function isDirty() {
|
|
99
|
+
return this.lazyValue != null && this.lazyValue.toString().length > 0 || this.badInput || ['time', 'date', 'datetime-local', 'week', 'month'].includes(this.type);
|
|
100
|
+
},
|
|
101
|
+
shouldAutoGrow: function shouldAutoGrow() {
|
|
102
|
+
return (this.multiLine || this.textarea) && this.autoGrow;
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
watch: {
|
|
107
|
+
isFocused: function isFocused(val) {
|
|
108
|
+
if (val) {
|
|
109
|
+
this.initialValue = this.lazyValue;
|
|
110
|
+
} else if (this.initialValue !== this.lazyValue) {
|
|
111
|
+
this.$emit('change', this.lazyValue);
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
value: function value(val) {
|
|
115
|
+
// Value was changed externally, update lazy
|
|
116
|
+
this.lazyValue = val;
|
|
117
|
+
|
|
118
|
+
!this.validateOnBlur && this.validate();
|
|
119
|
+
this.shouldAutoGrow && this.calculateInputHeight();
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
mounted: function mounted() {
|
|
124
|
+
var _this = this;
|
|
125
|
+
|
|
126
|
+
this.$kdutify.load(function () {
|
|
127
|
+
_this.shouldAutoGrow && _this.calculateInputHeight();
|
|
128
|
+
_this.autofocus && _this.focus();
|
|
129
|
+
});
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
methods: {
|
|
134
|
+
calculateInputHeight: function calculateInputHeight() {
|
|
135
|
+
var _this2 = this;
|
|
136
|
+
|
|
137
|
+
this.inputHeight = null;
|
|
138
|
+
|
|
139
|
+
this.$nextTick(function () {
|
|
140
|
+
var height = _this2.$refs.input ? _this2.$refs.input.scrollHeight : 0;
|
|
141
|
+
var minHeight = _this2.rows * 24;
|
|
142
|
+
var inputHeight = height < minHeight ? minHeight : height;
|
|
143
|
+
_this2.inputHeight = inputHeight + (_this2.textarea ? 4 : 0);
|
|
144
|
+
});
|
|
145
|
+
},
|
|
146
|
+
onInput: function onInput(e) {
|
|
147
|
+
this.resetSelections(e.target);
|
|
148
|
+
this.inputValue = this.unmaskText(e.target.value);
|
|
149
|
+
this.badInput = e.target.validity && e.target.validity.badInput;
|
|
150
|
+
this.shouldAutoGrow && this.calculateInputHeight();
|
|
151
|
+
},
|
|
152
|
+
blur: function blur(e) {
|
|
153
|
+
var _this3 = this;
|
|
154
|
+
|
|
155
|
+
this.isFocused = false;
|
|
156
|
+
|
|
157
|
+
this.$nextTick(function () {
|
|
158
|
+
_this3.validate();
|
|
159
|
+
});
|
|
160
|
+
this.$emit('blur', e);
|
|
161
|
+
},
|
|
162
|
+
focus: function focus(e) {
|
|
163
|
+
if (!this.$refs.input) return;
|
|
164
|
+
|
|
165
|
+
this.isFocused = true;
|
|
166
|
+
if (document.activeElement !== this.$refs.input) {
|
|
167
|
+
this.$refs.input.focus();
|
|
168
|
+
}
|
|
169
|
+
this.$emit('focus', e);
|
|
170
|
+
},
|
|
171
|
+
genCounter: function genCounter() {
|
|
172
|
+
return this.$createElement('div', {
|
|
173
|
+
'class': {
|
|
174
|
+
'input-group__counter': true,
|
|
175
|
+
'input-group__counter--error': this.hasError
|
|
176
|
+
}
|
|
177
|
+
}, this.count);
|
|
178
|
+
},
|
|
179
|
+
genInput: function genInput() {
|
|
180
|
+
var tag = this.multiLine || this.textarea ? 'textarea' : 'input';
|
|
181
|
+
var listeners = Object.assign({}, this.$listeners);
|
|
182
|
+
delete listeners['change']; // Change should not be bound externally
|
|
183
|
+
|
|
184
|
+
var data = {
|
|
185
|
+
style: {},
|
|
186
|
+
domProps: {
|
|
187
|
+
autofocus: this.autofocus,
|
|
188
|
+
disabled: this.disabled,
|
|
189
|
+
required: this.required,
|
|
190
|
+
value: this.maskText(this.lazyValue)
|
|
191
|
+
},
|
|
192
|
+
attrs: _extends({}, this.$attrs, {
|
|
193
|
+
readonly: this.readonly,
|
|
194
|
+
tabindex: this.tabindex,
|
|
195
|
+
'aria-label': (!this.$attrs || !this.$attrs.id) && this.label // Label `for` will be set if we have an id
|
|
196
|
+
}),
|
|
197
|
+
on: Object.assign(listeners, {
|
|
198
|
+
blur: this.blur,
|
|
199
|
+
input: this.onInput,
|
|
200
|
+
focus: this.focus
|
|
201
|
+
}),
|
|
202
|
+
ref: 'input'
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
if (this.shouldAutoGrow) {
|
|
206
|
+
data.style.height = this.inputHeight && this.inputHeight + 'px';
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (this.placeholder) data.domProps.placeholder = this.placeholder;
|
|
210
|
+
|
|
211
|
+
if (!this.textarea && !this.multiLine) {
|
|
212
|
+
data.domProps.type = this.type;
|
|
213
|
+
} else {
|
|
214
|
+
data.domProps.rows = this.rows;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (this.mask) {
|
|
218
|
+
data.attrs.maxlength = this.masked.length;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
var children = [this.$createElement(tag, data)];
|
|
222
|
+
|
|
223
|
+
this.prefix && children.unshift(this.genFix('prefix'));
|
|
224
|
+
this.suffix && children.push(this.genFix('suffix'));
|
|
225
|
+
|
|
226
|
+
return children;
|
|
227
|
+
},
|
|
228
|
+
genFix: function genFix(type) {
|
|
229
|
+
return this.$createElement('span', {
|
|
230
|
+
'class': 'input-group--text-field__' + type
|
|
231
|
+
}, this[type]);
|
|
232
|
+
},
|
|
233
|
+
clearableCallback: function clearableCallback() {
|
|
234
|
+
var _this4 = this;
|
|
235
|
+
|
|
236
|
+
this.inputValue = null;
|
|
237
|
+
this.$nextTick(function () {
|
|
238
|
+
return _this4.$refs.input.focus();
|
|
239
|
+
});
|
|
240
|
+
},
|
|
241
|
+
resetSelections: function resetSelections(input) {
|
|
242
|
+
this.selection = input.selectionEnd;
|
|
243
|
+
this.lazySelection = 0;
|
|
244
|
+
|
|
245
|
+
var _iteratorNormalCompletion = true;
|
|
246
|
+
var _didIteratorError = false;
|
|
247
|
+
var _iteratorError = undefined;
|
|
248
|
+
|
|
249
|
+
try {
|
|
250
|
+
for (var _iterator = input.value.substr(0, this.selection)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
251
|
+
var char = _step.value;
|
|
252
|
+
|
|
253
|
+
isMaskDelimiter(char) || this.lazySelection++;
|
|
254
|
+
}
|
|
255
|
+
} catch (err) {
|
|
256
|
+
_didIteratorError = true;
|
|
257
|
+
_iteratorError = err;
|
|
258
|
+
} finally {
|
|
259
|
+
try {
|
|
260
|
+
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
261
|
+
_iterator.return();
|
|
262
|
+
}
|
|
263
|
+
} finally {
|
|
264
|
+
if (_didIteratorError) {
|
|
265
|
+
throw _iteratorError;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
|
|
272
|
+
render: function render() {
|
|
273
|
+
return this.genInputGroup(this.genInput(), { attrs: { tabindex: false } });
|
|
274
|
+
}
|
|
275
|
+
};
|
|
@@ -0,0 +1,302 @@
|
|
|
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
|
+
require('../../../src/stylus/components/_pickers.styl');
|
|
4
|
+
require('../../../src/stylus/components/_time-picker.styl');
|
|
5
|
+
|
|
6
|
+
import { createRange } from '../../util/helpers';
|
|
7
|
+
|
|
8
|
+
import KCard from '../KCard';
|
|
9
|
+
|
|
10
|
+
import Picker from '../../mixins/picker';
|
|
11
|
+
import TimeTitle from './mixins/time-title';
|
|
12
|
+
import TimeBody from './mixins/time-body';
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
name: 'k-time-picker',
|
|
16
|
+
|
|
17
|
+
components: {
|
|
18
|
+
KCard: KCard
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
mixins: [Picker, TimeBody, TimeTitle],
|
|
22
|
+
|
|
23
|
+
data: function data() {
|
|
24
|
+
return {
|
|
25
|
+
isDragging: false,
|
|
26
|
+
rotate: 0,
|
|
27
|
+
originalTime: this.value,
|
|
28
|
+
period: 'am',
|
|
29
|
+
selectingHour: true,
|
|
30
|
+
ranges: {
|
|
31
|
+
hours: createRange(24),
|
|
32
|
+
minutes: createRange(60)
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
props: {
|
|
39
|
+
format: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: 'ampm',
|
|
42
|
+
validator: function validator(val) {
|
|
43
|
+
return ['ampm', '24hr'].includes(val);
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
allowedHours: {
|
|
47
|
+
type: [Array, Object, Function],
|
|
48
|
+
default: function _default() {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
allowedMinutes: {
|
|
53
|
+
type: [Array, Object, Function],
|
|
54
|
+
default: function _default() {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
computed: {
|
|
61
|
+
is24hr: function is24hr() {
|
|
62
|
+
return this.format !== 'ampm';
|
|
63
|
+
},
|
|
64
|
+
is24hrAfter12: function is24hrAfter12() {
|
|
65
|
+
return this.selectingHour && this.is24hr && this.hour >= 12;
|
|
66
|
+
},
|
|
67
|
+
divider: function divider() {
|
|
68
|
+
return this.selectingHour ? 12 : 60;
|
|
69
|
+
},
|
|
70
|
+
degrees: function degrees() {
|
|
71
|
+
return this.degreesPerUnit * Math.PI / 180;
|
|
72
|
+
},
|
|
73
|
+
degreesPerUnit: function degreesPerUnit() {
|
|
74
|
+
return 360 / this.divider;
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
inputTime: {
|
|
78
|
+
get: function get() {
|
|
79
|
+
if (this.value && !(this.value instanceof Date)) {
|
|
80
|
+
if (!this.is24hr) {
|
|
81
|
+
this.period = this.value.match(/pm/i) ? 'pm' : 'am';
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return this.value;
|
|
85
|
+
}
|
|
86
|
+
var value = new Date();
|
|
87
|
+
|
|
88
|
+
if (this.value instanceof Date) {
|
|
89
|
+
value = this.value;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
var hour = value.getHours();
|
|
93
|
+
var minute = value.getMinutes();
|
|
94
|
+
var period = '';
|
|
95
|
+
|
|
96
|
+
if (!this.is24hr) {
|
|
97
|
+
period = hour >= 12 ? 'pm' : 'am';
|
|
98
|
+
hour = hour > 12 ? hour - 12 : hour;
|
|
99
|
+
hour = hour === 0 ? 12 : hour;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
period && (this.period = period);
|
|
103
|
+
|
|
104
|
+
hour = this.firstAllowed('hour', hour);
|
|
105
|
+
minute = this.firstAllowed('minute', minute);
|
|
106
|
+
|
|
107
|
+
minute = minute < 10 ? '0' + minute : minute > 59 ? '00' : minute;
|
|
108
|
+
|
|
109
|
+
return hour + ':' + minute + period;
|
|
110
|
+
},
|
|
111
|
+
set: function set(val) {
|
|
112
|
+
return this.$emit('input', val);
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
timeArray: function timeArray() {
|
|
116
|
+
return this.inputTime.replace(/(am|pm)/, '').split(':');
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
hour: {
|
|
120
|
+
get: function get() {
|
|
121
|
+
return parseInt(this.timeArray[0]);
|
|
122
|
+
},
|
|
123
|
+
set: function set(val) {
|
|
124
|
+
if (!this.is24hr) {
|
|
125
|
+
val = val > 12 ? val - 12 : val < 1 ? 12 : val;
|
|
126
|
+
} else {
|
|
127
|
+
val = val < 10 ? '0' + val : val > 23 ? '00' : val;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
this.inputTime = val + ':' + this.minute + (!this.is24hr ? this.period : '');
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
minute: {
|
|
134
|
+
get: function get() {
|
|
135
|
+
var minute = parseInt(this.timeArray[1]);
|
|
136
|
+
|
|
137
|
+
return minute < 10 ? '0' + minute : minute > 59 ? '00' : minute;
|
|
138
|
+
},
|
|
139
|
+
set: function set(val) {
|
|
140
|
+
val = val < 10 ? '0' + parseInt(val) : val > 59 ? '00' : val;
|
|
141
|
+
var hour = this.hour;
|
|
142
|
+
|
|
143
|
+
if (this.is24hr && hour < 10) {
|
|
144
|
+
hour = '0' + hour;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
this.inputTime = hour + ':' + val + (!this.is24hr ? this.period : '');
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
clockHand: function clockHand() {
|
|
151
|
+
if (this.selectingHour) return this.degreesPerUnit * this.hour;
|
|
152
|
+
return this.degreesPerUnit * this.minute;
|
|
153
|
+
},
|
|
154
|
+
radius: function radius() {
|
|
155
|
+
return this.clockSize / 2;
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
clockSize: {
|
|
159
|
+
get: function get() {
|
|
160
|
+
return this.size;
|
|
161
|
+
},
|
|
162
|
+
set: function set(val) {
|
|
163
|
+
this.size = val;
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
size: function size() {
|
|
167
|
+
return this.landscape ? 250 : 280;
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
watch: {
|
|
172
|
+
period: function period(val) {
|
|
173
|
+
var hour = !!this.allowedHours && this.selectingHour ? this.firstAllowed('hour', this.hour - 1) : this.hour;
|
|
174
|
+
this.inputTime = hour + ':' + this.minute + val;
|
|
175
|
+
},
|
|
176
|
+
value: function value(val) {
|
|
177
|
+
if (this.isSaving) {
|
|
178
|
+
this.originalTime = this.inputTime;
|
|
179
|
+
this.isSaving = false;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
methods: {
|
|
185
|
+
save: function save() {
|
|
186
|
+
var _this = this;
|
|
187
|
+
|
|
188
|
+
if (this.originalTime) {
|
|
189
|
+
this.originalTime = this.value;
|
|
190
|
+
} else {
|
|
191
|
+
this.inputTime = this.inputTime;
|
|
192
|
+
this.originalTime = this.inputTime;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (this.$parent && this.$parent.isActive) this.$parent.isActive = false;
|
|
196
|
+
|
|
197
|
+
// Fix for #1818
|
|
198
|
+
// Wait for data to persist
|
|
199
|
+
// then set selectingHour
|
|
200
|
+
this.$nextTick(function () {
|
|
201
|
+
return _this.selectingHour = true;
|
|
202
|
+
});
|
|
203
|
+
},
|
|
204
|
+
cancel: function cancel() {
|
|
205
|
+
var _this2 = this;
|
|
206
|
+
|
|
207
|
+
this.inputTime = this.originalTime;
|
|
208
|
+
if (this.$parent && this.$parent.isActive) this.$parent.isActive = false;
|
|
209
|
+
|
|
210
|
+
// Fix for #1818
|
|
211
|
+
// Wait for data to persist
|
|
212
|
+
// then set selectingHour
|
|
213
|
+
this.$nextTick(function () {
|
|
214
|
+
return _this2.selectingHour = true;
|
|
215
|
+
});
|
|
216
|
+
},
|
|
217
|
+
isAllowed: function isAllowed(type, value) {
|
|
218
|
+
var allowed = this['allowed' + (type.charAt(0).toUpperCase() + type.slice(1)) + 's'];
|
|
219
|
+
|
|
220
|
+
if (!allowed) return true;
|
|
221
|
+
|
|
222
|
+
if (Array.isArray(allowed)) {
|
|
223
|
+
return !!allowed.some(function (v) {
|
|
224
|
+
return v === value;
|
|
225
|
+
});
|
|
226
|
+
} else if (allowed instanceof Function) {
|
|
227
|
+
return allowed(value);
|
|
228
|
+
} else if (allowed === Object(allowed)) {
|
|
229
|
+
var range = type === 'minute' ? this.ranges.minutes : this.ranges.hours;
|
|
230
|
+
var mod = type === 'minute' ? 60 : 24;
|
|
231
|
+
|
|
232
|
+
if (allowed.min === String(allowed.min)) {
|
|
233
|
+
allowed.min = this.convert12to24hr(allowed.min);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (allowed.max === String(allowed.max)) {
|
|
237
|
+
allowed.max = this.convert12to24hr(allowed.max);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
var steps = allowed.max - allowed.min;
|
|
241
|
+
value = type === 'hour' && !this.is24hr && this.period === 'pm' ? value + 12 : value;
|
|
242
|
+
|
|
243
|
+
for (var i = 0; i <= steps; i++) {
|
|
244
|
+
var index = (allowed.min + i) % mod;
|
|
245
|
+
if (range[index] === value) return true;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return true;
|
|
252
|
+
},
|
|
253
|
+
convert12to24hr: function convert12to24hr(input) {
|
|
254
|
+
input = input.toLowerCase();
|
|
255
|
+
var pm = input.indexOf('pm') !== -1;
|
|
256
|
+
var hour = parseInt(input.slice(0, input.indexOf(pm ? 'pm' : 'am')));
|
|
257
|
+
|
|
258
|
+
return pm ? hour + 12 : hour;
|
|
259
|
+
},
|
|
260
|
+
generateRange: function generateRange(type, start) {
|
|
261
|
+
var range = type === 'hour' ? this.ranges.hours : this.ranges.minutes;
|
|
262
|
+
var offset = 1;
|
|
263
|
+
|
|
264
|
+
if (type === 'hour' && !this.is24hr) {
|
|
265
|
+
range = range.slice(1, 13);
|
|
266
|
+
offset = 0;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
return range.slice(start + offset, range.length).concat(range.slice(0, start + offset));
|
|
270
|
+
},
|
|
271
|
+
firstAllowed: function firstAllowed(type, value) {
|
|
272
|
+
var _this3 = this;
|
|
273
|
+
|
|
274
|
+
var allowed = this['allowed' + (type.charAt(0).toUpperCase() + type.slice(1)) + 's'];
|
|
275
|
+
|
|
276
|
+
if (!allowed) return value;
|
|
277
|
+
|
|
278
|
+
var range = this.generateRange(type, value);
|
|
279
|
+
|
|
280
|
+
var first = range.find(function (v) {
|
|
281
|
+
return _this3.isAllowed(type, v);
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
return first || value;
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
|
|
288
|
+
render: function render(h) {
|
|
289
|
+
var children = [this.genBody()];
|
|
290
|
+
|
|
291
|
+
!this.noTitle && children.unshift(this.genTitle());
|
|
292
|
+
this.$scopedSlots.default && children.push(this.genSlot());
|
|
293
|
+
|
|
294
|
+
return h('k-card', {
|
|
295
|
+
'class': _extends({
|
|
296
|
+
'picker picker--time': true,
|
|
297
|
+
'picker--landscape': this.landscape,
|
|
298
|
+
'picker--time--hours': this.selectingHour
|
|
299
|
+
}, this.themeClasses)
|
|
300
|
+
}, children);
|
|
301
|
+
}
|
|
302
|
+
};
|