@nutui/nutui 3.1.22 → 3.1.23-beta.0
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.
- package/dist/nutui.es.js +20418 -4214
- package/dist/nutui.umd.js +20524 -4216
- package/dist/packages/_es/ActionSheet.js +149 -17
- package/dist/packages/_es/Address.js +535 -110
- package/dist/packages/_es/AddressList.js +615 -113
- package/dist/packages/_es/Animate.js +59 -17
- package/dist/packages/_es/Audio.js +257 -53
- package/dist/packages/_es/AudioOperate.js +100 -13
- package/dist/packages/_es/Avatar.js +162 -38
- package/dist/packages/_es/AvatarGroup.js +73 -14
- package/dist/packages/_es/BackTop.js +156 -43
- package/dist/packages/_es/Badge.js +86 -14
- package/dist/packages/_es/Barrage.js +120 -41
- package/dist/packages/_es/Button.js +128 -23
- package/dist/packages/_es/Calendar.js +246 -30
- package/dist/packages/_es/CalendarItem.js +1 -1
- package/dist/packages/_es/Card.js +107 -10
- package/dist/packages/_es/Cascader.js +496 -147
- package/dist/packages/_es/Category.js +58 -15
- package/dist/packages/_es/CategoryPane.js +111 -11
- package/dist/packages/_es/Cell.js +108 -21
- package/dist/packages/_es/CellGroup.js +44 -9
- package/dist/packages/_es/Checkbox.js +134 -29
- package/dist/packages/_es/CheckboxGroup.js +79 -29
- package/dist/packages/_es/CircleProgress.js +150 -28
- package/dist/packages/_es/Col.js +56 -14
- package/dist/packages/_es/Collapse.js +109 -32
- package/dist/packages/_es/CollapseItem.js +253 -59
- package/dist/packages/_es/Comment.js +434 -64
- package/dist/packages/_es/ConfigProvider.js +20 -8
- package/dist/packages/_es/CountDown.js +238 -56
- package/dist/packages/_es/CountUp.js +539 -140
- package/dist/packages/_es/DatePicker.js +315 -98
- package/dist/packages/_es/Dialog.js +289 -60
- package/dist/packages/_es/Divider.js +65 -13
- package/dist/packages/_es/Drag.js +197 -56
- package/dist/packages/_es/Ecard.js +159 -24
- package/dist/packages/_es/Elevator.js +255 -58
- package/dist/packages/_es/Ellipsis.js +200 -58
- package/dist/packages/_es/Empty.js +71 -12
- package/dist/packages/_es/FixedNav.js +122 -15
- package/dist/packages/_es/Form.js +151 -64
- package/dist/packages/_es/FormItem.js +114 -15
- package/dist/packages/_es/Grid.js +6 -5
- package/dist/packages/_es/GridItem.js +144 -33
- package/dist/packages/_es/Icon.js +40 -15
- package/dist/packages/_es/Image.js +137 -26
- package/dist/packages/_es/ImagePreview.js +547 -76
- package/dist/packages/_es/Indicator.js +62 -15
- package/dist/packages/_es/InfiniteLoading.js +249 -57
- package/dist/packages/_es/Input.js +433 -51
- package/dist/packages/_es/InputNumber.js +160 -41
- package/dist/packages/_es/Layout.js +5 -4
- package/dist/packages/_es/List.js +106 -18
- package/dist/packages/_es/Menu.js +168 -44
- package/dist/packages/_es/MenuItem.js +173 -37
- package/dist/packages/_es/Navbar.js +192 -30
- package/dist/packages/_es/NoticeBar.js +380 -74
- package/dist/packages/_es/Notify.js +227 -72
- package/dist/packages/_es/NumberKeyboard.js +272 -41
- package/dist/packages/_es/OldPicker.js +457 -130
- package/dist/packages/_es/OverLay.js +98 -24
- package/dist/packages/_es/Pagination.js +157 -39
- package/dist/packages/_es/Picker.js +460 -129
- package/dist/packages/_es/Popover.js +957 -318
- package/dist/packages/_es/Popup.js +299 -55
- package/dist/packages/_es/Price.js +118 -16
- package/dist/packages/_es/Progress.js +146 -14
- package/dist/packages/_es/PullRefresh.js +339 -84
- package/dist/packages/_es/Radio.js +90 -22
- package/dist/packages/_es/RadioGroup.js +37 -8
- package/dist/packages/_es/Range.js +408 -83
- package/dist/packages/_es/Rate.js +192 -36
- package/dist/packages/_es/Row.js +64 -22
- package/dist/packages/_es/SearchBar.js +238 -37
- package/dist/packages/_es/ShortPassword.js +225 -35
- package/dist/packages/_es/SideNavBar.js +81 -24
- package/dist/packages/_es/SideNavBarItem.js +46 -11
- package/dist/packages/_es/Signature.js +160 -41
- package/dist/packages/_es/Skeleton.js +136 -20
- package/dist/packages/_es/Sku.js +491 -84
- package/dist/packages/_es/Step.js +115 -20
- package/dist/packages/_es/Steps.js +53 -18
- package/dist/packages/_es/Sticky.js +138 -53
- package/dist/packages/_es/SubSideNavBar.js +82 -17
- package/dist/packages/_es/Swipe.js +178 -41
- package/dist/packages/_es/Swiper.js +433 -121
- package/dist/packages/_es/SwiperItem.js +53 -22
- package/dist/packages/_es/Switch.js +116 -21
- package/dist/packages/_es/TabPane.js +39 -12
- package/dist/packages/_es/Tabbar.js +72 -17
- package/dist/packages/_es/TabbarItem.js +151 -29
- package/dist/packages/_es/Table.js +178 -18
- package/dist/packages/_es/Tabs.js +202 -43
- package/dist/packages/_es/Tag.js +97 -20
- package/dist/packages/_es/TextArea.js +160 -42
- package/dist/packages/_es/TimeDetail.js +79 -18
- package/dist/packages/_es/TimePannel.js +48 -14
- package/dist/packages/_es/TimeSelect.js +112 -15
- package/dist/packages/_es/Toast.js +310 -71
- package/dist/packages/_es/Uploader.js +455 -104
- package/dist/packages/_es/Video.js +332 -74
- package/dist/packages/_es/common.js +128 -38
- package/dist/packages/_es/component.js +76 -35
- package/dist/packages/_es/index.js +6 -5
- package/dist/packages/_es/index2.js +30 -9
- package/dist/packages/_es/index3.js +8 -6
- package/dist/packages/_es/index4.js +64 -13
- package/dist/packages/_es/index5.js +780 -164
- package/dist/packages/_es/plugin-vue_export-helper.js +8 -7
- package/dist/packages/_es/pxCheck.js +5 -3
- package/dist/packages/_es/raf.js +15 -8
- package/dist/packages/imagepreview/index.scss +6 -1
- package/dist/packages/locale/lang/baseLang.js +3 -3
- package/dist/packages/locale/lang/en-US.js +105 -5
- package/dist/packages/locale/lang/id-ID.js +105 -5
- package/dist/packages/locale/lang/index.js +38 -16
- package/dist/packages/locale/lang/zh-CN.js +105 -5
- package/dist/packages/locale/lang/zh-TW.js +105 -5
- package/dist/smartips/attributes.json +8 -0
- package/dist/smartips/tags.json +3 -1
- package/dist/smartips/web-types.json +19 -1
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/themes/default.scss +41 -41
- package/dist/styles/themes/jdb.scss +41 -41
- package/dist/styles/themes/jdt.scss +41 -41
- package/dist/types/__VUE/actionsheet/index.vue.d.ts +5 -5
- package/dist/types/__VUE/address/index.vue.d.ts +7 -7
- package/dist/types/__VUE/avatar/index.vue.d.ts +4 -4
- package/dist/types/__VUE/avatargroup/index.vue.d.ts +2 -2
- package/dist/types/__VUE/backtop/index.vue.d.ts +2 -2
- package/dist/types/__VUE/badge/index.vue.d.ts +2 -2
- package/dist/types/__VUE/button/index.vue.d.ts +8 -8
- package/dist/types/__VUE/calendar/index.vue.d.ts +1 -1
- package/dist/types/__VUE/cascader/index.vue.d.ts +4 -4
- package/dist/types/__VUE/cell/index.vue.d.ts +6 -6
- package/dist/types/__VUE/checkbox/index.vue.d.ts +2 -2
- package/dist/types/__VUE/collapseitem/index.vue.d.ts +2 -2
- package/dist/types/__VUE/comment/index.vue.d.ts +2 -2
- package/dist/types/__VUE/datepicker/index.vue.d.ts +4 -4
- package/dist/types/__VUE/dialog/index.vue.d.ts +4 -4
- package/dist/types/__VUE/fixednav/index.vue.d.ts +4 -4
- package/dist/types/__VUE/grid/index.vue.d.ts +4 -4
- package/dist/types/__VUE/image/index.vue.d.ts +4 -4
- package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +95 -0
- package/dist/types/__VUE/imagepreview/index.vue.d.ts +23 -25
- package/dist/types/__VUE/input/index.vue.d.ts +4 -4
- package/dist/types/__VUE/inputnumber/index.vue.d.ts +2 -2
- package/dist/types/__VUE/menu/index.vue.d.ts +2 -2
- package/dist/types/__VUE/menuitem/index.vue.d.ts +1 -1
- package/dist/types/__VUE/noticebar/index.vue.d.ts +3 -3
- package/dist/types/__VUE/notify/index.vue.d.ts +2 -2
- package/dist/types/__VUE/numberkeyboard/index.vue.d.ts +2 -2
- package/dist/types/__VUE/oldpicker/index.vue.d.ts +5 -5
- package/dist/types/__VUE/picker/Column.vue.d.ts +1 -1
- package/dist/types/__VUE/picker/index.vue.d.ts +6 -6
- package/dist/types/__VUE/popover/index.vue.d.ts +8 -8
- package/dist/types/__VUE/popup/index.vue.d.ts +6 -6
- package/dist/types/__VUE/radio/index.vue.d.ts +4 -4
- package/dist/types/__VUE/range/index.vue.d.ts +4 -4
- package/dist/types/__VUE/shortpassword/index.vue.d.ts +1 -1
- package/dist/types/__VUE/skeleton/index.vue.d.ts +4 -4
- package/dist/types/__VUE/sku/index.vue.d.ts +5 -5
- package/dist/types/__VUE/step/index.vue.d.ts +2 -2
- package/dist/types/__VUE/sticky/index.vue.d.ts +4 -4
- package/dist/types/__VUE/swipe/index.vue.d.ts +2 -2
- package/dist/types/__VUE/swiper/index.vue.d.ts +2 -2
- package/dist/types/__VUE/tabbar/index.vue.d.ts +2 -2
- package/dist/types/__VUE/tabbaritem/index.vue.d.ts +2 -2
- package/dist/types/__VUE/tag/index.vue.d.ts +2 -2
- package/dist/types/__VUE/timeselect/index.vue.d.ts +2 -2
- package/dist/types/__VUE/toast/index.vue.d.ts +4 -4
- package/dist/types/__VUE/uploader/index.vue.d.ts +4 -4
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -2
|
@@ -1,23 +1,183 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.0 Mon Jun 27 2022 17:55:50 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { c as
|
|
7
|
-
import { h
|
|
8
|
-
import { _ as
|
|
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
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.0 Mon Jun 27 2022 17:55:50 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { c as
|
|
7
|
-
import { p as
|
|
8
|
-
import { provide
|
|
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
|
|
11
|
+
class Title {
|
|
12
12
|
constructor() {
|
|
13
|
-
this.title = ""
|
|
13
|
+
this.title = "";
|
|
14
|
+
this.paneKey = "";
|
|
15
|
+
this.disabled = false;
|
|
14
16
|
}
|
|
15
17
|
}
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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 };
|
package/dist/packages/_es/Tag.js
CHANGED
|
@@ -1,25 +1,102 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.0 Mon Jun 27 2022 17:55:50 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import { toRefs
|
|
7
|
-
import { c as
|
|
8
|
-
import { _ as
|
|
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
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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 };
|