@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.
Files changed (186) hide show
  1. package/dist/nutui.es.js +20643 -4214
  2. package/dist/nutui.umd.js +20750 -4216
  3. package/dist/packages/_es/ActionSheet.js +149 -17
  4. package/dist/packages/_es/Address.js +535 -110
  5. package/dist/packages/_es/AddressList.js +615 -113
  6. package/dist/packages/_es/Animate.js +59 -17
  7. package/dist/packages/_es/Audio.js +257 -53
  8. package/dist/packages/_es/AudioOperate.js +100 -13
  9. package/dist/packages/_es/Avatar.js +162 -38
  10. package/dist/packages/_es/AvatarGroup.js +73 -14
  11. package/dist/packages/_es/BackTop.js +156 -43
  12. package/dist/packages/_es/Badge.js +86 -14
  13. package/dist/packages/_es/Barrage.js +120 -41
  14. package/dist/packages/_es/Button.js +128 -23
  15. package/dist/packages/_es/Calendar.js +246 -30
  16. package/dist/packages/_es/CalendarItem.js +1 -1
  17. package/dist/packages/_es/Card.js +107 -10
  18. package/dist/packages/_es/Cascader.js +496 -147
  19. package/dist/packages/_es/Category.js +58 -15
  20. package/dist/packages/_es/CategoryPane.js +113 -11
  21. package/dist/packages/_es/Cell.js +108 -21
  22. package/dist/packages/_es/CellGroup.js +44 -9
  23. package/dist/packages/_es/Checkbox.js +143 -29
  24. package/dist/packages/_es/CheckboxGroup.js +79 -29
  25. package/dist/packages/_es/CircleProgress.js +150 -28
  26. package/dist/packages/_es/Col.js +56 -14
  27. package/dist/packages/_es/Collapse.js +109 -32
  28. package/dist/packages/_es/CollapseItem.js +253 -59
  29. package/dist/packages/_es/Comment.js +434 -64
  30. package/dist/packages/_es/ConfigProvider.js +20 -8
  31. package/dist/packages/_es/CountDown.js +238 -56
  32. package/dist/packages/_es/CountUp.js +539 -140
  33. package/dist/packages/_es/DatePicker.js +316 -98
  34. package/dist/packages/_es/Dialog.js +289 -60
  35. package/dist/packages/_es/Divider.js +65 -13
  36. package/dist/packages/_es/Drag.js +197 -56
  37. package/dist/packages/_es/Ecard.js +159 -24
  38. package/dist/packages/_es/Elevator.js +255 -58
  39. package/dist/packages/_es/Ellipsis.js +200 -58
  40. package/dist/packages/_es/Empty.js +71 -12
  41. package/dist/packages/_es/FixedNav.js +122 -15
  42. package/dist/packages/_es/Form.js +151 -64
  43. package/dist/packages/_es/FormItem.js +114 -15
  44. package/dist/packages/_es/Grid.js +6 -5
  45. package/dist/packages/_es/GridItem.js +144 -33
  46. package/dist/packages/_es/Icon.js +40 -15
  47. package/dist/packages/_es/Image.js +137 -26
  48. package/dist/packages/_es/ImagePreview.js +547 -76
  49. package/dist/packages/_es/Indicator.js +62 -15
  50. package/dist/packages/_es/InfiniteLoading.js +249 -57
  51. package/dist/packages/_es/Input.js +433 -51
  52. package/dist/packages/_es/InputNumber.js +160 -41
  53. package/dist/packages/_es/Layout.js +5 -4
  54. package/dist/packages/_es/List.js +106 -18
  55. package/dist/packages/_es/Menu.js +168 -44
  56. package/dist/packages/_es/MenuItem.js +173 -37
  57. package/dist/packages/_es/Navbar.js +192 -30
  58. package/dist/packages/_es/NoticeBar.js +380 -74
  59. package/dist/packages/_es/Notify.js +227 -72
  60. package/dist/packages/_es/NumberKeyboard.js +272 -41
  61. package/dist/packages/_es/OldPicker.js +457 -130
  62. package/dist/packages/_es/OverLay.js +98 -24
  63. package/dist/packages/_es/Pagination.js +157 -39
  64. package/dist/packages/_es/Picker.js +482 -129
  65. package/dist/packages/_es/Popover.js +957 -318
  66. package/dist/packages/_es/Popup.js +295 -55
  67. package/dist/packages/_es/Price.js +118 -16
  68. package/dist/packages/_es/Progress.js +146 -14
  69. package/dist/packages/_es/PullRefresh.js +339 -84
  70. package/dist/packages/_es/Radio.js +90 -22
  71. package/dist/packages/_es/RadioGroup.js +37 -8
  72. package/dist/packages/_es/Range.js +408 -83
  73. package/dist/packages/_es/Rate.js +192 -36
  74. package/dist/packages/_es/Row.js +64 -22
  75. package/dist/packages/_es/SearchBar.js +238 -37
  76. package/dist/packages/_es/ShortPassword.js +225 -35
  77. package/dist/packages/_es/SideNavBar.js +81 -24
  78. package/dist/packages/_es/SideNavBarItem.js +46 -11
  79. package/dist/packages/_es/Signature.js +160 -41
  80. package/dist/packages/_es/Skeleton.js +136 -20
  81. package/dist/packages/_es/Sku.js +491 -84
  82. package/dist/packages/_es/Step.js +115 -20
  83. package/dist/packages/_es/Steps.js +53 -18
  84. package/dist/packages/_es/Sticky.js +138 -53
  85. package/dist/packages/_es/SubSideNavBar.js +82 -17
  86. package/dist/packages/_es/Swipe.js +178 -41
  87. package/dist/packages/_es/Swiper.js +444 -121
  88. package/dist/packages/_es/SwiperItem.js +53 -22
  89. package/dist/packages/_es/Switch.js +124 -21
  90. package/dist/packages/_es/TabPane.js +39 -12
  91. package/dist/packages/_es/Tabbar.js +72 -17
  92. package/dist/packages/_es/TabbarItem.js +151 -29
  93. package/dist/packages/_es/Table.js +178 -18
  94. package/dist/packages/_es/Tabs.js +202 -43
  95. package/dist/packages/_es/Tag.js +97 -20
  96. package/dist/packages/_es/TextArea.js +160 -42
  97. package/dist/packages/_es/TimeDetail.js +79 -18
  98. package/dist/packages/_es/TimePannel.js +48 -14
  99. package/dist/packages/_es/TimeSelect.js +112 -15
  100. package/dist/packages/_es/Toast.js +310 -71
  101. package/dist/packages/_es/Uploader.js +455 -104
  102. package/dist/packages/_es/Video.js +332 -74
  103. package/dist/packages/_es/WaterMark.js +187 -0
  104. package/dist/packages/_es/common.js +128 -38
  105. package/dist/packages/_es/component.js +76 -35
  106. package/dist/packages/_es/index.js +6 -5
  107. package/dist/packages/_es/index2.js +30 -9
  108. package/dist/packages/_es/index3.js +8 -6
  109. package/dist/packages/_es/index4.js +64 -13
  110. package/dist/packages/_es/index5.js +781 -164
  111. package/dist/packages/_es/plugin-vue_export-helper.js +8 -7
  112. package/dist/packages/_es/pxCheck.js +5 -3
  113. package/dist/packages/_es/raf.js +15 -8
  114. package/dist/packages/imagepreview/index.scss +5 -1
  115. package/dist/packages/locale/lang/baseLang.js +3 -3
  116. package/dist/packages/locale/lang/en-US.js +105 -5
  117. package/dist/packages/locale/lang/id-ID.js +105 -5
  118. package/dist/packages/locale/lang/index.js +38 -16
  119. package/dist/packages/locale/lang/zh-CN.js +105 -5
  120. package/dist/packages/locale/lang/zh-TW.js +105 -5
  121. package/dist/packages/picker/index.scss +14 -0
  122. package/dist/packages/watermark/index.scss +13 -0
  123. package/dist/smartips/attributes.json +68 -0
  124. package/dist/smartips/tags.json +23 -2
  125. package/dist/smartips/web-types.json +161 -1
  126. package/dist/style.css +1 -1
  127. package/dist/style.es.js +1 -1
  128. package/dist/styles/themes/default.scss +51 -50
  129. package/dist/styles/themes/jdb.scss +51 -50
  130. package/dist/styles/themes/jdt.scss +51 -50
  131. package/dist/styles/variables-jdb.scss +3 -1
  132. package/dist/styles/variables-jdt.scss +3 -1
  133. package/dist/styles/variables.scss +4 -1
  134. package/dist/types/__VUE/actionsheet/index.vue.d.ts +5 -5
  135. package/dist/types/__VUE/address/index.vue.d.ts +7 -7
  136. package/dist/types/__VUE/avatar/index.vue.d.ts +4 -4
  137. package/dist/types/__VUE/avatargroup/index.vue.d.ts +2 -2
  138. package/dist/types/__VUE/backtop/index.vue.d.ts +2 -2
  139. package/dist/types/__VUE/badge/index.vue.d.ts +2 -2
  140. package/dist/types/__VUE/button/index.vue.d.ts +8 -8
  141. package/dist/types/__VUE/calendar/index.vue.d.ts +1 -1
  142. package/dist/types/__VUE/cascader/index.vue.d.ts +4 -4
  143. package/dist/types/__VUE/categorypane/index.vue.d.ts +1 -1
  144. package/dist/types/__VUE/cell/index.vue.d.ts +6 -6
  145. package/dist/types/__VUE/checkbox/index.vue.d.ts +2 -2
  146. package/dist/types/__VUE/collapse/index.vue.d.ts +2 -2
  147. package/dist/types/__VUE/collapseitem/index.vue.d.ts +2 -2
  148. package/dist/types/__VUE/comment/index.vue.d.ts +2 -2
  149. package/dist/types/__VUE/datepicker/index.vue.d.ts +4 -4
  150. package/dist/types/__VUE/dialog/index.vue.d.ts +4 -4
  151. package/dist/types/__VUE/fixednav/index.vue.d.ts +4 -4
  152. package/dist/types/__VUE/grid/index.vue.d.ts +4 -4
  153. package/dist/types/__VUE/image/index.vue.d.ts +4 -4
  154. package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +95 -0
  155. package/dist/types/__VUE/imagepreview/index.vue.d.ts +23 -25
  156. package/dist/types/__VUE/input/index.vue.d.ts +4 -4
  157. package/dist/types/__VUE/inputnumber/index.vue.d.ts +2 -2
  158. package/dist/types/__VUE/menu/index.vue.d.ts +2 -2
  159. package/dist/types/__VUE/menuitem/index.vue.d.ts +1 -1
  160. package/dist/types/__VUE/noticebar/index.vue.d.ts +3 -3
  161. package/dist/types/__VUE/notify/index.vue.d.ts +2 -2
  162. package/dist/types/__VUE/numberkeyboard/index.vue.d.ts +2 -2
  163. package/dist/types/__VUE/oldpicker/index.vue.d.ts +5 -5
  164. package/dist/types/__VUE/picker/Column.vue.d.ts +2 -1
  165. package/dist/types/__VUE/picker/index.vue.d.ts +7 -6
  166. package/dist/types/__VUE/popover/index.vue.d.ts +8 -8
  167. package/dist/types/__VUE/popup/index.vue.d.ts +8 -8
  168. package/dist/types/__VUE/radio/index.vue.d.ts +4 -4
  169. package/dist/types/__VUE/range/index.vue.d.ts +4 -4
  170. package/dist/types/__VUE/shortpassword/index.vue.d.ts +1 -1
  171. package/dist/types/__VUE/skeleton/index.vue.d.ts +4 -4
  172. package/dist/types/__VUE/sku/index.vue.d.ts +5 -5
  173. package/dist/types/__VUE/step/index.vue.d.ts +2 -2
  174. package/dist/types/__VUE/sticky/index.vue.d.ts +4 -4
  175. package/dist/types/__VUE/swipe/index.vue.d.ts +2 -2
  176. package/dist/types/__VUE/swiper/index.vue.d.ts +9 -2
  177. package/dist/types/__VUE/tabbar/index.vue.d.ts +2 -2
  178. package/dist/types/__VUE/tabbaritem/index.vue.d.ts +2 -2
  179. package/dist/types/__VUE/tag/index.vue.d.ts +2 -2
  180. package/dist/types/__VUE/timeselect/index.vue.d.ts +2 -2
  181. package/dist/types/__VUE/toast/index.vue.d.ts +4 -4
  182. package/dist/types/__VUE/uploader/index.vue.d.ts +4 -4
  183. package/dist/types/__VUE/watermark/index.vue.d.ts +143 -0
  184. package/dist/types/index.d.ts +1 -1
  185. package/dist/types/nutui.d.ts +2 -1
  186. package/package.json +8 -3
