vant 4.8.11 → 4.9.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 (68) hide show
  1. package/README.md +11 -8
  2. package/es/address-list/AddressList.d.ts +13 -13
  3. package/es/address-list/AddressList.mjs +20 -4
  4. package/es/address-list/AddressListItem.d.ts +3 -0
  5. package/es/address-list/AddressListItem.mjs +19 -7
  6. package/es/address-list/index.d.ts +2 -2
  7. package/es/address-list/style/index.mjs +1 -0
  8. package/es/area/utils.mjs +3 -3
  9. package/es/calendar/Calendar.d.ts +16 -10
  10. package/es/calendar/Calendar.mjs +83 -53
  11. package/es/calendar/CalendarHeader.d.ts +16 -1
  12. package/es/calendar/CalendarHeader.mjs +71 -7
  13. package/es/calendar/CalendarMonth.d.ts +6 -24
  14. package/es/calendar/CalendarMonth.mjs +6 -4
  15. package/es/calendar/index.css +1 -1
  16. package/es/calendar/index.d.ts +11 -7
  17. package/es/calendar/types.d.ts +4 -0
  18. package/es/calendar/utils.d.ts +6 -0
  19. package/es/calendar/utils.mjs +20 -0
  20. package/es/floating-panel/FloatingPanel.mjs +11 -5
  21. package/es/highlight/Highlight.mjs +7 -0
  22. package/es/image-preview/ImagePreviewItem.mjs +2 -0
  23. package/es/index-bar/IndexBar.mjs +10 -2
  24. package/es/index.d.ts +1 -1
  25. package/es/index.mjs +1 -1
  26. package/es/picker-group/PickerGroup.d.ts +13 -0
  27. package/es/picker-group/PickerGroup.mjs +5 -4
  28. package/es/picker-group/index.d.ts +9 -0
  29. package/es/stepper/Stepper.mjs +1 -0
  30. package/es/tabs/index.css +1 -1
  31. package/es/utils/basic.d.ts +1 -1
  32. package/lib/address-list/AddressList.d.ts +13 -13
  33. package/lib/address-list/AddressList.js +19 -3
  34. package/lib/address-list/AddressListItem.d.ts +3 -0
  35. package/lib/address-list/AddressListItem.js +19 -7
  36. package/lib/address-list/index.d.ts +2 -2
  37. package/lib/address-list/style/index.js +1 -0
  38. package/lib/area/utils.js +3 -3
  39. package/lib/calendar/Calendar.d.ts +16 -10
  40. package/lib/calendar/Calendar.js +82 -52
  41. package/lib/calendar/CalendarHeader.d.ts +16 -1
  42. package/lib/calendar/CalendarHeader.js +68 -4
  43. package/lib/calendar/CalendarMonth.d.ts +6 -24
  44. package/lib/calendar/CalendarMonth.js +6 -4
  45. package/lib/calendar/index.css +1 -1
  46. package/lib/calendar/index.d.ts +11 -7
  47. package/lib/calendar/types.d.ts +4 -0
  48. package/lib/calendar/utils.d.ts +6 -0
  49. package/lib/calendar/utils.js +20 -0
  50. package/lib/floating-panel/FloatingPanel.js +11 -5
  51. package/lib/highlight/Highlight.js +7 -0
  52. package/lib/image-preview/ImagePreviewItem.js +2 -0
  53. package/lib/index-bar/IndexBar.js +10 -2
  54. package/lib/index.css +1 -1
  55. package/lib/index.d.ts +1 -1
  56. package/lib/index.js +1 -1
  57. package/lib/picker-group/PickerGroup.d.ts +13 -0
  58. package/lib/picker-group/PickerGroup.js +4 -3
  59. package/lib/picker-group/index.d.ts +9 -0
  60. package/lib/stepper/Stepper.js +1 -0
  61. package/lib/tabs/index.css +1 -1
  62. package/lib/utils/basic.d.ts +1 -1
  63. package/lib/vant.cjs.js +516 -356
  64. package/lib/vant.es.js +516 -356
  65. package/lib/vant.js +518 -358
  66. package/lib/vant.min.js +3 -3
  67. package/lib/web-types.json +1 -1
  68. package/package.json +17 -17
@@ -27,8 +27,22 @@ function getDayByOffset(date, offset) {
27
27
  cloned.setDate(cloned.getDate() + offset);
28
28
  return cloned;
29
29
  }
30
+ function getMonthByOffset(date, offset) {
31
+ const cloned = cloneDate(date);
32
+ cloned.setMonth(cloned.getMonth() + offset);
33
+ return cloned;
34
+ }
35
+ function getYearByOffset(date, offset) {
36
+ const cloned = cloneDate(date);
37
+ cloned.setFullYear(cloned.getFullYear() + offset);
38
+ return cloned;
39
+ }
30
40
  const getPrevDay = (date) => getDayByOffset(date, -1);
31
41
  const getNextDay = (date) => getDayByOffset(date, 1);
