@vtj/materials 0.13.16 → 0.13.18

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.
Files changed (127) hide show
  1. package/dist/assets/antdv/index.umd.js +2 -2
  2. package/dist/assets/charts/index.umd.js +2 -2
  3. package/dist/assets/element/index.umd.js +3 -3
  4. package/dist/assets/icons/index.umd.js +2 -2
  5. package/dist/assets/ui/index.umd.js +2 -2
  6. package/dist/assets/uni-h5/index.umd.js +2 -2
  7. package/dist/assets/uni-ui/index.umd.js +2 -2
  8. package/dist/assets/vant/index.umd.js +2 -2
  9. package/dist/deps/@vtj/charts/index.umd.js +2 -2
  10. package/dist/deps/@vtj/icons/index.umd.js +2 -2
  11. package/dist/deps/@vtj/ui/index.umd.js +4 -4
  12. package/dist/deps/@vtj/ui/style.css +1 -1
  13. package/dist/deps/@vtj/utils/index.umd.js +28 -33
  14. package/dist/deps/@vueuse/core/index.iife.min.js +1 -1
  15. package/dist/deps/element-plus/index.css +1 -1
  16. package/dist/deps/element-plus/index.full.min.js +14 -14
  17. package/dist/deps/element-plus/zh-cn.js +1 -1
  18. package/dist/deps/uni-app/index.umd.js +1 -1
  19. package/dist/deps/uni-h5/index.umd.js +8 -8
  20. package/dist/deps/uni-h5/style.css +1 -1
  21. package/dist/deps/uni-h5-vue/index.umd.js +1 -1
  22. package/dist/deps/uni-ui/index.umd.js +1 -1
  23. package/dist/deps/uni-ui/style.css +1 -1
  24. package/dist/deps/vue/vue.global.js +88 -53
  25. package/dist/deps/vue/vue.global.prod.js +9 -9
  26. package/package.json +12 -12
  27. package/src/antdv/image.ts +1 -1
  28. package/src/element/image.ts +1 -1
  29. package/src/element/virtualizedTable.ts +6 -6
  30. package/src/manifest.json +69 -0
  31. package/src/pages/index.vue +2 -0
  32. package/src/pages.json +19 -0
  33. package/src/uni-ui/index.ts +88 -58
  34. package/src/{uni-ui/lib/uni.scss → uni.scss} +4 -0
  35. package/src/version.ts +2 -2
  36. package/src/uni-ui/lib/uni-col/uni-col.vue +0 -324
  37. package/src/uni-ui/lib/uni-collapse/uni-collapse.vue +0 -153
  38. package/src/uni-ui/lib/uni-collapse-item/uni-collapse-item.vue +0 -425
  39. package/src/uni-ui/lib/uni-data-picker/keypress.js +0 -45
  40. package/src/uni-ui/lib/uni-data-picker/uni-data-picker.vue +0 -604
  41. package/src/uni-ui/lib/uni-data-pickerview/uni-data-picker.js +0 -622
  42. package/src/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.css +0 -76
  43. package/src/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.vue +0 -335
  44. package/src/uni-ui/lib/uni-data-select/uni-data-select.vue +0 -590
  45. package/src/uni-ui/lib/uni-datetime-picker/calendar-item.vue +0 -188
  46. package/src/uni-ui/lib/uni-datetime-picker/calendar.vue +0 -985
  47. package/src/uni-ui/lib/uni-datetime-picker/i18n/en.json +0 -22
  48. package/src/uni-ui/lib/uni-datetime-picker/i18n/index.js +0 -8
  49. package/src/uni-ui/lib/uni-datetime-picker/i18n/zh-Hans.json +0 -22
  50. package/src/uni-ui/lib/uni-datetime-picker/i18n/zh-Hant.json +0 -22
  51. package/src/uni-ui/lib/uni-datetime-picker/time-picker.vue +0 -1032
  52. package/src/uni-ui/lib/uni-datetime-picker/uni-datetime-picker.vue +0 -1230
  53. package/src/uni-ui/lib/uni-datetime-picker/util.js +0 -448
  54. package/src/uni-ui/lib/uni-easyinput/common.js +0 -54
  55. package/src/uni-ui/lib/uni-easyinput/uni-easyinput.vue +0 -790
  56. package/src/uni-ui/lib/uni-fav/i18n/en.json +0 -4
  57. package/src/uni-ui/lib/uni-fav/i18n/index.js +0 -8
  58. package/src/uni-ui/lib/uni-fav/i18n/zh-Hans.json +0 -4
  59. package/src/uni-ui/lib/uni-fav/i18n/zh-Hant.json +0 -4
  60. package/src/uni-ui/lib/uni-fav/uni-fav.vue +0 -170
  61. package/src/uni-ui/lib/uni-file-picker/choose-and-upload-file.js +0 -280
  62. package/src/uni-ui/lib/uni-file-picker/uni-file-picker.vue +0 -668
  63. package/src/uni-ui/lib/uni-file-picker/upload-file.vue +0 -325
  64. package/src/uni-ui/lib/uni-file-picker/upload-image.vue +0 -292
  65. package/src/uni-ui/lib/uni-file-picker/utils.js +0 -110
  66. package/src/uni-ui/lib/uni-forms/uni-forms.vue +0 -416
  67. package/src/uni-ui/lib/uni-forms/utils.js +0 -293
  68. package/src/uni-ui/lib/uni-forms/validate.js +0 -486
  69. package/src/uni-ui/lib/uni-forms-item/uni-forms-item.vue +0 -630
  70. package/src/uni-ui/lib/uni-goods-nav/i18n/en.json +0 -6
  71. package/src/uni-ui/lib/uni-goods-nav/i18n/index.js +0 -8
  72. package/src/uni-ui/lib/uni-goods-nav/i18n/zh-Hans.json +0 -6
  73. package/src/uni-ui/lib/uni-goods-nav/i18n/zh-Hant.json +0 -6
  74. package/src/uni-ui/lib/uni-goods-nav/uni-goods-nav.vue +0 -231
  75. package/src/uni-ui/lib/uni-grid/uni-grid.vue +0 -148
  76. package/src/uni-ui/lib/uni-icons/uni-icons.uvue +0 -91
  77. package/src/uni-ui/lib/uni-icons/uni-icons.vue +0 -114
  78. package/src/uni-ui/lib/uni-icons/uniicons.css +0 -664
  79. package/src/uni-ui/lib/uni-icons/uniicons.ttf +0 -0
  80. package/src/uni-ui/lib/uni-icons/uniicons_file.ts +0 -664
  81. package/src/uni-ui/lib/uni-icons/uniicons_file_vue.js +0 -649
  82. package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list-item.vue +0 -168
  83. package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list.vue +0 -404
  84. package/src/uni-ui/lib/uni-list/uni-list.vue +0 -123
  85. package/src/uni-ui/lib/uni-list/uni-refresh.vue +0 -65
  86. package/src/uni-ui/lib/uni-list/uni-refresh.wxs +0 -87
  87. package/src/uni-ui/lib/uni-load-more/i18n/en.json +0 -5
  88. package/src/uni-ui/lib/uni-load-more/i18n/index.js +0 -8
  89. package/src/uni-ui/lib/uni-load-more/i18n/zh-Hans.json +0 -5
  90. package/src/uni-ui/lib/uni-load-more/i18n/zh-Hant.json +0 -5
  91. package/src/uni-ui/lib/uni-load-more/uni-load-more.vue +0 -456
  92. package/src/uni-ui/lib/uni-notice-bar/uni-notice-bar.vue +0 -484
  93. package/src/uni-ui/lib/uni-popup/i18n/en.json +0 -7
  94. package/src/uni-ui/lib/uni-popup/i18n/index.js +0 -8
  95. package/src/uni-ui/lib/uni-popup/i18n/zh-Hans.json +0 -7
  96. package/src/uni-ui/lib/uni-popup/i18n/zh-Hant.json +0 -7
  97. package/src/uni-ui/lib/uni-popup/keypress.js +0 -45
  98. package/src/uni-ui/lib/uni-popup/popup.js +0 -26
  99. package/src/uni-ui/lib/uni-popup/uni-popup.uvue +0 -90
  100. package/src/uni-ui/lib/uni-popup/uni-popup.vue +0 -552
  101. package/src/uni-ui/lib/uni-popup-dialog/keypress.js +0 -45
  102. package/src/uni-ui/lib/uni-popup-dialog/uni-popup-dialog.vue +0 -324
  103. package/src/uni-ui/lib/uni-popup-message/uni-popup-message.vue +0 -149
  104. package/src/uni-ui/lib/uni-rate/uni-rate.vue +0 -380
  105. package/src/uni-ui/lib/uni-row/uni-row.vue +0 -193
  106. package/src/uni-ui/lib/uni-search-bar/i18n/en.json +0 -4
  107. package/src/uni-ui/lib/uni-search-bar/i18n/index.js +0 -8
  108. package/src/uni-ui/lib/uni-search-bar/i18n/zh-Hans.json +0 -4
  109. package/src/uni-ui/lib/uni-search-bar/i18n/zh-Hant.json +0 -4
  110. package/src/uni-ui/lib/uni-search-bar/uni-search-bar.vue +0 -339
  111. package/src/uni-ui/lib/uni-swipe-action-item/bindingx.js +0 -311
  112. package/src/uni-ui/lib/uni-swipe-action-item/isPC.js +0 -12
  113. package/src/uni-ui/lib/uni-swipe-action-item/mpalipay.js +0 -195
  114. package/src/uni-ui/lib/uni-swipe-action-item/mpother.js +0 -260
  115. package/src/uni-ui/lib/uni-swipe-action-item/mpwxs.js +0 -84
  116. package/src/uni-ui/lib/uni-swipe-action-item/render.js +0 -270
  117. package/src/uni-ui/lib/uni-swipe-action-item/uni-swipe-action-item.vue +0 -493
  118. package/src/uni-ui/lib/uni-swipe-action-item/wx.wxs +0 -341
  119. package/src/uni-ui/lib/uni-table/uni-table.vue +0 -496
  120. package/src/uni-ui/lib/uni-td/uni-td.vue +0 -99
  121. package/src/uni-ui/lib/uni-th/filter-dropdown.vue +0 -559
  122. package/src/uni-ui/lib/uni-th/uni-th.vue +0 -322
  123. package/src/uni-ui/lib/uni-tr/table-checkbox.vue +0 -181
  124. package/src/uni-ui/lib/uni-tr/uni-tr.vue +0 -208
  125. package/src/uni-ui/lib/uni-transition/createAnimation.js +0 -131
  126. package/src/uni-ui/lib/uni-transition/uni-transition.vue +0 -310
  127. package/src/uni-ui/polyfill.ts +0 -41
