hy-app 0.1.3 → 0.1.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 (48) hide show
  1. package/components/hy-button/hy-button.vue +7 -6
  2. package/components/hy-button/typing.d.ts +1 -1
  3. package/components/hy-divider/index.scss +1 -0
  4. package/components/hy-float-button/hy-float-button.vue +19 -3
  5. package/components/hy-float-button/index.scss +0 -2
  6. package/components/hy-form/typing.d.ts +1 -1
  7. package/components/hy-image/hy-image.vue +5 -1
  8. package/components/hy-loading/typing.d.ts +2 -1
  9. package/components/hy-login/TheUserLogin.vue +5 -73
  10. package/components/hy-notice-bar/hy-row-notice.vue +12 -3
  11. package/components/hy-parse/hy-parse.vue +499 -0
  12. package/components/hy-parse/index.scss +9 -0
  13. package/components/hy-parse/node/node.vue +584 -0
  14. package/components/hy-parse/parser.js +1337 -0
  15. package/components/hy-parse/props.ts +19 -0
  16. package/components/hy-parse/typing.d.ts +68 -0
  17. package/components/hy-price/hy-price.vue +6 -8
  18. package/components/hy-price/index.scss +6 -6
  19. package/components/hy-price/props.ts +4 -3
  20. package/components/hy-price/typing.d.ts +8 -4
  21. package/components/hy-slider/hy-slider.vue +4 -3
  22. package/components/hy-submitBar/Index.vue +17 -0
  23. package/components/hy-submitBar/hy-submitBar.vue +216 -0
  24. package/components/hy-submitBar/index.scss +9 -0
  25. package/components/hy-submitBar/props.ts +22 -0
  26. package/components/hy-submitBar/typing.d.ts +88 -0
  27. package/components/hy-tag/hy-tag.vue +24 -6
  28. package/components/hy-tag/index.scss +3 -2
  29. package/components/hy-text/typing.d.ts +1 -1
  30. package/components/hy-toast/hy-toast.vue +175 -0
  31. package/components/hy-toast/index.scss +77 -0
  32. package/components/hy-toast/props.ts +3 -0
  33. package/components/hy-toast/typing.d.ts +38 -0
  34. package/components/hy-warn/hy-warn.vue +2 -21
  35. package/components/hy-waterfall/hy-waterfall.vue +168 -38
  36. package/components/hy-waterfall/index.scss +9 -75
  37. package/components/hy-waterfall/props.ts +4 -5
  38. package/components/hy-waterfall/typing.d.ts +5 -9
  39. package/composables/index.ts +1 -0
  40. package/composables/useShare.ts +27 -0
  41. package/config/color.ts +1 -1
  42. package/config/icon.ts +21 -1
  43. package/index.ts +9 -8
  44. package/package.json +3 -2
  45. package/typing/index.ts +1 -1
  46. package/typing/modules/common.d.ts +21 -1
  47. package/utils/inspect.ts +50 -1
  48. package/utils/utils.ts +9 -7
