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,7 +1,10 @@
1
1
  <template>
2
2
  <view :class="[`hy-steps--${direction}`, 'hy-steps']">
3
3
  <template v-for="(item, i) in list" :key="i">
4
- <view ref="hy-steps-item" :class="[`hy-steps-item--${direction}`, 'hy-steps-item']">
4
+ <view
5
+ ref="hy-steps-item"
6
+ :class="[`hy-steps-item--${direction}`, 'hy-steps-item']"
7
+ >
5
8
  <!-- 线条 -->
6
9
  <view
7
10
  v-if="i > 0"
@@ -34,7 +37,10 @@
34
37
  backgroundColor: statusColor(i, item?.error),
35
38
  }"
36
39
  ></view>
37
- <view class="hy-steps-item__wrapper__icon" v-else-if="activeIcon || inactiveIcon">
40
+ <view
41
+ class="hy-steps-item__wrapper__icon"
42
+ v-else-if="activeIcon || inactiveIcon"
43
+ >
38
44
  <HyIcon
39
45
  :name="i <= current ? activeIcon : inactiveIcon"
40
46
  :size="iconSize"
@@ -45,28 +51,35 @@
45
51
  v-else
46
52
  :style="{
47
53
  backgroundColor:
48
- statusClass(i, item.error) === 'process' ? activeColor : 'transparent',
54
+ statusClass(i, item.error) === 'process'
55
+ ? activeColor
56
+ : 'transparent',
49
57
  borderColor: statusColor(i, item?.error),
50
58
  }"
51
59
  class="hy-steps-item__wrapper__circle"
52
60
  >
53
61
  <text
54
62
  v-if="
55
- statusClass(i, item.error) === 'process' || statusClass(i, item.error) === 'wait'
63
+ statusClass(i, item.error) === 'process' ||
64
+ statusClass(i, item.error) === 'wait'
56
65
  "
57
66
  class="hy-steps-item__wrapper__circle__text"
58
67
  :style="{
59
- color: i == current ? '#ffffff' : inactiveColor,
68
+ color: textColor(i),
60
69
  }"
61
70
  >
62
71
  {{ i + 1 }}
63
72
  </text>
64
73
  <HyIcon
65
74
  v-else
66
- :color="statusClass(i, item.error) === 'error' ? 'error' : activeColor"
75
+ :color="
76
+ statusClass(i, item.error) === 'error' ? 'error' : activeColor
77
+ "
67
78
  :size="iconSize"
68
79
  :name="
69
- statusClass(i, item.error) === 'error' ? IconConfig.CLOSE : IconConfig.CHECK_MASK
80
+ statusClass(i, item.error) === 'error'
81
+ ? IconConfig.CLOSE
82
+ : IconConfig.CHECK_MASK
70
83
  "
71
84
  ></HyIcon>
72
85
  </view>
@@ -83,17 +96,21 @@
83
96
  <slot name="content" :record="item" :index="i">
84
97
  <slot name="title" :title="item.title" :index="i">
85
98
  <text
86
- :class="[current == i && 'hy-steps-item__content__title--active']"
87
- :style="{
88
- lineHeight: '20px',
89
- fontSize: current == i ? '14px' : '13px',
90
- }"
99
+ :class="[
100
+ 'hy-steps-item__content__title',
101
+ current == i && 'hy-steps-item__content__title--active',
102
+ current == i &&
103
+ item.error &&
104
+ 'hy-steps-item__content__title--error',
105
+ ]"
91
106
  >
92
107
  {{ item.title }}
93
108
  </text>
94
109
  </slot>
95
110
  <slot name="desc" :desc="item.desc" :index="i">
96
- <text :style="{ fontSize: '12px', color: '#999' }">{{ item.desc }}</text>
111
+ <text :style="{ fontSize: '12px', color: '#999' }">{{
112
+ item.desc
113
+ }}</text>
97
114
  </slot>
98
115
  </slot>
99
116
  </view>
@@ -105,31 +122,31 @@
105
122
 
106
123
  <script lang="ts">
