@nutui/nutui 3.1.22-beta.5 → 3.1.23-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +3 -4
  3. package/dist/nutui.es.js +20412 -4214
  4. package/dist/nutui.umd.js +20518 -4216
  5. package/dist/packages/_es/ActionSheet.js +149 -17
  6. package/dist/packages/_es/Address.js +535 -110
  7. package/dist/packages/_es/AddressList.js +615 -113
  8. package/dist/packages/_es/Animate.js +59 -17
  9. package/dist/packages/_es/Audio.js +257 -53
  10. package/dist/packages/_es/AudioOperate.js +100 -13
  11. package/dist/packages/_es/Avatar.js +162 -38
  12. package/dist/packages/_es/AvatarGroup.js +73 -14
  13. package/dist/packages/_es/BackTop.js +156 -43
  14. package/dist/packages/_es/Badge.js +86 -14
  15. package/dist/packages/_es/Barrage.js +120 -41
  16. package/dist/packages/_es/Button.js +128 -23
  17. package/dist/packages/_es/Calendar.js +246 -30
  18. package/dist/packages/_es/CalendarItem.js +1 -1
  19. package/dist/packages/_es/Card.js +107 -10
  20. package/dist/packages/_es/Cascader.js +496 -147
  21. package/dist/packages/_es/Category.js +58 -15
  22. package/dist/packages/_es/CategoryPane.js +111 -11
  23. package/dist/packages/_es/Cell.js +108 -21
  24. package/dist/packages/_es/CellGroup.js +44 -9
  25. package/dist/packages/_es/Checkbox.js +134 -29
  26. package/dist/packages/_es/CheckboxGroup.js +79 -29
  27. package/dist/packages/_es/CircleProgress.js +150 -28
  28. package/dist/packages/_es/Col.js +56 -14
  29. package/dist/packages/_es/Collapse.js +109 -32
  30. package/dist/packages/_es/CollapseItem.js +253 -59
  31. package/dist/packages/_es/Comment.js +434 -64
  32. package/dist/packages/_es/ConfigProvider.js +20 -8
  33. package/dist/packages/_es/CountDown.js +238 -56
  34. package/dist/packages/_es/CountUp.js +539 -140
  35. package/dist/packages/_es/DatePicker.js +315 -98
  36. package/dist/packages/_es/Dialog.js +289 -60
  37. package/dist/packages/_es/Divider.js +65 -13
  38. package/dist/packages/_es/Drag.js +197 -56
  39. package/dist/packages/_es/Ecard.js +159 -24
  40. package/dist/packages/_es/Elevator.js +255 -58
  41. package/dist/packages/_es/Ellipsis.js +200 -58
  42. package/dist/packages/_es/Empty.js +71 -12
  43. package/dist/packages/_es/FixedNav.js +122 -15
  44. package/dist/packages/_es/Form.js +151 -64
  45. package/dist/packages/_es/FormItem.js +114 -15
  46. package/dist/packages/_es/Grid.js +6 -5
  47. package/dist/packages/_es/GridItem.js +144 -33
  48. package/dist/packages/_es/Icon.js +40 -15
  49. package/dist/packages/_es/Image.js +137 -26
  50. package/dist/packages/_es/ImagePreview.js +547 -76
  51. package/dist/packages/_es/Indicator.js +62 -15
  52. package/dist/packages/_es/InfiniteLoading.js +249 -57
  53. package/dist/packages/_es/Input.js +433 -51
  54. package/dist/packages/_es/InputNumber.js +160 -41
  55. package/dist/packages/_es/Layout.js +5 -4
  56. package/dist/packages/_es/List.js +106 -18
  57. package/dist/packages/_es/Menu.js +168 -44
  58. package/dist/packages/_es/MenuItem.js +173 -37
  59. package/dist/packages/_es/Navbar.js +192 -30
  60. package/dist/packages/_es/NoticeBar.js +380 -74
  61. package/dist/packages/_es/Notify.js +227 -72
  62. package/dist/packages/_es/NumberKeyboard.js +272 -41
  63. package/dist/packages/_es/OldPicker.js +457 -130
  64. package/dist/packages/_es/OverLay.js +98 -24
  65. package/dist/packages/_es/Pagination.js +157 -39
  66. package/dist/packages/_es/Picker.js +454 -129
  67. package/dist/packages/_es/Popover.js +957 -318
  68. package/dist/packages/_es/Popup.js +299 -55
  69. package/dist/packages/_es/Price.js +118 -16
  70. package/dist/packages/_es/Progress.js +146 -14
  71. package/dist/packages/_es/PullRefresh.js +339 -84
  72. package/dist/packages/_es/Radio.js +90 -22
  73. package/dist/packages/_es/RadioGroup.js +37 -8
  74. package/dist/packages/_es/Range.js +408 -83
  75. package/dist/packages/_es/Rate.js +192 -36
  76. package/dist/packages/_es/Row.js +64 -22
  77. package/dist/packages/_es/SearchBar.js +238 -37
  78. package/dist/packages/_es/ShortPassword.js +225 -35
  79. package/dist/packages/_es/SideNavBar.js +81 -24
  80. package/dist/packages/_es/SideNavBarItem.js +46 -11
  81. package/dist/packages/_es/Signature.js +160 -41
  82. package/dist/packages/_es/Skeleton.js +136 -20
  83. package/dist/packages/_es/Sku.js +491 -84
  84. package/dist/packages/_es/Step.js +115 -20
  85. package/dist/packages/_es/Steps.js +53 -18
  86. package/dist/packages/_es/Sticky.js +138 -53
  87. package/dist/packages/_es/SubSideNavBar.js +82 -17
  88. package/dist/packages/_es/Swipe.js +178 -41
  89. package/dist/packages/_es/Swiper.js +433 -121
  90. package/dist/packages/_es/SwiperItem.js +53 -22
  91. package/dist/packages/_es/Switch.js +116 -21
  92. package/dist/packages/_es/TabPane.js +39 -12
  93. package/dist/packages/_es/Tabbar.js +72 -17
  94. package/dist/packages/_es/TabbarItem.js +151 -29
  95. package/dist/packages/_es/Table.js +178 -18
  96. package/dist/packages/_es/Tabs.js +202 -43
  97. package/dist/packages/_es/Tag.js +97 -20
  98. package/dist/packages/_es/TextArea.js +160 -42
  99. package/dist/packages/_es/TimeDetail.js +79 -18
  100. package/dist/packages/_es/TimePannel.js +48 -14
  101. package/dist/packages/_es/TimeSelect.js +112 -15
  102. package/dist/packages/_es/Toast.js +310 -71
  103. package/dist/packages/_es/Uploader.js +455 -104
  104. package/dist/packages/_es/Video.js +332 -74
  105. package/dist/packages/_es/common.js +128 -38
  106. package/dist/packages/_es/component.js +76 -35
  107. package/dist/packages/_es/index.js +6 -5
  108. package/dist/packages/_es/index2.js +30 -9
  109. package/dist/packages/_es/index3.js +8 -6
  110. package/dist/packages/_es/index4.js +64 -13
  111. package/dist/packages/_es/index5.js +780 -164
  112. package/dist/packages/_es/plugin-vue_export-helper.js +8 -7
  113. package/dist/packages/_es/pxCheck.js +5 -3
  114. package/dist/packages/_es/raf.js +15 -8
  115. package/dist/packages/imagepreview/index.scss +6 -1
  116. package/dist/packages/locale/lang/baseLang.js +3 -3
  117. package/dist/packages/locale/lang/en-US.js +105 -5
  118. package/dist/packages/locale/lang/id-ID.js +105 -5
  119. package/dist/packages/locale/lang/index.js +38 -16
  120. package/dist/packages/locale/lang/zh-CN.js +105 -5
  121. package/dist/packages/locale/lang/zh-TW.js +105 -5
  122. package/dist/packages/picker/index.scss +13 -0
  123. package/dist/smartips/attributes.json +8 -0
  124. package/dist/smartips/tags.json +3 -1
  125. package/dist/smartips/web-types.json +19 -1
  126. package/dist/style.css +1 -1
  127. package/dist/style.es.js +1 -1
  128. package/dist/styles/themes/default.scss +49 -49
  129. package/dist/styles/themes/jdb.scss +49 -49
  130. package/dist/styles/themes/jdt.scss +49 -49
  131. package/dist/styles/variables-jdb.scss +4 -1
  132. package/dist/styles/variables-jdt.scss +4 -1
  133. package/dist/styles/variables.scss +1 -1
  134. package/dist/types/__VUE/actionsheet/index.vue.d.ts +3 -3
  135. package/dist/types/__VUE/address/index.vue.d.ts +4 -4
  136. package/dist/types/__VUE/calendar/index.vue.d.ts +1 -1
  137. package/dist/types/__VUE/cascader/index.vue.d.ts +3 -3
  138. package/dist/types/__VUE/cell/index.vue.d.ts +2 -2
  139. package/dist/types/__VUE/checkbox/index.vue.d.ts +2 -2
  140. package/dist/types/__VUE/collapse/index.vue.d.ts +2 -2
  141. package/dist/types/__VUE/datepicker/index.vue.d.ts +2 -2
  142. package/dist/types/__VUE/dialog/index.vue.d.ts +2 -2
  143. package/dist/types/__VUE/ecard/index.vue.d.ts +2 -2
  144. package/dist/types/__VUE/fixednav/index.vue.d.ts +2 -2
  145. package/dist/types/__VUE/grid/index.vue.d.ts +3 -3
  146. package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +95 -0
  147. package/dist/types/__VUE/imagepreview/index.vue.d.ts +23 -25
  148. package/dist/types/__VUE/infiniteloading/index.vue.d.ts +6 -6
  149. package/dist/types/__VUE/input/index.vue.d.ts +2 -2
  150. package/dist/types/__VUE/menu/index.vue.d.ts +4 -4
  151. package/dist/types/__VUE/menuitem/index.vue.d.ts +1 -1
  152. package/dist/types/__VUE/numberkeyboard/index.vue.d.ts +2 -2
  153. package/dist/types/__VUE/oldpicker/index.vue.d.ts +3 -3
  154. package/dist/types/__VUE/picker/index.vue.d.ts +3 -3
  155. package/dist/types/__VUE/popover/index.vue.d.ts +6 -6
  156. package/dist/types/__VUE/popup/index.vue.d.ts +4 -4
  157. package/dist/types/__VUE/range/index.vue.d.ts +1 -1
  158. package/dist/types/__VUE/rate/index.vue.d.ts +2 -2
  159. package/dist/types/__VUE/searchbar/index.vue.d.ts +2 -2
  160. package/dist/types/__VUE/shortpassword/index.vue.d.ts +1 -1
  161. package/dist/types/__VUE/sku/index.vue.d.ts +3 -3
  162. package/dist/types/__VUE/swipe/index.vue.d.ts +2 -2
  163. package/dist/types/__VUE/switch/index.vue.d.ts +2 -2
  164. package/dist/types/__VUE/tabbar/index.vue.d.ts +2 -2
  165. package/dist/types/__VUE/textarea/index.vue.d.ts +2 -2
  166. package/dist/types/__VUE/toast/index.vue.d.ts +1 -1
  167. package/dist/types/index.d.ts +1 -1
  168. package/package.json +1 -2
