@tencentcloud/ai-desk-customer-vue 0.1.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.
Files changed (351) hide show
  1. package/.code.yml +17 -0
  2. package/.eslintignore +6 -0
  3. package/.stylelintrc.json +40 -0
  4. package/CHANGELOG.md +5 -0
  5. package/README.md +12 -0
  6. package/adapter-vue-web.ts +73 -0
  7. package/adapter-vue.ts +10 -0
  8. package/assets/audio-before-delete.svg +4 -0
  9. package/assets/audio-blue.png +0 -0
  10. package/assets/audio-bubble-blue.svg +3 -0
  11. package/assets/audio-bubble-red.svg +3 -0
  12. package/assets/audio-delete.svg +10 -0
  13. package/assets/audio.svg +6 -0
  14. package/assets/back.svg +16 -0
  15. package/assets/background_mobile.png +0 -0
  16. package/assets/camera-uni.png +0 -0
  17. package/assets/close-quote-icon.svg +3 -0
  18. package/assets/customer_avatar.png +0 -0
  19. package/assets/customer_avatar_mobile.png +0 -0
  20. package/assets/dialog-close.png +0 -0
  21. package/assets/double-arrow.svg +1 -0
  22. package/assets/download.svg +6 -0
  23. package/assets/emoji.png +0 -0
  24. package/assets/face-uni.png +0 -0
  25. package/assets/face.png +0 -0
  26. package/assets/file-h5.png +0 -0
  27. package/assets/files.png +0 -0
  28. package/assets/form-dialog-bg.png +0 -0
  29. package/assets/icon-arrow-left.svg +7 -0
  30. package/assets/icon-close.svg +6 -0
  31. package/assets/iconRight.svg +3 -0
  32. package/assets/icon_form.png +0 -0
  33. package/assets/icon_form_filled.png +0 -0
  34. package/assets/icon_question.png +0 -0
  35. package/assets/icon_refresh.png +0 -0
  36. package/assets/icon_success.png +0 -0
  37. package/assets/imRobotGuess.svg +4 -0
  38. package/assets/image-uni.png +0 -0
  39. package/assets/image.png +0 -0
  40. package/assets/keyboard_icon.png +0 -0
  41. package/assets/loading.png +0 -0
  42. package/assets/more-uni.png +0 -0
  43. package/assets/more_tools.png +0 -0
  44. package/assets/msg-audio.svg +1 -0
  45. package/assets/msg-copy.svg +30 -0
  46. package/assets/msg-del.svg +33 -0
  47. package/assets/msg-quote.svg +8 -0
  48. package/assets/msg-revoke.svg +29 -0
  49. package/assets/radio-check.png +0 -0
  50. package/assets/radio-uncheck.png +0 -0
  51. package/assets/radio.svg +6 -0
  52. package/assets/refresh.svg +4 -0
  53. package/assets/rotate-left.svg +7 -0
  54. package/assets/rotate-right.svg +7 -0
  55. package/assets/star.png +0 -0
  56. package/assets/starLine.png +0 -0
  57. package/assets/translate.svg +12 -0
  58. package/assets/video-play.png +0 -0
  59. package/assets/video-uni.png +0 -0
  60. package/assets/video.png +0 -0
  61. package/assets/zoom-in.svg +9 -0
  62. package/assets/zoom-out.svg +9 -0
  63. package/components/CustomerServiceChat/chat-header/index-web.vue +141 -0
  64. package/components/CustomerServiceChat/emoji-config/custom-emoji.ts +15 -0
  65. package/components/CustomerServiceChat/emoji-config/default-emoji.ts +114 -0
  66. package/components/CustomerServiceChat/emoji-config/index.ts +140 -0
  67. package/components/CustomerServiceChat/emoji-config/locales/en.ts +66 -0
  68. package/components/CustomerServiceChat/emoji-config/locales/zh_cn.ts +66 -0
  69. package/components/CustomerServiceChat/index-web.vue +250 -0
  70. package/components/CustomerServiceChat/message-input/index-web.vue +214 -0
  71. package/components/CustomerServiceChat/message-input/index.ts +2 -0
  72. package/components/CustomerServiceChat/message-input/message-input-button.vue +95 -0
  73. package/components/CustomerServiceChat/message-input/message-input-editor-web.vue +884 -0
  74. package/components/CustomerServiceChat/message-input/message-input-file-web.ts +38 -0
  75. package/components/CustomerServiceChat/message-input/message-input-quote/index.vue +204 -0
  76. package/components/CustomerServiceChat/message-input-toolbar/emoji-dialog-mobile/emoji-dialog-mobile.vue +145 -0
  77. package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/emoji-picker-dialog.vue +180 -0
  78. package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/index.ts +2 -0
  79. package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/index.vue +90 -0
  80. package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/style/h5.scss +26 -0
  81. package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/style/index.scss +4 -0
  82. package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/style/web.scss +55 -0
  83. package/components/CustomerServiceChat/message-input-toolbar/file-upload/index.ts +2 -0
  84. package/components/CustomerServiceChat/message-input-toolbar/file-upload/index.vue +77 -0
  85. package/components/CustomerServiceChat/message-input-toolbar/image-upload/index.ts +2 -0
  86. package/components/CustomerServiceChat/message-input-toolbar/image-upload/index.vue +185 -0
  87. package/components/CustomerServiceChat/message-input-toolbar/index-web.vue +191 -0
  88. package/components/CustomerServiceChat/message-input-toolbar/index.ts +2 -0
  89. package/components/CustomerServiceChat/message-input-toolbar/style/uni.scss +111 -0
  90. package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/index.vue +149 -0
  91. package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/color.scss +6 -0
  92. package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/h5.scss +20 -0
  93. package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/index.scss +5 -0
  94. package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/uni.scss +36 -0
  95. package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/web.scss +19 -0
  96. package/components/CustomerServiceChat/message-input-toolbar/video-upload/index.ts +2 -0
  97. package/components/CustomerServiceChat/message-input-toolbar/video-upload/index.vue +146 -0
  98. package/components/CustomerServiceChat/message-list/index-web.vue +712 -0
  99. package/components/CustomerServiceChat/message-list/link/index.ts +23 -0
  100. package/components/CustomerServiceChat/message-list/message-elements/message-audio-web.vue +223 -0
  101. package/components/CustomerServiceChat/message-list/message-elements/message-bubble-web.vue +504 -0
  102. package/components/CustomerServiceChat/message-list/message-elements/message-custom.vue +5 -0
  103. package/components/CustomerServiceChat/message-list/message-elements/message-face.vue +45 -0
  104. package/components/CustomerServiceChat/message-list/message-elements/message-file.vue +151 -0
  105. package/components/CustomerServiceChat/message-list/message-elements/message-image-web.vue +97 -0
  106. package/components/CustomerServiceChat/message-list/message-elements/message-location.vue +34 -0
  107. package/components/CustomerServiceChat/message-list/message-elements/message-quote/index-web.vue +286 -0
  108. package/components/CustomerServiceChat/message-list/message-elements/message-quote/interface.ts +60 -0
  109. package/components/CustomerServiceChat/message-list/message-elements/message-record/index.vue +139 -0
  110. package/components/CustomerServiceChat/message-list/message-elements/message-text.vue +94 -0
  111. package/components/CustomerServiceChat/message-list/message-elements/message-timestamp.vue +76 -0
  112. package/components/CustomerServiceChat/message-list/message-elements/message-video-web.vue +319 -0
  113. package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/index.ts +9 -0
  114. package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-customer/index.ts +5 -0
  115. package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-customer/message-customer-service.vue +22 -0
  116. package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-plugin-layout-web.vue +133 -0
  117. package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-plugin-web.vue +83 -0
  118. package/components/CustomerServiceChat/message-list/message-elements/read-status/index.vue +193 -0
  119. package/components/CustomerServiceChat/message-list/message-elements/simple-message-list/index.vue +462 -0
  120. package/components/CustomerServiceChat/message-list/message-elements/simple-message-list/message-container.vue +105 -0
  121. package/components/CustomerServiceChat/message-list/message-elements/video-play.vue +59 -0
  122. package/components/CustomerServiceChat/message-list/message-tool/index-web.vue +312 -0
  123. package/components/CustomerServiceChat/message-list/message-tool/message-revoked.vue +63 -0
  124. package/components/CustomerServiceChat/message-list/scroll-button/index.vue +201 -0
  125. package/components/CustomerServiceChat/message-list/style/color.scss +32 -0
  126. package/components/CustomerServiceChat/message-list/style/h5.scss +16 -0
  127. package/components/CustomerServiceChat/message-list/style/index.scss +11 -0
  128. package/components/CustomerServiceChat/message-list/style/web.scss +180 -0
  129. package/components/CustomerServiceChat/style/common.scss +59 -0
  130. package/components/CustomerServiceChat/style/h5.scss +51 -0
  131. package/components/CustomerServiceChat/style/index.scss +12 -0
  132. package/components/CustomerServiceChat/style/uni.scss +13 -0
  133. package/components/CustomerServiceChat/style/web.scss +46 -0
  134. package/components/CustomerServiceChat/style/wx.scss +5 -0
  135. package/components/CustomerServiceChat/utils/conversationDraft.ts +86 -0
  136. package/components/CustomerServiceChat/utils/sendMessage.ts +140 -0
  137. package/components/common/Avatar/index.vue +148 -0
  138. package/components/common/BottomPopup/index.ts +3 -0
  139. package/components/common/BottomPopup/index.vue +160 -0
  140. package/components/common/BottomPopup/style/h5.scss +62 -0
  141. package/components/common/BottomPopup/style/index.scss +3 -0
  142. package/components/common/BottomPopup/style/modal.scss +5 -0
  143. package/components/common/Dialog/index.ts +3 -0
  144. package/components/common/Dialog/index.vue +120 -0
  145. package/components/common/Dialog/style/color.scss +43 -0
  146. package/components/common/Dialog/style/dialog.scss +4 -0
  147. package/components/common/Dialog/style/h5.scss +56 -0
  148. package/components/common/Dialog/style/web.scss +61 -0
  149. package/components/common/Drawer/index.vue +164 -0
  150. package/components/common/Icon.vue +83 -0
  151. package/components/common/ImagePreviewer/image-item-web.vue +42 -0
  152. package/components/common/ImagePreviewer/index-web.vue +682 -0
  153. package/components/common/ImagePreviewer/index.ts +3 -0
  154. package/components/common/Overlay/index.vue +126 -0
  155. package/components/common/ProgressMessage/index.vue +95 -0
  156. package/components/common/RadioSelect/index.vue +59 -0
  157. package/components/common/RichText/LICENSE +21 -0
  158. package/components/common/RichText/README.md +244 -0
  159. package/components/common/RichText/dist/mp-alipay/index.acss +1 -0
  160. package/components/common/RichText/dist/mp-alipay/index.axml +1 -0
  161. package/components/common/RichText/dist/mp-alipay/index.js +8 -0
  162. package/components/common/RichText/dist/mp-alipay/index.json +1 -0
  163. package/components/common/RichText/dist/mp-alipay/node/node.acss +1 -0
  164. package/components/common/RichText/dist/mp-alipay/node/node.axml +1 -0
  165. package/components/common/RichText/dist/mp-alipay/node/node.js +1 -0
  166. package/components/common/RichText/dist/mp-alipay/node/node.json +1 -0
  167. package/components/common/RichText/dist/mp-alipay/parser.js +1 -0
  168. package/components/common/RichText/dist/mp-baidu/index.css +1 -0
  169. package/components/common/RichText/dist/mp-baidu/index.js +8 -0
  170. package/components/common/RichText/dist/mp-baidu/index.json +1 -0
  171. package/components/common/RichText/dist/mp-baidu/index.swan +1 -0
  172. package/components/common/RichText/dist/mp-baidu/node/node.css +1 -0
  173. package/components/common/RichText/dist/mp-baidu/node/node.js +1 -0
  174. package/components/common/RichText/dist/mp-baidu/node/node.json +1 -0
  175. package/components/common/RichText/dist/mp-baidu/node/node.swan +1 -0
  176. package/components/common/RichText/dist/mp-baidu/parser.js +1 -0
  177. package/components/common/RichText/dist/mp-qq/index.js +8 -0
  178. package/components/common/RichText/dist/mp-qq/index.json +1 -0
  179. package/components/common/RichText/dist/mp-qq/index.qml +1 -0
  180. package/components/common/RichText/dist/mp-qq/index.qss +1 -0
  181. package/components/common/RichText/dist/mp-qq/node/node.js +1 -0
  182. package/components/common/RichText/dist/mp-qq/node/node.json +1 -0
  183. package/components/common/RichText/dist/mp-qq/node/node.qml +1 -0
  184. package/components/common/RichText/dist/mp-qq/node/node.qss +1 -0
  185. package/components/common/RichText/dist/mp-qq/parser.js +1 -0
  186. package/components/common/RichText/dist/mp-toutiao/index.js +8 -0
  187. package/components/common/RichText/dist/mp-toutiao/index.json +1 -0
  188. package/components/common/RichText/dist/mp-toutiao/index.ttml +1 -0
  189. package/components/common/RichText/dist/mp-toutiao/index.ttss +1 -0
  190. package/components/common/RichText/dist/mp-toutiao/node/node.js +1 -0
  191. package/components/common/RichText/dist/mp-toutiao/node/node.json +1 -0
  192. package/components/common/RichText/dist/mp-toutiao/node/node.ttml +1 -0
  193. package/components/common/RichText/dist/mp-toutiao/node/node.ttss +1 -0
  194. package/components/common/RichText/dist/mp-toutiao/parser.js +1 -0
  195. package/components/common/RichText/dist/mp-weixin/index.js +8 -0
  196. package/components/common/RichText/dist/mp-weixin/index.json +1 -0
  197. package/components/common/RichText/dist/mp-weixin/index.wxml +1 -0
  198. package/components/common/RichText/dist/mp-weixin/index.wxss +1 -0
  199. package/components/common/RichText/dist/mp-weixin/node/node.js +1 -0
  200. package/components/common/RichText/dist/mp-weixin/node/node.json +1 -0
  201. package/components/common/RichText/dist/mp-weixin/node/node.wxml +1 -0
  202. package/components/common/RichText/dist/mp-weixin/node/node.wxss +1 -0
  203. package/components/common/RichText/dist/mp-weixin/parser.js +1 -0
  204. package/components/common/RichText/dist/uni-app/components/mp-html/mp-html.vue +498 -0
  205. package/components/common/RichText/dist/uni-app/components/mp-html/node/node.vue +587 -0
  206. package/components/common/RichText/dist/uni-app/components/mp-html/parser.js +1393 -0
  207. package/components/common/RichText/dist/uni-app/static/app-plus/mp-html/js/handler.js +1 -0
  208. package/components/common/RichText/dist/uni-app/static/app-plus/mp-html/js/uni.webview.min.js +1 -0
  209. package/components/common/RichText/dist/uni-app/static/app-plus/mp-html/local.html +1 -0
  210. package/components/common/RichText/docs/.nojekyll +0 -0
  211. package/components/common/RichText/docs/index.html +50 -0
  212. package/components/common/RichText/docs/lib/docsify.min.js +1 -0
  213. package/components/common/RichText/docs/lib/prism-bash.min.js +1 -0
  214. package/components/common/RichText/docs/lib/search.min.js +1 -0
  215. package/components/common/RichText/docs/lib/vue.css +858 -0
  216. package/components/common/RichText/gulpfile.js +113 -0
  217. package/components/common/RichText/lint.js +63 -0
  218. package/components/common/RichText/package.json +74 -0
  219. package/components/common/RichText/plugins/README.md +2 -0
  220. package/components/common/RichText/plugins/audio/README.md +25 -0
  221. package/components/common/RichText/plugins/audio/build.js +11 -0
  222. package/components/common/RichText/plugins/audio/context.js +7 -0
  223. package/components/common/RichText/plugins/audio/index.js +34 -0
  224. package/components/common/RichText/plugins/audio/miniprogram/audio.js +189 -0
  225. package/components/common/RichText/plugins/audio/miniprogram/audio.json +3 -0
  226. package/components/common/RichText/plugins/audio/miniprogram/audio.wxml +17 -0
  227. package/components/common/RichText/plugins/audio/miniprogram/audio.wxss +127 -0
  228. package/components/common/RichText/plugins/audio/miniprogram/build.js +3 -0
  229. package/components/common/RichText/plugins/audio/uni-app/audio.vue +269 -0
  230. package/components/common/RichText/plugins/audio/uni-app/build.js +3 -0
  231. package/components/common/RichText/plugins/card/README.md +30 -0
  232. package/components/common/RichText/plugins/card/build.js +14 -0
  233. package/components/common/RichText/plugins/card/index.js +7 -0
  234. package/components/common/RichText/plugins/card/miniprogram/build.js +3 -0
  235. package/components/common/RichText/plugins/card/miniprogram/card.js +26 -0
  236. package/components/common/RichText/plugins/card/miniprogram/card.json +3 -0
  237. package/components/common/RichText/plugins/card/miniprogram/card.wxml +9 -0
  238. package/components/common/RichText/plugins/card/miniprogram/card.wxss +55 -0
  239. package/components/common/RichText/plugins/card/uni-app/build.js +3 -0
  240. package/components/common/RichText/plugins/card/uni-app/card.vue +122 -0
  241. package/components/common/RichText/plugins/editable/README.md +137 -0
  242. package/components/common/RichText/plugins/editable/config.js +15 -0
  243. package/components/common/RichText/plugins/editable/miniprogram/build.js +813 -0
  244. package/components/common/RichText/plugins/editable/miniprogram/index.js +551 -0
  245. package/components/common/RichText/plugins/editable/uni-app/build.js +744 -0
  246. package/components/common/RichText/plugins/editable/uni-app/index.js +553 -0
  247. package/components/common/RichText/plugins/emoji/README.md +15 -0
  248. package/components/common/RichText/plugins/emoji/index.js +203 -0
  249. package/components/common/RichText/plugins/highlight/README.md +26 -0
  250. package/components/common/RichText/plugins/highlight/config.js +5 -0
  251. package/components/common/RichText/plugins/highlight/index.js +96 -0
  252. package/components/common/RichText/plugins/highlight/miniprogram/build.js +88 -0
  253. package/components/common/RichText/plugins/highlight/prism.css +125 -0
  254. package/components/common/RichText/plugins/highlight/prism.min.js +7 -0
  255. package/components/common/RichText/plugins/highlight/uni-app/build.js +88 -0
  256. package/components/common/RichText/plugins/img-cache/README.md +24 -0
  257. package/components/common/RichText/plugins/img-cache/build.js +16 -0
  258. package/components/common/RichText/plugins/img-cache/index.js +138 -0
  259. package/components/common/RichText/plugins/latex/README.md +16 -0
  260. package/components/common/RichText/plugins/latex/build.js +14 -0
  261. package/components/common/RichText/plugins/latex/index.js +77 -0
  262. package/components/common/RichText/plugins/latex/katex.css +1070 -0
  263. package/components/common/RichText/plugins/latex/katex.min.js +1 -0
  264. package/components/common/RichText/plugins/markdown/README.md +17 -0
  265. package/components/common/RichText/plugins/markdown/index.js +34 -0
  266. package/components/common/RichText/plugins/markdown/marked.min.js +6 -0
  267. package/components/common/RichText/plugins/markdown/miniprogram/build.js +70 -0
  268. package/components/common/RichText/plugins/markdown/uni-app/build.js +68 -0
  269. package/components/common/RichText/plugins/search/README.md +46 -0
  270. package/components/common/RichText/plugins/search/miniprogram/index.js +137 -0
  271. package/components/common/RichText/plugins/search/uni-app/index.js +132 -0
  272. package/components/common/RichText/plugins/style/README.md +30 -0
  273. package/components/common/RichText/plugins/style/index.js +129 -0
  274. package/components/common/RichText/plugins/style/parser.js +175 -0
  275. package/components/common/RichText/plugins/template/README.md +2 -0
  276. package/components/common/RichText/plugins/template/build.js +65 -0
  277. package/components/common/RichText/plugins/template/index.js +67 -0
  278. package/components/common/RichText/plugins/txv-video/README.md +18 -0
  279. package/components/common/RichText/plugins/txv-video/build.js +3 -0
  280. package/components/common/RichText/plugins/txv-video/index.js +46 -0
  281. package/components/common/RichText/plugins/txv-video/miniprogram/build.js +6 -0
  282. package/components/common/RichText/plugins/txv-video/uni-app/build.js +3 -0
  283. package/components/common/RichText/src/miniprogram/index.js +396 -0
  284. package/components/common/RichText/src/miniprogram/index.json +6 -0
  285. package/components/common/RichText/src/miniprogram/index.wxml +7 -0
  286. package/components/common/RichText/src/miniprogram/index.wxss +13 -0
  287. package/components/common/RichText/src/miniprogram/node/node.js +247 -0
  288. package/components/common/RichText/src/miniprogram/node/node.json +6 -0
  289. package/components/common/RichText/src/miniprogram/node/node.wxml +112 -0
  290. package/components/common/RichText/src/miniprogram/node/node.wxss +164 -0
  291. package/components/common/RichText/src/miniprogram/parser.js +1269 -0
  292. package/components/common/RichText/src/uni-app/components/mp-html/mp-html.vue +498 -0
  293. package/components/common/RichText/src/uni-app/components/mp-html/node/node.vue +585 -0
  294. package/components/common/RichText/src/uni-app/components/mp-html/parser.js +1393 -0
  295. package/components/common/RichText/src/uni-app/static/app-plus/mp-html/js/handler.js +254 -0
  296. package/components/common/RichText/src/uni-app/static/app-plus/mp-html/js/uni.webview.min.js +1 -0
  297. package/components/common/RichText/src/uni-app/static/app-plus/mp-html/local.html +33 -0
  298. package/components/common/RichText/tools/config.js +82 -0
  299. package/components/common/RichText/tools/converter.js +205 -0
  300. package/components/common/RichText/tools/ifdef.js +115 -0
  301. package/components/common/RichText/tools/minifier.js +40 -0
  302. package/components/common/RichText/tools/plugin.js +248 -0
  303. package/components/common/Toast/index-web.ts +122 -0
  304. package/components/common/Toast/index-web.vue +178 -0
  305. package/components/common/Toast/type.ts +8 -0
  306. package/components/common/common.scss +59 -0
  307. package/components/customer-icon.vue +56 -0
  308. package/components/message-branch.vue +120 -0
  309. package/components/message-customer-service.vue +114 -0
  310. package/components/message-form/form-branch.vue +68 -0
  311. package/components/message-form/form-input.vue +242 -0
  312. package/components/message-form/index.vue +80 -0
  313. package/components/message-multi-branch/branch-pc.vue +79 -0
  314. package/components/message-multi-branch/index.vue +60 -0
  315. package/components/message-multi-form/component-mobile/form-popup.vue +37 -0
  316. package/components/message-multi-form/component-mobile/input-mobile.vue +102 -0
  317. package/components/message-multi-form/component-mobile/label-mobile.vue +32 -0
  318. package/components/message-multi-form/component-mobile/radios-mobile.vue +161 -0
  319. package/components/message-multi-form/component-pc/input-pc.vue +93 -0
  320. package/components/message-multi-form/component-pc/label-pc.vue +33 -0
  321. package/components/message-multi-form/component-pc/radio-pc.vue +98 -0
  322. package/components/message-multi-form/form-mobile.vue +385 -0
  323. package/components/message-multi-form/form-pc.vue +184 -0
  324. package/components/message-multi-form/index.vue +61 -0
  325. package/components/message-product-card.vue +129 -0
  326. package/components/message-rating/index.vue +56 -0
  327. package/components/message-rating/message-rating-number.vue +247 -0
  328. package/components/message-rating/message-rating-star.vue +237 -0
  329. package/components/message-rich-text.vue +155 -0
  330. package/components/message-robot-welcome.vue +181 -0
  331. package/components/message-stream.vue +109 -0
  332. package/constant.ts +122 -0
  333. package/excluded-list.txt +6 -0
  334. package/index.ts +30 -0
  335. package/index.vue +60 -0
  336. package/interface.ts +176 -0
  337. package/logger/index.ts +12 -0
  338. package/logger/main.ts +120 -0
  339. package/package.json +62 -0
  340. package/script/fileCopy.js +60 -0
  341. package/script/syncVersion.js +35 -0
  342. package/server.ts +128 -0
  343. package/styles/common.scss +116 -0
  344. package/tsconfig.json +34 -0
  345. package/typings.d.ts +20 -0
  346. package/utils/chatStorage.ts +70 -0
  347. package/utils/copy-web.ts +141 -0
  348. package/utils/enableSampleTaskStatus.ts +8 -0
  349. package/utils/env.ts +15 -0
  350. package/utils/index.ts +59 -0
  351. package/utils/utils.ts +162 -0
