vant 4.9.2 → 4.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { createVNode as _createVNode } from "vue";
2
2
  import { computed, defineComponent } from "vue";
3
3
  import { createNamespace, HAPTICS_FEEDBACK, makeStringProp } from "../utils/index.mjs";
4
- import { t, bem, getPrevMonth, getPrevYear, getNextMonth, getNextYear } from "./utils.mjs";
4
+ import { t, bem, compareMonth, getPrevMonth, getPrevYear, getNextMonth, getNextYear } from "./utils.mjs";
5
5
  import { Icon } from "../icon/index.mjs";
6
6
  const [name] = createNamespace("calendar-header");
7
7
  var stdin_default = defineComponent({
@@ -22,22 +22,10 @@ var stdin_default = defineComponent({
22
22
  slots,
23
23
  emit
24
24
  }) {
25
- const prevMonthDisabled = computed(() => {
26
- const prevMonth = getPrevMonth(props.date);
27
- return props.minDate && prevMonth < props.minDate;
28
- });
29
- const prevYearDisabled = computed(() => {
30
- const prevYear = getPrevYear(props.date);
31
- return props.minDate && prevYear < props.minDate;
32
- });
33
- const nextMonthDisabled = computed(() => {
34
- const nextMonth = getNextMonth(props.date);
35
- return props.maxDate && nextMonth > props.maxDate;
36
- });
37
- const nextYearDisabled = computed(() => {
38
- const nextYear = getNextYear(props.date);
39
- return props.maxDate && nextYear > props.maxDate;
40
- });
25
+ const prevMonthDisabled = computed(() => props.date && props.minDate && compareMonth(getPrevMonth(props.date), props.minDate) < 0);
26
+ const prevYearDisabled = computed(() => props.date && props.minDate && compareMonth(getPrevYear(props.date), props.minDate) < 0);
27
+ const nextMonthDisabled = computed(() => props.date && props.maxDate && compareMonth(getNextMonth(props.date), props.maxDate) > 0);
28
+ const nextYearDisabled = computed(() => props.date && props.maxDate && compareMonth(getNextYear(props.date), props.maxDate) > 0);
41
29
  const renderTitle = () => {
42
30
  if (props.showTitle) {
43
31
  const text = props.title || t("title");
@@ -30,11 +30,17 @@ function getDayByOffset(date, offset) {
30
30
  function getMonthByOffset(date, offset) {
31
31
  const cloned = cloneDate(date);
32
32
  cloned.setMonth(cloned.getMonth() + offset);
33
+ if (cloned.getDate() !== date.getDate()) {
34
+ cloned.setDate(0);
35
+ }
33
36
  return cloned;
34
37
  }
35
38
  function getYearByOffset(date, offset) {
36
39
  const cloned = cloneDate(date);
37
40
  cloned.setFullYear(cloned.getFullYear() + offset);
41
+ if (cloned.getDate() !== date.getDate()) {
42
+ cloned.setDate(0);
43
+ }
38
44
  return cloned;
39
45
  }
40
46
  const getPrevDay = (date) => getDayByOffset(date, -1);
package/es/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.2";
109
+ export const version: "4.9.4";
package/es/index.mjs CHANGED
@@ -99,7 +99,7 @@ import { Toast } from "./toast/index.mjs";
99
99
  import { TreeSelect } from "./tree-select/index.mjs";
100
100
  import { Uploader } from "./uploader/index.mjs";
101
101
  import { Watermark } from "./watermark/index.mjs";
102
- const version = "4.9.2";
102
+ const version = "4.9.4";
103
103
  function install(app) {
104
104
  const components = [
105
105
  ActionBar,
@@ -0,0 +1,63 @@
1
+ declare const _default: {
2
+ name: string;
3
+ tel: string;
4
+ save: string;
5
+ clear: string;
6
+ cancel: string;
7
+ confirm: string;
8
+ delete: string;
9
+ loading: string;
10
+ noCoupon: string;
11
+ nameEmpty: string;
12
+ addContact: string;
13
+ telInvalid: string;
14
+ vanCalendar: {
15
+ end: string;
16
+ start: string;
17
+ title: string;
18
+ weekdays: string[];
19
+ monthTitle: (year: number, month: number) => string;
20
+ rangePrompt: (maxRange: number) => string;
21
+ };
22
+ vanCascader: {
23
+ select: string;
24
+ };
25
+ vanPagination: {
26
+ prev: string;
27
+ next: string;
28
+ };
29
+ vanPullRefresh: {
30
+ pulling: string;
31
+ loosing: string;
32
+ };
33
+ vanSubmitBar: {
34
+ label: string;
35
+ };
36
+ vanCoupon: {
37
+ unlimited: string;
38
+ discount: (discount: number) => string;
39
+ condition: (condition: number) => string;
40
+ };
41
+ vanCouponCell: {
42
+ title: string;
43
+ count: (count: number) => string;
44
+ };
45
+ vanCouponList: {
46
+ exchange: string;
47
+ close: string;
48
+ enable: string;
49
+ disabled: string;
50
+ placeholder: string;
51
+ };
52
+ vanAddressEdit: {
53
+ area: string;
54
+ areaEmpty: string;
55
+ addressEmpty: string;
56
+ addressDetail: string;
57
+ defaultAddress: string;
58
+ };
59
+ vanAddressList: {
60
+ add: string;
61
+ };
62
+ };
63
+ export default _default;
@@ -0,0 +1,81 @@
1
+ var stdin_default = {
2
+ name: "\u0410\u0442\u044B",
3
+ tel: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D",
4
+ save: "\u0421\u0430\u049B\u0442\u0430\u0443",
5
+ clear: "\u0422\u0430\u0437\u0430\u0440\u0442\u0443",
6
+ cancel: "\u0411\u0430\u0441\u0442\u0430\u0440\u0442\u0443",
7
+ confirm: "\u0420\u0430\u0441\u0442\u0430\u0443",
8
+ delete: "\u0416\u043E\u044E",
9
+ loading: "\u0416\u04AF\u043A\u0442\u0435\u043B\u0443\u0434\u0435...",
10
+ noCoupon: "\u041A\u0443\u043F\u043E\u043D\u0434\u0430\u0440 \u0436\u043E\u049B",
11
+ nameEmpty: "\u0410\u0442\u044B-\u0436\u04E9\u043D\u0456\u04A3\u0456\u0437\u0434\u0456 \u0442\u043E\u043B\u0442\u044B\u0440\u044B\u04A3\u044B\u0437",
12
+ addContact: "\u041A\u043E\u043D\u0442\u0430\u043A\u0442\u0456 \u049B\u043E\u0441\u0443",
13
+ telInvalid: "\u0414\u04B1\u0440\u044B\u0441 \u0442\u0435\u043B\u0435\u0444\u043E\u043D \u043D\u04E9\u043C\u0456\u0440\u0456\u043D \u0442\u043E\u043B\u0442\u044B\u0440\u044B\u04A3\u044B\u0437",
14
+ vanCalendar: {
15
+ end: "\u0410\u044F\u049B\u0442\u0430\u043B\u0443 \u0443\u0430\u049B\u044B\u0442\u044B",
16
+ start: "\u0411\u0430\u0441\u0442\u0430\u0443 \u0443\u0430\u049B\u044B\u0442\u044B",
17
+ title: "\u041A\u04AF\u043D\u0434\u0456 \u0442\u0430\u04A3\u0434\u0430\u0443",
18
+ weekdays: ["\u0416\u0421", "\u0414\u0421", "\u0421\u0421", "\u0421\u0420", "\u0411\u0421", "\u0416\u041C", "\u0421\u0411"],
19
+ monthTitle: (year, month) => {
20
+ const monthNames = [
21
+ "\u049A\u0430\u04A3\u0442\u0430\u0440",
22
+ "\u0410\u049B\u043F\u0430\u043D",
23
+ "\u041D\u0430\u0443\u0440\u044B\u0437",
24
+ "\u0421\u04D9\u0443\u0456\u0440",
25
+ "\u041C\u0430\u043C\u044B\u0440",
26
+ "\u041C\u0430\u0443\u0441\u044B\u043C",
27
+ "\u0428\u0456\u043B\u0434\u0435",
28
+ "\u0422\u0430\u043C\u044B\u0437",
29
+ "\u049A\u044B\u0440\u043A\u04AF\u0439\u0435\u043A",
30
+ "\u049A\u0430\u0437\u0430\u043D",
31
+ "\u049A\u0430\u0440\u0430\u0448\u0430",
32
+ "\u0416\u0435\u043B\u0442\u043E\u049B\u0441\u0430\u043D"
33
+ ];
34
+ return `${year} ${monthNames[month - 1]}`;
35
+ },
36
+ rangePrompt: (maxRange) => `\u0422\u0435\u043A ${maxRange} \u043A\u04AF\u043D\u0433\u0435 \u0434\u0435\u0439\u0456\u043D \u0442\u0430\u04A3\u0434\u0430\u0439 \u0430\u043B\u0430\u0441\u044B\u0437`
37
+ },
38
+ vanCascader: {
39
+ select: "\u0422\u0430\u04A3\u0434\u0430\u04A3\u044B\u0437"
40
+ },
41
+ vanPagination: {
42
+ prev: "\u0410\u0440\u0442\u049B\u0430",
43
+ next: "\u0410\u043B\u0493\u0430"
44
+ },
45
+ vanPullRefresh: {
46
+ pulling: "\u0416\u0430\u04A3\u0430\u0440\u0442\u0443 \u04AF\u0448\u0456\u043D \u0442\u0430\u0440\u0442\u044B\u04A3\u044B\u0437...",
47
+ loosing: "\u0416\u0430\u04A3\u0430\u0440\u0442\u0443 \u04AF\u0448\u0456\u043D \u0436\u0456\u0431\u0435\u0440\u0456\u04A3\u0456\u0437..."
48
+ },
49
+ vanSubmitBar: {
50
+ label: "\u0416\u0430\u043B\u043F\u044B:"
51
+ },
52
+ vanCoupon: {
53
+ unlimited: "\u0422\u0430\u043B\u0430\u043F \u0436\u043E\u049B",
54
+ discount: (discount) => `${discount * 10}% \u0436\u0435\u04A3\u0456\u043B\u0434\u0456\u043A`,
55
+ condition: (condition) => `${condition} \u0442\u0435\u04A3\u0433\u0435\u0433\u0435 \u0436\u0435\u0442\u043A\u0435\u043D\u0434\u0435 \u049B\u043E\u043B \u0436\u0435\u0442\u0456\u043C\u0434\u0456`
56
+ },
57
+ vanCouponCell: {
58
+ title: "\u041A\u0443\u043F\u043E\u043D",
59
+ count: (count) => `${count} \u049B\u043E\u043B \u0436\u0435\u0442\u0456\u043C\u0434\u0456 \u043A\u0443\u043F\u043E\u043D`
60
+ },
61
+ vanCouponList: {
62
+ exchange: "\u0410\u0439\u044B\u0440\u0431\u0430\u0441\u0442\u0430\u0443",
63
+ close: "\u049A\u043E\u043B\u0434\u0430\u043D\u0431\u0430\u0443",
64
+ enable: "\u049A\u043E\u043B \u0436\u0435\u0442\u0456\u043C\u0434\u0456",
65
+ disabled: "\u049A\u043E\u043B\u0436\u0435\u0442\u0456\u043C\u0441\u0456\u0437",
66
+ placeholder: "\u0416\u0435\u04A3\u0456\u043B\u0434\u0456\u043A \u043A\u043E\u0434\u044B\u043D \u0435\u043D\u0433\u0456\u0437\u0456\u04A3\u0456\u0437"
67
+ },
68
+ vanAddressEdit: {
69
+ area: "\u0410\u0443\u043C\u0430\u049B",
70
+ areaEmpty: "\u0410\u0439\u043C\u0430\u049B\u0442\u044B \u0442\u0430\u04A3\u0434\u0430\u04A3\u044B\u0437",
71
+ addressEmpty: "\u0422\u043E\u043B\u044B\u049B \u043C\u0435\u043A\u0435\u043D-\u0436\u0430\u0439\u0434\u044B \u0442\u043E\u043B\u0442\u044B\u0440\u044B\u04A3\u044B\u0437",
72
+ addressDetail: "\u041C\u0435\u043A\u0435\u043D\u0436\u0430\u0439",
73
+ defaultAddress: "\u04D8\u0434\u0435\u043F\u043A\u0456 \u0436\u0435\u0442\u043A\u0456\u0437\u0443 \u043C\u0435\u043A\u0435\u043D\u0436\u0430\u0439\u044B \u0440\u0435\u0442\u0456\u043D\u0434\u0435 \u043E\u0440\u043D\u0430\u0442\u0443"
74
+ },
75
+ vanAddressList: {
76
+ add: "\u041C\u0435\u043A\u0435\u043D\u0436\u0430\u0439 \u049B\u043E\u0441\u0443"
77
+ }
78
+ };
79
+ export {
80
+ stdin_default as default
81
+ };
@@ -100,7 +100,7 @@ var stdin_default = defineComponent({
100
100
  }, 0);
101
101
  }
102
102
  };
103
- const onClick = (position = "outside") => {
103
+ const onClick = (position = "outside", event) => {
104
104
  if (isInBeforeClosing)
105
105
  return;
106
106
  emit("click", position);
@@ -108,6 +108,7 @@ var stdin_default = defineComponent({
108
108
  isInBeforeClosing = true;
109
109
  callInterceptor(props.beforeClose, {
110
110
  args: [{
111
+ event,
111
112
  name: props.name,
112
113
  position
113
114
  }],
@@ -124,7 +125,10 @@ var stdin_default = defineComponent({
124
125
  if (stop) {
125
126
  event.stopPropagation();
126
127
  }
127
- onClick(position);
128
+ if (lockClick) {
129
+ return;
130
+ }
131
+ onClick(position, event);
128
132
  };
129
133
  const renderSideContent = (side, ref2) => {
130
134
  const contentSlot = slots[side];
@@ -140,7 +144,7 @@ var stdin_default = defineComponent({
140
144
  open,
141
145
  close
142
146
  });
143
- useClickAway(root, () => onClick("outside"), {
147
+ useClickAway(root, (event) => onClick("outside", event), {
144
148
  eventName: "touchstart"
145
149
  });
146
150
  useEventListener("touchmove", onTouchMove, {
@@ -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);
@@ -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 = {
@@ -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/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.2";
109
+ export const version: "4.9.4";
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.2";
229
+ const version = "4.9.4";
230
230
  function install(app) {
231
231
  const components = [
232
232
  import_action_bar.ActionBar,
@@ -0,0 +1,63 @@
1
+ declare const _default: {
2
+ name: string;
3
+ tel: string;
4
+ save: string;
5
+ clear: string;
6
+ cancel: string;
7
+ confirm: string;
8
+ delete: string;
9
+ loading: string;
10
+ noCoupon: string;
11
+ nameEmpty: string;
12
+ addContact: string;
13
+ telInvalid: string;
14
+ vanCalendar: {
15
+ end: string;
16
+ start: string;
17
+ title: string;
18
+ weekdays: string[];
19
+ monthTitle: (year: number, month: number) => string;
20
+ rangePrompt: (maxRange: number) => string;
21
+ };
22
+ vanCascader: {
23
+ select: string;
24
+ };
25
+ vanPagination: {
26
+ prev: string;
27
+ next: string;
28
+ };
29
+ vanPullRefresh: {
30
+ pulling: string;
31
+ loosing: string;
32
+ };
33
+ vanSubmitBar: {
34
+ label: string;
35
+ };
36
+ vanCoupon: {
37
+ unlimited: string;
38
+ discount: (discount: number) => string;
39
+ condition: (condition: number) => string;
40
+ };
41
+ vanCouponCell: {
42
+ title: string;
43
+ count: (count: number) => string;
44
+ };
45
+ vanCouponList: {
46
+ exchange: string;
47
+ close: string;
48
+ enable: string;
49
+ disabled: string;
50
+ placeholder: string;
51
+ };
52
+ vanAddressEdit: {
53
+ area: string;
54
+ areaEmpty: string;
55
+ addressEmpty: string;
56
+ addressDetail: string;
57
+ defaultAddress: string;
58
+ };
59
+ vanAddressList: {
60
+ add: string;
61
+ };
62
+ };
63
+ export default _default;