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,82 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
methods: {
|
|
3
|
+
monthWheelScroll (e) {
|
|
4
|
+
e.preventDefault()
|
|
5
|
+
|
|
6
|
+
let year = this.tableYear
|
|
7
|
+
|
|
8
|
+
if (e.deltaY < 0) year++
|
|
9
|
+
else year--
|
|
10
|
+
|
|
11
|
+
this.tableDate = this.normalizeDate(year)
|
|
12
|
+
},
|
|
13
|
+
monthClick (month) {
|
|
14
|
+
this.inputDate = this.normalizeDate(this.tableYear, month, this.day)
|
|
15
|
+
if (this.type === 'date') {
|
|
16
|
+
this.activePicker = 'DATE'
|
|
17
|
+
} else {
|
|
18
|
+
this.$nextTick(() => (this.autosave && this.save()))
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
monthGenTD (month) {
|
|
22
|
+
const date = this.normalizeDate(this.tableYear, month)
|
|
23
|
+
let monthName
|
|
24
|
+
|
|
25
|
+
if (typeof this.monthFormat === 'function') {
|
|
26
|
+
monthName = this.monthFormat(date)
|
|
27
|
+
} else if (this.supportsLocaleFormat) {
|
|
28
|
+
monthName = date.toLocaleDateString(this.locale, Object.assign(this.monthFormat, {
|
|
29
|
+
timeZone: this.timeZone
|
|
30
|
+
}))
|
|
31
|
+
} else {
|
|
32
|
+
monthName = date.getMonth() + 1
|
|
33
|
+
if (monthName < 10) {
|
|
34
|
+
monthName = `0${monthName}`
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return this.$createElement('td', [
|
|
39
|
+
this.$createElement('button', {
|
|
40
|
+
'class': {
|
|
41
|
+
'btn btn--date-picker': true,
|
|
42
|
+
'btn--raised': this.monthIsActive(month),
|
|
43
|
+
'btn--flat': true,
|
|
44
|
+
'btn--active': this.monthIsActive(month),
|
|
45
|
+
'btn--outline': this.monthIsCurrent(month) && !this.monthIsActive(month),
|
|
46
|
+
'btn--disabled': this.type === 'month' && !this.isAllowed(date)
|
|
47
|
+
},
|
|
48
|
+
attrs: {
|
|
49
|
+
type: 'button'
|
|
50
|
+
},
|
|
51
|
+
domProps: {
|
|
52
|
+
innerHTML: `<span class="btn__content">${monthName}</span>`
|
|
53
|
+
},
|
|
54
|
+
on: {
|
|
55
|
+
click: () => this.monthClick(month)
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
])
|
|
59
|
+
},
|
|
60
|
+
monthGenTBody () {
|
|
61
|
+
const children = []
|
|
62
|
+
const cols = Array(3).fill(null)
|
|
63
|
+
const rows = 12 / cols.length
|
|
64
|
+
|
|
65
|
+
for (let row = 0; row < rows; row++) {
|
|
66
|
+
children.push(this.$createElement('tr', cols.map((_, col) => {
|
|
67
|
+
return this.monthGenTD(row * cols.length + col)
|
|
68
|
+
})))
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return this.$createElement('tbody', children)
|
|
72
|
+
},
|
|
73
|
+
monthIsActive (i) {
|
|
74
|
+
return this.tableYear === this.year &&
|
|
75
|
+
this.month === i
|
|
76
|
+
},
|
|
77
|
+
monthIsCurrent (i) {
|
|
78
|
+
return this.currentYear === this.tableYear &&
|
|
79
|
+
this.currentMonth === i
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
require('../../stylus/components/_dialogs.styl')
|
|
2
|
+
|
|
3
|
+
// Mixins
|
|
4
|
+
import Dependent from '../../mixins/dependent'
|
|
5
|
+
import Detachable from '../../mixins/detachable'
|
|
6
|
+
import Overlayable from '../../mixins/overlayable'
|
|
7
|
+
import Stackable from '../../mixins/stackable'
|
|
8
|
+
import Toggleable from '../../mixins/toggleable'
|
|
9
|
+
|
|
10
|
+
// Directives
|
|
11
|
+
import ClickOutside from '../../directives/click-outside'
|
|
12
|
+
|
|
13
|
+
// Helpers
|
|
14
|
+
import { getZIndex } from '../../util/helpers'
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
name: 'k-dialog',
|
|
18
|
+
|
|
19
|
+
mixins: [Dependent, Detachable, Overlayable, Stackable, Toggleable],
|
|
20
|
+
|
|
21
|
+
directives: {
|
|
22
|
+
ClickOutside
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
data () {
|
|
26
|
+
return {
|
|
27
|
+
isDependent: false,
|
|
28
|
+
stackClass: 'dialog__content__active',
|
|
29
|
+
stackMinZIndex: 200
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
props: {
|
|
34
|
+
disabled: Boolean,
|
|
35
|
+
persistent: Boolean,
|
|
36
|
+
fullscreen: Boolean,
|
|
37
|
+
fullWidth: Boolean,
|
|
38
|
+
maxWidth: {
|
|
39
|
+
type: [String, Number],
|
|
40
|
+
default: 290
|
|
41
|
+
},
|
|
42
|
+
origin: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: 'center center'
|
|
45
|
+
},
|
|
46
|
+
width: [String, Number],
|
|
47
|
+
scrollable: Boolean,
|
|
48
|
+
transition: {
|
|
49
|
+
type: [String, Boolean],
|
|
50
|
+
default: 'dialog-transition'
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
computed: {
|
|
55
|
+
classes () {
|
|
56
|
+
return {
|
|
57
|
+
[(`dialog ${this.contentClass}`).trim()]: true,
|
|
58
|
+
'dialog--active': this.isActive,
|
|
59
|
+
'dialog--persistent': this.persistent,
|
|
60
|
+
'dialog--fullscreen': this.fullscreen,
|
|
61
|
+
'dialog--stacked-actions': this.stackedActions && !this.fullscreen,
|
|
62
|
+
'dialog--scrollable': this.scrollable
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
contentClasses () {
|
|
66
|
+
return {
|
|
67
|
+
'dialog__content': true,
|
|
68
|
+
'dialog__content__active': this.isActive
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
watch: {
|
|
74
|
+
isActive (val) {
|
|
75
|
+
if (val) {
|
|
76
|
+
this.show()
|
|
77
|
+
} else {
|
|
78
|
+
this.removeOverlay()
|
|
79
|
+
this.unbind()
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
mounted () {
|
|
85
|
+
this.isBooted = this.isActive
|
|
86
|
+
this.$kdutify.load(this.init)
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
beforeDestroy () {
|
|
90
|
+
if (typeof window !== 'undefined') this.unbind()
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
methods: {
|
|
94
|
+
closeConditional (e) {
|
|
95
|
+
// close dialog if !persistent, clicked outside and we're the topmost dialog.
|
|
96
|
+
// Since this should only be called in a capture event (bottom up), we shouldn't need to stop propagation
|
|
97
|
+
return !this.persistent && getZIndex(this.$refs.content) >= this.getMaxZIndex()
|
|
98
|
+
},
|
|
99
|
+
init () {
|
|
100
|
+
this.isActive && this.show()
|
|
101
|
+
},
|
|
102
|
+
show () {
|
|
103
|
+
!this.fullscreen && !this.hideOverlay && this.genOverlay()
|
|
104
|
+
this.fullscreen && this.hideScroll()
|
|
105
|
+
this.$refs.content.focus()
|
|
106
|
+
this.$listeners.keydown && this.bind()
|
|
107
|
+
},
|
|
108
|
+
bind () {
|
|
109
|
+
window.addEventListener('keydown', this.onKeydown)
|
|
110
|
+
},
|
|
111
|
+
unbind () {
|
|
112
|
+
window.removeEventListener('keydown', this.onKeydown)
|
|
113
|
+
},
|
|
114
|
+
onKeydown (e) {
|
|
115
|
+
this.$emit('keydown', e)
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
render (h) {
|
|
120
|
+
const children = []
|
|
121
|
+
const data = {
|
|
122
|
+
'class': this.classes,
|
|
123
|
+
ref: 'dialog',
|
|
124
|
+
directives: [
|
|
125
|
+
{
|
|
126
|
+
name: 'click-outside',
|
|
127
|
+
value: {
|
|
128
|
+
callback: this.closeConditional,
|
|
129
|
+
include: this.getOpenDependentElements
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
{ name: 'show', value: this.isActive }
|
|
133
|
+
],
|
|
134
|
+
on: { click: e => e.stopPropagation() }
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (!this.fullscreen) {
|
|
138
|
+
let width = this.maxWidth
|
|
139
|
+
|
|
140
|
+
if (this.width) {
|
|
141
|
+
console.log('The {width} property is being deprecated, please use {max-width}.')
|
|
142
|
+
// TODO: Deprecate
|
|
143
|
+
width = this.width
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
data.style = {
|
|
147
|
+
maxWidth: isNaN(width) ? width : `${width}px`
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (this.$slots.activator) {
|
|
152
|
+
children.push(h('div', {
|
|
153
|
+
'class': 'dialog__activator',
|
|
154
|
+
on: {
|
|
155
|
+
click: e => {
|
|
156
|
+
if (!this.disabled) this.isActive = !this.isActive
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}, [this.$slots.activator]))
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const dialog = h('transition', {
|
|
163
|
+
props: {
|
|
164
|
+
name: this.transition || '', // If false, show nothing
|
|
165
|
+
origin: this.origin
|
|
166
|
+
}
|
|
167
|
+
}, [h('div', data,
|
|
168
|
+
this.showLazyContent(this.$slots.default)
|
|
169
|
+
)])
|
|
170
|
+
|
|
171
|
+
children.push(h('div', {
|
|
172
|
+
'class': this.contentClasses,
|
|
173
|
+
style: { zIndex: this.activeZIndex },
|
|
174
|
+
ref: 'content'
|
|
175
|
+
}, [dialog]))
|
|
176
|
+
|
|
177
|
+
return h('div', {
|
|
178
|
+
'class': 'dialog__container',
|
|
179
|
+
style: {
|
|
180
|
+
display: !this.$slots.activator && 'none' || this.fullWidth ? 'block' : 'inline-block'
|
|
181
|
+
}
|
|
182
|
+
}, children)
|
|
183
|
+
}
|
|
184
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require('../../stylus/components/_dividers.styl')
|
|
2
|
+
|
|
3
|
+
import Themeable from '../../mixins/themeable'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
name: 'k-divider',
|
|
7
|
+
|
|
8
|
+
functional: true,
|
|
9
|
+
|
|
10
|
+
mixins: [Themeable],
|
|
11
|
+
|
|
12
|
+
props: {
|
|
13
|
+
inset: Boolean
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
render (h, { props, data, children }) {
|
|
17
|
+
data.staticClass = (`divider ${data.staticClass || ''}`).trim()
|
|
18
|
+
|
|
19
|
+
if (props.inset) data.staticClass += ' divider--inset'
|
|
20
|
+
if (props.light) data.staticClass += ' theme--light'
|
|
21
|
+
if (props.dark) data.staticClass += ' theme--dark'
|
|
22
|
+
|
|
23
|
+
return h('hr', data)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
require('../../stylus/components/_expansion-panel.styl')
|
|
2
|
+
|
|
3
|
+
import Themeable from '../../mixins/themeable'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
name: 'k-expansion-panel',
|
|
7
|
+
|
|
8
|
+
mixins: [Themeable],
|
|
9
|
+
|
|
10
|
+
provide () {
|
|
11
|
+
return {
|
|
12
|
+
panelClick: this.panelClick,
|
|
13
|
+
focusable: this.focusable
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
props: {
|
|
18
|
+
expand: Boolean,
|
|
19
|
+
focusable: Boolean,
|
|
20
|
+
inset: Boolean,
|
|
21
|
+
popout: Boolean
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
methods: {
|
|
25
|
+
getChildren () {
|
|
26
|
+
return this.$children.filter(c => {
|
|
27
|
+
if (!c.$options) return
|
|
28
|
+
|
|
29
|
+
return c.$options._componentTag === 'k-expansion-panel-content'
|
|
30
|
+
})
|
|
31
|
+
},
|
|
32
|
+
panelClick (uid) {
|
|
33
|
+
if (!this.expand) {
|
|
34
|
+
return this.getChildren()
|
|
35
|
+
.forEach(e => e.toggle(uid))
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const panel = this.$children.find(e => e._uid === uid)
|
|
39
|
+
|
|
40
|
+
panel && panel.toggle(uid)
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
render (h) {
|
|
45
|
+
return h('ul', {
|
|
46
|
+
staticClass: 'expansion-panel',
|
|
47
|
+
'class': {
|
|
48
|
+
'expansion-panel--focusable': this.focusable,
|
|
49
|
+
'expansion-panel--popout': this.popout,
|
|
50
|
+
'expansion-panel--inset': this.inset,
|
|
51
|
+
...this.themeClasses
|
|
52
|
+
}
|
|
53
|
+
}, this.$slots.default)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { KExpandTransition } from '../transitions'
|
|
2
|
+
|
|
3
|
+
import Bootable from '../../mixins/bootable'
|
|
4
|
+
import Toggleable from '../../mixins/toggleable'
|
|
5
|
+
|
|
6
|
+
import KIcon from '../KIcon'
|
|
7
|
+
|
|
8
|
+
import Ripple from '../../directives/ripple'
|
|
9
|
+
import ClickOutside from '../../directives/click-outside'
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
name: 'k-expansion-panel-content',
|
|
13
|
+
|
|
14
|
+
mixins: [Bootable, Toggleable],
|
|
15
|
+
|
|
16
|
+
components: {
|
|
17
|
+
KIcon
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
directives: {
|
|
21
|
+
Ripple,
|
|
22
|
+
ClickOutside
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
inject: ['focusable', 'panelClick'],
|
|
26
|
+
|
|
27
|
+
data () {
|
|
28
|
+
return {
|
|
29
|
+
height: 'auto'
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
props: {
|
|
34
|
+
hideActions: Boolean,
|
|
35
|
+
ripple: Boolean
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
methods: {
|
|
39
|
+
genBody () {
|
|
40
|
+
return this.$createElement('div', {
|
|
41
|
+
ref: 'body',
|
|
42
|
+
class: 'expansion-panel__body',
|
|
43
|
+
directives: [
|
|
44
|
+
{
|
|
45
|
+
name: 'show',
|
|
46
|
+
value: this.isActive
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}, this.showLazyContent(this.$slots.default))
|
|
50
|
+
},
|
|
51
|
+
genHeader () {
|
|
52
|
+
return this.$createElement('div', {
|
|
53
|
+
staticClass: 'expansion-panel__header',
|
|
54
|
+
directives: [{
|
|
55
|
+
name: 'ripple',
|
|
56
|
+
value: this.ripple
|
|
57
|
+
}],
|
|
58
|
+
on: {
|
|
59
|
+
click: () => this.panelClick(this._uid)
|
|
60
|
+
}
|
|
61
|
+
}, [
|
|
62
|
+
this.$slots.header,
|
|
63
|
+
this.genIcon()
|
|
64
|
+
])
|
|
65
|
+
},
|
|
66
|
+
genIcon (h) {
|
|
67
|
+
if (this.hideActions) return null
|
|
68
|
+
|
|
69
|
+
const icon = this.$slots.actions ||
|
|
70
|
+
this.$createElement('k-icon', 'keyboard_arrow_down')
|
|
71
|
+
|
|
72
|
+
return this.$createElement('div', {
|
|
73
|
+
staticClass: 'header__icon'
|
|
74
|
+
}, [icon])
|
|
75
|
+
},
|
|
76
|
+
toggle (uid) {
|
|
77
|
+
const isActive = this._uid === uid && !this.isActive
|
|
78
|
+
|
|
79
|
+
if (isActive) this.isBooted = true
|
|
80
|
+
|
|
81
|
+
// We treat bootable differently
|
|
82
|
+
// Needs time to calc height
|
|
83
|
+
this.$nextTick(() => (this.isActive = isActive))
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
render (h) {
|
|
88
|
+
const children = []
|
|
89
|
+
|
|
90
|
+
this.$slots.header && children.push(this.genHeader())
|
|
91
|
+
children.push(h(KExpandTransition, [this.genBody()]))
|
|
92
|
+
|
|
93
|
+
return h('li', {
|
|
94
|
+
staticClass: 'expansion-panel__container',
|
|
95
|
+
'class': {
|
|
96
|
+
'expansion-panel__container--active': this.isActive
|
|
97
|
+
},
|
|
98
|
+
attrs: {
|
|
99
|
+
tabindex: 0
|
|
100
|
+
},
|
|
101
|
+
on: {
|
|
102
|
+
keydown: e => {
|
|
103
|
+
// Ensure element is focusable and the activeElement
|
|
104
|
+
if (this.focusable &&
|
|
105
|
+
this.$el === document.activeElement &&
|
|
106
|
+
e.keyCode === 13
|
|
107
|
+
) this.panelClick(this._uid)
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}, children)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import KExpansionPanel from './KExpansionPanel'
|
|
2
|
+
import KExpansionPanelContent from './KExpansionPanelContent'
|
|
3
|
+
|
|
4
|
+
KExpansionPanel.install = function install (Kdu) {
|
|
5
|
+
Kdu.component(KExpansionPanel.name, KExpansionPanel)
|
|
6
|
+
Kdu.component(KExpansionPanelContent.name, KExpansionPanelContent)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default KExpansionPanel
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
require('../../stylus/components/_footer.styl')
|
|
2
|
+
|
|
3
|
+
import Applicationable from '../../mixins/applicationable'
|
|
4
|
+
import Colorable from '../../mixins/colorable'
|
|
5
|
+
import Themeable from '../../mixins/themeable'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
name: 'k-footer',
|
|
9
|
+
|
|
10
|
+
mixins: [Applicationable, Colorable, Themeable],
|
|
11
|
+
|
|
12
|
+
props: {
|
|
13
|
+
absolute: Boolean,
|
|
14
|
+
fixed: Boolean
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
computed: {
|
|
18
|
+
paddingLeft () {
|
|
19
|
+
return this.fixed || !this.app
|
|
20
|
+
? 0
|
|
21
|
+
: this.$kdutify.application.left
|
|
22
|
+
},
|
|
23
|
+
paddingRight () {
|
|
24
|
+
return this.fixed || !this.app
|
|
25
|
+
? 0
|
|
26
|
+
: this.$kdutify.application.right
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
destroyed () {
|
|
31
|
+
if (this.app) this.$kdutify.application.bottom = 0
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
methods: {
|
|
35
|
+
updateApplication () {
|
|
36
|
+
if (!this.app) return
|
|
37
|
+
|
|
38
|
+
this.$kdutify.application.bottom = this.fixed
|
|
39
|
+
? this.$el && this.$el.clientHeight
|
|
40
|
+
: 0
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
mounted () {
|
|
45
|
+
this.updateApplication()
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
render (h) {
|
|
49
|
+
this.updateApplication()
|
|
50
|
+
|
|
51
|
+
const data = {
|
|
52
|
+
staticClass: 'footer',
|
|
53
|
+
'class': this.addBackgroundColorClassChecks({
|
|
54
|
+
'footer--absolute': this.absolute,
|
|
55
|
+
'footer--fixed': this.fixed,
|
|
56
|
+
'theme--dark': this.dark,
|
|
57
|
+
'theme--light': this.light
|
|
58
|
+
}),
|
|
59
|
+
style: {
|
|
60
|
+
paddingLeft: `${this.paddingLeft}px`,
|
|
61
|
+
paddingRight: `${this.paddingRight}px`
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return h('footer', data, this.$slots.default)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
name: 'k-form',
|
|
3
|
+
|
|
4
|
+
inheritAttrs: false,
|
|
5
|
+
|
|
6
|
+
data () {
|
|
7
|
+
return {
|
|
8
|
+
inputs: [],
|
|
9
|
+
errorBag: {}
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
props: {
|
|
14
|
+
value: Boolean,
|
|
15
|
+
lazyValidation: Boolean
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
watch: {
|
|
19
|
+
errorBag: {
|
|
20
|
+
handler () {
|
|
21
|
+
const errors = Object.values(this.errorBag).includes(true)
|
|
22
|
+
|
|
23
|
+
this.$emit('input', !errors)
|
|
24
|
+
|
|
25
|
+
return !errors
|
|
26
|
+
},
|
|
27
|
+
deep: true
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
methods: {
|
|
32
|
+
getInputs () {
|
|
33
|
+
const results = []
|
|
34
|
+
|
|
35
|
+
const search = (children, depth = 0) => {
|
|
36
|
+
for (const child of children) {
|
|
37
|
+
if (child.errorBucket !== undefined) {
|
|
38
|
+
results.push(child)
|
|
39
|
+
} else {
|
|
40
|
+
search(child.$children, depth + 1)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (depth === 0) return results
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return search(this.$children)
|
|
47
|
+
},
|
|
48
|
+
watchInputs (inputs = this.getInputs()) {
|
|
49
|
+
for (const child of inputs) {
|
|
50
|
+
if (this.inputs.includes(child)) {
|
|
51
|
+
continue // We already know about this input
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
this.inputs.push(child)
|
|
55
|
+
this.watchChild(child)
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
watchChild (child) {
|
|
59
|
+
const watcher = (child) => {
|
|
60
|
+
child.$watch('valid', (val) => {
|
|
61
|
+
this.$set(this.errorBag, child._uid, !val)
|
|
62
|
+
}, { immediate: true })
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (!this.lazyValidation) return watcher(child)
|
|
66
|
+
|
|
67
|
+
// Only start watching inputs if we need to
|
|
68
|
+
child.$watch('shouldValidate', (val) => {
|
|
69
|
+
if (!val) return
|
|
70
|
+
|
|
71
|
+
// Only watch if we're not already doing it
|
|
72
|
+
if (this.errorBag.hasOwnProperty(child._uid)) return
|
|
73
|
+
|
|
74
|
+
watcher(child)
|
|
75
|
+
})
|
|
76
|
+
},
|
|
77
|
+
validate () {
|
|
78
|
+
const errors = this.inputs.filter(input => !input.validate(true)).length
|
|
79
|
+
return !errors
|
|
80
|
+
},
|
|
81
|
+
reset () {
|
|
82
|
+
this.inputs.forEach((input) => input.reset())
|
|
83
|
+
if (this.lazyValidation) {
|
|
84
|
+
Object.keys(this.errorBag).forEach(key => this.$delete(this.errorBag, key))
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
mounted () {
|
|
90
|
+
this.$kdutify.load(() => this.watchInputs())
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
updated () {
|
|
94
|
+
const inputs = this.getInputs()
|
|
95
|
+
|
|
96
|
+
if (inputs.length < this.inputs.length) {
|
|
97
|
+
// Something was removed, we don't want it in the errorBag any more
|
|
98
|
+
const removed = this.inputs.filter(i => !inputs.includes(i))
|
|
99
|
+
|
|
100
|
+
for (const input of removed) {
|
|
101
|
+
this.$delete(this.errorBag, input._uid)
|
|
102
|
+
this.$delete(this.inputs, this.inputs.indexOf(input))
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
this.watchInputs(inputs)
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
render (h) {
|
|
110
|
+
return h('form', {
|
|
111
|
+
attrs: this.$attrs,
|
|
112
|
+
on: {
|
|
113
|
+
submit: e => this.$emit('submit', e)
|
|
114
|
+
}
|
|
115
|
+
}, this.$slots.default)
|
|
116
|
+
}
|
|
117
|
+
}
|