@blueking/date-picker 2.0.0-beta.33 → 2.0.0-beta.35
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/README.md +2 -0
- package/package.json +1 -1
- package/typings/date-picker.vue.d.ts +6 -3
- package/typings/hooks/use-validate.d.ts +1 -1
- package/typings/lang/lang.d.ts +3 -1
- package/typings/utils/date.d.ts +5 -2
- package/typings/utils/duration.d.ts +6 -0
- package/typings/utils/index.d.ts +1 -0
- package/typings/utils/types.d.ts +6 -1
- package/typings/utils/utils.d.ts +6 -4
- package/vue2/index.es.min.js +120 -33
- package/vue2/index.iife.min.js +119 -32
- package/vue2/index.umd.min.js +119 -32
- package/vue3/index.es.min.js +118 -33
- package/vue3/index.iife.min.js +117 -32
- package/vue3/index.umd.min.js +117 -32
package/README.md
CHANGED
|
@@ -91,6 +91,8 @@ export default {
|
|
|
91
91
|
| timezone | 时区值 | `string` | 浏览器时区 |
|
|
92
92
|
| validDateRange | 有效可选的日期范围 | `DateValue \| undefined` | |
|
|
93
93
|
| version | 版本号 用于控制本地缓存 | `number \| string` | '1.0' |
|
|
94
|
+
| minDuration | 最小可选时间跨度毫秒值 | `number` | |
|
|
95
|
+
| maxDuration | 最大可选时间跨度毫秒值 | `number` | |
|
|
94
96
|
|
|
95
97
|
### 事件列表
|
|
96
98
|
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
14
14
|
"update:modelValue": (value: DateValue | undefined, info: {
|
|
15
15
|
dayjs: dayjs.Dayjs | null;
|
|
16
16
|
formatText: null | string;
|
|
17
|
-
}[]) => void;
|
|
17
|
+
}[], rawVal: DateValue) => void;
|
|
18
18
|
"update:timezone": (value: string, timezoneInfo: ITimezoneItem) => void;
|
|
19
19
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<IDatePickerProps>, {
|
|
20
20
|
behavior: string;
|
|
@@ -26,13 +26,16 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
26
26
|
"onUpdate:modelValue"?: ((value: DateValue | undefined, info: {
|
|
27
27
|
dayjs: dayjs.Dayjs | null;
|
|
28
28
|
formatText: null | string;
|
|
29
|
-
}[]) => any) | undefined;
|
|
29
|
+
}[], rawVal: DateValue) => any) | undefined;
|
|
30
30
|
"onUpdate:timezone"?: ((value: string, timezoneInfo: ITimezoneItem) => any) | undefined;
|
|
31
31
|
}, {
|
|
32
32
|
format: string;
|
|
33
|
+
commonUseList: {
|
|
34
|
+
id: DateValue;
|
|
35
|
+
name: string;
|
|
36
|
+
}[] | DateValue[];
|
|
33
37
|
version: number | string;
|
|
34
38
|
behavior: "normal" | "simplicity";
|
|
35
|
-
commonUseList: DateValue[];
|
|
36
39
|
needTimezone: boolean;
|
|
37
40
|
}, {}>;
|
|
38
41
|
export default _default;
|
|
@@ -3,7 +3,7 @@ import { type DateValue } from '../utils';
|
|
|
3
3
|
import { DateRange } from '../utils/date';
|
|
4
4
|
export declare const useValidate: () => {
|
|
5
5
|
validDateRange: import("vue").Ref<DateRange | undefined>;
|
|
6
|
-
validMsg: import("vue").
|
|
6
|
+
validMsg: import("vue").Ref<string>;
|
|
7
7
|
validateDateRange: (validDate: DateRange) => boolean;
|
|
8
8
|
validateDateValue: (validDate: DateValue) => boolean;
|
|
9
9
|
validateDayjs: (validDate: Dayjs) => boolean;
|
package/typings/lang/lang.d.ts
CHANGED
|
@@ -73,12 +73,14 @@ export declare const langData: {
|
|
|
73
73
|
readonly 近: "Last";
|
|
74
74
|
readonly '\uFF08\u81F3\u4ECA\uFF09': " so far";
|
|
75
75
|
readonly '\uFF0C\u65E0\u6CD5\u9009\u62E9': ", cannot be selected";
|
|
76
|
+
readonly 时间范围不能小于: "Time range cannot be less than";
|
|
77
|
+
readonly 时间范围不能大于: "Time range cannot be greater than";
|
|
76
78
|
};
|
|
77
79
|
export type NaturalDateKey = keyof typeof naturalDateLangData;
|
|
78
80
|
export type TimeUnitDateKey = keyof typeof timeUnitLangData;
|
|
79
81
|
export type ShortTimeUnitDateKey = keyof typeof shortTimeUnitLangData;
|
|
80
82
|
export type LangKey = keyof typeof langData;
|
|
81
83
|
export type LangValue = (typeof langData)[LangKey];
|
|
82
|
-
export declare const langValueMap: Record<LangValue, "前" | "取消" | "将来" | "常用时间" | "开始时间" | "开始时间不能大于结束时间" | "支持多种时间格式自动转换" | "整" | "无匹配数据" | "日期选择" | "时区设置" | "时差:早 $n 小时" | "时差:晚 $n 小时" | "时间格式支持" | "是否清空最近使用?" | "暂无常用时间" | "暂无最近使用记录" | "最近" | "最近使用" | "未来" | "查看支持格式" | "格式" | "此刻" | "浏览器时区" | "的最近" | "确定" | "示例" | "结束时间" | "自然日期" | "至今" | "请输入" | "请输入搜索(国家,城市,简称)" | "超出可选范围" | "近" | "(至今)" | ",无法选择">;
|
|
84
|
+
export declare const langValueMap: Record<LangValue, "前" | "取消" | "将来" | "常用时间" | "开始时间" | "开始时间不能大于结束时间" | "支持多种时间格式自动转换" | "整" | "无匹配数据" | "日期选择" | "时区设置" | "时差:早 $n 小时" | "时差:晚 $n 小时" | "时间格式支持" | "是否清空最近使用?" | "暂无常用时间" | "暂无最近使用记录" | "最近" | "最近使用" | "未来" | "查看支持格式" | "格式" | "此刻" | "浏览器时区" | "的最近" | "确定" | "示例" | "结束时间" | "自然日期" | "至今" | "请输入" | "请输入搜索(国家,城市,简称)" | "超出可选范围" | "近" | "(至今)" | ",无法选择" | "时间范围不能小于" | "时间范围不能大于">;
|
|
83
85
|
export declare const lang: string;
|
|
84
86
|
export declare const t: (key: LangKey | NaturalDateKey | ShortTimeUnitDateKey | TimeUnitDateKey) => string;
|
package/typings/utils/date.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import dayjs, { type Dayjs } from 'dayjs';
|
|
1
|
+
import dayjs, { type Dayjs, type OpUnitType } from 'dayjs';
|
|
2
2
|
import { type DateUnit } from './constant';
|
|
3
3
|
import { DateMode, type DateValue } from './types';
|
|
4
4
|
export declare const baselineDateRegexp: RegExp;
|
|
@@ -22,6 +22,7 @@ export declare class DateRange {
|
|
|
22
22
|
startDate: Dayjs | null;
|
|
23
23
|
startNum: number | undefined;
|
|
24
24
|
startUnit: DateUnit | undefined;
|
|
25
|
+
userDisplayName: string | undefined;
|
|
25
26
|
constructor(dateValue?: DateValue, format?: string, timezome?: string);
|
|
26
27
|
get dateMode(): DateMode;
|
|
27
28
|
get endDisplayText(): string;
|
|
@@ -29,8 +30,10 @@ export declare class DateRange {
|
|
|
29
30
|
get recentOrFuturedateNum(): number | undefined;
|
|
30
31
|
get recentOrFuturedateUnit(): "M" | "d" | "h" | "m" | "s" | "w" | "y" | undefined;
|
|
31
32
|
get startDisplayText(): string;
|
|
32
|
-
dateDuration(): number | undefined;
|
|
33
|
+
dateDuration(unit?: OpUnitType | dayjs.QUnitType): number | undefined;
|
|
33
34
|
isInValidDateRange(date: DateRange): boolean;
|
|
35
|
+
isInValidDuration(minDuration?: number, maxDuration?: number): boolean;
|
|
36
|
+
setUserDisplayName(v: string): void;
|
|
34
37
|
toDisplayString(): string;
|
|
35
38
|
toEmitValue(): [
|
|
36
39
|
DateValue,
|
package/typings/utils/index.d.ts
CHANGED
package/typings/utils/types.d.ts
CHANGED
|
@@ -20,7 +20,10 @@ export type CommonDateValue = [string, string];
|
|
|
20
20
|
export type DateValue = [Dayjs | number | string, Dayjs | number | string];
|
|
21
21
|
export interface IDatePickerProps {
|
|
22
22
|
behavior?: 'normal' | 'simplicity';
|
|
23
|
-
commonUseList?:
|
|
23
|
+
commonUseList?: {
|
|
24
|
+
id: DateValue;
|
|
25
|
+
name: string;
|
|
26
|
+
}[] | DateValue[];
|
|
24
27
|
disabled?: boolean;
|
|
25
28
|
format?: string;
|
|
26
29
|
modelValue: DateValue | undefined;
|
|
@@ -28,4 +31,6 @@ export interface IDatePickerProps {
|
|
|
28
31
|
timezone?: string;
|
|
29
32
|
validDateRange?: DateValue;
|
|
30
33
|
version?: number | string;
|
|
34
|
+
minDuration?: number;
|
|
35
|
+
maxDuration?: number;
|
|
31
36
|
}
|
package/typings/utils/utils.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { type ComputedRef, type InjectionKey } from 'vue';
|
|
1
|
+
import { type ComputedRef, type InjectionKey, type Ref } from 'vue';
|
|
2
2
|
import { type LangKey } from '../lang/lang';
|
|
3
3
|
import { type ITimezoneItem } from './timezone';
|
|
4
|
-
import { type DateValue } from './types';
|
|
4
|
+
import { type IDatePickerProps, type DateValue } from './types';
|
|
5
5
|
export interface IDatePickerProvider {
|
|
6
|
-
commonUseList: ComputedRef<
|
|
6
|
+
commonUseList: ComputedRef<IDatePickerProps['commonUseList']>;
|
|
7
7
|
format: ComputedRef<string>;
|
|
8
8
|
storeKey: ComputedRef<string>;
|
|
9
9
|
t: (key: LangKey) => string;
|
|
10
10
|
timezoneInfo: ComputedRef<ITimezoneItem>;
|
|
11
11
|
version: ComputedRef<number | string>;
|
|
12
|
-
|
|
12
|
+
validateTimeRange: ComputedRef<DateValue | undefined>;
|
|
13
|
+
minDuration: Ref<number | undefined>;
|
|
14
|
+
maxDuration: Ref<number | undefined>;
|
|
13
15
|
}
|
|
14
16
|
export declare const DATE_PICKER_PROVIDER_KEY: InjectionKey<IDatePickerProvider>;
|
|
15
17
|
export declare const useDatePickerProvider: (data: IDatePickerProvider) => void;
|
package/vue2/index.es.min.js
CHANGED
|
@@ -2,7 +2,7 @@ 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
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE_vue__ from "@blueking/bkui-library";
|
|
5
|
-
import { provide, inject,
|
|
5
|
+
import { provide, inject, ref, customRef, defineComponent, openBlock, createElementBlock, createVNode, unref, withCtx, Fragment, renderList, createBlock, createCommentVNode, createTextVNode, toDisplayString, shallowRef, watch, createElementVNode, normalizeClass, withModifiers, computed, normalizeStyle, withDirectives, withKeys, onMounted, vShow, nextTick, mergeProps, KeepAlive, resolveDynamicComponent, onBeforeUnmount, createApp, h as h$1 } from "@blueking/bkui-library";
|
|
6
6
|
import dayjs from "dayjs";
|
|
7
7
|
import customParseFormat from "dayjs/plugin/customParseFormat";
|
|
8
8
|
import localizedFormat from "dayjs/plugin/localizedFormat";
|
|
@@ -23008,7 +23008,9 @@ const langData = {
|
|
|
23008
23008
|
超出可选范围: "Out of range",
|
|
23009
23009
|
近: "Last",
|
|
23010
23010
|
"(至今)": " so far",
|
|
23011
|
-
",无法选择": ", cannot be selected"
|
|
23011
|
+
",无法选择": ", cannot be selected",
|
|
23012
|
+
时间范围不能小于: "Time range cannot be less than",
|
|
23013
|
+
时间范围不能大于: "Time range cannot be greater than"
|
|
23012
23014
|
};
|
|
23013
23015
|
Object.keys(langData).reduce(
|
|
23014
23016
|
(pre, cur) => {
|
|
@@ -23254,6 +23256,7 @@ class DateRange {
|
|
|
23254
23256
|
__publicField(this, "startDate");
|
|
23255
23257
|
__publicField(this, "startNum");
|
|
23256
23258
|
__publicField(this, "startUnit");
|
|
23259
|
+
__publicField(this, "userDisplayName");
|
|
23257
23260
|
this.dateValue = dateValue;
|
|
23258
23261
|
this.format = format;
|
|
23259
23262
|
this.timezome = timezome;
|
|
@@ -23314,22 +23317,22 @@ class DateRange {
|
|
|
23314
23317
|
var _a;
|
|
23315
23318
|
return dayjs.tz(((_a = this.startDate) == null ? void 0 : _a.valueOf()) || void 0, this.timezome).format(this.format);
|
|
23316
23319
|
}
|
|
23317
|
-
dateDuration() {
|
|
23320
|
+
dateDuration(unit) {
|
|
23318
23321
|
if (!this.startDate || !this.endDate || !this.isValidate) return;
|
|
23319
23322
|
let durations = this.endDate.diff(this.startDate);
|
|
23320
23323
|
const dayDuration = 24 * 60 * 60 * 1e3;
|
|
23321
23324
|
switch (this.dateMode) {
|
|
23322
23325
|
case DateMode.RECENT:
|
|
23323
|
-
durations = dayjs().add(this.startNum, this.startUnit).diff(dayjs());
|
|
23326
|
+
durations = dayjs().add(this.startNum, this.startUnit).diff(dayjs(), unit);
|
|
23324
23327
|
break;
|
|
23325
23328
|
case DateMode.FUTURE:
|
|
23326
23329
|
durations = dayjs().diff(
|
|
23327
23330
|
dayjs().add(this.endNum, this.endUnit),
|
|
23328
|
-
this.endUnit
|
|
23331
|
+
unit || this.endUnit
|
|
23329
23332
|
);
|
|
23330
23333
|
break;
|
|
23331
23334
|
case DateMode.NATURAL:
|
|
23332
|
-
durations = this.endDate.diff(this.startDate);
|
|
23335
|
+
durations = this.endDate.diff(this.startDate, unit);
|
|
23333
23336
|
const dayDuration2 = 24 * 60 * 60 * 1e3;
|
|
23334
23337
|
if (durations % dayDuration2 === dayDuration2 - 1) {
|
|
23335
23338
|
durations += 1;
|
|
@@ -23337,7 +23340,7 @@ class DateRange {
|
|
|
23337
23340
|
break;
|
|
23338
23341
|
default:
|
|
23339
23342
|
case DateMode.Date:
|
|
23340
|
-
durations = this.endDate.diff(this.startDate);
|
|
23343
|
+
durations = this.endDate.diff(this.startDate, unit);
|
|
23341
23344
|
break;
|
|
23342
23345
|
}
|
|
23343
23346
|
const durationMod = durations % dayDuration;
|
|
@@ -23352,6 +23355,15 @@ class DateRange {
|
|
|
23352
23355
|
if (!this.startDate || !this.endDate) return false;
|
|
23353
23356
|
return (this.startDate.isSame(date.startDate, "ms") || this.startDate.isBefore(date.startDate)) && (this.endDate.isSame(date.endDate, "ms") || this.endDate.isAfter(date.endDate));
|
|
23354
23357
|
}
|
|
23358
|
+
isInValidDuration(minDuration = 0, maxDuration = Number.MAX_SAFE_INTEGER) {
|
|
23359
|
+
if (!this.startDate || !this.endDate) return false;
|
|
23360
|
+
const durations = this.dateDuration();
|
|
23361
|
+
if (durations === void 0) return false;
|
|
23362
|
+
return durations >= minDuration && durations <= maxDuration;
|
|
23363
|
+
}
|
|
23364
|
+
setUserDisplayName(v2) {
|
|
23365
|
+
this.userDisplayName = v2;
|
|
23366
|
+
}
|
|
23355
23367
|
toDisplayString() {
|
|
23356
23368
|
var _a, _b;
|
|
23357
23369
|
const {
|
|
@@ -23366,6 +23378,7 @@ class DateRange {
|
|
|
23366
23378
|
startNum,
|
|
23367
23379
|
startUnit
|
|
23368
23380
|
} = this;
|
|
23381
|
+
if (this.userDisplayName) return this.userDisplayName;
|
|
23369
23382
|
if (!startDate || !endDate || !isValidate) {
|
|
23370
23383
|
return ((_a = this.dateValue) == null ? void 0 : _a.join(" ~ ")) || "";
|
|
23371
23384
|
}
|
|
@@ -23582,6 +23595,24 @@ const isValidTimeZone = (timeZone) => {
|
|
|
23582
23595
|
return false;
|
|
23583
23596
|
}
|
|
23584
23597
|
};
|
|
23598
|
+
const timeUnits = {
|
|
23599
|
+
天: 24 * 60 * 60 * 1e3,
|
|
23600
|
+
小时: 60 * 60 * 1e3,
|
|
23601
|
+
分钟: 60 * 1e3,
|
|
23602
|
+
秒: 1e3
|
|
23603
|
+
};
|
|
23604
|
+
const formatDuration = (milliseconds) => {
|
|
23605
|
+
let remainingTime = milliseconds;
|
|
23606
|
+
let result = "";
|
|
23607
|
+
for (const [unit, value] of Object.entries(timeUnits)) {
|
|
23608
|
+
const amount = Math.floor(remainingTime / value);
|
|
23609
|
+
if (amount > 0) {
|
|
23610
|
+
result += `${amount} ${t(unit)} `;
|
|
23611
|
+
remainingTime %= value;
|
|
23612
|
+
}
|
|
23613
|
+
}
|
|
23614
|
+
return result.trim();
|
|
23615
|
+
};
|
|
23585
23616
|
dayjs.extend(utc);
|
|
23586
23617
|
dayjs.extend(tz);
|
|
23587
23618
|
const timezoneData = [
|
|
@@ -24978,43 +25009,73 @@ const useDatePickerProvider = (data2) => {
|
|
|
24978
25009
|
};
|
|
24979
25010
|
const useDatePickerInject = () => inject(DATE_PICKER_PROVIDER_KEY);
|
|
24980
25011
|
const useValidate = () => {
|
|
24981
|
-
|
|
25012
|
+
var _a;
|
|
25013
|
+
const { format, timezoneInfo, validateTimeRange, minDuration, maxDuration } = useDatePickerInject();
|
|
25014
|
+
const validMsg = ref("");
|
|
24982
25015
|
const validDateRange = customRef((track) => {
|
|
24983
|
-
let date = new DateRange(
|
|
25016
|
+
let date = new DateRange(validateTimeRange.value, format.value, timezoneInfo.value.label);
|
|
24984
25017
|
return {
|
|
24985
25018
|
get() {
|
|
24986
|
-
var
|
|
25019
|
+
var _a2;
|
|
24987
25020
|
track();
|
|
24988
|
-
if (((
|
|
24989
|
-
if (
|
|
24990
|
-
return new DateRange(
|
|
25021
|
+
if (((_a2 = validateTimeRange.value) == null ? void 0 : _a2.length) !== 2) return void 0;
|
|
25022
|
+
if (validateTimeRange.value.some((v2) => typeof v2 === "string" && v2.includes("now")))
|
|
25023
|
+
return new DateRange(validateTimeRange.value, format.value, timezoneInfo.value.label);
|
|
24991
25024
|
return date;
|
|
24992
25025
|
},
|
|
24993
25026
|
set() {
|
|
24994
25027
|
}
|
|
24995
25028
|
};
|
|
24996
25029
|
});
|
|
25030
|
+
const rangeMsg = t("超出可选范围") + " (" + ((_a = validDateRange.value) == null ? void 0 : _a.toDisplayString()) + ") " + t(",无法选择");
|
|
25031
|
+
const validDuration = (validDate) => {
|
|
25032
|
+
let date;
|
|
25033
|
+
if (validDate instanceof DateRange) {
|
|
25034
|
+
date = validDate;
|
|
25035
|
+
} else {
|
|
25036
|
+
date = new DateRange(validDate, format.value, timezoneInfo.value.label);
|
|
25037
|
+
}
|
|
25038
|
+
const durations = Math.abs(date.dateDuration("ms") || 0);
|
|
25039
|
+
let message = "";
|
|
25040
|
+
if (minDuration.value && durations < minDuration.value) {
|
|
25041
|
+
message = t("时间范围不能小于") + " " + formatDuration(minDuration.value);
|
|
25042
|
+
}
|
|
25043
|
+
if (!message && maxDuration.value && durations > maxDuration.value) {
|
|
25044
|
+
message = t("时间范围不能大于") + " " + formatDuration(maxDuration.value);
|
|
25045
|
+
}
|
|
25046
|
+
return message;
|
|
25047
|
+
};
|
|
25048
|
+
const commonValidateFn = (date) => {
|
|
25049
|
+
var _a2;
|
|
25050
|
+
const isValid = ((_a2 = validDateRange.value) == null ? void 0 : _a2.isInValidDateRange(date)) ?? true;
|
|
25051
|
+
if (!isValid) {
|
|
25052
|
+
validMsg.value = rangeMsg;
|
|
25053
|
+
return isValid;
|
|
25054
|
+
}
|
|
25055
|
+
const message = validDuration(date);
|
|
25056
|
+
validMsg.value = message;
|
|
25057
|
+
return !message;
|
|
25058
|
+
};
|
|
24997
25059
|
const validateDateValue = (validDate) => {
|
|
24998
|
-
var _a;
|
|
24999
25060
|
if (!(validDate == null ? void 0 : validDate.length)) return false;
|
|
25000
|
-
|
|
25061
|
+
const date = new DateRange(validDate, format.value, timezoneInfo.value.label);
|
|
25062
|
+
return commonValidateFn(date);
|
|
25001
25063
|
};
|
|
25002
25064
|
const validateDateRange = (validDate) => {
|
|
25003
|
-
var _a;
|
|
25004
25065
|
if (!validDate.isValidate) return false;
|
|
25005
|
-
return (
|
|
25066
|
+
return commonValidateFn(validDate);
|
|
25006
25067
|
};
|
|
25007
25068
|
const validateDayjs = (validDate) => {
|
|
25008
|
-
var
|
|
25069
|
+
var _a2;
|
|
25070
|
+
validMsg.value = "";
|
|
25009
25071
|
if (!validDate.isValid()) return false;
|
|
25010
|
-
|
|
25011
|
-
|
|
25012
|
-
)
|
|
25072
|
+
const date = new DateRange([validDate.startOf("d"), validDate.endOf("d")], format.value, timezoneInfo.value.label);
|
|
25073
|
+
const isValid = ((_a2 = validDateRange.value) == null ? void 0 : _a2.isInValidDateRange(date)) ?? true;
|
|
25074
|
+
if (!isValid) {
|
|
25075
|
+
validMsg.value = rangeMsg;
|
|
25076
|
+
}
|
|
25077
|
+
return isValid;
|
|
25013
25078
|
};
|
|
25014
|
-
const validMsg = computed(() => {
|
|
25015
|
-
var _a;
|
|
25016
|
-
return t("超出可选范围") + " (" + ((_a = validDateRange.value) == null ? void 0 : _a.toDisplayString()) + ") " + t(",无法选择");
|
|
25017
|
-
});
|
|
25018
25079
|
return {
|
|
25019
25080
|
validDateRange,
|
|
25020
25081
|
validMsg,
|
|
@@ -26756,9 +26817,14 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
26756
26817
|
const browserTimezone = dayjs.tz.guess();
|
|
26757
26818
|
const recentUseList = shallowRef(getStoreDateList(storeKey2.value));
|
|
26758
26819
|
const dateList = computed(
|
|
26759
|
-
() => (activePanel.value === "common" ? commonUseList.value || commonDateList : recentUseList.value).map(
|
|
26760
|
-
(date
|
|
26761
|
-
|
|
26820
|
+
() => (activePanel.value === "common" ? commonUseList.value || commonDateList : recentUseList.value).map((date) => {
|
|
26821
|
+
if ((date == null ? void 0 : date.id) && date.name) {
|
|
26822
|
+
const dateRange = new DateRange(date.id, format.value, props2.timezone);
|
|
26823
|
+
dateRange.setUserDisplayName(date.name);
|
|
26824
|
+
return dateRange;
|
|
26825
|
+
}
|
|
26826
|
+
return new DateRange(date, format.value, props2.timezone);
|
|
26827
|
+
})
|
|
26762
26828
|
);
|
|
26763
26829
|
const handleChange = (date) => {
|
|
26764
26830
|
emits("change", date);
|
|
@@ -26984,7 +27050,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
26984
27050
|
needTimezone: { type: Boolean, default: true },
|
|
26985
27051
|
timezone: {},
|
|
26986
27052
|
validDateRange: {},
|
|
26987
|
-
version: { default: "1.0" }
|
|
27053
|
+
version: { default: "1.0" },
|
|
27054
|
+
minDuration: {},
|
|
27055
|
+
maxDuration: {}
|
|
26988
27056
|
},
|
|
26989
27057
|
emits: ["update:modelValue", "update:timezone"],
|
|
26990
27058
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -27036,6 +27104,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
27036
27104
|
var _a;
|
|
27037
27105
|
return ((_a = props2.commonUseList) == null ? void 0 : _a.length) ? props2.commonUseList : commonDateList;
|
|
27038
27106
|
});
|
|
27107
|
+
const dateDetailDisplayString = computed(() => {
|
|
27108
|
+
var _a;
|
|
27109
|
+
const commonDate = commonDateUseList.value.find((item) => {
|
|
27110
|
+
var _a2, _b, _c, _d;
|
|
27111
|
+
return Array.isArray(item.id) && ((_b = (_a2 = item.id).join) == null ? void 0 : _b.call(_a2, "_")) === ((_d = (_c = dateDetail.value) == null ? void 0 : _c.dateValue) == null ? void 0 : _d.join("_"));
|
|
27112
|
+
});
|
|
27113
|
+
if (commonDate) {
|
|
27114
|
+
return commonDate.name;
|
|
27115
|
+
}
|
|
27116
|
+
return (_a = dateDetail.value) == null ? void 0 : _a.toDisplayString();
|
|
27117
|
+
});
|
|
27039
27118
|
useDatePickerProvider({
|
|
27040
27119
|
commonUseList: commonDateUseList,
|
|
27041
27120
|
format,
|
|
@@ -27043,7 +27122,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
27043
27122
|
t,
|
|
27044
27123
|
timezoneInfo,
|
|
27045
27124
|
version: computed(() => props2.version),
|
|
27046
|
-
|
|
27125
|
+
validateTimeRange: computed(() => props2.validDateRange),
|
|
27126
|
+
minDuration: ref(props2.minDuration),
|
|
27127
|
+
maxDuration: ref(props2.maxDuration)
|
|
27047
27128
|
});
|
|
27048
27129
|
onBeforeUnmount(() => {
|
|
27049
27130
|
tooltipsShow.value = false;
|
|
@@ -27073,8 +27154,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
27073
27154
|
if (start2 && end2 && start2 === oldStart && end2 === oldEnd) return;
|
|
27074
27155
|
dateDetail.value = new DateRange(val, format.value, timezoneInfo.value.label);
|
|
27075
27156
|
const emitValue = dateDetail.value.toEmitValue();
|
|
27076
|
-
emits("update:modelValue", ...emitValue);
|
|
27077
|
-
const canStore = commonDateUseList.value.some((item) =>
|
|
27157
|
+
emits("update:modelValue", ...emitValue, [...val]);
|
|
27158
|
+
const canStore = commonDateUseList.value.some((item) => {
|
|
27159
|
+
const startDate = Array.isArray(item == null ? void 0 : item.id) ? item.id[0] : item[0];
|
|
27160
|
+
const endDate = Array.isArray(item == null ? void 0 : item.id) ? item.id[1] : item[1];
|
|
27161
|
+
return startDate === start2 && endDate === end2;
|
|
27162
|
+
});
|
|
27078
27163
|
!canStore && dateDetail.value.isValidate && setStoreDateList(val, storeKey2.value);
|
|
27079
27164
|
};
|
|
27080
27165
|
const handleTimezoneChange = (val, info) => {
|
|
@@ -27180,7 +27265,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
27180
27265
|
createElementVNode(
|
|
27181
27266
|
"span",
|
|
27182
27267
|
null,
|
|
27183
|
-
toDisplayString(
|
|
27268
|
+
toDisplayString(dateDetailDisplayString.value),
|
|
27184
27269
|
1
|
|
27185
27270
|
/* TEXT */
|
|
27186
27271
|
),
|
|
@@ -27299,6 +27384,8 @@ const vue2 = {
|
|
|
27299
27384
|
format: props2.format,
|
|
27300
27385
|
modelValue: props2.modelValue,
|
|
27301
27386
|
needTimezone: props2.needTimezone,
|
|
27387
|
+
minDuration: props2.minDuration,
|
|
27388
|
+
maxDuration: props2.maxDuration,
|
|
27302
27389
|
"onUpdate:modelValue"() {
|
|
27303
27390
|
emit("update:modelValue", ...arguments);
|
|
27304
27391
|
emit("change", ...arguments);
|