@@ -1,23 +1,183 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.5 Fri Jun 24 2022 15:10:09 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { c as t } from "./component.js";
7
- import { h as e, reactive as a, computed as s, watch as l, toRefs as r, resolveComponent as n, openBlock as o, createElementBlock as _, normalizeClass as u, createElementVNode as c, Fragment as i, renderList as d, createTextVNode as m, toDisplayString as p, renderSlot as y, createBlock as b, createCommentVNode as f } from "vue";
8
- import { _ as v } from "./plugin-vue_export-helper.js";
6
+ import { c as createComponent } from "./component.js";
7
+ import { h, reactive, computed, watch, toRefs, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, Fragment, renderList, createTextVNode, toDisplayString, renderSlot, createBlock, createCommentVNode } from "vue";
8
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
9
  import "../locale/lang";
10
- var k = { setup: (t2) => () => e("view", {}, t2.slots[0] ? t2.slots[0](t2.record) : t2.slots[1](t2.record)), props: { slots: Array, record: Object } };
11
- const { componentName: w, create: C, translate: D } = t("table"), h = C(((t2, e2) => ({ components: { RenderColumn: k }, props: { bordered: { type: Boolean, default: true }, columns: { type: Array, default: () => [] }, data: { type: Object, default: () => ({}) }, summary: { type: Function, default: null }, striped: { type: Boolean, default: false } }, emits: ["sorter"], setup(n2, { emit: o2, slots: _2 }) {
12
- const u2 = a({ curData: n2.data }), c2 = s(() => ({ [t2]: true }));
13
- return l(() => n2.data, (t3) => {
14
- u2.curData = t3.slice();
15
- }), { ...r(u2), classes: c2, cellClasses: (t3) => ({ "nut-table__main__head__tr--border": n2.bordered, [`nut-table__main__head__tr--align${t3.align ? t3.align : ""}`]: true }), getColumnItem: (t3) => n2.columns.filter((e3) => e3.key === t3)[0], handleSorterClick: (t3) => {
16
- t3.sorter && (o2("sorter", t3), u2.curData = typeof t3.sorter == "function" ? u2.curData.sort(t3.sorter) : t3.sorter === "default" ? u2.curData.sort() : u2.curData);
17
- }, sortDataItem: () => n2.columns.map((t3) => [t3.key, t3.render]), translate: e2 };
18
- } }))(w, D)), g = { class: "nut-table__main__head" }, x = { class: "nut-table__main__head__tr" }, $ = ["onClick"], j = { class: "nut-table__main__body" }, I = { key: 1 }, A = { key: 0, class: "nut-table__summary" }, B = ["innerHTML"], H = { key: 1, class: "nut-table__nodata" }, L = { key: 0, class: "nut-table__nodata__text" };
19
- var M = v(h, [["render", function(t2, e2, a2, s2, l2, r2) {
20
- const v2 = n("nut-icon"), k2 = n("RenderColumn");
21
- return o(), _("view", { class: u(t2.classes) }, [c("view", { class: u(["nut-table__main", { "nut-table__main--striped": t2.striped }]) }, [c("view", g, [c("view", x, [(o(true), _(i, null, d(t2.columns, (e3) => (o(), _("span", { class: u(["nut-table__main__head__tr__th", t2.cellClasses(e3)]), key: e3.key, onClick: (a3) => t2.handleSorterClick(e3) }, [m(p(e3.title) + " ", 1), y(t2.$slots, "icon"), !t2.$slots.icon && e3.sorter ? (o(), b(v2, { key: 0, name: "down-arrow", size: "12px" })) : f("", true)], 10, $))), 128))])]), c("view", j, [(o(true), _(i, null, d(t2.curData, (e3) => (o(), _("view", { class: "nut-table__main__body__tr", key: e3 }, [(o(true), _(i, null, d(t2.sortDataItem(), ([a3, s3]) => (o(), _("span", { class: u(["nut-table__main__body__tr__td", t2.cellClasses(t2.getColumnItem(a3))]), key: a3 }, [typeof e3[a3] == "function" || typeof s3 == "function" ? (o(), b(k2, { key: 0, slots: [s3, e3[a3]], record: e3 }, null, 8, ["slots", "record"])) : (o(), _("view", I, p(e3[a3]), 1))], 2))), 128))]))), 128))])], 2), t2.summary ? (o(), _("view", A, [c("span", { class: "nut-table__summary__text", innerHTML: t2.summary().value }, null, 8, B)])) : f("", true), t2.curData.length ? f("", true) : (o(), _("view", H, [c("div", { class: u(["nut-table__nodata", { "nut-table__nodata--border": t2.bordered }]) }, [y(t2.$slots, "nodata"), t2.$slots.nodata ? f("", true) : (o(), _("div", L, p(t2.translate("noData")), 1))], 2)]))], 2);
22
- }]]);
23
- export { M as default };
10
+ var RenderColumn = {
11
+ setup(props) {
12
+ return () => h(`view`, {}, props.slots[0] ? props.slots[0](props.record) : props.slots[1](props.record));
13
+ },
14
+ props: {
15
+ slots: Array,
16
+ record: Object
17
+ }
18
+ };
19
+ const component = (componentName2, translate2) => {
20
+ return {
21
+ components: {
22
+ RenderColumn
23
+ },
24
+ props: {
25
+ bordered: {
26
+ type: Boolean,
27
+ default: true
28
+ },
29
+ columns: {
30
+ type: Array,
31
+ default: () => {
32
+ return [];
33
+ }
34
+ },
35
+ data: {
36
+ type: Object,
37
+ default: () => {
38
+ return {};
39
+ }
40
+ },
41
+ summary: {
42
+ type: Function,
43
+ default: null
44
+ },
45
+ striped: {
46
+ type: Boolean,
47
+ default: false
48
+ }
49
+ },
50
+ emits: ["sorter"],
51
+ setup(props, { emit, slots }) {
52
+ const state = reactive({
53
+ curData: props.data
54
+ });
55
+ const classes = computed(() => {
56
+ const prefixCls = componentName2;
57
+ return {
58
+ [prefixCls]: true
59
+ };
60
+ });
61
+ const cellClasses = (item) => {
62
+ return {
63
+ "nut-table__main__head__tr--border": props.bordered,
64
+ [`nut-table__main__head__tr--align${item.align ? item.align : ""}`]: true
65
+ };
66
+ };
67
+ const getColumnItem = (value) => {
68
+ return props.columns.filter((item) => item.key === value)[0];
69
+ };
70
+ const handleSorterClick = (item) => {
71
+ if (item.sorter) {
72
+ emit("sorter", item);
73
+ state.curData = typeof item.sorter === "function" ? state.curData.sort(item.sorter) : item.sorter === "default" ? state.curData.sort() : state.curData;
74
+ }
75
+ };
76
+ const sortDataItem = () => {
77
+ return props.columns.map((columns) => {
78
+ return [columns.key, columns.render];
79
+ });
80
+ };
81
+ watch(() => props.data, (val) => {
82
+ state.curData = val.slice();
83
+ });
84
+ return {
85
+ ...toRefs(state),
86
+ classes,
87
+ cellClasses,
88
+ getColumnItem,
89
+ handleSorterClick,
90
+ sortDataItem,
91
+ translate: translate2
92
+ };
93
+ }
94
+ };
95
+ };
96
+ const { componentName, create, translate } = createComponent("table");
97
+ const _sfc_main = create(component(componentName, translate));
98
+ const _hoisted_1 = { class: "nut-table__main__head" };
99
+ const _hoisted_2 = { class: "nut-table__main__head__tr" };
100
+ const _hoisted_3 = ["onClick"];
101
+ const _hoisted_4 = { class: "nut-table__main__body" };
102
+ const _hoisted_5 = { key: 1 };
103
+ const _hoisted_6 = {
104
+ key: 0,
105
+ class: "nut-table__summary"
106
+ };
107
+ const _hoisted_7 = ["innerHTML"];
108
+ const _hoisted_8 = {
109
+ key: 1,
110
+ class: "nut-table__nodata"
111
+ };
112
+ const _hoisted_9 = {
113
+ key: 0,
114
+ class: "nut-table__nodata__text"
115
+ };
116
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
117
+ const _component_nut_icon = resolveComponent("nut-icon");
118
+ const _component_RenderColumn = resolveComponent("RenderColumn");
119
+ return openBlock(), createElementBlock("view", {
120
+ class: normalizeClass(_ctx.classes)
121
+ }, [
122
+ createElementVNode("view", {
123
+ class: normalizeClass(["nut-table__main", { "nut-table__main--striped": _ctx.striped }])
124
+ }, [
125
+ createElementVNode("view", _hoisted_1, [
126
+ createElementVNode("view", _hoisted_2, [
127
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columns, (item) => {
128
+ return openBlock(), createElementBlock("span", {
129
+ class: normalizeClass(["nut-table__main__head__tr__th", _ctx.cellClasses(item)]),
130
+ key: item.key,
131
+ onClick: ($event) => _ctx.handleSorterClick(item)
132
+ }, [
133
+ createTextVNode(toDisplayString(item.title) + " ", 1),
134
+ renderSlot(_ctx.$slots, "icon"),
135
+ !_ctx.$slots.icon && item.sorter ? (openBlock(), createBlock(_component_nut_icon, {
136
+ key: 0,
137
+ name: "down-arrow",
138
+ size: "12px"
139
+ })) : createCommentVNode("", true)
140
+ ], 10, _hoisted_3);
141
+ }), 128))
142
+ ])
143
+ ]),
144
+ createElementVNode("view", _hoisted_4, [
145
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.curData, (item) => {
146
+ return openBlock(), createElementBlock("view", {
147
+ class: "nut-table__main__body__tr",
148
+ key: item
149
+ }, [
150
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.sortDataItem(), ([value, render]) => {
151
+ return openBlock(), createElementBlock("span", {
152
+ class: normalizeClass(["nut-table__main__body__tr__td", _ctx.cellClasses(_ctx.getColumnItem(value))]),
153
+ key: value
154
+ }, [
155
+ typeof item[value] === "function" || typeof render === "function" ? (openBlock(), createBlock(_component_RenderColumn, {
156
+ key: 0,
157
+ slots: [render, item[value]],
158
+ record: item
159
+ }, null, 8, ["slots", "record"])) : (openBlock(), createElementBlock("view", _hoisted_5, toDisplayString(item[value]), 1))
160
+ ], 2);
161
+ }), 128))
162
+ ]);
163
+ }), 128))
164
+ ])
165
+ ], 2),
166
+ _ctx.summary ? (openBlock(), createElementBlock("view", _hoisted_6, [
167
+ createElementVNode("span", {
168
+ class: "nut-table__summary__text",
169
+ innerHTML: _ctx.summary().value
170
+ }, null, 8, _hoisted_7)
171
+ ])) : createCommentVNode("", true),
172
+ !_ctx.curData.length ? (openBlock(), createElementBlock("view", _hoisted_8, [
173
+ createElementVNode("div", {
174
+ class: normalizeClass(["nut-table__nodata", { "nut-table__nodata--border": _ctx.bordered }])
175
+ }, [
176
+ renderSlot(_ctx.$slots, "nodata"),
177
+ !_ctx.$slots.nodata ? (openBlock(), createElementBlock("div", _hoisted_9, toDisplayString(_ctx.translate("noData")), 1)) : createCommentVNode("", true)
178
+ ], 2)
179
+ ])) : createCommentVNode("", true)
180
+ ], 2);
181
+ }
182
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
183
+ export { index as default };
@@ -1,52 +1,211 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.5 Fri Jun 24 2022 15:10:09 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { c as e } from "./component.js";
7
- import { p as t } from "./pxCheck.js";
8
- import { provide as l, computed as a, ref as i, watch as s, onMounted as n, onActivated as o, resolveComponent as r, openBlock as u, createElementBlock as p, normalizeClass as c, createElementVNode as d, normalizeStyle as y, renderSlot as m, Fragment as b, renderList as g, createCommentVNode as v, createVNode as f, toDisplayString as h } from "vue";
9
- import { _ } from "./plugin-vue_export-helper.js";
6
+ import { c as createComponent } from "./component.js";
7
+ import { p as pxCheck } from "./pxCheck.js";
8
+ import { provide, computed, ref, watch, onMounted, onActivated, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, renderSlot, Fragment, renderList, createCommentVNode, createVNode, toDisplayString } from "vue";
9
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
10
10
  import "../locale/lang";
