@nutui/nutui 4.1.0-beta.6 → 4.1.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 (55) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +27 -70
  3. package/dist/nutui.es.js +4 -2
  4. package/dist/nutui.js +5140 -5134
  5. package/dist/nutui.umd.js +1 -1
  6. package/dist/packages/_es/Animate.js +37 -39
  7. package/dist/packages/_es/Card.js +26 -27
  8. package/dist/packages/_es/CircleProgress.js +8 -17
  9. package/dist/packages/_es/Empty.js +26 -29
  10. package/dist/packages/_es/Indicator.js +17 -18
  11. package/dist/packages/_es/Navbar.js +41 -88
  12. package/dist/packages/_es/Price.js +2 -2
  13. package/dist/packages/_es/Progress.js +20 -23
  14. package/dist/packages/_es/Sticky.js +4 -0
  15. package/dist/packages/_es/Swipe.js +64 -39
  16. package/dist/packages/_es/SwipeGroup.js +39 -0
  17. package/dist/packages/_es/Tabs.js +8 -3
  18. package/dist/packages/_es/Tag.js +30 -25
  19. package/dist/packages/_es/Uploader.js +52 -53
  20. package/dist/packages/button/index.scss +14 -0
  21. package/dist/packages/navbar/index.scss +1 -0
  22. package/dist/packages/progress/index.scss +6 -0
  23. package/dist/packages/swipe/index.scss +1 -0
  24. package/dist/packages/swipegroup/index.mjs +4 -0
  25. package/dist/packages/swipegroup/index.scss +0 -0
  26. package/dist/packages/swipegroup/style.mjs +2 -0
  27. package/dist/smartips/web-types.json +158 -23
  28. package/dist/style.css +1 -1
  29. package/dist/styles/themes/default.scss +56 -55
  30. package/dist/styles/themes/jdb.scss +56 -55
  31. package/dist/styles/themes/jddkh.scss +56 -55
  32. package/dist/styles/themes/jdt.scss +56 -55
  33. package/dist/types/__VUE/animate/index.vue.d.ts +14 -3
  34. package/dist/types/__VUE/animate/type.d.ts +1 -1
  35. package/dist/types/__VUE/card/index.vue.d.ts +22 -3
  36. package/dist/types/__VUE/circleprogress/index.vue.d.ts +7 -10
  37. package/dist/types/__VUE/circleprogress/types.d.ts +1 -0
  38. package/dist/types/__VUE/empty/index.vue.d.ts +11 -4
  39. package/dist/types/__VUE/empty/types.d.ts +1 -0
  40. package/dist/types/__VUE/indicator/index.vue.d.ts +7 -9
  41. package/dist/types/__VUE/indicator/types.d.ts +1 -0
  42. package/dist/types/__VUE/navbar/index.vue.d.ts +8 -5
  43. package/dist/types/__VUE/price/index.vue.d.ts +8 -6
  44. package/dist/types/__VUE/price/types.d.ts +2 -0
  45. package/dist/types/__VUE/progress/index.vue.d.ts +10 -10
  46. package/dist/types/__VUE/progress/types.d.ts +2 -0
  47. package/dist/types/__VUE/swipe/index.vue.d.ts +4 -4
  48. package/dist/types/__VUE/swipegroup/index.vue.d.ts +26 -0
  49. package/dist/types/__VUE/tag/index.vue.d.ts +5 -4
  50. package/dist/types/__VUE/uploader/index.vue.d.ts +40 -7
  51. package/dist/types/index.d.ts +3 -2
  52. package/dist/types/utils/unit.d.ts +1 -0
  53. package/dist/types/utils/useTaroRect/index.d.ts +1 -0
  54. package/package.json +1 -1
  55. /package/dist/types/__VUE/tag/{type.d.ts → types.d.ts} +0 -0
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- import { reactive, computed, h, resolveComponent, openBlock, createElementBlock, normalizeClass, renderSlot, createBlock, resolveDynamicComponent, createCommentVNode, Fragment, renderList, createElementVNode, toDisplayString, createVNode } from "vue";
7
+ import { ref, watch, h, reactive, resolveComponent, openBlock, createElementBlock, renderSlot, createBlock, resolveDynamicComponent, createCommentVNode, Fragment, renderList, normalizeClass, createElementVNode, toDisplayString, createVNode } from "vue";
8
8
  import { c as createComponent } from "./component-0fbad28e.js";
