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,126 +1,126 @@
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 HyNumberStepProps {
5
5
  /**
6
6
  * @description 用于双向绑定的值,初始化时设置设为默认min值(最小值) (默认 0 )
7
7
  * */
8
- modelValue: number
8
+ modelValue: number;
9
9
  /**
10
10
  * @description 最小值 (默认 1 )
11
11
  * */
12
- min?: number
12
+ min?: number;
13
13
  /**
14
14
  * @description 最大值 (默认 Number.MAX_SAFE_INTEGER )
15
15
  * */
16
- max?: number
16
+ max?: number;
17
17
  /**
18
18
  * @description 加减的步长,可为小数 (默认 1 )
19
19
  * */
20
- step?: number
20
+ step?: number;
21
21
  /**
22
22
  * @description 是否只允许输入整数 (默认 false )
23
23
  * */
24
- integer?: boolean
24
+ integer?: boolean;
25
25
  /**
26
26
  * @description 是否禁用,包括输入框,加减按钮 (默认 false )
27
27
  * */
28
- disabled?: boolean
28
+ disabled?: boolean;
29
29
  /**
30
30
  * @description 是否禁用输入框 (默认 false )
31
31
  * */
32
- disabledInput?: boolean
32
+ disabledInput?: boolean;
33
33
  /**
34
34
  * @description 是否开启异步变更,开启后需要手动控制输入值 (默认 false )
35
35
  * */
36
- asyncChange?: boolean
36
+ asyncChange?: boolean;
37
37
  /**
38
38
  * @description 输入框宽度,单位为px (默认 35 )
39
39
  * */
40
- inputWidth?: number
40
+ inputWidth?: number;
41
41
  /**
42
42
  * @description 是否显示减少按钮 (默认 true )
43
43
  * */
44
- showMinus?: boolean
44
+ showMinus?: boolean;
45
45
  /**
46
46
  * @description 是否显示增加按钮 (默认 true )
47
47
  * */
48
- showPlus?: boolean
48
+ showPlus?: boolean;
49
49
  /**
50
50
  * @description 显示的小数位数
51
51
  * */
52
- decimalLength?: number | null
52
+ decimalLength?: number | null;
53
53
  /**
54
54
  * @description 是否开启长按加减手势 (默认 true )
55
55
  * */
56
- longPress?: boolean
56
+ longPress?: boolean;
57
57
  /**
58
58
  * @description 输入框文字和加减按钮图标的颜色 (默认 '#323233' )
59
59
  * */
60
- color?: string
60
+ color?: string;
61
61
  /**
62
62
  * @description 按钮宽度(默认 '30' )
63
63
  * */
64
- buttonWidth?: number | string
64
+ buttonWidth?: number | string;
65
65
  /**
66
66
  * @description 按钮大小,宽高等于此值,单位px,输入框高度和此值保持一致 (默认 30 )
67
67
  * */
68
- buttonSize?: number | string
68
+ buttonSize?: number | string;
69
69
  /**
70
70
  * @description 按钮圆角 (默认 '0px' )
71
71
  * */
72
- buttonRadius?: number | string
72
+ buttonRadius?: number | string;
73
73
  /**
74
74
  * @description 输入框和按钮的背景颜色 (默认 '#EBECEE' )
75
75
  * */
76
- bgColor?: string
76
+ bgColor?: string;
77
77
  /**
78
78
  * @description 输入框背景颜色 (默认 '#EBECEE' )
79
79
  * */
80
- inputBgColor?: string
80
+ inputBgColor?: string;
81
81
  /**
82
82
  * @description 指定光标于键盘的距离,避免键盘遮挡输入框,单位px (默认 100 )
83
83
  * */
84
- cursorSpacing?: number
84
+ cursorSpacing?: number;
85
85
  /**
86
86
  * @description 是否禁用减少按钮 (默认 false )
87
87
  * */
88
- disableMinus?: boolean
88
+ disableMinus?: boolean;
89
89
  /**
90
90
  * @description 是否禁用增加按钮 (默认 false )
91
91
  * */
92
- disablePlus?: boolean
92
+ disablePlus?: boolean;
93
93
  /**
94
94
  * @description 减号按钮图标
95
95
  * */
96
- minusIcon?: Partial<HyIconProps>
96
+ minusIcon?: Partial<HyIconProps>;
97
97
  /**
98
98
  * @description 加号按钮图标
99
99
  * */
100
- plusIcon?: Partial<HyIconProps>
100
+ plusIcon?: Partial<HyIconProps>;
101
101
  /**
102
102
  * @description 迷你模式(默认 false )
103
103
  * */
104
- miniMode?: boolean
104
+ miniMode?: boolean;
105
105
  /**
106
106
  * @description 定义需要用到的外部样式
107
107
  * */
108
- customStyle?: CSSProperties
108
+ customStyle?: CSSProperties;
109
109
  }
110
110
 