11
- class S {
11
+ class Title {
12
12
  constructor() {
13
- this.title = "", this.paneKey = "", this.disabled = false;
13
+ this.title = "";
14
+ this.paneKey = "";
15
+ this.disabled = false;
14
16
  }
15
17
  }
16
- const k = { props: { modelValue: { type: [String, Number], default: 0 }, color: { type: String, default: "" }, direction: { type: String, default: "horizontal" }, size: { type: String, default: "normal" }, type: { type: String, default: "line" }, titleScroll: { type: Boolean, default: false }, ellipsis: { type: Boolean, default: true }, autoHeight: { type: Boolean, default: false }, background: { type: String, default: "" }, animatedTime: { type: [Number, String], default: 300 }, titleGutter: { type: [Number, String], default: 0 } }, components: {}, emits: ["update:modelValue", "click", "change"], setup(e2, { emit: r2, slots: u2 }) {
17
- l("activeKey", { activeKey: a(() => e2.modelValue) }), l("autoHeight", { autoHeight: a(() => e2.autoHeight) });
18
- const p2 = i([]), c2 = (e3) => {
19
- e3.forEach((e4, t2) => {
20
- var _a, _b, _c, _d, _e, _f, _g;
21
- let l2 = e4.type;
22
- if (l2 = l2.name || l2, l2 == "nut-tabpane") {
23
- let l3 = new S();
24
- (((_a = e4.props) == null ? void 0 : _a.title) || ((_b = e4.props) == null ? void 0 : _b["pane-key"]) || ((_c = e4.props) == null ? void 0 : _c.paneKey)) && (l3.title = (_d = e4.props) == null ? void 0 : _d.title, l3.paneKey = ((_e = e4.props) == null ? void 0 : _e["pane-key"]) || ((_f = e4.props) == null ? void 0 : _f.paneKey) || t2, l3.disabled = (_g = e4.props) == null ? void 0 : _g.disabled), p2.value.push(l3);
25
- } else
26
- c2(e4.children);
18
+ const component = {
19
+ props: {
20
+ modelValue: {
21
+ type: [String, Number],
22
+ default: 0
23
+ },
24
+ color: {
25
+ type: String,
26
+ default: ""
27
+ },
28
+ direction: {
29
+ type: String,
30
+ default: "horizontal"
31
+ },
32
+ size: {
33
+ type: String,
34
+ default: "normal"
35
+ },
36
+ type: {
37
+ type: String,
38
+ default: "line"
39
+ },
40
+ titleScroll: {
41
+ type: Boolean,
42
+ default: false
43
+ },
44
+ ellipsis: {
45
+ type: Boolean,
46
+ default: true
47
+ },
48
+ autoHeight: {
49
+ type: Boolean,
50
+ default: false
51
+ },
52
+ background: {
53
+ type: String,
54
+ default: ""
55
+ },
56
+ animatedTime: {
57
+ type: [Number, String],
58
+ default: 300
59
+ },
60
+ titleGutter: {
61
+ type: [Number, String],
62
+ default: 0
63
+ }
64
+ },
65
+ components: {},
66
+ emits: ["update:modelValue", "click", "change"],
67
+ setup(props, { emit, slots }) {
68
+ provide("activeKey", { activeKey: computed(() => props.modelValue) });
69
+ provide("autoHeight", { autoHeight: computed(() => props.autoHeight) });
70
+ const titles = ref([]);
71
+ const renderTitles = (vnodes) => {
72
+ vnodes.forEach((vnode, index2) => {
73
+ var _a, _b, _c, _d, _e, _f, _g;
74
+ let type = vnode.type;
75
+ type = type.name || type;
76
+ if (type == "nut-tabpane") {
77
+ let title = new Title();
78
+ if (((_a = vnode.props) == null ? void 0 : _a.title) || ((_b = vnode.props) == null ? void 0 : _b["pane-key"]) || ((_c = vnode.props) == null ? void 0 : _c["paneKey"])) {
79
+ title.title = (_d = vnode.props) == null ? void 0 : _d.title;
80
+ title.paneKey = ((_e = vnode.props) == null ? void 0 : _e["pane-key"]) || ((_f = vnode.props) == null ? void 0 : _f["paneKey"]) || index2;
81
+ title.disabled = (_g = vnode.props) == null ? void 0 : _g.disabled;
82
+ }
83
+ titles.value.push(title);
84
+ } else {
85
+ renderTitles(vnode.children);
86
+ }
87
+ });
88
+ };
89
+ const currentIndex = ref(props.modelValue || 0);
90
+ const findTabsIndex = (value) => {
91
+ let index2 = titles.value.findIndex((item) => item.paneKey == value);
92
+ if (titles.value.length == 0) {
93
+ console.error("[NutUI] <Tabs> \u5F53\u524D\u672A\u627E\u5230 TabPane \u7EC4\u4EF6\u5143\u7D20 , \u8BF7\u68C0\u67E5 .");
94
+ } else if (index2 == -1) {
95
+ console.error("[NutUI] <Tabs> \u8BF7\u68C0\u67E5 v-model \u503C\u662F\u5426\u4E3A paneKey ,\u5982 paneKey \u672A\u8BBE\u7F6E\uFF0C\u8BF7\u91C7\u7528\u4E0B\u6807\u63A7\u5236 .");
96
+ } else {
97
+ currentIndex.value = index2;
98
+ }
99
+ };
100
+ const init = (vnodes = ((_a) => (_a = slots.default) == null ? void 0 : _a.call(slots))()) => {
101
+ titles.value = [];
102
+ if (vnodes && vnodes.length) {
103
+ renderTitles(vnodes);
104
+ }
105
+ findTabsIndex(props.modelValue);
106
+ };
107
+ watch(() => {
108
+ var _a;
109
+ return (_a = slots.default) == null ? void 0 : _a.call(slots);
110
+ }, (vnodes) => {
111
+ init(vnodes);
27
112
  });
28
- }, d2 = i(e2.modelValue || 0), y2 = (e3) => {
29
- let t2 = p2.value.findIndex((t3) => t3.paneKey == e3);
30
- p2.value.length == 0 || t2 == -1 || (d2.value = t2);
31
- }, m2 = (t2 = ((_a) => (_a = u2.default) == null ? void 0 : _a.call(u2))()) => {
32
- p2.value = [], t2 && t2.length && c2(t2), y2(e2.modelValue);
33
- };
34
- s(() => {
35
- var _a;
36
- return (_a = u2.default) == null ? void 0 : _a.call(u2);
37
- }, (e3) => {
38
- m2(e3);
39
- }), s(() => e2.modelValue, (e3) => {
40
- y2(e3);
41
- }), n(m2), o(m2);
42
- const b2 = a(() => ({ transform: e2.direction == "horizontal" ? `translate3d(-${100 * d2.value}%, 0, 0)` : `translate3d( 0,-${100 * d2.value}%, 0)`, transitionDuration: `${e2.animatedTime}ms` })), g2 = a(() => ({ background: e2.background })), v2 = a(() => ({ color: e2.type == "smile" ? e2.color : "", background: e2.type == "line" ? e2.color : "" })), f2 = a(() => ({ marginLeft: t(e2.titleGutter), marginRight: t(e2.titleGutter) })), h2 = { tabChange: (e3, t2) => {
43
- r2("click", e3), e3.disabled || (d2.value = t2, r2("update:modelValue", e3.paneKey), r2("change", e3));
44
- } };
45
- return { titles: p2, contentStyle: b2, tabsNavStyle: g2, titleStyle: f2, tabsActiveStyle: v2, ...h2 };
46
- } }, K = ["onClick"];
47
- const { create: w } = e("tabs");
48
- var V = _(w(k), [["render", function(e2, t2, l2, a2, i2, s2) {
49
- const n2 = r("nut-icon");
50
- return u(), p("view", { class: c(["nut-tabs", [e2.direction]]) }, [d("view", { class: c(["nut-tabs__titles", { [e2.type]: e2.type, scrollable: e2.titleScroll, [e2.size]: e2.size }]), style: y(e2.tabsNavStyle) }, [e2.$slots.titles ? m(e2.$slots, "titles", { key: 0 }) : (u(true), p(b, { key: 1 }, g(e2.titles, (t3, l3) => (u(), p("view", { class: c(["nut-tabs__titles-item", { active: t3.paneKey == e2.modelValue, disabled: t3.disabled }]), style: y(e2.titleStyle), onClick: (a3) => e2.tabChange(t3, l3), key: t3.paneKey }, [e2.type == "line" ? (u(), p("view", { key: 0, class: "nut-tabs__titles-item__line", style: y(e2.tabsActiveStyle) }, null, 4)) : v("", true), e2.type == "smile" ? (u(), p("view", { key: 1, class: "nut-tabs__titles-item__smile", style: y(e2.tabsActiveStyle) }, [f(n2, { color: e2.color, name: "joy-smile" }, null, 8, ["color"])], 4)) : v("", true), d("view", { class: c(["nut-tabs__titles-item__text", { ellipsis: e2.ellipsis }]) }, h(t3.title), 3)], 14, K))), 128))], 6), d("view", { class: "nut-tabs__content", style: y(e2.contentStyle) }, [m(e2.$slots, "default")], 4)], 2);
51
- }]]);
52
- export { V as default };
113
+ watch(() => props.modelValue, (value) => {
114
+ findTabsIndex(value);
115
+ });
116
+ onMounted(init);
117
+ onActivated(init);
118
+ const contentStyle = computed(() => {
119
+ return {
120
+ transform: props.direction == "horizontal" ? `translate3d(-${currentIndex.value * 100}%, 0, 0)` : `translate3d( 0,-${currentIndex.value * 100}%, 0)`,
121
+ transitionDuration: `${props.animatedTime}ms`
122
+ };
123
+ });
124
+ const tabsNavStyle = computed(() => {
125
+ return {
126
+ background: props.background
127
+ };
128
+ });
129
+ const tabsActiveStyle = computed(() => {
130
+ return {
131
+ color: props.type == "smile" ? props.color : "",
132
+ background: props.type == "line" ? props.color : ""
133
+ };
134
+ });
135
+ const titleStyle = computed(() => {
136
+ return {
137
+ marginLeft: pxCheck(props.titleGutter),
138
+ marginRight: pxCheck(props.titleGutter)
139
+ };
140
+ });
141
+ const methods = {
142
+ tabChange: (item, index2) => {
143
+ emit("click", item);
144
+ if (item.disabled) {
145
+ return;
146
+ }
147
+ currentIndex.value = index2;
148
+ emit("update:modelValue", item.paneKey);
149
+ emit("change", item);
150
+ }
151
+ };
152
+ return {
153
+ titles,
154
+ contentStyle,
155
+ tabsNavStyle,
156
+ titleStyle,
157
+ tabsActiveStyle,
158
+ ...methods
159
+ };
160
+ }
161
+ };
162
+ const _hoisted_1 = ["onClick"];
163
+ function render(_ctx, _cache, $props, $setup, $data, $options) {
164
+ const _component_nut_icon = resolveComponent("nut-icon");
165
+ return openBlock(), createElementBlock("view", {
166
+ class: normalizeClass(["nut-tabs", [_ctx.direction]])
167
+ }, [
168
+ createElementVNode("view", {
169
+ class: normalizeClass(["nut-tabs__titles", { [_ctx.type]: _ctx.type, scrollable: _ctx.titleScroll, [_ctx.size]: _ctx.size }]),
170
+ style: normalizeStyle(_ctx.tabsNavStyle)
171
+ }, [
172
+ _ctx.$slots.titles ? renderSlot(_ctx.$slots, "titles", { key: 0 }) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.titles, (item, index2) => {
173
+ return openBlock(), createElementBlock("view", {
174
+ class: normalizeClass(["nut-tabs__titles-item", { active: item.paneKey == _ctx.modelValue, disabled: item.disabled }]),
175
+ style: normalizeStyle(_ctx.titleStyle),
176
+ onClick: ($event) => _ctx.tabChange(item, index2),
177
+ key: item.paneKey
178
+ }, [
179
+ _ctx.type == "line" ? (openBlock(), createElementBlock("view", {
180
+ key: 0,
181
+ class: "nut-tabs__titles-item__line",
182
+ style: normalizeStyle(_ctx.tabsActiveStyle)
183
+ }, null, 4)) : createCommentVNode("", true),
184
+ _ctx.type == "smile" ? (openBlock(), createElementBlock("view", {
185
+ key: 1,
186
+ class: "nut-tabs__titles-item__smile",
187
+ style: normalizeStyle(_ctx.tabsActiveStyle)
188
+ }, [
189
+ createVNode(_component_nut_icon, {
190
+ color: _ctx.color,
191
+ name: "joy-smile"
192
+ }, null, 8, ["color"])
193
+ ], 4)) : createCommentVNode("", true),
194
+ createElementVNode("view", {
195
+ class: normalizeClass(["nut-tabs__titles-item__text", { ellipsis: _ctx.ellipsis }])
196
+ }, toDisplayString(item.title), 3)
197
+ ], 14, _hoisted_1);
198
+ }), 128))
199
+ ], 6),
200
+ createElementVNode("view", {
201
+ class: "nut-tabs__content",
202
+ style: normalizeStyle(_ctx.contentStyle)
203
+ }, [
204
+ renderSlot(_ctx.$slots, "default")
205
+ ], 4)
206
+ ], 2);
207
+ }
208
+ const { create } = createComponent("tabs");
209
+ const _sfc_main = create(component);
210
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", render]]);
211
+ export { index as default };
@@ -1,25 +1,102 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.5 Fri Jun 24 2022 15:10:09 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { toRefs as e, computed as o, resolveComponent as l, openBlock as t, createElementBlock as a, normalizeClass as n, normalizeStyle as r, renderSlot as c, createBlock as s, createCommentVNode as u } from "vue";
7
- import { c as p } from "./component.js";
8
- import { _ as i } from "./plugin-vue_export-helper.js";
6
+ import { toRefs, computed, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, renderSlot, createBlock, createCommentVNode } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
9
  import "../locale/lang";
