hy-app 0.5.2 → 0.5.4

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 (74) hide show
  1. package/components/hy-action-sheet/index.scss +0 -5
  2. package/components/hy-avatar/hy-avatar.vue +4 -3
  3. package/components/hy-back-top/hy-back-top.vue +10 -9
  4. package/components/hy-back-top/props.ts +5 -3
  5. package/components/hy-badge/hy-badge.vue +5 -4
  6. package/components/hy-badge/index.scss +0 -1
  7. package/components/hy-badge/props.ts +11 -4
  8. package/components/hy-button/hy-button.vue +5 -5
  9. package/components/hy-button/index.scss +9 -0
  10. package/components/hy-button/props.ts +11 -6
  11. package/components/hy-coupon/hy-coupon.vue +159 -167
  12. package/components/hy-coupon/index.scss +135 -516
  13. package/components/hy-coupon/props.ts +101 -127
  14. package/components/hy-coupon/typing.d.ts +147 -146
  15. package/components/hy-datetime-picker/props.ts +1 -3
  16. package/components/hy-folding-panel/props.ts +1 -1
  17. package/components/hy-folding-panel/typing.d.ts +0 -38
  18. package/components/hy-folding-panel-item/hy-folding-panel-item.vue +2 -5
  19. package/components/hy-folding-panel-item/index.scss +0 -8
  20. package/components/hy-folding-panel-item/typing.d.ts +14 -0
  21. package/components/hy-form-group/hy-form-group.vue +308 -511
  22. package/components/hy-form-group/index.scss +0 -33
  23. package/components/hy-form-group/props.ts +103 -13
  24. package/components/hy-form-group/typing.d.ts +0 -77
  25. package/components/hy-form-item/hy-form-item.vue +3 -3
  26. package/components/hy-icon/hy-icon.vue +3 -8
  27. package/components/hy-input/hy-input.vue +16 -10
  28. package/components/hy-input/index.scss +4 -0
  29. package/components/hy-input/props.ts +2 -2
  30. package/components/hy-list/props.ts +1 -1
  31. package/components/hy-notice-bar/hy-column-notice.vue +63 -70
  32. package/components/hy-notice-bar/hy-row-notice.vue +92 -110
  33. package/components/hy-notice-bar/index.scss +2 -4
  34. package/components/hy-notice-bar/props.ts +4 -1
  35. package/components/hy-notice-bar/typing.d.ts +2 -0
  36. package/components/hy-popup/hy-popup.vue +0 -1
  37. package/components/hy-qrcode/hy-qrcode.vue +69 -3
  38. package/components/hy-qrcode/index.scss +3 -3
  39. package/components/hy-qrcode/qrcode.js +1344 -1400
  40. package/components/hy-rate/hy-rate.vue +0 -1
  41. package/components/hy-read-more/hy-read-more.vue +1 -1
  42. package/components/hy-signature/hy-signature.vue +25 -22
  43. package/components/hy-signature/index.scss +0 -4
  44. package/components/hy-tabbar/hy-tabbar.vue +137 -0
  45. package/components/{hy-tabBar → hy-tabbar}/index.scss +30 -30
  46. package/components/hy-tabbar/props.ts +59 -0
  47. package/components/hy-tabbar/typing.d.ts +61 -0
  48. package/components/hy-tabbar-group/README.md +326 -0
  49. package/components/hy-tabbar-group/hy-tabbar-group.vue +87 -0
  50. package/components/hy-tabbar-group/index.scss +57 -0
  51. package/components/hy-tabbar-group/props.ts +78 -0
  52. package/components/hy-tabbar-group/typing.ts +16 -0
  53. package/components/hy-tabbar-item/hy-tabbar-item.vue +103 -0
  54. package/components/hy-tabbar-item/index.scss +43 -0
  55. package/components/hy-tabbar-item/props.ts +24 -0
  56. package/components/hy-tabbar-item/typing.ts +22 -0
  57. package/components/hy-tag/props.ts +8 -2
  58. package/components/hy-text/props.ts +8 -2
  59. package/components/hy-textarea/hy-textarea.vue +1 -1
  60. package/components/hy-textarea/index.scss +8 -7
  61. package/components/hy-textarea/props.ts +4 -1
  62. package/components/hy-toast/index.scss +2 -7
  63. package/components/hy-tooltip/props.ts +1 -3
  64. package/components/hy-upload/props.ts +1 -1
  65. package/components/index.ts +177 -177
  66. package/global.d.ts +87 -85
  67. package/libs/css/common.scss +0 -5
  68. package/libs/typing/modules/form.ts +159 -163
  69. package/package.json +2 -2
  70. package/web-types.json +1 -1
  71. package/components/hy-coupon/README.md +0 -133
  72. package/components/hy-tabBar/hy-tabBar.vue +0 -109
  73. package/components/hy-tabBar/props.ts +0 -13
  74. package/components/hy-tabBar/typing.d.ts +0 -54
