mcrm-mobile 1.1.0 → 1.1.3
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/es/badge/index.js +13 -6
- package/es/biz/style/index.js +2 -0
- package/es/biz/style/less.js +2 -0
- package/es/calendar/components/Month.js +51 -46
- package/es/calendar/index.css +3 -14
- package/es/calendar/index.js +64 -59
- package/es/calendar/index.less +0 -8
- package/es/card/index.js +5 -3
- package/es/common-utils/index.js +17 -5
- package/es/data/MenuIcon.json +1 -1
- package/es/directive/index.js +15 -17
- package/es/http/index.js +69 -73
- package/es/index.css +50 -35
- package/es/index.js +1 -1
- package/es/menu/index.js +19 -7
- package/es/menu-icon/index.css +22 -2
- package/es/menu-icon/index.js +15 -11
- package/es/menu-icon/index.less +17 -2
- package/es/menu-jump/index.js +298 -149
- package/es/menus/index.css +2 -3
- package/es/menus/index.js +7 -6
- package/es/menus/index.less +2 -3
- package/es/notice-bar/index.js +1 -1
- package/es/style/base.css +23 -16
- package/es/style/css/iconfont.css +12 -0
- package/es/style/fonts/iconfont.ttf +0 -0
- package/es/style/fonts/iconfont.woff +0 -0
- package/es/style/fonts/iconfont.woff2 +0 -0
- package/es/style/theme.less +6 -7
- package/es/tab/index.js +3 -1
- package/es/tabs/index.css +11 -14
- package/es/tabs/index.js +8 -2
- package/es/tabs/index.less +9 -16
- package/es/tabs/style/index.js +2 -0
- package/es/tabs/style/less.js +2 -0
- package/es/tabs/title.js +17 -8
- package/es/tag/content.js +119 -0
- package/es/tag/index.css +12 -2
- package/es/tag/index.js +6 -61
- package/es/tag/index.less +15 -1
- package/es/uploader/index.js +96 -27
- package/es/uploader/style/index.js +2 -0
- package/es/uploader/style/less.js +2 -0
- package/es/utils/http.js +66 -21
- package/lib/badge/index.js +13 -6
- package/lib/biz/style/index.js +2 -0
- package/lib/biz/style/less.js +2 -0
- package/lib/calendar/components/Month.js +51 -46
- package/lib/calendar/index.css +3 -14
- package/lib/calendar/index.js +65 -59
- package/lib/calendar/index.less +0 -8
- package/lib/card/index.js +5 -3
- package/lib/common-utils/index.js +17 -5
- package/lib/data/MenuIcon.json +1 -1
- package/lib/directive/index.js +16 -17
- package/lib/http/index.js +69 -73
- package/lib/index.css +50 -35
- package/lib/index.js +1 -1
- package/lib/mcrm-mobile.js +3177 -2855
- package/lib/mcrm-mobile.min.js +5 -5
- package/lib/menu/index.js +20 -9
- package/lib/menu-icon/index.css +22 -2
- package/lib/menu-icon/index.js +15 -11
- package/lib/menu-icon/index.less +17 -2
- package/lib/menu-jump/index.js +302 -149
- package/lib/menus/index.css +2 -3
- package/lib/menus/index.js +7 -6
- package/lib/menus/index.less +2 -3
- package/lib/notice-bar/index.js +1 -1
- package/lib/style/base.css +23 -16
- package/lib/style/css/iconfont.css +12 -0
- package/lib/style/fonts/iconfont.ttf +0 -0
- package/lib/style/fonts/iconfont.woff +0 -0
- package/lib/style/fonts/iconfont.woff2 +0 -0
- package/lib/style/theme.less +6 -7
- package/lib/tab/index.js +3 -1
- package/lib/tabs/index.css +11 -14
- package/lib/tabs/index.js +8 -2
- package/lib/tabs/index.less +9 -16
- package/lib/tabs/style/index.js +2 -0
- package/lib/tabs/style/less.js +2 -0
- package/lib/tabs/title.js +18 -8
- package/lib/tag/content.js +131 -0
- package/lib/tag/index.css +12 -2
- package/lib/tag/index.js +6 -61
- package/lib/tag/index.less +15 -1
- package/lib/uploader/index.js +97 -27
- package/lib/uploader/style/index.js +2 -0
- package/lib/uploader/style/less.js +2 -0
- package/lib/utils/http.js +69 -21
- package/package.json +2 -2
- package/types/common.d.ts +2 -0
- package/types/menu-jump.d.ts +1 -0
- package/vetur/attributes.json +203 -145
- package/vetur/tags.json +50 -37
- package/vetur/web-types.json +457 -311
package/es/badge/index.js
CHANGED
|
@@ -18,9 +18,7 @@ export default create({
|
|
|
18
18
|
dot: _vm.dot,
|
|
19
19
|
fixed: !!_vm.$slots['default']
|
|
20
20
|
}),
|
|
21
|
-
style:
|
|
22
|
-
background: _vm.color
|
|
23
|
-
}
|
|
21
|
+
style: _vm.style
|
|
24
22
|
}, [_vm._t("content", function () {
|
|
25
23
|
return [_vm._v("\n " + _vm._s(_vm.renderContent()) + "\n ")];
|
|
26
24
|
})], 2) : _vm._e()], 2) : _c('div', {
|
|
@@ -28,9 +26,7 @@ export default create({
|
|
|
28
26
|
dot: _vm.dot,
|
|
29
27
|
fixed: !!_vm.$slots['default']
|
|
30
28
|
}),
|
|
31
|
-
style:
|
|
32
|
-
background: _vm.color
|
|
33
|
-
}
|
|
29
|
+
style: _vm.style
|
|
34
30
|
}, [_vm._t("content", function () {
|
|
35
31
|
return [_vm._v("\n " + _vm._s(_vm.renderContent()) + "\n ")];
|
|
36
32
|
})], 2);
|
|
@@ -43,6 +39,7 @@ export default create({
|
|
|
43
39
|
dot: Boolean,
|
|
44
40
|
max: [Number, String],
|
|
45
41
|
color: String,
|
|
42
|
+
textColor: String,
|
|
46
43
|
content: [Number, String],
|
|
47
44
|
tag: {
|
|
48
45
|
type: String,
|
|
@@ -66,5 +63,15 @@ export default create({
|
|
|
66
63
|
return content;
|
|
67
64
|
}
|
|
68
65
|
}
|
|
66
|
+
},
|
|
67
|
+
computed: {
|
|
68
|
+
style: function style() {
|
|
69
|
+
var textColor = this.textColor,
|
|
70
|
+
color = this.color;
|
|
71
|
+
return {
|
|
72
|
+
color: textColor,
|
|
73
|
+
background: color
|
|
74
|
+
};
|
|
75
|
+
}
|
|
69
76
|
}
|
|
70
77
|
});
|
package/es/biz/style/index.js
CHANGED
package/es/biz/style/less.js
CHANGED
|
@@ -14,5 +14,7 @@ import '../../menu/index.less';
|
|
|
14
14
|
import '../../menus/index.less';
|
|
15
15
|
import '../../sticky/index.less';
|
|
16
16
|
import '../../tabs/index.less';
|
|
17
|
+
import '../../tag/index.less';
|
|
18
|
+
import '../../badge/index.less';
|
|
17
19
|
import '../../tab/index.less';
|
|
18
20
|
import '../index.less';
|
|
@@ -11,29 +11,25 @@ export default {
|
|
|
11
11
|
|
|
12
12
|
return _c('div', {
|
|
13
13
|
ref: "month",
|
|
14
|
-
class: _vm.b('month')
|
|
15
|
-
style: _vm.monthStyle
|
|
14
|
+
class: _vm.b('month')
|
|
16
15
|
}, [_vm.showMonthTitle ? _c('div', {
|
|
17
16
|
class: _vm.b('month-title')
|
|
18
|
-
}, [_vm._v("\n " + _vm._s(_vm.title) + "\n ")]) : _vm._e(),
|
|
17
|
+
}, [_vm._v("\n " + _vm._s(_vm.title) + "\n ")]) : _vm._e(), _c('div', {
|
|
19
18
|
ref: "days",
|
|
20
19
|
class: _vm.b('days'),
|
|
21
20
|
attrs: {
|
|
22
21
|
"role": "grid"
|
|
23
22
|
}
|
|
24
|
-
}, [_vm.showMark ? _c('div', {
|
|
23
|
+
}, [_vm.showMark && _vm.shouldRender ? _c('div', {
|
|
25
24
|
class: _vm.b('month-mark')
|
|
26
|
-
}, [_vm._v("\n " + _vm._s(_vm.date.getMonth() + 1) + "\n ")]) : _vm._e(), _vm._l(_vm.
|
|
27
|
-
return _c('div', {
|
|
25
|
+
}, [_vm._v("\n " + _vm._s(_vm.date.getMonth() + 1) + "\n ")]) : _vm._e(), _vm._l(_vm.newDats, function (item, index) {
|
|
26
|
+
return [item.type === 'selected' ? _c('div', {
|
|
28
27
|
key: index + '' + item.text,
|
|
29
|
-
|
|
30
|
-
refInFor: true,
|
|
31
|
-
class: [_vm.b('day', item.type), item.className],
|
|
28
|
+
class: [_vm.b('day'), item.className],
|
|
32
29
|
style: _vm.getDayStyle(item.type, index),
|
|
33
30
|
attrs: {
|
|
34
|
-
"refInFor": "",
|
|
35
31
|
"role": "gridcell",
|
|
36
|
-
"tabindex":
|
|
32
|
+
"tabindex": -1
|
|
37
33
|
},
|
|
38
34
|
on: {
|
|
39
35
|
"click": function click($event) {
|
|
@@ -41,16 +37,35 @@ export default {
|
|
|
41
37
|
}
|
|
42
38
|
}
|
|
43
39
|
}, [_c('div', {
|
|
44
|
-
class:
|
|
45
|
-
style:
|
|
40
|
+
class: _vm.b('selected-day'),
|
|
41
|
+
style: _vm.selectedStyle
|
|
42
|
+
}, [item.topInfo || _vm.$slots['top-info'] ? _c('div', {
|
|
43
|
+
class: _vm.b('top-info')
|
|
44
|
+
}, [_vm._t("top-info", function () {
|
|
45
|
+
return [_vm._v("\n " + _vm._s(item.topInfo) + "\n ")];
|
|
46
|
+
}, null, item)], 2) : _vm._e(), _vm._v("\n " + _vm._s(item.text) + "\n "), item.bottomInfo || _vm.$slots['bottom-info'] ? _c('div', {
|
|
47
|
+
class: _vm.b('bottom-info')
|
|
48
|
+
}, [_vm._t("bottom-info", function () {
|
|
49
|
+
return [_vm._v("\n " + _vm._s(item.bottomInfo) + "\n ")];
|
|
50
|
+
}, null, item)], 2) : _vm._e()])]) : _c('div', {
|
|
51
|
+
key: index + '' + item.text,
|
|
52
|
+
class: [_vm.b('day', item.type), item.className],
|
|
53
|
+
style: _vm.getDayStyle(item.type, index),
|
|
54
|
+
attrs: {
|
|
55
|
+
"role": "gridcell",
|
|
56
|
+
"tabindex": item.type === 'disabled' ? null : -1
|
|
57
|
+
},
|
|
58
|
+
on: {
|
|
59
|
+
"click": function click($event) {
|
|
60
|
+
return _vm.onClick(item);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
46
63
|
}, [item.topInfo ? _c('div', {
|
|
47
64
|
class: _vm.b('top-info')
|
|
48
65
|
}, [_vm._v("\n " + _vm._s(item.topInfo) + "\n ")]) : _vm._e(), _vm._v("\n " + _vm._s(item.text) + "\n "), item.bottomInfo ? _c('div', {
|
|
49
66
|
class: _vm.b('bottom-info')
|
|
50
|
-
}, [_vm._v("\n " + _vm._s(item.bottomInfo) + "\n ")]) : _vm._e()])]
|
|
51
|
-
})], 2)
|
|
52
|
-
ref: "days"
|
|
53
|
-
})]);
|
|
67
|
+
}, [_vm._v("\n " + _vm._s(item.bottomInfo) + "\n ")]) : _vm._e()])];
|
|
68
|
+
})], 2)]);
|
|
54
69
|
},
|
|
55
70
|
name: "month",
|
|
56
71
|
props: {
|
|
@@ -67,29 +82,9 @@ export default {
|
|
|
67
82
|
currentDate: [Date, Array],
|
|
68
83
|
allowSameDay: Boolean,
|
|
69
84
|
showSubtitle: Boolean,
|
|
70
|
-
realRowHeight: Number,
|
|
71
85
|
showMonthTitle: Boolean,
|
|
72
86
|
firstDayOfWeek: Number
|
|
73
87
|
},
|
|
74
|
-
watch: {
|
|
75
|
-
shouldRender: function shouldRender(value) {
|
|
76
|
-
var _this = this;
|
|
77
|
-
|
|
78
|
-
if (value) {
|
|
79
|
-
this.$nextTick(function () {
|
|
80
|
-
if (_this.$refs.day[0] && !_this.realRowHeight) {
|
|
81
|
-
var _this$$refs$day$0$get = _this.$refs.day[0].getBoundingClientRect(),
|
|
82
|
-
height = _this$$refs$day$0$get.height;
|
|
83
|
-
|
|
84
|
-
_this.$emit("update-height", height);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
realRowHeight: function realRowHeight() {
|
|
90
|
-
this.height = null;
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
88
|
data: function data() {
|
|
94
89
|
return {
|
|
95
90
|
visible: false
|
|
@@ -117,10 +112,10 @@ export default {
|
|
|
117
112
|
Scroll.setScrollTop(body, scrollTop);
|
|
118
113
|
},
|
|
119
114
|
getMultipleDayType: function getMultipleDayType(day) {
|
|
120
|
-
var
|
|
115
|
+
var _this = this;
|
|
121
116
|
|
|
122
117
|
var isSelected = function isSelected(date) {
|
|
123
|
-
return
|
|
118
|
+
return _this.currentDate.some(function (item) {
|
|
124
119
|
return compareDay(item, date) === 0;
|
|
125
120
|
});
|
|
126
121
|
};
|
|
@@ -225,6 +220,11 @@ export default {
|
|
|
225
220
|
height: this.rowHeightWithUnit
|
|
226
221
|
};
|
|
227
222
|
|
|
223
|
+
if (type === "placeholder") {
|
|
224
|
+
style.width = "100%";
|
|
225
|
+
return style;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
228
|
if (index === 0) {
|
|
229
229
|
style.marginLeft = 100 * this.offset / 7 + "%";
|
|
230
230
|
}
|
|
@@ -270,15 +270,17 @@ export default {
|
|
|
270
270
|
shouldRender: function shouldRender() {
|
|
271
271
|
return this.visible || !this.lazyRender;
|
|
272
272
|
},
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
273
|
+
placeholders: function placeholders() {
|
|
274
|
+
var rows = [];
|
|
275
|
+
var count = Math.ceil((this.totalDay + this.offset) / 7);
|
|
276
|
+
|
|
277
|
+
for (var day = 1; day <= count; day++) {
|
|
278
|
+
rows.push({
|
|
279
|
+
type: "placeholder"
|
|
280
|
+
});
|
|
279
281
|
}
|
|
280
282
|
|
|
281
|
-
return
|
|
283
|
+
return rows;
|
|
282
284
|
},
|
|
283
285
|
days: function days() {
|
|
284
286
|
var days = [];
|
|
@@ -303,6 +305,9 @@ export default {
|
|
|
303
305
|
}
|
|
304
306
|
|
|
305
307
|
return days;
|
|
308
|
+
},
|
|
309
|
+
newDats: function newDats() {
|
|
310
|
+
return this.shouldRender ? this.days : this.placeholders;
|
|
306
311
|
}
|
|
307
312
|
}
|
|
308
313
|
};
|
package/es/calendar/index.css
CHANGED
|
@@ -330,14 +330,10 @@
|
|
|
330
330
|
display: flex;
|
|
331
331
|
-ms-flex-wrap: wrap;
|
|
332
332
|
flex-wrap: wrap;
|
|
333
|
-
-webkit-appearance: none;
|
|
334
|
-
-webkit-tap-highlight-color: transparent;
|
|
335
|
-
outline: none;
|
|
336
333
|
-webkit-user-select: none;
|
|
337
334
|
-moz-user-select: none;
|
|
338
335
|
-ms-user-select: none;
|
|
339
336
|
user-select: none;
|
|
340
|
-
border: 0;
|
|
341
337
|
}
|
|
342
338
|
.mm-calendar-month-mark {
|
|
343
339
|
position: absolute;
|
|
@@ -369,13 +365,6 @@
|
|
|
369
365
|
height: 64px;
|
|
370
366
|
font-size: 16px;
|
|
371
367
|
cursor: pointer;
|
|
372
|
-
-webkit-appearance: none;
|
|
373
|
-
-webkit-tap-highlight-color: transparent;
|
|
374
|
-
outline: none;
|
|
375
|
-
-webkit-user-select: none;
|
|
376
|
-
-moz-user-select: none;
|
|
377
|
-
-ms-user-select: none;
|
|
378
|
-
user-select: none;
|
|
379
368
|
}
|
|
380
369
|
.mm-calendar-day-end,
|
|
381
370
|
.mm-calendar-day-start,
|
|
@@ -383,7 +372,7 @@
|
|
|
383
372
|
.mm-calendar-day-multiple-middle,
|
|
384
373
|
.mm-calendar-day-multiple-selected {
|
|
385
374
|
color: #fff;
|
|
386
|
-
background-color: #
|
|
375
|
+
background-color: #0095fd;
|
|
387
376
|
}
|
|
388
377
|
.mm-calendar-day-start {
|
|
389
378
|
border-radius: 4px 0 0 4px;
|
|
@@ -396,7 +385,7 @@
|
|
|
396
385
|
border-radius: 4px;
|
|
397
386
|
}
|
|
398
387
|
.mm-calendar-day-middle {
|
|
399
|
-
color: #
|
|
388
|
+
color: #0095fd;
|
|
400
389
|
}
|
|
401
390
|
.mm-calendar-day-middle::after {
|
|
402
391
|
position: absolute;
|
|
@@ -436,7 +425,7 @@
|
|
|
436
425
|
width: 54px;
|
|
437
426
|
height: 54px;
|
|
438
427
|
color: #fff;
|
|
439
|
-
background-color: #
|
|
428
|
+
background-color: #0095fd;
|
|
440
429
|
border-radius: 4px;
|
|
441
430
|
}
|
|
442
431
|
.mm-calendar-footer {
|
package/es/calendar/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import Header from "./components/Header"; // Utils
|
|
|
9
9
|
import { isDate } from "../utils/validate/date";
|
|
10
10
|
import Scroll from "../utils/dom/scroll";
|
|
11
11
|
import { copyDate, copyDates, getNextDay, compareDay, calcDateNum, compareMonth, getDayByOffset, rangePromptFn } from "./utils";
|
|
12
|
+
import { raf } from "../utils/dom/raf";
|
|
12
13
|
export default create({
|
|
13
14
|
render: function render() {
|
|
14
15
|
var _vm = this;
|
|
@@ -31,16 +32,16 @@ export default create({
|
|
|
31
32
|
on: {
|
|
32
33
|
"input": _vm.togglePopup,
|
|
33
34
|
"open": function open($event) {
|
|
34
|
-
return _vm.
|
|
35
|
+
return _vm.createListener('open');
|
|
35
36
|
},
|
|
36
37
|
"opened": function opened($event) {
|
|
37
|
-
return _vm.
|
|
38
|
+
return _vm.createListener('opened');
|
|
38
39
|
},
|
|
39
40
|
"close": function close($event) {
|
|
40
|
-
return _vm.
|
|
41
|
+
return _vm.createListener('close');
|
|
41
42
|
},
|
|
42
43
|
"closed": function closed($event) {
|
|
43
|
-
return _vm.
|
|
44
|
+
return _vm.createListener('closed');
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
}, [_c('div', {
|
|
@@ -80,13 +81,11 @@ export default create({
|
|
|
80
81
|
"currentDate": _vm.currentDate,
|
|
81
82
|
"showSubtitle": _vm.showSubtitle,
|
|
82
83
|
"allowSameDay": _vm.allowSameDay,
|
|
83
|
-
"realRowHeight": _vm.realRowHeight,
|
|
84
84
|
"showMonthTitle": index !== 0 || !_vm.showSubtitle,
|
|
85
85
|
"firstDayOfWeek": _vm.dayOffset
|
|
86
86
|
},
|
|
87
87
|
on: {
|
|
88
|
-
"click": _vm.onClickDay
|
|
89
|
-
"update-height": _vm.onUpdateHeight
|
|
88
|
+
"click": _vm.onClickDay
|
|
90
89
|
}
|
|
91
90
|
});
|
|
92
91
|
}), 1), _c('div', {
|
|
@@ -95,14 +94,12 @@ export default create({
|
|
|
95
94
|
})
|
|
96
95
|
}, [_vm._t("footer", function () {
|
|
97
96
|
return [_vm.showConfirm ? _c('Button', {
|
|
98
|
-
staticClass: "bg-
|
|
97
|
+
staticClass: "bg-blue",
|
|
99
98
|
class: _vm.b('confirm'),
|
|
100
99
|
attrs: {
|
|
101
100
|
"radius": "mc",
|
|
102
101
|
"block": "",
|
|
103
|
-
"
|
|
104
|
-
"color": _vm.color,
|
|
105
|
-
"background": _vm.background,
|
|
102
|
+
"background": _vm.btnBackground,
|
|
106
103
|
"disabled": _vm.buttonDisabled,
|
|
107
104
|
"nativeType": "button"
|
|
108
105
|
},
|
|
@@ -147,13 +144,11 @@ export default create({
|
|
|
147
144
|
"currentDate": _vm.currentDate,
|
|
148
145
|
"showSubtitle": _vm.showSubtitle,
|
|
149
146
|
"allowSameDay": _vm.allowSameDay,
|
|
150
|
-
"realRowHeight": _vm.realRowHeight,
|
|
151
147
|
"showMonthTitle": index !== 0 || !_vm.showSubtitle,
|
|
152
148
|
"firstDayOfWeek": _vm.dayOffset
|
|
153
149
|
},
|
|
154
150
|
on: {
|
|
155
|
-
"click": _vm.onClickDay
|
|
156
|
-
"update-height": _vm.onUpdateHeight
|
|
151
|
+
"click": _vm.onClickDay
|
|
157
152
|
}
|
|
158
153
|
});
|
|
159
154
|
}), 1), _c('div', {
|
|
@@ -162,14 +157,12 @@ export default create({
|
|
|
162
157
|
})
|
|
163
158
|
}, [_vm._t("footer", function () {
|
|
164
159
|
return [_vm.showConfirm ? _c('Button', {
|
|
165
|
-
staticClass: "bg-
|
|
160
|
+
staticClass: "bg-blue",
|
|
166
161
|
class: _vm.b('confirm'),
|
|
167
162
|
attrs: {
|
|
168
163
|
"radius": "mc",
|
|
169
164
|
"block": "",
|
|
170
|
-
"
|
|
171
|
-
"color": _vm.color,
|
|
172
|
-
"background": _vm.background,
|
|
165
|
+
"background": _vm.btnBackground,
|
|
173
166
|
"disabled": _vm.buttonDisabled,
|
|
174
167
|
"nativeType": "button"
|
|
175
168
|
},
|
|
@@ -190,7 +183,7 @@ export default create({
|
|
|
190
183
|
props: {
|
|
191
184
|
title: String,
|
|
192
185
|
color: String,
|
|
193
|
-
|
|
186
|
+
btnBackground: String,
|
|
194
187
|
value: Boolean,
|
|
195
188
|
readonly: Boolean,
|
|
196
189
|
formatter: Function,
|
|
@@ -277,8 +270,10 @@ export default create({
|
|
|
277
270
|
}
|
|
278
271
|
},
|
|
279
272
|
watch: {
|
|
280
|
-
type: "reset",
|
|
281
273
|
value: "init",
|
|
274
|
+
type: function type() {
|
|
275
|
+
this.reset();
|
|
276
|
+
},
|
|
282
277
|
defaultDate: function defaultDate(val) {
|
|
283
278
|
this.currentDate = val;
|
|
284
279
|
this.scrollIntoView();
|
|
@@ -287,8 +282,7 @@ export default create({
|
|
|
287
282
|
data: function data() {
|
|
288
283
|
return {
|
|
289
284
|
subtitle: "",
|
|
290
|
-
currentDate: this.getInitialDate()
|
|
291
|
-
realRowHeight: 0
|
|
285
|
+
currentDate: this.getInitialDate()
|
|
292
286
|
};
|
|
293
287
|
},
|
|
294
288
|
mounted: function mounted() {
|
|
@@ -301,8 +295,12 @@ export default create({
|
|
|
301
295
|
},
|
|
302
296
|
methods: {
|
|
303
297
|
// @exposed-api
|
|
304
|
-
reset: function reset() {
|
|
305
|
-
|
|
298
|
+
reset: function reset(date) {
|
|
299
|
+
if (date === void 0) {
|
|
300
|
+
date = this.getInitialDate();
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
this.currentDate = date;
|
|
306
304
|
this.scrollIntoView();
|
|
307
305
|
},
|
|
308
306
|
init: function init() {
|
|
@@ -318,21 +316,15 @@ export default create({
|
|
|
318
316
|
_this.bodyHeight = Math.floor(_this.$refs.body.getBoundingClientRect().height);
|
|
319
317
|
|
|
320
318
|
_this.onScroll();
|
|
319
|
+
|
|
320
|
+
_this.scrollIntoView();
|
|
321
321
|
});
|
|
322
|
-
this.scrollIntoView();
|
|
323
322
|
},
|
|
324
|
-
//
|
|
325
|
-
|
|
323
|
+
// @exposed-api
|
|
324
|
+
scrollToDate: function scrollToDate(targetDate) {
|
|
326
325
|
var _this2 = this;
|
|
327
326
|
|
|
328
|
-
|
|
329
|
-
var currentDate = _this2.currentDate;
|
|
330
|
-
|
|
331
|
-
if (!currentDate) {
|
|
332
|
-
return;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
var targetDate = _this2.type === "single" ? currentDate : currentDate[0];
|
|
327
|
+
raf(function () {
|
|
336
328
|
var displayed = _this2.value || !_this2.poppable;
|
|
337
329
|
/* istanbul ignore if */
|
|
338
330
|
|
|
@@ -351,8 +343,19 @@ export default create({
|
|
|
351
343
|
|
|
352
344
|
return false;
|
|
353
345
|
});
|
|
346
|
+
|
|
347
|
+
_this2.onScroll();
|
|
354
348
|
});
|
|
355
349
|
},
|
|
350
|
+
// scroll to current month
|
|
351
|
+
scrollIntoView: function scrollIntoView() {
|
|
352
|
+
var currentDate = this.currentDate;
|
|
353
|
+
|
|
354
|
+
if (currentDate) {
|
|
355
|
+
var targetDate = this.type === "single" ? currentDate : currentDate[0];
|
|
356
|
+
this.scrollToDate(targetDate);
|
|
357
|
+
}
|
|
358
|
+
},
|
|
356
359
|
getInitialDate: function getInitialDate() {
|
|
357
360
|
var type = this.type,
|
|
358
361
|
minDate = this.minDate,
|
|
@@ -392,6 +395,7 @@ export default create({
|
|
|
392
395
|
body = _this$$refs.body,
|
|
393
396
|
months = _this$$refs.months;
|
|
394
397
|
var top = Scroll.getScrollTop(body);
|
|
398
|
+
var bottom = top + this.bodyHeight;
|
|
395
399
|
var heights = months.map(function (item) {
|
|
396
400
|
return item.getHeight();
|
|
397
401
|
});
|
|
@@ -399,39 +403,41 @@ export default create({
|
|
|
399
403
|
return a + b;
|
|
400
404
|
}, 0); // iOS scroll bounce may exceed the range
|
|
401
405
|
|
|
402
|
-
var bottom = top + this.bodyHeight;
|
|
403
|
-
|
|
404
406
|
if (bottom > heightSum && top > 0) {
|
|
405
|
-
|
|
407
|
+
return;
|
|
406
408
|
}
|
|
407
409
|
|
|
408
410
|
var height = 0;
|
|
409
|
-
var currentMonth;
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
var viewportOffset = 50;
|
|
413
|
-
var viewportTop = top - viewportOffset;
|
|
414
|
-
var viewportBottom = bottom + viewportOffset;
|
|
411
|
+
var currentMonth;
|
|
412
|
+
var visibleRange = [-1, -1];
|
|
415
413
|
|
|
416
414
|
for (var i = 0; i < months.length; i++) {
|
|
417
|
-
var visible = height <=
|
|
415
|
+
var visible = height <= bottom && height + heights[i] >= top;
|
|
418
416
|
|
|
419
|
-
if (visible
|
|
420
|
-
|
|
421
|
-
}
|
|
417
|
+
if (visible) {
|
|
418
|
+
visibleRange[1] = i;
|
|
422
419
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
420
|
+
if (!currentMonth) {
|
|
421
|
+
currentMonth = months[i];
|
|
422
|
+
visibleRange[0] = i;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
if (!months[i].showed) {
|
|
426
|
+
months[i].showed = true;
|
|
427
|
+
this.$emit("month-show", {
|
|
428
|
+
date: months[i].date,
|
|
429
|
+
title: months[i].title
|
|
430
|
+
});
|
|
431
|
+
}
|
|
428
432
|
}
|
|
429
433
|
|
|
430
|
-
months[i].visible = visible;
|
|
431
434
|
height += heights[i];
|
|
432
435
|
}
|
|
433
|
-
/* istanbul ignore else */
|
|
434
436
|
|
|
437
|
+
months.forEach(function (month, index) {
|
|
438
|
+
month.visible = index >= visibleRange[0] - 1 && index <= visibleRange[1] + 1;
|
|
439
|
+
});
|
|
440
|
+
/* istanbul ignore else */
|
|
435
441
|
|
|
436
442
|
if (currentMonth) {
|
|
437
443
|
this.subtitle = currentMonth.title;
|
|
@@ -465,6 +471,8 @@ export default create({
|
|
|
465
471
|
} else if (this.allowSameDay) {
|
|
466
472
|
this.select([date, date], true);
|
|
467
473
|
}
|
|
474
|
+
} else if (endDay && date.getTime() > endDay.getTime()) {
|
|
475
|
+
this.select([startDay, date], true);
|
|
468
476
|
} else {
|
|
469
477
|
this.select([date, null]);
|
|
470
478
|
}
|
|
@@ -502,7 +510,7 @@ export default create({
|
|
|
502
510
|
togglePopup: function togglePopup(val) {
|
|
503
511
|
this.$emit("input", val);
|
|
504
512
|
},
|
|
505
|
-
|
|
513
|
+
createListener: function createListener(name) {
|
|
506
514
|
this.$emit(name);
|
|
507
515
|
},
|
|
508
516
|
select: function select(date, complete) {
|
|
@@ -548,9 +556,6 @@ export default create({
|
|
|
548
556
|
},
|
|
549
557
|
onConfirm: function onConfirm() {
|
|
550
558
|
this.$emit("confirm", copyDates(this.currentDate));
|
|
551
|
-
},
|
|
552
|
-
onUpdateHeight: function onUpdateHeight(height) {
|
|
553
|
-
this.realRowHeight = height;
|
|
554
559
|
}
|
|
555
560
|
},
|
|
556
561
|
computed: {
|
package/es/calendar/index.less
CHANGED
|
@@ -69,11 +69,7 @@
|
|
|
69
69
|
position: relative;
|
|
70
70
|
display: flex;
|
|
71
71
|
flex-wrap: wrap;
|
|
72
|
-
-webkit-appearance: none;
|
|
73
|
-
-webkit-tap-highlight-color: transparent;
|
|
74
|
-
outline: none;
|
|
75
72
|
user-select: none;
|
|
76
|
-
border: 0;
|
|
77
73
|
}
|
|
78
74
|
|
|
79
75
|
&-month-mark {
|
|
@@ -101,10 +97,6 @@
|
|
|
101
97
|
height: @calendar-day-height;
|
|
102
98
|
font-size: @calendar-day-font-size;
|
|
103
99
|
cursor: pointer;
|
|
104
|
-
-webkit-appearance: none;
|
|
105
|
-
-webkit-tap-highlight-color: transparent;
|
|
106
|
-
outline: none;
|
|
107
|
-
user-select: none;
|
|
108
100
|
|
|
109
101
|
&-end,
|
|
110
102
|
&-start,
|
package/es/card/index.js
CHANGED
|
@@ -20,9 +20,11 @@ export default create({
|
|
|
20
20
|
on: {
|
|
21
21
|
"click": _vm.onClick
|
|
22
22
|
}
|
|
23
|
-
}, [
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
}, [_vm._t("title", function () {
|
|
24
|
+
return [_c('span', {
|
|
25
|
+
class: _vm.b('header-title')
|
|
26
|
+
}, [_vm._v(_vm._s(_vm.title))])];
|
|
27
|
+
}), _vm._t("right-op", function () {
|
|
26
28
|
return [_vm.isLink ? _c('mm-icon', {
|
|
27
29
|
attrs: {
|
|
28
30
|
"name": _vm.icon
|
package/es/common-utils/index.js
CHANGED
|
@@ -87,6 +87,7 @@ CommonUtils.formattingTime = function (date, format) {
|
|
|
87
87
|
var hour = date.getHours();
|
|
88
88
|
var min = date.getMinutes();
|
|
89
89
|
var seconds = date.getSeconds();
|
|
90
|
+
var milliseconds = date.getMilliseconds();
|
|
90
91
|
var monthS = CommonUtils.zeroPadding(function (val) {
|
|
91
92
|
return val < 10;
|
|
92
93
|
}, month);
|
|
@@ -102,7 +103,10 @@ CommonUtils.formattingTime = function (date, format) {
|
|
|
102
103
|
var secondsS = CommonUtils.zeroPadding(function (val) {
|
|
103
104
|
return val < 10;
|
|
104
105
|
}, seconds);
|
|
105
|
-
var
|
|
106
|
+
var millisecondsS = CommonUtils.zeroPadding(function (val) {
|
|
107
|
+
return val < 10;
|
|
108
|
+
}, milliseconds);
|
|
109
|
+
var desc = format.replace("yyyy", year).replace("MM", monthS).replace("dd", dayS).replace("hh", hourS).replace("mm", minS).replace("ss", secondsS).replace("SSS", millisecondsS);
|
|
106
110
|
return {
|
|
107
111
|
date: date,
|
|
108
112
|
desc: desc,
|
|
@@ -111,7 +115,8 @@ CommonUtils.formattingTime = function (date, format) {
|
|
|
111
115
|
day: day,
|
|
112
116
|
hour: hour,
|
|
113
117
|
min: min,
|
|
114
|
-
seconds: seconds
|
|
118
|
+
seconds: seconds,
|
|
119
|
+
milliseconds: milliseconds
|
|
115
120
|
};
|
|
116
121
|
};
|
|
117
122
|
|
|
@@ -133,9 +138,16 @@ CommonUtils.getMonthBefore = function (monthBefore, currDate) {
|
|
|
133
138
|
month = currMonth - monthBefore;
|
|
134
139
|
year = currYear;
|
|
135
140
|
|
|
136
|
-
if (
|
|
137
|
-
month
|
|
138
|
-
|
|
141
|
+
if (monthBefore > 0) {
|
|
142
|
+
if (month <= 0) {
|
|
143
|
+
month += 12;
|
|
144
|
+
year--;
|
|
145
|
+
}
|
|
146
|
+
} else {
|
|
147
|
+
if (month > 12) {
|
|
148
|
+
month -= 12;
|
|
149
|
+
year++;
|
|
150
|
+
}
|
|
139
151
|
}
|
|
140
152
|
|
|
141
153
|
day = CommonUtils.getNumForMonth(year, month);
|