@nutui/nutui 3.1.6 → 3.1.7
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/CHANGELOG.md +40 -0
- package/dist/nutui.d.ts +7 -1
- package/dist/nutui.es.js +1097 -517
- package/dist/nutui.umd.js +1158 -571
- package/dist/packages/_es/ActionSheet.js +158 -0
- package/dist/packages/_es/Address.js +525 -0
- package/dist/packages/_es/Avatar.js +87 -0
- package/dist/packages/_es/BackTop.js +159 -0
- package/dist/packages/_es/Badge.js +90 -0
- package/dist/packages/_es/Barrage.js +118 -0
- package/dist/packages/_es/Button.js +124 -0
- package/dist/packages/_es/Calendar.js +700 -0
- package/dist/packages/_es/Cell.js +95 -0
- package/dist/packages/_es/CellGroup.js +42 -0
- package/dist/packages/_es/Checkbox.js +109 -0
- package/dist/packages/_es/CheckboxGroup.js +62 -0
- package/dist/packages/_es/CircleProgress.js +109 -0
- package/dist/packages/_es/Col.js +53 -0
- package/dist/packages/_es/Collapse.js +89 -0
- package/dist/packages/_es/CollapseItem.js +257 -0
- package/dist/packages/_es/CountDown.js +224 -0
- package/dist/packages/_es/CountUp.js +547 -0
- package/dist/packages/_es/DatePicker.js +282 -0
- package/dist/packages/_es/Dialog.js +313 -0
- package/dist/packages/_es/Divider.js +49 -0
- package/dist/packages/_es/Drag.js +198 -0
- package/dist/packages/_es/Elevator.js +207 -0
- package/dist/packages/_es/FixedNav.js +127 -0
- package/dist/packages/_es/Icon.js +44 -0
- package/dist/packages/_es/ImagePreview.js +109 -0
- package/dist/packages/_es/InfiniteLoading.js +265 -0
- package/dist/packages/_es/Input.js +183 -0
- package/dist/packages/_es/InputNumber.js +172 -0
- package/dist/packages/_es/Layout.js +10 -0
- package/dist/packages/_es/MenuItem.js +180 -0
- package/dist/packages/_es/Navbar.js +160 -0
- package/dist/packages/_es/NoticeBar.js +389 -0
- package/dist/packages/_es/Notify.js +233 -0
- package/dist/packages/_es/NumberKeyboard.js +248 -0
- package/dist/packages/_es/OverLay.js +118 -0
- package/dist/packages/_es/Pagination.js +163 -0
- package/dist/packages/_es/Picker.js +485 -0
- package/dist/packages/_es/Popover.js +157 -0
- package/dist/packages/_es/Popup.js +268 -0
- package/dist/packages/_es/Price.js +104 -0
- package/dist/packages/_es/Progress.js +131 -0
- package/dist/packages/_es/Radio.js +72 -0
- package/dist/packages/_es/RadioGroup.js +37 -0
- package/dist/packages/_es/Range.js +350 -0
- package/dist/packages/_es/Rate.js +129 -0
- package/dist/packages/_es/Row.js +61 -0
- package/dist/packages/_es/ShortPassword.js +221 -0
- package/dist/packages/_es/Signature.js +167 -0
- package/dist/packages/_es/Step.js +116 -0
- package/dist/packages/_es/Steps.js +52 -0
- package/dist/packages/_es/Swipe.js +193 -0
- package/dist/packages/_es/Swiper.js +429 -0
- package/dist/packages/_es/SwiperItem.js +60 -0
- package/dist/packages/_es/Switch.js +90 -0
- package/dist/packages/_es/Tab.js +179 -0
- package/dist/packages/_es/TabPane.js +42 -0
- package/dist/packages/_es/TabPanel.js +30 -0
- package/dist/packages/_es/Tabbar.js +73 -0
- package/dist/packages/_es/TabbarItem.js +142 -0
- package/dist/packages/_es/Tag.js +98 -0
- package/dist/packages/_es/TextArea.js +127 -0
- package/dist/packages/_es/Toast.js +317 -0
- package/dist/packages/_es/Uploader.js +400 -0
- package/dist/packages/_es/Video.js +405 -0
- package/dist/packages/_es/component.js +26 -0
- package/dist/packages/_es/index.js +64 -0
- package/dist/packages/_es/index2.js +13 -0
- package/dist/packages/_es/plugin-vue_export-helper.js +12 -0
- package/dist/packages/_es/pxCheck.js +9 -0
- package/dist/packages/_es/raf.js +19 -0
- package/dist/packages/avatar/index.scss +0 -1
- package/dist/packages/badge/index.scss +35 -0
- package/dist/packages/calendar/index.scss +13 -0
- package/dist/packages/imagepreview/index.scss +48 -0
- package/dist/packages/input/index.scss +14 -7
- package/dist/packages/pagination/index.scss +51 -0
- package/dist/packages/popover/index.scss +159 -0
- package/dist/packages/shortpassword/index.scss +19 -7
- package/dist/packages/tabpane/index.scss +1 -0
- package/dist/packages/tabs/index.scss +1 -0
- package/dist/packages/tag/index.scss +47 -0
- package/dist/packages/uploader/index.scss +0 -1
- package/dist/style.css +1 -1
- package/dist/style.es.js +2 -1
- package/dist/styles/themes/default.scss +35 -28
- package/dist/styles/variables.scss +55 -32
- package/package.json +7 -7
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @nutui/nutui v3.1.7 Thu Sep 30 2021 20:17:02 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2021 @jdf2e.
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import { ref, computed, watch, onMounted, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, createElementBlock, toDisplayString, createCommentVNode, Fragment, renderList, normalizeClass, createTextVNode } from "vue";
|
|
7
|
+
import { c as createComponent } from "./component.js";
|
|
8
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
9
|
+
const { create } = createComponent("numberkeyboard");
|
|
10
|
+
const _sfc_main = create({
|
|
11
|
+
props: {
|
|
12
|
+
title: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: ""
|
|
15
|
+
},
|
|
16
|
+
visible: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: false
|
|
19
|
+
},
|
|
20
|
+
type: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: "default"
|
|
23
|
+
},
|
|
24
|
+
customKey: {
|
|
25
|
+
type: Array,
|
|
26
|
+
default: () => []
|
|
27
|
+
},
|
|
28
|
+
value: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: ""
|
|
31
|
+
},
|
|
32
|
+
maxlength: {
|
|
33
|
+
type: [Number, String],
|
|
34
|
+
default: 6
|
|
35
|
+
},
|
|
36
|
+
randomKeys: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: false
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
emits: ["input", "delete", "close", "update:value"],
|
|
42
|
+
setup(props, { emit }) {
|
|
43
|
+
const clickKeyIndex = ref(void 0);
|
|
44
|
+
const show = ref(props.visible);
|
|
45
|
+
const root = ref();
|
|
46
|
+
function defaultKey() {
|
|
47
|
+
return [
|
|
48
|
+
...getBasicKeys(),
|
|
49
|
+
{ id: "lock", type: "lock" },
|
|
50
|
+
{ id: 0, type: "number" },
|
|
51
|
+
{ id: "delete", type: "delete" }
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
function getBasicKeys() {
|
|
55
|
+
const keys = [];
|
|
56
|
+
for (let i = 1; i <= 9; i++) {
|
|
57
|
+
keys.push({ id: i, type: "number" });
|
|
58
|
+
}
|
|
59
|
+
if (props.randomKeys) {
|
|
60
|
+
return keys.sort(() => Math.random() > 0.5 ? 1 : -1);
|
|
61
|
+
}
|
|
62
|
+
return keys;
|
|
63
|
+
}
|
|
64
|
+
function genCustomKeys() {
|
|
65
|
+
const keys = getBasicKeys();
|
|
66
|
+
const { customKey } = props;
|
|
67
|
+
let customKeys = Array.isArray(customKey) ? customKey : [customKey];
|
|
68
|
+
if (customKeys.length > 2) {
|
|
69
|
+
customKeys = [customKeys[0], customKeys[1]];
|
|
70
|
+
}
|
|
71
|
+
if (customKeys.length === 1) {
|
|
72
|
+
if (props.title) {
|
|
73
|
+
keys.push({ id: customKeys[0], type: "custom" }, { id: 0, type: "number" }, { id: "delete", type: "delete" });
|
|
74
|
+
} else {
|
|
75
|
+
keys.push({ id: 0, type: "number" }, { id: customKeys[0], type: "custom" });
|
|
76
|
+
}
|
|
77
|
+
} else if (customKeys.length === 2) {
|
|
78
|
+
keys.push({ id: customKeys[0], type: "custom" }, { id: 0, type: "number" }, { id: customKeys[1], type: "custom" });
|
|
79
|
+
if (props.title) {
|
|
80
|
+
keys.push({ id: "delete", type: "delete" });
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
keys.push({ id: 0, type: "number" });
|
|
84
|
+
}
|
|
85
|
+
return keys;
|
|
86
|
+
}
|
|
87
|
+
const keysList = computed(() => {
|
|
88
|
+
if (props.type == "rightColumn" || props.title != "") {
|
|
89
|
+
return genCustomKeys();
|
|
90
|
+
}
|
|
91
|
+
return defaultKey();
|
|
92
|
+
});
|
|
93
|
+
watch(() => props.visible, (value) => {
|
|
94
|
+
show.value = value;
|
|
95
|
+
});
|
|
96
|
+
function onTouchstart(item, event) {
|
|
97
|
+
event.stopPropagation();
|
|
98
|
+
clickKeyIndex.value = item.id;
|
|
99
|
+
if (item.type == "number" || item.type == "custom") {
|
|
100
|
+
emit("input", item.id);
|
|
101
|
+
if (props.value.length < props.maxlength) {
|
|
102
|
+
emit("update:value", props.value + item.id);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (item.type == "lock") {
|
|
106
|
+
closeBoard();
|
|
107
|
+
}
|
|
108
|
+
if (item.type == "delete") {
|
|
109
|
+
emit("delete");
|
|
110
|
+
emit("update:value", props.value.slice(0, props.value.length - 1));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function onTouchMove(id, event) {
|
|
114
|
+
event.stopPropagation();
|
|
115
|
+
}
|
|
116
|
+
function onTouchEnd() {
|
|
117
|
+
clickKeyIndex.value = void 0;
|
|
118
|
+
}
|
|
119
|
+
function closeBoard() {
|
|
120
|
+
emit("close");
|
|
121
|
+
}
|
|
122
|
+
onMounted(() => {
|
|
123
|
+
});
|
|
124
|
+
return {
|
|
125
|
+
clickKeyIndex,
|
|
126
|
+
defaultKey,
|
|
127
|
+
closeBoard,
|
|
128
|
+
onTouchEnd,
|
|
129
|
+
onTouchMove,
|
|
130
|
+
onTouchstart,
|
|
131
|
+
keysList,
|
|
132
|
+
genCustomKeys,
|
|
133
|
+
getBasicKeys,
|
|
134
|
+
root,
|
|
135
|
+
show
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
const _hoisted_1 = {
|
|
140
|
+
class: "nut-numberkeyboard",
|
|
141
|
+
ref: "root"
|
|
142
|
+
};
|
|
143
|
+
const _hoisted_2 = {
|
|
144
|
+
key: 0,
|
|
145
|
+
class: "number-board-header"
|
|
146
|
+
};
|
|
147
|
+
const _hoisted_3 = { class: "tit" };
|
|
148
|
+
const _hoisted_4 = { class: "number-board-body" };
|
|
149
|
+
const _hoisted_5 = { class: "number-board" };
|
|
150
|
+
const _hoisted_6 = ["onTouchstart", "onTouchmove"];
|
|
151
|
+
const _hoisted_7 = {
|
|
152
|
+
key: 1,
|
|
153
|
+
src: "https://img11.360buyimg.com/imagetools/jfs/t1/146371/38/8485/738/5f606425Eca239740/14f4b4f5f20d8a68.png"
|
|
154
|
+
};
|
|
155
|
+
const _hoisted_8 = {
|
|
156
|
+
key: 2,
|
|
157
|
+
src: "https://img11.360buyimg.com/imagetools/jfs/t1/129395/8/12735/2030/5f61ac37E70cab338/fb477dc11f46056c.png"
|
|
158
|
+
};
|
|
159
|
+
const _hoisted_9 = {
|
|
160
|
+
key: 0,
|
|
161
|
+
class: "number-board-sidebar"
|
|
162
|
+
};
|
|
163
|
+
const _hoisted_10 = { class: "key-board-wrapper" };
|
|
164
|
+
const _hoisted_11 = /* @__PURE__ */ createElementVNode("img", { src: "https://img11.360buyimg.com/imagetools/jfs/t1/129395/8/12735/2030/5f61ac37E70cab338/fb477dc11f46056c.png" }, null, -1);
|
|
165
|
+
const _hoisted_12 = [
|
|
166
|
+
_hoisted_11
|
|
167
|
+
];
|
|
168
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
169
|
+
const _component_nut_popup = resolveComponent("nut-popup");
|
|
170
|
+
return openBlock(), createBlock(_component_nut_popup, {
|
|
171
|
+
visible: _ctx.show,
|
|
172
|
+
"onUpdate:visible": _cache[6] || (_cache[6] = ($event) => _ctx.show = $event),
|
|
173
|
+
position: "bottom",
|
|
174
|
+
onClickOverlay: _cache[7] || (_cache[7] = ($event) => _ctx.closeBoard()),
|
|
175
|
+
"overlay-class": "nut-numberkeyboard-overlay"
|
|
176
|
+
}, {
|
|
177
|
+
default: withCtx(() => [
|
|
178
|
+
createElementVNode("div", _hoisted_1, [
|
|
179
|
+
_ctx.title ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
180
|
+
createElementVNode("h3", _hoisted_3, toDisplayString(_ctx.title), 1),
|
|
181
|
+
createElementVNode("span", {
|
|
182
|
+
class: "keyboard-close",
|
|
183
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.closeBoard())
|
|
184
|
+
}, "\u5B8C\u6210")
|
|
185
|
+
])) : createCommentVNode("", true),
|
|
186
|
+
createElementVNode("div", _hoisted_4, [
|
|
187
|
+
createElementVNode("div", _hoisted_5, [
|
|
188
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.keysList, (item) => {
|
|
189
|
+
return openBlock(), createElementBlock("div", {
|
|
190
|
+
class: normalizeClass([
|
|
191
|
+
"key-board-wrapper",
|
|
192
|
+
{
|
|
193
|
+
"key-board-wrapper-large": item.id == 0 && _ctx.type == "rightColumn" && Array.isArray(_ctx.customKey) && _ctx.customKey.length == 1
|
|
194
|
+
}
|
|
195
|
+
]),
|
|
196
|
+
key: "key" + item.id
|
|
197
|
+
}, [
|
|
198
|
+
createElementVNode("div", {
|
|
199
|
+
class: normalizeClass([
|
|
200
|
+
"key",
|
|
201
|
+
{ active: item.id == _ctx.clickKeyIndex },
|
|
202
|
+
{ lock: item.type == "lock" },
|
|
203
|
+
{ delete: item.type == "delete" }
|
|
204
|
+
]),
|
|
205
|
+
onTouchstart: (event) => _ctx.onTouchstart(item, event),
|
|
206
|
+
onTouchmove: (event) => _ctx.onTouchMove(item, event),
|
|
207
|
+
onTouchend: _cache[1] || (_cache[1] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args))
|
|
208
|
+
}, [
|
|
209
|
+
item.type == "number" || item.type == "custom" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
210
|
+
createTextVNode(toDisplayString(item.id), 1)
|
|
211
|
+
], 64)) : createCommentVNode("", true),
|
|
212
|
+
item.type == "lock" ? (openBlock(), createElementBlock("img", _hoisted_7)) : createCommentVNode("", true),
|
|
213
|
+
item.type == "delete" ? (openBlock(), createElementBlock("img", _hoisted_8)) : createCommentVNode("", true)
|
|
214
|
+
], 42, _hoisted_6)
|
|
215
|
+
], 2);
|
|
216
|
+
}), 128))
|
|
217
|
+
]),
|
|
218
|
+
_ctx.type == "rightColumn" ? (openBlock(), createElementBlock("div", _hoisted_9, [
|
|
219
|
+
createElementVNode("div", _hoisted_10, [
|
|
220
|
+
createElementVNode("div", {
|
|
221
|
+
class: normalizeClass(["key", { active: _ctx.clickKeyIndex == "delete" }]),
|
|
222
|
+
onTouchstart: _cache[2] || (_cache[2] = (event) => _ctx.onTouchstart({ id: "delete", type: "delete" }, event)),
|
|
223
|
+
onTouchmove: _cache[3] || (_cache[3] = (event) => _ctx.onTouchMove({ id: "delete", type: "delete" }, event)),
|
|
224
|
+
onTouchend: _cache[4] || (_cache[4] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args))
|
|
225
|
+
}, _hoisted_12, 34)
|
|
226
|
+
]),
|
|
227
|
+
_ctx.title == "" ? (openBlock(), createElementBlock("div", {
|
|
228
|
+
key: 0,
|
|
229
|
+
class: "key-board-wrapper",
|
|
230
|
+
onClick: _cache[5] || (_cache[5] = ($event) => _ctx.closeBoard())
|
|
231
|
+
}, [
|
|
232
|
+
createElementVNode("div", {
|
|
233
|
+
class: normalizeClass([
|
|
234
|
+
"key",
|
|
235
|
+
"finish",
|
|
236
|
+
{ activeFinsh: _ctx.clickKeyIndex == "finish" }
|
|
237
|
+
])
|
|
238
|
+
}, " \u5B8C\u6210 ", 2)
|
|
239
|
+
])) : createCommentVNode("", true)
|
|
240
|
+
])) : createCommentVNode("", true)
|
|
241
|
+
])
|
|
242
|
+
], 512)
|
|
243
|
+
]),
|
|
244
|
+
_: 1
|
|
245
|
+
}, 8, ["visible"]);
|
|
246
|
+
}
|
|
247
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
248
|
+
export { index as default };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
/*!
|
|
18
|
+
* @nutui/nutui v3.1.7 Thu Sep 30 2021 20:17:02 GMT+0800 (中国标准时间)
|
|
19
|
+
* (c) 2021 @jdf2e.
|
|
20
|
+
* Released under the MIT License.
|
|
21
|
+
*/
|
|
22
|
+
import { computed, watch, onDeactivated, onBeforeUnmount, onMounted, onActivated, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, withModifiers, normalizeStyle, renderSlot, vShow } from "vue";
|
|
23
|
+
import { c as createComponent } from "./component.js";
|
|
24
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
25
|
+
const { componentName, create } = createComponent("overlay");
|
|
26
|
+
const overlayProps = {
|
|
27
|
+
visible: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false
|
|
30
|
+
},
|
|
31
|
+
zIndex: {
|
|
32
|
+
type: [Number, String],
|
|
33
|
+
default: 2e3
|
|
34
|
+
},
|
|
35
|
+
duration: {
|
|
36
|
+
type: [Number, String],
|
|
37
|
+
default: 0.3
|
|
38
|
+
},
|
|
39
|
+
overlayClass: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: ""
|
|
42
|
+
},
|
|
43
|
+
lockScroll: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: true
|
|
46
|
+
},
|
|
47
|
+
overlayStyle: {
|
|
48
|
+
type: Object
|
|
49
|
+
},
|
|
50
|
+
closeOnClickOverlay: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: true
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const _sfc_main = create({
|
|
56
|
+
props: overlayProps,
|
|
57
|
+
emits: ["click", "update:visible"],
|
|
58
|
+
setup(props, { emit }) {
|
|
59
|
+
const classes = computed(() => {
|
|
60
|
+
const prefixCls = componentName;
|
|
61
|
+
return {
|
|
62
|
+
[prefixCls]: true,
|
|
63
|
+
[props.overlayClass]: true
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
watch(() => props.visible, (value) => {
|
|
67
|
+
value ? lock() : unlock();
|
|
68
|
+
});
|
|
69
|
+
const lock = () => {
|
|
70
|
+
if (props.lockScroll && props.visible) {
|
|
71
|
+
document.body.classList.add("nut-overflow-hidden");
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const unlock = () => {
|
|
75
|
+
document.body.classList.remove("nut-overflow-hidden");
|
|
76
|
+
};
|
|
77
|
+
onDeactivated(unlock);
|
|
78
|
+
onBeforeUnmount(unlock);
|
|
79
|
+
onMounted(lock);
|
|
80
|
+
onActivated(lock);
|
|
81
|
+
const style = computed(() => {
|
|
82
|
+
return __spreadValues({
|
|
83
|
+
animationDuration: `${props.duration}s`,
|
|
84
|
+
zIndex: props.zIndex
|
|
85
|
+
}, props.overlayStyle);
|
|
86
|
+
});
|
|
87
|
+
const touchmove = (e) => {
|
|
88
|
+
if (props.lockScroll)
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
};
|
|
91
|
+
const onClick = (e) => {
|
|
92
|
+
emit("click", e);
|
|
93
|
+
if (props.closeOnClickOverlay) {
|
|
94
|
+
emit("update:visible", false);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
return { classes, style, touchmove, onClick };
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
101
|
+
return openBlock(), createBlock(Transition, { name: "overlay-fade" }, {
|
|
102
|
+
default: withCtx(() => [
|
|
103
|
+
withDirectives(createElementVNode("view", {
|
|
104
|
+
class: normalizeClass(_ctx.classes),
|
|
105
|
+
onTouchmove: _cache[0] || (_cache[0] = withModifiers((...args) => _ctx.touchmove && _ctx.touchmove(...args), ["stop"])),
|
|
106
|
+
onClick: _cache[1] || (_cache[1] = (...args) => _ctx.onClick && _ctx.onClick(...args)),
|
|
107
|
+
style: normalizeStyle(_ctx.style)
|
|
108
|
+
}, [
|
|
109
|
+
renderSlot(_ctx.$slots, "default")
|
|
110
|
+
], 38), [
|
|
111
|
+
[vShow, _ctx.visible]
|
|
112
|
+
])
|
|
113
|
+
]),
|
|
114
|
+
_: 3
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
var overlay = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
118
|
+
export { overlay as default, overlayProps };
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @nutui/nutui v3.1.7 Thu Sep 30 2021 20:17:02 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2021 @jdf2e.
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import { toRefs, computed, watchEffect, openBlock, createElementBlock, createElementVNode, normalizeClass, renderSlot, createTextVNode, toDisplayString, Fragment, renderList, createCommentVNode } from "vue";
|
|
7
|
+
import { c as createComponent } from "./component.js";
|
|
8
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
9
|
+
const { componentName, create } = createComponent("pagination");
|
|
10
|
+
const _sfc_main = create({
|
|
11
|
+
props: {
|
|
12
|
+
modelValue: {
|
|
13
|
+
type: Number,
|
|
14
|
+
default: 1
|
|
15
|
+
},
|
|
16
|
+
mode: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: "multi"
|
|
19
|
+
},
|
|
20
|
+
prevText: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: "\u4E0A\u4E00\u9875"
|
|
23
|
+
},
|
|
24
|
+
nextText: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: "\u4E0B\u4E00\u9875"
|
|
27
|
+
},
|
|
28
|
+
pageCount: {
|
|
29
|
+
type: [String, Number],
|
|
30
|
+
default: ""
|
|
31
|
+
},
|
|
32
|
+
totalItems: {
|
|
33
|
+
type: [String, Number],
|
|
34
|
+
default: "0"
|
|
35
|
+
},
|
|
36
|
+
itemsPerPage: {
|
|
37
|
+
type: [String, Number],
|
|
38
|
+
default: "10"
|
|
39
|
+
},
|
|
40
|
+
showPageSize: {
|
|
41
|
+
type: [String, Number],
|
|
42
|
+
default: "5"
|
|
43
|
+
},
|
|
44
|
+
forceEllipses: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
components: {},
|
|
50
|
+
emits: ["change", "update:modelValue"],
|
|
51
|
+
setup(props, { emit }) {
|
|
52
|
+
const { modelValue, mode, showPageSize, forceEllipses } = toRefs(props);
|
|
53
|
+
const countRef = computed(() => {
|
|
54
|
+
const { pageCount, totalItems, itemsPerPage } = toRefs(props);
|
|
55
|
+
const num = +pageCount.value || Math.ceil(+totalItems.value / +itemsPerPage.value);
|
|
56
|
+
return Math.max(1, num);
|
|
57
|
+
});
|
|
58
|
+
const select = (curPage, isSelect) => {
|
|
59
|
+
if (curPage > countRef.value || curPage < 1)
|
|
60
|
+
return;
|
|
61
|
+
if (curPage != modelValue.value)
|
|
62
|
+
emit("update:modelValue", curPage);
|
|
63
|
+
if (isSelect)
|
|
64
|
+
emit("change", curPage);
|
|
65
|
+
};
|
|
66
|
+
const setPage = (number, text, active) => {
|
|
67
|
+
return { number, text, active };
|
|
68
|
+
};
|
|
69
|
+
const pages = computed(() => {
|
|
70
|
+
if (mode.value == "simple")
|
|
71
|
+
return;
|
|
72
|
+
let items = [];
|
|
73
|
+
const pageCount = countRef.value;
|
|
74
|
+
const pageSize = showPageSize.value;
|
|
75
|
+
let startPage = 1;
|
|
76
|
+
let endPage = pageCount;
|
|
77
|
+
const partialShow = pageCount > pageSize;
|
|
78
|
+
if (partialShow) {
|
|
79
|
+
startPage = Math.max(modelValue.value - Math.floor(pageSize / 2), 1);
|
|
80
|
+
endPage = startPage + pageSize - 1;
|
|
81
|
+
if (endPage > pageCount) {
|
|
82
|
+
endPage = pageCount;
|
|
83
|
+
startPage = endPage - pageSize + 1;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
for (var i = startPage; i <= endPage; i++) {
|
|
87
|
+
const page = setPage(i, i, modelValue.value == i);
|
|
88
|
+
items.push(page);
|
|
89
|
+
}
|
|
90
|
+
if (partialShow && pageSize > 0 && forceEllipses.value) {
|
|
91
|
+
if (startPage > 1) {
|
|
92
|
+
const prevPage = setPage(startPage - 1, "...");
|
|
93
|
+
items.unshift(prevPage);
|
|
94
|
+
}
|
|
95
|
+
if (endPage < pageCount) {
|
|
96
|
+
const nextPage = setPage(endPage + 1, "...");
|
|
97
|
+
items.push(nextPage);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return items;
|
|
101
|
+
});
|
|
102
|
+
watchEffect(() => {
|
|
103
|
+
select(modelValue.value, false);
|
|
104
|
+
});
|
|
105
|
+
return {
|
|
106
|
+
modelValue,
|
|
107
|
+
select,
|
|
108
|
+
countRef,
|
|
109
|
+
mode,
|
|
110
|
+
pages,
|
|
111
|
+
forceEllipses
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
const _hoisted_1 = { class: "nut-pagination" };
|
|
116
|
+
const _hoisted_2 = {
|
|
117
|
+
key: 0,
|
|
118
|
+
class: "nut-pagination-contain"
|
|
119
|
+
};
|
|
120
|
+
const _hoisted_3 = ["onClick"];
|
|
121
|
+
const _hoisted_4 = {
|
|
122
|
+
key: 1,
|
|
123
|
+
class: "nut-pagination-contain"
|
|
124
|
+
};
|
|
125
|
+
const _hoisted_5 = { class: "nut-pagination-simple" };
|
|
126
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
127
|
+
return openBlock(), createElementBlock("view", _hoisted_1, [
|
|
128
|
+
createElementVNode("view", {
|
|
129
|
+
class: normalizeClass(["nut-pagination-prev", _ctx.mode == "multi" ? "" : "simple-border", _ctx.modelValue == 1 ? "disabled" : ""]),
|
|
130
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.select(_ctx.modelValue - 1, true))
|
|
131
|
+
}, [
|
|
132
|
+
renderSlot(_ctx.$slots, "prev-text", {}, () => [
|
|
133
|
+
createTextVNode(toDisplayString(_ctx.prevText), 1)
|
|
134
|
+
])
|
|
135
|
+
], 2),
|
|
136
|
+
_ctx.mode == "multi" ? (openBlock(), createElementBlock("view", _hoisted_2, [
|
|
137
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.pages, (item, index2) => {
|
|
138
|
+
return openBlock(), createElementBlock("view", {
|
|
139
|
+
key: index2 + "pagination",
|
|
140
|
+
class: normalizeClass(["nut-pagination-item", item.active ? "active" : ""]),
|
|
141
|
+
onClick: ($event) => _ctx.select(item.number, true)
|
|
142
|
+
}, [
|
|
143
|
+
renderSlot(_ctx.$slots, "page", { item }, () => [
|
|
144
|
+
createTextVNode(toDisplayString(item.text), 1)
|
|
145
|
+
])
|
|
146
|
+
], 10, _hoisted_3);
|
|
147
|
+
}), 128))
|
|
148
|
+
])) : createCommentVNode("", true),
|
|
149
|
+
_ctx.mode == "simple" ? (openBlock(), createElementBlock("view", _hoisted_4, [
|
|
150
|
+
createElementVNode("view", _hoisted_5, toDisplayString(_ctx.modelValue) + "/" + toDisplayString(_ctx.countRef), 1)
|
|
151
|
+
])) : createCommentVNode("", true),
|
|
152
|
+
createElementVNode("view", {
|
|
153
|
+
class: normalizeClass(["nut-pagination-next", _ctx.modelValue >= _ctx.countRef ? "disabled" : ""]),
|
|
154
|
+
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.select(_ctx.modelValue + 1, true))
|
|
155
|
+
}, [
|
|
156
|
+
renderSlot(_ctx.$slots, "next-text", {}, () => [
|
|
157
|
+
createTextVNode(toDisplayString(_ctx.nextText), 1)
|
|
158
|
+
])
|
|
159
|
+
], 2)
|
|
160
|
+
]);
|
|
161
|
+
}
|
|
162
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
163
|
+
export { index as default };
|