vant 3.5.1 → 3.5.4
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/LICENSE +10 -0
- package/README.md +13 -13
- package/changelog.generated.md +54 -0
- package/es/action-bar/ActionBar.d.ts +4 -0
- package/es/action-bar/ActionBar.mjs +13 -2
- package/es/action-bar/index.d.ts +3 -0
- package/es/button/index.less +1 -1
- package/es/calendar/Calendar.mjs +3 -1
- package/es/calendar/types.d.ts +1 -0
- package/es/cell/Cell.d.ts +1 -1
- package/es/cell/index.d.ts +1 -1
- package/es/collapse/Collapse.d.ts +8 -1
- package/es/collapse/Collapse.mjs +28 -1
- package/es/collapse/index.d.ts +1 -1
- package/es/collapse-item/CollapseItem.d.ts +1 -1
- package/es/collapse-item/CollapseItem.mjs +3 -1
- package/es/collapse-item/index.d.ts +1 -1
- package/es/collapse-item/index.less +1 -1
- package/es/composables/use-height.d.ts +1 -1
- package/es/composables/use-height.mjs +6 -2
- package/es/composables/use-placeholder.mjs +1 -1
- package/es/dialog/Dialog.d.ts +1 -1
- package/es/field/Field.d.ts +4 -2
- package/es/field/Field.mjs +7 -1
- package/es/field/index.d.ts +4 -2
- package/es/field/index.less +1 -1
- package/es/grid-item/index.less +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/locale/index.d.ts +1 -1
- package/es/popover/Popover.mjs +17 -18
- package/es/sidebar-item/index.less +1 -1
- package/es/submit-bar/SubmitBar.d.ts +4 -0
- package/es/submit-bar/SubmitBar.mjs +13 -2
- package/es/submit-bar/index.d.ts +3 -0
- package/es/swipe/index.less +1 -1
- package/es/switch/index.less +1 -1
- package/es/toast/index.less +1 -1
- package/es/uploader/Uploader.mjs +1 -1
- package/es/utils/basic.d.ts +3 -3
- package/es/utils/create.d.ts +1 -1
- package/lib/action-bar/ActionBar.d.ts +4 -0
- package/lib/action-bar/ActionBar.js +12 -1
- package/lib/action-bar/index.d.ts +3 -0
- package/lib/button/index.less +1 -1
- package/lib/calendar/Calendar.js +3 -1
- package/lib/calendar/types.d.ts +1 -0
- package/lib/cell/Cell.d.ts +1 -1
- package/lib/cell/index.d.ts +1 -1
- package/lib/collapse/Collapse.d.ts +8 -1
- package/lib/collapse/Collapse.js +28 -1
- package/lib/collapse/index.d.ts +1 -1
- package/lib/collapse-item/CollapseItem.d.ts +1 -1
- package/lib/collapse-item/CollapseItem.js +3 -1
- package/lib/collapse-item/index.d.ts +1 -1
- package/lib/collapse-item/index.less +1 -1
- package/lib/composables/use-height.d.ts +1 -1
- package/lib/composables/use-height.js +6 -2
- package/lib/composables/use-placeholder.js +1 -1
- package/lib/dialog/Dialog.d.ts +1 -1
- package/lib/field/Field.d.ts +4 -2
- package/lib/field/Field.js +7 -1
- package/lib/field/index.d.ts +4 -2
- package/lib/field/index.less +1 -1
- package/lib/grid-item/index.less +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/locale/index.d.ts +1 -1
- package/lib/popover/Popover.js +17 -18
- package/lib/sidebar-item/index.less +1 -1
- package/lib/submit-bar/SubmitBar.d.ts +4 -0
- package/lib/submit-bar/SubmitBar.js +12 -1
- package/lib/submit-bar/index.d.ts +3 -0
- package/lib/swipe/index.less +1 -1
- package/lib/switch/index.less +1 -1
- package/lib/toast/index.less +1 -1
- package/lib/uploader/Uploader.js +1 -1
- package/lib/utils/basic.d.ts +3 -3
- package/lib/utils/create.d.ts +1 -1
- package/lib/vant.cjs.js +182 -50
- package/lib/vant.es.js +271 -49
- package/lib/vant.js +107 -48
- package/lib/vant.min.js +1 -1
- package/{vetur → lib}/web-types.json +1346 -1312
- package/package.json +9 -14
- package/lib/ssr.js +0 -7
- package/lib/ssr.mjs +0 -1
- package/lib/vant.cjs.min.js +0 -1
- package/lib/vant.es.min.js +0 -14667
- package/vetur/attributes.json +0 -3474
- package/vetur/tags.json +0 -1202
package/lib/vant.js
CHANGED
@@ -352,7 +352,7 @@
|
|
352
352
|
}
|
353
353
|
return { width, height };
|
354
354
|
}
|
355
|
-
var overflowScrollReg = /scroll|auto/i;
|
355
|
+
var overflowScrollReg = /scroll|auto|overlay/i;
|
356
356
|
var defaultRoot = inBrowser ? window : void 0;
|
357
357
|
function isElement$1(node) {
|
358
358
|
const ELEMENT_NODE_TYPE = 1;
|
@@ -747,9 +747,34 @@
|
|
747
747
|
};
|
748
748
|
return options;
|
749
749
|
}
|
750
|
+
const useHeight = (element, withSafeArea) => {
|
751
|
+
const height2 = vue.ref();
|
752
|
+
const setHeight = () => {
|
753
|
+
height2.value = useRect(element).height;
|
754
|
+
};
|
755
|
+
vue.onMounted(() => {
|
756
|
+
vue.nextTick(setHeight);
|
757
|
+
if (withSafeArea) {
|
758
|
+
for (let i = 1; i <= 3; i++) {
|
759
|
+
setTimeout(setHeight, 100 * i);
|
760
|
+
}
|
761
|
+
}
|
762
|
+
});
|
763
|
+
return height2;
|
764
|
+
};
|
765
|
+
function usePlaceholder(contentRef, bem2) {
|
766
|
+
const height2 = useHeight(contentRef, true);
|
767
|
+
return (renderContent) => vue.createVNode("div", {
|
768
|
+
"class": bem2("placeholder"),
|
769
|
+
"style": {
|
770
|
+
height: height2.value ? `${height2.value}px` : void 0
|
771
|
+
}
|
772
|
+
}, [renderContent()]);
|
773
|
+
}
|
750
774
|
const [name$1u, bem$1q] = createNamespace("action-bar");
|
751
775
|
const ACTION_BAR_KEY = Symbol(name$1u);
|
752
776
|
const actionBarProps = {
|
777
|
+
placeholder: Boolean,
|
753
778
|
safeAreaInsetBottom: truthProp
|
754
779
|
};
|
755
780
|
var stdin_default$1B = vue.defineComponent({
|
@@ -758,18 +783,27 @@
|
|
758
783
|
setup(props, {
|
759
784
|
slots
|
760
785
|
}) {
|
786
|
+
const root = vue.ref();
|
787
|
+
const renderPlaceholder = usePlaceholder(root, bem$1q);
|
761
788
|
const {
|
762
789
|
linkChildren
|
763
790
|
} = useChildren(ACTION_BAR_KEY);
|
764
791
|
linkChildren();
|
765
|
-
|
792
|
+
const renderActionBar = () => {
|
766
793
|
var _a;
|
767
794
|
return vue.createVNode("div", {
|
795
|
+
"ref": root,
|
768
796
|
"class": [bem$1q(), {
|
769
797
|
"van-safe-area-bottom": props.safeAreaInsetBottom
|
770
798
|
}]
|
771
799
|
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
772
800
|
};
|
801
|
+
return () => {
|
802
|
+
if (props.placeholder) {
|
803
|
+
return renderPlaceholder(renderActionBar);
|
804
|
+
}
|
805
|
+
return renderActionBar();
|
806
|
+
};
|
773
807
|
}
|
774
808
|
});
|
775
809
|
const ActionBar = withInstall(stdin_default$1B);
|
@@ -2969,7 +3003,7 @@
|
|
2969
3003
|
var stdin_default$1l = vue.defineComponent({
|
2970
3004
|
name: name$1e,
|
2971
3005
|
props: fieldProps,
|
2972
|
-
emits: ["blur", "focus", "clear", "keypress", "click-input", "click-left-icon", "click-right-icon", "update:modelValue"],
|
3006
|
+
emits: ["blur", "focus", "clear", "keypress", "click-input", "end-validate", "start-validate", "click-left-icon", "click-right-icon", "update:modelValue"],
|
2973
3007
|
setup(props, {
|
2974
3008
|
emit,
|
2975
3009
|
slots
|
@@ -3043,18 +3077,24 @@
|
|
3043
3077
|
state.status = "unvalidated";
|
3044
3078
|
state.validateMessage = "";
|
3045
3079
|
};
|
3080
|
+
const endValidate = () => emit("end-validate", {
|
3081
|
+
status: state.status
|
3082
|
+
});
|
3046
3083
|
const validate = (rules = props.rules) => new Promise((resolve) => {
|
3047
3084
|
resetValidation();
|
3048
3085
|
if (rules) {
|
3086
|
+
emit("start-validate");
|
3049
3087
|
runRules(rules).then(() => {
|
3050
3088
|
if (state.status === "failed") {
|
3051
3089
|
resolve({
|
3052
3090
|
name: props.name,
|
3053
3091
|
message: state.validateMessage
|
3054
3092
|
});
|
3093
|
+
endValidate();
|
3055
3094
|
} else {
|
3056
3095
|
state.status = "passed";
|
3057
3096
|
resolve();
|
3097
|
+
endValidate();
|
3058
3098
|
}
|
3059
3099
|
});
|
3060
3100
|
} else {
|
@@ -4599,17 +4639,6 @@
|
|
4599
4639
|
}
|
4600
4640
|
});
|
4601
4641
|
};
|
4602
|
-
const useHeight = (element) => {
|
4603
|
-
const height2 = vue.ref();
|
4604
|
-
const setHeight = () => {
|
4605
|
-
height2.value = useRect(element).height;
|
4606
|
-
};
|
4607
|
-
vue.onMounted(() => {
|
4608
|
-
vue.nextTick(setHeight);
|
4609
|
-
setTimeout(setHeight, 100);
|
4610
|
-
});
|
4611
|
-
return height2;
|
4612
|
-
};
|
4613
4642
|
const [name$13] = createNamespace("calendar-day");
|
4614
4643
|
var stdin_default$1a = vue.defineComponent({
|
4615
4644
|
name: name$13,
|
@@ -5102,6 +5131,7 @@
|
|
5102
5131
|
}
|
5103
5132
|
return !currentDate.value;
|
5104
5133
|
});
|
5134
|
+
const getSelectedDate = () => currentDate.value;
|
5105
5135
|
const onScroll = () => {
|
5106
5136
|
const top2 = getScrollTop(bodyRef.value);
|
5107
5137
|
const bottom2 = top2 + bodyHeight;
|
@@ -5344,7 +5374,8 @@
|
|
5344
5374
|
});
|
5345
5375
|
useExpose({
|
5346
5376
|
reset,
|
5347
|
-
scrollToDate
|
5377
|
+
scrollToDate,
|
5378
|
+
getSelectedDate
|
5348
5379
|
});
|
5349
5380
|
onMountedOrActivated(init);
|
5350
5381
|
return () => {
|
@@ -7484,7 +7515,8 @@
|
|
7484
7515
|
slots
|
7485
7516
|
}) {
|
7486
7517
|
const {
|
7487
|
-
linkChildren
|
7518
|
+
linkChildren,
|
7519
|
+
children
|
7488
7520
|
} = useChildren(COLLAPSE_KEY);
|
7489
7521
|
const updateName = (name2) => {
|
7490
7522
|
emit("change", name2);
|
@@ -7503,6 +7535,28 @@
|
|
7503
7535
|
updateName(modelValue.filter((activeName) => activeName !== name2));
|
7504
7536
|
}
|
7505
7537
|
};
|
7538
|
+
const toggleAll = (options = {}) => {
|
7539
|
+
if (props.accordion) {
|
7540
|
+
return;
|
7541
|
+
}
|
7542
|
+
if (typeof options === "boolean") {
|
7543
|
+
options = {
|
7544
|
+
expanded: options
|
7545
|
+
};
|
7546
|
+
}
|
7547
|
+
const {
|
7548
|
+
expanded,
|
7549
|
+
skipDisabled
|
7550
|
+
} = options;
|
7551
|
+
const expandedChildren = children.filter((item) => {
|
7552
|
+
if (item.disabled && skipDisabled) {
|
7553
|
+
return item.expanded.value;
|
7554
|
+
}
|
7555
|
+
return expanded != null ? expanded : !item.expanded.value;
|
7556
|
+
});
|
7557
|
+
const names = expandedChildren.map((item) => item.itemName.value);
|
7558
|
+
updateName(names);
|
7559
|
+
};
|
7506
7560
|
const isExpanded = (name2) => {
|
7507
7561
|
const {
|
7508
7562
|
accordion,
|
@@ -7510,6 +7564,9 @@
|
|
7510
7564
|
} = props;
|
7511
7565
|
return accordion ? modelValue === name2 : modelValue.includes(name2);
|
7512
7566
|
};
|
7567
|
+
useExpose({
|
7568
|
+
toggleAll
|
7569
|
+
});
|
7513
7570
|
linkChildren({
|
7514
7571
|
toggle,
|
7515
7572
|
isExpanded
|
@@ -7635,7 +7692,9 @@
|
|
7635
7692
|
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]), [[vue.vShow, show.value]]);
|
7636
7693
|
});
|
7637
7694
|
useExpose({
|
7638
|
-
toggle
|
7695
|
+
toggle,
|
7696
|
+
expanded,
|
7697
|
+
itemName: name2
|
7639
7698
|
});
|
7640
7699
|
return () => vue.createVNode("div", {
|
7641
7700
|
"class": [bem$K({
|
@@ -10586,15 +10645,6 @@
|
|
10586
10645
|
}
|
10587
10646
|
});
|
10588
10647
|
const List = withInstall(stdin_default$v);
|
10589
|
-
function usePlaceholder(contentRef, bem2) {
|
10590
|
-
const height2 = useHeight(contentRef);
|
10591
|
-
return (renderContent) => vue.createVNode("div", {
|
10592
|
-
"class": bem2("placeholder"),
|
10593
|
-
"style": {
|
10594
|
-
height: height2.value ? `${height2.value}px` : void 0
|
10595
|
-
}
|
10596
|
-
}, [renderContent()]);
|
10597
|
-
}
|
10598
10648
|
const [name$p, bem$p] = createNamespace("nav-bar");
|
10599
10649
|
const navBarProps = {
|
10600
10650
|
title: String,
|
@@ -12387,22 +12437,23 @@
|
|
12387
12437
|
let popper;
|
12388
12438
|
const wrapperRef = vue.ref();
|
12389
12439
|
const popoverRef = vue.ref();
|
12440
|
+
const getPopoverOptions = () => ({
|
12441
|
+
placement: props.placement,
|
12442
|
+
modifiers: [{
|
12443
|
+
name: "computeStyles",
|
12444
|
+
options: {
|
12445
|
+
adaptive: false,
|
12446
|
+
gpuAcceleration: false
|
12447
|
+
}
|
12448
|
+
}, extend({}, offset_default, {
|
12449
|
+
options: {
|
12450
|
+
offset: props.offset
|
12451
|
+
}
|
12452
|
+
})]
|
12453
|
+
});
|
12390
12454
|
const createPopperInstance = () => {
|
12391
12455
|
if (wrapperRef.value && popoverRef.value) {
|
12392
|
-
return createPopper(wrapperRef.value, popoverRef.value.popupRef.value,
|
12393
|
-
placement: props.placement,
|
12394
|
-
modifiers: [{
|
12395
|
-
name: "computeStyles",
|
12396
|
-
options: {
|
12397
|
-
adaptive: false,
|
12398
|
-
gpuAcceleration: false
|
12399
|
-
}
|
12400
|
-
}, extend({}, offset_default, {
|
12401
|
-
options: {
|
12402
|
-
offset: props.offset
|
12403
|
-
}
|
12404
|
-
})]
|
12405
|
-
});
|
12456
|
+
return createPopper(wrapperRef.value, popoverRef.value.popupRef.value, getPopoverOptions());
|
12406
12457
|
}
|
12407
12458
|
return null;
|
12408
12459
|
};
|
@@ -12414,9 +12465,7 @@
|
|
12414
12465
|
if (!popper) {
|
12415
12466
|
popper = createPopperInstance();
|
12416
12467
|
} else {
|
12417
|
-
popper.setOptions(
|
12418
|
-
placement: props.placement
|
12419
|
-
});
|
12468
|
+
popper.setOptions(getPopoverOptions());
|
12420
12469
|
}
|
12421
12470
|
});
|
12422
12471
|
};
|
@@ -12487,7 +12536,7 @@
|
|
12487
12536
|
popper = null;
|
12488
12537
|
}
|
12489
12538
|
});
|
12490
|
-
vue.watch(() => [props.show, props.placement], updateLocation);
|
12539
|
+
vue.watch(() => [props.show, props.offset, props.placement], updateLocation);
|
12491
12540
|
useClickAway(wrapperRef, onClickAway, {
|
12492
12541
|
eventName: "touchstart"
|
12493
12542
|
});
|
@@ -14039,6 +14088,7 @@
|
|
14039
14088
|
buttonType: makeStringProp("danger"),
|
14040
14089
|
buttonColor: String,
|
14041
14090
|
suffixLabel: String,
|
14091
|
+
placeholder: Boolean,
|
14042
14092
|
decimalLength: makeNumericProp(2),
|
14043
14093
|
safeAreaInsetBottom: truthProp
|
14044
14094
|
};
|
@@ -14050,6 +14100,8 @@
|
|
14050
14100
|
emit,
|
14051
14101
|
slots
|
14052
14102
|
}) {
|
14103
|
+
const root = vue.ref();
|
14104
|
+
const renderPlaceholder = usePlaceholder(root, bem$5);
|
14053
14105
|
const renderText = () => {
|
14054
14106
|
const {
|
14055
14107
|
price,
|
@@ -14109,9 +14161,10 @@
|
|
14109
14161
|
"onClick": onClickButton
|
14110
14162
|
}, null);
|
14111
14163
|
};
|
14112
|
-
|
14164
|
+
const renderSubmitBar = () => {
|
14113
14165
|
var _a, _b;
|
14114
14166
|
return vue.createVNode("div", {
|
14167
|
+
"ref": root,
|
14115
14168
|
"class": [bem$5(), {
|
14116
14169
|
"van-safe-area-bottom": props.safeAreaInsetBottom
|
14117
14170
|
}]
|
@@ -14119,6 +14172,12 @@
|
|
14119
14172
|
"class": bem$5("bar")
|
14120
14173
|
}, [(_b = slots.default) == null ? void 0 : _b.call(slots), renderText(), renderButton()])]);
|
14121
14174
|
};
|
14175
|
+
return () => {
|
14176
|
+
if (props.placeholder) {
|
14177
|
+
return renderPlaceholder(renderSubmitBar);
|
14178
|
+
}
|
14179
|
+
return renderSubmitBar();
|
14180
|
+
};
|
14122
14181
|
}
|
14123
14182
|
});
|
14124
14183
|
const SubmitBar = withInstall(stdin_default$a);
|
@@ -14867,7 +14926,7 @@
|
|
14867
14926
|
if (props.previewFullImage) {
|
14868
14927
|
const imageFiles = props.modelValue.filter(isImageFile);
|
14869
14928
|
const images = imageFiles.map((item2) => {
|
14870
|
-
if (item2.file && !item2.url) {
|
14929
|
+
if (item2.file && !item2.url && item2.status !== "failed") {
|
14871
14930
|
item2.url = URL.createObjectURL(item2.file);
|
14872
14931
|
urls.push(item2.url);
|
14873
14932
|
}
|
@@ -15811,7 +15870,7 @@
|
|
15811
15870
|
});
|
15812
15871
|
}
|
15813
15872
|
};
|
15814
|
-
const version = "3.5.
|
15873
|
+
const version = "3.5.4";
|
15815
15874
|
function install(app) {
|
15816
15875
|
const components = [
|
15817
15876
|
ActionBar,
|
@@ -15998,7 +16057,7 @@
|
|
15998
16057
|
exports2.Toast = Toast;
|
15999
16058
|
exports2.TreeSelect = TreeSelect;
|
16000
16059
|
exports2.Uploader = Uploader;
|
16001
|
-
exports2
|
16060
|
+
exports2.default = stdin_default;
|
16002
16061
|
exports2.install = install;
|
16003
16062
|
exports2.version = version;
|
16004
16063
|
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|