hy-app 0.2.2 → 0.2.5

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 (62) hide show
  1. package/components/hy-button/hy-button.vue +88 -120
  2. package/components/hy-button/index.scss +1 -3
  3. package/components/hy-calendar/index.scss +1 -1
  4. package/components/hy-cell/index.scss +2 -17
  5. package/components/hy-checkbox/index.scss +10 -10
  6. package/components/hy-code-input/hy-code-input.vue +85 -74
  7. package/components/hy-code-input/index.scss +31 -1
  8. package/components/hy-code-input/props.ts +8 -7
  9. package/components/hy-code-input/typing.d.ts +22 -18
  10. package/components/hy-config-provider/props.ts +1 -1
  11. package/components/hy-config-provider/typing.d.ts +7 -7
  12. package/components/hy-dropdown-item/hy-dropdown-item.vue +69 -75
  13. package/components/hy-dropdown-item/index.scss +1 -1
  14. package/components/hy-float-button/hy-float-button.vue +69 -86
  15. package/components/hy-form/index.scss +1 -1
  16. package/components/hy-grid/hy-grid.vue +2 -3
  17. package/components/hy-grid/props.ts +4 -0
  18. package/components/hy-grid/typing.d.ts +15 -0
  19. package/components/hy-icon/index.scss +2 -2
  20. package/components/hy-login/TheUserLogin.vue +0 -1
  21. package/components/hy-menu/hy-menu.vue +159 -0
  22. package/components/hy-menu/index.scss +58 -0
  23. package/components/hy-menu/props.ts +12 -0
  24. package/components/hy-menu/typing.d.ts +57 -0
  25. package/components/hy-navbar/index.scss +2 -2
  26. package/components/hy-notice-bar/index.scss +3 -3
  27. package/components/hy-notify/typing.d.ts +1 -1
  28. package/components/hy-pagination/typing.d.ts +1 -1
  29. package/components/hy-picker/hy-picker.vue +9 -8
  30. package/components/hy-picker/index.scss +6 -2
  31. package/components/hy-radio/index.scss +2 -2
  32. package/components/hy-scroll-list/index.scss +1 -1
  33. package/components/hy-signature/hy-signature.vue +50 -50
  34. package/components/hy-signature/index.scss +2 -4
  35. package/components/hy-signature/props.ts +2 -1
  36. package/components/hy-signature/typing.d.ts +5 -1
  37. package/components/hy-subsection/hy-subsection.vue +15 -13
  38. package/components/hy-subsection/props.ts +2 -2
  39. package/components/hy-subsection/typing.d.ts +1 -1
  40. package/components/hy-tabBar/hy-tabBar.vue +96 -0
  41. package/components/hy-tabBar/index.scss +169 -0
  42. package/components/hy-tabBar/props.ts +13 -0
  43. package/components/hy-tabBar/typing.d.ts +54 -0
  44. package/components/hy-text/hy-text.vue +76 -87
  45. package/components/hy-text/index.scss +8 -8
  46. package/components/hy-upload/index.scss +0 -1
  47. package/components/hy-watermark/hy-watermark.vue +583 -0
  48. package/components/hy-watermark/index.scss +17 -0
  49. package/components/hy-watermark/props.ts +23 -0
  50. package/components/hy-watermark/typing.d.ts +76 -0
  51. package/components/index.ts +2 -2
  52. package/index.scss +1 -1
  53. package/index.ts +1 -1
  54. package/libs/css/common.scss +9 -1
  55. package/libs/css/vars.css +5 -1
  56. package/package.json +2 -2
  57. package/theme.scss +8 -18
  58. package/typing/modules/common.d.ts +1 -1
  59. package/utils/inspect.ts +20 -0
  60. package/utils/utils.ts +52 -22
  61. package/components/yk-tabbar/props.ts +0 -49
  62. package/components/yk-tabbar/yk-tabbar.vue +0 -224
package/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from "./common";
2
2
  export * from "./utils";
3
3
  export * from "./store";
4
- export * from "./components";
4
+ // export * from "./components";
5
5
  export * from "./global";
6
6
  export * from "./typing";
7
7
  export * from "./api";
@@ -22,4 +22,12 @@
22
22
  height: 100vh;
23
23
  /* #endif */
24
24
  overflow: auto;
25
- }
25
+ }
26
+
27
+ /* 解决滚动时候出现滚动条 */
28
+ ::-webkit-scrollbar{
29
+ width: 0;
30
+ height: 0;
31
+ color: transparent;
32
+ display:none;
33
+ }
package/libs/css/vars.css CHANGED
@@ -13,10 +13,12 @@
13
13
  --hy-background: #f8f8f8;
