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
@@ -1,44 +1,49 @@
1
- import type { CSSProperties } from 'vue'
1
+ import type { CSSProperties } from "vue";
2
+ import type {
3
+ InputOnBlurEvent,
4
+ InputOnConfirmEvent,
5
+ InputOnFocusEvent,
6
+ } from "@uni-helper/uni-types";
2
7
 
3
8
  export default interface HyTextareaProps {
4
- modelValue: string
5
- placeholder?: string | null
6
- placeholderClass?: string
7
- placeholderStyle?: CSSProperties
8
- height?: number
9
- confirmType?: 'done' | 'send' | 'search' | 'next' | 'go'
10
- disabled?: boolean
11
- count?: boolean
12
- focus?: boolean
13
- autoHeight?: boolean
14
- fixed?: boolean
15
- cursorSpacing?: number
16
- cursor?: string
17
- showConfirmBar?: boolean
18
- selectionStart?: number
19
- selectionEnd?: number
20
- adjustPosition?: boolean
21
- disableDefaultPadding?: boolean
22
- holdKeyboard?: boolean
23
- maxlength?: number
24
- border?: HyApp.BorderType
25
- formatter?: ((value: string) => string) | null
26
- customStyle?: CSSProperties
9
+ modelValue: string;
10
+ placeholder?: string | null;
11
+ placeholderClass?: string;
12
+ placeholderStyle?: CSSProperties;
13
+ height?: number;
14
+ confirmType?: "done" | "send" | "search" | "next" | "go";
15
+ disabled?: boolean;
16
+ count?: boolean;
17
+ focus?: boolean;
18
+ autoHeight?: boolean;
19
+ fixed?: boolean;
20
+ cursorSpacing?: number;
21
+ cursor?: string;
22
+ showConfirmBar?: boolean;
23
+ selectionStart?: number;
24
+ selectionEnd?: number;
25
+ adjustPosition?: boolean;
26
+ disableDefaultPadding?: boolean;
27
+ holdKeyboard?: boolean;
28
+ maxlength?: number;
29
+ border?: HyApp.BorderType;
30
+ formatter?: ((value: string) => string) | null;
31
+ customStyle?: CSSProperties;
27
32
  }
28
33
 
29
34
  export interface ITextareaEmits {
30
35
  /** 输入框失去焦点时触发 */
31
- (e: 'blur', event: any): void
36
+ (e: "blur", event: InputOnBlurEvent): void;
32
37
  /** 输入框聚焦时触发 */
33
- (e: 'focus', event: any): void
38
+ (e: "focus", event: InputOnFocusEvent): void;
34
39
  /** 当键盘输入时,触发 input 事件 */
35
- (e: 'change', value: string): void
40
+ (e: "change", value: string): void;
36
41
  /** 点击完成时, 触发 confirm 事件 */
37
- (e: 'confirm', event: any): void
42
+ (e: "confirm", event: InputOnConfirmEvent): void;
38
43
  /** 输入框行数变化时调用 */
39
- (e: 'lineChange', event: any): void
44
+ (e: "lineChange", event: any): void;
40
45
  /** 当键盘输入时,触发 input 事件 */
41
- (e: 'update:modelValue', value: string): void
46
+ (e: "update:modelValue", value: string): void;
42
47
  /** 键盘高度发生变化的时候触发此事件 */
43
- (e: 'keyboardheightchange', event: any): void
48
+ (e: "keyboardheightchange", event: InputOnKeyboardheightchangeEvent): void;
44
49
  }
@@ -1,11 +1,17 @@
1
1
  <template>
2
- <HyOverlay :show="isShow" :zIndex="tmpConfig.overlay ? 10070 : -1" :custom-style="overlayStyle">
2
+ <HyOverlay
3
+ :show="isShow"
4
+ :zIndex="tmpConfig.overlay ? 10070 : -1"
5
+ :custom-style="overlayStyle"
6
+ >
3
7
  <view
4
8
  :style="[contentStyle]"
5
9
  :class="[
6
10
  'hy-toast__content',
7
11
  'hy-toast--' + tmpConfig.type,
8
- tmpConfig.type === 'loading' || tmpConfig.loading ? 'hy-toast__content--loading' : '',
12
+ tmpConfig.type === 'loading' || tmpConfig.loading
13
+ ? 'hy-toast__content--loading'
14
+ : '',
9
15
  ]"
10
16
  >
11
17
  <HyLoading
