@blueking/date-picker 2.0.0-beta.26 → 2.0.0-beta.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/typings/components/baseline-select.vue.d.ts +4 -4
- package/typings/components/date-panel.vue.d.ts +4 -4
- package/typings/components/recent-picker.vue.d.ts +4 -4
- package/typings/date-picker.vue.d.ts +5 -9
- package/typings/utils/date.d.ts +0 -2
- package/typings/utils/store.d.ts +1 -1
- package/typings/utils/types.d.ts +1 -4
- package/typings/utils/utils.d.ts +3 -3
- package/vue2/index.es.min.js +17 -42
- package/vue2/index.iife.min.js +1069 -1090
- package/vue2/index.umd.min.js +17 -42
- package/vue3/index.es.min.js +17 -42
- package/vue3/index.iife.min.js +71 -93
- package/vue3/index.umd.min.js +17 -42
package/package.json
CHANGED
|
@@ -15,13 +15,10 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
15
15
|
}, {}>;
|
|
16
16
|
export default _default;
|
|
17
17
|
type __VLS_WithDefaults<P, D> = {
|
|
18
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ?
|
|
18
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
19
19
|
default: D[K];
|
|
20
20
|
}> : P[K];
|
|
21
21
|
};
|
|
22
|
-
type __VLS_Prettify<T> = {
|
|
23
|
-
[K in keyof T]: T[K];
|
|
24
|
-
} & {};
|
|
25
22
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
26
23
|
type __VLS_TypePropsToOption<T> = {
|
|
27
24
|
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
@@ -31,3 +28,6 @@ type __VLS_TypePropsToOption<T> = {
|
|
|
31
28
|
required: true;
|
|
32
29
|
};
|
|
33
30
|
};
|
|
31
|
+
type __VLS_PrettifyLocal<T> = {
|
|
32
|
+
[K in keyof T]: T[K];
|
|
33
|
+
} & {};
|
|
@@ -35,13 +35,10 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
35
35
|
}, {}>;
|
|
36
36
|
export default _default;
|
|
37
37
|
type __VLS_WithDefaults<P, D> = {
|
|
38
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ?
|
|
38
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
39
39
|
default: D[K];
|
|
40
40
|
}> : P[K];
|
|
41
41
|
};
|
|
42
|
-
type __VLS_Prettify<T> = {
|
|
43
|
-
[K in keyof T]: T[K];
|
|
44
|
-
} & {};
|
|
45
42
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
46
43
|
type __VLS_TypePropsToOption<T> = {
|
|
47
44
|
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
@@ -51,3 +48,6 @@ type __VLS_TypePropsToOption<T> = {
|
|
|
51
48
|
required: true;
|
|
52
49
|
};
|
|
53
50
|
};
|
|
51
|
+
type __VLS_PrettifyLocal<T> = {
|
|
52
|
+
[K in keyof T]: T[K];
|
|
53
|
+
} & {};
|
|
@@ -18,13 +18,10 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
18
18
|
}, {}>;
|
|
19
19
|
export default _default;
|
|
20
20
|
type __VLS_WithDefaults<P, D> = {
|
|
21
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ?
|
|
21
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
22
22
|
default: D[K];
|
|
23
23
|
}> : P[K];
|
|
24
24
|
};
|
|
25
|
-
type __VLS_Prettify<T> = {
|
|
26
|
-
[K in keyof T]: T[K];
|
|
27
|
-
} & {};
|
|
28
25
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
29
26
|
type __VLS_TypePropsToOption<T> = {
|
|
30
27
|
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
@@ -34,3 +31,6 @@ type __VLS_TypePropsToOption<T> = {
|
|
|
34
31
|
required: true;
|
|
35
32
|
};
|
|
36
33
|
};
|
|
34
|
+
type __VLS_PrettifyLocal<T> = {
|
|
35
|
+
[K in keyof T]: T[K];
|
|
36
|
+
} & {};
|
|
@@ -30,24 +30,17 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
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[];
|
|
37
33
|
version: number | string;
|
|
38
34
|
behavior: "normal" | "simplicity";
|
|
35
|
+
commonUseList: DateValue[];
|
|
39
36
|
needTimezone: boolean;
|
|
40
37
|
}, {}>;
|
|
41
38
|
export default _default;
|
|
42
|
-
|
|
43
39
|
type __VLS_WithDefaults<P, D> = {
|
|
44
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ?
|
|
40
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
45
41
|
default: D[K];
|
|
46
42
|
}> : P[K];
|
|
47
43
|
};
|
|
48
|
-
type __VLS_Prettify<T> = {
|
|
49
|
-
[K in keyof T]: T[K];
|
|
50
|
-
} & {};
|
|
51
44
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
52
45
|
type __VLS_TypePropsToOption<T> = {
|
|
53
46
|
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
@@ -57,3 +50,6 @@ type __VLS_TypePropsToOption<T> = {
|
|
|
57
50
|
required: true;
|
|
58
51
|
};
|
|
59
52
|
};
|
|
53
|
+
type __VLS_PrettifyLocal<T> = {
|
|
54
|
+
[K in keyof T]: T[K];
|
|
55
|
+
} & {};
|
package/typings/utils/date.d.ts
CHANGED
|
@@ -22,7 +22,6 @@ export declare class DateRange {
|
|
|
22
22
|
startDate: Dayjs | null;
|
|
23
23
|
startNum: number | undefined;
|
|
24
24
|
startUnit: DateUnit | undefined;
|
|
25
|
-
userDisplayName: string | undefined;
|
|
26
25
|
constructor(dateValue?: DateValue, format?: string, timezome?: string);
|
|
27
26
|
get dateMode(): DateMode;
|
|
28
27
|
get endDisplayText(): string;
|
|
@@ -32,7 +31,6 @@ export declare class DateRange {
|
|
|
32
31
|
get startDisplayText(): string;
|
|
33
32
|
dateDuration(): number | undefined;
|
|
34
33
|
isInValidDateRange(date: DateRange): boolean;
|
|
35
|
-
setUserDisplayName(v: string): void;
|
|
36
34
|
toDisplayString(): string;
|
|
37
35
|
toEmitValue(): [
|
|
38
36
|
DateValue,
|
package/typings/utils/store.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type StoreType = 'local' | 'session';
|
|
|
5
5
|
* @param storeKey store key
|
|
6
6
|
* @returns store value list
|
|
7
7
|
*/
|
|
8
|
-
export declare const getStoreDateList: (storeKey: string, type?: StoreType) =>
|
|
8
|
+
export declare const getStoreDateList: (storeKey: string, type?: StoreType) => never[];
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
11
11
|
* @param val store value
|
package/typings/utils/types.d.ts
CHANGED
|
@@ -20,10 +20,7 @@ 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?:
|
|
24
|
-
id: DateValue;
|
|
25
|
-
name: string;
|
|
26
|
-
}[] | DateValue[];
|
|
23
|
+
commonUseList?: DateValue[];
|
|
27
24
|
disabled?: boolean;
|
|
28
25
|
format?: string;
|
|
29
26
|
modelValue: DateValue | undefined;
|
package/typings/utils/utils.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { type ComputedRef, type InjectionKey } from 'vue';
|
|
2
2
|
import { type LangKey } from '../lang/lang';
|
|
3
3
|
import { type ITimezoneItem } from './timezone';
|
|
4
|
-
import { type
|
|
4
|
+
import { type DateValue } from './types';
|
|
5
5
|
export interface IDatePickerProvider {
|
|
6
|
-
commonUseList: ComputedRef<
|
|
6
|
+
commonUseList: ComputedRef<DateValue[]>;
|
|
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
|
+
vildateTimeRange: ComputedRef<DateValue | undefined>;
|
|
13
13
|
}
|
|
14
14
|
export declare const DATE_PICKER_PROVIDER_KEY: InjectionKey<IDatePickerProvider>;
|
|
15
15
|
export declare const useDatePickerProvider: (data: IDatePickerProvider) => void;
|
package/vue2/index.es.min.js
CHANGED
|
@@ -23253,7 +23253,6 @@ class DateRange {
|
|
|
23253
23253
|
__publicField(this, "startDate");
|
|
23254
23254
|
__publicField(this, "startNum");
|
|
23255
23255
|
__publicField(this, "startUnit");
|
|
23256
|
-
__publicField(this, "userDisplayName");
|
|
23257
23256
|
this.dateValue = dateValue;
|
|
23258
23257
|
this.format = format;
|
|
23259
23258
|
this.timezome = timezome;
|
|
@@ -23352,9 +23351,6 @@ class DateRange {
|
|
|
23352
23351
|
if (!this.startDate || !this.endDate) return false;
|
|
23353
23352
|
return (this.startDate.isSame(date.startDate, "ms") || this.startDate.isBefore(date.startDate)) && (this.endDate.isSame(date.endDate, "ms") || this.endDate.isAfter(date.endDate));
|
|
23354
23353
|
}
|
|
23355
|
-
setUserDisplayName(v2) {
|
|
23356
|
-
this.userDisplayName = v2;
|
|
23357
|
-
}
|
|
23358
23354
|
toDisplayString() {
|
|
23359
23355
|
var _a, _b;
|
|
23360
23356
|
const {
|
|
@@ -23369,7 +23365,6 @@ class DateRange {
|
|
|
23369
23365
|
startNum,
|
|
23370
23366
|
startUnit
|
|
23371
23367
|
} = this;
|
|
23372
|
-
if (this.userDisplayName) return this.userDisplayName;
|
|
23373
23368
|
if (!startDate || !endDate || !isValidate) {
|
|
23374
23369
|
return ((_a = this.dateValue) == null ? void 0 : _a.join(" ~ ")) || "";
|
|
23375
23370
|
}
|
|
@@ -24969,16 +24964,16 @@ const useDatePickerProvider = (data2) => {
|
|
|
24969
24964
|
};
|
|
24970
24965
|
const useDatePickerInject = () => inject(DATE_PICKER_PROVIDER_KEY);
|
|
24971
24966
|
const useValidate = () => {
|
|
24972
|
-
const { format, timezoneInfo,
|
|
24967
|
+
const { format, timezoneInfo, vildateTimeRange } = useDatePickerInject();
|
|
24973
24968
|
const validDateRange = customRef((track) => {
|
|
24974
|
-
let date = new DateRange(
|
|
24969
|
+
let date = new DateRange(vildateTimeRange.value, format.value, timezoneInfo.value.label);
|
|
24975
24970
|
return {
|
|
24976
24971
|
get() {
|
|
24977
24972
|
var _a;
|
|
24978
24973
|
track();
|
|
24979
|
-
if (((_a =
|
|
24980
|
-
if (
|
|
24981
|
-
return new DateRange(
|
|
24974
|
+
if (((_a = vildateTimeRange.value) == null ? void 0 : _a.length) !== 2) return void 0;
|
|
24975
|
+
if (vildateTimeRange.value.some((v2) => typeof v2 === "string" && v2.includes("now")))
|
|
24976
|
+
return new DateRange(vildateTimeRange.value, format.value, timezoneInfo.value.label);
|
|
24982
24977
|
return date;
|
|
24983
24978
|
},
|
|
24984
24979
|
set() {
|
|
@@ -25615,7 +25610,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
25615
25610
|
"model-value": startDate.value,
|
|
25616
25611
|
title: unref(t)("开始时间"),
|
|
25617
25612
|
"onUpdate:isNow": _cache[2] || (_cache[2] = () => handleIsNowChange("start")),
|
|
25618
|
-
"onUpdate:modelValue": handleStartTimeChange
|
|
25613
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = (date) => handleStartTimeChange(date.startOf("d")))
|
|
25619
25614
|
}, null, 8, ["disable-now", "format", "is-now", "model-value", "title"])
|
|
25620
25615
|
]),
|
|
25621
25616
|
default: withCtx(() => {
|
|
@@ -25657,8 +25652,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
25657
25652
|
"is-now": isEndNow.value,
|
|
25658
25653
|
"model-value": endDate.value,
|
|
25659
25654
|
title: unref(t)("结束时间"),
|
|
25660
|
-
"onUpdate:isNow": _cache[
|
|
25661
|
-
"onUpdate:modelValue": _cache[
|
|
25655
|
+
"onUpdate:isNow": _cache[6] || (_cache[6] = () => handleIsNowChange("end")),
|
|
25656
|
+
"onUpdate:modelValue": _cache[7] || (_cache[7] = (date) => handleEndTimeChange(date.endOf("d")))
|
|
25662
25657
|
}, null, 8, ["disable-now", "format", "is-now", "model-value", "title"])
|
|
25663
25658
|
]),
|
|
25664
25659
|
default: withCtx(() => {
|
|
@@ -25670,9 +25665,9 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
25670
25665
|
class: "date-picker-end",
|
|
25671
25666
|
placeholder: unref(t)("结束时间"),
|
|
25672
25667
|
value: isEndNow.value ? unref(NowConstant) : (_a2 = endDate.value) == null ? void 0 : _a2.format(unref(format)),
|
|
25673
|
-
onBlur: _cache[
|
|
25668
|
+
onBlur: _cache[4] || (_cache[4] = (e) => handleInputEnter(e, "end")),
|
|
25674
25669
|
onClick: handleFocusEnd,
|
|
25675
|
-
onKeypress: _cache[
|
|
25670
|
+
onKeypress: _cache[5] || (_cache[5] = withKeys((e) => handleInputEnter(e, "end"), ["enter"]))
|
|
25676
25671
|
}, null, 40, _hoisted_6$2), [
|
|
25677
25672
|
[unref(__webpack_exports__clickoutside), handleClickoutsideEnd]
|
|
25678
25673
|
])
|
|
@@ -26223,7 +26218,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
26223
26218
|
return;
|
|
26224
26219
|
}
|
|
26225
26220
|
let date = inputVal2Dayjs(val, format.value, specificDate == null ? void 0 : specificDate.value);
|
|
26226
|
-
if (date.isValid()) {
|
|
26221
|
+
if (date == null ? void 0 : date.isValid()) {
|
|
26227
26222
|
canEditNautralId.value = "";
|
|
26228
26223
|
const formatValue = date.format(format.value);
|
|
26229
26224
|
const item = baselineOptions.value.find((item2) => item2.id === formatValue);
|
|
@@ -26721,14 +26716,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
26721
26716
|
const browserTimezone = dayjs.tz.guess();
|
|
26722
26717
|
const recentUseList = shallowRef(getStoreDateList(storeKey2.value));
|
|
26723
26718
|
const dateList = computed(
|
|
26724
|
-
() => (activePanel.value === "common" ? commonUseList.value || commonDateList : recentUseList.value).map(
|
|
26725
|
-
|
|
26726
|
-
|
|
26727
|
-
dateRange.setUserDisplayName(date.name);
|
|
26728
|
-
return dateRange;
|
|
26729
|
-
}
|
|
26730
|
-
return new DateRange(date, format.value, props2.timezone);
|
|
26731
|
-
})
|
|
26719
|
+
() => (activePanel.value === "common" ? commonUseList.value || commonDateList : recentUseList.value).map(
|
|
26720
|
+
(date) => new DateRange(date, format.value, props2.timezone)
|
|
26721
|
+
)
|
|
26732
26722
|
);
|
|
26733
26723
|
const handleChange = (date) => {
|
|
26734
26724
|
emits("change", date);
|
|
@@ -26999,17 +26989,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
26999
26989
|
var _a;
|
|
27000
26990
|
return ((_a = props2.commonUseList) == null ? void 0 : _a.length) ? props2.commonUseList : commonDateList;
|
|
27001
26991
|
});
|
|
27002
|
-
const dateDetailDisplayString = computed(() => {
|
|
27003
|
-
var _a;
|
|
27004
|
-
const commonDate = commonDateUseList.value.find((item) => {
|
|
27005
|
-
var _a2, _b, _c, _d;
|
|
27006
|
-
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("_"));
|
|
27007
|
-
});
|
|
27008
|
-
if (commonDate) {
|
|
27009
|
-
return commonDate.name;
|
|
27010
|
-
}
|
|
27011
|
-
return (_a = dateDetail.value) == null ? void 0 : _a.toDisplayString();
|
|
27012
|
-
});
|
|
27013
26992
|
useDatePickerProvider({
|
|
27014
26993
|
commonUseList: commonDateUseList,
|
|
27015
26994
|
format,
|
|
@@ -27017,7 +26996,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
27017
26996
|
t,
|
|
27018
26997
|
timezoneInfo,
|
|
27019
26998
|
version: computed(() => props2.version),
|
|
27020
|
-
|
|
26999
|
+
vildateTimeRange: computed(() => props2.validDateRange)
|
|
27021
27000
|
});
|
|
27022
27001
|
onBeforeUnmount(() => {
|
|
27023
27002
|
tooltipsShow.value = false;
|
|
@@ -27048,11 +27027,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
27048
27027
|
dateDetail.value = new DateRange(val, format.value, props2.timezone);
|
|
27049
27028
|
const emitValue = dateDetail.value.toEmitValue();
|
|
27050
27029
|
emits("update:modelValue", ...emitValue);
|
|
27051
|
-
const canStore = commonDateUseList.value.some((item) =>
|
|
27052
|
-
const startDate = Array.isArray(item == null ? void 0 : item.id) ? item.id[0] : item[0];
|
|
27053
|
-
const endDate = Array.isArray(item == null ? void 0 : item.id) ? item.id[1] : item[1];
|
|
27054
|
-
return startDate === start2 && endDate === end2;
|
|
27055
|
-
});
|
|
27030
|
+
const canStore = commonDateUseList.value.some((item) => item[0] === start2 && item[1] === end2);
|
|
27056
27031
|
!canStore && dateDetail.value.isValidate && setStoreDateList(val, storeKey2.value);
|
|
27057
27032
|
};
|
|
27058
27033
|
const handleTimezoneChange = (val, info) => {
|
|
@@ -27158,7 +27133,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
27158
27133
|
createElementVNode(
|
|
27159
27134
|
"span",
|
|
27160
27135
|
null,
|
|
27161
|
-
toDisplayString(
|
|
27136
|
+
toDisplayString(dateDetail.value.toDisplayString()),
|
|
27162
27137
|
1
|
|
27163
27138
|
/* TEXT */
|
|
27164
27139
|
),
|