@@ -0,0 +1,19 @@
1
+ import type IProps from "./typing";
2
+
3
+ const defaultProps: IProps = {
4
+ content: "",
5
+ copyLink: "",
6
+ domain: "",
7
+ errorImg: "",
8
+ lazyLoad: false,
9
+ loadingImg: "",
10
+ pauseVideo: true,
11
+ previewImg: true,
12
+ scrollTable: false,
13
+ selectable: false,
14
+ setTitle: true,
15
+ showImgMenu: true,
16
+ useAnchor: false,
17
+ };
18
+
19
+ export default defaultProps;
@@ -0,0 +1,68 @@
1
+ import type { CSSProperties } from "vue";
2
+
3
+ export default interface IProps {
4
+ /**
5
+ * @description 用于渲染的 html 字符串
6
+ * */
7
+ content?: string;
8
+ /**
9
+ * @description 是否允许外部链接被点击时自动复制
10
+ * */
11
+ copyLink?: string;
12
+ /**
13
+ * @description 主域名,用于拼接链接
14
+ * */
15
+ domain?: string;
16
+ /**
17
+ * @description 图片出错时的占位图链接
18
+ * */
19
+ errorImg?: string;
20
+ /**
21
+ * @description 是否开启图片懒加载
22
+ * */
23
+ lazyLoad?: boolean;
24
+ /**
25
+ * @description 图片加载过程中的占位图链接
26
+ * */
27
+ loadingImg?: string;
28
+ /**
29
+ * @description 是否在播放一个视频时自动暂停其他视频
30
+ * */
31
+ pauseVideo?: boolean;
32
+ /**
33
+ * @description 是否允许图片被点击时自动预览
34
+ * */
35
+ previewImg?: boolean;
36
+ /**
37
+ * @description 是否给每个表格添加一个滚动层使其能单独横向滚动
38
+ * */
39
+ scrollTable?: boolean;
40
+ /**
41
+ * @description 是否开启长按复制
42
+ * */
43
+ selectable?: boolean;
44
+ /**
45
+ * @description 是否将 title 标签的内容设置到页面标题
46
+ * */
47
+ setTitle?: boolean;
48
+ /**
49
+ * @description 是否允许图片被长按时显示菜单
50
+ * */
51
+ showImgMenu?: boolean;
52
+ /**
53
+ * @description 是否使用锚点链接
54
+ * */
55
+ useAnchor?: boolean;
56
+ /**
57
+ * @description 标签的默认样式
58
+ * */
59
+ tagStyle?: CSSProperties;
60
+ /**
61
+ * @description 容器的样式
62
+ * */
63
+ containerStyle?: CSSProperties;
64
+ /**
65
+ * @description 定义需要用到的外部样式
66
+ * */
67
+ customStyle?: CSSProperties;
68
+ }
@@ -7,9 +7,7 @@
7
7
  <text class="hy-price__prefix">{{ symbol }}</text>
8
8
  <text
9
9
  class="hy-price__text"
10
- :style="[
11
- { 'font-size': `${Number(fontSize) + Number(fontSize) * 0.8}rpx` },
12
- ]"
10
+ :style="[{ 'font-size': addUnit(getPx(size) * ratio) }]"
13
11
  >{{ priceOne[0] }}
14
12
  </text>
15
13
  <text class="hy-price__decimal">
@@ -22,10 +20,10 @@
22
20
  import { computed, type CSSProperties, toRefs } from "vue";
23
21
  import defaultProps from "./props";
24
22
  import type IProps from "./typing";
25
- import { addUnit } from "../../utils";
23
+ import { addUnit, getPx } from "../../utils";
26
24
 
27
25
  const props = withDefaults(defineProps<IProps>(), defaultProps);
28
- const { text, textColor, weight, fontSize, slant, customStyle } = toRefs(props);
26
+ const { text, color, weight, size, slant, customStyle } = toRefs(props);
29
27
  const emit = defineEmits(["click"]);
30
28
 
31
29
  /**
@@ -33,13 +31,13 @@ const emit = defineEmits(["click"]);
33
31
  * */
34
32
  const priceStyle = computed<CSSProperties>(() => {
35
33
  const style: CSSProperties = {
36
- color: textColor.value,
34
+ color: color.value,
37
35
  fontWeight: weight.value,
38
36
  fontStyle: slant.value ? "oblique" : "",
39
- fontSize: addUnit(fontSize.value),
37
+ fontSize: addUnit(size.value),
40
38
  };
41
39
 
42
- return Object.assign(style, customStyle);
40
+ return Object.assign(style, customStyle.value);
43
41
  });
44
42
 
45
43
  /**
@@ -2,10 +2,10 @@
2
2
  font-size: 32rpx;
3
3
  font-weight: 500;
4
4
  margin-top: 5px;
5
- &__prefix {
6
- font-size: 24rpx;
7
- }
8
- &__decimal {
9
- font-size: 24rpx;
10
- }
5
+ //&__prefix {
6
+ // font-size: 24rpx;
7
+ //}
8
+ //&__decimal {
9
+ // font-size: 24rpx;
10
+ //}
11
11
  }
@@ -1,11 +1,12 @@
1
1
  import type IProps from "./typing";
2
2
 
3
3
  const defaultProps: IProps = {
4
- text: "0.00",
4
+ text: "",
5
5
  symbol: "¥",
6
+ ratio: 1.4,
6
7
  num: 2,
7
- textColor: "#FE3232",
8
- fontSize: 22,
8
+ color: "#FE3232",
9
+ size: 12,
9
10
  weight: 500,
10
11
  slant: false,
11
12
  };
@@ -9,6 +9,10 @@ export default interface IProps {
9
9
  * @description 金额符号(默认:¥)
10
10
  * */
