@blueking/date-picker 2.0.0-beta.21 → 2.0.0-beta.22
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 +3 -5
- package/typings/components/common-submit.vue.d.ts +4 -4
- package/typings/components/common-tab.vue.d.ts +9 -3
- package/typings/components/date-panel.vue.d.ts +1 -1
- package/typings/components/panel-wrapper.vue.d.ts +4 -4
- package/typings/components/timezone-picker.vue.d.ts +2 -2
- package/typings/date-picker.vue.d.ts +3 -3
- package/typings/hooks/use-validate.d.ts +2 -2
- package/typings/utils/constant.d.ts +2 -2
- package/typings/utils/date.d.ts +4 -4
- package/typings/utils/store.d.ts +1 -1
- package/typings/utils/types.d.ts +1 -1
- package/typings/utils/utils.d.ts +5 -5
- package/typings/vue2.d.ts +1 -1
- package/vue2/index.es.min.js +602 -1091
- package/vue2/index.iife.min.js +1264 -1795
- package/vue2/index.umd.min.js +602 -1091
- package/vue3/index.es.min.js +131 -185
- package/vue3/index.iife.min.js +647 -1172
- package/vue3/index.umd.min.js +131 -185
package/vue3/index.es.min.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) =>
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
4
|
import dayjs from "dayjs";
|
|
8
5
|
import { default as default2 } from "dayjs";
|
|
9
6
|
import customParseFormat from "dayjs/plugin/customParseFormat";
|
|
@@ -107,8 +104,7 @@ Object.keys(langData).reduce(
|
|
|
107
104
|
);
|
|
108
105
|
const lang = getCookieByName("blueking_language") || "zh-cn";
|
|
109
106
|
const t = (key) => {
|
|
110
|
-
if (lang !== "en")
|
|
111
|
-
return shortTimeUnitLangData[key] || key;
|
|
107
|
+
if (lang !== "en") return shortTimeUnitLangData[key] || key;
|
|
112
108
|
return shortTimeUnitLangData[key] || timeUnitLangData[key] || naturalDateLangData[key] || langData[key] || key;
|
|
113
109
|
};
|
|
114
110
|
var DateMode = /* @__PURE__ */ ((DateMode2) => {
|
|
@@ -351,14 +347,10 @@ class DateRange {
|
|
|
351
347
|
}
|
|
352
348
|
get dateMode() {
|
|
353
349
|
const [start, end] = this.dateValue;
|
|
354
|
-
if (typeof start === "number" || typeof end === "number")
|
|
355
|
-
|
|
356
|
-
if (dayjs
|
|
357
|
-
|
|
358
|
-
if (dayjs(start).isValid() || dayjs(end).isValid())
|
|
359
|
-
return DateMode.Date;
|
|
360
|
-
if (start === NowConstant && futureDateRegexp.test(end))
|
|
361
|
-
return DateMode.FUTURE;
|
|
350
|
+
if (typeof start === "number" || typeof end === "number") return DateMode.Date;
|
|
351
|
+
if (dayjs.isDayjs(start) || dayjs.isDayjs(end)) return DateMode.Date;
|
|
352
|
+
if (dayjs(start).isValid() || dayjs(end).isValid()) return DateMode.Date;
|
|
353
|
+
if (start === NowConstant && futureDateRegexp.test(end)) return DateMode.FUTURE;
|
|
362
354
|
if (end === NowConstant && recentDateRegexp.test(start) || start.includes("(") && end.includes("("))
|
|
363
355
|
return DateMode.RECENT;
|
|
364
356
|
if (naturalDateShortcutMap[this.dateValue.join("~")]) {
|
|
@@ -368,11 +360,9 @@ class DateRange {
|
|
|
368
360
|
const [, startNum, startUnit, startDiffUnit] = start.match(commonDateRegexp) || [];
|
|
369
361
|
const [, endNum, endUnit, endDiffUnit] = end.match(commonDateRegexp) || [];
|
|
370
362
|
if (startDiffUnit) {
|
|
371
|
-
if (end === NowConstant)
|
|
372
|
-
return DateMode.NATURAL;
|
|
363
|
+
if (end === NowConstant) return DateMode.NATURAL;
|
|
373
364
|
if (startNum && +endNum == -1) {
|
|
374
|
-
if (startUnit === startDiffUnit && endUnit === endDiffUnit && startUnit === endUnit)
|
|
375
|
-
return DateMode.NATURAL;
|
|
365
|
+
if (startUnit === startDiffUnit && endUnit === endDiffUnit && startUnit === endUnit) return DateMode.NATURAL;
|
|
376
366
|
}
|
|
377
367
|
}
|
|
378
368
|
}
|
|
@@ -409,8 +399,7 @@ class DateRange {
|
|
|
409
399
|
return dayjs.tz(((_a = this.startDate) == null ? void 0 : _a.valueOf()) || void 0, this.timezome).format(this.format);
|
|
410
400
|
}
|
|
411
401
|
dateDuration() {
|
|
412
|
-
if (!this.startDate || !this.endDate || !this.isValidate)
|
|
413
|
-
return;
|
|
402
|
+
if (!this.startDate || !this.endDate || !this.isValidate) return;
|
|
414
403
|
let durations = this.endDate.diff(this.startDate);
|
|
415
404
|
const dayDuration = 24 * 60 * 60 * 1e3;
|
|
416
405
|
switch (this.dateMode) {
|
|
@@ -444,8 +433,7 @@ class DateRange {
|
|
|
444
433
|
return durations;
|
|
445
434
|
}
|
|
446
435
|
isInValidDateRange(date) {
|
|
447
|
-
if (!this.startDate || !this.endDate)
|
|
448
|
-
return false;
|
|
436
|
+
if (!this.startDate || !this.endDate) return false;
|
|
449
437
|
return (this.startDate.isSame(date.startDate, "ms") || this.startDate.isBefore(date.startDate)) && (this.endDate.isSame(date.endDate, "ms") || this.endDate.isAfter(date.endDate));
|
|
450
438
|
}
|
|
451
439
|
toDisplayString() {
|
|
@@ -595,8 +583,7 @@ class DateRange {
|
|
|
595
583
|
updateDateValue(dateValue, timezome) {
|
|
596
584
|
this.dateValue = dateValue;
|
|
597
585
|
const [start, end] = dateValue;
|
|
598
|
-
if (timezome)
|
|
599
|
-
this.timezome = timezome;
|
|
586
|
+
if (timezome) this.timezome = timezome;
|
|
600
587
|
this.startDate = start ? this.transformValue2Dayjs(start) : null;
|
|
601
588
|
this.endDate = end ? this.transformValue2Dayjs(end, "end") : null;
|
|
602
589
|
}
|
|
@@ -630,8 +617,7 @@ const transformValue2Dayjs = (val, type = "start", timezome) => {
|
|
|
630
617
|
return date.isValid() ? dayjs.tz(date.valueOf(), timezome || dayjs.tz.guess()) : void 0;
|
|
631
618
|
};
|
|
632
619
|
const transformDateRange2Dayjs = (dateValue, timezome) => {
|
|
633
|
-
if (!Array.isArray(dateValue) || dateValue.length < 1)
|
|
634
|
-
return [];
|
|
620
|
+
if (!Array.isArray(dateValue) || dateValue.length < 1) return [];
|
|
635
621
|
const [start, end] = dateValue || [];
|
|
636
622
|
const startDate = transformValue2Dayjs(start, "start", timezome);
|
|
637
623
|
const endDate = transformValue2Dayjs(end, "end", timezome);
|
|
@@ -2053,8 +2039,7 @@ const getTimezoneInfo = (searchIndex) => {
|
|
|
2053
2039
|
const timezoneDetails = getTimezoneDetails();
|
|
2054
2040
|
const getTimezoneInfoByValue = (value) => {
|
|
2055
2041
|
return timezoneDetails.reduce((pre, group) => {
|
|
2056
|
-
if ((pre == null ? void 0 : pre.label) === value)
|
|
2057
|
-
return pre;
|
|
2042
|
+
if ((pre == null ? void 0 : pre.label) === value) return pre;
|
|
2058
2043
|
return group.options.find((option) => option.label === value);
|
|
2059
2044
|
}, void 0);
|
|
2060
2045
|
};
|
|
@@ -2062,17 +2047,16 @@ const DATE_PICKER_PROVIDER_KEY = Symbol("DATE_PICKER_PROVIDER_KEY");
|
|
|
2062
2047
|
const useDatePickerProvider = (data) => {
|
|
2063
2048
|
provide(DATE_PICKER_PROVIDER_KEY, data);
|
|
2064
2049
|
};
|
|
2065
|
-
const
|
|
2050
|
+
const useDatePickerInject = () => inject(DATE_PICKER_PROVIDER_KEY);
|
|
2066
2051
|
const useValidate = () => {
|
|
2067
|
-
const { format, timezoneInfo, vildateTimeRange } =
|
|
2052
|
+
const { format, timezoneInfo, vildateTimeRange } = useDatePickerInject();
|
|
2068
2053
|
const validDateRange = customRef((track) => {
|
|
2069
2054
|
let date = new DateRange(vildateTimeRange.value, format.value, timezoneInfo.value.label);
|
|
2070
2055
|
return {
|
|
2071
2056
|
get() {
|
|
2072
2057
|
var _a;
|
|
2073
2058
|
track();
|
|
2074
|
-
if (((_a = vildateTimeRange.value) == null ? void 0 : _a.length) !== 2)
|
|
2075
|
-
return void 0;
|
|
2059
|
+
if (((_a = vildateTimeRange.value) == null ? void 0 : _a.length) !== 2) return void 0;
|
|
2076
2060
|
if (vildateTimeRange.value.some((v) => typeof v === "string" && v.includes("now")))
|
|
2077
2061
|
return new DateRange(vildateTimeRange.value, format.value, timezoneInfo.value.label);
|
|
2078
2062
|
return date;
|
|
@@ -2083,20 +2067,17 @@ const useValidate = () => {
|
|
|
2083
2067
|
});
|
|
2084
2068
|
const validateDateValue = (validDate) => {
|
|
2085
2069
|
var _a;
|
|
2086
|
-
if (!(validDate == null ? void 0 : validDate.length))
|
|
2087
|
-
return false;
|
|
2070
|
+
if (!(validDate == null ? void 0 : validDate.length)) return false;
|
|
2088
2071
|
return ((_a = validDateRange.value) == null ? void 0 : _a.isInValidDateRange(new DateRange(validDate, format.value, timezoneInfo.value.label))) ?? true;
|
|
2089
2072
|
};
|
|
2090
2073
|
const validateDateRange = (validDate) => {
|
|
2091
2074
|
var _a;
|
|
2092
|
-
if (!validDate.isValidate)
|
|
2093
|
-
return false;
|
|
2075
|
+
if (!validDate.isValidate) return false;
|
|
2094
2076
|
return ((_a = validDateRange.value) == null ? void 0 : _a.isInValidDateRange(validDate)) ?? true;
|
|
2095
2077
|
};
|
|
2096
2078
|
const validateDayjs = (validDate) => {
|
|
2097
2079
|
var _a;
|
|
2098
|
-
if (!validDate.isValid())
|
|
2099
|
-
return false;
|
|
2080
|
+
if (!validDate.isValid()) return false;
|
|
2100
2081
|
return ((_a = validDateRange.value) == null ? void 0 : _a.isInValidDateRange(
|
|
2101
2082
|
new DateRange([validDate.startOf("d"), validDate.endOf("d")], format.value, timezoneInfo.value.label)
|
|
2102
2083
|
)) ?? true;
|
|
@@ -2143,8 +2124,7 @@ const setStoreDateList = (val, storeKey2, type = "local") => {
|
|
|
2143
2124
|
if (!Array.isArray(list)) {
|
|
2144
2125
|
list = [];
|
|
2145
2126
|
}
|
|
2146
|
-
if (list.some((item) => item[0] === val[0] && item[1] === val[1]))
|
|
2147
|
-
return;
|
|
2127
|
+
if (list.some((item) => item[0] === val[0] && item[1] === val[1])) return;
|
|
2148
2128
|
list.unshift(val);
|
|
2149
2129
|
store.setItem(storeKey2, JSON.stringify(list.slice(0, 10)));
|
|
2150
2130
|
};
|
|
@@ -2167,6 +2147,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
2167
2147
|
type: Boolean
|
|
2168
2148
|
}
|
|
2169
2149
|
},
|
|
2150
|
+
emits: ["confirm", "update:modelValue"],
|
|
2170
2151
|
setup(__props) {
|
|
2171
2152
|
return (_ctx, _cache) => {
|
|
2172
2153
|
return openBlock(), createElementBlock("div", _hoisted_1$8, [
|
|
@@ -2195,12 +2176,12 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
2195
2176
|
}, 8, ["active"]),
|
|
2196
2177
|
__props.showDeleteAll ? (openBlock(), createBlock(unref(PopConfirm), {
|
|
2197
2178
|
key: 0,
|
|
2179
|
+
"ext-cls": "__bk-date-picker-popover__ __bk-date-picker-popover-delete__",
|
|
2198
2180
|
"cancel-text": unref(t)("取消"),
|
|
2199
2181
|
"confirm-text": unref(t)("确定"),
|
|
2200
2182
|
content: unref(t)("是否清空最近使用?"),
|
|
2201
2183
|
trigger: "click",
|
|
2202
2184
|
width: 189,
|
|
2203
|
-
"ext-cls": "__bk-date-picker-popover__ __bk-date-picker-popover-delete__",
|
|
2204
2185
|
onConfirm: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("confirm"))
|
|
2205
2186
|
}, {
|
|
2206
2187
|
default: withCtx(() => [
|
|
@@ -2233,9 +2214,9 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
2233
2214
|
}, {
|
|
2234
2215
|
default: withCtx(() => [
|
|
2235
2216
|
createVNode(unref(Button), {
|
|
2217
|
+
class: "common-submit",
|
|
2236
2218
|
disabled: _ctx.disabled,
|
|
2237
2219
|
outline: true,
|
|
2238
|
-
class: "common-submit",
|
|
2239
2220
|
theme: "primary",
|
|
2240
2221
|
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("submit"))
|
|
2241
2222
|
}, {
|
|
@@ -2286,7 +2267,7 @@ const weekItemCount = 7;
|
|
|
2286
2267
|
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
2287
2268
|
__name: "date-panel",
|
|
2288
2269
|
props: {
|
|
2289
|
-
|
|
2270
|
+
disableNow: { type: Boolean },
|
|
2290
2271
|
format: { default: "YYYY-MM-DD HH:mm:ss" },
|
|
2291
2272
|
isNow: { type: Boolean },
|
|
2292
2273
|
minDate: {},
|
|
@@ -2299,7 +2280,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
2299
2280
|
const props = __props;
|
|
2300
2281
|
const emits = __emit;
|
|
2301
2282
|
const weekList = lang === "en" ? ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] : ["日", "一", "二", "三", "四", "五", "六"];
|
|
2302
|
-
const
|
|
2283
|
+
const panelDateList = shallowRef([]);
|
|
2303
2284
|
const today = dayjs();
|
|
2304
2285
|
const curPanelDate = shallowRef(props.modelValue || today);
|
|
2305
2286
|
const { validateDayjs } = useValidate();
|
|
@@ -2311,7 +2292,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
2311
2292
|
for (let i = 0; i < panelRowCount * weekItemCount; i++) {
|
|
2312
2293
|
list.push(firstDay.add(i, "day"));
|
|
2313
2294
|
}
|
|
2314
|
-
|
|
2295
|
+
panelDateList.value = list;
|
|
2315
2296
|
},
|
|
2316
2297
|
{
|
|
2317
2298
|
immediate: true
|
|
@@ -2332,10 +2313,8 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
2332
2313
|
let timeout;
|
|
2333
2314
|
const handleMouseDown = (e) => {
|
|
2334
2315
|
e.preventDefault();
|
|
2335
|
-
if (props.
|
|
2336
|
-
|
|
2337
|
-
if (timeout)
|
|
2338
|
-
return;
|
|
2316
|
+
if (props.disableNow) return;
|
|
2317
|
+
if (timeout) return;
|
|
2339
2318
|
emits("update:isNow", !props.isNow);
|
|
2340
2319
|
timeout = setTimeout(() => {
|
|
2341
2320
|
clearTimeout(timeout);
|
|
@@ -2358,8 +2337,8 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
2358
2337
|
},
|
|
2359
2338
|
[
|
|
2360
2339
|
createVNode(unref(Checkbox), {
|
|
2340
|
+
disabled: _ctx.disableNow,
|
|
2361
2341
|
"model-value": _ctx.isNow,
|
|
2362
|
-
disabled: _ctx.diableNow,
|
|
2363
2342
|
size: "small"
|
|
2364
2343
|
}, {
|
|
2365
2344
|
default: withCtx(() => [
|
|
@@ -2367,7 +2346,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
2367
2346
|
]),
|
|
2368
2347
|
_: 1
|
|
2369
2348
|
/* STABLE */
|
|
2370
|
-
}, 8, ["
|
|
2349
|
+
}, 8, ["disabled", "model-value"])
|
|
2371
2350
|
],
|
|
2372
2351
|
32
|
|
2373
2352
|
/* NEED_HYDRATION */
|
|
@@ -2418,8 +2397,8 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
2418
2397
|
return openBlock(), createElementBlock(
|
|
2419
2398
|
"li",
|
|
2420
2399
|
{
|
|
2421
|
-
|
|
2422
|
-
|
|
2400
|
+
class: "date-grid-item not-click",
|
|
2401
|
+
key: index
|
|
2423
2402
|
},
|
|
2424
2403
|
toDisplayString(day),
|
|
2425
2404
|
1
|
|
@@ -2435,22 +2414,22 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
2435
2414
|
null,
|
|
2436
2415
|
renderList(panelRowCount, (row) => {
|
|
2437
2416
|
return createElementVNode("ul", {
|
|
2438
|
-
|
|
2439
|
-
|
|
2417
|
+
class: "date-grid",
|
|
2418
|
+
key: row
|
|
2440
2419
|
}, [
|
|
2441
2420
|
(openBlock(true), createElementBlock(
|
|
2442
2421
|
Fragment,
|
|
2443
2422
|
null,
|
|
2444
|
-
renderList(
|
|
2423
|
+
renderList(panelDateList.value.slice((row - 1) * weekItemCount, (row - 1) * weekItemCount + weekItemCount), (date) => {
|
|
2445
2424
|
return openBlock(), createElementBlock("li", {
|
|
2446
|
-
|
|
2447
|
-
class: normalizeClass([{
|
|
2425
|
+
class: normalizeClass(["date-grid-item", {
|
|
2448
2426
|
"is-last-month": date.isBefore(curPanelDate.value, "month"),
|
|
2449
2427
|
"is-next-month": date.isAfter(curPanelDate.value, "month"),
|
|
2450
2428
|
"is-today": date.isSame(unref(today), "day"),
|
|
2451
2429
|
"is-disabled": !unref(validateDayjs)(date) || _ctx.minDate && date.isBefore(_ctx.minDate, "day"),
|
|
2452
2430
|
"is-selected": props.modelValue && date.isSame(props.modelValue, "day")
|
|
2453
|
-
}
|
|
2431
|
+
}]),
|
|
2432
|
+
key: date.unix(),
|
|
2454
2433
|
onClick: withModifiers(($event) => handleDateChange(date), ["prevent"])
|
|
2455
2434
|
}, toDisplayString(date.date()), 11, _hoisted_11$1);
|
|
2456
2435
|
}),
|
|
@@ -2475,11 +2454,11 @@ const _hoisted_3$4 = /* @__PURE__ */ createElementVNode(
|
|
|
2475
2454
|
{ class: "date-picker-icon" },
|
|
2476
2455
|
[
|
|
2477
2456
|
/* @__PURE__ */ createElementVNode("svg", {
|
|
2478
|
-
|
|
2457
|
+
width: "14",
|
|
2479
2458
|
height: "14",
|
|
2459
|
+
class: "date-content-icon",
|
|
2480
2460
|
version: "1.1",
|
|
2481
2461
|
viewBox: "0 0 1024 1024",
|
|
2482
|
-
width: "14",
|
|
2483
2462
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2484
2463
|
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
2485
2464
|
}, [
|
|
@@ -2528,7 +2507,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
2528
2507
|
const endDate = shallowRef();
|
|
2529
2508
|
const isStartNow = ref(false);
|
|
2530
2509
|
const isEndNow = ref(false);
|
|
2531
|
-
const { format, timezoneInfo } =
|
|
2510
|
+
const { format, timezoneInfo } = useDatePickerInject();
|
|
2532
2511
|
const today = dayjs();
|
|
2533
2512
|
const isValidate = ref(true);
|
|
2534
2513
|
const { validMsg, validateDateValue } = useValidate();
|
|
@@ -2546,16 +2525,11 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
2546
2525
|
}
|
|
2547
2526
|
);
|
|
2548
2527
|
const canConfirm = computed(() => {
|
|
2549
|
-
if (!startDate.value || !endDate.value)
|
|
2550
|
-
|
|
2551
|
-
if (
|
|
2552
|
-
|
|
2553
|
-
if (startDate.value.
|
|
2554
|
-
return false;
|
|
2555
|
-
if (startDate.value.format(format.value) === endDate.value.format(format.value))
|
|
2556
|
-
return false;
|
|
2557
|
-
if (startDate.value.isAfter(endDate.value))
|
|
2558
|
-
return false;
|
|
2528
|
+
if (!startDate.value || !endDate.value) return false;
|
|
2529
|
+
if (!startDate.value.isValid() || !endDate.value.isValid()) return false;
|
|
2530
|
+
if (startDate.value.isSame(endDate.value, "ms")) return false;
|
|
2531
|
+
if (startDate.value.format(format.value) === endDate.value.format(format.value)) return false;
|
|
2532
|
+
if (startDate.value.isAfter(endDate.value)) return false;
|
|
2559
2533
|
return true;
|
|
2560
2534
|
});
|
|
2561
2535
|
const handleInputEnter = async (_, type) => {
|
|
@@ -2567,10 +2541,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
2567
2541
|
const curNow = type === "start" ? isStartNow : isEndNow;
|
|
2568
2542
|
const otherNow = type === "start" ? isEndNow : isStartNow;
|
|
2569
2543
|
const formatValue = editDate == null ? void 0 : editDate.format(format.value);
|
|
2570
|
-
if (val === formatValue)
|
|
2571
|
-
|
|
2572
|
-
if (!val || val === NowConstant && curNow.value)
|
|
2573
|
-
return;
|
|
2544
|
+
if (val === formatValue) return;
|
|
2545
|
+
if (!val || val === NowConstant && curNow.value) return;
|
|
2574
2546
|
if (val === NowConstant && !curNow.value && !otherNow.value) {
|
|
2575
2547
|
handleIsNowChange(type);
|
|
2576
2548
|
return;
|
|
@@ -2673,23 +2645,20 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
2673
2645
|
const startValue = isStartNow.value ? NowConstant : startDate.value.tz(timezoneInfo.value.label, true).valueOf();
|
|
2674
2646
|
const endValue = isEndNow.value ? NowConstant : endDate.value.tz(timezoneInfo.value.label, true).valueOf();
|
|
2675
2647
|
isValidate.value = validateDateValue([startValue || "", endValue || ""]);
|
|
2676
|
-
if (!isValidate.value)
|
|
2677
|
-
return;
|
|
2648
|
+
if (!isValidate.value) return;
|
|
2678
2649
|
emits("change", [startValue || "", endValue || ""]);
|
|
2679
2650
|
}
|
|
2680
2651
|
};
|
|
2681
2652
|
const handleClickoutsideStart = (e) => {
|
|
2682
2653
|
var _a;
|
|
2683
|
-
if (!showStartPanel.value)
|
|
2684
|
-
return;
|
|
2654
|
+
if (!showStartPanel.value) return;
|
|
2685
2655
|
if (!((_a = document.querySelector(".__date-picker-popover-start__")) == null ? void 0 : _a.contains(e.target))) {
|
|
2686
2656
|
hiddenStartPanel();
|
|
2687
2657
|
}
|
|
2688
2658
|
};
|
|
2689
2659
|
const handleClickoutsideEnd = (e) => {
|
|
2690
2660
|
var _a;
|
|
2691
|
-
if (!showEndPanel.value)
|
|
2692
|
-
return;
|
|
2661
|
+
if (!showEndPanel.value) return;
|
|
2693
2662
|
if (!((_a = document.querySelector(".__date-picker-popover-end__")) == null ? void 0 : _a.contains(e.target))) {
|
|
2694
2663
|
hiddenEndPanel();
|
|
2695
2664
|
}
|
|
@@ -2709,10 +2678,10 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
2709
2678
|
[
|
|
2710
2679
|
_hoisted_3$4,
|
|
2711
2680
|
createVNode(unref(Popover), {
|
|
2681
|
+
"ext-cls": "__bk-date-picker-popover__ __date-picker-popover-start__",
|
|
2712
2682
|
arrow: false,
|
|
2713
2683
|
"is-show": showStartPanel.value,
|
|
2714
2684
|
boundary: "parent",
|
|
2715
|
-
"ext-cls": "__bk-date-picker-popover__ __date-picker-popover-start__",
|
|
2716
2685
|
placement: "bottom-start",
|
|
2717
2686
|
theme: "light",
|
|
2718
2687
|
trigger: "manual"
|
|
@@ -2720,14 +2689,14 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
2720
2689
|
content: withCtx(() => [
|
|
2721
2690
|
createVNode(_sfc_main$7, {
|
|
2722
2691
|
key: "start",
|
|
2723
|
-
"
|
|
2692
|
+
"disable-now": isEndNow.value,
|
|
2724
2693
|
format: unref(format),
|
|
2725
2694
|
"is-now": isStartNow.value,
|
|
2726
2695
|
"model-value": startDate.value,
|
|
2727
2696
|
title: unref(t)("开始时间"),
|
|
2728
2697
|
"onUpdate:isNow": _cache[2] || (_cache[2] = () => handleIsNowChange("start")),
|
|
2729
2698
|
"onUpdate:modelValue": handleStartTimeChange
|
|
2730
|
-
}, null, 8, ["
|
|
2699
|
+
}, null, 8, ["disable-now", "format", "is-now", "model-value", "title"])
|
|
2731
2700
|
]),
|
|
2732
2701
|
default: withCtx(() => {
|
|
2733
2702
|
var _a2;
|
|
@@ -2735,9 +2704,9 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
2735
2704
|
withDirectives(createElementVNode("input", {
|
|
2736
2705
|
ref_key: "startInput",
|
|
2737
2706
|
ref: startInput,
|
|
2707
|
+
class: "date-picker-start",
|
|
2738
2708
|
placeholder: unref(t)("开始时间"),
|
|
2739
2709
|
value: isStartNow.value ? unref(NowConstant) : (_a2 = startDate.value) == null ? void 0 : _a2.format(unref(format)),
|
|
2740
|
-
class: "date-picker-start",
|
|
2741
2710
|
spellcheck: "false",
|
|
2742
2711
|
onBlur: _cache[0] || (_cache[0] = (e) => handleInputEnter(e, "start")),
|
|
2743
2712
|
onClick: handleFocusStart,
|
|
@@ -2752,10 +2721,10 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
2752
2721
|
}, 8, ["is-show"]),
|
|
2753
2722
|
_hoisted_5$3,
|
|
2754
2723
|
createVNode(unref(Popover), {
|
|
2724
|
+
"ext-cls": "__bk-date-picker-popover__ __date-picker-popover-end__",
|
|
2755
2725
|
arrow: false,
|
|
2756
2726
|
"is-show": showEndPanel.value,
|
|
2757
2727
|
boundary: "parent",
|
|
2758
|
-
"ext-cls": "__bk-date-picker-popover__ __date-picker-popover-end__",
|
|
2759
2728
|
placement: "bottom-start",
|
|
2760
2729
|
theme: "light",
|
|
2761
2730
|
trigger: "manual"
|
|
@@ -2763,14 +2732,14 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
2763
2732
|
content: withCtx(() => [
|
|
2764
2733
|
createVNode(_sfc_main$7, {
|
|
2765
2734
|
key: "end",
|
|
2766
|
-
"
|
|
2735
|
+
"disable-now": isStartNow.value,
|
|
2767
2736
|
format: unref(format),
|
|
2768
2737
|
"is-now": isEndNow.value,
|
|
2769
2738
|
"model-value": endDate.value,
|
|
2770
2739
|
title: unref(t)("结束时间"),
|
|
2771
2740
|
"onUpdate:isNow": _cache[5] || (_cache[5] = () => handleIsNowChange("end")),
|
|
2772
2741
|
"onUpdate:modelValue": _cache[6] || (_cache[6] = (date) => handleEndTimeChange(date.endOf("d")))
|
|
2773
|
-
}, null, 8, ["
|
|
2742
|
+
}, null, 8, ["disable-now", "format", "is-now", "model-value", "title"])
|
|
2774
2743
|
]),
|
|
2775
2744
|
default: withCtx(() => {
|
|
2776
2745
|
var _a2;
|
|
@@ -2778,9 +2747,9 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
2778
2747
|
withDirectives(createElementVNode("input", {
|
|
2779
2748
|
ref_key: "endInput",
|
|
2780
2749
|
ref: endInput,
|
|
2750
|
+
class: "date-picker-end",
|
|
2781
2751
|
placeholder: unref(t)("结束时间"),
|
|
2782
2752
|
value: isEndNow.value ? unref(NowConstant) : (_a2 = endDate.value) == null ? void 0 : _a2.format(unref(format)),
|
|
2783
|
-
class: "date-picker-end",
|
|
2784
2753
|
onBlur: _cache[3] || (_cache[3] = (e) => handleInputEnter(e, "end")),
|
|
2785
2754
|
onClick: handleFocusEnd,
|
|
2786
2755
|
onKeypress: _cache[4] || (_cache[4] = withKeys((e) => handleInputEnter(e, "end"), ["enter"]))
|
|
@@ -2821,8 +2790,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
2821
2790
|
/* TEXT */
|
|
2822
2791
|
),
|
|
2823
2792
|
createVNode(unref(Popover), {
|
|
2824
|
-
trigger: "click",
|
|
2825
2793
|
"ext-cls": "__bk-date-picker-popover__",
|
|
2794
|
+
trigger: "click",
|
|
2826
2795
|
placement: "bottom",
|
|
2827
2796
|
theme: "light"
|
|
2828
2797
|
}, {
|
|
@@ -2886,8 +2855,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
2886
2855
|
default: withCtx(() => [
|
|
2887
2856
|
createVNode(unref(Button), {
|
|
2888
2857
|
class: "format-button",
|
|
2889
|
-
|
|
2890
|
-
|
|
2858
|
+
theme: "primary",
|
|
2859
|
+
text: ""
|
|
2891
2860
|
}, {
|
|
2892
2861
|
default: withCtx(() => [
|
|
2893
2862
|
createTextVNode(
|
|
@@ -2927,15 +2896,14 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
2927
2896
|
const naturalSelectRef = ref();
|
|
2928
2897
|
const naturalOptions = shallowRef(CommonNaturalOptions.slice());
|
|
2929
2898
|
const naturalUnitValue = ref(naturalUnitOptions[0].id);
|
|
2930
|
-
const
|
|
2899
|
+
const canEditNaturalId = ref("");
|
|
2931
2900
|
const inputValue = ref();
|
|
2932
2901
|
const naturalValue = ref(naturalOptions.value[0]);
|
|
2933
2902
|
const isValidate = ref(true);
|
|
2934
2903
|
const { validMsg, validateDateValue } = useValidate();
|
|
2935
2904
|
getStoreDateList(getStoreKey(), "session").forEach((item) => {
|
|
2936
2905
|
const [start, end] = item;
|
|
2937
|
-
if (dayjs.isDayjs(start) || dayjs.isDayjs(end))
|
|
2938
|
-
return;
|
|
2906
|
+
if (dayjs.isDayjs(start) || dayjs.isDayjs(end)) return;
|
|
2939
2907
|
const date = new DateRange(item);
|
|
2940
2908
|
const { startNum, startUnit } = date;
|
|
2941
2909
|
const specialDate = naturalOptions.value.find((item2) => item2.id === start);
|
|
@@ -2953,13 +2921,10 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
2953
2921
|
watch(
|
|
2954
2922
|
() => props.value,
|
|
2955
2923
|
(date) => {
|
|
2956
|
-
if (!date)
|
|
2957
|
-
|
|
2958
|
-
if (date.dateMode !== DateMode.NATURAL)
|
|
2959
|
-
return;
|
|
2924
|
+
if (!date) return;
|
|
2925
|
+
if (date.dateMode !== DateMode.NATURAL) return;
|
|
2960
2926
|
const [start, end] = date.dateValue;
|
|
2961
|
-
if (dayjs.isDayjs(start) || dayjs.isDayjs(end))
|
|
2962
|
-
return;
|
|
2927
|
+
if (dayjs.isDayjs(start) || dayjs.isDayjs(end)) return;
|
|
2963
2928
|
const { startNum, startUnit } = date;
|
|
2964
2929
|
naturalUnitValue.value = end === NowConstant ? NaturalUnit.NOW : NaturalUnit.ALL;
|
|
2965
2930
|
const customDate = naturalOptions.value.find((item) => item.id === start && item.type === NaturalOptionType.custom);
|
|
@@ -2967,7 +2932,9 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
2967
2932
|
naturalValue.value = customDate;
|
|
2968
2933
|
return;
|
|
2969
2934
|
}
|
|
2970
|
-
const specialDate = CommonNaturalOptions.find(
|
|
2935
|
+
const specialDate = CommonNaturalOptions.find(
|
|
2936
|
+
(item) => item.id === start && item.type === NaturalOptionType.default
|
|
2937
|
+
);
|
|
2971
2938
|
if (end !== NowConstant && start !== end && specialDate || !specialDate) {
|
|
2972
2939
|
const name = `${`${t("前")} ${startNum} ${t(
|
|
2973
2940
|
shortTimeUnitLangData[startUnit]
|
|
@@ -2994,8 +2961,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
2994
2961
|
if (naturalUnitValue.value === NaturalUnit.ALL) {
|
|
2995
2962
|
const [, num, unit, dateUnit2] = value.match(naturalDateRegexp) || [];
|
|
2996
2963
|
if (Math.abs(+num) > 1) {
|
|
2997
|
-
if (Math.abs(+num) === 2 && unit === "d")
|
|
2998
|
-
return [value, value];
|
|
2964
|
+
if (Math.abs(+num) === 2 && unit === "d") return [value, value];
|
|
2999
2965
|
return [value, `now-1${unit}/${dateUnit2}`];
|
|
3000
2966
|
}
|
|
3001
2967
|
return [value, value];
|
|
@@ -3006,7 +2972,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3006
2972
|
var _a;
|
|
3007
2973
|
if (item.type === NaturalOptionType.edit) {
|
|
3008
2974
|
inputValue.value = 1;
|
|
3009
|
-
|
|
2975
|
+
canEditNaturalId.value = item.id;
|
|
3010
2976
|
setTimeout(() => {
|
|
3011
2977
|
var _a2, _b, _c;
|
|
3012
2978
|
(_c = (_b = (_a2 = inputRef.value) == null ? void 0 : _a2[0]) == null ? void 0 : _b.focus) == null ? void 0 : _c.call(_b);
|
|
@@ -3014,7 +2980,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3014
2980
|
return;
|
|
3015
2981
|
}
|
|
3016
2982
|
naturalValue.value = item;
|
|
3017
|
-
|
|
2983
|
+
canEditNaturalId.value = "";
|
|
3018
2984
|
(_a = naturalSelectRef.value) == null ? void 0 : _a.hidePopover();
|
|
3019
2985
|
};
|
|
3020
2986
|
const handleUnitChange = (value) => {
|
|
@@ -3022,7 +2988,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3022
2988
|
};
|
|
3023
2989
|
const customNaturalOptions = (v, item) => {
|
|
3024
2990
|
var _a, _b;
|
|
3025
|
-
|
|
2991
|
+
canEditNaturalId.value = "";
|
|
3026
2992
|
const value = `now-${+v}${item.unit}/${item.unit}`;
|
|
3027
2993
|
const date = naturalOptions.value.find((item2) => item2.id === value);
|
|
3028
2994
|
if (date) {
|
|
@@ -3039,17 +3005,14 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3039
3005
|
(_b = naturalSelectRef.value) == null ? void 0 : _b.hidePopover();
|
|
3040
3006
|
};
|
|
3041
3007
|
const handleInputKeyPress = (e, v, item) => {
|
|
3042
|
-
if (!v || +v < 1)
|
|
3043
|
-
|
|
3044
|
-
if (e.key !== "Enter" || !canEditNautralId.value)
|
|
3045
|
-
return;
|
|
3008
|
+
if (!v || +v < 1) return;
|
|
3009
|
+
if (e.key !== "Enter" || !canEditNaturalId.value) return;
|
|
3046
3010
|
customNaturalOptions(Math.ceil(v), item);
|
|
3047
3011
|
};
|
|
3048
3012
|
const handleSubmit = () => {
|
|
3049
3013
|
const value = getNaturalDateValue(naturalValue.value);
|
|
3050
3014
|
isValidate.value = validateDateValue(value);
|
|
3051
|
-
if (!isValidate.value)
|
|
3052
|
-
return;
|
|
3015
|
+
if (!isValidate.value) return;
|
|
3053
3016
|
naturalOptions.value.filter((item) => item.type === NaturalOptionType.custom).forEach((item) => {
|
|
3054
3017
|
setStoreDateList(getNaturalDateValue(item), getStoreKey(), "session");
|
|
3055
3018
|
});
|
|
@@ -3071,6 +3034,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3071
3034
|
createVNode(unref(Select), {
|
|
3072
3035
|
ref_key: "naturalSelectRef",
|
|
3073
3036
|
ref: naturalSelectRef,
|
|
3037
|
+
class: "natural-date",
|
|
3074
3038
|
clearable: false,
|
|
3075
3039
|
"input-search": false,
|
|
3076
3040
|
"model-value": getNaturalOptionId(naturalValue.value),
|
|
@@ -3079,7 +3043,6 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3079
3043
|
"popover-options": { boundary: "parent", extCls: "__bk-date-picker-popover__" },
|
|
3080
3044
|
prefix: unref(t)("自然日期"),
|
|
3081
3045
|
"search-placeholder": unref(t)("请输入"),
|
|
3082
|
-
class: "natural-date",
|
|
3083
3046
|
filterable: "",
|
|
3084
3047
|
onClick: _cache[2] || (_cache[2] = ($event) => isValidate.value = true)
|
|
3085
3048
|
}, {
|
|
@@ -3099,11 +3062,12 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3099
3062
|
onClick: _cache[1] || (_cache[1] = withModifiers(() => {
|
|
3100
3063
|
}, ["prevent", "stop"]))
|
|
3101
3064
|
}, [
|
|
3102
|
-
|
|
3065
|
+
canEditNaturalId.value === item.id ? (openBlock(), createBlock(unref(Input), {
|
|
3103
3066
|
key: 0,
|
|
3104
3067
|
ref_for: true,
|
|
3105
3068
|
ref_key: "inputRef",
|
|
3106
3069
|
ref: inputRef,
|
|
3070
|
+
style: { "width": "150px" },
|
|
3107
3071
|
modelValue: inputValue.value,
|
|
3108
3072
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event),
|
|
3109
3073
|
clearable: false,
|
|
@@ -3115,7 +3079,6 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3115
3079
|
suffix: item.suffix,
|
|
3116
3080
|
autofocus: "true",
|
|
3117
3081
|
size: "small",
|
|
3118
|
-
style: { "width": "150px" },
|
|
3119
3082
|
type: "number",
|
|
3120
3083
|
onKeypress: (v, e) => handleInputKeyPress(e, v, item)
|
|
3121
3084
|
}, null, 8, ["modelValue", "placeholder", "prefix", "suffix", "onKeypress"])) : (openBlock(), createElementBlock("div", {
|
|
@@ -3137,10 +3100,10 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3137
3100
|
/* STABLE */
|
|
3138
3101
|
}, 8, ["model-value", "no-match-text", "prefix", "search-placeholder"]),
|
|
3139
3102
|
createVNode(unref(Select), {
|
|
3103
|
+
class: "natural-unit",
|
|
3140
3104
|
clearable: false,
|
|
3141
3105
|
"model-value": naturalUnitValue.value,
|
|
3142
3106
|
"popover-options": { boundary: "parent" },
|
|
3143
|
-
class: "natural-unit",
|
|
3144
3107
|
onChange: handleUnitChange,
|
|
3145
3108
|
onClick: _cache[3] || (_cache[3] = ($event) => isValidate.value = true)
|
|
3146
3109
|
}, {
|
|
@@ -3191,11 +3154,11 @@ const _hoisted_3$3 = /* @__PURE__ */ createElementVNode(
|
|
|
3191
3154
|
{ class: "specific-date-icon" },
|
|
3192
3155
|
[
|
|
3193
3156
|
/* @__PURE__ */ createElementVNode("svg", {
|
|
3194
|
-
|
|
3157
|
+
width: "14",
|
|
3195
3158
|
height: "14",
|
|
3159
|
+
class: "date-content-icon",
|
|
3196
3160
|
version: "1.1",
|
|
3197
3161
|
viewBox: "0 0 1024 1024",
|
|
3198
|
-
width: "14",
|
|
3199
3162
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3200
3163
|
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
3201
3164
|
}, [
|
|
@@ -3220,7 +3183,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3220
3183
|
setup(__props, { emit: __emit }) {
|
|
3221
3184
|
const props = __props;
|
|
3222
3185
|
const emits = __emit;
|
|
3223
|
-
const { format } =
|
|
3186
|
+
const { format } = useDatePickerInject();
|
|
3224
3187
|
const inputRef = ref();
|
|
3225
3188
|
const specificInput = ref();
|
|
3226
3189
|
const baselineSelectRef = ref();
|
|
@@ -3310,10 +3273,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3310
3273
|
emits("update:modelValue", item.id);
|
|
3311
3274
|
};
|
|
3312
3275
|
const handleInputKeyPress = (e, v, item) => {
|
|
3313
|
-
if (!v || +v < 1)
|
|
3314
|
-
|
|
3315
|
-
if (e.key !== "Enter" || !canEditNautralId.value)
|
|
3316
|
-
return;
|
|
3276
|
+
if (!v || +v < 1) return;
|
|
3277
|
+
if (e.key !== "Enter" || !canEditNautralId.value) return;
|
|
3317
3278
|
customNaturalOptions(Math.ceil(v), item);
|
|
3318
3279
|
};
|
|
3319
3280
|
const customNaturalOptions = (v, item) => {
|
|
@@ -3379,19 +3340,19 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3379
3340
|
createVNode(unref(Select), {
|
|
3380
3341
|
ref_key: "baselineSelectRef",
|
|
3381
3342
|
ref: baselineSelectRef,
|
|
3382
|
-
|
|
3383
|
-
"input-search": false,
|
|
3384
|
-
"no-match-text": unref(t)("无匹配数据"),
|
|
3385
|
-
"popover-min-width": 130,
|
|
3343
|
+
class: "baseline-picker-select",
|
|
3386
3344
|
"popover-options": {
|
|
3387
3345
|
boundary: "parent",
|
|
3388
3346
|
extCls: "__bk-date-picker-popover__ __bk-date-picker-baseline-popover__"
|
|
3389
3347
|
},
|
|
3348
|
+
clearable: false,
|
|
3349
|
+
"input-search": false,
|
|
3350
|
+
"model-value": baselineValue.value,
|
|
3351
|
+
"no-match-text": unref(t)("无匹配数据"),
|
|
3352
|
+
"popover-min-width": 130,
|
|
3390
3353
|
prefix: unref(t)("基于"),
|
|
3391
3354
|
"search-placeholder": unref(t)("请输入"),
|
|
3392
|
-
|
|
3393
|
-
filterable: "",
|
|
3394
|
-
"model-value": baselineValue.value
|
|
3355
|
+
filterable: ""
|
|
3395
3356
|
}, {
|
|
3396
3357
|
default: withCtx(() => [
|
|
3397
3358
|
(openBlock(true), createElementBlock(
|
|
@@ -3399,10 +3360,10 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3399
3360
|
null,
|
|
3400
3361
|
renderList(baselineOptions.value, (item) => {
|
|
3401
3362
|
return openBlock(), createBlock(unref(Select).Option, {
|
|
3363
|
+
style: { "overflow": "inherit" },
|
|
3402
3364
|
id: item.id,
|
|
3403
3365
|
key: item.id,
|
|
3404
|
-
name: item.name
|
|
3405
|
-
style: { "overflow": "inherit" }
|
|
3366
|
+
name: item.name
|
|
3406
3367
|
}, {
|
|
3407
3368
|
default: withCtx(() => {
|
|
3408
3369
|
var _a;
|
|
@@ -3422,10 +3383,10 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3422
3383
|
ref_for: true,
|
|
3423
3384
|
ref_key: "specificInput",
|
|
3424
3385
|
ref: specificInput,
|
|
3425
|
-
placeholder: unref(t)("具体时间"),
|
|
3426
3386
|
class: "specific-date-input",
|
|
3427
|
-
|
|
3387
|
+
placeholder: unref(t)("具体时间"),
|
|
3428
3388
|
value: (_a = specificDate.value) == null ? void 0 : _a.format(unref(format)),
|
|
3389
|
+
spellcheck: "false",
|
|
3429
3390
|
onClick: handleInputFocus,
|
|
3430
3391
|
onKeydown: withKeys(withModifiers(handleInputEnter, ["stop"]), ["enter"])
|
|
3431
3392
|
}, null, 40, _hoisted_4$3),
|
|
@@ -3433,8 +3394,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3433
3394
|
key: "specific",
|
|
3434
3395
|
class: "specific-date-panel",
|
|
3435
3396
|
format: unref(format),
|
|
3436
|
-
"show-title": false,
|
|
3437
3397
|
"model-value": specificDate.value,
|
|
3398
|
+
"show-title": false,
|
|
3438
3399
|
onClick: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
3439
3400
|
}, ["prevent", "stop"])),
|
|
3440
3401
|
"onUpdate:modelValue": handleSpecificTimeChange
|
|
@@ -3446,6 +3407,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3446
3407
|
ref_for: true,
|
|
3447
3408
|
ref_key: "inputRef",
|
|
3448
3409
|
ref: inputRef,
|
|
3410
|
+
style: { "width": "174px" },
|
|
3449
3411
|
modelValue: inputValue.value,
|
|
3450
3412
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => inputValue.value = $event),
|
|
3451
3413
|
clearable: false,
|
|
@@ -3456,7 +3418,6 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3456
3418
|
suffix: item.suffix,
|
|
3457
3419
|
autofocus: "true",
|
|
3458
3420
|
size: "small",
|
|
3459
|
-
style: { "width": "174px" },
|
|
3460
3421
|
type: "number",
|
|
3461
3422
|
onKeypress: (v, e) => handleInputKeyPress(e, v, item)
|
|
3462
3423
|
}, null, 8, ["modelValue", "placeholder", "suffix", "onKeypress"]))
|
|
@@ -3481,7 +3442,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3481
3442
|
]),
|
|
3482
3443
|
_: 1
|
|
3483
3444
|
/* STABLE */
|
|
3484
|
-
}, 8, ["no-match-text", "prefix", "search-placeholder"
|
|
3445
|
+
}, 8, ["model-value", "no-match-text", "prefix", "search-placeholder"])
|
|
3485
3446
|
]);
|
|
3486
3447
|
};
|
|
3487
3448
|
}
|
|
@@ -3510,10 +3471,8 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
3510
3471
|
watch(
|
|
3511
3472
|
() => props.value,
|
|
3512
3473
|
(val) => {
|
|
3513
|
-
if (!val)
|
|
3514
|
-
|
|
3515
|
-
if (props.type !== val.dateMode)
|
|
3516
|
-
return;
|
|
3474
|
+
if (!val) return;
|
|
3475
|
+
if (props.type !== val.dateMode) return;
|
|
3517
3476
|
recentUnit.value = val.recentOrFuturedateUnit;
|
|
3518
3477
|
dateValue.value = val.recentOrFuturedateNum || void 0;
|
|
3519
3478
|
recentBaselineTime.value = val == null ? void 0 : val.startBaselineTime;
|
|
@@ -3523,14 +3482,12 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
3523
3482
|
}
|
|
3524
3483
|
);
|
|
3525
3484
|
const handleSubmit = () => {
|
|
3526
|
-
if (!dateValue.value)
|
|
3527
|
-
return;
|
|
3485
|
+
if (!dateValue.value) return;
|
|
3528
3486
|
const emitDate = props.type === DateMode.FUTURE ? [NowConstant, `${DateMode.FUTURE}${dateValue.value}${recentUnit.value}`] : [`${DateMode.RECENT}${dateValue.value}${recentUnit.value}`, NowConstant].map(
|
|
3529
3487
|
(v) => recentBaselineTime.value && recentBaselineTime.value !== NowConstant ? v.replace(NowConstant, `(${recentBaselineTime.value})`) : v
|
|
3530
3488
|
);
|
|
3531
3489
|
isValidate.value = !!validateDateValue(emitDate);
|
|
3532
|
-
if (!isValidate.value)
|
|
3533
|
-
return;
|
|
3490
|
+
if (!isValidate.value) return;
|
|
3534
3491
|
if (props.type === DateMode.FUTURE) {
|
|
3535
3492
|
emits("change", emitDate);
|
|
3536
3493
|
return;
|
|
@@ -3556,24 +3513,24 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
3556
3513
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => recentBaselineTime.value = $event)
|
|
3557
3514
|
}, null, 8, ["modelValue"])) : createCommentVNode("v-if", true),
|
|
3558
3515
|
createVNode(unref(Input), {
|
|
3516
|
+
class: "recent-input",
|
|
3559
3517
|
modelValue: dateValue.value,
|
|
3560
3518
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => dateValue.value = $event),
|
|
3561
3519
|
min: 1,
|
|
3562
3520
|
placeholder: unref(t)("请输入"),
|
|
3563
3521
|
precision: 0,
|
|
3564
3522
|
prefix: _ctx.type === unref(DateMode).RECENT ? unref(t)("的最近") : unref(t)("未来"),
|
|
3565
|
-
class: "recent-input",
|
|
3566
3523
|
type: "number",
|
|
3567
3524
|
onClick: _cache[2] || (_cache[2] = ($event) => isValidate.value = true)
|
|
3568
3525
|
}, null, 8, ["modelValue", "placeholder", "prefix"]),
|
|
3569
3526
|
createVNode(unref(Select), {
|
|
3527
|
+
class: "recent-unit",
|
|
3570
3528
|
modelValue: recentUnit.value,
|
|
3571
3529
|
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => recentUnit.value = $event),
|
|
3572
3530
|
clearable: false,
|
|
3531
|
+
"popover-min-width": 130,
|
|
3573
3532
|
"popover-options": { boundary: "parent" },
|
|
3574
|
-
class: "recent-unit",
|
|
3575
3533
|
filterable: "",
|
|
3576
|
-
"popover-min-width": 130,
|
|
3577
3534
|
onClick: _cache[4] || (_cache[4] = ($event) => isValidate.value = true)
|
|
3578
3535
|
}, {
|
|
3579
3536
|
default: withCtx(() => [
|
|
@@ -3641,6 +3598,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
3641
3598
|
};
|
|
3642
3599
|
return (_ctx, _cache) => {
|
|
3643
3600
|
return openBlock(), createBlock(unref(Select), {
|
|
3601
|
+
class: "timezone-picker",
|
|
3644
3602
|
clearable: false,
|
|
3645
3603
|
"filter-option": handleSearch,
|
|
3646
3604
|
"input-search": false,
|
|
@@ -3649,7 +3607,6 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
3649
3607
|
placeholder: unref(t)("请输入搜索(国家,城市,简称)"),
|
|
3650
3608
|
"popover-options": { "ext-cls": "__bk-date-picker-popover__" },
|
|
3651
3609
|
"search-placeholder": unref(t)("请输入搜索(国家,城市,简称)"),
|
|
3652
|
-
class: "timezone-picker",
|
|
3653
3610
|
filterable: "",
|
|
3654
3611
|
onChange: handleChange
|
|
3655
3612
|
}, {
|
|
@@ -3802,7 +3759,7 @@ const _hoisted_2$1 = {
|
|
|
3802
3759
|
key: 0,
|
|
3803
3760
|
class: "common-date-list"
|
|
3804
3761
|
};
|
|
3805
|
-
const _hoisted_3$1 = ["
|
|
3762
|
+
const _hoisted_3$1 = ["onClick", "onMouseenter"];
|
|
3806
3763
|
const _hoisted_4$1 = {
|
|
3807
3764
|
key: 1,
|
|
3808
3765
|
class: "common-wrapper"
|
|
@@ -3825,7 +3782,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3825
3782
|
},
|
|
3826
3783
|
emits: ["change", "update:timezone"],
|
|
3827
3784
|
setup(__props, { emit: __emit }) {
|
|
3828
|
-
const { commonUseList, format, storeKey: storeKey2, timezoneInfo, version } =
|
|
3785
|
+
const { commonUseList, format, storeKey: storeKey2, timezoneInfo, version } = useDatePickerInject();
|
|
3829
3786
|
const props = __props;
|
|
3830
3787
|
const emits = __emit;
|
|
3831
3788
|
let popoverInstance = null;
|
|
@@ -3833,8 +3790,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3833
3790
|
const activePanel = ref("common");
|
|
3834
3791
|
const defaultTabKey = computed(() => {
|
|
3835
3792
|
const tab = localStorage.getItem(getStoreTabKey(version.value));
|
|
3836
|
-
if (!tab)
|
|
3837
|
-
return DateMode.Date;
|
|
3793
|
+
if (!tab) return DateMode.Date;
|
|
3838
3794
|
if (Object.values(DateMode).includes(tab)) {
|
|
3839
3795
|
return tab;
|
|
3840
3796
|
}
|
|
@@ -3876,12 +3832,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3876
3832
|
};
|
|
3877
3833
|
const isSameDateRange = (date1, date2) => {
|
|
3878
3834
|
var _a, _b, _c, _d, _e, _f;
|
|
3879
|
-
if (!date1 || !date2)
|
|
3880
|
-
|
|
3881
|
-
if (((
|
|
3882
|
-
return true;
|
|
3883
|
-
if (((_e = date1 == null ? void 0 : date1.toDisplayString) == null ? void 0 : _e.call(date1)) === ((_f = date2 == null ? void 0 : date2.toDisplayString) == null ? void 0 : _f.call(date2)))
|
|
3884
|
-
return true;
|
|
3835
|
+
if (!date1 || !date2) return false;
|
|
3836
|
+
if (((_b = (_a = date1.dateValue) == null ? void 0 : _a.join) == null ? void 0 : _b.call(_a, "~")) === ((_d = (_c = date2 == null ? void 0 : date2.dateValue) == null ? void 0 : _c.join) == null ? void 0 : _d.call(_c, "~"))) return true;
|
|
3837
|
+
if (((_e = date1 == null ? void 0 : date1.toDisplayString) == null ? void 0 : _e.call(date1)) === ((_f = date2 == null ? void 0 : date2.toDisplayString) == null ? void 0 : _f.call(date2))) return true;
|
|
3885
3838
|
return false;
|
|
3886
3839
|
};
|
|
3887
3840
|
const handleDeleteConfirm = () => {
|
|
@@ -3919,16 +3872,16 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3919
3872
|
null,
|
|
3920
3873
|
renderList(dateList.value, (date, index) => {
|
|
3921
3874
|
return openBlock(), createElementBlock("li", {
|
|
3922
|
-
key: index,
|
|
3923
3875
|
class: normalizeClass({
|
|
3924
3876
|
"list-item": true,
|
|
3925
3877
|
"is-recent-item": activePanel.value === "recent",
|
|
3926
3878
|
"is-selected": isSameDateRange(date, _ctx.defaultDate),
|
|
3927
3879
|
"is-disabled": !unref(validateDateRange)(date)
|
|
3928
3880
|
}),
|
|
3881
|
+
key: index,
|
|
3882
|
+
onClick: ($event) => unref(validateDateRange)(date) && handleChange(date.dateValue),
|
|
3929
3883
|
onMouseenter: ($event) => !unref(validateDateRange)(date) && handleShowDisableMsg($event),
|
|
3930
|
-
onMouseleave: handleHideDisableMsg
|
|
3931
|
-
onClick: ($event) => unref(validateDateRange)(date) && handleChange(date.dateValue)
|
|
3884
|
+
onMouseleave: handleHideDisableMsg
|
|
3932
3885
|
}, toDisplayString(date.toDisplayString()), 43, _hoisted_3$1);
|
|
3933
3886
|
}),
|
|
3934
3887
|
128
|
|
@@ -3949,9 +3902,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3949
3902
|
)
|
|
3950
3903
|
])),
|
|
3951
3904
|
createVNode(_sfc_main$9, {
|
|
3905
|
+
class: "date-pick-tab",
|
|
3952
3906
|
"model-value": activeDatePickTab.value,
|
|
3953
3907
|
panels: unref(datePickTabList),
|
|
3954
|
-
class: "date-pick-tab",
|
|
3955
3908
|
"onUpdate:modelValue": handleDateTabChange
|
|
3956
3909
|
}, null, 8, ["model-value", "panels"]),
|
|
3957
3910
|
(openBlock(), createBlock(
|
|
@@ -4032,11 +3985,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
4032
3985
|
const _hoisted_1 = /* @__PURE__ */ createElementVNode(
|
|
4033
3986
|
"svg",
|
|
4034
3987
|
{
|
|
4035
|
-
|
|
3988
|
+
width: "14",
|
|
4036
3989
|
height: "14",
|
|
3990
|
+
class: "date-content-icon",
|
|
4037
3991
|
version: "1.1",
|
|
4038
3992
|
viewBox: "0 0 1024 1024",
|
|
4039
|
-
width: "14",
|
|
4040
3993
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4041
3994
|
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
4042
3995
|
},
|
|
@@ -4095,8 +4048,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4095
4048
|
const timezoneInfo = computed(() => getTimezoneInfoByValue(props.timezone || dayjs.tz.guess()));
|
|
4096
4049
|
const diffTimezone = computed(() => {
|
|
4097
4050
|
const timezone = props.timezone;
|
|
4098
|
-
if (!timezone || props.timezone === dayjs.tz.guess())
|
|
4099
|
-
return 0;
|
|
4051
|
+
if (!timezone || props.timezone === dayjs.tz.guess()) return 0;
|
|
4100
4052
|
const a = dayjs().utcOffset();
|
|
4101
4053
|
const b = dayjs.tz(dayjs(), timezone).utcOffset();
|
|
4102
4054
|
return (b - a) / 60;
|
|
@@ -4138,8 +4090,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4138
4090
|
let enterTimer;
|
|
4139
4091
|
let leaveTimer;
|
|
4140
4092
|
function handleDateMouseenter() {
|
|
4141
|
-
if (enterTimer)
|
|
4142
|
-
return;
|
|
4093
|
+
if (enterTimer) return;
|
|
4143
4094
|
enterTimer = setTimeout(() => {
|
|
4144
4095
|
tooltipsShow.value = true;
|
|
4145
4096
|
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value, props.timezone);
|
|
@@ -4147,8 +4098,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4147
4098
|
}, 100);
|
|
4148
4099
|
}
|
|
4149
4100
|
function handleDateMouseleave() {
|
|
4150
|
-
if (leaveTimer)
|
|
4151
|
-
clearTimeout(leaveTimer);
|
|
4101
|
+
if (leaveTimer) clearTimeout(leaveTimer);
|
|
4152
4102
|
leaveTimer = setTimeout(() => {
|
|
4153
4103
|
tooltipsShow.value = false;
|
|
4154
4104
|
leaveTimer = null;
|
|
@@ -4158,8 +4108,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4158
4108
|
datePanelShow.value = false;
|
|
4159
4109
|
const [start, end] = val;
|
|
4160
4110
|
const [oldStart, oldEnd] = props.modelValue || [];
|
|
4161
|
-
if (start && end && start === oldStart && end === oldEnd)
|
|
4162
|
-
return;
|
|
4111
|
+
if (start && end && start === oldStart && end === oldEnd) return;
|
|
4163
4112
|
dateDetail.value = new DateRange(val, format.value, props.timezone);
|
|
4164
4113
|
const emitValue = dateDetail.value.toEmitValue();
|
|
4165
4114
|
emits("update:modelValue", ...emitValue);
|
|
@@ -4176,15 +4125,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4176
4125
|
};
|
|
4177
4126
|
const diffDateDuration = (type) => {
|
|
4178
4127
|
var _a, _b;
|
|
4179
|
-
if (((_a = dateDetail.value.dateValue) == null ? void 0 : _a.length) < 2)
|
|
4180
|
-
return;
|
|
4128
|
+
if (((_a = dateDetail.value.dateValue) == null ? void 0 : _a.length) < 2) return;
|
|
4181
4129
|
const { endDate, startDate } = dateDetail.value;
|
|
4182
4130
|
const durations = dateDetail.value.dateDuration();
|
|
4183
4131
|
const val = type === "left" ? [startDate.subtract(durations), endDate.subtract(durations)] : [startDate.add(durations), endDate.add(durations)];
|
|
4184
4132
|
if ((_b = props.validDateRange) == null ? void 0 : _b.length) {
|
|
4185
4133
|
const validDateRange = new DateRange(props.validDateRange, props.format, props.timezone);
|
|
4186
|
-
if (!validDateRange.isInValidDateRange(new DateRange(val, props.format, props.timezone)))
|
|
4187
|
-
return;
|
|
4134
|
+
if (!validDateRange.isInValidDateRange(new DateRange(val, props.format, props.timezone))) return;
|
|
4188
4135
|
}
|
|
4189
4136
|
handleChange(val);
|
|
4190
4137
|
};
|
|
@@ -4195,8 +4142,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4195
4142
|
diffDateDuration("right");
|
|
4196
4143
|
};
|
|
4197
4144
|
const handleClickoutside = (e) => {
|
|
4198
|
-
if (!datePanelShow.value)
|
|
4199
|
-
return;
|
|
4145
|
+
if (!datePanelShow.value) return;
|
|
4200
4146
|
if (!Array.from(document.querySelectorAll(".__bk-date-picker-popover__")).some(
|
|
4201
4147
|
(item) => item.contains(e.target)
|
|
4202
4148
|
)) {
|
|
@@ -4235,10 +4181,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4235
4181
|
createVNode(unref(AngleLeft), { class: "date-icon-left" })
|
|
4236
4182
|
]),
|
|
4237
4183
|
createVNode(unref(Popover), {
|
|
4184
|
+
"ext-cls": "bk-date-picker-popover __bk-date-picker-popover__",
|
|
4238
4185
|
arrow: false,
|
|
4239
4186
|
"is-show": datePanelShow.value,
|
|
4240
4187
|
offset: { mainAxis: 10, crossAxis: 10, alignmentAxis: -32 },
|
|
4241
|
-
"ext-cls": "bk-date-picker-popover __bk-date-picker-popover__",
|
|
4242
4188
|
placement: "bottom-start",
|
|
4243
4189
|
theme: "light",
|
|
4244
4190
|
trigger: "manual",
|
|
@@ -4246,12 +4192,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4246
4192
|
}, {
|
|
4247
4193
|
content: withCtx(() => [
|
|
4248
4194
|
createVNode(_sfc_main$1, {
|
|
4249
|
-
"need-timezone": _ctx.needTimezone,
|
|
4250
4195
|
"default-date": dateDetail.value,
|
|
4196
|
+
"need-timezone": _ctx.needTimezone,
|
|
4251
4197
|
timezone: _ctx.timezone,
|
|
4252
4198
|
onChange: handleChange,
|
|
4253
4199
|
"onUpdate:timezone": handleTimezoneChange
|
|
4254
|
-
}, null, 8, ["
|
|
4200
|
+
}, null, 8, ["default-date", "need-timezone", "timezone"])
|
|
4255
4201
|
]),
|
|
4256
4202
|
default: withCtx(() => {
|
|
4257
4203
|
var _a;
|
|
@@ -4261,8 +4207,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4261
4207
|
{
|
|
4262
4208
|
ref_key: "dateContentRef",
|
|
4263
4209
|
ref: dateContentRef,
|
|
4264
|
-
popoverDelay: [100, 10],
|
|
4265
4210
|
class: "date-content",
|
|
4211
|
+
popoverDelay: [100, 10],
|
|
4266
4212
|
onClick: handleClickDate,
|
|
4267
4213
|
onMouseenter: handleDateMouseenter,
|
|
4268
4214
|
onMouseleave: handleDateMouseleave
|