hy-app 0.5.14 → 0.5.16

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 (35) hide show
  1. package/components/hy-address-picker/hy-address-picker.vue +0 -1
  2. package/components/hy-button/hy-button.vue +7 -1
  3. package/components/hy-button/index.scss +22 -21
  4. package/components/hy-code-input/hy-code-input.vue +231 -231
  5. package/components/hy-code-input/props.ts +90 -88
  6. package/components/hy-config-provider/index.scss +1 -1
  7. package/components/hy-datetime-picker/hy-datetime-picker.vue +519 -521
  8. package/components/hy-icon/index.scss +1 -2
  9. package/components/hy-index-bar/hy-index-bar.vue +0 -12
  10. package/components/hy-index-bar/index.scss +1 -1
  11. package/components/hy-notify/hy-notify.vue +174 -174
  12. package/components/hy-picker/hy-picker.vue +0 -1
  13. package/components/hy-picker/index.scss +1 -1
  14. package/components/hy-skeleton/hy-skeleton.vue +142 -0
  15. package/components/hy-skeleton/index.scss +90 -0
  16. package/components/hy-skeleton/props.ts +46 -0
  17. package/components/hy-skeleton/typing.d.ts +31 -0
  18. package/components/hy-steps/hy-steps.vue +267 -267
  19. package/components/hy-steps/index.scss +7 -2
  20. package/components/hy-steps/typing.d.ts +25 -21
  21. package/components/hy-tabs/index.scss +1 -0
  22. package/components/hy-tag/hy-tag.vue +174 -174
  23. package/components/hy-tag/index.scss +3 -6
  24. package/components/hy-tag/props.ts +89 -89
  25. package/components/hy-text/hy-text.vue +1 -1
  26. package/components/hy-textarea/hy-textarea.vue +1 -1
  27. package/components/hy-textarea/index.scss +1 -4
  28. package/global.d.ts +2 -0
  29. package/index.scss +1 -1
  30. package/libs/css/iconfont.css +117 -119
  31. package/libs/css/theme.scss +1 -0
  32. package/libs/css/vars.scss +2 -0
  33. package/libs/utils/utils.ts +0 -1
  34. package/package.json +62 -3
  35. package/web-types.json +1 -1