107
124
  export default {
108
- name: 'hy-steps',
125
+ name: "hy-steps",
109
126
  options: {
110
127
  addGlobalClass: true,
111
128
  virtualHost: true,
112
- styleIsolation: 'shared',
129
+ styleIsolation: "shared",
113
130
  },
114
- }
131
+ };
115
132
  </script>
116
133
 
117
134
  <script setup lang="ts">
118
- import { computed, toRefs, ref, onMounted, getCurrentInstance, watch } from 'vue'
119
- import type { CSSProperties, PropType } from 'vue'
120
- import type { IStepsEmits } from './typing'
121
- import type { StepListVo } from './typing'
122
- import { addUnit, getRect } from '../../utils'
123
- import { ColorConfig, IconConfig } from '../../config'
135
+ import { computed, ref, onMounted, getCurrentInstance, watch } from "vue";
136
+ import type { CSSProperties, PropType } from "vue";
137
+ import type { IStepsEmits } from "./typing";
138
+ import type { StepListVo } from "./typing";
139
+ import { addUnit, getRect } from "../../utils";
140
+ import { ColorConfig, IconConfig } from "../../config";
124
141
 
125
142
  /**
126
143
  * 一般用于完成一个任务要分几个步骤,标识目前处于第几步的场景。
127
144
  * @displayName hy-steps
128
145
  */
129
- defineOptions({})
146
+ defineOptions({});
130
147
 
131
148
  // 组件
132
- import HyIcon from '../hy-icon/hy-icon.vue'
149
+ import HyIcon from "../hy-icon/hy-icon.vue";
133
150
 
134
151
  // const props = withDefaults(defineProps<IProps>(), defaultProps)
135
152
  const props = defineProps({
@@ -149,12 +166,18 @@ const props = defineProps({
149
166
  * */
150
167
  direction: {
151
168
  type: String,
152
- default: 'row',
169
+ default: "row",
153
170
  },
154
171
  /** 激活状态颜色 */
155
- activeColor: String,
172
+ activeColor: {
173
+ type: String,
174
+ default: "",
175
+ },
156
176
  /** 未激活状态颜色 */
157
- inactiveColor: String,
177
+ inactiveColor: {
178
+ type: String,
179
+ default: "",
180
+ },
158
181
  /** 激活状态的图标 */
159
182
  activeIcon: String,
160
183
  /** 未激活状态图标 */
@@ -169,112 +192,117 @@ const props = defineProps({
169
192
  type: [String, Number],
170
193
  default: 17,
171
194
  },
172
- })
173
- const { current, list, direction, dot, inactiveColor, activeColor } = toRefs(props)
174
- const emit = defineEmits<IStepsEmits>()
195
+ });
196
+ const emit = defineEmits<IStepsEmits>();
175
197
 
176
198
  const size = ref<UniApp.NodeInfo>({
177
199
  height: 0,
178
200
  width: 0,
179
- })
180
- const instance = getCurrentInstance()
201
+ });
202
+ const instance = getCurrentInstance();
181
203
 
182
204
  watch(
183
- () => current.value,
205
+ () => props.current,
184
206
  (newVal: number) => {
185
- if (list.value[newVal - 1]?.error) {
186
- const index = list.value.findIndex((item) => item.error)
187
- emit('update:current', index)
188
- emit('change', index)
207
+ if (props.list[newVal - 1]?.error) {
208
+ const index = props.list.findIndex((item) => item.error);
209
+ emit("update:current", index);
210
+ emit("change", index);
189
211
  }
190
212
  },
191
- )
213
+ );
214
+
215
+ // 字体颜色
216
+ const textColor = computed(() => {
217
+ return (index: number) =>
218
+ index == props.current ? "#ffffff" : props.inactiveColor;
219
+ });
192
220
 
193
221
  /**
194
222
  * @description 线条样式
195
223
  * */
