@nutui/nutui 3.1.12-beta.1 → 3.1.14
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 +56 -0
- package/README.md +139 -37
- package/dist/nutui.d.ts +9 -2
- package/dist/nutui.es.js +4830 -2950
- package/dist/nutui.umd.js +4910 -2953
- package/dist/packages/_es/ActionSheet.js +12 -13
- package/dist/packages/_es/Address.js +64 -77
- package/dist/packages/_es/Avatar.js +5 -4
- package/dist/packages/_es/BackTop.js +109 -72
- package/dist/packages/_es/Badge.js +5 -4
- package/dist/packages/_es/Barrage.js +57 -63
- package/dist/packages/_es/Button.js +6 -5
- package/dist/packages/_es/Calendar.js +18 -27
- package/dist/packages/_es/Card.js +8 -7
- package/dist/packages/_es/Cascader.js +547 -0
- package/dist/packages/_es/Cell.js +13 -5
- package/dist/packages/_es/CellGroup.js +14 -7
- package/dist/packages/_es/Checkbox.js +3 -3
- package/dist/packages/_es/CheckboxGroup.js +4 -9
- package/dist/packages/_es/CircleProgress.js +46 -142
- package/dist/packages/_es/Col.js +5 -4
- package/dist/packages/_es/Collapse.js +10 -35
- package/dist/packages/_es/CollapseItem.js +35 -80
- package/dist/packages/_es/CountDown.js +7 -10
- package/dist/packages/_es/CountUp.js +33 -34
- package/dist/packages/_es/DatePicker.js +219 -451
- package/dist/packages/_es/Dialog.js +98 -46
- package/dist/packages/_es/Divider.js +6 -5
- package/dist/packages/_es/Drag.js +50 -76
- package/dist/packages/_es/Elevator.js +53 -81
- package/dist/packages/_es/Empty.js +74 -0
- package/dist/packages/_es/FixedNav.js +9 -8
- package/dist/packages/_es/Form.js +23 -9
- package/dist/packages/_es/FormItem.js +5 -4
- package/dist/packages/_es/Grid.js +12 -0
- package/dist/packages/_es/GridItem.js +149 -0
- package/dist/packages/_es/Icon.js +40 -6
- package/dist/packages/_es/ImagePreview.js +158 -44
- package/dist/packages/_es/Indicator.js +66 -0
- package/dist/packages/_es/InfiniteLoading.js +109 -95
- package/dist/packages/_es/Input.js +21 -22
- package/dist/packages/_es/InputNumber.js +18 -24
- package/dist/packages/_es/Layout.js +2 -2
- package/dist/packages/_es/Menu.js +14 -16
- package/dist/packages/_es/MenuItem.js +11 -9
- package/dist/packages/_es/Navbar.js +7 -7
- package/dist/packages/_es/NoticeBar.js +31 -46
- package/dist/packages/_es/Notify.js +166 -30
- package/dist/packages/_es/NumberKeyboard.js +7 -9
- package/dist/packages/_es/OverLay.js +29 -22
- package/dist/packages/_es/Pagination.js +9 -8
- package/dist/packages/_es/Picker.js +447 -61
- package/dist/packages/_es/Popover.js +34 -161
- package/dist/packages/_es/Popup.js +77 -17
- package/dist/packages/_es/Price.js +7 -18
- package/dist/packages/_es/Progress.js +12 -23
- package/dist/packages/_es/Radio.js +3 -3
- package/dist/packages/_es/RadioGroup.js +2 -2
- package/dist/packages/_es/Range.js +31 -38
- package/dist/packages/_es/Rate.js +35 -17
- package/dist/packages/_es/Row.js +5 -4
- package/dist/packages/_es/SearchBar.js +5 -7
- package/dist/packages/_es/ShortPassword.js +59 -89
- package/dist/packages/_es/Signature.js +71 -70
- package/dist/packages/_es/Skeleton.js +138 -0
- package/dist/packages/_es/Sku.js +43 -53
- package/dist/packages/_es/Step.js +8 -10
- package/dist/packages/_es/Steps.js +2 -2
- package/dist/packages/_es/Swipe.js +28 -43
- package/dist/packages/_es/Swiper.js +418 -17
- package/dist/packages/_es/SwiperItem.js +39 -14
- package/dist/packages/_es/Switch.js +47 -16
- package/dist/packages/_es/TabPane.js +5 -4
- package/dist/packages/_es/Tabbar.js +5 -4
- package/dist/packages/_es/TabbarItem.js +9 -8
- package/dist/packages/_es/Table.js +191 -0
- package/dist/packages/_es/Tabs.js +21 -23
- package/dist/packages/_es/Tag.js +6 -5
- package/dist/packages/_es/TextArea.js +12 -16
- package/dist/packages/_es/TimeDetail.js +5 -7
- package/dist/packages/_es/TimePannel.js +5 -7
- package/dist/packages/_es/TimeSelect.js +7 -12
- package/dist/packages/_es/Toast.js +178 -46
- package/dist/packages/_es/Uploader.js +149 -109
- package/dist/packages/_es/Video.js +405 -0
- package/dist/packages/_es/common.js +136 -0
- package/dist/packages/_es/component.js +1 -1
- package/dist/packages/_es/index.js +7 -58
- package/dist/packages/_es/index2.js +58 -43
- package/dist/packages/_es/index3.js +28 -411
- package/dist/packages/_es/plugin-vue_export-helper.js +13 -0
- package/dist/packages/_es/pxCheck.js +1 -1
- package/dist/packages/_es/raf.js +1 -1
- package/dist/packages/_es/util.js +1 -1
- package/dist/packages/cascader/index.scss +81 -0
- package/dist/packages/cellgroup/index.scss +9 -0
- package/dist/packages/dialog/index.scss +17 -0
- package/dist/packages/drag/index.scss +4 -0
- package/dist/packages/empty/index.scss +33 -0
- package/dist/packages/fixednav/index.scss +6 -1
- package/dist/packages/formitem/index.scss +4 -1
- package/dist/packages/grid/index.scss +10 -0
- package/dist/packages/griditem/index.scss +92 -0
- package/dist/packages/icon/index.scss +2 -1
- package/dist/packages/indicator/index.scss +48 -0
- package/dist/packages/numberkeyboard/index.scss +1 -1
- package/dist/packages/popover/index.scss +2 -2
- package/dist/packages/rate/index.scss +1 -0
- package/dist/packages/skeleton/index.scss +57 -0
- package/dist/packages/table/index.scss +81 -0
- package/dist/packages/tabs/index.scss +16 -0
- package/dist/packages/textarea/index.scss +1 -0
- package/dist/packages/timedetail/index.scss +1 -2
- package/dist/packages/timeselect/index.scss +3 -0
- package/dist/packages/toast/index.scss +6 -0
- package/dist/style.css +1 -1
- package/dist/style.es.js +2 -1
- package/dist/styles/font/config.json +2 -1
- package/dist/styles/font/demo_index.html +26 -3
- package/dist/styles/font/iconfont.css +7 -3
- package/dist/styles/font/iconfont.js +31 -32
- package/dist/styles/font/iconfont.json +7 -0
- package/dist/styles/font/iconfont.ttf +0 -0
- package/dist/styles/font/iconfont.woff +0 -0
- package/dist/styles/font/iconfont.woff2 +0 -0
- package/dist/styles/themes/default.scss +40 -33
- package/dist/styles/variables.scss +54 -1
- package/package.json +2 -3
- package/dist/packages/_es/commonProps.js +0 -30
- package/dist/packages/_es/index.taro.vue_vue&type=script&lang.js +0 -44
- package/dist/packages/_es/use-lock-scroll.js +0 -23
|
@@ -0,0 +1,405 @@
|
|
|
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.14 Wed Dec 22 2021 20:49:10 GMT+0800 (中国标准时间)
|
|
22
|
+
* (c) 2021 @jdf2e.
|
|
23
|
+
* Released under the MIT License.
|
|
24
|
+
*/
|
|
25
|
+
import { reactive, ref, computed, watch, nextTick, onMounted, toRefs, openBlock, createElementBlock, createElementVNode, createCommentVNode, withDirectives, vShow, normalizeClass, toDisplayString, normalizeStyle, withModifiers } from "vue";
|
|
26
|
+
import { c as createComponent } from "./component.js";
|
|
27
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
28
|
+
const throttle = (func, wait, type) => {
|
|
29
|
+
if (type === 1) {
|
|
30
|
+
var previous = 0;
|
|
31
|
+
} else if (type === 2) {
|
|
32
|
+
var timeout;
|
|
33
|
+
}
|
|
34
|
+
return function() {
|
|
35
|
+
let context = this;
|
|
36
|
+
let args = arguments;
|
|
37
|
+
if (type === 1) {
|
|
38
|
+
let now = Date.now();
|
|
39
|
+
if (now - previous > wait) {
|
|
40
|
+
func.apply(context, args);
|
|
41
|
+
previous = now;
|
|
42
|
+
}
|
|
43
|
+
} else if (type === 2) {
|
|
44
|
+
if (!timeout) {
|
|
45
|
+
timeout = setTimeout(() => {
|
|
46
|
+
timeout = null;
|
|
47
|
+
func.apply(context, args);
|
|
48
|
+
}, wait);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
const { create } = createComponent("video");
|
|
54
|
+
const _sfc_main = create({
|
|
55
|
+
props: {
|
|
56
|
+
source: {
|
|
57
|
+
type: Object,
|
|
58
|
+
default: {}
|
|
59
|
+
},
|
|
60
|
+
options: {
|
|
61
|
+
type: Object,
|
|
62
|
+
default: {
|
|
63
|
+
autoplay: false,
|
|
64
|
+
volume: 0.5,
|
|
65
|
+
poster: "",
|
|
66
|
+
loop: false,
|
|
67
|
+
controls: true,
|
|
68
|
+
muted: false,
|
|
69
|
+
disabled: false,
|
|
70
|
+
playsinline: false,
|
|
71
|
+
touchPlay: false,
|
|
72
|
+
preload: ""
|
|
73
|
+
},
|
|
74
|
+
required: true
|
|
75
|
+
},
|
|
76
|
+
model: {
|
|
77
|
+
type: String,
|
|
78
|
+
default: ""
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
components: {},
|
|
82
|
+
emits: ["click", "play", "pause", "playend"],
|
|
83
|
+
setup(props, { emit }) {
|
|
84
|
+
const state = reactive({
|
|
85
|
+
videoElm: null,
|
|
86
|
+
initial: true,
|
|
87
|
+
showToolbox: false,
|
|
88
|
+
player: {
|
|
89
|
+
$player: null,
|
|
90
|
+
pos: null
|
|
91
|
+
},
|
|
92
|
+
progressBar: {
|
|
93
|
+
progressElm: null,
|
|
94
|
+
pos: null
|
|
95
|
+
},
|
|
96
|
+
videoSet: {
|
|
97
|
+
loaded: 0,
|
|
98
|
+
displayTime: "00:00",
|
|
99
|
+
totalTime: "00:00",
|
|
100
|
+
progress: {
|
|
101
|
+
width: 0,
|
|
102
|
+
current: 0
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
state: {
|
|
106
|
+
controlShow: true,
|
|
107
|
+
vol: 0.5,
|
|
108
|
+
currentTime: 0,
|
|
109
|
+
fullScreen: false,
|
|
110
|
+
playing: false,
|
|
111
|
+
isLoading: false,
|
|
112
|
+
isEnd: false,
|
|
113
|
+
isError: false,
|
|
114
|
+
isMuted: false
|
|
115
|
+
},
|
|
116
|
+
showTouchMask: false
|
|
117
|
+
});
|
|
118
|
+
const root = ref();
|
|
119
|
+
const isDisabled = computed(() => {
|
|
120
|
+
return props.options.disabled;
|
|
121
|
+
});
|
|
122
|
+
watch(props.source, (newValue) => {
|
|
123
|
+
if (newValue.src) {
|
|
124
|
+
nextTick(() => {
|
|
125
|
+
state.videoElm.load();
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
watch(props.options, (newValue) => {
|
|
130
|
+
state.state.isMuted = newValue.muted ? newValue.muted : false;
|
|
131
|
+
}, { immediate: true });
|
|
132
|
+
const init = () => {
|
|
133
|
+
state.videoElm = root.value;
|
|
134
|
+
if (props.options.autoplay) {
|
|
135
|
+
state.videoElm.play();
|
|
136
|
+
}
|
|
137
|
+
if (props.options.touchPlay) {
|
|
138
|
+
state.showTouchMask = true;
|
|
139
|
+
}
|
|
140
|
+
if (props.options.playsinline) {
|
|
141
|
+
state.videoElm.setAttribute("playsinline", props.options.playsinline);
|
|
142
|
+
state.videoElm.setAttribute("webkit-playsinline", props.options.playsinline);
|
|
143
|
+
state.videoElm.setAttribute("x5-video-player-type", "h5-page");
|
|
144
|
+
state.videoElm.setAttribute("x5-video-player-fullscreen", false);
|
|
145
|
+
}
|
|
146
|
+
volumeHandle();
|
|
147
|
+
if (state.showToolbox) {
|
|
148
|
+
customerInit();
|
|
149
|
+
} else {
|
|
150
|
+
state.videoElm.addEventListener("play", () => {
|
|
151
|
+
state.state.playing = true;
|
|
152
|
+
emit("play", state.videoElm);
|
|
153
|
+
});
|
|
154
|
+
state.videoElm.addEventListener("pause", () => {
|
|
155
|
+
state.state.playing = false;
|
|
156
|
+
emit("pause", state.videoElm);
|
|
157
|
+
});
|
|
158
|
+
state.videoElm.addEventListener("ended", playEnded);
|
|
159
|
+
state.videoElm.addEventListener("timeupdate", throttle(getPlayTime, 100, 1));
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
const customerInit = () => {
|
|
163
|
+
const $player = root.value;
|
|
164
|
+
const $progress = root.value.getElementsByClassName("progress")[0];
|
|
165
|
+
state.player.$player = $player;
|
|
166
|
+
state.progressBar.progressElm = $progress;
|
|
167
|
+
state.progressBar.pos = $progress.getBoundingClientRect();
|
|
168
|
+
state.videoSet.progress.width = Math.round($progress.getBoundingClientRect().width);
|
|
169
|
+
};
|
|
170
|
+
const play = () => {
|
|
171
|
+
if (props.options.autoplay && props.options.disabled) {
|
|
172
|
+
state.state.playing = true;
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
state.state.playing = !state.state.playing;
|
|
176
|
+
if (state.videoElm) {
|
|
177
|
+
if (state.state.playing) {
|
|
178
|
+
try {
|
|
179
|
+
state.videoElm.play();
|
|
180
|
+
state.videoElm.addEventListener("progress", () => {
|
|
181
|
+
getLoadTime();
|
|
182
|
+
});
|
|
183
|
+
state.videoElm.addEventListener("timeupdate", throttle(getPlayTime, 100, 1));
|
|
184
|
+
state.videoElm.addEventListener("ended", playEnded);
|
|
185
|
+
emit("play", state.videoElm);
|
|
186
|
+
} catch (e) {
|
|
187
|
+
handleError();
|
|
188
|
+
}
|
|
189
|
+
} else {
|
|
190
|
+
state.videoElm.pause();
|
|
191
|
+
emit("pause", state.videoElm);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
const timeFormat = (t) => {
|
|
196
|
+
var h = Math.floor(t / 3600);
|
|
197
|
+
if (h < 10) {
|
|
198
|
+
h = "0" + h;
|
|
199
|
+
}
|
|
200
|
+
var m = Math.floor(t % 3600 / 60);
|
|
201
|
+
if (m < 10) {
|
|
202
|
+
m = "0" + m;
|
|
203
|
+
}
|
|
204
|
+
var s = Math.round(t % 3600 % 60);
|
|
205
|
+
if (s < 10) {
|
|
206
|
+
s = "0" + s;
|
|
207
|
+
}
|
|
208
|
+
var str = "";
|
|
209
|
+
if (h != 0) {
|
|
210
|
+
str = h + ":" + m + ":" + s;
|
|
211
|
+
} else {
|
|
212
|
+
str = m + ":" + s;
|
|
213
|
+
}
|
|
214
|
+
return str;
|
|
215
|
+
};
|
|
216
|
+
const getLoadTime = () => {
|
|
217
|
+
if (state.videoSet.loaded)
|
|
218
|
+
state.videoSet.loaded = state.videoElm.buffered.end(0) / state.videoElm.duration * 100;
|
|
219
|
+
};
|
|
220
|
+
const getPlayTime = () => {
|
|
221
|
+
const percent = state.videoElm.currentTime / state.videoElm.duration;
|
|
222
|
+
state.videoSet.progress.current = Math.round(state.videoSet.progress.width * percent);
|
|
223
|
+
state.videoSet.totalTime = timeFormat(state.videoElm.duration);
|
|
224
|
+
state.videoSet.displayTime = timeFormat(state.videoElm.currentTime);
|
|
225
|
+
};
|
|
226
|
+
const playEnded = () => {
|
|
227
|
+
state.state.playing = false;
|
|
228
|
+
state.state.isEnd = true;
|
|
229
|
+
state.videoSet.displayTime = "00:00";
|
|
230
|
+
state.videoSet.progress.current = 0;
|
|
231
|
+
state.videoElm.currentTime = 0;
|
|
232
|
+
emit("playend", state.videoElm);
|
|
233
|
+
};
|
|
234
|
+
const handleError = () => {
|
|
235
|
+
state.state.isError = true;
|
|
236
|
+
};
|
|
237
|
+
const volumeHandle = () => {
|
|
238
|
+
state.state.vol = props.options.volume;
|
|
239
|
+
};
|
|
240
|
+
const handleMuted = () => {
|
|
241
|
+
state.state.isMuted = !state.state.isMuted;
|
|
242
|
+
state.videoElm.muted = state.state.isMuted;
|
|
243
|
+
};
|
|
244
|
+
const touchSlidSrart = () => {
|
|
245
|
+
};
|
|
246
|
+
const touchSlidMove = (e) => {
|
|
247
|
+
let currentX = e.targetTouches[0].pageX;
|
|
248
|
+
let offsetX = currentX - state.progressBar.pos.left;
|
|
249
|
+
if (offsetX <= 0) {
|
|
250
|
+
offsetX = 0;
|
|
251
|
+
}
|
|
252
|
+
if (offsetX >= state.videoSet.progress.width) {
|
|
253
|
+
offsetX = state.videoSet.progress.width;
|
|
254
|
+
}
|
|
255
|
+
state.videoSet.progress.current = offsetX;
|
|
256
|
+
let percent = state.videoSet.progress.current / state.videoSet.progress.width;
|
|
257
|
+
state.videoElm.duration && setPlayTime(percent, state.videoElm.duration);
|
|
258
|
+
};
|
|
259
|
+
const touchSlidEnd = (e) => {
|
|
260
|
+
let currentX = e.changedTouches[0].pageX;
|
|
261
|
+
let offsetX = currentX - state.progressBar.pos.left;
|
|
262
|
+
state.videoSet.progress.current = offsetX;
|
|
263
|
+
let percent = offsetX / state.videoSet.progress.width;
|
|
264
|
+
state.videoElm.duration && setPlayTime(percent, state.videoElm.duration);
|
|
265
|
+
};
|
|
266
|
+
const setPlayTime = (percent, totalTime) => {
|
|
267
|
+
state.videoElm.currentTime = Math.floor(percent * totalTime);
|
|
268
|
+
};
|
|
269
|
+
const retry = () => {
|
|
270
|
+
state.state.isError = false;
|
|
271
|
+
init();
|
|
272
|
+
};
|
|
273
|
+
const fullScreen = () => {
|
|
274
|
+
if (!state.state.fullScreen) {
|
|
275
|
+
state.state.fullScreen = true;
|
|
276
|
+
state.videoElm.webkitRequestFullScreen();
|
|
277
|
+
} else {
|
|
278
|
+
state.state.fullScreen = false;
|
|
279
|
+
document.webkitCancelFullScreen();
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
onMounted(() => {
|
|
283
|
+
init();
|
|
284
|
+
});
|
|
285
|
+
return __spreadProps(__spreadValues(__spreadValues({
|
|
286
|
+
root
|
|
287
|
+
}, toRefs(props)), toRefs(state)), {
|
|
288
|
+
handleError,
|
|
289
|
+
isDisabled,
|
|
290
|
+
play,
|
|
291
|
+
handleMuted,
|
|
292
|
+
touchSlidSrart,
|
|
293
|
+
touchSlidMove,
|
|
294
|
+
touchSlidEnd,
|
|
295
|
+
retry,
|
|
296
|
+
fullScreen
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
const _hoisted_1 = {
|
|
301
|
+
class: "nut-video",
|
|
302
|
+
ref: "videocon"
|
|
303
|
+
};
|
|
304
|
+
const _hoisted_2 = ["muted", "autoplay", "loop", "poster", "controls", "preload"];
|
|
305
|
+
const _hoisted_3 = ["src", "type"];
|
|
306
|
+
const _hoisted_4 = { class: "current-time" };
|
|
307
|
+
const _hoisted_5 = { class: "progress-container" };
|
|
308
|
+
const _hoisted_6 = {
|
|
309
|
+
class: "progress",
|
|
310
|
+
ref: "progressBar"
|
|
311
|
+
};
|
|
312
|
+
const _hoisted_7 = /* @__PURE__ */ createElementVNode("div", { class: "move-handle" }, null, -1);
|
|
313
|
+
const _hoisted_8 = [
|
|
314
|
+
_hoisted_7
|
|
315
|
+
];
|
|
316
|
+
const _hoisted_9 = {
|
|
317
|
+
class: "played",
|
|
318
|
+
ref: "playedBar"
|
|
319
|
+
};
|
|
320
|
+
const _hoisted_10 = { class: "duration-time" };
|
|
321
|
+
const _hoisted_11 = { class: "nut-video-error" };
|
|
322
|
+
const _hoisted_12 = /* @__PURE__ */ createElementVNode("p", { class: "lose" }, "\u89C6\u9891\u52A0\u8F7D\u5931\u8D25", -1);
|
|
323
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
324
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
325
|
+
createElementVNode("video", {
|
|
326
|
+
ref: "root",
|
|
327
|
+
class: "nut-video-player",
|
|
328
|
+
muted: _ctx.options.muted,
|
|
329
|
+
autoplay: _ctx.options.autoplay,
|
|
330
|
+
loop: _ctx.options.loop,
|
|
331
|
+
poster: _ctx.options.poster,
|
|
332
|
+
controls: _ctx.options.controls,
|
|
333
|
+
preload: _ctx.options.preload,
|
|
334
|
+
onError: _cache[0] || (_cache[0] = (...args) => _ctx.handleError && _ctx.handleError(...args))
|
|
335
|
+
}, [
|
|
336
|
+
createElementVNode("source", {
|
|
337
|
+
src: _ctx.source.src,
|
|
338
|
+
type: _ctx.source.type
|
|
339
|
+
}, null, 8, _hoisted_3)
|
|
340
|
+
], 40, _hoisted_2),
|
|
341
|
+
_ctx.showToolbox && !_ctx.isDisabled ? (openBlock(), createElementBlock("div", {
|
|
342
|
+
key: 0,
|
|
343
|
+
class: "playing-mask",
|
|
344
|
+
ref: "touchMask",
|
|
345
|
+
onClick: _cache[1] || (_cache[1] = (...args) => _ctx.play && _ctx.play(...args))
|
|
346
|
+
}, null, 512)) : createCommentVNode("", true),
|
|
347
|
+
_ctx.showToolbox && !_ctx.isDisabled ? withDirectives((openBlock(), createElementBlock("div", {
|
|
348
|
+
key: 1,
|
|
349
|
+
class: "nut-video-play-btn",
|
|
350
|
+
ref: "palyBtn",
|
|
351
|
+
onClick: _cache[2] || (_cache[2] = (...args) => _ctx.play && _ctx.play(...args))
|
|
352
|
+
}, null, 512)), [
|
|
353
|
+
[vShow, !_ctx.state.playing]
|
|
354
|
+
]) : createCommentVNode("", true),
|
|
355
|
+
withDirectives(createElementVNode("div", {
|
|
356
|
+
class: normalizeClass(["nut-video-controller", { "show-control": !_ctx.state.playing, "hide-control": _ctx.state.playing }])
|
|
357
|
+
}, [
|
|
358
|
+
createElementVNode("div", {
|
|
359
|
+
class: "control-play-btn",
|
|
360
|
+
onClick: _cache[3] || (_cache[3] = (...args) => _ctx.play && _ctx.play(...args))
|
|
361
|
+
}),
|
|
362
|
+
createElementVNode("div", _hoisted_4, toDisplayString(_ctx.videoSet.displayTime), 1),
|
|
363
|
+
createElementVNode("div", _hoisted_5, [
|
|
364
|
+
createElementVNode("div", _hoisted_6, [
|
|
365
|
+
createElementVNode("div", {
|
|
366
|
+
class: "buffered",
|
|
367
|
+
style: normalizeStyle({ width: `${_ctx.videoSet.loaded}%` })
|
|
368
|
+
}, null, 4),
|
|
369
|
+
createElementVNode("div", {
|
|
370
|
+
class: "video-ball",
|
|
371
|
+
style: normalizeStyle({
|
|
372
|
+
transform: `translate3d(${_ctx.videoSet.progress.current}px, -50%, 0)`
|
|
373
|
+
}),
|
|
374
|
+
onTouchmove: _cache[4] || (_cache[4] = withModifiers(($event) => _ctx.touchSlidMove($event), ["stop", "prevent"])),
|
|
375
|
+
onTouchstart: _cache[5] || (_cache[5] = withModifiers(($event) => _ctx.touchSlidSrart($event), ["stop"])),
|
|
376
|
+
onTouchend: _cache[6] || (_cache[6] = withModifiers(($event) => _ctx.touchSlidEnd($event), ["stop"]))
|
|
377
|
+
}, _hoisted_8, 36),
|
|
378
|
+
createElementVNode("div", _hoisted_9, null, 512)
|
|
379
|
+
], 512)
|
|
380
|
+
]),
|
|
381
|
+
createElementVNode("div", _hoisted_10, toDisplayString(_ctx.videoSet.totalTime), 1),
|
|
382
|
+
createElementVNode("div", {
|
|
383
|
+
class: normalizeClass(["volume", { muted: _ctx.state.isMuted }]),
|
|
384
|
+
onClick: _cache[7] || (_cache[7] = (...args) => _ctx.handleMuted && _ctx.handleMuted(...args))
|
|
385
|
+
}, null, 2),
|
|
386
|
+
createElementVNode("div", {
|
|
387
|
+
class: "fullscreen-icon",
|
|
388
|
+
onClick: _cache[8] || (_cache[8] = (...args) => _ctx.fullScreen && _ctx.fullScreen(...args))
|
|
389
|
+
})
|
|
390
|
+
], 2), [
|
|
391
|
+
[vShow, _ctx.showToolbox && !_ctx.isDisabled]
|
|
392
|
+
]),
|
|
393
|
+
withDirectives(createElementVNode("div", _hoisted_11, [
|
|
394
|
+
_hoisted_12,
|
|
395
|
+
createElementVNode("p", {
|
|
396
|
+
class: "retry",
|
|
397
|
+
onClick: _cache[9] || (_cache[9] = (...args) => _ctx.retry && _ctx.retry(...args))
|
|
398
|
+
}, "\u70B9\u51FB\u91CD\u8BD5")
|
|
399
|
+
], 512), [
|
|
400
|
+
[vShow, _ctx.state.isError]
|
|
401
|
+
])
|
|
402
|
+
], 512);
|
|
403
|
+
}
|
|
404
|
+
var Video = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
405
|
+
export { Video as default };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @nutui/nutui v3.1.14 Wed Dec 22 2021 20:49:10 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2021 @jdf2e.
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import { provide, shallowReactive, getCurrentInstance, markRaw, isVNode, computed, h } from "vue";
|
|
7
|
+
import { c as createComponent } from "./component.js";
|
|
8
|
+
import { p as pxCheck } from "./pxCheck.js";
|
|
9
|
+
function flattenVNodes(children, childName) {
|
|
10
|
+
const result = [];
|
|
11
|
+
const traverse = (children2) => {
|
|
12
|
+
if (!Array.isArray(children2))
|
|
13
|
+
return;
|
|
14
|
+
children2.forEach((child) => {
|
|
15
|
+
var _a;
|
|
16
|
+
if (!isVNode(child))
|
|
17
|
+
return;
|
|
18
|
+
if (childName) {
|
|
19
|
+
if (child.type && child.type.name === childName) {
|
|
20
|
+
result.push(child);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
} else {
|
|
24
|
+
result.push(child);
|
|
25
|
+
}
|
|
26
|
+
if ((_a = child.component) == null ? void 0 : _a.subTree) {
|
|
27
|
+
traverse(child.component.subTree.children);
|
|
28
|
+
}
|
|
29
|
+
if (child.children) {
|
|
30
|
+
traverse(child.children);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
traverse(children);
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
function sortChildren(parent, internalChildren, childName) {
|
|
38
|
+
const vnodes = flattenVNodes(parent.subTree.children, childName);
|
|
39
|
+
internalChildren.sort((a, b) => {
|
|
40
|
+
return vnodes.indexOf(a.vnode) - vnodes.indexOf(b.vnode);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function useProvide(key, childName) {
|
|
44
|
+
const internalChildren = shallowReactive([]);
|
|
45
|
+
const parent = getCurrentInstance();
|
|
46
|
+
const add = (child) => {
|
|
47
|
+
if (!child.proxy)
|
|
48
|
+
return;
|
|
49
|
+
internalChildren.push(markRaw(child));
|
|
50
|
+
sortChildren(parent, internalChildren, childName);
|
|
51
|
+
};
|
|
52
|
+
const remove = (child) => {
|
|
53
|
+
internalChildren.splice(internalChildren.indexOf(markRaw(child)), 1);
|
|
54
|
+
};
|
|
55
|
+
const extend = Object.assign;
|
|
56
|
+
return (value) => {
|
|
57
|
+
provide(key, extend({
|
|
58
|
+
add,
|
|
59
|
+
remove,
|
|
60
|
+
internalChildren
|
|
61
|
+
}, value));
|
|
62
|
+
return {
|
|
63
|
+
internalChildren
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
const { componentName } = createComponent("grid");
|
|
68
|
+
const GRID_KEY = Symbol("grid");
|
|
69
|
+
const gridProps = {
|
|
70
|
+
columnNum: {
|
|
71
|
+
type: [Number, String],
|
|
72
|
+
default: 4
|
|
73
|
+
},
|
|
74
|
+
iconSize: {
|
|
75
|
+
type: [Number, String],
|
|
76
|
+
default: 28
|
|
77
|
+
},
|
|
78
|
+
iconColor: {
|
|
79
|
+
type: String
|
|
80
|
+
},
|
|
81
|
+
border: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
default: true
|
|
84
|
+
},
|
|
85
|
+
gutter: {
|
|
86
|
+
type: [Number, String],
|
|
87
|
+
default: 0
|
|
88
|
+
},
|
|
89
|
+
center: {
|
|
90
|
+
type: Boolean,
|
|
91
|
+
default: true
|
|
92
|
+
},
|
|
93
|
+
square: {
|
|
94
|
+
type: Boolean,
|
|
95
|
+
default: false
|
|
96
|
+
},
|
|
97
|
+
reverse: {
|
|
98
|
+
type: Boolean,
|
|
99
|
+
default: false
|
|
100
|
+
},
|
|
101
|
+
direction: {
|
|
102
|
+
type: String
|
|
103
|
+
},
|
|
104
|
+
clickable: {
|
|
105
|
+
type: Boolean,
|
|
106
|
+
default: false
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
const component = {
|
|
110
|
+
props: gridProps,
|
|
111
|
+
setup(props, { slots }) {
|
|
112
|
+
useProvide(GRID_KEY, `${componentName}-item`)({ props });
|
|
113
|
+
const rootClass = computed(() => {
|
|
114
|
+
const prefixCls = componentName;
|
|
115
|
+
return {
|
|
116
|
+
[prefixCls]: true,
|
|
117
|
+
[`${prefixCls}--border`]: props.border && !props.gutter
|
|
118
|
+
};
|
|
119
|
+
});
|
|
120
|
+
const rootStyle = computed(() => {
|
|
121
|
+
const style = {};
|
|
122
|
+
if (props.gutter) {
|
|
123
|
+
style.paddingLeft = pxCheck(props.gutter);
|
|
124
|
+
}
|
|
125
|
+
return style;
|
|
126
|
+
});
|
|
127
|
+
return () => {
|
|
128
|
+
var _a;
|
|
129
|
+
return h("view", {
|
|
130
|
+
class: rootClass.value,
|
|
131
|
+
style: rootStyle.value
|
|
132
|
+
}, (_a = slots.default) == null ? void 0 : _a.call(slots));
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
export { GRID_KEY as G, component as c };
|
|
@@ -1,64 +1,13 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.14 Wed Dec 22 2021 20:49:10 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2021 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (
|
|
10
|
-
|
|
6
|
+
import { getCurrentInstance } from "vue";
|
|
7
|
+
function useExpose(apis) {
|
|
8
|
+
const instance = getCurrentInstance();
|
|
9
|
+
if (instance) {
|
|
10
|
+
Object.assign(instance.proxy, apis);
|
|
11
11
|
}
|
|
12
|
-
if (y > x && y > MIN_DISTANCE) {
|
|
13
|
-
return "vertical";
|
|
14
|
-
}
|
|
15
|
-
return "";
|
|
16
|
-
}
|
|
17
|
-
function useTouch() {
|
|
18
|
-
const startX = ref(0);
|
|
19
|
-
const startY = ref(0);
|
|
20
|
-
const deltaX = ref(0);
|
|
21
|
-
const deltaY = ref(0);
|
|
22
|
-
const offsetX = ref(0);
|
|
23
|
-
const offsetY = ref(0);
|
|
24
|
-
const direction = ref("");
|
|
25
|
-
const isVertical = () => direction.value === "vertical";
|
|
26
|
-
const isHorizontal = () => direction.value === "horizontal";
|
|
27
|
-
const reset = () => {
|
|
28
|
-
deltaX.value = 0;
|
|
29
|
-
deltaY.value = 0;
|
|
30
|
-
offsetX.value = 0;
|
|
31
|
-
offsetY.value = 0;
|
|
32
|
-
direction.value = "";
|
|
33
|
-
};
|
|
34
|
-
const start = (event) => {
|
|
35
|
-
reset();
|
|
36
|
-
startX.value = event.touches[0].clientX;
|
|
37
|
-
startY.value = event.touches[0].clientY;
|
|
38
|
-
};
|
|
39
|
-
const move = (event) => {
|
|
40
|
-
const touch = event.touches[0];
|
|
41
|
-
deltaX.value = touch.clientX - startX.value;
|
|
42
|
-
deltaY.value = touch.clientY - startY.value;
|
|
43
|
-
offsetX.value = Math.abs(deltaX.value);
|
|
44
|
-
offsetY.value = Math.abs(deltaY.value);
|
|
45
|
-
if (!direction.value) {
|
|
46
|
-
direction.value = getDirection(offsetX.value, offsetY.value);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
return {
|
|
50
|
-
move,
|
|
51
|
-
start,
|
|
52
|
-
reset,
|
|
53
|
-
startX,
|
|
54
|
-
startY,
|
|
55
|
-
deltaX,
|
|
56
|
-
deltaY,
|
|
57
|
-
offsetX,
|
|
58
|
-
offsetY,
|
|
59
|
-
direction,
|
|
60
|
-
isVertical,
|
|
61
|
-
isHorizontal
|
|
62
|
-
};
|
|
63
12
|
}
|
|
64
|
-
export {
|
|
13
|
+
export { useExpose as u };
|