hy-app 0.2.2 → 0.2.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 (43) hide show
  1. package/components/hy-button/index.scss +1 -3
  2. package/components/hy-cell/index.scss +0 -15
  3. package/components/hy-code-input/hy-code-input.vue +2 -1
  4. package/components/hy-code-input/typing.d.ts +1 -1
  5. package/components/hy-config-provider/props.ts +1 -1
  6. package/components/hy-grid/hy-grid.vue +2 -3
  7. package/components/hy-grid/props.ts +4 -0
  8. package/components/hy-grid/typing.d.ts +15 -0
  9. package/components/hy-icon/index.scss +2 -2
  10. package/components/hy-login/TheUserLogin.vue +0 -1
  11. package/components/hy-menu/hy-menu.vue +159 -0
  12. package/components/hy-menu/index.scss +58 -0
  13. package/components/hy-menu/props.ts +12 -0
  14. package/components/hy-menu/typing.d.ts +57 -0
  15. package/components/hy-notify/typing.d.ts +1 -1
  16. package/components/hy-pagination/typing.d.ts +1 -1
  17. package/components/hy-signature/hy-signature.vue +50 -50
  18. package/components/hy-signature/index.scss +2 -4
  19. package/components/hy-signature/props.ts +2 -1
  20. package/components/hy-signature/typing.d.ts +5 -1
  21. package/components/hy-subsection/hy-subsection.vue +15 -13
  22. package/components/hy-subsection/props.ts +2 -2
  23. package/components/hy-subsection/typing.d.ts +1 -1
  24. package/components/hy-tabBar/hy-tabBar.vue +96 -0
  25. package/components/hy-tabBar/index.scss +169 -0
  26. package/components/hy-tabBar/props.ts +13 -0
  27. package/components/hy-tabBar/typing.d.ts +54 -0
  28. package/components/hy-text/index.scss +2 -2
  29. package/components/hy-upload/index.scss +0 -1
  30. package/components/hy-watermark/hy-watermark.vue +603 -0
  31. package/components/hy-watermark/index.scss +15 -0
  32. package/components/hy-watermark/props.ts +23 -0
  33. package/components/hy-watermark/typing.d.ts +76 -0
  34. package/components/index.ts +2 -2
  35. package/index.ts +1 -1
  36. package/libs/css/vars.css +5 -1
  37. package/package.json +2 -2
  38. package/theme.scss +4 -3
  39. package/typing/modules/common.d.ts +1 -1
  40. package/utils/inspect.ts +20 -0
  41. package/utils/utils.ts +52 -22
  42. package/components/yk-tabbar/props.ts +0 -49
  43. package/components/yk-tabbar/yk-tabbar.vue +0 -224
@@ -0,0 +1,76 @@
1
+ import type { CSSProperties } from "vue";
2
+
3
+ export default interface HyOverlayProps {
4
+ /**
5
+ * @description 显示内容
6
+ * */
7
+ content?: string;
8
+ /**
9
+ * @description 显示图片的地址,支持网络图片和base64(钉钉小程序仅支持网络图片)
10
+ * */
11
+ image?: string;
12
+ /**
13
+ * @description 图片高度
14
+ * */
15
+ imageHeight?: number;
16
+ /**
17
+ * @description 图片高度
18
+ * */
19
+ imageWidth?: number;
20
+ /**
21
+ * @description X轴间距,单位px
22
+ * */
23
+ gutterX?: number;
24
+ /**
25
+ * @description Y轴间距,单位px
26
+ * */
27
+ gutterY?: number;
28
+ /**
29
+ * @description canvas画布宽度,单位px
30
+ * */
31
+ width?: number;
32
+ /**
33
+ * @description canvas画布高度,单位px
34
+ * */
35
+ height?: number;
36
+ /**
37
+ * @description 是否为全屏水印
38
+ * */
39
+ fullScreen?: boolean;
40
+ /**
41
+ * @description 水印字体颜色
42
+ * */
43
+ color?: string;
44
+ /**
45
+ * @description 水印字体大小,单位px
46
+ * */
47
+ size?: number;
48
+ /**
49
+ * @description 水印字体样式(仅微信和h5支持),可能的值:normal、italic、oblique
50
+ * */
51
+ fontStyle?: string;
52
+ /**
53
+ * @description 水印字体的粗细(仅微信和h5支持)
54
+ * */
55
+ fontWeight?: string;
56
+ /**
57
+ * @description 水印字体系列(仅微信和h5支持)
58
+ * */
59
+ fontFamily?: string;
60
+ /**
61
+ * @description 水印旋转角度
62
+ * */
63
+ rotate?: number;
64
+ /**
65
+ * @description 自定义层级
66
+ * */
67
+ zIndex?: number;
68
+ /**
69
+ * @description 自定义透明度,取值 0~1
70
+ * */
71
+ opacity?: number;
72
+ /**
73
+ * @description 定义需要用到的外部样式
74
+ * */
75
+ customStyle?: CSSProperties;
76
+ }
@@ -1,4 +1,4 @@
1
- import YkTabbar from "./yk-tabbar/yk-tabbar.vue";
1
+ import HyTabBr from "./hy-tabBar/hy-tabBar.vue";
2
2
  import Dialog from "./dialog";
3
3
  /* #ifdef H5 */
4
4
  import DialogService from "./message";
@@ -63,7 +63,7 @@ import HyUpload from "./hy-upload/hy-upload.vue";
63
63
  import HyWarn from "./hy-warn/hy-warn.vue";
64
64
 
65
65
  const install = (Vue: any) => {
66
- Vue.component("yk-tabbar", YkTabbar);
66
+ Vue.component("hy-tabBar", HyTabBr);
67
67
 
68
68
  Vue.component("HyAddressPicker", HyAddressPicker);
69
69
  Vue.component("HyAvatar", HyAvatar);
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";
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.4",
4
+ "description": "新增组件:分页、签名面板、水印、验证码输入、侧边菜单栏",
5
5
  "main": "./index.ts",
6
6
  "private": false,
7
7
  "scripts": {},
package/theme.scss CHANGED
@@ -43,10 +43,11 @@ $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
53
  $hy-font-size-sm: 12px;
@@ -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>