cnhis-design-vue 3.3.2-beta.17 → 3.3.2-beta.19

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 (50) hide show
  1. package/README.md +87 -87
  2. package/es/components/audio-sdk/index.d.ts +172 -146
  3. package/es/components/audio-sdk/src/Index.vue.d.ts +173 -147
  4. package/es/components/audio-sdk/src/Index.vue2.js +131 -53
  5. package/es/components/audio-sdk/src/audioSDK.d.ts +29 -26
  6. package/es/components/audio-sdk/src/audioSDK.js +124 -42
  7. package/es/components/audio-sdk/src/components/readyCountdown.vue.d.ts +31 -0
  8. package/es/components/audio-sdk/src/components/readyCountdown.vue.js +6 -0
  9. package/es/components/audio-sdk/src/components/readyCountdown.vue2.js +46 -0
  10. package/es/components/audio-sdk/src/components/recording-modal.vue.d.ts +137 -10
  11. package/es/components/audio-sdk/src/components/recording.vue.d.ts +138 -11
  12. package/es/components/audio-sdk/src/components/recording.vue2.js +317 -74
  13. package/es/components/audio-sdk/src/hooks/useChartAudioContext.d.ts +24 -0
  14. package/es/components/audio-sdk/src/hooks/useChartAudioContext.js +176 -0
  15. package/es/components/audio-sdk/src/svgs/Close.vue.js +26 -0
  16. package/es/components/audio-sdk/src/svgs/Continue.vue.js +20 -0
  17. package/es/components/audio-sdk/src/svgs/Enlarge.vue.js +20 -0
  18. package/es/components/audio-sdk/src/svgs/Pause.vue.js +20 -0
  19. package/es/components/audio-sdk/src/svgs/WaveView.vue.js +20 -0
  20. package/es/components/audio-sdk/src/svgs/Zoom.vue.js +27 -0
  21. package/es/components/audio-sdk/src/types/index.d.ts +42 -0
  22. package/es/components/audio-sdk/src/types/index.js +10 -0
  23. package/es/components/audio-sdk/src/utils/recordingModal.d.ts +9 -3
  24. package/es/components/audio-sdk/src/utils/recordingModal.js +57 -32
  25. package/es/components/audio-sdk/style/index.css +1 -1
  26. package/es/components/button-print/index.d.ts +11 -4
  27. package/es/components/button-print/src/ButtonPrint.vue.d.ts +11 -4
  28. package/es/components/button-print/src/components/IdentityVerification.vue.d.ts +4 -2
  29. package/es/components/button-print/src/components/IdentityVerification.vue2.js +6 -2
  30. package/es/components/button-print/src/components/NewPrintComponent.vue.d.ts +7 -2
  31. package/es/components/button-print/src/components/NewPrintComponent.vue2.js +12 -2
  32. package/es/components/button-print/src/components/OldPrintComponent.vue.d.ts +4 -2
  33. package/es/components/button-print/src/components/Preview.vue.d.ts +5 -2
  34. package/es/components/button-print/src/components/Preview.vue2.js +6 -2
  35. package/es/components/button-print/src/utils/dialog.js +2 -2
  36. package/es/components/classification/src/components/table-modal/index.vue.d.ts +0 -3
  37. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +2 -1
  38. package/es/components/field-set/src/FieldColor.vue.d.ts +1 -1
  39. package/es/components/field-set/src/FieldFilter.vue.d.ts +1 -1
  40. package/es/components/field-set/src/FieldSet.vue.d.ts +1 -1
  41. package/es/components/field-set/src/components/table-row.vue.d.ts +1 -1
  42. package/es/components/form-render/src/components/renderer/textarea.js +4 -3
  43. package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
  44. package/es/components/index.css +1 -1
  45. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  46. package/es/env.d.ts +25 -25
  47. package/es/shared/package.json.js +1 -1
  48. package/package.json +2 -2
  49. package/es/components/audio-sdk/src/components/recording-modal.vue.js +0 -6
  50. package/es/components/audio-sdk/src/components/recording-modal.vue2.js +0 -40
