@varlet/ui 2.10.2-alpha.1683284670321 → 2.10.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/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/popup/popup.css +1 -1
- package/es/slider/Slider.mjs +40 -16
- package/es/slider/slider.css +1 -1
- package/es/snackbar/style/index.mjs +1 -1
- package/es/style.css +1 -1
- package/es/varlet.esm.js +2593 -2580
- package/highlight/web-types.en-US.json +1 -1
- package/highlight/web-types.zh-CN.json +1 -1
- package/lib/style.css +1 -1
- package/lib/varlet.cjs.js +39 -17
- package/package.json +6 -6
- package/umd/varlet.js +5 -5
package/lib/varlet.cjs.js
CHANGED
|
@@ -21006,7 +21006,7 @@ var {
|
|
|
21006
21006
|
n: n$f,
|
|
21007
21007
|
classes: classes$b
|
|
21008
21008
|
} = createNamespace("slider");
|
|
21009
|
-
var _hoisted_1$3 = ["onTouchstart"
|
|
21009
|
+
var _hoisted_1$3 = ["onTouchstart"];
|
|
21010
21010
|
function __render__$d(_ctx, _cache) {
|
|
21011
21011
|
var _component_var_hover_overlay = vue.resolveComponent("var-hover-overlay");
|
|
21012
21012
|
var _component_var_form_details = vue.resolveComponent("var-form-details");
|
|
@@ -21065,10 +21065,7 @@ function __render__$d(_ctx, _cache) {
|
|
|
21065
21065
|
class: vue.normalizeClass(_ctx.n(_ctx.direction + "-thumb")),
|
|
21066
21066
|
key: item.enumValue,
|
|
21067
21067
|
style: vue.normalizeStyle(_ctx.thumbStyle(item)),
|
|
21068
|
-
onTouchstart: vue.withModifiers(($event) => _ctx.start($event, item.enumValue), ["stop"])
|
|
21069
|
-
onTouchmove: vue.withModifiers(($event) => _ctx.move($event, item.enumValue), ["stop"]),
|
|
21070
|
-
onTouchend: ($event) => _ctx.end(item.enumValue),
|
|
21071
|
-
onTouchcancel: ($event) => _ctx.end(item.enumValue)
|
|
21068
|
+
onTouchstart: vue.withModifiers(($event) => _ctx.start($event, item.enumValue), ["stop"])
|
|
21072
21069
|
},
|
|
21073
21070
|
[vue.renderSlot(_ctx.$slots, "button", {
|
|
21074
21071
|
currentValue: item.text
|
|
@@ -21247,6 +21244,7 @@ var __sfc__$e = vue.defineComponent({
|
|
|
21247
21244
|
var isDisabled = vue.computed(() => props2.disabled || (form == null ? void 0 : form.disabled.value));
|
|
21248
21245
|
var isReadonly = vue.computed(() => props2.readonly || (form == null ? void 0 : form.readonly.value));
|
|
21249
21246
|
var isVertical = vue.computed(() => props2.direction === "vertical");
|
|
21247
|
+
var activeThumb;
|
|
21250
21248
|
var getOffset = (e) => {
|
|
21251
21249
|
var currentTarget = e.currentTarget;
|
|
21252
21250
|
if (!currentTarget)
|
|
@@ -21330,25 +21328,44 @@ var __sfc__$e = vue.defineComponent({
|
|
|
21330
21328
|
var offsetToThumb2 = Math.abs(offset2 - thumb2Distance);
|
|
21331
21329
|
return offsetToThumb1 <= offsetToThumb2 ? Thumbs.First : Thumbs.Second;
|
|
21332
21330
|
};
|
|
21331
|
+
var addDocumentEvents = () => {
|
|
21332
|
+
document.addEventListener("touchmove", move, {
|
|
21333
|
+
passive: false
|
|
21334
|
+
});
|
|
21335
|
+
document.addEventListener("touchend", end2);
|
|
21336
|
+
document.addEventListener("touchcancel", end2);
|
|
21337
|
+
};
|
|
21338
|
+
var removeDocumentEvents = () => {
|
|
21339
|
+
document.removeEventListener("touchmove", move);
|
|
21340
|
+
document.removeEventListener("touchend", end2);
|
|
21341
|
+
document.removeEventListener("touchcancel", end2);
|
|
21342
|
+
};
|
|
21333
21343
|
var start2 = (event, type) => {
|
|
21334
21344
|
if (!maxDistance.value)
|
|
21335
21345
|
maxDistance.value = sliderEl.value.offsetWidth;
|
|
21336
21346
|
if (!isDisabled.value) {
|
|
21337
21347
|
thumbsProps[type].active = true;
|
|
21338
21348
|
}
|
|
21349
|
+
activeThumb = type;
|
|
21350
|
+
addDocumentEvents();
|
|
21339
21351
|
if (isDisabled.value || isReadonly.value)
|
|
21340
21352
|
return;
|
|
21341
21353
|
call(props2.onStart);
|
|
21342
21354
|
isScroll.value = true;
|
|
21343
|
-
|
|
21355
|
+
var {
|
|
21356
|
+
clientX,
|
|
21357
|
+
clientY
|
|
21358
|
+
} = event.touches[0];
|
|
21359
|
+
thumbsProps[type].startPosition = isVertical.value ? clientY : clientX;
|
|
21344
21360
|
};
|
|
21345
|
-
var move = (event
|
|
21361
|
+
var move = (event) => {
|
|
21362
|
+
event.preventDefault();
|
|
21346
21363
|
if (isDisabled.value || isReadonly.value || !isScroll.value)
|
|
21347
21364
|
return;
|
|
21348
21365
|
var {
|
|
21349
21366
|
startPosition,
|
|
21350
21367
|
currentOffset
|
|
21351
|
-
} = thumbsProps[
|
|
21368
|
+
} = thumbsProps[activeThumb];
|
|
21352
21369
|
var {
|
|
21353
21370
|
clientX,
|
|
21354
21371
|
clientY
|
|
@@ -21358,9 +21375,10 @@ var __sfc__$e = vue.defineComponent({
|
|
|
21358
21375
|
moveDistance = 0;
|
|
21359
21376
|
else if (moveDistance >= maxDistance.value)
|
|
21360
21377
|
moveDistance = maxDistance.value;
|
|
21361
|
-
setPercent(moveDistance,
|
|
21378
|
+
setPercent(moveDistance, activeThumb);
|
|
21362
21379
|
};
|
|
21363
|
-
var end2 = (
|
|
21380
|
+
var end2 = () => {
|
|
21381
|
+
removeDocumentEvents();
|
|
21364
21382
|
var {
|
|
21365
21383
|
range,
|
|
21366
21384
|
modelValue,
|
|
@@ -21369,15 +21387,15 @@ var __sfc__$e = vue.defineComponent({
|
|
|
21369
21387
|
min: min2
|
|
21370
21388
|
} = props2;
|
|
21371
21389
|
if (!isDisabled.value) {
|
|
21372
|
-
thumbsProps[
|
|
21390
|
+
thumbsProps[activeThumb].active = false;
|
|
21373
21391
|
}
|
|
21374
21392
|
if (isDisabled.value || isReadonly.value)
|
|
21375
21393
|
return;
|
|
21376
21394
|
var rangeValue = [];
|
|
21377
|
-
thumbsProps[
|
|
21378
|
-
var curValue = thumbsProps[
|
|
21395
|
+
thumbsProps[activeThumb].currentOffset = thumbsProps[activeThumb].percentValue * unitWidth.value;
|
|
21396
|
+
var curValue = thumbsProps[activeThumb].percentValue * toNumber(step2) + toNumber(min2);
|
|
21379
21397
|
if (range && isArray(modelValue)) {
|
|
21380
|
-
rangeValue =
|
|
21398
|
+
rangeValue = activeThumb === Thumbs.First ? [curValue, modelValue[1]] : [modelValue[0], curValue];
|
|
21381
21399
|
}
|
|
21382
21400
|
call(onEnd, range ? rangeValue : curValue);
|
|
21383
21401
|
isScroll.value = false;
|
|
@@ -21389,8 +21407,9 @@ var __sfc__$e = vue.defineComponent({
|
|
|
21389
21407
|
return;
|
|
21390
21408
|
var offset2 = getOffset(event);
|
|
21391
21409
|
var type = getType(offset2);
|
|
21410
|
+
activeThumb = type;
|
|
21392
21411
|
setPercent(offset2, type);
|
|
21393
|
-
end2(
|
|
21412
|
+
end2();
|
|
21394
21413
|
};
|
|
21395
21414
|
var stepValidator = () => {
|
|
21396
21415
|
var stepNumber = toNumber(props2.step);
|
|
@@ -21473,6 +21492,9 @@ var __sfc__$e = vue.defineComponent({
|
|
|
21473
21492
|
return;
|
|
21474
21493
|
maxDistance.value = sliderEl.value[isVertical.value ? "offsetHeight" : "offsetWidth"];
|
|
21475
21494
|
});
|
|
21495
|
+
vue.onBeforeUnmount(() => {
|
|
21496
|
+
removeDocumentEvents();
|
|
21497
|
+
});
|
|
21476
21498
|
return {
|
|
21477
21499
|
n: n$f,
|
|
21478
21500
|
classes: classes$b,
|
|
@@ -25375,9 +25397,9 @@ const skeleton = "";
|
|
|
25375
25397
|
const SkeletonSfc = "";
|
|
25376
25398
|
const slider = "";
|
|
25377
25399
|
const SliderSfc = "";
|
|
25378
|
-
const SnackbarSfc = "";
|
|
25379
25400
|
const snackbar = "";
|
|
25380
25401
|
const coreSfc = "";
|
|
25402
|
+
const SnackbarSfc = "";
|
|
25381
25403
|
const space = "";
|
|
25382
25404
|
const step = "";
|
|
25383
25405
|
const StepSfc = "";
|
|
@@ -25402,7 +25424,7 @@ const TimePickerSfc = "";
|
|
|
25402
25424
|
const TooltipSfc = "";
|
|
25403
25425
|
const uploader = "";
|
|
25404
25426
|
const UploaderSfc = "";
|
|
25405
|
-
const version = "2.10.2
|
|
25427
|
+
const version = "2.10.2";
|
|
25406
25428
|
function install(app) {
|
|
25407
25429
|
ActionSheet.install && app.use(ActionSheet);
|
|
25408
25430
|
AppBar.install && app.use(AppBar);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varlet/ui",
|
|
3
|
-
"version": "2.10.2
|
|
3
|
+
"version": "2.10.2",
|
|
4
4
|
"description": "A material like components library",
|
|
5
5
|
"main": "lib/varlet.cjs.js",
|
|
6
6
|
"module": "es/index.mjs",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"@popperjs/core": "^2.11.6",
|
|
47
47
|
"dayjs": "^1.10.4",
|
|
48
48
|
"decimal.js": "^10.2.1",
|
|
49
|
-
"@varlet/icons": "2.10.2
|
|
50
|
-
"@varlet/shared": "2.10.2
|
|
51
|
-
"@varlet/use": "2.10.2
|
|
49
|
+
"@varlet/icons": "2.10.2",
|
|
50
|
+
"@varlet/shared": "2.10.2",
|
|
51
|
+
"@varlet/use": "2.10.2"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/jest": "^26.0.15",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"typescript": "^4.4.4",
|
|
64
64
|
"vue": "3.2.47",
|
|
65
65
|
"vue-router": "4.1.6",
|
|
66
|
-
"@varlet/cli": "2.10.2
|
|
67
|
-
"@varlet/touch-emulator": "2.10.2
|
|
66
|
+
"@varlet/cli": "2.10.2",
|
|
67
|
+
"@varlet/touch-emulator": "2.10.2"
|
|
68
68
|
},
|
|
69
69
|
"browserslist": [
|
|
70
70
|
"Chrome >= 54",
|