snail.vue 2.0.18 → 2.0.19

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.js CHANGED
@@ -1,7 +1,7 @@
1
1
  //@ sourceURL=/snail.vue.js
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, onBeforeUnmount, onActivated, vShow, getCurrentScope, onScopeDispose } from 'vue';
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 { link, css, useObserver, useAnimation } from 'snail.view';
4
+ import { css, link, useObserver, useAnimation } from 'snail.view';
5
5
 
6
6
  const _hoisted_1$n = ["title"];
7
7
  var _sfc_main$D = defineComponent({
@@ -25,10 +25,6 @@ var _sfc_main$D = defineComponent({
25
25
  }
26
26
  });
27
27
 
28
- var addLink = href => setTimeout(link.register, 0, href);
29
-
30
- addLink("/styles/snail.vue.vue.css");
31
-
32
28
  function getBuiltinIcon(iconType) {
33
29
  switch (iconType) {
34
30
  case "success":
@@ -68,8 +64,8 @@ function getBuiltinIcon(iconType) {
68
64
  }
69
65
 
70
66
  const _hoisted_1$m = ["viewBox"];
71
- const _hoisted_2$e = ["textContent"];
72
- const _hoisted_3$b = ["d"];
67
+ const _hoisted_2$d = ["textContent"];
68
+ const _hoisted_3$a = ["d"];
73
69
  var _sfc_main$C = defineComponent({
74
70
  __name: "icon",
75
71
  props: {
@@ -125,22 +121,22 @@ var _sfc_main$C = defineComponent({
125
121
  onMouseleave: _cache[1] || (_cache[1] = $event => isMouseEnterRef.value = false)
126
122
  }), [createElementVNode("title", {
127
123
  textContent: toDisplayString(__props.title || "")
128
- }, null, 8, _hoisted_2$e), __props.custom == true ? renderSlot(_ctx.$slots, "default", {
124
+ }, null, 8, _hoisted_2$d), __props.custom == true ? renderSlot(_ctx.$slots, "default", {
129
125
  key: 0
130
126
  }) : (openBlock(true), createElementBlock(Fragment, {
131
127
  key: 1
132
128
  }, renderList(unref(getBuiltinIcon)(__props.type), d => {
133
129
  return openBlock(), createElementBlock("path", {
134
130
  d
135
- }, null, 8, _hoisted_3$b);
131
+ }, null, 8, _hoisted_3$a);
136
132
  }), 256))], 16, _hoisted_1$m);
137
133
  };
138
134
  }
139
135
  });
140
136
 
141
137
  const _hoisted_1$l = ["title", "onClick"];
142
- const _hoisted_2$d = ["type", "checked"];
143
- const _hoisted_3$a = ["textContent"];
138
+ const _hoisted_2$c = ["type", "checked"];
139
+ const _hoisted_3$9 = ["textContent"];
144
140
  const _hoisted_4$7 = ["textContent"];
