@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,325 @@
|
|
|
1
|
+
@use "sass:map";
|
|
2
|
+
@use '../../styles/variable.scss' as *;
|
|
3
|
+
@use '../../styles/mixin/mixin.scss' as *;
|
|
4
|
+
|
|
5
|
+
// 基础文字颜色
|
|
6
|
+
$tag-color: var(--wot-tag-color, $text-white) !default;
|
|
7
|
+
// 基础字号
|
|
8
|
+
$tag-font-size: var(--wot-tag-font-size, $typography-label-size-main) !default;
|
|
9
|
+
// 默认圆角
|
|
10
|
+
$tag-radius: var(--wot-tag-radius, $radius-small) !default;
|
|
11
|
+
// 圆角标签圆角
|
|
12
|
+
$tag-round-radius: var(--wot-tag-round-radius, $radius-radius-full) !default;
|
|
13
|
+
// 标记标签圆角
|
|
14
|
+
$tag-mark-radius: var(--wot-tag-mark-radius, $radius-large $radius-main) !default;
|
|
15
|
+
// 图标间距
|
|
16
|
+
$tag-icon-spacing: var(--wot-tag-icon-spacing, $spacing-ultra-tight) !default;
|
|
17
|
+
// 输入态宽度
|
|
18
|
+
$tag-input-width: var(--wot-tag-input-width, $n-64) !default;
|
|
19
|
+
// 主色浅色背景
|
|
20
|
+
$tag-primary-light-bg: var(--wot-tag-primary-light-bg, $primary-1) !default;
|
|
21
|
+
// 主色背景
|
|
22
|
+
$tag-primary-bg: var(--wot-tag-primary-bg, $primary-6) !default;
|
|
23
|
+
// 主色文字颜色
|
|
24
|
+
$tag-primary-color: var(--wot-tag-primary-color, $primary-6) !default;
|
|
25
|
+
// 成功色背景
|
|
26
|
+
$tag-success-bg: var(--wot-tag-success-bg, $success-main) !default;
|
|
27
|
+
// 成功色浅色背景
|
|
28
|
+
$tag-success-light-bg: var(--wot-tag-success-light-bg, $success-surface) !default;
|
|
29
|
+
// 成功色文字颜色
|
|
30
|
+
$tag-success-color: var(--wot-tag-success-color, $success-main) !default;
|
|
31
|
+
// 警告色背景
|
|
32
|
+
$tag-warning-bg: var(--wot-tag-warning-bg, $warning-main) !default;
|
|
33
|
+
// 警告色浅色背景
|
|
34
|
+
$tag-warning-light-bg: var(--wot-tag-warning-light-bg, $warning-surface) !default;
|
|
35
|
+
// 警告色文字颜色
|
|
36
|
+
$tag-warning-color: var(--wot-tag-warning-color, $warning-main) !default;
|
|
37
|
+
// 危险色背景
|
|
38
|
+
$tag-danger-bg: var(--wot-tag-danger-bg, $danger-main) !default;
|
|
39
|
+
// 危险色浅色背景
|
|
40
|
+
$tag-danger-light-bg: var(--wot-tag-danger-light-bg, $danger-surface) !default;
|
|
41
|
+
// 危险色文字颜色
|
|
42
|
+
$tag-danger-color: var(--wot-tag-danger-color, $danger-main) !default;
|
|
43
|
+
// 橘火色背景
|
|
44
|
+
$tag-volcano-bg: var(--wot-tag-volcano-bg, $volcano-6) !default;
|
|
45
|
+
// 橘火色浅色背景
|
|
46
|
+
$tag-volcano-light-bg: var(--wot-tag-volcano-light-bg, $volcano-1) !default;
|
|
47
|
+
// 橘火色文字颜色
|
|
48
|
+
$tag-volcano-color: var(--wot-tag-volcano-color, $volcano-6) !default;
|
|
49
|
+
// 默认信息色背景
|
|
50
|
+
$tag-info-bg: var(--wot-tag-info-bg, $text-auxiliary) !default;
|
|
51
|
+
// 默认信息色浅色背景
|
|
52
|
+
$tag-info-light-bg: var(--wot-tag-info-light-bg, $filled-content) !default;
|
|
53
|
+
// 默认信息色文字颜色
|
|
54
|
+
$tag-info-color: var(--wot-tag-info-color, $text-secondary) !default;
|
|
55
|
+
// 亮蓝色背景
|
|
56
|
+
$tag-lightblue-bg: var(--wot-tag-lightblue-bg, $lightblue-6) !default;
|
|
57
|
+
// 亮蓝色浅色背景
|
|
58
|
+
$tag-lightblue-light-bg: var(--wot-tag-lightblue-light-bg, $lightblue-1) !default;
|
|
59
|
+
// 亮蓝色文字颜色
|
|
60
|
+
$tag-lightblue-color: var(--wot-tag-lightblue-color, $lightblue-6) !default;
|
|
61
|
+
// 青色背景
|
|
62
|
+
$tag-cyan-bg: var(--wot-tag-cyan-bg, $cyan-6) !default;
|
|
63
|
+
// 青色浅色背景
|
|
64
|
+
$tag-cyan-light-bg: var(--wot-tag-cyan-light-bg, $cyan-1) !default;
|
|
65
|
+
// 青色文字颜色
|
|
66
|
+
$tag-cyan-color: var(--wot-tag-cyan-color, $cyan-6) !default;
|
|
67
|
+
// 粉色背景
|
|
68
|
+
$tag-pink-bg: var(--wot-tag-pink-bg, $pink-6) !default;
|
|
69
|
+
// 粉色浅色背景
|
|
70
|
+
$tag-pink-light-bg: var(--wot-tag-pink-light-bg, $pink-1) !default;
|
|
71
|
+
// 粉色文字颜色
|
|
72
|
+
$tag-pink-color: var(--wot-tag-pink-color, $pink-6) !default;
|
|
73
|
+
// 紫色背景
|
|
74
|
+
$tag-purple-bg: var(--wot-tag-purple-bg, $purple-6) !default;
|
|
75
|
+
// 紫色浅色背景
|
|
76
|
+
$tag-purple-light-bg: var(--wot-tag-purple-light-bg, $purple-1) !default;
|
|
77
|
+
// 紫色文字颜色
|
|
78
|
+
$tag-purple-color: var(--wot-tag-purple-color, $purple-6) !default;
|
|
79
|
+
// 小尺寸字号
|
|
80
|
+
$tag-small-font-size: var(--wot-tag-small-font-size, $typography-label-size-small) !default;
|
|
81
|
+
// 小尺寸行高
|
|
82
|
+
$tag-small-line-height: var(--wot-tag-small-line-height, $typography-label-line--height-size-small) !default;
|
|
83
|
+
// 小尺寸内边距
|
|
84
|
+
$tag-small-padding: var(--wot-tag-small-padding, $padding-zero $padding-super-tight) !default;
|
|
85
|
+
// 小尺寸圆角态内边距
|
|
86
|
+
$tag-small-round-padding: var(--wot-tag-small-round-padding, $padding-zero $padding-tight) !default;
|
|
87
|
+
// 小尺寸图标尺寸
|
|
88
|
+
$tag-small-icon-size: var(--wot-tag-small-icon-size, $n-10) !default;
|
|
89
|
+
// 中尺寸字号
|
|
90
|
+
$tag-medium-font-size: var(--wot-tag-medium-font-size, $typography-label-size-main) !default;
|
|
91
|
+
// 中尺寸行高
|
|
92
|
+
$tag-medium-line-height: var(--wot-tag-medium-line-height, $typography-label-line--height-size-main) !default;
|
|
93
|
+
// 中尺寸内边距
|
|
94
|
+
$tag-medium-padding: var(--wot-tag-medium-padding, $n-1 $padding-super-tight) !default;
|
|
95
|
+
// 中尺寸圆角态内边距
|
|
96
|
+
$tag-medium-round-padding: var(--wot-tag-medium-round-padding, $n-1 $padding-tight) !default;
|
|
97
|
+
// 中尺寸图标尺寸
|
|
98
|
+
$tag-medium-icon-size: var(--wot-tag-medium-icon-size, $n-10) !default;
|
|
99
|
+
// 默认尺寸字号
|
|
100
|
+
$tag-default-font-size: var(--wot-tag-default-font-size, $typography-label-size-main) !default;
|
|
101
|
+
// 默认尺寸行高
|
|
102
|
+
$tag-default-line-height: var(--wot-tag-default-line-height, $typography-label-line--height-size-main) !default;
|
|
103
|
+
// 默认尺寸内边距
|
|
104
|
+
$tag-default-padding: var(--wot-tag-default-padding, $n-3 $padding-extra-tight) !default;
|
|
105
|
+
// 默认尺寸圆角态内边距
|
|
106
|
+
$tag-default-round-padding: var(--wot-tag-default-round-padding, $n-3 $padding-loose) !default;
|
|
107
|
+
// 默认尺寸图标尺寸
|
|
108
|
+
$tag-default-icon-size: var(--wot-tag-default-icon-size, $n-12) !default;
|
|
109
|
+
// 大尺寸字号
|
|
110
|
+
$tag-large-font-size: var(--wot-tag-large-font-size, $typography-label-size-large) !default;
|
|
111
|
+
// 大尺寸行高
|
|
112
|
+
$tag-large-line-height: var(--wot-tag-large-line-height, $typography-label-line--height-size-large) !default;
|
|
113
|
+
// 大尺寸内边距
|
|
114
|
+
$tag-large-padding: var(--wot-tag-large-padding, $n-3 $padding-extra-tight) !default;
|
|
115
|
+
// 大尺寸圆角态内边距
|
|
116
|
+
$tag-large-round-padding: var(--wot-tag-large-round-padding, $n-3 $padding-loose) !default;
|
|
117
|
+
// 大尺寸图标尺寸
|
|
118
|
+
$tag-large-icon-size: var(--wot-tag-large-icon-size, $n-12) !default;
|
|
119
|
+
// 超大尺寸字号
|
|
120
|
+
$tag-extra-large-font-size: var(--wot-tag-extra-large-font-size, $typography-body-size-main) !default;
|
|
121
|
+
// 超大尺寸行高
|
|
122
|
+
$tag-extra-large-line-height: var(--wot-tag-extra-large-line-height, $typography-body-line--height-size-main) !default;
|
|
123
|
+
// 超大尺寸内边距
|
|
124
|
+
$tag-extra-large-padding: var(--wot-tag-extra-large-padding, $n-3 $padding-extra-tight) !default;
|
|
125
|
+
// 超大尺寸圆角态内边距
|
|
126
|
+
$tag-extra-large-round-padding: var(--wot-tag-extra-large-round-padding, $n-3 $padding-loose) !default;
|
|
127
|
+
// 超大尺寸图标尺寸
|
|
128
|
+
$tag-extra-large-icon-size: var(--wot-tag-extra-large-icon-size, $n-12) !default;
|
|
129
|
+
|
|
130
|
+
$tag-types: (
|
|
131
|
+
"default": (
|
|
132
|
+
"color": $tag-info-color,
|
|
133
|
+
"bg": $tag-info-bg,
|
|
134
|
+
"light-bg": $tag-info-light-bg
|
|
135
|
+
),
|
|
136
|
+
"primary": (
|
|
137
|
+
"color": $tag-primary-color,
|
|
138
|
+
"bg": $tag-primary-bg,
|
|
139
|
+
"light-bg": $tag-primary-light-bg
|
|
140
|
+
),
|
|
141
|
+
"success": (
|
|
142
|
+
"color": $tag-success-color,
|
|
143
|
+
"bg": $tag-success-bg,
|
|
144
|
+
"light-bg": $tag-success-light-bg
|
|
145
|
+
),
|
|
146
|
+
"danger": (
|
|
147
|
+
"color": $tag-danger-color,
|
|
148
|
+
"bg": $tag-danger-bg,
|
|
149
|
+
"light-bg": $tag-danger-light-bg
|
|
150
|
+
),
|
|
151
|
+
"warning": (
|
|
152
|
+
"color": $tag-warning-color,
|
|
153
|
+
"bg": $tag-warning-bg,
|
|
154
|
+
"light-bg": $tag-warning-light-bg
|
|
155
|
+
),
|
|
156
|
+
"volcano": (
|
|
157
|
+
"color": $tag-volcano-color,
|
|
158
|
+
"bg": $tag-volcano-bg,
|
|
159
|
+
"light-bg": $tag-volcano-light-bg
|
|
160
|
+
),
|
|
161
|
+
"lightblue": (
|
|
162
|
+
"color": $tag-lightblue-color,
|
|
163
|
+
"bg": $tag-lightblue-bg,
|
|
164
|
+
"light-bg": $tag-lightblue-light-bg
|
|
165
|
+
),
|
|
166
|
+
"cyan": (
|
|
167
|
+
"color": $tag-cyan-color,
|
|
168
|
+
"bg": $tag-cyan-bg,
|
|
169
|
+
"light-bg": $tag-cyan-light-bg
|
|
170
|
+
),
|
|
171
|
+
"pink": (
|
|
172
|
+
"color": $tag-pink-color,
|
|
173
|
+
"bg": $tag-pink-bg,
|
|
174
|
+
"light-bg": $tag-pink-light-bg
|
|
175
|
+
),
|
|
176
|
+
"purple": (
|
|
177
|
+
"color": $tag-purple-color,
|
|
178
|
+
"bg": $tag-purple-bg,
|
|
179
|
+
"light-bg": $tag-purple-light-bg
|
|
180
|
+
)
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
$tag-sizes: (
|
|
184
|
+
"small": (
|
|
185
|
+
"font-size": $tag-small-font-size,
|
|
186
|
+
"line-height": $tag-small-line-height,
|
|
187
|
+
"padding": $tag-small-padding,
|
|
188
|
+
"round-padding": $tag-small-round-padding,
|
|
189
|
+
"icon-size": $tag-small-icon-size
|
|
190
|
+
),
|
|
191
|
+
"medium": (
|
|
192
|
+
"font-size": $tag-medium-font-size,
|
|
193
|
+
"line-height": $tag-medium-line-height,
|
|
194
|
+
"padding": $tag-medium-padding,
|
|
195
|
+
"round-padding": $tag-medium-round-padding,
|
|
196
|
+
"icon-size": $tag-medium-icon-size
|
|
197
|
+
),
|
|
198
|
+
"default": (
|
|
199
|
+
"font-size": $tag-default-font-size,
|
|
200
|
+
"line-height": $tag-default-line-height,
|
|
201
|
+
"padding": $tag-default-padding,
|
|
202
|
+
"round-padding": $tag-default-round-padding,
|
|
203
|
+
"icon-size": $tag-default-icon-size
|
|
204
|
+
),
|
|
205
|
+
"large": (
|
|
206
|
+
"font-size": $tag-large-font-size,
|
|
207
|
+
"line-height": $tag-large-line-height,
|
|
208
|
+
"padding": $tag-large-padding,
|
|
209
|
+
"round-padding": $tag-large-round-padding,
|
|
210
|
+
"icon-size": $tag-large-icon-size
|
|
211
|
+
),
|
|
212
|
+
"extra-large": (
|
|
213
|
+
"font-size": $tag-extra-large-font-size,
|
|
214
|
+
"line-height": $tag-extra-large-line-height,
|
|
215
|
+
"padding": $tag-extra-large-padding,
|
|
216
|
+
"round-padding": $tag-extra-large-round-padding,
|
|
217
|
+
"icon-size": $tag-extra-large-icon-size
|
|
218
|
+
)
|
|
219
|
+
);
|
|
220
|
+
|
|
221
|
+
@include b(tag) {
|
|
222
|
+
display: inline-flex;
|
|
223
|
+
align-items: center;
|
|
224
|
+
color: $tag-color;
|
|
225
|
+
border-radius: $tag-radius;
|
|
226
|
+
|
|
227
|
+
@include e(input) {
|
|
228
|
+
width: $tag-input-width;
|
|
229
|
+
min-height: 0;
|
|
230
|
+
padding: 0;
|
|
231
|
+
margin: 0;
|
|
232
|
+
line-height: 1;
|
|
233
|
+
font-size: inherit;
|
|
234
|
+
background: transparent;
|
|
235
|
+
border: none;
|
|
236
|
+
outline: none;
|
|
237
|
+
color: inherit;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
@each $size, $conf in $tag-sizes {
|
|
241
|
+
@include when($size) {
|
|
242
|
+
font-size: map.get($conf, "font-size");
|
|
243
|
+
line-height: map.get($conf, "line-height");
|
|
244
|
+
padding: map.get($conf, "padding");
|
|
245
|
+
|
|
246
|
+
@include when(round) {
|
|
247
|
+
padding: map.get($conf, "round-padding");
|
|
248
|
+
}
|
|
249
|
+
@include edeep(icon,add,close-icon) {
|
|
250
|
+
font-size: map.get($conf, "icon-size");
|
|
251
|
+
color: currentColor;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
@include edeep(icon) {
|
|
255
|
+
margin-right: $tag-icon-spacing;
|
|
256
|
+
}
|
|
257
|
+
.wd-tag__input {
|
|
258
|
+
height: map.get($conf, "line-height");
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
@each $type, $conf in $tag-types {
|
|
264
|
+
@include when($type) {
|
|
265
|
+
$color: map.get($conf, "color");
|
|
266
|
+
$bg: map.get($conf, "bg");
|
|
267
|
+
$light-bg: map.get($conf, "light-bg");
|
|
268
|
+
|
|
269
|
+
@include when(light) {
|
|
270
|
+
background: $light-bg;
|
|
271
|
+
color: $color;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
@include when(dark) {
|
|
275
|
+
background: $bg;
|
|
276
|
+
color: $tag-color;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
@include when(plain) {
|
|
280
|
+
background: transparent;
|
|
281
|
+
color: $color;
|
|
282
|
+
@include pixelBorderSurround($color,solid);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
@include when(dashed) {
|
|
286
|
+
background: transparent;
|
|
287
|
+
color: $color;
|
|
288
|
+
@include pixelBorderSurround($color,dashed);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
@include when(text) {
|
|
292
|
+
background: transparent;
|
|
293
|
+
color: $color;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.wd-tag__placeholder {
|
|
297
|
+
color: currentColor;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
@include when(round) {
|
|
303
|
+
border-radius: $tag-round-radius;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
@include when(mark) {
|
|
307
|
+
border-radius: $tag-mark-radius;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
@include when(active) {
|
|
311
|
+
color: $tag-primary-color;
|
|
312
|
+
border-color: $tag-primary-color;
|
|
313
|
+
}
|
|
314
|
+
@include when(icon) {
|
|
315
|
+
font-size: $tag-font-size;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
@include e(close) {
|
|
319
|
+
margin-left: $tag-icon-spacing;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
@include edeep(add) {
|
|
323
|
+
margin-right: $tag-icon-spacing;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { ExtractPropTypes } from 'vue'
|
|
2
|
+
import { baseProps, makeBooleanProp, makeStringProp } from '../../common/props'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 标签类型
|
|
6
|
+
* 可选值: 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'volcano' | 'lightblue' | 'cyan' | 'pink' | 'purple'
|
|
7
|
+
*/
|
|
8
|
+
export type TagType = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'volcano' | 'lightblue' | 'cyan' | 'pink' | 'purple'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 标签变体
|
|
12
|
+
* 可选值: 'light' | 'dark' | 'plain' | 'dashed' | 'text'
|
|
13
|
+
*/
|
|
14
|
+
export type TagVariant = 'light' | 'dark' | 'plain' | 'dashed' | 'text'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 标签尺寸
|
|
18
|
+
* 可选值: 'small' | 'medium' | 'large' | 'extra-large' | 'default'
|
|
19
|
+
*/
|
|
20
|
+
export type TagSize = 'small' | 'medium' | 'large' | 'extra-large' | 'default'
|
|
21
|
+
|
|
22
|
+
export const tagProps = {
|
|
23
|
+
...baseProps,
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 标签尺寸
|
|
27
|
+
* 类型: TagSize
|
|
28
|
+
* 可选值: 'small' | 'medium' | 'large' | 'extra-large' | 'default'
|
|
29
|
+
* 默认值: 'default'
|
|
30
|
+
*/
|
|
31
|
+
size: makeStringProp<TagSize>('default'),
|
|
32
|
+
/**
|
|
33
|
+
* 标签类型
|
|
34
|
+
* 类型: TagType
|
|
35
|
+
* 可选值: 'default' | 'primary' | 'danger' | 'warning' | 'success' | 'volcano' | 'lightblue' | 'cyan' | 'pink' | 'purple'
|
|
36
|
+
* 默认值: 'default'
|
|
37
|
+
*/
|
|
38
|
+
type: makeStringProp<TagType>('default'),
|
|
39
|
+
/**
|
|
40
|
+
* 左侧图标
|
|
41
|
+
* 类型: string
|
|
42
|
+
* 默认值: ''
|
|
43
|
+
*/
|
|
44
|
+
icon: makeStringProp(''),
|
|
45
|
+
/**
|
|
46
|
+
* 是否可关闭(只对圆角类型支持)
|
|
47
|
+
* 类型: boolean
|
|
48
|
+
* 默认值: false
|
|
49
|
+
*/
|
|
50
|
+
closable: makeBooleanProp(false),
|
|
51
|
+
/**
|
|
52
|
+
* 是否为新增标签
|
|
53
|
+
* 类型: boolean
|
|
54
|
+
* 默认值: false
|
|
55
|
+
*/
|
|
56
|
+
dynamic: makeBooleanProp(false),
|
|
57
|
+
/**
|
|
58
|
+
* 文字颜色
|
|
59
|
+
* 类型: string
|
|
60
|
+
* 默认值: ''
|
|
61
|
+
*/
|
|
62
|
+
color: makeStringProp(''),
|
|
63
|
+
/**
|
|
64
|
+
* 背景色和边框色
|
|
65
|
+
* 类型: string
|
|
66
|
+
* 默认值: ''
|
|
67
|
+
*/
|
|
68
|
+
bgColor: makeStringProp(''),
|
|
69
|
+
/**
|
|
70
|
+
* 圆角类型
|
|
71
|
+
* 类型: boolean
|
|
72
|
+
* 默认值: false
|
|
73
|
+
*/
|
|
74
|
+
round: makeBooleanProp(false),
|
|
75
|
+
/**
|
|
76
|
+
* 标记类型
|
|
77
|
+
* 类型: boolean
|
|
78
|
+
* 默认值: false
|
|
79
|
+
*/
|
|
80
|
+
mark: makeBooleanProp(false),
|
|
81
|
+
/**
|
|
82
|
+
* 标签变体
|
|
83
|
+
* 类型: TagVariant
|
|
84
|
+
* 可选值: 'light' | 'dark' | 'plain' | 'dashed' | 'text'
|
|
85
|
+
* 默认值: 'dark'
|
|
86
|
+
*/
|
|
87
|
+
variant: makeStringProp<TagVariant>('dark')
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export type TagProps = ExtractPropTypes<typeof tagProps>
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="rootClass" :style="rootStyle" @click="handleClick">
|
|
3
|
+
<input
|
|
4
|
+
v-if="dynamicInput && dynamic"
|
|
5
|
+
class="wd-tag__input"
|
|
6
|
+
:placeholder="translate('placeholder')"
|
|
7
|
+
placeholder-class="wd-tag__placeholder"
|
|
8
|
+
type="text"
|
|
9
|
+
:focus="true"
|
|
10
|
+
v-model="dynamicValue"
|
|
11
|
+
@blur="handleBlur"
|
|
12
|
+
@confirm="handleConfirm"
|
|
13
|
+
/>
|
|
14
|
+
<view v-else-if="dynamic" class="wd-tag__text" :style="textStyle" @click.stop="handleAdd">
|
|
15
|
+
<slot name="add">
|
|
16
|
+
<wd-icon name="plus" custom-class="wd-tag__add" />
|
|
17
|
+
<text>{{ translate('add') }}</text>
|
|
18
|
+
</slot>
|
|
19
|
+
</view>
|
|
20
|
+
|
|
21
|
+
<template v-else>
|
|
22
|
+
<slot name="icon" v-if="$slots.icon || icon">
|
|
23
|
+
<wd-icon :name="icon" custom-class="wd-tag__icon" />
|
|
24
|
+
</slot>
|
|
25
|
+
<text class="wd-tag__text" :style="textStyle" v-if="$slots.default">
|
|
26
|
+
<slot />
|
|
27
|
+
</text>
|
|
28
|
+
<view class="wd-tag__close" v-if="closable" @click.stop="handleClose">
|
|
29
|
+
<wd-icon name="close" custom-class="wd-tag__close-icon"></wd-icon>
|
|
30
|
+
</view>
|
|
31
|
+
</template>
|
|
32
|
+
</view>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script lang="ts">
|
|
36
|
+
export default {
|
|
37
|
+
name: 'wd-tag',
|
|
38
|
+
options: {
|
|
39
|
+
addGlobalClass: true,
|
|
40
|
+
// #ifndef MP-TOUTIAO
|
|
41
|
+
virtualHost: true,
|
|
42
|
+
// #endif
|
|
43
|
+
styleIsolation: 'shared'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
</script>
|
|
47
|
+
<script lang="ts" setup>
|
|
48
|
+
import wdIcon from '../wd-icon/wd-icon.vue'
|
|
49
|
+
import { objToStyle } from '../../common/util'
|
|
50
|
+
import { computed, ref } from 'vue'
|
|
51
|
+
import { useTranslate } from '../../composables/useTranslate'
|
|
52
|
+
import { tagProps } from './types'
|
|
53
|
+
|
|
54
|
+
const props = defineProps(tagProps)
|
|
55
|
+
const emit = defineEmits(['click', 'close', 'confirm'])
|
|
56
|
+
|
|
57
|
+
const { translate } = useTranslate('tag')
|
|
58
|
+
|
|
59
|
+
const dynamicValue = ref<string>('')
|
|
60
|
+
const dynamicInput = ref<boolean>(false)
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 根节点类名
|
|
64
|
+
*/
|
|
65
|
+
const rootClass = computed<string>(() => {
|
|
66
|
+
const { type, variant, size, round, mark, customClass } = props
|
|
67
|
+
const classList: string[] = []
|
|
68
|
+
type && classList.push(`is-${type}`)
|
|
69
|
+
variant && classList.push(`is-${variant}`)
|
|
70
|
+
size && classList.push(`is-${size}`)
|
|
71
|
+
round && classList.push('is-round')
|
|
72
|
+
mark && classList.push('is-mark')
|
|
73
|
+
return `wd-tag ${customClass} ${classList.join(' ')}`
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* 根节点样式
|
|
78
|
+
*/
|
|
79
|
+
const rootStyle = computed<string>(() => {
|
|
80
|
+
const rootStyle: Record<string, any> = {}
|
|
81
|
+
if (props.variant !== 'plain' && props.variant !== 'dashed' && props.variant !== 'text' && props.bgColor) {
|
|
82
|
+
rootStyle['background'] = props.bgColor
|
|
83
|
+
}
|
|
84
|
+
if (props.bgColor) {
|
|
85
|
+
rootStyle['border-color'] = props.bgColor
|
|
86
|
+
}
|
|
87
|
+
return `${objToStyle(rootStyle)}${props.customStyle}`
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* 文本样式
|
|
92
|
+
*/
|
|
93
|
+
const textStyle = computed<string>(() => {
|
|
94
|
+
const textStyle: Record<string, any> = {}
|
|
95
|
+
if (props.color) {
|
|
96
|
+
textStyle['color'] = props.color
|
|
97
|
+
}
|
|
98
|
+
return objToStyle(textStyle)
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* 处理点击事件
|
|
103
|
+
* @param {MouseEvent} event 鼠标事件对象
|
|
104
|
+
* @returns {void}
|
|
105
|
+
*/
|
|
106
|
+
function handleClick(event: MouseEvent) {
|
|
107
|
+
emit('click', event)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* 处理关闭事件
|
|
112
|
+
* @param {MouseEvent} event 鼠标事件对象
|
|
113
|
+
* @returns {void}
|
|
114
|
+
*/
|
|
115
|
+
function handleClose(event: MouseEvent): void {
|
|
116
|
+
emit('close', event)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* 处理添加事件
|
|
121
|
+
* @returns {void}
|
|
122
|
+
*/
|
|
123
|
+
function handleAdd(): void {
|
|
124
|
+
dynamicInput.value = true
|
|
125
|
+
dynamicValue.value = ''
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* 处理输入框失焦事件
|
|
130
|
+
* @returns {void}
|
|
131
|
+
*/
|
|
132
|
+
function handleBlur(): void {
|
|
133
|
+
setDynamicInput()
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* 处理输入完成事件
|
|
138
|
+
* @param {any} event 回车或完成事件对象
|
|
139
|
+
* @returns {void}
|
|
140
|
+
*/
|
|
141
|
+
function handleConfirm(event: any): void {
|
|
142
|
+
setDynamicInput()
|
|
143
|
+
emit('confirm', {
|
|
144
|
+
value: event.detail.value
|
|
145
|
+
})
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* 重置动态输入框状态
|
|
150
|
+
* @returns {void}
|
|
151
|
+
*/
|
|
152
|
+
function setDynamicInput() {
|
|
153
|
+
dynamicInput.value = false
|
|
154
|
+
}
|
|
155
|
+
</script>
|
|
156
|
+
<style lang="scss">
|
|
157
|
+
@use './index.scss';
|
|
158
|
+
</style>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
@use '../../styles/variable.scss'as *;
|
|
2
|
+
@use '../../styles/mixin/mixin.scss'as *;
|
|
3
|
+
|
|
4
|
+
// 默认文字字号
|
|
5
|
+
$text-font-size: var(--wot-text-font-size, $typography-body-size-main) !default;
|
|
6
|
+
// 默认文字行高
|
|
7
|
+
$text-line-height: var(--wot-text-line-height, $typography-body-line--height-size-main) !default;
|
|
8
|
+
// 主色文字颜色
|
|
9
|
+
$text-primary-color: var(--wot-text-primary-color, $primary-6) !default;
|
|
10
|
+
// 成功文字颜色
|
|
11
|
+
$text-success-color: var(--wot-text-success-color, $success-main) !default;
|
|
12
|
+
// 错误文字颜色
|
|
13
|
+
$text-error-color: var(--wot-text-error-color, $danger-main) !default;
|
|
14
|
+
// 警告文字颜色
|
|
15
|
+
$text-warning-color: var(--wot-text-warning-color, $warning-main) !default;
|
|
16
|
+
// 默认文字颜色
|
|
17
|
+
$text-default-color: var(--wot-text-default-color, $text-auxiliary) !default;
|
|
18
|
+
|
|
19
|
+
@include b(text) {
|
|
20
|
+
font-size: $text-font-size;
|
|
21
|
+
line-height: $text-line-height;
|
|
22
|
+
|
|
23
|
+
@include when(bold) {
|
|
24
|
+
font-weight: bold;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@for $i from 1 through 5 {
|
|
28
|
+
&.is-lines-#{$i} {
|
|
29
|
+
@include multiEllipsis($i);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@include when(default) {
|
|
34
|
+
color: $text-default-color;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@include when(primary) {
|
|
38
|
+
color: $text-primary-color;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@include when(error) {
|
|
42
|
+
color: $text-error-color;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@include when(warning) {
|
|
46
|
+
color: $text-warning-color;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@include when(success) {
|
|
50
|
+
color: $text-success-color;
|
|
51
|
+
}
|
|
52
|
+
}
|