@gmcb/uv-ui 0.2.26
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 +295 -0
- package/LICENSE +21 -0
- package/README.md +164 -0
- package/components/uv-action-sheet/props.js +50 -0
- package/components/uv-action-sheet/uv-action-sheet.vue +280 -0
- package/components/uv-album/uv-album.vue +312 -0
- package/components/uv-alert/props.js +45 -0
- package/components/uv-alert/uv-alert.vue +246 -0
- package/components/uv-avatar/props.js +85 -0
- package/components/uv-avatar/uv-avatar.vue +182 -0
- package/components/uv-avatar-group/props.js +53 -0
- package/components/uv-avatar-group/uv-avatar-group.vue +106 -0
- package/components/uv-back-top/props.js +58 -0
- package/components/uv-back-top/uv-back-top.vue +116 -0
- package/components/uv-badge/props.js +73 -0
- package/components/uv-badge/uv-badge.vue +176 -0
- package/components/uv-button/nvue.scss +46 -0
- package/components/uv-button/props.js +163 -0
- package/components/uv-button/uv-button.vue +529 -0
- package/components/uv-button/vue.scss +93 -0
- package/components/uv-calendar/calendar.js +546 -0
- package/components/uv-calendar/header.vue +104 -0
- package/components/uv-calendar/month.vue +616 -0
- package/components/uv-calendar/props.js +145 -0
- package/components/uv-calendar/uv-calendar.vue +390 -0
- package/components/uv-calendars/calendar-body.vue +376 -0
- package/components/uv-calendars/calendar-item.vue +248 -0
- package/components/uv-calendars/calendar.js +546 -0
- package/components/uv-calendars/i18n/en.json +12 -0
- package/components/uv-calendars/i18n/index.js +8 -0
- package/components/uv-calendars/i18n/zh-Hans.json +12 -0
- package/components/uv-calendars/i18n/zh-Hant.json +12 -0
- package/components/uv-calendars/util.js +435 -0
- package/components/uv-calendars/uv-calendars.vue +452 -0
- package/components/uv-cell/props.js +116 -0
- package/components/uv-cell/uv-cell.vue +209 -0
- package/components/uv-cell-group/props.js +15 -0
- package/components/uv-cell-group/uv-cell-group.vue +63 -0
- package/components/uv-checkbox/props.js +70 -0
- package/components/uv-checkbox/uv-checkbox.vue +371 -0
- package/components/uv-checkbox-group/props.js +84 -0
- package/components/uv-checkbox-group/uv-checkbox-group.vue +119 -0
- package/components/uv-code/props.js +35 -0
- package/components/uv-code/uv-code.vue +136 -0
- package/components/uv-code-input/props.js +83 -0
- package/components/uv-code-input/uv-code-input.vue +272 -0
- package/components/uv-col/props.js +30 -0
- package/components/uv-col/uv-col.vue +165 -0
- package/components/uv-collapse/props.js +20 -0
- package/components/uv-collapse/uv-collapse.vue +86 -0
- package/components/uv-collapse-item/props.js +60 -0
- package/components/uv-collapse-item/uv-collapse-item.vue +228 -0
- package/components/uv-column-notice/props.js +61 -0
- package/components/uv-column-notice/uv-column-notice.vue +176 -0
- package/components/uv-count-down/props.js +25 -0
- package/components/uv-count-down/utils.js +62 -0
- package/components/uv-count-down/uv-count-down.vue +169 -0
- package/components/uv-count-to/props.js +60 -0
- package/components/uv-count-to/uv-count-to.vue +187 -0
- package/components/uv-datetime-picker/props.js +130 -0
- package/components/uv-datetime-picker/uv-datetime-picker.vue +355 -0
- package/components/uv-divider/props.js +45 -0
- package/components/uv-divider/uv-divider.vue +113 -0
- package/components/uv-drop-down/uv-drop-down.vue +135 -0
- package/components/uv-drop-down-item/uv-drop-down-item.vue +169 -0
- package/components/uv-drop-down-popup/uv-drop-down-popup.vue +242 -0
- package/components/uv-empty/props.js +60 -0
- package/components/uv-empty/uv-empty.vue +126 -0
- package/components/uv-form/props.js +46 -0
- package/components/uv-form/uv-form.vue +209 -0
- package/components/uv-form/valid.js +1343 -0
- package/components/uv-form-item/props.js +49 -0
- package/components/uv-form-item/uv-form-item.vue +226 -0
- package/components/uv-gap/props.js +25 -0
- package/components/uv-gap/uv-gap.vue +36 -0
- package/components/uv-grid/props.js +20 -0
- package/components/uv-grid/uv-grid.vue +100 -0
- package/components/uv-grid-item/props.js +15 -0
- package/components/uv-grid-item/uv-grid-item.vue +223 -0
- package/components/uv-icon/icons.js +160 -0
- package/components/uv-icon/props.js +90 -0
- package/components/uv-icon/uv-icon.vue +226 -0
- package/components/uv-icon/uvicons.ttf +0 -0
- package/components/uv-image/props.js +100 -0
- package/components/uv-image/uv-image.vue +296 -0
- package/components/uv-index-anchor/props.js +30 -0
- package/components/uv-index-anchor/uv-index-anchor.vue +98 -0
- package/components/uv-index-item/uv-index-item.vue +87 -0
- package/components/uv-index-list/props.js +30 -0
- package/components/uv-index-list/uv-index-list.vue +461 -0
- package/components/uv-input/props.js +175 -0
- package/components/uv-input/uv-input.vue +348 -0
- package/components/uv-keyboard/props.js +95 -0
- package/components/uv-keyboard/uv-keyboard.vue +180 -0
- package/components/uv-keyboard-car/props.js +24 -0
- package/components/uv-keyboard-car/uv-keyboard-car.vue +347 -0
- package/components/uv-keyboard-number/props.js +19 -0
- package/components/uv-keyboard-number/uv-keyboard-number.vue +201 -0
- package/components/uv-line/props.js +34 -0
- package/components/uv-line/uv-line.vue +60 -0
- package/components/uv-line-progress/props.js +29 -0
- package/components/uv-line-progress/uv-line-progress.vue +146 -0
- package/components/uv-link/props.js +40 -0
- package/components/uv-link/uv-link.vue +83 -0
- package/components/uv-list/uv-list.vue +147 -0
- package/components/uv-list-item/uv-list-item.vue +535 -0
- package/components/uv-load-more/props.js +95 -0
- package/components/uv-load-more/uv-load-more.vue +152 -0
- package/components/uv-loading-icon/props.js +67 -0
- package/components/uv-loading-icon/uv-loading-icon.vue +347 -0
- package/components/uv-loading-page/props.js +55 -0
- package/components/uv-loading-page/uv-loading-page.vue +96 -0
- package/components/uv-modal/props.js +90 -0
- package/components/uv-modal/uv-modal.vue +245 -0
- package/components/uv-navbar/props.js +89 -0
- package/components/uv-navbar/uv-navbar.vue +245 -0
- package/components/uv-no-network/props.js +20 -0
- package/components/uv-no-network/uv-no-network.vue +222 -0
- package/components/uv-notice-bar/props.js +76 -0
- package/components/uv-notice-bar/uv-notice-bar.vue +110 -0
- package/components/uv-notify/props.js +45 -0
- package/components/uv-notify/uv-notify.vue +220 -0
- package/components/uv-number-box/props.js +118 -0
- package/components/uv-number-box/uv-number-box.vue +397 -0
- package/components/uv-overlay/props.js +25 -0
- package/components/uv-overlay/uv-overlay.vue +85 -0
- package/components/uv-parse/node/node.vue +576 -0
- package/components/uv-parse/parser.js +1335 -0
- package/components/uv-parse/uv-parse.vue +498 -0
- package/components/uv-pick-color/colors.js +217 -0
- package/components/uv-pick-color/props.js +47 -0
- package/components/uv-pick-color/uv-pick-color.vue +551 -0
- package/components/uv-picker/props.js +95 -0
- package/components/uv-picker/uv-picker.vue +329 -0
- package/components/uv-popup/keypress.js +45 -0
- package/components/uv-popup/uv-popup.vue +537 -0
- package/components/uv-preview-video/uv-preview-video.vue +52 -0
- package/components/uv-qrcode/cache.js +1 -0
- package/components/uv-qrcode/gcanvas/bridge/bridge-weex.js +241 -0
- package/components/uv-qrcode/gcanvas/context-2d/FillStyleLinearGradient.js +18 -0
- package/components/uv-qrcode/gcanvas/context-2d/FillStylePattern.js +8 -0
- package/components/uv-qrcode/gcanvas/context-2d/FillStyleRadialGradient.js +17 -0
- package/components/uv-qrcode/gcanvas/context-2d/RenderingContext.js +666 -0
- package/components/uv-qrcode/gcanvas/context-webgl/ActiveInfo.js +11 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Buffer.js +21 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Framebuffer.js +21 -0
- package/components/uv-qrcode/gcanvas/context-webgl/GLenum.js +298 -0
- package/components/uv-qrcode/gcanvas/context-webgl/GLmethod.js +142 -0
- package/components/uv-qrcode/gcanvas/context-webgl/GLtype.js +23 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Program.js +21 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Renderbuffer.js +21 -0
- package/components/uv-qrcode/gcanvas/context-webgl/RenderingContext.js +1191 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Shader.js +22 -0
- package/components/uv-qrcode/gcanvas/context-webgl/ShaderPrecisionFormat.js +11 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Texture.js +22 -0
- package/components/uv-qrcode/gcanvas/context-webgl/UniformLocation.js +22 -0
- package/components/uv-qrcode/gcanvas/context-webgl/classUtils.js +3 -0
- package/components/uv-qrcode/gcanvas/env/canvas.js +74 -0
- package/components/uv-qrcode/gcanvas/env/image.js +96 -0
- package/components/uv-qrcode/gcanvas/env/tool.js +24 -0
- package/components/uv-qrcode/gcanvas/index.js +39 -0
- package/components/uv-qrcode/props.js +85 -0
- package/components/uv-qrcode/qrcode.js +34 -0
- package/components/uv-qrcode/queue.js +41 -0
- package/components/uv-qrcode/uv-qrcode.vue +1038 -0
- package/components/uv-radio/props.js +65 -0
- package/components/uv-radio/uv-radio.vue +349 -0
- package/components/uv-radio-group/props.js +89 -0
- package/components/uv-radio-group/uv-radio-group.vue +115 -0
- package/components/uv-rate/props.js +73 -0
- package/components/uv-rate/uv-rate.vue +274 -0
- package/components/uv-read-more/props.js +62 -0
- package/components/uv-read-more/uv-read-more.vue +162 -0
- package/components/uv-row/props.js +20 -0
- package/components/uv-row/uv-row.vue +95 -0
- package/components/uv-row-notice/props.js +40 -0
- package/components/uv-row-notice/uv-row-notice.vue +341 -0
- package/components/uv-safe-bottom/uv-safe-bottom.vue +67 -0
- package/components/uv-scroll-list/nvue.js +29 -0
- package/components/uv-scroll-list/props.js +35 -0
- package/components/uv-scroll-list/scrollWxs.wxs +51 -0
- package/components/uv-scroll-list/uv-scroll-list.vue +218 -0
- package/components/uv-search/props.js +127 -0
- package/components/uv-search/uv-search.vue +311 -0
- package/components/uv-skeleton/props.js +65 -0
- package/components/uv-skeleton/uv-skeleton.vue +250 -0
- package/components/uv-skeletons/uv-skeletons.vue +247 -0
- package/components/uv-slider/props.js +58 -0
- package/components/uv-slider/uv-slider.vue +58 -0
- package/components/uv-status-bar/props.js +8 -0
- package/components/uv-status-bar/uv-status-bar.vue +54 -0
- package/components/uv-steps/props.js +40 -0
- package/components/uv-steps/uv-steps.vue +83 -0
- package/components/uv-steps-item/props.js +25 -0
- package/components/uv-steps-item/uv-steps-item.vue +347 -0
- package/components/uv-sticky/props.js +41 -0
- package/components/uv-sticky/uv-sticky.vue +223 -0
- package/components/uv-subsection/props.js +54 -0
- package/components/uv-subsection/uv-subsection.vue +269 -0
- package/components/uv-swipe-action/props.js +10 -0
- package/components/uv-swipe-action/uv-swipe-action.vue +65 -0
- package/components/uv-swipe-action-item/index - backup.wxs +256 -0
- package/components/uv-swipe-action-item/index.wxs +225 -0
- package/components/uv-swipe-action-item/nvue - backup.js +264 -0
- package/components/uv-swipe-action-item/nvue.js +182 -0
- package/components/uv-swipe-action-item/props.js +40 -0
- package/components/uv-swipe-action-item/uv-swipe-action-item.vue +200 -0
- package/components/uv-swipe-action-item/wxs.js +15 -0
- package/components/uv-swiper/props.js +136 -0
- package/components/uv-swiper/uv-swiper.vue +263 -0
- package/components/uv-swiper-indicator/props.js +30 -0
- package/components/uv-swiper-indicator/uv-swiper-indicator.vue +112 -0
- package/components/uv-switch/props.js +58 -0
- package/components/uv-switch/uv-switch.vue +182 -0
- package/components/uv-tabbar/props.js +50 -0
- package/components/uv-tabbar/uv-tabbar.vue +146 -0
- package/components/uv-tabbar-item/props.js +40 -0
- package/components/uv-tabbar-item/uv-tabbar-item.vue +146 -0
- package/components/uv-tabs/props.js +71 -0
- package/components/uv-tabs/uv-tabs.vue +391 -0
- package/components/uv-tags/props.js +104 -0
- package/components/uv-tags/uv-tags.vue +379 -0
- package/components/uv-text/props.js +113 -0
- package/components/uv-text/uv-text.vue +218 -0
- package/components/uv-text/value.js +87 -0
- package/components/uv-textarea/props.js +138 -0
- package/components/uv-textarea/uv-textarea.vue +238 -0
- package/components/uv-toast/uv-toast.vue +292 -0
- package/components/uv-toolbar/props.js +40 -0
- package/components/uv-toolbar/uv-toolbar.vue +109 -0
- package/components/uv-tooltip/props.js +60 -0
- package/components/uv-tooltip/uv-tooltip.vue +372 -0
- package/components/uv-transition/createAnimation.js +131 -0
- package/components/uv-transition/props.js +31 -0
- package/components/uv-transition/uv-transition.vue +320 -0
- package/components/uv-upload/mixin.js +22 -0
- package/components/uv-upload/props.js +130 -0
- package/components/uv-upload/utils.js +151 -0
- package/components/uv-upload/uv-upload.vue +488 -0
- package/components/uv-vtabs/props.js +79 -0
- package/components/uv-vtabs/uv-vtabs.vue +438 -0
- package/components/uv-vtabs-item/uv-vtabs-item.vue +68 -0
- package/components/uv-waterfall/props.js +69 -0
- package/components/uv-waterfall/uv-waterfall.vue +265 -0
- package/index.js +82 -0
- package/index.scss +7 -0
- package/libs/config/config.js +34 -0
- package/libs/css/color.scss +32 -0
- package/libs/css/common.scss +100 -0
- package/libs/css/components.scss +23 -0
- package/libs/css/variable.scss +111 -0
- package/libs/css/vue.scss +40 -0
- package/libs/function/colorGradient.js +134 -0
- package/libs/function/compress.js +27 -0
- package/libs/function/debounce.js +29 -0
- package/libs/function/digit.js +167 -0
- package/libs/function/index.js +734 -0
- package/libs/function/platform.js +75 -0
- package/libs/function/test.js +287 -0
- package/libs/function/throttle.js +30 -0
- package/libs/luch-request/adapters/index.js +132 -0
- package/libs/luch-request/core/InterceptorManager.js +51 -0
- package/libs/luch-request/core/Request.js +201 -0
- package/libs/luch-request/core/buildFullPath.js +20 -0
- package/libs/luch-request/core/defaults.js +33 -0
- package/libs/luch-request/core/dispatchRequest.js +6 -0
- package/libs/luch-request/core/mergeConfig.js +126 -0
- package/libs/luch-request/core/settle.js +16 -0
- package/libs/luch-request/helpers/buildURL.js +64 -0
- package/libs/luch-request/helpers/combineURLs.js +14 -0
- package/libs/luch-request/helpers/isAbsoluteURL.js +14 -0
- package/libs/luch-request/index.d.ts +197 -0
- package/libs/luch-request/index.js +2 -0
- package/libs/luch-request/utils/clone.js +264 -0
- package/libs/luch-request/utils.js +135 -0
- package/libs/mixin/button.js +13 -0
- package/libs/mixin/mixin.js +172 -0
- package/libs/mixin/mpMixin.js +8 -0
- package/libs/mixin/mpShare.js +13 -0
- package/libs/mixin/openType.js +47 -0
- package/libs/mixin/touch.js +59 -0
- package/libs/util/dayjs.js +216 -0
- package/libs/util/route.js +126 -0
- package/package.json +28 -0
- package/theme.scss +43 -0
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="uv-calendar">
|
|
3
|
+
<view class="uv-calendar__content" v-if="insert">
|
|
4
|
+
<calendar-body
|
|
5
|
+
:date="date"
|
|
6
|
+
:nowDate="nowDate"
|
|
7
|
+
:weeks="weeks"
|
|
8
|
+
:calendar="calendar"
|
|
9
|
+
:selected="selected"
|
|
10
|
+
:lunar="lunar"
|
|
11
|
+
:showMonth="showMonth"
|
|
12
|
+
:color="color"
|
|
13
|
+
:startText="startText"
|
|
14
|
+
:endText="endText"
|
|
15
|
+
:range="range"
|
|
16
|
+
:multiple="multiple"
|
|
17
|
+
:allowSameDay="allowSameDay"
|
|
18
|
+
@bindDateChange="bindDateChange"
|
|
19
|
+
@pre="pre"
|
|
20
|
+
@next="next"
|
|
21
|
+
@backToday="backToday"
|
|
22
|
+
@choiceDate="choiceDate"
|
|
23
|
+
></calendar-body>
|
|
24
|
+
</view>
|
|
25
|
+
<uv-popup ref="popup" mode="bottom" v-else :round="round" z-index="998" :close-on-click-overlay="closeOnClickOverlay" @maskClick="maskClick">
|
|
26
|
+
<view style="min-height: 100px;">
|
|
27
|
+
<uv-toolbar
|
|
28
|
+
:show="true"
|
|
29
|
+
:cancelColor="cancelColor"
|
|
30
|
+
:confirmColor="getConfirmColor"
|
|
31
|
+
:cancelText="cancelText"
|
|
32
|
+
:confirmText="confirmText"
|
|
33
|
+
:title="title"
|
|
34
|
+
@cancel="close"
|
|
35
|
+
@confirm="confirm"></uv-toolbar>
|
|
36
|
+
<view class="line"></view>
|
|
37
|
+
<calendar-body
|
|
38
|
+
:nowDate="nowDate"
|
|
39
|
+
:weeks="weeks"
|
|
40
|
+
:calendar="calendar"
|
|
41
|
+
:selected="selected"
|
|
42
|
+
:lunar="lunar"
|
|
43
|
+
:showMonth="showMonth"
|
|
44
|
+
:color="color"
|
|
45
|
+
:startText="startText"
|
|
46
|
+
:endText="endText"
|
|
47
|
+
:range="range"
|
|
48
|
+
:multiple="multiple"
|
|
49
|
+
:allowSameDay="allowSameDay"
|
|
50
|
+
@bindDateChange="bindDateChange"
|
|
51
|
+
@pre="pre"
|
|
52
|
+
@next="next"
|
|
53
|
+
@backToday="backToday"
|
|
54
|
+
@choiceDate="choiceDate"
|
|
55
|
+
></calendar-body>
|
|
56
|
+
</view>
|
|
57
|
+
</uv-popup>
|
|
58
|
+
</view>
|
|
59
|
+
</template>
|
|
60
|
+
<script>
|
|
61
|
+
/**
|
|
62
|
+
* Calendar 日历
|
|
63
|
+
* @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等
|
|
64
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?name=uv-calendar
|
|
65
|
+
* @property {String} date 自定义当前时间,默认为今天
|
|
66
|
+
* @property {Boolean} lunar 显示农历
|
|
67
|
+
* @property {String} startDate 日期选择范围-开始日期
|
|
68
|
+
* @property {String} endDate 日期选择范围-结束日期
|
|
69
|
+
* @property {String} mode = [不传 | multiple | range ] 多个日期 | 选择日期范围 默认单日期
|
|
70
|
+
* @property {Boolean} insert = [true|false] 插入模式,默认为false
|
|
71
|
+
* @value true 弹窗模式
|
|
72
|
+
* @value false 插入模式
|
|
73
|
+
* @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容
|
|
74
|
+
* @property {Array} selected 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}]
|
|
75
|
+
* @property {String} cancelColor 取消按钮颜色
|
|
76
|
+
* @property {String} confirmColor 确认按钮颜色,默认#3c9cff
|
|
77
|
+
* @property {String} title 头部工具条中间的标题文字
|
|
78
|
+
* @property {String} color 主题色,默认#3c9cff
|
|
79
|
+
* @property {Number} round :insert="false"时的圆角
|
|
80
|
+
* @property {Boolean} closeOnClickOverlay 点击遮罩是否关闭
|
|
81
|
+
* @property {String} startText range为true时,第一个日期底部的提示文字
|
|
82
|
+
* @property {String} endText range为true时,最后一个日期底部的提示文字
|
|
83
|
+
* @property {String} readonly 是否为只读状态,只读状态下禁止选择日期,默认false
|
|
84
|
+
*
|
|
85
|
+
* @event {Function} change 日期改变,`insert :ture` 时生效
|
|
86
|
+
* @event {Function} confirm 确认选择`insert :false` 时生效
|
|
87
|
+
* @event {Function} monthSwitch 切换月份时触发
|
|
88
|
+
*
|
|
89
|
+
* @example <uv-calendar :insert="true":lunar="true" :start-date="'2019-3-2'":end-date="'2019-5-20'"@change="change" />
|
|
90
|
+
*/
|
|
91
|
+
import mpMixin from '../../libs/mixin/mpMixin.js';
|
|
92
|
+
import mixin from '../../libs/mixin/mixin.js';
|
|
93
|
+
import Calendar from './util.js';
|
|
94
|
+
import calendarBody from './calendar-body.vue';
|
|
95
|
+
import { initVueI18n } from '@dcloudio/uni-i18n';
|
|
96
|
+
import i18nMessages from './i18n/index.js';
|
|
97
|
+
const { t } = initVueI18n(i18nMessages);
|
|
98
|
+
export default {
|
|
99
|
+
components: {
|
|
100
|
+
calendarBody
|
|
101
|
+
},
|
|
102
|
+
mixins: [mpMixin, mixin],
|
|
103
|
+
emits: ['close', 'confirm', 'change', 'monthSwitch'],
|
|
104
|
+
props: {
|
|
105
|
+
// 取消按钮颜色
|
|
106
|
+
cancelColor: {
|
|
107
|
+
type: String,
|
|
108
|
+
default: ''
|
|
109
|
+
},
|
|
110
|
+
// 确认按钮颜色,range模式下未选全显示灰色
|
|
111
|
+
confirmColor: {
|
|
112
|
+
type: String,
|
|
113
|
+
default: '#3c9cff'
|
|
114
|
+
},
|
|
115
|
+
// 标题
|
|
116
|
+
title: {
|
|
117
|
+
type: String,
|
|
118
|
+
default: ''
|
|
119
|
+
},
|
|
120
|
+
// 主题色
|
|
121
|
+
color: {
|
|
122
|
+
type: String,
|
|
123
|
+
default: '#3c9cff'
|
|
124
|
+
},
|
|
125
|
+
// 默认显示日期
|
|
126
|
+
date: {
|
|
127
|
+
type: [String,Array],
|
|
128
|
+
default: ''
|
|
129
|
+
},
|
|
130
|
+
// 打点等设置
|
|
131
|
+
selected: {
|
|
132
|
+
type: Array,
|
|
133
|
+
default () {
|
|
134
|
+
return []
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
// 是否显示农历
|
|
138
|
+
lunar: {
|
|
139
|
+
type: Boolean,
|
|
140
|
+
default: false
|
|
141
|
+
},
|
|
142
|
+
// 可选择的起始日期
|
|
143
|
+
startDate: {
|
|
144
|
+
type: String,
|
|
145
|
+
default: ''
|
|
146
|
+
},
|
|
147
|
+
// 可选择的结束日期
|
|
148
|
+
endDate: {
|
|
149
|
+
type: String,
|
|
150
|
+
default: ''
|
|
151
|
+
},
|
|
152
|
+
// multiple - 选择多日期 range - 选择日期范围
|
|
153
|
+
mode: {
|
|
154
|
+
type: String,
|
|
155
|
+
default: ''
|
|
156
|
+
},
|
|
157
|
+
// 是否插入模式
|
|
158
|
+
insert: {
|
|
159
|
+
type: Boolean,
|
|
160
|
+
default: false
|
|
161
|
+
},
|
|
162
|
+
// 是否显示月份为背景
|
|
163
|
+
showMonth: {
|
|
164
|
+
type: Boolean,
|
|
165
|
+
default: true
|
|
166
|
+
},
|
|
167
|
+
// 弹窗模式是否清空上次选择内容
|
|
168
|
+
clearDate: {
|
|
169
|
+
type: Boolean,
|
|
170
|
+
default: true
|
|
171
|
+
},
|
|
172
|
+
// 弹窗圆角
|
|
173
|
+
round: {
|
|
174
|
+
type: [Number,String],
|
|
175
|
+
default: 8
|
|
176
|
+
},
|
|
177
|
+
// 点击遮罩是否关闭弹窗
|
|
178
|
+
closeOnClickOverlay: {
|
|
179
|
+
type: Boolean,
|
|
180
|
+
default: true
|
|
181
|
+
},
|
|
182
|
+
// range为true时,第一个日期底部的提示文字
|
|
183
|
+
startText: {
|
|
184
|
+
type: String,
|
|
185
|
+
default: '开始'
|
|
186
|
+
},
|
|
187
|
+
// range为true时,最后一个日期底部的提示文字
|
|
188
|
+
endText: {
|
|
189
|
+
type: String,
|
|
190
|
+
default: '结束'
|
|
191
|
+
},
|
|
192
|
+
// 是否允许日期范围的起止时间为同一天,mode = range时有效
|
|
193
|
+
allowSameDay: {
|
|
194
|
+
type: Boolean,
|
|
195
|
+
default: false
|
|
196
|
+
},
|
|
197
|
+
// 是否禁用
|
|
198
|
+
readonly: {
|
|
199
|
+
type: Boolean,
|
|
200
|
+
default: false
|
|
201
|
+
},
|
|
202
|
+
...uni.$uv?.props?.calendars
|
|
203
|
+
},
|
|
204
|
+
data(){
|
|
205
|
+
return {
|
|
206
|
+
weeks: [],
|
|
207
|
+
calendar: {},
|
|
208
|
+
nowDate: '',
|
|
209
|
+
allowConfirm: false,
|
|
210
|
+
multiple: false,
|
|
211
|
+
range: false
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
computed:{
|
|
215
|
+
/**
|
|
216
|
+
* for i18n
|
|
217
|
+
*/
|
|
218
|
+
confirmText() {
|
|
219
|
+
return t("uv-calender.ok")
|
|
220
|
+
},
|
|
221
|
+
cancelText() {
|
|
222
|
+
return t("uv-calender.cancel")
|
|
223
|
+
},
|
|
224
|
+
getConfirmColor() {
|
|
225
|
+
if(this.range || this.multiple || this.readonly) {
|
|
226
|
+
return this.allowConfirm? this.confirmColor: '#999'
|
|
227
|
+
}else {
|
|
228
|
+
return this.confirmColor;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
watch: {
|
|
233
|
+
date(newVal) {
|
|
234
|
+
this.init(newVal)
|
|
235
|
+
},
|
|
236
|
+
startDate(val) {
|
|
237
|
+
this.cale.resetSatrtDate(val)
|
|
238
|
+
this.cale.setDate(this.nowDate.fullDate)
|
|
239
|
+
this.weeks = this.cale.weeks
|
|
240
|
+
},
|
|
241
|
+
endDate(val) {
|
|
242
|
+
this.cale.resetEndDate(val)
|
|
243
|
+
this.cale.setDate(this.nowDate.fullDate)
|
|
244
|
+
this.weeks = this.cale.weeks
|
|
245
|
+
},
|
|
246
|
+
selected(newVal) {
|
|
247
|
+
this.cale.setSelectInfo(this.nowDate.fullDate, newVal)
|
|
248
|
+
this.weeks = this.cale.weeks
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
created() {
|
|
252
|
+
this.setMode();
|
|
253
|
+
this.cale = new Calendar({
|
|
254
|
+
selected: this.selected,
|
|
255
|
+
startDate: this.startDate,
|
|
256
|
+
endDate: this.endDate,
|
|
257
|
+
range: this.range,
|
|
258
|
+
multiple: this.multiple,
|
|
259
|
+
allowSameDay: this.allowSameDay
|
|
260
|
+
})
|
|
261
|
+
this.init(this.date)
|
|
262
|
+
},
|
|
263
|
+
methods: {
|
|
264
|
+
setMode() {
|
|
265
|
+
switch (this.mode){
|
|
266
|
+
case 'range':
|
|
267
|
+
this.range = true;
|
|
268
|
+
break;
|
|
269
|
+
case 'multiple':
|
|
270
|
+
this.multiple = true;
|
|
271
|
+
default:
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
async open() {
|
|
276
|
+
if (this.clearDate && !this.insert) {
|
|
277
|
+
this.cale.cleanRangeStatus()
|
|
278
|
+
this.init(this.date)
|
|
279
|
+
}
|
|
280
|
+
if(!this.insert){
|
|
281
|
+
this.$refs.popup.open();
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
close() {
|
|
285
|
+
this.$refs.popup.close();
|
|
286
|
+
this.$emit('close');
|
|
287
|
+
},
|
|
288
|
+
confirm() {
|
|
289
|
+
if(this.readonly) {
|
|
290
|
+
return;
|
|
291
|
+
} else if(this.range && !this.cale.rangeStatus.after) {
|
|
292
|
+
return;
|
|
293
|
+
} else if(this.multiple && this.cale.multipleStatus.data.length == 0){
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
this.setEmit('confirm');
|
|
297
|
+
this.close()
|
|
298
|
+
},
|
|
299
|
+
maskClick() {
|
|
300
|
+
if(this.closeOnClickOverlay) {
|
|
301
|
+
this.$emit('close');
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
bindDateChange(e) {
|
|
305
|
+
const value = e.detail.value + '-1'
|
|
306
|
+
this.setDate(value)
|
|
307
|
+
|
|
308
|
+
const { year, month } = this.cale.getDate(value)
|
|
309
|
+
this.$emit('monthSwitch', {
|
|
310
|
+
year,
|
|
311
|
+
month
|
|
312
|
+
})
|
|
313
|
+
},
|
|
314
|
+
/**
|
|
315
|
+
* 初始化日期显示
|
|
316
|
+
* @param {Object} date
|
|
317
|
+
*/
|
|
318
|
+
init(date) {
|
|
319
|
+
if(this.range) {
|
|
320
|
+
// 重置范围选择状态
|
|
321
|
+
this.cale.cleanRangeStatus();
|
|
322
|
+
}else if(this.multiple){
|
|
323
|
+
// 重置多选状态
|
|
324
|
+
this.cale.cleanMultipleStatus();
|
|
325
|
+
}
|
|
326
|
+
this.cale.setDate(date,'init')
|
|
327
|
+
this.weeks = this.cale.weeks
|
|
328
|
+
this.nowDate = this.calendar = this.cale.getInfo(date)
|
|
329
|
+
this.changeConfirmStatus();
|
|
330
|
+
},
|
|
331
|
+
/**
|
|
332
|
+
* 变化触发
|
|
333
|
+
*/
|
|
334
|
+
change() {
|
|
335
|
+
this.changeConfirmStatus();
|
|
336
|
+
if (!this.insert) return
|
|
337
|
+
this.setEmit('change')
|
|
338
|
+
},
|
|
339
|
+
changeConfirmStatus() {
|
|
340
|
+
if(this.readonly) {
|
|
341
|
+
this.allowConfirm = false;
|
|
342
|
+
} else if (this.range) {
|
|
343
|
+
this.allowConfirm = this.cale.rangeStatus.after ? true : false;
|
|
344
|
+
} else if(this.multiple) {
|
|
345
|
+
this.allowConfirm = this.cale.multipleStatus.data.length > 0 ? true : false;
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
/**
|
|
349
|
+
* 选择月份触发
|
|
350
|
+
*/
|
|
351
|
+
monthSwitch() {
|
|
352
|
+
let {
|
|
353
|
+
year,
|
|
354
|
+
month
|
|
355
|
+
} = this.nowDate
|
|
356
|
+
this.$emit('monthSwitch', {
|
|
357
|
+
year,
|
|
358
|
+
month: Number(month)
|
|
359
|
+
})
|
|
360
|
+
},
|
|
361
|
+
/**
|
|
362
|
+
* 派发事件
|
|
363
|
+
* @param {Object} name
|
|
364
|
+
*/
|
|
365
|
+
setEmit(name) {
|
|
366
|
+
let {
|
|
367
|
+
year,
|
|
368
|
+
month,
|
|
369
|
+
date,
|
|
370
|
+
fullDate,
|
|
371
|
+
lunar,
|
|
372
|
+
extraInfo
|
|
373
|
+
} = this.calendar
|
|
374
|
+
this.$emit(name, {
|
|
375
|
+
range: this.cale.rangeStatus,
|
|
376
|
+
multiple: this.cale.multipleStatus,
|
|
377
|
+
year,
|
|
378
|
+
month,
|
|
379
|
+
date,
|
|
380
|
+
fulldate: fullDate,
|
|
381
|
+
lunar,
|
|
382
|
+
extraInfo: extraInfo || {}
|
|
383
|
+
})
|
|
384
|
+
},
|
|
385
|
+
/**
|
|
386
|
+
* 选择天触发
|
|
387
|
+
* @param {Object} weeks
|
|
388
|
+
*/
|
|
389
|
+
choiceDate(weeks) {
|
|
390
|
+
if (weeks.disable || this.readonly) return
|
|
391
|
+
this.calendar = weeks
|
|
392
|
+
// 设置范围选择
|
|
393
|
+
this.cale.setRange(this.calendar.fullDate)
|
|
394
|
+
// 设置多选
|
|
395
|
+
this.cale.setMultiple(this.calendar.fullDate);
|
|
396
|
+
this.weeks = this.cale.weeks
|
|
397
|
+
this.change()
|
|
398
|
+
},
|
|
399
|
+
/**
|
|
400
|
+
* 回到今天
|
|
401
|
+
*/
|
|
402
|
+
backToday() {
|
|
403
|
+
const nowYearMonth = `${this.nowDate.year}-${this.nowDate.month}`
|
|
404
|
+
const date = this.cale.getDate(new Date())
|
|
405
|
+
const todayYearMonth = `${date.year}-${date.month}`
|
|
406
|
+
this.init(date.fullDate)
|
|
407
|
+
if (nowYearMonth !== todayYearMonth) {
|
|
408
|
+
this.monthSwitch()
|
|
409
|
+
}
|
|
410
|
+
this.change()
|
|
411
|
+
},
|
|
412
|
+
/**
|
|
413
|
+
* 上个月
|
|
414
|
+
*/
|
|
415
|
+
pre() {
|
|
416
|
+
const preDate = this.cale.getDate(this.nowDate.fullDate, -1, 'month').fullDate
|
|
417
|
+
this.setDate(preDate)
|
|
418
|
+
this.monthSwitch()
|
|
419
|
+
},
|
|
420
|
+
/**
|
|
421
|
+
* 下个月
|
|
422
|
+
*/
|
|
423
|
+
next() {
|
|
424
|
+
const nextDate = this.cale.getDate(this.nowDate.fullDate, +1, 'month').fullDate
|
|
425
|
+
this.setDate(nextDate)
|
|
426
|
+
this.monthSwitch()
|
|
427
|
+
},
|
|
428
|
+
/**
|
|
429
|
+
* 设置日期
|
|
430
|
+
* @param {Object} date
|
|
431
|
+
*/
|
|
432
|
+
setDate(date) {
|
|
433
|
+
this.cale.setDate(date)
|
|
434
|
+
this.weeks = this.cale.weeks
|
|
435
|
+
this.nowDate = this.cale.getInfo(date)
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
</script>
|
|
440
|
+
<style scoped lang="scss">
|
|
441
|
+
$uv-border-color: #EDEDED !default;
|
|
442
|
+
.uv-calendar__content {
|
|
443
|
+
background-color: #fff;
|
|
444
|
+
}
|
|
445
|
+
.line {
|
|
446
|
+
width: 750rpx;
|
|
447
|
+
height: 1px;
|
|
448
|
+
border-bottom-color: $uv-border-color;
|
|
449
|
+
border-bottom-style: solid;
|
|
450
|
+
border-bottom-width: 1px;
|
|
451
|
+
}
|
|
452
|
+
</style>
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
// 标题
|
|
4
|
+
title: {
|
|
5
|
+
type: [String, Number],
|
|
6
|
+
default: ''
|
|
7
|
+
},
|
|
8
|
+
// 标题下方的描述信息
|
|
9
|
+
label: {
|
|
10
|
+
type: [String, Number],
|
|
11
|
+
default: ''
|
|
12
|
+
},
|
|
13
|
+
// 右侧的内容
|
|
14
|
+
value: {
|
|
15
|
+
type: [String, Number],
|
|
16
|
+
default: ''
|
|
17
|
+
},
|
|
18
|
+
// 左侧图标名称,或者图片链接(本地文件建议使用绝对地址)
|
|
19
|
+
icon: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: ''
|
|
22
|
+
},
|
|
23
|
+
// 是否禁用cell
|
|
24
|
+
disabled: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: false
|
|
27
|
+
},
|
|
28
|
+
// 是否显示下边框
|
|
29
|
+
border: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: true
|
|
32
|
+
},
|
|
33
|
+
// 内容是否垂直居中(主要是针对右侧的value部分)
|
|
34
|
+
center: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: true
|
|
37
|
+
},
|
|
38
|
+
// 点击后跳转的URL地址
|
|
39
|
+
url: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: ''
|
|
42
|
+
},
|
|
43
|
+
// 链接跳转的方式,内部使用的是uvui封装的route方法,可能会进行拦截操作
|
|
44
|
+
linkType: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: 'navigateTo'
|
|
47
|
+
},
|
|
48
|
+
// 是否开启点击反馈(表现为点击时加上灰色背景)
|
|
49
|
+
clickable: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false
|
|
52
|
+
},
|
|
53
|
+
// 是否展示右侧箭头并开启点击反馈
|
|
54
|
+
isLink: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: false
|
|
57
|
+
},
|
|
58
|
+
// 是否显示表单状态下的必填星号(此组件可能会内嵌入input组件)
|
|
59
|
+
required: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: false
|
|
62
|
+
},
|
|
63
|
+
// 右侧的图标箭头
|
|
64
|
+
rightIcon: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: 'arrow-right'
|
|
67
|
+
},
|
|
68
|
+
// 右侧箭头的方向,可选值为:left,up,down
|
|
69
|
+
arrowDirection: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: ''
|
|
72
|
+
},
|
|
73
|
+
// 左侧图标样式
|
|
74
|
+
iconStyle: {
|
|
75
|
+
type: [Object, String],
|
|
76
|
+
default: () => {
|
|
77
|
+
return {}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
// 右侧箭头图标的样式
|
|
81
|
+
rightIconStyle: {
|
|
82
|
+
type: [Object, String],
|
|
83
|
+
default: () => {
|
|
84
|
+
return {}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
// 标题的样式
|
|
88
|
+
titleStyle: {
|
|
89
|
+
type: [Object, String],
|
|
90
|
+
default: () => {
|
|
91
|
+
return {}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
// 单位元的大小,可选值为large
|
|
95
|
+
size: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: ''
|
|
98
|
+
},
|
|
99
|
+
// 点击cell是否阻止事件传播
|
|
100
|
+
stop: {
|
|
101
|
+
type: Boolean,
|
|
102
|
+
default: true
|
|
103
|
+
},
|
|
104
|
+
// 标识符,cell被点击时返回
|
|
105
|
+
name: {
|
|
106
|
+
type: [Number, String],
|
|
107
|
+
default: ''
|
|
108
|
+
},
|
|
109
|
+
// 单元格自定义样式
|
|
110
|
+
cellStyle: {
|
|
111
|
+
type: [Object, String],
|
|
112
|
+
default: () => {}
|
|
113
|
+
},
|
|
114
|
+
...uni.$uv?.props?.cell
|
|
115
|
+
}
|
|
116
|
+
}
|