@didaoktv/didaoui-uniapp 2.13.0 → 2.15.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 +6 -6
- package/components/dd-album/dd-album.vue +280 -228
- package/components/dd-avatar/dd-avatar.vue +132 -75
- package/components/dd-avatar-group/dd-avatar-group.vue +52 -30
- package/components/dd-barcode/dd-barcode.vue +884 -947
- package/components/dd-button/dd-button.vue +47 -21
- package/components/dd-canvas/dd-canvas.vue +1156 -985
- package/components/dd-car-keyboard/dd-car-keyboard.vue +12 -12
- package/components/dd-champion-card/dd-champion-card.vue +49 -21
- package/components/dd-checkbox-group/dd-checkbox-group.vue +2 -0
- package/components/dd-copy/dd-copy.vue +51 -56
- package/components/dd-cropper/dd-cropper.vue +1224 -1135
- package/components/dd-divider/dd-divider.vue +9 -2
- package/components/dd-form/dd-form.vue +2 -0
- package/components/dd-goods-sku/dd-goods-sku.vue +6 -1
- package/components/dd-icon/dd-icon.vue +1 -1
- package/components/dd-keyboard/dd-keyboard.vue +95 -46
- package/components/dd-link/dd-link.vue +72 -49
- package/components/dd-markdown/dd-markdown.vue +154 -154
- package/components/dd-number-keyboard/dd-number-keyboard.vue +109 -94
- package/components/dd-package-sku/dd-package-sku.vue +24 -1
- package/components/dd-parse/dd-parse.vue +473 -442
- package/components/dd-poster/dd-poster.vue +579 -567
- package/components/dd-pull-refresh/dd-pull-refresh.vue +1 -9
- package/components/dd-qrcode/dd-qrcode.vue +431 -405
- package/components/dd-radio-group/dd-radio-group.vue +1 -1
- package/components/dd-segmented-tab/dd-segmented-tab.vue +61 -16
- package/components/dd-signature/dd-signature.vue +377 -357
- package/components/dd-step/dd-step.vue +1 -1
- package/components/dd-sticky/dd-sticky.vue +5 -10
- package/components/dd-swipe-action/dd-swipe-action.vue +1 -9
- package/components/dd-swipe-item/dd-swipe-item.vue +2 -0
- package/components/dd-swipeable-tab/dd-swipeable-tab.vue +1 -5
- package/components/dd-switch/dd-switch.vue +1 -1
- package/components/dd-text/dd-text.vue +304 -82
- package/components/dd-waterfall/dd-waterfall.vue +147 -0
- package/components/dd-waterfall/waterfall.ts +17 -0
- package/index.ts +4 -3
- package/libs/function/index.d.ts +88 -0
- package/libs/function/index.js +14 -0
- package/libs/function/test.d.ts +65 -0
- package/package.json +1 -1
- package/scss/_mixins.scss +8 -0
- package/scss/_theme-tokens.scss +7 -0
- package/scss/_variables.scss +283 -156
- package/components/dd-album/album.js +0 -19
- package/components/dd-album/props.js +0 -89
- package/components/dd-avatar/avatar.js +0 -19
- package/components/dd-avatar/props.js +0 -84
- package/components/dd-avatar-group/avatarGroup.js +0 -14
- package/components/dd-avatar-group/props.js +0 -57
- package/components/dd-keyboard/keyboard.js +0 -19
- package/components/dd-keyboard/props.js +0 -79
- package/components/dd-link/link.js +0 -17
- package/components/dd-link/props.js +0 -44
- package/components/dd-number-keyboard/numberKeyboard.js +0 -8
- package/components/dd-number-keyboard/props.js +0 -24
- package/components/dd-parse/props.js +0 -57
- package/components/dd-text/props.js +0 -120
- package/components/dd-text/text.js +0 -30
- package/components/dd-text/value.js +0 -87
- package/libs/config/color.js +0 -16
- package/libs/config/props.js +0 -184
- package/libs/mixin/button.js +0 -18
- package/libs/mixin/mixin.js +0 -44
- package/libs/mixin/mpMixin.js +0 -13
- package/libs/mixin/openType.js +0 -27
- package/libs/vue.js +0 -3
- package/scss/_dd-shared.scss +0 -40
|
@@ -2,12 +2,9 @@
|
|
|
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
|
+
:class="{ 'dd-seg--sm': size === 'sm', 'dd-seg--no-ellipsis': !ellipsis }"
|
|
6
6
|
>
|
|
7
|
-
<view
|
|
8
|
-
ref="trackRef"
|
|
9
|
-
class="dd-seg__track"
|
|
10
|
-
>
|
|
7
|
+
<view class="dd-seg__track">
|
|
11
8
|
<view
|
|
12
9
|
v-for="(opt, index) in options"
|
|
13
10
|
:key="index"
|
|
@@ -27,7 +24,8 @@
|
|
|
27
24
|
<view
|
|
28
25
|
v-else
|
|
29
26
|
class="dd-seg dd-seg--text"
|
|
30
|
-
:class="{ 'dd-seg--sm': size === 'sm' }"
|
|
27
|
+
:class="{ 'dd-seg--sm': size === 'sm', 'dd-seg--no-ellipsis': !ellipsis }"
|
|
28
|
+
:style="gapStyle"
|
|
31
29
|
>
|
|
32
30
|
<view
|
|
33
31
|
v-for="(opt, index) in options"
|
|
@@ -43,8 +41,7 @@
|
|
|
43
41
|
</template>
|
|
44
42
|
|
|
45
43
|
<script setup lang="ts">
|
|
46
|
-
import { nextTick, onMounted, ref, watch } from 'vue'
|
|
47
|
-
import { getCurrentInstance } from 'vue'
|
|
44
|
+
import { computed, getCurrentInstance, nextTick, onMounted, ref, watch } from 'vue'
|
|
48
45
|
// z-index 统一取 libs/config/zIndex.js(分段项盖住滑块指示器取 base 档)
|
|
49
46
|
import zIndexConfig from '../../libs/config/zIndex.js'
|
|
50
47
|
|
|
@@ -54,6 +51,17 @@ interface Props {
|
|
|
54
51
|
variant?: 'pill' | 'text'
|
|
55
52
|
/** 尺寸:md 标准;sm 小号(与页面 24rpx 字号胶囊控件同高,用于工具行等紧凑场景) */
|
|
56
53
|
size?: 'sm' | 'md'
|
|
54
|
+
/**
|
|
55
|
+
* text 变体水平间距(rpx)。不传则沿用 SCSS 默认 $dd-space-6;
|
|
56
|
+
* 项数多(如 7 项横滑)需要收窄时由消费方显式传值,避免把整体节奏写死在组件里
|
|
57
|
+
*/
|
|
58
|
+
gap?: number
|
|
59
|
+
/**
|
|
60
|
+
* 标签超长是否打点省略。默认 true(单行省略号);
|
|
61
|
+
* false 时不打点也不换行:项改为按内容自适应宽度(放弃等分)、标签强制单行,
|
|
62
|
+
* 总宽超出容器会溢出——标签过长时请精简文案或保留省略
|
|
63
|
+
*/
|
|
64
|
+
ellipsis?: boolean
|
|
57
65
|
}
|
|
58
66
|
|
|
59
67
|
const props = withDefaults(defineProps<Props>(), {
|
|
@@ -61,6 +69,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
61
69
|
options: () => [],
|
|
62
70
|
variant: 'pill',
|
|
63
71
|
size: 'md',
|
|
72
|
+
ellipsis: true,
|
|
64
73
|
})
|
|
65
74
|
|
|
66
75
|
const emit = defineEmits<{
|
|
@@ -70,6 +79,10 @@ const emit = defineEmits<{
|
|
|
70
79
|
|
|
71
80
|
const instance = getCurrentInstance()
|
|
72
81
|
const indicatorStyle = ref({ width: '0px', transform: 'translateX(0px)' })
|
|
82
|
+
// 未传 gap 时不产出内联样式,交回 SCSS 里的 $dd-space-6 兜底
|
|
83
|
+
const gapStyle = computed(() =>
|
|
84
|
+
props.gap === undefined ? undefined : { columnGap: `${props.gap}rpx` },
|
|
85
|
+
)
|
|
73
86
|
|
|
74
87
|
function labelOf(opt: string | { label: string }): string {
|
|
75
88
|
return typeof opt === 'string' ? opt : opt.label
|
|
@@ -95,7 +108,9 @@ function measure() {
|
|
|
95
108
|
const track = res[1] as UniApp.NodeInfo
|
|
96
109
|
if (!items.length || !track) return
|
|
97
110
|
const target = items[props.modelValue]
|
|
98
|
-
|
|
111
|
+
// 宽为 0 说明此刻容器不可见(弹层/抽屉/未激活 tab 内挂载),此时不写入几何:
|
|
112
|
+
// 否则指示块会被钉成 0 宽且再无重测触发(可见性变化不会经过本组件的 watch)
|
|
113
|
+
if (!target || !target.width || !track.width) return
|
|
99
114
|
const left = (target.left || 0) - (track.left || 0)
|
|
100
115
|
indicatorStyle.value = {
|
|
101
116
|
width: (target.width || 0) + 'px',
|
|
@@ -106,8 +121,12 @@ function measure() {
|
|
|
106
121
|
}
|
|
107
122
|
|
|
108
123
|
onMounted(measure)
|
|
109
|
-
|
|
110
|
-
|
|
124
|
+
// modelValue(停靠位)/ options(标签改动或引用变化)/ size(sm↔md 档位,改项宽)三者都影响几何,
|
|
125
|
+
// 统一监听;deep 用于捕捉 options 元素 label 被就地改写(数组引用不变的场景)
|
|
126
|
+
watch([() => props.modelValue, () => props.options, () => props.size], measure, { deep: true })
|
|
127
|
+
|
|
128
|
+
// 隐藏态挂载的补测入口:父级容器变可见后(弹层打开 / tab 切换)调用一次即可收敛
|
|
129
|
+
defineExpose({ refresh: measure })
|
|
111
130
|
</script>
|
|
112
131
|
|
|
113
132
|
<style lang="scss" scoped>
|
|
@@ -122,16 +141,21 @@ watch(() => props.options, measure)
|
|
|
122
141
|
.dd-seg--pill {
|
|
123
142
|
.dd-seg__track {
|
|
124
143
|
position: relative;
|
|
125
|
-
display:
|
|
144
|
+
display: flex;
|
|
145
|
+
width: 100%;
|
|
146
|
+
box-sizing: border-box;
|
|
126
147
|
padding: $dd-space-1;
|
|
127
148
|
background: var(--dd-surface-container-high, #{$dd-surface-container-high});
|
|
128
149
|
border: 1px solid var(--dd-border-default, #{$dd-border-default});
|
|
129
150
|
border-radius: $dd-radius-full;
|
|
130
151
|
}
|
|
131
152
|
|
|
153
|
+
// 等分填充父容器(antd-mobile Segmented 的做法):项按 flex 等分,标签超长省略而非撑破容器
|
|
132
154
|
.dd-seg__item {
|
|
133
155
|
position: relative;
|
|
134
|
-
|
|
156
|
+
flex: 1 1 0;
|
|
157
|
+
min-width: 0;
|
|
158
|
+
overflow: hidden;
|
|
135
159
|
padding: 12rpx $dd-space-4;
|
|
136
160
|
@include dd-flex-center;
|
|
137
161
|
color: var(--dd-text-tertiary, #{$dd-text-tertiary});
|
|
@@ -148,7 +172,6 @@ watch(() => props.options, measure)
|
|
|
148
172
|
// sm 小号:字号 caption(12px=24rpx)、更紧内边距,整体高度对齐页面 24rpx 字号胶囊
|
|
149
173
|
&.dd-seg--sm {
|
|
150
174
|
.dd-seg__item {
|
|
151
|
-
min-width: 96rpx;
|
|
152
175
|
padding: $dd-space-1;
|
|
153
176
|
font-size: $dd-font-size-caption;
|
|
154
177
|
}
|
|
@@ -161,7 +184,7 @@ watch(() => props.options, measure)
|
|
|
161
184
|
left: 0;
|
|
162
185
|
background: $dd-color-white;
|
|
163
186
|
border-radius: $dd-radius-full;
|
|
164
|
-
box-shadow:
|
|
187
|
+
box-shadow: var(--dd-shadow-1, #{$dd-shadow-1});
|
|
165
188
|
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
|
|
166
189
|
width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
167
190
|
}
|
|
@@ -171,7 +194,9 @@ watch(() => props.options, measure)
|
|
|
171
194
|
.dd-seg--text {
|
|
172
195
|
display: flex;
|
|
173
196
|
flex-direction: row;
|
|
174
|
-
|
|
197
|
+
flex-wrap: wrap;
|
|
198
|
+
column-gap: $dd-space-6;
|
|
199
|
+
row-gap: $dd-space-2;
|
|
175
200
|
|
|
176
201
|
&.dd-seg--sm {
|
|
177
202
|
.dd-seg-text__item {
|
|
@@ -209,4 +234,24 @@ watch(() => props.options, measure)
|
|
|
209
234
|
line-height: 1.2;
|
|
210
235
|
@include dd-ellipsis(1);
|
|
211
236
|
}
|
|
237
|
+
|
|
238
|
+
// ellipsis=false:不打点不换行,项按内容自适应宽度(放弃等分),标签强制单行;
|
|
239
|
+
// ponytail: 总宽超出容器会溢出(未做横滑),标签过长请精简文案或保留省略
|
|
240
|
+
.dd-seg--no-ellipsis {
|
|
241
|
+
.dd-seg__item,
|
|
242
|
+
.dd-seg-text__item {
|
|
243
|
+
flex: 0 0 auto;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.dd-seg__label {
|
|
247
|
+
overflow: visible;
|
|
248
|
+
white-space: nowrap;
|
|
249
|
+
text-overflow: clip;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// text 变体容器本可换行,no-ellipsis 时整体强制单行
|
|
254
|
+
.dd-seg--text.dd-seg--no-ellipsis {
|
|
255
|
+
flex-wrap: nowrap;
|
|
256
|
+
}
|
|
212
257
|
</style>
|