@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
@@ -1,28 +1,429 @@
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
+ import { reactive, ref, computed, provide, onMounted, nextTick, onActivated, onDeactivated, onBeforeUnmount, watch, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, renderSlot, Fragment, renderList, createCommentVNode } from "vue";
6
7
  import { c as createComponent } from "./component.js";
7
- import { resolveComponent, openBlock, createBlock, normalizeProps, guardReactiveProps, withCtx, renderSlot } from "vue";
8
+ import { u as useExpose } from "./index.js";
9
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
10
+ const DISTANCE = 5;
11
+ function useTouch() {
12
+ const state = reactive({
13
+ startX: 0,
14
+ startY: 0,
15
+ deltaX: 0,
16
+ deltaY: 0,
17
+ offsetX: 0,
18
+ offsetY: 0,
19
+ direction: ""
20
+ });
21
+ const getDirection = (x, y) => {
22
+ if (x > y && x > DISTANCE)
23
+ return "horizontal";
24
+ if (y > x && y > DISTANCE)
25
+ return "vertical";
26
+ return "";
27
+ };
28
+ const reset = () => {
29
+ state.startX = 0;
30
+ state.startY = 0;
31
+ state.deltaX = 0;
32
+ state.deltaY = 0;
33
+ state.offsetX = 0;
34
+ state.offsetY = 0;
35
+ state.direction = "";
36
+ };
37
+ const start = (e) => {
38
+ reset();
39
+ state.startX = e.touches[0].clientX;
40
+ state.startY = e.touches[0].clientY;
41
+ };
42
+ const move = (e) => {
43
+ state.deltaX = e.touches[0].clientX - state.startX;
44
+ state.deltaY = e.touches[0].clientY - state.startY;
45
+ state.offsetX = Math.abs(state.deltaX);
46
+ state.offsetY = Math.abs(state.deltaY);
47
+ if (!state.direction) {
48
+ state.direction = getDirection(state.offsetX, state.offsetY);
49
+ }
50
+ };
51
+ return {
52
+ state,
53
+ start,
54
+ reset,
55
+ move
56
+ };
57
+ }
8
58
  const { create, componentName } = createComponent("swiper");