145
141
  var _sfc_main$B = defineComponent({
146
142
  ...{
@@ -218,7 +214,7 @@ var _sfc_main$B = defineComponent({
218
214
  key: 0,
219
215
  type: unref(type),
220
216
  checked: node.selected
221
- }, null, 8, _hoisted_2$d)) : unref(mode) == "beautiful" ? (openBlock(), createElementBlock("div", {
217
+ }, null, 8, _hoisted_2$c)) : unref(mode) == "beautiful" ? (openBlock(), createElementBlock("div", {
222
218
  key: 1,
223
219
  class: normalizeClass(["status", [node.selected ? "selected" : ""]])
224
220
  }, [node.selected ? (openBlock(), createBlock(_sfc_main$C, {
@@ -230,7 +226,7 @@ var _sfc_main$B = defineComponent({
230
226
  key: 2,
231
227
  class: "item-text",
232
228
  textContent: toDisplayString(node.item.text)
233
- }, null, 8, _hoisted_3$a)) : createCommentVNode("", true), node.item.description ? (openBlock(), createElementBlock("span", {
229
+ }, null, 8, _hoisted_3$9)) : createCommentVNode("", true), node.item.description ? (openBlock(), createElementBlock("span", {
234
230
  key: 3,
235
231
  class: "item-des",
236
232
  textContent: toDisplayString(node.item.description)
@@ -288,6 +284,10 @@ var _sfc_main$A = defineComponent({
288
284
  }
289
285
  });
290
286
 
287
+ var addLink = href => setTimeout(link.register, 0, href);
288
+
289
+ addLink("/styles/snail.vue.vue.css");
290
+
291
291
  const _hoisted_1$k = ["textContent"];
292
292
  var _sfc_main$z = defineComponent({
293
293
  ...{
@@ -342,12 +342,12 @@ var _sfc_main$z = defineComponent({
342
342
  });
343
343
 
344
344
  const _hoisted_1$j = ["textContent"];
345
- const _hoisted_2$c = {
345
+ const _hoisted_2$b = {
346
346
  key: 0,
347
347
  class: "required",
348
348
  textContent: "*"
349
349
  };
350
- const _hoisted_3$9 = {
350
+ const _hoisted_3$8 = {
351
351
  class: "input-body"
352
352
  };
353
353
  const _hoisted_4$6 = ["type", "value", "readonly", "placeholder", "title"];
@@ -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$j), __props.readonly != true && __props.required == true ? (openBlock(), createElementBlock("span", _hoisted_2$c)) : createCommentVNode("", true)], 4)) : createCommentVNode("", true), createElementVNode("div", _hoisted_3$9, [createElementVNode("input", {
407
+ }, null, 8, _hoisted_1$j), __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,
@@ -631,8 +631,8 @@ const _hoisted_1$i = {
631
631
  key: 0,
632
632
  class: "number-prefix"
633
633
  };
634
- const _hoisted_2$b = ["textContent"];
635
- const _hoisted_3$8 = ["inputmode", "placeholder", "title"];
634
+ const _hoisted_2$a = ["textContent"];
635
+ const _hoisted_3$7 = ["inputmode", "placeholder", "title"];
636
636
  const _hoisted_4$5 = {
637
637
  key: 1,
638
638
  class: "number-suffix"
@@ -790,7 +790,7 @@ var _sfc_main$x = defineComponent({
790
790
  }, [unref(hasPrefix) ? (openBlock(), createElementBlock("div", _hoisted_1$i, [createElementVNode("span", {
791
791
  class: "ellipsis",
792
792
  textContent: toDisplayString(unref(prefix))
793
- }, null, 8, _hoisted_2$b)])) : createCommentVNode("", true), createElementVNode("div", {
793
+ }, null, 8, _hoisted_2$a)])) : createCommentVNode("", true), createElementVNode("div", {
794
794
  class: normalizeClass(["input-panel", unref(controls)])
795
795
  }, [withDirectives(createElementVNode("input", {
796
796
  type: "text",
@@ -802,7 +802,7 @@ var _sfc_main$x = defineComponent({
802
802
  onFocus: _cache[1] || (_cache[1] = $event => isRef(needBackSection) ? needBackSection.value = true : needBackSection = true),
803
803
  onPaste: _cache[2] || (_cache[2] = $event => isRef(needBackSection) ? needBackSection.value = false : needBackSection = false),
804
804
  onBlur: _cache[3] || (_cache[3] = $event => formatOnEnd(true))
805
- }, null, 40, _hoisted_3$8), [[vModelText, displayValueRef.value]]), unref(controls) == "default" ? (openBlock(), createElementBlock(Fragment, {
805
+ }, null, 40, _hoisted_3$7), [[vModelText, displayValueRef.value]]), unref(controls) == "default" ? (openBlock(), createElementBlock(Fragment, {
806
806
  key: 0
807
807
  }, [createElementVNode("div", {
808
808
  class: "controls default subtract",
@@ -1130,7 +1130,7 @@ function deducePosition(strategy, targetStart, targetEnd, contentSize, clientSiz
1130
1130
  const _hoisted_1$g = {
1131
1131
  class: "snail-confirm flex-column"
1132
1132
  };
1133
- const _hoisted_2$a = ["innerHTML"];
1133
+ const _hoisted_2$9 = ["innerHTML"];
1134
1134
  var _sfc_main$v = defineComponent({
1135
1135
  ...{
1136
1136
  name: "ConfirmContainer",
@@ -1166,7 +1166,7 @@ var _sfc_main$v = defineComponent({
1166
1166
  }, null, 8, ["title"]), createElementVNode("div", {
1167
1167
  class: "confirm-body",
1168
1168
  innerHTML: __props.message || "请确认?"
1169
- }, null, 8, _hoisted_2$a), createVNode(_sfc_main$A, {
1169
+ }, null, 8, _hoisted_2$9), createVNode(_sfc_main$A, {
1170
1170
  align: "right",
1171
1171
  "cancel-name": __props.cancelName,
1172
1172
  "cancel-disabled": __props.cancelDisabled,
@@ -1646,7 +1646,7 @@ const _hoisted_1$f = {
1646
1646
  key: 1,
1647
1647
  class: "icon"
1648
1648
  };
1649
- const _hoisted_2$9 = ["innerHTML"];
1649
+ const _hoisted_2$8 = ["innerHTML"];
1650
1650
  var _sfc_main$o = defineComponent({
1651
1651
  ...{
1652
1652
  name: "ToastContainer",
@@ -1702,7 +1702,7 @@ var _sfc_main$o = defineComponent({
1702
1702
  }, null, 8, ["type"])])) : createCommentVNode("", true), createElementVNode("div", {
1703
1703
  class: "message",
1704
1704
  innerHTML: unref(props).message
1705
- }, null, 8, _hoisted_2$9)], 38);
1705
+ }, null, 8, _hoisted_2$8)], 38);
1706
1706
  };
1707
1707
  }
1708
1708
  });
@@ -1948,8 +1948,8 @@ function getNoDataBase64Image() {
1948
1948
  const _hoisted_1$e = {
1949
1949
  class: "snail-empty"
1950
1950
  };
1951
- const _hoisted_2$8 = ["src"];
1952
- const _hoisted_3$7 = ["textContent"];
1951
+ const _hoisted_2$7 = ["src"];
1952
+ const _hoisted_3$6 = ["textContent"];
1953
1953
  var _sfc_main$n = defineComponent({
1954
1954
  ...{
1955
1955
  name: "Empty",
@@ -1965,17 +1965,17 @@ var _sfc_main$n = defineComponent({
1965
1965
  return (_ctx, _cache) => {
1966
1966
  return openBlock(), createElementBlock("div", _hoisted_1$e, [createElementVNode("img", {
1967
1967
  src: __props.imageUrl || unref(defaultImageBase64)
1968
- }, null, 8, _hoisted_2$8), renderSlot(_ctx.$slots, "default", {}, () => [createElementVNode("div", {
1968
+ }, null, 8, _hoisted_2$7), renderSlot(_ctx.$slots, "default", {}, () => [createElementVNode("div", {
1969
1969
  class: "message",
1970
1970
  textContent: toDisplayString(__props.message || "无数据")
1971
- }, null, 8, _hoisted_3$7)])]);
1971
+ }, null, 8, _hoisted_3$6)])]);
1972
1972
  };
1973
1973
  }
1974
1974
  });
1975
1975
 
1976
1976
  const _hoisted_1$d = ["title"];
1977
- const _hoisted_2$7 = ["textContent"];
1978
- const _hoisted_3$6 = {
1977
+ const _hoisted_2$6 = ["textContent"];
1978
+ const _hoisted_3$5 = {
1979
1979
  key: 1,
1980
1980
  class: "select-status"
1981
1981
  };
@@ -2024,10 +2024,10 @@ var _sfc_main$m = defineComponent({
2024
2024
  }, [createElementVNode("div", {
2025
2025
  class: "item-text ellipsis",
2026
2026
  textContent: toDisplayString(__props.item.text)
2027
- }, null, 8, _hoisted_2$7), __props.item.type == "group" ? (openBlock(), createBlock(_sfc_main$C, {
2027
+ }, null, 8, _hoisted_2$6), __props.item.type == "group" ? (openBlock(), createBlock(_sfc_main$C, {
2028
2028
  key: 0,
2029
2029
  type: "arrow"
2030
- })) : __props.multiple == true ? (openBlock(), createElementBlock("div", _hoisted_3$6, [createVNode(_sfc_main$C, {
2030
+ })) : __props.multiple == true ? (openBlock(), createElementBlock("div", _hoisted_3$5, [createVNode(_sfc_main$C, {
2031
2031
  type: "success",
2032
2032
  button: "",
2033
2033
  size: 12,
@@ -2252,8 +2252,8 @@ const _hoisted_1$c = {
2252
2252
  key: 0,
2253
2253
  class: "select-result"
2254
2254
  };
2255
- const _hoisted_2$6 = ["title", "textContent"];
2256
- const _hoisted_3$5 = ["textContent"];
2255
+ const _hoisted_2$5 = ["title", "textContent"];
2256
+ const _hoisted_3$4 = ["textContent"];
2257
2257
  const _hoisted_4$4 = {
2258
2258
  key: 1,
2259
2259
  class: "placeholder"
@@ -2397,11 +2397,11 @@ var _sfc_main$k = defineComponent({
2397
2397
  class: "select-text ellipsis",
2398
2398
  title: selectedTextRef.value,
2399
2399
  textContent: toDisplayString(selectedTextRef.value)
2400
- }, null, 8, _hoisted_2$6)])])) : (openBlock(), createElementBlock("div", {
2400
+ }, null, 8, _hoisted_2$5)])])) : (openBlock(), createElementBlock("div", {
2401
2401
  key: 1,
2402
2402
  class: "placeholder",
2403
2403
  textContent: toDisplayString(__props.readonly ? "" : __props.placeholder || "请选择")
2404
- }, null, 8, _hoisted_3$5)), __props.readonly != true ? (openBlock(), createBlock(_sfc_main$C, {
2404
+ }, null, 8, _hoisted_3$4)), __props.readonly != true ? (openBlock(), createBlock(_sfc_main$C, {
2405
2405
  key: 2,
2406
2406
  type: "arrow",
2407
2407
  button: "",
@@ -2527,85 +2527,72 @@ var _sfc_main$i = defineComponent({
2527
2527
  }
2528
2528
  });
2529
2529
 
2530
+ function isLeft(root) {
2531
+ return root.scrollLeft == 0;
2532
+ }
2530
2533
  function isRight(root) {
2531
- return root.scrollLeft + root.clientWidth >= root.scrollWidth;
2534
+ return Math.abs(root.scrollWidth - root.clientWidth - root.scrollLeft) < 1;
2535
+ }
2536
+ function isTop(root) {
2537
+ return root.scrollTop == 0;
2532
2538
  }
2533
2539
  function isBottom(root) {
2534
- return root.scrollTop + root.clientHeight >= root.scrollHeight;
2540
+ return Math.abs(root.scrollHeight - root.clientHeight - root.scrollTop) < 1;
2535
2541
  }
2536
2542
 
2537
2543
  const _hoisted_1$a = {
2538
- key: 0,
2539
- class: "down-refresh"
2540
- };
2541
- const _hoisted_2$5 = {
2542
- class: "main-body"
2543
- };
2544
- const _hoisted_3$4 = {
2545
- key: 1,
2546
- class: "up-more"
2544
+ class: "snail-elastic"
2547
2545
  };
2548
2546
  var _sfc_main$h = defineComponent({
2549
2547
  __name: "elastic",
2550
2548
  props: {
2551
2549
  scroll: {},
2550
+ barSize: {},
2552
2551
  spring: {},
2553
2552
  downRefresh: {
2554
2553
  type: Boolean
2555
2554
  },
2556
2555
  upMore: {
2557
2556
  type: Boolean
2558
- },
2559
- barSize: {}
2557
+ }
2560
2558
  },
2561
- setup(__props) {
2559
+ emits: ["refresh", "more"],
2560
+ setup(__props, _ref) {
2561
+ let {
2562
+ emit: __emit
2563
+ } = _ref;
2562
2564
  const props = __props;
2565
+ const emits = __emit;
2563
2566
  const {
2564
- onEvent
2567
+ onEvent,
2568
+ onSize
2565
2569
  } = useObserver();
2566
- const rootDom = useTemplateRef("root-dom");
2567
- const scrollStyleRef = computed(buildScrollStyle);
2568
- ref(void 0);
2569
- const springStyleRef = computed(buildSpringStyle);
2570
+ const {
2571
+ watcher
2572
+ } = useReactive();
2573
+ const downRefreshDom = useTemplateRef("down-refresh");
2574
+ const mainBodyDom = useTemplateRef("main-body");
2575
+ const upMoreDom = useTemplateRef("up-more");
2576
+ let isStartByTouch = false;
2577
+ const startPointerRef = ref(void 0);
2578
+ const isMovingRef = shallowRef(false);
2579
+ const springStatusRef = ref(Object.create(null));
2570
2580
  const springXRef = computed(() => props.spring == "x" || props.spring == "both");
2571
2581
  const springYRef = computed(() => props.spring == "y" || props.spring == "both");
2572
- const downRefreshRef = computed(() => springYRef.value == true && props.downRefresh == true);
2573
- const upMoreRef = computed(() => springYRef.value == true && props.upMore == true);
2574
- const isMovingRef = ref(false);
2575
- const springStatusRef = ref(void 0);
2576
- const startPointerRef = ref(void 0);
2577
- let isStartByTouch = false;
2578
- function buildScrollStyle() {
2579
- const vars = Object.create(null);
2582
+ const loadingRef = shallowRef();
2583
+ function buildMainBodyStyle() {
2584
+ const style = Object.create(null);
2580
2585
  switch (props.scroll) {
2581
2586
  case "x":
2582
- vars["--overflow"] = "auto hidden";
2587
+ style["overflow"] = "auto hidden";
2583
2588
  break;
2584
2589
  case "y":
2585
- vars["--overflow"] = "hidden auto";
2586
- break;
2587
- case "both":
2588
- vars["--overflow"] = "auto";
2589
- break;
2590
- }
2591
- switch (props.barSize) {
2592
- case "normal":
2593
- vars["--bar-size"] = "10px";
2594
- break;
2595
- case "small":
2596
- vars["--bar-size"] = "6px";
2597
- break;
2598
- case "mini":
2599
- vars["--bar-size"] = "4px";
2590
+ style["overflow"] = "hidden auto";
2600
2591
  break;
2601
2592
  case "none":
2602
- vars["--bar-size"] = "0";
2593
+ style["overflow"] = "none";
2603
2594
  break;
2604
2595
  }
2605
- return vars;
2606
- }
2607
- function buildSpringStyle() {
2608
- const style = Object.create(null);
2609
2596
  if (springStatusRef.value != void 0) {
2610
2597
  const {
2611
2598
  x,
@@ -2614,18 +2601,19 @@ var _sfc_main$h = defineComponent({
2614
2601
  const transforms = [];
2615
2602
  x != void 0 && transforms.push(`translateX(${x}px)`);
2616
2603
  y != void 0 && transforms.push(`translateY(${y}px)`);
2617
- transforms.length && (style["--spring-transform"] = transforms.join(" "));
2604
+ transforms.length && (style["transform"] = transforms.join(" "));
2618
2605
  }
2619
2606
  return style;
2620
2607
  }
2621
2608
  function onSpringStart(isTouch, position) {
2622
- if (isTouch != true && isStartByTouch == true) {
2609
+ if (loadingRef.value != void 0) {
2610
+ return;
2611
+ }
2612
+ if (isStartByTouch == true && isTouch != true) {
2623
2613
  return;
2624
2614
  }
2625
2615
  isTouch && (isStartByTouch = true);
2626
2616
  if (springXRef.value == true || springYRef.value == true) {
2627
- isMovingRef.value = true;
2628
- springStatusRef.value = Object.create(null);
2629
2617
  startPointerRef.value = {
2630
2618
  clientX: position.clientX,
2631
2619
  clientY: position.clientY
@@ -2633,60 +2621,102 @@ var _sfc_main$h = defineComponent({
2633
2621
  }
2634
2622
  }
2635
2623
  function onSpringMove(isTouch, position) {
2636
- if (startPointerRef.value == void 0 || isTouch != true && isStartByTouch == true) {
2624
+ if (startPointerRef.value == void 0 || isStartByTouch == true && isTouch != true) {
2637
2625
  return;
2638
2626
  }
2627
+ isMovingRef.value = true;
2639
2628
  if (springXRef.value == true) {
2640
2629
  const distance = position.clientX - startPointerRef.value.clientX;
2641
- if (distance >= 0 && rootDom.value.scrollLeft == 0) {
2630
+ if (distance >= 0 && isLeft(mainBodyDom.value)) {
2642
2631
  springStatusRef.value.x = Math.pow(distance, 0.8);
2643
- } else if (distance <= 0 && isRight(rootDom.value)) {
2632
+ } else if (distance <= 0 && isRight(mainBodyDom.value)) {
2644
2633
  springStatusRef.value.x = -Math.pow(-distance, 0.8);
2645
2634
  }
2646
2635
  }
2647
2636
  if (springYRef.value == true) {
2648
2637
  const distance = position.clientY - startPointerRef.value.clientY;
2649
- if (distance >= 0) {
2650
- if (rootDom.value.scrollTop == 0) {
2651
- springStatusRef.value.y = Math.pow(distance, 0.8);
2652
- } else {
2653
- startPointerRef.value.clientY = position.clientY;
2654
- }
2655
- } else if (distance <= 0 && isBottom(rootDom.value) == true) {
2656
- springStatusRef.value.y = -Math.pow(-distance, 0.8);
2638
+ switch (loadingRef.value) {
2639
+ default:
2640
+ {
2641
+ if (distance >= 0) {
2642
+ isTop(mainBodyDom.value) ? springStatusRef.value.y = Math.pow(distance, 0.8) : startPointerRef.value.clientY = position.clientY;
2643
+ } else {
2644
+ 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;
2646
+ }
2647
+ break;
2648
+ }
2657
2649
  }
2658
2650
  }
2659
2651
  }
2660
2652
  function onSpringEnd(isTouch, isCancel) {
2661
- if (startPointerRef.value != void 0) {
2662
- springStatusRef.value = Object.create(null);
2663
- isMovingRef.value = false;
2664
- startPointerRef.value = void 0;
2665
- isStartByTouch = false;
2653
+ if (startPointerRef.value == void 0 || isStartByTouch == true && isTouch != true) {
2654
+ return;
2655
+ }
2656
+ if (isMovingRef.value != true) {
2657
+ return;
2666
2658
  }
2659
+ if (loadingRef.value == void 0) {
2660
+ if (downRefreshDom.value && springStatusRef.value.y > downRefreshDom.value.clientHeight) {
2661
+ resetAfterEnd();
2662
+ loadingRef.value = "refresh";
2663
+ springStatusRef.value.y = downRefreshDom.value.clientHeight;
2664
+ emits("refresh", resetAfterEnd);
2665
+ return;
2666
+ }
2667
+ if (upMoreDom.value && springStatusRef.value.y <= -upMoreDom.value.clientHeight) {
2668
+ resetAfterEnd();
2669
+ loadingRef.value = "more";
2670
+ springStatusRef.value.y = -upMoreDom.value.clientHeight;
2671
+ emits("more", resetAfterEnd);
2672
+ return;
2673
+ }
2674
+ }
2675
+ resetAfterEnd();
2676
+ }
2677
+ function resetAfterEnd() {
2678
+ loadingRef.value = void 0;
2679
+ springStatusRef.value = Object.create(null);
2680
+ isMovingRef.value = false;
2681
+ startPointerRef.value = void 0;
2682
+ isStartByTouch = false;
2667
2683
  }
2668
2684
  onMounted(() => {
2669
2685
  if ("ontouchstart" in window) {
2670
- onEvent(rootDom.value, "touchstart", evt => onSpringStart(true, evt.touches[0]));
2686
+ onEvent(mainBodyDom.value, "touchstart", evt => onSpringStart(true, evt.touches[0]));
2671
2687
  onEvent(window, "touchmove", evt => onSpringMove(true, evt.touches[0]));
2672
- onEvent(window, "touchend", () => onSpringEnd());
2673
- onEvent(window, "touchcancel", () => onSpringEnd());
2688
+ onEvent(window, "touchend", () => onSpringEnd(true));
2689
+ onEvent(window, "touchcancel", () => onSpringEnd(true));
2674
2690
  }
2675
2691
  if ("onmousedown" in window) {
2676
- onEvent(rootDom.value, "mousedown", evt => onSpringStart(false, evt));
2692
+ onEvent(mainBodyDom.value, "mousedown", evt => onSpringStart(false, evt));
2677
2693
  onEvent(window, "mousemove", evt => onSpringMove(false, evt));
2678
- onEvent(window, "mouseup", () => onSpringEnd());
2694
+ onEvent(window, "mouseup", () => onSpringEnd(false));
2679
2695
  }
2680
2696
  });
2681
2697
  return (_ctx, _cache) => {
2682
- return openBlock(), createElementBlock("div", {
2683
- class: normalizeClass(["snail-elastic", {
2684
- "spring": springXRef.value || springYRef.value,
2685
- "moving": isMovingRef.value
2698
+ return openBlock(), createElementBlock("div", _hoisted_1$a, [springYRef.value == true && __props.downRefresh == true ? withDirectives((openBlock(), createElementBlock("div", {
2699
+ key: 0,
2700
+ class: normalizeClass(["down-refresh", {
2701
+ "running": loadingRef.value == "refresh"
2702
+ }]),
2703
+ ref: "down-refresh"
2704
+ }, [renderSlot(_ctx.$slots, "down-refresh", {}, () => [_cache[0] || (_cache[0] = createElementVNode("div", {
2705
+ class: "flex-center default-loading"
2706
+ }, [createElementVNode("span"), createElementVNode("span"), createElementVNode("span")], -1))])], 2)), [[vShow, loadingRef.value != "more"]]) : createCommentVNode("", true), createElementVNode("div", {
2707
+ class: normalizeClass(["main-body wh-fill", [__props.barSize ? `${__props.barSize}-scrollbar` : "", isMovingRef.value ? "moving" : ""]]),
2708
+ ref: "main-body",
2709
+ key: "main-body",
2710
+ style: normalizeStyle(buildMainBodyStyle())
2711
+ }, [renderSlot(_ctx.$slots, "default")], 6), springYRef.value == true && __props.upMore == true ? withDirectives((openBlock(), createElementBlock("div", {
2712
+ key: 1,
2713
+ class: normalizeClass(["up-more", {
2714
+ "running": loadingRef.value == "more"
2686
2715
  }]),
2687
- style: normalizeStyle([scrollStyleRef.value, springStyleRef.value]),
2688
- ref: "root-dom"
2689
- }, [downRefreshRef.value ? (openBlock(), createElementBlock("div", _hoisted_1$a, [renderSlot(_ctx.$slots, "down-refresh", {}, () => [_cache[0] || (_cache[0] = createTextVNode(" 默认实现[下拉刷新] ", -1))])])) : createCommentVNode("", true), createElementVNode("div", _hoisted_2$5, [renderSlot(_ctx.$slots, "default")]), upMoreRef.value ? (openBlock(), createElementBlock("div", _hoisted_3$4, [renderSlot(_ctx.$slots, "up-more", {}, () => [_cache[1] || (_cache[1] = createTextVNode(" 默认实现[上拉加载更多] ", -1))])])) : createCommentVNode("", true)], 6);
2716
+ ref: "up-more"
2717
+ }, [renderSlot(_ctx.$slots, "up-more", {}, () => [_cache[1] || (_cache[1] = createElementVNode("div", {
2718
+ class: "flex-center default-loading"
2719
+ }, [createElementVNode("span"), createElementVNode("span"), createElementVNode("span")], -1))])], 2)), [[vShow, loadingRef.value != "refresh"]]) : createCommentVNode("", true)]);
2690
2720
  };
2691
2721
  }
2692
2722
  });
@@ -2701,9 +2731,9 @@ var _sfc_main$g = defineComponent({
2701
2731
  direction: {},
2702
2732
  wrap: {},
2703
2733
  gap: {},
2704
- justifyContent: {},
2705
- alignItems: {},
2706
- alignContent: {},
2734
+ main: {},
2735
+ cross: {},
2736
+ content: {},
2707
2737
  repairItem: {
2708
2738
  type: Boolean
2709
2739
  },
@@ -2721,35 +2751,21 @@ var _sfc_main$g = defineComponent({
2721
2751
  watcher
2722
2752
  } = useReactive();
2723
2753
  const classRef = computed(buildClass);
2724
- const styleRef = computed(buildStyle);
2725
2754
  const repairItemsRef = shallowRef(0);
2726
2755
  function buildClass() {
2727
2756
  const items = [];
2728
- items.push(props.direction || "row");
2757
+ let direction = props.direction;
2758
+ props.repairItem == true && isStringNotEmpty(direction) == false && (direction = "row");
2759
+ direction && items.push(direction);
2729
2760
  props.wrap && items.push(props.wrap);
2730
- props.justifyContent && items.push(props.justifyContent);
2761
+ isStringNotEmpty(props.main) && items.push(`justify-${props.main}`);
2762
+ isStringNotEmpty(props.cross) && items.push(`items-${props.cross}`);
2763
+ isStringNotEmpty(props.content) && items.push(`content-${props.content}`);
2731
2764
  return items;
2732
2765
  }
2733
- function buildStyle() {
2734
- const styleVar = Object.create(null);
2735
- isStringNotEmpty(props.gap) && (styleVar["--gap"] = props.gap);
2736
- const tmpFunc = value => {
2737
- switch (value) {
2738
- case "start":
2739
- return "flex-start";
2740
- case "end":
2741
- return "flex-end";
2742
- default:
2743
- return value;
2744
- }
2745
- };
2746
- isStringNotEmpty(props.alignItems) && (styleVar["--align-items"] = tmpFunc(props.alignItems));
2747
- isStringNotEmpty(props.alignContent) && (styleVar["--align-content"] = tmpFunc(props.alignContent));
2748
- return styleVar;
2749
- }
2750
2766
  function repairSpace() {
2751
2767
  repairItemsRef.value = 0;
2752
- const needRepair = props.repairItem == true && props.justifyContent && props.justifyContent.startsWith("space-") && props.itemCount > 0 && rootDom.value.children.length > 0;
2768
+ const needRepair = props.repairItem == true && (props.main == "between" || props.main == "around" || props.main == "evenly") && props.itemCount > 0 && rootDom.value.children.length > 0;
2753
2769
  if (needRepair == true) {
2754
2770
  let containerSize, itemSize, itemGap;
2755
2771
  const containerStyle = getComputedStyle(rootDom.value);
@@ -2771,8 +2787,7 @@ var _sfc_main$g = defineComponent({
2771
2787
  break;
2772
2788
  }
2773
2789
  }
2774
- let itemCountPer;
2775
- itemCountPer = Math.floor((containerSize + itemGap) / (itemSize + itemGap));
2790
+ let itemCountPer = Math.floor((containerSize + itemGap) / (itemSize + itemGap));
2776
2791
  if (itemCountPer > 1) {
2777
2792
  const mode = props.itemCount % itemCountPer;
2778
2793
  mode > 0 && (repairItemsRef.value = itemCountPer - mode);
@@ -2788,7 +2803,9 @@ var _sfc_main$g = defineComponent({
2788
2803
  return (_ctx, _cache) => {
2789
2804
  return openBlock(), createElementBlock("div", mergeProps(_ctx.$attrs, {
2790
2805
  class: ["snail-flex", classRef.value],
2791
- style: styleRef.value,
2806
+ style: unref(isStringNotEmpty)(__props.gap) ? {
2807
+ "--gap": __props.gap
2808
+ } : void 0,
2792
2809
  ref: "root-flex"
2793
2810
  }), [renderSlot(_ctx.$slots, "default"), (openBlock(true), createElementBlock(Fragment, null, renderList(repairItemsRef.value, _ => {
2794
2811
  return openBlock(), createBlock(resolveDynamicComponent(unref(correctString)(props.itemTag, "div", true)), {
@@ -2908,12 +2925,7 @@ var _sfc_main$e = defineComponent({
2908
2925
  },
2909
2926
  __name: "scroll",
2910
2927
  props: {
2911
- scrollX: {
2912
- type: Boolean
2913
- },
2914
- scrollY: {
2915
- type: Boolean
2916
- },
2928
+ scroll: {},
2917
2929
  barSize: {}
2918
2930
  },
2919
2931
  emits: ["xbar", "left", "right", "ybar", "top", "bottom"],
@@ -2931,32 +2943,26 @@ var _sfc_main$e = defineComponent({
2931
2943
  const {
2932
2944
  onInterval
2933
2945
  } = useTimer();
2934
- const styleRef = computed(() => {
2935
- const style = Object.create(null);
2936
- (props.scrollX || props.scrollY) && (style["--scroll-overflow"] = `${props.scrollX == true ? "auto" : "hidden"} ${props.scrollY == true ? "auto" : "hidden"}`);
2937
- if (props.barSize) {
2938
- switch (props.barSize) {
2939
- case "normal":
2940
- style["--scroll-bar-size"] = "10px";
2941
- break;
2942
- case "small":
2943
- style["--scroll-bar-size"] = "6px";
2944
- break;
2945
- case "mini":
2946
- style["--scroll-bar-size"] = "4px";
2947
- break;
2948
- case "none":
2949
- style["--scroll-bar-size"] = "0";
2950
- break;
2951
- }
2952
- }
2953
- return style;
2954
- });
2955
2946
  var preStatus = void 0;
2956
2947
  __expose({
2957
2948
  scroll,
2958
2949
  scrollTo
2959
2950
  });
2951
+ function buildStyle() {
2952
+ const style = Object.create(null);
2953
+ switch (props.scroll) {
2954
+ case "x":
2955
+ style["overflow"] = "auto hidden";
2956
+ break;
2957
+ case "y":
2958
+ style["overflow"] = "hidden auto";
2959
+ break;
2960
+ case "none":
2961
+ style["overflow"] = "none";
2962
+ break;
2963
+ }
2964
+ return style;
2965
+ }
2960
2966
  function scroll(left, top) {
2961
2967
  left == void 0 || (rootDom.value.scrollLeft += left);
2962
2968
  top == void 0 || (rootDom.value.scrollTop += top);
@@ -3022,11 +3028,11 @@ var _sfc_main$e = defineComponent({
3022
3028
  });
3023
3029
  return (_ctx, _cache) => {
3024
3030
  return openBlock(), createElementBlock("div", {
3025
- class: "snail-scroll",
3031
+ class: normalizeClass(["snail-scroll", __props.barSize ? `${__props.barSize}-scrollbar` : ""]),
3026
3032
  ref: "scroll-root",
3027
- style: normalizeStyle(styleRef.value),
3033
+ style: normalizeStyle(buildStyle()),
3028
3034
  onScroll: refreshScrollInfo
3029
- }, [renderSlot(_ctx.$slots, "default")], 36);
3035
+ }, [renderSlot(_ctx.$slots, "default")], 38);
3030
3036
  };
3031
3037
  }
3032
3038
  });
@@ -3227,12 +3233,7 @@ var _sfc_main$b = defineComponent({
3227
3233
  },
3228
3234
  __name: "table",
3229
3235
  props: {
3230
- scrollX: {
3231
- type: Boolean
3232
- },
3233
- scrollY: {
3234
- type: Boolean
3235
- },
3236
+ scroll: {},
3236
3237
  barSize: {},
3237
3238
  border: {
3238
3239
  type: Boolean
@@ -3249,8 +3250,8 @@ var _sfc_main$b = defineComponent({
3249
3250
  class: normalizeClass(["snail-table", {
3250
3251
  "start-border": __props.border == true
3251
3252
  }]),
3252
- "scroll-x": __props.scrollX,
3253
- "scroll-y": __props.scrollY
3253
+ scroll: __props.scroll,
3254
+ "bar-size": __props.barSize
3254
3255
  }, {
3255
3256
  default: withCtx(() => [createElementVNode("div", {
3256
3257
  class: "table-header",
@@ -3260,7 +3261,7 @@ var _sfc_main$b = defineComponent({
3260
3261
  style: normalizeStyle(fStyleRef.value)
3261
3262
  }, [renderSlot(_ctx.$slots, "footer")], 4)]),
3262
3263
  _: 3
3263
- }, 8, ["scroll-x", "scroll-y", "class"]);
3264
+ }, 8, ["scroll", "bar-size", "class"]);
3264
3265
  };
3265
3266
  }
3266
3267
  });
@@ -3531,7 +3532,7 @@ var _sfc_main$7 = defineComponent({
3531
3532
  }, __props.search, {
3532
3533
  onSearch
3533
3534
  }), null, 16)) : createCommentVNode("", true), createVNode(_sfc_main$e, {
3534
- "scroll-y": true
3535
+ scroll: "y"
3535
3536
  }, {
3536
3537
  default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.nodes || [], node => {
3537
3538
  return openBlock(), createBlock(_sfc_main$8, {
@@ -3587,8 +3588,7 @@ var _sfc_main$6 = defineComponent({
3587
3588
  }), null, 16)) : createCommentVNode("", true), createVNode(_sfc_main$e, mergeProps({
3588
3589
  class: "wrapper-body"
3589
3590
  }, __props.content || {
3590
- scrollX: false,
3591
- scrollY: false
3591
+ scroll: "none"
3592
3592
  }), {
3593
3593
  default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
3594
3594
  _: 3