@nutui/nutui 3.1.18-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 (149) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/LICENSE +1 -1
  3. package/README.md +6 -0
  4. package/dist/nutui.d.ts +39 -36
  5. package/dist/nutui.es.js +13149 -11288
  6. package/dist/nutui.umd.js +13156 -11381
  7. package/dist/packages/_es/ActionSheet.js +13 -19
  8. package/dist/packages/_es/Address.js +70 -55
  9. package/dist/packages/_es/Audio.js +13 -13
  10. package/dist/packages/_es/AudioOperate.js +125 -0
  11. package/dist/packages/_es/Avatar.js +4 -4
  12. package/dist/packages/_es/BackTop.js +69 -108
  13. package/dist/packages/_es/Badge.js +4 -4
  14. package/dist/packages/_es/Barrage.js +63 -56
  15. package/dist/packages/_es/Button.js +3 -3
  16. package/dist/packages/_es/Calendar.js +30 -702
  17. package/dist/packages/_es/CalendarItem.js +10 -0
  18. package/dist/packages/_es/Card.js +7 -6
  19. package/dist/packages/_es/Cascader.js +8 -8
  20. package/dist/packages/_es/Cell.js +27 -27
  21. package/dist/packages/_es/CellGroup.js +2 -2
  22. package/dist/packages/_es/Checkbox.js +4 -4
  23. package/dist/packages/_es/CheckboxGroup.js +3 -3
  24. package/dist/packages/_es/CircleProgress.js +150 -41
  25. package/dist/packages/_es/Col.js +2 -2
  26. package/dist/packages/_es/Collapse.js +35 -9
  27. package/dist/packages/_es/CollapseItem.js +79 -38
  28. package/dist/packages/_es/CountDown.js +8 -6
  29. package/dist/packages/_es/CountUp.js +31 -30
  30. package/dist/packages/_es/DatePicker.js +81 -44
  31. package/dist/packages/_es/Dialog.js +7 -83
  32. package/dist/packages/_es/Divider.js +5 -5
  33. package/dist/packages/_es/Drag.js +93 -55
  34. package/dist/packages/_es/Elevator.js +75 -50
  35. package/dist/packages/_es/Empty.js +4 -4
  36. package/dist/packages/_es/FixedNav.js +6 -6
  37. package/dist/packages/_es/Form.js +11 -9
  38. package/dist/packages/_es/FormItem.js +9 -6
  39. package/dist/packages/_es/Grid.js +2 -2
  40. package/dist/packages/_es/GridItem.js +9 -27
  41. package/dist/packages/_es/Icon.js +2 -2
  42. package/dist/packages/_es/ImagePreview.js +14 -83
  43. package/dist/packages/_es/Indicator.js +4 -4
  44. package/dist/packages/_es/InfiniteLoading.js +94 -108
  45. package/dist/packages/_es/Input.js +297 -73
  46. package/dist/packages/_es/InputNumber.js +24 -17
  47. package/dist/packages/_es/Layout.js +2 -2
  48. package/dist/packages/_es/List.js +131 -0
  49. package/dist/packages/_es/Menu.js +16 -13
  50. package/dist/packages/_es/MenuItem.js +8 -8
  51. package/dist/packages/_es/Navbar.js +17 -12
  52. package/dist/packages/_es/NoticeBar.js +47 -39
  53. package/dist/packages/_es/Notify.js +28 -163
  54. package/dist/packages/_es/NumberKeyboard.js +4 -4
  55. package/dist/packages/_es/OldPicker.js +486 -0
  56. package/dist/packages/_es/OverLay.js +6 -26
  57. package/dist/packages/_es/Pagination.js +8 -8
  58. package/dist/packages/_es/Picker.js +192 -163
  59. package/dist/packages/_es/Popover.js +155 -30
  60. package/dist/packages/_es/Popup.js +7 -70
  61. package/dist/packages/_es/Price.js +18 -6
  62. package/dist/packages/_es/Progress.js +29 -27
  63. package/dist/packages/_es/PullRefresh.js +363 -0
  64. package/dist/packages/_es/Radio.js +4 -4
  65. package/dist/packages/_es/RadioGroup.js +2 -2
  66. package/dist/packages/_es/Range.js +169 -46
  67. package/dist/packages/_es/Rate.js +17 -20
  68. package/dist/packages/_es/Row.js +2 -2
  69. package/dist/packages/_es/SearchBar.js +9 -7
  70. package/dist/packages/_es/ShortPassword.js +90 -68
  71. package/dist/packages/_es/SideNavBar.js +6 -17
  72. package/dist/packages/_es/SideNavBarItem.js +2 -2
  73. package/dist/packages/_es/Signature.js +70 -70
  74. package/dist/packages/_es/Skeleton.js +9 -12
  75. package/dist/packages/_es/Sku.js +40 -31
  76. package/dist/packages/_es/Step.js +28 -12
  77. package/dist/packages/_es/Steps.js +8 -3
  78. package/dist/packages/_es/Sticky.js +29 -24
  79. package/dist/packages/_es/SubSideNavBar.js +2 -2
  80. package/dist/packages/_es/Swipe.js +40 -27
  81. package/dist/packages/_es/Swiper.js +32 -14
  82. package/dist/packages/_es/SwiperItem.js +2 -2
  83. package/dist/packages/_es/Switch.js +4 -4
  84. package/dist/packages/_es/TabPane.js +2 -2
  85. package/dist/packages/_es/Tabbar.js +4 -4
  86. package/dist/packages/_es/TabbarItem.js +28 -23
  87. package/dist/packages/_es/Table.js +14 -14
  88. package/dist/packages/_es/Tabs.js +19 -15
  89. package/dist/packages/_es/Tag.js +14 -8
  90. package/dist/packages/_es/TextArea.js +49 -15
  91. package/dist/packages/_es/TimeDetail.js +5 -4
  92. package/dist/packages/_es/TimePannel.js +4 -4
  93. package/dist/packages/_es/TimeSelect.js +9 -8
  94. package/dist/packages/_es/Toast.js +42 -171
  95. package/dist/packages/_es/Uploader.js +108 -139
  96. package/dist/packages/_es/Video.js +14 -10
  97. package/dist/packages/_es/common.js +2 -2
  98. package/dist/packages/_es/component.js +2 -2
  99. package/dist/packages/_es/index.js +45 -7
  100. package/dist/packages/_es/index.taro.js +719 -0
  101. package/dist/packages/_es/index2.js +2 -2
  102. package/dist/packages/_es/index3.js +57 -29
  103. package/dist/packages/_es/index4.js +414 -57
  104. package/dist/packages/_es/plugin-vue_export-helper.js +2 -2
  105. package/dist/packages/_es/pxCheck.js +2 -2
  106. package/dist/packages/_es/use-lock-scroll.js +23 -0
  107. package/dist/packages/_es/util.js +2 -2
  108. package/dist/packages/badge/index.scss +11 -13
  109. package/dist/packages/button/index.scss +1 -0
  110. package/dist/packages/calendar/index.scss +9 -4
  111. package/dist/packages/calendaritem/index.scss +0 -207
  112. package/dist/packages/cell/index.scss +6 -6
  113. package/dist/packages/checkbox/index.scss +4 -3
  114. package/dist/packages/collapseitem/index.scss +21 -11
  115. package/dist/packages/countdown/index.scss +3 -1
  116. package/dist/packages/divider/index.scss +8 -8
  117. package/dist/packages/elevator/index.scss +36 -36
  118. package/dist/packages/formitem/index.scss +15 -8
  119. package/dist/packages/indicator/index.scss +1 -1
  120. package/dist/packages/input/index.scss +70 -24
  121. package/dist/packages/inputnumber/index.scss +4 -2
  122. package/dist/packages/list/index.scss +24 -0
  123. package/dist/packages/menu/index.scss +3 -3
  124. package/dist/packages/navbar/index.scss +28 -8
  125. package/dist/packages/noticebar/index.scss +7 -8
  126. package/dist/packages/notify/index.scss +9 -0
  127. package/dist/packages/numberkeyboard/index.scss +22 -21
  128. package/dist/packages/oldpicker/index.scss +131 -0
  129. package/dist/packages/picker/index.scss +38 -32
  130. package/dist/packages/progress/index.scss +6 -5
  131. package/dist/packages/radio/index.scss +7 -6
  132. package/dist/packages/range/index.scss +109 -2
  133. package/dist/packages/searchbar/index.scss +7 -7
  134. package/dist/packages/sidenavbaritem/index.scss +5 -5
  135. package/dist/packages/step/index.scss +29 -29
  136. package/dist/packages/subsidenavbar/index.scss +10 -8
  137. package/dist/packages/tabbaritem/index.scss +15 -0
  138. package/dist/packages/timedetail/index.scss +13 -13
  139. package/dist/packages/timepannel/index.scss +7 -7
  140. package/dist/packages/timeselect/index.scss +3 -3
  141. package/dist/packages/uploader/index.scss +6 -6
  142. package/dist/style.css +1 -1
  143. package/dist/styles/themes/default.scss +64 -62
  144. package/dist/styles/themes/jdt.scss +91 -0
  145. package/dist/styles/variables-jdt.scss +728 -0
  146. package/dist/styles/variables.scss +250 -44
  147. package/package.json +2 -1
  148. package/dist/packages/_es/raf.js +0 -19
  149. package/dist/styles/themes/jdd.scss +0 -2
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.18-beta.0 Tue Mar 08 2022 10:41:31 GMT+0800 (中国标准时间)
3
- * (c) 2021 @jdf2e.
2
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
3
+ * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { resolveComponent, openBlock, createElementBlock, createElementVNode, renderSlot, createBlock, createCommentVNode, toDisplayString, ref, watch, onMounted, Fragment, renderList, normalizeClass, createVNode, withCtx, createSlots } from "vue";
@@ -68,13 +68,13 @@ const _sfc_main$3 = create$3({
68
68
  skuInfo.value = [].slice.call(props.sku);
69
69
  }
70
70
  });
