@didaoktv/didaoui-uniapp 2.11.0 → 2.13.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 CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  - **帝王级配色** — 帝王金 `#F5A623` + 皇家蓝 `#2D4BA0` 双主色,暗色主题默认
8
8
  - **玻璃拟态设计** — 多层级玻璃拟态效果,打造高端夜店沉浸感
9
- - **98 个精心打磨的组件** — 覆盖表单、导航、布局卡片、数据展示、浮层反馈、交互、画布七大类,含 KTV 业务组件(房态卡、账单明细、工单卡、日历、二维码)
9
+ - **99 个精心打磨的组件** — 覆盖表单、导航、布局卡片、数据展示、浮层反馈、交互、画布七大类,含 KTV 业务组件(房态卡、账单明细、工单卡、日历、二维码)
10
10
  - **Vue3 + TypeScript** — 完整类型定义,Composition API
11
11
  - **多端兼容** — H5 / 微信小程序 / 抖音小程序 / Android / iOS
12
12
 
@@ -53,7 +53,7 @@ import { DdButton, DdInput } from '@didaoktv/didaoui-uniapp'
53
53
  | 表单输入 | 25 | Button, CodeButton, Input, Form, Field, Switch, Checkbox, CheckboxGroup, Radio, RadioGroup, Stepper, SearchBar, Slider, DatePicker, Picker, Rate, Upload, Icon, Keyboard, NumberKeyboard, CarKeyboard, Cascader, GoodsSku, PackageSku, TreeSelect |
54
54
  | 导航 | 14 | Navigation, TopNavbar, SegmentedTab, SwipeableTab, Drawer, Tabbar, TabbarItem, Backtop, Collapse, CollapseItem, DropdownMenu, DropdownItem, Sidebar, SidebarItem | |
55
55
  | 布局/卡片 | 11 | Card, RoomCard, GoodsCard, FeatureGrid, Sticky, BillDetail, WorkorderCard, Calendar, Qrcode, SubmitBar, CartBar |
56
- | 数据展示 | 25 | Tag, StatCard, ChampionCard, Avatar, AvatarGroup, Badge, ListCell, Cell, CellGroup, CountDown, Divider, Image, Progress, Skeleton, EmptyState, Step, Steps, Text, Link, Copy, Album, Coupon, Parse, Markdown, Price |
56
+ | 数据展示 | 26 | Tag, StatCard, ChampionCard, Avatar, AvatarGroup, Badge, ListCell, Cell, CellGroup, Fold, CountDown, Divider, Image, Progress, Skeleton, EmptyState, Step, Steps, Text, Link, Copy, Album, Coupon, Parse, Markdown, Price |
57
57
  | 浮层反馈 | 11 | Modal, ActionSheet, Toast, Alert, Loading, Dialog, Overlay, Popup, Popover, PopoverItem, Portal |
58
58
  | 交互 | 5 | SwipeAction, Swipe, SwipeItem, PullRefresh, Loadmore |
59
59
  | 小程序专属 | 2 | CapsuleButton, MiniProgramNavbar |
