@varlet/ui 2.11.3-alpha.1685455534947 → 2.11.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/field-decorator/FieldDecorator.mjs +7 -6
- package/es/image/Image.mjs +40 -33
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/pagination/pagination.css +1 -1
- package/es/picker/Picker.mjs +7 -23
- package/es/picker/picker.css +1 -1
- package/es/snackbar/core.mjs +5 -5
- package/es/snackbar/snackbar.css +1 -1
- package/es/style.css +1 -1
- package/es/swipe/Swipe.mjs +14 -14
- package/es/tabs/Tabs.mjs +2 -2
- package/es/themes/dark/picker.mjs +2 -0
- package/es/varlet.esm.js +5224 -5228
- package/highlight/web-types.en-US.json +7 -2
- package/highlight/web-types.zh-CN.json +7 -2
- package/lib/style.css +1 -1
- package/lib/varlet.cjs.js +74 -78
- package/package.json +6 -6
- package/types/image.d.ts +5 -0
- package/umd/varlet.js +5 -5
package/lib/varlet.cjs.js
CHANGED
|
@@ -84,6 +84,8 @@ const find = (arr, callback, from = "start") => {
|
|
|
84
84
|
return [null, -1];
|
|
85
85
|
};
|
|
86
86
|
const normalizeToArray = (value) => isArray(value) ? value : [value];
|
|
87
|
+
const clamp$1 = (num, min2, max2) => Math.min(max2, Math.max(min2, num));
|
|
88
|
+
const clampArrayRange = (index, arr) => clamp$1(index, 0, arr.length - 1);
|
|
87
89
|
var isHTMLSupportImage = (val) => {
|
|
88
90
|
if (val == null) {
|
|
89
91
|
return false;
|
|
@@ -13913,7 +13915,7 @@ var {
|
|
|
13913
13915
|
n: n$H,
|
|
13914
13916
|
classes: classes$A
|
|
13915
13917
|
} = createNamespace("image");
|
|
13916
|
-
var _hoisted_1$j = ["alt", "title", "lazy-
|
|
13918
|
+
var _hoisted_1$j = ["alt", "title", "lazy-loading", "lazy-error"];
|
|
13917
13919
|
var _hoisted_2$b = ["alt", "title", "src"];
|
|
13918
13920
|
function __render__$I(_ctx, _cache) {
|
|
13919
13921
|
var _directive_lazy = vue.resolveDirective("lazy");
|
|
@@ -13925,35 +13927,32 @@ function __render__$I(_ctx, _cache) {
|
|
|
13925
13927
|
style: vue.normalizeStyle({
|
|
13926
13928
|
width: _ctx.toSizeUnit(_ctx.width),
|
|
13927
13929
|
height: _ctx.toSizeUnit(_ctx.height),
|
|
13928
|
-
|
|
13930
|
+
borderRadius: _ctx.toSizeUnit(_ctx.radius)
|
|
13929
13931
|
})
|
|
13930
13932
|
},
|
|
13931
|
-
[_ctx.lazy ? vue.withDirectives((vue.openBlock(), vue.createElementBlock(
|
|
13933
|
+
[_ctx.lazy && !_ctx.showErrorSlot ? vue.withDirectives((vue.openBlock(), vue.createElementBlock(
|
|
13932
13934
|
"img",
|
|
13933
13935
|
{
|
|
13934
13936
|
key: 0,
|
|
13935
13937
|
class: vue.normalizeClass(_ctx.n("image")),
|
|
13936
13938
|
alt: _ctx.alt,
|
|
13937
13939
|
title: _ctx.title,
|
|
13938
|
-
"lazy-error": _ctx.error,
|
|
13939
13940
|
"lazy-loading": _ctx.loading,
|
|
13941
|
+
"lazy-error": _ctx.error,
|
|
13940
13942
|
style: vue.normalizeStyle({
|
|
13941
13943
|
objectFit: _ctx.fit
|
|
13942
13944
|
}),
|
|
13943
13945
|
onLoad: _cache[0] || (_cache[0] = function() {
|
|
13944
13946
|
return _ctx.handleLoad && _ctx.handleLoad(...arguments);
|
|
13945
13947
|
}),
|
|
13946
|
-
|
|
13947
|
-
return _ctx.handleError && _ctx.handleError(...arguments);
|
|
13948
|
-
}),
|
|
13949
|
-
onClick: _cache[2] || (_cache[2] = function() {
|
|
13948
|
+
onClick: _cache[1] || (_cache[1] = function() {
|
|
13950
13949
|
return _ctx.handleClick && _ctx.handleClick(...arguments);
|
|
13951
13950
|
})
|
|
13952
13951
|
},
|
|
13953
13952
|
null,
|
|
13954
13953
|
46,
|
|
13955
13954
|
_hoisted_1$j
|
|
13956
|
-
)), [[_directive_lazy, _ctx.src]]) : (vue.openBlock(), vue.createElementBlock(
|
|
13955
|
+
)), [[_directive_lazy, _ctx.src]]) : vue.createCommentVNode("v-if", true), !_ctx.lazy && !_ctx.showErrorSlot ? (vue.openBlock(), vue.createElementBlock(
|
|
13957
13956
|
"img",
|
|
13958
13957
|
{
|
|
13959
13958
|
key: 1,
|
|
@@ -13964,20 +13963,22 @@ function __render__$I(_ctx, _cache) {
|
|
|
13964
13963
|
objectFit: _ctx.fit
|
|
13965
13964
|
}),
|
|
13966
13965
|
src: _ctx.src,
|
|
13967
|
-
onLoad: _cache[
|
|
13966
|
+
onLoad: _cache[2] || (_cache[2] = function() {
|
|
13968
13967
|
return _ctx.handleLoad && _ctx.handleLoad(...arguments);
|
|
13969
13968
|
}),
|
|
13970
|
-
onError: _cache[
|
|
13969
|
+
onError: _cache[3] || (_cache[3] = function() {
|
|
13971
13970
|
return _ctx.handleError && _ctx.handleError(...arguments);
|
|
13972
13971
|
}),
|
|
13973
|
-
onClick: _cache[
|
|
13972
|
+
onClick: _cache[4] || (_cache[4] = function() {
|
|
13974
13973
|
return _ctx.handleClick && _ctx.handleClick(...arguments);
|
|
13975
13974
|
})
|
|
13976
13975
|
},
|
|
13977
13976
|
null,
|
|
13978
13977
|
46,
|
|
13979
13978
|
_hoisted_2$b
|
|
13980
|
-
))
|
|
13979
|
+
)) : vue.createCommentVNode("v-if", true), _ctx.showErrorSlot ? vue.renderSlot(_ctx.$slots, "error", {
|
|
13980
|
+
key: 2
|
|
13981
|
+
}) : vue.createCommentVNode("v-if", true)],
|
|
13981
13982
|
6
|
|
13982
13983
|
/* CLASS, STYLE */
|
|
13983
13984
|
)), [[_directive_ripple, {
|
|
@@ -13991,34 +13992,39 @@ var __sfc__$J = vue.defineComponent({
|
|
|
13991
13992
|
Ripple: Ripple$1
|
|
13992
13993
|
},
|
|
13993
13994
|
props: props$E,
|
|
13994
|
-
setup(props2) {
|
|
13995
|
+
setup(props2, _ref) {
|
|
13996
|
+
var {
|
|
13997
|
+
slots
|
|
13998
|
+
} = _ref;
|
|
13999
|
+
var showErrorSlot = vue.ref(false);
|
|
14000
|
+
var handleError = (e) => {
|
|
14001
|
+
showErrorSlot.value = !!slots.error;
|
|
14002
|
+
call(props2.onError, e);
|
|
14003
|
+
};
|
|
13995
14004
|
var handleLoad = (e) => {
|
|
13996
14005
|
var el = e.currentTarget;
|
|
13997
|
-
|
|
13998
|
-
|
|
13999
|
-
|
|
14000
|
-
|
|
14001
|
-
|
|
14002
|
-
|
|
14003
|
-
|
|
14004
|
-
|
|
14006
|
+
if (props2.lazy) {
|
|
14007
|
+
if (el._lazy.state === "success") {
|
|
14008
|
+
call(props2.onLoad, e);
|
|
14009
|
+
return;
|
|
14010
|
+
}
|
|
14011
|
+
if (el._lazy.state === "error") {
|
|
14012
|
+
handleError(e);
|
|
14013
|
+
}
|
|
14005
14014
|
} else {
|
|
14006
|
-
call(onLoad, e);
|
|
14015
|
+
call(props2.onLoad, e);
|
|
14007
14016
|
}
|
|
14008
14017
|
};
|
|
14009
|
-
var handleError = (e) => {
|
|
14010
|
-
var {
|
|
14011
|
-
lazy,
|
|
14012
|
-
onError
|
|
14013
|
-
} = props2;
|
|
14014
|
-
!lazy && call(onError, e);
|
|
14015
|
-
};
|
|
14016
14018
|
var handleClick = (e) => {
|
|
14017
14019
|
call(props2.onClick, e);
|
|
14018
14020
|
};
|
|
14021
|
+
vue.watch(() => props2.src, () => {
|
|
14022
|
+
showErrorSlot.value = false;
|
|
14023
|
+
});
|
|
14019
14024
|
return {
|
|
14020
14025
|
n: n$H,
|
|
14021
14026
|
classes: classes$A,
|
|
14027
|
+
showErrorSlot,
|
|
14022
14028
|
toSizeUnit,
|
|
14023
14029
|
handleLoad,
|
|
14024
14030
|
handleError,
|
|
@@ -14252,17 +14258,17 @@ var __sfc__$I = vue.defineComponent({
|
|
|
14252
14258
|
}
|
|
14253
14259
|
return swipeIndex;
|
|
14254
14260
|
};
|
|
14255
|
-
var
|
|
14256
|
-
|
|
14257
|
-
|
|
14258
|
-
|
|
14259
|
-
|
|
14260
|
-
|
|
14261
|
-
|
|
14262
|
-
|
|
14263
|
-
return
|
|
14261
|
+
var clampIndex = (index2) => {
|
|
14262
|
+
if (props2.loop) {
|
|
14263
|
+
if (index2 < 0) {
|
|
14264
|
+
return length.value + index2;
|
|
14265
|
+
}
|
|
14266
|
+
if (index2 >= length.value) {
|
|
14267
|
+
return index2 - length.value;
|
|
14268
|
+
}
|
|
14269
|
+
return index2;
|
|
14264
14270
|
}
|
|
14265
|
-
return index2;
|
|
14271
|
+
return clamp$1(index2, 0, length.value - 1);
|
|
14266
14272
|
};
|
|
14267
14273
|
var fixPosition = (fn2) => {
|
|
14268
14274
|
var overLeft = translate.value >= size.value;
|
|
@@ -14285,7 +14291,7 @@ var __sfc__$I = vue.defineComponent({
|
|
|
14285
14291
|
if (initializedIndex) {
|
|
14286
14292
|
return;
|
|
14287
14293
|
}
|
|
14288
|
-
index.value =
|
|
14294
|
+
index.value = clampIndex(toNumber(props2.initialIndex));
|
|
14289
14295
|
initializedIndex = true;
|
|
14290
14296
|
};
|
|
14291
14297
|
var startAutoplay = () => {
|
|
@@ -14403,7 +14409,7 @@ var __sfc__$I = vue.defineComponent({
|
|
|
14403
14409
|
onChange
|
|
14404
14410
|
} = props2;
|
|
14405
14411
|
var currentIndex = index.value;
|
|
14406
|
-
index.value =
|
|
14412
|
+
index.value = clampIndex(currentIndex + 1);
|
|
14407
14413
|
if ((options == null ? void 0 : options.event) !== false) {
|
|
14408
14414
|
call(onChange, index.value);
|
|
14409
14415
|
}
|
|
@@ -14428,7 +14434,7 @@ var __sfc__$I = vue.defineComponent({
|
|
|
14428
14434
|
onChange
|
|
14429
14435
|
} = props2;
|
|
14430
14436
|
var currentIndex = index.value;
|
|
14431
|
-
index.value =
|
|
14437
|
+
index.value = clampIndex(currentIndex - 1);
|
|
14432
14438
|
if ((options == null ? void 0 : options.event) !== false) {
|
|
14433
14439
|
call(onChange, index.value);
|
|
14434
14440
|
}
|
|
@@ -15837,7 +15843,7 @@ function __render__$B(_ctx, _cache) {
|
|
|
15837
15843
|
[vue.renderSlot(_ctx.$slots, "default")],
|
|
15838
15844
|
2
|
|
15839
15845
|
/* CLASS */
|
|
15840
|
-
), _ctx.hint ? (vue.openBlock(), vue.createElementBlock(
|
|
15846
|
+
), _ctx.placeholder && _ctx.hint ? (vue.openBlock(), vue.createElementBlock(
|
|
15841
15847
|
"label",
|
|
15842
15848
|
{
|
|
15843
15849
|
key: 0,
|
|
@@ -15901,7 +15907,7 @@ function __render__$B(_ctx, _cache) {
|
|
|
15901
15907
|
width: _ctx.legendWidth
|
|
15902
15908
|
})
|
|
15903
15909
|
},
|
|
15904
|
-
[_ctx.hint ? (vue.openBlock(), vue.createBlock(vue.Teleport, {
|
|
15910
|
+
[_ctx.placeholder && _ctx.hint ? (vue.openBlock(), vue.createBlock(vue.Teleport, {
|
|
15905
15911
|
key: 0,
|
|
15906
15912
|
to: "body"
|
|
15907
15913
|
}, [vue.createElementVNode(
|
|
@@ -15981,9 +15987,10 @@ var __sfc__$C = vue.defineComponent({
|
|
|
15981
15987
|
var {
|
|
15982
15988
|
size,
|
|
15983
15989
|
hint,
|
|
15984
|
-
variant
|
|
15990
|
+
variant,
|
|
15991
|
+
placeholder
|
|
15985
15992
|
} = props2;
|
|
15986
|
-
if (!hint || variant !== "outlined") {
|
|
15993
|
+
if (!placeholder || !hint || variant !== "outlined") {
|
|
15987
15994
|
legendWidth.value = "";
|
|
15988
15995
|
return;
|
|
15989
15996
|
}
|
|
@@ -15998,7 +16005,7 @@ var __sfc__$C = vue.defineComponent({
|
|
|
15998
16005
|
call(props2.onClick, e);
|
|
15999
16006
|
};
|
|
16000
16007
|
useMounted(resize);
|
|
16001
|
-
vue.
|
|
16008
|
+
vue.onUpdated(resize);
|
|
16002
16009
|
useEventListener(() => window, "resize", resize);
|
|
16003
16010
|
return {
|
|
16004
16011
|
placeholderTextEl,
|
|
@@ -18283,27 +18290,14 @@ var __sfc__$u = vue.defineComponent({
|
|
|
18283
18290
|
var handlePopupUpdateShow = (value) => {
|
|
18284
18291
|
call(props2["onUpdate:show"], value);
|
|
18285
18292
|
};
|
|
18286
|
-
var
|
|
18287
|
-
var
|
|
18288
|
-
var
|
|
18289
|
-
|
|
18290
|
-
scrollColumn.translate = startTranslate;
|
|
18291
|
-
}
|
|
18292
|
-
if (scrollColumn.translate <= endTranslate) {
|
|
18293
|
-
scrollColumn.translate = endTranslate;
|
|
18294
|
-
}
|
|
18295
|
-
};
|
|
18296
|
-
var boundaryIndex = (scrollColumn, index) => {
|
|
18297
|
-
var {
|
|
18298
|
-
length
|
|
18299
|
-
} = scrollColumn.column.texts;
|
|
18300
|
-
index = index >= length ? length - 1 : index;
|
|
18301
|
-
index = index <= 0 ? 0 : index;
|
|
18302
|
-
return index;
|
|
18293
|
+
var clampTranslate = (scrollColumn) => {
|
|
18294
|
+
var minTranslate = center.value - scrollColumn.column.texts.length * optionHeight.value;
|
|
18295
|
+
var maxTranslate = optionHeight.value + center.value;
|
|
18296
|
+
scrollColumn.translate = clamp$1(scrollColumn.translate, minTranslate, maxTranslate);
|
|
18303
18297
|
};
|
|
18304
18298
|
var getTargetIndex = (scrollColumn, viewTranslate) => {
|
|
18305
18299
|
var index = Math.round((center.value - viewTranslate) / optionHeight.value);
|
|
18306
|
-
return
|
|
18300
|
+
return clampArrayRange(index, scrollColumn.column.texts);
|
|
18307
18301
|
};
|
|
18308
18302
|
var updateTranslate = (scrollColumn) => {
|
|
18309
18303
|
scrollColumn.translate = center.value - scrollColumn.index * optionHeight.value;
|
|
@@ -18352,7 +18346,7 @@ var __sfc__$u = vue.defineComponent({
|
|
|
18352
18346
|
var deltaY = scrollColumn.prevY !== void 0 ? clientY - scrollColumn.prevY : 0;
|
|
18353
18347
|
scrollColumn.prevY = clientY;
|
|
18354
18348
|
scrollColumn.translate += deltaY;
|
|
18355
|
-
|
|
18349
|
+
clampTranslate(scrollColumn);
|
|
18356
18350
|
var now = performance.now();
|
|
18357
18351
|
if (now - scrollColumn.momentumTime > MOMENTUM_RECORD_TIME) {
|
|
18358
18352
|
scrollColumn.momentumTime = now;
|
|
@@ -21814,14 +21808,6 @@ function __render__$c(_ctx, _cache) {
|
|
|
21814
21808
|
{
|
|
21815
21809
|
class: vue.normalizeClass([_ctx.n("icon")])
|
|
21816
21810
|
},
|
|
21817
|
-
[vue.renderSlot(_ctx.$slots, "icon")],
|
|
21818
|
-
2
|
|
21819
|
-
/* CLASS */
|
|
21820
|
-
), vue.createElementVNode(
|
|
21821
|
-
"div",
|
|
21822
|
-
{
|
|
21823
|
-
class: vue.normalizeClass(_ctx.n("action"))
|
|
21824
|
-
},
|
|
21825
21811
|
[_ctx.iconName ? (vue.openBlock(), vue.createBlock(
|
|
21826
21812
|
_component_var_icon,
|
|
21827
21813
|
{
|
|
@@ -21843,7 +21829,15 @@ function __render__$c(_ctx, _cache) {
|
|
|
21843
21829
|
null,
|
|
21844
21830
|
8,
|
|
21845
21831
|
["type", "size", "color", "radius"]
|
|
21846
|
-
)) : vue.createCommentVNode("v-if", true), vue.renderSlot(_ctx.$slots, "
|
|
21832
|
+
)) : vue.createCommentVNode("v-if", true), vue.renderSlot(_ctx.$slots, "icon")],
|
|
21833
|
+
2
|
|
21834
|
+
/* CLASS */
|
|
21835
|
+
), vue.createElementVNode(
|
|
21836
|
+
"div",
|
|
21837
|
+
{
|
|
21838
|
+
class: vue.normalizeClass(_ctx.n("action"))
|
|
21839
|
+
},
|
|
21840
|
+
[vue.renderSlot(_ctx.$slots, "action")],
|
|
21847
21841
|
2
|
|
21848
21842
|
/* CLASS */
|
|
21849
21843
|
)],
|
|
@@ -23440,7 +23434,7 @@ var __sfc__$4 = vue.defineComponent({
|
|
|
23440
23434
|
active: active2
|
|
23441
23435
|
} = props2;
|
|
23442
23436
|
if (isNumber(active2)) {
|
|
23443
|
-
var activeIndex = active2
|
|
23437
|
+
var activeIndex = clamp$1(active2, 0, length.value - 1);
|
|
23444
23438
|
call(props2["onUpdate:active"], activeIndex);
|
|
23445
23439
|
return matchIndex(activeIndex);
|
|
23446
23440
|
}
|
|
@@ -23757,6 +23751,8 @@ const pagination$1 = {
|
|
|
23757
23751
|
const picker$1 = {
|
|
23758
23752
|
"--picker-background": "#1e1e1e",
|
|
23759
23753
|
"--picker-cancel-button-text-color": "#aaa",
|
|
23754
|
+
"--picker-title-text-color": "#fff",
|
|
23755
|
+
"--picker-option-text-color": "#fff",
|
|
23760
23756
|
"--picker-picked-border": "1px solid rgba(255, 255, 255, 0.12)",
|
|
23761
23757
|
"--picker-mask-background-image": "linear-gradient(180deg, hsla(0, 0%, 12%, 0.9), hsla(0, 0%, 12%, 0.4)), linear-gradient(0deg, hsla(0, 0%, 12%, 0.9), hsla(0, 0%, 12%, 0.4))"
|
|
23762
23758
|
};
|
|
@@ -25564,7 +25560,7 @@ const TimePickerSfc = "";
|
|
|
25564
25560
|
const TooltipSfc = "";
|
|
25565
25561
|
const uploader = "";
|
|
25566
25562
|
const UploaderSfc = "";
|
|
25567
|
-
const version = "2.11.3
|
|
25563
|
+
const version = "2.11.3";
|
|
25568
25564
|
function install(app) {
|
|
25569
25565
|
ActionSheet.install && app.use(ActionSheet);
|
|
25570
25566
|
AppBar.install && app.use(AppBar);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varlet/ui",
|
|
3
|
-
"version": "2.11.3
|
|
3
|
+
"version": "2.11.3",
|
|
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.11.3
|
|
50
|
-
"@varlet/
|
|
51
|
-
"@varlet/
|
|
49
|
+
"@varlet/icons": "2.11.3",
|
|
50
|
+
"@varlet/use": "2.11.3",
|
|
51
|
+
"@varlet/shared": "2.11.3"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@vue/runtime-core": "3.3.1",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"typescript": "^4.4.4",
|
|
64
64
|
"vue": "3.3.2",
|
|
65
65
|
"vue-router": "4.2.0",
|
|
66
|
-
"@varlet/cli": "2.11.3
|
|
67
|
-
"@varlet/touch-emulator": "2.11.3
|
|
66
|
+
"@varlet/cli": "2.11.3",
|
|
67
|
+
"@varlet/touch-emulator": "2.11.3"
|
|
68
68
|
},
|
|
69
69
|
"browserslist": [
|
|
70
70
|
"Chrome >= 54",
|
package/types/image.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { VarComponent, BasicAttributes, ListenerProp } from './varComponent'
|
|
2
|
+
import { VNode } from 'vue'
|
|
2
3
|
|
|
3
4
|
export declare const imageProps: Record<string, any>
|
|
4
5
|
|
|
@@ -24,6 +25,10 @@ export interface ImageProps extends BasicAttributes {
|
|
|
24
25
|
|
|
25
26
|
export class Image extends VarComponent {
|
|
26
27
|
$props: ImageProps
|
|
28
|
+
|
|
29
|
+
$slots: {
|
|
30
|
+
error(): VNode[]
|
|
31
|
+
}
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
export class _ImageComponent extends Image {}
|