42
+ const getPrevMonth = (date) => getMonthByOffset(date, -1);
43
+ const getNextMonth = (date) => getMonthByOffset(date, 1);
44
+ const getPrevYear = (date) => getYearByOffset(date, -1);
45
+ const getNextYear = (date) => getYearByOffset(date, 1);
32
46
  const getToday = () => {
33
47
  const today = /* @__PURE__ */ new Date();
34
48
  today.setHours(0, 0, 0, 0);
@@ -48,9 +62,15 @@ export {
48
62
  compareMonth,
49
63
  formatMonthTitle,
50
64
  getDayByOffset,
65
+ getMonthByOffset,
51
66
  getNextDay,
67
+ getNextMonth,
68
+ getNextYear,
52
69
  getPrevDay,
70
+ getPrevMonth,
71
+ getPrevYear,
53
72
  getToday,
73
+ getYearByOffset,
54
74
  name,
55
75
  t
56
76
  };
@@ -102,6 +102,16 @@ var stdin_default = defineComponent({
102
102
  useEventListener("touchmove", onTouchmove, {
103
103
  target: rootRef
104
104
  });
105
+ const renderHeader = () => {
106
+ if (slots.header) {
107
+ return slots.header();
108
+ }
109
+ return _createVNode("div", {
110
+ "class": bem("header")
111
+ }, [_createVNode("div", {
112
+ "class": bem("header-bar")
113
+ }, null)]);
114
+ };
105
115
  return () => {
106
116
  var _a;
107
117
  return _createVNode("div", {
@@ -113,11 +123,7 @@ var stdin_default = defineComponent({
113
123
  "onTouchstartPassive": onTouchstart,
114
124
  "onTouchend": onTouchend,
115
125
  "onTouchcancel": onTouchend
116
- }, [_createVNode("div", {
117
- "class": bem("header")
118
- }, [_createVNode("div", {
119
- "class": bem("header-bar")
120
- }, null)]), _createVNode("div", {
126
+ }, [renderHeader(), _createVNode("div", {
121
127
  "class": bem("content"),
122
128
  "ref": contentRef
123
129
  }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]);
@@ -66,6 +66,13 @@ var stdin_default = defineComponent({
66
66
  return chunks2;
67
67
  }, []);
68
68
  const lastChunk = chunks[chunks.length - 1];
69
+ if (!lastChunk) {
70
+ chunks.push({
71
+ start: 0,
72
+ end: sourceString.length,
73
+ highlight: false
74
+ });
75
+ }
69
76
  if (lastChunk && lastChunk.end < sourceString.length) {
70
77
  chunks.push({
71
78
  start: lastChunk.end,
@@ -191,6 +191,8 @@ var stdin_default = defineComponent({
191
191
  const checkClose = (event) => {
192
192
  var _a;
193
193
  const swipeItemEl = (_a = swipeItem.value) == null ? void 0 : _a.$el;
194
+ if (!swipeItemEl)
195
+ return;
194
196
  const imageEl = swipeItemEl.firstElementChild;
195
197
  const isClickOverlay = event.target === swipeItemEl;
196
198
  const isClickImage = imageEl == null ? void 0 : imageEl.contains(event.target);
@@ -84,7 +84,11 @@ var stdin_default = defineComponent({
84
84
  const match = getMatchAnchor(selectActiveIndex);
85
85
  if (match) {
86
86
  const rect = match.getRect(scrollParent.value, scrollParentRect);
87
- active = getActiveAnchor(rect.top, rects);
87
+ if (props.sticky && props.stickyOffsetTop) {
88
+ active = getActiveAnchor(rect.top - props.stickyOffsetTop, rects);
89
+ } else {
90
+ active = getActiveAnchor(rect.top, rects);
91
+ }
88
92
  }
89
93
  } else {
90
94
  active = getActiveAnchor(scrollTop, rects);
@@ -157,7 +161,11 @@ var stdin_default = defineComponent({
157
161
  return;
158
162
  }
159
163
  if (props.sticky && props.stickyOffsetTop) {
160
- setRootScrollTop(getRootScrollTop() - props.stickyOffsetTop);
164
+ if (getRootScrollTop() === offsetHeight - scrollParentRect.height) {
165
+ setRootScrollTop(getRootScrollTop());
166
+ } else {
167
+ setRootScrollTop(getRootScrollTop() - props.stickyOffsetTop);
168
+ }
161
169
  }
162
170
  emit("select", match.index);
163
171
  }
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.8.11";
109
+ export const version: "4.9.1";
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.8.11";
102
+ const version = "4.9.1";
103
103
  function install(app) {
104
104
  const components = [
105
105
  ActionBar,
@@ -11,6 +11,10 @@ export declare const pickerGroupProps: {
11
11
  default: number;
12
12
  };
13
13
  nextStepText: StringConstructor;
14
+ showToolbar: {
15
+ type: BooleanConstructor;
16
+ default: true;
17
+ };
14
18
  } & {
15
19
  title: StringConstructor;
16
20
  cancelButtonText: StringConstructor;
@@ -27,6 +31,10 @@ declare const _default: import("vue").DefineComponent<{
27
31
  default: number;
28
32
  };
29
33
  nextStepText: StringConstructor;
34
+ showToolbar: {
35
+ type: BooleanConstructor;
36
+ default: true;
37
+ };
30
38
  } & {
31
39
  title: StringConstructor;
32
40
  cancelButtonText: StringConstructor;
@@ -41,6 +49,10 @@ declare const _default: import("vue").DefineComponent<{
41
49
  default: number;
42
50
  };
43
51
  nextStepText: StringConstructor;
52
+ showToolbar: {
53
+ type: BooleanConstructor;
54
+ default: true;
55
+ };
44
56
  } & {
45
57
  title: StringConstructor;
46
58
  cancelButtonText: StringConstructor;
@@ -50,6 +62,7 @@ declare const _default: import("vue").DefineComponent<{
50
62
  onConfirm?: ((...args: any[]) => any) | undefined;
51
63
  "onUpdate:activeTab"?: ((...args: any[]) => any) | undefined;
52
64
  }, {
65
+ showToolbar: boolean;
53
66
  tabs: string[];
54
67
  activeTab: string | number;
55
68
  }, {}>;
@@ -1,6 +1,6 @@
1
1
  import { createVNode as _createVNode } from "vue";
2
2
  import { defineComponent, Comment, Fragment } from "vue";
3
- import { flat, pick, extend, makeArrayProp, makeNumericProp, createNamespace } from "../utils/index.mjs";
3
+ import { flat, pick, extend, makeArrayProp, makeNumericProp, createNamespace, truthProp } from "../utils/index.mjs";
4
4
  import { useChildren } from "@vant/use";
5
5
  import { useSyncPropRef } from "../composables/use-sync-prop-ref.mjs";
6
6
  import { Tab } from "../tab/index.mjs";
@@ -11,7 +11,8 @@ const PICKER_GROUP_KEY = Symbol(name);
11
11
  const pickerGroupProps = extend({
12
12
  tabs: makeArrayProp(),
13
13
  activeTab: makeNumericProp(0),
14
- nextStepText: String
14
+ nextStepText: String,
15
+ showToolbar: truthProp
15
16
  }, pickerToolbarProps);
16
17
  var stdin_default = defineComponent({
17
18
  name,
@@ -50,13 +51,13 @@ var stdin_default = defineComponent({
50
51
  const confirmButtonText = showNextButton() ? props.nextStepText : props.confirmButtonText;
51
52
  return _createVNode("div", {
52
53
  "class": bem()
53
- }, [_createVNode(Toolbar, {
54
+ }, [props.showToolbar ? _createVNode(Toolbar, {
54
55
  "title": props.title,
55
56
  "cancelButtonText": props.cancelButtonText,
56
57
  "confirmButtonText": confirmButtonText,
57
58
  "onConfirm": onConfirm,
58
59
  "onCancel": onCancel
59
- }, pick(slots, pickerToolbarSlots)), _createVNode(Tabs, {
60
+ }, pick(slots, pickerToolbarSlots)) : null, _createVNode(Tabs, {
60
61
  "active": activeTab.value,
61
62
  "onUpdate:active": ($event) => activeTab.value = $event,
62
63
  "class": bem("tabs"),
@@ -9,6 +9,10 @@ export declare const PickerGroup: import("../utils").WithInstall<import("vue").D
9
9
  default: number;
10
10
  };
11
11
  nextStepText: StringConstructor;
12
+ showToolbar: {
13
+ type: BooleanConstructor;
14
+ default: true;
15
+ };
12
16
  } & {
13
17
  title: StringConstructor;
14
18
  cancelButtonText: StringConstructor;
@@ -23,6 +27,10 @@ export declare const PickerGroup: import("../utils").WithInstall<import("vue").D
23
27
  default: number;
24
28
  };
25
29
  nextStepText: StringConstructor;
30
+ showToolbar: {
31
+ type: BooleanConstructor;
32
+ default: true;
33
+ };
26
34
  } & {
27
35
  title: StringConstructor;
28
36
  cancelButtonText: StringConstructor;
@@ -32,6 +40,7 @@ export declare const PickerGroup: import("../utils").WithInstall<import("vue").D
32
40
  onConfirm?: ((...args: any[]) => any) | undefined;
33
41
  "onUpdate:activeTab"?: ((...args: any[]) => any) | undefined;
34
42
  }, {
43
+ showToolbar: boolean;
35
44
  tabs: string[];
36
45
  activeTab: string | number;
37
46
  }, {}>>;
@@ -223,6 +223,7 @@ var stdin_default = defineComponent({
223
223
  "readonly": props.disableInput,
224
224
  "inputmode": props.integer ? "numeric" : "decimal",
225
225
  "placeholder": props.placeholder,
226
+ "autocomplete": "off",
226
227
  "aria-valuemax": props.max,
227
228
  "aria-valuemin": props.min,
228
229
  "aria-valuenow": current.value,
package/es/tabs/index.css CHANGED
@@ -1 +1 @@
1
- :root,:host{--van-tab-text-color: var(--van-gray-7);--van-tab-active-text-color: var(--van-text-color);--van-tab-disabled-text-color: var(--van-text-color-3);--van-tab-font-size: var(--van-font-size-md);--van-tab-line-height: var(--van-line-height-md);--van-tabs-default-color: var(--van-primary-color);--van-tabs-line-height: 44px;--van-tabs-card-height: 30px;--van-tabs-nav-background: var(--van-background-2);--van-tabs-bottom-bar-width: 40px;--van-tabs-bottom-bar-height: 3px;--van-tabs-bottom-bar-color: var(--van-primary-color)}.van-tab{position:relative;display:flex;flex:1;align-items:center;justify-content:center;box-sizing:border-box;padding:0 var(--van-padding-base);color:var(--van-tab-text-color);font-size:var(--van-tab-font-size);line-height:var(--van-tab-line-height);cursor:pointer}.van-tab--active{color:var(--van-tab-active-text-color);font-weight:var(--van-font-bold)}.van-tab--disabled{color:var(--van-tab-disabled-text-color);cursor:not-allowed}.van-tab--grow{flex:1 0 auto;padding:0 var(--van-padding-sm)}.van-tab--shrink{flex:none;padding:0 var(--van-padding-xs)}.van-tab--card{color:var(--van-tabs-default-color);border-right:var(--van-border-width) solid var(--van-tabs-default-color)}.van-tab--card:last-child{border-right:none}.van-tab--card.van-tab--active{color:var(--van-white);background-color:var(--van-tabs-default-color)}.van-tab--card--disabled{color:var(--van-tab-disabled-text-color)}.van-tab__text--ellipsis{display:-webkit-box;overflow:hidden;-webkit-line-clamp:1;-webkit-box-orient:vertical}.van-tabs{position:relative}.van-tabs__wrap{overflow:hidden}.van-tabs__wrap--page-top{position:fixed}.van-tabs__wrap--content-bottom{top:auto;bottom:0}.van-tabs__nav{position:relative;display:flex;background:var(--van-tabs-nav-background);-webkit-user-select:none;user-select:none}.van-tabs__nav--complete{overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}.van-tabs__nav--complete::-webkit-scrollbar{display:none}.van-tabs__nav--line{box-sizing:content-box;height:100%;padding-bottom:15px}.van-tabs__nav--line.van-tabs__nav--shrink,.van-tabs__nav--line.van-tabs__nav--complete{padding-right:var(--van-padding-xs);padding-left:var(--van-padding-xs)}.van-tabs__nav--card{box-sizing:border-box;height:var(--van-tabs-card-height);margin:0 var(--van-padding-md);border:var(--van-border-width) solid var(--van-tabs-default-color);border-radius:var(--van-radius-sm)}.van-tabs__nav--card.van-tabs__nav--shrink{display:inline-flex}.van-tabs__line{position:absolute;bottom:15px;left:0;z-index:1;width:var(--van-tabs-bottom-bar-width);height:var(--van-tabs-bottom-bar-height);background:var(--van-tabs-bottom-bar-color);border-radius:var(--van-tabs-bottom-bar-height)}.van-tabs__track{position:relative;display:flex;width:100%;height:100%;will-change:left}.van-tabs__content--animated{overflow:hidden}.van-tabs--line .van-tabs__wrap{height:var(--van-tabs-line-height)}.van-tabs--card>.van-tabs__wrap{height:var(--van-tabs-card-height)}
1
+ :root,:host{--van-tab-text-color: var(--van-gray-7);--van-tab-active-text-color: var(--van-text-color);--van-tab-disabled-text-color: var(--van-text-color-3);--van-tab-font-size: var(--van-font-size-md);--van-tab-line-height: var(--van-line-height-md);--van-tabs-default-color: var(--van-primary-color);--van-tabs-line-height: 44px;--van-tabs-card-height: 30px;--van-tabs-nav-background: var(--van-background-2);--van-tabs-bottom-bar-width: 40px;--van-tabs-bottom-bar-height: 3px;--van-tabs-bottom-bar-color: var(--van-primary-color)}.van-tab{position:relative;display:flex;flex:1;align-items:center;justify-content:center;box-sizing:border-box;padding:0 var(--van-padding-base);color:var(--van-tab-text-color);font-size:var(--van-tab-font-size);line-height:var(--van-tab-line-height);cursor:pointer}.van-tab--active{color:var(--van-tab-active-text-color);font-weight:var(--van-font-bold)}.van-tab--disabled{color:var(--van-tab-disabled-text-color);cursor:not-allowed}.van-tab--grow{flex:1 0 auto;padding:0 var(--van-padding-sm)}.van-tab--shrink{flex:none;padding:0 var(--van-padding-xs)}.van-tab--card{color:var(--van-tabs-default-color);border-right:var(--van-border-width) solid var(--van-tabs-default-color)}.van-tab--card:last-child{border-right:none}.van-tab--card.van-tab--active{color:var(--van-white);background-color:var(--van-tabs-default-color)}.van-tab--card.van-tab--disabled{color:var(--van-tab-disabled-text-color)}.van-tab__text--ellipsis{display:-webkit-box;overflow:hidden;-webkit-line-clamp:1;-webkit-box-orient:vertical}.van-tabs{position:relative}.van-tabs__wrap{overflow:hidden}.van-tabs__wrap--page-top{position:fixed}.van-tabs__wrap--content-bottom{top:auto;bottom:0}.van-tabs__nav{position:relative;display:flex;background:var(--van-tabs-nav-background);-webkit-user-select:none;user-select:none}.van-tabs__nav--complete{overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}.van-tabs__nav--complete::-webkit-scrollbar{display:none}.van-tabs__nav--line{box-sizing:content-box;height:100%;padding-bottom:15px}.van-tabs__nav--line.van-tabs__nav--shrink,.van-tabs__nav--line.van-tabs__nav--complete{padding-right:var(--van-padding-xs);padding-left:var(--van-padding-xs)}.van-tabs__nav--card{box-sizing:border-box;height:var(--van-tabs-card-height);margin:0 var(--van-padding-md);border:var(--van-border-width) solid var(--van-tabs-default-color);border-radius:var(--van-radius-sm)}.van-tabs__nav--card.van-tabs__nav--shrink{display:inline-flex}.van-tabs__line{position:absolute;bottom:15px;left:0;z-index:1;width:var(--van-tabs-bottom-bar-width);height:var(--van-tabs-bottom-bar-height);background:var(--van-tabs-bottom-bar-color);border-radius:var(--van-tabs-bottom-bar-height)}.van-tabs__track{position:relative;display:flex;width:100%;height:100%;will-change:left}.van-tabs__content--animated{overflow:hidden}.van-tabs--line .van-tabs__wrap{height:var(--van-tabs-line-height)}.van-tabs--card>.van-tabs__wrap{height:var(--van-tabs-card-height)}
@@ -27,4 +27,4 @@ export type RequiredParams<T> = T extends (...args: infer P) => infer R ? (...ar
27
27
  export declare function pick<T, U extends keyof T>(obj: T, keys: ReadonlyArray<U>, ignoreUndefined?: boolean): Writeable<Pick<T, U>>;
28
28
  export declare const isSameValue: (newValue: unknown, oldValue: unknown) => boolean;
29
29
  export declare const toArray: <T>(item: T | T[]) => T[];
30
- export declare const flat: <T>(arr: (T | T[])[]) => T[];
30
+ export declare const flat: <T>(arr: Array<T | T[]>) => T[];
@@ -1,18 +1,18 @@
1
- import { type ExtractPropTypes } from 'vue';
1
+ import { type ExtractPropTypes, type PropType } from 'vue';
2
2
  import { AddressListAddress } from './AddressListItem';
3
3
  export declare const addressListProps: {
4
4
  list: {
5
- type: import("vue").PropType<AddressListAddress[]>;
5
+ type: PropType<AddressListAddress[]>;
6
6
  default: () => never[];
7
7
  };
8
- modelValue: (NumberConstructor | StringConstructor)[];
8
+ modelValue: PropType<string | number | (string | number)[]>;
9
9
  switchable: {
10
10
  type: BooleanConstructor;
11
11
  default: true;
12
12
  };
13
13
  disabledText: StringConstructor;
14
14
  disabledList: {
15
- type: import("vue").PropType<AddressListAddress[]>;
15
+ type: PropType<AddressListAddress[]>;
16
16
  default: () => never[];
17
17
  };
18
18
  showAddButton: {
@@ -22,24 +22,24 @@ export declare const addressListProps: {
22
22
  addButtonText: StringConstructor;
23
23
  defaultTagText: StringConstructor;
24
24
  rightIcon: {
25
- type: import("vue").PropType<string>;
25
+ type: PropType<string>;
26
26
  default: string;
27
27
  };
28
28
  };
29
29
  export type AddressListProps = ExtractPropTypes<typeof addressListProps>;
30
30
  declare const _default: import("vue").DefineComponent<{
31
31
  list: {
32
- type: import("vue").PropType<AddressListAddress[]>;
32
+ type: PropType<AddressListAddress[]>;
33
33
  default: () => never[];
34
34
  };
35
- modelValue: (NumberConstructor | StringConstructor)[];
35
+ modelValue: PropType<string | number | (string | number)[]>;
36
36
  switchable: {
37
37
  type: BooleanConstructor;
38
38
  default: true;
39
39
  };
40
40
  disabledText: StringConstructor;
41
41
  disabledList: {
42
- type: import("vue").PropType<AddressListAddress[]>;
42
+ type: PropType<AddressListAddress[]>;
43
43
  default: () => never[];
44
44
  };
45
45
  showAddButton: {
@@ -49,22 +49,22 @@ declare const _default: import("vue").DefineComponent<{
49
49
  addButtonText: StringConstructor;
50
50
  defaultTagText: StringConstructor;
51
51
  rightIcon: {
52
- type: import("vue").PropType<string>;
52
+ type: PropType<string>;
53
53
  default: string;
54
54
  };
55
55
  }, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "add" | "update:modelValue" | "edit" | "clickItem" | "editDisabled" | "selectDisabled")[], "select" | "add" | "update:modelValue" | "edit" | "clickItem" | "editDisabled" | "selectDisabled", import("vue").PublicProps, Readonly<ExtractPropTypes<{
56
56
  list: {
57
- type: import("vue").PropType<AddressListAddress[]>;
57
+ type: PropType<AddressListAddress[]>;
58
58
  default: () => never[];
59
59
  };
60
- modelValue: (NumberConstructor | StringConstructor)[];
60
+ modelValue: PropType<string | number | (string | number)[]>;
61
61
  switchable: {
62
62
  type: BooleanConstructor;
63
63
  default: true;
64
64
  };
65
65
  disabledText: StringConstructor;
66
66
  disabledList: {
67
- type: import("vue").PropType<AddressListAddress[]>;
67
+ type: PropType<AddressListAddress[]>;
68
68
  default: () => never[];
69
69
  };
70
70
  showAddButton: {
@@ -74,7 +74,7 @@ declare const _default: import("vue").DefineComponent<{
74
74
  addButtonText: StringConstructor;
75
75
  defaultTagText: StringConstructor;
76
76
  rightIcon: {
77
- type: import("vue").PropType<string>;
77
+ type: PropType<string>;
78
78
  default: string;
79
79
  };
80
80
  }>> & {
@@ -36,11 +36,12 @@ var import_vue2 = require("vue");
36
36
  var import_utils = require("../utils");
37
37
  var import_button = require("../button");
38
38
  var import_radio_group = require("../radio-group");
39
+ var import_checkbox_group = require("../checkbox-group");
39
40
  var import_AddressListItem = __toESM(require("./AddressListItem"));
40
41
  const [name, bem, t] = (0, import_utils.createNamespace)("address-list");
41
42
  const addressListProps = {
42
43
  list: (0, import_utils.makeArrayProp)(),
43
- modelValue: import_utils.numericProp,
44
+ modelValue: [...import_utils.numericProp, Array],
44
45
  switchable: import_utils.truthProp,
45
46
  disabledText: String,
46
47
  disabledList: (0, import_utils.makeArrayProp)(),
@@ -57,6 +58,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
57
58
  slots,
58
59
  emit
59
60
  }) {
61
+ const singleChoice = (0, import_vue2.computed)(() => !Array.isArray(props.modelValue));
60
62
  const renderItem = (item, index, disabled) => {
61
63
  const onEdit = () => emit(disabled ? "editDisabled" : "edit", item, index);
62
64
  const onClick = (event) => emit("clickItem", item, index, {
@@ -65,7 +67,16 @@ var stdin_default = (0, import_vue2.defineComponent)({
65
67
  const onSelect = () => {
66
68
  emit(disabled ? "selectDisabled" : "select", item, index);
67
69
  if (!disabled) {
68
- emit("update:modelValue", item.id);
70
+ if (singleChoice.value) {
71
+ emit("update:modelValue", item.id);
72
+ } else {
73
+ const value = props.modelValue;
74
+ if (value.includes(item.id)) {
75
+ emit("update:modelValue", value.filter((id) => id !== item.id));
76
+ } else {
77
+ emit("update:modelValue", [...value, item.id]);
78
+ }
79
+ }
69
80
  }
70
81
  };
71
82
  return (0, import_vue.createVNode)(import_AddressListItem.default, {
@@ -73,6 +84,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
73
84
  "address": item,
74
85
  "disabled": disabled,
75
86
  "switchable": props.switchable,
87
+ "singleChoice": singleChoice.value,
76
88
  "defaultTagText": props.defaultTagText,
77
89
  "rightIcon": props.rightIcon,
78
90
  "onEdit": onEdit,
@@ -107,7 +119,11 @@ var stdin_default = (0, import_vue2.defineComponent)({
107
119
  }, [props.disabledText]);
108
120
  return (0, import_vue.createVNode)("div", {
109
121
  "class": bem()
110
- }, [(_a = slots.top) == null ? void 0 : _a.call(slots), (0, import_vue.createVNode)(import_radio_group.RadioGroup, {
122
+ }, [(_a = slots.top) == null ? void 0 : _a.call(slots), !singleChoice.value && Array.isArray(props.modelValue) ? (0, import_vue.createVNode)(import_checkbox_group.CheckboxGroup, {
123
+ "modelValue": props.modelValue
124
+ }, {
125
+ default: () => [List]
126
+ }) : (0, import_vue.createVNode)(import_radio_group.RadioGroup, {
111
127
  "modelValue": props.modelValue
112
128
  }, {
113
129
  default: () => [List]
@@ -14,6 +14,7 @@ declare const _default: import("vue").DefineComponent<{
14
14
  };
15
15
  disabled: BooleanConstructor;
16
16
  switchable: BooleanConstructor;
17
+ singleChoice: BooleanConstructor;
17
18
  defaultTagText: StringConstructor;
18
19
  rightIcon: {
19
20
  type: PropType<string>;
@@ -26,6 +27,7 @@ declare const _default: import("vue").DefineComponent<{
26
27
  };
27
28
  disabled: BooleanConstructor;
28
29
  switchable: BooleanConstructor;
30
+ singleChoice: BooleanConstructor;
29
31
  defaultTagText: StringConstructor;
30
32
  rightIcon: {
31
33
  type: PropType<string>;
@@ -39,5 +41,6 @@ declare const _default: import("vue").DefineComponent<{
39
41
  disabled: boolean;
40
42
  rightIcon: string;
41
43
  switchable: boolean;
44
+ singleChoice: boolean;
42
45
  }, {}>;
43
46
  export default _default;
@@ -27,6 +27,7 @@ var import_tag = require("../tag");
27
27
  var import_icon = require("../icon");
28
28
  var import_cell = require("../cell");
29
29
  var import_radio = require("../radio");
30
+ var import_checkbox = require("../checkbox");
30
31
  const [name, bem] = (0, import_utils.createNamespace)("address-item");
31
32
  var stdin_default = (0, import_vue2.defineComponent)({
32
33
  name,
@@ -34,6 +35,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
34
35
  address: (0, import_utils.makeRequiredProp)(Object),
35
36
  disabled: Boolean,
36
37
  switchable: Boolean,
38
+ singleChoice: Boolean,
37
39
  defaultTagText: String,
38
40
  rightIcon: (0, import_utils.makeStringProp)("edit")
39
41
  },
@@ -75,7 +77,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
75
77
  const {
76
78
  address,
77
79
  disabled,
78
- switchable
80
+ switchable,
81
+ singleChoice
79
82
  } = props;
80
83
  const Info = [(0, import_vue.createVNode)("div", {
81
84
  "class": bem("name")
@@ -83,12 +86,21 @@ var stdin_default = (0, import_vue2.defineComponent)({
83
86
  "class": bem("address")
84
87
  }, [address.address])];
85
88
  if (switchable && !disabled) {
86
- return (0, import_vue.createVNode)(import_radio.Radio, {
87
- "name": address.id,
88
- "iconSize": 18
89
- }, {
90
- default: () => [Info]
91
- });
89
+ if (singleChoice) {
90
+ return (0, import_vue.createVNode)(import_radio.Radio, {
91
+ "name": address.id,
92
+ "iconSize": 18
93
+ }, {
94
+ default: () => [Info]
95
+ });
96
+ } else {
97
+ return (0, import_vue.createVNode)(import_checkbox.Checkbox, {
98
+ "name": address.id,
99
+ "iconSize": 18
100
+ }, {
101
+ default: () => [Info]
102
+ });
103
+ }
92
104
  }
93
105
  return Info;
94
106
  };
@@ -3,7 +3,7 @@ export declare const AddressList: import("../utils").WithInstall<import("vue").D
3
3
  type: import("vue").PropType<import("./AddressListItem").AddressListAddress[]>;
4
4
  default: () => never[];
5
5
  };
6
- modelValue: (NumberConstructor | StringConstructor)[];
6
+ modelValue: import("vue").PropType<string | number | (string | number)[]>;
7
7
  switchable: {
8
8
  type: BooleanConstructor;
9
9
  default: true;
@@ -28,7 +28,7 @@ export declare const AddressList: import("../utils").WithInstall<import("vue").D
28
28
  type: import("vue").PropType<import("./AddressListItem").AddressListAddress[]>;
29
29
  default: () => never[];
30
30
  };
31
- modelValue: (NumberConstructor | StringConstructor)[];
31
+ modelValue: import("vue").PropType<string | number | (string | number)[]>;
32
32
  switchable: {
33
33
  type: BooleanConstructor;
34
34
  default: true;
@@ -6,6 +6,7 @@ require("../../cell/index.css");
6
6
  require("../../loading/index.css");
7
7
  require("../../button/index.css");
8
8
  require("../../radio-group/index.css");
9
+ require("../../checkbox-group/index.css");
9
10
  require("../../checkbox/index.css");
10
11
  require("../../radio/index.css");
11
12
  require("../index.css");
package/lib/area/utils.js CHANGED
@@ -61,9 +61,9 @@ function formatDataForCascade({
61
61
  const showCounty = +columnsNum > 2;
62
62
  const getProvinceChildren = () => {
63
63
  if (showCity) {
64
- return placeholder.length ? [
64
+ return placeholder.length > 1 ? [
65
65
  makeOption(
66
- placeholder[0],
66
+ placeholder[1],
67
67
  AREA_EMPTY_CODE,
68
68
  showCounty ? [] : void 0
69
69
  )
@@ -81,7 +81,7 @@ function formatDataForCascade({
81
81
  if (showCity) {
82
82
  const getCityChildren = () => {
83
83
  if (showCounty) {
84
- return placeholder.length ? [makeOption(placeholder[1])] : [];
84
+ return placeholder.length > 2 ? [makeOption(placeholder[2])] : [];
85
85
  }
86
86
  };
87
87
  Object.keys(city).forEach((code) => {
@@ -1,12 +1,16 @@
1
1
  import { type PropType, type ExtractPropTypes } from 'vue';
2
2
  import { PopupPosition } from '../popup';
3
- import type { CalendarType, CalendarDayItem } from './types';
3
+ import type { CalendarType, CalendarSwitchMode, CalendarDayItem } from './types';
4
4
  export declare const calendarProps: {
5
5
  show: BooleanConstructor;
6
6
  type: {
7
7
  type: PropType<CalendarType>;
8
8
  default: CalendarType;
9
9
  };
10
+ switchMode: {
11
+ type: PropType<CalendarSwitchMode>;
12
+ default: CalendarSwitchMode;
13
+ };
10
14
  title: StringConstructor;
11
15
  color: StringConstructor;
12
16
  round: {
@@ -74,12 +78,10 @@ export declare const calendarProps: {
74
78
  minDate: {
75
79
  type: DateConstructor;
76
80
  validator: (val: unknown) => val is Date;
77
- default: () => Date;
78
81
  };
79
82
  maxDate: {
80
83
  type: DateConstructor;
81
84
  validator: (val: unknown) => val is Date;
82
- default: () => Date;
83
85
  };
84
86
  firstDayOfWeek: {
85
87
  type: (NumberConstructor | StringConstructor)[];
@@ -94,6 +96,10 @@ declare const _default: import("vue").DefineComponent<{
94
96
  type: PropType<CalendarType>;
95
97
  default: CalendarType;
96
98
  };
99
+ switchMode: {
100
+ type: PropType<CalendarSwitchMode>;
101
+ default: CalendarSwitchMode;
102
+ };
97
103
  title: StringConstructor;
98
104
  color: StringConstructor;
99
105
  round: {
@@ -161,24 +167,26 @@ declare const _default: import("vue").DefineComponent<{
161
167
  minDate: {
162
168
  type: DateConstructor;
163
169
  validator: (val: unknown) => val is Date;
164
- default: () => Date;
165
170
  };
166
171
  maxDate: {
167
172
  type: DateConstructor;
168
173
  validator: (val: unknown) => val is Date;
169
- default: () => Date;
170
174
  };
171
175
  firstDayOfWeek: {
172
176
  type: (NumberConstructor | StringConstructor)[];
173
177
  default: number;
174
178
  validator: (val: number) => boolean;
175
179
  };
176
- }, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:show" | "confirm" | "clickDisabledDate" | "clickSubtitle" | "unselect" | "monthShow" | "overRange")[], "select" | "update:show" | "confirm" | "clickDisabledDate" | "clickSubtitle" | "unselect" | "monthShow" | "overRange", import("vue").PublicProps, Readonly<ExtractPropTypes<{
180
+ }, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:show" | "confirm" | "clickDisabledDate" | "clickSubtitle" | "panelChange" | "unselect" | "monthShow" | "overRange")[], "select" | "update:show" | "confirm" | "clickDisabledDate" | "clickSubtitle" | "panelChange" | "unselect" | "monthShow" | "overRange", import("vue").PublicProps, Readonly<ExtractPropTypes<{
177
181
  show: BooleanConstructor;
178
182
  type: {
179
183
  type: PropType<CalendarType>;
180
184
  default: CalendarType;
181
185
  };
186
+ switchMode: {
187
+ type: PropType<CalendarSwitchMode>;
188
+ default: CalendarSwitchMode;
189
+ };
182
190
  title: StringConstructor;
183
191
  color: StringConstructor;
184
192
  round: {
@@ -246,12 +254,10 @@ declare const _default: import("vue").DefineComponent<{
246
254
  minDate: {
247
255
  type: DateConstructor;
248
256
  validator: (val: unknown) => val is Date;
249
- default: () => Date;
250
257
  };
251
258
  maxDate: {
252
259
  type: DateConstructor;
253
260
  validator: (val: unknown) => val is Date;
254
- default: () => Date;
255
261
  };
256
262
  firstDayOfWeek: {
257
263
  type: (NumberConstructor | StringConstructor)[];
@@ -264,6 +270,7 @@ declare const _default: import("vue").DefineComponent<{
264
270
  onConfirm?: ((...args: any[]) => any) | undefined;
265
271
  onClickDisabledDate?: ((...args: any[]) => any) | undefined;
266
272
  onClickSubtitle?: ((...args: any[]) => any) | undefined;
273
+ onPanelChange?: ((...args: any[]) => any) | undefined;
267
274
  onUnselect?: ((...args: any[]) => any) | undefined;
268
275
  onMonthShow?: ((...args: any[]) => any) | undefined;
269
276
  onOverRange?: ((...args: any[]) => any) | undefined;
@@ -278,6 +285,7 @@ declare const _default: import("vue").DefineComponent<{
278
285
  closeOnClickOverlay: boolean;
279
286
  closeOnPopstate: boolean;
280
287
  safeAreaInsetTop: boolean;
288
+ switchMode: CalendarSwitchMode;
281
289
  poppable: boolean;
282
290
  maxRange: string | number;
283
291
  showMark: boolean;
@@ -286,8 +294,6 @@ declare const _default: import("vue").DefineComponent<{
286
294
  allowSameDay: boolean;
287
295
  showSubtitle: boolean;
288
296
  showRangePrompt: boolean;
289
- minDate: Date;
290
- maxDate: Date;
291
297
  firstDayOfWeek: string | number;
292
298
  }, {}>;
293
299
  export default _default;