vant 3.3.0 → 3.3.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.
package/lib/vant.js CHANGED
@@ -4060,8 +4060,7 @@
4060
4060
  "text": props.saveButtonText || t$h("save"),
4061
4061
  "class": bem$16("button"),
4062
4062
  "loading": props.isSaving,
4063
- "nativeType": "submit",
4064
- "onClick": onSave
4063
+ "nativeType": "submit"
4065
4064
  }, null), props.showDelete && vue.createVNode(Button, {
4066
4065
  "block": true,
4067
4066
  "round": true,
@@ -4744,13 +4743,6 @@
4744
4743
  var totalDay = vue.computed(() => getMonthEndDay(props.date.getFullYear(), props.date.getMonth() + 1));
4745
4744
  var shouldRender = vue.computed(() => visible.value || !props.lazyRender);
4746
4745
  var getTitle = () => title.value;
4747
- var scrollIntoView = (body) => {
4748
- var el = props.showSubtitle ? daysRef.value : monthRef.value;
4749
- if (el) {
4750
- var scrollTop = useRect(el).top - useRect(body).top + body.scrollTop;
4751
- setScrollTop(body, scrollTop);
4752
- }
4753
- };
4754
4746
  var getMultipleDayType = (day) => {
4755
4747
  var isSelected = (date) => props.currentDate.some((item) => compareDay(item, date) === 0);
4756
4748
  if (isSelected(day)) {
@@ -4871,6 +4863,15 @@
4871
4863
  return days2;
4872
4864
  });
4873
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
+ };
4874
4875
  var renderDay = (item, index2) => vue.createVNode(CalendarDay, {
4875
4876
  "item": item,
4876
4877
  "index": index2,
@@ -4888,7 +4889,7 @@
4888
4889
  getTitle,
4889
4890
  getHeight: () => height2.value,
4890
4891
  setVisible,
4891
- scrollIntoView,
4892
+ scrollToDate,
4892
4893
  disabledDays
4893
4894
  });
4894
4895
  return () => vue.createVNode("div", {
@@ -5121,7 +5122,7 @@
5121
5122
  months.value.some((month, index2) => {
5122
5123
  if (compareMonth(month, targetDate) === 0) {
5123
5124
  if (bodyRef.value) {
5124
- monthRefs.value[index2].scrollIntoView(bodyRef.value);
5125
+ monthRefs.value[index2].scrollToDate(bodyRef.value, targetDate);
5125
5126
  }
5126
5127
  return true;
5127
5128
  }
@@ -5130,7 +5131,7 @@
5130
5131
  onScroll();
5131
5132
  });
5132
5133
  };
5133
- var scrollIntoView = () => {
5134
+ var scrollToCurrentDate = () => {
5134
5135
  if (props.poppable && !props.show) {
5135
5136
  return;
5136
5137
  }
@@ -5147,7 +5148,7 @@
5147
5148
  }
5148
5149
  raf(() => {
5149
5150
  bodyHeight = Math.floor(useRect(bodyRef).height);
5150
- scrollIntoView();
5151
+ scrollToCurrentDate();
5151
5152
  });
5152
5153
  };
5153
5154
  var reset = function(date) {
@@ -5155,7 +5156,7 @@
5155
5156
  date = getInitialDate();
5156
5157
  }
5157
5158
  currentDate.value = date;
5158
- scrollIntoView();
5159
+ scrollToCurrentDate();
5159
5160
  };
5160
5161
  var checkRange = (date) => {
5161
5162
  var {
@@ -5184,11 +5185,7 @@
5184
5185
  if (complete && props.type === "range") {
5185
5186
  var valid = checkRange(date);
5186
5187
  if (!valid) {
5187
- if (props.showConfirm) {
5188
- setCurrentDate([date[0], getDayByOffset(date[0], +props.maxRange - 1)]);
5189
- } else {
5190
- setCurrentDate(date);
5191
- }
5188
+ setCurrentDate([date[0], getDayByOffset(date[0], +props.maxRange - 1)]);
5192
5189
  return;
5193
5190
  }
5194
5191
  }
@@ -5321,7 +5318,7 @@
5321
5318
  value = null;
5322
5319
  }
5323
5320
  currentDate.value = value;
5324
- scrollIntoView();
5321
+ scrollToCurrentDate();
5325
5322
  });
5326
5323
  useExpose({
5327
5324
  reset,
@@ -6057,8 +6054,11 @@
6057
6054
  var onTouchMove = (event) => {
6058
6055
  if (props.touchable && state.swiping) {
6059
6056
  touch.move(event);
6060
- if (isCorrectDirection.value) {
6057
+ var shouldPrevent = isCorrectDirection.value || touch.offsetY.value > touch.offsetX.value === props.vertical;
6058
+ if (shouldPrevent) {
6061
6059
  preventDefault(event, props.stopPropagation);
6060
+ }
6061
+ if (isCorrectDirection.value) {
6062
6062
  move({
6063
6063
  offset: delta.value
6064
6064
  });
@@ -6712,7 +6712,7 @@
6712
6712
  return vue.createVNode(SwipeItem, {
6713
6713
  "id": id,
6714
6714
  "role": "tabpanel",
6715
- "class": bem$T("pane-wrapper", {
6715
+ "class": bem$T("panel-wrapper", {
6716
6716
  inactive: !active.value
6717
6717
  }),
6718
6718
  "tabindex": active.value ? 0 : -1,
@@ -14814,9 +14814,11 @@
14814
14814
  var config = isObject(to) ? to : {
14815
14815
  path: to
14816
14816
  };
14817
- var pathMatched = "path" in config && config.path === $route.path;
14818
- var nameMatched = "name" in config && config.name === $route.name;
14819
- 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
+ });
14820
14822
  }
14821
14823
  return ((_props$name = props.name) != null ? _props$name : index2.value) === modelValue;
14822
14824
  });
@@ -15183,6 +15185,7 @@
15183
15185
  slots
15184
15186
  } = _ref;
15185
15187
  var inputRef = vue.ref();
15188
+ var urls = [];
15186
15189
  var getDetail = function(index2) {
15187
15190
  if (index2 === void 0) {
15188
15191
  index2 = props.modelValue.length;
@@ -15289,7 +15292,13 @@
15289
15292
  var previewImage = (item) => {
15290
15293
  if (props.previewFullImage) {
15291
15294
  var imageFiles = props.modelValue.filter(isImageFile);
15292
- var images = imageFiles.map((item2) => item2.content || item2.url).filter(Boolean);
15295
+ var images = imageFiles.map((item2) => {
15296
+ if (item2.file && !item2.url) {
15297
+ item2.url = URL.createObjectURL(item2.file);
15298
+ urls.push(item2.url);
15299
+ }
15300
+ return item2.url;
15301
+ }).filter(Boolean);
15293
15302
  imagePreview = ImagePreview(extend({
15294
15303
  images,
15295
15304
  startPosition: imageFiles.indexOf(item),
@@ -15365,6 +15374,9 @@
15365
15374
  inputRef.value.click();
15366
15375
  }
15367
15376
  };
15377
+ vue.onBeforeUnmount(() => {
15378
+ urls.forEach((url) => URL.revokeObjectURL(url));
15379
+ });
15368
15380
  useExpose({
15369
15381
  chooseFile,
15370
15382
  closeImagePreview
@@ -15380,7 +15392,7 @@
15380
15392
  }
15381
15393
  });
15382
15394
  var Uploader = withInstall(_Uploader);
15383
- var version = "3.3.0";
15395
+ var version = "3.3.3";
15384
15396
  function install(app) {
15385
15397
  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];
15386
15398
  components.forEach((item) => {