@varlet/ui 3.1.0-alpha.1709717246484 → 3.1.0
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/button/Button.mjs +10 -10
- package/es/button/props.mjs +3 -1
- package/es/date-picker/date-picker.css +1 -1
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/picker/props.mjs +2 -3
- package/es/popup/props.mjs +6 -7
- package/es/select/useSelectController.mjs +2 -4
- package/es/slider/Slider.mjs +124 -41
- package/es/snackbar/style/index.mjs +1 -1
- package/es/style.css +1 -1
- package/es/themes/dark/datePicker.mjs +1 -0
- package/es/themes/dark/timePicker.mjs +2 -1
- package/es/themes/md3-dark/datePicker.mjs +1 -0
- package/es/themes/md3-dark/timePicker.mjs +2 -1
- package/es/themes/md3-light/datePicker.mjs +1 -0
- package/es/themes/md3-light/timePicker.mjs +2 -1
- package/es/time-picker/timePicker.css +1 -1
- package/es/tooltip/props.mjs +5 -6
- package/es/varlet.esm.js +4679 -4620
- package/highlight/web-types.en-US.json +37 -2
- package/lib/style.css +1 -1
- package/lib/varlet.cjs.js +162 -73
- package/package.json +7 -7
- package/types/picker.d.ts +4 -0
- package/types/popup.d.ts +2 -0
- package/types/styleVars.d.ts +4 -0
- package/types/tooltip.d.ts +1 -0
- package/umd/varlet.js +6 -6
package/lib/varlet.cjs.js
CHANGED
|
@@ -587,7 +587,10 @@ function useWindowSize(options = {}) {
|
|
|
587
587
|
function useVModel(props2, key, options = {}) {
|
|
588
588
|
const { passive: passive2 = true, eventName, defaultValue, emit } = options;
|
|
589
589
|
const event = eventName != null ? eventName : `onUpdate:${key.toString()}`;
|
|
590
|
-
const getValue = () =>
|
|
590
|
+
const getValue = () => {
|
|
591
|
+
var _a;
|
|
592
|
+
return (_a = props2[key]) != null ? _a : defaultValue;
|
|
593
|
+
};
|
|
591
594
|
if (!passive2) {
|
|
592
595
|
return vue.computed({
|
|
593
596
|
get() {
|
|
@@ -973,6 +976,10 @@ const props$1g = {
|
|
|
973
976
|
type: Boolean,
|
|
974
977
|
default: true
|
|
975
978
|
},
|
|
979
|
+
closeOnKeyEscape: {
|
|
980
|
+
type: Boolean,
|
|
981
|
+
default: true
|
|
982
|
+
},
|
|
976
983
|
defaultStyle: {
|
|
977
984
|
type: Boolean,
|
|
978
985
|
default: true
|
|
@@ -987,16 +994,11 @@ const props$1g = {
|
|
|
987
994
|
onOpened: defineListenerProp(),
|
|
988
995
|
onClose: defineListenerProp(),
|
|
989
996
|
onClosed: defineListenerProp(),
|
|
997
|
+
onKeyEscape: defineListenerProp(),
|
|
990
998
|
onClickOverlay: defineListenerProp(),
|
|
991
999
|
"onUpdate:show": defineListenerProp(),
|
|
992
1000
|
// internal for Dialog
|
|
993
|
-
onRouteChange: defineListenerProp()
|
|
994
|
-
// internal for esc
|
|
995
|
-
onKeyEscape: defineListenerProp(),
|
|
996
|
-
closeOnKeyEscape: {
|
|
997
|
-
type: Boolean,
|
|
998
|
-
default: true
|
|
999
|
-
}
|
|
1001
|
+
onRouteChange: defineListenerProp()
|
|
1000
1002
|
};
|
|
1001
1003
|
function resolveLock() {
|
|
1002
1004
|
const lockCounts = Object.keys(stdin_default$5V.locks).length;
|
|
@@ -3377,7 +3379,9 @@ const props$18 = {
|
|
|
3377
3379
|
},
|
|
3378
3380
|
loadingRadius: [Number, String],
|
|
3379
3381
|
loadingType: pickProps(props$19, "type"),
|
|
3380
|
-
loadingSize: pickProps(props$19, "size"),
|
|
3382
|
+
loadingSize: __spreadProps$7(__spreadValues$o({}, pickProps(props$19, "size")), {
|
|
3383
|
+
default: void 0
|
|
3384
|
+
}),
|
|
3381
3385
|
loadingColor: __spreadProps$7(__spreadValues$o({}, pickProps(props$19, "color")), {
|
|
3382
3386
|
default: "currentColor"
|
|
3383
3387
|
}),
|
|
@@ -3443,7 +3447,7 @@ function __render__$1f(_ctx, _cache) {
|
|
|
3443
3447
|
"var-button-cover": "",
|
|
3444
3448
|
color: _ctx.loadingColor,
|
|
3445
3449
|
type: _ctx.loadingType,
|
|
3446
|
-
size: _ctx.loadingSize,
|
|
3450
|
+
size: _ctx.loadingSize || _ctx.states.size,
|
|
3447
3451
|
radius: _ctx.loadingRadius
|
|
3448
3452
|
}, null, 8, ["class", "color", "type", "size", "radius"])) : vue.createCommentVNode("v-if", true),
|
|
3449
3453
|
vue.createElementVNode(
|
|
@@ -3480,11 +3484,12 @@ const __sfc__$1g = vue.defineComponent({
|
|
|
3480
3484
|
const { buttonGroup } = useButtonGroup();
|
|
3481
3485
|
const { hovering, handleHovering } = useHoverOverlay();
|
|
3482
3486
|
const states = vue.computed(() => {
|
|
3487
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3483
3488
|
if (!buttonGroup) {
|
|
3484
3489
|
return {
|
|
3485
3490
|
elevation: formatElevation(props2.elevation, 2),
|
|
3486
|
-
type: props2.type != null ?
|
|
3487
|
-
size: props2.size != null ?
|
|
3491
|
+
type: (_a = props2.type) != null ? _a : "default",
|
|
3492
|
+
size: (_b = props2.size) != null ? _b : "normal",
|
|
3488
3493
|
color: props2.color,
|
|
3489
3494
|
text: props2.text,
|
|
3490
3495
|
textColor: props2.textColor,
|
|
@@ -3495,10 +3500,10 @@ const __sfc__$1g = vue.defineComponent({
|
|
|
3495
3500
|
const { type, size, color, textColor, mode } = buttonGroup;
|
|
3496
3501
|
return {
|
|
3497
3502
|
elevation: "",
|
|
3498
|
-
type: props2.type != null ?
|
|
3499
|
-
size: props2.size != null ?
|
|
3500
|
-
color: props2.color != null ?
|
|
3501
|
-
textColor: props2.textColor != null ?
|
|
3503
|
+
type: (_c = props2.type) != null ? _c : type.value,
|
|
3504
|
+
size: (_d = props2.size) != null ? _d : size.value,
|
|
3505
|
+
color: (_e = props2.color) != null ? _e : color.value,
|
|
3506
|
+
textColor: (_f = props2.textColor) != null ? _f : textColor.value,
|
|
3502
3507
|
text: mode.value === "text" || mode.value === "outline",
|
|
3503
3508
|
outline: mode.value === "outline",
|
|
3504
3509
|
iconContainer: mode.value === "icon-container"
|
|
@@ -3507,8 +3512,7 @@ const __sfc__$1g = vue.defineComponent({
|
|
|
3507
3512
|
function attemptAutoLoading(result) {
|
|
3508
3513
|
if (props2.autoLoading) {
|
|
3509
3514
|
pending.value = true;
|
|
3510
|
-
|
|
3511
|
-
Promise.all(result).then(() => {
|
|
3515
|
+
Promise.all(normalizeToArray(result)).then(() => {
|
|
3512
3516
|
pending.value = false;
|
|
3513
3517
|
}).catch(() => {
|
|
3514
3518
|
pending.value = false;
|
|
@@ -13736,17 +13740,16 @@ const props$L = {
|
|
|
13736
13740
|
},
|
|
13737
13741
|
sameWidth: Boolean,
|
|
13738
13742
|
closeOnClickReference: Boolean,
|
|
13743
|
+
closeOnKeyEscape: {
|
|
13744
|
+
type: Boolean,
|
|
13745
|
+
default: true
|
|
13746
|
+
},
|
|
13739
13747
|
onOpen: defineListenerProp(),
|
|
13740
13748
|
onOpened: defineListenerProp(),
|
|
13741
13749
|
onClose: defineListenerProp(),
|
|
13742
13750
|
onClosed: defineListenerProp(),
|
|
13743
13751
|
onClickOutside: defineListenerProp(),
|
|
13744
|
-
"onUpdate:show": defineListenerProp()
|
|
13745
|
-
// internal for esc
|
|
13746
|
-
closeOnKeyEscape: {
|
|
13747
|
-
type: Boolean,
|
|
13748
|
-
default: true
|
|
13749
|
-
}
|
|
13752
|
+
"onUpdate:show": defineListenerProp()
|
|
13750
13753
|
};
|
|
13751
13754
|
const { name: name$L, n: n$O, classes: classes$G } = createNamespace("tooltip");
|
|
13752
13755
|
function __render__$O(_ctx, _cache) {
|
|
@@ -17650,10 +17653,8 @@ function useSelectController(options) {
|
|
|
17650
17653
|
return (_a = option == null ? void 0 : option.label.value) != null ? _a : "";
|
|
17651
17654
|
}
|
|
17652
17655
|
function findValueOrLabel({ value, label: label2 }) {
|
|
17653
|
-
|
|
17654
|
-
|
|
17655
|
-
}
|
|
17656
|
-
return label2.value;
|
|
17656
|
+
var _a;
|
|
17657
|
+
return (_a = value.value) != null ? _a : label2.value;
|
|
17657
17658
|
}
|
|
17658
17659
|
function getSelectedValue(option) {
|
|
17659
17660
|
const multiple = multipleGetter();
|
|
@@ -18640,6 +18641,7 @@ const props$o = __spreadValues$7({
|
|
|
18640
18641
|
"show",
|
|
18641
18642
|
"onUpdate:show",
|
|
18642
18643
|
"closeOnClickOverlay",
|
|
18644
|
+
"closeOnKeyEscape",
|
|
18643
18645
|
"teleport",
|
|
18644
18646
|
"safeArea",
|
|
18645
18647
|
"onOpen",
|
|
@@ -18648,9 +18650,7 @@ const props$o = __spreadValues$7({
|
|
|
18648
18650
|
"onClosed",
|
|
18649
18651
|
"onClickOverlay",
|
|
18650
18652
|
"onRouteChange",
|
|
18651
|
-
|
|
18652
|
-
"onKeyEscape",
|
|
18653
|
-
"closeOnKeyEscape"
|
|
18653
|
+
"onKeyEscape"
|
|
18654
18654
|
]));
|
|
18655
18655
|
const { name: name$o, n: n$r, classes: classes$m } = createNamespace("picker");
|
|
18656
18656
|
const MOMENTUM_RECORD_TIME = 300;
|
|
@@ -21580,7 +21580,7 @@ const props$e = {
|
|
|
21580
21580
|
"onUpdate:modelValue": defineListenerProp()
|
|
21581
21581
|
};
|
|
21582
21582
|
const { name: name$e, n: n$g, classes: classes$c } = createNamespace("slider");
|
|
21583
|
-
const _hoisted_1$4 = ["onTouchstart"];
|
|
21583
|
+
const _hoisted_1$4 = ["tabindex", "onTouchstart", "onFocusin", "onFocusout"];
|
|
21584
21584
|
function __render__$e(_ctx, _cache) {
|
|
21585
21585
|
const _component_var_hover_overlay = vue.resolveComponent("var-hover-overlay");
|
|
21586
21586
|
const _component_var_form_details = vue.resolveComponent("var-form-details");
|
|
@@ -21641,7 +21641,10 @@ function __render__$e(_ctx, _cache) {
|
|
|
21641
21641
|
class: vue.normalizeClass(_ctx.n(`${_ctx.direction}-thumb`)),
|
|
21642
21642
|
key: item.enumValue,
|
|
21643
21643
|
style: vue.normalizeStyle(_ctx.thumbStyle(item)),
|
|
21644
|
-
|
|
21644
|
+
tabindex: _ctx.isDisabled ? void 0 : "0",
|
|
21645
|
+
onTouchstart: vue.withModifiers(($event) => _ctx.start($event, item.enumValue), ["stop"]),
|
|
21646
|
+
onFocusin: ($event) => _ctx.handleFocus(item),
|
|
21647
|
+
onFocusout: ($event) => _ctx.handleBlur(item)
|
|
21645
21648
|
}, [
|
|
21646
21649
|
vue.renderSlot(_ctx.$slots, "button", {
|
|
21647
21650
|
currentValue: item.text
|
|
@@ -21675,8 +21678,9 @@ function __render__$e(_ctx, _cache) {
|
|
|
21675
21678
|
},
|
|
21676
21679
|
[
|
|
21677
21680
|
vue.createVNode(_component_var_hover_overlay, {
|
|
21678
|
-
hovering: item.hovering
|
|
21679
|
-
|
|
21681
|
+
hovering: !_ctx.isDisabled && item.hovering,
|
|
21682
|
+
focusing: !_ctx.isDisabled && item.focusing
|
|
21683
|
+
}, null, 8, ["hovering", "focusing"])
|
|
21680
21684
|
],
|
|
21681
21685
|
6
|
|
21682
21686
|
/* CLASS, STYLE */
|
|
@@ -21743,6 +21747,8 @@ const __sfc__$f = vue.defineComponent({
|
|
|
21743
21747
|
const isDisabled = vue.computed(() => props2.disabled || (form == null ? void 0 : form.disabled.value));
|
|
21744
21748
|
const isReadonly = vue.computed(() => props2.readonly || (form == null ? void 0 : form.readonly.value));
|
|
21745
21749
|
const isVertical = vue.computed(() => props2.direction === "vertical");
|
|
21750
|
+
const focusingFirst = vue.ref(false);
|
|
21751
|
+
const focusingSecond = vue.ref(false);
|
|
21746
21752
|
const { bindForm, form } = useForm();
|
|
21747
21753
|
const { errorMessage, validateWithTrigger: vt, validate: v, resetValidation } = useValidation();
|
|
21748
21754
|
const { hovering: hoveringFirst, handleHovering: handleHoveringFirst } = useHoverOverlay();
|
|
@@ -21756,15 +21762,23 @@ const __sfc__$f = vue.defineComponent({
|
|
|
21756
21762
|
value: getValue(modelValue[0]),
|
|
21757
21763
|
enumValue: Thumbs.First,
|
|
21758
21764
|
text: toPrecision(modelValue[0]),
|
|
21759
|
-
hovering:
|
|
21760
|
-
|
|
21765
|
+
hovering: hoveringFirst.value,
|
|
21766
|
+
focusing: focusingFirst.value,
|
|
21767
|
+
handleHovering: handleHoveringFirst,
|
|
21768
|
+
handleFocusing(value) {
|
|
21769
|
+
focusingFirst.value = value;
|
|
21770
|
+
}
|
|
21761
21771
|
},
|
|
21762
21772
|
{
|
|
21763
21773
|
value: getValue(modelValue[1]),
|
|
21764
21774
|
enumValue: Thumbs.Second,
|
|
21765
21775
|
text: toPrecision(modelValue[1]),
|
|
21766
|
-
hovering:
|
|
21767
|
-
|
|
21776
|
+
hovering: hoveringSecond.value,
|
|
21777
|
+
focusing: focusingSecond.value,
|
|
21778
|
+
handleHovering: handleHoveringSecond,
|
|
21779
|
+
handleFocusing(value) {
|
|
21780
|
+
focusingSecond.value = value;
|
|
21781
|
+
}
|
|
21768
21782
|
}
|
|
21769
21783
|
];
|
|
21770
21784
|
} else if (isNumber(modelValue)) {
|
|
@@ -21773,8 +21787,12 @@ const __sfc__$f = vue.defineComponent({
|
|
|
21773
21787
|
value: getValue(modelValue),
|
|
21774
21788
|
enumValue: Thumbs.First,
|
|
21775
21789
|
text: toPrecision(modelValue),
|
|
21776
|
-
hovering:
|
|
21777
|
-
|
|
21790
|
+
hovering: hoveringFirst.value,
|
|
21791
|
+
focusing: focusingFirst.value,
|
|
21792
|
+
handleHovering: handleHoveringFirst,
|
|
21793
|
+
handleFocusing(value) {
|
|
21794
|
+
focusingFirst.value = value;
|
|
21795
|
+
}
|
|
21778
21796
|
}
|
|
21779
21797
|
];
|
|
21780
21798
|
}
|
|
@@ -21808,19 +21826,24 @@ const __sfc__$f = vue.defineComponent({
|
|
|
21808
21826
|
};
|
|
21809
21827
|
call(bindForm, sliderProvider);
|
|
21810
21828
|
vue.watch([() => props2.modelValue, () => props2.step], ([modelValue, step]) => {
|
|
21811
|
-
if (!stepValidator() || !valueValidator() || isScroll.value)
|
|
21829
|
+
if (!stepValidator() || !valueValidator() || isScroll.value) {
|
|
21812
21830
|
return;
|
|
21831
|
+
}
|
|
21813
21832
|
setProps(modelValue, toNumber(step));
|
|
21814
21833
|
});
|
|
21815
21834
|
vue.watch(maxDistance, () => setProps());
|
|
21816
21835
|
onSmartMounted(() => {
|
|
21817
|
-
if (!stepValidator() || !valueValidator())
|
|
21836
|
+
if (!stepValidator() || !valueValidator()) {
|
|
21818
21837
|
return;
|
|
21819
|
-
|
|
21820
|
-
|
|
21821
|
-
vue.onBeforeUnmount(() => {
|
|
21822
|
-
removeDocumentEvents();
|
|
21838
|
+
}
|
|
21839
|
+
resizeMaxDistance();
|
|
21823
21840
|
});
|
|
21841
|
+
vue.onBeforeUnmount(removeDocumentEvents);
|
|
21842
|
+
useEventListener(() => window, "keydown", handleKeydown);
|
|
21843
|
+
onWindowResize(resizeMaxDistance);
|
|
21844
|
+
function resizeMaxDistance() {
|
|
21845
|
+
maxDistance.value = sliderEl.value[isVertical.value ? "offsetHeight" : "offsetWidth"];
|
|
21846
|
+
}
|
|
21824
21847
|
function validate() {
|
|
21825
21848
|
return v(props2.rules, props2.modelValue);
|
|
21826
21849
|
}
|
|
@@ -21837,8 +21860,9 @@ const __sfc__$f = vue.defineComponent({
|
|
|
21837
21860
|
}
|
|
21838
21861
|
function getOffset(e) {
|
|
21839
21862
|
const currentTarget = e.currentTarget;
|
|
21840
|
-
if (!currentTarget)
|
|
21863
|
+
if (!currentTarget) {
|
|
21841
21864
|
return 0;
|
|
21865
|
+
}
|
|
21842
21866
|
if (!isVertical.value) {
|
|
21843
21867
|
return e.clientX - getLeft(currentTarget);
|
|
21844
21868
|
}
|
|
@@ -21852,36 +21876,49 @@ const __sfc__$f = vue.defineComponent({
|
|
|
21852
21876
|
};
|
|
21853
21877
|
}
|
|
21854
21878
|
function showLabel(type) {
|
|
21855
|
-
if (props2.labelVisible === "always")
|
|
21879
|
+
if (props2.labelVisible === "always") {
|
|
21856
21880
|
return true;
|
|
21857
|
-
|
|
21881
|
+
}
|
|
21882
|
+
if (props2.labelVisible === "never") {
|
|
21858
21883
|
return false;
|
|
21884
|
+
}
|
|
21859
21885
|
return thumbsProps[type].active;
|
|
21860
21886
|
}
|
|
21861
21887
|
function getValue(value) {
|
|
21862
21888
|
const { min: min2, max: max2 } = props2;
|
|
21863
|
-
if (value < toNumber(min2))
|
|
21889
|
+
if (value < toNumber(min2)) {
|
|
21864
21890
|
return 0;
|
|
21865
|
-
|
|
21891
|
+
}
|
|
21892
|
+
if (value > toNumber(max2)) {
|
|
21866
21893
|
return 100;
|
|
21894
|
+
}
|
|
21867
21895
|
return (value - toNumber(min2)) / scope.value * 100;
|
|
21868
21896
|
}
|
|
21869
21897
|
function toPrecision(value) {
|
|
21870
|
-
if (!isNumber(value))
|
|
21898
|
+
if (!isNumber(value)) {
|
|
21871
21899
|
return 0;
|
|
21900
|
+
}
|
|
21872
21901
|
let num = value;
|
|
21873
|
-
if (num < Number(props2.min))
|
|
21902
|
+
if (num < Number(props2.min)) {
|
|
21874
21903
|
num = Number(props2.min);
|
|
21875
|
-
|
|
21904
|
+
}
|
|
21905
|
+
if (num > Number(props2.max)) {
|
|
21876
21906
|
num = Number(props2.max);
|
|
21907
|
+
}
|
|
21877
21908
|
const isInteger = parseInt(`${num}`, 10) === num;
|
|
21878
21909
|
return isInteger ? num : toNumber(num.toPrecision(5));
|
|
21879
21910
|
}
|
|
21880
21911
|
function hover(value, item) {
|
|
21881
|
-
if (isDisabled.value)
|
|
21912
|
+
if (isDisabled.value) {
|
|
21882
21913
|
return;
|
|
21914
|
+
}
|
|
21883
21915
|
item.handleHovering(value);
|
|
21884
21916
|
}
|
|
21917
|
+
function emitChange(value) {
|
|
21918
|
+
call(props2.onChange, value);
|
|
21919
|
+
call(props2["onUpdate:modelValue"], value);
|
|
21920
|
+
validateWithTrigger();
|
|
21921
|
+
}
|
|
21885
21922
|
function setPercent(moveDistance, type) {
|
|
21886
21923
|
let rangeValue = [];
|
|
21887
21924
|
const { step, range, modelValue, onChange, min: min2 } = props2;
|
|
@@ -21895,14 +21932,13 @@ const __sfc__$f = vue.defineComponent({
|
|
|
21895
21932
|
}
|
|
21896
21933
|
if (prevValue !== curValue) {
|
|
21897
21934
|
const value = range ? rangeValue.map((value2) => toPrecision(value2)) : toPrecision(curValue);
|
|
21898
|
-
|
|
21899
|
-
call(props2["onUpdate:modelValue"], value);
|
|
21900
|
-
validateWithTrigger();
|
|
21935
|
+
emitChange(value);
|
|
21901
21936
|
}
|
|
21902
21937
|
}
|
|
21903
21938
|
function getType(offset2) {
|
|
21904
|
-
if (!props2.range)
|
|
21939
|
+
if (!props2.range) {
|
|
21905
21940
|
return Thumbs.First;
|
|
21941
|
+
}
|
|
21906
21942
|
const thumb1Distance = thumbsProps[Thumbs.First].percentValue * unitWidth.value;
|
|
21907
21943
|
const thumb2Distance = thumbsProps[Thumbs.Second].percentValue * unitWidth.value;
|
|
21908
21944
|
const offsetToThumb1 = Math.abs(offset2 - thumb1Distance);
|
|
@@ -21920,15 +21956,15 @@ const __sfc__$f = vue.defineComponent({
|
|
|
21920
21956
|
document.removeEventListener("touchcancel", end2);
|
|
21921
21957
|
}
|
|
21922
21958
|
function start2(event, type) {
|
|
21923
|
-
|
|
21924
|
-
maxDistance.value = sliderEl.value.offsetWidth;
|
|
21959
|
+
resizeMaxDistance();
|
|
21925
21960
|
if (!isDisabled.value) {
|
|
21926
21961
|
thumbsProps[type].active = true;
|
|
21927
21962
|
}
|
|
21928
21963
|
activeThumb = type;
|
|
21929
21964
|
addDocumentEvents();
|
|
21930
|
-
if (isDisabled.value || isReadonly.value)
|
|
21965
|
+
if (isDisabled.value || isReadonly.value) {
|
|
21931
21966
|
return;
|
|
21967
|
+
}
|
|
21932
21968
|
call(props2.onStart);
|
|
21933
21969
|
isScroll.value = true;
|
|
21934
21970
|
const { clientX, clientY } = event.touches[0];
|
|
@@ -21936,15 +21972,17 @@ const __sfc__$f = vue.defineComponent({
|
|
|
21936
21972
|
}
|
|
21937
21973
|
function move(event) {
|
|
21938
21974
|
preventDefault(event);
|
|
21939
|
-
if (isDisabled.value || isReadonly.value || !isScroll.value)
|
|
21975
|
+
if (isDisabled.value || isReadonly.value || !isScroll.value) {
|
|
21940
21976
|
return;
|
|
21977
|
+
}
|
|
21941
21978
|
const { startPosition, currentOffset } = thumbsProps[activeThumb];
|
|
21942
21979
|
const { clientX, clientY } = event.touches[0];
|
|
21943
21980
|
let moveDistance = (isVertical.value ? startPosition - clientY : clientX - startPosition) + currentOffset;
|
|
21944
|
-
if (moveDistance <= 0)
|
|
21981
|
+
if (moveDistance <= 0) {
|
|
21945
21982
|
moveDistance = 0;
|
|
21946
|
-
else if (moveDistance >= maxDistance.value)
|
|
21983
|
+
} else if (moveDistance >= maxDistance.value) {
|
|
21947
21984
|
moveDistance = maxDistance.value;
|
|
21985
|
+
}
|
|
21948
21986
|
setPercent(moveDistance, activeThumb);
|
|
21949
21987
|
}
|
|
21950
21988
|
function end2() {
|
|
@@ -21953,8 +21991,9 @@ const __sfc__$f = vue.defineComponent({
|
|
|
21953
21991
|
if (!isDisabled.value) {
|
|
21954
21992
|
thumbsProps[activeThumb].active = false;
|
|
21955
21993
|
}
|
|
21956
|
-
if (isDisabled.value || isReadonly.value)
|
|
21994
|
+
if (isDisabled.value || isReadonly.value) {
|
|
21957
21995
|
return;
|
|
21996
|
+
}
|
|
21958
21997
|
let rangeValue = [];
|
|
21959
21998
|
thumbsProps[activeThumb].currentOffset = thumbsProps[activeThumb].percentValue * unitWidth.value;
|
|
21960
21999
|
const curValue = thumbsProps[activeThumb].percentValue * toNumber(step) + toNumber(min2);
|
|
@@ -22006,10 +22045,12 @@ const __sfc__$f = vue.defineComponent({
|
|
|
22006
22045
|
function setProps(modelValue = props2.modelValue, step = toNumber(props2.step)) {
|
|
22007
22046
|
const getPercent = (value) => {
|
|
22008
22047
|
const { min: min2, max: max2 } = props2;
|
|
22009
|
-
if (value < toNumber(min2))
|
|
22048
|
+
if (value < toNumber(min2)) {
|
|
22010
22049
|
return 0;
|
|
22011
|
-
|
|
22050
|
+
}
|
|
22051
|
+
if (value > toNumber(max2)) {
|
|
22012
22052
|
return scope.value / step;
|
|
22053
|
+
}
|
|
22013
22054
|
return (value - toNumber(min2)) / step;
|
|
22014
22055
|
};
|
|
22015
22056
|
if (props2.range && isArray(modelValue)) {
|
|
@@ -22026,6 +22067,46 @@ const __sfc__$f = vue.defineComponent({
|
|
|
22026
22067
|
call(props2["onUpdate:modelValue"], resetValue);
|
|
22027
22068
|
resetValidation();
|
|
22028
22069
|
}
|
|
22070
|
+
function moveFocusingThumb(offset2, value) {
|
|
22071
|
+
const stepValue = Number(props2.step);
|
|
22072
|
+
if (isArray(value)) {
|
|
22073
|
+
const updatedFirstValue = value[0] + (focusingFirst.value ? offset2 * stepValue : 0);
|
|
22074
|
+
const updatedSecondValue = value[1] + (focusingSecond.value ? offset2 * stepValue : 0);
|
|
22075
|
+
return [updatedFirstValue, updatedSecondValue].map(toPrecision);
|
|
22076
|
+
}
|
|
22077
|
+
return toPrecision(value + offset2 * stepValue);
|
|
22078
|
+
}
|
|
22079
|
+
function handleKeydown(event) {
|
|
22080
|
+
const keyToOffset = {
|
|
22081
|
+
ArrowRight: 1,
|
|
22082
|
+
ArrowUp: 1,
|
|
22083
|
+
ArrowLeft: -1,
|
|
22084
|
+
ArrowDown: -1
|
|
22085
|
+
};
|
|
22086
|
+
const { key } = event;
|
|
22087
|
+
if (!hasOwn(keyToOffset, key) || isReadonly.value || isDisabled.value) {
|
|
22088
|
+
return;
|
|
22089
|
+
}
|
|
22090
|
+
if (props2.range && !focusingFirst.value && !focusingSecond.value) {
|
|
22091
|
+
return;
|
|
22092
|
+
}
|
|
22093
|
+
if (!props2.range && !focusingFirst.value) {
|
|
22094
|
+
return;
|
|
22095
|
+
}
|
|
22096
|
+
preventDefault(event);
|
|
22097
|
+
const offset2 = keyToOffset[key];
|
|
22098
|
+
const value = moveFocusingThumb(offset2, props2.modelValue);
|
|
22099
|
+
emitChange(value);
|
|
22100
|
+
}
|
|
22101
|
+
function handleFocus(item) {
|
|
22102
|
+
if (isDisabled.value) {
|
|
22103
|
+
return;
|
|
22104
|
+
}
|
|
22105
|
+
item.handleFocusing(true);
|
|
22106
|
+
}
|
|
22107
|
+
function handleBlur(item) {
|
|
22108
|
+
item.handleFocusing(false);
|
|
22109
|
+
}
|
|
22029
22110
|
return {
|
|
22030
22111
|
Thumbs,
|
|
22031
22112
|
sliderEl,
|
|
@@ -22035,6 +22116,8 @@ const __sfc__$f = vue.defineComponent({
|
|
|
22035
22116
|
errorMessage,
|
|
22036
22117
|
thumbsProps,
|
|
22037
22118
|
thumbList,
|
|
22119
|
+
handleFocus,
|
|
22120
|
+
handleBlur,
|
|
22038
22121
|
n: n$g,
|
|
22039
22122
|
classes: classes$c,
|
|
22040
22123
|
thumbStyle,
|
|
@@ -24006,6 +24089,7 @@ var stdin_default$2$ = {
|
|
|
24006
24089
|
"--date-picker-title-date-font-size": "34px",
|
|
24007
24090
|
"--date-picker-title-date-font-weight": "500",
|
|
24008
24091
|
"--date-picker-title-date-range-font-size": "20px",
|
|
24092
|
+
"--date-picker-title-date-justify-content": "normal",
|
|
24009
24093
|
"--date-picker-body-height": "280px",
|
|
24010
24094
|
"--date-picker-body-padding": "0",
|
|
24011
24095
|
"--date-picker-header-padding": "4px 16px",
|
|
@@ -24292,7 +24376,8 @@ var stdin_default$2M = {
|
|
|
24292
24376
|
"--time-picker-inner-top": "36px",
|
|
24293
24377
|
"--time-picker-inner-bottom": "36px",
|
|
24294
24378
|
"--time-picker-body-height": "288px",
|
|
24295
|
-
"--time-picker-actions-padding": "0 8px 12px 8px"
|
|
24379
|
+
"--time-picker-actions-padding": "0 8px 12px 8px",
|
|
24380
|
+
"--time-picker-title-time-container-justify-content": "flex-end"
|
|
24296
24381
|
};
|
|
24297
24382
|
var stdin_default$2L = {
|
|
24298
24383
|
"--uploader-action-background": "#303030",
|
|
@@ -25285,7 +25370,8 @@ var stdin_default$1z = {
|
|
|
25285
25370
|
"--time-picker-inner-right": "36px",
|
|
25286
25371
|
"--time-picker-inner-top": "36px",
|
|
25287
25372
|
"--time-picker-inner-bottom": "36px",
|
|
25288
|
-
"--time-picker-body-height": "288px"
|
|
25373
|
+
"--time-picker-body-height": "288px",
|
|
25374
|
+
"--time-picker-title-time-container-justify-content": "flex-end"
|
|
25289
25375
|
};
|
|
25290
25376
|
var stdin_default$1y = {
|
|
25291
25377
|
"--date-picker-title-background": "var(--color-surface-container-high)",
|
|
@@ -25313,6 +25399,7 @@ var stdin_default$1y = {
|
|
|
25313
25399
|
"--date-picker-title-date-font-size": "34px",
|
|
25314
25400
|
"--date-picker-title-date-font-weight": "500",
|
|
25315
25401
|
"--date-picker-title-date-range-font-size": "20px",
|
|
25402
|
+
"--date-picker-title-date-justify-content": "normal",
|
|
25316
25403
|
"--month-picker-padding": "0 12px",
|
|
25317
25404
|
"--month-picker-item-width": "33%",
|
|
25318
25405
|
"--month-picker-item-height": "56px",
|
|
@@ -26326,7 +26413,8 @@ var stdin_default$q = {
|
|
|
26326
26413
|
"--time-picker-inner-right": "36px",
|
|
26327
26414
|
"--time-picker-inner-top": "36px",
|
|
26328
26415
|
"--time-picker-inner-bottom": "36px",
|
|
26329
|
-
"--time-picker-body-height": "288px"
|
|
26416
|
+
"--time-picker-body-height": "288px",
|
|
26417
|
+
"--time-picker-title-time-container-justify-content": "flex-end"
|
|
26330
26418
|
};
|
|
26331
26419
|
var stdin_default$p = {
|
|
26332
26420
|
"--date-picker-title-background": "var(--color-surface-container-high)",
|
|
@@ -26354,6 +26442,7 @@ var stdin_default$p = {
|
|
|
26354
26442
|
"--date-picker-title-date-font-size": "34px",
|
|
26355
26443
|
"--date-picker-title-date-font-weight": "500",
|
|
26356
26444
|
"--date-picker-title-date-range-font-size": "20px",
|
|
26445
|
+
"--date-picker-title-date-justify-content": "normal",
|
|
26357
26446
|
"--month-picker-padding": "0 12px",
|
|
26358
26447
|
"--month-picker-item-width": "33%",
|
|
26359
26448
|
"--month-picker-item-height": "56px",
|
|
@@ -28282,7 +28371,7 @@ withInstall(stdin_default$1);
|
|
|
28282
28371
|
withPropsDefaultsSetter(stdin_default$1, props);
|
|
28283
28372
|
const _WatermarkComponent = stdin_default$1;
|
|
28284
28373
|
var stdin_default = stdin_default$1;
|
|
28285
|
-
const version = "3.1.0
|
|
28374
|
+
const version = "3.1.0";
|
|
28286
28375
|
function install(app) {
|
|
28287
28376
|
stdin_default$5E.install && app.use(stdin_default$5E);
|
|
28288
28377
|
stdin_default$5C.install && app.use(stdin_default$5C);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varlet/ui",
|
|
3
|
-
"version": "3.1.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "A material like components library",
|
|
5
5
|
"main": "lib/varlet.cjs.js",
|
|
6
6
|
"module": "es/index.mjs",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"@popperjs/core": "^2.11.6",
|
|
49
49
|
"dayjs": "^1.10.4",
|
|
50
50
|
"decimal.js": "^10.2.1",
|
|
51
|
-
"@varlet/
|
|
52
|
-
"@varlet/
|
|
53
|
-
"@varlet/
|
|
51
|
+
"@varlet/shared": "3.1.0",
|
|
52
|
+
"@varlet/icons": "3.1.0",
|
|
53
|
+
"@varlet/use": "3.1.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@vue/runtime-core": "3.4.15",
|
|
@@ -66,9 +66,9 @@
|
|
|
66
66
|
"typescript": "^5.1.5",
|
|
67
67
|
"vue": "3.4.15",
|
|
68
68
|
"vue-router": "4.2.0",
|
|
69
|
-
"@varlet/
|
|
70
|
-
"@varlet/
|
|
71
|
-
"@varlet/
|
|
69
|
+
"@varlet/touch-emulator": "3.1.0",
|
|
70
|
+
"@varlet/ui": "3.1.0",
|
|
71
|
+
"@varlet/cli": "3.1.0"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
74
74
|
"dev": "varlet-cli dev",
|
package/types/picker.d.ts
CHANGED
|
@@ -28,9 +28,11 @@ export interface PickerProps {
|
|
|
28
28
|
cancelButtonText?: string
|
|
29
29
|
confirmButtonTextColor?: string
|
|
30
30
|
cancelButtonTextColor?: string
|
|
31
|
+
closeOnKeyEscape?: boolean
|
|
31
32
|
onChange?: ListenerProp<(values: (string | number)[], indexes: number[], options: PickerColumnOption[]) => void>
|
|
32
33
|
onConfirm?: ListenerProp<(values: (string | number)[], indexes: number[], options: PickerColumnOption[]) => void>
|
|
33
34
|
onCancel?: ListenerProp<(values: (string | number)[], indexes: number[], options: PickerColumnOption[]) => void>
|
|
35
|
+
onKeyEscape?: ListenerProp<() => void>
|
|
34
36
|
'onUpdate:modelValue'?: ListenerProp<(values: (string | number)[]) => void>
|
|
35
37
|
}
|
|
36
38
|
|
|
@@ -74,6 +76,7 @@ export interface PickerOptions {
|
|
|
74
76
|
cancelButtonTextColor?: string
|
|
75
77
|
safeArea?: boolean
|
|
76
78
|
closeOnClickOverlay?: boolean
|
|
79
|
+
closeOnKeyEscape?: boolean
|
|
77
80
|
onClickOverlay?: () => void
|
|
78
81
|
onOpen?: () => void
|
|
79
82
|
onOpened?: () => void
|
|
@@ -82,6 +85,7 @@ export interface PickerOptions {
|
|
|
82
85
|
onChange?: (values: (string | number)[], indexes: number[], options: PickerColumnOption[]) => void
|
|
83
86
|
onConfirm?: (values: (string | number)[], indexes: number[], options: PickerColumnOption[]) => void
|
|
84
87
|
onCancel?: (values: (string | number)[], indexes: number[], options: PickerColumnOption[]) => void
|
|
88
|
+
onKeyEscape?: () => void
|
|
85
89
|
}
|
|
86
90
|
|
|
87
91
|
export interface IPicker {
|
package/types/popup.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export interface PopupProps extends BasicAttributes {
|
|
|
13
13
|
overlayStyle?: Record<string, any>
|
|
14
14
|
lockScroll?: boolean
|
|
15
15
|
closeOnClickOverlay?: boolean
|
|
16
|
+
closeOnKeyEscape?: boolean
|
|
16
17
|
defaultStyle?: boolean
|
|
17
18
|
safeArea?: boolean
|
|
18
19
|
safeAreaTop?: boolean
|
|
@@ -22,6 +23,7 @@ export interface PopupProps extends BasicAttributes {
|
|
|
22
23
|
onClose?: ListenerProp<() => void>
|
|
23
24
|
onClosed?: ListenerProp<() => void>
|
|
24
25
|
onClickOverlay?: ListenerProp<() => void>
|
|
26
|
+
onKeyEscape?: ListenerProp<() => void>
|
|
25
27
|
'onUpdate:show'?: ListenerProp<(show: boolean) => void>
|
|
26
28
|
}
|
|
27
29
|
|
package/types/styleVars.d.ts
CHANGED
|
@@ -481,6 +481,8 @@ export interface StyleVars {
|
|
|
481
481
|
datePickerTitleDateFontWeight?: string
|
|
482
482
|
'--date-picker-title-date-range-font-size'?: string
|
|
483
483
|
datePickerTitleDateRangeFontSize?: string
|
|
484
|
+
'--date-picker-title-date-justify-content'?: string
|
|
485
|
+
datePickerTitleDateJustifyContent?: string
|
|
484
486
|
'--date-picker-body-padding'?: string
|
|
485
487
|
datePickerBodyPadding?: string
|
|
486
488
|
'--date-picker-body-background-color'?: string
|
|
@@ -1383,6 +1385,8 @@ export interface StyleVars {
|
|
|
1383
1385
|
timePickerTitleTimeBackground?: string
|
|
1384
1386
|
'--time-picker-title-time-active-background'?: string
|
|
1385
1387
|
timePickerTitleTimeActiveBackground?: string
|
|
1388
|
+
'--time-picker-title-time-container-justify-content'?: string
|
|
1389
|
+
timePickerTitleTimeContainerJustifyContent?: string
|
|
1386
1390
|
'--time-picker-title-ampm-button-active-background'?: string
|
|
1387
1391
|
timePickerTitleAmpmButtonActiveBackground?: string
|
|
1388
1392
|
'--time-picker-title-ampm-margin-left'?: string
|
package/types/tooltip.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export interface TooltipProps extends BasicAttributes {
|
|
|
30
30
|
teleport?: TeleportProps['to'] | false
|
|
31
31
|
sameWidth?: boolean
|
|
32
32
|
closeOnClickReference?: boolean
|
|
33
|
+
closeOnKeyEscape?: boolean
|
|
33
34
|
onOpen?: ListenerProp<() => void>
|
|
34
35
|
onOpened?: ListenerProp<() => void>
|
|
35
36
|
onClose?: ListenerProp<() => void>
|