@didaoktv/didaoui-uniapp 1.3.6 → 1.3.8
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/components/dd-button/dd-button.vue +33 -2
- package/components/dd-cell/dd-cell.vue +10 -5
- package/components/dd-dialog/dd-dialog.vue +13 -4
- package/components/dd-empty-state/dd-empty-state.vue +2 -2
- package/components/dd-input/dd-input.vue +6 -2
- package/components/dd-segmented-tab/dd-segmented-tab.vue +24 -1
- package/package.json +2 -1
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
{
|
|
8
8
|
'dd-btn--block': block,
|
|
9
9
|
'dd-btn--round': round,
|
|
10
|
+
'dd-btn--plain': plain,
|
|
10
11
|
'dd-btn--icon-right': iconPosition === 'right',
|
|
11
12
|
'dd-btn--icon-only': isIconOnly,
|
|
12
13
|
'dd-btn--loading': loading,
|
|
@@ -31,10 +32,11 @@ import { computed, useSlots } from 'vue'
|
|
|
31
32
|
import DdIcon from '../dd-icon/dd-icon.vue'
|
|
32
33
|
|
|
33
34
|
interface Props {
|
|
34
|
-
type?: 'primary' | 'secondary' | 'ghost' | 'text' | 'success' | 'warning' | 'danger'
|
|
35
|
+
type?: 'default' | 'primary' | 'secondary' | 'ghost' | 'text' | 'success' | 'warning' | 'danger'
|
|
35
36
|
size?: 'sm' | 'md' | 'lg'
|
|
36
37
|
block?: boolean
|
|
37
38
|
round?: boolean
|
|
39
|
+
plain?: boolean
|
|
38
40
|
iconPosition?: 'left' | 'right'
|
|
39
41
|
icon?: string
|
|
40
42
|
loading?: boolean
|
|
@@ -46,6 +48,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
46
48
|
size: 'md',
|
|
47
49
|
block: false,
|
|
48
50
|
round: false,
|
|
51
|
+
plain: false,
|
|
49
52
|
iconPosition: 'left',
|
|
50
53
|
icon: '',
|
|
51
54
|
loading: false,
|
|
@@ -149,6 +152,11 @@ function onClick(e: Event) {
|
|
|
149
152
|
}
|
|
150
153
|
}
|
|
151
154
|
|
|
155
|
+
.dd-btn--default {
|
|
156
|
+
background: var(--dd-surface-container, #{$dd-surface-container});
|
|
157
|
+
color: var(--dd-text-primary, #{$dd-text-primary});
|
|
158
|
+
border-color: var(--dd-border-default, #{$dd-border-default});
|
|
159
|
+
}
|
|
152
160
|
.dd-btn--primary {
|
|
153
161
|
background: var(--dd-primary, #{$dd-primary});
|
|
154
162
|
color: $dd-neutral-50;
|
|
@@ -190,6 +198,28 @@ function onClick(e: Event) {
|
|
|
190
198
|
color: var(--dd-error-contrast, #{$dd-error-contrast});
|
|
191
199
|
}
|
|
192
200
|
|
|
201
|
+
// plain:线框按钮,透明底 + 保留各 type 的主题色文字/描边(对齐 Vant 语义)
|
|
202
|
+
.dd-btn--plain {
|
|
203
|
+
background: transparent;
|
|
204
|
+
border-color: currentColor;
|
|
205
|
+
&.dd-btn--primary {
|
|
206
|
+
color: var(--dd-primary, #{$dd-primary});
|
|
207
|
+
}
|
|
208
|
+
&.dd-btn--secondary {
|
|
209
|
+
color: var(--dd-primary-400, #{$dd-primary-400});
|
|
210
|
+
border-color: var(--dd-primary-400, #{$dd-primary-400});
|
|
211
|
+
}
|
|
212
|
+
&.dd-btn--success {
|
|
213
|
+
color: var(--dd-success, #{$dd-success});
|
|
214
|
+
}
|
|
215
|
+
&.dd-btn--warning {
|
|
216
|
+
color: var(--dd-warning, #{$dd-warning});
|
|
217
|
+
}
|
|
218
|
+
&.dd-btn--danger {
|
|
219
|
+
color: var(--dd-error, #{$dd-error});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
193
223
|
.dd-btn--round {
|
|
194
224
|
border-radius: $dd-radius-full;
|
|
195
225
|
}
|
|
@@ -201,7 +231,8 @@ function onClick(e: Event) {
|
|
|
201
231
|
opacity: 0.85;
|
|
202
232
|
}
|
|
203
233
|
.dd-btn--secondary.dd-btn--hover,
|
|
204
|
-
.dd-btn--ghost.dd-btn--hover
|
|
234
|
+
.dd-btn--ghost.dd-btn--hover,
|
|
235
|
+
.dd-btn--default.dd-btn--hover {
|
|
205
236
|
opacity: 0.7;
|
|
206
237
|
}
|
|
207
238
|
|
|
@@ -124,15 +124,20 @@ function handleClick(e: Event) {
|
|
|
124
124
|
padding: 0 24rpx 0 $dd-space-4;
|
|
125
125
|
background: var(--dd-bg-elevated, #{$dd-bg-elevated});
|
|
126
126
|
font-size: $dd-font-size-body;
|
|
127
|
+
// vant 式恒定行高(24px),title/value/label/icon 全部基线对齐
|
|
128
|
+
line-height: $dd-line-height-lead;
|
|
127
129
|
color: var(--dd-text-primary, #{$dd-text-primary});
|
|
128
130
|
@include dd-hairline-bottom(var(--dd-border-subtle, #{$dd-border-subtle}));
|
|
129
131
|
|
|
132
|
+
// vant 式:高度 = 垂直 padding + 行高(12/16px × 2 + 23.8px ≈ 96/112rpx),内容天然居中
|
|
130
133
|
&--normal {
|
|
131
|
-
|
|
134
|
+
padding-top: $dd-space-3;
|
|
135
|
+
padding-bottom: $dd-space-3;
|
|
132
136
|
}
|
|
133
137
|
|
|
134
138
|
&--large {
|
|
135
|
-
|
|
139
|
+
padding-top: $dd-space-4;
|
|
140
|
+
padding-bottom: $dd-space-4;
|
|
136
141
|
}
|
|
137
142
|
|
|
138
143
|
&--center {
|
|
@@ -154,7 +159,8 @@ function handleClick(e: Event) {
|
|
|
154
159
|
margin-right: $dd-space-2;
|
|
155
160
|
display: flex;
|
|
156
161
|
align-items: center;
|
|
157
|
-
|
|
162
|
+
// ponytail: stretch 拉伸到兄弟 content 高度使图标居中于首行;title+label 多行时会居中于整块而非首行(vant 是贴首行),如需精确可改为固定行高盒
|
|
163
|
+
align-self: stretch;
|
|
158
164
|
}
|
|
159
165
|
|
|
160
166
|
&__icon-text {
|
|
@@ -167,7 +173,7 @@ function handleClick(e: Event) {
|
|
|
167
173
|
color: var(--dd-error, #{$dd-error});
|
|
168
174
|
font-size: $dd-font-size-body;
|
|
169
175
|
margin-right: 4rpx;
|
|
170
|
-
line-height:
|
|
176
|
+
line-height: inherit;
|
|
171
177
|
text {
|
|
172
178
|
line-height: 1;
|
|
173
179
|
}
|
|
@@ -179,7 +185,6 @@ function handleClick(e: Event) {
|
|
|
179
185
|
display: flex;
|
|
180
186
|
flex-direction: column;
|
|
181
187
|
justify-content: center;
|
|
182
|
-
padding: $dd-space-2 0;
|
|
183
188
|
}
|
|
184
189
|
|
|
185
190
|
&__title {
|
|
@@ -17,8 +17,9 @@
|
|
|
17
17
|
<text class="dd-dialog__title">{{ title }}</text>
|
|
18
18
|
</view>
|
|
19
19
|
<view class="dd-dialog__body" :class="{ 'dd-dialog__body--isolated': !title }">
|
|
20
|
+
<!-- message 与 slot 共存(slot 在下):prompt 型弹窗需同时展示说明文案与输入内容 -->
|
|
20
21
|
<text v-if="message" class="dd-dialog__message">{{ message }}</text>
|
|
21
|
-
<slot
|
|
22
|
+
<slot></slot>
|
|
22
23
|
</view>
|
|
23
24
|
<view v-if="showConfirmButton || showCancelButton" class="dd-dialog__footer" :class="`dd-dialog__footer--${theme}`">
|
|
24
25
|
<template v-if="theme === 'round-button'">
|
|
@@ -83,6 +84,8 @@ interface Props {
|
|
|
83
84
|
cancelColor?: string
|
|
84
85
|
width?: string | number
|
|
85
86
|
closeOnClickOverlay?: boolean
|
|
87
|
+
/** 异步关闭:确认/取消/遮罩只发事件不自动关窗,由调用方(如表单校验)自行控制 modelValue */
|
|
88
|
+
asyncClose?: boolean
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
const props = withDefaults(defineProps<Props>(), {
|
|
@@ -98,6 +101,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
98
101
|
cancelColor: '',
|
|
99
102
|
width: '640rpx',
|
|
100
103
|
closeOnClickOverlay: false,
|
|
104
|
+
asyncClose: false,
|
|
101
105
|
})
|
|
102
106
|
|
|
103
107
|
const emit = defineEmits<{
|
|
@@ -133,17 +137,17 @@ function close() {
|
|
|
133
137
|
function onOverlayClick() {
|
|
134
138
|
if (!props.closeOnClickOverlay) return
|
|
135
139
|
emit('cancel')
|
|
136
|
-
close()
|
|
140
|
+
if (!props.asyncClose) close()
|
|
137
141
|
}
|
|
138
142
|
|
|
139
143
|
function onConfirm() {
|
|
140
144
|
emit('confirm')
|
|
141
|
-
close()
|
|
145
|
+
if (!props.asyncClose) close()
|
|
142
146
|
}
|
|
143
147
|
|
|
144
148
|
function onCancel() {
|
|
145
149
|
emit('cancel')
|
|
146
|
-
close()
|
|
150
|
+
if (!props.asyncClose) close()
|
|
147
151
|
}
|
|
148
152
|
</script>
|
|
149
153
|
|
|
@@ -237,6 +241,11 @@ function onCancel() {
|
|
|
237
241
|
&--cancel {
|
|
238
242
|
border-right: 1px solid var(--dd-border-subtle, #{$dd-border-subtle});
|
|
239
243
|
}
|
|
244
|
+
|
|
245
|
+
/* 确认按钮文字默认主色;confirmColor 传入时走内联样式覆盖 */
|
|
246
|
+
&--confirm .dd-dialog__btn-text {
|
|
247
|
+
color: var(--dd-primary, #{$dd-primary});
|
|
248
|
+
}
|
|
240
249
|
}
|
|
241
250
|
|
|
242
251
|
&__btn-text {
|
|
@@ -37,7 +37,7 @@ import DdIcon from '../dd-icon/dd-icon.vue'
|
|
|
37
37
|
|
|
38
38
|
interface Props {
|
|
39
39
|
modelValue?: string | number
|
|
40
|
-
type?: 'text' | 'password' | 'search' | 'number'
|
|
40
|
+
type?: 'text' | 'password' | 'search' | 'number' | 'digit'
|
|
41
41
|
placeholder?: string
|
|
42
42
|
disabled?: boolean
|
|
43
43
|
clearable?: boolean
|
|
@@ -70,7 +70,11 @@ const isFocused = ref(false)
|
|
|
70
70
|
const visible = ref(false)
|
|
71
71
|
|
|
72
72
|
// ponytail: search 在小程序降级为 text;password 用 uni 原生 password 布尔属性跨端
|
|
73
|
-
const inputType = computed<'text' | 'number'>(() =>
|
|
73
|
+
const inputType = computed<'text' | 'number' | 'digit'>(() => {
|
|
74
|
+
if (props.type === 'number') return 'number'
|
|
75
|
+
if (props.type === 'digit') return 'digit'
|
|
76
|
+
return 'text'
|
|
77
|
+
})
|
|
74
78
|
const isPassword = computed(() => props.type === 'password' && !visible.value)
|
|
75
79
|
const confirmType = computed(() => (props.type === 'search' ? 'search' : 'done'))
|
|
76
80
|
const showClear = computed(() => props.clearable && !!props.modelValue && !props.disabled)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<view
|
|
3
3
|
v-if="variant === 'pill'"
|
|
4
4
|
class="dd-seg dd-seg--pill"
|
|
5
|
+
:class="{ 'dd-seg--sm': size === 'sm' }"
|
|
5
6
|
>
|
|
6
7
|
<view
|
|
7
8
|
ref="trackRef"
|
|
@@ -22,7 +23,11 @@
|
|
|
22
23
|
></view>
|
|
23
24
|
</view>
|
|
24
25
|
</view>
|
|
25
|
-
<view
|
|
26
|
+
<view
|
|
27
|
+
v-else
|
|
28
|
+
class="dd-seg dd-seg--text"
|
|
29
|
+
:class="{ 'dd-seg--sm': size === 'sm' }"
|
|
30
|
+
>
|
|
26
31
|
<view
|
|
27
32
|
v-for="(opt, index) in options"
|
|
28
33
|
:key="index"
|
|
@@ -44,12 +49,15 @@ interface Props {
|
|
|
44
49
|
modelValue?: number
|
|
45
50
|
options?: (string | { label: string })[]
|
|
46
51
|
variant?: 'pill' | 'text'
|
|
52
|
+
/** 尺寸:md 标准;sm 小号(与页面 24rpx 字号胶囊控件同高,用于工具行等紧凑场景) */
|
|
53
|
+
size?: 'sm' | 'md'
|
|
47
54
|
}
|
|
48
55
|
|
|
49
56
|
const props = withDefaults(defineProps<Props>(), {
|
|
50
57
|
modelValue: 0,
|
|
51
58
|
options: () => [],
|
|
52
59
|
variant: 'pill',
|
|
60
|
+
size: 'md',
|
|
53
61
|
})
|
|
54
62
|
|
|
55
63
|
const emit = defineEmits<{
|
|
@@ -135,6 +143,15 @@ watch(() => props.options, measure)
|
|
|
135
143
|
}
|
|
136
144
|
}
|
|
137
145
|
|
|
146
|
+
// sm 小号:字号 caption(12px=24rpx)、更紧内边距,整体高度对齐页面 24rpx 字号胶囊
|
|
147
|
+
&.dd-seg--sm {
|
|
148
|
+
.dd-seg__item {
|
|
149
|
+
min-width: 96rpx;
|
|
150
|
+
padding: $dd-space-1;
|
|
151
|
+
font-size: $dd-font-size-caption;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
138
155
|
.dd-seg__indicator {
|
|
139
156
|
position: absolute;
|
|
140
157
|
top: $dd-space-1;
|
|
@@ -154,6 +171,12 @@ watch(() => props.options, measure)
|
|
|
154
171
|
flex-direction: row;
|
|
155
172
|
gap: $dd-space-6;
|
|
156
173
|
|
|
174
|
+
&.dd-seg--sm {
|
|
175
|
+
.dd-seg-text__item {
|
|
176
|
+
font-size: $dd-font-size-caption;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
157
180
|
.dd-seg-text__item {
|
|
158
181
|
position: relative;
|
|
159
182
|
padding: $dd-space-2 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@didaoktv/didaoui-uniapp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.8",
|
|
4
4
|
"description": "帝到KTV UniApp 组件库",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"types": "index.ts",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"dev:h5": "cd ../DidaoUI-uniapp-docs/h5-demo && npm run dev:h5",
|
|
25
25
|
"build:docs": "cd ../DidaoUI-uniapp-docs && npm run build",
|
|
26
26
|
"type-check": "vue-tsc --noEmit",
|
|
27
|
+
"bump:consumers": "node scripts/bump-consumers.mjs",
|
|
27
28
|
"prepublishOnly": "node -e \"const p=require('./package.json');if(p.publishConfig&&p.publishConfig.access==='public'){process.exit(0)}console.error('publishConfig.access must be public');process.exit(1)\""
|
|
28
29
|
},
|
|
29
30
|
"publishConfig": {
|