@nutui/nutui 4.0.11 → 4.0.12

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 (158) hide show
  1. package/dist/nutui.es.js +1 -1
  2. package/dist/nutui.js +2 -2
  3. package/dist/nutui.umd.js +1 -1
  4. package/dist/packages/_es/ActionSheet.js +111 -78
  5. package/dist/packages/_es/Address.js +375 -250
  6. package/dist/packages/_es/AddressList.js +354 -269
  7. package/dist/packages/_es/Animate.js +58 -41
  8. package/dist/packages/_es/Audio.js +197 -128
  9. package/dist/packages/_es/AudioOperate.js +71 -60
  10. package/dist/packages/_es/Avatar.js +89 -66
  11. package/dist/packages/_es/AvatarGroup.js +31 -23
  12. package/dist/packages/_es/Backtop.js +99 -59
  13. package/dist/packages/_es/Badge.js +47 -36
  14. package/dist/packages/_es/Barrage.js +147 -68
  15. package/dist/packages/_es/Button.js +66 -47
  16. package/dist/packages/_es/Calendar.js +157 -135
  17. package/dist/packages/_es/CalendarItem.js +6 -6
  18. package/dist/packages/_es/Card.js +56 -42
  19. package/dist/packages/_es/Cascader.js +474 -315
  20. package/dist/packages/_es/Category.js +39 -29
  21. package/dist/packages/_es/CategoryPane.js +83 -57
  22. package/dist/packages/_es/Cell.js +71 -56
  23. package/dist/packages/_es/CellGroup.js +27 -19
  24. package/dist/packages/_es/Checkbox.js +156 -109
  25. package/dist/packages/_es/CheckboxGroup.js +59 -38
  26. package/dist/packages/_es/CircleProgress.js +96 -67
  27. package/dist/packages/_es/Col.js +31 -23
  28. package/dist/packages/_es/Collapse.js +58 -33
  29. package/dist/packages/_es/CollapseItem.js +108 -78
  30. package/dist/packages/_es/Comment.js +279 -207
  31. package/dist/packages/_es/ConfigProvider.js +55 -37
  32. package/dist/packages/_es/Countdown.js +212 -100
  33. package/dist/packages/_es/Countup.js +445 -232
  34. package/dist/packages/_es/DatePicker.js +265 -162
  35. package/dist/packages/_es/Dialog.js +213 -161
  36. package/dist/packages/_es/Divider.js +57 -42
  37. package/dist/packages/_es/Drag.js +153 -70
  38. package/dist/packages/_es/Ecard.js +104 -64
  39. package/dist/packages/_es/Elevator.js +219 -143
  40. package/dist/packages/_es/Ellipsis.js +178 -95
  41. package/dist/packages/_es/Empty.js +39 -23
  42. package/dist/packages/_es/FixedNav.js +116 -93
  43. package/dist/packages/_es/Form.js +178 -107
  44. package/dist/packages/_es/FormItem.js +61 -48
  45. package/dist/packages/_es/Grid.js +6 -5
  46. package/dist/packages/_es/GridItem.js +84 -58
  47. package/dist/packages/_es/Image.js +130 -90
  48. package/dist/packages/_es/ImagePreview.js +412 -256
  49. package/dist/packages/_es/Indicator.js +34 -30
  50. package/dist/packages/_es/InfiniteLoading.js +136 -83
  51. package/dist/packages/_es/Input.js +264 -160
  52. package/dist/packages/_es/InputNumber.js +117 -81
  53. package/dist/packages/_es/Interceptor-956b24fc.js +29 -0
  54. package/dist/packages/_es/Invoice.js +130 -104
  55. package/dist/packages/_es/Layout.js +4 -3
  56. package/dist/packages/_es/List.js +215 -117
  57. package/dist/packages/_es/Menu.js +150 -95
  58. package/dist/packages/_es/MenuItem.js +154 -109
  59. package/dist/packages/_es/Navbar.js +119 -103
  60. package/dist/packages/_es/Noticebar.js +312 -197
  61. package/dist/packages/_es/Notify.js +166 -110
  62. package/dist/packages/_es/NumberKeyboard.js +202 -127
  63. package/dist/packages/_es/Overlay.js +80 -52
  64. package/dist/packages/_es/Pagination.js +100 -70
  65. package/dist/packages/_es/Picker.js +437 -275
  66. package/dist/packages/_es/Popover.js +225 -122
  67. package/dist/packages/_es/Popup.js +4 -4
  68. package/dist/packages/_es/Price.js +82 -44
  69. package/dist/packages/_es/Progress.js +79 -63
  70. package/dist/packages/_es/PullRefresh.js +173 -95
  71. package/dist/packages/_es/Radio.js +4 -4
  72. package/dist/packages/_es/RadioGroup.js +3 -3
  73. package/dist/packages/_es/Range.js +347 -204
  74. package/dist/packages/_es/Rate.js +141 -92
  75. package/dist/packages/_es/Row.js +27 -21
  76. package/dist/packages/_es/Searchbar.js +174 -123
  77. package/dist/packages/_es/ShortPassword.js +93 -69
  78. package/dist/packages/_es/SideNavbar.js +80 -49
  79. package/dist/packages/_es/SideNavbarItem.js +32 -22
  80. package/dist/packages/_es/Signature.js +146 -83
  81. package/dist/packages/_es/Skeleton.js +130 -110
  82. package/dist/packages/_es/Sku.js +343 -250
  83. package/dist/packages/_es/Step.js +86 -59
  84. package/dist/packages/_es/Steps.js +31 -26
  85. package/dist/packages/_es/Sticky.js +4 -4
  86. package/dist/packages/_es/SubSideNavbar.js +74 -52
  87. package/dist/packages/_es/Swipe.js +155 -83
  88. package/dist/packages/_es/Swiper.js +311 -174
  89. package/dist/packages/_es/SwiperItem.js +44 -28
  90. package/dist/packages/_es/Switch.js +68 -55
  91. package/dist/packages/_es/TabPane.js +41 -30
  92. package/dist/packages/_es/Tabbar.js +52 -41
  93. package/dist/packages/_es/TabbarItem.js +82 -61
  94. package/dist/packages/_es/Table.js +165 -109
  95. package/dist/packages/_es/Tabs.js +388 -240
  96. package/dist/packages/_es/Tag.js +61 -44
  97. package/dist/packages/_es/Textarea.js +124 -80
  98. package/dist/packages/_es/TimeDetail.js +76 -49
  99. package/dist/packages/_es/TimePannel.js +48 -34
  100. package/dist/packages/_es/TimeSelect.js +68 -47
  101. package/dist/packages/_es/Toast.js +218 -144
  102. package/dist/packages/_es/Tour.js +192 -138
  103. package/dist/packages/_es/TrendArrow.js +77 -57
  104. package/dist/packages/_es/Uploader.js +359 -234
  105. package/dist/packages/_es/Video.js +316 -191
  106. package/dist/packages/_es/Watermark.js +117 -84
  107. package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +10 -0
  108. package/dist/packages/_es/common-b9a5e726.js +145 -0
  109. package/dist/packages/_es/component-81a4c1d0.js +145 -0
  110. package/dist/packages/_es/index-29892cda.js +33 -0
  111. package/dist/packages/_es/index-43c34ac6.js +30 -0
  112. package/dist/packages/_es/index-54d03fc1.js +8 -0
  113. package/dist/packages/_es/index-79c5dc33.js +10 -0
  114. package/dist/packages/_es/index-7a7385e4.js +67 -0
  115. package/dist/packages/_es/index-87422be8.js +942 -0
  116. package/dist/packages/_es/index-da0a7662.js +259 -0
  117. package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +46 -0
  118. package/dist/packages/_es/index.vue_vue_type_script_lang-a8856969.js +97 -0
  119. package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +151 -0
  120. package/dist/packages/_es/mountComponent-8b24c346.js +39 -0
  121. package/dist/packages/_es/pxCheck-c6b9f6b7.js +6 -0
  122. package/dist/packages/_es/raf-729dad54.js +25 -0
  123. package/dist/packages/_es/renderIcon-3d0fd47c.js +9 -0
  124. package/dist/packages/locale/lang/baseLang-3a8457ac.js +5 -0
  125. package/dist/packages/locale/lang/en-US.js +39 -36
  126. package/dist/packages/locale/lang/id-ID.js +39 -36
  127. package/dist/packages/locale/lang/index.js +44 -22
  128. package/dist/packages/locale/lang/zh-CN.js +38 -35
  129. package/dist/packages/locale/lang/zh-TW.js +38 -35
  130. package/dist/resolver/index.js +26 -1
  131. package/dist/resolver/index.mjs +17 -14
  132. package/dist/smartips/web-types.json +1 -1
  133. package/dist/style.css +1 -1
  134. package/dist/styles/themes/default.scss +48 -48
  135. package/dist/styles/themes/jdb.scss +48 -48
  136. package/dist/styles/themes/jddkh.scss +48 -48
  137. package/dist/styles/themes/jdt.scss +48 -48
  138. package/dist/types/index.d.ts +1 -1
  139. package/package.json +3 -4
  140. package/dist/packages/_es/Interceptor-6e26b757.js +0 -18
  141. package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +0 -9
  142. package/dist/packages/_es/common-d218746f.js +0 -116
  143. package/dist/packages/_es/component-234624bc.js +0 -89
  144. package/dist/packages/_es/index-14dfadc4.js +0 -561
  145. package/dist/packages/_es/index-192a3ef6.js +0 -29
  146. package/dist/packages/_es/index-360c5092.js +0 -210
  147. package/dist/packages/_es/index-496e6e05.js +0 -24
  148. package/dist/packages/_es/index-50eed3d9.js +0 -7
  149. package/dist/packages/_es/index-53ec2d4d.js +0 -34
  150. package/dist/packages/_es/index-fadb0974.js +0 -8
  151. package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +0 -43
  152. package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +0 -77
  153. package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +0 -110
  154. package/dist/packages/_es/mountComponent-6d4ff200.js +0 -23
  155. package/dist/packages/_es/pxCheck-38173291.js +0 -4
  156. package/dist/packages/_es/raf-a74f1a06.js +0 -16
  157. package/dist/packages/_es/renderIcon-47498b32.js +0 -5
  158. package/dist/packages/locale/lang/baseLang-0bdc6353.js +0 -5
