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.
Files changed (96) hide show
  1. package/README.md +6 -3
  2. package/common/shakeService.ts +31 -29
  3. package/components/avatar.zip +0 -0
  4. package/components/hy-action-sheet/hy-action-sheet.vue +71 -46
  5. package/components/hy-address-picker/hy-address-picker.vue +94 -83
  6. package/components/hy-avatar/hy-avatar.vue +84 -85
  7. package/components/hy-badge/hy-badge.vue +47 -46
  8. package/components/hy-button/hy-button.vue +117 -93
  9. package/components/hy-calendar/hy-calendar.vue +168 -160
  10. package/components/hy-card/hy-card.vue +50 -43
  11. package/components/hy-card/typing.d.ts +33 -32
  12. package/components/hy-cell/hy-cell.vue +73 -51
  13. package/components/hy-check-button/hy-check-button.vue +54 -47
  14. package/components/hy-checkbox/hy-checkbox.vue +97 -105
  15. package/components/hy-code-input/hy-code-input.vue +80 -89
  16. package/components/hy-config-provider/hy-config-provider.vue +19 -20
  17. package/components/hy-count-down/hy-count-down.vue +66 -67
  18. package/components/hy-count-to/hy-count-to.vue +105 -99
  19. package/components/hy-count-to/typing.d.ts +13 -12
  20. package/components/hy-datetime-picker/hy-datetime-picker.vue +261 -253
  21. package/components/hy-datetime-picker/typing.d.ts +42 -40
  22. package/components/hy-divider/hy-divider.vue +68 -73
  23. package/components/hy-dropdown/hy-dropdown.vue +20 -19
  24. package/components/hy-dropdown-item/hy-dropdown-item.vue +66 -61
  25. package/components/hy-dropdown-item/typing.d.ts +9 -9
  26. package/components/hy-empty/hy-empty.vue +42 -42
  27. package/components/hy-flex/hy-flex.vue +52 -26
  28. package/components/hy-float-button/hy-float-button.vue +218 -210
  29. package/components/hy-folding-panel/hy-folding-panel.vue +32 -33
  30. package/components/hy-form/hy-form.vue +264 -259
  31. package/components/hy-grid/hy-grid.vue +44 -43
  32. package/components/hy-icon/hy-icon.vue +61 -67
  33. package/components/hy-image/hy-image.vue +112 -88
  34. package/components/hy-image/typing.d.ts +27 -23
  35. package/components/hy-input/hy-input.vue +157 -127
  36. package/components/hy-input/typing.d.ts +53 -47
  37. package/components/hy-line/hy-line.vue +26 -26
  38. package/components/hy-line-progress/hy-line-progress.vue +42 -35
  39. package/components/hy-list/hy-list.vue +76 -85
  40. package/components/hy-loading/hy-loading.vue +26 -23
  41. package/components/hy-menu/hy-menu.vue +48 -43
  42. package/components/hy-menu/typing.d.ts +18 -17
  43. package/components/hy-modal/hy-modal.vue +39 -35
  44. package/components/hy-navbar/hy-navbar.vue +25 -25
  45. package/components/hy-navbar/typing.d.ts +24 -22
  46. package/components/hy-notice-bar/hy-notice-bar.vue +26 -27
  47. package/components/hy-notify/hy-notify.vue +53 -53
  48. package/components/hy-number-step/hy-number-step.vue +134 -146
  49. package/components/hy-number-step/typing.d.ts +35 -35
  50. package/components/hy-overlay/hy-overlay.vue +23 -21
  51. package/components/hy-pagination/hy-pagination.vue +41 -36
  52. package/components/hy-picker/hy-picker.vue +184 -154
  53. package/components/hy-picker/typing.d.ts +39 -39
  54. package/components/hy-popover/hy-popover.vue +97 -77
  55. package/components/hy-popup/hy-popup.vue +107 -98
  56. package/components/hy-price/hy-price.vue +38 -34
  57. package/components/hy-qrcode/hy-qrcode.vue +50 -51
  58. package/components/hy-radio/hy-radio.vue +101 -113
  59. package/components/hy-rate/hy-rate.vue +107 -88
  60. package/components/hy-read-more/hy-read-more.vue +64 -49
  61. package/components/hy-scroll-list/hy-scroll-list.vue +45 -48
  62. package/components/hy-search/hy-search.vue +73 -66
  63. package/components/hy-search/typing.d.ts +36 -35
  64. package/components/hy-signature/hy-signature.vue +282 -240
  65. package/components/hy-slider/hy-slider.vue +195 -153
  66. package/components/hy-slider/typing.d.ts +21 -21
  67. package/components/hy-steps/hy-steps.vue +118 -90
  68. package/components/hy-steps/index.scss +31 -21
  69. package/components/hy-submit-bar/hy-submit-bar.vue +61 -70
  70. package/components/hy-subsection/hy-subsection.vue +99 -102
  71. package/components/hy-subsection/typing.d.ts +19 -19
  72. package/components/hy-swipe-action/hy-swipe-action.vue +131 -118
  73. package/components/hy-swiper/hy-swiper.vue +85 -71
  74. package/components/hy-switch/hy-switch.vue +67 -72
  75. package/components/hy-switch/typing.d.ts +21 -19
  76. package/components/hy-tabs/hy-tabs.vue +168 -113
  77. package/components/hy-tag/hy-tag.vue +90 -86
  78. package/components/hy-tag/typing.d.ts +26 -21
  79. package/components/hy-text/hy-text.vue +119 -111
  80. package/components/hy-textarea/hy-textarea.vue +100 -93
  81. package/components/hy-textarea/typing.d.ts +36 -31
  82. package/components/hy-toast/hy-toast.vue +77 -67
  83. package/components/hy-tooltip/hy-tooltip.vue +109 -91
  84. package/components/hy-transition/hy-transition.vue +62 -66
  85. package/components/hy-upload/hy-upload.vue +294 -152
  86. package/components/hy-upload/typing.d.ts +41 -36
  87. package/components/hy-warn/hy-warn.vue +34 -27
  88. package/components/hy-waterfall/hy-waterfall.vue +83 -74
  89. package/components/hy-watermark/hy-watermark.vue +134 -115
  90. package/composables/usePopover.ts +236 -221
  91. package/composables/useQueue.ts +53 -52
  92. package/package.json +2 -2
  93. package/store/index.ts +9 -1
  94. package/typing/index.ts +0 -1
  95. package/typing/modules/common.d.ts +0 -2
  96. 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="Object.assign({ marginRight: '3px' }, icon?.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 :name="IconConfig.CLOSE" :size="closeSize" color="#ffffff"></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: 'hy-tag',