@@ -1,81 +1,339 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22 Fri Jun 24 2022 18:11:16 GMT+0800 (中国标准时间)
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 as e, ref as o, computed as t, watch as l, nextTick as s, onMounted as r, toRefs as i, openBlock as a, createElementBlock as d, createElementVNode as n, createCommentVNode as p, withDirectives as u, vShow as c, normalizeClass as v, toDisplayString as m, normalizeStyle as y, withModifiers as E } from "vue";
7
- import { c as g } from "./component.js";
8
- import { _ as h } from "./plugin-vue_export-helper.js";
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: S, translate: f } = g("video"), b = S({ props: { source: { type: Object, default: {} }, options: { type: Object, default: { autoplay: false, volume: 0.5, poster: "", loop: false, controls: true, muted: false, disabled: false, playsinline: false, touchPlay: false, preload: "" }, required: true }, model: { type: String, default: "" } }, components: {}, emits: ["click", "play", "pause", "playend"], setup(a2, { emit: d2 }) {
11
- const n2 = e({ videoElm: null, initial: true, showToolbox: false, player: { $player: null, pos: null }, progressBar: { progressElm: null, pos: null }, videoSet: { loaded: 0, displayTime: "00:00", totalTime: "00:00", progress: { width: 0, current: 0 } }, state: { controlShow: true, vol: 0.5, currentTime: 0, fullScreen: false, playing: false, isLoading: false, isEnd: false, isError: false, isMuted: false }, showTouchMask: false }), p2 = o(null), u2 = t(() => a2.options.disabled);
12
- l(() => a2.source, (e2) => {
13
- e2.src && s(() => {
14
- n2.videoElm.load();
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
- }), l(() => a2.options, (e2) => {
17
- n2.state.isMuted = !!e2 && e2.muted;
18
- }, { immediate: true });
19
- const c2 = () => {
20
- n2.videoElm = p2.value, a2.options.autoplay && setTimeout(() => {
21
- n2.videoElm.play();
22
- }, 200), a2.options.touchPlay && (n2.showTouchMask = true), a2.options.playsinline && (n2.videoElm.setAttribute("playsinline", a2.options.playsinline), n2.videoElm.setAttribute("webkit-playsinline", a2.options.playsinline), n2.videoElm.setAttribute("x5-video-player-type", "h5-page"), n2.videoElm.setAttribute("x5-video-player-fullscreen", false)), g2(), n2.showToolbox ? v2() : (n2.videoElm.addEventListener("play", () => {
23
- n2.state.playing = true, d2("play", n2.videoElm);
24
- }), n2.videoElm.addEventListener("pause", () => {
25
- n2.state.playing = false, d2("pause", n2.videoElm);
26
- }), n2.videoElm.addEventListener("ended", y2));
27
- }, v2 = () => {
28
- const e2 = p2.value, o2 = p2.value.getElementsByClassName("progress")[0];
29
- n2.player.$player = e2, n2.progressBar.progressElm = o2, n2.progressBar.pos = o2.getBoundingClientRect(), n2.videoSet.progress.width = Math.round(o2.getBoundingClientRect().width);
30
- }, m2 = () => {
31
- n2.videoSet.loaded && (n2.videoSet.loaded = n2.videoElm.buffered.end(0) / n2.videoElm.duration * 100);
32
- }, y2 = () => {
33
- n2.state.playing = false, n2.state.isEnd = true, n2.videoSet.displayTime = "00:00", n2.videoSet.progress.current = 0, n2.videoElm.currentTime = 0, d2("playend", n2.videoElm);
34
- }, E2 = () => {
35
- n2.state.isError = true;
36
- }, g2 = () => {
37
- n2.state.vol = a2.options.volume;
38
- }, h2 = (e2, o2) => {
39
- n2.videoElm.currentTime = Math.floor(e2 * o2);
40
- };
41
- return r(() => {
42
- c2();
43
- }), { root: p2, ...i(a2), ...i(n2), handleError: E2, isDisabled: u2, play: () => {
44
- if (a2.options.autoplay && a2.options.disabled)
45
- return n2.state.playing = true, false;
46
- if (n2.state.playing = !n2.state.playing, n2.videoElm)
47
- if (n2.state.playing)
48
- try {
49
- setTimeout(() => {
50
- n2.videoElm.play();
51
- }, 200), n2.videoElm.addEventListener("progress", () => {
52
- m2();
53
- }), n2.videoElm.addEventListener("ended", y2), d2("play", n2.videoElm);
54
- } catch (e2) {
55
- E2();
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
- else
58
- n2.videoElm.pause(), d2("pause", n2.videoElm);
59
- }, handleMuted: () => {
60
- n2.state.isMuted = !n2.state.isMuted, n2.videoElm.muted = n2.state.isMuted;
61
- }, touchSlidSrart: () => {
62
- }, touchSlidMove: (e2) => {
63
- let o2 = e2.targetTouches[0].pageX - n2.progressBar.pos.left;
64
- o2 <= 0 && (o2 = 0), o2 >= n2.videoSet.progress.width && (o2 = n2.videoSet.progress.width), n2.videoSet.progress.current = o2;
65
- let t2 = n2.videoSet.progress.current / n2.videoSet.progress.width;
66
- n2.videoElm.duration && h2(t2, n2.videoElm.duration);
67
- }, touchSlidEnd: (e2) => {
68
- let o2 = e2.changedTouches[0].pageX - n2.progressBar.pos.left;
69
- n2.videoSet.progress.current = o2;
70
- let t2 = o2 / n2.videoSet.progress.width;
71
- n2.videoElm.duration && h2(t2, n2.videoElm.duration);
72
- }, retry: () => {
73
- n2.state.isError = false, c2();
74
- }, fullScreen: () => {
75
- n2.state.fullScreen ? (n2.state.fullScreen = false, document.webkitCancelFullScreen()) : (n2.state.fullScreen = true, n2.videoElm.webkitRequestFullScreen());
76
- }, translate: f };
77
- } }), T = { class: "nut-video", ref: "videocon" }, w = ["muted", "autoplay", "loop", "poster", "controls", "preload"], k = ["src", "type"], M = { class: "current-time" }, B = { class: "progress-container" }, x = { class: "progress", ref: "progressBar" }, C = [n("div", { class: "move-handle" }, null, -1)], L = { class: "played", ref: "playedBar" }, j = { class: "duration-time" }, A = { class: "nut-video-error" }, D = { class: "lose" };
78
- var R = h(b, [["render", function(e2, o2, t2, l2, s2, r2) {
79
- return a(), d("div", T, [n("video", { ref: "root", class: "nut-video-player", muted: e2.options.muted, autoplay: e2.options.autoplay, loop: e2.options.loop, poster: e2.options.poster, controls: e2.options.controls, preload: e2.options.preload, onError: o2[0] || (o2[0] = (...o3) => e2.handleError && e2.handleError(...o3)) }, [n("source", { src: e2.source.src, type: e2.source.type }, null, 8, k)], 40, w), e2.showToolbox && !e2.isDisabled ? (a(), d("div", { key: 0, class: "playing-mask", ref: "touchMask", onClick: o2[1] || (o2[1] = (...o3) => e2.play && e2.play(...o3)) }, null, 512)) : p("", true), e2.showToolbox && !e2.isDisabled ? u((a(), d("div", { key: 1, class: "nut-video-play-btn", ref: "palyBtn", onClick: o2[2] || (o2[2] = (...o3) => e2.play && e2.play(...o3)) }, null, 512)), [[c, !e2.state.playing]]) : p("", true), u(n("div", { class: v(["nut-video-controller", { "show-control": !e2.state.playing, "hide-control": e2.state.playing }]) }, [n("div", { class: "control-play-btn", onClick: o2[3] || (o2[3] = (...o3) => e2.play && e2.play(...o3)) }), n("div", M, m(e2.videoSet.displayTime), 1), n("div", B, [n("div", x, [n("div", { class: "buffered", style: y({ width: `${e2.videoSet.loaded}%` }) }, null, 4), n("div", { class: "video-ball", style: y({ transform: `translate3d(${e2.videoSet.progress.current}px, -50%, 0)` }), onTouchmove: o2[4] || (o2[4] = E((o3) => e2.touchSlidMove(o3), ["stop", "prevent"])), onTouchstart: o2[5] || (o2[5] = E((o3) => e2.touchSlidSrart(o3), ["stop"])), onTouchend: o2[6] || (o2[6] = E((o3) => e2.touchSlidEnd(o3), ["stop"])) }, C, 36), n("div", L, null, 512)], 512)]), n("div", j, m(e2.videoSet.totalTime), 1), n("div", { class: v(["volume", { muted: e2.state.isMuted }]), onClick: o2[7] || (o2[7] = (...o3) => e2.handleMuted && e2.handleMuted(...o3)) }, null, 2), n("div", { class: "fullscreen-icon", onClick: o2[8] || (o2[8] = (...o3) => e2.fullScreen && e2.fullScreen(...o3)) })], 2), [[c, e2.showToolbox && !e2.isDisabled]]), u(n("div", A, [n("p", D, m(e2.translate("errorTip")), 1), n("p", { class: "retry", onClick: o2[9] || (o2[9] = (...o3) => e2.retry && e2.retry(...o3)) }, m(e2.translate("clickRetry")), 1)], 512), [[c, e2.state.isError]])], 512);
80
- }]]);
81
- export { R as default };
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 };