196
224
  const lineStyle = computed(() => {
197
225
  return (temp: StepListVo, index: number): CSSProperties => {
198
- const style: CSSProperties = {}
199
- if (direction.value === 'row') {
200
- style.width = addUnit(size.value.width! - 25)
201
- style.left = addUnit(-size.value.width! / 2 + 12)
226
+ const style: CSSProperties = {};
227
+ if (props.direction === "row") {
228
+ style.width = addUnit(size.value.width! - 25);
229
+ style.left = addUnit(-size.value.width! / 2 + 12);
202
230
  } else {
203
- style.height = addUnit(size.value.height! - 30)
204
- style.top = addUnit(25)
231
+ style.height = addUnit(size.value.height! - 30);
232
+ style.top = addUnit(25);
205
233
  }
206
234
  style.backgroundColor = temp.error
207
- ? ''
208
- : index < current.value
209
- ? activeColor.value
210
- : inactiveColor.value
211
- return style
212
- }
213
- })
235
+ ? ""
236
+ : index < props.current
237
+ ? ""
238
+ : props.inactiveColor;
239
+ return style;
240
+ };
241
+ });
214
242
 
215
243
  const itemStyleInner = computed(() => {
216
- return {}
217
- })
244
+ return {};
245
+ });
218
246
  /**
219
247
  * @description 状态类名
220
248
  * */
221
249
  const statusClass = computed(() => {
222
250
  return (index: number, error: boolean = false) => {
223
- if (current.value == index) {
224
- return error ? 'error' : 'process'
225
- } else if (current.value > index) {
226
- return 'finish'
251
+ if (props.current == index) {
252
+ return error ? "error" : "process";
253
+ } else if (props.current > index) {
254
+ return "finish";
227
255
  } else {
228
- return 'wait'
256
+ return "wait";
229
257
  }
230
- }
231
- })
258
+ };
259
+ });
232
260
  const statusColor = computed(() => {
233
261
  return (index: number, error?: boolean) => {
234
- let colorTmp = ''
262
+ let colorTmp: string | number;
235
263
  switch (statusClass.value(index, error)) {
236
- case 'finish':
237
- colorTmp = activeColor.value
238
- break
239
- case 'error':
240
- colorTmp = ColorConfig.error
241
- break
242
- case 'process':
243
- colorTmp = dot.value ? activeColor.value : 'transparent'
244
- break
264
+ case "finish":
265
+ colorTmp = props.activeColor;
266
+ break;
267
+ case "error":
268
+ colorTmp = ColorConfig.error;
269
+ break;
270
+ case "process":
271
+ colorTmp = props.dot ? props.current : "transparent";
272
+ break;
245
273
  default:
246
- colorTmp = inactiveColor.value
247
- break
274
+ colorTmp = props.inactiveColor;
275
+ break;
248
276
  }
249
- return colorTmp
250
- }
251
- })
277
+ return colorTmp;
278
+ };
279
+ });
252
280
 
253
281
  const contentStyle = computed<CSSProperties>(() => {
254
- const style: CSSProperties = {}
255
- if (direction.value === 'column') {
256
- style.marginLeft = dot.value ? '2px' : '6px'
257
- style.marginTop = dot.value ? '0px' : '6px'
282
+ const style: CSSProperties = {};
283
+ if (props.direction === "column") {
284
+ style.marginLeft = props.dot ? "2px" : "6px";
285
+ style.marginTop = props.dot ? "0px" : "6px";
258
286
  } else {
259
- style.marginTop = dot.value ? '2px' : '6px'
260
- style.marginLeft = dot.value ? '2px' : '6px'
287
+ style.marginTop = props.dot ? "2px" : "6px";
288
+ style.marginLeft = props.dot ? "2px" : "6px";
261
289
  }
262
290
 
263
- return style
264
- })
291
+ return style;
292
+ });
265
293
 
266
294
  onMounted(() => {
267
- getStepsItemRect()
268
- })
295
+ getStepsItemRect();
296
+ });
269
297
 
270
298
  // 获取组件的尺寸,用于设置横线的位置
271
299
  const getStepsItemRect = () => {
272
- getRect('.hy-steps-item', false, instance).then((rect) => {
273
- size.value = rect as UniApp.NodeInfo
274
- })
275
- }
300
+ getRect(".hy-steps-item", false, instance).then((rect) => {
301
+ size.value = rect as UniApp.NodeInfo;
302
+ });
303
+ };
276
304
  </script>
277
305
 
278
306
  <style lang="scss" scoped>
279
- @import './index.scss';
307
+ @import "./index.scss";
280
308
  </style>
