@wot-ui/ui 1.0.0 → 2.0.0-alpha.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/LICENSE +21 -0
- package/README.md +134 -0
- package/attributes.json +1 -0
- package/changelog.md +53 -0
- package/common/AbortablePromise.ts +28 -0
- package/common/canvasHelper.ts +49 -0
- package/common/clickoutside.ts +25 -0
- package/common/event.ts +8 -0
- package/common/formatDate.ts +68 -0
- package/common/interceptor.ts +43 -0
- package/common/props.ts +53 -0
- package/common/util.ts +836 -0
- package/components/wd-action-sheet/index.scss +232 -0
- package/components/wd-action-sheet/types.ts +155 -0
- package/components/wd-action-sheet/wd-action-sheet.vue +176 -0
- package/components/wd-avatar/index.scss +150 -0
- package/components/wd-avatar/types.ts +98 -0
- package/components/wd-avatar/wd-avatar.vue +184 -0
- package/components/wd-avatar-group/index.scss +11 -0
- package/components/wd-avatar-group/types.ts +61 -0
- package/components/wd-avatar-group/wd-avatar-group.vue +115 -0
- package/components/wd-backtop/index.scss +67 -0
- package/components/wd-backtop/types.ts +66 -0
- package/components/wd-backtop/wd-backtop.vue +57 -0
- package/components/wd-badge/index.scss +116 -0
- package/components/wd-badge/types.ts +94 -0
- package/components/wd-badge/wd-badge.vue +78 -0
- package/components/wd-button/index.scss +436 -0
- package/components/wd-button/types.ts +204 -0
- package/components/wd-button/wd-button.vue +210 -0
- package/components/wd-calendar/index.scss +97 -0
- package/components/wd-calendar/types.ts +221 -0
- package/components/wd-calendar/wd-calendar.vue +339 -0
- package/components/wd-calendar-view/index.scss +41 -0
- package/components/wd-calendar-view/month/index.scss +144 -0
- package/components/wd-calendar-view/month/month.vue +389 -0
- package/components/wd-calendar-view/month/types.ts +70 -0
- package/components/wd-calendar-view/monthPanel/index.scss +84 -0
- package/components/wd-calendar-view/monthPanel/month-panel.vue +541 -0
- package/components/wd-calendar-view/monthPanel/types.ts +151 -0
- package/components/wd-calendar-view/types.ts +166 -0
- package/components/wd-calendar-view/utils.ts +318 -0
- package/components/wd-calendar-view/wd-calendar-view.vue +117 -0
- package/components/wd-calendar-view/year/index.scss +148 -0
- package/components/wd-calendar-view/year/types.ts +74 -0
- package/components/wd-calendar-view/year/year.vue +206 -0
- package/components/wd-calendar-view/yearPanel/index.scss +42 -0
- package/components/wd-calendar-view/yearPanel/types.ts +96 -0
- package/components/wd-calendar-view/yearPanel/year-panel.vue +249 -0
- package/components/wd-card/index.scss +104 -0
- package/components/wd-card/types.ts +47 -0
- package/components/wd-card/wd-card.vue +38 -0
- package/components/wd-cascader/index.scss +154 -0
- package/components/wd-cascader/types.ts +191 -0
- package/components/wd-cascader/wd-cascader.vue +589 -0
- package/components/wd-cell/index.scss +244 -0
- package/components/wd-cell/types.ts +205 -0
- package/components/wd-cell/wd-cell.vue +172 -0
- package/components/wd-cell-group/index.scss +53 -0
- package/components/wd-cell-group/types.ts +97 -0
- package/components/wd-cell-group/wd-cell-group.vue +48 -0
- package/components/wd-checkbox/index.scss +166 -0
- package/components/wd-checkbox/types.ts +118 -0
- package/components/wd-checkbox/wd-checkbox.vue +216 -0
- package/components/wd-checkbox-group/index.scss +5 -0
- package/components/wd-checkbox-group/types.ts +93 -0
- package/components/wd-checkbox-group/wd-checkbox-group.vue +148 -0
- package/components/wd-circle/index.scss +28 -0
- package/components/wd-circle/types.ts +54 -0
- package/components/wd-circle/wd-circle.vue +306 -0
- package/components/wd-col/index.scss +5 -0
- package/components/wd-col/types.ts +16 -0
- package/components/wd-col/wd-col.vue +83 -0
- package/components/wd-collapse/index.scss +71 -0
- package/components/wd-collapse/types.ts +68 -0
- package/components/wd-collapse/wd-collapse.vue +165 -0
- package/components/wd-collapse-item/index.scss +86 -0
- package/components/wd-collapse-item/types.ts +62 -0
- package/components/wd-collapse-item/wd-collapse-item.vue +184 -0
- package/components/wd-config-provider/index.scss +10 -0
- package/components/wd-config-provider/types.ts +2063 -0
- package/components/wd-config-provider/wd-config-provider.vue +61 -0
- package/components/wd-count-down/index.scss +16 -0
- package/components/wd-count-down/types.ts +58 -0
- package/components/wd-count-down/utils.ts +52 -0
- package/components/wd-count-down/wd-count-down.vue +62 -0
- package/components/wd-count-to/index.scss +25 -0
- package/components/wd-count-to/types.ts +121 -0
- package/components/wd-count-to/wd-count-to.vue +126 -0
- package/components/wd-curtain/index.scss +96 -0
- package/components/wd-curtain/types.ts +82 -0
- package/components/wd-curtain/wd-curtain.vue +172 -0
- package/components/wd-datetime-picker/index.scss +133 -0
- package/components/wd-datetime-picker/types.ts +198 -0
- package/components/wd-datetime-picker/wd-datetime-picker.vue +526 -0
- package/components/wd-datetime-picker-view/types.ts +171 -0
- package/components/wd-datetime-picker-view/util.ts +30 -0
- package/components/wd-datetime-picker-view/wd-datetime-picker-view.vue +402 -0
- package/components/wd-dialog/index.scss +281 -0
- package/components/wd-dialog/index.ts +168 -0
- package/components/wd-dialog/types.ts +452 -0
- package/components/wd-dialog/wd-dialog.vue +586 -0
- package/components/wd-divider/index.scss +122 -0
- package/components/wd-divider/types.ts +50 -0
- package/components/wd-divider/wd-divider.vue +54 -0
- package/components/wd-drop-menu/index.scss +90 -0
- package/components/wd-drop-menu/types.ts +38 -0
- package/components/wd-drop-menu/wd-drop-menu.vue +168 -0
- package/components/wd-drop-menu-item/index.scss +96 -0
- package/components/wd-drop-menu-item/types.ts +93 -0
- package/components/wd-drop-menu-item/wd-drop-menu-item.vue +205 -0
- package/components/wd-empty/index.scss +46 -0
- package/components/wd-empty/types.ts +37 -0
- package/components/wd-empty/wd-empty.vue +47 -0
- package/components/wd-fab/index.scss +124 -0
- package/components/wd-fab/types.ts +119 -0
- package/components/wd-fab/wd-fab.vue +322 -0
- package/components/wd-floating-panel/index.scss +73 -0
- package/components/wd-floating-panel/type.ts +32 -0
- package/components/wd-floating-panel/wd-floating-panel.vue +142 -0
- package/components/wd-form/adapters/zod.ts +56 -0
- package/components/wd-form/types.ts +147 -0
- package/components/wd-form/wd-form.vue +121 -0
- package/components/wd-form-item/index.scss +26 -0
- package/components/wd-form-item/types.ts +134 -0
- package/components/wd-form-item/wd-form-item.vue +182 -0
- package/components/wd-gap/index.scss +9 -0
- package/components/wd-gap/types.ts +26 -0
- package/components/wd-gap/wd-gap.vue +38 -0
- package/components/wd-grid/index.scss +11 -0
- package/components/wd-grid/types.ts +97 -0
- package/components/wd-grid/wd-grid.vue +48 -0
- package/components/wd-grid-item/index.scss +187 -0
- package/components/wd-grid-item/types.ts +98 -0
- package/components/wd-grid-item/wd-grid-item.vue +295 -0
- package/components/wd-icon/index.scss +46 -0
- package/components/wd-icon/types.ts +44 -0
- package/components/wd-icon/wd-icon.vue +66 -0
- package/components/wd-image-preview/index.scss +94 -0
- package/components/wd-image-preview/index.ts +95 -0
- package/components/wd-image-preview/types.ts +165 -0
- package/components/wd-image-preview/wd-image-preview.vue +233 -0
- package/components/wd-img/index.scss +82 -0
- package/components/wd-img/types.ts +96 -0
- package/components/wd-img/wd-img.vue +91 -0
- package/components/wd-img-cropper/index.scss +259 -0
- package/components/wd-img-cropper/types.ts +101 -0
- package/components/wd-img-cropper/wd-img-cropper.vue +653 -0
- package/components/wd-index-anchor/index.scss +34 -0
- package/components/wd-index-anchor/type.ts +9 -0
- package/components/wd-index-anchor/wd-index-anchor.vue +55 -0
- package/components/wd-index-bar/index.scss +68 -0
- package/components/wd-index-bar/type.ts +23 -0
- package/components/wd-index-bar/wd-index-bar.vue +157 -0
- package/components/wd-input/index.scss +129 -0
- package/components/wd-input/types.ts +165 -0
- package/components/wd-input/wd-input.vue +237 -0
- package/components/wd-input-number/index.scss +233 -0
- package/components/wd-input-number/types.ts +131 -0
- package/components/wd-input-number/wd-input-number.vue +473 -0
- package/components/wd-keyboard/constants.ts +81 -0
- package/components/wd-keyboard/index.scss +104 -0
- package/components/wd-keyboard/key/index.scss +103 -0
- package/components/wd-keyboard/key/index.vue +84 -0
- package/components/wd-keyboard/key/types.ts +44 -0
- package/components/wd-keyboard/types.ts +138 -0
- package/components/wd-keyboard/wd-keyboard.vue +236 -0
- package/components/wd-loading/index.scss +205 -0
- package/components/wd-loading/types.ts +61 -0
- package/components/wd-loading/wd-loading.vue +70 -0
- package/components/wd-loadmore/index.scss +62 -0
- package/components/wd-loadmore/types.ts +42 -0
- package/components/wd-loadmore/wd-loadmore.vue +68 -0
- package/components/wd-navbar/index.scss +96 -0
- package/components/wd-navbar/types.ts +74 -0
- package/components/wd-navbar/wd-navbar.vue +136 -0
- package/components/wd-navbar-capsule/index.scss +70 -0
- package/components/wd-navbar-capsule/types.ts +11 -0
- package/components/wd-navbar-capsule/wd-navbar-capsule.vue +48 -0
- package/components/wd-notice-bar/index.scss +94 -0
- package/components/wd-notice-bar/types.ts +97 -0
- package/components/wd-notice-bar/wd-notice-bar.vue +270 -0
- package/components/wd-notify/index.scss +114 -0
- package/components/wd-notify/index.ts +63 -0
- package/components/wd-notify/types.ts +130 -0
- package/components/wd-notify/wd-notify.vue +162 -0
- package/components/wd-overlay/index.scss +14 -0
- package/components/wd-overlay/types.ts +42 -0
- package/components/wd-overlay/wd-overlay.vue +55 -0
- package/components/wd-pagination/index.scss +71 -0
- package/components/wd-pagination/types.ts +69 -0
- package/components/wd-pagination/wd-pagination.vue +118 -0
- package/components/wd-password-input/index.scss +134 -0
- package/components/wd-password-input/types.ts +42 -0
- package/components/wd-password-input/wd-password-input.vue +51 -0
- package/components/wd-picker/index.scss +72 -0
- package/components/wd-picker/types.ts +141 -0
- package/components/wd-picker/wd-picker.vue +220 -0
- package/components/wd-picker-view/index.scss +93 -0
- package/components/wd-picker-view/types.ts +145 -0
- package/components/wd-picker-view/useSelection.ts +385 -0
- package/components/wd-picker-view/wd-picker-view.vue +227 -0
- package/components/wd-popover/index.scss +117 -0
- package/components/wd-popover/types.ts +106 -0
- package/components/wd-popover/wd-popover.vue +212 -0
- package/components/wd-popup/index.scss +89 -0
- package/components/wd-popup/types.ts +110 -0
- package/components/wd-popup/wd-popup.vue +174 -0
- package/components/wd-progress/index.scss +155 -0
- package/components/wd-progress/types.ts +94 -0
- package/components/wd-progress/wd-progress.vue +249 -0
- package/components/wd-radio/index.scss +189 -0
- package/components/wd-radio/types.ts +64 -0
- package/components/wd-radio/wd-radio.vue +164 -0
- package/components/wd-radio-group/index.scss +5 -0
- package/components/wd-radio-group/types.ts +70 -0
- package/components/wd-radio-group/wd-radio-group.vue +53 -0
- package/components/wd-rate/index.scss +57 -0
- package/components/wd-rate/types.ts +86 -0
- package/components/wd-rate/wd-rate.vue +168 -0
- package/components/wd-resize/index.scss +31 -0
- package/components/wd-resize/types.ts +14 -0
- package/components/wd-resize/wd-resize.vue +157 -0
- package/components/wd-root-portal/wd-root-portal.vue +77 -0
- package/components/wd-row/index.scss +6 -0
- package/components/wd-row/types.ts +36 -0
- package/components/wd-row/wd-row.vue +88 -0
- package/components/wd-search/index.scss +171 -0
- package/components/wd-search/types.ts +107 -0
- package/components/wd-search/wd-search.vue +198 -0
- package/components/wd-segmented/index.scss +155 -0
- package/components/wd-segmented/types.ts +81 -0
- package/components/wd-segmented/wd-segmented.vue +169 -0
- package/components/wd-select-picker/index.scss +72 -0
- package/components/wd-select-picker/types.ts +72 -0
- package/components/wd-select-picker/wd-select-picker.vue +371 -0
- package/components/wd-sidebar/index.scss +25 -0
- package/components/wd-sidebar/types.ts +34 -0
- package/components/wd-sidebar/wd-sidebar.vue +57 -0
- package/components/wd-sidebar-item/index.scss +91 -0
- package/components/wd-sidebar-item/types.ts +28 -0
- package/components/wd-sidebar-item/wd-sidebar-item.vue +118 -0
- package/components/wd-signature/index.scss +42 -0
- package/components/wd-signature/types.ts +295 -0
- package/components/wd-signature/wd-signature.vue +664 -0
- package/components/wd-skeleton/index.scss +112 -0
- package/components/wd-skeleton/types.ts +124 -0
- package/components/wd-skeleton/wd-skeleton.vue +110 -0
- package/components/wd-slide-verify/index.scss +112 -0
- package/components/wd-slide-verify/types.ts +98 -0
- package/components/wd-slide-verify/wd-slide-verify.vue +222 -0
- package/components/wd-slider/index.scss +485 -0
- package/components/wd-slider/types.ts +166 -0
- package/components/wd-slider/wd-slider.vue +529 -0
- package/components/wd-sort-button/index.scss +126 -0
- package/components/wd-sort-button/types.ts +68 -0
- package/components/wd-sort-button/wd-sort-button.vue +67 -0
- package/components/wd-step/index.scss +366 -0
- package/components/wd-step/types.ts +43 -0
- package/components/wd-step/wd-step.vue +181 -0
- package/components/wd-steps/index.scss +7 -0
- package/components/wd-steps/types.ts +50 -0
- package/components/wd-steps/wd-steps.vue +39 -0
- package/components/wd-sticky/index.scss +9 -0
- package/components/wd-sticky/types.ts +13 -0
- package/components/wd-sticky/wd-sticky.vue +192 -0
- package/components/wd-sticky-box/index.scss +6 -0
- package/components/wd-sticky-box/types.ts +20 -0
- package/components/wd-sticky-box/wd-sticky-box.vue +157 -0
- package/components/wd-swipe-action/index.scss +22 -0
- package/components/wd-swipe-action/types.ts +87 -0
- package/components/wd-swipe-action/wd-swipe-action.vue +320 -0
- package/components/wd-swiper/index.scss +69 -0
- package/components/wd-swiper/types.ts +275 -0
- package/components/wd-swiper/wd-swiper.vue +332 -0
- package/components/wd-swiper-nav/index.scss +179 -0
- package/components/wd-swiper-nav/types.ts +42 -0
- package/components/wd-swiper-nav/wd-swiper-nav.vue +42 -0
- package/components/wd-switch/index.scss +177 -0
- package/components/wd-switch/types.ts +93 -0
- package/components/wd-switch/wd-switch.vue +107 -0
- package/components/wd-tab/index.scss +16 -0
- package/components/wd-tab/types.ts +45 -0
- package/components/wd-tab/wd-tab.vue +99 -0
- package/components/wd-tabbar/index.scss +71 -0
- package/components/wd-tabbar/types.ts +79 -0
- package/components/wd-tabbar/wd-tabbar.vue +109 -0
- package/components/wd-tabbar-item/index.scss +50 -0
- package/components/wd-tabbar-item/types.ts +45 -0
- package/components/wd-tabbar-item/wd-tabbar-item.vue +101 -0
- package/components/wd-table/index.scss +128 -0
- package/components/wd-table/types.ts +160 -0
- package/components/wd-table/wd-table.vue +331 -0
- package/components/wd-table-column/index.scss +15 -0
- package/components/wd-table-column/types.ts +81 -0
- package/components/wd-table-column/wd-table-column.vue +198 -0
- package/components/wd-tabs/index.scss +332 -0
- package/components/wd-tabs/types.ts +155 -0
- package/components/wd-tabs/wd-tabs.vue +508 -0
- package/components/wd-tag/index.scss +325 -0
- package/components/wd-tag/types.ts +90 -0
- package/components/wd-tag/wd-tag.vue +158 -0
- package/components/wd-text/index.scss +52 -0
- package/components/wd-text/types.ts +107 -0
- package/components/wd-text/wd-text.vue +141 -0
- package/components/wd-textarea/index.scss +112 -0
- package/components/wd-textarea/types.ts +151 -0
- package/components/wd-textarea/wd-textarea.vue +212 -0
- package/components/wd-toast/index.scss +92 -0
- package/components/wd-toast/index.ts +97 -0
- package/components/wd-toast/types.ts +190 -0
- package/components/wd-toast/wd-toast.vue +158 -0
- package/components/wd-tooltip/index.scss +77 -0
- package/components/wd-tooltip/types.ts +105 -0
- package/components/wd-tooltip/wd-tooltip.vue +169 -0
- package/components/wd-tour/index.scss +106 -0
- package/components/wd-tour/types.ts +268 -0
- package/components/wd-tour/wd-tour.vue +518 -0
- package/components/wd-transition/index.scss +67 -0
- package/components/wd-transition/types.ts +106 -0
- package/components/wd-transition/wd-transition.vue +238 -0
- package/components/wd-upload/index.scss +204 -0
- package/components/wd-upload/types.ts +390 -0
- package/components/wd-upload/wd-upload.vue +565 -0
- package/components/wd-video-preview/index.scss +54 -0
- package/components/wd-video-preview/index.ts +64 -0
- package/components/wd-video-preview/types.ts +66 -0
- package/components/wd-video-preview/wd-video-preview.vue +141 -0
- package/components/wd-watermark/index.scss +21 -0
- package/components/wd-watermark/types.ts +130 -0
- package/components/wd-watermark/wd-watermark.vue +718 -0
- package/components/wot-ui/wot-ui.vue +5 -0
- package/composables/index.ts +12 -0
- package/composables/useCell.ts +34 -0
- package/composables/useChildren.ts +120 -0
- package/composables/useConfigProvider.ts +45 -0
- package/composables/useCountDown.ts +138 -0
- package/composables/useDeviceInfo.ts +136 -0
- package/composables/useLockScroll.ts +37 -0
- package/composables/useParent.ts +51 -0
- package/composables/usePopover.ts +212 -0
- package/composables/useQueue.ts +52 -0
- package/composables/useRaf.ts +37 -0
- package/composables/useTouch.ts +43 -0
- package/composables/useTranslate.ts +12 -0
- package/composables/useUpload.ts +366 -0
- package/global.d.ts +106 -0
- package/index.ts +11 -0
- package/locale/index.ts +32 -0
- package/locale/lang/ar-SA.ts +150 -0
- package/locale/lang/de-DE.ts +150 -0
- package/locale/lang/en-US.ts +150 -0
- package/locale/lang/es-ES.ts +150 -0
- package/locale/lang/fr-FR.ts +150 -0
- package/locale/lang/ja-JP.ts +150 -0
- package/locale/lang/ko-KR.ts +150 -0
- package/locale/lang/pt-PT.ts +150 -0
- package/locale/lang/ru-RU.ts +150 -0
- package/locale/lang/th-TH.ts +150 -0
- package/locale/lang/tr-TR.ts +155 -0
- package/locale/lang/ug-CN.ts +154 -0
- package/locale/lang/vi-VN.ts +89 -0
- package/locale/lang/zh-CN.ts +154 -0
- package/locale/lang/zh-HK.ts +78 -0
- package/locale/lang/zh-TW.ts +78 -0
- package/package.json +1 -11
- package/styles/iconfont/iconfont.scss +1243 -0
- package/styles/mixin/_config.scss +7 -0
- package/styles/mixin/_function.scss +44 -0
- package/styles/mixin/_mixin.scss +473 -0
- package/styles/theme/base/color.scss +210 -0
- package/styles/theme/base/font.scss +13 -0
- package/styles/theme/base/index.scss +8 -0
- package/styles/theme/base/insets.scss +32 -0
- package/styles/theme/base/number.scss +36 -0
- package/styles/theme/base/opacity.scss +9 -0
- package/styles/theme/base/radius.scss +13 -0
- package/styles/theme/base/stroke.scss +9 -0
- package/styles/theme/base/typography.scss +44 -0
- package/styles/theme/dark.scss +101 -0
- package/styles/theme/index.scss +16 -0
- package/styles/theme/light.scss +101 -0
- package/styles/variable.scss +472 -0
- package/tags.json +1 -0
- package/web-types.json +1 -0
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="`wd-select-picker ${customClass}`" :style="customStyle">
|
|
3
|
+
<wd-action-sheet
|
|
4
|
+
v-model="pickerShow"
|
|
5
|
+
:title="title || translate('title')"
|
|
6
|
+
:close-on-click-modal="closeOnClickModal"
|
|
7
|
+
:z-index="zIndex"
|
|
8
|
+
:safe-area-inset-bottom="safeAreaInsetBottom"
|
|
9
|
+
:root-portal="rootPortal"
|
|
10
|
+
@close="close"
|
|
11
|
+
@after-enter="scrollIntoView ? setScrollIntoView() : ''"
|
|
12
|
+
custom-class="wd-select-picker__popup"
|
|
13
|
+
>
|
|
14
|
+
<wd-search
|
|
15
|
+
v-if="filterable"
|
|
16
|
+
v-model="filterVal"
|
|
17
|
+
:placeholder="filterPlaceholder || translate('filterPlaceholder')"
|
|
18
|
+
hide-cancel
|
|
19
|
+
placeholder-left
|
|
20
|
+
@change="handleFilterChange"
|
|
21
|
+
/>
|
|
22
|
+
<scroll-view
|
|
23
|
+
:class="`wd-select-picker__wrapper ${loading ? 'is-loading' : ''} ${customContentClass}`"
|
|
24
|
+
:scroll-y="!loading"
|
|
25
|
+
:scroll-top="scrollTop"
|
|
26
|
+
:scroll-with-animation="true"
|
|
27
|
+
>
|
|
28
|
+
<!-- 多选 -->
|
|
29
|
+
<view v-if="type === 'checkbox' && isArray(selectList)" class="wd-select-picker__checkbox" id="wd-checkbox-group">
|
|
30
|
+
<wd-checkbox-group
|
|
31
|
+
v-model="selectList"
|
|
32
|
+
:size="selectSize"
|
|
33
|
+
:checked-color="checkedColor"
|
|
34
|
+
:min="min"
|
|
35
|
+
:max="max"
|
|
36
|
+
type="square"
|
|
37
|
+
placement="right"
|
|
38
|
+
@change="handleChange"
|
|
39
|
+
>
|
|
40
|
+
<view v-for="item in filterColumns" :key="item[valueKey]" :id="'check' + item[valueKey]">
|
|
41
|
+
<wd-checkbox :name="item[valueKey]" :disabled="item.disabled" custom-label-class="wd-select-picker__checkbox-label">
|
|
42
|
+
<block v-if="showHighlightText">
|
|
43
|
+
<block v-for="text in item[labelKey]" :key="text.label">
|
|
44
|
+
<text v-if="text.type === 'active'" class="wd-select-picker__text-active">{{ text.label }}</text>
|
|
45
|
+
<block v-else>{{ text.label }}</block>
|
|
46
|
+
</block>
|
|
47
|
+
</block>
|
|
48
|
+
<block v-else>
|
|
49
|
+
{{ item[labelKey] }}
|
|
50
|
+
</block>
|
|
51
|
+
</wd-checkbox>
|
|
52
|
+
</view>
|
|
53
|
+
</wd-checkbox-group>
|
|
54
|
+
</view>
|
|
55
|
+
<!-- 单选 -->
|
|
56
|
+
<view v-if="type === 'radio' && !isArray(selectList)" class="wd-select-picker__radio" id="wd-radio-group">
|
|
57
|
+
<wd-radio-group
|
|
58
|
+
v-model="selectList"
|
|
59
|
+
cell
|
|
60
|
+
:size="selectSize"
|
|
61
|
+
:checked-color="checkedColor"
|
|
62
|
+
placement="right"
|
|
63
|
+
type="dot"
|
|
64
|
+
@change="handleChange"
|
|
65
|
+
>
|
|
66
|
+
<view v-for="(item, index) in filterColumns" :key="index" :id="'radio' + item[valueKey]">
|
|
67
|
+
<wd-radio :value="item[valueKey]" :disabled="item.disabled" custom-label-class="wd-select-picker__radio-label">
|
|
68
|
+
<block v-if="showHighlightText">
|
|
69
|
+
<block v-for="text in item[labelKey]" :key="text.label">
|
|
70
|
+
<text :class="`${text.type === 'active' ? 'wd-select-picker__text-active' : ''}`">{{ text.label }}</text>
|
|
71
|
+
</block>
|
|
72
|
+
</block>
|
|
73
|
+
<block v-else>
|
|
74
|
+
{{ item[labelKey] }}
|
|
75
|
+
</block>
|
|
76
|
+
</wd-radio>
|
|
77
|
+
</view>
|
|
78
|
+
</wd-radio-group>
|
|
79
|
+
</view>
|
|
80
|
+
<view v-if="loading" class="wd-select-picker__loading" @touchmove="noop">
|
|
81
|
+
<wd-loading :color="loadingColor" custom-class="wd-select-picker__loading-icon" />
|
|
82
|
+
</view>
|
|
83
|
+
</scroll-view>
|
|
84
|
+
<!-- 确认按钮 -->
|
|
85
|
+
<view v-if="showConfirm" class="wd-select-picker__footer">
|
|
86
|
+
<wd-button block size="large" @click="onConfirm" :disabled="loading">{{ confirmButtonText || translate('confirm') }}</wd-button>
|
|
87
|
+
</view>
|
|
88
|
+
</wd-action-sheet>
|
|
89
|
+
</view>
|
|
90
|
+
</template>
|
|
91
|
+
<script lang="ts">
|
|
92
|
+
export default {
|
|
93
|
+
name: 'wd-select-picker',
|
|
94
|
+
options: {
|
|
95
|
+
addGlobalClass: true,
|
|
96
|
+
// #ifndef MP-TOUTIAO
|
|
97
|
+
virtualHost: true,
|
|
98
|
+
// #endif
|
|
99
|
+
styleIsolation: 'shared'
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
</script>
|
|
103
|
+
|
|
104
|
+
<script lang="ts" setup>
|
|
105
|
+
import wdActionSheet from '../wd-action-sheet/wd-action-sheet.vue'
|
|
106
|
+
import wdCheckbox from '../wd-checkbox/wd-checkbox.vue'
|
|
107
|
+
import wdCheckboxGroup from '../wd-checkbox-group/wd-checkbox-group.vue'
|
|
108
|
+
import wdRadio from '../wd-radio/wd-radio.vue'
|
|
109
|
+
import wdRadioGroup from '../wd-radio-group/wd-radio-group.vue'
|
|
110
|
+
import wdButton from '../wd-button/wd-button.vue'
|
|
111
|
+
import wdLoading from '../wd-loading/wd-loading.vue'
|
|
112
|
+
|
|
113
|
+
import { getCurrentInstance, onBeforeMount, ref, watch, nextTick, computed } from 'vue'
|
|
114
|
+
import { getRect, isArray, isDef, isFunction, pause } from '../../common/util'
|
|
115
|
+
import { callInterceptor } from '../../common/interceptor'
|
|
116
|
+
import { useTranslate } from '../../composables/useTranslate'
|
|
117
|
+
import { selectPickerProps, type SelectPickerExpose } from './types'
|
|
118
|
+
|
|
119
|
+
const { translate } = useTranslate('select-picker')
|
|
120
|
+
|
|
121
|
+
const props = defineProps(selectPickerProps)
|
|
122
|
+
const emit = defineEmits(['change', 'cancel', 'confirm', 'update:modelValue', 'open', 'close', 'update:visible'])
|
|
123
|
+
|
|
124
|
+
const pickerShow = ref<boolean>(false)
|
|
125
|
+
const selectList = ref<Array<number | boolean | string> | number | boolean | string>([])
|
|
126
|
+
const isConfirm = ref<boolean>(false)
|
|
127
|
+
const lastSelectList = ref<Array<number | boolean | string> | number | boolean | string>([])
|
|
128
|
+
const filterVal = ref<string>('')
|
|
129
|
+
const filterColumns = ref<Array<Record<string, any>>>([])
|
|
130
|
+
const scrollTop = ref<number>(0) // 滚动位置
|
|
131
|
+
|
|
132
|
+
const valueItemMap = computed(() => {
|
|
133
|
+
const map = new Map<string | number | boolean, Record<string, any>>()
|
|
134
|
+
const { columns, valueKey } = props
|
|
135
|
+
columns.forEach((item) => {
|
|
136
|
+
map.set(item[valueKey], item)
|
|
137
|
+
})
|
|
138
|
+
return map
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
const showHighlightText = computed(() => {
|
|
142
|
+
return props.filterable && !!filterVal.value
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
function getModelValueWatchKey(value: string | number | boolean | (string | number | boolean)[]) {
|
|
146
|
+
if (props.type === 'checkbox') {
|
|
147
|
+
return isArray(value) ? value.join('|') : ''
|
|
148
|
+
}
|
|
149
|
+
return isDef(value) ? String(value) : ''
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function getColumnsWatchKey(columns: Record<string, any>[]) {
|
|
153
|
+
const { valueKey, labelKey } = props
|
|
154
|
+
return columns
|
|
155
|
+
.map((item) => {
|
|
156
|
+
const value = isDef(item[valueKey]) ? String(item[valueKey]) : ''
|
|
157
|
+
const label = isDef(item[labelKey]) ? String(item[labelKey]) : ''
|
|
158
|
+
return `${value}|${label}|${item.disabled ? '1' : '0'}`
|
|
159
|
+
})
|
|
160
|
+
.join('||')
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
watch(
|
|
164
|
+
() => getModelValueWatchKey(props.modelValue),
|
|
165
|
+
() => {
|
|
166
|
+
const newValue = props.modelValue
|
|
167
|
+
if (newValue === selectList.value) return
|
|
168
|
+
selectList.value = valueFormat(newValue)
|
|
169
|
+
lastSelectList.value = valueFormat(newValue)
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
immediate: true
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
watch(
|
|
177
|
+
() => getColumnsWatchKey(props.columns),
|
|
178
|
+
() => {
|
|
179
|
+
const newValue = props.columns
|
|
180
|
+
if (props.filterable && filterVal.value) {
|
|
181
|
+
formatFilterColumns(newValue, filterVal.value)
|
|
182
|
+
} else {
|
|
183
|
+
filterColumns.value = newValue
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
immediate: true
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
watch(
|
|
192
|
+
() => props.visible,
|
|
193
|
+
(val) => {
|
|
194
|
+
pickerShow.value = val
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
immediate: true
|
|
198
|
+
}
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
onBeforeMount(() => {
|
|
202
|
+
selectList.value = valueFormat(props.modelValue)
|
|
203
|
+
filterColumns.value = props.columns
|
|
204
|
+
})
|
|
205
|
+
|
|
206
|
+
const { proxy } = getCurrentInstance() as any
|
|
207
|
+
|
|
208
|
+
async function setScrollIntoView() {
|
|
209
|
+
let wraperSelector: string = ''
|
|
210
|
+
let targetSelector: string = ''
|
|
211
|
+
if (isDef(selectList.value) && selectList.value !== '' && !isArray(selectList.value)) {
|
|
212
|
+
wraperSelector = '#wd-radio-group'
|
|
213
|
+
targetSelector = `#radio${selectList.value}`
|
|
214
|
+
} else if (isArray(selectList.value) && selectList.value.length > 0) {
|
|
215
|
+
wraperSelector = '#wd-checkbox-group'
|
|
216
|
+
targetSelector = `#check${selectList.value[0]}`
|
|
217
|
+
}
|
|
218
|
+
if (wraperSelector && targetSelector) {
|
|
219
|
+
await pause(2000 / 30)
|
|
220
|
+
const [scrollView, wraper, target] = await Promise.all([
|
|
221
|
+
getRect('.wd-select-picker__wrapper', false, proxy),
|
|
222
|
+
getRect(wraperSelector, false, proxy),
|
|
223
|
+
getRect(targetSelector, false, proxy)
|
|
224
|
+
])
|
|
225
|
+
|
|
226
|
+
if (isDef(wraper) && isDef(scrollView) && isDef(target)) {
|
|
227
|
+
const isVisible = target.bottom! > scrollView.top! && target.top! < scrollView.bottom!
|
|
228
|
+
if (!isVisible) {
|
|
229
|
+
scrollTop.value = -1
|
|
230
|
+
nextTick(() => {
|
|
231
|
+
scrollTop.value = Math.max(0, target.top! - wraper.top! - scrollView.height! / 2)
|
|
232
|
+
})
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function noop() {}
|
|
239
|
+
|
|
240
|
+
function getSelectedItem(value: string | number | boolean) {
|
|
241
|
+
const { valueKey, labelKey } = props
|
|
242
|
+
const selected = valueItemMap.value.get(value)
|
|
243
|
+
|
|
244
|
+
if (selected) {
|
|
245
|
+
return selected
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return {
|
|
249
|
+
[valueKey]: value,
|
|
250
|
+
[labelKey]: ''
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function valueFormat(value: string | number | boolean | (string | number | boolean)[]) {
|
|
255
|
+
return props.type === 'checkbox' ? (isArray(value) ? value : []) : value
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function handleChange({ value }: { value: string | number | boolean | (string | number | boolean)[] }) {
|
|
259
|
+
selectList.value = value
|
|
260
|
+
emit('change', { value })
|
|
261
|
+
if (props.type === 'radio' && !props.showConfirm) {
|
|
262
|
+
onConfirm()
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function close() {
|
|
267
|
+
pickerShow.value = false
|
|
268
|
+
emit('update:visible', false)
|
|
269
|
+
// 未确定选项时,数据还原复位
|
|
270
|
+
if (!isConfirm.value) {
|
|
271
|
+
selectList.value = valueFormat(lastSelectList.value)
|
|
272
|
+
}
|
|
273
|
+
emit('cancel')
|
|
274
|
+
emit('close')
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function open() {
|
|
278
|
+
selectList.value = valueFormat(props.modelValue)
|
|
279
|
+
pickerShow.value = true
|
|
280
|
+
emit('update:visible', true)
|
|
281
|
+
isConfirm.value = false
|
|
282
|
+
emit('open')
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
function onConfirm() {
|
|
286
|
+
if (props.loading) {
|
|
287
|
+
pickerShow.value = false
|
|
288
|
+
emit('update:visible', false)
|
|
289
|
+
emit('confirm')
|
|
290
|
+
emit('close')
|
|
291
|
+
return
|
|
292
|
+
}
|
|
293
|
+
callInterceptor(props.beforeConfirm, {
|
|
294
|
+
args: [selectList.value],
|
|
295
|
+
done: () => {
|
|
296
|
+
handleConfirm()
|
|
297
|
+
}
|
|
298
|
+
})
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function handleConfirm() {
|
|
302
|
+
isConfirm.value = true
|
|
303
|
+
pickerShow.value = false
|
|
304
|
+
emit('update:visible', false)
|
|
305
|
+
lastSelectList.value = valueFormat(selectList.value)
|
|
306
|
+
let selectedItems: Record<string, any> = {}
|
|
307
|
+
if (props.type === 'checkbox') {
|
|
308
|
+
selectedItems = (isArray(lastSelectList.value) ? lastSelectList.value : []).map((item) => {
|
|
309
|
+
return getSelectedItem(item)
|
|
310
|
+
})
|
|
311
|
+
} else {
|
|
312
|
+
selectedItems = getSelectedItem(lastSelectList.value as string | number | boolean)
|
|
313
|
+
}
|
|
314
|
+
emit('update:modelValue', lastSelectList.value)
|
|
315
|
+
emit('confirm', {
|
|
316
|
+
value: lastSelectList.value,
|
|
317
|
+
selectedItems
|
|
318
|
+
})
|
|
319
|
+
emit('close')
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
function escapeRegExp(text: string) {
|
|
323
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function getFilterText(label: string, filterVal: string): Array<{ type: 'active' | 'normal'; label: string }> {
|
|
327
|
+
const reg = new RegExp(`(${escapeRegExp(filterVal)})`, 'g')
|
|
328
|
+
|
|
329
|
+
return label.split(reg).map((text) => {
|
|
330
|
+
return {
|
|
331
|
+
type: text === filterVal ? 'active' : 'normal',
|
|
332
|
+
label: text
|
|
333
|
+
}
|
|
334
|
+
})
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function handleFilterChange({ value }: { value: string }) {
|
|
338
|
+
filterVal.value = value
|
|
339
|
+
if (value === '') {
|
|
340
|
+
filterColumns.value = props.columns
|
|
341
|
+
} else {
|
|
342
|
+
formatFilterColumns(props.columns, value)
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
function formatFilterColumns(columns: Record<string, any>[], filterVal: string) {
|
|
347
|
+
const filterColumnsTemp = columns.filter((item) => {
|
|
348
|
+
return item[props.labelKey].indexOf(filterVal) > -1
|
|
349
|
+
})
|
|
350
|
+
|
|
351
|
+
const formatFilterColumns = filterColumnsTemp.map((item) => {
|
|
352
|
+
return {
|
|
353
|
+
...item,
|
|
354
|
+
[props.labelKey]: getFilterText(item[props.labelKey], filterVal)
|
|
355
|
+
}
|
|
356
|
+
})
|
|
357
|
+
filterColumns.value = formatFilterColumns
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
const showConfirm = computed(() => {
|
|
361
|
+
return (props.type === 'radio' && props.showConfirm) || props.type === 'checkbox'
|
|
362
|
+
})
|
|
363
|
+
|
|
364
|
+
defineExpose<SelectPickerExpose>({
|
|
365
|
+
close,
|
|
366
|
+
open
|
|
367
|
+
})
|
|
368
|
+
</script>
|
|
369
|
+
<style lang="scss">
|
|
370
|
+
@use './index.scss';
|
|
371
|
+
</style>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
@use '../../styles/mixin/mixin.scss' as *;
|
|
2
|
+
@use '../../styles/variable.scss' as *;
|
|
3
|
+
|
|
4
|
+
// 侧边栏宽度
|
|
5
|
+
$sidebar-width: var(--wot-sidebar-width, 114px) !default;
|
|
6
|
+
// 侧边栏高度
|
|
7
|
+
$sidebar-height: var(--wot-sidebar-height, 100%) !default;
|
|
8
|
+
// 侧边栏背景色
|
|
9
|
+
$sidebar-bg: var(--wot-sidebar-bg, $filled-oppo) !default;
|
|
10
|
+
// 内容区背景色
|
|
11
|
+
$sidebar-padding-bg: var(--wot-sidebar-padding-bg, $filled-oppo) !default;
|
|
12
|
+
|
|
13
|
+
@include b(sidebar) {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
overflow-y: auto;
|
|
17
|
+
width: $sidebar-width;
|
|
18
|
+
height: $sidebar-height;
|
|
19
|
+
background: $sidebar-bg;
|
|
20
|
+
|
|
21
|
+
@include e(padding) {
|
|
22
|
+
flex: 1 1 auto;
|
|
23
|
+
background: $sidebar-padding-bg;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: weisheng
|
|
3
|
+
* @Date: 2024-01-05 18:03:27
|
|
4
|
+
* @LastEditTime: 2024-11-18 23:27:55
|
|
5
|
+
* @LastEditors: weisheng
|
|
6
|
+
* @Description:
|
|
7
|
+
* @FilePath: /wot-ui/src/uni_modules/wot-ui/components/wd-sidebar/types.ts
|
|
8
|
+
* 记得注释
|
|
9
|
+
*/
|
|
10
|
+
import { type ExtractPropTypes, type InjectionKey, type PropType } from 'vue'
|
|
11
|
+
import { baseProps, makeNumericProp } from '../../common/props'
|
|
12
|
+
|
|
13
|
+
export type SidebarProvide = {
|
|
14
|
+
props: Partial<SidebarProps>
|
|
15
|
+
setChange: (value: number | string, label: string) => void
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const SIDEBAR_KEY: InjectionKey<SidebarProvide> = Symbol('wd-sidebar')
|
|
19
|
+
|
|
20
|
+
export type SidebarBeforeChange = (value: number | string) => boolean | Promise<boolean>
|
|
21
|
+
|
|
22
|
+
export const sidebarProps = {
|
|
23
|
+
...baseProps,
|
|
24
|
+
/**
|
|
25
|
+
* 当前导航项的索引
|
|
26
|
+
*/
|
|
27
|
+
modelValue: makeNumericProp(0),
|
|
28
|
+
/**
|
|
29
|
+
* 在改变前执行的函数
|
|
30
|
+
*/
|
|
31
|
+
beforeChange: Function as PropType<SidebarBeforeChange>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type SidebarProps = ExtractPropTypes<typeof sidebarProps>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="`wd-sidebar ${customClass}`" :style="customStyle">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
<view class="wd-sidebar__padding"></view>
|
|
5
|
+
</view>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
export default {
|
|
10
|
+
name: 'wd-sidebar',
|
|
11
|
+
options: {
|
|
12
|
+
addGlobalClass: true,
|
|
13
|
+
// #ifndef MP-TOUTIAO
|
|
14
|
+
virtualHost: true,
|
|
15
|
+
// #endif
|
|
16
|
+
styleIsolation: 'shared'
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<script lang="ts" setup>
|
|
22
|
+
import { callInterceptor } from '../../common/interceptor'
|
|
23
|
+
import { useChildren } from '../../composables/useChildren'
|
|
24
|
+
import { SIDEBAR_KEY, sidebarProps } from './types'
|
|
25
|
+
|
|
26
|
+
const props = defineProps(sidebarProps)
|
|
27
|
+
const emit = defineEmits(['change', 'update:modelValue'])
|
|
28
|
+
|
|
29
|
+
const { linkChildren } = useChildren(SIDEBAR_KEY)
|
|
30
|
+
linkChildren({ props, setChange })
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 子项状态变更
|
|
34
|
+
* @param value 目标值
|
|
35
|
+
* @param label 目标值标题
|
|
36
|
+
*/
|
|
37
|
+
function setChange(value: number | string, label: string) {
|
|
38
|
+
callInterceptor(props.beforeChange, {
|
|
39
|
+
args: [value],
|
|
40
|
+
done: () => updateValue(value, label)
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 更新选中状态
|
|
46
|
+
* @param value 目标值
|
|
47
|
+
* @param label 目标值标题
|
|
48
|
+
*/
|
|
49
|
+
function updateValue(value: number | string, label: string) {
|
|
50
|
+
emit('update:modelValue', value)
|
|
51
|
+
emit('change', { value, label })
|
|
52
|
+
}
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<style lang="scss">
|
|
56
|
+
@use './index.scss';
|
|
57
|
+
</style>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
@use '../../styles/mixin/mixin.scss' as *;
|
|
2
|
+
@use '../../styles/variable.scss' as *;
|
|
3
|
+
|
|
4
|
+
// 选项字号
|
|
5
|
+
$sidebar-item-font-size: var(--wot-sidebar-item-font-size, $typography-body-size-main) !default;
|
|
6
|
+
// 选项行高
|
|
7
|
+
$sidebar-item-line-height: var(--wot-sidebar-item-line-height, $typography-body-line--height-size-main) !default;
|
|
8
|
+
// 选项文字颜色
|
|
9
|
+
$sidebar-item-color: var(--wot-sidebar-item-color, $text-main) !default;
|
|
10
|
+
// 选项内边距
|
|
11
|
+
$sidebar-item-padding: var(--wot-sidebar-item-padding, $padding-extra-tight $padding-extra-loose) !default;
|
|
12
|
+
// 选项背景色
|
|
13
|
+
$sidebar-item-bg: var(--wot-sidebar-item-bg, $filled-bottom) !default;
|
|
14
|
+
// 选项最小高度
|
|
15
|
+
$sidebar-item-min-height: var(--wot-sidebar-item-min-height, $n-52) !default;
|
|
16
|
+
// 选项点击态背景色
|
|
17
|
+
$sidebar-item-bg-hover: var(--wot-sidebar-item-bg-hover, $feedback-active) !default;
|
|
18
|
+
// 激活项背景色
|
|
19
|
+
$sidebar-item-bg-active: var(--wot-sidebar-item-bg-active, $filled-oppo) !default;
|
|
20
|
+
// 激活项文字颜色
|
|
21
|
+
$sidebar-item-color-active: var(--wot-sidebar-item-color-active, $primary-6) !default;
|
|
22
|
+
// 激活项字重
|
|
23
|
+
$sidebar-item-font-weight-active: var(--wot-sidebar-item-font-weight-active, $font-weight-semibold) !default;
|
|
24
|
+
// 激活指示条宽度
|
|
25
|
+
$sidebar-item-indicator-width: var(--wot-sidebar-item-indicator-width, $n-2) !default;
|
|
26
|
+
// 激活指示条高度
|
|
27
|
+
$sidebar-item-indicator-height: var(--wot-sidebar-item-indicator-height, $n-20) !default;
|
|
28
|
+
// 圆角大小
|
|
29
|
+
$sidebar-item-border-radius: var(--wot-sidebar-item-border-radius, $radius-large) !default;
|
|
30
|
+
// 禁用状态文字颜色
|
|
31
|
+
$sidebar-item-color-disabled: var(--wot-sidebar-item-color-disabled, $text-disabled) !default;
|
|
32
|
+
// 图标大小
|
|
33
|
+
$sidebar-item-icon-size: var(--wot-sidebar-item-icon-size, $n-20) !default;
|
|
34
|
+
// 图标右边距
|
|
35
|
+
$sidebar-item-icon-margin-right: var(--wot-sidebar-item-icon-margin-right, $padding-ultra-tight) !default;
|
|
36
|
+
|
|
37
|
+
@include b(sidebar-item) {
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
position: relative;
|
|
42
|
+
padding: $sidebar-item-padding;
|
|
43
|
+
font-size: $sidebar-item-font-size;
|
|
44
|
+
color: $sidebar-item-color;
|
|
45
|
+
background: $sidebar-item-bg;
|
|
46
|
+
min-height: $sidebar-item-min-height;
|
|
47
|
+
box-sizing: border-box;
|
|
48
|
+
white-space: wrap;
|
|
49
|
+
line-height: $sidebar-item-line-height;
|
|
50
|
+
|
|
51
|
+
@include m(active) {
|
|
52
|
+
font-weight: $sidebar-item-font-weight-active;
|
|
53
|
+
background: $sidebar-item-bg-active;
|
|
54
|
+
color: $sidebar-item-color-active;
|
|
55
|
+
|
|
56
|
+
&::before {
|
|
57
|
+
position: absolute;
|
|
58
|
+
top: 50%;
|
|
59
|
+
left: 0;
|
|
60
|
+
width: $sidebar-item-indicator-width;
|
|
61
|
+
height: $sidebar-item-indicator-height;
|
|
62
|
+
background: $sidebar-item-color-active;
|
|
63
|
+
transform: translateY(-50%);
|
|
64
|
+
content: '';
|
|
65
|
+
border-radius: $sidebar-item-indicator-width;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@include m(prefix) {
|
|
70
|
+
border-bottom-right-radius: $sidebar-item-border-radius;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@include m(suffix) {
|
|
74
|
+
border-top-right-radius: $sidebar-item-border-radius;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@include m(disabled) {
|
|
78
|
+
color: $sidebar-item-color-disabled;
|
|
79
|
+
cursor: not-allowed;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@include edeep(badge) {
|
|
83
|
+
z-index: 2;
|
|
84
|
+
word-break: break-all;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@include edeep(icon) {
|
|
88
|
+
font-size: $sidebar-item-icon-size;
|
|
89
|
+
margin-right: $sidebar-item-icon-margin-right;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ExtractPropTypes, Prop, PropType } from 'vue'
|
|
2
|
+
import { baseProps, makeBooleanProp, makeNumberProp, makeRequiredProp } from '../../common/props'
|
|
3
|
+
import type { BadgeProps } from '../wd-badge/types'
|
|
4
|
+
|
|
5
|
+
export const sidebarItemProps = {
|
|
6
|
+
...baseProps,
|
|
7
|
+
/** 当前选项标题 */
|
|
8
|
+
label: makeRequiredProp(String),
|
|
9
|
+
/** 当前选项的值,唯一标识 */
|
|
10
|
+
value: makeRequiredProp([Number, String]),
|
|
11
|
+
/** 徽标显示值 */
|
|
12
|
+
badge: [String, Number] as PropType<string | number>,
|
|
13
|
+
/** 徽标属性,透传给 Badge 组件 */
|
|
14
|
+
badgeProps: Object as PropType<Partial<BadgeProps>>,
|
|
15
|
+
/** 图标 */
|
|
16
|
+
icon: String,
|
|
17
|
+
/** 是否点状徽标 */
|
|
18
|
+
isDot: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: undefined
|
|
21
|
+
},
|
|
22
|
+
/** 徽标最大值 */
|
|
23
|
+
max: Number,
|
|
24
|
+
/** 是否禁用 */
|
|
25
|
+
disabled: makeBooleanProp(false)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type SidebarItemProps = ExtractPropTypes<typeof sidebarItemProps>
|