9
9
  import { f as funInterceptor } from "./Interceptor-c05a39f2.js";
10
10
  import Progress from "./Progress.js";
@@ -90,7 +90,7 @@ class FileItem {
90
90
  __publicField(this, "formData", {});
91
91
  }
92
92
  }
93
- const { componentName, create, translate } = createComponent("uploader");
93
+ const { create, translate } = createComponent("uploader");
94
94
  const _sfc_main = create({
95
95
  components: {
96
96
  [Progress.name]: Progress,
@@ -151,14 +151,14 @@ const _sfc_main = create({
151
151
  "file-item-click"
152
152
  ],
153
153
  setup(props, { emit }) {
154
- const fileList = reactive(props.fileList);
155
- let uploadQueue = [];
156
- const classes = computed(() => {
157
- const prefixCls = componentName;
158
- return {
159
- [prefixCls]: true
160
- };
161
- });
154
+ const fileList = ref(props.fileList);
155
+ const uploadQueue = ref([]);
156
+ watch(
157
+ () => props.fileList,
158
+ () => {
159
+ fileList.value = props.fileList;
160
+ }
161
+ );
162
162
  const renderInput = () => {
163
163
  let params = {
164
164
  class: `nut-uploader__input`,
@@ -213,7 +213,7 @@ const _sfc_main = create({
213
213
  option,
214
214
  fileItem
215
215
  });
216
- emit("update:fileList", fileList);
216
+ emit("update:fileList", fileList.value);
217
217
  };
218
218
  uploadOption.onFailure = (responseText, option) => {
219
219
  fileItem.status = "error";
@@ -228,7 +228,7 @@ const _sfc_main = create({
228
228
  if (props.autoUpload) {
229
229
  task.upload();
230
230
  } else {
231
- uploadQueue.push(
231
+ uploadQueue.value.push(
232
232
  new Promise((resolve) => {
233
233
  resolve(task);
234
234
  })
@@ -237,14 +237,15 @@ const _sfc_main = create({
237
237
  };
238
238
  const clearUploadQueue = (index2 = -1) => {
239
239
  if (index2 > -1) {
240
- uploadQueue.splice(index2, 1);
240
+ uploadQueue.value.splice(index2, 1);
241
241
  } else {
242
- uploadQueue = [];
243
- fileList.splice(0, fileList.length);
242
+ uploadQueue.value = [];
243
+ fileList.value = [];
244
+ emit("update:fileList", fileList.value);
244
245
  }
245
246
  };
246
247
  const submit = () => {
247
- Promise.all(uploadQueue).then((res) => {
248
+ Promise.all(uploadQueue.value).then((res) => {
248
249
  res.forEach((i) => i.upload());
249
250
  });
250
251
  };
@@ -266,11 +267,11 @@ const _sfc_main = create({
266
267
  const reader = new FileReader();
267
268
  reader.onload = (event) => {
268
269
  fileItem.url = event.target.result;
269
- fileList.push(fileItem);
270
+ fileList.value.push(fileItem);
270
271
  };
271
272
  reader.readAsDataURL(file);
272
273
  } else {
273
- fileList.push(fileItem);
274
+ fileList.value.push(fileItem);
274
275
  }
275
276
  });
276
277
  };
@@ -289,24 +290,24 @@ const _sfc_main = create({
289
290
  if (oversizes.length) {
290
291
  emit("oversize", oversizes);
291
292
  }
292
- let currentFileLength = files.length + fileList.length;
293
+ let currentFileLength = files.length + fileList.value.length;
293
294
  if (currentFileLength > maximum) {
294
295
  files.splice(files.length - (currentFileLength - maximum));
295
296
  }
296
297
  return files;
297
298
  };
298
299
  const deleted = (file, index2) => {
299
- fileList.splice(index2, 1);
300
+ fileList.value.splice(index2, 1);
300
301
  emit("delete", {
301
302
  file,
302
- fileList,
303
+ fileList: fileList.value,
303
304
  index: index2
304
305
  });
305
306
  };
306
307
  const onDelete = (file, index2) => {
307
308
  clearUploadQueue(index2);
308
309
  funInterceptor(props.beforeDelete, {
309
- args: [file, fileList],
310
+ args: [file, fileList.value],
310
311
  done: () => deleted(file, index2)
311
312
  });
312
313
  };
@@ -322,7 +323,7 @@ const _sfc_main = create({
322
323
  changeReadFile(files);
323
324
  }
324
325
  emit("change", {
325
- fileList,
326
+ fileList: fileList.value,
326
327
  event
327
328
  });
328
329
  if (props.clearInput) {
@@ -337,7 +338,6 @@ const _sfc_main = create({
337
338
  onChange,
338
339
  onDelete,
339
340
  fileList,
340
- classes,
341
341
  fileItemClick,
342
342
  clearUploadQueue,
343
343
  submit,
@@ -345,34 +345,35 @@ const _sfc_main = create({
345
345
  };
346
346
  }
347
347
  });
348
- const _hoisted_1 = {
348
+ const _hoisted_1 = { class: "nut-uploader" };
349
+ const _hoisted_2 = {
349
350
  key: 0,
350
351
  class: "nut-uploader__slot"
351
352
  };
352
- const _hoisted_2 = {
353
+ const _hoisted_3 = {
353
354
  key: 0,
354
355
  class: "nut-uploader__preview-img"
355
356
  };
356
- const _hoisted_3 = {
357
+ const _hoisted_4 = {
357
358
  key: 0,
358
359
  class: "nut-uploader__preview__progress"
359
360
  };
360
- const _hoisted_4 = { class: "nut-uploader__preview__progress__msg" };
361
- const _hoisted_5 = ["onClick"];
362
- const _hoisted_6 = ["onClick", "src"];
363
- const _hoisted_7 = {
361
+ const _hoisted_5 = { class: "nut-uploader__preview__progress__msg" };
362
+ const _hoisted_6 = ["onClick"];
363
+ const _hoisted_7 = ["onClick", "src"];
364
+ const _hoisted_8 = {
364
365
  key: 3,
365
366
  class: "nut-uploader__preview-img__file"
366
367
  };
367
- const _hoisted_8 = ["onClick"];
368
- const _hoisted_9 = { class: "file__name_tips" };
369
- const _hoisted_10 = { class: "tips" };
370
- const _hoisted_11 = {
368
+ const _hoisted_9 = ["onClick"];
369
+ const _hoisted_10 = { class: "file__name_tips" };
370
+ const _hoisted_11 = { class: "tips" };
371
+ const _hoisted_12 = {
371
372
  key: 1,
372
373
  class: "nut-uploader__preview-list"
373
374
  };
374
- const _hoisted_12 = ["onClick"];
375
- const _hoisted_13 = { class: "file__name_tips" };
375
+ const _hoisted_13 = ["onClick"];
376
+ const _hoisted_14 = { class: "file__name_tips" };
376
377
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
377
378
  const _component_Failure = resolveComponent("Failure");
378
379
  const _component_Loading = resolveComponent("Loading");
@@ -380,10 +381,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
380
381
  const _component_Del = resolveComponent("Del");
381
382
  const _component_nut_progress = resolveComponent("nut-progress");
382
383
  const _component_Photograph = resolveComponent("Photograph");
383
- return openBlock(), createElementBlock("view", {
384
- class: normalizeClass(_ctx.classes)
385
- }, [
386
- _ctx.$slots.default ? (openBlock(), createElementBlock("view", _hoisted_1, [
384
+ return openBlock(), createElementBlock("view", _hoisted_1, [
385
+ _ctx.$slots.default ? (openBlock(), createElementBlock("view", _hoisted_2, [
387
386
  renderSlot(_ctx.$slots, "default"),
388
387
  Number(_ctx.maximum) - _ctx.fileList.length ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.renderInput), {
389
388
  key: 0,
@@ -396,8 +395,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
396
395
  class: normalizeClass(["nut-uploader__preview", [_ctx.listType]]),
397
396
  key: item.uid
398
397
  }, [
399
- _ctx.listType == "picture" && !_ctx.$slots.default ? (openBlock(), createElementBlock("view", _hoisted_2, [
400
- item.status != "success" ? (openBlock(), createElementBlock("view", _hoisted_3, [
398
+ _ctx.listType == "picture" && !_ctx.$slots.default ? (openBlock(), createElementBlock("view", _hoisted_3, [
399
+ item.status != "success" ? (openBlock(), createElementBlock("view", _hoisted_4, [
401
400
  item.status != "ready" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
402
401
  item.status == "error" ? (openBlock(), createBlock(_component_Failure, {
403
402
  key: 0,
@@ -408,7 +407,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
408
407
  color: "#fff"
409
408
  }))
410
409
  ], 64)) : createCommentVNode("", true),
411
- createElementVNode("view", _hoisted_4, toDisplayString(item.message), 1)
410
+ createElementVNode("view", _hoisted_5, toDisplayString(item.message), 1)
412
411
  ])) : createCommentVNode("", true),
413
412
  _ctx.isDeletable ? (openBlock(), createElementBlock("view", {
414
413
  key: 1,
@@ -418,35 +417,35 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
418
417
  renderSlot(_ctx.$slots, "delete-icon", {}, () => [
419
418
  createVNode(_component_Failure)
420
419
  ])
421
- ], 8, _hoisted_5)) : createCommentVNode("", true),
420
+ ], 8, _hoisted_6)) : createCommentVNode("", true),
422
421
  ((_a = item == null ? void 0 : item.type) == null ? void 0 : _a.includes("image")) && item.url ? (openBlock(), createElementBlock("img", {
423
422
  key: 2,
424
423
  class: "nut-uploader__preview-img__c",
425
424
  onClick: ($event) => _ctx.fileItemClick(item),
426
425
  src: item.url
427
- }, null, 8, _hoisted_6)) : (openBlock(), createElementBlock("view", _hoisted_7, [
426
+ }, null, 8, _hoisted_7)) : (openBlock(), createElementBlock("view", _hoisted_8, [
428
427
  createElementVNode("view", {
429
428
  onClick: ($event) => _ctx.fileItemClick(item),
430
429
  class: "nut-uploader__preview-img__file__name"
431
430
  }, [
432
- createElementVNode("view", _hoisted_9, toDisplayString(item.name), 1)
433
- ], 8, _hoisted_8)
431
+ createElementVNode("view", _hoisted_10, toDisplayString(item.name), 1)
432
+ ], 8, _hoisted_9)
434
433
  ])),
435
- createElementVNode("view", _hoisted_10, toDisplayString(item.name), 1)
436
- ])) : _ctx.listType == "list" ? (openBlock(), createElementBlock("view", _hoisted_11, [
434
+ createElementVNode("view", _hoisted_11, toDisplayString(item.name), 1)
435
+ ])) : _ctx.listType == "list" ? (openBlock(), createElementBlock("view", _hoisted_12, [
437
436
  createElementVNode("view", {
438
437
  onClick: ($event) => _ctx.fileItemClick(item),
439
438
  class: normalizeClass(["nut-uploader__preview-img__file__name", [item.status]])
440
439
  }, [
441
440
  createVNode(_component_Link, { class: "nut-uploader__preview-img__file__link" }),
442
- createElementVNode("view", _hoisted_13, toDisplayString(item.name), 1),
441
+ createElementVNode("view", _hoisted_14, toDisplayString(item.name), 1),
443
442
  _ctx.isDeletable ? (openBlock(), createBlock(_component_Del, {
444
443
  key: 0,
445
444
  color: "#808080",
446
445
  class: "nut-uploader__preview-img__file__del",
447
446
  onClick: ($event) => _ctx.onDelete(item, index2)
448
447
  }, null, 8, ["onClick"])) : createCommentVNode("", true)
449
- ], 10, _hoisted_12),
448
+ ], 10, _hoisted_13),
450
449
  item.status == "uploading" ? (openBlock(), createBlock(_component_nut_progress, {
451
450
  key: 0,
452
451
  size: "small",
@@ -466,7 +465,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
466
465
  ]),
467
466
  (openBlock(), createBlock(resolveDynamicComponent(_ctx.renderInput), { onChange: _ctx.onChange }, null, 40, ["onChange"]))
468
467
  ], 2)) : createCommentVNode("", true)
469
- ], 2);
468
+ ]);
470
469
  }
471
470
  const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
472
471
  export {
@@ -59,41 +59,48 @@
59
59
  &--default {
60
60
  color: $button-default-color;
61
61
  background: $button-default-bg-color;
62
+ background-origin: border-box;
62
63
  border: $button-border-width solid $button-default-border-color;
63
64
  }
64
65
 
65
66
  &--primary {
66
67
  color: $button-primary-color;
67
68
  background: $button-primary-background-color;
69
+ background-origin: border-box;
68
70
  border: $button-border-width solid transparent;
69
71
  }
70
72
 
71
73
  &--info {
72
74
  color: $button-info-color;
73
75
  background: $button-info-background-color;
76
+ background-origin: border-box;
74
77
  border: $button-border-width solid transparent;
75
78
  }
76
79
 
77
80
  &--success {
78
81
  color: $button-success-color;
79
82
  background: $button-success-background-color;
83
+ background-origin: border-box;
80
84
  border: $button-border-width solid transparent;
81
85
  }
82
86
 
83
87
  &--danger {
84
88
  color: $button-danger-color;
85
89
  background: $button-danger-background-color;
90
+ background-origin: border-box;
86
91
  border: $button-border-width solid transparent;
87
92
  }
88
93
 
89
94
  &--warning {
90
95
  color: $button-warning-color;
91
96
  background: $button-warning-background-color;
97
+ background-origin: border-box;
92
98
  border: $button-border-width solid transparent;
93
99
  }
94
100
 
95
101
  &--plain {
96
102
  background: $button-plain-background-color;
103
+ background-origin: border-box;
97
104
 
98
105
  &.nut-button--primary {
99
106
  color: $button-primary-border-color;
@@ -176,39 +183,46 @@
176
183
  .nut-button--default:not([disabled]):active {
177
184
  color: $button-default-color;
178
185
  background: $button-default-bg-color;
186
+ background-origin: border-box;
179
187
  border: $button-border-width solid $button-default-border-color;
180
188
  }
181
189
  .nut-button--primary:not([disabled]):active {
182
190
  color: $button-primary-color;
183
191
  background: $button-primary-background-color;
192
+ background-origin: border-box;
184
193
  border: $button-border-width solid transparent;
185
194
  }
186
195
 
187
196
  .nut-button--info:not([disabled]):active {
188
197
  color: $button-info-color;
189
198
  background: $button-info-background-color;
199
+ background-origin: border-box;
190
200
  border: $button-border-width solid transparent;
191
201
  }
192
202
 
193
203
  .nut-button--success:not([disabled]):active {
194
204
  color: $button-success-color;
195
205
  background: $button-success-background-color;
206
+ background-origin: border-box;
196
207
  border: $button-border-width solid transparent;
197
208
  }
198
209
 
199
210
  .nut-button--danger:not([disabled]):active {
200
211
  color: $button-danger-color;
201
212
  background: $button-danger-background-color;
213
+ background-origin: border-box;
202
214
  border: $button-border-width solid transparent;
203
215
  }
204
216
 
205
217
  .nut-button--warning:not([disabled]):active {
206
218
  color: $button-warning-color;
207
219
  background: $button-warning-background-color;
220
+ background-origin: border-box;
208
221
  border: $button-border-width solid transparent;
209
222
  }
210
223
  .nut-button--plain:not([disabled]):active {
211
224
  background: $button-plain-background-color;
225
+ background-origin: border-box;
212
226
  }
213
227
  .nut-button--plain {
214
228
  &.nut-button--primary:not([disabled]):active {
@@ -33,6 +33,7 @@
33
33
  width: 100%;
34
34
  }
35
35
  &--placeholder {
36
+ display: block;
36
37
  width: 100%;
37
38
  }
38
39
  &--safe-area-inset-top {
@@ -2,6 +2,7 @@
2
2
  width: 100%;
3
3
  position: relative;
4
4
  display: flex;
5
+ align-items: center;
5
6
  .nut-progress-outer {
6
7
  flex: 1;
7
8
  background-color: $progress-outer-background-color;
@@ -22,6 +23,11 @@
22
23
  justify-content: center;
23
24
  color: #fff;
24
25
  }
26
+ .nut-progress-slot {
27
+ display: flex;
28
+ justify-content: center;
29
+ align-items: center;
30
+ }
25
31
  .nut-active {
26
32
  &:before {
27
33
  content: '';
@@ -1,6 +1,7 @@
1
1
  .nut-swipe {
2
2
  position: relative;
3
3
  display: block;
4
+ cursor: grab;
4
5
  transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
5
6
  &__left,
6
7
  &__right {
@@ -0,0 +1,4 @@
1
+ import _SwipeGroup from '../_es/SwipeGroup.js';
2
+ const treeshaking = (t) => t;
3
+ const SwipeGroup = treeshaking(_SwipeGroup);
4
+ export { SwipeGroup };
File without changes
@@ -0,0 +1,2 @@
1
+ import '../../styles/reset.css';
2
+ import './index.scss';