hy-app 0.5.2 → 0.5.3

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 (39) hide show
  1. package/components/hy-action-sheet/index.scss +0 -5
  2. package/components/hy-back-top/hy-back-top.vue +10 -9
  3. package/components/hy-back-top/props.ts +5 -3
  4. package/components/hy-badge/hy-badge.vue +2 -1
  5. package/components/hy-badge/props.ts +5 -3
  6. package/components/hy-button/hy-button.vue +5 -5
  7. package/components/hy-button/index.scss +9 -0
  8. package/components/hy-button/props.ts +11 -6
  9. package/components/hy-coupon/hy-coupon.vue +159 -167
  10. package/components/hy-coupon/index.scss +130 -516
  11. package/components/hy-coupon/props.ts +98 -127
  12. package/components/hy-coupon/typing.d.ts +147 -146
  13. package/components/hy-folding-panel-item/hy-folding-panel-item.vue +1 -3
  14. package/components/hy-folding-panel-item/index.scss +0 -8
  15. package/components/hy-form-group/hy-form-group.vue +308 -511
  16. package/components/hy-form-group/index.scss +0 -33
  17. package/components/hy-form-group/props.ts +103 -13
  18. package/components/hy-form-group/typing.d.ts +0 -77
  19. package/components/hy-form-item/hy-form-item.vue +3 -3
  20. package/components/hy-input/hy-input.vue +16 -10
  21. package/components/hy-input/index.scss +4 -0
  22. package/components/hy-input/props.ts +2 -2
  23. package/components/hy-notice-bar/hy-column-notice.vue +63 -70
  24. package/components/hy-notice-bar/hy-row-notice.vue +92 -110
  25. package/components/hy-notice-bar/index.scss +2 -4
  26. package/components/hy-notice-bar/props.ts +4 -1
  27. package/components/hy-qrcode/hy-qrcode.vue +1 -1
  28. package/components/hy-qrcode/index.scss +1 -0
  29. package/components/hy-qrcode/qrcode.js +1208 -1402
  30. package/components/hy-rate/hy-rate.vue +0 -1
  31. package/components/hy-read-more/hy-read-more.vue +1 -1
  32. package/components/hy-textarea/hy-textarea.vue +1 -1
  33. package/components/hy-textarea/index.scss +8 -7
  34. package/components/hy-toast/index.scss +2 -7
  35. package/libs/css/common.scss +0 -5
  36. package/libs/typing/modules/form.ts +159 -163
  37. package/package.json +2 -2
  38. package/web-types.json +1 -1
  39. package/components/hy-coupon/README.md +0 -133
@@ -121,8 +121,3 @@
121
121
  @include lineEllipsis;
122
122
  }
123
123
  }
124
-
125
- /* 去除原生按钮边框 */
126
- button:after {
127
- border: none;
128
- }
@@ -1,9 +1,10 @@
1
1
  <template>
2
- <HyTransition mode="fade" :customStyle="backTopStyle" :show="show">
3
- <!-- @slot 默认插槽 -->
4
- <slot>
5
- <view class="hy-back-top" :style="contentStyle" @click="backToTop">
6
- <HyIcon
2
+ <hy-transition mode="fade" :customStyle="backTopStyle" :show="show">
3
+ <view class="hy-back-top" :style="contentStyle" @click="backToTop">
4
+ <!-- @slot 默认插槽 -->
5
+ <slot v-if="$slots.default"></slot>
6
+ <template v-else>
7
+ <hy-icon
7
8
  :name="icon?.name || IconConfig.DOWNLOAD"
8
9
  :color="icon?.color"
9
10
  :size="icon?.size"
@@ -16,11 +17,11 @@
16
17
  :stop="icon?.stop"
17
18
  :round="icon?.round"
18
19
  :customStyle="icon?.customStyle"
19
- ></HyIcon>
20
+ ></hy-icon>
20
21
  <text v-if="text" class="hy-back-top__text">{{ text }}</text>
21
- </view>
22
- </slot>
23
- </HyTransition>
22
+ </template>
23
+ </view>
24
+ </hy-transition>
24
25
  </template>
25
26
 
26
27
  <script lang="ts">
