vant 4.8.10 → 4.9.0

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 (58) hide show
  1. package/README.md +7 -5
  2. package/es/calendar/Calendar.d.ts +16 -10
  3. package/es/calendar/Calendar.mjs +83 -53
  4. package/es/calendar/CalendarHeader.d.ts +16 -1
  5. package/es/calendar/CalendarHeader.mjs +71 -7
  6. package/es/calendar/CalendarMonth.d.ts +6 -24
  7. package/es/calendar/CalendarMonth.mjs +6 -4
  8. package/es/calendar/index.css +1 -1
  9. package/es/calendar/index.d.ts +11 -7
  10. package/es/calendar/types.d.ts +4 -0
  11. package/es/calendar/utils.d.ts +6 -0
  12. package/es/calendar/utils.mjs +20 -0
  13. package/es/dropdown-item/DropdownItem.mjs +10 -3
  14. package/es/dropdown-item/index.css +1 -1
  15. package/es/dropdown-item/types.d.ts +1 -0
  16. package/es/dropdown-menu/index.css +1 -1
  17. package/es/dropdown-menu/types.d.ts +1 -0
  18. package/es/highlight/Highlight.mjs +7 -0
  19. package/es/image-preview/ImagePreviewItem.mjs +2 -0
  20. package/es/index-bar/IndexBar.mjs +10 -2
  21. package/es/index.d.ts +1 -1
  22. package/es/index.mjs +1 -1
  23. package/es/picker-group/PickerGroup.d.ts +13 -0
  24. package/es/picker-group/PickerGroup.mjs +5 -4
  25. package/es/picker-group/index.d.ts +9 -0
  26. package/es/utils/basic.d.ts +1 -1
  27. package/lib/calendar/Calendar.d.ts +16 -10
  28. package/lib/calendar/Calendar.js +82 -52
  29. package/lib/calendar/CalendarHeader.d.ts +16 -1
  30. package/lib/calendar/CalendarHeader.js +68 -4
  31. package/lib/calendar/CalendarMonth.d.ts +6 -24
  32. package/lib/calendar/CalendarMonth.js +6 -4
  33. package/lib/calendar/index.css +1 -1
  34. package/lib/calendar/index.d.ts +11 -7
  35. package/lib/calendar/types.d.ts +4 -0
  36. package/lib/calendar/utils.d.ts +6 -0
  37. package/lib/calendar/utils.js +20 -0
  38. package/lib/dropdown-item/DropdownItem.js +10 -3
  39. package/lib/dropdown-item/index.css +1 -1
  40. package/lib/dropdown-item/types.d.ts +1 -0
  41. package/lib/dropdown-menu/index.css +1 -1
  42. package/lib/dropdown-menu/types.d.ts +1 -0
  43. package/lib/highlight/Highlight.js +7 -0
  44. package/lib/image-preview/ImagePreviewItem.js +2 -0
  45. package/lib/index-bar/IndexBar.js +10 -2
  46. package/lib/index.css +1 -1
  47. package/lib/index.d.ts +1 -1
  48. package/lib/index.js +1 -1
  49. package/lib/picker-group/PickerGroup.d.ts +13 -0
  50. package/lib/picker-group/PickerGroup.js +4 -3
  51. package/lib/picker-group/index.d.ts +9 -0
  52. package/lib/utils/basic.d.ts +1 -1
  53. package/lib/vant.cjs.js +203 -69
  54. package/lib/vant.es.js +203 -69
  55. package/lib/vant.js +204 -70
  56. package/lib/vant.min.js +3 -3
  57. package/lib/web-types.json +1 -1
  58. package/package.json +13 -13
