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
@@ -32,7 +32,10 @@
32
32
  </text>
33
33
  </slot>
34
34
  </view>
35
- <view class="hy-modal__button-group--confirm-button" v-if="$slots.confirmButton">
35
+ <view
36
+ class="hy-modal__button-group--confirm-button"
37
+ v-if="$slots.confirmButton"
38
+ >
36
39
  <slot name="confirmButton"></slot>
37
40
  </view>
38
41
  <template v-else>
@@ -41,7 +44,9 @@
41
44
  'hy-modal__button-group',
42
45
  showCancelButton &&
43
46
  showConfirmButton &&
44
- (!buttonReverse ? 'hy-modal__button-exact' : 'hy-modal__button-exact--reverse'),
47
+ (!buttonReverse
48
+ ? 'hy-modal__button-exact'
49
+ : 'hy-modal__button-exact--reverse'),
45
50
  ]"
46
51
  :style="{
47
52
  flexDirection: buttonReverse ? 'row-reverse' : 'row',
@@ -89,28 +94,28 @@
89
94
 
90
95
  <script lang="ts">
91
96
  export default {
92
- name: 'hy-modal',
97
+ name: "hy-modal",
93
98
  options: {
94
99
  addGlobalClass: true,
95
100
  virtualHost: true,
96
- styleIsolation: 'shared',
101
+ styleIsolation: "shared",
97
102
  },
98
- }
103
+ };
99
104
  </script>
100
105
 
101
106
  <script setup lang="ts">
102
- import { ref, toRefs, watch } from 'vue'
103
- import type { IModalEmits } from './typing'
104
- import { addUnit } from '../../utils'
107
+ import { ref, watch } from "vue";
108
+ import type { IModalEmits } from "./typing";
109
+ import { addUnit } from "../../utils";
105
110
  // 组件
106
- import HyPopup from '../hy-popup/hy-popup.vue'
107
- import HyLoading from '../hy-loading/hy-loading.vue'
111
+ import HyPopup from "../hy-popup/hy-popup.vue";
112
+ import HyLoading from "../hy-loading/hy-loading.vue";
108
113
 
109
114
  /**
110
115
  * 弹出模态框,常用于消息提示、消息确认、在当前页面内完成特定的交互操作。
111
116
  * @displayName hy-modal
112
117
  */
113
- defineOptions({})
118
+ defineOptions({});
114
119
 
115
120
  // const props = withDefaults(defineProps<IProps>(), defaultProps)