@@ -50,10 +50,12 @@ const backTopProps = {
50
50
  /** 定义需要用到的外部样式 */
51
51
  customStyle: {
52
52
  type: Object as PropType<CSSProperties>,
53
- default: {
53
+ default: () => ({
54
54
  transform: 'rotate(180deg)'
55
- }
56
- }
55
+ })
56
+ },
57
+ /** 自定义外部类名 */
58
+ customClass: String,
57
59
  }
58
60
 
59
61
  export default backTopProps
@@ -6,7 +6,8 @@
6
6
  isDot ? 'hy-badge--dot' : 'hy-badge--not-dot',
7
7
  inverted && 'hy-badge--inverted',
8
8
  shape === 'horn' && 'hy-badge--horn',
9
- `hy-badge--${type}${inverted ? '--inverted' : ''}`
9
+ `hy-badge--${type}${inverted ? '--inverted' : ''}`,
10
+ customClass
10
11
  ]"
11
12
  :style="[customStyle, badgeStyle]"
12
13
  @tap="onClick"
@@ -54,8 +54,8 @@ const badgeProps = {
54
54
  type: String,
55
55
  default: 'overflow'
56
56
  },
57
- /** 设置badge的位置偏移,格式为 [x, y],也即设置的为top和right的值,absolute为true时有效 */
58
- offset: Array<number>,
57
+ /** 设置badge的位置偏移,格式为 \[x, y\],也即设置的为top和right的值,absolute为true时有效 */
58
+ offset: Array,
59
59
  /** 是否反转背景和字体颜色 */
60
60
  inverted: {
61
61
  type: Boolean,
@@ -69,7 +69,9 @@ const badgeProps = {
69
69
  /** 自定义输入框外部样式 */
70
70
  customStyle: {
71
71
  type: Object as PropType<CSSProperties>
72
- }
72
+ },
73
+ /** 自定义外部类名 */
74
+ customClass: String
73
75
  }
74
76
 
75
77
  export default badgeProps
@@ -23,7 +23,7 @@
23
23
  :hover-class="!disabled && !loading ? 'hy-button--active' : ''"
24
24
  :style="[baseColor, customStyle]"
25
25
  @click="clickHandler"
26
- :class="['hy-button', 'hy-reset-button', bemClass, customClass]"
26
+ :class="['hy-button', border ? '' : 'hy-button__no-border', bemClass, customClass]"
27
27
  >
28
28
  <template v-if="loading">
29
29
  <HyLoading :mode="loadingMode" :size="loadingSize" :color="loadingColor"></HyLoading>
@@ -32,7 +32,7 @@
32
32
  </text>
33
33
  </template>
34
34
  <template v-else>
35
- <HyIcon
35
+ <hy-icon
36
36
  v-if="icon?.name"
37
37
  :name="icon?.name"
38
38
  :color="iconColorCom"
@@ -46,7 +46,7 @@
46
46
  :stop="icon?.stop"
47
47
  :round="icon?.round"
48
48
  :customStyle="icon?.customStyle || { marginRight: '2px' }"
49
- ></HyIcon>
49
+ ></hy-icon>
50
50
  <!-- @slot 插入默认的值 -->
51
51
  <slot v-if="$slots.default"></slot>