9
- var _sfc_main = create({
10
- inheritAttrs: false,
11
- props: {},
12
- emits: [],
13
- setup(props, context) {
14
- const attrs = context.attrs;
15
- return { attrs };
59
+ const _sfc_main = create({
60
+ props: {
61
+ width: {
62
+ type: [Number, String],
63
+ default: window.innerWidth
64
+ },
65
+ height: {
66
+ type: [Number, String],
67
+ default: 0
68
+ },
69
+ direction: {
70
+ type: [String],
71
+ default: "horizontal"
72
+ },
73
+ paginationVisible: {
74
+ type: Boolean,
75
+ default: false
76
+ },
77
+ paginationColor: {
78
+ type: String,
79
+ default: "#fff"
80
+ },
81
+ loop: {
82
+ type: Boolean,
83
+ default: true
84
+ },
85
+ duration: {
86
+ type: [Number, String],
87
+ default: 500
88
+ },
89
+ autoPlay: {
90
+ type: [Number, String],
91
+ default: 0
92
+ },
93
+ initPage: {
94
+ type: [Number, String],
95
+ default: 0
96
+ },
97
+ touchable: {
98
+ type: Boolean,
99
+ default: true
100
+ },
101
+ isPreventDefault: {
102
+ type: Boolean,
103
+ default: true
104
+ },
105
+ isStopPropagation: {
106
+ type: Boolean,
107
+ default: true
108
+ }
109
+ },
110
+ emits: ["change"],
111
+ setup(props, { emit, slots }) {
112
+ const container = ref();
113
+ const state = reactive({
114
+ active: 0,
115
+ num: 0,
116
+ rect: null,
117
+ width: 0,
118
+ height: 0,
119
+ moving: false,
120
+ offset: 0,
121
+ touchTime: 0,
122
+ autoplayTimer: 0,
123
+ children: [],
124
+ style: {}
125
+ });
126
+ const touch = useTouch();
127
+ const classes = computed(() => {
128
+ const prefixCls = componentName;
129
+ return {
130
+ [prefixCls]: true
131
+ };
132
+ });
133
+ const isVertical = computed(() => props.direction === "vertical");
134
+ const delTa = computed(() => {
135
+ return isVertical.value ? touch.state.deltaY : touch.state.deltaX;
136
+ });
137
+ const isCorrectDirection = computed(() => {
138
+ return touch.state.direction === props.direction;
139
+ });
140
+ const childCount = computed(() => state.children.length);
141
+ const size = computed(() => state[isVertical.value ? "height" : "width"]);
142
+ const trackSize = computed(() => childCount.value * size.value);
143
+ const minOffset = computed(() => {
144
+ if (state.rect) {
145
+ const base = isVertical.value ? state.rect.height : state.rect.width;
146
+ return base - size.value * childCount.value;
147
+ }
148
+ return 0;
149
+ });
150
+ const activePagination = computed(() => (state.active + childCount.value) % childCount.value);
151
+ const getStyle = () => {
152
+ state.style = {
153
+ transitionDuration: `${state.moving ? 0 : props.duration}ms`,
154
+ transform: `translate${isVertical.value ? "Y" : "X"}(${state.offset}px)`,
155
+ [isVertical.value ? "height" : "width"]: `${size.value * childCount.value}px`,
156
+ [isVertical.value ? "width" : "height"]: `${isVertical.value ? state.width : state.height}px`
157
+ };
158
+ };
159
+ const relation = (child) => {
160
+ if (child.proxy) {
161
+ state.children.push(child.proxy);
162
+ }
163
+ };
164
+ const range = (num, min, max) => {
165
+ return Math.min(Math.max(num, min), max);
166
+ };
167
+ const requestFrame = (fn) => {
168
+ window.requestAnimationFrame.call(window, fn);
169
+ };
170
+ const getOffset = (active, offset = 0) => {
171
+ let currentPosition = active * size.value;
172
+ if (!props.loop) {
173
+ currentPosition = Math.min(currentPosition, -minOffset.value);
174
+ }
175
+ let targetOffset = offset - currentPosition;
176
+ if (!props.loop) {
177
+ targetOffset = range(targetOffset, minOffset.value, 0);
178
+ }
179
+ return targetOffset;
180
+ };
181
+ const getActive = (pace) => {
182
+ const { active } = state;
183
+ if (pace) {
184
+ if (props.loop) {
185
+ return range(active + pace, -1, childCount.value);
186
+ }
187
+ return range(active + pace, 0, childCount.value - 1);
188
+ }
189
+ return active;
190
+ };
191
+ const move = ({ pace = 0, offset = 0, isEmit = false }) => {
192
+ if (childCount.value <= 1)
193
+ return;
194
+ const { active } = state;
195
+ const targetActive = getActive(pace);
196
+ const targetOffset = getOffset(targetActive, offset);
197
+ if (props.loop) {
198
+ if (state.children[0] && targetOffset !== minOffset.value) {
199
+ const rightBound = targetOffset < minOffset.value;
200
+ state.children[0].setOffset(rightBound ? trackSize.value : 0);
201
+ }
202
+ if (state.children[childCount.value - 1] && targetOffset !== 0) {
203
+ const leftBound = targetOffset > 0;
204
+ state.children[childCount.value - 1].setOffset(leftBound ? -trackSize.value : 0);
205
+ }
206
+ }
207
+ state.active = targetActive;
208
+ state.offset = targetOffset;
209
+ if (isEmit && active !== state.active) {
210
+ emit("change", activePagination.value);
211
+ }
212
+ getStyle();
213
+ };
214
+ const resettPosition = () => {
215
+ state.moving = true;
216
+ if (state.active <= -1) {
217
+ move({ pace: childCount.value });
218
+ }
219
+ if (state.active >= childCount.value) {
220
+ move({ pace: -childCount.value });
221
+ }
222
+ };
223
+ const stopAutoPlay = () => {
224
+ clearTimeout(state.autoplayTimer);
225
+ };
226
+ const prev = () => {
227
+ resettPosition();
228
+ touch.reset();
229
+ requestFrame(() => {
230
+ requestFrame(() => {
231
+ state.moving = false;
232
+ move({
233
+ pace: -1,
234
+ isEmit: true
235
+ });
236
+ });
237
+ });
238
+ };
239
+ const next = () => {
240
+ resettPosition();
241
+ touch.reset();
242
+ requestFrame(() => {
243
+ requestFrame(() => {
244
+ state.moving = false;
245
+ move({
246
+ pace: 1,
247
+ isEmit: true
248
+ });
249
+ });
250
+ });
251
+ };
252
+ const to = (index) => {
253
+ resettPosition();
254
+ touch.reset();
255
+ requestFrame(() => {
256
+ requestFrame(() => {
257
+ state.moving = false;
258
+ let targetIndex;
259
+ if (props.loop && childCount.value === index) {
260
+ targetIndex = state.active === 0 ? 0 : index;
261
+ } else {
262
+ targetIndex = index % childCount.value;
263
+ }
264
+ move({
265
+ pace: targetIndex - state.active,
266
+ isEmit: true
267
+ });
268
+ });
269
+ });
270
+ };
271
+ const autoplay = () => {
272
+ if (props.autoPlay <= 0 || childCount.value <= 1)
273
+ return;
274
+ stopAutoPlay();
275
+ state.autoplayTimer = setTimeout(() => {
276
+ next();
277
+ autoplay();
278
+ }, Number(props.autoPlay));
279
+ };
280
+ const init = (active = +props.initPage) => {
281
+ stopAutoPlay();
282
+ state.rect = container.value.getBoundingClientRect();
283
+ active = Math.min(childCount.value - 1, active);
284
+ state.width = props.width ? +props.width : state.rect.width;
285
+ state.height = props.height ? +props.height : state.rect.height;
286
+ state.active = active;
287
+ state.offset = getOffset(state.active);
288
+ state.moving = true;
289
+ getStyle();
290
+ autoplay();
291
+ };
292
+ const onTouchStart = (e) => {
293
+ if (props.isPreventDefault)
294
+ e.preventDefault();
295
+ if (props.isStopPropagation)
296
+ e.stopPropagation();
297
+ if (!props.touchable)
298
+ return;
299
+ touch.start(e);
300
+ state.touchTime = Date.now();
301
+ stopAutoPlay();
302
+ resettPosition();
303
+ };
304
+ const onTouchMove = (e) => {
305
+ if (props.touchable && state.moving) {
306
+ touch.move(e);
307
+ if (isCorrectDirection.value) {
308
+ move({
309
+ offset: delTa.value
310
+ });
311
+ }
312
+ }
313
+ };
314
+ const onTouchEnd = (e) => {
315
+ if (!props.touchable || !state.moving)
316
+ return;
317
+ const speed = delTa.value / (Date.now() - state.touchTime);
318
+ const isShouldMove = Math.abs(speed) > 0.3 || Math.abs(delTa.value) > +(size.value / 2).toFixed(2);
319
+ if (isShouldMove && isCorrectDirection.value) {
320
+ let pace = 0;
321
+ const offset = isVertical.value ? touch.state.offsetY : touch.state.offsetX;
322
+ if (props.loop) {
323
+ pace = offset > 0 ? delTa.value > 0 ? -1 : 1 : 0;
324
+ } else {
325
+ pace = -Math[delTa.value > 0 ? "ceil" : "floor"](delTa.value / size.value);
326
+ }
327
+ move({
328
+ pace,
329
+ isEmit: true
330
+ });
331
+ } else if (delTa.value) {
332
+ move({ pace: 0 });
333
+ }
334
+ state.moving = false;
335
+ getStyle();
336
+ autoplay();
337
+ };
338
+ provide("parent", {
339
+ props,
340
+ size,
341
+ relation
342
+ });
343
+ useExpose({
344
+ prev,
345
+ next,
346
+ to
347
+ });
348
+ onMounted(() => {
349
+ nextTick(() => {
350
+ init();
351
+ });
352
+ });
353
+ onActivated(() => {
354
+ nextTick(() => {
355
+ init();
356
+ });
357
+ });
358
+ onDeactivated(() => {
359
+ stopAutoPlay();
360
+ });
361
+ onBeforeUnmount(() => {
362
+ stopAutoPlay();
363
+ });
364
+ watch(() => props.initPage, (val) => {
365
+ nextTick(() => {
366
+ init(Number(val));
367
+ });
368
+ });
369
+ watch(() => state.children.length, () => {
370
+ nextTick(() => {
371
+ init(state.active);
372
+ });
373
+ });
374
+ watch(() => props.autoPlay, (val) => {
375
+ val > 0 ? autoplay() : stopAutoPlay();
376
+ });
377
+ return {
378
+ state,
379
+ classes,
380
+ container,
381
+ componentName,
382
+ isVertical,
383
+ slots,
384
+ activePagination,
385
+ onTouchStart,
386
+ onTouchMove,
387
+ onTouchEnd
388
+ };
16
389
  }
17
390
  });
18
391
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
19
- const _component_swiper = resolveComponent("swiper");
20
- return openBlock(), createBlock(_component_swiper, normalizeProps(guardReactiveProps(_ctx.attrs)), {
21
- default: withCtx(() => [
392
+ return openBlock(), createElementBlock("view", {
393
+ ref: "container",
394
+ class: normalizeClass(_ctx.classes),
395
+ onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args)),
396
+ onTouchmove: _cache[1] || (_cache[1] = (...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args)),
397
+ onTouchend: _cache[2] || (_cache[2] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args)),
398
+ onTouchcancel: _cache[3] || (_cache[3] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args))
399
+ }, [
400
+ createElementVNode("view", {
401
+ class: normalizeClass({
402
+ [`${_ctx.componentName}-inner`]: true,
403
+ [`${_ctx.componentName}-vertical`]: _ctx.isVertical
404
+ }),
405
+ style: normalizeStyle(_ctx.state.style)
406
+ }, [
22
407
  renderSlot(_ctx.$slots, "default")
23
- ]),
24
- _: 3
25
- }, 16);
408
+ ], 6),
409
+ renderSlot(_ctx.$slots, "page"),
410
+ _ctx.paginationVisible && !_ctx.slots.page ? (openBlock(), createElementBlock("view", {
411
+ key: 0,
412
+ class: normalizeClass({
413
+ [`${_ctx.componentName}-pagination`]: true,
414
+ [`${_ctx.componentName}-pagination-vertical`]: _ctx.isVertical
415
+ })
416
+ }, [
417
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.state.children.length, (item, index) => {
418
+ return openBlock(), createElementBlock("i", {
419
+ style: normalizeStyle({
420
+ backgroundColor: _ctx.activePagination === index ? _ctx.paginationColor : "#ddd"
421
+ }),
422
+ key: index
423
+ }, null, 4);
424
+ }), 128))
425
+ ], 2)) : createCommentVNode("", true)
426
+ ], 34);
26
427
  }
