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.umd.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.SnailVue = global.SnailVue || {}, global.Vue, global.Snail, global.SnailView));
|
|
6
6
|
})(this, (function (exports, vue, snail_core, snail_view) { 'use strict';
|
|
7
7
|
|
|
8
|
-
const _hoisted_1$
|
|
8
|
+
const _hoisted_1$m = ["title"];
|
|
9
9
|
var _sfc_main$D = vue.defineComponent({
|
|
10
10
|
...{
|
|
11
11
|
name: "Button",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
23
23
|
class: vue.normalizeClass(["snail-button", [__props.size, __props.type]]),
|
|
24
24
|
title: __props.title
|
|
25
|
-
}, [vue.renderSlot(_ctx.$slots, "default", {}, () => [_cache[0] || (_cache[0] = vue.createTextVNode("按钮", -1))])], 10, _hoisted_1$
|
|
25
|
+
}, [vue.renderSlot(_ctx.$slots, "default", {}, () => [_cache[0] || (_cache[0] = vue.createTextVNode("按钮", -1))])], 10, _hoisted_1$m);
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
});
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
const _hoisted_1$
|
|
68
|
+
const _hoisted_1$l = ["viewBox"];
|
|
69
69
|
const _hoisted_2$d = ["textContent"];
|
|
70
70
|
const _hoisted_3$a = ["d"];
|
|
71
71
|
var _sfc_main$C = vue.defineComponent({
|
|
@@ -131,12 +131,12 @@
|
|
|
131
131
|
return vue.openBlock(), vue.createElementBlock("path", {
|
|
132
132
|
d
|
|
133
133
|
}, null, 8, _hoisted_3$a);
|
|
134
|
-
}), 256))], 16, _hoisted_1$
|
|
134
|
+
}), 256))], 16, _hoisted_1$l);
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
137
|
});
|
|
138
138
|
|
|
139
|
-
const _hoisted_1$
|
|
139
|
+
const _hoisted_1$k = ["title", "onClick"];
|
|
140
140
|
const _hoisted_2$c = ["type", "checked"];
|
|
141
141
|
const _hoisted_3$9 = ["textContent"];
|
|
142
142
|
const _hoisted_4$7 = ["textContent"];
|
|
@@ -232,12 +232,16 @@
|
|
|
232
232
|
key: 3,
|
|
233
233
|
class: "item-des",
|
|
234
234
|
textContent: vue.toDisplayString(node.item.description)
|
|
235
|
-
}, null, 8, _hoisted_4$7)) : vue.createCommentVNode("", true)], 14, _hoisted_1$
|
|
235
|
+
}, null, 8, _hoisted_4$7)) : vue.createCommentVNode("", true)], 14, _hoisted_1$k);
|
|
236
236
|
}), 128))], 2);
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
239
|
});
|
|
240
240
|
|
|
241
|
+
var addLink = href => setTimeout(snail_view.link.register, 0, href);
|
|
242
|
+
|
|
243
|
+
addLink("/styles/snail.vue.vue.css");
|
|
244
|
+
|
|
241
245
|
var _sfc_main$A = vue.defineComponent({
|
|
242
246
|
...{
|
|
243
247
|
name: "Footer",
|
|
@@ -286,11 +290,7 @@
|
|
|
286
290
|
}
|
|
287
291
|
});
|
|
288
292
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
addLink("/styles/snail.vue.vue.css");
|
|
292
|
-
|
|
293
|
-
const _hoisted_1$k = ["textContent"];
|
|
293
|
+
const _hoisted_1$j = ["textContent"];
|
|
294
294
|
var _sfc_main$z = vue.defineComponent({
|
|
295
295
|
...{
|
|
296
296
|
name: "Header",
|
|
@@ -330,7 +330,7 @@
|
|
|
330
330
|
key: 0,
|
|
331
331
|
textContent: vue.toDisplayString(__props.title),
|
|
332
332
|
class: vue.normalizeClass(["header-title", __props.titleAlign])
|
|
333
|
-
}, null, 10, _hoisted_1$
|
|
333
|
+
}, null, 10, _hoisted_1$j)) : vue.createCommentVNode("", true), vue.renderSlot(_ctx.$slots, "default"), __props.closeDisabled != true ? (vue.openBlock(), vue.createBlock(_sfc_main$C, {
|
|
334
334
|
key: 1,
|
|
335
335
|
class: "close-icon",
|
|
336
336
|
type: "close",
|
|
@@ -343,7 +343,7 @@
|
|
|
343
343
|
}
|
|
344
344
|
});
|
|
345
345
|
|
|
346
|
-
const _hoisted_1$
|
|
346
|
+
const _hoisted_1$i = ["textContent"];
|
|
347
347
|
const _hoisted_2$b = {
|
|
348
348
|
key: 0,
|
|
349
349
|
class: "required",
|
|
@@ -406,7 +406,7 @@
|
|
|
406
406
|
}, [vue.createElementVNode("span", {
|
|
407
407
|
class: "text",
|
|
408
408
|
textContent: vue.toDisplayString(__props.title)
|
|
409
|
-
}, null, 8, _hoisted_1$
|
|
409
|
+
}, null, 8, _hoisted_1$i), __props.readonly != true && __props.required == true ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$b)) : vue.createCommentVNode("", true)], 4)) : vue.createCommentVNode("", true), vue.createElementVNode("div", _hoisted_3$8, [vue.createElementVNode("input", {
|
|
410
410
|
ref: "input-el",
|
|
411
411
|
type: __props.type || "text",
|
|
412
412
|
value: inputModel.value,
|
|
@@ -629,7 +629,7 @@
|
|
|
629
629
|
return formatter;
|
|
630
630
|
}
|
|
631
631
|
|
|
632
|
-
const _hoisted_1$
|
|
632
|
+
const _hoisted_1$h = {
|
|
633
633
|
key: 0,
|
|
634
634
|
class: "number-prefix"
|
|
635
635
|
};
|
|
@@ -789,7 +789,7 @@
|
|
|
789
789
|
"has-prefix": vue.unref(hasPrefix),
|
|
790
790
|
"has-suffix": vue.unref(hasSuffix)
|
|
791
791
|
}])
|
|
792
|
-
}, [vue.unref(hasPrefix) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
792
|
+
}, [vue.unref(hasPrefix) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [vue.createElementVNode("span", {
|
|
793
793
|
class: "ellipsis",
|
|
794
794
|
textContent: vue.toDisplayString(vue.unref(prefix))
|
|
795
795
|
}, null, 8, _hoisted_2$a)])) : vue.createCommentVNode("", true), vue.createElementVNode("div", {
|
|
@@ -856,7 +856,7 @@
|
|
|
856
856
|
}
|
|
857
857
|
});
|
|
858
858
|
|
|
859
|
-
const _hoisted_1$
|
|
859
|
+
const _hoisted_1$g = ["placeholder", "readonly"];
|
|
860
860
|
var _sfc_main$w = vue.defineComponent({
|
|
861
861
|
...{
|
|
862
862
|
name: "Search",
|
|
@@ -902,7 +902,7 @@
|
|
|
902
902
|
readonly: __props.readonly,
|
|
903
903
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = $event => textModel.value = $event),
|
|
904
904
|
onKeyup: _cache[1] || (_cache[1] = $event => onSearch($event))
|
|
905
|
-
}, null, 40, _hoisted_1$
|
|
905
|
+
}, null, 40, _hoisted_1$g), [[vue.vModelText, textModel.value, void 0, {
|
|
906
906
|
trim: true
|
|
907
907
|
}]]), vue.createElementVNode("div", null, [vue.createVNode(_sfc_main$C, {
|
|
908
908
|
class: "search-button",
|
|
@@ -1129,7 +1129,7 @@
|
|
|
1129
1129
|
}
|
|
1130
1130
|
}
|
|
1131
1131
|
|
|
1132
|
-
const _hoisted_1$
|
|
1132
|
+
const _hoisted_1$f = {
|
|
1133
1133
|
class: "snail-confirm flex-column"
|
|
1134
1134
|
};
|
|
1135
1135
|
const _hoisted_2$9 = ["innerHTML"];
|
|
@@ -1161,7 +1161,7 @@
|
|
|
1161
1161
|
},
|
|
1162
1162
|
setup(__props) {
|
|
1163
1163
|
return (_ctx, _cache) => {
|
|
1164
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
1164
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, [vue.createVNode(_sfc_main$z, {
|
|
1165
1165
|
"use-to": "dialog",
|
|
1166
1166
|
title: __props.title || "提示",
|
|
1167
1167
|
onClose: _cache[0] || (_cache[0] = $event => __props.closePopup(false))
|
|
@@ -1644,7 +1644,7 @@
|
|
|
1644
1644
|
}
|
|
1645
1645
|
});
|
|
1646
1646
|
|
|
1647
|
-
const _hoisted_1$
|
|
1647
|
+
const _hoisted_1$e = {
|
|
1648
1648
|
key: 1,
|
|
1649
1649
|
class: "icon"
|
|
1650
1650
|
};
|
|
@@ -1697,7 +1697,7 @@
|
|
|
1697
1697
|
onClick: _cache[0] || (_cache[0] = $event => {
|
|
1698
1698
|
vue.unref(closePopup)();
|
|
1699
1699
|
})
|
|
1700
|
-
})) : vue.createCommentVNode("", true), vue.unref(props).type ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
1700
|
+
})) : vue.createCommentVNode("", true), vue.unref(props).type ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e, [vue.createVNode(_sfc_main$C, {
|
|
1701
1701
|
type: vue.unref(props).type,
|
|
1702
1702
|
color: "#707070",
|
|
1703
1703
|
size: 20
|
|
@@ -1947,7 +1947,7 @@
|
|
|
1947
1947
|
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==";
|
|
1948
1948
|
}
|
|
1949
1949
|
|
|
1950
|
-
const _hoisted_1$
|
|
1950
|
+
const _hoisted_1$d = {
|
|
1951
1951
|
class: "snail-empty"
|
|
1952
1952
|
};
|
|
1953
1953
|
const _hoisted_2$7 = ["src"];
|
|
@@ -1965,7 +1965,7 @@
|
|
|
1965
1965
|
setup(__props) {
|
|
1966
1966
|
const defaultImageBase64 = getNoDataBase64Image();
|
|
1967
1967
|
return (_ctx, _cache) => {
|
|
1968
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
1968
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$d, [vue.createElementVNode("img", {
|
|
1969
1969
|
src: __props.imageUrl || vue.unref(defaultImageBase64)
|
|
1970
1970
|
}, null, 8, _hoisted_2$7), vue.renderSlot(_ctx.$slots, "default", {}, () => [vue.createElementVNode("div", {
|
|
1971
1971
|
class: "message",
|
|
@@ -1975,7 +1975,7 @@
|
|
|
1975
1975
|
}
|
|
1976
1976
|
});
|
|
1977
1977
|
|
|
1978
|
-
const _hoisted_1$
|
|
1978
|
+
const _hoisted_1$c = ["title"];
|
|
1979
1979
|
const _hoisted_2$6 = ["textContent"];
|
|
1980
1980
|
const _hoisted_3$5 = {
|
|
1981
1981
|
key: 1,
|
|
@@ -2034,7 +2034,7 @@
|
|
|
2034
2034
|
button: "",
|
|
2035
2035
|
size: 12,
|
|
2036
2036
|
color: "white"
|
|
2037
|
-
})])) : vue.createCommentVNode("", true)], 42, _hoisted_1$
|
|
2037
|
+
})])) : vue.createCommentVNode("", true)], 42, _hoisted_1$c)) : vue.createCommentVNode("", true), showRef.value ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, {
|
|
2038
2038
|
key: 1
|
|
2039
2039
|
}, vue.renderList(vue.unref(showChildrenRef), child => {
|
|
2040
2040
|
return vue.openBlock(), vue.createBlock(_component_SelectNode, {
|
|
@@ -2250,7 +2250,7 @@
|
|
|
2250
2250
|
}
|
|
2251
2251
|
});
|
|
2252
2252
|
|
|
2253
|
-
const _hoisted_1$
|
|
2253
|
+
const _hoisted_1$b = {
|
|
2254
2254
|
key: 0,
|
|
2255
2255
|
class: "select-result"
|
|
2256
2256
|
};
|
|
@@ -2395,7 +2395,7 @@
|
|
|
2395
2395
|
ref: "select"
|
|
2396
2396
|
}, [__props.items && __props.items.length ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
|
|
2397
2397
|
key: 0
|
|
2398
|
-
}, [selectedItemsRef.value.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2398
|
+
}, [selectedItemsRef.value.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.guardReactiveProps(vue.unref(slotOptions))), () => [vue.createElementVNode("div", {
|
|
2399
2399
|
class: "select-text ellipsis",
|
|
2400
2400
|
title: selectedTextRef.value,
|
|
2401
2401
|
textContent: vue.toDisplayString(selectedTextRef.value)
|
|
@@ -2463,7 +2463,7 @@
|
|
|
2463
2463
|
}
|
|
2464
2464
|
});
|
|
2465
2465
|
|
|
2466
|
-
const _hoisted_1$
|
|
2466
|
+
const _hoisted_1$a = ["readonly", "placeholder", "rows"];
|
|
2467
2467
|
var _sfc_main$i = vue.defineComponent({
|
|
2468
2468
|
...{
|
|
2469
2469
|
name: "Textarea",
|
|
@@ -2524,28 +2524,74 @@
|
|
|
2524
2524
|
onInput: _cache[2] || (_cache[2] = $event => emits("input", textareaDom.value.value)),
|
|
2525
2525
|
onBlur: _cache[3] || (_cache[3] = $event => emits("blur", textareaDom.value.value)),
|
|
2526
2526
|
onChange: _cache[4] || (_cache[4] = $event => emits("change", textareaDom.value.value))
|
|
2527
|
-
}, null, 40, _hoisted_1$
|
|
2527
|
+
}, null, 40, _hoisted_1$a)), [[vue.vModelText, valueModel.value]]);
|
|
2528
2528
|
};
|
|
2529
2529
|
}
|
|
2530
2530
|
});
|
|
2531
2531
|
|
|
2532
|
-
function
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2532
|
+
function monitScroll(manager, root, options, emiter, classStyleRef) {
|
|
2533
|
+
const scope = snail_core.useScope();
|
|
2534
|
+
let preStatus = void 0;
|
|
2535
|
+
const observer = snail_view.useObserver();
|
|
2536
|
+
const timer = snail_core.useTimer();
|
|
2537
|
+
const reactive = useReactive();
|
|
2538
|
+
function buildClassStyle() {
|
|
2539
|
+
const array = (classStyleRef.value ? [...classStyleRef.value] : []).filter(item => item == "x-bar" || item == "y-bar");
|
|
2540
|
+
array.push(...manager.buildClassStyle(options));
|
|
2541
|
+
classStyleRef.value = array;
|
|
2542
|
+
}
|
|
2543
|
+
function refreshScrollInfo() {
|
|
2544
|
+
const status = Object.freeze(manager.getStatus(root));
|
|
2545
|
+
const events = Object.create(null);
|
|
2546
|
+
if (preStatus != void 0) {
|
|
2547
|
+
preStatus.xbar != status.xbar && (events.xbar = [status.xbar]);
|
|
2548
|
+
preStatus.ybar != status.ybar && (events.ybar = [status.ybar]);
|
|
2549
|
+
if (preStatus.xbar == true && status.xbar == true) {
|
|
2550
|
+
status.left && preStatus.left !== status.left && (events.left = []);
|
|
2551
|
+
status.right && preStatus.right !== status.right && (events.right = []);
|
|
2552
|
+
}
|
|
2553
|
+
if (preStatus.ybar == true && status.ybar == true) {
|
|
2554
|
+
status.top && preStatus.top !== status.top && (events.top = []);
|
|
2555
|
+
status.bottom && preStatus.bottom !== status.bottom && (events.bottom = []);
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
preStatus = status;
|
|
2559
|
+
events.xbar && emiter("xbar", ...events.xbar);
|
|
2560
|
+
events.left && emiter("left");
|
|
2561
|
+
events.right && emiter("right");
|
|
2562
|
+
events.ybar && emiter("ybar", ...events.ybar);
|
|
2563
|
+
events.top && emiter("top");
|
|
2564
|
+
events.bottom && emiter("bottom");
|
|
2565
|
+
{
|
|
2566
|
+
const array = (classStyleRef.value ? [...classStyleRef.value] : []).filter(item => item != "x-bar" && item != "y-bar");
|
|
2567
|
+
status.xbar && array.push("x-bar");
|
|
2568
|
+
status.ybar && array.push("y-bar");
|
|
2569
|
+
classStyleRef.value = array;
|
|
2570
|
+
}
|
|
2571
|
+
}
|
|
2572
|
+
buildClassStyle();
|
|
2573
|
+
refreshScrollInfo();
|
|
2574
|
+
reactive.watcher(() => options.scroll, buildClassStyle);
|
|
2575
|
+
reactive.watcher(() => options.barSize, buildClassStyle);
|
|
2576
|
+
observer.onSize(root, refreshScrollInfo);
|
|
2577
|
+
observer.onEvent(root, "scroll", refreshScrollInfo);
|
|
2578
|
+
timer.onInterval(() => {
|
|
2579
|
+
const isChange = preStatus.scrollWidth != root.scrollWidth || preStatus.scrollHeight != root.scrollHeight;
|
|
2580
|
+
isChange && refreshScrollInfo();
|
|
2581
|
+
}, 100);
|
|
2582
|
+
scope.onDestroy(() => {
|
|
2583
|
+
observer.destroyed || observer.destroy();
|
|
2584
|
+
timer.destroyed || timer.destroy();
|
|
2585
|
+
reactive.destroyed || reactive.destroy();
|
|
2586
|
+
});
|
|
2587
|
+
return scope;
|
|
2543
2588
|
}
|
|
2544
2589
|
|
|
2545
|
-
const _hoisted_1$a = {
|
|
2546
|
-
class: "snail-elastic"
|
|
2547
|
-
};
|
|
2548
2590
|
var _sfc_main$h = vue.defineComponent({
|
|
2591
|
+
...{
|
|
2592
|
+
name: "Elastic",
|
|
2593
|
+
inheritAttrs: false
|
|
2594
|
+
},
|
|
2549
2595
|
__name: "elastic",
|
|
2550
2596
|
props: {
|
|
2551
2597
|
scroll: {},
|
|
@@ -2558,23 +2604,26 @@
|
|
|
2558
2604
|
type: Boolean
|
|
2559
2605
|
}
|
|
2560
2606
|
},
|
|
2561
|
-
emits: ["refresh", "more"],
|
|
2607
|
+
emits: ["xbar", "left", "right", "ybar", "top", "bottom", "refresh", "more"],
|
|
2562
2608
|
setup(__props, _ref) {
|
|
2563
2609
|
let {
|
|
2610
|
+
expose: __expose,
|
|
2564
2611
|
emit: __emit
|
|
2565
2612
|
} = _ref;
|
|
2613
|
+
__expose({
|
|
2614
|
+
loadRefresh,
|
|
2615
|
+
loadMore
|
|
2616
|
+
});
|
|
2566
2617
|
const props = __props;
|
|
2567
2618
|
const emits = __emit;
|
|
2568
2619
|
const {
|
|
2569
|
-
onEvent
|
|
2570
|
-
onSize
|
|
2620
|
+
onEvent
|
|
2571
2621
|
} = snail_view.useObserver();
|
|
2572
|
-
const
|
|
2573
|
-
watcher
|
|
2574
|
-
} = useReactive();
|
|
2622
|
+
const manager = snail_view.useScroll();
|
|
2575
2623
|
const downRefreshDom = vue.useTemplateRef("down-refresh");
|
|
2576
2624
|
const mainBodyDom = vue.useTemplateRef("main-body");
|
|
2577
2625
|
const upMoreDom = vue.useTemplateRef("up-more");
|
|
2626
|
+
const classStyleRef = vue.shallowRef();
|
|
2578
2627
|
let isStartByTouch = false;
|
|
2579
2628
|
const startPointerRef = vue.ref(void 0);
|
|
2580
2629
|
const isMovingRef = vue.shallowRef(false);
|
|
@@ -2584,17 +2633,6 @@
|
|
|
2584
2633
|
const loadingRef = vue.shallowRef();
|
|
2585
2634
|
function buildMainBodyStyle() {
|
|
2586
2635
|
const style = Object.create(null);
|
|
2587
|
-
switch (props.scroll) {
|
|
2588
|
-
case "x":
|
|
2589
|
-
style["overflow"] = "auto hidden";
|
|
2590
|
-
break;
|
|
2591
|
-
case "y":
|
|
2592
|
-
style["overflow"] = "hidden auto";
|
|
2593
|
-
break;
|
|
2594
|
-
case "none":
|
|
2595
|
-
style["overflow"] = "none";
|
|
2596
|
-
break;
|
|
2597
|
-
}
|
|
2598
2636
|
if (springStatusRef.value != void 0) {
|
|
2599
2637
|
const {
|
|
2600
2638
|
x,
|
|
@@ -2607,6 +2645,41 @@
|
|
|
2607
2645
|
}
|
|
2608
2646
|
return style;
|
|
2609
2647
|
}
|
|
2648
|
+
function loadRefresh() {
|
|
2649
|
+
const deferred = snail_core.defer();
|
|
2650
|
+
if (downRefreshDom.value == void 0) {
|
|
2651
|
+
deferred.reject("not support pullRefresh feature!");
|
|
2652
|
+
} else if (loadingRef.value != void 0) {
|
|
2653
|
+
deferred.reject(`pre load task[${loadingRef.value}] is running!`);
|
|
2654
|
+
} else {
|
|
2655
|
+
resetAfterEnd();
|
|
2656
|
+
loadingRef.value = "refresh";
|
|
2657
|
+
springStatusRef.value.y = downRefreshDom.value.clientHeight;
|
|
2658
|
+
emits("refresh", () => {
|
|
2659
|
+
resetAfterEnd();
|
|
2660
|
+
deferred.resolve();
|
|
2661
|
+
});
|
|
2662
|
+
}
|
|
2663
|
+
return deferred.promise;
|
|
2664
|
+
}
|
|
2665
|
+
function loadMore() {
|
|
2666
|
+
const deferred = snail_core.defer();
|
|
2667
|
+
if (downRefreshDom.value == void 0) {
|
|
2668
|
+
deferred.reject("not support upMore feature!");
|
|
2669
|
+
} else if (loadingRef.value != void 0) {
|
|
2670
|
+
deferred.reject(`pre load task[${loadingRef.value}] is running!`);
|
|
2671
|
+
} else {
|
|
2672
|
+
resetAfterEnd();
|
|
2673
|
+
loadingRef.value = "more";
|
|
2674
|
+
springStatusRef.value.y = -upMoreDom.value.clientHeight;
|
|
2675
|
+
emits("more", () => {
|
|
2676
|
+
resetAfterEnd();
|
|
2677
|
+
deferred.resolve();
|
|
2678
|
+
});
|
|
2679
|
+
return;
|
|
2680
|
+
}
|
|
2681
|
+
return deferred.promise;
|
|
2682
|
+
}
|
|
2610
2683
|
function onSpringStart(isTouch, position) {
|
|
2611
2684
|
if (loadingRef.value != void 0) {
|
|
2612
2685
|
return;
|
|
@@ -2629,9 +2702,9 @@
|
|
|
2629
2702
|
isMovingRef.value = true;
|
|
2630
2703
|
if (springXRef.value == true) {
|
|
2631
2704
|
const distance = position.clientX - startPointerRef.value.clientX;
|
|
2632
|
-
if (distance >= 0 && isLeft(mainBodyDom.value)) {
|
|
2705
|
+
if (distance >= 0 && manager.isLeft(mainBodyDom.value)) {
|
|
2633
2706
|
springStatusRef.value.x = Math.pow(distance, 0.8);
|
|
2634
|
-
} else if (distance <= 0 && isRight(mainBodyDom.value)) {
|
|
2707
|
+
} else if (distance <= 0 && manager.isRight(mainBodyDom.value)) {
|
|
2635
2708
|
springStatusRef.value.x = -Math.pow(-distance, 0.8);
|
|
2636
2709
|
}
|
|
2637
2710
|
}
|
|
@@ -2641,10 +2714,10 @@
|
|
|
2641
2714
|
default:
|
|
2642
2715
|
{
|
|
2643
2716
|
if (distance >= 0) {
|
|
2644
|
-
isTop(mainBodyDom.value) ? springStatusRef.value.y = Math.pow(distance, 0.8) : startPointerRef.value.clientY = position.clientY;
|
|
2717
|
+
manager.isTop(mainBodyDom.value) ? springStatusRef.value.y = Math.pow(distance, 0.8) : startPointerRef.value.clientY = position.clientY;
|
|
2645
2718
|
} else {
|
|
2646
2719
|
console.log("isBottom", mainBodyDom.value.scrollTop + mainBodyDom.value.clientHeight, "---", mainBodyDom.value.scrollHeight);
|
|
2647
|
-
isBottom(mainBodyDom.value) ? springStatusRef.value.y = -Math.pow(-distance, 0.8) : startPointerRef.value.clientY = position.clientY;
|
|
2720
|
+
manager.isBottom(mainBodyDom.value) ? springStatusRef.value.y = -Math.pow(-distance, 0.8) : startPointerRef.value.clientY = position.clientY;
|
|
2648
2721
|
}
|
|
2649
2722
|
break;
|
|
2650
2723
|
}
|
|
@@ -2660,18 +2733,10 @@
|
|
|
2660
2733
|
}
|
|
2661
2734
|
if (loadingRef.value == void 0) {
|
|
2662
2735
|
if (downRefreshDom.value && springStatusRef.value.y > downRefreshDom.value.clientHeight) {
|
|
2663
|
-
|
|
2664
|
-
loadingRef.value = "refresh";
|
|
2665
|
-
springStatusRef.value.y = downRefreshDom.value.clientHeight;
|
|
2666
|
-
emits("refresh", resetAfterEnd);
|
|
2667
|
-
return;
|
|
2736
|
+
return loadRefresh();
|
|
2668
2737
|
}
|
|
2669
2738
|
if (upMoreDom.value && springStatusRef.value.y <= -upMoreDom.value.clientHeight) {
|
|
2670
|
-
|
|
2671
|
-
loadingRef.value = "more";
|
|
2672
|
-
springStatusRef.value.y = -upMoreDom.value.clientHeight;
|
|
2673
|
-
emits("more", resetAfterEnd);
|
|
2674
|
-
return;
|
|
2739
|
+
return loadMore();
|
|
2675
2740
|
}
|
|
2676
2741
|
}
|
|
2677
2742
|
resetAfterEnd();
|
|
@@ -2684,6 +2749,7 @@
|
|
|
2684
2749
|
isStartByTouch = false;
|
|
2685
2750
|
}
|
|
2686
2751
|
vue.onMounted(() => {
|
|
2752
|
+
monitScroll(manager, mainBodyDom.value, props, emits, classStyleRef);
|
|
2687
2753
|
if ("ontouchstart" in window) {
|
|
2688
2754
|
onEvent(mainBodyDom.value, "touchstart", evt => onSpringStart(true, evt.touches[0]));
|
|
2689
2755
|
onEvent(window, "touchmove", evt => onSpringMove(true, evt.touches[0]));
|
|
@@ -2697,7 +2763,9 @@
|
|
|
2697
2763
|
}
|
|
2698
2764
|
});
|
|
2699
2765
|
return (_ctx, _cache) => {
|
|
2700
|
-
return vue.openBlock(), vue.createElementBlock("div",
|
|
2766
|
+
return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps(_ctx.$attrs, {
|
|
2767
|
+
class: "snail-elastic"
|
|
2768
|
+
}), [springYRef.value == true && __props.downRefresh == true ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
|
|
2701
2769
|
key: 0,
|
|
2702
2770
|
class: vue.normalizeClass(["down-refresh", {
|
|
2703
2771
|
"running": loadingRef.value == "refresh"
|
|
@@ -2706,7 +2774,9 @@
|
|
|
2706
2774
|
}, [vue.renderSlot(_ctx.$slots, "down-refresh", {}, () => [_cache[0] || (_cache[0] = vue.createElementVNode("div", {
|
|
2707
2775
|
class: "flex-center default-loading"
|
|
2708
2776
|
}, [vue.createElementVNode("span"), vue.createElementVNode("span"), vue.createElementVNode("span")], -1))])], 2)), [[vue.vShow, loadingRef.value != "more"]]) : vue.createCommentVNode("", true), vue.createElementVNode("div", {
|
|
2709
|
-
class: vue.normalizeClass(["main-body wh-fill",
|
|
2777
|
+
class: vue.normalizeClass(["main-body wh-fill", classStyleRef.value, {
|
|
2778
|
+
"moving": isMovingRef.value
|
|
2779
|
+
}]),
|
|
2710
2780
|
ref: "main-body",
|
|
2711
2781
|
key: "main-body",
|
|
2712
2782
|
style: vue.normalizeStyle(buildMainBodyStyle())
|
|
@@ -2718,7 +2788,7 @@
|
|
|
2718
2788
|
ref: "up-more"
|
|
2719
2789
|
}, [vue.renderSlot(_ctx.$slots, "up-more", {}, () => [_cache[1] || (_cache[1] = vue.createElementVNode("div", {
|
|
2720
2790
|
class: "flex-center default-loading"
|
|
2721
|
-
}, [vue.createElementVNode("span"), vue.createElementVNode("span"), vue.createElementVNode("span")], -1))])], 2)), [[vue.vShow, loadingRef.value != "refresh"]]) : vue.createCommentVNode("", true)]);
|
|
2791
|
+
}, [vue.createElementVNode("span"), vue.createElementVNode("span"), vue.createElementVNode("span")], -1))])], 2)), [[vue.vShow, loadingRef.value != "refresh"]]) : vue.createCommentVNode("", true)], 16);
|
|
2722
2792
|
};
|
|
2723
2793
|
}
|
|
2724
2794
|
});
|
|
@@ -2923,7 +2993,7 @@
|
|
|
2923
2993
|
var _sfc_main$e = vue.defineComponent({
|
|
2924
2994
|
...{
|
|
2925
2995
|
name: "Scroll",
|
|
2926
|
-
inheritAttrs:
|
|
2996
|
+
inheritAttrs: false
|
|
2927
2997
|
},
|
|
2928
2998
|
__name: "scroll",
|
|
2929
2999
|
props: {
|
|
@@ -2939,102 +3009,27 @@
|
|
|
2939
3009
|
const props = __props;
|
|
2940
3010
|
const emits = __emit;
|
|
2941
3011
|
const rootDom = vue.useTemplateRef("scroll-root");
|
|
2942
|
-
const
|
|
2943
|
-
|
|
2944
|
-
} = snail_view.useObserver();
|
|
2945
|
-
const {
|
|
2946
|
-
onInterval
|
|
2947
|
-
} = snail_core.useTimer();
|
|
2948
|
-
var preStatus = void 0;
|
|
3012
|
+
const manager = snail_view.useScroll();
|
|
3013
|
+
const classStyleRef = vue.shallowRef();
|
|
2949
3014
|
__expose({
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
style["overflow"] = "hidden auto";
|
|
2961
|
-
break;
|
|
2962
|
-
case "none":
|
|
2963
|
-
style["overflow"] = "none";
|
|
2964
|
-
break;
|
|
2965
|
-
}
|
|
2966
|
-
return style;
|
|
2967
|
-
}
|
|
2968
|
-
function scroll(left, top) {
|
|
2969
|
-
left == void 0 || (rootDom.value.scrollLeft += left);
|
|
2970
|
-
top == void 0 || (rootDom.value.scrollTop += top);
|
|
2971
|
-
}
|
|
2972
|
-
function scrollTo(left, top) {
|
|
2973
|
-
left == void 0 || (rootDom.value.scrollLeft = left);
|
|
2974
|
-
top == void 0 || (rootDom.value.scrollTop = top);
|
|
2975
|
-
}
|
|
2976
|
-
function refreshScrollInfo() {
|
|
2977
|
-
const status = {
|
|
2978
|
-
xbar: rootDom.value.scrollWidth > rootDom.value.clientWidth,
|
|
2979
|
-
ybar: rootDom.value.scrollHeight > rootDom.value.clientHeight,
|
|
2980
|
-
left: false,
|
|
2981
|
-
right: false,
|
|
2982
|
-
top: false,
|
|
2983
|
-
bottom: false,
|
|
2984
|
-
scrollwidth: rootDom.value.scrollWidth,
|
|
2985
|
-
scrollheight: rootDom.value.scrollHeight
|
|
2986
|
-
};
|
|
2987
|
-
if (status.xbar == true) {
|
|
2988
|
-
status.left = rootDom.value.scrollLeft == 0;
|
|
2989
|
-
status.right = rootDom.value.scrollLeft + rootDom.value.clientWidth == rootDom.value.scrollWidth;
|
|
2990
|
-
}
|
|
2991
|
-
if (status.ybar == true) {
|
|
2992
|
-
status.top = rootDom.value.scrollTop == 0;
|
|
2993
|
-
status.bottom = rootDom.value.scrollTop + rootDom.value.clientHeight == rootDom.value.scrollHeight;
|
|
2994
|
-
}
|
|
2995
|
-
Object.freeze(status);
|
|
2996
|
-
const events = Object.create(null);
|
|
2997
|
-
if (preStatus != void 0) {
|
|
2998
|
-
preStatus.xbar != status.xbar && (events.xbar = [status.xbar]);
|
|
2999
|
-
preStatus.ybar != status.ybar && (events.ybar = [status.ybar]);
|
|
3000
|
-
if (preStatus.xbar == true && status.xbar == true) {
|
|
3001
|
-
status.left && preStatus.left !== status.left && (events.left = []);
|
|
3002
|
-
status.right && preStatus.right !== status.right && (events.right = []);
|
|
3003
|
-
}
|
|
3004
|
-
if (preStatus.ybar == true && status.ybar == true) {
|
|
3005
|
-
status.top && preStatus.top !== status.top && (events.top = []);
|
|
3006
|
-
status.bottom && preStatus.bottom !== status.bottom && (events.bottom = []);
|
|
3007
|
-
}
|
|
3008
|
-
}
|
|
3009
|
-
preStatus = status;
|
|
3010
|
-
preStatus = Object.freeze(status);
|
|
3011
|
-
events.xbar && emits("xbar", ...events.xbar);
|
|
3012
|
-
events.left && emits("left");
|
|
3013
|
-
events.right && emits("right");
|
|
3014
|
-
events.ybar && emits("ybar", ...events.ybar);
|
|
3015
|
-
events.top && emits("top");
|
|
3016
|
-
events.bottom && emits("bottom");
|
|
3017
|
-
if (rootDom.value) {
|
|
3018
|
-
rootDom.value.classList.remove("x-bar", "y-bar");
|
|
3019
|
-
status.xbar && rootDom.value.classList.add("x-bar");
|
|
3020
|
-
status.ybar && rootDom.value.classList.add("y-bar");
|
|
3015
|
+
getStatus() {
|
|
3016
|
+
return manager.getStatus(rootDom.value);
|
|
3017
|
+
},
|
|
3018
|
+
scroll(left, top) {
|
|
3019
|
+
left == void 0 || (rootDom.value.scrollLeft += left);
|
|
3020
|
+
top == void 0 || (rootDom.value.scrollTop += top);
|
|
3021
|
+
},
|
|
3022
|
+
scrollTo(left, top) {
|
|
3023
|
+
left == void 0 || (rootDom.value.scrollLeft = left);
|
|
3024
|
+
top == void 0 || (rootDom.value.scrollTop = top);
|
|
3021
3025
|
}
|
|
3022
|
-
}
|
|
3023
|
-
vue.onMounted(() => {
|
|
3024
|
-
refreshScrollInfo();
|
|
3025
|
-
onSize(rootDom.value, refreshScrollInfo);
|
|
3026
|
-
onInterval(() => {
|
|
3027
|
-
const isChange = preStatus.scrollwidth != rootDom.value.scrollWidth || preStatus.scrollheight != rootDom.value.scrollHeight;
|
|
3028
|
-
isChange && refreshScrollInfo();
|
|
3029
|
-
}, 100);
|
|
3030
3026
|
});
|
|
3027
|
+
vue.onMounted(() => monitScroll(manager, rootDom.value, props, emits, classStyleRef));
|
|
3031
3028
|
return (_ctx, _cache) => {
|
|
3032
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
3033
|
-
class:
|
|
3034
|
-
ref: "scroll-root"
|
|
3035
|
-
|
|
3036
|
-
onScroll: refreshScrollInfo
|
|
3037
|
-
}, [vue.renderSlot(_ctx.$slots, "default")], 38);
|
|
3029
|
+
return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps(_ctx.$attrs, {
|
|
3030
|
+
class: ["snail-scroll", classStyleRef.value],
|
|
3031
|
+
ref: "scroll-root"
|
|
3032
|
+
}), [vue.renderSlot(_ctx.$slots, "default")], 16);
|
|
3038
3033
|
};
|
|
3039
3034
|
}
|
|
3040
3035
|
});
|