sard-uniapp 1.0.1 → 1.0.3
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/README.md +37 -0
- package/components/_template/index.scss +17 -0
- package/components/_template/index.vue +41 -0
- package/components/_template/variables.scss +5 -0
- package/components/accordion/accordion.vue +79 -0
- package/components/accordion/common.d.ts +47 -0
- package/components/accordion/common.js +15 -0
- package/components/accordion/index.d.ts +1 -0
- package/components/accordion/index.js +1 -0
- package/components/accordion/index.scss +9 -0
- package/components/accordion/variables.scss +16 -0
- package/components/accordion-item/accordion-item.vue +83 -0
- package/components/accordion-item/index.scss +56 -0
- package/components/action-sheet/action-sheet.vue +132 -0
- package/components/action-sheet/common.d.ts +42 -0
- package/components/action-sheet/common.js +18 -0
- package/components/action-sheet/index.d.ts +1 -0
- package/components/action-sheet/index.js +1 -0
- package/components/action-sheet/index.scss +103 -0
- package/components/action-sheet/variables.scss +31 -0
- package/components/avatar/avatar.vue +62 -0
- package/components/avatar/common.d.ts +28 -0
- package/components/avatar/common.js +14 -0
- package/components/avatar/index.d.ts +1 -0
- package/components/avatar/index.js +1 -0
- package/components/avatar/index.scss +29 -0
- package/components/avatar/variables.scss +10 -0
- package/components/badge/badge.vue +69 -0
- package/components/badge/common.d.ts +33 -0
- package/components/badge/common.js +18 -0
- package/components/badge/index.d.ts +1 -0
- package/components/badge/index.js +1 -0
- package/components/badge/index.scss +47 -0
- package/components/badge/variables.scss +12 -0
- package/components/button/button.vue +85 -0
- package/components/button/common.d.ts +42 -0
- package/components/button/common.js +23 -0
- package/components/button/index.d.ts +1 -0
- package/components/button/index.js +1 -0
- package/components/button/index.scss +186 -0
- package/components/button/test.scss +10 -0
- package/components/button/variables.scss +38 -0
- package/components/calendar/calendar.vue +290 -0
- package/components/calendar/common.d.ts +131 -0
- package/components/calendar/common.js +94 -0
- package/components/calendar/index.d.ts +1 -0
- package/components/calendar/index.js +1 -0
- package/components/calendar/index.scss +67 -0
- package/components/calendar/variables.scss +32 -0
- package/components/calendar-input/calendar-input.vue +158 -0
- package/components/calendar-input/common.d.ts +52 -0
- package/components/calendar-input/common.js +24 -0
- package/components/calendar-input/index.d.ts +1 -0
- package/components/calendar-input/index.js +1 -0
- package/components/calendar-month/calendar-month.vue +159 -0
- package/components/calendar-month/index.scss +111 -0
- package/components/card/card.vue +71 -0
- package/components/card/common.d.ts +24 -0
- package/components/card/common.js +7 -0
- package/components/card/index.d.ts +1 -0
- package/components/card/index.js +1 -0
- package/components/card/index.scss +44 -0
- package/components/card/variables.scss +19 -0
- package/components/cascader/cascader.vue +254 -0
- package/components/cascader/common.d.ts +50 -0
- package/components/cascader/common.js +34 -0
- package/components/cascader/index.d.ts +1 -0
- package/components/cascader/index.js +1 -0
- package/components/cascader/index.scss +99 -0
- package/components/cascader/variables.scss +19 -0
- package/components/cascader-input/cascader-input.vue +156 -0
- package/components/cascader-input/common.d.ts +45 -0
- package/components/cascader-input/common.js +21 -0
- package/components/cascader-input/index.d.ts +1 -0
- package/components/cascader-input/index.js +1 -0
- package/components/checkbox/checkbox.vue +127 -0
- package/components/checkbox/common.d.ts +102 -0
- package/components/checkbox/common.js +50 -0
- package/components/checkbox/index.d.ts +1 -0
- package/components/checkbox/index.js +1 -0
- package/components/checkbox/index.scss +44 -0
- package/components/checkbox/variables.scss +13 -0
- package/components/checkbox-group/checkbox-group.vue +81 -0
- package/components/checkbox-group/index.scss +19 -0
- package/components/col/col.vue +59 -0
- package/components/col/index.scss +47 -0
- package/components/col/variables.scss +2 -0
- package/components/collapse/collapse.vue +100 -0
- package/components/collapse/common.d.ts +18 -0
- package/components/collapse/common.js +7 -0
- package/components/collapse/index.d.ts +1 -0
- package/components/collapse/index.js +1 -0
- package/components/collapse/index.scss +9 -0
- package/components/collapse/variables.scss +5 -0
- package/components/config/index.d.ts +576 -0
- package/components/config/index.js +329 -0
- package/components/count-down/common.d.ts +45 -0
- package/components/count-down/common.js +45 -0
- package/components/count-down/count-down.vue +106 -0
- package/components/count-down/index.d.ts +1 -0
- package/components/count-down/index.js +1 -0
- package/components/datetime-picker/common.d.ts +54 -0
- package/components/datetime-picker/common.js +100 -0
- package/components/datetime-picker/datetime-picker.vue +154 -0
- package/components/datetime-picker/index.d.ts +1 -0
- package/components/datetime-picker/index.js +1 -0
- package/components/datetime-picker-input/common.d.ts +46 -0
- package/components/datetime-picker-input/common.js +26 -0
- package/components/datetime-picker-input/datetime-picker-input.vue +147 -0
- package/components/datetime-picker-input/index.d.ts +1 -0
- package/components/datetime-picker-input/index.js +1 -0
- package/components/dialog/common.d.ts +60 -0
- package/components/dialog/common.js +42 -0
- package/components/dialog/dialog.vue +189 -0
- package/components/dialog/index.d.ts +1 -0
- package/components/dialog/index.js +1 -0
- package/components/dialog/index.scss +120 -0
- package/components/dialog/variables.scss +28 -0
- package/components/dialog-agent/common.d.ts +62 -0
- package/components/dialog-agent/common.js +57 -0
- package/components/dialog-agent/dialog-agent.vue +67 -0
- package/components/dialog-agent/index.d.ts +1 -0
- package/components/dialog-agent/index.js +1 -0
- package/components/dropdown/common.d.ts +89 -0
- package/components/dropdown/common.js +50 -0
- package/components/dropdown/dropdown.vue +74 -0
- package/components/dropdown/index.d.ts +1 -0
- package/components/dropdown/index.js +1 -0
- package/components/dropdown/index.scss +27 -0
- package/components/dropdown/variables.scss +29 -0
- package/components/dropdown-item/dropdown-item.vue +265 -0
- package/components/dropdown-item/index.scss +117 -0
- package/components/empty/common.d.ts +25 -0
- package/components/empty/common.js +12 -0
- package/components/empty/empty.vue +60 -0
- package/components/empty/index.d.ts +1 -0
- package/components/empty/index.js +1 -0
- package/components/empty/index.scss +34 -0
- package/components/empty/variables.scss +12 -0
- package/components/form/Validator.d.ts +95 -0
- package/components/form/Validator.js +269 -0
- package/components/form/common.d.ts +179 -0
- package/components/form/common.js +99 -0
- package/components/form/form.vue +150 -0
- package/components/form/getUrlRegexp.d.ts +2 -0
- package/components/form/getUrlRegexp.js +53 -0
- package/components/form/index.d.ts +1 -0
- package/components/form/index.js +1 -0
- package/components/form/index.scss +12 -0
- package/components/form/variables.scss +26 -0
- package/components/form-item/form-item.vue +289 -0
- package/components/form-item/index.scss +112 -0
- package/components/grid/common.d.ts +64 -0
- package/components/grid/common.js +32 -0
- package/components/grid/grid.vue +73 -0
- package/components/grid/index.d.ts +1 -0
- package/components/grid/index.js +1 -0
- package/components/grid/index.scss +15 -0
- package/components/grid/variables.scss +16 -0
- package/components/grid-item/grid-item.vue +79 -0
- package/components/grid-item/index.scss +118 -0
- package/components/icon/common.d.ts +23 -0
- package/components/icon/common.js +19 -0
- package/components/icon/icon.vue +56 -0
- package/components/icon/index.d.ts +1 -0
- package/components/icon/index.js +1 -0
- package/components/icon/index.scss +22 -0
- package/components/icon/sari.scss +165 -0
- package/components/icon/variables.scss +2 -0
- package/components/indexes/common.d.ts +62 -0
- package/components/indexes/common.js +21 -0
- package/components/indexes/index.d.ts +1 -0
- package/components/indexes/index.js +1 -0
- package/components/indexes/index.scss +11 -0
- package/components/indexes/indexes.vue +184 -0
- package/components/indexes/variables.scss +25 -0
- package/components/indexes-anchor/index.scss +15 -0
- package/components/indexes-anchor/indexes-anchor.vue +66 -0
- package/components/indexes-nav/index.scss +65 -0
- package/components/indexes-nav/indexes-nav.vue +174 -0
- package/components/input/common.d.ts +128 -0
- package/components/input/common.js +71 -0
- package/components/input/index.d.ts +1 -0
- package/components/input/index.js +1 -0
- package/components/input/index.scss +118 -0
- package/components/input/input.vue +238 -0
- package/components/input/variables.scss +30 -0
- package/components/keyboard/common.d.ts +32 -0
- package/components/keyboard/common.js +117 -0
- package/components/keyboard/index.d.ts +1 -0
- package/components/keyboard/index.js +1 -0
- package/components/keyboard/index.scss +97 -0
- package/components/keyboard/keyboard.vue +210 -0
- package/components/keyboard/variables-dark.scss +12 -0
- package/components/keyboard/variables.scss +22 -0
- package/components/list/common.d.ts +64 -0
- package/components/list/common.js +29 -0
- package/components/list/index.d.ts +1 -0
- package/components/list/index.js +1 -0
- package/components/list/index.scss +50 -0
- package/components/list/list.vue +62 -0
- package/components/list/variables.scss +50 -0
- package/components/list-item/index.scss +91 -0
- package/components/list-item/list-item.vue +94 -0
- package/components/loading/common.d.ts +29 -0
- package/components/loading/common.js +18 -0
- package/components/loading/index.d.ts +1 -0
- package/components/loading/index.js +1 -0
- package/components/loading/index.scss +92 -0
- package/components/loading/loading.vue +76 -0
- package/components/loading/variables.scss +15 -0
- package/components/locale/index.d.ts +10 -0
- package/components/locale/index.js +44 -0
- package/components/locale/lang/zh-CN.d.ts +94 -0
- package/components/locale/lang/zh-CN.js +94 -0
- package/components/menu/common.d.ts +46 -0
- package/components/menu/common.js +21 -0
- package/components/menu/index.d.ts +1 -0
- package/components/menu/index.js +1 -0
- package/components/menu/index.scss +19 -0
- package/components/menu/menu.vue +67 -0
- package/components/menu/variables.scss +20 -0
- package/components/menu-item/index.scss +124 -0
- package/components/menu-item/menu-item.vue +51 -0
- package/components/navbar/common.d.ts +33 -0
- package/components/navbar/common.js +10 -0
- package/components/navbar/index.d.ts +1 -0
- package/components/navbar/index.js +1 -0
- package/components/navbar/index.scss +80 -0
- package/components/navbar/navbar.vue +60 -0
- package/components/navbar/variables.scss +18 -0
- package/components/navbar-item/index.scss +20 -0
- package/components/navbar-item/navbar-item.vue +45 -0
- package/components/notice-bar/common.d.ts +52 -0
- package/components/notice-bar/common.js +34 -0
- package/components/notice-bar/index.d.ts +1 -0
- package/components/notice-bar/index.js +1 -0
- package/components/notice-bar/index.scss +88 -0
- package/components/notice-bar/notice-bar.vue +146 -0
- package/components/notice-bar/variables.scss +19 -0
- package/components/notify/common.d.ts +45 -0
- package/components/notify/common.js +25 -0
- package/components/notify/index.d.ts +1 -0
- package/components/notify/index.js +1 -0
- package/components/notify/index.scss +31 -0
- package/components/notify/notify.vue +93 -0
- package/components/notify/variables.scss +8 -0
- package/components/notify-agent/common.d.ts +53 -0
- package/components/notify-agent/common.js +54 -0
- package/components/notify-agent/index.d.ts +1 -0
- package/components/notify-agent/index.js +1 -0
- package/components/notify-agent/notify-agent.vue +67 -0
- package/components/overlay/common.d.ts +28 -0
- package/components/overlay/common.js +16 -0
- package/components/overlay/index.d.ts +1 -0
- package/components/overlay/index.js +1 -0
- package/components/overlay/index.scss +27 -0
- package/components/overlay/overlay.vue +72 -0
- package/components/overlay/variables.scss +7 -0
- package/components/pagination/common.d.ts +60 -0
- package/components/pagination/common.js +66 -0
- package/components/pagination/index.d.ts +1 -0
- package/components/pagination/index.js +1 -0
- package/components/pagination/index.scss +110 -0
- package/components/pagination/pagination.vue +147 -0
- package/components/pagination/variables.scss +20 -0
- package/components/password-input/common.d.ts +42 -0
- package/components/password-input/common.js +29 -0
- package/components/password-input/index.d.ts +1 -0
- package/components/password-input/index.js +1 -0
- package/components/password-input/index.scss +138 -0
- package/components/password-input/password-input.vue +139 -0
- package/components/password-input/variables.scss +18 -0
- package/components/picker/common.d.ts +48 -0
- package/components/picker/common.js +124 -0
- package/components/picker/index.d.ts +1 -0
- package/components/picker/index.js +1 -0
- package/components/picker/index.scss +21 -0
- package/components/picker/picker.vue +171 -0
- package/components/picker/variables.scss +43 -0
- package/components/picker-input/common.d.ts +36 -0
- package/components/picker-input/common.js +18 -0
- package/components/picker-input/index.d.ts +1 -0
- package/components/picker-input/index.js +1 -0
- package/components/picker-input/picker-input.vue +144 -0
- package/components/popout/common.d.ts +71 -0
- package/components/popout/common.js +43 -0
- package/components/popout/index.d.ts +1 -0
- package/components/popout/index.js +1 -0
- package/components/popout/index.scss +92 -0
- package/components/popout/popout.vue +200 -0
- package/components/popout/variables.scss +24 -0
- package/components/popout-input/common.d.ts +26 -0
- package/components/popout-input/common.js +10 -0
- package/components/popout-input/index.scss +48 -0
- package/components/popout-input/popout-input.vue +136 -0
- package/components/popout-input/variables.scss +10 -0
- package/components/popover/common.d.ts +79 -0
- package/components/popover/common.js +49 -0
- package/components/popover/index.d.ts +3 -0
- package/components/popover/index.js +1 -0
- package/components/popover/index.scss +74 -0
- package/components/popover/popover.vue +210 -0
- package/components/popover/usePopover.d.ts +7 -0
- package/components/popover/usePopover.js +35 -0
- package/components/popover/utils.d.ts +24 -0
- package/components/popover/utils.js +130 -0
- package/components/popover/variables.scss +14 -0
- package/components/popover-reference/index.d.ts +1 -0
- package/components/popover-reference/index.js +1 -0
- package/components/popover-reference/popover-reference.vue +60 -0
- package/components/popup/common.d.ts +56 -0
- package/components/popup/common.js +49 -0
- package/components/popup/index.d.ts +1 -0
- package/components/popup/index.js +1 -0
- package/components/popup/index.scss +126 -0
- package/components/popup/popup.vue +100 -0
- package/components/popup/variables.scss +6 -0
- package/components/progress-bar/common.d.ts +36 -0
- package/components/progress-bar/common.js +24 -0
- package/components/progress-bar/index.d.ts +1 -0
- package/components/progress-bar/index.js +1 -0
- package/components/progress-bar/index.scss +114 -0
- package/components/progress-bar/progress-bar.vue +82 -0
- package/components/progress-bar/variables.scss +28 -0
- package/components/progress-circle/common.d.ts +30 -0
- package/components/progress-circle/common.js +21 -0
- package/components/progress-circle/index.d.ts +1 -0
- package/components/progress-circle/index.js +1 -0
- package/components/progress-circle/index.scss +87 -0
- package/components/progress-circle/progress-circle.vue +119 -0
- package/components/progress-circle/variables.scss +15 -0
- package/components/radio/common.d.ts +94 -0
- package/components/radio/common.js +49 -0
- package/components/radio/index.d.ts +1 -0
- package/components/radio/index.js +1 -0
- package/components/radio/index.scss +44 -0
- package/components/radio/radio.vue +100 -0
- package/components/radio/variables.scss +13 -0
- package/components/radio-group/index.scss +18 -0
- package/components/radio-group/radio-group.vue +79 -0
- package/components/rate/common.d.ts +56 -0
- package/components/rate/common.js +39 -0
- package/components/rate/index.d.ts +1 -0
- package/components/rate/index.js +1 -0
- package/components/rate/index.scss +57 -0
- package/components/rate/rate.vue +233 -0
- package/components/rate/variables.scss +8 -0
- package/components/result/common.d.ts +37 -0
- package/components/result/common.js +24 -0
- package/components/result/index.d.ts +1 -0
- package/components/result/index.js +1 -0
- package/components/result/index.scss +58 -0
- package/components/result/result.vue +64 -0
- package/components/result/variables.scss +21 -0
- package/components/row/index.scss +12 -0
- package/components/row/row.vue +69 -0
- package/components/row/variables.scss +2 -0
- package/components/sard-uniapp/sard-uniapp.vue +7 -0
- package/components/search/common.d.ts +45 -0
- package/components/search/common.js +22 -0
- package/components/search/index.d.ts +1 -0
- package/components/search/index.js +1 -0
- package/components/search/index.scss +43 -0
- package/components/search/search.vue +129 -0
- package/components/search/variables.scss +11 -0
- package/components/share-sheet/common.d.ts +46 -0
- package/components/share-sheet/common.js +22 -0
- package/components/share-sheet/index.d.ts +1 -0
- package/components/share-sheet/index.js +1 -0
- package/components/share-sheet/index.scss +132 -0
- package/components/share-sheet/share-sheet.vue +170 -0
- package/components/share-sheet/variables.scss +46 -0
- package/components/skeleton/common.d.ts +84 -0
- package/components/skeleton/common.js +40 -0
- package/components/skeleton/index.d.ts +1 -0
- package/components/skeleton/index.js +1 -0
- package/components/skeleton/index.scss +75 -0
- package/components/skeleton/skeleton.vue +58 -0
- package/components/skeleton/variables-dark.scss +7 -0
- package/components/skeleton/variables.scss +19 -0
- package/components/skeleton-avatar/index.scss +11 -0
- package/components/skeleton-avatar/skeleton-avatar.vue +52 -0
- package/components/skeleton-block/index.scss +35 -0
- package/components/skeleton-block/skeleton-block.vue +49 -0
- package/components/skeleton-paragraph/index.scss +16 -0
- package/components/skeleton-paragraph/skeleton-paragraph.vue +49 -0
- package/components/skeleton-title/index.scss +9 -0
- package/components/skeleton-title/skeleton-title.vue +46 -0
- package/components/slider/common.d.ts +72 -0
- package/components/slider/common.js +43 -0
- package/components/slider/index.d.ts +1 -0
- package/components/slider/index.js +1 -0
- package/components/slider/index.scss +233 -0
- package/components/slider/slider.vue +367 -0
- package/components/slider/variables-dark.scss +7 -0
- package/components/slider/variables.scss +32 -0
- package/components/stepper/common.d.ts +68 -0
- package/components/stepper/common.js +54 -0
- package/components/stepper/index.d.ts +1 -0
- package/components/stepper/index.js +1 -0
- package/components/stepper/index.scss +75 -0
- package/components/stepper/stepper.vue +219 -0
- package/components/stepper/variables.scss +18 -0
- package/components/steps/common.d.ts +58 -0
- package/components/steps/common.js +46 -0
- package/components/steps/index.d.ts +1 -0
- package/components/steps/index.js +1 -0
- package/components/steps/index.scss +231 -0
- package/components/steps/steps.vue +90 -0
- package/components/steps/variables.scss +37 -0
- package/components/style/base.scss +3 -0
- package/components/style/configuration.scss +62 -0
- package/components/style/functions.scss +39 -0
- package/components/style/index.scss +0 -0
- package/components/style/mixins/bem.scss +225 -0
- package/components/style/mixins/border.scss +157 -0
- package/components/style/mixins/button.scss +38 -0
- package/components/style/mixins/disabled.scss +10 -0
- package/components/style/mixins/ellipsis.scss +5 -0
- package/components/style/mixins/notify.scss +4 -0
- package/components/style/mixins/theme-dark.scss +13 -0
- package/components/style/mixins/universal.scss +6 -0
- package/components/style/mixins.scss +8 -0
- package/components/style/variables-dark.scss +58 -0
- package/components/style/variables.scss +194 -0
- package/components/swiper-dot/common.d.ts +31 -0
- package/components/swiper-dot/common.js +28 -0
- package/components/swiper-dot/index.d.ts +1 -0
- package/components/swiper-dot/index.js +1 -0
- package/components/swiper-dot/index.scss +82 -0
- package/components/swiper-dot/swiper-dot.vue +64 -0
- package/components/swiper-dot/variables.scss +28 -0
- package/components/switch/common.d.ts +45 -0
- package/components/switch/common.js +30 -0
- package/components/switch/index.d.ts +1 -0
- package/components/switch/index.js +1 -0
- package/components/switch/index.scss +59 -0
- package/components/switch/switch.vue +105 -0
- package/components/switch/variables.scss +22 -0
- package/components/tab/index.scss +72 -0
- package/components/tab/tab.vue +91 -0
- package/components/tabbar/common.d.ts +62 -0
- package/components/tabbar/common.js +27 -0
- package/components/tabbar/index.d.ts +1 -0
- package/components/tabbar/index.js +1 -0
- package/components/tabbar/index.scss +18 -0
- package/components/tabbar/tabbar.vue +64 -0
- package/components/tabbar/variables.scss +16 -0
- package/components/tabbar-item/index.scss +30 -0
- package/components/tabbar-item/tabbar-item.vue +79 -0
- package/components/tabs/common.d.ts +66 -0
- package/components/tabs/common.js +26 -0
- package/components/tabs/index.d.ts +1 -0
- package/components/tabs/index.js +1 -0
- package/components/tabs/index.scss +42 -0
- package/components/tabs/tabs.vue +170 -0
- package/components/tabs/variables.scss +24 -0
- package/components/tag/index.scss +80 -0
- package/components/tag/tag.vue +78 -0
- package/components/tag/variables.scss +20 -0
- package/components/toast/common.d.ts +47 -0
- package/components/toast/common.js +34 -0
- package/components/toast/index.d.ts +1 -0
- package/components/toast/index.js +1 -0
- package/components/toast/index.scss +64 -0
- package/components/toast/toast.vue +117 -0
- package/components/toast/variables.scss +27 -0
- package/components/toast-agent/common.d.ts +56 -0
- package/components/toast-agent/common.js +54 -0
- package/components/toast-agent/index.d.ts +1 -0
- package/components/toast-agent/index.js +1 -0
- package/components/toast-agent/toast-agent.vue +66 -0
- package/components/upload/common.d.ts +137 -0
- package/components/upload/common.js +81 -0
- package/components/upload/index.d.ts +1 -0
- package/components/upload/index.js +1 -0
- package/components/upload/index.scss +52 -0
- package/components/upload/upload.vue +245 -0
- package/components/upload/variables.scss +43 -0
- package/components/upload-preview/index.scss +138 -0
- package/components/upload-preview/play.png +0 -0
- package/components/upload-preview/upload-preview.vue +154 -0
- package/dark.scss +4 -0
- package/global.d.ts +160 -0
- package/index.d.ts +63 -0
- package/index.js +63 -3
- package/index.scss +54 -0
- package/package.json +103 -8
- package/use/index.d.ts +3 -0
- package/use/index.js +3 -0
- package/use/useSetTimeout.d.ts +1 -0
- package/use/useSetTimeout.js +24 -0
- package/use/useTransition.d.ts +18 -0
- package/use/useTransition.js +137 -0
- package/use/useZIndex.d.ts +1 -0
- package/use/useZIndex.js +9 -0
- package/utils/bem.d.ts +23 -0
- package/utils/bem.js +49 -0
- package/utils/case.d.ts +4 -0
- package/utils/case.js +26 -0
- package/utils/date.d.ts +14 -0
- package/utils/date.js +91 -0
- package/utils/dom.d.ts +137 -0
- package/utils/dom.js +154 -0
- package/utils/file.d.ts +33 -0
- package/utils/file.js +62 -0
- package/utils/index.d.ts +7 -0
- package/utils/index.js +7 -0
- package/utils/is.d.ts +42 -0
- package/utils/is.js +56 -0
- package/utils/utils.d.ts +209 -0
- package/utils/utils.js +641 -0
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img alt="logo" src="https://fastly.jsdelivr.net/npm/@sard/assets/logo.svg" width="120" height="120" style="margin-bottom: 10px;">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">Sard Uniapp</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">sard-uniapp 是一套基于 Uniapp + Vue3 框架开发的兼容多端的 UI 组件库。</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
📖 <a href="http://sutras.gitee.io/sard-uniapp-docs">文档网站</a>
|
|
11
|
+
🧑🏻🏫 <a href="http://sutras.gitee.io/sard-uniapp-docs/mobile/">案例演示</a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 介绍
|
|
17
|
+
|
|
18
|
+
`sard-uniapp` 是一套基于 `Uniapp` + `Vue3`框架开发的兼容多端的 `UI` 组件库。
|
|
19
|
+
|
|
20
|
+
`sard-uniapp` 兼容 H5 / 小程序 / `APP`(不支持 `nvue` 或 `uvue`)。
|
|
21
|
+
|
|
22
|
+
## 特性
|
|
23
|
+
|
|
24
|
+
- 🧩 60+个高质量组件,覆盖移动端主流场景
|
|
25
|
+
- 💪 支持一套代码同时开发 H5 / 小程序 / App
|
|
26
|
+
- 🌿 支持按需引入和 `Tree Shaking`
|
|
27
|
+
- 📖 详尽的文档和案例展示
|
|
28
|
+
- ʦ 使用 `TypeScript` 编写,提供完整的类型定义
|
|
29
|
+
- 🌈 支持定制主题
|
|
30
|
+
- 🌍 国际化支持
|
|
31
|
+
- 🌙 支持暗黑模式
|
|
32
|
+
- 🧪 单元测试覆盖率超过 80%,保障稳定性
|
|
33
|
+
- ⭐️ 零外部依赖,不依赖三方 `npm` 包
|
|
34
|
+
|
|
35
|
+
## 开源协议
|
|
36
|
+
|
|
37
|
+
本项目基于 <a href="https://zh.wikipedia.org/wiki/MIT%E8%A8%B1%E5%8F%AF%E8%AD%89" target="_blank">MIT</a> 协议,请自由地享受和参与开源。
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="_templateClass" :style="_templateStyle">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</view>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
import { defineComponent as _defineComponent } from "vue";
|
|
9
|
+
import { computed } from "vue";
|
|
10
|
+
import { classNames, stringifyStyle, createBem } from "../../utils";
|
|
11
|
+
import { _templateProps } from "./common";
|
|
12
|
+
const __default__ = {
|
|
13
|
+
options: {
|
|
14
|
+
virtualHost: true,
|
|
15
|
+
styleIsolation: "shared"
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export default /* @__PURE__ */ _defineComponent({
|
|
19
|
+
...__default__,
|
|
20
|
+
__name: "index",
|
|
21
|
+
props: _templateProps,
|
|
22
|
+
emits: ["click"],
|
|
23
|
+
setup(__props, { expose: __expose }) {
|
|
24
|
+
__expose();
|
|
25
|
+
const props = __props;
|
|
26
|
+
const bem = createBem("_template");
|
|
27
|
+
const _templateClass = computed(() => {
|
|
28
|
+
return classNames(bem.b(), props.rootClass);
|
|
29
|
+
});
|
|
30
|
+
const _templateStyle = computed(() => {
|
|
31
|
+
return stringifyStyle(props.rootStyle);
|
|
32
|
+
});
|
|
33
|
+
const __returned__ = { props, bem, _templateClass, _templateStyle };
|
|
34
|
+
return __returned__;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<style lang="scss">
|
|
40
|
+
@import './index.scss';
|
|
41
|
+
</style>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="accordionClass" :style="accordionStyle">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</view>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
import { defineComponent as _defineComponent } from "vue";
|
|
9
|
+
import { computed, provide, ref, watch, toRef, reactive } from "vue";
|
|
10
|
+
import { classNames, stringifyStyle, createBem } from "../../utils";
|
|
11
|
+
import {
|
|
12
|
+
accoridonContextSymbol,
|
|
13
|
+
accordionProps
|
|
14
|
+
} from "./common";
|
|
15
|
+
const __default__ = {
|
|
16
|
+
options: {
|
|
17
|
+
virtualHost: true,
|
|
18
|
+
styleIsolation: "shared"
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export default /* @__PURE__ */ _defineComponent({
|
|
22
|
+
...__default__,
|
|
23
|
+
__name: "accordion",
|
|
24
|
+
props: accordionProps,
|
|
25
|
+
emits: ["update:model-value"],
|
|
26
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
27
|
+
__expose();
|
|
28
|
+
const props = __props;
|
|
29
|
+
const emit = __emit;
|
|
30
|
+
const bem = createBem("accordion");
|
|
31
|
+
const innerValue = ref(props.modelValue);
|
|
32
|
+
watch(
|
|
33
|
+
() => props.modelValue,
|
|
34
|
+
() => {
|
|
35
|
+
innerValue.value = props.modelValue || [];
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
const toggle = (name) => {
|
|
39
|
+
let value;
|
|
40
|
+
if (props.multiple) {
|
|
41
|
+
value = Array.isArray(innerValue.value) ? innerValue.value : [];
|
|
42
|
+
if (value.includes(name)) {
|
|
43
|
+
value = value.filter((item) => item !== name);
|
|
44
|
+
} else {
|
|
45
|
+
value = value.concat(name);
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
if (innerValue.value === name) {
|
|
49
|
+
value = void 0;
|
|
50
|
+
} else {
|
|
51
|
+
value = name;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
innerValue.value = value;
|
|
55
|
+
emit("update:model-value", value);
|
|
56
|
+
};
|
|
57
|
+
provide(
|
|
58
|
+
accoridonContextSymbol,
|
|
59
|
+
reactive({
|
|
60
|
+
value: innerValue,
|
|
61
|
+
multiple: toRef(props, "multiple"),
|
|
62
|
+
toggle
|
|
63
|
+
})
|
|
64
|
+
);
|
|
65
|
+
const accordionClass = computed(() => {
|
|
66
|
+
return classNames(bem.b(), props.rootClass);
|
|
67
|
+
});
|
|
68
|
+
const accordionStyle = computed(() => {
|
|
69
|
+
return stringifyStyle(props.rootStyle);
|
|
70
|
+
});
|
|
71
|
+
const __returned__ = { props, emit, bem, innerValue, toggle, accordionClass, accordionStyle };
|
|
72
|
+
return __returned__;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<style lang="scss">
|
|
78
|
+
@import './index.scss';
|
|
79
|
+
</style>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type PropType, type StyleValue } from 'vue';
|
|
2
|
+
export interface AccordionProps {
|
|
3
|
+
rootStyle?: StyleValue;
|
|
4
|
+
rootClass?: string;
|
|
5
|
+
modelValue?: (string | number)[] | string | number;
|
|
6
|
+
multiple?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const accordionProps: {
|
|
9
|
+
rootStyle: PropType<StyleValue>;
|
|
10
|
+
rootClass: StringConstructor;
|
|
11
|
+
modelValue: PropType<string | number | (string | number)[] | undefined>;
|
|
12
|
+
multiple: BooleanConstructor;
|
|
13
|
+
};
|
|
14
|
+
export interface AccordionEmits {
|
|
15
|
+
(e: 'update:model-value', event: any): void;
|
|
16
|
+
}
|
|
17
|
+
export interface AccordionSlots {
|
|
18
|
+
default(props: Record<string, never>): any;
|
|
19
|
+
}
|
|
20
|
+
export interface AccoridonContext {
|
|
21
|
+
value: any;
|
|
22
|
+
multiple: AccordionProps['multiple'];
|
|
23
|
+
toggle: (name: string | number) => void;
|
|
24
|
+
}
|
|
25
|
+
export declare const accoridonContextSymbol: unique symbol;
|
|
26
|
+
export interface AccordionItemProps {
|
|
27
|
+
rootStyle?: StyleValue;
|
|
28
|
+
rootClass?: string;
|
|
29
|
+
title?: string;
|
|
30
|
+
value?: string;
|
|
31
|
+
name?: string | number;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare const accordionItemProps: {
|
|
35
|
+
rootStyle: PropType<StyleValue>;
|
|
36
|
+
rootClass: StringConstructor;
|
|
37
|
+
title: StringConstructor;
|
|
38
|
+
value: StringConstructor;
|
|
39
|
+
name: (StringConstructor | NumberConstructor)[];
|
|
40
|
+
disabled: BooleanConstructor;
|
|
41
|
+
};
|
|
42
|
+
export interface AccordionItemEmits {
|
|
43
|
+
(e: 'click', event: any): void;
|
|
44
|
+
}
|
|
45
|
+
export interface AccordionItemSlots {
|
|
46
|
+
default(props: Record<string, never>): any;
|
|
47
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const accordionProps = {
|
|
2
|
+
rootStyle: [String, Object, Array],
|
|
3
|
+
rootClass: String,
|
|
4
|
+
modelValue: [String, Number, Array],
|
|
5
|
+
multiple: Boolean,
|
|
6
|
+
};
|
|
7
|
+
export const accoridonContextSymbol = Symbol('accoridon-context');
|
|
8
|
+
export const accordionItemProps = {
|
|
9
|
+
rootStyle: [String, Object, Array],
|
|
10
|
+
rootClass: String,
|
|
11
|
+
title: String,
|
|
12
|
+
value: String,
|
|
13
|
+
name: [String, Number],
|
|
14
|
+
disabled: Boolean,
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { AccordionProps, AccordionEmits, AccordionSlots, AccordionItemProps, AccordionItemEmits, AccordionItemSlots, } from './common';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// #variables
|
|
2
|
+
page {
|
|
3
|
+
--sar-accordion-bg: var(--sar-emphasis-bg);
|
|
4
|
+
--sar-accordion-active-bg: var(--sar-active-bg);
|
|
5
|
+
--sar-accordion-border-color: var(--sar-border-color);
|
|
6
|
+
|
|
7
|
+
--sar-accordion-item-header-padding-x: 32rpx;
|
|
8
|
+
--sar-accordion-item-header-padding-y: 20rpx;
|
|
9
|
+
|
|
10
|
+
--sar-accordion-item-title-font-size: var(--sar-text-base);
|
|
11
|
+
--sar-accordion-item-title-line-height: var(--sar-leading-snug);
|
|
12
|
+
|
|
13
|
+
--sar-accordion-item-body-padding-x: 32rpx;
|
|
14
|
+
--sar-accordion-item-body-padding-y: 32rpx;
|
|
15
|
+
}
|
|
16
|
+
// #endvariables
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="accordionItemClass" :style="accordionItemStyle">
|
|
3
|
+
<view
|
|
4
|
+
:class="
|
|
5
|
+
classNames(bem.e('header'), bem.em('header', 'disabled', disabled))
|
|
6
|
+
"
|
|
7
|
+
@click="onClick"
|
|
8
|
+
>
|
|
9
|
+
<view :class="bem.e('title')">{{ title }}</view>
|
|
10
|
+
<view v-if="value" :class="bem.e('value')">{{ value }}</view>
|
|
11
|
+
<view :class="bem.e('icon')">
|
|
12
|
+
<sar-icon :name="iconName" />
|
|
13
|
+
</view>
|
|
14
|
+
</view>
|
|
15
|
+
<sar-collapse :visible="visible">
|
|
16
|
+
<view :class="bem.e('body')">
|
|
17
|
+
<slot></slot>
|
|
18
|
+
</view>
|
|
19
|
+
</sar-collapse>
|
|
20
|
+
</view>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script lang="ts">
|
|
24
|
+
import { defineComponent as _defineComponent } from "vue";
|
|
25
|
+
import { computed, inject } from "vue";
|
|
26
|
+
import { classNames, stringifyStyle, createBem, isNullish } from "../../utils";
|
|
27
|
+
import {
|
|
28
|
+
accoridonContextSymbol,
|
|
29
|
+
accordionItemProps
|
|
30
|
+
} from "../accordion/common";
|
|
31
|
+
import SarCollapse from "../collapse/collapse.vue";
|
|
32
|
+
import SarIcon from "../icon/icon.vue";
|
|
33
|
+
const __default__ = {
|
|
34
|
+
options: {
|
|
35
|
+
virtualHost: true,
|
|
36
|
+
styleIsolation: "shared"
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export default /* @__PURE__ */ _defineComponent({
|
|
40
|
+
...__default__,
|
|
41
|
+
__name: "accordion-item",
|
|
42
|
+
props: accordionItemProps,
|
|
43
|
+
emits: ["click"],
|
|
44
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
45
|
+
__expose();
|
|
46
|
+
const props = __props;
|
|
47
|
+
const emit = __emit;
|
|
48
|
+
const bem = createBem("accordion-item");
|
|
49
|
+
const context = inject(
|
|
50
|
+
accoridonContextSymbol
|
|
51
|
+
);
|
|
52
|
+
if (!context) {
|
|
53
|
+
throw new Error("AccordionItem must be included in Accordion.");
|
|
54
|
+
}
|
|
55
|
+
const onClick = (event) => {
|
|
56
|
+
if (!props.disabled && !isNullish(props.name)) {
|
|
57
|
+
context.toggle(props.name);
|
|
58
|
+
}
|
|
59
|
+
emit("click", event);
|
|
60
|
+
};
|
|
61
|
+
const visible = computed(() => {
|
|
62
|
+
return context.multiple ? (context.value || []).includes(props.name) : context.value === props.name;
|
|
63
|
+
});
|
|
64
|
+
const iconName = computed(() => {
|
|
65
|
+
return visible.value ? "up" : "down";
|
|
66
|
+
});
|
|
67
|
+
const accordionItemClass = computed(() => {
|
|
68
|
+
return classNames(bem.b(), props.rootClass);
|
|
69
|
+
});
|
|
70
|
+
const accordionItemStyle = computed(() => {
|
|
71
|
+
return stringifyStyle(props.rootStyle);
|
|
72
|
+
});
|
|
73
|
+
const __returned__ = { props, emit, bem, context, onClick, visible, iconName, accordionItemClass, accordionItemStyle, get classNames() {
|
|
74
|
+
return classNames;
|
|
75
|
+
}, SarCollapse, SarIcon };
|
|
76
|
+
return __returned__;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
</script>
|
|
80
|
+
|
|
81
|
+
<style lang="scss">
|
|
82
|
+
@import './index.scss';
|
|
83
|
+
</style>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
@use '../style/base' as *;
|
|
2
|
+
|
|
3
|
+
@include bem(accordion-item) {
|
|
4
|
+
@include b() {
|
|
5
|
+
@include universal;
|
|
6
|
+
background-color: var(--sar-accordion-bg);
|
|
7
|
+
|
|
8
|
+
&::before {
|
|
9
|
+
@include border-top(var(--sar-accordion-border-color));
|
|
10
|
+
left: var(--sar-accordion-item-header-padding-x);
|
|
11
|
+
right: var(--sar-accordion-item-header-padding-x);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&:first-child::before {
|
|
15
|
+
display: none;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@include e(header) {
|
|
20
|
+
@include universal;
|
|
21
|
+
flex-direction: row;
|
|
22
|
+
justify-content: space-between;
|
|
23
|
+
align-items: center;
|
|
24
|
+
padding: var(--sar-accordion-item-header-padding-y)
|
|
25
|
+
var(--sar-accordion-item-header-padding-x);
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
|
|
28
|
+
@include m-not(disabled) {
|
|
29
|
+
&:active {
|
|
30
|
+
background-color: var(--sar-accordion-active-bg);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@include m(disabled) {
|
|
35
|
+
cursor: not-allowed;
|
|
36
|
+
@include disabled;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@include e(title) {
|
|
41
|
+
font-size: var(--sar-accordion-item-title-font-size);
|
|
42
|
+
line-height: var(--sar-accordion-item-title-line-height);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@include e(body) {
|
|
46
|
+
@include universal;
|
|
47
|
+
padding: var(--sar-accordion-item-body-padding-y)
|
|
48
|
+
var(--sar-accordion-item-body-padding-x);
|
|
49
|
+
|
|
50
|
+
&::before {
|
|
51
|
+
@include border-top(var(--sar-accordion-border-color));
|
|
52
|
+
left: var(--sar-accordion-item-body-padding-x);
|
|
53
|
+
right: var(--sar-accordion-item-body-padding-x);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<sar-popup
|
|
3
|
+
effect="slide-bottom"
|
|
4
|
+
:visible="innerVisible"
|
|
5
|
+
:duration="duration"
|
|
6
|
+
@overlay-click="onOverlayClick"
|
|
7
|
+
>
|
|
8
|
+
<view :class="actionSheetClass" :style="actionSheetStyle">
|
|
9
|
+
<view v-if="description" :class="bem.e('description')">
|
|
10
|
+
{{ description }}
|
|
11
|
+
</view>
|
|
12
|
+
<view :class="bem.e('content')">
|
|
13
|
+
<view
|
|
14
|
+
v-for="(item, i) in itemList"
|
|
15
|
+
:key="i"
|
|
16
|
+
:class="
|
|
17
|
+
classNames(
|
|
18
|
+
bem.e('item'),
|
|
19
|
+
bem.em('item', 'disabled', item.disabled),
|
|
20
|
+
bem.em('item', 'loading', item.loading),
|
|
21
|
+
)
|
|
22
|
+
"
|
|
23
|
+
:style="stringifyStyle({ color: item.color })"
|
|
24
|
+
@click="onSelect(item, i)"
|
|
25
|
+
>
|
|
26
|
+
<template v-if="!item.loading">
|
|
27
|
+
<view :class="bem.e('item-name')">
|
|
28
|
+
{{ item.name }}
|
|
29
|
+
</view>
|
|
30
|
+
<view v-if="item.description" :class="bem.e('item-description')">
|
|
31
|
+
{{ item.description }}
|
|
32
|
+
</view>
|
|
33
|
+
</template>
|
|
34
|
+
<view v-else :class="bem.e('loading')">
|
|
35
|
+
<sar-loading />
|
|
36
|
+
</view>
|
|
37
|
+
</view>
|
|
38
|
+
</view>
|
|
39
|
+
<template v-if="cancel">
|
|
40
|
+
<view :class="bem.e('gap')"></view>
|
|
41
|
+
<view :class="bem.e('cancel')" @click="onCancel">
|
|
42
|
+
{{ cancel }}
|
|
43
|
+
</view>
|
|
44
|
+
</template>
|
|
45
|
+
</view>
|
|
46
|
+
</sar-popup>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script lang="ts">
|
|
50
|
+
import { defineComponent as _defineComponent } from "vue";
|
|
51
|
+
import { computed, ref, watch } from "vue";
|
|
52
|
+
import { classNames, stringifyStyle, createBem, noop } from "../../utils";
|
|
53
|
+
import SarPopup from "../popup/popup.vue";
|
|
54
|
+
import SarLoading from "../loading/loading.vue";
|
|
55
|
+
import { actionSheetProps } from "./common";
|
|
56
|
+
const __default__ = {
|
|
57
|
+
options: {
|
|
58
|
+
virtualHost: true,
|
|
59
|
+
styleIsolation: "shared"
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
export default /* @__PURE__ */ _defineComponent({
|
|
63
|
+
...__default__,
|
|
64
|
+
__name: "action-sheet",
|
|
65
|
+
props: actionSheetProps,
|
|
66
|
+
emits: ["update:visible", "close", "cancel", "select"],
|
|
67
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
68
|
+
__expose();
|
|
69
|
+
const props = __props;
|
|
70
|
+
const emit = __emit;
|
|
71
|
+
const bem = createBem("action-sheet");
|
|
72
|
+
const innerVisible = ref(props.visible);
|
|
73
|
+
watch(
|
|
74
|
+
() => props.visible,
|
|
75
|
+
() => {
|
|
76
|
+
innerVisible.value = props.visible;
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
const perhapsClose = (type) => {
|
|
80
|
+
if (typeof props.beforeClose === "function") {
|
|
81
|
+
const result = props.beforeClose(type);
|
|
82
|
+
if (result instanceof Promise) {
|
|
83
|
+
return result.then(() => {
|
|
84
|
+
innerVisible.value = false;
|
|
85
|
+
emit("update:visible", false);
|
|
86
|
+
}).catch(noop);
|
|
87
|
+
} else if (result === false) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
innerVisible.value = false;
|
|
92
|
+
emit("update:visible", false);
|
|
93
|
+
};
|
|
94
|
+
const onOverlayClick = () => {
|
|
95
|
+
emit("close");
|
|
96
|
+
if (props.overlayClosable) {
|
|
97
|
+
perhapsClose("close");
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const onSelect = (item, index) => {
|
|
101
|
+
if (!item.disabled && !item.loading) {
|
|
102
|
+
emit("select", item, index);
|
|
103
|
+
perhapsClose("select");
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
const onCancel = () => {
|
|
107
|
+
emit("cancel");
|
|
108
|
+
perhapsClose("cancel");
|
|
109
|
+
};
|
|
110
|
+
const actionSheetClass = computed(() => {
|
|
111
|
+
return classNames(
|
|
112
|
+
bem.b(),
|
|
113
|
+
bem.m("headless", !props.description),
|
|
114
|
+
props.rootClass
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
const actionSheetStyle = computed(() => {
|
|
118
|
+
return stringifyStyle(props.rootStyle);
|
|
119
|
+
});
|
|
120
|
+
const __returned__ = { props, emit, bem, innerVisible, perhapsClose, onOverlayClick, onSelect, onCancel, actionSheetClass, actionSheetStyle, get classNames() {
|
|
121
|
+
return classNames;
|
|
122
|
+
}, get stringifyStyle() {
|
|
123
|
+
return stringifyStyle;
|
|
124
|
+
}, SarPopup, SarLoading };
|
|
125
|
+
return __returned__;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
</script>
|
|
129
|
+
|
|
130
|
+
<style lang="scss">
|
|
131
|
+
@import './index.scss';
|
|
132
|
+
</style>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type PropType, type StyleValue } from 'vue';
|
|
2
|
+
export interface ActionSheetProps {
|
|
3
|
+
rootStyle?: StyleValue;
|
|
4
|
+
rootClass?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
itemList?: ActionSheetItem[];
|
|
7
|
+
cancel?: string;
|
|
8
|
+
visible?: boolean;
|
|
9
|
+
overlayClosable?: boolean;
|
|
10
|
+
beforeClose?: (type: 'close' | 'cancel' | 'select') => boolean | Promise<any>;
|
|
11
|
+
duration?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare const actionSheetProps: {
|
|
14
|
+
rootStyle: PropType<StyleValue>;
|
|
15
|
+
rootClass: StringConstructor;
|
|
16
|
+
description: StringConstructor;
|
|
17
|
+
itemList: PropType<ActionSheetItem[] | undefined>;
|
|
18
|
+
cancel: StringConstructor;
|
|
19
|
+
visible: BooleanConstructor;
|
|
20
|
+
overlayClosable: {
|
|
21
|
+
type: BooleanConstructor;
|
|
22
|
+
default: boolean;
|
|
23
|
+
};
|
|
24
|
+
beforeClose: PropType<((type: 'close' | 'cancel' | 'select') => boolean | Promise<any>) | undefined>;
|
|
25
|
+
duration: {
|
|
26
|
+
type: NumberConstructor;
|
|
27
|
+
default: number;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export interface ActionSheetEmits {
|
|
31
|
+
(e: 'update:visible', visible: boolean): void;
|
|
32
|
+
(e: 'close'): void;
|
|
33
|
+
(e: 'cancel'): void;
|
|
34
|
+
(e: 'select', item: ActionSheetItem, index: number): void;
|
|
35
|
+
}
|
|
36
|
+
export interface ActionSheetItem {
|
|
37
|
+
name?: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
color?: string;
|
|
40
|
+
loading?: boolean;
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defaultConfig } from '../config';
|
|
2
|
+
export const actionSheetProps = {
|
|
3
|
+
rootStyle: [String, Object, Array],
|
|
4
|
+
rootClass: String,
|
|
5
|
+
description: String,
|
|
6
|
+
itemList: Array,
|
|
7
|
+
cancel: String,
|
|
8
|
+
visible: Boolean,
|
|
9
|
+
overlayClosable: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: defaultConfig.actionSheet.overlayClosable,
|
|
12
|
+
},
|
|
13
|
+
beforeClose: Function,
|
|
14
|
+
duration: {
|
|
15
|
+
type: Number,
|
|
16
|
+
default: defaultConfig.shareSheet.duration,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ActionSheetProps, ActionSheetEmits, ActionSheetItem, } from './common';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|