@nutui/nutui 3.1.12-beta.1 → 3.1.12

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 (114) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/nutui.d.ts +1 -1
  3. package/dist/nutui.es.js +3219 -2562
  4. package/dist/nutui.umd.js +3292 -2565
  5. package/dist/packages/_es/ActionSheet.js +12 -13
  6. package/dist/packages/_es/Address.js +49 -63
  7. package/dist/packages/_es/Avatar.js +5 -4
  8. package/dist/packages/_es/BackTop.js +109 -72
  9. package/dist/packages/_es/Badge.js +5 -4
  10. package/dist/packages/_es/Barrage.js +57 -63
  11. package/dist/packages/_es/Button.js +6 -5
  12. package/dist/packages/_es/Calendar.js +18 -27
  13. package/dist/packages/_es/Card.js +8 -7
  14. package/dist/packages/_es/Cell.js +13 -5
  15. package/dist/packages/_es/CellGroup.js +14 -7
  16. package/dist/packages/_es/Checkbox.js +3 -3
  17. package/dist/packages/_es/CheckboxGroup.js +4 -9
  18. package/dist/packages/_es/CircleProgress.js +46 -142
  19. package/dist/packages/_es/Col.js +5 -4
  20. package/dist/packages/_es/Collapse.js +10 -35
  21. package/dist/packages/_es/CollapseItem.js +35 -80
  22. package/dist/packages/_es/CountDown.js +5 -7
  23. package/dist/packages/_es/CountUp.js +31 -34
  24. package/dist/packages/_es/DatePicker.js +219 -451
  25. package/dist/packages/_es/Dialog.js +98 -46
  26. package/dist/packages/_es/Divider.js +6 -5
  27. package/dist/packages/_es/Drag.js +50 -76
  28. package/dist/packages/_es/Elevator.js +52 -81
  29. package/dist/packages/_es/FixedNav.js +9 -8
  30. package/dist/packages/_es/Form.js +6 -5
  31. package/dist/packages/_es/FormItem.js +5 -4
  32. package/dist/packages/_es/Icon.js +40 -6
  33. package/dist/packages/_es/ImagePreview.js +158 -44
  34. package/dist/packages/_es/InfiniteLoading.js +109 -95
  35. package/dist/packages/_es/Input.js +21 -22
  36. package/dist/packages/_es/InputNumber.js +18 -24
  37. package/dist/packages/_es/Layout.js +2 -2
  38. package/dist/packages/_es/Menu.js +14 -16
  39. package/dist/packages/_es/MenuItem.js +11 -9
  40. package/dist/packages/_es/Navbar.js +7 -7
  41. package/dist/packages/_es/NoticeBar.js +26 -39
  42. package/dist/packages/_es/Notify.js +166 -30
  43. package/dist/packages/_es/NumberKeyboard.js +7 -9
  44. package/dist/packages/_es/OverLay.js +29 -22
  45. package/dist/packages/_es/Pagination.js +9 -8
  46. package/dist/packages/_es/Picker.js +447 -61
  47. package/dist/packages/_es/Popover.js +34 -161
  48. package/dist/packages/_es/Popup.js +77 -17
  49. package/dist/packages/_es/Price.js +7 -18
  50. package/dist/packages/_es/Progress.js +12 -23
  51. package/dist/packages/_es/Radio.js +3 -3
  52. package/dist/packages/_es/RadioGroup.js +2 -2
  53. package/dist/packages/_es/Range.js +31 -38
  54. package/dist/packages/_es/Rate.js +35 -17
  55. package/dist/packages/_es/Row.js +5 -4
  56. package/dist/packages/_es/SearchBar.js +5 -7
  57. package/dist/packages/_es/ShortPassword.js +59 -89
  58. package/dist/packages/_es/Signature.js +71 -70
  59. package/dist/packages/_es/Sku.js +43 -53
  60. package/dist/packages/_es/Step.js +8 -10
  61. package/dist/packages/_es/Steps.js +2 -2
  62. package/dist/packages/_es/Swipe.js +28 -43
  63. package/dist/packages/_es/Swiper.js +418 -17
  64. package/dist/packages/_es/SwiperItem.js +39 -14
  65. package/dist/packages/_es/Switch.js +32 -11
  66. package/dist/packages/_es/TabPane.js +5 -4
  67. package/dist/packages/_es/Tabbar.js +5 -4
  68. package/dist/packages/_es/TabbarItem.js +9 -8
  69. package/dist/packages/_es/Tabs.js +16 -22
  70. package/dist/packages/_es/Tag.js +6 -5
  71. package/dist/packages/_es/TextArea.js +12 -16
  72. package/dist/packages/_es/TimeDetail.js +5 -7
  73. package/dist/packages/_es/TimePannel.js +5 -7
  74. package/dist/packages/_es/TimeSelect.js +7 -12
  75. package/dist/packages/_es/Toast.js +178 -46
  76. package/dist/packages/_es/Uploader.js +149 -109
  77. package/dist/packages/_es/Video.js +405 -0
  78. package/dist/packages/_es/component.js +1 -1
  79. package/dist/packages/_es/index.js +7 -58
  80. package/dist/packages/_es/index2.js +58 -43
  81. package/dist/packages/_es/index3.js +28 -411
  82. package/dist/packages/_es/plugin-vue_export-helper.js +13 -0
  83. package/dist/packages/_es/pxCheck.js +1 -1
  84. package/dist/packages/_es/raf.js +1 -1
  85. package/dist/packages/_es/util.js +1 -1
  86. package/dist/packages/cellgroup/index.scss +9 -0
  87. package/dist/packages/dialog/index.scss +17 -0
  88. package/dist/packages/drag/index.scss +4 -0
  89. package/dist/packages/fixednav/index.scss +6 -1
  90. package/dist/packages/formitem/index.scss +3 -0
  91. package/dist/packages/icon/index.scss +2 -1
  92. package/dist/packages/numberkeyboard/index.scss +1 -1
  93. package/dist/packages/popover/index.scss +2 -2
  94. package/dist/packages/rate/index.scss +1 -0
  95. package/dist/packages/textarea/index.scss +1 -0
  96. package/dist/packages/timedetail/index.scss +1 -2
  97. package/dist/packages/timeselect/index.scss +3 -0
  98. package/dist/packages/toast/index.scss +6 -0
  99. package/dist/style.css +1 -1
  100. package/dist/style.es.js +2 -1
  101. package/dist/styles/font/config.json +2 -1
  102. package/dist/styles/font/demo_index.html +26 -3
  103. package/dist/styles/font/iconfont.css +7 -3
  104. package/dist/styles/font/iconfont.js +31 -32
  105. package/dist/styles/font/iconfont.json +7 -0
  106. package/dist/styles/font/iconfont.ttf +0 -0
  107. package/dist/styles/font/iconfont.woff +0 -0
  108. package/dist/styles/font/iconfont.woff2 +0 -0
  109. package/dist/styles/themes/default.scss +38 -38
  110. package/dist/styles/variables.scss +5 -1
  111. package/package.json +1 -1
  112. package/dist/packages/_es/commonProps.js +0 -30
  113. package/dist/packages/_es/index.taro.vue_vue&type=script&lang.js +0 -44
  114. package/dist/packages/_es/use-lock-scroll.js +0 -23