27
- _sfc_main.render = _sfc_render;
28
- export { _sfc_main as default };
428
+ var Swiper = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
429
+ export { Swiper as default };
@@ -1,35 +1,60 @@
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
- import { computed, resolveComponent, openBlock, createBlock, normalizeClass, withCtx, renderSlot } from "vue";
6
+ import { getCurrentInstance, inject, reactive, 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";
9
+ function useExpose(apis) {
10
+ const instance = getCurrentInstance();
11
+ if (instance) {
12
+ Object.assign(instance.proxy, apis);
13
+ }
14
+ }
8
15
  const { create, componentName } = createComponent("swiper-item");
9
- var _sfc_main = create({
16
+ const _sfc_main = create({
10
17
  props: {},
11
18
  setup(props, { slots }) {
19
+ const parent = inject("parent");
20
+ parent["relation"](getCurrentInstance());
21
+ const state = reactive({
22
+ offset: 0
23
+ });
12
24
  const classes = computed(() => {
13
25
  const prefixCls = componentName;
14
26
  return {
15
27
  [prefixCls]: true
16
28
  };
17
29
  });
30
+ const style = computed(() => {
31
+ const style2 = {};
32
+ const direction = parent == null ? void 0 : parent.props.direction;
33
+ if (parent == null ? void 0 : parent.size.value) {
34
+ style2[direction === "horizontal" ? "width" : "height"] = `${parent == null ? void 0 : parent.size.value}px`;
35
+ }
36
+ if (state.offset) {
37
+ style2["transform"] = `translate${direction === "horizontal" ? "X" : "Y"}(${state.offset}px)`;
38
+ }
39
+ return style2;
40
+ });
41
+ const setOffset = (offset) => {
42
+ state.offset = offset;
43
+ };
44
+ useExpose({ setOffset });
18
45
  return {
46
+ style,
19
47
  classes
20
48
  };
21
49
  }
22
50
  });
23
51
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
24
- const _component_swiper_item = resolveComponent("swiper-item");
25
- return openBlock(), createBlock(_component_swiper_item, {
26
- class: normalizeClass(_ctx.classes)
27
- }, {
28
- default: withCtx(() => [
29
- renderSlot(_ctx.$slots, "default")
30
- ]),
31
- _: 3
32
- }, 8, ["class"]);
52
+ return openBlock(), createElementBlock("view", {
53
+ class: normalizeClass(_ctx.classes),
54
+ style: normalizeStyle(_ctx.style)
55
+ }, [
56
+ renderSlot(_ctx.$slots, "default")
57
+ ], 6);
33
58
  }
34
- _sfc_main.render = _sfc_render;
35
- export { _sfc_main as default };
59
+ var SwiperItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
60
+ export { SwiperItem 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
- import { computed, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, withDirectives, vShow, Fragment, toDisplayString, createCommentVNode } from "vue";
6
+ import { computed, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, createBlock, createCommentVNode, Fragment, withDirectives, toDisplayString, 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 { componentName, create } = createComponent("switch");
9
- var _sfc_main = create({
10
+ const _sfc_main = create({
10
11
  props: {
11
12
  modelValue: {
12
13
  type: Boolean,
@@ -31,6 +32,22 @@ var _sfc_main = create({
31
32
  inactiveText: {
32
33
  type: String,
33
34
  default: ""
35
+ },
36
+ loading: {
37
+ type: Boolean,
38
+ default: false
39
+ },
40
+ name: {
41
+ type: String,
42
+ default: "loading1"
43
+ },
44
+ size: {
45
+ type: [String, Number],
46
+ default: "12px"
47
+ },
48
+ color: {
49
+ type: String,
50
+ default: ""
34
51
  }
35
52
  },
36
53
  emits: ["change", "update:modelValue"],
@@ -50,9 +67,10 @@ var _sfc_main = create({
50
67
  };
51
68
  });
52
69
  const onClick = (event) => {
53
- if (props.disable)
70
+ if (props.disable || props.loading)
54
71
  return;
55
72
  emit("update:modelValue", !props.modelValue);
73
+ emit("update:loading");
56
74
  emit("change", !props.modelValue, event);
57
75
  };
58
76
  return {
@@ -63,18 +81,21 @@ var _sfc_main = create({
63
81
  }
64
82
  });
65
83
  const _hoisted_1 = { class: "switch-button" };
66
- const _hoisted_2 = { class: "close-line" };
67
84
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
85
+ const _component_nut_icon = resolveComponent("nut-icon");
68
86
  return openBlock(), createElementBlock("view", {
69
87
  class: normalizeClass(_ctx.classes),
70
88
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args)),
71
89
  style: normalizeStyle(_ctx.style)
72
90
  }, [
73
91
  createElementVNode("view", _hoisted_1, [
74
- withDirectives(createElementVNode("view", _hoisted_2, null, 512), [
75
- [vShow, !_ctx.modelValue]
76
- ]),
77
- _ctx.activeText ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
92
+ _ctx.loading ? (openBlock(), createBlock(_component_nut_icon, {
93
+ key: 0,
94
+ name: _ctx.name,
95
+ size: _ctx.size,
96
+ color: _ctx.color
97
+ }, null, 8, ["name", "size", "color"])) : createCommentVNode("", true),
98
+ _ctx.activeText ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
78
99
  withDirectives(createElementVNode("view", { class: "nut-switch-label open" }, toDisplayString(_ctx.activeText), 513), [
79
100
  [vShow, _ctx.modelValue]
80
101
  ]),
@@ -85,5 +106,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
85
106
  ])
86
107
  ], 6);
87
108
  }
88
- _sfc_main.render = _sfc_render;
89
- export { _sfc_main as default };
109
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
110
+ 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 { inject, openBlock, createElementBlock, normalizeClass, 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("tabpane");
9
- var _sfc_main = create({
10
+ const _sfc_main = create({
10
11
  props: {
11
12
  title: {
12
13
  type: [String, Number],
@@ -34,5 +35,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
34
35
  renderSlot(_ctx.$slots, "default")
35
36
  ], 2);
36
37
  }
37
- _sfc_main.render = _sfc_render;
38
- export { _sfc_main as default };
38
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
39
+ 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, provide, watch, openBlock, createElementBlock, normalizeClass, 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("tabbar");
9
- var _sfc_main = create({
10
+ const _sfc_main = create({
10
11
  props: {
11
12
  visible: {
12
13
  type: [Number, String],
@@ -68,5 +69,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
68
69
  renderSlot(_ctx.$slots, "default")
69
70
  ], 2);
70
71
  }
71
- _sfc_main.render = _sfc_render;
72
- export { _sfc_main as default };
72
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
73
+ export { index as default };