cnhis-design-vue 3.3.1-release.4 → 3.3.1-release.5

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 (33) hide show
  1. package/es/components/ai-chat/src/hooks/useChartAudioContext.js +1 -1
  2. package/es/components/audio-sdk/index.d.ts +37 -6
  3. package/es/components/audio-sdk/index.js +1 -0
  4. package/es/components/audio-sdk/src/Index.vue.d.ts +35 -6
  5. package/es/components/audio-sdk/src/Index.vue2.js +12 -4
  6. package/es/components/audio-sdk/src/audioSDK.d.ts +3 -4
  7. package/es/components/audio-sdk/src/audioSDK.js +12 -6
  8. package/es/components/audio-sdk/src/components/recording-modal.vue.d.ts +17 -3
  9. package/es/components/audio-sdk/src/components/recording.vue.d.ts +17 -3
  10. package/es/components/audio-sdk/src/components/recording.vue2.js +9 -6
  11. package/es/components/audio-sdk/src/utils/recorder/fft.js +75 -0
  12. package/es/components/audio-sdk/src/utils/recorder/index.d.ts +3 -0
  13. package/es/components/audio-sdk/src/utils/recorder/index.js +12 -0
  14. package/es/components/audio-sdk/src/utils/recorder/mp3-engine.js +12435 -0
  15. package/es/components/audio-sdk/src/utils/recorder/mp3.js +343 -0
  16. package/es/components/audio-sdk/src/utils/recorder/recorder.js +1324 -0
  17. package/es/components/audio-sdk/src/utils/recorder/wave.js +258 -0
  18. package/es/components/field-set/src/FieldColor.vue.d.ts +1 -1
  19. package/es/components/field-set/src/FieldFilter.vue.d.ts +1 -1
  20. package/es/components/field-set/src/FieldSet.vue.d.ts +1 -1
  21. package/es/components/field-set/src/components/table-row.vue.d.ts +1 -1
  22. package/es/components/index.js +1 -0
  23. package/es/components/select-person/src/SelectPerson.vue2.js +18 -9
  24. package/es/components/table-filter/src/components/render-widget/enums.d.ts +2 -0
  25. package/es/components/table-filter/src/components/render-widget/enums.js +2 -1
  26. package/es/components/table-filter/src/components/render-widget/helpers/dateExtraMap.js +8 -0
  27. package/es/components/table-filter/src/components/render-widget/helpers/enums.d.ts +1 -0
  28. package/es/components/table-filter/src/components/render-widget/helpers/enums.js +2 -1
  29. package/es/components/table-filter/src/components/render-widget/helpers/presetValToTimestamp.js +4 -2
  30. package/es/components/table-filter/src/tool/baseOptions.js +3 -0
  31. package/es/shared/package.json.js +1 -1
  32. package/es/shared/utils/index.js +3 -2
  33. package/package.json +1 -2
@@ -1,10 +1,10 @@
1
1
  import { useIntervalFn, promiseTimeout } from '@vueuse/core';
2
- import Recorder from 'recorder-core';
3
2
  import { ref, computed, watch, nextTick, onBeforeUnmount } from 'vue';
4
3
  import { useData } from './useData.js';
5
4
  import { $message } from '../utils/index.js';
6
5
  import '../../../audio-sdk/index.js';
7
6
  import AudioSDK from '../../../audio-sdk/src/audioSDK.js';
7
+ import Recorder from '../../../audio-sdk/src/utils/recorder/recorder.js';
8
8
 
