@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,22 +1,64 @@
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 { toRefs as e, reactive as t, computed as l, openBlock as a, createElementBlock as i, createElementVNode as o, normalizeClass as c, renderSlot as n } from "vue";
7
- import { c as s } from "./component.js";
8
- import { _ as r } from "./plugin-vue_export-helper.js";
6
+ import { toRefs, reactive, computed, openBlock, createElementBlock, createElementVNode, normalizeClass, renderSlot } 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 { componentName: p, create: u } = s("animate"), m = u({ props: { type: { type: String, default: "" }, action: { type: String, default: "initial" }, loop: { type: Boolean, default: false } }, emits: ["click"], setup(a2, { emit: i2 }) {
11
- const { type: o2, loop: c2, action: n2 } = e(a2), s2 = t({ clicked: false });
12
- let r2 = l(() => ({ "nut-ani-container": true, [`${p}-${o2.value}`]: !(n2.value !== "initial" && !s2.clicked) && o2.value, loop: c2.value }));
13
- return { ...e(s2), classes: r2, handleClick: (e2) => {
14
- s2.clicked = true, c2.value || setTimeout(() => {
15
- s2.clicked = false;
16
- }, 1e3), i2("click", e2);
17
- } };
18
- } }), d = { class: "nut-animate" };
19
- var k = r(m, [["render", function(e2, t2, l2, s2, r2, p2) {
20
- return a(), i("view", d, [o("view", { class: c(e2.classes), onClick: t2[0] || (t2[0] = (...t3) => e2.handleClick && e2.handleClick(...t3)) }, [n(e2.$slots, "default")], 2)]);
21
- }]]);
22
- export { k as default };
10
+ const { componentName, create } = createComponent("animate");
11
+ const _sfc_main = create({
12
+ props: {
13
+ type: {
14
+ type: String,
15
+ default: ""
16
+ },
17
+ action: {
18
+ type: String,
19
+ default: "initial"
20
+ },
21
+ loop: {
22
+ type: Boolean,
23
+ default: false
24
+ }
25
+ },
26
+ emits: ["click"],
27
+ setup(props, { emit }) {
28
+ const { type, loop, action } = toRefs(props);
29
+ const state = reactive({
30
+ clicked: false
31
+ });
32
+ let classes = computed(() => {
33
+ const prefixCls = componentName;
34
+ return {
35
+ "nut-ani-container": true,
36
+ [`${prefixCls}-${type.value}`]: action.value === "initial" || state.clicked ? type.value : false,
37
+ loop: loop.value
38
+ };
39
+ });
40
+ const handleClick = (event) => {
41
+ state.clicked = true;
42
+ if (!loop.value) {
43
+ setTimeout(() => {
44
+ state.clicked = false;
45
+ }, 1e3);
46
+ }
47
+ emit("click", event);
48
+ };
49
+ return { ...toRefs(state), classes, handleClick };
50
+ }
51
+ });
52
+ const _hoisted_1 = { class: "nut-animate" };
53
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
54
+ return openBlock(), createElementBlock("view", _hoisted_1, [
55
+ createElementVNode("view", {
56
+ class: normalizeClass(_ctx.classes),
57
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
58
+ }, [
59
+ renderSlot(_ctx.$slots, "default")
60
+ ], 2)
61
+ ]);
62
+ }
63
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
64
+ export { index as default };
@@ -1,59 +1,263 @@
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 { ref as e, reactive as a, onMounted as t, watch as n, provide as o, toRefs as r, resolveComponent as u, openBlock as i, createElementBlock as l, createElementVNode as c, toDisplayString as d, createVNode as s, withCtx as p, createCommentVNode as m, normalizeClass as y, createBlock as g, renderSlot as h } from "vue";
7
- import { c as f } from "./component.js";
8
- import { _ as v } from "./plugin-vue_export-helper.js";
6
+ import { ref, reactive, onMounted, watch, provide, toRefs, resolveComponent, openBlock, createElementBlock, createElementVNode, toDisplayString, createVNode, withCtx, createCommentVNode, normalizeClass, createBlock, renderSlot } 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 { componentName: T, create: k } = f("audio"), M = k({ props: { url: { type: String, default: "" }, muted: { type: Boolean, default: false }, autoplay: { type: Boolean, default: false }, loop: { type: Boolean, default: false }, preload: { type: String, default: "auto" }, second: { type: Number, default: 0 }, type: { type: String, default: "progress" } }, components: {}, emits: ["fastBack", "play", "forward", "ended", "changeProgress", "mute"], setup(u2, { emit: i2 }) {
11
- const l2 = e(null), c2 = a({ currentTime: 0, currentDuration: "00:00:00", percent: 0, duration: "00:00:00", second: 0, hanMuted: u2.muted, playing: u2.autoplay, handPlaying: false });
12
- t(() => {
13
- var e2 = ["webkitVisibilityState", "visibilitychange"];
14
- try {
15
- for (let a2 = 0; a2 < e2.length; a2++)
16
- document.addEventListener(e2[a2], () => {
17
- document.hidden ? l2.value.pause() : c2.playing && setTimeout(() => {
18
- l2.value.play();
19
- }, 200);
20
- });
21
- } catch (e3) {
10
+ const { componentName, create } = createComponent("audio");
11
+ const _sfc_main = create({
12
+ props: {
13
+ url: {
14
+ type: String,
15
+ default: ""
16
+ },
17
+ muted: {
18
+ type: Boolean,
19
+ default: false
20
+ },
21
+ autoplay: {
22
+ type: Boolean,
23
+ default: false
24
+ },
25
+ loop: {
26
+ type: Boolean,
27
+ default: false
28
+ },
29
+ preload: {
30
+ type: String,
31
+ default: "auto"
32
+ },
33
+ second: {
34
+ type: Number,
35
+ default: 0
36
+ },
37
+ type: {
38
+ type: String,
39
+ default: "progress"
22
40
  }
23
- setTimeout(() => {
24
- const e3 = l2.value;
25
- u2.autoplay && e3 && e3.paused && e3.play(), c2.second = e3.duration, c2.duration = y2(e3.duration);
26
- }, 500);
27
- });
28
- const d2 = () => {
29
- c2.currentTime--, l2.value.currentTime = c2.currentTime, i2("fastBack", c2.currentTime);
30
- }, s2 = () => {
31
- const e2 = l2.value;
32
- c2.playing ? (e2.pause(), c2.handPlaying = false) : (e2.play(), c2.handPlaying = true), c2.playing = !c2.playing, i2("play", c2.playing);
33
- }, p2 = () => {
34
- c2.currentTime++, l2.value.currentTime = c2.currentTime, i2("forward", c2.currentTime);
35
- }, m2 = () => {
36
- c2.hanMuted = !c2.hanMuted, i2("mute", c2.hanMuted);
37
- }, y2 = (e2) => {
38
- let a2 = parseInt(e2), t2 = 0, n2 = 0;
39
- a2 > 60 && (t2 = Math.floor(a2 / 60), a2 = Math.floor(a2 % 60), t2 > 60 && (n2 = Math.floor(t2 / 60), t2 = Math.floor(t2 % 60)));
40
- let o2 = "";
41
- return a2 < 10 && (o2 = "0" + o2), t2 > 0 ? (o2 = t2 + ":" + o2, t2 < 10 && (o2 = "0" + o2)) : o2 = "00:" + o2, n2 > 0 ? (o2 = n2 + ":" + o2, n2 < 10 && (o2 = "0" + o2)) : o2 = "00:" + o2, o2;
42
- };
43
- return n(() => c2.currentTime, (e2) => {
44
- var a2;
45
- a2 = e2, c2.currentDuration = y2(a2), c2.percent = a2 / c2.second * 100;
46
- }), o("audioParent", { children: [], props: u2, audioData: c2, handleMute: m2, forward: p2, fastBack: d2, changeStatus: s2 }), { ...r(u2), ...r(c2), audioRef: l2, fastBack: d2, forward: p2, changeStatus: s2, progressChange: (e2) => {
47
- const a2 = l2.value;
48
- a2.currentTime = c2.second * e2 / 100, i2("changeProgress", a2.currentTime);
49
- }, audioEnd: () => {
50
- c2.playing = false, i2("ended");
51
- }, onTimeupdate: (e2) => {
52
- c2.currentTime = parseInt(e2.target.currentTime);
53
- }, handleMute: m2 };
54
- } }), S = { class: "nut-audio" }, b = { key: 0, class: "progress-wrapper" }, w = { class: "time" }, B = { class: "progress-bar-wrapper" }, C = c("div", { class: "custom-button" }, null, -1), P = { class: "time" }, E = { key: 1, class: "nut-audio-icon" }, D = ["controls", "src", "preload", "autoplay", "loop", "muted"];
55
- var V = v(M, [["render", function(e2, a2, t2, n2, o2, r2) {
56
- const f2 = u("nut-range"), v2 = u("nut-icon");
57
- return i(), l("div", S, [e2.type == "progress" ? (i(), l("div", b, [c("div", w, d(e2.currentDuration), 1), c("div", B, [s(f2, { modelValue: e2.percent, "onUpdate:modelValue": a2[0] || (a2[0] = (a3) => e2.percent = a3), "hidden-range": "", onChange: e2.progressChange, "inactive-color": "#cccccc", "active-color": "#fa2c19" }, { button: p(() => [C]), _: 1 }, 8, ["modelValue", "onChange"])]), c("div", P, d(e2.duration), 1)])) : m("", true), e2.type == "icon" ? (i(), l("div", E, [c("div", { class: y(["nut-audio-icon-box", e2.playing ? "nut-audio-icon-play" : "nut-audio-icon-stop"]), onClick: a2[1] || (a2[1] = (...a3) => e2.changeStatus && e2.changeStatus(...a3)) }, [e2.playing ? (i(), g(v2, { key: 0, name: "service", class: "nut-icon-am-rotate nut-icon-am-infinite" })) : m("", true), e2.playing ? m("", true) : (i(), g(v2, { key: 1, name: "service" }))], 2)])) : m("", true), e2.type == "none" ? (i(), l("div", { key: 2, onClick: a2[2] || (a2[2] = (...a3) => e2.changeStatus && e2.changeStatus(...a3)) }, [h(e2.$slots, "default")])) : m("", true), e2.type != "none" ? h(e2.$slots, "default", { key: 3 }) : m("", true), c("audio", { class: "audioMain", controls: e2.type == "controls", ref: "audioRef", src: e2.url, preload: e2.preload, autoplay: e2.autoplay, loop: e2.loop, onTimeupdate: a2[3] || (a2[3] = (...a3) => e2.onTimeupdate && e2.onTimeupdate(...a3)), onEnded: a2[4] || (a2[4] = (...a3) => e2.audioEnd && e2.audioEnd(...a3)), muted: e2.hanMuted }, null, 40, D)]);
58
- }]]);
59
- export { V as default };
41
+ },
42
+ components: {},
43
+ emits: ["fastBack", "play", "forward", "ended", "changeProgress", "mute"],
44
+ setup(props, { emit }) {
45
+ const audioRef = ref(null);
46
+ const audioData = reactive({
47
+ currentTime: 0,
48
+ currentDuration: "00:00:00",
49
+ percent: 0,
50
+ duration: "00:00:00",
51
+ second: 0,
52
+ hanMuted: props.muted,
53
+ playing: props.autoplay,
54
+ handPlaying: false
55
+ });
56
+ onMounted(() => {
57
+ var arr = ["webkitVisibilityState", "visibilitychange"];
58
+ try {
59
+ for (let i = 0; i < arr.length; i++) {
60
+ document.addEventListener(arr[i], () => {
61
+ if (document.hidden) {
62
+ audioRef.value.pause();
63
+ } else {
64
+ if (audioData.playing) {
65
+ setTimeout(() => {
66
+ audioRef.value.play();
67
+ }, 200);
68
+ }
69
+ }
70
+ });
71
+ }
72
+ } catch (e) {
73
+ console.log(e.message);
74
+ }
75
+ setTimeout(() => {
76
+ const audioR = audioRef.value;
77
+ if (props.autoplay) {
78
+ if (audioR && audioR.paused) {
79
+ audioR.play();
80
+ }
81
+ }
82
+ audioData.second = audioR.duration;
83
+ audioData.duration = formatSeconds(audioR.duration);
84
+ }, 500);
85
+ });
86
+ const onTimeupdate = (e) => {
87
+ audioData.currentTime = parseInt(e.target.currentTime);
88
+ };
89
+ const fastBack = () => {
90
+ audioData.currentTime--;
91
+ audioRef.value.currentTime = audioData.currentTime;
92
+ emit("fastBack", audioData.currentTime);
93
+ };
94
+ const changeStatus = () => {
95
+ const audioR = audioRef.value;
96
+ if (audioData.playing) {
97
+ audioR.pause();
98
+ audioData.handPlaying = false;
99
+ } else {
100
+ audioR.play();
101
+ audioData.handPlaying = true;
102
+ }
103
+ audioData.playing = !audioData.playing;
104
+ emit("play", audioData.playing);
105
+ };
106
+ const forward = () => {
107
+ audioData.currentTime++;
108
+ audioRef.value.currentTime = audioData.currentTime;
109
+ emit("forward", audioData.currentTime);
110
+ };
111
+ const handle = (val) => {
112
+ audioData.currentDuration = formatSeconds(val);
113
+ audioData.percent = val / audioData.second * 100;
114
+ };
115
+ const audioEnd = () => {
116
+ audioData.playing = false;
117
+ emit("ended");
118
+ };
119
+ const progressChange = (val) => {
120
+ const ar = audioRef.value;
121
+ ar.currentTime = audioData.second * val / 100;
122
+ emit("changeProgress", ar.currentTime);
123
+ };
124
+ const handleMute = () => {
125
+ audioData.hanMuted = !audioData.hanMuted;
126
+ emit("mute", audioData.hanMuted);
127
+ };
128
+ const formatSeconds = (value) => {
129
+ let theTime = parseInt(value);
130
+ let theTime1 = 0;
131
+ let theTime2 = 0;
132
+ if (theTime > 60) {
133
+ theTime1 = Math.floor(theTime / 60);
134
+ theTime = Math.floor(theTime % 60);
135
+ if (theTime1 > 60) {
136
+ theTime2 = Math.floor(theTime1 / 60);
137
+ theTime1 = Math.floor(theTime1 % 60);
138
+ }
139
+ }
140
+ let result = "";
141
+ if (theTime < 10) {
142
+ result = "0" + result;
143
+ }
144
+ if (theTime1 > 0) {
145
+ result = "" + theTime1 + ":" + result;
146
+ if (theTime1 < 10) {
147
+ result = "0" + result;
148
+ }
149
+ } else {
150
+ result = "00:" + result;
151
+ }
152
+ if (theTime2 > 0) {
153
+ result = "" + theTime2 + ":" + result;
154
+ if (theTime2 < 10) {
155
+ result = "0" + result;
156
+ }
157
+ } else {
158
+ result = "00:" + result;
159
+ }
160
+ return result;
161
+ };
162
+ watch(() => audioData.currentTime, (value) => {
163
+ handle(value);
164
+ });
165
+ provide("audioParent", {
166
+ children: [],
167
+ props,
168
+ audioData,
169
+ handleMute,
170
+ forward,
171
+ fastBack,
172
+ changeStatus
173
+ });
174
+ return {
175
+ ...toRefs(props),
176
+ ...toRefs(audioData),
177
+ audioRef,
178
+ fastBack,
179
+ forward,
180
+ changeStatus,
181
+ progressChange,
182
+ audioEnd,
183
+ onTimeupdate,
184
+ handleMute
185
+ };
186
+ }
187
+ });
188
+ const _hoisted_1 = { class: "nut-audio" };
189
+ const _hoisted_2 = {
190
+ key: 0,
191
+ class: "progress-wrapper"
192
+ };
193
+ const _hoisted_3 = { class: "time" };
194
+ const _hoisted_4 = { class: "progress-bar-wrapper" };
195
+ const _hoisted_5 = /* @__PURE__ */ createElementVNode("div", { class: "custom-button" }, null, -1);
196
+ const _hoisted_6 = { class: "time" };
197
+ const _hoisted_7 = {
198
+ key: 1,
199
+ class: "nut-audio-icon"
200
+ };
201
+ const _hoisted_8 = ["controls", "src", "preload", "autoplay", "loop", "muted"];
202
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
203
+ const _component_nut_range = resolveComponent("nut-range");
204
+ const _component_nut_icon = resolveComponent("nut-icon");
205
+ return openBlock(), createElementBlock("div", _hoisted_1, [
206
+ _ctx.type == "progress" ? (openBlock(), createElementBlock("div", _hoisted_2, [
207
+ createElementVNode("div", _hoisted_3, toDisplayString(_ctx.currentDuration), 1),
208
+ createElementVNode("div", _hoisted_4, [
209
+ createVNode(_component_nut_range, {
210
+ modelValue: _ctx.percent,
211
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.percent = $event),
212
+ "hidden-range": "",
213
+ onChange: _ctx.progressChange,
214
+ "inactive-color": "#cccccc",
215
+ "active-color": "#fa2c19"
216
+ }, {
217
+ button: withCtx(() => [
218
+ _hoisted_5
219
+ ]),
220
+ _: 1
221
+ }, 8, ["modelValue", "onChange"])
222
+ ]),
223
+ createElementVNode("div", _hoisted_6, toDisplayString(_ctx.duration), 1)
224
+ ])) : createCommentVNode("", true),
225
+ _ctx.type == "icon" ? (openBlock(), createElementBlock("div", _hoisted_7, [
226
+ createElementVNode("div", {
227
+ class: normalizeClass(["nut-audio-icon-box", _ctx.playing ? "nut-audio-icon-play" : "nut-audio-icon-stop"]),
228
+ onClick: _cache[1] || (_cache[1] = (...args) => _ctx.changeStatus && _ctx.changeStatus(...args))
229
+ }, [
230
+ _ctx.playing ? (openBlock(), createBlock(_component_nut_icon, {
231
+ key: 0,
232
+ name: "service",
233
+ class: "nut-icon-am-rotate nut-icon-am-infinite"
234
+ })) : createCommentVNode("", true),
235
+ !_ctx.playing ? (openBlock(), createBlock(_component_nut_icon, {
236
+ key: 1,
237
+ name: "service"
238
+ })) : createCommentVNode("", true)
239
+ ], 2)
240
+ ])) : createCommentVNode("", true),
241
+ _ctx.type == "none" ? (openBlock(), createElementBlock("div", {
242
+ key: 2,
243
+ onClick: _cache[2] || (_cache[2] = (...args) => _ctx.changeStatus && _ctx.changeStatus(...args))
244
+ }, [
245
+ renderSlot(_ctx.$slots, "default")
246
+ ])) : createCommentVNode("", true),
247
+ _ctx.type != "none" ? renderSlot(_ctx.$slots, "default", { key: 3 }) : createCommentVNode("", true),
248
+ createElementVNode("audio", {
249
+ class: "audioMain",
250
+ controls: _ctx.type == "controls",
251
+ ref: "audioRef",
252
+ src: _ctx.url,
253
+ preload: _ctx.preload,
254
+ autoplay: _ctx.autoplay,
255
+ loop: _ctx.loop,
256
+ onTimeupdate: _cache[3] || (_cache[3] = (...args) => _ctx.onTimeupdate && _ctx.onTimeupdate(...args)),
257
+ onEnded: _cache[4] || (_cache[4] = (...args) => _ctx.audioEnd && _ctx.audioEnd(...args)),
258
+ muted: _ctx.hanMuted
259
+ }, null, 40, _hoisted_8)
260
+ ]);
261
+ }
262
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
263
+ export { index as default };
@@ -1,18 +1,105 @@
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 { inject as t, reactive as e, ref as a, useSlots as o, toRefs as l, resolveComponent as s, openBlock as r, createElementBlock as u, createBlock as i, withCtx as n, createTextVNode as p, toDisplayString as d, createCommentVNode as c, renderSlot as m } from "vue";
7
- import { c as y } from "./component.js";
8
- import { _ as f } from "./plugin-vue_export-helper.js";
6
+ import { inject, reactive, ref, useSlots, toRefs, resolveComponent, openBlock, createElementBlock, createBlock, withCtx, createTextVNode, toDisplayString, createCommentVNode, renderSlot } 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 { componentName: k, create: v, translate: S } = y("audio-operate"), g = v({ props: { type: { type: String, default: () => "play" } }, components: {}, emits: ["click"], setup(s2, { emit: r2 }) {
11
- const u2 = t("audioParent"), i2 = e(u2), n2 = a(o().default);
12
- return { ...l(s2), ...l(i2), customSlot: n2, translate: S };
13
- } }), h = { class: "nut-audio-operate" }, $ = p("\u5FEB\u8FDB");
14
- var _ = f(g, [["render", function(t2, e2, a2, o2, l2, y2) {
15
- const f2 = s("nut-button");
16
- return r(), u("div", h, [t2.type == "back" ? (r(), u("div", { key: 0, class: "nut-audio-operate-item", onClick: e2[0] || (e2[0] = (...e3) => t2.fastBack && t2.fastBack(...e3)) }, [t2.customSlot ? c("", true) : (r(), i(f2, { key: 0, type: "primary", size: "small" }, { default: n(() => [p(d(t2.translate("back")), 1)]), _: 1 })), m(t2.$slots, "default")])) : c("", true), t2.type == "play" ? (r(), u("div", { key: 1, class: "nut-audio-operate-item", onClick: e2[1] || (e2[1] = (...e3) => t2.changeStatus && t2.changeStatus(...e3)) }, [t2.customSlot ? c("", true) : (r(), i(f2, { key: 0, type: "primary", size: "small" }, { default: n(() => [p(d(t2.audioData.playing ? `${t2.translate("pause")}` : `${t2.translate("start")}`), 1)]), _: 1 })), m(t2.$slots, "default")])) : c("", true), t2.type == "forward" ? (r(), u("div", { key: 2, class: "nut-audio-operate-item", onClick: e2[2] || (e2[2] = (...e3) => t2.forward && t2.forward(...e3)) }, [t2.customSlot ? c("", true) : (r(), i(f2, { key: 0, type: "primary", size: "small" }, { default: n(() => [$]), _: 1 })), m(t2.$slots, "default")])) : c("", true), t2.type == "mute" ? (r(), u("div", { key: 3, class: "nut-audio-operate-item", onClick: e2[3] || (e2[3] = (...e3) => t2.handleMute && t2.handleMute(...e3)) }, [t2.customSlot ? c("", true) : (r(), i(f2, { key: 0, type: t2.audioData.hanMuted ? "default" : "primary", size: "small" }, { default: n(() => [p(d(t2.translate("mute")), 1)]), _: 1 }, 8, ["type"])), m(t2.$slots, "default")])) : c("", true)]);
17
- }]]);
18
- export { _ as default };
10
+ const { componentName, create, translate } = createComponent("audio-operate");
11
+ const _sfc_main = create({
12
+ props: {
13
+ type: {
14
+ type: String,
15
+ default() {
16
+ return "play";
17
+ }
18
+ }
19
+ },
20
+ components: {},
21
+ emits: ["click"],
22
+ setup(props, { emit }) {
23
+ const audio = inject("audioParent");
24
+ const parent = reactive(audio);
25
+ const customSlot = ref(useSlots().default);
26
+ return { ...toRefs(props), ...toRefs(parent), customSlot, translate };
27
+ }
28
+ });
29
+ const _hoisted_1 = { class: "nut-audio-operate" };
30
+ const _hoisted_2 = /* @__PURE__ */ createTextVNode("\u5FEB\u8FDB");
31
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
32
+ const _component_nut_button = resolveComponent("nut-button");
33
+ return openBlock(), createElementBlock("div", _hoisted_1, [
34
+ _ctx.type == "back" ? (openBlock(), createElementBlock("div", {
35
+ key: 0,
36
+ class: "nut-audio-operate-item",
37
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.fastBack && _ctx.fastBack(...args))
38
+ }, [
39
+ !_ctx.customSlot ? (openBlock(), createBlock(_component_nut_button, {
40
+ key: 0,
41
+ type: "primary",
42
+ size: "small"
43
+ }, {
44
+ default: withCtx(() => [
45
+ createTextVNode(toDisplayString(_ctx.translate("back")), 1)
46
+ ]),
47
+ _: 1
48
+ })) : createCommentVNode("", true),
49
+ renderSlot(_ctx.$slots, "default")
50
+ ])) : createCommentVNode("", true),
51
+ _ctx.type == "play" ? (openBlock(), createElementBlock("div", {
52
+ key: 1,
53
+ class: "nut-audio-operate-item",
54
+ onClick: _cache[1] || (_cache[1] = (...args) => _ctx.changeStatus && _ctx.changeStatus(...args))
55
+ }, [
56
+ !_ctx.customSlot ? (openBlock(), createBlock(_component_nut_button, {
57
+ key: 0,
58
+ type: "primary",
59
+ size: "small"
60
+ }, {
61
+ default: withCtx(() => [
62
+ createTextVNode(toDisplayString(!_ctx.audioData.playing ? `${_ctx.translate("start")}` : `${_ctx.translate("pause")}`), 1)
63
+ ]),
64
+ _: 1
65
+ })) : createCommentVNode("", true),
66
+ renderSlot(_ctx.$slots, "default")
67
+ ])) : createCommentVNode("", true),
68
+ _ctx.type == "forward" ? (openBlock(), createElementBlock("div", {
69
+ key: 2,
70
+ class: "nut-audio-operate-item",
71
+ onClick: _cache[2] || (_cache[2] = (...args) => _ctx.forward && _ctx.forward(...args))
72
+ }, [
73
+ !_ctx.customSlot ? (openBlock(), createBlock(_component_nut_button, {
74
+ key: 0,
75
+ type: "primary",
76
+ size: "small"
77
+ }, {
78
+ default: withCtx(() => [
79
+ _hoisted_2
80
+ ]),
81
+ _: 1
82
+ })) : createCommentVNode("", true),
83
+ renderSlot(_ctx.$slots, "default")
84
+ ])) : createCommentVNode("", true),
85
+ _ctx.type == "mute" ? (openBlock(), createElementBlock("div", {
86
+ key: 3,
87
+ class: "nut-audio-operate-item",
88
+ onClick: _cache[3] || (_cache[3] = (...args) => _ctx.handleMute && _ctx.handleMute(...args))
89
+ }, [
90
+ !_ctx.customSlot ? (openBlock(), createBlock(_component_nut_button, {
91
+ key: 0,
92
+ type: !_ctx.audioData.hanMuted ? "primary" : "default",
93
+ size: "small"
94
+ }, {
95
+ default: withCtx(() => [
96
+ createTextVNode(toDisplayString(_ctx.translate("mute")), 1)
97
+ ]),
98
+ _: 1
99
+ }, 8, ["type"])) : createCommentVNode("", true),
100
+ renderSlot(_ctx.$slots, "default")
101
+ ])) : createCommentVNode("", true)
102
+ ]);
103
+ }
104
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
105
+ export { index as default };