@blueking/date-picker 2.0.0-beta.27 → 2.0.0-beta.28
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/package.json +1 -1
- package/typings/utils/date.d.ts +1 -0
- package/vue2/index.es.min.js +63 -37
- package/vue2/index.iife.min.js +63 -37
- package/vue2/index.umd.min.js +63 -37
- package/vue3/index.es.min.js +63 -37
- package/vue3/index.iife.min.js +63 -37
- package/vue3/index.umd.min.js +63 -37
package/package.json
CHANGED
package/typings/utils/date.d.ts
CHANGED
|
@@ -46,3 +46,4 @@ export declare class DateRange {
|
|
|
46
46
|
export declare const transformValue2Dayjs: (val: DateValue[number], type?: "end" | "start", timezome?: string) => dayjs.Dayjs | undefined;
|
|
47
47
|
export declare const transformDateRange2Dayjs: (dateValue: DateValue, timezome?: string) => (dayjs.Dayjs | undefined)[];
|
|
48
48
|
export declare const inputVal2Dayjs: (val: string, format: string, defaultDate?: Dayjs) => dayjs.Dayjs;
|
|
49
|
+
export declare function getTimezoneOffset(timezone: string): number;
|
package/vue2/index.es.min.js
CHANGED
|
@@ -23568,6 +23568,11 @@ const inputVal2Dayjs = (val, format, defaultDate) => {
|
|
|
23568
23568
|
}
|
|
23569
23569
|
return date;
|
|
23570
23570
|
};
|
|
23571
|
+
function getTimezoneOffset(timezone) {
|
|
23572
|
+
const localTime = dayjs().tz(timezone);
|
|
23573
|
+
const offset2 = localTime.utcOffset() / 60;
|
|
23574
|
+
return offset2;
|
|
23575
|
+
}
|
|
23571
23576
|
dayjs.extend(utc);
|
|
23572
23577
|
dayjs.extend(tz);
|
|
23573
23578
|
const timezoneData = [
|
|
@@ -25426,6 +25431,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
25426
25431
|
const today = dayjs();
|
|
25427
25432
|
const isValidate = ref(true);
|
|
25428
25433
|
const { validMsg, validateDateValue } = useValidate();
|
|
25434
|
+
const curTimezoneInfo = ref(timezoneInfo.value || dayjs.tz.guess());
|
|
25429
25435
|
watch(
|
|
25430
25436
|
() => props2.value,
|
|
25431
25437
|
(date) => {
|
|
@@ -25439,6 +25445,26 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
25439
25445
|
immediate: true
|
|
25440
25446
|
}
|
|
25441
25447
|
);
|
|
25448
|
+
watch(
|
|
25449
|
+
() => timezoneInfo,
|
|
25450
|
+
(newTimezone) => {
|
|
25451
|
+
if (!timezoneInfo.value) return;
|
|
25452
|
+
if (newTimezone.value.label === curTimezoneInfo.value.label) return;
|
|
25453
|
+
if (newTimezone.value.utc === curTimezoneInfo.value.utc) return;
|
|
25454
|
+
curTimezoneInfo.value = newTimezone.value || dayjs.tz.guess();
|
|
25455
|
+
if (startDate.value) {
|
|
25456
|
+
startDate.value = dayjs.tz(startDate.value, curTimezoneInfo.value.label);
|
|
25457
|
+
startInput.value.value = startDate.value.format(format.value);
|
|
25458
|
+
}
|
|
25459
|
+
if (endDate.value) {
|
|
25460
|
+
endDate.value = dayjs.tz(endDate.value, curTimezoneInfo.value.label);
|
|
25461
|
+
endInput.value.value = endDate.value.format(format.value);
|
|
25462
|
+
}
|
|
25463
|
+
},
|
|
25464
|
+
{
|
|
25465
|
+
deep: true
|
|
25466
|
+
}
|
|
25467
|
+
);
|
|
25442
25468
|
const canConfirm = computed(() => {
|
|
25443
25469
|
if (!startDate.value || !endDate.value) return false;
|
|
25444
25470
|
if (!startDate.value.isValid() || !endDate.value.isValid()) return false;
|
|
@@ -25448,33 +25474,31 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
25448
25474
|
return true;
|
|
25449
25475
|
});
|
|
25450
25476
|
const handleInputEnter = async (_2, type) => {
|
|
25451
|
-
|
|
25452
|
-
|
|
25453
|
-
|
|
25454
|
-
|
|
25455
|
-
|
|
25456
|
-
|
|
25457
|
-
|
|
25458
|
-
|
|
25459
|
-
|
|
25460
|
-
|
|
25461
|
-
|
|
25462
|
-
|
|
25463
|
-
|
|
25464
|
-
|
|
25465
|
-
|
|
25466
|
-
if (
|
|
25467
|
-
|
|
25468
|
-
|
|
25469
|
-
|
|
25470
|
-
|
|
25471
|
-
|
|
25472
|
-
handleEndTimeChange(!endDate.value ? date.endOf("d") : date);
|
|
25473
|
-
}
|
|
25477
|
+
var _a, _b, _c;
|
|
25478
|
+
const target = type === "start" ? startInput.value : endInput.value;
|
|
25479
|
+
const val = (_a = target == null ? void 0 : target.value) == null ? void 0 : _a.toString().trim();
|
|
25480
|
+
const editDate = type === "start" ? startDate.value : endDate.value;
|
|
25481
|
+
const curNow = type === "start" ? isStartNow : isEndNow;
|
|
25482
|
+
const otherNow = type === "start" ? isEndNow : isStartNow;
|
|
25483
|
+
const formatValue = editDate == null ? void 0 : editDate.format(format.value);
|
|
25484
|
+
if (val === formatValue) return;
|
|
25485
|
+
if (!val || val === NowConstant && curNow.value) return;
|
|
25486
|
+
if (val === NowConstant && !curNow.value && !otherNow.value) {
|
|
25487
|
+
handleIsNowChange(type);
|
|
25488
|
+
return;
|
|
25489
|
+
}
|
|
25490
|
+
let date = inputVal2Dayjs(val, format.value, editDate);
|
|
25491
|
+
if (date.isValid()) {
|
|
25492
|
+
if (!(editDate == null ? void 0 : editDate.isSame(date))) {
|
|
25493
|
+
curNow.value = val === NowConstant;
|
|
25494
|
+
if (type === "start") {
|
|
25495
|
+
handleStartTimeChange(!startDate.value ? date.startOf("d") : date);
|
|
25496
|
+
} else {
|
|
25497
|
+
handleEndTimeChange(!endDate.value ? date.endOf("d") : date);
|
|
25474
25498
|
}
|
|
25475
25499
|
}
|
|
25476
|
-
|
|
25477
|
-
|
|
25500
|
+
}
|
|
25501
|
+
target.value = type === "start" ? ((_b = startDate.value) == null ? void 0 : _b.format(format.value)) || "" : ((_c = endDate.value) == null ? void 0 : _c.format(format.value)) || "";
|
|
25478
25502
|
};
|
|
25479
25503
|
const handleFocusStart = () => {
|
|
25480
25504
|
showStartPanel.value = true;
|
|
@@ -25557,8 +25581,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
25557
25581
|
};
|
|
25558
25582
|
const handleSubmit = () => {
|
|
25559
25583
|
if (startDate.value && endDate.value) {
|
|
25560
|
-
const startValue = isStartNow.value ? NowConstant : startDate.value.
|
|
25561
|
-
const endValue = isEndNow.value ? NowConstant : endDate.value.
|
|
25584
|
+
const startValue = isStartNow.value ? NowConstant : dayjs.tz(startDate.value.format(format.value), timezoneInfo.value.label).valueOf();
|
|
25585
|
+
const endValue = isEndNow.value ? NowConstant : dayjs.tz(endDate.value.format(format.value), timezoneInfo.value.label).valueOf();
|
|
25562
25586
|
isValidate.value = validateDateValue([startValue || "", endValue || ""]);
|
|
25563
25587
|
if (!isValidate.value) return;
|
|
25564
25588
|
emits("change", [startValue || "", endValue || ""]);
|
|
@@ -25592,10 +25616,11 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
25592
25616
|
},
|
|
25593
25617
|
[
|
|
25594
25618
|
_hoisted_3$4,
|
|
25595
|
-
|
|
25619
|
+
(openBlock(), createBlock(unref(__webpack_exports__default$9), {
|
|
25596
25620
|
"ext-cls": "__bk-date-picker-popover__ __date-picker-popover-start__",
|
|
25597
25621
|
arrow: false,
|
|
25598
25622
|
"is-show": showStartPanel.value,
|
|
25623
|
+
key: unref(timezoneInfo).label,
|
|
25599
25624
|
boundary: "parent",
|
|
25600
25625
|
placement: "bottom-start",
|
|
25601
25626
|
theme: "light",
|
|
@@ -25633,12 +25658,13 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
25633
25658
|
}),
|
|
25634
25659
|
_: 1
|
|
25635
25660
|
/* STABLE */
|
|
25636
|
-
}, 8, ["is-show"]),
|
|
25661
|
+
}, 8, ["is-show"])),
|
|
25637
25662
|
_hoisted_5$3,
|
|
25638
|
-
|
|
25663
|
+
(openBlock(), createBlock(unref(__webpack_exports__default$9), {
|
|
25639
25664
|
"ext-cls": "__bk-date-picker-popover__ __date-picker-popover-end__",
|
|
25640
25665
|
arrow: false,
|
|
25641
25666
|
"is-show": showEndPanel.value,
|
|
25667
|
+
key: unref(timezoneInfo).label,
|
|
25642
25668
|
boundary: "parent",
|
|
25643
25669
|
placement: "bottom-start",
|
|
25644
25670
|
theme: "light",
|
|
@@ -25675,7 +25701,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
25675
25701
|
}),
|
|
25676
25702
|
_: 1
|
|
25677
25703
|
/* STABLE */
|
|
25678
|
-
}, 8, ["is-show"]),
|
|
25704
|
+
}, 8, ["is-show"])),
|
|
25679
25705
|
!!(startDate.value || endDate.value) ? (openBlock(), createBlock(unref(__webpack_exports__default$m), {
|
|
25680
25706
|
key: 0,
|
|
25681
25707
|
class: "date-picker-clear",
|
|
@@ -26968,7 +26994,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
26968
26994
|
const b2 = dayjs.tz(dayjs(), timezone).utcOffset();
|
|
26969
26995
|
return (b2 - a2) / 60;
|
|
26970
26996
|
});
|
|
26971
|
-
const dateDetail = shallowRef(new DateRange(props2.modelValue, props2.format
|
|
26997
|
+
const dateDetail = shallowRef(new DateRange(props2.modelValue, props2.format));
|
|
26972
26998
|
const tooltipsDetail = shallowRef();
|
|
26973
26999
|
const storeKey2 = computed(() => getStoreKey(props2.version));
|
|
26974
27000
|
const datePanelShow = ref(false);
|
|
@@ -26979,7 +27005,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
26979
27005
|
var _a, _b;
|
|
26980
27006
|
if (((_b = (_a = dateDetail.value) == null ? void 0 : _a.dateValue) == null ? void 0 : _b.length) && dateDetail.value.dateValue.every((item, index) => item === (v2 == null ? void 0 : v2[index])))
|
|
26981
27007
|
return;
|
|
26982
|
-
dateDetail.value = new DateRange(v2, format.value
|
|
27008
|
+
dateDetail.value = new DateRange(v2, format.value);
|
|
26983
27009
|
},
|
|
26984
27010
|
{
|
|
26985
27011
|
immediate: true
|
|
@@ -27008,7 +27034,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
27008
27034
|
if (enterTimer) return;
|
|
27009
27035
|
enterTimer = setTimeout(() => {
|
|
27010
27036
|
tooltipsShow.value = true;
|
|
27011
|
-
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value
|
|
27037
|
+
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value);
|
|
27012
27038
|
enterTimer = null;
|
|
27013
27039
|
}, 100);
|
|
27014
27040
|
}
|
|
@@ -27031,7 +27057,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
27031
27057
|
!canStore && dateDetail.value.isValidate && setStoreDateList(val, storeKey2.value);
|
|
27032
27058
|
};
|
|
27033
27059
|
const handleTimezoneChange = (val, info) => {
|
|
27034
|
-
dateDetail.value = new DateRange(props2.modelValue, format.value, val);
|
|
27035
27060
|
emits("update:timezone", val, { ...info });
|
|
27036
27061
|
sessionStorage.setItem(timezoneStoreKey, val);
|
|
27037
27062
|
};
|
|
@@ -27045,8 +27070,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
27045
27070
|
const durations = dateDetail.value.dateDuration();
|
|
27046
27071
|
const val = type === "left" ? [startDate.subtract(durations), endDate.subtract(durations)] : [startDate.add(durations), endDate.add(durations)];
|
|
27047
27072
|
if ((_b = props2.validDateRange) == null ? void 0 : _b.length) {
|
|
27048
|
-
const validDateRange = new DateRange(props2.validDateRange, props2.format
|
|
27049
|
-
if (!validDateRange.isInValidDateRange(new DateRange(val, props2.format
|
|
27073
|
+
const validDateRange = new DateRange(props2.validDateRange, props2.format);
|
|
27074
|
+
if (!validDateRange.isInValidDateRange(new DateRange(val, props2.format))) return;
|
|
27050
27075
|
}
|
|
27051
27076
|
handleChange(val);
|
|
27052
27077
|
};
|
|
@@ -27319,6 +27344,7 @@ export {
|
|
|
27319
27344
|
futureDateRegexp,
|
|
27320
27345
|
getStoreKey,
|
|
27321
27346
|
getStoreTabKey,
|
|
27347
|
+
getTimezoneOffset,
|
|
27322
27348
|
inputVal2Dayjs,
|
|
27323
27349
|
naturalDateRegexp,
|
|
27324
27350
|
naturalDateShortcutMap,
|
package/vue2/index.iife.min.js
CHANGED
|
@@ -30589,6 +30589,11 @@ ${$(r2)}`), n2;
|
|
|
30589
30589
|
}
|
|
30590
30590
|
return date;
|
|
30591
30591
|
};
|
|
30592
|
+
function getTimezoneOffset(timezone2) {
|
|
30593
|
+
const localTime = dayjs().tz(timezone2);
|
|
30594
|
+
const offset2 = localTime.utcOffset() / 60;
|
|
30595
|
+
return offset2;
|
|
30596
|
+
}
|
|
30592
30597
|
dayjs.extend(utc);
|
|
30593
30598
|
dayjs.extend(tz);
|
|
30594
30599
|
const timezoneData = [
|
|
@@ -32447,6 +32452,7 @@ ${$(r2)}`), n2;
|
|
|
32447
32452
|
const today = dayjs();
|
|
32448
32453
|
const isValidate = ref(true);
|
|
32449
32454
|
const { validMsg, validateDateValue } = useValidate();
|
|
32455
|
+
const curTimezoneInfo = ref(timezoneInfo.value || dayjs.tz.guess());
|
|
32450
32456
|
watch(
|
|
32451
32457
|
() => props2.value,
|
|
32452
32458
|
(date) => {
|
|
@@ -32460,6 +32466,26 @@ ${$(r2)}`), n2;
|
|
|
32460
32466
|
immediate: true
|
|
32461
32467
|
}
|
|
32462
32468
|
);
|
|
32469
|
+
watch(
|
|
32470
|
+
() => timezoneInfo,
|
|
32471
|
+
(newTimezone) => {
|
|
32472
|
+
if (!timezoneInfo.value) return;
|
|
32473
|
+
if (newTimezone.value.label === curTimezoneInfo.value.label) return;
|
|
32474
|
+
if (newTimezone.value.utc === curTimezoneInfo.value.utc) return;
|
|
32475
|
+
curTimezoneInfo.value = newTimezone.value || dayjs.tz.guess();
|
|
32476
|
+
if (startDate.value) {
|
|
32477
|
+
startDate.value = dayjs.tz(startDate.value, curTimezoneInfo.value.label);
|
|
32478
|
+
startInput.value.value = startDate.value.format(format.value);
|
|
32479
|
+
}
|
|
32480
|
+
if (endDate.value) {
|
|
32481
|
+
endDate.value = dayjs.tz(endDate.value, curTimezoneInfo.value.label);
|
|
32482
|
+
endInput.value.value = endDate.value.format(format.value);
|
|
32483
|
+
}
|
|
32484
|
+
},
|
|
32485
|
+
{
|
|
32486
|
+
deep: true
|
|
32487
|
+
}
|
|
32488
|
+
);
|
|
32463
32489
|
const canConfirm = computed(() => {
|
|
32464
32490
|
if (!startDate.value || !endDate.value) return false;
|
|
32465
32491
|
if (!startDate.value.isValid() || !endDate.value.isValid()) return false;
|
|
@@ -32469,33 +32495,31 @@ ${$(r2)}`), n2;
|
|
|
32469
32495
|
return true;
|
|
32470
32496
|
});
|
|
32471
32497
|
const handleInputEnter = async (_2, type) => {
|
|
32472
|
-
|
|
32473
|
-
|
|
32474
|
-
|
|
32475
|
-
|
|
32476
|
-
|
|
32477
|
-
|
|
32478
|
-
|
|
32479
|
-
|
|
32480
|
-
|
|
32481
|
-
|
|
32482
|
-
|
|
32483
|
-
|
|
32484
|
-
|
|
32485
|
-
|
|
32486
|
-
|
|
32487
|
-
if (
|
|
32488
|
-
|
|
32489
|
-
|
|
32490
|
-
|
|
32491
|
-
|
|
32492
|
-
|
|
32493
|
-
handleEndTimeChange(!endDate.value ? date.endOf("d") : date);
|
|
32494
|
-
}
|
|
32498
|
+
var _a, _b, _c;
|
|
32499
|
+
const target = type === "start" ? startInput.value : endInput.value;
|
|
32500
|
+
const val = (_a = target == null ? void 0 : target.value) == null ? void 0 : _a.toString().trim();
|
|
32501
|
+
const editDate = type === "start" ? startDate.value : endDate.value;
|
|
32502
|
+
const curNow = type === "start" ? isStartNow : isEndNow;
|
|
32503
|
+
const otherNow = type === "start" ? isEndNow : isStartNow;
|
|
32504
|
+
const formatValue = editDate == null ? void 0 : editDate.format(format.value);
|
|
32505
|
+
if (val === formatValue) return;
|
|
32506
|
+
if (!val || val === NowConstant && curNow.value) return;
|
|
32507
|
+
if (val === NowConstant && !curNow.value && !otherNow.value) {
|
|
32508
|
+
handleIsNowChange(type);
|
|
32509
|
+
return;
|
|
32510
|
+
}
|
|
32511
|
+
let date = inputVal2Dayjs(val, format.value, editDate);
|
|
32512
|
+
if (date.isValid()) {
|
|
32513
|
+
if (!(editDate == null ? void 0 : editDate.isSame(date))) {
|
|
32514
|
+
curNow.value = val === NowConstant;
|
|
32515
|
+
if (type === "start") {
|
|
32516
|
+
handleStartTimeChange(!startDate.value ? date.startOf("d") : date);
|
|
32517
|
+
} else {
|
|
32518
|
+
handleEndTimeChange(!endDate.value ? date.endOf("d") : date);
|
|
32495
32519
|
}
|
|
32496
32520
|
}
|
|
32497
|
-
|
|
32498
|
-
|
|
32521
|
+
}
|
|
32522
|
+
target.value = type === "start" ? ((_b = startDate.value) == null ? void 0 : _b.format(format.value)) || "" : ((_c = endDate.value) == null ? void 0 : _c.format(format.value)) || "";
|
|
32499
32523
|
};
|
|
32500
32524
|
const handleFocusStart = () => {
|
|
32501
32525
|
showStartPanel.value = true;
|
|
@@ -32578,8 +32602,8 @@ ${$(r2)}`), n2;
|
|
|
32578
32602
|
};
|
|
32579
32603
|
const handleSubmit = () => {
|
|
32580
32604
|
if (startDate.value && endDate.value) {
|
|
32581
|
-
const startValue = isStartNow.value ? NowConstant : startDate.value.
|
|
32582
|
-
const endValue = isEndNow.value ? NowConstant : endDate.value.
|
|
32605
|
+
const startValue = isStartNow.value ? NowConstant : dayjs.tz(startDate.value.format(format.value), timezoneInfo.value.label).valueOf();
|
|
32606
|
+
const endValue = isEndNow.value ? NowConstant : dayjs.tz(endDate.value.format(format.value), timezoneInfo.value.label).valueOf();
|
|
32583
32607
|
isValidate.value = validateDateValue([startValue || "", endValue || ""]);
|
|
32584
32608
|
if (!isValidate.value) return;
|
|
32585
32609
|
emits("change", [startValue || "", endValue || ""]);
|
|
@@ -32613,10 +32637,11 @@ ${$(r2)}`), n2;
|
|
|
32613
32637
|
},
|
|
32614
32638
|
[
|
|
32615
32639
|
_hoisted_3$4,
|
|
32616
|
-
|
|
32640
|
+
(openBlock(), createBlock(unref(__webpack_exports__default$9), {
|
|
32617
32641
|
"ext-cls": "__bk-date-picker-popover__ __date-picker-popover-start__",
|
|
32618
32642
|
arrow: false,
|
|
32619
32643
|
"is-show": showStartPanel.value,
|
|
32644
|
+
key: unref(timezoneInfo).label,
|
|
32620
32645
|
boundary: "parent",
|
|
32621
32646
|
placement: "bottom-start",
|
|
32622
32647
|
theme: "light",
|
|
@@ -32654,12 +32679,13 @@ ${$(r2)}`), n2;
|
|
|
32654
32679
|
}),
|
|
32655
32680
|
_: 1
|
|
32656
32681
|
/* STABLE */
|
|
32657
|
-
}, 8, ["is-show"]),
|
|
32682
|
+
}, 8, ["is-show"])),
|
|
32658
32683
|
_hoisted_5$3,
|
|
32659
|
-
|
|
32684
|
+
(openBlock(), createBlock(unref(__webpack_exports__default$9), {
|
|
32660
32685
|
"ext-cls": "__bk-date-picker-popover__ __date-picker-popover-end__",
|
|
32661
32686
|
arrow: false,
|
|
32662
32687
|
"is-show": showEndPanel.value,
|
|
32688
|
+
key: unref(timezoneInfo).label,
|
|
32663
32689
|
boundary: "parent",
|
|
32664
32690
|
placement: "bottom-start",
|
|
32665
32691
|
theme: "light",
|
|
@@ -32696,7 +32722,7 @@ ${$(r2)}`), n2;
|
|
|
32696
32722
|
}),
|
|
32697
32723
|
_: 1
|
|
32698
32724
|
/* STABLE */
|
|
32699
|
-
}, 8, ["is-show"]),
|
|
32725
|
+
}, 8, ["is-show"])),
|
|
32700
32726
|
!!(startDate.value || endDate.value) ? (openBlock(), createBlock(unref(__webpack_exports__default$m), {
|
|
32701
32727
|
key: 0,
|
|
32702
32728
|
class: "date-picker-clear",
|
|
@@ -33989,7 +34015,7 @@ ${$(r2)}`), n2;
|
|
|
33989
34015
|
const b2 = dayjs.tz(dayjs(), timezone2).utcOffset();
|
|
33990
34016
|
return (b2 - a2) / 60;
|
|
33991
34017
|
});
|
|
33992
|
-
const dateDetail = shallowRef(new DateRange(props2.modelValue, props2.format
|
|
34018
|
+
const dateDetail = shallowRef(new DateRange(props2.modelValue, props2.format));
|
|
33993
34019
|
const tooltipsDetail = shallowRef();
|
|
33994
34020
|
const storeKey2 = computed(() => getStoreKey(props2.version));
|
|
33995
34021
|
const datePanelShow = ref(false);
|
|
@@ -34000,7 +34026,7 @@ ${$(r2)}`), n2;
|
|
|
34000
34026
|
var _a, _b;
|
|
34001
34027
|
if (((_b = (_a = dateDetail.value) == null ? void 0 : _a.dateValue) == null ? void 0 : _b.length) && dateDetail.value.dateValue.every((item, index) => item === (v2 == null ? void 0 : v2[index])))
|
|
34002
34028
|
return;
|
|
34003
|
-
dateDetail.value = new DateRange(v2, format.value
|
|
34029
|
+
dateDetail.value = new DateRange(v2, format.value);
|
|
34004
34030
|
},
|
|
34005
34031
|
{
|
|
34006
34032
|
immediate: true
|
|
@@ -34029,7 +34055,7 @@ ${$(r2)}`), n2;
|
|
|
34029
34055
|
if (enterTimer) return;
|
|
34030
34056
|
enterTimer = setTimeout(() => {
|
|
34031
34057
|
tooltipsShow.value = true;
|
|
34032
|
-
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value
|
|
34058
|
+
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value);
|
|
34033
34059
|
enterTimer = null;
|
|
34034
34060
|
}, 100);
|
|
34035
34061
|
}
|
|
@@ -34052,7 +34078,6 @@ ${$(r2)}`), n2;
|
|
|
34052
34078
|
!canStore && dateDetail.value.isValidate && setStoreDateList(val, storeKey2.value);
|
|
34053
34079
|
};
|
|
34054
34080
|
const handleTimezoneChange = (val, info) => {
|
|
34055
|
-
dateDetail.value = new DateRange(props2.modelValue, format.value, val);
|
|
34056
34081
|
emits("update:timezone", val, { ...info });
|
|
34057
34082
|
sessionStorage.setItem(timezoneStoreKey, val);
|
|
34058
34083
|
};
|
|
@@ -34066,8 +34091,8 @@ ${$(r2)}`), n2;
|
|
|
34066
34091
|
const durations = dateDetail.value.dateDuration();
|
|
34067
34092
|
const val = type === "left" ? [startDate.subtract(durations), endDate.subtract(durations)] : [startDate.add(durations), endDate.add(durations)];
|
|
34068
34093
|
if ((_b = props2.validDateRange) == null ? void 0 : _b.length) {
|
|
34069
|
-
const validDateRange = new DateRange(props2.validDateRange, props2.format
|
|
34070
|
-
if (!validDateRange.isInValidDateRange(new DateRange(val, props2.format
|
|
34094
|
+
const validDateRange = new DateRange(props2.validDateRange, props2.format);
|
|
34095
|
+
if (!validDateRange.isInValidDateRange(new DateRange(val, props2.format))) return;
|
|
34071
34096
|
}
|
|
34072
34097
|
handleChange(val);
|
|
34073
34098
|
};
|
|
@@ -34339,6 +34364,7 @@ ${$(r2)}`), n2;
|
|
|
34339
34364
|
exports.futureDateRegexp = futureDateRegexp;
|
|
34340
34365
|
exports.getStoreKey = getStoreKey;
|
|
34341
34366
|
exports.getStoreTabKey = getStoreTabKey;
|
|
34367
|
+
exports.getTimezoneOffset = getTimezoneOffset;
|
|
34342
34368
|
exports.inputVal2Dayjs = inputVal2Dayjs;
|
|
34343
34369
|
exports.naturalDateRegexp = naturalDateRegexp;
|
|
34344
34370
|
exports.naturalDateShortcutMap = naturalDateShortcutMap;
|
package/vue2/index.umd.min.js
CHANGED
|
@@ -23583,6 +23583,11 @@ ${$(r2)}`), n2;
|
|
|
23583
23583
|
}
|
|
23584
23584
|
return date;
|
|
23585
23585
|
};
|
|
23586
|
+
function getTimezoneOffset(timezone) {
|
|
23587
|
+
const localTime = dayjs().tz(timezone);
|
|
23588
|
+
const offset2 = localTime.utcOffset() / 60;
|
|
23589
|
+
return offset2;
|
|
23590
|
+
}
|
|
23586
23591
|
dayjs.extend(utc);
|
|
23587
23592
|
dayjs.extend(tz);
|
|
23588
23593
|
const timezoneData = [
|
|
@@ -25441,6 +25446,7 @@ ${$(r2)}`), n2;
|
|
|
25441
25446
|
const today = dayjs();
|
|
25442
25447
|
const isValidate = __WEBPACK_EXTERNAL_MODULE_vue__.ref(true);
|
|
25443
25448
|
const { validMsg, validateDateValue } = useValidate();
|
|
25449
|
+
const curTimezoneInfo = __WEBPACK_EXTERNAL_MODULE_vue__.ref(timezoneInfo.value || dayjs.tz.guess());
|
|
25444
25450
|
__WEBPACK_EXTERNAL_MODULE_vue__.watch(
|
|
25445
25451
|
() => props2.value,
|
|
25446
25452
|
(date) => {
|
|
@@ -25454,6 +25460,26 @@ ${$(r2)}`), n2;
|
|
|
25454
25460
|
immediate: true
|
|
25455
25461
|
}
|
|
25456
25462
|
);
|
|
25463
|
+
__WEBPACK_EXTERNAL_MODULE_vue__.watch(
|
|
25464
|
+
() => timezoneInfo,
|
|
25465
|
+
(newTimezone) => {
|
|
25466
|
+
if (!timezoneInfo.value) return;
|
|
25467
|
+
if (newTimezone.value.label === curTimezoneInfo.value.label) return;
|
|
25468
|
+
if (newTimezone.value.utc === curTimezoneInfo.value.utc) return;
|
|
25469
|
+
curTimezoneInfo.value = newTimezone.value || dayjs.tz.guess();
|
|
25470
|
+
if (startDate.value) {
|
|
25471
|
+
startDate.value = dayjs.tz(startDate.value, curTimezoneInfo.value.label);
|
|
25472
|
+
startInput.value.value = startDate.value.format(format.value);
|
|
25473
|
+
}
|
|
25474
|
+
if (endDate.value) {
|
|
25475
|
+
endDate.value = dayjs.tz(endDate.value, curTimezoneInfo.value.label);
|
|
25476
|
+
endInput.value.value = endDate.value.format(format.value);
|
|
25477
|
+
}
|
|
25478
|
+
},
|
|
25479
|
+
{
|
|
25480
|
+
deep: true
|
|
25481
|
+
}
|
|
25482
|
+
);
|
|
25457
25483
|
const canConfirm = __WEBPACK_EXTERNAL_MODULE_vue__.computed(() => {
|
|
25458
25484
|
if (!startDate.value || !endDate.value) return false;
|
|
25459
25485
|
if (!startDate.value.isValid() || !endDate.value.isValid()) return false;
|
|
@@ -25463,33 +25489,31 @@ ${$(r2)}`), n2;
|
|
|
25463
25489
|
return true;
|
|
25464
25490
|
});
|
|
25465
25491
|
const handleInputEnter = async (_2, type) => {
|
|
25466
|
-
|
|
25467
|
-
|
|
25468
|
-
|
|
25469
|
-
|
|
25470
|
-
|
|
25471
|
-
|
|
25472
|
-
|
|
25473
|
-
|
|
25474
|
-
|
|
25475
|
-
|
|
25476
|
-
|
|
25477
|
-
|
|
25478
|
-
|
|
25479
|
-
|
|
25480
|
-
|
|
25481
|
-
if (
|
|
25482
|
-
|
|
25483
|
-
|
|
25484
|
-
|
|
25485
|
-
|
|
25486
|
-
|
|
25487
|
-
handleEndTimeChange(!endDate.value ? date.endOf("d") : date);
|
|
25488
|
-
}
|
|
25492
|
+
var _a, _b, _c;
|
|
25493
|
+
const target = type === "start" ? startInput.value : endInput.value;
|
|
25494
|
+
const val = (_a = target == null ? void 0 : target.value) == null ? void 0 : _a.toString().trim();
|
|
25495
|
+
const editDate = type === "start" ? startDate.value : endDate.value;
|
|
25496
|
+
const curNow = type === "start" ? isStartNow : isEndNow;
|
|
25497
|
+
const otherNow = type === "start" ? isEndNow : isStartNow;
|
|
25498
|
+
const formatValue = editDate == null ? void 0 : editDate.format(format.value);
|
|
25499
|
+
if (val === formatValue) return;
|
|
25500
|
+
if (!val || val === NowConstant && curNow.value) return;
|
|
25501
|
+
if (val === NowConstant && !curNow.value && !otherNow.value) {
|
|
25502
|
+
handleIsNowChange(type);
|
|
25503
|
+
return;
|
|
25504
|
+
}
|
|
25505
|
+
let date = inputVal2Dayjs(val, format.value, editDate);
|
|
25506
|
+
if (date.isValid()) {
|
|
25507
|
+
if (!(editDate == null ? void 0 : editDate.isSame(date))) {
|
|
25508
|
+
curNow.value = val === NowConstant;
|
|
25509
|
+
if (type === "start") {
|
|
25510
|
+
handleStartTimeChange(!startDate.value ? date.startOf("d") : date);
|
|
25511
|
+
} else {
|
|
25512
|
+
handleEndTimeChange(!endDate.value ? date.endOf("d") : date);
|
|
25489
25513
|
}
|
|
25490
25514
|
}
|
|
25491
|
-
|
|
25492
|
-
|
|
25515
|
+
}
|
|
25516
|
+
target.value = type === "start" ? ((_b = startDate.value) == null ? void 0 : _b.format(format.value)) || "" : ((_c = endDate.value) == null ? void 0 : _c.format(format.value)) || "";
|
|
25493
25517
|
};
|
|
25494
25518
|
const handleFocusStart = () => {
|
|
25495
25519
|
showStartPanel.value = true;
|
|
@@ -25572,8 +25596,8 @@ ${$(r2)}`), n2;
|
|
|
25572
25596
|
};
|
|
25573
25597
|
const handleSubmit = () => {
|
|
25574
25598
|
if (startDate.value && endDate.value) {
|
|
25575
|
-
const startValue = isStartNow.value ? NowConstant : startDate.value.
|
|
25576
|
-
const endValue = isEndNow.value ? NowConstant : endDate.value.
|
|
25599
|
+
const startValue = isStartNow.value ? NowConstant : dayjs.tz(startDate.value.format(format.value), timezoneInfo.value.label).valueOf();
|
|
25600
|
+
const endValue = isEndNow.value ? NowConstant : dayjs.tz(endDate.value.format(format.value), timezoneInfo.value.label).valueOf();
|
|
25577
25601
|
isValidate.value = validateDateValue([startValue || "", endValue || ""]);
|
|
25578
25602
|
if (!isValidate.value) return;
|
|
25579
25603
|
emits("change", [startValue || "", endValue || ""]);
|
|
@@ -25607,10 +25631,11 @@ ${$(r2)}`), n2;
|
|
|
25607
25631
|
},
|
|
25608
25632
|
[
|
|
25609
25633
|
_hoisted_3$4,
|
|
25610
|
-
__WEBPACK_EXTERNAL_MODULE_vue__.
|
|
25634
|
+
(__WEBPACK_EXTERNAL_MODULE_vue__.openBlock(), __WEBPACK_EXTERNAL_MODULE_vue__.createBlock(__WEBPACK_EXTERNAL_MODULE_vue__.unref(__webpack_exports__default$9), {
|
|
25611
25635
|
"ext-cls": "__bk-date-picker-popover__ __date-picker-popover-start__",
|
|
25612
25636
|
arrow: false,
|
|
25613
25637
|
"is-show": showStartPanel.value,
|
|
25638
|
+
key: __WEBPACK_EXTERNAL_MODULE_vue__.unref(timezoneInfo).label,
|
|
25614
25639
|
boundary: "parent",
|
|
25615
25640
|
placement: "bottom-start",
|
|
25616
25641
|
theme: "light",
|
|
@@ -25648,12 +25673,13 @@ ${$(r2)}`), n2;
|
|
|
25648
25673
|
}),
|
|
25649
25674
|
_: 1
|
|
25650
25675
|
/* STABLE */
|
|
25651
|
-
}, 8, ["is-show"]),
|
|
25676
|
+
}, 8, ["is-show"])),
|
|
25652
25677
|
_hoisted_5$3,
|
|
25653
|
-
__WEBPACK_EXTERNAL_MODULE_vue__.
|
|
25678
|
+
(__WEBPACK_EXTERNAL_MODULE_vue__.openBlock(), __WEBPACK_EXTERNAL_MODULE_vue__.createBlock(__WEBPACK_EXTERNAL_MODULE_vue__.unref(__webpack_exports__default$9), {
|
|
25654
25679
|
"ext-cls": "__bk-date-picker-popover__ __date-picker-popover-end__",
|
|
25655
25680
|
arrow: false,
|
|
25656
25681
|
"is-show": showEndPanel.value,
|
|
25682
|
+
key: __WEBPACK_EXTERNAL_MODULE_vue__.unref(timezoneInfo).label,
|
|
25657
25683
|
boundary: "parent",
|
|
25658
25684
|
placement: "bottom-start",
|
|
25659
25685
|
theme: "light",
|
|
@@ -25690,7 +25716,7 @@ ${$(r2)}`), n2;
|
|
|
25690
25716
|
}),
|
|
25691
25717
|
_: 1
|
|
25692
25718
|
/* STABLE */
|
|
25693
|
-
}, 8, ["is-show"]),
|
|
25719
|
+
}, 8, ["is-show"])),
|
|
25694
25720
|
!!(startDate.value || endDate.value) ? (__WEBPACK_EXTERNAL_MODULE_vue__.openBlock(), __WEBPACK_EXTERNAL_MODULE_vue__.createBlock(__WEBPACK_EXTERNAL_MODULE_vue__.unref(__webpack_exports__default$m), {
|
|
25695
25721
|
key: 0,
|
|
25696
25722
|
class: "date-picker-clear",
|
|
@@ -26983,7 +27009,7 @@ ${$(r2)}`), n2;
|
|
|
26983
27009
|
const b2 = dayjs.tz(dayjs(), timezone).utcOffset();
|
|
26984
27010
|
return (b2 - a2) / 60;
|
|
26985
27011
|
});
|
|
26986
|
-
const dateDetail = __WEBPACK_EXTERNAL_MODULE_vue__.shallowRef(new DateRange(props2.modelValue, props2.format
|
|
27012
|
+
const dateDetail = __WEBPACK_EXTERNAL_MODULE_vue__.shallowRef(new DateRange(props2.modelValue, props2.format));
|
|
26987
27013
|
const tooltipsDetail = __WEBPACK_EXTERNAL_MODULE_vue__.shallowRef();
|
|
26988
27014
|
const storeKey2 = __WEBPACK_EXTERNAL_MODULE_vue__.computed(() => getStoreKey(props2.version));
|
|
26989
27015
|
const datePanelShow = __WEBPACK_EXTERNAL_MODULE_vue__.ref(false);
|
|
@@ -26994,7 +27020,7 @@ ${$(r2)}`), n2;
|
|
|
26994
27020
|
var _a, _b;
|
|
26995
27021
|
if (((_b = (_a = dateDetail.value) == null ? void 0 : _a.dateValue) == null ? void 0 : _b.length) && dateDetail.value.dateValue.every((item, index) => item === (v2 == null ? void 0 : v2[index])))
|
|
26996
27022
|
return;
|
|
26997
|
-
dateDetail.value = new DateRange(v2, format.value
|
|
27023
|
+
dateDetail.value = new DateRange(v2, format.value);
|
|
26998
27024
|
},
|
|
26999
27025
|
{
|
|
27000
27026
|
immediate: true
|
|
@@ -27023,7 +27049,7 @@ ${$(r2)}`), n2;
|
|
|
27023
27049
|
if (enterTimer) return;
|
|
27024
27050
|
enterTimer = setTimeout(() => {
|
|
27025
27051
|
tooltipsShow.value = true;
|
|
27026
|
-
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value
|
|
27052
|
+
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value);
|
|
27027
27053
|
enterTimer = null;
|
|
27028
27054
|
}, 100);
|
|
27029
27055
|
}
|
|
@@ -27046,7 +27072,6 @@ ${$(r2)}`), n2;
|
|
|
27046
27072
|
!canStore && dateDetail.value.isValidate && setStoreDateList(val, storeKey2.value);
|
|
27047
27073
|
};
|
|
27048
27074
|
const handleTimezoneChange = (val, info) => {
|
|
27049
|
-
dateDetail.value = new DateRange(props2.modelValue, format.value, val);
|
|
27050
27075
|
emits("update:timezone", val, { ...info });
|
|
27051
27076
|
sessionStorage.setItem(timezoneStoreKey, val);
|
|
27052
27077
|
};
|
|
@@ -27060,8 +27085,8 @@ ${$(r2)}`), n2;
|
|
|
27060
27085
|
const durations = dateDetail.value.dateDuration();
|
|
27061
27086
|
const val = type === "left" ? [startDate.subtract(durations), endDate.subtract(durations)] : [startDate.add(durations), endDate.add(durations)];
|
|
27062
27087
|
if ((_b = props2.validDateRange) == null ? void 0 : _b.length) {
|
|
27063
|
-
const validDateRange = new DateRange(props2.validDateRange, props2.format
|
|
27064
|
-
if (!validDateRange.isInValidDateRange(new DateRange(val, props2.format
|
|
27088
|
+
const validDateRange = new DateRange(props2.validDateRange, props2.format);
|
|
27089
|
+
if (!validDateRange.isInValidDateRange(new DateRange(val, props2.format))) return;
|
|
27065
27090
|
}
|
|
27066
27091
|
handleChange(val);
|
|
27067
27092
|
};
|
|
@@ -27333,6 +27358,7 @@ ${$(r2)}`), n2;
|
|
|
27333
27358
|
exports2.futureDateRegexp = futureDateRegexp;
|
|
27334
27359
|
exports2.getStoreKey = getStoreKey;
|
|
27335
27360
|
exports2.getStoreTabKey = getStoreTabKey;
|
|
27361
|
+
exports2.getTimezoneOffset = getTimezoneOffset;
|
|
27336
27362
|
exports2.inputVal2Dayjs = inputVal2Dayjs;
|
|
27337
27363
|
exports2.naturalDateRegexp = naturalDateRegexp;
|
|
27338
27364
|
exports2.naturalDateShortcutMap = naturalDateShortcutMap;
|
package/vue3/index.es.min.js
CHANGED
|
@@ -653,6 +653,11 @@ const inputVal2Dayjs = (val, format, defaultDate) => {
|
|
|
653
653
|
}
|
|
654
654
|
return date;
|
|
655
655
|
};
|
|
656
|
+
function getTimezoneOffset(timezone) {
|
|
657
|
+
const localTime = dayjs().tz(timezone);
|
|
658
|
+
const offset = localTime.utcOffset() / 60;
|
|
659
|
+
return offset;
|
|
660
|
+
}
|
|
656
661
|
dayjs.extend(utc);
|
|
657
662
|
dayjs.extend(tz);
|
|
658
663
|
const timezoneData = [
|
|
@@ -2511,6 +2516,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
2511
2516
|
const today = dayjs();
|
|
2512
2517
|
const isValidate = ref(true);
|
|
2513
2518
|
const { validMsg, validateDateValue } = useValidate();
|
|
2519
|
+
const curTimezoneInfo = ref(timezoneInfo.value || dayjs.tz.guess());
|
|
2514
2520
|
watch(
|
|
2515
2521
|
() => props.value,
|
|
2516
2522
|
(date) => {
|
|
@@ -2524,6 +2530,26 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
2524
2530
|
immediate: true
|
|
2525
2531
|
}
|
|
2526
2532
|
);
|
|
2533
|
+
watch(
|
|
2534
|
+
() => timezoneInfo,
|
|
2535
|
+
(newTimezone) => {
|
|
2536
|
+
if (!timezoneInfo.value) return;
|
|
2537
|
+
if (newTimezone.value.label === curTimezoneInfo.value.label) return;
|
|
2538
|
+
if (newTimezone.value.utc === curTimezoneInfo.value.utc) return;
|
|
2539
|
+
curTimezoneInfo.value = newTimezone.value || dayjs.tz.guess();
|
|
2540
|
+
if (startDate.value) {
|
|
2541
|
+
startDate.value = dayjs.tz(startDate.value, curTimezoneInfo.value.label);
|
|
2542
|
+
startInput.value.value = startDate.value.format(format.value);
|
|
2543
|
+
}
|
|
2544
|
+
if (endDate.value) {
|
|
2545
|
+
endDate.value = dayjs.tz(endDate.value, curTimezoneInfo.value.label);
|
|
2546
|
+
endInput.value.value = endDate.value.format(format.value);
|
|
2547
|
+
}
|
|
2548
|
+
},
|
|
2549
|
+
{
|
|
2550
|
+
deep: true
|
|
2551
|
+
}
|
|
2552
|
+
);
|
|
2527
2553
|
const canConfirm = computed(() => {
|
|
2528
2554
|
if (!startDate.value || !endDate.value) return false;
|
|
2529
2555
|
if (!startDate.value.isValid() || !endDate.value.isValid()) return false;
|
|
@@ -2533,33 +2559,31 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
2533
2559
|
return true;
|
|
2534
2560
|
});
|
|
2535
2561
|
const handleInputEnter = async (_, type) => {
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
if (
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
handleEndTimeChange(!endDate.value ? date.endOf("d") : date);
|
|
2558
|
-
}
|
|
2562
|
+
var _a, _b, _c;
|
|
2563
|
+
const target = type === "start" ? startInput.value : endInput.value;
|
|
2564
|
+
const val = (_a = target == null ? void 0 : target.value) == null ? void 0 : _a.toString().trim();
|
|
2565
|
+
const editDate = type === "start" ? startDate.value : endDate.value;
|
|
2566
|
+
const curNow = type === "start" ? isStartNow : isEndNow;
|
|
2567
|
+
const otherNow = type === "start" ? isEndNow : isStartNow;
|
|
2568
|
+
const formatValue = editDate == null ? void 0 : editDate.format(format.value);
|
|
2569
|
+
if (val === formatValue) return;
|
|
2570
|
+
if (!val || val === NowConstant && curNow.value) return;
|
|
2571
|
+
if (val === NowConstant && !curNow.value && !otherNow.value) {
|
|
2572
|
+
handleIsNowChange(type);
|
|
2573
|
+
return;
|
|
2574
|
+
}
|
|
2575
|
+
let date = inputVal2Dayjs(val, format.value, editDate);
|
|
2576
|
+
if (date.isValid()) {
|
|
2577
|
+
if (!(editDate == null ? void 0 : editDate.isSame(date))) {
|
|
2578
|
+
curNow.value = val === NowConstant;
|
|
2579
|
+
if (type === "start") {
|
|
2580
|
+
handleStartTimeChange(!startDate.value ? date.startOf("d") : date);
|
|
2581
|
+
} else {
|
|
2582
|
+
handleEndTimeChange(!endDate.value ? date.endOf("d") : date);
|
|
2559
2583
|
}
|
|
2560
2584
|
}
|
|
2561
|
-
|
|
2562
|
-
|
|
2585
|
+
}
|
|
2586
|
+
target.value = type === "start" ? ((_b = startDate.value) == null ? void 0 : _b.format(format.value)) || "" : ((_c = endDate.value) == null ? void 0 : _c.format(format.value)) || "";
|
|
2563
2587
|
};
|
|
2564
2588
|
const handleFocusStart = () => {
|
|
2565
2589
|
showStartPanel.value = true;
|
|
@@ -2642,8 +2666,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
2642
2666
|
};
|
|
2643
2667
|
const handleSubmit = () => {
|
|
2644
2668
|
if (startDate.value && endDate.value) {
|
|
2645
|
-
const startValue = isStartNow.value ? NowConstant : startDate.value.
|
|
2646
|
-
const endValue = isEndNow.value ? NowConstant : endDate.value.
|
|
2669
|
+
const startValue = isStartNow.value ? NowConstant : dayjs.tz(startDate.value.format(format.value), timezoneInfo.value.label).valueOf();
|
|
2670
|
+
const endValue = isEndNow.value ? NowConstant : dayjs.tz(endDate.value.format(format.value), timezoneInfo.value.label).valueOf();
|
|
2647
2671
|
isValidate.value = validateDateValue([startValue || "", endValue || ""]);
|
|
2648
2672
|
if (!isValidate.value) return;
|
|
2649
2673
|
emits("change", [startValue || "", endValue || ""]);
|
|
@@ -2677,10 +2701,11 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
2677
2701
|
},
|
|
2678
2702
|
[
|
|
2679
2703
|
_hoisted_3$4,
|
|
2680
|
-
|
|
2704
|
+
(openBlock(), createBlock(unref(Popover), {
|
|
2681
2705
|
"ext-cls": "__bk-date-picker-popover__ __date-picker-popover-start__",
|
|
2682
2706
|
arrow: false,
|
|
2683
2707
|
"is-show": showStartPanel.value,
|
|
2708
|
+
key: unref(timezoneInfo).label,
|
|
2684
2709
|
boundary: "parent",
|
|
2685
2710
|
placement: "bottom-start",
|
|
2686
2711
|
theme: "light",
|
|
@@ -2718,12 +2743,13 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
2718
2743
|
}),
|
|
2719
2744
|
_: 1
|
|
2720
2745
|
/* STABLE */
|
|
2721
|
-
}, 8, ["is-show"]),
|
|
2746
|
+
}, 8, ["is-show"])),
|
|
2722
2747
|
_hoisted_5$3,
|
|
2723
|
-
|
|
2748
|
+
(openBlock(), createBlock(unref(Popover), {
|
|
2724
2749
|
"ext-cls": "__bk-date-picker-popover__ __date-picker-popover-end__",
|
|
2725
2750
|
arrow: false,
|
|
2726
2751
|
"is-show": showEndPanel.value,
|
|
2752
|
+
key: unref(timezoneInfo).label,
|
|
2727
2753
|
boundary: "parent",
|
|
2728
2754
|
placement: "bottom-start",
|
|
2729
2755
|
theme: "light",
|
|
@@ -2760,7 +2786,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
2760
2786
|
}),
|
|
2761
2787
|
_: 1
|
|
2762
2788
|
/* STABLE */
|
|
2763
|
-
}, 8, ["is-show"]),
|
|
2789
|
+
}, 8, ["is-show"])),
|
|
2764
2790
|
!!(startDate.value || endDate.value) ? (openBlock(), createBlock(unref(Close), {
|
|
2765
2791
|
key: 0,
|
|
2766
2792
|
class: "date-picker-clear",
|
|
@@ -4053,7 +4079,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4053
4079
|
const b = dayjs.tz(dayjs(), timezone).utcOffset();
|
|
4054
4080
|
return (b - a) / 60;
|
|
4055
4081
|
});
|
|
4056
|
-
const dateDetail = shallowRef(new DateRange(props.modelValue, props.format
|
|
4082
|
+
const dateDetail = shallowRef(new DateRange(props.modelValue, props.format));
|
|
4057
4083
|
const tooltipsDetail = shallowRef();
|
|
4058
4084
|
const storeKey2 = computed(() => getStoreKey(props.version));
|
|
4059
4085
|
const datePanelShow = ref(false);
|
|
@@ -4064,7 +4090,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4064
4090
|
var _a, _b;
|
|
4065
4091
|
if (((_b = (_a = dateDetail.value) == null ? void 0 : _a.dateValue) == null ? void 0 : _b.length) && dateDetail.value.dateValue.every((item, index) => item === (v == null ? void 0 : v[index])))
|
|
4066
4092
|
return;
|
|
4067
|
-
dateDetail.value = new DateRange(v, format.value
|
|
4093
|
+
dateDetail.value = new DateRange(v, format.value);
|
|
4068
4094
|
},
|
|
4069
4095
|
{
|
|
4070
4096
|
immediate: true
|
|
@@ -4093,7 +4119,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4093
4119
|
if (enterTimer) return;
|
|
4094
4120
|
enterTimer = setTimeout(() => {
|
|
4095
4121
|
tooltipsShow.value = true;
|
|
4096
|
-
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value
|
|
4122
|
+
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value);
|
|
4097
4123
|
enterTimer = null;
|
|
4098
4124
|
}, 100);
|
|
4099
4125
|
}
|
|
@@ -4116,7 +4142,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4116
4142
|
!canStore && dateDetail.value.isValidate && setStoreDateList(val, storeKey2.value);
|
|
4117
4143
|
};
|
|
4118
4144
|
const handleTimezoneChange = (val, info) => {
|
|
4119
|
-
dateDetail.value = new DateRange(props.modelValue, format.value, val);
|
|
4120
4145
|
emits("update:timezone", val, { ...info });
|
|
4121
4146
|
sessionStorage.setItem(timezoneStoreKey, val);
|
|
4122
4147
|
};
|
|
@@ -4130,8 +4155,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4130
4155
|
const durations = dateDetail.value.dateDuration();
|
|
4131
4156
|
const val = type === "left" ? [startDate.subtract(durations), endDate.subtract(durations)] : [startDate.add(durations), endDate.add(durations)];
|
|
4132
4157
|
if ((_b = props.validDateRange) == null ? void 0 : _b.length) {
|
|
4133
|
-
const validDateRange = new DateRange(props.validDateRange, props.format
|
|
4134
|
-
if (!validDateRange.isInValidDateRange(new DateRange(val, props.format
|
|
4158
|
+
const validDateRange = new DateRange(props.validDateRange, props.format);
|
|
4159
|
+
if (!validDateRange.isInValidDateRange(new DateRange(val, props.format))) return;
|
|
4135
4160
|
}
|
|
4136
4161
|
handleChange(val);
|
|
4137
4162
|
};
|
|
@@ -4338,6 +4363,7 @@ export {
|
|
|
4338
4363
|
futureDateRegexp,
|
|
4339
4364
|
getStoreKey,
|
|
4340
4365
|
getStoreTabKey,
|
|
4366
|
+
getTimezoneOffset,
|
|
4341
4367
|
inputVal2Dayjs,
|
|
4342
4368
|
naturalDateRegexp,
|
|
4343
4369
|
naturalDateShortcutMap,
|
package/vue3/index.iife.min.js
CHANGED
|
@@ -24189,6 +24189,11 @@ ${$(r2)}`), n2;
|
|
|
24189
24189
|
}
|
|
24190
24190
|
return date;
|
|
24191
24191
|
};
|
|
24192
|
+
function getTimezoneOffset(timezone2) {
|
|
24193
|
+
const localTime = dayjs().tz(timezone2);
|
|
24194
|
+
const offset2 = localTime.utcOffset() / 60;
|
|
24195
|
+
return offset2;
|
|
24196
|
+
}
|
|
24192
24197
|
dayjs.extend(utc);
|
|
24193
24198
|
dayjs.extend(tz);
|
|
24194
24199
|
const timezoneData = [
|
|
@@ -26047,6 +26052,7 @@ ${$(r2)}`), n2;
|
|
|
26047
26052
|
const today = dayjs();
|
|
26048
26053
|
const isValidate = __WEBPACK_EXTERNAL_MODULE_vue__.ref(true);
|
|
26049
26054
|
const { validMsg, validateDateValue } = useValidate();
|
|
26055
|
+
const curTimezoneInfo = __WEBPACK_EXTERNAL_MODULE_vue__.ref(timezoneInfo.value || dayjs.tz.guess());
|
|
26050
26056
|
__WEBPACK_EXTERNAL_MODULE_vue__.watch(
|
|
26051
26057
|
() => props2.value,
|
|
26052
26058
|
(date) => {
|
|
@@ -26060,6 +26066,26 @@ ${$(r2)}`), n2;
|
|
|
26060
26066
|
immediate: true
|
|
26061
26067
|
}
|
|
26062
26068
|
);
|
|
26069
|
+
__WEBPACK_EXTERNAL_MODULE_vue__.watch(
|
|
26070
|
+
() => timezoneInfo,
|
|
26071
|
+
(newTimezone) => {
|
|
26072
|
+
if (!timezoneInfo.value) return;
|
|
26073
|
+
if (newTimezone.value.label === curTimezoneInfo.value.label) return;
|
|
26074
|
+
if (newTimezone.value.utc === curTimezoneInfo.value.utc) return;
|
|
26075
|
+
curTimezoneInfo.value = newTimezone.value || dayjs.tz.guess();
|
|
26076
|
+
if (startDate.value) {
|
|
26077
|
+
startDate.value = dayjs.tz(startDate.value, curTimezoneInfo.value.label);
|
|
26078
|
+
startInput.value.value = startDate.value.format(format.value);
|
|
26079
|
+
}
|
|
26080
|
+
if (endDate.value) {
|
|
26081
|
+
endDate.value = dayjs.tz(endDate.value, curTimezoneInfo.value.label);
|
|
26082
|
+
endInput.value.value = endDate.value.format(format.value);
|
|
26083
|
+
}
|
|
26084
|
+
},
|
|
26085
|
+
{
|
|
26086
|
+
deep: true
|
|
26087
|
+
}
|
|
26088
|
+
);
|
|
26063
26089
|
const canConfirm = __WEBPACK_EXTERNAL_MODULE_vue__.computed(() => {
|
|
26064
26090
|
if (!startDate.value || !endDate.value) return false;
|
|
26065
26091
|
if (!startDate.value.isValid() || !endDate.value.isValid()) return false;
|
|
@@ -26069,33 +26095,31 @@ ${$(r2)}`), n2;
|
|
|
26069
26095
|
return true;
|
|
26070
26096
|
});
|
|
26071
26097
|
const handleInputEnter = async (_2, type) => {
|
|
26072
|
-
|
|
26073
|
-
|
|
26074
|
-
|
|
26075
|
-
|
|
26076
|
-
|
|
26077
|
-
|
|
26078
|
-
|
|
26079
|
-
|
|
26080
|
-
|
|
26081
|
-
|
|
26082
|
-
|
|
26083
|
-
|
|
26084
|
-
|
|
26085
|
-
|
|
26086
|
-
|
|
26087
|
-
if (
|
|
26088
|
-
|
|
26089
|
-
|
|
26090
|
-
|
|
26091
|
-
|
|
26092
|
-
|
|
26093
|
-
handleEndTimeChange(!endDate.value ? date.endOf("d") : date);
|
|
26094
|
-
}
|
|
26098
|
+
var _a, _b, _c;
|
|
26099
|
+
const target = type === "start" ? startInput.value : endInput.value;
|
|
26100
|
+
const val = (_a = target == null ? void 0 : target.value) == null ? void 0 : _a.toString().trim();
|
|
26101
|
+
const editDate = type === "start" ? startDate.value : endDate.value;
|
|
26102
|
+
const curNow = type === "start" ? isStartNow : isEndNow;
|
|
26103
|
+
const otherNow = type === "start" ? isEndNow : isStartNow;
|
|
26104
|
+
const formatValue = editDate == null ? void 0 : editDate.format(format.value);
|
|
26105
|
+
if (val === formatValue) return;
|
|
26106
|
+
if (!val || val === NowConstant && curNow.value) return;
|
|
26107
|
+
if (val === NowConstant && !curNow.value && !otherNow.value) {
|
|
26108
|
+
handleIsNowChange(type);
|
|
26109
|
+
return;
|
|
26110
|
+
}
|
|
26111
|
+
let date = inputVal2Dayjs(val, format.value, editDate);
|
|
26112
|
+
if (date.isValid()) {
|
|
26113
|
+
if (!(editDate == null ? void 0 : editDate.isSame(date))) {
|
|
26114
|
+
curNow.value = val === NowConstant;
|
|
26115
|
+
if (type === "start") {
|
|
26116
|
+
handleStartTimeChange(!startDate.value ? date.startOf("d") : date);
|
|
26117
|
+
} else {
|
|
26118
|
+
handleEndTimeChange(!endDate.value ? date.endOf("d") : date);
|
|
26095
26119
|
}
|
|
26096
26120
|
}
|
|
26097
|
-
|
|
26098
|
-
|
|
26121
|
+
}
|
|
26122
|
+
target.value = type === "start" ? ((_b = startDate.value) == null ? void 0 : _b.format(format.value)) || "" : ((_c = endDate.value) == null ? void 0 : _c.format(format.value)) || "";
|
|
26099
26123
|
};
|
|
26100
26124
|
const handleFocusStart = () => {
|
|
26101
26125
|
showStartPanel.value = true;
|
|
@@ -26178,8 +26202,8 @@ ${$(r2)}`), n2;
|
|
|
26178
26202
|
};
|
|
26179
26203
|
const handleSubmit = () => {
|
|
26180
26204
|
if (startDate.value && endDate.value) {
|
|
26181
|
-
const startValue = isStartNow.value ? NowConstant : startDate.value.
|
|
26182
|
-
const endValue = isEndNow.value ? NowConstant : endDate.value.
|
|
26205
|
+
const startValue = isStartNow.value ? NowConstant : dayjs.tz(startDate.value.format(format.value), timezoneInfo.value.label).valueOf();
|
|
26206
|
+
const endValue = isEndNow.value ? NowConstant : dayjs.tz(endDate.value.format(format.value), timezoneInfo.value.label).valueOf();
|
|
26183
26207
|
isValidate.value = validateDateValue([startValue || "", endValue || ""]);
|
|
26184
26208
|
if (!isValidate.value) return;
|
|
26185
26209
|
emits("change", [startValue || "", endValue || ""]);
|
|
@@ -26213,10 +26237,11 @@ ${$(r2)}`), n2;
|
|
|
26213
26237
|
},
|
|
26214
26238
|
[
|
|
26215
26239
|
_hoisted_3$4,
|
|
26216
|
-
__WEBPACK_EXTERNAL_MODULE_vue__.
|
|
26240
|
+
(__WEBPACK_EXTERNAL_MODULE_vue__.openBlock(), __WEBPACK_EXTERNAL_MODULE_vue__.createBlock(__WEBPACK_EXTERNAL_MODULE_vue__.unref(__webpack_exports__default$9), {
|
|
26217
26241
|
"ext-cls": "__bk-date-picker-popover__ __date-picker-popover-start__",
|
|
26218
26242
|
arrow: false,
|
|
26219
26243
|
"is-show": showStartPanel.value,
|
|
26244
|
+
key: __WEBPACK_EXTERNAL_MODULE_vue__.unref(timezoneInfo).label,
|
|
26220
26245
|
boundary: "parent",
|
|
26221
26246
|
placement: "bottom-start",
|
|
26222
26247
|
theme: "light",
|
|
@@ -26254,12 +26279,13 @@ ${$(r2)}`), n2;
|
|
|
26254
26279
|
}),
|
|
26255
26280
|
_: 1
|
|
26256
26281
|
/* STABLE */
|
|
26257
|
-
}, 8, ["is-show"]),
|
|
26282
|
+
}, 8, ["is-show"])),
|
|
26258
26283
|
_hoisted_5$3,
|
|
26259
|
-
__WEBPACK_EXTERNAL_MODULE_vue__.
|
|
26284
|
+
(__WEBPACK_EXTERNAL_MODULE_vue__.openBlock(), __WEBPACK_EXTERNAL_MODULE_vue__.createBlock(__WEBPACK_EXTERNAL_MODULE_vue__.unref(__webpack_exports__default$9), {
|
|
26260
26285
|
"ext-cls": "__bk-date-picker-popover__ __date-picker-popover-end__",
|
|
26261
26286
|
arrow: false,
|
|
26262
26287
|
"is-show": showEndPanel.value,
|
|
26288
|
+
key: __WEBPACK_EXTERNAL_MODULE_vue__.unref(timezoneInfo).label,
|
|
26263
26289
|
boundary: "parent",
|
|
26264
26290
|
placement: "bottom-start",
|
|
26265
26291
|
theme: "light",
|
|
@@ -26296,7 +26322,7 @@ ${$(r2)}`), n2;
|
|
|
26296
26322
|
}),
|
|
26297
26323
|
_: 1
|
|
26298
26324
|
/* STABLE */
|
|
26299
|
-
}, 8, ["is-show"]),
|
|
26325
|
+
}, 8, ["is-show"])),
|
|
26300
26326
|
!!(startDate.value || endDate.value) ? (__WEBPACK_EXTERNAL_MODULE_vue__.openBlock(), __WEBPACK_EXTERNAL_MODULE_vue__.createBlock(__WEBPACK_EXTERNAL_MODULE_vue__.unref(__webpack_exports__default$m), {
|
|
26301
26327
|
key: 0,
|
|
26302
26328
|
class: "date-picker-clear",
|
|
@@ -27589,7 +27615,7 @@ ${$(r2)}`), n2;
|
|
|
27589
27615
|
const b2 = dayjs.tz(dayjs(), timezone2).utcOffset();
|
|
27590
27616
|
return (b2 - a2) / 60;
|
|
27591
27617
|
});
|
|
27592
|
-
const dateDetail = __WEBPACK_EXTERNAL_MODULE_vue__.shallowRef(new DateRange(props2.modelValue, props2.format
|
|
27618
|
+
const dateDetail = __WEBPACK_EXTERNAL_MODULE_vue__.shallowRef(new DateRange(props2.modelValue, props2.format));
|
|
27593
27619
|
const tooltipsDetail = __WEBPACK_EXTERNAL_MODULE_vue__.shallowRef();
|
|
27594
27620
|
const storeKey2 = __WEBPACK_EXTERNAL_MODULE_vue__.computed(() => getStoreKey(props2.version));
|
|
27595
27621
|
const datePanelShow = __WEBPACK_EXTERNAL_MODULE_vue__.ref(false);
|
|
@@ -27600,7 +27626,7 @@ ${$(r2)}`), n2;
|
|
|
27600
27626
|
var _a, _b;
|
|
27601
27627
|
if (((_b = (_a = dateDetail.value) == null ? void 0 : _a.dateValue) == null ? void 0 : _b.length) && dateDetail.value.dateValue.every((item, index) => item === (v2 == null ? void 0 : v2[index])))
|
|
27602
27628
|
return;
|
|
27603
|
-
dateDetail.value = new DateRange(v2, format.value
|
|
27629
|
+
dateDetail.value = new DateRange(v2, format.value);
|
|
27604
27630
|
},
|
|
27605
27631
|
{
|
|
27606
27632
|
immediate: true
|
|
@@ -27629,7 +27655,7 @@ ${$(r2)}`), n2;
|
|
|
27629
27655
|
if (enterTimer) return;
|
|
27630
27656
|
enterTimer = setTimeout(() => {
|
|
27631
27657
|
tooltipsShow.value = true;
|
|
27632
|
-
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value
|
|
27658
|
+
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value);
|
|
27633
27659
|
enterTimer = null;
|
|
27634
27660
|
}, 100);
|
|
27635
27661
|
}
|
|
@@ -27652,7 +27678,6 @@ ${$(r2)}`), n2;
|
|
|
27652
27678
|
!canStore && dateDetail.value.isValidate && setStoreDateList(val, storeKey2.value);
|
|
27653
27679
|
};
|
|
27654
27680
|
const handleTimezoneChange = (val, info) => {
|
|
27655
|
-
dateDetail.value = new DateRange(props2.modelValue, format.value, val);
|
|
27656
27681
|
emits("update:timezone", val, { ...info });
|
|
27657
27682
|
sessionStorage.setItem(timezoneStoreKey, val);
|
|
27658
27683
|
};
|
|
@@ -27666,8 +27691,8 @@ ${$(r2)}`), n2;
|
|
|
27666
27691
|
const durations = dateDetail.value.dateDuration();
|
|
27667
27692
|
const val = type === "left" ? [startDate.subtract(durations), endDate.subtract(durations)] : [startDate.add(durations), endDate.add(durations)];
|
|
27668
27693
|
if ((_b = props2.validDateRange) == null ? void 0 : _b.length) {
|
|
27669
|
-
const validDateRange = new DateRange(props2.validDateRange, props2.format
|
|
27670
|
-
if (!validDateRange.isInValidDateRange(new DateRange(val, props2.format
|
|
27694
|
+
const validDateRange = new DateRange(props2.validDateRange, props2.format);
|
|
27695
|
+
if (!validDateRange.isInValidDateRange(new DateRange(val, props2.format))) return;
|
|
27671
27696
|
}
|
|
27672
27697
|
handleChange(val);
|
|
27673
27698
|
};
|
|
@@ -27873,6 +27898,7 @@ ${$(r2)}`), n2;
|
|
|
27873
27898
|
exports.futureDateRegexp = futureDateRegexp;
|
|
27874
27899
|
exports.getStoreKey = getStoreKey;
|
|
27875
27900
|
exports.getStoreTabKey = getStoreTabKey;
|
|
27901
|
+
exports.getTimezoneOffset = getTimezoneOffset;
|
|
27876
27902
|
exports.inputVal2Dayjs = inputVal2Dayjs;
|
|
27877
27903
|
exports.naturalDateRegexp = naturalDateRegexp;
|
|
27878
27904
|
exports.naturalDateShortcutMap = naturalDateShortcutMap;
|
package/vue3/index.umd.min.js
CHANGED
|
@@ -649,6 +649,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
649
649
|
}
|
|
650
650
|
return date;
|
|
651
651
|
};
|
|
652
|
+
function getTimezoneOffset(timezone) {
|
|
653
|
+
const localTime = dayjs().tz(timezone);
|
|
654
|
+
const offset = localTime.utcOffset() / 60;
|
|
655
|
+
return offset;
|
|
656
|
+
}
|
|
652
657
|
dayjs.extend(utc);
|
|
653
658
|
dayjs.extend(tz);
|
|
654
659
|
const timezoneData = [
|
|
@@ -2507,6 +2512,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2507
2512
|
const today = dayjs();
|
|
2508
2513
|
const isValidate = vue.ref(true);
|
|
2509
2514
|
const { validMsg, validateDateValue } = useValidate();
|
|
2515
|
+
const curTimezoneInfo = vue.ref(timezoneInfo.value || dayjs.tz.guess());
|
|
2510
2516
|
vue.watch(
|
|
2511
2517
|
() => props.value,
|
|
2512
2518
|
(date) => {
|
|
@@ -2520,6 +2526,26 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2520
2526
|
immediate: true
|
|
2521
2527
|
}
|
|
2522
2528
|
);
|
|
2529
|
+
vue.watch(
|
|
2530
|
+
() => timezoneInfo,
|
|
2531
|
+
(newTimezone) => {
|
|
2532
|
+
if (!timezoneInfo.value) return;
|
|
2533
|
+
if (newTimezone.value.label === curTimezoneInfo.value.label) return;
|
|
2534
|
+
if (newTimezone.value.utc === curTimezoneInfo.value.utc) return;
|
|
2535
|
+
curTimezoneInfo.value = newTimezone.value || dayjs.tz.guess();
|
|
2536
|
+
if (startDate.value) {
|
|
2537
|
+
startDate.value = dayjs.tz(startDate.value, curTimezoneInfo.value.label);
|
|
2538
|
+
startInput.value.value = startDate.value.format(format.value);
|
|
2539
|
+
}
|
|
2540
|
+
if (endDate.value) {
|
|
2541
|
+
endDate.value = dayjs.tz(endDate.value, curTimezoneInfo.value.label);
|
|
2542
|
+
endInput.value.value = endDate.value.format(format.value);
|
|
2543
|
+
}
|
|
2544
|
+
},
|
|
2545
|
+
{
|
|
2546
|
+
deep: true
|
|
2547
|
+
}
|
|
2548
|
+
);
|
|
2523
2549
|
const canConfirm = vue.computed(() => {
|
|
2524
2550
|
if (!startDate.value || !endDate.value) return false;
|
|
2525
2551
|
if (!startDate.value.isValid() || !endDate.value.isValid()) return false;
|
|
@@ -2529,33 +2555,31 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2529
2555
|
return true;
|
|
2530
2556
|
});
|
|
2531
2557
|
const handleInputEnter = async (_, type) => {
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
if (
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
handleEndTimeChange(!endDate.value ? date.endOf("d") : date);
|
|
2554
|
-
}
|
|
2558
|
+
var _a, _b, _c;
|
|
2559
|
+
const target = type === "start" ? startInput.value : endInput.value;
|
|
2560
|
+
const val = (_a = target == null ? void 0 : target.value) == null ? void 0 : _a.toString().trim();
|
|
2561
|
+
const editDate = type === "start" ? startDate.value : endDate.value;
|
|
2562
|
+
const curNow = type === "start" ? isStartNow : isEndNow;
|
|
2563
|
+
const otherNow = type === "start" ? isEndNow : isStartNow;
|
|
2564
|
+
const formatValue = editDate == null ? void 0 : editDate.format(format.value);
|
|
2565
|
+
if (val === formatValue) return;
|
|
2566
|
+
if (!val || val === NowConstant && curNow.value) return;
|
|
2567
|
+
if (val === NowConstant && !curNow.value && !otherNow.value) {
|
|
2568
|
+
handleIsNowChange(type);
|
|
2569
|
+
return;
|
|
2570
|
+
}
|
|
2571
|
+
let date = inputVal2Dayjs(val, format.value, editDate);
|
|
2572
|
+
if (date.isValid()) {
|
|
2573
|
+
if (!(editDate == null ? void 0 : editDate.isSame(date))) {
|
|
2574
|
+
curNow.value = val === NowConstant;
|
|
2575
|
+
if (type === "start") {
|
|
2576
|
+
handleStartTimeChange(!startDate.value ? date.startOf("d") : date);
|
|
2577
|
+
} else {
|
|
2578
|
+
handleEndTimeChange(!endDate.value ? date.endOf("d") : date);
|
|
2555
2579
|
}
|
|
2556
2580
|
}
|
|
2557
|
-
|
|
2558
|
-
|
|
2581
|
+
}
|
|
2582
|
+
target.value = type === "start" ? ((_b = startDate.value) == null ? void 0 : _b.format(format.value)) || "" : ((_c = endDate.value) == null ? void 0 : _c.format(format.value)) || "";
|
|
2559
2583
|
};
|
|
2560
2584
|
const handleFocusStart = () => {
|
|
2561
2585
|
showStartPanel.value = true;
|
|
@@ -2638,8 +2662,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2638
2662
|
};
|
|
2639
2663
|
const handleSubmit = () => {
|
|
2640
2664
|
if (startDate.value && endDate.value) {
|
|
2641
|
-
const startValue = isStartNow.value ? NowConstant : startDate.value.
|
|
2642
|
-
const endValue = isEndNow.value ? NowConstant : endDate.value.
|
|
2665
|
+
const startValue = isStartNow.value ? NowConstant : dayjs.tz(startDate.value.format(format.value), timezoneInfo.value.label).valueOf();
|
|
2666
|
+
const endValue = isEndNow.value ? NowConstant : dayjs.tz(endDate.value.format(format.value), timezoneInfo.value.label).valueOf();
|
|
2643
2667
|
isValidate.value = validateDateValue([startValue || "", endValue || ""]);
|
|
2644
2668
|
if (!isValidate.value) return;
|
|
2645
2669
|
emits("change", [startValue || "", endValue || ""]);
|
|
@@ -2673,10 +2697,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2673
2697
|
},
|
|
2674
2698
|
[
|
|
2675
2699
|
_hoisted_3$4,
|
|
2676
|
-
vue.
|
|
2700
|
+
(vue.openBlock(), vue.createBlock(vue.unref(bkuiVue.Popover), {
|
|
2677
2701
|
"ext-cls": "__bk-date-picker-popover__ __date-picker-popover-start__",
|
|
2678
2702
|
arrow: false,
|
|
2679
2703
|
"is-show": showStartPanel.value,
|
|
2704
|
+
key: vue.unref(timezoneInfo).label,
|
|
2680
2705
|
boundary: "parent",
|
|
2681
2706
|
placement: "bottom-start",
|
|
2682
2707
|
theme: "light",
|
|
@@ -2714,12 +2739,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2714
2739
|
}),
|
|
2715
2740
|
_: 1
|
|
2716
2741
|
/* STABLE */
|
|
2717
|
-
}, 8, ["is-show"]),
|
|
2742
|
+
}, 8, ["is-show"])),
|
|
2718
2743
|
_hoisted_5$3,
|
|
2719
|
-
vue.
|
|
2744
|
+
(vue.openBlock(), vue.createBlock(vue.unref(bkuiVue.Popover), {
|
|
2720
2745
|
"ext-cls": "__bk-date-picker-popover__ __date-picker-popover-end__",
|
|
2721
2746
|
arrow: false,
|
|
2722
2747
|
"is-show": showEndPanel.value,
|
|
2748
|
+
key: vue.unref(timezoneInfo).label,
|
|
2723
2749
|
boundary: "parent",
|
|
2724
2750
|
placement: "bottom-start",
|
|
2725
2751
|
theme: "light",
|
|
@@ -2756,7 +2782,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2756
2782
|
}),
|
|
2757
2783
|
_: 1
|
|
2758
2784
|
/* STABLE */
|
|
2759
|
-
}, 8, ["is-show"]),
|
|
2785
|
+
}, 8, ["is-show"])),
|
|
2760
2786
|
!!(startDate.value || endDate.value) ? (vue.openBlock(), vue.createBlock(vue.unref(icon.Close), {
|
|
2761
2787
|
key: 0,
|
|
2762
2788
|
class: "date-picker-clear",
|
|
@@ -4049,7 +4075,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4049
4075
|
const b = dayjs.tz(dayjs(), timezone).utcOffset();
|
|
4050
4076
|
return (b - a) / 60;
|
|
4051
4077
|
});
|
|
4052
|
-
const dateDetail = vue.shallowRef(new DateRange(props.modelValue, props.format
|
|
4078
|
+
const dateDetail = vue.shallowRef(new DateRange(props.modelValue, props.format));
|
|
4053
4079
|
const tooltipsDetail = vue.shallowRef();
|
|
4054
4080
|
const storeKey2 = vue.computed(() => getStoreKey(props.version));
|
|
4055
4081
|
const datePanelShow = vue.ref(false);
|
|
@@ -4060,7 +4086,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4060
4086
|
var _a, _b;
|
|
4061
4087
|
if (((_b = (_a = dateDetail.value) == null ? void 0 : _a.dateValue) == null ? void 0 : _b.length) && dateDetail.value.dateValue.every((item, index) => item === (v == null ? void 0 : v[index])))
|
|
4062
4088
|
return;
|
|
4063
|
-
dateDetail.value = new DateRange(v, format.value
|
|
4089
|
+
dateDetail.value = new DateRange(v, format.value);
|
|
4064
4090
|
},
|
|
4065
4091
|
{
|
|
4066
4092
|
immediate: true
|
|
@@ -4089,7 +4115,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4089
4115
|
if (enterTimer) return;
|
|
4090
4116
|
enterTimer = setTimeout(() => {
|
|
4091
4117
|
tooltipsShow.value = true;
|
|
4092
|
-
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value
|
|
4118
|
+
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value);
|
|
4093
4119
|
enterTimer = null;
|
|
4094
4120
|
}, 100);
|
|
4095
4121
|
}
|
|
@@ -4112,7 +4138,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4112
4138
|
!canStore && dateDetail.value.isValidate && setStoreDateList(val, storeKey2.value);
|
|
4113
4139
|
};
|
|
4114
4140
|
const handleTimezoneChange = (val, info) => {
|
|
4115
|
-
dateDetail.value = new DateRange(props.modelValue, format.value, val);
|
|
4116
4141
|
emits("update:timezone", val, { ...info });
|
|
4117
4142
|
sessionStorage.setItem(timezoneStoreKey, val);
|
|
4118
4143
|
};
|
|
@@ -4126,8 +4151,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4126
4151
|
const durations = dateDetail.value.dateDuration();
|
|
4127
4152
|
const val = type === "left" ? [startDate.subtract(durations), endDate.subtract(durations)] : [startDate.add(durations), endDate.add(durations)];
|
|
4128
4153
|
if ((_b = props.validDateRange) == null ? void 0 : _b.length) {
|
|
4129
|
-
const validDateRange = new DateRange(props.validDateRange, props.format
|
|
4130
|
-
if (!validDateRange.isInValidDateRange(new DateRange(val, props.format
|
|
4154
|
+
const validDateRange = new DateRange(props.validDateRange, props.format);
|
|
4155
|
+
if (!validDateRange.isInValidDateRange(new DateRange(val, props.format))) return;
|
|
4131
4156
|
}
|
|
4132
4157
|
handleChange(val);
|
|
4133
4158
|
};
|
|
@@ -4333,6 +4358,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4333
4358
|
exports2.futureDateRegexp = futureDateRegexp;
|
|
4334
4359
|
exports2.getStoreKey = getStoreKey;
|
|
4335
4360
|
exports2.getStoreTabKey = getStoreTabKey;
|
|
4361
|
+
exports2.getTimezoneOffset = getTimezoneOffset;
|
|
4336
4362
|
exports2.inputVal2Dayjs = inputVal2Dayjs;
|
|
4337
4363
|
exports2.naturalDateRegexp = naturalDateRegexp;
|
|
4338
4364
|
exports2.naturalDateShortcutMap = naturalDateShortcutMap;
|