@@ -0,0 +1,46 @@
1
+ import type { CSSProperties, PropType } from 'vue'
2
+ import type { SkeletonAnimation, SkeletonRowCol, SkeletonTheme } from './typing'
3
+
4
+ const skeletonProps = {
5
+ /**
6
+ * 骨架图风格,有基础、头像组合等两大类
7
+ * @values text,avatar,paragraph,image
8
+ */
9
+ theme: {
10
+ type: String as PropType<SkeletonTheme>,
11
+ default: 'text'
12
+ },
13
+ /**
14
+ * 用于设置行列数量、宽度高度、间距等。
15
+ * @example
16
+ * 【示例一】,`[1, 1, 2]` 表示输出三行骨架图,第一行一列,第二行一列,第三行两列。
17
+ * 【示例二】,`[1, 1, { width: '100px' }]` 表示自定义第三行的宽度为 `100px`。
18
+ * 【示例三】,`[1, 2, [{ width, height }, { width, height, marginLeft }]]` 表示第三行有两列,且自定义宽度、高度和间距
19
+ */
20
+ rowCol: {
21
+ type: Array as PropType<SkeletonRowCol>
22
+ },
23
+ /**
24
+ * 是否为加载状态,如果是则显示骨架图,如果不是则显示加载完成的内容
25
+ * @default true
26
+ */
27
+ loading: {
28
+ type: Boolean,
29
+ default: true
30
+ },
31
+ /**
32
+ * 动画效果,有「渐变加载动画」和「闪烁加载动画」两种。值为空则表示没有动画
33
+ */
34
+ animation: {
35
+ type: String as PropType<SkeletonAnimation>,
36
+ default: ''
37
+ },
38
+ /** 定义需要用到的外部样式 */
39
+ customStyle: {
40
+ type: Object as PropType<CSSProperties>
41
+ },
42
+ /** 自定义外部类名 */
43
+ customClass: String
44
+ }
45
+
46
+ export default skeletonProps
@@ -0,0 +1,31 @@
1
+ import type { ExtractPropTypes } from 'vue'
2
+ import skeletonProps from './props'
3
+
4
+ export type SkeletonTheme = 'text' | 'avatar' | 'paragraph' | 'image'
5
+ export type SkeletonAnimation = 'gradient' | 'flashed'
6
+ export type SkeletonRowColObj = {
7
+ [key: string]: any
8
+ type?: 'rect' | 'circle' | 'text'
9
+ size?: string | number
10
+ width?: string | number
11
+ height?: string | number
12
+ margin?: string | number
13
+ background?: string
14
+ marginLeft?: string | number
15
+ marginRight?: string | number
16
+ borderRadius?: string | number
17
+ backgroundColor?: string
18
+ }
19
+ export type SkeletonRowCol = number | SkeletonRowColObj | Array<SkeletonRowColObj>
20
+ export type SkeletonThemeVars = {
21
+ notifyPadding?: string
22
+ notifyFontSize?: string
23
+ notifyTextColor?: string
24
+ notifyLineHeight?: number | string
25
+ notifyDangerBackground?: string
26
+ notifyPrimaryBackground?: string
27
+ notifySuccessBackground?: string
28
+ notifyWarningBackground?: string
29
+ }
30
+
31
+ export type HySkeletonProps = ExtractPropTypes<typeof skeletonProps>
@@ -1,267 +1,267 @@
1
- <template>
2
- <view :class="[`hy-steps--${direction}`, 'hy-steps']">
3
- <template v-for="(item, i) in list" :key="i">
4
- <view ref="hy-steps-item" :class="[`hy-steps-item--${direction}`, 'hy-steps-item']">
5
- <!-- 线条 -->
6
- <view
7
- v-if="i > 0"
8
- :class="[
9
- `hy-steps-item__line--${direction}`,
10
- 'hy-steps-item__line',
11
- statusClass(i, item.error)
12
- ]"
13
- :style="lineStyle(item, i)"
14
- ></view>
15
- <!-- 线条 -->
16
-
17
- <!-- 步骤状态 -->
18
- <view
19
- :class="[
20
- `hy-steps-item__wrapper--${direction}`,
21
- dot ? `hy-steps-item__wrapper--dot` : statusClass(i, item.error),
22
- 'hy-steps-item__wrapper'
23
- ]"
24
- :style="itemStyleInner"
25
- >
26
- <slot v-if="$slots.icon" name="icon" :error="item?.error" :index="i"></slot>
27
- <template v-else>
28
- <view
29
- :class="[
30
- 'hy-steps-item__wrapper--dot__item',
31
- `hy-steps-item__wrapper--dot__${statusClass(i, item.error)}`
32
- ]"
33
- v-if="dot"
34
- :style="{
35
- backgroundColor: statusColor(i, item?.error)
36
- }"
37
- ></view>
38
- <view
39
- class="hy-steps-item__wrapper__icon"
40
- v-else-if="activeIcon || inactiveIcon"
41
- >
42
- <hy-icon
43
- :name="i <= current ? activeIcon : inactiveIcon"
44
- :size="iconSize"
45
- :color="i <= current ? activeColor : inactiveColor"
46
- ></hy-icon>
47
- </view>
48
- <view
49
- v-else
50
- :style="{
51
- backgroundColor:
52
- statusClass(i, item.error) === 'process'
53
- ? activeColor
54
- : 'transparent',
55
- borderColor: statusColor(i, item?.error)
56
- }"
57
- class="hy-steps-item__wrapper__circle"
58
- >
59
- <text
60
- v-if="
61
- statusClass(i, item.error) === 'process' ||
62
- statusClass(i, item.error) === 'wait'
63
- "
64
- class="hy-steps-item__wrapper__circle__text"
65
- :style="{
66
- color: textColor(i)
67
- }"
68
- >
69
- {{ i + 1 }}
70
- </text>
71
- <hy-icon
72
- v-else
73
- :color="
74
- statusClass(i, item.error) === 'error' ? 'error' : activeColor
75
- "
76
- :size="iconSize"
77
- :name="
78
- statusClass(i, item.error) === 'error'
79
- ? IconConfig.CLOSE
80
- : IconConfig.CHECK_MASK
81
- "
82
- ></hy-icon>
83
- </view>
84
- </template>
85
- </view>
86
- <!-- 步骤状态 -->
87
-
88
- <!-- 内容区域 -->
89
- <view
90
- class="hy-steps-item__content"
91
- :class="[`hy-steps-item__content--${direction}`]"
92
- :style="[contentStyle]"
93
- >
94
- <slot v-if="$slots.content" name="content" :record="item" :index="i"></slot>
95
- <template v-else>
96
- <slot
97
- v-if="$slots.title"
98
- name="title"
99
- :title="item.title"
100
- :index="i"
101
- ></slot>
102
- <text v-else :class="titleClass(i, item.error)">
103
- {{ item.title }}
104
- </text>
105
- <slot v-if="$slots.desc" name="desc" :desc="item.desc" :index="i"></slot>
106
- <text v-else :style="{ fontSize: '12px', color: '#999' }">{{
107
- item.desc
108
- }}</text>
109
- </template>
110
- </view>
111
- <!-- 内容区域 -->
112
- </view>
113
- </template>
114
- </view>
115
- </template>
116
-
117
- <script lang="ts">
118
- export default {
119
- name: 'hy-steps',
120
- options: {
121
- addGlobalClass: true,
122
- virtualHost: true,
123
- styleIsolation: 'shared'
124
- }
125
- }
126
- </script>
127
-
128
- <script setup lang="ts">
129
- import { computed, ref, onMounted, getCurrentInstance, watch } from 'vue'
130
- import type { CSSProperties } from 'vue'
131
- import type { IStepsEmits } from './typing'
132
- import type { StepListVo } from './typing'
133
- import { addUnit, getRect, ColorConfig, IconConfig } from '../../libs'
134
- import stepsProps from './props'
135
- // 组件
136
- import HyIcon from '../hy-icon/hy-icon.vue'
137
-
138
- /**
139
- * 一般用于完成一个任务要分几个步骤,标识目前处于第几步的场景。
140
- * @displayName hy-steps
141
- */
142
- defineOptions({})
143
-
144
- const props = defineProps(stepsProps)
145
- const emit = defineEmits<IStepsEmits>()
146
-
147
- const size = ref<UniApp.NodeInfo>({
148
- height: 0,
149
- width: 0
150
- })
151
- const instance = getCurrentInstance()
152
-
153
- watch(
154
- () => props.current,
155
- (newVal: number) => {
156
- if (props.list[newVal - 1]?.error) {
157
- const index = props.list.findIndex((item) => item.error)
158
- emit('update:current', index)
159
- emit('change', index)
160
- }
161
- }
162
- )
163
-
164
- // 字体标题类名
165
- const titleClass = computed(() => {
166
- return (index: number, error: boolean) => {
167
- const classes = ['hy-steps-item__content__title']
168
- if (props.current === index) {
169
- classes.push('hy-steps-item__content__title--active')
170
-
171
- if (error) {
172
- classes.push('hy-steps-item__content__title--error')
173
- }
174
- }
175
-
176
- return classes
177
- }
178
- })
179
- // 字体颜色
180
- const textColor = computed(() => {
181
- return (index: number) => (index === props.current ? '#ffffff' : props.inactiveColor)
182
- })
183
-
184
- /**
185
- * @description 线条样式
186
- * */
187
- const lineStyle = computed(() => {
188
- return (temp: StepListVo, index: number): CSSProperties => {
189
- const style: CSSProperties = {}
190
- if (props.direction === 'row') {
191
- style.width = addUnit(size.value.width! - 25)
192
- style.left = addUnit(-size.value.width! / 2 + 12)
193
- } else {
194
- style.height = addUnit(size.value.height! - 30)
195
- style.top = addUnit(25)
196
- }
197
- style.backgroundColor = temp.error ? '' : index < props.current ? '' : props.inactiveColor
198
- return style
199
- }
200
- })
201
-
202
- const itemStyleInner = computed(() => {
203
- return {}
204
- })
205
- /**
206
- * @description 状态类名
207
- * */
208
- const statusClass = computed(() => {
209
- return (index: number, error: boolean = false) => {
210
- if (props.current == index) {
211
- return error ? 'error' : 'process'
212
- } else if (props.current > index) {
213
- return 'finish'
214
- } else {
215
- return 'wait'
216
- }
217
- }
218
- })
219
- const statusColor = computed(() => {
220
- return (index: number, error?: boolean) => {
221
- let colorTmp: string | number
222
- switch (statusClass.value(index, error)) {
223
- case 'finish':
224
- colorTmp = props.activeColor
225
- break
226
- case 'error':
227
- colorTmp = ColorConfig.error
228
- break
229
- case 'process':
230
- colorTmp = props.dot ? props.current : 'transparent'
231
- break
232
- default:
233
- colorTmp = props.inactiveColor
234
- break
235
- }
236
- return colorTmp
237
- }
238
- })
239
-
240
- const contentStyle = computed<CSSProperties>(() => {
241
- const style: CSSProperties = {}
242
- if (props.direction === 'column') {
243
- style.marginLeft = props.dot ? '2px' : '6px'
244
- style.marginTop = props.dot ? '0px' : '6px'
245
- } else {
246
- style.marginTop = props.dot ? '2px' : '6px'
247
- style.marginLeft = props.dot ? '2px' : '6px'
248
- }
249
-
250
- return style
251
- })
252
-
253
- onMounted(() => {
254
- getStepsItemRect()
255
- })
256
-
257
- // 获取组件的尺寸,用于设置横线的位置
258
- const getStepsItemRect = () => {
259
- getRect('.hy-steps-item', false, instance).then((rect) => {
260
- size.value = rect as UniApp.NodeInfo
261
- })
262
- }
263
- </script>
264
-
265
- <style lang="scss" scoped>
266
- @import './index.scss';
267
- </style>
1
+ <template>
2
+ <view :class="[`hy-steps--${direction}`, 'hy-steps']">
3
+ <template v-for="(item, i) in list" :key="i">
4
+ <view ref="hy-steps-item" :class="[`hy-steps-item--${direction}`, 'hy-steps-item']">
5
+ <!-- 线条 -->
6
+ <view
7
+ v-if="i + 1 < list.length"
8
+ :class="[
9
+ `hy-steps-item__line--${direction}`,
10
+ 'hy-steps-item__line',
11
+ statusClass(i + 1, list[i + 1].error, '====')
12
+ ]"
13
+ :style="lineStyle(item, i)"
14
+ ></view>
15
+ <!-- 线条 -->
16
+
17
+ <!-- 步骤状态 -->
18
+ <view
19
+ :class="[
20
+ `hy-steps-item__wrapper--${direction}`,
21
+ dot ? `hy-steps-item__wrapper--dot` : statusClass(i, item.error),
22
+ 'hy-steps-item__wrapper'
23
+ ]"
24
+ :style="itemStyleInner"
25
+ >
26
+ <slot v-if="$slots.icon" name="icon" :error="item?.error" :index="i"></slot>
27
+ <template v-else>
28
+ <view
29
+ :class="[
30
+ 'hy-steps-item__wrapper--dot__item',
31
+ `hy-steps-item__wrapper--dot__${statusClass(i, item.error)}`
32
+ ]"
33
+ v-if="dot"
34
+ :style="{
35
+ backgroundColor: statusColor(i, item?.error)
36
+ }"
37
+ ></view>
38
+ <view
39
+ class="hy-steps-item__wrapper__icon"
40
+ v-else-if="activeIcon || inactiveIcon"
41
+ >
42
+ <hy-icon
43
+ :name="i <= current ? activeIcon : inactiveIcon"
44
+ :size="iconSize"
45
+ :color="i <= current ? activeColor : inactiveColor"
46
+ ></hy-icon>
47
+ </view>
48
+ <view
49
+ v-else
50
+ :style="{
51
+ backgroundColor:
52
+ statusClass(i, item.error) === 'process'
53
+ ? activeColor
54
+ : 'transparent',
55
+ borderColor: statusColor(i, item?.error)
56
+ }"
57
+ class="hy-steps-item__wrapper__circle"
58
+ >
59
+ <text
60
+ v-if="
61
+ statusClass(i, item.error) === 'process' ||
62
+ statusClass(i, item.error) === 'wait'
63
+ "
64
+ class="hy-steps-item__wrapper__circle__text"
65
+ :style="{
66
+ color: textColor(i)
67
+ }"
68
+ >
69
+ {{ i + 1 }}
70
+ </text>
71
+ <hy-icon
72
+ v-else
73
+ :color="
74
+ statusClass(i, item.error) === 'error' ? 'error' : activeColor
75
+ "
76
+ :size="iconSize"
77
+ :name="
78
+ statusClass(i, item.error) === 'error'
79
+ ? IconConfig.CLOSE
80
+ : IconConfig.CHECK_MASK
81
+ "
82
+ ></hy-icon>
83
+ </view>
84
+ </template>
85
+ </view>
86
+ <!-- 步骤状态 -->
87
+
88
+ <!-- 内容区域 -->
89
+ <view
90
+ class="hy-steps-item__content"
91
+ :class="[`hy-steps-item__content--${direction}`]"
92
+ :style="[contentStyle]"
93
+ >
94
+ <slot v-if="$slots.content" name="content" :record="item" :index="i"></slot>
95
+ <template v-else>
96
+ <slot
97
+ v-if="$slots.title"
98
+ name="title"
99
+ :title="item.title"
100
+ :index="i"
101
+ ></slot>
102
+ <text v-else :class="titleClass(i, item.error)">
103
+ {{ item.title }}
104
+ </text>
105
+ <slot v-if="$slots.docs" name="docs" :desc="item.docs" :index="i"></slot>
106
+ <text v-else :style="{ fontSize: '12px', color: '#999' }">{{
107
+ item.docs
108
+ }}</text>
109
+ <text class="hy-steps-item__content--date">{{ item.date }}</text>
110
+ </template>
111
+ </view>
112
+ <!-- 内容区域 -->
113
+ </view>
114
+ </template>
115
+ </view>
116
+ </template>
117
+
118
+ <script lang="ts">
119
+ export default {
120
+ name: 'hy-steps',
121
+ options: {
122
+ addGlobalClass: true,
123
+ virtualHost: true,
124
+ styleIsolation: 'shared'
125
+ }
126
+ }
127
+ </script>
128
+
129
+ <script setup lang="ts">
130
+ import { computed, ref, onMounted, getCurrentInstance, watch } from 'vue'
131
+ import type { CSSProperties } from 'vue'
132
+ import type { IStepsEmits } from './typing'
133
+ import type { StepListVo } from './typing'
134
+ import { addUnit, getRect, ColorConfig, IconConfig } from '../../libs'
135
+ import stepsProps from './props'
136
+ // 组件
137
+ import HyIcon from '../hy-icon/hy-icon.vue'
138
+
139
+ /**
140
+ * 一般用于完成一个任务要分几个步骤,标识目前处于第几步的场景。
141
+ * @displayName hy-steps
142
+ */
143
+ defineOptions({})
144
+
145
+ const props = defineProps(stepsProps)
146
+ const emit = defineEmits<IStepsEmits>()
147
+
148
+ const stepsRects = ref<UniApp.NodeInfo[]>([])
149
+ const instance = getCurrentInstance()
150
+
151
+ watch(
152
+ () => props.current,
153
+ (newVal: number) => {
154
+ if (props.list[newVal - 1]?.error) {
155
+ const index = props.list.findIndex((item) => item.error)
156
+ emit('update:current', index)
157
+ emit('change', index)
158
+ }
159
+ }
160
+ )
161
+
162
+ // 字体标题类名
163
+ const titleClass = computed(() => {
164
+ return (index: number, error: boolean) => {
165
+ const classes = ['hy-steps-item__content__title']
166
+ if (props.current === index) {
167
+ classes.push('hy-steps-item__content__title--active')
168
+
169
+ if (error) {
170
+ classes.push('hy-steps-item__content__title--error')
171
+ }
172
+ }
173
+
174
+ return classes
175
+ }
176
+ })
177
+ // 字体颜色
178
+ const textColor = computed(() => {
179
+ return (index: number) => (index === props.current ? '#ffffff' : props.inactiveColor)
180
+ })
181
+
182
+ /**
183
+ * @description 线条样式
184
+ * */
185
+ const lineStyle = computed(() => {
186
+ return (temp: StepListVo, index: number): CSSProperties => {
187
+ const style: CSSProperties = {}
188
+ if (!stepsRects.value.length) return style
189
+ if (props.direction === 'row') {
190
+ style.width = addUnit(stepsRects.value[index].width! - 25)
191
+ style.left = addUnit(stepsRects.value[index].width! / 2 + 12)
192
+ } else {
193
+ style.height = addUnit(stepsRects.value[index].height! - 30)
194
+ style.top = addUnit(25)
195
+ }
196
+ style.backgroundColor = temp.error ? '' : index < props.current ? '' : props.inactiveColor
197
+ return style
198
+ }
199
+ })
200
+
201
+ const itemStyleInner = computed(() => {
202
+ return {}
203
+ })
204
+ /**
205
+ * @description 状态类名
206
+ * */
207
+ const statusClass = computed(() => {
208
+ return (index: number, error: boolean = false, line: string) => {
209
+ console.log(index, props.current, line, error)
210
+ if (props.current == index) {
211
+ return error ? 'error' : 'process'
212
+ } else if (props.current > index) {
213
+ return 'finish'
214
+ } else {
215
+ return 'wait'
216
+ }
217
+ }
218
+ })
219
+ const statusColor = computed(() => {
220
+ return (index: number, error?: boolean) => {
221
+ let colorTmp: string | number
222
+ switch (statusClass.value(index, error)) {
223
+ case 'finish':
224
+ colorTmp = props.activeColor
225
+ break
226
+ case 'error':
227
+ colorTmp = ColorConfig.error
228
+ break
229
+ case 'process':
230
+ colorTmp = props.dot ? props.current : 'transparent'
231
+ break
232
+ default:
233
+ colorTmp = props.inactiveColor
234
+ break
235
+ }
236
+ return colorTmp
237
+ }
238
+ })
239
+
240
+ const contentStyle = computed<CSSProperties>(() => {
241
+ const style: CSSProperties = {}
242
+ if (props.direction === 'column') {
243
+ style.marginLeft = props.dot ? '2px' : '6px'
244
+ style.marginTop = props.dot ? '0px' : '0px'
245
+ } else {
246
+ style.marginTop = props.dot ? '2px' : '6px'
247
+ style.marginLeft = props.dot ? '0px' : '0px'
248
+ }
249
+
250
+ return style
251
+ })
252
+
253
+ onMounted(() => {
254
+ getStepsItemRect()
255
+ })
256
+
257
+ // 获取组件的尺寸,用于设置横线的位置
258
+ const getStepsItemRect = () => {
259
+ getRect('.hy-steps-item', true, instance).then((rect) => {
260
+ stepsRects.value = rect as UniApp.NodeInfo[]
261
+ })
262
+ }
263
+ </script>
264
+
265
+ <style lang="scss" scoped>
266
+ @import './index.scss';
267
+ </style>
@@ -114,10 +114,10 @@
114
114
 
115
115
  @include e(title) {
116
116
  line-height: 25px;
117
- font-size: 13px;
117
+ font-size: 30rpx;
118
118
  @include m(active) {
119
119
  color: $hy-primary;
120
- font-size: 15px;
120
+ font-size: 34rpx;
121
121
  }
122
122
 
123
123
  @include m(error) {
@@ -136,6 +136,11 @@
136
136
  margin-left: $hy-border-margin-padding-sm;
137
137
  min-height: 60px;
138
138
  }
139
+
140
+ @include m(date) {
141
+ font-size: 24rpx;
142
+ color: #999;
143
+ }
139
144
  }
140
145
 
141
146
  /* 线条样式 */