@nutui/nutui 3.1.19-beta.0 → 3.1.19-beta.1

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.
Files changed (110) hide show
  1. package/dist/nutui.d.ts +38 -37
  2. package/dist/nutui.es.js +13439 -12616
  3. package/dist/nutui.umd.js +13431 -12695
  4. package/dist/packages/_es/ActionSheet.js +12 -18
  5. package/dist/packages/_es/Address.js +78 -69
  6. package/dist/packages/_es/Audio.js +12 -12
  7. package/dist/packages/_es/AudioOperate.js +1 -1
  8. package/dist/packages/_es/Avatar.js +3 -3
  9. package/dist/packages/_es/BackTop.js +68 -110
  10. package/dist/packages/_es/Badge.js +3 -3
  11. package/dist/packages/_es/Barrage.js +62 -55
  12. package/dist/packages/_es/Button.js +2 -2
  13. package/dist/packages/_es/Calendar.js +28 -23
  14. package/dist/packages/_es/CalendarItem.js +3 -3
  15. package/dist/packages/_es/Card.js +6 -5
  16. package/dist/packages/_es/Cascader.js +7 -7
  17. package/dist/packages/_es/Cell.js +4 -11
  18. package/dist/packages/_es/CellGroup.js +1 -1
  19. package/dist/packages/_es/Checkbox.js +1 -1
  20. package/dist/packages/_es/CheckboxGroup.js +1 -1
  21. package/dist/packages/_es/CircleProgress.js +149 -40
  22. package/dist/packages/_es/Col.js +1 -1
  23. package/dist/packages/_es/Collapse.js +34 -8
  24. package/dist/packages/_es/CollapseItem.js +90 -59
  25. package/dist/packages/_es/CountDown.js +5 -5
  26. package/dist/packages/_es/CountUp.js +43 -51
  27. package/dist/packages/_es/DatePicker.js +21 -20
  28. package/dist/packages/_es/Dialog.js +8 -86
  29. package/dist/packages/_es/Divider.js +4 -4
  30. package/dist/packages/_es/Drag.js +92 -54
  31. package/dist/packages/_es/Elevator.js +74 -49
  32. package/dist/packages/_es/Empty.js +3 -3
  33. package/dist/packages/_es/FixedNav.js +5 -5
  34. package/dist/packages/_es/Form.js +4 -4
  35. package/dist/packages/_es/FormItem.js +1 -1
  36. package/dist/packages/_es/Grid.js +1 -1
  37. package/dist/packages/_es/GridItem.js +8 -26
  38. package/dist/packages/_es/Icon.js +1 -1
  39. package/dist/packages/_es/ImagePreview.js +15 -84
  40. package/dist/packages/_es/Indicator.js +3 -3
  41. package/dist/packages/_es/InfiniteLoading.js +93 -107
  42. package/dist/packages/_es/Input.js +8 -8
  43. package/dist/packages/_es/InputNumber.js +23 -16
  44. package/dist/packages/_es/Layout.js +1 -1
  45. package/dist/packages/_es/List.js +41 -34
  46. package/dist/packages/_es/Menu.js +15 -12
  47. package/dist/packages/_es/MenuItem.js +9 -9
  48. package/dist/packages/_es/Navbar.js +3 -4
  49. package/dist/packages/_es/NoticeBar.js +47 -40
  50. package/dist/packages/_es/Notify.js +29 -168
  51. package/dist/packages/_es/NumberKeyboard.js +5 -10
  52. package/dist/packages/_es/OldPicker.js +122 -120
  53. package/dist/packages/_es/OverLay.js +5 -25
  54. package/dist/packages/_es/Pagination.js +7 -7
  55. package/dist/packages/_es/Picker.js +39 -16
  56. package/dist/packages/_es/Popover.js +155 -30
  57. package/dist/packages/_es/Popup.js +8 -71
  58. package/dist/packages/_es/Price.js +17 -5
  59. package/dist/packages/_es/Progress.js +18 -8
  60. package/dist/packages/_es/PullRefresh.js +1 -1
  61. package/dist/packages/_es/Radio.js +2 -2
  62. package/dist/packages/_es/RadioGroup.js +1 -1
  63. package/dist/packages/_es/Range.js +46 -33
  64. package/dist/packages/_es/Rate.js +16 -19
  65. package/dist/packages/_es/Row.js +1 -1
  66. package/dist/packages/_es/SearchBar.js +8 -6
  67. package/dist/packages/_es/ShortPassword.js +89 -67
  68. package/dist/packages/_es/SideNavBar.js +5 -16
  69. package/dist/packages/_es/SideNavBarItem.js +1 -1
  70. package/dist/packages/_es/Signature.js +69 -88
  71. package/dist/packages/_es/Skeleton.js +8 -11
  72. package/dist/packages/_es/Sku.js +47 -56
  73. package/dist/packages/_es/Step.js +1 -1
  74. package/dist/packages/_es/Steps.js +1 -1
  75. package/dist/packages/_es/Sticky.js +28 -23
  76. package/dist/packages/_es/SubSideNavBar.js +1 -1
  77. package/dist/packages/_es/Swipe.js +39 -26
  78. package/dist/packages/_es/Swiper.js +31 -13
  79. package/dist/packages/_es/SwiperItem.js +1 -1
  80. package/dist/packages/_es/Switch.js +3 -3
  81. package/dist/packages/_es/TabPane.js +1 -1
  82. package/dist/packages/_es/Tabbar.js +3 -3
  83. package/dist/packages/_es/TabbarItem.js +17 -23
  84. package/dist/packages/_es/Table.js +13 -13
  85. package/dist/packages/_es/Tabs.js +21 -20
  86. package/dist/packages/_es/Tag.js +4 -4
  87. package/dist/packages/_es/TextArea.js +44 -42
  88. package/dist/packages/_es/TimeDetail.js +4 -3
  89. package/dist/packages/_es/TimePannel.js +3 -3
  90. package/dist/packages/_es/TimeSelect.js +8 -7
  91. package/dist/packages/_es/Toast.js +41 -170
  92. package/dist/packages/_es/Uploader.js +109 -138
  93. package/dist/packages/_es/Video.js +3 -3
  94. package/dist/packages/_es/common.js +1 -1
  95. package/dist/packages/_es/component.js +1 -1
  96. package/dist/packages/_es/index.js +44 -6
  97. package/dist/packages/_es/{index5.js → index.taro.js} +127 -95
  98. package/dist/packages/_es/index2.js +1 -1
  99. package/dist/packages/_es/index3.js +56 -28
  100. package/dist/packages/_es/index4.js +413 -56
  101. package/dist/packages/_es/plugin-vue_export-helper.js +1 -1
  102. package/dist/packages/_es/pxCheck.js +1 -1
  103. package/dist/packages/_es/use-lock-scroll.js +23 -0
  104. package/dist/packages/_es/util.js +1 -1
  105. package/dist/packages/uploader/index.scss +2 -2
  106. package/dist/style.css +1 -1
  107. package/dist/styles/themes/default.scss +61 -61
  108. package/dist/styles/themes/jdt.scss +61 -61
  109. package/package.json +1 -1
  110. package/dist/packages/_es/raf.js +0 -19
