@veltra/mobile 1.0.0 → 1.1.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/package.json +32 -6
- package/src/components/_internal/bottom-sheet/bottom-sheet.vue +81 -0
- package/src/components/_internal/bottom-sheet/index.ts +1 -0
- package/src/components/_internal/bottom-sheet/style.scss +116 -0
- package/src/components/_internal/bottom-sheet/style.ts +1 -0
- package/src/components/_internal/overlay-container.ts +34 -0
- package/src/components/avatar/avatar.vue +44 -0
- package/src/components/avatar/index.ts +1 -0
- package/src/components/avatar/style.scss +53 -0
- package/src/components/avatar/style.ts +1 -0
- package/src/components/badge/badge.vue +59 -0
- package/src/components/badge/index.ts +1 -0
- package/src/components/badge/style.scss +62 -0
- package/src/components/badge/style.ts +1 -0
- package/src/components/button/button.vue +76 -0
- package/src/components/button/index.ts +1 -0
- package/src/components/button/style.scss +207 -0
- package/src/components/button/style.ts +1 -0
- package/src/components/card/card.vue +24 -0
- package/src/components/card/index.ts +1 -0
- package/src/components/card/style.scss +35 -0
- package/src/components/card/style.ts +1 -0
- package/src/components/cascade/cascade.vue +595 -0
- package/src/components/cascade/index.ts +1 -0
- package/src/components/cascade/node.ts +29 -0
- package/src/components/cascade/style.scss +424 -0
- package/src/components/cascade/style.ts +2 -0
- package/src/components/check-tag/check-tag.vue +35 -0
- package/src/components/check-tag/index.ts +1 -0
- package/src/components/check-tag/style.scss +46 -0
- package/src/components/check-tag/style.ts +1 -0
- package/src/components/checkbox/checkbox.vue +67 -0
- package/src/components/checkbox/index.ts +1 -0
- package/src/components/checkbox/style.scss +132 -0
- package/src/components/checkbox/style.ts +2 -0
- package/src/components/checkbox-group/checkbox-group.vue +94 -0
- package/src/components/checkbox-group/index.ts +1 -0
- package/src/components/checkbox-group/style.scss +57 -0
- package/src/components/checkbox-group/style.ts +2 -0
- package/src/components/collapse/collapse-item.vue +134 -0
- package/src/components/collapse/collapse.vue +117 -0
- package/src/components/collapse/di.ts +18 -0
- package/src/components/collapse/index.ts +3 -0
- package/src/components/collapse/style.scss +157 -0
- package/src/components/collapse/style.ts +1 -0
- package/src/components/date-picker/date-picker.vue +326 -0
- package/src/components/date-picker/index.ts +1 -0
- package/src/components/date-picker/style.scss +236 -0
- package/src/components/date-picker/style.ts +2 -0
- package/src/components/descriptions/descriptions-item.vue +12 -0
- package/src/components/descriptions/descriptions.vue +50 -0
- package/src/components/descriptions/index.ts +2 -0
- package/src/components/descriptions/style.scss +120 -0
- package/src/components/descriptions/style.ts +1 -0
- package/src/components/dialog/dialog.vue +143 -0
- package/src/components/dialog/index.ts +1 -0
- package/src/components/dialog/style.scss +163 -0
- package/src/components/dialog/style.ts +4 -0
- package/src/components/divider/divider.vue +29 -0
- package/src/components/divider/index.ts +1 -0
- package/src/components/divider/style.scss +91 -0
- package/src/components/divider/style.ts +1 -0
- package/src/components/drawer/drawer.vue +168 -0
- package/src/components/drawer/index.ts +1 -0
- package/src/components/drawer/style.scss +240 -0
- package/src/components/drawer/style.ts +2 -0
- package/src/components/empty/empty.vue +22 -0
- package/src/components/empty/index.ts +1 -0
- package/src/components/empty/style.scss +36 -0
- package/src/components/empty/style.ts +1 -0
- package/src/components/form/form.vue +119 -0
- package/src/components/form/index.ts +1 -0
- package/src/components/form/is-field-modified.ts +16 -0
- package/src/components/form/style.scss +58 -0
- package/src/components/form/style.ts +2 -0
- package/src/components/form/use-form-fields.ts +115 -0
- package/src/components/form/use-node-interceptor.ts +101 -0
- package/src/components/form-item/form-item.vue +171 -0
- package/src/components/form-item/helper.ts +9 -0
- package/src/components/form-item/index.ts +1 -0
- package/src/components/form-item/style.scss +121 -0
- package/src/components/form-item/style.ts +1 -0
- package/src/components/form-item/validate.ts +131 -0
- package/src/components/icon/icon.vue +23 -0
- package/src/components/icon/index.ts +1 -0
- package/src/components/icon/style.scss +37 -0
- package/src/components/icon/style.ts +1 -0
- package/src/components/input/index.ts +1 -0
- package/src/components/input/input.vue +187 -0
- package/src/components/input/style.scss +121 -0
- package/src/components/input/style.ts +1 -0
- package/src/components/list/index.ts +3 -0
- package/src/components/list/list-item.vue +20 -0
- package/src/components/list/list.vue +20 -0
- package/src/components/list/style.scss +50 -0
- package/src/components/list/style.ts +1 -0
- package/src/components/loading/directive.ts +34 -0
- package/src/components/loading/index.ts +3 -0
- package/src/components/loading/loading.vue +25 -0
- package/src/components/loading/style.scss +179 -0
- package/src/components/loading/style.ts +2 -0
- package/src/components/message/helper.ts +28 -0
- package/src/components/message/index.ts +3 -0
- package/src/components/message/message-box.vue +31 -0
- package/src/components/message/message.ts +122 -0
- package/src/components/message/message.vue +54 -0
- package/src/components/message/style.scss +130 -0
- package/src/components/message/style.ts +1 -0
- package/src/components/message-confirm/index.ts +3 -0
- package/src/components/message-confirm/message-confirm-box.vue +36 -0
- package/src/components/message-confirm/message-confirm.ts +139 -0
- package/src/components/message-confirm/message-confirm.vue +53 -0
- package/src/components/message-confirm/style.scss +138 -0
- package/src/components/message-confirm/style.ts +1 -0
- package/src/components/multi-select/index.ts +1 -0
- package/src/components/multi-select/multi-select.vue +410 -0
- package/src/components/multi-select/style.scss +376 -0
- package/src/components/multi-select/style.ts +2 -0
- package/src/components/number-input/index.ts +1 -0
- package/src/components/number-input/number-input.vue +407 -0
- package/src/components/number-input/style.scss +118 -0
- package/src/components/number-input/style.ts +2 -0
- package/src/components/password-input/index.ts +1 -0
- package/src/components/password-input/password-input.vue +134 -0
- package/src/components/password-input/style.scss +40 -0
- package/src/components/password-input/style.ts +2 -0
- package/src/components/progress/index.ts +1 -0
- package/src/components/progress/progress.vue +90 -0
- package/src/components/progress/style.scss +73 -0
- package/src/components/progress/style.ts +1 -0
- package/src/components/radio/index.ts +1 -0
- package/src/components/radio/radio.vue +57 -0
- package/src/components/radio/style.scss +113 -0
- package/src/components/radio/style.ts +1 -0
- package/src/components/radio-group/index.ts +1 -0
- package/src/components/radio-group/radio-group.vue +60 -0
- package/src/components/radio-group/style.scss +29 -0
- package/src/components/radio-group/style.ts +2 -0
- package/src/components/segment/index.ts +1 -0
- package/src/components/segment/segment.vue +121 -0
- package/src/components/segment/style.scss +118 -0
- package/src/components/segment/style.ts +1 -0
- package/src/components/select/index.ts +1 -0
- package/src/components/select/select.vue +278 -0
- package/src/components/select/style.scss +237 -0
- package/src/components/select/style.ts +2 -0
- package/src/components/select/use-options.ts +195 -0
- package/src/components/skeleton/index.ts +1 -0
- package/src/components/skeleton/skeleton.vue +37 -0
- package/src/components/skeleton/style.scss +95 -0
- package/src/components/skeleton/style.ts +1 -0
- package/src/components/space/index.ts +1 -0
- package/src/components/space/space.vue +45 -0
- package/src/components/space/style.scss +41 -0
- package/src/components/space/style.ts +1 -0
- package/src/components/steps/index.ts +1 -0
- package/src/components/steps/steps.vue +114 -0
- package/src/components/steps/style.scss +231 -0
- package/src/components/steps/style.ts +1 -0
- package/src/components/switch/index.ts +1 -0
- package/src/components/switch/style.scss +137 -0
- package/src/components/switch/style.ts +1 -0
- package/src/components/switch/switch.vue +63 -0
- package/src/components/tabs/index.ts +1 -0
- package/src/components/tabs/style.scss +285 -0
- package/src/components/tabs/style.ts +1 -0
- package/src/components/tabs/tabs.vue +127 -0
- package/src/components/tag/index.ts +1 -0
- package/src/components/tag/style.scss +114 -0
- package/src/components/tag/style.ts +1 -0
- package/src/components/tag/tag.vue +49 -0
- package/src/components/text/index.ts +1 -0
- package/src/components/text/style.scss +63 -0
- package/src/components/text/style.ts +1 -0
- package/src/components/text/text.vue +63 -0
- package/src/components/textarea/index.ts +1 -0
- package/src/components/textarea/style.scss +124 -0
- package/src/components/textarea/style.ts +1 -0
- package/src/components/textarea/textarea.vue +121 -0
- package/src/components/textarea/utils.ts +11 -0
- package/src/components/time-picker/index.ts +1 -0
- package/src/components/time-picker/style.scss +216 -0
- package/src/components/time-picker/style.ts +2 -0
- package/src/components/time-picker/time-picker.vue +263 -0
- package/src/components/timeline/index.ts +2 -0
- package/src/components/timeline/style.scss +107 -0
- package/src/components/timeline/style.ts +1 -0
- package/src/components/timeline/timeline-item.vue +43 -0
- package/src/components/timeline/timeline.vue +16 -0
- package/src/components/uploader/index.ts +1 -0
- package/src/components/uploader/style.scss +220 -0
- package/src/components/uploader/style.ts +1 -0
- package/src/components/uploader/uploader.vue +306 -0
- package/src/env.d.ts +7 -0
- package/src/index.ts +99 -1
- package/src/shared/bem.ts +12 -0
- package/src/shared/use-scroll-lock.ts +111 -0
- package/src/shared/use-touch-gesture.ts +150 -0
- package/src/styles/_tokens.scss +129 -0
- package/src/types/avatar.ts +31 -0
- package/src/types/badge.ts +28 -0
- package/src/types/button.ts +48 -0
- package/src/types/card.ts +16 -0
- package/src/types/cascade.ts +87 -0
- package/src/types/check-tag.ts +24 -0
- package/src/types/checkbox-group.ts +20 -0
- package/src/types/checkbox.ts +15 -0
- package/src/types/collapse.ts +79 -0
- package/src/types/date-picker.ts +39 -0
- package/src/types/descriptions.ts +22 -0
- package/src/types/dialog.ts +54 -0
- package/src/types/divider.ts +14 -0
- package/src/types/drawer.ts +38 -0
- package/src/types/empty.ts +19 -0
- package/src/types/form-item.ts +22 -0
- package/src/types/form.ts +54 -0
- package/src/types/icon.ts +10 -0
- package/src/types/input.ts +51 -0
- package/src/types/list.ts +13 -0
- package/src/types/loading.ts +20 -0
- package/src/types/message-confirm.ts +72 -0
- package/src/types/message.ts +71 -0
- package/src/types/multi-select.ts +38 -0
- package/src/types/number-input.ts +32 -0
- package/src/types/password-input.ts +19 -0
- package/src/types/progress.ts +22 -0
- package/src/types/radio-group.ts +33 -0
- package/src/types/radio.ts +18 -0
- package/src/types/segment.ts +42 -0
- package/src/types/select.ts +63 -0
- package/src/types/skeleton.ts +29 -0
- package/src/types/space.ts +22 -0
- package/src/types/steps.ts +67 -0
- package/src/types/switch.ts +17 -0
- package/src/types/tabs.ts +63 -0
- package/src/types/tag.ts +19 -0
- package/src/types/text.ts +28 -0
- package/src/types/textarea.ts +76 -0
- package/src/types/time-picker.ts +40 -0
- package/src/types/timeline.ts +15 -0
- package/src/types/uploader.ts +50 -0
- package/.turbo/turbo-build.log +0 -2
- package/.turbo/turbo-check-types.log +0 -1
- package/tsconfig.json +0 -12
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
@use 'pkg:@veltra/styles/mixins' as m with ($namespace: um);
|
|
2
|
+
@use 'pkg:@veltra/styles/functions' as fn;
|
|
3
|
+
@use '../../styles/tokens' as t;
|
|
4
|
+
|
|
5
|
+
$root-name: date-picker;
|
|
6
|
+
|
|
7
|
+
@include m.b($root-name) {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
width: 100%;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
gap: t.use-var('spacing-sm');
|
|
13
|
+
padding: 0 t.use-var('spacing-md');
|
|
14
|
+
border: fn.use-var(border);
|
|
15
|
+
border-radius: t.control-radius(default);
|
|
16
|
+
background-color: fn.use-var(bg-color, top);
|
|
17
|
+
color: fn.use-var(text-color, main);
|
|
18
|
+
font-size: t.use-var('font-size-main');
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
-webkit-tap-highlight-color: transparent;
|
|
21
|
+
transition:
|
|
22
|
+
border-color fn.use-var(transition, fast) fn.use-var(transition, ease),
|
|
23
|
+
box-shadow fn.use-var(transition, fast) fn.use-var(transition, ease);
|
|
24
|
+
|
|
25
|
+
// 触控热区:任何尺寸的可点击区域不小于 44×44,高度走移动端密度 token
|
|
26
|
+
@include m.size using ($size) {
|
|
27
|
+
min-height: max(t.control-height($size), t.use-var('touch-target'));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&:active {
|
|
31
|
+
border-color: fn.use-var(color, primary);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&:focus-visible {
|
|
35
|
+
box-shadow: fn.use-var(focus-ring);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@include m.is(active) {
|
|
39
|
+
border-color: fn.use-var(color, primary);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@include m.is(disabled) {
|
|
43
|
+
cursor: not-allowed;
|
|
44
|
+
color: fn.use-var(text-color, disabled);
|
|
45
|
+
background-color: fn.use-var(bg-color, middle);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@include m.e(value) {
|
|
49
|
+
flex: 1;
|
|
50
|
+
min-width: 0;
|
|
51
|
+
@include m.ellipsis;
|
|
52
|
+
|
|
53
|
+
@include m.is(placeholder) {
|
|
54
|
+
color: fn.use-var(text-color, placeholder);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@include m.e(icons) {
|
|
59
|
+
display: inline-flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
flex-shrink: 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@include m.e(clear) {
|
|
65
|
+
// 清除热区 ≥44×44(高度受行高约束,用外扩补足)
|
|
66
|
+
display: inline-flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
min-width: t.use-var('touch-target');
|
|
70
|
+
min-height: t.use-var('touch-target');
|
|
71
|
+
// 热区外扩量(spacing-sm):补偿清除钮居中图标的两侧留白,不挤压视觉边距
|
|
72
|
+
margin: calc(-1 * #{t.use-var('spacing-sm')}) calc(-1 * #{t.use-var('spacing-sm')}) calc(-1 * #{t.use-var('spacing-sm')}) 0;
|
|
73
|
+
padding: 0;
|
|
74
|
+
border: none;
|
|
75
|
+
background: none;
|
|
76
|
+
font-size: t.use-var('font-size-main');
|
|
77
|
+
color: fn.use-var(text-color, second);
|
|
78
|
+
cursor: pointer;
|
|
79
|
+
|
|
80
|
+
svg {
|
|
81
|
+
width: 1em;
|
|
82
|
+
height: 1em;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&:active {
|
|
86
|
+
color: fn.use-var(text-color, title);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@include m.e(icon) {
|
|
91
|
+
display: inline-flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
color: fn.use-var(text-color, second);
|
|
94
|
+
font-size: t.use-var('font-size-main');
|
|
95
|
+
|
|
96
|
+
svg {
|
|
97
|
+
width: 1em;
|
|
98
|
+
height: 1em;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// 底部日历面板
|
|
103
|
+
@include m.e(panel) {
|
|
104
|
+
display: flex;
|
|
105
|
+
flex-direction: column;
|
|
106
|
+
gap: t.use-var('spacing-sm');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@include m.e(panel-header) {
|
|
110
|
+
display: flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
justify-content: space-between;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@include m.e(nav) {
|
|
116
|
+
// 翻页热区 ≥44×44
|
|
117
|
+
display: inline-flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
justify-content: center;
|
|
120
|
+
min-width: t.use-var('touch-target');
|
|
121
|
+
min-height: t.use-var('touch-target');
|
|
122
|
+
border: none;
|
|
123
|
+
background: none;
|
|
124
|
+
font-size: t.use-var('font-size-main');
|
|
125
|
+
color: fn.use-var(text-color, main);
|
|
126
|
+
cursor: pointer;
|
|
127
|
+
|
|
128
|
+
svg {
|
|
129
|
+
width: 1em;
|
|
130
|
+
height: 1em;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&:active {
|
|
134
|
+
color: fn.use-var(color, primary);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@include m.e(panel-title) {
|
|
139
|
+
// 日历面板内部标题走主字号(面板级主标题才用 font-size-title 档)
|
|
140
|
+
font-size: t.use-var('font-size-main');
|
|
141
|
+
font-weight: 600;
|
|
142
|
+
color: fn.use-var(text-color, title);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@include m.e(week) {
|
|
146
|
+
display: grid;
|
|
147
|
+
grid-template-columns: repeat(7, 1fr);
|
|
148
|
+
margin: 0;
|
|
149
|
+
padding: 0;
|
|
150
|
+
list-style: none;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
@include m.e(week-day) {
|
|
154
|
+
text-align: center;
|
|
155
|
+
font-size: t.use-var('font-size-auxiliary');
|
|
156
|
+
color: fn.use-var(text-color, second);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@include m.e(days) {
|
|
160
|
+
display: grid;
|
|
161
|
+
grid-template-columns: repeat(7, 1fr);
|
|
162
|
+
gap: t.use-var('spacing-xs');
|
|
163
|
+
margin: 0;
|
|
164
|
+
padding: 0;
|
|
165
|
+
list-style: none;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
@include m.e(months) {
|
|
169
|
+
display: grid;
|
|
170
|
+
grid-template-columns: repeat(3, 1fr);
|
|
171
|
+
gap: t.use-var('spacing-xs');
|
|
172
|
+
margin: 0;
|
|
173
|
+
padding: 0;
|
|
174
|
+
list-style: none;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
@include m.e(years) {
|
|
178
|
+
display: grid;
|
|
179
|
+
grid-template-columns: repeat(2, 1fr);
|
|
180
|
+
gap: t.use-var('spacing-xs');
|
|
181
|
+
margin: 0;
|
|
182
|
+
padding: 0;
|
|
183
|
+
list-style: none;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
@include m.e(cell) {
|
|
187
|
+
// 日期格热区 ≥44×44,字号走移动端密度 token
|
|
188
|
+
display: flex;
|
|
189
|
+
align-items: center;
|
|
190
|
+
justify-content: center;
|
|
191
|
+
min-height: t.use-var('touch-target');
|
|
192
|
+
border-radius: t.control-radius(large);
|
|
193
|
+
color: fn.use-var(text-color, main);
|
|
194
|
+
font-size: t.use-var('font-size-main');
|
|
195
|
+
user-select: none;
|
|
196
|
+
cursor: pointer;
|
|
197
|
+
-webkit-tap-highlight-color: transparent;
|
|
198
|
+
|
|
199
|
+
&:active {
|
|
200
|
+
background-color: fn.use-var(bg-color, hover);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// 补位日期弱化
|
|
204
|
+
@include m.is(pre) {
|
|
205
|
+
color: fn.use-var(text-color, disabled);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
@include m.is(next) {
|
|
209
|
+
color: fn.use-var(text-color, disabled);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
@include m.is(today) {
|
|
213
|
+
color: fn.component-var(date-picker, today-color, fn.use-var(color, primary));
|
|
214
|
+
font-weight: 600;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
@include m.is(selected) {
|
|
218
|
+
background-color: fn.use-var(color, primary);
|
|
219
|
+
color: fn.use-var(text-color, white);
|
|
220
|
+
font-weight: 600;
|
|
221
|
+
|
|
222
|
+
&:active {
|
|
223
|
+
background-color: fn.use-var(color, primary);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
@include m.is(disabled) {
|
|
228
|
+
cursor: not-allowed;
|
|
229
|
+
color: fn.use-var(text-color, disabled);
|
|
230
|
+
|
|
231
|
+
&:active {
|
|
232
|
+
background-color: transparent;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- 本组件不自行布局:由 UDescriptions 收集插槽 vnode 后渲染进单列键值列表 -->
|
|
3
|
+
<slot />
|
|
4
|
+
</template>
|
|
5
|
+
|
|
6
|
+
<script lang="ts" setup>
|
|
7
|
+
import type { DescriptionsItemProps } from '../../types/descriptions'
|
|
8
|
+
|
|
9
|
+
defineOptions({ name: 'UDescriptionsItem' })
|
|
10
|
+
|
|
11
|
+
defineProps<DescriptionsItemProps>()
|
|
12
|
+
</script>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="classList">
|
|
3
|
+
<div v-if="title" :class="cls.e('header')">{{ title }}</div>
|
|
4
|
+
|
|
5
|
+
<ul v-if="items.length" :class="cls.e('list')">
|
|
6
|
+
<li v-for="(item, i) of items" :key="i" :class="cls.e('row')">
|
|
7
|
+
<div :class="cls.e('label')">{{ item.label }}</div>
|
|
8
|
+
<div :class="cls.e('content')">
|
|
9
|
+
<component :is="item.vnode" />
|
|
10
|
+
</div>
|
|
11
|
+
</li>
|
|
12
|
+
</ul>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script lang="ts" setup>
|
|
17
|
+
import { computed, useSlots, type VNode } from 'vue'
|
|
18
|
+
|
|
19
|
+
import { bem } from '../../shared/bem'
|
|
20
|
+
import type { DescriptionsProps } from '../../types/descriptions'
|
|
21
|
+
import UDescriptionsItem from './descriptions-item.vue'
|
|
22
|
+
|
|
23
|
+
defineOptions({ name: 'UDescriptions' })
|
|
24
|
+
|
|
25
|
+
const props = defineProps<DescriptionsProps>()
|
|
26
|
+
|
|
27
|
+
const cls = bem('descriptions')
|
|
28
|
+
|
|
29
|
+
const slots = useSlots()
|
|
30
|
+
|
|
31
|
+
interface DescriptionItem {
|
|
32
|
+
label: string | undefined
|
|
33
|
+
vnode: VNode
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// 插槽 vnode 须在渲染路径读取:插槽内容读取的响应式数据经调用链追踪,内容变化时重新计算。
|
|
37
|
+
// 移动端单列形态不按 column 分组,逐项纵向堆叠(column 语义保留,不影响窄屏布局)
|
|
38
|
+
const items = computed<DescriptionItem[]>(() => {
|
|
39
|
+
return (slots.default?.() ?? [])
|
|
40
|
+
.filter((vnode) => vnode.type === UDescriptionsItem)
|
|
41
|
+
.map((vnode) => ({ label: vnode.props?.label as string | undefined, vnode }))
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
const classList = computed(() => [
|
|
45
|
+
cls.b,
|
|
46
|
+
cls.m(props.layout ?? 'horizontal'),
|
|
47
|
+
cls.m(props.size ?? 'default'),
|
|
48
|
+
bem.is('bordered', !!props.border)
|
|
49
|
+
])
|
|
50
|
+
</script>
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use 'pkg:@veltra/styles/mixins' as m with ($namespace: um);
|
|
3
|
+
@use 'pkg:@veltra/styles/functions' as fn;
|
|
4
|
+
@use '../../styles/tokens' as t;
|
|
5
|
+
|
|
6
|
+
$root-name: descriptions;
|
|
7
|
+
|
|
8
|
+
// 小档用次字号,默认 / 大档主字号 16;行内边距走移动端间距刻度(4 / 8 / 12)
|
|
9
|
+
$size-font: (
|
|
10
|
+
small: font-size-secondary,
|
|
11
|
+
default: font-size-main,
|
|
12
|
+
large: font-size-main
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
$size-row-padding: (
|
|
16
|
+
small: spacing-xs,
|
|
17
|
+
default: spacing-sm,
|
|
18
|
+
large: spacing-md
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
@include m.b($root-name) {
|
|
22
|
+
font-size: t.use-var(font-size-main);
|
|
23
|
+
line-height: 1.6;
|
|
24
|
+
color: fn.use-var(text-color, main);
|
|
25
|
+
|
|
26
|
+
@include m.e(header) {
|
|
27
|
+
margin-bottom: t.use-var(spacing-sm);
|
|
28
|
+
font-weight: 600;
|
|
29
|
+
color: fn.use-var(text-color, main);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// 单列键值列表:每项一行,无多列分组(窄屏适配,column 不参与布局)
|
|
33
|
+
@include m.e(list) {
|
|
34
|
+
margin: 0;
|
|
35
|
+
padding: 0;
|
|
36
|
+
list-style: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@include m.e(row) {
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: baseline;
|
|
42
|
+
gap: t.use-var(spacing-md);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@include m.e(label) {
|
|
46
|
+
flex: none;
|
|
47
|
+
max-width: 40%;
|
|
48
|
+
text-align: start;
|
|
49
|
+
font-weight: 500;
|
|
50
|
+
color: fn.use-var(text-color, second);
|
|
51
|
+
word-break: break-word;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@include m.e(content) {
|
|
55
|
+
flex: 1;
|
|
56
|
+
min-width: 0;
|
|
57
|
+
text-align: end;
|
|
58
|
+
word-break: break-word;
|
|
59
|
+
color: fn.use-var(text-color, main);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@include m.size using ($size) {
|
|
63
|
+
font-size: t.use-var(map.get($size-font, $size));
|
|
64
|
+
|
|
65
|
+
.um-#{$root-name}__row {
|
|
66
|
+
padding: t.use-var(map.get($size-row-padding, $size)) 0;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// 垂直布局:键名在上、内容在下
|
|
71
|
+
@include m.m(vertical) {
|
|
72
|
+
.um-#{$root-name}__row {
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
align-items: stretch;
|
|
75
|
+
gap: t.use-var(spacing-sm);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.um-#{$root-name}__content {
|
|
79
|
+
text-align: start;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// 边框模式:列表整体描边、纯白底,行间分隔线,键名灰底块(对应 desktop 单元格描边语义)
|
|
84
|
+
@include m.is(bordered) {
|
|
85
|
+
.um-#{$root-name}__list {
|
|
86
|
+
border: fn.use-var(border-muted);
|
|
87
|
+
border-radius: t.control-radius(default);
|
|
88
|
+
background-color: fn.use-var(bg-color, top);
|
|
89
|
+
overflow: hidden;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.um-#{$root-name}__row {
|
|
93
|
+
gap: 0;
|
|
94
|
+
|
|
95
|
+
& + & {
|
|
96
|
+
border-top: fn.use-var(border-muted);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.um-#{$root-name}__label {
|
|
101
|
+
max-width: none;
|
|
102
|
+
flex: 0 0 38%;
|
|
103
|
+
align-self: stretch;
|
|
104
|
+
padding-inline: t.use-var(spacing-sm);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.um-#{$root-name}__content {
|
|
108
|
+
padding-inline: t.use-var(spacing-sm);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// 垂直布局下键名独占一行:保留灰底块作行分组头
|
|
112
|
+
// 此处不能用 m.m():嵌套在 is(bordered) 下会拼出 .is-bordered--vertical 的失效复合选择器
|
|
113
|
+
&.um-#{$root-name}--vertical {
|
|
114
|
+
.um-#{$root-name}__label {
|
|
115
|
+
flex-basis: auto;
|
|
116
|
+
background-color: fn.use-var(bg-color, middle);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './style.scss'
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Teleport :to="getOverlayContainer()">
|
|
3
|
+
<transition name="fade" appear @enter="onOverlayEnter" @after-leave="onOverlayLeave">
|
|
4
|
+
<div
|
|
5
|
+
v-if="overlayVisible"
|
|
6
|
+
:class="[cls.e('overlay'), bem.is('modal', modal), bem.is('fullscreen', fullscreen)]"
|
|
7
|
+
:style="{ zIndex: overlayZIndex }"
|
|
8
|
+
@click="modal && close()"
|
|
9
|
+
>
|
|
10
|
+
<transition :name="transition" appear @after-leave="onAfterDialogLeave">
|
|
11
|
+
<div v-if="dialogVisible" v-bind="$attrs" :class="className" @click.stop>
|
|
12
|
+
<section :class="cls.e('header')">
|
|
13
|
+
<div :class="cls.e('title')">
|
|
14
|
+
<slot name="header">
|
|
15
|
+
{{ header || title }}
|
|
16
|
+
</slot>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<button :class="cls.e('close')" type="button" aria-label="关闭" @click="close">
|
|
20
|
+
<Close />
|
|
21
|
+
</button>
|
|
22
|
+
</section>
|
|
23
|
+
|
|
24
|
+
<section :class="bodyClass">
|
|
25
|
+
<slot />
|
|
26
|
+
</section>
|
|
27
|
+
|
|
28
|
+
<!-- 移动端惯例按钮组:等宽铺满、主操作居右;不传插槽时内置取消/确认 -->
|
|
29
|
+
<section :class="footerClass">
|
|
30
|
+
<slot name="footer" v-bind="{ close }">
|
|
31
|
+
<UButton v-if="showCancel" plain @click="onCancel">
|
|
32
|
+
{{ cancelText }}
|
|
33
|
+
</UButton>
|
|
34
|
+
<UButton type="primary" @click="onConfirm">
|
|
35
|
+
{{ confirmText }}
|
|
36
|
+
</UButton>
|
|
37
|
+
</slot>
|
|
38
|
+
</section>
|
|
39
|
+
</div>
|
|
40
|
+
</transition>
|
|
41
|
+
</div>
|
|
42
|
+
</transition>
|
|
43
|
+
</Teleport>
|
|
44
|
+
|
|
45
|
+
<!-- 触发器 -->
|
|
46
|
+
<span v-if="$slots.trigger" :class="cls.e('trigger')" @click="visible = !visible">
|
|
47
|
+
<slot name="trigger" />
|
|
48
|
+
</span>
|
|
49
|
+
</template>
|
|
50
|
+
|
|
51
|
+
<script lang="ts" setup>
|
|
52
|
+
import { Close } from '@veltra/icons/normal'
|
|
53
|
+
import { zIndex } from '@veltra/utils'
|
|
54
|
+
import { computed, shallowRef, watch } from 'vue'
|
|
55
|
+
|
|
56
|
+
import { bem } from '../../shared/bem'
|
|
57
|
+
import type { DialogEmits, DialogProps, _DialogExposed } from '../../types/dialog'
|
|
58
|
+
import { getOverlayContainer, useOverlayScrollLock } from '../_internal/overlay-container'
|
|
59
|
+
import { UButton } from '../button'
|
|
60
|
+
|
|
61
|
+
defineOptions({ name: 'UDialog', inheritAttrs: false })
|
|
62
|
+
|
|
63
|
+
const props = withDefaults(defineProps<DialogProps>(), {
|
|
64
|
+
modal: true,
|
|
65
|
+
transition: 'fade-scale',
|
|
66
|
+
confirmText: '确认',
|
|
67
|
+
cancelText: '取消',
|
|
68
|
+
showCancel: true,
|
|
69
|
+
contentAlign: 'center'
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
const emit = defineEmits<DialogEmits>()
|
|
73
|
+
|
|
74
|
+
const cls = bem('dialog')
|
|
75
|
+
|
|
76
|
+
const visible = defineModel<boolean>({ default: false })
|
|
77
|
+
|
|
78
|
+
const overlayVisible = shallowRef(false)
|
|
79
|
+
const dialogVisible = shallowRef(false)
|
|
80
|
+
const overlayZIndex = shallowRef<number>()
|
|
81
|
+
|
|
82
|
+
// 打开期间锁定背景滚动(body / 设备外壳视口),完全关闭后恢复原滚动位置
|
|
83
|
+
const scrollLock = useOverlayScrollLock()
|
|
84
|
+
|
|
85
|
+
// 打开时盖在新一层级上;关闭链路:卡片退场 -> 遮罩退场 -> closed
|
|
86
|
+
// immediate:初始即为 true 时直接进入打开态,由 appear 补上进场动画
|
|
87
|
+
watch(
|
|
88
|
+
visible,
|
|
89
|
+
(v) => {
|
|
90
|
+
if (v) {
|
|
91
|
+
overlayZIndex.value = zIndex()
|
|
92
|
+
scrollLock.lock()
|
|
93
|
+
overlayVisible.value = true
|
|
94
|
+
} else {
|
|
95
|
+
dialogVisible.value = false
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
{ immediate: true }
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
function onOverlayEnter() {
|
|
102
|
+
dialogVisible.value = true
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function onAfterDialogLeave() {
|
|
106
|
+
overlayVisible.value = false
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** 遮罩退场完成即整条关闭链路结束:解锁背景滚动并通知 closed */
|
|
110
|
+
function onOverlayLeave() {
|
|
111
|
+
scrollLock.unlock()
|
|
112
|
+
emit('closed')
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const className = computed(() => {
|
|
116
|
+
return [cls.b, bem.is('fullscreen', props.fullscreen)]
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
const bodyClass = computed(() => {
|
|
120
|
+
return [cls.e('body'), bem.is(`align-${props.contentAlign}`, true)]
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
const footerClass = computed(() => {
|
|
124
|
+
return [cls.e('footer'), bem.is('actions-vertical', props.verticalActions)]
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
/** 关闭 */
|
|
128
|
+
const close = () => {
|
|
129
|
+
visible.value = false
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function onCancel() {
|
|
133
|
+
emit('cancel')
|
|
134
|
+
close()
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function onConfirm() {
|
|
138
|
+
emit('confirm')
|
|
139
|
+
close()
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
defineExpose<_DialogExposed>({ close })
|
|
143
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as UDialog } from './dialog.vue'
|