71
- const changeSaleChild = (attrItem, index2, parentItem, parentIndex) => {
71
+ const changeSaleChild = (attrItem, index, parentItem, parentIndex) => {
72
72
  if (attrItem.checkFlag || attrItem.disable) {
73
73
  return;
74
74
  }
75
75
  emit("selectSku", {
76
76
  sku: attrItem,
77
- skuIndex: index2,
77
+ skuIndex: index,
78
78
  parentSku: parentItem,
79
79
  parentIndex
80
80
  });
@@ -91,7 +91,7 @@ const _hoisted_3$2 = { class: "nut-sku-select-item-skus" };
91
91
  const _hoisted_4$2 = ["onClick"];
92
92
  function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
93
93
  return openBlock(), createElementBlock("view", _hoisted_1$3, [
94
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.skuInfo, (item, index2) => {
94
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.skuInfo, (item, index) => {
95
95
  return openBlock(), createElementBlock("view", {
96
96
  class: "nut-sku-select-item",
97
97
  key: item.id
@@ -101,7 +101,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
101
101
  (openBlock(true), createElementBlock(Fragment, null, renderList(item.list, (itemAttr, itemAttrIndex) => {
102
102
  return openBlock(), createElementBlock("view", {
103
103
  class: normalizeClass(["nut-sku-select-item-skus-sku", [{ active: !itemAttr.disable && itemAttr.active }, { disable: itemAttr.disable }]]),
104
- onClick: ($event) => _ctx.changeSaleChild(itemAttr, itemAttrIndex, item, index2),
104
+ onClick: ($event) => _ctx.changeSaleChild(itemAttr, itemAttrIndex, item, index),
105
105
  key: itemAttr.name
106
106
  }, toDisplayString(itemAttr.name), 11, _hoisted_4$2);
107
107
  }), 128))
@@ -232,9 +232,6 @@ const _sfc_main$1 = create$1({
232
232
  };
233
233
  return mapD[type];
234
234
  };
235
- onMounted(() => {
236
- console.log(slots);
237
- });
238
235
  const getSlots = (name) => slots[name];
239
236
  const clickBtnOperate = (btn) => {
240
237
  emit("clickBtnOperate", btn);
@@ -291,6 +288,10 @@ const _sfc_main = create({
291
288
  type: Object,
292
289
  default: {}
293
290
  },
291
+ showSaleLimit: {
292
+ type: Boolean,
293
+ default: false
294
+ },
294
295
  stepperMax: {
295
296
  type: [Number, String],
296
297
  default: 99999
@@ -299,6 +300,14 @@ const _sfc_main = create({
299
300
  type: [Number, String],
300
301
  default: 1
301
302
  },
303
+ purchased: {
304
+ type: [Number, String],
305
+ default: 0
306
+ },
307
+ showSaleLowest: {
308
+ type: Boolean,
309
+ default: false
310
+ },
302
311
  btnOptions: {
303
312
  type: Array,
304
313
  default: () => ["confirm"]
@@ -307,13 +316,17 @@ const _sfc_main = create({
307
316
  type: String,
308
317
  default: "\u8D2D\u4E70\u6570\u91CF"
309
318
  },
310
- stepperExtraText: {
319
+ saleLowestText: {
311
320
  type: [Function, Boolean],
312
321
  default: false
313
322
  },
314
- btnExtraText: {
315
- type: String,
316
- default: ""
323
+ saleLimitText: {
324
+ type: [Function, Boolean],
325
+ default: false
326
+ },
327
+ purchasedText: {
328
+ type: [Function, Boolean],
329
+ default: false
317
330
  },
318
331
  buyText: {
319
332
  type: String,
@@ -338,8 +351,7 @@ const _sfc_main = create({
338
351
  "close",
339
352
  "reduce",
340
353
  "add",
341
- "overLimit",
342
- "clickOverlay"
354
+ "overLimit"
343
355
  ],
344
356
  components: {
345
357
  SkuHeader,
@@ -358,8 +370,6 @@ const _sfc_main = create({
358
370
  close();
359
371
  }
360
372
  });
361
- onMounted(() => {
362
- });
363
373
  const getSlots = (name) => slots[name];
364
374
  const selectSku = (skus) => {
365
375
  emit("selectSku", skus);
@@ -465,33 +475,32 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
465
475
  stepperTitle: _ctx.stepperTitle,
466
476
  stepperMax: _ctx.stepperMax,
467
477
  stepperMin: _ctx.stepperMin,
468
- stepperExtraText: _ctx.stepperExtraText,
478
+ purchased: _ctx.purchased,
479
+ showSaleLimit: _ctx.showSaleLimit,
480
+ showSaleLowest: _ctx.showSaleLowest,
481
+ saleLowestText: _ctx.saleLowestText,
482
+ saleLimitText: _ctx.saleLimitText,
483
+ purchasedText: _ctx.purchasedText,
469
484
  onAdd: _ctx.add,
470
485
  onReduce: _ctx.reduce,
471
486
  onChangeStepper: _ctx.changeStepper,
472
487
  onOverLimit: _ctx.stepperOverLimit
473
- }, null, 8, ["goods", "stepperTitle", "stepperMax", "stepperMin", "stepperExtraText", "onAdd", "onReduce", "onChangeStepper", "onOverLimit"])) : createCommentVNode("", true),
488
+ }, null, 8, ["goods", "stepperTitle", "stepperMax", "stepperMin", "purchased", "showSaleLimit", "showSaleLowest", "saleLowestText", "saleLimitText", "purchasedText", "onAdd", "onReduce", "onChangeStepper", "onOverLimit"])) : createCommentVNode("", true),
474
489
  renderSlot(_ctx.$slots, "sku-stepper-bottom")
475
490
  ]),
476
- createVNode(_component_sku_operate, {
491
+ renderSlot(_ctx.$slots, "sku-operate"),
492
+ !_ctx.getSlots("sku-operate") ? (openBlock(), createBlock(_component_sku_operate, {
493
+ key: 1,
477
494
  btnOptions: _ctx.btnOptions,
478
- btnExtraText: _ctx.btnExtraText,
479
495
  buyText: _ctx.buyText,
480
496
  addCartText: _ctx.addCartText,
481
497
  confirmText: _ctx.confirmText,
482
498
  onClickBtnOperate: _ctx.clickBtnOperate
483
- }, createSlots({ _: 2 }, [
484
- _ctx.getSlots("sku-operate") ? {
485
- name: "operate-btn",
486
- fn: withCtx(() => [
487
- renderSlot(_ctx.$slots, "sku-operate")
488
- ])
489
- } : void 0
490
- ]), 1032, ["btnOptions", "btnExtraText", "buyText", "addCartText", "confirmText", "onClickBtnOperate"])
499
+ }, null, 8, ["btnOptions", "buyText", "addCartText", "confirmText", "onClickBtnOperate"])) : createCommentVNode("", true)
491
500
  ])
492
501
  ]),
493
502
  _: 3
494
503
  }, 8, ["visible"]);
495
504
  }
496
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
497
- export { index as default };
505
+ var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
506
+ export { index_taro as default };
@@ -18,11 +18,11 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.18-beta.0 Tue Mar 08 2022 10:41:31 GMT+0800 (中国标准时间)
22
- * (c) 2021 @jdf2e.
21
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
22
+ * (c) 2022 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
25
- import { getCurrentInstance, inject, reactive, computed, toRefs, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, createBlock, Fragment, toDisplayString, createCommentVNode } from "vue";
25
+ import { getCurrentInstance, inject, reactive, computed, toRefs, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, createBlock, Fragment, toDisplayString, createCommentVNode, renderSlot } from "vue";
26
26
  import { c as createComponent } from "./component.js";
27
27
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
28
28
  const { create, componentName } = createComponent("step");
@@ -49,6 +49,7 @@ const _sfc_main = create({
49
49
  default: "12px"
50
50
  }
51
51
  },
52
+ emits: ["click-step"],
52
53
  setup(props, { emit, slots }) {
53
54
  const { proxy } = getCurrentInstance();
54
55
  const parent = inject("parent");
@@ -73,9 +74,13 @@ const _sfc_main = create({
73
74
  [`${prefixCls}-${status.value}`]: true
74
75
  };
75
76
  });
77
+ const handleClickStep = () => {
78
+ parent["onEmit"](index2.value);
79
+ };
76
80
  return __spreadProps(__spreadValues({}, toRefs(state)), {
77
81
  index: index2,
78
- classes
82
+ classes,
83
+ handleClickStep
79
84
  });
80
85
  }
81
86
  });
@@ -87,11 +92,17 @@ const _hoisted_3 = {
87
92
  };
88
93
  const _hoisted_4 = { class: "nut-step-main" };
89
94
  const _hoisted_5 = { class: "nut-step-title" };
90
- const _hoisted_6 = ["innerHTML"];
95
+ const _hoisted_6 = { key: 0 };
96
+ const _hoisted_7 = {
97
+ key: 0,
98
+ class: "nut-step-content"
99
+ };
100
+ const _hoisted_8 = ["innerHTML"];
91
101
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
92
102
  const _component_nut_icon = resolveComponent("nut-icon");
93
103
  return openBlock(), createElementBlock("view", {
94
- class: normalizeClass(_ctx.classes)
104
+ class: normalizeClass(_ctx.classes),
105
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClickStep && _ctx.handleClickStep(...args))
95
106
  }, [
96
107
  createElementVNode("view", _hoisted_1, [
97
108
  _hoisted_2,
@@ -108,12 +119,17 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
108
119
  ], 2)
109
120
  ]),
