stellar-ui-plus 1.16.18
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 +176 -0
- package/common/css/common.scss +19 -0
- package/common/useProps.js +9 -0
- package/components/ste-animate/ATTRIBUTES.md +10 -0
- package/components/ste-animate/README.md +115 -0
- package/components/ste-animate/animate.scss +247 -0
- package/components/ste-animate/config.json +5 -0
- package/components/ste-animate/props.ts +9 -0
- package/components/ste-animate/ste-animate.easycom.json +39 -0
- package/components/ste-animate/ste-animate.scss +113 -0
- package/components/ste-animate/ste-animate.vue +67 -0
- package/components/ste-badge/ATTRIBUTES.md +17 -0
- package/components/ste-badge/README.md +162 -0
- package/components/ste-badge/config.json +5 -0
- package/components/ste-badge/props.ts +17 -0
- package/components/ste-badge/ste-badge.easycom.json +96 -0
- package/components/ste-badge/ste-badge.vue +157 -0
- package/components/ste-barcode/ATTRIBUTES.md +14 -0
- package/components/ste-barcode/README.md +28 -0
- package/components/ste-barcode/config.json +5 -0
- package/components/ste-barcode/encode.ts +317 -0
- package/components/ste-barcode/props.ts +7 -0
- package/components/ste-barcode/ste-barcode.easycom.json +44 -0
- package/components/ste-barcode/ste-barcode.vue +152 -0
- package/components/ste-button/ATTRIBUTES.md +32 -0
- package/components/ste-button/README.md +119 -0
- package/components/ste-button/config.json +5 -0
- package/components/ste-button/props.ts +21 -0
- package/components/ste-button/ste-button.easycom.json +168 -0
- package/components/ste-button/ste-button.vue +275 -0
- package/components/ste-calendar/ATTRIBUTES.md +31 -0
- package/components/ste-calendar/README.md +241 -0
- package/components/ste-calendar/config.json +5 -0
- package/components/ste-calendar/date.ts +110 -0
- package/components/ste-calendar/props.ts +26 -0
- package/components/ste-calendar/ste-calendar.easycom.json +172 -0
- package/components/ste-calendar/ste-calendar.vue +376 -0
- package/components/ste-calendar/useData.ts +30 -0
- package/components/ste-checkbox/ATTRIBUTES.md +25 -0
- package/components/ste-checkbox/README.md +302 -0
- package/components/ste-checkbox/config.json +5 -0
- package/components/ste-checkbox/props.ts +33 -0
- package/components/ste-checkbox/ste-checkbox.easycom.json +151 -0
- package/components/ste-checkbox/ste-checkbox.vue +206 -0
- package/components/ste-checkbox/type.d.ts +2 -0
- package/components/ste-checkbox-group/props.ts +34 -0
- package/components/ste-checkbox-group/ste-checkbox-group.vue +34 -0
- package/components/ste-code-input/ATTRIBUTES.md +22 -0
- package/components/ste-code-input/README.md +56 -0
- package/components/ste-code-input/config.json +5 -0
- package/components/ste-code-input/props.ts +19 -0
- package/components/ste-code-input/ste-code-input.easycom.json +99 -0
- package/components/ste-code-input/ste-code-input.vue +222 -0
- package/components/ste-date-picker/ATTRIBUTES.md +25 -0
- package/components/ste-date-picker/README.md +119 -0
- package/components/ste-date-picker/config.json +5 -0
- package/components/ste-date-picker/props.ts +62 -0
- package/components/ste-date-picker/ste-date-picker.easycom.json +137 -0
- package/components/ste-date-picker/ste-date-picker.vue +290 -0
- package/components/ste-date-picker/types.d.ts +3 -0
- package/components/ste-drag/ATTRIBUTES.md +13 -0
- package/components/ste-drag/README.md +88 -0
- package/components/ste-drag/config.json +5 -0
- package/components/ste-drag/props.ts +10 -0
- package/components/ste-drag/ste-drag.easycom.json +50 -0
- package/components/ste-drag/ste-drag.vue +172 -0
- package/components/ste-dropdown-menu/ATTRIBUTES.md +22 -0
- package/components/ste-dropdown-menu/README.md +325 -0
- package/components/ste-dropdown-menu/config.json +5 -0
- package/components/ste-dropdown-menu/constans.ts +4 -0
- package/components/ste-dropdown-menu/props.ts +30 -0
- package/components/ste-dropdown-menu/ste-dropdown-menu.easycom.json +111 -0
- package/components/ste-dropdown-menu/ste-dropdown-menu.scss +99 -0
- package/components/ste-dropdown-menu/ste-dropdown-menu.vue +223 -0
- package/components/ste-dropdown-menu-item/props.ts +17 -0
- package/components/ste-dropdown-menu-item/ste-dropdown-menu-item.scss +61 -0
- package/components/ste-dropdown-menu-item/ste-dropdown-menu-item.vue +84 -0
- package/components/ste-dropdown-menu-item/type.d.ts +4 -0
- package/components/ste-icon/ATTRIBUTES.md +19 -0
- package/components/ste-icon/README.md +72 -0
- package/components/ste-icon/config.json +5 -0
- package/components/ste-icon/iconfont.css +22 -0
- package/components/ste-icon/props.ts +14 -0
- package/components/ste-icon/ste-icon.easycom.json +71 -0
- package/components/ste-icon/ste-icon.vue +80 -0
- package/components/ste-image/ATTRIBUTES.md +21 -0
- package/components/ste-image/README.md +118 -0
- package/components/ste-image/config.json +5 -0
- package/components/ste-image/props.ts +15 -0
- package/components/ste-image/ste-image.easycom.json +189 -0
- package/components/ste-image/ste-image.vue +146 -0
- package/components/ste-index-item/props.ts +4 -0
- package/components/ste-index-item/ste-index-item.vue +83 -0
- package/components/ste-index-list/ATTRIBUTES.md +15 -0
- package/components/ste-index-list/README.md +138 -0
- package/components/ste-index-list/config.json +5 -0
- package/components/ste-index-list/props.ts +17 -0
- package/components/ste-index-list/ste-index-list.easycom.json +48 -0
- package/components/ste-index-list/ste-index-list.vue +109 -0
- package/components/ste-input/ATTRIBUTES.md +37 -0
- package/components/ste-input/README.md +130 -0
- package/components/ste-input/config.json +5 -0
- package/components/ste-input/props.ts +46 -0
- package/components/ste-input/ste-input.easycom.json +282 -0
- package/components/ste-input/ste-input.scss +124 -0
- package/components/ste-input/ste-input.vue +221 -0
- package/components/ste-loading/ATTRIBUTES.md +11 -0
- package/components/ste-loading/README.md +74 -0
- package/components/ste-loading/config.json +5 -0
- package/components/ste-loading/props.ts +8 -0
- package/components/ste-loading/ste-loading.easycom.json +54 -0
- package/components/ste-loading/ste-loading.vue +127 -0
- package/components/ste-media-preview/ATTRIBUTES.md +20 -0
- package/components/ste-media-preview/README.md +252 -0
- package/components/ste-media-preview/TouchScaleing.ts +117 -0
- package/components/ste-media-preview/config.json +5 -0
- package/components/ste-media-preview/props.ts +12 -0
- package/components/ste-media-preview/ste-media-preview.easycom.json +88 -0
- package/components/ste-media-preview/ste-media-preview.vue +201 -0
- package/components/ste-media-preview/useData.ts +63 -0
- package/components/ste-message-box/ATTRIBUTES.md +6 -0
- package/components/ste-message-box/README.md +222 -0
- package/components/ste-message-box/config.json +5 -0
- package/components/ste-message-box/constants.ts +25 -0
- package/components/ste-message-box/ste-message-box.easycom.json +14 -0
- package/components/ste-message-box/ste-message-box.ts +1 -0
- package/components/ste-message-box/ste-message-box.vue +355 -0
- package/components/ste-message-box/use-message-box.ts +26 -0
- package/components/ste-message-box/useData.ts +56 -0
- package/components/ste-notice-bar/ATTRIBUTES.md +22 -0
- package/components/ste-notice-bar/README.md +124 -0
- package/components/ste-notice-bar/config.json +5 -0
- package/components/ste-notice-bar/props.ts +15 -0
- package/components/ste-notice-bar/ste-notice-bar.easycom.json +109 -0
- package/components/ste-notice-bar/ste-notice-bar.vue +262 -0
- package/components/ste-number-keyboard/ATTRIBUTES.md +31 -0
- package/components/ste-number-keyboard/KeyboardVue.vue +142 -0
- package/components/ste-number-keyboard/README.md +192 -0
- package/components/ste-number-keyboard/config.json +5 -0
- package/components/ste-number-keyboard/props.ts +35 -0
- package/components/ste-number-keyboard/ste-number-keyboard.easycom.json +177 -0
- package/components/ste-number-keyboard/ste-number-keyboard.vue +81 -0
- package/components/ste-number-keyboard/useData.ts +144 -0
- package/components/ste-picker/props.ts +16 -0
- package/components/ste-picker/ste-picker.vue +194 -0
- package/components/ste-popup/ATTRIBUTES.md +24 -0
- package/components/ste-popup/README.md +135 -0
- package/components/ste-popup/config.json +6 -0
- package/components/ste-popup/event.ts +0 -0
- package/components/ste-popup/props.ts +19 -0
- package/components/ste-popup/ste-popup.easycom.json +122 -0
- package/components/ste-popup/ste-popup.vue +253 -0
- package/components/ste-price/ATTRIBUTES.md +26 -0
- package/components/ste-price/README.md +110 -0
- package/components/ste-price/config.json +5 -0
- package/components/ste-price/props.ts +23 -0
- package/components/ste-price/ste-price.easycom.json +154 -0
- package/components/ste-price/ste-price.vue +148 -0
- package/components/ste-progress/ATTRIBUTES.md +17 -0
- package/components/ste-progress/README.md +88 -0
- package/components/ste-progress/config.json +5 -0
- package/components/ste-progress/props.ts +16 -0
- package/components/ste-progress/ste-progress.easycom.json +80 -0
- package/components/ste-progress/ste-progress.vue +135 -0
- package/components/ste-qrcode/ATTRIBUTES.md +16 -0
- package/components/ste-qrcode/README.md +34 -0
- package/components/ste-qrcode/config.json +5 -0
- package/components/ste-qrcode/props.ts +16 -0
- package/components/ste-qrcode/ste-qrcode.easycom.json +56 -0
- package/components/ste-qrcode/ste-qrcode.vue +134 -0
- package/components/ste-qrcode/uqrcode.d.ts +57 -0
- package/components/ste-qrcode/uqrcode.js +34 -0
- package/components/ste-radio/ATTRIBUTES.md +25 -0
- package/components/ste-radio/README.md +260 -0
- package/components/ste-radio/config.json +5 -0
- package/components/ste-radio/props.ts +33 -0
- package/components/ste-radio/ste-radio.easycom.json +150 -0
- package/components/ste-radio/ste-radio.vue +188 -0
- package/components/ste-radio/type.d.ts +2 -0
- package/components/ste-radio-group/props.ts +33 -0
- package/components/ste-radio-group/ste-radio-group.vue +34 -0
- package/components/ste-rate/ATTRIBUTES.md +21 -0
- package/components/ste-rate/README.md +97 -0
- package/components/ste-rate/config.json +5 -0
- package/components/ste-rate/props.ts +16 -0
- package/components/ste-rate/ste-rate.easycom.json +85 -0
- package/components/ste-rate/ste-rate.vue +143 -0
- package/components/ste-read-more/ATTRIBUTES.md +16 -0
- package/components/ste-read-more/README.md +93 -0
- package/components/ste-read-more/config.json +5 -0
- package/components/ste-read-more/props.ts +9 -0
- package/components/ste-read-more/ste-read-more.easycom.json +54 -0
- package/components/ste-read-more/ste-read-more.vue +106 -0
- package/components/ste-rich-text/ATTRIBUTES.md +8 -0
- package/components/ste-rich-text/README.md +26 -0
- package/components/ste-rich-text/config.json +5 -0
- package/components/ste-rich-text/props.ts +8 -0
- package/components/ste-rich-text/ste-rich-text.easycom.json +40 -0
- package/components/ste-rich-text/ste-rich-text.vue +33 -0
- package/components/ste-scroll-to/ATTRIBUTES.md +11 -0
- package/components/ste-scroll-to/README.md +47 -0
- package/components/ste-scroll-to/config.json +5 -0
- package/components/ste-scroll-to/props.ts +17 -0
- package/components/ste-scroll-to/ste-scroll-to.easycom.json +25 -0
- package/components/ste-scroll-to/ste-scroll-to.vue +42 -0
- package/components/ste-scroll-to/useData.ts +214 -0
- package/components/ste-scroll-to-item/ste-scroll-to-item.vue +24 -0
- package/components/ste-search/ATTRIBUTES.md +39 -0
- package/components/ste-search/README.md +232 -0
- package/components/ste-search/config.json +5 -0
- package/components/ste-search/props.ts +124 -0
- package/components/ste-search/ste-search.easycom.json +232 -0
- package/components/ste-search/ste-search.vue +379 -0
- package/components/ste-search/useData.ts +34 -0
- package/components/ste-select/ATTRIBUTES.md +39 -0
- package/components/ste-select/README.md +324 -0
- package/components/ste-select/config.json +5 -0
- package/components/ste-select/datapager.vue +54 -0
- package/components/ste-select/datetime.vue +109 -0
- package/components/ste-select/defaultDate.ts +138 -0
- package/components/ste-select/props.ts +67 -0
- package/components/ste-select/ste-select.easycom.json +287 -0
- package/components/ste-select/ste-select.vue +437 -0
- package/components/ste-select/useData.ts +471 -0
- package/components/ste-signature/ATTRIBUTES.md +18 -0
- package/components/ste-signature/README.md +97 -0
- package/components/ste-signature/config.json +5 -0
- package/components/ste-signature/props.ts +12 -0
- package/components/ste-signature/ste-signature.easycom.json +74 -0
- package/components/ste-signature/ste-signature.vue +183 -0
- package/components/ste-signature/types.d.ts +4 -0
- package/components/ste-slider/ATTRIBUTES.md +25 -0
- package/components/ste-slider/README.md +149 -0
- package/components/ste-slider/config.json +5 -0
- package/components/ste-slider/props.ts +32 -0
- package/components/ste-slider/ste-slider.easycom.json +128 -0
- package/components/ste-slider/ste-slider.scss +150 -0
- package/components/ste-slider/ste-slider.vue +293 -0
- package/components/ste-slider/type.d.ts +4 -0
- package/components/ste-slider/useData.ts +79 -0
- package/components/ste-step/props.ts +10 -0
- package/components/ste-step/ste-step.scss +104 -0
- package/components/ste-step/ste-step.vue +122 -0
- package/components/ste-stepper/ATTRIBUTES.md +33 -0
- package/components/ste-stepper/README.md +172 -0
- package/components/ste-stepper/config.json +5 -0
- package/components/ste-stepper/props.ts +41 -0
- package/components/ste-stepper/ste-stepper.easycom.json +220 -0
- package/components/ste-stepper/ste-stepper.vue +249 -0
- package/components/ste-steps/ATTRIBUTES.md +12 -0
- package/components/ste-steps/README.md +139 -0
- package/components/ste-steps/config.json +5 -0
- package/components/ste-steps/props.ts +18 -0
- package/components/ste-steps/ste-steps.easycom.json +46 -0
- package/components/ste-steps/ste-steps.vue +44 -0
- package/components/ste-sticky/ATTRIBUTES.md +15 -0
- package/components/ste-sticky/README.md +56 -0
- package/components/ste-sticky/config.json +5 -0
- package/components/ste-sticky/props.ts +7 -0
- package/components/ste-sticky/ste-sticky.easycom.json +48 -0
- package/components/ste-sticky/ste-sticky.vue +88 -0
- package/components/ste-swipe-action/ATTRIBUTES.md +16 -0
- package/components/ste-swipe-action/README.md +195 -0
- package/components/ste-swipe-action/config.json +5 -0
- package/components/ste-swipe-action/props.ts +23 -0
- package/components/ste-swipe-action/ste-swipe-action.easycom.json +74 -0
- package/components/ste-swipe-action/ste-swipe-action.vue +138 -0
- package/components/ste-swipe-action/useData.ts +204 -0
- package/components/ste-swipe-action-group/ATTRIBUTES.md +17 -0
- package/components/ste-swipe-action-group/props.ts +22 -0
- package/components/ste-swipe-action-group/ste-swipe-action-group.easycom.json +90 -0
- package/components/ste-swipe-action-group/ste-swipe-action-group.vue +57 -0
- package/components/ste-swiper/ATTRIBUTES.md +24 -0
- package/components/ste-swiper/README.md +156 -0
- package/components/ste-swiper/config.json +5 -0
- package/components/ste-swiper/props.ts +41 -0
- package/components/ste-swiper/ste-swiper.easycom.json +123 -0
- package/components/ste-swiper/ste-swiper.vue +98 -0
- package/components/ste-swiper/useData.ts +365 -0
- package/components/ste-swiper-item/ste-swiper-item.vue +41 -0
- package/components/ste-switch/ATTRIBUTES.md +17 -0
- package/components/ste-switch/README.md +105 -0
- package/components/ste-switch/config.json +5 -0
- package/components/ste-switch/props.ts +9 -0
- package/components/ste-switch/ste-switch.easycom.json +60 -0
- package/components/ste-switch/ste-switch.vue +96 -0
- package/components/ste-tab/ATTRIBUTES.md +14 -0
- package/components/ste-tab/props.ts +25 -0
- package/components/ste-tab/ste-tab.easycom.json +56 -0
- package/components/ste-tab/ste-tab.vue +26 -0
- package/components/ste-table/ATTRIBUTES.md +41 -0
- package/components/ste-table/README.md +638 -0
- package/components/ste-table/config.json +5 -0
- package/components/ste-table/props.ts +72 -0
- package/components/ste-table/ste-table.easycom.json +188 -0
- package/components/ste-table/ste-table.vue +427 -0
- package/components/ste-table/types.d.ts +3 -0
- package/components/ste-table/useData.ts +233 -0
- package/components/ste-table/utils.ts +11 -0
- package/components/ste-table-column/checkbox-icon.vue +35 -0
- package/components/ste-table-column/common.scss +52 -0
- package/components/ste-table-column/props.ts +18 -0
- package/components/ste-table-column/radio-icon.vue +99 -0
- package/components/ste-table-column/ste-table-column.vue +169 -0
- package/components/ste-table-column/var.scss +1 -0
- package/components/ste-tabs/ATTRIBUTES.md +52 -0
- package/components/ste-tabs/README.md +165 -0
- package/components/ste-tabs/config.json +5 -0
- package/components/ste-tabs/props.ts +133 -0
- package/components/ste-tabs/ste-tabs.easycom.json +278 -0
- package/components/ste-tabs/ste-tabs.vue +447 -0
- package/components/ste-tabs/useData.ts +364 -0
- package/components/ste-text/ATTRIBUTES.md +9 -0
- package/components/ste-text/README.md +58 -0
- package/components/ste-text/config.json +6 -0
- package/components/ste-text/props.ts +10 -0
- package/components/ste-text/ste-text.easycom.json +30 -0
- package/components/ste-text/ste-text.vue +46 -0
- package/components/ste-toast/ATTRIBUTES.md +15 -0
- package/components/ste-toast/README.md +222 -0
- package/components/ste-toast/config.json +5 -0
- package/components/ste-toast/props.ts +7 -0
- package/components/ste-toast/ste-toast.easycom.json +73 -0
- package/components/ste-toast/ste-toast.vue +209 -0
- package/components/ste-toast/use-toast.ts +26 -0
- package/components/ste-touch-swipe/ATTRIBUTES.md +18 -0
- package/components/ste-touch-swipe/README.md +89 -0
- package/components/ste-touch-swipe/TouchEvent.ts +79 -0
- package/components/ste-touch-swipe/config.json +5 -0
- package/components/ste-touch-swipe/props.ts +23 -0
- package/components/ste-touch-swipe/ste-touch-swipe.easycom.json +83 -0
- package/components/ste-touch-swipe/ste-touch-swipe.vue +283 -0
- package/components/ste-touch-swipe/useData.ts +51 -0
- package/components/ste-touch-swipe-item/ste-touch-swipe-item.vue +32 -0
- package/components/ste-tour/ATTRIBUTES.md +26 -0
- package/components/ste-tour/README.md +134 -0
- package/components/ste-tour/config.json +5 -0
- package/components/ste-tour/props.ts +45 -0
- package/components/ste-tour/ste-tour.easycom.json +120 -0
- package/components/ste-tour/ste-tour.vue +152 -0
- package/components/ste-tour/useData.ts +220 -0
- package/components/ste-tree/ATTRIBUTES.md +19 -0
- package/components/ste-tree/README.md +217 -0
- package/components/ste-tree/config.json +5 -0
- package/components/ste-tree/props.ts +24 -0
- package/components/ste-tree/ste-tree.easycom.json +106 -0
- package/components/ste-tree/ste-tree.vue +140 -0
- package/components/ste-tree/useData.ts +219 -0
- package/components/ste-upload/ATTRIBUTES.md +35 -0
- package/components/ste-upload/README.md +208 -0
- package/components/ste-upload/ReadFile.ts +305 -0
- package/components/ste-upload/config.json +5 -0
- package/components/ste-upload/props.ts +25 -0
- package/components/ste-upload/ste-upload.easycom.json +267 -0
- package/components/ste-upload/ste-upload.vue +386 -0
- package/components/ste-upload/useData.ts +46 -0
- package/components/ste-video/ATTRIBUTES.md +34 -0
- package/components/ste-video/README.md +48 -0
- package/components/ste-video/config.json +5 -0
- package/components/ste-video/props.ts +86 -0
- package/components/ste-video/ste-video.easycom.json +226 -0
- package/components/ste-video/ste-video.scss +201 -0
- package/components/ste-video/ste-video.vue +390 -0
- package/components/ste-video/types.d.ts +4 -0
- package/components/ste-video/useData.ts +140 -0
- package/composables.ts +2 -0
- package/config/color.ts +16 -0
- package/config/index.ts +48 -0
- package/index.ts +118 -0
- package/package.json +22 -0
- package/store/color.ts +24 -0
- package/store/index.ts +12 -0
- package/store/message-box.ts +54 -0
- package/store/toast.ts +50 -0
- package/types/components.d.ts +124 -0
- package/types/event.d.ts +51 -0
- package/types/index.d.ts +112 -0
- package/types/refComponents.d.ts +118 -0
- package/utils/Color.ts +66 -0
- package/utils/System.ts +114 -0
- package/utils/mixin.ts +122 -0
- package/utils/utils.ts +520 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { watch, computed, ref, type CSSProperties, getCurrentInstance, defineOptions } from 'vue';
|
|
3
|
+
import { useProvide } from '../../utils/mixin';
|
|
4
|
+
import { DEFAULT_DURATION, MAX_DURATION, MIN_DURATION, DEFAULT_ROOT_QUERY } from './constans';
|
|
5
|
+
import propsData, { DEOP_DOWN_MENU_KEY, dropDownMenuEmits } from './props';
|
|
6
|
+
import type { DropdownItem } from '../ste-dropdown-menu-item/type';
|
|
7
|
+
import { type DropdownMenuItemProps } from '../ste-dropdown-menu-item/props';
|
|
8
|
+
import utils from '../../utils/utils';
|
|
9
|
+
import System from '../../utils/System.js';
|
|
10
|
+
import useColor from '../../config/color';
|
|
11
|
+
let color = useColor();
|
|
12
|
+
|
|
13
|
+
const props = defineProps(propsData);
|
|
14
|
+
const emits = defineEmits(dropDownMenuEmits);
|
|
15
|
+
const componentName = `ste-dropdown-menu`;
|
|
16
|
+
defineOptions({
|
|
17
|
+
name: componentName,
|
|
18
|
+
options: {
|
|
19
|
+
virtualHost: true,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const addPx = (val: string | number) => {
|
|
24
|
+
if (utils.isNumber(String(val))) {
|
|
25
|
+
return `${val}px`;
|
|
26
|
+
} else {
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const showMenu = ref(false);
|
|
32
|
+
const menuRootQuery = ref<typeof DEFAULT_ROOT_QUERY>(DEFAULT_ROOT_QUERY);
|
|
33
|
+
const contentHeight = ref(0);
|
|
34
|
+
const menuTitle = ref<string | undefined>('');
|
|
35
|
+
const hiddenContent = ref(false);
|
|
36
|
+
|
|
37
|
+
let chooseItems: any[] = [];
|
|
38
|
+
const instance = getCurrentInstance() as unknown as ComponentPublicInstance;
|
|
39
|
+
|
|
40
|
+
const cmpRootClass = computed(() => {
|
|
41
|
+
let classArr = [props.direction, showMenu.value ? 'open' : 'close', props.type];
|
|
42
|
+
return classArr.join(' ');
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const cmpRootStyle = computed(() => ({
|
|
46
|
+
'--duration': cmpDuration.value + 's',
|
|
47
|
+
'--active-color': props.activeColor ? props.activeColor : color.getColor().steThemeColor,
|
|
48
|
+
'--inactive-color': props.inactiveColor,
|
|
49
|
+
'--menu-z-index': props.zIndex,
|
|
50
|
+
}));
|
|
51
|
+
6;
|
|
52
|
+
const cmpMenuPlaceholderStyle = computed(() => {
|
|
53
|
+
let style: CSSProperties = { height: 0 };
|
|
54
|
+
|
|
55
|
+
if (showMenu.value) {
|
|
56
|
+
if (props.direction == 'down') {
|
|
57
|
+
style.height = addPx(menuRootQuery.value.top + menuRootQuery.value.height);
|
|
58
|
+
} else {
|
|
59
|
+
let windowHeight = System.getWindowInfo().windowHeight;
|
|
60
|
+
style.height = addPx(windowHeight - menuRootQuery.value.bottom + menuRootQuery.value.height);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return style;
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const cmpMenuContentStyle = computed(() => {
|
|
68
|
+
let style = {
|
|
69
|
+
height: addPx(contentHeight.value),
|
|
70
|
+
background: props.showMask ? 'rgba(0, 0, 0, 0.6)' : 'rgba(0, 0, 0, 0)',
|
|
71
|
+
} as CSSProperties;
|
|
72
|
+
if (props.direction == 'down') {
|
|
73
|
+
style.top = addPx(menuRootQuery.value.top + menuRootQuery.value.height);
|
|
74
|
+
} else {
|
|
75
|
+
style.top = 0;
|
|
76
|
+
}
|
|
77
|
+
return style;
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const cmpDuration = computed(() => {
|
|
81
|
+
if (!utils.isNumber(String(props.duration))) {
|
|
82
|
+
return DEFAULT_DURATION;
|
|
83
|
+
}
|
|
84
|
+
if (Number(props.duration) > MAX_DURATION) {
|
|
85
|
+
return MAX_DURATION;
|
|
86
|
+
}
|
|
87
|
+
if (Number(props.duration) < MIN_DURATION) {
|
|
88
|
+
return MIN_DURATION;
|
|
89
|
+
}
|
|
90
|
+
return props.duration;
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
watch(
|
|
94
|
+
() => [props.modelValue, props.value],
|
|
95
|
+
([modalVal, val]) => {
|
|
96
|
+
let v = val ? val : modalVal;
|
|
97
|
+
if (Array.isArray(v)) {
|
|
98
|
+
chooseItems = v;
|
|
99
|
+
} else {
|
|
100
|
+
v ? (chooseItems = [v]) : '';
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
{ immediate: true }
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
let menuItems = ref<DropdownItem[]>([]);
|
|
107
|
+
function updateItems() {
|
|
108
|
+
let childrens = internalChildren;
|
|
109
|
+
if (childrens.length !== menuItems.value.length) {
|
|
110
|
+
menuItems.value = childrens.map(e => e.props as DropdownMenuItemProps);
|
|
111
|
+
loadMenuTitle();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function loadMenuTitle() {
|
|
116
|
+
if (!props.title) {
|
|
117
|
+
let item = internalChildren.find(e => {
|
|
118
|
+
return chooseItems.find(v => v == e.props.value);
|
|
119
|
+
});
|
|
120
|
+
menuTitle.value = (item?.props as DropdownMenuItemProps).title;
|
|
121
|
+
} else {
|
|
122
|
+
menuTitle.value = props.title;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function touchmove(e: TouchEvent) {
|
|
126
|
+
// TODO nvue 取消冒泡
|
|
127
|
+
e.stopPropagation();
|
|
128
|
+
}
|
|
129
|
+
async function getContentHeight() {
|
|
130
|
+
let windowHeight = System.getWindowInfo().windowHeight;
|
|
131
|
+
|
|
132
|
+
const res = await utils.querySelector<false>('.ste-dropdown-menu-root', instance);
|
|
133
|
+
menuRootQuery.value = { height: res.height || 0, top: res.top || 0, bottom: res.bottom || 0, left: res.left || 0 };
|
|
134
|
+
contentHeight.value = props.direction == 'down' ? windowHeight - menuRootQuery.value.bottom : menuRootQuery.value.top;
|
|
135
|
+
}
|
|
136
|
+
async function handleMenuClick() {
|
|
137
|
+
if (!showMenu.value) {
|
|
138
|
+
await getContentHeight();
|
|
139
|
+
open();
|
|
140
|
+
} else {
|
|
141
|
+
close();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function open() {
|
|
145
|
+
showMenu.value = true;
|
|
146
|
+
hiddenContent.value = false;
|
|
147
|
+
emits('open');
|
|
148
|
+
}
|
|
149
|
+
function close() {
|
|
150
|
+
showMenu.value = false;
|
|
151
|
+
setTimeout(
|
|
152
|
+
() => {
|
|
153
|
+
hiddenContent.value = true;
|
|
154
|
+
contentHeight.value = 0;
|
|
155
|
+
menuRootQuery.value = DEFAULT_ROOT_QUERY;
|
|
156
|
+
emits('close');
|
|
157
|
+
},
|
|
158
|
+
Number(cmpDuration.value) * 1000
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
function choose(item: DropdownItem) {
|
|
162
|
+
let temp = chooseItems;
|
|
163
|
+
let index = temp.findIndex(e => e == item.value);
|
|
164
|
+
let max = props.max < 1 ? 1 : props.max;
|
|
165
|
+
if (index > -1) {
|
|
166
|
+
// 当选中项再次被选中时,做取消选中操作
|
|
167
|
+
temp.splice(index, 1);
|
|
168
|
+
} else {
|
|
169
|
+
if (chooseItems.length < max) {
|
|
170
|
+
temp.push(item.value);
|
|
171
|
+
} else {
|
|
172
|
+
temp.shift();
|
|
173
|
+
temp.push(item.value);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
chooseItems = temp;
|
|
178
|
+
loadMenuTitle();
|
|
179
|
+
if (chooseItems.length == max) {
|
|
180
|
+
close();
|
|
181
|
+
}
|
|
182
|
+
emits('update:modelValue', chooseItems);
|
|
183
|
+
emits('change', chooseItems);
|
|
184
|
+
emits('item-choose', item);
|
|
185
|
+
triggerChildLoadStatus();
|
|
186
|
+
}
|
|
187
|
+
function handleMaskClick() {
|
|
188
|
+
if (props.isMaskClick) {
|
|
189
|
+
close();
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function handleMenuConentClick() {}
|
|
193
|
+
|
|
194
|
+
function triggerChildLoadStatus() {
|
|
195
|
+
internalChildren.forEach(e => {
|
|
196
|
+
(e.exposed as any).loadStatus();
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const { internalChildren } = useProvide(DEOP_DOWN_MENU_KEY, 'ste-checkbox')({ props, chooseItems, cmpDuration, choose, updateItems });
|
|
201
|
+
defineExpose({ close });
|
|
202
|
+
</script>
|
|
203
|
+
|
|
204
|
+
<template>
|
|
205
|
+
<view class="ste-dropdown-menu-root" :class="[cmpRootClass]" :style="[cmpRootStyle]" @touchmove.stop.prevent="touchmove" @wheel.stop.prevent>
|
|
206
|
+
<view class="dropdown-placeholder" :style="[cmpMenuPlaceholderStyle]" @click="close" @touchmove.stop.prevent="touchmove" @wheel.stop.prevent />
|
|
207
|
+
<view class="menu-box" @click="handleMenuClick" @touchmove.stop.prevent="touchmove" @wheel.stop.prevent>
|
|
208
|
+
<text class="title">{{ menuTitle || title }}</text>
|
|
209
|
+
<view class="menu-title-icon">
|
|
210
|
+
<ste-icon code="" size="16" color="#bbbbbb"></ste-icon>
|
|
211
|
+
</view>
|
|
212
|
+
</view>
|
|
213
|
+
<view :class="hiddenContent ? 'dropdown-content hidden' : 'dropdown-content'" :style="[cmpMenuContentStyle]" @click="handleMaskClick" @touchmove.stop.prevent="touchmove" @wheel.stop.prevent>
|
|
214
|
+
<view class="menu-item-content" @click.stop="handleMenuConentClick">
|
|
215
|
+
<slot></slot>
|
|
216
|
+
</view>
|
|
217
|
+
</view>
|
|
218
|
+
</view>
|
|
219
|
+
</template>
|
|
220
|
+
|
|
221
|
+
<style lang="scss" scoped>
|
|
222
|
+
@import './ste-dropdown-menu.scss';
|
|
223
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ExtractPropTypes } from 'vue'
|
|
2
|
+
|
|
3
|
+
const dropdownMenuItemProps = {
|
|
4
|
+
value: { type: String, default: '' },
|
|
5
|
+
title: { type: String, default: '' },
|
|
6
|
+
disabled: { type: Boolean, default: false },
|
|
7
|
+
readonly: { type: Boolean, default: false },
|
|
8
|
+
max: { type: Number, default: 1 },
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type DropdownMenuItemProps = ExtractPropTypes<typeof dropdownMenuItemProps>
|
|
12
|
+
|
|
13
|
+
export default dropdownMenuItemProps
|
|
14
|
+
|
|
15
|
+
export const dropdownMenuItemEmits = {
|
|
16
|
+
click: (suspend: () => void, next: () => void, stop: () => void) => suspend instanceof Function && next instanceof Function && stop instanceof Function,
|
|
17
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
.ste-dropdown-menu-item-root {
|
|
2
|
+
&.down {
|
|
3
|
+
border-top: solid 2rpx #f9f9f9;
|
|
4
|
+
}
|
|
5
|
+
&.up {
|
|
6
|
+
border-bottom: solid 2rpx #f9f9f9;
|
|
7
|
+
}
|
|
8
|
+
background-color: #ffffff;
|
|
9
|
+
padding: 24rpx;
|
|
10
|
+
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: space-between;
|
|
14
|
+
color: var(--inactive-color);
|
|
15
|
+
.menu-item-icon {
|
|
16
|
+
display: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.text {
|
|
20
|
+
font-size: var(--font-size-28, 28rpx);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.disabled {
|
|
24
|
+
color: #cccccc !important;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&.active {
|
|
28
|
+
color: var(--active-color);
|
|
29
|
+
.menu-item-icon {
|
|
30
|
+
display: inline-flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&.round {
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
border: none;
|
|
38
|
+
padding: 14rpx 10rpx;
|
|
39
|
+
border-radius: 48rpx;
|
|
40
|
+
border: 2rpx solid var(--active-color);
|
|
41
|
+
width: 194rpx;
|
|
42
|
+
white-space: nowrap;
|
|
43
|
+
margin-bottom: 20rpx;
|
|
44
|
+
|
|
45
|
+
.text {
|
|
46
|
+
width: 100%;
|
|
47
|
+
text-align: center;
|
|
48
|
+
color: var(--active-color);
|
|
49
|
+
white-space: nowrap;
|
|
50
|
+
text-overflow: ellipsis;
|
|
51
|
+
overflow: hidden;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&.active {
|
|
55
|
+
background-color: var(--active-color);
|
|
56
|
+
.text {
|
|
57
|
+
color: #fff;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { ref, computed, type ComputedRef, onMounted } from 'vue';
|
|
3
|
+
import propsData, { dropdownMenuItemEmits } from './props';
|
|
4
|
+
import { type DropDownMenuProps, DEOP_DOWN_MENU_KEY } from '../ste-dropdown-menu/props';
|
|
5
|
+
import type { DropdownItem } from './type';
|
|
6
|
+
import { useInject } from '../../utils/mixin';
|
|
7
|
+
|
|
8
|
+
const props = defineProps(propsData);
|
|
9
|
+
const emits = defineEmits(dropdownMenuItemEmits);
|
|
10
|
+
const Parent = useInject<{ props: Required<DropDownMenuProps>; chooseItems: any[]; cmpDuration: ComputedRef; choose: (item: DropdownItem) => void; updateItems: () => void }>(DEOP_DOWN_MENU_KEY);
|
|
11
|
+
const parent = Parent.parent;
|
|
12
|
+
const parentProps = Parent.parent?.props as DropDownMenuProps;
|
|
13
|
+
|
|
14
|
+
const status = ref(false); // 是否选中状态 true: 选中,false: 未选中
|
|
15
|
+
|
|
16
|
+
const cmpRootClass = computed(() => {
|
|
17
|
+
let classArr = [parentProps.direction];
|
|
18
|
+
if (status.value) {
|
|
19
|
+
classArr.push('active');
|
|
20
|
+
}
|
|
21
|
+
if (props.readonly) {
|
|
22
|
+
classArr.push('readonly');
|
|
23
|
+
}
|
|
24
|
+
if (props.disabled) {
|
|
25
|
+
classArr.push('disabled');
|
|
26
|
+
}
|
|
27
|
+
classArr.push(parentProps.type);
|
|
28
|
+
return classArr.join(' ');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
onMounted(() => {
|
|
32
|
+
parent?.updateItems();
|
|
33
|
+
loadStatus();
|
|
34
|
+
// this.parent.$on('item-choose', value => {
|
|
35
|
+
// this.loadStatus();
|
|
36
|
+
// });
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
function loadStatus() {
|
|
40
|
+
if (parent?.chooseItems) {
|
|
41
|
+
status.value = !!parent.chooseItems.find(e => e == props.value);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
let clickTask: Promise<any> | null = null;
|
|
46
|
+
async function handleClick() {
|
|
47
|
+
if (!props.disabled && !props.readonly) {
|
|
48
|
+
if (clickTask) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
let next = true;
|
|
52
|
+
clickTask = new Promise((resolve, reject) => {
|
|
53
|
+
emits(
|
|
54
|
+
'click',
|
|
55
|
+
() => (next = false),
|
|
56
|
+
() => resolve(null),
|
|
57
|
+
() => reject()
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
if (!next) {
|
|
61
|
+
await clickTask;
|
|
62
|
+
}
|
|
63
|
+
parent?.choose({ title: props.title, value: props.value });
|
|
64
|
+
setTimeout(() => {
|
|
65
|
+
clickTask = null;
|
|
66
|
+
loadStatus();
|
|
67
|
+
}, parent?.cmpDuration.value * 1000);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
defineExpose({ loadStatus });
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<template>
|
|
75
|
+
<view class="ste-dropdown-menu-item-root" :class="[cmpRootClass]" @click="handleClick">
|
|
76
|
+
<text class="text">{{ title }}</text>
|
|
77
|
+
<view class="menu-item-icon" v-if="parentProps.type == 'block'">
|
|
78
|
+
<ste-icon code="" size="32"></ste-icon>
|
|
79
|
+
</view>
|
|
80
|
+
</view>
|
|
81
|
+
</template>
|
|
82
|
+
<style lang="scss" scoped>
|
|
83
|
+
@import './ste-dropdown-menu-item.scss';
|
|
84
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#### Props
|
|
2
|
+
| 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
|
|
3
|
+
| ----- | ----- | --- | ------- | ------ | -------- |
|
|
4
|
+
| `code` | 图标名称 | `string` | - | - | - |
|
|
5
|
+
| `color` | 图标颜色 | `string` | - | - | - |
|
|
6
|
+
| `size` | 图标大小,单位rpx | `string / number` | `28` | - | - |
|
|
7
|
+
| `bold` | 图标是否粗体 | `boolean` | `false` | - | - |
|
|
8
|
+
| `marginLeft` | 左外边距,单位rpx | `string / number` | `0` | - | - |
|
|
9
|
+
| `marginRight` | 右外边距,单位rpx | `string / number` | `0` | - | - |
|
|
10
|
+
| `marginTop` | 上外边距,单位rpx | `string / number` | `0` | - | - |
|
|
11
|
+
| `marginBottom` | 下外边距,单位rpx | `string / number` | `0` | - | - |
|
|
12
|
+
| `fontFamily` | 字体名 | `string` | `` | - | - |
|
|
13
|
+
| `inlineBlock` | 容器对齐方式 | `boolean` | `true` | - | - |
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
#### Events
|
|
17
|
+
| 事件名 | 说明 | 事件参数 | 支持版本 |
|
|
18
|
+
| ----- | ----- | ------- | -------- |
|
|
19
|
+
| `click` | 图标点击回调事件 | - | - |
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Icon 图标
|
|
2
|
+
|
|
3
|
+
基于字体的图标集,包含了大多数常见场景的图标
|
|
4
|
+
|
|
5
|
+
---$
|
|
6
|
+
|
|
7
|
+
## 代码演示
|
|
8
|
+
|
|
9
|
+
### 基础用法
|
|
10
|
+
|
|
11
|
+
通过 `code` 属性来指定需要使用的图标,Stellar 组件使用[iconfont 做图标库](https://at.alicdn.com/t/c/font_4041637_pivqtx3f1mq.json?spm=a313x.manage_type_myprojects.i1.49.f7ba3a81fFvJ6W&file=font_4041637_pivqtx3f1mq.json),
|
|
12
|
+
可以直接传入对应的编码来使用
|
|
13
|
+
|
|
14
|
+
```html
|
|
15
|
+
<ste-icon code=""></ste-icon>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### 图标颜色
|
|
19
|
+
|
|
20
|
+
通过 `color` 属性来设置图标的颜色
|
|
21
|
+
|
|
22
|
+
```html
|
|
23
|
+
<ste-icon code="" color="#1989fa" :size="60" marginRight="30"></ste-icon>
|
|
24
|
+
<ste-icon code="" color="#ee0a24" :size="60"></ste-icon>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 图标大小
|
|
28
|
+
|
|
29
|
+
通过 `size` 属性来设置图标的尺寸大小,单位为 rpx,默认`28`
|
|
30
|
+
|
|
31
|
+
```html
|
|
32
|
+
<ste-icon code="" marginRight="30"></ste-icon>
|
|
33
|
+
<ste-icon code="" marginRight="30" :size="50"></ste-icon>
|
|
34
|
+
<ste-icon code="" marginRight="30" :size="70"></ste-icon>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 图标是否粗体
|
|
38
|
+
|
|
39
|
+
通过 `bold` 属性来设置图标是否粗体,默认`false`
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<ste-icon code="" marginRight="30"></ste-icon>
|
|
43
|
+
<ste-icon code="" bold></ste-icon>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 自定义图标
|
|
47
|
+
|
|
48
|
+
如果需要在现有 `Icon` 的基础上使用更多图标,可以引入第三方 `iconfont` 对应的字体文件和 `CSS` 文件,之后就可以在 `Icon` 组件中直接使用。
|
|
49
|
+
|
|
50
|
+
```css
|
|
51
|
+
/* 引入第三方或自定义的字体图标样式 */
|
|
52
|
+
@font-face {
|
|
53
|
+
font-family: 'iconfont'; /* Project id 2344394 */
|
|
54
|
+
src: url('//at.alicdn.com/t/c/font_2344394_nltp3ggc4q.woff2?t=1709779088427') format('woff2');
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```html
|
|
59
|
+
<!-- 通过 class-prefix 指定类名为 font-family属性的值:如iconfont -->
|
|
60
|
+
<ste-icon fontFamily="iconfont" code="" />
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---$
|
|
64
|
+
|
|
65
|
+
### API
|
|
66
|
+
|
|
67
|
+
<!-- props -->
|
|
68
|
+
|
|
69
|
+
---$
|
|
70
|
+
{{zyy}}
|
|
71
|
+
|
|
72
|
+
{{qinpengfei}}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* #ifdef APP */
|
|
2
|
+
/* 在线链接服务仅供平台体验和调试使用,平台不承诺服务的稳定性,企业客户需下载字体包自行发布使用并做好备份。 */
|
|
3
|
+
@font-face {
|
|
4
|
+
font-family: 'ste-iconfont-1709689042473';
|
|
5
|
+
/* Project id 4457057 */
|
|
6
|
+
src: url('https://at.alicdn.com/t/c/font_4457057_378iyzac6bn.woff2?t=1727661432800') format('woff2'),
|
|
7
|
+
url('https://at.alicdn.com/t/c/font_4457057_378iyzac6bn.woff?t=1727661432800') format('woff'),
|
|
8
|
+
url('https://at.alicdn.com/t/c/font_4457057_378iyzac6bn.ttf?t=1727661432800') format('truetype');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* #endif */
|
|
12
|
+
/* #ifndef APP */
|
|
13
|
+
/* 在线链接服务仅供平台体验和调试使用,平台不承诺服务的稳定性,企业客户需下载字体包自行发布使用并做好备份。 */
|
|
14
|
+
@font-face {
|
|
15
|
+
font-family: 'ste-iconfont-1709689042473';
|
|
16
|
+
/* Project id 4457057 */
|
|
17
|
+
src: url('//at.alicdn.com/t/c/font_4457057_378iyzac6bn.woff2?t=1727661432800') format('woff2'),
|
|
18
|
+
url('//at.alicdn.com/t/c/font_4457057_378iyzac6bn.woff?t=1727661432800') format('woff'),
|
|
19
|
+
url('//at.alicdn.com/t/c/font_4457057_378iyzac6bn.ttf?t=1727661432800') format('truetype');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* #endif */
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
code: { type: String, default: '' },
|
|
3
|
+
size: { type: [String, Number], default: 28 },
|
|
4
|
+
scale: { type: Number, default: 1 },
|
|
5
|
+
color: { type: String, default: '' },
|
|
6
|
+
bold: { type: Boolean, default: false },
|
|
7
|
+
marginLeft: { type: [String, Number], default: 0 },
|
|
8
|
+
marginRight: { type: [String, Number], default: 0 },
|
|
9
|
+
marginTop: { type: [String, Number], default: 0 },
|
|
10
|
+
marginBottom: { type: [String, Number], default: 0 },
|
|
11
|
+
fontFamily: { type: String, default: '' },
|
|
12
|
+
showBorder: { type: Boolean, default: false },
|
|
13
|
+
inlineBlock: { type: Boolean, default: true },
|
|
14
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ste-icon",
|
|
3
|
+
"description": "图标组件 基于字体的图标集,包含了大多数常见场景的图标",
|
|
4
|
+
"example": "<ste-icon></ste-icon>",
|
|
5
|
+
"tutorial": "https://stellar-ui.intecloud.com.cn/plus/#/?active=icon",
|
|
6
|
+
"attributes": [
|
|
7
|
+
{
|
|
8
|
+
"name": "code",
|
|
9
|
+
"description": "图标名称",
|
|
10
|
+
"type": "string"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "color",
|
|
14
|
+
"description": "图标颜色",
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "size",
|
|
19
|
+
"description": "图标大小,单位rpx",
|
|
20
|
+
"type": "string | number",
|
|
21
|
+
"default": 28
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "bold",
|
|
25
|
+
"description": "图标是否粗体",
|
|
26
|
+
"type": "boolean",
|
|
27
|
+
"default": false
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "marginLeft",
|
|
31
|
+
"description": "左外边距,单位rpx",
|
|
32
|
+
"type": "string | number",
|
|
33
|
+
"default": 0
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "marginRight",
|
|
37
|
+
"description": "右外边距,单位rpx",
|
|
38
|
+
"type": "string | number",
|
|
39
|
+
"default": 0
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "marginTop",
|
|
43
|
+
"description": "上外边距,单位rpx",
|
|
44
|
+
"type": "string | number",
|
|
45
|
+
"default": 0
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "marginBottom",
|
|
49
|
+
"description": "下外边距,单位rpx",
|
|
50
|
+
"type": "string | number",
|
|
51
|
+
"default": 0
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "fontFamily",
|
|
55
|
+
"description": "字体名",
|
|
56
|
+
"type": "string",
|
|
57
|
+
"default": ""
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "inlineBlock",
|
|
61
|
+
"description": "容器对齐方式",
|
|
62
|
+
"type": "boolean",
|
|
63
|
+
"default": true
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"name": "[event]click",
|
|
67
|
+
"description": "图标点击回调事件",
|
|
68
|
+
"type": "() => void"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, defineOptions } from 'vue';
|
|
3
|
+
import propsData from './props';
|
|
4
|
+
import utils from '../../utils/utils';
|
|
5
|
+
|
|
6
|
+
const componentName = `ste-icon`;
|
|
7
|
+
|
|
8
|
+
defineOptions({
|
|
9
|
+
name: componentName,
|
|
10
|
+
options: {
|
|
11
|
+
virtualHost: true,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const props = defineProps(propsData);
|
|
16
|
+
const emits = defineEmits<{
|
|
17
|
+
(e: 'click', event?: Event): void;
|
|
18
|
+
}>();
|
|
19
|
+
|
|
20
|
+
let defaultFontFamily = 'ste-iconfont-1709689042473';
|
|
21
|
+
|
|
22
|
+
const cmpCode = computed(() => {
|
|
23
|
+
// unicode编码转字符
|
|
24
|
+
if (!props.code) return;
|
|
25
|
+
if (/[a-zA-Z]/.test(props.code)) {
|
|
26
|
+
return String.fromCharCode(props.code.replace('&#', '0').replace(';', '') as any);
|
|
27
|
+
} else {
|
|
28
|
+
return props.code;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const cmpCssVar = computed(() => {
|
|
33
|
+
return {
|
|
34
|
+
'--border': props.showBorder ? '1px' : '0px',
|
|
35
|
+
'--color': props.color,
|
|
36
|
+
'--size': `var(--font-size-${props.size},${utils.formatPx(props.size)})`,
|
|
37
|
+
'--weight': props.bold ? 'bold' : 'normal',
|
|
38
|
+
'--margin-left': utils.formatPx(props.marginLeft),
|
|
39
|
+
'--margin-right': utils.formatPx(props.marginRight),
|
|
40
|
+
'--margin-top': utils.formatPx(props.marginTop),
|
|
41
|
+
'--margin-bottom': utils.formatPx(props.marginBottom),
|
|
42
|
+
'--font-family': props.fontFamily ? props.fontFamily : defaultFontFamily,
|
|
43
|
+
'--display': props.inlineBlock ? 'inline-block' : 'inline-flex',
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
function handleClick(event: any) {
|
|
48
|
+
emits('click', event);
|
|
49
|
+
}
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<template>
|
|
53
|
+
<view class="ste-icon-root" :style="[cmpCssVar]" @click="handleClick">{{ cmpCode }}</view>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<style lang="scss" scoped>
|
|
57
|
+
@import './iconfont.css';
|
|
58
|
+
|
|
59
|
+
.ste-icon-root {
|
|
60
|
+
display: var(--display);
|
|
61
|
+
justify-content: center;
|
|
62
|
+
align-items: center;
|
|
63
|
+
vertical-align: baseline;
|
|
64
|
+
border-width: var(--border);
|
|
65
|
+
border-color: #bbb;
|
|
66
|
+
border-style: solid;
|
|
67
|
+
|
|
68
|
+
margin-left: var(--margin-left) !important;
|
|
69
|
+
margin-right: var(--margin-right) !important;
|
|
70
|
+
transform: translateY(calc(var(--margin-bottom) - var(--margin-top))) !important;
|
|
71
|
+
|
|
72
|
+
// height: calc(var(--size)) !important;
|
|
73
|
+
width: calc(var(--size)) !important;
|
|
74
|
+
line-height: calc(var(--size) - var(--border) * 2) !important;
|
|
75
|
+
font-family: var(--font-family) !important;
|
|
76
|
+
font-size: calc(var(--size) - var(--border) * 2) !important;
|
|
77
|
+
color: var(--color);
|
|
78
|
+
font-weight: var(--weight) !important;
|
|
79
|
+
}
|
|
80
|
+
</style>
|