vant 3.3.1 → 3.3.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.
- package/es/calendar/Calendar.js +8 -14
- package/es/calendar/CalendarMonth.js +11 -10
- package/es/calendar/types.d.ts +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/locale/lang/pt-BR.d.ts +73 -0
- package/es/locale/lang/pt-BR.js +72 -0
- package/es/swipe/Swipe.js +8 -2
- package/es/swipe/index.css +1 -1
- package/es/swipe/index.less +2 -0
- package/es/tab/Tab.js +1 -1
- package/es/tabbar-item/TabbarItem.js +5 -3
- package/es/uploader/Uploader.js +13 -2
- package/lib/calendar/Calendar.js +8 -14
- package/lib/calendar/CalendarMonth.js +11 -10
- package/lib/calendar/types.d.ts +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/locale/lang/pt-BR.d.ts +73 -0
- package/lib/locale/lang/pt-BR.js +77 -0
- package/lib/ssr.js +7 -0
- package/lib/ssr.mjs +1 -0
- package/lib/swipe/Swipe.js +8 -2
- package/lib/swipe/index.css +1 -1
- package/lib/swipe/index.less +2 -0
- package/lib/tab/Tab.js +1 -1
- package/lib/tabbar-item/TabbarItem.js +5 -3
- package/lib/uploader/Uploader.js +12 -1
- package/lib/vant.cjs.js +14417 -0
- package/lib/vant.cjs.min.js +1 -0
- package/lib/vant.es.js +173 -1241
- package/lib/vant.es.min.js +173 -1241
- package/lib/vant.js +38 -25
- package/lib/vant.min.js +1 -1
- package/package.json +23 -8
- package/vetur/attributes.json +277 -277
- package/vetur/tags.json +96 -96
- package/vetur/web-types.json +882 -882
package/es/calendar/Calendar.js
CHANGED
@@ -220,7 +220,7 @@ export default defineComponent({
|
|
220
220
|
months.value.some((month, index) => {
|
221
221
|
if (compareMonth(month, targetDate) === 0) {
|
222
222
|
if (bodyRef.value) {
|
223
|
-
monthRefs.value[index].
|
223
|
+
monthRefs.value[index].scrollToDate(bodyRef.value, targetDate);
|
224
224
|
}
|
225
225
|
|
226
226
|
return true;
|
@@ -230,10 +230,9 @@ export default defineComponent({
|
|
230
230
|
});
|
231
231
|
onScroll();
|
232
232
|
});
|
233
|
-
};
|
234
|
-
|
233
|
+
};
|
235
234
|
|
236
|
-
var
|
235
|
+
var scrollToCurrentDate = () => {
|
237
236
|
if (props.poppable && !props.show) {
|
238
237
|
return;
|
239
238
|
}
|
@@ -255,7 +254,7 @@ export default defineComponent({
|
|
255
254
|
// add Math.floor to avoid decimal height issues
|
256
255
|
// https://github.com/youzan/vant/issues/5640
|
257
256
|
bodyHeight = Math.floor(useRect(bodyRef).height);
|
258
|
-
|
257
|
+
scrollToCurrentDate();
|
259
258
|
});
|
260
259
|
};
|
261
260
|
|
@@ -265,7 +264,7 @@ export default defineComponent({
|
|
265
264
|
}
|
266
265
|
|
267
266
|
currentDate.value = date;
|
268
|
-
|
267
|
+
scrollToCurrentDate();
|
269
268
|
};
|
270
269
|
|
271
270
|
var checkRange = date => {
|
@@ -303,13 +302,8 @@ export default defineComponent({
|
|
303
302
|
var valid = checkRange(date);
|
304
303
|
|
305
304
|
if (!valid) {
|
306
|
-
// auto selected to max range
|
307
|
-
|
308
|
-
setCurrentDate([date[0], getDayByOffset(date[0], +props.maxRange - 1)]);
|
309
|
-
} else {
|
310
|
-
setCurrentDate(date);
|
311
|
-
}
|
312
|
-
|
305
|
+
// auto selected to max range
|
306
|
+
setCurrentDate([date[0], getDayByOffset(date[0], +props.maxRange - 1)]);
|
313
307
|
return;
|
314
308
|
}
|
315
309
|
}
|
@@ -467,7 +461,7 @@ export default defineComponent({
|
|
467
461
|
}
|
468
462
|
|
469
463
|
currentDate.value = value;
|
470
|
-
|
464
|
+
scrollToCurrentDate();
|
471
465
|
});
|
472
466
|
useExpose({
|
473
467
|
reset,
|
@@ -58,15 +58,6 @@ export default defineComponent({
|
|
58
58
|
|
59
59
|
var getTitle = () => title.value;
|
60
60
|
|
61
|
-
var scrollIntoView = body => {
|
62
|
-
var el = props.showSubtitle ? daysRef.value : monthRef.value;
|
63
|
-
|
64
|
-
if (el) {
|
65
|
-
var scrollTop = useRect(el).top - useRect(body).top + body.scrollTop;
|
66
|
-
setScrollTop(body, scrollTop);
|
67
|
-
}
|
68
|
-
};
|
69
|
-
|
70
61
|
var getMultipleDayType = day => {
|
71
62
|
var isSelected = date => props.currentDate.some(item => compareDay(item, date) === 0);
|
72
63
|
|
@@ -219,6 +210,16 @@ export default defineComponent({
|
|
219
210
|
});
|
220
211
|
var disabledDays = computed(() => days.value.filter(day => day.type === 'disabled'));
|
221
212
|
|
213
|
+
var scrollToDate = (body, targetDate) => {
|
214
|
+
if (daysRef.value) {
|
215
|
+
var daysRect = useRect(daysRef.value);
|
216
|
+
var totalRows = placeholders.value.length;
|
217
|
+
var currentRow = Math.ceil((targetDate.getDate() + offset.value) / 7);
|
218
|
+
var rowOffset = (currentRow - 1) * daysRect.height / totalRows;
|
219
|
+
setScrollTop(body, daysRect.top + rowOffset + body.scrollTop - useRect(body).top);
|
220
|
+
}
|
221
|
+
};
|
222
|
+
|
222
223
|
var renderDay = (item, index) => _createVNode(CalendarDay, {
|
223
224
|
"item": item,
|
224
225
|
"index": index,
|
@@ -238,7 +239,7 @@ export default defineComponent({
|
|
238
239
|
getTitle,
|
239
240
|
getHeight: () => height.value,
|
240
241
|
setVisible,
|
241
|
-
|
242
|
+
scrollToDate,
|
242
243
|
disabledDays
|
243
244
|
});
|
244
245
|
return () => _createVNode("div", {
|
package/es/calendar/types.d.ts
CHANGED
@@ -21,6 +21,6 @@ export declare type CalendarMonthInstance = ComponentPublicInstance<CalendarMont
|
|
21
21
|
getTitle: () => string;
|
22
22
|
getHeight: () => number;
|
23
23
|
setVisible: (value?: boolean | undefined) => void;
|
24
|
-
|
24
|
+
scrollToDate: (body: Element, targetDate: Date) => void;
|
25
25
|
disabledDays: Ref<ComputedRef<CalendarDayItem[]>>;
|
26
26
|
}>;
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
@@ -84,7 +84,7 @@ import { Tag } from './tag';
|
|
84
84
|
import { Toast } from './toast';
|
85
85
|
import { TreeSelect } from './tree-select';
|
86
86
|
import { Uploader } from './uploader';
|
87
|
-
var version = '3.3.
|
87
|
+
var version = '3.3.4';
|
88
88
|
|
89
89
|
function install(app) {
|
90
90
|
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, 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];
|
@@ -0,0 +1,73 @@
|
|
1
|
+
declare const _default: {
|
2
|
+
name: string;
|
3
|
+
tel: string;
|
4
|
+
save: string;
|
5
|
+
confirm: string;
|
6
|
+
cancel: string;
|
7
|
+
delete: string;
|
8
|
+
loading: string;
|
9
|
+
noCoupon: string;
|
10
|
+
nameEmpty: string;
|
11
|
+
telInvalid: string;
|
12
|
+
vanCalendar: {
|
13
|
+
end: string;
|
14
|
+
start: string;
|
15
|
+
title: string;
|
16
|
+
startEnd: string;
|
17
|
+
weekdays: string[];
|
18
|
+
monthTitle: (year: number, month: number) => string;
|
19
|
+
rangePrompt: (maxRange: number) => string;
|
20
|
+
};
|
21
|
+
vanCascader: {
|
22
|
+
select: string;
|
23
|
+
};
|
24
|
+
vanContactCard: {
|
25
|
+
addText: string;
|
26
|
+
};
|
27
|
+
vanContactList: {
|
28
|
+
addText: string;
|
29
|
+
};
|
30
|
+
vanPagination: {
|
31
|
+
prev: string;
|
32
|
+
next: string;
|
33
|
+
};
|
34
|
+
vanPullRefresh: {
|
35
|
+
pulling: string;
|
36
|
+
loosing: string;
|
37
|
+
};
|
38
|
+
vanSubmitBar: {
|
39
|
+
label: string;
|
40
|
+
};
|
41
|
+
vanCoupon: {
|
42
|
+
unlimited: string;
|
43
|
+
discount: (discount: number) => string;
|
44
|
+
condition: (condition: number) => string;
|
45
|
+
};
|
46
|
+
vanCouponCell: {
|
47
|
+
title: string;
|
48
|
+
count: (count: number) => string;
|
49
|
+
};
|
50
|
+
vanCouponList: {
|
51
|
+
exchange: string;
|
52
|
+
close: string;
|
53
|
+
enable: string;
|
54
|
+
disabled: string;
|
55
|
+
placeholder: string;
|
56
|
+
};
|
57
|
+
vanAddressEdit: {
|
58
|
+
area: string;
|
59
|
+
postal: string;
|
60
|
+
areaEmpty: string;
|
61
|
+
addressEmpty: string;
|
62
|
+
postalEmpty: string;
|
63
|
+
defaultAddress: string;
|
64
|
+
};
|
65
|
+
vanAddressEditDetail: {
|
66
|
+
label: string;
|
67
|
+
placeholder: string;
|
68
|
+
};
|
69
|
+
vanAddressList: {
|
70
|
+
add: string;
|
71
|
+
};
|
72
|
+
};
|
73
|
+
export default _default;
|
@@ -0,0 +1,72 @@
|
|
1
|
+
export default {
|
2
|
+
name: 'Nome',
|
3
|
+
tel: 'Fone',
|
4
|
+
save: 'Salvar',
|
5
|
+
confirm: 'Confirmar',
|
6
|
+
cancel: 'Cancelar',
|
7
|
+
delete: 'Excluir',
|
8
|
+
loading: 'Carregando...',
|
9
|
+
noCoupon: 'Nenhum cupom',
|
10
|
+
nameEmpty: 'Por favor, preencha o nome',
|
11
|
+
telInvalid: 'Telefone em formato inválido',
|
12
|
+
vanCalendar: {
|
13
|
+
end: 'Fim',
|
14
|
+
start: 'Início',
|
15
|
+
title: 'Calendário',
|
16
|
+
startEnd: 'Início/Fim',
|
17
|
+
weekdays: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'],
|
18
|
+
monthTitle: (year, month) => month + "/" + year,
|
19
|
+
rangePrompt: maxRange => "Escolha no m\xE1ximo " + maxRange + " dias"
|
20
|
+
},
|
21
|
+
vanCascader: {
|
22
|
+
select: 'Selecione'
|
23
|
+
},
|
24
|
+
vanContactCard: {
|
25
|
+
addText: 'Adicionar informações de contato'
|
26
|
+
},
|
27
|
+
vanContactList: {
|
28
|
+
addText: 'Adicionar novo contato'
|
29
|
+
},
|
30
|
+
vanPagination: {
|
31
|
+
prev: 'Anterior',
|
32
|
+
next: 'Próximo'
|
33
|
+
},
|
34
|
+
vanPullRefresh: {
|
35
|
+
pulling: 'Puxe para atualizar...',
|
36
|
+
loosing: 'Solte para atualizar...'
|
37
|
+
},
|
38
|
+
vanSubmitBar: {
|
39
|
+
label: 'Total:'
|
40
|
+
},
|
41
|
+
vanCoupon: {
|
42
|
+
unlimited: 'Ilimitado',
|
43
|
+
discount: discount => discount * 10 + "% de desconto",
|
44
|
+
condition: condition => "Pelo menos " + condition
|
45
|
+
},
|
46
|
+
vanCouponCell: {
|
47
|
+
title: 'Cupom',
|
48
|
+
count: count => "Voc\xEA possui " + count + " cupom(ns)"
|
49
|
+
},
|
50
|
+
vanCouponList: {
|
51
|
+
exchange: 'Usar',
|
52
|
+
close: 'Fechar',
|
53
|
+
enable: 'Disponível',
|
54
|
+
disabled: 'Indisponível',
|
55
|
+
placeholder: 'Código do cupom'
|
56
|
+
},
|
57
|
+
vanAddressEdit: {
|
58
|
+
area: 'Área',
|
59
|
+
postal: 'CEP',
|
60
|
+
areaEmpty: 'Por favor, selecione uma área de recebimento',
|
61
|
+
addressEmpty: 'Endereço não pode ser vazio',
|
62
|
+
postalEmpty: 'CEP inválido',
|
63
|
+
defaultAddress: 'Usar como endereço padrão'
|
64
|
+
},
|
65
|
+
vanAddressEditDetail: {
|
66
|
+
label: 'Endereço',
|
67
|
+
placeholder: 'Endereço'
|
68
|
+
},
|
69
|
+
vanAddressList: {
|
70
|
+
add: 'Adicionar novo endereço'
|
71
|
+
}
|
72
|
+
};
|
package/es/swipe/Swipe.js
CHANGED
@@ -259,10 +259,16 @@ export default defineComponent({
|
|
259
259
|
|
260
260
|
var onTouchMove = event => {
|
261
261
|
if (props.touchable && state.swiping) {
|
262
|
-
touch.move(event);
|
262
|
+
touch.move(event); // if user starting to touchmove, prevent the event bubbling to
|
263
|
+
// avoid affecting the parent components
|
263
264
|
|
264
|
-
|
265
|
+
var shouldPrevent = isCorrectDirection.value || touch.offsetY.value > touch.offsetX.value === props.vertical;
|
266
|
+
|
267
|
+
if (shouldPrevent) {
|
265
268
|
preventDefault(event, props.stopPropagation);
|
269
|
+
}
|
270
|
+
|
271
|
+
if (isCorrectDirection.value) {
|
266
272
|
move({
|
267
273
|
offset: delta.value
|
268
274
|
});
|
package/es/swipe/index.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
:root{--van-swipe-indicator-size:6px;--van-swipe-indicator-margin:var(--van-padding-sm);--van-swipe-indicator-active-opacity:1;--van-swipe-indicator-inactive-opacity:0.3;--van-swipe-indicator-active-background-color:var(--van-primary-color);--van-swipe-indicator-inactive-background-color:var(--van-border-color)}.van-swipe{position:relative;overflow:hidden;cursor:-webkit-grab;cursor:grab;-webkit-user-select:none;user-select:none}.van-swipe__track{display:flex;height:100%}.van-swipe__track--vertical{flex-direction:column}.van-swipe__indicators{position:absolute;bottom:var(--van-swipe-indicator-margin);left:50%;display:flex;transform:translateX(-50%)}.van-swipe__indicators--vertical{top:50%;bottom:auto;left:var(--van-swipe-indicator-margin);flex-direction:column;transform:translateY(-50%)}.van-swipe__indicators--vertical .van-swipe__indicator:not(:last-child){margin-bottom:var(--van-swipe-indicator-size)}.van-swipe__indicator{width:var(--van-swipe-indicator-size);height:var(--van-swipe-indicator-size);background-color:var(--van-swipe-indicator-inactive-background-color);border-radius:100%;opacity:var(--van-swipe-indicator-inactive-opacity);transition:opacity var(--van-animation-duration-fast),background-color var(--van-animation-duration-fast)}.van-swipe__indicator:not(:last-child){margin-right:var(--van-swipe-indicator-size)}.van-swipe__indicator--active{background-color:var(--van-swipe-indicator-active-background-color);opacity:var(--van-swipe-indicator-active-opacity)}
|
1
|
+
:root{--van-swipe-indicator-size:6px;--van-swipe-indicator-margin:var(--van-padding-sm);--van-swipe-indicator-active-opacity:1;--van-swipe-indicator-inactive-opacity:0.3;--van-swipe-indicator-active-background-color:var(--van-primary-color);--van-swipe-indicator-inactive-background-color:var(--van-border-color)}.van-swipe{position:relative;overflow:hidden;transform:translateZ(0);cursor:-webkit-grab;cursor:grab;-webkit-user-select:none;user-select:none}.van-swipe__track{display:flex;height:100%}.van-swipe__track--vertical{flex-direction:column}.van-swipe__indicators{position:absolute;bottom:var(--van-swipe-indicator-margin);left:50%;display:flex;transform:translateX(-50%)}.van-swipe__indicators--vertical{top:50%;bottom:auto;left:var(--van-swipe-indicator-margin);flex-direction:column;transform:translateY(-50%)}.van-swipe__indicators--vertical .van-swipe__indicator:not(:last-child){margin-bottom:var(--van-swipe-indicator-size)}.van-swipe__indicator{width:var(--van-swipe-indicator-size);height:var(--van-swipe-indicator-size);background-color:var(--van-swipe-indicator-inactive-background-color);border-radius:100%;opacity:var(--van-swipe-indicator-inactive-opacity);transition:opacity var(--van-animation-duration-fast),background-color var(--van-animation-duration-fast)}.van-swipe__indicator:not(:last-child){margin-right:var(--van-swipe-indicator-size)}.van-swipe__indicator--active{background-color:var(--van-swipe-indicator-active-background-color);opacity:var(--van-swipe-indicator-active-opacity)}
|
package/es/swipe/index.less
CHANGED
package/es/tab/Tab.js
CHANGED
@@ -60,9 +60,11 @@ export default defineComponent({
|
|
60
60
|
var config = isObject(to) ? to : {
|
61
61
|
path: to
|
62
62
|
};
|
63
|
-
|
64
|
-
|
65
|
-
|
63
|
+
return !!$route.matched.find(val => {
|
64
|
+
var pathMatched = 'path' in config && config.path === val.path;
|
65
|
+
var nameMatched = 'name' in config && config.name === val.name;
|
66
|
+
return pathMatched || nameMatched;
|
67
|
+
});
|
66
68
|
}
|
67
69
|
|
68
70
|
return ((_props$name = props.name) != null ? _props$name : index.value) === modelValue;
|
package/es/uploader/Uploader.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { createVNode as _createVNode, mergeProps as _mergeProps, resolveDirective as _resolveDirective } from "vue";
|
2
|
-
import { ref, reactive, defineComponent } from 'vue'; // Utils
|
2
|
+
import { ref, reactive, defineComponent, onBeforeUnmount } from 'vue'; // Utils
|
3
3
|
|
4
4
|
import { pick, extend, isPromise, truthProp, numericProp, getSizeStyle, makeArrayProp, makeStringProp, makeNumericProp } from '../utils';
|
5
5
|
import { bem, name, toArray, isOversize, filterFiles, isImageFile, readFileContent } from './utils'; // Composables
|
@@ -50,6 +50,7 @@ export default defineComponent({
|
|
50
50
|
slots
|
51
51
|
} = _ref;
|
52
52
|
var inputRef = ref();
|
53
|
+
var urls = [];
|
53
54
|
|
54
55
|
var getDetail = function (index) {
|
55
56
|
if (index === void 0) {
|
@@ -182,7 +183,14 @@ export default defineComponent({
|
|
182
183
|
var previewImage = item => {
|
183
184
|
if (props.previewFullImage) {
|
184
185
|
var imageFiles = props.modelValue.filter(isImageFile);
|
185
|
-
var images = imageFiles.map(item =>
|
186
|
+
var images = imageFiles.map(item => {
|
187
|
+
if (item.file && !item.url) {
|
188
|
+
item.url = URL.createObjectURL(item.file);
|
189
|
+
urls.push(item.url);
|
190
|
+
}
|
191
|
+
|
192
|
+
return item.url;
|
193
|
+
}).filter(Boolean);
|
186
194
|
imagePreview = ImagePreview(extend({
|
187
195
|
images,
|
188
196
|
startPosition: imageFiles.indexOf(item),
|
@@ -269,6 +277,9 @@ export default defineComponent({
|
|
269
277
|
}
|
270
278
|
};
|
271
279
|
|
280
|
+
onBeforeUnmount(() => {
|
281
|
+
urls.forEach(url => URL.revokeObjectURL(url));
|
282
|
+
});
|
272
283
|
useExpose({
|
273
284
|
chooseFile,
|
274
285
|
closeImagePreview
|
package/lib/calendar/Calendar.js
CHANGED
@@ -237,7 +237,7 @@ var _default = (0, _vue.defineComponent)({
|
|
237
237
|
months.value.some((month, index) => {
|
238
238
|
if ((0, _utils2.compareMonth)(month, targetDate) === 0) {
|
239
239
|
if (bodyRef.value) {
|
240
|
-
monthRefs.value[index].
|
240
|
+
monthRefs.value[index].scrollToDate(bodyRef.value, targetDate);
|
241
241
|
}
|
242
242
|
|
243
243
|
return true;
|
@@ -247,10 +247,9 @@ var _default = (0, _vue.defineComponent)({
|
|
247
247
|
});
|
248
248
|
onScroll();
|
249
249
|
});
|
250
|
-
};
|
251
|
-
|
250
|
+
};
|
252
251
|
|
253
|
-
var
|
252
|
+
var scrollToCurrentDate = () => {
|
254
253
|
if (props.poppable && !props.show) {
|
255
254
|
return;
|
256
255
|
}
|
@@ -272,7 +271,7 @@ var _default = (0, _vue.defineComponent)({
|
|
272
271
|
// add Math.floor to avoid decimal height issues
|
273
272
|
// https://github.com/youzan/vant/issues/5640
|
274
273
|
bodyHeight = Math.floor((0, _use.useRect)(bodyRef).height);
|
275
|
-
|
274
|
+
scrollToCurrentDate();
|
276
275
|
});
|
277
276
|
};
|
278
277
|
|
@@ -282,7 +281,7 @@ var _default = (0, _vue.defineComponent)({
|
|
282
281
|
}
|
283
282
|
|
284
283
|
currentDate.value = date;
|
285
|
-
|
284
|
+
scrollToCurrentDate();
|
286
285
|
};
|
287
286
|
|
288
287
|
var checkRange = date => {
|
@@ -320,13 +319,8 @@ var _default = (0, _vue.defineComponent)({
|
|
320
319
|
var valid = checkRange(date);
|
321
320
|
|
322
321
|
if (!valid) {
|
323
|
-
// auto selected to max range
|
324
|
-
|
325
|
-
setCurrentDate([date[0], (0, _utils2.getDayByOffset)(date[0], +props.maxRange - 1)]);
|
326
|
-
} else {
|
327
|
-
setCurrentDate(date);
|
328
|
-
}
|
329
|
-
|
322
|
+
// auto selected to max range
|
323
|
+
setCurrentDate([date[0], (0, _utils2.getDayByOffset)(date[0], +props.maxRange - 1)]);
|
330
324
|
return;
|
331
325
|
}
|
332
326
|
}
|
@@ -484,7 +478,7 @@ var _default = (0, _vue.defineComponent)({
|
|
484
478
|
}
|
485
479
|
|
486
480
|
currentDate.value = value;
|
487
|
-
|
481
|
+
scrollToCurrentDate();
|
488
482
|
});
|
489
483
|
(0, _useExpose.useExpose)({
|
490
484
|
reset,
|
@@ -72,15 +72,6 @@ var _default = (0, _vue.defineComponent)({
|
|
72
72
|
|
73
73
|
var getTitle = () => title.value;
|
74
74
|
|
75
|
-
var scrollIntoView = body => {
|
76
|
-
var el = props.showSubtitle ? daysRef.value : monthRef.value;
|
77
|
-
|
78
|
-
if (el) {
|
79
|
-
var scrollTop = (0, _use.useRect)(el).top - (0, _use.useRect)(body).top + body.scrollTop;
|
80
|
-
(0, _utils.setScrollTop)(body, scrollTop);
|
81
|
-
}
|
82
|
-
};
|
83
|
-
|
84
75
|
var getMultipleDayType = day => {
|
85
76
|
var isSelected = date => props.currentDate.some(item => (0, _utils3.compareDay)(item, date) === 0);
|
86
77
|
|
@@ -233,6 +224,16 @@ var _default = (0, _vue.defineComponent)({
|
|
233
224
|
});
|
234
225
|
var disabledDays = (0, _vue.computed)(() => days.value.filter(day => day.type === 'disabled'));
|
235
226
|
|
227
|
+
var scrollToDate = (body, targetDate) => {
|
228
|
+
if (daysRef.value) {
|
229
|
+
var daysRect = (0, _use.useRect)(daysRef.value);
|
230
|
+
var totalRows = placeholders.value.length;
|
231
|
+
var currentRow = Math.ceil((targetDate.getDate() + offset.value) / 7);
|
232
|
+
var rowOffset = (currentRow - 1) * daysRect.height / totalRows;
|
233
|
+
(0, _utils.setScrollTop)(body, daysRect.top + rowOffset + body.scrollTop - (0, _use.useRect)(body).top);
|
234
|
+
}
|
235
|
+
};
|
236
|
+
|
236
237
|
var renderDay = (item, index) => (0, _vue.createVNode)(_CalendarDay.default, {
|
237
238
|
"item": item,
|
238
239
|
"index": index,
|
@@ -252,7 +253,7 @@ var _default = (0, _vue.defineComponent)({
|
|
252
253
|
getTitle,
|
253
254
|
getHeight: () => height.value,
|
254
255
|
setVisible,
|
255
|
-
|
256
|
+
scrollToDate,
|
256
257
|
disabledDays
|
257
258
|
});
|
258
259
|
return () => (0, _vue.createVNode)("div", {
|
package/lib/calendar/types.d.ts
CHANGED
@@ -21,6 +21,6 @@ export declare type CalendarMonthInstance = ComponentPublicInstance<CalendarMont
|
|
21
21
|
getTitle: () => string;
|
22
22
|
getHeight: () => number;
|
23
23
|
setVisible: (value?: boolean | undefined) => void;
|
24
|
-
|
24
|
+
scrollToDate: (body: Element, targetDate: Date) => void;
|
25
25
|
disabledDays: Ref<ComputedRef<CalendarDayItem[]>>;
|
26
26
|
}>;
|