@@ -17,18 +17,17 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __require = typeof require !== "undefined" ? require : (x) => {
21
- throw new Error('Dynamic require of "' + x + '" is not supported');
22
- };
23
20
  /*!
24
- * @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
25
22
  * (c) 2021 @jdf2e.
26
23
  * Released under the MIT License.
27
24
  */
28
25
  import { c as createComponent } from "./component.js";
29
26
  import { computed, resolveComponent, openBlock, createElementBlock, normalizeClass, createVNode, withCtx, createElementVNode, toDisplayString, createCommentVNode, Fragment, renderList, normalizeStyle, createTextVNode } from "vue";
30
- import { p as popupProps } from "./index3.js";
31
- import "./use-lock-scroll.js";
27
+ import { popupProps } from "./Popup.js";
28
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
29
+ import "./OverLay.js";
30
+ import "./Icon.js";
32
31
  import "./pxCheck.js";
33
32
  const { componentName, create } = createComponent("actionsheet");
34
33
  const _sfc_main = create({
@@ -81,9 +80,9 @@ const _sfc_main = create({
81
80
  emit("cancel");
82
81
  emit("update:visible", false);
83
82
  };
84
- const chooseItem = (item, index) => {
83
+ const chooseItem = (item, index2) => {
85
84
  if (!item.disable) {
86
- emit("choose", item, index);
85
+ emit("choose", item, index2);
87
86
  emit("update:visible", false);
88
87
  }
89
88
  };
@@ -132,12 +131,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
132
131
  _ctx.title ? (openBlock(), createElementBlock("view", _hoisted_2, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true),
133
132
  _ctx.description ? (openBlock(), createElementBlock("view", _hoisted_3, toDisplayString(_ctx.description), 1)) : createCommentVNode("", true),
134
133
  _ctx.menuItems.length ? (openBlock(), createElementBlock("view", _hoisted_4, [
135
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuItems, (item, index) => {
134
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuItems, (item, index2) => {
136
135
  return openBlock(), createElementBlock("view", {
137
136
  class: normalizeClass(["nut-actionsheet-item", { "nut-actionsheet-item-disabled": item.disable }]),
138
137
  style: normalizeStyle({ color: _ctx.isHighlight(item) }),
139
- key: index,
140
- onClick: ($event) => _ctx.chooseItem(item, index)
138
+ key: index2,
139
+ onClick: ($event) => _ctx.chooseItem(item, index2)
141
140
  }, [
142
141
  createTextVNode(toDisplayString(item[_ctx.optionTag]), 1),
143
142
  createElementVNode("view", _hoisted_6, toDisplayString(item[_ctx.optionSubTag]), 1)
@@ -155,5 +154,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
155
154
  }, 8, ["visible", "onClickOverlay"])
156
155
  ], 2);
157
156
  }
158
- _sfc_main.render = _sfc_render;
159
- export { _sfc_main as default };
157
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
158
+ export { index as default };
@@ -14,19 +14,16 @@ var __spreadValues = (a, b) => {
14
14
  }
15
15
  return a;
16
16
  };
17
- var __require = typeof require !== "undefined" ? require : (x) => {
18
- throw new Error('Dynamic require of "' + x + '" is not supported');
19
- };
20
17
  /*!
21
- * @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
18
+ * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
22
19
  * (c) 2021 @jdf2e.
23
20
  * Released under the MIT License.
24
21
  */
25
- import { computed, ref, reactive, watch, toRefs, resolveComponent, openBlock, createBlock, normalizeClass, withCtx, createElementVNode, createCommentVNode, toDisplayString, createElementBlock, Fragment, renderList, normalizeStyle, createTextVNode, createVNode } from "vue";
22
+ import { ref, reactive, computed, watch, toRefs, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, withDirectives, createVNode, vShow, toDisplayString, createCommentVNode, createElementBlock, Fragment, renderList, normalizeClass, normalizeStyle, createTextVNode, nextTick } from "vue";
26
23
  import { c as createComponent } from "./component.js";
27
- import Taro from "@tarojs/taro";
28
- const { create, componentName } = createComponent("address");
29
- var _sfc_main = create({
24
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
25
+ const { componentName, create } = createComponent("address");
26
+ const _sfc_main = create({
30
27
  inheritAttrs: false,
31
28
  props: {
32
29
  visible: {
@@ -96,12 +93,6 @@ var _sfc_main = create({
96
93
  },
97
94
  emits: ["update:visible", "type", "change", "selected", "close", "close-mask", "switch-module"],
98
95
  setup(props, { emit }) {
99
- const classes = computed(() => {
100
- const prefixCls = componentName;
101
- return {
102
- [prefixCls]: true
103
- };
104
- });
105
96
  const regionLine = ref(null);
106
97
  const tabItemRef = reactive({
107
98
  province: ref(null),
@@ -130,16 +121,16 @@ var _sfc_main = create({
130
121
  return a.title.localeCompare(b.title);
131
122
  });
132
123
  data.forEach((item) => {
133
- const index = newData.findIndex((value) => value.title === item.title);
134
- if (index <= -1) {
124
+ const index2 = newData.findIndex((value) => value.title === item.title);
125
+ if (index2 <= -1) {
135
126
  newData.push({
136
127
  title: item.title,
137
128
  list: [].concat(item)
138
129
  });
139
130
  } else {
140
- newData[index] = {
131
+ newData[index2] = {
141
132
  title: item.title,
142
- list: newData[index].list.concat(item)
133
+ list: newData[index2].list.concat(item)
143
134
  };
144
135
  }
145
136
  });
@@ -160,10 +151,10 @@ var _sfc_main = create({
160
151
  let selectedExistAddress = reactive({});
161
152
  const closeWay = ref("self");
162
153
  const lineDistance = ref(20);
163
- const getTabName = (item, index) => {
154
+ const getTabName = (item, index2) => {
164
155
  if (item.name)
165
156
  return item.name;
166
- if (tabIndex.value < index) {
157
+ if (tabIndex.value < index2) {
167
158
  return item.name;
168
159
  } else {
169
160
  return "\u8BF7\u9009\u62E9";
@@ -179,14 +170,13 @@ var _sfc_main = create({
179
170
  closeWay.value = "mask";
180
171
  };
181
172
  const lineAnimation = () => {
182
- setTimeout(() => {
183
- Taro.createSelectorQuery().selectAll(`.${tabName.value[tabIndex.value]}`).boundingClientRect((rects) => {
184
- rects.forEach((rect) => {
185
- if (rect.width > 0)
186
- lineDistance.value = rect.left;
187
- });
188
- }).exec();
189
- }, 100);
173
+ const name = tabItemRef[tabName.value[tabIndex.value]];
174
+ nextTick(() => {
175
+ if (name) {
176
+ const distance = name.offsetLeft;
177
+ lineDistance.value = distance ? distance : 20;
178
+ }
179
+ });
190
180
  };
191
181
  const nextAreaList = (item) => {
192
182
  const calBack = {
@@ -208,16 +198,16 @@ var _sfc_main = create({
208
198
  handClose();
209
199
  }
210
200
  };
211
- const changeRegionTab = (item, key, index) => {
212
- if (getTabName(item, index)) {
213
- tabIndex.value = index;
201
+ const changeRegionTab = (item, key, index2) => {
202
+ if (getTabName(item, index2)) {
203
+ tabIndex.value = index2;
214
204
  lineAnimation();
215
205
  }
216
206
  };
217
207
  const selectedExist = (item) => {
218
208
  const copyExistAdd = props.existAddress;
219
209
  let prevExistAdd = {};
220
- copyExistAdd.forEach((list, index) => {
210
+ copyExistAdd.forEach((list, index2) => {
221
211
  if (list && list.selectedAddress) {
222
212
  prevExistAdd = list;
223
213
  }
@@ -303,14 +293,13 @@ var _sfc_main = create({
303
293
  regionList.town = isCustom2.value ? transformData(value) : value;
304
294
  });
305
295
  watch(() => props.existAddress, (value) => {
306
- value.forEach((item, index) => {
296
+ value.forEach((item, index2) => {
307
297
  if (item.selectedAddress) {
308
298
  selectedExistAddress = item;
309
299
  }
310
300
  });
311
301
  });
312
302
  return __spreadValues(__spreadValues({
313
- classes,
314
303
  showPopup,
315
304
  privateType,
316
305
  tabIndex,
@@ -351,10 +340,7 @@ const _hoisted_10 = {
351
340
  };
352
341
  const _hoisted_11 = { class: "region-tab" };
353
342
  const _hoisted_12 = ["onClick"];
354
- const _hoisted_13 = {
355
- key: 0,
356
- class: "elevator-group"
357
- };
343
+ const _hoisted_13 = { class: "elevator-group" };
358
344
  const _hoisted_14 = {
359
345
  key: 2,
360
346
  class: "exist-address"
@@ -381,8 +367,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
381
367
  onClickOverlay: _ctx.clickOverlay,
382
368
  onOpen: _cache[3] || (_cache[3] = ($event) => _ctx.closeWay = "self"),
383
369
  visible: _ctx.showPopup,
384
- "onUpdate:visible": _cache[4] || (_cache[4] = ($event) => _ctx.showPopup = $event),
385
- class: normalizeClass(_ctx.classes)
370
+ "onUpdate:visible": _cache[4] || (_cache[4] = ($event) => _ctx.showPopup = $event)
386
371
  }, {
387
372
  default: withCtx(() => [
388
373
  createElementVNode("view", _hoisted_1, [
@@ -391,11 +376,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
391
376
  class: "arrow-back",
392
377
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.switchModule && _ctx.switchModule(...args))
393
378
  }, [
394
- _ctx.privateType == "custom" && _ctx.type == "exist" && _ctx.backBtnIcon ? (openBlock(), createBlock(_component_nut_icon, {
395
- key: 0,
379
+ withDirectives(createVNode(_component_nut_icon, {
396
380
  name: _ctx.backBtnIcon,
397
381
  color: "#cccccc"
398
- }, null, 8, ["name"])) : createCommentVNode("", true)
382
+ }, null, 8, ["name"]), [
383
+ [vShow, _ctx.privateType == "custom" && _ctx.backBtnIcon]
384
+ ])
399
385
  ]),
400
386
  createElementVNode("view", _hoisted_3, toDisplayString(_ctx.privateType == "custom" ? _ctx.customAddressTitle : _ctx.existAddressTitle), 1),
401
387
  createElementVNode("view", {
@@ -412,14 +398,14 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
412
398
  ]),
413
399
  _ctx.privateType == "custom" ? (openBlock(), createElementBlock("view", _hoisted_4, [
414
400
  createElementVNode("view", _hoisted_5, [
415
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selectedRegion, (item, key, index) => {
401
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selectedRegion, (item, key, index2) => {
416
402
  return openBlock(), createElementBlock("view", {
417
- class: normalizeClass(["tab-item", [index == _ctx.tabIndex ? "active" : "", key]]),
418
- key: index,
403
+ class: normalizeClass(["tab-item", [index2 == _ctx.tabIndex ? "active" : ""]]),
404
+ key: index2,
419
405
  ref: key,
420
- onClick: ($event) => _ctx.changeRegionTab(item, key, index)
406
+ onClick: ($event) => _ctx.changeRegionTab(item, key, index2)
421
407
  }, [
422
- createElementVNode("view", null, toDisplayString(_ctx.getTabName(item, index)), 1)
408
+ createElementVNode("view", null, toDisplayString(_ctx.getTabName(item, index2)), 1)
423
409
  ], 10, _hoisted_6);
424
410
  }), 128)),
425
411
  createElementVNode("view", {
@@ -430,9 +416,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
430
416
  ]),
431
417
  createElementVNode("view", _hoisted_7, [
432
418
  createElementVNode("ul", _hoisted_8, [
433
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.regionList[_ctx.tabName[_ctx.tabIndex]], (item, index) => {
419
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.regionList[_ctx.tabName[_ctx.tabIndex]], (item, index2) => {
434
420
  return openBlock(), createElementBlock("li", {
435
- key: index,
421
+ key: index2,
436
422
  class: normalizeClass(["region-item", [_ctx.selectedRegion[_ctx.tabName[_ctx.tabIndex]].id == item.id ? "active" : ""]]),
437
423
  onClick: ($event) => _ctx.nextAreaList(item)
438
424
  }, [
@@ -449,16 +435,16 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
449
435
  }), 128))
450
436
  ])
451
437
  ])
452
- ])) : _ctx.privateType === "custom2" ? (openBlock(), createElementBlock("view", _hoisted_10, [
438
+ ])) : _ctx.privateType == "custom2" ? (openBlock(), createElementBlock("view", _hoisted_10, [
453
439
  createElementVNode("view", _hoisted_11, [
454
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selectedRegion, (item, key, index) => {
440
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selectedRegion, (item, key, index2) => {
455
441
  return openBlock(), createElementBlock("view", {
456
- class: normalizeClass(["tab-item", [index == _ctx.tabIndex ? "active" : ""]]),
457
- key: index,
442
+ class: normalizeClass(["tab-item", [index2 == _ctx.tabIndex ? "active" : ""]]),
443
+ key: index2,
458
444
  ref: key,
459
- onClick: ($event) => _ctx.changeRegionTab(item, key, index)
445
+ onClick: ($event) => _ctx.changeRegionTab(item, key, index2)
460
446
  }, [
461
- createElementVNode("view", null, toDisplayString(_ctx.getTabName(item, index)), 1)
447
+ createElementVNode("view", null, toDisplayString(_ctx.getTabName(item, index2)), 1)
462
448
  ], 10, _hoisted_12);
463
449
  }), 128)),
464
450
  createElementVNode("view", {
@@ -467,20 +453,20 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
467
453
  style: normalizeStyle({ left: _ctx.lineDistance + "px" })
468
454
  }, null, 4)
469
455
  ]),
470
- _ctx.showPopup ? (openBlock(), createElementBlock("view", _hoisted_13, [
456
+ createElementVNode("view", _hoisted_13, [
471
457
  createVNode(_component_nut_elevator, {
472
458
  height: _ctx.height,
473
459
  "index-list": _ctx.regionList[_ctx.tabName[_ctx.tabIndex]],
474
460
  onClickItem: _ctx.handleElevatorItem
475
461
  }, null, 8, ["height", "index-list", "onClickItem"])
476
- ])) : createCommentVNode("", true)
462
+ ])
477
463
  ])) : _ctx.privateType == "exist" ? (openBlock(), createElementBlock("view", _hoisted_14, [
478
464
  createElementVNode("div", _hoisted_15, [
479
465
  createElementVNode("ul", _hoisted_16, [
480
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.existAddress, (item, index) => {
466
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.existAddress, (item, index2) => {
481
467
  return openBlock(), createElementBlock("li", {
482
468
  class: normalizeClass(["exist-item", [item.selectedAddress ? "active" : ""]]),
483
- key: index,
469
+ key: index2,
484
470
  onClick: ($event) => _ctx.selectedExist(item)
485
471
  }, [
486
472
  createVNode(_component_nut_icon, {
@@ -514,7 +500,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
514
500
  ])
515
501
  ]),
516
502
  _: 1
517
- }, 8, ["onClose", "onClickOverlay", "visible", "class"]);
503
+ }, 8, ["onClose", "onClickOverlay", "visible"]);
518
504
  }
519
- _sfc_main.render = _sfc_render;
520
- export { _sfc_main as default };
505
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
506
+ export { index as default };
@@ -1,12 +1,13 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { toRefs, computed, resolveComponent, openBlock, createElementBlock, normalizeStyle, normalizeClass, createVNode, renderSlot, createCommentVNode } from "vue";
7
7
  import { c as createComponent } from "./component.js";
8
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
8
9
  const { componentName, create } = createComponent("avatar");
9
- var _sfc_main = create({
10
+ const _sfc_main = create({
10
11
  props: {
11
12
  size: {
12
13
  type: String,
@@ -82,5 +83,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
82
83
  ])) : createCommentVNode("", true)
83
84
  ], 6);
84
85
  }
85
- _sfc_main.render = _sfc_render;
86
- export { _sfc_main as default };
86
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
87
+ export { index as default };
@@ -1,39 +1,14 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __require = typeof require !== "undefined" ? require : (x) => {
21
- throw new Error('Dynamic require of "' + x + '" is not supported');
22
- };
23
1
  /*!
24
- * @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
25
3
  * (c) 2021 @jdf2e.
26
4
  * Released under the MIT License.
27
5
  */
28
- import { reactive, computed, toRefs, resolveComponent, openBlock, createElementBlock, createVNode, normalizeStyle, withCtx, renderSlot, createElementVNode, normalizeClass, withModifiers } from "vue";
6
+ import { reactive, computed, onMounted, onUnmounted, onActivated, onDeactivated, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, withModifiers, renderSlot, createVNode } from "vue";
29
7
  import { c as createComponent } from "./component.js";
8
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
30
9
  const { componentName, create } = createComponent("backtop");
31
- var _sfc_main = create({
10
+ const _sfc_main = create({
32
11
  props: {
33
- height: {
34
- type: String,
35
- default: "100vh"
36
- },
37
12
  bottom: {
38
13
  type: Number,
39
14
  default: 20
@@ -42,20 +17,35 @@ var _sfc_main = create({
42
17
  type: Number,
43
18
  default: 10
44
19
  },
20
+ elId: {
21
+ type: String,
22
+ default: ""
23
+ },
24
+ distance: {
25
+ type: Number,
26
+ default: 200
27
+ },
45
28
  zIndex: {
46
29
  type: Number,
47
30
  default: 10
48
31
  },
49
- distance: {
32
+ isAnimation: {
33
+ type: Boolean,
34
+ default: true
35
+ },
36
+ duration: {
50
37
  type: Number,
51
- default: 200
38
+ default: 1e3
52
39
  }
53
40
  },
54
41
  emits: ["click"],
55
42
  setup(props, { emit }) {
56
43
  const state = reactive({
57
44
  backTop: false,
58
- scrollTop: 1
45
+ scrollTop: 0,
46
+ scrollEl: window,
47
+ startTime: 0,
48
+ keepAlive: false
59
49
  });
60
50
  const classes = computed(() => {
61
51
  const prefixCls = componentName;
@@ -71,52 +61,99 @@ var _sfc_main = create({
71
61
  zIndex: props.zIndex
72
62
  };
73
63
  });
74
- const scroll = (e) => {
75
- state.scrollTop = 2;
76
- state.backTop = e.detail.scrollTop >= props.distance;
77
- };
78
- const click = (e) => {
79
- state.scrollTop = 1;
64
+ function scrollListener() {
65
+ if (state.scrollEl instanceof Window) {
66
+ state.scrollTop = state.scrollEl.pageYOffset;
67
+ } else {
68
+ state.scrollTop = state.scrollEl.scrollTop;
69
+ }
70
+ state.backTop = state.scrollTop >= props.distance;
71
+ }
72
+ function scroll(y = 0) {
73
+ if (state.scrollEl instanceof Window) {
74
+ window.scrollTo(0, y);
75
+ } else {
76
+ state.scrollEl.scrollTop = y;
77
+ }
78
+ }
79
+ function scrollAnimation() {
80
+ let cid = requestAniFrame()(function fn() {
81
+ var t = props.duration - Math.max(0, state.startTime - +new Date() + props.duration);
82
+ var y = t * -state.scrollTop / props.duration + state.scrollTop;
83
+ scroll(y);
84
+ cid = requestAniFrame()(fn);
85
+ if (t == props.duration || y == 0) {
86
+ window.cancelAnimationFrame(cid);
87
+ }
88
+ });
89
+ }
90
+ function addEventListener() {
91
+ state.scrollEl.addEventListener("scroll", scrollListener, false);
92
+ state.scrollEl.addEventListener("resize", scrollListener, false);
93
+ }
94
+ function removeEventListener() {
95
+ state.scrollEl.removeEventListener("scroll", scrollListener, false);
96
+ state.scrollEl.removeEventListener("resize", scrollListener, false);
97
+ }
98
+ function initCancelAniFrame() {
99
+ window.cancelAnimationFrame = window.webkitCancelAnimationFrame;
100
+ }
101
+ function requestAniFrame() {
102
+ return window.requestAnimationFrame || window.webkitRequestAnimationFrame || function(callback) {
103
+ window.setTimeout(callback, 1e3 / 60);
104
+ };
105
+ }
106
+ function click(e) {
107
+ state.startTime = +new Date();
108
+ props.isAnimation && props.duration > 0 ? scrollAnimation() : scroll();
80
109
  emit("click", e);
81
- };
82
- return __spreadProps(__spreadValues({}, toRefs(state)), {
110
+ }
111
+ function init() {
112
+ if (props.elId && document.getElementById(props.elId)) {
113
+ state.scrollEl = document.getElementById(props.elId);
114
+ }
115
+ addEventListener();
116
+ initCancelAniFrame();
117
+ }
118
+ onMounted(() => {
119
+ init();
120
+ });
121
+ onUnmounted(() => {
122
+ removeEventListener();
123
+ });
124
+ onActivated(() => {
125
+ if (state.keepAlive) {
126
+ state.keepAlive = false;
127
+ init();
128
+ }
129
+ });
130
+ onDeactivated(() => {
131
+ state.keepAlive = true;
132
+ removeEventListener();
133
+ });
134
+ return {
135
+ state,
83
136
  classes,
84
137
  style,
85
- scroll,
86
138
  click
87
- });
139
+ };
88
140
  }
89
141
  });
90
142
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
91
- const _component_scroll_view = resolveComponent("scroll-view");
92
143
  const _component_nut_icon = resolveComponent("nut-icon");
93
- return openBlock(), createElementBlock("view", null, [
94
- createVNode(_component_scroll_view, {
95
- "scroll-y": true,
96
- style: normalizeStyle({ height: _ctx.height }),
97
- onScroll: _ctx.scroll,
98
- "scroll-top": _ctx.scrollTop,
99
- "scroll-with-animation": "true"
100
- }, {
101
- default: withCtx(() => [
102
- renderSlot(_ctx.$slots, "content")
103
- ]),
104
- _: 3
105
- }, 8, ["style", "onScroll", "scroll-top"]),
106
- createElementVNode("view", {
107
- class: normalizeClass(_ctx.classes),
108
- style: normalizeStyle(_ctx.style),
109
- onClick: _cache[0] || (_cache[0] = withModifiers((...args) => _ctx.click && _ctx.click(...args), ["stop"]))
110
- }, [
111
- renderSlot(_ctx.$slots, "icon", {}, () => [
112
- createVNode(_component_nut_icon, {
113
- size: "19px",
114
- class: "nut-backtop-main",
115
- name: "top"
116
- })
117
- ])
118
- ], 6)
119
- ]);
144
+ return openBlock(), createElementBlock("div", {
145
+ class: normalizeClass(_ctx.classes),
146
+ style: normalizeStyle(_ctx.style),
147
+ onClick: _cache[0] || (_cache[0] = withModifiers((...args) => _ctx.click && _ctx.click(...args), ["stop"]))
148
+ }, [
149
+ renderSlot(_ctx.$slots, "default", {}, () => [
150
+ createVNode(_component_nut_icon, {
151
+ size: "19px",
152
+ class: "nut-backtop-main",
153
+ name: "top"
154
+ })
155
+ ])
156
+ ], 6);
120
157
  }
121
- _sfc_main.render = _sfc_render;
122
- export { _sfc_main as default };
158
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
159
+ export { index as default };
@@ -1,12 +1,13 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { reactive, computed, openBlock, createElementBlock, createElementVNode, renderSlot, withDirectives, toDisplayString, normalizeClass, normalizeStyle, vShow } from "vue";
7
7
  import { c as createComponent } from "./component.js";
8
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
8
9
  const { create } = createComponent("badge");
9
- var _sfc_main = create({
10
+ const _sfc_main = create({
10
11
  props: {
11
12
  value: {
12
13
  type: [String, Number]
@@ -85,5 +86,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
85
86
  ])
86
87
  ]);
87
88
  }
88
- _sfc_main.render = _sfc_render;
89
- export { _sfc_main as default };
89
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
90
+ export { index as default };