@nutui/nutui 4.0.12-beta.1 → 4.0.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 (158) hide show
  1. package/dist/nutui.es.js +1 -1
  2. package/dist/nutui.js +1 -1
  3. package/dist/nutui.umd.js +1 -1
  4. package/dist/packages/_es/ActionSheet.js +111 -78
  5. package/dist/packages/_es/Address.js +375 -250
  6. package/dist/packages/_es/AddressList.js +354 -269
  7. package/dist/packages/_es/Animate.js +58 -41
  8. package/dist/packages/_es/Audio.js +197 -128
  9. package/dist/packages/_es/AudioOperate.js +71 -60
  10. package/dist/packages/_es/Avatar.js +89 -66
  11. package/dist/packages/_es/AvatarGroup.js +31 -23
  12. package/dist/packages/_es/Backtop.js +99 -59
  13. package/dist/packages/_es/Badge.js +47 -36
  14. package/dist/packages/_es/Barrage.js +147 -68
  15. package/dist/packages/_es/Button.js +66 -47
  16. package/dist/packages/_es/Calendar.js +157 -135
  17. package/dist/packages/_es/CalendarItem.js +6 -6
  18. package/dist/packages/_es/Card.js +56 -42
  19. package/dist/packages/_es/Cascader.js +474 -315
  20. package/dist/packages/_es/Category.js +39 -29
  21. package/dist/packages/_es/CategoryPane.js +83 -57
  22. package/dist/packages/_es/Cell.js +71 -56
  23. package/dist/packages/_es/CellGroup.js +27 -19
  24. package/dist/packages/_es/Checkbox.js +156 -109
  25. package/dist/packages/_es/CheckboxGroup.js +59 -38
  26. package/dist/packages/_es/CircleProgress.js +96 -67
  27. package/dist/packages/_es/Col.js +31 -23
  28. package/dist/packages/_es/Collapse.js +58 -33
  29. package/dist/packages/_es/CollapseItem.js +108 -78
  30. package/dist/packages/_es/Comment.js +279 -207
  31. package/dist/packages/_es/ConfigProvider.js +55 -37
  32. package/dist/packages/_es/Countdown.js +212 -100
  33. package/dist/packages/_es/Countup.js +445 -232
  34. package/dist/packages/_es/DatePicker.js +265 -162
  35. package/dist/packages/_es/Dialog.js +213 -161
  36. package/dist/packages/_es/Divider.js +57 -42
  37. package/dist/packages/_es/Drag.js +153 -70
  38. package/dist/packages/_es/Ecard.js +104 -64
  39. package/dist/packages/_es/Elevator.js +219 -143
  40. package/dist/packages/_es/Ellipsis.js +178 -95
  41. package/dist/packages/_es/Empty.js +39 -23
  42. package/dist/packages/_es/FixedNav.js +116 -93
  43. package/dist/packages/_es/Form.js +178 -107
  44. package/dist/packages/_es/FormItem.js +61 -48
  45. package/dist/packages/_es/Grid.js +6 -5
  46. package/dist/packages/_es/GridItem.js +84 -58
  47. package/dist/packages/_es/Image.js +130 -90
  48. package/dist/packages/_es/ImagePreview.js +412 -256
  49. package/dist/packages/_es/Indicator.js +34 -30
  50. package/dist/packages/_es/InfiniteLoading.js +136 -83
  51. package/dist/packages/_es/Input.js +264 -160
  52. package/dist/packages/_es/InputNumber.js +117 -81
  53. package/dist/packages/_es/Interceptor-956b24fc.js +29 -0
  54. package/dist/packages/_es/Invoice.js +130 -104
  55. package/dist/packages/_es/Layout.js +4 -3
  56. package/dist/packages/_es/List.js +215 -117
  57. package/dist/packages/_es/Menu.js +150 -95
  58. package/dist/packages/_es/MenuItem.js +154 -109
  59. package/dist/packages/_es/Navbar.js +119 -103
  60. package/dist/packages/_es/Noticebar.js +312 -197
  61. package/dist/packages/_es/Notify.js +166 -110
  62. package/dist/packages/_es/NumberKeyboard.js +202 -127
  63. package/dist/packages/_es/Overlay.js +80 -52
  64. package/dist/packages/_es/Pagination.js +100 -70
  65. package/dist/packages/_es/Picker.js +437 -275
  66. package/dist/packages/_es/Popover.js +225 -122
  67. package/dist/packages/_es/Popup.js +4 -4
  68. package/dist/packages/_es/Price.js +82 -44
  69. package/dist/packages/_es/Progress.js +79 -63
  70. package/dist/packages/_es/PullRefresh.js +173 -95
  71. package/dist/packages/_es/Radio.js +4 -4
  72. package/dist/packages/_es/RadioGroup.js +3 -3
  73. package/dist/packages/_es/Range.js +347 -204
  74. package/dist/packages/_es/Rate.js +141 -92
  75. package/dist/packages/_es/Row.js +27 -21
  76. package/dist/packages/_es/Searchbar.js +174 -123
  77. package/dist/packages/_es/ShortPassword.js +93 -69
  78. package/dist/packages/_es/SideNavbar.js +80 -49
  79. package/dist/packages/_es/SideNavbarItem.js +32 -22
  80. package/dist/packages/_es/Signature.js +146 -83
  81. package/dist/packages/_es/Skeleton.js +130 -110
  82. package/dist/packages/_es/Sku.js +343 -250
  83. package/dist/packages/_es/Step.js +86 -59
  84. package/dist/packages/_es/Steps.js +31 -26
  85. package/dist/packages/_es/Sticky.js +4 -4
  86. package/dist/packages/_es/SubSideNavbar.js +74 -52
  87. package/dist/packages/_es/Swipe.js +155 -83
  88. package/dist/packages/_es/Swiper.js +311 -174
  89. package/dist/packages/_es/SwiperItem.js +44 -28
  90. package/dist/packages/_es/Switch.js +68 -55
  91. package/dist/packages/_es/TabPane.js +41 -30
  92. package/dist/packages/_es/Tabbar.js +52 -41
  93. package/dist/packages/_es/TabbarItem.js +82 -61
  94. package/dist/packages/_es/Table.js +165 -109
  95. package/dist/packages/_es/Tabs.js +388 -240
  96. package/dist/packages/_es/Tag.js +61 -44
  97. package/dist/packages/_es/Textarea.js +124 -80
  98. package/dist/packages/_es/TimeDetail.js +76 -49
  99. package/dist/packages/_es/TimePannel.js +48 -34
  100. package/dist/packages/_es/TimeSelect.js +68 -47
  101. package/dist/packages/_es/Toast.js +218 -144
  102. package/dist/packages/_es/Tour.js +192 -138
  103. package/dist/packages/_es/TrendArrow.js +77 -57
  104. package/dist/packages/_es/Uploader.js +359 -234
  105. package/dist/packages/_es/Video.js +316 -191
  106. package/dist/packages/_es/Watermark.js +117 -84
  107. package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +10 -0
  108. package/dist/packages/_es/common-b9a5e726.js +145 -0
  109. package/dist/packages/_es/component-81a4c1d0.js +145 -0
  110. package/dist/packages/_es/index-29892cda.js +33 -0
  111. package/dist/packages/_es/index-43c34ac6.js +30 -0
  112. package/dist/packages/_es/index-54d03fc1.js +8 -0
  113. package/dist/packages/_es/index-79c5dc33.js +10 -0
  114. package/dist/packages/_es/index-7a7385e4.js +67 -0
  115. package/dist/packages/_es/index-87422be8.js +942 -0
  116. package/dist/packages/_es/index-da0a7662.js +259 -0
  117. package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +46 -0
  118. package/dist/packages/_es/index.vue_vue_type_script_lang-a8856969.js +97 -0
  119. package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +151 -0
  120. package/dist/packages/_es/mountComponent-8b24c346.js +39 -0
  121. package/dist/packages/_es/pxCheck-c6b9f6b7.js +6 -0
  122. package/dist/packages/_es/raf-729dad54.js +25 -0
  123. package/dist/packages/_es/renderIcon-3d0fd47c.js +9 -0
  124. package/dist/packages/locale/lang/baseLang-3a8457ac.js +5 -0
  125. package/dist/packages/locale/lang/en-US.js +39 -36
  126. package/dist/packages/locale/lang/id-ID.js +39 -36
  127. package/dist/packages/locale/lang/index.js +44 -22
  128. package/dist/packages/locale/lang/zh-CN.js +38 -35
  129. package/dist/packages/locale/lang/zh-TW.js +38 -35
  130. package/dist/resolver/index.js +26 -1
  131. package/dist/resolver/index.mjs +17 -14
  132. package/dist/smartips/web-types.json +1 -1
  133. package/dist/style.css +1 -1
  134. package/dist/styles/themes/default.scss +50 -50
  135. package/dist/styles/themes/jdb.scss +50 -50
  136. package/dist/styles/themes/jddkh.scss +50 -50
  137. package/dist/styles/themes/jdt.scss +50 -50
  138. package/dist/types/index.d.ts +1 -1
  139. package/package.json +2 -2
  140. package/dist/packages/_es/Interceptor-6e26b757.js +0 -18
  141. package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +0 -9
  142. package/dist/packages/_es/common-d218746f.js +0 -116
  143. package/dist/packages/_es/component-234624bc.js +0 -89
  144. package/dist/packages/_es/index-14dfadc4.js +0 -561
  145. package/dist/packages/_es/index-192a3ef6.js +0 -29
  146. package/dist/packages/_es/index-360c5092.js +0 -210
  147. package/dist/packages/_es/index-496e6e05.js +0 -24
  148. package/dist/packages/_es/index-50eed3d9.js +0 -7
  149. package/dist/packages/_es/index-53ec2d4d.js +0 -34
  150. package/dist/packages/_es/index-fadb0974.js +0 -8
  151. package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +0 -43
  152. package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +0 -77
  153. package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +0 -110
  154. package/dist/packages/_es/mountComponent-6d4ff200.js +0 -23
  155. package/dist/packages/_es/pxCheck-38173291.js +0 -4
  156. package/dist/packages/_es/raf-a74f1a06.js +0 -16
  157. package/dist/packages/_es/renderIcon-47498b32.js +0 -5
  158. package/dist/packages/locale/lang/baseLang-0bdc6353.js +0 -5
