vant 4.9.7 → 4.9.8
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/es/calendar/Calendar.mjs +1 -1
- package/es/calendar/CalendarDay.mjs +5 -3
- package/es/calendar/CalendarMonth.mjs +1 -1
- package/es/date-picker/DatePicker.d.ts +3 -3
- package/es/date-picker/DatePicker.mjs +9 -8
- package/es/date-picker/index.d.ts +2 -2
- package/es/date-picker/utils.d.ts +2 -4
- package/es/date-picker/utils.mjs +1 -6
- package/es/field/Field.mjs +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/time-picker/TimePicker.d.ts +3 -7
- package/es/time-picker/TimePicker.mjs +1 -2
- package/es/time-picker/index.d.ts +2 -4
- package/lib/calendar/Calendar.js +1 -1
- package/lib/calendar/CalendarDay.js +5 -3
- package/lib/calendar/CalendarMonth.js +1 -1
- package/lib/date-picker/DatePicker.d.ts +3 -3
- package/lib/date-picker/DatePicker.js +9 -8
- package/lib/date-picker/index.d.ts +2 -2
- package/lib/date-picker/utils.d.ts +2 -4
- package/lib/field/Field.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/time-picker/TimePicker.d.ts +3 -7
- package/lib/time-picker/TimePicker.js +1 -2
- package/lib/time-picker/index.d.ts +2 -4
- package/lib/vant.cjs.js +19 -17
- package/lib/vant.es.js +19 -17
- package/lib/vant.js +20 -18
- package/lib/vant.min.js +3 -3
- package/lib/web-types.json +1 -1
- package/package.json +14 -14
package/es/calendar/Calendar.mjs
CHANGED
@@ -358,7 +358,7 @@ var stdin_default = defineComponent({
|
|
358
358
|
}, pick(props, ["type", "color", "showMark", "formatter", "rowHeight", "showSubtitle", "allowSameDay"]), {
|
359
359
|
"onClick": onClickDay,
|
360
360
|
"onClickDisabledDate": (item) => emit("clickDisabledDate", item)
|
361
|
-
}), pick(slots, ["top-info", "bottom-info", "month-title"]));
|
361
|
+
}), pick(slots, ["top-info", "bottom-info", "month-title", "text"]));
|
362
362
|
};
|
363
363
|
const renderFooterButton = () => {
|
364
364
|
if (slots.footer) {
|
@@ -81,6 +81,9 @@ var stdin_default = defineComponent({
|
|
81
81
|
}, [slots["bottom-info"] ? slots["bottom-info"](props.item) : bottomInfo]);
|
82
82
|
}
|
83
83
|
};
|
84
|
+
const renderText = () => {
|
85
|
+
return slots.text ? slots.text(props.item) : props.item.text;
|
86
|
+
};
|
84
87
|
const renderContent = () => {
|
85
88
|
const {
|
86
89
|
item,
|
@@ -88,10 +91,9 @@ var stdin_default = defineComponent({
|
|
88
91
|
rowHeight
|
89
92
|
} = props;
|
90
93
|
const {
|
91
|
-
type
|
92
|
-
text
|
94
|
+
type
|
93
95
|
} = item;
|
94
|
-
const Nodes = [renderTopInfo(),
|
96
|
+
const Nodes = [renderTopInfo(), renderText(), renderBottomInfo()];
|
95
97
|
if (type === "selected") {
|
96
98
|
return _createVNode("div", {
|
97
99
|
"class": bem("selected-day"),
|
@@ -189,7 +189,7 @@ var stdin_default = defineComponent({
|
|
189
189
|
"rowHeight": rowHeight.value,
|
190
190
|
"onClick": (item2) => emit("click", item2),
|
191
191
|
"onClickDisabledDate": (item2) => emit("clickDisabledDate", item2)
|
192
|
-
}, pick(slots, ["top-info", "bottom-info"]));
|
192
|
+
}, pick(slots, ["top-info", "bottom-info", "text"]));
|
193
193
|
const renderDays = () => _createVNode("div", {
|
194
194
|
"ref": daysRef,
|
195
195
|
"role": "grid",
|
@@ -29,7 +29,7 @@ export declare const datePickerProps: {
|
|
29
29
|
type: PropType<string[]>;
|
30
30
|
default: () => never[];
|
31
31
|
};
|
32
|
-
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values
|
32
|
+
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values: string[]) => import("../picker").PickerOption[]>;
|
33
33
|
formatter: {
|
34
34
|
type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
|
35
35
|
default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
|
@@ -85,7 +85,7 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
85
85
|
type: PropType<string[]>;
|
86
86
|
default: () => never[];
|
87
87
|
};
|
88
|
-
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values
|
88
|
+
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values: string[]) => import("../picker").PickerOption[]>;
|
89
89
|
formatter: {
|
90
90
|
type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
|
91
91
|
default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
|
@@ -134,7 +134,7 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
134
134
|
type: PropType<string[]>;
|
135
135
|
default: () => never[];
|
136
136
|
};
|
137
|
-
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values
|
137
|
+
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values: string[]) => import("../picker").PickerOption[]>;
|
138
138
|
formatter: {
|
139
139
|
type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
|
140
140
|
default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
|
@@ -32,11 +32,7 @@ var stdin_default = defineComponent({
|
|
32
32
|
const currentValues = ref(props.modelValue);
|
33
33
|
const updatedByExternalSources = ref(false);
|
34
34
|
const pickerRef = ref();
|
35
|
-
const
|
36
|
-
const minYear = props.minDate.getFullYear();
|
37
|
-
const maxYear = props.maxDate.getFullYear();
|
38
|
-
return genOptions(minYear, maxYear, "year", props.formatter, props.filter);
|
39
|
-
};
|
35
|
+
const computedValues = computed(() => updatedByExternalSources.value ? props.modelValue : currentValues.value);
|
40
36
|
const isMinYear = (year) => year === props.minDate.getFullYear();
|
41
37
|
const isMaxYear = (year) => year === props.maxDate.getFullYear();
|
42
38
|
const isMinMonth = (month) => month === props.minDate.getMonth() + 1;
|
@@ -47,7 +43,7 @@ var stdin_default = defineComponent({
|
|
47
43
|
columnsType
|
48
44
|
} = props;
|
49
45
|
const index = columnsType.indexOf(type);
|
50
|
-
const value =
|
46
|
+
const value = computedValues.value[index];
|
51
47
|
if (value) {
|
52
48
|
return +value;
|
53
49
|
}
|
@@ -60,18 +56,23 @@ var stdin_default = defineComponent({
|
|
60
56
|
return minDate.getDate();
|
61
57
|
}
|
62
58
|
};
|
59
|
+
const genYearOptions = () => {
|
60
|
+
const minYear = props.minDate.getFullYear();
|
61
|
+
const maxYear = props.maxDate.getFullYear();
|
62
|
+
return genOptions(minYear, maxYear, "year", props.formatter, props.filter, computedValues.value);
|
63
|
+
};
|
63
64
|
const genMonthOptions = () => {
|
64
65
|
const year = getValue("year");
|
65
66
|
const minMonth = isMinYear(year) ? props.minDate.getMonth() + 1 : 1;
|
66
67
|
const maxMonth = isMaxYear(year) ? props.maxDate.getMonth() + 1 : 12;
|
67
|
-
return genOptions(minMonth, maxMonth, "month", props.formatter, props.filter);
|
68
|
+
return genOptions(minMonth, maxMonth, "month", props.formatter, props.filter, computedValues.value);
|
68
69
|
};
|
69
70
|
const genDayOptions = () => {
|
70
71
|
const year = getValue("year");
|
71
72
|
const month = getValue("month");
|
72
73
|
const minDate = isMinYear(year) && isMinMonth(month) ? props.minDate.getDate() : 1;
|
73
74
|
const maxDate = isMaxYear(year) && isMaxMonth(month) ? props.maxDate.getDate() : getMonthEndDay(year, month);
|
74
|
-
return genOptions(minDate, maxDate, "day", props.formatter, props.filter);
|
75
|
+
return genOptions(minDate, maxDate, "day", props.formatter, props.filter, computedValues.value);
|
75
76
|
};
|
76
77
|
const confirm = () => {
|
77
78
|
var _a;
|
@@ -28,7 +28,7 @@ export declare const DatePicker: import("../utils").WithInstall<import("vue").De
|
|
28
28
|
type: import("vue").PropType<string[]>;
|
29
29
|
default: () => never[];
|
30
30
|
};
|
31
|
-
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values
|
31
|
+
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values: string[]) => import("..").PickerOption[]>;
|
32
32
|
formatter: {
|
33
33
|
type: import("vue").PropType<(type: string, option: import("..").PickerOption) => import("..").PickerOption>;
|
34
34
|
default: (type: string, option: import("..").PickerOption) => import("..").PickerOption;
|
@@ -77,7 +77,7 @@ export declare const DatePicker: import("../utils").WithInstall<import("vue").De
|
|
77
77
|
type: import("vue").PropType<string[]>;
|
78
78
|
default: () => never[];
|
79
79
|
};
|
80
|
-
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values
|
80
|
+
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values: string[]) => import("..").PickerOption[]>;
|
81
81
|
formatter: {
|
82
82
|
type: import("vue").PropType<(type: string, option: import("..").PickerOption) => import("..").PickerOption>;
|
83
83
|
default: (type: string, option: import("..").PickerOption) => import("..").PickerOption;
|
@@ -1,9 +1,7 @@
|
|
1
|
-
import { type RequiredParams } from '../utils';
|
2
1
|
import { pickerSharedProps } from '../picker/Picker';
|
3
2
|
import type { PropType } from 'vue';
|
4
3
|
import type { PickerOption } from '../picker';
|
5
|
-
type Filter = (columnType: string, options: PickerOption[], values
|
6
|
-
export type TimeFilter = RequiredParams<Filter>;
|
4
|
+
type Filter = (columnType: string, options: PickerOption[], values: string[]) => PickerOption[];
|
7
5
|
type Formatter = (type: string, option: PickerOption) => PickerOption;
|
8
6
|
export declare const sharedProps: {
|
9
7
|
loading: BooleanConstructor;
|
@@ -43,6 +41,6 @@ export declare const sharedProps: {
|
|
43
41
|
export declare const pickerInheritKeys: Array<keyof typeof pickerSharedProps>;
|
44
42
|
export declare function times<T>(n: number, iteratee: (index: number) => T): T[];
|
45
43
|
export declare const getMonthEndDay: (year: number, month: number) => number;
|
46
|
-
export declare const genOptions: <T extends string>(min: number, max: number, type: T, formatter: Formatter, filter
|
44
|
+
export declare const genOptions: <T extends string>(min: number, max: number, type: T, formatter: Formatter, filter: Filter | undefined, values: string[]) => PickerOption[];
|
47
45
|
export declare const formatValueRange: (values: string[], columns: PickerOption[][]) => string[];
|
48
46
|
export {};
|
package/es/date-picker/utils.mjs
CHANGED
@@ -1,9 +1,4 @@
|
|
1
|
-
import {
|
2
|
-
extend,
|
3
|
-
padZero,
|
4
|
-
makeArrayProp,
|
5
|
-
clamp
|
6
|
-
} from "../utils/index.mjs";
|
1
|
+
import { extend, padZero, makeArrayProp, clamp } from "../utils/index.mjs";
|
7
2
|
import { pickerSharedProps } from "../picker/Picker.mjs";
|
8
3
|
const sharedProps = extend({}, pickerSharedProps, {
|
9
4
|
modelValue: makeArrayProp(),
|
package/es/field/Field.mjs
CHANGED
@@ -222,7 +222,7 @@ var stdin_default = defineComponent({
|
|
222
222
|
if (props.type === "number" || props.type === "digit") {
|
223
223
|
const isNumber = props.type === "number";
|
224
224
|
value = formatNumber(value, isNumber, isNumber);
|
225
|
-
if (trigger === "onBlur" && value !== "") {
|
225
|
+
if (trigger === "onBlur" && value !== "" && (props.min !== void 0 || props.max !== void 0)) {
|
226
226
|
const adjustedValue = clamp(+value, (_a = props.min) != null ? _a : -Infinity, (_b = props.max) != null ? _b : Infinity);
|
227
227
|
value = adjustedValue.toString();
|
228
228
|
}
|
package/es/index.d.ts
CHANGED
package/es/index.mjs
CHANGED
@@ -99,7 +99,7 @@ import { Toast } from "./toast/index.mjs";
|
|
99
99
|
import { TreeSelect } from "./tree-select/index.mjs";
|
100
100
|
import { Uploader } from "./uploader/index.mjs";
|
101
101
|
import { Watermark } from "./watermark/index.mjs";
|
102
|
-
const version = "4.9.
|
102
|
+
const version = "4.9.8";
|
103
103
|
function install(app) {
|
104
104
|
const components = [
|
105
105
|
ActionBar,
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { type ExtractPropTypes, type PropType, type ComponentPublicInstance } from 'vue';
|
2
|
-
import { type TimeFilter } from '../date-picker/utils';
|
3
2
|
export type TimePickerColumnType = 'hour' | 'minute' | 'second';
|
4
3
|
export declare const timePickerProps: {
|
5
4
|
loading: BooleanConstructor;
|
@@ -30,7 +29,7 @@ export declare const timePickerProps: {
|
|
30
29
|
type: PropType<string[]>;
|
31
30
|
default: () => never[];
|
32
31
|
};
|
33
|
-
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values
|
32
|
+
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values: string[]) => import("../picker").PickerOption[]>;
|
34
33
|
formatter: {
|
35
34
|
type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
|
36
35
|
default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
|
@@ -72,7 +71,6 @@ export declare const timePickerProps: {
|
|
72
71
|
type: PropType<TimePickerColumnType[]>;
|
73
72
|
default: () => string[];
|
74
73
|
};
|
75
|
-
filter: PropType<TimeFilter>;
|
76
74
|
};
|
77
75
|
export type TimePickerProps = ExtractPropTypes<typeof timePickerProps>;
|
78
76
|
export type TimePickerExpose = {
|
@@ -109,7 +107,7 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
109
107
|
type: PropType<string[]>;
|
110
108
|
default: () => never[];
|
111
109
|
};
|
112
|
-
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values
|
110
|
+
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values: string[]) => import("../picker").PickerOption[]>;
|
113
111
|
formatter: {
|
114
112
|
type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
|
115
113
|
default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
|
@@ -151,7 +149,6 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
151
149
|
type: PropType<TimePickerColumnType[]>;
|
152
150
|
default: () => string[];
|
153
151
|
};
|
154
|
-
filter: PropType<TimeFilter>;
|
155
152
|
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "cancel" | "change" | "confirm")[], "update:modelValue" | "cancel" | "change" | "confirm", import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
156
153
|
loading: BooleanConstructor;
|
157
154
|
readonly: BooleanConstructor;
|
@@ -181,7 +178,7 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
181
178
|
type: PropType<string[]>;
|
182
179
|
default: () => never[];
|
183
180
|
};
|
184
|
-
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values
|
181
|
+
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values: string[]) => import("../picker").PickerOption[]>;
|
185
182
|
formatter: {
|
186
183
|
type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
|
187
184
|
default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
|
@@ -223,7 +220,6 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
223
220
|
type: PropType<TimePickerColumnType[]>;
|
224
221
|
default: () => string[];
|
225
222
|
};
|
226
|
-
filter: PropType<TimeFilter>;
|
227
223
|
}>> & Readonly<{
|
228
224
|
onChange?: ((...args: any[]) => any) | undefined;
|
229
225
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
@@ -28,7 +28,7 @@ export declare const TimePicker: import("../utils").WithInstall<import("vue").De
|
|
28
28
|
type: import("vue").PropType<string[]>;
|
29
29
|
default: () => never[];
|
30
30
|
};
|
31
|
-
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values
|
31
|
+
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values: string[]) => import("..").PickerOption[]>;
|
32
32
|
formatter: {
|
33
33
|
type: import("vue").PropType<(type: string, option: import("..").PickerOption) => import("..").PickerOption>;
|
34
34
|
default: (type: string, option: import("..").PickerOption) => import("..").PickerOption;
|
@@ -70,7 +70,6 @@ export declare const TimePicker: import("../utils").WithInstall<import("vue").De
|
|
70
70
|
type: import("vue").PropType<import("./TimePicker").TimePickerColumnType[]>;
|
71
71
|
default: () => string[];
|
72
72
|
};
|
73
|
-
filter: import("vue").PropType<import("../date-picker/utils").TimeFilter>;
|
74
73
|
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "cancel" | "change" | "confirm")[], "update:modelValue" | "cancel" | "change" | "confirm", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
75
74
|
loading: BooleanConstructor;
|
76
75
|
readonly: BooleanConstructor;
|
@@ -100,7 +99,7 @@ export declare const TimePicker: import("../utils").WithInstall<import("vue").De
|
|
100
99
|
type: import("vue").PropType<string[]>;
|
101
100
|
default: () => never[];
|
102
101
|
};
|
103
|
-
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values
|
102
|
+
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values: string[]) => import("..").PickerOption[]>;
|
104
103
|
formatter: {
|
105
104
|
type: import("vue").PropType<(type: string, option: import("..").PickerOption) => import("..").PickerOption>;
|
106
105
|
default: (type: string, option: import("..").PickerOption) => import("..").PickerOption;
|
@@ -142,7 +141,6 @@ export declare const TimePicker: import("../utils").WithInstall<import("vue").De
|
|
142
141
|
type: import("vue").PropType<import("./TimePicker").TimePickerColumnType[]>;
|
143
142
|
default: () => string[];
|
144
143
|
};
|
145
|
-
filter: import("vue").PropType<import("../date-picker/utils").TimeFilter>;
|
146
144
|
}>> & Readonly<{
|
147
145
|
onChange?: ((...args: any[]) => any) | undefined;
|
148
146
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
package/lib/calendar/Calendar.js
CHANGED
@@ -391,7 +391,7 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
391
391
|
}, (0, import_utils.pick)(props, ["type", "color", "showMark", "formatter", "rowHeight", "showSubtitle", "allowSameDay"]), {
|
392
392
|
"onClick": onClickDay,
|
393
393
|
"onClickDisabledDate": (item) => emit("clickDisabledDate", item)
|
394
|
-
}), (0, import_utils.pick)(slots, ["top-info", "bottom-info", "month-title"]));
|
394
|
+
}), (0, import_utils.pick)(slots, ["top-info", "bottom-info", "month-title", "text"]));
|
395
395
|
};
|
396
396
|
const renderFooterButton = () => {
|
397
397
|
if (slots.footer) {
|
@@ -103,6 +103,9 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
103
103
|
}, [slots["bottom-info"] ? slots["bottom-info"](props.item) : bottomInfo]);
|
104
104
|
}
|
105
105
|
};
|
106
|
+
const renderText = () => {
|
107
|
+
return slots.text ? slots.text(props.item) : props.item.text;
|
108
|
+
};
|
106
109
|
const renderContent = () => {
|
107
110
|
const {
|
108
111
|
item,
|
@@ -110,10 +113,9 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
110
113
|
rowHeight
|
111
114
|
} = props;
|
112
115
|
const {
|
113
|
-
type
|
114
|
-
text
|
116
|
+
type
|
115
117
|
} = item;
|
116
|
-
const Nodes = [renderTopInfo(),
|
118
|
+
const Nodes = [renderTopInfo(), renderText(), renderBottomInfo()];
|
117
119
|
if (type === "selected") {
|
118
120
|
return (0, import_vue.createVNode)("div", {
|
119
121
|
"class": (0, import_utils2.bem)("selected-day"),
|
@@ -221,7 +221,7 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
221
221
|
"rowHeight": rowHeight.value,
|
222
222
|
"onClick": (item2) => emit("click", item2),
|
223
223
|
"onClickDisabledDate": (item2) => emit("clickDisabledDate", item2)
|
224
|
-
}, (0, import_utils.pick)(slots, ["top-info", "bottom-info"]));
|
224
|
+
}, (0, import_utils.pick)(slots, ["top-info", "bottom-info", "text"]));
|
225
225
|
const renderDays = () => (0, import_vue.createVNode)("div", {
|
226
226
|
"ref": daysRef,
|
227
227
|
"role": "grid",
|
@@ -29,7 +29,7 @@ export declare const datePickerProps: {
|
|
29
29
|
type: PropType<string[]>;
|
30
30
|
default: () => never[];
|
31
31
|
};
|
32
|
-
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values
|
32
|
+
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values: string[]) => import("../picker").PickerOption[]>;
|
33
33
|
formatter: {
|
34
34
|
type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
|
35
35
|
default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
|
@@ -85,7 +85,7 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
85
85
|
type: PropType<string[]>;
|
86
86
|
default: () => never[];
|
87
87
|
};
|
88
|
-
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values
|
88
|
+
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values: string[]) => import("../picker").PickerOption[]>;
|
89
89
|
formatter: {
|
90
90
|
type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
|
91
91
|
default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
|
@@ -134,7 +134,7 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
134
134
|
type: PropType<string[]>;
|
135
135
|
default: () => never[];
|
136
136
|
};
|
137
|
-
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values
|
137
|
+
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values: string[]) => import("../picker").PickerOption[]>;
|
138
138
|
formatter: {
|
139
139
|
type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
|
140
140
|
default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
|
@@ -55,11 +55,7 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
55
55
|
const currentValues = (0, import_vue.ref)(props.modelValue);
|
56
56
|
const updatedByExternalSources = (0, import_vue.ref)(false);
|
57
57
|
const pickerRef = (0, import_vue.ref)();
|
58
|
-
const
|
59
|
-
const minYear = props.minDate.getFullYear();
|
60
|
-
const maxYear = props.maxDate.getFullYear();
|
61
|
-
return (0, import_utils2.genOptions)(minYear, maxYear, "year", props.formatter, props.filter);
|
62
|
-
};
|
58
|
+
const computedValues = (0, import_vue.computed)(() => updatedByExternalSources.value ? props.modelValue : currentValues.value);
|
63
59
|
const isMinYear = (year) => year === props.minDate.getFullYear();
|
64
60
|
const isMaxYear = (year) => year === props.maxDate.getFullYear();
|
65
61
|
const isMinMonth = (month) => month === props.minDate.getMonth() + 1;
|
@@ -70,7 +66,7 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
70
66
|
columnsType
|
71
67
|
} = props;
|
72
68
|
const index = columnsType.indexOf(type);
|
73
|
-
const value =
|
69
|
+
const value = computedValues.value[index];
|
74
70
|
if (value) {
|
75
71
|
return +value;
|
76
72
|
}
|
@@ -83,18 +79,23 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
83
79
|
return minDate.getDate();
|
84
80
|
}
|
85
81
|
};
|
82
|
+
const genYearOptions = () => {
|
83
|
+
const minYear = props.minDate.getFullYear();
|
84
|
+
const maxYear = props.maxDate.getFullYear();
|
85
|
+
return (0, import_utils2.genOptions)(minYear, maxYear, "year", props.formatter, props.filter, computedValues.value);
|
86
|
+
};
|
86
87
|
const genMonthOptions = () => {
|
87
88
|
const year = getValue("year");
|
88
89
|
const minMonth = isMinYear(year) ? props.minDate.getMonth() + 1 : 1;
|
89
90
|
const maxMonth = isMaxYear(year) ? props.maxDate.getMonth() + 1 : 12;
|
90
|
-
return (0, import_utils2.genOptions)(minMonth, maxMonth, "month", props.formatter, props.filter);
|
91
|
+
return (0, import_utils2.genOptions)(minMonth, maxMonth, "month", props.formatter, props.filter, computedValues.value);
|
91
92
|
};
|
92
93
|
const genDayOptions = () => {
|
93
94
|
const year = getValue("year");
|
94
95
|
const month = getValue("month");
|
95
96
|
const minDate = isMinYear(year) && isMinMonth(month) ? props.minDate.getDate() : 1;
|
96
97
|
const maxDate = isMaxYear(year) && isMaxMonth(month) ? props.maxDate.getDate() : (0, import_utils2.getMonthEndDay)(year, month);
|
97
|
-
return (0, import_utils2.genOptions)(minDate, maxDate, "day", props.formatter, props.filter);
|
98
|
+
return (0, import_utils2.genOptions)(minDate, maxDate, "day", props.formatter, props.filter, computedValues.value);
|
98
99
|
};
|
99
100
|
const confirm = () => {
|
100
101
|
var _a;
|
@@ -28,7 +28,7 @@ export declare const DatePicker: import("../utils").WithInstall<import("vue").De
|
|
28
28
|
type: import("vue").PropType<string[]>;
|
29
29
|
default: () => never[];
|
30
30
|
};
|
31
|
-
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values
|
31
|
+
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values: string[]) => import("..").PickerOption[]>;
|
32
32
|
formatter: {
|
33
33
|
type: import("vue").PropType<(type: string, option: import("..").PickerOption) => import("..").PickerOption>;
|
34
34
|
default: (type: string, option: import("..").PickerOption) => import("..").PickerOption;
|
@@ -77,7 +77,7 @@ export declare const DatePicker: import("../utils").WithInstall<import("vue").De
|
|
77
77
|
type: import("vue").PropType<string[]>;
|
78
78
|
default: () => never[];
|
79
79
|
};
|
80
|
-
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values
|
80
|
+
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values: string[]) => import("..").PickerOption[]>;
|
81
81
|
formatter: {
|
82
82
|
type: import("vue").PropType<(type: string, option: import("..").PickerOption) => import("..").PickerOption>;
|
83
83
|
default: (type: string, option: import("..").PickerOption) => import("..").PickerOption;
|
@@ -1,9 +1,7 @@
|
|
1
|
-
import { type RequiredParams } from '../utils';
|
2
1
|
import { pickerSharedProps } from '../picker/Picker';
|
3
2
|
import type { PropType } from 'vue';
|
4
3
|
import type { PickerOption } from '../picker';
|
5
|
-
type Filter = (columnType: string, options: PickerOption[], values
|
6
|
-
export type TimeFilter = RequiredParams<Filter>;
|
4
|
+
type Filter = (columnType: string, options: PickerOption[], values: string[]) => PickerOption[];
|
7
5
|
type Formatter = (type: string, option: PickerOption) => PickerOption;
|
8
6
|
export declare const sharedProps: {
|
9
7
|
loading: BooleanConstructor;
|
@@ -43,6 +41,6 @@ export declare const sharedProps: {
|
|
43
41
|
export declare const pickerInheritKeys: Array<keyof typeof pickerSharedProps>;
|
44
42
|
export declare function times<T>(n: number, iteratee: (index: number) => T): T[];
|
45
43
|
export declare const getMonthEndDay: (year: number, month: number) => number;
|
46
|
-
export declare const genOptions: <T extends string>(min: number, max: number, type: T, formatter: Formatter, filter
|
44
|
+
export declare const genOptions: <T extends string>(min: number, max: number, type: T, formatter: Formatter, filter: Filter | undefined, values: string[]) => PickerOption[];
|
47
45
|
export declare const formatValueRange: (values: string[], columns: PickerOption[][]) => string[];
|
48
46
|
export {};
|
package/lib/field/Field.js
CHANGED
@@ -246,7 +246,7 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
246
246
|
if (props.type === "number" || props.type === "digit") {
|
247
247
|
const isNumber = props.type === "number";
|
248
248
|
value = (0, import_utils.formatNumber)(value, isNumber, isNumber);
|
249
|
-
if (trigger === "onBlur" && value !== "") {
|
249
|
+
if (trigger === "onBlur" && value !== "" && (props.min !== void 0 || props.max !== void 0)) {
|
250
250
|
const adjustedValue = (0, import_utils.clamp)(+value, (_a = props.min) != null ? _a : -Infinity, (_b = props.max) != null ? _b : Infinity);
|
251
251
|
value = adjustedValue.toString();
|
252
252
|
}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
@@ -226,7 +226,7 @@ __reExport(stdin_exports, require("./toast"), module.exports);
|
|
226
226
|
__reExport(stdin_exports, require("./tree-select"), module.exports);
|
227
227
|
__reExport(stdin_exports, require("./uploader"), module.exports);
|
228
228
|
__reExport(stdin_exports, require("./watermark"), module.exports);
|
229
|
-
const version = "4.9.
|
229
|
+
const version = "4.9.8";
|
230
230
|
function install(app) {
|
231
231
|
const components = [
|
232
232
|
import_action_bar.ActionBar,
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { type ExtractPropTypes, type PropType, type ComponentPublicInstance } from 'vue';
|
2
|
-
import { type TimeFilter } from '../date-picker/utils';
|
3
2
|
export type TimePickerColumnType = 'hour' | 'minute' | 'second';
|
4
3
|
export declare const timePickerProps: {
|
5
4
|
loading: BooleanConstructor;
|
@@ -30,7 +29,7 @@ export declare const timePickerProps: {
|
|
30
29
|
type: PropType<string[]>;
|
31
30
|
default: () => never[];
|
32
31
|
};
|
33
|
-
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values
|
32
|
+
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values: string[]) => import("../picker").PickerOption[]>;
|
34
33
|
formatter: {
|
35
34
|
type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
|
36
35
|
default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
|
@@ -72,7 +71,6 @@ export declare const timePickerProps: {
|
|
72
71
|
type: PropType<TimePickerColumnType[]>;
|
73
72
|
default: () => string[];
|
74
73
|
};
|
75
|
-
filter: PropType<TimeFilter>;
|
76
74
|
};
|
77
75
|
export type TimePickerProps = ExtractPropTypes<typeof timePickerProps>;
|
78
76
|
export type TimePickerExpose = {
|
@@ -109,7 +107,7 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
109
107
|
type: PropType<string[]>;
|
110
108
|
default: () => never[];
|
111
109
|
};
|
112
|
-
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values
|
110
|
+
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values: string[]) => import("../picker").PickerOption[]>;
|
113
111
|
formatter: {
|
114
112
|
type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
|
115
113
|
default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
|
@@ -151,7 +149,6 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
151
149
|
type: PropType<TimePickerColumnType[]>;
|
152
150
|
default: () => string[];
|
153
151
|
};
|
154
|
-
filter: PropType<TimeFilter>;
|
155
152
|
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "cancel" | "change" | "confirm")[], "update:modelValue" | "cancel" | "change" | "confirm", import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
156
153
|
loading: BooleanConstructor;
|
157
154
|
readonly: BooleanConstructor;
|
@@ -181,7 +178,7 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
181
178
|
type: PropType<string[]>;
|
182
179
|
default: () => never[];
|
183
180
|
};
|
184
|
-
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values
|
181
|
+
filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values: string[]) => import("../picker").PickerOption[]>;
|
185
182
|
formatter: {
|
186
183
|
type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
|
187
184
|
default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
|
@@ -223,7 +220,6 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
223
220
|
type: PropType<TimePickerColumnType[]>;
|
224
221
|
default: () => string[];
|
225
222
|
};
|
226
|
-
filter: PropType<TimeFilter>;
|
227
223
|
}>> & Readonly<{
|
228
224
|
onChange?: ((...args: any[]) => any) | undefined;
|
229
225
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
@@ -28,7 +28,7 @@ export declare const TimePicker: import("../utils").WithInstall<import("vue").De
|
|
28
28
|
type: import("vue").PropType<string[]>;
|
29
29
|
default: () => never[];
|
30
30
|
};
|
31
|
-
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values
|
31
|
+
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values: string[]) => import("..").PickerOption[]>;
|
32
32
|
formatter: {
|
33
33
|
type: import("vue").PropType<(type: string, option: import("..").PickerOption) => import("..").PickerOption>;
|
34
34
|
default: (type: string, option: import("..").PickerOption) => import("..").PickerOption;
|
@@ -70,7 +70,6 @@ export declare const TimePicker: import("../utils").WithInstall<import("vue").De
|
|
70
70
|
type: import("vue").PropType<import("./TimePicker").TimePickerColumnType[]>;
|
71
71
|
default: () => string[];
|
72
72
|
};
|
73
|
-
filter: import("vue").PropType<import("../date-picker/utils").TimeFilter>;
|
74
73
|
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "cancel" | "change" | "confirm")[], "update:modelValue" | "cancel" | "change" | "confirm", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
75
74
|
loading: BooleanConstructor;
|
76
75
|
readonly: BooleanConstructor;
|
@@ -100,7 +99,7 @@ export declare const TimePicker: import("../utils").WithInstall<import("vue").De
|
|
100
99
|
type: import("vue").PropType<string[]>;
|
101
100
|
default: () => never[];
|
102
101
|
};
|
103
|
-
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values
|
102
|
+
filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values: string[]) => import("..").PickerOption[]>;
|
104
103
|
formatter: {
|
105
104
|
type: import("vue").PropType<(type: string, option: import("..").PickerOption) => import("..").PickerOption>;
|
106
105
|
default: (type: string, option: import("..").PickerOption) => import("..").PickerOption;
|
@@ -142,7 +141,6 @@ export declare const TimePicker: import("../utils").WithInstall<import("vue").De
|
|
142
141
|
type: import("vue").PropType<import("./TimePicker").TimePickerColumnType[]>;
|
143
142
|
default: () => string[];
|
144
143
|
};
|
145
|
-
filter: import("vue").PropType<import("../date-picker/utils").TimeFilter>;
|
146
144
|
}>> & Readonly<{
|
147
145
|
onChange?: ((...args: any[]) => any) | undefined;
|
148
146
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|