@varlet/ui 2.6.2 → 2.6.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/es/app-bar/appBar.css +1 -1
- package/es/index-bar/IndexBar.js +43 -19
- package/es/slider/Slider.js +1 -8
- package/es/slider/props.js +7 -0
- package/es/snackbar/style/index.js +1 -1
- package/es/style.css +1 -1
- package/es/swipe/Swipe.js +27 -10
- package/es/varlet.esm.js +1784 -1763
- package/highlight/web-types.json +1 -1
- package/lib/app-bar/appBar.css +1 -1
- package/lib/index-bar/IndexBar.js +43 -19
- package/lib/slider/Slider.js +17 -23
- package/lib/slider/props.js +9 -1
- package/lib/snackbar/style/index.js +1 -1
- package/lib/style.css +1 -1
- package/lib/swipe/Swipe.js +27 -10
- package/package.json +5 -5
- package/types/indexBar.d.ts +5 -1
- package/types/swipe.d.ts +7 -3
- package/umd/varlet.js +7 -7
package/es/app-bar/appBar.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root { --app-bar-color: var(--color-primary); --app-bar-title-padding: 0 12px; --app-bar-text-color: #fff; --app-bar-height: 54px; --app-bar-left-gap: 6px; --app-bar-right-gap: 6px; --app-bar-border-radius: 4px;}.var-app-bar { position: relative; display: flex; width: 100%; justify-content: center; align-items: center; height: var(--app-bar-height); background: var(--app-bar-color); color: var(--app-bar-text-color); transition: background-color 0.25s;}.var-app-bar__title { flex: 1; display: flex; justify-content: center; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; padding: var(--app-bar-title-padding);}.var-app-bar__left,.var-app-bar__right { display: flex; align-items: center; height: 100%; z-index: 2;}.var-app-bar__left { position: absolute; top: 0; left: var(--app-bar-left-gap);}.var-app-bar__right { position: absolute; top: 0; right: var(--app-bar-right-gap);}.var-app-bar--round { border-radius: var(--app-bar-border-radius);}
|
|
1
|
+
:root { --app-bar-color: var(--color-primary); --app-bar-title-padding: 0 12px; --app-bar-title-font-size: var(--font-size-lg); --app-bar-text-color: #fff; --app-bar-height: 54px; --app-bar-left-gap: 6px; --app-bar-right-gap: 6px; --app-bar-border-radius: 4px; --app-bar-font-size: var(--font-size-lg);}.var-app-bar { position: relative; display: flex; width: 100%; font-size: var(--app-bar-font-size); justify-content: center; align-items: center; height: var(--app-bar-height); background: var(--app-bar-color); color: var(--app-bar-text-color); transition: background-color 0.25s;}.var-app-bar__title { font-size: var(--app-bar-title-font-size); flex: 1; display: flex; justify-content: center; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; padding: var(--app-bar-title-padding);}.var-app-bar__left,.var-app-bar__right { display: flex; align-items: center; height: 100%; z-index: 2;}.var-app-bar__left { position: absolute; top: 0; left: var(--app-bar-left-gap);}.var-app-bar__right { position: absolute; top: 0; right: var(--app-bar-right-gap);}.var-app-bar--round { border-radius: var(--app-bar-border-radius);}
|
package/es/index-bar/IndexBar.js
CHANGED
|
@@ -35,7 +35,10 @@ export function render(_ctx, _cache) {
|
|
|
35
35
|
style: _normalizeStyle({
|
|
36
36
|
color: _ctx.active === anchorName && _ctx.highlightColor ? _ctx.highlightColor : ''
|
|
37
37
|
}),
|
|
38
|
-
onClick: $event => _ctx.anchorClick(
|
|
38
|
+
onClick: $event => _ctx.anchorClick({
|
|
39
|
+
anchorName,
|
|
40
|
+
manualCall: true
|
|
41
|
+
})
|
|
39
42
|
}, _toDisplayString(anchorName), 15
|
|
40
43
|
/* TEXT, CLASS, STYLE, PROPS */
|
|
41
44
|
, _hoisted_1);
|
|
@@ -76,25 +79,40 @@ export default defineComponent({
|
|
|
76
79
|
};
|
|
77
80
|
bindIndexAnchors(indexBarProvider);
|
|
78
81
|
|
|
79
|
-
var emitEvent = anchor => {
|
|
82
|
+
var emitEvent = (anchor, options) => {
|
|
80
83
|
var anchorName = isPlainObject(anchor) ? anchor.name.value : anchor;
|
|
81
84
|
if (anchorName === active.value || anchorName === undefined) return;
|
|
82
85
|
active.value = anchorName;
|
|
83
|
-
|
|
86
|
+
|
|
87
|
+
if ((options == null ? void 0 : options.event) !== false) {
|
|
88
|
+
call(props.onChange, anchorName);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
var getOffsetTop = () => {
|
|
93
|
+
if (!('getBoundingClientRect' in scroller.value)) return 0;
|
|
94
|
+
var {
|
|
95
|
+
top: parentTop
|
|
96
|
+
} = scroller.value.getBoundingClientRect();
|
|
97
|
+
var {
|
|
98
|
+
scrollTop
|
|
99
|
+
} = scroller.value;
|
|
100
|
+
var {
|
|
101
|
+
top: targetTop
|
|
102
|
+
} = barEl.value.getBoundingClientRect();
|
|
103
|
+
return scrollTop - parentTop + targetTop;
|
|
84
104
|
};
|
|
85
105
|
|
|
86
106
|
var handleScroll = () => {
|
|
87
107
|
var scrollTop = getScrollTop(scroller.value);
|
|
88
108
|
var scrollHeight = scroller.value === window ? document.body.scrollHeight : scroller.value.scrollHeight;
|
|
89
|
-
var
|
|
90
|
-
offsetTop
|
|
91
|
-
} = barEl.value;
|
|
109
|
+
var offsetTop = getOffsetTop();
|
|
92
110
|
indexAnchors.forEach((anchor, index) => {
|
|
93
111
|
var anchorTop = anchor.ownTop.value;
|
|
94
112
|
var top = scrollTop - anchorTop + stickyOffsetTop.value - offsetTop;
|
|
95
113
|
var distance = index === indexAnchors.length - 1 ? scrollHeight : indexAnchors[index + 1].ownTop.value - anchor.ownTop.value;
|
|
96
114
|
|
|
97
|
-
if (top >= 0 && top < distance &&
|
|
115
|
+
if (top >= 0 && top < distance && clickedName.value === '') {
|
|
98
116
|
if (index && !props.cssMode) {
|
|
99
117
|
indexAnchors[index - 1].setDisabled(true);
|
|
100
118
|
}
|
|
@@ -106,23 +124,26 @@ export default defineComponent({
|
|
|
106
124
|
};
|
|
107
125
|
|
|
108
126
|
var anchorClick = /*#__PURE__*/function () {
|
|
109
|
-
var
|
|
127
|
+
var _ref2 = _asyncToGenerator(function* (_ref) {
|
|
110
128
|
var {
|
|
111
|
-
|
|
112
|
-
|
|
129
|
+
anchorName,
|
|
130
|
+
manualCall = false,
|
|
131
|
+
options
|
|
132
|
+
} = _ref;
|
|
113
133
|
if (manualCall) call(props.onClick, anchorName);
|
|
114
134
|
if (anchorName === active.value) return;
|
|
115
|
-
var indexAnchor = indexAnchors.find(
|
|
135
|
+
var indexAnchor = indexAnchors.find(_ref3 => {
|
|
116
136
|
var {
|
|
117
137
|
name
|
|
118
|
-
} =
|
|
138
|
+
} = _ref3;
|
|
119
139
|
return anchorName === name.value;
|
|
120
140
|
});
|
|
121
141
|
if (!indexAnchor) return;
|
|
142
|
+
var offsetTop = getOffsetTop();
|
|
122
143
|
var top = indexAnchor.ownTop.value - stickyOffsetTop.value + offsetTop;
|
|
123
144
|
var left = getScrollLeft(scroller.value);
|
|
124
145
|
clickedName.value = anchorName;
|
|
125
|
-
emitEvent(anchorName);
|
|
146
|
+
emitEvent(anchorName, options);
|
|
126
147
|
yield varScrollTo(scroller.value, {
|
|
127
148
|
left,
|
|
128
149
|
top,
|
|
@@ -134,23 +155,26 @@ export default defineComponent({
|
|
|
134
155
|
});
|
|
135
156
|
});
|
|
136
157
|
|
|
137
|
-
return function anchorClick(_x
|
|
138
|
-
return
|
|
158
|
+
return function anchorClick(_x) {
|
|
159
|
+
return _ref2.apply(this, arguments);
|
|
139
160
|
};
|
|
140
161
|
}(); // expose
|
|
141
162
|
|
|
142
163
|
|
|
143
|
-
var scrollTo = index => {
|
|
144
|
-
requestAnimationFrame(() => anchorClick(
|
|
164
|
+
var scrollTo = (index, options) => {
|
|
165
|
+
requestAnimationFrame(() => anchorClick({
|
|
166
|
+
anchorName: index,
|
|
167
|
+
options
|
|
168
|
+
}));
|
|
145
169
|
};
|
|
146
170
|
|
|
147
171
|
watch(() => length.value, /*#__PURE__*/_asyncToGenerator(function* () {
|
|
148
172
|
yield doubleRaf();
|
|
149
|
-
indexAnchors.forEach(
|
|
173
|
+
indexAnchors.forEach(_ref5 => {
|
|
150
174
|
var {
|
|
151
175
|
name,
|
|
152
176
|
setOwnTop
|
|
153
|
-
} =
|
|
177
|
+
} = _ref5;
|
|
154
178
|
if (name.value) anchorNameList.value.push(name.value);
|
|
155
179
|
setOwnTop();
|
|
156
180
|
});
|
package/es/slider/Slider.js
CHANGED
|
@@ -3,19 +3,12 @@ import { useValidation, createNamespace, call } from '../utils/components';
|
|
|
3
3
|
import { useForm } from '../form/provide';
|
|
4
4
|
import { getLeft, multiplySizeUnit } from '../utils/elements';
|
|
5
5
|
import { isArray, isNumber, toNumber } from '@varlet/shared';
|
|
6
|
-
import { props } from './props';
|
|
6
|
+
import { props, Thumbs } from './props';
|
|
7
7
|
import VarFormDetails from '../form-details';
|
|
8
8
|
var {
|
|
9
9
|
n,
|
|
10
10
|
classes
|
|
11
11
|
} = createNamespace('slider');
|
|
12
|
-
var Thumbs;
|
|
13
|
-
|
|
14
|
-
(function (Thumbs) {
|
|
15
|
-
Thumbs["First"] = "1";
|
|
16
|
-
Thumbs["Second"] = "2";
|
|
17
|
-
})(Thumbs || (Thumbs = {}));
|
|
18
|
-
|
|
19
12
|
import { normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, renderSlot as _renderSlot, toDisplayString as _toDisplayString, withModifiers as _withModifiers, resolveComponent as _resolveComponent, createVNode as _createVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
20
13
|
|
|
21
14
|
var _withScopeId = n => (_pushScopeId(""), n = n(), _popScopeId(), n);
|
package/es/slider/props.js
CHANGED
|
@@ -4,6 +4,13 @@ function labelValidator(label) {
|
|
|
4
4
|
return ['always', 'normal', 'never'].includes(label);
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
export var Thumbs;
|
|
8
|
+
|
|
9
|
+
(function (Thumbs) {
|
|
10
|
+
Thumbs["First"] = "1";
|
|
11
|
+
Thumbs["Second"] = "2";
|
|
12
|
+
})(Thumbs || (Thumbs = {}));
|
|
13
|
+
|
|
7
14
|
export var props = {
|
|
8
15
|
// 当前进度百分比
|
|
9
16
|
modelValue: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import '../../styles/common.css'
|
|
2
|
+
import '../SnackbarSfc.css'
|
|
2
3
|
import '../../styles/elevation.css'
|
|
3
4
|
import '../../loading/loading.css'
|
|
4
5
|
import '../../button/button.css'
|
|
5
6
|
import '../../icon/icon.css'
|
|
6
7
|
import '../snackbar.css'
|
|
7
8
|
import '../coreSfc.css'
|
|
8
|
-
import '../SnackbarSfc.css'
|