@@ -104,8 +104,14 @@ var stdin_default = (0, import_vue2.defineComponent)({
104
104
  const {
105
105
  activeColor
106
106
  } = parent.props;
107
+ const {
108
+ disabled
109
+ } = option;
107
110
  const active = option.value === props.modelValue;
108
111
  const onClick = () => {
112
+ if (disabled) {
113
+ return;
114
+ }
109
115
  state.showPopup = false;
110
116
  if (option.value !== props.modelValue) {
111
117
  emit("update:modelValue", option.value);
@@ -116,7 +122,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
116
122
  if (active) {
117
123
  return (0, import_vue.createVNode)(import_icon.Icon, {
118
124
  "class": bem("icon"),
119
- "color": activeColor,
125
+ "color": disabled ? void 0 : activeColor,
120
126
  "name": "success"
121
127
  }, null);
122
128
  }
@@ -127,13 +133,14 @@ var stdin_default = (0, import_vue2.defineComponent)({
127
133
  "icon": option.icon,
128
134
  "title": option.text,
129
135
  "class": bem("option", {
130
- active
136
+ active,
137
+ disabled
131
138
  }),
132
139
  "style": {
133
140
  color: active ? activeColor : ""
134
141
  },
135
142
  "tabindex": active ? 0 : -1,
136
- "clickable": true,
143
+ "clickable": !disabled,
137
144
  "onClick": onClick
138
145
  }, {
139
146
  value: renderIcon
@@ -1 +1 @@
1
- :root,:host{--van-dropdown-item-z-index: 10}.van-dropdown-item{position:fixed;right:0;left:0;z-index:var(--van-dropdown-item-z-index);overflow:hidden}.van-dropdown-item__icon{display:block;line-height:inherit}.van-dropdown-item__option{text-align:left}.van-dropdown-item__option--active,.van-dropdown-item__option--active .van-dropdown-item__icon{color:var(--van-dropdown-menu-option-active-color)}.van-dropdown-item--up{top:0}.van-dropdown-item--down{bottom:0}.van-dropdown-item__content{position:absolute;max-height:var(--van-dropdown-menu-content-max-height)}
1
+ :root,:host{--van-dropdown-item-z-index: 10}.van-dropdown-item{position:fixed;right:0;left:0;z-index:var(--van-dropdown-item-z-index);overflow:hidden}.van-dropdown-item__icon{display:block;line-height:inherit}.van-dropdown-item__option{text-align:left}.van-dropdown-item__option--active,.van-dropdown-item__option--active .van-dropdown-item__icon{color:var(--van-dropdown-menu-option-active-color)}.van-dropdown-item__option--disabled,.van-dropdown-item__option--disabled .van-dropdown-item__icon{color:var(--van-dropdown-menu-option-disabled-color)}.van-dropdown-item--up{top:0}.van-dropdown-item--down{bottom:0}.van-dropdown-item__content{position:absolute;max-height:var(--van-dropdown-menu-content-max-height)}
@@ -3,6 +3,7 @@ import type { VNode, ComponentPublicInstance } from 'vue';
3
3
  import type { Numeric } from '../utils';
4
4
  export type DropdownItemOptionValue = Numeric | boolean;
5
5
  export type DropdownItemOption = {
6
+ disabled?: boolean;
6
7
  text: string;
7
8
  icon?: string;
8
9
  value: DropdownItemOptionValue;
@@ -1 +1 @@
1
- :root,:host{--van-dropdown-menu-height: 48px;--van-dropdown-menu-background: var(--van-background-2);--van-dropdown-menu-shadow: 0 2px 12px rgba(100, 101, 102, .12);--van-dropdown-menu-title-font-size: 15px;--van-dropdown-menu-title-text-color: var(--van-text-color);--van-dropdown-menu-title-active-text-color: var(--van-primary-color);--van-dropdown-menu-title-disabled-text-color: var(--van-text-color-2);--van-dropdown-menu-title-padding: 0 var(--van-padding-xs);--van-dropdown-menu-title-line-height: var(--van-line-height-lg);--van-dropdown-menu-option-active-color: var(--van-primary-color);--van-dropdown-menu-content-max-height: 80%}.van-dropdown-menu{-webkit-user-select:none;user-select:none}.van-dropdown-menu__bar{position:relative;display:flex;height:var(--van-dropdown-menu-height);background:var(--van-dropdown-menu-background);box-shadow:var(--van-dropdown-menu-shadow)}.van-dropdown-menu__bar--opened{z-index:calc(var(--van-dropdown-item-z-index) + 1)}.van-dropdown-menu__bar--scrollable{padding-left:var(--van-padding-base);padding-right:var(--van-padding-xs);overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}.van-dropdown-menu__bar--scrollable::-webkit-scrollbar{display:none}.van-dropdown-menu__item{display:flex;flex:1;align-items:center;justify-content:center;min-width:0}.van-dropdown-menu__item--disabled .van-dropdown-menu__title{color:var(--van-dropdown-menu-title-disabled-text-color)}.van-dropdown-menu__item--grow{flex:1 0 auto;padding-left:var(--van-padding-base);padding-right:var(--van-padding-sm)}.van-dropdown-menu__title{position:relative;box-sizing:border-box;max-width:100%;padding:var(--van-dropdown-menu-title-padding);color:var(--van-dropdown-menu-title-text-color);font-size:var(--van-dropdown-menu-title-font-size);line-height:var(--van-dropdown-menu-title-line-height)}.van-dropdown-menu__title:after{position:absolute;top:50%;right:-4px;margin-top:-5px;border:3px solid;border-color:transparent transparent var(--van-gray-4) var(--van-gray-4);transform:rotate(-45deg);opacity:.8;content:""}.van-dropdown-menu__title--active{color:var(--van-dropdown-menu-title-active-text-color)}.van-dropdown-menu__title--active:after{border-color:transparent transparent currentColor currentColor}.van-dropdown-menu__title--down:after{margin-top:-1px;transform:rotate(135deg)}
1
+ :root,:host{--van-dropdown-menu-height: 48px;--van-dropdown-menu-background: var(--van-background-2);--van-dropdown-menu-shadow: 0 2px 12px rgba(100, 101, 102, .12);--van-dropdown-menu-title-font-size: 15px;--van-dropdown-menu-title-text-color: var(--van-text-color);--van-dropdown-menu-title-active-text-color: var(--van-primary-color);--van-dropdown-menu-title-disabled-text-color: var(--van-text-color-2);--van-dropdown-menu-title-padding: 0 var(--van-padding-xs);--van-dropdown-menu-title-line-height: var(--van-line-height-lg);--van-dropdown-menu-option-active-color: var(--van-primary-color);--van-dropdown-menu-option-disabled-color: var(--van-text-color-3);--van-dropdown-menu-content-max-height: 80%}.van-dropdown-menu{-webkit-user-select:none;user-select:none}.van-dropdown-menu__bar{position:relative;display:flex;height:var(--van-dropdown-menu-height);background:var(--van-dropdown-menu-background);box-shadow:var(--van-dropdown-menu-shadow)}.van-dropdown-menu__bar--opened{z-index:calc(var(--van-dropdown-item-z-index) + 1)}.van-dropdown-menu__bar--scrollable{padding-left:var(--van-padding-base);padding-right:var(--van-padding-xs);overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}.van-dropdown-menu__bar--scrollable::-webkit-scrollbar{display:none}.van-dropdown-menu__item{display:flex;flex:1;align-items:center;justify-content:center;min-width:0}.van-dropdown-menu__item--disabled .van-dropdown-menu__title{color:var(--van-dropdown-menu-title-disabled-text-color)}.van-dropdown-menu__item--grow{flex:1 0 auto;padding-left:var(--van-padding-base);padding-right:var(--van-padding-sm)}.van-dropdown-menu__title{position:relative;box-sizing:border-box;max-width:100%;padding:var(--van-dropdown-menu-title-padding);color:var(--van-dropdown-menu-title-text-color);font-size:var(--van-dropdown-menu-title-font-size);line-height:var(--van-dropdown-menu-title-line-height)}.van-dropdown-menu__title:after{position:absolute;top:50%;right:-4px;margin-top:-5px;border:3px solid;border-color:transparent transparent var(--van-gray-4) var(--van-gray-4);transform:rotate(-45deg);opacity:.8;content:""}.van-dropdown-menu__title--active{color:var(--van-dropdown-menu-title-active-text-color)}.van-dropdown-menu__title--active:after{border-color:transparent transparent currentColor currentColor}.van-dropdown-menu__title--down:after{margin-top:-1px;transform:rotate(135deg)}
@@ -22,5 +22,6 @@ export type DropdownMenuThemeVars = {
22
22
  dropdownMenuTitlePadding?: string;
23
23
  dropdownMenuTitleLineHeight?: number | string;
24
24
  dropdownMenuOptionActiveColor?: string;
25
+ dropdownMenuOptionDisabledColor?: string;
25
26
  dropdownMenuContentMaxHeight?: string;
26
27
  };
@@ -89,6 +89,13 @@ var stdin_default = (0, import_vue2.defineComponent)({
89
89
  return chunks2;
90
90
  }, []);
91
91
  const lastChunk = chunks[chunks.length - 1];
92
+ if (!lastChunk) {
93
+ chunks.push({
94
+ start: 0,
95
+ end: sourceString.length,
96
+ highlight: false
97
+ });
98
+ }
92
99
  if (lastChunk && lastChunk.end < sourceString.length) {
93
100
  chunks.push({
94
101
  start: lastChunk.end,
@@ -213,6 +213,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
213
213
  const checkClose = (event) => {
214
214
  var _a;
215
215
  const swipeItemEl = (_a = swipeItem.value) == null ? void 0 : _a.$el;
216
+ if (!swipeItemEl)
217
+ return;
216
218
  const imageEl = swipeItemEl.firstElementChild;
217
219
  const isClickOverlay = event.target === swipeItemEl;
218
220
  const isClickImage = imageEl == null ? void 0 : imageEl.contains(event.target);
@@ -108,7 +108,11 @@ var stdin_default = (0, import_vue2.defineComponent)({
108
108
  const match = getMatchAnchor(selectActiveIndex);
109
109
  if (match) {
110
110
  const rect = match.getRect(scrollParent.value, scrollParentRect);
111
- active = getActiveAnchor(rect.top, rects);
111
+ if (props.sticky && props.stickyOffsetTop) {
112
+ active = getActiveAnchor(rect.top - props.stickyOffsetTop, rects);
113
+ } else {
114
+ active = getActiveAnchor(rect.top, rects);
115
+ }
112
116
  }
113
117
  } else {
114
118
  active = getActiveAnchor(scrollTop, rects);
@@ -181,7 +185,11 @@ var stdin_default = (0, import_vue2.defineComponent)({
181
185
  return;
182
186
  }
183
187
  if (props.sticky && props.stickyOffsetTop) {
184
- (0, import_utils.setRootScrollTop)((0, import_utils.getRootScrollTop)() - props.stickyOffsetTop);
188
+ if ((0, import_utils.getRootScrollTop)() === offsetHeight - scrollParentRect.height) {
189
+ (0, import_utils.setRootScrollTop)((0, import_utils.getRootScrollTop)());
190
+ } else {
191
+ (0, import_utils.setRootScrollTop)((0, import_utils.getRootScrollTop)() - props.stickyOffsetTop);
192
+ }
185
193
  }
186
194
  emit("select", match.index);
187
195
  }