@@ -1,20 +1,28 @@
1
- var f = Object.defineProperty, k = Object.defineProperties;
2
- var v = Object.getOwnPropertyDescriptors;
3
- var r = Object.getOwnPropertySymbols;
4
- var y = Object.prototype.hasOwnProperty, C = Object.prototype.propertyIsEnumerable;
5
- var c = (e, t, o) => t in e ? f(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o, p = (e, t) => {
6
- for (var o in t || (t = {}))
7
- y.call(t, o) && c(e, o, t[o]);
8
- if (r)
9
- for (var o of r(t))
10
- C.call(t, o) && c(e, o, t[o]);
11
- return e;
12
- }, u = (e, t) => k(e, v(t));
13
- import { toRefs as d, reactive as $, computed as S, openBlock as _, createElementBlock as g, createElementVNode as h, normalizeClass as B, normalizeStyle as N, renderSlot as w } from "vue";
14
- import { c as z } from "./component-234624bc.js";
15
- import { _ as E } from "./_plugin-vue_export-helper-dad06003.js";
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
+ import { toRefs, reactive, computed, openBlock, createElementBlock, createElementVNode, normalizeClass, normalizeStyle, renderSlot } from "vue";
21
+ import { c as createComponent } from "./component-81a4c1d0.js";
22
+ import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
16
23
  import "../locale/lang";
17
- const { componentName: b, create: D } = z("animate"), R = D({
24
+ const { componentName, create } = createComponent("animate");
25
+ const _sfc_main = create({
18
26
  props: {
19
27
  type: {
20
28
  type: String,
@@ -26,44 +34,53 @@ const { componentName: b, create: D } = z("animate"), R = D({
26
34
  },
27
35
  loop: {
28
36
  type: Boolean,
29
- default: !1
37
+ default: false
30
38
  },
31
39
  duration: {
32
40
  type: [String, Number]
33
41
  }
34
42
  },
35
43
  emits: ["click"],
36
- setup(e, { emit: t }) {
37
- const { type: o, loop: n, action: l } = d(e), a = $({
38
- clicked: !1
44
+ setup(props, { emit }) {
45
+ const { type, loop, action } = toRefs(props);
46
+ const state = reactive({
47
+ clicked: false
48
+ });
49
+ let classes = computed(() => {
50
+ const prefixCls = componentName;
51
+ return {
52
+ "nut-animate__container": true,
53
+ [`${prefixCls}-${type.value}`]: action.value === "initial" || state.clicked ? type.value : false,
54
+ loop: loop.value
55
+ };
39
56
  });
40
- let i = S(() => ({
41
- "nut-animate__container": !0,
42
- [`${b}-${o.value}`]: l.value === "initial" || a.clicked ? o.value : !1,
43
- loop: n.value
44
- }));
45
- const m = (s) => {
46
- a.clicked = !0, n.value || setTimeout(() => {
47
- a.clicked = !1;
48
- }, 1e3), t("click", s);
57
+ const handleClick = (event) => {
58
+ state.clicked = true;
59
+ if (!loop.value) {
60
+ setTimeout(() => {
61
+ state.clicked = false;
62
+ }, 1e3);
63
+ }
64
+ emit("click", event);
49
65
  };
50
- return u(p({}, d(a)), { classes: i, handleClick: m });
66
+ return __spreadProps(__spreadValues({}, toRefs(state)), { classes, handleClick });
51
67
  }
52
- }), T = { class: "nut-animate" };
53
- function V(e, t, o, n, l, a) {
54
- return _(), g("view", T, [
55
- h("view", {
56
- class: B(e.classes),
57
- onClick: t[0] || (t[0] = (...i) => e.handleClick && e.handleClick(...i)),
58
- style: N({
59
- animationDuration: e.duration ? `${e.duration}ms` : void 0
68
+ });
69
+ const _hoisted_1 = { class: "nut-animate" };
70
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
71
+ return openBlock(), createElementBlock("view", _hoisted_1, [
72
+ createElementVNode("view", {
73
+ class: normalizeClass(_ctx.classes),
74
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args)),
75
+ style: normalizeStyle({
76
+ animationDuration: _ctx.duration ? `${_ctx.duration}ms` : void 0
60
77
  })
61
78
  }, [
62
- w(e.$slots, "default")
79
+ renderSlot(_ctx.$slots, "default")
63
80
  ], 6)
64
81
  ]);
65
82
  }
66
- const G = /* @__PURE__ */ E(R, [["render", V]]);
83
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
67
84
  export {
68
- G as default
85
+ index as default
69
86
  };
@@ -1,24 +1,32 @@
1
- var I = Object.defineProperty, z = Object.defineProperties;
2
- var L = Object.getOwnPropertyDescriptors;
3
- var C = Object.getOwnPropertySymbols;
4
- var U = Object.prototype.hasOwnProperty, j = Object.prototype.propertyIsEnumerable;
5
- var M = (e, n, i) => n in e ? I(e, n, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[n] = i, g = (e, n) => {
6
- for (var i in n || (n = {}))
7
- U.call(n, i) && M(e, i, n[i]);
8
- if (C)
9
- for (var i of C(n))
10
- j.call(n, i) && M(e, i, n[i]);
11
- return e;
12
- }, B = (e, n) => z(e, L(n));
13
- import { ref as q, reactive as A, onMounted as F, watch as G, provide as H, toRefs as b, resolveComponent as _, openBlock as s, createElementBlock as p, createElementVNode as l, toDisplayString as E, createVNode as J, withCtx as K, createCommentVNode as m, normalizeClass as O, createBlock as V, renderSlot as w } from "vue";
14
- import { c as Q } from "./component-234624bc.js";
15
- import { Service as W } from "@nutui/icons-vue";
16
- import P from "./Range.js";
17
- import { _ as X } from "./_plugin-vue_export-helper-dad06003.js";
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
+ import { ref, reactive, onMounted, watch, provide, toRefs, resolveComponent, openBlock, createElementBlock, createElementVNode, toDisplayString, createVNode, withCtx, createCommentVNode, normalizeClass, createBlock, renderSlot } from "vue";
21
+ import { c as createComponent } from "./component-81a4c1d0.js";
22
+ import { Service } from "@nutui/icons-vue";
23
+ import Range from "./Range.js";
24
+ import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
18
25
  import "../locale/lang";
19
- import "./index-53ec2d4d.js";
20
- import "./index-192a3ef6.js";
21
- const { componentName: he, create: Y } = Q("audio"), Z = Y({
26
+ import "./index-7a7385e4.js";
27
+ import "./index-29892cda.js";
28
+ const { componentName, create } = createComponent("audio");
29
+ const _sfc_main = create({
22
30
  props: {
23
31
  url: {
24
32
  type: String,
@@ -27,17 +35,17 @@ const { componentName: he, create: Y } = Q("audio"), Z = Y({
27
35
  // 静音
28
36
  muted: {
29
37
  type: Boolean,
30
- default: !1
38
+ default: false
31
39
  },
32
40
  // 自动播放
33
41
  autoplay: {
34
42
  type: Boolean,
35
- default: !1
43
+ default: false
36
44
  },
37
45
  // 循环播放
38
46
  loop: {
39
47
  type: Boolean,
40
- default: !1
48
+ default: false
41
49
  },
42
50
  // 是否预加载音频
43
51
  preload: {
@@ -56,150 +64,211 @@ const { componentName: he, create: Y } = Q("audio"), Z = Y({
56
64
  }
57
65
  },
58
66
  components: {
59
- Service: W,
60
- [P.name]: P
67
+ Service,
68
+ [Range.name]: Range
61
69
  },
62
70
  emits: ["fastBack", "play", "forward", "ended", "changeProgress", "mute", "can-play"],
63
- setup(e, { emit: n, slots: i }) {
64
- const u = q(null), t = A({
71
+ setup(props, { emit, slots }) {
72
+ const audioRef = ref(null);
73
+ const audioData = reactive({
65
74
  currentTime: 0,
66
75
  currentDuration: "00:00:00",
67
76
  percent: 0,
68
77
  duration: "00:00:00",
69
78
  second: 0,
70
- hanMuted: e.muted,
71
- playing: e.autoplay,
72
- handPlaying: !1
79
+ hanMuted: props.muted,
80
+ playing: props.autoplay,
81
+ handPlaying: false
73
82
  });
74
- F(() => {
75
- var o = ["webkitVisibilityState", "visibilitychange"];
83
+ onMounted(() => {
84
+ var arr = ["webkitVisibilityState", "visibilitychange"];
76
85
  try {
77
- for (let a = 0; a < o.length; a++)
78
- document.addEventListener(o[a], () => {
79
- document.hidden ? u.value.pause() : t.playing && setTimeout(() => {
80
- u.value.play();
81
- }, 200);
86
+ for (let i = 0; i < arr.length; i++) {
87
+ document.addEventListener(arr[i], () => {
88
+ if (document.hidden) {
89
+ audioRef.value.pause();
90
+ } else {
91
+ if (audioData.playing) {
92
+ setTimeout(() => {
93
+ audioRef.value.play();
94
+ }, 200);
95
+ }
96
+ }
82
97
  });
83
- } catch (a) {
84
- console.log(a.message);
98
+ }
99
+ } catch (e) {
100
+ console.log(e.message);
85
101
  }
86
102
  });
87
- const h = (o) => {
88
- const a = u.value;
89
- e.autoplay && a && a.paused && a.play(), t.second = a.duration, t.duration = S(a.duration), n("can-play", o);
90
- }, y = (o) => {
91
- t.currentTime = parseInt(o.target.currentTime);
92
- }, d = () => {
93
- t.currentTime > 0 && t.currentTime--, u.value.currentTime = t.currentTime, n("fastBack", t.currentTime);
94
- }, r = () => {
95
- const o = u.value;
96
- t.playing ? (o.pause(), t.handPlaying = !1) : (o.play(), t.handPlaying = !0), t.playing = !t.playing, n("play", t.playing);
97
- }, v = () => {
98
- t.currentTime++, u.value.currentTime = t.currentTime, n("forward", t.currentTime);
99
- }, R = (o) => {
100
- t.currentDuration = S(o), t.percent = o / t.second * 100;
101
- }, $ = () => {
102
- t.playing = !1, n("ended");
103
- }, D = (o) => {
104
- const a = u.value;
105
- a.currentTime = t.second * o / 100, n("changeProgress", a.currentTime);
106
- }, T = () => {
107
- t.hanMuted = !t.hanMuted, n("mute", t.hanMuted);
108
- }, S = (o) => {
109
- if (!o)
103
+ const onCanplay = (e) => {
104
+ const audioR = audioRef.value;
105
+ if (props.autoplay) {
106
+ if (audioR && audioR.paused) {
107
+ audioR.play();
108
+ }
109
+ }
110
+ audioData.second = audioR.duration;
111
+ audioData.duration = formatSeconds(audioR.duration);
112
+ emit("can-play", e);
113
+ };
114
+ const onTimeupdate = (e) => {
115
+ audioData.currentTime = parseInt(e.target.currentTime);
116
+ };
117
+ const fastBack = () => {
118
+ if (audioData.currentTime > 0) {
119
+ audioData.currentTime--;
120
+ }
121
+ audioRef.value.currentTime = audioData.currentTime;
122
+ emit("fastBack", audioData.currentTime);
123
+ };
124
+ const changeStatus = () => {
125
+ const audioR = audioRef.value;
126
+ if (audioData.playing) {
127
+ audioR.pause();
128
+ audioData.handPlaying = false;
129
+ } else {
130
+ audioR.play();
131
+ audioData.handPlaying = true;
132
+ }
133
+ audioData.playing = !audioData.playing;
134
+ emit("play", audioData.playing);
135
+ };
136
+ const forward = () => {
137
+ audioData.currentTime++;
138
+ audioRef.value.currentTime = audioData.currentTime;
139
+ emit("forward", audioData.currentTime);
140
+ };
141
+ const handle = (val) => {
142
+ audioData.currentDuration = formatSeconds(val);
143
+ audioData.percent = val / audioData.second * 100;
144
+ };
145
+ const audioEnd = () => {
146
+ audioData.playing = false;
147
+ emit("ended");
148
+ };
149
+ const progressChange = (val) => {
150
+ const ar = audioRef.value;
151
+ ar.currentTime = audioData.second * val / 100;
152
+ emit("changeProgress", ar.currentTime);
153
+ };
154
+ const handleMute = () => {
155
+ audioData.hanMuted = !audioData.hanMuted;
156
+ emit("mute", audioData.hanMuted);
157
+ };
158
+ const formatSeconds = (value) => {
159
+ if (!value) {
110
160
  return "00:00:00";
111
- let a = parseInt(o), f = Math.floor(a / 3600), k = Math.floor((a - f * 3600) / 60), N = a - f * 3600 - k * 60, c = "";
112
- return c += ("0" + f.toString()).slice(-2) + ":", c += ("0" + k.toString()).slice(-2) + ":", c += ("0" + N.toString()).slice(-2), c;
161
+ }
162
+ let time = parseInt(value);
163
+ let hours = Math.floor(time / 3600);
164
+ let minutes = Math.floor((time - hours * 3600) / 60);
165
+ let seconds = time - hours * 3600 - minutes * 60;
166
+ let result = "";
167
+ result += ("0" + hours.toString()).slice(-2) + ":";
168
+ result += ("0" + minutes.toString()).slice(-2) + ":";
169
+ result += ("0" + seconds.toString()).slice(-2);
170
+ return result;
113
171
  };
114
- return G(
115
- () => t.currentTime,
116
- (o) => {
117
- R(o);
172
+ watch(
173
+ () => audioData.currentTime,
174
+ (value) => {
175
+ handle(value);
118
176
  }
119
- ), H("audioParent", {
177
+ );
178
+ provide("audioParent", {
120
179
  children: [],
121
- props: e,
122
- audioData: t,
123
- handleMute: T,
124
- forward: v,
125
- fastBack: d,
126
- changeStatus: r
127
- }), B(g(g({}, b(e)), b(t)), {
128
- audioRef: u,
129
- fastBack: d,
130
- forward: v,
131
- changeStatus: r,
132
- progressChange: D,
133
- audioEnd: $,
134
- onTimeupdate: y,
135
- handleMute: T,
136
- onCanplay: h,
137
- slots: i
180
+ props,
181
+ audioData,
182
+ handleMute,
183
+ forward,
184
+ fastBack,
185
+ changeStatus
186
+ });
187
+ return __spreadProps(__spreadValues(__spreadValues({}, toRefs(props)), toRefs(audioData)), {
188
+ audioRef,
189
+ fastBack,
190
+ forward,
191
+ changeStatus,
192
+ progressChange,
193
+ audioEnd,
194
+ onTimeupdate,
195
+ handleMute,
196
+ onCanplay,
197
+ slots
138
198
  });
139
199
  }
140
- }), x = { class: "nut-audio" }, ee = {
200
+ });
201
+ const _hoisted_1 = { class: "nut-audio" };
202
+ const _hoisted_2 = {
141
203
  key: 0,
142
204
  class: "nut-audio__progress"
143
- }, ne = { class: "nut-audio__time" }, te = { class: "nut-audio__bar" }, oe = /* @__PURE__ */ l("div", { class: "nut-audio__button--custom" }, null, -1), ae = { class: "nut-audio__time" }, re = {
205
+ };
206
+ const _hoisted_3 = { class: "nut-audio__time" };
207
+ const _hoisted_4 = { class: "nut-audio__bar" };
208
+ const _hoisted_5 = /* @__PURE__ */ createElementVNode("div", { class: "nut-audio__button--custom" }, null, -1);
209
+ const _hoisted_6 = { class: "nut-audio__time" };
210
+ const _hoisted_7 = {
144
211
  key: 1,
145
212
  class: "nut-audio__icon"
146
- }, ie = ["controls", "src", "preload", "autoplay", "loop", "muted"];
147
- function ue(e, n, i, u, t, h) {
148
- const y = _("nut-range"), d = _("Service");
149
- return s(), p("div", x, [
150
- e.type == "progress" ? (s(), p("div", ee, [
151
- l("div", ne, E(e.currentDuration), 1),
152
- l("div", te, [
153
- J(y, {
154
- modelValue: e.percent,
155
- "onUpdate:modelValue": n[0] || (n[0] = (r) => e.percent = r),
213
+ };
214
+ const _hoisted_8 = ["controls", "src", "preload", "autoplay", "loop", "muted"];
215
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
216
+ const _component_nut_range = resolveComponent("nut-range");
217
+ const _component_Service = resolveComponent("Service");
218
+ return openBlock(), createElementBlock("div", _hoisted_1, [
219
+ _ctx.type == "progress" ? (openBlock(), createElementBlock("div", _hoisted_2, [
220
+ createElementVNode("div", _hoisted_3, toDisplayString(_ctx.currentDuration), 1),
221
+ createElementVNode("div", _hoisted_4, [
222
+ createVNode(_component_nut_range, {
223
+ modelValue: _ctx.percent,
224
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.percent = $event),
156
225
  "hidden-range": "",
157
- onChange: e.progressChange,
226
+ onChange: _ctx.progressChange,
158
227
  "inactive-color": "#cccccc",
159
228
  "active-color": "#fa2c19"
160
229
  }, {
161
- button: K(() => [
162
- oe
230
+ button: withCtx(() => [
231
+ _hoisted_5
163
232
  ]),
164
233
  _: 1
165
234
  }, 8, ["modelValue", "onChange"])
166
235
  ]),
167
- l("div", ae, E(e.duration), 1)
168
- ])) : m("", !0),
169
- e.type == "icon" ? (s(), p("div", re, [
170
- l("div", {
171
- class: O(["nut-audio__icon--box", e.playing ? "nut-audio__icon--play" : "nut-audio__icon--stop"]),
172
- onClick: n[1] || (n[1] = (...r) => e.changeStatus && e.changeStatus(...r))
236
+ createElementVNode("div", _hoisted_6, toDisplayString(_ctx.duration), 1)
237
+ ])) : createCommentVNode("", true),
238
+ _ctx.type == "icon" ? (openBlock(), createElementBlock("div", _hoisted_7, [
239
+ createElementVNode("div", {
240
+ class: normalizeClass(["nut-audio__icon--box", _ctx.playing ? "nut-audio__icon--play" : "nut-audio__icon--stop"]),
241
+ onClick: _cache[1] || (_cache[1] = (...args) => _ctx.changeStatus && _ctx.changeStatus(...args))
173
242
  }, [
174
- e.playing ? (s(), V(d, {
243
+ _ctx.playing ? (openBlock(), createBlock(_component_Service, {
175
244
  key: 0,
176
245
  class: "nut-icon-am-rotate nut-icon-am-infinite"
177
- })) : (s(), V(d, { key: 1 }))
246
+ })) : (openBlock(), createBlock(_component_Service, { key: 1 }))
178
247
  ], 2)
179
- ])) : m("", !0),
180
- e.type == "none" ? (s(), p("div", {
248
+ ])) : createCommentVNode("", true),
249
+ _ctx.type == "none" ? (openBlock(), createElementBlock("div", {
181
250
  key: 2,
182
- onClick: n[2] || (n[2] = (...r) => e.changeStatus && e.changeStatus(...r))
251
+ onClick: _cache[2] || (_cache[2] = (...args) => _ctx.changeStatus && _ctx.changeStatus(...args))
183
252
  }, [
184
- w(e.$slots, "default")
185
- ])) : m("", !0),
186
- e.type != "none" ? w(e.$slots, "default", { key: 3 }) : m("", !0),
187
- l("audio", {
253
+ renderSlot(_ctx.$slots, "default")
254
+ ])) : createCommentVNode("", true),
255
+ _ctx.type != "none" ? renderSlot(_ctx.$slots, "default", { key: 3 }) : createCommentVNode("", true),
256
+ createElementVNode("audio", {
188
257
  class: "audioMain",
189
- controls: e.type == "controls",
258
+ controls: _ctx.type == "controls",
190
259
  ref: "audioRef",
191
- src: e.url,
192
- preload: e.preload,
193
- autoplay: e.autoplay,
194
- loop: e.loop,
195
- onTimeupdate: n[3] || (n[3] = (...r) => e.onTimeupdate && e.onTimeupdate(...r)),
196
- onCanplay: n[4] || (n[4] = (...r) => e.onCanplay && e.onCanplay(...r)),
197
- onEnded: n[5] || (n[5] = (...r) => e.audioEnd && e.audioEnd(...r)),
198
- muted: e.hanMuted
199
- }, null, 40, ie)
260
+ src: _ctx.url,
261
+ preload: _ctx.preload,
262
+ autoplay: _ctx.autoplay,
263
+ loop: _ctx.loop,
264
+ onTimeupdate: _cache[3] || (_cache[3] = (...args) => _ctx.onTimeupdate && _ctx.onTimeupdate(...args)),
265
+ onCanplay: _cache[4] || (_cache[4] = (...args) => _ctx.onCanplay && _ctx.onCanplay(...args)),
266
+ onEnded: _cache[5] || (_cache[5] = (...args) => _ctx.audioEnd && _ctx.audioEnd(...args)),
267
+ muted: _ctx.hanMuted
268
+ }, null, 40, _hoisted_8)
200
269
  ]);
201
270
  }
202
- const ve = /* @__PURE__ */ X(Z, [["render", ue]]);
271
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
203
272
  export {
204
- ve as default
273
+ index as default
205
274
  };