@nutui/nutui 3.1.12-beta.1 → 3.1.14

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 (131) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/README.md +139 -37
  3. package/dist/nutui.d.ts +9 -2
  4. package/dist/nutui.es.js +4830 -2950
  5. package/dist/nutui.umd.js +4910 -2953
  6. package/dist/packages/_es/ActionSheet.js +12 -13
  7. package/dist/packages/_es/Address.js +64 -77
  8. package/dist/packages/_es/Avatar.js +5 -4
  9. package/dist/packages/_es/BackTop.js +109 -72
  10. package/dist/packages/_es/Badge.js +5 -4
  11. package/dist/packages/_es/Barrage.js +57 -63
  12. package/dist/packages/_es/Button.js +6 -5
  13. package/dist/packages/_es/Calendar.js +18 -27
  14. package/dist/packages/_es/Card.js +8 -7
  15. package/dist/packages/_es/Cascader.js +547 -0
  16. package/dist/packages/_es/Cell.js +13 -5
  17. package/dist/packages/_es/CellGroup.js +14 -7
  18. package/dist/packages/_es/Checkbox.js +3 -3
  19. package/dist/packages/_es/CheckboxGroup.js +4 -9
  20. package/dist/packages/_es/CircleProgress.js +46 -142
  21. package/dist/packages/_es/Col.js +5 -4
  22. package/dist/packages/_es/Collapse.js +10 -35
  23. package/dist/packages/_es/CollapseItem.js +35 -80
  24. package/dist/packages/_es/CountDown.js +7 -10
  25. package/dist/packages/_es/CountUp.js +33 -34
  26. package/dist/packages/_es/DatePicker.js +219 -451
  27. package/dist/packages/_es/Dialog.js +98 -46
  28. package/dist/packages/_es/Divider.js +6 -5
  29. package/dist/packages/_es/Drag.js +50 -76
  30. package/dist/packages/_es/Elevator.js +53 -81
  31. package/dist/packages/_es/Empty.js +74 -0
  32. package/dist/packages/_es/FixedNav.js +9 -8
  33. package/dist/packages/_es/Form.js +23 -9
  34. package/dist/packages/_es/FormItem.js +5 -4
  35. package/dist/packages/_es/Grid.js +12 -0
  36. package/dist/packages/_es/GridItem.js +149 -0
  37. package/dist/packages/_es/Icon.js +40 -6
  38. package/dist/packages/_es/ImagePreview.js +158 -44
  39. package/dist/packages/_es/Indicator.js +66 -0
  40. package/dist/packages/_es/InfiniteLoading.js +109 -95
  41. package/dist/packages/_es/Input.js +21 -22
  42. package/dist/packages/_es/InputNumber.js +18 -24
  43. package/dist/packages/_es/Layout.js +2 -2
  44. package/dist/packages/_es/Menu.js +14 -16
  45. package/dist/packages/_es/MenuItem.js +11 -9
  46. package/dist/packages/_es/Navbar.js +7 -7
  47. package/dist/packages/_es/NoticeBar.js +31 -46
  48. package/dist/packages/_es/Notify.js +166 -30
  49. package/dist/packages/_es/NumberKeyboard.js +7 -9
  50. package/dist/packages/_es/OverLay.js +29 -22
  51. package/dist/packages/_es/Pagination.js +9 -8
  52. package/dist/packages/_es/Picker.js +447 -61
  53. package/dist/packages/_es/Popover.js +34 -161
  54. package/dist/packages/_es/Popup.js +77 -17
  55. package/dist/packages/_es/Price.js +7 -18
  56. package/dist/packages/_es/Progress.js +12 -23
  57. package/dist/packages/_es/Radio.js +3 -3
  58. package/dist/packages/_es/RadioGroup.js +2 -2
  59. package/dist/packages/_es/Range.js +31 -38
  60. package/dist/packages/_es/Rate.js +35 -17
  61. package/dist/packages/_es/Row.js +5 -4
  62. package/dist/packages/_es/SearchBar.js +5 -7
  63. package/dist/packages/_es/ShortPassword.js +59 -89
  64. package/dist/packages/_es/Signature.js +71 -70
  65. package/dist/packages/_es/Skeleton.js +138 -0
  66. package/dist/packages/_es/Sku.js +43 -53
  67. package/dist/packages/_es/Step.js +8 -10
  68. package/dist/packages/_es/Steps.js +2 -2
  69. package/dist/packages/_es/Swipe.js +28 -43
  70. package/dist/packages/_es/Swiper.js +418 -17
  71. package/dist/packages/_es/SwiperItem.js +39 -14
  72. package/dist/packages/_es/Switch.js +47 -16
  73. package/dist/packages/_es/TabPane.js +5 -4
  74. package/dist/packages/_es/Tabbar.js +5 -4
  75. package/dist/packages/_es/TabbarItem.js +9 -8
  76. package/dist/packages/_es/Table.js +191 -0
  77. package/dist/packages/_es/Tabs.js +21 -23
  78. package/dist/packages/_es/Tag.js +6 -5
  79. package/dist/packages/_es/TextArea.js +12 -16
  80. package/dist/packages/_es/TimeDetail.js +5 -7
  81. package/dist/packages/_es/TimePannel.js +5 -7
  82. package/dist/packages/_es/TimeSelect.js +7 -12
  83. package/dist/packages/_es/Toast.js +178 -46
  84. package/dist/packages/_es/Uploader.js +149 -109
  85. package/dist/packages/_es/Video.js +405 -0
  86. package/dist/packages/_es/common.js +136 -0
  87. package/dist/packages/_es/component.js +1 -1
  88. package/dist/packages/_es/index.js +7 -58
  89. package/dist/packages/_es/index2.js +58 -43
  90. package/dist/packages/_es/index3.js +28 -411
  91. package/dist/packages/_es/plugin-vue_export-helper.js +13 -0
  92. package/dist/packages/_es/pxCheck.js +1 -1
  93. package/dist/packages/_es/raf.js +1 -1
  94. package/dist/packages/_es/util.js +1 -1
  95. package/dist/packages/cascader/index.scss +81 -0
  96. package/dist/packages/cellgroup/index.scss +9 -0
  97. package/dist/packages/dialog/index.scss +17 -0
  98. package/dist/packages/drag/index.scss +4 -0
  99. package/dist/packages/empty/index.scss +33 -0
  100. package/dist/packages/fixednav/index.scss +6 -1
  101. package/dist/packages/formitem/index.scss +4 -1
  102. package/dist/packages/grid/index.scss +10 -0
  103. package/dist/packages/griditem/index.scss +92 -0
  104. package/dist/packages/icon/index.scss +2 -1
  105. package/dist/packages/indicator/index.scss +48 -0
  106. package/dist/packages/numberkeyboard/index.scss +1 -1
  107. package/dist/packages/popover/index.scss +2 -2
  108. package/dist/packages/rate/index.scss +1 -0
  109. package/dist/packages/skeleton/index.scss +57 -0
  110. package/dist/packages/table/index.scss +81 -0
  111. package/dist/packages/tabs/index.scss +16 -0
  112. package/dist/packages/textarea/index.scss +1 -0
  113. package/dist/packages/timedetail/index.scss +1 -2
  114. package/dist/packages/timeselect/index.scss +3 -0
  115. package/dist/packages/toast/index.scss +6 -0
  116. package/dist/style.css +1 -1
  117. package/dist/style.es.js +2 -1
  118. package/dist/styles/font/config.json +2 -1
  119. package/dist/styles/font/demo_index.html +26 -3
  120. package/dist/styles/font/iconfont.css +7 -3
  121. package/dist/styles/font/iconfont.js +31 -32
  122. package/dist/styles/font/iconfont.json +7 -0
  123. package/dist/styles/font/iconfont.ttf +0 -0
  124. package/dist/styles/font/iconfont.woff +0 -0
  125. package/dist/styles/font/iconfont.woff2 +0 -0
  126. package/dist/styles/themes/default.scss +40 -33
  127. package/dist/styles/variables.scss +54 -1
  128. package/package.json +2 -3
  129. package/dist/packages/_es/commonProps.js +0 -30
  130. package/dist/packages/_es/index.taro.vue_vue&type=script&lang.js +0 -44
  131. package/dist/packages/_es/use-lock-scroll.js +0 -23
