@nutui/nutui 3.1.22 → 3.1.23-beta.2
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 +20643 -4214
- package/dist/nutui.umd.js +20750 -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 +113 -11
- package/dist/packages/_es/Cell.js +108 -21
- package/dist/packages/_es/CellGroup.js +44 -9
- package/dist/packages/_es/Checkbox.js +143 -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 +316 -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 +482 -129
- package/dist/packages/_es/Popover.js +957 -318
- package/dist/packages/_es/Popup.js +295 -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 +444 -121
- package/dist/packages/_es/SwiperItem.js +53 -22
- package/dist/packages/_es/Switch.js +124 -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/WaterMark.js +187 -0
- 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 +781 -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 +5 -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/packages/picker/index.scss +14 -0
- package/dist/packages/watermark/index.scss +13 -0
- package/dist/smartips/attributes.json +68 -0
- package/dist/smartips/tags.json +23 -2
- package/dist/smartips/web-types.json +161 -1
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/themes/default.scss +51 -50
- package/dist/styles/themes/jdb.scss +51 -50
- package/dist/styles/themes/jdt.scss +51 -50
- package/dist/styles/variables-jdb.scss +3 -1
- package/dist/styles/variables-jdt.scss +3 -1
- package/dist/styles/variables.scss +4 -1
- 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/categorypane/index.vue.d.ts +1 -1
- 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/collapse/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 +2 -1
- package/dist/types/__VUE/picker/index.vue.d.ts +7 -6
- package/dist/types/__VUE/popover/index.vue.d.ts +8 -8
- package/dist/types/__VUE/popup/index.vue.d.ts +8 -8
- 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 +9 -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/__VUE/watermark/index.vue.d.ts +143 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/nutui.d.ts +2 -1
- package/package.json +8 -3
|
@@ -1,81 +1,339 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.2 Thu Jul 07 2022 19:06:52 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 { _ as
|
|
6
|
+
import { reactive, ref, computed, watch, nextTick, onMounted, toRefs, openBlock, createElementBlock, createElementVNode, createCommentVNode, withDirectives, vShow, normalizeClass, toDisplayString, normalizeStyle, withModifiers } 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
|
-
|
|
10
|
+
const { create, translate } = createComponent("video");
|
|
11
|
+
const _sfc_main = create({
|
|
12
|
+
props: {
|
|
13
|
+
source: {
|
|
14
|
+
type: Object,
|
|
15
|
+
default: {}
|
|
16
|
+
},
|
|
17
|
+
options: {
|
|
18
|
+
type: Object,
|
|
19
|
+
default: {
|
|
20
|
+
autoplay: false,
|
|
21
|
+
volume: 0.5,
|
|
22
|
+
poster: "",
|
|
23
|
+
loop: false,
|
|
24
|
+
controls: true,
|
|
25
|
+
muted: false,
|
|
26
|
+
disabled: false,
|
|
27
|
+
playsinline: false,
|
|
28
|
+
touchPlay: false,
|
|
29
|
+
preload: ""
|
|
30
|
+
},
|
|
31
|
+
required: true
|
|
32
|
+
},
|
|
33
|
+
model: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: ""
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
components: {},
|
|
39
|
+
emits: ["click", "play", "pause", "playend"],
|
|
40
|
+
setup(props, { emit }) {
|
|
41
|
+
const state = reactive({
|
|
42
|
+
videoElm: null,
|
|
43
|
+
initial: true,
|
|
44
|
+
showToolbox: false,
|
|
45
|
+
player: {
|
|
46
|
+
$player: null,
|
|
47
|
+
pos: null
|
|
48
|
+
},
|
|
49
|
+
progressBar: {
|
|
50
|
+
progressElm: null,
|
|
51
|
+
pos: null
|
|
52
|
+
},
|
|
53
|
+
videoSet: {
|
|
54
|
+
loaded: 0,
|
|
55
|
+
displayTime: "00:00",
|
|
56
|
+
totalTime: "00:00",
|
|
57
|
+
progress: {
|
|
58
|
+
width: 0,
|
|
59
|
+
current: 0
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
state: {
|
|
63
|
+
controlShow: true,
|
|
64
|
+
vol: 0.5,
|
|
65
|
+
currentTime: 0,
|
|
66
|
+
fullScreen: false,
|
|
67
|
+
playing: false,
|
|
68
|
+
isLoading: false,
|
|
69
|
+
isEnd: false,
|
|
70
|
+
isError: false,
|
|
71
|
+
isMuted: false
|
|
72
|
+
},
|
|
73
|
+
showTouchMask: false
|
|
74
|
+
});
|
|
75
|
+
const root = ref(null);
|
|
76
|
+
const isDisabled = computed(() => {
|
|
77
|
+
return props.options.disabled;
|
|
15
78
|
});
|
|
16
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
79
|
+
watch(() => props.source, (newValue) => {
|
|
80
|
+
if (newValue.src) {
|
|
81
|
+
nextTick(() => {
|
|
82
|
+
state.videoElm.load();
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
watch(() => props.options, (newValue) => {
|
|
87
|
+
state.state.isMuted = newValue ? newValue.muted : false;
|
|
88
|
+
}, { immediate: true });
|
|
89
|
+
const init = () => {
|
|
90
|
+
state.videoElm = root.value;
|
|
91
|
+
if (props.options.autoplay) {
|
|
92
|
+
setTimeout(() => {
|
|
93
|
+
state.videoElm.play();
|
|
94
|
+
}, 200);
|
|
95
|
+
}
|
|
96
|
+
if (props.options.touchPlay) {
|
|
97
|
+
state.showTouchMask = true;
|
|
98
|
+
}
|
|
99
|
+
if (props.options.playsinline) {
|
|
100
|
+
state.videoElm.setAttribute("playsinline", props.options.playsinline);
|
|
101
|
+
state.videoElm.setAttribute("webkit-playsinline", props.options.playsinline);
|
|
102
|
+
state.videoElm.setAttribute("x5-video-player-type", "h5-page");
|
|
103
|
+
state.videoElm.setAttribute("x5-video-player-fullscreen", false);
|
|
104
|
+
}
|
|
105
|
+
volumeHandle();
|
|
106
|
+
if (state.showToolbox) {
|
|
107
|
+
customerInit();
|
|
108
|
+
} else {
|
|
109
|
+
state.videoElm.addEventListener("play", () => {
|
|
110
|
+
state.state.playing = true;
|
|
111
|
+
emit("play", state.videoElm);
|
|
112
|
+
});
|
|
113
|
+
state.videoElm.addEventListener("pause", () => {
|
|
114
|
+
state.state.playing = false;
|
|
115
|
+
emit("pause", state.videoElm);
|
|
116
|
+
});
|
|
117
|
+
state.videoElm.addEventListener("ended", playEnded);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
const customerInit = () => {
|
|
121
|
+
const $player = root.value;
|
|
122
|
+
const $progress = root.value.getElementsByClassName("progress")[0];
|
|
123
|
+
state.player.$player = $player;
|
|
124
|
+
state.progressBar.progressElm = $progress;
|
|
125
|
+
state.progressBar.pos = $progress.getBoundingClientRect();
|
|
126
|
+
state.videoSet.progress.width = Math.round($progress.getBoundingClientRect().width);
|
|
127
|
+
};
|
|
128
|
+
const play = () => {
|
|
129
|
+
if (props.options.autoplay && props.options.disabled) {
|
|
130
|
+
state.state.playing = true;
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
state.state.playing = !state.state.playing;
|
|
134
|
+
if (state.videoElm) {
|
|
135
|
+
if (state.state.playing) {
|
|
136
|
+
try {
|
|
137
|
+
setTimeout(() => {
|
|
138
|
+
state.videoElm.play();
|
|
139
|
+
}, 200);
|
|
140
|
+
state.videoElm.addEventListener("progress", () => {
|
|
141
|
+
getLoadTime();
|
|
142
|
+
});
|
|
143
|
+
state.videoElm.addEventListener("ended", playEnded);
|
|
144
|
+
emit("play", state.videoElm);
|
|
145
|
+
} catch (e) {
|
|
146
|
+
handleError();
|
|
147
|
+
}
|
|
148
|
+
} else {
|
|
149
|
+
state.videoElm.pause();
|
|
150
|
+
emit("pause", state.videoElm);
|
|
56
151
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
const getLoadTime = () => {
|
|
155
|
+
if (state.videoSet.loaded)
|
|
156
|
+
state.videoSet.loaded = state.videoElm.buffered.end(0) / state.videoElm.duration * 100;
|
|
157
|
+
};
|
|
158
|
+
const playEnded = () => {
|
|
159
|
+
state.state.playing = false;
|
|
160
|
+
state.state.isEnd = true;
|
|
161
|
+
state.videoSet.displayTime = "00:00";
|
|
162
|
+
state.videoSet.progress.current = 0;
|
|
163
|
+
state.videoElm.currentTime = 0;
|
|
164
|
+
emit("playend", state.videoElm);
|
|
165
|
+
};
|
|
166
|
+
const handleError = () => {
|
|
167
|
+
state.state.isError = true;
|
|
168
|
+
};
|
|
169
|
+
const volumeHandle = () => {
|
|
170
|
+
state.state.vol = props.options.volume;
|
|
171
|
+
};
|
|
172
|
+
const handleMuted = () => {
|
|
173
|
+
state.state.isMuted = !state.state.isMuted;
|
|
174
|
+
state.videoElm.muted = state.state.isMuted;
|
|
175
|
+
};
|
|
176
|
+
const touchSlidSrart = () => {
|
|
177
|
+
};
|
|
178
|
+
const touchSlidMove = (e) => {
|
|
179
|
+
let currentX = e.targetTouches[0].pageX;
|
|
180
|
+
let offsetX = currentX - state.progressBar.pos.left;
|
|
181
|
+
if (offsetX <= 0) {
|
|
182
|
+
offsetX = 0;
|
|
183
|
+
}
|
|
184
|
+
if (offsetX >= state.videoSet.progress.width) {
|
|
185
|
+
offsetX = state.videoSet.progress.width;
|
|
186
|
+
}
|
|
187
|
+
state.videoSet.progress.current = offsetX;
|
|
188
|
+
let percent = state.videoSet.progress.current / state.videoSet.progress.width;
|
|
189
|
+
state.videoElm.duration && setPlayTime(percent, state.videoElm.duration);
|
|
190
|
+
};
|
|
191
|
+
const touchSlidEnd = (e) => {
|
|
192
|
+
let currentX = e.changedTouches[0].pageX;
|
|
193
|
+
let offsetX = currentX - state.progressBar.pos.left;
|
|
194
|
+
state.videoSet.progress.current = offsetX;
|
|
195
|
+
let percent = offsetX / state.videoSet.progress.width;
|
|
196
|
+
state.videoElm.duration && setPlayTime(percent, state.videoElm.duration);
|
|
197
|
+
};
|
|
198
|
+
const setPlayTime = (percent, totalTime) => {
|
|
199
|
+
state.videoElm.currentTime = Math.floor(percent * totalTime);
|
|
200
|
+
};
|
|
201
|
+
const retry = () => {
|
|
202
|
+
state.state.isError = false;
|
|
203
|
+
init();
|
|
204
|
+
};
|
|
205
|
+
const fullScreen = () => {
|
|
206
|
+
if (!state.state.fullScreen) {
|
|
207
|
+
state.state.fullScreen = true;
|
|
208
|
+
state.videoElm.webkitRequestFullScreen();
|
|
209
|
+
} else {
|
|
210
|
+
state.state.fullScreen = false;
|
|
211
|
+
document.webkitCancelFullScreen();
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
onMounted(() => {
|
|
215
|
+
init();
|
|
216
|
+
});
|
|
217
|
+
return {
|
|
218
|
+
root,
|
|
219
|
+
...toRefs(props),
|
|
220
|
+
...toRefs(state),
|
|
221
|
+
handleError,
|
|
222
|
+
isDisabled,
|
|
223
|
+
play,
|
|
224
|
+
handleMuted,
|
|
225
|
+
touchSlidSrart,
|
|
226
|
+
touchSlidMove,
|
|
227
|
+
touchSlidEnd,
|
|
228
|
+
retry,
|
|
229
|
+
fullScreen,
|
|
230
|
+
translate
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
const _hoisted_1 = {
|
|
235
|
+
class: "nut-video",
|
|
236
|
+
ref: "videocon"
|
|
237
|
+
};
|
|
238
|
+
const _hoisted_2 = ["muted", "autoplay", "loop", "poster", "controls", "preload"];
|
|
239
|
+
const _hoisted_3 = ["src", "type"];
|
|
240
|
+
const _hoisted_4 = { class: "current-time" };
|
|
241
|
+
const _hoisted_5 = { class: "progress-container" };
|
|
242
|
+
const _hoisted_6 = {
|
|
243
|
+
class: "progress",
|
|
244
|
+
ref: "progressBar"
|
|
245
|
+
};
|
|
246
|
+
const _hoisted_7 = /* @__PURE__ */ createElementVNode("div", { class: "move-handle" }, null, -1);
|
|
247
|
+
const _hoisted_8 = [
|
|
248
|
+
_hoisted_7
|
|
249
|
+
];
|
|
250
|
+
const _hoisted_9 = {
|
|
251
|
+
class: "played",
|
|
252
|
+
ref: "playedBar"
|
|
253
|
+
};
|
|
254
|
+
const _hoisted_10 = { class: "duration-time" };
|
|
255
|
+
const _hoisted_11 = { class: "nut-video-error" };
|
|
256
|
+
const _hoisted_12 = { class: "lose" };
|
|
257
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
258
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
259
|
+
createElementVNode("video", {
|
|
260
|
+
ref: "root",
|
|
261
|
+
class: "nut-video-player",
|
|
262
|
+
muted: _ctx.options.muted,
|
|
263
|
+
autoplay: _ctx.options.autoplay,
|
|
264
|
+
loop: _ctx.options.loop,
|
|
265
|
+
poster: _ctx.options.poster,
|
|
266
|
+
controls: _ctx.options.controls,
|
|
267
|
+
preload: _ctx.options.preload,
|
|
268
|
+
onError: _cache[0] || (_cache[0] = (...args) => _ctx.handleError && _ctx.handleError(...args))
|
|
269
|
+
}, [
|
|
270
|
+
createElementVNode("source", {
|
|
271
|
+
src: _ctx.source.src,
|
|
272
|
+
type: _ctx.source.type
|
|
273
|
+
}, null, 8, _hoisted_3)
|
|
274
|
+
], 40, _hoisted_2),
|
|
275
|
+
_ctx.showToolbox && !_ctx.isDisabled ? (openBlock(), createElementBlock("div", {
|
|
276
|
+
key: 0,
|
|
277
|
+
class: "playing-mask",
|
|
278
|
+
ref: "touchMask",
|
|
279
|
+
onClick: _cache[1] || (_cache[1] = (...args) => _ctx.play && _ctx.play(...args))
|
|
280
|
+
}, null, 512)) : createCommentVNode("", true),
|
|
281
|
+
_ctx.showToolbox && !_ctx.isDisabled ? withDirectives((openBlock(), createElementBlock("div", {
|
|
282
|
+
key: 1,
|
|
283
|
+
class: "nut-video-play-btn",
|
|
284
|
+
ref: "palyBtn",
|
|
285
|
+
onClick: _cache[2] || (_cache[2] = (...args) => _ctx.play && _ctx.play(...args))
|
|
286
|
+
}, null, 512)), [
|
|
287
|
+
[vShow, !_ctx.state.playing]
|
|
288
|
+
]) : createCommentVNode("", true),
|
|
289
|
+
withDirectives(createElementVNode("div", {
|
|
290
|
+
class: normalizeClass(["nut-video-controller", { "show-control": !_ctx.state.playing, "hide-control": _ctx.state.playing }])
|
|
291
|
+
}, [
|
|
292
|
+
createElementVNode("div", {
|
|
293
|
+
class: "control-play-btn",
|
|
294
|
+
onClick: _cache[3] || (_cache[3] = (...args) => _ctx.play && _ctx.play(...args))
|
|
295
|
+
}),
|
|
296
|
+
createElementVNode("div", _hoisted_4, toDisplayString(_ctx.videoSet.displayTime), 1),
|
|
297
|
+
createElementVNode("div", _hoisted_5, [
|
|
298
|
+
createElementVNode("div", _hoisted_6, [
|
|
299
|
+
createElementVNode("div", {
|
|
300
|
+
class: "buffered",
|
|
301
|
+
style: normalizeStyle({ width: `${_ctx.videoSet.loaded}%` })
|
|
302
|
+
}, null, 4),
|
|
303
|
+
createElementVNode("div", {
|
|
304
|
+
class: "video-ball",
|
|
305
|
+
style: normalizeStyle({
|
|
306
|
+
transform: `translate3d(${_ctx.videoSet.progress.current}px, -50%, 0)`
|
|
307
|
+
}),
|
|
308
|
+
onTouchmove: _cache[4] || (_cache[4] = withModifiers(($event) => _ctx.touchSlidMove($event), ["stop", "prevent"])),
|
|
309
|
+
onTouchstart: _cache[5] || (_cache[5] = withModifiers(($event) => _ctx.touchSlidSrart($event), ["stop"])),
|
|
310
|
+
onTouchend: _cache[6] || (_cache[6] = withModifiers(($event) => _ctx.touchSlidEnd($event), ["stop"]))
|
|
311
|
+
}, _hoisted_8, 36),
|
|
312
|
+
createElementVNode("div", _hoisted_9, null, 512)
|
|
313
|
+
], 512)
|
|
314
|
+
]),
|
|
315
|
+
createElementVNode("div", _hoisted_10, toDisplayString(_ctx.videoSet.totalTime), 1),
|
|
316
|
+
createElementVNode("div", {
|
|
317
|
+
class: normalizeClass(["volume", { muted: _ctx.state.isMuted }]),
|
|
318
|
+
onClick: _cache[7] || (_cache[7] = (...args) => _ctx.handleMuted && _ctx.handleMuted(...args))
|
|
319
|
+
}, null, 2),
|
|
320
|
+
createElementVNode("div", {
|
|
321
|
+
class: "fullscreen-icon",
|
|
322
|
+
onClick: _cache[8] || (_cache[8] = (...args) => _ctx.fullScreen && _ctx.fullScreen(...args))
|
|
323
|
+
})
|
|
324
|
+
], 2), [
|
|
325
|
+
[vShow, _ctx.showToolbox && !_ctx.isDisabled]
|
|
326
|
+
]),
|
|
327
|
+
withDirectives(createElementVNode("div", _hoisted_11, [
|
|
328
|
+
createElementVNode("p", _hoisted_12, toDisplayString(_ctx.translate("errorTip")), 1),
|
|
329
|
+
createElementVNode("p", {
|
|
330
|
+
class: "retry",
|
|
331
|
+
onClick: _cache[9] || (_cache[9] = (...args) => _ctx.retry && _ctx.retry(...args))
|
|
332
|
+
}, toDisplayString(_ctx.translate("clickRetry")), 1)
|
|
333
|
+
], 512), [
|
|
334
|
+
[vShow, _ctx.state.isError]
|
|
335
|
+
])
|
|
336
|
+
], 512);
|
|
337
|
+
}
|
|
338
|
+
var Video = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
339
|
+
export { Video as default };
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @nutui/nutui v3.1.23-beta.2 Thu Jul 07 2022 19:06:52 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2022 @jdf2e.
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import { reactive, watch, computed, toRefs, openBlock, createElementBlock, normalizeClass, normalizeStyle } from "vue";
|
|
7
|
+
import { c as createComponent } from "./component.js";
|
|
8
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
9
|
+
import "../locale/lang";
|
|
10
|
+
const { componentName, create } = createComponent("watermark");
|
|
11
|
+
const _sfc_main = create({
|
|
12
|
+
props: {
|
|
13
|
+
name: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: ""
|
|
16
|
+
},
|
|
17
|
+
gapY: {
|
|
18
|
+
type: Number,
|
|
19
|
+
default: 48
|
|
20
|
+
},
|
|
21
|
+
gapX: {
|
|
22
|
+
type: Number,
|
|
23
|
+
default: 24
|
|
24
|
+
},
|
|
25
|
+
zIndex: {
|
|
26
|
+
type: Number,
|
|
27
|
+
default: 2e3
|
|
28
|
+
},
|
|
29
|
+
width: {
|
|
30
|
+
type: Number,
|
|
31
|
+
default: 120
|
|
32
|
+
},
|
|
33
|
+
height: {
|
|
34
|
+
type: Number,
|
|
35
|
+
default: 64
|
|
36
|
+
},
|
|
37
|
+
rotate: {
|
|
38
|
+
type: Number,
|
|
39
|
+
default: -22
|
|
40
|
+
},
|
|
41
|
+
image: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: ""
|
|
44
|
+
},
|
|
45
|
+
imageWidth: {
|
|
46
|
+
type: Number,
|
|
47
|
+
default: 120
|
|
48
|
+
},
|
|
49
|
+
imageHeight: {
|
|
50
|
+
type: Number,
|
|
51
|
+
default: 64
|
|
52
|
+
},
|
|
53
|
+
content: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: ""
|
|
56
|
+
},
|
|
57
|
+
fontColor: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: "rgba(0,0,0,.15)"
|
|
60
|
+
},
|
|
61
|
+
fontStyle: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: "normal"
|
|
64
|
+
},
|
|
65
|
+
fontFamily: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: "PingFang SC"
|
|
68
|
+
},
|
|
69
|
+
fontWeight: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: "normal"
|
|
72
|
+
},
|
|
73
|
+
fontSize: {
|
|
74
|
+
type: [String, Number],
|
|
75
|
+
default: 14
|
|
76
|
+
},
|
|
77
|
+
fullPage: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
default: ""
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
emits: ["click"],
|
|
83
|
+
setup(props, { emit }) {
|
|
84
|
+
const state = reactive({
|
|
85
|
+
base64Url: ""
|
|
86
|
+
});
|
|
87
|
+
const {
|
|
88
|
+
zIndex,
|
|
89
|
+
gapX,
|
|
90
|
+
gapY,
|
|
91
|
+
width,
|
|
92
|
+
height,
|
|
93
|
+
rotate,
|
|
94
|
+
image,
|
|
95
|
+
imageWidth,
|
|
96
|
+
imageHeight,
|
|
97
|
+
content,
|
|
98
|
+
fontStyle,
|
|
99
|
+
fontWeight,
|
|
100
|
+
fontColor,
|
|
101
|
+
fontSize,
|
|
102
|
+
fontFamily
|
|
103
|
+
} = props;
|
|
104
|
+
const init = () => {
|
|
105
|
+
const canvas = document.createElement("canvas");
|
|
106
|
+
const ratio = window.devicePixelRatio;
|
|
107
|
+
console.log(ratio);
|
|
108
|
+
const ctx = canvas.getContext("2d");
|
|
109
|
+
const canvasWidth = `${(gapX + width) * ratio}px`;
|
|
110
|
+
const canvasHeight = `${(gapY + height) * ratio}px`;
|
|
111
|
+
const markWidth = width * ratio;
|
|
112
|
+
const markHeight = height * ratio;
|
|
113
|
+
canvas.setAttribute("width", canvasWidth);
|
|
114
|
+
canvas.setAttribute("height", canvasHeight);
|
|
115
|
+
if (ctx) {
|
|
116
|
+
if (image) {
|
|
117
|
+
ctx.translate(markWidth / 2, markHeight / 2);
|
|
118
|
+
ctx.rotate(Math.PI / 180 * Number(rotate));
|
|
119
|
+
const img = new Image();
|
|
120
|
+
img.crossOrigin = "anonymous";
|
|
121
|
+
img.referrerPolicy = "no-referrer";
|
|
122
|
+
img.src = image;
|
|
123
|
+
img.onload = () => {
|
|
124
|
+
ctx.drawImage(img, -imageWidth * ratio / 2, -imageHeight * ratio / 2, imageWidth * ratio, imageHeight * ratio);
|
|
125
|
+
ctx.restore();
|
|
126
|
+
state.base64Url = canvas.toDataURL();
|
|
127
|
+
console.log(state.base64Url);
|
|
128
|
+
};
|
|
129
|
+
} else if (content) {
|
|
130
|
+
ctx.textBaseline = "middle";
|
|
131
|
+
ctx.textAlign = "center";
|
|
132
|
+
ctx.translate(markWidth / 2, markHeight / 2);
|
|
133
|
+
ctx.rotate(Math.PI / 180 * Number(rotate));
|
|
134
|
+
const markSize = Number(fontSize) * ratio;
|
|
135
|
+
ctx.font = `${fontStyle} normal ${fontWeight} ${markSize}px/${markHeight}px ${fontFamily}`;
|
|
136
|
+
ctx.fillStyle = fontColor;
|
|
137
|
+
ctx.fillText(content, 0, 0);
|
|
138
|
+
ctx.restore();
|
|
139
|
+
state.base64Url = canvas.toDataURL();
|
|
140
|
+
console.log(state.base64Url);
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
throw new Error("\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301Canvas");
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
init();
|
|
147
|
+
watch(() => [
|
|
148
|
+
zIndex,
|
|
149
|
+
gapX,
|
|
150
|
+
gapY,
|
|
151
|
+
width,
|
|
152
|
+
height,
|
|
153
|
+
rotate,
|
|
154
|
+
image,
|
|
155
|
+
imageWidth,
|
|
156
|
+
imageHeight,
|
|
157
|
+
content,
|
|
158
|
+
fontStyle,
|
|
159
|
+
fontWeight,
|
|
160
|
+
fontColor,
|
|
161
|
+
fontSize,
|
|
162
|
+
fontFamily
|
|
163
|
+
], () => {
|
|
164
|
+
init();
|
|
165
|
+
});
|
|
166
|
+
const classes = computed(() => {
|
|
167
|
+
const prefixCls = componentName;
|
|
168
|
+
return {
|
|
169
|
+
[prefixCls]: true,
|
|
170
|
+
[`${prefixCls}-full-page`]: props.fullPage
|
|
171
|
+
};
|
|
172
|
+
});
|
|
173
|
+
return { ...toRefs(state), classes };
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
177
|
+
return openBlock(), createElementBlock("view", {
|
|
178
|
+
class: normalizeClass(_ctx.classes),
|
|
179
|
+
style: normalizeStyle({
|
|
180
|
+
zIndex: _ctx.zIndex,
|
|
181
|
+
backgroundSize: `${_ctx.gapX + _ctx.width}px`,
|
|
182
|
+
backgroundImage: `url('${_ctx.base64Url}')`
|
|
183
|
+
})
|
|
184
|
+
}, null, 6);
|
|
185
|
+
}
|
|
186
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
187
|
+
export { index as default };
|