111
111
  export interface INumberStepEmits {
112
112
  /** 输入框得到焦点触发 */
113
- (e: 'focus', value: number): void
113
+ (e: "focus", value: string): void;
114
114
  /** 输入框失去焦点时触发 */
115
- (e: 'blur', value: number): void
115
+ (e: "blur", value: string): void;
116
116
  /** 超过范围阈值时触发 */
117
- (e: 'overLimit', type: 'minus' | 'plus'): void
117
+ (e: "overLimit", type: "minus" | "plus"): void;
118
118
  /** 输入框内容发生变化时触发 */
119
- (e: 'change', value: number): void
119
+ (e: "change", value: string | number): void;
120
120
  /** 点击增加按钮触发 */
121
- (e: 'plus', value: number): void
121
+ (e: "plus", value: string): void;
122
122
  /** 点击减少按钮触发 */
123
- (e: 'minus', value: number): void
123
+ (e: "minus", value: string): void;
124
124
  /** 值更新触发 */
125
- (e: 'update:modelValue', value: number): void
125
+ (e: "update:modelValue", value: string | number): void;
126
126
  }
@@ -12,26 +12,26 @@
12
12
 
13
13
  <script lang="ts">
14
14
  export default {
15
- name: 'hy-overlay',
15
+ name: "hy-overlay",
16
16
  options: {
17
17
  addGlobalClass: true,
18
18
  virtualHost: true,
19
- styleIsolation: 'shared',
19
+ styleIsolation: "shared",
20
20
  },
21
- }
21
+ };
22
22
  </script>
23
23
 
24
24
  <script setup lang="ts">
25
- import { computed, toRefs } from 'vue'
26
- import type { CSSProperties, PropType } from 'vue'
27
- import type { IOverlayEmits } from './typing'
28
- import HyTransition from '../hy-transition/hy-transition.vue'
25
+ import { computed, toRefs } from "vue";
26
+ import type { CSSProperties, PropType } from "vue";
27
+ import type { IOverlayEmits } from "./typing";
28
+ import HyTransition from "../hy-transition/hy-transition.vue";
29
29
 
30
30
  /**
31
31
  * 创建一个遮罩层,用于强调特定的页面元素,并阻止用户对遮罩下层的内容进行操作,一般用于弹窗场景
32
32
  * @displayName hy-overlay
33
33
  */
34
- defineOptions({})
34
+ defineOptions({});
35
35
 
36
36
  // const props = withDefaults(defineProps<IProps>(), defaultProps)
37
37
  const props = defineProps({
@@ -56,30 +56,32 @@ const props = defineProps({
56
56
  default: 0.5,
57
57
  },
58
58
  /** 定义需要用到的外部样式 */
59
- customStyle: Object as PropType<CSSProperties>,
59
+ customStyle: {
60
+ type: Object as PropType<CSSProperties>,
61
+ default: () => {},
62
+ },
60
63
  /** 自定义外部类名 */
61
64
  customClass: String,
62
- })
63
- const { customStyle, opacity, zIndex } = toRefs(props)
64
- const emit = defineEmits<IOverlayEmits>()
65
+ });
66
+ const emit = defineEmits<IOverlayEmits>();
65
67
 
66
68
  const overlayStyle = computed<CSSProperties>(() => {
67
69
  const style: CSSProperties = {
68
- position: 'fixed',
70
+ position: "fixed",
69
71
  top: 0,
70
72
  left: 0,
71
73
  right: 0,
72
- zIndex: zIndex?.value,
74
+ zIndex: props.zIndex,
73
75
  bottom: 0,
74
- 'background-color': `rgba(0, 0, 0, ${opacity.value})`,
75
- }
76
- return Object.assign(style, customStyle.value || {})
77
- })
76
+ "background-color": `rgba(0, 0, 0, ${props.opacity})`,
77
+ };
78
+ return Object.assign(style, props.customStyle);
79
+ });
78
80
  const clickHandler = () => {
79
- emit('click')
80
- }
81
+ emit("click");
82
+ };
81
83
  </script>
82
84
 
83
85
  <style lang="scss" scoped>
84
- @import './index.scss';
86
+ @import "./index.scss";
85
87
  </style>
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <view class="hy-pagination" :style="customStyle" v-if="!(hideIfOnePage && totalPageNum === 1)">
2
+ <view
3
+ class="hy-pagination"
4
+ :style="customStyle"
5
+ v-if="!(hideIfOnePage && totalPageNum === 1)"
6
+ >
3
7
  <view class="hy-pagination__content">
4
8
  <hy-button
5
9
  :plain="modelValue > 1"
@@ -14,7 +18,9 @@
14
18
  <hy-icon
15
19
  v-else
16
20
  :class="`hy-pagination__left hy-pagination__icon ${
