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