uview-pro 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +23 -0
- package/components/u-action-sheet/u-action-sheet.vue +10 -3
- package/components/u-alert-tips/u-alert-tips.vue +13 -2
- package/components/u-avatar/u-avatar.vue +16 -2
- package/components/u-avatar-cropper/weCropper.js +36 -8
- package/components/u-avatar-cropper/weCropper.ts +28 -7
- package/components/u-back-top/u-back-top.vue +4 -1
- package/components/u-button/u-button.vue +11 -1
- package/components/u-calendar/types.ts +3 -1
- package/components/u-calendar/u-calendar.vue +172 -17
- package/components/u-car-keyboard/u-car-keyboard.vue +22 -3
- package/components/u-cell-item/u-cell-item.vue +13 -2
- package/components/u-checkbox/u-checkbox.vue +10 -13
- package/components/u-circle-progress/u-circle-progress.vue +6 -2
- package/components/u-city-select/u-city-select.vue +32 -4
- package/components/u-collapse/u-collapse.vue +0 -9
- package/components/u-collapse-item/u-collapse-item.vue +21 -47
- package/components/u-column-notice/u-column-notice.vue +40 -6
- package/components/u-count-down/u-count-down.vue +20 -4
- package/components/u-count-to/u-count-to.vue +9 -2
- package/components/u-divider/u-divider.vue +10 -2
- package/components/u-dropdown/u-dropdown.vue +16 -3
- package/components/u-dropdown-item/u-dropdown-item.vue +6 -1
- package/components/u-field/u-field.vue +23 -4
- package/components/u-form/u-form.vue +5 -1
- package/components/u-form-item/u-form-item.vue +37 -7
- package/components/u-full-screen/u-full-screen.vue +8 -1
- package/components/u-grid-item/u-grid-item.vue +5 -1
- package/components/u-icon/u-icon.vue +15 -2
- package/components/u-image/u-image.vue +10 -2
- package/components/u-input/u-input.vue +19 -4
- package/components/u-keyboard/u-keyboard.vue +13 -2
- package/components/u-lazy-load/u-lazy-load.vue +10 -8
- package/components/u-line-progress/u-line-progress.vue +9 -1
- package/components/u-loading/u-loading.vue +7 -1
- package/components/u-loadmore/u-loadmore.vue +6 -1
- package/components/u-message-input/u-message-input.vue +19 -4
- package/components/u-modal/u-modal.vue +8 -1
- package/components/u-navbar/u-navbar.vue +18 -4
- package/components/u-no-network/u-no-network.vue +3 -1
- package/components/u-notice-bar/u-notice-bar.vue +6 -1
- package/components/u-number-keyboard/u-number-keyboard.vue +19 -6
- package/components/u-picker/u-picker.vue +49 -10
- package/components/u-popup/u-popup.vue +19 -3
- package/components/u-radio/u-radio.vue +19 -5
- package/components/u-radio-group/u-radio-group.vue +11 -1
- package/components/u-read-more/u-read-more.vue +7 -1
- package/components/u-row-notice/u-row-notice.vue +37 -6
- package/components/u-search/u-search.vue +14 -2
- package/components/u-section/u-section.vue +7 -1
- package/components/u-select/u-select.vue +22 -5
- package/components/u-skeleton/u-skeleton.vue +18 -3
- package/components/u-slider/u-slider.vue +11 -2
- package/components/u-steps/u-steps.vue +11 -2
- package/components/u-sticky/u-sticky.vue +4 -1
- package/components/u-swipe-action/u-swipe-action.vue +8 -1
- package/components/u-swiper/u-swiper.vue +31 -6
- package/components/u-switch/u-switch.vue +6 -1
- package/components/u-tabbar/u-tabbar.vue +22 -4
- package/components/u-tabs/u-tabs.vue +8 -1
- package/components/u-tabs-swiper/u-tabs-swiper.vue +21 -3
- package/components/u-tag/u-tag.vue +9 -1
- package/components/u-text/types.ts +4 -1
- package/components/u-text/u-text.vue +18 -3
- package/components/u-upload/types.ts +8 -2
- package/components/u-upload/u-upload.vue +17 -3
- package/iconfont.css +2 -1
- package/libs/css/style.vue.scss +1 -1
- package/libs/function/$parent.ts +4 -1
- package/libs/function/colorGradient.ts +18 -4
- package/libs/function/deepMerge.ts +2 -1
- package/libs/function/getParent.ts +5 -1
- package/libs/function/md5.ts +17 -5
- package/libs/function/queryParams.ts +5 -1
- package/libs/function/test.ts +7 -3
- package/libs/function/timeFormat.ts +2 -1
- package/libs/function/type2icon.ts +4 -1
- package/libs/hooks/useComponent.ts +485 -69
- package/libs/hooks/useEmitter.ts +4 -2
- package/libs/request/index.ts +24 -5
- package/libs/util/async-validator.d.ts +16 -3
- package/libs/util/emitter.ts +12 -2
- package/libs/util/mitt.ts +4 -1
- package/package.json +1 -1
- package/readme.md +1 -1
package/changelog.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
## 0.2.4(2025-10-08)
|
|
2
|
+
|
|
3
|
+
### 🐛 Bug Fixes | Bug 修复
|
|
4
|
+
|
|
5
|
+
- **i18n:** 修复切换中英文切换失效问题 ([d61d817](https://github.com/anyup/uView-Pro/commit/d61d81790aecd774435999c9ab8c3672a2df38ad))
|
|
6
|
+
- **style:** 修复文本溢出样式u-line-1生成错误问题 ([5d2bf3c](https://github.com/anyup/uView-Pro/commit/5d2bf3ca080f8c5bc9fe40bb1f421c28f7ee8017))
|
|
7
|
+
|
|
8
|
+
### ✨ Features | 新功能
|
|
9
|
+
|
|
10
|
+
- **calendar:** 增加日历组件的页面显示模式 ([af13724](https://github.com/anyup/uView-Pro/commit/af137241e644a5f1e99b07e580c8d3aca9250e9e))
|
|
11
|
+
|
|
12
|
+
### ♻️ Code Refactoring | 代码重构
|
|
13
|
+
|
|
14
|
+
- 优化代码格式和可读性 ([2e338d5](https://github.com/anyup/uView-Pro/commit/2e338d5cb2dbf3ce42f38c9581c04164b852f992))
|
|
15
|
+
- **useComponent:** 重构组件事件处理并添加热更新支持 ([80f7e5e](https://github.com/anyup/uView-Pro/commit/80f7e5efaa2b2ab1668969072cb6d18652d00cc2))
|
|
16
|
+
- **u-collapse:** 重构 u-collapse 组件中的事件处理逻辑 ([6aadfd1](https://github.com/anyup/uView-Pro/commit/6aadfd16d5aefd45f022c8da1612ba1921942f6e))
|
|
17
|
+
- **u-checkbox:** 优化复选框组件的父组件事件处理 ([3b597ea](https://github.com/anyup/uView-Pro/commit/3b597ea2833ca71e5752d097b2f07c143869f0d2))
|
|
18
|
+
- **hooks:** 优化 useComponent 以支持页面级别组件关系管理 ([429192f](https://github.com/anyup/uView-Pro/commit/429192f66ba59a26acb957acfc01d5f318d43fb6))
|
|
19
|
+
|
|
20
|
+
### 📝 Documentation | 文档
|
|
21
|
+
|
|
22
|
+
- 更新微信交流群图片链接 ([e67588a](https://github.com/anyup/uView-Pro/commit/e67588ae392d5150ec4d271ce45e65fe32372460))
|
|
23
|
+
|
|
1
24
|
## 0.2.3(2025-10-06)
|
|
2
25
|
|
|
3
26
|
### 🐛 Bug Fixes | Bug 修复
|
|
@@ -27,9 +27,16 @@
|
|
|
27
27
|
</view>
|
|
28
28
|
</block>
|
|
29
29
|
<view class="u-gab" v-if="cancelBtn"> </view>
|
|
30
|
-
<view
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
<view
|
|
31
|
+
@touchmove.stop.prevent
|
|
32
|
+
class="u-actionsheet-cancel u-action-sheet-item"
|
|
33
|
+
hover-class="u-hover-class"
|
|
34
|
+
:hover-stay-time="150"
|
|
35
|
+
v-if="cancelBtn"
|
|
36
|
+
@tap="close"
|
|
37
|
+
>
|
|
38
|
+
{{ cancelText }}
|
|
39
|
+
</view>
|
|
33
40
|
</u-popup>
|
|
34
41
|
</template>
|
|
35
42
|
|
|
@@ -2,14 +2,25 @@
|
|
|
2
2
|
<view
|
|
3
3
|
class="u-alert-tips"
|
|
4
4
|
v-if="show"
|
|
5
|
-
:class="[
|
|
5
|
+
:class="[
|
|
6
|
+
!show ? 'u-close-alert-tips' : '',
|
|
7
|
+
type ? 'u-alert-tips--bg--' + type + '-light' : '',
|
|
8
|
+
type ? 'u-alert-tips--border--' + type + '-disabled' : ''
|
|
9
|
+
]"
|
|
6
10
|
:style="{
|
|
7
11
|
backgroundColor: bgColor,
|
|
8
12
|
borderColor: borderColor
|
|
9
13
|
}"
|
|
10
14
|
>
|
|
11
15
|
<view class="u-icon-wrap">
|
|
12
|
-
<u-icon
|
|
16
|
+
<u-icon
|
|
17
|
+
v-if="showIcon"
|
|
18
|
+
:name="uIconName"
|
|
19
|
+
:size="description ? 40 : 32"
|
|
20
|
+
class="u-icon"
|
|
21
|
+
:color="uIconType"
|
|
22
|
+
:custom-style="iconStyle"
|
|
23
|
+
></u-icon>
|
|
13
24
|
</view>
|
|
14
25
|
<view class="u-alert-content" @tap.stop="onClick">
|
|
15
26
|
<view class="u-alert-title" :style="uTitleStyle">
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="u-avatar" :style="wrapStyle" @tap="onClick">
|
|
3
|
-
<image
|
|
3
|
+
<image
|
|
4
|
+
@error="onLoadError"
|
|
5
|
+
:style="imgStyle"
|
|
6
|
+
class="u-avatar__img"
|
|
7
|
+
v-if="!uText && avatar"
|
|
8
|
+
:src="avatar"
|
|
9
|
+
:mode="imgMode"
|
|
10
|
+
></image>
|
|
4
11
|
<text class="u-line-1" v-else-if="uText" :style="{ fontSize: '38rpx' }">{{ uText }}</text>
|
|
5
12
|
<slot v-else></slot>
|
|
6
13
|
<view class="u-avatar__sex" v-if="showSex" :class="['u-avatar__sex--' + sexIcon]" :style="uSexStyle">
|
|
@@ -69,7 +76,14 @@ watch(
|
|
|
69
76
|
*/
|
|
70
77
|
const wrapStyle = computed(() => {
|
|
71
78
|
let style: Record<string, string> = {};
|
|
72
|
-
style.height =
|
|
79
|
+
style.height =
|
|
80
|
+
props.size === 'large'
|
|
81
|
+
? '120rpx'
|
|
82
|
+
: props.size === 'default'
|
|
83
|
+
? '90rpx'
|
|
84
|
+
: props.size === 'mini'
|
|
85
|
+
? '70rpx'
|
|
86
|
+
: props.size + 'rpx';
|
|
73
87
|
style.width = style.height;
|
|
74
88
|
style.flex = `0 0 ${style.height}`;
|
|
75
89
|
style.backgroundColor = props.bgColor;
|
|
@@ -240,7 +240,14 @@
|
|
|
240
240
|
self.deviceRadio = windowWidth / 750;
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
var commonjsGlobal =
|
|
243
|
+
var commonjsGlobal =
|
|
244
|
+
typeof window !== 'undefined'
|
|
245
|
+
? window
|
|
246
|
+
: typeof global !== 'undefined'
|
|
247
|
+
? global
|
|
248
|
+
: typeof self !== 'undefined'
|
|
249
|
+
? self
|
|
250
|
+
: {};
|
|
244
251
|
|
|
245
252
|
function createCommonjsModule(fn, module) {
|
|
246
253
|
return (
|
|
@@ -478,14 +485,22 @@
|
|
|
478
485
|
buffer = a + b + c;
|
|
479
486
|
// Turn the 24 bits into four chunks of 6 bits each, and append the
|
|
480
487
|
// matching character for each of them to the output.
|
|
481
|
-
output +=
|
|
488
|
+
output +=
|
|
489
|
+
TABLE.charAt((buffer >> 18) & 0x3f) +
|
|
490
|
+
TABLE.charAt((buffer >> 12) & 0x3f) +
|
|
491
|
+
TABLE.charAt((buffer >> 6) & 0x3f) +
|
|
492
|
+
TABLE.charAt(buffer & 0x3f);
|
|
482
493
|
}
|
|
483
494
|
|
|
484
495
|
if (padding == 2) {
|
|
485
496
|
a = input.charCodeAt(position) << 8;
|
|
486
497
|
b = input.charCodeAt(++position);
|
|
487
498
|
buffer = a + b;
|
|
488
|
-
output +=
|
|
499
|
+
output +=
|
|
500
|
+
TABLE.charAt(buffer >> 10) +
|
|
501
|
+
TABLE.charAt((buffer >> 4) & 0x3f) +
|
|
502
|
+
TABLE.charAt((buffer << 2) & 0x3f) +
|
|
503
|
+
'=';
|
|
489
504
|
} else if (padding == 1) {
|
|
490
505
|
buffer = input.charCodeAt(position);
|
|
491
506
|
output += TABLE.charAt(buffer >> 2) + TABLE.charAt((buffer << 4) & 0x3f) + '==';
|
|
@@ -701,7 +716,10 @@
|
|
|
701
716
|
var strPixelRow = '';
|
|
702
717
|
for (var x = 0; x < biWidth; x++) {
|
|
703
718
|
var iOffsetX = x << 2;
|
|
704
|
-
strPixelRow +=
|
|
719
|
+
strPixelRow +=
|
|
720
|
+
fromCharCode(aImgData[iOffsetY + iOffsetX + 2]) +
|
|
721
|
+
fromCharCode(aImgData[iOffsetY + iOffsetX + 1]) +
|
|
722
|
+
fromCharCode(aImgData[iOffsetY + iOffsetX]);
|
|
705
723
|
}
|
|
706
724
|
|
|
707
725
|
for (var c = 0; c < iPadding; c++) {
|
|
@@ -881,7 +899,13 @@
|
|
|
881
899
|
if (tools_10(customOptions) && customOptions.original) {
|
|
882
900
|
// original mode
|
|
883
901
|
task = function () {
|
|
884
|
-
self.targetCtx.drawImage(
|
|
902
|
+
self.targetCtx.drawImage(
|
|
903
|
+
self.croperTarget,
|
|
904
|
+
self.imgLeft * pixelRatio,
|
|
905
|
+
self.imgTop * pixelRatio,
|
|
906
|
+
self.scaleWidth * pixelRatio,
|
|
907
|
+
self.scaleHeight * pixelRatio
|
|
908
|
+
);
|
|
885
909
|
|
|
886
910
|
canvasOptions = {
|
|
887
911
|
canvasId: targetId,
|
|
@@ -905,7 +929,9 @@
|
|
|
905
929
|
fn = customOptions;
|
|
906
930
|
}
|
|
907
931
|
|
|
908
|
-
var arg = canvasOptions.componentContext
|
|
932
|
+
var arg = canvasOptions.componentContext
|
|
933
|
+
? [canvasOptions, canvasOptions.componentContext]
|
|
934
|
+
: [canvasOptions];
|
|
909
935
|
|
|
910
936
|
return canvasToTempFilePath.apply(null, arg);
|
|
911
937
|
})
|
|
@@ -1094,9 +1120,11 @@
|
|
|
1094
1120
|
* @param imgTop 图片左上角纵坐标值
|
|
1095
1121
|
*/
|
|
1096
1122
|
self.outsideBound = function (imgLeft, imgTop) {
|
|
1097
|
-
self.imgLeft =
|
|
1123
|
+
self.imgLeft =
|
|
1124
|
+
imgLeft >= x ? x : self.scaleWidth + imgLeft - x <= width ? x + width - self.scaleWidth : imgLeft;
|
|
1098
1125
|
|
|
1099
|
-
self.imgTop =
|
|
1126
|
+
self.imgTop =
|
|
1127
|
+
imgTop >= y ? y : self.scaleHeight + imgTop - y <= height ? y + height - self.scaleHeight : imgTop;
|
|
1100
1128
|
};
|
|
1101
1129
|
|
|
1102
1130
|
/**
|
|
@@ -482,14 +482,22 @@ var base64 = createCommonjsModule(function (module, exports) {
|
|
|
482
482
|
buffer = a + b + c;
|
|
483
483
|
// Turn the 24 bits into four chunks of 6 bits each, and append the
|
|
484
484
|
// matching character for each of them to the output.
|
|
485
|
-
output +=
|
|
485
|
+
output +=
|
|
486
|
+
TABLE.charAt((buffer >> 18) & 0x3f) +
|
|
487
|
+
TABLE.charAt((buffer >> 12) & 0x3f) +
|
|
488
|
+
TABLE.charAt((buffer >> 6) & 0x3f) +
|
|
489
|
+
TABLE.charAt(buffer & 0x3f);
|
|
486
490
|
}
|
|
487
491
|
|
|
488
492
|
if (padding == 2) {
|
|
489
493
|
a = input.charCodeAt(position) << 8;
|
|
490
494
|
b = input.charCodeAt(++position);
|
|
491
495
|
buffer = a + b;
|
|
492
|
-
output +=
|
|
496
|
+
output +=
|
|
497
|
+
TABLE.charAt(buffer >> 10) +
|
|
498
|
+
TABLE.charAt((buffer >> 4) & 0x3f) +
|
|
499
|
+
TABLE.charAt((buffer << 2) & 0x3f) +
|
|
500
|
+
'=';
|
|
493
501
|
} else if (padding == 1) {
|
|
494
502
|
buffer = input.charCodeAt(position);
|
|
495
503
|
output += TABLE.charAt(buffer >> 2) + TABLE.charAt((buffer << 4) & 0x3f) + '==';
|
|
@@ -705,7 +713,10 @@ function genBitmapImage(oData: any) {
|
|
|
705
713
|
var strPixelRow = '';
|
|
706
714
|
for (var x = 0; x < biWidth; x++) {
|
|
707
715
|
var iOffsetX = x << 2;
|
|
708
|
-
strPixelRow +=
|
|
716
|
+
strPixelRow +=
|
|
717
|
+
fromCharCode(aImgData[iOffsetY + iOffsetX + 2]) +
|
|
718
|
+
fromCharCode(aImgData[iOffsetY + iOffsetX + 1]) +
|
|
719
|
+
fromCharCode(aImgData[iOffsetY + iOffsetX]);
|
|
709
720
|
}
|
|
710
721
|
|
|
711
722
|
for (var c = 0; c < iPadding; c++) {
|
|
@@ -885,7 +896,13 @@ function methods(this: any) {
|
|
|
885
896
|
if (tools_10(customOptions) && customOptions.original) {
|
|
886
897
|
// original mode
|
|
887
898
|
task = function () {
|
|
888
|
-
self.targetCtx.drawImage(
|
|
899
|
+
self.targetCtx.drawImage(
|
|
900
|
+
self.croperTarget,
|
|
901
|
+
self.imgLeft * pixelRatio,
|
|
902
|
+
self.imgTop * pixelRatio,
|
|
903
|
+
self.scaleWidth * pixelRatio,
|
|
904
|
+
self.scaleHeight * pixelRatio
|
|
905
|
+
);
|
|
889
906
|
|
|
890
907
|
canvasOptions = {
|
|
891
908
|
canvasId: targetId,
|
|
@@ -909,7 +926,9 @@ function methods(this: any) {
|
|
|
909
926
|
fn = customOptions;
|
|
910
927
|
}
|
|
911
928
|
|
|
912
|
-
var arg = canvasOptions.componentContext
|
|
929
|
+
var arg = canvasOptions.componentContext
|
|
930
|
+
? [canvasOptions, canvasOptions.componentContext]
|
|
931
|
+
: [canvasOptions];
|
|
913
932
|
|
|
914
933
|
return canvasToTempFilePath.apply(null, arg);
|
|
915
934
|
})
|
|
@@ -1098,9 +1117,11 @@ function cut(this: any) {
|
|
|
1098
1117
|
* @param imgTop 图片左上角纵坐标值
|
|
1099
1118
|
*/
|
|
1100
1119
|
self.outsideBound = function (imgLeft: any, imgTop: any) {
|
|
1101
|
-
self.imgLeft =
|
|
1120
|
+
self.imgLeft =
|
|
1121
|
+
imgLeft >= x ? x : self.scaleWidth + imgLeft - x <= width ? x + width - self.scaleWidth : imgLeft;
|
|
1102
1122
|
|
|
1103
|
-
self.imgTop =
|
|
1123
|
+
self.imgTop =
|
|
1124
|
+
imgTop >= y ? y : self.scaleHeight + imgTop - y <= height ? y + height - self.scaleHeight : imgTop;
|
|
1104
1125
|
};
|
|
1105
1126
|
|
|
1106
1127
|
/**
|
|
@@ -63,7 +63,10 @@ const uZIndex = ref(-1);
|
|
|
63
63
|
*/
|
|
64
64
|
const showBackTop = computed(() => {
|
|
65
65
|
// uni.upx2px 用于将 rpx 转为 px
|
|
66
|
-
return
|
|
66
|
+
return (
|
|
67
|
+
Number(props.scrollTop) >
|
|
68
|
+
(typeof uni !== 'undefined' && uni.upx2px ? uni.upx2px(Number(props.top)) : Number(props.top))
|
|
69
|
+
);
|
|
67
70
|
// #else
|
|
68
71
|
// return Number(props.scrollTop) > Number(props.top)
|
|
69
72
|
});
|
|
@@ -110,7 +110,17 @@ defineOptions({
|
|
|
110
110
|
* @example <u-button>月落</u-button>
|
|
111
111
|
*/
|
|
112
112
|
|
|
113
|
-
const emit = defineEmits([
|
|
113
|
+
const emit = defineEmits([
|
|
114
|
+
'click',
|
|
115
|
+
'getuserinfo',
|
|
116
|
+
'contact',
|
|
117
|
+
'getphonenumber',
|
|
118
|
+
'error',
|
|
119
|
+
'launchapp',
|
|
120
|
+
'opensetting',
|
|
121
|
+
'chooseavatar',
|
|
122
|
+
'agreeprivacyauthorization'
|
|
123
|
+
]);
|
|
114
124
|
|
|
115
125
|
const props = defineProps(ButtonProps);
|
|
116
126
|
|
|
@@ -61,7 +61,9 @@ export const CalendarProps = {
|
|
|
61
61
|
/** 顶部的提示文字 */
|
|
62
62
|
toolTip: { type: String, default: '选择日期' },
|
|
63
63
|
/** 是否显示农历 */
|
|
64
|
-
showLunar: { type: Boolean, default: false }
|
|
64
|
+
showLunar: { type: Boolean, default: false },
|
|
65
|
+
/** 是否在页面中显示 */
|
|
66
|
+
isPage: { type: Boolean, default: false }
|
|
65
67
|
};
|
|
66
68
|
|
|
67
69
|
export type CalendarProps = ExtractPropTypes<typeof CalendarProps>;
|
|
@@ -1,5 +1,111 @@
|
|
|
1
1
|
<template>
|
|
2
|
+
<view v-if="props.isPage" class="u-calendar" :class="props.customClass" :style="$u.toStyle(customStyle)">
|
|
3
|
+
<!-- <view class="u-calendar__header">
|
|
4
|
+
<view class="u-calendar__header__text" v-if="!slots.tooltip">
|
|
5
|
+
{{ toolTip }}
|
|
6
|
+
</view>
|
|
7
|
+
<slot v-else name="tooltip" />
|
|
8
|
+
</view> -->
|
|
9
|
+
<view class="u-calendar__action u-flex u-row-center">
|
|
10
|
+
<view class="u-calendar__action__icon">
|
|
11
|
+
<u-icon
|
|
12
|
+
v-if="changeYear"
|
|
13
|
+
name="arrow-left-double"
|
|
14
|
+
:color="yearArrowColor"
|
|
15
|
+
@click="changeYearHandler(0)"
|
|
16
|
+
></u-icon>
|
|
17
|
+
</view>
|
|
18
|
+
<view class="u-calendar__action__icon">
|
|
19
|
+
<u-icon
|
|
20
|
+
v-if="changeMonth"
|
|
21
|
+
name="arrow-left"
|
|
22
|
+
:color="monthArrowColor"
|
|
23
|
+
@click="changeMonthHandler(0)"
|
|
24
|
+
></u-icon>
|
|
25
|
+
</view>
|
|
26
|
+
<view class="u-calendar__action__text">{{ showTitle }}</view>
|
|
27
|
+
<view class="u-calendar__action__icon">
|
|
28
|
+
<u-icon
|
|
29
|
+
v-if="changeMonth"
|
|
30
|
+
name="arrow-right"
|
|
31
|
+
:color="monthArrowColor"
|
|
32
|
+
@click="changeMonthHandler(1)"
|
|
33
|
+
></u-icon>
|
|
34
|
+
</view>
|
|
35
|
+
<view class="u-calendar__action__icon">
|
|
36
|
+
<u-icon
|
|
37
|
+
v-if="changeYear"
|
|
38
|
+
name="arrow-right-double"
|
|
39
|
+
:color="yearArrowColor"
|
|
40
|
+
@click="changeYearHandler(1)"
|
|
41
|
+
></u-icon>
|
|
42
|
+
</view>
|
|
43
|
+
</view>
|
|
44
|
+
<view class="u-calendar__week-day">
|
|
45
|
+
<view class="u-calendar__week-day__text" v-for="(item, index) in weekDayZh" :key="index">{{ item }}</view>
|
|
46
|
+
</view>
|
|
47
|
+
<view class="u-calendar__content">
|
|
48
|
+
<!-- 前置空白部分 -->
|
|
49
|
+
<block v-for="(item, index) in weekdayArr" :key="index">
|
|
50
|
+
<view class="u-calendar__content__item"></view>
|
|
51
|
+
</block>
|
|
52
|
+
<view
|
|
53
|
+
class="u-calendar__content__item"
|
|
54
|
+
:class="{
|
|
55
|
+
'u-hover-class': openDisAbled(year, month, index + 1),
|
|
56
|
+
'u-calendar__content--start-date':
|
|
57
|
+
(mode == 'range' && startDate == `${year}-${month}-${index + 1}`) || mode == 'date',
|
|
58
|
+
'u-calendar__content--end-date':
|
|
59
|
+
(mode == 'range' && endDate == `${year}-${month}-${index + 1}`) || mode == 'date'
|
|
60
|
+
}"
|
|
61
|
+
:style="{ backgroundColor: getColor(index, 1) }"
|
|
62
|
+
v-for="(item, index) in daysArr"
|
|
63
|
+
:key="index"
|
|
64
|
+
@tap="dateClick(index)"
|
|
65
|
+
>
|
|
66
|
+
<view class="u-calendar__content__item__inner" :style="{ color: getColor(index, 2) }">
|
|
67
|
+
<view>{{ index + 1 }}</view>
|
|
68
|
+
</view>
|
|
69
|
+
<view
|
|
70
|
+
class="u-calendar__content__item__tips"
|
|
71
|
+
:style="{ color: activeColor }"
|
|
72
|
+
v-if="mode == 'range' && startDate == `${year}-${month}-${index + 1}` && startDate != endDate"
|
|
73
|
+
>
|
|
74
|
+
{{ startText }}
|
|
75
|
+
</view>
|
|
76
|
+
<view
|
|
77
|
+
class="u-calendar__content__item__tips"
|
|
78
|
+
:style="{ color: activeColor }"
|
|
79
|
+
v-if="mode == 'range' && endDate == `${year}-${month}-${index + 1}`"
|
|
80
|
+
>
|
|
81
|
+
{{ endText }}
|
|
82
|
+
</view>
|
|
83
|
+
<view
|
|
84
|
+
v-if="
|
|
85
|
+
props.showLunar &&
|
|
86
|
+
!(mode == 'range' && startDate == `${year}-${month}-${index + 1}` && startDate != endDate) &&
|
|
87
|
+
!(mode == 'range' && endDate == `${year}-${month}-${index + 1}`)
|
|
88
|
+
"
|
|
89
|
+
class="u-calendar__content__item__tips"
|
|
90
|
+
:style="{ color: getColor(index, 2) }"
|
|
91
|
+
>
|
|
92
|
+
{{ lunarArr[index]?.dayCn === '初一' ? lunarArr[index].monthCn : (lunarArr[index]?.dayCn ?? '') }}
|
|
93
|
+
</view>
|
|
94
|
+
</view>
|
|
95
|
+
<view class="u-calendar__content__bg-month">{{ month }}</view>
|
|
96
|
+
</view>
|
|
97
|
+
<!-- <view class="u-calendar__bottom">
|
|
98
|
+
<view class="u-calendar__bottom__choose">
|
|
99
|
+
<text>{{ mode == 'date' ? activeDate : startDate }}</text>
|
|
100
|
+
<text v-if="endDate">至{{ endDate }}</text>
|
|
101
|
+
</view>
|
|
102
|
+
<view class="u-calendar__bottom__btn">
|
|
103
|
+
<u-button :type="btnType" shape="circle" size="default" @click="btnFix(false)">确定</u-button>
|
|
104
|
+
</view>
|
|
105
|
+
</view> -->
|
|
106
|
+
</view>
|
|
2
107
|
<u-popup
|
|
108
|
+
v-else
|
|
3
109
|
:maskCloseAble="maskCloseAble"
|
|
4
110
|
mode="bottom"
|
|
5
111
|
:popup="false"
|
|
@@ -20,21 +126,43 @@
|
|
|
20
126
|
</view>
|
|
21
127
|
<view class="u-calendar__action u-flex u-row-center">
|
|
22
128
|
<view class="u-calendar__action__icon">
|
|
23
|
-
<u-icon
|
|
129
|
+
<u-icon
|
|
130
|
+
v-if="changeYear"
|
|
131
|
+
name="arrow-left-double"
|
|
132
|
+
:color="yearArrowColor"
|
|
133
|
+
@click="changeYearHandler(0)"
|
|
134
|
+
></u-icon>
|
|
24
135
|
</view>
|
|
25
136
|
<view class="u-calendar__action__icon">
|
|
26
|
-
<u-icon
|
|
137
|
+
<u-icon
|
|
138
|
+
v-if="changeMonth"
|
|
139
|
+
name="arrow-left"
|
|
140
|
+
:color="monthArrowColor"
|
|
141
|
+
@click="changeMonthHandler(0)"
|
|
142
|
+
></u-icon>
|
|
27
143
|
</view>
|
|
28
144
|
<view class="u-calendar__action__text">{{ showTitle }}</view>
|
|
29
145
|
<view class="u-calendar__action__icon">
|
|
30
|
-
<u-icon
|
|
146
|
+
<u-icon
|
|
147
|
+
v-if="changeMonth"
|
|
148
|
+
name="arrow-right"
|
|
149
|
+
:color="monthArrowColor"
|
|
150
|
+
@click="changeMonthHandler(1)"
|
|
151
|
+
></u-icon>
|
|
31
152
|
</view>
|
|
32
153
|
<view class="u-calendar__action__icon">
|
|
33
|
-
<u-icon
|
|
154
|
+
<u-icon
|
|
155
|
+
v-if="changeYear"
|
|
156
|
+
name="arrow-right-double"
|
|
157
|
+
:color="yearArrowColor"
|
|
158
|
+
@click="changeYearHandler(1)"
|
|
159
|
+
></u-icon>
|
|
34
160
|
</view>
|
|
35
161
|
</view>
|
|
36
162
|
<view class="u-calendar__week-day">
|
|
37
|
-
<view class="u-calendar__week-day__text" v-for="(item, index) in weekDayZh" :key="index">
|
|
163
|
+
<view class="u-calendar__week-day__text" v-for="(item, index) in weekDayZh" :key="index">
|
|
164
|
+
{{ item }}
|
|
165
|
+
</view>
|
|
38
166
|
</view>
|
|
39
167
|
<view class="u-calendar__content">
|
|
40
168
|
<!-- 前置空白部分 -->
|
|
@@ -45,8 +173,10 @@
|
|
|
45
173
|
class="u-calendar__content__item"
|
|
46
174
|
:class="{
|
|
47
175
|
'u-hover-class': openDisAbled(year, month, index + 1),
|
|
48
|
-
'u-calendar__content--start-date':
|
|
49
|
-
|
|
176
|
+
'u-calendar__content--start-date':
|
|
177
|
+
(mode == 'range' && startDate == `${year}-${month}-${index + 1}`) || mode == 'date',
|
|
178
|
+
'u-calendar__content--end-date':
|
|
179
|
+
(mode == 'range' && endDate == `${year}-${month}-${index + 1}`) || mode == 'date'
|
|
50
180
|
}"
|
|
51
181
|
:style="{ backgroundColor: getColor(index, 1) }"
|
|
52
182
|
v-for="(item, index) in daysArr"
|
|
@@ -60,21 +190,32 @@
|
|
|
60
190
|
class="u-calendar__content__item__tips"
|
|
61
191
|
:style="{ color: activeColor }"
|
|
62
192
|
v-if="mode == 'range' && startDate == `${year}-${month}-${index + 1}` && startDate != endDate"
|
|
63
|
-
>{{ startText }}</view
|
|
64
193
|
>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
194
|
+
{{ startText }}
|
|
195
|
+
</view>
|
|
196
|
+
<view
|
|
197
|
+
class="u-calendar__content__item__tips"
|
|
198
|
+
:style="{ color: activeColor }"
|
|
199
|
+
v-if="mode == 'range' && endDate == `${year}-${month}-${index + 1}`"
|
|
200
|
+
>
|
|
201
|
+
{{ endText }}
|
|
202
|
+
</view>
|
|
68
203
|
<view
|
|
69
204
|
v-if="
|
|
70
205
|
props.showLunar &&
|
|
71
|
-
!(
|
|
206
|
+
!(
|
|
207
|
+
mode == 'range' &&
|
|
208
|
+
startDate == `${year}-${month}-${index + 1}` &&
|
|
209
|
+
startDate != endDate
|
|
210
|
+
) &&
|
|
72
211
|
!(mode == 'range' && endDate == `${year}-${month}-${index + 1}`)
|
|
73
212
|
"
|
|
74
213
|
class="u-calendar__content__item__tips"
|
|
75
214
|
:style="{ color: getColor(index, 2) }"
|
|
76
215
|
>
|
|
77
|
-
{{
|
|
216
|
+
{{
|
|
217
|
+
lunarArr[index]?.dayCn === '初一' ? lunarArr[index].monthCn : (lunarArr[index]?.dayCn ?? '')
|
|
218
|
+
}}
|
|
78
219
|
</view>
|
|
79
220
|
</view>
|
|
80
221
|
<view class="u-calendar__content__bg-month">{{ month }}</view>
|
|
@@ -92,15 +233,25 @@
|
|
|
92
233
|
</u-popup>
|
|
93
234
|
</template>
|
|
94
235
|
|
|
236
|
+
<script lang="ts">
|
|
237
|
+
export default {
|
|
238
|
+
name: 'u-calendar',
|
|
239
|
+
options: {
|
|
240
|
+
addGlobalClass: true,
|
|
241
|
+
// #ifndef MP-TOUTIAO
|
|
242
|
+
virtualHost: true,
|
|
243
|
+
// #endif
|
|
244
|
+
styleIsolation: 'shared'
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
</script>
|
|
248
|
+
|
|
95
249
|
<script setup lang="ts">
|
|
96
250
|
import { ref, computed, watch, onMounted, useSlots } from 'vue';
|
|
97
251
|
import { $u } from '../..';
|
|
98
252
|
import { CalendarProps, type CalendarEmits } from './types';
|
|
99
253
|
import Calendar from '../../libs/util/calendar';
|
|
100
254
|
|
|
101
|
-
defineOptions({
|
|
102
|
-
name: 'u-calendar'
|
|
103
|
-
});
|
|
104
255
|
/**
|
|
105
256
|
* calendar 日历
|
|
106
257
|
* @description 此组件用于单个选择日期,范围选择日期等,日历被包裹在底部弹起的容器中。
|
|
@@ -372,6 +523,9 @@ function getLunar(year, month, day) {
|
|
|
372
523
|
* 日期点击事件
|
|
373
524
|
*/
|
|
374
525
|
function dateClick(dayIdx: number) {
|
|
526
|
+
if (props.isPage) {
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
375
529
|
const d = dayIdx + 1;
|
|
376
530
|
if (!openDisAbled(year.value, month.value, d)) {
|
|
377
531
|
day.value = d;
|
|
@@ -379,7 +533,8 @@ function dateClick(dayIdx: number) {
|
|
|
379
533
|
if (props.mode == 'date') {
|
|
380
534
|
activeDate.value = date;
|
|
381
535
|
} else {
|
|
382
|
-
let compare =
|
|
536
|
+
let compare =
|
|
537
|
+
new Date(date.replace(/\-/g, '/')).getTime() < new Date(startDate.value.replace(/\-/g, '/')).getTime();
|
|
383
538
|
if (isStart.value || compare) {
|
|
384
539
|
startDate.value = date;
|
|
385
540
|
startYear.value = year.value;
|
|
@@ -3,14 +3,32 @@
|
|
|
3
3
|
<view class="u-keyboard-grids">
|
|
4
4
|
<view>
|
|
5
5
|
<view class="u-keyboard-grids-item" v-for="(group, i) in abc ? EngKeyBoardList : areaList" :key="i">
|
|
6
|
-
<view
|
|
6
|
+
<view
|
|
7
|
+
:hover-stay-time="100"
|
|
8
|
+
@tap="carInputClick(i, j)"
|
|
9
|
+
hover-class="u-carinput-hover"
|
|
10
|
+
class="u-keyboard-grids-btn"
|
|
11
|
+
v-for="(item, j) in group"
|
|
12
|
+
:key="j"
|
|
13
|
+
>
|
|
7
14
|
{{ item }}
|
|
8
15
|
</view>
|
|
9
16
|
</view>
|
|
10
|
-
<view
|
|
17
|
+
<view
|
|
18
|
+
@touchstart="backspaceClick"
|
|
19
|
+
@touchend="clearTimer"
|
|
20
|
+
:hover-stay-time="100"
|
|
21
|
+
class="u-keyboard-back"
|
|
22
|
+
hover-class="u-hover-class"
|
|
23
|
+
>
|
|
11
24
|
<u-icon :size="38" name="backspace" :bold="true"></u-icon>
|
|
12
25
|
</view>
|
|
13
|
-
<view
|
|
26
|
+
<view
|
|
27
|
+
:hover-stay-time="100"
|
|
28
|
+
class="u-keyboard-change"
|
|
29
|
+
hover-class="u-carinput-hover"
|
|
30
|
+
@tap="changeCarInputMode"
|
|
31
|
+
>
|
|
14
32
|
<text class="zh" :class="[!abc ? 'active' : 'inactive']">中</text>
|
|
15
33
|
/
|
|
16
34
|
<text class="en" :class="[abc ? 'active' : 'inactive']">英</text>
|
|
@@ -96,6 +114,7 @@ const areaList = computed(() => {
|
|
|
96
114
|
});
|
|
97
115
|
|
|
98
116
|
const EngKeyBoardList = computed(() => {
|
|
117
|
+
// prettier-ignore
|
|
99
118
|
let data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', 'X', 'C', 'V', 'B', 'N', 'M'];
|
|
100
119
|
let tmp: (string | number)[][] = [];
|
|
101
120
|
if (props.random) {
|
|
@@ -12,7 +12,13 @@
|
|
|
12
12
|
:hover-class="hoverClass"
|
|
13
13
|
:style="{ backgroundColor: bgColor }"
|
|
14
14
|
>
|
|
15
|
-
<u-icon
|
|
15
|
+
<u-icon
|
|
16
|
+
:size="iconSize"
|
|
17
|
+
:name="icon"
|
|
18
|
+
v-if="icon"
|
|
19
|
+
:custom-style="iconStyle"
|
|
20
|
+
class="u-cell__left-icon-wrap"
|
|
21
|
+
></u-icon>
|
|
16
22
|
<view class="u-flex" v-else>
|
|
17
23
|
<slot name="icon"></slot>
|
|
18
24
|
</view>
|
|
@@ -31,7 +37,12 @@
|
|
|
31
37
|
<view class="u-flex u-cell_right" v-if="$slots['right-icon']">
|
|
32
38
|
<slot name="right-icon"></slot>
|
|
33
39
|
</view>
|
|
34
|
-
<u-icon
|
|
40
|
+
<u-icon
|
|
41
|
+
v-if="arrow"
|
|
42
|
+
name="arrow-right"
|
|
43
|
+
:style="[arrowStyle]"
|
|
44
|
+
class="u-icon-wrap u-cell__right-icon-wrap"
|
|
45
|
+
></u-icon>
|
|
35
46
|
</view>
|
|
36
47
|
</template>
|
|
37
48
|
|