10
- const { componentName: d, create: f } = p("tag");
11
- var m = i(f({ props: { color: { type: String, default: "" }, textColor: { type: String, default: "" }, type: { type: String, default: "default" }, plain: { type: Boolean, default: false }, round: { type: Boolean, default: false }, mark: { type: Boolean, default: false }, closeable: { type: Boolean, default: false } }, emits: ["close", "click"], setup(l2, { emit: t2 }) {
12
- const { type: a2, color: n2, plain: r2, round: c2, mark: s2, textColor: u2 } = e(l2);
13
- return { classes: o(() => {
14
- const e2 = d;
15
- return { [e2]: true, [`${e2}--${a2.value}`]: a2.value, [`${e2}--plain`]: r2.value, [`${e2}--round`]: c2.value, [`${e2}--mark`]: s2.value };
16
- }), getStyle: () => (n2 == null ? void 0 : n2.value) ? { background: n2.value, color: u2.value } : r2.value ? { color: "#FA2400", background: "#fff", border: "1px solid rgba(250,36,0,1)" } : { color: "", background: "" }, onClose: (e2) => {
17
- e2.stopPropagation(), t2("close", e2);
18
- }, onClick: (e2) => {
19
- e2.stopPropagation(), t2("click", e2);
20
- } };
21
- } }), [["render", function(e2, o2, p2, i2, d2, f2) {
22
- const m2 = l("nut-icon");
23
- return t(), a("view", { class: n(e2.classes), style: r(e2.getStyle()), onClick: o2[0] || (o2[0] = (...o3) => e2.onClick && e2.onClick(...o3)) }, [c(e2.$slots, "default"), e2.closeable ? (t(), s(m2, { key: 0, class: "nut-tag--close", name: "close", size: "12", onClick: e2.onClose }, null, 8, ["onClick"])) : u("", true)], 6);
24
- }]]);
25
- export { m as default };
10
+ const { componentName, create } = createComponent("tag");
11
+ const _sfc_main = create({
12
+ props: {
13
+ color: { type: String, default: "" },
14
+ textColor: { type: String, default: "" },
15
+ type: {
16
+ type: String,
17
+ default: "default"
18
+ },
19
+ plain: {
20
+ type: Boolean,
21
+ default: false
22
+ },
23
+ round: {
24
+ type: Boolean,
25
+ default: false
26
+ },
27
+ mark: {
28
+ type: Boolean,
29
+ default: false
30
+ },
31
+ closeable: {
32
+ type: Boolean,
33
+ default: false
34
+ }
35
+ },
36
+ emits: ["close", "click"],
37
+ setup(props, { emit }) {
38
+ const { type, color, plain, round, mark, textColor } = toRefs(props);
39
+ const classes = computed(() => {
40
+ const prefixCls = componentName;
41
+ return {
42
+ [prefixCls]: true,
43
+ [`${prefixCls}--${type.value}`]: type.value,
44
+ [`${prefixCls}--plain`]: plain.value,
45
+ [`${prefixCls}--round`]: round.value,
46
+ [`${prefixCls}--mark`]: mark.value
47
+ };
48
+ });
49
+ const getStyle = () => {
50
+ if (color == null ? void 0 : color.value) {
51
+ return {
52
+ background: color.value,
53
+ color: textColor.value
54
+ };
55
+ }
56
+ if (plain.value) {
57
+ return {
58
+ color: "#FA2400",
59
+ background: "#fff",
60
+ border: "1px solid rgba(250,36,0,1)"
61
+ };
62
+ }
63
+ return {
64
+ color: "",
65
+ background: ""
66
+ };
67
+ };
68
+ const onClose = (event) => {
69
+ event.stopPropagation();
70
+ emit("close", event);
71
+ };
72
+ const onClick = (event) => {
73
+ event.stopPropagation();
74
+ emit("click", event);
75
+ };
76
+ return {
77
+ classes,
78
+ getStyle,
79
+ onClose,
80
+ onClick
81
+ };
82
+ }
83
+ });
84
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
85
+ const _component_nut_icon = resolveComponent("nut-icon");
86
+ return openBlock(), createElementBlock("view", {
87
+ class: normalizeClass(_ctx.classes),
88
+ style: normalizeStyle(_ctx.getStyle()),
89
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
90
+ }, [
91
+ renderSlot(_ctx.$slots, "default"),
92
+ _ctx.closeable ? (openBlock(), createBlock(_component_nut_icon, {
93
+ key: 0,
94
+ class: "nut-tag--close",
95
+ name: "close",
96
+ size: "12",
97
+ onClick: _ctx.onClose
98
+ }, null, 8, ["onClick"])) : createCommentVNode("", true)
99
+ ], 6);
100
+ }
101
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
102
+ export { index as default };