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,202 @@
|
|
|
1
|
+
import KIcon from '../KIcon'
|
|
2
|
+
|
|
3
|
+
import Resize from '../../directives/resize'
|
|
4
|
+
import Touch from '../../directives/touch'
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
name: 'k-tabs-bar',
|
|
8
|
+
|
|
9
|
+
directives: {
|
|
10
|
+
Resize,
|
|
11
|
+
Touch
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
provide () {
|
|
15
|
+
return {
|
|
16
|
+
addTabItem: (action, toggle, el) => {
|
|
17
|
+
this.registerTabItem(action, toggle, el)
|
|
18
|
+
this.onResize()
|
|
19
|
+
},
|
|
20
|
+
removeTabItem: (action) => {
|
|
21
|
+
this.unregisterTabItem(action)
|
|
22
|
+
this.onResize()
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
inject: ['isScrollable', 'isMobile', 'registerTabItem', 'unregisterTabItem'],
|
|
28
|
+
|
|
29
|
+
data () {
|
|
30
|
+
return {
|
|
31
|
+
isOverflowing: false,
|
|
32
|
+
scrollOffset: 0,
|
|
33
|
+
itemOffset: 0,
|
|
34
|
+
startX: 0
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
computed: {
|
|
39
|
+
classes () {
|
|
40
|
+
return {
|
|
41
|
+
'tabs__bar': true
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
containerClasses () {
|
|
45
|
+
return {
|
|
46
|
+
'tabs__container': true
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
wrapperClasses () {
|
|
50
|
+
return {
|
|
51
|
+
'tabs__wrapper': true,
|
|
52
|
+
'tabs__wrapper--scrollable': this.isScrollable(),
|
|
53
|
+
'tabs__wrapper--overflow': this.isOverflowing
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
containerStyles () {
|
|
57
|
+
return {
|
|
58
|
+
'transform': `translateX(${-this.scrollOffset}px)`
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
leftIconVisible () {
|
|
62
|
+
return !this.isMobile() &&
|
|
63
|
+
this.isScrollable() &&
|
|
64
|
+
this.isOverflowing &&
|
|
65
|
+
this.scrollOffset > 0
|
|
66
|
+
},
|
|
67
|
+
rightIconVisible () {
|
|
68
|
+
if (this.isMobile() ||
|
|
69
|
+
!this.isScrollable() ||
|
|
70
|
+
!this.isOverflowing) return
|
|
71
|
+
|
|
72
|
+
// Check one scroll ahead to know the width of right-most item
|
|
73
|
+
const container = this.$refs.container
|
|
74
|
+
const item = this.newOffsetRight(this.scrollOffset, this.itemOffset)
|
|
75
|
+
const itemWidth = item && container.children[item.index].clientWidth || 0
|
|
76
|
+
const scrollOffset = this.scrollOffset + container.clientWidth
|
|
77
|
+
|
|
78
|
+
return container.scrollWidth - scrollOffset > itemWidth * 0.30
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
methods: {
|
|
83
|
+
genContainer () {
|
|
84
|
+
return this.$createElement('ul', {
|
|
85
|
+
'class': this.containerClasses,
|
|
86
|
+
'style': this.containerStyles,
|
|
87
|
+
ref: 'container'
|
|
88
|
+
}, this.$slots.default)
|
|
89
|
+
},
|
|
90
|
+
genIcon (direction) {
|
|
91
|
+
const capitalize = direction.charAt(0).toUpperCase() + direction.slice(1)
|
|
92
|
+
return this.$createElement(KIcon, {
|
|
93
|
+
props: { [`${direction}`]: true },
|
|
94
|
+
style: { display: 'inline-flex' },
|
|
95
|
+
on: {
|
|
96
|
+
click: this[`scroll${capitalize}`]
|
|
97
|
+
}
|
|
98
|
+
}, `chevron_${direction}`)
|
|
99
|
+
},
|
|
100
|
+
genWrapper () {
|
|
101
|
+
return this.$createElement('div', {
|
|
102
|
+
class: this.wrapperClasses,
|
|
103
|
+
directives: [{
|
|
104
|
+
name: 'touch',
|
|
105
|
+
value: {
|
|
106
|
+
start: this.start,
|
|
107
|
+
move: this.move,
|
|
108
|
+
end: this.end
|
|
109
|
+
}
|
|
110
|
+
}]
|
|
111
|
+
}, [this.genContainer()])
|
|
112
|
+
},
|
|
113
|
+
start (e) {
|
|
114
|
+
this.startX = this.scrollOffset + e.touchstartX
|
|
115
|
+
this.$refs.container.style.transition = 'none'
|
|
116
|
+
},
|
|
117
|
+
move (e) {
|
|
118
|
+
const offset = this.startX - e.touchmoveX
|
|
119
|
+
this.scrollOffset = offset
|
|
120
|
+
},
|
|
121
|
+
end (e) {
|
|
122
|
+
this.onResize()
|
|
123
|
+
const container = this.$refs.container
|
|
124
|
+
const scrollWidth = container.scrollWidth - this.$el.clientWidth / 2
|
|
125
|
+
container.style.transition = null
|
|
126
|
+
|
|
127
|
+
if (this.scrollOffset < 0 || !this.isOverflowing) {
|
|
128
|
+
this.scrollOffset = 0
|
|
129
|
+
} else if (this.scrollOffset >= scrollWidth) {
|
|
130
|
+
const lastItem = container.children[container.children.length - 1]
|
|
131
|
+
this.scrollOffset = scrollWidth - lastItem.clientWidth
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
scrollLeft () {
|
|
135
|
+
const { offset, index } = this.newOffset('Left')
|
|
136
|
+
this.scrollOffset = offset
|
|
137
|
+
this.itemOffset = index
|
|
138
|
+
},
|
|
139
|
+
scrollRight () {
|
|
140
|
+
const { offset, index } = this.newOffset('Right')
|
|
141
|
+
this.scrollOffset = offset
|
|
142
|
+
this.itemOffset = index
|
|
143
|
+
},
|
|
144
|
+
onResize () {
|
|
145
|
+
if (this._isDestroyed) return
|
|
146
|
+
|
|
147
|
+
const container = this.$refs.container
|
|
148
|
+
this.isOverflowing = container.clientWidth < container.scrollWidth
|
|
149
|
+
},
|
|
150
|
+
newOffset (direction) {
|
|
151
|
+
return this[`newOffset${direction}`](this.scrollOffset, this.itemOffset)
|
|
152
|
+
},
|
|
153
|
+
newOffsetLeft (currentOffset, currentIndex) {
|
|
154
|
+
const container = this.$refs.container
|
|
155
|
+
const items = container.children
|
|
156
|
+
let offset = 0
|
|
157
|
+
|
|
158
|
+
for (let index = currentIndex - 1; index >= 0; index--) {
|
|
159
|
+
if (!items[index].classList.contains('tabs__slider')) {
|
|
160
|
+
const newOffset = offset + items[index].clientWidth
|
|
161
|
+
if (newOffset >= container.clientWidth) {
|
|
162
|
+
return { offset: currentOffset - offset, index: index + 1 }
|
|
163
|
+
}
|
|
164
|
+
offset = newOffset
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return { offset: 0, index: 0 }
|
|
169
|
+
},
|
|
170
|
+
newOffsetRight (currentOffset, currentIndex) {
|
|
171
|
+
const container = this.$refs.container
|
|
172
|
+
const items = container.children
|
|
173
|
+
let offset = currentOffset
|
|
174
|
+
|
|
175
|
+
for (let index = currentIndex; index < items.length; index++) {
|
|
176
|
+
if (!items[index].classList.contains('tabs__slider')) {
|
|
177
|
+
const newOffset = offset + items[index].clientWidth
|
|
178
|
+
if (newOffset > currentOffset + container.clientWidth) {
|
|
179
|
+
return { offset, index }
|
|
180
|
+
}
|
|
181
|
+
offset = newOffset
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return null
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
render (h) {
|
|
190
|
+
return h('div', {
|
|
191
|
+
'class': this.classes,
|
|
192
|
+
directives: [{
|
|
193
|
+
name: 'resize',
|
|
194
|
+
value: this.onResize
|
|
195
|
+
}]
|
|
196
|
+
}, [
|
|
197
|
+
this.genWrapper(),
|
|
198
|
+
this.leftIconVisible ? this.genIcon('left') : null,
|
|
199
|
+
this.rightIconVisible ? this.genIcon('right') : null
|
|
200
|
+
])
|
|
201
|
+
}
|
|
202
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import Bootable from '../../mixins/bootable'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
KTabTransition,
|
|
5
|
+
KTabReverseTransition
|
|
6
|
+
} from '../transitions'
|
|
7
|
+
|
|
8
|
+
import Touch from '../../directives/touch'
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
name: 'k-tabs-content',
|
|
12
|
+
|
|
13
|
+
mixins: [Bootable],
|
|
14
|
+
|
|
15
|
+
inject: ['registerContent', 'unregisterContent'],
|
|
16
|
+
|
|
17
|
+
components: {
|
|
18
|
+
KTabTransition,
|
|
19
|
+
KTabReverseTransition
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
directives: {
|
|
23
|
+
Touch
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
data () {
|
|
27
|
+
return {
|
|
28
|
+
isActive: false,
|
|
29
|
+
reverse: false
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
props: {
|
|
34
|
+
id: {
|
|
35
|
+
type: String,
|
|
36
|
+
required: true
|
|
37
|
+
},
|
|
38
|
+
transition: {
|
|
39
|
+
type: [Boolean, String],
|
|
40
|
+
default: 'tab-transition'
|
|
41
|
+
},
|
|
42
|
+
reverseTransition: {
|
|
43
|
+
type: [Boolean, String],
|
|
44
|
+
default: 'tab-reverse-transition'
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
computed: {
|
|
49
|
+
computedTransition () {
|
|
50
|
+
return this.reverse ? this.reverseTransition : this.transition
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
methods: {
|
|
55
|
+
toggle (target, reverse, showTransition) {
|
|
56
|
+
this.$el.style.transition = !showTransition ? 'none' : null
|
|
57
|
+
this.reverse = reverse
|
|
58
|
+
this.isActive = this.id === target
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
mounted () {
|
|
63
|
+
this.registerContent(this.id, this.toggle)
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
beforeDestroy () {
|
|
67
|
+
this.unregisterContent(this.id)
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
render (h) {
|
|
71
|
+
const data = {
|
|
72
|
+
staticClass: 'tabs__content',
|
|
73
|
+
directives: [{
|
|
74
|
+
name: 'show',
|
|
75
|
+
value: this.isActive
|
|
76
|
+
}],
|
|
77
|
+
on: this.$listeners
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (this.id) data.domProps = { id: this.id }
|
|
81
|
+
|
|
82
|
+
const div = h('div', data, this.showLazyContent(this.$slots.default))
|
|
83
|
+
|
|
84
|
+
if (!this.computedTransition) return div
|
|
85
|
+
|
|
86
|
+
return h('transition', {
|
|
87
|
+
props: { name: this.computedTransition }
|
|
88
|
+
}, [div])
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import Routable from '../../mixins/routable'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
name: 'k-tabs-item',
|
|
5
|
+
|
|
6
|
+
inject: ['slider', 'tabClick', 'addTabItem', 'removeTabItem'],
|
|
7
|
+
|
|
8
|
+
mixins: [Routable],
|
|
9
|
+
|
|
10
|
+
data () {
|
|
11
|
+
return {
|
|
12
|
+
isActive: false
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
props: {
|
|
17
|
+
activeClass: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: 'tabs__item--active'
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
computed: {
|
|
24
|
+
classes () {
|
|
25
|
+
const classes = {
|
|
26
|
+
'tabs__item': true,
|
|
27
|
+
'tabs__item--disabled': this.disabled
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
classes[this.activeClass] = !this.to && this.isActive
|
|
31
|
+
|
|
32
|
+
return classes
|
|
33
|
+
},
|
|
34
|
+
action () {
|
|
35
|
+
const to = this.to || this.href
|
|
36
|
+
|
|
37
|
+
if (!to || to === Object(to)) return this._uid
|
|
38
|
+
|
|
39
|
+
return to.replace('#', '')
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
watch: {
|
|
44
|
+
$route () {
|
|
45
|
+
this.to && this.callSlider()
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
mounted () {
|
|
50
|
+
this.addTabItem(this.action, this.toggle, this.$el)
|
|
51
|
+
this.callSlider()
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
beforeDestroy () {
|
|
55
|
+
this.removeTabItem(this.action)
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
methods: {
|
|
59
|
+
callSlider () {
|
|
60
|
+
setTimeout(() => {
|
|
61
|
+
this.$el.firstChild.classList.contains('tabs__item--active') &&
|
|
62
|
+
this.slider(this.$el)
|
|
63
|
+
}, 0)
|
|
64
|
+
},
|
|
65
|
+
click (e) {
|
|
66
|
+
e.preventDefault()
|
|
67
|
+
this.$emit('click', e)
|
|
68
|
+
|
|
69
|
+
if (!this.to && !this.href) return
|
|
70
|
+
|
|
71
|
+
if (!this.to) {
|
|
72
|
+
this.tabClick(this.action)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
this.callSlider()
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
toggle (action) {
|
|
79
|
+
this.isActive = this.action === action
|
|
80
|
+
|
|
81
|
+
this.$nextTick(() => {
|
|
82
|
+
this.isActive && this.slider(this.$el)
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
render (h) {
|
|
88
|
+
const link = this.generateRouteLink()
|
|
89
|
+
const { data } = link
|
|
90
|
+
|
|
91
|
+
// If disabled, use div as anchor tags do not support
|
|
92
|
+
// being disabled
|
|
93
|
+
const tag = this.disabled ? 'div' : link.tag
|
|
94
|
+
|
|
95
|
+
return h('li', {
|
|
96
|
+
'class': 'tabs__li'
|
|
97
|
+
}, [h(tag, data, this.$slots.default)])
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import Touch from '../../directives/touch'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
name: 'k-tabs-items',
|
|
5
|
+
|
|
6
|
+
directives: { Touch },
|
|
7
|
+
|
|
8
|
+
inject: ['next', 'prev'],
|
|
9
|
+
|
|
10
|
+
props: {
|
|
11
|
+
cycle: Boolean,
|
|
12
|
+
touchless: Boolean
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
methods: {
|
|
16
|
+
swipeLeft () {
|
|
17
|
+
this.next(this.cycle)
|
|
18
|
+
},
|
|
19
|
+
swipeRight () {
|
|
20
|
+
this.prev(this.cycle)
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
render (h) {
|
|
25
|
+
const data = {
|
|
26
|
+
staticClass: 'tabs__items',
|
|
27
|
+
directives: []
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
!this.touchless && data.directives.push({
|
|
31
|
+
name: 'touch',
|
|
32
|
+
value: {
|
|
33
|
+
left: this.swipeLeft,
|
|
34
|
+
right: this.swipeRight
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
return h('div', data, this.$slots.default)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import KTabs from './KTabs'
|
|
2
|
+
import KTabsBar from './KTabsBar'
|
|
3
|
+
import KTabsContent from './KTabsContent'
|
|
4
|
+
import KTabsItem from './KTabsItem'
|
|
5
|
+
import KTabsItems from './KTabsItems'
|
|
6
|
+
import KTabsSlider from './KTabsSlider'
|
|
7
|
+
|
|
8
|
+
KTabs.install = function install (Kdu) {
|
|
9
|
+
Kdu.component(KTabs.name, KTabs)
|
|
10
|
+
Kdu.component(KTabsBar.name, KTabsBar)
|
|
11
|
+
Kdu.component(KTabsContent.name, KTabsContent)
|
|
12
|
+
Kdu.component(KTabsItem.name, KTabsItem)
|
|
13
|
+
Kdu.component(KTabsItems.name, KTabsItems)
|
|
14
|
+
Kdu.component(KTabsSlider.name, KTabsSlider)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default KTabs
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
require('../../stylus/components/_input-groups.styl')
|
|
2
|
+
require('../../stylus/components/_text-fields.styl')
|
|
3
|
+
|
|
4
|
+
import Colorable from '../../mixins/colorable'
|
|
5
|
+
import Input from '../../mixins/input'
|
|
6
|
+
import Maskable from '../../mixins/maskable'
|
|
7
|
+
import { isMaskDelimiter } from '../../util/mask'
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
name: 'k-text-field',
|
|
11
|
+
|
|
12
|
+
mixins: [Colorable, Input, Maskable],
|
|
13
|
+
|
|
14
|
+
inheritAttrs: false,
|
|
15
|
+
|
|
16
|
+
data () {
|
|
17
|
+
return {
|
|
18
|
+
initialValue: null,
|
|
19
|
+
inputHeight: null,
|
|
20
|
+
badInput: false,
|
|
21
|
+
lazySelection: 0
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
props: {
|
|
26
|
+
autofocus: Boolean,
|
|
27
|
+
autoGrow: Boolean,
|
|
28
|
+
box: Boolean,
|
|
29
|
+
clearable: Boolean,
|
|
30
|
+
color: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: 'primary'
|
|
33
|
+
},
|
|
34
|
+
counter: [Boolean, Number, String],
|
|
35
|
+
fullWidth: Boolean,
|
|
36
|
+
multiLine: Boolean,
|
|
37
|
+
placeholder: String,
|
|
38
|
+
prefix: String,
|
|
39
|
+
rows: {
|
|
40
|
+
default: 5
|
|
41
|
+
},
|
|
42
|
+
singleLine: Boolean,
|
|
43
|
+
solo: Boolean,
|
|
44
|
+
suffix: String,
|
|
45
|
+
textarea: Boolean,
|
|
46
|
+
type: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: 'text'
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
computed: {
|
|
53
|
+
classes () {
|
|
54
|
+
const classes = {
|
|
55
|
+
'input-group--text-field': true,
|
|
56
|
+
'input-group--text-field-box': this.box,
|
|
57
|
+
'input-group--single-line': this.singleLine || this.solo,
|
|
58
|
+
'input-group--solo': this.solo,
|
|
59
|
+
'input-group--multi-line': this.multiLine,
|
|
60
|
+
'input-group--full-width': this.fullWidth,
|
|
61
|
+
'input-group--prefix': this.prefix,
|
|
62
|
+
'input-group--suffix': this.suffix,
|
|
63
|
+
'input-group--textarea': this.textarea
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (this.hasError) {
|
|
67
|
+
classes['error--text'] = true
|
|
68
|
+
} else {
|
|
69
|
+
return this.addTextColorClassChecks(classes)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return classes
|
|
73
|
+
},
|
|
74
|
+
count () {
|
|
75
|
+
let inputLength
|
|
76
|
+
if (this.inputValue) inputLength = this.inputValue.toString().length
|
|
77
|
+
else inputLength = 0
|
|
78
|
+
|
|
79
|
+
return `${inputLength} / ${this.counterLength}`
|
|
80
|
+
},
|
|
81
|
+
counterLength () {
|
|
82
|
+
const parsedLength = parseInt(this.counter, 10)
|
|
83
|
+
return isNaN(parsedLength) ? 25 : parsedLength
|
|
84
|
+
},
|
|
85
|
+
inputValue: {
|
|
86
|
+
get () {
|
|
87
|
+
return this.value
|
|
88
|
+
},
|
|
89
|
+
set (val) {
|
|
90
|
+
this.lazyValue = val
|
|
91
|
+
this.mask && this.setSelectionRange()
|
|
92
|
+
this.$emit('input', val)
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
isDirty () {
|
|
96
|
+
return this.lazyValue != null &&
|
|
97
|
+
this.lazyValue.toString().length > 0 ||
|
|
98
|
+
this.badInput ||
|
|
99
|
+
['time', 'date', 'datetime-local', 'week', 'month'].includes(this.type)
|
|
100
|
+
},
|
|
101
|
+
shouldAutoGrow () {
|
|
102
|
+
return (this.multiLine || this.textarea) && this.autoGrow
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
watch: {
|
|
107
|
+
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 (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 () {
|
|
124
|
+
this.$kdutify.load(() => {
|
|
125
|
+
this.shouldAutoGrow && this.calculateInputHeight()
|
|
126
|
+
this.autofocus && this.focus()
|
|
127
|
+
})
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
methods: {
|
|
131
|
+
calculateInputHeight () {
|
|
132
|
+
this.inputHeight = null
|
|
133
|
+
|
|
134
|
+
this.$nextTick(() => {
|
|
135
|
+
const height = this.$refs.input
|
|
136
|
+
? this.$refs.input.scrollHeight
|
|
137
|
+
: 0
|
|
138
|
+
const minHeight = this.rows * 24
|
|
139
|
+
const inputHeight = height < minHeight ? minHeight : height
|
|
140
|
+
this.inputHeight = inputHeight + (this.textarea ? 4 : 0)
|
|
141
|
+
})
|
|
142
|
+
},
|
|
143
|
+
onInput (e) {
|
|
144
|
+
this.resetSelections(e.target)
|
|
145
|
+
this.inputValue = this.unmaskText(e.target.value)
|
|
146
|
+
this.badInput = e.target.validity && e.target.validity.badInput
|
|
147
|
+
this.shouldAutoGrow && this.calculateInputHeight()
|
|
148
|
+
},
|
|
149
|
+
blur (e) {
|
|
150
|
+
this.isFocused = false
|
|
151
|
+
|
|
152
|
+
this.$nextTick(() => {
|
|
153
|
+
this.validate()
|
|
154
|
+
})
|
|
155
|
+
this.$emit('blur', e)
|
|
156
|
+
},
|
|
157
|
+
focus (e) {
|
|
158
|
+
if (!this.$refs.input) return
|
|
159
|
+
|
|
160
|
+
this.isFocused = true
|
|
161
|
+
if (document.activeElement !== this.$refs.input) {
|
|
162
|
+
this.$refs.input.focus()
|
|
163
|
+
}
|
|
164
|
+
this.$emit('focus', e)
|
|
165
|
+
},
|
|
166
|
+
genCounter () {
|
|
167
|
+
return this.$createElement('div', {
|
|
168
|
+
'class': {
|
|
169
|
+
'input-group__counter': true,
|
|
170
|
+
'input-group__counter--error': this.hasError
|
|
171
|
+
}
|
|
172
|
+
}, this.count)
|
|
173
|
+
},
|
|
174
|
+
genInput () {
|
|
175
|
+
const tag = this.multiLine || this.textarea ? 'textarea' : 'input'
|
|
176
|
+
const listeners = Object.assign({}, this.$listeners)
|
|
177
|
+
delete listeners['change'] // Change should not be bound externally
|
|
178
|
+
|
|
179
|
+
const data = {
|
|
180
|
+
style: {},
|
|
181
|
+
domProps: {
|
|
182
|
+
autofocus: this.autofocus,
|
|
183
|
+
disabled: this.disabled,
|
|
184
|
+
required: this.required,
|
|
185
|
+
value: this.maskText(this.lazyValue)
|
|
186
|
+
},
|
|
187
|
+
attrs: {
|
|
188
|
+
...this.$attrs,
|
|
189
|
+
readonly: this.readonly,
|
|
190
|
+
tabindex: this.tabindex,
|
|
191
|
+
'aria-label': (!this.$attrs || !this.$attrs.id) && this.label // Label `for` will be set if we have an id
|
|
192
|
+
},
|
|
193
|
+
on: Object.assign(listeners, {
|
|
194
|
+
blur: this.blur,
|
|
195
|
+
input: this.onInput,
|
|
196
|
+
focus: this.focus
|
|
197
|
+
}),
|
|
198
|
+
ref: 'input'
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (this.shouldAutoGrow) {
|
|
202
|
+
data.style.height = this.inputHeight && `${this.inputHeight}px`
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (this.placeholder) data.domProps.placeholder = this.placeholder
|
|
206
|
+
|
|
207
|
+
if (!this.textarea && !this.multiLine) {
|
|
208
|
+
data.domProps.type = this.type
|
|
209
|
+
} else {
|
|
210
|
+
data.domProps.rows = this.rows
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (this.mask) {
|
|
214
|
+
data.attrs.maxlength = this.masked.length
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const children = [this.$createElement(tag, data)]
|
|
218
|
+
|
|
219
|
+
this.prefix && children.unshift(this.genFix('prefix'))
|
|
220
|
+
this.suffix && children.push(this.genFix('suffix'))
|
|
221
|
+
|
|
222
|
+
return children
|
|
223
|
+
},
|
|
224
|
+
genFix (type) {
|
|
225
|
+
return this.$createElement('span', {
|
|
226
|
+
'class': `input-group--text-field__${type}`
|
|
227
|
+
}, this[type])
|
|
228
|
+
},
|
|
229
|
+
clearableCallback () {
|
|
230
|
+
this.inputValue = null
|
|
231
|
+
this.$nextTick(() => this.$refs.input.focus())
|
|
232
|
+
},
|
|
233
|
+
resetSelections (input) {
|
|
234
|
+
this.selection = input.selectionEnd
|
|
235
|
+
this.lazySelection = 0
|
|
236
|
+
|
|
237
|
+
for (const char of input.value.substr(0, this.selection)) {
|
|
238
|
+
isMaskDelimiter(char) || this.lazySelection++
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
render () {
|
|
244
|
+
return this.genInputGroup(this.genInput(), { attrs: { tabindex: false } })
|
|
245
|
+
}
|
|
246
|
+
}
|