@@ -1,985 +0,0 @@
1
- <template>
2
- <view class="uni-calendar" @mouseleave="leaveCale">
3
- <view
4
- v-if="!insert && show"
5
- class="uni-calendar__mask"
6
- :class="{ 'uni-calendar--mask-show': aniMaskShow }"
7
- @click="maskClick"></view>
8
-
9
- <view
10
- v-if="insert || show"
11
- class="uni-calendar__content"
12
- :class="{
13
- 'uni-calendar--fixed': !insert,
14
- 'uni-calendar--ani-show': aniMaskShow,
15
- 'uni-calendar__content-mobile': aniMaskShow
16
- }">
17
- <view
18
- class="uni-calendar__header"
19
- :class="{ 'uni-calendar__header-mobile': !insert }">
20
- <view
21
- class="uni-calendar__header-btn-box"
22
- @click.stop="changeMonth('pre')">
23
- <view class="uni-calendar__header-btn uni-calendar--left"></view>
24
- </view>
25
-
26
- <picker
27
- mode="date"
28
- :value="date"
29
- fields="month"
30
- @change="bindDateChange">
31
- <text class="uni-calendar__header-text">{{
32
- (nowDate.year || '') + yearText + (nowDate.month || '') + monthText
33
- }}</text>
34
- </picker>
35
-
36
- <view
37
- class="uni-calendar__header-btn-box"
38
- @click.stop="changeMonth('next')">
39
- <view class="uni-calendar__header-btn uni-calendar--right"></view>
40
- </view>
41
-
42
- <view v-if="!insert" class="dialog-close" @click="maskClick">
43
- <view class="dialog-close-plus" data-id="close"></view>
44
- <view
45
- class="dialog-close-plus dialog-close-rotate"
46
- data-id="close"></view>
47
- </view>
48
- </view>
49
- <view class="uni-calendar__box">
50
- <view v-if="showMonth" class="uni-calendar__box-bg">
51
- <text class="uni-calendar__box-bg-text">{{ nowDate.month }}</text>
52
- </view>
53
-
54
- <view class="uni-calendar__weeks" style="padding-bottom: 7px">
55
- <view class="uni-calendar__weeks-day">
56
- <text class="uni-calendar__weeks-day-text">{{ SUNText }}</text>
57
- </view>
58
- <view class="uni-calendar__weeks-day">
59
- <text class="uni-calendar__weeks-day-text">{{ MONText }}</text>
60
- </view>
61
- <view class="uni-calendar__weeks-day">
62
- <text class="uni-calendar__weeks-day-text">{{ TUEText }}</text>
63
- </view>
64
- <view class="uni-calendar__weeks-day">
65
- <text class="uni-calendar__weeks-day-text">{{ WEDText }}</text>
66
- </view>
67
- <view class="uni-calendar__weeks-day">
68
- <text class="uni-calendar__weeks-day-text">{{ THUText }}</text>
69
- </view>
70
- <view class="uni-calendar__weeks-day">
71
- <text class="uni-calendar__weeks-day-text">{{ FRIText }}</text>
72
- </view>
73
- <view class="uni-calendar__weeks-day">
74
- <text class="uni-calendar__weeks-day-text">{{ SATText }}</text>
75
- </view>
76
- </view>
77
-
78
- <view
79
- class="uni-calendar__weeks"
80
- v-for="(item, weekIndex) in weeks"
81
- :key="weekIndex">
82
- <view
83
- class="uni-calendar__weeks-item"
84
- v-for="(weeks, weeksIndex) in item"
85
- :key="weeksIndex">
86
- <calendar-item
87
- class="uni-calendar-item--hook"
88
- :weeks="weeks"
89
- :calendar="calendar"
90
- :selected="selected"
91
- :checkHover="range"
92
- @change="choiceDate"
93
- @handleMouse="handleMouse">
94
- </calendar-item>
95
- </view>
96
- </view>
97
- </view>
98
-
99
- <view
100
- v-if="!insert && !range && hasTime"
101
- class="uni-date-changed uni-calendar--fixed-top"
102
- style="padding: 0 80px">
103
- <view class="uni-date-changed--time-date">{{
104
- tempSingleDate ? tempSingleDate : selectDateText
105
- }}</view>
106
- <time-picker
107
- type="time"
108
- :start="timepickerStartTime"
109
- :end="timepickerEndTime"
110
- v-model="time"
111
- :disabled="!tempSingleDate"
112
- :border="false"
113
- :hide-second="hideSecond"
114
- class="time-picker-style">
115
- </time-picker>
116
- </view>
117
-
118
- <view
119
- v-if="!insert && range && hasTime"
120
- class="uni-date-changed uni-calendar--fixed-top">
121
- <view class="uni-date-changed--time-start">
122
- <view class="uni-date-changed--time-date"
123
- >{{ tempRange.before ? tempRange.before : startDateText }}
124
- </view>
125
- <time-picker
126
- type="time"
127
- :start="timepickerStartTime"
128
- v-model="timeRange.startTime"
129
- :border="false"
130
- :hide-second="hideSecond"
131
- :disabled="!tempRange.before"
132
- class="time-picker-style">
133
- </time-picker>
134
- </view>
135
- <view style="line-height: 50px">
136
- <uni-icons type="arrowthinright" color="#999"></uni-icons>
137
- </view>
138
- <view class="uni-date-changed--time-end">
139
- <view class="uni-date-changed--time-date">{{
140
- tempRange.after ? tempRange.after : endDateText
141
- }}</view>
142
- <time-picker
143
- type="time"
144
- :end="timepickerEndTime"
145
- v-model="timeRange.endTime"
146
- :border="false"
147
- :hide-second="hideSecond"
148
- :disabled="!tempRange.after"
149
- class="time-picker-style">
150
- </time-picker>
151
- </view>
152
- </view>
153
-
154
- <view v-if="!insert" class="uni-date-changed uni-date-btn--ok">
155
- <view class="uni-datetime-picker--btn" @click="confirm">{{
156
- confirmText
157
- }}</view>
158
- </view>
159
- </view>
160
- </view>
161
- </template>
162
-
163
- <script>
164
- import { Calendar, getDate, getTime } from './util.js';
165
- import calendarItem from './calendar-item.vue';
166
- import timePicker from './time-picker.vue';
167
-
168
- import { initVueI18n } from '@dcloudio/uni-i18n';
169
- import i18nMessages from './i18n/index.js';
170
- const { t } = initVueI18n(i18nMessages);
171
-
172
- /**
173
- * Calendar 日历
174
- * @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等
175
- * @tutorial https://ext.dcloud.net.cn/plugin?id=56
176
- * @property {String} date 自定义当前时间,默认为今天
177
- * @property {String} startDate 日期选择范围-开始日期
178
- * @property {String} endDate 日期选择范围-结束日期
179
- * @property {Boolean} range 范围选择
180
- * @property {Boolean} insert = [true|false] 插入模式,默认为false
181
- * @value true 弹窗模式
182
- * @value false 插入模式
183
- * @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容
184
- * @property {Array} selected 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}]
185
- * @property {Boolean} showMonth 是否选择月份为背景
186
- * @property {[String} defaultValue 选择器打开时默认显示的时间
187
- * @event {Function} change 日期改变,`insert :ture` 时生效
188
- * @event {Function} confirm 确认选择`insert :false` 时生效
189
- * @event {Function} monthSwitch 切换月份时触发
190
- * @example <uni-calendar :insert="true" :start-date="'2019-3-2'":end-date="'2019-5-20'"@change="change" />
191
- */
192
- export default {
193
- components: {
194
- calendarItem,
195
- timePicker
196
- },
197
-
198
- options: {
199
- // #ifdef MP-TOUTIAO
200
- // virtualHost: false,
201
- // #endif
202
- // #ifndef MP-TOUTIAO
203
- virtualHost: true
204
- // #endif
205
- },
206
- props: {
207
- date: {
208
- type: String,
209
- default: ''
210
- },
211
- defTime: {
212
- type: [String, Object],
213
- default: ''
214
- },
215
- selectableTimes: {
216
- type: [Object],
217
- default() {
218
- return {};
219
- }
220
- },
221
- selected: {
222
- type: Array,
223
- default() {
224
- return [];
225
- }
226
- },
227
- startDate: {
228
- type: String,
229
- default: ''
230
- },
231
- endDate: {
232
- type: String,
233
- default: ''
234
- },
235
- startPlaceholder: {
236
- type: String,
237
- default: ''
238
- },
239
- endPlaceholder: {
240
- type: String,
241
- default: ''
242
- },
243
- range: {
244
- type: Boolean,
245
- default: false
246
- },
247
- hasTime: {
248
- type: Boolean,
249
- default: false
250
- },
251
- insert: {
252
- type: Boolean,
253
- default: true
254
- },
255
- showMonth: {
256
- type: Boolean,
257
- default: true
258
- },
259
- clearDate: {
260
- type: Boolean,
261
- default: true
262
- },
263
- checkHover: {
264
- type: Boolean,
265
- default: true
266
- },
267
- hideSecond: {
268
- type: [Boolean],
269
- default: false
270
- },
271
- pleStatus: {
272
- type: Object,
273
- default() {
274
- return {
275
- before: '',
276
- after: '',
277
- data: [],
278
- fulldate: ''
279
- };
280
- }
281
- },
282
- defaultValue: {
283
- type: [String, Object, Array],
284
- default: ''
285
- }
286
- },
287
- data() {
288
- return {
289
- show: false,
290
- weeks: [],
291
- calendar: {},
292
- nowDate: {},
293
- aniMaskShow: false,
294
- firstEnter: true,
295
- time: '',
296
- timeRange: {
297
- startTime: '',
298
- endTime: ''
299
- },
300
- tempSingleDate: '',
301
- tempRange: {
302
- before: '',
303
- after: ''
304
- }
305
- };
306
- },
307
- watch: {
308
- date: {
309
- immediate: true,
310
- handler(newVal) {
311
- if (!this.range) {
312
- this.tempSingleDate = newVal;
313
- setTimeout(() => {
314
- this.init(newVal);
315
- }, 100);
316
- }
317
- }
318
- },
319
- defTime: {
320
- immediate: true,
321
- handler(newVal) {
322
- if (!this.range) {
323
- this.time = newVal;
324
- } else {
325
- this.timeRange.startTime = newVal.start;
326
- this.timeRange.endTime = newVal.end;
327
- }
328
- }
329
- },
330
- startDate(val) {
331
- // 字节小程序 watch 早于 created
332
- if (!this.cale) {
333
- return;
334
- }
335
- this.cale.setStartDate(val);
336
- this.cale.setDate(this.nowDate.fullDate);
337
- this.weeks = this.cale.weeks;
338
- },
339
- endDate(val) {
340
- // 字节小程序 watch 早于 created
341
- if (!this.cale) {
342
- return;
343
- }
344
- this.cale.setEndDate(val);
345
- this.cale.setDate(this.nowDate.fullDate);
346
- this.weeks = this.cale.weeks;
347
- },
348
- selected(newVal) {
349
- // 字节小程序 watch 早于 created
350
- if (!this.cale) {
351
- return;
352
- }
353
- this.cale.setSelectInfo(this.nowDate.fullDate, newVal);
354
- this.weeks = this.cale.weeks;
355
- },
356
- pleStatus: {
357
- immediate: true,
358
- handler(newVal) {
359
- const { before, after, fulldate, which } = newVal;
360
- this.tempRange.before = before;
361
- this.tempRange.after = after;
362
- setTimeout(() => {
363
- if (fulldate) {
364
- this.cale.setHoverMultiple(fulldate);
365
- if (before && after) {
366
- this.cale.lastHover = true;
367
- if (this.rangeWithinMonth(after, before)) return;
368
- this.setDate(before);
369
- } else {
370
- this.cale.setMultiple(fulldate);
371
- this.setDate(this.nowDate.fullDate);
372
- this.calendar.fullDate = '';
373
- this.cale.lastHover = false;
374
- }
375
- } else {
376
- // 字节小程序 watch 早于 created
377
- if (!this.cale) {
378
- return;
379
- }
380
-
381
- this.cale.setDefaultMultiple(before, after);
382
- if (which === 'left' && before) {
383
- this.setDate(before);
384
- this.weeks = this.cale.weeks;
385
- } else if (after) {
386
- this.setDate(after);
387
- this.weeks = this.cale.weeks;
388
- }
389
- this.cale.lastHover = true;
390
- }
391
- }, 16);
392
- }
393
- }
394
- },
395
- computed: {
396
- timepickerStartTime() {
397
- const activeDate = this.range
398
- ? this.tempRange.before
399
- : this.calendar.fullDate;
400
- return activeDate === this.startDate ? this.selectableTimes.start : '';
401
- },
402
- timepickerEndTime() {
403
- const activeDate = this.range
404
- ? this.tempRange.after
405
- : this.calendar.fullDate;
406
- return activeDate === this.endDate ? this.selectableTimes.end : '';
407
- },
408
- /**
409
- * for i18n
410
- */
411
- selectDateText() {
412
- return t('uni-datetime-picker.selectDate');
413
- },
414
- startDateText() {
415
- return this.startPlaceholder || t('uni-datetime-picker.startDate');
416
- },
417
- endDateText() {
418
- return this.endPlaceholder || t('uni-datetime-picker.endDate');
419
- },
420
- okText() {
421
- return t('uni-datetime-picker.ok');
422
- },
423
- yearText() {
424
- return t('uni-datetime-picker.year');
425
- },
426
- monthText() {
427
- return t('uni-datetime-picker.month');
428
- },
429
- MONText() {
430
- return t('uni-calender.MON');
431
- },
432
- TUEText() {
433
- return t('uni-calender.TUE');
434
- },
435
- WEDText() {
436
- return t('uni-calender.WED');
437
- },
438
- THUText() {
439
- return t('uni-calender.THU');
440
- },
441
- FRIText() {
442
- return t('uni-calender.FRI');
443
- },
444
- SATText() {
445
- return t('uni-calender.SAT');
446
- },
447
- SUNText() {
448
- return t('uni-calender.SUN');
449
- },
450
- confirmText() {
451
- return t('uni-calender.confirm');
452
- }
453
- },
454
- created() {
455
- // 获取日历方法实例
456
- this.cale = new Calendar({
457
- selected: this.selected,
458
- startDate: this.startDate,
459
- endDate: this.endDate,
460
- range: this.range
461
- });
462
- // 选中某一天
463
- this.init(this.date);
464
- },
465
- methods: {
466
- leaveCale() {
467
- this.firstEnter = true;
468
- },
469
- handleMouse(weeks) {
470
- if (weeks.disable) return;
471
- if (this.cale.lastHover) return;
472
- let { before, after } = this.cale.multipleStatus;
473
- if (!before) return;
474
- this.calendar = weeks;
475
- // 设置范围选
476
- this.cale.setHoverMultiple(this.calendar.fullDate);
477
- this.weeks = this.cale.weeks;
478
- // hover时,进入一个日历,更新另一个
479
- if (this.firstEnter) {
480
- this.$emit('firstEnterCale', this.cale.multipleStatus);
481
- this.firstEnter = false;
482
- }
483
- },
484
- rangeWithinMonth(A, B) {
485
- const [yearA, monthA] = A.split('-');
486
- const [yearB, monthB] = B.split('-');
487
- return yearA === yearB && monthA === monthB;
488
- },
489
- // 蒙版点击事件
490
- maskClick() {
491
- this.close();
492
- this.$emit('maskClose');
493
- },
494
-
495
- clearCalender() {
496
- if (this.range) {
497
- this.timeRange.startTime = '';
498
- this.timeRange.endTime = '';
499
- this.tempRange.before = '';
500
- this.tempRange.after = '';
501
- this.cale.multipleStatus.before = '';
502
- this.cale.multipleStatus.after = '';
503
- this.cale.multipleStatus.data = [];
504
- this.cale.lastHover = false;
505
- } else {
506
- this.time = '';
507
- this.tempSingleDate = '';
508
- }
509
- this.calendar.fullDate = '';
510
- this.setDate(new Date());
511
- },
512
-
513
- bindDateChange(e) {
514
- const value = e.detail.value + '-1';
515
- this.setDate(value);
516
- },
517
- /**
518
- * 初始化日期显示
519
- * @param {Object} date
520
- */
521
- init(date) {
522
- // 字节小程序 watch 早于 created
523
- if (!this.cale) {
524
- return;
525
- }
526
- this.cale.setDate(date || new Date());
527
- this.weeks = this.cale.weeks;
528
- this.nowDate = this.cale.getInfo(date);
529
- this.calendar = {
530
- ...this.nowDate
531
- };
532
- if (!date) {
533
- // 优化date为空默认不选中今天
534
- this.calendar.fullDate = '';
535
- if (this.defaultValue && !this.range) {
536
- // 暂时只支持移动端非范围选择
537
- const defaultDate = new Date(this.defaultValue);
538
- const fullDate = getDate(defaultDate);
539
- const year = defaultDate.getFullYear();
540
- const month = defaultDate.getMonth() + 1;
541
- const date = defaultDate.getDate();
542
- const day = defaultDate.getDay();
543
- (this.calendar = {
544
- fullDate,
545
- year,
546
- month,
547
- date,
548
- day
549
- }),
550
- (this.tempSingleDate = fullDate);
551
- this.time = getTime(defaultDate, this.hideSecond);
552
- }
553
- }
554
- },
555
- /**
556
- * 打开日历弹窗
557
- */
558
- open() {
559
- // 弹窗模式并且清理数据
560
- if (this.clearDate && !this.insert) {
561
- this.cale.cleanMultipleStatus();
562
- this.init(this.date);
563
- }
564
- this.show = true;
565
- this.$nextTick(() => {
566
- setTimeout(() => {
567
- this.aniMaskShow = true;
568
- }, 50);
569
- });
570
- },
571
- /**
572
- * 关闭日历弹窗
573
- */
574
- close() {
575
- this.aniMaskShow = false;
576
- this.$nextTick(() => {
577
- setTimeout(() => {
578
- this.show = false;
579
- this.$emit('close');
580
- }, 300);
581
- });
582
- },
583
- /**
584
- * 确认按钮
585
- */
586
- confirm() {
587
- this.setEmit('confirm');
588
- this.close();
589
- },
590
- /**
591
- * 变化触发
592
- */
593
- change(isSingleChange) {
594
- if (!this.insert && !isSingleChange) return;
595
- this.setEmit('change');
596
- },
597
- /**
598
- * 选择月份触发
599
- */
600
- monthSwitch() {
601
- let { year, month } = this.nowDate;
602
- this.$emit('monthSwitch', {
603
- year,
604
- month: Number(month)
605
- });
606
- },
607
- /**
608
- * 派发事件
609
- * @param {Object} name
610
- */
611
- setEmit(name) {
612
- if (!this.range) {
613
- if (!this.calendar.fullDate) {
614
- this.calendar = this.cale.getInfo(new Date());
615
- this.tempSingleDate = this.calendar.fullDate;
616
- }
617
- if (this.hasTime && !this.time) {
618
- this.time = getTime(new Date(), this.hideSecond);
619
- }
620
- }
621
- let { year, month, date, fullDate, extraInfo } = this.calendar;
622
- this.$emit(name, {
623
- range: this.cale.multipleStatus,
624
- year,
625
- month,
626
- date,
627
- time: this.time,
628
- timeRange: this.timeRange,
629
- fulldate: fullDate,
630
- extraInfo: extraInfo || {}
631
- });
632
- },
633
- /**
634
- * 选择天触发
635
- * @param {Object} weeks
636
- */
637
- choiceDate(weeks) {
638
- if (weeks.disable) return;
639
- this.calendar = weeks;
640
- this.calendar.userChecked = true;
641
- // 设置多选
642
- this.cale.setMultiple(this.calendar.fullDate, true);
643
- this.weeks = this.cale.weeks;
644
- this.tempSingleDate = this.calendar.fullDate;
645
- const beforeDate = new Date(this.cale.multipleStatus.before).getTime();
646
- const afterDate = new Date(this.cale.multipleStatus.after).getTime();
647
- if (beforeDate > afterDate && afterDate) {
648
- this.tempRange.before = this.cale.multipleStatus.after;
649
- this.tempRange.after = this.cale.multipleStatus.before;
650
- } else {
651
- this.tempRange.before = this.cale.multipleStatus.before;
652
- this.tempRange.after = this.cale.multipleStatus.after;
653
- }
654
- this.change(true);
655
- },
656
- changeMonth(type) {
657
- let newDate;
658
- if (type === 'pre') {
659
- newDate = this.cale.getPreMonthObj(this.nowDate.fullDate).fullDate;
660
- } else if (type === 'next') {
661
- newDate = this.cale.getNextMonthObj(this.nowDate.fullDate).fullDate;
662
- }
663
-
664
- this.setDate(newDate);
665
- this.monthSwitch();
666
- },
667
- /**
668
- * 设置日期
669
- * @param {Object} date
670
- */
671
- setDate(date) {
672
- this.cale.setDate(date);
673
- this.weeks = this.cale.weeks;
674
- this.nowDate = this.cale.getInfo(date);
675
- }
676
- }
677
- };
678
- </script>
679
-
680
- <style lang="scss">
681
- $uni-primary: #007aff !default;
682
-
683
- .uni-calendar {
684
- /* #ifndef APP-NVUE */
685
- display: flex;
686
- /* #endif */
687
- flex-direction: column;
688
- }
689
-
690
- .uni-calendar__mask {
691
- position: fixed;
692
- bottom: 0;
693
- top: 0;
694
- left: 0;
695
- right: 0;
696
- background-color: rgba(0, 0, 0, 0.4);
697
- transition-property: opacity;
698
- transition-duration: 0.3s;
699
- opacity: 0;
700
- /* #ifndef APP-NVUE */
701
- z-index: 99;
702
- /* #endif */
703
- }
704
-
705
- .uni-calendar--mask-show {
706
- opacity: 1;
707
- }
708
-
709
- .uni-calendar--fixed {
710
- position: fixed;
711
- bottom: calc(var(--window-bottom));
712
- left: 0;
713
- right: 0;
714
- transition-property: transform;
715
- transition-duration: 0.3s;
716
- transform: translateY(460px);
717
- /* #ifndef APP-NVUE */
718
- z-index: 99;
719
- /* #endif */
720
- }
721
-
722
- .uni-calendar--ani-show {
723
- transform: translateY(0);
724
- }
725
-
726
- .uni-calendar__content {
727
- background-color: #fff;
728
- }
729
-
730
- .uni-calendar__content-mobile {
731
- border-top-left-radius: 10px;
732
- border-top-right-radius: 10px;
733
- box-shadow: 0px 0px 5px 3px rgba(0, 0, 0, 0.1);
734
- }
735
-
736
- .uni-calendar__header {
737
- position: relative;
738
- /* #ifndef APP-NVUE */
739
- display: flex;
740
- /* #endif */
741
- flex-direction: row;
742
- justify-content: center;
743
- align-items: center;
744
- height: 50px;
745
- }
746
-
747
- .uni-calendar__header-mobile {
748
- padding: 10px;
749
- padding-bottom: 0;
750
- }
751
-
752
- .uni-calendar--fixed-top {
753
- /* #ifndef APP-NVUE */
754
- display: flex;
755
- /* #endif */
756
- flex-direction: row;
757
- justify-content: space-between;
758
- border-top-color: rgba(0, 0, 0, 0.4);
759
- border-top-style: solid;
760
- border-top-width: 1px;
761
- }
762
-
763
- .uni-calendar--fixed-width {
764
- width: 50px;
765
- }
766
-
767
- .uni-calendar__backtoday {
768
- position: absolute;
769
- right: 0;
770
- top: 25rpx;
771
- padding: 0 5px;
772
- padding-left: 10px;
773
- height: 25px;
774
- line-height: 25px;
775
- font-size: 12px;
776
- border-top-left-radius: 25px;
777
- border-bottom-left-radius: 25px;
778
- color: #fff;
779
- background-color: #f1f1f1;
780
- }
781
-
782
- .uni-calendar__header-text {
783
- text-align: center;
784
- width: 100px;
785
- font-size: 15px;
786
- color: #666;
787
- }
788
-
789
- .uni-calendar__button-text {
790
- text-align: center;
791
- width: 100px;
792
- font-size: 14px;
793
- color: $uni-primary;
794
- /* #ifndef APP-NVUE */
795
- letter-spacing: 3px;
796
- /* #endif */
797
- }
798
-
799
- .uni-calendar__header-btn-box {
800
- /* #ifndef APP-NVUE */
801
- display: flex;
802
- /* #endif */
803
- flex-direction: row;
804
- align-items: center;
805
- justify-content: center;
806
- width: 50px;
807
- height: 50px;
808
- }
809
-
810
- .uni-calendar__header-btn {
811
- width: 9px;
812
- height: 9px;
813
- border-left-color: #808080;
814
- border-left-style: solid;
815
- border-left-width: 1px;
816
- border-top-color: #555555;
817
- border-top-style: solid;
818
- border-top-width: 1px;
819
- }
820
-
821
- .uni-calendar--left {
822
- transform: rotate(-45deg);
823
- }
824
-
825
- .uni-calendar--right {
826
- transform: rotate(135deg);
827
- }
828
-
829
- .uni-calendar__weeks {
830
- position: relative;
831
- /* #ifndef APP-NVUE */
832
- display: flex;
833
- /* #endif */
834
- flex-direction: row;
835
- }
836
-
837
- .uni-calendar__weeks-item {
838
- flex: 1;
839
- }
840
-
841
- .uni-calendar__weeks-day {
842
- flex: 1;
843
- /* #ifndef APP-NVUE */
844
- display: flex;
845
- /* #endif */
846
- flex-direction: column;
847
- justify-content: center;
848
- align-items: center;
849
- height: 40px;
850
- border-bottom-color: #f5f5f5;
851
- border-bottom-style: solid;
852
- border-bottom-width: 1px;
853
- }
854
-
855
- .uni-calendar__weeks-day-text {
856
- font-size: 12px;
857
- color: #b2b2b2;
858
- }
859
-
860
- .uni-calendar__box {
861
- position: relative;
862
- // padding: 0 10px;
863
- padding-bottom: 7px;
864
- }
865
-
866
- .uni-calendar__box-bg {
867
- /* #ifndef APP-NVUE */
868
- display: flex;
869
- /* #endif */
870
- justify-content: center;
871
- align-items: center;
872
- position: absolute;
873
- top: 0;
874
- left: 0;
875
- right: 0;
876
- bottom: 0;
877
- }
878
-
879
- .uni-calendar__box-bg-text {
880
- font-size: 200px;
881
- font-weight: bold;
882
- color: #999;
883
- opacity: 0.1;
884
- text-align: center;
885
- /* #ifndef APP-NVUE */
886
- line-height: 1;
887
- /* #endif */
888
- }
889
-
890
- .uni-date-changed {
891
- padding: 0 10px;
892
- // line-height: 50px;
893
- text-align: center;
894
- color: #333;
895
- border-top-color: #dcdcdc;
896
- border-top-style: solid;
897
- border-top-width: 1px;
898
- flex: 1;
899
- }
900
-
901
- .uni-date-btn--ok {
902
- padding: 20px 15px;
903
- }
904
-
905
- .uni-date-changed--time-start {
906
- /* #ifndef APP-NVUE */
907
- display: flex;
908
- /* #endif */
909
- align-items: center;
910
- }
911
-
912
- .uni-date-changed--time-end {
913
- /* #ifndef APP-NVUE */
914
- display: flex;
915
- /* #endif */
916
- align-items: center;
917
- }
918
-
919
- .uni-date-changed--time-date {
920
- color: #999;
921
- line-height: 50px;
922
- /* #ifdef MP-TOUTIAO */
923
- // font-size: 16px;
924
- /* #endif */
925
- margin-right: 5px;
926
- // opacity: 0.6;
927
- }
928
-
929
- .time-picker-style {
930
- // width: 62px;
931
- /* #ifndef APP-NVUE */
932
- display: flex;
933
- /* #endif */
934
- justify-content: center;
935
- align-items: center;
936
- }
937
-
938
- .mr-10 {
939
- margin-right: 10px;
940
- }
941
-
942
- .dialog-close {
943
- position: absolute;
944
- top: 0;
945
- right: 0;
946
- bottom: 0;
947
- /* #ifndef APP-NVUE */
948
- display: flex;
949
- /* #endif */
950
- flex-direction: row;
951
- align-items: center;
952
- padding: 0 25px;
953
- margin-top: 10px;
954
- }
955
-
956
- .dialog-close-plus {
957
- width: 16px;
958
- height: 2px;
959
- background-color: #737987;
960
- border-radius: 2px;
961
- transform: rotate(45deg);
962
- }
963
-
964
- .dialog-close-rotate {
965
- position: absolute;
966
- transform: rotate(-45deg);
967
- }
968
-
969
- .uni-datetime-picker--btn {
970
- border-radius: 100px;
971
- height: 40px;
972
- line-height: 40px;
973
- background-color: $uni-primary;
974
- color: #fff;
975
- font-size: 16px;
976
- letter-spacing: 2px;
977
- }
978
-
979
- /* #ifndef APP-NVUE */
980
- .uni-datetime-picker--btn:active {
981
- opacity: 0.7;
982
- }
983
-
984
- /* #endif */
985
- </style>