@nutui/nutui 3.1.22 → 3.1.23-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/dist/nutui.es.js +20418 -4214
  2. package/dist/nutui.umd.js +20524 -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 +111 -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 +134 -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 +315 -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 +460 -129
  65. package/dist/packages/_es/Popover.js +957 -318
  66. package/dist/packages/_es/Popup.js +299 -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 +433 -121
  88. package/dist/packages/_es/SwiperItem.js +53 -22
  89. package/dist/packages/_es/Switch.js +116 -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/common.js +128 -38
  104. package/dist/packages/_es/component.js +76 -35
  105. package/dist/packages/_es/index.js +6 -5
  106. package/dist/packages/_es/index2.js +30 -9
  107. package/dist/packages/_es/index3.js +8 -6
  108. package/dist/packages/_es/index4.js +64 -13
  109. package/dist/packages/_es/index5.js +780 -164
  110. package/dist/packages/_es/plugin-vue_export-helper.js +8 -7
  111. package/dist/packages/_es/pxCheck.js +5 -3
  112. package/dist/packages/_es/raf.js +15 -8
  113. package/dist/packages/imagepreview/index.scss +6 -1
  114. package/dist/packages/locale/lang/baseLang.js +3 -3
  115. package/dist/packages/locale/lang/en-US.js +105 -5
  116. package/dist/packages/locale/lang/id-ID.js +105 -5
  117. package/dist/packages/locale/lang/index.js +38 -16
  118. package/dist/packages/locale/lang/zh-CN.js +105 -5
  119. package/dist/packages/locale/lang/zh-TW.js +105 -5
  120. package/dist/smartips/attributes.json +8 -0
  121. package/dist/smartips/tags.json +3 -1
  122. package/dist/smartips/web-types.json +19 -1
  123. package/dist/style.css +1 -1
  124. package/dist/style.es.js +1 -1
  125. package/dist/styles/themes/default.scss +41 -41
  126. package/dist/styles/themes/jdb.scss +41 -41
  127. package/dist/styles/themes/jdt.scss +41 -41
  128. package/dist/types/__VUE/actionsheet/index.vue.d.ts +5 -5
  129. package/dist/types/__VUE/address/index.vue.d.ts +7 -7
  130. package/dist/types/__VUE/avatar/index.vue.d.ts +4 -4
  131. package/dist/types/__VUE/avatargroup/index.vue.d.ts +2 -2
  132. package/dist/types/__VUE/backtop/index.vue.d.ts +2 -2
  133. package/dist/types/__VUE/badge/index.vue.d.ts +2 -2
  134. package/dist/types/__VUE/button/index.vue.d.ts +8 -8
  135. package/dist/types/__VUE/calendar/index.vue.d.ts +1 -1
  136. package/dist/types/__VUE/cascader/index.vue.d.ts +4 -4
  137. package/dist/types/__VUE/cell/index.vue.d.ts +6 -6
  138. package/dist/types/__VUE/checkbox/index.vue.d.ts +2 -2
  139. package/dist/types/__VUE/collapseitem/index.vue.d.ts +2 -2
  140. package/dist/types/__VUE/comment/index.vue.d.ts +2 -2
  141. package/dist/types/__VUE/datepicker/index.vue.d.ts +4 -4
  142. package/dist/types/__VUE/dialog/index.vue.d.ts +4 -4
  143. package/dist/types/__VUE/fixednav/index.vue.d.ts +4 -4
  144. package/dist/types/__VUE/grid/index.vue.d.ts +4 -4
  145. package/dist/types/__VUE/image/index.vue.d.ts +4 -4
  146. package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +95 -0
  147. package/dist/types/__VUE/imagepreview/index.vue.d.ts +23 -25
  148. package/dist/types/__VUE/input/index.vue.d.ts +4 -4
  149. package/dist/types/__VUE/inputnumber/index.vue.d.ts +2 -2
  150. package/dist/types/__VUE/menu/index.vue.d.ts +2 -2
  151. package/dist/types/__VUE/menuitem/index.vue.d.ts +1 -1
  152. package/dist/types/__VUE/noticebar/index.vue.d.ts +3 -3
  153. package/dist/types/__VUE/notify/index.vue.d.ts +2 -2
  154. package/dist/types/__VUE/numberkeyboard/index.vue.d.ts +2 -2
  155. package/dist/types/__VUE/oldpicker/index.vue.d.ts +5 -5
  156. package/dist/types/__VUE/picker/Column.vue.d.ts +1 -1
  157. package/dist/types/__VUE/picker/index.vue.d.ts +6 -6
  158. package/dist/types/__VUE/popover/index.vue.d.ts +8 -8
  159. package/dist/types/__VUE/popup/index.vue.d.ts +6 -6
  160. package/dist/types/__VUE/radio/index.vue.d.ts +4 -4
  161. package/dist/types/__VUE/range/index.vue.d.ts +4 -4
  162. package/dist/types/__VUE/shortpassword/index.vue.d.ts +1 -1
  163. package/dist/types/__VUE/skeleton/index.vue.d.ts +4 -4
  164. package/dist/types/__VUE/sku/index.vue.d.ts +5 -5
  165. package/dist/types/__VUE/step/index.vue.d.ts +2 -2
  166. package/dist/types/__VUE/sticky/index.vue.d.ts +4 -4
  167. package/dist/types/__VUE/swipe/index.vue.d.ts +2 -2
  168. package/dist/types/__VUE/swiper/index.vue.d.ts +2 -2
  169. package/dist/types/__VUE/tabbar/index.vue.d.ts +2 -2
  170. package/dist/types/__VUE/tabbaritem/index.vue.d.ts +2 -2
  171. package/dist/types/__VUE/tag/index.vue.d.ts +2 -2
  172. package/dist/types/__VUE/timeselect/index.vue.d.ts +2 -2
  173. package/dist/types/__VUE/toast/index.vue.d.ts +4 -4
  174. package/dist/types/__VUE/uploader/index.vue.d.ts +4 -4
  175. package/dist/types/index.d.ts +1 -1
  176. package/package.json +1 -2
