@wot-ui/ui 2.0.8 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -11
- package/attributes.json +1 -1
- package/changelog.md +40 -0
- package/components/wd-avatar/wd-avatar.vue +1 -1
- package/components/wd-button/index.scss +1 -0
- package/components/wd-button/types.ts +14 -11
- package/components/wd-button/wd-button.vue +26 -4
- package/components/wd-calendar-view/monthPanel/month-panel.vue +1 -0
- package/components/wd-calendar-view/yearPanel/year-panel.vue +1 -0
- package/components/wd-cell/index.scss +12 -1
- package/components/wd-config-provider/global-config.ts +50 -0
- package/components/wd-config-provider/theme-vars.ts +2073 -0
- package/components/wd-config-provider/types.ts +20 -2071
- package/components/wd-config-provider/wd-config-provider.vue +15 -4
- package/components/wd-dialog/wd-dialog.vue +1 -0
- package/components/wd-drop-menu/wd-drop-menu.vue +1 -0
- package/components/wd-form/wd-form.vue +32 -7
- package/components/wd-grid/wd-grid.vue +0 -2
- package/components/wd-icon/wd-icon.vue +2 -2
- package/components/wd-img/wd-img.vue +1 -0
- package/components/wd-index-anchor/index.scss +5 -5
- package/components/wd-index-bar/index.scss +14 -14
- package/components/wd-keyboard/key/index.vue +2 -0
- package/components/wd-notify/wd-notify.vue +1 -0
- package/components/wd-picker-view/useSelection.ts +3 -1
- package/components/wd-root-portal/wd-root-portal.vue +1 -1
- package/components/wd-select-picker/wd-select-picker.vue +1 -0
- package/components/wd-signature/wd-signature.vue +1 -0
- package/components/wd-slider/index.scss +45 -45
- package/components/wd-slider/wd-slider.vue +19 -3
- package/components/wd-switch/wd-switch.vue +2 -0
- package/components/wd-tabs/wd-tabs.vue +1 -0
- package/components/wd-tag/index.scss +8 -7
- package/components/wd-tag/types.ts +10 -7
- package/components/wd-tag/wd-tag.vue +23 -6
- package/components/wd-toast/index.scss +0 -1
- package/components/wd-toast/wd-toast.vue +4 -0
- package/components/wd-video-preview/index.scss +19 -1
- package/components/wd-video-preview/types.ts +21 -2
- package/components/wd-video-preview/wd-video-preview.vue +109 -30
- package/composables/index.ts +2 -0
- package/composables/useChildren.ts +0 -6
- package/composables/useConfigProvider.ts +27 -12
- package/composables/useGlobalConfig.ts +9 -0
- package/index.ts +1 -1
- package/package.json +1 -1
- package/styles/variable.scss +381 -381
- package/tags.json +1 -1
- package/web-types.json +1 -1
|
@@ -22,21 +22,22 @@ import { computed, inject } from 'vue'
|
|
|
22
22
|
import { configProviderProps, CONFIG_PROVIDER_KEY, type ConfigProviderProvide } from './types'
|
|
23
23
|
import { objToStyle } from '../../common/util'
|
|
24
24
|
import { useChildren } from '../../composables/useChildren'
|
|
25
|
+
import { useParent } from '../../composables/useParent'
|
|
25
26
|
import { mapThemeVarsToCSSVars } from '../../composables/useConfigProvider'
|
|
26
27
|
import { USE_CONFIG_PROVIDER_KEY } from '../../composables/useConfigProvider'
|
|
28
|
+
import { mergeConfig, type ConfigProviderInput, type GlobalConfig } from './global-config'
|
|
27
29
|
|
|
28
30
|
const None = Symbol('None')
|
|
29
31
|
const hooksProvider = inject<ConfigProviderProvide | typeof None>(USE_CONFIG_PROVIDER_KEY, None)
|
|
30
32
|
const props = defineProps(configProviderProps)
|
|
31
33
|
|
|
32
34
|
const { linkChildren } = useChildren(CONFIG_PROVIDER_KEY)
|
|
35
|
+
const { parent: parentConfigProvider } = useParent(CONFIG_PROVIDER_KEY)
|
|
33
36
|
|
|
34
37
|
const themeClass = computed(() => {
|
|
35
38
|
return `wot-theme-${props.theme} ${props.customClass}`
|
|
36
39
|
})
|
|
37
40
|
|
|
38
|
-
const themeValue = computed(() => props.theme)
|
|
39
|
-
|
|
40
41
|
const themeStyle = computed(() => {
|
|
41
42
|
if (hooksProvider !== None) {
|
|
42
43
|
return hooksProvider.themeStyle.value
|
|
@@ -50,9 +51,19 @@ const rootStyle = computed(() => {
|
|
|
50
51
|
return style
|
|
51
52
|
})
|
|
52
53
|
|
|
54
|
+
const globalConfig = computed<GlobalConfig>(() => {
|
|
55
|
+
const parentGlobalConfig = parentConfigProvider.value?.globalConfig.value || null
|
|
56
|
+
return mergeConfig(parentGlobalConfig, {
|
|
57
|
+
theme: props.theme,
|
|
58
|
+
themeVars: props.themeVars,
|
|
59
|
+
button: props.button,
|
|
60
|
+
tag: props.tag
|
|
61
|
+
} as ConfigProviderInput)
|
|
62
|
+
})
|
|
63
|
+
|
|
53
64
|
linkChildren({
|
|
54
|
-
|
|
55
|
-
|
|
65
|
+
themeStyle,
|
|
66
|
+
globalConfig
|
|
56
67
|
})
|
|
57
68
|
</script>
|
|
58
69
|
|
|
@@ -136,6 +136,7 @@ export default {
|
|
|
136
136
|
<script lang="ts" setup>
|
|
137
137
|
import wdPopup from '../wd-popup/wd-popup.vue'
|
|
138
138
|
import wdButton from '../wd-button/wd-button.vue'
|
|
139
|
+
import wdIcon from '../wd-icon/wd-icon.vue'
|
|
139
140
|
import wdInput from '../wd-input/wd-input.vue'
|
|
140
141
|
import wdTextarea from '../wd-textarea/wd-textarea.vue'
|
|
141
142
|
import { computed, inject, reactive, ref, watch } from 'vue'
|
|
@@ -53,6 +53,7 @@ import { getRect, getSystemInfo, uuid } from '../../common/util'
|
|
|
53
53
|
import { useChildren } from '../../composables/useChildren'
|
|
54
54
|
import { DROP_MENU_KEY, dropMenuProps } from './types'
|
|
55
55
|
import wdOverlay from '../wd-overlay/wd-overlay.vue'
|
|
56
|
+
import wdIcon from '../wd-icon/wd-icon.vue'
|
|
56
57
|
|
|
57
58
|
const props = defineProps(dropMenuProps)
|
|
58
59
|
const queue = inject<Queue | null>(queueKey, null)
|
|
@@ -57,12 +57,12 @@ async function validate(prop?: string | string[]): Promise<{ valid: boolean; err
|
|
|
57
57
|
prop: issue.path.map((item) => String(item)).join('.'),
|
|
58
58
|
message: issue.message
|
|
59
59
|
}))
|
|
60
|
+
const childrenProps = getChildrenProps()
|
|
61
|
+
const visibleErrors = errors.filter((error) => getMatchedChildProp(error.prop, childrenProps))
|
|
60
62
|
const filteredErrors =
|
|
61
63
|
propsToValidate.length > 0
|
|
62
|
-
?
|
|
63
|
-
|
|
64
|
-
)
|
|
65
|
-
: errors
|
|
64
|
+
? visibleErrors.filter((error) => propsToValidate.some((target) => isSameOrSubPath(error.prop, target)))
|
|
65
|
+
: visibleErrors
|
|
66
66
|
const valid = filteredErrors.length === 0
|
|
67
67
|
|
|
68
68
|
showMessage(filteredErrors)
|
|
@@ -81,9 +81,30 @@ async function validate(prop?: string | string[]): Promise<{ valid: boolean; err
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
function getChildrenProps() {
|
|
85
|
+
return children.map((e) => e.prop).filter((prop): prop is string => Boolean(prop))
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function isSameOrSubPath(prop: string, target: string) {
|
|
89
|
+
return prop === target || prop.startsWith(`${target}.`) || target.startsWith(`${prop}.`)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function getMatchedChildProp(prop: string, childrenProps: string[]) {
|
|
93
|
+
return childrenProps.find((target) => target === prop) || childrenProps.find((target) => isSameOrSubPath(prop, target))
|
|
94
|
+
}
|
|
95
|
+
|
|
84
96
|
function showMessage(errors: ErrorMessage[]) {
|
|
85
|
-
const childrenProps =
|
|
86
|
-
const messages = errors.
|
|
97
|
+
const childrenProps = getChildrenProps()
|
|
98
|
+
const messages = errors.reduce<ErrorMessage[]>((result, error) => {
|
|
99
|
+
const matchedProp = getMatchedChildProp(error.prop, childrenProps)
|
|
100
|
+
if (error.message && matchedProp) {
|
|
101
|
+
result.push({
|
|
102
|
+
prop: matchedProp,
|
|
103
|
+
message: error.message
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
return result
|
|
107
|
+
}, [])
|
|
87
108
|
if (messages.length) {
|
|
88
109
|
messages.sort((a, b) => {
|
|
89
110
|
return childrenProps.indexOf(a.prop) - childrenProps.indexOf(b.prop)
|
|
@@ -100,7 +121,11 @@ function showMessage(errors: ErrorMessage[]) {
|
|
|
100
121
|
|
|
101
122
|
function clearMessage(prop?: string) {
|
|
102
123
|
if (prop) {
|
|
103
|
-
errorMessages
|
|
124
|
+
Object.keys(errorMessages).forEach((key) => {
|
|
125
|
+
if (isSameOrSubPath(key, prop)) {
|
|
126
|
+
errorMessages[key] = ''
|
|
127
|
+
}
|
|
128
|
+
})
|
|
104
129
|
} else {
|
|
105
130
|
Object.keys(errorMessages).forEach((key) => {
|
|
106
131
|
errorMessages[key] = ''
|
|
@@ -61,8 +61,8 @@ const rootStyle = computed(() => {
|
|
|
61
61
|
if (props.size) {
|
|
62
62
|
const sizeValue = addUnit(props.size)
|
|
63
63
|
style['font-size'] = sizeValue
|
|
64
|
-
// CSS
|
|
65
|
-
if (props.cssIcon) {
|
|
64
|
+
// CSS 图标和图片模式下,同步设置 width/height
|
|
65
|
+
if (props.cssIcon || isImage.value) {
|
|
66
66
|
style['width'] = sizeValue
|
|
67
67
|
style['height'] = sizeValue
|
|
68
68
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
@use '../../styles/mixin/mixin.scss' as *;
|
|
2
2
|
@use '../../styles/variable.scss' as *;
|
|
3
3
|
|
|
4
|
-
$index-anchor-bg: var(--wot-index-anchor-bg, $filled-bottom) !default;
|
|
5
|
-
$index-anchor-padding: var(--wot-index-anchor-padding, $padding-main) !default;
|
|
6
|
-
$index-anchor-font-size: var(--wot-index-anchor-font-size, $typography-body-size-main) !default;
|
|
7
|
-
$index-anchor-color: var(--wot-index-anchor-color, $text-main) !default;
|
|
8
|
-
$index-anchor-z-index: var(--wot-index-anchor-z-index, 1) !default;
|
|
4
|
+
$index-anchor-bg: var(--wot-index-anchor-bg, $filled-bottom) !default; // 索引锚点背景色
|
|
5
|
+
$index-anchor-padding: var(--wot-index-anchor-padding, $padding-main) !default; // 索引锚点内边距
|
|
6
|
+
$index-anchor-font-size: var(--wot-index-anchor-font-size, $typography-body-size-main) !default; // 索引锚点文字字号
|
|
7
|
+
$index-anchor-color: var(--wot-index-anchor-color, $text-main) !default; // 索引锚点文字颜色
|
|
8
|
+
$index-anchor-z-index: var(--wot-index-anchor-z-index, 1) !default; // 索引锚点吸顶层级
|
|
9
9
|
|
|
10
10
|
// #ifdef MP-DINGTALK
|
|
11
11
|
@include b(index-anchor-ding) {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
@use '../../styles/mixin/mixin.scss' as *;
|
|
2
2
|
@use '../../styles/variable.scss' as *;
|
|
3
3
|
|
|
4
|
-
$index-bar-sidebar-right: var(--wot-index-bar-sidebar-right, $spacing-super-tight) !default;
|
|
5
|
-
$index-bar-index-font-size: var(--wot-index-bar-index-font-size, $typography-label-size-main) !default;
|
|
6
|
-
$index-bar-index-width: var(--wot-index-bar-index-width, $typography-label-line-height-size-main) !default;
|
|
7
|
-
$index-bar-index-height: var(--wot-index-bar-index-height, $typography-label-line-height-size-main) !default;
|
|
8
|
-
$index-bar-index-font-weight: var(--wot-index-bar-index-font-weight, $font-weight-medium) !default;
|
|
9
|
-
$index-bar-index-color: var(--wot-index-bar-index-color, $text-auxiliary) !default;
|
|
10
|
-
$index-bar-index-border-radius: var(--wot-index-bar-index-border-radius, $radius-full) !default;
|
|
11
|
-
$index-bar-index-color-active: var(--wot-index-bar-index-color-active, $text-white) !default;
|
|
12
|
-
$index-bar-index-bg-active: var(--wot-index-bar-index-bg-active, $primary-6) !default;
|
|
13
|
-
$index-bar-current-index-size: var(--wot-index-bar-current-index-size, $n-56) !default;
|
|
14
|
-
$index-bar-current-index-bg: var(--wot-index-bar-current-index-bg, $primary-6) !default;
|
|
15
|
-
$index-bar-current-index-color: var(--wot-index-bar-current-index-color, $text-white) !default;
|
|
16
|
-
$index-bar-current-index-font-size: var(--wot-index-bar-current-index-font-size, $typography-title-size-extra-large) !default;
|
|
17
|
-
$index-bar-current-index-z-index: var(--wot-index-bar-current-index-z-index, 10) !default;
|
|
4
|
+
$index-bar-sidebar-right: var(--wot-index-bar-sidebar-right, $spacing-super-tight) !default; // 索引侧边栏右侧偏移
|
|
5
|
+
$index-bar-index-font-size: var(--wot-index-bar-index-font-size, $typography-label-size-main) !default; // 索引项文字字号
|
|
6
|
+
$index-bar-index-width: var(--wot-index-bar-index-width, $typography-label-line-height-size-main) !default; // 索引项宽度
|
|
7
|
+
$index-bar-index-height: var(--wot-index-bar-index-height, $typography-label-line-height-size-main) !default; // 索引项高度
|
|
8
|
+
$index-bar-index-font-weight: var(--wot-index-bar-index-font-weight, $font-weight-medium) !default; // 索引项字重
|
|
9
|
+
$index-bar-index-color: var(--wot-index-bar-index-color, $text-auxiliary) !default; // 索引项文字颜色
|
|
10
|
+
$index-bar-index-border-radius: var(--wot-index-bar-index-border-radius, $radius-full) !default; // 索引项圆角
|
|
11
|
+
$index-bar-index-color-active: var(--wot-index-bar-index-color-active, $text-white) !default; // 激活索引项文字颜色
|
|
12
|
+
$index-bar-index-bg-active: var(--wot-index-bar-index-bg-active, $primary-6) !default; // 激活索引项背景色
|
|
13
|
+
$index-bar-current-index-size: var(--wot-index-bar-current-index-size, $n-56) !default; // 当前索引提示尺寸
|
|
14
|
+
$index-bar-current-index-bg: var(--wot-index-bar-current-index-bg, $primary-6) !default; // 当前索引提示背景色
|
|
15
|
+
$index-bar-current-index-color: var(--wot-index-bar-current-index-color, $text-white) !default; // 当前索引提示文字颜色
|
|
16
|
+
$index-bar-current-index-font-size: var(--wot-index-bar-current-index-font-size, $typography-title-size-extra-large) !default; // 当前索引提示文字字号
|
|
17
|
+
$index-bar-current-index-z-index: var(--wot-index-bar-current-index-z-index, 10) !default; // 当前索引提示层级
|
|
18
18
|
|
|
19
19
|
@include b(index-bar) {
|
|
20
20
|
position: relative;
|
|
@@ -32,6 +32,8 @@ export default {
|
|
|
32
32
|
</script>
|
|
33
33
|
|
|
34
34
|
<script lang="ts" setup>
|
|
35
|
+
import wdLoading from '../../wd-loading/wd-loading.vue'
|
|
36
|
+
import wdIcon from '../../wd-icon/wd-icon.vue'
|
|
35
37
|
import { computed, ref } from 'vue'
|
|
36
38
|
import { useTouch } from '../../../composables/useTouch'
|
|
37
39
|
import { keyProps } from './types'
|
|
@@ -49,6 +49,7 @@ export default {
|
|
|
49
49
|
|
|
50
50
|
<script lang="ts" setup>
|
|
51
51
|
import wdPopup from '../wd-popup/wd-popup.vue'
|
|
52
|
+
import wdIcon from '../wd-icon/wd-icon.vue'
|
|
52
53
|
import { inject, computed, watch, ref, type CSSProperties } from 'vue'
|
|
53
54
|
import { notifyProps, type NotifyProps } from './types'
|
|
54
55
|
import { getNotifyOptionKey } from '.'
|
|
@@ -108,7 +108,9 @@ export function useSelection(valueKey: string, labelKey: string, childrenKey: st
|
|
|
108
108
|
* @returns {string[]} label数组
|
|
109
109
|
*/
|
|
110
110
|
const selectedLabels = computed(() => {
|
|
111
|
-
return selectedIndex.value.map((row, col) =>
|
|
111
|
+
return selectedIndex.value.map((row, col) =>
|
|
112
|
+
String(isDef(formatColumns.value[col][row][labelKey]) ? formatColumns.value[col][row][labelKey] : '')
|
|
113
|
+
)
|
|
112
114
|
})
|
|
113
115
|
|
|
114
116
|
/**
|
|
@@ -53,7 +53,7 @@ const configProviderStyle = computed(() => {
|
|
|
53
53
|
})
|
|
54
54
|
|
|
55
55
|
const themeClass = computed(() => {
|
|
56
|
-
const theme = hooksProvider !== None ? hooksProvider.
|
|
56
|
+
const theme = hooksProvider !== None ? hooksProvider.globalConfig?.value.theme : configProvider.value?.globalConfig?.value.theme
|
|
57
57
|
return theme ? `wot-theme-${theme}` : 'wot-theme-light'
|
|
58
58
|
})
|
|
59
59
|
</script>
|
|
@@ -109,6 +109,7 @@ import wdRadio from '../wd-radio/wd-radio.vue'
|
|
|
109
109
|
import wdRadioGroup from '../wd-radio-group/wd-radio-group.vue'
|
|
110
110
|
import wdButton from '../wd-button/wd-button.vue'
|
|
111
111
|
import wdLoading from '../wd-loading/wd-loading.vue'
|
|
112
|
+
import wdSearch from '../wd-search/wd-search.vue'
|
|
112
113
|
|
|
113
114
|
import { getCurrentInstance, onBeforeMount, ref, watch, nextTick, computed } from 'vue'
|
|
114
115
|
import { getRect, isArray, isDef, isFunction, pause } from '../../common/util'
|
|
@@ -72,6 +72,7 @@ export default {
|
|
|
72
72
|
}
|
|
73
73
|
</script>
|
|
74
74
|
<script lang="ts" setup>
|
|
75
|
+
import wdButton from '../wd-button/wd-button.vue'
|
|
75
76
|
import { computed, getCurrentInstance, onBeforeMount, onMounted, reactive, ref, watch, type CSSProperties } from 'vue'
|
|
76
77
|
import { addUnit, getRect, getSystemInfo, isDef, objToStyle, uuid } from '../../common/util'
|
|
77
78
|
import { signatureProps, type SignatureExpose, type SignatureResult, type Point, type Line } from './types'
|
|
@@ -4,64 +4,64 @@
|
|
|
4
4
|
/* ================================ 组件SCSS变量 ================================ */
|
|
5
5
|
|
|
6
6
|
/* 轨道 (Track) */
|
|
7
|
-
$slider-bar-height: var(--wot-slider-bar-height, $n-2) !default;
|
|
8
|
-
$slider-bar-height-capsule: var(--wot-slider-bar-height-capsule, $n-24) !default;
|
|
9
|
-
$slider-bar-bg: var(--wot-slider-bar-bg, $filled-strong) !default;
|
|
10
|
-
$slider-bar-radius: var(--wot-slider-bar-radius, $radius-full) !default;
|
|
11
|
-
$slider-bar-height-vertical: var(--wot-slider-bar-height-vertical, $n-248) !default;
|
|
7
|
+
$slider-bar-height: var(--wot-slider-bar-height, $n-2) !default; // 轨道高度
|
|
8
|
+
$slider-bar-height-capsule: var(--wot-slider-bar-height-capsule, $n-24) !default; // 胶囊轨道高度
|
|
9
|
+
$slider-bar-bg: var(--wot-slider-bar-bg, $filled-strong) !default; // 轨道背景色
|
|
10
|
+
$slider-bar-radius: var(--wot-slider-bar-radius, $radius-full) !default; // 轨道圆角
|
|
11
|
+
$slider-bar-height-vertical: var(--wot-slider-bar-height-vertical, $n-248) !default; // 垂直轨道高度
|
|
12
12
|
|
|
13
13
|
/* 进度条 (Range) */
|
|
14
|
-
$slider-line-bg: var(--wot-slider-line-bg, $primary-6) !default;
|
|
15
|
-
$slider-line-height: var(--wot-slider-line-height, $n-2) !default;
|
|
16
|
-
$slider-line-height-capsule: var(--wot-slider-line-height-capsule, $n-18) !default;
|
|
14
|
+
$slider-line-bg: var(--wot-slider-line-bg, $primary-6) !default; // 进度条背景色
|
|
15
|
+
$slider-line-height: var(--wot-slider-line-height, $n-2) !default; // 进度条高度
|
|
16
|
+
$slider-line-height-capsule: var(--wot-slider-line-height-capsule, $n-18) !default; // 胶囊进度条高度
|
|
17
17
|
|
|
18
18
|
/* 滑块 (Thumb) */
|
|
19
|
-
$slider-dot-size: var(--wot-slider-dot-size, $n-24) !default;
|
|
20
|
-
$slider-dot-bg: var(--wot-slider-dot-bg, $filled-oppo) !default;
|
|
21
|
-
$slider-dot-shadow: var(--wot-slider-dot-shadow, 0 2px 8px 0 rgba(0, 0, 0, 0.1)) !default;
|
|
19
|
+
$slider-dot-size: var(--wot-slider-dot-size, $n-24) !default; // 滑块尺寸
|
|
20
|
+
$slider-dot-bg: var(--wot-slider-dot-bg, $filled-oppo) !default; // 滑块背景色
|
|
21
|
+
$slider-dot-shadow: var(--wot-slider-dot-shadow, 0 2px 8px 0 rgba(0, 0, 0, 0.1)) !default; // 滑块阴影
|
|
22
22
|
|
|
23
23
|
/* 气泡提示 (Popover) */
|
|
24
|
-
$slider-dot-popover-bg: var(--wot-slider-dot-popover-bg, $opacfilled-tooltip-toast-cover) !default;
|
|
25
|
-
$slider-dot-popover-color: var(--wot-slider-dot-popover-color, $text-white) !default;
|
|
26
|
-
$slider-dot-popover-radius: var(--wot-slider-dot-popover-radius, $radius-main) !default;
|
|
27
|
-
$slider-dot-popover-padding: var(--wot-slider-dot-popover-padding, $padding-extra-tight $padding-loose) !default;
|
|
28
|
-
$slider-dot-popover-font-size: var(--wot-slider-dot-popover-font-size, $typography-body-size-main) !default;
|
|
29
|
-
$slider-dot-popover-line-height: var(--wot-slider-dot-popover-line-height, $typography-body-line-height-size-main) !default;
|
|
30
|
-
$slider-dot-popover-gap: var(--wot-slider-dot-popover-gap, $n-3) !default;
|
|
31
|
-
$slider-dot-popover-arrow-width: var(--wot-slider-dot-popover-arrow-width, $n-12) !default;
|
|
32
|
-
$slider-dot-popover-arrow-height: var(--wot-slider-dot-popover-arrow-height, $n-6) !default;
|
|
33
|
-
$slider-dot-popover-duration-exit: var(--wot-slider-dot-popover-duration-exit, 100ms) !default;
|
|
34
|
-
$slider-dot-popover-easing-exit: var(--wot-slider-dot-popover-easing-exit, cubic-bezier(0.4, 0, 1, 1)) !default;
|
|
35
|
-
$slider-dot-popover-duration-enter: var(--wot-slider-dot-popover-duration-enter, 200ms) !default;
|
|
36
|
-
$slider-dot-popover-easing-enter: var(--wot-slider-dot-popover-easing-enter, cubic-bezier(0.34, 1.56, 0.64, 1)) !default;
|
|
24
|
+
$slider-dot-popover-bg: var(--wot-slider-dot-popover-bg, $opacfilled-tooltip-toast-cover) !default; // 气泡提示背景色
|
|
25
|
+
$slider-dot-popover-color: var(--wot-slider-dot-popover-color, $text-white) !default; // 气泡提示文字颜色
|
|
26
|
+
$slider-dot-popover-radius: var(--wot-slider-dot-popover-radius, $radius-main) !default; // 气泡提示圆角
|
|
27
|
+
$slider-dot-popover-padding: var(--wot-slider-dot-popover-padding, $padding-extra-tight $padding-loose) !default; // 气泡提示内边距
|
|
28
|
+
$slider-dot-popover-font-size: var(--wot-slider-dot-popover-font-size, $typography-body-size-main) !default; // 气泡提示文字字号
|
|
29
|
+
$slider-dot-popover-line-height: var(--wot-slider-dot-popover-line-height, $typography-body-line-height-size-main) !default; // 气泡提示行高
|
|
30
|
+
$slider-dot-popover-gap: var(--wot-slider-dot-popover-gap, $n-3) !default; // 气泡提示与滑块间距
|
|
31
|
+
$slider-dot-popover-arrow-width: var(--wot-slider-dot-popover-arrow-width, $n-12) !default; // 气泡提示箭头宽度
|
|
32
|
+
$slider-dot-popover-arrow-height: var(--wot-slider-dot-popover-arrow-height, $n-6) !default; // 气泡提示箭头高度
|
|
33
|
+
$slider-dot-popover-duration-exit: var(--wot-slider-dot-popover-duration-exit, 100ms) !default; // 气泡提示离场动画时长
|
|
34
|
+
$slider-dot-popover-easing-exit: var(--wot-slider-dot-popover-easing-exit, cubic-bezier(0.4, 0, 1, 1)) !default; // 气泡提示离场动画缓动
|
|
35
|
+
$slider-dot-popover-duration-enter: var(--wot-slider-dot-popover-duration-enter, 200ms) !default; // 气泡提示入场动画时长
|
|
36
|
+
$slider-dot-popover-easing-enter: var(--wot-slider-dot-popover-easing-enter, cubic-bezier(0.34, 1.56, 0.64, 1)) !default; // 气泡提示入场动画缓动
|
|
37
37
|
|
|
38
38
|
/* 刻度 (Scale) */
|
|
39
|
-
$slider-scale-size: var(--wot-slider-scale-size, $n-6) !default;
|
|
40
|
-
$slider-scale-border-radius: var(--wot-slider-scale-border-radius, $radius-full) !default;
|
|
41
|
-
$slider-scale-bg: var(--wot-slider-scale-bg, $filled-strong) !default;
|
|
42
|
-
$slider-scale-bg-active: var(--wot-slider-scale-bg-active, $primary-6) !default;
|
|
43
|
-
$slider-scale-capsule-bg: var(--wot-slider-scale-capsule-bg, $filled-strong) !default;
|
|
44
|
-
$slider-scale-capsule-width: var(--wot-slider-scale-capsule-width, $n-2) !default;
|
|
45
|
-
$slider-scale-capsule-border-radius: var(--wot-slider-scale-capsule-border-radius, $radius-zero) !default;
|
|
46
|
-
$slider-scale-desc-font-size: var(--wot-slider-scale-desc-font-size, $typography-body-size-main) !default;
|
|
47
|
-
$slider-scale-desc-line-height: var(--wot-slider-scale-desc-line-height, $typography-body-line-height-size-main) !default;
|
|
48
|
-
$slider-scale-desc-color: var(--wot-slider-scale-desc-color, $text-main) !default;
|
|
49
|
-
$slider-scale-desc-spacing: var(--wot-slider-scale-desc-spacing, $spacing-tight) !default;
|
|
50
|
-
$slider-marks-desc-spacing: var(--wot-slider-marks-desc-spacing, calc($slider-dot-size / 2 + $spacing-tight)) !default;
|
|
51
|
-
$slider-marks-desc-capsule-spacing: var(--wot-slider-marks-desc-capsule-spacing, calc($slider-dot-size + $spacing-super-tight)) !default;
|
|
52
|
-
$slider-marks-extra-padding: var(--wot-slider-marks-extra-padding, $padding-super-loose) !default;
|
|
53
|
-
$slider-marks-extra-capsule-padding: var(--wot-slider-marks-extra-capsule-padding, $padding-ultra-loose) !default;
|
|
39
|
+
$slider-scale-size: var(--wot-slider-scale-size, $n-6) !default; // 刻度尺寸
|
|
40
|
+
$slider-scale-border-radius: var(--wot-slider-scale-border-radius, $radius-full) !default; // 刻度圆角
|
|
41
|
+
$slider-scale-bg: var(--wot-slider-scale-bg, $filled-strong) !default; // 刻度背景色
|
|
42
|
+
$slider-scale-bg-active: var(--wot-slider-scale-bg-active, $primary-6) !default; // 激活刻度背景色
|
|
43
|
+
$slider-scale-capsule-bg: var(--wot-slider-scale-capsule-bg, $filled-strong) !default; // 胶囊刻度背景色
|
|
44
|
+
$slider-scale-capsule-width: var(--wot-slider-scale-capsule-width, $n-2) !default; // 胶囊刻度宽度
|
|
45
|
+
$slider-scale-capsule-border-radius: var(--wot-slider-scale-capsule-border-radius, $radius-zero) !default; // 胶囊刻度圆角
|
|
46
|
+
$slider-scale-desc-font-size: var(--wot-slider-scale-desc-font-size, $typography-body-size-main) !default; // 刻度描述文字字号
|
|
47
|
+
$slider-scale-desc-line-height: var(--wot-slider-scale-desc-line-height, $typography-body-line-height-size-main) !default; // 刻度描述行高
|
|
48
|
+
$slider-scale-desc-color: var(--wot-slider-scale-desc-color, $text-main) !default; // 刻度描述文字颜色
|
|
49
|
+
$slider-scale-desc-spacing: var(--wot-slider-scale-desc-spacing, $spacing-tight) !default; // 刻度描述间距
|
|
50
|
+
$slider-marks-desc-spacing: var(--wot-slider-marks-desc-spacing, calc($slider-dot-size / 2 + $spacing-tight)) !default; // 标记描述间距
|
|
51
|
+
$slider-marks-desc-capsule-spacing: var(--wot-slider-marks-desc-capsule-spacing, calc($slider-dot-size + $spacing-super-tight)) !default; // 胶囊标记描述间距
|
|
52
|
+
$slider-marks-extra-padding: var(--wot-slider-marks-extra-padding, $padding-super-loose) !default; // 标记额外内边距
|
|
53
|
+
$slider-marks-extra-capsule-padding: var(--wot-slider-marks-extra-capsule-padding, $padding-ultra-loose) !default; // 胶囊标记额外内边距
|
|
54
54
|
|
|
55
55
|
/* 布局 (Layout) */
|
|
56
|
-
$slider-capsule-track-inset: var(--wot-slider-capsule-track-inset, $n-3) !default;
|
|
57
|
-
$slider-extreme-spacing: var(--wot-slider-extreme-spacing, $spacing-loose) !default;
|
|
56
|
+
$slider-capsule-track-inset: var(--wot-slider-capsule-track-inset, $n-3) !default; // 胶囊轨道内缩距离
|
|
57
|
+
$slider-extreme-spacing: var(--wot-slider-extreme-spacing, $spacing-loose) !default; // 极值文字与轨道间距
|
|
58
58
|
|
|
59
59
|
/* 极值文字 (Extreme Value) */
|
|
60
|
-
$slider-value-font-size: var(--wot-slider-value-font-size, $typography-body-size-main) !default;
|
|
61
|
-
$slider-value-color: var(--wot-slider-value-color, $text-secondary) !default;
|
|
60
|
+
$slider-value-font-size: var(--wot-slider-value-font-size, $typography-body-size-main) !default; // 极值文字字号
|
|
61
|
+
$slider-value-color: var(--wot-slider-value-color, $text-secondary) !default; // 极值文字颜色
|
|
62
62
|
|
|
63
63
|
/* 状态 (States) */
|
|
64
|
-
$slider-opacity-disabled: var(--wot-slider-opacity-disabled, $opacity-disabled) !default;
|
|
64
|
+
$slider-opacity-disabled: var(--wot-slider-opacity-disabled, $opacity-disabled) !default; // 禁用态透明度
|
|
65
65
|
|
|
66
66
|
@include b(slider) {
|
|
67
67
|
display: flex;
|
|
@@ -482,4 +482,4 @@ $slider-opacity-disabled: var(--wot-slider-opacity-disabled, $opacity-disabled)
|
|
|
482
482
|
opacity: $slider-opacity-disabled;
|
|
483
483
|
pointer-events: none;
|
|
484
484
|
}
|
|
485
|
-
}
|
|
485
|
+
}
|
|
@@ -304,8 +304,24 @@ function initSlider() {
|
|
|
304
304
|
*/
|
|
305
305
|
function getPointerPosition(event: any): number {
|
|
306
306
|
return props.vertical
|
|
307
|
-
? Number(
|
|
308
|
-
|
|
307
|
+
? Number(
|
|
308
|
+
isDef(event.detail?.y)
|
|
309
|
+
? event.detail?.y
|
|
310
|
+
: isDef(event.clientY)
|
|
311
|
+
? event.clientY
|
|
312
|
+
: isDef(event.touches?.[0]?.clientY)
|
|
313
|
+
? event.touches?.[0]?.clientY
|
|
314
|
+
: 0
|
|
315
|
+
)
|
|
316
|
+
: Number(
|
|
317
|
+
isDef(event.detail?.x)
|
|
318
|
+
? event.detail?.x
|
|
319
|
+
: isDef(event.clientX)
|
|
320
|
+
? event.clientX
|
|
321
|
+
: isDef(event.touches?.[0]?.clientX)
|
|
322
|
+
? event.touches?.[0]?.clientX
|
|
323
|
+
: 0
|
|
324
|
+
)
|
|
309
325
|
}
|
|
310
326
|
|
|
311
327
|
/**
|
|
@@ -413,7 +429,7 @@ function dotDisplayValue(index: number): number {
|
|
|
413
429
|
return modelValue.value as number
|
|
414
430
|
}
|
|
415
431
|
const values = currentValue.value
|
|
416
|
-
return values[index]
|
|
432
|
+
return isDef(values[index]) ? values[index] : values[0]
|
|
417
433
|
}
|
|
418
434
|
|
|
419
435
|
/**
|
|
@@ -36,6 +36,8 @@ export default {
|
|
|
36
36
|
</script>
|
|
37
37
|
|
|
38
38
|
<script lang="ts" setup>
|
|
39
|
+
import wdIcon from '../wd-icon/wd-icon.vue'
|
|
40
|
+
import wdLoading from '../wd-loading/wd-loading.vue'
|
|
39
41
|
import { computed, type CSSProperties, onBeforeMount } from 'vue'
|
|
40
42
|
import { callInterceptor } from '../../common/interceptor'
|
|
41
43
|
import { addUnit, isDef, isUndefined, objToStyle, omitBy } from '../../common/util'
|
|
@@ -140,6 +140,7 @@ export default {
|
|
|
140
140
|
</script>
|
|
141
141
|
<script lang="ts" setup>
|
|
142
142
|
import wdIcon from '../wd-icon/wd-icon.vue'
|
|
143
|
+
import wdBadge from '../wd-badge/wd-badge.vue'
|
|
143
144
|
import wdSticky from '../wd-sticky/wd-sticky.vue'
|
|
144
145
|
import wdStickyBox from '../wd-sticky-box/wd-sticky-box.vue'
|
|
145
146
|
import { computed, getCurrentInstance, onMounted, watch, nextTick, reactive, type CSSProperties, type ComponentInstance } from 'vue'
|
|
@@ -127,6 +127,7 @@ $tag-extra-large-round-padding: var(--wot-tag-extra-large-round-padding, $n-3 $p
|
|
|
127
127
|
// 超大尺寸图标尺寸
|
|
128
128
|
$tag-extra-large-icon-size: var(--wot-tag-extra-large-icon-size, $n-12) !default;
|
|
129
129
|
|
|
130
|
+
// 这里的顺序决定了生成的 CSS 优先级,default 必须放在首位以确保其他尺寸可以覆盖它
|
|
130
131
|
$tag-types: (
|
|
131
132
|
"default": (
|
|
132
133
|
"color": $tag-info-color,
|
|
@@ -181,6 +182,13 @@ $tag-types: (
|
|
|
181
182
|
);
|
|
182
183
|
|
|
183
184
|
$tag-sizes: (
|
|
185
|
+
"default": (
|
|
186
|
+
"font-size": $tag-default-font-size,
|
|
187
|
+
"line-height": $tag-default-line-height,
|
|
188
|
+
"padding": $tag-default-padding,
|
|
189
|
+
"round-padding": $tag-default-round-padding,
|
|
190
|
+
"icon-size": $tag-default-icon-size
|
|
191
|
+
),
|
|
184
192
|
"small": (
|
|
185
193
|
"font-size": $tag-small-font-size,
|
|
186
194
|
"line-height": $tag-small-line-height,
|
|
@@ -195,13 +203,6 @@ $tag-sizes: (
|
|
|
195
203
|
"round-padding": $tag-medium-round-padding,
|
|
196
204
|
"icon-size": $tag-medium-icon-size
|
|
197
205
|
),
|
|
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
206
|
"large": (
|
|
206
207
|
"font-size": $tag-large-font-size,
|
|
207
208
|
"line-height": $tag-large-line-height,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtractPropTypes } from 'vue'
|
|
1
|
+
import type { ExtractPropTypes, PropType } from 'vue'
|
|
2
2
|
import { baseProps, makeBooleanProp, makeStringProp } from '../../common/props'
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -26,9 +26,9 @@ export const tagProps = {
|
|
|
26
26
|
* 标签尺寸
|
|
27
27
|
* 类型: TagSize
|
|
28
28
|
* 可选值: 'small' | 'medium' | 'large' | 'extra-large' | 'default'
|
|
29
|
-
*
|
|
29
|
+
* 不传则继承全局配置
|
|
30
30
|
*/
|
|
31
|
-
size:
|
|
31
|
+
size: String as PropType<TagSize>,
|
|
32
32
|
/**
|
|
33
33
|
* 标签类型
|
|
34
34
|
* 类型: TagType
|
|
@@ -69,9 +69,12 @@ export const tagProps = {
|
|
|
69
69
|
/**
|
|
70
70
|
* 圆角类型
|
|
71
71
|
* 类型: boolean
|
|
72
|
-
*
|
|
72
|
+
* 不传则继承全局配置
|
|
73
73
|
*/
|
|
74
|
-
round:
|
|
74
|
+
round: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: void 0
|
|
77
|
+
},
|
|
75
78
|
/**
|
|
76
79
|
* 标记类型
|
|
77
80
|
* 类型: boolean
|
|
@@ -82,9 +85,9 @@ export const tagProps = {
|
|
|
82
85
|
* 标签变体
|
|
83
86
|
* 类型: TagVariant
|
|
84
87
|
* 可选值: 'light' | 'dark' | 'plain' | 'dashed' | 'text'
|
|
85
|
-
*
|
|
88
|
+
* 不传则继承全局配置
|
|
86
89
|
*/
|
|
87
|
-
variant:
|
|
90
|
+
variant: String as PropType<TagVariant>
|
|
88
91
|
}
|
|
89
92
|
|
|
90
93
|
export type TagProps = ExtractPropTypes<typeof tagProps>
|
|
@@ -46,15 +46,32 @@ export default {
|
|
|
46
46
|
</script>
|
|
47
47
|
<script lang="ts" setup>
|
|
48
48
|
import wdIcon from '../wd-icon/wd-icon.vue'
|
|
49
|
-
import { objToStyle } from '../../common/util'
|
|
49
|
+
import { objToStyle, isUndefined } from '../../common/util'
|
|
50
50
|
import { computed, ref } from 'vue'
|
|
51
51
|
import { useTranslate } from '../../composables/useTranslate'
|
|
52
52
|
import { tagProps } from './types'
|
|
53
|
+
import { useGlobalConfig } from '../../composables/useGlobalConfig'
|
|
53
54
|
|
|
54
55
|
const props = defineProps(tagProps)
|
|
55
56
|
const emit = defineEmits(['click', 'close', 'confirm'])
|
|
56
57
|
|
|
57
58
|
const { translate } = useTranslate('tag')
|
|
59
|
+
const globalConfig = useGlobalConfig()
|
|
60
|
+
|
|
61
|
+
const effectiveSize = computed(() => {
|
|
62
|
+
return props.size || globalConfig.value.tag?.size || 'default'
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
const effectiveVariant = computed(() => {
|
|
66
|
+
return props.variant || globalConfig.value.tag?.variant || 'dark'
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
const effectiveRound = computed(() => {
|
|
70
|
+
if (isUndefined(props.round)) {
|
|
71
|
+
return isUndefined(globalConfig.value.tag?.round) ? false : globalConfig.value.tag?.round
|
|
72
|
+
}
|
|
73
|
+
return props.round
|
|
74
|
+
})
|
|
58
75
|
|
|
59
76
|
const dynamicValue = ref<string>('')
|
|
60
77
|
const dynamicInput = ref<boolean>(false)
|
|
@@ -63,12 +80,12 @@ const dynamicInput = ref<boolean>(false)
|
|
|
63
80
|
* 根节点类名
|
|
64
81
|
*/
|
|
65
82
|
const rootClass = computed<string>(() => {
|
|
66
|
-
const { type,
|
|
83
|
+
const { type, mark, customClass } = props
|
|
67
84
|
const classList: string[] = []
|
|
68
85
|
type && classList.push(`is-${type}`)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
86
|
+
effectiveVariant.value && classList.push(`is-${effectiveVariant.value}`)
|
|
87
|
+
effectiveSize.value && classList.push(`is-${effectiveSize.value}`)
|
|
88
|
+
effectiveRound.value && classList.push('is-round')
|
|
72
89
|
mark && classList.push('is-mark')
|
|
73
90
|
return `wd-tag ${customClass} ${classList.join(' ')}`
|
|
74
91
|
})
|
|
@@ -78,7 +95,7 @@ const rootClass = computed<string>(() => {
|
|
|
78
95
|
*/
|
|
79
96
|
const rootStyle = computed<string>(() => {
|
|
80
97
|
const rootStyle: Record<string, any> = {}
|
|
81
|
-
if (
|
|
98
|
+
if (effectiveVariant.value !== 'plain' && effectiveVariant.value !== 'dashed' && effectiveVariant.value !== 'text' && props.bgColor) {
|
|
82
99
|
rootStyle['background'] = props.bgColor
|
|
83
100
|
}
|
|
84
101
|
if (props.bgColor) {
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
:custom-class="`wd-toast__icon ${direction === 'vertical' ? 'is-vertical' : ''}`"
|
|
17
17
|
:size="iconSize"
|
|
18
18
|
:class-prefix="classPrefix"
|
|
19
|
+
:color="iconColor"
|
|
19
20
|
:name="toastIcon[iconName]"
|
|
20
21
|
></wd-icon>
|
|
21
22
|
<wd-icon
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
:custom-class="`wd-toast__icon ${direction === 'vertical' ? 'is-vertical' : ''}`"
|
|
24
25
|
:size="iconSize"
|
|
25
26
|
:class-prefix="classPrefix"
|
|
27
|
+
:color="iconColor"
|
|
26
28
|
:name="iconClass"
|
|
27
29
|
:css-icon="cssIcon"
|
|
28
30
|
></wd-icon>
|
|
@@ -65,6 +67,7 @@ const zIndex = ref<number>(100)
|
|
|
65
67
|
const loadingType = ref<ToastLoadingType>('circular')
|
|
66
68
|
const loadingColor = ref<string>('#fff')
|
|
67
69
|
const iconSize = ref<string>() // 图标大小
|
|
70
|
+
const iconColor = ref<string>() // 图标颜色
|
|
68
71
|
const loadingSize = ref<string>() // loading大小
|
|
69
72
|
const cover = ref<boolean>(false) // 是否存在遮罩层
|
|
70
73
|
const classPrefix = ref<string>('wd-icon') // 图标前缀
|
|
@@ -148,6 +151,7 @@ function mergeOptionsWithProps(option: ToastOptions, props: ToastProps) {
|
|
|
148
151
|
loadingType.value = isDef(option.loadingType!) ? option.loadingType! : props.loadingType
|
|
149
152
|
loadingColor.value = isDef(option.loadingColor!) ? option.loadingColor! : props.loadingColor
|
|
150
153
|
iconSize.value = isDef(option.iconSize) ? addUnit(option.iconSize) : isDef(props.iconSize) ? addUnit(props.iconSize) : undefined
|
|
154
|
+
iconColor.value = isDef(option.iconColor!) ? option.iconColor! : props.iconColor
|
|
151
155
|
loadingSize.value = isDef(option.loadingSize) ? addUnit(option.loadingSize) : isDef(props.loadingSize) ? addUnit(props.loadingSize) : undefined
|
|
152
156
|
cover.value = isDef(option.cover!) ? option.cover! : props.cover
|
|
153
157
|
classPrefix.value = isDef(option.classPrefix) ? option.classPrefix : props.classPrefix
|