vant 4.1.0 → 4.1.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/es/area/utils.mjs +2 -2
- package/es/back-top/BackTop.mjs +1 -1
- package/es/badge/Badge.mjs +1 -1
- package/es/button/Button.d.ts +1 -1
- package/es/button/index.d.ts +1 -1
- package/es/calendar/Calendar.mjs +2 -2
- package/es/calendar/utils.mjs +1 -1
- package/es/checkbox/Checkbox.mjs +1 -1
- package/es/date-picker/DatePicker.mjs +1 -1
- package/es/divider/Divider.d.ts +1 -1
- package/es/divider/index.d.ts +1 -1
- package/es/field/Field.mjs +2 -2
- package/es/field/index.d.ts +1 -1
- package/es/field/types.d.ts +2 -2
- package/es/grid-item/GridItem.mjs +1 -1
- package/es/image-preview/ImagePreviewItem.mjs +3 -2
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/lazyload/vue-lazyload/index.mjs +5 -0
- package/es/lazyload/vue-lazyload/lazy-image.mjs +0 -1
- package/es/lazyload/vue-lazyload/lazy.mjs +81 -0
- package/es/lazyload/vue-lazyload/listener.mjs +45 -0
- package/es/list/List.mjs +3 -2
- package/es/number-keyboard/NumberKeyboard.mjs +1 -1
- package/es/password-input/PasswordInput.mjs +1 -1
- package/es/picker/Picker.mjs +1 -0
- package/es/popup/shared.mjs +12 -0
- package/es/progress/Progress.mjs +1 -1
- package/es/search/Search.mjs +4 -4
- package/es/slider/Slider.d.ts +1 -1
- package/es/slider/index.d.ts +1 -1
- package/es/stepper/Stepper.mjs +2 -2
- package/es/sticky/Sticky.mjs +2 -0
- package/es/swipe/Swipe.mjs +3 -2
- package/es/tabs/Tabs.mjs +1 -1
- package/es/tag/Tag.d.ts +1 -1
- package/es/tag/index.d.ts +1 -1
- package/es/text-ellipsis/index.css +1 -1
- package/es/tree-select/TreeSelect.mjs +1 -1
- package/es/uploader/Uploader.mjs +1 -1
- package/es/uploader/utils.mjs +2 -2
- package/lib/action-bar/index.js +4 -0
- package/lib/action-bar-button/index.js +4 -0
- package/lib/action-bar-icon/index.js +4 -0
- package/lib/action-sheet/index.js +4 -0
- package/lib/address-edit/AddressEdit.js +4 -0
- package/lib/address-edit/index.js +4 -0
- package/lib/address-list/AddressList.js +4 -0
- package/lib/address-list/index.js +4 -0
- package/lib/area/index.js +4 -0
- package/lib/area/utils.js +2 -2
- package/lib/back-top/BackTop.js +1 -1
- package/lib/back-top/index.js +4 -0
- package/lib/badge/Badge.js +1 -1
- package/lib/badge/index.js +4 -0
- package/lib/button/Button.d.ts +1 -1
- package/lib/button/index.d.ts +1 -1
- package/lib/button/index.js +4 -0
- package/lib/calendar/Calendar.js +6 -2
- package/lib/calendar/CalendarMonth.js +4 -0
- package/lib/calendar/index.js +4 -0
- package/lib/calendar/utils.js +1 -1
- package/lib/card/index.js +4 -0
- package/lib/cascader/index.js +4 -0
- package/lib/cell/index.js +4 -0
- package/lib/cell-group/index.js +4 -0
- package/lib/checkbox/Checkbox.js +5 -1
- package/lib/checkbox/index.js +4 -0
- package/lib/checkbox-group/index.js +4 -0
- package/lib/circle/index.js +4 -0
- package/lib/col/index.js +4 -0
- package/lib/collapse/index.js +4 -0
- package/lib/collapse-item/index.js +4 -0
- package/lib/config-provider/index.js +4 -0
- package/lib/contact-card/index.js +4 -0
- package/lib/contact-edit/index.js +4 -0
- package/lib/contact-list/index.js +4 -0
- package/lib/count-down/index.js +4 -0
- package/lib/coupon/index.js +4 -0
- package/lib/coupon-cell/index.js +4 -0
- package/lib/coupon-list/index.js +4 -0
- package/lib/date-picker/DatePicker.js +1 -1
- package/lib/date-picker/index.js +4 -0
- package/lib/dialog/function-call.js +4 -0
- package/lib/dialog/index.js +4 -0
- package/lib/divider/Divider.d.ts +1 -1
- package/lib/divider/index.d.ts +1 -1
- package/lib/divider/index.js +4 -0
- package/lib/dropdown-item/index.js +4 -0
- package/lib/dropdown-menu/index.js +4 -0
- package/lib/empty/index.js +4 -0
- package/lib/field/Field.js +2 -2
- package/lib/field/index.d.ts +1 -1
- package/lib/field/index.js +4 -0
- package/lib/field/types.d.ts +2 -2
- package/lib/form/index.js +4 -0
- package/lib/grid/index.js +4 -0
- package/lib/grid-item/GridItem.js +1 -1
- package/lib/grid-item/index.js +4 -0
- package/lib/icon/index.js +4 -0
- package/lib/image/index.js +4 -0
- package/lib/image-preview/ImagePreview.js +4 -0
- package/lib/image-preview/ImagePreviewItem.js +3 -2
- package/lib/image-preview/function-call.js +4 -0
- package/lib/image-preview/index.js +4 -0
- package/lib/index-anchor/index.js +4 -0
- package/lib/index-bar/index.js +4 -0
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/lazyload/vue-lazyload/index.js +9 -0
- package/lib/lazyload/vue-lazyload/lazy-image.js +0 -1
- package/lib/lazyload/vue-lazyload/lazy.js +85 -0
- package/lib/lazyload/vue-lazyload/listener.js +45 -0
- package/lib/list/List.js +3 -2
- package/lib/list/index.js +4 -0
- package/lib/loading/index.js +4 -0
- package/lib/locale/index.js +4 -0
- package/lib/nav-bar/index.js +4 -0
- package/lib/notice-bar/index.js +4 -0
- package/lib/notify/function-call.js +4 -0
- package/lib/notify/index.js +4 -0
- package/lib/number-keyboard/NumberKeyboard.js +5 -1
- package/lib/number-keyboard/index.js +4 -0
- package/lib/overlay/index.js +4 -0
- package/lib/pagination/index.js +4 -0
- package/lib/password-input/PasswordInput.js +1 -1
- package/lib/password-input/index.js +4 -0
- package/lib/picker/Picker.js +5 -0
- package/lib/picker/index.js +4 -0
- package/lib/picker-group/PickerGroup.js +4 -0
- package/lib/picker-group/index.js +4 -0
- package/lib/popover/index.js +4 -0
- package/lib/popup/index.js +4 -0
- package/lib/popup/shared.js +12 -0
- package/lib/progress/Progress.js +1 -1
- package/lib/progress/index.js +4 -0
- package/lib/pull-refresh/index.js +4 -0
- package/lib/radio/Radio.js +4 -0
- package/lib/radio/index.js +4 -0
- package/lib/radio-group/index.js +4 -0
- package/lib/rate/index.js +4 -0
- package/lib/row/index.js +4 -0
- package/lib/search/Search.js +4 -4
- package/lib/search/index.js +4 -0
- package/lib/share-sheet/index.js +4 -0
- package/lib/sidebar/index.js +4 -0
- package/lib/sidebar-item/index.js +4 -0
- package/lib/skeleton/Skeleton.js +4 -0
- package/lib/skeleton/index.js +4 -0
- package/lib/skeleton-avatar/index.js +4 -0
- package/lib/skeleton-image/index.js +4 -0
- package/lib/skeleton-paragraph/index.js +4 -0
- package/lib/skeleton-title/index.js +4 -0
- package/lib/slider/Slider.d.ts +1 -1
- package/lib/slider/index.d.ts +1 -1
- package/lib/slider/index.js +4 -0
- package/lib/space/index.js +4 -0
- package/lib/step/index.js +4 -0
- package/lib/stepper/Stepper.js +2 -2
- package/lib/stepper/index.js +4 -0
- package/lib/steps/index.js +4 -0
- package/lib/sticky/Sticky.js +2 -0
- package/lib/sticky/index.js +4 -0
- package/lib/submit-bar/index.js +4 -0
- package/lib/swipe/Swipe.js +3 -2
- package/lib/swipe/index.js +4 -0
- package/lib/swipe-cell/index.js +4 -0
- package/lib/swipe-item/index.js +4 -0
- package/lib/switch/index.js +4 -0
- package/lib/tab/index.js +4 -0
- package/lib/tabbar/index.js +4 -0
- package/lib/tabbar-item/index.js +4 -0
- package/lib/tabs/Tabs.js +5 -1
- package/lib/tabs/index.js +4 -0
- package/lib/tag/Tag.d.ts +1 -1
- package/lib/tag/index.d.ts +1 -1
- package/lib/tag/index.js +4 -0
- package/lib/text-ellipsis/index.css +1 -1
- package/lib/text-ellipsis/index.js +4 -0
- package/lib/time-picker/index.js +4 -0
- package/lib/toast/function-call.js +4 -0
- package/lib/toast/index.js +4 -0
- package/lib/tree-select/TreeSelect.js +1 -1
- package/lib/tree-select/index.js +4 -0
- package/lib/uploader/Uploader.js +5 -1
- package/lib/uploader/index.js +4 -0
- package/lib/uploader/utils.js +2 -2
- package/lib/utils/create.js +4 -0
- package/lib/vant.cjs.js +182 -34
- package/lib/vant.es.js +182 -34
- package/lib/vant.js +219 -41
- package/lib/vant.min.js +1 -1
- package/lib/web-types.json +1 -1
- package/package.json +5 -5
package/es/area/utils.mjs
CHANGED
@@ -32,8 +32,8 @@ function formatDataForCascade({
|
|
32
32
|
county_list: county = {},
|
33
33
|
province_list: province = {}
|
34
34
|
} = areaList;
|
35
|
-
const showCity = columnsNum > 1;
|
36
|
-
const showCounty = columnsNum > 2;
|
35
|
+
const showCity = +columnsNum > 1;
|
36
|
+
const showCounty = +columnsNum > 2;
|
37
37
|
const getProvinceChildren = () => {
|
38
38
|
if (showCity) {
|
39
39
|
return placeholder.length ? [
|
package/es/back-top/BackTop.mjs
CHANGED
@@ -43,7 +43,7 @@ var stdin_default = defineComponent({
|
|
43
43
|
});
|
44
44
|
};
|
45
45
|
const scroll = () => {
|
46
|
-
show.value = scrollParent.value ? getScrollTop(scrollParent.value) >= props.offset : false;
|
46
|
+
show.value = scrollParent.value ? getScrollTop(scrollParent.value) >= +props.offset : false;
|
47
47
|
};
|
48
48
|
const getTarget = () => {
|
49
49
|
const {
|
package/es/badge/Badge.mjs
CHANGED
@@ -38,7 +38,7 @@ var stdin_default = defineComponent({
|
|
38
38
|
if (slots.content) {
|
39
39
|
return slots.content();
|
40
40
|
}
|
41
|
-
if (isDef(max) && isNumeric(content) && +content > max) {
|
41
|
+
if (isDef(max) && isNumeric(content) && +content > +max) {
|
42
42
|
return `${max}+`;
|
43
43
|
}
|
44
44
|
return content;
|
package/es/button/Button.d.ts
CHANGED
@@ -131,8 +131,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
131
131
|
size: ButtonSize;
|
132
132
|
loading: boolean;
|
133
133
|
block: boolean;
|
134
|
-
square: boolean;
|
135
134
|
plain: boolean;
|
135
|
+
square: boolean;
|
136
136
|
hairline: boolean;
|
137
137
|
nativeType: ButtonNativeType;
|
138
138
|
iconPosition: ButtonIconPosition;
|
package/es/button/index.d.ts
CHANGED
@@ -87,8 +87,8 @@ export declare const Button: import("../utils").WithInstall<import("vue").Define
|
|
87
87
|
size: import("./types").ButtonSize;
|
88
88
|
loading: boolean;
|
89
89
|
block: boolean;
|
90
|
-
square: boolean;
|
91
90
|
plain: boolean;
|
91
|
+
square: boolean;
|
92
92
|
hairline: boolean;
|
93
93
|
nativeType: import("./types").ButtonNativeType;
|
94
94
|
iconPosition: import("./types").ButtonIconPosition;
|
package/es/calendar/Calendar.mjs
CHANGED
@@ -222,7 +222,7 @@ var stdin_default = defineComponent({
|
|
222
222
|
rangePrompt,
|
223
223
|
showRangePrompt
|
224
224
|
} = props;
|
225
|
-
if (maxRange && calcDateNum(date) > maxRange) {
|
225
|
+
if (maxRange && calcDateNum(date) > +maxRange) {
|
226
226
|
if (showRangePrompt) {
|
227
227
|
showToast(rangePrompt || t("rangePrompt", maxRange));
|
228
228
|
}
|
@@ -309,7 +309,7 @@ var stdin_default = defineComponent({
|
|
309
309
|
if (selectedIndex !== -1) {
|
310
310
|
const [unselectedDate] = dates.splice(selectedIndex, 1);
|
311
311
|
emit("unselect", cloneDate(unselectedDate));
|
312
|
-
} else if (props.maxRange && dates.length >= props.maxRange) {
|
312
|
+
} else if (props.maxRange && dates.length >= +props.maxRange) {
|
313
313
|
showToast(props.rangePrompt || t("rangePrompt", props.maxRange));
|
314
314
|
} else {
|
315
315
|
select([...dates, date]);
|
package/es/calendar/utils.mjs
CHANGED
@@ -30,7 +30,7 @@ function getDayByOffset(date, offset) {
|
|
30
30
|
const getPrevDay = (date) => getDayByOffset(date, -1);
|
31
31
|
const getNextDay = (date) => getDayByOffset(date, 1);
|
32
32
|
const getToday = () => {
|
33
|
-
const today = new Date();
|
33
|
+
const today = /* @__PURE__ */ new Date();
|
34
34
|
today.setHours(0, 0, 0, 0);
|
35
35
|
return today;
|
36
36
|
};
|
package/es/checkbox/Checkbox.mjs
CHANGED
@@ -30,7 +30,7 @@ var stdin_default = defineComponent({
|
|
30
30
|
} = parent.props;
|
31
31
|
const value = modelValue.slice();
|
32
32
|
if (checked2) {
|
33
|
-
const overlimit = max && value.length >= max;
|
33
|
+
const overlimit = max && value.length >= +max;
|
34
34
|
if (!overlimit && !value.includes(name2)) {
|
35
35
|
value.push(name2);
|
36
36
|
if (props.bindGroup) {
|
@@ -3,7 +3,7 @@ import { ref, watch, computed, defineComponent } from "vue";
|
|
3
3
|
import { pick, extend, isDate, isSameValue, createNamespace } from "../utils/index.mjs";
|
4
4
|
import { genOptions, sharedProps, getMonthEndDay, pickerInheritKeys, formatValueRange } from "./utils.mjs";
|
5
5
|
import { Picker } from "../picker/index.mjs";
|
6
|
-
const currentYear = new Date().getFullYear();
|
6
|
+
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
7
7
|
const [name] = createNamespace("date-picker");
|
8
8
|
const datePickerProps = extend({}, sharedProps, {
|
9
9
|
columnsType: {
|
package/es/divider/Divider.d.ts
CHANGED
package/es/divider/index.d.ts
CHANGED
@@ -19,8 +19,8 @@ export declare const Divider: import("../utils").WithInstall<import("vue").Defin
|
|
19
19
|
default: import("./Divider").DividerContentPosition;
|
20
20
|
};
|
21
21
|
}>>, {
|
22
|
-
dashed: boolean;
|
23
22
|
hairline: boolean;
|
23
|
+
dashed: boolean;
|
24
24
|
contentPosition: import("./Divider").DividerContentPosition;
|
25
25
|
}>>;
|
26
26
|
export default Divider;
|
package/es/field/Field.mjs
CHANGED
@@ -183,7 +183,7 @@ var stdin_default = defineComponent({
|
|
183
183
|
const {
|
184
184
|
maxlength
|
185
185
|
} = props;
|
186
|
-
if (isDef(maxlength) && getStringLength(value) > maxlength) {
|
186
|
+
if (isDef(maxlength) && getStringLength(value) > +maxlength) {
|
187
187
|
const modelValue = getModelValue();
|
188
188
|
if (modelValue && getStringLength(modelValue) === +maxlength) {
|
189
189
|
return modelValue;
|
@@ -214,7 +214,7 @@ var stdin_default = defineComponent({
|
|
214
214
|
maxlength
|
215
215
|
} = props;
|
216
216
|
value = formatter(value);
|
217
|
-
if (isDef(maxlength) && getStringLength(value) > maxlength) {
|
217
|
+
if (isDef(maxlength) && getStringLength(value) > +maxlength) {
|
218
218
|
value = cutString(value, +maxlength);
|
219
219
|
}
|
220
220
|
if (inputRef.value && state.focused) {
|
package/es/field/index.d.ts
CHANGED
@@ -205,7 +205,7 @@ export declare const Field: import("../utils").WithInstall<import("vue").DefineC
|
|
205
205
|
export default Field;
|
206
206
|
export { fieldProps } from './Field';
|
207
207
|
export type { FieldProps };
|
208
|
-
export type { FieldType, FieldRule, FieldInstance, FieldTextAlign, FieldThemeVars, FieldRuleMessage, FieldClearTrigger, FieldFormatTrigger, FieldRuleValidator,
|
208
|
+
export type { FieldType, FieldRule, FieldInstance, FieldTextAlign, FieldThemeVars, FieldRuleMessage, FieldClearTrigger, FieldFormatTrigger, FieldRuleValidator, FieldRuleFormatter, FieldValidateError, FieldAutosizeConfig, FieldValidateTrigger, FieldValidationStatus, } from './types';
|
209
209
|
declare module 'vue' {
|
210
210
|
interface GlobalComponents {
|
211
211
|
VanField: typeof Field;
|
package/es/field/types.d.ts
CHANGED
@@ -15,14 +15,14 @@ export type FieldValidateError = {
|
|
15
15
|
};
|
16
16
|
export type FieldRuleMessage = string | ((value: any, rule: FieldRule) => string);
|
17
17
|
export type FieldRuleValidator = (value: any, rule: FieldRule) => boolean | string | Promise<boolean | string>;
|
18
|
-
export type
|
18
|
+
export type FieldRuleFormatter = (value: any, rule: FieldRule) => string;
|
19
19
|
export type FieldRule = {
|
20
20
|
pattern?: RegExp;
|
21
21
|
trigger?: FieldValidateTrigger | FieldValidateTrigger[];
|
22
22
|
message?: FieldRuleMessage;
|
23
23
|
required?: boolean;
|
24
24
|
validator?: FieldRuleValidator;
|
25
|
-
formatter?:
|
25
|
+
formatter?: FieldRuleFormatter;
|
26
26
|
validateEmpty?: boolean;
|
27
27
|
};
|
28
28
|
export type FieldValidationStatus = 'passed' | 'failed' | 'unvalidated';
|
@@ -214,8 +214,9 @@ var stdin_default = defineComponent({
|
|
214
214
|
if (state.scale < 1) {
|
215
215
|
resetScale();
|
216
216
|
}
|
217
|
-
|
218
|
-
|
217
|
+
const maxZoom = +props.maxZoom;
|
218
|
+
if (state.scale > maxZoom) {
|
219
|
+
state.scale = maxZoom;
|
219
220
|
}
|
220
221
|
}
|
221
222
|
}
|
package/es/index.d.ts
CHANGED
package/es/index.mjs
CHANGED
@@ -92,7 +92,7 @@ import { TimePicker } from "./time-picker/index.mjs";
|
|
92
92
|
import { Toast } from "./toast/index.mjs";
|
93
93
|
import { TreeSelect } from "./tree-select/index.mjs";
|
94
94
|
import { Uploader } from "./uploader/index.mjs";
|
95
|
-
const version = "4.1.
|
95
|
+
const version = "4.1.1";
|
96
96
|
function install(app) {
|
97
97
|
const components = [
|
98
98
|
ActionBar,
|
@@ -3,6 +3,11 @@ import LazyComponent from "./lazy-component.mjs";
|
|
3
3
|
import LazyContainer from "./lazy-container.mjs";
|
4
4
|
import LazyImage from "./lazy-image.mjs";
|
5
5
|
const Lazyload = {
|
6
|
+
/*
|
7
|
+
* install function
|
8
|
+
* @param {App} app
|
9
|
+
* @param {object} options lazyload options
|
10
|
+
*/
|
6
11
|
install(app, options = {}) {
|
7
12
|
const LazyClass = Lazy();
|
8
13
|
const lazy = new LazyClass(options);
|
@@ -75,12 +75,26 @@ function stdin_default() {
|
|
75
75
|
);
|
76
76
|
this.setMode(this.options.observer ? modeType.observer : modeType.event);
|
77
77
|
}
|
78
|
+
/**
|
79
|
+
* update config
|
80
|
+
* @param {Object} config params
|
81
|
+
* @return
|
82
|
+
*/
|
78
83
|
config(options = {}) {
|
79
84
|
Object.assign(this.options, options);
|
80
85
|
}
|
86
|
+
/**
|
87
|
+
* output listener's load performance
|
88
|
+
* @return {Array}
|
89
|
+
*/
|
81
90
|
performance() {
|
82
91
|
return this.listeners.map((item) => item.performance());
|
83
92
|
}
|
93
|
+
/*
|
94
|
+
* add lazy component to queue
|
95
|
+
* @param {Vue} vm lazy component instance
|
96
|
+
* @return
|
97
|
+
*/
|
84
98
|
addLazyBox(vm) {
|
85
99
|
this.listeners.push(vm);
|
86
100
|
if (inBrowser) {
|
@@ -91,6 +105,13 @@ function stdin_default() {
|
|
91
105
|
}
|
92
106
|
}
|
93
107
|
}
|
108
|
+
/*
|
109
|
+
* add image listener to queue
|
110
|
+
* @param {DOM} el
|
111
|
+
* @param {object} binding vue directive binding
|
112
|
+
* @param {vnode} vnode vue directive vnode
|
113
|
+
* @return
|
114
|
+
*/
|
94
115
|
add(el, binding, vnode) {
|
95
116
|
if (this.listeners.some((item) => item.el === el)) {
|
96
117
|
this.update(el, binding);
|
@@ -131,6 +152,12 @@ function stdin_default() {
|
|
131
152
|
nextTick(() => this.lazyLoadHandler());
|
132
153
|
});
|
133
154
|
}
|
155
|
+
/**
|
156
|
+
* update image src
|
157
|
+
* @param {DOM} el
|
158
|
+
* @param {object} vue directive binding
|
159
|
+
* @return
|
160
|
+
*/
|
134
161
|
update(el, binding, vnode) {
|
135
162
|
const value = this.valueFormatter(binding.value);
|
136
163
|
let { src } = value;
|
@@ -152,6 +179,11 @@ function stdin_default() {
|
|
152
179
|
this.lazyLoadHandler();
|
153
180
|
nextTick(() => this.lazyLoadHandler());
|
154
181
|
}
|
182
|
+
/**
|
183
|
+
* remove listener form list
|
184
|
+
* @param {DOM} el
|
185
|
+
* @return
|
186
|
+
*/
|
155
187
|
remove(el) {
|
156
188
|
if (!el)
|
157
189
|
return;
|
@@ -164,6 +196,11 @@ function stdin_default() {
|
|
164
196
|
existItem.$destroy();
|
165
197
|
}
|
166
198
|
}
|
199
|
+
/*
|
200
|
+
* remove lazy components form list
|
201
|
+
* @param {Vue} vm Vue instance
|
202
|
+
* @return
|
203
|
+
*/
|
167
204
|
removeComponent(vm) {
|
168
205
|
if (!vm)
|
169
206
|
return;
|
@@ -196,6 +233,14 @@ function stdin_default() {
|
|
196
233
|
this.initIntersectionObserver();
|
197
234
|
}
|
198
235
|
}
|
236
|
+
/*
|
237
|
+
*** Private functions ***
|
238
|
+
*/
|
239
|
+
/*
|
240
|
+
* add listener target
|
241
|
+
* @param {DOM} el listener target
|
242
|
+
* @return
|
243
|
+
*/
|
199
244
|
addListenerTarget(el) {
|
200
245
|
if (!el)
|
201
246
|
return;
|
@@ -214,6 +259,11 @@ function stdin_default() {
|
|
214
259
|
}
|
215
260
|
return this.targetIndex;
|
216
261
|
}
|
262
|
+
/*
|
263
|
+
* remove listener target or reduce target childrenCount
|
264
|
+
* @param {DOM} el or window
|
265
|
+
* @return
|
266
|
+
*/
|
217
267
|
removeListenerTarget(el) {
|
218
268
|
this.targets.forEach((target, index) => {
|
219
269
|
if (target.el === el) {
|
@@ -226,6 +276,12 @@ function stdin_default() {
|
|
226
276
|
}
|
227
277
|
});
|
228
278
|
}
|
279
|
+
/*
|
280
|
+
* add or remove eventlistener
|
281
|
+
* @param {DOM} el DOM or Window
|
282
|
+
* @param {boolean} start flag
|
283
|
+
* @return
|
284
|
+
*/
|
229
285
|
initListen(el, start) {
|
230
286
|
this.options.ListenEvents.forEach(
|
231
287
|
(evt) => (start ? on : off)(el, evt, this.lazyLoadHandler)
|
@@ -266,6 +322,10 @@ function stdin_default() {
|
|
266
322
|
this.Event.listeners[event].forEach((func) => func(context, inCache));
|
267
323
|
};
|
268
324
|
}
|
325
|
+
/**
|
326
|
+
* find nodes which in viewport and trigger load
|
327
|
+
* @return
|
328
|
+
*/
|
269
329
|
lazyLoadHandler() {
|
270
330
|
const freeList = [];
|
271
331
|
this.listeners.forEach((listener) => {
|
@@ -282,6 +342,11 @@ function stdin_default() {
|
|
282
342
|
item.$destroy();
|
283
343
|
});
|
284
344
|
}
|
345
|
+
/**
|
346
|
+
* init IntersectionObserver
|
347
|
+
* set mode to observer
|
348
|
+
* @return
|
349
|
+
*/
|
285
350
|
initIntersectionObserver() {
|
286
351
|
if (!hasIntersectionObserver) {
|
287
352
|
return;
|
@@ -296,6 +361,10 @@ function stdin_default() {
|
|
296
361
|
});
|
297
362
|
}
|
298
363
|
}
|
364
|
+
/**
|
365
|
+
* init IntersectionObserver
|
366
|
+
* @return
|
367
|
+
*/
|
299
368
|
observerHandler(entries) {
|
300
369
|
entries.forEach((entry) => {
|
301
370
|
if (entry.isIntersecting) {
|
@@ -309,6 +378,13 @@ function stdin_default() {
|
|
309
378
|
}
|
310
379
|
});
|
311
380
|
}
|
381
|
+
/**
|
382
|
+
* set element attribute with image'url and state
|
383
|
+
* @param {object} lazyload listener object
|
384
|
+
* @param {string} state will be rendered
|
385
|
+
* @param {bool} inCache is rendered from cache
|
386
|
+
* @return
|
387
|
+
*/
|
312
388
|
elRenderer(listener, state, cache) {
|
313
389
|
if (!listener.el)
|
314
390
|
return;
|
@@ -340,6 +416,11 @@ function stdin_default() {
|
|
340
416
|
el.dispatchEvent(event);
|
341
417
|
}
|
342
418
|
}
|
419
|
+
/**
|
420
|
+
* generate loading loaded error image url
|
421
|
+
* @param {string} image's src
|
422
|
+
* @return {object} image's loading, loaded, error url
|
423
|
+
*/
|
343
424
|
valueFormatter(value) {
|
344
425
|
let src = value;
|
345
426
|
let { loading, error } = this.options;
|
@@ -35,6 +35,10 @@ class ReactiveListener {
|
|
35
35
|
this.initState();
|
36
36
|
this.render("loading", false);
|
37
37
|
}
|
38
|
+
/*
|
39
|
+
* init listener state
|
40
|
+
* @return
|
41
|
+
*/
|
38
42
|
initState() {
|
39
43
|
if ("dataset" in this.el) {
|
40
44
|
this.el.dataset.src = this.src;
|
@@ -48,9 +52,20 @@ class ReactiveListener {
|
|
48
52
|
rendered: false
|
49
53
|
};
|
50
54
|
}
|
55
|
+
/*
|
56
|
+
* record performance
|
57
|
+
* @return
|
58
|
+
*/
|
51
59
|
record(event) {
|
52
60
|
this.performanceData[event] = Date.now();
|
53
61
|
}
|
62
|
+
/*
|
63
|
+
* update image listener data
|
64
|
+
* @param {String} image uri
|
65
|
+
* @param {String} loading image uri
|
66
|
+
* @param {String} error image uri
|
67
|
+
* @return
|
68
|
+
*/
|
54
69
|
update({ src, loading, error }) {
|
55
70
|
const oldSrc = this.src;
|
56
71
|
this.src = src;
|
@@ -62,15 +77,27 @@ class ReactiveListener {
|
|
62
77
|
this.initState();
|
63
78
|
}
|
64
79
|
}
|
80
|
+
/*
|
81
|
+
* check el is in view
|
82
|
+
* @return {Boolean} el is in view
|
83
|
+
*/
|
65
84
|
checkInView() {
|
66
85
|
const rect = useRect(this.el);
|
67
86
|
return rect.top < window.innerHeight * this.options.preLoad && rect.bottom > this.options.preLoadTop && rect.left < window.innerWidth * this.options.preLoad && rect.right > 0;
|
68
87
|
}
|
88
|
+
/*
|
89
|
+
* listener filter
|
90
|
+
*/
|
69
91
|
filter() {
|
70
92
|
Object.keys(this.options.filter).forEach((key) => {
|
71
93
|
this.options.filter[key](this, this.options);
|
72
94
|
});
|
73
95
|
}
|
96
|
+
/*
|
97
|
+
* render loading first
|
98
|
+
* @params cb:Function
|
99
|
+
* @return
|
100
|
+
*/
|
74
101
|
renderLoading(cb) {
|
75
102
|
this.state.loading = true;
|
76
103
|
loadImageAsync(
|
@@ -93,6 +120,10 @@ class ReactiveListener {
|
|
93
120
|
}
|
94
121
|
);
|
95
122
|
}
|
123
|
+
/*
|
124
|
+
* try load image and render it
|
125
|
+
* @return
|
126
|
+
*/
|
96
127
|
load(onFinish = noop) {
|
97
128
|
if (this.attempt > this.options.attempt - 1 && this.state.error) {
|
98
129
|
if (process.env.NODE_ENV !== "production" && !this.options.silent) {
|
@@ -141,9 +172,19 @@ class ReactiveListener {
|
|
141
172
|
);
|
142
173
|
});
|
143
174
|
}
|
175
|
+
/*
|
176
|
+
* render image
|
177
|
+
* @param {String} state to render // ['loading', 'src', 'error']
|
178
|
+
* @param {String} is form cache
|
179
|
+
* @return
|
180
|
+
*/
|
144
181
|
render(state, cache) {
|
145
182
|
this.elRenderer(this, state, cache);
|
146
183
|
}
|
184
|
+
/*
|
185
|
+
* output performance data
|
186
|
+
* @return {Object} performance data
|
187
|
+
*/
|
147
188
|
performance() {
|
148
189
|
let state = "loading";
|
149
190
|
let time = 0;
|
@@ -159,6 +200,10 @@ class ReactiveListener {
|
|
159
200
|
time
|
160
201
|
};
|
161
202
|
}
|
203
|
+
/*
|
204
|
+
* $destroy
|
205
|
+
* @return
|
206
|
+
*/
|
162
207
|
$destroy() {
|
163
208
|
this.el = null;
|
164
209
|
this.src = null;
|
package/es/list/List.mjs
CHANGED
@@ -33,13 +33,14 @@ var stdin_default = defineComponent({
|
|
33
33
|
const scrollParent = useScrollParent(root);
|
34
34
|
const check = () => {
|
35
35
|
nextTick(() => {
|
36
|
-
if (loading.value || props.finished || props.disabled || props.error ||
|
36
|
+
if (loading.value || props.finished || props.disabled || props.error || // skip check when inside an inactive tab
|
37
|
+
(tabStatus == null ? void 0 : tabStatus.value) === false) {
|
37
38
|
return;
|
38
39
|
}
|
39
40
|
const {
|
40
|
-
offset,
|
41
41
|
direction
|
42
42
|
} = props;
|
43
|
+
const offset = +props.offset;
|
43
44
|
const scrollParentRect = useRect(scrollParent);
|
44
45
|
if (!scrollParentRect.height || isHidden(root)) {
|
45
46
|
return;
|
@@ -117,7 +117,7 @@ var stdin_default = defineComponent({
|
|
117
117
|
emit("update:modelValue", value.slice(0, value.length - 1));
|
118
118
|
} else if (type === "close") {
|
119
119
|
onClose();
|
120
|
-
} else if (value.length < props.maxlength) {
|
120
|
+
} else if (value.length < +props.maxlength) {
|
121
121
|
emit("input", text);
|
122
122
|
emit("update:modelValue", value + text);
|
123
123
|
}
|
@@ -27,10 +27,10 @@ var stdin_default = defineComponent({
|
|
27
27
|
const {
|
28
28
|
mask,
|
29
29
|
value,
|
30
|
-
length,
|
31
30
|
gutter,
|
32
31
|
focused
|
33
32
|
} = props;
|
33
|
+
const length = +props.length;
|
34
34
|
for (let i = 0; i < length; i++) {
|
35
35
|
const char = value[i];
|
36
36
|
const showBorder = i !== 0 && !gutter;
|
package/es/picker/Picker.mjs
CHANGED
@@ -164,6 +164,7 @@ var stdin_default = defineComponent({
|
|
164
164
|
watch(() => props.modelValue, (newValues) => {
|
165
165
|
if (!isSameValue(newValues, selectedValues.value) && !isSameValue(newValues, lastEmittedModelValue)) {
|
166
166
|
selectedValues.value = newValues.slice(0);
|
167
|
+
lastEmittedModelValue = newValues.slice(0);
|
167
168
|
}
|
168
169
|
}, {
|
169
170
|
deep: true
|
package/es/popup/shared.mjs
CHANGED
@@ -1,16 +1,28 @@
|
|
1
1
|
import { truthProp, unknownProp, numericProp } from "../utils/index.mjs";
|
2
2
|
const popupSharedProps = {
|
3
|
+
// whether to show popup
|
3
4
|
show: Boolean,
|
5
|
+
// z-index
|
4
6
|
zIndex: numericProp,
|
7
|
+
// whether to show overlay
|
5
8
|
overlay: truthProp,
|
9
|
+
// transition duration
|
6
10
|
duration: numericProp,
|
11
|
+
// teleport
|
7
12
|
teleport: [String, Object],
|
13
|
+
// prevent body scroll
|
8
14
|
lockScroll: truthProp,
|
15
|
+
// whether to lazy render
|
9
16
|
lazyRender: truthProp,
|
17
|
+
// callback function before close
|
10
18
|
beforeClose: Function,
|
19
|
+
// overlay custom style
|
11
20
|
overlayStyle: Object,
|
21
|
+
// overlay custom class name
|
12
22
|
overlayClass: unknownProp,
|
23
|
+
// Initial rendering animation
|
13
24
|
transitionAppear: Boolean,
|
25
|
+
// whether to close popup when overlay is clicked
|
14
26
|
closeOnClickOverlay: truthProp
|
15
27
|
};
|
16
28
|
const popupSharedPropKeys = Object.keys(
|
package/es/progress/Progress.mjs
CHANGED
package/es/search/Search.mjs
CHANGED
@@ -25,7 +25,7 @@ var stdin_default = defineComponent({
|
|
25
25
|
attrs
|
26
26
|
}) {
|
27
27
|
const id = useId();
|
28
|
-
const
|
28
|
+
const fieldRef = ref();
|
29
29
|
const onCancel = () => {
|
30
30
|
if (!slots.action) {
|
31
31
|
emit("update:modelValue", "");
|
@@ -61,11 +61,11 @@ var stdin_default = defineComponent({
|
|
61
61
|
};
|
62
62
|
const blur = () => {
|
63
63
|
var _a;
|
64
|
-
return (_a =
|
64
|
+
return (_a = fieldRef.value) == null ? void 0 : _a.blur();
|
65
65
|
};
|
66
66
|
const focus = () => {
|
67
67
|
var _a;
|
68
|
-
return (_a =
|
68
|
+
return (_a = fieldRef.value) == null ? void 0 : _a.focus();
|
69
69
|
};
|
70
70
|
const onBlur = (event) => emit("blur", event);
|
71
71
|
const onFocus = (event) => emit("focus", event);
|
@@ -80,7 +80,7 @@ var stdin_default = defineComponent({
|
|
80
80
|
});
|
81
81
|
const onInput = (value) => emit("update:modelValue", value);
|
82
82
|
return _createVNode(Field, _mergeProps({
|
83
|
-
"ref":
|
83
|
+
"ref": fieldRef,
|
84
84
|
"type": "search",
|
85
85
|
"class": bem("field"),
|
86
86
|
"border": false,
|
package/es/slider/Slider.d.ts
CHANGED
@@ -87,9 +87,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
87
87
|
onDragStart?: ((...args: any[]) => any) | undefined;
|
88
88
|
onDragEnd?: ((...args: any[]) => any) | undefined;
|
89
89
|
}, {
|
90
|
+
reverse: boolean;
|
90
91
|
range: boolean;
|
91
92
|
max: string | number;
|
92
|
-
reverse: boolean;
|
93
93
|
disabled: boolean;
|
94
94
|
modelValue: SliderValue;
|
95
95
|
readonly: boolean;
|
package/es/slider/index.d.ts
CHANGED
@@ -56,9 +56,9 @@ export declare const Slider: import("../utils").WithInstall<import("vue").Define
|
|
56
56
|
onDragStart?: ((...args: any[]) => any) | undefined;
|
57
57
|
onDragEnd?: ((...args: any[]) => any) | undefined;
|
58
58
|
}, {
|
59
|
+
reverse: boolean;
|
59
60
|
range: boolean;
|
60
61
|
max: string | number;
|
61
|
-
reverse: boolean;
|
62
62
|
disabled: boolean;
|
63
63
|
modelValue: number | [number, number];
|
64
64
|
readonly: boolean;
|
package/es/stepper/Stepper.mjs
CHANGED
@@ -68,8 +68,8 @@ var stdin_default = defineComponent({
|
|
68
68
|
let actionType;
|
69
69
|
const inputRef = ref();
|
70
70
|
const current = ref(getInitialValue());
|
71
|
-
const minusDisabled = computed(() => props.disabled || props.disableMinus || current.value <= +props.min);
|
72
|
-
const plusDisabled = computed(() => props.disabled || props.disablePlus || current.value >= +props.max);
|
71
|
+
const minusDisabled = computed(() => props.disabled || props.disableMinus || +current.value <= +props.min);
|
72
|
+
const plusDisabled = computed(() => props.disabled || props.disablePlus || +current.value >= +props.max);
|
73
73
|
const inputStyle = computed(() => ({
|
74
74
|
width: addUnit(props.inputWidth),
|
75
75
|
height: addUnit(props.buttonSize)
|