mdui 1.0.2 → 2.0.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 +1 -1
- package/README.md +49 -70
- package/components/avatar/index.d.ts +49 -0
- package/components/avatar/index.js +55 -0
- package/components/avatar/style.d.ts +1 -0
- package/components/avatar/style.js +2 -0
- package/components/avatar.d.ts +1 -0
- package/components/avatar.js +1 -0
- package/components/badge/index.d.ts +28 -0
- package/components/badge/index.js +41 -0
- package/components/badge/style.d.ts +1 -0
- package/components/badge/style.js +2 -0
- package/components/badge.d.ts +1 -0
- package/components/badge.js +1 -0
- package/components/bottom-app-bar/index.d.ts +60 -0
- package/components/bottom-app-bar/index.js +105 -0
- package/components/bottom-app-bar/style.d.ts +1 -0
- package/components/bottom-app-bar/style.js +2 -0
- package/components/bottom-app-bar.d.ts +1 -0
- package/components/bottom-app-bar.js +1 -0
- package/components/button/button-base-style.d.ts +1 -0
- package/components/button/button-base-style.js +2 -0
- package/components/button/button-base.d.ts +138 -0
- package/components/button/button-base.js +206 -0
- package/components/button/index.d.ts +64 -0
- package/components/button/index.js +110 -0
- package/components/button/style.d.ts +1 -0
- package/components/button/style.js +4 -0
- package/components/button-icon/index.d.ts +66 -0
- package/components/button-icon/index.js +129 -0
- package/components/button-icon/style.d.ts +1 -0
- package/components/button-icon/style.js +4 -0
- package/components/button-icon.d.ts +1 -0
- package/components/button-icon.js +1 -0
- package/components/button.d.ts +1 -0
- package/components/button.js +1 -0
- package/components/card/index.d.ts +49 -0
- package/components/card/index.js +87 -0
- package/components/card/style.d.ts +1 -0
- package/components/card/style.js +2 -0
- package/components/card.d.ts +1 -0
- package/components/card.js +1 -0
- package/components/checkbox/index.d.ts +130 -0
- package/components/checkbox/index.js +257 -0
- package/components/checkbox/style.d.ts +1 -0
- package/components/checkbox/style.js +2 -0
- package/components/checkbox.d.ts +1 -0
- package/components/checkbox.js +1 -0
- package/components/chip/index.d.ts +102 -0
- package/components/chip/index.js +243 -0
- package/components/chip/style.d.ts +1 -0
- package/components/chip/style.js +4 -0
- package/components/chip.d.ts +1 -0
- package/components/chip.js +1 -0
- package/components/circular-progress/index.d.ts +28 -0
- package/components/circular-progress/index.js +61 -0
- package/components/circular-progress/style.d.ts +1 -0
- package/components/circular-progress/style.js +2 -0
- package/components/circular-progress.d.ts +1 -0
- package/components/circular-progress.js +1 -0
- package/components/collapse/collapse-item-style.d.ts +1 -0
- package/components/collapse/collapse-item-style.js +2 -0
- package/components/collapse/collapse-item.d.ts +56 -0
- package/components/collapse/collapse-item.js +126 -0
- package/components/collapse/collapse-style.d.ts +1 -0
- package/components/collapse/collapse-style.js +2 -0
- package/components/collapse/collapse.d.ts +49 -0
- package/components/collapse/collapse.js +175 -0
- package/components/collapse-item.d.ts +1 -0
- package/components/collapse-item.js +1 -0
- package/components/collapse.d.ts +1 -0
- package/components/collapse.js +1 -0
- package/components/dialog/index.d.ts +99 -0
- package/components/dialog/index.js +307 -0
- package/components/dialog/style.d.ts +1 -0
- package/components/dialog/style.js +2 -0
- package/components/dialog.d.ts +1 -0
- package/components/dialog.js +1 -0
- package/components/divider/index.d.ts +30 -0
- package/components/divider/index.js +58 -0
- package/components/divider/style.d.ts +1 -0
- package/components/divider/style.js +2 -0
- package/components/divider.d.ts +1 -0
- package/components/divider.js +1 -0
- package/components/dropdown/index.d.ts +131 -0
- package/components/dropdown/index.js +571 -0
- package/components/dropdown/style.d.ts +1 -0
- package/components/dropdown/style.js +2 -0
- package/components/dropdown.d.ts +1 -0
- package/components/dropdown.js +1 -0
- package/components/fab/index.d.ts +70 -0
- package/components/fab/index.js +144 -0
- package/components/fab/style.d.ts +1 -0
- package/components/fab/style.js +8 -0
- package/components/fab.d.ts +1 -0
- package/components/fab.js +1 -0
- package/components/icon/index.d.ts +29 -0
- package/components/icon/index.js +57 -0
- package/components/icon/style.d.ts +1 -0
- package/components/icon/style.js +2 -0
- package/components/icon.d.ts +1 -0
- package/components/icon.js +1 -0
- package/components/layout/helper.d.ts +67 -0
- package/components/layout/helper.js +212 -0
- package/components/layout/layout-item-base.d.ts +17 -0
- package/components/layout/layout-item-base.js +45 -0
- package/components/layout/layout-item-style.d.ts +1 -0
- package/components/layout/layout-item-style.js +2 -0
- package/components/layout/layout-item.d.ts +37 -0
- package/components/layout/layout-item.js +58 -0
- package/components/layout/layout-main-style.d.ts +1 -0
- package/components/layout/layout-main-style.js +2 -0
- package/components/layout/layout-main.d.ts +27 -0
- package/components/layout/layout-main.js +46 -0
- package/components/layout/layout-style.d.ts +1 -0
- package/components/layout/layout-style.js +2 -0
- package/components/layout/layout.d.ts +28 -0
- package/components/layout/layout.js +43 -0
- package/components/layout-item.d.ts +1 -0
- package/components/layout-item.js +1 -0
- package/components/layout-main.d.ts +1 -0
- package/components/layout-main.js +1 -0
- package/components/layout.d.ts +1 -0
- package/components/layout.js +1 -0
- package/components/linear-progress/index.d.ts +30 -0
- package/components/linear-progress/index.js +48 -0
- package/components/linear-progress/style.d.ts +1 -0
- package/components/linear-progress/style.js +2 -0
- package/components/linear-progress.d.ts +1 -0
- package/components/linear-progress.js +1 -0
- package/components/list/list-item-style.d.ts +1 -0
- package/components/list/list-item-style.js +4 -0
- package/components/list/list-item.d.ts +111 -0
- package/components/list/list-item.js +186 -0
- package/components/list/list-style.d.ts +1 -0
- package/components/list/list-style.js +2 -0
- package/components/list/list-subheader-style.d.ts +1 -0
- package/components/list/list-subheader-style.js +2 -0
- package/components/list/list-subheader.d.ts +24 -0
- package/components/list/list-subheader.js +30 -0
- package/components/list/list.d.ts +24 -0
- package/components/list/list.js +27 -0
- package/components/list-item.d.ts +1 -0
- package/components/list-item.js +1 -0
- package/components/list-subheader.d.ts +1 -0
- package/components/list-subheader.js +1 -0
- package/components/list.d.ts +1 -0
- package/components/list.js +1 -0
- package/components/menu/menu-item-style.d.ts +1 -0
- package/components/menu/menu-item-style.js +2 -0
- package/components/menu/menu-item.d.ts +123 -0
- package/components/menu/menu-item.js +412 -0
- package/components/menu/menu-style.d.ts +1 -0
- package/components/menu/menu-style.js +2 -0
- package/components/menu/menu.d.ts +111 -0
- package/components/menu/menu.js +425 -0
- package/components/menu-item.d.ts +1 -0
- package/components/menu-item.js +1 -0
- package/components/menu.d.ts +1 -0
- package/components/menu.js +1 -0
- package/components/navigation-bar/navigation-bar-item-style.d.ts +1 -0
- package/components/navigation-bar/navigation-bar-item-style.js +2 -0
- package/components/navigation-bar/navigation-bar-item.d.ts +72 -0
- package/components/navigation-bar/navigation-bar-item.js +120 -0
- package/components/navigation-bar/navigation-bar-style.d.ts +1 -0
- package/components/navigation-bar/navigation-bar-style.js +2 -0
- package/components/navigation-bar/navigation-bar.d.ts +78 -0
- package/components/navigation-bar/navigation-bar.js +180 -0
- package/components/navigation-bar-item.d.ts +1 -0
- package/components/navigation-bar-item.js +1 -0
- package/components/navigation-bar.d.ts +1 -0
- package/components/navigation-bar.js +1 -0
- package/components/navigation-drawer/index.d.ts +84 -0
- package/components/navigation-drawer/index.js +365 -0
- package/components/navigation-drawer/style.d.ts +1 -0
- package/components/navigation-drawer/style.js +2 -0
- package/components/navigation-drawer.d.ts +1 -0
- package/components/navigation-drawer.js +1 -0
- package/components/navigation-rail/navigation-rail-item-style.d.ts +1 -0
- package/components/navigation-rail/navigation-rail-item-style.js +2 -0
- package/components/navigation-rail/navigation-rail-item.d.ts +72 -0
- package/components/navigation-rail/navigation-rail-item.js +128 -0
- package/components/navigation-rail/navigation-rail-style.d.ts +1 -0
- package/components/navigation-rail/navigation-rail-style.js +2 -0
- package/components/navigation-rail/navigation-rail.d.ts +87 -0
- package/components/navigation-rail/navigation-rail.js +230 -0
- package/components/navigation-rail-item.d.ts +1 -0
- package/components/navigation-rail-item.js +1 -0
- package/components/navigation-rail.d.ts +1 -0
- package/components/navigation-rail.js +1 -0
- package/components/radio/radio-group-style.d.ts +1 -0
- package/components/radio/radio-group-style.js +2 -0
- package/components/radio/radio-group.d.ts +103 -0
- package/components/radio/radio-group.js +268 -0
- package/components/radio/radio-style.d.ts +1 -0
- package/components/radio/radio-style.js +2 -0
- package/components/radio/radio.d.ts +71 -0
- package/components/radio/radio.js +144 -0
- package/components/radio-group.d.ts +1 -0
- package/components/radio-group.js +1 -0
- package/components/radio.d.ts +1 -0
- package/components/radio.js +1 -0
- package/components/range-slider/index.d.ts +67 -0
- package/components/range-slider/index.js +210 -0
- package/components/range-slider.d.ts +1 -0
- package/components/range-slider.js +1 -0
- package/components/ripple/index.d.ts +44 -0
- package/components/ripple/index.js +173 -0
- package/components/ripple/ripple-mixin.d.ts +28 -0
- package/components/ripple/ripple-mixin.js +258 -0
- package/components/ripple/style.d.ts +1 -0
- package/components/ripple/style.js +2 -0
- package/components/ripple.d.ts +1 -0
- package/components/ripple.js +1 -0
- package/components/segmented-button/segmented-button-group-style.d.ts +1 -0
- package/components/segmented-button/segmented-button-group-style.js +2 -0
- package/components/segmented-button/segmented-button-group.d.ts +125 -0
- package/components/segmented-button/segmented-button-group.js +383 -0
- package/components/segmented-button/segmented-button-style.d.ts +1 -0
- package/components/segmented-button/segmented-button-style.js +4 -0
- package/components/segmented-button/segmented-button.d.ts +73 -0
- package/components/segmented-button/segmented-button.js +160 -0
- package/components/segmented-button-group.d.ts +1 -0
- package/components/segmented-button-group.js +1 -0
- package/components/segmented-button.d.ts +1 -0
- package/components/segmented-button.js +1 -0
- package/components/select/index.d.ts +200 -0
- package/components/select/index.js +390 -0
- package/components/select/style.d.ts +1 -0
- package/components/select/style.js +2 -0
- package/components/select.d.ts +1 -0
- package/components/select.js +1 -0
- package/components/slider/index.d.ts +53 -0
- package/components/slider/index.js +128 -0
- package/components/slider/slider-base-style.d.ts +1 -0
- package/components/slider/slider-base-style.js +2 -0
- package/components/slider/slider-base.d.ts +92 -0
- package/components/slider/slider-base.js +199 -0
- package/components/slider/style.d.ts +1 -0
- package/components/slider/style.js +2 -0
- package/components/slider.d.ts +1 -0
- package/components/slider.js +1 -0
- package/components/snackbar/index.d.ts +98 -0
- package/components/snackbar/index.js +285 -0
- package/components/snackbar/style.d.ts +1 -0
- package/components/snackbar/style.js +2 -0
- package/components/snackbar.d.ts +1 -0
- package/components/snackbar.js +1 -0
- package/components/switch/index.d.ts +123 -0
- package/components/switch/index.js +245 -0
- package/components/switch/style.d.ts +1 -0
- package/components/switch/style.js +2 -0
- package/components/switch.d.ts +1 -0
- package/components/switch.js +1 -0
- package/components/tab-panel.d.ts +1 -0
- package/components/tab-panel.js +1 -0
- package/components/tab.d.ts +1 -0
- package/components/tab.js +1 -0
- package/components/tabs/tab-panel-style.d.ts +1 -0
- package/components/tabs/tab-panel-style.js +2 -0
- package/components/tabs/tab-panel.d.ts +36 -0
- package/components/tabs/tab-panel.js +52 -0
- package/components/tabs/tab-style.d.ts +1 -0
- package/components/tabs/tab-style.js +2 -0
- package/components/tabs/tab.d.ts +69 -0
- package/components/tabs/tab.js +110 -0
- package/components/tabs/tabs-style.d.ts +1 -0
- package/components/tabs/tabs-style.js +2 -0
- package/components/tabs/tabs.d.ts +87 -0
- package/components/tabs/tabs.js +221 -0
- package/components/tabs.d.ts +1 -0
- package/components/tabs.js +1 -0
- package/components/text-field/index.d.ts +400 -0
- package/components/text-field/index.js +752 -0
- package/components/text-field/style.d.ts +1 -0
- package/components/text-field/style.js +2 -0
- package/components/text-field.d.ts +1 -0
- package/components/text-field.js +1 -0
- package/components/tooltip/index.d.ts +140 -0
- package/components/tooltip/index.js +497 -0
- package/components/tooltip/style.d.ts +1 -0
- package/components/tooltip/style.js +2 -0
- package/components/tooltip.d.ts +1 -0
- package/components/tooltip.js +1 -0
- package/components/top-app-bar/top-app-bar-style.d.ts +1 -0
- package/components/top-app-bar/top-app-bar-style.js +2 -0
- package/components/top-app-bar/top-app-bar-title-style.d.ts +1 -0
- package/components/top-app-bar/top-app-bar-title-style.js +2 -0
- package/components/top-app-bar/top-app-bar-title.d.ts +46 -0
- package/components/top-app-bar/top-app-bar-title.js +76 -0
- package/components/top-app-bar/top-app-bar.d.ts +74 -0
- package/components/top-app-bar/top-app-bar.js +178 -0
- package/components/top-app-bar-title.d.ts +1 -0
- package/components/top-app-bar-title.js +1 -0
- package/components/top-app-bar.d.ts +1 -0
- package/components/top-app-bar.js +1 -0
- package/css-data.zh-cn.json +2819 -0
- package/custom-elements.json +28087 -0
- package/functions/alert.d.ts +80 -0
- package/functions/alert.js +59 -0
- package/functions/breakpoint.d.ts +1 -0
- package/functions/breakpoint.js +1 -0
- package/functions/confirm.d.ts +95 -0
- package/functions/confirm.js +68 -0
- package/functions/dialog.d.ts +97 -0
- package/functions/dialog.js +100 -0
- package/functions/getColorFromImage.d.ts +7 -0
- package/functions/getColorFromImage.js +12 -0
- package/functions/getTheme.d.ts +10 -0
- package/functions/getTheme.js +16 -0
- package/functions/observeResize.d.ts +2 -0
- package/functions/observeResize.js +1 -0
- package/functions/prompt.d.ts +110 -0
- package/functions/prompt.js +103 -0
- package/functions/removeColorScheme.d.ts +6 -0
- package/functions/removeColorScheme.js +8 -0
- package/functions/setColorScheme.d.ts +15 -0
- package/functions/setColorScheme.js +15 -0
- package/functions/setTheme.d.ts +10 -0
- package/functions/setTheme.js +16 -0
- package/functions/snackbar.d.ts +91 -0
- package/functions/snackbar.js +84 -0
- package/functions/throttle.d.ts +1 -0
- package/functions/throttle.js +1 -0
- package/functions/utils/colorScheme.d.ts +39 -0
- package/functions/utils/colorScheme.js +133 -0
- package/functions/utils/theme.d.ts +1 -0
- package/html-data.zh-cn.json +6566 -0
- package/jq.d.ts +1 -0
- package/jq.js +1 -0
- package/mdui.css +1 -0
- package/mdui.d.ts +61 -0
- package/mdui.esm.js +22 -0
- package/mdui.global.js +22 -0
- package/mdui.js +61 -0
- package/package.json +39 -68
- package/web-types.zh-cn.json +11728 -0
- package/dist/css/mdui.css +0 -13559
- package/dist/css/mdui.css.map +0 -1
- package/dist/css/mdui.min.css +0 -6
- package/dist/css/mdui.min.css.map +0 -1
- package/dist/fonts/roboto/LICENSE.txt +0 -201
- package/dist/fonts/roboto/Roboto-Black.woff +0 -0
- package/dist/fonts/roboto/Roboto-Black.woff2 +0 -0
- package/dist/fonts/roboto/Roboto-BlackItalic.woff +0 -0
- package/dist/fonts/roboto/Roboto-BlackItalic.woff2 +0 -0
- package/dist/fonts/roboto/Roboto-Bold.woff +0 -0
- package/dist/fonts/roboto/Roboto-Bold.woff2 +0 -0
- package/dist/fonts/roboto/Roboto-BoldItalic.woff +0 -0
- package/dist/fonts/roboto/Roboto-BoldItalic.woff2 +0 -0
- package/dist/fonts/roboto/Roboto-Light.woff +0 -0
- package/dist/fonts/roboto/Roboto-Light.woff2 +0 -0
- package/dist/fonts/roboto/Roboto-LightItalic.woff +0 -0
- package/dist/fonts/roboto/Roboto-LightItalic.woff2 +0 -0
- package/dist/fonts/roboto/Roboto-Medium.woff +0 -0
- package/dist/fonts/roboto/Roboto-Medium.woff2 +0 -0
- package/dist/fonts/roboto/Roboto-MediumItalic.woff +0 -0
- package/dist/fonts/roboto/Roboto-MediumItalic.woff2 +0 -0
- package/dist/fonts/roboto/Roboto-Regular.woff +0 -0
- package/dist/fonts/roboto/Roboto-Regular.woff2 +0 -0
- package/dist/fonts/roboto/Roboto-RegularItalic.woff +0 -0
- package/dist/fonts/roboto/Roboto-RegularItalic.woff2 +0 -0
- package/dist/fonts/roboto/Roboto-Thin.woff +0 -0
- package/dist/fonts/roboto/Roboto-Thin.woff2 +0 -0
- package/dist/fonts/roboto/Roboto-ThinItalic.woff +0 -0
- package/dist/fonts/roboto/Roboto-ThinItalic.woff2 +0 -0
- package/dist/icons/material-icons/LICENSE.txt +0 -393
- package/dist/icons/material-icons/MaterialIcons-Regular.ijmap +0 -1
- package/dist/icons/material-icons/MaterialIcons-Regular.woff +0 -0
- package/dist/icons/material-icons/MaterialIcons-Regular.woff2 +0 -0
- package/dist/js/mdui.esm.js +0 -5976
- package/dist/js/mdui.esm.js.map +0 -1
- package/dist/js/mdui.js +0 -6474
- package/dist/js/mdui.js.map +0 -1
- package/dist/js/mdui.min.js +0 -7
- package/dist/js/mdui.min.js.map +0 -1
- package/es/components/appbar/index.d.ts +0 -2
- package/es/components/appbar/index.js +0 -17
- package/es/components/bottom_nav/index.d.ts +0 -9
- package/es/components/bottom_nav/index.js +0 -38
- package/es/components/collapse/collapseAbstract.d.ts +0 -110
- package/es/components/collapse/collapseAbstract.js +0 -175
- package/es/components/collapse/customAttr.d.ts +0 -2
- package/es/components/collapse/customAttr.js +0 -11
- package/es/components/collapse/index.d.ts +0 -23
- package/es/components/collapse/index.js +0 -8
- package/es/components/dialog/alert.d.ts +0 -44
- package/es/components/dialog/alert.js +0 -42
- package/es/components/dialog/class.d.ts +0 -133
- package/es/components/dialog/class.js +0 -316
- package/es/components/dialog/confirm.d.ts +0 -54
- package/es/components/dialog/confirm.js +0 -55
- package/es/components/dialog/customAttr.d.ts +0 -4
- package/es/components/dialog/customAttr.js +0 -25
- package/es/components/dialog/dialog.d.ts +0 -91
- package/es/components/dialog/dialog.js +0 -101
- package/es/components/dialog/index.d.ts +0 -20
- package/es/components/dialog/index.js +0 -14
- package/es/components/dialog/prompt.d.ts +0 -74
- package/es/components/dialog/prompt.js +0 -109
- package/es/components/drawer/customAttr.d.ts +0 -4
- package/es/components/drawer/customAttr.js +0 -20
- package/es/components/drawer/index.d.ts +0 -111
- package/es/components/drawer/index.js +0 -310
- package/es/components/fab/customAttr.d.ts +0 -1
- package/es/components/fab/customAttr.js +0 -13
- package/es/components/fab/index.d.ts +0 -100
- package/es/components/fab/index.js +0 -144
- package/es/components/headroom/customAttr.d.ts +0 -2
- package/es/components/headroom/customAttr.js +0 -11
- package/es/components/headroom/index.d.ts +0 -120
- package/es/components/headroom/index.js +0 -167
- package/es/components/menu/customAttr.d.ts +0 -3
- package/es/components/menu/customAttr.js +0 -24
- package/es/components/menu/index.d.ts +0 -167
- package/es/components/menu/index.js +0 -512
- package/es/components/panel/customAttr.d.ts +0 -2
- package/es/components/panel/customAttr.js +0 -11
- package/es/components/panel/index.d.ts +0 -23
- package/es/components/panel/index.js +0 -8
- package/es/components/progress/spinner.d.ts +0 -16
- package/es/components/progress/spinner.js +0 -47
- package/es/components/ripple/index.d.ts +0 -25
- package/es/components/ripple/index.js +0 -170
- package/es/components/select/customAttr.d.ts +0 -2
- package/es/components/select/customAttr.js +0 -11
- package/es/components/select/index.d.ts +0 -160
- package/es/components/select/index.js +0 -340
- package/es/components/slider/index.d.ts +0 -28
- package/es/components/slider/index.js +0 -134
- package/es/components/snackbar/index.d.ts +0 -126
- package/es/components/snackbar/index.js +0 -217
- package/es/components/tab/customAttr.d.ts +0 -2
- package/es/components/tab/customAttr.js +0 -11
- package/es/components/tab/index.d.ts +0 -114
- package/es/components/tab/index.js +0 -266
- package/es/components/table/index.d.ts +0 -25
- package/es/components/table/index.js +0 -178
- package/es/components/textfield/index.d.ts +0 -28
- package/es/components/textfield/index.js +0 -147
- package/es/components/tooltip/customAttr.d.ts +0 -3
- package/es/components/tooltip/customAttr.js +0 -20
- package/es/components/tooltip/index.d.ts +0 -123
- package/es/components/tooltip/index.js +0 -251
- package/es/global/mutation.d.ts +0 -23
- package/es/global/mutation.js +0 -14
- package/es/index.d.ts +0 -36
- package/es/index.js +0 -36
- package/es/interfaces/MduiStatic.d.ts +0 -8
- package/es/jq.d.ts +0 -99
- package/es/jq.js +0 -102
- package/es/jq_extends/methods/mutation.d.ts +0 -11
- package/es/jq_extends/methods/mutation.js +0 -19
- package/es/jq_extends/methods/reflow.d.ts +0 -14
- package/es/jq_extends/methods/reflow.js +0 -7
- package/es/jq_extends/methods/transform.d.ts +0 -14
- package/es/jq_extends/methods/transform.js +0 -8
- package/es/jq_extends/methods/transformOrigin.d.ts +0 -14
- package/es/jq_extends/methods/transformOrigin.js +0 -8
- package/es/jq_extends/methods/transition.d.ts +0 -15
- package/es/jq_extends/methods/transition.js +0 -12
- package/es/jq_extends/methods/transitionEnd.d.ts +0 -17
- package/es/jq_extends/methods/transitionEnd.js +0 -23
- package/es/jq_extends/static/guid.d.ts +0 -18
- package/es/jq_extends/static/guid.js +0 -30
- package/es/jq_extends/static/hideOverlay.d.ts +0 -23
- package/es/jq_extends/static/hideOverlay.js +0 -25
- package/es/jq_extends/static/lockScreen.d.ts +0 -15
- package/es/jq_extends/static/lockScreen.js +0 -14
- package/es/jq_extends/static/showOverlay.d.ts +0 -23
- package/es/jq_extends/static/showOverlay.js +0 -27
- package/es/jq_extends/static/throttle.d.ts +0 -17
- package/es/jq_extends/static/throttle.js +0 -13
- package/es/jq_extends/static/unlockScreen.d.ts +0 -22
- package/es/jq_extends/static/unlockScreen.js +0 -13
- package/es/mdui.d.ts +0 -3
- package/es/mdui.js +0 -8
- package/es/utils/componentEvent.d.ts +0 -13
- package/es/utils/componentEvent.js +0 -37
- package/es/utils/dom.d.ts +0 -4
- package/es/utils/dom.js +0 -5
- package/es/utils/mutation.d.ts +0 -15
- package/es/utils/mutation.js +0 -24
- package/es/utils/parseOptions.d.ts +0 -9
- package/es/utils/parseOptions.js +0 -15
- package/es/utils/queue.d.ts +0 -18
- package/es/utils/queue.js +0 -26
- package/es/utils/touchHandler.d.ts +0 -50
- package/es/utils/touchHandler.js +0 -76
- package/src/components/appbar/index.less +0 -110
- package/src/components/appbar/index.ts +0 -19
- package/src/components/bottom_nav/index.less +0 -155
- package/src/components/bottom_nav/index.ts +0 -43
- package/src/components/button/index.less +0 -291
- package/src/components/card/index.less +0 -200
- package/src/components/chip/index.less +0 -97
- package/src/components/collapse/collapseAbstract.ts +0 -270
- package/src/components/collapse/customAttr.ts +0 -13
- package/src/components/collapse/index.less +0 -44
- package/src/components/collapse/index.ts +0 -32
- package/src/components/dialog/alert.less +0 -11
- package/src/components/dialog/alert.ts +0 -111
- package/src/components/dialog/class.ts +0 -432
- package/src/components/dialog/confirm.less +0 -11
- package/src/components/dialog/confirm.ts +0 -140
- package/src/components/dialog/customAttr.ts +0 -41
- package/src/components/dialog/dialog.ts +0 -224
- package/src/components/dialog/index.less +0 -154
- package/src/components/dialog/index.ts +0 -40
- package/src/components/dialog/prompt.less +0 -16
- package/src/components/dialog/prompt.ts +0 -231
- package/src/components/divider/index.less +0 -49
- package/src/components/drawer/customAttr.ts +0 -30
- package/src/components/drawer/index.less +0 -177
- package/src/components/drawer/index.ts +0 -425
- package/src/components/fab/customAttr.ts +0 -23
- package/src/components/fab/index.less +0 -158
- package/src/components/fab/index.ts +0 -232
- package/src/components/grid_list/index.less +0 -126
- package/src/components/headroom/customAttr.ts +0 -13
- package/src/components/headroom/index.less +0 -51
- package/src/components/headroom/index.ts +0 -275
- package/src/components/list/index.less +0 -347
- package/src/components/menu/customAttr.ts +0 -40
- package/src/components/menu/index.less +0 -195
- package/src/components/menu/index.ts +0 -725
- package/src/components/menu/svg/arrow_right_dark.svg +0 -1
- package/src/components/menu/svg/arrow_right_light.svg +0 -1
- package/src/components/panel/customAttr.ts +0 -13
- package/src/components/panel/index.less +0 -191
- package/src/components/panel/index.ts +0 -32
- package/src/components/progress/progress.less +0 -113
- package/src/components/progress/spinner.less +0 -198
- package/src/components/progress/spinner.ts +0 -75
- package/src/components/ripple/index.less +0 -92
- package/src/components/ripple/index.ts +0 -217
- package/src/components/select/customAttr.ts +0 -13
- package/src/components/select/index.less +0 -342
- package/src/components/select/index.ts +0 -478
- package/src/components/select/svg/arrow_down_dark.svg +0 -1
- package/src/components/select/svg/arrow_down_light.svg +0 -1
- package/src/components/select/svg/arrow_up_dark.svg +0 -1
- package/src/components/select/svg/arrow_up_light.svg +0 -1
- package/src/components/selection_control/checkbox.less +0 -226
- package/src/components/selection_control/radio.less +0 -163
- package/src/components/selection_control/switch.less +0 -210
- package/src/components/slider/index.less +0 -340
- package/src/components/slider/index.ts +0 -187
- package/src/components/snackbar/index.less +0 -133
- package/src/components/snackbar/index.ts +0 -367
- package/src/components/subheader/index.less +0 -38
- package/src/components/tab/customAttr.ts +0 -13
- package/src/components/tab/index.less +0 -195
- package/src/components/tab/index.ts +0 -372
- package/src/components/table/index.less +0 -169
- package/src/components/table/index.ts +0 -240
- package/src/components/textfield/index.less +0 -425
- package/src/components/textfield/index.ts +0 -217
- package/src/components/toolbar/index.less +0 -92
- package/src/components/tooltip/customAttr.ts +0 -26
- package/src/components/tooltip/index.less +0 -45
- package/src/components/tooltip/index.ts +0 -361
- package/src/fonts/roboto/LICENSE.txt +0 -201
- package/src/fonts/roboto/Roboto-Black.woff +0 -0
- package/src/fonts/roboto/Roboto-Black.woff2 +0 -0
- package/src/fonts/roboto/Roboto-BlackItalic.woff +0 -0
- package/src/fonts/roboto/Roboto-BlackItalic.woff2 +0 -0
- package/src/fonts/roboto/Roboto-Bold.woff +0 -0
- package/src/fonts/roboto/Roboto-Bold.woff2 +0 -0
- package/src/fonts/roboto/Roboto-BoldItalic.woff +0 -0
- package/src/fonts/roboto/Roboto-BoldItalic.woff2 +0 -0
- package/src/fonts/roboto/Roboto-Light.woff +0 -0
- package/src/fonts/roboto/Roboto-Light.woff2 +0 -0
- package/src/fonts/roboto/Roboto-LightItalic.woff +0 -0
- package/src/fonts/roboto/Roboto-LightItalic.woff2 +0 -0
- package/src/fonts/roboto/Roboto-Medium.woff +0 -0
- package/src/fonts/roboto/Roboto-Medium.woff2 +0 -0
- package/src/fonts/roboto/Roboto-MediumItalic.woff +0 -0
- package/src/fonts/roboto/Roboto-MediumItalic.woff2 +0 -0
- package/src/fonts/roboto/Roboto-Regular.woff +0 -0
- package/src/fonts/roboto/Roboto-Regular.woff2 +0 -0
- package/src/fonts/roboto/Roboto-RegularItalic.woff +0 -0
- package/src/fonts/roboto/Roboto-RegularItalic.woff2 +0 -0
- package/src/fonts/roboto/Roboto-Thin.woff +0 -0
- package/src/fonts/roboto/Roboto-Thin.woff2 +0 -0
- package/src/fonts/roboto/Roboto-ThinItalic.woff +0 -0
- package/src/fonts/roboto/Roboto-ThinItalic.woff2 +0 -0
- package/src/global/mutation.ts +0 -37
- package/src/icons/material-icons/LICENSE.txt +0 -393
- package/src/icons/material-icons/MaterialIcons-Regular.ijmap +0 -1
- package/src/icons/material-icons/MaterialIcons-Regular.woff +0 -0
- package/src/icons/material-icons/MaterialIcons-Regular.woff2 +0 -0
- package/src/index.less +0 -73
- package/src/index.ts +0 -39
- package/src/interfaces/MduiStatic.ts +0 -11
- package/src/jq.ts +0 -104
- package/src/jq_extends/methods/mutation.ts +0 -32
- package/src/jq_extends/methods/reflow.ts +0 -23
- package/src/jq_extends/methods/transform.ts +0 -24
- package/src/jq_extends/methods/transformOrigin.ts +0 -24
- package/src/jq_extends/methods/transition.ts +0 -30
- package/src/jq_extends/methods/transitionEnd.ts +0 -49
- package/src/jq_extends/static/guid.ts +0 -56
- package/src/jq_extends/static/hideOverlay.ts +0 -50
- package/src/jq_extends/static/lockScreen.ts +0 -30
- package/src/jq_extends/static/showOverlay.ts +0 -51
- package/src/jq_extends/static/throttle.ts +0 -32
- package/src/jq_extends/static/unlockScreen.ts +0 -36
- package/src/mdui.ts +0 -12
- package/src/styles/color.less +0 -392
- package/src/styles/global.less +0 -75
- package/src/styles/grid.less +0 -150
- package/src/styles/helper.less +0 -242
- package/src/styles/icon.less +0 -31
- package/src/styles/material-icons.less +0 -36
- package/src/styles/media.less +0 -39
- package/src/styles/mixin/color.less +0 -66
- package/src/styles/mixin/divider.less +0 -30
- package/src/styles/mixin/helper.less +0 -126
- package/src/styles/mixin/icon.less +0 -33
- package/src/styles/mixin/layout-theme.less +0 -14
- package/src/styles/mixin/media.less +0 -11
- package/src/styles/mixin/shadow.less +0 -17
- package/src/styles/mixin/typo.less +0 -149
- package/src/styles/mixin.less +0 -8
- package/src/styles/roboto.less +0 -125
- package/src/styles/shadow.less +0 -20
- package/src/styles/typo-styles.less +0 -91
- package/src/styles/typo.less +0 -338
- package/src/styles/variable/animation.less +0 -5
- package/src/styles/variable/color/amber.less +0 -41
- package/src/styles/variable/color/black.less +0 -16
- package/src/styles/variable/color/blue-grey.less +0 -29
- package/src/styles/variable/color/blue.less +0 -41
- package/src/styles/variable/color/brown.less +0 -29
- package/src/styles/variable/color/cyan.less +0 -41
- package/src/styles/variable/color/deep-orange.less +0 -41
- package/src/styles/variable/color/deep-purple.less +0 -41
- package/src/styles/variable/color/default.less +0 -74
- package/src/styles/variable/color/green.less +0 -41
- package/src/styles/variable/color/grey.less +0 -29
- package/src/styles/variable/color/indigo.less +0 -41
- package/src/styles/variable/color/light-blue.less +0 -41
- package/src/styles/variable/color/light-green.less +0 -41
- package/src/styles/variable/color/lime.less +0 -41
- package/src/styles/variable/color/orange.less +0 -41
- package/src/styles/variable/color/pink.less +0 -41
- package/src/styles/variable/color/purple.less +0 -41
- package/src/styles/variable/color/red.less +0 -41
- package/src/styles/variable/color/teal.less +0 -41
- package/src/styles/variable/color/transparent.less +0 -1
- package/src/styles/variable/color/white.less +0 -16
- package/src/styles/variable/color/yellow.less +0 -41
- package/src/styles/variable/global.less +0 -98
- package/src/styles/variable/shadow.less +0 -103
- package/src/styles/variable.less +0 -26
- package/src/tsconfig.json +0 -12
- package/src/utils/componentEvent.ts +0 -63
- package/src/utils/dom.ts +0 -7
- package/src/utils/mutation.ts +0 -41
- package/src/utils/parseOptions.ts +0 -23
- package/src/utils/queue.ts +0 -51
- package/src/utils/touchHandler.ts +0 -92
- /package/{es/interfaces/MduiStatic.js → functions/utils/theme.js} +0 -0
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html, LitElement } from 'lit';
|
|
3
|
+
import { customElement, property, queryAssignedElements, } from 'lit/decorators.js';
|
|
4
|
+
import { createRef, ref } from 'lit/directives/ref.js';
|
|
5
|
+
import { $ } from '@mdui/jq/$.js';
|
|
6
|
+
import '@mdui/jq/methods/height.js';
|
|
7
|
+
import '@mdui/jq/methods/is.js';
|
|
8
|
+
import '@mdui/jq/methods/on.js';
|
|
9
|
+
import '@mdui/jq/methods/width.js';
|
|
10
|
+
import { watch } from '@mdui/shared/decorators/watch.js';
|
|
11
|
+
import { animateTo, stopAnimations } from '@mdui/shared/helpers/animate.js';
|
|
12
|
+
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
13
|
+
import { emit } from '@mdui/shared/helpers/event.js';
|
|
14
|
+
import { getDuration, getEasing } from '@mdui/shared/helpers/motion.js';
|
|
15
|
+
import { observeResize } from '@mdui/shared/helpers/observeResize.js';
|
|
16
|
+
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
17
|
+
import { style } from './style.js';
|
|
18
|
+
/**
|
|
19
|
+
* @summary 下拉组件
|
|
20
|
+
*
|
|
21
|
+
* ```html
|
|
22
|
+
* <mdui-dropdown>
|
|
23
|
+
* ..<mdui-button slot="trigger">open dropdown</mdui-button>
|
|
24
|
+
* ..<mdui-menu>
|
|
25
|
+
* ....<mdui-menu-item>Item 1</mdui-menu-item>
|
|
26
|
+
* ....<mdui-menu-item>Item 2</mdui-menu-item>
|
|
27
|
+
* ..</mdui-menu>
|
|
28
|
+
* </mdui-dropdown>
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @event open - dropdown 开始打开时,事件被触发。可以通过调用 `event.preventDefault()` 阻止 dropdown 打开
|
|
32
|
+
* @event opened - dropdown 打开动画完成时,事件被触发
|
|
33
|
+
* @event close - dropdown 开始关闭时,事件被触发。可以通过调用 `event.preventDefault()` 阻止 dropdown 关闭
|
|
34
|
+
* @event closed - dropdown 关闭动画完成时,事件被触发
|
|
35
|
+
*
|
|
36
|
+
* @slot - dropdown 的内容
|
|
37
|
+
* @slot trigger - 触发 dropdown 的元素,例如 [`<mdui-button>`](/docs/2/components/button) 元素
|
|
38
|
+
*
|
|
39
|
+
* @csspart trigger - 触发 dropdown 的元素的容器,即 `trigger` slot 的容器
|
|
40
|
+
* @csspart panel - dropdown 内容的容器
|
|
41
|
+
*
|
|
42
|
+
* @cssprop --z-index - 组件的 CSS 的 `z-index` 值
|
|
43
|
+
*/
|
|
44
|
+
export let Dropdown = class Dropdown extends LitElement {
|
|
45
|
+
constructor() {
|
|
46
|
+
super();
|
|
47
|
+
/**
|
|
48
|
+
* dropdown 是否打开
|
|
49
|
+
*/
|
|
50
|
+
this.open = false;
|
|
51
|
+
/**
|
|
52
|
+
* 是否禁用 dropdown
|
|
53
|
+
*/
|
|
54
|
+
this.disabled = false;
|
|
55
|
+
/**
|
|
56
|
+
* dropdown 的触发方式,支持传入多个值,用空格分隔。可选值为:
|
|
57
|
+
*
|
|
58
|
+
* * `click`:点击时触发
|
|
59
|
+
* * `hover`:鼠标悬浮触发
|
|
60
|
+
* * `focus`:聚焦时触发
|
|
61
|
+
* * `contextmenu`:鼠标右键点击、或触摸长按时触发
|
|
62
|
+
* * `manual`:使用了该值时,只能使用编程方式打开和关闭 dropdown,且不能再指定其他触发方式
|
|
63
|
+
*/
|
|
64
|
+
this.trigger = 'click';
|
|
65
|
+
/**
|
|
66
|
+
* dropdown 内容的位置。可选值为:
|
|
67
|
+
*
|
|
68
|
+
* * `auto`:自动判断位置
|
|
69
|
+
* * `top-start`:位于上方,且左对齐
|
|
70
|
+
* * `top`:位于上方,且居中对齐
|
|
71
|
+
* * `top-end`:位于上方,且右对齐
|
|
72
|
+
* * `bottom-start`:位于下方,且左对齐
|
|
73
|
+
* * `bottom`:位于下方,且居中对齐
|
|
74
|
+
* * `bottom-end`:位于下方,且右对齐
|
|
75
|
+
* * `left-start`:位于左侧,且顶部对齐
|
|
76
|
+
* * `left`:位于左侧,且居中对齐
|
|
77
|
+
* * `left-end`:位于左侧,且底部对齐
|
|
78
|
+
* * `right-start`:位于右侧,且顶部对齐
|
|
79
|
+
* * `right`:位于右侧,且居中对齐
|
|
80
|
+
* * `right-end`:位于右侧,且底部对齐
|
|
81
|
+
*/
|
|
82
|
+
this.placement = 'auto';
|
|
83
|
+
/**
|
|
84
|
+
* 在点击 [`<mdui-menu-item>`](/docs/2/components/menu#menu-item-api) 元素后,是否仍保持 dropdown 为打开状态
|
|
85
|
+
*/
|
|
86
|
+
this.stayOpenOnClick = false;
|
|
87
|
+
/**
|
|
88
|
+
* 通过 hover 触发 dropdown 打开时的延时,单位为毫秒
|
|
89
|
+
*/
|
|
90
|
+
this.openDelay = 150;
|
|
91
|
+
/**
|
|
92
|
+
* 通过 hover 触发 dropdown 关闭时的延时,单位为毫秒
|
|
93
|
+
*/
|
|
94
|
+
this.closeDelay = 150;
|
|
95
|
+
/**
|
|
96
|
+
* 是否在触发 dropdown 时的光标所在的位置打开 dropdown。通常用于在打开鼠标右键菜单时使用
|
|
97
|
+
*/
|
|
98
|
+
this.openOnPointer = false;
|
|
99
|
+
this.panelRef = createRef();
|
|
100
|
+
this.onDocumentClick = this.onDocumentClick.bind(this);
|
|
101
|
+
this.onDocumentKeydown = this.onDocumentKeydown.bind(this);
|
|
102
|
+
this.onWindowScroll = this.onWindowScroll.bind(this);
|
|
103
|
+
this.onMouseLeave = this.onMouseLeave.bind(this);
|
|
104
|
+
this.onFocus = this.onFocus.bind(this);
|
|
105
|
+
this.onClick = this.onClick.bind(this);
|
|
106
|
+
this.onContextMenu = this.onContextMenu.bind(this);
|
|
107
|
+
this.onMouseEnter = this.onMouseEnter.bind(this);
|
|
108
|
+
this.onPanelClick = this.onPanelClick.bind(this);
|
|
109
|
+
}
|
|
110
|
+
get triggerSlot() {
|
|
111
|
+
return this.triggerSlots[0];
|
|
112
|
+
}
|
|
113
|
+
get panelSlot() {
|
|
114
|
+
return this.panelSlots[0];
|
|
115
|
+
}
|
|
116
|
+
// 这些属性变更时,需要更新样式
|
|
117
|
+
async onPositionChange() {
|
|
118
|
+
// 打开动画开始前,设置 panel 的样式
|
|
119
|
+
if (this.open) {
|
|
120
|
+
this.updatePositioner();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
async onOpenChange() {
|
|
124
|
+
var _a, _b, _c, _d;
|
|
125
|
+
const hasUpdated = this.hasUpdated;
|
|
126
|
+
const easingLinear = getEasing(this, 'linear');
|
|
127
|
+
const easingEmphasizedDecelerate = getEasing(this, 'emphasized-decelerate');
|
|
128
|
+
const easingEmphasizedAccelerate = getEasing(this, 'emphasized-accelerate');
|
|
129
|
+
// 打开
|
|
130
|
+
// 要区分是否首次渲染,首次渲染时不触发事件,不执行动画;非首次渲染,触发事件,执行动画
|
|
131
|
+
if (this.open) {
|
|
132
|
+
if (!hasUpdated) {
|
|
133
|
+
await this.updateComplete;
|
|
134
|
+
}
|
|
135
|
+
if (hasUpdated) {
|
|
136
|
+
const requestOpen = emit(this, 'open', {
|
|
137
|
+
cancelable: true,
|
|
138
|
+
});
|
|
139
|
+
if (requestOpen.defaultPrevented) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// dropdown 打开时,尝试把焦点放到 panel 中
|
|
144
|
+
if (typeof ((_a = this.panelSlot) === null || _a === void 0 ? void 0 : _a.focus) === 'function') {
|
|
145
|
+
this.panelSlot.focus();
|
|
146
|
+
}
|
|
147
|
+
const duration = getDuration(this, 'medium4');
|
|
148
|
+
await stopAnimations(this.panelRef.value);
|
|
149
|
+
this.panelRef.value.hidden = false;
|
|
150
|
+
this.updatePositioner();
|
|
151
|
+
await Promise.all([
|
|
152
|
+
animateTo(this.panelRef.value, [
|
|
153
|
+
{ transform: `${this.getCssScaleName()}(0.45)` },
|
|
154
|
+
{ transform: `${this.getCssScaleName()}(1)` },
|
|
155
|
+
], {
|
|
156
|
+
duration: hasUpdated ? duration : 0,
|
|
157
|
+
easing: easingEmphasizedDecelerate,
|
|
158
|
+
}),
|
|
159
|
+
animateTo(this.panelRef.value, [{ opacity: 0 }, { opacity: 1, offset: 0.125 }, { opacity: 1 }], {
|
|
160
|
+
duration: hasUpdated ? duration : 0,
|
|
161
|
+
easing: easingLinear,
|
|
162
|
+
}),
|
|
163
|
+
]);
|
|
164
|
+
if (hasUpdated) {
|
|
165
|
+
emit(this, 'opened');
|
|
166
|
+
}
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
// 关闭
|
|
170
|
+
if (!this.open && hasUpdated) {
|
|
171
|
+
const requestClose = emit(this, 'close', {
|
|
172
|
+
cancelable: true,
|
|
173
|
+
});
|
|
174
|
+
if (requestClose.defaultPrevented) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
// dropdown 关闭时,如果不支持 focus 触发,且焦点在 dropdown 内,则焦点回到 trigger 上
|
|
178
|
+
if (!this.hasTrigger('focus') &&
|
|
179
|
+
typeof ((_b = this.triggerSlot) === null || _b === void 0 ? void 0 : _b.focus) === 'function' &&
|
|
180
|
+
(this.contains(document.activeElement) ||
|
|
181
|
+
this.contains((_d = (_c = document.activeElement) === null || _c === void 0 ? void 0 : _c.assignedSlot) !== null && _d !== void 0 ? _d : null))) {
|
|
182
|
+
this.triggerSlot.focus();
|
|
183
|
+
}
|
|
184
|
+
const duration = getDuration(this, 'short4');
|
|
185
|
+
await stopAnimations(this.panelRef.value);
|
|
186
|
+
await Promise.all([
|
|
187
|
+
animateTo(this.panelRef.value, [
|
|
188
|
+
{ transform: `${this.getCssScaleName()}(1)` },
|
|
189
|
+
{ transform: `${this.getCssScaleName()}(0.45)` },
|
|
190
|
+
], { duration, easing: easingEmphasizedAccelerate }),
|
|
191
|
+
animateTo(this.panelRef.value, [{ opacity: 1 }, { opacity: 1, offset: 0.875 }, { opacity: 0 }], { duration, easing: easingLinear }),
|
|
192
|
+
]);
|
|
193
|
+
// 可能关闭 dropdown 时该元素已经不存在了(比如页面直接跳转了)
|
|
194
|
+
if (this.panelRef.value) {
|
|
195
|
+
this.panelRef.value.hidden = true;
|
|
196
|
+
}
|
|
197
|
+
emit(this, 'closed');
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
connectedCallback() {
|
|
201
|
+
super.connectedCallback();
|
|
202
|
+
document.addEventListener('pointerdown', this.onDocumentClick);
|
|
203
|
+
document.addEventListener('keydown', this.onDocumentKeydown);
|
|
204
|
+
window.addEventListener('scroll', this.onWindowScroll);
|
|
205
|
+
// triggerSlot 的尺寸变化时,重新调整 panel 的位置
|
|
206
|
+
this.updateComplete.then(() => {
|
|
207
|
+
this.observeResize = observeResize(this.triggerSlot, () => {
|
|
208
|
+
this.updatePositioner();
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
disconnectedCallback() {
|
|
213
|
+
var _a;
|
|
214
|
+
super.disconnectedCallback();
|
|
215
|
+
document.removeEventListener('pointerdown', this.onDocumentClick);
|
|
216
|
+
document.removeEventListener('keydown', this.onDocumentKeydown);
|
|
217
|
+
window.removeEventListener('scroll', this.onWindowScroll);
|
|
218
|
+
(_a = this.observeResize) === null || _a === void 0 ? void 0 : _a.unobserve();
|
|
219
|
+
}
|
|
220
|
+
firstUpdated(changedProperties) {
|
|
221
|
+
super.firstUpdated(changedProperties);
|
|
222
|
+
this.addEventListener('mouseleave', this.onMouseLeave);
|
|
223
|
+
this.triggerSlot.addEventListener('focus', this.onFocus);
|
|
224
|
+
this.triggerSlot.addEventListener('click', this.onClick);
|
|
225
|
+
this.triggerSlot.addEventListener('contextmenu', this.onContextMenu);
|
|
226
|
+
this.triggerSlot.addEventListener('mouseenter', this.onMouseEnter);
|
|
227
|
+
$(this.panelRef.value).on('click', this.onPanelClick);
|
|
228
|
+
}
|
|
229
|
+
render() {
|
|
230
|
+
return html `<slot name="trigger" part="trigger" class="trigger"></slot><slot ${ref(this.panelRef)} part="panel" class="panel" hidden></slot>`;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* 获取 dropdown 打开、关闭动画的 CSS scaleX 或 scaleY
|
|
234
|
+
*/
|
|
235
|
+
getCssScaleName() {
|
|
236
|
+
return this.animateDirection === 'horizontal' ? 'scaleX' : 'scaleY';
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* 在 document 上点击时,根据条件判断是否要关闭 dropdown
|
|
240
|
+
*/
|
|
241
|
+
onDocumentClick(e) {
|
|
242
|
+
if (this.disabled || !this.open) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const path = e.composedPath();
|
|
246
|
+
// 点击 dropdown 外部区域,直接关闭
|
|
247
|
+
if (!path.includes(this)) {
|
|
248
|
+
this.open = false;
|
|
249
|
+
}
|
|
250
|
+
// 当包含 contextmenu 且不包含 click 时,点击 trigger,关闭
|
|
251
|
+
if (this.hasTrigger('contextmenu') &&
|
|
252
|
+
!this.hasTrigger('click') &&
|
|
253
|
+
path.includes(this.triggerSlot)) {
|
|
254
|
+
this.open = false;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* 在 document 上按下按键时,根据条件判断是否要关闭 dropdown
|
|
259
|
+
*/
|
|
260
|
+
onDocumentKeydown(event) {
|
|
261
|
+
var _a;
|
|
262
|
+
if (this.disabled || !this.open) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
// 按下 ESC 键时,关闭 dropdown
|
|
266
|
+
if (event.key === 'Escape') {
|
|
267
|
+
this.open = false;
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
// 按下 Tab 键时,关闭 dropdown
|
|
271
|
+
if (event.key === 'Tab') {
|
|
272
|
+
// 如果不支持 focus 触发,则焦点回到 trigger 上(这个会在 onOpenChange 中执行 )这里只需阻止默认的 Tab 行为
|
|
273
|
+
if (!this.hasTrigger('focus') &&
|
|
274
|
+
typeof ((_a = this.triggerSlot) === null || _a === void 0 ? void 0 : _a.focus) === 'function') {
|
|
275
|
+
event.preventDefault();
|
|
276
|
+
}
|
|
277
|
+
this.open = false;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
onWindowScroll() {
|
|
281
|
+
window.requestAnimationFrame(() => this.onPositionChange());
|
|
282
|
+
}
|
|
283
|
+
hasTrigger(trigger) {
|
|
284
|
+
const triggers = this.trigger.split(' ');
|
|
285
|
+
return triggers.includes(trigger);
|
|
286
|
+
}
|
|
287
|
+
onFocus() {
|
|
288
|
+
if (this.disabled || this.open || !this.hasTrigger('focus')) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
this.open = true;
|
|
292
|
+
}
|
|
293
|
+
onClick(e) {
|
|
294
|
+
// e.button 为 0 时,为鼠标左键点击。忽略鼠标中间和右键
|
|
295
|
+
if (this.disabled || e.button || !this.hasTrigger('click')) {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
// 支持 hover 或 focus 触发时,点击时,不关闭 dropdown
|
|
299
|
+
if (this.open && (this.hasTrigger('hover') || this.hasTrigger('focus'))) {
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
this.pointerOffsetX = e.offsetX;
|
|
303
|
+
this.pointerOffsetY = e.offsetY;
|
|
304
|
+
this.open = !this.open;
|
|
305
|
+
}
|
|
306
|
+
onPanelClick(e) {
|
|
307
|
+
const event = e;
|
|
308
|
+
if (!this.disabled &&
|
|
309
|
+
!this.stayOpenOnClick &&
|
|
310
|
+
$(event.target).is('mdui-menu-item')) {
|
|
311
|
+
this.open = false;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
onContextMenu(e) {
|
|
315
|
+
if (this.disabled || !this.hasTrigger('contextmenu')) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
e.preventDefault();
|
|
319
|
+
this.pointerOffsetX = e.offsetX;
|
|
320
|
+
this.pointerOffsetY = e.offsetY;
|
|
321
|
+
this.open = true;
|
|
322
|
+
}
|
|
323
|
+
onMouseEnter() {
|
|
324
|
+
// 不做 open 状态的判断,因为可以延时打开和关闭
|
|
325
|
+
if (this.disabled || !this.hasTrigger('hover')) {
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
window.clearTimeout(this.closeTimeout);
|
|
329
|
+
if (this.openDelay) {
|
|
330
|
+
this.openTimeout = window.setTimeout(() => {
|
|
331
|
+
this.open = true;
|
|
332
|
+
}, this.openDelay);
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
this.open = true;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
onMouseLeave() {
|
|
339
|
+
// 不做 open 状态的判断,因为可以延时打开和关闭
|
|
340
|
+
if (this.disabled || !this.hasTrigger('hover')) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
window.clearTimeout(this.openTimeout);
|
|
344
|
+
this.closeTimeout = window.setTimeout(() => {
|
|
345
|
+
this.open = false;
|
|
346
|
+
}, this.closeDelay || 50);
|
|
347
|
+
}
|
|
348
|
+
updatePositioner() {
|
|
349
|
+
var _a;
|
|
350
|
+
const $panel = $(this.panelRef.value);
|
|
351
|
+
const $window = $(window);
|
|
352
|
+
const panelSlots = this.panelSlots;
|
|
353
|
+
const panelRect = {
|
|
354
|
+
width: Math.max(...((_a = panelSlots === null || panelSlots === void 0 ? void 0 : panelSlots.map((panel) => panel.offsetWidth)) !== null && _a !== void 0 ? _a : [])),
|
|
355
|
+
height: panelSlots === null || panelSlots === void 0 ? void 0 : panelSlots.map((panel) => panel.offsetHeight).reduce((total, height) => total + height),
|
|
356
|
+
};
|
|
357
|
+
// 在光标位置触发时,假设 triggerSlot 的宽高为 0,位置位于光标位置
|
|
358
|
+
const triggerClientRect = this.triggerSlot.getBoundingClientRect();
|
|
359
|
+
const triggerRect = this.openOnPointer
|
|
360
|
+
? {
|
|
361
|
+
top: this.pointerOffsetY + triggerClientRect.top,
|
|
362
|
+
left: this.pointerOffsetX + triggerClientRect.left,
|
|
363
|
+
width: 0,
|
|
364
|
+
height: 0,
|
|
365
|
+
}
|
|
366
|
+
: triggerClientRect;
|
|
367
|
+
// dropdown 与屏幕边界至少保留 8px 间距
|
|
368
|
+
const screenMargin = 8;
|
|
369
|
+
let transformOriginX;
|
|
370
|
+
let transformOriginY;
|
|
371
|
+
let top;
|
|
372
|
+
let left;
|
|
373
|
+
let placement = this.placement;
|
|
374
|
+
// 自动判断 dropdown 的方位
|
|
375
|
+
// 优先级为 bottom>top>right>left,start>center>end
|
|
376
|
+
if (placement === 'auto') {
|
|
377
|
+
const windowWidth = $window.width();
|
|
378
|
+
const windowHeight = $window.height();
|
|
379
|
+
let position;
|
|
380
|
+
let alignment;
|
|
381
|
+
if (windowHeight - triggerRect.top - triggerRect.height >
|
|
382
|
+
panelRect.height + screenMargin) {
|
|
383
|
+
// 下方放得下,放下方
|
|
384
|
+
position = 'bottom';
|
|
385
|
+
}
|
|
386
|
+
else if (triggerRect.top > panelRect.height + screenMargin) {
|
|
387
|
+
// 上方放得下,放上方
|
|
388
|
+
position = 'top';
|
|
389
|
+
}
|
|
390
|
+
else if (windowWidth - triggerRect.left - triggerRect.width >
|
|
391
|
+
panelRect.width + screenMargin) {
|
|
392
|
+
// 右侧放得下,放右侧
|
|
393
|
+
position = 'right';
|
|
394
|
+
}
|
|
395
|
+
else if (triggerRect.left > panelRect.width + screenMargin) {
|
|
396
|
+
// 左侧放得下,放左侧
|
|
397
|
+
position = 'left';
|
|
398
|
+
}
|
|
399
|
+
else {
|
|
400
|
+
// 默认放下方
|
|
401
|
+
position = 'bottom';
|
|
402
|
+
}
|
|
403
|
+
if (['top', 'bottom'].includes(position)) {
|
|
404
|
+
if (windowWidth - triggerRect.left > panelRect.width + screenMargin) {
|
|
405
|
+
// 左对齐放得下,左对齐
|
|
406
|
+
alignment = 'start';
|
|
407
|
+
}
|
|
408
|
+
else if (triggerRect.left + triggerRect.width / 2 >
|
|
409
|
+
panelRect.width / 2 + screenMargin &&
|
|
410
|
+
windowWidth - triggerRect.left - triggerRect.width / 2 >
|
|
411
|
+
panelRect.width / 2 + screenMargin) {
|
|
412
|
+
// 居中对齐放得下,居中对齐
|
|
413
|
+
alignment = undefined;
|
|
414
|
+
}
|
|
415
|
+
else if (triggerRect.left + triggerRect.width >
|
|
416
|
+
panelRect.width + screenMargin) {
|
|
417
|
+
// 右对齐放得下,右对齐
|
|
418
|
+
alignment = 'end';
|
|
419
|
+
}
|
|
420
|
+
else {
|
|
421
|
+
// 默认左对齐
|
|
422
|
+
alignment = 'start';
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
else {
|
|
426
|
+
if (windowHeight - triggerRect.top > panelRect.height + screenMargin) {
|
|
427
|
+
// 顶部对齐放得下,顶部对齐
|
|
428
|
+
alignment = 'start';
|
|
429
|
+
}
|
|
430
|
+
else if (triggerRect.top + triggerRect.height / 2 >
|
|
431
|
+
panelRect.height / 2 + screenMargin &&
|
|
432
|
+
windowHeight - triggerRect.top - triggerRect.height / 2 >
|
|
433
|
+
panelRect.height / 2 + screenMargin) {
|
|
434
|
+
// 居中对齐放得下,居中对齐
|
|
435
|
+
alignment = undefined;
|
|
436
|
+
}
|
|
437
|
+
else if (triggerRect.top + triggerRect.height >
|
|
438
|
+
panelRect.height + screenMargin) {
|
|
439
|
+
// 底部对齐放得下,底部对齐
|
|
440
|
+
alignment = 'end';
|
|
441
|
+
}
|
|
442
|
+
else {
|
|
443
|
+
// 默认顶部对齐
|
|
444
|
+
alignment = 'start';
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
placement = alignment
|
|
448
|
+
? [position, alignment].join('-')
|
|
449
|
+
: position;
|
|
450
|
+
}
|
|
451
|
+
// 根据 placement 计算 panel 的位置和方向
|
|
452
|
+
const [position, alignment] = placement.split('-');
|
|
453
|
+
this.animateDirection = ['top', 'bottom'].includes(position)
|
|
454
|
+
? 'vertical'
|
|
455
|
+
: 'horizontal';
|
|
456
|
+
switch (position) {
|
|
457
|
+
case 'top':
|
|
458
|
+
transformOriginY = 'bottom';
|
|
459
|
+
top = triggerRect.top - panelRect.height;
|
|
460
|
+
break;
|
|
461
|
+
case 'bottom':
|
|
462
|
+
transformOriginY = 'top';
|
|
463
|
+
top = triggerRect.top + triggerRect.height;
|
|
464
|
+
break;
|
|
465
|
+
default:
|
|
466
|
+
transformOriginY = 'center';
|
|
467
|
+
switch (alignment) {
|
|
468
|
+
case 'start':
|
|
469
|
+
top = triggerRect.top;
|
|
470
|
+
break;
|
|
471
|
+
case 'end':
|
|
472
|
+
top = triggerRect.top + triggerRect.height - panelRect.height;
|
|
473
|
+
break;
|
|
474
|
+
default:
|
|
475
|
+
top =
|
|
476
|
+
triggerRect.top + triggerRect.height / 2 - panelRect.height / 2;
|
|
477
|
+
break;
|
|
478
|
+
}
|
|
479
|
+
break;
|
|
480
|
+
}
|
|
481
|
+
switch (position) {
|
|
482
|
+
case 'left':
|
|
483
|
+
transformOriginX = 'right';
|
|
484
|
+
left = triggerRect.left - panelRect.width;
|
|
485
|
+
break;
|
|
486
|
+
case 'right':
|
|
487
|
+
transformOriginX = 'left';
|
|
488
|
+
left = triggerRect.left + triggerRect.width;
|
|
489
|
+
break;
|
|
490
|
+
default:
|
|
491
|
+
transformOriginX = 'center';
|
|
492
|
+
switch (alignment) {
|
|
493
|
+
case 'start':
|
|
494
|
+
left = triggerRect.left;
|
|
495
|
+
break;
|
|
496
|
+
case 'end':
|
|
497
|
+
left = triggerRect.left + triggerRect.width - panelRect.width;
|
|
498
|
+
break;
|
|
499
|
+
default:
|
|
500
|
+
left =
|
|
501
|
+
triggerRect.left + triggerRect.width / 2 - panelRect.width / 2;
|
|
502
|
+
break;
|
|
503
|
+
}
|
|
504
|
+
break;
|
|
505
|
+
}
|
|
506
|
+
$panel.css({
|
|
507
|
+
top,
|
|
508
|
+
left,
|
|
509
|
+
transformOrigin: [transformOriginX, transformOriginY].join(' '),
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
Dropdown.styles = [componentStyle, style];
|
|
514
|
+
__decorate([
|
|
515
|
+
property({
|
|
516
|
+
type: Boolean,
|
|
517
|
+
reflect: true,
|
|
518
|
+
converter: booleanConverter,
|
|
519
|
+
})
|
|
520
|
+
], Dropdown.prototype, "open", void 0);
|
|
521
|
+
__decorate([
|
|
522
|
+
property({
|
|
523
|
+
type: Boolean,
|
|
524
|
+
reflect: true,
|
|
525
|
+
converter: booleanConverter,
|
|
526
|
+
})
|
|
527
|
+
], Dropdown.prototype, "disabled", void 0);
|
|
528
|
+
__decorate([
|
|
529
|
+
property({ reflect: true })
|
|
530
|
+
], Dropdown.prototype, "trigger", void 0);
|
|
531
|
+
__decorate([
|
|
532
|
+
property({ reflect: true })
|
|
533
|
+
], Dropdown.prototype, "placement", void 0);
|
|
534
|
+
__decorate([
|
|
535
|
+
property({
|
|
536
|
+
type: Boolean,
|
|
537
|
+
reflect: true,
|
|
538
|
+
converter: booleanConverter,
|
|
539
|
+
attribute: 'stay-open-on-click',
|
|
540
|
+
})
|
|
541
|
+
], Dropdown.prototype, "stayOpenOnClick", void 0);
|
|
542
|
+
__decorate([
|
|
543
|
+
property({ type: Number, reflect: true, attribute: 'open-delay' })
|
|
544
|
+
], Dropdown.prototype, "openDelay", void 0);
|
|
545
|
+
__decorate([
|
|
546
|
+
property({ type: Number, reflect: true, attribute: 'close-delay' })
|
|
547
|
+
], Dropdown.prototype, "closeDelay", void 0);
|
|
548
|
+
__decorate([
|
|
549
|
+
property({
|
|
550
|
+
type: Boolean,
|
|
551
|
+
reflect: true,
|
|
552
|
+
converter: booleanConverter,
|
|
553
|
+
attribute: 'open-on-pointer',
|
|
554
|
+
})
|
|
555
|
+
], Dropdown.prototype, "openOnPointer", void 0);
|
|
556
|
+
__decorate([
|
|
557
|
+
queryAssignedElements({ slot: 'trigger', flatten: true })
|
|
558
|
+
], Dropdown.prototype, "triggerSlots", void 0);
|
|
559
|
+
__decorate([
|
|
560
|
+
queryAssignedElements({ flatten: true })
|
|
561
|
+
], Dropdown.prototype, "panelSlots", void 0);
|
|
562
|
+
__decorate([
|
|
563
|
+
watch('placement', true),
|
|
564
|
+
watch('openOnPointer', true)
|
|
565
|
+
], Dropdown.prototype, "onPositionChange", null);
|
|
566
|
+
__decorate([
|
|
567
|
+
watch('open')
|
|
568
|
+
], Dropdown.prototype, "onOpenChange", null);
|
|
569
|
+
Dropdown = __decorate([
|
|
570
|
+
customElement('mdui-dropdown')
|
|
571
|
+
], Dropdown);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const style: import("lit").CSSResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dropdown/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dropdown/index.js';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ButtonBase } from '../button/button-base.js';
|
|
2
|
+
import '../icon.js';
|
|
3
|
+
import type { Ripple } from '../ripple/index.js';
|
|
4
|
+
import type { TemplateResult, CSSResultGroup } from 'lit';
|
|
5
|
+
/**
|
|
6
|
+
* @summary 浮动操作按钮组件
|
|
7
|
+
*
|
|
8
|
+
* ```html
|
|
9
|
+
* <mdui-fab icon="edit"></mdui-fab>
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @event focus - 获得焦点时触发
|
|
13
|
+
* @event blur - 失去焦点时触发
|
|
14
|
+
* @event invalid - 表单字段验证未通过时触发
|
|
15
|
+
*
|
|
16
|
+
* @slot - 文本
|
|
17
|
+
* @slot icon - 图标
|
|
18
|
+
*
|
|
19
|
+
* @csspart button - 内部的 `button` 或 `a` 元素
|
|
20
|
+
* @csspart label - 右侧的文本
|
|
21
|
+
* @csspart icon - 左侧的图标
|
|
22
|
+
* @csspart loading - 加载中状态的 `<mdui-circular-progress>` 元素
|
|
23
|
+
*
|
|
24
|
+
* @cssprop --shape-corner-small - `size="small"` 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
25
|
+
* @cssprop --shape-corner-normal - `size="normal"` 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
26
|
+
* @cssprop --shape-corner-large - `size="large"` 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
27
|
+
*/
|
|
28
|
+
export declare class Fab extends ButtonBase {
|
|
29
|
+
static styles: CSSResultGroup;
|
|
30
|
+
/**
|
|
31
|
+
* FAB 形状,此组件的不同形状之间只有颜色不一样。可选值为:
|
|
32
|
+
*
|
|
33
|
+
* * `primary`:使用 Primary container 背景色
|
|
34
|
+
* * `surface`:使用 Surface container high 背景色
|
|
35
|
+
* * `secondary`:使用 Secondary container 背景色
|
|
36
|
+
* * `tertiary`:使用 Tertiary container 背景色
|
|
37
|
+
*/
|
|
38
|
+
variant: /*使用 Primary container 背景色*/ 'primary' | /*使用 Surface container high 背景色*/ 'surface' | /*使用 Secondary container 背景色*/ 'secondary' | /*使用 Tertiary container 背景色*/ 'tertiary';
|
|
39
|
+
/**
|
|
40
|
+
* FAB 大小。可选值为:
|
|
41
|
+
* * `normal`:普通大小 FAB
|
|
42
|
+
* * `small`:小型 FAB
|
|
43
|
+
* * `large`:大型 FAB
|
|
44
|
+
*/
|
|
45
|
+
size: /*普通大小 FAB*/ 'normal' | /*小型 FAB*/ 'small' | /*大型 FAB*/ 'large';
|
|
46
|
+
/**
|
|
47
|
+
* Material Icons 图标名。也可以通过 `slot="icon"` 设置
|
|
48
|
+
*/
|
|
49
|
+
icon?: string;
|
|
50
|
+
/**
|
|
51
|
+
* 是否为展开状态
|
|
52
|
+
*/
|
|
53
|
+
extended: boolean;
|
|
54
|
+
private readonly rippleRef;
|
|
55
|
+
private readonly hasSlotController;
|
|
56
|
+
protected get rippleElement(): Ripple;
|
|
57
|
+
/**
|
|
58
|
+
* extended 变更时,设置动画
|
|
59
|
+
*/
|
|
60
|
+
private onExtendedChange;
|
|
61
|
+
protected render(): TemplateResult;
|
|
62
|
+
private renderLabel;
|
|
63
|
+
private renderIcon;
|
|
64
|
+
private renderInner;
|
|
65
|
+
}
|
|
66
|
+
declare global {
|
|
67
|
+
interface HTMLElementTagNameMap {
|
|
68
|
+
'mdui-fab': Fab;
|
|
69
|
+
}
|
|
70
|
+
}
|