vant 4.3.0 → 4.3.2

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/lib/index.d.ts CHANGED
@@ -101,4 +101,4 @@ declare namespace _default {
101
101
  }
102
102
  export default _default;
103
103
  export function install(app: any): void;
104
- export const version: "4.3.0";
104
+ export const version: "4.3.2";
package/lib/index.js CHANGED
@@ -216,7 +216,7 @@ __reExport(stdin_exports, require("./toast"), module.exports);
216
216
  __reExport(stdin_exports, require("./tree-select"), module.exports);
217
217
  __reExport(stdin_exports, require("./uploader"), module.exports);
218
218
  __reExport(stdin_exports, require("./watermark"), module.exports);
219
- const version = "4.3.0";
219
+ const version = "4.3.2";
220
220
  function install(app) {
221
221
  const components = [
222
222
  import_action_bar.ActionBar,
@@ -6,6 +6,10 @@ export declare const pickerGroupProps: {
6
6
  type: import("vue").PropType<string[]>;
7
7
  default: () => never[];
8
8
  };
9
+ activeTab: {
10
+ type: (NumberConstructor | StringConstructor)[];
11
+ default: number;
12
+ };
9
13
  nextStepText: StringConstructor;
10
14
  } & {
11
15
  title: StringConstructor;
@@ -18,16 +22,24 @@ declare const _default: import("vue").DefineComponent<{
18
22
  type: import("vue").PropType<string[]>;
19
23
  default: () => never[];
20
24
  };
25
+ activeTab: {
26
+ type: (NumberConstructor | StringConstructor)[];
27
+ default: number;
28
+ };
21
29
  nextStepText: StringConstructor;
22
30
  } & {
23
31
  title: StringConstructor;
24
32
  cancelButtonText: StringConstructor;
25
33
  confirmButtonText: StringConstructor;
26
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("cancel" | "confirm")[], "cancel" | "confirm", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
34
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("cancel" | "confirm" | "update:activeTab")[], "cancel" | "confirm" | "update:activeTab", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
27
35
  tabs: {
28
36
  type: import("vue").PropType<string[]>;
29
37
  default: () => never[];
30
38
  };
39
+ activeTab: {
40
+ type: (NumberConstructor | StringConstructor)[];
41
+ default: number;
42
+ };
31
43
  nextStepText: StringConstructor;
32
44
  } & {
33
45
  title: StringConstructor;
@@ -36,7 +48,9 @@ declare const _default: import("vue").DefineComponent<{
36
48
  }>> & {
37
49
  onCancel?: ((...args: any[]) => any) | undefined;
38
50
  onConfirm?: ((...args: any[]) => any) | undefined;
51
+ "onUpdate:activeTab"?: ((...args: any[]) => any) | undefined;
39
52
  }, {
40
53
  tabs: string[];
54
+ activeTab: string | number;
41
55
  }>;
42
56
  export default _default;
@@ -36,6 +36,7 @@ var import_vue = require("vue");
36
36
  var import_vue2 = require("vue");
37
37
  var import_utils = require("../utils");
38
38
  var import_use = require("@vant/use");
39
+ var import_use_sync_prop_ref = require("../composables/use-sync-prop-ref");
39
40
  var import_tab = require("../tab");
40
41
  var import_tabs = require("../tabs");
41
42
  var import_PickerToolbar = __toESM(require("../picker/PickerToolbar"));
@@ -43,26 +44,27 @@ const [name, bem] = (0, import_utils.createNamespace)("picker-group");
43
44
  const PICKER_GROUP_KEY = Symbol(name);
44
45
  const pickerGroupProps = (0, import_utils.extend)({
45
46
  tabs: (0, import_utils.makeArrayProp)(),
47
+ activeTab: (0, import_utils.makeNumericProp)(0),
46
48
  nextStepText: String
47
49
  }, import_PickerToolbar.pickerToolbarProps);
48
50
  var stdin_default = (0, import_vue2.defineComponent)({
49
51
  name,
50
52
  props: pickerGroupProps,
51
- emits: ["confirm", "cancel"],
53
+ emits: ["confirm", "cancel", "update:activeTab"],
52
54
  setup(props, {
53
55
  emit,
54
56
  slots
55
57
  }) {
56
- const activeTab = (0, import_vue2.ref)(0);
58
+ const activeTab = (0, import_use_sync_prop_ref.useSyncPropRef)(() => props.activeTab, (value) => emit("update:activeTab", value));
57
59
  const {
58
60
  children,
59
61
  linkChildren
60
62
  } = (0, import_use.useChildren)(PICKER_GROUP_KEY);
61
63
  linkChildren();
62
- const showNextButton = () => activeTab.value < props.tabs.length - 1 && props.nextStepText;
64
+ const showNextButton = () => +activeTab.value < props.tabs.length - 1 && props.nextStepText;
63
65
  const onConfirm = () => {
64
66
  if (showNextButton()) {
65
- activeTab.value++;
67
+ activeTab.value = +activeTab.value + 1;
66
68
  } else {
67
69
  emit("confirm", children.map((item) => item.confirm()));
68
70
  }
@@ -4,16 +4,24 @@ export declare const PickerGroup: import("../utils").WithInstall<import("vue").D
4
4
  type: import("vue").PropType<string[]>;
5
5
  default: () => never[];
6
6
  };
7
+ activeTab: {
8
+ type: (NumberConstructor | StringConstructor)[];
9
+ default: number;
10
+ };
7
11
  nextStepText: StringConstructor;
8
12
  } & {
9
13
  title: StringConstructor;
10
14
  cancelButtonText: StringConstructor;
11
15
  confirmButtonText: StringConstructor;
12
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("cancel" | "confirm")[], "cancel" | "confirm", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
16
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("cancel" | "confirm" | "update:activeTab")[], "cancel" | "confirm" | "update:activeTab", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
13
17
  tabs: {
14
18
  type: import("vue").PropType<string[]>;
15
19
  default: () => never[];
16
20
  };
21
+ activeTab: {
22
+ type: (NumberConstructor | StringConstructor)[];
23
+ default: number;
24
+ };
17
25
  nextStepText: StringConstructor;
18
26
  } & {
19
27
  title: StringConstructor;
@@ -22,8 +30,10 @@ export declare const PickerGroup: import("../utils").WithInstall<import("vue").D
22
30
  }>> & {
23
31
  onCancel?: ((...args: any[]) => any) | undefined;
24
32
  onConfirm?: ((...args: any[]) => any) | undefined;
33
+ "onUpdate:activeTab"?: ((...args: any[]) => any) | undefined;
25
34
  }, {
26
35
  tabs: string[];
36
+ activeTab: string | number;
27
37
  }>>;
28
38
  export default PickerGroup;
29
39
  export { pickerGroupProps } from './PickerGroup';
@@ -1 +1 @@
1
- :root{--van-step-text-color: var(--van-text-color-2);--van-step-active-color: var(--van-primary-color);--van-step-process-text-color: var(--van-text-color);--van-step-font-size: var(--van-font-size-md);--van-step-line-color: var(--van-border-color);--van-step-finish-line-color: var(--van-primary-color);--van-step-finish-text-color: var(--van-text-color);--van-step-icon-size: 12px;--van-step-circle-size: 5px;--van-step-circle-color: var(--van-gray-6);--van-step-horizontal-title-font-size: var(--van-font-size-sm)}.van-step{position:relative;flex:1;color:var(--van-step-text-color);font-size:var(--van-step-font-size)}.van-step__circle{display:block;width:var(--van-step-circle-size);height:var(--van-step-circle-size);background-color:var(--van-step-circle-color);border-radius:50%}.van-step__line{position:absolute;background-color:var(--van-step-line-color);transition:background-color var(--van-duration-base)}.van-step--horizontal{float:left}.van-step--horizontal:first-child .van-step__title{margin-left:0;transform:none}.van-step--horizontal:last-child{position:absolute;right:1px;width:auto}.van-step--horizontal:last-child .van-step__title{margin-left:0;transform:none}.van-step--horizontal:last-child .van-step__circle-container{right:-9px;left:auto}.van-step--horizontal .van-step__circle-container{position:absolute;top:30px;left:calc(var(--van-padding-xs) * -1);z-index:1;padding:0 var(--van-padding-xs);background-color:var(--van-background-2);transform:translateY(-50%)}.van-step--horizontal .van-step__title{display:inline-block;margin-left:3px;font-size:var(--van-step-horizontal-title-font-size);transform:translate(-50%)}.van-step--horizontal .van-step__line{top:30px;left:0;width:100%;height:1px}.van-step--horizontal .van-step__icon{display:block;font-size:var(--van-step-icon-size)}.van-step--horizontal .van-step--process{color:var(--van-step-process-text-color)}.van-step--vertical{display:block;float:none;padding:10px 10px 10px 0;line-height:var(--van-line-height-sm)}.van-step--vertical:not(:last-child):after{border-bottom-width:1px}.van-step--vertical .van-step__circle-container{position:absolute;top:19px;left:-15px;z-index:1;font-size:var(--van-step-icon-size);line-height:1;transform:translate(-50%,-50%)}.van-step--vertical .van-step__line{top:16px;left:-15px;width:1px;height:100%}.van-step:last-child .van-step__line{width:0}.van-step--finish{color:var(--van-step-finish-text-color)}.van-step--finish .van-step__circle,.van-step--finish .van-step__line{background-color:var(--van-step-finish-line-color)}.van-step__icon,.van-step__title{transition:color var(--van-duration-base)}.van-step__icon--active,.van-step__title--active,.van-step__icon--finish,.van-step__title--finish{color:var(--van-step-active-color)}
1
+ :root{--van-step-text-color: var(--van-text-color-2);--van-step-active-color: var(--van-primary-color);--van-step-process-text-color: var(--van-text-color);--van-step-font-size: var(--van-font-size-md);--van-step-line-color: var(--van-border-color);--van-step-finish-line-color: var(--van-primary-color);--van-step-finish-text-color: var(--van-text-color);--van-step-icon-size: 12px;--van-step-circle-size: 5px;--van-step-circle-color: var(--van-gray-6);--van-step-horizontal-title-font-size: var(--van-font-size-sm)}.van-step{position:relative;flex:1;color:var(--van-step-text-color);font-size:var(--van-step-font-size)}.van-step__circle{display:block;width:var(--van-step-circle-size);height:var(--van-step-circle-size);background-color:var(--van-step-circle-color);border-radius:50%}.van-step__line{position:absolute;background-color:var(--van-step-line-color);transition:background-color var(--van-duration-base)}.van-step--horizontal{float:left}.van-step--horizontal:first-child .van-step__title{margin-left:0;transform:none}.van-step--horizontal:last-child:not(:first-child){position:absolute;right:1px;width:auto}.van-step--horizontal:last-child:not(:first-child) .van-step__title{margin-left:0;transform:none}.van-step--horizontal:last-child:not(:first-child) .van-step__circle-container{right:-9px;left:auto}.van-step--horizontal .van-step__circle-container{position:absolute;top:30px;left:calc(var(--van-padding-xs) * -1);z-index:1;padding:0 var(--van-padding-xs);background-color:var(--van-background-2);transform:translateY(-50%)}.van-step--horizontal .van-step__title{display:inline-block;margin-left:3px;font-size:var(--van-step-horizontal-title-font-size);transform:translate(-50%)}.van-step--horizontal .van-step__line{top:30px;left:0;width:100%;height:1px}.van-step--horizontal .van-step__icon{display:block;font-size:var(--van-step-icon-size)}.van-step--horizontal .van-step--process{color:var(--van-step-process-text-color)}.van-step--vertical{display:block;float:none;padding:10px 10px 10px 0;line-height:var(--van-line-height-sm)}.van-step--vertical:not(:last-child):after{border-bottom-width:1px}.van-step--vertical .van-step__circle-container{position:absolute;top:19px;left:-15px;z-index:1;font-size:var(--van-step-icon-size);line-height:1;transform:translate(-50%,-50%)}.van-step--vertical .van-step__line{top:16px;left:-15px;width:1px;height:100%}.van-step:last-child .van-step__line{width:0}.van-step--finish{color:var(--van-step-finish-text-color)}.van-step--finish .van-step__circle,.van-step--finish .van-step__line{background-color:var(--van-step-finish-line-color)}.van-step__icon,.van-step__title{transition:color var(--van-duration-base)}.van-step__icon--active,.van-step__title--active,.van-step__icon--finish,.van-step__title--finish{color:var(--van-step-active-color)}
@@ -1 +1 @@
1
- :root{--van-submit-bar-height: 50px;--van-submit-bar-z-index: 100;--van-submit-bar-background: var(--van-background-2);--van-submit-bar-button-width: 110px;--van-submit-bar-price-color: var(--van-danger-color);--van-submit-bar-price-font-size: var(--van-font-size-sm);--van-submit-bar-price-integer-font-size: 20px;--van-submit-bar-price-font: var(--van-price-font);--van-submit-bar-currency-font-size: var(--van-font-size-md);--van-submit-bar-text-color: var(--van-text-color);--van-submit-bar-text-font-size: var(--van-font-size-md);--van-submit-bar-tip-padding: var(--van-padding-xs) var(--van-padding-sm);--van-submit-bar-tip-font-size: var(--van-font-size-sm);--van-submit-bar-tip-line-height: 1.5;--van-submit-bar-tip-color: var(--van-orange-dark);--van-submit-bar-tip-background: var(--van-orange-light);--van-submit-bar-tip-icon-size: 12px;--van-submit-bar-button-height: 40px;--van-submit-bar-padding: 0 var(--van-padding-md)}.van-submit-bar{position:fixed;bottom:0;left:0;z-index:var(--van-submit-bar-z-index);width:100%;background:var(--van-submit-bar-background);-webkit-user-select:none;user-select:none}.van-submit-bar__tip{padding:var(--van-submit-bar-tip-padding);color:var(--van-submit-bar-tip-color);font-size:var(--van-submit-bar-tip-font-size);line-height:var(--van-submit-bar-tip-line-height);background:var(--van-submit-bar-tip-background)}.van-submit-bar__tip-icon{margin-right:var(--van-padding-base);font-size:var(--van-submit-bar-tip-icon-size);vertical-align:middle}.van-submit-bar__tip-text{vertical-align:middle}.van-submit-bar__bar{display:flex;align-items:center;justify-content:flex-end;height:var(--van-submit-bar-height);padding:var(--van-submit-bar-padding);font-size:var(--van-submit-bar-text-font-size)}.van-submit-bar__text{flex:1;padding-right:var(--van-padding-sm);color:var(--van-submit-bar-text-color);text-align:right}.van-submit-bar__text span{display:inline-block}.van-submit-bar__suffix-label{margin-left:var(--van-padding-base);font-weight:var(--van-font-bold)}.van-submit-bar__price{color:var(--van-submit-bar-price-color);font-weight:var(--van-font-bold);font-size:var(--van-submit-bar-price-font-size);margin-left:var(--van-padding-base)}.van-submit-bar__price-integer{font-size:var(--van-submit-bar-price-integer-font-size);font-family:var(--van-submit-bar-price-font)}.van-submit-bar__button{width:var(--van-submit-bar-button-width);height:var(--van-submit-bar-button-height);font-weight:var(--van-font-bold);border:none}.van-submit-bar__button--danger{background:var(--van-gradient-red)}
1
+ :root{--van-submit-bar-height: 50px;--van-submit-bar-z-index: 100;--van-submit-bar-background: var(--van-background-2);--van-submit-bar-button-width: 110px;--van-submit-bar-price-color: var(--van-danger-color);--van-submit-bar-price-font-size: var(--van-font-size-sm);--van-submit-bar-price-integer-font-size: 20px;--van-submit-bar-price-font: var(--van-price-font);--van-submit-bar-text-color: var(--van-text-color);--van-submit-bar-text-font-size: var(--van-font-size-md);--van-submit-bar-tip-padding: var(--van-padding-xs) var(--van-padding-sm);--van-submit-bar-tip-font-size: var(--van-font-size-sm);--van-submit-bar-tip-line-height: 1.5;--van-submit-bar-tip-color: var(--van-orange-dark);--van-submit-bar-tip-background: var(--van-orange-light);--van-submit-bar-tip-icon-size: 12px;--van-submit-bar-button-height: 40px;--van-submit-bar-padding: 0 var(--van-padding-md)}.van-submit-bar{position:fixed;bottom:0;left:0;z-index:var(--van-submit-bar-z-index);width:100%;background:var(--van-submit-bar-background);-webkit-user-select:none;user-select:none}.van-submit-bar__tip{padding:var(--van-submit-bar-tip-padding);color:var(--van-submit-bar-tip-color);font-size:var(--van-submit-bar-tip-font-size);line-height:var(--van-submit-bar-tip-line-height);background:var(--van-submit-bar-tip-background)}.van-submit-bar__tip-icon{margin-right:var(--van-padding-base);font-size:var(--van-submit-bar-tip-icon-size);vertical-align:middle}.van-submit-bar__tip-text{vertical-align:middle}.van-submit-bar__bar{display:flex;align-items:center;justify-content:flex-end;height:var(--van-submit-bar-height);padding:var(--van-submit-bar-padding);font-size:var(--van-submit-bar-text-font-size)}.van-submit-bar__text{flex:1;padding-right:var(--van-padding-sm);color:var(--van-submit-bar-text-color);text-align:right}.van-submit-bar__text span{display:inline-block}.van-submit-bar__suffix-label{margin-left:var(--van-padding-base);font-weight:var(--van-font-bold)}.van-submit-bar__price{color:var(--van-submit-bar-price-color);font-weight:var(--van-font-bold);font-size:var(--van-submit-bar-price-font-size);margin-left:var(--van-padding-base)}.van-submit-bar__price-integer{font-size:var(--van-submit-bar-price-integer-font-size);font-family:var(--van-submit-bar-price-font)}.van-submit-bar__button{width:var(--van-submit-bar-button-width);height:var(--van-submit-bar-button-height);font-weight:var(--van-font-bold);border:none}.van-submit-bar__button--danger{background:var(--van-gradient-red)}
package/lib/tabs/Tabs.js CHANGED
@@ -80,6 +80,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
80
80
  let tabHeight;
81
81
  let lockScroll;
82
82
  let stickyFixed;
83
+ let cancelScrollLeftToRaf;
84
+ let cancelScrollTopToRaf;
83
85
  const root = (0, import_vue2.ref)();
84
86
  const navRef = (0, import_vue2.ref)();
85
87
  const wrapRef = (0, import_vue2.ref)();
@@ -127,7 +129,9 @@ var stdin_default = (0, import_vue2.defineComponent)({
127
129
  }
128
130
  const title = titles[state.currentIndex].$el;
129
131
  const to = title.offsetLeft - (nav.offsetWidth - title.offsetWidth) / 2;
130
- (0, import_utils2.scrollLeftTo)(nav, to, immediate ? 0 : +props.duration);
132
+ if (cancelScrollLeftToRaf)
133
+ cancelScrollLeftToRaf();
134
+ cancelScrollLeftToRaf = (0, import_utils2.scrollLeftTo)(nav, to, immediate ? 0 : +props.duration);
131
135
  };
132
136
  const setLine = () => {
133
137
  const shouldAnimate = state.inited;
@@ -203,7 +207,9 @@ var stdin_default = (0, import_vue2.defineComponent)({
203
207
  if (target && scroller.value) {
204
208
  const to = (0, import_utils.getElementTop)(target, scroller.value) - scrollOffset.value;
205
209
  lockScroll = true;
206
- (0, import_utils2.scrollTopTo)(scroller.value, to, immediate ? 0 : +props.duration, () => {
210
+ if (cancelScrollTopToRaf)
211
+ cancelScrollTopToRaf();
212
+ cancelScrollTopToRaf = (0, import_utils2.scrollTopTo)(scroller.value, to, immediate ? 0 : +props.duration, () => {
207
213
  lockScroll = false;
208
214
  });
209
215
  }
@@ -1,3 +1,3 @@
1
1
  import { ScrollElement } from '../utils';
2
- export declare function scrollLeftTo(scroller: HTMLElement, to: number, duration: number): void;
3
- export declare function scrollTopTo(scroller: ScrollElement, to: number, duration: number, callback: () => void): void;
2
+ export declare function scrollLeftTo(scroller: HTMLElement, to: number, duration: number): () => void;
3
+ export declare function scrollTopTo(scroller: ScrollElement, to: number, duration: number, callback: () => void): () => void;
package/lib/tabs/utils.js CHANGED
@@ -24,22 +24,31 @@ module.exports = __toCommonJS(stdin_exports);
24
24
  var import_use = require("@vant/use");
25
25
  var import_utils = require("../utils");
26
26
  function scrollLeftTo(scroller, to, duration) {
27
+ let rafId;
27
28
  let count = 0;
28
29
  const from = scroller.scrollLeft;
29
30
  const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
31
+ function cancel() {
32
+ (0, import_use.cancelRaf)(rafId);
33
+ }
30
34
  function animate() {
31
35
  scroller.scrollLeft += (to - from) / frames;
32
36
  if (++count < frames) {
33
- (0, import_use.raf)(animate);
37
+ rafId = (0, import_use.raf)(animate);
34
38
  }
35
39
  }
36
40
  animate();
41
+ return cancel;
37
42
  }
38
43
  function scrollTopTo(scroller, to, duration, callback) {
44
+ let rafId;
39
45
  let current = (0, import_utils.getScrollTop)(scroller);
40
46
  const isDown = current < to;
41
47
  const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
42
48
  const step = (to - current) / frames;
49
+ function cancel() {
50
+ (0, import_use.cancelRaf)(rafId);
51
+ }
43
52
  function animate() {
44
53
  current += step;
45
54
  if (isDown && current > to || !isDown && current < to) {
@@ -47,10 +56,11 @@ function scrollTopTo(scroller, to, duration, callback) {
47
56
  }
48
57
  (0, import_utils.setScrollTop)(scroller, current);
49
58
  if (isDown && current < to || !isDown && current > to) {
50
- (0, import_use.raf)(animate);
59
+ rafId = (0, import_use.raf)(animate);
51
60
  } else if (callback) {
52
- (0, import_use.raf)(callback);
61
+ rafId = (0, import_use.raf)(callback);
53
62
  }
54
63
  }
55
64
  animate();
65
+ return cancel;
56
66
  }
package/lib/vant.cjs.js CHANGED
@@ -1863,23 +1863,46 @@ var stdin_default$1B = vue.defineComponent({
1863
1863
  }, [slots.toolbar ? slots.toolbar() : [renderCancel(), renderTitle(), renderConfirm()]]);
1864
1864
  }
1865
1865
  });
1866
+ const useSyncPropRef = (getProp, setProp) => {
1867
+ const propRef = vue.ref(getProp());
1868
+ vue.watch(getProp, (value) => {
1869
+ if (value !== propRef.value) {
1870
+ propRef.value = value;
1871
+ }
1872
+ });
1873
+ vue.watch(propRef, (value) => {
1874
+ if (value !== getProp()) {
1875
+ setProp(value);
1876
+ }
1877
+ });
1878
+ return propRef;
1879
+ };
1866
1880
  function scrollLeftTo(scroller, to, duration) {
1881
+ let rafId;
1867
1882
  let count = 0;
1868
1883
  const from = scroller.scrollLeft;
1869
1884
  const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
1885
+ function cancel() {
1886
+ use.cancelRaf(rafId);
1887
+ }
1870
1888
  function animate() {
1871
1889
  scroller.scrollLeft += (to - from) / frames;
1872
1890
  if (++count < frames) {
1873
- use.raf(animate);
1891
+ rafId = use.raf(animate);
1874
1892
  }
1875
1893
  }
1876
1894
  animate();
1895
+ return cancel;
1877
1896
  }
1878
1897
  function scrollTopTo(scroller, to, duration, callback) {
1898
+ let rafId;
1879
1899
  let current2 = getScrollTop(scroller);
1880
1900
  const isDown = current2 < to;
1881
1901
  const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
1882
1902
  const step = (to - current2) / frames;
1903
+ function cancel() {
1904
+ use.cancelRaf(rafId);
1905
+ }
1883
1906
  function animate() {
1884
1907
  current2 += step;
1885
1908
  if (isDown && current2 > to || !isDown && current2 < to) {
@@ -1887,12 +1910,13 @@ function scrollTopTo(scroller, to, duration, callback) {
1887
1910
  }
1888
1911
  setScrollTop(scroller, current2);
1889
1912
  if (isDown && current2 < to || !isDown && current2 > to) {
1890
- use.raf(animate);
1913
+ rafId = use.raf(animate);
1891
1914
  } else if (callback) {
1892
- use.raf(callback);
1915
+ rafId = use.raf(callback);
1893
1916
  }
1894
1917
  }
1895
1918
  animate();
1919
+ return cancel;
1896
1920
  }
1897
1921
  let current = 0;
1898
1922
  function useId() {
@@ -2535,6 +2559,8 @@ var stdin_default$1x = vue.defineComponent({
2535
2559
  let tabHeight;
2536
2560
  let lockScroll;
2537
2561
  let stickyFixed;
2562
+ let cancelScrollLeftToRaf;
2563
+ let cancelScrollTopToRaf;
2538
2564
  const root = vue.ref();
2539
2565
  const navRef = vue.ref();
2540
2566
  const wrapRef = vue.ref();
@@ -2582,7 +2608,9 @@ var stdin_default$1x = vue.defineComponent({
2582
2608
  }
2583
2609
  const title = titles[state.currentIndex].$el;
2584
2610
  const to = title.offsetLeft - (nav.offsetWidth - title.offsetWidth) / 2;
2585
- scrollLeftTo(nav, to, immediate ? 0 : +props.duration);
2611
+ if (cancelScrollLeftToRaf)
2612
+ cancelScrollLeftToRaf();
2613
+ cancelScrollLeftToRaf = scrollLeftTo(nav, to, immediate ? 0 : +props.duration);
2586
2614
  };
2587
2615
  const setLine = () => {
2588
2616
  const shouldAnimate = state.inited;
@@ -2658,7 +2686,9 @@ var stdin_default$1x = vue.defineComponent({
2658
2686
  if (target && scroller.value) {
2659
2687
  const to = getElementTop(target, scroller.value) - scrollOffset.value;
2660
2688
  lockScroll = true;
2661
- scrollTopTo(scroller.value, to, immediate ? 0 : +props.duration, () => {
2689
+ if (cancelScrollTopToRaf)
2690
+ cancelScrollTopToRaf();
2691
+ cancelScrollTopToRaf = scrollTopTo(scroller.value, to, immediate ? 0 : +props.duration, () => {
2662
2692
  lockScroll = false;
2663
2693
  });
2664
2694
  }
@@ -3127,26 +3157,27 @@ const [name$1j, bem$1f] = createNamespace("picker-group");
3127
3157
  const PICKER_GROUP_KEY = Symbol(name$1j);
3128
3158
  const pickerGroupProps = extend({
3129
3159
  tabs: makeArrayProp(),
3160
+ activeTab: makeNumericProp(0),
3130
3161
  nextStepText: String
3131
3162
  }, pickerToolbarProps);
3132
3163
  var stdin_default$1u = vue.defineComponent({
3133
3164
  name: name$1j,
3134
3165
  props: pickerGroupProps,
3135
- emits: ["confirm", "cancel"],
3166
+ emits: ["confirm", "cancel", "update:activeTab"],
3136
3167
  setup(props, {
3137
3168
  emit,
3138
3169
  slots
3139
3170
  }) {
3140
- const activeTab = vue.ref(0);
3171
+ const activeTab = useSyncPropRef(() => props.activeTab, (value) => emit("update:activeTab", value));
3141
3172
  const {
3142
3173
  children,
3143
3174
  linkChildren
3144
3175
  } = use.useChildren(PICKER_GROUP_KEY);
3145
3176
  linkChildren();
3146
- const showNextButton = () => activeTab.value < props.tabs.length - 1 && props.nextStepText;
3177
+ const showNextButton = () => +activeTab.value < props.tabs.length - 1 && props.nextStepText;
3147
3178
  const onConfirm = () => {
3148
3179
  if (showNextButton()) {
3149
- activeTab.value++;
3180
+ activeTab.value = +activeTab.value + 1;
3150
3181
  } else {
3151
3182
  emit("confirm", children.map((item) => item.confirm()));
3152
3183
  }
@@ -4314,6 +4345,10 @@ var stdin_default$1p = vue.defineComponent({
4314
4345
  return vue.createVNode("label", {
4315
4346
  "id": `${id}-label`,
4316
4347
  "for": getInputId(),
4348
+ "onClick": (event) => {
4349
+ preventDefault(event);
4350
+ focus();
4351
+ },
4317
4352
  "style": labelAlign === "top" && labelWidth ? {
4318
4353
  width: addUnit(labelWidth)
4319
4354
  } : void 0
@@ -5242,7 +5277,19 @@ var stdin_default$1i = vue.defineComponent({
5242
5277
  return props.parent.props[name2];
5243
5278
  }
5244
5279
  };
5245
- const disabled = vue.computed(() => getParentProp("disabled") || props.disabled);
5280
+ const disabled = vue.computed(() => {
5281
+ if (props.parent && props.bindGroup) {
5282
+ const disabled2 = getParentProp("disabled") || props.disabled;
5283
+ if (props.role === "checkbox") {
5284
+ const checkedCount = getParentProp("modelValue").length;
5285
+ const max = getParentProp("max");
5286
+ const overlimit = max && checkedCount >= +max;
5287
+ return disabled2 || overlimit && !props.checked;
5288
+ }
5289
+ return disabled2;
5290
+ }
5291
+ return props.disabled;
5292
+ });
5246
5293
  const direction = vue.computed(() => getParentProp("direction"));
5247
5294
  const iconStyle = vue.computed(() => {
5248
5295
  const checkedColor = props.checkedColor || getParentProp("checkedColor");
@@ -9606,6 +9653,10 @@ var stdin_default$M = vue.defineComponent({
9606
9653
  });
9607
9654
  const GridItem = withInstall(stdin_default$M);
9608
9655
  const getDistance = (touches) => Math.sqrt((touches[0].clientX - touches[1].clientX) ** 2 + (touches[0].clientY - touches[1].clientY) ** 2);
9656
+ const getCenter = (touches) => ({
9657
+ x: (touches[0].clientX + touches[1].clientX) / 2,
9658
+ y: (touches[0].clientY + touches[1].clientY) / 2
9659
+ });
9609
9660
  const bem$C = createNamespace("image-preview")[1];
9610
9661
  var stdin_default$L = vue.defineComponent({
9611
9662
  props: {
@@ -9634,6 +9685,7 @@ var stdin_default$L = vue.defineComponent({
9634
9685
  displayHeight: 0
9635
9686
  });
9636
9687
  const touch = useTouch();
9688
+ const imageRef = vue.ref();
9637
9689
  const swipeItem = vue.ref();
9638
9690
  const vertical = vue.computed(() => {
9639
9691
  const {
@@ -9655,9 +9707,7 @@ var stdin_default$L = vue.defineComponent({
9655
9707
  transitionDuration: zooming || moving ? "0s" : ".3s"
9656
9708
  };
9657
9709
  if (scale !== 1) {
9658
- const offsetX = moveX / scale;
9659
- const offsetY = moveY / scale;
9660
- style.transform = `scale(${scale}, ${scale}) translate(${offsetX}px, ${offsetY}px)`;
9710
+ style.transform = `matrix(${scale}, 0, 0, ${scale}, ${moveX}, ${moveY})`;
9661
9711
  }
9662
9712
  return style;
9663
9713
  });
@@ -9683,10 +9733,26 @@ var stdin_default$L = vue.defineComponent({
9683
9733
  }
9684
9734
  return 0;
9685
9735
  });
9686
- const setScale = (scale) => {
9736
+ const setScale = (scale, center) => {
9737
+ var _a;
9687
9738
  scale = clamp(scale, +props.minZoom, +props.maxZoom + 1);
9688
9739
  if (scale !== state.scale) {
9740
+ const ratio = scale / state.scale;
9689
9741
  state.scale = scale;
9742
+ if (center) {
9743
+ const imageRect = use.useRect((_a = imageRef.value) == null ? void 0 : _a.$el);
9744
+ const origin = {
9745
+ x: imageRect.width * 0.5,
9746
+ y: imageRect.height * 0.5
9747
+ };
9748
+ const moveX = state.moveX - (center.x - imageRect.left - origin.x) * (ratio - 1);
9749
+ const moveY = state.moveY - (center.y - imageRect.top - origin.y) * (ratio - 1);
9750
+ state.moveX = clamp(moveX, -maxMoveX.value, maxMoveX.value);
9751
+ state.moveY = clamp(moveY, -maxMoveY.value, maxMoveY.value);
9752
+ } else {
9753
+ state.moveX = 0;
9754
+ state.moveY = 0;
9755
+ }
9690
9756
  emit("scale", {
9691
9757
  scale,
9692
9758
  index: props.active
@@ -9695,20 +9761,20 @@ var stdin_default$L = vue.defineComponent({
9695
9761
  };
9696
9762
  const resetScale = () => {
9697
9763
  setScale(1);
9698
- state.moveX = 0;
9699
- state.moveY = 0;
9700
9764
  };
9701
9765
  const toggleScale = () => {
9702
9766
  const scale = state.scale > 1 ? 1 : 2;
9703
- setScale(scale);
9704
- state.moveX = 0;
9705
- state.moveY = 0;
9767
+ setScale(scale, scale === 2 ? {
9768
+ x: touch.startX.value,
9769
+ y: touch.startY.value
9770
+ } : void 0);
9706
9771
  };
9707
9772
  let fingerNum;
9708
9773
  let startMoveX;
9709
9774
  let startMoveY;
9710
9775
  let startScale;
9711
9776
  let startDistance;
9777
+ let lastCenter;
9712
9778
  let doubleTapTimer;
9713
9779
  let touchStartTime;
9714
9780
  let isImageMoved = false;
@@ -9732,7 +9798,7 @@ var stdin_default$L = vue.defineComponent({
9732
9798
  state.zooming = fingerNum === 2 && !offsetX.value;
9733
9799
  if (state.zooming) {
9734
9800
  startScale = state.scale;
9735
- startDistance = getDistance(event.touches);
9801
+ startDistance = getDistance(touches);
9736
9802
  }
9737
9803
  };
9738
9804
  const onTouchMove = (event) => {
@@ -9761,7 +9827,8 @@ var stdin_default$L = vue.defineComponent({
9761
9827
  if (touches.length === 2) {
9762
9828
  const distance = getDistance(touches);
9763
9829
  const scale = startScale * distance / startDistance;
9764
- setScale(scale);
9830
+ lastCenter = getCenter(touches);
9831
+ setScale(scale, lastCenter);
9765
9832
  }
9766
9833
  }
9767
9834
  };
@@ -9815,7 +9882,7 @@ var stdin_default$L = vue.defineComponent({
9815
9882
  }
9816
9883
  const maxZoom = +props.maxZoom;
9817
9884
  if (state.scale > maxZoom) {
9818
- state.scale = maxZoom;
9885
+ setScale(maxZoom, lastCenter);
9819
9886
  }
9820
9887
  }
9821
9888
  }
@@ -9860,6 +9927,7 @@ var stdin_default$L = vue.defineComponent({
9860
9927
  }, [slots.image({
9861
9928
  src: props.src
9862
9929
  })]) : vue.createVNode(Image$1, {
9930
+ "ref": imageRef,
9863
9931
  "src": props.src,
9864
9932
  "fit": "contain",
9865
9933
  "class": bem$C("image", {
@@ -11390,20 +11458,6 @@ var stdin_default$A = vue.defineComponent({
11390
11458
  });
11391
11459
  const PasswordInput = withInstall(stdin_default$A);
11392
11460
  const PickerGroup = withInstall(stdin_default$1u);
11393
- const useSyncPropRef = (getProp, setProp) => {
11394
- const propRef = vue.ref(getProp());
11395
- vue.watch(getProp, (value) => {
11396
- if (value !== propRef.value) {
11397
- propRef.value = value;
11398
- }
11399
- });
11400
- vue.watch(propRef, (value) => {
11401
- if (value !== getProp()) {
11402
- setProp(value);
11403
- }
11404
- });
11405
- return propRef;
11406
- };
11407
11461
  const [name$r, bem$q] = createNamespace("popover");
11408
11462
  const popupProps = ["overlay", "duration", "teleport", "overlayStyle", "overlayClass", "closeOnClickOverlay"];
11409
11463
  const popoverProps = {
@@ -15525,7 +15579,7 @@ const Lazyload = {
15525
15579
  });
15526
15580
  }
15527
15581
  };
15528
- const version = "4.3.0";
15582
+ const version = "4.3.2";
15529
15583
  function install(app) {
15530
15584
  const components = [
15531
15585
  ActionBar,