9
9
  function useChartAudioContext(props, emit, options) {
10
10
  const audioSdk = AudioSDK.create();
@@ -1,5 +1,7 @@
1
1
  import { SFCWithInstall } from '../../shared/types';
2
2
  import AudioSDK from './src/audioSDK';
3
+ import Recorder from './src/utils/recorder';
4
+ export { Recorder as CRecorder };
3
5
  export { AudioSDK as CAudioSDK };
4
6
  declare const AudioSdk: SFCWithInstall<import("vue").DefineComponent<{
5
7
  timed: {
@@ -57,6 +59,7 @@ declare const AudioSdk: SFCWithInstall<import("vue").DefineComponent<{
57
59
  emit: (event: "close" | "success" | "fail", ...args: any[]) => void;
58
60
  recordingRef: import("vue").Ref<any>;
59
61
  isRecording: import("vue").Ref<boolean>;
62
+ loading: import("vue").Ref<boolean>;
60
63
  content: import("vue").ComputedRef<string>;
61
64
  recordingProps: import("vue").ComputedRef<{
62
65
  token: string | undefined;
@@ -87,6 +90,10 @@ declare const AudioSdk: SFCWithInstall<import("vue").DefineComponent<{
87
90
  configs: {
88
91
  type: import("vue").PropType<import("../../shared/types").AnyObject>;
89
92
  };
93
+ loading: {
94
+ type: BooleanConstructor;
95
+ default: boolean;
96
+ };
90
97
  }, {
91
98
  consultationRecordUrl: string;
92
99
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -108,21 +115,25 @@ declare const AudioSdk: SFCWithInstall<import("vue").DefineComponent<{
108
115
  configs: {
109
116
  type: import("vue").PropType<import("../../shared/types").AnyObject>;
110
117
  };
118
+ loading: {
119
+ type: BooleanConstructor;
120
+ default: boolean;
121
+ };
111
122
  }>> & {
112
123
  onSuccess?: ((...args: any[]) => any) | undefined;
113
124
  onClose?: ((...args: any[]) => any) | undefined;
114
125
  onFail?: ((...args: any[]) => any) | undefined;
115
126
  onEnd?: ((...args: any[]) => any) | undefined;
127
+ "onUpdate:loading"?: ((...args: any[]) => any) | undefined;
116
128
  }>>;
117
- emit: (event: "close" | "success" | "end" | "fail", ...args: any[]) => void;
118
- loading: import("vue").Ref<boolean>;
129
+ emit: (event: "close" | "success" | "end" | "fail" | "update:loading", ...args: any[]) => void;
119
130
  close: () => void;
120
131
  toAnalyzing: () => Promise<void>;
121
132
  NIcon: any;
122
133
  NButton: any;
123
134
  NSpin: any;
124
135
  Mic: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
125
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "success" | "end" | "fail")[], "close" | "success" | "end" | "fail", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
136
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "success" | "end" | "fail" | "update:loading")[], "close" | "success" | "end" | "fail" | "update:loading", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
126
137
  content: {
127
138
  type: import("vue").PropType<string | {
128
139
  data: string;
@@ -141,15 +152,21 @@ declare const AudioSdk: SFCWithInstall<import("vue").DefineComponent<{
141
152
  configs: {
142
153
  type: import("vue").PropType<import("../../shared/types").AnyObject>;
143
154
  };
155
+ loading: {
156
+ type: BooleanConstructor;
157
+ default: boolean;
158
+ };
144
159
  }>> & {
145
160
  onSuccess?: ((...args: any[]) => any) | undefined;
146
161
  onClose?: ((...args: any[]) => any) | undefined;
147
162
  onFail?: ((...args: any[]) => any) | undefined;
148
163
  onEnd?: ((...args: any[]) => any) | undefined;
164
+ "onUpdate:loading"?: ((...args: any[]) => any) | undefined;
149
165
  }, {
150
166
  content: string | {
151
167
  data: string;
152
168
  };
169
+ loading: boolean;
153
170
  showBtn: boolean;
154
171
  }>;
155
172
  RecordingModal: import("vue").DefineComponent<{
@@ -185,6 +202,10 @@ declare const AudioSdk: SFCWithInstall<import("vue").DefineComponent<{
185
202
  configs: {
186
203
  type: import("vue").PropType<import("../../shared/types").AnyObject>;
187
204
  };
205
+ loading: {
206
+ type: BooleanConstructor;
207
+ default: boolean;
208
+ };
188
209
  }, {
189
210
  consultationRecordUrl: string;
190
211
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -206,21 +227,25 @@ declare const AudioSdk: SFCWithInstall<import("vue").DefineComponent<{
206
227
  configs: {
207
228
  type: import("vue").PropType<import("../../shared/types").AnyObject>;
208
229
  };
230
+ loading: {
231
+ type: BooleanConstructor;
232
+ default: boolean;
233
+ };
209
234
  }>> & {
210
235
  onSuccess?: ((...args: any[]) => any) | undefined;
211
236
  onClose?: ((...args: any[]) => any) | undefined;
212
237
  onFail?: ((...args: any[]) => any) | undefined;
213
238
  onEnd?: ((...args: any[]) => any) | undefined;
239
+ "onUpdate:loading"?: ((...args: any[]) => any) | undefined;
214
240
  }>>;
215
- emit: (event: "close" | "success" | "end" | "fail", ...args: any[]) => void;
216
- loading: import("vue").Ref<boolean>;
241
+ emit: (event: "close" | "success" | "end" | "fail" | "update:loading", ...args: any[]) => void;
217
242
  close: () => void;
218
243
  toAnalyzing: () => Promise<void>;
219
244
  NIcon: any;
220
245
  NButton: any;
221
246
  NSpin: any;
222
247
  Mic: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
223
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "success" | "end" | "fail")[], "close" | "success" | "end" | "fail", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
248
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "success" | "end" | "fail" | "update:loading")[], "close" | "success" | "end" | "fail" | "update:loading", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
224
249
  content: {
225
250
  type: import("vue").PropType<string | {
226
251
  data: string;
@@ -239,15 +264,21 @@ declare const AudioSdk: SFCWithInstall<import("vue").DefineComponent<{
239
264
  configs: {
240
265
  type: import("vue").PropType<import("../../shared/types").AnyObject>;
241
266
  };
267
+ loading: {
268
+ type: BooleanConstructor;
269
+ default: boolean;
270
+ };
242
271
  }>> & {
243
272
  onSuccess?: ((...args: any[]) => any) | undefined;
244
273
  onClose?: ((...args: any[]) => any) | undefined;
245
274
  onFail?: ((...args: any[]) => any) | undefined;
246
275
  onEnd?: ((...args: any[]) => any) | undefined;
276
+ "onUpdate:loading"?: ((...args: any[]) => any) | undefined;
247
277
  }, {
248
278
  content: string | {
249
279
  data: string;
250
280
  };
281
+ loading: boolean;
251
282
  showBtn: boolean;
252
283
  }>;
253
284
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
@@ -2,6 +2,7 @@ import { COMPONENT_NAMESPACE } from '../../shared/global/variable.js';
2
2
  import { safeComponentRegister } from '../../shared/utils/index.js';
3
3
  import script from './src/Index.vue.js';
4
4
  export { default as CAudioSDK } from './src/audioSDK.js';
5
+ export { default as CRecorder } from './src/utils/recorder/recorder.js';
5
6
 
6
7
  const AudioSdk = script;
7
8
  AudioSdk.install = function(app) {
@@ -57,6 +57,7 @@ declare const _default: import("vue").DefineComponent<{
57
57
  emit: (event: "close" | "success" | "fail", ...args: any[]) => void;
58
58
  recordingRef: import("vue").Ref<any>;
59
59
  isRecording: import("vue").Ref<boolean>;
60
+ loading: import("vue").Ref<boolean>;
60
61
  content: import("vue").ComputedRef<string>;
61
62
  recordingProps: import("vue").ComputedRef<{
62
63
  token: string | undefined;
@@ -87,6 +88,10 @@ declare const _default: import("vue").DefineComponent<{
87
88
  configs: {
88
89
  type: PropType<AnyObject>;
89
90
  };
91
+ loading: {
92
+ type: BooleanConstructor;
93
+ default: boolean;
94
+ };
90
95
  }, {
91
96
  consultationRecordUrl: string;
92
97
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -108,21 +113,25 @@ declare const _default: import("vue").DefineComponent<{
108
113
  configs: {
109
114
  type: PropType<AnyObject>;
110
115
  };
116
+ loading: {
117
+ type: BooleanConstructor;
118
+ default: boolean;
119
+ };
111
120
  }>> & {
112
121
  onSuccess?: ((...args: any[]) => any) | undefined;
113
122
  onClose?: ((...args: any[]) => any) | undefined;
114
123
  onFail?: ((...args: any[]) => any) | undefined;
115
124
  onEnd?: ((...args: any[]) => any) | undefined;
125
+ "onUpdate:loading"?: ((...args: any[]) => any) | undefined;
116
126
  }>>;
117
- emit: (event: "close" | "success" | "end" | "fail", ...args: any[]) => void;
118
- loading: import("vue").Ref<boolean>;
127
+ emit: (event: "close" | "success" | "end" | "fail" | "update:loading", ...args: any[]) => void;
119
128
  close: () => void;
120
129
  toAnalyzing: () => Promise<void>;
121
130
  NIcon: any;
122
131
  NButton: any;
123
132
  NSpin: any;
124
133
  Mic: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
125
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "success" | "end" | "fail")[], "close" | "success" | "end" | "fail", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
134
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "success" | "end" | "fail" | "update:loading")[], "close" | "success" | "end" | "fail" | "update:loading", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
126
135
  content: {
127
136
  type: PropType<string | {
128
137
  data: string;
@@ -141,15 +150,21 @@ declare const _default: import("vue").DefineComponent<{
141
150
  configs: {
142
151
  type: PropType<AnyObject>;
143
152
  };
153
+ loading: {
154
+ type: BooleanConstructor;
155
+ default: boolean;
156
+ };
144
157
  }>> & {
145
158
  onSuccess?: ((...args: any[]) => any) | undefined;
146
159
  onClose?: ((...args: any[]) => any) | undefined;
147
160
  onFail?: ((...args: any[]) => any) | undefined;
148
161
  onEnd?: ((...args: any[]) => any) | undefined;
162
+ "onUpdate:loading"?: ((...args: any[]) => any) | undefined;
149
163
  }, {
150
164
  content: string | {
151
165
  data: string;
152
166
  };
167
+ loading: boolean;
153
168
  showBtn: boolean;
154
169
  }>;
155
170
  RecordingModal: import("vue").DefineComponent<{
@@ -185,6 +200,10 @@ declare const _default: import("vue").DefineComponent<{
185
200
  configs: {
186
201
  type: PropType<AnyObject>;
187
202
  };
203
+ loading: {
204
+ type: BooleanConstructor;
205
+ default: boolean;
206
+ };
188
207
  }, {
189
208
  consultationRecordUrl: string;
190
209
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -206,21 +225,25 @@ declare const _default: import("vue").DefineComponent<{
206
225
  configs: {
207
226
  type: PropType<AnyObject>;
208
227
  };
228
+ loading: {
229
+ type: BooleanConstructor;
230
+ default: boolean;
231
+ };
209
232
  }>> & {
210
233
  onSuccess?: ((...args: any[]) => any) | undefined;
211
234
  onClose?: ((...args: any[]) => any) | undefined;
212
235
  onFail?: ((...args: any[]) => any) | undefined;
213
236
  onEnd?: ((...args: any[]) => any) | undefined;
237
+ "onUpdate:loading"?: ((...args: any[]) => any) | undefined;
214
238
  }>>;
215
- emit: (event: "close" | "success" | "end" | "fail", ...args: any[]) => void;
216
- loading: import("vue").Ref<boolean>;
239
+ emit: (event: "close" | "success" | "end" | "fail" | "update:loading", ...args: any[]) => void;
217
240
  close: () => void;
218
241
  toAnalyzing: () => Promise<void>;
219
242
  NIcon: any;
220
243
  NButton: any;
221
244
  NSpin: any;
222
245
  Mic: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
223
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "success" | "end" | "fail")[], "close" | "success" | "end" | "fail", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
246
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "success" | "end" | "fail" | "update:loading")[], "close" | "success" | "end" | "fail" | "update:loading", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
224
247
  content: {
225
248
  type: PropType<string | {
226
249
  data: string;
@@ -239,15 +262,21 @@ declare const _default: import("vue").DefineComponent<{
239
262
  configs: {
240
263
  type: PropType<AnyObject>;
241
264
  };
265
+ loading: {
266
+ type: BooleanConstructor;
267
+ default: boolean;
268
+ };
242
269
  }>> & {
243
270
  onSuccess?: ((...args: any[]) => any) | undefined;
244
271
  onClose?: ((...args: any[]) => any) | undefined;
245
272
  onFail?: ((...args: any[]) => any) | undefined;
246
273
  onEnd?: ((...args: any[]) => any) | undefined;
274
+ "onUpdate:loading"?: ((...args: any[]) => any) | undefined;
247
275
  }, {
248
276
  content: string | {
249
277
  data: string;
250
278
  };
279
+ loading: boolean;
251
280
  showBtn: boolean;
252
281
  }>;
253
282
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
@@ -1,4 +1,4 @@
1
- import { defineComponent, useAttrs, ref, computed, onBeforeUnmount, openBlock, createElementBlock, normalizeStyle, unref, Fragment, createBlock, mergeProps, createCommentVNode } from 'vue';
1
+ import { defineComponent, useAttrs, ref, computed, watch, onBeforeUnmount, openBlock, createElementBlock, normalizeStyle, unref, Fragment, createBlock, mergeProps, createCommentVNode } from 'vue';
2
2
  import CRecording from './components/recording.vue.js';
3
3
  import RecordingModal$1 from './components/recording-modal.vue.js';
4
4
  import { useTheme } from '../../../shared/hooks/useTheme.js';
@@ -49,6 +49,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
49
49
  const attrs = useAttrs();
50
50
  const recordingRef = ref();
51
51
  const isRecording = ref(false);
52
+ const loading = ref(true);
52
53
  const content = computed(() => {
53
54
  return audioSdk.contentRef.value;
54
55
  });
@@ -73,6 +74,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
73
74
  isRecording.value = false;
74
75
  emit("success", data);
75
76
  }
77
+ watch(() => audioSdk.wsConnected.value, (newVal) => {
78
+ if (newVal) {
79
+ loading.value = false;
80
+ }
81
+ });
76
82
  onBeforeUnmount(() => {
77
83
  AudioSDK.destroy();
78
84
  });
@@ -116,13 +122,15 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
116
122
  key: 0,
117
123
  ref_key: "recordingRef",
118
124
  ref: recordingRef,
119
- "show-btn": ""
125
+ "show-btn": "",
126
+ loading: loading.value,
127
+ "onUpdate:loading": _cache[0] || (_cache[0] = ($event) => loading.value = $event)
120
128
  }, unref(recordingProps), {
121
129
  onClose,
122
130
  onEnd,
123
- onFail: _cache[0] || (_cache[0] = (error) => emit("fail", error)),
131
+ onFail: _cache[1] || (_cache[1] = (error) => emit("fail", error)),
124
132
  onSuccess
125
- }), null, 16)) : createCommentVNode("v-if", true), createCommentVNode(' <c-form\r\n v-if="isForm"\r\n :configs="configsAndBasicData.configs"\r\n :data="jsonData"\r\n @close="onFormClose"\r\n @finish="onFinish"\r\n /> ')], 64)) : (openBlock(), createBlock(RecordingModal$1, {
133
+ }), null, 16, ["loading"])) : createCommentVNode("v-if", true), createCommentVNode(' <c-form\r\n v-if="isForm"\r\n :configs="configsAndBasicData.configs"\r\n :data="jsonData"\r\n @close="onFormClose"\r\n @finish="onFinish"\r\n /> ')], 64)) : (openBlock(), createBlock(RecordingModal$1, {
126
134
  key: 1,
127
135
  content: unref(content)
128
136
  }, null, 8, ["content"]))], 4);
