hy-app 0.3.1 → 0.3.2
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 -3
- package/common/shakeService.ts +31 -29
- package/components/avatar.zip +0 -0
- package/components/hy-action-sheet/hy-action-sheet.vue +71 -46
- package/components/hy-address-picker/hy-address-picker.vue +94 -83
- package/components/hy-avatar/hy-avatar.vue +84 -85
- package/components/hy-badge/hy-badge.vue +47 -46
- package/components/hy-button/hy-button.vue +117 -93
- package/components/hy-calendar/hy-calendar.vue +168 -160
- package/components/hy-card/hy-card.vue +50 -43
- package/components/hy-card/typing.d.ts +33 -32
- package/components/hy-cell/hy-cell.vue +73 -51
- package/components/hy-check-button/hy-check-button.vue +54 -47
- package/components/hy-checkbox/hy-checkbox.vue +97 -105
- package/components/hy-code-input/hy-code-input.vue +80 -89
- package/components/hy-config-provider/hy-config-provider.vue +19 -20
- package/components/hy-count-down/hy-count-down.vue +66 -67
- package/components/hy-count-to/hy-count-to.vue +105 -99
- package/components/hy-count-to/typing.d.ts +13 -12
- package/components/hy-datetime-picker/hy-datetime-picker.vue +261 -253
- package/components/hy-datetime-picker/typing.d.ts +42 -40
- package/components/hy-divider/hy-divider.vue +68 -73
- package/components/hy-dropdown/hy-dropdown.vue +20 -19
- package/components/hy-dropdown-item/hy-dropdown-item.vue +66 -61
- package/components/hy-dropdown-item/typing.d.ts +9 -9
- package/components/hy-empty/hy-empty.vue +42 -42
- package/components/hy-flex/hy-flex.vue +52 -26
- package/components/hy-float-button/hy-float-button.vue +218 -210
- package/components/hy-folding-panel/hy-folding-panel.vue +32 -33
- package/components/hy-form/hy-form.vue +264 -259
- package/components/hy-grid/hy-grid.vue +44 -43
- package/components/hy-icon/hy-icon.vue +61 -67
- package/components/hy-image/hy-image.vue +112 -88
- package/components/hy-image/typing.d.ts +27 -23
- package/components/hy-input/hy-input.vue +157 -127
- package/components/hy-input/typing.d.ts +53 -47
- package/components/hy-line/hy-line.vue +26 -26
- package/components/hy-line-progress/hy-line-progress.vue +42 -35
- package/components/hy-list/hy-list.vue +76 -85
- package/components/hy-loading/hy-loading.vue +26 -23
- package/components/hy-menu/hy-menu.vue +48 -43
- package/components/hy-menu/typing.d.ts +18 -17
- package/components/hy-modal/hy-modal.vue +39 -35
- package/components/hy-navbar/hy-navbar.vue +25 -25
- package/components/hy-navbar/typing.d.ts +24 -22
- package/components/hy-notice-bar/hy-notice-bar.vue +26 -27
- package/components/hy-notify/hy-notify.vue +53 -53
- package/components/hy-number-step/hy-number-step.vue +134 -146
- package/components/hy-number-step/typing.d.ts +35 -35
- package/components/hy-overlay/hy-overlay.vue +23 -21
- package/components/hy-pagination/hy-pagination.vue +41 -36
- package/components/hy-picker/hy-picker.vue +184 -154
- package/components/hy-picker/typing.d.ts +39 -39
- package/components/hy-popover/hy-popover.vue +97 -77
- package/components/hy-popup/hy-popup.vue +107 -98
- package/components/hy-price/hy-price.vue +38 -34
- package/components/hy-qrcode/hy-qrcode.vue +50 -51
- package/components/hy-radio/hy-radio.vue +101 -113
- package/components/hy-rate/hy-rate.vue +107 -88
- package/components/hy-read-more/hy-read-more.vue +64 -49
- package/components/hy-scroll-list/hy-scroll-list.vue +45 -48
- package/components/hy-search/hy-search.vue +73 -66
- package/components/hy-search/typing.d.ts +36 -35
- package/components/hy-signature/hy-signature.vue +282 -240
- package/components/hy-slider/hy-slider.vue +195 -153
- package/components/hy-slider/typing.d.ts +21 -21
- package/components/hy-steps/hy-steps.vue +118 -90
- package/components/hy-steps/index.scss +31 -21
- package/components/hy-submit-bar/hy-submit-bar.vue +61 -70
- package/components/hy-subsection/hy-subsection.vue +99 -102
- package/components/hy-subsection/typing.d.ts +19 -19
- package/components/hy-swipe-action/hy-swipe-action.vue +131 -118
- package/components/hy-swiper/hy-swiper.vue +85 -71
- package/components/hy-switch/hy-switch.vue +67 -72
- package/components/hy-switch/typing.d.ts +21 -19
- package/components/hy-tabs/hy-tabs.vue +168 -113
- package/components/hy-tag/hy-tag.vue +90 -86
- package/components/hy-tag/typing.d.ts +26 -21
- package/components/hy-text/hy-text.vue +119 -111
- package/components/hy-textarea/hy-textarea.vue +100 -93
- package/components/hy-textarea/typing.d.ts +36 -31
- package/components/hy-toast/hy-toast.vue +77 -67
- package/components/hy-tooltip/hy-tooltip.vue +109 -91
- package/components/hy-transition/hy-transition.vue +62 -66
- package/components/hy-upload/hy-upload.vue +294 -152
- package/components/hy-upload/typing.d.ts +41 -36
- package/components/hy-warn/hy-warn.vue +34 -27
- package/components/hy-waterfall/hy-waterfall.vue +83 -74
- package/components/hy-watermark/hy-watermark.vue +134 -115
- package/composables/usePopover.ts +236 -221
- package/composables/useQueue.ts +53 -52
- package/package.json +2 -2
- package/store/index.ts +9 -1
- package/typing/index.ts +0 -1
- package/typing/modules/common.d.ts +0 -2
- package/web-types.json +1 -1
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
:top="icon?.top"
|
|
17
17
|
:stop="icon?.stop"
|
|
18
18
|
:round="icon?.round"
|
|
19
|
-
:customStyle="
|
|
19
|
+
:customStyle="
|
|
20
|
+
Object.assign({ marginRight: '3px' }, icon?.customStyle)
|
|
21
|
+
"
|
|
20
22
|
></HyIcon>
|
|
21
23
|
</slot>
|
|
22
24
|
<text :class="textClass" :style="textStyle">
|
|
@@ -31,7 +33,11 @@
|
|
|
31
33
|
@tap.stop="closeHandler"
|
|
32
34
|
:style="{ backgroundColor: closeColor }"
|
|
33
35
|
>
|
|
34
|
-
<HyIcon
|
|
36
|
+
<HyIcon
|
|
37
|
+
:name="IconConfig.CLOSE"
|
|
38
|
+
:size="closeSize"
|
|
39
|
+
color="#ffffff"
|
|
40
|
+
></HyIcon>
|
|
35
41
|
</view>
|
|
36
42
|
</view>
|
|
37
43
|
</HyTransition>
|
|
@@ -39,32 +45,32 @@
|
|
|
39
45
|
|
|
40
46
|
<script lang="ts">
|
|
41
47
|
export default {
|
|
42
|
-
name:
|
|
48
|
+
name: "hy-tag",
|
|
43
49
|
options: {
|
|
44
50
|
addGlobalClass: true,
|
|
45
51
|
virtualHost: true,
|
|
46
|
-
styleIsolation:
|
|
52
|
+
styleIsolation: "shared",
|
|
47
53
|
},
|
|
48
|
-
}
|
|
54
|
+
};
|
|
49
55
|
</script>
|
|
50
56
|
|
|
51
57
|
<script setup lang="ts">
|
|
52
|
-
import { computed, toRefs } from
|
|
53
|
-
import type { CSSProperties, PropType } from
|
|
54
|
-
import type { ITagEmits } from
|
|
55
|
-
import { IconConfig } from
|
|
56
|
-
import { colorGradient } from
|
|
57
|
-
import type HyIconProps from
|
|
58
|
+
import { computed, toRefs } from "vue";
|
|
59
|
+
import type { CSSProperties, PropType } from "vue";
|
|
60
|
+
import type { ITagEmits } from "./typing";
|
|
61
|
+
import { IconConfig } from "../../config";
|
|
62
|
+
import { colorGradient } from "../../utils";
|
|
63
|
+
import type HyIconProps from "../hy-icon/typing";
|
|
58
64
|
|
|
59
65
|
// 组件
|
|
60
|
-
import HyTransition from
|
|
61
|
-
import HyIcon from
|
|
66
|
+
import HyTransition from "../hy-transition/hy-transition.vue";
|
|
67
|
+
import HyIcon from "../hy-icon/hy-icon.vue";
|
|
62
68
|
|
|
63
69
|
/**
|
|
64
70
|
* tag组件一般用于标记和选择,我们提供了更加丰富的表现形式,能够较全面的涵盖您的使用场景
|
|
65
71
|
* @displayName hy-tag
|
|
66
72
|
*/
|
|
67
|
-
defineOptions({})
|
|
73
|
+
defineOptions({});
|
|
68
74
|
|
|
69
75
|
// const props = withDefaults(defineProps<IProps>(), defaultProps)
|
|
70
76
|
const props = defineProps({
|
|
@@ -78,7 +84,7 @@ const props = defineProps({
|
|
|
78
84
|
* */
|
|
79
85
|
type: {
|
|
80
86
|
type: String,
|
|
81
|
-
default:
|
|
87
|
+
default: "primary",
|
|
82
88
|
},
|
|
83
89
|
/** 禁用点击标签 */
|
|
84
90
|
disabled: {
|
|
@@ -91,7 +97,7 @@ const props = defineProps({
|
|
|
91
97
|
* */
|
|
92
98
|
size: {
|
|
93
99
|
type: String,
|
|
94
|
-
default:
|
|
100
|
+
default: "medium",
|
|
95
101
|
},
|
|
96
102
|
/**
|
|
97
103
|
* tag的形状
|
|
@@ -99,7 +105,7 @@ const props = defineProps({
|
|
|
99
105
|
* */
|
|
100
106
|
shape: {
|
|
101
107
|
type: String,
|
|
102
|
-
default:
|
|
108
|
+
default: "square",
|
|
103
109
|
},
|
|
104
110
|
/** 背景颜色,默认为空字符串,即不处理 */
|
|
105
111
|
bgColor: String,
|
|
@@ -110,7 +116,7 @@ const props = defineProps({
|
|
|
110
116
|
/** 关闭按钮图标的颜色 */
|
|
111
117
|
closeColor: {
|
|
112
118
|
type: String,
|
|
113
|
-
default:
|
|
119
|
+
default: "#C6C7CB",
|
|
114
120
|
},
|
|
115
121
|
/** 镂空时是否填充背景色 */
|
|
116
122
|
plainFill: {
|
|
@@ -135,130 +141,128 @@ const props = defineProps({
|
|
|
135
141
|
/** 组件内置图标,或绝对路径的图片 */
|
|
136
142
|
icon: Object as PropType<HyIconProps>,
|
|
137
143
|
/** 定义需要用到的外部样式 */
|
|
138
|
-
customStyle:
|
|
144
|
+
customStyle: {
|
|
145
|
+
type: Object as PropType<CSSProperties>,
|
|
146
|
+
default: "",
|
|
147
|
+
},
|
|
139
148
|
/** 自定义外部类名 */
|
|
140
|
-
customClass:
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
plain,
|
|
147
|
-
type,
|
|
148
|
-
size,
|
|
149
|
-
plainFill,
|
|
150
|
-
closable,
|
|
151
|
-
bgColor,
|
|
152
|
-
color,
|
|
153
|
-
borderColor,
|
|
154
|
-
icon,
|
|
155
|
-
disabled,
|
|
156
|
-
customStyle,
|
|
157
|
-
customClass,
|
|
158
|
-
} = toRefs(props)
|
|
159
|
-
const emit = defineEmits<ITagEmits>()
|
|
149
|
+
customClass: {
|
|
150
|
+
type: String,
|
|
151
|
+
default: "",
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
const emit = defineEmits<ITagEmits>();
|
|
160
155
|
|
|
161
156
|
/**
|
|
162
157
|
* @description tag类名
|
|
163
158
|
* */
|
|
164
159
|
const tagClass = computed((): string[] => {
|
|
165
|
-
let classes = [
|
|
166
|
-
|
|
167
|
-
|
|
160
|
+
let classes = [
|
|
161
|
+
"hy-tag",
|
|
162
|
+
`hy-tag--${props.shape}`,
|
|
163
|
+
`hy-tag--${props.size}`,
|
|
164
|
+
props.customClass,
|
|
165
|
+
];
|
|
166
|
+
if (props.disabled) {
|
|
167
|
+
classes.push("hy-tag--disabled");
|
|
168
168
|
} else {
|
|
169
169
|
const arr = [
|
|
170
|
-
plain
|
|
171
|
-
plain
|
|
172
|
-
].filter(Boolean)
|
|
173
|
-
classes = classes.concat(arr as string[])
|
|
170
|
+
props.plain ? `hy-tag--${props.type}--plain` : `hy-tag--${props.type}`,
|
|
171
|
+
props.plain && props.plainFill && `hy-tag--${props.type}--plain__fill`,
|
|
172
|
+
].filter(Boolean);
|
|
173
|
+
classes = classes.concat(arr as string[]);
|
|
174
174
|
}
|
|
175
|
-
return classes
|
|
176
|
-
})
|
|
175
|
+
return classes;
|
|
176
|
+
});
|
|
177
177
|
/**
|
|
178
178
|
* @description tag样式
|
|
179
179
|
* */
|
|
180
180
|
const tagStyle = computed<CSSProperties>(() => {
|
|
181
181
|
const style: CSSProperties = {
|
|
182
|
-
marginRight: closable
|
|
183
|
-
marginTop: closable
|
|
184
|
-
background: bgColor
|
|
185
|
-
borderColor: borderColor
|
|
186
|
-
}
|
|
182
|
+
marginRight: props.closable ? "10px" : 0,
|
|
183
|
+
marginTop: props.closable ? "10px" : 0,
|
|
184
|
+
background: props.bgColor,
|
|
185
|
+
borderColor: props.borderColor,
|
|
186
|
+
};
|
|
187
187
|
|
|
188
|
-
if (color
|
|
189
|
-
if (plain
|
|
190
|
-
style.borderColor = color
|
|
191
|
-
if (plainFill
|
|
192
|
-
style.background = colorGradient(color
|
|
188
|
+
if (props.color) {
|
|
189
|
+
if (props.plain) {
|
|
190
|
+
style.borderColor = props.color;
|
|
191
|
+
if (props.plainFill) {
|
|
192
|
+
style.background = colorGradient(props.color, "#FFFFFF", 100)[90];
|
|
193
193
|
}
|
|
194
194
|
} else {
|
|
195
|
-
style.background = color
|
|
196
|
-
style.borderColor = color
|
|
195
|
+
style.background = props.color;
|
|
196
|
+
style.borderColor = props.color;
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
return Object.assign(style, customStyle
|
|
201
|
-
})
|
|
200
|
+
return Object.assign(style, props.customStyle);
|
|
201
|
+
});
|
|
202
202
|
|
|
203
203
|
/**
|
|
204
204
|
* @description 文本样式
|
|
205
205
|
* */
|
|
206
206
|
const textStyle = computed(() => {
|
|
207
|
-
const style: CSSProperties = {}
|
|
208
|
-
if (color
|
|
209
|
-
return style
|
|
210
|
-
})
|
|
207
|
+
const style: CSSProperties = {};
|
|
208
|
+
if (props.color && props.plain) style.color = props.color;
|
|
209
|
+
return style;
|
|
210
|
+
});
|
|
211
211
|
/**
|
|
212
212
|
* @description 文本类名
|
|
213
213
|
* */
|
|
214
214
|
const textClass = computed((): string[] => {
|
|
215
|
-
return [`hy-tag__text`, `hy-tag__text--${size
|
|
216
|
-
})
|
|
215
|
+
return [`hy-tag__text`, `hy-tag__text--${props.size}`];
|
|
216
|
+
});
|
|
217
217
|
|
|
218
218
|
/**
|
|
219
219
|
* @description 关闭图标icon大小
|
|
220
220
|
*/
|
|
221
221
|
const closeSize = computed(() => {
|
|
222
|
-
return size
|
|
223
|
-
})
|
|
222
|
+
return props.size === "large" ? 15 : props.size === "medium" ? 13 : 11;
|
|
223
|
+
});
|
|
224
224
|
/**
|
|
225
225
|
* @description 图标大小
|
|
226
226
|
* */
|
|
227
227
|
const hyIconSize = computed(() => {
|
|
228
|
-
if (icon
|
|
229
|
-
return icon.
|
|
228
|
+
if (props.icon?.size) {
|
|
229
|
+
return props.icon.size;
|
|
230
230
|
} else {
|
|
231
|
-
return size
|
|
231
|
+
return props.size === "large" ? 18 : props.size === "medium" ? 14 : 10;
|
|
232
232
|
}
|
|
233
|
-
})
|
|
233
|
+
});
|
|
234
234
|
/**
|
|
235
235
|
* @description 图标颜色
|
|
236
236
|
* */
|
|
237
237
|
const hyIconColor = computed(() => {
|
|
238
|
-
return
|
|
239
|
-
|
|
238
|
+
return props.icon?.color
|
|
239
|
+
? props.icon.color
|
|
240
|
+
: props.plain
|
|
241
|
+
? props.type
|
|
242
|
+
: "#ffffff";
|
|
243
|
+
});
|
|
240
244
|
|
|
241
245
|
/**
|
|
242
246
|
* @description 点击关闭按钮
|
|
243
247
|
* */
|
|
244
248
|
const closeHandler = () => {
|
|
245
|
-
if (!disabled
|
|
246
|
-
emit(
|
|
249
|
+
if (!props.disabled) {
|
|
250
|
+
emit("close", props.text);
|
|
247
251
|
}
|
|
248
|
-
}
|
|
252
|
+
};
|
|
249
253
|
/**
|
|
250
254
|
* @description 点击标签
|
|
251
255
|
* */
|
|
252
256
|
const clickHandler = () => {
|
|
253
|
-
if (!disabled
|
|
254
|
-
emit(
|
|
255
|
-
value: text
|
|
256
|
-
name: name
|
|
257
|
-
})
|
|
257
|
+
if (!props.disabled) {
|
|
258
|
+
emit("click", {
|
|
259
|
+
value: props.text,
|
|
260
|
+
name: props.name,
|
|
261
|
+
});
|
|
258
262
|
}
|
|
259
|
-
}
|
|
263
|
+
};
|
|
260
264
|
</script>
|
|
261
265
|
|
|
262
266
|
<style lang="scss" scoped>
|
|
263
|
-
@import
|
|
267
|
+
@import "./index.scss";
|
|
264
268
|
</style>
|
|
@@ -1,77 +1,82 @@
|
|
|
1
|
-
import type { CSSProperties } from
|
|
2
|
-
import type HyIconProps from
|
|
1
|
+
import type { CSSProperties } from "vue";
|
|
2
|
+
import type HyIconProps from "../hy-icon/typing";
|
|
3
3
|
|
|
4
4
|
export default interface HyTagProps {
|
|
5
5
|
/**
|
|
6
6
|
* @description 标签的文字内容
|
|
7
7
|
* */
|
|
8
|
-
text: string | number
|
|
8
|
+
text: string | number;
|
|
9
9
|
/**
|
|
10
10
|
* @description 点击需要传得值
|
|
11
11
|
* */
|
|
12
|
-
name?: string | number
|
|
12
|
+
name?: string | number;
|
|
13
13
|
/**
|
|
14
14
|
* @description 标签类型info、primary、success、warning、error (默认 'primary' )
|
|
15
15
|
* */
|
|
16
|
-
type?: HyApp.ThemeType
|
|
16
|
+
type?: HyApp.ThemeType;
|
|
17
17
|
/**
|
|
18
18
|
* @description 禁用(默认 false )
|
|
19
19
|
* */
|
|
20
|
-
disabled?: boolean
|
|
20
|
+
disabled?: boolean;
|
|
21
21
|
/**
|
|
22
22
|
* @description 标签的大小,large,medium,small (默认 'medium' )
|
|
23
23
|
* */
|
|
24
|
-
size?: HyApp.SizeType
|
|
24
|
+
size?: HyApp.SizeType;
|
|
25
25
|
/**
|
|
26
26
|
* @description tag的形状,circle(两边半圆形), square(方形,带圆角)(默认 'square' )
|
|
27
27
|
* */
|
|
28
|
-
shape?: HyApp.ShapeType
|
|
28
|
+
shape?: HyApp.ShapeType;
|
|
29
29
|
/**
|
|
30
30
|
* @description 背景颜色,默认为空字符串,即不处理
|
|
31
31
|
* */
|
|
32
|
-
bgColor?: string
|
|
32
|
+
bgColor?: string;
|
|
33
33
|
/**
|
|
34
34
|
* @description 标签字体颜色,默认为空字符串,即不处理
|
|
35
35
|
* */
|
|
36
|
-
color?: string
|
|
36
|
+
color?: string;
|
|
37
37
|
/**
|
|
38
38
|
* @description 镂空形式标签的边框颜色
|
|
39
39
|
* */
|
|
40
|
-
borderColor?: string
|
|
40
|
+
borderColor?: string;
|
|
41
41
|
/**
|
|
42
42
|
* @description 关闭按钮图标的颜色(默认 #C6C7CB)
|
|
43
43
|
* */
|
|
44
|
-
closeColor?: string
|
|
44
|
+
closeColor?: string;
|
|
45
45
|
/**
|
|
46
46
|
* @description 镂空时是否填充背景色(默认 false )
|
|
47
47
|
* */
|
|
48
|
-
plainFill?: boolean
|
|
48
|
+
plainFill?: boolean;
|
|
49
49
|
/**
|
|
50
50
|
* @description 是否镂空(默认 false )
|
|
51
51
|
* */
|
|
52
|
-
plain?: boolean
|
|
52
|
+
plain?: boolean;
|
|
53
53
|
/**
|
|
54
54
|
* @description 是否可关闭,设置为true,文字右边会出现一个关闭图标(默认 false )
|
|
55
55
|
* */
|
|
56
|
-
closable?: boolean
|
|
56
|
+
closable?: boolean;
|
|
57
57
|
/**
|
|
58
58
|
* @description 标签显示与否(默认 true )
|
|
59
59
|
* */
|
|
60
|
-
show?: boolean
|
|
60
|
+
show?: boolean;
|
|
61
61
|
/**
|
|
62
62
|
* @description 组件内置图标,或绝对路径的图片
|
|
63
63
|
* */
|
|
64
|
-
icon?: Partial<HyIconProps
|
|
64
|
+
icon?: Partial<HyIconProps>;
|
|
65
65
|
/**
|
|
66
66
|
* @description 定义需要用到的外部样式
|
|
67
67
|
* */
|
|
68
|
-
customStyle?: CSSProperties
|
|
68
|
+
customStyle?: CSSProperties;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
type TagParamsVo = {
|
|
71
|
+
export type TagParamsVo = {
|
|
72
|
+
/** 值 */
|
|
73
|
+
value?: string;
|
|
74
|
+
/** 名称 */
|
|
75
|
+
name?: string | number;
|
|
76
|
+
};
|
|
72
77
|
export interface ITagEmits {
|
|
73
78
|
/** 点击标签触发 */
|
|
74
|
-
(e:
|
|
79
|
+
(e: "click", params: TagParamsVo): void;
|
|
75
80
|
/** 关闭标签触发 */
|
|
76
|
-
(e:
|
|
81
|
+
(e: "close", value?: string): void;
|
|
77
82
|
}
|