@@ -1,18 +1,68 @@
1
- import { defineComponent, openBlock, createElementBlock, createBlock, unref, Fragment, createElementVNode, toDisplayString, createVNode, withCtx, createTextVNode, createCommentVNode } from 'vue';
2
- import { isString, isObject } from 'lodash-es';
3
- import { NSpin, NIcon, NButton } from 'naive-ui';
4
- import { Mic } from '@vicons/ionicons5';
5
- import axios from 'axios';
1
+ import { createElementVNode, defineComponent, toRefs, ref, computed, watch, openBlock, createElementBlock, normalizeClass, unref, createVNode, withCtx, createBlock, createCommentVNode, toDisplayString, withDirectives, vShow, isRef, createTextVNode } from 'vue';
2
+ import { NSpin, NIcon, NTooltip, NSpace, NButton } from 'naive-ui';
3
+ import { StopCircle, MicOff, PlayCircleOutline } from '@vicons/ionicons5';
4
+ import { useDebounceFn, promiseTimeout } from '@vueuse/core';
5
+ import { useChartAudioContext } from '../hooks/useChartAudioContext.js';
6
+ import ReadyCountdown from './readyCountdown.vue.js';
7
+ import CloseSvg from '../svgs/Close.vue.js';
8
+ import ZoomSvg from '../svgs/Zoom.vue.js';
9
+ import PauseSvg from '../svgs/Pause.vue.js';
10
+ import ContinueSvg from '../svgs/Continue.vue.js';
11
+ import EnlargeSvg from '../svgs/Enlarge.vue.js';
12
+ import WaveView from '../svgs/WaveView.vue.js';
6
13
 
7
14
  const _hoisted_1 = {
8
- class: "c-recording-wrapper"
15
+ key: 0,
16
+ class: "c-recording-small"
9
17
  };
10
18
  const _hoisted_2 = {
11
- class: "content"
19
+ class: "c-recording-chart-box-small-wrap"
12
20
  };
13
21
  const _hoisted_3 = {
14
- key: 0,
15
- class: "btns"
22
+ class: "c-recording-formatted-time"
23
+ };
24
+ const _hoisted_4 = {
25
+ class: "tip-small"
26
+ };
27
+ const _hoisted_5 = /* @__PURE__ */ createElementVNode("span", null, "\u6682\u505C", -1);
28
+ const _hoisted_6 = /* @__PURE__ */ createElementVNode("span", null, "\u7EE7\u7EED", -1);
29
+ const _hoisted_7 = /* @__PURE__ */ createElementVNode("span", null, function() {
30
+ var _a, _b, _c;
31
+ try {
32
+ return ((_a = window.getLanguageByCode) == null ? void 0 : _a.call(window, "10010.1.77")) || ((_c = (_b = window.top) == null ? void 0 : _b.getLanguageByCode) == null ? void 0 : _c.call(_b, "10010.1.77")) || "\u7ED3\u675F";
33
+ } catch (e) {
34
+ return "\u7ED3\u675F";
35
+ }
36
+ }(), -1);
37
+ const _hoisted_8 = /* @__PURE__ */ createElementVNode("span", {
38
+ class: "split-line"
39
+ }, null, -1);
40
+ const _hoisted_9 = /* @__PURE__ */ createElementVNode("span", null, "\u653E\u5927", -1);
41
+ const _hoisted_10 = {
42
+ key: 1,
43
+ class: "c-recording-top-wrap"
44
+ };
45
+ const _hoisted_11 = {
46
+ class: "c-recording-header"
47
+ };
48
+ const _hoisted_12 = /* @__PURE__ */ createElementVNode("span", null, "\u7F29\u5C0F", -1);
49
+ const _hoisted_13 = {
50
+ class: "c-recording-container"
51
+ };
52
+ const _hoisted_14 = {
53
+ class: "c-recording-status-section"
54
+ };
55
+ const _hoisted_15 = {
56
+ class: "c-recording-chart-box-wrap"
57
+ };
58
+ const _hoisted_16 = {
59
+ class: "tip"
60
+ };
61
+ const _hoisted_17 = {
62
+ class: "c-recording-formatted-time"
63
+ };
64
+ const _hoisted_18 = {
65
+ class: "content"
16
66
  };
17
67
  var _sfc_main = /* @__PURE__ */ defineComponent({
18
68
  __name: "recording",
@@ -35,85 +85,278 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
35
85
  },
36
86
  loading: {
37
87
  type: Boolean,
38
- default: true
88
+ default: false
89
+ },
90
+ wsConnected: {
91
+ type: Boolean,
92
+ default: false
39
93
  },
40
94
  fromSdk: {
41
95
  type: Boolean
96
+ },
97
+ show: {
98
+ type: Boolean,
99
+ default: false
100
+ },
101
+ startWaveViewMethod: {
102
+ type: Function
103
+ },
104
+ recorderStatus: {
105
+ type: String,
106
+ default: ""
42
107
  }
43
108
  },