110
121
  createElementVNode("view", _hoisted_4, [
111
- createElementVNode("view", _hoisted_5, toDisplayString(_ctx.title), 1),
112
- _ctx.content ? (openBlock(), createElementBlock("view", {
113
- key: 0,
114
- class: "nut-step-content",
115
- innerHTML: _ctx.content
116
- }, null, 8, _hoisted_6)) : createCommentVNode("", true)
122
+ createElementVNode("view", _hoisted_5, [
123
+ !_ctx.$slots.title ? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true),
124
+ renderSlot(_ctx.$slots, "title")
125
+ ]),
126
+ _ctx.content || _ctx.$slots.content ? (openBlock(), createElementBlock("view", _hoisted_7, [
127
+ !_ctx.$slots.content ? (openBlock(), createElementBlock("span", {
128
+ key: 0,
129
+ innerHTML: _ctx.content
130
+ }, null, 8, _hoisted_8)) : createCommentVNode("", true),
131
+ renderSlot(_ctx.$slots, "content")
132
+ ])) : createCommentVNode("", true)
117
133
  ])
118
134
  ], 2);
119
135
  }
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.18-beta.0 Tue Mar 08 2022 10:41:31 GMT+0800 (中国标准时间)
3
- * (c) 2021 @jdf2e.
2
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
3
+ * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { reactive, computed, provide, h } from "vue";
@@ -21,6 +21,7 @@ const _sfc_main = create({
21
21
  default: false
22
22
  }
23
23
  },
