hy-app 0.2.1 → 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.
- package/components/hy-button/index.scss +2 -0
- package/components/hy-cell/index.scss +0 -15
- package/components/hy-code-input/hy-code-input.vue +224 -0
- package/components/hy-code-input/index.scss +108 -0
- package/components/hy-code-input/props.ts +21 -0
- package/components/hy-code-input/typing.d.ts +65 -0
- package/components/hy-config-provider/hy-config-provider.vue +0 -1
- package/components/hy-config-provider/props.ts +1 -1
- package/components/hy-dropdown/props.ts +1 -1
- package/components/hy-dropdown-item/hy-dropdown-item.vue +2 -5
- package/components/hy-dropdown-item/index.scss +11 -13
- package/components/hy-grid/hy-grid.vue +7 -8
- package/components/hy-grid/props.ts +4 -0
- package/components/hy-grid/typing.d.ts +15 -0
- package/components/hy-icon/index.scss +2 -1
- package/components/hy-login/TheUserLogin.vue +0 -1
- package/components/hy-menu/hy-menu.vue +159 -0
- package/components/hy-menu/index.scss +58 -0
- package/components/hy-menu/props.ts +12 -0
- package/components/hy-menu/typing.d.ts +57 -0
- package/components/hy-modal/hy-modal.vue +5 -5
- package/components/hy-modal/index.scss +0 -6
- package/components/hy-notify/hy-notify.vue +169 -0
- package/components/hy-notify/index.scss +25 -0
- package/components/hy-notify/props.ts +14 -0
- package/components/hy-notify/typing.d.ts +44 -0
- package/components/hy-pagination/hy-pagination.vue +125 -0
- package/components/hy-pagination/index.scss +46 -0
- package/components/hy-pagination/props.ts +15 -0
- package/components/hy-pagination/typing.d.ts +44 -0
- package/components/hy-picker/index.scss +4 -0
- package/components/hy-scroll-list/index.scss +1 -1
- package/components/hy-search/index.scss +1 -2
- package/components/hy-signature/canvasHelper.ts +51 -0
- package/components/hy-signature/hy-signature.vue +656 -0
- package/components/hy-signature/index.scss +29 -0
- package/components/hy-signature/props.ts +29 -0
- package/components/hy-signature/typing.d.ts +181 -0
- package/components/hy-slider/index.scss +5 -1
- package/components/hy-subsection/hy-subsection.vue +15 -13
- package/components/hy-subsection/props.ts +2 -2
- package/components/hy-subsection/typing.d.ts +1 -1
- package/components/hy-swipe-action/hy-swipe-action.vue +288 -248
- package/components/hy-swipe-action/index.scss +34 -0
- package/components/hy-swipe-action/index.ts +34 -0
- package/components/hy-swipe-action/props.ts +15 -9
- package/components/hy-swipe-action/typing.d.ts +20 -22
- package/components/hy-swiper/index.scss +5 -0
- package/components/hy-tabBar/hy-tabBar.vue +96 -0
- package/components/hy-tabBar/index.scss +169 -0
- package/components/hy-tabBar/props.ts +13 -0
- package/components/hy-tabBar/typing.d.ts +54 -0
- package/components/hy-tabs/index.scss +2 -2
- package/components/hy-tag/index.scss +1 -1
- package/components/hy-text/index.scss +2 -2
- package/components/hy-textarea/hy-textarea.vue +5 -5
- package/components/hy-textarea/index.scss +5 -6
- package/components/hy-tooltip/index.scss +2 -2
- package/components/hy-upload/index.scss +1 -2
- package/components/hy-watermark/hy-watermark.vue +603 -0
- package/components/hy-watermark/index.scss +15 -0
- package/components/hy-watermark/props.ts +23 -0
- package/components/hy-watermark/typing.d.ts +76 -0
- package/components/index.ts +2 -2
- package/composables/index.ts +1 -0
- package/composables/useTouch.ts +48 -0
- package/index.ts +1 -1
- package/libs/css/mixin.scss +52 -13
- package/libs/css/vars.css +12 -2
- package/package.json +2 -2
- package/theme.scss +24 -46
- package/typing/modules/common.d.ts +1 -1
- package/utils/inspect.ts +20 -0
- package/utils/utils.ts +52 -22
- package/components/hy-swipe-action/index.wxs +0 -235
- package/components/hy-swipe-action/wxs.js +0 -15
- package/components/yk-tabbar/props.ts +0 -49
- package/components/yk-tabbar/yk-tabbar.vue +0 -224
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import type { CSSProperties } from "vue";
|
|
2
|
+
|
|
3
|
+
export default interface HySignatureProps {
|
|
4
|
+
/**
|
|
5
|
+
* @description 签名笔颜色
|
|
6
|
+
* */
|
|
7
|
+
penColor?: string;
|
|
8
|
+
/**
|
|
9
|
+
* @description 签名笔宽度(默认 2 )
|
|
10
|
+
* */
|
|
11
|
+
lineWidth?: number;
|
|
12
|
+
/**
|
|
13
|
+
* @description 清空按钮的文本
|
|
14
|
+
* */
|
|
15
|
+
clearText?: string;
|
|
16
|
+
/**
|
|
17
|
+
* @description 撤回按钮的文本
|
|
18
|
+
* */
|
|
19
|
+
revokeText?: string;
|
|
20
|
+
/**
|
|
21
|
+
* @description 恢复按钮的文本
|
|
22
|
+
* */
|
|
23
|
+
restoreText?: string;
|
|
24
|
+
/**
|
|
25
|
+
* @description 确认按钮的文本
|
|
26
|
+
* */
|
|
27
|
+
confirmText?: string;
|
|
28
|
+
/**
|
|
29
|
+
* @description 目标文件的类型(默认 png )
|
|
30
|
+
* */
|
|
31
|
+
fileType?: string;
|
|
32
|
+
/**
|
|
33
|
+
* @description 签名笔颜色
|
|
34
|
+
* */
|
|
35
|
+
quality?: number;
|
|
36
|
+
/**
|
|
37
|
+
* @description 目标文件的质量(默认 1 )
|
|
38
|
+
* */
|
|
39
|
+
exportScale?: number;
|
|
40
|
+
/**
|
|
41
|
+
* @description 是否禁用签名板(默认 false )
|
|
42
|
+
* */
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* @description 画布的高度
|
|
46
|
+
* */
|
|
47
|
+
height?: number;
|
|
48
|
+
/**
|
|
49
|
+
* @description 画布的宽度
|
|
50
|
+
* */
|
|
51
|
+
width?: number;
|
|
52
|
+
/**
|
|
53
|
+
* @description 边框圆角
|
|
54
|
+
* */
|
|
55
|
+
round?: string | number;
|
|
56
|
+
/**
|
|
57
|
+
* @description 画板的背景色
|
|
58
|
+
* */
|
|
59
|
+
backgroundColor?: string;
|
|
60
|
+
/**
|
|
61
|
+
* @description 是否禁用画布滚动(默认 true )
|
|
62
|
+
* */
|
|
63
|
+
disableScroll?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* @description 是否开启历史记录(默认 false )
|
|
66
|
+
* */
|
|
67
|
+
enableHistory?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* @description 撤回和恢复的步长(默认 1 )
|
|
70
|
+
* */
|
|
71
|
+
step?: number;
|
|
72
|
+
/**
|
|
73
|
+
* @description 撤回按钮的文本(默认 撤销 )
|
|
74
|
+
* */
|
|
75
|
+
undoText?: string;
|
|
76
|
+
/**
|
|
77
|
+
* @description 恢复按钮的文本(默认 恢复 )
|
|
78
|
+
* */
|
|
79
|
+
redoText?: string;
|
|
80
|
+
/**
|
|
81
|
+
* @description 是否启用压感模式(默认 false )
|
|
82
|
+
* */
|
|
83
|
+
pressure?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* @description 压感模式下笔画最小宽度(默认 2 )
|
|
86
|
+
* */
|
|
87
|
+
minWidth?: number;
|
|
88
|
+
/**
|
|
89
|
+
* @description 压感模式下笔画最大宽度(默认 6 )
|
|
90
|
+
* */
|
|
91
|
+
maxWidth?: number;
|
|
92
|
+
/**
|
|
93
|
+
* @description 最小速度阈值,影响压感模式下的笔画宽度变化(默认 1.5 )
|
|
94
|
+
* */
|
|
95
|
+
minSpeed?: number;
|
|
96
|
+
/**
|
|
97
|
+
* @description 定义需要用到的外部样式
|
|
98
|
+
* */
|
|
99
|
+
customStyle?: CSSProperties;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* 签名结果类型
|
|
104
|
+
* @property tempFilePath - 生成图片的临时路径
|
|
105
|
+
* @property success - 是否成功生成图片
|
|
106
|
+
* @property width - 生成图片的宽度
|
|
107
|
+
* @property height - 生成图片的高度
|
|
108
|
+
*/
|
|
109
|
+
export type SignatureResult = {
|
|
110
|
+
tempFilePath: string;
|
|
111
|
+
success: boolean;
|
|
112
|
+
width: number;
|
|
113
|
+
height: number;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* 签名线条类型
|
|
118
|
+
* @property points - 线条所包含的所有点的数组
|
|
119
|
+
* @property color - 线条颜色
|
|
120
|
+
* @property width - 线条宽度
|
|
121
|
+
* @property backgroundColor - 线条背景色 (可选)
|
|
122
|
+
* @property isPressure - 是否为笔锋模式的线条 (可选)
|
|
123
|
+
*/
|
|
124
|
+
export interface Line {
|
|
125
|
+
points: Point[];
|
|
126
|
+
color: string;
|
|
127
|
+
width: number;
|
|
128
|
+
backgroundColor?: string;
|
|
129
|
+
isPressure?: boolean;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* 签名点位类型
|
|
134
|
+
* @property x - 点的横坐标
|
|
135
|
+
* @property y - 点的纵坐标
|
|
136
|
+
* @property t - 点的时间戳
|
|
137
|
+
* @property speed - 当前点的绘制速度 (可选)
|
|
138
|
+
* @property distance - 与上一个点的距离 (可选)
|
|
139
|
+
* @property lineWidth - 当前点的线宽 (可选,用于笔锋模式)
|
|
140
|
+
* @property lastX1 - 贝塞尔曲线第一个控制点的x坐标 (可选)
|
|
141
|
+
* @property lastY1 - 贝塞尔曲线第一个控制点的y坐标 (可选)
|
|
142
|
+
* @property lastX2 - 贝塞尔曲线第二个控制点的x坐标 (可选)
|
|
143
|
+
* @property lastY2 - 贝塞尔曲线第二个控制点的y坐标 (可选)
|
|
144
|
+
* @property isFirstPoint - 是否为线条的第一个点 (可选)
|
|
145
|
+
*/
|
|
146
|
+
export interface Point {
|
|
147
|
+
x: number;
|
|
148
|
+
y: number;
|
|
149
|
+
t: number;
|
|
150
|
+
speed?: number;
|
|
151
|
+
distance?: number;
|
|
152
|
+
lineWidth?: number;
|
|
153
|
+
lastX1?: number;
|
|
154
|
+
lastY1?: number;
|
|
155
|
+
lastX2?: number;
|
|
156
|
+
lastY2?: number;
|
|
157
|
+
isFirstPoint?: boolean;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* 签名组件暴露的方法类型
|
|
162
|
+
* @property init - 初始化签名板
|
|
163
|
+
* @property clear - 清除签名
|
|
164
|
+
* @property confirm - 确认签名并生成图片
|
|
165
|
+
* @property restore - 恢复上一步操作
|
|
166
|
+
* @property revoke - 撤销上一步操作
|
|
167
|
+
*/
|
|
168
|
+
export type SignatureExpose = {
|
|
169
|
+
/** 初始化签名板
|
|
170
|
+
* @param forceUpdate - 是否强制更新
|
|
171
|
+
*/
|
|
172
|
+
init: (forceUpdate?: boolean) => void;
|
|
173
|
+
/** 点击清除按钮清除签名 */
|
|
174
|
+
clear: () => void;
|
|
175
|
+
/** 点击确定按钮 */
|
|
176
|
+
confirm: () => void;
|
|
177
|
+
/* 点击恢复 */
|
|
178
|
+
restore: () => void;
|
|
179
|
+
/* 点击撤回 */
|
|
180
|
+
revoke: () => void;
|
|
181
|
+
};
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
&__base {
|
|
36
|
-
background-color:
|
|
36
|
+
background-color: $hy-background--empty;
|
|
37
|
+
border-radius: $hy-border-radius-semicircle;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
/* #ifndef APP-NVUE */
|
|
@@ -53,6 +54,9 @@
|
|
|
53
54
|
border-radius: $hy-border-radius-semicircle;
|
|
54
55
|
transition: width 0.2s;
|
|
55
56
|
background-color: $hy-primary;
|
|
57
|
+
&-0 {
|
|
58
|
+
background-color: $hy-background--empty;
|
|
59
|
+
}
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
&__button {
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
|
|
23
23
|
<script lang="ts">
|
|
24
24
|
export default {
|
|
25
|
-
name:
|
|
25
|
+
name: "hy-subsection",
|
|
26
26
|
options: {
|
|
27
27
|
addGlobalClass: true,
|
|
28
28
|
virtualHost: true,
|
|
29
|
-
styleIsolation:
|
|
30
|
-
}
|
|
31
|
-
}
|
|
29
|
+
styleIsolation: "shared",
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
32
|
</script>
|
|
33
33
|
|
|
34
34
|
<script setup lang="ts">
|
|
35
|
-
import {computed, toRefs, ref, onMounted,
|
|
35
|
+
import { computed, toRefs, ref, onMounted, getCurrentInstance } from "vue";
|
|
36
36
|
import type { CSSProperties } from "vue";
|
|
37
37
|
import defaultProps from "./props";
|
|
38
38
|
import type IProps from "./typing";
|
|
@@ -50,7 +50,7 @@ const {
|
|
|
50
50
|
bold,
|
|
51
51
|
bgColor,
|
|
52
52
|
inactiveColor,
|
|
53
|
-
|
|
53
|
+
customKeys,
|
|
54
54
|
} = toRefs(props);
|
|
55
55
|
const emit = defineEmits(["change", "update:modelValue"]);
|
|
56
56
|
|
|
@@ -83,7 +83,7 @@ const wrapperClass = computed(() => {
|
|
|
83
83
|
"hy-subsection__item",
|
|
84
84
|
"cursor-pointer",
|
|
85
85
|
`hy-subsection__item--${innerCurrent.value}__${guidClass}`,
|
|
86
|
-
|
|
86
|
+
`hy-subsection__item--${mode.value}`,
|
|
87
87
|
index < list.value.length - 1 && "hy-subsection__item--no-border-right",
|
|
88
88
|
index === 0 && "hy-subsection__item--first",
|
|
89
89
|
index === list.value.length - 1 && "hy-subsection__item--last",
|
|
@@ -175,7 +175,7 @@ const init = () => {
|
|
|
175
175
|
if (typeof item === "string" || typeof item === "number") {
|
|
176
176
|
return item === modelValue.value;
|
|
177
177
|
} else {
|
|
178
|
-
return item[
|
|
178
|
+
return item[customKeys.value.value] === modelValue.value;
|
|
179
179
|
}
|
|
180
180
|
});
|
|
181
181
|
|
|
@@ -184,23 +184,25 @@ const init = () => {
|
|
|
184
184
|
innerCurrent.value === -1 ? current.value : innerCurrent.value;
|
|
185
185
|
|
|
186
186
|
// TODO: 多个数组在一起计算宽度, 宽度不一样会有问题,所以必须加guidClass随机数
|
|
187
|
-
getRect(`.hy-subsection__item--0__${guidClass}`, false, instance).then(
|
|
188
|
-
|
|
189
|
-
|
|
187
|
+
getRect(`.hy-subsection__item--0__${guidClass}`, false, instance).then(
|
|
188
|
+
(size) => {
|
|
189
|
+
itemRect.value = size as UniApp.NodeInfo;
|
|
190
|
+
},
|
|
191
|
+
);
|
|
190
192
|
};
|
|
191
193
|
|
|
192
194
|
/**
|
|
193
195
|
* @description 判断值
|
|
194
196
|
* */
|
|
195
197
|
const getValue = (item: SubSectionVo) => {
|
|
196
|
-
return typeof item === "object" ? item[
|
|
198
|
+
return typeof item === "object" ? item[customKeys.value.value] : item;
|
|
197
199
|
};
|
|
198
200
|
|
|
199
201
|
/**
|
|
200
202
|
* @description 判断展示文本
|
|
201
203
|
* */
|
|
202
204
|
const getName = (item: SubSectionVo) => {
|
|
203
|
-
return typeof item === "object" ? item[
|
|
205
|
+
return typeof item === "object" ? item[customKeys.value.name] : item;
|
|
204
206
|
};
|
|
205
207
|
|
|
206
208
|
/**
|