@varlet/ui 2.8.5 → 2.8.6-alpha.1678026101378
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/app-bar/AppBar.mjs +3 -2
- package/es/avatar/Avatar.mjs +3 -2
- package/es/back-top/BackTop.mjs +26 -15
- package/es/bottom-navigation/BottomNavigation.mjs +3 -2
- package/es/countdown/Countdown.mjs +24 -7
- package/es/date-picker/src/day-picker-panel.mjs +3 -2
- package/es/date-picker/src/year-picker-panel.mjs +3 -2
- package/es/divider/Divider.mjs +10 -5
- package/es/index-bar/IndexBar.mjs +54 -22
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/input/Input.mjs +53 -15
- package/es/list/List.mjs +3 -2
- package/es/menu/usePopover.mjs +9 -18
- package/es/pull-refresh/PullRefresh.mjs +9 -13
- package/es/slider/Slider.mjs +4 -3
- package/es/snackbar/core.mjs +3 -2
- package/es/sticky/Sticky.mjs +10 -7
- package/es/swipe/Swipe.mjs +6 -8
- package/es/tabs/Tabs.mjs +3 -3
- package/es/utils/components.mjs +3 -8
- package/es/varlet.esm.js +4972 -4892
- package/highlight/web-types.en-US.json +1 -1
- package/highlight/web-types.zh-CN.json +1 -1
- package/lib/varlet.cjs.js +241 -115
- package/package.json +6 -5
- package/umd/varlet.js +5 -5
- package/es/utils/types.mjs +0 -1
package/es/app-bar/AppBar.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { defineComponent, ref,
|
|
1
|
+
import { defineComponent, ref, onUpdated, computed } from 'vue';
|
|
2
2
|
import { props } from './props.mjs';
|
|
3
3
|
import { createNamespace } from '../utils/components.mjs';
|
|
4
|
+
import { useMounted } from '@varlet/use';
|
|
4
5
|
var {
|
|
5
6
|
n,
|
|
6
7
|
classes
|
|
@@ -93,7 +94,7 @@ var __sfc__ = defineComponent({
|
|
|
93
94
|
color: textColor
|
|
94
95
|
};
|
|
95
96
|
});
|
|
96
|
-
|
|
97
|
+
useMounted(computePadding);
|
|
97
98
|
onUpdated(computePadding);
|
|
98
99
|
return {
|
|
99
100
|
n,
|
package/es/avatar/Avatar.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import Lazy from '../lazy/index.mjs';
|
|
2
|
-
import { defineComponent, ref,
|
|
2
|
+
import { defineComponent, ref, onUpdated } from 'vue';
|
|
3
3
|
import { props, internalSizeValidator, sizeValidator } from './props.mjs';
|
|
4
4
|
import { toSizeUnit } from '../utils/elements.mjs';
|
|
5
5
|
import { createNamespace, call } from '../utils/components.mjs';
|
|
6
|
+
import { useMounted } from '@varlet/use';
|
|
6
7
|
var {
|
|
7
8
|
n,
|
|
8
9
|
classes
|
|
@@ -128,7 +129,7 @@ var __sfc__ = defineComponent({
|
|
|
128
129
|
call(props.onClick, e);
|
|
129
130
|
};
|
|
130
131
|
|
|
131
|
-
|
|
132
|
+
useMounted(getScale);
|
|
132
133
|
onUpdated(getScale);
|
|
133
134
|
return {
|
|
134
135
|
internalSizeValidator,
|
package/es/back-top/BackTop.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent, ref, onMounted, onBeforeUnmount } from 'vue';
|
|
2
1
|
import VarButton from '../button/index.mjs';
|
|
3
2
|
import VarIcon from '../icon/index.mjs';
|
|
3
|
+
import { defineComponent, ref, onBeforeUnmount, onDeactivated, onMounted, onActivated } from 'vue';
|
|
4
4
|
import { props } from './props.mjs';
|
|
5
5
|
import { throttle } from '@varlet/shared';
|
|
6
6
|
import { easeInOutCubic } from '../utils/shared.mjs';
|
|
@@ -29,7 +29,7 @@ function __render__(_ctx, _cache) {
|
|
|
29
29
|
}
|
|
30
30
|
}, _ctx.$attrs, {
|
|
31
31
|
onClick: _cache[0] || (_cache[0] = _withModifiers(function () {
|
|
32
|
-
return _ctx.
|
|
32
|
+
return _ctx.handleClick && _ctx.handleClick(...arguments);
|
|
33
33
|
}, ["stop"]))
|
|
34
34
|
}), [_renderSlot(_ctx.$slots, "default", {}, () => [_createVNode(_component_var_button, {
|
|
35
35
|
type: "primary",
|
|
@@ -62,31 +62,42 @@ var __sfc__ = defineComponent({
|
|
|
62
62
|
var show = ref(false);
|
|
63
63
|
var backTopEl = ref(null);
|
|
64
64
|
var disabled = ref(true);
|
|
65
|
-
var
|
|
65
|
+
var scroller;
|
|
66
66
|
|
|
67
|
-
var
|
|
67
|
+
var handleClick = event => {
|
|
68
68
|
call(props.onClick, event);
|
|
69
|
-
var left = getScrollLeft(
|
|
70
|
-
scrollTo(
|
|
69
|
+
var left = getScrollLeft(scroller);
|
|
70
|
+
scrollTo(scroller, {
|
|
71
71
|
left,
|
|
72
72
|
duration: props.duration,
|
|
73
73
|
animation: easeInOutCubic
|
|
74
74
|
});
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
var
|
|
78
|
-
show.value = getScrollTop(
|
|
77
|
+
var handleScroll = throttle(() => {
|
|
78
|
+
show.value = getScrollTop(scroller) >= toPxNum(props.visibilityHeight);
|
|
79
|
+
}, 200);
|
|
80
|
+
|
|
81
|
+
var setScroller = () => {
|
|
82
|
+
scroller = props.target ? getTarget(props.target, 'BackTop') : getParentScroller(backTopEl.value);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
var addScrollerEventListener = () => {
|
|
86
|
+
scroller.addEventListener('scroll', handleScroll);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
var removeScrollerEventListener = () => {
|
|
90
|
+
scroller.removeEventListener('scroll', handleScroll);
|
|
79
91
|
};
|
|
80
92
|
|
|
81
|
-
var throttleScroll = throttle(scroll, 200);
|
|
82
93
|
onMounted(() => {
|
|
83
|
-
|
|
84
|
-
|
|
94
|
+
setScroller();
|
|
95
|
+
addScrollerEventListener();
|
|
85
96
|
disabled.value = false;
|
|
86
97
|
});
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
98
|
+
onActivated(addScrollerEventListener);
|
|
99
|
+
onBeforeUnmount(removeScrollerEventListener);
|
|
100
|
+
onDeactivated(removeScrollerEventListener);
|
|
90
101
|
return {
|
|
91
102
|
disabled,
|
|
92
103
|
show,
|
|
@@ -94,7 +105,7 @@ var __sfc__ = defineComponent({
|
|
|
94
105
|
toSizeUnit,
|
|
95
106
|
n,
|
|
96
107
|
classes,
|
|
97
|
-
|
|
108
|
+
handleClick
|
|
98
109
|
};
|
|
99
110
|
}
|
|
100
111
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
3
|
import VarButton from '../button/index.mjs';
|
|
4
|
-
import { defineComponent, ref, computed,
|
|
4
|
+
import { defineComponent, ref, computed, onUpdated, watch } from 'vue';
|
|
5
5
|
import { props } from './props.mjs';
|
|
6
6
|
import { useBottomNavigationItems } from './provide.mjs';
|
|
7
7
|
import { createNamespace, call } from '../utils/components.mjs';
|
|
8
8
|
import { isNumber, isArray } from '@varlet/shared';
|
|
9
|
+
import { useMounted } from '@varlet/use';
|
|
9
10
|
var {
|
|
10
11
|
n,
|
|
11
12
|
classes
|
|
@@ -186,7 +187,7 @@ var __sfc__ = defineComponent({
|
|
|
186
187
|
immediate: true,
|
|
187
188
|
deep: true
|
|
188
189
|
});
|
|
189
|
-
|
|
190
|
+
useMounted(() => {
|
|
190
191
|
if (!slots.fab) {
|
|
191
192
|
return;
|
|
192
193
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, watch } from 'vue';
|
|
1
|
+
import { defineComponent, onActivated, onDeactivated, onUnmounted, ref, watch } from 'vue';
|
|
2
2
|
import { props } from './props.mjs';
|
|
3
3
|
import { requestAnimationFrame, cancelAnimationFrame } from '../utils/elements.mjs';
|
|
4
4
|
import { call, createNamespace } from '../utils/components.mjs';
|
|
@@ -93,9 +93,17 @@ var __sfc__ = defineComponent({
|
|
|
93
93
|
autoStart
|
|
94
94
|
} = props;
|
|
95
95
|
var now = performance.now();
|
|
96
|
-
|
|
96
|
+
|
|
97
|
+
if (!endTime.value) {
|
|
98
|
+
endTime.value = now + toNumber(time);
|
|
99
|
+
}
|
|
100
|
+
|
|
97
101
|
var durationTime = endTime.value - now;
|
|
98
|
-
|
|
102
|
+
|
|
103
|
+
if (durationTime < 0) {
|
|
104
|
+
durationTime = 0;
|
|
105
|
+
}
|
|
106
|
+
|
|
99
107
|
pauseTime.value = durationTime;
|
|
100
108
|
formatTime(durationTime);
|
|
101
109
|
|
|
@@ -104,20 +112,26 @@ var __sfc__ = defineComponent({
|
|
|
104
112
|
return;
|
|
105
113
|
}
|
|
106
114
|
|
|
107
|
-
if (autoStart || isStart.value)
|
|
115
|
+
if (autoStart || isStart.value) {
|
|
116
|
+
handle.value = requestAnimationFrame(countdown);
|
|
117
|
+
}
|
|
108
118
|
}; // expose
|
|
109
119
|
|
|
110
120
|
|
|
111
121
|
var start = () => {
|
|
112
|
-
if (isStart.value)
|
|
122
|
+
if (isStart.value) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
113
126
|
isStart.value = true;
|
|
114
|
-
endTime.value =
|
|
127
|
+
endTime.value = performance.now() + (pauseTime.value || toNumber(props.time));
|
|
115
128
|
countdown();
|
|
116
129
|
}; // expose
|
|
117
130
|
|
|
118
131
|
|
|
119
132
|
var pause = () => {
|
|
120
133
|
isStart.value = false;
|
|
134
|
+
cancelAnimationFrame(handle.value);
|
|
121
135
|
}; // expose
|
|
122
136
|
|
|
123
137
|
|
|
@@ -128,9 +142,12 @@ var __sfc__ = defineComponent({
|
|
|
128
142
|
countdown();
|
|
129
143
|
};
|
|
130
144
|
|
|
131
|
-
watch(() => props.time,
|
|
145
|
+
watch(() => props.time, reset, {
|
|
132
146
|
immediate: true
|
|
133
147
|
});
|
|
148
|
+
onActivated(start);
|
|
149
|
+
onDeactivated(pause);
|
|
150
|
+
onUnmounted(pause);
|
|
134
151
|
return {
|
|
135
152
|
showTime,
|
|
136
153
|
timeData,
|
|
@@ -5,11 +5,12 @@ import isSameOrBefore from 'dayjs/esm/plugin/isSameOrBefore';
|
|
|
5
5
|
import isSameOrAfter from 'dayjs/esm/plugin/isSameOrAfter';
|
|
6
6
|
import PanelHeader from './panel-header.mjs';
|
|
7
7
|
import VarButton from '../../button/index.mjs';
|
|
8
|
-
import { defineComponent, ref, computed, watch,
|
|
8
|
+
import { defineComponent, ref, computed, watch, reactive } from 'vue';
|
|
9
9
|
import { WEEK_HEADER } from '../props.mjs';
|
|
10
10
|
import { toNumber } from '@varlet/shared';
|
|
11
11
|
import { createNamespace } from '../../utils/components.mjs';
|
|
12
12
|
import { pack } from '../../locale/index.mjs';
|
|
13
|
+
import { useMounted } from '@varlet/use';
|
|
13
14
|
dayjs.extend(isSameOrBefore);
|
|
14
15
|
dayjs.extend(isSameOrAfter);
|
|
15
16
|
var {
|
|
@@ -327,7 +328,7 @@ var __sfc__ = defineComponent({
|
|
|
327
328
|
headerEl.value.checkDate(checkType);
|
|
328
329
|
};
|
|
329
330
|
|
|
330
|
-
|
|
331
|
+
useMounted(() => {
|
|
331
332
|
initDate();
|
|
332
333
|
initHeader();
|
|
333
334
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { defineComponent, computed, onMounted } from 'vue';
|
|
2
1
|
import dayjs from 'dayjs/esm';
|
|
2
|
+
import { defineComponent, computed } from 'vue';
|
|
3
3
|
import { toNumber } from '@varlet/shared';
|
|
4
4
|
import { createNamespace } from '../../utils/components.mjs';
|
|
5
|
+
import { useMounted } from '@varlet/use';
|
|
5
6
|
var {
|
|
6
7
|
n,
|
|
7
8
|
classes
|
|
@@ -89,7 +90,7 @@ var __sfc__ = defineComponent({
|
|
|
89
90
|
emit('choose-year', year);
|
|
90
91
|
};
|
|
91
92
|
|
|
92
|
-
|
|
93
|
+
useMounted(() => {
|
|
93
94
|
var activeEl = document.querySelector("." + n('item--active'));
|
|
94
95
|
activeEl == null ? void 0 : activeEl.scrollIntoView({
|
|
95
96
|
block: 'center'
|
package/es/divider/Divider.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
|
-
import { defineComponent, computed, reactive,
|
|
3
|
+
import { defineComponent, computed, reactive, onUpdated, toRefs } from 'vue';
|
|
4
4
|
import { toSizeUnit } from '../utils/elements.mjs';
|
|
5
5
|
import { isBoolean, toNumber } from '@varlet/shared';
|
|
6
6
|
import { props } from './props.mjs';
|
|
7
7
|
import { createNamespace } from '../utils/components.mjs';
|
|
8
|
+
import { useMounted } from '@varlet/use';
|
|
8
9
|
var {
|
|
9
10
|
n,
|
|
10
11
|
classes
|
|
@@ -36,7 +37,9 @@ var __sfc__ = defineComponent({
|
|
|
36
37
|
var state = reactive({
|
|
37
38
|
withText: false
|
|
38
39
|
});
|
|
39
|
-
var isInset = computed(() =>
|
|
40
|
+
var isInset = computed(() => {
|
|
41
|
+
return isBoolean(props.inset) ? props.inset : true;
|
|
42
|
+
});
|
|
40
43
|
var style = computed(() => {
|
|
41
44
|
var {
|
|
42
45
|
inset,
|
|
@@ -46,10 +49,12 @@ var __sfc__ = defineComponent({
|
|
|
46
49
|
var baseStyle = {
|
|
47
50
|
margin
|
|
48
51
|
};
|
|
49
|
-
if (isBoolean(inset) || inset === 0) return _extends({}, baseStyle); // -18px -> -18
|
|
50
52
|
|
|
51
|
-
|
|
53
|
+
if (isBoolean(inset) || inset === 0) {
|
|
54
|
+
return _extends({}, baseStyle);
|
|
55
|
+
}
|
|
52
56
|
|
|
57
|
+
var _inset = toNumber(inset);
|
|
53
58
|
|
|
54
59
|
var absInsetWithUnit = Math.abs(_inset) + (inset + '').replace(_inset + '', '');
|
|
55
60
|
return vertical ? _extends({}, baseStyle, {
|
|
@@ -64,7 +69,7 @@ var __sfc__ = defineComponent({
|
|
|
64
69
|
state.withText = Boolean(slots.default) || Boolean(props.description);
|
|
65
70
|
};
|
|
66
71
|
|
|
67
|
-
|
|
72
|
+
useMounted(() => {
|
|
68
73
|
checkHasText();
|
|
69
74
|
});
|
|
70
75
|
onUpdated(() => {
|
|
@@ -2,13 +2,14 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
2
2
|
|
|
3
3
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
4
4
|
|
|
5
|
-
import { computed, defineComponent, ref, watch,
|
|
5
|
+
import { computed, defineComponent, ref, watch, onBeforeUnmount, onDeactivated } from 'vue';
|
|
6
6
|
import { isPlainObject, toNumber } from '@varlet/shared';
|
|
7
7
|
import { easeInOutCubic } from '../utils/shared.mjs';
|
|
8
8
|
import { doubleRaf, getParentScroller, getScrollLeft, getScrollTop, nextTickFrame, requestAnimationFrame, scrollTo as varScrollTo, toPxNum } from '../utils/elements.mjs';
|
|
9
9
|
import { useIndexAnchors } from './provide.mjs';
|
|
10
10
|
import { props } from './props.mjs';
|
|
11
11
|
import { createNamespace, call } from '../utils/components.mjs';
|
|
12
|
+
import { useMounted } from '@varlet/use';
|
|
12
13
|
var {
|
|
13
14
|
n,
|
|
14
15
|
classes
|
|
@@ -63,7 +64,6 @@ var __sfc__ = defineComponent({
|
|
|
63
64
|
bindIndexAnchors
|
|
64
65
|
} = useIndexAnchors();
|
|
65
66
|
var clickedName = ref('');
|
|
66
|
-
var scroller = ref(null);
|
|
67
67
|
var barEl = ref(null);
|
|
68
68
|
var anchorNameList = ref([]);
|
|
69
69
|
var active = ref();
|
|
@@ -71,6 +71,7 @@ var __sfc__ = defineComponent({
|
|
|
71
71
|
var cssMode = computed(() => props.cssMode);
|
|
72
72
|
var stickyOffsetTop = computed(() => toPxNum(props.stickyOffsetTop));
|
|
73
73
|
var zIndex = computed(() => props.zIndex);
|
|
74
|
+
var scroller = null;
|
|
74
75
|
var indexBarProvider = {
|
|
75
76
|
active,
|
|
76
77
|
sticky,
|
|
@@ -91,13 +92,16 @@ var __sfc__ = defineComponent({
|
|
|
91
92
|
};
|
|
92
93
|
|
|
93
94
|
var getOffsetTop = () => {
|
|
94
|
-
if (!('getBoundingClientRect' in scroller
|
|
95
|
+
if (!('getBoundingClientRect' in scroller)) {
|
|
96
|
+
return 0;
|
|
97
|
+
}
|
|
98
|
+
|
|
95
99
|
var {
|
|
96
100
|
top: parentTop
|
|
97
|
-
} = scroller.
|
|
101
|
+
} = scroller.getBoundingClientRect();
|
|
98
102
|
var {
|
|
99
103
|
scrollTop
|
|
100
|
-
} = scroller
|
|
104
|
+
} = scroller;
|
|
101
105
|
var {
|
|
102
106
|
top: targetTop
|
|
103
107
|
} = barEl.value.getBoundingClientRect();
|
|
@@ -105,8 +109,8 @@ var __sfc__ = defineComponent({
|
|
|
105
109
|
};
|
|
106
110
|
|
|
107
111
|
var handleScroll = () => {
|
|
108
|
-
var scrollTop = getScrollTop(scroller
|
|
109
|
-
var scrollHeight = scroller
|
|
112
|
+
var scrollTop = getScrollTop(scroller);
|
|
113
|
+
var scrollHeight = scroller === window ? document.body.scrollHeight : scroller.scrollHeight;
|
|
110
114
|
var offsetTop = getOffsetTop();
|
|
111
115
|
indexAnchors.forEach((anchor, index) => {
|
|
112
116
|
var anchorTop = anchor.ownTop.value;
|
|
@@ -131,21 +135,32 @@ var __sfc__ = defineComponent({
|
|
|
131
135
|
manualCall = false,
|
|
132
136
|
options
|
|
133
137
|
} = _ref;
|
|
134
|
-
|
|
135
|
-
if (
|
|
138
|
+
|
|
139
|
+
if (manualCall) {
|
|
140
|
+
call(props.onClick, anchorName);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (anchorName === active.value) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
|
|
136
147
|
var indexAnchor = indexAnchors.find(_ref3 => {
|
|
137
148
|
var {
|
|
138
149
|
name
|
|
139
150
|
} = _ref3;
|
|
140
151
|
return anchorName === name.value;
|
|
141
152
|
});
|
|
142
|
-
|
|
153
|
+
|
|
154
|
+
if (!indexAnchor) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
143
158
|
var offsetTop = getOffsetTop();
|
|
144
159
|
var top = indexAnchor.ownTop.value - stickyOffsetTop.value + offsetTop;
|
|
145
|
-
var left = getScrollLeft(scroller
|
|
160
|
+
var left = getScrollLeft(scroller);
|
|
146
161
|
clickedName.value = anchorName;
|
|
147
162
|
emitEvent(anchorName, options);
|
|
148
|
-
yield varScrollTo(scroller
|
|
163
|
+
yield varScrollTo(scroller, {
|
|
149
164
|
left,
|
|
150
165
|
top,
|
|
151
166
|
animation: easeInOutCubic,
|
|
@@ -159,7 +174,26 @@ var __sfc__ = defineComponent({
|
|
|
159
174
|
return function anchorClick(_x) {
|
|
160
175
|
return _ref2.apply(this, arguments);
|
|
161
176
|
};
|
|
162
|
-
}();
|
|
177
|
+
}();
|
|
178
|
+
|
|
179
|
+
var setScroller = /*#__PURE__*/function () {
|
|
180
|
+
var _ref4 = _asyncToGenerator(function* () {
|
|
181
|
+
yield doubleRaf();
|
|
182
|
+
scroller = getParentScroller(barEl.value);
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
return function setScroller() {
|
|
186
|
+
return _ref4.apply(this, arguments);
|
|
187
|
+
};
|
|
188
|
+
}();
|
|
189
|
+
|
|
190
|
+
var addScrollerListener = () => {
|
|
191
|
+
scroller.addEventListener('scroll', handleScroll);
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
var removeScrollerListener = () => {
|
|
195
|
+
scroller.removeEventListener('scroll', handleScroll);
|
|
196
|
+
}; // expose
|
|
163
197
|
|
|
164
198
|
|
|
165
199
|
var scrollTo = (index, options) => {
|
|
@@ -171,23 +205,21 @@ var __sfc__ = defineComponent({
|
|
|
171
205
|
|
|
172
206
|
watch(() => length.value, /*#__PURE__*/_asyncToGenerator(function* () {
|
|
173
207
|
yield doubleRaf();
|
|
174
|
-
indexAnchors.forEach(
|
|
208
|
+
indexAnchors.forEach(_ref6 => {
|
|
175
209
|
var {
|
|
176
210
|
name,
|
|
177
211
|
setOwnTop
|
|
178
|
-
} =
|
|
212
|
+
} = _ref6;
|
|
179
213
|
if (name.value) anchorNameList.value.push(name.value);
|
|
180
214
|
setOwnTop();
|
|
181
215
|
});
|
|
182
216
|
}));
|
|
183
|
-
|
|
184
|
-
yield
|
|
185
|
-
|
|
186
|
-
scroller.value.addEventListener('scroll', handleScroll);
|
|
217
|
+
useMounted( /*#__PURE__*/_asyncToGenerator(function* () {
|
|
218
|
+
yield setScroller();
|
|
219
|
+
addScrollerListener();
|
|
187
220
|
}));
|
|
188
|
-
onBeforeUnmount(
|
|
189
|
-
|
|
190
|
-
});
|
|
221
|
+
onBeforeUnmount(removeScrollerListener);
|
|
222
|
+
onDeactivated(removeScrollerListener);
|
|
191
223
|
return {
|
|
192
224
|
n,
|
|
193
225
|
classes,
|
package/es/index.bundle.mjs
CHANGED
|
@@ -235,7 +235,7 @@ import './time-picker/style/index.mjs'
|
|
|
235
235
|
import './tooltip/style/index.mjs'
|
|
236
236
|
import './uploader/style/index.mjs'
|
|
237
237
|
|
|
238
|
-
const version = '2.8.
|
|
238
|
+
const version = '2.8.6-alpha.1678026101378'
|
|
239
239
|
|
|
240
240
|
function install(app) {
|
|
241
241
|
ActionSheet.install && app.use(ActionSheet)
|
package/es/index.mjs
CHANGED
|
@@ -156,7 +156,7 @@ export * from './time-picker/index.mjs'
|
|
|
156
156
|
export * from './tooltip/index.mjs'
|
|
157
157
|
export * from './uploader/index.mjs'
|
|
158
158
|
|
|
159
|
-
const version = '2.8.
|
|
159
|
+
const version = '2.8.6-alpha.1678026101378'
|
|
160
160
|
|
|
161
161
|
function install(app) {
|
|
162
162
|
ActionSheet.install && app.use(ActionSheet)
|
package/es/input/Input.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import VarFormDetails from '../form-details/index.mjs';
|
|
2
2
|
import VarIcon from '../icon/index.mjs';
|
|
3
|
-
import { defineComponent, getCurrentInstance, ref, computed, nextTick
|
|
3
|
+
import { defineComponent, getCurrentInstance, ref, computed, nextTick } from 'vue';
|
|
4
4
|
import { props } from './props.mjs';
|
|
5
5
|
import { isEmpty, toNumber } from '@varlet/shared';
|
|
6
6
|
import { useValidation, createNamespace, call } from '../utils/components.mjs';
|
|
7
7
|
import { useForm } from '../form/provide.mjs';
|
|
8
|
+
import { useMounted } from '@varlet/use';
|
|
8
9
|
var {
|
|
9
10
|
n,
|
|
10
11
|
classes
|
|
@@ -24,7 +25,7 @@ function __render__(_ctx, _cache) {
|
|
|
24
25
|
|
|
25
26
|
return _openBlock(), _createElementBlock("div", {
|
|
26
27
|
class: _normalizeClass(_ctx.classes(_ctx.n(), _ctx.n('$--box'), [_ctx.disabled, _ctx.n('--disabled')])),
|
|
27
|
-
onClick: _cache[
|
|
28
|
+
onClick: _cache[14] || (_cache[14] = function () {
|
|
28
29
|
return _ctx.handleClick && _ctx.handleClick(...arguments);
|
|
29
30
|
})
|
|
30
31
|
}, [_createElementVNode("div", {
|
|
@@ -73,6 +74,12 @@ function __render__(_ctx, _cache) {
|
|
|
73
74
|
}),
|
|
74
75
|
onTouchstart: _cache[4] || (_cache[4] = function () {
|
|
75
76
|
return _ctx.handleTouchstart && _ctx.handleTouchstart(...arguments);
|
|
77
|
+
}),
|
|
78
|
+
onCompositionstart: _cache[5] || (_cache[5] = function () {
|
|
79
|
+
return _ctx.handleCompositionStart && _ctx.handleCompositionStart(...arguments);
|
|
80
|
+
}),
|
|
81
|
+
onCompositionend: _cache[6] || (_cache[6] = function () {
|
|
82
|
+
return _ctx.handleCompositionEnd && _ctx.handleCompositionEnd(...arguments);
|
|
76
83
|
})
|
|
77
84
|
}, "\n ", 46
|
|
78
85
|
/* CLASS, STYLE, PROPS, HYDRATE_EVENTS */
|
|
@@ -90,20 +97,26 @@ function __render__(_ctx, _cache) {
|
|
|
90
97
|
color: _ctx.textColor,
|
|
91
98
|
caretColor: !_ctx.errorMessage ? _ctx.focusColor : undefined
|
|
92
99
|
}),
|
|
93
|
-
onFocus: _cache[
|
|
100
|
+
onFocus: _cache[7] || (_cache[7] = function () {
|
|
94
101
|
return _ctx.handleFocus && _ctx.handleFocus(...arguments);
|
|
95
102
|
}),
|
|
96
|
-
onBlur: _cache[
|
|
103
|
+
onBlur: _cache[8] || (_cache[8] = function () {
|
|
97
104
|
return _ctx.handleBlur && _ctx.handleBlur(...arguments);
|
|
98
105
|
}),
|
|
99
|
-
onInput: _cache[
|
|
106
|
+
onInput: _cache[9] || (_cache[9] = function () {
|
|
100
107
|
return _ctx.handleInput && _ctx.handleInput(...arguments);
|
|
101
108
|
}),
|
|
102
|
-
onChange: _cache[
|
|
109
|
+
onChange: _cache[10] || (_cache[10] = function () {
|
|
103
110
|
return _ctx.handleChange && _ctx.handleChange(...arguments);
|
|
104
111
|
}),
|
|
105
|
-
onTouchstart: _cache[
|
|
112
|
+
onTouchstart: _cache[11] || (_cache[11] = function () {
|
|
106
113
|
return _ctx.handleTouchstart && _ctx.handleTouchstart(...arguments);
|
|
114
|
+
}),
|
|
115
|
+
onCompositionstart: _cache[12] || (_cache[12] = function () {
|
|
116
|
+
return _ctx.handleCompositionStart && _ctx.handleCompositionStart(...arguments);
|
|
117
|
+
}),
|
|
118
|
+
onCompositionend: _cache[13] || (_cache[13] = function () {
|
|
119
|
+
return _ctx.handleCompositionEnd && _ctx.handleCompositionEnd(...arguments);
|
|
107
120
|
})
|
|
108
121
|
}, null, 46
|
|
109
122
|
/* CLASS, STYLE, PROPS, HYDRATE_EVENTS */
|
|
@@ -241,7 +254,7 @@ var __sfc__ = defineComponent({
|
|
|
241
254
|
validateWithTrigger('onBlur');
|
|
242
255
|
};
|
|
243
256
|
|
|
244
|
-
var
|
|
257
|
+
var updateValue = e => {
|
|
245
258
|
var target = e.target;
|
|
246
259
|
var {
|
|
247
260
|
value
|
|
@@ -253,18 +266,41 @@ var __sfc__ = defineComponent({
|
|
|
253
266
|
|
|
254
267
|
value = withMaxlength(withTrim(value));
|
|
255
268
|
target.value = value;
|
|
269
|
+
return value;
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
var handleCompositionStart = e => {
|
|
273
|
+
Object.assign(e.target, {
|
|
274
|
+
composing: true
|
|
275
|
+
});
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
var handleCompositionEnd = e => {
|
|
279
|
+
var target = e.target;
|
|
280
|
+
|
|
281
|
+
if (target.composing) {
|
|
282
|
+
target.composing = false;
|
|
283
|
+
target.dispatchEvent(new Event('input'));
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
var handleInput = e => {
|
|
288
|
+
var {
|
|
289
|
+
composing
|
|
290
|
+
} = e.target;
|
|
291
|
+
|
|
292
|
+
if (composing) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
var value = updateValue(e);
|
|
256
297
|
call(props['onUpdate:modelValue'], value);
|
|
257
298
|
call(props.onInput, value, e);
|
|
258
299
|
validateWithTrigger('onInput');
|
|
259
300
|
};
|
|
260
301
|
|
|
261
302
|
var handleChange = e => {
|
|
262
|
-
var
|
|
263
|
-
var {
|
|
264
|
-
value
|
|
265
|
-
} = target;
|
|
266
|
-
value = withMaxlength(withTrim(value));
|
|
267
|
-
target.value = value;
|
|
303
|
+
var value = updateValue(e);
|
|
268
304
|
call(props.onChange, value, e);
|
|
269
305
|
validateWithTrigger('onChange');
|
|
270
306
|
};
|
|
@@ -361,7 +397,7 @@ var __sfc__ = defineComponent({
|
|
|
361
397
|
resetValidation
|
|
362
398
|
};
|
|
363
399
|
call(bindForm, inputProvider);
|
|
364
|
-
|
|
400
|
+
useMounted(() => {
|
|
365
401
|
if (props.autofocus) {
|
|
366
402
|
focus();
|
|
367
403
|
}
|
|
@@ -386,6 +422,8 @@ var __sfc__ = defineComponent({
|
|
|
386
422
|
handleClear,
|
|
387
423
|
handleClick,
|
|
388
424
|
handleTouchstart,
|
|
425
|
+
handleCompositionStart,
|
|
426
|
+
handleCompositionEnd,
|
|
389
427
|
validate,
|
|
390
428
|
resetValidation,
|
|
391
429
|
reset,
|
package/es/list/List.mjs
CHANGED
|
@@ -4,13 +4,14 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
4
4
|
|
|
5
5
|
import VarLoading from '../loading/index.mjs';
|
|
6
6
|
import Ripple from '../ripple/index.mjs';
|
|
7
|
-
import { defineComponent,
|
|
7
|
+
import { defineComponent, onUnmounted, ref, nextTick } from 'vue';
|
|
8
8
|
import { getParentScroller, toPxNum } from '../utils/elements.mjs';
|
|
9
9
|
import { props } from './props.mjs';
|
|
10
10
|
import { isNumber } from '@varlet/shared';
|
|
11
11
|
import { dt } from '../utils/shared.mjs';
|
|
12
12
|
import { createNamespace, call } from '../utils/components.mjs';
|
|
13
13
|
import { pack } from '../locale/index.mjs';
|
|
14
|
+
import { useMounted } from '@varlet/use';
|
|
14
15
|
var {
|
|
15
16
|
n,
|
|
16
17
|
classes
|
|
@@ -116,7 +117,7 @@ var __sfc__ = defineComponent({
|
|
|
116
117
|
};
|
|
117
118
|
}();
|
|
118
119
|
|
|
119
|
-
|
|
120
|
+
useMounted(() => {
|
|
120
121
|
scroller = getParentScroller(listEl.value);
|
|
121
122
|
props.immediateCheck && check();
|
|
122
123
|
scroller.addEventListener('scroll', check);
|