116
121
  const props = defineProps({
@@ -126,12 +131,12 @@ const props = defineProps({
126
131
  /** 确认按钮的文字 */
127
132
  confirmText: {
128
133
  type: String,
129
- default: '确认',
134
+ default: "确认",
130
135
  },
131
136
  /** 取消按钮的文字 */
132
137
  cancelText: {
133
138
  type: String,
134
- default: '取消',
139
+ default: "取消",
135
140
  },
136
141
  /** 是否显示确认按钮 */
137
142
  showConfirmButton: {
@@ -180,7 +185,7 @@ const props = defineProps({
180
185
  /** modal宽度,不支持百分比,可以数值,px,rpx单位 */
181
186
  width: {
182
187
  type: [String, Number],
183
- default: '550rpx',
188
+ default: "550rpx",
184
189
  },
185
190
  /**
186
191
  * 确认按钮的样式,如设置,将不会显示取消按钮
@@ -193,55 +198,54 @@ const props = defineProps({
193
198
  * */
194
199
  contentTextAlign: {
195
200
  type: String,
196
- default: 'left',
201
+ default: "left",
197
202
  },
198
- })
199
- const { modelValue, asyncClose, closeOnClickOverlay } = toRefs(props)
200
- const emit = defineEmits<IModalEmits>()
203
+ });
204
+ const emit = defineEmits<IModalEmits>();
201
205
 
202
- const loading = ref<boolean>(false)
206
+ const loading = ref<boolean>(false);
203
207
 
204
208
  watch(
205
- () => modelValue.value,
209
+ () => props.modelValue,
206
210
  (newValue) => {
207
- if (newValue && loading.value) loading.value = false
211
+ if (newValue && loading.value) loading.value = false;
208
212
  },
209
- )
213
+ );
210
214
 
211
215
  /**
212
216
  * @description 点击确定按钮
213
217
  * */
214
218
  const confirmHandler = () => {
215
219
  // 如果配置了异步关闭,将按钮值为loading状态
216
- if (asyncClose.value) {
217
- loading.value = true
220
+ if (props.asyncClose) {
221
+ loading.value = true;
218
222
  } else {
219
- emit('update:modelValue', false)
223
+ emit("update:modelValue", false);
220
224
  }
221
- emit('confirm')
222
- }
225
+ emit("confirm");
226
+ };
223
227
 
224
228
  /**
225
229
  * @description 点击取消按钮
226
230
  * */
227
231
  const cancelHandler = () => {
228
- emit('update:modelValue', false)
229
- emit('cancel')
230
- }
232
+ emit("update:modelValue", false);
233
+ emit("cancel");
234
+ };
231
235
 
232
236
  /**
233
237
  * @description 点击遮罩
234
238
  * */
235
239
  const clickHandler = () => {
236
- if (closeOnClickOverlay.value) {
237
- emit('update:modelValue', false)
238
- emit('close')
240
+ if (props.closeOnClickOverlay) {
241
+ emit("update:modelValue", false);
242
+ emit("close");
239
243
  }
240
- }
244
+ };
241
245
  </script>
242
246
 
243
247
  <style lang="scss" scoped>
244
- @import './index.scss';
248
+ @import "./index.scss";
245
249
  .modal__content__text {
246
250
  text-align: v-bind(contentTextAlign);
247
251
  }
@@ -75,7 +75,9 @@
75
75
  >
76
76
  <slot name="right">
77
77
  <HyIcon v-if="rightIcon" :name="rightIcon" size="20"></HyIcon>
78
- <text v-if="rightText" class="hy-navbar__content__right__text">{{ rightText }}</text>
78
+ <text v-if="rightText" class="hy-navbar__content__right__text">{{
79
+ rightText
80
+ }}</text>
79
81
  </slot>
80
82
  </view>
81
83
  </view>
@@ -85,30 +87,29 @@
85
87
 
86
88
  <script lang="ts">
87
89
  export default {
88
- name: 'hy-navbar',
90
+ name: "hy-navbar",
89
91
  options: {
90
92
  addGlobalClass: true,
91
93
  virtualHost: true,
92
- styleIsolation: 'shared',
94
+ styleIsolation: "shared",
93
95
  },
94
- }
96
+ };
95
97
  </script>
96
98
 
97
99
  <script setup lang="ts">
98
- import { toRefs } from 'vue'
99
- import type { CSSProperties, PropType } from 'vue'
100
- import type { INavbarEmits } from './typing'
101
- import { addUnit, getPx, getWindowInfo } from '../../utils'
102
- import { IconConfig } from '../../config'
100
+ import type { CSSProperties, PropType } from "vue";
101
+ import type { INavbarEmits } from "./typing";
102
+ import { addUnit, getPx, getWindowInfo } from "../../utils";
103
+ import { IconConfig } from "../../config";
103
104
  // 组件
104
- import HyIcon from '../hy-icon/hy-icon.vue'
105
- import HyStatusBar from '../hy-status-bar/hy-status-bar.vue'
105
+ import HyIcon from "../hy-icon/hy-icon.vue";
106
+ import HyStatusBar from "../hy-status-bar/hy-status-bar.vue";
106
107
 
107
108
  /**
108
109
  * 一般用于在特殊情况下,需要自定义导航栏的时候用到,一般建议使用uni-app带的导航栏。
109
110
  * @displayName hy-navbar
110
111
  */
111
- defineOptions({})
112
+ defineOptions({});
112
113
 
113
114
  // const props = withDefaults(defineProps<IProps>(), defaultProps)
