vant 4.9.1 → 4.9.3

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 (68) hide show
  1. package/es/action-bar-button/ActionBarButton.d.ts +3 -3
  2. package/es/action-bar-button/index.d.ts +2 -2
  3. package/es/action-bar-icon/ActionBarIcon.d.ts +3 -3
  4. package/es/action-bar-icon/index.d.ts +2 -2
  5. package/es/button/Button.d.ts +3 -3
  6. package/es/button/index.d.ts +2 -2
  7. package/es/calendar/CalendarHeader.mjs +5 -17
  8. package/es/calendar/utils.mjs +6 -0
  9. package/es/card/Card.mjs +3 -3
  10. package/es/cell/Cell.d.ts +3 -3
  11. package/es/cell/index.d.ts +2 -2
  12. package/es/composables/use-route.d.ts +1 -2
  13. package/es/form/Form.d.ts +3 -0
  14. package/es/form/Form.mjs +9 -2
  15. package/es/form/index.d.ts +2 -0
  16. package/es/grid-item/GridItem.d.ts +3 -3
  17. package/es/grid-item/index.d.ts +2 -2
  18. package/es/index.d.ts +1 -1
  19. package/es/index.mjs +1 -1
  20. package/es/notify/types.d.ts +3 -0
  21. package/es/sidebar-item/SidebarItem.d.ts +3 -3
  22. package/es/sidebar-item/index.d.ts +2 -2
  23. package/es/tab/Tab.d.ts +3 -3
  24. package/es/tab/index.d.ts +2 -2
  25. package/es/tabbar-item/TabbarItem.d.ts +3 -3
  26. package/es/tabbar-item/index.d.ts +2 -2
  27. package/es/tabs/utils.mjs +3 -1
  28. package/es/text-ellipsis/TextEllipsis.mjs +56 -46
  29. package/es/uploader/Uploader.mjs +6 -8
  30. package/es/uploader/index.d.ts +1 -1
  31. package/es/uploader/types.d.ts +1 -0
  32. package/lib/action-bar-button/ActionBarButton.d.ts +3 -3
  33. package/lib/action-bar-button/index.d.ts +2 -2
  34. package/lib/action-bar-icon/ActionBarIcon.d.ts +3 -3
  35. package/lib/action-bar-icon/index.d.ts +2 -2
  36. package/lib/button/Button.d.ts +3 -3
  37. package/lib/button/index.d.ts +2 -2
  38. package/lib/calendar/CalendarHeader.js +4 -16
  39. package/lib/calendar/utils.js +6 -0
  40. package/lib/card/Card.js +2 -2
  41. package/lib/cell/Cell.d.ts +3 -3
  42. package/lib/cell/index.d.ts +2 -2
  43. package/lib/composables/use-route.d.ts +1 -2
  44. package/lib/form/Form.d.ts +3 -0
  45. package/lib/form/Form.js +9 -2
  46. package/lib/form/index.d.ts +2 -0
  47. package/lib/grid-item/GridItem.d.ts +3 -3
  48. package/lib/grid-item/index.d.ts +2 -2
  49. package/lib/index.d.ts +1 -1
  50. package/lib/index.js +1 -1
  51. package/lib/notify/types.d.ts +3 -0
  52. package/lib/sidebar-item/SidebarItem.d.ts +3 -3
  53. package/lib/sidebar-item/index.d.ts +2 -2
  54. package/lib/tab/Tab.d.ts +3 -3
  55. package/lib/tab/index.d.ts +2 -2
  56. package/lib/tabbar-item/TabbarItem.d.ts +3 -3
  57. package/lib/tabbar-item/index.d.ts +2 -2
  58. package/lib/tabs/utils.js +3 -1
  59. package/lib/text-ellipsis/TextEllipsis.js +55 -45
  60. package/lib/uploader/Uploader.js +6 -8
  61. package/lib/uploader/index.d.ts +1 -1
  62. package/lib/uploader/types.d.ts +1 -0
  63. package/lib/vant.cjs.js +86 -75
  64. package/lib/vant.es.js +86 -75
  65. package/lib/vant.js +87 -76
  66. package/lib/vant.min.js +3 -3
  67. package/lib/web-types.json +1 -1
  68. package/package.json +15 -15
@@ -1,5 +1,5 @@
1
1
  import { createVNode as _createVNode } from "vue";