44
- emits: ["close", "success", "end", "fail", "update:loading"],
109
+ emits: ["close", "success", "fail", "pause", "resume", "toAnalyzing", "heightChange"],
45
110
  setup(__props, {
46
- expose,
47
111
  emit
48
112
  }) {
49
113
  const props = __props;
50
- const consultationRecordUrl = "/flow/openApi/consultationRecord";
51
- function close() {
52
- emit("close");
53
- }
54
- async function toAnalyzing() {
55
- if (props.fromSdk)
56
- return close();
57
- emit("end");
58
- emit("update:loading", true);
59
- try {
60
- const audioText = isString(props.content) ? props.content : isObject(props.content) ? props.content.data : "";
61
- const {
62
- data
63
- } = await axios.post(consultationRecordUrl, {
64
- taskId: 1,
65
- audioText,
66
- intentionCode: props.intentionCode,
67
- configs: props.configs || {}
68
- }, {
69
- headers: {
70
- Authorization: `bearer ${props.token}`
71
- }
72
- });
73
- if (!(data == null ? void 0 : data.success)) {
74
- emit("fail", {
75
- result: "fail",
76
- msg: data.msg
77
- });
78
- return;
79
- }
80
- const json = (data == null ? void 0 : data.data) || {};
81
- emit("success", json);
82
- } catch (error) {
83
- emit("fail", error);
84
- } finally {
85
- emit("update:loading", false);
114
+ const {
115
+ loading,
116
+ content,
117
+ wsConnected,
118
+ recorderStatus
119
+ } = toRefs(props);
120
+ const audioChartRef = ref();
121
+ const audioChartSamllRef = ref();
122
+ const contentScrollRef = ref();
123
+ const {
124
+ isActive,
125
+ isWarning,
126
+ formattedTime,
127
+ isCountFinished,
128
+ isCountActive,
129
+ isZoomSmall,
130
+ pause,
131
+ btnDisabled,
132
+ handleEnd,
133
+ handlePause,
134
+ handlePlay,
135
+ handleZoom,
136
+ setWarningState,
137
+ startWarningTimer,
138
+ initStartWaveView,
139
+ cleanupState,
140
+ handleHeightChange
141
+ } = useChartAudioContext(props, emit, {
142
+ waveSelector: () => audioChartRef.value,
143
+ waveSelectorSmall: () => audioChartSamllRef.value
144
+ });
145
+ const onEnd = useDebounceFn(handleEnd, 500);
146
+ const onPause = useDebounceFn(handlePause, 500);
147
+ const onPlay = useDebounceFn(handlePlay, 500);
148
+ const onZoom = useDebounceFn(handleZoom, 500);
149
+ const isFailStatus = computed(() => recorderStatus.value === "fail");
150
+ const isActiveStatus = computed(() => !loading.value && isActive.value && !isWarning.value);
151
+ const isWarningStatus = computed(() => isFailStatus.value || !loading.value && isActive.value && isWarning.value);
152
+ const isPauseStatus = computed(() => !isFailStatus.value && (loading.value || !isActive.value));
153
+ const showContent = computed(() => isCountFinished.value && !!content.value);
154
+ const tip = computed(() => {
155
+ if (isFailStatus.value)
156
+ return "\u5F55\u97F3\u5F02\u5E38\uFF01";
157
+ if (loading.value)
158
+ return "\u5F55\u97F3\u8BC6\u522B\u4E2D...";
159
+ if (isActiveStatus.value)
160
+ return "\u6B63\u5728\u5F55\u97F3\u4E2D...";
161
+ if (isWarningStatus.value)
162
+ return "\u65E0\u8BED\u97F3\u5F55\u5165\uFF0C\u8BF7\u68C0\u6D4B\u662F\u5426\u5F55\u97F3\uFF01";
163
+ return "\u5DF2\u6682\u505C\u5F55\u97F3";
164
+ });
165
+ const tipSmall = computed(() => {
166
+ if (isFailStatus.value)
167
+ return "\u5F55\u5165\u5F02\u5E38";
168
+ if (loading.value)
169
+ return "\u8BC6\u522B\u4E2D...";
170
+ if (isActiveStatus.value)
171
+ return "\u5F55\u97F3\u4E2D...";
172
+ if (isWarningStatus.value)
173
+ return "\u5F55\u5165\u5F02\u5E38";
174
+ return "\u5DF2\u6682\u505C";
175
+ });
176
+ const showDom = computed(() => props.show && wsConnected.value && isCountFinished.value);
177
+ watch(() => props.show, async (val) => {
178
+ if (val || isFailStatus.value) {
179
+ cleanupState();
180
+ startWarningTimer(8e3);
181
+ } else {
182
+ pause == null ? void 0 : pause();
86
183
  }
87
- }
88
- expose({
89
- toAnalyzing
184
+ }, {
185
+ immediate: true
186
+ });
187
+ watch(() => showDom.value, (newVal) => {
188
+ if (!newVal || isFailStatus.value)
189
+ return;
190
+ initStartWaveView();
191
+ });
192
+ watch(() => isFailStatus.value, (newVal) => {
193
+ if (!newVal)
194
+ return;
195
+ isCountFinished.value = true;
196
+ cleanupState();
197
+ });
198
+ watch(() => content.value, async (value) => {
199
+ setWarningState(false);
200
+ startWarningTimer();
201
+ await promiseTimeout(10);
202
+ const scrollRef = contentScrollRef.value;
203
+ if (!scrollRef)
204
+ return;
205
+ await promiseTimeout(50);
206
+ requestAnimationFrame(() => {
207
+ scrollRef.scrollTop = scrollRef.scrollHeight;
208
+ });
209
+ });
210
+ watch(() => showContent.value, (newVal) => {
211
+ handleHeightChange(newVal);
90
212
  });
91
213
  return (_ctx, _cache) => {
92
- return openBlock(), createElementBlock("div", _hoisted_1, [__props.loading ? (openBlock(), createBlock(unref(NSpin), {
93
- key: 0,
94
- description: "\u52A0\u8F7D\u4E2D..."
95
- })) : (openBlock(), createElementBlock(Fragment, {
96
- key: 1
97
- }, [createElementVNode("p", _hoisted_2, toDisplayString(__props.content || "\u6B63\u5728\u8046\u542C..."), 1), createElementVNode("div", {
98
- class: "icon-box",
99
- onClick: toAnalyzing
100
- }, [createVNode(unref(NIcon), {
101
- size: "60",
102
- color: "#fff",
103
- component: unref(Mic)
104
- }, null, 8, ["component"])]), __props.showBtn ? (openBlock(), createElementBlock("div", _hoisted_3, [createVNode(unref(NButton), {
105
- type: "primary",
106
- onClick: toAnalyzing,
107
- disabled: !__props.content
214
+ return openBlock(), createElementBlock("div", {
215
+ class: normalizeClass(["c-recording-wrapper", {
216
+ "c-recording-wrapper-warning": unref(isWarningStatus),
217
+ "c-recording-wrapper-pause": unref(isPauseStatus),
218
+ "c-recording-wrapper-disabled": unref(loading),
219
+ "c-recording-wrapper-show_content": unref(showContent)
220
+ }])
221
+ }, [createVNode(unref(NSpin), {
222
+ show: !unref(wsConnected)
108
223
  }, {
109
- default: withCtx(() => [createTextVNode("\u7ED3\u675F\u5F55\u97F3")]),
110
- _: 1
111
- }, 8, ["disabled"]), createVNode(unref(NButton), {
112
- onClick: close
113
- }, {
114
- default: withCtx(() => [createTextVNode("\u53D6\u6D88\u5F55\u97F3")]),
224
+ default: withCtx(() => [unref(isZoomSmall) ? (openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [createElementVNode("div", {
225
+ ref_key: "audioChartSamllRef",
226
+ ref: audioChartSamllRef,
227
+ class: "c-recording-chart-box-small"
228
+ }, null, 512), unref(isPauseStatus) || unref(isWarningStatus) ? (openBlock(), createBlock(unref(NIcon), {
229
+ key: 0,
230
+ color: "#FF1818",
231
+ component: WaveView
232
+ })) : createCommentVNode("v-if", true)]), createElementVNode("div", _hoisted_3, toDisplayString(unref(formattedTime)), 1), createElementVNode("span", _hoisted_4, toDisplayString(unref(tipSmall)), 1), createVNode(unref(NTooltip), null, {
233
+ trigger: withCtx(() => [withDirectives(createVNode(unref(NIcon), {
234
+ component: PauseSvg,
235
+ onClick: unref(onPause)
236
+ }, null, 8, ["onClick"]), [[vShow, unref(isActive)]])]),
237
+ default: withCtx(() => [_hoisted_5]),
238
+ _: 1
239
+ }), createVNode(unref(NTooltip), null, {
240
+ trigger: withCtx(() => [withDirectives(createVNode(unref(NIcon), {
241
+ component: ContinueSvg,
242
+ onClick: unref(onPlay)
243
+ }, null, 8, ["onClick"]), [[vShow, !unref(isActive)]])]),
244
+ default: withCtx(() => [_hoisted_6]),
245
+ _: 1
246
+ }), createVNode(unref(NTooltip), null, {
247
+ trigger: withCtx(() => [createVNode(unref(NIcon), {
248
+ component: unref(StopCircle),
249
+ color: "#FF1818",
250
+ onClick: _cache[0] || (_cache[0] = () => unref(onEnd)("end"))
251
+ }, null, 8, ["component"])]),
252
+ default: withCtx(() => [_hoisted_7]),
253
+ _: 1
254
+ }), _hoisted_8, createVNode(unref(NTooltip), null, {
255
+ trigger: withCtx(() => [createVNode(unref(NIcon), {
256
+ component: EnlargeSvg,
257
+ onClick: unref(onZoom),
258
+ class: "c-recording-zoom-svg"
259
+ }, null, 8, ["onClick"])]),
260
+ default: withCtx(() => [_hoisted_9]),
261
+ _: 1
262
+ })])) : (openBlock(), createElementBlock("div", _hoisted_10, [createElementVNode("div", _hoisted_11, [createVNode(unref(NSpace), {
263
+ "wrap-item": false,
264
+ size: 16,
265
+ justify: "end"
266
+ }, {
267
+ default: withCtx(() => [!unref(btnDisabled) ? (openBlock(), createBlock(unref(NTooltip), {
268
+ key: 0
269
+ }, {
270
+ trigger: withCtx(() => [createVNode(unref(NIcon), {
271
+ size: 16,
272
+ onClick: unref(onZoom),
273
+ component: ZoomSvg
274
+ }, null, 8, ["onClick"])]),
275
+ default: withCtx(() => [_hoisted_12]),
276
+ _: 1
277
+ })) : createCommentVNode("v-if", true), createVNode(unref(NIcon), {
278
+ class: "audio-icon",
279
+ size: 16,
280
+ onClick: _cache[1] || (_cache[1] = () => unref(onEnd)("close")),
281
+ component: CloseSvg
282
+ })]),
283
+ _: 1
284
+ })]), createElementVNode("div", _hoisted_13, [createElementVNode("div", _hoisted_14, [!unref(isCountFinished) ? (openBlock(), createBlock(ReadyCountdown, {
285
+ key: 0,
286
+ isCountFinished: unref(isCountFinished),
287
+ "onUpdate:isCountFinished": _cache[2] || (_cache[2] = ($event) => isRef(isCountFinished) ? isCountFinished.value = $event : null),
288
+ isCountActive: unref(isCountActive)
289
+ }, null, 8, ["isCountFinished", "isCountActive"])) : (openBlock(), createBlock(unref(NSpace), {
290
+ key: 1,
291
+ vertical: "",
292
+ size: 4,
293
+ "wrap-item": false,
294
+ justify: "space-between",
295
+ align: "center"
296
+ }, {
297
+ default: withCtx(() => [createElementVNode("div", _hoisted_15, [createElementVNode("div", {
298
+ ref_key: "audioChartRef",
299
+ ref: audioChartRef,
300
+ class: "c-recording-chart-box"
301
+ }, null, 512)]), unref(isWarningStatus) ? (openBlock(), createBlock(unref(NIcon), {
302
+ key: 0,
303
+ size: "54",
304
+ color: "#FF1818",
305
+ component: unref(MicOff)
306
+ }, null, 8, ["component"])) : createCommentVNode("v-if", true), unref(isPauseStatus) ? (openBlock(), createBlock(unref(NIcon), {
307
+ key: 1,
308
+ size: "54",
309
+ color: "#FF1818",
310
+ component: unref(PlayCircleOutline)
311
+ }, null, 8, ["component"])) : createCommentVNode("v-if", true), createElementVNode("span", _hoisted_16, toDisplayString(unref(tip)), 1), createElementVNode("h3", _hoisted_17, toDisplayString(unref(formattedTime)), 1)]),
312
+ _: 1
313
+ }))]), createVNode(unref(NSpace), {
314
+ "wrap-item": false,
315
+ size: 15,
316
+ class: "c-recording-btn-section"
317
+ }, {
318
+ default: withCtx(() => [withDirectives(createVNode(unref(NButton), {
319
+ size: "large",
320
+ round: "",
321
+ disabled: unref(btnDisabled),
322
+ onClick: unref(onPause)
323
+ }, {
324
+ default: withCtx(() => [createTextVNode("\u6682\u505C")]),
325
+ _: 1
326
+ }, 8, ["disabled", "onClick"]), [[vShow, unref(isActive)]]), withDirectives(createVNode(unref(NButton), {
327
+ size: "large",
328
+ round: "",
329
+ disabled: unref(btnDisabled),
330
+ onClick: unref(onPlay)
331
+ }, {
332
+ default: withCtx(() => [createTextVNode("\u7EE7\u7EED")]),
333
+ _: 1
334
+ }, 8, ["disabled", "onClick"]), [[vShow, !unref(isActive)]]), createVNode(unref(NButton), {
335
+ round: "",
336
+ color: "#FF1818",
337
+ size: "large",
338
+ disabled: unref(btnDisabled),
339
+ onClick: _cache[3] || (_cache[3] = () => unref(onEnd)("end"))
340
+ }, {
341
+ default: withCtx(() => [createTextVNode(function() {
342
+ var _a, _b, _c;
343
+ try {
344
+ return ((_a = window.getLanguageByCode) == null ? void 0 : _a.call(window, "10010.1.77")) || ((_c = (_b = window.top) == null ? void 0 : _b.getLanguageByCode) == null ? void 0 : _c.call(_b, "10010.1.77")) || "\u7ED3\u675F";
345
+ } catch (e) {
346
+ return "\u7ED3\u675F";
347
+ }
348
+ }())]),
349
+ _: 1
350
+ }, 8, ["disabled"])]),
351
+ _: 1
352
+ })])])), unref(showContent) ? (openBlock(), createElementBlock("div", {
353
+ key: 2,
354
+ class: "c-recording-content-wrap",
355
+ ref_key: "contentScrollRef",
356
+ ref: contentScrollRef
357
+ }, [createElementVNode("p", _hoisted_18, toDisplayString(unref(content)), 1)], 512)) : createCommentVNode("v-if", true)]),
115
358
  _: 1
116
- })])) : createCommentVNode("v-if", true)], 64))]);
359
+ }, 8, ["show"])], 2);
117
360
  };
118
361
  }