52
52
  <text v-else class="hy-button__text" :style="[{ fontSize: textSize + 'px' }]">{{
@@ -83,7 +83,7 @@
83
83
  </text>
84
84
  </template>
85
85
  <template v-else>
86
- <HyIcon
86
+ <hy-icon
87
87
  v-if="icon?.name"
88
88
  :name="icon?.name"
89
89
  :color="iconColorCom"
@@ -97,7 +97,7 @@
97
97
  :stop="icon?.stop"
98
98
  :round="icon?.round"
99
99
  :customStyle="icon?.customStyle || { marginRight: '2px' }"
100
- ></HyIcon>
100
+ ></hy-icon>
101
101
  <text
102
102
  class="hy-button__text"
103
103
  :style="[
@@ -15,6 +15,11 @@
15
15
  /* #endif */
16
16
  flex-direction: row;
17
17
 
18
+ /* 去除原生按钮边框 */
19
+ &:after {
20
+ border: none !important;
21
+ }
22
+
18
23
  @include e(text) {
19
24
  font-size: 15px;
20
25
  }
@@ -59,6 +64,10 @@
59
64
  opacity: 0.5;
60
65
  }
61
66
 
67
+ @include e(no-border) {
68
+ border: none !important;
69
+ }
70
+
62
71
  @include themeColor(info, $hy-info, $hy-info);
63
72
  @include themeColor(success, $hy-success, $hy-success);
64
73
  @include themeColor(primary, $hy-primary, $hy-primary);
@@ -5,7 +5,12 @@ const buttonProps = {
5
5
  /** 是否显示按钮的细边框 */
6
6
  hairline: {
7
7
  type: Boolean,
8
- default: false
8
+ default: true
9
+ },
10
+ /** 是否显示按钮的边框 */
11
+ border: {
12
+ type: Boolean,
13
+ default: true
9
14
  },
10
15
  /**
11
16
  * 按钮的预置样式
@@ -116,15 +121,15 @@ const buttonProps = {
116
121
  icon: Object as PropType<HyIconProps>,
117
122
  /** 按钮颜色,支持传入linear-gradient渐变色 */
118
123
  color: String,
124
+ /** 定义需要用到的外部样式 */
125
+ customStyle: Object as PropType<CSSProperties>,
126
+ /** 自定义外部类名 */
127
+ customClass: String,
119
128
  /** 阻止事件冒泡 */
120
129
  stop: {
121
130
  type: Boolean,
122
131
  default: true
123
- },
124
- /** 定义需要用到的外部样式 */
125
- customStyle: Object as PropType<CSSProperties>,
126
- /** 自定义外部类名 */
127
- customClass: String
132
+ }
128
133
  }
129
134
 
130
135
  export default buttonProps
@@ -1,180 +1,172 @@
1
1
  <template>
2
- <view
3
- :class="['hy-coupon', `hy-coupon--${status}`, `hy-coupon--${type}`, customClass]"
4
- :style="customStyle"
5
- @click="handleClick"
6
- @mouseenter="handleMouseEnter"
7
- @mouseleave="handleMouseLeave"
8
- >
9
- <!-- 顶部和底部波浪形装饰 -->
10
- <view class="top-wave"></view>
11
- <view class="bottom-wave"></view>
12
-
13
- <!-- 左侧金额区域 -->
14
- <view class="hy-coupon__left">
15
- <!-- 背景纹理 -->
16
- <view class="texture"></view>
17
- <text class="amount">
18
- <text class="amount-symbol">¥</text>
19
- {{ amount }}
20
- </text>
21
- <text class="min-spend" v-if="minSpend > 0"> 满{{ minSpend }}可用 </text>
22
- </view>
23
-
24
- <!-- 优惠券左侧边框装饰 -->
25
- <view v-if="showLeftBorder" class="coupon-border-left"></view>
26
-
27
- <!-- 右侧内容区域 -->
28
- <view class="hy-coupon__right">
29
- <view class="content">
30
- <text class="title">{{ title }}</text>
31
- <text v-if="subTitle" class="subtitle">{{ subTitle }}</text>
32
- </view>
33
- <text class="validity">{{ validityText }}</text>
34
-
35
- <!-- 限制标签 -->
36
- <view class="limit-tags" v-if="limitTags.length > 0">
37
- <text v-for="(tag, index) in limitTags" :key="index" class="limit-tag">
38
- {{ tag }}
39
- </text>
40
- </view>
41
-
42
- <!-- 立即领取按钮 -->
43
- <view class="action-button" v-if="showActionButton">
44
- <text class="action-button-text">{{ buttonText }}</text>
45
- </view>
2
+ <view
3
+ :class="cardClass"
4
+ @click="handleClick"
5
+ :style="[
6
+ {
7
+ background: bgColor,
8
+ filter: boxShadow ? 'drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.2))' : ''
9
+ },
10
+ customStyle
11
+ ]"
12
+ >
13
+ <!-- 优惠券主体 -->
14
+ <view class="hy-coupon__content">
15
+ <!-- 左侧金额/折扣信息 -->
16
+ <view class="hy-coupon__content--left">
17
+ <!-- @slot 自定义金额插槽 -->
18
+ <slot v-if="$slots.left" name="left"></slot>
19
+ <template v-else>
20
+ <view class="hy-coupon__content--left__block">
21
+ <view class="hy-coupon__content--left__value">
22
+ <text>
23
+ {{ amount || 0 }}
24
+ </text>
25
+ </view>
26
+ <view class="hy-coupon__content--left__suffix">
27
+ <text v-if="unit">{{ unit }}</text>
28
+ <text v-else-if="type === 'discount'">折</text>
29
+ <text v-else>元</text>
30
+ </view>
31
+ </view>
32
+
33
+ <hy-tag
34
+ :text="typeValue"
35
+ size="mini"
36
+ plain
37
+ shape="circle"
38
+ color="#FFFFFF"
39
+ ></hy-tag>
40
+ </template>
41
+ </view>
42
+
43
+ <hy-line
44
+ :hairline="false"
45
+ direction="column"
46
+ dashed
47
+ color="#FFFFFF"
48
+ length="70%"
49
+ ></hy-line>
50
+
51
+ <!-- 右侧描述信息 -->
52
+ <view class="hy-coupon__content--right">
53
+ <!-- 自定义详情插槽 -->
54
+ <slot v-if="$slots.right" name="right"></slot>
55
+ <template v-else>
56
+ <view class="hy-coupon__content--right__name">{{ title }}</view>
57
+ <view class="hy-coupon__content--right__desc">{{ description }}</view>
58
+ <view class="hy-coupon__content--right__validity">
59
+ {{
60
+ dateDesc
61
+ ? dateDesc
62
+ : `有效期: ${formatTime(startDate, format)} - ${formatTime(endDate, format)}`
63
+ }}
64
+ </view>
65
+ </template>
66
+ </view>
67
+ </view>
68
+
69
+ <!-- 右侧状态标签 -->
70
+ <view class="hy-coupon__btn">
71
+ <!-- 自定义按钮插槽 -->
72
+ <slot v-if="$slots.button" name="button"></slot>
73
+ <template v-else>
74
+ <view v-if="btnMode === 'text'" class="hy-coupon__tag">
75
+ <text class="hy-coupon__tag--btn" @tap.stop="onUsed">{{ btnText }}</text>
76
+ </view>
77
+ <hy-button
78
+ v-if="btnMode === 'button'"
79
+ :text="btnText"
80
+ plain
81
+ :disabled="isDisable"
82
+ :size="buttonProp?.size || 'small'"
83
+ :shape="buttonProp?.shape || 'circle'"
84
+ :color="buttonProp?.color || '#FFFFFF'"
85
+ :custom-style="{ marginRight: '10px' }"
86
+ @click="onUsed"
87
+ ></hy-button>
88
+ </template>
89
+ </view>
46
90
  </view>
