yc-design-vue 1.1.2 → 1.1.4
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/Carousel/Carousel.vue.js +1 -1
- package/es/Carousel/Carousel.vue2.js +15 -14
- package/es/Carousel/hooks/useContext.js +4 -3
- package/es/Cascader/Cascader.vue.js +1 -1
- package/es/Cascader/Cascader.vue2.js +3 -0
- package/es/Image/ImagePreview.vue.js +1 -1
- package/es/Image/ImagePreview.vue2.js +10 -8
- package/es/InputNumber/InputOperaBtn.vue2.js +1 -1
- package/es/Scrollbar/Scrollbar.vue.js +1 -1
- package/es/Scrollbar/Scrollbar.vue2.js +9 -10
- package/es/Typography/TypographyBase.vue2.js +2 -2
- package/es/_shared/icons/IconCopy.vue.js +16 -1
- package/es/_shared/icons/IconCopy.vue2.js +1 -16
- package/es/_shared/icons/IconEdit.vue.js +16 -1
- package/es/_shared/icons/IconEdit.vue2.js +1 -16
- package/es/_shared/icons/IconMinus.vue.js +16 -1
- package/es/_shared/icons/IconMinus.vue2.js +1 -16
- package/es/_shared/utils/dom.d.ts +2 -0
- package/es/_shared/utils/dom.js +26 -4
- package/es/node_modules/@vueuse/core/index.js +3 -1
- package/es/node_modules/@vueuse/shared/index.js +76 -1
- package/es/style.css +1 -1
- package/lib/Carousel/Carousel.vue.js +1 -1
- package/lib/Carousel/Carousel.vue2.js +1 -1
- package/lib/Carousel/hooks/useContext.js +1 -1
- package/lib/Cascader/Cascader.vue.js +1 -1
- package/lib/Cascader/Cascader.vue2.js +1 -1
- package/lib/Image/ImagePreview.vue.js +1 -1
- package/lib/Image/ImagePreview.vue2.js +1 -1
- package/lib/InputNumber/InputOperaBtn.vue2.js +1 -1
- package/lib/Scrollbar/Scrollbar.vue.js +1 -1
- package/lib/Scrollbar/Scrollbar.vue2.js +1 -1
- package/lib/Typography/TypographyBase.vue2.js +1 -1
- package/lib/_shared/icons/IconCopy.vue.js +1 -1
- package/lib/_shared/icons/IconCopy.vue2.js +1 -1
- package/lib/_shared/icons/IconEdit.vue.js +1 -1
- package/lib/_shared/icons/IconEdit.vue2.js +1 -1
- package/lib/_shared/icons/IconMinus.vue.js +1 -1
- package/lib/_shared/icons/IconMinus.vue2.js +1 -1
- package/lib/_shared/utils/dom.d.ts +2 -0
- package/lib/_shared/utils/dom.js +1 -1
- package/lib/node_modules/@vueuse/core/index.js +1 -1
- package/lib/node_modules/@vueuse/shared/index.js +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
@@ -1,7 +1,7 @@
|
|
1
1
|
import _sfc_main from "./Carousel.vue2.js";
|
2
2
|
/* empty css */
|
3
3
|
import _export_sfc from "../_virtual/_plugin-vue_export-helper.js";
|
4
|
-
const _Carousel = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
4
|
+
const _Carousel = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-5285806c"]]);
|
5
5
|
export {
|
6
6
|
_Carousel as default
|
7
7
|
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineComponent, watch, onBeforeUnmount, createElementBlock, openBlock, normalizeClass, createElementVNode, createCommentVNode, unref, Fragment, renderList, createBlock, resolveDynamicComponent, createVNode } from "vue";
|
1
|
+
import { defineComponent, ref, watch, onBeforeUnmount, createElementBlock, openBlock, normalizeClass, createElementVNode, createCommentVNode, unref, Fragment, renderList, createBlock, resolveDynamicComponent, createVNode } from "vue";
|
2
2
|
import "../node_modules/tinycolor2/esm/tinycolor.js";
|
3
3
|
import "../_shared/utils/dom.js";
|
4
4
|
import { isObject } from "../_shared/utils/is.js";
|
@@ -8,6 +8,7 @@ import "../Empty/index.js";
|
|
8
8
|
import useContext from "./hooks/useContext.js";
|
9
9
|
import CarouselArrow from "./CarouselArrow.vue.js";
|
10
10
|
import CarouselIndicator from "./CarouselIndicator.vue.js";
|
11
|
+
import { useInterval } from "../node_modules/@vueuse/shared/index.js";
|
11
12
|
const _hoisted_1 = {
|
12
13
|
key: 0,
|
13
14
|
class: "yc-carousel-indicator-wrapper"
|
@@ -41,21 +42,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
41
42
|
const props = __props;
|
42
43
|
const emits = __emit;
|
43
44
|
const { slideTo, computedCurrent, autoPlay, carouselItems } = useContext().provide(props, emits);
|
44
|
-
let autoPlayTimer =
|
45
|
+
let autoPlayTimer = ref(0);
|
46
|
+
const stopAutoPlay = () => {
|
47
|
+
clearInterval(autoPlayTimer.value);
|
48
|
+
};
|
45
49
|
const setAutoPlay = () => {
|
46
50
|
var _a;
|
47
51
|
if (!autoPlay.value) return;
|
48
|
-
autoPlayTimer =
|
49
|
-
()
|
50
|
-
|
51
|
-
|
52
|
-
|
52
|
+
autoPlayTimer = useInterval(
|
53
|
+
((_a = autoPlay.value) == null ? void 0 : _a.interval) ?? 3e3,
|
54
|
+
{
|
55
|
+
callback: () => {
|
56
|
+
console.log("定时器触发了");
|
57
|
+
slideTo(computedCurrent.value + 1);
|
58
|
+
}
|
59
|
+
}
|
53
60
|
);
|
54
61
|
};
|
55
|
-
const stopAutoPlay = () => {
|
56
|
-
clearInterval(autoPlayTimer);
|
57
|
-
autoPlayTimer = null;
|
58
|
-
};
|
59
62
|
const handleChange = async (index) => {
|
60
63
|
stopAutoPlay();
|
61
64
|
await slideTo(index);
|
@@ -64,9 +67,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
64
67
|
watch(
|
65
68
|
() => autoPlay.value,
|
66
69
|
() => {
|
67
|
-
|
68
|
-
return stopAutoPlay();
|
69
|
-
}
|
70
|
+
stopAutoPlay();
|
70
71
|
setAutoPlay();
|
71
72
|
},
|
72
73
|
{
|
@@ -41,7 +41,7 @@ const useContext = () => {
|
|
41
41
|
);
|
42
42
|
const moveType = ref("positive");
|
43
43
|
const preIndex = ref(computedCurrent.value);
|
44
|
-
let
|
44
|
+
let flag = false;
|
45
45
|
const getValidIndex = (val) => {
|
46
46
|
if (val < 0) {
|
47
47
|
return length.value - 1;
|
@@ -49,15 +49,16 @@ const useContext = () => {
|
|
49
49
|
return val > length.value ? val % length.value : val;
|
50
50
|
};
|
51
51
|
const slideTo = async (targetIndex) => {
|
52
|
-
if (
|
52
|
+
if (flag || targetIndex == computedCurrent.value) {
|
53
53
|
return;
|
54
54
|
}
|
55
55
|
moveType.value = targetIndex > computedCurrent.value ? "positive" : "negative";
|
56
56
|
preIndex.value = computedCurrent.value;
|
57
57
|
computedCurrent.value = getValidIndex(targetIndex);
|
58
58
|
emits("change", computedCurrent.value, preIndex.value, true);
|
59
|
+
flag = true;
|
59
60
|
await sleep(moveSpeed.value);
|
60
|
-
|
61
|
+
flag = false;
|
61
62
|
};
|
62
63
|
provide(CAROUSEL_CONTEXT_KEY, {
|
63
64
|
length,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _sfc_main from "./Cascader.vue2.js";
|
2
2
|
/* empty css */
|
3
3
|
import _export_sfc from "../_virtual/_plugin-vue_export-helper.js";
|
4
|
-
const _Cascader = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
4
|
+
const _Cascader = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-546388ae"]]);
|
5
5
|
export {
|
6
6
|
_Cascader as default
|
7
7
|
};
|
@@ -154,6 +154,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
154
154
|
"popup-offset": 4,
|
155
155
|
"popup-container": _ctx.popupContainer,
|
156
156
|
disabled: unref(disabled),
|
157
|
+
"content-style": {
|
158
|
+
background: "transparent"
|
159
|
+
},
|
157
160
|
position: "bl",
|
158
161
|
trigger: "focus",
|
159
162
|
"animation-name": "slide-dynamic-origin",
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _sfc_main from "./ImagePreview.vue2.js";
|
2
2
|
/* empty css */
|
3
3
|
import _export_sfc from "../_virtual/_plugin-vue_export-helper.js";
|
4
|
-
const ImagePreview = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
4
|
+
const ImagePreview = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-252a7f6e"]]);
|
5
5
|
export {
|
6
6
|
ImagePreview as default
|
7
7
|
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineComponent, toRefs, ref, createBlock, openBlock, Teleport, unref, createElementBlock, createCommentVNode, normalizeStyle, normalizeClass, createVNode, Transition, withCtx, withDirectives, createElementVNode, vShow,
|
1
|
+
import { defineComponent, toRefs, ref, createBlock, openBlock, Teleport, unref, createElementBlock, createCommentVNode, normalizeStyle, normalizeClass, createVNode, Transition, withCtx, withDirectives, createElementVNode, vShow, withModifiers, renderSlot, createSlots } from "vue";
|
2
2
|
import "../node_modules/tinycolor2/esm/tinycolor.js";
|
3
3
|
import "../_shared/utils/dom.js";
|
4
4
|
import { isUndefined } from "../_shared/utils/is.js";
|
@@ -11,8 +11,7 @@ import { useEventListener, onKeyStroke } from "../node_modules/@vueuse/core/inde
|
|
11
11
|
import useModalClose from "../Modal/hooks/useModalClose.js";
|
12
12
|
import ImagePreviewToolbar from "./ImagePreviewToolbar.vue.js";
|
13
13
|
const _hoisted_1 = { class: "yc-image-preview-mask" };
|
14
|
-
const _hoisted_2 =
|
15
|
-
const _hoisted_3 = ["src"];
|
14
|
+
const _hoisted_2 = ["src"];
|
16
15
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
17
16
|
...{
|
18
17
|
name: "ImagePreview",
|
@@ -112,6 +111,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
112
111
|
if (wheelZoom.value) {
|
113
112
|
useEventListener("wheel", (e) => {
|
114
113
|
e.preventDefault();
|
114
|
+
e.stopPropagation();
|
115
115
|
const delta = e.deltaY < 0 ? 1 : -1;
|
116
116
|
scale.value *= Math.pow(zoomRate.value, delta);
|
117
117
|
});
|
@@ -157,13 +157,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
157
157
|
onAfterLeave: unref(handleAfterLeave)
|
158
158
|
}, {
|
159
159
|
default: withCtx(() => [
|
160
|
-
withDirectives(createElementVNode("div",
|
160
|
+
withDirectives(createElementVNode("div", {
|
161
|
+
class: "yc-image-preview-wrapper",
|
162
|
+
onClick: _cache[1] || (_cache[1] = withModifiers(($event) => unref(handleClose)("mask", $event, false), ["self"]))
|
163
|
+
}, [
|
161
164
|
createElementVNode("div", {
|
162
165
|
style: normalizeStyle({
|
163
166
|
transform: `scale(${unref(scale)}, ${unref(scale)})`
|
164
167
|
}),
|
165
|
-
class: "yc-image-preview-img-container"
|
166
|
-
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => unref(handleClose)("mask", $event, false), ["self"]))
|
168
|
+
class: "yc-image-preview-img-container"
|
167
169
|
}, [
|
168
170
|
createElementVNode("img", {
|
169
171
|
src: _ctx.src,
|
@@ -173,7 +175,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
173
175
|
class: "yc-image-preview-img",
|
174
176
|
ref_key: "imageRef",
|
175
177
|
ref: imageRef
|
176
|
-
}, null, 12,
|
178
|
+
}, null, 12, _hoisted_2)
|
177
179
|
], 4),
|
178
180
|
createVNode(ImagePreviewToolbar, {
|
179
181
|
actionsLayout: _ctx.actionsLayout,
|
@@ -191,7 +193,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
191
193
|
_ctx.closable ? (openBlock(), createElementBlock("div", {
|
192
194
|
key: 0,
|
193
195
|
class: "yc-image-preview-close-btn",
|
194
|
-
onClick: _cache[
|
196
|
+
onClick: _cache[0] || (_cache[0] = ($event) => unref(handleClose)("closeBtn", $event))
|
195
197
|
}, [
|
196
198
|
createVNode(unref(_sfc_main$1))
|
197
199
|
])) : createCommentVNode("", true)
|
@@ -5,7 +5,7 @@ import "../_shared/utils/dom.js";
|
|
5
5
|
import "../_shared/utils/time.js";
|
6
6
|
import "../Empty/index.js";
|
7
7
|
/* empty css */
|
8
|
-
import _sfc_main$2 from "../_shared/icons/IconMinus.
|
8
|
+
import _sfc_main$2 from "../_shared/icons/IconMinus.vue.js";
|
9
9
|
import _sfc_main$3 from "../_shared/icons/IconPlus.vue.js";
|
10
10
|
import Button from "../Button/index.js";
|
11
11
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _sfc_main from "./Scrollbar.vue2.js";
|
2
2
|
/* empty css */
|
3
3
|
import _export_sfc from "../_virtual/_plugin-vue_export-helper.js";
|
4
|
-
const _Scrollbar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
4
|
+
const _Scrollbar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-891ea4c3"]]);
|
5
5
|
export {
|
6
6
|
_Scrollbar as default
|
7
7
|
};
|
@@ -1,5 +1,10 @@
|
|
1
1
|
import { defineComponent, toRefs, ref, computed, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, createElementVNode, createBlock, createCommentVNode, renderSlot } from "vue";
|
2
2
|
import { useResizeObserver, useElementSize } from "../node_modules/@vueuse/core/index.js";
|
3
|
+
import "../node_modules/tinycolor2/esm/tinycolor.js";
|
4
|
+
import { isVerticallyScrollable, isHorizontallyScrollable } from "../_shared/utils/dom.js";
|
5
|
+
import "../_shared/utils/time.js";
|
6
|
+
import "../Empty/index.js";
|
7
|
+
/* empty css */
|
3
8
|
import ScrollbarTrack from "./ScrollbarTrack.vue.js";
|
4
9
|
import useContext from "./hooks/useContext.js";
|
5
10
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
@@ -99,18 +104,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
99
104
|
const curTop2 = ref(0);
|
100
105
|
const curLeft2 = ref(0);
|
101
106
|
const hasVerticalBar2 = computed(() => {
|
102
|
-
|
103
|
-
|
104
|
-
const overflow = style.overflow;
|
105
|
-
const allowScroll = ["auto", "scroll"];
|
106
|
-
return contentHeight.value > scrollHeight2.value && (allowScroll.includes(overflowY) || allowScroll.includes(overflow));
|
107
|
+
if (!scrollRef.value) return false;
|
108
|
+
return contentHeight.value > scrollHeight2.value && isVerticallyScrollable(scrollRef.value);
|
107
109
|
});
|
108
110
|
const hashorizontalBar2 = computed(() => {
|
109
|
-
|
110
|
-
|
111
|
-
const overflow = style.overflow;
|
112
|
-
const allowScroll = ["auto", "scroll"];
|
113
|
-
return contentWidth.value > scrollWidth2.value && (allowScroll.includes(overflowX) || allowScroll.includes(overflow));
|
111
|
+
if (!scrollRef.value) return false;
|
112
|
+
return contentWidth.value > scrollWidth2.value && isHorizontallyScrollable(scrollRef.value);
|
114
113
|
});
|
115
114
|
const thumbHeight = computed(() => {
|
116
115
|
if (!hasVerticalBar2.value) return 0;
|
@@ -5,8 +5,8 @@ import { getDomText, sleep } from "../_shared/utils/dom.js";
|
|
5
5
|
import "../_shared/utils/time.js";
|
6
6
|
import "../Empty/index.js";
|
7
7
|
/* empty css */
|
8
|
-
import _sfc_main$3 from "../_shared/icons/IconCopy.
|
9
|
-
import _sfc_main$1 from "../_shared/icons/IconEdit.
|
8
|
+
import _sfc_main$3 from "../_shared/icons/IconCopy.vue.js";
|
9
|
+
import _sfc_main$1 from "../_shared/icons/IconEdit.vue.js";
|
10
10
|
import _sfc_main$2 from "../_shared/icons/IconInfo.vue.js";
|
11
11
|
import useControlValue from "../_shared/utils/control.js";
|
12
12
|
import Input from "../Input/index.js";
|
@@ -1,4 +1,19 @@
|
|
1
|
-
import
|
1
|
+
import { defineComponent, createBlock, openBlock, normalizeProps, guardReactiveProps, withCtx, createElementVNode } from "vue";
|
2
|
+
import YcIcon from "../components/Icon.vue2.js";
|
3
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
4
|
+
__name: "IconCopy",
|
5
|
+
setup(__props) {
|
6
|
+
return (_ctx, _cache) => {
|
7
|
+
return openBlock(), createBlock(YcIcon, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
|
8
|
+
default: withCtx(() => _cache[0] || (_cache[0] = [
|
9
|
+
createElementVNode("path", { d: "M20 6h18a2 2 0 0 1 2 2v22M8 16v24c0 1.105.891 2 1.996 2h20.007A1.99 1.99 0 0 0 32 40.008V15.997A1.997 1.997 0 0 0 30 14H10a2 2 0 0 0-2 2Z" }, null, -1)
|
10
|
+
])),
|
11
|
+
_: 1,
|
12
|
+
__: [0]
|
13
|
+
}, 16);
|
14
|
+
};
|
15
|
+
}
|
16
|
+
});
|
2
17
|
export {
|
3
18
|
_sfc_main as default
|
4
19
|
};
|
@@ -1,19 +1,4 @@
|
|
1
|
-
import
|
2
|
-
import YcIcon from "../components/Icon.vue2.js";
|
3
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
4
|
-
__name: "IconCopy",
|
5
|
-
setup(__props) {
|
6
|
-
return (_ctx, _cache) => {
|
7
|
-
return openBlock(), createBlock(YcIcon, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
|
8
|
-
default: withCtx(() => _cache[0] || (_cache[0] = [
|
9
|
-
createElementVNode("path", { d: "M20 6h18a2 2 0 0 1 2 2v22M8 16v24c0 1.105.891 2 1.996 2h20.007A1.99 1.99 0 0 0 32 40.008V15.997A1.997 1.997 0 0 0 30 14H10a2 2 0 0 0-2 2Z" }, null, -1)
|
10
|
-
])),
|
11
|
-
_: 1,
|
12
|
-
__: [0]
|
13
|
-
}, 16);
|
14
|
-
};
|
15
|
-
}
|
16
|
-
});
|
1
|
+
import _sfc_main from "./IconCopy.vue.js";
|
17
2
|
export {
|
18
3
|
_sfc_main as default
|
19
4
|
};
|
@@ -1,4 +1,19 @@
|
|
1
|
-
import
|
1
|
+
import { defineComponent, createBlock, openBlock, normalizeProps, guardReactiveProps, withCtx, createElementVNode } from "vue";
|
2
|
+
import YcIcon from "../components/Icon.vue2.js";
|
3
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
4
|
+
__name: "IconEdit",
|
5
|
+
setup(__props) {
|
6
|
+
return (_ctx, _cache) => {
|
7
|
+
return openBlock(), createBlock(YcIcon, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
|
8
|
+
default: withCtx(() => _cache[0] || (_cache[0] = [
|
9
|
+
createElementVNode("path", { d: "m30.48 19.038 5.733-5.734a1 1 0 0 0 0-1.414l-5.586-5.586a1 1 0 0 0-1.414 0l-5.734 5.734m7 7L15.763 33.754a1 1 0 0 1-.59.286l-6.048.708a1 1 0 0 1-1.113-1.069l.477-6.31a1 1 0 0 1 .29-.631l14.7-14.7m7 7-7-7M6 42h36" }, null, -1)
|
10
|
+
])),
|
11
|
+
_: 1,
|
12
|
+
__: [0]
|
13
|
+
}, 16);
|
14
|
+
};
|
15
|
+
}
|
16
|
+
});
|
2
17
|
export {
|
3
18
|
_sfc_main as default
|
4
19
|
};
|
@@ -1,19 +1,4 @@
|
|
1
|
-
import
|
2
|
-
import YcIcon from "../components/Icon.vue2.js";
|
3
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
4
|
-
__name: "IconEdit",
|
5
|
-
setup(__props) {
|
6
|
-
return (_ctx, _cache) => {
|
7
|
-
return openBlock(), createBlock(YcIcon, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
|
8
|
-
default: withCtx(() => _cache[0] || (_cache[0] = [
|
9
|
-
createElementVNode("path", { d: "m30.48 19.038 5.733-5.734a1 1 0 0 0 0-1.414l-5.586-5.586a1 1 0 0 0-1.414 0l-5.734 5.734m7 7L15.763 33.754a1 1 0 0 1-.59.286l-6.048.708a1 1 0 0 1-1.113-1.069l.477-6.31a1 1 0 0 1 .29-.631l14.7-14.7m7 7-7-7M6 42h36" }, null, -1)
|
10
|
-
])),
|
11
|
-
_: 1,
|
12
|
-
__: [0]
|
13
|
-
}, 16);
|
14
|
-
};
|
15
|
-
}
|
16
|
-
});
|
1
|
+
import _sfc_main from "./IconEdit.vue.js";
|
17
2
|
export {
|
18
3
|
_sfc_main as default
|
19
4
|
};
|
@@ -1,4 +1,19 @@
|
|
1
|
-
import
|
1
|
+
import { defineComponent, createBlock, openBlock, normalizeProps, guardReactiveProps, withCtx, createElementVNode } from "vue";
|
2
|
+
import YcIcon from "../components/Icon.vue2.js";
|
3
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
4
|
+
__name: "IconMinus",
|
5
|
+
setup(__props) {
|
6
|
+
return (_ctx, _cache) => {
|
7
|
+
return openBlock(), createBlock(YcIcon, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
|
8
|
+
default: withCtx(() => _cache[0] || (_cache[0] = [
|
9
|
+
createElementVNode("path", { d: "M5 24h38" }, null, -1)
|
10
|
+
])),
|
11
|
+
_: 1,
|
12
|
+
__: [0]
|
13
|
+
}, 16);
|
14
|
+
};
|
15
|
+
}
|
16
|
+
});
|
2
17
|
export {
|
3
18
|
_sfc_main as default
|
4
19
|
};
|
@@ -1,19 +1,4 @@
|
|
1
|
-
import
|
2
|
-
import YcIcon from "../components/Icon.vue2.js";
|
3
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
4
|
-
__name: "IconMinus",
|
5
|
-
setup(__props) {
|
6
|
-
return (_ctx, _cache) => {
|
7
|
-
return openBlock(), createBlock(YcIcon, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
|
8
|
-
default: withCtx(() => _cache[0] || (_cache[0] = [
|
9
|
-
createElementVNode("path", { d: "M5 24h38" }, null, -1)
|
10
|
-
])),
|
11
|
-
_: 1,
|
12
|
-
__: [0]
|
13
|
-
}, 16);
|
14
|
-
};
|
15
|
-
}
|
16
|
-
});
|
1
|
+
import _sfc_main from "./IconMinus.vue.js";
|
17
2
|
export {
|
18
3
|
_sfc_main as default
|
19
4
|
};
|
@@ -15,3 +15,5 @@ export declare const throttleByRaf: (cb: (...args: any[]) => void) => {
|
|
15
15
|
export declare const debounce: (func: (...args: any) => void, delay: number, immediate?: boolean) => (this: any, ...args: any) => void;
|
16
16
|
export declare const throttle: (fn: (...args: any) => void, delay: number) => (this: any, ...args: any) => void;
|
17
17
|
export declare const valueToPx: (value: string | number | undefined) => string;
|
18
|
+
export declare function isHorizontallyScrollable(element: HTMLElement): boolean;
|
19
|
+
export declare function isVerticallyScrollable(element: HTMLElement): boolean;
|
package/es/_shared/utils/dom.js
CHANGED
@@ -70,7 +70,7 @@ const findFirstScrollableParent = (element) => {
|
|
70
70
|
}
|
71
71
|
let currentElement = element.parentElement;
|
72
72
|
while (currentElement && currentElement !== document.body) {
|
73
|
-
const style =
|
73
|
+
const style = getComputedStyle(currentElement);
|
74
74
|
const overflow = style.overflowY || style.overflow;
|
75
75
|
const isScrollable = ["auto", "scroll"].includes(overflow);
|
76
76
|
const canScroll = currentElement.scrollHeight > currentElement.clientHeight;
|
@@ -91,15 +91,15 @@ const throttleByRaf = (cb) => {
|
|
91
91
|
let timer = 0;
|
92
92
|
const throttle2 = (...args) => {
|
93
93
|
if (timer) {
|
94
|
-
|
94
|
+
cancelAnimationFrame(timer);
|
95
95
|
}
|
96
|
-
timer =
|
96
|
+
timer = requestAnimationFrame(() => {
|
97
97
|
cb(...args);
|
98
98
|
timer = 0;
|
99
99
|
});
|
100
100
|
};
|
101
101
|
throttle2.cancel = () => {
|
102
|
-
|
102
|
+
cancelAnimationFrame(timer);
|
103
103
|
timer = 0;
|
104
104
|
};
|
105
105
|
return throttle2;
|
@@ -151,13 +151,35 @@ const valueToPx = (value) => {
|
|
151
151
|
}
|
152
152
|
return value;
|
153
153
|
};
|
154
|
+
function isHorizontallyScrollable(element) {
|
155
|
+
const style = getComputedStyle(element);
|
156
|
+
const isScrollableOverflow = style.overflowX === "scroll" || style.overflowX === "auto";
|
157
|
+
const isVisible = style.display !== "none" && style.visibility !== "hidden";
|
158
|
+
if (!isVisible) {
|
159
|
+
return false;
|
160
|
+
}
|
161
|
+
const isContentLarger = element.scrollWidth > element.clientWidth;
|
162
|
+
return isScrollableOverflow && isContentLarger;
|
163
|
+
}
|
164
|
+
function isVerticallyScrollable(element) {
|
165
|
+
const style = getComputedStyle(element);
|
166
|
+
const isScrollableOverflow = style.overflowY === "scroll" || style.overflowY === "auto";
|
167
|
+
const isVisible = style.display !== "none" && style.visibility !== "hidden";
|
168
|
+
if (!isVisible) {
|
169
|
+
return false;
|
170
|
+
}
|
171
|
+
const isContentLarger = element.scrollHeight > element.clientHeight;
|
172
|
+
return isScrollableOverflow && isContentLarger;
|
173
|
+
}
|
154
174
|
export {
|
155
175
|
debounce,
|
156
176
|
findFirstScrollableParent,
|
157
177
|
getBreakpointValue,
|
158
178
|
getDomText,
|
159
179
|
getElement,
|
180
|
+
isHorizontallyScrollable,
|
160
181
|
isServerRendering,
|
182
|
+
isVerticallyScrollable,
|
161
183
|
mediaQueryHandler,
|
162
184
|
querySelector,
|
163
185
|
sleep,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { tryOnScopeDispose, toArray, watchImmediate, isClient, isObject, makeDestructurable, camelize, tryOnMounted, toRefs, noop, isIOS, notNullish, useThrottleFn, useDebounceFn, pxValue, injectLocal, useTimeoutFn, createSingletonPromise } from "../shared/index.js";
|
2
|
-
import { createFilterWrapper, debounceFilter, getLifeCycleTarget, throttleFilter } from "../shared/index.js";
|
2
|
+
import { createFilterWrapper, debounceFilter, getLifeCycleTarget, throttleFilter, useInterval, useIntervalFn } from "../shared/index.js";
|
3
3
|
import { computed, toValue, watch, shallowRef, getCurrentInstance, onMounted, unref, defineComponent, ref, reactive, watchEffect, hasInjectionContext, toRaw } from "vue";
|
4
4
|
function createReusableTemplate(options = {}) {
|
5
5
|
const {
|
@@ -1080,6 +1080,8 @@ export {
|
|
1080
1080
|
useElementBounding,
|
1081
1081
|
useElementSize,
|
1082
1082
|
useEventListener,
|
1083
|
+
useInterval,
|
1084
|
+
useIntervalFn,
|
1083
1085
|
useMediaQuery,
|
1084
1086
|
useMounted,
|
1085
1087
|
useMutationObserver,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { getCurrentScope, onScopeDispose, watch, onMounted, nextTick, isRef, toRefs as toRefs$1, customRef, toValue, getCurrentInstance, hasInjectionContext, inject,
|
1
|
+
import { getCurrentScope, onScopeDispose, watch, onMounted, nextTick, isRef, toRefs as toRefs$1, customRef, toValue, getCurrentInstance, shallowRef, hasInjectionContext, inject, readonly } from "vue";
|
2
2
|
function tryOnScopeDispose(fn) {
|
3
3
|
if (getCurrentScope()) {
|
4
4
|
onScopeDispose(fn);
|
@@ -240,6 +240,79 @@ function tryOnMounted(fn, sync = true, target) {
|
|
240
240
|
else
|
241
241
|
nextTick(fn);
|
242
242
|
}
|
243
|
+
function useIntervalFn(cb, interval = 1e3, options = {}) {
|
244
|
+
const {
|
245
|
+
immediate = true,
|
246
|
+
immediateCallback = false
|
247
|
+
} = options;
|
248
|
+
let timer = null;
|
249
|
+
const isActive = shallowRef(false);
|
250
|
+
function clean() {
|
251
|
+
if (timer) {
|
252
|
+
clearInterval(timer);
|
253
|
+
timer = null;
|
254
|
+
}
|
255
|
+
}
|
256
|
+
function pause() {
|
257
|
+
isActive.value = false;
|
258
|
+
clean();
|
259
|
+
}
|
260
|
+
function resume() {
|
261
|
+
const intervalValue = toValue(interval);
|
262
|
+
if (intervalValue <= 0)
|
263
|
+
return;
|
264
|
+
isActive.value = true;
|
265
|
+
if (immediateCallback)
|
266
|
+
cb();
|
267
|
+
clean();
|
268
|
+
if (isActive.value)
|
269
|
+
timer = setInterval(cb, intervalValue);
|
270
|
+
}
|
271
|
+
if (immediate && isClient)
|
272
|
+
resume();
|
273
|
+
if (isRef(interval) || typeof interval === "function") {
|
274
|
+
const stopWatch = watch(interval, () => {
|
275
|
+
if (isActive.value && isClient)
|
276
|
+
resume();
|
277
|
+
});
|
278
|
+
tryOnScopeDispose(stopWatch);
|
279
|
+
}
|
280
|
+
tryOnScopeDispose(pause);
|
281
|
+
return {
|
282
|
+
isActive,
|
283
|
+
pause,
|
284
|
+
resume
|
285
|
+
};
|
286
|
+
}
|
287
|
+
function useInterval(interval = 1e3, options = {}) {
|
288
|
+
const {
|
289
|
+
controls: exposeControls = false,
|
290
|
+
immediate = true,
|
291
|
+
callback
|
292
|
+
} = options;
|
293
|
+
const counter = shallowRef(0);
|
294
|
+
const update = () => counter.value += 1;
|
295
|
+
const reset = () => {
|
296
|
+
counter.value = 0;
|
297
|
+
};
|
298
|
+
const controls = useIntervalFn(
|
299
|
+
callback ? () => {
|
300
|
+
update();
|
301
|
+
callback(counter.value);
|
302
|
+
} : update,
|
303
|
+
interval,
|
304
|
+
{ immediate }
|
305
|
+
);
|
306
|
+
if (exposeControls) {
|
307
|
+
return {
|
308
|
+
counter,
|
309
|
+
reset,
|
310
|
+
...controls
|
311
|
+
};
|
312
|
+
} else {
|
313
|
+
return counter;
|
314
|
+
}
|
315
|
+
}
|
243
316
|
function useTimeoutFn(cb, interval, options = {}) {
|
244
317
|
const {
|
245
318
|
immediate = true,
|
@@ -310,6 +383,8 @@ export {
|
|
310
383
|
tryOnMounted,
|
311
384
|
tryOnScopeDispose,
|
312
385
|
useDebounceFn,
|
386
|
+
useInterval,
|
387
|
+
useIntervalFn,
|
313
388
|
useThrottleFn,
|
314
389
|
useTimeoutFn,
|
315
390
|
watchImmediate
|