@@ -1,7 +1,3 @@
1
- import 'recorder-core/src/engine/mp3-engine';
2
- import 'recorder-core/src/engine/mp3';
3
- import 'recorder-core/src/extensions/frequency.histogram.view';
4
- import 'recorder-core/src/extensions/lib.fft';
5
1
  interface SpeechResult {
6
2
  result: 'success';
7
3
  data?: string;
@@ -24,6 +20,7 @@ type AudioOptions = Partial<{
24
20
  wsTimeout: number;
25
21
  }>;
26
22
  export default class AudioSDK {
23
+ private plugins;
27
24
  private static instance;
28
25
  private recorder;
29
26
  private webSocket;
@@ -36,12 +33,14 @@ export default class AudioSDK {
36
33
  private timer;
37
34
  private recordingModal;
38
35
  contentRef: import("vue").Ref<string>;
36
+ wsConnected: import("vue").Ref<boolean>;
39
37
  private loading;
40
38
  waveView: any;
41
39
  constructor();
42
40
  static create(): AudioSDK;
43
41
  private initRecorder;
44
42
  start(options: AudioOptions): Promise<SpeechResult>;
43
+ private setWsConnected;
45
44
  private setupWebSocket;
46
45
  private startRecording;
47
46
  private showRecordingModal;
@@ -1,14 +1,11 @@
1
1
  import { uuidGenerator } from '../../../shared/utils/index.js';
2
2
  import axios from 'axios';
3
3
  import { isString, isObject } from 'lodash-es';
4
- import Recorder from 'recorder-core';
5
- import 'recorder-core/src/engine/mp3-engine';
6
- import 'recorder-core/src/engine/mp3';
7
- import 'recorder-core/src/extensions/frequency.histogram.view';
8
- import 'recorder-core/src/extensions/lib.fft';
4
+ import { loadRecorderPlugins } from './utils/recorder/index.js';
9
5
  import { ref } from 'vue';
10
6
  import { $message } from './utils/index.js';
11
7
  import { RecordingModal } from './utils/recordingModal.js';
8
+ import Recorder from './utils/recorder/recorder.js';
12
9
 
13
10
  const DEFAULT_OPTIONS = {
14
11
  showModal: true,
@@ -25,6 +22,7 @@ const DEFAULT_OPTIONS = {
25
22
  };
26
23
  const _AudioSDK = class {
27
24
  constructor() {
25
+ this.plugins = loadRecorderPlugins();
28
26
  this.recorder = null;
29
27
  this.webSocket = null;
30
28
  this.messageQueue = [];
@@ -38,6 +36,7 @@ const _AudioSDK = class {
38
36
  this.timer = null;
39
37
  this.recordingModal = new RecordingModal();
40
38
  this.contentRef = ref("");
39
+ this.wsConnected = ref(false);
41
40
  this.loading = ref(false);
42
41
  this.waveView = null;
43
42
  this.messageResolver = null;
@@ -71,13 +70,19 @@ const _AudioSDK = class {
71
70
  this.initRecorder();
72
71
  this.contentRef.value = "";
73
72
  if (this.options.type === "websocket") {
73
+ this.setWsConnected(false);
74
74
  await this.setupWebSocket();
75
+ } else {
76
+ this.setWsConnected(true);
75
77
  }
76
78
  return this.startRecording();
77
79
  }
80
+ setWsConnected(wsConnected) {
81
+ this.wsConnected.value = wsConnected;
82
+ }
78
83
  async setupWebSocket() {
79
84
  if (this.connectionState === 2 /* CONNECTED */)
80
- return;
85
+ return this.setWsConnected(true);
81
86
  return new Promise((resolve, reject) => {
82
87
  const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
83
88
  const url = this.options.origin || `${protocol}//${window.location.host}${this.options.wsOrigin}`;
@@ -94,6 +99,7 @@ const _AudioSDK = class {
94
99
  this.webSocket.onopen = () => {
95
100
  clearTimeout(timeout);
96
101
  this.connectionState = 2 /* CONNECTED */;
102
+ this.setWsConnected(true);
97
103
  resolve();
98
104
  };
99
105
  this.webSocket.onmessage = this.handleMessage.bind(this);
@@ -31,6 +31,10 @@ declare const _default: import("vue").DefineComponent<{
31
31
  configs: {
32
32
  type: import("vue").PropType<import("../../../../shared/types").AnyObject>;
33
33
  };
34
+ loading: {
35
+ type: BooleanConstructor;
36
+ default: boolean;
37
+ };
34
38
  }, {
35
39
  consultationRecordUrl: string;
36
40
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -52,21 +56,25 @@ declare const _default: import("vue").DefineComponent<{
52
56
  configs: {
53
57
  type: import("vue").PropType<import("../../../../shared/types").AnyObject>;
54
58
  };
59
+ loading: {
60
+ type: BooleanConstructor;
61
+ default: boolean;
62
+ };
55
63
  }>> & {
56
64
  onSuccess?: ((...args: any[]) => any) | undefined;
57
65
  onClose?: ((...args: any[]) => any) | undefined;
58
66
  onFail?: ((...args: any[]) => any) | undefined;
59
67
  onEnd?: ((...args: any[]) => any) | undefined;
68
+ "onUpdate:loading"?: ((...args: any[]) => any) | undefined;
60
69
  }>>;
61
- emit: (event: "close" | "success" | "end" | "fail", ...args: any[]) => void;
62
- loading: import("vue").Ref<boolean>;
70
+ emit: (event: "close" | "success" | "end" | "fail" | "update:loading", ...args: any[]) => void;
63
71
  close: () => void;
64
72
  toAnalyzing: () => Promise<void>;
65
73
  NIcon: any;
66
74
  NButton: any;
67
75
  NSpin: any;
68
76
  Mic: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
69
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "success" | "end" | "fail")[], "close" | "success" | "end" | "fail", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
77
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "success" | "end" | "fail" | "update:loading")[], "close" | "success" | "end" | "fail" | "update:loading", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
70
78
  content: {
71
79
  type: import("vue").PropType<string | {
72
80
  data: string;
@@ -85,15 +93,21 @@ declare const _default: import("vue").DefineComponent<{
85
93
  configs: {
86
94
  type: import("vue").PropType<import("../../../../shared/types").AnyObject>;
87
95
  };
96
+ loading: {
97
+ type: BooleanConstructor;
98
+ default: boolean;
99
+ };
88
100
  }>> & {
89
101
  onSuccess?: ((...args: any[]) => any) | undefined;
90
102
  onClose?: ((...args: any[]) => any) | undefined;
91
103
  onFail?: ((...args: any[]) => any) | undefined;
92
104
  onEnd?: ((...args: any[]) => any) | undefined;
105
+ "onUpdate:loading"?: ((...args: any[]) => any) | undefined;
93
106
  }, {
94
107
  content: string | {
95
108
  data: string;
96
109
  };
110
+ loading: boolean;
97
111
  showBtn: boolean;
98
112
  }>;
99
113
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
@@ -19,6 +19,10 @@ declare const _default: import("vue").DefineComponent<{
19
19
  configs: {
20
20
  type: PropType<AnyObject>;
21
21
  };
22
+ loading: {
23
+ type: BooleanConstructor;
24
+ default: boolean;
25
+ };
22
26
  }, {
23
27
  consultationRecordUrl: string;
24
28
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -40,21 +44,25 @@ declare const _default: import("vue").DefineComponent<{
40
44
  configs: {
41
45
  type: PropType<AnyObject>;
42
46
  };
47
+ loading: {
48
+ type: BooleanConstructor;
49
+ default: boolean;
50
+ };
43
51
  }>> & {
44
52
  onSuccess?: ((...args: any[]) => any) | undefined;
45
53
  onClose?: ((...args: any[]) => any) | undefined;
46
54
  onFail?: ((...args: any[]) => any) | undefined;
47
55
  onEnd?: ((...args: any[]) => any) | undefined;
56
+ "onUpdate:loading"?: ((...args: any[]) => any) | undefined;
48
57
  }>>;
49
- emit: (event: "close" | "success" | "end" | "fail", ...args: any[]) => void;
50
- loading: import("vue").Ref<boolean>;
58
+ emit: (event: "close" | "success" | "end" | "fail" | "update:loading", ...args: any[]) => void;
51
59
  close: () => void;
52
60
  toAnalyzing: () => Promise<void>;
53
61
  NIcon: any;
54
62
  NButton: any;
55
63
  NSpin: any;
56
64
  Mic: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
57
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "success" | "end" | "fail")[], "close" | "success" | "end" | "fail", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
65
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "success" | "end" | "fail" | "update:loading")[], "close" | "success" | "end" | "fail" | "update:loading", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
58
66
  content: {
59
67
  type: PropType<string | {
60
68
  data: string;
@@ -73,15 +81,21 @@ declare const _default: import("vue").DefineComponent<{
73
81
  configs: {
74
82
  type: PropType<AnyObject>;
75
83
  };
84
+ loading: {
85
+ type: BooleanConstructor;
86
+ default: boolean;
87
+ };
76
88
  }>> & {
77
89
  onSuccess?: ((...args: any[]) => any) | undefined;
78
90
  onClose?: ((...args: any[]) => any) | undefined;
79
91
  onFail?: ((...args: any[]) => any) | undefined;
80
92
  onEnd?: ((...args: any[]) => any) | undefined;
93
+ "onUpdate:loading"?: ((...args: any[]) => any) | undefined;
81
94
  }, {
82
95
  content: string | {
83
96
  data: string;
84
97
  };
98
+ loading: boolean;
85
99
  showBtn: boolean;
86
100
  }>;
87
101
  export default _default;
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, openBlock, createElementBlock, createBlock, unref, Fragment, createElementVNode, toDisplayString, createVNode, withCtx, createTextVNode, createCommentVNode } from 'vue';
1
+ import { defineComponent, openBlock, createElementBlock, createBlock, unref, Fragment, createElementVNode, toDisplayString, createVNode, withCtx, createTextVNode, createCommentVNode } from 'vue';
2
2
  import { isString, isObject } from 'lodash-es';
3
3
  import { NSpin, NIcon, NButton } from 'naive-ui';
4
4
  import { Mic } from '@vicons/ionicons5';
@@ -32,22 +32,25 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
32
32
  },
33
33
  configs: {
34
34
  type: Object
35
+ },
36
+ loading: {
37
+ type: Boolean,
38
+ default: true
35
39
  }
36
40
  },
37
- emits: ["close", "success", "end", "fail"],
41
+ emits: ["close", "success", "end", "fail", "update:loading"],
38
42
  setup(__props, {
39
43
  expose,
40
44
  emit
41
45
  }) {
42
46
  const props = __props;
43
47
  const consultationRecordUrl = "/flow/openApi/consultationRecord";
44
- const loading = ref(false);
45
48
  function close() {
46
49
  emit("close");
47
50
  }
48
51
  async function toAnalyzing() {
49
52
  emit("end");
50
- loading.value = true;
53
+ emit("update:loading", true);
51
54
  try {
52
55
  const audioText = isString(props.content) ? props.content : isObject(props.content) ? props.content.data : "";
53
56
  const {
@@ -74,14 +77,14 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
74
77
  } catch (error) {
75
78
  emit("fail", error);
76
79
  } finally {
77
- loading.value = false;
80
+ emit("update:loading", false);
78
81
  }
79
82
  }
80
83
  expose({
81
84
  toAnalyzing
82
85
  });
83
86
  return (_ctx, _cache) => {
84
- return openBlock(), createElementBlock("div", _hoisted_1, [loading.value ? (openBlock(), createBlock(unref(NSpin), {
87
+ return openBlock(), createElementBlock("div", _hoisted_1, [__props.loading ? (openBlock(), createBlock(unref(NSpin), {
85
88
  key: 0,
86
89
  description: "\u52A0\u8F7D\u4E2D..."
87
90
  })) : (openBlock(), createElementBlock(Fragment, {