cnhis-design-vue 3.3.2-release.0 → 3.3.2-release.2

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 (251) hide show
  1. package/es/components/audio-sdk/index.d.ts +173 -146
  2. package/es/components/audio-sdk/src/Index.vue.d.ts +174 -147
  3. package/es/components/audio-sdk/src/Index.vue2.js +131 -53
  4. package/es/components/audio-sdk/src/audioSDK.d.ts +29 -26
  5. package/es/components/audio-sdk/src/audioSDK.js +123 -42
  6. package/es/components/audio-sdk/src/components/readyCountdown.vue.d.ts +31 -0
  7. package/es/components/audio-sdk/src/components/readyCountdown.vue.js +6 -0
  8. package/es/components/audio-sdk/src/components/readyCountdown.vue2.js +46 -0
  9. package/es/components/audio-sdk/src/components/recording-modal.vue.d.ts +138 -10
  10. package/es/components/audio-sdk/src/components/recording.vue.d.ts +139 -11
  11. package/es/components/audio-sdk/src/components/recording.vue2.js +318 -74
  12. package/es/components/audio-sdk/src/hooks/useChartAudioContext.d.ts +24 -0
  13. package/es/components/audio-sdk/src/hooks/useChartAudioContext.js +176 -0
  14. package/es/components/audio-sdk/src/svgs/Close.vue.js +26 -0
  15. package/es/components/audio-sdk/src/svgs/Continue.vue.js +20 -0
  16. package/es/components/audio-sdk/src/svgs/Enlarge.vue.js +20 -0
  17. package/es/components/audio-sdk/src/svgs/Pause.vue.js +20 -0
  18. package/es/components/audio-sdk/src/svgs/WaveView.vue.js +20 -0
  19. package/es/components/audio-sdk/src/svgs/Zoom.vue.js +27 -0
  20. package/es/components/audio-sdk/src/types/index.d.ts +42 -0
  21. package/es/components/audio-sdk/src/types/index.js +10 -0
  22. package/es/components/audio-sdk/src/utils/recordingModal.d.ts +9 -3
  23. package/es/components/audio-sdk/src/utils/recordingModal.js +57 -32
  24. package/es/components/audio-sdk/style/index.css +1 -1
  25. package/es/components/base-search/src/index.vue2.js +30 -18
  26. package/es/components/big-table/src/BigTable.vue2.js +191 -133
  27. package/es/components/big-table/src/components/NoData.vue2.js +16 -4
  28. package/es/components/big-table/src/components/edit-form/edit-date.js +12 -6
  29. package/es/components/big-table/src/components/edit-form/edit-input.js +8 -2
  30. package/es/components/big-table/src/components/edit-form/edit-select.js +21 -17
  31. package/es/components/big-table/src/components/edit-form/edit-time.js +11 -4
  32. package/es/components/big-table/src/components/input-button.vue2.js +8 -4
  33. package/es/components/big-table/src/hooks/useNestTable.js +18 -4
  34. package/es/components/big-table/src/hooks/useTableParse.js +16 -3
  35. package/es/components/body-select/src/index.vue2.js +24 -4
  36. package/es/components/button-print/index.d.ts +12 -4
  37. package/es/components/button-print/src/ButtonPrint.vue.d.ts +12 -4
  38. package/es/components/button-print/src/ButtonPrint.vue2.js +52 -11
  39. package/es/components/button-print/src/components/EditFormat.vue2.js +16 -8
  40. package/es/components/button-print/src/components/IdentityVerification.vue.d.ts +4 -2
  41. package/es/components/button-print/src/components/IdentityVerification.vue2.js +104 -49
  42. package/es/components/button-print/src/components/NewPrintComponent.vue.d.ts +7 -2
  43. package/es/components/button-print/src/components/NewPrintComponent.vue2.js +244 -95
  44. package/es/components/button-print/src/components/OldPrintComponent.vue.d.ts +5 -2
  45. package/es/components/button-print/src/components/OldPrintComponent.vue2.js +92 -32
  46. package/es/components/button-print/src/components/Preview.vue.d.ts +5 -2
  47. package/es/components/button-print/src/components/Preview.vue2.js +14 -4
  48. package/es/components/button-print/src/utils/dialog.js +26 -8
  49. package/es/components/button-print/src/utils/print.d.ts +5 -5
  50. package/es/components/button-print/src/utils/print.js +108 -21
  51. package/es/components/card-reader-sdk/src/components/readCardDialog.vue2.js +8 -2
  52. package/es/components/card-reader-sdk/src/utils/readHealthCard.js +16 -4
  53. package/es/components/card-reader-sdk-cn/src/henan/index.js +38 -11
  54. package/es/components/card-render/src/components/index.d.ts +23 -23
  55. package/es/components/classification/src/components/search-filter/index.vue2.js +24 -10
  56. package/es/components/classification/src/components/set-classification/index.vue2.js +24 -7
  57. package/es/components/classification/src/components/table-modal/index.vue2.js +324 -165
  58. package/es/components/classification/src/index.vue2.js +261 -69
  59. package/es/components/default-page/src/constants/index.js +144 -19
  60. package/es/components/default-page/src/index.vue2.js +8 -2
  61. package/es/components/expand-field/src/components/FormBatchOptionsModal.vue2.js +75 -51
  62. package/es/components/expand-field/src/components/FormItemPerson.vue2.js +46 -38
  63. package/es/components/expand-field/src/components/PersonModal.vue2.js +62 -50
  64. package/es/components/expand-field/src/components/form.vue2.js +783 -412
  65. package/es/components/expand-field/src/index.vue2.js +88 -22
  66. package/es/components/expand-field/src/utils/constant.js +88 -12
  67. package/es/components/fabric-chart/src/components/PopupMenu.js +32 -15
  68. package/es/components/fabric-chart/src/constants/index.js +72 -10
  69. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +18 -4
  70. package/es/components/fabric-chart/src/hooks/newBirthProcess/useNewBirthProcess.js +8 -2
  71. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +32 -5
  72. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +8 -2
  73. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +63 -41
  74. package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +1 -1
  75. package/es/components/fabric-chart/src/hooks/temperature/useTop.js +5 -1
  76. package/es/components/fabric-chart/src/hooks/useCommon.js +24 -4
  77. package/es/components/fabric-chart/src/hooks/useCumputedPoint.js +4 -1
  78. package/es/components/fabric-chart/src/hooks/useDraw.js +19 -0
  79. package/es/components/fabric-chart/src/utils/index.d.ts +1 -1
  80. package/es/components/fabric-chart/src/utils/index.js +2 -2
  81. package/es/components/field-editor/src/fields.js +232 -30
  82. package/es/components/field-set/src/FieldColor.vue.d.ts +2 -2
  83. package/es/components/field-set/src/FieldColor.vue2.js +88 -21
  84. package/es/components/field-set/src/FieldFilter.vue.d.ts +2 -2
  85. package/es/components/field-set/src/FieldFilter.vue2.js +32 -16
  86. package/es/components/field-set/src/FieldSet.vue.d.ts +2 -2
  87. package/es/components/field-set/src/FieldSet.vue2.js +210 -57
  88. package/es/components/field-set/src/Index.vue2.js +40 -6
  89. package/es/components/field-set/src/TableStyle.vue2.js +48 -13
  90. package/es/components/field-set/src/components/condition.vue2.js +26 -10
  91. package/es/components/field-set/src/components/edit-dialog.vue2.js +148 -68
  92. package/es/components/field-set/src/components/edit-filter.vue2.js +24 -4
  93. package/es/components/field-set/src/components/table-row.vue.d.ts +2 -2
  94. package/es/components/field-set/src/components/table-row.vue2.js +123 -42
  95. package/es/components/field-set/src/constants/filter.js +328 -42
  96. package/es/components/field-set/src/constants/index.js +504 -64
  97. package/es/components/field-set/src/utils/index.js +1 -1
  98. package/es/components/form-config/src/components/FormConfigEventSetting.vue2.js +91 -46
  99. package/es/components/form-config/src/constants/index.js +80 -11
  100. package/es/components/form-config/src/hooks/useLocale.js +240 -31
  101. package/es/components/form-render/src/components/renderer/combination/hooks/useCombination.js +8 -4
  102. package/es/components/form-render/src/components/renderer/combination/jsonCombination.js +8 -4
  103. package/es/components/form-render/src/components/renderer/combination/tableCombination.js +8 -2
  104. package/es/components/form-render/src/components/renderer/input.js +3 -2
  105. package/es/components/form-render/src/components/renderer/radio_checkbox.js +8 -4
  106. package/es/components/form-render/src/components/renderer/remoteSearch.js +8 -2
  107. package/es/components/form-render/src/components/renderer/switch.js +24 -4
  108. package/es/components/form-render/src/components/renderer/textarea.js +5 -4
  109. package/es/components/form-render/src/utils/schema.js +26 -6
  110. package/es/components/iho-chat/src/Index.vue2.js +42 -38
  111. package/es/components/iho-chat/src/components/ChatAdd.vue2.js +108 -33
  112. package/es/components/iho-chat/src/components/ChatFile.vue2.js +132 -90
  113. package/es/components/iho-chat/src/components/ChatFooter.vue2.js +110 -48
  114. package/es/components/iho-chat/src/components/ChatHeader.vue2.js +40 -20
  115. package/es/components/iho-chat/src/components/ChatMain.vue2.js +55 -23
  116. package/es/components/iho-chat/src/components/ChatRecord.vue2.js +77 -45
  117. package/es/components/iho-chat/src/components/ChatSearch.vue2.js +256 -208
  118. package/es/components/iho-chat/src/components/ChatSet.vue2.js +306 -208
  119. package/es/components/iho-chat/src/components/ContextMenu.js +50 -9
  120. package/es/components/iho-chat/src/components/MessageEvent.vue2.js +16 -4
  121. package/es/components/iho-chat/src/components/MessageTemplate.vue2.js +8 -2
  122. package/es/components/iho-chat/src/components/MultipleVideo.vue2.js +104 -18
  123. package/es/components/iho-chat/src/components/PersonProfile.vue2.js +66 -11
  124. package/es/components/iho-chat/src/components/SelectLabel.vue2.js +47 -43
  125. package/es/components/iho-chat/src/components/SiderList.vue2.js +68 -38
  126. package/es/components/iho-chat/src/components/Video.vue2.js +38 -11
  127. package/es/components/iho-chat/src/hooks/useVideo.js +15 -4
  128. package/es/components/iho-chat/src/utils/index.js +79 -14
  129. package/es/components/iho-table/src/hooks/useColumnConfigAdaptor.js +8 -2
  130. package/es/components/iho-table/src/plugins/dynamicFilterRenderPlugin/dynamicFilter.vue2.js +40 -15
  131. package/es/components/iho-table/src/plugins/filterRemoteSearchPlugin/remoteFilter.vue2.js +40 -15
  132. package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue.d.ts +1 -1
  133. package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue2.js +50 -20
  134. package/es/components/iho-table/src/plugins/filterTextPlugin/filter.vue2.js +16 -8
  135. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/numberRendererPlugin.js +10 -3
  136. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +42 -15
  137. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/index.js +1 -1
  138. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/editTime.vue2.js +18 -12
  139. package/es/components/index.css +1 -1
  140. package/es/components/info-header/src/components/patientInfo/index.vue2.js +144 -25
  141. package/es/components/keyboard/src/Keyboard.vue2.js +20 -8
  142. package/es/components/keyboard/src/components/NumberPanel.vue2.js +51 -37
  143. package/es/components/map/src/Map.vue2.js +8 -4
  144. package/es/components/picture-clipper/src/PictureClipper.vue2.js +16 -8
  145. package/es/components/quick-search/src/index.vue2.js +176 -131
  146. package/es/components/recommend-search/src/components/BaseSearch.js +14 -8
  147. package/es/components/recommend-search/src/components/RecommendInput.vue2.js +28 -8
  148. package/es/components/recommend-search/src/components/RecommendSelect.vue2.js +18 -5
  149. package/es/components/scale-view/src/ScaleView.vue2.js +16 -8
  150. package/es/components/scale-view/src/components/NoData.vue2.js +16 -4
  151. package/es/components/scale-view/src/components/formitem/r-cascader.js +8 -2
  152. package/es/components/scale-view/src/components/formitem/r-checkbox.js +24 -6
  153. package/es/components/scale-view/src/components/formitem/r-input.js +8 -2
  154. package/es/components/scale-view/src/components/formitem/r-map.js +8 -2
  155. package/es/components/scale-view/src/components/formitem/r-radio.js +24 -6
  156. package/es/components/scale-view/src/components/formitem/r-select.js +8 -2
  157. package/es/components/scale-view/src/components/formitem/r-sign.js +32 -11
  158. package/es/components/scale-view/src/components/formitem/standard-modal.js +16 -3
  159. package/es/components/scale-view/src/hooks/scaleview-computed.js +24 -5
  160. package/es/components/scale-view/src/hooks/scaleview-methods.js +16 -4
  161. package/es/components/scale-view/src/hooks/scaleview-submit.js +16 -3
  162. package/es/components/scale-view/src/hooks/scaleview-validate.js +40 -9
  163. package/es/components/search-cascader/src/SearchCascader.vue2.js +20 -14
  164. package/es/components/select-label/src/LabelFormContent.vue2.js +53 -21
  165. package/es/components/select-label/src/SelectLabel.vue2.js +81 -51
  166. package/es/components/select-label/src/components/label-classify.vue2.js +28 -11
  167. package/es/components/select-label/src/ihoLabel/IhoLabelFormContent.vue2.js +18 -5
  168. package/es/components/select-label/src/ihoLabel/IhoSelectLabel.vue2.js +34 -8
  169. package/es/components/select-label/src/ihoLabel/iho-label-classify.vue2.js +18 -5
  170. package/es/components/select-person/src/SelectPerson.vue2.js +214 -141
  171. package/es/components/select-person/src/SelectPersonType.vue2.js +127 -102
  172. package/es/components/select-person/src/components/SearchOrgAndStaff.vue2.js +9 -2
  173. package/es/components/select-person/src/index.vue2.js +20 -7
  174. package/es/components/slider-tree/src/index.vue2.js +16 -3
  175. package/es/components/table-export-field/index.d.ts +1 -0
  176. package/es/components/table-export-field/src/components/ExportModal.vue.d.ts +1 -0
  177. package/es/components/table-export-field/src/components/ExportModal.vue2.js +187 -113
  178. package/es/components/table-export-field/src/components/SaveProjectModal.vue2.js +147 -88
  179. package/es/components/table-export-field/src/index.vue.d.ts +1 -0
  180. package/es/components/table-export-field/src/index.vue2.js +28 -12
  181. package/es/components/table-filter/src/components/bi-filter/ValueCfg.vue2.js +32 -5
  182. package/es/components/table-filter/src/components/bi-filter/helpers/options.js +264 -34
  183. package/es/components/table-filter/src/components/bi-filter/index.vue2.js +214 -135
  184. package/es/components/table-filter/src/components/classify-filter/ValueCfg.vue2.js +16 -3
  185. package/es/components/table-filter/src/components/classify-filter/components/Date.vue2.js +9 -2
  186. package/es/components/table-filter/src/components/classify-filter/components/DateRange.vue2.js +39 -6
  187. package/es/components/table-filter/src/components/classify-filter/components/InputFilter.vue2.js +18 -5
  188. package/es/components/table-filter/src/components/classify-filter/components/InputNumberGroup.vue2.js +29 -18
  189. package/es/components/table-filter/src/components/classify-filter/helpers/options.js +16 -3
  190. package/es/components/table-filter/src/components/classify-filter/hooks/useDisplayCategory.js +8 -2
  191. package/es/components/table-filter/src/components/classify-filter/index.vue2.js +195 -130
  192. package/es/components/table-filter/src/components/render-widget/components/DateInner.vue2.js +26 -7
  193. package/es/components/table-filter/src/components/render-widget/components/DateOut.vue2.js +12 -6
  194. package/es/components/table-filter/src/components/render-widget/components/DateRangeInner.vue2.js +34 -8
  195. package/es/components/table-filter/src/components/render-widget/components/DateRangeOut.vue2.js +21 -8
  196. package/es/components/table-filter/src/components/render-widget/components/InputCustom.vue2.js +8 -4
  197. package/es/components/table-filter/src/components/render-widget/components/InputNumberGroup.vue2.js +19 -6
  198. package/es/components/table-filter/src/components/render-widget/components/LabelInner.vue2.js +16 -3
  199. package/es/components/table-filter/src/components/render-widget/components/SelectDynamicOption/index.vue2.js +24 -10
  200. package/es/components/table-filter/src/components/render-widget/helpers/dateExtraMap.js +1648 -207
  201. package/es/components/table-filter/src/components/render-widget/helpers/selectExtraMap.js +8 -2
  202. package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.js +16 -3
  203. package/es/components/table-filter/src/tool/baseOptions.js +144 -19
  204. package/es/components/tooth-bitmap/src/ToothBitmap.vue2.js +32 -16
  205. package/es/components/vod-chunk-upload/src/hooks/upload-computed.js +22 -2
  206. package/es/components/vod-chunk-upload/src/vod-chunk-upload/vod-chunk-upload.vue2.js +8 -4
  207. package/es/components/vod-chunk-upload/src/vod-upload-modal.js +16 -8
  208. package/es/shared/assets/img/defaultCover/10review_successful.png.js +1 -1
  209. package/es/shared/assets/img/defaultCover/11review_fail.png.js +1 -1
  210. package/es/shared/assets/img/defaultCover/12no_setting.png.js +1 -1
  211. package/es/shared/assets/img/defaultCover/13no_menu_setting.png.js +1 -1
  212. package/es/shared/assets/img/defaultCover/14no_call_setting.png.js +1 -1
  213. package/es/shared/assets/img/defaultCover/15no_use_tag.png.js +1 -1
  214. package/es/shared/assets/img/defaultCover/16no_table_data.png.js +1 -1
  215. package/es/shared/assets/img/defaultCover/1location.png.js +1 -1
  216. package/es/shared/assets/img/defaultCover/2notfound.png.js +1 -1
  217. package/es/shared/assets/img/defaultCover/3loading.png.js +1 -1
  218. package/es/shared/assets/img/defaultCover/4no_permission.png.js +1 -1
  219. package/es/shared/assets/img/defaultCover/5no_data.png.js +1 -1
  220. package/es/shared/assets/img/defaultCover/6no_network.png.js +1 -1
  221. package/es/shared/assets/img/defaultCover/7no_doctor.png.js +1 -1
  222. package/es/shared/assets/img/defaultCover/8system_error.png.js +1 -1
  223. package/es/shared/assets/img/defaultCover/9system_upgrade.png.js +1 -1
  224. package/es/shared/assets/img/failure.png.js +1 -1
  225. package/es/shared/assets/img/no-permission.png.js +1 -1
  226. package/es/shared/assets/img/nodata.png.js +1 -1
  227. package/es/shared/assets/img/notfound.png.js +1 -1
  228. package/es/shared/assets/img/qr.png.js +1 -1
  229. package/es/shared/assets/img/success.png.js +1 -1
  230. package/es/shared/assets/img/table_style_2.png.js +1 -1
  231. package/es/shared/assets/img/video.png.js +1 -1
  232. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  233. package/es/shared/assets/img/xb_big.png.js +1 -1
  234. package/es/shared/assets/img/xb_small.png.js +1 -1
  235. package/es/shared/hooks/selectHooks/useSelectAllowModify.js +2 -2
  236. package/es/shared/package.json.js +1 -1
  237. package/package.json +2 -2
  238. package/es/components/audio-sdk/src/components/recording-modal.vue.js +0 -6
  239. package/es/components/audio-sdk/src/components/recording-modal.vue2.js +0 -40
  240. package/es/components/audio-sdk/src/utils/recorder/fft.d.ts +0 -4
  241. package/es/components/audio-sdk/src/utils/recorder/mp3-engine.d.ts +0 -4
  242. package/es/components/audio-sdk/src/utils/recorder/mp3.d.ts +0 -4
  243. package/es/components/audio-sdk/src/utils/recorder/recorder.d.ts +0 -4
  244. package/es/components/audio-sdk/src/utils/recorder/wave.d.ts +0 -4
  245. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  246. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
  247. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
  248. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
  249. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
  250. package/es/shared/utils/fabricjs/index.d.ts +0 -6823
  251. package/es/shared/utils/tapable/index.d.ts +0 -139
