@vtj/materials 0.13.15 → 0.13.17
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/dist/assets/antdv/index.umd.js +2 -2
- package/dist/assets/charts/index.umd.js +2 -2
- package/dist/assets/element/index.umd.js +3 -3
- package/dist/assets/icons/index.umd.js +2 -2
- package/dist/assets/ui/index.umd.js +2 -2
- package/dist/assets/uni-h5/index.umd.js +2 -2
- package/dist/assets/uni-ui/index.umd.js +2 -2
- package/dist/assets/vant/index.umd.js +2 -2
- package/dist/deps/@vtj/charts/index.umd.js +2 -2
- package/dist/deps/@vtj/icons/index.umd.js +2 -2
- package/dist/deps/@vtj/ui/index.umd.js +4 -4
- package/dist/deps/@vtj/ui/style.css +1 -1
- package/dist/deps/@vtj/utils/index.umd.js +28 -33
- package/dist/deps/@vueuse/core/index.iife.min.js +1 -1
- package/dist/deps/element-plus/index.css +1 -1
- package/dist/deps/element-plus/index.full.min.js +14 -14
- package/dist/deps/element-plus/zh-cn.js +1 -1
- package/dist/deps/uni-app/index.umd.js +1 -1
- package/dist/deps/uni-h5/index.umd.js +8 -8
- package/dist/deps/uni-h5/style.css +1 -1
- package/dist/deps/uni-h5-vue/index.umd.js +1 -1
- package/dist/deps/uni-ui/index.umd.js +6 -1
- package/dist/deps/uni-ui/style.css +1 -1
- package/dist/deps/vue/vue.global.js +88 -53
- package/dist/deps/vue/vue.global.prod.js +9 -9
- package/package.json +12 -12
- package/src/antdv/image.ts +1 -1
- package/src/element/image.ts +1 -1
- package/src/element/virtualizedTable.ts +6 -6
- package/src/manifest.json +69 -0
- package/src/pages/index.vue +2 -0
- package/src/pages.json +19 -0
- package/src/uni-ui/index.ts +88 -58
- package/src/{uni-ui/lib/uni.scss → uni.scss} +4 -0
- package/src/version.ts +2 -2
- package/src/uni-ui/lib/uni-col/uni-col.vue +0 -324
- package/src/uni-ui/lib/uni-collapse/uni-collapse.vue +0 -153
- package/src/uni-ui/lib/uni-collapse-item/uni-collapse-item.vue +0 -425
- package/src/uni-ui/lib/uni-data-picker/keypress.js +0 -45
- package/src/uni-ui/lib/uni-data-picker/uni-data-picker.vue +0 -604
- package/src/uni-ui/lib/uni-data-pickerview/uni-data-picker.js +0 -622
- package/src/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.css +0 -76
- package/src/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.vue +0 -335
- package/src/uni-ui/lib/uni-data-select/uni-data-select.vue +0 -590
- package/src/uni-ui/lib/uni-datetime-picker/calendar-item.vue +0 -188
- package/src/uni-ui/lib/uni-datetime-picker/calendar.vue +0 -985
- package/src/uni-ui/lib/uni-datetime-picker/i18n/en.json +0 -22
- package/src/uni-ui/lib/uni-datetime-picker/i18n/index.js +0 -8
- package/src/uni-ui/lib/uni-datetime-picker/i18n/zh-Hans.json +0 -22
- package/src/uni-ui/lib/uni-datetime-picker/i18n/zh-Hant.json +0 -22
- package/src/uni-ui/lib/uni-datetime-picker/time-picker.vue +0 -1032
- package/src/uni-ui/lib/uni-datetime-picker/uni-datetime-picker.vue +0 -1230
- package/src/uni-ui/lib/uni-datetime-picker/util.js +0 -448
- package/src/uni-ui/lib/uni-easyinput/common.js +0 -54
- package/src/uni-ui/lib/uni-easyinput/uni-easyinput.vue +0 -790
- package/src/uni-ui/lib/uni-fav/i18n/en.json +0 -4
- package/src/uni-ui/lib/uni-fav/i18n/index.js +0 -8
- package/src/uni-ui/lib/uni-fav/i18n/zh-Hans.json +0 -4
- package/src/uni-ui/lib/uni-fav/i18n/zh-Hant.json +0 -4
- package/src/uni-ui/lib/uni-fav/uni-fav.vue +0 -170
- package/src/uni-ui/lib/uni-file-picker/choose-and-upload-file.js +0 -280
- package/src/uni-ui/lib/uni-file-picker/uni-file-picker.vue +0 -668
- package/src/uni-ui/lib/uni-file-picker/upload-file.vue +0 -325
- package/src/uni-ui/lib/uni-file-picker/upload-image.vue +0 -292
- package/src/uni-ui/lib/uni-file-picker/utils.js +0 -110
- package/src/uni-ui/lib/uni-forms/uni-forms.vue +0 -416
- package/src/uni-ui/lib/uni-forms/utils.js +0 -293
- package/src/uni-ui/lib/uni-forms/validate.js +0 -486
- package/src/uni-ui/lib/uni-forms-item/uni-forms-item.vue +0 -630
- package/src/uni-ui/lib/uni-goods-nav/i18n/en.json +0 -6
- package/src/uni-ui/lib/uni-goods-nav/i18n/index.js +0 -8
- package/src/uni-ui/lib/uni-goods-nav/i18n/zh-Hans.json +0 -6
- package/src/uni-ui/lib/uni-goods-nav/i18n/zh-Hant.json +0 -6
- package/src/uni-ui/lib/uni-goods-nav/uni-goods-nav.vue +0 -231
- package/src/uni-ui/lib/uni-grid/uni-grid.vue +0 -148
- package/src/uni-ui/lib/uni-icons/uni-icons.uvue +0 -91
- package/src/uni-ui/lib/uni-icons/uni-icons.vue +0 -114
- package/src/uni-ui/lib/uni-icons/uniicons.css +0 -664
- package/src/uni-ui/lib/uni-icons/uniicons.ttf +0 -0
- package/src/uni-ui/lib/uni-icons/uniicons_file.ts +0 -664
- package/src/uni-ui/lib/uni-icons/uniicons_file_vue.js +0 -649
- package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list-item.vue +0 -168
- package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list.vue +0 -404
- package/src/uni-ui/lib/uni-list/uni-list.vue +0 -123
- package/src/uni-ui/lib/uni-list/uni-refresh.vue +0 -65
- package/src/uni-ui/lib/uni-list/uni-refresh.wxs +0 -87
- package/src/uni-ui/lib/uni-load-more/i18n/en.json +0 -5
- package/src/uni-ui/lib/uni-load-more/i18n/index.js +0 -8
- package/src/uni-ui/lib/uni-load-more/i18n/zh-Hans.json +0 -5
- package/src/uni-ui/lib/uni-load-more/i18n/zh-Hant.json +0 -5
- package/src/uni-ui/lib/uni-load-more/uni-load-more.vue +0 -456
- package/src/uni-ui/lib/uni-notice-bar/uni-notice-bar.vue +0 -484
- package/src/uni-ui/lib/uni-popup/i18n/en.json +0 -7
- package/src/uni-ui/lib/uni-popup/i18n/index.js +0 -8
- package/src/uni-ui/lib/uni-popup/i18n/zh-Hans.json +0 -7
- package/src/uni-ui/lib/uni-popup/i18n/zh-Hant.json +0 -7
- package/src/uni-ui/lib/uni-popup/keypress.js +0 -45
- package/src/uni-ui/lib/uni-popup/popup.js +0 -26
- package/src/uni-ui/lib/uni-popup/uni-popup.uvue +0 -90
- package/src/uni-ui/lib/uni-popup/uni-popup.vue +0 -552
- package/src/uni-ui/lib/uni-popup-dialog/keypress.js +0 -45
- package/src/uni-ui/lib/uni-popup-dialog/uni-popup-dialog.vue +0 -324
- package/src/uni-ui/lib/uni-popup-message/uni-popup-message.vue +0 -149
- package/src/uni-ui/lib/uni-rate/uni-rate.vue +0 -380
- package/src/uni-ui/lib/uni-row/uni-row.vue +0 -193
- package/src/uni-ui/lib/uni-search-bar/i18n/en.json +0 -4
- package/src/uni-ui/lib/uni-search-bar/i18n/index.js +0 -8
- package/src/uni-ui/lib/uni-search-bar/i18n/zh-Hans.json +0 -4
- package/src/uni-ui/lib/uni-search-bar/i18n/zh-Hant.json +0 -4
- package/src/uni-ui/lib/uni-search-bar/uni-search-bar.vue +0 -339
- package/src/uni-ui/lib/uni-swipe-action-item/bindingx.js +0 -311
- package/src/uni-ui/lib/uni-swipe-action-item/isPC.js +0 -12
- package/src/uni-ui/lib/uni-swipe-action-item/mpalipay.js +0 -195
- package/src/uni-ui/lib/uni-swipe-action-item/mpother.js +0 -260
- package/src/uni-ui/lib/uni-swipe-action-item/mpwxs.js +0 -84
- package/src/uni-ui/lib/uni-swipe-action-item/render.js +0 -270
- package/src/uni-ui/lib/uni-swipe-action-item/uni-swipe-action-item.vue +0 -493
- package/src/uni-ui/lib/uni-swipe-action-item/wx.wxs +0 -341
- package/src/uni-ui/lib/uni-table/uni-table.vue +0 -496
- package/src/uni-ui/lib/uni-td/uni-td.vue +0 -99
- package/src/uni-ui/lib/uni-th/filter-dropdown.vue +0 -559
- package/src/uni-ui/lib/uni-th/uni-th.vue +0 -322
- package/src/uni-ui/lib/uni-tr/table-checkbox.vue +0 -181
- package/src/uni-ui/lib/uni-tr/uni-tr.vue +0 -208
- package/src/uni-ui/lib/uni-transition/createAnimation.js +0 -131
- package/src/uni-ui/lib/uni-transition/uni-transition.vue +0 -310
- package/src/uni-ui/polyfill.ts +0 -41
@@ -1,1230 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<view class="uni-date">
|
3
|
-
<view class="uni-date-editor" @click="show">
|
4
|
-
<slot>
|
5
|
-
<view
|
6
|
-
class="uni-date-editor--x"
|
7
|
-
:class="{
|
8
|
-
'uni-date-editor--x__disabled': disabled,
|
9
|
-
'uni-date-x--border': border
|
10
|
-
}">
|
11
|
-
<view v-if="!isRange" class="uni-date-x uni-date-single">
|
12
|
-
<uni-icons
|
13
|
-
class="icon-calendar"
|
14
|
-
type="calendar"
|
15
|
-
color="#c0c4cc"
|
16
|
-
size="22"></uni-icons>
|
17
|
-
<view class="uni-date__x-input">{{
|
18
|
-
displayValue || singlePlaceholderText
|
19
|
-
}}</view>
|
20
|
-
</view>
|
21
|
-
|
22
|
-
<view v-else class="uni-date-x uni-date-range">
|
23
|
-
<uni-icons
|
24
|
-
class="icon-calendar"
|
25
|
-
type="calendar"
|
26
|
-
color="#c0c4cc"
|
27
|
-
size="22"></uni-icons>
|
28
|
-
<view class="uni-date__x-input text-center">{{
|
29
|
-
displayRangeValue.startDate || startPlaceholderText
|
30
|
-
}}</view>
|
31
|
-
|
32
|
-
<view class="range-separator">{{ rangeSeparator }}</view>
|
33
|
-
|
34
|
-
<view class="uni-date__x-input text-center">{{
|
35
|
-
displayRangeValue.endDate || endPlaceholderText
|
36
|
-
}}</view>
|
37
|
-
</view>
|
38
|
-
|
39
|
-
<view
|
40
|
-
v-if="showClearIcon"
|
41
|
-
class="uni-date__icon-clear"
|
42
|
-
@click.stop="clear">
|
43
|
-
<uni-icons type="clear" color="#c0c4cc" size="22"></uni-icons>
|
44
|
-
</view>
|
45
|
-
</view>
|
46
|
-
</slot>
|
47
|
-
</view>
|
48
|
-
|
49
|
-
<view
|
50
|
-
v-show="pickerVisible"
|
51
|
-
class="uni-date-mask--pc"
|
52
|
-
@click="close"></view>
|
53
|
-
|
54
|
-
<view
|
55
|
-
v-if="!isPhone"
|
56
|
-
v-show="pickerVisible"
|
57
|
-
ref="datePicker"
|
58
|
-
class="uni-date-picker__container">
|
59
|
-
<view
|
60
|
-
v-if="!isRange"
|
61
|
-
class="uni-date-single--x"
|
62
|
-
:style="pickerPositionStyle">
|
63
|
-
<view class="uni-popper__arrow"></view>
|
64
|
-
|
65
|
-
<view v-if="hasTime" class="uni-date-changed popup-x-header">
|
66
|
-
<input
|
67
|
-
class="uni-date__input text-center"
|
68
|
-
type="text"
|
69
|
-
v-model="inputDate"
|
70
|
-
:placeholder="selectDateText" />
|
71
|
-
|
72
|
-
<time-picker
|
73
|
-
type="time"
|
74
|
-
v-model="pickerTime"
|
75
|
-
:border="false"
|
76
|
-
:disabled="!inputDate"
|
77
|
-
:start="timepickerStartTime"
|
78
|
-
:end="timepickerEndTime"
|
79
|
-
:hideSecond="hideSecond"
|
80
|
-
style="width: 100%">
|
81
|
-
<input
|
82
|
-
class="uni-date__input text-center"
|
83
|
-
type="text"
|
84
|
-
v-model="pickerTime"
|
85
|
-
:placeholder="selectTimeText"
|
86
|
-
:disabled="!inputDate" />
|
87
|
-
</time-picker>
|
88
|
-
</view>
|
89
|
-
|
90
|
-
<Calendar
|
91
|
-
ref="pcSingle"
|
92
|
-
:showMonth="false"
|
93
|
-
:start-date="calendarRange.startDate"
|
94
|
-
:end-date="calendarRange.endDate"
|
95
|
-
:date="calendarDate"
|
96
|
-
@change="singleChange"
|
97
|
-
:default-value="defaultValue"
|
98
|
-
style="padding: 0 8px" />
|
99
|
-
|
100
|
-
<view v-if="hasTime" class="popup-x-footer">
|
101
|
-
<text class="confirm-text" @click="confirmSingleChange">{{
|
102
|
-
okText
|
103
|
-
}}</text>
|
104
|
-
</view>
|
105
|
-
</view>
|
106
|
-
|
107
|
-
<view v-else class="uni-date-range--x" :style="pickerPositionStyle">
|
108
|
-
<view class="uni-popper__arrow"></view>
|
109
|
-
<view v-if="hasTime" class="popup-x-header uni-date-changed">
|
110
|
-
<view class="popup-x-header--datetime">
|
111
|
-
<input
|
112
|
-
class="uni-date__input uni-date-range__input"
|
113
|
-
type="text"
|
114
|
-
v-model="tempRange.startDate"
|
115
|
-
:placeholder="startDateText" />
|
116
|
-
|
117
|
-
<time-picker
|
118
|
-
type="time"
|
119
|
-
v-model="tempRange.startTime"
|
120
|
-
:start="timepickerStartTime"
|
121
|
-
:border="false"
|
122
|
-
:disabled="!tempRange.startDate"
|
123
|
-
:hideSecond="hideSecond">
|
124
|
-
<input
|
125
|
-
class="uni-date__input uni-date-range__input"
|
126
|
-
type="text"
|
127
|
-
v-model="tempRange.startTime"
|
128
|
-
:placeholder="startTimeText"
|
129
|
-
:disabled="!tempRange.startDate" />
|
130
|
-
</time-picker>
|
131
|
-
</view>
|
132
|
-
|
133
|
-
<uni-icons
|
134
|
-
type="arrowthinright"
|
135
|
-
color="#999"
|
136
|
-
style="line-height: 40px"></uni-icons>
|
137
|
-
|
138
|
-
<view class="popup-x-header--datetime">
|
139
|
-
<input
|
140
|
-
class="uni-date__input uni-date-range__input"
|
141
|
-
type="text"
|
142
|
-
v-model="tempRange.endDate"
|
143
|
-
:placeholder="endDateText" />
|
144
|
-
|
145
|
-
<time-picker
|
146
|
-
type="time"
|
147
|
-
v-model="tempRange.endTime"
|
148
|
-
:end="timepickerEndTime"
|
149
|
-
:border="false"
|
150
|
-
:disabled="!tempRange.endDate"
|
151
|
-
:hideSecond="hideSecond">
|
152
|
-
<input
|
153
|
-
class="uni-date__input uni-date-range__input"
|
154
|
-
type="text"
|
155
|
-
v-model="tempRange.endTime"
|
156
|
-
:placeholder="endTimeText"
|
157
|
-
:disabled="!tempRange.endDate" />
|
158
|
-
</time-picker>
|
159
|
-
</view>
|
160
|
-
</view>
|
161
|
-
|
162
|
-
<view class="popup-x-body">
|
163
|
-
<Calendar
|
164
|
-
ref="left"
|
165
|
-
:showMonth="false"
|
166
|
-
:start-date="calendarRange.startDate"
|
167
|
-
:end-date="calendarRange.endDate"
|
168
|
-
:range="true"
|
169
|
-
:pleStatus="endMultipleStatus"
|
170
|
-
@change="leftChange"
|
171
|
-
@firstEnterCale="updateRightCale"
|
172
|
-
style="padding: 0 8px" />
|
173
|
-
<Calendar
|
174
|
-
ref="right"
|
175
|
-
:showMonth="false"
|
176
|
-
:start-date="calendarRange.startDate"
|
177
|
-
:end-date="calendarRange.endDate"
|
178
|
-
:range="true"
|
179
|
-
@change="rightChange"
|
180
|
-
:pleStatus="startMultipleStatus"
|
181
|
-
@firstEnterCale="updateLeftCale"
|
182
|
-
style="padding: 0 8px; border-left: 1px solid #f1f1f1" />
|
183
|
-
</view>
|
184
|
-
|
185
|
-
<view v-if="hasTime" class="popup-x-footer">
|
186
|
-
<text @click="clear">{{ clearText }}</text>
|
187
|
-
<text class="confirm-text" @click="confirmRangeChange">{{
|
188
|
-
okText
|
189
|
-
}}</text>
|
190
|
-
</view>
|
191
|
-
</view>
|
192
|
-
</view>
|
193
|
-
|
194
|
-
<Calendar
|
195
|
-
v-if="isPhone"
|
196
|
-
ref="mobile"
|
197
|
-
:clearDate="false"
|
198
|
-
:date="calendarDate"
|
199
|
-
:defTime="mobileCalendarTime"
|
200
|
-
:start-date="calendarRange.startDate"
|
201
|
-
:end-date="calendarRange.endDate"
|
202
|
-
:selectableTimes="mobSelectableTime"
|
203
|
-
:startPlaceholder="startPlaceholder"
|
204
|
-
:endPlaceholder="endPlaceholder"
|
205
|
-
:default-value="defaultValue"
|
206
|
-
:pleStatus="endMultipleStatus"
|
207
|
-
:showMonth="false"
|
208
|
-
:range="isRange"
|
209
|
-
:hasTime="hasTime"
|
210
|
-
:insert="false"
|
211
|
-
:hideSecond="hideSecond"
|
212
|
-
@confirm="mobileChange"
|
213
|
-
@maskClose="close"
|
214
|
-
@change="calendarClick" />
|
215
|
-
</view>
|
216
|
-
</template>
|
217
|
-
<script>
|
218
|
-
/**
|
219
|
-
* DatetimePicker 时间选择器
|
220
|
-
* @description 同时支持 PC 和移动端使用日历选择日期和日期范围
|
221
|
-
* @tutorial https://ext.dcloud.net.cn/plugin?id=3962
|
222
|
-
* @property {String} type 选择器类型
|
223
|
-
* @property {String|Number|Array|Date} value 绑定值
|
224
|
-
* @property {String} placeholder 单选择时的占位内容
|
225
|
-
* @property {String} start 起始时间
|
226
|
-
* @property {String} end 终止时间
|
227
|
-
* @property {String} start-placeholder 范围选择时开始日期的占位内容
|
228
|
-
* @property {String} end-placeholder 范围选择时结束日期的占位内容
|
229
|
-
* @property {String} range-separator 选择范围时的分隔符
|
230
|
-
* @property {Boolean} border = [true|false] 是否有边框
|
231
|
-
* @property {Boolean} disabled = [true|false] 是否禁用
|
232
|
-
* @property {Boolean} clearIcon = [true|false] 是否显示清除按钮(仅PC端适用)
|
233
|
-
* @property {[String} defaultValue 选择器打开时默认显示的时间
|
234
|
-
* @event {Function} change 确定日期时触发的事件
|
235
|
-
* @event {Function} maskClick 点击遮罩层触发的事件
|
236
|
-
* @event {Function} show 打开弹出层
|
237
|
-
* @event {Function} close 关闭弹出层
|
238
|
-
* @event {Function} clear 清除上次选中的状态和值
|
239
|
-
**/
|
240
|
-
import Calendar from './calendar.vue';
|
241
|
-
import TimePicker from './time-picker.vue';
|
242
|
-
import { initVueI18n } from '@dcloudio/uni-i18n';
|
243
|
-
import i18nMessages from './i18n/index.js';
|
244
|
-
import {
|
245
|
-
getDateTime,
|
246
|
-
getDate,
|
247
|
-
getTime,
|
248
|
-
getDefaultSecond,
|
249
|
-
dateCompare,
|
250
|
-
checkDate,
|
251
|
-
fixIosDateFormat
|
252
|
-
} from './util';
|
253
|
-
|
254
|
-
export default {
|
255
|
-
name: 'UniDatetimePicker',
|
256
|
-
|
257
|
-
options: {
|
258
|
-
// #ifdef MP-TOUTIAO
|
259
|
-
// virtualHost: false,
|
260
|
-
// #endif
|
261
|
-
// #ifndef MP-TOUTIAO
|
262
|
-
virtualHost: true
|
263
|
-
// #endif
|
264
|
-
},
|
265
|
-
components: {
|
266
|
-
Calendar,
|
267
|
-
TimePicker
|
268
|
-
},
|
269
|
-
data() {
|
270
|
-
return {
|
271
|
-
isRange: false,
|
272
|
-
hasTime: false,
|
273
|
-
displayValue: '',
|
274
|
-
inputDate: '',
|
275
|
-
calendarDate: '',
|
276
|
-
pickerTime: '',
|
277
|
-
calendarRange: {
|
278
|
-
startDate: '',
|
279
|
-
startTime: '',
|
280
|
-
endDate: '',
|
281
|
-
endTime: ''
|
282
|
-
},
|
283
|
-
displayRangeValue: {
|
284
|
-
startDate: '',
|
285
|
-
endDate: ''
|
286
|
-
},
|
287
|
-
tempRange: {
|
288
|
-
startDate: '',
|
289
|
-
startTime: '',
|
290
|
-
endDate: '',
|
291
|
-
endTime: ''
|
292
|
-
},
|
293
|
-
// 左右日历同步数据
|
294
|
-
startMultipleStatus: {
|
295
|
-
before: '',
|
296
|
-
after: '',
|
297
|
-
data: [],
|
298
|
-
fulldate: ''
|
299
|
-
},
|
300
|
-
endMultipleStatus: {
|
301
|
-
before: '',
|
302
|
-
after: '',
|
303
|
-
data: [],
|
304
|
-
fulldate: ''
|
305
|
-
},
|
306
|
-
pickerVisible: false,
|
307
|
-
pickerPositionStyle: null,
|
308
|
-
isEmitValue: false,
|
309
|
-
isPhone: false,
|
310
|
-
isFirstShow: true,
|
311
|
-
i18nT: () => {}
|
312
|
-
};
|
313
|
-
},
|
314
|
-
props: {
|
315
|
-
type: {
|
316
|
-
type: String,
|
317
|
-
default: 'datetime'
|
318
|
-
},
|
319
|
-
value: {
|
320
|
-
type: [String, Number, Array, Date],
|
321
|
-
default: ''
|
322
|
-
},
|
323
|
-
modelValue: {
|
324
|
-
type: [String, Number, Array, Date],
|
325
|
-
default: ''
|
326
|
-
},
|
327
|
-
start: {
|
328
|
-
type: [Number, String],
|
329
|
-
default: ''
|
330
|
-
},
|
331
|
-
end: {
|
332
|
-
type: [Number, String],
|
333
|
-
default: ''
|
334
|
-
},
|
335
|
-
returnType: {
|
336
|
-
type: String,
|
337
|
-
default: 'string'
|
338
|
-
},
|
339
|
-
placeholder: {
|
340
|
-
type: String,
|
341
|
-
default: ''
|
342
|
-
},
|
343
|
-
startPlaceholder: {
|
344
|
-
type: String,
|
345
|
-
default: ''
|
346
|
-
},
|
347
|
-
endPlaceholder: {
|
348
|
-
type: String,
|
349
|
-
default: ''
|
350
|
-
},
|
351
|
-
rangeSeparator: {
|
352
|
-
type: String,
|
353
|
-
default: '-'
|
354
|
-
},
|
355
|
-
border: {
|
356
|
-
type: [Boolean],
|
357
|
-
default: true
|
358
|
-
},
|
359
|
-
disabled: {
|
360
|
-
type: [Boolean],
|
361
|
-
default: false
|
362
|
-
},
|
363
|
-
clearIcon: {
|
364
|
-
type: [Boolean],
|
365
|
-
default: true
|
366
|
-
},
|
367
|
-
hideSecond: {
|
368
|
-
type: [Boolean],
|
369
|
-
default: false
|
370
|
-
},
|
371
|
-
defaultValue: {
|
372
|
-
type: [String, Object, Array],
|
373
|
-
default: ''
|
374
|
-
}
|
375
|
-
},
|
376
|
-
watch: {
|
377
|
-
type: {
|
378
|
-
immediate: true,
|
379
|
-
handler(newVal) {
|
380
|
-
this.hasTime = newVal.indexOf('time') !== -1;
|
381
|
-
this.isRange = newVal.indexOf('range') !== -1;
|
382
|
-
}
|
383
|
-
},
|
384
|
-
// #ifndef VUE3
|
385
|
-
// value: {
|
386
|
-
// immediate: true,
|
387
|
-
// handler(newVal) {
|
388
|
-
// if (this.isEmitValue) {
|
389
|
-
// this.isEmitValue = false;
|
390
|
-
// return;
|
391
|
-
// }
|
392
|
-
// this.initPicker(newVal);
|
393
|
-
// }
|
394
|
-
// },
|
395
|
-
// #endif
|
396
|
-
// #ifdef VUE3
|
397
|
-
modelValue: {
|
398
|
-
immediate: true,
|
399
|
-
handler(newVal) {
|
400
|
-
if (this.isEmitValue) {
|
401
|
-
this.isEmitValue = false;
|
402
|
-
return;
|
403
|
-
}
|
404
|
-
this.initPicker(newVal);
|
405
|
-
}
|
406
|
-
},
|
407
|
-
// #endif
|
408
|
-
start: {
|
409
|
-
immediate: true,
|
410
|
-
handler(newVal) {
|
411
|
-
if (!newVal) return;
|
412
|
-
this.calendarRange.startDate = getDate(newVal);
|
413
|
-
if (this.hasTime) {
|
414
|
-
this.calendarRange.startTime = getTime(newVal);
|
415
|
-
}
|
416
|
-
}
|
417
|
-
},
|
418
|
-
end: {
|
419
|
-
immediate: true,
|
420
|
-
handler(newVal) {
|
421
|
-
if (!newVal) return;
|
422
|
-
this.calendarRange.endDate = getDate(newVal);
|
423
|
-
if (this.hasTime) {
|
424
|
-
this.calendarRange.endTime = getTime(newVal, this.hideSecond);
|
425
|
-
}
|
426
|
-
}
|
427
|
-
}
|
428
|
-
},
|
429
|
-
computed: {
|
430
|
-
timepickerStartTime() {
|
431
|
-
const activeDate = this.isRange
|
432
|
-
? this.tempRange.startDate
|
433
|
-
: this.inputDate;
|
434
|
-
return activeDate === this.calendarRange.startDate
|
435
|
-
? this.calendarRange.startTime
|
436
|
-
: '';
|
437
|
-
},
|
438
|
-
timepickerEndTime() {
|
439
|
-
const activeDate = this.isRange
|
440
|
-
? this.tempRange.endDate
|
441
|
-
: this.inputDate;
|
442
|
-
return activeDate === this.calendarRange.endDate
|
443
|
-
? this.calendarRange.endTime
|
444
|
-
: '';
|
445
|
-
},
|
446
|
-
mobileCalendarTime() {
|
447
|
-
const timeRange = {
|
448
|
-
start: this.tempRange.startTime,
|
449
|
-
end: this.tempRange.endTime
|
450
|
-
};
|
451
|
-
return this.isRange ? timeRange : this.pickerTime;
|
452
|
-
},
|
453
|
-
mobSelectableTime() {
|
454
|
-
return {
|
455
|
-
start: this.calendarRange.startTime,
|
456
|
-
end: this.calendarRange.endTime
|
457
|
-
};
|
458
|
-
},
|
459
|
-
datePopupWidth() {
|
460
|
-
// todo
|
461
|
-
return this.isRange ? 653 : 301;
|
462
|
-
},
|
463
|
-
|
464
|
-
/**
|
465
|
-
* for i18n
|
466
|
-
*/
|
467
|
-
singlePlaceholderText() {
|
468
|
-
return (
|
469
|
-
this.placeholder ||
|
470
|
-
(this.type === 'date' ? this.selectDateText : this.selectDateTimeText)
|
471
|
-
);
|
472
|
-
},
|
473
|
-
startPlaceholderText() {
|
474
|
-
return this.startPlaceholder || this.startDateText;
|
475
|
-
},
|
476
|
-
endPlaceholderText() {
|
477
|
-
return this.endPlaceholder || this.endDateText;
|
478
|
-
},
|
479
|
-
selectDateText() {
|
480
|
-
return this.i18nT('uni-datetime-picker.selectDate');
|
481
|
-
},
|
482
|
-
selectDateTimeText() {
|
483
|
-
return this.i18nT('uni-datetime-picker.selectDateTime');
|
484
|
-
},
|
485
|
-
selectTimeText() {
|
486
|
-
return this.i18nT('uni-datetime-picker.selectTime');
|
487
|
-
},
|
488
|
-
startDateText() {
|
489
|
-
return (
|
490
|
-
this.startPlaceholder || this.i18nT('uni-datetime-picker.startDate')
|
491
|
-
);
|
492
|
-
},
|
493
|
-
startTimeText() {
|
494
|
-
return this.i18nT('uni-datetime-picker.startTime');
|
495
|
-
},
|
496
|
-
endDateText() {
|
497
|
-
return this.endPlaceholder || this.i18nT('uni-datetime-picker.endDate');
|
498
|
-
},
|
499
|
-
endTimeText() {
|
500
|
-
return this.i18nT('uni-datetime-picker.endTime');
|
501
|
-
},
|
502
|
-
okText() {
|
503
|
-
return this.i18nT('uni-datetime-picker.ok');
|
504
|
-
},
|
505
|
-
clearText() {
|
506
|
-
return this.i18nT('uni-datetime-picker.clear');
|
507
|
-
},
|
508
|
-
showClearIcon() {
|
509
|
-
return (
|
510
|
-
this.clearIcon &&
|
511
|
-
!this.disabled &&
|
512
|
-
(this.displayValue ||
|
513
|
-
(this.displayRangeValue.startDate &&
|
514
|
-
this.displayRangeValue.endDate))
|
515
|
-
);
|
516
|
-
}
|
517
|
-
},
|
518
|
-
created() {
|
519
|
-
this.initI18nT();
|
520
|
-
this.platform();
|
521
|
-
},
|
522
|
-
methods: {
|
523
|
-
initI18nT() {
|
524
|
-
const vueI18n = initVueI18n(i18nMessages);
|
525
|
-
this.i18nT = vueI18n.t;
|
526
|
-
},
|
527
|
-
initPicker(newVal) {
|
528
|
-
if (
|
529
|
-
(!newVal && !this.defaultValue) ||
|
530
|
-
(Array.isArray(newVal) && !newVal.length)
|
531
|
-
) {
|
532
|
-
this.$nextTick(() => {
|
533
|
-
this.clear(false);
|
534
|
-
});
|
535
|
-
return;
|
536
|
-
}
|
537
|
-
|
538
|
-
if (!Array.isArray(newVal) && !this.isRange) {
|
539
|
-
if (newVal) {
|
540
|
-
this.displayValue =
|
541
|
-
this.inputDate =
|
542
|
-
this.calendarDate =
|
543
|
-
getDate(newVal);
|
544
|
-
if (this.hasTime) {
|
545
|
-
this.pickerTime = getTime(newVal, this.hideSecond);
|
546
|
-
this.displayValue = `${this.displayValue} ${this.pickerTime}`;
|
547
|
-
}
|
548
|
-
} else if (this.defaultValue) {
|
549
|
-
this.inputDate = this.calendarDate = getDate(this.defaultValue);
|
550
|
-
if (this.hasTime) {
|
551
|
-
this.pickerTime = getTime(this.defaultValue, this.hideSecond);
|
552
|
-
}
|
553
|
-
}
|
554
|
-
} else {
|
555
|
-
const [before, after] = newVal;
|
556
|
-
if (!before && !after) return;
|
557
|
-
const beforeDate = getDate(before);
|
558
|
-
const beforeTime = getTime(before, this.hideSecond);
|
559
|
-
|
560
|
-
const afterDate = getDate(after);
|
561
|
-
const afterTime = getTime(after, this.hideSecond);
|
562
|
-
const startDate = beforeDate;
|
563
|
-
const endDate = afterDate;
|
564
|
-
this.displayRangeValue.startDate = this.tempRange.startDate =
|
565
|
-
startDate;
|
566
|
-
this.displayRangeValue.endDate = this.tempRange.endDate = endDate;
|
567
|
-
|
568
|
-
if (this.hasTime) {
|
569
|
-
this.displayRangeValue.startDate = `${beforeDate} ${beforeTime}`;
|
570
|
-
this.displayRangeValue.endDate = `${afterDate} ${afterTime}`;
|
571
|
-
this.tempRange.startTime = beforeTime;
|
572
|
-
this.tempRange.endTime = afterTime;
|
573
|
-
}
|
574
|
-
const defaultRange = {
|
575
|
-
before: beforeDate,
|
576
|
-
after: afterDate
|
577
|
-
};
|
578
|
-
this.startMultipleStatus = Object.assign(
|
579
|
-
{},
|
580
|
-
this.startMultipleStatus,
|
581
|
-
defaultRange,
|
582
|
-
{
|
583
|
-
which: 'right'
|
584
|
-
}
|
585
|
-
);
|
586
|
-
this.endMultipleStatus = Object.assign(
|
587
|
-
{},
|
588
|
-
this.endMultipleStatus,
|
589
|
-
defaultRange,
|
590
|
-
{
|
591
|
-
which: 'left'
|
592
|
-
}
|
593
|
-
);
|
594
|
-
}
|
595
|
-
},
|
596
|
-
updateLeftCale(e) {
|
597
|
-
const left = this.$refs.left;
|
598
|
-
// 设置范围选
|
599
|
-
left.cale.setHoverMultiple(e.after);
|
600
|
-
left.setDate(this.$refs.left.nowDate.fullDate);
|
601
|
-
},
|
602
|
-
updateRightCale(e) {
|
603
|
-
const right = this.$refs.right;
|
604
|
-
// 设置范围选
|
605
|
-
right.cale.setHoverMultiple(e.after);
|
606
|
-
right.setDate(this.$refs.right.nowDate.fullDate);
|
607
|
-
},
|
608
|
-
platform() {
|
609
|
-
if (typeof navigator !== 'undefined') {
|
610
|
-
this.isPhone =
|
611
|
-
navigator.userAgent.toLowerCase().indexOf('mobile') !== -1;
|
612
|
-
return;
|
613
|
-
}
|
614
|
-
// #ifdef MP-WEIXIN
|
615
|
-
// const { windowWidth } = uni.getWindowInfo();
|
616
|
-
// #endif
|
617
|
-
// #ifndef MP-WEIXIN
|
618
|
-
const { windowWidth } = uni.getSystemInfoSync();
|
619
|
-
// #endif
|
620
|
-
this.isPhone = windowWidth <= 500;
|
621
|
-
this.windowWidth = windowWidth;
|
622
|
-
},
|
623
|
-
show() {
|
624
|
-
this.$emit('show');
|
625
|
-
if (this.disabled) {
|
626
|
-
return;
|
627
|
-
}
|
628
|
-
this.platform();
|
629
|
-
if (this.isPhone) {
|
630
|
-
setTimeout(() => {
|
631
|
-
this.$refs.mobile.open();
|
632
|
-
}, 0);
|
633
|
-
return;
|
634
|
-
}
|
635
|
-
this.pickerPositionStyle = {
|
636
|
-
top: '10px'
|
637
|
-
};
|
638
|
-
const dateEditor = uni
|
639
|
-
.createSelectorQuery()
|
640
|
-
.in(this)
|
641
|
-
.select('.uni-date-editor');
|
642
|
-
dateEditor
|
643
|
-
.boundingClientRect((rect) => {
|
644
|
-
if (this.windowWidth - rect.left < this.datePopupWidth) {
|
645
|
-
this.pickerPositionStyle.right = 0;
|
646
|
-
}
|
647
|
-
})
|
648
|
-
.exec();
|
649
|
-
setTimeout(() => {
|
650
|
-
this.pickerVisible = !this.pickerVisible;
|
651
|
-
if (!this.isPhone && this.isRange && this.isFirstShow) {
|
652
|
-
this.isFirstShow = false;
|
653
|
-
const { startDate, endDate } = this.calendarRange;
|
654
|
-
if (startDate && endDate) {
|
655
|
-
if (this.diffDate(startDate, endDate) < 30) {
|
656
|
-
this.$refs.right.changeMonth('pre');
|
657
|
-
}
|
658
|
-
} else {
|
659
|
-
// this.$refs.right.changeMonth('next')
|
660
|
-
if (this.isPhone) {
|
661
|
-
this.$refs.right.cale.lastHover = false;
|
662
|
-
}
|
663
|
-
}
|
664
|
-
}
|
665
|
-
}, 50);
|
666
|
-
},
|
667
|
-
close() {
|
668
|
-
setTimeout(() => {
|
669
|
-
this.pickerVisible = false;
|
670
|
-
this.$emit('maskClick', this.value);
|
671
|
-
this.$refs.mobile && this.$refs.mobile.close();
|
672
|
-
}, 20);
|
673
|
-
},
|
674
|
-
setEmit(value) {
|
675
|
-
if (this.returnType === 'timestamp' || this.returnType === 'date') {
|
676
|
-
if (!Array.isArray(value)) {
|
677
|
-
if (!this.hasTime) {
|
678
|
-
value = value + ' ' + '00:00:00';
|
679
|
-
}
|
680
|
-
value = this.createTimestamp(value);
|
681
|
-
if (this.returnType === 'date') {
|
682
|
-
value = new Date(value);
|
683
|
-
}
|
684
|
-
} else {
|
685
|
-
if (!this.hasTime) {
|
686
|
-
value[0] = value[0] + ' ' + '00:00:00';
|
687
|
-
value[1] = value[1] + ' ' + '00:00:00';
|
688
|
-
}
|
689
|
-
value[0] = this.createTimestamp(value[0]);
|
690
|
-
value[1] = this.createTimestamp(value[1]);
|
691
|
-
if (this.returnType === 'date') {
|
692
|
-
value[0] = new Date(value[0]);
|
693
|
-
value[1] = new Date(value[1]);
|
694
|
-
}
|
695
|
-
}
|
696
|
-
}
|
697
|
-
|
698
|
-
this.$emit('update:modelValue', value);
|
699
|
-
this.$emit('input', value);
|
700
|
-
this.$emit('change', value);
|
701
|
-
this.isEmitValue = true;
|
702
|
-
},
|
703
|
-
createTimestamp(date) {
|
704
|
-
date = fixIosDateFormat(date);
|
705
|
-
return Date.parse(new Date(date));
|
706
|
-
},
|
707
|
-
singleChange(e) {
|
708
|
-
this.calendarDate = this.inputDate = e.fulldate;
|
709
|
-
if (this.hasTime) return;
|
710
|
-
this.confirmSingleChange();
|
711
|
-
},
|
712
|
-
confirmSingleChange() {
|
713
|
-
if (!checkDate(this.inputDate)) {
|
714
|
-
const now = new Date();
|
715
|
-
this.calendarDate = this.inputDate = getDate(now);
|
716
|
-
this.pickerTime = getTime(now, this.hideSecond);
|
717
|
-
}
|
718
|
-
|
719
|
-
let startLaterInputDate = false;
|
720
|
-
let startDate, startTime;
|
721
|
-
if (this.start) {
|
722
|
-
let startString = this.start;
|
723
|
-
if (typeof this.start === 'number') {
|
724
|
-
startString = getDateTime(this.start, this.hideSecond);
|
725
|
-
}
|
726
|
-
[startDate, startTime] = startString.split(' ');
|
727
|
-
if (this.start && !dateCompare(startDate, this.inputDate)) {
|
728
|
-
startLaterInputDate = true;
|
729
|
-
this.inputDate = startDate;
|
730
|
-
}
|
731
|
-
}
|
732
|
-
|
733
|
-
let endEarlierInputDate = false;
|
734
|
-
let endDate, endTime;
|
735
|
-
if (this.end) {
|
736
|
-
let endString = this.end;
|
737
|
-
if (typeof this.end === 'number') {
|
738
|
-
endString = getDateTime(this.end, this.hideSecond);
|
739
|
-
}
|
740
|
-
[endDate, endTime] = endString.split(' ');
|
741
|
-
if (this.end && !dateCompare(this.inputDate, endDate)) {
|
742
|
-
endEarlierInputDate = true;
|
743
|
-
this.inputDate = endDate;
|
744
|
-
}
|
745
|
-
}
|
746
|
-
if (this.hasTime) {
|
747
|
-
if (startLaterInputDate) {
|
748
|
-
this.pickerTime = startTime || getDefaultSecond(this.hideSecond);
|
749
|
-
}
|
750
|
-
if (endEarlierInputDate) {
|
751
|
-
this.pickerTime = endTime || getDefaultSecond(this.hideSecond);
|
752
|
-
}
|
753
|
-
if (!this.pickerTime) {
|
754
|
-
this.pickerTime = getTime(Date.now(), this.hideSecond);
|
755
|
-
}
|
756
|
-
this.displayValue = `${this.inputDate} ${this.pickerTime}`;
|
757
|
-
} else {
|
758
|
-
this.displayValue = this.inputDate;
|
759
|
-
}
|
760
|
-
this.setEmit(this.displayValue);
|
761
|
-
this.pickerVisible = false;
|
762
|
-
},
|
763
|
-
leftChange(e) {
|
764
|
-
const { before, after } = e.range;
|
765
|
-
this.rangeChange(before, after);
|
766
|
-
const obj = {
|
767
|
-
before: e.range.before,
|
768
|
-
after: e.range.after,
|
769
|
-
data: e.range.data,
|
770
|
-
fulldate: e.fulldate
|
771
|
-
};
|
772
|
-
this.startMultipleStatus = Object.assign(
|
773
|
-
{},
|
774
|
-
this.startMultipleStatus,
|
775
|
-
obj
|
776
|
-
);
|
777
|
-
this.$emit('calendarClick', e);
|
778
|
-
},
|
779
|
-
rightChange(e) {
|
780
|
-
const { before, after } = e.range;
|
781
|
-
this.rangeChange(before, after);
|
782
|
-
const obj = {
|
783
|
-
before: e.range.before,
|
784
|
-
after: e.range.after,
|
785
|
-
data: e.range.data,
|
786
|
-
fulldate: e.fulldate
|
787
|
-
};
|
788
|
-
this.endMultipleStatus = Object.assign({}, this.endMultipleStatus, obj);
|
789
|
-
this.$emit('calendarClick', e);
|
790
|
-
},
|
791
|
-
mobileChange(e) {
|
792
|
-
if (this.isRange) {
|
793
|
-
const { before, after } = e.range;
|
794
|
-
if (!before) {
|
795
|
-
return;
|
796
|
-
}
|
797
|
-
|
798
|
-
this.handleStartAndEnd(before, after, true);
|
799
|
-
if (this.hasTime) {
|
800
|
-
const { startTime, endTime } = e.timeRange;
|
801
|
-
this.tempRange.startTime = startTime;
|
802
|
-
this.tempRange.endTime = endTime;
|
803
|
-
}
|
804
|
-
this.confirmRangeChange();
|
805
|
-
} else {
|
806
|
-
if (this.hasTime) {
|
807
|
-
this.displayValue = e.fulldate + ' ' + e.time;
|
808
|
-
} else {
|
809
|
-
this.displayValue = e.fulldate;
|
810
|
-
}
|
811
|
-
this.setEmit(this.displayValue);
|
812
|
-
}
|
813
|
-
this.$refs.mobile.close();
|
814
|
-
},
|
815
|
-
rangeChange(before, after) {
|
816
|
-
if (!(before && after)) return;
|
817
|
-
this.handleStartAndEnd(before, after, true);
|
818
|
-
if (this.hasTime) return;
|
819
|
-
this.confirmRangeChange();
|
820
|
-
},
|
821
|
-
confirmRangeChange() {
|
822
|
-
if (!this.tempRange.startDate || !this.tempRange.endDate) {
|
823
|
-
this.pickerVisible = false;
|
824
|
-
return;
|
825
|
-
}
|
826
|
-
if (!checkDate(this.tempRange.startDate)) {
|
827
|
-
this.tempRange.startDate = getDate(Date.now());
|
828
|
-
}
|
829
|
-
if (!checkDate(this.tempRange.endDate)) {
|
830
|
-
this.tempRange.endDate = getDate(Date.now());
|
831
|
-
}
|
832
|
-
|
833
|
-
let start, end;
|
834
|
-
|
835
|
-
let startDateLaterRangeStartDate = false;
|
836
|
-
let startDateLaterRangeEndDate = false;
|
837
|
-
let startDate, startTime;
|
838
|
-
if (this.start) {
|
839
|
-
let startString = this.start;
|
840
|
-
if (typeof this.start === 'number') {
|
841
|
-
startString = getDateTime(this.start, this.hideSecond);
|
842
|
-
}
|
843
|
-
[startDate, startTime] = startString.split(' ');
|
844
|
-
if (
|
845
|
-
this.start &&
|
846
|
-
!dateCompare(
|
847
|
-
this.start,
|
848
|
-
`${this.tempRange.startDate} ${this.tempRange.startTime}`
|
849
|
-
)
|
850
|
-
) {
|
851
|
-
startDateLaterRangeStartDate = true;
|
852
|
-
this.tempRange.startDate = startDate;
|
853
|
-
}
|
854
|
-
if (
|
855
|
-
this.start &&
|
856
|
-
!dateCompare(
|
857
|
-
this.start,
|
858
|
-
`${this.tempRange.endDate} ${this.tempRange.endTime}`
|
859
|
-
)
|
860
|
-
) {
|
861
|
-
startDateLaterRangeEndDate = true;
|
862
|
-
this.tempRange.endDate = startDate;
|
863
|
-
}
|
864
|
-
}
|
865
|
-
let endDateEarlierRangeStartDate = false;
|
866
|
-
let endDateEarlierRangeEndDate = false;
|
867
|
-
let endDate, endTime;
|
868
|
-
if (this.end) {
|
869
|
-
let endString = this.end;
|
870
|
-
if (typeof this.end === 'number') {
|
871
|
-
endString = getDateTime(this.end, this.hideSecond);
|
872
|
-
}
|
873
|
-
[endDate, endTime] = endString.split(' ');
|
874
|
-
|
875
|
-
if (
|
876
|
-
this.end &&
|
877
|
-
!dateCompare(
|
878
|
-
`${this.tempRange.startDate} ${this.tempRange.startTime}`,
|
879
|
-
this.end
|
880
|
-
)
|
881
|
-
) {
|
882
|
-
endDateEarlierRangeStartDate = true;
|
883
|
-
this.tempRange.startDate = endDate;
|
884
|
-
}
|
885
|
-
if (
|
886
|
-
this.end &&
|
887
|
-
!dateCompare(
|
888
|
-
`${this.tempRange.endDate} ${this.tempRange.endTime}`,
|
889
|
-
this.end
|
890
|
-
)
|
891
|
-
) {
|
892
|
-
endDateEarlierRangeEndDate = true;
|
893
|
-
this.tempRange.endDate = endDate;
|
894
|
-
}
|
895
|
-
}
|
896
|
-
if (!this.hasTime) {
|
897
|
-
start = this.displayRangeValue.startDate = this.tempRange.startDate;
|
898
|
-
end = this.displayRangeValue.endDate = this.tempRange.endDate;
|
899
|
-
} else {
|
900
|
-
if (startDateLaterRangeStartDate) {
|
901
|
-
this.tempRange.startTime =
|
902
|
-
startTime || getDefaultSecond(this.hideSecond);
|
903
|
-
} else if (endDateEarlierRangeStartDate) {
|
904
|
-
this.tempRange.startTime =
|
905
|
-
endTime || getDefaultSecond(this.hideSecond);
|
906
|
-
}
|
907
|
-
if (!this.tempRange.startTime) {
|
908
|
-
this.tempRange.startTime = getTime(Date.now(), this.hideSecond);
|
909
|
-
}
|
910
|
-
|
911
|
-
if (startDateLaterRangeEndDate) {
|
912
|
-
this.tempRange.endTime =
|
913
|
-
startTime || getDefaultSecond(this.hideSecond);
|
914
|
-
} else if (endDateEarlierRangeEndDate) {
|
915
|
-
this.tempRange.endTime =
|
916
|
-
endTime || getDefaultSecond(this.hideSecond);
|
917
|
-
}
|
918
|
-
if (!this.tempRange.endTime) {
|
919
|
-
this.tempRange.endTime = getTime(Date.now(), this.hideSecond);
|
920
|
-
}
|
921
|
-
start =
|
922
|
-
this.displayRangeValue.startDate = `${this.tempRange.startDate} ${this.tempRange.startTime}`;
|
923
|
-
end =
|
924
|
-
this.displayRangeValue.endDate = `${this.tempRange.endDate} ${this.tempRange.endTime}`;
|
925
|
-
}
|
926
|
-
if (!dateCompare(start, end)) {
|
927
|
-
[start, end] = [end, start];
|
928
|
-
}
|
929
|
-
this.displayRangeValue.startDate = start;
|
930
|
-
this.displayRangeValue.endDate = end;
|
931
|
-
const displayRange = [start, end];
|
932
|
-
this.setEmit(displayRange);
|
933
|
-
this.pickerVisible = false;
|
934
|
-
},
|
935
|
-
handleStartAndEnd(before, after, temp = false) {
|
936
|
-
if (!before) return;
|
937
|
-
if (!after) after = before;
|
938
|
-
const type = temp ? 'tempRange' : 'range';
|
939
|
-
const isStartEarlierEnd = dateCompare(before, after);
|
940
|
-
this[type].startDate = isStartEarlierEnd ? before : after;
|
941
|
-
this[type].endDate = isStartEarlierEnd ? after : before;
|
942
|
-
},
|
943
|
-
/**
|
944
|
-
* 比较时间大小
|
945
|
-
*/
|
946
|
-
dateCompare(startDate, endDate) {
|
947
|
-
// 计算截止时间
|
948
|
-
startDate = new Date(startDate.replace('-', '/').replace('-', '/'));
|
949
|
-
// 计算详细项的截止时间
|
950
|
-
endDate = new Date(endDate.replace('-', '/').replace('-', '/'));
|
951
|
-
return startDate <= endDate;
|
952
|
-
},
|
953
|
-
|
954
|
-
/**
|
955
|
-
* 比较时间差
|
956
|
-
*/
|
957
|
-
diffDate(startDate, endDate) {
|
958
|
-
// 计算截止时间
|
959
|
-
startDate = new Date(startDate.replace('-', '/').replace('-', '/'));
|
960
|
-
// 计算详细项的截止时间
|
961
|
-
endDate = new Date(endDate.replace('-', '/').replace('-', '/'));
|
962
|
-
const diff = (endDate - startDate) / (24 * 60 * 60 * 1000);
|
963
|
-
return Math.abs(diff);
|
964
|
-
},
|
965
|
-
|
966
|
-
clear(needEmit = true) {
|
967
|
-
if (!this.isRange) {
|
968
|
-
this.displayValue = '';
|
969
|
-
this.inputDate = '';
|
970
|
-
this.pickerTime = '';
|
971
|
-
if (this.isPhone) {
|
972
|
-
this.$refs.mobile && this.$refs.mobile.clearCalender();
|
973
|
-
} else {
|
974
|
-
this.$refs.pcSingle && this.$refs.pcSingle.clearCalender();
|
975
|
-
}
|
976
|
-
if (needEmit) {
|
977
|
-
this.$emit('change', '');
|
978
|
-
this.$emit('input', '');
|
979
|
-
this.$emit('update:modelValue', '');
|
980
|
-
}
|
981
|
-
} else {
|
982
|
-
this.displayRangeValue.startDate = '';
|
983
|
-
this.displayRangeValue.endDate = '';
|
984
|
-
this.tempRange.startDate = '';
|
985
|
-
this.tempRange.startTime = '';
|
986
|
-
this.tempRange.endDate = '';
|
987
|
-
this.tempRange.endTime = '';
|
988
|
-
if (this.isPhone) {
|
989
|
-
this.$refs.mobile && this.$refs.mobile.clearCalender();
|
990
|
-
} else {
|
991
|
-
this.$refs.left && this.$refs.left.clearCalender();
|
992
|
-
this.$refs.right && this.$refs.right.clearCalender();
|
993
|
-
this.$refs.right && this.$refs.right.changeMonth('next');
|
994
|
-
}
|
995
|
-
if (needEmit) {
|
996
|
-
this.$emit('change', []);
|
997
|
-
this.$emit('input', []);
|
998
|
-
this.$emit('update:modelValue', []);
|
999
|
-
}
|
1000
|
-
}
|
1001
|
-
},
|
1002
|
-
|
1003
|
-
calendarClick(e) {
|
1004
|
-
this.$emit('calendarClick', e);
|
1005
|
-
}
|
1006
|
-
}
|
1007
|
-
};
|
1008
|
-
</script>
|
1009
|
-
|
1010
|
-
<style lang="scss">
|
1011
|
-
$uni-primary: #007aff !default;
|
1012
|
-
|
1013
|
-
.uni-date {
|
1014
|
-
width: 100%;
|
1015
|
-
flex: 1;
|
1016
|
-
}
|
1017
|
-
|
1018
|
-
.uni-date-x {
|
1019
|
-
display: flex;
|
1020
|
-
flex-direction: row;
|
1021
|
-
align-items: center;
|
1022
|
-
justify-content: center;
|
1023
|
-
border-radius: 4px;
|
1024
|
-
background-color: #fff;
|
1025
|
-
color: #666;
|
1026
|
-
font-size: 14px;
|
1027
|
-
flex: 1;
|
1028
|
-
|
1029
|
-
.icon-calendar {
|
1030
|
-
padding-left: 3px;
|
1031
|
-
}
|
1032
|
-
|
1033
|
-
.range-separator {
|
1034
|
-
height: 35px;
|
1035
|
-
/* #ifndef MP */
|
1036
|
-
padding: 0 2px;
|
1037
|
-
/* #endif */
|
1038
|
-
line-height: 35px;
|
1039
|
-
}
|
1040
|
-
}
|
1041
|
-
|
1042
|
-
.uni-date-x--border {
|
1043
|
-
box-sizing: border-box;
|
1044
|
-
border-radius: 4px;
|
1045
|
-
border: 1px solid #e5e5e5;
|
1046
|
-
}
|
1047
|
-
|
1048
|
-
.uni-date-editor--x {
|
1049
|
-
display: flex;
|
1050
|
-
align-items: center;
|
1051
|
-
position: relative;
|
1052
|
-
}
|
1053
|
-
|
1054
|
-
.uni-date-editor--x .uni-date__icon-clear {
|
1055
|
-
padding-right: 3px;
|
1056
|
-
display: flex;
|
1057
|
-
align-items: center;
|
1058
|
-
/* #ifdef H5 */
|
1059
|
-
cursor: pointer;
|
1060
|
-
/* #endif */
|
1061
|
-
}
|
1062
|
-
|
1063
|
-
.uni-date__x-input {
|
1064
|
-
width: auto;
|
1065
|
-
height: 35px;
|
1066
|
-
/* #ifndef MP */
|
1067
|
-
padding-left: 5px;
|
1068
|
-
/* #endif */
|
1069
|
-
position: relative;
|
1070
|
-
flex: 1;
|
1071
|
-
line-height: 35px;
|
1072
|
-
font-size: 14px;
|
1073
|
-
overflow: hidden;
|
1074
|
-
}
|
1075
|
-
|
1076
|
-
.text-center {
|
1077
|
-
text-align: center;
|
1078
|
-
}
|
1079
|
-
|
1080
|
-
.uni-date__input {
|
1081
|
-
height: 40px;
|
1082
|
-
width: 100%;
|
1083
|
-
line-height: 40px;
|
1084
|
-
font-size: 14px;
|
1085
|
-
}
|
1086
|
-
|
1087
|
-
.uni-date-range__input {
|
1088
|
-
text-align: center;
|
1089
|
-
max-width: 142px;
|
1090
|
-
}
|
1091
|
-
|
1092
|
-
.uni-date-picker__container {
|
1093
|
-
position: relative;
|
1094
|
-
}
|
1095
|
-
|
1096
|
-
.uni-date-mask--pc {
|
1097
|
-
position: fixed;
|
1098
|
-
bottom: 0px;
|
1099
|
-
top: 0px;
|
1100
|
-
left: 0px;
|
1101
|
-
right: 0px;
|
1102
|
-
background-color: rgba(0, 0, 0, 0);
|
1103
|
-
transition-duration: 0.3s;
|
1104
|
-
z-index: 996;
|
1105
|
-
}
|
1106
|
-
|
1107
|
-
.uni-date-single--x {
|
1108
|
-
background-color: #fff;
|
1109
|
-
position: absolute;
|
1110
|
-
top: 0;
|
1111
|
-
z-index: 999;
|
1112
|
-
border: 1px solid #ebeef5;
|
1113
|
-
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
1114
|
-
border-radius: 4px;
|
1115
|
-
}
|
1116
|
-
|
1117
|
-
.uni-date-range--x {
|
1118
|
-
background-color: #fff;
|
1119
|
-
position: absolute;
|
1120
|
-
top: 0;
|
1121
|
-
z-index: 999;
|
1122
|
-
border: 1px solid #ebeef5;
|
1123
|
-
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
1124
|
-
border-radius: 4px;
|
1125
|
-
}
|
1126
|
-
|
1127
|
-
.uni-date-editor--x__disabled {
|
1128
|
-
opacity: 0.4;
|
1129
|
-
cursor: default;
|
1130
|
-
}
|
1131
|
-
|
1132
|
-
.uni-date-editor--logo {
|
1133
|
-
width: 16px;
|
1134
|
-
height: 16px;
|
1135
|
-
vertical-align: middle;
|
1136
|
-
}
|
1137
|
-
|
1138
|
-
/* 添加时间 */
|
1139
|
-
.popup-x-header {
|
1140
|
-
/* #ifndef APP-NVUE */
|
1141
|
-
display: flex;
|
1142
|
-
/* #endif */
|
1143
|
-
flex-direction: row;
|
1144
|
-
}
|
1145
|
-
|
1146
|
-
.popup-x-header--datetime {
|
1147
|
-
/* #ifndef APP-NVUE */
|
1148
|
-
display: flex;
|
1149
|
-
/* #endif */
|
1150
|
-
flex-direction: row;
|
1151
|
-
flex: 1;
|
1152
|
-
}
|
1153
|
-
|
1154
|
-
.popup-x-body {
|
1155
|
-
display: flex;
|
1156
|
-
}
|
1157
|
-
|
1158
|
-
.popup-x-footer {
|
1159
|
-
padding: 0 15px;
|
1160
|
-
border-top-color: #f1f1f1;
|
1161
|
-
border-top-style: solid;
|
1162
|
-
border-top-width: 1px;
|
1163
|
-
line-height: 40px;
|
1164
|
-
text-align: right;
|
1165
|
-
color: #666;
|
1166
|
-
}
|
1167
|
-
|
1168
|
-
.popup-x-footer text:hover {
|
1169
|
-
color: $uni-primary;
|
1170
|
-
cursor: pointer;
|
1171
|
-
opacity: 0.8;
|
1172
|
-
}
|
1173
|
-
|
1174
|
-
.popup-x-footer .confirm-text {
|
1175
|
-
margin-left: 20px;
|
1176
|
-
color: $uni-primary;
|
1177
|
-
}
|
1178
|
-
|
1179
|
-
.uni-date-changed {
|
1180
|
-
text-align: center;
|
1181
|
-
color: #333;
|
1182
|
-
border-bottom-color: #f1f1f1;
|
1183
|
-
border-bottom-style: solid;
|
1184
|
-
border-bottom-width: 1px;
|
1185
|
-
}
|
1186
|
-
|
1187
|
-
.uni-date-changed--time text {
|
1188
|
-
height: 50px;
|
1189
|
-
line-height: 50px;
|
1190
|
-
}
|
1191
|
-
|
1192
|
-
.uni-date-changed .uni-date-changed--time {
|
1193
|
-
flex: 1;
|
1194
|
-
}
|
1195
|
-
|
1196
|
-
.uni-date-changed--time-date {
|
1197
|
-
color: #333;
|
1198
|
-
opacity: 0.6;
|
1199
|
-
}
|
1200
|
-
|
1201
|
-
.mr-50 {
|
1202
|
-
margin-right: 50px;
|
1203
|
-
}
|
1204
|
-
|
1205
|
-
/* picker 弹出层通用的指示小三角, todo:扩展至上下左右方向定位 */
|
1206
|
-
.uni-popper__arrow,
|
1207
|
-
.uni-popper__arrow::after {
|
1208
|
-
position: absolute;
|
1209
|
-
display: block;
|
1210
|
-
width: 0;
|
1211
|
-
height: 0;
|
1212
|
-
border: 6px solid transparent;
|
1213
|
-
border-top-width: 0;
|
1214
|
-
}
|
1215
|
-
|
1216
|
-
.uni-popper__arrow {
|
1217
|
-
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
|
1218
|
-
top: -6px;
|
1219
|
-
left: 10%;
|
1220
|
-
margin-right: 3px;
|
1221
|
-
border-bottom-color: #ebeef5;
|
1222
|
-
}
|
1223
|
-
|
1224
|
-
.uni-popper__arrow::after {
|
1225
|
-
content: ' ';
|
1226
|
-
top: 1px;
|
1227
|
-
margin-left: -6px;
|
1228
|
-
border-bottom-color: #fff;
|
1229
|
-
}
|
1230
|
-
</style>
|