@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,198 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="wd-table-column">
|
|
3
|
+
<view v-for="config in cellConfigs" :key="config.rowIndex" :class="config.class" :style="config.style" @click="handleRowClick(config.rowIndex)">
|
|
4
|
+
<template v-if="config.visible">
|
|
5
|
+
<slot name="value" v-if="$slots.value" :row="getScope(config.rowIndex)" :index="config.rowIndex"></slot>
|
|
6
|
+
<text :class="['wd-table__value', { 'is-ellipsis': ellipsis }]" v-else>{{ config.value }}</text>
|
|
7
|
+
</template>
|
|
8
|
+
</view>
|
|
9
|
+
</view>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script lang="ts">
|
|
13
|
+
export default {
|
|
14
|
+
name: 'wd-table-column',
|
|
15
|
+
options: {
|
|
16
|
+
addGlobalClass: true,
|
|
17
|
+
virtualHost: true,
|
|
18
|
+
styleIsolation: 'shared'
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
</script>
|
|
22
|
+
<script lang="ts" setup>
|
|
23
|
+
import { type CSSProperties, computed, ref } from 'vue'
|
|
24
|
+
import { isDef, objToStyle, isOdd, isFunction } from '../../common/util'
|
|
25
|
+
import { tableColumnProps, type SortDirection } from './types'
|
|
26
|
+
import { useParent } from '../../composables/useParent'
|
|
27
|
+
import { TABLE_KEY } from '../wd-table/types'
|
|
28
|
+
import type { SpanMethodResult } from '../wd-table/types'
|
|
29
|
+
|
|
30
|
+
const props = defineProps(tableColumnProps)
|
|
31
|
+
|
|
32
|
+
const { parent: table, index: columnIndex } = useParent(TABLE_KEY)
|
|
33
|
+
|
|
34
|
+
/** 当前列的排序方向 */
|
|
35
|
+
const sortDirection = ref<SortDirection>(0)
|
|
36
|
+
|
|
37
|
+
/** 是否开启斑马纹(从父级 table 继承) */
|
|
38
|
+
const stripe = computed(() => {
|
|
39
|
+
return isDef(table.value) ? table.value.props.stripe : false
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
/** 是否显示边框(从父级 table 继承) */
|
|
43
|
+
const border = computed(() => {
|
|
44
|
+
return isDef(table.value) ? table.value.props.border : false
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
/** 是否超出省略(从父级 table 继承) */
|
|
48
|
+
const ellipsis = computed(() => {
|
|
49
|
+
return isDef(table.value) ? table.value.props.ellipsis : false
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
/** 当前列是否为最后一个固定列(用于显示右侧阴影) */
|
|
53
|
+
const isLastFixed = computed(() => {
|
|
54
|
+
if (props.fixed && isDef(table.value)) {
|
|
55
|
+
return table.value.getIsLastFixed(props)
|
|
56
|
+
}
|
|
57
|
+
return false
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 当前列的数据数组,从父级 table 的 data 中按 prop 提取
|
|
62
|
+
* @returns 当前列 prop 对应的数据值数组
|
|
63
|
+
*/
|
|
64
|
+
const column = computed(() => {
|
|
65
|
+
if (!isDef(table.value) || !isDef(table.value.props.data) || !Array.isArray(table.value.props.data)) {
|
|
66
|
+
return []
|
|
67
|
+
}
|
|
68
|
+
return table.value.props.data.map((item) => item[props.prop])
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* 固定列的 left 偏移值(缓存,避免每个单元格重复调用 getFixedLeft)
|
|
73
|
+
* @returns CSS left 值字符串,非固定列返回空字符串
|
|
74
|
+
*/
|
|
75
|
+
const fixedLeft = computed(() => {
|
|
76
|
+
if (props.fixed && isDef(table.value) && isFunction(table.value.getFixedLeft)) {
|
|
77
|
+
return table.value.getFixedLeft(columnIndex.value)
|
|
78
|
+
}
|
|
79
|
+
return ''
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* 是否为最后一列(用于去除外边框)
|
|
84
|
+
*/
|
|
85
|
+
const isLastColumn = computed(() => {
|
|
86
|
+
return isDef(table.value) ? columnIndex.value === table.value.children.length - 1 : false
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* 预计算可视区域单元格的 class、style、visible 配置
|
|
91
|
+
* 虚拟滚动时只生成 visibleRange 范围内的单元格
|
|
92
|
+
* @returns 每行单元格的渲染配置数组
|
|
93
|
+
*/
|
|
94
|
+
const cellConfigs = computed(() => {
|
|
95
|
+
const configs: Array<{ rowIndex: number; value: any; class: any; style: string; visible: boolean }> = []
|
|
96
|
+
const data = isDef(table.value) && Array.isArray(table.value.props.data) ? table.value.props.data : []
|
|
97
|
+
if (data.length === 0) return configs
|
|
98
|
+
|
|
99
|
+
const range = isDef(table.value) ? table.value.visibleRange.value : { start: 0, end: data.length - 1 }
|
|
100
|
+
const colIdx = columnIndex.value
|
|
101
|
+
const colStart = colIdx + 1
|
|
102
|
+
const hasScrollLeft = isDef(table.value) && table.value.state.scrollLeft
|
|
103
|
+
const isFixed = props.fixed
|
|
104
|
+
const isLast = isLastFixed.value
|
|
105
|
+
const isLastCol = isLastColumn.value
|
|
106
|
+
const left = fixedLeft.value
|
|
107
|
+
const align = props.align
|
|
108
|
+
const stripeVal = stripe.value
|
|
109
|
+
const borderVal = border.value
|
|
110
|
+
const propKey = props.prop
|
|
111
|
+
|
|
112
|
+
for (let rowIndex = range.start; rowIndex <= range.end; rowIndex++) {
|
|
113
|
+
const span = getSpanResult(rowIndex)
|
|
114
|
+
const hidden = span.rowspan === 0 || span.colspan === 0
|
|
115
|
+
|
|
116
|
+
const cls = [
|
|
117
|
+
'wd-table__cell',
|
|
118
|
+
{
|
|
119
|
+
'is-stripe': stripeVal && isOdd(rowIndex),
|
|
120
|
+
'is-border': borderVal,
|
|
121
|
+
'is-fixed': isFixed,
|
|
122
|
+
'is-shadow': isLast && hasScrollLeft,
|
|
123
|
+
'is-hidden': hidden,
|
|
124
|
+
'is-last': isLastCol
|
|
125
|
+
},
|
|
126
|
+
`is-${align}`
|
|
127
|
+
]
|
|
128
|
+
|
|
129
|
+
const style: CSSProperties = {}
|
|
130
|
+
if (hidden) {
|
|
131
|
+
style['display'] = 'none'
|
|
132
|
+
} else {
|
|
133
|
+
if (span.colspan > 1) {
|
|
134
|
+
style['grid-column'] = `${colStart} / span ${span.colspan}`
|
|
135
|
+
} else {
|
|
136
|
+
style['grid-column'] = `${colStart}`
|
|
137
|
+
}
|
|
138
|
+
const rowStart = rowIndex + 1
|
|
139
|
+
if (span.rowspan > 1) {
|
|
140
|
+
style['grid-row'] = `${rowStart} / span ${span.rowspan}`
|
|
141
|
+
} else {
|
|
142
|
+
style['grid-row'] = `${rowStart}`
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (isFixed && left) {
|
|
146
|
+
style['left'] = left
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
configs.push({
|
|
150
|
+
rowIndex,
|
|
151
|
+
value: data[rowIndex]?.[propKey],
|
|
152
|
+
class: cls,
|
|
153
|
+
style: objToStyle(style),
|
|
154
|
+
visible: !hidden
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
return configs
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* 获取指定行的单元格合并信息
|
|
162
|
+
* @param rowIndex - 行索引
|
|
163
|
+
* @returns 合并配置 { rowspan, colspan }
|
|
164
|
+
*/
|
|
165
|
+
function getSpanResult(rowIndex: number): SpanMethodResult {
|
|
166
|
+
if (!isDef(table.value) || !isFunction(table.value.getSpan)) {
|
|
167
|
+
return { rowspan: 1, colspan: 1 }
|
|
168
|
+
}
|
|
169
|
+
return table.value.getSpan(rowIndex, columnIndex.value)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* 处理单元格点击事件,转发给父级 table 的 rowClick
|
|
174
|
+
* @param index - 被点击行的索引
|
|
175
|
+
*/
|
|
176
|
+
function handleRowClick(index: number) {
|
|
177
|
+
if (!isDef(table.value)) return
|
|
178
|
+
isFunction(table.value.rowClick) && table.value.rowClick(index)
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* 获取指定行的完整数据对象,用于 #value 插槽的 row 参数
|
|
183
|
+
* @param index - 行索引
|
|
184
|
+
* @returns 该行的数据对象
|
|
185
|
+
*/
|
|
186
|
+
function getScope(index: number) {
|
|
187
|
+
if (!isDef(table.value) || !isDef(table.value.props.data) || !Array.isArray(table.value.props.data)) {
|
|
188
|
+
return {}
|
|
189
|
+
}
|
|
190
|
+
return table.value.props.data[index] || {}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
defineExpose({ sortDirection })
|
|
194
|
+
</script>
|
|
195
|
+
|
|
196
|
+
<style lang="scss">
|
|
197
|
+
@use './index.scss';
|
|
198
|
+
</style>
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
@use '../../styles/variable.scss'as *;
|
|
2
|
+
@use '../../styles/mixin/mixin.scss'as *;
|
|
3
|
+
|
|
4
|
+
// 导航背景色
|
|
5
|
+
$tabs-nav-bg: var(--wot-tabs-nav-bg, $filled-oppo) !default;
|
|
6
|
+
// 导航吸顶宽度
|
|
7
|
+
$tabs-nav-sticky-width: var(--wot-tabs-nav-sticky-width, 100vw) !default;
|
|
8
|
+
// 导航文字颜色
|
|
9
|
+
$tabs-nav-color: var(--wot-tabs-nav-color, $text-secondary) !default;
|
|
10
|
+
// 导航激活文字颜色
|
|
11
|
+
$tabs-nav-color-active: var(--wot-tabs-nav-color-active, $primary-6) !default;
|
|
12
|
+
// 导航激活文字字重
|
|
13
|
+
$tabs-nav-font-weight-active: var(--wot-tabs-nav-font-weight-active, $font-weight-medium) !default;
|
|
14
|
+
// 导航项字号
|
|
15
|
+
$tabs-nav-item-font-size: var(--wot-tabs-nav-item-font-size, $typography-body-size-extra-large) !default;
|
|
16
|
+
// 导航项行高
|
|
17
|
+
$tabs-nav-item-line-height: var(--wot-tabs-nav-item-line-height, $typography-body-line--height-size-extra-large) !default;
|
|
18
|
+
// 导航项内边距
|
|
19
|
+
$tabs-nav-item-padding: var(--wot-tabs-nav-item-padding, $padding-main $padding-extra-loose) !default;
|
|
20
|
+
// 导航禁用文字颜色
|
|
21
|
+
$tabs-nav-color-disabled: var(--wot-tabs-nav-color-disabled, $text-disabled) !default;
|
|
22
|
+
// 导航线背景色
|
|
23
|
+
$tabs-nav-line-bg: var(--wot-tabs-nav-line-bg, $primary-6) !default;
|
|
24
|
+
// 导航线高度
|
|
25
|
+
$tabs-nav-line-height: var(--wot-tabs-nav-line-height, $n-4) !default;
|
|
26
|
+
// 导航线宽度
|
|
27
|
+
$tabs-nav-line-width: var(--wot-tabs-nav-line-width, $n-24) !default;
|
|
28
|
+
// 导航线底部偏移
|
|
29
|
+
$tabs-nav-line-bottom: var(--wot-tabs-nav-line-bottom, $n-2) !default;
|
|
30
|
+
// 过渡时长
|
|
31
|
+
$tabs-duration: var(--wot-tabs-duration, 0.3s) !default;
|
|
32
|
+
// 地图模式遮罩背景
|
|
33
|
+
$tabs-map-modal-bg: var(--wot-tabs-map-modal-bg, $opac-7_55) !default;
|
|
34
|
+
// 地图模式箭头尺寸
|
|
35
|
+
$tabs-map-arrow-size: var(--wot-tabs-map-arrow-size, $n-16) !default;
|
|
36
|
+
// 地图模式箭头颜色
|
|
37
|
+
$tabs-map-arrow-color: var(--wot-tabs-map-arrow-color, $icon-secondary) !default;
|
|
38
|
+
// 地图模式按钮宽度
|
|
39
|
+
$tabs-map-btn-width: var(--wot-tabs-map-btn-width, $n-44) !default;
|
|
40
|
+
// 地图模式按钮高度
|
|
41
|
+
$tabs-map-btn-height: var(--wot-tabs-map-btn-height, $n-44) !default;
|
|
42
|
+
// 地图模式按钮前景渐变背景
|
|
43
|
+
$tabs-map-btn-before-bg: var(--wot-tabs-map-btn-before-bg, linear-gradient(270deg, $filled-oppo 0%, $base-transparent 100%)) !default;
|
|
44
|
+
// 地图模式通用文字颜色
|
|
45
|
+
$tabs-map-color: var(--wot-tabs-map-color, $text-main) !default;
|
|
46
|
+
// 地图模式头部字号
|
|
47
|
+
$tabs-map-header-font-size: var(--wot-tabs-map-header-font-size, $typography-body-size-extra-large) !default;
|
|
48
|
+
// 地图模式头部行高
|
|
49
|
+
$tabs-map-header-line-height: var(--wot-tabs-map-header-line-height, $typography-body-line--height-size-extra-large) !default;
|
|
50
|
+
// 地图模式头部内边距
|
|
51
|
+
$tabs-map-header-padding: var(--wot-tabs-map-header-padding, $padding-main $padding-extra-loose) !default;
|
|
52
|
+
// 地图模式导航按钮间距
|
|
53
|
+
$tabs-map-nav-btn-gap: var(--wot-tabs-map-nav-btn-gap, $spacing-main) !default;
|
|
54
|
+
// 地图模式导航按钮禁用透明度
|
|
55
|
+
$tabs-map-nav-btn-disabled-opacity: var(--wot-tabs-map-nav-btn-disabled-opacity, $opacity-disabled) !default;
|
|
56
|
+
// 地图模式导航按钮背景
|
|
57
|
+
$tabs-map-nav-btn-bg: var(--wot-tabs-map-nav-btn-bg, $filled-bottom) !default;
|
|
58
|
+
// 地图模式导航按钮文字颜色
|
|
59
|
+
$tabs-map-nav-btn-color: var(--wot-tabs-map-nav-btn-color, $text-main) !default;
|
|
60
|
+
// 地图模式导航按钮圆角
|
|
61
|
+
$tabs-map-nav-btn-radius: var(--wot-tabs-map-nav-btn-radius, $radius-main) !default;
|
|
62
|
+
// 地图模式导航按钮字号
|
|
63
|
+
$tabs-map-nav-btn-font-size: var(--wot-tabs-map-nav-btn-font-size, $typography-body-size-ultra-large) !default;
|
|
64
|
+
// 地图模式导航按钮行高
|
|
65
|
+
$tabs-map-nav-btn-line-height: var(--wot-tabs-map-nav-btn-line-height, $typography-body-line--height-size-ultra-large) !default;
|
|
66
|
+
// 地图模式导航按钮内边距
|
|
67
|
+
$tabs-map-nav-btn-padding: var(--wot-tabs-map-nav-btn-padding, $padding-tight $padding-extra-loose) !default;
|
|
68
|
+
// 地图模式内容内边距
|
|
69
|
+
$tabs-map-body-padding: var(--wot-tabs-map-body-padding, $padding-loose $padding-extra-loose) !default;
|
|
70
|
+
// 地图模式内容背景色
|
|
71
|
+
$tabs-map-body-bg: var(--wot-tabs-map-body-bg, $filled-oppo) !default;
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@include b(tabs) {
|
|
75
|
+
position: relative;
|
|
76
|
+
background: $tabs-nav-bg;
|
|
77
|
+
width: 100%;
|
|
78
|
+
|
|
79
|
+
@include when(hide-scrollbar) {
|
|
80
|
+
::-webkit-scrollbar {
|
|
81
|
+
width: 0;
|
|
82
|
+
height: 0;
|
|
83
|
+
-webkit-appearance: none;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@include e(nav) {
|
|
88
|
+
position: relative;
|
|
89
|
+
left: 0;
|
|
90
|
+
right: 0;
|
|
91
|
+
width: 100%;
|
|
92
|
+
background: $tabs-nav-bg;
|
|
93
|
+
|
|
94
|
+
@include m(wrap) {
|
|
95
|
+
height: 100%;
|
|
96
|
+
overflow: hidden;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@include m(sticky) {
|
|
100
|
+
width: $tabs-nav-sticky-width;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@include e(nav-container) {
|
|
105
|
+
position: relative;
|
|
106
|
+
display: flex;
|
|
107
|
+
user-select: none;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@include e(nav-item) {
|
|
111
|
+
position: relative;
|
|
112
|
+
display: flex;
|
|
113
|
+
align-items: center;
|
|
114
|
+
justify-content: center;
|
|
115
|
+
flex: 1;
|
|
116
|
+
min-width: 0;
|
|
117
|
+
font-size: $tabs-nav-item-font-size;
|
|
118
|
+
line-height: $tabs-nav-item-line-height;
|
|
119
|
+
padding: $tabs-nav-item-padding;
|
|
120
|
+
color: $tabs-nav-color;
|
|
121
|
+
transition: color $tabs-duration;
|
|
122
|
+
|
|
123
|
+
@include when(active) {
|
|
124
|
+
font-weight: $tabs-nav-font-weight-active;
|
|
125
|
+
color: $tabs-nav-color-active;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@include when(disabled) {
|
|
129
|
+
color: $tabs-nav-color-disabled;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@include e(nav-item-text) {
|
|
134
|
+
@include lineEllipsis();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@include edeep(nav-item-badge) {
|
|
138
|
+
display: flex;
|
|
139
|
+
align-items: center;
|
|
140
|
+
justify-content: center;
|
|
141
|
+
max-width: 100%;
|
|
142
|
+
min-width: 0;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@include e(line) {
|
|
146
|
+
position: absolute;
|
|
147
|
+
bottom: $tabs-nav-line-bottom;
|
|
148
|
+
left: 0;
|
|
149
|
+
z-index: 1;
|
|
150
|
+
height: $tabs-nav-line-height;
|
|
151
|
+
background: $tabs-nav-line-bg;
|
|
152
|
+
border-radius: calc($tabs-nav-line-height / 2);
|
|
153
|
+
|
|
154
|
+
@include m(inner) {
|
|
155
|
+
left: 50%;
|
|
156
|
+
transform: translateX(-50%)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@include when(normal) {
|
|
160
|
+
width: $tabs-nav-line-width;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
@include when(underline) {
|
|
164
|
+
bottom: 0;
|
|
165
|
+
height: $n-2;
|
|
166
|
+
border-radius: $radius-zero;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
@include when(dot) {
|
|
170
|
+
bottom: 0;
|
|
171
|
+
width: $n-6;
|
|
172
|
+
height: $n-6;
|
|
173
|
+
border-radius: $radius-radius-full;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
@include e(container) {
|
|
178
|
+
overflow: hidden;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
@include e(body) {
|
|
182
|
+
position: relative;
|
|
183
|
+
width: 100%;
|
|
184
|
+
height: 100%;
|
|
185
|
+
|
|
186
|
+
@include when(animated) {
|
|
187
|
+
display: flex;
|
|
188
|
+
transition-property: left;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
@include e(map) {
|
|
193
|
+
position: absolute;
|
|
194
|
+
top: 0;
|
|
195
|
+
left: 0;
|
|
196
|
+
right: 0;
|
|
197
|
+
z-index: 1;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
@include e(map-header) {
|
|
201
|
+
position: relative;
|
|
202
|
+
font-size: $tabs-map-header-font-size;
|
|
203
|
+
line-height: $tabs-map-header-line-height;
|
|
204
|
+
padding: $tabs-map-header-padding;
|
|
205
|
+
color: $tabs-map-color;
|
|
206
|
+
transition: opacity $tabs-duration;
|
|
207
|
+
background: $tabs-nav-bg;
|
|
208
|
+
opacity: 0;
|
|
209
|
+
|
|
210
|
+
&::after {
|
|
211
|
+
z-index: 3;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
@include e(map-body) {
|
|
216
|
+
display: flex;
|
|
217
|
+
flex-wrap: wrap;
|
|
218
|
+
padding: $tabs-map-body-padding;
|
|
219
|
+
background: $tabs-map-body-bg;
|
|
220
|
+
transition: transform $tabs-duration;
|
|
221
|
+
transform: scaleY(0);
|
|
222
|
+
transform-origin: center top;
|
|
223
|
+
|
|
224
|
+
@include when(open) {
|
|
225
|
+
transform: scaleY(1);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
@include e(map-btn) {
|
|
230
|
+
position: absolute;
|
|
231
|
+
right: 0;
|
|
232
|
+
top: 0;
|
|
233
|
+
display: flex;
|
|
234
|
+
align-items: center;
|
|
235
|
+
justify-content: center;
|
|
236
|
+
z-index: 1;
|
|
237
|
+
background: $tabs-nav-bg;
|
|
238
|
+
-webkit-tap-highlight-color: transparent;
|
|
239
|
+
width: $tabs-map-btn-width;
|
|
240
|
+
height: $tabs-map-btn-height;
|
|
241
|
+
|
|
242
|
+
&::before {
|
|
243
|
+
position: absolute;
|
|
244
|
+
content: '';
|
|
245
|
+
top: 0;
|
|
246
|
+
left: 0;
|
|
247
|
+
width: $n-24;
|
|
248
|
+
transform: translateX(-100%);
|
|
249
|
+
height: 100%;
|
|
250
|
+
background: $tabs-map-btn-before-bg;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
@include e(map-arrow) {
|
|
255
|
+
display: block;
|
|
256
|
+
transition: transform $tabs-duration;
|
|
257
|
+
|
|
258
|
+
@include when(open) {
|
|
259
|
+
transform: rotate(180deg);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
@include edeep(map-arrow-icon) {
|
|
264
|
+
font-size: $tabs-map-arrow-size;
|
|
265
|
+
color: $tabs-map-arrow-color;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
@include e(map-nav-item) {
|
|
270
|
+
flex-basis: calc((100% - 2 * $tabs-map-nav-btn-gap) / 3);
|
|
271
|
+
box-sizing: border-box;
|
|
272
|
+
margin-right: $tabs-map-nav-btn-gap;
|
|
273
|
+
margin-bottom: $tabs-map-nav-btn-gap;
|
|
274
|
+
|
|
275
|
+
&:nth-child(3n) {
|
|
276
|
+
margin-right: 0;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
&:nth-last-child(-n + 3) {
|
|
280
|
+
margin-bottom: 0;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
@include e(map-nav-btn) {
|
|
285
|
+
@include buttonClear;
|
|
286
|
+
@include lineEllipsis;
|
|
287
|
+
box-sizing: border-box;
|
|
288
|
+
background: $tabs-map-nav-btn-bg;
|
|
289
|
+
width: 100%;
|
|
290
|
+
border: $n-1 solid transparent;
|
|
291
|
+
font-size: $tabs-map-nav-btn-font-size;
|
|
292
|
+
line-height: $tabs-map-nav-btn-line-height;
|
|
293
|
+
border-radius: $tabs-map-nav-btn-radius;
|
|
294
|
+
color: $tabs-map-nav-btn-color;
|
|
295
|
+
padding: $tabs-map-nav-btn-padding;
|
|
296
|
+
text-align: center;
|
|
297
|
+
transition: color $tabs-duration, border-color $tabs-duration;
|
|
298
|
+
|
|
299
|
+
@include when(active) {
|
|
300
|
+
color: $tabs-nav-color-active;
|
|
301
|
+
border-color: $tabs-nav-color-active;
|
|
302
|
+
background: $tabs-nav-bg
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
@include when(disabled) {
|
|
306
|
+
opacity: $tabs-map-nav-btn-disabled-opacity;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
@include e(mask) {
|
|
311
|
+
position: absolute;
|
|
312
|
+
top: calc(2 * $padding-main + $tabs-map-header-line-height);
|
|
313
|
+
left: 0;
|
|
314
|
+
right: 0;
|
|
315
|
+
bottom: 0;
|
|
316
|
+
background: $tabs-map-modal-bg;
|
|
317
|
+
opacity: 0;
|
|
318
|
+
transition: opacity $tabs-duration;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
@include when(slide) {
|
|
322
|
+
.wd-tabs__nav-item {
|
|
323
|
+
flex: 0 0 auto;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
@include when(map) {
|
|
328
|
+
.wd-tabs__nav--wrap {
|
|
329
|
+
padding-right: $tabs-map-btn-width;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { type ComponentPublicInstance, type ExtractPropTypes, type InjectionKey } from 'vue'
|
|
2
|
+
import { baseProps, makeBooleanProp, makeNumberProp, makeNumericProp, makeStringProp, numericProp } from '../../common/props'
|
|
3
|
+
|
|
4
|
+
export type TabsProvide = {
|
|
5
|
+
state: {
|
|
6
|
+
/** 当前激活的 tab 索引 */
|
|
7
|
+
activeIndex: number
|
|
8
|
+
/** 激活项边框线样式 */
|
|
9
|
+
lineStyle: string
|
|
10
|
+
/** 组件是否已初始化 */
|
|
11
|
+
inited: boolean
|
|
12
|
+
/** 是否正在进行切换动画 */
|
|
13
|
+
animating: boolean
|
|
14
|
+
/** 导航地图是否显示 */
|
|
15
|
+
mapShow: boolean
|
|
16
|
+
/** 滚动条位置 */
|
|
17
|
+
scrollLeft: number
|
|
18
|
+
}
|
|
19
|
+
props: Partial<TabsProps>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type TabsSlidable = 'auto' | 'always'
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 底部条位置样式
|
|
26
|
+
* normal: 默认宽度,不设置 lineWidth 时 宽度为 24px
|
|
27
|
+
* text: 宽度跟随文字,不设置 lineWidth 时 宽度等于文字宽度
|
|
28
|
+
* underline: 下划线,宽度等于 tab 宽度
|
|
29
|
+
* dot: 点状,宽度等于 6px
|
|
30
|
+
*/
|
|
31
|
+
export type TabsLineTheme = 'normal' | 'text' | 'underline' | 'dot'
|
|
32
|
+
|
|
33
|
+
export const TABS_KEY: InjectionKey<TabsProvide> = Symbol('wd-tabs')
|
|
34
|
+
|
|
35
|
+
export const tabsProps = {
|
|
36
|
+
...baseProps,
|
|
37
|
+
/**
|
|
38
|
+
* 绑定值,选中选项卡的 name
|
|
39
|
+
* 类型: number | string
|
|
40
|
+
* 默认值: 0
|
|
41
|
+
*/
|
|
42
|
+
modelValue: makeNumericProp(0),
|
|
43
|
+
/**
|
|
44
|
+
* 标签数超过阈值可滑动
|
|
45
|
+
* 类型: number
|
|
46
|
+
* 默认值: 6
|
|
47
|
+
*/
|
|
48
|
+
slidableNum: makeNumberProp(6),
|
|
49
|
+
/**
|
|
50
|
+
* 标签数超过阈值显示导航地图
|
|
51
|
+
* 类型: number
|
|
52
|
+
* 默认值: 10
|
|
53
|
+
*/
|
|
54
|
+
mapNum: makeNumberProp(10),
|
|
55
|
+
/**
|
|
56
|
+
* 导航地图的标题
|
|
57
|
+
* 类型: string
|
|
58
|
+
*/
|
|
59
|
+
mapTitle: String,
|
|
60
|
+
/**
|
|
61
|
+
* 粘性布局
|
|
62
|
+
* 类型: boolean
|
|
63
|
+
* 默认值: false
|
|
64
|
+
*/
|
|
65
|
+
sticky: makeBooleanProp(false),
|
|
66
|
+
/**
|
|
67
|
+
* 粘性布局吸顶位置
|
|
68
|
+
* 类型: number
|
|
69
|
+
* 默认值: 0
|
|
70
|
+
*/
|
|
71
|
+
offsetTop: makeNumberProp(0),
|
|
72
|
+
/**
|
|
73
|
+
* 开启手势滑动
|
|
74
|
+
* 类型: boolean
|
|
75
|
+
* 默认值: false
|
|
76
|
+
*/
|
|
77
|
+
swipeable: makeBooleanProp(false),
|
|
78
|
+
/**
|
|
79
|
+
* 底部条位置样式
|
|
80
|
+
* 类型: string
|
|
81
|
+
* 可选值: 'normal' | 'text' | 'underline' | 'dot'
|
|
82
|
+
* 默认值: 'normal'
|
|
83
|
+
*/
|
|
84
|
+
lineTheme: makeStringProp<TabsLineTheme>('normal'),
|
|
85
|
+
/**
|
|
86
|
+
* 底部条宽度,单位像素
|
|
87
|
+
* 类型: number | string
|
|
88
|
+
*/
|
|
89
|
+
lineWidth: numericProp,
|
|
90
|
+
/**
|
|
91
|
+
* 底部条高度,单位像素
|
|
92
|
+
* 类型: number | string
|
|
93
|
+
*/
|
|
94
|
+
lineHeight: numericProp,
|
|
95
|
+
/**
|
|
96
|
+
* 颜色
|
|
97
|
+
* 类型: string
|
|
98
|
+
* 默认值: ''
|
|
99
|
+
*/
|
|
100
|
+
color: makeStringProp(''),
|
|
101
|
+
/**
|
|
102
|
+
* 非活动状态颜色
|
|
103
|
+
* 类型: string
|
|
104
|
+
* 默认值: ''
|
|
105
|
+
*/
|
|
106
|
+
inactiveColor: makeStringProp(''),
|
|
107
|
+
/**
|
|
108
|
+
* 是否开启切换标签内容时的过渡动画
|
|
109
|
+
* 类型: boolean
|
|
110
|
+
* 默认值: false
|
|
111
|
+
*/
|
|
112
|
+
animated: makeBooleanProp(false),
|
|
113
|
+
/**
|
|
114
|
+
* 切换动画过渡时间,单位毫秒
|
|
115
|
+
* 类型: number
|
|
116
|
+
* 默认值: 300
|
|
117
|
+
*/
|
|
118
|
+
duration: makeNumberProp(300),
|
|
119
|
+
/**
|
|
120
|
+
* 是否开启滚动导航
|
|
121
|
+
* 类型: string
|
|
122
|
+
* 可选值:'auto' | 'always'
|
|
123
|
+
* 默认值: 'auto'
|
|
124
|
+
*/
|
|
125
|
+
slidable: makeStringProp<TabsSlidable>('auto'),
|
|
126
|
+
/**
|
|
127
|
+
* 标签可滑动时是否显示滚动条
|
|
128
|
+
* 类型: boolean
|
|
129
|
+
* 默认值: false
|
|
130
|
+
*/
|
|
131
|
+
showScrollbar: makeBooleanProp(false)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export type TabsExpose = {
|
|
135
|
+
/**
|
|
136
|
+
* 设置激活项
|
|
137
|
+
* @param {number | string} value 激活值
|
|
138
|
+
* @param {boolean} init 是否已初始化
|
|
139
|
+
* @param {boolean} setScroll 是否设置scroll-view滚动
|
|
140
|
+
*/
|
|
141
|
+
setActive: (value: number | string, init: boolean, setScroll: boolean) => void
|
|
142
|
+
/**
|
|
143
|
+
* 使选中项滚动到可视区域
|
|
144
|
+
*/
|
|
145
|
+
scrollIntoView: () => void
|
|
146
|
+
/**
|
|
147
|
+
* 更新激活项边框线样式
|
|
148
|
+
* @param {boolean} animation 是否开启动画,默认开启
|
|
149
|
+
*/
|
|
150
|
+
updateLineStyle: (animation?: boolean) => void
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export type TabsProps = ExtractPropTypes<typeof tabsProps>
|
|
154
|
+
|
|
155
|
+
export type TabsInstance = ComponentPublicInstance<TabsProps, TabsExpose>
|