@blueking/date-picker 2.0.0-beta.8 → 3.0.0-beta.1
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 +15 -10
- package/package.json +14 -81
- package/typings/components/baseline-select.vue.d.ts +12 -0
- package/typings/components/common-submit.vue.d.ts +10 -19
- package/typings/components/common-tab.vue.d.ts +10 -14
- package/typings/components/date-list.vue.d.ts +15 -0
- package/typings/components/date-panel.vue.d.ts +9 -28
- package/typings/components/date-picker.vue.d.ts +8 -15
- package/typings/components/date-title.vue.d.ts +6 -0
- package/typings/components/natural-picker.vue.d.ts +6 -13
- package/typings/components/panel-wrapper.vue.d.ts +12 -21
- package/typings/components/recent-picker.vue.d.ts +10 -28
- package/typings/components/timezone-picker.vue.d.ts +14 -19
- package/typings/date-picker.vue.d.ts +21 -44
- package/typings/hooks/use-keydown-enter.d.ts +1 -0
- package/typings/hooks/use-validate.d.ts +17 -0
- package/typings/lang/lang.d.ts +14 -4
- package/typings/utils/constant.d.ts +8 -5
- package/typings/utils/cookie.d.ts +4 -0
- package/typings/utils/date.d.ts +38 -15
- package/typings/utils/duration.d.ts +5 -0
- package/typings/utils/index.d.ts +4 -3
- package/typings/utils/provider.d.ts +20 -0
- package/typings/utils/store.d.ts +1 -1
- package/typings/utils/timezone.d.ts +4 -4
- package/typings/utils/types.d.ts +22 -14
- package/typings/vue2.d.ts +20 -2
- package/typings/vue3.d.ts +7 -2
- package/vue2/config.json +1 -1
- package/vue2/index.es.min.js +25195 -18806
- package/vue2/index.iife.min.js +36661 -76
- package/vue2/index.umd.min.js +29072 -57
- package/vue2/vue2.css +3520 -1
- package/vue3/config.json +1 -1
- package/vue3/index.es.min.js +2957 -1717
- package/vue3/index.iife.min.js +29559 -57
- package/vue3/index.umd.min.js +4551 -2
- package/vue3/vue3.css +796 -1
- package/typings/utils/utils.d.ts +0 -15
package/typings/lang/lang.d.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
export declare const naturalDateLangData: {
|
|
2
|
+
readonly 'N \u5929\u524D': "N days ago";
|
|
2
3
|
readonly 上周: "Last week";
|
|
3
4
|
readonly 上月: "Last month";
|
|
4
5
|
readonly 今天: "Today";
|
|
5
6
|
readonly 今年: "This year";
|
|
7
|
+
readonly 具体时间: "Specific time";
|
|
6
8
|
readonly '\u524D N \u5468': "Previous N weeks";
|
|
7
9
|
readonly '\u524D N \u5929': "Previous N days";
|
|
8
10
|
readonly 前天: "The day before yesterday";
|
|
9
11
|
readonly 前年: "The year before last";
|
|
10
12
|
readonly 去年: "Last year";
|
|
13
|
+
readonly 基于: "Based on";
|
|
14
|
+
readonly 天前: "days ago";
|
|
11
15
|
readonly 昨天: "Yesterday";
|
|
12
16
|
readonly 本周: "This week";
|
|
13
17
|
readonly 本月: "This month";
|
|
@@ -57,6 +61,7 @@ export declare const langData: {
|
|
|
57
61
|
readonly 格式: "Format";
|
|
58
62
|
readonly 此刻: "now";
|
|
59
63
|
readonly 浏览器时区: "Browser timezone";
|
|
64
|
+
readonly 的最近: "Last";
|
|
60
65
|
readonly 确定: "Confirm";
|
|
61
66
|
readonly 示例: "Example";
|
|
62
67
|
readonly 结束时间: "End Time";
|
|
@@ -64,14 +69,19 @@ export declare const langData: {
|
|
|
64
69
|
readonly 至今: "so far";
|
|
65
70
|
readonly 请输入: "Please enter";
|
|
66
71
|
readonly '\u8BF7\u8F93\u5165\u641C\u7D22\uFF08\u56FD\u5BB6\uFF0C\u57CE\u5E02\uFF0C\u7B80\u79F0\uFF09': "Please enter search (country, city, abbreviation)";
|
|
72
|
+
readonly 超出可选范围: "Out of range";
|
|
67
73
|
readonly 近: "Last";
|
|
68
74
|
readonly '\uFF08\u81F3\u4ECA\uFF09': " so far";
|
|
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";
|
|
78
|
+
readonly 时间格式转换: "Time format conversion";
|
|
69
79
|
};
|
|
70
|
-
export type NaturalDateKey = keyof typeof naturalDateLangData;
|
|
71
|
-
export type TimeUnitDateKey = keyof typeof timeUnitLangData;
|
|
72
|
-
export type ShortTimeUnitDateKey = keyof typeof shortTimeUnitLangData;
|
|
73
80
|
export type LangKey = keyof typeof langData;
|
|
74
81
|
export type LangValue = (typeof langData)[LangKey];
|
|
75
|
-
export
|
|
82
|
+
export type NaturalDateKey = keyof typeof naturalDateLangData;
|
|
83
|
+
export type ShortTimeUnitDateKey = keyof typeof shortTimeUnitLangData;
|
|
84
|
+
export type TimeUnitDateKey = keyof typeof timeUnitLangData;
|
|
85
|
+
export declare const langValueMap: Record<LangValue, "前" | "取消" | "将来" | "常用时间" | "开始时间" | "开始时间不能大于结束时间" | "支持多种时间格式自动转换" | "整" | "无匹配数据" | "日期选择" | "时区设置" | "时差:早 $n 小时" | "时差:晚 $n 小时" | "时间格式支持" | "是否清空最近使用?" | "暂无常用时间" | "暂无最近使用记录" | "最近" | "最近使用" | "未来" | "查看支持格式" | "格式" | "此刻" | "浏览器时区" | "的最近" | "确定" | "示例" | "结束时间" | "自然日期" | "至今" | "请输入" | "请输入搜索(国家,城市,简称)" | "超出可选范围" | "近" | "(至今)" | ",无法选择" | "时间范围不能小于" | "时间范围不能大于" | "时间格式转换">;
|
|
76
86
|
export declare const lang: string;
|
|
77
87
|
export declare const t: (key: LangKey | NaturalDateKey | ShortTimeUnitDateKey | TimeUnitDateKey) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type DateValue, DateMode } from './types';
|
|
2
2
|
export declare const DateUnitList: readonly [{
|
|
3
3
|
readonly id: "s";
|
|
4
4
|
readonly name: string;
|
|
@@ -22,11 +22,12 @@ export declare const DateUnitList: readonly [{
|
|
|
22
22
|
readonly name: string;
|
|
23
23
|
}];
|
|
24
24
|
export type DateUnit = (typeof DateUnitList)[number]['id'];
|
|
25
|
-
export declare const dateUnit:
|
|
25
|
+
export declare const dateUnit: DateUnit;
|
|
26
26
|
export declare enum NaturalOptionType {
|
|
27
|
-
custom = "custom"
|
|
28
|
-
default = "default"
|
|
29
|
-
edit = "edit"
|
|
27
|
+
custom = "custom",// 自定义
|
|
28
|
+
default = "default",// 默认
|
|
29
|
+
edit = "edit",// 可编辑
|
|
30
|
+
specific = "specific"
|
|
30
31
|
}
|
|
31
32
|
export declare const CommonNaturalOptions: ({
|
|
32
33
|
id: string;
|
|
@@ -82,3 +83,5 @@ export declare const commonDateList: DateValue[];
|
|
|
82
83
|
export declare const NowConstant = "now";
|
|
83
84
|
export declare const DATE_REGEX_PARSE: RegExp;
|
|
84
85
|
export declare const DATE_REGEX_FORMAT: RegExp;
|
|
86
|
+
export declare const DEFAULT_TIMEZONE = "Asia/Shanghai";
|
|
87
|
+
export declare const MAX_NUMBER_VALUE = 10000;
|
package/typings/utils/date.d.ts
CHANGED
|
@@ -1,22 +1,48 @@
|
|
|
1
|
-
import dayjs, { Dayjs } from 'dayjs';
|
|
2
|
-
import { DateUnit } from './constant';
|
|
3
|
-
import {
|
|
1
|
+
import dayjs, { type Dayjs, type OpUnitType } from 'dayjs';
|
|
2
|
+
import { type DateUnit } from './constant';
|
|
3
|
+
import { type DateValue, DateMode } from './types';
|
|
4
|
+
export declare const baselineDateRegexp: RegExp;
|
|
4
5
|
export declare const commonDateRegexp: RegExp;
|
|
5
6
|
export declare const recentDateRegexp: RegExp;
|
|
6
7
|
export declare const futureDateRegexp: RegExp;
|
|
7
8
|
export declare const naturalDateRegexp: RegExp;
|
|
9
|
+
/**
|
|
10
|
+
* @description 不同日期范围统一在这里实例化处理
|
|
11
|
+
* 1、最近时间 now-1d now-12h
|
|
12
|
+
* 2、未来时间 now+1d now+12h
|
|
13
|
+
* 3、普通日期格式 2024-01-02 12:00:00
|
|
14
|
+
* 4、自然时间 now/d now-1d/d 昨天 前天
|
|
15
|
+
* 5、dayjs 实例
|
|
16
|
+
* 6、其他时间戳
|
|
17
|
+
*/
|
|
8
18
|
export declare class DateRange {
|
|
9
19
|
dateValue: DateValue;
|
|
10
20
|
format: string;
|
|
11
|
-
|
|
21
|
+
timezone: string;
|
|
22
|
+
endBaselineNum: number | undefined;
|
|
23
|
+
endBaselineTime: string | undefined;
|
|
24
|
+
endBaselineUnit: DateUnit | undefined;
|
|
12
25
|
endDate: Dayjs | null;
|
|
13
26
|
endNum: number | undefined;
|
|
14
27
|
endUnit: DateUnit | undefined;
|
|
28
|
+
startBaselineNum: number | undefined;
|
|
29
|
+
startBaselineTime: string | undefined;
|
|
30
|
+
startBaselineUnit: DateUnit | undefined;
|
|
15
31
|
startDate: Dayjs | null;
|
|
16
32
|
startNum: number | undefined;
|
|
17
33
|
startUnit: DateUnit | undefined;
|
|
18
|
-
|
|
19
|
-
|
|
34
|
+
userDisplayName: string | undefined;
|
|
35
|
+
constructor(dateValue?: DateValue, format?: string, timezone?: string);
|
|
36
|
+
get dateMode(): DateMode;
|
|
37
|
+
get endDisplayText(): string;
|
|
38
|
+
get isValidate(): boolean | undefined;
|
|
39
|
+
get recentOrFutureDateNum(): number | undefined;
|
|
40
|
+
get recentOrFutureDateUnit(): "M" | "d" | "h" | "m" | "s" | "w" | "y" | undefined;
|
|
41
|
+
get startDisplayText(): string;
|
|
42
|
+
dateDuration(unit?: dayjs.QUnitType | OpUnitType): number | undefined;
|
|
43
|
+
isInValidDateRange(date: DateRange): boolean;
|
|
44
|
+
isInValidDuration(minDuration?: number, maxDuration?: number): boolean;
|
|
45
|
+
setUserDisplayName(v: string): void;
|
|
20
46
|
toDisplayString(): string;
|
|
21
47
|
toEmitValue(): [
|
|
22
48
|
DateValue,
|
|
@@ -26,14 +52,11 @@ export declare class DateRange {
|
|
|
26
52
|
}[]
|
|
27
53
|
];
|
|
28
54
|
transformValue2Dayjs(val: DateValue[number], type?: 'end' | 'start'): dayjs.Dayjs;
|
|
29
|
-
updateDateValue(dateValue: DateValue,
|
|
55
|
+
updateDateValue(dateValue: DateValue, timezone?: string): void;
|
|
30
56
|
updateFormat(format: string): void;
|
|
31
|
-
get dateMode(): DateMode;
|
|
32
|
-
get endDisplayText(): string;
|
|
33
|
-
get isValidate(): boolean | undefined;
|
|
34
|
-
get recentOrFuturedateNum(): number | undefined;
|
|
35
|
-
get recentOrFuturedateUnit(): "M" | "d" | "h" | "m" | "s" | "w" | "y" | undefined;
|
|
36
|
-
get startDisplayText(): string;
|
|
37
57
|
}
|
|
38
|
-
export declare const transformValue2Dayjs: (val: DateValue[number], type?:
|
|
39
|
-
export declare const transformDateRange2Dayjs: (dateValue: DateValue,
|
|
58
|
+
export declare const transformValue2Dayjs: (val: DateValue[number], type?: "end" | "start", timezone?: string) => dayjs.Dayjs | undefined;
|
|
59
|
+
export declare const transformDateRange2Dayjs: (dateValue: DateValue, timezone?: string) => (dayjs.Dayjs | undefined)[];
|
|
60
|
+
export declare const inputVal2Dayjs: (val: string, format: string, defaultDate?: Dayjs) => dayjs.Dayjs;
|
|
61
|
+
export declare function getTimezoneOffset(timezone: string): number;
|
|
62
|
+
export declare const isValidTimeZone: (timeZone: string) => boolean;
|
package/typings/utils/index.d.ts
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ComputedRef, type InjectionKey, type Ref } from 'vue';
|
|
2
|
+
import type { LangKey } from '../lang/lang';
|
|
3
|
+
import type { ITimezoneItem } from './timezone';
|
|
4
|
+
import type { DateValue, IDatePickerProps } from './types';
|
|
5
|
+
export interface IDatePickerProvider {
|
|
6
|
+
commonUseList: ComputedRef<IDatePickerProps['commonUseList']>;
|
|
7
|
+
enableFormatClick: boolean;
|
|
8
|
+
format: Ref<string>;
|
|
9
|
+
maxDuration: ComputedRef<number | undefined>;
|
|
10
|
+
minDuration: ComputedRef<number | undefined>;
|
|
11
|
+
storeKey: ComputedRef<string>;
|
|
12
|
+
timezoneInfo: ComputedRef<ITimezoneItem>;
|
|
13
|
+
validateTimeRange: ComputedRef<DateValue | undefined>;
|
|
14
|
+
version: ComputedRef<number | string>;
|
|
15
|
+
formatChange: (format: string) => void;
|
|
16
|
+
t: (key: LangKey) => string;
|
|
17
|
+
}
|
|
18
|
+
export declare const DATE_PICKER_PROVIDER_KEY: InjectionKey<IDatePickerProvider>;
|
|
19
|
+
export declare const useDatePickerProvider: (data: IDatePickerProvider) => void;
|
|
20
|
+
export declare const useDatePickerInject: () => IDatePickerProvider | undefined;
|
package/typings/utils/store.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export interface ITimeZoneGroup {
|
|
2
|
+
label: string;
|
|
3
|
+
options: ITimezoneItem[];
|
|
4
|
+
}
|
|
1
5
|
export interface ITimezoneItem {
|
|
2
6
|
abbreviation: string;
|
|
3
7
|
country: string;
|
|
@@ -5,10 +9,6 @@ export interface ITimezoneItem {
|
|
|
5
9
|
label: string;
|
|
6
10
|
utc: string;
|
|
7
11
|
}
|
|
8
|
-
export interface ITimeZoneGroup {
|
|
9
|
-
label: string;
|
|
10
|
-
options: ITimezoneItem[];
|
|
11
|
-
}
|
|
12
12
|
export declare const getTimezoneDetails: () => ITimeZoneGroup[];
|
|
13
13
|
export declare const getTimezoneInfo: (searchIndex: string) => {
|
|
14
14
|
abbreviation: string;
|
package/typings/utils/types.d.ts
CHANGED
|
@@ -1,30 +1,38 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
export interface ICommonTabItem {
|
|
4
|
-
id: string;
|
|
5
|
-
name: string;
|
|
6
|
-
}
|
|
1
|
+
import type { DateUnit, NowConstant } from './constant';
|
|
2
|
+
import type { Dayjs } from 'dayjs';
|
|
7
3
|
export declare enum DateMode {
|
|
8
4
|
Date = "date",
|
|
9
5
|
FUTURE = "now+",
|
|
10
6
|
NATURAL = "natural",
|
|
11
7
|
RECENT = "now-"
|
|
12
8
|
}
|
|
13
|
-
export type RecentValue = `${DateMode.RECENT}${number}${DateUnit}`;
|
|
14
|
-
export type RecentDateValue = [RecentValue, typeof NowConstant];
|
|
15
|
-
export type FutureValue = `${DateMode.FUTURE}${number}${DateUnit}`;
|
|
16
|
-
export type FutureDateValue = [typeof NowConstant, FutureValue];
|
|
17
|
-
export type NaturalSelectDate = `${RecentValue}/${DateUnit}`;
|
|
18
|
-
export type NaturalDateValue = [NaturalSelectDate, NaturalSelectDate | typeof NowConstant];
|
|
19
9
|
export type CommonDateValue = [string, string];
|
|
20
10
|
export type DateValue = [Dayjs | number | string, Dayjs | number | string];
|
|
11
|
+
export type FutureDateValue = [typeof NowConstant, FutureValue];
|
|
12
|
+
export type FutureValue = `${DateMode.FUTURE}${number}${DateUnit}`;
|
|
13
|
+
export interface ICommonTabItem {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
}
|
|
21
17
|
export interface IDatePickerProps {
|
|
22
18
|
behavior?: 'normal' | 'simplicity';
|
|
23
|
-
commonUseList?: DateValue[];
|
|
24
19
|
disabled?: boolean;
|
|
20
|
+
enableFormatClick?: boolean;
|
|
25
21
|
format?: string;
|
|
26
|
-
|
|
22
|
+
id?: string;
|
|
23
|
+
maxDuration?: number;
|
|
24
|
+
minDuration?: number;
|
|
25
|
+
modelValue: DateValue | undefined;
|
|
27
26
|
needTimezone?: boolean;
|
|
28
27
|
timezone?: string;
|
|
28
|
+
validDateRange?: DateValue;
|
|
29
29
|
version?: number | string;
|
|
30
|
+
commonUseList?: DateValue[] | {
|
|
31
|
+
id: DateValue;
|
|
32
|
+
name: string;
|
|
33
|
+
}[];
|
|
30
34
|
}
|
|
35
|
+
export type NaturalDateValue = [NaturalSelectDate, NaturalSelectDate | typeof NowConstant];
|
|
36
|
+
export type NaturalSelectDate = `${RecentValue}/${DateUnit}`;
|
|
37
|
+
export type RecentDateValue = [RecentValue, typeof NowConstant];
|
|
38
|
+
export type RecentValue = `${DateMode.RECENT}${number}${DateUnit}`;
|
package/typings/vue2.d.ts
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: {
|
|
2
|
+
beforeDestroy(): void;
|
|
3
|
+
created(): void;
|
|
4
|
+
data(): {
|
|
5
|
+
app: null;
|
|
6
|
+
unWatchStack: never[];
|
|
7
|
+
};
|
|
8
|
+
methods: {
|
|
9
|
+
handleHidePanel(): void;
|
|
10
|
+
handleShowPanel(): void;
|
|
11
|
+
};
|
|
12
|
+
mounted(): void;
|
|
13
|
+
name: string;
|
|
14
|
+
props: any;
|
|
15
|
+
render(createElement: any): any;
|
|
16
|
+
};
|
|
2
17
|
export default _default;
|
|
3
|
-
export
|
|
18
|
+
export declare const TimeZonePicker: any;
|
|
4
19
|
export * from './utils/constant';
|
|
20
|
+
export * from './utils/date';
|
|
21
|
+
export * from './utils/timezone';
|
|
22
|
+
export type * from './utils/types';
|
package/typings/vue3.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description: datePicker vue3版本
|
|
3
|
+
*/
|
|
1
4
|
import dayjs from 'dayjs';
|
|
5
|
+
import TimezonePicker from './components/timezone-picker.vue';
|
|
2
6
|
import DatePicker from './date-picker.vue';
|
|
3
|
-
export { DatePicker, dayjs };
|
|
7
|
+
export { DatePicker, dayjs, TimezonePicker };
|
|
4
8
|
export default DatePicker;
|
|
5
|
-
export * from './utils/date';
|
|
6
9
|
export * from './utils/constant';
|
|
10
|
+
export * from './utils/date';
|
|
11
|
+
export * from './utils/timezone';
|
|
7
12
|
export type * from './utils/types';
|
package/vue2/config.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"blueking-date-picker
|
|
1
|
+
{"type":"blueking-date-picker","name":"blueking-date-picker","displayName":"蓝鲸监控平台日期组件","framework":"vue2","props":{"behavior":{"type":"string","val":"normal","options":["normal","simplicity"],"tips":"组件展示风格"},"commonUseList":{"type":"array","tips":"常用列表"},"disabled":{"type":"boolean","tips":"是否禁用"},"format":{"type":"string","tips":"日期转换显示格式"},"modelValue":{"type":"array","val":["now-1d","now"],"tips":"日期值"},"needTimezone":{"type":"boolean","tips":"是否展示时区"},"timezone":{"type":"string","tips":"时区值"},"version":{"type":["number","string"],"val":"1.0","tips":"版本号 用于控制本地缓存"}},"events":[{"name":"update:modelValue","tips":"响应组件的点击事件"},{"name":"update:timezone","tips":"更新时区值的事件,以及时区信息"}]}
|