hy-app 0.3.0 → 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 (108) 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-back-top/hy-back-top.vue +8 -6
  8. package/components/hy-badge/hy-badge.vue +47 -46
  9. package/components/hy-button/hy-button.vue +117 -93
  10. package/components/hy-calendar/hy-calendar.vue +168 -160
  11. package/components/hy-card/hy-card.vue +50 -43
  12. package/components/hy-card/typing.d.ts +33 -32
  13. package/components/hy-cell/hy-cell.vue +73 -51
  14. package/components/hy-check-button/hy-check-button.vue +54 -47
  15. package/components/hy-checkbox/hy-checkbox.vue +97 -105
  16. package/components/hy-code-input/hy-code-input.vue +80 -89
  17. package/components/hy-config-provider/hy-config-provider.vue +20 -21
  18. package/components/hy-count-down/hy-count-down.vue +66 -67
  19. package/components/hy-count-to/hy-count-to.vue +105 -99
  20. package/components/hy-count-to/typing.d.ts +13 -12
  21. package/components/hy-datetime-picker/hy-datetime-picker.vue +261 -253
  22. package/components/hy-datetime-picker/typing.d.ts +42 -40
  23. package/components/hy-divider/hy-divider.vue +68 -73
  24. package/components/hy-dropdown/hy-dropdown.vue +20 -19
  25. package/components/hy-dropdown-item/hy-dropdown-item.vue +66 -61
  26. package/components/hy-dropdown-item/typing.d.ts +9 -9
  27. package/components/hy-empty/hy-empty.vue +42 -42
  28. package/components/hy-flex/hy-flex.vue +99 -0
  29. package/components/hy-flex/index.scss +8 -0
  30. package/components/hy-flex/typing.d.ts +23 -0
  31. package/components/hy-float-button/hy-float-button.vue +218 -210
  32. package/components/hy-folding-panel/hy-folding-panel.vue +32 -33
  33. package/components/hy-form/hy-form.vue +264 -252
  34. package/components/hy-form/typing.d.ts +4 -0
  35. package/components/hy-form-group/hy-form-group.vue +114 -183
  36. package/components/hy-form-item/hy-form-item.vue +12 -10
  37. package/components/hy-form-item/index.scss +2 -2
  38. package/components/hy-form-item/typing.d.ts +3 -6
  39. package/components/hy-grid/hy-grid.vue +44 -43
  40. package/components/hy-icon/hy-icon.vue +61 -67
  41. package/components/hy-image/hy-image.vue +112 -88
  42. package/components/hy-image/typing.d.ts +27 -23
  43. package/components/hy-input/hy-input.vue +157 -127
  44. package/components/hy-input/typing.d.ts +53 -47
  45. package/components/hy-line/hy-line.vue +26 -26
  46. package/components/hy-line-progress/hy-line-progress.vue +42 -35
  47. package/components/hy-list/hy-list.vue +76 -85
  48. package/components/hy-loading/hy-loading.vue +26 -23
  49. package/components/hy-login/TheUserLogin.vue +1 -1
  50. package/components/hy-menu/hy-menu.vue +48 -43
  51. package/components/hy-menu/typing.d.ts +18 -17
  52. package/components/hy-modal/hy-modal.vue +39 -35
  53. package/components/hy-navbar/hy-navbar.vue +25 -25
  54. package/components/hy-navbar/typing.d.ts +24 -22
  55. package/components/hy-notice-bar/hy-notice-bar.vue +26 -27
  56. package/components/hy-notify/hy-notify.vue +53 -53
  57. package/components/hy-number-step/hy-number-step.vue +134 -146
  58. package/components/hy-number-step/typing.d.ts +35 -35
  59. package/components/hy-overlay/hy-overlay.vue +23 -21
  60. package/components/hy-pagination/hy-pagination.vue +41 -36
  61. package/components/hy-picker/hy-picker.vue +184 -154
  62. package/components/hy-picker/typing.d.ts +39 -39
  63. package/components/hy-popover/hy-popover.vue +97 -77
  64. package/components/hy-popup/hy-popup.vue +107 -98
  65. package/components/hy-price/hy-price.vue +38 -34
  66. package/components/hy-qrcode/hy-qrcode.vue +50 -51
  67. package/components/hy-radio/hy-radio.vue +101 -113
  68. package/components/hy-rate/hy-rate.vue +107 -88
  69. package/components/hy-read-more/hy-read-more.vue +64 -49
  70. package/components/hy-scroll-list/hy-scroll-list.vue +45 -48
  71. package/components/hy-search/hy-search.vue +73 -66
  72. package/components/hy-search/typing.d.ts +36 -35
  73. package/components/hy-signature/hy-signature.vue +282 -240
  74. package/components/hy-slider/hy-slider.vue +195 -153
  75. package/components/hy-slider/typing.d.ts +21 -21
  76. package/components/hy-steps/hy-steps.vue +118 -90
  77. package/components/hy-steps/index.scss +31 -21
  78. package/components/hy-submit-bar/hy-submit-bar.vue +61 -70
  79. package/components/hy-subsection/hy-subsection.vue +99 -102
  80. package/components/hy-subsection/typing.d.ts +19 -19
  81. package/components/hy-swipe-action/hy-swipe-action.vue +131 -118
  82. package/components/hy-swiper/hy-swiper.vue +85 -71
  83. package/components/hy-switch/hy-switch.vue +67 -72
  84. package/components/hy-switch/typing.d.ts +21 -19
  85. package/components/hy-tabs/hy-tabs.vue +168 -113
  86. package/components/hy-tag/hy-tag.vue +90 -86
  87. package/components/hy-tag/typing.d.ts +26 -21
  88. package/components/hy-text/hy-text.vue +119 -111
  89. package/components/hy-textarea/hy-textarea.vue +100 -93
  90. package/components/hy-textarea/typing.d.ts +36 -31
  91. package/components/hy-toast/hy-toast.vue +77 -67
  92. package/components/hy-tooltip/hy-tooltip.vue +109 -91
  93. package/components/hy-transition/hy-transition.vue +62 -66
  94. package/components/hy-upload/hy-upload.vue +294 -152
  95. package/components/hy-upload/typing.d.ts +41 -36
  96. package/components/hy-warn/hy-warn.vue +34 -27
  97. package/components/hy-waterfall/hy-waterfall.vue +83 -74
  98. package/components/hy-watermark/hy-watermark.vue +134 -115
  99. package/components/index.ts +1 -1
  100. package/composables/usePopover.ts +236 -221
  101. package/composables/useQueue.ts +53 -52
  102. package/global.d.ts +1 -0
  103. package/package.json +2 -2
  104. package/store/index.ts +9 -1
  105. package/theme.scss +5 -5
  106. package/typing/index.ts +0 -1
  107. package/typing/modules/common.d.ts +0 -2
  108. package/web-types.json +1 -1