@@ -24,7 +30,10 @@
24
30
  :customStyle="iconStyle"
25
31
  ></HyIcon>
26
32
  <text
27
- :class="['hy-toast__content__text', 'hy-toast__content__text--' + tmpConfig.type]"
33
+ :class="[
34
+ 'hy-toast__content__text',
35
+ 'hy-toast__content__text--' + tmpConfig.type,
36
+ ]"
28
37
  style="max-width: 400rpx"
29
38
  >
30
39
  {{ tmpConfig.message }}
@@ -35,149 +44,150 @@
35
44
 
36
45
  <script lang="ts">
37
46
  export default {
38
- name: 'hy-toast',
47
+ name: "hy-toast",
39
48
  options: {
40
49
  addGlobalClass: true,
41
50
  virtualHost: true,
42
- styleIsolation: 'shared',
51
+ styleIsolation: "shared",
43
52
  },
44
- }
53
+ };
45
54
  </script>
46
55
 
47
56
  <script setup lang="ts">
48
- import { computed, type CSSProperties, reactive, ref } from 'vue'
49
- import type ToastParamsVo from './typing'
50
- import { getWindowInfo, hexToRgb } from '../../utils'
51
- import { ColorConfig, iconName } from '../../config'
52
-
57
+ import { computed, reactive, ref } from "vue";
58
+ import type { CSSProperties } from "vue";
59
+ import type ToastParamsVo from "./typing";
60
+ import { getWindowInfo, hexToRgb } from "../../utils";
61
+ import { ColorConfig, iconName } from "../../config";
53
62
  // 组件
54
- import HyOverlay from '../hy-overlay/hy-overlay.vue'
55
- import HyIcon from '../hy-icon/hy-icon.vue'
56
- import HyLoading from '../hy-loading/hy-loading.vue'
63
+ import HyOverlay from "../hy-overlay/hy-overlay.vue";
64
+ import HyIcon from "../hy-icon/hy-icon.vue";
65
+ import HyLoading from "../hy-loading/hy-loading.vue";
57
66
 
58
67
  /**
59
68
  * Toast 组件主要用于消息通知、加载提示、操作结果提示等醒目提示效果,我们为其提供了多种丰富的API。
60
69
  * @displayName hy-toast
61
70
  */
62
- defineOptions({})
71
+ defineOptions({});
63
72
 
64
- const isShow = ref(false)
65
- const tmpConfig = ref<ToastParamsVo>({})
73
+ const isShow = ref(false);
74
+ const tmpConfig = ref<ToastParamsVo>({});
66
75
  const config: ToastParamsVo = reactive({
67
- message: '',
68
- type: 'info',
76
+ message: "",
77
+ type: "info",
69
78
  duration: 2000,
70
79
  icon: false,
71
- position: 'center',
80
+ position: "center",
72
81
  complete: null,
73
82
  overlay: true,
74
83
  loading: false,
75
- })
76
- let timer: any = null
84
+ });
85
+ let timer: any = null;
77
86
 
78
87
  const isThemeType = (type: string): boolean =>
79
- ['error', 'warning', 'success', 'primary', 'info'].includes(type)
88
+ ["error", "warning", "success", "primary", "info"].includes(type);
80
89
 
81
90
  const overlayStyle = computed(() => {
82
91
  const style: CSSProperties = {
83
- justifyContent: 'center',
84
- alignItems: 'center',
85
- display: 'flex',
86
- }
92
+ justifyContent: "center",
93
+ alignItems: "center",
94
+ display: "flex",
95
+ };
87
96
  // 将遮罩设置为100%透明度,避免出现灰色背景
88
- style.backgroundColor = 'rgba(0, 0, 0, 0)'
89
- return style
90
- })
97
+ style.backgroundColor = "rgba(0, 0, 0, 0)";
98
+ return style;
99
+ });
91
100
 
92
101
  const iconNameCom = computed(() => {
93
102
  // 只有不为none,并且type为error|warning|succes|info时候,才显示图标
94
103
  if (!tmpConfig.value.icon || !tmpConfig.value.type) {
95
- return ''
104
+ return "";
96
105
  }
97
106
  if (tmpConfig.value.icon === true) {
98
107
  if (isThemeType(tmpConfig.value.type)) {
99
- return iconName(tmpConfig.value.type)
108
+ return iconName(tmpConfig.value.type);
100
109
  } else {
101
- return ''
110
+ return "";
102
111
  }
103
112
  } else {
104
- return tmpConfig.value.icon
113
+ return tmpConfig.value.icon;
105
114
  }
106
- })
115
+ });
107
116
  const iconStyle = computed(() => {
108
- const style: CSSProperties = {}
117
+ const style: CSSProperties = {};
109
118
  // 图标需要一个右边距,以跟右边的文字有隔开的距离
110
- style.marginRight = '4px'
111
- return style
112
- })
119
+ style.marginRight = "4px";
120
+ return style;
121
+ });
113
122
 