48
+ name: "hy-tag",
43
49
  options: {
44
50
  addGlobalClass: true,
45
51
  virtualHost: true,
46
- styleIsolation: 'shared',
52
+ styleIsolation: "shared",
47
53
  },
48
- }
54
+ };
49
55
  </script>
50
56
 
51
57
  <script setup lang="ts">
52
- import { computed, toRefs } from 'vue'
53
- import type { CSSProperties, PropType } from 'vue'
54
- import type { ITagEmits } from './typing'
55
- import { IconConfig } from '../../config'
56
- import { colorGradient } from '../../utils'
57
- import type HyIconProps from '../hy-icon/typing'
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 '../hy-transition/hy-transition.vue'
61
- import HyIcon from '../hy-icon/hy-icon.vue'
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: 'primary',
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: 'medium',
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: 'square',
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: '#C6C7CB',
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: Object as PropType<CSSProperties>,
144
+ customStyle: {
145
+ type: Object as PropType<CSSProperties>,
146
+ default: "",
147
+ },
139
148
  /** 自定义外部类名 */
140
- customClass: String,
141
- })
142
- const {
143
- text,
144
- name,
145
- shape,
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 = ['hy-tag', `hy-tag--${shape.value}`, `hy-tag--${size.value}`, customClass.value]
166
- if (disabled.value) {
167
- classes.push('hy-tag--disabled')
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.value ? `hy-tag--${type.value}--plain` : `hy-tag--${type.value}`,
171
- plain.value && plainFill.value && `hy-tag--${type.value}--plain__fill`,
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.value ? '10px' : 0,
183
- marginTop: closable.value ? '10px' : 0,
184
- background: bgColor.value,
185
- borderColor: borderColor.value,
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.value) {
189
- if (plain.value) {
190
- style.borderColor = color.value
191
- if (plainFill.value) {
192
- style.background = colorGradient(color.value, '#FFFFFF', 100)[90]
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.value
196
- style.borderColor = color.value
195
+ style.background = props.color;
196
+ style.borderColor = props.color;
197
197
  }
198
198
  }
199
199
 
200
- return Object.assign(style, customStyle.value)
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.value && plain.value) style.color = color.value
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.value}`]
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.value === 'large' ? 15 : size.value === 'medium' ? 13 : 11
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.value.size) {
229
- return icon.value.size
228
+ if (props.icon?.size) {
229
+ return props.icon.size;
230
230
  } else {
231
- return size.value === 'large' ? 18 : size.value === 'medium' ? 14 : 10
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 icon.value.color ? icon.value.color : plain.value ? type.value : '#ffffff'
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.value) {
246
- emit('close', text.value)
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.value) {
254
- emit('click', {
255
- value: text.value,
256
- name: name.value,
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 './index.scss';
267
+ @import "./index.scss";
264
268
  </style>
@@ -1,77 +1,82 @@
1
- import type { CSSProperties } from 'vue'
2
- import type HyIconProps from '../hy-icon/typing'
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 = { value: string; name: string | number }
71
+ export type TagParamsVo = {
72
+ /** 值 */
73
+ value?: string;
74
+ /** 名称 */
75
+ name?: string | number;
76
+ };
72
77
  export interface ITagEmits {
73
78
  /** 点击标签触发 */
74
- (e: 'click', params: TagParamsVo): void
79
+ (e: "click", params: TagParamsVo): void;
75
80
  /** 关闭标签触发 */
76
- (e: 'close', value: string): void
81
+ (e: "close", value?: string): void;
77
82
  }