@@ -1,8 +1,9 @@
1
- import { toRefs as b, computed as k, watchEffect as E, openBlock as m, createElementBlock as d, createElementVNode as y, normalizeClass as S, renderSlot as V, createTextVNode as w, toDisplayString as f, Fragment as T, renderList as z, createCommentVNode as N } from "vue";
2
- import { c as M } from "./component-234624bc.js";
3
- import { _ as R } from "./_plugin-vue_export-helper-dad06003.js";
1
+ import { toRefs, computed, watchEffect, openBlock, createElementBlock, createElementVNode, normalizeClass, renderSlot, createTextVNode, toDisplayString, Fragment, renderList, createCommentVNode } from "vue";
2
+ import { c as createComponent } from "./component-81a4c1d0.js";
3
+ import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
4
4
  import "../locale/lang";
5
- const { create: B, translate: I } = M("pagination"), D = B({
5
+ const { create, translate } = createComponent("pagination");
6
+ const _sfc_main = create({
6
7
  props: {
7
8
  modelValue: {
8
9
  type: Number,
@@ -38,95 +39,124 @@ const { create: B, translate: I } = M("pagination"), D = B({
38
39
  },
39
40
  forceEllipses: {
40
41
  type: Boolean,
41
- default: !1
42
+ default: false
42
43
  }
43
44
  },
44
45
  components: {},
45
46
  emits: ["change", "update:modelValue"],
46
- setup(e, { emit: l }) {
47
- const { modelValue: r, mode: v, showPageSize: C, forceEllipses: h } = b(e), n = k(() => {
48
- const { pageCount: t, totalItems: a, itemsPerPage: o } = b(e), s = +t.value || Math.ceil(+a.value / +o.value);
49
- return Math.max(1, s);
50
- }), c = (t, a) => {
51
- t > n.value || t < 1 || (t != r.value && l("update:modelValue", t), a && l("change", t));
52
- }, g = (t, a, o = !1) => ({ number: t, text: a, active: o }), P = k(() => {
53
- if (v.value == "simple")
47
+ setup(props, { emit }) {
48
+ const { modelValue, mode, showPageSize, forceEllipses } = toRefs(props);
49
+ const countRef = computed(() => {
50
+ const { pageCount, totalItems, itemsPerPage } = toRefs(props);
51
+ const num = +pageCount.value || Math.ceil(+totalItems.value / +itemsPerPage.value);
52
+ return Math.max(1, num);
53
+ });
54
+ const select = (curPage, isSelect) => {
55
+ if (curPage > countRef.value || curPage < 1)
54
56
  return;
55
- let t = [];
56
- const a = n.value, o = +C.value;
57
- let s = 1, i = a;
58
- const $ = a > o;
59
- $ && (s = Math.max(r.value - Math.floor(o / 2), 1), i = s + +o - 1, i > a && (i = a, s = i - +o + 1));
60
- for (var u = s; u <= i; u++) {
61
- const p = g(u, u, r.value == u);
62
- t.push(p);
57
+ if (curPage != modelValue.value)
58
+ emit("update:modelValue", curPage);
59
+ if (isSelect)
60
+ emit("change", curPage);
61
+ };
62
+ const setPage = (number, text, active = false) => {
63
+ return { number, text, active };
64
+ };
65
+ const pages = computed(() => {
66
+ if (mode.value == "simple")
67
+ return;
68
+ let items = [];
69
+ const pageCount = countRef.value;
70
+ const pageSize = +showPageSize.value;
71
+ let startPage = 1;
72
+ let endPage = pageCount;
73
+ const partialShow = pageCount > pageSize;
74
+ if (partialShow) {
75
+ startPage = Math.max(modelValue.value - Math.floor(pageSize / 2), 1);
76
+ endPage = startPage + +pageSize - 1;
77
+ if (endPage > pageCount) {
78
+ endPage = pageCount;
79
+ startPage = endPage - +pageSize + 1;
80
+ }
63
81
  }
64
- if ($ && o > 0 && h.value) {
65
- if (s > 1) {
66
- const p = g(s - 1, "...");
67
- t.unshift(p);
82
+ for (var i = startPage; i <= endPage; i++) {
83
+ const page = setPage(i, i, modelValue.value == i);
84
+ items.push(page);
85
+ }
86
+ if (partialShow && pageSize > 0 && forceEllipses.value) {
87
+ if (startPage > 1) {
88
+ const prevPage = setPage(startPage - 1, "...");
89
+ items.unshift(prevPage);
68
90
  }
69
- if (i < a) {
70
- const p = g(i + 1, "...");
71
- t.push(p);
91
+ if (endPage < pageCount) {
92
+ const nextPage = setPage(endPage + 1, "...");
93
+ items.push(nextPage);
72
94
  }
73
95
  }
74
- return t;
96
+ return items;
97
+ });
98
+ watchEffect(() => {
99
+ select(modelValue.value, false);
75
100
  });
76
- return E(() => {
77
- c(r.value, !1);
78
- }), {
79
- modelValue: r,
80
- select: c,
81
- countRef: n,
82
- mode: v,
83
- pages: P,
84
- forceEllipses: h,
85
- translate: I
101
+ return {
102
+ modelValue,
103
+ select,
104
+ countRef,
105
+ mode,
106
+ pages,
107
+ forceEllipses,
108
+ translate
86
109
  };
87
110
  }
88
- }), F = { class: "nut-pagination" }, L = {
111
+ });
112
+ const _hoisted_1 = { class: "nut-pagination" };
113
+ const _hoisted_2 = {
89
114
  key: 0,
90
115
  class: "nut-pagination-contain"
91
- }, j = ["onClick"], q = {
116
+ };
117
+ const _hoisted_3 = ["onClick"];
118
+ const _hoisted_4 = {
92
119
  key: 1,
93
120
  class: "nut-pagination-contain"
94
- }, A = { class: "nut-pagination-simple" };
95
- function G(e, l, r, v, C, h) {
96
- return m(), d("view", F, [
97
- y("view", {
98
- class: S(["nut-pagination-prev", e.mode == "multi" ? "" : "simple-border", e.modelValue == 1 ? "disabled" : ""]),
99
- onClick: l[0] || (l[0] = (n) => e.select(e.modelValue - 1, !0))
121
+ };
122
+ const _hoisted_5 = { class: "nut-pagination-simple" };
123
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
124
+ return openBlock(), createElementBlock("view", _hoisted_1, [
125
+ createElementVNode("view", {
126
+ class: normalizeClass(["nut-pagination-prev", _ctx.mode == "multi" ? "" : "simple-border", _ctx.modelValue == 1 ? "disabled" : ""]),
127
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.select(_ctx.modelValue - 1, true))
100
128
  }, [
101
- V(e.$slots, "prev-text", {}, () => [
102
- w(f(e.prevText || e.translate("prev")), 1)
129
+ renderSlot(_ctx.$slots, "prev-text", {}, () => [
130
+ createTextVNode(toDisplayString(_ctx.prevText || _ctx.translate("prev")), 1)
103
131
  ])
104
132
  ], 2),
105
- e.mode == "multi" ? (m(), d("view", L, [
106
- (m(!0), d(T, null, z(e.pages, (n, c) => (m(), d("view", {
107
- key: c + "pagination",
108
- class: S(["nut-pagination-item", n.active ? "active" : ""]),
109
- onClick: (g) => e.select(n.number, !0)
110
- }, [
111
- V(e.$slots, "page", { item: n }, () => [
112
- w(f(n.text), 1)
113
- ])
114
- ], 10, j))), 128))
115
- ])) : N("", !0),
116
- e.mode == "simple" ? (m(), d("view", q, [
117
- y("view", A, f(e.modelValue) + "/" + f(e.countRef), 1)
118
- ])) : N("", !0),
119
- y("view", {
120
- class: S(["nut-pagination-next", e.modelValue >= e.countRef ? "disabled" : ""]),
121
- onClick: l[1] || (l[1] = (n) => e.select(e.modelValue + 1, !0))
133
+ _ctx.mode == "multi" ? (openBlock(), createElementBlock("view", _hoisted_2, [
134
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.pages, (item, index2) => {
135
+ return openBlock(), createElementBlock("view", {
136
+ key: index2 + "pagination",
137
+ class: normalizeClass(["nut-pagination-item", item.active ? "active" : ""]),
138
+ onClick: ($event) => _ctx.select(item.number, true)
139
+ }, [
140
+ renderSlot(_ctx.$slots, "page", { item }, () => [
141
+ createTextVNode(toDisplayString(item.text), 1)
142
+ ])
143
+ ], 10, _hoisted_3);
144
+ }), 128))
145
+ ])) : createCommentVNode("", true),
146
+ _ctx.mode == "simple" ? (openBlock(), createElementBlock("view", _hoisted_4, [
147
+ createElementVNode("view", _hoisted_5, toDisplayString(_ctx.modelValue) + "/" + toDisplayString(_ctx.countRef), 1)
148
+ ])) : createCommentVNode("", true),
149
+ createElementVNode("view", {
150
+ class: normalizeClass(["nut-pagination-next", _ctx.modelValue >= _ctx.countRef ? "disabled" : ""]),
151
+ onClick: _cache[1] || (_cache[1] = ($event) => _ctx.select(_ctx.modelValue + 1, true))
122
152
  }, [
123
- V(e.$slots, "next-text", {}, () => [
124
- w(f(e.nextText || e.translate("next")), 1)
153
+ renderSlot(_ctx.$slots, "next-text", {}, () => [
154
+ createTextVNode(toDisplayString(_ctx.nextText || _ctx.translate("next")), 1)
125
155
  ])
126
156
  ], 2)
127
157
  ]);
128
158
  }
129
- const Q = /* @__PURE__ */ R(D, [["render", G]]);
159
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
130
160
  export {
131
- Q as default
161
+ index as default
132
162
  };