47
-
48
- <!-- 优惠券右侧边框装饰 -->
49
- <view v-if="showRightBorder" class="coupon-border-right"></view>
50
-
51
- <!-- 悬浮提示 -->
52
- <view v-if="tooltip" class="coupon-tooltip" :class="{ show: showTooltip }">
53
- {{ tooltip }}
54
- </view>
55
- </view>
56
91
  </template>
57
92
 
58
93
  <script lang="ts">
59
- import { defineComponent, ref, computed } from "vue";
60
- import type { CouponStatus } from "./typing";
61
- import { props } from "./props";
94
+ export default {
95
+ name: 'hy-coupon',
96
+ options: {
97
+ addGlobalClass: true,
98
+ virtualHost: true,
99
+ styleIsolation: 'shared'
100
+ }
101
+ }
102
+ </script>
103
+
104
+ <script setup lang="ts">
105
+ import { computed } from 'vue'
106
+ import type { ICouponEmits } from './typing'
107
+ import { formatTime } from '../../libs'
108
+ import couponProps from './props'
109
+
110
+ // 组件
111
+ import hyTag from '../hy-tag/hy-tag.vue'
112
+ import hyLine from '../hy-line/hy-line.vue'
113
+ import hyButton from '../hy-button/hy-button.vue'
62
114
 
63
115
  /**
64
- * 优惠券组件
116
+ * 用于商品优惠券的业务组件
65
117
  * @displayName hy-coupon
66
118
  */
