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
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
// 结算框对角尺寸
|
|
68
|
-
$border-size:
|
|
68
|
+
$border-size: 4rpx;
|
|
69
69
|
|
|
70
70
|
// 节选框的四个角
|
|
71
71
|
.is-left-top,
|
|
@@ -76,14 +76,14 @@
|
|
|
76
76
|
content: "";
|
|
77
77
|
position: absolute;
|
|
78
78
|
width: $border-size;
|
|
79
|
-
height:
|
|
79
|
+
height: 40rpx;
|
|
80
80
|
background-color: #fff;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
&::after {
|
|
84
84
|
content: "";
|
|
85
85
|
position: absolute;
|
|
86
|
-
width:
|
|
86
|
+
width: 40rpx;
|
|
87
87
|
height: $border-size;
|
|
88
88
|
background-color: #fff;
|
|
89
89
|
}
|
|
@@ -184,8 +184,8 @@
|
|
|
184
184
|
@include e(canvas) {
|
|
185
185
|
position: fixed;
|
|
186
186
|
background: white;
|
|
187
|
-
width:
|
|
188
|
-
height:
|
|
187
|
+
width: 300rpx;
|
|
188
|
+
height: 300rpx;
|
|
189
189
|
z-index: 10;
|
|
190
190
|
top: -200%;
|
|
191
191
|
pointer-events: none;
|
|
@@ -194,7 +194,7 @@
|
|
|
194
194
|
@include e(footer) {
|
|
195
195
|
position: fixed;
|
|
196
196
|
z-index: 10;
|
|
197
|
-
bottom:
|
|
197
|
+
bottom: 20rpx;
|
|
198
198
|
width: 100%;
|
|
199
199
|
height: 15vh;
|
|
200
200
|
text-align: center;
|
|
@@ -202,7 +202,7 @@
|
|
|
202
202
|
@include m(button) {
|
|
203
203
|
position: relative;
|
|
204
204
|
text-align: left;
|
|
205
|
-
margin: 0
|
|
205
|
+
margin: 0 40rpx;
|
|
206
206
|
padding-top: 4vh;
|
|
207
207
|
// line-height: 32px;
|
|
208
208
|
box-sizing: border-box;
|
|
@@ -210,16 +210,16 @@
|
|
|
210
210
|
.is-cancel {
|
|
211
211
|
display: inline-block;
|
|
212
212
|
color: #fff;
|
|
213
|
-
font-size:
|
|
213
|
+
font-size: 32rpx;
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
.is-confirm {
|
|
217
217
|
position: absolute;
|
|
218
218
|
right: 0;
|
|
219
219
|
// height: 32px;
|
|
220
|
-
width:
|
|
221
|
-
border-radius:
|
|
222
|
-
font-size:
|
|
220
|
+
width: 112rpx;
|
|
221
|
+
border-radius: 32rpx;
|
|
222
|
+
font-size: 32rpx;
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
}
|
|
@@ -228,4 +228,4 @@
|
|
|
228
228
|
font-size: $-img-cropper-icon-size;
|
|
229
229
|
color: $-img-cropper-icon-color;
|
|
230
230
|
}
|
|
231
|
-
}
|
|
231
|
+
}
|
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
<!-- 画出裁剪框 -->
|
|
7
7
|
<view class="oxy-img-cropper__cut">
|
|
8
8
|
<!-- 上方阴影块 -->
|
|
9
|
-
<view :class="`oxy-img-cropper__cut--top ${IS_TOUCH_END ? '' : 'is-hightlight'}`" :style="`height: ${cutTop}
|
|
10
|
-
<view class="oxy-img-cropper__cut--middle" :style="`height: ${cutHeight}
|
|
9
|
+
<view :class="`oxy-img-cropper__cut--top ${IS_TOUCH_END ? '' : 'is-hightlight'}`" :style="`height: ${toPx(cutTop)};`"></view>
|
|
10
|
+
<view class="oxy-img-cropper__cut--middle" :style="`height: ${toPx(cutHeight)};`">
|
|
11
11
|
<!-- 左侧阴影块 -->
|
|
12
12
|
<view
|
|
13
13
|
:class="`oxy-img-cropper__cut--left ${IS_TOUCH_END ? '' : 'is-hightlight'}`"
|
|
14
|
-
:style="`width: ${cutLeft}
|
|
14
|
+
:style="`width: ${toPx(cutLeft)}; height: ${toPx(cutHeight)};`"
|
|
15
15
|
></view>
|
|
16
16
|
<!-- 裁剪框 -->
|
|
17
|
-
<view class="oxy-img-cropper__cut--body" :style="`width: ${cutWidth}
|
|
17
|
+
<view class="oxy-img-cropper__cut--body" :style="`width: ${toPx(cutWidth)}; height: ${toPx(cutHeight)};`">
|
|
18
18
|
<!-- 内部网格线 -->
|
|
19
19
|
<view class="is-gridlines-x"></view>
|
|
20
20
|
<view class="is-gridlines-y"></view>
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
:id="canvasId"
|
|
53
53
|
class="oxy-img-cropper__canvas"
|
|
54
54
|
:disable-scroll="true"
|
|
55
|
-
:style="`width: ${Number(canvasWidth) * canvasScale}
|
|
55
|
+
:style="`width: ${toPx(Number(canvasWidth) * canvasScale)}; height: ${toPx(Number(canvasHeight) * canvasScale)};`"
|
|
56
56
|
/>
|
|
57
57
|
<!-- 下方按钮 -->
|
|
58
58
|
<view class="oxy-img-cropper__footer">
|
|
@@ -80,7 +80,8 @@ export default {
|
|
|
80
80
|
import OxyIcon from '../oxy-icon/oxy-icon.vue'
|
|
81
81
|
import OxyButton from '../oxy-button/oxy-button.vue'
|
|
82
82
|
import { computed, getCurrentInstance, ref, watch } from 'vue'
|
|
83
|
-
import {
|
|
83
|
+
import { objToStyle, unitConvert, unitConvertWithDefault, uuid } from '../common/util'
|
|
84
|
+
import { useWindowResize, type WindowResizeResult } from '../composables/useWindowResize'
|
|
84
85
|
import { useTranslate } from '../composables/useTranslate'
|
|
85
86
|
import { imgCropperProps, type ImgCropperExpose } from './types'
|
|
86
87
|
|
|
@@ -132,11 +133,12 @@ const imgScale = ref<number>(1)
|
|
|
132
133
|
// imgWidth: null,
|
|
133
134
|
// imgHeight: null,
|
|
134
135
|
// 图片中心轴点距左的距离
|
|
135
|
-
const
|
|
136
|
-
const
|
|
136
|
+
const initialInfo = uni.getSystemInfoSync()
|
|
137
|
+
const imgLeft = ref<number>(initialInfo.windowWidth / 2)
|
|
138
|
+
const imgTop = ref<number>((initialInfo.windowHeight / 2) * TOP_PERCENT)
|
|
137
139
|
|
|
138
140
|
const imgInfo = ref<UniApp.GetImageInfoSuccessData | null>(null)
|
|
139
|
-
const info = ref<UniApp.GetSystemInfoResult>(
|
|
141
|
+
const info = ref<UniApp.GetSystemInfoResult>(initialInfo)
|
|
140
142
|
|
|
141
143
|
// 是否移动中设置 同时控制背景颜色是否高亮
|
|
142
144
|
const IS_TOUCH_END = ref<boolean>(true)
|
|
@@ -157,31 +159,58 @@ const fingerDistance = ref<string | number>('')
|
|
|
157
159
|
const ctx = ref<UniApp.CanvasContext | null>(null)
|
|
158
160
|
|
|
159
161
|
const { proxy } = getCurrentInstance() as any
|
|
162
|
+
const updateSystemInfo = (res?: WindowResizeResult) => {
|
|
163
|
+
const systemInfo = uni.getSystemInfoSync()
|
|
164
|
+
const resizeWidth = Number(res?.size?.windowWidth ?? res?.windowWidth)
|
|
165
|
+
const resizeHeight = Number(res?.size?.windowHeight ?? res?.windowHeight)
|
|
166
|
+
info.value = {
|
|
167
|
+
...systemInfo,
|
|
168
|
+
windowWidth: Number.isFinite(resizeWidth) && resizeWidth > 0 ? resizeWidth : systemInfo.windowWidth,
|
|
169
|
+
windowHeight: Number.isFinite(resizeHeight) && resizeHeight > 0 ? resizeHeight : systemInfo.windowHeight
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function updateCropLayout() {
|
|
174
|
+
INIT_IMGWIDTH = props.imgWidth
|
|
175
|
+
INIT_IMGHEIGHT = props.imgHeight
|
|
176
|
+
|
|
177
|
+
// 根据aspectRatio计算裁剪框尺寸
|
|
178
|
+
const [widthRatio, heightRatio] = props.aspectRatio.split(':').map(Number)
|
|
179
|
+
const tempCutWidth = info.value.windowWidth - offset.value * 2
|
|
180
|
+
const tempCutHeight = (tempCutWidth * heightRatio) / widthRatio
|
|
181
|
+
|
|
182
|
+
cutWidth.value = tempCutWidth
|
|
183
|
+
cutHeight.value = tempCutHeight
|
|
184
|
+
cutTop.value = (info.value.windowHeight * TOP_PERCENT - tempCutHeight) / 2
|
|
185
|
+
cutLeft.value = offset.value
|
|
186
|
+
|
|
187
|
+
canvasScale.value = props.exportScale
|
|
188
|
+
canvasHeight.value = tempCutHeight
|
|
189
|
+
canvasWidth.value = tempCutWidth
|
|
190
|
+
|
|
191
|
+
// 根据开发者设置的图片目标尺寸计算实际尺寸
|
|
192
|
+
initImageSize()
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const handleWindowResize = (res?: WindowResizeResult) => {
|
|
196
|
+
updateSystemInfo(res)
|
|
197
|
+
if (!props.modelValue) return
|
|
198
|
+
|
|
199
|
+
updateCropLayout()
|
|
200
|
+
if (imgInfo.value) {
|
|
201
|
+
computeImgSize()
|
|
202
|
+
resetImg()
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
useWindowResize(handleWindowResize)
|
|
160
207
|
|
|
161
208
|
watch(
|
|
162
209
|
() => props.modelValue,
|
|
163
210
|
(newValue) => {
|
|
164
211
|
if (newValue) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
info.value = uni.getSystemInfoSync()
|
|
168
|
-
|
|
169
|
-
// 根据aspectRatio计算裁剪框尺寸
|
|
170
|
-
const [widthRatio, heightRatio] = props.aspectRatio.split(':').map(Number)
|
|
171
|
-
const tempCutWidth = info.value.windowWidth - offset.value * 2
|
|
172
|
-
const tempCutHeight = (tempCutWidth * heightRatio) / widthRatio
|
|
173
|
-
|
|
174
|
-
cutWidth.value = tempCutWidth
|
|
175
|
-
cutHeight.value = tempCutHeight
|
|
176
|
-
cutTop.value = (info.value.windowHeight * TOP_PERCENT - tempCutHeight) / 2
|
|
177
|
-
cutLeft.value = offset.value
|
|
178
|
-
|
|
179
|
-
canvasScale.value = props.exportScale
|
|
180
|
-
canvasHeight.value = tempCutHeight
|
|
181
|
-
canvasWidth.value = tempCutWidth
|
|
182
|
-
|
|
183
|
-
// 根据开发者设置的图片目标尺寸计算实际尺寸
|
|
184
|
-
initImageSize()
|
|
212
|
+
updateSystemInfo()
|
|
213
|
+
updateCropLayout()
|
|
185
214
|
// 初始化canvas
|
|
186
215
|
initCanvas()
|
|
187
216
|
// 加载图片
|
|
@@ -242,21 +271,25 @@ const buttonStyle = computed(() => {
|
|
|
242
271
|
position: 'absolute',
|
|
243
272
|
right: 0,
|
|
244
273
|
// height: 32px;
|
|
245
|
-
width: '
|
|
246
|
-
'border-radius': '
|
|
247
|
-
'font-size': '
|
|
274
|
+
width: '112rpx',
|
|
275
|
+
'border-radius': '32rpx',
|
|
276
|
+
'font-size': '32rpx'
|
|
248
277
|
}
|
|
249
278
|
|
|
250
279
|
return objToStyle(style)
|
|
251
280
|
})
|
|
252
281
|
|
|
282
|
+
const toPx = (value: string | number | null | undefined) => unitConvert(value, 0, { output: 'px' })
|
|
283
|
+
|
|
253
284
|
const imageStyle = computed(() => {
|
|
254
285
|
const style: Record<string, string | number> = {
|
|
255
|
-
width: picWidth.value ?
|
|
256
|
-
height: picHeight.value ?
|
|
257
|
-
transform: `translate(${
|
|
258
|
-
|
|
259
|
-
|
|
286
|
+
width: picWidth.value ? unitConvert(picWidth.value, 0, { output: 'px' }) : 'auto',
|
|
287
|
+
height: picHeight.value ? unitConvert(picHeight.value, 0, { output: 'px' }) : 'auto',
|
|
288
|
+
transform: `translate(${unitConvert(imgLeft.value - picWidth.value / 2, 0, { output: 'px' })}, ${unitConvert(
|
|
289
|
+
imgTop.value - picHeight.value / 2,
|
|
290
|
+
0,
|
|
291
|
+
{ output: 'px' }
|
|
292
|
+
)}) scale(${imgScale.value}) rotate(${imgAngle.value}deg)`,
|
|
260
293
|
'transition-duration': (isAnimation.value ? 0.4 : 0) + 's'
|
|
261
294
|
}
|
|
262
295
|
return objToStyle(style)
|
|
@@ -305,7 +338,7 @@ function setRoate(angle: number) {
|
|
|
305
338
|
* 初始化图片的大小和角度以及距离
|
|
306
339
|
*/
|
|
307
340
|
function resetImg() {
|
|
308
|
-
const { windowHeight, windowWidth } =
|
|
341
|
+
const { windowHeight, windowWidth } = info.value
|
|
309
342
|
imgScale.value = 1
|
|
310
343
|
imgAngle.value = 0
|
|
311
344
|
imgLeft.value = windowWidth / 2
|
|
@@ -387,21 +420,33 @@ function initCanvas() {
|
|
|
387
420
|
* 图片初始化,处理宽高特殊单位
|
|
388
421
|
*/
|
|
389
422
|
function initImageSize() {
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
423
|
+
const resolveImageLength = (value: number | string | null, base: number): number | null => {
|
|
424
|
+
if (value === null || value === undefined || value === '') return null
|
|
425
|
+
|
|
426
|
+
if (typeof value === 'string') {
|
|
427
|
+
const trimmed = value.trim()
|
|
428
|
+
if (!trimmed) return null
|
|
429
|
+
if (trimmed.endsWith('%')) {
|
|
430
|
+
const percentValue = Number(trimmed.slice(0, -1))
|
|
431
|
+
if (!Number.isFinite(percentValue)) return null
|
|
432
|
+
return (base * percentValue) / 100
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
const converted = unitConvertWithDefault(value, { defaultUnit: 'rpx' })
|
|
437
|
+
return Number.isFinite(converted) && converted > 0 ? converted : null
|
|
397
438
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
picWidth.value =
|
|
403
|
-
}
|
|
404
|
-
|
|
439
|
+
|
|
440
|
+
const resolvedWidth = resolveImageLength(INIT_IMGWIDTH, info.value.windowWidth)
|
|
441
|
+
if (resolvedWidth !== null) {
|
|
442
|
+
INIT_IMGWIDTH = resolvedWidth
|
|
443
|
+
picWidth.value = resolvedWidth
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
const resolvedHeight = resolveImageLength(INIT_IMGHEIGHT, info.value.windowHeight)
|
|
447
|
+
if (resolvedHeight !== null) {
|
|
448
|
+
INIT_IMGHEIGHT = resolvedHeight
|
|
449
|
+
picHeight.value = resolvedHeight
|
|
405
450
|
}
|
|
406
451
|
}
|
|
407
452
|
|
|
@@ -38,11 +38,11 @@ export const imgCropperProps = {
|
|
|
38
38
|
*/
|
|
39
39
|
imgSrc: makeStringProp(''),
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* 图片宽,支持 `px/rpx/%`,number 与纯数字字符串按 rpx 处理
|
|
42
42
|
*/
|
|
43
43
|
imgWidth: makeNumericProp(''),
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* 图片高,支持 `px/rpx/%`,number 与纯数字字符串按 rpx 处理
|
|
46
46
|
*/
|
|
47
47
|
imgHeight: makeNumericProp(''),
|
|
48
48
|
/**
|
|
@@ -64,7 +64,7 @@ export default {
|
|
|
64
64
|
|
|
65
65
|
<script lang="ts" setup>
|
|
66
66
|
import { computed, getCurrentInstance, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
|
67
|
-
import {
|
|
67
|
+
import { withDefaultUnit, isDef, objToStyle } from '../common/util'
|
|
68
68
|
import { imgLazyProps } from './types'
|
|
69
69
|
|
|
70
70
|
const props = defineProps(imgLazyProps)
|
|
@@ -73,10 +73,10 @@ const emit = defineEmits(['show', 'load', 'error', 'destroyed'])
|
|
|
73
73
|
const rootStyle = computed(() => {
|
|
74
74
|
const style: Record<string, string | number> = {}
|
|
75
75
|
if (isDef(props.height)) {
|
|
76
|
-
style['height'] =
|
|
76
|
+
style['height'] = withDefaultUnit(props.height)
|
|
77
77
|
}
|
|
78
78
|
if (isDef(props.width)) {
|
|
79
|
-
style['width'] =
|
|
79
|
+
style['width'] = withDefaultUnit(props.width)
|
|
80
80
|
}
|
|
81
81
|
return `${objToStyle(style)}${props.customStyle}`
|
|
82
82
|
})
|
|
@@ -28,15 +28,15 @@ export const imgLazyProps = {
|
|
|
28
28
|
*/
|
|
29
29
|
mode: makeStringProp<ImageMode>('aspectFill'),
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* 宽度,number 类型按 `rpx` 语义处理,也支持 `px/rpx`
|
|
32
32
|
*/
|
|
33
33
|
width: numericProp,
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* 高度,number 类型按 `rpx` 语义处理,也支持 `px/rpx`
|
|
36
36
|
*/
|
|
37
37
|
height: numericProp,
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* 圆角大小,number 类型按 `rpx` 语义处理,也支持 `px/rpx`
|
|
40
40
|
*/
|
|
41
41
|
borderRadius: makeStringProp('0'),
|
|
42
42
|
/**
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
15
|
<script setup lang="ts">
|
|
16
|
-
import { indexAnchorProps } from './
|
|
16
|
+
import { indexAnchorProps } from './types'
|
|
17
17
|
import { onMounted, getCurrentInstance, ref, computed } from 'vue'
|
|
18
|
-
import { indexBarInjectionKey } from '../oxy-index-bar/
|
|
18
|
+
import { indexBarInjectionKey } from '../oxy-index-bar/types'
|
|
19
19
|
import { getRect, isDef, uuid } from '../common/util'
|
|
20
20
|
import { useParent } from '../composables/useParent'
|
|
21
21
|
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
@include e(sidebar) {
|
|
23
23
|
position: absolute;
|
|
24
24
|
top: 50%;
|
|
25
|
-
right:
|
|
25
|
+
right: 8rpx;
|
|
26
26
|
transform: translateY(-50%);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
@include e(index) {
|
|
30
|
-
font-size:
|
|
30
|
+
font-size: 24rpx;
|
|
31
31
|
font-weight: $-fw-medium;
|
|
32
32
|
color: $-color-title;
|
|
33
|
-
padding:
|
|
33
|
+
padding: 8rpx 12rpx;
|
|
34
34
|
|
|
35
35
|
@include when(active) {
|
|
36
36
|
color: $-color-theme;
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
</template>
|
|
25
25
|
|
|
26
26
|
<script setup lang="ts">
|
|
27
|
-
import type { AnchorIndex } from './
|
|
28
|
-
import { indexBarInjectionKey, indexBarProps } from './
|
|
27
|
+
import type { AnchorIndex } from './types'
|
|
28
|
+
import { indexBarInjectionKey, indexBarProps } from './types'
|
|
29
29
|
import { ref, getCurrentInstance, onMounted, reactive, nextTick, watch } from 'vue'
|
|
30
30
|
import { getRect, isDef, uuid, pause } from '../common/util'
|
|
31
31
|
import { useChildren } from '../composables/useChildren'
|
|
@@ -71,7 +71,7 @@ let offsetTop = 0
|
|
|
71
71
|
let sidebarInfo = {
|
|
72
72
|
// 侧边栏距离顶部的高度
|
|
73
73
|
offsetTop: 0,
|
|
74
|
-
// 高度固定
|
|
74
|
+
// 高度固定48rpx
|
|
75
75
|
indexHeight: 24
|
|
76
76
|
}
|
|
77
77
|
|
|
@@ -6,7 +6,7 @@ export type AnchorIndex = number | string
|
|
|
6
6
|
|
|
7
7
|
export const indexBarProps = {
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* 索引栏是否启用吸顶效果
|
|
10
10
|
*/
|
|
11
11
|
sticky: makeBooleanProp(false)
|
|
12
12
|
}
|
|
@@ -16,7 +16,7 @@ export type IndexBarProps = ExtractPropTypes<typeof indexBarProps>
|
|
|
16
16
|
export type InderBarProvide = {
|
|
17
17
|
props: { sticky?: boolean }
|
|
18
18
|
anchorState: {
|
|
19
|
-
activeIndex: AnchorIndex | null
|
|
19
|
+
activeIndex: AnchorIndex | null
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
&::after {
|
|
46
46
|
position: absolute;
|
|
47
47
|
content: "";
|
|
48
|
-
width: calc(200% -
|
|
49
|
-
height: calc(200% -
|
|
48
|
+
width: calc(200% - 4rpx);
|
|
49
|
+
height: calc(200% - 4rpx);
|
|
50
50
|
left: 0;
|
|
51
51
|
top: 0;
|
|
52
52
|
border: 1px solid $-input-number-border-color;
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
display: block;
|
|
78
78
|
width: $-input-number-input-width;
|
|
79
79
|
height: $-input-number-height;
|
|
80
|
-
padding: 0
|
|
80
|
+
padding: 0 4rpx;
|
|
81
81
|
box-sizing: border-box;
|
|
82
82
|
z-index: 1;
|
|
83
83
|
background: transparent;
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
@include e(input-border) {
|
|
94
94
|
position: absolute;
|
|
95
95
|
width: 100%;
|
|
96
|
-
height: calc(200% -
|
|
96
|
+
height: calc(200% - 4rpx);
|
|
97
97
|
left: 0;
|
|
98
98
|
top: 0;
|
|
99
99
|
border-top: 1px solid $-input-number-border-color;
|
|
@@ -129,4 +129,4 @@
|
|
|
129
129
|
border-left: none;
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
}
|
|
132
|
+
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<view v-if="!withoutInput" class="oxy-input-number__inner" @click.stop="">
|
|
14
14
|
<input
|
|
15
15
|
class="oxy-input-number__input"
|
|
16
|
-
:style="`${inputWidth ? 'width: ' + inputWidth : ''}`"
|
|
16
|
+
:style="`${inputWidth ? 'width: ' + withDefaultUnit(inputWidth) : ''}`"
|
|
17
17
|
:type="inputType"
|
|
18
18
|
:input-mode="precision ? 'decimal' : 'numeric'"
|
|
19
19
|
:disabled="disabled || disableInput"
|
|
@@ -52,7 +52,7 @@ export default {
|
|
|
52
52
|
<script lang="ts" setup>
|
|
53
53
|
import OxyIcon from '../oxy-icon/oxy-icon.vue'
|
|
54
54
|
import { computed, nextTick, ref, watch } from 'vue'
|
|
55
|
-
import { isDef, isEqual } from '../common/util'
|
|
55
|
+
import { isDef, isEqual, withDefaultUnit } from '../common/util'
|
|
56
56
|
import { inputNumberProps, type OperationType } from './types'
|
|
57
57
|
import { callInterceptor } from '../common/interceptor'
|
|
58
58
|
|
|
@@ -57,9 +57,10 @@ export const inputNumberProps = {
|
|
|
57
57
|
*/
|
|
58
58
|
withoutInput: makeBooleanProp(false),
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
60
|
+
* 输入框宽度。
|
|
61
|
+
* number 或纯数字字符串默认按 rpx 处理,支持传入带单位字符串(如 `px`、`rpx`、`%`)。
|
|
61
62
|
*/
|
|
62
|
-
inputWidth: makeNumericProp(
|
|
63
|
+
inputWidth: makeNumericProp(72),
|
|
63
64
|
/**
|
|
64
65
|
* 是否允许为空
|
|
65
66
|
*/
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
user-select: none;
|
|
19
19
|
|
|
20
20
|
@include m(with-title) {
|
|
21
|
-
border-radius:
|
|
21
|
+
border-radius: 40rpx 40rpx 0 0;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
@include e(header) {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
justify-content: center;
|
|
29
29
|
box-sizing: content-box;
|
|
30
30
|
height: $-keyboard-title-height;
|
|
31
|
-
padding-top:
|
|
31
|
+
padding-top: 12rpx;
|
|
32
32
|
color: $-keyboard-title-color;
|
|
33
33
|
font-size: $-keyboard-title-font-size;
|
|
34
34
|
}
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
|
|
46
46
|
@include e(body) {
|
|
47
47
|
display: flex;
|
|
48
|
-
padding:
|
|
48
|
+
padding: 12rpx 0 0 12rpx;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
@include e(keys) {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
&-car {
|
|
58
58
|
@include e(body) {
|
|
59
59
|
display: flex;
|
|
60
|
-
padding:
|
|
60
|
+
padding: 12rpx 0 0 12rpx;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
flex-wrap: wrap;
|
|
69
69
|
|
|
70
70
|
.oxy-key-wrapper {
|
|
71
|
-
--oxy-keyboard-key-font-size:
|
|
71
|
+
--oxy-keyboard-key-font-size: 36rpx;
|
|
72
72
|
flex-basis: 10%;
|
|
73
73
|
|
|
74
74
|
@include m(wider) {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
flex: 1;
|
|
22
22
|
flex-basis: 33%;
|
|
23
23
|
box-sizing: border-box;
|
|
24
|
-
padding: 0
|
|
24
|
+
padding: 0 12rpx 12rpx 0;
|
|
25
25
|
|
|
26
26
|
@include m(wider) {
|
|
27
27
|
flex-basis: 66%;
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
@include m(large) {
|
|
46
46
|
position: absolute;
|
|
47
47
|
top: 0;
|
|
48
|
-
right:
|
|
49
|
-
bottom:
|
|
48
|
+
right: 12rpx;
|
|
49
|
+
bottom: 12rpx;
|
|
50
50
|
left: 0;
|
|
51
51
|
height: auto;
|
|
52
52
|
}
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
<template v-if="text">
|
|
12
12
|
{{ text }}
|
|
13
13
|
</template>
|
|
14
|
-
<oxy-icon v-else custom-class="oxy-key__icon" name="keyboard-delete" size="
|
|
14
|
+
<oxy-icon v-else custom-class="oxy-key__icon" name="keyboard-delete" size="44rpx"></oxy-icon>
|
|
15
15
|
</template>
|
|
16
16
|
<template v-else-if="type === 'extra'">
|
|
17
17
|
<template v-if="text">
|
|
18
18
|
{{ text }}
|
|
19
19
|
</template>
|
|
20
|
-
<oxy-icon v-else custom-class="oxy-key__icon" name="keyboard-collapse" size="
|
|
20
|
+
<oxy-icon v-else custom-class="oxy-key__icon" name="keyboard-collapse" size="44rpx"></oxy-icon>
|
|
21
21
|
</template>
|
|
22
22
|
<template v-else>{{ text }}</template>
|
|
23
23
|
</view>
|
|
@@ -3,9 +3,24 @@ import { makeBooleanProp, makeNumericProp, makeStringProp } from '../../common/p
|
|
|
3
3
|
export type NumberKeyType = '' | 'delete' | 'extra' | 'close'
|
|
4
4
|
|
|
5
5
|
export const keyProps = {
|
|
6
|
+
/**
|
|
7
|
+
* 按键类型
|
|
8
|
+
*/
|
|
6
9
|
type: makeStringProp<NumberKeyType>(''),
|
|
10
|
+
/**
|
|
11
|
+
* 按键显示文本
|
|
12
|
+
*/
|
|
7
13
|
text: makeNumericProp(''),
|
|
14
|
+
/**
|
|
15
|
+
* 是否为加宽按键
|
|
16
|
+
*/
|
|
8
17
|
wider: makeBooleanProp(false),
|
|
18
|
+
/**
|
|
19
|
+
* 是否为大号按键
|
|
20
|
+
*/
|
|
9
21
|
large: makeBooleanProp(false),
|
|
22
|
+
/**
|
|
23
|
+
* 是否显示加载状态
|
|
24
|
+
*/
|
|
10
25
|
loading: makeBooleanProp(false)
|
|
11
26
|
}
|