@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,389 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
/*!
|
|
21
|
+
* @nutui/nutui v3.1.7 Thu Sep 30 2021 20:17:02 GMT+0800 (中国标准时间)
|
|
22
|
+
* (c) 2021 @jdf2e.
|
|
23
|
+
* Released under the MIT License.
|
|
24
|
+
*/
|
|
25
|
+
import { h, ref, reactive, computed, watch, onMounted, onActivated, onDeactivated, onUnmounted, toRefs, resolveComponent, openBlock, createElementBlock, normalizeClass, withDirectives, normalizeStyle, createBlock, createCommentVNode, createElementVNode, renderSlot, createTextVNode, toDisplayString, withModifiers, createVNode, vShow, Fragment, renderList } from "vue";
|
|
26
|
+
import { c as createComponent } from "./component.js";
|
|
27
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
28
|
+
const { componentName, create } = createComponent("noticebar");
|
|
29
|
+
const _sfc_main = create({
|
|
30
|
+
props: {
|
|
31
|
+
direction: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: "across"
|
|
34
|
+
},
|
|
35
|
+
list: {
|
|
36
|
+
type: Array,
|
|
37
|
+
default: () => {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
standTime: {
|
|
42
|
+
type: Number,
|
|
43
|
+
default: 1e3
|
|
44
|
+
},
|
|
45
|
+
complexAm: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false
|
|
48
|
+
},
|
|
49
|
+
height: {
|
|
50
|
+
type: Number,
|
|
51
|
+
default: 40
|
|
52
|
+
},
|
|
53
|
+
text: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: ""
|
|
56
|
+
},
|
|
57
|
+
closeMode: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: false
|
|
60
|
+
},
|
|
61
|
+
wrapable: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: false
|
|
64
|
+
},
|
|
65
|
+
leftIcon: { type: String, default: "" },
|
|
66
|
+
color: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: ""
|
|
69
|
+
},
|
|
70
|
+
background: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: ""
|
|
73
|
+
},
|
|
74
|
+
delay: {
|
|
75
|
+
type: [String, Number],
|
|
76
|
+
default: 1
|
|
77
|
+
},
|
|
78
|
+
scrollable: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: true
|
|
81
|
+
},
|
|
82
|
+
speed: {
|
|
83
|
+
type: Number,
|
|
84
|
+
default: 50
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
components: {
|
|
88
|
+
ScrollItem: function(props) {
|
|
89
|
+
props.item.props.style = props.style;
|
|
90
|
+
return h(props.item);
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
emits: ["click", "close"],
|
|
94
|
+
setup(props, { emit, slots }) {
|
|
95
|
+
console.log("componentName", componentName);
|
|
96
|
+
const wrap = ref(null);
|
|
97
|
+
const content = ref(null);
|
|
98
|
+
const state = reactive({
|
|
99
|
+
wrapWidth: 0,
|
|
100
|
+
firstRound: true,
|
|
101
|
+
duration: 0,
|
|
102
|
+
offsetWidth: 0,
|
|
103
|
+
showNoticeBar: true,
|
|
104
|
+
animationClass: "",
|
|
105
|
+
animate: false,
|
|
106
|
+
scrollList: [],
|
|
107
|
+
distance: 0,
|
|
108
|
+
timer: null,
|
|
109
|
+
keepAlive: false
|
|
110
|
+
});
|
|
111
|
+
const classes = computed(() => {
|
|
112
|
+
const prefixCls = componentName;
|
|
113
|
+
return {
|
|
114
|
+
[prefixCls]: true
|
|
115
|
+
};
|
|
116
|
+
});
|
|
117
|
+
const iconShow = computed(() => {
|
|
118
|
+
if (props.leftIcon == "close") {
|
|
119
|
+
return false;
|
|
120
|
+
} else {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
const barStyle = computed(() => {
|
|
125
|
+
let style = {};
|
|
126
|
+
props.color && (style.color = props.color);
|
|
127
|
+
props.background && (style.background = props.background);
|
|
128
|
+
if (props.direction == "vertical") {
|
|
129
|
+
style.height = `${props.height}px`;
|
|
130
|
+
}
|
|
131
|
+
return style;
|
|
132
|
+
});
|
|
133
|
+
const contentStyle = computed(() => {
|
|
134
|
+
return {
|
|
135
|
+
paddingLeft: state.firstRound ? 0 : state.wrapWidth + "px",
|
|
136
|
+
animationDelay: (state.firstRound ? props.delay : 0) + "s",
|
|
137
|
+
animationDuration: state.duration + "s"
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
const iconBg = computed(() => {
|
|
141
|
+
let iconBg2 = "";
|
|
142
|
+
if (props.leftIcon) {
|
|
143
|
+
iconBg2 = props.leftIcon;
|
|
144
|
+
}
|
|
145
|
+
return iconBg2;
|
|
146
|
+
});
|
|
147
|
+
const horseLampStyle = computed(() => {
|
|
148
|
+
let styles = {};
|
|
149
|
+
if (props.complexAm) {
|
|
150
|
+
styles = {
|
|
151
|
+
transform: `translateY(${state.distance}px)`
|
|
152
|
+
};
|
|
153
|
+
} else {
|
|
154
|
+
if (state.animate) {
|
|
155
|
+
styles = {
|
|
156
|
+
transition: `all ${~~(props.height / props.speed / 4)}s`,
|
|
157
|
+
"margin-top": `-${props.height}px`
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return styles;
|
|
162
|
+
});
|
|
163
|
+
watch(() => props.text, (value) => {
|
|
164
|
+
initScrollWrap(value);
|
|
165
|
+
});
|
|
166
|
+
watch(() => props.list, (value) => {
|
|
167
|
+
state.scrollList = [].concat(value);
|
|
168
|
+
});
|
|
169
|
+
const initScrollWrap = (value) => {
|
|
170
|
+
if (state.showNoticeBar == false) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
setTimeout(() => {
|
|
174
|
+
if (!wrap.value || !content.value) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const wrapWidth = wrap.value.getBoundingClientRect().width;
|
|
178
|
+
const offsetWidth = content.value.getBoundingClientRect().width;
|
|
179
|
+
if (props.scrollable && offsetWidth > wrapWidth) {
|
|
180
|
+
state.wrapWidth = wrapWidth;
|
|
181
|
+
state.offsetWidth = offsetWidth;
|
|
182
|
+
state.duration = offsetWidth / props.speed;
|
|
183
|
+
state.animationClass = "play";
|
|
184
|
+
} else {
|
|
185
|
+
state.animationClass = "";
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
const handleClick = (event) => {
|
|
190
|
+
emit("click", event);
|
|
191
|
+
};
|
|
192
|
+
const onClickIcon = (event) => {
|
|
193
|
+
state.showNoticeBar = !props.closeMode;
|
|
194
|
+
emit("close", event);
|
|
195
|
+
};
|
|
196
|
+
const onAnimationEnd = () => {
|
|
197
|
+
state.firstRound = false;
|
|
198
|
+
setTimeout(() => {
|
|
199
|
+
state.duration = (state.offsetWidth + state.wrapWidth) / props.speed;
|
|
200
|
+
state.animationClass = "play-infinite";
|
|
201
|
+
}, 0);
|
|
202
|
+
};
|
|
203
|
+
const startRollEasy = () => {
|
|
204
|
+
showhorseLamp();
|
|
205
|
+
state.timer = setInterval(showhorseLamp, ~~(props.height / props.speed / 4) * 1e3 + props.standTime);
|
|
206
|
+
};
|
|
207
|
+
const showhorseLamp = () => {
|
|
208
|
+
state.animate = true;
|
|
209
|
+
setTimeout(() => {
|
|
210
|
+
state.scrollList.push(state.scrollList[0]);
|
|
211
|
+
state.scrollList.shift();
|
|
212
|
+
state.animate = false;
|
|
213
|
+
}, ~~(props.height / props.speed / 4) * 1e3);
|
|
214
|
+
};
|
|
215
|
+
const startRoll = () => {
|
|
216
|
+
state.timer = setInterval(() => {
|
|
217
|
+
let chunk = 100;
|
|
218
|
+
for (let i = 0; i < chunk; i++) {
|
|
219
|
+
scroll(i, i < chunk - 1 ? false : true);
|
|
220
|
+
}
|
|
221
|
+
}, props.standTime + 100 * props.speed);
|
|
222
|
+
};
|
|
223
|
+
const scroll = (n, last) => {
|
|
224
|
+
setTimeout(() => {
|
|
225
|
+
state.distance -= props.height / 100;
|
|
226
|
+
if (last) {
|
|
227
|
+
state.scrollList.push(state.scrollList[0]);
|
|
228
|
+
state.scrollList.shift();
|
|
229
|
+
state.distance = 0;
|
|
230
|
+
}
|
|
231
|
+
}, n * props.speed);
|
|
232
|
+
};
|
|
233
|
+
const go = (item) => {
|
|
234
|
+
emit("click", item);
|
|
235
|
+
};
|
|
236
|
+
const handleClickIcon = () => {
|
|
237
|
+
emit("close", state.scrollList[0]);
|
|
238
|
+
};
|
|
239
|
+
onMounted(() => {
|
|
240
|
+
console.log(props.direction);
|
|
241
|
+
if (props.direction == "vertical") {
|
|
242
|
+
if (slots.default) {
|
|
243
|
+
state.scrollList = [].concat(slots.default()[0].children);
|
|
244
|
+
} else {
|
|
245
|
+
state.scrollList = [].concat(props.list);
|
|
246
|
+
}
|
|
247
|
+
console.log(state.scrollList);
|
|
248
|
+
setTimeout(() => {
|
|
249
|
+
props.complexAm ? startRoll() : startRollEasy();
|
|
250
|
+
}, props.standTime);
|
|
251
|
+
} else {
|
|
252
|
+
initScrollWrap(props.text);
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
onActivated(() => {
|
|
256
|
+
if (state.keepAlive) {
|
|
257
|
+
state.keepAlive = false;
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
onDeactivated(() => {
|
|
261
|
+
state.keepAlive = true;
|
|
262
|
+
clearInterval(state.timer);
|
|
263
|
+
});
|
|
264
|
+
onUnmounted(() => {
|
|
265
|
+
clearInterval(state.timer);
|
|
266
|
+
});
|
|
267
|
+
return __spreadProps(__spreadValues(__spreadValues({}, toRefs(props)), toRefs(state)), {
|
|
268
|
+
classes,
|
|
269
|
+
iconShow,
|
|
270
|
+
barStyle,
|
|
271
|
+
contentStyle,
|
|
272
|
+
iconBg,
|
|
273
|
+
horseLampStyle,
|
|
274
|
+
wrap,
|
|
275
|
+
content,
|
|
276
|
+
handleClick,
|
|
277
|
+
onClickIcon,
|
|
278
|
+
onAnimationEnd,
|
|
279
|
+
go,
|
|
280
|
+
handleClickIcon,
|
|
281
|
+
slots
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
const _hoisted_1 = {
|
|
286
|
+
ref: "wrap",
|
|
287
|
+
class: "wrap"
|
|
288
|
+
};
|
|
289
|
+
const _hoisted_2 = ["onClick"];
|
|
290
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
291
|
+
const _component_nut_icon = resolveComponent("nut-icon");
|
|
292
|
+
const _component_ScrollItem = resolveComponent("ScrollItem");
|
|
293
|
+
return openBlock(), createElementBlock("view", {
|
|
294
|
+
class: normalizeClass(_ctx.classes)
|
|
295
|
+
}, [
|
|
296
|
+
_ctx.direction == "across" ? withDirectives((openBlock(), createElementBlock("view", {
|
|
297
|
+
key: 0,
|
|
298
|
+
class: normalizeClass(["nut-noticebar-page", { withicon: _ctx.closeMode, close: _ctx.closeMode, wrapable: _ctx.wrapable }]),
|
|
299
|
+
style: normalizeStyle(_ctx.barStyle),
|
|
300
|
+
onClick: _cache[3] || (_cache[3] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
|
|
301
|
+
}, [
|
|
302
|
+
_ctx.iconShow ? (openBlock(), createElementBlock("view", {
|
|
303
|
+
key: 0,
|
|
304
|
+
class: "left-icon",
|
|
305
|
+
style: normalizeStyle({ "background-image": `url(${_ctx.iconBg})` })
|
|
306
|
+
}, [
|
|
307
|
+
!_ctx.iconBg ? (openBlock(), createBlock(_component_nut_icon, {
|
|
308
|
+
key: 0,
|
|
309
|
+
name: "notice",
|
|
310
|
+
size: "16",
|
|
311
|
+
color: _ctx.color
|
|
312
|
+
}, null, 8, ["color"])) : createCommentVNode("", true)
|
|
313
|
+
], 4)) : createCommentVNode("", true),
|
|
314
|
+
createElementVNode("view", _hoisted_1, [
|
|
315
|
+
createElementVNode("view", {
|
|
316
|
+
ref: "content",
|
|
317
|
+
class: normalizeClass(["content", [
|
|
318
|
+
_ctx.animationClass,
|
|
319
|
+
{ "nut-ellipsis": !_ctx.scrollable && !_ctx.wrapable }
|
|
320
|
+
]]),
|
|
321
|
+
style: normalizeStyle(_ctx.contentStyle),
|
|
322
|
+
onAnimationend: _cache[0] || (_cache[0] = (...args) => _ctx.onAnimationEnd && _ctx.onAnimationEnd(...args)),
|
|
323
|
+
onWebkitAnimationEnd: _cache[1] || (_cache[1] = (...args) => _ctx.onAnimationEnd && _ctx.onAnimationEnd(...args))
|
|
324
|
+
}, [
|
|
325
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
326
|
+
createTextVNode("1" + toDisplayString(_ctx.text), 1)
|
|
327
|
+
])
|
|
328
|
+
], 38)
|
|
329
|
+
], 512),
|
|
330
|
+
_ctx.closeMode ? (openBlock(), createElementBlock("view", {
|
|
331
|
+
key: 1,
|
|
332
|
+
class: "right-icon",
|
|
333
|
+
onClick: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.onClickIcon && _ctx.onClickIcon(...args), ["stop"]))
|
|
334
|
+
}, [
|
|
335
|
+
createVNode(_component_nut_icon, {
|
|
336
|
+
name: "close",
|
|
337
|
+
color: _ctx.color
|
|
338
|
+
}, null, 8, ["color"])
|
|
339
|
+
])) : createCommentVNode("", true)
|
|
340
|
+
], 6)), [
|
|
341
|
+
[vShow, _ctx.showNoticeBar]
|
|
342
|
+
]) : createCommentVNode("", true),
|
|
343
|
+
_ctx.scrollList.length > 0 && _ctx.direction == "vertical" ? (openBlock(), createElementBlock("view", {
|
|
344
|
+
key: 1,
|
|
345
|
+
class: "nut-noticebar-vertical",
|
|
346
|
+
style: normalizeStyle(_ctx.barStyle)
|
|
347
|
+
}, [
|
|
348
|
+
_ctx.slots.default ? (openBlock(), createElementBlock("view", {
|
|
349
|
+
key: 0,
|
|
350
|
+
class: "horseLamp_list",
|
|
351
|
+
style: normalizeStyle(_ctx.horseLampStyle)
|
|
352
|
+
}, [
|
|
353
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.scrollList, (item, index2) => {
|
|
354
|
+
return openBlock(), createBlock(_component_ScrollItem, {
|
|
355
|
+
key: index2,
|
|
356
|
+
style: normalizeStyle({ height: _ctx.height + "px", "line-height": _ctx.height + "px" }),
|
|
357
|
+
item
|
|
358
|
+
}, null, 8, ["style", "item"]);
|
|
359
|
+
}), 128))
|
|
360
|
+
], 4)) : (openBlock(), createElementBlock("ul", {
|
|
361
|
+
key: 1,
|
|
362
|
+
class: "horseLamp_list",
|
|
363
|
+
style: normalizeStyle(_ctx.horseLampStyle)
|
|
364
|
+
}, [
|
|
365
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.scrollList, (item, index2) => {
|
|
366
|
+
return openBlock(), createElementBlock("li", {
|
|
367
|
+
class: "horseLamp_list_item",
|
|
368
|
+
key: index2,
|
|
369
|
+
style: normalizeStyle({ height: _ctx.height }),
|
|
370
|
+
onClick: ($event) => _ctx.go(item)
|
|
371
|
+
}, toDisplayString(item), 13, _hoisted_2);
|
|
372
|
+
}), 128))
|
|
373
|
+
], 4)),
|
|
374
|
+
createElementVNode("view", {
|
|
375
|
+
class: "go",
|
|
376
|
+
onClick: _cache[4] || (_cache[4] = ($event) => !_ctx.slots.rightIcon && _ctx.handleClickIcon())
|
|
377
|
+
}, [
|
|
378
|
+
_ctx.slots.rightIcon ? renderSlot(_ctx.$slots, "rightIcon", { key: 0 }) : _ctx.closeMode ? (openBlock(), createBlock(_component_nut_icon, {
|
|
379
|
+
key: 1,
|
|
380
|
+
type: "cross",
|
|
381
|
+
color: _ctx.color,
|
|
382
|
+
size: "11px"
|
|
383
|
+
}, null, 8, ["color"])) : createCommentVNode("", true)
|
|
384
|
+
])
|
|
385
|
+
], 4)) : createCommentVNode("", true)
|
|
386
|
+
], 2);
|
|
387
|
+
}
|
|
388
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
389
|
+
export { index as default };
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
/*!
|
|
21
|
+
* @nutui/nutui v3.1.7 Thu Sep 30 2021 20:17:02 GMT+0800 (中国标准时间)
|
|
22
|
+
* (c) 2021 @jdf2e.
|
|
23
|
+
* Released under the MIT License.
|
|
24
|
+
*/
|
|
25
|
+
import { reactive, onMounted, watch, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, normalizeStyle, renderSlot, createElementBlock, Fragment, createTextVNode, toDisplayString, vShow, createVNode, render } from "vue";
|
|
26
|
+
import { c as createComponent } from "./component.js";
|
|
27
|
+
import Popup from "./Popup.js";
|
|
28
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
29
|
+
import "./OverLay.js";
|
|
30
|
+
import "./Icon.js";
|
|
31
|
+
import "./pxCheck.js";
|
|
32
|
+
const { componentName, create } = createComponent("notify");
|
|
33
|
+
const _sfc_main = create({
|
|
34
|
+
components: {
|
|
35
|
+
[Popup.name]: Popup
|
|
36
|
+
},
|
|
37
|
+
props: {
|
|
38
|
+
id: String,
|
|
39
|
+
color: { type: String, default: "" },
|
|
40
|
+
msg: { type: String, default: "" },
|
|
41
|
+
duration: { type: Number, default: 3e3 },
|
|
42
|
+
className: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: ""
|
|
45
|
+
},
|
|
46
|
+
background: { type: String, default: "" },
|
|
47
|
+
type: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: "danger"
|
|
50
|
+
},
|
|
51
|
+
showPopup: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: false
|
|
54
|
+
},
|
|
55
|
+
onClose: Function,
|
|
56
|
+
onClick: Function,
|
|
57
|
+
unmount: Function
|
|
58
|
+
},
|
|
59
|
+
setup(props, { slots }) {
|
|
60
|
+
let timer = null;
|
|
61
|
+
const state = reactive({
|
|
62
|
+
mounted: false
|
|
63
|
+
});
|
|
64
|
+
onMounted(() => {
|
|
65
|
+
state.mounted = true;
|
|
66
|
+
});
|
|
67
|
+
const clickCover = () => {
|
|
68
|
+
props.onClick && props.onClick();
|
|
69
|
+
};
|
|
70
|
+
const clearTimer = () => {
|
|
71
|
+
if (timer) {
|
|
72
|
+
clearTimeout(timer);
|
|
73
|
+
timer = null;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const hide = () => {
|
|
77
|
+
state.mounted = false;
|
|
78
|
+
};
|
|
79
|
+
const show = () => {
|
|
80
|
+
clearTimer();
|
|
81
|
+
if (props.duration) {
|
|
82
|
+
timer = setTimeout(() => {
|
|
83
|
+
hide();
|
|
84
|
+
}, props.duration);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
if (props.duration) {
|
|
88
|
+
show();
|
|
89
|
+
}
|
|
90
|
+
watch(() => props.duration, (val) => {
|
|
91
|
+
if (val) {
|
|
92
|
+
show();
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
const onAfterLeave = () => {
|
|
96
|
+
clearTimer();
|
|
97
|
+
props.unmount && props.unmount(props.id);
|
|
98
|
+
props.onClose && props.onClose();
|
|
99
|
+
};
|
|
100
|
+
return { state, hide, onAfterLeave, clickCover };
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
104
|
+
return openBlock(), createBlock(Transition, {
|
|
105
|
+
name: "toast-fade",
|
|
106
|
+
onAfterLeave: _ctx.onAfterLeave
|
|
107
|
+
}, {
|
|
108
|
+
default: withCtx(() => [
|
|
109
|
+
withDirectives(createElementVNode("view", {
|
|
110
|
+
class: normalizeClass(["popup-top", "nut-notify", `nut-notify--${_ctx.type}`, { className: _ctx.className }]),
|
|
111
|
+
style: normalizeStyle({ color: _ctx.color, background: _ctx.background }),
|
|
112
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickCover && _ctx.clickCover(...args))
|
|
113
|
+
}, [
|
|
114
|
+
_ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
115
|
+
createTextVNode(toDisplayString(_ctx.msg), 1)
|
|
116
|
+
], 64))
|
|
117
|
+
], 6), [
|
|
118
|
+
[vShow, _ctx.state.mounted]
|
|
119
|
+
])
|
|
120
|
+
]),
|
|
121
|
+
_: 3
|
|
122
|
+
}, 8, ["onAfterLeave"]);
|
|
123
|
+
}
|
|
124
|
+
var Notify = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
125
|
+
const defaultOptions = {
|
|
126
|
+
type: "base",
|
|
127
|
+
showPopup: false,
|
|
128
|
+
msg: "",
|
|
129
|
+
color: void 0,
|
|
130
|
+
background: void 0,
|
|
131
|
+
duration: 3e3,
|
|
132
|
+
className: "",
|
|
133
|
+
onClosed: null,
|
|
134
|
+
onClick: null,
|
|
135
|
+
onOpened: null,
|
|
136
|
+
textTimer: null,
|
|
137
|
+
unmount: null
|
|
138
|
+
};
|
|
139
|
+
let idsMap = [];
|
|
140
|
+
let optsMap = [];
|
|
141
|
+
const clearNotify = (id) => {
|
|
142
|
+
if (id) {
|
|
143
|
+
const container = document.getElementById(id);
|
|
144
|
+
optsMap = optsMap.filter((item) => item.id !== id);
|
|
145
|
+
idsMap = idsMap.filter((item) => item !== id);
|
|
146
|
+
if (container) {
|
|
147
|
+
document.body.removeChild(container);
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
idsMap.forEach((item) => {
|
|
151
|
+
const container = document.getElementById(item);
|
|
152
|
+
if (container) {
|
|
153
|
+
document.body.removeChild(container);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
optsMap = [];
|
|
157
|
+
idsMap = [];
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
const updateNotify = (opts) => {
|
|
161
|
+
const container = document.getElementById(opts.id);
|
|
162
|
+
if (container) {
|
|
163
|
+
const currentOpt = optsMap.find((item) => item.id === opts.id);
|
|
164
|
+
if (currentOpt) {
|
|
165
|
+
opts = __spreadValues(__spreadValues(__spreadValues({}, defaultOptions), currentOpt), opts);
|
|
166
|
+
} else {
|
|
167
|
+
opts = __spreadValues(__spreadValues({}, defaultOptions), opts);
|
|
168
|
+
}
|
|
169
|
+
const instance = createVNode(Notify, opts);
|
|
170
|
+
render(instance, container);
|
|
171
|
+
return instance.component.ctx;
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
const mountNotify = (opts) => {
|
|
175
|
+
opts.unmount = clearNotify;
|
|
176
|
+
let _id;
|
|
177
|
+
if (opts.id) {
|
|
178
|
+
_id = opts.id;
|
|
179
|
+
if (idsMap.find((item) => item === opts.id)) {
|
|
180
|
+
return updateNotify(opts);
|
|
181
|
+
}
|
|
182
|
+
} else {
|
|
183
|
+
_id = new Date().getTime() + "";
|
|
184
|
+
}
|
|
185
|
+
opts = __spreadValues(__spreadValues({}, defaultOptions), opts);
|
|
186
|
+
opts.id = _id;
|
|
187
|
+
idsMap.push(opts.id);
|
|
188
|
+
optsMap.push(opts);
|
|
189
|
+
const container = document.createElement("view");
|
|
190
|
+
container.id = opts.id;
|
|
191
|
+
const instance = createVNode(Notify, opts);
|
|
192
|
+
render(instance, container);
|
|
193
|
+
document.body.appendChild(container);
|
|
194
|
+
setTimeout(() => {
|
|
195
|
+
instance.showPopup = true;
|
|
196
|
+
}, 0);
|
|
197
|
+
return instance.component.ctx;
|
|
198
|
+
};
|
|
199
|
+
const errorMsg = (msg) => {
|
|
200
|
+
if (!msg) {
|
|
201
|
+
console.warn("[NutUI Notify]: msg\u4E0D\u80FD\u4E3A\u7A7A");
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
const NotifyFunction = {
|
|
206
|
+
text(msg, obj = {}) {
|
|
207
|
+
errorMsg(msg);
|
|
208
|
+
return mountNotify(__spreadProps(__spreadValues({}, obj), { msg }));
|
|
209
|
+
},
|
|
210
|
+
primary(msg, obj = {}) {
|
|
211
|
+
errorMsg(msg);
|
|
212
|
+
return mountNotify(__spreadProps(__spreadValues({}, obj), { msg, type: "primary" }));
|
|
213
|
+
},
|
|
214
|
+
success(msg, obj = {}) {
|
|
215
|
+
errorMsg(msg);
|
|
216
|
+
return mountNotify(__spreadProps(__spreadValues({}, obj), { msg, type: "success" }));
|
|
217
|
+
},
|
|
218
|
+
danger(msg, obj = {}) {
|
|
219
|
+
errorMsg(msg);
|
|
220
|
+
return mountNotify(__spreadProps(__spreadValues({}, obj), { msg, type: "danger" }));
|
|
221
|
+
},
|
|
222
|
+
warn(msg, obj = {}) {
|
|
223
|
+
errorMsg(msg);
|
|
224
|
+
return mountNotify(__spreadProps(__spreadValues({}, obj), { msg, type: "warning" }));
|
|
225
|
+
},
|
|
226
|
+
hide() {
|
|
227
|
+
clearNotify();
|
|
228
|
+
},
|
|
229
|
+
install(app) {
|
|
230
|
+
app.config.globalProperties.$notify = NotifyFunction;
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
export { Notify, NotifyFunction, NotifyFunction as default };
|