119
362
  });
@@ -0,0 +1,24 @@
1
+ import { AnyObject, AnyFn } from '../../../../shared/types';
2
+ export declare function useChartAudioContext(props: AnyObject, emit: AnyFn, options: {
3
+ waveSelector: () => string | HTMLElement;
4
+ waveSelectorSmall: () => string | HTMLElement;
5
+ waveProps?: AnyObject;
6
+ }): {
7
+ isActive: import("vue").Ref<boolean>;
8
+ isWarning: import("vue").Ref<boolean>;
9
+ formattedTime: import("vue").ComputedRef<string>;
10
+ isCountFinished: import("vue").Ref<boolean>;
11
+ isCountActive: import("vue").Ref<boolean>;
12
+ isZoomSmall: import("vue").Ref<boolean>;
13
+ pause: any;
14
+ btnDisabled: import("vue").ComputedRef<any>;
15
+ handleEnd: (closeType?: string) => Promise<any>;
16
+ handlePause: () => Promise<void>;
17
+ handlePlay: () => Promise<void>;
18
+ handleZoom: () => Promise<void>;
19
+ setWarningState: (state: boolean) => void;
20
+ startWarningTimer: (initTime?: number) => void;
21
+ initStartWaveView: () => Promise<void>;
22
+ cleanupState: () => void;
23
+ handleHeightChange: (showContent: boolean) => void;
24
+ };
@@ -0,0 +1,176 @@
1
+ import { ref, computed, watch } from 'vue';
2
+ import { promiseTimeout, useIntervalFn } from '@vueuse/core';
3
+
4
+ function useChartAudioContext(props, emit, options) {
5
+ const isCountFinished = ref(false);
6
+ const isCountActive = ref(true);
7
+ const time = ref(0);
8
+ let warnTimer = null;
9
+ let warnCancelTimer = null;
10
+ const NO_CONTENT_DURATION = 5e3;
11
+ const warnTime = ref(5);
12
+ const isWarning = ref(false);
13
+ let pause = null;
14
+ let resume = null;
15
+ const isActive = ref(false);
16
+ const isZoomSmall = ref(false);
17
+ const initAudioTiming = () => {
18
+ pause = null;
19
+ resume = null;
20
+ const {
21
+ pause: pauseFn,
22
+ resume: resumeFn,
23
+ isActive: iIsActive
24
+ } = useIntervalFn(() => {
25
+ time.value++;
26
+ }, 1e3);
27
+ pause = pauseFn;
28
+ resume = resumeFn;
29
+ watch(iIsActive, (val) => {
30
+ isActive.value = val;
31
+ }, {
32
+ immediate: true
33
+ });
34
+ };
35
+ const btnDisabled = computed(() => props.loading || !isCountFinished.value || props.recorderStatus === "fail");
36
+ const formattedTime = computed(() => {
37
+ if (!time.value)
38
+ return "00:00";
39
+ const hours = Math.floor(time.value / 3600);
40
+ const minutes = Math.floor(time.value % 3600 / 60);
41
+ const seconds = time.value % 60;
42
+ const formattedMinutes = minutes.toString().padStart(2, "0");
43
+ const formattedSeconds = seconds.toString().padStart(2, "0");
44
+ if (hours > 0) {
45
+ const formattedHours = hours.toString().padStart(2, "0");
46
+ return `${formattedHours}:${formattedMinutes}:${formattedSeconds}`;
47
+ } else {
48
+ return `${formattedMinutes}:${formattedSeconds}`;
49
+ }
50
+ });
51
+ function startWarningTimer(initTime = NO_CONTENT_DURATION) {
52
+ warnTimer && clearInterval(warnTimer);
53
+ setWarningState(false);
54
+ warnTimer = setTimeout(() => {
55
+ setWarningState(true);
56
+ }, initTime);
57
+ }
58
+ function setWarningState(state) {
59
+ isWarning.value = state;
60
+ if (state) {
61
+ clearInterval(warnCancelTimer);
62
+ warnTime.value = 5;
63
+ warnCancelTimer = setInterval(() => {
64
+ if (warnTime.value > 0) {
65
+ warnTime.value--;
66
+ } else {
67
+ warnTime.value = 5;
68
+ clearInterval(warnCancelTimer);
69
+ startWarningTimer();
70
+ }
71
+ }, 1e3);
72
+ } else {
73
+ clearInterval(warnCancelTimer);
74
+ }
75
+ }
76
+ const cleanupState = () => {
77
+ isCountFinished.value = false;
78
+ isCountActive.value = true;
79
+ warnTimer && clearTimeout(warnTimer);
80
+ warnCancelTimer && clearInterval(warnCancelTimer);
81
+ time.value = 0;
82
+ warnTimer = null;
83
+ warnCancelTimer = null;
84
+ isWarning.value = false;
85
+ pause = null;
86
+ resume = null;
87
+ isActive.value = false;
88
+ };
89
+ const handleEnd = async (closeType = "close") => {
90
+ if (btnDisabled.value && closeType == "end")
91
+ return;
92
+ isCountActive.value = false;
93
+ const isEndSet = closeType == "end";
94
+ const isCloseSet = closeType == "close";
95
+ pause == null ? void 0 : pause();
96
+ if (props.fromSdk || closeType === "close") {
97
+ return emit("close", {
98
+ isEndSet,
99
+ isCloseSet
100
+ });
101
+ }
102
+ emit("toAnalyzing", {
103
+ isEndSet,
104
+ isCloseSet
105
+ });
106
+ };
107
+ const handlePause = async () => {
108
+ if (btnDisabled.value)
109
+ return;
110
+ pause == null ? void 0 : pause();
111
+ setWarningState(false);
112
+ warnTimer && clearTimeout(warnTimer);
113
+ emit("pause");
114
+ };
115
+ const handlePlay = async () => {
116
+ if (btnDisabled.value)
117
+ return;
118
+ resume();
119
+ startWarningTimer();
120
+ emit("resume");
121
+ };
122
+ const handleHeightChange = (showContent) => {
123
+ let cH = isZoomSmall.value ? 60 : 284;
124
+ if (showContent) {
125
+ cH = isZoomSmall.value ? 212 : 404;
126
+ }
127
+ emit("heightChange", cH);
128
+ };
129
+ const handleZoom = async () => {
130
+ var _a;
131
+ if (btnDisabled.value)
132
+ return;
133
+ isZoomSmall.value = !isZoomSmall.value;
134
+ await promiseTimeout(50);
135
+ handleHeightChange(isCountFinished.value && props.content);
136
+ if (!props.startWaveViewMethod || typeof props.startWaveViewMethod !== "function")
137
+ return;
138
+ (_a = props.startWaveViewMethod) == null ? void 0 : _a.call(props, {
139
+ waveSelector: isZoomSmall.value ? options.waveSelectorSmall : options.waveSelector,
140
+ waveProps: {
141
+ widthRatio: isZoomSmall.value ? 0.4 : 0.5,
142
+ lineCount: isZoomSmall.value ? 3 : 30,
143
+ minHeight: isZoomSmall.value ? 4 : 2
144
+ }
145
+ });
146
+ };
147
+ const initStartWaveView = async () => {
148
+ var _a;
149
+ initAudioTiming();
150
+ await promiseTimeout(50);
151
+ (_a = props.startWaveViewMethod) == null ? void 0 : _a.call(props, {
152
+ waveSelector: options.waveSelector
153
+ });
154
+ };
155
+ return {
156
+ isActive,
157
+ isWarning,
158
+ formattedTime,
159
+ isCountFinished,
160
+ isCountActive,
161
+ isZoomSmall,
162
+ pause,
163
+ btnDisabled,
164
+ handleEnd,
165
+ handlePause,
166
+ handlePlay,
167
+ handleZoom,
168
+ setWarningState,
169
+ startWarningTimer,
170
+ initStartWaveView,
171
+ cleanupState,
172
+ handleHeightChange
173
+ };
174
+ }
175
+
176
+ export { useChartAudioContext };
@@ -0,0 +1,26 @@
1
+ import { openBlock, createElementBlock, createElementVNode } from 'vue';
2
+ import _export_sfc from '../../../../_virtual/_plugin-vue_export-helper.js';
3
+
4
+ const _sfc_main = {};
5
+ const _hoisted_1 = {
6
+ t: "1709016977682",
7
+ class: "icon",
8
+ viewBox: "0 0 1024 1024",
9
+ version: "1.1",
10
+ xmlns: "http://www.w3.org/2000/svg",
11
+ "p-id": "33595",
12
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
13
+ width: "32",
14
+ height: "32"
15
+ };
16
+ const _hoisted_2 = /* @__PURE__ */ createElementVNode("path", {
17
+ d: "M512 432.448l353.92-353.92a56.128 56.128 0 0 1 96 39.68 56.192 56.192 0 0 1-16.448 39.808L591.552 512l353.92 353.92a56.192 56.192 0 1 1-79.552 79.552L512 591.552l-353.92 353.92a56.128 56.128 0 0 1-96-39.68c0-14.976 5.888-29.312 16.448-39.808L432.448 512l-353.92-353.92a56.128 56.128 0 0 1 39.68-96c14.976 0 29.312 5.888 39.808 16.448L512 432.448z",
18
+ "p-id": "33596"
19
+ }, null, -1);
20
+ const _hoisted_3 = [_hoisted_2];
21
+ function _sfc_render(_ctx, _cache) {
22
+ return openBlock(), createElementBlock("svg", _hoisted_1, _hoisted_3);
23
+ }
24
+ var CloseSvg = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "Close.vue"]]);
25
+
26
+ export { CloseSvg as default };
@@ -0,0 +1,20 @@
1
+ import { openBlock, createElementBlock, createStaticVNode } from 'vue';
2
+ import _export_sfc from '../../../../_virtual/_plugin-vue_export-helper.js';
3
+
4
+ const _sfc_main = {};
5
+ const _hoisted_1 = {
6
+ width: "32px",
7
+ height: "32.3232323px",
8
+ viewBox: "0 0 32 32.3232323",
9
+ version: "1.1",
10
+ xmlns: "http://www.w3.org/2000/svg",
11
+ "xmlns:xlink": "http://www.w3.org/1999/xlink"
12
+ };
13
+ const _hoisted_2 = /* @__PURE__ */ createStaticVNode('<g id="\u7535\u5B50\u75C5\u5386" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="\u753B\u677F" transform="translate(-1430, -727)"><g id="\u7F16\u7EC4-10" transform="translate(111, 186)"><g id="\u7F16\u7EC4-9" transform="translate(1136, 532)"><g id="\u7EE7\u7EED\u5F55\u97F3" transform="translate(183, 9)"><ellipse id="\u692D\u5706\u5F62" fill-opacity="0.08" fill="#5F58E0" cx="16" cy="16.1616162" rx="16" ry="16.1616162"></ellipse><g id="\u7F16\u7EC4" transform="translate(10.4, 8.0808)" fill="#464646"><path d="M12.1419265,9.33720245 L2.22486107,15.9250123 C1.56119513,16.3700919 0.663665944,16.16807 0.233863237,15.4799327 C0.0774276935,15.236875 0,14.9543599 0,14.6718448 L0,1.49622514 C0,0.686559003 0.663665944,0 1.44426351,0 C1.71763067,0 1.99099783,0.0804931245 2.22486107,0.24305767 L12.1419265,6.83086751 C12.8055924,7.27594714 13.0015319,8.20556381 12.5717292,8.89212282 C12.4532174,9.05468736 12.3362858,9.21567361 12.1419265,9.33720245 L12.1419265,9.33720245 Z" id="\u8DEF\u5F84"></path></g></g></g></g></g></g>', 1);
14
+ const _hoisted_3 = [_hoisted_2];
15
+ function _sfc_render(_ctx, _cache) {
16
+ return openBlock(), createElementBlock("svg", _hoisted_1, _hoisted_3);
17
+ }
18
+ var ContinueSvg = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "Continue.vue"]]);
19
+
20
+ export { ContinueSvg as default };