@@ -1,24 +1,4 @@
1
- interface SpeechResult {
2
- result: 'success';
3
- data?: string;
4
- timeout?: boolean;
5
- }
6
- type AudioOptions = Partial<{
7
- timed: number;
8
- showModal: boolean;
9
- instance: any;
10
- token: string;
11
- origin: string;
12
- wsType: 'whole' | 'chunk';
13
- type: 'http' | 'websocket';
14
- wsOrigin: string;
15
- wsSendInterval: number;
16
- uploadOrigin: string;
17
- recognizeOrigin: string;
18
- allowPunctuationMark: boolean;
19
- lastChunkTimeout: number;
20
- wsTimeout: number;
21
- }>;
1
+ import { AudioTypes } from './types';
22
2
  export default class AudioSDK {
23
3
  private plugins;
24
4
  private static instance;
@@ -36,11 +16,14 @@ export default class AudioSDK {
36
16
  contentRef: import("vue").Ref<string>;
37
17
  wsConnected: import("vue").Ref<boolean>;
38
18
  private loading;
19
+ private pauseContent;
20
+ recorderStatus: import("vue").Ref<"" | "fail" | "recording" | "pause" | "ws_close" | "stop">;
21
+ recorderClosing: import("vue").Ref<boolean>;
39
22
  waveView: any;
40
23
  constructor();
41
24
  static create(): AudioSDK;
42
25
  private initRecorder;
43
- start(options: AudioOptions): Promise<SpeechResult>;
26
+ start(options: AudioTypes.AudioOptions): Promise<AudioTypes.SpeechResult>;
44
27
  private setWsConnected;
45
28
  private setupWebSocket;
46
29
  private startRecording;
@@ -54,8 +37,19 @@ export default class AudioSDK {
54
37
  private sendBlob;
55
38
  private messageResolver;
56
39
  private lastChunkTimer;
40
+ /**
41
+ * 关闭录音
42
+ * isErrorSet 错误状态需要关闭录音, 关闭页面或者弹框, 并提示
43
+ * isEndSet 结束 需要校验录音空值并提示
44
+ * isCloseSet 关闭 不要返回this.contentRef.value
45
+ * @param params
46
+ * @returns
47
+ */
57
48
  stop(params?: {
58
49
  timeout?: boolean;
50
+ isErrorSet?: boolean;
51
+ isEndSet?: boolean;
52
+ isCloseSet?: boolean;
59
53
  }): Promise<void>;
60
54
  private resolvePendingRequest;
61
55
  private processHttpRecording;
@@ -63,14 +57,23 @@ export default class AudioSDK {
63
57
  private handleMessage;
64
58
  private handleLastChunk;
65
59
  private parseMessageData;
66
- handleError(msg: string, isUserNotAllow?: boolean): void;
60
+ /**
61
+ * 错误处理
62
+ * @param msg 错误信息
63
+ * @param isUserNotAllow 是否用户未授权
64
+ * @param messageType 提示类型 warning 警告 error 错误
65
+ * @param errorType 错误类型 stop空值提示触发的, 就不需要再调用stop
66
+ * @returns
67
+ */
68
+ handleError(msg: string, isUserNotAllow?: boolean, messageType?: 'warning' | 'error', errorType?: 'stop'): Promise<void>;
67
69
  private cleanupWebSocket;
68
70
  private cleanupResources;
69
71
  private resetState;
70
72
  private checkEnvironment;
71
- pause(): void;
72
- resume(): void;
73
+ private cleanupWaveView;
74
+ startWaveView(options: AudioTypes.WaveViewOptions): Promise<void>;
75
+ pause(): Promise<void>;
76
+ resume(): Promise<void>;
73
77
  destroy(): void;
74
78
  static destroy(): void;
75
79
  }
76
- export {};
@@ -6,6 +6,8 @@ import { loadRecorderPlugins } from './utils/recorder/index.js';
6
6
  import { ref } from 'vue';
7
7
  import { $message } from './utils/index.js';
8
8
  import { RecordingModal } from './utils/recordingModal.js';
9
+ import { AudioTypes } from './types/index.js';
10
+ import { promiseTimeout } from '@vueuse/core';
9
11
  import Recorder from './utils/recorder/recorder.js';
10
12
 
11
13
  const DEFAULT_OPTIONS = {
@@ -31,7 +33,7 @@ const _AudioSDK = class {
31
33
  ...DEFAULT_OPTIONS
32
34
  };
33
35
  this.reqId = "";
34
- this.connectionState = 0 /* DISCONNECTED */;
36
+ this.connectionState = AudioTypes.ConnectionState.DISCONNECTED;
35
37
  this.sendBuffer = [];
36
38
  this.startTimestamp = 0;
37
39
  this.bufferIndex = 0;
@@ -40,6 +42,9 @@ const _AudioSDK = class {
40
42
  this.contentRef = ref("");
41
43
  this.wsConnected = ref(false);
42
44
  this.loading = ref(false);
45
+ this.pauseContent = "";
46
+ this.recorderStatus = ref("");
47
+ this.recorderClosing = ref(false);
43
48
  this.waveView = null;
44
49
  this.messageResolver = null;
45
50
  this.lastChunkTimer = null;
@@ -61,8 +66,10 @@ const _AudioSDK = class {
61
66
  }
62
67
  async start(options) {
63
68
  this.resetState();
69
+ this.wsConnected.value = false;
64
70
  Object.assign(this.options, DEFAULT_OPTIONS, options);
65
71
  if (!this.checkEnvironment()) {
72
+ this.recorderStatus.value = "fail";
66
73
  return Promise.reject({
67
74
  result: "fail",
68
75
  msg: "\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u5F55\u97F3"
@@ -71,6 +78,7 @@ const _AudioSDK = class {
71
78
  if (!this.recorder)
72
79
  this.initRecorder();
73
80
  this.reqId = uuidGenerator();
81
+ this.pauseContent = "";
74
82
  this.contentRef.value = "";
75
83
  if (this.options.type === "websocket") {
76
84
  this.setWsConnected(false);
@@ -84,13 +92,13 @@ const _AudioSDK = class {
84
92
  this.wsConnected.value = wsConnected;
85
93
  }
86
94
  async setupWebSocket() {
87
- if (this.connectionState === 2 /* CONNECTED */)
95
+ if (this.connectionState === AudioTypes.ConnectionState.CONNECTED)
88
96
  return this.setWsConnected(true);
89
97
  return new Promise((resolve, reject) => {
90
98
  const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
91
99
  const url = this.options.origin || `${protocol}//${window.location.host}${this.options.wsOrigin}`;
92
100
  this.webSocket = new WebSocket(url);
93
- this.connectionState = 1 /* CONNECTING */;
101
+ this.connectionState = AudioTypes.ConnectionState.CONNECTING;
94
102
  const timeout = setTimeout(() => {
95
103
  this.cleanupWebSocket();
96
104
  reject({
@@ -101,7 +109,7 @@ const _AudioSDK = class {
101
109
  }, this.options.wsTimeout);
102
110
  this.webSocket.onopen = () => {
103
111
  clearTimeout(timeout);
104
- this.connectionState = 2 /* CONNECTED */;
112
+ this.connectionState = AudioTypes.ConnectionState.CONNECTED;
105
113
  this.setWsConnected(true);
106
114
  resolve();
107
115
  };
@@ -110,6 +118,7 @@ const _AudioSDK = class {
110
118
  this.webSocket.onclose = () => {
111
119
  this.cleanupWebSocket();
112
120
  clearTimeout(timeout);
121
+ this.recorderStatus.value = "ws_close";
113
122
  };
114
123
  });
115
124
  }
@@ -124,9 +133,11 @@ const _AudioSDK = class {
124
133
  this.recorder.start();
125
134
  if (this.options.timed) {
126
135
  this.timer = setTimeout(() => this.stop({
127
- timeout: true
136
+ timeout: true,
137
+ isEndSet: true
128
138
  }), this.options.timed * 1e3);
129
139
  }
140
+ this.recorderStatus.value = "recording";
130
141
  if (this.options.showModal) {
131
142
  this.showRecordingModal();
132
143
  }
@@ -138,10 +149,14 @@ const _AudioSDK = class {
138
149
  showRecordingModal() {
139
150
  this.recordingModal.show({
140
151
  instance: this.options.instance,
141
- onClose: () => this.stop(),
152
+ onClose: async (obj) => await this.stop(obj),
153
+ startWaveViewMethod: (options) => this.startWaveView(options),
154
+ pause: () => this.pause(),
155
+ resume: () => this.resume(),
142
156
  props: {
143
157
  contentRef: this.contentRef,
144
- wsConnected: this.wsConnected
158
+ wsConnected: this.wsConnected,
159
+ recorderStatus: this.recorderStatus
145
160
  }
146
161
  });
147
162
  }
@@ -223,20 +238,38 @@ const _AudioSDK = class {
223
238
  reader.readAsDataURL(blob);
224
239
  }
225
240
  async stop(params = {}) {
226
- this.recordingModal.hide();
241
+ var _a, _b;
242
+ if (this.recorderClosing.value)
243
+ return;
244
+ this.recorderClosing.value = true;
245
+ (_b = (_a = this.recordingModal) == null ? void 0 : _a.setLoading) == null ? void 0 : _b.call(_a);
227
246
  clearTimeout(this.timer);
228
- if (this.options.type === "http") {
229
- await this.processHttpRecording();
230
- } else {
231
- this.sendBufferedData(true);
232
- await new Promise((resolve) => {
233
- this.messageResolver = resolve;
234
- this.lastChunkTimer = setTimeout(resolve, this.options.lastChunkTimeout);
235
- });
236
- this.messageResolver = null;
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) {
262
+ this.handleError("\u5F55\u97F3\u5185\u5BB9\u4E3A\u7A7A", false, "warning", "stop");
263
+ this.recorderClosing.value = false;
264
+ return;
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;
237
272
  }
238
- this.resolvePendingRequest(params);
239
- this.cleanupResources();
240
273
  }
241
274
  resolvePendingRequest(params) {
242
275
  const handler = this.messageQueue.shift();
@@ -244,7 +277,7 @@ const _AudioSDK = class {
244
277
  return;
245
278
  const result = {
246
279
  result: "success",
247
- data: this.contentRef.value,
280
+ data: params.isCloseSet ? "" : this.contentRef.value,
248
281
  timeout: params.timeout
249
282
  };
250
283
  handler.resolve(result);
@@ -303,11 +336,23 @@ const _AudioSDK = class {
303
336
  }
304
337
  handleMessage(event) {
305
338
  const {
306
- data,
307
- isLast
339
+ data: {
340
+ data,
341
+ isLast
342
+ } = {
343
+ data: "",
344
+ isLast: false
345
+ },
346
+ success,
347
+ msg
308
348
  } = this.parseMessageData(event.data) || {};
349
+ if (!success) {
350
+ this.handleError(msg || "\u670D\u52A1\u5F02\u5E38");
351
+ return;
352
+ }
309
353
  if (data) {
310
- this.contentRef.value = this.options.allowPunctuationMark ? data : data.replace(/[??,。,.\s]/g, "");
354
+ const _data = this.pauseContent + data;
355
+ this.contentRef.value = this.options.allowPunctuationMark ? _data : _data.replace(/[??,。,.\s]/g, "");
311
356
  }
312
357
  isLast && this.handleLastChunk();
313
358
  }
@@ -323,23 +368,23 @@ const _AudioSDK = class {
323
368
  }
324
369
  parseMessageData(data) {
325
370
  if (!isString(data))
326
- return null;
371
+ return {
372
+ success: true
373
+ };
327
374
  try {
328
- const res = JSON.parse(data).data;
375
+ const res = JSON.parse(data);
329
376
  if (!isObject(res))
330
377
  return {
331
- data,
332
- isLast: false
378
+ success: true
333
379
  };
334
380
  return res;
335
381
  } catch (e) {
336
382
  return {
337
- data,
338
- isLast: false
383
+ success: true
339
384
  };
340
385
  }
341
386
  }
342
- handleError(msg, isUserNotAllow = false) {
387
+ async handleError(msg, isUserNotAllow = false, messageType = "error", errorType) {
343
388
  const handler = this.messageQueue.shift();
344
389
  if (!handler)
345
390
  return;
@@ -348,25 +393,31 @@ const _AudioSDK = class {
348
393
  msg,
349
394
  isUserNotAllow
350
395
  };
351
- handler.reject(error);
352
- this.cleanupResources();
396
+ this.recorderStatus.value = "fail";
397
+ errorType != "stop" && await this.stop({
398
+ isErrorSet: true
399
+ });
353
400
  if (isUserNotAllow) {
354
401
  $message.warning("\u8BF7\u5F00\u542F\u9EA6\u514B\u98CE\u6743\u9650");
402
+ } else if (msg) {
403
+ $message[messageType](msg);
355
404
  }
405
+ handler.reject(error);
356
406
  }
357
407
  cleanupWebSocket() {
358
- var _a;
359
- (_a = this.webSocket) == null ? void 0 : _a.close();
408
+ var _a, _b;
409
+ (_b = (_a = this.webSocket) == null ? void 0 : _a.close) == null ? void 0 : _b.call(_a);
360
410
  this.webSocket = null;
361
- this.connectionState = 0 /* DISCONNECTED */;
411
+ this.connectionState = AudioTypes.ConnectionState.DISCONNECTED;
362
412
  }
363
- cleanupResources() {
364
- var _a;
365
- (_a = this.recorder) == null ? void 0 : _a.close();
413
+ async cleanupResources() {
414
+ var _a, _b;
415
+ await ((_b = (_a = this.recorder) == null ? void 0 : _a.close) == null ? void 0 : _b.call(_a));
366
416
  this.sendBuffer = [];
367
417
  this.startTimestamp = 0;
368
418
  }
369
419
  resetState() {
420
+ this.recorderStatus.value = "";
370
421
  this.cleanupResources();
371
422
  clearTimeout(this.timer);
372
423
  }
@@ -377,13 +428,43 @@ const _AudioSDK = class {
377
428
  }
378
429
  return true;
379
430
  }
380
- pause() {
381
- var _a;
382
- (_a = this.recorder) == null ? void 0 : _a.pause();
431
+ cleanupWaveView() {
432
+ if (!this.waveView)
433
+ return;
434
+ this.waveView.elem = null;
435
+ this.waveView.canvas = null;
436
+ this.waveView = null;
437
+ }
438
+ async startWaveView(options) {
439
+ var _a, _b, _c, _d;
440
+ this.cleanupWaveView();
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;
455
+ }
456
+ async pause() {
457
+ var _a, _b;
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";
383
462
  }
384
- resume() {
463
+ async resume() {
385
464
  var _a;
465
+ await this.setupWebSocket();
386
466
  (_a = this.recorder) == null ? void 0 : _a.resume();
467
+ this.recorderStatus.value = "recording";
387
468
  }
388
469
  destroy() {
389
470
  this.resetState();
@@ -0,0 +1,31 @@
1
+ declare const _default: import("vue").DefineComponent<{
2
+ isCountActive: {
3
+ type: BooleanConstructor;
4
+ default: boolean;
5
+ };
6
+ }, {
7
+ props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
8
+ isCountActive: {
9
+ type: BooleanConstructor;
10
+ default: boolean;
11
+ };
12
+ }>> & {
13
+ "onUpdate:isCountFinished"?: ((...args: any[]) => any) | undefined;
14
+ }>>;
15
+ emit: (event: "update:isCountFinished", ...args: any[]) => void;
16
+ renderCountdown: ({ seconds }: {
17
+ seconds: number;
18
+ }) => number;
19
+ countDownFinish: () => void;
20
+ NCountdown: any;
21
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:isCountFinished"[], "update:isCountFinished", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
22
+ isCountActive: {
23
+ type: BooleanConstructor;
24
+ default: boolean;
25
+ };
26
+ }>> & {
27
+ "onUpdate:isCountFinished"?: ((...args: any[]) => any) | undefined;
28
+ }, {
29
+ isCountActive: boolean;
30
+ }>;
31
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import _sfc_main from './readyCountdown.vue2.js';
2
+ import _export_sfc from '../../../../_virtual/_plugin-vue_export-helper.js';
3
+
4
+ var ReadyCountdown = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "readyCountdown.vue"]]);
5
+
6
+ export { ReadyCountdown as default };
@@ -0,0 +1,46 @@
1
+ import { defineComponent, openBlock, createElementBlock, createElementVNode, createVNode, unref } from 'vue';
2
+ import { NCountdown } from 'naive-ui';
3
+
4
+ const _hoisted_1 = {
5
+ class: "c-recording-ready"
6
+ };
7
+ const _hoisted_2 = {
8
+ class: "c-recording-countdown-box"
9
+ };
10
+ const _hoisted_3 = /* @__PURE__ */ createElementVNode("h4", null, "\u51C6\u5907\u5F00\u59CB\u5F55\u97F3", -1);
11
+ const _hoisted_4 = /* @__PURE__ */ createElementVNode("p", {
12
+ class: "c-recording-ready-desc"
13
+ }, "3\u79D2\u540E\u5F00\u59CB\u5F55\u97F3\uFF0C\u8BF7\u505A\u597D\u51C6\u5907\uFF01", -1);
14
+ var _sfc_main = /* @__PURE__ */ defineComponent({
15
+ __name: "readyCountdown",
16
+ props: {
17
+ isCountActive: {
18
+ type: Boolean,
19
+ default: false
20
+ }
21
+ },
22
+ emits: ["update:isCountFinished"],
23
+ setup(__props, {
24
+ emit
25
+ }) {
26
+ const props = __props;
27
+ const renderCountdown = ({
28
+ seconds
29
+ }) => {
30
+ return seconds;
31
+ };
32
+ const countDownFinish = () => {
33
+ emit("update:isCountFinished", true);
34
+ };
35
+ return (_ctx, _cache) => {
36
+ return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [createElementVNode("span", null, [createVNode(unref(NCountdown), {
37
+ active: props.isCountActive,
38
+ duration: 3e3,
39
+ render: renderCountdown,
40
+ onFinish: countDownFinish
41
+ }, null, 8, ["active"])])]), _hoisted_3, _hoisted_4]);
42
+ };
43
+ }
44
+ });
45
+
46
+ export { _sfc_main as default };