11
11
  symbol?: string;
12
+ /**
13
+ * @description 比例大小(默认:1.4)
14
+ * */
15
+ ratio?: number;
12
16
  /**
13
17
  * @description 保留小数点后几位数(默认:2)
14
18
  * */
@@ -16,15 +20,15 @@ export default interface IProps {
16
20
  /**
17
21
  * @description 字体颜色(默认:#FE3232)
18
22
  * */
19
- textColor?: string;
23
+ color?: string;
20
24
  /**
21
- * @description 字体大小(默认:22
25
+ * @description 字体大小(默认:12
22
26
  * */
23
- fontSize?: string | number;
27
+ size?: string | number;
24
28
  /**
25
29
  * @description 字体粗细(默认:500)
26
30
  * */
27
- weight?: string | number;
31
+ weight?: number;
28
32
  /**
29
33
  * @description 是否倾斜(默认:false)
30
34
  * */
@@ -364,7 +364,7 @@ const updateValue = (value: number, drag: boolean, index: number = 1) => {
364
364
  width: width + "px",
365
365
  };
366
366
  // 移动期间无需过渡动画
367
- if (drag == true) {
367
+ if (drag) {
368
368
  barStyle_1.transition = "none";
369
369
  } else {
370
370
  // 非移动期间,删掉对过渡为空的声明,让css中的声明起效
@@ -421,9 +421,10 @@ const format = (value: number, index = 1): number => {
421
421
  return 0;
422
422
  }
423
423
  } else {
424
+ // 解决精度丢失
424
425
  return (
425
- Math.round(Math.max(min.value, Math.min(value, max.value)) / step.value) *
426
- step.value
426
+ Math.round(Math.max(min.value, Math.min(value, max.value)) / step.value) * 1000 *
427
+ step.value / 1000
427
428
  );
428
429
  }
429
430
  };
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <Hy-cell title="基础组件" :list="list_1"></Hy-cell>
3
+ <hy-cell title="表单组件" :list="list_2"></hy-cell>
4
+ <hy-cell title="布局组件" :list="list_3"></hy-cell>
5
+ <hy-cell title="反馈组件" :list="list_4"></hy-cell>
6
+ <hy-cell title="导航组件" :list="list_5"></hy-cell>
7
+ <hy-cell title="其他组件" :list="list_6"></hy-cell>
8
+ <hy-cell title="业务组件" :list="list_7"></hy-cell>
9
+ </template>
10
+
11
+ <script setup lang="ts">
12
+ import HyCell from "hy-app/components/hy-cell/hy-cell.vue";
13
+
14
+ import { list_1, list_2, list_3, list_4, list_5, list_6, list_7 } from "./index1";
15
+ </script>
16
+
17
+ <style lang="scss" scoped></style>
@@ -0,0 +1,216 @@
1
+ <template>
2
+ <view
3
+ :class="['hy-submit-bar', border && 'hy-border__top']"
4
+ :style="submitBarStyle"
5
+ >
6
+ <view class="hy-submit-bar__left">
7
+ <slot name="left">
8
+ <view
9
+ class="hy-submit-bar__left--item"
10
+ v-for="(item, i) in menus"
11
+ :key="i"
12
+ @tap="clickMenuFn(i)"
13
+ >
14
+ <HyIcon
15
+ :name="item.icon"
16
+ :label="item.text"
17
+ :color="iconColor"
18
+ :label-color="iconLabelColor"
19
+ labelPos="bottom"
20
+ space="7"
21
+ :size="20"
22
+ ></HyIcon>
23
+ <HyBadge
24
+ :value="item?.badge?.value"
25
+ :absolute="true"
26
+ :offset="item?.badge?.offset ?? [-5, 20]"
27
+ :isDot="item?.badge?.isDot"
28
+ :type="item?.badge?.type"
29
+ :color="item?.badge?.color"
30
+ :shape="item?.badge?.shape"
31
+ :numberType="item?.badge?.numberType"
32
+ :inverted="item?.badge?.inverted"
33
+ ></HyBadge>
34
+ </view>
35
+ </slot>
36
+ </view>
37
+ <view class="hy-submit-bar__right">
38
+ <slot name="right">
39
+ <view
40
+ class="hy-submit-bar__right--button"
41
+ v-if="showLeftBtn"
42
+ :style="leftBtnStyle"
43
+ @tap.stop="confirmClickFn(0)"
44
+ >
45
+ <HyLoading
46
+ :show="leftLoading"
47
+ size="13"
48
+ mode="circle"
49
+ :custom-style="{ marginRight: '10rpx' }"
50
+ ></HyLoading>
51
+ {{ leftBtnText }}
52
+ </view>
53
+ <view
54
+ class="hy-submit-bar__right--button"
55
+ v-if="showRightBtn"
56
+ :style="rightBtnStyle"
57
+ @tap.stop="confirmClickFn(1)"
58
+ >
59
+ <HyLoading
60
+ :show="rightLoading"
61
+ size="13"
62
+ mode="circle"
63
+ :custom-style="{ marginRight: '10rpx' }"
64
+ ></HyLoading>
65
+ {{ rightBtnText }}
66
+ </view>
67
+ </slot>
68
+ </view>
69
+ </view>
70
+ </template>
71
+
72
+ <script setup lang="ts">
73
+ import type IProps from "./typing";
74
+ import defaultProps from "./props";
75
+ import { computed, type CSSProperties, toRefs } from "vue";
76
+ import { debounce } from "../../utils";
77
+
78
+ // 组件
79
+ import HyIcon from "../hy-icon/hy-icon.vue";
80
+ import HyLoading from "../hy-loading/hy-loading.vue";
81
+ import HyBadge from "../hy-badge/hy-badge.vue";
82
+
83
+ const props = withDefaults(defineProps<IProps>(), defaultProps);
84
+ const {
85
+ fixed,
86
+ showLeftBtn,
87
+ showRightBtn,
88
+ leftBtnColor,
89
+ rightBtnColor,
90
+ shape,
91
+ textColor,
92
+ leftLoading,
93
+ rightLoading,
94
+ warn,
95
+ customStyle,
96
+ } = toRefs(props);
97
+ const emit = defineEmits(["click", "menuClick"]);
98
+
99
+ /**
100
+ * @description 整体样式
101
+ * */
102
+ const submitBarStyle = computed(() => {
103
+ const style: CSSProperties = {
104
+ bottom: 0,
105
+ };
106
+ if (fixed.value) style.position = "fixed";
107
+ return Object.assign(style, customStyle.value);
108
+ });
109
+
110
+ /**
111
+ * @description 左边按钮样式
112
+ * */
113
+ const leftBtnStyle = computed(() => {
114
+ const style: CSSProperties = {
115
+ background: leftBtnColor.value,
116
+ color: textColor.value,
117
+ };
118
+ if (!showRightBtn.value) {
119
+ style.flex = 1;
120
+ if (shape.value === "circle") {
121
+ style.borderRadius = "100px";
122
+ } else {
123
+ style.borderRadius = "2px";
124
+ }
125
+ } else {
126
+ if (shape.value === "circle") {
127
+ style.borderRadius = "100px 0 0 100px";
128
+ } else {
129
+ style.borderRadius = "2px 0 0 2px";
130
+ }
131
+ }
132
+ return style;
133
+ });
134
+
135
+ /**
136
+ * @description 右边按钮样式
137
+ * */
138
+ const rightBtnStyle = computed(() => {
139
+ const style: CSSProperties = {
140
+ background: rightBtnColor.value,
141
+ color: textColor.value,
142
+ };
143
+ if (!showLeftBtn.value) {
144
+ style.flex = 1;
145
+ if (shape.value === "circle") {
146
+ style.borderRadius = "100px";
147
+ } else {
148
+ style.borderRadius = "2px";
149
+ }
150
+ } else {
151
+ if (shape.value === "circle") {
152
+ style.borderRadius = "0 100px 100px 0";
153
+ } else {
154
+ style.borderRadius = "0 2px 2px 0";
155
+ }
156
+ }
157
+ return style;
158
+ });
159
+
160
+ /**
161
+ * @description 点击左边图标
162
+ * */
163
+ const clickMenuFn = (i: number) => {
164
+ emit("menuClick", i);
165
+ };
166
+
167
+ /**
168
+ * @description 点击按钮
169
+ * */
170
+ const confirmClickFn = debounce((i: number) => {
171
+ if (
172
+ (!leftLoading.value && !rightLoading.value) ||
173
+ (leftLoading.value && i !== 0) ||
174
+ (rightLoading.value && i !== 1)
175
+ ) {
176
+ emit("click", i);
177
+ }
178
+ }, warn.value);
179
+ </script>
180
+
181
+ <style lang="scss" scoped>
182
+ @import "../../theme.scss";
183
+ .hy-submit-bar {
184
+ display: flex;
185
+ background-color: #ffffff;
186
+ padding: $hy-border-margin-padding-base;
187
+ width: 100%;
188
+ box-sizing: border-box;
189
+ /*左边内容*/
190
+ &__left {
191
+ display: flex;
192
+ font-size: 20rpx;
193
+ flex: 1;
194
+ &--item {
195
+ margin: 0 $hy-border-margin-padding-base;
196
+ position: relative;
197
+ }
198
+ }
199
+
200
+ /*右边内容*/
201
+ &__right {
202
+ display: flex;
203
+ justify-content: flex-end;
204
+ font-size: 26rpx;
205
+ align-items: center;
206
+ width: 400rpx;
207
+ &--button {
208
+ padding: $hy-border-margin-padding-base $hy-border-margin-padding-lg;
209
+ color: #ffffff;
210
+ display: flex;
211
+ justify-content: center;
212
+ align-items: center;
213
+ }
214
+ }
215
+ }
216
+ </style>
@@ -0,0 +1,9 @@
1
+
2
+ .hy-overlay {
3
+ position: fixed;
4
+ top: 0;
5
+ left: 0;
6
+ width: 100%;
7
+ height: 100%;
8
+ background-color: rgba(0, 0, 0, 0.7);
9
+ }
@@ -0,0 +1,22 @@
1
+ import type IProps from "./typing";
2
+
3
+ const defaultProps: IProps = {
4
+ menus: [],
5
+ fixed: true,
6
+ border: true,
7
+ leftLoading: false,
8
+ rightLoading: false,
9
+ iconColor: "",
10
+ iconLabelColor: "#909193FF",
11
+ textColor: "",
12
+ showLeftBtn: true,
13
+ showRightBtn: true,
14
+ leftBtnText: "加入购物车",
15
+ rightBtnText: "立即购买",
16
+ leftBtnColor: "#ed3f14",
17
+ rightBtnColor: "#ff7900",
18
+ shape: "circle",
19
+ warn: 300,
20
+ };
21
+
22
+ export default defaultProps;
@@ -0,0 +1,88 @@
1
+ import type { CSSProperties } from "vue";
2
+ import type BadgeProps from "../hy-badge/props";
3
+
4
+ interface IconMenus {
5
+ /**
6
+ * @description icon图标
7
+ * */
8
+ icon: string;
9
+ /**
10
+ * @description 文本
11
+ * */
12
+ text: string;
13
+ /**
14
+ * @description 徽标值
15
+ * */
16
+ badge?: BadgeProps["badge"];
17
+ }
18
+
19
+ export default interface IProps {
20
+ /**
21
+ * @description 左边菜单栏
22
+ * */
23
+ menus?: IconMenus[];
24
+ /**
25
+ * @description 绝对定位
26
+ * */
27
+ fixed?: boolean;
28
+ /**
29
+ * @description 是否显示边框
30
+ * */
31
+ border?: boolean;
32
+ /**
33
+ * @description 加载左边按钮loading
34
+ * */
35
+ leftLoading?: boolean;
36
+ /**
37
+ * @description 加载右边按钮loading
38
+ * */
39
+ rightLoading?: boolean;
40
+ /**
41
+ * @description 左边icon的颜色
42
+ * */
43
+ iconColor?: string;
44
+ /**
45
+ * @description 左边文字的颜色
46
+ * */
47
+ iconLabelColor?: string;
48
+ /**
49
+ * @description 右边按钮文字颜色
50
+ * */
51
+ textColor?: string;
52
+ /**
53
+ * @description 显示左边按钮
54
+ * */
55
+ showLeftBtn?: boolean;
56
+ /**
57
+ * @description 显示右边按钮
58
+ * */
59
+ showRightBtn?: boolean;
60
+ /**
61
+ * @description 左边按钮文字
62
+ * */
63
+ leftBtnText?: string;
64
+ /**
65
+ * @description 右边按钮文字
66
+ * */
67
+ rightBtnText?: string;
68
+ /**
69
+ * @description 左边按钮颜色,支持渐变色
70
+ * */
71
+ leftBtnColor?: string;
72
+ /**
73
+ * @description 有边按钮颜色,支持渐变色
74
+ * */
75
+ rightBtnColor?: string;
76
+ /**
77
+ * @description 按钮的形状
78
+ * */
79
+ shape?: HyApp.ShapeType;
80
+ /**
81
+ * @description 按钮点击等待时长(运用了节流方法)
82
+ * */
83
+ warn?: number;
84
+ /**
85
+ * @description 定义需要用到的外部样式
86
+ * */
87
+ customStyle?: CSSProperties;
88
+ }
@@ -11,7 +11,7 @@
11
11
  :customStyle="{ marginRight: '3px' }"
12
12
  ></HyIcon>
13
13
  </slot>
14
- <text :class="textClass" :style="{ color: color }">
14
+ <text :class="textClass" :style="textStyle">
15
15
  <slot>
16
16
  {{ text }}
17
17
  </slot>
@@ -40,6 +40,7 @@ import type IProps from "./typing";
40
40
  import HyTransition from "../hy-transition/hy-transition.vue";
41
41
  import HyIcon from "../hy-icon/hy-icon.vue";
42
42
  import { IconConfig } from "../../config";
43
+ import {colorGradient} from "@/package";
43
44
 
44
45
  const props = withDefaults(defineProps<IProps>(), defaultProps);
45
46
  const {
@@ -84,16 +85,33 @@ const tagStyle = computed<CSSProperties>(() => {
84
85
  const style: CSSProperties = {
85
86
  marginRight: closable.value ? "10px" : 0,
86
87
  marginTop: closable.value ? "10px" : 0,
88
+ background: bgColor.value,
89
+ borderColor: borderColor.value
87
90
  };
88
- if (bgColor.value) {
89
- style.background = bgColor.value;
90
- }
91
- if (borderColor.value) {
92
- style.borderColor = borderColor.value;
91
+
92
+ if(color.value) {
93
+ if (plain.value) {
94
+ style.borderColor = color.value;
95
+ if(plainFill.value) {
96
+ style.background = colorGradient(color.value, "#FFFFFF", 100)[90];
97
+ }
98
+ } else {
99
+ style.background = color.value;
100
+ style.borderColor = color.value;
101
+ }
93
102
  }
103
+
94
104
  return Object.assign(style, customStyle.value);
95
105
  });
96
106
 
107
+ /**
108
+ * @description 文本样式
109
+ * */
110
+ const textStyle = computed(() => {
111
+ const style: CSSProperties = {}
112
+ if(color.value && plain.value) style.color = color.value;
113
+ return style;
114
+ })
97
115
  /**
98
116
  * @description 文本类名
99
117
  * */
@@ -2,12 +2,13 @@
2
2
  @use "../../libs/css/mixin.scss" as *;
3
3
 
4
4
  .hy-tag {
5
+ border-style: solid;
5
6
  @include flex;
6
7
  align-items: center;
7
- border-style: solid;
8
-
9
8
  &__wrapper {
9
+ @include flex;
10
10
  position: relative;
11
+ box-sizing: border-box;
11
12
  }
12
13
 
13
14
  /*禁用*/
@@ -82,7 +82,7 @@ export default interface IProps {
82
82
  /**
83
83
  * @description 文本对齐方式,可选值left|center|right(默认 'left' )
84
84
  * */
85
- align?: HyApp.CenterType;
85
+ align?: HyApp.RowCenterType;
86
86
  /**
87
87
  * @description 文字换行,可选值break-word|normal|anywhere(默认 'normal' )
88
88
  * */