@varlet/ui 2.17.0 → 2.18.0-alpha.1697472019506
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/action-sheet/actionSheet.css +1 -1
- package/es/dialog/dialog.css +1 -1
- package/es/drag/Drag.mjs +2 -2
- package/es/form/Form.mjs +3 -3
- package/es/image-preview/ImagePreview.mjs +2 -2
- package/es/index-bar/indexBar.css +1 -1
- package/es/index.bundle.mjs +13 -1
- package/es/index.mjs +11 -1
- package/es/input/Input.mjs +2 -2
- package/es/menu/style/index.mjs +1 -1
- package/es/menu-option/MenuOption.mjs +122 -0
- package/es/menu-option/MenuOptionSfc.css +0 -0
- package/es/menu-option/index.mjs +11 -0
- package/es/menu-option/menuOption.css +1 -0
- package/es/menu-option/props.mjs +8 -0
- package/es/menu-option/provide.mjs +19 -0
- package/es/menu-option/style/index.mjs +5 -0
- package/es/menu-select/MenuSelect.mjs +110 -0
- package/es/menu-select/MenuSelectSfc.css +0 -0
- package/es/menu-select/index.mjs +9 -0
- package/es/menu-select/menuSelect.css +1 -0
- package/es/menu-select/props.mjs +58 -0
- package/es/menu-select/provide.mjs +16 -0
- package/es/menu-select/style/index.mjs +5 -0
- package/es/option/Option.mjs +28 -28
- package/es/option/option.css +1 -1
- package/es/option/props.mjs +2 -1
- package/es/popup/popup.css +1 -1
- package/es/pull-refresh/PullRefresh.mjs +2 -2
- package/es/ripple/index.mjs +2 -0
- package/es/select/Select.mjs +14 -47
- package/es/select/useSelectController.mjs +67 -0
- package/es/slider/Slider.mjs +2 -2
- package/es/style.css +1 -1
- package/es/style.mjs +2 -0
- package/es/swipe/Swipe.mjs +13 -13
- package/es/themes/dark/index.mjs +3 -2
- package/es/themes/dark/menuOption.mjs +6 -0
- package/es/themes/dark/option.mjs +1 -1
- package/es/time-picker/TimePicker.mjs +2 -2
- package/es/uploader/Uploader.mjs +8 -4
- package/es/uploader/props.mjs +2 -0
- package/es/utils/shared.mjs +4 -4
- package/es/varlet.esm.js +5429 -5139
- package/highlight/web-types.en-US.json +359 -90
- package/highlight/web-types.zh-CN.json +271 -2
- package/lib/style.css +1 -1
- package/lib/varlet.cjs.js +2101 -1744
- package/package.json +7 -7
- package/types/index.d.ts +4 -0
- package/types/menuOption.d.ts +20 -0
- package/types/menuSelect.d.ts +70 -0
- package/types/option.d.ts +1 -0
- package/types/uploader.d.ts +2 -0
- package/umd/varlet.js +6 -6
package/es/style.mjs
CHANGED
|
@@ -45,6 +45,8 @@ import './loading/style/index.mjs'
|
|
|
45
45
|
import './loading-bar/style/index.mjs'
|
|
46
46
|
import './locale/style/index.mjs'
|
|
47
47
|
import './menu/style/index.mjs'
|
|
48
|
+
import './menu-option/style/index.mjs'
|
|
49
|
+
import './menu-select/style/index.mjs'
|
|
48
50
|
import './option/style/index.mjs'
|
|
49
51
|
import './overlay/style/index.mjs'
|
|
50
52
|
import './pagination/style/index.mjs'
|
package/es/swipe/Swipe.mjs
CHANGED
|
@@ -24,7 +24,7 @@ import Hover from "../hover/index.mjs";
|
|
|
24
24
|
import { defineComponent, ref, computed, watch, onActivated } from "vue";
|
|
25
25
|
import { useSwipeItems } from "./provide.mjs";
|
|
26
26
|
import { props } from "./props.mjs";
|
|
27
|
-
import { clamp, isNumber, toNumber, doubleRaf } from "@varlet/shared";
|
|
27
|
+
import { clamp, isNumber, toNumber, doubleRaf, preventDefault } from "@varlet/shared";
|
|
28
28
|
import { call, createNamespace } from "../utils/components.mjs";
|
|
29
29
|
import { onSmartUnmounted, onWindowResize, useTouch } from "@varlet/use";
|
|
30
30
|
import { usePopup } from "../popup/provide.mjs";
|
|
@@ -372,7 +372,7 @@ const __sfc__ = defineComponent({
|
|
|
372
372
|
if (!isExpectDirection.value) {
|
|
373
373
|
return;
|
|
374
374
|
}
|
|
375
|
-
|
|
375
|
+
preventDefault(event);
|
|
376
376
|
setTrackTranslate(trackTranslate.value + (vertical2 ? moveY.value : moveX.value));
|
|
377
377
|
}
|
|
378
378
|
function handleTouchend() {
|
|
@@ -397,6 +397,17 @@ const __sfc__ = defineComponent({
|
|
|
397
397
|
call(onChange, index.value);
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
|
+
function handleHovering(value) {
|
|
401
|
+
if (props2.navigation === "hover") {
|
|
402
|
+
hovering.value = value;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
function getNavigationAnimation(type) {
|
|
406
|
+
if (props2.navigation !== "hover") {
|
|
407
|
+
return "";
|
|
408
|
+
}
|
|
409
|
+
return n(`--navigation${props2.vertical ? "-vertical" : ""}-${type}-animation`);
|
|
410
|
+
}
|
|
400
411
|
function resize() {
|
|
401
412
|
if (!swipeEl.value) {
|
|
402
413
|
return;
|
|
@@ -471,17 +482,6 @@ const __sfc__ = defineComponent({
|
|
|
471
482
|
task({ event: index2 === count - 1 ? options == null ? void 0 : options.event : false });
|
|
472
483
|
});
|
|
473
484
|
}
|
|
474
|
-
const handleHovering = (value) => {
|
|
475
|
-
if (props2.navigation === "hover") {
|
|
476
|
-
hovering.value = value;
|
|
477
|
-
}
|
|
478
|
-
};
|
|
479
|
-
function getNavigationAnimation(type) {
|
|
480
|
-
if (props2.navigation !== "hover") {
|
|
481
|
-
return "";
|
|
482
|
-
}
|
|
483
|
-
return props2.vertical ? n(`--navigation-vertical-${type}-animation`) : n(`--navigation-${type}-animation`);
|
|
484
|
-
}
|
|
485
485
|
return {
|
|
486
486
|
length,
|
|
487
487
|
index,
|
package/es/themes/dark/index.mjs
CHANGED
|
@@ -53,7 +53,8 @@ import progress from "./progress.mjs";
|
|
|
53
53
|
import option from "./option.mjs";
|
|
54
54
|
import countdown from "./countdown.mjs";
|
|
55
55
|
import watermark from "./watermark.mjs";
|
|
56
|
-
|
|
56
|
+
import menuOption from "./menuOption.mjs";
|
|
57
|
+
var stdin_default = __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
57
58
|
// common
|
|
58
59
|
"--color-body": "#1e1e1e",
|
|
59
60
|
"--color-text": "#fff",
|
|
@@ -64,7 +65,7 @@ var stdin_default = __spreadValues(__spreadValues(__spreadValues(__spreadValues(
|
|
|
64
65
|
"--color-danger": "#ef5350",
|
|
65
66
|
"--color-disabled": "#404040",
|
|
66
67
|
"--color-text-disabled": "#757575"
|
|
67
|
-
}, button), cell), card), timePicker), datePicker), skeleton), tabs), tab), popup), dialog), actionSheet), chip), badge), uploader), collapse), pullRefresh), switchThemes), steps), pagination), table), fieldDecorator), select), radio), checkbox), divider), picker), appBar), bottomNavigation), bottomNavigationItem), menu), result), breadcrumb), paper), avatar), link), progress), option), countdown), watermark);
|
|
68
|
+
}, button), cell), card), timePicker), datePicker), skeleton), tabs), tab), popup), dialog), actionSheet), chip), badge), uploader), collapse), pullRefresh), switchThemes), steps), pagination), table), fieldDecorator), select), radio), checkbox), divider), picker), appBar), bottomNavigation), bottomNavigationItem), menu), result), breadcrumb), paper), avatar), link), progress), option), countdown), watermark), menuOption);
|
|
68
69
|
export {
|
|
69
70
|
stdin_default as default
|
|
70
71
|
};
|
|
@@ -2,7 +2,7 @@ import dayjs from "dayjs/esm";
|
|
|
2
2
|
import Clock from "./clock.mjs";
|
|
3
3
|
import { computed, defineComponent, reactive, ref, watch } from "vue";
|
|
4
4
|
import { props, hoursAmpm, hours24 } from "./props.mjs";
|
|
5
|
-
import { toNumber, getRect } from "@varlet/shared";
|
|
5
|
+
import { toNumber, getRect, preventDefault } from "@varlet/shared";
|
|
6
6
|
import { createNamespace, call, formatElevation } from "../utils/components.mjs";
|
|
7
7
|
import { padStart } from "../utils/shared.mjs";
|
|
8
8
|
import { getNumberTime, getIsDisableMinute, getIsDisableSecond } from "./utils.mjs";
|
|
@@ -358,7 +358,7 @@ const __sfc__ = defineComponent({
|
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
360
|
function moveHand(event) {
|
|
361
|
-
|
|
361
|
+
preventDefault(event);
|
|
362
362
|
if (props2.readonly)
|
|
363
363
|
return;
|
|
364
364
|
setCenterAndRange();
|
package/es/uploader/Uploader.mjs
CHANGED
|
@@ -27,7 +27,7 @@ import Ripple from "../ripple/index.mjs";
|
|
|
27
27
|
import Hover from "../hover/index.mjs";
|
|
28
28
|
import { defineComponent, nextTick, reactive, computed, watch, ref } from "vue";
|
|
29
29
|
import { props } from "./props.mjs";
|
|
30
|
-
import { isNumber, toNumber,
|
|
30
|
+
import { isNumber, toNumber, normalizeToArray, toDataURL } from "@varlet/shared";
|
|
31
31
|
import { isHTMLSupportImage, isHTMLSupportVideo } from "../utils/shared.mjs";
|
|
32
32
|
import { call, useValidation, createNamespace, formatElevation } from "../utils/components.mjs";
|
|
33
33
|
import { useForm } from "../form/provide.mjs";
|
|
@@ -276,16 +276,20 @@ const __sfc__ = defineComponent({
|
|
|
276
276
|
{ deep: true }
|
|
277
277
|
);
|
|
278
278
|
function preview(varFile) {
|
|
279
|
-
const { disabled, previewed } = props2;
|
|
279
|
+
const { disabled, previewed, preventDefaultPreview, onPreview } = props2;
|
|
280
280
|
if ((form == null ? void 0 : form.disabled.value) || disabled || !previewed) {
|
|
281
281
|
return;
|
|
282
282
|
}
|
|
283
|
+
call(onPreview, reactive(varFile));
|
|
284
|
+
if (preventDefaultPreview) {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
283
287
|
const { url } = varFile;
|
|
284
|
-
if (
|
|
288
|
+
if (isHTMLSupportImage(url)) {
|
|
285
289
|
ImagePreview(url);
|
|
286
290
|
return;
|
|
287
291
|
}
|
|
288
|
-
if (
|
|
292
|
+
if (isHTMLSupportVideo(url)) {
|
|
289
293
|
currentPreview.value = varFile;
|
|
290
294
|
showPreview.value = true;
|
|
291
295
|
}
|
package/es/uploader/props.mjs
CHANGED
|
@@ -43,12 +43,14 @@ const props = {
|
|
|
43
43
|
},
|
|
44
44
|
rules: Array,
|
|
45
45
|
hideList: Boolean,
|
|
46
|
+
preventDefaultPreview: Boolean,
|
|
46
47
|
onBeforeFilter: defineListenerProp(),
|
|
47
48
|
onBeforeRead: defineListenerProp(),
|
|
48
49
|
onAfterRead: defineListenerProp(),
|
|
49
50
|
onBeforeRemove: defineListenerProp(),
|
|
50
51
|
onRemove: defineListenerProp(),
|
|
51
52
|
onOversize: defineListenerProp(),
|
|
53
|
+
onPreview: defineListenerProp(),
|
|
52
54
|
"onUpdate:modelValue": defineListenerProp()
|
|
53
55
|
};
|
|
54
56
|
export {
|
package/es/utils/shared.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { removeItem } from "@varlet/shared";
|
|
1
|
+
import { isString, removeItem } from "@varlet/shared";
|
|
2
2
|
const isHTMLSupportImage = (val) => {
|
|
3
|
-
if (val
|
|
3
|
+
if (!isString(val)) {
|
|
4
4
|
return false;
|
|
5
5
|
}
|
|
6
|
-
return val.startsWith("data:image") || /\.(png|jpg|gif|jpeg|svg|webp)
|
|
6
|
+
return val.startsWith("data:image") || /\.(png|jpg|gif|jpeg|svg|webp|ico)$/i.test(val);
|
|
7
7
|
};
|
|
8
8
|
const isHTMLSupportVideo = (val) => {
|
|
9
|
-
if (val
|
|
9
|
+
if (!isString(val)) {
|
|
10
10
|
return false;
|
|
11
11
|
}
|
|
12
12
|
return val.startsWith("data:video") || /\.(mp4|webm|ogg)$/.test(val);
|