vant 3.3.1 → 3.3.2

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.
package/lib/vant.js CHANGED
@@ -4743,13 +4743,6 @@
4743
4743
  var totalDay = vue.computed(() => getMonthEndDay(props.date.getFullYear(), props.date.getMonth() + 1));
4744
4744
  var shouldRender = vue.computed(() => visible.value || !props.lazyRender);
4745
4745
  var getTitle = () => title.value;
4746
- var scrollIntoView = (body) => {
4747
- var el = props.showSubtitle ? daysRef.value : monthRef.value;
4748
- if (el) {
4749
- var scrollTop = useRect(el).top - useRect(body).top + body.scrollTop;
4750
- setScrollTop(body, scrollTop);
4751
- }
4752
- };
4753
4746
  var getMultipleDayType = (day) => {
4754
4747
  var isSelected = (date) => props.currentDate.some((item) => compareDay(item, date) === 0);
4755
4748
  if (isSelected(day)) {
@@ -4870,6 +4863,15 @@
4870
4863
  return days2;
4871
4864
  });
4872
4865
  var disabledDays = vue.computed(() => days.value.filter((day) => day.type === "disabled"));
4866
+ var scrollToDate = (body, targetDate) => {
4867
+ if (daysRef.value) {
4868
+ var daysRect = useRect(daysRef.value);
4869
+ var totalRows = placeholders.value.length;
4870
+ var currentRow = Math.ceil((targetDate.getDate() + offset2.value) / 7);
4871
+ var rowOffset = (currentRow - 1) * daysRect.height / totalRows;
4872
+ setScrollTop(body, daysRect.top + rowOffset + body.scrollTop - useRect(body).top);
4873
+ }
4874
+ };
4873
4875
  var renderDay = (item, index2) => vue.createVNode(CalendarDay, {
4874
4876
  "item": item,
4875
4877
  "index": index2,
@@ -4887,7 +4889,7 @@
4887
4889
  getTitle,
4888
4890
  getHeight: () => height2.value,
4889
4891
  setVisible,
4890
- scrollIntoView,
4892
+ scrollToDate,
4891
4893
  disabledDays
4892
4894
  });
4893
4895
  return () => vue.createVNode("div", {
@@ -5120,7 +5122,7 @@
5120
5122
  months.value.some((month, index2) => {
5121
5123
  if (compareMonth(month, targetDate) === 0) {
5122
5124
  if (bodyRef.value) {
5123
- monthRefs.value[index2].scrollIntoView(bodyRef.value);
5125
+ monthRefs.value[index2].scrollToDate(bodyRef.value, targetDate);
5124
5126
  }
5125
5127
  return true;
5126
5128
  }
@@ -5129,7 +5131,7 @@
5129
5131
  onScroll();
5130
5132
  });
5131
5133
  };
5132
- var scrollIntoView = () => {
5134
+ var scrollToCurrentDate = () => {
5133
5135
  if (props.poppable && !props.show) {
5134
5136
  return;
5135
5137
  }
@@ -5146,7 +5148,7 @@
5146
5148
  }
5147
5149
  raf(() => {
5148
5150
  bodyHeight = Math.floor(useRect(bodyRef).height);
5149
- scrollIntoView();
5151
+ scrollToCurrentDate();
5150
5152
  });
5151
5153
  };
5152
5154
  var reset = function(date) {
@@ -5154,7 +5156,7 @@
5154
5156
  date = getInitialDate();
5155
5157
  }
5156
5158
  currentDate.value = date;
5157
- scrollIntoView();
5159
+ scrollToCurrentDate();
5158
5160
  };
5159
5161
  var checkRange = (date) => {
5160
5162
  var {
@@ -5183,11 +5185,7 @@
5183
5185
  if (complete && props.type === "range") {
5184
5186
  var valid = checkRange(date);
5185
5187
  if (!valid) {
5186
- if (props.showConfirm) {
5187
- setCurrentDate([date[0], getDayByOffset(date[0], +props.maxRange - 1)]);
5188
- } else {
5189
- setCurrentDate(date);
5190
- }
5188
+ setCurrentDate([date[0], getDayByOffset(date[0], +props.maxRange - 1)]);
5191
5189
  return;
5192
5190
  }
5193
5191
  }
@@ -5320,7 +5318,7 @@
5320
5318
  value = null;
5321
5319
  }
5322
5320
  currentDate.value = value;
5323
- scrollIntoView();
5321
+ scrollToCurrentDate();
5324
5322
  });
5325
5323
  useExpose({
5326
5324
  reset,
@@ -6056,8 +6054,11 @@
6056
6054
  var onTouchMove = (event) => {
6057
6055
  if (props.touchable && state.swiping) {
6058
6056
  touch.move(event);
6059
- if (isCorrectDirection.value) {
6057
+ var shouldPrevent = isCorrectDirection.value || touch.offsetY.value > touch.offsetX.value === props.vertical;
6058
+ if (shouldPrevent) {
6060
6059
  preventDefault(event, props.stopPropagation);
6060
+ }
6061
+ if (isCorrectDirection.value) {
6061
6062
  move({
6062
6063
  offset: delta.value
6063
6064
  });
@@ -6711,7 +6712,7 @@
6711
6712
  return vue.createVNode(SwipeItem, {
6712
6713
  "id": id,
6713
6714
  "role": "tabpanel",
6714
- "class": bem$T("pane-wrapper", {
6715
+ "class": bem$T("panel-wrapper", {
6715
6716
  inactive: !active.value
6716
6717
  }),
6717
6718
  "tabindex": active.value ? 0 : -1,
@@ -14813,9 +14814,11 @@
14813
14814
  var config = isObject(to) ? to : {
14814
14815
  path: to
14815
14816
  };
14816
- var pathMatched = "path" in config && config.path === $route.path;
14817
- var nameMatched = "name" in config && config.name === $route.name;
14818
- return pathMatched || nameMatched;
14817
+ return !!$route.matched.find((val) => {
14818
+ var pathMatched = "path" in config && config.path === val.path;
14819
+ var nameMatched = "name" in config && config.name === val.name;
14820
+ return pathMatched || nameMatched;
14821
+ });
14819
14822
  }
14820
14823
  return ((_props$name = props.name) != null ? _props$name : index2.value) === modelValue;
14821
14824
  });
@@ -15379,7 +15382,7 @@
15379
15382
  }
15380
15383
  });
15381
15384
  var Uploader = withInstall(_Uploader);
15382
- var version = "3.3.1";
15385
+ var version = "3.3.2";
15383
15386
  function install(app) {
15384
15387
  var components = [ActionBar, ActionBarButton, ActionBarIcon, ActionSheet, AddressEdit, AddressList, Area, Badge, Button, Calendar, Card, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Circle, Col, Collapse, CollapseItem, ConfigProvider, ContactCard, ContactEdit, ContactList, CountDown, Coupon, CouponCell, CouponList, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, Form, Grid, GridItem, Icon, Image$1, ImagePreview, IndexAnchor, IndexBar, List, Loading, Locale, NavBar, NoticeBar, Notify, NumberKeyboard, Overlay, Pagination, PasswordInput, Picker, Popover, Popup, Progress, PullRefresh, Radio, RadioGroup, Rate, Row, Search, ShareSheet, Sidebar, SidebarItem, Skeleton, Slider, Step, Stepper, Steps, Sticky, SubmitBar, Swipe, SwipeCell, SwipeItem, Switch, Tab, Tabbar, TabbarItem, Tabs, Tag, Toast, TreeSelect, Uploader];
15385
15388
  components.forEach((item) => {