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,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Menu activator
|
|
3
|
+
*
|
|
4
|
+
* @mixin
|
|
5
|
+
*
|
|
6
|
+
* Handles the click and hover activation
|
|
7
|
+
* Supports slotted and detached activators
|
|
8
|
+
*/
|
|
9
|
+
export default {
|
|
10
|
+
methods: {
|
|
11
|
+
activatorClickHandler (e) {
|
|
12
|
+
if (this.disabled) return
|
|
13
|
+
if (this.openOnClick && !this.isActive) {
|
|
14
|
+
this.getActivator().focus()
|
|
15
|
+
this.isActive = true
|
|
16
|
+
this.absoluteX = e.clientX
|
|
17
|
+
this.absoluteY = e.clientY
|
|
18
|
+
} else if (this.closeOnClick && this.isActive) {
|
|
19
|
+
this.getActivator().blur()
|
|
20
|
+
this.isActive = false
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
mouseEnterHandler (e) {
|
|
24
|
+
this.runDelay('open', () => {
|
|
25
|
+
if (this.hasJustFocused) return
|
|
26
|
+
|
|
27
|
+
this.hasJustFocused = true
|
|
28
|
+
this.isActive = true
|
|
29
|
+
})
|
|
30
|
+
},
|
|
31
|
+
mouseLeaveHandler (e) {
|
|
32
|
+
// Prevent accidental re-activation
|
|
33
|
+
this.runDelay('close', () => {
|
|
34
|
+
if (this.$refs.content.contains(e.relatedTarget)) return
|
|
35
|
+
|
|
36
|
+
requestAnimationFrame(() => {
|
|
37
|
+
this.isActive = false
|
|
38
|
+
this.callDeactivate()
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
},
|
|
42
|
+
addActivatorEvents (activator = null) {
|
|
43
|
+
if (!activator) return
|
|
44
|
+
activator.addEventListener('click', this.activatorClickHandler)
|
|
45
|
+
},
|
|
46
|
+
removeActivatorEvents (activator = null) {
|
|
47
|
+
if (!activator) return
|
|
48
|
+
activator.removeEventListener('click', this.activatorClickHandler)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Menu generators
|
|
3
|
+
*
|
|
4
|
+
* @mixin
|
|
5
|
+
*
|
|
6
|
+
* Used for creating the DOM elements for KMenu
|
|
7
|
+
*/
|
|
8
|
+
export default {
|
|
9
|
+
methods: {
|
|
10
|
+
genActivator () {
|
|
11
|
+
if (!this.$slots.activator) return null
|
|
12
|
+
|
|
13
|
+
const options = {
|
|
14
|
+
staticClass: 'menu__activator',
|
|
15
|
+
'class': {
|
|
16
|
+
'menu__activator--active': this.hasJustFocused || this.isActive
|
|
17
|
+
},
|
|
18
|
+
ref: 'activator',
|
|
19
|
+
on: {}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (this.openOnHover) {
|
|
23
|
+
options.on['mouseenter'] = this.mouseEnterHandler
|
|
24
|
+
options.on['mouseleave'] = this.mouseLeaveHandler
|
|
25
|
+
} else if (this.openOnClick) {
|
|
26
|
+
options.on['click'] = this.activatorClickHandler
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return this.$createElement('div', options, this.$slots.activator)
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
genTransition () {
|
|
33
|
+
if (!this.transition) return this.genContent()
|
|
34
|
+
|
|
35
|
+
return this.$createElement('transition', {
|
|
36
|
+
props: {
|
|
37
|
+
name: this.transition
|
|
38
|
+
}
|
|
39
|
+
}, [this.genContent()])
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
genDirectives () {
|
|
43
|
+
// Do not add click outside for hover menu
|
|
44
|
+
const directives = !this.openOnHover ? [{
|
|
45
|
+
name: 'click-outside',
|
|
46
|
+
value: {
|
|
47
|
+
callback: () => this.closeOnClick,
|
|
48
|
+
include: () => [this.$el, ...this.getOpenDependentElements()]
|
|
49
|
+
}
|
|
50
|
+
}] : []
|
|
51
|
+
|
|
52
|
+
directives.push({
|
|
53
|
+
name: 'show',
|
|
54
|
+
value: this.isContentActive
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
return directives
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
genContent () {
|
|
61
|
+
const options = {
|
|
62
|
+
'class': [
|
|
63
|
+
(`menu__content ${this.contentClass}`).trim(),
|
|
64
|
+
{ 'menuable__content__active': this.isActive }
|
|
65
|
+
],
|
|
66
|
+
style: this.styles,
|
|
67
|
+
directives: this.genDirectives(),
|
|
68
|
+
ref: 'content',
|
|
69
|
+
on: {
|
|
70
|
+
click: e => {
|
|
71
|
+
e.stopPropagation()
|
|
72
|
+
if (e.target.getAttribute('disabled')) return
|
|
73
|
+
if (this.closeOnContentClick) this.isActive = false
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
!this.disabled && this.openOnHover && (options.on.mouseenter = this.mouseEnterHandler)
|
|
79
|
+
this.openOnHover && (options.on.mouseleave = this.mouseLeaveHandler)
|
|
80
|
+
|
|
81
|
+
return this.$createElement('div', options, this.showLazyContent(this.$slots.default))
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Menu keyable
|
|
3
|
+
*
|
|
4
|
+
* @mixin
|
|
5
|
+
*
|
|
6
|
+
* Primarily used to support KSelect
|
|
7
|
+
* Handles opening and closing of KMenu from keystrokes
|
|
8
|
+
* Will conditionally highlight KListTiles for KSelect
|
|
9
|
+
*/
|
|
10
|
+
export default {
|
|
11
|
+
data: () => ({
|
|
12
|
+
listIndex: -1,
|
|
13
|
+
tiles: []
|
|
14
|
+
}),
|
|
15
|
+
|
|
16
|
+
watch: {
|
|
17
|
+
isActive (val) {
|
|
18
|
+
if (!val) this.listIndex = -1
|
|
19
|
+
},
|
|
20
|
+
listIndex (next, prev) {
|
|
21
|
+
// For infinite scroll and autocomplete, re-evaluate children
|
|
22
|
+
this.getTiles()
|
|
23
|
+
|
|
24
|
+
if (next in this.tiles) {
|
|
25
|
+
this.tiles[next].classList.add('list__tile--highlighted')
|
|
26
|
+
this.$refs.content.scrollTop = next * 48
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
prev in this.tiles &&
|
|
30
|
+
this.tiles[prev].classList.remove('list__tile--highlighted')
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
methods: {
|
|
35
|
+
changeListIndex (e) {
|
|
36
|
+
// Up, Down, Enter, Space
|
|
37
|
+
if ([40, 38, 13].includes(e.keyCode) ||
|
|
38
|
+
e.keyCode === 32 && !this.isActive
|
|
39
|
+
) {
|
|
40
|
+
e.preventDefault()
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Esc, Tab
|
|
44
|
+
if ([27, 9].includes(e.keyCode)) return this.isActive = false
|
|
45
|
+
else if (!this.isActive &&
|
|
46
|
+
// Enter, Space
|
|
47
|
+
[13, 32].includes(e.keyCode) &&
|
|
48
|
+
this.openOnClick
|
|
49
|
+
) {
|
|
50
|
+
return this.isActive = true
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Down
|
|
54
|
+
if (e.keyCode === 40 && this.listIndex < this.tiles.length - 1) {
|
|
55
|
+
this.listIndex++
|
|
56
|
+
// Up
|
|
57
|
+
} else if (e.keyCode === 38 && this.listIndex > 0) {
|
|
58
|
+
this.listIndex--
|
|
59
|
+
// Enter
|
|
60
|
+
} else if (e.keyCode === 13 && this.listIndex !== -1) {
|
|
61
|
+
this.tiles[this.listIndex].click()
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
getTiles () {
|
|
65
|
+
this.tiles = this.$refs.content.querySelectorAll('.list__tile')
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Menu position
|
|
3
|
+
*
|
|
4
|
+
* @mixin
|
|
5
|
+
*
|
|
6
|
+
* Used for calculating an automatic position (used for KSelect)
|
|
7
|
+
* Will position the KMenu content properly over the KSelect
|
|
8
|
+
*/
|
|
9
|
+
export default {
|
|
10
|
+
methods: {
|
|
11
|
+
// Revisit this
|
|
12
|
+
calculateScroll () {
|
|
13
|
+
if (this.selectedIndex === null) return
|
|
14
|
+
|
|
15
|
+
let scrollTop = 0
|
|
16
|
+
|
|
17
|
+
if (this.selectedIndex >= this.stopIndex) {
|
|
18
|
+
scrollTop = this.$refs.content.scrollHeight
|
|
19
|
+
} else if (this.selectedIndex > this.startIndex) {
|
|
20
|
+
scrollTop = (
|
|
21
|
+
(this.selectedIndex * (this.defaultOffset * 6)) -
|
|
22
|
+
(this.defaultOffset * 7)
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
this.$refs.content.scrollTop = scrollTop
|
|
27
|
+
},
|
|
28
|
+
calcLeftAuto () {
|
|
29
|
+
const a = this.dimensions.activator
|
|
30
|
+
|
|
31
|
+
return parseInt(a.left - this.defaultOffset * 2)
|
|
32
|
+
},
|
|
33
|
+
calcTopAuto () {
|
|
34
|
+
if (!this.hasActivator) return this.calcTop()
|
|
35
|
+
|
|
36
|
+
const selectedIndex = Array.from(this.tiles)
|
|
37
|
+
.findIndex(n => n.classList.contains('list__tile--active'))
|
|
38
|
+
|
|
39
|
+
if (selectedIndex === -1) {
|
|
40
|
+
this.selectedIndex = null
|
|
41
|
+
|
|
42
|
+
return this.calcTop()
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
this.selectedIndex = selectedIndex
|
|
46
|
+
let actingIndex = selectedIndex
|
|
47
|
+
|
|
48
|
+
let offsetPadding = -(this.defaultOffset * 2)
|
|
49
|
+
// #708 Stop index should vary by tile length
|
|
50
|
+
this.stopIndex = this.tiles.length > 4
|
|
51
|
+
? this.tiles.length - 4
|
|
52
|
+
: this.tiles.length
|
|
53
|
+
|
|
54
|
+
if (selectedIndex > this.startIndex && selectedIndex < this.stopIndex) {
|
|
55
|
+
actingIndex = 2
|
|
56
|
+
offsetPadding = (this.defaultOffset * 3)
|
|
57
|
+
} else if (selectedIndex >= this.stopIndex) {
|
|
58
|
+
offsetPadding = -(this.defaultOffset)
|
|
59
|
+
actingIndex = selectedIndex - this.stopIndex
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Is always off by 1 pixel, send help (┛ಠ_ಠ)┛彡┻━┻
|
|
63
|
+
offsetPadding--
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
this.calcTop() +
|
|
67
|
+
offsetPadding -
|
|
68
|
+
(actingIndex * (this.defaultOffset * 6))
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
require('../../stylus/components/_navigation-drawer.styl')
|
|
2
|
+
|
|
3
|
+
import Applicationable from '../../mixins/applicationable'
|
|
4
|
+
import Overlayable from '../../mixins/overlayable'
|
|
5
|
+
import Themeable from '../../mixins/themeable'
|
|
6
|
+
|
|
7
|
+
import ClickOutside from '../../directives/click-outside'
|
|
8
|
+
import Resize from '../../directives/resize'
|
|
9
|
+
import Touch from '../../directives/touch'
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
name: 'k-navigation-drawer',
|
|
13
|
+
|
|
14
|
+
mixins: [Applicationable, Overlayable, Themeable],
|
|
15
|
+
|
|
16
|
+
directives: {
|
|
17
|
+
ClickOutside,
|
|
18
|
+
Resize,
|
|
19
|
+
Touch
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
data () {
|
|
23
|
+
return {
|
|
24
|
+
isActive: this.value,
|
|
25
|
+
isBooted: false,
|
|
26
|
+
isMobile: false,
|
|
27
|
+
touchArea: {
|
|
28
|
+
left: 0,
|
|
29
|
+
right: 0
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
props: {
|
|
35
|
+
absolute: Boolean,
|
|
36
|
+
clipped: Boolean,
|
|
37
|
+
disableRouteWatcher: Boolean,
|
|
38
|
+
enableResizeWatcher: Boolean,
|
|
39
|
+
height: String,
|
|
40
|
+
floating: Boolean,
|
|
41
|
+
miniVariant: Boolean,
|
|
42
|
+
miniVariantWidth: {
|
|
43
|
+
type: [Number, String],
|
|
44
|
+
default: 80
|
|
45
|
+
},
|
|
46
|
+
mobileBreakPoint: {
|
|
47
|
+
type: Number,
|
|
48
|
+
default: 1264
|
|
49
|
+
},
|
|
50
|
+
permanent: Boolean,
|
|
51
|
+
persistent: Boolean,
|
|
52
|
+
right: Boolean,
|
|
53
|
+
temporary: Boolean,
|
|
54
|
+
touchless: Boolean,
|
|
55
|
+
width: {
|
|
56
|
+
type: [Number, String],
|
|
57
|
+
default: 300
|
|
58
|
+
},
|
|
59
|
+
value: { required: false }
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
computed: {
|
|
63
|
+
calculatedHeight () {
|
|
64
|
+
return this.height || '100%'
|
|
65
|
+
},
|
|
66
|
+
calculatedWidth () {
|
|
67
|
+
return this.miniVariant
|
|
68
|
+
? this.miniVariantWidth
|
|
69
|
+
: this.width
|
|
70
|
+
},
|
|
71
|
+
classes () {
|
|
72
|
+
return {
|
|
73
|
+
'navigation-drawer': true,
|
|
74
|
+
'navigation-drawer--absolute': this.absolute,
|
|
75
|
+
'navigation-drawer--clipped': this.clipped,
|
|
76
|
+
'navigation-drawer--close': !this.isBooted || !this.isActive,
|
|
77
|
+
'navigation-drawer--floating': this.floating,
|
|
78
|
+
'navigation-drawer--is-booted': this.isBooted,
|
|
79
|
+
'navigation-drawer--is-mobile': this.isMobile,
|
|
80
|
+
'navigation-drawer--mini-variant': this.miniVariant,
|
|
81
|
+
'navigation-drawer--open': this.isActive && this.isBooted,
|
|
82
|
+
'navigation-drawer--permanent': this.permanent,
|
|
83
|
+
'navigation-drawer--persistent': this.persistent,
|
|
84
|
+
'navigation-drawer--right': this.right,
|
|
85
|
+
'navigation-drawer--temporary': this.temporary,
|
|
86
|
+
'theme--dark': this.dark,
|
|
87
|
+
'theme--light': this.light
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
marginTop () {
|
|
91
|
+
if (!this.app) return 0
|
|
92
|
+
let marginTop = this.$kdutify.application.bar
|
|
93
|
+
|
|
94
|
+
marginTop += this.clipped
|
|
95
|
+
? this.$kdutify.application.top
|
|
96
|
+
: 0
|
|
97
|
+
|
|
98
|
+
return marginTop
|
|
99
|
+
},
|
|
100
|
+
maxHeight () {
|
|
101
|
+
if (!this.app) return '100%'
|
|
102
|
+
|
|
103
|
+
return this.clipped
|
|
104
|
+
? this.$kdutify.application.top + this.$kdutify.application.bottom
|
|
105
|
+
: this.$kdutify.application.bottom
|
|
106
|
+
},
|
|
107
|
+
showOverlay () {
|
|
108
|
+
return !this.permanent &&
|
|
109
|
+
this.isActive &&
|
|
110
|
+
(this.temporary || this.isMobile)
|
|
111
|
+
},
|
|
112
|
+
styles () {
|
|
113
|
+
return {
|
|
114
|
+
height: this.calculatedHeight,
|
|
115
|
+
marginTop: `${this.marginTop}px`,
|
|
116
|
+
maxHeight: `calc(100% - ${this.maxHeight}px)`,
|
|
117
|
+
width: `${this.calculatedWidth}px`
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
watch: {
|
|
123
|
+
$route () {
|
|
124
|
+
if (!this.disableRouteWatcher) {
|
|
125
|
+
this.isActive = !this.closeConditional()
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
isActive (val) {
|
|
129
|
+
this.$emit('input', val)
|
|
130
|
+
this.showOverlay &&
|
|
131
|
+
val &&
|
|
132
|
+
this.genOverlay() ||
|
|
133
|
+
this.removeOverlay()
|
|
134
|
+
this.$el.scrollTop = 0
|
|
135
|
+
},
|
|
136
|
+
isMobile (val) {
|
|
137
|
+
!val && this.removeOverlay()
|
|
138
|
+
},
|
|
139
|
+
permanent (val) {
|
|
140
|
+
this.$emit('input', val)
|
|
141
|
+
},
|
|
142
|
+
value (val) {
|
|
143
|
+
if (this.permanent) return
|
|
144
|
+
if (val !== this.isActive) this.isActive = val
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
mounted () {
|
|
149
|
+
this.$kdutify.load(this.init)
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
methods: {
|
|
153
|
+
init () {
|
|
154
|
+
if (this.value != null) this.isActive = this.value
|
|
155
|
+
else if (this.permanent) this.isActive = true
|
|
156
|
+
else if (this.isMobile) this.isActive = false
|
|
157
|
+
else if (!this.value &&
|
|
158
|
+
(this.persistent || this.temporary)
|
|
159
|
+
) this.isActive = false
|
|
160
|
+
else this.isActive = true
|
|
161
|
+
|
|
162
|
+
setTimeout(() => (this.isBooted = true), 0)
|
|
163
|
+
},
|
|
164
|
+
calculateTouchArea () {
|
|
165
|
+
if (!this.$el.parentNode) return
|
|
166
|
+
const parentRect = this.$el.parentNode.getBoundingClientRect()
|
|
167
|
+
|
|
168
|
+
this.touchArea = {
|
|
169
|
+
left: parentRect.left + 50,
|
|
170
|
+
right: parentRect.right - 50
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
checkIfMobile () {
|
|
174
|
+
this.isMobile = window.innerWidth < parseInt(this.mobileBreakPoint)
|
|
175
|
+
},
|
|
176
|
+
closeConditional () {
|
|
177
|
+
return !this.permanent && (this.temporary || this.isMobile)
|
|
178
|
+
},
|
|
179
|
+
genDirectives () {
|
|
180
|
+
const directives = [
|
|
181
|
+
{
|
|
182
|
+
name: 'click-outside',
|
|
183
|
+
value: this.closeConditional
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: 'resize',
|
|
187
|
+
value: this.onResize
|
|
188
|
+
}
|
|
189
|
+
]
|
|
190
|
+
|
|
191
|
+
!this.touchless && directives.push({
|
|
192
|
+
name: 'touch',
|
|
193
|
+
value: {
|
|
194
|
+
parent: true,
|
|
195
|
+
left: this.swipeLeft,
|
|
196
|
+
right: this.swipeRight
|
|
197
|
+
}
|
|
198
|
+
})
|
|
199
|
+
|
|
200
|
+
return directives
|
|
201
|
+
},
|
|
202
|
+
onResize () {
|
|
203
|
+
if (!this.enableResizeWatcher ||
|
|
204
|
+
this.permanent ||
|
|
205
|
+
this.temporary
|
|
206
|
+
) return
|
|
207
|
+
|
|
208
|
+
this.checkIfMobile()
|
|
209
|
+
|
|
210
|
+
this.isActive = !this.isMobile
|
|
211
|
+
},
|
|
212
|
+
swipeRight (e) {
|
|
213
|
+
if (this.isActive && !this.right) return
|
|
214
|
+
this.calculateTouchArea()
|
|
215
|
+
|
|
216
|
+
if (Math.abs(e.touchendX - e.touchstartX) < 100) return
|
|
217
|
+
else if (!this.right &&
|
|
218
|
+
e.touchstartX <= this.touchArea.left
|
|
219
|
+
) this.isActive = true
|
|
220
|
+
else if (this.right && this.isActive) this.isActive = false
|
|
221
|
+
},
|
|
222
|
+
swipeLeft (e) {
|
|
223
|
+
if (this.isActive && this.right) return
|
|
224
|
+
this.calculateTouchArea()
|
|
225
|
+
|
|
226
|
+
if (Math.abs(e.touchendX - e.touchstartX) < 100) return
|
|
227
|
+
else if (this.right &&
|
|
228
|
+
e.touchstartX >= this.touchArea.right
|
|
229
|
+
) this.isActive = true
|
|
230
|
+
else if (!this.right && this.isActive) this.isActive = false
|
|
231
|
+
},
|
|
232
|
+
updateApplication () {
|
|
233
|
+
if (!this.app) return
|
|
234
|
+
|
|
235
|
+
const width = !this.isActive ||
|
|
236
|
+
!this.isBooted ||
|
|
237
|
+
!this.permanent &&
|
|
238
|
+
this.$kdutify.breakpoint.width < this.mobileBreakPoint
|
|
239
|
+
? 0
|
|
240
|
+
: this.calculatedWidth
|
|
241
|
+
|
|
242
|
+
if (this.right) {
|
|
243
|
+
this.$kdutify.application.right = width
|
|
244
|
+
} else {
|
|
245
|
+
this.$kdutify.application.left = width
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
|
|
250
|
+
render (h) {
|
|
251
|
+
this.updateApplication()
|
|
252
|
+
|
|
253
|
+
const data = {
|
|
254
|
+
'class': this.classes,
|
|
255
|
+
style: this.styles,
|
|
256
|
+
directives: this.genDirectives(),
|
|
257
|
+
on: {
|
|
258
|
+
click: () => this.$emit('update:miniVariant', false)
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return h('aside', data, [
|
|
263
|
+
this.$slots.default,
|
|
264
|
+
h('div', { 'class': 'navigation-drawer__border' })
|
|
265
|
+
])
|
|
266
|
+
}
|
|
267
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
require('../../stylus/components/_pagination.styl')
|
|
2
|
+
|
|
3
|
+
import KIcon from '../KIcon'
|
|
4
|
+
|
|
5
|
+
import Resize from '../../directives/resize'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
name: 'k-pagination',
|
|
9
|
+
|
|
10
|
+
directives: { Resize },
|
|
11
|
+
|
|
12
|
+
props: {
|
|
13
|
+
circle: Boolean,
|
|
14
|
+
disabled: Boolean,
|
|
15
|
+
length: {
|
|
16
|
+
type: Number,
|
|
17
|
+
default: 0,
|
|
18
|
+
validator: val => val % 1 === 0
|
|
19
|
+
},
|
|
20
|
+
totalVisible: [Number, String],
|
|
21
|
+
nextIcon: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: 'chevron_right'
|
|
24
|
+
},
|
|
25
|
+
prevIcon: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: 'chevron_left'
|
|
28
|
+
},
|
|
29
|
+
value: {
|
|
30
|
+
type: Number,
|
|
31
|
+
default: 0
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
data () {
|
|
36
|
+
return {
|
|
37
|
+
maxButtons: 0
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
watch: {
|
|
42
|
+
value () {
|
|
43
|
+
this.init()
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
computed: {
|
|
48
|
+
classes () {
|
|
49
|
+
return {
|
|
50
|
+
'pagination': true,
|
|
51
|
+
'pagination--circle': this.circle,
|
|
52
|
+
'pagination--disabled': this.disabled
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
items () {
|
|
57
|
+
const maxLength = this.totalVisible || this.maxButtons
|
|
58
|
+
if (this.length <= maxLength) {
|
|
59
|
+
return this.range(1, this.length)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const even = maxLength % 2 === 0 ? 1 : 0
|
|
63
|
+
const left = Math.floor(maxLength / 2)
|
|
64
|
+
const right = this.length - left + 1 + even
|
|
65
|
+
|
|
66
|
+
if (this.value >= left && this.value <= right) {
|
|
67
|
+
const start = this.value - left + 2
|
|
68
|
+
const end = this.value + left - 2 - even
|
|
69
|
+
|
|
70
|
+
return [1, '...', ...this.range(start, end), '...', this.length]
|
|
71
|
+
} else {
|
|
72
|
+
return [
|
|
73
|
+
...this.range(1, left),
|
|
74
|
+
'...',
|
|
75
|
+
...this.range(this.length - left + 1 + even, this.length)
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
mounted () {
|
|
82
|
+
this.$kdutify.load.call(this, this.init)
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
methods: {
|
|
86
|
+
onResize () {
|
|
87
|
+
const width = this.$el && this.$el.parentNode
|
|
88
|
+
? this.$el.parentNode.clientWidth
|
|
89
|
+
: window.innerWidth
|
|
90
|
+
|
|
91
|
+
this.maxButtons = Math.floor((width - 96) / 42)
|
|
92
|
+
},
|
|
93
|
+
init () {
|
|
94
|
+
this.selected = null
|
|
95
|
+
|
|
96
|
+
// Change this
|
|
97
|
+
setTimeout(() => (this.selected = this.value), 100)
|
|
98
|
+
},
|
|
99
|
+
next (e) {
|
|
100
|
+
e.preventDefault()
|
|
101
|
+
this.$emit('input', this.value + 1)
|
|
102
|
+
this.$emit('next')
|
|
103
|
+
},
|
|
104
|
+
previous (e) {
|
|
105
|
+
e.preventDefault()
|
|
106
|
+
this.$emit('input', this.value - 1)
|
|
107
|
+
this.$emit('previous')
|
|
108
|
+
},
|
|
109
|
+
range (from, to) {
|
|
110
|
+
const range = []
|
|
111
|
+
|
|
112
|
+
from = from > 0 ? from : 1
|
|
113
|
+
|
|
114
|
+
for (let i = from; i <= to; i++) {
|
|
115
|
+
range.push(i)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return range
|
|
119
|
+
},
|
|
120
|
+
genIcon (h, icon, disabled, fn) {
|
|
121
|
+
return h('li', [
|
|
122
|
+
h('a', {
|
|
123
|
+
class: {
|
|
124
|
+
'pagination__navigation': true,
|
|
125
|
+
'pagination__navigation--disabled': disabled
|
|
126
|
+
},
|
|
127
|
+
attrs: { href: '#!' },
|
|
128
|
+
on: { click: fn }
|
|
129
|
+
}, [h(KIcon, [icon])])
|
|
130
|
+
])
|
|
131
|
+
},
|
|
132
|
+
genItem (h, i) {
|
|
133
|
+
return h('a', {
|
|
134
|
+
class: {
|
|
135
|
+
'pagination__item': true,
|
|
136
|
+
'pagination__item--active': i === this.value
|
|
137
|
+
},
|
|
138
|
+
attrs: { href: '#!' },
|
|
139
|
+
on: {
|
|
140
|
+
click: (e) => {
|
|
141
|
+
e.preventDefault()
|
|
142
|
+
this.$emit('input', i)
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}, [i])
|
|
146
|
+
},
|
|
147
|
+
genItems (h) {
|
|
148
|
+
return this.items.map((i) => {
|
|
149
|
+
return h('li', [
|
|
150
|
+
isNaN(i) && h('span', { class: 'pagination__more' }, [i]) || this.genItem(h, i)
|
|
151
|
+
])
|
|
152
|
+
})
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
render (h) {
|
|
157
|
+
const children = [
|
|
158
|
+
this.genIcon(h, this.prevIcon, this.value === 1, this.previous),
|
|
159
|
+
this.genItems(h),
|
|
160
|
+
this.genIcon(h, this.nextIcon, this.value === this.length, this.next)
|
|
161
|
+
]
|
|
162
|
+
|
|
163
|
+
return h('ul', {
|
|
164
|
+
directives: [{ name: 'resize', value: this.onResize }],
|
|
165
|
+
class: this.classes
|
|
166
|
+
}, children)
|
|
167
|
+
}
|
|
168
|
+
}
|