67
- export default defineComponent({
68
- name: "HyCoupon",
69
- props,
70
- emits: ["click", "receive", "hover"],
71
- setup(props: any, { emit }) {
72
-
73
- // 响应式数据
74
- const showTooltip = ref(false);
75
-
76
- // 计算有效性文本
77
- const validityText = computed(() => {
78
- if (!props.validity) return "";
79
-
80
- // 根据状态显示不同的有效期文本
81
- switch (props.status) {
82
- case "used":
83
- return props.usedDate ? `使用时间: ${props.usedDate}` : "已使用";
84
- case "expired":
85
- return props.expireDate ? `有效期至: ${props.expireDate}` : "已过期";
86
- case "disabled":
87
- return props.disabledReason || "已禁用";
88
- default:
89
- return props.validity;
90
- }
91
- });
92
-
93
- // 计算限制标签
94
- const limitTags = computed(() => {
95
- const tags: string[] = [];
96
-
97
- // 根据属性添加不同的标签
98
- if (props.isExclusive) {
99
- tags.push("专属");
100
- }
101
-
102
- if (props.limitPerUser > 0) {
103
- tags.push(`限领${props.limitPerUser}张`);
104
- }
105
-
106
- if (props.minSpend > 0 && props.minSpend <= 1000) {
107
- // 小额满减可以显示在标签中
108
- tags.push(`满${props.minSpend}可用`);
109
- }
110
-
111
- return tags;
112
- });
113
-
114
- // 按钮文本
115
- const buttonText = computed(() => {
116
- return (
117
- props.customButtonText || (props.status === "normal" ? "立即领取" : "")
118
- );
119
- });
120
-
121
- // 是否显示操作按钮
122
- const showActionButton = computed(() => {
123
- return props.showActionButton && props.status === "normal";
124
- });
125
-
126
- // 是否显示左侧边框装饰
127
- const showLeftBorder = computed(() => {
128
- return true; // 默认显示左侧边框装饰
129
- });
130
-
131
- // 是否显示右侧边框装饰
132
- const showRightBorder = computed(() => {
133
- return true; // 默认显示右侧边框装饰
134
- });
135
-
136
- // 处理点击事件
137
- const handleClick = () => {
138
- if (props.status === "normal") {
139
- emit("click", { status: props.status });
140
-
141
- // 如果需要,可以同时触发receive事件
142
- if (props.triggerReceiveOnClick) {
143
- emit("receive");
119
+ defineOptions({})
120
+
121
+ const props = defineProps(couponProps)
122
+ const emit = defineEmits<ICouponEmits>()
123
+
124
+ // 禁用功能
125
+ const isDisable = computed(() => props.disabledStatus.includes(props.status))
126
+
127
+ const typeValue = computed(() => {
128
+ let text = ''
129
+ if (props.typeText) {
130
+ text = props.typeText
131
+ } else {
132
+ switch (props.type) {
133
+ case 'moneyOff':
134
+ text = '满减券'
135
+ break
136
+ case 'discount':
137
+ text = '折扣券'
138
+ break
139
+ case 'fixedAmount':
140
+ text = '无门槛券'
141
+ break
142
+ default:
143
+ text = '未知券'
144
+ break
144
145
  }
145
- }
146
- };
147
-
148
- // 鼠标悬停处理
149
- const handleMouseEnter = () => {
150
- if (props.tooltip) {
151
- showTooltip.value = true;
152
- }
153
- emit("hover", true);
154
- };
155
-
156
- // 鼠标离开处理
157
- const handleMouseLeave = () => {
158
- showTooltip.value = false;
159
- emit("hover", false);
160
- };
161
-
162
- return {
163
- showTooltip,
164
- validityText,
165
- limitTags,
166
- buttonText,
167
- showActionButton,
168
- showLeftBorder,
169
- showRightBorder,
170
- handleClick,
171
- handleMouseEnter,
172
- handleMouseLeave,
173
- };
174
- }
175
- });
146
+ }
147
+ return text
148
+ })
149
+
150
+ const cardClass = computed(() => {
151
+ const baseClass = 'hy-coupon hy-coupon__card'
152
+ const typeClass = `hy-coupon--${props.type}`
153
+ const statusClass = isDisable.value && 'hy-coupon--disabled'
154
+ return `${baseClass} ${typeClass} ${statusClass} ${props.customClass}`
155
+ })
156
+
157
+ // 点击优惠券触发
158
+ const handleClick = () => {
159
+ emit('click')
160
+ }
161
+
162
+ // 点击使用优惠券触发
163
+ const onUsed = () => {
164
+ if (!isDisable.value) {
165
+ emit('used')
166
+ }
167
+ }
176
168
  </script>
177
169
 
178
- <style lang="scss" scoped>
179
- @import "./index.scss";
170
+ <style scoped lang="scss">
171
+ @import './index.scss';
180
172
  </style>