17
- modelValue <= 1 ? 'hy-pagination__nav--disabled' : 'hy-pagination__nav--active'
21
+ modelValue <= 1
22
+ ? 'hy-pagination__nav--disabled'
23
+ : 'hy-pagination__nav--active'
18
24
  }`"
19
25
  :name="IconConfig.LEFT"
20
26
  ></hy-icon>
@@ -54,29 +60,29 @@
54
60
 
55
61
  <script lang="ts">
56
62
  export default {
57
- name: 'hy-pagination',
63
+ name: "hy-pagination",
58
64
  options: {
59
65
  virtualHost: true,
60
66
  addGlobalClass: true,
61
- styleIsolation: 'shared',
67
+ styleIsolation: "shared",
62
68
  },
63
- }
69
+ };
64
70
  </script>
65
71
 
66
72
  <script lang="ts" setup>
67
- import { ref, toRefs, watch } from 'vue'
68
- import type { CSSProperties, PropType } from 'vue'
69
- import type { IPaginationEmits } from './typing'
70
- import { IconConfig } from '../../config'
73
+ import { ref, watch } from "vue";
74
+ import type { CSSProperties, PropType } from "vue";
75
+ import type { IPaginationEmits } from "./typing";
76
+ import { IconConfig } from "../../config";
71
77
  // 组件
72
- import HyIcon from '../hy-icon/hy-icon.vue'
73
- import HyButton from '../hy-button/hy-button.vue'
78
+ import HyIcon from "../hy-icon/hy-icon.vue";
79
+ import HyButton from "../hy-button/hy-button.vue";
74
80
 
75
81
  /**
76
82
  * 当数据量过多时,使用分页分解数据。
77
83
  * @displayName hy-pagination
78
84
  */
79
- defineOptions({})
85
+ defineOptions({});
80
86
 
81
87
  // const props = withDefaults(defineProps<IProps>(), defaultProps);
82
88
  const props = defineProps({
@@ -113,12 +119,12 @@ const props = defineProps({
113
119
  /** 上一页文本 */
114
120
  prevText: {
115
121
  type: String,
116
- default: '上一页',
122
+ default: "上一页",
117
123
  },
118
124
  /** 下一页文本 */
119
125
  nextText: {
120
126
  type: String,
121
- default: '下一页',
127
+ default: "下一页",
122
128
  },
123
129
  /** 总页数只有一页时是否隐藏 */
124
130
  hideIfOnePage: {
@@ -129,57 +135,56 @@ const props = defineProps({
129
135
  customStyle: {
130
136
  type: Object as PropType<CSSProperties>,
131
137
  },
132
- })
133
- const { pageSize, totalPage } = toRefs(props)
134
- const emit = defineEmits<IPaginationEmits>()
138
+ });
139
+ const emit = defineEmits<IPaginationEmits>();
135
140
 
136
- const totalPageNum = ref<number>(0) // 总页数
141
+ const totalPageNum = ref<number>(0); // 总页数
137
142
 
138
143
  watch(
139
- () => totalPage.value,
144
+ () => props.totalPage,
140
145
  (newValue) => {
141
146
  if (!totalPageNum.value && newValue) {
142
- totalPageNum.value = totalPageNum.value
147
+ totalPageNum.value = totalPageNum.value;
143
148
  }
144
149
  },
145
150
  { immediate: true, deep: true },
146
- )
151
+ );
147
152
 
148
153
  watch(
149
154
  () => props.total,
150
155
  () => {
151
- updateTotalPage()
156
+ updateTotalPage();
152
157
  },
153
158
  { immediate: true, deep: true },
154
- )
159
+ );
155
160
 
156
161
  /**
157
162
  * @description 加数
158
163
  * */
159
164
  const add = () => {
160
- const { modelValue } = props
165
+ const { modelValue } = props;
161
166
  if (modelValue > totalPageNum.value - 1) {
162
- return
167
+ return;
163
168
  }
164
- emit('change', { value: modelValue + 1 })
165
- emit('update:modelValue', modelValue + 1)
166
- }
169
+ emit("change", { value: modelValue + 1 });
170
+ emit("update:modelValue", modelValue + 1);
171
+ };
167
172
 
168
173
  const sub = () => {
169
- const { modelValue } = props
174
+ const { modelValue } = props;
170
175
  if (modelValue < 2) {
171
- return
176
+ return;
172
177
  }
173
- emit('change', { value: modelValue - 1 })
174
- emit('update:modelValue', modelValue - 1)
175
- }
178
+ emit("change", { value: modelValue - 1 });
179
+ emit("update:modelValue", modelValue - 1);
180
+ };
176
181
 
177
182
  function updateTotalPage() {
178
- const { total, pageSize } = props
179
- totalPageNum.value = Math.ceil(total / pageSize)
183
+ const { total, pageSize } = props;
184
+ totalPageNum.value = Math.ceil(total / pageSize);
180
185
  }
181
186
  </script>
182
187
 
183
188
  <style lang="scss" scoped>
184
- @import './index.scss';
189
+ @import "./index.scss";
185
190
  </style>