@@ -24,7 +24,9 @@
24
24
  :top="item?.iconConfig?.top || iconConfig?.top"
25
25
  :stop="item?.iconConfig?.stop || iconConfig?.stop"
26
26
  :round="item?.iconConfig?.round || iconConfig?.round || 6"
27
- :customStyle="item?.iconConfig?.customStyle || iconConfig?.customStyle"
27
+ :customStyle="
28
+ item?.iconConfig?.customStyle || iconConfig?.customStyle
29
+ "
28
30
  ></HyIcon>
29
31
  </slot>
30
32
  </view>
@@ -34,29 +36,29 @@
34
36
 
35
37
  <script lang="ts">
36
38
  export default {
37
- name: 'hy-grid',
39
+ name: "hy-grid",
38
40
  options: {
39
41
  addGlobalClass: true,
40
42
  virtualHost: true,
41
- styleIsolation: 'shared',
43
+ styleIsolation: "shared",
42
44
  },
43
- }
45
+ };
44
46
  </script>
45
47
 
46
48
  <script setup lang="ts">
47
- import { computed, toRefs } from 'vue'
48
- import type { CSSProperties, PropType } from 'vue'
49
- import type { CustomKeysVo, GridItemVo, IGridEmits } from './typing'
50
- import { addUnit } from '../../utils'
51
- import type HyIconProps from '../hy-icon/typing'
49
+ import { computed } from "vue";
50
+ import type { CSSProperties, PropType } from "vue";
51
+ import type { CustomKeysVo, GridItemVo, IGridEmits } from "./typing";
52
+ import { addUnit } from "../../utils";
53
+ import type HyIconProps from "../hy-icon/typing";
52
54
  // 组件
53
- import HyIcon from '../hy-icon/hy-icon.vue'
55
+ import HyIcon from "../hy-icon/hy-icon.vue";
54
56
 