114
115
  const props = defineProps({
@@ -154,12 +155,12 @@ const props = defineProps({
154
155
  /** 导航栏标题的最大宽度,内容超出会以省略号隐藏 */
155
156
  titleWidth: {
156
157
  type: [String, Number],
157
- default: '400rpx',
158
+ default: "400rpx",
158
159
  },
159
160
  /** 导航栏高度(不包括状态栏高度在内,内部自动加上) */
160
161
  height: {
161
162
  type: [String, Number],
162
- default: '44px',
163
+ default: "44px",
163
164
  },
164
165
  /** 左侧返回图标的大小 */
165
166
  leftIconSize: {
@@ -183,31 +184,30 @@ const props = defineProps({
183
184
  },
184
185
  /** 自定义外部类名 */
185
186
  customClass: String,
186
- })
187
- const { autoBack, fixed } = toRefs(props)
188
- const emit = defineEmits<INavbarEmits>()
187
+ });
188
+ const emit = defineEmits<INavbarEmits>();
189
189
 
190
190
  // 获取状态栏高度
191
- const { statusBarHeight } = getWindowInfo()
191
+ const { statusBarHeight } = getWindowInfo();
192
192
 
193
193
  /**
194
194
  * @description 点击左侧区域
195
195
  * */
196
196
  const leftClick = () => {
197
197
  // 如果配置了autoBack,自动返回上一页
198
- emit('leftClick')
199
- if (autoBack.value) {
200
- uni.navigateBack()
198
+ emit("leftClick");
199
+ if (props.autoBack) {
200
+ uni.navigateBack();
201
201
  }
202
- }
202
+ };
203
203
  /**
204
204
  * @description 点击右侧区域
205
205
  * */
206
206
  const rightClick = () => {
207
- emit('rightClick')
208
- }
207
+ emit("rightClick");
208
+ };
209
209
  </script>
210
210
 
211
211
  <style lang="scss" scoped>
212
- @import './index.scss';
212
+ @import "./index.scss";
213
213
  </style>
@@ -1,85 +1,87 @@
1
- import type { CSSProperties } from 'vue'
1
+ import type { CSSProperties } from "vue";
2
2
 
3
3
  export default interface HyNavbarProps {
4
4
  /**
5
5
  * @description 是否开启顶部安全区适配 (默认 true )
6
6
  * */
7
- safeAreaInsetTop?: boolean
7
+ safeAreaInsetTop?: boolean;
8
8
  /**
9
9
  * @description 固定在顶部时,是否生成一个等高元素,以防止塌陷 (默认 false )
10
10
  * */
11
- placeholder?: boolean
11
+ placeholder?: boolean;
12
12
  /**
13
13
  * @description 导航栏是否固定在顶部 (默认 true )
14
14
  * */
15
- fixed?: boolean
15
+ fixed?: boolean;
16
16
  /**
17
17
  * @description 导航栏底部是否显示下边框 (默认 false )
18
18
  * */
19
- border?: boolean
19
+ border?: boolean;
20
20
  /**
21
21
  * @description 左边返回图标的名称,只能为uview-pls自带的图标 (默认 'left' )
22
22
  * */
23
- leftIcon?: string
23
+ leftIcon?: string;
24
24
  /**
25
25
  * @description 左边的提示文字
26
26
  * */
27
- leftText?: string
27
+ leftText?: string;
28
28
  /**
29
29
  * @description 右边的提示文字
30
30
  * */
31
- rightText?: string
31
+ rightText?: string;
32
32
  /**
33
33
  * @description 右边返回图标的名称,只能为uview-plus自带的图标
34
34
  * */
35
- rightIcon?: string
35
+ rightIcon?: string;
36
36
  /**
37
37
  * @description 导航栏标题,如设置为空字符,将会隐藏标题占位区域
38
38
  * */
39
- title?: string
39
+ title?: string;
40
40
  /**
41
41
  * @description 导航栏副标题
42
42
  * */
43
- sub?: string
43
+ sub?: string;
44
44
  /**
45
45
  * @description 文字颜色 (默认 '' )
46
46
  * */
47
- titleColor?: string
47
+ titleColor?: string;
48
48
  /**
49
49
  * @description 导航栏背景设置 (默认 '#ffffff' )
50
50
  * */
51
- bgColor?: string
51
+ bgColor?: string;
52
52
  /**
53
53
  * @description 导航栏标题的最大宽度,内容超出会以省略号隐藏 (默认 '400rpx' )
54
54
  * */
55
- titleWidth?: string | number
55
+ titleWidth?: string | number;
56
56
  /**
57
57
  * @description 导航栏高度(不包括状态栏高度在内,内部自动加上)(默认 '44px' )
58
58
  * */
59
- height?: string | number
59
+ height?: string | number;
60
60
  /**
61
61
  * @description 左侧返回图标的大小(默认 20px )
62
62
  * */
63
- leftIconSize?: string | number
63
+ leftIconSize?: string | number;
64
64
  /**
65
65
  * @description 左侧返回图标的颜色(默认 #303133 )
66
66
  * */
67
- leftIconColor?: string
67
+ leftIconColor?: string;
68
68
  /**
69
69
  * @description 点击左侧区域(返回图标),是否自动返回上一页(默认 false )
70
70
  * */
71
- autoBack?: boolean
71
+ autoBack?: boolean;
72
72
  /**
73
73
  * @description 标题的样式,对象或字符串
74
74
  * */
75
- titleStyle?: CSSProperties
75
+ titleStyle?: CSSProperties;
76
76
  /**
77
77
  * @description 定义需要用到的外部样式
78
78
  * */
79
- customStyle?: CSSProperties
79
+ customStyle?: CSSProperties;
80
80
  }
81
81
 
82
82
  export interface INavbarEmits {
83
- (e: 'leftClick'): void
84
- (e: 'rightClick'): void
83
+ /** 点击导航栏左边 */
84
+ (e: "leftClick"): void;
85
+ /** 点击导航栏右边 */
86
+ (e: "rightClick"): void;
85
87
  }
@@ -45,31 +45,31 @@
45
45
 
46
46
  <script lang="ts">
47
47
  export default {
48
- name: 'hy-notice-bar',
48
+ name: "hy-notice-bar",
49
49
  options: {
50
50
  addGlobalClass: true,
51
51
  virtualHost: true,
52
- styleIsolation: 'shared',
52
+ styleIsolation: "shared",
53
53
  },
54
- }
54
+ };
55
55
  </script>