114
123
  /**
115
124
  * @description 内容盒子的样式
116
125
  * */
117
126
  const contentStyle = computed(() => {
118
127
  const windowHeight = getWindowInfo().windowHeight,
119
- style: CSSProperties = {}
120
- let value = 0
128
+ style: CSSProperties = {};
129
+ let value = 0;
121
130
  // 根据top和bottom,对Y轴进行窗体高度的百分比偏移
122
- if (tmpConfig.value.position === 'top') {
123
- value = -windowHeight * 0.25
124
- } else if (tmpConfig.value.position === 'bottom') {
125
- value = windowHeight * 0.25
131
+ if (tmpConfig.value.position === "top") {
132
+ value = -windowHeight * 0.25;
133
+ } else if (tmpConfig.value.position === "bottom") {
134
+ value = windowHeight * 0.25;
126
135
  }
127
- style.transform = `translateY(${value}px)`
128
- return style
129
- })
136
+ style.transform = `translateY(${value}px)`;
137
+ return style;
138
+ });
130
139
 
131
140
  const loadingIconColor = computed(() => {
132
- let colorTmp = 'rgb(255, 255, 255)'
141
+ let colorTmp = "rgb(255, 255, 255)";
133
142
  if (isThemeType(tmpConfig.value.type)) {
134
143
  // loading-icon组件内部会对color参数进行一个透明度处理,该方法要求传入的颜色值
135
144
  // 必须为rgb格式的,所以这里做一个处理
136
- colorTmp = hexToRgb(ColorConfig[tmpConfig.value.type]) as string
145
+ colorTmp = hexToRgb(ColorConfig[tmpConfig.value.type]) as string;
137
146
  }
138
- return colorTmp
139
- })
147
+ return colorTmp;
148
+ });
140
149
 
141
150
  /**
142
151
  * @description 显示toast组件,由父组件通过xxx.show(options)形式调用
143
152
  * */
144
153
  const show = (options: ToastParamsVo) => {
145
154
  // 不将结果合并到this.config变量,避免多次调用u-toast,前后的配置造成混乱
146
- tmpConfig.value = Object.assign(config, options)
155
+ tmpConfig.value = Object.assign(config, options);
147
156
  // 清除定时器
148
- clearTimer()
149
- isShow.value = true
157
+ clearTimer();
158
+ isShow.value = true;
150
159
  // -1时不自动关闭
151
160
  if (tmpConfig.value.duration !== -1) {
152
161
  timer = setTimeout(() => {
153
162
  // 倒计时结束,清除定时器,隐藏toast组件
154
- clearTimer()
163
+ clearTimer();
155
164
  // 判断是否存在callback方法,如果存在就执行
156
- typeof tmpConfig.value.complete === 'function' && tmpConfig.value.complete()
157
- }, tmpConfig.value.duration)
165
+ typeof tmpConfig.value.complete === "function" &&
166
+ tmpConfig.value.complete();
167
+ }, tmpConfig.value.duration);
158
168
  }
159
- }
169
+ };
160
170
 
161
171
  // 隐藏toast组件,由父组件通过this.$refs.xxx.hide()形式调用
162
172
  const hide = () => {
163
- clearTimer()
164
- }
173
+ clearTimer();
174
+ };
165
175
  /**
166
176
  * @description 清除定时任务
167
177
  * */
168
178
  const clearTimer = () => {
169
- isShow.value = false
179
+ isShow.value = false;
170
180
  // 清除定时器
171
- clearTimeout(timer)
172
- timer = null
173
- }
181
+ clearTimeout(timer);
182
+ timer = null;
183
+ };
174
184
 
175
185
  defineExpose({
176
186
  show,
177
187
  hide,
178
- })
188
+ });
179
189
  </script>
180
190
 
181
191
  <style scoped lang="scss">
182
- @import './index.scss';
192
+ @import "./index.scss";
183
193
  </style>