vant 4.1.2 → 4.2.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.
Files changed (71) hide show
  1. package/es/index.d.ts +2 -1
  2. package/es/index.mjs +5 -2
  3. package/es/pagination/Pagination.d.ts +26 -0
  4. package/es/pagination/Pagination.mjs +14 -4
  5. package/es/pagination/index.css +1 -1
  6. package/es/pagination/index.d.ts +18 -0
  7. package/es/picker/Picker.d.ts +2 -1
  8. package/es/picker/Picker.mjs +16 -6
  9. package/es/picker/PickerColumn.d.ts +2 -1
  10. package/es/picker/PickerColumn.mjs +10 -4
  11. package/es/picker/index.d.ts +2 -1
  12. package/es/share-sheet/ShareSheet.mjs +11 -10
  13. package/es/sticky/Sticky.mjs +20 -4
  14. package/es/swipe/Swipe.mjs +1 -1
  15. package/es/tab/Tab.mjs +24 -6
  16. package/es/{tabs/TabsTitle.d.ts → tab/TabTitle.d.ts} +1 -2
  17. package/es/{tabs/TabsTitle.mjs → tab/TabTitle.mjs} +2 -2
  18. package/es/tabs/Tabs.d.ts +1 -1
  19. package/es/tabs/Tabs.mjs +15 -30
  20. package/es/tabs/index.d.ts +1 -1
  21. package/es/tabs/style/index.mjs +0 -1
  22. package/es/tabs/types.d.ts +3 -1
  23. package/es/text-ellipsis/TextEllipsis.d.ts +13 -0
  24. package/es/text-ellipsis/TextEllipsis.mjs +4 -3
  25. package/es/text-ellipsis/index.d.ts +9 -0
  26. package/es/watermark/Watermark.d.ts +112 -0
  27. package/es/watermark/Watermark.mjs +133 -0
  28. package/es/watermark/index.css +1 -0
  29. package/es/watermark/index.d.ts +83 -0
  30. package/es/watermark/index.mjs +10 -0
  31. package/es/watermark/style/index.d.ts +1 -0
  32. package/es/watermark/style/index.mjs +2 -0
  33. package/lib/index.css +1 -1
  34. package/lib/index.d.ts +2 -1
  35. package/lib/index.js +5 -2
  36. package/lib/pagination/Pagination.d.ts +26 -0
  37. package/lib/pagination/Pagination.js +13 -3
  38. package/lib/pagination/index.css +1 -1
  39. package/lib/pagination/index.d.ts +18 -0
  40. package/lib/picker/Picker.d.ts +2 -1
  41. package/lib/picker/Picker.js +16 -6
  42. package/lib/picker/PickerColumn.d.ts +2 -1
  43. package/lib/picker/PickerColumn.js +9 -3
  44. package/lib/picker/index.d.ts +2 -1
  45. package/lib/share-sheet/ShareSheet.js +11 -10
  46. package/lib/sticky/Sticky.js +18 -2
  47. package/lib/swipe/Swipe.js +1 -1
  48. package/lib/tab/Tab.js +21 -3
  49. package/lib/{tabs/TabsTitle.d.ts → tab/TabTitle.d.ts} +1 -2
  50. package/lib/{tabs/TabsTitle.js → tab/TabTitle.js} +2 -2
  51. package/lib/tabs/Tabs.d.ts +1 -1
  52. package/lib/tabs/Tabs.js +13 -28
  53. package/lib/tabs/index.d.ts +1 -1
  54. package/lib/tabs/style/index.js +0 -1
  55. package/lib/tabs/types.d.ts +3 -1
  56. package/lib/text-ellipsis/TextEllipsis.d.ts +13 -0
  57. package/lib/text-ellipsis/TextEllipsis.js +4 -3
  58. package/lib/text-ellipsis/index.d.ts +9 -0
  59. package/lib/vant.cjs.js +1158 -981
  60. package/lib/vant.es.js +1160 -983
  61. package/lib/vant.js +1159 -982
  62. package/lib/vant.min.js +1 -1
  63. package/lib/watermark/Watermark.d.ts +112 -0
  64. package/lib/watermark/Watermark.js +152 -0
  65. package/lib/watermark/index.css +1 -0
  66. package/lib/watermark/index.d.ts +83 -0
  67. package/lib/watermark/index.js +39 -0
  68. package/lib/watermark/style/index.d.ts +1 -0
  69. package/lib/watermark/style/index.js +2 -0
  70. package/lib/web-types.json +1 -1
  71. package/package.json +1 -1
package/es/index.d.ts CHANGED
@@ -93,10 +93,11 @@ export * from "./time-picker";
93
93
  export * from "./toast";
94
94
  export * from "./tree-select";
95
95
  export * from "./uploader";
96
+ export * from "./watermark";
96
97
  declare namespace _default {
97
98
  export { install };
98
99
  export { version };
99
100
  }
100
101
  export default _default;
101
102
  export function install(app: any): void;
