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,11 @@
|
|
|
1
|
+
import KRadioGroup from './KRadioGroup'
|
|
2
|
+
import KRadio from './KRadio'
|
|
3
|
+
|
|
4
|
+
export { KRadioGroup, KRadio }
|
|
5
|
+
|
|
6
|
+
KRadioGroup.install = function install (Kdu) {
|
|
7
|
+
Kdu.component(KRadioGroup.name, KRadioGroup)
|
|
8
|
+
Kdu.component(KRadio.name, KRadio)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default KRadioGroup
|
|
@@ -0,0 +1,641 @@
|
|
|
1
|
+
require('../../stylus/components/_text-fields.styl')
|
|
2
|
+
require('../../stylus/components/_input-groups.styl')
|
|
3
|
+
require('../../stylus/components/_select.styl')
|
|
4
|
+
|
|
5
|
+
// Components
|
|
6
|
+
import KCard from '../KCard'
|
|
7
|
+
import KCheckbox from '../KCheckbox'
|
|
8
|
+
import {
|
|
9
|
+
KList,
|
|
10
|
+
KListTile,
|
|
11
|
+
KListTileAction,
|
|
12
|
+
KListTileContent,
|
|
13
|
+
KListTileTitle
|
|
14
|
+
} from '../KList'
|
|
15
|
+
import KMenu from '../KMenu'
|
|
16
|
+
import KBtn from '../KBtn'
|
|
17
|
+
|
|
18
|
+
// Mixins
|
|
19
|
+
import Colorable from '../../mixins/colorable'
|
|
20
|
+
import Dependent from '../../mixins/dependent'
|
|
21
|
+
import Filterable from '../../mixins/filterable'
|
|
22
|
+
import Input from '../../mixins/input'
|
|
23
|
+
import Maskable from '../../mixins/maskable'
|
|
24
|
+
|
|
25
|
+
// Component level mixins
|
|
26
|
+
import Autocomplete from './mixins/select-autocomplete'
|
|
27
|
+
import Generators from './mixins/select-generators'
|
|
28
|
+
|
|
29
|
+
// Directives
|
|
30
|
+
import ClickOutside from '../../directives/click-outside'
|
|
31
|
+
|
|
32
|
+
// Helpers
|
|
33
|
+
import { getObjectValueByPath } from '../../util/helpers'
|
|
34
|
+
|
|
35
|
+
export default {
|
|
36
|
+
name: 'k-select',
|
|
37
|
+
|
|
38
|
+
inheritAttrs: false,
|
|
39
|
+
|
|
40
|
+
components: {
|
|
41
|
+
KCard,
|
|
42
|
+
KCheckbox,
|
|
43
|
+
KList,
|
|
44
|
+
KListTile,
|
|
45
|
+
KListTileAction,
|
|
46
|
+
KListTileContent,
|
|
47
|
+
KListTileTitle,
|
|
48
|
+
KMenu,
|
|
49
|
+
KBtn
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
directives: {
|
|
53
|
+
ClickOutside
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
mixins: [Autocomplete, Colorable, Dependent, Filterable, Generators, Input, Maskable],
|
|
57
|
+
|
|
58
|
+
data () {
|
|
59
|
+
return {
|
|
60
|
+
cachedItems: [],
|
|
61
|
+
content: {},
|
|
62
|
+
inputValue: (this.multiple || this.tags) && !this.value ? [] : this.value,
|
|
63
|
+
isBooted: false,
|
|
64
|
+
lastItem: 20,
|
|
65
|
+
lazySearch: null,
|
|
66
|
+
isActive: false,
|
|
67
|
+
menuIsActive: false,
|
|
68
|
+
searchTimeout: null,
|
|
69
|
+
selectedIndex: -1,
|
|
70
|
+
selectedItems: [],
|
|
71
|
+
shouldBreak: false
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
props: {
|
|
76
|
+
appendIcon: {
|
|
77
|
+
type: String,
|
|
78
|
+
default: 'arrow_drop_down'
|
|
79
|
+
},
|
|
80
|
+
appendIconCb: Function,
|
|
81
|
+
auto: Boolean,
|
|
82
|
+
autocomplete: Boolean,
|
|
83
|
+
cacheItems: Boolean,
|
|
84
|
+
chips: Boolean,
|
|
85
|
+
clearable: Boolean,
|
|
86
|
+
color: {
|
|
87
|
+
type: String,
|
|
88
|
+
default: 'primary'
|
|
89
|
+
},
|
|
90
|
+
combobox: Boolean,
|
|
91
|
+
debounceSearch: {
|
|
92
|
+
type: [Number, String],
|
|
93
|
+
default: 200
|
|
94
|
+
},
|
|
95
|
+
browserAutocomplete: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: 'on'
|
|
98
|
+
},
|
|
99
|
+
items: {
|
|
100
|
+
type: Array,
|
|
101
|
+
default: () => []
|
|
102
|
+
},
|
|
103
|
+
itemAvatar: {
|
|
104
|
+
type: String,
|
|
105
|
+
default: 'avatar'
|
|
106
|
+
},
|
|
107
|
+
itemText: {
|
|
108
|
+
type: String,
|
|
109
|
+
default: 'text'
|
|
110
|
+
},
|
|
111
|
+
itemValue: {
|
|
112
|
+
type: String,
|
|
113
|
+
default: 'value'
|
|
114
|
+
},
|
|
115
|
+
itemDisabled: {
|
|
116
|
+
type: String,
|
|
117
|
+
default: 'disabled'
|
|
118
|
+
},
|
|
119
|
+
maxHeight: {
|
|
120
|
+
type: [Number, String],
|
|
121
|
+
default: 300
|
|
122
|
+
},
|
|
123
|
+
minWidth: {
|
|
124
|
+
type: [Boolean, Number, String],
|
|
125
|
+
default: false
|
|
126
|
+
},
|
|
127
|
+
multiple: Boolean,
|
|
128
|
+
multiLine: Boolean,
|
|
129
|
+
solo: Boolean,
|
|
130
|
+
searchInput: {
|
|
131
|
+
default: null
|
|
132
|
+
},
|
|
133
|
+
singleLine: Boolean,
|
|
134
|
+
tags: Boolean,
|
|
135
|
+
returnObject: Boolean,
|
|
136
|
+
overflow: Boolean,
|
|
137
|
+
segmented: Boolean,
|
|
138
|
+
editable: Boolean
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
computed: {
|
|
142
|
+
classes () {
|
|
143
|
+
const classes = {
|
|
144
|
+
'input-group--text-field input-group--select': true,
|
|
145
|
+
'input-group--auto': this.auto,
|
|
146
|
+
'input-group--overflow': this.overflow,
|
|
147
|
+
'input-group--segmented': this.segmented,
|
|
148
|
+
'input-group--editable': this.editable,
|
|
149
|
+
'input-group--autocomplete': this.isAutocomplete,
|
|
150
|
+
'input-group--single-line': this.singleLine || this.isDropdown,
|
|
151
|
+
'input-group--multi-line': this.multiLine,
|
|
152
|
+
'input-group--chips': this.chips,
|
|
153
|
+
'input-group--solo': this.solo,
|
|
154
|
+
'input-group--multiple': this.multiple
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (this.hasError) {
|
|
158
|
+
classes['error--text'] = true
|
|
159
|
+
} else {
|
|
160
|
+
return this.addTextColorClassChecks(classes)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return classes
|
|
164
|
+
},
|
|
165
|
+
computedContentClass () {
|
|
166
|
+
const children = [
|
|
167
|
+
'menu__content--select',
|
|
168
|
+
this.auto ? 'menu__content--auto' : '',
|
|
169
|
+
this.isDropdown ? 'menu__content--dropdown' : '',
|
|
170
|
+
this.isAutocomplete ? 'menu__content--autocomplete' : ''
|
|
171
|
+
]
|
|
172
|
+
|
|
173
|
+
return children.join(' ')
|
|
174
|
+
},
|
|
175
|
+
computedItems () {
|
|
176
|
+
return this.filterDuplicates(this.cachedItems.concat(this.items))
|
|
177
|
+
},
|
|
178
|
+
/**
|
|
179
|
+
* The range of the current input text
|
|
180
|
+
*
|
|
181
|
+
* @return {Number}
|
|
182
|
+
*/
|
|
183
|
+
currentRange () {
|
|
184
|
+
return this.getText(this.selectedItem || '').length
|
|
185
|
+
},
|
|
186
|
+
filteredItems () {
|
|
187
|
+
// If we are not actively filtering
|
|
188
|
+
// Show all available items
|
|
189
|
+
const items = this.isNotFiltering
|
|
190
|
+
? this.computedItems
|
|
191
|
+
: this.filterSearch()
|
|
192
|
+
|
|
193
|
+
return !this.auto ? items.slice(0, this.lastItem) : items
|
|
194
|
+
},
|
|
195
|
+
hideSelections () {
|
|
196
|
+
return this.isAutocomplete &&
|
|
197
|
+
!this.isMultiple &&
|
|
198
|
+
this.isFocused &&
|
|
199
|
+
!this.chips
|
|
200
|
+
},
|
|
201
|
+
isNotFiltering () {
|
|
202
|
+
return this.isAutocomplete &&
|
|
203
|
+
this.isDirty &&
|
|
204
|
+
this.searchValue === this.getText(this.selectedItem)
|
|
205
|
+
},
|
|
206
|
+
isAutocomplete () {
|
|
207
|
+
return this.autocomplete || this.editable || this.tags || this.combobox
|
|
208
|
+
},
|
|
209
|
+
isDirty () {
|
|
210
|
+
return this.selectedItems.length > 0
|
|
211
|
+
},
|
|
212
|
+
isDropdown () {
|
|
213
|
+
return this.segmented || this.overflow || this.editable || this.solo
|
|
214
|
+
},
|
|
215
|
+
isMultiple () {
|
|
216
|
+
return this.multiple || this.tags
|
|
217
|
+
},
|
|
218
|
+
searchValue: {
|
|
219
|
+
get () { return this.lazySearch },
|
|
220
|
+
set (val) {
|
|
221
|
+
if (!this.isAutocomplete ||
|
|
222
|
+
this.selectedIndex > -1
|
|
223
|
+
) return
|
|
224
|
+
|
|
225
|
+
this.lazySearch = val
|
|
226
|
+
|
|
227
|
+
clearTimeout(this.searchTimeout)
|
|
228
|
+
|
|
229
|
+
this.searchTimeout = setTimeout(() => {
|
|
230
|
+
this.$emit('update:searchInput', val)
|
|
231
|
+
}, this.debounceSearch)
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
selectedItem () {
|
|
235
|
+
if (this.isMultiple) return null
|
|
236
|
+
|
|
237
|
+
return this.selectedItems.find(i => (
|
|
238
|
+
this.getValue(i) === this.getValue(this.inputValue)
|
|
239
|
+
)) || null
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
watch: {
|
|
244
|
+
inputValue (val) {
|
|
245
|
+
// Populate selected items
|
|
246
|
+
this.genSelectedItems(val)
|
|
247
|
+
|
|
248
|
+
this.$emit('input', val)
|
|
249
|
+
|
|
250
|
+
// When inputValue is changed
|
|
251
|
+
// and combobox is true set
|
|
252
|
+
// menu property to false
|
|
253
|
+
if (this.combobox) this.menuIsActive = false
|
|
254
|
+
},
|
|
255
|
+
isActive (val) {
|
|
256
|
+
if (!val) {
|
|
257
|
+
this.searchValue = null
|
|
258
|
+
this.menuIsActive = false
|
|
259
|
+
this.isFocused = false
|
|
260
|
+
this.selectedIndex = -1
|
|
261
|
+
} else {
|
|
262
|
+
this.searchValue = this.getText(this.selectedItem)
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// this.lastItem += !val ? 20 : 0
|
|
266
|
+
},
|
|
267
|
+
isBooted () {
|
|
268
|
+
this.$nextTick(() => {
|
|
269
|
+
if (this.content && this.content.addEventListener) {
|
|
270
|
+
this.content.addEventListener('scroll', this.onScroll, false)
|
|
271
|
+
}
|
|
272
|
+
})
|
|
273
|
+
},
|
|
274
|
+
isFocused (val) {
|
|
275
|
+
// When focusing the input
|
|
276
|
+
// re-set the caret position
|
|
277
|
+
if (this.isAutocomplete &&
|
|
278
|
+
!this.mask &&
|
|
279
|
+
!this.isMultiple &&
|
|
280
|
+
val
|
|
281
|
+
) {
|
|
282
|
+
this.setCaretPosition(this.currentRange)
|
|
283
|
+
this.shouldBreak && this.$nextTick(() => {
|
|
284
|
+
this.$refs.input.scrollLeft = this.$refs.input.scrollWidth
|
|
285
|
+
})
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
items (val) {
|
|
289
|
+
if (this.cacheItems) {
|
|
290
|
+
this.cachedItems = this.filterDuplicates(this.cachedItems.concat(val))
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
this.$refs.menu.listIndex = -1
|
|
294
|
+
|
|
295
|
+
this.searchValue && this.$nextTick(() => {
|
|
296
|
+
this.$refs.menu && (this.$refs.menu.listIndex = 0)
|
|
297
|
+
})
|
|
298
|
+
|
|
299
|
+
this.genSelectedItems()
|
|
300
|
+
},
|
|
301
|
+
menuIsActive (val) {
|
|
302
|
+
if (!val) return
|
|
303
|
+
|
|
304
|
+
this.isBooted = true
|
|
305
|
+
this.isActive = true
|
|
306
|
+
},
|
|
307
|
+
isMultiple (val) {
|
|
308
|
+
this.inputValue = val ? [] : null
|
|
309
|
+
},
|
|
310
|
+
searchInput (val) {
|
|
311
|
+
this.searchValue = val
|
|
312
|
+
},
|
|
313
|
+
searchValue (val) {
|
|
314
|
+
// Wrap input to next line if overflowing
|
|
315
|
+
if (this.$refs.input.scrollWidth > this.$refs.input.clientWidth) {
|
|
316
|
+
this.shouldBreak = true
|
|
317
|
+
this.$nextTick(this.$refs.menu.updateDimensions)
|
|
318
|
+
} else if (val === null) {
|
|
319
|
+
this.shouldBreak = false
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// Activate menu if inactive and searching
|
|
323
|
+
if (this.isActive &&
|
|
324
|
+
!this.menuIsActive &&
|
|
325
|
+
val !== this.getValue(this.selectedItem)
|
|
326
|
+
) {
|
|
327
|
+
this.menuIsActive = true
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
this.$refs.menu.listIndex = null
|
|
331
|
+
|
|
332
|
+
this.$nextTick(() => {
|
|
333
|
+
this.$refs.menu && (this.$refs.menu.listIndex = val ? 0 : -1)
|
|
334
|
+
})
|
|
335
|
+
},
|
|
336
|
+
selectedItems () {
|
|
337
|
+
clearTimeout(this.searchTimeout)
|
|
338
|
+
|
|
339
|
+
if (this.isAutocomplete) {
|
|
340
|
+
this.$nextTick(this.$refs.menu.updateDimensions)
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
value (val) {
|
|
344
|
+
this.inputValue = val
|
|
345
|
+
this.validate()
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
|
|
349
|
+
mounted () {
|
|
350
|
+
// If instance is being destroyed
|
|
351
|
+
// do not run mounted functions
|
|
352
|
+
if (this._isDestroyed) return
|
|
353
|
+
|
|
354
|
+
// Evaluate the selected items immediately
|
|
355
|
+
// to avoid a unnecessary label transition
|
|
356
|
+
this.genSelectedItems()
|
|
357
|
+
|
|
358
|
+
this.content = this.$refs.menu.$refs.content
|
|
359
|
+
},
|
|
360
|
+
|
|
361
|
+
beforeDestroy () {
|
|
362
|
+
if (this.isBooted) {
|
|
363
|
+
if (this.content) {
|
|
364
|
+
this.content.removeEventListener('scroll', this.onScroll, false)
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
|
|
369
|
+
methods: {
|
|
370
|
+
blur () {
|
|
371
|
+
this.$emit('blur')
|
|
372
|
+
if (this.isAutocomplete && this.$refs.input) this.$refs.input.blur()
|
|
373
|
+
this.$nextTick(() => (this.isActive = false))
|
|
374
|
+
},
|
|
375
|
+
changeSelectedIndex (keyCode) {
|
|
376
|
+
// backspace, left, right, delete
|
|
377
|
+
if (![8, 37, 39, 46].includes(keyCode)) return
|
|
378
|
+
|
|
379
|
+
const indexes = this.selectedItems.length - 1
|
|
380
|
+
|
|
381
|
+
if (keyCode === 37) { // Left arrow
|
|
382
|
+
this.selectedIndex = this.selectedIndex === -1
|
|
383
|
+
? indexes
|
|
384
|
+
: this.selectedIndex - 1
|
|
385
|
+
} else if (keyCode === 39) { // Right arrow
|
|
386
|
+
this.selectedIndex = this.selectedIndex >= indexes
|
|
387
|
+
? -1
|
|
388
|
+
: this.selectedIndex + 1
|
|
389
|
+
} else if (this.selectedIndex === -1) {
|
|
390
|
+
this.selectedIndex = indexes
|
|
391
|
+
return
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// backspace/delete
|
|
395
|
+
if ([8, 46].includes(keyCode)) {
|
|
396
|
+
const newIndex = this.selectedIndex === indexes
|
|
397
|
+
? this.selectedIndex - 1
|
|
398
|
+
: this.selectedItems[this.selectedIndex + 1]
|
|
399
|
+
? this.selectedIndex
|
|
400
|
+
: -1
|
|
401
|
+
|
|
402
|
+
this.selectItem(this.selectedItems[this.selectedIndex])
|
|
403
|
+
this.selectedIndex = newIndex
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
compareObjects (a, b) {
|
|
407
|
+
const aProps = Object.keys(a)
|
|
408
|
+
const bProps = Object.keys(b)
|
|
409
|
+
|
|
410
|
+
if (aProps.length !== bProps.length) return false
|
|
411
|
+
|
|
412
|
+
for (let i = 0, length = aProps.length; i < length; i++) {
|
|
413
|
+
const propName = aProps[i]
|
|
414
|
+
|
|
415
|
+
if (a[propName] !== b[propName]) return false
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
return true
|
|
419
|
+
},
|
|
420
|
+
filterDuplicates (arr) {
|
|
421
|
+
const values = arr.map(this.getValue)
|
|
422
|
+
return arr.filter((el, i) => i === values.indexOf(values[i]))
|
|
423
|
+
},
|
|
424
|
+
focus () {
|
|
425
|
+
this.isActive = true
|
|
426
|
+
this.isFocused = true
|
|
427
|
+
|
|
428
|
+
if (this.$refs.input && this.isAutocomplete) {
|
|
429
|
+
this.$refs.input.focus()
|
|
430
|
+
} else {
|
|
431
|
+
this.$el.focus()
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
this.$emit('focus')
|
|
435
|
+
},
|
|
436
|
+
genDirectives () {
|
|
437
|
+
return [{
|
|
438
|
+
name: 'click-outside',
|
|
439
|
+
value: e => {
|
|
440
|
+
return (
|
|
441
|
+
this.$refs.menu &&
|
|
442
|
+
!this.$refs.menu.$refs.content.contains(e.target)
|
|
443
|
+
)
|
|
444
|
+
}
|
|
445
|
+
}]
|
|
446
|
+
},
|
|
447
|
+
genListeners () {
|
|
448
|
+
const listeners = Object.assign({}, this.$listeners)
|
|
449
|
+
delete listeners.input
|
|
450
|
+
|
|
451
|
+
return {
|
|
452
|
+
...listeners,
|
|
453
|
+
click: () => {
|
|
454
|
+
if (this.disabled || this.readonly) return
|
|
455
|
+
this.showMenuItems()
|
|
456
|
+
this.selectedIndex = -1
|
|
457
|
+
},
|
|
458
|
+
focus: () => {
|
|
459
|
+
if (this.disabled || this.readonly) return
|
|
460
|
+
|
|
461
|
+
!this.isFocused && this.focus()
|
|
462
|
+
},
|
|
463
|
+
keydown: this.onKeyDown // Located in mixins/select-autocomplete.js
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
genLabel () {
|
|
467
|
+
const singleLine = this.singleLine || this.isDropdown
|
|
468
|
+
if (singleLine && this.isDirty ||
|
|
469
|
+
singleLine && this.isFocused && this.searchValue
|
|
470
|
+
) return null
|
|
471
|
+
|
|
472
|
+
const data = {}
|
|
473
|
+
|
|
474
|
+
if (this.id) data.attrs = { for: this.id }
|
|
475
|
+
|
|
476
|
+
return this.$createElement('label', data, this.$slots.label || this.label)
|
|
477
|
+
},
|
|
478
|
+
getPropertyFromItem (item, field) {
|
|
479
|
+
if (item !== Object(item)) return item
|
|
480
|
+
|
|
481
|
+
const value = getObjectValueByPath(item, field)
|
|
482
|
+
|
|
483
|
+
return typeof value === 'undefined' ? item : value
|
|
484
|
+
},
|
|
485
|
+
genSelectedItems (val = this.inputValue) {
|
|
486
|
+
// If we are using tags, don't filter results
|
|
487
|
+
if (this.tags) return (this.selectedItems = val)
|
|
488
|
+
|
|
489
|
+
// Combobox is the single version
|
|
490
|
+
// of a taggable select element
|
|
491
|
+
if (this.combobox) return (this.selectedItems = val ? [val] : [])
|
|
492
|
+
|
|
493
|
+
let selectedItems = this.computedItems.filter(i => {
|
|
494
|
+
if (!this.isMultiple) {
|
|
495
|
+
return this.getValue(i) === this.getValue(val)
|
|
496
|
+
} else {
|
|
497
|
+
// Always return Boolean
|
|
498
|
+
return val.find((j) => {
|
|
499
|
+
const a = this.getValue(j)
|
|
500
|
+
const b = this.getValue(i)
|
|
501
|
+
|
|
502
|
+
if (a !== Object(a)) return a === b
|
|
503
|
+
|
|
504
|
+
return this.compareObjects(a, b)
|
|
505
|
+
}) !== undefined
|
|
506
|
+
}
|
|
507
|
+
})
|
|
508
|
+
|
|
509
|
+
if (!selectedItems.length &&
|
|
510
|
+
val != null &&
|
|
511
|
+
this.tags
|
|
512
|
+
) {
|
|
513
|
+
selectedItems = Array.isArray(val) ? val : [val]
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
this.selectedItems = selectedItems
|
|
517
|
+
},
|
|
518
|
+
getText (item) {
|
|
519
|
+
return this.getPropertyFromItem(item, this.itemText)
|
|
520
|
+
},
|
|
521
|
+
getValue (item) {
|
|
522
|
+
return this.getPropertyFromItem(item, this.itemValue)
|
|
523
|
+
},
|
|
524
|
+
clearableCallback () {
|
|
525
|
+
const inputValue = this.isMultiple ? [] : null
|
|
526
|
+
|
|
527
|
+
this.inputValue = inputValue
|
|
528
|
+
this.searchValue = null
|
|
529
|
+
this.$emit('change', inputValue)
|
|
530
|
+
this.genSelectedItems()
|
|
531
|
+
this.showMenu()
|
|
532
|
+
},
|
|
533
|
+
showMenu () {
|
|
534
|
+
this.showMenuItems()
|
|
535
|
+
this.isAutocomplete && this.focus()
|
|
536
|
+
},
|
|
537
|
+
onScroll () {
|
|
538
|
+
if (!this.isActive) {
|
|
539
|
+
requestAnimationFrame(() => (this.content.scrollTop = 0))
|
|
540
|
+
} else {
|
|
541
|
+
if (this.lastItem >= this.computedItems.length) return
|
|
542
|
+
|
|
543
|
+
const showMoreItems = (
|
|
544
|
+
this.content.scrollHeight -
|
|
545
|
+
(this.content.scrollTop +
|
|
546
|
+
this.content.clientHeight)
|
|
547
|
+
) < 200
|
|
548
|
+
|
|
549
|
+
if (showMoreItems) {
|
|
550
|
+
this.lastItem += 20
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
},
|
|
554
|
+
selectItem (item) {
|
|
555
|
+
if (!this.isMultiple) {
|
|
556
|
+
this.inputValue = this.returnObject ? item : this.getValue(item)
|
|
557
|
+
this.selectedItems = [item]
|
|
558
|
+
} else {
|
|
559
|
+
const selectedItems = []
|
|
560
|
+
const inputValue = this.inputValue.slice()
|
|
561
|
+
const i = this.inputValue.findIndex((i) => {
|
|
562
|
+
const a = this.getValue(i)
|
|
563
|
+
const b = this.getValue(item)
|
|
564
|
+
|
|
565
|
+
if (a !== Object(a)) return a === b
|
|
566
|
+
|
|
567
|
+
return this.compareObjects(a, b)
|
|
568
|
+
})
|
|
569
|
+
|
|
570
|
+
i !== -1 && inputValue.splice(i, 1) || inputValue.push(item)
|
|
571
|
+
this.inputValue = inputValue.map((i) => {
|
|
572
|
+
selectedItems.push(i)
|
|
573
|
+
return this.returnObject ? i : this.getValue(i)
|
|
574
|
+
})
|
|
575
|
+
|
|
576
|
+
this.selectedItems = selectedItems
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
this.searchValue = !this.isMultiple || this.chips
|
|
580
|
+
? this.getText(this.selectedItem)
|
|
581
|
+
: ''
|
|
582
|
+
|
|
583
|
+
this.$emit('change', this.inputValue)
|
|
584
|
+
|
|
585
|
+
// List tile will re-render, reset index to
|
|
586
|
+
// maintain highlighting
|
|
587
|
+
const savedIndex = this.$refs.menu.listIndex
|
|
588
|
+
this.$refs.menu.listIndex = -1
|
|
589
|
+
|
|
590
|
+
// After selecting an item
|
|
591
|
+
// refocus the input and
|
|
592
|
+
// reset the caret pos
|
|
593
|
+
this.$nextTick(() => {
|
|
594
|
+
this.focus()
|
|
595
|
+
this.setCaretPosition(this.currentRange)
|
|
596
|
+
this.$refs.menu && (this.$refs.menu.listIndex = savedIndex)
|
|
597
|
+
})
|
|
598
|
+
},
|
|
599
|
+
showMenuItems () {
|
|
600
|
+
this.isActive = true
|
|
601
|
+
this.menuIsActive = true
|
|
602
|
+
this.chips && (this.$refs.menu.listIndex = -1)
|
|
603
|
+
}
|
|
604
|
+
},
|
|
605
|
+
|
|
606
|
+
render (h) {
|
|
607
|
+
const data = {
|
|
608
|
+
attrs: {
|
|
609
|
+
tabindex: this.isAutocomplete || this.disabled ? -1 : this.tabindex,
|
|
610
|
+
...(this.isAutocomplete ? null : this.$attrs),
|
|
611
|
+
role: this.isAutocomplete ? null : 'combobox'
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
if (!this.isAutocomplete) {
|
|
616
|
+
data.on = this.genListeners()
|
|
617
|
+
data.directives = this.genDirectives()
|
|
618
|
+
} else {
|
|
619
|
+
data.on = {
|
|
620
|
+
click: () => {
|
|
621
|
+
if (this.disabled || this.readonly) return
|
|
622
|
+
|
|
623
|
+
// Workaround for clicking select
|
|
624
|
+
// when using autocomplete
|
|
625
|
+
// and click doesn't target the input
|
|
626
|
+
setTimeout(() => {
|
|
627
|
+
if (this.menuIsActive) return
|
|
628
|
+
|
|
629
|
+
this.focus()
|
|
630
|
+
this.menuIsActive = true
|
|
631
|
+
}, 100)
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
return this.genInputGroup([
|
|
637
|
+
this.genSelectionsAndSearch(),
|
|
638
|
+
this.genMenu()
|
|
639
|
+
], data, () => this.showMenu())
|
|
640
|
+
}
|
|
641
|
+
}
|