@@ -4,11 +4,11 @@
4
4
  @include b(steps) {
5
5
  @include flex;
6
6
 
7
- &--column {
7
+ @include m(column) {
8
8
  flex-direction: column;
9
9
  }
10
10
 
11
- &--row {
11
+ @include m(row) {
12
12
  flex-direction: row;
13
13
  flex: 1;
14
14
  /* #ifdef MP */
@@ -21,20 +21,20 @@
21
21
  flex: 1;
22
22
  @include flex;
23
23
 
24
- &--row {
24
+ @include m(row) {
25
25
  flex-direction: column;
26
26
  align-items: center;
27
27
  position: relative;
28
28
  }
29
29
 
30
- &--column {
30
+ @include m(column) {
31
31
  position: relative;
32
32
  flex-direction: row;
33
33
  justify-content: flex-start;
34
34
  padding-bottom: 5px;
35
35
  }
36
36
 
37
- &__wrapper {
37
+ @include e(wrapper) {
38
38
  @include flex;
39
39
  justify-content: center;
40
40
  align-items: center;
@@ -55,34 +55,34 @@
55
55
  }
56
56
  }
57
57
 
58
- &--column {
58
+ @include m(column) {
59
59
  width: 20px;
60
60
  height: 20px;
61
61
  }
62
62
 
63
- &--row {
63
+ @include m(row) {
64
64
  width: 20px;
65
65
  height: 20px;
66
66
  }
67
67
 
68
68
  /* 点形状 */
69
- &--dot {
70
- &__item {
69
+ @include m(dot) {
70
+ @include e(item) {
71
71
  width: 10px;
72
72
  height: 10px;
73
73
  border-radius: $hy-border-radius-circle;
74
74
  background-color: $hy-info;
75
75
  border: none;
76
76
  }
77
- &__finish {
77
+ @include e(finish) {
78
78
  background-color: $hy-primary;
79
79
  }
80
- &__process {
80
+ @include e(process) {
81
81
  background-color: $hy-primary;
82
82
  }
83
83
  }
84
84
 
85
- &__circle {
85
+ @include e(circle) {
86
86
  width: 20px;
87
87
  height: 20px;
88
88
  /* #ifndef APP-NVUE */
@@ -96,7 +96,7 @@
96
96
  justify-content: center;
97
97
  transition: background-color 0.3s;
98
98
 
99
- &__text {
99
+ @include e(text) {
100
100
  color: $hy-text-color--grey;
101
101
  font-size: 11px;
102
102
  @include flex(row);
@@ -108,19 +108,29 @@
108
108
  }
109
109
  }
110
110
 
111
- &__content {
111
+ @include e(content) {
112
112
  @include flex;
113
113
  flex: 1;
114
- &__title--active {
115
- color: $hy-primary;
114
+
115
+ @include e(title) {
116
+ line-height: 25px;
117
+ font-size: 13px;
118
+ @include m(active) {
119
+ color: $hy-primary;
120
+ font-size: 15px;
121
+ }
122
+
123
+ @include m(error) {
124
+ color: $hy-error;
125
+ }
116
126
  }
117
127
 
118
- &--row {
128
+ @include m(row) {
119
129
  flex-direction: column;
120
130
  align-items: center;
121
131
  }
122
132
 
123
- &--column {
133
+ @include m(column) {
124
134
  flex-direction: column;
125
135
  justify-content: flex-start;
126
136
  margin-left: $hy-border-margin-padding-sm;
@@ -129,7 +139,7 @@
129
139
  }
130
140
 
131
141
  /* 线条样式 */
132
- &__line {
142
+ @include e(line) {
133
143
  position: absolute;
134
144
  background: $hy-border-color;
135
145
 
@@ -146,12 +156,12 @@
146
156
  background-color: $hy-info;
147
157
  }
148
158
 
149
- &--row {
159
+ @include m(row) {
150
160
  top: $hy-border-margin-padding-base;
151
161
  height: 1px;
152
162
  }
153
163
 
154
- &--column {
164
+ @include m(column) {
155
165
  width: 1px;
156
166
  left: $hy-border-margin-padding-base;
157
167
  }