@@ -0,0 +1,553 @@
1
+ /**
2
+ * @fileoverview editable 插件
3
+ */
4
+ const config = require('./config')
5
+ const Parser = require('../parser')
6
+
7
+ function Editable (vm) {
8
+ this.vm = vm
9
+ this.editHistory = [] // 历史记录
10
+ this.editI = -1 // 历史记录指针
11
+ vm._mask = [] // 蒙版被点击时进行的操作
12
+
13
+ vm._setData = function (path, val) {
14
+ const paths = path.split('.')
15
+ let target = vm
16
+ for (let i = 0; i < paths.length - 1; i++) {
17
+ target = target[paths[i]]
18
+ }
19
+ vm.$set(target, paths.pop(), val)
20
+ }
21
+
22
+ /**
23
+ * @description 移动历史记录指针
24
+ * @param {Number} num 移动距离
25
+ */
26
+ const move = num => {
27
+ setTimeout(() => {
28
+ const item = this.editHistory[this.editI + num]
29
+ if (item) {
30
+ this.editI += num
31
+ vm._setData(item.key, item.value)
32
+ }
33
+ }, 200)
34
+ }
35
+ vm.undo = () => move(-1) // 撤销
36
+ vm.redo = () => move(1) // 重做
37
+
38
+ /**
39
+ * @description 更新记录
40
+ * @param {String} path 更新内容路径
41
+ * @param {*} oldVal 旧值
42
+ * @param {*} newVal 新值
43
+ * @param {Boolean} set 是否更新到视图
44
+ * @private
45
+ */
46
+ vm._editVal = (path, oldVal, newVal, set) => {
47
+ // 当前指针后的内容去除
48
+ while (this.editI < this.editHistory.length - 1) {
49
+ this.editHistory.pop()
50
+ }
51
+
52
+ // 最多存储 30 条操作记录
53
+ while (this.editHistory.length > 30) {
54
+ this.editHistory.pop()
55
+ this.editI--
56
+ }
57
+
58
+ const last = this.editHistory[this.editHistory.length - 1]
59
+ if (!last || last.key !== path) {
60
+ if (last) {
61
+ // 去掉上一次的新值
62
+ this.editHistory.pop()
63
+ this.editI--
64
+ }
65
+ // 存入这一次的旧值
66
+ this.editHistory.push({
67
+ key: path,
68
+ value: oldVal
69
+ })
70
+ this.editI++
71
+ }
72
+
73
+ // 存入本次的新值
74
+ this.editHistory.push({
75
+ key: path,
76
+ value: newVal
77
+ })
78
+ this.editI++
79
+
80
+ // 更新到视图
81
+ if (set) {
82
+ vm._setData(path, newVal)
83
+ }
84
+ }
85
+
86
+ /**
87
+ * @description 获取菜单项
88
+ * @private
89
+ */
90
+ vm._getItem = function (node, up, down) {
91
+ let items
92
+ let i
93
+ if (node === 'color') {
94
+ return config.color
95
+ }
96
+ if (node.name === 'img') {
97
+ items = config.img.slice(0)
98
+ if (!vm.getSrc) {
99
+ i = items.indexOf('换图')
100
+ if (i !== -1) {
101
+ items.splice(i, 1)
102
+ }
103
+ i = items.indexOf('超链接')
104
+ if (i !== -1) {
105
+ items.splice(i, 1)
106
+ }
107
+ i = items.indexOf('预览图')
108
+ if (i !== -1) {
109
+ items.splice(i, 1)
110
+ }
111
+ }
112
+ i = items.indexOf('禁用预览')
113
+ if (i !== -1 && node.attrs.ignore) {
114
+ items[i] = '启用预览'
115
+ }
116
+ } else if (node.name === 'a') {
117
+ items = config.link.slice(0)
118
+ if (!vm.getSrc) {
119
+ i = items.indexOf('更换链接')
120
+ if (i !== -1) {
121
+ items.splice(i, 1)
122
+ }
123
+ }
124
+ } else if (node.name === 'video' || node.name === 'audio') {
125
+ items = config.media.slice(0)
126
+ i = items.indexOf('封面')
127
+ if (!vm.getSrc && i !== -1) {
128
+ items.splice(i, 1)
129
+ }
130
+ i = items.indexOf('循环')
131
+ if (node.attrs.loop && i !== -1) {
132
+ items[i] = '不循环'
133
+ }
134
+ i = items.indexOf('自动播放')
135
+ if (node.attrs.autoplay && i !== -1) {
136
+ items[i] = '不自动播放'
137
+ }
138
+ } else if (node.name === 'card') {
139
+ items = config.card.slice(0)
140
+ } else {
141
+ items = config.node.slice(0)
142
+ }
143
+ if (!up) {
144
+ i = items.indexOf('上移')
145
+ if (i !== -1) {
146
+ items.splice(i, 1)
147
+ }
148
+ }
149
+ if (!down) {
150
+ i = items.indexOf('下移')
151
+ if (i !== -1) {
152
+ items.splice(i, 1)
153
+ }
154
+ }
155
+ return items
156
+ }
157
+
158
+ /**
159
+ * @description 显示 tooltip
160
+ * @param {object} obj
161
+ * @private
162
+ */
163
+ vm._tooltip = function (obj) {
164
+ vm.$set(vm, 'tooltip', {
165
+ top: obj.top,
166
+ items: obj.items
167
+ })
168
+ vm._tooltipcb = obj.success
169
+ }
170
+
171
+ /**
172
+ * @description 显示滚动条
173
+ * @param {object} obj
174
+ * @private
175
+ */
176
+ vm._slider = function (obj) {
177
+ vm.$set(vm, 'slider', {
178
+ min: obj.min,
179
+ max: obj.max,
180
+ value: obj.value,
181
+ top: obj.top
182
+ })
183
+ vm._slideringcb = obj.changing
184
+ vm._slidercb = obj.change
185
+ }
186
+
187
+ /**
188
+ * @description 显示颜色选择
189
+ * @param {object} obj
190
+ * @private
191
+ */
192
+ vm._color = function (obj) {
193
+ vm.$set(vm, 'color', {
194
+ items: obj.items,
195
+ top: obj.top
196
+ })
197
+ vm._colorcb = obj.success
198
+ }
199
+
200
+ /**
201
+ * @description 点击蒙版
202
+ * @private
203
+ */
204
+ vm._maskTap = function () {
205
+ // 隐藏所有悬浮窗
206
+ while (vm._mask.length) {
207
+ (vm._mask.pop())()
208
+ }
209
+ if (vm.tooltip) {
210
+ vm.$set(vm, 'tooltip', null)
211
+ }
212
+ if (vm.slider) {
213
+ vm.$set(vm, 'slider', null)
214
+ }
215
+ if (vm.color) {
216
+ vm.$set(vm, 'color', null)
217
+ }
218
+ }
219
+
220
+ /**
221
+ * @description 插入节点
222
+ * @param {Object} node
223
+ */
224
+ function insert (node) {
225
+ if (vm._edit) {
226
+ vm._edit.insert(node)
227
+ } else {
228
+ const nodes = vm.nodes.slice(0)
229
+ nodes.push(node)
230
+ vm._editVal('nodes', vm.nodes, nodes, true)
231
+ }
232
+ }
233
+
234
+ /**
235
+ * @description 在光标处插入指定 html 内容
236
+ * @param {String} html 内容
237
+ */
238
+ vm.insertHtml = html => {
239
+ this.inserting = true
240
+ const arr = new Parser(vm).parse(html)
241
+ this.inserting = undefined
242
+ for (let i = 0; i < arr.length; i++) {
243
+ insert(arr[i])
244
+ }
245
+ }
246
+
247
+ /**
248
+ * @description 在光标处插入图片
249
+ */
250
+ vm.insertImg = function () {
251
+ vm.getSrc && vm.getSrc('img').then(src => {
252
+ if (typeof src === 'string') {
253
+ src = [src]
254
+ }
255
+ const parser = new Parser(vm)
256
+ for (let i = 0; i < src.length; i++) {
257
+ insert({
258
+ name: 'img',
259
+ attrs: {
260
+ src: parser.getUrl(src[i])
261
+ }
262
+ })
263
+ }
264
+ }).catch(() => { })
265
+ }
266
+
267
+ /**
268
+ * @description 在光标处插入一个链接
269
+ */
270
+ vm.insertLink = function () {
271
+ vm.getSrc && vm.getSrc('link').then(url => {
272
+ insert({
273
+ name: 'a',
274
+ attrs: {
275
+ href: url
276
+ },
277
+ children: [{
278
+ type: 'text',
279
+ text: url
280
+ }]
281
+ })
282
+ }).catch(() => { })
283
+ }
284
+
285
+ /**
286
+ * @description 在光标处插入一个表格
287
+ * @param {Number} rows 行数
288
+ * @param {Number} cols 列数
289
+ */
290
+ vm.insertTable = function (rows, cols) {
291
+ const table = {
292
+ name: 'table',
293
+ attrs: {
294
+ style: 'display:table;width:100%;margin:10px 0;text-align:center;border-spacing:0;border-collapse:collapse;border:1px solid gray'
295
+ },
296
+ children: []
297
+ }
298
+ for (let i = 0; i < rows; i++) {
299
+ const tr = {
300
+ name: 'tr',
301
+ attrs: {},
302
+ children: []
303
+ }
304
+ for (let j = 0; j < cols; j++) {
305
+ tr.children.push({
306
+ name: 'td',
307
+ attrs: {
308
+ style: 'padding:2px;border:1px solid gray'
309
+ },
310
+ children: [{
311
+ type: 'text',
312
+ text: ''
313
+ }]
314
+ })
315
+ }
316
+ table.children.push(tr)
317
+ }
318
+ insert(table)
319
+ }
320
+
321
+ /**
322
+ * @description 插入视频/音频
323
+ * @param {Object} node
324
+ */
325
+ function insertMedia (node) {
326
+ if (typeof node.src === 'string') {
327
+ node.src = [node.src]
328
+ }
329
+ const parser = new Parser(vm)
330
+ // 拼接主域名
331
+ for (let i = 0; i < node.src.length; i++) {
332
+ node.src[i] = parser.getUrl(node.src[i])
333
+ }
334
+ insert({
335
+ name: 'div',
336
+ attrs: {
337
+ style: 'text-align:center'
338
+ },
339
+ children: [node]
340
+ })
341
+ }
342
+
343
+ /**
344
+ * @description 在光标处插入一个视频
345
+ */
346
+ vm.insertVideo = function () {
347
+ vm.getSrc && vm.getSrc('video').then(src => {
348
+ insertMedia({
349
+ name: 'video',
350
+ attrs: {
351
+ controls: 'T'
352
+ },
353
+ children: [],
354
+ src,
355
+ // #ifdef APP-PLUS
356
+ html: `<video src="${src}" style="width:100%;height:100%"></video>`
357
+ // #endif
358
+ })
359
+ }).catch(() => { })
360
+ }
361
+
362
+ /**
363
+ * @description 在光标处插入一个音频
364
+ */
365
+ vm.insertAudio = function () {
366
+ vm.getSrc && vm.getSrc('audio').then(attrs => {
367
+ let src
368
+ if (attrs.src) {
369
+ src = attrs.src
370
+ attrs.src = undefined
371
+ } else {
372
+ src = attrs
373
+ attrs = {}
374
+ }
375
+ attrs.controls = 'T'
376
+ insertMedia({
377
+ name: 'audio',
378
+ attrs,
379
+ children: [],
380
+ src
381
+ })
382
+ }).catch(() => { })
383
+ }
384
+
385
+ /**
386
+ * @description 在光标处插入一段文本
387
+ */
388
+ vm.insertText = function () {
389
+ insert({
390
+ name: 'p',
391
+ attrs: {},
392
+ children: [{
393
+ type: 'text',
394
+ text: ''
395
+ }]
396
+ })
397
+ }
398
+
399
+ /**
400
+ * @description 清空内容
401
+ */
402
+ vm.clear = function () {
403
+ vm._maskTap()
404
+ vm._edit = undefined
405
+ vm.$set(vm, 'nodes', [{
406
+ name: 'p',
407
+ attrs: {},
408
+ children: [{
409
+ type: 'text',
410
+ text: ''
411
+ }]
412
+ }])
413
+ }
414
+
415
+ /**
416
+ * @description 获取编辑后的 html
417
+ */
418
+ vm.getContent = function () {
419
+ let html = '';
420
+ // 递归遍历获取
421
+ (function traversal (nodes, table) {
422
+ for (let i = 0; i < nodes.length; i++) {
423
+ let item = nodes[i]
424
+ if (item.type === 'text') {
425
+ html += item.text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\n/g, '<br>').replace(/\xa0/g, '&nbsp;') // 编码实体
426
+ } else {
427
+ if (item.name === 'img') {
428
+ item.attrs.i = ''
429
+ // 还原被转换的 svg
430
+ if ((item.attrs.src || '').includes('data:image/svg+xml;utf8,')) {
431
+ html += item.attrs.src.substr(24).replace(/%23/g, '#').replace('<svg', '<svg style="' + (item.attrs.style || '') + '"')
432
+ continue
433
+ }
434
+ } else if (item.name === 'video' || item.name === 'audio') {
435
+ // 还原 video 和 audio 的 source
436
+ item = JSON.parse(JSON.stringify(item))
437
+ if (item.src.length > 1) {
438
+ item.children = []
439
+ for (let j = 0; j < item.src.length; j++) {
440
+ item.children.push({
441
+ name: 'source',
442
+ attrs: {
443
+ src: item.src[j]
444
+ }
445
+ })
446
+ }
447
+ } else {
448
+ item.attrs.src = item.src[0]
449
+ }
450
+ } else if (item.name === 'div' && (item.attrs.style || '').includes('overflow:auto') && (item.children[0] || {}).name === 'table') {
451
+ // 还原滚动层
452
+ item = item.children[0]
453
+ }
454
+ // 还原 table
455
+ if (item.name === 'table') {
456
+ item = JSON.parse(JSON.stringify(item))
457
+ table = item.attrs
458
+ if ((item.attrs.style || '').includes('display:grid')) {
459
+ item.attrs.style = item.attrs.style.split('display:grid')[0]
460
+ const children = [{
461
+ name: 'tr',
462
+ attrs: {},
463
+ children: []
464
+ }]
465
+ for (let j = 0; j < item.children.length; j++) {
466
+ item.children[j].attrs.style = item.children[j].attrs.style.replace(/grid-[^;]+;*/g, '')
467
+ if (item.children[j].r !== children.length) {
468
+ children.push({
469
+ name: 'tr',
470
+ attrs: {},
471
+ children: [item.children[j]]
472
+ })
473
+ } else {
474
+ children[children.length - 1].children.push(item.children[j])
475
+ }
476
+ }
477
+ item.children = children
478
+ }
479
+ }
480
+ html += '<' + item.name
481
+ for (const attr in item.attrs) {
482
+ let val = item.attrs[attr]
483
+ if (!val) continue
484
+ if (val === 'T' || val === true) {
485
+ // bool 型省略值
486
+ html += ' ' + attr
487
+ continue
488
+ } else if (item.name[0] === 't' && attr === 'style' && table) {
489
+ // 取消为了显示 table 添加的 style
490
+ val = val.replace(/;*display:table[^;]*/, '')
491
+ if (table.border) {
492
+ val = val.replace(/border[^;]+;*/g, $ => $.includes('collapse') ? $ : '')
493
+ }
494
+ if (table.cellpadding) {
495
+ val = val.replace(/padding[^;]+;*/g, '')
496
+ }
497
+ if (!val) continue
498
+ }
499
+ html += ' ' + attr + '="' + val.replace(/"/g, '&quot;') + '"'
500
+ }
501
+ html += '>'
502
+ if (item.children) {
503
+ traversal(item.children, table)
504
+ html += '</' + item.name + '>'
505
+ }
506
+ }
507
+ }
508
+ })(vm.nodes)
509
+
510
+ // 其他插件处理
511
+ for (let i = vm.plugins.length; i--;) {
512
+ if (vm.plugins[i].onGetContent) {
513
+ html = vm.plugins[i].onGetContent(html) || html
514
+ }
515
+ }
516
+
517
+ return html
518
+ }
519
+ }
520
+
521
+ Editable.prototype.onUpdate = function (content, config) {
522
+ if (this.vm.editable) {
523
+ this.vm._maskTap()
524
+ config.entities.amp = '&'
525
+ if (!this.inserting) {
526
+ this.vm._edit = undefined
527
+ if (!content) {
528
+ setTimeout(() => {
529
+ this.vm.$set(this.vm, 'nodes', [{
530
+ name: 'p',
531
+ attrs: {},
532
+ children: [{
533
+ type: 'text',
534
+ text: ''
535
+ }]
536
+ }])
537
+ }, 0)
538
+ }
539
+ }
540
+ }
541
+ }
542
+
543
+ Editable.prototype.onParse = function (node) {
544
+ // 空白单元格可编辑
545
+ if (this.vm.editable && (node.name === 'td' || node.name === 'th') && !this.vm.getText(node.children)) {
546
+ node.children.push({
547
+ type: 'text',
548
+ text: ''
549
+ })
550
+ }
551
+ }
552
+
553
+ module.exports = Editable
@@ -0,0 +1,15 @@
1
+ # emoji
2
+ 功能:解析 *emoji*
3
+ 大小:*≈3KB*
4
+ 支持平台:
5
+
6
+ | 微信小程序 | QQ 小程序 | 百度小程序 | 支付宝小程序 | 头条小程序 | uni-app |
7
+ |:---:|:---:|:---:|:---:|:---:|:---:|
8
+ | √ | √ | √ | √ | √ | √ |
9
+
10
+ 说明:
11
+ 将形如 *[笑脸]* 的文本替换为 *emoji* 字符 😄
12
+ 匹配模式可以通过修改 *reg* 变量实现
13
+ 默认配置了 *177* 个常用的 *emoji* 小表情,可以自行按照需要修改 *data* 变量
14
+
15
+ ?> 与 *editable* 插件共用时,导出编辑好的 *html* 内容,会将 *emoji* 字符编码为文本形式,便于存储