@@ -1,13 +1,13 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.14 Wed Dec 22 2021 20:49:10 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import Taro from "@tarojs/taro";
7
- import { ref, reactive, watch, onMounted, computed, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, toDisplayString } from "vue";
6
+ import { computed, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, renderSlot, createTextVNode, toDisplayString } from "vue";
8
7
  import { c as createComponent } from "./component.js";
8
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
9
  const { componentName, create } = createComponent("circleprogress");
10
- var _sfc_main = create({
10
+ const _sfc_main = create({
11
11
  props: {
12
12
  progress: {
13
13
  type: [Number, String],
@@ -17,6 +17,10 @@ var _sfc_main = create({
17
17
  type: [Number, String],
18
18
  default: 10
19
19
  },
20
+ isAuto: {
21
+ tyep: Boolean,
22
+ default: false
23
+ },
20
24
  progressOption: {
21
25
  type: Object,
22
26
  default: () => {
@@ -24,79 +28,12 @@ var _sfc_main = create({
24
28
  }
25
29
  },
26
30
  setup(props, { emit }) {
27
- const rotateLeft = ref();
28
- const rotateRight = ref();
29
- const InnerWidth = ref(props.strokeInnerWidth);
30
- const isMobile = ref(false);
31
- const cricleData = reactive({
32
- radius: 50,
33
- strokeOutWidth: 10,
34
- backColor: "#d9d9d9",
35
- progressColor: "red"
36
- });
37
- const loadPercent = (x, y) => {
38
- let rotate = x / y * 360;
39
- let rotateRc = 0;
40
- let rotateLc = 0;
41
- if (rotate < 180) {
42
- rotateRc = rotate + -45;
43
- } else {
44
- rotateRc = 135;
45
- rotateLc = rotate - 180 - 45;
46
- rotateLeft.value = rotateLc;
47
- }
48
- rotateRight.value = rotateRc;
49
- };
50
- watch(() => props.progress, (value) => {
51
- loadPercent(value, 100);
52
- });
53
- onMounted(() => {
54
- if (Taro.getEnv() === "WEB") {
55
- isMobile.value = true;
56
- } else {
57
- isMobile.value = false;
58
- loadPercent(props.progress, 100);
59
- Object.assign(cricleData, props.progressOption);
60
- }
61
- });
62
31
  const classes = computed(() => {
63
32
  const prefixCls = componentName;
64
33
  return {
65
34
  [prefixCls]: true
66
35
  };
67
36
  });
68
- const pieStyle = computed(() => {
69
- return {
70
- width: (cricleData.radius + cricleData.strokeOutWidth) * 2 + "px",
71
- height: (cricleData.radius + cricleData.strokeOutWidth) * 2 + "px"
72
- };
73
- });
74
- const mobileStyle = computed(() => {
75
- return {
76
- width: "100%",
77
- height: "100%"
78
- };
79
- });
80
- const RightStyle = computed(() => {
81
- return {
82
- transform: `rotate(${rotateRight.value + "deg"})`,
83
- transition: `all 0.3s`,
84
- borderTop: `${InnerWidth.value + "px"} solid ${cricleData.backColor};`,
85
- borderLeft: `${InnerWidth.value + "px"} solid ${cricleData.backColor};`,
86
- borderBottom: `${InnerWidth.value + "px"} solid ${cricleData.progressColor};`,
87
- borderRight: `${InnerWidth.value + "px"} solid ${cricleData.progressColor};`
88
- };
89
- });
90
- const LeftStyle = computed(() => {
91
- return {
92
- transform: `rotate(${rotateLeft.value + "deg"})`,
93
- transition: `all 0.3s`,
94
- borderTop: `${InnerWidth.value + "px"} solid ${cricleData.backColor};`,
95
- borderLeft: `${InnerWidth.value + "px"} solid ${cricleData.backColor};`,
96
- borderBottom: `${InnerWidth.value + "px"} solid ${cricleData.progressColor};`,
97
- borderRight: `${InnerWidth.value + "px"} solid ${cricleData.progressColor};`
98
- };
99
- });
100
37
  const option = computed(() => {
101
38
  let baseOption = {
102
39
  radius: 50,
@@ -120,86 +57,53 @@ var _sfc_main = create({
120
57
  return `${progressLength},${circleLength}`;
121
58
  });
122
59
  return {
123
- isMobile,
124
- rotateLeft,
125
- InnerWidth,
126
- rotateRight,
127
60
  classes,
128
- pieStyle,
129
- RightStyle,
130
- LeftStyle,
131
61
  option,
132
- arcLength,
133
- mobileStyle
62
+ arcLength
134
63
  };
135
64
  }
136
65
  });
137
- const _hoisted_1 = { class: "nut-circleprogress__right" };
138
- const _hoisted_2 = { class: "nut-circleprogress__line nut-circleprogress__r" };
139
- const _hoisted_3 = { class: "nut-circleprogress__progress" };
140
- const _hoisted_4 = { class: "nut-circleprogress__left" };
141
- const _hoisted_5 = { class: "nut-circleprogress__line nut-circleprogress__l" };
142
- const _hoisted_6 = { key: 1 };
143
- const _hoisted_7 = ["height", "width"];
144
- const _hoisted_8 = ["r", "cx", "cy", "stroke", "stroke-width"];
145
- const _hoisted_9 = ["r", "cx", "cy", "stroke", "stroke-dasharray", "stroke-width", "transform"];
146
- const _hoisted_10 = { class: "nut-circleprogress__progress" };
66
+ const _hoisted_1 = ["height", "width"];
67
+ const _hoisted_2 = ["r", "cx", "cy", "stroke", "stroke-width"];
68
+ const _hoisted_3 = ["r", "cx", "cy", "stroke", "stroke-dasharray", "stroke-width", "transform"];
69
+ const _hoisted_4 = { class: "nut-circleprogress-content" };
147
70
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
148
71
  return openBlock(), createElementBlock("div", {
149
72
  class: normalizeClass(_ctx.classes),
150
- style: normalizeStyle(_ctx.pieStyle)
73
+ style: normalizeStyle({ height: _ctx.option.size + "px", width: _ctx.option.size + "px" })
151
74
  }, [
152
- !_ctx.isMobile ? (openBlock(), createElementBlock("div", {
153
- key: 0,
154
- style: normalizeStyle(_ctx.mobileStyle)
75
+ (openBlock(), createElementBlock("svg", {
76
+ height: _ctx.option.size,
77
+ width: _ctx.option.size,
78
+ "x-mlns": "http://www.w3.org/200/svg"
155
79
  }, [
156
- createElementVNode("div", _hoisted_1, [
157
- createElementVNode("div", _hoisted_2, [
158
- createElementVNode("div", {
159
- class: "nut-circleprogress__line__c",
160
- style: normalizeStyle(_ctx.RightStyle)
161
- }, null, 4)
162
- ])
163
- ]),
164
- createElementVNode("div", _hoisted_3, toDisplayString(_ctx.progress) + " %", 1),
165
- createElementVNode("div", _hoisted_4, [
166
- createElementVNode("div", _hoisted_5, [
167
- createElementVNode("div", {
168
- class: "nut-circleprogress__line__c",
169
- style: normalizeStyle(_ctx.LeftStyle)
170
- }, null, 4)
171
- ])
172
- ])
173
- ], 4)) : (openBlock(), createElementBlock("div", _hoisted_6, [
174
- (openBlock(), createElementBlock("svg", {
175
- height: _ctx.option.size,
176
- width: _ctx.option.size,
177
- "x-mlns": "http://www.w3.org/200/svg"
178
- }, [
179
- createElementVNode("circle", {
180
- r: _ctx.option.radius,
181
- cx: _ctx.option.cx,
182
- cy: _ctx.option.cy,
183
- stroke: _ctx.option.backColor,
184
- "stroke-width": _ctx.option.strokeOutWidth,
185
- fill: "none"
186
- }, null, 8, _hoisted_8),
187
- createElementVNode("circle", {
188
- r: _ctx.option.radius,
189
- cx: _ctx.option.cx,
190
- cy: _ctx.option.cy,
191
- stroke: _ctx.option.progressColor,
192
- "stroke-dasharray": _ctx.arcLength,
193
- "stroke-width": _ctx.strokeInnerWidth,
194
- fill: "none",
195
- transform: _ctx.option.startPosition,
196
- "stroke-linecap": "round",
197
- style: { "transition": "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease 0s" }
198
- }, null, 8, _hoisted_9)
199
- ], 8, _hoisted_7)),
200
- createElementVNode("div", _hoisted_10, toDisplayString(_ctx.progress) + "%", 1)
201
- ]))
80
+ createElementVNode("circle", {
81
+ r: _ctx.option.radius,
82
+ cx: _ctx.option.cx,
83
+ cy: _ctx.option.cy,
84
+ stroke: _ctx.option.backColor,
85
+ "stroke-width": _ctx.option.strokeOutWidth,
86
+ fill: "none"
87
+ }, null, 8, _hoisted_2),
88
+ createElementVNode("circle", {
89
+ r: _ctx.option.radius,
90
+ cx: _ctx.option.cx,
91
+ cy: _ctx.option.cy,
92
+ stroke: _ctx.option.progressColor,
93
+ "stroke-dasharray": _ctx.arcLength,
94
+ "stroke-width": _ctx.strokeInnerWidth,
95
+ fill: "none",
96
+ transform: _ctx.option.startPosition,
97
+ "stroke-linecap": "round",
98
+ style: { "transition": "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease 0s" }
99
+ }, null, 8, _hoisted_3)
100
+ ], 8, _hoisted_1)),
101
+ createElementVNode("div", _hoisted_4, [
102
+ !_ctx.isAuto ? renderSlot(_ctx.$slots, "default", { key: 0 }, () => [
103
+ createTextVNode(toDisplayString(_ctx.progress) + "%", 1)
104
+ ]) : renderSlot(_ctx.$slots, "default", { key: 1 })
105
+ ])
202
106
  ], 6);
203
107
  }
204
- _sfc_main.render = _sfc_render;
205
- export { _sfc_main as default };
108
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
109
+ 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.14 Wed Dec 22 2021 20:49:10 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { inject, computed, openBlock, createElementBlock, normalizeClass, normalizeStyle, renderSlot } 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("col");
9
- var _sfc_main = create({
10
+ const _sfc_main = create({
10
11
  props: {
11
12
  span: {
12
13
  type: [String, Number],
@@ -48,5 +49,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
48
49
  renderSlot(_ctx.$slots, "default")
49
50
  ], 6);
50
51
  }
51
- _sfc_main.render = _sfc_render;
52
- export { _sfc_main as default };
52
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
53
+ 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.14 Wed Dec 22 2021 20:49:10 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { provide, openBlock, createElementBlock, renderSlot } 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("collapse");
9
- var _sfc_main = create({
10
+ const _sfc_main = create({
10
11
  props: {
11
12
  active: {
12
13
  type: [String, Number, Array]
@@ -48,20 +49,20 @@ var _sfc_main = create({
48
49
  }
49
50
  },
50
51
  emits: ["update:active", "change"],
51
- setup(props, { emit, slots }) {
52
+ setup(props, { emit }) {
52
53
  const changeVal = (val) => {
53
54
  emit("update:active", val);
54
55
  emit("change", val);
55
56
  };
56
57
  const changeValAry = (name) => {
57
58
  const activeItem = props.active instanceof Object ? Object.values(props.active) : props.active;
58
- let index = -1;
59
+ let index2 = -1;
59
60
  activeItem.forEach((item, idx) => {
60
61
  if (String(item) == String(name)) {
61
- index = idx;
62
+ index2 = idx;
62
63
  }
63
64
  });
64
- index > -1 ? activeItem.splice(index, 1) : activeItem.push(name);
65
+ index2 > -1 ? activeItem.splice(index2, 1) : activeItem.push(name);
65
66
  changeVal(activeItem);
66
67
  };
67
68
  const isExpanded = (name) => {
@@ -70,38 +71,12 @@ var _sfc_main = create({
70
71
  return typeof active === "number" || typeof active === "string" ? active == name : false;
71
72
  }
72
73
  };
73
- const activeIndex = () => {
74
- var _a;
75
- const activeCollapse = props.active;
76
- const childrenList = (_a = slots.default) == null ? void 0 : _a.call(slots);
77
- let act = [];
78
- childrenList.forEach((item, index) => {
79
- if (typeof activeCollapse == "number" || typeof activeCollapse == "string") {
80
- if (item.props.name == activeCollapse) {
81
- act.push(item.flag);
82
- return act;
83
- }
84
- } else {
85
- let ary = Array.from(activeCollapse);
86
- if (ary.includes(String(item.props.name)) || ary.includes(Number(item.props.name))) {
87
- act.push(item.flag);
88
- }
89
- }
90
- });
91
- return act;
92
- };
93
- const getParentChildren = () => {
94
- var _a;
95
- return (_a = slots.default) == null ? void 0 : _a.call(slots);
96
- };
97
74
  provide("collapseParent", {
98
75
  children: [],
99
76
  props,
100
77
  changeValAry,
101
78
  changeVal,
102
- isExpanded,
103
- activeIndex,
104
- getParentChildren
79
+ isExpanded
105
80
  });
106
81
  }
107
82
  });
@@ -110,5 +85,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
110
85
  renderSlot(_ctx.$slots, "default")
111
86
  ]);
112
87
  }
113
- _sfc_main.render = _sfc_render;
114
- export { _sfc_main as default };
88
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
89
+ export { index as default };
@@ -17,19 +17,16 @@ 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.14 Wed Dec 22 2021 20:49:10 GMT+0800 (中国标准时间)
25
22
  * (c) 2021 @jdf2e.
26
23
  * Released under the MIT License.
27
24
  */
28
- import { inject, ref, reactive, computed, getCurrentInstance, watch, onMounted, toRefs, nextTick, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, createBlock, createCommentVNode, renderSlot, normalizeStyle } from "vue";
29
- import Taro, { eventCenter, getCurrentInstance as getCurrentInstance$1 } from "@tarojs/taro";
25
+ import { inject, reactive, computed, getCurrentInstance, ref, watch, onMounted, toRefs, nextTick, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, createBlock, createCommentVNode, renderSlot, normalizeStyle } from "vue";
30
26
  import { c as createComponent } from "./component.js";
27
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
31
28
  const { create, componentName } = createComponent("collapse-item");
32
- var _sfc_main = create({
29
+ const _sfc_main = create({
33
30
  props: {
34
31
  title: {
35
32
  type: String,
@@ -54,7 +51,6 @@ var _sfc_main = create({
54
51
  },
55
52
  setup(props) {
56
53
  const collapse = inject("collapseParent");
57
- const conHeight = ref(0);
58
54
  const parent = reactive(collapse);
59
55
  const classes = computed(() => {
60
56
  const prefixCls = componentName;
@@ -73,7 +69,7 @@ var _sfc_main = create({
73
69
  icon: parent.props.icon,
74
70
  iconSize: parent.props.iconSize,
75
71
  iconColor: parent.props.iconColor,
76
- openExpanded: null,
72
+ openExpanded: false,
77
73
  iconStyle: {
78
74
  transform: "rotate(0deg)",
79
75
  marginTop: parent.props.iconHeght ? "-" + parent.props.iconHeght / 2 + "px" : "-10px"
@@ -88,33 +84,29 @@ var _sfc_main = create({
88
84
  const wrapperRef = ref(null);
89
85
  const contentRef = ref(null);
90
86
  const onTransitionEnd = () => {
91
- nextTick(() => {
92
- parent.children.forEach((item1, index) => {
93
- let ary = Array.from(item1.$el.children);
94
- ary.forEach((item2, index2) => {
95
- if (item2.className.includes("collapse-wrapper")) {
96
- item2.style.willChange = "auto";
97
- }
98
- });
99
- });
100
- });
87
+ const wrapperRefEle = document.getElementsByClassName("collapse-wrapper")[0];
88
+ wrapperRefEle.style.willChange = "auto";
101
89
  };
102
90
  const animation = () => {
103
- if (parent.props.icon && !proxyData.openExpanded) {
104
- proxyData.iconStyle["transform"] = "rotate(0deg)";
105
- } else {
106
- proxyData.iconStyle["transform"] = "rotate(" + parent.props.rotate + "deg)";
91
+ const wrapperRefEle = wrapperRef.value;
92
+ const contentRefEle = contentRef.value;
93
+ if (!wrapperRefEle || !contentRefEle) {
94
+ return;
107
95
  }
108
- nextTick(() => {
109
- const query = Taro.createSelectorQuery();
110
- query.selectAll(".collapse-content").boundingClientRect();
111
- query.exec((res) => {
112
- getH(res[0]);
113
- });
114
- if (!proxyData.openExpanded) {
115
- onTransitionEnd();
96
+ const offsetHeight = contentRefEle.offsetHeight;
97
+ if (offsetHeight) {
98
+ const contentHeight = `${offsetHeight}px`;
99
+ wrapperRefEle.style.willChange = "height";
100
+ wrapperRefEle.style.height = !proxyData.openExpanded ? 0 : contentHeight;
101
+ if (parent.props.icon && !proxyData.openExpanded) {
102
+ proxyData.iconStyle["transform"] = "rotate(0deg)";
103
+ } else {
104
+ proxyData.iconStyle["transform"] = "rotate(" + parent.props.rotate + "deg)";
116
105
  }
117
- });
106
+ }
107
+ if (!proxyData.openExpanded) {
108
+ onTransitionEnd();
109
+ }
118
110
  };
119
111
  const open = () => {
120
112
  proxyData.openExpanded = !proxyData.openExpanded;
@@ -129,7 +121,7 @@ var _sfc_main = create({
129
121
  const currentName = computed(() => props.name);
130
122
  const toggleOpen = () => {
131
123
  if (parent.props.accordion) {
132
- parent.children.forEach((item, index) => {
124
+ parent.children.forEach((item, index2) => {
133
125
  if (currentName.value == item.name) {
134
126
  item.changeOpen(!item.openExpanded);
135
127
  } else {
@@ -160,45 +152,9 @@ var _sfc_main = create({
160
152
  proxyData.openExpanded = true;
161
153
  }
162
154
  });
163
- const getH = (list) => {
164
- parent.children.forEach((item1, index1) => {
165
- let ary = Array.from(item1.$el.children);
166
- let _uid = ary[1].children[0]["uid"];
167
- let tm = list.filter((item2) => item2.id == _uid);
168
- if (tm && tm.length > 0) {
169
- let h = tm[0]["height"];
170
- item1.conHeight = h;
171
- }
172
- });
173
- };
174
- const getH5 = () => {
175
- parent.children.forEach((item1, index1) => {
176
- let ary = Array.from(item1.$el.children);
177
- let h = ary[1].children[0]["offsetHeight"];
178
- item1.conHeight = h;
179
- });
180
- };
181
- const getRefHeight = () => {
182
- const query = Taro.createSelectorQuery();
183
- query.selectAll(".collapse-content").boundingClientRect();
184
- query.exec((res) => {
185
- if (Taro.getEnv() === "WEB") {
186
- getH5();
187
- } else {
188
- getH(res[0]);
189
- }
190
- });
191
- };
192
155
  onMounted(() => {
193
156
  const { name } = props;
194
157
  const active = parent && parent.props.active;
195
- if (Taro.getEnv() === "WEB") {
196
- getRefHeight();
197
- } else {
198
- eventCenter.once(getCurrentInstance$1().router.onReady, () => {
199
- getRefHeight();
200
- });
201
- }
202
158
  if (typeof active == "number" || typeof active == "string") {
203
159
  if (name == active) {
204
160
  defaultOpen();
@@ -213,7 +169,6 @@ var _sfc_main = create({
213
169
  return __spreadProps(__spreadValues(__spreadValues(__spreadValues({
214
170
  classes
215
171
  }, toRefs(proxyData)), toRefs(parent.props)), toRefs(titleIconStyle)), {
216
- conHeight,
217
172
  wrapperRef,
218
173
  contentRef,
219
174
  open,
@@ -232,6 +187,10 @@ const _hoisted_4 = {
232
187
  };
233
188
  const _hoisted_5 = ["innerHTML"];
234
189
  const _hoisted_6 = {
190
+ class: "collapse-wrapper",
191
+ ref: "wrapperRef"
192
+ };
193
+ const _hoisted_7 = {
235
194
  class: "collapse-content",
236
195
  ref: "contentRef"
237
196
  };
@@ -252,7 +211,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
252
211
  name: _ctx.titleIcon,
253
212
  size: _ctx.titleIconSize,
254
213
  color: _ctx.titleIconColor,
255
- class: normalizeClass(["collapse-title-icon", _ctx.titleIconPosition == "left" ? "titleIconLeft" : "titleIconRight"])
214
+ class: normalizeClass([_ctx.titleIconPosition == "left" ? "titleIconLeft" : "titleIconRight"])
256
215
  }, null, 8, ["name", "size", "color", "class"])) : createCommentVNode("", true),
257
216
  _ctx.$slots.mTitle ? renderSlot(_ctx.$slots, "mTitle", { key: 1 }) : (openBlock(), createElementBlock("view", {
258
217
  key: 2,
@@ -278,16 +237,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
278
237
  style: normalizeStyle(_ctx.iconStyle)
279
238
  }, null, 8, ["name", "size", "color", "class", "style"])) : createCommentVNode("", true)
280
239
  ], 2),
281
- createElementVNode("view", {
282
- class: normalizeClass(["collapse-wrapper", _ctx.openExpanded ? "open-style" : "close-style"]),
283
- ref: "wrapperRef",
284
- style: normalizeStyle({ height: _ctx.openExpanded ? _ctx.conHeight + "px" : 0 })
285
- }, [
286
- createElementVNode("view", _hoisted_6, [
240
+ createElementVNode("view", _hoisted_6, [
241
+ createElementVNode("view", _hoisted_7, [
287
242
  renderSlot(_ctx.$slots, "default")
288
243
  ], 512)
289
- ], 6)
244
+ ], 512)
290
245
  ], 2);
291
246
  }
292
- _sfc_main.render = _sfc_render;
293
- export { _sfc_main as default };
247
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
248
+ export { index as default };
@@ -17,18 +17,16 @@ 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.14 Wed Dec 22 2021 20:49:10 GMT+0800 (中国标准时间)
25
22
  * (c) 2021 @jdf2e.
26
23
  * Released under the MIT License.
27
24
  */
28
25
  import { reactive, computed, watch, toRefs, openBlock, createElementBlock, normalizeClass, renderSlot, toDisplayString, Fragment, createElementVNode, createCommentVNode } from "vue";
29
26
  import { c as createComponent } from "./component.js";
27
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
30
28
  const { componentName, create } = createComponent("countdown");
31
- var _sfc_main = create({
29
+ const _sfc_main = create({
32
30
  props: {
33
31
  modelValue: {
34
32
  type: Object,
@@ -64,9 +62,8 @@ var _sfc_main = create({
64
62
  }
65
63
  },
66
64
  components: {},
67
- emits: ["input", "on-end", "on-restart", "on-paused"],
65
+ emits: ["input", "on-end", "on-restart", "on-paused", "update:modelValue"],
68
66
  setup(props, { emit, slots }) {
69
- console.log("componentName", componentName);
70
67
  const state = reactive({
71
68
  restTime: 0,
72
69
  p: 0,
@@ -132,7 +129,7 @@ var _sfc_main = create({
132
129
  if (!props.paused) {
133
130
  let restTime2 = end - (Date.now() - state.p + diffTime);
134
131
  state.restTime = restTime2;
135
- if (restTime2 < delay) {
132
+ if (restTime2 < 0) {
136
133
  state.restTime = 0;
137
134
  emit("on-end");
138
135
  clearInterval(state.timer);
@@ -222,5 +219,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
222
219
  ], 64))
223
220
  ], 2);
224
221
  }
225
- _sfc_main.render = _sfc_render;
226
- export { _sfc_main as default };
222
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
223
+ export { index as default };