@@ -51,8 +51,8 @@ interface Props {
51
51
  label?: string
52
52
  value?: string
53
53
  icon?: string
54
- /** 尺寸档:sm 紧凑 / md 默认 / lg 宽松,同时改变行高与字号 */
55
- size?: 'sm' | 'md' | 'lg'
54
+ /** 尺寸档:xs 紧凑展示 / sm 紧凑 / md 默认 / lg 宽松,同时改变行高与字号 */
55
+ size?: 'xs' | 'sm' | 'md' | 'lg'
56
56
  isLink?: boolean
57
57
  arrowDirection?: 'left' | 'right' | 'up' | 'down'
58
58
  required?: boolean | 'auto'
@@ -135,6 +135,13 @@ function handleClick(e: Event) {
135
135
  padding-top: $dd-space-3;
136
136
  padding-bottom: $dd-space-3;
137
137
 
138
+ // xs:最低档,竖直留白 4px,用于详情卡内的密集键值行;低于 44px 触控下限,仅限非交互展示
139
+ &--xs {
140
+ padding-top: $dd-space-1;
141
+ padding-bottom: $dd-space-1;
142
+ font-size: $dd-font-size-caption;
143
+ }
144
+
138
145
  &--sm {
139
146
  padding-top: $dd-space-2;
140
147
  padding-bottom: $dd-space-2;
@@ -21,7 +21,7 @@ interface Props {
21
21
  /** 通栏模式下的首尾外框发丝线 */
22
22
  border?: boolean
23
23
  /** 分节标题尺寸档,只影响标题排版,不向子 cell 传递 */
24
- size?: 'sm' | 'md' | 'lg'
24
+ size?: 'xs' | 'sm' | 'md' | 'lg'
25
25
  }
26
26
 
27
27
  withDefaults(defineProps<Props>(), {
@@ -68,6 +68,12 @@ withDefaults(defineProps<Props>(), {
68
68
  }
69
69
 
70
70
  // 尺寸档只调标题排版(竖直 padding + 字号),不级联到子 cell
71
+ &--xs {
72
+ padding-top: $dd-space-2;
73
+ padding-bottom: 0;
74
+ font-size: $dd-font-size-overline;
75
+ }
76
+
71
77
  &--sm {
72
78
  padding-top: $dd-space-3;
73
79
  padding-bottom: $dd-space-1;
@@ -140,8 +140,8 @@ interface Props {
140
140
  clickable?: boolean
141
141
  isLink?: boolean
142
142
  arrowDirection?: 'left' | 'right' | 'up' | 'down'
143
- /** 单元格尺寸档,与 dd-cell 的 sm/md/lg 同一套竖直 rhythm(8/12/16px) */
144
- size?: 'sm' | 'md' | 'lg'
143
+ /** 单元格尺寸档,与 dd-cell 同一套竖直 rhythm(xs/sm/md/lg = 4/8/12/16px) */
144
+ size?: 'xs' | 'sm' | 'md' | 'lg'
145
145
  icon?: string
146
146
  leftIcon?: string
147
147
  rightIcon?: string
@@ -457,6 +457,13 @@ defineExpose({ validate, validateWithTrigger, resetValidation, scrollIntoView, f
457
457
  transform: scaleY(0.5);
458
458
  }
459
459
 
460
+ // xs:36px 紧凑行(低于 44px 触控下限,仅限非交互展示),竖直留白 4px
461
+ &--xs {
462
+ min-height: $dd-size-control-compact;
463
+ padding-top: $dd-space-1;
464
+ padding-bottom: $dd-space-1;
465
+ }
466
+
460
467
  &--sm {
461
468
  padding-top: $dd-space-2;
462
469
  padding-bottom: $dd-space-2;
@@ -0,0 +1,133 @@
1
+ <template>
2
+ <view class="dd-fold">
3
+ <view class="dd-fold__clip" :style="clipStyle">
4
+ <view class="dd-fold__body">
5
+ <slot />
6
+ </view>
7
+ <view v-if="clamped" class="dd-fold__fade" :style="fadeStyle" />
8
+ </view>
9
+ <view v-if="overflow" class="dd-fold__toggle" @tap.stop="onToggle">
10
+ <text class="dd-fold__toggle-text">{{ expanded ? collapseText : expandText }}</text>
11
+ <dd-icon :name="expanded ? 'arrow-up' : 'arrow-down'" class="dd-fold__icon" />
12
+ </view>
13
+ </view>
14
+ </template>
15
+
16
+ <script setup lang="ts">
17
+ import { computed, getCurrentInstance, nextTick, onMounted, ref, watch } from 'vue'
18
+ import DdIcon from '../dd-icon/dd-icon.vue'
19
+
20
+ interface Props {
21
+ /** 展开态,配合 v-model:expanded 受控(组件本身不做内部状态) */
22
+ expanded?: boolean
23
+ /** 折叠高度(rpx),内容自然高度超过它才折叠 */
24
+ maxHeight?: number
25
+ /** 底部渐变高度(rpx) */
26
+ fadeHeight?: number
27
+ /** 渐变终色,默认取页面底色 token;与所在区域底色不一致时传入 */
28
+ fadeColor?: string
29
+ expandText?: string
30
+ collapseText?: string
31
+ }
32
+
33
+ const props = withDefaults(defineProps<Props>(), {
34
+ expanded: false,
35
+ maxHeight: 320,
36
+ fadeHeight: 96,
37
+ fadeColor: '',
38
+ expandText: '展开详情',
39
+ collapseText: '收起',
40
+ })
41
+
42
+ const emit = defineEmits<{
43
+ (e: 'update:expanded', val: boolean): void
44
+ (e: 'toggle', val: boolean): void
45
+ }>()
46
+
47
+ const instance = getCurrentInstance()
48
+ /** 内容自然高度是否超过 maxHeight(低于则完全不折叠,不出现渐变与入口) */
49
+ const overflow = ref(false)
50
+
51
+ const clamped = computed(() => overflow.value && !props.expanded)
52
+
53
+ const clipStyle = computed(() =>
54
+ clamped.value ? `max-height: ${props.maxHeight}rpx;` : '',
55
+ )
56
+
57
+ const fadeStyle = computed(() => {
58
+ const to = props.fadeColor || 'var(--dd-bg-section, #6b7280)'
59
+ return `height: ${props.fadeHeight}rpx; background: linear-gradient(to bottom, transparent, ${to} 78%);`
60
+ })
61
+
62
+ /** 量内容自然高度(父级 max-height/overflow 不改变子元素自身高度);rpx→px 用平台换算,各端阈值一致 */
63
+ function measure(): void {
64
+ const ctx = instance?.proxy
65
+ if (!ctx) return
66
+ uni
67
+ .createSelectorQuery()
68
+ .in(ctx)
69
+ .select('.dd-fold__body')
70
+ .boundingClientRect((rect) => {
71
+ const height = (rect as { height?: number } | null)?.height ?? 0
72
+ overflow.value = height > uni.upx2px(props.maxHeight) + 0.5
73
+ })
74
+ .exec()
75
+ }
76
+
77
+ /** 手动重量:插槽内容异步变化(加载更多、图片就绪等)后调用 */
78
+ defineExpose({ measure })
79
+
80
+ function onToggle(): void {
81
+ const next = !props.expanded
82
+ emit('update:expanded', next)
83
+ emit('toggle', next)
84
+ }
85
+
86
+ // 首屏等一帧布局落定再量(小程序端 nextTick 早于布局)
87
+ onMounted(() => {
88
+ nextTick(() => setTimeout(measure, 60))
89
+ })
90
+
91
+ watch(
92
+ () => props.maxHeight,
93
+ () => nextTick(measure),
94
+ )
95
+ </script>
96
+
97
+ <style lang="scss" scoped>
98
+ @import '../../scss/variables';
99
+ @import '../../scss/mixins';
100
+
101
+ .dd-fold {
102
+ width: 100%;
103
+
104
+ &__clip {
105
+ position: relative;
106
+ width: 100%;
107
+ overflow: hidden;
108
+ }
109
+
110
+ &__fade {
111
+ position: absolute;
112
+ right: 0;
113
+ bottom: 0;
114
+ left: 0;
115
+ pointer-events: none;
116
+ }
117
+
118
+ &__toggle {
119
+ display: flex;
120
+ align-items: center;
121
+ justify-content: center;
122
+ gap: $dd-space-1;
123
+ padding-top: $dd-space-1;
124
+ font-size: $dd-font-size-caption;
125
+ line-height: $dd-line-height-caption;
126
+ color: var(--dd-primary-400, #{$dd-primary-400});
127
+ }
128
+
129
+ &__icon {
130
+ font-size: 1em;
131
+ }
132
+ }
133
+ </style>
@@ -41,8 +41,8 @@ interface Props {
41
41
  subtitle?: string
42
42
  value?: string
43
43
  icon?: string
44
- /** 尺寸档:sm 紧凑 / md 默认 / lg 宽松,同时改变行高与字号 */
45
- size?: 'sm' | 'md' | 'lg'
44
+ /** 尺寸档:xs 紧凑展示 / sm 紧凑 / md 默认 / lg 宽松,同时改变行高与字号 */
45
+ size?: 'xs' | 'sm' | 'md' | 'lg'
46
46
  arrow?: boolean
47
47
  isLink?: boolean
48
48
  borderless?: boolean
@@ -85,7 +85,14 @@ function onClick(e: Event) {
85
85
  font-size: $dd-font-size-body;
86
86
  @include dd-hairline-bottom(var(--dd-border-default, #{$dd-border-default}));
87
87
 
88
- // 三档:44/48/56px(sm 取控件 md 档 = 44px 触控下限),字号 12/14/16px 同步缩放
88
+ // 四档:32/44/48/56px(md 48px = 原值;xs 32px 为紧凑元信息行,低于 44px 触控下限,仅限非交互展示),字号 12/12/14/16px
89
+ &--xs {
90
+ min-height: $dd-size-control-sm;
91
+ padding-top: $dd-space-1;
92
+ padding-bottom: $dd-space-1;
93
+ font-size: $dd-font-size-caption;
94
+ }
95
+
89
96
  &--sm {
90
97
  min-height: $dd-size-control-md;
91
98
  padding-top: $dd-space-2;
package/index.ts CHANGED
@@ -57,7 +57,7 @@ import DdQrcode from './components/dd-qrcode/dd-qrcode.vue'
57
57
  import DdSubmitBar from './components/dd-submit-bar/dd-submit-bar.vue'
58
58
  import DdCartBar from './components/dd-cart-bar/dd-cart-bar.vue'
59
59
 
60
- // === Display (25) ===
60
+ // === Display (26) ===
61
61
  import DdTag from './components/dd-tag/dd-tag.vue'
62
62
  import DdStatCard from './components/dd-stat-card/dd-stat-card.vue'
63
63
  import DdChampionCard from './components/dd-champion-card/dd-champion-card.vue'
@@ -67,6 +67,7 @@ import DdBadge from './components/dd-badge/dd-badge.vue'
67
67
  import DdListCell from './components/dd-list-cell/dd-list-cell.vue'
68
68
  import DdCell from './components/dd-cell/dd-cell.vue'
69
69
  import DdCellGroup from './components/dd-cell-group/dd-cell-group.vue'
70
+ import DdFold from './components/dd-fold/dd-fold.vue'
70
71
  import DdCountDown from './components/dd-count-down/dd-count-down.vue'
71
72
  import DdDivider from './components/dd-divider/dd-divider.vue'
72
73
  import DdImage from './components/dd-image/dd-image.vue'
@@ -128,7 +129,7 @@ const components = {
128
129
  DdSubmitBar,
129
130
  DdCartBar,
130
131
  DdTag, DdStatCard, DdChampionCard, DdAvatar, DdAvatarGroup, DdBadge,
131
- DdListCell, DdCell, DdCellGroup, DdCountDown, DdDivider,
132
+ DdListCell, DdCell, DdCellGroup, DdFold, DdCountDown, DdDivider,
132
133
  DdImage, DdProgress, DdSkeleton, DdEmptyState, DdStep, DdSteps,
133
134
  DdText, DdLink, DdCopy, DdAlbum, DdCoupon, DdParse, DdMarkdown, DdPrice,
134
135
  DdModal, DdActionSheet, DdToast, DdAlert, DdLoading,
@@ -161,7 +162,7 @@ export {
161
162
  DdSubmitBar,
162
163
  DdCartBar,
163
164
  DdTag, DdStatCard, DdChampionCard, DdAvatar, DdAvatarGroup, DdBadge,
164
- DdListCell, DdCell, DdCellGroup, DdCountDown, DdDivider,
165
+ DdListCell, DdCell, DdCellGroup, DdFold, DdCountDown, DdDivider,
165
166
  DdImage, DdProgress, DdSkeleton, DdEmptyState, DdStep, DdSteps,
166
167
  DdText, DdLink, DdCopy, DdAlbum, DdCoupon, DdParse, DdMarkdown, DdPrice,
167
168
  DdModal, DdActionSheet, DdToast, DdAlert, DdLoading,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@didaoktv/didaoui-uniapp",
3
- "version": "2.11.0",
3
+ "version": "2.13.0",
4
4
  "description": "帝到KTV UniApp 组件库",
5
5
  "main": "index.ts",
6
6
  "types": "index.ts",