@nutui/nutui 3.1.22-beta.0 → 3.1.22

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 (237) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +3 -4
  3. package/dist/nutui.es.js +4203 -19263
  4. package/dist/nutui.umd.js +4208 -19368
  5. package/dist/packages/_es/ActionSheet.js +17 -167
  6. package/dist/packages/_es/Address.js +110 -552
  7. package/dist/packages/_es/AddressList.js +113 -613
  8. package/dist/packages/_es/Animate.js +22 -0
  9. package/dist/packages/_es/Audio.js +53 -274
  10. package/dist/packages/_es/AudioOperate.js +13 -121
  11. package/dist/packages/_es/Avatar.js +38 -177
  12. package/dist/packages/_es/AvatarGroup.js +14 -73
  13. package/dist/packages/_es/BackTop.js +43 -156
  14. package/dist/packages/_es/Badge.js +14 -86
  15. package/dist/packages/_es/Barrage.js +41 -120
  16. package/dist/packages/_es/Button.js +23 -128
  17. package/dist/packages/_es/Calendar.js +30 -237
  18. package/dist/packages/_es/CalendarItem.js +2 -1
  19. package/dist/packages/_es/Card.js +10 -107
  20. package/dist/packages/_es/Cascader.js +147 -523
  21. package/dist/packages/_es/Category.js +15 -58
  22. package/dist/packages/_es/CategoryPane.js +11 -111
  23. package/dist/packages/_es/Cell.js +21 -100
  24. package/dist/packages/_es/CellGroup.js +9 -44
  25. package/dist/packages/_es/Checkbox.js +31 -113
  26. package/dist/packages/_es/CheckboxGroup.js +29 -58
  27. package/dist/packages/_es/CircleProgress.js +28 -151
  28. package/dist/packages/_es/Col.js +14 -56
  29. package/dist/packages/_es/Collapse.js +32 -84
  30. package/dist/packages/_es/CollapseItem.js +59 -272
  31. package/dist/packages/_es/Comment.js +64 -434
  32. package/dist/packages/_es/ConfigProvider.js +13 -0
  33. package/dist/packages/_es/CountDown.js +56 -256
  34. package/dist/packages/_es/CountUp.js +140 -556
  35. package/dist/packages/_es/DatePicker.js +98 -332
  36. package/dist/packages/_es/Dialog.js +60 -271
  37. package/dist/packages/_es/Divider.js +13 -82
  38. package/dist/packages/_es/Drag.js +56 -197
  39. package/dist/packages/_es/Ecard.js +24 -159
  40. package/dist/packages/_es/Elevator.js +58 -212
  41. package/dist/packages/_es/Ellipsis.js +64 -0
  42. package/dist/packages/_es/Empty.js +12 -71
  43. package/dist/packages/_es/FixedNav.js +15 -122
  44. package/dist/packages/_es/Form.js +64 -151
  45. package/dist/packages/_es/FormItem.js +15 -110
  46. package/dist/packages/_es/Grid.js +5 -6
  47. package/dist/packages/_es/GridItem.js +33 -144
  48. package/dist/packages/_es/Icon.js +15 -40
  49. package/dist/packages/_es/Image.js +31 -0
  50. package/dist/packages/_es/ImagePreview.js +77 -309
  51. package/dist/packages/_es/Indicator.js +15 -62
  52. package/dist/packages/_es/InfiniteLoading.js +57 -268
  53. package/dist/packages/_es/Input.js +51 -413
  54. package/dist/packages/_es/InputNumber.js +41 -160
  55. package/dist/packages/_es/Layout.js +4 -5
  56. package/dist/packages/_es/List.js +18 -124
  57. package/dist/packages/_es/Menu.js +45 -118
  58. package/dist/packages/_es/MenuItem.js +37 -162
  59. package/dist/packages/_es/Navbar.js +30 -192
  60. package/dist/packages/_es/NoticeBar.js +74 -397
  61. package/dist/packages/_es/Notify.js +72 -246
  62. package/dist/packages/_es/NumberKeyboard.js +41 -272
  63. package/dist/packages/_es/OldPicker.js +131 -474
  64. package/dist/packages/_es/OverLay.js +24 -113
  65. package/dist/packages/_es/Pagination.js +39 -157
  66. package/dist/packages/_es/Picker.js +129 -469
  67. package/dist/packages/_es/Popover.js +318 -975
  68. package/dist/packages/_es/Popup.js +55 -313
  69. package/dist/packages/_es/Price.js +16 -118
  70. package/dist/packages/_es/Progress.js +14 -146
  71. package/dist/packages/_es/PullRefresh.js +84 -354
  72. package/dist/packages/_es/Radio.js +22 -90
  73. package/dist/packages/_es/RadioGroup.js +8 -37
  74. package/dist/packages/_es/Range.js +83 -427
  75. package/dist/packages/_es/Rate.js +35 -137
  76. package/dist/packages/_es/Row.js +22 -64
  77. package/dist/packages/_es/SearchBar.js +37 -257
  78. package/dist/packages/_es/ShortPassword.js +35 -225
  79. package/dist/packages/_es/SideNavBar.js +24 -99
  80. package/dist/packages/_es/SideNavBarItem.js +11 -46
  81. package/dist/packages/_es/Signature.js +41 -179
  82. package/dist/packages/_es/Skeleton.js +20 -136
  83. package/dist/packages/_es/Sku.js +84 -509
  84. package/dist/packages/_es/Step.js +20 -133
  85. package/dist/packages/_es/Steps.js +18 -53
  86. package/dist/packages/_es/Sticky.js +53 -138
  87. package/dist/packages/_es/SubSideNavBar.js +17 -100
  88. package/dist/packages/_es/Swipe.js +41 -197
  89. package/dist/packages/_es/Swiper.js +121 -433
  90. package/dist/packages/_es/SwiperItem.js +22 -53
  91. package/dist/packages/_es/Switch.js +21 -116
  92. package/dist/packages/_es/TabPane.js +12 -39
  93. package/dist/packages/_es/Tabbar.js +17 -72
  94. package/dist/packages/_es/TabbarItem.js +29 -151
  95. package/dist/packages/_es/Table.js +18 -196
  96. package/dist/packages/_es/Tabs.js +43 -217
  97. package/dist/packages/_es/Tag.js +20 -97
  98. package/dist/packages/_es/TextArea.js +42 -160
  99. package/dist/packages/_es/TimeDetail.js +18 -98
  100. package/dist/packages/_es/TimePannel.js +14 -66
  101. package/dist/packages/_es/TimeSelect.js +15 -103
  102. package/dist/packages/_es/Toast.js +71 -329
  103. package/dist/packages/_es/Uploader.js +104 -468
  104. package/dist/packages/_es/Video.js +74 -350
  105. package/dist/packages/_es/common.js +38 -128
  106. package/dist/packages/_es/component.js +35 -76
  107. package/dist/packages/_es/index.js +5 -6
  108. package/dist/packages/_es/index2.js +9 -30
  109. package/dist/packages/_es/index3.js +6 -8
  110. package/dist/packages/_es/index4.js +13 -58
  111. package/dist/packages/_es/index5.js +164 -682
  112. package/dist/packages/_es/plugin-vue_export-helper.js +7 -8
  113. package/dist/packages/_es/pxCheck.js +3 -5
  114. package/dist/packages/_es/raf.js +8 -15
  115. package/dist/packages/animate/index.scss +299 -0
  116. package/dist/packages/button/index.scss +2 -1
  117. package/dist/packages/cell/index.scss +18 -1
  118. package/dist/packages/checkbox/index.scss +16 -0
  119. package/dist/packages/configprovider/index.scss +2 -0
  120. package/dist/packages/dialog/index.scss +1 -0
  121. package/dist/packages/elevator/index.scss +21 -0
  122. package/dist/packages/ellipsis/index.scss +12 -0
  123. package/dist/packages/formitem/index.scss +12 -0
  124. package/dist/packages/griditem/index.scss +11 -0
  125. package/dist/packages/image/index.scss +39 -0
  126. package/dist/packages/imagepreview/index.scss +21 -2
  127. package/dist/packages/input/index.scss +26 -1
  128. package/dist/packages/inputnumber/index.scss +21 -0
  129. package/dist/packages/locale/lang/baseLang.d.ts +1 -0
  130. package/dist/packages/locale/lang/baseLang.js +3 -3
  131. package/dist/packages/locale/lang/en-US.d.ts +8 -0
  132. package/dist/packages/locale/lang/en-US.js +5 -97
  133. package/dist/packages/locale/lang/id-ID.d.ts +8 -0
  134. package/dist/packages/locale/lang/id-ID.js +5 -97
  135. package/dist/packages/locale/lang/index.js +16 -38
  136. package/dist/packages/locale/lang/zh-CN.d.ts +8 -0
  137. package/dist/packages/locale/lang/zh-CN.js +5 -97
  138. package/dist/packages/locale/lang/zh-TW.d.ts +8 -0
  139. package/dist/packages/locale/lang/zh-TW.js +5 -97
  140. package/dist/packages/menu/index.scss +45 -36
  141. package/dist/packages/menuitem/index.scss +4 -0
  142. package/dist/packages/navbar/index.scss +9 -0
  143. package/dist/packages/pagination/index.scss +19 -0
  144. package/dist/packages/radio/index.scss +19 -0
  145. package/dist/packages/range/index.scss +19 -0
  146. package/dist/packages/rate/index.scss +1 -1
  147. package/dist/packages/searchbar/index.scss +21 -0
  148. package/dist/packages/switch/index.scss +4 -3
  149. package/dist/packages/tabbar/index.scss +5 -0
  150. package/dist/packages/tabbaritem/index.scss +7 -0
  151. package/dist/packages/tabpane/index.scss +6 -0
  152. package/dist/packages/tabs/index.scss +22 -0
  153. package/dist/packages/textarea/index.scss +8 -0
  154. package/dist/smartips/attributes.json +192 -12
  155. package/dist/smartips/tags.json +70 -10
  156. package/dist/smartips/web-types.json +6945 -0
  157. package/dist/style.css +1 -1
  158. package/dist/style.es.js +1 -1
  159. package/dist/styles/font/config.json +3 -1
  160. package/dist/styles/font/demo_index.html +49 -3
  161. package/dist/styles/font/iconfont.css +11 -3
  162. package/dist/styles/font/iconfont.js +15 -15
  163. package/dist/styles/font/iconfont.json +14 -0
  164. package/dist/styles/font/iconfont.ttf +0 -0
  165. package/dist/styles/font/iconfont.woff +0 -0
  166. package/dist/styles/font/iconfont.woff2 +0 -0
  167. package/dist/styles/themes/default.scss +54 -50
  168. package/dist/styles/themes/jdb.scss +54 -50
  169. package/dist/styles/themes/jdt.scss +54 -50
  170. package/dist/styles/variables-jdb.scss +22 -1
  171. package/dist/styles/variables-jdt.scss +22 -1
  172. package/dist/styles/variables.scss +22 -1
  173. package/dist/types/__VUE/actionsheet/index.vue.d.ts +2 -2
  174. package/dist/types/__VUE/address/index.vue.d.ts +4 -4
  175. package/dist/types/__VUE/addresslist/components/ItemContents.vue.d.ts +1 -0
  176. package/dist/types/__VUE/animate/index.vue.d.ts +48 -0
  177. package/dist/types/__VUE/animate/type.d.ts +6 -0
  178. package/dist/types/__VUE/audiooperate/index.vue.d.ts +1 -0
  179. package/dist/types/__VUE/avatar/index.vue.d.ts +5 -5
  180. package/dist/types/__VUE/avatargroup/index.vue.d.ts +2 -2
  181. package/dist/types/__VUE/badge/index.vue.d.ts +4 -4
  182. package/dist/types/__VUE/button/index.vue.d.ts +6 -6
  183. package/dist/types/__VUE/calendaritem/index.vue.d.ts +10 -2
  184. package/dist/types/__VUE/cascader/index.vue.d.ts +3 -3
  185. package/dist/types/__VUE/cell/index.vue.d.ts +11 -4
  186. package/dist/types/__VUE/checkbox/common.d.ts +59 -0
  187. package/dist/types/__VUE/checkbox/index.vue.d.ts +20 -7
  188. package/dist/types/__VUE/checkboxgroup/index.vue.d.ts +7 -0
  189. package/dist/types/__VUE/circleprogress/index.vue.d.ts +2 -2
  190. package/dist/types/__VUE/collapse/index.vue.d.ts +3 -1
  191. package/dist/types/__VUE/comment/index.vue.d.ts +2 -2
  192. package/dist/types/__VUE/configprovider/common.d.ts +20 -0
  193. package/dist/types/__VUE/configprovider/index.vue.d.ts +33 -0
  194. package/dist/types/__VUE/datepicker/index.vue.d.ts +2 -2
  195. package/dist/types/__VUE/dialog/index.d.ts +9 -2
  196. package/dist/types/__VUE/dialog/index.vue.d.ts +25 -10
  197. package/dist/types/__VUE/ecard/index.vue.d.ts +3 -3
  198. package/dist/types/__VUE/elevator/index.vue.d.ts +29 -0
  199. package/dist/types/__VUE/ellipsis/index.vue.d.ts +72 -0
  200. package/dist/types/__VUE/empty/index.vue.d.ts +2 -2
  201. package/dist/types/__VUE/fixednav/index.vue.d.ts +2 -2
  202. package/dist/types/__VUE/formitem/index.vue.d.ts +3 -10
  203. package/dist/types/__VUE/grid/index.vue.d.ts +4 -4
  204. package/dist/types/__VUE/griditem/index.vue.d.ts +1 -1
  205. package/dist/types/__VUE/image/index.vue.d.ts +105 -0
  206. package/dist/types/__VUE/image/type.d.ts +6 -0
  207. package/dist/types/__VUE/imagepreview/index.vue.d.ts +36 -2
  208. package/dist/types/__VUE/input/index.vue.d.ts +6 -6
  209. package/dist/types/__VUE/inputnumber/index.vue.d.ts +2 -2
  210. package/dist/types/__VUE/menu/index.vue.d.ts +29 -2
  211. package/dist/types/__VUE/menuitem/index.vue.d.ts +12 -3
  212. package/dist/types/__VUE/noticebar/index.vue.d.ts +3 -3
  213. package/dist/types/__VUE/notify/index.vue.d.ts +2 -2
  214. package/dist/types/__VUE/oldpicker/index.vue.d.ts +2 -2
  215. package/dist/types/__VUE/picker/Column.vue.d.ts +1 -1
  216. package/dist/types/__VUE/picker/index.vue.d.ts +3 -3
  217. package/dist/types/__VUE/popover/index.vue.d.ts +6 -6
  218. package/dist/types/__VUE/popup/index.vue.d.ts +2 -2
  219. package/dist/types/__VUE/radio/index.vue.d.ts +4 -4
  220. package/dist/types/__VUE/range/index.vue.d.ts +4 -4
  221. package/dist/types/__VUE/rate/common.d.ts +149 -0
  222. package/dist/types/__VUE/rate/index.vue.d.ts +15 -5
  223. package/dist/types/__VUE/skeleton/index.vue.d.ts +4 -4
  224. package/dist/types/__VUE/sku/index.vue.d.ts +2 -2
  225. package/dist/types/__VUE/step/index.vue.d.ts +2 -2
  226. package/dist/types/__VUE/sticky/index.vue.d.ts +4 -4
  227. package/dist/types/__VUE/swiper/index.vue.d.ts +4 -4
  228. package/dist/types/__VUE/tabbar/index.vue.d.ts +2 -2
  229. package/dist/types/__VUE/tag/index.vue.d.ts +2 -2
  230. package/dist/types/__VUE/timeselect/index.vue.d.ts +10 -2
  231. package/dist/types/__VUE/toast/index.vue.d.ts +5 -5
  232. package/dist/types/__VUE/uploader/index.vue.d.ts +6 -6
  233. package/dist/types/__VUE/uploader/uploader.d.ts +1 -0
  234. package/dist/types/__VUE/video/index.vue.d.ts +1 -1
  235. package/dist/types/index.d.ts +1 -1
  236. package/dist/types/nutui.d.ts +5 -1
  237. package/package.json +6 -3