14
14
  --hy-background--2: #FFFFFF;
15
15
  --hy-background--3: rgb(238, 238, 239);
16
+ --hy-background--track: #F6F6F6;
16
17
  --hy-background--container: #FFFFFF;
17
18
  --hy-background--disabled: rgba(0, 0, 0, 0.04);
18
19
  --hy-background--empty: #F3F3F3;
19
- --hy-background--hover: rgba(0,0,0,0.2);
20
+ --hy-background--hover: rgba(0,0,0,0.05);
21
+ --hy-background--active: #FFFFFF;
20
22
 
21
23
  --hy-border-line: 1rpx solid #c2c2c4;
22
24
  --hy-border-color: #c2c2c4;
@@ -42,10 +44,12 @@
42
44
  --hy-background: #1b1b1f;
43
45
  --hy-background--2: #161616;
44
46
  --hy-background--3: #646566;
47
+ --hy-background--track: #3A3A44;
45
48
  --hy-background--container: #242424;
46
49
  --hy-background--disabled: rgba(255, 255, 255, 0.08);
47
50
  --hy-background--empty: #3A3A44;
48
51
  --hy-background--hover: rgba(255,255,255,0.2);
52
+ --hy-background--active: #000000;
49
53
 
50
54
  --hy-border-line: 1rpx solid #3c3f44;
51
55
  --hy-border-color: #3c3f44;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hy-app",
3
- "version": "0.2.2",
4
- "description": "添加签名、分页组件",
3
+ "version": "0.2.5",
4
+ "description": "修复在微信小程序线上bug",
5
5
  "main": "./index.ts",
6
6
  "private": false,
7
7
  "scripts": {},