@@ -167,7 +167,6 @@ const clickHandler = (e: TouchEvent) => {
167
167
  // return;
168
168
  // }
169
169
  e.stopPropagation()
170
- console.log(e, '微信')
171
170
  let x = 0
172
171
  // #ifndef APP-NVUE || MP-ALIPAY
173
172
  x = e.detail.x
@@ -62,7 +62,7 @@ export default {
62
62
  import { computed, ref, onMounted, getCurrentInstance } from 'vue'
63
63
  import type { CSSProperties } from 'vue'
64
64
  import type { IReadMoreEmits } from './typing'
65
- import { getRect, guid, sleep, IconConfig } from '../../libs'
65
+ import { getRect, guid, sleep, addUnit, IconConfig } from '../../libs'
66
66
  import readMoreProps from './props'
67
67
  // 组件
68
68
  import HyIcon from '../hy-icon/hy-icon.vue'
@@ -46,37 +46,39 @@
46
46
  >
47
47
  </slot>
48
48
  <template v-else>
49
- <block v-if="enableHistory">
49
+ <hy-flex gap="12">
50
+ <block v-if="enableHistory">
51
+ <hy-button
52
+ size="small"
53
+ plain
54
+ shape="circle"
55
+ @click="revoke"
56
+ :disabled="lines.length <= 0"
57
+ :text="revokeText"
58
+ ></hy-button>
59
+ <hy-button
60
+ size="small"
61
+ plain
62
+ shape="circle"
63
+ @click="restore"
64
+ :disabled="redoLines.length <= 0"
65
+ :text="restoreText"
66
+ ></hy-button>
67
+ </block>
50
68
  <hy-button
51
69
  size="small"
52
70
  plain
53
71
  shape="circle"
54
- @click="revoke"
55
- :disabled="lines.length <= 0"
56
- :text="revokeText"
72
+ @click="clear"
73
+ :text="clearText"
57
74
  ></hy-button>
58
75
  <hy-button
59
76
  size="small"
60
- plain
61
77
  shape="circle"
62
- @click="restore"
63
- :disabled="redoLines.length <= 0"
64
- :text="restoreText"
78
+ @click="confirmSignature"
79
+ :text="confirmText"
65
80
  ></hy-button>
66
- </block>
67
- <hy-button
68
- size="small"
69
- plain
70
- shape="circle"
71
- @click="clear"
72
- :text="clearText"
73
- ></hy-button>
74
- <hy-button
75
- size="small"
76
- shape="circle"
77
- @click="confirmSignature"
78
- :text="confirmText"
79
- ></hy-button>
81
+ </hy-flex>
80
82
  </template>
81
83
  </view>
82
84
  </view>
@@ -105,6 +107,7 @@ import signatureProps from './props'
105
107
 
106
108
  // 组件
107
109
  import HyButton from '../hy-button/hy-button.vue'
110
+ import HyFlex from '../hy-flex/hy-flex.vue'
108
111
 
109
112
  /**
110
113
  * 用于签名场景,基于 Canvas 实现的签名组件。提供了基础签名、历史记录、笔锋效果等功能。
@@ -21,9 +21,5 @@
21
21
  margin-top: $hy-border-margin-padding-base;
22
22
  justify-content: flex-end;
23
23
  display: flex;
24
-
25
- :deep(.hy-button) {
26
- margin-left: $hy-border-margin-padding-base;
27
- }
28
24
  }
29
25
  }
@@ -0,0 +1,137 @@
1
+ <template>
2
+ <view class="hy-tabbar" :style="tabBarStyle">
3
+ <view v-if="placeholder" class="hy-tabbar--placeholder"></view>
4
+
5
+ <view class="hy-tabbar--box" :style="{ background: bgColor }">
6
+ <view class="hy-tabbar--container">
7
+ <view
8
+ :class="[
9
+ 'hy-tabbar--container__item',
10
+ 'list',
11
+ current === i ? 'is-active' : ''
12
+ ]"
13
+ v-for="(item, i) in list"
14
+ :key="i"
15
+ ref="itemRef"
16
+ @click="checkItem(i)"
17
+ >
18
+ <view class="hy-tabbar--container__item--bar">
19
+ <view class="icon">
20
+ <hy-badge
21
+ :value="item?.badge"
22
+ absolute
23
+ :offset="[-13, 25]"
24
+ :max="badgeProps?.max"
25
+ :is-dot="badgeProps?.isDot"
26
+ :inverted="badgeProps?.inverted"
27
+ :bg-color="badgeProps?.bgColor"
28
+ :type="badgeProps?.type"
29
+ :number-type="badgeProps?.numberType"
30
+ :shape="badgeProps?.shape"
31
+ :show-zero="badgeProps?.showZero"
32
+ :show="!!item?.badge"
33
+ ></hy-badge>
34
+ <!-- 图标插槽 -->
35
+ <slot v-if="$slots.icon" name="icon"></slot>
36
+ <hy-icon v-else :name="item.icon" :color="color" size="25"></hy-icon>
37
+ </view>
38
+ <text class="text" :style="[{ color: color }]">{{ item.name }}</text>
39
+ <text class="circle"></text>
40
+ </view>
41
+ </view>
42
+ <view
43
+ class="hy-tabbar--indicator"
44
+ :style="{
45
+ '--num': `translateX(${rectList[current]?.left}px)`,
46
+ background: activeColor
47
+ }"
48
+ ></view>
49
+ </view>
50
+ </view>
51
+ </view>
52
+ </template>
53
+
54
+ <script lang="ts">
55
+ export default {
56
+ name: 'hy-tabbar',
57
+ options: {
58
+ addGlobalClass: true,
59
+ virtualHost: true,
60
+ styleIsolation: 'shared'
61
+ }
62
+ }
63
+ </script>
64
+
65
+ <script setup lang="ts">
66
+ import { computed, getCurrentInstance, nextTick, onMounted, ref, watch } from 'vue'
67
+ import tabBarProps from './props'
68
+ import type { ITabBarEmits } from './typing'
69
+
70
+ // 组件
71
+ import HyIcon from '../hy-icon/hy-icon.vue'
72
+ import HyBadge from '../hy-badge/hy-badge.vue'
73
+ import { getRect } from '@/package'
74
+
75
+ /**
76
+ * 底部导航栏,用于在不同页面之间进行切换。
77
+ * @displayName hy-tabbar
78
+ */
79
+ defineOptions({})
80
+
81
+ const props = defineProps(tabBarProps)
82
+ const emit = defineEmits<ITabBarEmits>()
83
+
84
+ const instance = getCurrentInstance()
85
+ const rectList = ref<UniNamespace.NodeInfo[]>([])
86
+ const baseBackgroundColor = props.baseBgColor ? props.baseBgColor : 'var(--hy-background)'
87
+ const current = ref<number>(props.modelValue)
88
+ watch(
89
+ () => props.modelValue,
90
+ (newVal) => {
91
+ current.value = newVal
92
+ }
93
+ )
94
+
95
+ onMounted(() => {
96
+ nextTick(() => {
97
+ getRect('.list', true, instance).then((res) => {
98
+ console.log(res, current.value)
99
+ rectList.value = res
100
+ })
101
+ })
102
+ })
103
+
104
+ // tabbar属性值
105
+ const tabBarStyle = computed(() => {
106
+ const style = {
107
+ position: props.fixed ? 'fixed' : '',
108
+ zIndex: props.zIndex
109
+ }
110
+
111
+ return Object.assign(style, props.customStyle)
112
+ })
113
+
114
+ const checkItem = (index: number) => {
115
+ if (current.value !== index) {
116
+ current.value = index
117
+ emit('change', index)
118
+ emit('update:modelValue', index)
119
+ }
120
+ }
121
+ </script>
122
+
123
+ <style lang="scss" scoped>
124
+ @import './index.scss';
125
+ .hy-tabbar {
126
+ background: v-bind(baseBackgroundColor);
127
+ &--indicator {
128
+ border: 5px solid v-bind(baseBackgroundColor);
129
+ &::before {
130
+ box-shadow: 1px -15rpx 0 v-bind(baseBackgroundColor);
131
+ }
132
+ &::after {
133
+ box-shadow: -1px -15rpx 0 v-bind(baseBackgroundColor);
134
+ }
135
+ }
136
+ }
137
+ </style>
@@ -1,27 +1,26 @@
1
1
  @use "../../libs/css/theme" as *;
2
2
  @use "../../libs/css/mixin.scss" as *;
3
3
 
4
- @include b(tabBar) {
5
- height: 135rpx;
6
- z-index: 999;
7
- position: fixed;
4
+ @include b(tabbar) {
5
+ height: 70px;
8
6
  bottom: 0;
7
+ left: 0;
8
+ right: 0;
9
+ position: relative;
9
10
  @include m(placeholder) {
10
- height: 135rpx;
11
- position: relative;
11
+ height: 137rpx;
12
12
  bottom: 0;
13
13
  }
14
14
 
15
15
  @include m(box) {
16
- margin-top: 15rpx;
17
- position: relative;
18
- width: 100vw;
19
- height: 120rpx;
16
+ position: absolute;
17
+ bottom: 0;
18
+ width: 100%;
19
+ height: 60px;
20
20
  display: flex;
21
21
  justify-content: center;
22
22
  align-items: center;
23
23
  border-radius: 15rpx 15rpx 0 0;
24
- padding: 0 20rpx;
25
24
  /* #ifndef APP-PLUS-NVUE */
26
25
  box-sizing: border-box;
27
26
  /* #endif */
@@ -30,38 +29,38 @@
30
29
  @include m(container) {
31
30
  width: 100%;
32
31
  display: flex;
33
- justify-content: space-between;
32
+ justify-content: space-around;
34
33
  align-items: center;
35
34
  padding: 0 20rpx;
36
35
  &__item {
37
36
  position: relative;
38
- width: 100rpx;
39
- height: 70rpx;
37
+ width: 60px;
38
+ height: 100%;
40
39
  z-index: 1;
41
40
 
42
41
  /* #ifndef APP-PLUS-NVUE */
43
- &:nth-child(1).is-active ~ .hy-tabBar--indicator {
42
+ &:nth-child(1).is-active ~ .hy-tabbar--indicator {
44
43
  transform: var(--num);
45
44
  }
46
45
 
47
- &:nth-child(2).is-active ~ .hy-tabBar--indicator {
46
+ &:nth-child(2).is-active ~ .hy-tabbar--indicator {
48
47
  transform: var(--num);
49
48
  }
50
49
 
51
- &:nth-child(3).is-active ~ .hy-tabBar--indicator {
50
+ &:nth-child(3).is-active ~ .hy-tabbar--indicator {
52
51
  transform: var(--num);
53
52
  }
54
53
 
55
- &:nth-child(4).is-active ~ .hy-tabBar--indicator {
54
+ &:nth-child(4).is-active ~ .hy-tabbar--indicator {
56
55
  transform: var(--num);
57
56
  }
58
57
 
59
- &:nth-child(5).is-active ~ .hy-tabBar--indicator {
58
+ &:nth-child(5).is-active ~ .hy-tabbar--indicator {
60
59
  transform: var(--num);
61
60
  }
62
61
  /* #endif */
63
62
 
64
- &--bar {
63
+ @include m(bar) {
65
64
  position: relative;
66
65
  display: flex;
67
66
  justify-content: center;
@@ -91,19 +90,20 @@
91
90
  /* #ifndef APP-PLUS-NVUE */
92
91
  display: block;
93
92
  /* #endif */
94
- width: 75rpx;
95
- height: 75rpx;
93
+ width: 40px;
94
+ height: 40px;
96
95
  background: transparent;
97
96
  border-radius: 50%;
98
97
  border: 3rpx solid #fff;
99
98
  transform: translateY(-70rpx) scale(0);
99
+ z-index: -1;
100
100
  }
101
101
  }
102
102
 
103
103
  @include is(active) {
104
- @include b(tabBar--container__item--bar) {
104
+ @include b(tabbar--container__item--bar) {
105
105
  .icon {
106
- transform: translate(2rpx, -56rpx);
106
+ transform: translate(0, -36px);
107
107
  :deep(.hy-icon) {
108
108
  color: #FFFFFF;
109
109
  }
@@ -118,7 +118,7 @@
118
118
  transition: 0.5s;
119
119
  /* #endif */
120
120
  transition-delay: 0.5s;
121
- transform: translate(2rpx, -56rpx) scale(1);
121
+ transform: translate(-1px, -36px) scale(1);
122
122
  }
123
123
  }
124
124
  }
@@ -127,10 +127,10 @@
127
127
 
128
128
  @include m(indicator) {
129
129
  position: absolute;
130
- top: -59%;
131
- left: 30rpx;
132
- width: 100rpx;
133
- height: 100rpx;
130
+ top: -36px;
131
+ left: 0;
132
+ width: 50px;
133
+ height: 50px;
134
134
  border-radius: 50%;
135
135
  display: flex;
136
136
  justify-content: center;
@@ -159,7 +159,7 @@
159
159
  /* #endif */
160
160
  position: absolute;
161
161
  top: 58%;
162
- right: -49rpx;
162
+ right: -46rpx;
163
163
  width: 50rpx;
164
164
  height: 40rpx;
165
165
  background: transparent;
@@ -0,0 +1,59 @@
1
+ import type { CSSProperties, PropType } from 'vue'
2
+ import type HyBadgeProps from '../hy-badge/typing'
3
+
4
+ const tabBarProps = {
5
+ /** 选中项的索引值 */
6
+ modelValue: {
7
+ type: Number,
8
+ default: 0
9
+ },
10
+ /** 导航栏数据集合 */
11
+ list: {
12
+ type: Array,
13
+ default: () => []
14
+ },
15
+ /** 是否固定在底部 */
16
+ fixed: {
17
+ type: Boolean,
18
+ default: true
19
+ },
20
+ /** 是否显示占位元素 */
21
+ placeholder: {
22
+ type: Boolean,
23
+ default: false
24
+ },
25
+ zIndex: {
26
+ type: Number,
27
+ default: 10086
28
+ },
29
+ /** 图标和字体颜色 */
30
+ color: {
31
+ type: String,
32
+ default: ''
33
+ },
34
+ /** 轨道颜色 */
35
+ baseBgColor: {
36
+ type: String,
37
+ default: ''
38
+ },
39
+ /** 背景颜色 */
40
+ bgColor: {
41
+ type: String,
42
+ default: ''
43
+ },
44
+ /** 激活圆形背景颜色 */
45
+ activeColor: {
46
+ type: String,
47
+ default: ''
48
+ },
49
+ /** 徽标部分属性 */
50
+ badgeProps: {
51
+ type: Object as PropType<HyBadgeProps>
52
+ },
53
+ /** 定义需要用到的外部样式 */
54
+ customStyle: Object as PropType<CSSProperties>,
55
+ /** 自定义外部类名 */
56
+ customClass: String
57
+ }
58
+
59
+ export default tabBarProps
@@ -0,0 +1,61 @@
1
+ import type HyBadgeProps from '../hy-badge/typing'
2
+
3
+ export interface TabListVo {
4
+ /**
5
+ * @description 标题
6
+ * */
7
+ name: string
8
+ /**
9
+ * @description icon图标或者图片
10
+ * */
11
+ icon: string
12
+ /**
13
+ * @description 徽标值
14
+ * */
15
+ badge?: number
16
+ }
17
+
18
+ export interface HyTabBarProps {
19
+ /**
20
+ * @description tab当前值
21
+ * */
22
+ modelValue: number
23
+ /**
24
+ * @description 导航栏值
25
+ * {
26
+ * name: 中文名,
27
+ * icon: uview-plus里面的矢量图标库
28
+ * }
29
+ * */
30
+ list: TabListVo[]
31
+ /**
32
+ * @description 文字颜色
33
+ * */
34
+ color?: string
35
+ /**
36
+ * @description 底部导航栏底部背景颜色(颜色设置必须要和页面背景颜色一样,才有重合感觉)
37
+ * 支持渐变色--linear-gradient(155deg, #192b6e, #a6307c)
38
+ * */
39
+ baseBgColor?: string
40
+ /**
41
+ * @description 底部导航栏背景颜色
42
+ * 支持渐变色--linear-gradient(155deg, #192b6e, #a6307c)
43
+ * */
44
+ barBgColor?: string
45
+ /**
46
+ * @description 点击突出按钮的背景颜色
47
+ * 支持渐变色--linear-gradient(0deg, #ffa576,#0951eb)
48
+ * */
49
+ activeColor?: string
50
+ /**
51
+ * @description 徽标属性集合
52
+ * */
53
+ badge?: Partial<HyBadgeProps>
54
+ }
55
+
56
+ export interface ITabBarEmits {
57
+ /** 更新选中索引 */
58
+ (e: 'update:modelValue', index: number): void
59
+ /** 变化事件 */
60
+ (e: 'change', index: number): void
61
+ }