vxe-table 4.1.17-beta.1 → 4.1.17-beta.2
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/input/src/input.js +30 -9
- package/lib/index.umd.js +40 -10
- package/lib/index.umd.min.js +1 -1
- package/lib/input/src/input.js +41 -12
- package/lib/input/src/input.min.js +1 -1
- package/package.json +3 -3
- package/packages/input/src/input.ts +32 -10
- package/types/input.d.ts +2 -2
package/es/input/src/input.js
CHANGED
|
@@ -283,12 +283,15 @@ export default defineComponent({
|
|
|
283
283
|
}
|
|
284
284
|
return '';
|
|
285
285
|
});
|
|
286
|
+
var computeFirstDayOfWeek = computed(function () {
|
|
287
|
+
var startDay = props.startDay, startWeek = props.startWeek;
|
|
288
|
+
return XEUtils.toNumber(XEUtils.isNumber(startDay) || XEUtils.isString(startDay) ? startDay : startWeek);
|
|
289
|
+
});
|
|
286
290
|
var computeWeekDatas = computed(function () {
|
|
287
291
|
var weeks = [];
|
|
288
292
|
var isDatePickerType = computeIsDatePickerType.value;
|
|
289
293
|
if (isDatePickerType) {
|
|
290
|
-
var
|
|
291
|
-
var sWeek = XEUtils.toNumber(XEUtils.isNumber(startDay) || XEUtils.isString(startDay) ? startDay : startWeek);
|
|
294
|
+
var sWeek = computeFirstDayOfWeek.value;
|
|
292
295
|
weeks.push(sWeek);
|
|
293
296
|
for (var index = 0; index < 6; index++) {
|
|
294
297
|
if (sWeek >= 6) {
|
|
@@ -435,6 +438,7 @@ export default defineComponent({
|
|
|
435
438
|
});
|
|
436
439
|
var computeWeekDates = computed(function () {
|
|
437
440
|
var dayDatas = computeDayDatas.value;
|
|
441
|
+
var firstDayOfWeek = computeFirstDayOfWeek.value;
|
|
438
442
|
return dayDatas.map(function (list) {
|
|
439
443
|
var firstItem = list[0];
|
|
440
444
|
var item = {
|
|
@@ -444,7 +448,7 @@ export default defineComponent({
|
|
|
444
448
|
isCurrent: false,
|
|
445
449
|
isNow: false,
|
|
446
450
|
isNext: false,
|
|
447
|
-
label: XEUtils.getYearWeek(firstItem.date)
|
|
451
|
+
label: XEUtils.getYearWeek(firstItem.date, firstDayOfWeek)
|
|
448
452
|
};
|
|
449
453
|
return [item].concat(list);
|
|
450
454
|
});
|
|
@@ -610,6 +614,7 @@ export default defineComponent({
|
|
|
610
614
|
var type = props.type;
|
|
611
615
|
var valueFormat = props.valueFormat;
|
|
612
616
|
var dateLabelFormat = computeDateLabelFormat.value;
|
|
617
|
+
var firstDayOfWeek = computeFirstDayOfWeek.value;
|
|
613
618
|
var dValue = null;
|
|
614
619
|
var dLabel = '';
|
|
615
620
|
if (value) {
|
|
@@ -621,7 +626,20 @@ export default defineComponent({
|
|
|
621
626
|
}
|
|
622
627
|
}
|
|
623
628
|
if (XEUtils.isValidDate(dValue)) {
|
|
624
|
-
dLabel = XEUtils.toDateString(dValue, dateLabelFormat);
|
|
629
|
+
dLabel = XEUtils.toDateString(dValue, dateLabelFormat, { firstDay: firstDayOfWeek });
|
|
630
|
+
// 由于年份和第几周是冲突的行为,所以需要特殊处理,判断是否跨年
|
|
631
|
+
if (dateLabelFormat && type === 'week') {
|
|
632
|
+
var firstWeekDate = XEUtils.getWhatWeek(dValue, 0, firstDayOfWeek, firstDayOfWeek);
|
|
633
|
+
if (firstWeekDate.getFullYear() < dValue.getFullYear()) {
|
|
634
|
+
var yyIndex = dateLabelFormat.indexOf('yyyy');
|
|
635
|
+
if (yyIndex > -1) {
|
|
636
|
+
var yyNum = Number(dLabel.substring(yyIndex, yyIndex + 4));
|
|
637
|
+
if (yyNum && !isNaN(yyNum)) {
|
|
638
|
+
dLabel = dLabel.replace("" + yyNum, "" + (yyNum - 1));
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
625
643
|
}
|
|
626
644
|
else {
|
|
627
645
|
dValue = null;
|
|
@@ -680,16 +698,17 @@ export default defineComponent({
|
|
|
680
698
|
var datetimePanelValue = reactData.datetimePanelValue;
|
|
681
699
|
var isDateTimeType = computeIsDateTimeType.value;
|
|
682
700
|
var dateValueFormat = computeDateValueFormat.value;
|
|
701
|
+
var firstDayOfWeek = computeFirstDayOfWeek.value;
|
|
683
702
|
if (props.type === 'week') {
|
|
684
703
|
var sWeek = XEUtils.toNumber(props.selectDay);
|
|
685
|
-
date = XEUtils.getWhatWeek(date, 0, sWeek);
|
|
704
|
+
date = XEUtils.getWhatWeek(date, 0, sWeek, firstDayOfWeek);
|
|
686
705
|
}
|
|
687
706
|
else if (isDateTimeType) {
|
|
688
707
|
date.setHours(datetimePanelValue.getHours());
|
|
689
708
|
date.setMinutes(datetimePanelValue.getMinutes());
|
|
690
709
|
date.setSeconds(datetimePanelValue.getSeconds());
|
|
691
710
|
}
|
|
692
|
-
var inpVal = XEUtils.toDateString(date, dateValueFormat);
|
|
711
|
+
var inpVal = XEUtils.toDateString(date, dateValueFormat, { firstDay: firstDayOfWeek });
|
|
693
712
|
dateCheckMonth(date);
|
|
694
713
|
if (!XEUtils.isEqual(modelValue, inpVal)) {
|
|
695
714
|
emitModel(inpVal, { type: 'update' });
|
|
@@ -740,6 +759,7 @@ export default defineComponent({
|
|
|
740
759
|
}
|
|
741
760
|
else {
|
|
742
761
|
var isChange = false;
|
|
762
|
+
var firstDayOfWeek = computeFirstDayOfWeek.value;
|
|
743
763
|
if (type === 'datetime') {
|
|
744
764
|
var dateValue = computeDateValue.value;
|
|
745
765
|
if (inputValue !== XEUtils.toDateString(dateValue, dateLabelFormat) || inputValue !== XEUtils.toDateString(inpDateVal, dateLabelFormat)) {
|
|
@@ -752,7 +772,7 @@ export default defineComponent({
|
|
|
752
772
|
else {
|
|
753
773
|
isChange = true;
|
|
754
774
|
}
|
|
755
|
-
reactData.inputValue = XEUtils.toDateString(inpDateVal, dateLabelFormat);
|
|
775
|
+
reactData.inputValue = XEUtils.toDateString(inpDateVal, dateLabelFormat, { firstDay: firstDayOfWeek });
|
|
756
776
|
if (isChange) {
|
|
757
777
|
dateChange(inpDateVal);
|
|
758
778
|
}
|
|
@@ -1192,17 +1212,18 @@ export default defineComponent({
|
|
|
1192
1212
|
}
|
|
1193
1213
|
else {
|
|
1194
1214
|
var offsetDay = datePanelValue || XEUtils.getWhatDay(Date.now(), 0, 'first');
|
|
1215
|
+
var firstDayOfWeek = computeFirstDayOfWeek.value;
|
|
1195
1216
|
if (isLeftArrow) {
|
|
1196
1217
|
offsetDay = XEUtils.getWhatDay(offsetDay, -1);
|
|
1197
1218
|
}
|
|
1198
1219
|
else if (isUpArrow) {
|
|
1199
|
-
offsetDay = XEUtils.getWhatWeek(offsetDay, -1);
|
|
1220
|
+
offsetDay = XEUtils.getWhatWeek(offsetDay, -1, firstDayOfWeek);
|
|
1200
1221
|
}
|
|
1201
1222
|
else if (isRightArrow) {
|
|
1202
1223
|
offsetDay = XEUtils.getWhatDay(offsetDay, 1);
|
|
1203
1224
|
}
|
|
1204
1225
|
else if (isDwArrow) {
|
|
1205
|
-
offsetDay = XEUtils.getWhatWeek(offsetDay, 1);
|
|
1226
|
+
offsetDay = XEUtils.getWhatWeek(offsetDay, 1, firstDayOfWeek);
|
|
1206
1227
|
}
|
|
1207
1228
|
dateMoveDay(offsetDay);
|
|
1208
1229
|
}
|
package/lib/index.umd.js
CHANGED
|
@@ -15176,14 +15176,17 @@ function toStringTimeDate(str) {
|
|
|
15176
15176
|
|
|
15177
15177
|
return '';
|
|
15178
15178
|
});
|
|
15179
|
+
var computeFirstDayOfWeek = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(function () {
|
|
15180
|
+
var startDay = props.startDay,
|
|
15181
|
+
startWeek = props.startWeek;
|
|
15182
|
+
return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toNumber(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isNumber(startDay) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isString(startDay) ? startDay : startWeek);
|
|
15183
|
+
});
|
|
15179
15184
|
var computeWeekDatas = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(function () {
|
|
15180
15185
|
var weeks = [];
|
|
15181
15186
|
var isDatePickerType = computeIsDatePickerType.value;
|
|
15182
15187
|
|
|
15183
15188
|
if (isDatePickerType) {
|
|
15184
|
-
var
|
|
15185
|
-
startWeek = props.startWeek;
|
|
15186
|
-
var sWeek = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toNumber(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isNumber(startDay) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isString(startDay) ? startDay : startWeek);
|
|
15189
|
+
var sWeek = computeFirstDayOfWeek.value;
|
|
15187
15190
|
weeks.push(sWeek);
|
|
15188
15191
|
|
|
15189
15192
|
for (var index = 0; index < 6; index++) {
|
|
@@ -15352,6 +15355,7 @@ function toStringTimeDate(str) {
|
|
|
15352
15355
|
});
|
|
15353
15356
|
var computeWeekDates = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(function () {
|
|
15354
15357
|
var dayDatas = computeDayDatas.value;
|
|
15358
|
+
var firstDayOfWeek = computeFirstDayOfWeek.value;
|
|
15355
15359
|
return dayDatas.map(function (list) {
|
|
15356
15360
|
var firstItem = list[0];
|
|
15357
15361
|
var item = {
|
|
@@ -15361,7 +15365,7 @@ function toStringTimeDate(str) {
|
|
|
15361
15365
|
isCurrent: false,
|
|
15362
15366
|
isNow: false,
|
|
15363
15367
|
isNext: false,
|
|
15364
|
-
label: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.getYearWeek(firstItem.date)
|
|
15368
|
+
label: external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.getYearWeek(firstItem.date, firstDayOfWeek)
|
|
15365
15369
|
};
|
|
15366
15370
|
return [item].concat(list);
|
|
15367
15371
|
});
|
|
@@ -15576,6 +15580,7 @@ function toStringTimeDate(str) {
|
|
|
15576
15580
|
var type = props.type;
|
|
15577
15581
|
var valueFormat = props.valueFormat;
|
|
15578
15582
|
var dateLabelFormat = computeDateLabelFormat.value;
|
|
15583
|
+
var firstDayOfWeek = computeFirstDayOfWeek.value;
|
|
15579
15584
|
var dValue = null;
|
|
15580
15585
|
var dLabel = '';
|
|
15581
15586
|
|
|
@@ -15588,7 +15593,25 @@ function toStringTimeDate(str) {
|
|
|
15588
15593
|
}
|
|
15589
15594
|
|
|
15590
15595
|
if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isValidDate(dValue)) {
|
|
15591
|
-
dLabel = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toDateString(dValue, dateLabelFormat
|
|
15596
|
+
dLabel = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toDateString(dValue, dateLabelFormat, {
|
|
15597
|
+
firstDay: firstDayOfWeek
|
|
15598
|
+
}); // 由于年份和第几周是冲突的行为,所以需要特殊处理,判断是否跨年
|
|
15599
|
+
|
|
15600
|
+
if (dateLabelFormat && type === 'week') {
|
|
15601
|
+
var firstWeekDate = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.getWhatWeek(dValue, 0, firstDayOfWeek, firstDayOfWeek);
|
|
15602
|
+
|
|
15603
|
+
if (firstWeekDate.getFullYear() < dValue.getFullYear()) {
|
|
15604
|
+
var yyIndex = dateLabelFormat.indexOf('yyyy');
|
|
15605
|
+
|
|
15606
|
+
if (yyIndex > -1) {
|
|
15607
|
+
var yyNum = Number(dLabel.substring(yyIndex, yyIndex + 4));
|
|
15608
|
+
|
|
15609
|
+
if (yyNum && !isNaN(yyNum)) {
|
|
15610
|
+
dLabel = dLabel.replace("".concat(yyNum), "".concat(yyNum - 1));
|
|
15611
|
+
}
|
|
15612
|
+
}
|
|
15613
|
+
}
|
|
15614
|
+
}
|
|
15592
15615
|
} else {
|
|
15593
15616
|
dValue = null;
|
|
15594
15617
|
}
|
|
@@ -15661,17 +15684,20 @@ function toStringTimeDate(str) {
|
|
|
15661
15684
|
var datetimePanelValue = reactData.datetimePanelValue;
|
|
15662
15685
|
var isDateTimeType = computeIsDateTimeType.value;
|
|
15663
15686
|
var dateValueFormat = computeDateValueFormat.value;
|
|
15687
|
+
var firstDayOfWeek = computeFirstDayOfWeek.value;
|
|
15664
15688
|
|
|
15665
15689
|
if (props.type === 'week') {
|
|
15666
15690
|
var sWeek = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toNumber(props.selectDay);
|
|
15667
|
-
date = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.getWhatWeek(date, 0, sWeek);
|
|
15691
|
+
date = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.getWhatWeek(date, 0, sWeek, firstDayOfWeek);
|
|
15668
15692
|
} else if (isDateTimeType) {
|
|
15669
15693
|
date.setHours(datetimePanelValue.getHours());
|
|
15670
15694
|
date.setMinutes(datetimePanelValue.getMinutes());
|
|
15671
15695
|
date.setSeconds(datetimePanelValue.getSeconds());
|
|
15672
15696
|
}
|
|
15673
15697
|
|
|
15674
|
-
var inpVal = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toDateString(date, dateValueFormat
|
|
15698
|
+
var inpVal = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toDateString(date, dateValueFormat, {
|
|
15699
|
+
firstDay: firstDayOfWeek
|
|
15700
|
+
});
|
|
15675
15701
|
dateCheckMonth(date);
|
|
15676
15702
|
|
|
15677
15703
|
if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.isEqual(modelValue, inpVal)) {
|
|
@@ -15739,6 +15765,7 @@ function toStringTimeDate(str) {
|
|
|
15739
15765
|
reactData.inputValue = inpDateVal;
|
|
15740
15766
|
} else {
|
|
15741
15767
|
var isChange = false;
|
|
15768
|
+
var firstDayOfWeek = computeFirstDayOfWeek.value;
|
|
15742
15769
|
|
|
15743
15770
|
if (type === 'datetime') {
|
|
15744
15771
|
var dateValue = computeDateValue.value;
|
|
@@ -15753,7 +15780,9 @@ function toStringTimeDate(str) {
|
|
|
15753
15780
|
isChange = true;
|
|
15754
15781
|
}
|
|
15755
15782
|
|
|
15756
|
-
reactData.inputValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toDateString(inpDateVal, dateLabelFormat
|
|
15783
|
+
reactData.inputValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.toDateString(inpDateVal, dateLabelFormat, {
|
|
15784
|
+
firstDay: firstDayOfWeek
|
|
15785
|
+
});
|
|
15757
15786
|
|
|
15758
15787
|
if (isChange) {
|
|
15759
15788
|
dateChange(inpDateVal);
|
|
@@ -16281,15 +16310,16 @@ function toStringTimeDate(str) {
|
|
|
16281
16310
|
dateMoveMonth(offsetMonth);
|
|
16282
16311
|
} else {
|
|
16283
16312
|
var offsetDay = datePanelValue || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.getWhatDay(Date.now(), 0, 'first');
|
|
16313
|
+
var firstDayOfWeek = computeFirstDayOfWeek.value;
|
|
16284
16314
|
|
|
16285
16315
|
if (isLeftArrow) {
|
|
16286
16316
|
offsetDay = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.getWhatDay(offsetDay, -1);
|
|
16287
16317
|
} else if (isUpArrow) {
|
|
16288
|
-
offsetDay = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.getWhatWeek(offsetDay, -1);
|
|
16318
|
+
offsetDay = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.getWhatWeek(offsetDay, -1, firstDayOfWeek);
|
|
16289
16319
|
} else if (isRightArrow) {
|
|
16290
16320
|
offsetDay = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.getWhatDay(offsetDay, 1);
|
|
16291
16321
|
} else if (isDwArrow) {
|
|
16292
|
-
offsetDay = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.getWhatWeek(offsetDay, 1);
|
|
16322
|
+
offsetDay = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default.a.getWhatWeek(offsetDay, 1, firstDayOfWeek);
|
|
16293
16323
|
}
|
|
16294
16324
|
|
|
16295
16325
|
dateMoveDay(offsetDay);
|