uview-plus 3.8.49 → 3.8.86
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/changelog.md +2043 -1827
- package/components/u-action-sheet/props.js +3 -1
- package/components/u-action-sheet/u-action-sheet.vue +1 -0
- package/components/u-album/props.js +3 -1
- package/components/u-alert/props.js +4 -2
- package/components/u-avatar/props.js +4 -1
- package/components/u-avatar-group/props.js +4 -1
- package/components/u-back-top/props.js +4 -1
- package/components/u-badge/props.js +4 -1
- package/components/u-barcode/u-barcode.vue +46 -15
- package/components/u-box/props.js +5 -2
- package/components/u-button/props.js +4 -1
- package/components/u-button/vue.scss +3 -3
- package/components/u-calendar/calendar.js +14 -2
- package/components/u-calendar/month.vue +41 -6
- package/components/u-calendar/props.js +63 -1
- package/components/u-calendar/u-calendar.vue +311 -2
- package/components/u-calendar-strip/props.js +3 -1
- package/components/u-canvas/u-canvas.vue +734 -423
- package/components/u-car-keyboard/props.js +3 -1
- package/components/u-card/props.js +3 -1
- package/components/u-cell/props.js +4 -1
- package/components/u-cell/u-cell.vue +1 -1
- package/components/u-cell-group/props.js +4 -1
- package/components/u-checkbox/props.js +4 -1
- package/components/u-checkbox/u-checkbox.vue +7 -3
- package/components/u-checkbox-group/props.js +3 -1
- package/components/u-circle-progress/props.js +4 -1
- package/components/u-code/props.js +4 -1
- package/components/u-code-input/props.js +4 -1
- package/components/u-col/props.js +4 -1
- package/components/u-collapse/props.js +4 -1
- package/components/u-collapse-item/props.js +4 -1
- package/components/u-color-picker/u-color-picker.vue +1 -0
- package/components/u-column-notice/props.js +4 -1
- package/components/u-count-down/props.js +4 -1
- package/components/u-count-to/props.js +4 -1
- package/components/u-cropper/u-cropper.vue +95 -51
- package/components/u-datetime-picker/props.js +4 -1
- package/components/u-divider/props.js +4 -1
- package/components/u-dragsort/u-dragsort.vue +2 -1
- package/components/u-dropdown/props.js +3 -1
- package/components/u-dropdown-item/props.js +3 -1
- package/components/u-empty/props.js +4 -1
- package/components/u-form/props.js +4 -1
- package/components/u-form-item/props.js +4 -1
- package/components/u-gap/props.js +4 -1
- package/components/u-grid/props.js +4 -1
- package/components/u-grid-item/props.js +4 -1
- package/components/u-guide/props.js +3 -1
- package/components/u-icon/props.js +4 -1
- package/components/u-icon/u-icon.vue +2 -2
- package/components/u-icon/upicon.ttf +0 -0
- package/components/u-icon/util.js +29 -7
- package/components/u-image/props.js +4 -1
- package/components/u-image/u-image.vue +280 -267
- package/components/u-index-anchor/props.js +4 -1
- package/components/u-index-item/props.js +2 -1
- package/components/u-index-list/props.js +4 -1
- package/components/u-input/props.js +3 -1
- package/components/u-input/u-input.vue +10 -1
- package/components/u-keyboard/props.js +4 -1
- package/components/u-line/props.js +4 -1
- package/components/u-line-progress/props.js +6 -3
- package/components/u-link/props.js +4 -1
- package/components/u-list/props.js +4 -1
- package/components/u-list-item/props.js +4 -1
- package/components/u-loading-icon/props.js +4 -1
- package/components/u-loading-page/props.js +3 -1
- package/components/u-loadmore/props.js +4 -1
- package/components/u-markdown/u-markdown.vue +45 -3
- package/components/u-modal/props.js +4 -1
- package/components/u-navbar/props.js +4 -2
- package/components/u-navbar/u-navbar.vue +15 -9
- package/components/u-no-network/props.js +4 -1
- package/components/u-notice-bar/props.js +4 -1
- package/components/u-notify/props.js +4 -1
- package/components/u-number-box/props.js +4 -1
- package/components/u-number-box/u-number-box.vue +2 -2
- package/components/u-number-keyboard/props.js +4 -1
- package/components/u-overlay/props.js +4 -1
- package/components/u-pagination/u-pagination.vue +60 -39
- package/components/u-parse/props.js +4 -1
- package/components/u-picker/props.js +4 -1
- package/components/u-picker/u-picker.vue +15 -0
- package/components/u-picker-column/props.js +3 -1
- package/components/u-popover/props.js +2 -1
- package/components/u-popup/props.js +4 -1
- package/components/u-poster/u-poster.vue +29 -14
- package/components/u-qrcode/qrcode.js +88 -87
- package/components/u-qrcode/u-qrcode.vue +138 -256
- package/components/u-radio/props.js +4 -1
- package/components/u-radio/u-radio.vue +7 -3
- package/components/u-radio-group/props.js +4 -1
- package/components/u-rate/props.js +4 -1
- package/components/u-read-more/props.js +4 -1
- package/components/u-row/props.js +4 -1
- package/components/u-row-notice/props.js +4 -1
- package/components/u-safe-bottom/props.js +2 -1
- package/components/u-scroll-list/props.js +4 -1
- package/components/u-search/props.js +3 -1
- package/components/u-skeleton/props.js +4 -1
- package/components/u-slider/props.js +3 -1
- package/components/u-slider/u-slider.vue +70 -28
- package/components/u-status-bar/props.js +4 -1
- package/components/u-steps/props.js +4 -1
- package/components/u-steps-item/props.js +4 -1
- package/components/u-sticky/props.js +4 -1
- package/components/u-sticky/u-sticky.vue +11 -0
- package/components/u-subsection/props.js +3 -1
- package/components/u-swipe-action/props.js +4 -1
- package/components/u-swipe-action-item/props.js +4 -1
- package/components/u-swipe-action-item/u-swipe-action-item.vue +14 -0
- package/components/u-swiper/props.js +9 -1
- package/components/u-swiper/swiper.js +1 -0
- package/components/u-swiper/u-swiper.vue +2 -0
- package/components/u-swiper-indicator/props.js +4 -1
- package/components/u-switch/props.js +4 -1
- package/components/u-tabbar/props.js +3 -1
- package/components/u-tabbar-item/props.js +4 -1
- package/components/u-table/props.js +3 -1
- package/components/u-table2/tableRow.vue +155 -69
- package/components/u-table2/u-table2.vue +328 -140
- package/components/u-tabs/props.js +4 -1
- package/components/u-tabs-item/props.js +3 -1
- package/components/u-tag/props.js +4 -1
- package/components/u-td/props.js +3 -1
- package/components/u-text/props.js +4 -1
- package/components/u-textarea/props.js +3 -1
- package/components/u-textarea/u-textarea.vue +16 -5
- package/components/u-th/props.js +3 -1
- package/components/u-toolbar/props.js +4 -1
- package/components/u-tooltip/props.js +10 -2
- package/components/u-tooltip/tooltip.js +2 -1
- package/components/u-tooltip/u-tooltip.vue +31 -3
- package/components/u-tr/props.js +3 -1
- package/components/u-transition/nvue-ani-map.js +75 -68
- package/components/u-transition/props.js +4 -1
- package/components/u-transition/transitionMixin.js +164 -163
- package/components/u-upload/props.js +4 -1
- package/components/u-upload/u-upload.vue +47 -40
- package/components/u-waterfall/u-waterfall.vue +50 -51
- package/index.js +65 -8
- package/libs/config/props.js +179 -204
- package/libs/css/components.scss +3 -0
- package/libs/function/uni-api-shims.js +29 -0
- package/libs/i18n/index.js +71 -36
- package/libs/i18n/locale-packs.js +11 -0
- package/libs/i18n/locales/all.js +23 -0
- package/libs/i18n/locales/{de.json → de.js} +1 -1
- package/libs/i18n/locales/{en.json → en.js} +2 -2
- package/libs/i18n/locales/{es.json → es.js} +1 -1
- package/libs/i18n/locales/{fr.json → fr.js} +2 -2
- package/libs/i18n/locales/{ja.json → ja.js} +1 -1
- package/libs/i18n/locales/{ko.json → ko.js} +1 -1
- package/libs/i18n/locales/{ru.json → ru.js} +1 -1
- package/libs/i18n/locales/{th.json → th.js} +1 -1
- package/libs/i18n/locales/{zh-Hans.json → zh-Hans.js} +1 -1
- package/libs/i18n/locales/{zh-Hant.json → zh-Hant.js} +1 -1
- package/libs/mixin/mixin.js +14 -4
- package/libs/util/gcanvas/bridge/bridge-weex.js +10 -5
- package/package.json +4 -5
- package/tsconfig.json +18 -0
- package/types/comps/calendar.d.ts +57 -0
- package/types/comps/checkbox.d.ts +12 -0
- package/types/comps/lineProgress.d.ts +5 -0
- package/types/comps/navbar.d.ts +3 -3
- package/types/comps/swiper.d.ts +5 -0
- package/types/comps/tooltip.d.ts +36 -1
- /package/components/u-markdown/{marked.esm.js → marked.esm.mjs} +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import CarKeyboardDefaultProps from './carKeyboard'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
3
4
|
|
|
5
|
+
const defProps = registerComponentProps(CarKeyboardDefaultProps)
|
|
4
6
|
export const props = defineMixin({
|
|
5
7
|
props: {
|
|
6
8
|
// 是否打乱键盘按键的顺序
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import CardDefaultProps from './card'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
3
4
|
|
|
5
|
+
const defProps = registerComponentProps(CardDefaultProps)
|
|
4
6
|
export const propsCard = defineMixin({
|
|
5
7
|
props: {
|
|
6
8
|
// 与屏幕两侧是否留空隙
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import CellDefaultProps from './cell'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
4
|
+
|
|
5
|
+
const defProps = registerComponentProps(CellDefaultProps)
|
|
3
6
|
export const props = defineMixin({
|
|
4
7
|
props: {
|
|
5
8
|
// 标题
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<!-- 将slot与默认内容用if/else分开主要是因为微信小程序不支持slot嵌套传递,这样才能解决collapse组件的slot不失效问题,label暂时未用到。 -->
|
|
16
16
|
<slot name="title" v-if="$slots.title || !title">
|
|
17
17
|
</slot>
|
|
18
|
-
<text v-else class="u-cell__title-text" :style="[
|
|
18
|
+
<text v-else class="u-cell__title-text" :style="[cellTitleDynamicStyle, titleTextStyle]"
|
|
19
19
|
:class="[required && 'u-cell--required', disabled && 'u-cell--disabled', size === 'large' && 'u-cell__title-text--large']">{{ title }}</text>
|
|
20
20
|
<slot name="label">
|
|
21
21
|
<text class="u-cell__label" v-if="label"
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import CellGroupDefaultProps from './cellGroup'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
4
|
+
|
|
5
|
+
const defProps = registerComponentProps(CellGroupDefaultProps)
|
|
3
6
|
export const props = defineMixin({
|
|
4
7
|
props: {
|
|
5
8
|
// 分组标题
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import CheckboxDefaultProps from './checkbox'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
4
|
+
|
|
5
|
+
const defProps = registerComponentProps(CheckboxDefaultProps)
|
|
3
6
|
export const props = defineMixin({
|
|
4
7
|
props: {
|
|
5
8
|
// checkbox的名称
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
:class="iconClasses"
|
|
12
12
|
:style="[iconWrapStyle]"
|
|
13
13
|
>
|
|
14
|
-
<slot name="icon" :elIconSize="elIconSize" :elIconColor="elIconColor">
|
|
14
|
+
<slot name="icon" :elIconSize="elIconSize" :elIconColor="elIconColor" :checked="isChecked" :elDisabled="elDisabled">
|
|
15
15
|
<up-icon
|
|
16
16
|
class="u-checkbox__icon-wrap__icon"
|
|
17
17
|
name="checkbox-mark"
|
|
@@ -149,8 +149,12 @@
|
|
|
149
149
|
if (this.elDisabled) {
|
|
150
150
|
classes.push('u-checkbox__icon-wrap--disabled')
|
|
151
151
|
}
|
|
152
|
-
if (this.isChecked
|
|
153
|
-
|
|
152
|
+
if (this.isChecked) {
|
|
153
|
+
if (this.elDisabled) {
|
|
154
|
+
classes.push('u-checkbox__icon-wrap--disabled--checked')
|
|
155
|
+
} else {
|
|
156
|
+
classes.push('u-checkbox__icon-wrap--checked')
|
|
157
|
+
}
|
|
154
158
|
}
|
|
155
159
|
// 支付宝,头条小程序无法动态绑定一个数组类名,否则解析出来的结果会带有",",而导致失效
|
|
156
160
|
// #ifdef MP-ALIPAY || MP-TOUTIAO
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import CheckboxGroupDefaultProps from './checkboxGroup'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
3
4
|
|
|
5
|
+
const defProps = registerComponentProps(CheckboxGroupDefaultProps)
|
|
4
6
|
export const props = defineMixin({
|
|
5
7
|
props: {
|
|
6
8
|
// 标识符
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import CircleProgressDefaultProps from './circleProgress'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
4
|
+
|
|
5
|
+
const defProps = registerComponentProps(CircleProgressDefaultProps)
|
|
3
6
|
export const props = defineMixin({
|
|
4
7
|
props: {
|
|
5
8
|
percentage: {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import CodeDefaultProps from './code'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
4
|
+
|
|
5
|
+
const defProps = registerComponentProps(CodeDefaultProps)
|
|
3
6
|
export const props = defineMixin({
|
|
4
7
|
props: {
|
|
5
8
|
// 倒计时总秒数
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import CodeInputDefaultProps from './codeInput'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
4
|
+
|
|
5
|
+
const defProps = registerComponentProps(CodeInputDefaultProps)
|
|
3
6
|
export const props = defineMixin({
|
|
4
7
|
props: {
|
|
5
8
|
// 键盘弹起时,是否自动上推页面
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import ColDefaultProps from './col'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
4
|
+
|
|
5
|
+
const defProps = registerComponentProps(ColDefaultProps)
|
|
3
6
|
export const props = defineMixin({
|
|
4
7
|
props: {
|
|
5
8
|
// 占父容器宽度的多少等分,总分为12份
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import CollapseDefaultProps from './collapse'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
4
|
+
|
|
5
|
+
const defProps = registerComponentProps(CollapseDefaultProps)
|
|
3
6
|
export const props = defineMixin({
|
|
4
7
|
props: {
|
|
5
8
|
// 当前展开面板的name,非手风琴模式:[<string | number>],手风琴模式:string | number
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import CollapseItemDefaultProps from './collapseItem'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
4
|
+
|
|
5
|
+
const defProps = registerComponentProps(CollapseItemDefaultProps)
|
|
3
6
|
export const props = defineMixin({
|
|
4
7
|
props: {
|
|
5
8
|
// 标题
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import ColumnNoticeDefaultProps from './columnNotice'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
4
|
+
|
|
5
|
+
const defProps = registerComponentProps(ColumnNoticeDefaultProps)
|
|
3
6
|
export const props = defineMixin({
|
|
4
7
|
props: {
|
|
5
8
|
// 显示的内容,字符串
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import CountDownDefaultProps from './countDown'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
4
|
+
|
|
5
|
+
const defProps = registerComponentProps(CountDownDefaultProps)
|
|
3
6
|
export const props = defineMixin({
|
|
4
7
|
props: {
|
|
5
8
|
// 倒计时时长,单位ms
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import CountToDefaultProps from './countTo'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
4
|
+
|
|
5
|
+
const defProps = registerComponentProps(CountToDefaultProps)
|
|
3
6
|
export const props = defineMixin({
|
|
4
7
|
props: {
|
|
5
8
|
// 开始的数值,默认从0增长到某一个数
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="u-cropper">
|
|
3
3
|
<!-- <image :src="imgSrc.imgSrc" @click="select" :style="[ imgStyle ]" class="my-avatar"></image> -->
|
|
4
|
-
<canvas :canvas-id="'avatar-canvas-' + instanceId"
|
|
5
|
-
<canvas :canvas-id="'oper-canvas-' + instanceId"
|
|
6
|
-
<canvas :canvas-id="'prv-canvas-' + instanceId"
|
|
4
|
+
<up-canvas ref="avatarCanvas" :canvas-id="'avatar-canvas-' + instanceId" class="my-canvas" :width="windowWidth || 0" :height="windowHeight || 0" :style="{ top: styleTop, height: cvsStyleHeight }" bg-color="transparent"></up-canvas>
|
|
5
|
+
<up-canvas ref="operCanvas" :canvas-id="'oper-canvas-' + instanceId" class="oper-canvas" :width="windowWidth || 0" :height="windowHeight || 0" :style="{ top: styleTop, height: cvsStyleHeight }" bg-color="transparent" @touchstart="start" @touchmove="move" @touchend="end"></up-canvas>
|
|
6
|
+
<up-canvas ref="prvCanvas" :canvas-id="'prv-canvas-' + instanceId" class="prv-canvas" :width="windowWidth || 0" :height="windowHeight || 0" bg-color="transparent" @touchstart="hideImg" :style="{ height: cvsStyleHeight, top: prvTop }"></up-canvas>
|
|
7
7
|
<view class="oper-wrapper" :style="{ display: styleDisplay }">
|
|
8
8
|
<view class="oper">
|
|
9
9
|
<view class="btn-wrapper" v-if="showOper">
|
|
@@ -108,9 +108,9 @@
|
|
|
108
108
|
},
|
|
109
109
|
},
|
|
110
110
|
created() {
|
|
111
|
-
this.ctxCanvas =
|
|
112
|
-
this.ctxCanvasOper =
|
|
113
|
-
this.ctxCanvasPrv =
|
|
111
|
+
this.ctxCanvas = null;
|
|
112
|
+
this.ctxCanvasOper = null;
|
|
113
|
+
this.ctxCanvasPrv = null;
|
|
114
114
|
this.qlty = parseInt(this.quality) || 0.9;
|
|
115
115
|
this.imgSrc.imgSrc = this.imageSrc;
|
|
116
116
|
this.letRotate = (this.canRotate === false || this.inner === true) ? 0 : 1;
|
|
@@ -144,8 +144,27 @@
|
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
146
|
},
|
|
147
|
+
mounted() {
|
|
148
|
+
this.initCanvasRefs(true);
|
|
149
|
+
},
|
|
147
150
|
methods: {
|
|
148
151
|
t,
|
|
152
|
+
async initCanvasRefs(force = false) {
|
|
153
|
+
await this.$nextTick();
|
|
154
|
+
const avatarCanvas = this.$refs.avatarCanvas;
|
|
155
|
+
const operCanvas = this.$refs.operCanvas;
|
|
156
|
+
const prvCanvas = this.$refs.prvCanvas;
|
|
157
|
+
if (!avatarCanvas || !operCanvas || !prvCanvas) return false;
|
|
158
|
+
await Promise.all([
|
|
159
|
+
avatarCanvas.initCanvas(force),
|
|
160
|
+
operCanvas.initCanvas(force),
|
|
161
|
+
prvCanvas.initCanvas(force)
|
|
162
|
+
]);
|
|
163
|
+
this.ctxCanvas = avatarCanvas;
|
|
164
|
+
this.ctxCanvasOper = operCanvas;
|
|
165
|
+
this.ctxCanvasPrv = prvCanvas;
|
|
166
|
+
return true;
|
|
167
|
+
},
|
|
149
168
|
windowResize() {
|
|
150
169
|
let sysInfo = uni.getSystemInfoSync();
|
|
151
170
|
this.platform = sysInfo.platform;
|
|
@@ -264,7 +283,7 @@
|
|
|
264
283
|
}
|
|
265
284
|
})
|
|
266
285
|
},
|
|
267
|
-
confirm() {
|
|
286
|
+
async confirm() {
|
|
268
287
|
if (this.fUploading) return;
|
|
269
288
|
this.fUploading = true;
|
|
270
289
|
setTimeout(() => { this.fUploading = false; }, 1000)
|
|
@@ -289,35 +308,34 @@
|
|
|
289
308
|
this.styleTop = '-10000px';
|
|
290
309
|
this.hasSel = false;
|
|
291
310
|
this.hideImg();
|
|
292
|
-
|
|
311
|
+
await this.initCanvasRefs();
|
|
312
|
+
this.ctxCanvas.toTempFilePath({
|
|
293
313
|
x: x,
|
|
294
314
|
y: y,
|
|
295
315
|
width: width,
|
|
296
316
|
height: height,
|
|
297
317
|
destWidth: expWidth,
|
|
298
318
|
destHeight: expHeight,
|
|
299
|
-
canvasId: 'avatar-canvas-' + this.instanceId,
|
|
300
319
|
fileType: 'png',
|
|
301
320
|
quality: this.qlty,
|
|
302
321
|
success: (r) => {
|
|
303
322
|
r = r.tempFilePath;
|
|
304
323
|
// #ifdef H5
|
|
305
|
-
this.btop(r).then((r) => {
|
|
324
|
+
this.btop(r).then(async (r) => {
|
|
306
325
|
if (this.expWidth && this.expHeight) {
|
|
307
326
|
let ctxCanvas = this.ctxCanvas;
|
|
308
327
|
expWidth = this.expWidth,
|
|
309
328
|
expHeight = this.expHeight;
|
|
310
329
|
|
|
311
|
-
ctxCanvas.drawImage(r, 0, 0, expWidth, expHeight);
|
|
330
|
+
await ctxCanvas.drawImage(r, 0, 0, expWidth, expHeight);
|
|
312
331
|
ctxCanvas.draw(false, () => {
|
|
313
|
-
|
|
332
|
+
ctxCanvas.toTempFilePath({
|
|
314
333
|
x: 0,
|
|
315
334
|
y: 0,
|
|
316
335
|
width: expWidth,
|
|
317
336
|
height: expHeight,
|
|
318
337
|
destWidth: expWidth,
|
|
319
338
|
destHeight: expHeight,
|
|
320
|
-
canvasId: 'avatar-canvas-' + this.instanceId,
|
|
321
339
|
fileType: 'png',
|
|
322
340
|
quality: this.qlty,
|
|
323
341
|
success: (r) => {
|
|
@@ -353,10 +371,10 @@
|
|
|
353
371
|
uni.hideLoading();
|
|
354
372
|
this.noBar || uni.showTabBar();
|
|
355
373
|
}
|
|
356
|
-
}
|
|
374
|
+
});
|
|
357
375
|
},
|
|
358
376
|
// 用户点击"预览"模式下的"确认"按钮时被调用,用于将预览的裁剪结果上传
|
|
359
|
-
prvUpload() {
|
|
377
|
+
async prvUpload() {
|
|
360
378
|
if (this.fPrvUploading) return;
|
|
361
379
|
this.fPrvUploading = true;
|
|
362
380
|
setTimeout(() => { this.fPrvUploading = false; }, 1000)
|
|
@@ -384,35 +402,34 @@
|
|
|
384
402
|
this.styleTop = '-10000px';
|
|
385
403
|
this.hasSel = false;
|
|
386
404
|
this.hideImg();
|
|
387
|
-
|
|
405
|
+
await this.initCanvasRefs();
|
|
406
|
+
this.ctxCanvasPrv.toTempFilePath({
|
|
388
407
|
x: prvX,
|
|
389
408
|
y: prvY,
|
|
390
409
|
width: prvWidth,
|
|
391
410
|
height: prvHeight,
|
|
392
411
|
destWidth: expWidth,
|
|
393
412
|
destHeight: expHeight,
|
|
394
|
-
canvasId: 'prv-canvas-' + this.instanceId,
|
|
395
413
|
fileType: 'png',
|
|
396
414
|
quality: this.qlty,
|
|
397
415
|
success: (r) => {
|
|
398
416
|
r = r.tempFilePath;
|
|
399
417
|
// #ifdef H5
|
|
400
|
-
this.btop(r).then((r) => {
|
|
418
|
+
this.btop(r).then(async (r) => {
|
|
401
419
|
if (this.expWidth && this.expHeight) {
|
|
402
420
|
let ctxCanvas = this.ctxCanvas;
|
|
403
421
|
expWidth = this.expWidth,
|
|
404
422
|
expHeight = this.expHeight;
|
|
405
423
|
|
|
406
|
-
ctxCanvas.drawImage(r, 0, 0, expWidth, expHeight);
|
|
424
|
+
await ctxCanvas.drawImage(r, 0, 0, expWidth, expHeight);
|
|
407
425
|
ctxCanvas.draw(false, () => {
|
|
408
|
-
|
|
426
|
+
ctxCanvas.toTempFilePath({
|
|
409
427
|
x: 0,
|
|
410
428
|
y: 0,
|
|
411
429
|
width: expWidth,
|
|
412
430
|
height: expHeight,
|
|
413
431
|
destWidth: expWidth,
|
|
414
432
|
destHeight: expHeight,
|
|
415
|
-
canvasId: 'avatar-canvas-' + this.instanceId,
|
|
416
433
|
fileType: 'png',
|
|
417
434
|
quality: this.qlty,
|
|
418
435
|
success: (r) => {
|
|
@@ -448,9 +465,10 @@
|
|
|
448
465
|
uni.hideLoading();
|
|
449
466
|
this.noBar || uni.showTabBar();
|
|
450
467
|
}
|
|
451
|
-
}
|
|
468
|
+
});
|
|
452
469
|
},
|
|
453
|
-
drawInit(ini = false) {
|
|
470
|
+
async drawInit(ini = false) {
|
|
471
|
+
await this.initCanvasRefs();
|
|
454
472
|
let allWidth = this.windowWidth,
|
|
455
473
|
allHeight = this.windowHeight,
|
|
456
474
|
imgWidth = this.imgWidth,
|
|
@@ -597,7 +615,8 @@
|
|
|
597
615
|
|
|
598
616
|
this.$emit("avtinit");
|
|
599
617
|
},
|
|
600
|
-
drawImage() {
|
|
618
|
+
async drawImage() {
|
|
619
|
+
await this.initCanvasRefs();
|
|
601
620
|
let tm_now = Date.now();
|
|
602
621
|
if (tm_now - this.drawTm < 20) return;
|
|
603
622
|
this.drawTm = tm_now;
|
|
@@ -605,10 +624,12 @@
|
|
|
605
624
|
if (this.fillColor && this.fillColor !== 'transparent') {
|
|
606
625
|
ctxCanvas.fillRect(0, 0, this.windowWidth, this.windowHeight - tabHeight);
|
|
607
626
|
}
|
|
627
|
+
ctxCanvas.save();
|
|
608
628
|
ctxCanvas.translate(this.posWidth + this.useWidth / 2, this.posHeight + this.useHeight / 2);
|
|
609
629
|
ctxCanvas.scale(this.scaleSize, this.scaleSize);
|
|
610
630
|
ctxCanvas.rotate(this.rotateDeg * Math.PI / 180);
|
|
611
|
-
ctxCanvas.drawImage(this.imgPath, -this.useWidth / 2, -this.useHeight / 2, this.useWidth, this.useHeight);
|
|
631
|
+
await ctxCanvas.drawImage(this.imgPath, -this.useWidth / 2, -this.useHeight / 2, this.useWidth, this.useHeight);
|
|
632
|
+
ctxCanvas.restore();
|
|
612
633
|
ctxCanvas.draw(false);
|
|
613
634
|
},
|
|
614
635
|
hideImg() {
|
|
@@ -628,7 +649,7 @@
|
|
|
628
649
|
this.noBar || uni.showTabBar();
|
|
629
650
|
this.$emit('cancel');
|
|
630
651
|
},
|
|
631
|
-
preview() {
|
|
652
|
+
async preview() {
|
|
632
653
|
if (this.fPreviewing) return;
|
|
633
654
|
this.fPreviewing = true;
|
|
634
655
|
setTimeout(() => { this.fPreviewing = false; }, 1000);
|
|
@@ -640,15 +661,15 @@
|
|
|
640
661
|
|
|
641
662
|
uni.showLoading({ mask: true });
|
|
642
663
|
// console.log('size', x, y, width, height)
|
|
643
|
-
|
|
664
|
+
await this.initCanvasRefs();
|
|
665
|
+
this.ctxCanvas.toTempFilePath({
|
|
644
666
|
x: x,
|
|
645
667
|
y: y,
|
|
646
668
|
width: width,
|
|
647
669
|
height: height,
|
|
648
|
-
canvasId: 'avatar-canvas-' + this.instanceId,
|
|
649
670
|
fileType: 'png',
|
|
650
671
|
quality: this.qlty,
|
|
651
|
-
success: (r) => {
|
|
672
|
+
success: async (r) => {
|
|
652
673
|
// console.log(r)
|
|
653
674
|
this.prvImgTmp = r = r.tempFilePath;
|
|
654
675
|
|
|
@@ -678,7 +699,7 @@
|
|
|
678
699
|
this.prvY = prvY = (prvY - prvHeight) / 2;
|
|
679
700
|
this.prvWidth = prvWidth;
|
|
680
701
|
this.prvHeight = prvHeight;
|
|
681
|
-
ctxCanvasPrv.drawImage(r, prvX, prvY, prvWidth, prvHeight);
|
|
702
|
+
await ctxCanvasPrv.drawImage(r, prvX, prvY, prvWidth, prvHeight);
|
|
682
703
|
ctxCanvasPrv.draw(false, () => {
|
|
683
704
|
// #ifdef H5
|
|
684
705
|
this.btop(this.prvImgTmp).then((r) => {
|
|
@@ -703,7 +724,7 @@
|
|
|
703
724
|
complete: () => {
|
|
704
725
|
uni.hideLoading();
|
|
705
726
|
}
|
|
706
|
-
}
|
|
727
|
+
});
|
|
707
728
|
},
|
|
708
729
|
chooseImage(index = undefined, params = undefined, data = undefined) {
|
|
709
730
|
if (params) {
|
|
@@ -725,7 +746,8 @@
|
|
|
725
746
|
|
|
726
747
|
expWidth && (this.expWidth = expWidth.indexOf('rpx') >= 0 ? parseInt(expWidth) * this.pxRatio : parseInt(expWidth));
|
|
727
748
|
expHeight && (this.expHeight = expHeight.indexOf('rpx') >= 0 ? parseInt(expHeight) * this.pxRatio : parseInt(expHeight));
|
|
728
|
-
this.
|
|
749
|
+
this.isin = inner === true ? 1 : 0;
|
|
750
|
+
this.letRotate = (canRotate === false || this.isin) ? 0 : 1;
|
|
729
751
|
this.letScale = canScale === false ? 0 : 1;
|
|
730
752
|
// 设置是否允许调整裁剪框大小
|
|
731
753
|
this.letChangeSize = canChangeSize || false;
|
|
@@ -733,7 +755,6 @@
|
|
|
733
755
|
this.mnScale = minScale || 0.3;
|
|
734
756
|
this.mxScale = maxScale || 4;
|
|
735
757
|
this.stc = stretch;
|
|
736
|
-
this.isin = inner === true ? 1 : 0;
|
|
737
758
|
this.lck = lock;
|
|
738
759
|
if (this.isin) {
|
|
739
760
|
this.btnWidth = '24%';
|
|
@@ -893,17 +914,41 @@
|
|
|
893
914
|
break;
|
|
894
915
|
}
|
|
895
916
|
|
|
896
|
-
//
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
917
|
+
// 约束裁剪框:最小尺寸、屏幕边界,inner 模式下再限制在图片内
|
|
918
|
+
let nl = parseInt(style.left);
|
|
919
|
+
let nt = parseInt(style.top);
|
|
920
|
+
let nw = parseInt(style.width);
|
|
921
|
+
let nh = parseInt(style.height);
|
|
922
|
+
|
|
923
|
+
// 屏幕边界
|
|
924
|
+
if (nl < 0) nl = 0;
|
|
925
|
+
if (nt < 0) nt = 0;
|
|
926
|
+
if (nl + nw > this.windowWidth) nw = this.windowWidth - nl;
|
|
927
|
+
if (nt + nh > this.windowHeight - tabHeight) nh = this.windowHeight - tabHeight - nt;
|
|
928
|
+
|
|
929
|
+
if (this.isin) {
|
|
930
|
+
const imgWidth = this.useWidth * this.scaleSize;
|
|
931
|
+
const imgHeight = this.useHeight * this.scaleSize;
|
|
932
|
+
const rx0 = this.posWidth + this.useWidth / 2;
|
|
933
|
+
const ry0 = this.posHeight + this.useHeight / 2;
|
|
934
|
+
const imgL = rx0 - imgWidth / 2;
|
|
935
|
+
const imgT = ry0 - imgHeight / 2;
|
|
936
|
+
const imgR = imgL + imgWidth;
|
|
937
|
+
const imgB = imgT + imgHeight;
|
|
938
|
+
if (nl < imgL) nl = imgL;
|
|
939
|
+
if (nt < imgT) nt = imgT;
|
|
940
|
+
if (nl + nw > imgR) nw = imgR - nl;
|
|
941
|
+
if (nt + nh > imgB) nh = imgB - nt;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
if (nw >= minWidth && nh >= minHeight) {
|
|
945
|
+
style.left = nl + 'px';
|
|
946
|
+
style.top = nt + 'px';
|
|
947
|
+
style.width = nw + 'px';
|
|
948
|
+
style.height = nh + 'px';
|
|
949
|
+
this.selStyle = style;
|
|
950
|
+
// 重新绘制操作层
|
|
951
|
+
this.drawInit();
|
|
907
952
|
}
|
|
908
953
|
} else {
|
|
909
954
|
// 原有的移动图片逻辑
|
|
@@ -962,7 +1007,8 @@
|
|
|
962
1007
|
this.resizeHandle = null; // 重置调整手柄
|
|
963
1008
|
}
|
|
964
1009
|
},
|
|
965
|
-
getImgData() {
|
|
1010
|
+
async getImgData() {
|
|
1011
|
+
await this.initCanvasRefs();
|
|
966
1012
|
return new Promise((resolve, reject) => {
|
|
967
1013
|
let prvX = this.prvX,
|
|
968
1014
|
prvY = this.prvY,
|
|
@@ -974,8 +1020,7 @@
|
|
|
974
1020
|
prvWidth *= this.pixelRatio;
|
|
975
1021
|
prvHeight *= this.pixelRatio;
|
|
976
1022
|
// #endif
|
|
977
|
-
|
|
978
|
-
canvasId: 'prv-canvas-' + this.instanceId,
|
|
1023
|
+
this.ctxCanvasPrv.getImageData({
|
|
979
1024
|
x: prvX,
|
|
980
1025
|
y: prvY,
|
|
981
1026
|
width: prvWidth,
|
|
@@ -986,7 +1031,7 @@
|
|
|
986
1031
|
fail(err) {
|
|
987
1032
|
reject(err);
|
|
988
1033
|
}
|
|
989
|
-
}
|
|
1034
|
+
});
|
|
990
1035
|
});
|
|
991
1036
|
},
|
|
992
1037
|
async colorChange(e) {
|
|
@@ -1110,8 +1155,7 @@
|
|
|
1110
1155
|
prvWidth *= this.pixelRatio;
|
|
1111
1156
|
prvHeight *= this.pixelRatio;
|
|
1112
1157
|
// #endif
|
|
1113
|
-
|
|
1114
|
-
canvasId: 'prv-canvas-' + this.instanceId,
|
|
1158
|
+
this.ctxCanvasPrv.putImageData({
|
|
1115
1159
|
x: prvX,
|
|
1116
1160
|
y: prvY,
|
|
1117
1161
|
width: prvWidth,
|
|
@@ -1126,7 +1170,7 @@
|
|
|
1126
1170
|
complete() {
|
|
1127
1171
|
uni.hideLoading();
|
|
1128
1172
|
}
|
|
1129
|
-
}
|
|
1173
|
+
});
|
|
1130
1174
|
},
|
|
1131
1175
|
btop(base64) {
|
|
1132
1176
|
return new Promise(function (resolve, reject) {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import DatetimePickerDefaultProps from './datetimePicker'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
4
|
+
|
|
5
|
+
const defProps = registerComponentProps(DatetimePickerDefaultProps)
|
|
3
6
|
export const props = defineMixin({
|
|
4
7
|
props: {
|
|
5
8
|
// 是否显示input
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import DividerDefaultProps from './divider'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
4
|
+
|
|
5
|
+
const defProps = registerComponentProps(DividerDefaultProps)
|
|
3
6
|
export const props = defineMixin({
|
|
4
7
|
props: {
|
|
5
8
|
// 是否虚线
|
|
@@ -212,7 +212,8 @@ export default {
|
|
|
212
212
|
if (this.$slots.handler && e.currentTarget.dataset.action !== 'handler') {
|
|
213
213
|
return
|
|
214
214
|
}
|
|
215
|
-
|
|
215
|
+
// 全局禁用或单项禁用时,不进入拖拽态,避免 Android 上小范围漂浮/阴影
|
|
216
|
+
if (!this.draggable || this.list[index]?.draggable === false) return;
|
|
216
217
|
if (this.timer) clearTimeout(this.timer);
|
|
217
218
|
this.sortChanged = false;
|
|
218
219
|
this.dragIndex = index;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
3
|
+
|
|
4
|
+
const defProps = registerComponentProps({ dropdown: {} })
|
|
3
5
|
export const props = defineMixin({
|
|
4
6
|
props: {
|
|
5
7
|
// 菜单标题和选项的激活态颜色
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
3
|
+
|
|
4
|
+
const defProps = registerComponentProps({ dropdownItem: {} })
|
|
3
5
|
export const props = defineMixin({
|
|
4
6
|
props: {
|
|
5
7
|
// #ifdef VUE3
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import EmptyDefaultProps from './empty'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
4
|
+
|
|
5
|
+
const defProps = registerComponentProps(EmptyDefaultProps)
|
|
3
6
|
export const props = defineMixin({
|
|
4
7
|
props: {
|
|
5
8
|
// 内置图标名称,或图片路径,建议绝对路径
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import FormDefaultProps from './form'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
4
|
+
|
|
5
|
+
const defProps = registerComponentProps(FormDefaultProps)
|
|
3
6
|
export const props = defineMixin({
|
|
4
7
|
props: {
|
|
5
8
|
// 当前form的需要验证字段的集合
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { defineMixin } from '../../libs/vue'
|
|
2
|
-
import
|
|
2
|
+
import FormItemDefaultProps from './formItem'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
4
|
+
|
|
5
|
+
const defProps = registerComponentProps(FormItemDefaultProps)
|
|
3
6
|
export const props = defineMixin({
|
|
4
7
|
props: {
|
|
5
8
|
// input的label提示语
|