@blueking/date-picker 3.0.2 → 3.0.4
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/vue2/index.es.min.js +45 -12
- package/vue2/index.iife.min.js +45 -12
- package/vue2/index.umd.min.js +45 -12
- package/vue3/index.es.min.js +45 -12
- package/vue3/index.iife.min.js +45 -12
- package/vue3/index.umd.min.js +45 -12
package/package.json
CHANGED
package/vue2/index.es.min.js
CHANGED
|
@@ -24494,6 +24494,40 @@ const t = (key) => {
|
|
|
24494
24494
|
};
|
|
24495
24495
|
dayjs.extend(utc);
|
|
24496
24496
|
dayjs.extend(tz);
|
|
24497
|
+
const getDynamicTimezoneInfo = (timezone) => {
|
|
24498
|
+
try {
|
|
24499
|
+
const now2 = dayjs().tz(timezone);
|
|
24500
|
+
const offsetMinutes = now2.utcOffset();
|
|
24501
|
+
const hours = Math.floor(Math.abs(offsetMinutes) / 60);
|
|
24502
|
+
const minutes = Math.abs(offsetMinutes) % 60;
|
|
24503
|
+
const sign = offsetMinutes >= 0 ? "+" : "-";
|
|
24504
|
+
const utcOffset = minutes > 0 ? `utc${sign}${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}` : `utc${sign}${String(hours).padStart(2, "0")}:00`;
|
|
24505
|
+
const abbreviation = getTimezoneAbbreviation(timezone);
|
|
24506
|
+
return { abbreviation: abbreviation.toLowerCase(), utcOffset: utcOffset.toLowerCase() };
|
|
24507
|
+
} catch {
|
|
24508
|
+
return { abbreviation: "", utcOffset: "" };
|
|
24509
|
+
}
|
|
24510
|
+
};
|
|
24511
|
+
const getTimezoneAbbreviation = (timezone) => {
|
|
24512
|
+
try {
|
|
24513
|
+
const formatter = new Intl.DateTimeFormat("en-US", {
|
|
24514
|
+
timeZone: timezone,
|
|
24515
|
+
timeZoneName: "short"
|
|
24516
|
+
});
|
|
24517
|
+
const parts = formatter.formatToParts(/* @__PURE__ */ new Date());
|
|
24518
|
+
const tzPart = parts.find((part) => part.type === "timeZoneName");
|
|
24519
|
+
return (tzPart == null ? void 0 : tzPart.value) || "";
|
|
24520
|
+
} catch {
|
|
24521
|
+
return "";
|
|
24522
|
+
}
|
|
24523
|
+
};
|
|
24524
|
+
const updateSearchIndex = (searchIndex, timezone) => {
|
|
24525
|
+
const parts = searchIndex.split("|");
|
|
24526
|
+
const { abbreviation, utcOffset } = getDynamicTimezoneInfo(timezone);
|
|
24527
|
+
parts[1] = abbreviation;
|
|
24528
|
+
parts[2] = utcOffset;
|
|
24529
|
+
return parts.join("|");
|
|
24530
|
+
};
|
|
24497
24531
|
const timezoneData = [
|
|
24498
24532
|
{
|
|
24499
24533
|
label: "Africa",
|
|
@@ -25838,9 +25872,11 @@ const getTimezoneDetails = () => {
|
|
|
25838
25872
|
return {
|
|
25839
25873
|
label: group.label,
|
|
25840
25874
|
options: group.options.map((option) => {
|
|
25875
|
+
const dynamicSearchIndex = updateSearchIndex(option.searchIndex, option.value);
|
|
25841
25876
|
const info = {
|
|
25842
25877
|
...option,
|
|
25843
|
-
|
|
25878
|
+
searchIndex: dynamicSearchIndex,
|
|
25879
|
+
...getTimezoneInfo(dynamicSearchIndex)
|
|
25844
25880
|
};
|
|
25845
25881
|
if (option.value === browserTimeZone) {
|
|
25846
25882
|
defaultTimezoneList.push({
|
|
@@ -28563,7 +28599,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
28563
28599
|
});
|
|
28564
28600
|
const props2 = __props;
|
|
28565
28601
|
const emits = __emit;
|
|
28566
|
-
const dateTooltipsRef = ref();
|
|
28567
28602
|
const dateContentRef = ref();
|
|
28568
28603
|
const format = ref(props2.format);
|
|
28569
28604
|
const timezoneInfo = computed(() => {
|
|
@@ -28581,8 +28616,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
28581
28616
|
const b2 = dayjs.tz(dayjs(), timezone).utcOffset();
|
|
28582
28617
|
return (b2 - a2) / 60;
|
|
28583
28618
|
});
|
|
28584
|
-
const dateDetail = shallowRef(new DateRange(props2.modelValue, props2.format
|
|
28585
|
-
const tooltipsDetail = shallowRef();
|
|
28619
|
+
const dateDetail = shallowRef(new DateRange(props2.modelValue, props2.format));
|
|
28620
|
+
const tooltipsDetail = shallowRef(new DateRange(dateDetail.value.dateValue, format.value));
|
|
28586
28621
|
const storeKey2 = computed(() => getStoreKey(props2.version));
|
|
28587
28622
|
const datePanelShow = ref(false);
|
|
28588
28623
|
const tooltipsShow = ref(false);
|
|
@@ -28644,14 +28679,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
28644
28679
|
tooltipsShow.value = false;
|
|
28645
28680
|
datePanelShow.value = false;
|
|
28646
28681
|
});
|
|
28682
|
+
watch([() => props2.modelValue, () => props2.format, () => props2.timezone], () => {
|
|
28683
|
+
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value, timezoneInfo.value.label);
|
|
28684
|
+
});
|
|
28647
28685
|
function handleDateMouseenter() {
|
|
28648
28686
|
if (enterTimer) return;
|
|
28649
28687
|
enterTimer = setTimeout(() => {
|
|
28650
28688
|
tooltipsShow.value = true;
|
|
28651
|
-
console.log("handleDateMouseenter", dateDetail.value, format.value, timezoneInfo.value.label);
|
|
28652
|
-
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value, timezoneInfo.value.label);
|
|
28653
28689
|
enterTimer = null;
|
|
28654
|
-
},
|
|
28690
|
+
}, 100);
|
|
28655
28691
|
}
|
|
28656
28692
|
function handleDateMouseleave() {
|
|
28657
28693
|
if (leaveTimer) clearTimeout(leaveTimer);
|
|
@@ -28673,9 +28709,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
28673
28709
|
const endDate = Array.isArray(item == null ? void 0 : item.id) ? item.id[1] : item[1];
|
|
28674
28710
|
return startDate === start2 && endDate === end2;
|
|
28675
28711
|
});
|
|
28676
|
-
|
|
28677
|
-
setStoreDateList(val, storeKey2.value);
|
|
28678
|
-
}
|
|
28712
|
+
!canStore && dateDetail.value.isValidate && setStoreDateList(val, storeKey2.value);
|
|
28679
28713
|
};
|
|
28680
28714
|
const handleTimezoneChange = (val, info) => {
|
|
28681
28715
|
dateDetail.value = new DateRange(props2.modelValue, format.value, val);
|
|
@@ -28846,8 +28880,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
28846
28880
|
createElementVNode(
|
|
28847
28881
|
"div",
|
|
28848
28882
|
{
|
|
28849
|
-
|
|
28850
|
-
ref: dateTooltipsRef,
|
|
28883
|
+
ref: "dateTooltipsRef",
|
|
28851
28884
|
class: "__date-tooltips__",
|
|
28852
28885
|
style: normalizeStyle({ maxWidth: unref(lang) === "en" ? "210px" : "156px" })
|
|
28853
28886
|
},
|
package/vue2/index.iife.min.js
CHANGED
|
@@ -32065,6 +32065,40 @@ ${$(r2)}`), n2;
|
|
|
32065
32065
|
};
|
|
32066
32066
|
dayjs.extend(utc);
|
|
32067
32067
|
dayjs.extend(tz);
|
|
32068
|
+
const getDynamicTimezoneInfo = (timezone2) => {
|
|
32069
|
+
try {
|
|
32070
|
+
const now2 = dayjs().tz(timezone2);
|
|
32071
|
+
const offsetMinutes = now2.utcOffset();
|
|
32072
|
+
const hours = Math.floor(Math.abs(offsetMinutes) / 60);
|
|
32073
|
+
const minutes = Math.abs(offsetMinutes) % 60;
|
|
32074
|
+
const sign = offsetMinutes >= 0 ? "+" : "-";
|
|
32075
|
+
const utcOffset = minutes > 0 ? `utc${sign}${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}` : `utc${sign}${String(hours).padStart(2, "0")}:00`;
|
|
32076
|
+
const abbreviation = getTimezoneAbbreviation(timezone2);
|
|
32077
|
+
return { abbreviation: abbreviation.toLowerCase(), utcOffset: utcOffset.toLowerCase() };
|
|
32078
|
+
} catch {
|
|
32079
|
+
return { abbreviation: "", utcOffset: "" };
|
|
32080
|
+
}
|
|
32081
|
+
};
|
|
32082
|
+
const getTimezoneAbbreviation = (timezone2) => {
|
|
32083
|
+
try {
|
|
32084
|
+
const formatter = new Intl.DateTimeFormat("en-US", {
|
|
32085
|
+
timeZone: timezone2,
|
|
32086
|
+
timeZoneName: "short"
|
|
32087
|
+
});
|
|
32088
|
+
const parts = formatter.formatToParts(/* @__PURE__ */ new Date());
|
|
32089
|
+
const tzPart = parts.find((part) => part.type === "timeZoneName");
|
|
32090
|
+
return (tzPart == null ? void 0 : tzPart.value) || "";
|
|
32091
|
+
} catch {
|
|
32092
|
+
return "";
|
|
32093
|
+
}
|
|
32094
|
+
};
|
|
32095
|
+
const updateSearchIndex = (searchIndex, timezone2) => {
|
|
32096
|
+
const parts = searchIndex.split("|");
|
|
32097
|
+
const { abbreviation, utcOffset } = getDynamicTimezoneInfo(timezone2);
|
|
32098
|
+
parts[1] = abbreviation;
|
|
32099
|
+
parts[2] = utcOffset;
|
|
32100
|
+
return parts.join("|");
|
|
32101
|
+
};
|
|
32068
32102
|
const timezoneData = [
|
|
32069
32103
|
{
|
|
32070
32104
|
label: "Africa",
|
|
@@ -33409,9 +33443,11 @@ ${$(r2)}`), n2;
|
|
|
33409
33443
|
return {
|
|
33410
33444
|
label: group.label,
|
|
33411
33445
|
options: group.options.map((option) => {
|
|
33446
|
+
const dynamicSearchIndex = updateSearchIndex(option.searchIndex, option.value);
|
|
33412
33447
|
const info = {
|
|
33413
33448
|
...option,
|
|
33414
|
-
|
|
33449
|
+
searchIndex: dynamicSearchIndex,
|
|
33450
|
+
...getTimezoneInfo(dynamicSearchIndex)
|
|
33415
33451
|
};
|
|
33416
33452
|
if (option.value === browserTimeZone) {
|
|
33417
33453
|
defaultTimezoneList.push({
|
|
@@ -36166,7 +36202,6 @@ ${$(r2)}`), n2;
|
|
|
36166
36202
|
});
|
|
36167
36203
|
const props2 = __props;
|
|
36168
36204
|
const emits = __emit;
|
|
36169
|
-
const dateTooltipsRef = ref();
|
|
36170
36205
|
const dateContentRef = ref();
|
|
36171
36206
|
const format = ref(props2.format);
|
|
36172
36207
|
const timezoneInfo = computed(() => {
|
|
@@ -36184,8 +36219,8 @@ ${$(r2)}`), n2;
|
|
|
36184
36219
|
const b2 = dayjs.tz(dayjs(), timezone2).utcOffset();
|
|
36185
36220
|
return (b2 - a2) / 60;
|
|
36186
36221
|
});
|
|
36187
|
-
const dateDetail = shallowRef(new DateRange(props2.modelValue, props2.format
|
|
36188
|
-
const tooltipsDetail = shallowRef();
|
|
36222
|
+
const dateDetail = shallowRef(new DateRange(props2.modelValue, props2.format));
|
|
36223
|
+
const tooltipsDetail = shallowRef(new DateRange(dateDetail.value.dateValue, format.value));
|
|
36189
36224
|
const storeKey2 = computed(() => getStoreKey(props2.version));
|
|
36190
36225
|
const datePanelShow = ref(false);
|
|
36191
36226
|
const tooltipsShow = ref(false);
|
|
@@ -36247,14 +36282,15 @@ ${$(r2)}`), n2;
|
|
|
36247
36282
|
tooltipsShow.value = false;
|
|
36248
36283
|
datePanelShow.value = false;
|
|
36249
36284
|
});
|
|
36285
|
+
watch([() => props2.modelValue, () => props2.format, () => props2.timezone], () => {
|
|
36286
|
+
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value, timezoneInfo.value.label);
|
|
36287
|
+
});
|
|
36250
36288
|
function handleDateMouseenter() {
|
|
36251
36289
|
if (enterTimer) return;
|
|
36252
36290
|
enterTimer = setTimeout(() => {
|
|
36253
36291
|
tooltipsShow.value = true;
|
|
36254
|
-
console.log("handleDateMouseenter", dateDetail.value, format.value, timezoneInfo.value.label);
|
|
36255
|
-
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value, timezoneInfo.value.label);
|
|
36256
36292
|
enterTimer = null;
|
|
36257
|
-
},
|
|
36293
|
+
}, 100);
|
|
36258
36294
|
}
|
|
36259
36295
|
function handleDateMouseleave() {
|
|
36260
36296
|
if (leaveTimer) clearTimeout(leaveTimer);
|
|
@@ -36276,9 +36312,7 @@ ${$(r2)}`), n2;
|
|
|
36276
36312
|
const endDate = Array.isArray(item == null ? void 0 : item.id) ? item.id[1] : item[1];
|
|
36277
36313
|
return startDate === start2 && endDate === end2;
|
|
36278
36314
|
});
|
|
36279
|
-
|
|
36280
|
-
setStoreDateList(val, storeKey2.value);
|
|
36281
|
-
}
|
|
36315
|
+
!canStore && dateDetail.value.isValidate && setStoreDateList(val, storeKey2.value);
|
|
36282
36316
|
};
|
|
36283
36317
|
const handleTimezoneChange = (val, info) => {
|
|
36284
36318
|
dateDetail.value = new DateRange(props2.modelValue, format.value, val);
|
|
@@ -36449,8 +36483,7 @@ ${$(r2)}`), n2;
|
|
|
36449
36483
|
createBaseVNode(
|
|
36450
36484
|
"div",
|
|
36451
36485
|
{
|
|
36452
|
-
|
|
36453
|
-
ref: dateTooltipsRef,
|
|
36486
|
+
ref: "dateTooltipsRef",
|
|
36454
36487
|
class: "__date-tooltips__",
|
|
36455
36488
|
style: normalizeStyle({ maxWidth: unref(lang) === "en" ? "210px" : "156px" })
|
|
36456
36489
|
},
|
package/vue2/index.umd.min.js
CHANGED
|
@@ -24509,6 +24509,40 @@ ${$(r2)}`), n2;
|
|
|
24509
24509
|
};
|
|
24510
24510
|
dayjs.extend(utc);
|
|
24511
24511
|
dayjs.extend(tz);
|
|
24512
|
+
const getDynamicTimezoneInfo = (timezone) => {
|
|
24513
|
+
try {
|
|
24514
|
+
const now2 = dayjs().tz(timezone);
|
|
24515
|
+
const offsetMinutes = now2.utcOffset();
|
|
24516
|
+
const hours = Math.floor(Math.abs(offsetMinutes) / 60);
|
|
24517
|
+
const minutes = Math.abs(offsetMinutes) % 60;
|
|
24518
|
+
const sign = offsetMinutes >= 0 ? "+" : "-";
|
|
24519
|
+
const utcOffset = minutes > 0 ? `utc${sign}${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}` : `utc${sign}${String(hours).padStart(2, "0")}:00`;
|
|
24520
|
+
const abbreviation = getTimezoneAbbreviation(timezone);
|
|
24521
|
+
return { abbreviation: abbreviation.toLowerCase(), utcOffset: utcOffset.toLowerCase() };
|
|
24522
|
+
} catch {
|
|
24523
|
+
return { abbreviation: "", utcOffset: "" };
|
|
24524
|
+
}
|
|
24525
|
+
};
|
|
24526
|
+
const getTimezoneAbbreviation = (timezone) => {
|
|
24527
|
+
try {
|
|
24528
|
+
const formatter = new Intl.DateTimeFormat("en-US", {
|
|
24529
|
+
timeZone: timezone,
|
|
24530
|
+
timeZoneName: "short"
|
|
24531
|
+
});
|
|
24532
|
+
const parts = formatter.formatToParts(/* @__PURE__ */ new Date());
|
|
24533
|
+
const tzPart = parts.find((part) => part.type === "timeZoneName");
|
|
24534
|
+
return (tzPart == null ? void 0 : tzPart.value) || "";
|
|
24535
|
+
} catch {
|
|
24536
|
+
return "";
|
|
24537
|
+
}
|
|
24538
|
+
};
|
|
24539
|
+
const updateSearchIndex = (searchIndex, timezone) => {
|
|
24540
|
+
const parts = searchIndex.split("|");
|
|
24541
|
+
const { abbreviation, utcOffset } = getDynamicTimezoneInfo(timezone);
|
|
24542
|
+
parts[1] = abbreviation;
|
|
24543
|
+
parts[2] = utcOffset;
|
|
24544
|
+
return parts.join("|");
|
|
24545
|
+
};
|
|
24512
24546
|
const timezoneData = [
|
|
24513
24547
|
{
|
|
24514
24548
|
label: "Africa",
|
|
@@ -25853,9 +25887,11 @@ ${$(r2)}`), n2;
|
|
|
25853
25887
|
return {
|
|
25854
25888
|
label: group.label,
|
|
25855
25889
|
options: group.options.map((option) => {
|
|
25890
|
+
const dynamicSearchIndex = updateSearchIndex(option.searchIndex, option.value);
|
|
25856
25891
|
const info = {
|
|
25857
25892
|
...option,
|
|
25858
|
-
|
|
25893
|
+
searchIndex: dynamicSearchIndex,
|
|
25894
|
+
...getTimezoneInfo(dynamicSearchIndex)
|
|
25859
25895
|
};
|
|
25860
25896
|
if (option.value === browserTimeZone) {
|
|
25861
25897
|
defaultTimezoneList.push({
|
|
@@ -28578,7 +28614,6 @@ ${$(r2)}`), n2;
|
|
|
28578
28614
|
});
|
|
28579
28615
|
const props2 = __props;
|
|
28580
28616
|
const emits = __emit;
|
|
28581
|
-
const dateTooltipsRef = __WEBPACK_EXTERNAL_MODULE_vue__.ref();
|
|
28582
28617
|
const dateContentRef = __WEBPACK_EXTERNAL_MODULE_vue__.ref();
|
|
28583
28618
|
const format = __WEBPACK_EXTERNAL_MODULE_vue__.ref(props2.format);
|
|
28584
28619
|
const timezoneInfo = __WEBPACK_EXTERNAL_MODULE_vue__.computed(() => {
|
|
@@ -28596,8 +28631,8 @@ ${$(r2)}`), n2;
|
|
|
28596
28631
|
const b2 = dayjs.tz(dayjs(), timezone).utcOffset();
|
|
28597
28632
|
return (b2 - a2) / 60;
|
|
28598
28633
|
});
|
|
28599
|
-
const dateDetail = __WEBPACK_EXTERNAL_MODULE_vue__.shallowRef(new DateRange(props2.modelValue, props2.format
|
|
28600
|
-
const tooltipsDetail = __WEBPACK_EXTERNAL_MODULE_vue__.shallowRef();
|
|
28634
|
+
const dateDetail = __WEBPACK_EXTERNAL_MODULE_vue__.shallowRef(new DateRange(props2.modelValue, props2.format));
|
|
28635
|
+
const tooltipsDetail = __WEBPACK_EXTERNAL_MODULE_vue__.shallowRef(new DateRange(dateDetail.value.dateValue, format.value));
|
|
28601
28636
|
const storeKey2 = __WEBPACK_EXTERNAL_MODULE_vue__.computed(() => getStoreKey(props2.version));
|
|
28602
28637
|
const datePanelShow = __WEBPACK_EXTERNAL_MODULE_vue__.ref(false);
|
|
28603
28638
|
const tooltipsShow = __WEBPACK_EXTERNAL_MODULE_vue__.ref(false);
|
|
@@ -28659,14 +28694,15 @@ ${$(r2)}`), n2;
|
|
|
28659
28694
|
tooltipsShow.value = false;
|
|
28660
28695
|
datePanelShow.value = false;
|
|
28661
28696
|
});
|
|
28697
|
+
__WEBPACK_EXTERNAL_MODULE_vue__.watch([() => props2.modelValue, () => props2.format, () => props2.timezone], () => {
|
|
28698
|
+
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value, timezoneInfo.value.label);
|
|
28699
|
+
});
|
|
28662
28700
|
function handleDateMouseenter() {
|
|
28663
28701
|
if (enterTimer) return;
|
|
28664
28702
|
enterTimer = setTimeout(() => {
|
|
28665
28703
|
tooltipsShow.value = true;
|
|
28666
|
-
console.log("handleDateMouseenter", dateDetail.value, format.value, timezoneInfo.value.label);
|
|
28667
|
-
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value, timezoneInfo.value.label);
|
|
28668
28704
|
enterTimer = null;
|
|
28669
|
-
},
|
|
28705
|
+
}, 100);
|
|
28670
28706
|
}
|
|
28671
28707
|
function handleDateMouseleave() {
|
|
28672
28708
|
if (leaveTimer) clearTimeout(leaveTimer);
|
|
@@ -28688,9 +28724,7 @@ ${$(r2)}`), n2;
|
|
|
28688
28724
|
const endDate = Array.isArray(item == null ? void 0 : item.id) ? item.id[1] : item[1];
|
|
28689
28725
|
return startDate === start2 && endDate === end2;
|
|
28690
28726
|
});
|
|
28691
|
-
|
|
28692
|
-
setStoreDateList(val, storeKey2.value);
|
|
28693
|
-
}
|
|
28727
|
+
!canStore && dateDetail.value.isValidate && setStoreDateList(val, storeKey2.value);
|
|
28694
28728
|
};
|
|
28695
28729
|
const handleTimezoneChange = (val, info) => {
|
|
28696
28730
|
dateDetail.value = new DateRange(props2.modelValue, format.value, val);
|
|
@@ -28861,8 +28895,7 @@ ${$(r2)}`), n2;
|
|
|
28861
28895
|
__WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode(
|
|
28862
28896
|
"div",
|
|
28863
28897
|
{
|
|
28864
|
-
|
|
28865
|
-
ref: dateTooltipsRef,
|
|
28898
|
+
ref: "dateTooltipsRef",
|
|
28866
28899
|
class: "__date-tooltips__",
|
|
28867
28900
|
style: __WEBPACK_EXTERNAL_MODULE_vue__.normalizeStyle({ maxWidth: __WEBPACK_EXTERNAL_MODULE_vue__.unref(lang) === "en" ? "210px" : "156px" })
|
|
28868
28901
|
},
|
package/vue3/index.es.min.js
CHANGED
|
@@ -112,6 +112,40 @@ const t = (key) => {
|
|
|
112
112
|
};
|
|
113
113
|
dayjs.extend(utc);
|
|
114
114
|
dayjs.extend(tz);
|
|
115
|
+
const getDynamicTimezoneInfo = (timezone) => {
|
|
116
|
+
try {
|
|
117
|
+
const now = dayjs().tz(timezone);
|
|
118
|
+
const offsetMinutes = now.utcOffset();
|
|
119
|
+
const hours = Math.floor(Math.abs(offsetMinutes) / 60);
|
|
120
|
+
const minutes = Math.abs(offsetMinutes) % 60;
|
|
121
|
+
const sign = offsetMinutes >= 0 ? "+" : "-";
|
|
122
|
+
const utcOffset = minutes > 0 ? `utc${sign}${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}` : `utc${sign}${String(hours).padStart(2, "0")}:00`;
|
|
123
|
+
const abbreviation = getTimezoneAbbreviation(timezone);
|
|
124
|
+
return { abbreviation: abbreviation.toLowerCase(), utcOffset: utcOffset.toLowerCase() };
|
|
125
|
+
} catch {
|
|
126
|
+
return { abbreviation: "", utcOffset: "" };
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
const getTimezoneAbbreviation = (timezone) => {
|
|
130
|
+
try {
|
|
131
|
+
const formatter = new Intl.DateTimeFormat("en-US", {
|
|
132
|
+
timeZone: timezone,
|
|
133
|
+
timeZoneName: "short"
|
|
134
|
+
});
|
|
135
|
+
const parts = formatter.formatToParts(/* @__PURE__ */ new Date());
|
|
136
|
+
const tzPart = parts.find((part) => part.type === "timeZoneName");
|
|
137
|
+
return (tzPart == null ? void 0 : tzPart.value) || "";
|
|
138
|
+
} catch {
|
|
139
|
+
return "";
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
const updateSearchIndex = (searchIndex, timezone) => {
|
|
143
|
+
const parts = searchIndex.split("|");
|
|
144
|
+
const { abbreviation, utcOffset } = getDynamicTimezoneInfo(timezone);
|
|
145
|
+
parts[1] = abbreviation;
|
|
146
|
+
parts[2] = utcOffset;
|
|
147
|
+
return parts.join("|");
|
|
148
|
+
};
|
|
115
149
|
const timezoneData = [
|
|
116
150
|
{
|
|
117
151
|
label: "Africa",
|
|
@@ -1456,9 +1490,11 @@ const getTimezoneDetails = () => {
|
|
|
1456
1490
|
return {
|
|
1457
1491
|
label: group.label,
|
|
1458
1492
|
options: group.options.map((option) => {
|
|
1493
|
+
const dynamicSearchIndex = updateSearchIndex(option.searchIndex, option.value);
|
|
1459
1494
|
const info = {
|
|
1460
1495
|
...option,
|
|
1461
|
-
|
|
1496
|
+
searchIndex: dynamicSearchIndex,
|
|
1497
|
+
...getTimezoneInfo(dynamicSearchIndex)
|
|
1462
1498
|
};
|
|
1463
1499
|
if (option.value === browserTimeZone) {
|
|
1464
1500
|
defaultTimezoneList.push({
|
|
@@ -4181,7 +4217,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4181
4217
|
});
|
|
4182
4218
|
const props = __props;
|
|
4183
4219
|
const emits = __emit;
|
|
4184
|
-
const dateTooltipsRef = ref();
|
|
4185
4220
|
const dateContentRef = ref();
|
|
4186
4221
|
const format = ref(props.format);
|
|
4187
4222
|
const timezoneInfo = computed(() => {
|
|
@@ -4199,8 +4234,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4199
4234
|
const b = dayjs.tz(dayjs(), timezone).utcOffset();
|
|
4200
4235
|
return (b - a) / 60;
|
|
4201
4236
|
});
|
|
4202
|
-
const dateDetail = shallowRef(new DateRange(props.modelValue, props.format
|
|
4203
|
-
const tooltipsDetail = shallowRef();
|
|
4237
|
+
const dateDetail = shallowRef(new DateRange(props.modelValue, props.format));
|
|
4238
|
+
const tooltipsDetail = shallowRef(new DateRange(dateDetail.value.dateValue, format.value));
|
|
4204
4239
|
const storeKey2 = computed(() => getStoreKey(props.version));
|
|
4205
4240
|
const datePanelShow = ref(false);
|
|
4206
4241
|
const tooltipsShow = ref(false);
|
|
@@ -4262,14 +4297,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4262
4297
|
tooltipsShow.value = false;
|
|
4263
4298
|
datePanelShow.value = false;
|
|
4264
4299
|
});
|
|
4300
|
+
watch([() => props.modelValue, () => props.format, () => props.timezone], () => {
|
|
4301
|
+
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value, timezoneInfo.value.label);
|
|
4302
|
+
});
|
|
4265
4303
|
function handleDateMouseenter() {
|
|
4266
4304
|
if (enterTimer) return;
|
|
4267
4305
|
enterTimer = setTimeout(() => {
|
|
4268
4306
|
tooltipsShow.value = true;
|
|
4269
|
-
console.log("handleDateMouseenter", dateDetail.value, format.value, timezoneInfo.value.label);
|
|
4270
|
-
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value, timezoneInfo.value.label);
|
|
4271
4307
|
enterTimer = null;
|
|
4272
|
-
},
|
|
4308
|
+
}, 100);
|
|
4273
4309
|
}
|
|
4274
4310
|
function handleDateMouseleave() {
|
|
4275
4311
|
if (leaveTimer) clearTimeout(leaveTimer);
|
|
@@ -4291,9 +4327,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4291
4327
|
const endDate = Array.isArray(item == null ? void 0 : item.id) ? item.id[1] : item[1];
|
|
4292
4328
|
return startDate === start && endDate === end;
|
|
4293
4329
|
});
|
|
4294
|
-
|
|
4295
|
-
setStoreDateList(val, storeKey2.value);
|
|
4296
|
-
}
|
|
4330
|
+
!canStore && dateDetail.value.isValidate && setStoreDateList(val, storeKey2.value);
|
|
4297
4331
|
};
|
|
4298
4332
|
const handleTimezoneChange = (val, info) => {
|
|
4299
4333
|
dateDetail.value = new DateRange(props.modelValue, format.value, val);
|
|
@@ -4464,8 +4498,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4464
4498
|
createElementVNode(
|
|
4465
4499
|
"div",
|
|
4466
4500
|
{
|
|
4467
|
-
|
|
4468
|
-
ref: dateTooltipsRef,
|
|
4501
|
+
ref: "dateTooltipsRef",
|
|
4469
4502
|
class: "__date-tooltips__",
|
|
4470
4503
|
style: normalizeStyle({ maxWidth: unref(lang) === "en" ? "210px" : "156px" })
|
|
4471
4504
|
},
|
package/vue3/index.iife.min.js
CHANGED
|
@@ -25083,6 +25083,40 @@ ${$(r2)}`), n2;
|
|
|
25083
25083
|
};
|
|
25084
25084
|
dayjs.extend(utc);
|
|
25085
25085
|
dayjs.extend(tz);
|
|
25086
|
+
const getDynamicTimezoneInfo = (timezone2) => {
|
|
25087
|
+
try {
|
|
25088
|
+
const now2 = dayjs().tz(timezone2);
|
|
25089
|
+
const offsetMinutes = now2.utcOffset();
|
|
25090
|
+
const hours = Math.floor(Math.abs(offsetMinutes) / 60);
|
|
25091
|
+
const minutes = Math.abs(offsetMinutes) % 60;
|
|
25092
|
+
const sign = offsetMinutes >= 0 ? "+" : "-";
|
|
25093
|
+
const utcOffset = minutes > 0 ? `utc${sign}${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}` : `utc${sign}${String(hours).padStart(2, "0")}:00`;
|
|
25094
|
+
const abbreviation = getTimezoneAbbreviation(timezone2);
|
|
25095
|
+
return { abbreviation: abbreviation.toLowerCase(), utcOffset: utcOffset.toLowerCase() };
|
|
25096
|
+
} catch {
|
|
25097
|
+
return { abbreviation: "", utcOffset: "" };
|
|
25098
|
+
}
|
|
25099
|
+
};
|
|
25100
|
+
const getTimezoneAbbreviation = (timezone2) => {
|
|
25101
|
+
try {
|
|
25102
|
+
const formatter = new Intl.DateTimeFormat("en-US", {
|
|
25103
|
+
timeZone: timezone2,
|
|
25104
|
+
timeZoneName: "short"
|
|
25105
|
+
});
|
|
25106
|
+
const parts = formatter.formatToParts(/* @__PURE__ */ new Date());
|
|
25107
|
+
const tzPart = parts.find((part) => part.type === "timeZoneName");
|
|
25108
|
+
return (tzPart == null ? void 0 : tzPart.value) || "";
|
|
25109
|
+
} catch {
|
|
25110
|
+
return "";
|
|
25111
|
+
}
|
|
25112
|
+
};
|
|
25113
|
+
const updateSearchIndex = (searchIndex, timezone2) => {
|
|
25114
|
+
const parts = searchIndex.split("|");
|
|
25115
|
+
const { abbreviation, utcOffset } = getDynamicTimezoneInfo(timezone2);
|
|
25116
|
+
parts[1] = abbreviation;
|
|
25117
|
+
parts[2] = utcOffset;
|
|
25118
|
+
return parts.join("|");
|
|
25119
|
+
};
|
|
25086
25120
|
const timezoneData = [
|
|
25087
25121
|
{
|
|
25088
25122
|
label: "Africa",
|
|
@@ -26427,9 +26461,11 @@ ${$(r2)}`), n2;
|
|
|
26427
26461
|
return {
|
|
26428
26462
|
label: group.label,
|
|
26429
26463
|
options: group.options.map((option) => {
|
|
26464
|
+
const dynamicSearchIndex = updateSearchIndex(option.searchIndex, option.value);
|
|
26430
26465
|
const info = {
|
|
26431
26466
|
...option,
|
|
26432
|
-
|
|
26467
|
+
searchIndex: dynamicSearchIndex,
|
|
26468
|
+
...getTimezoneInfo(dynamicSearchIndex)
|
|
26433
26469
|
};
|
|
26434
26470
|
if (option.value === browserTimeZone) {
|
|
26435
26471
|
defaultTimezoneList.push({
|
|
@@ -29184,7 +29220,6 @@ ${$(r2)}`), n2;
|
|
|
29184
29220
|
});
|
|
29185
29221
|
const props2 = __props;
|
|
29186
29222
|
const emits = __emit;
|
|
29187
|
-
const dateTooltipsRef = __WEBPACK_EXTERNAL_MODULE_vue__.ref();
|
|
29188
29223
|
const dateContentRef = __WEBPACK_EXTERNAL_MODULE_vue__.ref();
|
|
29189
29224
|
const format = __WEBPACK_EXTERNAL_MODULE_vue__.ref(props2.format);
|
|
29190
29225
|
const timezoneInfo = __WEBPACK_EXTERNAL_MODULE_vue__.computed(() => {
|
|
@@ -29202,8 +29237,8 @@ ${$(r2)}`), n2;
|
|
|
29202
29237
|
const b2 = dayjs.tz(dayjs(), timezone2).utcOffset();
|
|
29203
29238
|
return (b2 - a2) / 60;
|
|
29204
29239
|
});
|
|
29205
|
-
const dateDetail = __WEBPACK_EXTERNAL_MODULE_vue__.shallowRef(new DateRange(props2.modelValue, props2.format
|
|
29206
|
-
const tooltipsDetail = __WEBPACK_EXTERNAL_MODULE_vue__.shallowRef();
|
|
29240
|
+
const dateDetail = __WEBPACK_EXTERNAL_MODULE_vue__.shallowRef(new DateRange(props2.modelValue, props2.format));
|
|
29241
|
+
const tooltipsDetail = __WEBPACK_EXTERNAL_MODULE_vue__.shallowRef(new DateRange(dateDetail.value.dateValue, format.value));
|
|
29207
29242
|
const storeKey2 = __WEBPACK_EXTERNAL_MODULE_vue__.computed(() => getStoreKey(props2.version));
|
|
29208
29243
|
const datePanelShow = __WEBPACK_EXTERNAL_MODULE_vue__.ref(false);
|
|
29209
29244
|
const tooltipsShow = __WEBPACK_EXTERNAL_MODULE_vue__.ref(false);
|
|
@@ -29265,14 +29300,15 @@ ${$(r2)}`), n2;
|
|
|
29265
29300
|
tooltipsShow.value = false;
|
|
29266
29301
|
datePanelShow.value = false;
|
|
29267
29302
|
});
|
|
29303
|
+
__WEBPACK_EXTERNAL_MODULE_vue__.watch([() => props2.modelValue, () => props2.format, () => props2.timezone], () => {
|
|
29304
|
+
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value, timezoneInfo.value.label);
|
|
29305
|
+
});
|
|
29268
29306
|
function handleDateMouseenter() {
|
|
29269
29307
|
if (enterTimer) return;
|
|
29270
29308
|
enterTimer = setTimeout(() => {
|
|
29271
29309
|
tooltipsShow.value = true;
|
|
29272
|
-
console.log("handleDateMouseenter", dateDetail.value, format.value, timezoneInfo.value.label);
|
|
29273
|
-
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value, timezoneInfo.value.label);
|
|
29274
29310
|
enterTimer = null;
|
|
29275
|
-
},
|
|
29311
|
+
}, 100);
|
|
29276
29312
|
}
|
|
29277
29313
|
function handleDateMouseleave() {
|
|
29278
29314
|
if (leaveTimer) clearTimeout(leaveTimer);
|
|
@@ -29294,9 +29330,7 @@ ${$(r2)}`), n2;
|
|
|
29294
29330
|
const endDate = Array.isArray(item == null ? void 0 : item.id) ? item.id[1] : item[1];
|
|
29295
29331
|
return startDate === start2 && endDate === end2;
|
|
29296
29332
|
});
|
|
29297
|
-
|
|
29298
|
-
setStoreDateList(val, storeKey2.value);
|
|
29299
|
-
}
|
|
29333
|
+
!canStore && dateDetail.value.isValidate && setStoreDateList(val, storeKey2.value);
|
|
29300
29334
|
};
|
|
29301
29335
|
const handleTimezoneChange = (val, info) => {
|
|
29302
29336
|
dateDetail.value = new DateRange(props2.modelValue, format.value, val);
|
|
@@ -29467,8 +29501,7 @@ ${$(r2)}`), n2;
|
|
|
29467
29501
|
__WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode(
|
|
29468
29502
|
"div",
|
|
29469
29503
|
{
|
|
29470
|
-
|
|
29471
|
-
ref: dateTooltipsRef,
|
|
29504
|
+
ref: "dateTooltipsRef",
|
|
29472
29505
|
class: "__date-tooltips__",
|
|
29473
29506
|
style: __WEBPACK_EXTERNAL_MODULE_vue__.normalizeStyle({ maxWidth: __WEBPACK_EXTERNAL_MODULE_vue__.unref(lang) === "en" ? "210px" : "156px" })
|
|
29474
29507
|
},
|
package/vue3/index.umd.min.js
CHANGED
|
@@ -108,6 +108,40 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
108
108
|
};
|
|
109
109
|
dayjs.extend(utc);
|
|
110
110
|
dayjs.extend(tz);
|
|
111
|
+
const getDynamicTimezoneInfo = (timezone) => {
|
|
112
|
+
try {
|
|
113
|
+
const now = dayjs().tz(timezone);
|
|
114
|
+
const offsetMinutes = now.utcOffset();
|
|
115
|
+
const hours = Math.floor(Math.abs(offsetMinutes) / 60);
|
|
116
|
+
const minutes = Math.abs(offsetMinutes) % 60;
|
|
117
|
+
const sign = offsetMinutes >= 0 ? "+" : "-";
|
|
118
|
+
const utcOffset = minutes > 0 ? `utc${sign}${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}` : `utc${sign}${String(hours).padStart(2, "0")}:00`;
|
|
119
|
+
const abbreviation = getTimezoneAbbreviation(timezone);
|
|
120
|
+
return { abbreviation: abbreviation.toLowerCase(), utcOffset: utcOffset.toLowerCase() };
|
|
121
|
+
} catch {
|
|
122
|
+
return { abbreviation: "", utcOffset: "" };
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const getTimezoneAbbreviation = (timezone) => {
|
|
126
|
+
try {
|
|
127
|
+
const formatter = new Intl.DateTimeFormat("en-US", {
|
|
128
|
+
timeZone: timezone,
|
|
129
|
+
timeZoneName: "short"
|
|
130
|
+
});
|
|
131
|
+
const parts = formatter.formatToParts(/* @__PURE__ */ new Date());
|
|
132
|
+
const tzPart = parts.find((part) => part.type === "timeZoneName");
|
|
133
|
+
return (tzPart == null ? void 0 : tzPart.value) || "";
|
|
134
|
+
} catch {
|
|
135
|
+
return "";
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
const updateSearchIndex = (searchIndex, timezone) => {
|
|
139
|
+
const parts = searchIndex.split("|");
|
|
140
|
+
const { abbreviation, utcOffset } = getDynamicTimezoneInfo(timezone);
|
|
141
|
+
parts[1] = abbreviation;
|
|
142
|
+
parts[2] = utcOffset;
|
|
143
|
+
return parts.join("|");
|
|
144
|
+
};
|
|
111
145
|
const timezoneData = [
|
|
112
146
|
{
|
|
113
147
|
label: "Africa",
|
|
@@ -1452,9 +1486,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1452
1486
|
return {
|
|
1453
1487
|
label: group.label,
|
|
1454
1488
|
options: group.options.map((option) => {
|
|
1489
|
+
const dynamicSearchIndex = updateSearchIndex(option.searchIndex, option.value);
|
|
1455
1490
|
const info = {
|
|
1456
1491
|
...option,
|
|
1457
|
-
|
|
1492
|
+
searchIndex: dynamicSearchIndex,
|
|
1493
|
+
...getTimezoneInfo(dynamicSearchIndex)
|
|
1458
1494
|
};
|
|
1459
1495
|
if (option.value === browserTimeZone) {
|
|
1460
1496
|
defaultTimezoneList.push({
|
|
@@ -4177,7 +4213,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4177
4213
|
});
|
|
4178
4214
|
const props = __props;
|
|
4179
4215
|
const emits = __emit;
|
|
4180
|
-
const dateTooltipsRef = vue.ref();
|
|
4181
4216
|
const dateContentRef = vue.ref();
|
|
4182
4217
|
const format = vue.ref(props.format);
|
|
4183
4218
|
const timezoneInfo = vue.computed(() => {
|
|
@@ -4195,8 +4230,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4195
4230
|
const b = dayjs.tz(dayjs(), timezone).utcOffset();
|
|
4196
4231
|
return (b - a) / 60;
|
|
4197
4232
|
});
|
|
4198
|
-
const dateDetail = vue.shallowRef(new DateRange(props.modelValue, props.format
|
|
4199
|
-
const tooltipsDetail = vue.shallowRef();
|
|
4233
|
+
const dateDetail = vue.shallowRef(new DateRange(props.modelValue, props.format));
|
|
4234
|
+
const tooltipsDetail = vue.shallowRef(new DateRange(dateDetail.value.dateValue, format.value));
|
|
4200
4235
|
const storeKey2 = vue.computed(() => getStoreKey(props.version));
|
|
4201
4236
|
const datePanelShow = vue.ref(false);
|
|
4202
4237
|
const tooltipsShow = vue.ref(false);
|
|
@@ -4258,14 +4293,15 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4258
4293
|
tooltipsShow.value = false;
|
|
4259
4294
|
datePanelShow.value = false;
|
|
4260
4295
|
});
|
|
4296
|
+
vue.watch([() => props.modelValue, () => props.format, () => props.timezone], () => {
|
|
4297
|
+
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value, timezoneInfo.value.label);
|
|
4298
|
+
});
|
|
4261
4299
|
function handleDateMouseenter() {
|
|
4262
4300
|
if (enterTimer) return;
|
|
4263
4301
|
enterTimer = setTimeout(() => {
|
|
4264
4302
|
tooltipsShow.value = true;
|
|
4265
|
-
console.log("handleDateMouseenter", dateDetail.value, format.value, timezoneInfo.value.label);
|
|
4266
|
-
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value, timezoneInfo.value.label);
|
|
4267
4303
|
enterTimer = null;
|
|
4268
|
-
},
|
|
4304
|
+
}, 100);
|
|
4269
4305
|
}
|
|
4270
4306
|
function handleDateMouseleave() {
|
|
4271
4307
|
if (leaveTimer) clearTimeout(leaveTimer);
|
|
@@ -4287,9 +4323,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4287
4323
|
const endDate = Array.isArray(item == null ? void 0 : item.id) ? item.id[1] : item[1];
|
|
4288
4324
|
return startDate === start && endDate === end;
|
|
4289
4325
|
});
|
|
4290
|
-
|
|
4291
|
-
setStoreDateList(val, storeKey2.value);
|
|
4292
|
-
}
|
|
4326
|
+
!canStore && dateDetail.value.isValidate && setStoreDateList(val, storeKey2.value);
|
|
4293
4327
|
};
|
|
4294
4328
|
const handleTimezoneChange = (val, info) => {
|
|
4295
4329
|
dateDetail.value = new DateRange(props.modelValue, format.value, val);
|
|
@@ -4460,8 +4494,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4460
4494
|
vue.createElementVNode(
|
|
4461
4495
|
"div",
|
|
4462
4496
|
{
|
|
4463
|
-
|
|
4464
|
-
ref: dateTooltipsRef,
|
|
4497
|
+
ref: "dateTooltipsRef",
|
|
4465
4498
|
class: "__date-tooltips__",
|
|
4466
4499
|
style: vue.normalizeStyle({ maxWidth: vue.unref(lang) === "en" ? "210px" : "156px" })
|
|
4467
4500
|
},
|