cnhis-design-vue 3.3.2-release.2 → 3.3.3-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.
- package/README.md +87 -87
- package/es/components/audio-sdk/index.d.ts +22 -9
- package/es/components/audio-sdk/src/Index.vue.d.ts +22 -9
- package/es/components/audio-sdk/src/Index.vue2.js +5 -1
- package/es/components/audio-sdk/src/audioSDK.d.ts +6 -53
- package/es/components/audio-sdk/src/audioSDK.js +67 -425
- package/es/components/audio-sdk/src/components/recording-modal.vue.d.ts +5 -5
- package/es/components/audio-sdk/src/components/recording.vue.d.ts +5 -5
- package/es/components/audio-sdk/src/types/index.d.ts +1 -1
- package/es/components/button-print/index.d.ts +2 -0
- package/es/components/button-print/src/ButtonPrint.vue.d.ts +2 -0
- package/es/components/button-print/src/ButtonPrint.vue2.js +6 -1
- package/es/components/button-print/src/components/NewPrintComponent.vue.d.ts +1 -0
- package/es/components/button-print/src/components/NewPrintComponent.vue2.js +20 -8
- package/es/components/callback/src/components/render/popupMaps.d.ts +2 -2
- package/es/components/classification/src/components/table-modal/index.vue.d.ts +3 -0
- package/es/components/field-set/src/FieldColor.vue.d.ts +1 -1
- package/es/components/field-set/src/FieldFilter.vue.d.ts +1 -1
- package/es/components/field-set/src/FieldSet.vue.d.ts +11 -1
- package/es/components/field-set/src/FieldSet.vue2.js +7 -1
- package/es/components/field-set/src/components/table-row.vue.d.ts +1 -1
- package/es/components/form-config/index.d.ts +35 -5
- package/es/components/form-config/src/FormConfig.vue.d.ts +35 -5
- package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +28 -4
- package/es/components/form-config/src/components/FormConfigEventSetting.vue.d.ts +7 -1
- package/es/components/form-render/index.js +1 -1
- package/es/components/form-render/src/components/renderer/date.js +64 -55
- package/es/components/form-render/src/components/renderer/radio_checkbox.js +8 -9
- package/es/components/form-render/src/hooks/useFieldListAdaptor.js +2 -2
- package/es/components/form-render/src/hooks/useFieldNormalize.js +6 -2
- package/es/components/form-render/src/types/fieldItem.d.ts +9 -1
- package/es/components/form-render/src/utils/business.d.ts +2 -1
- package/es/components/form-render/src/utils/business.js +45 -2
- package/es/components/form-render/src/utils/index.js +1 -1
- package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
- package/es/components/iho-table/index.d.ts +2 -2
- package/es/components/iho-table/src/IhoTable.vue.d.ts +2 -2
- package/es/components/iho-table/src/IhoTable.vue2.js +6 -6
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/selectUtils.js +17 -3
- package/es/components/index.js +1 -1
- package/es/components/scale-view/index.d.ts +13 -0
- package/es/components/scale-view/src/ScaleView.vue.d.ts +13 -0
- package/es/components/scale-view/src/ScaleView.vue2.js +4 -4
- package/es/components/scale-view/src/hooks/scaleview-computed.js +12 -7
- package/es/components/scale-view/src/hooks/scaleview-init.js +3 -3
- package/es/components/scale-view/src/hooks/scaleview-props.d.ts +4 -0
- package/es/components/scale-view/src/hooks/scaleview-props.js +4 -0
- package/es/components/shortcut-setter/index.d.ts +7 -1
- package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +7 -1
- package/es/env.d.ts +25 -25
- package/es/shared/package.json.js +1 -1
- package/package.json +3 -2
@@ -1,15 +1,14 @@
|
|
1
|
-
import {
|
2
|
-
import axios from 'axios';
|
3
|
-
import { isString, isObject } from 'lodash-es';
|
4
|
-
import { EMPTY_MP3 } from './constants/index.js';
|
5
|
-
import { loadRecorderPlugins } from './utils/recorder/index.js';
|
6
|
-
import { ref } from 'vue';
|
1
|
+
import { ref, computed } from 'vue';
|
7
2
|
import { $message } from './utils/index.js';
|
8
3
|
import { RecordingModal } from './utils/recordingModal.js';
|
9
|
-
import {
|
10
|
-
import { promiseTimeout } from '@vueuse/core';
|
11
|
-
import Recorder from './utils/recorder/recorder.js';
|
4
|
+
import { setAudioSDKEnv, AudioSDK as AudioSDK$1 } from '@cnhis-frontend/audio-sdk';
|
12
5
|
|
6
|
+
setAudioSDKEnv({
|
7
|
+
reactiveDecorator: ref,
|
8
|
+
toast: {
|
9
|
+
warn: (message) => $message.warning(message)
|
10
|
+
}
|
11
|
+
});
|
13
12
|
const DEFAULT_OPTIONS = {
|
14
13
|
showModal: true,
|
15
14
|
allowPunctuationMark: true,
|
@@ -23,132 +22,41 @@ const DEFAULT_OPTIONS = {
|
|
23
22
|
lastChunkTimeout: 2e3,
|
24
23
|
wsTimeout: 5e3
|
25
24
|
};
|
26
|
-
const
|
25
|
+
const _AudioSDK2 = class {
|
27
26
|
constructor() {
|
28
|
-
this.
|
29
|
-
this.
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
this.timer = null;
|
41
|
-
this.recordingModal = new RecordingModal();
|
42
|
-
this.contentRef = ref("");
|
43
|
-
this.wsConnected = ref(false);
|
44
|
-
this.loading = ref(false);
|
45
|
-
this.pauseContent = "";
|
46
|
-
this.recorderStatus = ref("");
|
47
|
-
this.recorderClosing = ref(false);
|
48
|
-
this.waveView = null;
|
49
|
-
this.messageResolver = null;
|
50
|
-
this.lastChunkTimer = null;
|
51
|
-
if (_AudioSDK.instance)
|
52
|
-
return _AudioSDK.instance;
|
53
|
-
_AudioSDK.instance = this;
|
54
|
-
}
|
55
|
-
static create() {
|
56
|
-
return new _AudioSDK();
|
57
|
-
}
|
58
|
-
initRecorder() {
|
59
|
-
this.recorder = Recorder({
|
60
|
-
type: "mp3",
|
61
|
-
sampleRate: 16e3,
|
62
|
-
bitRate: 16,
|
63
|
-
onProcess: this.handleProcess.bind(this),
|
64
|
-
takeoffEncodeChunk: this.handleChunk.bind(this)
|
27
|
+
this._audioSDK = null;
|
28
|
+
this.contentRef = computed({
|
29
|
+
get() {
|
30
|
+
var _a, _b, _c;
|
31
|
+
return (_c = (_b = (_a = _AudioSDK2.instance) == null ? void 0 : _a._audioSDK) == null ? void 0 : _b.contentRef.value) != null ? _c : "";
|
32
|
+
},
|
33
|
+
set(value) {
|
34
|
+
var _a;
|
35
|
+
if (!((_a = _AudioSDK2.instance) == null ? void 0 : _a._audioSDK))
|
36
|
+
return;
|
37
|
+
return _AudioSDK2.instance._audioSDK.contentRef.value = value;
|
38
|
+
}
|
65
39
|
});
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
this.wsConnected.value = false;
|
70
|
-
Object.assign(this.options, DEFAULT_OPTIONS, options);
|
71
|
-
if (!this.checkEnvironment()) {
|
72
|
-
this.recorderStatus.value = "fail";
|
73
|
-
return Promise.reject({
|
74
|
-
result: "fail",
|
75
|
-
msg: "\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u5F55\u97F3"
|
76
|
-
});
|
77
|
-
}
|
78
|
-
if (!this.recorder)
|
79
|
-
this.initRecorder();
|
80
|
-
this.reqId = uuidGenerator();
|
81
|
-
this.pauseContent = "";
|
82
|
-
this.contentRef.value = "";
|
83
|
-
if (this.options.type === "websocket") {
|
84
|
-
this.setWsConnected(false);
|
85
|
-
await this.setupWebSocket();
|
86
|
-
} else {
|
87
|
-
this.setWsConnected(true);
|
88
|
-
}
|
89
|
-
return this.startRecording();
|
90
|
-
}
|
91
|
-
setWsConnected(wsConnected) {
|
92
|
-
this.wsConnected.value = wsConnected;
|
93
|
-
}
|
94
|
-
async setupWebSocket() {
|
95
|
-
if (this.connectionState === AudioTypes.ConnectionState.CONNECTED)
|
96
|
-
return this.setWsConnected(true);
|
97
|
-
return new Promise((resolve, reject) => {
|
98
|
-
const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
|
99
|
-
const url = this.options.origin || `${protocol}//${window.location.host}${this.options.wsOrigin}`;
|
100
|
-
this.webSocket = new WebSocket(url);
|
101
|
-
this.connectionState = AudioTypes.ConnectionState.CONNECTING;
|
102
|
-
const timeout = setTimeout(() => {
|
103
|
-
this.cleanupWebSocket();
|
104
|
-
reject({
|
105
|
-
result: "fail",
|
106
|
-
wsTimeout: true,
|
107
|
-
msg: "\u8FDE\u63A5\u8D85\u65F6"
|
108
|
-
});
|
109
|
-
}, this.options.wsTimeout);
|
110
|
-
this.webSocket.onopen = () => {
|
111
|
-
clearTimeout(timeout);
|
112
|
-
this.connectionState = AudioTypes.ConnectionState.CONNECTED;
|
113
|
-
this.setWsConnected(true);
|
114
|
-
resolve();
|
115
|
-
};
|
116
|
-
this.webSocket.onmessage = this.handleMessage.bind(this);
|
117
|
-
this.webSocket.onerror = () => this.handleError("WebSocket\u8FDE\u63A5\u9519\u8BEF");
|
118
|
-
this.webSocket.onclose = () => {
|
119
|
-
this.cleanupWebSocket();
|
120
|
-
clearTimeout(timeout);
|
121
|
-
this.recorderStatus.value = "ws_close";
|
122
|
-
};
|
40
|
+
this.wsConnected = computed(() => {
|
41
|
+
var _a, _b;
|
42
|
+
return (_b = (_a = _AudioSDK2.instance) == null ? void 0 : _a._audioSDK) == null ? void 0 : _b.connectMap.websocket.wsConnected.value;
|
123
43
|
});
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
this.messageQueue.push({
|
128
|
-
resolve,
|
129
|
-
reject
|
130
|
-
});
|
131
|
-
this.recorder.open(() => {
|
132
|
-
this.startTimestamp = Date.now();
|
133
|
-
this.recorder.start();
|
134
|
-
if (this.options.timed) {
|
135
|
-
this.timer = setTimeout(() => this.stop({
|
136
|
-
timeout: true,
|
137
|
-
isEndSet: true
|
138
|
-
}), this.options.timed * 1e3);
|
139
|
-
}
|
140
|
-
this.recorderStatus.value = "recording";
|
141
|
-
if (this.options.showModal) {
|
142
|
-
this.showRecordingModal();
|
143
|
-
}
|
144
|
-
}, (msg, isUserNotAllow) => {
|
145
|
-
this.handleError(msg, isUserNotAllow);
|
146
|
-
});
|
44
|
+
this.recorderStatus = computed(() => {
|
45
|
+
var _a, _b;
|
46
|
+
return ((_b = (_a = _AudioSDK2.instance) == null ? void 0 : _a._audioSDK) == null ? void 0 : _b.audioFailed.value) ? "fail" : "";
|
147
47
|
});
|
48
|
+
this.recordingModal = new RecordingModal();
|
49
|
+
if (_AudioSDK2.instance)
|
50
|
+
return _AudioSDK2.instance;
|
51
|
+
_AudioSDK2.instance = this;
|
52
|
+
this._audioSDK = new AudioSDK$1();
|
53
|
+
}
|
54
|
+
static create() {
|
55
|
+
return new _AudioSDK2();
|
148
56
|
}
|
149
57
|
showRecordingModal() {
|
150
58
|
this.recordingModal.show({
|
151
|
-
instance: this.options.instance,
|
59
|
+
instance: this._audioSDK.options.instance,
|
152
60
|
onClose: async (obj) => await this.stop(obj),
|
153
61
|
startWaveViewMethod: (options) => this.startWaveView(options),
|
154
62
|
pause: () => this.pause(),
|
@@ -160,323 +68,57 @@ const _AudioSDK = class {
|
|
160
68
|
}
|
161
69
|
});
|
162
70
|
}
|
163
|
-
|
164
|
-
this.
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
}
|
179
|
-
updateAudioVisualization(buffers, powerLevel, sampleRate) {
|
180
|
-
if (!this.waveView)
|
181
|
-
return;
|
182
|
-
this.waveView.input(buffers[buffers.length - 1], powerLevel, sampleRate);
|
183
|
-
}
|
184
|
-
handleChunk(chunk) {
|
185
|
-
if (this.messageResolver)
|
186
|
-
return;
|
187
|
-
if (chunk)
|
188
|
-
this.sendBuffer.push(chunk);
|
189
|
-
if (this.options.type === "http")
|
190
|
-
return;
|
191
|
-
const currentTime = Date.now();
|
192
|
-
if (currentTime - this.startTimestamp < this.options.wsSendInterval)
|
193
|
-
return;
|
194
|
-
this.sendBufferedData();
|
195
|
-
this.startTimestamp = currentTime;
|
196
|
-
}
|
197
|
-
sendBufferedData(isLast = false) {
|
198
|
-
const merged = this.mergeBuffers();
|
199
|
-
if (this.options.wsType === "chunk") {
|
200
|
-
this.sendBuffer = [];
|
201
|
-
}
|
202
|
-
if (merged.length === 0 && !isLast) {
|
203
|
-
return;
|
204
|
-
}
|
205
|
-
const blob = new Blob([merged], {
|
206
|
-
type: "audio/mp3"
|
207
|
-
});
|
208
|
-
this.sendBlob(blob, isLast);
|
209
|
-
}
|
210
|
-
mergeBuffers() {
|
211
|
-
const total = this.sendBuffer.reduce((sum, {
|
212
|
-
length
|
213
|
-
}) => sum + length, 0);
|
214
|
-
const result = new Uint8Array(total);
|
215
|
-
this.sendBuffer.reduce((offset, buf) => {
|
216
|
-
result.set(buf, offset);
|
217
|
-
return offset + buf.length;
|
218
|
-
}, 0);
|
219
|
-
return result;
|
220
|
-
}
|
221
|
-
sendBlob(blob, isLast = false) {
|
222
|
-
const reader = new FileReader();
|
223
|
-
reader.onloadend = () => {
|
224
|
-
var _a, _b;
|
225
|
-
let base64 = (_a = reader.result) == null ? void 0 : _a.toString().split(",")[1];
|
226
|
-
if (isLast && !base64)
|
227
|
-
base64 = EMPTY_MP3;
|
228
|
-
if (!base64)
|
229
|
-
return;
|
230
|
-
(_b = this.webSocket) == null ? void 0 : _b.send(JSON.stringify({
|
231
|
-
type: 1,
|
232
|
-
isLast,
|
233
|
-
data: base64,
|
234
|
-
auth: this.options.token,
|
235
|
-
reqId: this.reqId
|
236
|
-
}));
|
237
|
-
};
|
238
|
-
reader.readAsDataURL(blob);
|
71
|
+
async start(options) {
|
72
|
+
return this._audioSDK.start(Object.assign(DEFAULT_OPTIONS, options, {
|
73
|
+
afterRecordStart: () => {
|
74
|
+
if (this._audioSDK.options.showModal) {
|
75
|
+
this.showRecordingModal();
|
76
|
+
}
|
77
|
+
},
|
78
|
+
beforeStop: () => {
|
79
|
+
var _a, _b;
|
80
|
+
(_b = (_a = this.recordingModal) == null ? void 0 : _a.setLoading) == null ? void 0 : _b.call(_a);
|
81
|
+
},
|
82
|
+
afterStop: () => {
|
83
|
+
this.recordingModal.hide();
|
84
|
+
}
|
85
|
+
}));
|
239
86
|
}
|
240
87
|
async stop(params = {}) {
|
241
|
-
var _a
|
242
|
-
|
243
|
-
|
244
|
-
this.recorderClosing.value = true;
|
245
|
-
(_b = (_a = this.recordingModal) == null ? void 0 : _a.setLoading) == null ? void 0 : _b.call(_a);
|
246
|
-
clearTimeout(this.timer);
|
247
|
-
!params.isErrorSet && (this.recorderStatus.value = "stop");
|
248
|
-
try {
|
249
|
-
if (this.options.type === "http") {
|
250
|
-
await this.processHttpRecording();
|
251
|
-
} else {
|
252
|
-
this.sendBufferedData(true);
|
253
|
-
await new Promise((resolve) => {
|
254
|
-
this.messageResolver = resolve;
|
255
|
-
this.lastChunkTimer = setTimeout(resolve, this.options.lastChunkTimeout);
|
256
|
-
});
|
257
|
-
this.messageResolver = null;
|
258
|
-
}
|
259
|
-
await this.cleanupResources();
|
260
|
-
this.cleanupWebSocket();
|
261
|
-
if (params.isEndSet && !this.contentRef.value) {
|
88
|
+
var _a;
|
89
|
+
params.beforeResolve = () => {
|
90
|
+
if (params.isEndSet && !this.contentRef.value)
|
262
91
|
this.handleError("\u5F55\u97F3\u5185\u5BB9\u4E3A\u7A7A", false, "warning", "stop");
|
263
|
-
|
264
|
-
|
265
|
-
}
|
266
|
-
this.resolvePendingRequest(params);
|
267
|
-
this.recordingModal.hide();
|
268
|
-
this.recorderClosing.value = false;
|
269
|
-
} catch (err) {
|
270
|
-
console.log(err);
|
271
|
-
this.recorderClosing.value = false;
|
272
|
-
}
|
273
|
-
}
|
274
|
-
resolvePendingRequest(params) {
|
275
|
-
const handler = this.messageQueue.shift();
|
276
|
-
if (!handler)
|
277
|
-
return;
|
278
|
-
const result = {
|
279
|
-
result: "success",
|
280
|
-
data: params.isCloseSet ? "" : this.contentRef.value,
|
281
|
-
timeout: params.timeout
|
92
|
+
if (params.isCloseSet)
|
93
|
+
this.contentRef.value = "";
|
282
94
|
};
|
283
|
-
|
284
|
-
}
|
285
|
-
async processHttpRecording() {
|
286
|
-
var _a, _b, _c;
|
287
|
-
try {
|
288
|
-
this.loading.value = true;
|
289
|
-
const Authorization = `bearer ${this.options.token}`;
|
290
|
-
const blob = new Blob([this.mergeBuffers()], {
|
291
|
-
type: "audio/mp3"
|
292
|
-
});
|
293
|
-
const file = new File([blob], `${uuidGenerator()}.mp3`);
|
294
|
-
const formData = new FormData();
|
295
|
-
formData.append("file", file);
|
296
|
-
const {
|
297
|
-
data
|
298
|
-
} = await axios.post(this.options.uploadOrigin, formData, {
|
299
|
-
headers: {
|
300
|
-
Authorization,
|
301
|
-
"Content-Type": "multipart/form-data"
|
302
|
-
}
|
303
|
-
});
|
304
|
-
if (!(data == null ? void 0 : data.success)) {
|
305
|
-
this.handleError((_a = data == null ? void 0 : data.msg) != null ? _a : "\u4E0A\u4F20\u6587\u4EF6\u5931\u8D25");
|
306
|
-
return;
|
307
|
-
}
|
308
|
-
const {
|
309
|
-
data: result
|
310
|
-
} = await axios.post(this.options.recognizeOrigin, {}, {
|
311
|
-
headers: {
|
312
|
-
Authorization
|
313
|
-
},
|
314
|
-
params: {
|
315
|
-
audioUrl: data.data,
|
316
|
-
channel: "DOUBAO_SP"
|
317
|
-
}
|
318
|
-
});
|
319
|
-
if (!(result == null ? void 0 : result.success)) {
|
320
|
-
this.handleError((_b = result == null ? void 0 : result.msg) != null ? _b : "\u8BED\u97F3\u8BC6\u522B\u5931\u8D25");
|
321
|
-
return;
|
322
|
-
}
|
323
|
-
this.contentRef.value = ((_c = result == null ? void 0 : result.data) == null ? void 0 : _c.text) || "";
|
324
|
-
} catch (error) {
|
325
|
-
this.handleError(this.getErrorMessage(error));
|
326
|
-
} finally {
|
327
|
-
this.loading.value = false;
|
328
|
-
}
|
329
|
-
}
|
330
|
-
getErrorMessage(error) {
|
331
|
-
if (isString(error))
|
332
|
-
return error;
|
333
|
-
if (isObject(error) && "message" in error)
|
334
|
-
return error.message;
|
335
|
-
return "\u672A\u77E5\u9519\u8BEF";
|
336
|
-
}
|
337
|
-
handleMessage(event) {
|
338
|
-
const {
|
339
|
-
data: {
|
340
|
-
data,
|
341
|
-
isLast
|
342
|
-
} = {
|
343
|
-
data: "",
|
344
|
-
isLast: false
|
345
|
-
},
|
346
|
-
success,
|
347
|
-
msg
|
348
|
-
} = this.parseMessageData(event.data) || {};
|
349
|
-
if (!success) {
|
350
|
-
this.handleError(msg || "\u670D\u52A1\u5F02\u5E38");
|
351
|
-
return;
|
352
|
-
}
|
353
|
-
if (data) {
|
354
|
-
const _data = this.pauseContent + data;
|
355
|
-
this.contentRef.value = this.options.allowPunctuationMark ? _data : _data.replace(/[??,。,.\s]/g, "");
|
356
|
-
}
|
357
|
-
isLast && this.handleLastChunk();
|
358
|
-
}
|
359
|
-
handleLastChunk() {
|
360
|
-
if (this.lastChunkTimer) {
|
361
|
-
clearTimeout(this.lastChunkTimer);
|
362
|
-
this.lastChunkTimer = null;
|
363
|
-
}
|
364
|
-
if (this.messageResolver) {
|
365
|
-
this.messageResolver();
|
366
|
-
this.messageResolver = null;
|
367
|
-
}
|
368
|
-
}
|
369
|
-
parseMessageData(data) {
|
370
|
-
if (!isString(data))
|
371
|
-
return {
|
372
|
-
success: true
|
373
|
-
};
|
374
|
-
try {
|
375
|
-
const res = JSON.parse(data);
|
376
|
-
if (!isObject(res))
|
377
|
-
return {
|
378
|
-
success: true
|
379
|
-
};
|
380
|
-
return res;
|
381
|
-
} catch (e) {
|
382
|
-
return {
|
383
|
-
success: true
|
384
|
-
};
|
385
|
-
}
|
95
|
+
return (_a = this._audioSDK) == null ? void 0 : _a.stop(params);
|
386
96
|
}
|
387
97
|
async handleError(msg, isUserNotAllow = false, messageType = "error", errorType) {
|
388
|
-
|
389
|
-
|
390
|
-
return;
|
391
|
-
const error = {
|
392
|
-
result: "fail",
|
393
|
-
msg,
|
394
|
-
isUserNotAllow
|
395
|
-
};
|
396
|
-
this.recorderStatus.value = "fail";
|
397
|
-
errorType != "stop" && await this.stop({
|
398
|
-
isErrorSet: true
|
399
|
-
});
|
400
|
-
if (isUserNotAllow) {
|
401
|
-
$message.warning("\u8BF7\u5F00\u542F\u9EA6\u514B\u98CE\u6743\u9650");
|
402
|
-
} else if (msg) {
|
403
|
-
$message[messageType](msg);
|
404
|
-
}
|
405
|
-
handler.reject(error);
|
406
|
-
}
|
407
|
-
cleanupWebSocket() {
|
408
|
-
var _a, _b;
|
409
|
-
(_b = (_a = this.webSocket) == null ? void 0 : _a.close) == null ? void 0 : _b.call(_a);
|
410
|
-
this.webSocket = null;
|
411
|
-
this.connectionState = AudioTypes.ConnectionState.DISCONNECTED;
|
412
|
-
}
|
413
|
-
async cleanupResources() {
|
414
|
-
var _a, _b;
|
415
|
-
await ((_b = (_a = this.recorder) == null ? void 0 : _a.close) == null ? void 0 : _b.call(_a));
|
416
|
-
this.sendBuffer = [];
|
417
|
-
this.startTimestamp = 0;
|
418
|
-
}
|
419
|
-
resetState() {
|
420
|
-
this.recorderStatus.value = "";
|
421
|
-
this.cleanupResources();
|
422
|
-
clearTimeout(this.timer);
|
423
|
-
}
|
424
|
-
checkEnvironment() {
|
425
|
-
if (!window.isSecureContext && navigator.userAgent.includes("Chrome")) {
|
426
|
-
$message.warning("\u5F53\u524D\u73AF\u5883\u9700\u8981\u5B89\u5168\u4E0A\u4E0B\u6587\u624D\u80FD\u4F7F\u7528\u5F55\u97F3\u529F\u80FD");
|
427
|
-
return false;
|
428
|
-
}
|
429
|
-
return true;
|
430
|
-
}
|
431
|
-
cleanupWaveView() {
|
432
|
-
if (!this.waveView)
|
433
|
-
return;
|
434
|
-
this.waveView.elem = null;
|
435
|
-
this.waveView.canvas = null;
|
436
|
-
this.waveView = null;
|
98
|
+
var _a;
|
99
|
+
return (_a = this._audioSDK) == null ? void 0 : _a.handleError(msg, isUserNotAllow);
|
437
100
|
}
|
438
101
|
async startWaveView(options) {
|
439
|
-
|
440
|
-
this.
|
441
|
-
await promiseTimeout(50);
|
442
|
-
this.waveView = (_d = (_c = (_b = Recorder).FrequencyHistogramView) == null ? void 0 : _c.call(_b, {
|
443
|
-
elem: (_a = options == null ? void 0 : options.waveSelector) == null ? void 0 : _a.call(options),
|
444
|
-
scale: 1,
|
445
|
-
fps: 15,
|
446
|
-
widthRatio: 0.5,
|
447
|
-
lineCount: 30,
|
448
|
-
minHeight: 2,
|
449
|
-
stripeEnable: false,
|
450
|
-
mirrorEnable: false,
|
451
|
-
linear: [0, "rgba(94, 92, 255, 0.9)", 1, "rgba(95, 88, 224)"],
|
452
|
-
position: 0,
|
453
|
-
...options == null ? void 0 : options.waveProps
|
454
|
-
})) != null ? _d : null;
|
102
|
+
this._audioSDK.clearWaveView();
|
103
|
+
this._audioSDK.createWaveView(options.waveSelector, options.waveProps);
|
455
104
|
}
|
456
105
|
async pause() {
|
457
|
-
|
458
|
-
this.cleanupWebSocket();
|
459
|
-
this.pauseContent = this.contentRef.value;
|
460
|
-
(_b = (_a = this.recorder) == null ? void 0 : _a.pause) == null ? void 0 : _b.call(_a);
|
461
|
-
this.recorderStatus.value = "pause";
|
106
|
+
return this._audioSDK.pause();
|
462
107
|
}
|
463
108
|
async resume() {
|
464
|
-
|
465
|
-
await this.setupWebSocket();
|
466
|
-
(_a = this.recorder) == null ? void 0 : _a.resume();
|
467
|
-
this.recorderStatus.value = "recording";
|
109
|
+
return this._audioSDK.resume();
|
468
110
|
}
|
469
111
|
destroy() {
|
470
|
-
|
471
|
-
this.
|
472
|
-
|
112
|
+
var _a;
|
113
|
+
(_a = this._audioSDK) == null ? void 0 : _a.destroy();
|
114
|
+
_AudioSDK2.instance = null;
|
473
115
|
}
|
474
116
|
static destroy() {
|
475
117
|
var _a;
|
476
118
|
(_a = this.instance) == null ? void 0 : _a.destroy();
|
477
119
|
}
|
478
120
|
};
|
479
|
-
let AudioSDK =
|
121
|
+
let AudioSDK = _AudioSDK2;
|
480
122
|
AudioSDK.instance = null;
|
481
123
|
|
482
124
|
export { AudioSDK as default };
|
@@ -50,7 +50,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
50
50
|
type: import("vue").PropType<import("../../../../shared/types").AnyFn>;
|
51
51
|
};
|
52
52
|
recorderStatus: {
|
53
|
-
type: import("vue").PropType<"" | "
|
53
|
+
type: import("vue").PropType<"" | "stop" | "fail" | "recording" | "pause" | "ws_close">;
|
54
54
|
default: string;
|
55
55
|
};
|
56
56
|
}, {
|
@@ -92,7 +92,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
92
92
|
type: import("vue").PropType<import("../../../../shared/types").AnyFn>;
|
93
93
|
};
|
94
94
|
recorderStatus: {
|
95
|
-
type: import("vue").PropType<"" | "
|
95
|
+
type: import("vue").PropType<"" | "stop" | "fail" | "recording" | "pause" | "ws_close">;
|
96
96
|
default: string;
|
97
97
|
};
|
98
98
|
}>> & {
|
@@ -110,7 +110,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
110
110
|
data: string;
|
111
111
|
}>;
|
112
112
|
wsConnected: import("vue").Ref<boolean>;
|
113
|
-
recorderStatus: import("vue").Ref<"" | "
|
113
|
+
recorderStatus: import("vue").Ref<"" | "stop" | "fail" | "recording" | "pause" | "ws_close">;
|
114
114
|
audioChartRef: import("vue").Ref<HTMLDivElement | undefined>;
|
115
115
|
audioChartSamllRef: import("vue").Ref<HTMLDivElement | undefined>;
|
116
116
|
contentScrollRef: import("vue").Ref<HTMLDivElement | undefined>;
|
@@ -226,7 +226,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
226
226
|
type: import("vue").PropType<import("../../../../shared/types").AnyFn>;
|
227
227
|
};
|
228
228
|
recorderStatus: {
|
229
|
-
type: import("vue").PropType<"" | "
|
229
|
+
type: import("vue").PropType<"" | "stop" | "fail" | "recording" | "pause" | "ws_close">;
|
230
230
|
default: string;
|
231
231
|
};
|
232
232
|
}>> & {
|
@@ -246,7 +246,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
246
246
|
showBtn: boolean;
|
247
247
|
wsConnected: boolean;
|
248
248
|
fromSdk: boolean;
|
249
|
-
recorderStatus: "" | "
|
249
|
+
recorderStatus: "" | "stop" | "fail" | "recording" | "pause" | "ws_close";
|
250
250
|
}>;
|
251
251
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
252
252
|
content: {
|
@@ -38,7 +38,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
38
38
|
type: PropType<AnyFn>;
|
39
39
|
};
|
40
40
|
recorderStatus: {
|
41
|
-
type: PropType<"" | "
|
41
|
+
type: PropType<"" | "stop" | "fail" | "recording" | "pause" | "ws_close">;
|
42
42
|
default: string;
|
43
43
|
};
|
44
44
|
}, {
|
@@ -80,7 +80,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
80
80
|
type: PropType<AnyFn>;
|
81
81
|
};
|
82
82
|
recorderStatus: {
|
83
|
-
type: PropType<"" | "
|
83
|
+
type: PropType<"" | "stop" | "fail" | "recording" | "pause" | "ws_close">;
|
84
84
|
default: string;
|
85
85
|
};
|
86
86
|
}>> & {
|
@@ -98,7 +98,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
98
98
|
data: string;
|
99
99
|
}>;
|
100
100
|
wsConnected: import("vue").Ref<boolean>;
|
101
|
-
recorderStatus: import("vue").Ref<"" | "
|
101
|
+
recorderStatus: import("vue").Ref<"" | "stop" | "fail" | "recording" | "pause" | "ws_close">;
|
102
102
|
audioChartRef: import("vue").Ref<HTMLDivElement | undefined>;
|
103
103
|
audioChartSamllRef: import("vue").Ref<HTMLDivElement | undefined>;
|
104
104
|
contentScrollRef: import("vue").Ref<HTMLDivElement | undefined>;
|
@@ -214,7 +214,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
214
214
|
type: PropType<AnyFn>;
|
215
215
|
};
|
216
216
|
recorderStatus: {
|
217
|
-
type: PropType<"" | "
|
217
|
+
type: PropType<"" | "stop" | "fail" | "recording" | "pause" | "ws_close">;
|
218
218
|
default: string;
|
219
219
|
};
|
220
220
|
}>> & {
|
@@ -234,6 +234,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
234
234
|
showBtn: boolean;
|
235
235
|
wsConnected: boolean;
|
236
236
|
fromSdk: boolean;
|
237
|
-
recorderStatus: "" | "
|
237
|
+
recorderStatus: "" | "stop" | "fail" | "recording" | "pause" | "ws_close";
|
238
238
|
}>;
|
239
239
|
export default _default;
|
@@ -547,6 +547,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
547
547
|
isPrintDisabled: (outer: any, j: number) => any;
|
548
548
|
directPrint: () => Promise<void>;
|
549
549
|
directDefaultFormatPrint: (defaultFormatId: string) => Promise<void>;
|
550
|
+
handleShortcutStartAndStop: (status: "start" | "stop") => void;
|
550
551
|
NDropdown: any;
|
551
552
|
NButton: any;
|
552
553
|
NIcon: any;
|
@@ -1590,6 +1591,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
1590
1591
|
}>;
|
1591
1592
|
emits: (event: "success" | "error" | "cancel" | "clickoutside" | "saveOuterPrint", ...args: any[]) => void;
|
1592
1593
|
directPrint: () => Promise<void>;
|
1594
|
+
handleShortcutStartAndStop: (status: "start" | "stop") => void;
|
1593
1595
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("success" | "error" | "cancel" | "clickoutside" | "saveOuterPrint")[], "success" | "error" | "cancel" | "clickoutside" | "saveOuterPrint", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
1594
1596
|
printParams: {
|
1595
1597
|
type: import("vue").PropType<import("../../shared/types").AnyObject[]>;
|
@@ -553,6 +553,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
553
553
|
isPrintDisabled: (outer: any, j: number) => any;
|
554
554
|
directPrint: () => Promise<void>;
|
555
555
|
directDefaultFormatPrint: (defaultFormatId: string) => Promise<void>;
|
556
|
+
handleShortcutStartAndStop: (status: "start" | "stop") => void;
|
556
557
|
NDropdown: any;
|
557
558
|
NButton: any;
|
558
559
|
NIcon: any;
|
@@ -1599,6 +1600,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
1599
1600
|
}>;
|
1600
1601
|
emits: (event: "success" | "error" | "cancel" | "clickoutside" | "saveOuterPrint", ...args: any[]) => void;
|
1601
1602
|
directPrint: () => Promise<void>;
|
1603
|
+
handleShortcutStartAndStop: (status: 'start' | 'stop') => void;
|
1602
1604
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("success" | "error" | "cancel" | "clickoutside" | "saveOuterPrint")[], "success" | "error" | "cancel" | "clickoutside" | "saveOuterPrint", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
1603
1605
|
printParams: {
|
1604
1606
|
type: PropType<AnyObject[]>;
|