vxe-table 3.5.4 → 3.5.6
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/helper/vetur/attributes.json +31 -19
- package/helper/vetur/tags.json +3 -0
- package/lib/form/src/form.js +6 -1
- package/lib/form/src/form.min.js +1 -1
- package/lib/header/style/style.css +1 -5
- package/lib/header/style/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.umd.js +325 -113
- package/lib/index.umd.min.js +1 -1
- package/lib/input/src/input.js +213 -68
- package/lib/input/src/input.min.js +1 -1
- package/lib/input/style/style.css +43 -14
- package/lib/input/style/style.min.css +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/src/methods.js +22 -20
- package/lib/table/src/methods.min.js +1 -1
- package/lib/tools/log.js +1 -1
- package/lib/tools/log.min.js +1 -1
- package/lib/tooltip/src/tooltip.js +24 -21
- package/lib/tooltip/src/tooltip.min.js +1 -1
- package/lib/v-x-e-table/index.js +1 -1
- package/lib/v-x-e-table/index.min.js +1 -1
- package/package.json +1 -1
- package/packages/form/src/form.js +1 -1
- package/packages/input/src/input.js +129 -44
- package/packages/table/src/methods.js +18 -12
- package/packages/tooltip/src/tooltip.js +22 -20
- package/styles/header.scss +1 -1
- package/styles/input.scss +17 -5
package/lib/input/src/input.js
CHANGED
|
@@ -37,7 +37,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
37
37
|
|
|
38
38
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
39
39
|
|
|
40
|
-
var yearSize =
|
|
40
|
+
var yearSize = 12;
|
|
41
41
|
var monthSize = 20;
|
|
42
42
|
var quarterSize = 8;
|
|
43
43
|
|
|
@@ -117,7 +117,9 @@ function renderDateDayTable(h, _vm) {
|
|
|
117
117
|
dateValue = _vm.dateValue,
|
|
118
118
|
datePanelValue = _vm.datePanelValue,
|
|
119
119
|
dateHeaders = _vm.dateHeaders,
|
|
120
|
-
dayDatas = _vm.dayDatas
|
|
120
|
+
dayDatas = _vm.dayDatas,
|
|
121
|
+
multiple = _vm.multiple,
|
|
122
|
+
dateListValue = _vm.dateListValue;
|
|
121
123
|
var matchFormat = 'yyyy-MM-dd';
|
|
122
124
|
return [h('table', {
|
|
123
125
|
class: "vxe-input--date-".concat(datePanelType, "-view"),
|
|
@@ -137,7 +139,9 @@ function renderDateDayTable(h, _vm) {
|
|
|
137
139
|
'is--now': item.isNow,
|
|
138
140
|
'is--next': item.isNext,
|
|
139
141
|
'is--disabled': isDateDisabled(_vm, item),
|
|
140
|
-
'is--selected':
|
|
142
|
+
'is--selected': multiple ? dateListValue.some(function (val) {
|
|
143
|
+
return _xeUtils.default.isDateSame(val, item.date, matchFormat);
|
|
144
|
+
}) : _xeUtils.default.isDateSame(dateValue, item.date, matchFormat),
|
|
141
145
|
'is--hover': _xeUtils.default.isDateSame(datePanelValue, item.date, matchFormat)
|
|
142
146
|
},
|
|
143
147
|
on: {
|
|
@@ -158,7 +162,9 @@ function renderDateWeekTable(h, _vm) {
|
|
|
158
162
|
dateValue = _vm.dateValue,
|
|
159
163
|
datePanelValue = _vm.datePanelValue,
|
|
160
164
|
weekHeaders = _vm.weekHeaders,
|
|
161
|
-
weekDates = _vm.weekDates
|
|
165
|
+
weekDates = _vm.weekDates,
|
|
166
|
+
multiple = _vm.multiple,
|
|
167
|
+
dateListValue = _vm.dateListValue;
|
|
162
168
|
var matchFormat = 'yyyyMMdd';
|
|
163
169
|
return [h('table', {
|
|
164
170
|
class: "vxe-input--date-".concat(datePanelType, "-view"),
|
|
@@ -170,7 +176,11 @@ function renderDateWeekTable(h, _vm) {
|
|
|
170
176
|
}, [h('thead', [h('tr', weekHeaders.map(function (item) {
|
|
171
177
|
return h('th', item.label);
|
|
172
178
|
}))]), h('tbody', weekDates.map(function (rows) {
|
|
173
|
-
var isSelected = rows.some(function (item) {
|
|
179
|
+
var isSelected = multiple ? rows.some(function (item) {
|
|
180
|
+
return dateListValue.some(function (val) {
|
|
181
|
+
return _xeUtils.default.isDateSame(val, item.date, matchFormat);
|
|
182
|
+
});
|
|
183
|
+
}) : rows.some(function (item) {
|
|
174
184
|
return _xeUtils.default.isDateSame(dateValue, item.date, matchFormat);
|
|
175
185
|
});
|
|
176
186
|
var isHover = rows.some(function (item) {
|
|
@@ -204,7 +214,9 @@ function renderDateMonthTable(h, _vm) {
|
|
|
204
214
|
var dateValue = _vm.dateValue,
|
|
205
215
|
datePanelType = _vm.datePanelType,
|
|
206
216
|
monthDatas = _vm.monthDatas,
|
|
207
|
-
datePanelValue = _vm.datePanelValue
|
|
217
|
+
datePanelValue = _vm.datePanelValue,
|
|
218
|
+
multiple = _vm.multiple,
|
|
219
|
+
dateListValue = _vm.dateListValue;
|
|
208
220
|
var matchFormat = 'yyyyMM';
|
|
209
221
|
return [h('table', {
|
|
210
222
|
class: "vxe-input--date-".concat(datePanelType, "-view"),
|
|
@@ -222,7 +234,9 @@ function renderDateMonthTable(h, _vm) {
|
|
|
222
234
|
'is--now': item.isNow,
|
|
223
235
|
'is--next': item.isNext,
|
|
224
236
|
'is--disabled': isDateDisabled(_vm, item),
|
|
225
|
-
'is--selected':
|
|
237
|
+
'is--selected': multiple ? dateListValue.some(function (val) {
|
|
238
|
+
return _xeUtils.default.isDateSame(val, item.date, matchFormat);
|
|
239
|
+
}) : _xeUtils.default.isDateSame(dateValue, item.date, matchFormat),
|
|
226
240
|
'is--hover': _xeUtils.default.isDateSame(datePanelValue, item.date, matchFormat)
|
|
227
241
|
},
|
|
228
242
|
on: {
|
|
@@ -242,7 +256,9 @@ function renderDateQuarterTable(h, _vm) {
|
|
|
242
256
|
var dateValue = _vm.dateValue,
|
|
243
257
|
datePanelType = _vm.datePanelType,
|
|
244
258
|
quarterDatas = _vm.quarterDatas,
|
|
245
|
-
datePanelValue = _vm.datePanelValue
|
|
259
|
+
datePanelValue = _vm.datePanelValue,
|
|
260
|
+
multiple = _vm.multiple,
|
|
261
|
+
dateListValue = _vm.dateListValue;
|
|
246
262
|
var matchFormat = 'yyyyq';
|
|
247
263
|
return [h('table', {
|
|
248
264
|
class: "vxe-input--date-".concat(datePanelType, "-view"),
|
|
@@ -260,7 +276,9 @@ function renderDateQuarterTable(h, _vm) {
|
|
|
260
276
|
'is--now': item.isNow,
|
|
261
277
|
'is--next': item.isNext,
|
|
262
278
|
'is--disabled': isDateDisabled(_vm, item),
|
|
263
|
-
'is--selected':
|
|
279
|
+
'is--selected': multiple ? dateListValue.some(function (val) {
|
|
280
|
+
return _xeUtils.default.isDateSame(val, item.date, matchFormat);
|
|
281
|
+
}) : _xeUtils.default.isDateSame(dateValue, item.date, matchFormat),
|
|
264
282
|
'is--hover': _xeUtils.default.isDateSame(datePanelValue, item.date, matchFormat)
|
|
265
283
|
},
|
|
266
284
|
on: {
|
|
@@ -280,7 +298,9 @@ function renderDateYearTable(h, _vm) {
|
|
|
280
298
|
var dateValue = _vm.dateValue,
|
|
281
299
|
datePanelType = _vm.datePanelType,
|
|
282
300
|
yearDatas = _vm.yearDatas,
|
|
283
|
-
datePanelValue = _vm.datePanelValue
|
|
301
|
+
datePanelValue = _vm.datePanelValue,
|
|
302
|
+
multiple = _vm.multiple,
|
|
303
|
+
dateListValue = _vm.dateListValue;
|
|
284
304
|
var matchFormat = 'yyyy';
|
|
285
305
|
return [h('table', {
|
|
286
306
|
class: "vxe-input--date-".concat(datePanelType, "-view"),
|
|
@@ -293,10 +313,14 @@ function renderDateYearTable(h, _vm) {
|
|
|
293
313
|
return h('tr', rows.map(function (item) {
|
|
294
314
|
return h('td', {
|
|
295
315
|
class: {
|
|
296
|
-
'is--
|
|
316
|
+
'is--prev': item.isPrev,
|
|
297
317
|
'is--current': item.isCurrent,
|
|
298
318
|
'is--now': item.isNow,
|
|
299
|
-
'is--
|
|
319
|
+
'is--next': item.isNext,
|
|
320
|
+
'is--disabled': isDateDisabled(item),
|
|
321
|
+
'is--selected': multiple ? dateListValue.some(function (val) {
|
|
322
|
+
return _xeUtils.default.isDateSame(val, item.date, matchFormat);
|
|
323
|
+
}) : _xeUtils.default.isDateSame(dateValue, item.date, matchFormat),
|
|
300
324
|
'is--hover': _xeUtils.default.isDateSame(datePanelValue, item.date, matchFormat)
|
|
301
325
|
},
|
|
302
326
|
on: {
|
|
@@ -336,7 +360,9 @@ function renderDatePanel(h, _vm) {
|
|
|
336
360
|
var datePanelType = _vm.datePanelType,
|
|
337
361
|
selectDatePanelLabel = _vm.selectDatePanelLabel,
|
|
338
362
|
isDisabledPrevDateBtn = _vm.isDisabledPrevDateBtn,
|
|
339
|
-
isDisabledNextDateBtn = _vm.isDisabledNextDateBtn
|
|
363
|
+
isDisabledNextDateBtn = _vm.isDisabledNextDateBtn,
|
|
364
|
+
multiple = _vm.multiple,
|
|
365
|
+
supportMultiples = _vm.supportMultiples;
|
|
340
366
|
return [h('div', {
|
|
341
367
|
class: 'vxe-input--date-picker-header'
|
|
342
368
|
}, [h('div', {
|
|
@@ -375,7 +401,17 @@ function renderDatePanel(h, _vm) {
|
|
|
375
401
|
}
|
|
376
402
|
}, [h('i', {
|
|
377
403
|
class: 'vxe-icon--caret-right'
|
|
378
|
-
})])
|
|
404
|
+
})]), multiple && supportMultiples ? h('span', {
|
|
405
|
+
class: 'vxe-input--date-picker-btn vxe-input--date-picker-confirm-btn'
|
|
406
|
+
}, [h('button', {
|
|
407
|
+
class: 'vxe-input--date-picker-confirm',
|
|
408
|
+
attrs: {
|
|
409
|
+
type: 'button'
|
|
410
|
+
},
|
|
411
|
+
on: {
|
|
412
|
+
click: _vm.dateConfirmEvent
|
|
413
|
+
}
|
|
414
|
+
}, _conf.default.i18n('vxe.button.confirm'))]) : null])]), h('div', {
|
|
379
415
|
class: 'vxe-input--date-picker-body'
|
|
380
416
|
}, renderDateTable(h, _vm))];
|
|
381
417
|
}
|
|
@@ -672,6 +708,7 @@ var _default2 = {
|
|
|
672
708
|
return _conf.default.input.size || _conf.default.size;
|
|
673
709
|
}
|
|
674
710
|
},
|
|
711
|
+
multiple: Boolean,
|
|
675
712
|
// number、integer、float
|
|
676
713
|
min: {
|
|
677
714
|
type: [String, Number],
|
|
@@ -792,9 +829,9 @@ var _default2 = {
|
|
|
792
829
|
return ['number', 'integer', 'float'].indexOf(this.type) > -1;
|
|
793
830
|
},
|
|
794
831
|
isDatePickerType: function isDatePickerType() {
|
|
795
|
-
return this.
|
|
832
|
+
return this.isDateTimeType || ['date', 'week', 'month', 'quarter', 'year'].indexOf(this.type) > -1;
|
|
796
833
|
},
|
|
797
|
-
|
|
834
|
+
isDateTimeType: function isDateTimeType() {
|
|
798
835
|
var type = this.type;
|
|
799
836
|
return type === 'time' || type === 'datetime';
|
|
800
837
|
},
|
|
@@ -848,6 +885,45 @@ var _default2 = {
|
|
|
848
885
|
dateMaxTime: function dateMaxTime() {
|
|
849
886
|
return this.maxDate ? _xeUtils.default.toStringDate(this.maxDate) : null;
|
|
850
887
|
},
|
|
888
|
+
supportMultiples: function supportMultiples() {
|
|
889
|
+
return ['date', 'week', 'month', 'quarter', 'year'].includes(this.type);
|
|
890
|
+
},
|
|
891
|
+
dateListValue: function dateListValue() {
|
|
892
|
+
var _this = this;
|
|
893
|
+
|
|
894
|
+
var value = this.value,
|
|
895
|
+
multiple = this.multiple,
|
|
896
|
+
isDatePickerType = this.isDatePickerType,
|
|
897
|
+
dateValueFormat = this.dateValueFormat;
|
|
898
|
+
|
|
899
|
+
if (multiple && value && isDatePickerType) {
|
|
900
|
+
return _xeUtils.default.toValueString(value).split(',').map(function (item) {
|
|
901
|
+
var date = _this.parseDate(item, dateValueFormat);
|
|
902
|
+
|
|
903
|
+
if (_xeUtils.default.isValidDate(date)) {
|
|
904
|
+
return date;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
return null;
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
return [];
|
|
912
|
+
},
|
|
913
|
+
dateMultipleValue: function dateMultipleValue() {
|
|
914
|
+
var dateListValue = this.dateListValue,
|
|
915
|
+
dateValueFormat = this.dateValueFormat;
|
|
916
|
+
return dateListValue.map(function (date) {
|
|
917
|
+
return _xeUtils.default.toDateString(date, dateValueFormat);
|
|
918
|
+
});
|
|
919
|
+
},
|
|
920
|
+
dateMultipleLabel: function dateMultipleLabel() {
|
|
921
|
+
var dateListValue = this.dateListValue,
|
|
922
|
+
dateLabelFormat = this.dateLabelFormat;
|
|
923
|
+
return dateListValue.map(function (date) {
|
|
924
|
+
return _xeUtils.default.toDateString(date, dateLabelFormat);
|
|
925
|
+
}).join(', ');
|
|
926
|
+
},
|
|
851
927
|
dateValue: function dateValue() {
|
|
852
928
|
var value = this.value,
|
|
853
929
|
isDatePickerType = this.isDatePickerType,
|
|
@@ -875,7 +951,7 @@ var _default2 = {
|
|
|
875
951
|
},
|
|
876
952
|
hmsTime: function hmsTime() {
|
|
877
953
|
var dateValue = this.dateValue;
|
|
878
|
-
return dateValue && this.
|
|
954
|
+
return dateValue && this.isDateTimeType ? (dateValue.getHours() * 3600 + dateValue.getMinutes() * 60 + dateValue.getSeconds()) * 1000 : 0;
|
|
879
955
|
},
|
|
880
956
|
dateLabelFormat: function dateLabelFormat() {
|
|
881
957
|
if (this.isDatePickerType) {
|
|
@@ -967,16 +1043,19 @@ var _default2 = {
|
|
|
967
1043
|
|
|
968
1044
|
if (selectMonth && currentDate) {
|
|
969
1045
|
var currFullYear = currentDate.getFullYear();
|
|
970
|
-
var
|
|
1046
|
+
var selectFullYear = selectMonth.getFullYear();
|
|
1047
|
+
var startYearDate = new Date(selectFullYear - selectFullYear % yearSize, 0, 1);
|
|
971
1048
|
|
|
972
|
-
for (var index = -
|
|
973
|
-
var date = _xeUtils.default.getWhatYear(
|
|
1049
|
+
for (var index = -4; index < yearSize + 4; index++) {
|
|
1050
|
+
var date = _xeUtils.default.getWhatYear(startYearDate, index, 'first');
|
|
974
1051
|
|
|
975
1052
|
var itemFullYear = date.getFullYear();
|
|
976
1053
|
months.push({
|
|
977
1054
|
date: date,
|
|
978
1055
|
isCurrent: true,
|
|
1056
|
+
isPrev: index < 0,
|
|
979
1057
|
isNow: currFullYear === itemFullYear,
|
|
1058
|
+
isNext: index >= yearSize,
|
|
980
1059
|
year: itemFullYear
|
|
981
1060
|
});
|
|
982
1061
|
}
|
|
@@ -1115,7 +1194,7 @@ var _default2 = {
|
|
|
1115
1194
|
hourList: function hourList() {
|
|
1116
1195
|
var list = [];
|
|
1117
1196
|
|
|
1118
|
-
if (this.
|
|
1197
|
+
if (this.isDateTimeType) {
|
|
1119
1198
|
for (var index = 0; index < 24; index++) {
|
|
1120
1199
|
list.push({
|
|
1121
1200
|
value: index,
|
|
@@ -1129,7 +1208,7 @@ var _default2 = {
|
|
|
1129
1208
|
minuteList: function minuteList() {
|
|
1130
1209
|
var list = [];
|
|
1131
1210
|
|
|
1132
|
-
if (this.
|
|
1211
|
+
if (this.isDateTimeType) {
|
|
1133
1212
|
for (var index = 0; index < 60; index++) {
|
|
1134
1213
|
list.push({
|
|
1135
1214
|
value: index,
|
|
@@ -1179,8 +1258,9 @@ var _default2 = {
|
|
|
1179
1258
|
inpReadonly: function inpReadonly() {
|
|
1180
1259
|
var type = this.type,
|
|
1181
1260
|
readonly = this.readonly,
|
|
1182
|
-
editable = this.editable
|
|
1183
|
-
|
|
1261
|
+
editable = this.editable,
|
|
1262
|
+
multiple = this.multiple;
|
|
1263
|
+
return readonly || multiple || !editable || type === 'week' || type === 'quarter';
|
|
1184
1264
|
}
|
|
1185
1265
|
},
|
|
1186
1266
|
watch: {
|
|
@@ -1204,7 +1284,7 @@ var _default2 = {
|
|
|
1204
1284
|
dateLabelFormat: function dateLabelFormat() {
|
|
1205
1285
|
if (this.isDatePickerType) {
|
|
1206
1286
|
this.dateParseValue(this.datePanelValue);
|
|
1207
|
-
this.inputValue = this.datePanelLabel;
|
|
1287
|
+
this.inputValue = this.multiple ? this.dateMultipleLabel : this.datePanelLabel;
|
|
1208
1288
|
}
|
|
1209
1289
|
}
|
|
1210
1290
|
},
|
|
@@ -1545,7 +1625,7 @@ var _default2 = {
|
|
|
1545
1625
|
changeValue: function changeValue() {
|
|
1546
1626
|
if (this.isDatePickerType) {
|
|
1547
1627
|
this.dateParseValue(this.inputValue);
|
|
1548
|
-
this.inputValue = this.datePanelLabel;
|
|
1628
|
+
this.inputValue = this.multiple ? this.dateMultipleLabel : this.datePanelLabel;
|
|
1549
1629
|
}
|
|
1550
1630
|
},
|
|
1551
1631
|
afterCheckValue: function afterCheckValue() {
|
|
@@ -1669,21 +1749,21 @@ var _default2 = {
|
|
|
1669
1749
|
clearTimeout(this.downbumTimeout);
|
|
1670
1750
|
},
|
|
1671
1751
|
numberDownPrevEvent: function numberDownPrevEvent(evnt) {
|
|
1672
|
-
var
|
|
1752
|
+
var _this2 = this;
|
|
1673
1753
|
|
|
1674
1754
|
this.downbumTimeout = setTimeout(function () {
|
|
1675
|
-
|
|
1755
|
+
_this2.numberPrevEvent(evnt);
|
|
1676
1756
|
|
|
1677
|
-
|
|
1757
|
+
_this2.numberDownPrevEvent(evnt);
|
|
1678
1758
|
}, 60);
|
|
1679
1759
|
},
|
|
1680
1760
|
numberDownNextEvent: function numberDownNextEvent(evnt) {
|
|
1681
|
-
var
|
|
1761
|
+
var _this3 = this;
|
|
1682
1762
|
|
|
1683
1763
|
this.downbumTimeout = setTimeout(function () {
|
|
1684
|
-
|
|
1764
|
+
_this3.numberNextEvent(evnt);
|
|
1685
1765
|
|
|
1686
|
-
|
|
1766
|
+
_this3.numberDownNextEvent(evnt);
|
|
1687
1767
|
}, 60);
|
|
1688
1768
|
},
|
|
1689
1769
|
numberKeydownEvent: function numberKeydownEvent(evnt) {
|
|
@@ -1702,7 +1782,7 @@ var _default2 = {
|
|
|
1702
1782
|
}
|
|
1703
1783
|
},
|
|
1704
1784
|
numberMousedownEvent: function numberMousedownEvent(evnt) {
|
|
1705
|
-
var
|
|
1785
|
+
var _this4 = this;
|
|
1706
1786
|
|
|
1707
1787
|
this.numberStopDown();
|
|
1708
1788
|
|
|
@@ -1717,9 +1797,9 @@ var _default2 = {
|
|
|
1717
1797
|
|
|
1718
1798
|
this.downbumTimeout = setTimeout(function () {
|
|
1719
1799
|
if (isPrevNumber) {
|
|
1720
|
-
|
|
1800
|
+
_this4.numberDownPrevEvent(evnt);
|
|
1721
1801
|
} else {
|
|
1722
|
-
|
|
1802
|
+
_this4.numberDownNextEvent(evnt);
|
|
1723
1803
|
}
|
|
1724
1804
|
}, 500);
|
|
1725
1805
|
}
|
|
@@ -1832,8 +1912,12 @@ var _default2 = {
|
|
|
1832
1912
|
},
|
|
1833
1913
|
dateTodayMonthEvent: function dateTodayMonthEvent(evnt) {
|
|
1834
1914
|
this.dateNowHandle();
|
|
1835
|
-
|
|
1836
|
-
this.
|
|
1915
|
+
|
|
1916
|
+
if (!this.multiple) {
|
|
1917
|
+
this.dateChange(this.currentDate);
|
|
1918
|
+
this.hidePanel();
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1837
1921
|
this.$emit('date-today', {
|
|
1838
1922
|
type: this.type,
|
|
1839
1923
|
$event: evnt
|
|
@@ -1876,7 +1960,8 @@ var _default2 = {
|
|
|
1876
1960
|
},
|
|
1877
1961
|
dateSelectItem: function dateSelectItem(date) {
|
|
1878
1962
|
var type = this.type,
|
|
1879
|
-
datePanelType = this.datePanelType
|
|
1963
|
+
datePanelType = this.datePanelType,
|
|
1964
|
+
multiple = this.multiple;
|
|
1880
1965
|
var isWeekType = type === 'week';
|
|
1881
1966
|
|
|
1882
1967
|
if (type === 'month') {
|
|
@@ -1885,18 +1970,27 @@ var _default2 = {
|
|
|
1885
1970
|
this.dateCheckMonth(date);
|
|
1886
1971
|
} else {
|
|
1887
1972
|
this.dateChange(date);
|
|
1888
|
-
|
|
1973
|
+
|
|
1974
|
+
if (!multiple) {
|
|
1975
|
+
this.hidePanel();
|
|
1976
|
+
}
|
|
1889
1977
|
}
|
|
1890
1978
|
} else if (type === 'year') {
|
|
1891
|
-
this.hidePanel();
|
|
1892
1979
|
this.dateChange(date);
|
|
1980
|
+
|
|
1981
|
+
if (!multiple) {
|
|
1982
|
+
this.hidePanel();
|
|
1983
|
+
}
|
|
1893
1984
|
} else if (type === 'quarter') {
|
|
1894
1985
|
if (datePanelType === 'year') {
|
|
1895
1986
|
this.datePanelType = 'quarter';
|
|
1896
1987
|
this.dateCheckMonth(date);
|
|
1897
1988
|
} else {
|
|
1898
1989
|
this.dateChange(date);
|
|
1899
|
-
|
|
1990
|
+
|
|
1991
|
+
if (!multiple) {
|
|
1992
|
+
this.hidePanel();
|
|
1993
|
+
}
|
|
1900
1994
|
}
|
|
1901
1995
|
} else {
|
|
1902
1996
|
if (datePanelType === 'month') {
|
|
@@ -1907,7 +2001,10 @@ var _default2 = {
|
|
|
1907
2001
|
this.dateCheckMonth(date);
|
|
1908
2002
|
} else {
|
|
1909
2003
|
this.dateChange(date);
|
|
1910
|
-
|
|
2004
|
+
|
|
2005
|
+
if (!multiple) {
|
|
2006
|
+
this.hidePanel();
|
|
2007
|
+
}
|
|
1911
2008
|
}
|
|
1912
2009
|
}
|
|
1913
2010
|
|
|
@@ -2138,13 +2235,15 @@ var _default2 = {
|
|
|
2138
2235
|
var value = this.value,
|
|
2139
2236
|
datetimePanelValue = this.datetimePanelValue,
|
|
2140
2237
|
dateValueFormat = this.dateValueFormat,
|
|
2141
|
-
firstDayOfWeek = this.firstDayOfWeek
|
|
2238
|
+
firstDayOfWeek = this.firstDayOfWeek,
|
|
2239
|
+
isDateTimeType = this.isDateTimeType,
|
|
2240
|
+
multiple = this.multiple;
|
|
2142
2241
|
|
|
2143
2242
|
if (this.type === 'week') {
|
|
2144
2243
|
var sWeek = _xeUtils.default.toNumber(this.selectDay);
|
|
2145
2244
|
|
|
2146
2245
|
date = _xeUtils.default.getWhatWeek(date, 0, sWeek, firstDayOfWeek);
|
|
2147
|
-
} else if (
|
|
2246
|
+
} else if (isDateTimeType) {
|
|
2148
2247
|
date.setHours(datetimePanelValue.getHours());
|
|
2149
2248
|
date.setMinutes(datetimePanelValue.getMinutes());
|
|
2150
2249
|
date.setSeconds(datetimePanelValue.getSeconds());
|
|
@@ -2156,10 +2255,51 @@ var _default2 = {
|
|
|
2156
2255
|
|
|
2157
2256
|
this.dateCheckMonth(date);
|
|
2158
2257
|
|
|
2159
|
-
if (
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2258
|
+
if (multiple) {
|
|
2259
|
+
// 如果为多选
|
|
2260
|
+
var dateMultipleValue = this.dateMultipleValue;
|
|
2261
|
+
|
|
2262
|
+
if (isDateTimeType) {
|
|
2263
|
+
// 如果是datetime特殊类型
|
|
2264
|
+
var dateListValue = this.dateListValue;
|
|
2265
|
+
var datetimeRest = [];
|
|
2266
|
+
dateListValue.forEach(function (item) {
|
|
2267
|
+
if (item && !_xeUtils.default.isDateSame(date, item, 'yyyyMMdd')) {
|
|
2268
|
+
item.setHours(datetimePanelValue.getHours());
|
|
2269
|
+
item.setMinutes(datetimePanelValue.getMinutes());
|
|
2270
|
+
item.setSeconds(datetimePanelValue.getSeconds());
|
|
2271
|
+
datetimeRest.push(item);
|
|
2272
|
+
}
|
|
2273
|
+
});
|
|
2274
|
+
datetimeRest.push(date);
|
|
2275
|
+
this.emitModel(datetimeRest.map(function (date) {
|
|
2276
|
+
return _xeUtils.default.toDateString(date, dateValueFormat);
|
|
2277
|
+
}).join(','), {
|
|
2278
|
+
type: 'update'
|
|
2279
|
+
});
|
|
2280
|
+
} else {
|
|
2281
|
+
// 如果是日期类型
|
|
2282
|
+
if (dateMultipleValue.some(function (val) {
|
|
2283
|
+
return _xeUtils.default.isEqual(val, inpVal);
|
|
2284
|
+
})) {
|
|
2285
|
+
this.emitModel(dateMultipleValue.filter(function (val) {
|
|
2286
|
+
return !_xeUtils.default.isEqual(val, inpVal);
|
|
2287
|
+
}).join(','), {
|
|
2288
|
+
type: 'update'
|
|
2289
|
+
});
|
|
2290
|
+
} else {
|
|
2291
|
+
this.emitModel(dateMultipleValue.concat([inpVal]).join(','), {
|
|
2292
|
+
type: 'update'
|
|
2293
|
+
});
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
} else {
|
|
2297
|
+
// 如果为单选
|
|
2298
|
+
if (!_xeUtils.default.isEqual(value, inpVal)) {
|
|
2299
|
+
this.emitModel(inpVal, {
|
|
2300
|
+
type: 'update'
|
|
2301
|
+
});
|
|
2302
|
+
}
|
|
2163
2303
|
}
|
|
2164
2304
|
},
|
|
2165
2305
|
dateCheckMonth: function dateCheckMonth(date) {
|
|
@@ -2170,7 +2310,7 @@ var _default2 = {
|
|
|
2170
2310
|
}
|
|
2171
2311
|
},
|
|
2172
2312
|
dateOpenPanel: function dateOpenPanel() {
|
|
2173
|
-
var
|
|
2313
|
+
var _this5 = this;
|
|
2174
2314
|
|
|
2175
2315
|
var type = this.type,
|
|
2176
2316
|
dateValue = this.dateValue;
|
|
@@ -2190,15 +2330,15 @@ var _default2 = {
|
|
|
2190
2330
|
this.dateNowHandle();
|
|
2191
2331
|
}
|
|
2192
2332
|
|
|
2193
|
-
if (this.
|
|
2333
|
+
if (this.isDateTimeType) {
|
|
2194
2334
|
this.datetimePanelValue = this.datePanelValue || _xeUtils.default.getWhatDay(Date.now(), 0, 'first');
|
|
2195
2335
|
this.$nextTick(function () {
|
|
2196
|
-
_xeUtils.default.arrayEach(
|
|
2336
|
+
_xeUtils.default.arrayEach(_this5.$refs.timeBody.querySelectorAll('li.is--selected'), _this5.updateTimePos);
|
|
2197
2337
|
});
|
|
2198
2338
|
}
|
|
2199
2339
|
},
|
|
2200
2340
|
dateRevert: function dateRevert() {
|
|
2201
|
-
this.inputValue = this.datePanelLabel;
|
|
2341
|
+
this.inputValue = this.multiple ? this.dateMultipleLabel : this.datePanelLabel;
|
|
2202
2342
|
},
|
|
2203
2343
|
// 日期
|
|
2204
2344
|
// 弹出面板
|
|
@@ -2208,7 +2348,7 @@ var _default2 = {
|
|
|
2208
2348
|
}
|
|
2209
2349
|
},
|
|
2210
2350
|
showPanel: function showPanel() {
|
|
2211
|
-
var
|
|
2351
|
+
var _this6 = this;
|
|
2212
2352
|
|
|
2213
2353
|
var disabled = this.disabled,
|
|
2214
2354
|
visiblePanel = this.visiblePanel,
|
|
@@ -2224,28 +2364,33 @@ var _default2 = {
|
|
|
2224
2364
|
}
|
|
2225
2365
|
|
|
2226
2366
|
setTimeout(function () {
|
|
2227
|
-
|
|
2367
|
+
_this6.visiblePanel = true;
|
|
2228
2368
|
}, 10);
|
|
2229
2369
|
this.updateZindex();
|
|
2230
|
-
this.updatePlacement();
|
|
2370
|
+
return this.updatePlacement();
|
|
2231
2371
|
}
|
|
2372
|
+
|
|
2373
|
+
return this.$nextTick();
|
|
2232
2374
|
},
|
|
2233
2375
|
hidePanel: function hidePanel() {
|
|
2234
|
-
var
|
|
2376
|
+
var _this7 = this;
|
|
2235
2377
|
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2378
|
+
return new Promise(function (resolve) {
|
|
2379
|
+
_this7.visiblePanel = false;
|
|
2380
|
+
_this7.hidePanelTimeout = setTimeout(function () {
|
|
2381
|
+
_this7.animatVisible = false;
|
|
2382
|
+
resolve();
|
|
2383
|
+
}, 350);
|
|
2384
|
+
});
|
|
2240
2385
|
},
|
|
2241
2386
|
updatePlacement: function updatePlacement() {
|
|
2242
|
-
var
|
|
2387
|
+
var _this8 = this;
|
|
2243
2388
|
|
|
2244
2389
|
return this.$nextTick().then(function () {
|
|
2245
|
-
var $refs =
|
|
2246
|
-
transfer =
|
|
2247
|
-
placement =
|
|
2248
|
-
panelIndex =
|
|
2390
|
+
var $refs = _this8.$refs,
|
|
2391
|
+
transfer = _this8.transfer,
|
|
2392
|
+
placement = _this8.placement,
|
|
2393
|
+
panelIndex = _this8.panelIndex;
|
|
2249
2394
|
var targetElem = $refs.input;
|
|
2250
2395
|
var panelElem = $refs.panel;
|
|
2251
2396
|
|
|
@@ -2319,9 +2464,9 @@ var _default2 = {
|
|
|
2319
2464
|
}
|
|
2320
2465
|
}
|
|
2321
2466
|
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
return
|
|
2467
|
+
_this8.panelStyle = panelStyle;
|
|
2468
|
+
_this8.panelPlacement = panelPlacement;
|
|
2469
|
+
return _this8.$nextTick();
|
|
2325
2470
|
}
|
|
2326
2471
|
});
|
|
2327
2472
|
},
|