56
56
 
57
57
  <script setup lang="ts">
58
- import { ref, toRefs } from 'vue'
59
- import type { PropType, CSSProperties } from 'vue'
60
- import { INoticeBarEmits, NoticeBarModeVo } from './typing'
61
- import { IconConfig } from '../../config'
58
+ import { ref } from "vue";
59
+ import type { PropType, CSSProperties } from "vue";
60
+ import type { INoticeBarEmits, NoticeBarModeVo } from "./typing";
61
+ import { IconConfig } from "../../config";
62
62
  // 组件
63
- import HyRowNotice from './hy-row-notice.vue'
64
- import HyColumnNotice from './hy-column-notice.vue'
63
+ import HyRowNotice from "./hy-row-notice.vue";
64
+ import HyColumnNotice from "./hy-column-notice.vue";
65
65
 
66
66
  /**
67
67
  * 该组件用于滚动通告场景,有多种模式可供选择
68
68
  * @displayName hy-notice-bar
69
69
  */
70
- defineOptions({})
70
+ defineOptions({});
71
71
 
72
- const show = ref(true)
72
+ const show = ref(true);
73
73
 
74
74
  // const props = withDefaults(defineProps<IProps>(), defaultProps);
75
75
  const props = defineProps({
@@ -84,7 +84,7 @@ const props = defineProps({
84
84
  * */
85
85
  direction: {
86
86
  type: String,
87
- default: 'row',
87
+ default: "row",
88
88
  },
89
89
  /** direction = row时,是否使用步进形式滚动 */
90
90
  step: {
@@ -130,16 +130,16 @@ const props = defineProps({
130
130
  * @values flex-start,flex-start,center
131
131
  * */
132
132
  justifyContent: {
133
- type: String,
134
- default: 'flex-start',
133
+ type: String as PropType<HyApp.JustifyContentType>,
134
+ default: "flex-start",
135
135
  },
136
136
  /**
137
137
  * 跳转类型
138
138
  * @values navigateTo,redirectTo,switchTab,reLaunch
139
139
  * */
140
140
  linkType: {
141
- type: String,
142
- default: 'navigateTo',
141
+ type: String as PropType<HyApp.NavigationType>,
142
+ default: "navigateTo",
143
143
  },
144
144
  /** 跳转地址 */
145
145
  url: String,
@@ -147,28 +147,27 @@ const props = defineProps({
147
147
  customStyle: Object as PropType<CSSProperties>,
148
148
  /** 自定义外部类名 */
149
149
  customClass: String,
150
- })
151
- const { mode, linkType, url } = toRefs(props)
152
- const emit = defineEmits<INoticeBarEmits>()
150
+ });
151
+ const emit = defineEmits<INoticeBarEmits>();
153
152
 
154
153
  /**
155
154
  * @description 点击通告栏
156
155
  * */
157
156
  const click = (index: number) => {
158
- emit('click', index)
159
- if (url.value && linkType.value && mode.value === 'link') {
160
- ;(uni as any)[linkType.value]({ url: url.value })
157
+ emit("click", index);
158
+ if (props.url && props.linkType && props.mode === "link") {
159
+ (uni as any)[props.linkType]({ url: props.url });
161
160
  }
162
- }
161
+ };
163
162
  /**
164
163
  * @description 点击关闭按钮
165
164
  * */
166
165
  const close = () => {
167
- show.value = false
168
- emit('close')
169
- }
166
+ show.value = false;
167
+ emit("close");
168
+ };
170
169
  </script>
171
170
 
172
171
  <style lang="scss" scoped>
173
- @import './index.scss';
172
+ @import "./index.scss";
174
173
  </style>