@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,81 +1,236 @@
|
|
|
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 { reactive
|
|
7
|
-
import { c as
|
|
8
|
-
import
|
|
9
|
-
import { _ as
|
|
6
|
+
import { reactive, onMounted, ref, watch, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, normalizeClass, normalizeStyle, renderSlot, createElementBlock, Fragment, createTextVNode, toDisplayString, createVNode, render, h } from "vue";
|
|
7
|
+
import { c as createComponent } from "./component.js";
|
|
8
|
+
import Popup from "./Popup.js";
|
|
9
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
10
10
|
import "../locale/lang";
|
|
11
11
|
import "./OverLay.js";
|
|
12
12
|
import "./Icon.js";
|
|
13
13
|
import "./pxCheck.js";
|
|
14
|
-
const { componentName
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
14
|
+
const { componentName, create } = createComponent("notify");
|
|
15
|
+
const _sfc_main = create({
|
|
16
|
+
components: {
|
|
17
|
+
[Popup.name]: Popup
|
|
18
|
+
},
|
|
19
|
+
props: {
|
|
20
|
+
id: String,
|
|
21
|
+
color: { type: String, default: "" },
|
|
22
|
+
msg: { type: String, default: "" },
|
|
23
|
+
duration: { type: Number, default: 3e3 },
|
|
24
|
+
className: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: ""
|
|
27
|
+
},
|
|
28
|
+
background: { type: String, default: "" },
|
|
29
|
+
type: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: "danger"
|
|
32
|
+
},
|
|
33
|
+
showPopup: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false
|
|
36
|
+
},
|
|
37
|
+
position: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: "top"
|
|
40
|
+
},
|
|
41
|
+
isWrapTeleport: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: true
|
|
44
|
+
},
|
|
45
|
+
onClose: Function,
|
|
46
|
+
onClick: Function,
|
|
47
|
+
unmount: Function
|
|
48
|
+
},
|
|
49
|
+
setup(props, { slots }) {
|
|
50
|
+
let timer = null;
|
|
51
|
+
const state = reactive({
|
|
52
|
+
mounted: false
|
|
53
|
+
});
|
|
54
|
+
onMounted(() => {
|
|
55
|
+
});
|
|
56
|
+
const visible = ref(false);
|
|
57
|
+
const clickCover = () => {
|
|
58
|
+
props.onClick && props.onClick();
|
|
59
|
+
};
|
|
60
|
+
const clearTimer = () => {
|
|
61
|
+
if (timer) {
|
|
62
|
+
clearTimeout(timer);
|
|
63
|
+
timer = null;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const hide = () => {
|
|
67
|
+
state.mounted = false;
|
|
68
|
+
};
|
|
69
|
+
const show = () => {
|
|
70
|
+
clearTimer();
|
|
71
|
+
if (props.duration) {
|
|
72
|
+
timer = setTimeout(() => {
|
|
73
|
+
hide();
|
|
74
|
+
}, props.duration);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
if (props.duration) {
|
|
78
|
+
show();
|
|
79
|
+
}
|
|
80
|
+
watch(() => props.duration, (val) => {
|
|
81
|
+
if (val) {
|
|
82
|
+
show();
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
const onAfterLeave = () => {
|
|
86
|
+
clearTimer();
|
|
87
|
+
props.unmount && props.unmount(props.id);
|
|
88
|
+
props.onClose && props.onClose();
|
|
89
|
+
};
|
|
90
|
+
return { state, hide, onAfterLeave, clickCover, visible };
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
94
|
+
const _component_nut_popup = resolveComponent("nut-popup");
|
|
95
|
+
return openBlock(), createBlock(_component_nut_popup, {
|
|
96
|
+
visible: _ctx.showPopup,
|
|
97
|
+
"onUpdate:visible": _cache[1] || (_cache[1] = ($event) => _ctx.showPopup = $event),
|
|
98
|
+
position: _ctx.position,
|
|
99
|
+
overlay: false,
|
|
100
|
+
isWrapTeleport: _ctx.isWrapTeleport
|
|
101
|
+
}, {
|
|
102
|
+
default: withCtx(() => [
|
|
103
|
+
createElementVNode("div", {
|
|
104
|
+
class: normalizeClass(["nut-notify", `nut-notify--${_ctx.type}`, _ctx.className]),
|
|
105
|
+
style: normalizeStyle({ color: _ctx.color, background: _ctx.background }),
|
|
106
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickCover && _ctx.clickCover(...args))
|
|
107
|
+
}, [
|
|
108
|
+
_ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
109
|
+
createTextVNode(toDisplayString(_ctx.msg), 1)
|
|
110
|
+
], 64))
|
|
111
|
+
], 6)
|
|
112
|
+
]),
|
|
113
|
+
_: 3
|
|
114
|
+
}, 8, ["visible", "position", "isWrapTeleport"]);
|
|
115
|
+
}
|
|
116
|
+
var Notify = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
117
|
+
const defaultOptions = {
|
|
118
|
+
type: "base",
|
|
119
|
+
showPopup: true,
|
|
120
|
+
visible: true,
|
|
121
|
+
msg: "",
|
|
122
|
+
color: void 0,
|
|
123
|
+
background: void 0,
|
|
124
|
+
duration: 3e3,
|
|
125
|
+
className: "",
|
|
126
|
+
onClosed: null,
|
|
127
|
+
onClick: null,
|
|
128
|
+
onOpened: null,
|
|
129
|
+
textTimer: null,
|
|
130
|
+
unmount: null
|
|
131
|
+
};
|
|
132
|
+
let idsMap = [];
|
|
133
|
+
let optsMap = [];
|
|
134
|
+
const clearNotify = (id) => {
|
|
135
|
+
if (id) {
|
|
136
|
+
const container = document.getElementById(id);
|
|
137
|
+
optsMap = optsMap.filter((item) => item.id !== id);
|
|
138
|
+
idsMap = idsMap.filter((item) => item !== id);
|
|
139
|
+
if (container) {
|
|
140
|
+
document.body.removeChild(container);
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
idsMap.forEach((item) => {
|
|
144
|
+
const container = document.getElementById(item);
|
|
145
|
+
if (container) {
|
|
146
|
+
document.body.removeChild(container);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
optsMap = [];
|
|
150
|
+
idsMap = [];
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
const updateNotify = (opts) => {
|
|
154
|
+
const container = document.getElementById(opts.id);
|
|
155
|
+
if (container) {
|
|
156
|
+
const currentOpt = optsMap.find((item) => item.id === opts.id);
|
|
157
|
+
if (currentOpt) {
|
|
158
|
+
opts = { ...defaultOptions, ...currentOpt, ...opts };
|
|
159
|
+
} else {
|
|
160
|
+
opts = { ...defaultOptions, ...opts };
|
|
161
|
+
}
|
|
162
|
+
const instance = createVNode(Notify, opts);
|
|
163
|
+
render(instance, container);
|
|
164
|
+
return instance.component.ctx;
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
const mountNotify = (opts) => {
|
|
168
|
+
opts.unmount = clearNotify;
|
|
169
|
+
let _id;
|
|
170
|
+
if (opts.id) {
|
|
171
|
+
_id = opts.id;
|
|
172
|
+
if (idsMap.find((item) => item === opts.id)) {
|
|
173
|
+
return updateNotify(opts);
|
|
174
|
+
}
|
|
175
|
+
} else {
|
|
176
|
+
_id = new Date().getTime() + "";
|
|
177
|
+
}
|
|
178
|
+
opts = { ...defaultOptions, ...opts };
|
|
179
|
+
opts.id = _id;
|
|
180
|
+
idsMap.push(opts.id);
|
|
181
|
+
optsMap.push(opts);
|
|
182
|
+
const root = document.createElement("view");
|
|
183
|
+
root.id = "notify-" + opts.id;
|
|
184
|
+
const Wrapper = {
|
|
185
|
+
setup() {
|
|
186
|
+
opts.teleport = `#notify-${opts.id}`;
|
|
187
|
+
onMounted(() => {
|
|
188
|
+
setTimeout(() => {
|
|
189
|
+
document.body.removeChild(root);
|
|
190
|
+
}, opts.duration);
|
|
191
|
+
});
|
|
192
|
+
return () => {
|
|
193
|
+
return h(Notify, opts);
|
|
194
|
+
};
|
|
195
|
+
}
|
|
28
196
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
n2.id = "notify-" + e2.id;
|
|
70
|
-
const i2 = g({ setup: () => (e2.teleport = `#notify-${e2.id}`, t(() => {
|
|
71
|
-
setTimeout(() => {
|
|
72
|
-
document.body.removeChild(n2);
|
|
73
|
-
}, e2.duration);
|
|
74
|
-
}), () => C(S, e2)) });
|
|
75
|
-
document.body.appendChild(n2), v(i2, n2);
|
|
76
|
-
}, N = { text: (e2, t2 = {}) => E({ ...t2, msg: e2 }), primary: (e2, t2 = {}) => E({ ...t2, msg: e2, type: "primary" }), success: (e2, t2 = {}) => E({ ...t2, msg: e2, type: "success" }), danger: (e2, t2 = {}) => E({ ...t2, msg: e2, type: "danger" }), warn: (e2, t2 = {}) => E({ ...t2, msg: e2, type: "warning" }), hide() {
|
|
77
|
-
B();
|
|
78
|
-
}, install(e2) {
|
|
79
|
-
e2.use(S), e2.config.globalProperties.$notify = N;
|
|
80
|
-
} };
|
|
81
|
-
export { S as Notify, N as NotifyFunction, N as default };
|
|
197
|
+
const instance = createVNode(Wrapper);
|
|
198
|
+
document.body.appendChild(root);
|
|
199
|
+
render(instance, root);
|
|
200
|
+
};
|
|
201
|
+
const errorMsg = (msg) => {
|
|
202
|
+
if (!msg) {
|
|
203
|
+
console.warn("[NutUI Notify]: msg\u4E0D\u80FD\u4E3A\u7A7A");
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
const NotifyFunction = {
|
|
208
|
+
text(msg, obj = {}) {
|
|
209
|
+
errorMsg(msg);
|
|
210
|
+
return mountNotify({ ...obj, msg });
|
|
211
|
+
},
|
|
212
|
+
primary(msg, obj = {}) {
|
|
213
|
+
errorMsg(msg);
|
|
214
|
+
return mountNotify({ ...obj, msg, type: "primary" });
|
|
215
|
+
},
|
|
216
|
+
success(msg, obj = {}) {
|
|
217
|
+
errorMsg(msg);
|
|
218
|
+
return mountNotify({ ...obj, msg, type: "success" });
|
|
219
|
+
},
|
|
220
|
+
danger(msg, obj = {}) {
|
|
221
|
+
errorMsg(msg);
|
|
222
|
+
return mountNotify({ ...obj, msg, type: "danger" });
|
|
223
|
+
},
|
|
224
|
+
warn(msg, obj = {}) {
|
|
225
|
+
errorMsg(msg);
|
|
226
|
+
return mountNotify({ ...obj, msg, type: "warning" });
|
|
227
|
+
},
|
|
228
|
+
hide() {
|
|
229
|
+
clearNotify();
|
|
230
|
+
},
|
|
231
|
+
install(app) {
|
|
232
|
+
app.use(Notify);
|
|
233
|
+
app.config.globalProperties.$notify = NotifyFunction;
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
export { Notify, NotifyFunction, NotifyFunction as default };
|
|
@@ -1,47 +1,278 @@
|
|
|
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 { ref
|
|
7
|
-
import { c as
|
|
8
|
-
import { _ as
|
|
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
9
|
import "../locale/lang";
|
|
10
|
-
const { create
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
const { create, translate } = createComponent("numberkeyboard");
|
|
11
|
+
const _sfc_main = create({
|
|
12
|
+
props: {
|
|
13
|
+
confirmText: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: ""
|
|
16
|
+
},
|
|
17
|
+
title: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: ""
|
|
20
|
+
},
|
|
21
|
+
visible: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false
|
|
24
|
+
},
|
|
25
|
+
type: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: "default"
|
|
28
|
+
},
|
|
29
|
+
customKey: {
|
|
30
|
+
type: Array,
|
|
31
|
+
default: () => []
|
|
32
|
+
},
|
|
33
|
+
value: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: ""
|
|
36
|
+
},
|
|
37
|
+
maxlength: {
|
|
38
|
+
type: [Number, String],
|
|
39
|
+
default: 6
|
|
40
|
+
},
|
|
41
|
+
randomKeys: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: false
|
|
44
|
+
},
|
|
45
|
+
overlay: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: true
|
|
48
|
+
},
|
|
49
|
+
isWrapTeleport: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: true
|
|
52
|
+
},
|
|
53
|
+
teleport: {
|
|
54
|
+
type: [String, Element],
|
|
55
|
+
default: "body"
|
|
56
|
+
},
|
|
57
|
+
popClass: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: ""
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
emits: ["input", "delete", "close", "update:value"],
|
|
63
|
+
setup(props, { emit }) {
|
|
64
|
+
const clickKeyIndex = ref(void 0);
|
|
65
|
+
const show = ref(props.visible);
|
|
66
|
+
const root = ref();
|
|
67
|
+
function defaultKey() {
|
|
68
|
+
const { customKey } = props;
|
|
69
|
+
let object = {
|
|
70
|
+
id: "lock",
|
|
71
|
+
type: "lock"
|
|
72
|
+
};
|
|
73
|
+
let customKeys = Array.isArray(customKey) ? customKey : [customKey];
|
|
74
|
+
if (customKeys.length === 1) {
|
|
75
|
+
object = {
|
|
76
|
+
id: customKeys[0],
|
|
77
|
+
type: "custom"
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return [...getBasicKeys(), object, { id: 0, type: "number" }, { id: "delete", type: "delete" }];
|
|
81
|
+
}
|
|
82
|
+
function getBasicKeys() {
|
|
83
|
+
const keys = [];
|
|
84
|
+
for (let i = 1; i <= 9; i++) {
|
|
85
|
+
keys.push({ id: i, type: "number" });
|
|
86
|
+
}
|
|
87
|
+
if (props.randomKeys) {
|
|
88
|
+
return keys.sort(() => Math.random() > 0.5 ? 1 : -1);
|
|
89
|
+
}
|
|
90
|
+
return keys;
|
|
91
|
+
}
|
|
92
|
+
function genCustomKeys() {
|
|
93
|
+
const keys = getBasicKeys();
|
|
94
|
+
const { customKey } = props;
|
|
95
|
+
let customKeys = Array.isArray(customKey) ? customKey : [customKey];
|
|
96
|
+
if (customKeys.length > 2) {
|
|
97
|
+
customKeys = [customKeys[0], customKeys[1]];
|
|
98
|
+
}
|
|
99
|
+
if (customKeys.length === 1) {
|
|
100
|
+
if (props.title) {
|
|
101
|
+
keys.push({ id: customKeys[0], type: "custom" }, { id: 0, type: "number" }, { id: "delete", type: "delete" });
|
|
102
|
+
} else {
|
|
103
|
+
keys.push({ id: 0, type: "number" }, { id: customKeys[0], type: "custom" });
|
|
104
|
+
}
|
|
105
|
+
} else if (customKeys.length === 2) {
|
|
106
|
+
keys.push({ id: customKeys[0], type: "custom" }, { id: 0, type: "number" }, { id: customKeys[1], type: "custom" });
|
|
107
|
+
if (props.title) {
|
|
108
|
+
keys.push({ id: "delete", type: "delete" });
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
keys.push({ id: 0, type: "number" });
|
|
112
|
+
}
|
|
113
|
+
return keys;
|
|
114
|
+
}
|
|
115
|
+
const keysList = computed(() => {
|
|
116
|
+
if (props.type == "rightColumn" || props.title != "") {
|
|
117
|
+
return genCustomKeys();
|
|
118
|
+
}
|
|
119
|
+
return defaultKey();
|
|
120
|
+
});
|
|
121
|
+
watch(() => props.visible, (value) => {
|
|
122
|
+
show.value = value;
|
|
123
|
+
});
|
|
124
|
+
function onTouchstart(item, event) {
|
|
125
|
+
event.stopPropagation();
|
|
126
|
+
clickKeyIndex.value = item.id;
|
|
127
|
+
if (item.type == "number" || item.type == "custom") {
|
|
128
|
+
emit("input", item.id);
|
|
129
|
+
if (props.value.length < props.maxlength) {
|
|
130
|
+
emit("update:value", props.value + item.id);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (item.type == "lock") {
|
|
134
|
+
closeBoard();
|
|
135
|
+
}
|
|
136
|
+
if (item.type == "delete") {
|
|
137
|
+
emit("delete");
|
|
138
|
+
emit("update:value", props.value.slice(0, props.value.length - 1));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
function onTouchMove(id, event) {
|
|
142
|
+
event.stopPropagation();
|
|
143
|
+
}
|
|
144
|
+
function onTouchEnd(event) {
|
|
145
|
+
event.preventDefault();
|
|
146
|
+
clickKeyIndex.value = void 0;
|
|
147
|
+
}
|
|
148
|
+
function closeBoard() {
|
|
149
|
+
emit("close");
|
|
150
|
+
}
|
|
151
|
+
onMounted(() => {
|
|
152
|
+
});
|
|
153
|
+
return {
|
|
154
|
+
clickKeyIndex,
|
|
155
|
+
defaultKey,
|
|
156
|
+
closeBoard,
|
|
157
|
+
onTouchEnd,
|
|
158
|
+
onTouchMove,
|
|
159
|
+
onTouchstart,
|
|
160
|
+
keysList,
|
|
161
|
+
genCustomKeys,
|
|
162
|
+
getBasicKeys,
|
|
163
|
+
root,
|
|
164
|
+
show,
|
|
165
|
+
translate
|
|
166
|
+
};
|
|
16
167
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
168
|
+
});
|
|
169
|
+
const _hoisted_1 = {
|
|
170
|
+
class: "nut-numberkeyboard",
|
|
171
|
+
ref: "root"
|
|
172
|
+
};
|
|
173
|
+
const _hoisted_2 = {
|
|
174
|
+
key: 0,
|
|
175
|
+
class: "number-board-header"
|
|
176
|
+
};
|
|
177
|
+
const _hoisted_3 = { class: "tit" };
|
|
178
|
+
const _hoisted_4 = { class: "number-board-body" };
|
|
179
|
+
const _hoisted_5 = { class: "number-board" };
|
|
180
|
+
const _hoisted_6 = ["onTouchstart", "onTouchmove"];
|
|
181
|
+
const _hoisted_7 = {
|
|
182
|
+
key: 1,
|
|
183
|
+
src: "https://img11.360buyimg.com/imagetools/jfs/t1/146371/38/8485/738/5f606425Eca239740/14f4b4f5f20d8a68.png"
|
|
184
|
+
};
|
|
185
|
+
const _hoisted_8 = {
|
|
186
|
+
key: 2,
|
|
187
|
+
src: "https://img11.360buyimg.com/imagetools/jfs/t1/129395/8/12735/2030/5f61ac37E70cab338/fb477dc11f46056c.png"
|
|
188
|
+
};
|
|
189
|
+
const _hoisted_9 = {
|
|
190
|
+
key: 0,
|
|
191
|
+
class: "number-board-sidebar"
|
|
192
|
+
};
|
|
193
|
+
const _hoisted_10 = { class: "key-board-wrapper" };
|
|
194
|
+
const _hoisted_11 = /* @__PURE__ */ createElementVNode("img", { src: "https://img11.360buyimg.com/imagetools/jfs/t1/129395/8/12735/2030/5f61ac37E70cab338/fb477dc11f46056c.png" }, null, -1);
|
|
195
|
+
const _hoisted_12 = [
|
|
196
|
+
_hoisted_11
|
|
197
|
+
];
|
|
198
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
199
|
+
const _component_nut_popup = resolveComponent("nut-popup");
|
|
200
|
+
return openBlock(), createBlock(_component_nut_popup, {
|
|
201
|
+
visible: _ctx.show,
|
|
202
|
+
"onUpdate:visible": _cache[6] || (_cache[6] = ($event) => _ctx.show = $event),
|
|
203
|
+
position: "bottom",
|
|
204
|
+
teleport: _ctx.teleport,
|
|
205
|
+
popClass: _ctx.popClass,
|
|
206
|
+
overlay: _ctx.overlay,
|
|
207
|
+
onClickOverlay: _cache[7] || (_cache[7] = ($event) => _ctx.closeBoard()),
|
|
208
|
+
isWrapTeleport: _ctx.isWrapTeleport,
|
|
209
|
+
"overlay-class": "nut-numberkeyboard-overlay"
|
|
210
|
+
}, {
|
|
211
|
+
default: withCtx(() => [
|
|
212
|
+
createElementVNode("div", _hoisted_1, [
|
|
213
|
+
_ctx.title ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
214
|
+
createElementVNode("h3", _hoisted_3, toDisplayString(_ctx.title), 1),
|
|
215
|
+
createElementVNode("span", {
|
|
216
|
+
class: "keyboard-close",
|
|
217
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.closeBoard())
|
|
218
|
+
}, toDisplayString(_ctx.translate("done")), 1)
|
|
219
|
+
])) : createCommentVNode("", true),
|
|
220
|
+
createElementVNode("div", _hoisted_4, [
|
|
221
|
+
createElementVNode("div", _hoisted_5, [
|
|
222
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.keysList, (item) => {
|
|
223
|
+
return openBlock(), createElementBlock("div", {
|
|
224
|
+
class: normalizeClass([
|
|
225
|
+
"key-board-wrapper",
|
|
226
|
+
{
|
|
227
|
+
"key-board-wrapper-large": item.id == 0 && _ctx.type == "rightColumn" && Array.isArray(_ctx.customKey) && _ctx.customKey.length == 1
|
|
228
|
+
}
|
|
229
|
+
]),
|
|
230
|
+
key: "key" + item.id
|
|
231
|
+
}, [
|
|
232
|
+
createElementVNode("div", {
|
|
233
|
+
class: normalizeClass([
|
|
234
|
+
"key",
|
|
235
|
+
{ active: item.id == _ctx.clickKeyIndex },
|
|
236
|
+
{ lock: item.type == "lock" },
|
|
237
|
+
{ delete: item.type == "delete" }
|
|
238
|
+
]),
|
|
239
|
+
onTouchstart: (event) => _ctx.onTouchstart(item, event),
|
|
240
|
+
onTouchmove: (event) => _ctx.onTouchMove(item, event),
|
|
241
|
+
onTouchend: _cache[1] || (_cache[1] = (event) => _ctx.onTouchEnd(event))
|
|
242
|
+
}, [
|
|
243
|
+
item.type == "number" || item.type == "custom" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
244
|
+
createTextVNode(toDisplayString(item.id), 1)
|
|
245
|
+
], 64)) : createCommentVNode("", true),
|
|
246
|
+
item.type == "lock" ? (openBlock(), createElementBlock("img", _hoisted_7)) : createCommentVNode("", true),
|
|
247
|
+
item.type == "delete" ? (openBlock(), createElementBlock("img", _hoisted_8)) : createCommentVNode("", true)
|
|
248
|
+
], 42, _hoisted_6)
|
|
249
|
+
], 2);
|
|
250
|
+
}), 128))
|
|
251
|
+
]),
|
|
252
|
+
_ctx.type == "rightColumn" ? (openBlock(), createElementBlock("div", _hoisted_9, [
|
|
253
|
+
createElementVNode("div", _hoisted_10, [
|
|
254
|
+
createElementVNode("div", {
|
|
255
|
+
class: normalizeClass(["key", { active: _ctx.clickKeyIndex == "delete" }]),
|
|
256
|
+
onTouchstart: _cache[2] || (_cache[2] = (event) => _ctx.onTouchstart({ id: "delete", type: "delete" }, event)),
|
|
257
|
+
onTouchmove: _cache[3] || (_cache[3] = (event) => _ctx.onTouchMove({ id: "delete", type: "delete" }, event)),
|
|
258
|
+
onTouchend: _cache[4] || (_cache[4] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args))
|
|
259
|
+
}, _hoisted_12, 34)
|
|
260
|
+
]),
|
|
261
|
+
_ctx.title == "" ? (openBlock(), createElementBlock("div", {
|
|
262
|
+
key: 0,
|
|
263
|
+
class: "key-board-wrapper key-board-finish",
|
|
264
|
+
onClick: _cache[5] || (_cache[5] = ($event) => _ctx.closeBoard())
|
|
265
|
+
}, [
|
|
266
|
+
createElementVNode("div", {
|
|
267
|
+
class: normalizeClass(["key", "finish", { activeFinsh: _ctx.clickKeyIndex == "finish" }])
|
|
268
|
+
}, toDisplayString(_ctx.confirmText || _ctx.translate("done")), 3)
|
|
269
|
+
])) : createCommentVNode("", true)
|
|
270
|
+
])) : createCommentVNode("", true)
|
|
271
|
+
])
|
|
272
|
+
], 512)
|
|
273
|
+
]),
|
|
274
|
+
_: 1
|
|
275
|
+
}, 8, ["visible", "teleport", "popClass", "overlay", "isWrapTeleport"]);
|
|
276
|
+
}
|
|
277
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
278
|
+
export { index as default };
|