2
- import { ref, watch, computed, onActivated, onMounted, defineComponent } from "vue";
2
+ import { ref, watch, computed, onActivated, onMounted, defineComponent, nextTick } from "vue";
3
3
  import { makeNumericProp, makeStringProp, createNamespace, windowWidth } from "../utils/index.mjs";
4
4
  import { useExpose } from "../composables/use-expose.mjs";
5
5
  const [name, bem] = createNamespace("text-ellipsis");
@@ -19,10 +19,11 @@ var stdin_default = defineComponent({
19
19
  emit,
20
20
  slots
21
21
  }) {
22
- const text = ref("");
22
+ const text = ref(props.content);
23
23
  const expanded = ref(false);
24
24
  const hasAction = ref(false);
25
25
  const root = ref();
26
+ const actionRef = ref();
26
27
  let needRecalculate = false;
27
28
  const actionText = computed(() => expanded.value ? props.collapseText : props.expandText);
28
29
  const pxToNum = (value) => {
@@ -50,57 +51,60 @@ var stdin_default = defineComponent({
50
51
  document.body.appendChild(container);
51
52
  return container;
52
53
  };
53
- const calcEllipsised = () => {
54
- const calcEllipsisText = (container2, maxHeight2) => {
55
- const {
56
- content,
57
- position,
58
- dots
59
- } = props;
60
- const end = content.length;
61
- const calcEllipse = () => {
62
- const tail = (left, right) => {
63
- if (right - left <= 1) {
64
- if (position === "end") {
65
- return content.slice(0, left) + dots;
66
- }
67
- return dots + content.slice(right, end);
68
- }
69
- const middle2 = Math.round((left + right) / 2);
54
+ const calcEllipsisText = (container, maxHeight) => {
55
+ var _a, _b;
56
+ const {
57
+ content,
58
+ position,
59
+ dots
60
+ } = props;
61
+ const end = content.length;
62
+ const middle = 0 + end >> 1;
63
+ const actionHTML = slots.action ? (_b = (_a = actionRef.value) == null ? void 0 : _a.outerHTML) != null ? _b : "" : props.expandText;
64
+ const calcEllipse = () => {
65
+ const tail = (left, right) => {
66
+ if (right - left <= 1) {
70
67
  if (position === "end") {
71
- container2.innerText = content.slice(0, middle2) + dots + actionText.value;
72
- } else {
73
- container2.innerText = dots + content.slice(middle2, end) + actionText.value;
74
- }
75
- if (container2.offsetHeight > maxHeight2) {
76
- if (position === "end") {
77
- return tail(left, middle2);
78
- }
79
- return tail(middle2, right);
68
+ return content.slice(0, left) + dots;
80
69
  }
70
+ return dots + content.slice(right, end);
71
+ }
72
+ const middle2 = Math.round((left + right) / 2);
73
+ if (position === "end") {
74
+ container.innerText = content.slice(0, middle2) + dots;
75
+ } else {
76
+ container.innerText = dots + content.slice(middle2, end);
77
+ }
78
+ container.innerHTML += actionHTML;
79
+ if (container.offsetHeight > maxHeight) {
81
80
  if (position === "end") {
82
- return tail(middle2, right);
81
+ return tail(left, middle2);
83
82
  }
84
- return tail(left, middle2);
85
- };
86
- container2.innerText = tail(0, end);
87
- };
88
- const middleTail = (leftPart, rightPart) => {
89
- if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
90
- return content.slice(0, leftPart[0]) + dots + content.slice(rightPart[1], end);
83
+ return tail(middle2, right);
91
84
  }
92
- const leftMiddle = Math.floor((leftPart[0] + leftPart[1]) / 2);
93
- const rightMiddle = Math.ceil((rightPart[0] + rightPart[1]) / 2);
94
- container2.innerText = props.content.slice(0, leftMiddle) + props.dots + props.content.slice(rightMiddle, end) + props.expandText;
95
- if (container2.offsetHeight >= maxHeight2) {
96
- return middleTail([leftPart[0], leftMiddle], [rightMiddle, rightPart[1]]);
85
+ if (position === "end") {
86
+ return tail(middle2, right);
97
87
  }
98
- return middleTail([leftMiddle, leftPart[1]], [rightPart[0], rightMiddle]);
88
+ return tail(left, middle2);
99
89
  };
100
- const middle = 0 + end >> 1;
101
- props.position === "middle" ? container2.innerText = middleTail([0, middle], [middle, end]) : calcEllipse();
102
- return container2.innerText;
90
+ return tail(0, end);
91
+ };
92
+ const middleTail = (leftPart, rightPart) => {
93
+ if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
94
+ return content.slice(0, leftPart[0]) + dots + content.slice(rightPart[1], end);
95
+ }
96
+ const leftMiddle = Math.floor((leftPart[0] + leftPart[1]) / 2);
97
+ const rightMiddle = Math.ceil((rightPart[0] + rightPart[1]) / 2);
98
+ container.innerText = props.content.slice(0, leftMiddle) + props.dots + props.content.slice(rightMiddle, end);
99
+ container.innerHTML += actionHTML;
100
+ if (container.offsetHeight >= maxHeight) {
101
+ return middleTail([leftPart[0], leftMiddle], [rightMiddle, rightPart[1]]);
102
+ }
103
+ return middleTail([leftMiddle, leftPart[1]], [rightPart[0], rightMiddle]);
103
104
  };
105
+ return props.position === "middle" ? middleTail([0, middle], [middle, end]) : calcEllipse();
106
+ };
107
+ const calcEllipsised = () => {
104
108
  const container = cloneContainer();
105
109
  if (!container) {
106
110
  needRecalculate = true;
@@ -133,11 +137,17 @@ var stdin_default = defineComponent({
133
137
  expanded: expanded.value
134
138
  }) : actionText.value;
135
139
  return _createVNode("span", {
140
+ "ref": actionRef,
136
141
  "class": bem("action"),
137
142
  "onClick": onClickAction
138
143
  }, [action]);
139
144
  };
140
- onMounted(calcEllipsised);
145
+ onMounted(() => {
146
+ calcEllipsised();
147
+ if (slots.action) {
148
+ nextTick(calcEllipsised);
149
+ }
150
+ });
141
151
  onActivated(() => {
142
152
  if (needRecalculate) {
143
153
  needRecalculate = false;
@@ -183,7 +183,7 @@ var stdin_default = defineComponent({
183
183
  emit("update:modelValue", fileList);
184
184
  emit("delete", item, getDetail(index));
185
185
  };
186
- const reuploadImage = (index) => {
186
+ const reuploadFile = (index) => {
187
187
  isReuploading.value = true;
188
188
  reuploadIndex.value = index;
189
189
  nextTick(() => chooseFile());
@@ -203,7 +203,7 @@ var stdin_default = defineComponent({
203
203
  "onClick": () => emit(props.reupload ? "clickReupload" : "clickPreview", item, getDetail(index)),
204
204
  "onDelete": () => deleteFile(item, index),
205
205
  "onPreview": () => previewImage(item),
206
- "onReupload": () => reuploadImage(index)
206
+ "onReupload": () => reuploadFile(index)
207
207
  }, pick(props, ["name", "lazyLoad"]), previewData), pick(slots, ["preview-cover", "preview-delete"]));
208
208
  };
209
209
  const renderPreviewList = () => {
@@ -213,10 +213,7 @@ var stdin_default = defineComponent({
213
213
  };
214
214
  const onClickUpload = (event) => emit("clickUpload", event);
215
215
  const renderUpload = () => {
216
- if (props.modelValue.length >= +props.maxCount && !props.reupload) {
217
- return;
218
- }
219
- const hideUploader = props.modelValue.length >= +props.maxCount && props.reupload;
216
+ const lessThanMax = props.modelValue.length < +props.maxCount;
220
217
  const Input = props.readonly ? null : _createVNode("input", {
221
218
  "ref": inputRef,
222
219
  "type": "file",
@@ -232,7 +229,7 @@ var stdin_default = defineComponent({
232
229
  return _withDirectives(_createVNode("div", {
233
230
  "class": bem("input-wrapper"),
234
231
  "onClick": onClickUpload
235
- }, [slots.default(), Input]), [[_vShow, !hideUploader]]);
232
+ }, [slots.default(), Input]), [[_vShow, lessThanMax]]);
236
233
  }
237
234
  return _withDirectives(_createVNode("div", {
238
235
  "class": bem("upload", {
@@ -245,7 +242,7 @@ var stdin_default = defineComponent({
245
242
  "class": bem("upload-icon")
246
243
  }, null), props.uploadText && _createVNode("span", {
247
244
  "class": bem("upload-text")
248
- }, [props.uploadText]), Input]), [[_vShow, props.showUpload && !hideUploader]]);
245
+ }, [props.uploadText]), Input]), [[_vShow, props.showUpload && lessThanMax]]);
249
246
  };
250
247
  const chooseFile = () => {
251
248
  if (inputRef.value && !props.disabled) {
@@ -257,6 +254,7 @@ var stdin_default = defineComponent({
257
254
  });
258
255
  useExpose({
259
256
  chooseFile,
257
+ reuploadFile,
260
258
  closeImagePreview
261
259
  });
262
260
  useCustomFieldValue(() => props.modelValue);
@@ -151,7 +151,7 @@ export declare const Uploader: import("../utils").WithInstall<import("vue").Defi
151
151
  export default Uploader;
152
152
  export { uploaderProps } from './Uploader';
153
153
  export type { UploaderProps };
154
- export type { UploaderInstance, UploaderThemeVars, UploaderResultType, UploaderFileListItem, } from './types';
154
+ export type { UploaderInstance, UploaderThemeVars, UploaderResultType, UploaderFileListItem, UploaderBeforeRead, UploaderAfterRead, } from './types';
155
155
  declare module 'vue' {
156
156
  interface GlobalComponents {
157
157
  VanUploader: typeof Uploader;
@@ -29,6 +29,7 @@ export type UploaderAfterRead = (items: UploaderFileListItem | UploaderFileListI
29
29
  export type UploaderExpose = {
30
30
  chooseFile: () => void;
31
31
  closeImagePreview: () => void;
32
+ reuploadFile: (index: number) => void;
32
33
  };
33
34
  export type UploaderInstance = ComponentPublicInstance<UploaderProps, UploaderExpose>;
34
35
  export type UploaderThemeVars = {
@@ -1,7 +1,7 @@
1
1
  import { type PropType, type ExtractPropTypes } from 'vue';
2
2
  import { ButtonType } from '../button';
3
3
  export declare const actionBarButtonProps: {
4
- to: PropType<import("vue-router").RouteLocationRaw>;
4
+ to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
5
5
  url: StringConstructor;
6
6
  replace: BooleanConstructor;
7
7
  } & {
@@ -14,7 +14,7 @@ export declare const actionBarButtonProps: {
14
14
  };
15
15
  export type ActionBarButtonProps = ExtractPropTypes<typeof actionBarButtonProps>;
16
16
  declare const _default: import("vue").DefineComponent<{
17
- to: PropType<import("vue-router").RouteLocationRaw>;
17
+ to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
18
18
  url: StringConstructor;
19
19
  replace: BooleanConstructor;
20
20
  } & {
@@ -25,7 +25,7 @@ declare const _default: import("vue").DefineComponent<{
25
25
  loading: BooleanConstructor;
26
26
  disabled: BooleanConstructor;
27
27
  }, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ExtractPropTypes<{
28
- to: PropType<import("vue-router").RouteLocationRaw>;
28
+ to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
29
29
  url: StringConstructor;
30
30
  replace: BooleanConstructor;
31
31
  } & {
@@ -1,5 +1,5 @@
1
1
  export declare const ActionBarButton: import("../utils").WithInstall<import("vue").DefineComponent<{
2
- to: import("vue").PropType<import("vue-router").RouteLocationRaw>;
2
+ to: import("vue").PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
3
3
  url: StringConstructor;
4
4
  replace: BooleanConstructor;
5
5
  } & {
@@ -10,7 +10,7 @@ export declare const ActionBarButton: import("../utils").WithInstall<import("vue
10
10
  loading: BooleanConstructor;
11
11
  disabled: BooleanConstructor;
12
12
  }, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
13
- to: import("vue").PropType<import("vue-router").RouteLocationRaw>;
13
+ to: import("vue").PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
14
14
  url: StringConstructor;
15
15
  replace: BooleanConstructor;
16
16
  } & {
@@ -1,7 +1,7 @@
1
1
  import { type PropType, type ExtractPropTypes } from 'vue';
2
2
  import { type BadgeProps } from '../badge';
3
3
  export declare const actionBarIconProps: {
4
- to: PropType<import("vue-router").RouteLocationRaw>;
4
+ to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
5
5
  url: StringConstructor;
6
6
  replace: BooleanConstructor;
7
7
  } & {
@@ -16,7 +16,7 @@ export declare const actionBarIconProps: {
16
16
  };
17
17
  export type ActionBarIconProps = ExtractPropTypes<typeof actionBarIconProps>;
18
18
  declare const _default: import("vue").DefineComponent<{
19
- to: PropType<import("vue-router").RouteLocationRaw>;
19
+ to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
20
20
  url: StringConstructor;
21
21
  replace: BooleanConstructor;
22
22
  } & {
@@ -29,7 +29,7 @@ declare const _default: import("vue").DefineComponent<{
29
29
  badgeProps: PropType<Partial<BadgeProps>>;
30
30
  iconPrefix: StringConstructor;
31
31
  }, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ExtractPropTypes<{
32
- to: PropType<import("vue-router").RouteLocationRaw>;
32
+ to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
33
33
  url: StringConstructor;
34
34
  replace: BooleanConstructor;
35
35
  } & {
@@ -1,5 +1,5 @@
1
1
  export declare const ActionBarIcon: import("../utils").WithInstall<import("vue").DefineComponent<{
2
- to: import("vue").PropType<import("vue-router").RouteLocationRaw>;
2
+ to: import("vue").PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
3
3
  url: StringConstructor;
4
4
  replace: BooleanConstructor;
5
5
  } & {
@@ -12,7 +12,7 @@ export declare const ActionBarIcon: import("../utils").WithInstall<import("vue")
12
12
  badgeProps: import("vue").PropType<Partial<import("..").BadgeProps>>;
13
13
  iconPrefix: StringConstructor;
14
14
  }, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
15
- to: import("vue").PropType<import("vue-router").RouteLocationRaw>;
15
+ to: import("vue").PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
16
16
  url: StringConstructor;
17
17
  replace: BooleanConstructor;
18
18
  } & {
@@ -2,7 +2,7 @@ import { type PropType, type ExtractPropTypes } from 'vue';
2
2
  import { LoadingType } from '../loading';
3
3
  import { ButtonSize, ButtonType, ButtonNativeType, ButtonIconPosition } from './types';
4
4
  export declare const buttonProps: {
5
- to: PropType<import("vue-router").RouteLocationRaw>;
5
+ to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
6
6
  url: StringConstructor;
7
7
  replace: BooleanConstructor;
8
8
  } & {
@@ -43,7 +43,7 @@ export declare const buttonProps: {
43
43
  };
44
44
  export type ButtonProps = ExtractPropTypes<typeof buttonProps>;
45
45
  declare const _default: import("vue").DefineComponent<{
46
- to: PropType<import("vue-router").RouteLocationRaw>;
46
+ to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
47
47
  url: StringConstructor;
48
48
  replace: BooleanConstructor;
49
49
  } & {
@@ -82,7 +82,7 @@ declare const _default: import("vue").DefineComponent<{
82
82
  default: ButtonIconPosition;
83
83
  };
84
84
  }, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "click"[], "click", import("vue").PublicProps, Readonly<ExtractPropTypes<{
85
- to: PropType<import("vue-router").RouteLocationRaw>;
85
+ to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
86
86
  url: StringConstructor;
87
87
  replace: BooleanConstructor;
88
88
  } & {
@@ -1,5 +1,5 @@
1
1
  export declare const Button: import("../utils").WithInstall<import("vue").DefineComponent<{
2
- to: import("vue").PropType<import("vue-router").RouteLocationRaw>;
2
+ to: import("vue").PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
3
3
  url: StringConstructor;
4
4
  replace: BooleanConstructor;
5
5
  } & {
@@ -38,7 +38,7 @@ export declare const Button: import("../utils").WithInstall<import("vue").Define
38
38
  default: import("./types").ButtonIconPosition;
39
39
  };
40
40
  }, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "click"[], "click", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
41
- to: import("vue").PropType<import("vue-router").RouteLocationRaw>;
41
+ to: import("vue").PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
42
42
  url: StringConstructor;
43
43
  replace: BooleanConstructor;
44
44
  } & {
@@ -44,22 +44,10 @@ var stdin_default = (0, import_vue2.defineComponent)({
44
44
  slots,
45
45
  emit
46
46
  }) {
47
- const prevMonthDisabled = (0, import_vue2.computed)(() => {
48
- const prevMonth = (0, import_utils2.getPrevMonth)(props.date);
49
- return props.minDate && prevMonth < props.minDate;
50
- });
51
- const prevYearDisabled = (0, import_vue2.computed)(() => {
52
- const prevYear = (0, import_utils2.getPrevYear)(props.date);
53
- return props.minDate && prevYear < props.minDate;
54
- });
55
- const nextMonthDisabled = (0, import_vue2.computed)(() => {
56
- const nextMonth = (0, import_utils2.getNextMonth)(props.date);
57
- return props.maxDate && nextMonth > props.maxDate;
58
- });
59
- const nextYearDisabled = (0, import_vue2.computed)(() => {
60
- const nextYear = (0, import_utils2.getNextYear)(props.date);
61
- return props.maxDate && nextYear > props.maxDate;
62
- });
47
+ const prevMonthDisabled = (0, import_vue2.computed)(() => props.date && props.minDate && (0, import_utils2.compareMonth)((0, import_utils2.getPrevMonth)(props.date), props.minDate) < 0);
48
+ const prevYearDisabled = (0, import_vue2.computed)(() => props.date && props.minDate && (0, import_utils2.compareMonth)((0, import_utils2.getPrevYear)(props.date), props.minDate) < 0);
49
+ const nextMonthDisabled = (0, import_vue2.computed)(() => props.date && props.maxDate && (0, import_utils2.compareMonth)((0, import_utils2.getNextMonth)(props.date), props.maxDate) > 0);
50
+ const nextYearDisabled = (0, import_vue2.computed)(() => props.date && props.maxDate && (0, import_utils2.compareMonth)((0, import_utils2.getNextYear)(props.date), props.maxDate) > 0);
63
51
  const renderTitle = () => {
64
52
  if (props.showTitle) {
65
53
  const text = props.title || (0, import_utils2.t)("title");
@@ -70,11 +70,17 @@ function getDayByOffset(date, offset) {
70
70
  function getMonthByOffset(date, offset) {
71
71
  const cloned = cloneDate(date);
72
72
  cloned.setMonth(cloned.getMonth() + offset);
73
+ if (cloned.getDate() !== date.getDate()) {
74
+ cloned.setDate(0);
75
+ }
73
76
  return cloned;
74
77
  }
75
78
  function getYearByOffset(date, offset) {
76
79
  const cloned = cloneDate(date);
77
80
  cloned.setFullYear(cloned.getFullYear() + offset);
81
+ if (cloned.getDate() !== date.getDate()) {
82
+ cloned.setDate(0);
83
+ }
78
84
  return cloned;
79
85
  }
80
86
  const getPrevDay = (date) => getDayByOffset(date, -1);
package/lib/card/Card.js CHANGED
@@ -107,9 +107,9 @@ var stdin_default = (0, import_vue2.defineComponent)({
107
107
  "class": bem("price-currency")
108
108
  }, [props.currency]), (0, import_vue.createVNode)("span", {
109
109
  "class": bem("price-integer")
110
- }, [priceArr[0]]), (0, import_vue.createTextVNode)("."), (0, import_vue.createVNode)("span", {
110
+ }, [priceArr[0]]), priceArr.length > 1 && (0, import_vue.createVNode)(import_vue.Fragment, null, [(0, import_vue.createTextVNode)("."), (0, import_vue.createVNode)("span", {
111
111
  "class": bem("price-decimal")
112
- }, [priceArr[1]])]);
112
+ }, [priceArr[1]])])]);
113
113
  };
114
114
  return () => {
115
115
  var _a, _b, _c;
@@ -63,7 +63,7 @@ export declare const cellProps: {
63
63
  default: null;
64
64
  };
65
65
  } & {
66
- to: PropType<import("vue-router").RouteLocationRaw>;
66
+ to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
67
67
  url: StringConstructor;
68
68
  replace: BooleanConstructor;
69
69
  };
@@ -99,7 +99,7 @@ declare const _default: import("vue").DefineComponent<{
99
99
  default: null;
100
100
  };
101
101
  } & {
102
- to: PropType<import("vue-router").RouteLocationRaw>;
102
+ to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
103
103
  url: StringConstructor;
104
104
  replace: BooleanConstructor;
105
105
  }, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ExtractPropTypes<{
@@ -133,7 +133,7 @@ declare const _default: import("vue").DefineComponent<{
133
133
  default: null;
134
134
  };
135
135
  } & {
136
- to: PropType<import("vue-router").RouteLocationRaw>;
136
+ to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
137
137
  url: StringConstructor;
138
138
  replace: BooleanConstructor;
139
139
  }>>, {
@@ -29,7 +29,7 @@ export declare const Cell: import("../utils").WithInstall<import("vue").DefineCo
29
29
  default: null;
30
30
  };
31
31
  } & {
32
- to: import("vue").PropType<import("vue-router").RouteLocationRaw>;
32
+ to: import("vue").PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
33
33
  url: StringConstructor;
34
34
  replace: BooleanConstructor;
35
35
  }, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -63,7 +63,7 @@ export declare const Cell: import("../utils").WithInstall<import("vue").DefineCo
63
63
  default: null;
64
64
  };
65
65
  } & {
66
- to: import("vue").PropType<import("vue-router").RouteLocationRaw>;
66
+ to: import("vue").PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
67
67
  url: StringConstructor;
68
68
  replace: BooleanConstructor;
69
69
  }>>, {
@@ -2,9 +2,8 @@
2
2
  * Vue Router support
3
3
  */
4
4
  import { type PropType, type ExtractPropTypes, type ComponentPublicInstance } from 'vue';
5
- import type { RouteLocationRaw } from 'vue-router';
6
5
  export declare const routeProps: {
7
- to: PropType<RouteLocationRaw>;
6
+ to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
8
7
  url: StringConstructor;
9
8
  replace: BooleanConstructor;
10
9
  };
@@ -10,6 +10,7 @@ export declare const formProps: {
10
10
  labelAlign: PropType<FieldTextAlign>;
11
11
  inputAlign: PropType<FieldTextAlign>;
12
12
  scrollToError: BooleanConstructor;
13
+ scrollToErrorPosition: PropType<ScrollLogicalPosition>;
13
14
  validateFirst: BooleanConstructor;
14
15
  submitOnEnter: {
15
16
  type: BooleanConstructor;
@@ -36,6 +37,7 @@ declare const _default: import("vue").DefineComponent<{
36
37
  labelAlign: PropType<FieldTextAlign>;
37
38
  inputAlign: PropType<FieldTextAlign>;
38
39
  scrollToError: BooleanConstructor;
40
+ scrollToErrorPosition: PropType<ScrollLogicalPosition>;
39
41
  validateFirst: BooleanConstructor;
40
42
  submitOnEnter: {
41
43
  type: BooleanConstructor;
@@ -60,6 +62,7 @@ declare const _default: import("vue").DefineComponent<{
60
62
  labelAlign: PropType<FieldTextAlign>;
61
63
  inputAlign: PropType<FieldTextAlign>;
62
64
  scrollToError: BooleanConstructor;
65
+ scrollToErrorPosition: PropType<ScrollLogicalPosition>;
63
66
  validateFirst: BooleanConstructor;
64
67
  submitOnEnter: {
65
68
  type: BooleanConstructor;
package/lib/form/Form.js CHANGED
@@ -37,6 +37,7 @@ const formProps = {
37
37
  labelAlign: String,
38
38
  inputAlign: String,
39
39
  scrollToError: Boolean,
40
+ scrollToErrorPosition: String,
40
41
  validateFirst: Boolean,
41
42
  submitOnEnter: import_utils.truthProp,
42
43
  showErrorMessage: import_utils.truthProp,
@@ -150,8 +151,14 @@ var stdin_default = (0, import_vue2.defineComponent)({
150
151
  values,
151
152
  errors
152
153
  });
153
- if (props.scrollToError && errors[0].name) {
154
- scrollToField(errors[0].name);
154
+ const {
155
+ scrollToError,
156
+ scrollToErrorPosition
157
+ } = props;
158
+ if (scrollToError && errors[0].name) {
159
+ scrollToField(errors[0].name, scrollToErrorPosition ? {
160
+ block: scrollToErrorPosition
161
+ } : void 0);
155
162
  }
156
163
  });
157
164
  };
@@ -9,6 +9,7 @@ export declare const Form: import("../utils").WithInstall<import("vue").DefineCo
9
9
  labelAlign: import("vue").PropType<import("..").FieldTextAlign>;
10
10
  inputAlign: import("vue").PropType<import("..").FieldTextAlign>;
11
11
  scrollToError: BooleanConstructor;
12
+ scrollToErrorPosition: import("vue").PropType<ScrollLogicalPosition>;
12
13
  validateFirst: BooleanConstructor;
13
14
  submitOnEnter: {
14
15
  type: BooleanConstructor;
@@ -33,6 +34,7 @@ export declare const Form: import("../utils").WithInstall<import("vue").DefineCo
33
34
  labelAlign: import("vue").PropType<import("..").FieldTextAlign>;
34
35
  inputAlign: import("vue").PropType<import("..").FieldTextAlign>;
35
36
  scrollToError: BooleanConstructor;
37
+ scrollToErrorPosition: import("vue").PropType<ScrollLogicalPosition>;
36
38
  validateFirst: BooleanConstructor;
37
39
  submitOnEnter: {
38
40
  type: BooleanConstructor;
@@ -1,7 +1,7 @@
1
1
  import { type PropType, type ExtractPropTypes } from 'vue';
2
2
  import { type BadgeProps } from '../badge';
3
3
  export declare const gridItemProps: {
4
- to: PropType<import("vue-router").RouteLocationRaw>;
4
+ to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
5
5
  url: StringConstructor;
6
6
  replace: BooleanConstructor;
7
7
  } & {
@@ -15,7 +15,7 @@ export declare const gridItemProps: {
15
15
  };
16
16
  export type GridItemProps = ExtractPropTypes<typeof gridItemProps>;
17
17
  declare const _default: import("vue").DefineComponent<{
18
- to: PropType<import("vue-router").RouteLocationRaw>;
18
+ to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
19
19
  url: StringConstructor;
20
20
  replace: BooleanConstructor;
21
21
  } & {
@@ -27,7 +27,7 @@ declare const _default: import("vue").DefineComponent<{
27
27
  iconPrefix: StringConstructor;
28
28
  badgeProps: PropType<Partial<BadgeProps>>;
29
29
  }, (() => import("vue/jsx-runtime").JSX.Element) | undefined, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ExtractPropTypes<{
30
- to: PropType<import("vue-router").RouteLocationRaw>;
30
+ to: PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
31
31
  url: StringConstructor;
32
32
  replace: BooleanConstructor;
33
33
  } & {
@@ -1,5 +1,5 @@
1
1
  export declare const GridItem: import("../utils").WithInstall<import("vue").DefineComponent<{
2
- to: import("vue").PropType<import("vue-router").RouteLocationRaw>;
2
+ to: import("vue").PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
3
3
  url: StringConstructor;
4
4
  replace: BooleanConstructor;
5
5
  } & {
@@ -11,7 +11,7 @@ export declare const GridItem: import("../utils").WithInstall<import("vue").Defi
11
11
  iconPrefix: StringConstructor;
12
12
  badgeProps: import("vue").PropType<Partial<import("..").BadgeProps>>;
13
13
  }, (() => import("vue/jsx-runtime").JSX.Element) | undefined, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
14
- to: import("vue").PropType<import("vue-router").RouteLocationRaw>;
14
+ to: import("vue").PropType<string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric>;
15
15
  url: StringConstructor;
16
16
  replace: BooleanConstructor;
17
17
  } & {
package/lib/index.d.ts CHANGED
@@ -106,4 +106,4 @@ declare namespace _default {
106
106
  }
107
107
  export default _default;
108
108
  export function install(app: any): void;
109
- export const version: "4.9.1";
109
+ export const version: "4.9.3";
package/lib/index.js CHANGED
@@ -226,7 +226,7 @@ __reExport(stdin_exports, require("./toast"), module.exports);
226
226
  __reExport(stdin_exports, require("./tree-select"), module.exports);
227
227
  __reExport(stdin_exports, require("./uploader"), module.exports);
228
228
  __reExport(stdin_exports, require("./watermark"), module.exports);
229
- const version = "4.9.1";
229
+ const version = "4.9.3";
230
230
  function install(app) {
231
231
  const components = [
232
232
  import_action_bar.ActionBar,
@@ -1,3 +1,4 @@
1
+ import type { TeleportProps } from 'vue';
1
2
  import type { Numeric } from '../utils';
2
3
  export type NotifyMessage = Numeric;
3
4
  export type NotifyType = 'primary' | 'success' | 'danger' | 'warning';
@@ -7,10 +8,12 @@ export type NotifyOptions = {
7
8
  color?: string;
8
9
  message?: NotifyMessage;
9
10
  duration?: number;
11
+ zIndex?: number;
10
12
  position?: NotifyPosition;
11
13
  className?: unknown;
12
14
  background?: string;
13
15
  lockScroll?: boolean;
16
+ teleport?: TeleportProps['to'];
14
17
  onClick?: (event: MouseEvent) => void;
15
18
  onClose?: () => void;
16
19
  onOpened?: () => void;