@@ -15,13 +15,13 @@ var __spreadValues = (a, b) => {
15
15
  return a;
16
16
  };
17
17
  /*!
18
- * @nutui/nutui v3.1.19-beta.0 Mon Mar 28 2022 17:50:21 GMT+0800 (中国标准时间)
18
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
19
19
  * (c) 2022 @jdf2e.
20
20
  * Released under the MIT License.
21
21
  */
22
- import { ref, computed, reactive, watch, toRefs, openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, createCommentVNode, renderSlot, Fragment, renderList, normalizeStyle, createTextVNode } from "vue";
22
+ import { ref, computed, reactive, onMounted, watch, toRefs, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, createCommentVNode, renderSlot, Fragment, renderList, createVNode, withCtx, normalizeStyle, createTextVNode } from "vue";
23
23
  import { c as createComponent } from "./component.js";
24
- import { r as requestAniFrame } from "./raf.js";
24
+ import Taro from "@tarojs/taro";
25
25
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
26
26
  const Utils = {
27
27
  isLeapYear: function(y) {
@@ -105,6 +105,7 @@ const Utils = {
105
105
  }
106
106
  };
107
107
  const { create } = createComponent("calendar-item");
108
+ let TARO_ENV = {}.TARO_ENV;
108
109
  const _sfc_main = create({
109
110
  props: {
110
111
  type: {
@@ -163,12 +164,10 @@ const _sfc_main = create({
163
164
  emits: ["choose", "update", "close", "select"],
164
165
  setup(props, { emit, slots }) {
165
166
  const weeks = ref(["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"]);
166
- const months = ref(null);
167
- const monthsPanel = ref(null);
168
- const weeksPanel = ref(null);
169
- const viewArea = ref(null);
167
+ const scalePx = ref(2);
170
168
  const viewHeight = ref(0);
171
- const compConthsData = computed(() => {
169
+ const months = ref(null);
170
+ computed(() => {
172
171
  return state.monthsData.slice(state.defaultRange[0], state.defaultRange[1]);
173
172
  });
174
173
  const showTopBtn = computed(() => {
@@ -182,7 +181,9 @@ const _sfc_main = create({
182
181
  });
183
182
  const state = reactive({
184
183
  yearMonthTitle: "",
185
- defaultRange: [],
184
+ defaultRange: [0, 1],
185
+ compConthsDatas: [],
186
+ containerHeight: "",
186
187
  currDate: "",
187
188
  propStartDate: "",
188
189
  propEndDate: "",
@@ -208,6 +209,7 @@ const _sfc_main = create({
208
209
  timer: 0,
209
210
  currentIndex: 0,
210
211
  avgHeight: 0,
212
+ scrollTop: 0,
211
213
  monthsNum: 0
212
214
  });
213
215
  const splitDate = (date) => {
@@ -227,7 +229,7 @@ const _sfc_main = create({
227
229
  if (day.type == "curr") {
228
230
  if (!state.isRange && Utils.isEqual(state.currDate, currDate) || state.isRange && (isStart(currDate) || isEnd(currDate))) {
229
231
  return `${state.dayPrefix}-active`;
230
- } else if (state.propStartDate && Utils.compareDate(currDate, state.propStartDate) || state.propEndDate && Utils.compareDate(state.propEndDate, currDate)) {
232
+ } else if (props.startDate && Utils.compareDate(currDate, props.startDate) || props.endDate && Utils.compareDate(props.endDate, currDate)) {
231
233
  return `${state.dayPrefix}-disabled`;
232
234
  } else if (state.isRange && Array.isArray(state.currDate) && Object.values(state.currDate).length == 2 && Utils.compareDate(state.currDate[0], currDate) && Utils.compareDate(currDate, state.currDate[1])) {
233
235
  return `${state.dayPrefix}-choose`;
@@ -350,7 +352,15 @@ const _sfc_main = create({
350
352
  ...getDaysStatus(currMonthDays, "curr", title)
351
353
  ]
352
354
  };
353
- monthInfo.cssHeight = 39 + (monthInfo.monthData.length > 35 ? 384 : 320);
355
+ let titleHeight, itemHeight;
356
+ if (TARO_ENV === "h5") {
357
+ titleHeight = 46 * scalePx.value + 16 * scalePx.value * 2;
358
+ itemHeight = 128 * scalePx.value;
359
+ } else {
360
+ titleHeight = Math.floor(46 * scalePx.value) + Math.floor(16 * scalePx.value) * 2;
361
+ itemHeight = Math.floor(128 * scalePx.value);
362
+ }
363
+ monthInfo.cssHeight = titleHeight + (monthInfo.monthData.length > 35 ? itemHeight * 6 : itemHeight * 5);
354
364
  let cssScrollHeight = 0;
355
365
  if (state.monthsData.length > 0) {
356
366
  cssScrollHeight = state.monthsData[state.monthsData.length - 1].cssScrollHeight + state.monthsData[state.monthsData.length - 1].cssHeight;
@@ -437,26 +447,37 @@ const _sfc_main = create({
437
447
  }
438
448
  let lastItem = state.monthsData[state.monthsData.length - 1];
439
449
  let containerHeight = lastItem.cssHeight + lastItem.cssScrollHeight;
440
- requestAniFrame(() => {
441
- if ((months == null ? void 0 : months.value) && (monthsPanel == null ? void 0 : monthsPanel.value) && (viewArea == null ? void 0 : viewArea.value)) {
442
- viewHeight.value = months.value.clientHeight;
443
- monthsPanel.value.style.height = `${containerHeight}px`;
444
- months.value.scrollTop = state.monthsData[state.currentIndex].cssScrollHeight;
445
- }
446
- });
450
+ state.containerHeight = `${containerHeight}px`;
451
+ state.scrollTop = state.monthsData[state.currentIndex].cssScrollHeight;
447
452
  state.avgHeight = Math.floor(containerHeight / (monthsNum + 1));
453
+ if (months == null ? void 0 : months.value) {
454
+ viewHeight.value = months.value.clientHeight;
455
+ }
456
+ if (TARO_ENV === "h5") {
457
+ Taro.nextTick(() => {
458
+ Taro.createSelectorQuery().select(".nut-calendar-content").boundingClientRect((res) => {
459
+ viewHeight.value = res.height;
460
+ }).exec();
461
+ });
462
+ }
448
463
  };
449
464
  const setDefaultRange = (monthsNum, current) => {
465
+ let rangeArr = [];
450
466
  if (monthsNum >= 3) {
451
467
  if (current > 0 && current < monthsNum) {
452
- state.defaultRange = [current - 1, current + 3];
468
+ rangeArr = [current - 1, current + 3];
453
469
  } else if (current == 0) {
454
- state.defaultRange = [current, current + 4];
470
+ rangeArr = [current, current + 4];
455
471
  } else if (current == monthsNum) {
456
- state.defaultRange = [current - 2, current + 2];
472
+ rangeArr = [current - 2, current + 2];
457
473
  }
458
474
  } else {
459
- state.defaultRange = [0, monthsNum + 2];
475
+ rangeArr = [0, monthsNum + 1];
476
+ }
477
+ if (JSON.stringify(state.defaultRange) !== JSON.stringify(rangeArr)) {
478
+ state.defaultRange[0] = rangeArr[0];
479
+ state.defaultRange[1] = rangeArr[1];
480
+ state.compConthsDatas = state.monthsData.slice(rangeArr[0], rangeArr[1]);
460
481
  }
461
482
  let defaultScrollTop = state.monthsData[state.defaultRange[0]].cssScrollHeight;
462
483
  state.translateY = defaultScrollTop;
@@ -498,7 +519,7 @@ const _sfc_main = create({
498
519
  }
499
520
  } else {
500
521
  const viewPosition = Math.round(currentScrollTop + viewHeight.value);
501
- if (viewPosition < state.monthsData[current].cssScrollHeight + state.monthsData[current].cssHeight && currentScrollTop > state.monthsData[current - 1].cssScrollHeight) {
522
+ if (viewPosition < state.monthsData[current].cssScrollHeight + state.monthsData[current].cssHeight && currentScrollTop < state.monthsData[current].cssScrollHeight) {
502
523
  current -= 1;
503
524
  }
504
525
  if (current + 1 <= state.monthsNum && viewPosition >= state.monthsData[current + 1].cssScrollHeight + state.monthsData[current + 1].cssHeight) {
@@ -519,7 +540,21 @@ const _sfc_main = create({
519
540
  state.monthsData.splice(0);
520
541
  initData();
521
542
  };
522
- initData();
543
+ onMounted(() => {
544
+ Taro.getSystemInfo({
545
+ success(res) {
546
+ let scale = 2;
547
+ let screenWidth = res.screenWidth;
548
+ let toFixed = 3;
549
+ if (TARO_ENV === "h5") {
550
+ toFixed = 5;
551
+ }
552
+ scale = Number((screenWidth / 750).toFixed(toFixed));
553
+ scalePx.value = scale;
554
+ initData();
555
+ }
556
+ });
557
+ });
523
558
  watch(() => props.defaultValue, (val) => {
524
559
  if (val) {
525
560
  if (props.poppable) {
@@ -529,7 +564,6 @@ const _sfc_main = create({
529
564
  });
530
565
  return __spreadValues(__spreadValues({
531
566
  weeks,
532
- compConthsData,
533
567
  showTopBtn,
534
568
  topInfo,
535
569
  bottomInfo,
@@ -541,10 +575,7 @@ const _sfc_main = create({
541
575
  chooseDay,
542
576
  isCurrDay,
543
577
  confirm,
544
- monthsPanel,
545
- months,
546
- weeksPanel,
547
- viewArea
578
+ months
548
579
  }, toRefs(state)), toRefs(props));
549
580
  }
550
581
  });
@@ -560,13 +591,10 @@ const _hoisted_3 = {
560
591
  key: 2,
561
592
  class: "calendar-curr-month"
562
593
  };
563
- const _hoisted_4 = {
564
- class: "calendar-weeks",
565
- ref: "weeksPanel"
566
- };
594
+ const _hoisted_4 = { class: "calendar-weeks" };
567
595
  const _hoisted_5 = {
568
596
  class: "calendar-months-panel",
569
- ref: "monthsPanel"
597
+ style: { "{{heihgt": "containerHeight}}" }
570
598
  };
571
599
  const _hoisted_6 = { class: "calendar-month-title" };
572
600
  const _hoisted_7 = { class: "calendar-month-con" };
@@ -585,7 +613,7 @@ const _hoisted_12 = {
585
613
  class: "calendar-curr-tip-curr"
586
614
  };
587
615
  const _hoisted_13 = {
588
- key: 4,
616
+ key: 3,
589
617
  class: "calendar-day-tip"
590
618
  };
591
619
  const _hoisted_14 = {
@@ -593,6 +621,7 @@ const _hoisted_14 = {
593
621
  class: "nut-calendar-footer"
594
622
  };
595
623
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
624
+ const _component_scroll_view = resolveComponent("scroll-view");
596
625
  return openBlock(), createElementBlock("view", {
597
626
  class: normalizeClass(["nut-calendar nut-calendar-taro", {
598
627
  "nut-calendar-tile": !_ctx.poppable,
@@ -614,71 +643,74 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
614
643
  key: index
615
644
  }, toDisplayString(item), 1);
616
645
  }), 128))
617
- ], 512)
646
+ ])
618
647
  ], 2),
619
- createElementVNode("view", {
648
+ createVNode(_component_scroll_view, {
649
+ "scroll-top": _ctx.scrollTop,
650
+ "scroll-y": true,
620
651
  class: "nut-calendar-content",
621
- ref: "months",
622
- onScroll: _cache[0] || (_cache[0] = (...args) => _ctx.mothsViewScroll && _ctx.mothsViewScroll(...args))
623
- }, [
624
- createElementVNode("view", _hoisted_5, [
625
- createElementVNode("view", {
626
- class: "viewArea",
627
- ref: "viewArea",
628
- style: normalizeStyle({ transform: `translateY(${_ctx.translateY}px)` })
629
- }, [
630
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.compConthsData, (month, index) => {
631
- return openBlock(), createElementBlock("view", {
632
- class: "calendar-month",
633
- key: index
634
- }, [
635
- createElementVNode("view", _hoisted_6, toDisplayString(month.title), 1),
636
- createElementVNode("view", _hoisted_7, [
637
- createElementVNode("view", {
638
- class: normalizeClass(["calendar-month-item", _ctx.type === "range" ? "month-item-range" : ""])
639
- }, [
640
- (openBlock(true), createElementBlock(Fragment, null, renderList(month.monthData, (day, i) => {
641
- return openBlock(), createElementBlock("view", {
642
- key: i,
643
- class: normalizeClass(["calendar-month-day", _ctx.getClass(day, month)]),
644
- onClick: ($event) => _ctx.chooseDay(day, month)
645
- }, [
646
- createElementVNode("view", _hoisted_9, [
647
- renderSlot(_ctx.$slots, "day", {
648
- date: day.type == "curr" ? day : ""
649
- }, () => [
650
- createTextVNode(toDisplayString(day.type == "curr" ? day.day : ""), 1)
651
- ])
652
- ]),
653
- _ctx.topInfo ? (openBlock(), createElementBlock("view", _hoisted_10, [
654
- renderSlot(_ctx.$slots, "topInfo", {
655
- date: day.type == "curr" ? day : ""
656
- })
657
- ])) : createCommentVNode("", true),
658
- _ctx.bottomInfo ? (openBlock(), createElementBlock("view", _hoisted_11, [
659
- renderSlot(_ctx.$slots, "bottomInfo", {
660
- date: day.type == "curr" ? day : ""
661
- })
662
- ])) : createCommentVNode("", true),
663
- !_ctx.bottomInfo && _ctx.showToday && _ctx.isCurrDay(day) ? (openBlock(), createElementBlock("view", _hoisted_12, " \u4ECA\u5929 ")) : createCommentVNode("", true),
664
- _ctx.isStartTip(day, month) ? (openBlock(), createElementBlock("view", {
665
- key: 3,
666
- class: normalizeClass(["calendar-day-tip", { "calendar-curr-tips-top": _ctx.rangeTip(day, month) }])
667
- }, toDisplayString(_ctx.startText), 3)) : createCommentVNode("", true),
668
- _ctx.isEndTip(day, month) ? (openBlock(), createElementBlock("view", _hoisted_13, toDisplayString(_ctx.endText), 1)) : createCommentVNode("", true)
669
- ], 10, _hoisted_8);
670
- }), 128))
671
- ], 2)
672
- ])
673
- ]);
674
- }), 128))
675
- ], 4)
676
- ], 512)
677
- ], 544),
652
+ onScroll: _ctx.mothsViewScroll,
653
+ ref: "months"
654
+ }, {
655
+ default: withCtx(() => [
656
+ createElementVNode("view", _hoisted_5, [
657
+ createElementVNode("view", {
658
+ class: "viewArea",
659
+ style: normalizeStyle({ transform: `translateY(${_ctx.translateY}px)` })
660
+ }, [
661
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.compConthsDatas, (month, index) => {
662
+ return openBlock(), createElementBlock("view", {
663
+ class: "calendar-month",
664
+ key: index
665
+ }, [
666
+ createElementVNode("view", _hoisted_6, toDisplayString(month.title), 1),
667
+ createElementVNode("view", _hoisted_7, [
668
+ createElementVNode("view", {
669
+ class: normalizeClass(["calendar-month-item", _ctx.type === "range" ? "month-item-range" : ""])
670
+ }, [
671
+ (openBlock(true), createElementBlock(Fragment, null, renderList(month.monthData, (day, i) => {
672
+ return openBlock(), createElementBlock("view", {
673
+ key: i,
674
+ class: normalizeClass(["calendar-month-day", _ctx.getClass(day, month)]),
675
+ onClick: ($event) => _ctx.chooseDay(day, month)
676
+ }, [
677
+ createElementVNode("view", _hoisted_9, [
678
+ renderSlot(_ctx.$slots, "day", {
679
+ date: day.type == "curr" ? day : ""
680
+ }, () => [
681
+ createTextVNode(toDisplayString(day.type == "curr" ? day.day : ""), 1)
682
+ ])
683
+ ]),
684
+ _ctx.topInfo ? (openBlock(), createElementBlock("view", _hoisted_10, [
685
+ renderSlot(_ctx.$slots, "topInfo", {
686
+ date: day.type == "curr" ? day : ""
687
+ })
688
+ ])) : createCommentVNode("", true),
689
+ _ctx.bottomInfo ? (openBlock(), createElementBlock("view", _hoisted_11, [
690
+ renderSlot(_ctx.$slots, "bottomInfo", {
691
+ date: day.type == "curr" ? day : ""
692
+ })
693
+ ])) : createCommentVNode("", true),
694
+ !_ctx.bottomInfo && _ctx.showToday && _ctx.isCurrDay(day) ? (openBlock(), createElementBlock("view", _hoisted_12, " \u4ECA\u5929 ")) : createCommentVNode("", true),
695
+ createElementVNode("view", {
696
+ class: normalizeClass({ "calendar-curr-tips-top": _ctx.rangeTip(day, month), "calendar-day-tip": true })
697
+ }, toDisplayString(_ctx.isStartTip(day, month) ? _ctx.startText : ""), 3),
698
+ _ctx.isEndTip(day, month) ? (openBlock(), createElementBlock("view", _hoisted_13, toDisplayString(_ctx.endText), 1)) : createCommentVNode("", true)
699
+ ], 10, _hoisted_8);
700
+ }), 128))
701
+ ], 2)
702
+ ])
703
+ ]);
704
+ }), 128))
705
+ ], 4)
706
+ ])
707
+ ]),
708
+ _: 3
709
+ }, 8, ["scroll-top", "onScroll"]),
678
710
  _ctx.poppable && !_ctx.isAutoBackFill ? (openBlock(), createElementBlock("view", _hoisted_14, [
679
711
  createElementVNode("view", {
680
712
  class: "calendar-confirm-btn",
681
- onClick: _cache[1] || (_cache[1] = (...args) => _ctx.confirm && _ctx.confirm(...args))
713
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.confirm && _ctx.confirm(...args))
682
714
  }, toDisplayString(_ctx.confirmText), 1)
683
715
  ])) : createCommentVNode("", true)
684
716
  ], 2);
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.19-beta.0 Mon Mar 28 2022 17:50:21 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,36 +1,64 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.19-beta.0 Mon Mar 28 2022 17:50:21 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { unref } from "vue";
7
- function isWindow(val) {
8
- return val === window;
9
- }
10
- const useRect = (elementRef) => {
11
- const element = unref(elementRef);
12
- if (isWindow(element)) {
13
- const width = element.innerWidth;
14
- const height = element.innerHeight;
15
- return {
16
- top: 0,
17
- left: 0,
18
- right: width,
19
- bottom: height,
20
- width,
21
- height
22
- };
6
+ import { ref } from "vue";
7
+ const MIN_DISTANCE = 10;
8
+ function getDirection(x, y) {
9
+ if (x > y && x > MIN_DISTANCE) {
10
+ return "horizontal";
23
11
  }
24
- if (element && element.getBoundingClientRect) {
25
- return element.getBoundingClientRect();
12
+ if (y > x && y > MIN_DISTANCE) {
13
+ return "vertical";
26
14
  }
15
+ return "";
16
+ }
17
+ function useTouch() {
18
+ const startX = ref(0);
19
+ const startY = ref(0);
20
+ const deltaX = ref(0);
21
+ const deltaY = ref(0);
22
+ const offsetX = ref(0);
23
+ const offsetY = ref(0);
24
+ const direction = ref("");
25
+ const isVertical = () => direction.value === "vertical";
26
+ const isHorizontal = () => direction.value === "horizontal";
27
+ const reset = () => {
28
+ deltaX.value = 0;
29
+ deltaY.value = 0;
30
+ offsetX.value = 0;
31
+ offsetY.value = 0;
32
+ direction.value = "";
33
+ };
34
+ const start = (event) => {
35
+ reset();
36
+ startX.value = event.touches[0].clientX;
37
+ startY.value = event.touches[0].clientY;
38
+ };
39
+ const move = (event) => {
40
+ const touch = event.touches[0];
41
+ deltaX.value = touch.clientX - startX.value;
42
+ deltaY.value = touch.clientY - startY.value;
43
+ offsetX.value = Math.abs(deltaX.value);
44
+ offsetY.value = Math.abs(deltaY.value);
45
+ if (!direction.value) {
46
+ direction.value = getDirection(offsetX.value, offsetY.value);
47
+ }
48
+ };
27
49
  return {
28
- top: 0,
29
- left: 0,
30
- right: 0,
31
- bottom: 0,
32
- width: 0,
33
- height: 0
50
+ move,
51
+ start,
52
+ reset,
53
+ startX,
54
+ startY,
55
+ deltaX,
56
+ deltaY,
57
+ offsetX,
58
+ offsetY,
59
+ direction,
60
+ isVertical,
61
+ isHorizontal
34
62
  };
35
- };
36
- export { useRect as u };
63
+ }
64
+ export { useTouch as u };