55
57
  /**
56
58
  * 宫格组件一般用于同时展示多个同类项目的场景,可以给宫格的项目设置徽标组件(badge),或者图标等,也可以扩展为左右滑动的轮播形式
57
59
  * @displayName hy-grid
58
60
  */
59
- defineOptions({})
61
+ defineOptions({});
60
62
 
61
63
  // const props = withDefaults(defineProps<IProps>(), defaultProps);
62
64
  const props = defineProps({
@@ -69,8 +71,8 @@ const props = defineProps({
69
71
  customKeys: {
70
72
  type: Object as PropType<CustomKeysVo>,
71
73
  default: () => ({
72
- name: 'name',
73
- icon: 'icon',
74
+ name: "name",
75
+ icon: "icon",
74
76
  }),
75
77
  },
76
78
  /** 宫格的列数 */
@@ -86,7 +88,7 @@ const props = defineProps({
86
88
  /** 单个宫格高度 */
87
89
  itemHeight: {
88
90
  type: [Number, String],
89
- default: '80px',
91
+ default: "80px",
90
92
  },
91
93
  /**
92
94
  * 宫格对齐方式,表现为数量少的时候,靠左,居中,还是靠右
@@ -94,7 +96,7 @@ const props = defineProps({
94
96
  * */
95
97
  align: {
96
98
  type: String,
97
- default: 'left',
99
+ default: "left",
98
100
  },
99
101
  /** 间隔 */
100
102
  gap: {
@@ -104,7 +106,7 @@ const props = defineProps({
104
106
  /** 宫格的背景颜色 */
105
107
  bgColor: {
106
108
  type: String,
107
- default: 'transparent',
109
+ default: "transparent",
108
110
  },
109
111
  /** 图标属性api配置集合 */
110
112
  iconConfig: Object as PropType<HyIconProps>,
@@ -112,47 +114,46 @@ const props = defineProps({
112
114
  customStyle: Object as PropType<CSSProperties>,
113
115
  /** 自定义外部类名 */
114
116
  customClass: String,
115
- })
116
- const { align, customStyle, bgColor, itemHeight, border } = toRefs(props)
117
- const emit = defineEmits<IGridEmits>()
117
+ });
118
+ const emit = defineEmits<IGridEmits>();
118
119
 
119
120
  /**
120
121
  * @description 宫格对齐方式
121
122
  * */
122
123
  const gridStyle = computed<CSSProperties>(() => {
123
- let style: CSSProperties = {}
124
- switch (align.value) {
125
- case 'left':
126
- style.justifyContent = 'flex-start'
127
- break
128
- case 'center':
129
- style.justifyContent = 'center'
130
- break
131
- case 'right':
132
- style.justifyContent = 'flex-end'
133
- break
124
+ let style: CSSProperties = {};
125
+ switch (props.align) {
126
+ case "left":
127
+ style.justifyContent = "flex-start";
128
+ break;
129
+ case "center":
130
+ style.justifyContent = "center";
131
+ break;
132
+ case "right":
133
+ style.justifyContent = "flex-end";
134
+ break;
134
135
  default:
135
- style.justifyContent = 'flex-start'
136
+ style.justifyContent = "flex-start";
136
137
  }
137
- return Object.assign(style, customStyle.value || {})
138
- })
138
+ return Object.assign(style, props.customStyle);
139
+ });
139
140
 
140
141
  const itemStyle = computed<CSSProperties>(() => {
141
142
  const style: CSSProperties = {
142
- background: bgColor.value,
143
- height: addUnit(itemHeight.value),
144
- width: '100%',
145
- border: border.value ? '0.5px solid #c8c7cc66' : '',
146
- }
147
- return style
148
- })
143
+ background: props.bgColor,
144
+ height: addUnit(props.itemHeight),
145
+ width: "100%",
146
+ border: props.border ? "0.5px solid #c8c7cc66" : "",
147
+ };
148
+ return style;
149
+ });
149
150
 
150
151
  /**
151
152
  * @description 点击事件
152
153
  * */
153
154
  const childClick = (name: string | Record<string, any>) => {
154
- emit('click', name)
155
- }
155
+ emit("click", name);
156
+ };
156
157
  </script>
157
158
 
158
159
  <style lang="scss" scoped>
@@ -160,5 +161,5 @@ const childClick = (name: string | Record<string, any>) => {
160
161
  grid-gap: v-bind(gap);
161
162
  grid-template-columns: repeat(v-bind(col), 1fr);
162
163
  }
163
- @import './index.scss';
164
+ @import "./index.scss";
164
165
  </style>
@@ -1,5 +1,8 @@
1
1
  <template>
2
- <view :class="`hy-icon ${customClass} hy-icon--${labelPos}`" @tap="clickHandler">
2
+ <view
3
+ :class="`hy-icon ${customClass} hy-icon--${labelPos}`"
4
+ @tap="clickHandler"
5
+ >
3
6
  <image
4
7
  class="hy-icon__img"
5
8
  v-if="isImg"
@@ -7,7 +10,12 @@
7
10
  :mode="imgMode"
8
11
  :style="[imgStyle, customStyle]"
9
12
  ></image>
10
- <text v-else class="hy-icon__icon" :class="uClasses" :style="[iconStyle, customStyle]"></text>
13
+ <text
14
+ v-else
15
+ class="hy-icon__icon"
16
+ :class="uClasses"
17
+ :style="[iconStyle, customStyle]"
18
+ ></text>
11
19
  <!-- 这里进行空字符串判断,如果仅仅是v-if="label",可能会出现传递0的时候,结果也无法显示 -->
12
20
  <text
13
21
  v-if="label"
@@ -26,26 +34,26 @@
26
34
 
27
35
  <script lang="ts">
28
36
  export default {
29
- name: 'hy-icon',
37
+ name: "hy-icon",
30
38
  options: {
31
39
  addGlobalClass: true,
32
40
  virtualHost: true,
33
- styleIsolation: 'shared',
41
+ styleIsolation: "shared",
34
42
  },
35
- }
43
+ };
36
44
  </script>
37
45
 
38
46
  <script setup lang="ts">
39
- import { computed, toRefs } from 'vue'
40
- import type { PropType, CSSProperties } from 'vue'
41
- import { addUnit } from '../../utils'
42
- import type { IIconEmits } from './typing'
47
+ import { computed } from "vue";
48
+ import type { PropType, CSSProperties } from "vue";
49
+ import { addUnit } from "../../utils";
50
+ import type { IIconEmits } from "./typing";
43
51
 
44
52
  /**
45
53
  * 基于字体的图标集,包含了大多数常见场景的图标,使用简单,开箱即用,无需自己再写每个图标的样式,直接简单配置即可。支持自定义图标。
46
54
  * @displayName hy-icon
47
55
  */
48
- defineOptions({})
56
+ defineOptions({});
49
57
 
50
58
  // const props = withDefaults(defineProps<IProps>(), defaultProps)
51
59
  const props = defineProps({
@@ -56,7 +64,7 @@ const props = defineProps({
56
64
  /** 图标字体大小,单位px */
57
65
  size: {
58
66
  type: [Number, String],
59
- default: '20px',
67
+ default: "20px",
60
68
  },
61
69
  /** 是否显示粗体 */
62
70
  bold: {
@@ -64,11 +72,14 @@ const props = defineProps({
64
72
  default: false,
65
73
  },
66
74
  /** 点击图标的时候传递事件出去的index(用于区分点击了哪一个) */
67
- index: String,
75
+ index: {
76
+ type: String,
77
+ default: "",
78
+ },
68
79
  /** 自定义扩展前缀,方便用户扩展自己的图标库 */
69
80
  customPrefix: {
70
81
  type: String,
71
- default: 'hy-icon',
82
+ default: "hy-icon",
72
83
  },
73
84
  /** 图标右侧的label文字 */
74
85
  label: String,
@@ -78,7 +89,7 @@ const props = defineProps({
78
89
  * */
79
90
  labelPos: {
80
91
  type: String,
81
- default: 'right',
92
+ default: "right",
82
93
  },
83
94
  /** label字体大小,单位px */
84
95
  labelSize: String,
@@ -87,7 +98,7 @@ const props = defineProps({
87
98
  /** label与图标的距离,单位px */
88
99
  space: {
89
100
  type: [Number, String],
90
- default: '2px',
101
+ default: "2px",
91
102
  },
92
103
  /** 图片的mode */
93
104
  imgMode: String,
@@ -119,82 +130,65 @@ const props = defineProps({
119
130
  customStyle: Object as PropType<CSSProperties>,
120
131
  /** 自定义外部类名 */
121
132
  customClass: String,
122
- })
123
- const {
124
- customPrefix,
125
- name,
126
- color,
127
- size,
128
- bold,
129
- top,
130
- width,
131
- height,
132
- stop,
133
- index,
134
- isRotate,
135
- round,
136
- customClass,
137
- customStyle,
138
- } = toRefs(props)
139
- const emit = defineEmits<IIconEmits>()
133
+ });
134
+ const emit = defineEmits<IIconEmits>();
140
135
 
141
136
  const uClasses = computed(() => {
142
137
  let classes: string | string[] = [
143
- 'iconfont',
144
- `${customPrefix.value}-${name.value}`,
145
- customPrefix.value,
146
- ]
147
- if (isRotate.value) classes.push('hy-rotate')
148
- if (color.value)
138
+ "iconfont",
139
+ `${props.customPrefix}-${props.name}`,
140
+ props.customPrefix,
141
+ ];
142
+ if (props.isRotate) classes.push("hy-rotate");
143
+ if (props.color)
149
144
  // 主题色,通过类配置
150
- classes.push('hy-icon__icon--' + color.value)
145
+ classes.push("hy-icon__icon--" + props.color);
151
146
  // 阿里,头条,百度小程序通过数组绑定类名时,无法直接使用[a, b, c]的形式,否则无法识别
152
147
  // 故需将其拆成一个字符串的形式,通过空格隔开各个类名
153
148
  //#ifdef MP-ALIPAY || MP-TOUTIAO || MP-BAIDU
154
- classes = classes.join(' ')
149
+ classes = classes.join(" ");
155
150
  //#endif
156
- return classes
157
- })
151
+ return classes;
152
+ });
158
153
  const iconStyle = computed<CSSProperties>(() => {
159
- let style: CSSProperties = {}
160
- style = {
161
- fontSize: addUnit(size.value),
162
- lineHeight: addUnit(size.value),
163
- fontWeight: bold.value ? 'bold' : 'normal',
164
- // 某些特殊情况需要设置一个到顶部的距离,才能更好的垂直居中
165
- top: addUnit(top.value),
166
- borderRadius: addUnit(round.value),
167
- color: color.value,
168
- }
154
+ const style: CSSProperties = {
155
+ fontSize: addUnit(props.size),
156
+ lineHeight: addUnit(props.size),
157
+ fontWeight: props.bold ? "bold" : "normal",
158
+ // 某些特殊情况需要设置一个到顶部的距离,才能更好地垂直居中
159
+ top: addUnit(props.top),
160
+ borderRadius: addUnit(props.round),
161
+ color: props.color,
162
+ };
169
163
 
170
- return style
171
- })
164
+ return style;
165
+ });
172
166
 
173
167
  /**
174
168
  * @description 判断传入的name属性,是否图片路径,只要带有"/"均认为是图片形式
175
169
  * */
176
170
  const isImg = computed(() => {
177
- return name.value?.indexOf('/') !== -1
178
- })
171
+ return props.name?.indexOf("/") !== -1;
172
+ });
179
173
  const imgStyle = computed((): CSSProperties => {
180
- let style: CSSProperties = {}
174
+ let style: CSSProperties = {};
181
175
  // 如果设置width和height属性,则优先使用,否则使用size属性
182
- style.width = width.value ? addUnit(width.value) : addUnit(size.value)
183
- style.height = height.value ? addUnit(height.value) : addUnit(size.value)
184
- style.borderRadius = addUnit(round.value)
185
- return style
186
- })
176
+ style.width = props.width ? addUnit(props.width) : addUnit(props.size);
177
+ style.height = props.height ? addUnit(props.height) : addUnit(props.size);
178
+ style.borderRadius = addUnit(props.round);
179
+ return style;
180
+ });
187
181
 
188
182
  /**
189
183
  * @description 点击
190
184
  * */
191
185
  const clickHandler = (e: Event) => {
192
- emit('click', index.value, e)
186
+ emit("click", props.index, e);
193
187
  // 是否阻止事件冒泡
194
- stop.value && e.stopPropagation()
195
- }
188
+ props.stop && e.stopPropagation();
189
+ };
196
190
  </script>
197
191
 
198
192
  <style lang="scss" scoped>
199
- @import './index.scss';
193
+ @import "./index.scss";
200
194
  </style>