102
- export const version: "4.1.2";
103
+ export const version: "4.2.1";
package/es/index.mjs CHANGED
@@ -92,7 +92,8 @@ 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.2";
95
+ import { Watermark } from "./watermark/index.mjs";
96
+ const version = "4.2.1";
96
97
  function install(app) {
97
98
  const components = [
98
99
  ActionBar,
@@ -188,7 +189,8 @@ function install(app) {
188
189
  TimePicker,
189
190
  Toast,
190
191
  TreeSelect,
191
- Uploader
192
+ Uploader,
193
+ Watermark
192
194
  ];
193
195
  components.forEach((item) => {
194
196
  if (item.install) {
@@ -293,6 +295,7 @@ export * from "./time-picker/index.mjs";
293
295
  export * from "./toast/index.mjs";
294
296
  export * from "./tree-select/index.mjs";
295
297
  export * from "./uploader/index.mjs";
298
+ export * from "./watermark/index.mjs";
296
299
  var stdin_default = {
297
300
  install,
298
301
  version
@@ -28,6 +28,14 @@ export declare const paginationProps: {
28
28
  default: number;
29
29
  };
30
30
  forceEllipses: BooleanConstructor;
31
+ showPrevButton: {
32
+ type: BooleanConstructor;
33
+ default: true;
34
+ };
35
+ showNextButton: {
36
+ type: BooleanConstructor;
37
+ default: true;
38
+ };
31
39
  };
32
40
  export type PaginationProps = ExtractPropTypes<typeof paginationProps>;
33
41
  declare const _default: import("vue").DefineComponent<{
@@ -58,6 +66,14 @@ declare const _default: import("vue").DefineComponent<{
58
66
  default: number;
59
67
  };
60
68
  forceEllipses: BooleanConstructor;
69
+ showPrevButton: {
70
+ type: BooleanConstructor;
71
+ default: true;
72
+ };
73
+ showNextButton: {
74
+ type: BooleanConstructor;
75
+ default: true;
76
+ };
61
77
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "change")[], "update:modelValue" | "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
62
78
  mode: {
63
79
  type: import("vue").PropType<PaginationMode>;
@@ -86,6 +102,14 @@ declare const _default: import("vue").DefineComponent<{
86
102
  default: number;
87
103
  };
88
104
  forceEllipses: BooleanConstructor;
105
+ showPrevButton: {
106
+ type: BooleanConstructor;
107
+ default: true;
108
+ };
109
+ showNextButton: {
110
+ type: BooleanConstructor;
111
+ default: true;
112
+ };
89
113
  }>> & {
90
114
  onChange?: ((...args: any[]) => any) | undefined;
91
115
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
@@ -97,5 +121,7 @@ declare const _default: import("vue").DefineComponent<{
97
121
  showPageSize: string | number;
98
122
  itemsPerPage: string | number;
99
123
  forceEllipses: boolean;
124
+ showPrevButton: boolean;
125
+ showNextButton: boolean;
100
126
  }>;
101
127
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import { createVNode as _createVNode } from "vue";
2
2
  import { computed, watchEffect, defineComponent } from "vue";
3
- import { clamp, makeStringProp, makeNumberProp, makeNumericProp, createNamespace, BORDER_SURROUND } from "../utils/index.mjs";
3
+ import { clamp, truthProp, makeStringProp, makeNumberProp, makeNumericProp, createNamespace, BORDER_SURROUND } from "../utils/index.mjs";
4
4
  const [name, bem, t] = createNamespace("pagination");
5
5
  const makePage = (number, text, active) => ({
6
6
  number,
@@ -16,7 +16,9 @@ const paginationProps = {
16
16
  totalItems: makeNumericProp(0),
17
17
  showPageSize: makeNumericProp(5),
18
18
  itemsPerPage: makeNumericProp(10),
19
- forceEllipses: Boolean
19
+ forceEllipses: Boolean,
20
+ showPrevButton: truthProp,
21
+ showNextButton: truthProp
20
22
  };
21
23
  var stdin_default = defineComponent({
22
24
  name,
@@ -86,8 +88,12 @@ var stdin_default = defineComponent({
86
88
  const renderPrevButton = () => {
87
89
  const {
88
90
  mode,
89
- modelValue
91
+ modelValue,
92
+ showPrevButton
90
93
  } = props;
94
+ if (!showPrevButton) {
95
+ return;
96
+ }
91
97
  const slot = slots["prev-text"];
92
98
  const disabled = modelValue === 1;
93
99
  return _createVNode("li", {
@@ -105,8 +111,12 @@ var stdin_default = defineComponent({
105
111
  const renderNextButton = () => {
106
112
  const {
107
113
  mode,
108
- modelValue
114
+ modelValue,
115
+ showNextButton
109
116
  } = props;
117
+ if (!showNextButton) {
118
+ return;
119
+ }
110
120
  const slot = slots["next-text"];
111
121
  const disabled = modelValue === count.value;
112
122
  return _createVNode("li", {
@@ -1 +1 @@
1
- :root{--van-pagination-height: 40px;--van-pagination-font-size: var(--van-font-size-md);--van-pagination-item-width: 36px;--van-pagination-item-default-color: var(--van-primary-color);--van-pagination-item-disabled-color: var(--van-gray-7);--van-pagination-item-disabled-background: var(--van-background);--van-pagination-background: var(--van-background-2);--van-pagination-desc-color: var(--van-gray-7);--van-pagination-disabled-opacity: var(--van-disabled-opacity)}.van-pagination{font-size:var(--van-pagination-font-size)}.van-pagination__items{display:flex}.van-pagination__item,.van-pagination__page-desc{display:flex;align-items:center;justify-content:center}.van-pagination__item{flex:1;box-sizing:border-box;min-width:var(--van-pagination-item-width);height:var(--van-pagination-height);color:var(--van-pagination-item-default-color);background:var(--van-pagination-background);cursor:pointer;-webkit-user-select:none;user-select:none}.van-pagination__item button{flex:1;height:100%;border:none;padding:0;background:transparent}.van-pagination__item button[disabled]{cursor:not-allowed}.van-pagination__item:active{color:var(--van-white);background-color:var(--van-pagination-item-default-color)}.van-pagination__item:not(:last-child):after{border-right-width:0}.van-pagination__item--active{color:var(--van-white);background-color:var(--van-pagination-item-default-color)}.van-pagination__item--page{flex-grow:0}.van-pagination__item--prev,.van-pagination__item--next{padding:0 var(--van-padding-base);cursor:pointer}.van-pagination__item--border:after{border-width:var(--van-border-width)}.van-pagination__item--disabled{color:var(--van-pagination-item-disabled-color);background-color:var(--van-pagination-item-disabled-background);opacity:var(--van-pagination-disabled-opacity)}.van-pagination__page-desc{flex:1;height:var(--van-pagination-height);color:var(--van-pagination-desc-color)}
1
+ :root{--van-pagination-height: 40px;--van-pagination-font-size: var(--van-font-size-md);--van-pagination-item-width: 36px;--van-pagination-item-default-color: var(--van-primary-color);--van-pagination-item-disabled-color: var(--van-gray-7);--van-pagination-item-disabled-background: var(--van-background);--van-pagination-background: var(--van-background-2);--van-pagination-desc-color: var(--van-gray-7);--van-pagination-disabled-opacity: var(--van-disabled-opacity)}.van-pagination{font-size:var(--van-pagination-font-size)}.van-pagination__items{display:flex}.van-pagination__item,.van-pagination__page-desc{display:flex;align-items:center;justify-content:center}.van-pagination__item{flex:1;box-sizing:border-box;min-width:var(--van-pagination-item-width);height:var(--van-pagination-height);color:var(--van-pagination-item-default-color);background:var(--van-pagination-background);cursor:pointer;-webkit-user-select:none;user-select:none}.van-pagination__item button{flex:1;height:100%;border:none;padding:0;background:transparent}.van-pagination__item button[disabled]{cursor:not-allowed}.van-pagination__item:active{color:var(--van-white);background-color:var(--van-pagination-item-default-color)}.van-pagination__item:not(:last-child):after{border-right-width:0}.van-pagination__item--active{color:var(--van-white);background-color:var(--van-pagination-item-default-color)}.van-pagination__item--page{flex-grow:0}.van-pagination__item--prev,.van-pagination__item--next{padding:0 var(--van-padding-base);cursor:pointer}.van-pagination__item--border:after{border-width:var(--van-border-width)}.van-pagination__item--disabled,.van-pagination__item--disabled:active{color:var(--van-pagination-item-disabled-color);background-color:var(--van-pagination-item-disabled-background);opacity:var(--van-pagination-disabled-opacity)}.van-pagination__page-desc{flex:1;height:var(--van-pagination-height);color:var(--van-pagination-desc-color)}
@@ -26,6 +26,14 @@ export declare const Pagination: import("../utils").WithInstall<import("vue").De
26
26
  default: number;
27
27
  };
28
28
  forceEllipses: BooleanConstructor;
29
+ showPrevButton: {
30
+ type: BooleanConstructor;
31
+ default: true;
32
+ };
33
+ showNextButton: {
34
+ type: BooleanConstructor;
35
+ default: true;
36
+ };
29
37
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "change")[], "update:modelValue" | "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
30
38
  mode: {
31
39
  type: import("vue").PropType<import("./Pagination").PaginationMode>;
@@ -54,6 +62,14 @@ export declare const Pagination: import("../utils").WithInstall<import("vue").De
54
62
  default: number;
55
63
  };
56
64
  forceEllipses: BooleanConstructor;
65
+ showPrevButton: {
66
+ type: BooleanConstructor;
67
+ default: true;
68
+ };
69
+ showNextButton: {
70
+ type: BooleanConstructor;
71
+ default: true;
72
+ };
57
73
  }>> & {
58
74
  onChange?: ((...args: any[]) => any) | undefined;
59
75
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
@@ -65,6 +81,8 @@ export declare const Pagination: import("../utils").WithInstall<import("vue").De
65
81
  showPageSize: string | number;
66
82
  itemsPerPage: string | number;
67
83
  forceEllipses: boolean;
84
+ showPrevButton: boolean;
85
+ showNextButton: boolean;
68
86
  }>>;
69
87
  export default Pagination;
70
88
  export { paginationProps } from './Pagination';
@@ -104,7 +104,7 @@ declare const _default: import("vue").DefineComponent<{
104
104
  default: PickerToolbarPosition;
105
105
  };
106
106
  columnsFieldNames: PropType<PickerFieldNames>;
107
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "cancel" | "change" | "clickOption" | "confirm")[], "update:modelValue" | "cancel" | "change" | "clickOption" | "confirm", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
107
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "cancel" | "change" | "clickOption" | "scrollInto" | "confirm")[], "update:modelValue" | "cancel" | "change" | "clickOption" | "scrollInto" | "confirm", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
108
108
  loading: BooleanConstructor;
109
109
  readonly: BooleanConstructor;
110
110
  allowHtml: BooleanConstructor;
@@ -147,6 +147,7 @@ declare const _default: import("vue").DefineComponent<{
147
147
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
148
148
  onCancel?: ((...args: any[]) => any) | undefined;
149
149
  onClickOption?: ((...args: any[]) => any) | undefined;
150
+ onScrollInto?: ((...args: any[]) => any) | undefined;
150
151
  onConfirm?: ((...args: any[]) => any) | undefined;
151
152
  }, {
152
153
  modelValue: Numeric[];
@@ -26,7 +26,7 @@ const pickerProps = extend({}, pickerSharedProps, {
26
26
  var stdin_default = defineComponent({
27
27
  name,
28
28
  props: pickerProps,
29
- emits: ["confirm", "cancel", "change", "clickOption", "update:modelValue"],
29
+ emits: ["confirm", "cancel", "change", "scrollInto", "clickOption", "update:modelValue"],
30
30
  setup(props, {
31
31
  emit,
32
32
  slots
@@ -88,10 +88,14 @@ var stdin_default = defineComponent({
88
88
  }, getEventParams()));
89
89
  });
90
90
  };
91
- const onClickOption = (currentOption, columnIndex) => emit("clickOption", extend({
92
- columnIndex,
93
- currentOption
94
- }, getEventParams()));
91
+ const onClickOption = (currentOption, columnIndex) => {
92
+ const params = {
93
+ columnIndex,
94
+ currentOption
95
+ };
96
+ emit("clickOption", extend(getEventParams(), params));
97
+ emit("scrollInto", params);
98
+ };
95
99
  const confirm = () => {
96
100
  children.forEach((child) => child.stopMomentum());
97
101
  const params = getEventParams();
@@ -111,7 +115,13 @@ var stdin_default = defineComponent({
111
115
  "swipeDuration": props.swipeDuration,
112
116
  "visibleOptionNum": props.visibleOptionNum,
113
117
  "onChange": (value) => onChange(value, columnIndex),
114
- "onClickOption": (option) => onClickOption(option, columnIndex)
118
+ "onClickOption": (option) => onClickOption(option, columnIndex),
119
+ "onScrollInto": (option) => {
120
+ emit("scrollInto", {
121
+ currentOption: option,
122
+ columnIndex
123
+ });
124
+ }
115
125
  }, {
116
126
  option: slots.option
117
127
  }));
@@ -25,7 +25,7 @@ declare const _default: import("vue").DefineComponent<{
25
25
  type: (NumberConstructor | StringConstructor)[];
26
26
  required: true;
27
27
  };
28
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "clickOption")[], "change" | "clickOption", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
28
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "clickOption" | "scrollInto")[], "change" | "clickOption" | "scrollInto", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
29
29
  value: (NumberConstructor | StringConstructor)[];
30
30
  fields: {
31
31
  type: PropType<Required<PickerFieldNames>>;
@@ -52,6 +52,7 @@ declare const _default: import("vue").DefineComponent<{
52
52
  }>> & {
53
53
  onChange?: ((...args: any[]) => any) | undefined;
54
54
  onClickOption?: ((...args: any[]) => any) | undefined;
55
+ onScrollInto?: ((...args: any[]) => any) | undefined;
55
56
  }, {
56
57
  readonly: boolean;
57
58
  allowHtml: boolean;
@@ -1,5 +1,5 @@
1
1
  import { createVNode as _createVNode } from "vue";
2
- import { ref, watchEffect, defineComponent } from "vue";
2
+ import { ref, computed, watchEffect, defineComponent } from "vue";
3
3
  import { clamp, numericProp, makeArrayProp, preventDefault, createNamespace, makeRequiredProp } from "../utils/index.mjs";
4
4
  import { getElementTranslateY, findIndexOfEnabledOption } from "./utils.mjs";
5
5
  import { useEventListener, useParent } from "@vant/use";
@@ -22,7 +22,7 @@ var stdin_default = defineComponent({
22
22
  swipeDuration: makeRequiredProp(numericProp),
23
23
  visibleOptionNum: makeRequiredProp(numericProp)
24
24
  },
25
- emits: ["change", "clickOption"],
25
+ emits: ["change", "clickOption", "scrollInto"],
26
26
  setup(props, {
27
27
  emit,
28
28
  slots
@@ -66,6 +66,7 @@ var stdin_default = defineComponent({
66
66
  emit("clickOption", props.options[index]);
67
67
  };
68
68
  const getIndexByOffset = (offset) => clamp(Math.round(-offset / props.optionHeight), 0, count() - 1);
69
+ const currentIndex = computed(() => getIndexByOffset(currentOffset.value));
69
70
  const momentum = (distance, duration) => {
70
71
  const speed = Math.abs(distance / duration);
71
72
  distance = currentOffset.value + speed / 3e-3 * (distance < 0 ? -1 : 1);
@@ -105,11 +106,16 @@ var stdin_default = defineComponent({
105
106
  moving = true;
106
107
  preventDefault(event, true);
107
108
  }
108
- currentOffset.value = clamp(startOffset + touch.deltaY.value, -(count() * props.optionHeight), props.optionHeight);
109
+ const newOffset = clamp(startOffset + touch.deltaY.value, -(count() * props.optionHeight), props.optionHeight);
110
+ const newIndex = getIndexByOffset(newOffset);
111
+ if (newIndex !== currentIndex.value) {
112
+ emit("scrollInto", props.options[newIndex]);
113
+ }
114
+ currentOffset.value = newOffset;
109
115
  const now = Date.now();
110
116
  if (now - touchStartTime > MOMENTUM_TIME) {
111
117
  touchStartTime = now;
112
- momentumOffset = currentOffset.value;
118
+ momentumOffset = newOffset;
113
119
  }
114
120
  };
115
121
  const onTouchEnd = () => {
@@ -37,7 +37,7 @@ export declare const Picker: import("../utils").WithInstall<import("vue").Define
37
37
  default: import("./types").PickerToolbarPosition;
38
38
  };
39
39
  columnsFieldNames: import("vue").PropType<import("./types").PickerFieldNames>;
40
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "cancel" | "change" | "clickOption" | "confirm")[], "update:modelValue" | "cancel" | "change" | "clickOption" | "confirm", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
40
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "cancel" | "change" | "clickOption" | "scrollInto" | "confirm")[], "update:modelValue" | "cancel" | "change" | "clickOption" | "scrollInto" | "confirm", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
41
41
  loading: BooleanConstructor;
42
42
  readonly: BooleanConstructor;
43
43
  allowHtml: BooleanConstructor;
@@ -80,6 +80,7 @@ export declare const Picker: import("../utils").WithInstall<import("vue").Define
80
80
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
81
81
  onCancel?: ((...args: any[]) => any) | undefined;
82
82
  onClickOption?: ((...args: any[]) => any) | undefined;
83
+ onScrollInto?: ((...args: any[]) => any) | undefined;
83
84
  onConfirm?: ((...args: any[]) => any) | undefined;
84
85
  }, {
85
86
  modelValue: import("../utils").Numeric[];
@@ -4,6 +4,7 @@ import { pick, extend, truthProp, makeArrayProp, createNamespace, HAPTICS_FEEDBA
4
4
  import { popupSharedProps, popupSharedPropKeys } from "../popup/shared.mjs";
5
5
  import { Icon } from "../icon/index.mjs";
6
6
  import { Popup } from "../popup/index.mjs";
7
+ const isImage = (name2) => name2 == null ? void 0 : name2.includes("/");
7
8
  const popupInheritKeys = [...popupSharedPropKeys, "round", "closeOnPopstate", "safeAreaInsetBottom"];
8
9
  const iconMap = {
9
10
  qq: "qq",
@@ -53,17 +54,17 @@ var stdin_default = defineComponent({
53
54
  }
54
55
  };
55
56
  const renderIcon = (icon) => {
56
- if (iconMap[icon]) {
57
- return _createVNode("div", {
58
- "class": bem("icon", [icon])
59
- }, [_createVNode(Icon, {
60
- "name": iconMap[icon] || icon
61
- }, null)]);
57
+ if (isImage(icon)) {
58
+ return _createVNode("img", {
59
+ "src": icon,
60
+ "class": bem("image-icon")
61
+ }, null);
62
62
  }
63
- return _createVNode("img", {
64
- "src": icon,
65
- "class": bem("image-icon")
66
- }, null);
63
+ return _createVNode("div", {
64
+ "class": bem("icon", [icon])
65
+ }, [_createVNode(Icon, {
66
+ "name": iconMap[icon] || icon
67
+ }, null)]);
67
68
  };
68
69
  const renderOption = (option, index) => {
69
70
  const {
@@ -1,6 +1,6 @@
1
1
  import { createVNode as _createVNode } from "vue";
2
- import { ref, watch, computed, reactive, defineComponent } from "vue";
3
- import { extend, isHidden, unitToPx, numericProp, getScrollTop, getZIndexStyle, makeStringProp, makeNumericProp, createNamespace } from "../utils/index.mjs";
2
+ import { ref, watch, computed, nextTick, reactive, defineComponent } from "vue";
3
+ import { extend, isHidden, unitToPx, numericProp, windowWidth, windowHeight, getScrollTop, getZIndexStyle, makeStringProp, makeNumericProp, createNamespace } from "../utils/index.mjs";
4
4
  import { useRect, useEventListener, useScrollParent } from "@vant/use";
5
5
  import { useVisibilityChange } from "../composables/use-visibility-change.mjs";
6
6
  const [name, bem] = createNamespace("sticky");
@@ -29,8 +29,12 @@ var stdin_default = defineComponent({
29
29
  // root height
30
30
  transform: 0
31
31
  });
32
+ const isReset = ref(false);
32
33
  const offset = computed(() => unitToPx(props.position === "top" ? props.offsetTop : props.offsetBottom));
33
34
  const rootStyle = computed(() => {
35
+ if (isReset.value) {
36
+ return;
37
+ }
34
38
  const {
35
39
  fixed,
36
40
  height,
@@ -44,7 +48,7 @@ var stdin_default = defineComponent({
44
48
  }
45
49
  });
46
50
  const stickyStyle = computed(() => {
47
- if (!state.fixed) {
51
+ if (!state.fixed || isReset.value) {
48
52
  return;
49
53
  }
50
54
  const style = extend(getZIndexStyle(props.zIndex), {
@@ -103,6 +107,18 @@ var stdin_default = defineComponent({
103
107
  passive: true
104
108
  });
105
109
  useVisibilityChange(root, onScroll);
110
+ watch([windowWidth, windowHeight], () => {
111
+ if (!root.value || isHidden(root) || !state.fixed) {
112
+ return;
113
+ }
114
+ isReset.value = true;
115
+ nextTick(() => {
116
+ const rootRect = useRect(root);
117
+ state.width = rootRect.width;
118
+ state.height = rootRect.height;
119
+ isReset.value = false;
120
+ });
121
+ });
106
122
  return () => {
107
123
  var _a;
108
124
  return _createVNode("div", {
@@ -110,7 +126,7 @@ var stdin_default = defineComponent({
110
126
  "style": rootStyle.value
111
127
  }, [_createVNode("div", {
112
128
  "class": bem({
113
- fixed: state.fixed
129
+ fixed: state.fixed && !isReset.value
114
130
  }),
115
131
  "style": stickyStyle.value
116
132
  }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]);
@@ -336,7 +336,7 @@ var stdin_default = defineComponent({
336
336
  watch(() => props.initialSwipe, (value) => initialize(+value));
337
337
  watch(count, () => initialize(state.active));
338
338
  watch(() => props.autoplay, autoplay);
339
- watch([windowWidth, windowHeight], resize);
339
+ watch([windowWidth, windowHeight, () => props.width, () => props.height], resize);
340
340
  watch(usePageVisibility(), (visible) => {
341
341
  if (visible === "visible") {
342
342
  autoplay();
package/es/tab/Tab.mjs CHANGED
@@ -1,12 +1,13 @@
1
- import { withDirectives as _withDirectives, vShow as _vShow, createVNode as _createVNode } from "vue";
2
- import { ref, watch, provide, computed, nextTick, defineComponent } from "vue";
3
- import { extend, truthProp, unknownProp, numericProp, createNamespace } from "../utils/index.mjs";
1
+ import { withDirectives as _withDirectives, vShow as _vShow, createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
2
+ import { ref, watch, provide, computed, nextTick, defineComponent, getCurrentInstance } from "vue";
3
+ import { pick, extend, truthProp, unknownProp, numericProp, createNamespace } from "../utils/index.mjs";
4
4
  import { TABS_KEY } from "../tabs/Tabs.mjs";
5
5
  import { doubleRaf, useParent } from "@vant/use";
6
6
  import { useId } from "../composables/use-id.mjs";
7
7
  import { useExpose } from "../composables/use-expose.mjs";
8
8
  import { routeProps } from "../composables/use-route.mjs";
9
9
  import { TAB_STATUS_KEY } from "../composables/use-tab-status.mjs";
10
+ import { TabTitle } from "./TabTitle.mjs";
10
11
  import { SwipeItem } from "../swipe-item/index.mjs";
11
12
  const [name, bem] = createNamespace("tab");
12
13
  const tabProps = extend({}, routeProps, {
@@ -27,6 +28,7 @@ var stdin_default = defineComponent({
27
28
  }) {
28
29
  const id = useId();
29
30
  const inited = ref(false);
31
+ const instance = getCurrentInstance();
30
32
  const {
31
33
  parent,
32
34
  index
@@ -56,6 +58,21 @@ var stdin_default = defineComponent({
56
58
  }
57
59
  return isActive;
58
60
  });
61
+ const renderTitle = (onClickTab) => _createVNode(TabTitle, _mergeProps({
62
+ "key": id,
63
+ "id": `${parent.id}-${index.value}`,
64
+ "ref": parent.setTitleRefs(index.value),
65
+ "style": props.titleStyle,
66
+ "class": props.titleClass,
67
+ "isActive": active.value,
68
+ "controls": id,
69
+ "scrollable": parent.scrollable.value,
70
+ "activeColor": parent.props.titleActiveColor,
71
+ "inactiveColor": parent.props.titleInactiveColor,
72
+ "onClick": (event) => onClickTab(instance.proxy, index.value, event)
73
+ }, pick(parent.props, ["type", "color", "shrink"]), pick(props, ["dot", "badge", "title", "disabled", "showZeroBadge"])), {
74
+ title: slots.title
75
+ });
59
76
  const hasInactiveClass = ref(!active.value);
60
77
  watch(active, (val) => {
61
78
  if (val) {
@@ -71,6 +88,10 @@ var stdin_default = defineComponent({
71
88
  parent.scrollIntoView();
72
89
  });
73
90
  provide(TAB_STATUS_KEY, active);
91
+ useExpose({
92
+ id,
93
+ renderTitle
94
+ });
74
95
  return () => {
75
96
  var _a;
76
97
  const label = `${parent.id}-${index.value}`;
@@ -105,9 +126,6 @@ var stdin_default = defineComponent({
105
126
  }
106
127
  const shouldRender = inited.value || scrollspy || !lazyRender;
107
128
  const Content = shouldRender ? (_a = slots.default) == null ? void 0 : _a.call(slots) : null;
108
- useExpose({
109
- id
110
- });
111
129
  return _withDirectives(_createVNode("div", {
112
130
  "id": id,
113
131
  "role": "tabpanel",
@@ -1,4 +1,4 @@
1
- declare const _default: import("vue").DefineComponent<{
1
+ export declare const TabTitle: import("vue").DefineComponent<{
2
2
  id: StringConstructor;
3
3
  dot: BooleanConstructor;
4
4
  type: StringConstructor;
@@ -42,4 +42,3 @@ declare const _default: import("vue").DefineComponent<{
42
42
  scrollable: boolean;
43
43
  showZeroBadge: boolean;
44
44
  }>;
45
- export default _default;
@@ -3,7 +3,7 @@ import { computed, defineComponent } from "vue";
3
3
  import { isDef, truthProp, numericProp, createNamespace } from "../utils/index.mjs";
4
4
  import { Badge } from "../badge/index.mjs";
5
5
  const [name, bem] = createNamespace("tab");
6
- var stdin_default = defineComponent({
6
+ const TabTitle = defineComponent({
7
7
  name,
8
8
  props: {
9
9
  id: String,
@@ -86,5 +86,5 @@ var stdin_default = defineComponent({
86
86
  }
87
87
  });
88
88
  export {
89
- stdin_default as default
89
+ TabTitle
90
90
  };
package/es/tabs/Tabs.d.ts CHANGED
@@ -145,9 +145,9 @@ declare const _default: import("vue").DefineComponent<{
145
145
  duration: string | number;
146
146
  lazyRender: boolean;
147
147
  offsetTop: string | number;
148
- shrink: boolean;
149
148
  animated: boolean;
150
149
  swipeable: boolean;
150
+ shrink: boolean;
151
151
  scrollspy: boolean;
152
152
  swipeThreshold: string | number;
153
153
  }>;
package/es/tabs/Tabs.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
1
+ import { createVNode as _createVNode } from "vue";
2
2
  import { ref, watch, computed, reactive, nextTick, onActivated, defineComponent } from "vue";
3
- import { pick, isDef, addUnit, isHidden, unitToPx, truthProp, numericProp, windowWidth, getElementTop, makeStringProp, callInterceptor, createNamespace, makeNumericProp, setRootScrollTop, BORDER_TOP_BOTTOM } from "../utils/index.mjs";
3
+ import { isDef, addUnit, isHidden, unitToPx, truthProp, numericProp, windowWidth, getElementTop, makeStringProp, callInterceptor, createNamespace, makeNumericProp, setRootScrollTop, BORDER_TOP_BOTTOM } from "../utils/index.mjs";
4
4
  import { scrollLeftTo, scrollTopTo } from "./utils.mjs";
5
5
  import { useRect, useChildren, useScrollParent, useEventListener, onMountedOrActivated } from "@vant/use";
6
6
  import { useId } from "../composables/use-id.mjs";
@@ -10,7 +10,6 @@ import { useExpose } from "../composables/use-expose.mjs";
10
10
  import { onPopupReopen } from "../composables/on-popup-reopen.mjs";
11
11
  import { useVisibilityChange } from "../composables/use-visibility-change.mjs";
12
12
  import { Sticky } from "../sticky/index.mjs";
13
- import TabsTitle from "./TabsTitle.mjs";
14
13
  import TabsContent from "./TabsContent.mjs";
15
14
  const [name, bem] = createNamespace("tabs");
16
15
  const tabsProps = {
@@ -226,24 +225,6 @@ var stdin_default = defineComponent({
226
225
  setCurrentIndex(index);
227
226
  }
228
227
  };
229
- const renderNav = () => children.map((item, index) => _createVNode(TabsTitle, _mergeProps({
230
- "key": item.id,
231
- "id": `${id}-${index}`,
232
- "ref": setTitleRefs(index),
233
- "type": props.type,
234
- "color": props.color,
235
- "style": item.titleStyle,
236
- "class": item.titleClass,
237
- "shrink": props.shrink,
238
- "isActive": index === state.currentIndex,
239
- "controls": item.id,
240
- "scrollable": scrollable.value,
241
- "activeColor": props.titleActiveColor,
242
- "inactiveColor": props.titleInactiveColor,
243
- "onClick": (event) => onClickTab(item, index, event)
244
- }, pick(item, ["dot", "badge", "title", "disabled", "showZeroBadge"])), {
245
- title: item.$slots.title
246
- }));
247
228
  const renderLine = () => {
248
229
  if (props.type === "line" && children.length) {
249
230
  return _createVNode("div", {
@@ -273,7 +254,7 @@ var stdin_default = defineComponent({
273
254
  }]),
274
255
  "style": navStyle.value,
275
256
  "aria-orientation": "horizontal"
276
- }, [(_a = slots["nav-left"]) == null ? void 0 : _a.call(slots), renderNav(), renderLine(), (_b = slots["nav-right"]) == null ? void 0 : _b.call(slots)])]), (_c = slots["nav-bottom"]) == null ? void 0 : _c.call(slots)];
257
+ }, [(_a = slots["nav-left"]) == null ? void 0 : _a.call(slots), children.map((item) => item.renderTitle(onClickTab)), renderLine(), (_b = slots["nav-right"]) == null ? void 0 : _b.call(slots)])]), (_c = slots["nav-bottom"]) == null ? void 0 : _c.call(slots)];
277
258
  if (sticky) {
278
259
  return _createVNode("div", {
279
260
  "ref": wrapRef
@@ -281,7 +262,16 @@ var stdin_default = defineComponent({
281
262
  }
282
263
  return Header;
283
264
  };
284
- watch([() => props.color, windowWidth], setLine);
265
+ const resize = () => {
266
+ setLine();
267
+ nextTick(() => {
268
+ var _a, _b;
269
+ scrollIntoView(true);
270
+ (_b = (_a = contentRef.value) == null ? void 0 : _a.swipeRef.value) == null ? void 0 : _b.resize();
271
+ });
272
+ };
273
+ watch(() => [props.color, props.duration, props.lineWidth, props.lineHeight], setLine);
274
+ watch(windowWidth, resize);
285
275
  watch(() => props.active, (value) => {
286
276
  if (value !== currentName.value) {
287
277
  setCurrentIndexByName(value);
@@ -307,13 +297,6 @@ var stdin_default = defineComponent({
307
297
  });
308
298
  };
309
299
  const onRendered = (name2, title) => emit("rendered", name2, title);
310
- const resize = () => {
311
- setLine();
312
- nextTick(() => {
313
- var _a, _b;
314
- return (_b = (_a = contentRef.value) == null ? void 0 : _a.swipeRef.value) == null ? void 0 : _b.resize();
315
- });
316
- };
317
300
  useExpose({
318
301
  resize,
319
302
  scrollTo
@@ -330,8 +313,10 @@ var stdin_default = defineComponent({
330
313
  id,
331
314
  props,
332
315
  setLine,
316
+ scrollable,
333
317
  onRendered,
334
318
  currentName,
319
+ setTitleRefs,
335
320
  scrollIntoView
336
321
  });
337
322
  return () => _createVNode("div", {
@@ -98,9 +98,9 @@ export declare const Tabs: import("../utils").WithInstall<import("vue").DefineCo
98
98
  duration: string | number;
99
99
  lazyRender: boolean;
100
100
  offsetTop: string | number;
101
- shrink: boolean;
102
101
  animated: boolean;
103
102
  swipeable: boolean;
103
+ shrink: boolean;
104
104
  scrollspy: boolean;
105
105
  swipeThreshold: string | number;
106
106
  }>>;
@@ -1,5 +1,4 @@
1
1
  import "../../style/base.css";
2
- import "../../badge/index.css";
3
2
  import "../../sticky/index.css";
4
3
  import "../../swipe/index.css";
5
4
  import "../index.css";