package/theme.scss CHANGED
@@ -43,26 +43,16 @@ $hy-background--2: var(--hy-background--2, #ffffff) !default; // 弹窗背景色
43
43
  $hy-background--3: var(--hy-background--3, #646566) !default; // 弹窗背景色
44
44
  $hy-background--container: var(--hy-background--container, #ffffff) !default; // 容器背景色
45
45
  $hy-background--disabled: var(--hy-background--disabled, #F5F5F5); // 禁用背景色
46
- $hy-background--track: var(--hy-background--track, #c6c7cb) !default;
47
- $hy-background--empty: var(--hy-background--empty, #f6f6f7) !default; // 搜索背景色
48
- $hy-background--hover: var(--hy-background--hover, #707070) !default; // 点击状态
46
+ $hy-background--track: var(--hy-background--track, #F6F6F6) !default; // 轨道背景色
47
+ $hy-background--empty: var(--hy-background--empty, #F3F3F3) !default; // 搜索背景色
48
+ $hy-background--hover: var(--hy-background--hover, rgba(0,0,0,0.1)) !default; // 点击状态
49
49
  $hy-light-background-mask: var(--hy-light-background-mask, rgba(0, 0, 0, 0.5)); //遮罩颜色
50
+ $hy-background--active: var(--hy-background--active, #131313); // 选中背景色
50
51
 
51
52
  /* 文字尺寸 */
52
- $hy-font-size-sm: 12px;
53
- $hy-font-size-base: 16px;
54
- $hy-font-size-lg: 20px;
55
-
56
- /* 文章场景相关 */
57
- $hy-color-title: #2c405a; // 文章标题颜色
58
- $hy-weight-title: 700;
59
- $hy-font-size-title: 44rpx;
60
- $hy-color-subtitle: #555555; // 二级标题颜色
61
- $hy-font-size-subtitle: 38rpx;
62
- $hy-color-paragraph: #3f536e; // 文章段落颜色
63
- $hy-font-size-paragraph: 32rpx;
64
- $hy-color-hint: #999; // 提示文字
65
- $hy-font-size-hint: 26rpx;
53
+ $hy-font-size-sm: 24rpx; // 提示文字大小
54
+ $hy-font-size-base: 32rpx; // 基本文字大小
55
+ $hy-font-size-lg: 40rpx; // 标题文字大小
66
56
 
67
57
 
68
58
  /* 边框颜色 */
@@ -97,4 +87,4 @@ $hy-border-margin-padding-sm: var(--hy-border-margin-padding-sm, 10rpx) !default
97
87
  $hy-border-margin-padding-base: var(--hy-border-margin-padding-base, 20rpx) !default;
98
88
  $hy-border-margin-padding-lg: var(--hy-border-margin-padding-lg, 30rpx) !default;
99
89
  /* 底部线条 */
100
- $hy-border-line: var(--hy-border-line, 1rpx solid #c2c2c4) !default;
90
+ $hy-border-line: var(--hy-border-line, 1px solid #c2c2c4) !default;
@@ -127,7 +127,7 @@ declare namespace HyApp {
127
127
  /**
128
128
  * @description 自定义columns的文本键
129
129
  * */
130
- label: string;
130
+ name: string;
131
131
  /**
132
132
  * @description 自定义columns的值键
133
133
  * */
package/utils/inspect.ts CHANGED
@@ -113,3 +113,23 @@ export const isChinese = (zh: string): boolean => {
113
113
  const reg = /^[\u4e00-\u9fa5]+$/gi;
114
114
  return reg.test(zh);
115
115
  };
116
+
117
+ /**
118
+ * 是否为base64图片
119
+ * @param {string} url
120
+ * @return
121
+ */
122
+ export function isBase64Image(url: string) {
123
+ // 使用正则表达式检查URL是否以"data:image"开头,这是Base64图片的常见前缀
124
+ return /^data:image\/(png|jpg|jpeg|gif|bmp);base64,/.test(url);
125
+ }
126
+
127
+ /**
128
+ * 是否图片
129
+ * @param {string} url
130
+ * @return
131
+ */
132
+ export function isImage(url: string) {
133
+ // 使用正则表达式检查URL是否以"data:image"开头,这是Base64图片的常见前缀
134
+ return /(\.jpg|\.jpeg|\.png|\.gif|\.bmp|\.webp)$/i.test(url);
135
+ }
package/utils/utils.ts CHANGED
@@ -364,7 +364,10 @@ const random = (min: number | string, max: number | string): number => {
364
364
  const range = (min = 0, max = 0, value = 0) => {
365
365
  return Math.max(min, Math.min(max, Number(value)));
366
366
  };
367
- let instance: any;
367
+
368
+ export type RectResultType<T extends boolean> = T extends true
369
+ ? UniApp.NodeInfo[]
370
+ : UniApp.NodeInfo;
368
371
  /**
369
372
  * 查询节点信息
370
373
  * 目前此方法在支付宝小程序中无法获取组件跟接点的尺寸,为支付宝的bug(2020-07-21)
@@ -372,32 +375,59 @@ let instance: any;
372
375
  * @param selector 元素类名或id
373
376
  * @param all 是否获取多个相同元素数值
374
377
  * @param ins 在微信小程序里,因为utils文件里面获取不到instance值所以必须通过ins这个传过来
378
+ * @param useFields 是否使用 fields 方法获取节点信息
375
379
  */
376
380
  const getRect = (
377
381
  selector: string,
378
- all?: boolean,
382
+ all?: T,
379
383
  ins?: any,
380
- ): Promise<UniApp.NodeInfo | UniApp.NodeInfo[]> => {
381
- return new Promise((resolve) => {
384
+ useFields?: boolean,
385
+ ): Promise<RectResultType<T>> => {
386
+ return new Promise<RectResultType<T>>((resolve, reject) => {
387
+ let query: UniNamespace.SelectorQuery | null = null;
382
388
  // TODO: 在微信小程序里,因为utils文件里面获取不到instance值所以必须通过ins这个传过来
383
- // #ifdef MP-WEIXIN
384
- instance = ins;
385
- // #endif
386
- // #ifndef APP-NVUE
387
- uni
388
- .createSelectorQuery()
389
- .in(instance)
390
- [all ? "selectAll" : "select"](selector)
391
- .boundingClientRect((rect) => {
392
- if (all && Array.isArray(rect) && rect.length) {
393
- resolve(rect as UniApp.NodeInfo[]);
394
- }
395
- if (!all && rect) {
396
- resolve(rect as UniApp.NodeInfo);
397
- }
398
- })
399
- .exec();
400
- // #endif
389
+ if (ins) {
390
+ query = uni.createSelectorQuery().in(ins);
391
+ } else {
392
+ query = uni.createSelectorQuery();
393
+ }
394
+ const method = all ? "selectAll" : "select";
395
+
396
+ const callback = (rect: UniApp.NodeInfo | UniApp.NodeInfo[]) => {
397
+ if (all && Array.isArray(rect) && rect.length > 0) {
398
+ resolve(rect as RectResultType<T>);
399
+ } else if (!all && rect) {
400
+ resolve(rect as RectResultType<T>);
401
+ } else {
402
+ reject(new Error("No nodes found"));
403
+ }
404
+ };
405
+
406
+ if (useFields) {
407
+ query[method](selector)
408
+ .fields({ size: true, node: true }, callback)
409
+ .exec();
410
+ } else {
411
+ query[method](selector).boundingClientRect(callback).exec();
412
+ }
413
+ // // #ifdef MP-WEIXIN
414
+ // instance = ins;
415
+ // // #endif
416
+ // // #ifndef APP-NVUE
417
+ // uni
418
+ // .createSelectorQuery()
419
+ // .in(instance)
420
+ // [all ? "selectAll" : "select"](selector)
421
+ // .boundingClientRect((rect) => {
422
+ // if (all && Array.isArray(rect) && rect.length) {
423
+ // resolve(rect as UniApp.NodeInfo[]);
424
+ // }
425
+ // if (!all && rect) {
426
+ // resolve(rect as UniApp.NodeInfo);
427
+ // }
428
+ // })
429
+ // .exec();
430
+ // // #endif
401
431
  });
402
432
  };
403
433
 
@@ -1,49 +0,0 @@
1
- export default {
2
- /**
3
- * tab当前值
4
- * */
5
- current: 0,
6
- /**
7
- * 文字颜色
8
- * */
9
- textColor: "#FFFFFF",
10
- /**
11
- * 底部导航栏背景颜色
12
- * 支持渐变色--linear-gradient(155deg, #192b6e, #a6307c)
13
- * */
14
- bgColor: "linear-gradient(155deg, #192b6e, #a6307c)",
15
- /**
16
- * 点击突出按钮的背景颜色
17
- * 支持渐变色--linear-gradient(0deg, #ffa576,#0951eb)
18
- * */
19
- activeColor: "linear-gradient(0deg, #ffa576,#0951eb)",
20
- /**
21
- * 导航栏值
22
- * {
23
- * key: 唯一建值,
24
- * label: 中文名,
25
- * icon: uview-plus里面的矢量图标库
26
- * iconUrl: 图片地址
27
- * }
28
- * */
29
- list: [
30
- {
31
- key: 0,
32
- label: "首页",
33
- icon: "home",
34
- iconUrl: ""
35
- },
36
- {
37
- key: 1,
38
- label: "工具栏",
39
- icon: "grid",
40
- iconUrl: ""
41
- },
42
- {
43
- key: 2,
44
- label: "我的",
45
- icon: "account",
46
- iconUrl: ""
47
- }
48
- ]
49
- }
@@ -1,224 +0,0 @@
1
- <template>
2
- <view class="placeholder-view"></view>
3
- <view class="bg">
4
- <view class="custom-tabbar" :style="{'background': props.bgColor}">
5
- <view class="ul">
6
- <view :class="['li', 'list', current === item.key ? 'active' : '']" v-for="item in props.list" :key="item.key" @click="checkItem(item.key)">
7
- <view class="bar">
8
- <view class="icon">
9
- <!-- <text-->
10
- <!-- :class="['t-icon', `custom-t-icon-${item.icon}`]"-->
11
- <!-- ></text>-->
12
- <image
13
- v-if="item.iconUrl"
14
- :src="item.iconUrl"
15
- style="height: 25px; width: 25px"
16
- ></image>
17
- <u-icon v-else :name="item.icon" :color="props.textColor" size="25"></u-icon>
18
- </view>
19
- <text class="text" :style="['color:' + props.textColor]">{{ item.label }}</text>
20
- <text class="circle"></text>
21
- </view>
22
- </view>
23
- <view
24
- class="indicator"
25
- :style="{
26
- '--num': `translateX(calc(((100vw - 110rpx - ${props.list.length} * 70rpx) / ${props.list.length - 1} + 70rpx) * ${current}))`,
27
- 'background': activeColor
28
- }"
29
- ></view>
30
- </view>
31
- </view>
32
- </view>
33
- </template>
34
-
35
- <script setup lang="ts">
36
- import { ref, reactive, watch } from "vue";
37
- import prop from "./props";
38
-
39
- interface IProps {
40
- current: number;
41
- textColor?: string;
42
- bgColor?: string;
43
- activeColor?: string;
44
- list: () => ([]);
45
- }
46
- const props = withDefaults(defineProps<IProps>(),{...prop})
47
- const emit = defineEmits(['clickTab'])
48
-
49
- const current = ref(0);
50
- watch(
51
- () => props.current,
52
- (newVal) => {
53
- current.value = newVal
54
- }
55
- )
56
-
57
- const checkItem = (index: number) => {
58
- current.value = index;
59
- emit("clickTab", index)
60
- }
61
- </script>
62
-
63
- <style lang="scss" scoped>
64
- .placeholder-view {
65
- height: 135rpx;
66
- }
67
- .bg {
68
- background: #F8F8F8;
69
- height: 135rpx;
70
- z-index: 999;
71
- position: fixed;
72
- bottom: 0;
73
- }
74
- .custom-tabbar {
75
- margin-top: 15rpx;
76
- position: relative;
77
- width: 100vw;
78
- height: 120rpx;
79
- display: flex;
80
- justify-content: center;
81
- align-items: center;
82
- border-radius: 15rpx 15rpx 0 0;
83
- padding: 0 20rpx;
84
- /* #ifndef APP-PLUS-NVUE */
85
- box-sizing: border-box;
86
- /* #endif */
87
- .ul {
88
- width: 100%;
89
- display: flex;
90
- justify-content: space-between;
91
- align-items: center;
92
- padding: 0 20rpx;
93
- .li {
94
- position: relative;
95
- width: 100rpx;
96
- height: 70rpx;
97
- z-index: 1;
98
- .bar {
99
- position: relative;
100
- display: flex;
101
- justify-content: center;
102
- align-items: center;
103
- flex-direction: column;
104
- width: 100%;
105
- text-align: center;
106
- font-weight: 500;
107
- .icon {
108
- /* #ifndef APP-PLUS-NVUE */
109
- transition: .5s;
110
- /* #endif */
111
- }
112
- .text {
113
- position: absolute;
114
- font-weight: 400;
115
- font-size: .75em;
116
- /* #ifndef APP-PLUS-NVUE */
117
- letter-spacing: .05em;
118
- transition: .5s;
119
- /* #endif */
120
- transform: translateY(20px) scale(0);
121
- }
122
- .circle {
123
- position: absolute;
124
- /* #ifndef APP-PLUS-NVUE */
125
- display: block;
126
- /* #endif */
127
- width: 75rpx;
128
- height: 75rpx;
129
- background: transparent;
130
- border-radius: 50%;
131
- border: 3rpx solid #fff;
132
- transform: translateY(-70rpx) scale(0);
133
- }
134
- }
135
-
136
- &.active {
137
- .bar {
138
- .icon {
139
- transform: translate(2rpx, -56rpx);
140
- }
141
- .text {
142
- opacity: 1;
143
- transform: translateY(20rpx);
144
- }
145
- .circle {
146
- /* #ifndef APP-PLUS-NVUE */
147
- margin: 0 auto;
148
- transition: .5s;
149
- /* #endif */
150
- transition-delay: .5s;
151
- transform: translate(2rpx, -56rpx) scale(1);
152
- }
153
- }
154
- }
155
- }
156
- }
157
- }
158
-
159
- .indicator {
160
- position: absolute;
161
- top: -59%;
162
- left: 30rpx;
163
- width: 100rpx;
164
- height: 100rpx;
165
- border: 12rpx solid #F8F8F8;
166
- border-radius: 50%;
167
- display: flex;
168
- justify-content: center;
169
- align-items: center;
170
- /* #ifndef APP-PLUS-NVUE */
171
- transition: .5s;
172
- /* #endif */
173
- }
174
-
175
- .indicator::before {
176
- /* #ifndef APP-PLUS-NVUE */
177
- content: '';
178
- /* #endif */
179
- position: absolute;
180
- top: 59%;
181
- left: -45rpx;
182
- width: 50rpx;
183
- height: 40rpx;
184
- background: transparent;
185
- border-top-right-radius: 20px;
186
- box-shadow: 1px -15rpx 0 #F8F8F8;
187
- }
188
-
189
- .indicator::after {
190
- /* #ifndef APP-PLUS-NVUE */
191
- content: '';
192
- /* #endif */
193
- position: absolute;
194
- top: 58%;
195
- right: -49rpx;
196
- width: 50rpx;
197
- height: 40rpx;
198
- background: transparent;
199
- border-top-left-radius: 40rpx;
200
- box-shadow: -1px -15rpx 0 #F8F8F8;
201
- }
202
-
203
- /* #ifndef APP-PLUS-NVUE */
204
- .custom-tabbar .ul .li:nth-child(1).active~.indicator {
205
- transform: var(--num);
206
- }
207
-
208
- .custom-tabbar .ul .li:nth-child(2).active~.indicator {
209
- transform: var(--num);
210
- }
211
-
212
- .custom-tabbar .ul .li:nth-child(3).active~.indicator {
213
- transform: var(--num);
214
- }
215
-
216
- .custom-tabbar .ul .li:nth-child(4).active~.indicator {
217
- transform: var(--num);
218
- }
219
-
220
- .custom-tabbar .ul .li:nth-child(5).active~.indicator {
221
- transform: var(--num);
222
- }
223
- /* #endif */
224
- </style>