snail.vue 2.0.19 → 2.0.20
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/dist/snail.vue.d.ts +87 -81
- package/dist/snail.vue.js +167 -172
- package/dist/snail.vue.umd.js +166 -171
- package/dist/styles/snail.vue.vue.css +22 -22
- package/package.json +2 -2
package/dist/snail.vue.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
//@ sourceURL=/snail.vue.js
|
|
2
2
|
import { defineComponent, createElementBlock, openBlock, normalizeClass, renderSlot, createTextVNode, shallowRef, computed, mergeProps, unref, createElementVNode, toDisplayString, Fragment, renderList, mergeModels, useModel, normalizeStyle, createCommentVNode, createBlock, nextTick, useTemplateRef, createVNode, watch, withDirectives, isRef, vModelText, withCtx, createApp, resolveDynamicComponent, TransitionGroup, Transition, normalizeProps, guardReactiveProps, ref, onErrorCaptured, createSlots, onMounted, withModifiers, getCurrentInstance, resolveComponent, vShow, onBeforeUnmount, onActivated, getCurrentScope, onScopeDispose } from 'vue';
|
|
3
3
|
import { throwError, isObject, correctNumber, correctString, useKey, isArray, mountScope, useScopes, throwIfFalse, isPromise, wait, isNumberNotNaN, isStringNotEmpty, hasAny, mustFunction, useScope, removeFromArray, mustObject, isArrayNotEmpty, hasOwnProperty, isString, script, delay, useTimer, defer, useAsyncScope, useHook, newId, throwIfTrue, isFunction, isNullish, getTimeNumber, getDateValue, parseDate, formatDateValue, getDateByValue, parseTimeValue, getTimeValue, padStart, formatTimeValue, parseDateValue, correctDateFormat, isValidTime, getFromArray, onMountScope } from 'snail.core';
|
|
4
|
-
import { css, link, useObserver, useAnimation } from 'snail.view';
|
|
4
|
+
import { css, link, useObserver, useScroll, useAnimation } from 'snail.view';
|
|
5
5
|
|
|
6
|
-
const _hoisted_1$
|
|
6
|
+
const _hoisted_1$m = ["title"];
|
|
7
7
|
var _sfc_main$D = defineComponent({
|
|
8
8
|
...{
|
|
9
9
|
name: "Button",
|
|
@@ -20,7 +20,7 @@ var _sfc_main$D = defineComponent({
|
|
|
20
20
|
return openBlock(), createElementBlock("div", {
|
|
21
21
|
class: normalizeClass(["snail-button", [__props.size, __props.type]]),
|
|
22
22
|
title: __props.title
|
|
23
|
-
}, [renderSlot(_ctx.$slots, "default", {}, () => [_cache[0] || (_cache[0] = createTextVNode("按钮", -1))])], 10, _hoisted_1$
|
|
23
|
+
}, [renderSlot(_ctx.$slots, "default", {}, () => [_cache[0] || (_cache[0] = createTextVNode("按钮", -1))])], 10, _hoisted_1$m);
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
});
|
|
@@ -63,7 +63,7 @@ function getBuiltinIcon(iconType) {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
const _hoisted_1$
|
|
66
|
+
const _hoisted_1$l = ["viewBox"];
|
|
67
67
|
const _hoisted_2$d = ["textContent"];
|
|
68
68
|
const _hoisted_3$a = ["d"];
|
|
69
69
|
var _sfc_main$C = defineComponent({
|
|
@@ -129,12 +129,12 @@ var _sfc_main$C = defineComponent({
|
|
|
129
129
|
return openBlock(), createElementBlock("path", {
|
|
130
130
|
d
|
|
131
131
|
}, null, 8, _hoisted_3$a);
|
|
132
|
-
}), 256))], 16, _hoisted_1$
|
|
132
|
+
}), 256))], 16, _hoisted_1$l);
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
135
|
});
|
|
136
136
|
|
|
137
|
-
const _hoisted_1$
|
|
137
|
+
const _hoisted_1$k = ["title", "onClick"];
|
|
138
138
|
const _hoisted_2$c = ["type", "checked"];
|
|
139
139
|
const _hoisted_3$9 = ["textContent"];
|
|
140
140
|
const _hoisted_4$7 = ["textContent"];
|
|
@@ -230,12 +230,16 @@ var _sfc_main$B = defineComponent({
|
|
|
230
230
|
key: 3,
|
|
231
231
|
class: "item-des",
|
|
232
232
|
textContent: toDisplayString(node.item.description)
|
|
233
|
-
}, null, 8, _hoisted_4$7)) : createCommentVNode("", true)], 14, _hoisted_1$
|
|
233
|
+
}, null, 8, _hoisted_4$7)) : createCommentVNode("", true)], 14, _hoisted_1$k);
|
|
234
234
|
}), 128))], 2);
|
|
235
235
|
};
|
|
236
236
|
}
|
|
237
237
|
});
|
|
238
238
|
|
|
239
|
+
var addLink = href => setTimeout(link.register, 0, href);
|
|
240
|
+
|
|
241
|
+
addLink("/styles/snail.vue.vue.css");
|
|
242
|
+
|
|
239
243
|
var _sfc_main$A = defineComponent({
|
|
240
244
|
...{
|
|
241
245
|
name: "Footer",
|
|
@@ -284,11 +288,7 @@ var _sfc_main$A = defineComponent({
|
|
|
284
288
|
}
|
|
285
289
|
});
|
|
286
290
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
addLink("/styles/snail.vue.vue.css");
|
|
290
|
-
|
|
291
|
-
const _hoisted_1$k = ["textContent"];
|
|
291
|
+
const _hoisted_1$j = ["textContent"];
|
|
292
292
|
var _sfc_main$z = defineComponent({
|
|
293
293
|
...{
|
|
294
294
|
name: "Header",
|
|
@@ -328,7 +328,7 @@ var _sfc_main$z = defineComponent({
|
|
|
328
328
|
key: 0,
|
|
329
329
|
textContent: toDisplayString(__props.title),
|
|
330
330
|
class: normalizeClass(["header-title", __props.titleAlign])
|
|
331
|
-
}, null, 10, _hoisted_1$
|
|
331
|
+
}, null, 10, _hoisted_1$j)) : createCommentVNode("", true), renderSlot(_ctx.$slots, "default"), __props.closeDisabled != true ? (openBlock(), createBlock(_sfc_main$C, {
|
|
332
332
|
key: 1,
|
|
333
333
|
class: "close-icon",
|
|
334
334
|
type: "close",
|
|
@@ -341,7 +341,7 @@ var _sfc_main$z = defineComponent({
|
|
|
341
341
|
}
|
|
342
342
|
});
|
|
343
343
|
|
|
344
|
-
const _hoisted_1$
|
|
344
|
+
const _hoisted_1$i = ["textContent"];
|
|
345
345
|
const _hoisted_2$b = {
|
|
346
346
|
key: 0,
|
|
347
347
|
class: "required",
|
|
@@ -404,7 +404,7 @@ var _sfc_main$y = defineComponent({
|
|
|
404
404
|
}, [createElementVNode("span", {
|
|
405
405
|
class: "text",
|
|
406
406
|
textContent: toDisplayString(__props.title)
|
|
407
|
-
}, null, 8, _hoisted_1$
|
|
407
|
+
}, null, 8, _hoisted_1$i), __props.readonly != true && __props.required == true ? (openBlock(), createElementBlock("span", _hoisted_2$b)) : createCommentVNode("", true)], 4)) : createCommentVNode("", true), createElementVNode("div", _hoisted_3$8, [createElementVNode("input", {
|
|
408
408
|
ref: "input-el",
|
|
409
409
|
type: __props.type || "text",
|
|
410
410
|
value: inputModel.value,
|
|
@@ -627,7 +627,7 @@ function useFormatter(options) {
|
|
|
627
627
|
return formatter;
|
|
628
628
|
}
|
|
629
629
|
|
|
630
|
-
const _hoisted_1$
|
|
630
|
+
const _hoisted_1$h = {
|
|
631
631
|
key: 0,
|
|
632
632
|
class: "number-prefix"
|
|
633
633
|
};
|
|
@@ -787,7 +787,7 @@ var _sfc_main$x = defineComponent({
|
|
|
787
787
|
"has-prefix": unref(hasPrefix),
|
|
788
788
|
"has-suffix": unref(hasSuffix)
|
|
789
789
|
}])
|
|
790
|
-
}, [unref(hasPrefix) ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
790
|
+
}, [unref(hasPrefix) ? (openBlock(), createElementBlock("div", _hoisted_1$h, [createElementVNode("span", {
|
|
791
791
|
class: "ellipsis",
|
|
792
792
|
textContent: toDisplayString(unref(prefix))
|
|
793
793
|
}, null, 8, _hoisted_2$a)])) : createCommentVNode("", true), createElementVNode("div", {
|
|
@@ -854,7 +854,7 @@ var _sfc_main$x = defineComponent({
|
|
|
854
854
|
}
|
|
855
855
|
});
|
|
856
856
|
|
|
857
|
-
const _hoisted_1$
|
|
857
|
+
const _hoisted_1$g = ["placeholder", "readonly"];
|
|
858
858
|
var _sfc_main$w = defineComponent({
|
|
859
859
|
...{
|
|
860
860
|
name: "Search",
|
|
@@ -900,7 +900,7 @@ var _sfc_main$w = defineComponent({
|
|
|
900
900
|
readonly: __props.readonly,
|
|
901
901
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = $event => textModel.value = $event),
|
|
902
902
|
onKeyup: _cache[1] || (_cache[1] = $event => onSearch($event))
|
|
903
|
-
}, null, 40, _hoisted_1$
|
|
903
|
+
}, null, 40, _hoisted_1$g), [[vModelText, textModel.value, void 0, {
|
|
904
904
|
trim: true
|
|
905
905
|
}]]), createElementVNode("div", null, [createVNode(_sfc_main$C, {
|
|
906
906
|
class: "search-button",
|
|
@@ -1127,7 +1127,7 @@ function deducePosition(strategy, targetStart, targetEnd, contentSize, clientSiz
|
|
|
1127
1127
|
}
|
|
1128
1128
|
}
|
|
1129
1129
|
|
|
1130
|
-
const _hoisted_1$
|
|
1130
|
+
const _hoisted_1$f = {
|
|
1131
1131
|
class: "snail-confirm flex-column"
|
|
1132
1132
|
};
|
|
1133
1133
|
const _hoisted_2$9 = ["innerHTML"];
|
|
@@ -1159,7 +1159,7 @@ var _sfc_main$v = defineComponent({
|
|
|
1159
1159
|
},
|
|
1160
1160
|
setup(__props) {
|
|
1161
1161
|
return (_ctx, _cache) => {
|
|
1162
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
1162
|
+
return openBlock(), createElementBlock("div", _hoisted_1$f, [createVNode(_sfc_main$z, {
|
|
1163
1163
|
"use-to": "dialog",
|
|
1164
1164
|
title: __props.title || "提示",
|
|
1165
1165
|
onClose: _cache[0] || (_cache[0] = $event => __props.closePopup(false))
|
|
@@ -1642,7 +1642,7 @@ var _sfc_main$p = defineComponent({
|
|
|
1642
1642
|
}
|
|
1643
1643
|
});
|
|
1644
1644
|
|
|
1645
|
-
const _hoisted_1$
|
|
1645
|
+
const _hoisted_1$e = {
|
|
1646
1646
|
key: 1,
|
|
1647
1647
|
class: "icon"
|
|
1648
1648
|
};
|
|
@@ -1695,7 +1695,7 @@ var _sfc_main$o = defineComponent({
|
|
|
1695
1695
|
onClick: _cache[0] || (_cache[0] = $event => {
|
|
1696
1696
|
unref(closePopup)();
|
|
1697
1697
|
})
|
|
1698
|
-
})) : createCommentVNode("", true), unref(props).type ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
1698
|
+
})) : createCommentVNode("", true), unref(props).type ? (openBlock(), createElementBlock("div", _hoisted_1$e, [createVNode(_sfc_main$C, {
|
|
1699
1699
|
type: unref(props).type,
|
|
1700
1700
|
color: "#707070",
|
|
1701
1701
|
size: 20
|
|
@@ -1945,7 +1945,7 @@ function getNoDataBase64Image() {
|
|
|
1945
1945
|
return "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyFpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQyIDc5LjE2MDkyNCwgMjAxNy8wNy8xMy0wMTowNjozOSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChXaW5kb3dzKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDoyREREODhFQ0M5M0UxMUU5ODlFREVENzc4Njk0RjQ2MiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDoyREREODhFREM5M0UxMUU5ODlFREVENzc4Njk0RjQ2MiI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjJEREQ4OEVBQzkzRTExRTk4OUVERUQ3Nzg2OTRGNDYyIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjJEREQ4OEVCQzkzRTExRTk4OUVERUQ3Nzg2OTRGNDYyIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8++keGxAAAA5lJREFUeNrsmktoE0EYx3eSTdpsk2abvnwcFBVp8QFqVPDgQaGgIogIoictelKKVhARBA8q+KAVrFqooh4qXgRfiHpTEHqw9iCKXqQHSVstpqlt0yabrP9p52K1yW72GTMf/JhZMrM7/3l+37REVVWhlMwjlJhxwVwwF8wFc8FcMBfsnIlGKg98TxRa9RbYAFYXUnl+XbjoRpiKXVXMU9qns3xK76CC/YC4QfA1MAg26aiTZGlQQ9la8AZ0g3VuENwLqsArsFVnXW+e30PgKVgGnoA+Nwi+Cw6DAHgGdmqoMwJoXJrJUcYPHoGN4C3Yl6e8rWv4Nmhma/kh2J6n/HW2JsdylLkKtoAPYAeYcPxYmmX32AjcAVHwPEfZFxreR2fAJ9Z5CbMaSYzceMxxDtN198vKo8Vt57ClYh0d4f/OtTTgOjpquaa8WEhldISM5DRYWYCXZdTS4DVoR9tSegdI9y6Nl1KBL5k/7JRto99HW/ZAtGralJ7DTtCPEUKUmqqKPlH0rtXgMZk2utms2jk0PEqPqt3gEOiybJdGjy5BcobmI7LUC7HrbRQ7HaR4PORoOBRoY+f0RbSp3spjqQNIPtEb8/vEqFMnixTwH0T6gPnwbZYIRk/uZWtHqApLQzaP7GyL1kSCPUinqIuKtjWZKhgvpFt1O82X+cXPXq9njdNHD2ZZC/aRTvZ4A20sN3OEz7IgXJDDkls8laV11aEBpHGaB62mCEbPNSA5QvNYO+88hDS6xcHABtbq9XiusMdTYJ4ZI3yBORdKZTBQ6zKnqq62OiQh7WdByzmjgqlzsWs6BAqW9xAiLHJdMECEY36f9zJ7pLt3oxHH4/j0O4kwWREoW8BuKvSYxG4utFoWjOoVHZErlg/+GP2I7ApwkgnXHy1h/VLntNJA76sROfgFI9CgoXh8OD72OJ3OHDA46Am4m3KhU7rSyJfRl2QiOaXVE3oPsU0mzPKw3RcAf5iiZEPaOkf9KsxcyVq7s1vu7SsZEQ5/LO81ydhk3I5Q05Y/tcQTExKLY/+9U2XV++PJVLMtZ7cdH0mlFfnnyPgIpm3s758y3Qj3NiNfY8sxlmeXNt2NhC/ej0grllXVdHIyVY/RbTD7G9iliZkXAIZsKqUspjjmjgolZlwwF1xigr8VoaYBI4I7ilBwl5Hw8JIwcx3aAha6XCj9t4ub4HzBjgfftLhgLpgL5oK5YC6YC+aCuWDt9luAAQC2EPxjL8cUkwAAAABJRU5ErkJggg==";
|
|
1946
1946
|
}
|
|
1947
1947
|
|
|
1948
|
-
const _hoisted_1$
|
|
1948
|
+
const _hoisted_1$d = {
|
|
1949
1949
|
class: "snail-empty"
|
|
1950
1950
|
};
|
|
1951
1951
|
const _hoisted_2$7 = ["src"];
|
|
@@ -1963,7 +1963,7 @@ var _sfc_main$n = defineComponent({
|
|
|
1963
1963
|
setup(__props) {
|
|
1964
1964
|
const defaultImageBase64 = getNoDataBase64Image();
|
|
1965
1965
|
return (_ctx, _cache) => {
|
|
1966
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
1966
|
+
return openBlock(), createElementBlock("div", _hoisted_1$d, [createElementVNode("img", {
|
|
1967
1967
|
src: __props.imageUrl || unref(defaultImageBase64)
|
|
1968
1968
|
}, null, 8, _hoisted_2$7), renderSlot(_ctx.$slots, "default", {}, () => [createElementVNode("div", {
|
|
1969
1969
|
class: "message",
|
|
@@ -1973,7 +1973,7 @@ var _sfc_main$n = defineComponent({
|
|
|
1973
1973
|
}
|
|
1974
1974
|
});
|
|
1975
1975
|
|
|
1976
|
-
const _hoisted_1$
|
|
1976
|
+
const _hoisted_1$c = ["title"];
|
|
1977
1977
|
const _hoisted_2$6 = ["textContent"];
|
|
1978
1978
|
const _hoisted_3$5 = {
|
|
1979
1979
|
key: 1,
|
|
@@ -2032,7 +2032,7 @@ var _sfc_main$m = defineComponent({
|
|
|
2032
2032
|
button: "",
|
|
2033
2033
|
size: 12,
|
|
2034
2034
|
color: "white"
|
|
2035
|
-
})])) : createCommentVNode("", true)], 42, _hoisted_1$
|
|
2035
|
+
})])) : createCommentVNode("", true)], 42, _hoisted_1$c)) : createCommentVNode("", true), showRef.value ? (openBlock(true), createElementBlock(Fragment, {
|
|
2036
2036
|
key: 1
|
|
2037
2037
|
}, renderList(unref(showChildrenRef), child => {
|
|
2038
2038
|
return openBlock(), createBlock(_component_SelectNode, {
|
|
@@ -2248,7 +2248,7 @@ var _sfc_main$l = defineComponent({
|
|
|
2248
2248
|
}
|
|
2249
2249
|
});
|
|
2250
2250
|
|
|
2251
|
-
const _hoisted_1$
|
|
2251
|
+
const _hoisted_1$b = {
|
|
2252
2252
|
key: 0,
|
|
2253
2253
|
class: "select-result"
|
|
2254
2254
|
};
|
|
@@ -2393,7 +2393,7 @@ var _sfc_main$k = defineComponent({
|
|
|
2393
2393
|
ref: "select"
|
|
2394
2394
|
}, [__props.items && __props.items.length ? (openBlock(), createElementBlock(Fragment, {
|
|
2395
2395
|
key: 0
|
|
2396
|
-
}, [selectedItemsRef.value.length ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
2396
|
+
}, [selectedItemsRef.value.length ? (openBlock(), createElementBlock("div", _hoisted_1$b, [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(slotOptions))), () => [createElementVNode("div", {
|
|
2397
2397
|
class: "select-text ellipsis",
|
|
2398
2398
|
title: selectedTextRef.value,
|
|
2399
2399
|
textContent: toDisplayString(selectedTextRef.value)
|
|
@@ -2461,7 +2461,7 @@ var _sfc_main$j = defineComponent({
|
|
|
2461
2461
|
}
|
|
2462
2462
|
});
|
|
2463
2463
|
|
|
2464
|
-
const _hoisted_1$
|
|
2464
|
+
const _hoisted_1$a = ["readonly", "placeholder", "rows"];
|
|
2465
2465
|
var _sfc_main$i = defineComponent({
|
|
2466
2466
|
...{
|
|
2467
2467
|
name: "Textarea",
|
|
@@ -2522,28 +2522,74 @@ var _sfc_main$i = defineComponent({
|
|
|
2522
2522
|
onInput: _cache[2] || (_cache[2] = $event => emits("input", textareaDom.value.value)),
|
|
2523
2523
|
onBlur: _cache[3] || (_cache[3] = $event => emits("blur", textareaDom.value.value)),
|
|
2524
2524
|
onChange: _cache[4] || (_cache[4] = $event => emits("change", textareaDom.value.value))
|
|
2525
|
-
}, null, 40, _hoisted_1$
|
|
2525
|
+
}, null, 40, _hoisted_1$a)), [[vModelText, valueModel.value]]);
|
|
2526
2526
|
};
|
|
2527
2527
|
}
|
|
2528
2528
|
});
|
|
2529
2529
|
|
|
2530
|
-
function
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
function
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2530
|
+
function monitScroll(manager, root, options, emiter, classStyleRef) {
|
|
2531
|
+
const scope = useScope();
|
|
2532
|
+
let preStatus = void 0;
|
|
2533
|
+
const observer = useObserver();
|
|
2534
|
+
const timer = useTimer();
|
|
2535
|
+
const reactive = useReactive();
|
|
2536
|
+
function buildClassStyle() {
|
|
2537
|
+
const array = (classStyleRef.value ? [...classStyleRef.value] : []).filter(item => item == "x-bar" || item == "y-bar");
|
|
2538
|
+
array.push(...manager.buildClassStyle(options));
|
|
2539
|
+
classStyleRef.value = array;
|
|
2540
|
+
}
|
|
2541
|
+
function refreshScrollInfo() {
|
|
2542
|
+
const status = Object.freeze(manager.getStatus(root));
|
|
2543
|
+
const events = Object.create(null);
|
|
2544
|
+
if (preStatus != void 0) {
|
|
2545
|
+
preStatus.xbar != status.xbar && (events.xbar = [status.xbar]);
|
|
2546
|
+
preStatus.ybar != status.ybar && (events.ybar = [status.ybar]);
|
|
2547
|
+
if (preStatus.xbar == true && status.xbar == true) {
|
|
2548
|
+
status.left && preStatus.left !== status.left && (events.left = []);
|
|
2549
|
+
status.right && preStatus.right !== status.right && (events.right = []);
|
|
2550
|
+
}
|
|
2551
|
+
if (preStatus.ybar == true && status.ybar == true) {
|
|
2552
|
+
status.top && preStatus.top !== status.top && (events.top = []);
|
|
2553
|
+
status.bottom && preStatus.bottom !== status.bottom && (events.bottom = []);
|
|
2554
|
+
}
|
|
2555
|
+
}
|
|
2556
|
+
preStatus = status;
|
|
2557
|
+
events.xbar && emiter("xbar", ...events.xbar);
|
|
2558
|
+
events.left && emiter("left");
|
|
2559
|
+
events.right && emiter("right");
|
|
2560
|
+
events.ybar && emiter("ybar", ...events.ybar);
|
|
2561
|
+
events.top && emiter("top");
|
|
2562
|
+
events.bottom && emiter("bottom");
|
|
2563
|
+
{
|
|
2564
|
+
const array = (classStyleRef.value ? [...classStyleRef.value] : []).filter(item => item != "x-bar" && item != "y-bar");
|
|
2565
|
+
status.xbar && array.push("x-bar");
|
|
2566
|
+
status.ybar && array.push("y-bar");
|
|
2567
|
+
classStyleRef.value = array;
|
|
2568
|
+
}
|
|
2569
|
+
}
|
|
2570
|
+
buildClassStyle();
|
|
2571
|
+
refreshScrollInfo();
|
|
2572
|
+
reactive.watcher(() => options.scroll, buildClassStyle);
|
|
2573
|
+
reactive.watcher(() => options.barSize, buildClassStyle);
|
|
2574
|
+
observer.onSize(root, refreshScrollInfo);
|
|
2575
|
+
observer.onEvent(root, "scroll", refreshScrollInfo);
|
|
2576
|
+
timer.onInterval(() => {
|
|
2577
|
+
const isChange = preStatus.scrollWidth != root.scrollWidth || preStatus.scrollHeight != root.scrollHeight;
|
|
2578
|
+
isChange && refreshScrollInfo();
|
|
2579
|
+
}, 100);
|
|
2580
|
+
scope.onDestroy(() => {
|
|
2581
|
+
observer.destroyed || observer.destroy();
|
|
2582
|
+
timer.destroyed || timer.destroy();
|
|
2583
|
+
reactive.destroyed || reactive.destroy();
|
|
2584
|
+
});
|
|
2585
|
+
return scope;
|
|
2541
2586
|
}
|
|
2542
2587
|
|
|
2543
|
-
const _hoisted_1$a = {
|
|
2544
|
-
class: "snail-elastic"
|
|
2545
|
-
};
|
|
2546
2588
|
var _sfc_main$h = defineComponent({
|
|
2589
|
+
...{
|
|
2590
|
+
name: "Elastic",
|
|
2591
|
+
inheritAttrs: false
|
|
2592
|
+
},
|
|
2547
2593
|
__name: "elastic",
|
|
2548
2594
|
props: {
|
|
2549
2595
|
scroll: {},
|
|
@@ -2556,23 +2602,26 @@ var _sfc_main$h = defineComponent({
|
|
|
2556
2602
|
type: Boolean
|
|
2557
2603
|
}
|
|
2558
2604
|
},
|
|
2559
|
-
emits: ["refresh", "more"],
|
|
2605
|
+
emits: ["xbar", "left", "right", "ybar", "top", "bottom", "refresh", "more"],
|
|
2560
2606
|
setup(__props, _ref) {
|
|
2561
2607
|
let {
|
|
2608
|
+
expose: __expose,
|
|
2562
2609
|
emit: __emit
|
|
2563
2610
|
} = _ref;
|
|
2611
|
+
__expose({
|
|
2612
|
+
loadRefresh,
|
|
2613
|
+
loadMore
|
|
2614
|
+
});
|
|
2564
2615
|
const props = __props;
|
|
2565
2616
|
const emits = __emit;
|
|
2566
2617
|
const {
|
|
2567
|
-
onEvent
|
|
2568
|
-
onSize
|
|
2618
|
+
onEvent
|
|
2569
2619
|
} = useObserver();
|
|
2570
|
-
const
|
|
2571
|
-
watcher
|
|
2572
|
-
} = useReactive();
|
|
2620
|
+
const manager = useScroll();
|
|
2573
2621
|
const downRefreshDom = useTemplateRef("down-refresh");
|
|
2574
2622
|
const mainBodyDom = useTemplateRef("main-body");
|
|
2575
2623
|
const upMoreDom = useTemplateRef("up-more");
|
|
2624
|
+
const classStyleRef = shallowRef();
|
|
2576
2625
|
let isStartByTouch = false;
|
|
2577
2626
|
const startPointerRef = ref(void 0);
|
|
2578
2627
|
const isMovingRef = shallowRef(false);
|
|
@@ -2582,17 +2631,6 @@ var _sfc_main$h = defineComponent({
|
|
|
2582
2631
|
const loadingRef = shallowRef();
|
|
2583
2632
|
function buildMainBodyStyle() {
|
|
2584
2633
|
const style = Object.create(null);
|
|
2585
|
-
switch (props.scroll) {
|
|
2586
|
-
case "x":
|
|
2587
|
-
style["overflow"] = "auto hidden";
|
|
2588
|
-
break;
|
|
2589
|
-
case "y":
|
|
2590
|
-
style["overflow"] = "hidden auto";
|
|
2591
|
-
break;
|
|
2592
|
-
case "none":
|
|
2593
|
-
style["overflow"] = "none";
|
|
2594
|
-
break;
|
|
2595
|
-
}
|
|
2596
2634
|
if (springStatusRef.value != void 0) {
|
|
2597
2635
|
const {
|
|
2598
2636
|
x,
|
|
@@ -2605,6 +2643,41 @@ var _sfc_main$h = defineComponent({
|
|
|
2605
2643
|
}
|
|
2606
2644
|
return style;
|
|
2607
2645
|
}
|
|
2646
|
+
function loadRefresh() {
|
|
2647
|
+
const deferred = defer();
|
|
2648
|
+
if (downRefreshDom.value == void 0) {
|
|
2649
|
+
deferred.reject("not support pullRefresh feature!");
|
|
2650
|
+
} else if (loadingRef.value != void 0) {
|
|
2651
|
+
deferred.reject(`pre load task[${loadingRef.value}] is running!`);
|
|
2652
|
+
} else {
|
|
2653
|
+
resetAfterEnd();
|
|
2654
|
+
loadingRef.value = "refresh";
|
|
2655
|
+
springStatusRef.value.y = downRefreshDom.value.clientHeight;
|
|
2656
|
+
emits("refresh", () => {
|
|
2657
|
+
resetAfterEnd();
|
|
2658
|
+
deferred.resolve();
|
|
2659
|
+
});
|
|
2660
|
+
}
|
|
2661
|
+
return deferred.promise;
|
|
2662
|
+
}
|
|
2663
|
+
function loadMore() {
|
|
2664
|
+
const deferred = defer();
|
|
2665
|
+
if (downRefreshDom.value == void 0) {
|
|
2666
|
+
deferred.reject("not support upMore feature!");
|
|
2667
|
+
} else if (loadingRef.value != void 0) {
|
|
2668
|
+
deferred.reject(`pre load task[${loadingRef.value}] is running!`);
|
|
2669
|
+
} else {
|
|
2670
|
+
resetAfterEnd();
|
|
2671
|
+
loadingRef.value = "more";
|
|
2672
|
+
springStatusRef.value.y = -upMoreDom.value.clientHeight;
|
|
2673
|
+
emits("more", () => {
|
|
2674
|
+
resetAfterEnd();
|
|
2675
|
+
deferred.resolve();
|
|
2676
|
+
});
|
|
2677
|
+
return;
|
|
2678
|
+
}
|
|
2679
|
+
return deferred.promise;
|
|
2680
|
+
}
|
|
2608
2681
|
function onSpringStart(isTouch, position) {
|
|
2609
2682
|
if (loadingRef.value != void 0) {
|
|
2610
2683
|
return;
|
|
@@ -2627,9 +2700,9 @@ var _sfc_main$h = defineComponent({
|
|
|
2627
2700
|
isMovingRef.value = true;
|
|
2628
2701
|
if (springXRef.value == true) {
|
|
2629
2702
|
const distance = position.clientX - startPointerRef.value.clientX;
|
|
2630
|
-
if (distance >= 0 && isLeft(mainBodyDom.value)) {
|
|
2703
|
+
if (distance >= 0 && manager.isLeft(mainBodyDom.value)) {
|
|
2631
2704
|
springStatusRef.value.x = Math.pow(distance, 0.8);
|
|
2632
|
-
} else if (distance <= 0 && isRight(mainBodyDom.value)) {
|
|
2705
|
+
} else if (distance <= 0 && manager.isRight(mainBodyDom.value)) {
|
|
2633
2706
|
springStatusRef.value.x = -Math.pow(-distance, 0.8);
|
|
2634
2707
|
}
|
|
2635
2708
|
}
|
|
@@ -2639,10 +2712,10 @@ var _sfc_main$h = defineComponent({
|
|
|
2639
2712
|
default:
|
|
2640
2713
|
{
|
|
2641
2714
|
if (distance >= 0) {
|
|
2642
|
-
isTop(mainBodyDom.value) ? springStatusRef.value.y = Math.pow(distance, 0.8) : startPointerRef.value.clientY = position.clientY;
|
|
2715
|
+
manager.isTop(mainBodyDom.value) ? springStatusRef.value.y = Math.pow(distance, 0.8) : startPointerRef.value.clientY = position.clientY;
|
|
2643
2716
|
} else {
|
|
2644
2717
|
console.log("isBottom", mainBodyDom.value.scrollTop + mainBodyDom.value.clientHeight, "---", mainBodyDom.value.scrollHeight);
|
|
2645
|
-
isBottom(mainBodyDom.value) ? springStatusRef.value.y = -Math.pow(-distance, 0.8) : startPointerRef.value.clientY = position.clientY;
|
|
2718
|
+
manager.isBottom(mainBodyDom.value) ? springStatusRef.value.y = -Math.pow(-distance, 0.8) : startPointerRef.value.clientY = position.clientY;
|
|
2646
2719
|
}
|
|
2647
2720
|
break;
|
|
2648
2721
|
}
|
|
@@ -2658,18 +2731,10 @@ var _sfc_main$h = defineComponent({
|
|
|
2658
2731
|
}
|
|
2659
2732
|
if (loadingRef.value == void 0) {
|
|
2660
2733
|
if (downRefreshDom.value && springStatusRef.value.y > downRefreshDom.value.clientHeight) {
|
|
2661
|
-
|
|
2662
|
-
loadingRef.value = "refresh";
|
|
2663
|
-
springStatusRef.value.y = downRefreshDom.value.clientHeight;
|
|
2664
|
-
emits("refresh", resetAfterEnd);
|
|
2665
|
-
return;
|
|
2734
|
+
return loadRefresh();
|
|
2666
2735
|
}
|
|
2667
2736
|
if (upMoreDom.value && springStatusRef.value.y <= -upMoreDom.value.clientHeight) {
|
|
2668
|
-
|
|
2669
|
-
loadingRef.value = "more";
|
|
2670
|
-
springStatusRef.value.y = -upMoreDom.value.clientHeight;
|
|
2671
|
-
emits("more", resetAfterEnd);
|
|
2672
|
-
return;
|
|
2737
|
+
return loadMore();
|
|
2673
2738
|
}
|
|
2674
2739
|
}
|
|
2675
2740
|
resetAfterEnd();
|
|
@@ -2682,6 +2747,7 @@ var _sfc_main$h = defineComponent({
|
|
|
2682
2747
|
isStartByTouch = false;
|
|
2683
2748
|
}
|
|
2684
2749
|
onMounted(() => {
|
|
2750
|
+
monitScroll(manager, mainBodyDom.value, props, emits, classStyleRef);
|
|
2685
2751
|
if ("ontouchstart" in window) {
|
|
2686
2752
|
onEvent(mainBodyDom.value, "touchstart", evt => onSpringStart(true, evt.touches[0]));
|
|
2687
2753
|
onEvent(window, "touchmove", evt => onSpringMove(true, evt.touches[0]));
|
|
@@ -2695,7 +2761,9 @@ var _sfc_main$h = defineComponent({
|
|
|
2695
2761
|
}
|
|
2696
2762
|
});
|
|
2697
2763
|
return (_ctx, _cache) => {
|
|
2698
|
-
return openBlock(), createElementBlock("div",
|
|
2764
|
+
return openBlock(), createElementBlock("div", mergeProps(_ctx.$attrs, {
|
|
2765
|
+
class: "snail-elastic"
|
|
2766
|
+
}), [springYRef.value == true && __props.downRefresh == true ? withDirectives((openBlock(), createElementBlock("div", {
|
|
2699
2767
|
key: 0,
|
|
2700
2768
|
class: normalizeClass(["down-refresh", {
|
|
2701
2769
|
"running": loadingRef.value == "refresh"
|
|
@@ -2704,7 +2772,9 @@ var _sfc_main$h = defineComponent({
|
|
|
2704
2772
|
}, [renderSlot(_ctx.$slots, "down-refresh", {}, () => [_cache[0] || (_cache[0] = createElementVNode("div", {
|
|
2705
2773
|
class: "flex-center default-loading"
|
|
2706
2774
|
}, [createElementVNode("span"), createElementVNode("span"), createElementVNode("span")], -1))])], 2)), [[vShow, loadingRef.value != "more"]]) : createCommentVNode("", true), createElementVNode("div", {
|
|
2707
|
-
class: normalizeClass(["main-body wh-fill",
|
|
2775
|
+
class: normalizeClass(["main-body wh-fill", classStyleRef.value, {
|
|
2776
|
+
"moving": isMovingRef.value
|
|
2777
|
+
}]),
|
|
2708
2778
|
ref: "main-body",
|
|
2709
2779
|
key: "main-body",
|
|
2710
2780
|
style: normalizeStyle(buildMainBodyStyle())
|
|
@@ -2716,7 +2786,7 @@ var _sfc_main$h = defineComponent({
|
|
|
2716
2786
|
ref: "up-more"
|
|
2717
2787
|
}, [renderSlot(_ctx.$slots, "up-more", {}, () => [_cache[1] || (_cache[1] = createElementVNode("div", {
|
|
2718
2788
|
class: "flex-center default-loading"
|
|
2719
|
-
}, [createElementVNode("span"), createElementVNode("span"), createElementVNode("span")], -1))])], 2)), [[vShow, loadingRef.value != "refresh"]]) : createCommentVNode("", true)]);
|
|
2789
|
+
}, [createElementVNode("span"), createElementVNode("span"), createElementVNode("span")], -1))])], 2)), [[vShow, loadingRef.value != "refresh"]]) : createCommentVNode("", true)], 16);
|
|
2720
2790
|
};
|
|
2721
2791
|
}
|
|
2722
2792
|
});
|
|
@@ -2921,7 +2991,7 @@ var _sfc_main$f = defineComponent({
|
|
|
2921
2991
|
var _sfc_main$e = defineComponent({
|
|
2922
2992
|
...{
|
|
2923
2993
|
name: "Scroll",
|
|
2924
|
-
inheritAttrs:
|
|
2994
|
+
inheritAttrs: false
|
|
2925
2995
|
},
|
|
2926
2996
|
__name: "scroll",
|
|
2927
2997
|
props: {
|
|
@@ -2937,102 +3007,27 @@ var _sfc_main$e = defineComponent({
|
|
|
2937
3007
|
const props = __props;
|
|
2938
3008
|
const emits = __emit;
|
|
2939
3009
|
const rootDom = useTemplateRef("scroll-root");
|
|
2940
|
-
const
|
|
2941
|
-
|
|
2942
|
-
} = useObserver();
|
|
2943
|
-
const {
|
|
2944
|
-
onInterval
|
|
2945
|
-
} = useTimer();
|
|
2946
|
-
var preStatus = void 0;
|
|
3010
|
+
const manager = useScroll();
|
|
3011
|
+
const classStyleRef = shallowRef();
|
|
2947
3012
|
__expose({
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
style["overflow"] = "hidden auto";
|
|
2959
|
-
break;
|
|
2960
|
-
case "none":
|
|
2961
|
-
style["overflow"] = "none";
|
|
2962
|
-
break;
|
|
2963
|
-
}
|
|
2964
|
-
return style;
|
|
2965
|
-
}
|
|
2966
|
-
function scroll(left, top) {
|
|
2967
|
-
left == void 0 || (rootDom.value.scrollLeft += left);
|
|
2968
|
-
top == void 0 || (rootDom.value.scrollTop += top);
|
|
2969
|
-
}
|
|
2970
|
-
function scrollTo(left, top) {
|
|
2971
|
-
left == void 0 || (rootDom.value.scrollLeft = left);
|
|
2972
|
-
top == void 0 || (rootDom.value.scrollTop = top);
|
|
2973
|
-
}
|
|
2974
|
-
function refreshScrollInfo() {
|
|
2975
|
-
const status = {
|
|
2976
|
-
xbar: rootDom.value.scrollWidth > rootDom.value.clientWidth,
|
|
2977
|
-
ybar: rootDom.value.scrollHeight > rootDom.value.clientHeight,
|
|
2978
|
-
left: false,
|
|
2979
|
-
right: false,
|
|
2980
|
-
top: false,
|
|
2981
|
-
bottom: false,
|
|
2982
|
-
scrollwidth: rootDom.value.scrollWidth,
|
|
2983
|
-
scrollheight: rootDom.value.scrollHeight
|
|
2984
|
-
};
|
|
2985
|
-
if (status.xbar == true) {
|
|
2986
|
-
status.left = rootDom.value.scrollLeft == 0;
|
|
2987
|
-
status.right = rootDom.value.scrollLeft + rootDom.value.clientWidth == rootDom.value.scrollWidth;
|
|
2988
|
-
}
|
|
2989
|
-
if (status.ybar == true) {
|
|
2990
|
-
status.top = rootDom.value.scrollTop == 0;
|
|
2991
|
-
status.bottom = rootDom.value.scrollTop + rootDom.value.clientHeight == rootDom.value.scrollHeight;
|
|
2992
|
-
}
|
|
2993
|
-
Object.freeze(status);
|
|
2994
|
-
const events = Object.create(null);
|
|
2995
|
-
if (preStatus != void 0) {
|
|
2996
|
-
preStatus.xbar != status.xbar && (events.xbar = [status.xbar]);
|
|
2997
|
-
preStatus.ybar != status.ybar && (events.ybar = [status.ybar]);
|
|
2998
|
-
if (preStatus.xbar == true && status.xbar == true) {
|
|
2999
|
-
status.left && preStatus.left !== status.left && (events.left = []);
|
|
3000
|
-
status.right && preStatus.right !== status.right && (events.right = []);
|
|
3001
|
-
}
|
|
3002
|
-
if (preStatus.ybar == true && status.ybar == true) {
|
|
3003
|
-
status.top && preStatus.top !== status.top && (events.top = []);
|
|
3004
|
-
status.bottom && preStatus.bottom !== status.bottom && (events.bottom = []);
|
|
3005
|
-
}
|
|
3006
|
-
}
|
|
3007
|
-
preStatus = status;
|
|
3008
|
-
preStatus = Object.freeze(status);
|
|
3009
|
-
events.xbar && emits("xbar", ...events.xbar);
|
|
3010
|
-
events.left && emits("left");
|
|
3011
|
-
events.right && emits("right");
|
|
3012
|
-
events.ybar && emits("ybar", ...events.ybar);
|
|
3013
|
-
events.top && emits("top");
|
|
3014
|
-
events.bottom && emits("bottom");
|
|
3015
|
-
if (rootDom.value) {
|
|
3016
|
-
rootDom.value.classList.remove("x-bar", "y-bar");
|
|
3017
|
-
status.xbar && rootDom.value.classList.add("x-bar");
|
|
3018
|
-
status.ybar && rootDom.value.classList.add("y-bar");
|
|
3013
|
+
getStatus() {
|
|
3014
|
+
return manager.getStatus(rootDom.value);
|
|
3015
|
+
},
|
|
3016
|
+
scroll(left, top) {
|
|
3017
|
+
left == void 0 || (rootDom.value.scrollLeft += left);
|
|
3018
|
+
top == void 0 || (rootDom.value.scrollTop += top);
|
|
3019
|
+
},
|
|
3020
|
+
scrollTo(left, top) {
|
|
3021
|
+
left == void 0 || (rootDom.value.scrollLeft = left);
|
|
3022
|
+
top == void 0 || (rootDom.value.scrollTop = top);
|
|
3019
3023
|
}
|
|
3020
|
-
}
|
|
3021
|
-
onMounted(() => {
|
|
3022
|
-
refreshScrollInfo();
|
|
3023
|
-
onSize(rootDom.value, refreshScrollInfo);
|
|
3024
|
-
onInterval(() => {
|
|
3025
|
-
const isChange = preStatus.scrollwidth != rootDom.value.scrollWidth || preStatus.scrollheight != rootDom.value.scrollHeight;
|
|
3026
|
-
isChange && refreshScrollInfo();
|
|
3027
|
-
}, 100);
|
|
3028
3024
|
});
|
|
3025
|
+
onMounted(() => monitScroll(manager, rootDom.value, props, emits, classStyleRef));
|
|
3029
3026
|
return (_ctx, _cache) => {
|
|
3030
|
-
return openBlock(), createElementBlock("div", {
|
|
3031
|
-
class:
|
|
3032
|
-
ref: "scroll-root"
|
|
3033
|
-
|
|
3034
|
-
onScroll: refreshScrollInfo
|
|
3035
|
-
}, [renderSlot(_ctx.$slots, "default")], 38);
|
|
3027
|
+
return openBlock(), createElementBlock("div", mergeProps(_ctx.$attrs, {
|
|
3028
|
+
class: ["snail-scroll", classStyleRef.value],
|
|
3029
|
+
ref: "scroll-root"
|
|
3030
|
+
}), [renderSlot(_ctx.$slots, "default")], 16);
|
|
3036
3031
|
};
|
|
3037
3032
|
}
|
|
3038
3033
|
});
|