@@ -1,357 +1,81 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
1
  /*!
21
- * @nutui/nutui v3.1.22-beta.0 Tue May 31 2022 21:47:10 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.22 Fri Jun 24 2022 18:11:16 GMT+0800 (中国标准时间)
22
3
  * (c) 2022 @jdf2e.
23
4
  * Released under the MIT License.
24
5
  */
25
- import { reactive, ref, computed, watch, nextTick, onMounted, toRefs, openBlock, createElementBlock, createElementVNode, createCommentVNode, withDirectives, vShow, normalizeClass, toDisplayString, normalizeStyle, withModifiers } from "vue";
26
- import { c as createComponent } from "./component.js";
27
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
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";
28
9
  import "../locale/lang";
29
- const { create, translate } = createComponent("video");
30
- const _sfc_main = create({
31
- props: {
32
- source: {
33
- type: Object,
34
- default: {}
35
- },
36
- options: {
37
- type: Object,
38
- default: {
39
- autoplay: false,
40
- volume: 0.5,
41
- poster: "",
42
- loop: false,
43
- controls: true,
44
- muted: false,
45
- disabled: false,
46
- playsinline: false,
47
- touchPlay: false,
48
- preload: ""
49
- },
50
- required: true
51
- },
52
- model: {
53
- type: String,
54
- default: ""
55
- }
56
- },
57
- components: {},
58
- emits: ["click", "play", "pause", "playend"],
59
- setup(props, { emit }) {
60
- const state = reactive({
61
- videoElm: null,
62
- initial: true,
63
- showToolbox: false,
64
- player: {
65
- $player: null,
66
- pos: null
67
- },
68
- progressBar: {
69
- progressElm: null,
70
- pos: null
71
- },
72
- videoSet: {
73
- loaded: 0,
74
- displayTime: "00:00",
75
- totalTime: "00:00",
76
- progress: {
77
- width: 0,
78
- current: 0
79
- }
80
- },
81
- state: {
82
- controlShow: true,
83
- vol: 0.5,
84
- currentTime: 0,
85
- fullScreen: false,
86
- playing: false,
87
- isLoading: false,
88
- isEnd: false,
89
- isError: false,
90
- isMuted: false
91
- },
92
- showTouchMask: false
93
- });
94
- const root = ref(null);
95
- const isDisabled = computed(() => {
96
- return props.options.disabled;
97
- });
98
- watch(() => props.source, (newValue) => {
99
- if (newValue.src) {
100
- nextTick(() => {
101
- state.videoElm.load();
102
- });
103
- }
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();
104
15
  });
105
- watch(() => props.options, (newValue) => {
106
- state.state.isMuted = newValue ? newValue.muted : false;
107
- }, { immediate: true });
108
- const init = () => {
109
- state.videoElm = root.value;
110
- if (props.options.autoplay) {
111
- setTimeout(() => {
112
- state.videoElm.play();
113
- }, 200);
114
- }
115
- if (props.options.touchPlay) {
116
- state.showTouchMask = true;
117
- }
118
- if (props.options.playsinline) {
119
- state.videoElm.setAttribute("playsinline", props.options.playsinline);
120
- state.videoElm.setAttribute("webkit-playsinline", props.options.playsinline);
121
- state.videoElm.setAttribute("x5-video-player-type", "h5-page");
122
- state.videoElm.setAttribute("x5-video-player-fullscreen", false);
123
- }
124
- volumeHandle();
125
- if (state.showToolbox) {
126
- customerInit();
127
- } else {
128
- state.videoElm.addEventListener("play", () => {
129
- state.state.playing = true;
130
- emit("play", state.videoElm);
131
- });
132
- state.videoElm.addEventListener("pause", () => {
133
- state.state.playing = false;
134
- emit("pause", state.videoElm);
135
- });
136
- state.videoElm.addEventListener("ended", playEnded);
137
- }
138
- };
139
- const customerInit = () => {
140
- const $player = root.value;
141
- const $progress = root.value.getElementsByClassName("progress")[0];
142
- state.player.$player = $player;
143
- state.progressBar.progressElm = $progress;
144
- state.progressBar.pos = $progress.getBoundingClientRect();
145
- state.videoSet.progress.width = Math.round($progress.getBoundingClientRect().width);
146
- };
147
- const play = () => {
148
- if (props.options.autoplay && props.options.disabled) {
149
- state.state.playing = true;
150
- return false;
151
- }
152
- state.state.playing = !state.state.playing;
153
- if (state.videoElm) {
154
- if (state.state.playing) {
155
- try {
156
- setTimeout(() => {
157
- state.videoElm.play();
158
- }, 200);
159
- state.videoElm.addEventListener("progress", () => {
160
- getLoadTime();
161
- });
162
- state.videoElm.addEventListener("ended", playEnded);
163
- emit("play", state.videoElm);
164
- } catch (e) {
165
- handleError();
166
- }
167
- } else {
168
- state.videoElm.pause();
169
- emit("pause", state.videoElm);
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();
170
56
  }
171
- }
172
- };
173
- const getLoadTime = () => {
174
- if (state.videoSet.loaded)
175
- state.videoSet.loaded = state.videoElm.buffered.end(0) / state.videoElm.duration * 100;
176
- };
177
- const playEnded = () => {
178
- state.state.playing = false;
179
- state.state.isEnd = true;
180
- state.videoSet.displayTime = "00:00";
181
- state.videoSet.progress.current = 0;
182
- state.videoElm.currentTime = 0;
183
- emit("playend", state.videoElm);
184
- };
185
- const handleError = () => {
186
- state.state.isError = true;
187
- };
188
- const volumeHandle = () => {
189
- state.state.vol = props.options.volume;
190
- };
191
- const handleMuted = () => {
192
- state.state.isMuted = !state.state.isMuted;
193
- state.videoElm.muted = state.state.isMuted;
194
- };
195
- const touchSlidSrart = () => {
196
- };
197
- const touchSlidMove = (e) => {
198
- let currentX = e.targetTouches[0].pageX;
199
- let offsetX = currentX - state.progressBar.pos.left;
200
- if (offsetX <= 0) {
201
- offsetX = 0;
202
- }
203
- if (offsetX >= state.videoSet.progress.width) {
204
- offsetX = state.videoSet.progress.width;
205
- }
206
- state.videoSet.progress.current = offsetX;
207
- let percent = state.videoSet.progress.current / state.videoSet.progress.width;
208
- state.videoElm.duration && setPlayTime(percent, state.videoElm.duration);
209
- };
210
- const touchSlidEnd = (e) => {
211
- let currentX = e.changedTouches[0].pageX;
212
- let offsetX = currentX - state.progressBar.pos.left;
213
- state.videoSet.progress.current = offsetX;
214
- let percent = offsetX / state.videoSet.progress.width;
215
- state.videoElm.duration && setPlayTime(percent, state.videoElm.duration);
216
- };
217
- const setPlayTime = (percent, totalTime) => {
218
- state.videoElm.currentTime = Math.floor(percent * totalTime);
219
- };
220
- const retry = () => {
221
- state.state.isError = false;
222
- init();
223
- };
224
- const fullScreen = () => {
225
- if (!state.state.fullScreen) {
226
- state.state.fullScreen = true;
227
- state.videoElm.webkitRequestFullScreen();
228
- } else {
229
- state.state.fullScreen = false;
230
- document.webkitCancelFullScreen();
231
- }
232
- };
233
- onMounted(() => {
234
- init();
235
- });
236
- return __spreadProps(__spreadValues(__spreadValues({
237
- root
238
- }, toRefs(props)), toRefs(state)), {
239
- handleError,
240
- isDisabled,
241
- play,
242
- handleMuted,
243
- touchSlidSrart,
244
- touchSlidMove,
245
- touchSlidEnd,
246
- retry,
247
- fullScreen,
248
- translate
249
- });
250
- }
251
- });
252
- const _hoisted_1 = {
253
- class: "nut-video",
254
- ref: "videocon"
255
- };
256
- const _hoisted_2 = ["muted", "autoplay", "loop", "poster", "controls", "preload"];
257
- const _hoisted_3 = ["src", "type"];
258
- const _hoisted_4 = { class: "current-time" };
259
- const _hoisted_5 = { class: "progress-container" };
260
- const _hoisted_6 = {
261
- class: "progress",
262
- ref: "progressBar"
263
- };
264
- const _hoisted_7 = /* @__PURE__ */ createElementVNode("div", { class: "move-handle" }, null, -1);
265
- const _hoisted_8 = [
266
- _hoisted_7
267
- ];
268
- const _hoisted_9 = {
269
- class: "played",
270
- ref: "playedBar"
271
- };
272
- const _hoisted_10 = { class: "duration-time" };
273
- const _hoisted_11 = { class: "nut-video-error" };
274
- const _hoisted_12 = { class: "lose" };
275
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
276
- return openBlock(), createElementBlock("div", _hoisted_1, [
277
- createElementVNode("video", {
278
- ref: "root",
279
- class: "nut-video-player",
280
- muted: _ctx.options.muted,
281
- autoplay: _ctx.options.autoplay,
282
- loop: _ctx.options.loop,
283
- poster: _ctx.options.poster,
284
- controls: _ctx.options.controls,
285
- preload: _ctx.options.preload,
286
- onError: _cache[0] || (_cache[0] = (...args) => _ctx.handleError && _ctx.handleError(...args))
287
- }, [
288
- createElementVNode("source", {
289
- src: _ctx.source.src,
290
- type: _ctx.source.type
291
- }, null, 8, _hoisted_3)
292
- ], 40, _hoisted_2),
293
- _ctx.showToolbox && !_ctx.isDisabled ? (openBlock(), createElementBlock("div", {
294
- key: 0,
295
- class: "playing-mask",
296
- ref: "touchMask",
297
- onClick: _cache[1] || (_cache[1] = (...args) => _ctx.play && _ctx.play(...args))
298
- }, null, 512)) : createCommentVNode("", true),
299
- _ctx.showToolbox && !_ctx.isDisabled ? withDirectives((openBlock(), createElementBlock("div", {
300
- key: 1,
301
- class: "nut-video-play-btn",
302
- ref: "palyBtn",
303
- onClick: _cache[2] || (_cache[2] = (...args) => _ctx.play && _ctx.play(...args))
304
- }, null, 512)), [
305
- [vShow, !_ctx.state.playing]
306
- ]) : createCommentVNode("", true),
307
- withDirectives(createElementVNode("div", {
308
- class: normalizeClass(["nut-video-controller", { "show-control": !_ctx.state.playing, "hide-control": _ctx.state.playing }])
309
- }, [
310
- createElementVNode("div", {
311
- class: "control-play-btn",
312
- onClick: _cache[3] || (_cache[3] = (...args) => _ctx.play && _ctx.play(...args))
313
- }),
314
- createElementVNode("div", _hoisted_4, toDisplayString(_ctx.videoSet.displayTime), 1),
315
- createElementVNode("div", _hoisted_5, [
316
- createElementVNode("div", _hoisted_6, [
317
- createElementVNode("div", {
318
- class: "buffered",
319
- style: normalizeStyle({ width: `${_ctx.videoSet.loaded}%` })
320
- }, null, 4),
321
- createElementVNode("div", {
322
- class: "video-ball",
323
- style: normalizeStyle({
324
- transform: `translate3d(${_ctx.videoSet.progress.current}px, -50%, 0)`
325
- }),
326
- onTouchmove: _cache[4] || (_cache[4] = withModifiers(($event) => _ctx.touchSlidMove($event), ["stop", "prevent"])),
327
- onTouchstart: _cache[5] || (_cache[5] = withModifiers(($event) => _ctx.touchSlidSrart($event), ["stop"])),
328
- onTouchend: _cache[6] || (_cache[6] = withModifiers(($event) => _ctx.touchSlidEnd($event), ["stop"]))
329
- }, _hoisted_8, 36),
330
- createElementVNode("div", _hoisted_9, null, 512)
331
- ], 512)
332
- ]),
333
- createElementVNode("div", _hoisted_10, toDisplayString(_ctx.videoSet.totalTime), 1),
334
- createElementVNode("div", {
335
- class: normalizeClass(["volume", { muted: _ctx.state.isMuted }]),
336
- onClick: _cache[7] || (_cache[7] = (...args) => _ctx.handleMuted && _ctx.handleMuted(...args))
337
- }, null, 2),
338
- createElementVNode("div", {
339
- class: "fullscreen-icon",
340
- onClick: _cache[8] || (_cache[8] = (...args) => _ctx.fullScreen && _ctx.fullScreen(...args))
341
- })
342
- ], 2), [
343
- [vShow, _ctx.showToolbox && !_ctx.isDisabled]
344
- ]),
345
- withDirectives(createElementVNode("div", _hoisted_11, [
346
- createElementVNode("p", _hoisted_12, toDisplayString(_ctx.translate("errorTip")), 1),
347
- createElementVNode("p", {
348
- class: "retry",
349
- onClick: _cache[9] || (_cache[9] = (...args) => _ctx.retry && _ctx.retry(...args))
350
- }, toDisplayString(_ctx.translate("clickRetry")), 1)
351
- ], 512), [
352
- [vShow, _ctx.state.isError]
353
- ])
354
- ], 512);
355
- }
356
- var Video = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
357
- export { Video as default };
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 };
@@ -1,136 +1,46 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.0 Tue May 31 2022 21:47:10 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.22 Fri Jun 24 2022 18:11:16 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { provide, shallowReactive, getCurrentInstance, markRaw, isVNode, computed, h } from "vue";
7
- import { c as createComponent } from "./component.js";
8
- import { p as pxCheck } from "./pxCheck.js";
9
- function flattenVNodes(children, childName) {
10
- const result = [];
11
- const traverse = (children2) => {
12
- if (!Array.isArray(children2))
13
- return;
14
- children2.forEach((child) => {
15
- var _a;
16
- if (!isVNode(child))
17
- return;
18
- if (childName) {
19
- if (child.type && child.type.name === childName) {
20
- result.push(child);
21
- return;
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);
22
21
  }
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;
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));
36
27
  }
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);
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;
41
40
  });
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);
41
+ return () => {
42
+ var _a;
43
+ return u("view", { class: d2.value, style: f.value }, (_a = l2.default) == null ? void 0 : _a.call(l2));
54
44
  };
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 };
45
+ } };
46
+ export { c as G, d as c };