24
+ emits: ["click-step"],
24
25
  setup(props, { emit, slots }) {
25
26
  const state = reactive({
26
27
  children: []
@@ -36,10 +37,14 @@ const _sfc_main = create({
36
37
  const relation = (child) => {
37
38
  child && state.children.push(child);
38
39
  };
40
+ const onEmit = (index) => {
41
+ emit("click-step", index);
42
+ };
39
43
  provide("parent", {
40
44
  relation,
41
45
  state,
42
- props
46
+ props,
47
+ onEmit
43
48
  });
44
49
  return () => {
45
50
  var _a;
@@ -1,11 +1,12 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.18-beta.0 Tue Mar 08 2022 10:41:31 GMT+0800 (中国标准时间)
3
- * (c) 2021 @jdf2e.
2
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
3
+ * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { ref, reactive, computed, watch, onMounted, onUnmounted, h, unref } from "vue";
6
+ import { ref, reactive, computed, watch, h, unref } from "vue";
7
+ import Taro from "@tarojs/taro";
7
8
  import { c as createComponent } from "./component.js";
8
- import { u as useRect } from "./index3.js";
9
+ import { u as useTaroRect } from "./index.js";
9
10
  const { componentName, create } = createComponent("sticky");
10
11
  const _sfc_main = create({
11
12
  props: {
@@ -32,6 +33,8 @@ const _sfc_main = create({
32
33
  emits: ["change", "scroll"],
33
34
  setup(props, { emit, slots }) {
34
35
  const root = ref();
36
+ const query = Taro.createSelectorQuery();
37
+ const refRandomId = Math.random().toString(36).slice(-8);
35
38
  const state = reactive({
36
39
  width: 0,
37
40
  height: 0,
@@ -67,19 +70,22 @@ const _sfc_main = create({
67
70
  const el = unref(elementRef);
68
71
  if (!el)
69
72
  return false;
70
- const style = window.getComputedStyle(el);
71
- const hidden = style.display === "none";
72
- const parentHidden = el.offsetParent === null && style.position !== "fixed";
73
- return hidden || parentHidden;
73
+ return new Promise((resolve, reject) => {
74
+ query.select(`#${el.id}`).fields({
75
+ computedStyle: ["display", "position"]
76
+ }, (res) => {
77
+ const hidden = res.display === "none";
78
+ const parentHidden = el.offsetParent === null && res.position !== "fixed";
79
+ resolve(hidden || parentHidden);
80
+ }).exec();
81
+ });
74
82
  };
75
- const isExistRoot = () => {
76
- if (!root.value || isHidden(root))
83
+ const isExistRoot = async () => {
84
+ const hidden = await isHidden(root);
85
+ if (!root.value || hidden)
77
86
  return false;
78
87
  return true;
79
88
  };
80
- const getScrollTop = (el) => {
81
- return Math.max(0, "scrollTop" in el ? el.scrollTop : el.pageYOffset);
82
- };
83
89
  const renderFixed = () => {
84
90
  var _a;
85
91
  return h("view", {
@@ -87,19 +93,18 @@ const _sfc_main = create({
87
93
  class: state.fixed ? `${componentName} nut-sticky--fixed` : componentName
88
94
  }, (_a = slots.default) == null ? void 0 : _a.call(slots));
89
95
  };
90
- const onScroll = () => {
96
+ const onScroll = async (scrollTop) => {
91
97
  if (!isExistRoot())
92
98
  return;
93
99
  const { container, position } = props;
94
- const scrollTop = getScrollTop(window);
95
- const rootRect = useRect(root);
100
+ const rootRect = await useTaroRect(root, Taro);
96
101
  if (rootRect.width || rootRect.height) {
97
102
  state.width = rootRect.width;
98
103
  state.height = rootRect.height;
99
104
  }
100
105
  if (position === "top") {
101
106
  if (container) {
102
- const containerRect = useRect(container);
107
+ const containerRect = await useTaroRect(container, Taro);
103
108
  const diff = containerRect.bottom - +offset.value - state.height;
104
109
  state.fixed = +offset.value > rootRect.top && containerRect.bottom > 0;
105
110
  state.transform = diff < 0 ? diff : 0;
@@ -107,9 +112,9 @@ const _sfc_main = create({
107
112
  state.fixed = offset.value > rootRect.top;
108
113
  }
109
114
  } else if (position === "bottom") {
110
- const clientHeight = document.documentElement.clientHeight;
115
+ const clientHeight = Taro.getSystemInfoSync().windowHeight;
111
116
  if (container) {
112
- const containerRect = useRect(container);
117
+ const containerRect = await useTaroRect(container, Taro);
113
118
  const diff = clientHeight - containerRect.top - +offset.value - state.height;
114
119
  state.fixed = clientHeight - +offset.value < rootRect.bottom && clientHeight > containerRect.top;
115
120
  state.transform = diff < 0 ? -diff : 0;
@@ -125,16 +130,16 @@ const _sfc_main = create({
125
130
  watch(() => state.fixed, (val) => {
126
131
  emit("change", val);
127
132
  });
128
- onMounted(() => {
129
- window.addEventListener("scroll", onScroll);
130
- onScroll();
133
+ Taro.usePageScroll((res) => {
134
+ onScroll(res.scrollTop);
131
135
  });
132
- onUnmounted(() => {
133
- window.removeEventListener("scroll", onScroll);
136
+ Taro.useReady(() => {
137
+ onScroll(0);
134
138
  });
135
139
  return () => {
136
140
  return h("view", {
137
141
  style: rootStyle.value,
142
+ id: `root-${refRandomId}`,
138
143
  ref: root
139
144
  }, [renderFixed()]);
140
145
  };
@@ -18,8 +18,8 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.18-beta.0 Tue Mar 08 2022 10:41:31 GMT+0800 (中国标准时间)
22
- * (c) 2021 @jdf2e.
21
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
22
+ * (c) 2022 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
25
25
  import { reactive, computed, onMounted, toRefs, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, withModifiers, toDisplayString, createVNode, normalizeStyle, renderSlot } from "vue";
@@ -18,13 +18,15 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.18-beta.0 Tue Mar 08 2022 10:41:31 GMT+0800 (中国标准时间)
22
- * (c) 2021 @jdf2e.
21
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
22
+ * (c) 2022 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
25
- import { u as useTouch } from "./index4.js";
26
- import { computed, ref, reactive, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, renderSlot } from "vue";
25
+ import Taro from "@tarojs/taro";
26
+ import { u as useTouch } from "./index3.js";
27
+ import { computed, ref, onMounted, reactive, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, renderSlot } from "vue";
27
28
  import { c as createComponent } from "./component.js";
29
+ import { u as useTaroRect } from "./index.js";
28
30
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
29
31
  const { componentName, create } = createComponent("swipe");
30
32
  const _sfc_main = create({
@@ -48,21 +50,29 @@ const _sfc_main = create({
48
50
  },
49
51
  emits: ["open", "close"],
50
52
  setup(props, { emit }) {
53
+ const refRandomId = Math.random().toString(36).slice(-8);
51
54
  const classes = computed(() => {
52
55
  const prefixCls = componentName;
53
56
  return {
54
57
  [prefixCls]: true
55
58
  };
56
59
  });
57
- const getRefWidth = (ref2) => {
58
- var _a;
59
- return ((_a = ref2.value) == null ? void 0 : _a.clientWidth) || 0;
60
+ const getRefWidth = async (ref2) => {
61
+ let rect = await useTaroRect(ref2, Taro);
62
+ return rect.width || 0;
60
63
  };
61
- const leftRef = ref(), leftRefWidth = computed(() => {
62
- return getRefWidth(leftRef);
63
- });
64
- const rightRef = ref(), rightRefWidth = computed(() => {
65
- return getRefWidth(rightRef);
64
+ const leftRef = ref();
65
+ const leftRefWidth = ref(0);
66
+ const rightRef = ref();
67
+ const rightRefWidth = ref(0);
68
+ const initWidth = async () => {
69
+ leftRefWidth.value = await getRefWidth(leftRef);
70
+ rightRefWidth.value = await getRefWidth(rightRef);
71
+ };
72
+ onMounted(() => {
73
+ setTimeout(() => {
74
+ initWidth();
75
+ }, 100);
66
76
  });
67
77
  let opened = false;
68
78
  let position = "";
@@ -122,7 +132,7 @@ const _sfc_main = create({
122
132
  return;
123
133
  touch.start(event);
124
134
  },
125
- onTouchMove(event) {
135
+ async onTouchMove(event) {
126
136
  if (props.disabled)
127
137
  return;
128
138
  touch.move(event);
@@ -168,20 +178,15 @@ const _sfc_main = create({
168
178
  }, touchMethods), {
169
179
  leftRef,
170
180
  rightRef,
181
+ refRandomId,
171
182
  open,
172
183
  close
173
184
  });
174
185
  }
175
186
  });
176
- const _hoisted_1 = {
177
- class: "nut-swipe__left",
178
- ref: "leftRef"
179
- };
187
+ const _hoisted_1 = ["id"];
180
188
  const _hoisted_2 = { class: "nut-swipe__content" };
181
- const _hoisted_3 = {
182
- class: "nut-swipe__right",
183
- ref: "rightRef"
184
- };
189
+ const _hoisted_3 = ["id"];
185
190
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
186
191
  return openBlock(), createElementBlock("view", {
187
192
  class: normalizeClass(_ctx.classes),
@@ -191,16 +196,24 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
191
196
  onTouchend: _cache[2] || (_cache[2] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args)),
192
197
  onTouchcancel: _cache[3] || (_cache[3] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args))
193
198
  }, [
194
- createElementVNode("view", _hoisted_1, [
199
+ createElementVNode("view", {
200
+ class: "nut-swipe__left",
201
+ ref: "leftRef",
202
+ id: "leftRef-" + _ctx.refRandomId
203
+ }, [
195
204
  renderSlot(_ctx.$slots, "left")
196
- ], 512),
205
+ ], 8, _hoisted_1),
197
206
  createElementVNode("view", _hoisted_2, [
198
207
  renderSlot(_ctx.$slots, "default")
199
208
  ]),
200
- createElementVNode("view", _hoisted_3, [
209
+ createElementVNode("view", {
210
+ class: "nut-swipe__right",
211
+ ref: "rightRef",
212
+ id: "rightRef-" + _ctx.refRandomId
213
+ }, [
201
214
  renderSlot(_ctx.$slots, "right")
202
- ], 512)
215
+ ], 8, _hoisted_3)
203
216
  ], 38);
204
217
  }
205
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
206
- export { index as default };
218
+ var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
219
+ export { index_taro as default };
@@ -1,11 +1,13 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.18-beta.0 Tue Mar 08 2022 10:41:31 GMT+0800 (中国标准时间)
3
- * (c) 2021 @jdf2e.
2
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
3
+ * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { reactive, ref, computed, provide, onMounted, nextTick, onActivated, onDeactivated, onBeforeUnmount, watch, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, renderSlot, Fragment, renderList, createCommentVNode } from "vue";
6
+ import { reactive, ref, computed, provide, onMounted, onActivated, onDeactivated, onBeforeUnmount, watch, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, renderSlot, Fragment, renderList, createCommentVNode } from "vue";
7
7
  import { c as createComponent } from "./component.js";
8
+ import { u as useTaroRect } from "./index.js";
8
9
  import { u as useExpose } from "./index2.js";
10
+ import Taro, { eventCenter, getCurrentInstance } from "@tarojs/taro";
9
11
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
10
12
  const DISTANCE = 5;
11
13
  function useTouch() {
@@ -110,6 +112,7 @@ const _sfc_main = create({
110
112
  emits: ["change"],
111
113
  setup(props, { emit, slots }) {
112
114
  const container = ref();
115
+ const refRandomId = Math.random().toString(36).slice(-8);
113
116
  const state = reactive({
114
117
  active: 0,
115
118
  num: 0,
@@ -165,7 +168,7 @@ const _sfc_main = create({
165
168
  return Math.min(Math.max(num, min), max);
166
169
  };
167
170
  const requestFrame = (fn) => {
168
- window.requestAnimationFrame.call(window, fn);
171
+ requestAnimationFrame.call(null, fn);
169
172
  };
170
173
  const getOffset = (active, offset = 0) => {
171
174
  let currentPosition = active * size.value;
@@ -277,9 +280,9 @@ const _sfc_main = create({
277
280
  autoplay();
278
281
  }, Number(props.autoPlay));
279
282
  };
280
- const init = (active = +props.initPage) => {
283
+ const init = async (active = +props.initPage) => {
281
284
  stopAutoPlay();
282
- state.rect = container.value.getBoundingClientRect();
285
+ state.rect = await useTaroRect(container, Taro);
283
286
  active = Math.min(childCount.value - 1, active);
284
287
  state.width = props.width ? +props.width : state.rect.width;
285
288
  state.height = props.height ? +props.height : state.rect.height;
@@ -346,14 +349,26 @@ const _sfc_main = create({
346
349
  to
347
350
  });
348
351
  onMounted(() => {
349
- nextTick(() => {
352
+ if (Taro.getEnv() === "WEB") {
350
353
  init();
351
- });
354
+ } else {
355
+ Taro.nextTick(async () => {
356
+ state.rect = await useTaroRect(container, Taro);
357
+ state.rect && init();
358
+ });
359
+ eventCenter.once(getCurrentInstance().router.onReady, () => {
360
+ init();
361
+ });
362
+ }
352
363
  });
353
364
  onActivated(() => {
354
- nextTick(() => {
365
+ if (Taro.getEnv() === "WEB") {
355
366
  init();
356
- });
367
+ } else {
368
+ eventCenter.once(getCurrentInstance().router.onReady, () => {
369
+ init();
370
+ });
371
+ }
357
372
  });
358
373
  onDeactivated(() => {
359
374
  stopAutoPlay();
@@ -362,12 +377,12 @@ const _sfc_main = create({
362
377
  stopAutoPlay();
363
378
  });
364
379
  watch(() => props.initPage, (val) => {
365
- nextTick(() => {
366
- init(Number(val));
380
+ eventCenter.once(getCurrentInstance().router.onReady, () => {
381
+ init(+val);
367
382
  });
368
383
  });
369
384
  watch(() => state.children.length, () => {
370
- nextTick(() => {
385
+ eventCenter.once(getCurrentInstance().router.onReady, () => {
371
386
  init(state.active);
372
387
  });
373
388
  });
@@ -376,6 +391,7 @@ const _sfc_main = create({
376
391
  });
377
392
  return {
378
393
  state,
394
+ refRandomId,
379
395
  classes,
380
396
  container,
381
397
  componentName,
@@ -388,9 +404,11 @@ const _sfc_main = create({
388
404
  };
389
405
  }
390
406
  });
407
+ const _hoisted_1 = ["id"];
391
408
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
392
409
  return openBlock(), createElementBlock("view", {
393
410
  ref: "container",
411
+ id: "container-" + _ctx.refRandomId,
394
412
  class: normalizeClass(_ctx.classes),
395
413
  onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args)),
396
414
  onTouchmove: _cache[1] || (_cache[1] = (...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args)),
@@ -423,7 +441,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
423
441
  }, null, 4);
424
442
  }), 128))
425
443
  ], 2)) : createCommentVNode("", true)
426
- ], 34);
444
+ ], 42, _hoisted_1);
427
445
  }
428
446
  var Swiper = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
429
447
  export { Swiper as default };
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.18-beta.0 Tue Mar 08 2022 10:41:31 GMT+0800 (中国标准时间)
3
- * (c) 2021 @jdf2e.
2
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
3
+ * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { inject, getCurrentInstance, reactive, computed, openBlock, createElementBlock, normalizeClass, normalizeStyle, renderSlot } from "vue";