oxy-uni-ui 1.2.3 → 2.0.0
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/attributes.json +1 -1
- package/components/common/abstracts/variable.scss +353 -328
- package/components/common/util.ts +185 -32
- package/components/composables/index.ts +1 -0
- package/components/composables/usePopover.ts +24 -20
- package/components/composables/useVirtualScroll.ts +10 -9
- package/components/composables/useWindowResize.ts +35 -0
- package/components/oxy-action-sheet/index.scss +24 -11
- package/components/oxy-action-sheet/oxy-action-sheet.vue +27 -19
- package/components/oxy-action-sheet/types.ts +7 -0
- package/components/oxy-backtop/index.scss +3 -3
- package/components/oxy-backtop/oxy-backtop.vue +9 -6
- package/components/oxy-backtop/types.ts +7 -7
- package/components/oxy-badge/index.scss +4 -4
- package/components/oxy-badge/oxy-badge.vue +3 -3
- package/components/oxy-badge/types.ts +2 -2
- package/components/oxy-button/index.scss +5 -5
- package/components/oxy-button/oxy-button.vue +5 -1
- package/components/oxy-calendar/index.scss +11 -11
- package/components/oxy-calendar/oxy-calendar.vue +1 -0
- package/components/oxy-calendar/types.ts +5 -0
- package/components/oxy-calendar-view/month/index.scss +4 -4
- package/components/oxy-calendar-view/month/types.ts +36 -0
- package/components/oxy-calendar-view/monthPanel/index.scss +7 -7
- package/components/oxy-calendar-view/monthPanel/month-panel.vue +14 -8
- package/components/oxy-calendar-view/year/index.scss +4 -4
- package/components/oxy-calendar-view/yearPanel/index.scss +4 -4
- package/components/oxy-calendar-view/yearPanel/year-panel.vue +21 -5
- package/components/oxy-card/index.scss +2 -2
- package/components/oxy-cell/index.scss +8 -8
- package/components/oxy-checkbox/index.scss +7 -7
- package/components/oxy-checkbox-group/index.scss +2 -2
- package/components/oxy-circle/oxy-circle.vue +10 -7
- package/components/oxy-circle/types.ts +5 -5
- package/components/oxy-col/oxy-col.vue +2 -2
- package/components/oxy-col-picker/index.scss +4 -4
- package/components/oxy-col-picker/oxy-col-picker.vue +6 -5
- package/components/oxy-col-picker/types.ts +7 -2
- package/components/oxy-collapse/index.scss +2 -2
- package/components/oxy-collapse-item/oxy-collapse-item.vue +3 -3
- package/components/oxy-corner/index.scss +32 -32
- package/components/oxy-count-to/oxy-count-to.vue +3 -3
- package/components/oxy-curtain/index.scss +15 -15
- package/components/oxy-curtain/oxy-curtain.vue +4 -2
- package/components/oxy-curtain/types.ts +6 -1
- package/components/oxy-date-strip/oxy-date-strip.vue +2 -2
- package/components/oxy-date-strip/types.ts +1 -1
- package/components/oxy-date-strip-item/index.scss +3 -3
- package/components/oxy-datetime-picker/index.scss +11 -11
- package/components/oxy-datetime-picker/oxy-datetime-picker.vue +1 -0
- package/components/oxy-datetime-picker/types.ts +5 -0
- package/components/oxy-drop-menu/index.scss +3 -3
- package/components/oxy-drop-menu/oxy-drop-menu.vue +3 -3
- package/components/oxy-drop-menu-item/index.scss +1 -1
- package/components/oxy-drop-menu-item/oxy-drop-menu-item.vue +4 -3
- package/components/oxy-drop-menu-item/types.ts +5 -0
- package/components/oxy-echarts/types.ts +6 -0
- package/components/oxy-fab/index.scss +8 -8
- package/components/oxy-fab/oxy-fab.vue +22 -3
- package/components/oxy-file-list/index.scss +24 -23
- package/components/oxy-file-list/oxy-file-list.vue +2 -2
- package/components/oxy-floating-panel/oxy-floating-panel.vue +13 -9
- package/components/oxy-floating-panel/{type.ts → types.ts} +8 -8
- package/components/oxy-footer/index.scss +19 -0
- package/components/oxy-footer/oxy-footer.vue +78 -0
- package/components/oxy-footer/types.ts +17 -0
- package/components/oxy-form-item/types.ts +22 -1
- package/components/oxy-gap/oxy-gap.vue +2 -2
- package/components/oxy-gap/types.ts +2 -2
- package/components/oxy-grid/oxy-grid.vue +1 -1
- package/components/oxy-grid/types.ts +1 -1
- package/components/oxy-grid-item/index.scss +1 -1
- package/components/oxy-grid-item/oxy-grid-item.vue +7 -5
- package/components/oxy-grid-item/types.ts +1 -1
- package/components/oxy-guidance/index.scss +75 -0
- package/components/oxy-guidance/oxy-guidance.vue +201 -0
- package/components/oxy-guidance/types.ts +33 -0
- package/components/oxy-icon/oxy-icon.vue +2 -2
- package/components/oxy-icon/types.ts +1 -1
- package/components/oxy-img/oxy-img.vue +4 -4
- package/components/oxy-img/types.ts +3 -3
- package/components/oxy-img-cropper/index.scss +12 -12
- package/components/oxy-img-cropper/oxy-img-cropper.vue +97 -52
- package/components/oxy-img-cropper/types.ts +2 -2
- package/components/oxy-img-lazy/oxy-img-lazy.vue +3 -3
- package/components/oxy-img-lazy/types.ts +3 -3
- package/components/oxy-index-anchor/index.scss +2 -2
- package/components/oxy-index-anchor/oxy-index-anchor.vue +2 -2
- package/components/oxy-index-anchor/{type.ts → types.ts} +3 -0
- package/components/oxy-index-bar/index.scss +3 -3
- package/components/oxy-index-bar/oxy-index-bar.vue +3 -3
- package/components/oxy-index-bar/{type.ts → types.ts} +2 -2
- package/components/oxy-input/index.scss +1 -1
- package/components/oxy-input-number/index.scss +5 -5
- package/components/oxy-input-number/oxy-input-number.vue +2 -2
- package/components/oxy-input-number/types.ts +3 -2
- package/components/oxy-keyboard/index.scss +5 -5
- package/components/oxy-keyboard/key/index.scss +3 -3
- package/components/oxy-keyboard/key/index.vue +2 -2
- package/components/oxy-keyboard/key/types.ts +15 -0
- package/components/oxy-keyboard/oxy-keyboard.vue +1 -0
- package/components/oxy-keyboard/types.ts +5 -0
- package/components/oxy-link/index.scss +2 -2
- package/components/oxy-list/oxy-list.vue +4 -3
- package/components/oxy-loading/oxy-loading.vue +8 -4
- package/components/oxy-loading/types.ts +1 -1
- package/components/oxy-loadmore/index.scss +3 -3
- package/components/oxy-long-press-menu/index.scss +93 -0
- package/components/oxy-long-press-menu/oxy-long-press-menu.vue +338 -0
- package/components/oxy-long-press-menu/types.ts +34 -0
- package/components/oxy-message-box/index.scss +12 -11
- package/components/oxy-message-box/oxy-message-box.vue +11 -3
- package/components/oxy-message-box/types.ts +14 -0
- package/components/oxy-navbar/index.scss +2 -2
- package/components/oxy-navbar/oxy-navbar.vue +58 -13
- package/components/oxy-navbar/types.ts +8 -1
- package/components/oxy-navbar-capsule/types.ts +3 -0
- package/components/oxy-notice-bar/index.scss +3 -3
- package/components/oxy-notice-bar/oxy-notice-bar.vue +9 -5
- package/components/oxy-notice-bar/types.ts +3 -3
- package/components/oxy-notify/index.ts +1 -0
- package/components/oxy-notify/oxy-notify.vue +3 -2
- package/components/oxy-notify/types.ts +7 -0
- package/components/oxy-pagination/index.scss +1 -1
- package/components/oxy-password-input/oxy-password-input.vue +2 -2
- package/components/oxy-password-input/types.ts +1 -1
- package/components/oxy-picker/index.scss +45 -2
- package/components/oxy-picker/oxy-picker.vue +100 -14
- package/components/oxy-picker/types.ts +29 -1
- package/components/oxy-picker-view/index.scss +3 -3
- package/components/oxy-picker-view/oxy-picker-view.vue +4 -4
- package/components/oxy-popover/index.scss +9 -9
- package/components/oxy-popup/index.scss +2 -2
- package/components/oxy-popup/oxy-popup.vue +35 -2
- package/components/oxy-popup/types.ts +8 -1
- package/components/oxy-progress/index.scss +3 -3
- package/components/oxy-qrcode/draw.ts +398 -0
- package/components/oxy-qrcode/index.scss +2 -0
- package/components/oxy-qrcode/oxy-qrcode.vue +124 -0
- package/components/oxy-qrcode/qrcode.ts +936 -0
- package/components/oxy-qrcode/types.ts +42 -0
- package/components/oxy-radio/index.scss +10 -10
- package/components/oxy-radio-group/index.scss +2 -2
- package/components/oxy-rate/types.ts +4 -4
- package/components/oxy-resize/index.scss +2 -2
- package/components/oxy-resize/oxy-resize.vue +4 -4
- package/components/oxy-resize/types.ts +3 -0
- package/components/oxy-rich-text/index.scss +30 -29
- package/components/oxy-rich-text/mp-html/mp-html.vue +33 -24
- package/components/oxy-rich-text/mp-html/node/node.vue +30 -19
- package/components/oxy-rich-text/oxy-rich-text.vue +31 -31
- package/components/oxy-rich-text/types.ts +6 -1
- package/components/oxy-row/oxy-row.vue +3 -3
- package/components/oxy-row/types.ts +1 -1
- package/components/oxy-search/index.scss +3 -3
- package/components/oxy-segmented/index.scss +16 -16
- package/components/oxy-segmented/oxy-segmented.vue +23 -3
- package/components/oxy-select/index.scss +144 -68
- package/components/oxy-select/oxy-select.vue +85 -50
- package/components/oxy-select/types.ts +13 -1
- package/components/oxy-select-picker/index.scss +7 -7
- package/components/oxy-select-picker/oxy-select-picker.vue +1 -0
- package/components/oxy-select-picker/types.ts +2 -0
- package/components/oxy-sidebar-item/index.scss +1 -1
- package/components/oxy-signature/oxy-signature.vue +18 -10
- package/components/oxy-signature/types.ts +106 -13
- package/components/oxy-skeleton/oxy-skeleton.vue +6 -6
- package/components/oxy-skeleton/types.ts +1 -1
- package/components/oxy-slider/index.scss +3 -3
- package/components/oxy-sort-button/index.scss +8 -8
- package/components/oxy-status-tip/index.scss +4 -4
- package/components/oxy-status-tip/oxy-status-tip.vue +5 -5
- package/components/oxy-status-tip/types.ts +3 -3
- package/components/oxy-step/index.scss +14 -14
- package/components/oxy-sticky/oxy-sticky.vue +6 -6
- package/components/oxy-stream-render/types.ts +4 -1
- package/components/oxy-swipe-action/oxy-swipe-action.vue +27 -2
- package/components/oxy-swiper/oxy-swiper.vue +6 -6
- package/components/oxy-swiper/types.ts +5 -5
- package/components/oxy-switch/index.scss +8 -8
- package/components/oxy-switch/oxy-switch.vue +2 -2
- package/components/oxy-switch/types.ts +1 -1
- package/components/oxy-tab/index.scss +11 -1
- package/components/oxy-tabbar/index.scss +1 -1
- package/components/oxy-tabbar/oxy-tabbar.vue +39 -10
- package/components/oxy-table/index.scss +5 -5
- package/components/oxy-table/oxy-table.vue +8 -6
- package/components/oxy-table/types.ts +2 -2
- package/components/oxy-table-col/oxy-table-col.vue +3 -3
- package/components/oxy-table-col/types.ts +2 -2
- package/components/oxy-tabs/index.scss +43 -15
- package/components/oxy-tabs/oxy-tabs.vue +53 -19
- package/components/oxy-tabs/types.ts +15 -3
- package/components/oxy-tag/index.scss +15 -15
- package/components/oxy-text/index.scss +5 -1
- package/components/oxy-text/oxy-text.vue +76 -7
- package/components/oxy-text/types.ts +12 -0
- package/components/oxy-textarea/index.scss +6 -6
- package/components/oxy-toast/oxy-toast.vue +24 -8
- package/components/oxy-tooltip/index.scss +9 -9
- package/components/oxy-tree/index.scss +51 -15
- package/components/oxy-tree/oxy-tree.vue +13 -9
- package/components/oxy-tree/types.ts +12 -9
- package/components/oxy-upload/index.scss +21 -21
- package/components/oxy-upload/types.ts +2 -2
- package/components/oxy-verification-code/index.scss +6 -0
- package/components/oxy-verification-code/oxy-verification-code.vue +187 -0
- package/components/oxy-verification-code/types.ts +82 -0
- package/components/oxy-video-preview/index.scss +4 -4
- package/components/oxy-virtual-scroll/index.scss +4 -4
- package/components/oxy-virtual-scroll/oxy-virtual-scroll.vue +11 -7
- package/components/oxy-virtual-scroll/types.ts +14 -14
- package/components/oxy-voice-player/index.scss +908 -0
- package/components/oxy-voice-player/oxy-voice-player.vue +821 -0
- package/components/oxy-voice-player/types.ts +567 -0
- package/components/oxy-waterfall/oxy-waterfall.vue +6 -6
- package/components/oxy-waterfall/types.ts +6 -6
- package/components/oxy-watermark/oxy-watermark.vue +35 -13
- package/components/oxy-watermark/types.ts +14 -14
- package/global.d.ts +2 -0
- package/locale/lang/ar-SA.ts +3 -0
- package/locale/lang/en-US.ts +3 -0
- package/locale/lang/zh-CN.ts +3 -0
- package/package.json +97 -1
- package/tags.json +1 -1
- package/web-types.json +1 -1
- package/components/oxy-number-keyboard/index.scss +0 -78
- package/components/oxy-number-keyboard/key/index.scss +0 -81
- package/components/oxy-number-keyboard/key/index.vue +0 -78
- package/components/oxy-number-keyboard/key/types.ts +0 -11
- package/components/oxy-number-keyboard/oxy-number-keyboard.vue +0 -151
- package/components/oxy-number-keyboard/types.ts +0 -83
- package/components/oxy-tree/components/tree-node-content.vue +0 -72
- package/components/oxy-tree/index.ts +0 -51
- package/oxy-uni-ui.zip +0 -0
|
@@ -69,7 +69,7 @@ export default {
|
|
|
69
69
|
</script>
|
|
70
70
|
<script lang="ts" setup>
|
|
71
71
|
import { computed, getCurrentInstance, onBeforeMount, onMounted, reactive, ref, watch, type CSSProperties } from 'vue'
|
|
72
|
-
import {
|
|
72
|
+
import { getRect, isDef, objToStyle, unitConvert, unitConvertWithDefault, withDefaultUnit, uuid } from '../common/util'
|
|
73
73
|
import { signatureProps, type SignatureExpose, type SignatureResult, type Point, type Line } from './types'
|
|
74
74
|
import { useTranslate } from '../composables/useTranslate'
|
|
75
75
|
// #ifdef MP-WEIXIN
|
|
@@ -147,11 +147,11 @@ watch(
|
|
|
147
147
|
const canvasStyle = computed(() => {
|
|
148
148
|
const style: CSSProperties = {}
|
|
149
149
|
if (isDef(props.width)) {
|
|
150
|
-
style.width =
|
|
150
|
+
style.width = unitConvert(withDefaultUnit(props.width, 'rpx'), 0, { output: 'px' })
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
if (isDef(props.height)) {
|
|
154
|
-
style.height =
|
|
154
|
+
style.height = unitConvert(withDefaultUnit(props.height, 'rpx'), 0, { output: 'px' })
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
return `${objToStyle(style)}`
|
|
@@ -159,6 +159,12 @@ const canvasStyle = computed(() => {
|
|
|
159
159
|
|
|
160
160
|
const disableScroll = computed(() => props.disableScroll)
|
|
161
161
|
const enableHistory = computed(() => props.enableHistory)
|
|
162
|
+
const resolveStrokeWidth = (value: number | string): number => {
|
|
163
|
+
return unitConvertWithDefault(value, { defaultUnit: 'rpx' })
|
|
164
|
+
}
|
|
165
|
+
const lineWidthInPx = computed(() => resolveStrokeWidth(props.lineWidth))
|
|
166
|
+
const minWidthInPx = computed(() => resolveStrokeWidth(props.minWidth))
|
|
167
|
+
const maxWidthInPx = computed(() => resolveStrokeWidth(props.maxWidth))
|
|
162
168
|
|
|
163
169
|
const lines = ref<Line[]>([]) // 保存所有线条
|
|
164
170
|
const redoLines = ref<Line[]>([]) // 保存撤销的线条
|
|
@@ -167,22 +173,24 @@ const currentStep = ref(0) // 当前步骤
|
|
|
167
173
|
|
|
168
174
|
// 添加计算笔画宽度的方法
|
|
169
175
|
function calculateLineWidth(speed: number): number {
|
|
170
|
-
if (!props.pressure) return
|
|
176
|
+
if (!props.pressure) return lineWidthInPx.value
|
|
171
177
|
|
|
172
178
|
const minSpeed = props.minSpeed || 1.5
|
|
179
|
+
const minWidth = Math.min(minWidthInPx.value, maxWidthInPx.value)
|
|
180
|
+
const maxWidth = Math.max(minWidthInPx.value, maxWidthInPx.value)
|
|
173
181
|
const limitedSpeed = Math.min(minSpeed * 10, Math.max(minSpeed, speed))
|
|
174
|
-
const addWidth = ((
|
|
175
|
-
const lineWidth = Math.max(
|
|
176
|
-
return Math.min(lineWidth,
|
|
182
|
+
const addWidth = ((maxWidth - minWidth) * (limitedSpeed - minSpeed)) / minSpeed
|
|
183
|
+
const lineWidth = Math.max(maxWidth - addWidth, minWidth)
|
|
184
|
+
return Math.min(lineWidth, maxWidth)
|
|
177
185
|
}
|
|
178
186
|
|
|
179
187
|
/* 获取默认笔画宽度 */
|
|
180
188
|
const getDefaultLineWidth = () => {
|
|
181
189
|
if (props.pressure) {
|
|
182
190
|
// 在压感模式下,使用最大和最小宽度的平均值作为默认值
|
|
183
|
-
return (
|
|
191
|
+
return (maxWidthInPx.value + minWidthInPx.value) / 2
|
|
184
192
|
}
|
|
185
|
-
return
|
|
193
|
+
return lineWidthInPx.value
|
|
186
194
|
}
|
|
187
195
|
|
|
188
196
|
/* 开始画线 */
|
|
@@ -469,7 +477,7 @@ function drawSmoothLine(prePoint: Point, point: Point) {
|
|
|
469
477
|
}
|
|
470
478
|
|
|
471
479
|
// 计算线宽
|
|
472
|
-
const lineWidth = point.lineWidth ||
|
|
480
|
+
const lineWidth = point.lineWidth || lineWidthInPx.value
|
|
473
481
|
|
|
474
482
|
// 绘制贝塞尔曲线
|
|
475
483
|
if (typeof prePoint.lastX1 === 'number') {
|
|
@@ -1,65 +1,122 @@
|
|
|
1
1
|
import type { ComponentPublicInstance, ExtractPropTypes } from 'vue'
|
|
2
|
-
import { baseProps, numericProp } from '../common/props'
|
|
2
|
+
import { baseProps, makeNumericProp, numericProp } from '../common/props'
|
|
3
3
|
|
|
4
4
|
export const signatureProps = {
|
|
5
5
|
...baseProps,
|
|
6
|
+
/**
|
|
7
|
+
* 画笔颜色
|
|
8
|
+
*/
|
|
6
9
|
penColor: {
|
|
7
10
|
type: String,
|
|
8
11
|
default: '#000'
|
|
9
12
|
},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* 画笔线宽,支持 number / string(如 '6rpx'、'3px'),number 与纯数字字符串按 rpx 处理
|
|
15
|
+
*/
|
|
16
|
+
lineWidth: makeNumericProp(6),
|
|
17
|
+
/**
|
|
18
|
+
* 清空按钮文案
|
|
19
|
+
*/
|
|
14
20
|
clearText: String,
|
|
21
|
+
/**
|
|
22
|
+
* 撤销按钮文案
|
|
23
|
+
*/
|
|
15
24
|
revokeText: String,
|
|
25
|
+
/**
|
|
26
|
+
* 恢复按钮文案
|
|
27
|
+
*/
|
|
16
28
|
restoreText: String,
|
|
29
|
+
/**
|
|
30
|
+
* 确认按钮文案
|
|
31
|
+
*/
|
|
17
32
|
confirmText: String,
|
|
33
|
+
/**
|
|
34
|
+
* 导出图片格式
|
|
35
|
+
*/
|
|
18
36
|
fileType: {
|
|
19
37
|
type: String,
|
|
20
38
|
default: 'png'
|
|
21
39
|
},
|
|
40
|
+
/**
|
|
41
|
+
* 导出质量
|
|
42
|
+
*/
|
|
22
43
|
quality: {
|
|
23
44
|
type: Number,
|
|
24
45
|
default: 1
|
|
25
46
|
},
|
|
47
|
+
/**
|
|
48
|
+
* 导出缩放比例
|
|
49
|
+
*/
|
|
26
50
|
exportScale: {
|
|
27
51
|
type: Number,
|
|
28
52
|
default: 1
|
|
29
53
|
},
|
|
54
|
+
/**
|
|
55
|
+
* 是否禁用签名操作
|
|
56
|
+
*/
|
|
30
57
|
disabled: {
|
|
31
58
|
type: Boolean,
|
|
32
59
|
default: false
|
|
33
60
|
},
|
|
61
|
+
/**
|
|
62
|
+
* 画布高度,支持 number / string(如 '600rpx'、'300px'),number 与纯数字字符串按 rpx 处理
|
|
63
|
+
*/
|
|
34
64
|
height: numericProp,
|
|
65
|
+
/**
|
|
66
|
+
* 画布宽度,支持 number / string(如 '100%'、'700rpx'),number 与纯数字字符串按 rpx 处理
|
|
67
|
+
*/
|
|
35
68
|
width: numericProp,
|
|
69
|
+
/**
|
|
70
|
+
* 画布背景色
|
|
71
|
+
*/
|
|
36
72
|
backgroundColor: String,
|
|
73
|
+
/**
|
|
74
|
+
* 是否禁用页面滚动
|
|
75
|
+
*/
|
|
37
76
|
disableScroll: {
|
|
38
77
|
type: Boolean,
|
|
39
78
|
default: true
|
|
40
79
|
},
|
|
80
|
+
/**
|
|
81
|
+
* 是否启用历史记录
|
|
82
|
+
*/
|
|
41
83
|
enableHistory: {
|
|
42
84
|
type: Boolean,
|
|
43
85
|
default: false
|
|
44
86
|
},
|
|
87
|
+
/**
|
|
88
|
+
* 每次记录步进
|
|
89
|
+
*/
|
|
45
90
|
step: {
|
|
46
91
|
type: Number,
|
|
47
92
|
default: 1
|
|
48
93
|
},
|
|
94
|
+
/**
|
|
95
|
+
* 撤销文案
|
|
96
|
+
*/
|
|
49
97
|
undoText: String,
|
|
98
|
+
/**
|
|
99
|
+
* 重做文案
|
|
100
|
+
*/
|
|
50
101
|
redoText: String,
|
|
102
|
+
/**
|
|
103
|
+
* 是否启用压感
|
|
104
|
+
*/
|
|
51
105
|
pressure: {
|
|
52
106
|
type: Boolean,
|
|
53
107
|
default: false
|
|
54
108
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
109
|
+
/**
|
|
110
|
+
* 压感最小线宽,支持 number / string(如 '4rpx'、'2px'),number 与纯数字字符串按 rpx 处理
|
|
111
|
+
*/
|
|
112
|
+
minWidth: makeNumericProp(4),
|
|
113
|
+
/**
|
|
114
|
+
* 压感最大线宽,支持 number / string(如 '12rpx'、'6px'),number 与纯数字字符串按 rpx 处理
|
|
115
|
+
*/
|
|
116
|
+
maxWidth: makeNumericProp(12),
|
|
117
|
+
/**
|
|
118
|
+
* 压感最小速度阈值
|
|
119
|
+
*/
|
|
63
120
|
minSpeed: {
|
|
64
121
|
type: Number,
|
|
65
122
|
default: 1.5
|
|
@@ -67,23 +124,59 @@ export const signatureProps = {
|
|
|
67
124
|
}
|
|
68
125
|
|
|
69
126
|
export type SignatureResult = {
|
|
127
|
+
/**
|
|
128
|
+
* 临时文件路径
|
|
129
|
+
*/
|
|
70
130
|
tempFilePath: string
|
|
131
|
+
/**
|
|
132
|
+
* 导出是否成功
|
|
133
|
+
*/
|
|
71
134
|
success: boolean
|
|
135
|
+
/**
|
|
136
|
+
* 导出宽度
|
|
137
|
+
*/
|
|
72
138
|
width: number
|
|
139
|
+
/**
|
|
140
|
+
* 导出高度
|
|
141
|
+
*/
|
|
73
142
|
height: number
|
|
74
143
|
}
|
|
75
144
|
|
|
76
145
|
export interface Line {
|
|
146
|
+
/**
|
|
147
|
+
* 线段点集合
|
|
148
|
+
*/
|
|
77
149
|
points: Point[]
|
|
150
|
+
/**
|
|
151
|
+
* 线段颜色
|
|
152
|
+
*/
|
|
78
153
|
color: string
|
|
154
|
+
/**
|
|
155
|
+
* 线段宽度
|
|
156
|
+
*/
|
|
79
157
|
width: number
|
|
158
|
+
/**
|
|
159
|
+
* 背景色
|
|
160
|
+
*/
|
|
80
161
|
backgroundColor?: string
|
|
162
|
+
/**
|
|
163
|
+
* 是否启用压感
|
|
164
|
+
*/
|
|
81
165
|
isPressure?: boolean
|
|
82
166
|
}
|
|
83
167
|
|
|
84
168
|
export interface Point {
|
|
169
|
+
/**
|
|
170
|
+
* x 坐标
|
|
171
|
+
*/
|
|
85
172
|
x: number
|
|
173
|
+
/**
|
|
174
|
+
* y 坐标
|
|
175
|
+
*/
|
|
86
176
|
y: number
|
|
177
|
+
/**
|
|
178
|
+
* 时间戳
|
|
179
|
+
*/
|
|
87
180
|
t: number
|
|
88
181
|
speed?: number
|
|
89
182
|
distance?: number
|
|
@@ -24,16 +24,16 @@ import type { CSSProperties } from 'vue'
|
|
|
24
24
|
import { ref, computed, watch } from 'vue'
|
|
25
25
|
import type { SkeletonRowCol, SkeletonRowColObj } from './types'
|
|
26
26
|
import { skeletonProps } from './types'
|
|
27
|
-
import { isNumber,
|
|
27
|
+
import { isNumber, withDefaultUnit } from '../common/util'
|
|
28
28
|
|
|
29
29
|
const themeMap = {
|
|
30
|
-
avatar: [{ type: 'circle', height: '
|
|
31
|
-
image: [{ type: 'rect', height: '
|
|
30
|
+
avatar: [{ type: 'circle', height: '128rpx', width: '128rpx' }],
|
|
31
|
+
image: [{ type: 'rect', height: '128rpx', width: '128rpx' }],
|
|
32
32
|
text: [
|
|
33
33
|
1,
|
|
34
34
|
[
|
|
35
|
-
{ width: '24%', height: '
|
|
36
|
-
{ width: '76%', height: '
|
|
35
|
+
{ width: '24%', height: '32rpx', marginRight: '32rpx' },
|
|
36
|
+
{ width: '76%', height: '32rpx' }
|
|
37
37
|
]
|
|
38
38
|
],
|
|
39
39
|
paragraph: [1, 1, 1, { width: '55%' }]
|
|
@@ -81,7 +81,7 @@ function getColItemStyle(rowCol: SkeletonRowColObj) {
|
|
|
81
81
|
|
|
82
82
|
for (const name of styleName) {
|
|
83
83
|
if (Object.prototype.hasOwnProperty.call(rowCol, name)) {
|
|
84
|
-
const px =
|
|
84
|
+
const px = withDefaultUnit(rowCol[name])
|
|
85
85
|
|
|
86
86
|
if (name === 'size') {
|
|
87
87
|
style.width = px
|
|
@@ -36,7 +36,7 @@ export const skeletonProps = {
|
|
|
36
36
|
* 用于设置行列数量、宽度高度、间距等。
|
|
37
37
|
* @example
|
|
38
38
|
* 【示例一】,`[1, 1, 2]` 表示输出三行骨架图,第一行一列,第二行一列,第三行两列。
|
|
39
|
-
* 【示例二】,`[1, 1, { width: '
|
|
39
|
+
* 【示例二】,`[1, 1, { width: '200rpx' }]` 表示自定义第三行的宽度为 `200rpx`。
|
|
40
40
|
* 【示例三】,`[1, 2, [{ width, height }, { width, height, marginLeft }]]` 表示第三行有两列,且自定义宽度、高度和间距
|
|
41
41
|
*/
|
|
42
42
|
rowCol: makeArrayProp<SkeletonRowCol>(),
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
background-color: rgba($color: #fff, $alpha: 0.5);
|
|
42
42
|
border-radius: 100%;
|
|
43
43
|
position: absolute;
|
|
44
|
-
bottom: calc($-slider-handle-radius * 2 +
|
|
44
|
+
bottom: calc($-slider-handle-radius * 2 + 16rpx);
|
|
45
45
|
}
|
|
46
46
|
@include e(bar-wrapper) {
|
|
47
47
|
flex: 1;
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
@include e(has-label) {
|
|
73
|
-
padding-top: calc($-slider-fs * 1.2 +
|
|
73
|
+
padding-top: calc($-slider-fs * 1.2 + 16rpx);
|
|
74
74
|
}
|
|
75
75
|
@include e(button) {
|
|
76
76
|
height: calc($-slider-handle-radius * 2);
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
border-radius: 100%;
|
|
80
80
|
border: 1px solid $-slider-axie-bg;
|
|
81
81
|
box-sizing: border-box;
|
|
82
|
-
box-shadow: 0
|
|
82
|
+
box-shadow: 0 4rpx 8rpx 0 rgba($color: #9b9b9b, $alpha: 0.5);
|
|
83
83
|
}
|
|
84
84
|
@include e(label-min) {
|
|
85
85
|
margin-right: calc($-slider-handle-radius * 2);
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
&::after {
|
|
21
21
|
position: absolute;
|
|
22
22
|
content: '';
|
|
23
|
-
width:
|
|
24
|
-
height:
|
|
25
|
-
bottom:
|
|
23
|
+
width: 38rpx;
|
|
24
|
+
height: 6rpx;
|
|
25
|
+
bottom: 12rpx;
|
|
26
26
|
left: 50%;
|
|
27
27
|
transform: translate(-50%, 0);
|
|
28
28
|
background: $-sort-button-line-color;
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
|
|
62
62
|
@include e(right) {
|
|
63
63
|
display: inline-block;
|
|
64
|
-
min-width:
|
|
65
|
-
margin-left:
|
|
64
|
+
min-width: 28rpx;
|
|
65
|
+
margin-left: 4rpx;
|
|
66
66
|
vertical-align: middle;
|
|
67
67
|
line-height: 1.1;
|
|
68
68
|
|
|
@@ -78,12 +78,12 @@
|
|
|
78
78
|
@include edeep(icon-up) {
|
|
79
79
|
display: block !important;
|
|
80
80
|
line-height: 1.1;
|
|
81
|
-
transform: scale(calc((10 / 14))) translate(0,
|
|
81
|
+
transform: scale(calc((10 / 14))) translate(0, 14rpx);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
@include edeep(icon-down) {
|
|
85
85
|
display: block !important;
|
|
86
86
|
line-height: 1.1;
|
|
87
|
-
transform: scale(calc((10 / 14))) translate(0, -
|
|
87
|
+
transform: scale(calc((10 / 14))) translate(0, -14rpx);
|
|
88
88
|
}
|
|
89
|
-
}
|
|
89
|
+
}
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
|
|
24
24
|
@include edeep(image) {
|
|
25
25
|
margin: 0 auto;
|
|
26
|
-
width:
|
|
27
|
-
height:
|
|
26
|
+
width: 320rpx;
|
|
27
|
+
height: 320rpx;
|
|
28
28
|
}
|
|
29
29
|
@include e(text) {
|
|
30
|
-
margin:
|
|
30
|
+
margin: 40rpx auto 0;
|
|
31
31
|
font-size: $-statustip-fs;
|
|
32
32
|
line-height: $-statustip-line-height;
|
|
33
33
|
color: $-statustip-color;
|
|
34
34
|
text-align: center;
|
|
35
35
|
overflow-wrap: break-word;
|
|
36
36
|
}
|
|
37
|
-
}
|
|
37
|
+
}
|
|
@@ -24,7 +24,7 @@ import ImgContent from './images/content.png'
|
|
|
24
24
|
import ImgNetwork from './images/network.png'
|
|
25
25
|
import ImgSearch from './images/search.png'
|
|
26
26
|
import { computed, type CSSProperties } from 'vue'
|
|
27
|
-
import {
|
|
27
|
+
import { withDefaultUnit, isDef, isObj, objToStyle } from '../common/util'
|
|
28
28
|
import { statusTipProps } from './types'
|
|
29
29
|
|
|
30
30
|
const imgs: AnyObject = {
|
|
@@ -54,12 +54,12 @@ const imgStyle = computed(() => {
|
|
|
54
54
|
let style: CSSProperties = {}
|
|
55
55
|
if (props.imageSize) {
|
|
56
56
|
if (isObj(props.imageSize)) {
|
|
57
|
-
isDef(props.imageSize.height) && (style.height =
|
|
58
|
-
isDef(props.imageSize.width) && (style.width =
|
|
57
|
+
isDef(props.imageSize.height) && (style.height = withDefaultUnit(props.imageSize.height))
|
|
58
|
+
isDef(props.imageSize.width) && (style.width = withDefaultUnit(props.imageSize.width))
|
|
59
59
|
} else {
|
|
60
60
|
style = {
|
|
61
|
-
height:
|
|
62
|
-
width:
|
|
61
|
+
height: withDefaultUnit(props.imageSize),
|
|
62
|
+
width: withDefaultUnit(props.imageSize)
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -4,11 +4,11 @@ import type { ImageMode } from '../oxy-img/types'
|
|
|
4
4
|
|
|
5
5
|
export type ImageSize = {
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* 宽度,number 类型按 `rpx` 语义处理,也支持 `px/rpx`
|
|
8
8
|
*/
|
|
9
9
|
width: number | string
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* 高度,number 类型按 `rpx` 语义处理,也支持 `px/rpx`
|
|
12
12
|
*/
|
|
13
13
|
height: number | string
|
|
14
14
|
}
|
|
@@ -25,7 +25,7 @@ export const statusTipProps = {
|
|
|
25
25
|
image: makeStringProp('network'),
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* 图片大小,number 类型按 `rpx` 语义处理,也支持 `px/rpx`。
|
|
29
29
|
* 类型: string 或 number 或 ImageSize
|
|
30
30
|
* 默认值: 空字符串
|
|
31
31
|
*/
|
|
@@ -78,12 +78,12 @@
|
|
|
78
78
|
color: $-steps-inactive-color;
|
|
79
79
|
}
|
|
80
80
|
@include e(icon-outer) {
|
|
81
|
-
width: calc($-steps-icon-size -
|
|
82
|
-
height: calc($-steps-icon-size -
|
|
81
|
+
width: calc($-steps-icon-size - 4rpx);
|
|
82
|
+
height: calc($-steps-icon-size - 4rpx);
|
|
83
83
|
border: 1px solid $-steps-inactive-color;
|
|
84
84
|
color: $-steps-inactive-color;
|
|
85
85
|
text-align: center;
|
|
86
|
-
line-height: calc($-steps-icon-size -
|
|
86
|
+
line-height: calc($-steps-icon-size - 4rpx);
|
|
87
87
|
border-radius: 50%;
|
|
88
88
|
font-size: $-steps-icon-text-fs;
|
|
89
89
|
}
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
background: $-steps-line-color;
|
|
106
106
|
}
|
|
107
107
|
@include e(content){
|
|
108
|
-
margin-top:
|
|
108
|
+
margin-top: 14rpx;
|
|
109
109
|
color: $-steps-inactive-color;
|
|
110
110
|
font-size: $-steps-label-fs;
|
|
111
111
|
}
|
|
@@ -118,8 +118,8 @@
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
@include e(description) {
|
|
121
|
-
margin-top:
|
|
122
|
-
padding: 0
|
|
121
|
+
margin-top: 10rpx;
|
|
122
|
+
padding: 0 4rpx;
|
|
123
123
|
color: $-steps-description-color;
|
|
124
124
|
}
|
|
125
125
|
@include when(wait) {
|
|
@@ -163,10 +163,10 @@
|
|
|
163
163
|
&::after {
|
|
164
164
|
position: absolute;
|
|
165
165
|
content: '';
|
|
166
|
-
width: $-steps-dot-size +
|
|
167
|
-
height: $-steps-dot-size +
|
|
168
|
-
left: -
|
|
169
|
-
top: -
|
|
166
|
+
width: $-steps-dot-size + 20rpx;
|
|
167
|
+
height: $-steps-dot-size + 20rpx;
|
|
168
|
+
left: -10rpx;
|
|
169
|
+
top: -10rpx;
|
|
170
170
|
border-radius: 50%;
|
|
171
171
|
background: $-steps-finished-color;
|
|
172
172
|
opacity: 0.2;
|
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
height: 100%;
|
|
208
208
|
|
|
209
209
|
&.is-dot {
|
|
210
|
-
top:
|
|
210
|
+
top: 12rpx;
|
|
211
211
|
|
|
212
212
|
.oxy-step__line {
|
|
213
213
|
margin-left: -1px;
|
|
@@ -216,9 +216,9 @@
|
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
218
|
.oxy-step__content {
|
|
219
|
-
margin-left:
|
|
219
|
+
margin-left: 60rpx;
|
|
220
220
|
margin-top: 0;
|
|
221
|
-
padding-bottom:
|
|
221
|
+
padding-bottom: 40rpx;
|
|
222
222
|
}
|
|
223
223
|
.oxy-step__line {
|
|
224
224
|
top: 0;
|
|
@@ -232,4 +232,4 @@
|
|
|
232
232
|
margin-top: -1px;
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
-
}
|
|
235
|
+
}
|
|
@@ -24,7 +24,7 @@ export default {
|
|
|
24
24
|
<script lang="ts" setup>
|
|
25
25
|
import OxyResize from '../oxy-resize/oxy-resize.vue'
|
|
26
26
|
import { computed, getCurrentInstance, reactive, ref, type CSSProperties } from 'vue'
|
|
27
|
-
import {
|
|
27
|
+
import { getRect, objToStyle, pause, unitConvert, uuid } from '../common/util'
|
|
28
28
|
import { stickyProps } from './types'
|
|
29
29
|
import { useParent } from '../composables/useParent'
|
|
30
30
|
import { STICKY_BOX_KEY } from '../oxy-sticky-box/types'
|
|
@@ -49,8 +49,8 @@ const { proxy } = getCurrentInstance() as any
|
|
|
49
49
|
const rootStyle = computed(() => {
|
|
50
50
|
const style: CSSProperties = {
|
|
51
51
|
'z-index': props.zIndex,
|
|
52
|
-
height:
|
|
53
|
-
width:
|
|
52
|
+
height: unitConvert(stickyState.height, 0, { output: 'px' }),
|
|
53
|
+
width: unitConvert(stickyState.width, 0, { output: 'px' })
|
|
54
54
|
}
|
|
55
55
|
if (!stickyState.boxLeaved) {
|
|
56
56
|
style['position'] = 'relative'
|
|
@@ -61,8 +61,8 @@ const rootStyle = computed(() => {
|
|
|
61
61
|
const stickyStyle = computed(() => {
|
|
62
62
|
const style: CSSProperties = {
|
|
63
63
|
'z-index': props.zIndex,
|
|
64
|
-
height:
|
|
65
|
-
width:
|
|
64
|
+
height: unitConvert(stickyState.height, 0, { output: 'px' }),
|
|
65
|
+
width: unitConvert(stickyState.width, 0, { output: 'px' })
|
|
66
66
|
}
|
|
67
67
|
if (!stickyState.boxLeaved) {
|
|
68
68
|
style['position'] = 'relative'
|
|
@@ -73,7 +73,7 @@ const stickyStyle = computed(() => {
|
|
|
73
73
|
const containerStyle = computed(() => {
|
|
74
74
|
const style: CSSProperties = {
|
|
75
75
|
position: stickyState.position as 'static' | 'relative' | 'absolute' | 'sticky' | 'fixed',
|
|
76
|
-
top:
|
|
76
|
+
top: unitConvert(stickyState.top, 0, { output: 'px' })
|
|
77
77
|
}
|
|
78
78
|
return objToStyle(style)
|
|
79
79
|
})
|
|
@@ -39,7 +39,7 @@ import { getCurrentInstance, inject, onBeforeMount, onBeforeUnmount, onMounted,
|
|
|
39
39
|
import { closeOther, pushToQueue, removeFromQueue } from '../common/clickoutside'
|
|
40
40
|
import { type Queue, queueKey } from '../composables/useQueue'
|
|
41
41
|
import { useTouch } from '../composables/useTouch'
|
|
42
|
-
import { getRect } from '../common/util'
|
|
42
|
+
import { getRect, unitConvert } from '../common/util'
|
|
43
43
|
import { swipeActionProps, type SwipeActionPosition, type SwipeActionReason, type SwipeActionStatus } from './types'
|
|
44
44
|
|
|
45
45
|
const props = defineProps(swipeActionProps)
|
|
@@ -55,6 +55,10 @@ const originOffset = ref<number>(0)
|
|
|
55
55
|
const wrapperOffset = ref<number>(0)
|
|
56
56
|
// 是否处于滑动状态
|
|
57
57
|
const touching = ref<boolean>(false)
|
|
58
|
+
// 标记本次触摸周期是否发生过横向滑动,用于抑制触摸后的合成 click
|
|
59
|
+
const swiping = ref<boolean>(false)
|
|
60
|
+
// 拖拽计算版本号,避免异步获取宽度结果乱序导致位移回退
|
|
61
|
+
const dragVersion = ref<number>(0)
|
|
58
62
|
|
|
59
63
|
const touch = useTouch()
|
|
60
64
|
|
|
@@ -139,7 +143,7 @@ function getWidths() {
|
|
|
139
143
|
*/
|
|
140
144
|
function swipeMove(offset = 0) {
|
|
141
145
|
// this.offset = offset
|
|
142
|
-
const transform = `translate3d(${offset}
|
|
146
|
+
const transform = `translate3d(${unitConvert(offset, 0, { output: 'px' })}, 0, 0)`
|
|
143
147
|
// 跟随手指滑动,不需要动画
|
|
144
148
|
const transition = touching.value ? 'none' : '.6s cubic-bezier(0.18, 0.89, 0.32, 1)'
|
|
145
149
|
wrapperStyle.value = `
|
|
@@ -156,6 +160,11 @@ function swipeMove(offset = 0) {
|
|
|
156
160
|
* @param event
|
|
157
161
|
*/
|
|
158
162
|
function onClick(position?: SwipeActionPosition) {
|
|
163
|
+
if (swiping.value) {
|
|
164
|
+
swiping.value = false
|
|
165
|
+
return
|
|
166
|
+
}
|
|
167
|
+
|
|
159
168
|
if (props.disabled || wrapperOffset.value === 0) {
|
|
160
169
|
return
|
|
161
170
|
}
|
|
@@ -172,6 +181,8 @@ function onClick(position?: SwipeActionPosition) {
|
|
|
172
181
|
function startDrag(event: TouchEvent) {
|
|
173
182
|
if (props.disabled) return
|
|
174
183
|
|
|
184
|
+
dragVersion.value += 1
|
|
185
|
+
swiping.value = false
|
|
175
186
|
originOffset.value = wrapperOffset.value
|
|
176
187
|
touch.touchStart(event)
|
|
177
188
|
if (queue && queue.closeOther) {
|
|
@@ -196,10 +207,17 @@ function onDrag(event: TouchEvent) {
|
|
|
196
207
|
}
|
|
197
208
|
|
|
198
209
|
touching.value = true
|
|
210
|
+
swiping.value = true
|
|
211
|
+
const currentDragVersion = ++dragVersion.value
|
|
199
212
|
|
|
200
213
|
// 本次滑动,wrapper应该设置的偏移量
|
|
201
214
|
const offset = originOffset.value + touch.deltaX.value
|
|
202
215
|
getWidths().then(([leftWidth, rightWidth]) => {
|
|
216
|
+
// 忽略过期的拖拽帧,避免异步返回顺序打乱造成回弹
|
|
217
|
+
if (!touching.value || currentDragVersion !== dragVersion.value) {
|
|
218
|
+
return
|
|
219
|
+
}
|
|
220
|
+
|
|
203
221
|
// 如果需要想滑出来的按钮不存在,对应的按钮肯定滑不出来,容器处于初始状态。此时需要模拟一下位于此处的start事件。
|
|
204
222
|
if ((leftWidth === 0 && offset > 0) || (rightWidth === 0 && offset < 0)) {
|
|
205
223
|
swipeMove(0)
|
|
@@ -224,6 +242,7 @@ function endDrag() {
|
|
|
224
242
|
// 滑出"操作按钮"的阈值
|
|
225
243
|
const THRESHOLD = 0.3
|
|
226
244
|
touching.value = false
|
|
245
|
+
dragVersion.value += 1
|
|
227
246
|
|
|
228
247
|
getWidths().then(([leftWidth, rightWidth]) => {
|
|
229
248
|
if (
|
|
@@ -261,6 +280,12 @@ function endDrag() {
|
|
|
261
280
|
close('swipe')
|
|
262
281
|
}
|
|
263
282
|
})
|
|
283
|
+
|
|
284
|
+
if (swiping.value) {
|
|
285
|
+
setTimeout(() => {
|
|
286
|
+
swiping.value = false
|
|
287
|
+
}, 0)
|
|
288
|
+
}
|
|
264
289
|
}
|
|
265
290
|
/**
|
|
266
291
|
* @description 关闭操过按钮,并在合适的时候调用 beforeClose
|