@@ -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.0 Mon Jun 27 2022 17:55:50 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { reactive 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 };
@@ -1,46 +1,136 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22 Fri Jun 24 2022 18:11:16 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.0 Mon Jun 27 2022 17:55:50 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { provide as e, shallowReactive as t, getCurrentInstance as r, markRaw as n, isVNode as o, computed as i, h as u } from "vue";
7
- import { c as l } from "./component.js";
8
- import { p as s } from "./pxCheck.js";
9
- function a(e2, t2, r2) {
10
- const n2 = function(e3, t3) {
11
- const r3 = [], n3 = (e4) => {
12
- Array.isArray(e4) && e4.forEach((e5) => {
13
- var _a;
14
- if (o(e5)) {
15
- if (t3) {
16
- if (e5.type && e5.type.name === t3)
17
- return void r3.push(e5);
18
- } else
19
- r3.push(e5);
20
- ((_a = e5.component) == null ? void 0 : _a.subTree) && n3(e5.component.subTree.children), e5.children && n3(e5.children);
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;
21
22
  }
22
- });
23
- };
24
- return n3(e3), r3;
25
- }(e2.subTree.children, r2);
26
- t2.sort((e3, t3) => n2.indexOf(e3.vnode) - n2.indexOf(t3.vnode));
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;
27
36
  }
28
- const { componentName: p } = l("grid"), c = Symbol("grid"), d = { props: { columnNum: { type: [Number, String], default: 4 }, iconSize: { type: [Number, String], default: 28 }, iconColor: { type: String }, border: { type: Boolean, default: true }, gutter: { type: [Number, String], default: 0 }, center: { type: Boolean, default: true }, square: { type: Boolean, default: false }, reverse: { type: Boolean, default: false }, direction: { type: String }, clickable: { type: Boolean, default: false } }, setup(o2, { slots: l2 }) {
29
- !function(o3, i2) {
30
- const u2 = t([]), l3 = r(), s2 = (e2) => {
31
- e2.proxy && (u2.push(n(e2)), a(l3, u2, i2));
32
- }, p2 = (e2) => {
33
- u2.splice(u2.indexOf(n(e2)), 1);
34
- }, c2 = Object.assign;
35
- return (t2) => (e(o3, c2({ add: s2, remove: p2, internalChildren: u2 }, t2)), { internalChildren: u2 });
36
- }(c, `${p}-item`)({ props: o2 });
37
- const d2 = i(() => ({ [p]: true, [`${p}--border`]: o2.border && !o2.gutter })), f = i(() => {
38
- const e2 = {};
39
- return o2.gutter && (e2.paddingLeft = s(o2.gutter)), e2;
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);
40
41
  });
41
- return () => {
42
- var _a;
43
- return u("view", { class: d2.value, style: f.value }, (_a = l2.default) == null ? void 0 : _a.call(l2));
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);
44
54
  };
45
- } };
46
- export { c as G, d as c };
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 };