@didaoktv/didaoui-uniapp 2.10.0 → 2.11.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.
@@ -51,7 +51,8 @@ interface Props {
51
51
  label?: string
52
52
  value?: string
53
53
  icon?: string
54
- size?: 'normal' | 'large'
54
+ /** 尺寸档:sm 紧凑 / md 默认 / lg 宽松,同时改变行高与字号 */
55
+ size?: 'sm' | 'md' | 'lg'
55
56
  isLink?: boolean
56
57
  arrowDirection?: 'left' | 'right' | 'up' | 'down'
57
58
  required?: boolean | 'auto'
@@ -70,7 +71,7 @@ const props = withDefaults(defineProps<Props>(), {
70
71
  label: '',
71
72
  value: '',
72
73
  icon: '',
73
- size: 'normal',
74
+ size: 'md',
74
75
  isLink: false,
75
76
  arrowDirection: 'right',
76
77
  required: false,
@@ -129,15 +130,21 @@ function handleClick(e: Event) {
129
130
  color: var(--dd-text-primary, #{$dd-text-primary});
130
131
  @include dd-hairline-bottom(var(--dd-border-subtle, #{$dd-border-subtle}));
131
132
 
132
- // 高度 = 垂直 padding + 行高(12/16px × 2 + 23.8px ≈ 96/112rpx),内容天然居中
133
- &--normal {
134
- padding-top: $dd-space-3;
135
- padding-bottom: $dd-space-3;
133
+ // 尺寸档由竖直 padding(8/12/16px)+ 根字号(12/14/16px)派生,横向留白恒定;
134
+ // 子元素字号统一用 em 跟随根字号,避免逐档重复声明
135
+ padding-top: $dd-space-3;
136
+ padding-bottom: $dd-space-3;
137
+
138
+ &--sm {
139
+ padding-top: $dd-space-2;
140
+ padding-bottom: $dd-space-2;
141
+ font-size: $dd-font-size-caption;
136
142
  }
137
143
 
138
- &--large {
144
+ &--lg {
139
145
  padding-top: $dd-space-4;
140
146
  padding-bottom: $dd-space-4;
147
+ font-size: $dd-font-size-lead;
141
148
  }
142
149
 
143
150
  &--center {
@@ -164,14 +171,14 @@ function handleClick(e: Event) {
164
171
  }
165
172
 
166
173
  &__icon-text {
167
- font-size: 36rpx;
174
+ font-size: 1.286em;
168
175
  line-height: 1;
169
176
  color: var(--dd-primary-400, #{$dd-primary-400});
170
177
  }
171
178
 
172
179
  &__required {
173
180
  color: var(--dd-error, #{$dd-error});
174
- font-size: $dd-font-size-body;
181
+ font-size: 1em;
175
182
  margin-right: 4rpx;
176
183
  line-height: inherit;
177
184
  text {
@@ -188,14 +195,14 @@ function handleClick(e: Event) {
188
195
  }
189
196
 
190
197
  &__title {
191
- font-size: $dd-font-size-body;
198
+ font-size: 1em;
192
199
  color: var(--dd-text-primary, #{$dd-text-primary});
193
200
  @include dd-ellipsis(1);
194
201
  }
195
202
 
196
203
  &__label {
197
204
  margin-top: 4rpx;
198
- font-size: $dd-font-size-caption;
205
+ font-size: 0.857em;
199
206
  color: var(--dd-text-tertiary, #{$dd-text-tertiary});
200
207
  @include dd-ellipsis(1);
201
208
  }
@@ -209,12 +216,12 @@ function handleClick(e: Event) {
209
216
  }
210
217
 
211
218
  &__value {
212
- font-size: $dd-font-size-body;
219
+ font-size: 1em;
213
220
  color: var(--dd-text-tertiary, #{$dd-text-tertiary});
214
221
  }
215
222
 
216
223
  &__arrow {
217
- font-size: $dd-font-size-h4;
224
+ font-size: 1.143em;
218
225
 
219
226
  &--right {
220
227
  transform: rotate(0deg);
@@ -1,6 +1,10 @@
1
1
  <template>
2
2
  <view>
3
- <view v-if="title || $slots.title" class="dd-cell-group__title" :class="{ 'dd-cell-group__title--inset': inset }">
3
+ <view
4
+ v-if="title || $slots.title"
5
+ class="dd-cell-group__title"
6
+ :class="[`dd-cell-group__title--${size}`, { 'dd-cell-group__title--inset': inset }]"
7
+ >
4
8
  <slot name="title">{{ title }}</slot>
5
9
  </view>
6
10
  <view class="dd-cell-group" :class="{ 'dd-cell-group--inset': inset, 'dd-cell-group--border': border && !inset }">
@@ -16,12 +20,15 @@ interface Props {
16
20
  inset?: boolean
17
21
  /** 通栏模式下的首尾外框发丝线 */
18
22
  border?: boolean
23
+ /** 分节标题尺寸档,只影响标题排版,不向子 cell 传递 */
24
+ size?: 'sm' | 'md' | 'lg'
19
25
  }
20
26
 
21
27
  withDefaults(defineProps<Props>(), {
22
28
  title: '',
23
29
  inset: false,
24
30
  border: true,
31
+ size: 'md',
25
32
  })
26
33
  </script>
27
34
 
@@ -51,12 +58,26 @@ withDefaults(defineProps<Props>(), {
51
58
  }
52
59
 
53
60
  .dd-cell-group__title {
54
- padding: 32rpx 32rpx 16rpx;
61
+ padding: $dd-space-4 $dd-space-4 $dd-space-2;
55
62
  font-size: $dd-font-size-caption;
56
63
  color: var(--dd-text-tertiary, #{$dd-text-tertiary});
57
64
 
58
65
  &--inset {
59
- padding: 32rpx 24rpx 16rpx;
66
+ padding-left: $dd-space-3;
67
+ padding-right: $dd-space-3;
68
+ }
69
+
70
+ // 尺寸档只调标题排版(竖直 padding + 字号),不级联到子 cell
71
+ &--sm {
72
+ padding-top: $dd-space-3;
73
+ padding-bottom: $dd-space-1;
74
+ font-size: $dd-font-size-overline;
75
+ }
76
+
77
+ &--lg {
78
+ padding-top: $dd-space-5;
79
+ padding-bottom: $dd-space-3;
80
+ font-size: $dd-font-size-body;
60
81
  }
61
82
  }
62
83
  </style>
@@ -3,6 +3,7 @@
3
3
  class="dd-field"
4
4
  :class="[
5
5
  rootClass,
6
+ `dd-field--${size}`,
6
7
  {
7
8
  'dd-field--error': errorState,
8
9
  'dd-field--disabled': disabledState,
@@ -11,7 +12,6 @@
11
12
  'dd-field--center': center,
12
13
  'dd-field--label-top': effectiveLabelPosition === 'top',
13
14
  'dd-field--clickable': clickableState,
14
- 'dd-field--large': size === 'large',
15
15
  },
16
16
  ]"
17
17
  :hover-class="clickableState ? 'dd-field--active' : ''"
@@ -140,8 +140,8 @@ interface Props {
140
140
  clickable?: boolean
141
141
  isLink?: boolean
142
142
  arrowDirection?: 'left' | 'right' | 'up' | 'down'
143
- /** 单元格尺寸,large 增大行高(与 dd-cell 对齐) */
144
- size?: 'normal' | 'large'
143
+ /** 单元格尺寸档,与 dd-cell 的 sm/md/lg 同一套竖直 rhythm(8/12/16px) */
144
+ size?: 'sm' | 'md' | 'lg'
145
145
  icon?: string
146
146
  leftIcon?: string
147
147
  rightIcon?: string
@@ -193,7 +193,7 @@ const props = withDefaults(defineProps<Props>(), {
193
193
  clickable: false,
194
194
  isLink: false,
195
195
  arrowDirection: 'right',
196
- size: 'normal',
196
+ size: 'md',
197
197
  icon: '',
198
198
  leftIcon: '',
199
199
  rightIcon: '',
@@ -437,7 +437,7 @@ defineExpose({ validate, validateWithTrigger, resetValidation, scrollIntoView, f
437
437
  width: 100%;
438
438
  // 单行/多行统一以 md 档为下限(border-box 下 padding 已含);textarea 靠内容自然增高,min-height 不限高
439
439
  min-height: $dd-size-control-md;
440
- padding: 20rpx $dd-space-4;
440
+ padding: $dd-space-3 $dd-space-4;
441
441
  overflow: hidden;
442
442
  font-size: $dd-font-size-body;
443
443
  line-height: $dd-line-height-lead;
@@ -457,9 +457,14 @@ defineExpose({ validate, validateWithTrigger, resetValidation, scrollIntoView, f
457
457
  transform: scaleY(0.5);
458
458
  }
459
459
 
460
- &--large {
461
- padding-top: $dd-space-3;
462
- padding-bottom: $dd-space-3;
460
+ &--sm {
461
+ padding-top: $dd-space-2;
462
+ padding-bottom: $dd-space-2;
463
+ }
464
+
465
+ &--lg {
466
+ padding-top: $dd-space-4;
467
+ padding-bottom: $dd-space-4;
463
468
  }
464
469
 
465
470
  &--center {
@@ -1,7 +1,10 @@
1
1
  <template>
2
2
  <view
3
3
  class="dd-list-cell"
4
- :class="{ 'dd-list-cell--link': isLink || arrow, 'dd-list-cell--borderless': borderless }"
4
+ :class="[
5
+ `dd-list-cell--${size}`,
6
+ { 'dd-list-cell--link': isLink || arrow, 'dd-list-cell--borderless': borderless },
7
+ ]"
5
8
  :hover-class="isLink || arrow ? 'dd-list-cell--active' : ''"
6
9
  :hover-stay-time="100"
7
10
  @click="onClick"
@@ -38,6 +41,8 @@ interface Props {
38
41
  subtitle?: string
39
42
  value?: string
40
43
  icon?: string
44
+ /** 尺寸档:sm 紧凑 / md 默认 / lg 宽松,同时改变行高与字号 */
45
+ size?: 'sm' | 'md' | 'lg'
41
46
  arrow?: boolean
42
47
  isLink?: boolean
43
48
  borderless?: boolean
@@ -48,6 +53,7 @@ const props = withDefaults(defineProps<Props>(), {
48
53
  subtitle: '',
49
54
  value: '',
50
55
  icon: '',
56
+ size: 'md',
51
57
  arrow: false,
52
58
  isLink: false,
53
59
  borderless: false,
@@ -71,12 +77,29 @@ function onClick(e: Event) {
71
77
  display: flex;
72
78
  flex-direction: row;
73
79
  align-items: center;
80
+ // 行高以 min-height 定档(md 48px = 原值),padding 只负责内容区留白与撑高
74
81
  min-height: $dd-space-7;
75
- padding: 0 $dd-space-4;
82
+ padding: $dd-space-3 $dd-space-4;
76
83
  box-sizing: border-box;
77
84
  background: var(--dd-bg-elevated, #{$dd-bg-elevated});
85
+ font-size: $dd-font-size-body;
78
86
  @include dd-hairline-bottom(var(--dd-border-default, #{$dd-border-default}));
79
87
 
88
+ // 三档:44/48/56px(sm 取控件 md 档 = 44px 触控下限),字号 12/14/16px 同步缩放
89
+ &--sm {
90
+ min-height: $dd-size-control-md;
91
+ padding-top: $dd-space-2;
92
+ padding-bottom: $dd-space-2;
93
+ font-size: $dd-font-size-caption;
94
+ }
95
+
96
+ &--lg {
97
+ min-height: $dd-space-7 + $dd-space-2;
98
+ padding-top: $dd-space-4;
99
+ padding-bottom: $dd-space-4;
100
+ font-size: $dd-font-size-lead;
101
+ }
102
+
80
103
  &__icon {
81
104
  flex-shrink: 0;
82
105
  width: 56rpx;
@@ -88,7 +111,7 @@ function onClick(e: Event) {
88
111
  }
89
112
 
90
113
  &__icon-text {
91
- font-size: $dd-font-size-h2;
114
+ font-size: 1.429em;
92
115
  line-height: 1;
93
116
  color: var(--dd-primary-400, #{$dd-primary-400});
94
117
  }
@@ -102,14 +125,14 @@ function onClick(e: Event) {
102
125
  }
103
126
 
104
127
  &__title {
105
- font-size: $dd-font-size-body;
128
+ font-size: 1em;
106
129
  font-weight: 500;
107
130
  color: var(--dd-text-primary, #{$dd-text-primary});
108
131
  @include dd-ellipsis(1);
109
132
  }
110
133
 
111
134
  &__subtitle {
112
- font-size: $dd-font-size-caption;
135
+ font-size: 0.857em;
113
136
  color: var(--dd-text-tertiary, #{$dd-text-tertiary});
114
137
  @include dd-ellipsis(1);
115
138
  }
@@ -123,13 +146,13 @@ function onClick(e: Event) {
123
146
  }
124
147
 
125
148
  &__value {
126
- font-size: $dd-font-size-body;
149
+ font-size: 1em;
127
150
  font-weight: 500;
128
151
  color: var(--dd-primary-400, #{$dd-primary-400});
129
152
  }
130
153
 
131
154
  &__arrow {
132
- font-size: $dd-font-size-h3;
155
+ font-size: 1.286em;
133
156
  color: var(--dd-text-tertiary, #{$dd-text-tertiary});
134
157
  line-height: 1;
135
158
  margin-left: $dd-space-1;
@@ -5,11 +5,11 @@
5
5
  :class="['dd-price--' + size, { 'dd-price--custom-color': color }]"
6
6
  :style="color ? { color } : undefined"
7
7
  >
8
- <text v-if="prefix" class="dd-price__prefix">{{ prefix }}</text>
8
+ <text v-if="prefix" class="dd-price__prefix" :style="prefixColor ? { color: prefixColor } : undefined">{{ prefix }}</text>
9
9
  <text class="dd-price__currency">{{ currency }}</text>
10
10
  <text class="dd-price__integer">{{ pricePair[0] }}</text>
11
11
  <text v-if="pricePair[1]" class="dd-price__decimal">{{ mark }}{{ pricePair[1] }}</text>
12
- <text v-if="suffix" class="dd-price__suffix">{{ suffix }}</text>
12
+ <text v-if="suffix" class="dd-price__suffix" :style="suffixColor ? { color: suffixColor } : undefined">{{ suffix }}</text>
13
13
  </view>
14
14
  </template>
15
15
 
@@ -31,8 +31,12 @@ interface Props {
31
31
  suffix?: string
32
32
  /** 尺寸:xxs 紧凑行最小号(房态卡片等 22rpx 正文旁)/ xs 最小号(一行四列小卡)/ sm 小号(购物车行/小卡)/ md 常规 / lg 大号(结算条/合计) */
33
33
  size?: 'xxs' | 'xs' | 'sm' | 'md' | 'lg'
34
- /** 主色(CSS 颜色/变量):整数、货币符、小数一起变色;不传则 inherit 跟随上下文(货币符/小数保持次级灰) */
34
+ /** 主色(CSS 颜色/变量):整数、货币符、小数、前缀、后缀一起变色;不传则 inherit 跟随上下文(货币符/小数/前后缀保持次级灰) */
35
35
  color?: string
36
+ /** 前缀颜色:不传默认跟随 color(color 也不传时保持次级灰) */
37
+ prefixColor?: string
38
+ /** 后缀颜色:不传默认跟随 color(color 也不传时保持次级灰) */
39
+ suffixColor?: string
36
40
  }
37
41
 
38
42
  const props = withDefaults(defineProps<Props>(), {
@@ -44,6 +48,8 @@ const props = withDefaults(defineProps<Props>(), {
44
48
  suffix: '',
45
49
  size: 'md',
46
50
  color: '',
51
+ prefixColor: '',
52
+ suffixColor: '',
47
53
  })
48
54
 
49
55
  const pricePair = computed<string[] | null>(() => {
@@ -88,8 +94,11 @@ const pricePair = computed<string[] | null>(() => {
88
94
  font-size: 24rpx;
89
95
  }
90
96
 
91
- // 自定义主色:货币符/小数默认是次级灰,传 color 时统一跟随主色
97
+ // 自定义主色:前后缀/货币符/小数默认是次级灰,传 color 时统一跟随主色
98
+ // prefixColor / suffixColor 单独传入时由行内 style 覆盖这里的 inherit
92
99
  &--custom-color {
100
+ .dd-price__prefix,
101
+ .dd-price__suffix,
93
102
  .dd-price__currency,
94
103
  .dd-price__decimal {
95
104
  color: inherit;
@@ -17,8 +17,12 @@
17
17
  </view>
18
18
  </view>
19
19
  <view class="dd-step__content">
20
- <text class="dd-step__title">{{ title }}</text>
21
- <text v-if="description" class="dd-step__desc">{{ description }}</text>
20
+ <!-- 默认插槽:传内容即整体接管标题/描述区(如自定义 tag、右对齐时间等富文本行);
21
+ 未传内容时渲染 title/description 兜底,保持既有用法不变 -->
22
+ <slot>
23
+ <text class="dd-step__title">{{ title }}</text>
24
+ <text v-if="description" class="dd-step__desc">{{ description }}</text>
25
+ </slot>
22
26
  </view>
23
27
  </template>
24
28
 
@@ -39,8 +43,10 @@
39
43
  ></view>
40
44
  </view>
41
45
  <view class="dd-step__content dd-step__content--vertical">
42
- <text class="dd-step__title">{{ title }}</text>
43
- <text v-if="description" class="dd-step__desc">{{ description }}</text>
46
+ <slot>
47
+ <text class="dd-step__title">{{ title }}</text>
48
+ <text v-if="description" class="dd-step__desc">{{ description }}</text>
49
+ </slot>
44
50
  </view>
45
51
  </template>
46
52
  </view>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@didaoktv/didaoui-uniapp",
3
- "version": "2.10.0",
3
+ "version": "2.11.0",
4
4
  "description": "帝到KTV UniApp 组件库",
5
5
  "main": "index.ts",
6
6
  "types": "index.ts",