@robot-admin/naive-ui-components 0.40.4 → 0.41.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 (495) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +62 -214
  3. package/README_EN.md +62 -195
  4. package/dist/ActionOverflow.cjs +1 -0
  5. package/dist/ActionOverflow.js +1 -0
  6. package/dist/C_ActionBar.css +63 -53
  7. package/dist/C_ActionBar2.cjs +1 -1
  8. package/dist/C_ActionBar2.js +1 -1
  9. package/dist/C_ApprovalViewer.cjs +1 -0
  10. package/dist/C_ApprovalViewer.css +79 -0
  11. package/dist/C_ApprovalViewer.d.cts +2 -0
  12. package/dist/C_ApprovalViewer.d.ts +2 -0
  13. package/dist/C_ApprovalViewer.js +1 -0
  14. package/dist/C_ApprovalViewer2.cjs +1 -0
  15. package/dist/C_ApprovalViewer2.js +1 -0
  16. package/dist/C_Attachments.cjs +1 -0
  17. package/dist/C_Attachments.css +204 -0
  18. package/dist/C_Attachments.d.cts +2 -0
  19. package/dist/C_Attachments.d.ts +2 -0
  20. package/dist/C_Attachments.js +1 -0
  21. package/dist/C_Attachments2.cjs +1 -0
  22. package/dist/C_Attachments2.js +1 -0
  23. package/dist/C_AudioPlayer.d.cts +1 -1
  24. package/dist/C_AudioPlayer.d.ts +1 -1
  25. package/dist/C_AutoComplete.d.cts +2 -2
  26. package/dist/C_AutoComplete.d.ts +2 -2
  27. package/dist/C_AvatarGroup.d.cts +1 -1
  28. package/dist/C_AvatarGroup.d.ts +1 -1
  29. package/dist/C_Barcode.d.cts +1 -1
  30. package/dist/C_Barcode.d.ts +1 -1
  31. package/dist/C_BatchResult.css +10 -10
  32. package/dist/C_BatchResult.d.cts +1 -1
  33. package/dist/C_BatchResult.d.ts +1 -1
  34. package/dist/C_BatchResult2.cjs +1 -1
  35. package/dist/C_BatchResult2.js +1 -1
  36. package/dist/C_Breadcrumb.d.cts +2 -2
  37. package/dist/C_Breadcrumb.d.ts +1 -1
  38. package/dist/C_Cascade.d.cts +1 -1
  39. package/dist/C_Cascade.d.ts +1 -1
  40. package/dist/C_ChangeReview.cjs +1 -0
  41. package/dist/C_ChangeReview.css +49 -0
  42. package/dist/C_ChangeReview.d.cts +2 -0
  43. package/dist/C_ChangeReview.d.ts +2 -0
  44. package/dist/C_ChangeReview.js +1 -0
  45. package/dist/C_ChangeReview2.cjs +1 -0
  46. package/dist/C_ChangeReview2.js +1 -0
  47. package/dist/C_Chat.css +120 -67
  48. package/dist/C_Chat.d.cts +2 -2
  49. package/dist/C_Chat.d.ts +2 -2
  50. package/dist/C_Chat2.cjs +1 -1
  51. package/dist/C_Chat2.js +1 -1
  52. package/dist/C_City.d.cts +1 -1
  53. package/dist/C_City.d.ts +1 -1
  54. package/dist/C_Code.d.cts +1 -1
  55. package/dist/C_Code.d.ts +1 -1
  56. package/dist/C_ContextMenu.d.cts +1 -1
  57. package/dist/C_ContextMenu.d.ts +1 -1
  58. package/dist/C_DataPicker.cjs +1 -1
  59. package/dist/C_DataPicker.css +125 -50
  60. package/dist/C_DataPicker.d.cts +3 -3
  61. package/dist/C_DataPicker.d.ts +4 -3
  62. package/dist/C_DataPicker.js +1 -1
  63. package/dist/C_DataPicker2.cjs +1 -1
  64. package/dist/C_DataPicker2.js +1 -1
  65. package/dist/C_Date.d.cts +1 -1
  66. package/dist/C_Date.d.ts +1 -1
  67. package/dist/C_Density.d.cts +1 -1
  68. package/dist/C_Density.d.ts +1 -1
  69. package/dist/C_Descriptions.cjs +1 -0
  70. package/dist/C_Descriptions.css +86 -0
  71. package/dist/C_Descriptions.d.cts +2 -0
  72. package/dist/C_Descriptions.d.ts +2 -0
  73. package/dist/C_Descriptions.js +1 -0
  74. package/dist/C_Descriptions2.cjs +1 -0
  75. package/dist/C_Descriptions2.js +1 -0
  76. package/dist/C_Editor.d.cts +1 -1
  77. package/dist/C_Editor.d.ts +1 -1
  78. package/dist/C_Editor2.cjs +1 -1
  79. package/dist/C_Editor2.js +1 -1
  80. package/dist/C_ErrorSummary.d.cts +1 -1
  81. package/dist/C_ErrorSummary.d.ts +1 -1
  82. package/dist/C_FilePreview.cjs +1 -1
  83. package/dist/C_FilePreview.d.cts +2 -1
  84. package/dist/C_FilePreview.d.ts +2 -1
  85. package/dist/C_FilePreview.js +1 -1
  86. package/dist/C_FilePreview2.cjs +1 -1
  87. package/dist/C_FilePreview2.js +1 -1
  88. package/dist/C_FilterBuilder.cjs +1 -0
  89. package/dist/C_FilterBuilder.css +59 -0
  90. package/dist/C_FilterBuilder.d.cts +2 -0
  91. package/dist/C_FilterBuilder.d.ts +2 -0
  92. package/dist/C_FilterBuilder.js +1 -0
  93. package/dist/C_FilterBuilder2.cjs +1 -0
  94. package/dist/C_FilterBuilder2.js +1 -0
  95. package/dist/C_Form.base.css +16 -16
  96. package/dist/C_Form.css +16 -16
  97. package/dist/C_Form.d.cts +1 -1
  98. package/dist/C_Form.d.ts +3 -3
  99. package/dist/C_FormModal.css +64 -54
  100. package/dist/C_FormModal.d.cts +2 -2
  101. package/dist/C_FormModal.d.ts +4 -4
  102. package/dist/C_FormModal2.cjs +1 -1
  103. package/dist/C_FormModal2.js +1 -1
  104. package/dist/C_FormSearch.d.cts +2 -1
  105. package/dist/C_FormSearch.d.ts +3 -2
  106. package/dist/C_GlobalSearch.css +156 -137
  107. package/dist/C_GlobalSearch.d.cts +2 -2
  108. package/dist/C_GlobalSearch.d.ts +2 -2
  109. package/dist/C_GlobalSearch2.cjs +1 -1
  110. package/dist/C_GlobalSearch2.js +1 -1
  111. package/dist/C_Guide.css +49 -3
  112. package/dist/C_Guide.d.cts +1 -1
  113. package/dist/C_Guide.d.ts +1 -1
  114. package/dist/C_Guide2.cjs +1 -1
  115. package/dist/C_Guide2.js +1 -1
  116. package/dist/C_Icon.d.cts +1 -1
  117. package/dist/C_Icon.d.ts +1 -1
  118. package/dist/C_ImageAnnotator.cjs +1 -0
  119. package/dist/C_ImageAnnotator.css +143 -0
  120. package/dist/C_ImageAnnotator.d.cts +2 -0
  121. package/dist/C_ImageAnnotator.d.ts +2 -0
  122. package/dist/C_ImageAnnotator.js +1 -0
  123. package/dist/C_ImageAnnotator2.cjs +1 -0
  124. package/dist/C_ImageAnnotator2.js +1 -0
  125. package/dist/C_ImportWizard.cjs +1 -0
  126. package/dist/C_ImportWizard.css +42 -0
  127. package/dist/C_ImportWizard.d.cts +2 -0
  128. package/dist/C_ImportWizard.d.ts +2 -0
  129. package/dist/C_ImportWizard.js +1 -0
  130. package/dist/C_ImportWizard2.cjs +1 -0
  131. package/dist/C_ImportWizard2.js +1 -0
  132. package/dist/C_Language.d.cts +1 -1
  133. package/dist/C_Language.d.ts +1 -1
  134. package/dist/C_Loading.d.cts +1 -1
  135. package/dist/C_Loading.d.ts +1 -1
  136. package/dist/C_Login.d.cts +1 -1
  137. package/dist/C_Login.d.ts +1 -1
  138. package/dist/C_Markdown.d.cts +1 -1
  139. package/dist/C_Markdown.d.ts +1 -1
  140. package/dist/C_Markdown2.cjs +1 -1
  141. package/dist/C_Markdown2.js +1 -1
  142. package/dist/C_Menu.d.cts +2 -2
  143. package/dist/C_Menu.d.ts +1 -1
  144. package/dist/C_NotificationCenter.cjs +1 -1
  145. package/dist/C_NotificationCenter.css +39 -39
  146. package/dist/C_NotificationCenter.d.cts +2 -1
  147. package/dist/C_NotificationCenter.d.ts +2 -1
  148. package/dist/C_NotificationCenter.js +1 -1
  149. package/dist/C_NotificationCenter2.cjs +1 -1
  150. package/dist/C_NotificationCenter2.js +1 -1
  151. package/dist/C_NotificationInbox.cjs +1 -0
  152. package/dist/C_NotificationInbox.css +154 -0
  153. package/dist/C_NotificationInbox.d.cts +2 -0
  154. package/dist/C_NotificationInbox.d.ts +2 -0
  155. package/dist/C_NotificationInbox.js +1 -0
  156. package/dist/C_NotificationInbox2.cjs +1 -0
  157. package/dist/C_NotificationInbox2.js +1 -0
  158. package/dist/C_OrgChart.d.cts +1 -1
  159. package/dist/C_OrgChart.d.ts +1 -1
  160. package/dist/C_Progress.d.cts +1 -1
  161. package/dist/C_Progress.d.ts +1 -1
  162. package/dist/C_QRCode2.cjs +1 -1
  163. package/dist/C_QRCode2.js +1 -1
  164. package/dist/C_RecordList.cjs +1 -0
  165. package/dist/C_RecordList.css +70 -0
  166. package/dist/C_RecordList.d.cts +2 -0
  167. package/dist/C_RecordList.d.ts +2 -0
  168. package/dist/C_RecordList.js +1 -0
  169. package/dist/C_RecordList2.cjs +1 -0
  170. package/dist/C_RecordList2.js +1 -0
  171. package/dist/C_RecurrenceEditor.cjs +1 -0
  172. package/dist/C_RecurrenceEditor.css +68 -0
  173. package/dist/C_RecurrenceEditor.d.cts +2 -0
  174. package/dist/C_RecurrenceEditor.d.ts +2 -0
  175. package/dist/C_RecurrenceEditor.js +1 -0
  176. package/dist/C_RecurrenceEditor2.cjs +1 -0
  177. package/dist/C_RecurrenceEditor2.js +1 -0
  178. package/dist/C_RelationshipExplorer.cjs +1 -0
  179. package/dist/C_RelationshipExplorer.css +76 -0
  180. package/dist/C_RelationshipExplorer.d.cts +2 -0
  181. package/dist/C_RelationshipExplorer.d.ts +2 -0
  182. package/dist/C_RelationshipExplorer.js +1 -0
  183. package/dist/C_RelationshipExplorer2.cjs +1 -0
  184. package/dist/C_RelationshipExplorer2.js +1 -0
  185. package/dist/C_ResourceSchedule.cjs +1 -0
  186. package/dist/C_ResourceSchedule.css +104 -0
  187. package/dist/C_ResourceSchedule.d.cts +2 -0
  188. package/dist/C_ResourceSchedule.d.ts +2 -0
  189. package/dist/C_ResourceSchedule.js +1 -0
  190. package/dist/C_ResourceSchedule2.cjs +1 -0
  191. package/dist/C_ResourceSchedule2.js +1 -0
  192. package/dist/C_ScanInput.cjs +1 -0
  193. package/dist/C_ScanInput.css +33 -0
  194. package/dist/C_ScanInput.d.cts +2 -0
  195. package/dist/C_ScanInput.d.ts +2 -0
  196. package/dist/C_ScanInput.js +1 -0
  197. package/dist/C_ScanInput2.cjs +1 -0
  198. package/dist/C_ScanInput2.js +1 -0
  199. package/dist/C_SectionNav.d.cts +1 -1
  200. package/dist/C_SectionNav.d.ts +1 -1
  201. package/dist/C_Select.d.cts +2 -2
  202. package/dist/C_Select.d.ts +2 -2
  203. package/dist/C_Skeleton.d.cts +1 -1
  204. package/dist/C_Skeleton.d.ts +1 -1
  205. package/dist/C_Steps.d.cts +1 -1
  206. package/dist/C_Steps.d.ts +1 -1
  207. package/dist/C_Table.base.css +194 -184
  208. package/dist/C_Table.css +178 -168
  209. package/dist/C_Table.d.cts +2 -2
  210. package/dist/C_Table.d.ts +15 -14
  211. package/dist/C_Table2.cjs +3 -3
  212. package/dist/C_Table2.js +3 -3
  213. package/dist/C_TagsView.d.cts +2 -2
  214. package/dist/C_TagsView.d.ts +1 -1
  215. package/dist/C_TaskBoard.cjs +1 -0
  216. package/dist/C_TaskBoard.css +58 -0
  217. package/dist/C_TaskBoard.d.cts +2 -0
  218. package/dist/C_TaskBoard.d.ts +2 -0
  219. package/dist/C_TaskBoard.js +1 -0
  220. package/dist/C_TaskBoard2.cjs +1 -0
  221. package/dist/C_TaskBoard2.js +1 -0
  222. package/dist/C_TaskPanel.cjs +1 -0
  223. package/dist/C_TaskPanel.css +68 -0
  224. package/dist/C_TaskPanel.d.cts +2 -0
  225. package/dist/C_TaskPanel.d.ts +2 -0
  226. package/dist/C_TaskPanel.js +1 -0
  227. package/dist/C_TaskPanel2.cjs +1 -0
  228. package/dist/C_TaskPanel2.js +1 -0
  229. package/dist/C_Theme.d.cts +1 -1
  230. package/dist/C_Theme.d.ts +1 -1
  231. package/dist/C_Timeline.d.cts +1 -1
  232. package/dist/C_Timeline.d.ts +1 -1
  233. package/dist/C_Timeline2.cjs +1 -1
  234. package/dist/C_Timeline2.js +1 -1
  235. package/dist/C_Transfer.css +108 -41
  236. package/dist/C_Transfer.d.cts +2 -2
  237. package/dist/C_Transfer.d.ts +2 -2
  238. package/dist/C_Transfer2.cjs +1 -1
  239. package/dist/C_Transfer2.js +1 -1
  240. package/dist/C_Tree.d.cts +1 -1
  241. package/dist/C_Tree.d.ts +13 -12
  242. package/dist/C_Upload.cjs +1 -1
  243. package/dist/C_Upload.d.cts +2 -1
  244. package/dist/C_Upload.d.ts +2 -1
  245. package/dist/C_Upload.js +1 -1
  246. package/dist/C_Upload2.cjs +1 -1
  247. package/dist/C_Upload2.js +1 -1
  248. package/dist/C_UserPicker.d.cts +1 -1
  249. package/dist/C_UserPicker.d.ts +2 -2
  250. package/dist/C_WorkFlow.d.ts +2 -2
  251. package/dist/ExportMenu.cjs +1 -0
  252. package/dist/ExportMenu.js +1 -0
  253. package/dist/NotificationItem.cjs +1 -0
  254. package/dist/NotificationItem.js +1 -0
  255. package/dist/component-config.d.ts +33 -10
  256. package/dist/config.d.cts +1 -1
  257. package/dist/config.d.ts +1 -1
  258. package/dist/constants.cjs +1 -0
  259. package/dist/constants.d.cts +2 -2
  260. package/dist/constants.d.ts +2 -2
  261. package/dist/constants.js +1 -0
  262. package/dist/constants2.d.cts +2 -2
  263. package/dist/constants2.d.ts +2 -2
  264. package/dist/constants3.d.cts +6 -232
  265. package/dist/constants3.d.ts +6 -232
  266. package/dist/constants4.d.cts +9 -199
  267. package/dist/constants4.d.ts +9 -199
  268. package/dist/constants5.d.cts +2 -2
  269. package/dist/constants5.d.ts +2 -2
  270. package/dist/context.d.cts +33 -10
  271. package/dist/data2.d.cts +8 -8
  272. package/dist/data2.d.ts +8 -8
  273. package/dist/dateRange.d.cts +4 -263
  274. package/dist/dateRange.d.ts +4 -263
  275. package/dist/editors.d.cts +11 -11
  276. package/dist/editors.d.ts +11 -11
  277. package/dist/excel.cjs +1 -0
  278. package/dist/excel.js +1 -0
  279. package/dist/fieldRenderers.cjs +1 -1
  280. package/dist/fieldRenderers.js +1 -1
  281. package/dist/fileUrl.cjs +1 -0
  282. package/dist/fileUrl.js +1 -0
  283. package/dist/html2.cjs +1 -0
  284. package/dist/html2.js +1 -0
  285. package/dist/index.cjs +1 -1
  286. package/dist/index.d.cts +88 -69
  287. package/dist/index.d.ts +87 -68
  288. package/dist/index.js +1 -1
  289. package/dist/index.vue.d.cts +54 -75
  290. package/dist/index.vue.d.ts +54 -75
  291. package/dist/index10.vue.d.cts +25 -27
  292. package/dist/index10.vue.d.ts +54 -41
  293. package/dist/index11.vue.d.cts +54 -41
  294. package/dist/index11.vue.d.ts +133 -75
  295. package/dist/index12.vue.d.cts +133 -75
  296. package/dist/index12.vue.d.ts +24 -6
  297. package/dist/index13.vue.d.cts +24 -6
  298. package/dist/index13.vue.d.ts +39 -57
  299. package/dist/index14.vue.d.cts +39 -57
  300. package/dist/index14.vue.d.ts +80 -16
  301. package/dist/index15.vue.d.cts +80 -16
  302. package/dist/index15.vue.d.ts +16 -56
  303. package/dist/index16.vue.d.cts +16 -56
  304. package/dist/index16.vue.d.ts +40 -118
  305. package/dist/index17.vue.d.cts +40 -118
  306. package/dist/index17.vue.d.ts +58 -52
  307. package/dist/index18.vue.d.cts +58 -52
  308. package/dist/index18.vue.d.ts +16 -20
  309. package/dist/index19.vue.d.cts +16 -20
  310. package/dist/index19.vue.d.ts +67 -14
  311. package/dist/index2.vue.d.cts +55 -17
  312. package/dist/index2.vue.d.ts +55 -17
  313. package/dist/index20.vue.d.cts +67 -14
  314. package/dist/index20.vue.d.ts +127 -123
  315. package/dist/index21.vue.d.cts +127 -123
  316. package/dist/index21.vue.d.ts +51 -76
  317. package/dist/index22.vue.d.cts +51 -76
  318. package/dist/index22.vue.d.ts +31 -71
  319. package/dist/index23.vue.d.cts +31 -129
  320. package/dist/index23.vue.d.ts +62 -118
  321. package/dist/index24.vue.d.cts +75 -50
  322. package/dist/index24.vue.d.ts +20 -49
  323. package/dist/index25.vue.d.cts +18 -18
  324. package/dist/index25.vue.d.ts +14 -22
  325. package/dist/index26.vue.d.cts +16 -26
  326. package/dist/index26.vue.d.ts +129 -24
  327. package/dist/index27.vue.d.cts +113 -81
  328. package/dist/index27.vue.d.ts +78 -96
  329. package/dist/index28.vue.d.cts +76 -29
  330. package/dist/index28.vue.d.ts +73 -31
  331. package/dist/index29.vue.d.cts +65 -13
  332. package/dist/index29.vue.d.ts +65 -13
  333. package/dist/index3.vue.d.cts +67 -70
  334. package/dist/index3.vue.d.ts +67 -70
  335. package/dist/index30.vue.d.cts +130 -81
  336. package/dist/index30.vue.d.ts +130 -81
  337. package/dist/index31.vue.d.cts +41 -94
  338. package/dist/index31.vue.d.ts +41 -94
  339. package/dist/index32.vue.d.cts +44 -61
  340. package/dist/index32.vue.d.ts +44 -61
  341. package/dist/index33.vue.d.cts +58 -0
  342. package/dist/index33.vue.d.ts +58 -0
  343. package/dist/index34.vue.d.cts +62 -0
  344. package/dist/index34.vue.d.ts +62 -0
  345. package/dist/index35.vue.d.cts +42 -0
  346. package/dist/index35.vue.d.ts +42 -0
  347. package/dist/index36.vue.d.cts +28 -0
  348. package/dist/index36.vue.d.ts +28 -0
  349. package/dist/index37.vue.d.cts +30 -0
  350. package/dist/index37.vue.d.ts +30 -0
  351. package/dist/index38.vue.d.cts +103 -0
  352. package/dist/index38.vue.d.ts +103 -0
  353. package/dist/index39.vue.d.cts +38 -0
  354. package/dist/index39.vue.d.ts +38 -0
  355. package/dist/index4.vue.d.cts +27 -36
  356. package/dist/index4.vue.d.ts +27 -36
  357. package/dist/index40.vue.d.cts +19 -0
  358. package/dist/index40.vue.d.ts +19 -0
  359. package/dist/index41.vue.d.cts +89 -0
  360. package/dist/index41.vue.d.ts +89 -0
  361. package/dist/index42.vue.d.cts +110 -0
  362. package/dist/index42.vue.d.ts +110 -0
  363. package/dist/index43.vue.d.cts +89 -0
  364. package/dist/index43.vue.d.ts +89 -0
  365. package/dist/index44.vue.d.cts +71 -0
  366. package/dist/index44.vue.d.ts +71 -0
  367. package/dist/index45.vue.d.cts +50 -0
  368. package/dist/index45.vue.d.ts +50 -0
  369. package/dist/index5.vue.d.cts +78 -17
  370. package/dist/index5.vue.d.ts +78 -17
  371. package/dist/index6.vue.d.cts +34 -132
  372. package/dist/index6.vue.d.ts +31 -34
  373. package/dist/index7.vue.d.cts +20 -34
  374. package/dist/index7.vue.d.ts +20 -28
  375. package/dist/index8.vue.d.cts +130 -29
  376. package/dist/index8.vue.d.ts +33 -118
  377. package/dist/index9.vue.d.cts +33 -118
  378. package/dist/index9.vue.d.ts +25 -27
  379. package/dist/localSource.cjs +1 -0
  380. package/dist/{formField.d.cts → localSource.d.cts} +42 -2
  381. package/dist/{formField.d.ts → localSource.d.ts} +42 -2
  382. package/dist/localSource.js +1 -0
  383. package/dist/mapUtils.d.cts +5 -5
  384. package/dist/mapUtils.d.ts +5 -5
  385. package/dist/model.d.cts +88 -0
  386. package/dist/model.d.ts +88 -0
  387. package/dist/presets.d.cts +2 -2
  388. package/dist/presets.d.ts +2 -2
  389. package/dist/previewLimits.cjs +1 -0
  390. package/dist/previewLimits.js +1 -0
  391. package/dist/resolver.cjs +1 -1
  392. package/dist/resolver.d.cts +1 -1
  393. package/dist/resolver.d.ts +1 -1
  394. package/dist/resolver.js +1 -1
  395. package/dist/rule.d.cts +51 -0
  396. package/dist/rule.d.ts +51 -0
  397. package/dist/source.cjs +1 -1
  398. package/dist/source.d.cts +2 -2
  399. package/dist/source.d.ts +2 -2
  400. package/dist/source.js +1 -1
  401. package/dist/style.css +1974 -542
  402. package/dist/types.d.cts +4 -0
  403. package/dist/types.d.ts +4 -0
  404. package/dist/types10.d.cts +229 -0
  405. package/dist/types10.d.ts +285 -0
  406. package/dist/types11.d.cts +285 -0
  407. package/dist/types2.d.cts +188 -31
  408. package/dist/types2.d.ts +188 -31
  409. package/dist/types3.d.cts +84 -101
  410. package/dist/types3.d.ts +82 -105
  411. package/dist/types4.d.cts +24 -106
  412. package/dist/types4.d.ts +30 -55
  413. package/dist/types5.d.cts +106 -55
  414. package/dist/types5.d.ts +130 -41
  415. package/dist/types6.d.cts +130 -41
  416. package/dist/types6.d.ts +244 -265
  417. package/dist/types7.d.cts +244 -265
  418. package/dist/types7.d.ts +60 -0
  419. package/dist/types8.d.cts +60 -0
  420. package/dist/types8.d.ts +50 -0
  421. package/dist/types9.d.cts +50 -0
  422. package/dist/types9.d.ts +229 -0
  423. package/dist/useCalendarEvents.d.cts +2 -2
  424. package/dist/useCalendarEvents.d.ts +2 -2
  425. package/dist/useCollapsePanel.d.cts +7 -7
  426. package/dist/useCollapsePanel.d.ts +7 -7
  427. package/dist/useComponentTheme.cjs +1 -1
  428. package/dist/useComponentTheme.js +1 -1
  429. package/dist/useCropperCore.d.cts +8 -8
  430. package/dist/useCropperCore.d.ts +8 -8
  431. package/dist/useDynamicFormState.d.cts +5 -4
  432. package/dist/useDynamicFormState.d.ts +5 -4
  433. package/dist/useEdgeInteraction.d.cts +2 -2
  434. package/dist/useEdgeInteraction.d.ts +2 -2
  435. package/dist/useFormArray.cjs +1 -1
  436. package/dist/useFormArray.d.cts +39 -3
  437. package/dist/useFormArray.d.ts +39 -3
  438. package/dist/useFormArray.js +1 -1
  439. package/dist/useFormRenderer.d.cts +6 -2
  440. package/dist/useFormRenderer.d.ts +6 -2
  441. package/dist/useFullscreen.d.cts +7 -99
  442. package/dist/useFullscreen.d.ts +7 -99
  443. package/dist/useGlobalSearch.d.cts +45 -3
  444. package/dist/useGlobalSearch.d.ts +45 -3
  445. package/dist/useInfiniteScroll.d.cts +2 -2
  446. package/dist/useInfiniteScroll.d.ts +2 -2
  447. package/dist/useLocalFileUrl.cjs +1 -0
  448. package/dist/useLocalFileUrl.js +1 -0
  449. package/dist/useQRCode.d.cts +3 -3
  450. package/dist/useQRCode.d.ts +3 -3
  451. package/dist/useSignatureHistory.d.cts +6 -6
  452. package/dist/useSignatureHistory.d.ts +6 -6
  453. package/dist/useSplitResize.d.cts +10 -10
  454. package/dist/useSplitResize.d.ts +10 -10
  455. package/dist/useWorkflowValidation.d.cts +108 -108
  456. package/dist/useWorkflowValidation.d.ts +108 -108
  457. package/dist/verification.d.cts +2 -2
  458. package/dist/verification.d.ts +2 -2
  459. package/dist/workflows.cjs +1 -1
  460. package/dist/workflows.d.cts +2 -2
  461. package/dist/workflows.d.ts +2 -2
  462. package/dist/workflows.js +1 -1
  463. package/docs/components.en.md +125 -135
  464. package/docs/components.md +125 -135
  465. package/docs/engineering.en.md +12 -4
  466. package/docs/engineering.md +12 -4
  467. package/docs/guides/api-migration.md +17 -1
  468. package/docs/guides/approval-viewer.md +50 -0
  469. package/docs/guides/attachments.md +39 -0
  470. package/docs/guides/batch-results.md +3 -1
  471. package/docs/guides/change-review.md +49 -0
  472. package/docs/guides/component-contracts.md +8 -0
  473. package/docs/guides/data-picker.md +75 -1
  474. package/docs/guides/data-workflows.md +27 -1
  475. package/docs/guides/dockable-workbench.md +49 -0
  476. package/docs/guides/filter-builder.md +47 -0
  477. package/docs/guides/global-search.md +49 -0
  478. package/docs/guides/image-annotator.md +27 -0
  479. package/docs/guides/import-wizard.md +40 -0
  480. package/docs/guides/notification-center.md +29 -0
  481. package/docs/guides/resource-schedule.md +58 -0
  482. package/docs/guides/scene-components.md +53 -0
  483. package/docs/guides/search-workflows.md +2 -0
  484. package/docs/guides/split-pane.md +2 -0
  485. package/docs/guides/table-density.md +47 -1
  486. package/docs/guides/task-board.md +53 -0
  487. package/docs/guides/task-panel.md +30 -0
  488. package/docs/guides/transfer.md +35 -0
  489. package/docs/guides/usage.en.md +23 -17
  490. package/docs/guides/usage.md +10 -24
  491. package/package.json +1 -1
  492. package/dist/formField.cjs +0 -1
  493. package/dist/formField.js +0 -1
  494. package/dist/html.cjs +0 -1
  495. package/dist/html.js +0 -1
package/dist/C_Chat.css CHANGED
@@ -191,14 +191,67 @@
191
191
  .border[data-v-1781627b]{border-width:1px;}
192
192
  .transition[data-v-1781627b]{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;}
193
193
 
194
- .c-chat__avatar[data-v-f8cf3d20] {
194
+ .c-chat-extras[data-v-dd33065d] {
195
+ display: grid;
196
+ gap: 4px;
197
+ margin-block-start: 4px;
198
+ font-size: 0.875em;
199
+ overflow-wrap: anywhere;
200
+ }
201
+ .c-chat-extras details[data-v-dd33065d] {
202
+ padding: 5px 8px;
203
+ border: 1px solid var(--chat-border);
204
+ border-radius: var(--c-radius, var(--c-theme-radius));
205
+ }
206
+ .c-chat-extras summary[data-v-dd33065d] {
207
+ cursor: pointer;
208
+ }
209
+ .c-chat-extras button[data-v-dd33065d] {
210
+ padding: 0;
211
+ border: 0;
212
+ background: transparent;
213
+ color: var(--c-primary, var(--c-theme-primary));
214
+ font: inherit;
215
+ text-align: start;
216
+ text-decoration: underline;
217
+ cursor: pointer;
218
+ }
219
+ .c-chat-extras small[data-v-dd33065d] {
220
+ display: block;
221
+ color: var(--chat-text-secondary);
222
+ }
223
+ .c-chat-extras__items[data-v-dd33065d] {
224
+ margin: 4px 0 0;
225
+ padding-inline-start: 18px;
226
+ }
227
+ .c-chat-extras__items li + li[data-v-dd33065d] {
228
+ margin-block-start: 4px;
229
+ }
230
+ .c-chat-extras__state[data-v-dd33065d] {
231
+ margin-inline-start: 8px;
232
+ color: var(--chat-text-secondary);
233
+ }
234
+ .c-chat-extras__state[data-status=succeeded][data-v-dd33065d] {
235
+ color: var(--c-success, var(--c-theme-success));
236
+ }
237
+ .c-chat-extras__state[data-status=failed][data-v-dd33065d] {
238
+ color: var(--c-error, var(--c-theme-error));
239
+ }
240
+
241
+ /* layer: default */
242
+ .grid[data-v-dd33065d]{display:grid;}
243
+ .block[data-v-dd33065d]{display:block;}
244
+ .border[data-v-dd33065d]{border-width:1px;}
245
+ .underline[data-v-dd33065d]{text-decoration-line:underline;}
246
+
247
+ .c-chat__avatar[data-v-d502dc05] {
195
248
  width: var(--chat-avatar-size);
196
249
  height: var(--chat-avatar-size);
197
250
  border-radius: 50%;
198
251
  object-fit: cover;
199
252
  background: color-mix(in srgb, var(--c-border, var(--c-theme-border, #e5e7eb)) 50%, transparent);
200
253
  }
201
- .c-chat__avatar-fallback[data-v-f8cf3d20] {
254
+ .c-chat__avatar-fallback[data-v-d502dc05] {
202
255
  width: var(--chat-avatar-size);
203
256
  height: var(--chat-avatar-size);
204
257
  border-radius: 50%;
@@ -212,60 +265,60 @@
212
265
  }
213
266
 
214
267
  /* ─── 消息气泡 ────────────────────────────────────────── */
215
- .c-chat__msg[data-v-f8cf3d20] {
268
+ .c-chat__msg[data-v-d502dc05] {
216
269
  display: flex;
217
270
  gap: 8px;
218
271
  max-width: 75%;
219
272
  }
220
- .c-chat__msg.is-self[data-v-f8cf3d20] {
273
+ .c-chat__msg.is-self[data-v-d502dc05] {
221
274
  margin-left: auto;
222
275
  flex-direction: row-reverse;
223
276
  }
224
- .c-chat__msg.is-system[data-v-f8cf3d20] {
277
+ .c-chat__msg.is-system[data-v-d502dc05] {
225
278
  max-width: 100%;
226
279
  justify-content: center;
227
280
  align-self: center;
228
281
  }
229
- .c-chat__msg-avatar[data-v-f8cf3d20] {
282
+ .c-chat__msg-avatar[data-v-d502dc05] {
230
283
  flex-shrink: 0;
231
284
  margin-top: 2px;
232
285
  }
233
- .c-chat__msg-body[data-v-f8cf3d20] {
286
+ .c-chat__msg-body[data-v-d502dc05] {
234
287
  display: flex;
235
288
  flex-direction: column;
236
289
  }
237
- .c-chat__msg-username[data-v-f8cf3d20] {
290
+ .c-chat__msg-username[data-v-d502dc05] {
238
291
  font-size: 12px;
239
292
  color: var(--chat-text-secondary);
240
293
  margin-bottom: 2px;
241
294
  }
242
- .is-self .c-chat__msg-username[data-v-f8cf3d20] {
295
+ .is-self .c-chat__msg-username[data-v-d502dc05] {
243
296
  text-align: right;
244
297
  }
245
- .c-chat__bubble[data-v-f8cf3d20] {
298
+ .c-chat__bubble[data-v-d502dc05] {
246
299
  padding: 10px 14px;
247
300
  border-radius: 16px;
248
301
  line-height: 1.5;
249
302
  word-break: break-word;
250
303
  white-space: pre-wrap;
251
304
  }
252
- .is-other .c-chat__bubble[data-v-f8cf3d20] {
305
+ .is-other .c-chat__bubble[data-v-d502dc05] {
253
306
  background: var(--chat-bubble-other);
254
307
  border: 1px solid var(--chat-border);
255
308
  border-top-left-radius: 4px;
256
309
  }
257
- .is-self .c-chat__bubble[data-v-f8cf3d20] {
310
+ .is-self .c-chat__bubble[data-v-d502dc05] {
258
311
  background: var(--chat-bubble-self);
259
312
  color: var(--chat-text-self);
260
313
  border-top-right-radius: 4px;
261
314
  }
262
- .is-system .c-chat__bubble[data-v-f8cf3d20] {
315
+ .is-system .c-chat__bubble[data-v-d502dc05] {
263
316
  background: var(--chat-bubble-system);
264
317
  color: var(--chat-text-secondary);
265
318
  font-size: 12px;
266
319
  padding: 4px 12px;
267
320
  }
268
- .c-chat__msg-image-button[data-v-f8cf3d20] {
321
+ .c-chat__msg-image-button[data-v-d502dc05] {
269
322
  display: inline-flex;
270
323
  align-self: flex-start;
271
324
  padding: 0;
@@ -273,20 +326,20 @@
273
326
  background: none;
274
327
  cursor: pointer;
275
328
  }
276
- .c-chat__msg-image[data-v-f8cf3d20] {
329
+ .c-chat__msg-image[data-v-d502dc05] {
277
330
  max-width: 240px;
278
331
  max-height: 180px;
279
332
  border-radius: 12px;
280
333
  cursor: pointer;
281
334
  object-fit: cover;
282
335
  }
283
- .is-self .c-chat__msg-image[data-v-f8cf3d20] {
336
+ .is-self .c-chat__msg-image[data-v-d502dc05] {
284
337
  border-top-right-radius: 4px;
285
338
  }
286
- .is-other .c-chat__msg-image[data-v-f8cf3d20] {
339
+ .is-other .c-chat__msg-image[data-v-d502dc05] {
287
340
  border-top-left-radius: 4px;
288
341
  }
289
- .c-chat__msg-file[data-v-f8cf3d20] {
342
+ .c-chat__msg-file[data-v-d502dc05] {
290
343
  display: flex;
291
344
  align-items: center;
292
345
  gap: 8px;
@@ -297,90 +350,90 @@
297
350
  text-align: left;
298
351
  border: 0;
299
352
  }
300
- .is-other .c-chat__msg-file[data-v-f8cf3d20] {
353
+ .is-other .c-chat__msg-file[data-v-d502dc05] {
301
354
  background: var(--chat-bubble-other);
302
355
  border: 1px solid var(--chat-border);
303
356
  border-top-left-radius: 4px;
304
357
  }
305
- .is-self .c-chat__msg-file[data-v-f8cf3d20] {
358
+ .is-self .c-chat__msg-file[data-v-d502dc05] {
306
359
  background: var(--chat-bubble-self);
307
360
  color: var(--chat-text-self);
308
361
  border-top-right-radius: 4px;
309
362
  }
310
- .c-chat__file-info[data-v-f8cf3d20] {
363
+ .c-chat__file-info[data-v-d502dc05] {
311
364
  display: flex;
312
365
  flex-direction: column;
313
366
  min-width: 0;
314
367
  }
315
- .c-chat__file-name[data-v-f8cf3d20] {
368
+ .c-chat__file-name[data-v-d502dc05] {
316
369
  font-size: 13px;
317
370
  font-weight: 500;
318
371
  white-space: nowrap;
319
372
  overflow: hidden;
320
373
  text-overflow: ellipsis;
321
374
  }
322
- .c-chat__file-size[data-v-f8cf3d20] {
375
+ .c-chat__file-size[data-v-d502dc05] {
323
376
  font-size: 11px;
324
377
  opacity: 0.6;
325
378
  }
326
- .c-chat__msg-time[data-v-f8cf3d20] {
379
+ .c-chat__msg-time[data-v-d502dc05] {
327
380
  font-size: 11px;
328
381
  color: var(--chat-text-secondary);
329
382
  margin-top: 4px;
330
383
  }
331
- .is-self .c-chat__msg-time[data-v-f8cf3d20] {
384
+ .is-self .c-chat__msg-time[data-v-d502dc05] {
332
385
  text-align: right;
333
386
  }
334
- .c-chat__msg-status[data-v-f8cf3d20] {
387
+ .c-chat__msg-status[data-v-d502dc05] {
335
388
  font-size: 11px;
336
389
  margin-top: 2px;
337
390
  text-align: right;
338
391
  }
339
- .c-chat__msg-status[data-v-f8cf3d20]:is(button) {
392
+ .c-chat__msg-status[data-v-d502dc05]:is(button) {
340
393
  align-self: flex-end;
341
394
  padding: 0;
342
395
  border: 0;
343
396
  background: none;
344
397
  font-family: inherit;
345
398
  }
346
- .c-chat__msg-status.is-sending[data-v-f8cf3d20] {
399
+ .c-chat__msg-status.is-sending[data-v-d502dc05] {
347
400
  color: var(--chat-text-secondary);
348
401
  }
349
- .c-chat__msg-status.is-failed[data-v-f8cf3d20] {
402
+ .c-chat__msg-status.is-failed[data-v-d502dc05] {
350
403
  color: var(--chat-failed-color);
351
404
  cursor: pointer;
352
405
  }
353
406
 
354
407
  /* ─── 时间分割线 ──────────────────────────────────────── */
355
- .c-chat__time-divider[data-v-f8cf3d20] {
408
+ .c-chat__time-divider[data-v-d502dc05] {
356
409
  text-align: center;
357
410
  font-size: 11px;
358
411
  color: var(--chat-text-secondary);
359
412
  padding: 4px 0;
360
413
  }
361
- .c-chat__message-row[data-v-f8cf3d20] {
414
+ .c-chat__message-row[data-v-d502dc05] {
362
415
  flex-shrink: 0;
363
416
  padding-bottom: 12px;
364
417
  }
365
- .c-chat__time-divider[data-v-f8cf3d20] {
418
+ .c-chat__time-divider[data-v-d502dc05] {
366
419
  margin-bottom: 12px;
367
420
  }
368
- .c-chat__msg-body[data-v-f8cf3d20] {
421
+ .c-chat__msg-body[data-v-d502dc05] {
369
422
  min-width: 0;
370
423
  }
371
- .c-chat__msg-image[data-v-f8cf3d20] {
424
+ .c-chat__msg-image[data-v-d502dc05] {
372
425
  max-width: min(240px, 100%);
373
426
  }
374
427
 
375
428
  /* layer: default */
376
- .hidden[data-v-f8cf3d20]{display:none;}
377
- .flex[data-v-f8cf3d20]{display:flex;}
378
- .inline-flex[data-v-f8cf3d20]{display:inline-flex;}
379
- .flex-shrink[data-v-f8cf3d20]{flex-shrink:1;}
380
- .border[data-v-f8cf3d20]{border-width:1px;}
429
+ .hidden[data-v-d502dc05]{display:none;}
430
+ .flex[data-v-d502dc05]{display:flex;}
431
+ .inline-flex[data-v-d502dc05]{display:inline-flex;}
432
+ .flex-shrink[data-v-d502dc05]{flex-shrink:1;}
433
+ .border[data-v-d502dc05]{border-width:1px;}
381
434
 
382
435
  /* ─── CSS 变量(基于项目主题变量,自动适配明暗) ───────────────────────── */
383
- .c-chat[data-v-86049762] {
436
+ .c-chat[data-v-27157b1a] {
384
437
  --chat-bg: var(--c-bg-card, var(--c-theme-bg-card, #fff));
385
438
  --chat-sidebar-bg: var(--c-bg-body, var(--c-theme-bg-body, #f8fafc));
386
439
  --chat-sidebar-width: 280px;
@@ -430,7 +483,7 @@
430
483
  }
431
484
 
432
485
  /* ─── 联系人侧栏 ──────────────────────────────────────── */
433
- .c-chat__sidebar[data-v-86049762] {
486
+ .c-chat__sidebar[data-v-27157b1a] {
434
487
  display: flex;
435
488
  flex-direction: column;
436
489
  width: var(--chat-sidebar-width);
@@ -439,7 +492,7 @@
439
492
  border-right: 1px solid var(--chat-border);
440
493
  box-shadow: 2px 0 8px var(--chat-shadow-light);
441
494
  }
442
- .c-chat__sidebar-header[data-v-86049762] {
495
+ .c-chat__sidebar-header[data-v-27157b1a] {
443
496
  display: flex;
444
497
  align-items: center;
445
498
  gap: 8px;
@@ -449,30 +502,30 @@
449
502
  font-weight: 600;
450
503
  font-size: 15px;
451
504
  }
452
- .c-chat__search[data-v-86049762] {
505
+ .c-chat__search[data-v-27157b1a] {
453
506
  padding: 8px 12px;
454
507
  }
455
- .c-chat__contact-list[data-v-86049762],[data-v-86049762] .c-chat__contact-list.v-vl {
508
+ .c-chat__contact-list[data-v-27157b1a],[data-v-27157b1a] .c-chat__contact-list.v-vl {
456
509
  flex: 1;
457
510
  overflow-y: auto;
458
511
  overscroll-behavior: contain;
459
512
  }
460
- .c-chat__contact-list[data-v-86049762]::-webkit-scrollbar,[data-v-86049762] .c-chat__contact-list.v-vl::-webkit-scrollbar {
513
+ .c-chat__contact-list[data-v-27157b1a]::-webkit-scrollbar,[data-v-27157b1a] .c-chat__contact-list.v-vl::-webkit-scrollbar {
461
514
  width: 4px;
462
515
  }
463
- .c-chat__contact-list[data-v-86049762]::-webkit-scrollbar-thumb,[data-v-86049762] .c-chat__contact-list.v-vl::-webkit-scrollbar-thumb {
516
+ .c-chat__contact-list[data-v-27157b1a]::-webkit-scrollbar-thumb,[data-v-27157b1a] .c-chat__contact-list.v-vl::-webkit-scrollbar-thumb {
464
517
  background: var(--chat-scrollbar-thumb);
465
518
  border-radius: 2px;
466
519
  }
467
520
 
468
521
  /* ─── 主聊天区域 ──────────────────────────────────────── */
469
- .c-chat__main[data-v-86049762] {
522
+ .c-chat__main[data-v-27157b1a] {
470
523
  flex: 1;
471
524
  display: flex;
472
525
  flex-direction: column;
473
526
  min-width: 0;
474
527
  }
475
- .c-chat__header[data-v-86049762] {
528
+ .c-chat__header[data-v-27157b1a] {
476
529
  display: flex;
477
530
  align-items: center;
478
531
  gap: 10px;
@@ -484,14 +537,14 @@
484
537
  font-weight: 600;
485
538
  font-size: 15px;
486
539
  }
487
- .c-chat__header-status[data-v-86049762] {
540
+ .c-chat__header-status[data-v-27157b1a] {
488
541
  font-size: 12px;
489
542
  font-weight: 400;
490
543
  color: var(--chat-text-secondary);
491
544
  }
492
545
 
493
546
  /* ─── 消息区域 ────────────────────────────────────────── */
494
- .c-chat__messages[data-v-86049762],[data-v-86049762] .c-chat__messages--virtual {
547
+ .c-chat__messages[data-v-27157b1a],[data-v-27157b1a] .c-chat__messages--virtual {
495
548
  flex: 1;
496
549
  overflow-y: auto;
497
550
  overscroll-behavior: contain;
@@ -500,18 +553,18 @@
500
553
  flex-direction: column;
501
554
  background: color-mix(in srgb, var(--c-bg-body, var(--c-theme-bg-body, #f8fafc)) 50%, var(--c-bg-card, var(--c-theme-bg-card, #fff)));
502
555
  }
503
- .c-chat__messages[data-v-86049762]::-webkit-scrollbar,[data-v-86049762] .c-chat__messages--virtual::-webkit-scrollbar {
556
+ .c-chat__messages[data-v-27157b1a]::-webkit-scrollbar,[data-v-27157b1a] .c-chat__messages--virtual::-webkit-scrollbar {
504
557
  width: 4px;
505
558
  }
506
- .c-chat__messages[data-v-86049762]::-webkit-scrollbar-thumb,[data-v-86049762] .c-chat__messages--virtual::-webkit-scrollbar-thumb {
559
+ .c-chat__messages[data-v-27157b1a]::-webkit-scrollbar-thumb,[data-v-27157b1a] .c-chat__messages--virtual::-webkit-scrollbar-thumb {
507
560
  background: var(--chat-scrollbar-thumb);
508
561
  border-radius: 2px;
509
562
  }
510
- .c-chat__load-more[data-v-86049762] {
563
+ .c-chat__load-more[data-v-27157b1a] {
511
564
  text-align: center;
512
565
  padding: 8px;
513
566
  }
514
- .c-chat__empty[data-v-86049762] {
567
+ .c-chat__empty[data-v-27157b1a] {
515
568
  flex: 1;
516
569
  display: flex;
517
570
  align-items: center;
@@ -521,7 +574,7 @@
521
574
  }
522
575
 
523
576
  /* ─── 输入区域 ────────────────────────────────────────── */
524
- .c-chat__input-area[data-v-86049762] {
577
+ .c-chat__input-area[data-v-27157b1a] {
525
578
  display: flex;
526
579
  align-items: center;
527
580
  gap: 8px;
@@ -530,21 +583,21 @@
530
583
  background: var(--chat-input-bg);
531
584
  border-top: 1px solid var(--chat-border);
532
585
  }
533
- .c-chat__input-actions[data-v-86049762] {
586
+ .c-chat__input-actions[data-v-27157b1a] {
534
587
  display: flex;
535
588
  gap: 4px;
536
589
  flex-shrink: 0;
537
590
  }
538
- .c-chat__input-wrap[data-v-86049762] {
591
+ .c-chat__input-wrap[data-v-27157b1a] {
539
592
  flex: 1;
540
593
  min-width: 0;
541
594
  }
542
- .c-chat__send-btn[data-v-86049762] {
595
+ .c-chat__send-btn[data-v-27157b1a] {
543
596
  flex-shrink: 0;
544
597
  }
545
598
 
546
599
  /* ─── 空态 ────────────────────────────────────────────── */
547
- .c-chat__no-chat[data-v-86049762] {
600
+ .c-chat__no-chat[data-v-27157b1a] {
548
601
  flex: 1;
549
602
  display: flex;
550
603
  flex-direction: column;
@@ -553,36 +606,36 @@
553
606
  gap: 12px;
554
607
  color: var(--chat-text-secondary);
555
608
  }
556
- .c-chat__no-chat-icon[data-v-86049762] {
609
+ .c-chat__no-chat-icon[data-v-27157b1a] {
557
610
  font-size: 48px;
558
611
  opacity: 0.3;
559
612
  }
560
613
 
561
614
  /* ─── 响应式 ──────────────────────────────────────────── */
562
615
  @media (max-width: 640px) {
563
- .c-chat[data-v-86049762] {
616
+ .c-chat[data-v-27157b1a] {
564
617
  --chat-sidebar-width: 72px;
565
618
  }
566
- .c-chat__search[data-v-86049762] {
619
+ .c-chat__search[data-v-27157b1a] {
567
620
  display: none;
568
621
  }
569
622
  }
570
- .c-chat__main[data-v-86049762] {
623
+ .c-chat__main[data-v-27157b1a] {
571
624
  min-height: 0;
572
625
  }
573
- .c-chat__messages[data-v-86049762],[data-v-86049762] .c-chat__messages--virtual {
626
+ .c-chat__messages[data-v-27157b1a],[data-v-27157b1a] .c-chat__messages--virtual {
574
627
  min-height: 0;
575
628
  }
576
- .c-chat__messages--virtual[data-v-86049762],[data-v-86049762] .c-chat__messages--virtual {
629
+ .c-chat__messages--virtual[data-v-27157b1a],[data-v-27157b1a] .c-chat__messages--virtual {
577
630
  display: block;
578
631
  padding: 0;
579
632
  overflow-anchor: none;
580
633
  }
581
- .c-chat__message-items[data-v-86049762] {
634
+ .c-chat__message-items[data-v-27157b1a] {
582
635
  flex: 1;
583
636
  display: flex;
584
637
  flex-direction: column;
585
638
  }
586
- .c-chat__contact-list[data-v-86049762],[data-v-86049762] .c-chat__contact-list.v-vl {
639
+ .c-chat__contact-list[data-v-27157b1a],[data-v-27157b1a] .c-chat__contact-list.v-vl {
587
640
  min-height: 0;
588
641
  }
package/dist/C_Chat.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as DEFAULT_CHAT_PROPS, c as MessageType, i as ChatProps, n as ChatContact, o as MessageSender, r as ChatMessage, s as MessageStatus, t as _default } from "./index9.vue.cjs";
2
- export { _default as C_Chat, type ChatContact, type ChatMessage, type ChatProps, DEFAULT_CHAT_PROPS, type MessageSender, type MessageStatus, type MessageType };
1
+ import { a as ChatProps, c as MessageSender, i as ChatMessage, l as MessageStatus, n as ChatActivity, o as ChatSource, r as ChatContact, s as DEFAULT_CHAT_PROPS, t as _default, u as MessageType } from "./index12.vue.cjs";
2
+ export { _default as C_Chat, type ChatActivity, type ChatContact, type ChatMessage, type ChatProps, type ChatSource, DEFAULT_CHAT_PROPS, type MessageSender, type MessageStatus, type MessageType };
package/dist/C_Chat.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as DEFAULT_CHAT_PROPS, c as MessageType, i as ChatProps, n as ChatContact, o as MessageSender, r as ChatMessage, s as MessageStatus, t as _default } from "./index8.vue.js";
2
- export { _default as C_Chat, type ChatContact, type ChatMessage, type ChatProps, DEFAULT_CHAT_PROPS, type MessageSender, type MessageStatus, type MessageType };
1
+ import { a as ChatProps, c as MessageSender, i as ChatMessage, l as MessageStatus, n as ChatActivity, o as ChatSource, r as ChatContact, s as DEFAULT_CHAT_PROPS, t as _default, u as MessageType } from "./index11.vue.js";
2
+ export { _default as C_Chat, type ChatActivity, type ChatContact, type ChatMessage, type ChatProps, type ChatSource, DEFAULT_CHAT_PROPS, type MessageSender, type MessageStatus, type MessageType };
package/dist/C_Chat2.cjs CHANGED
@@ -1 +1 @@
1
- require(`./chunk.cjs`);const e=require(`./useComponentLocale.cjs`),t=require(`./useComponentTheme.cjs`),n=require(`./export-helper.cjs`),r=require(`./C_Icon2.cjs`),i=require(`./virtualList.cjs`);let a=require(`vue`),o=require(`naive-ui`);const s=[`data-message-id`],c={key:0,class:`c-chat__time-divider`},l={key:0,class:`c-chat__msg-avatar`},u=[`src`],d={key:1,class:`c-chat__avatar-fallback`},f={class:`c-chat__msg-body`},p={key:0,class:`c-chat__msg-username`},m={key:1,class:`c-chat__bubble`},h=[`aria-label`],g=[`src`,`alt`],_={class:`c-chat__file-info`},v={class:`c-chat__file-name`},y={key:0,class:`c-chat__file-size`},b={key:4,class:`c-chat__msg-time`},x={key:6,class:`c-chat__msg-status is-sending`},S=(0,a.defineComponent)({__name:`ChatMessageItem`,props:{msg:{},previous:{},selfAvatar:{},selfName:{},showTimestamp:{type:Boolean}},emits:[`image-preview`,`file-click`,`resend`],setup(t,{emit:n}){let{t:i}=e.t(),o=t,S=n,C=(0,a.computed)(()=>!o.previous||new Date(o.msg.timestamp).getTime()-new Date(o.previous.timestamp).getTime()>3e5),w=e=>e.sender===`self`&&o.selfAvatar||e.avatar,T=e=>e.sender===`self`?o.selfName||e.username||i(`chat.self`):e.username||i(`common.unknown`);function E(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function D(e){let t=new Date(e),n=new Date;return t.toDateString()===n.toDateString()?E(e):`${t.getMonth()+1}/${t.getDate()} ${E(e)}`}function O(e){return e<1024?`${e}B`:e<1048576?`${(e/1024).toFixed(1)}KB`:`${(e/1048576).toFixed(1)}MB`}return(e,n)=>((0,a.openBlock)(),(0,a.createElementBlock)(`div`,{class:`c-chat__message-row`,"data-message-id":t.msg.id},[(0,a.createCommentVNode)(` 时间分割 `),C.value?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,c,(0,a.toDisplayString)(D(t.msg.timestamp)),1)):(0,a.createCommentVNode)(`v-if`,!0),(0,a.createCommentVNode)(` 消息条目 `),(0,a.createElementVNode)(`div`,{class:(0,a.normalizeClass)([`c-chat__msg`,`is-${t.msg.sender}`])},[(0,a.createCommentVNode)(` 头像 `),t.msg.sender===`system`?(0,a.createCommentVNode)(`v-if`,!0):((0,a.openBlock)(),(0,a.createElementBlock)(`div`,l,[w(t.msg)?((0,a.openBlock)(),(0,a.createElementBlock)(`img`,{key:0,src:w(t.msg),class:`c-chat__avatar`},null,8,u)):((0,a.openBlock)(),(0,a.createElementBlock)(`div`,d,(0,a.toDisplayString)(T(t.msg).charAt(0)),1))])),(0,a.createCommentVNode)(` 消息体 `),(0,a.createElementVNode)(`div`,f,[t.msg.sender===`other`&&t.msg.username?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,p,(0,a.toDisplayString)(t.msg.username),1)):(0,a.createCommentVNode)(`v-if`,!0),(0,a.createCommentVNode)(` 文本消息 `),t.msg.type===`text`||t.msg.type===`system`?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,m,(0,a.toDisplayString)(t.msg.content),1)):t.msg.type===`image`?((0,a.openBlock)(),(0,a.createElementBlock)(a.Fragment,{key:2},[(0,a.createCommentVNode)(` 图片消息 `),(0,a.createElementVNode)(`button`,{type:`button`,class:`c-chat__msg-image-button`,"aria-label":(0,a.unref)(i)(`chat.imagePreview`,{name:t.msg.username||(0,a.unref)(i)(`chat.title`)}),onClick:n[0]||=e=>S(`image-preview`,t.msg.content)},[(0,a.createElementVNode)(`img`,{src:t.msg.content,alt:t.msg.fileName||(0,a.unref)(i)(`chat.image`),class:`c-chat__msg-image`},null,8,g)],8,h)],2112)):t.msg.type===`file`?((0,a.openBlock)(),(0,a.createElementBlock)(a.Fragment,{key:3},[(0,a.createCommentVNode)(` 文件消息 `),(0,a.createElementVNode)(`button`,{type:`button`,class:`c-chat__msg-file`,onClick:n[1]||=e=>S(`file-click`,t.msg)},[(0,a.createVNode)(r.t,{name:`mdi:file-document-outline`,size:28}),(0,a.createElementVNode)(`div`,_,[(0,a.createElementVNode)(`span`,v,(0,a.toDisplayString)(t.msg.fileName||(0,a.unref)(i)(`chat.file`)),1),t.msg.fileSize?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,y,(0,a.toDisplayString)(O(t.msg.fileSize)),1)):(0,a.createCommentVNode)(`v-if`,!0)])])],2112)):(0,a.createCommentVNode)(`v-if`,!0),(0,a.createCommentVNode)(` 时间戳 `),t.showTimestamp&&t.msg.sender!==`system`?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,b,(0,a.toDisplayString)(E(t.msg.timestamp)),1)):(0,a.createCommentVNode)(`v-if`,!0),(0,a.createCommentVNode)(` 发送状态 `),t.msg.sender===`self`&&t.msg.status===`failed`?((0,a.openBlock)(),(0,a.createElementBlock)(`button`,{key:5,type:`button`,class:`c-chat__msg-status is-failed`,onClick:n[2]||=e=>S(`resend`,t.msg)},(0,a.toDisplayString)((0,a.unref)(i)(`chat.failed`)),1)):t.msg.sender===`self`&&t.msg.status===`sending`?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,x,(0,a.toDisplayString)((0,a.unref)(i)(`chat.sending`)),1)):(0,a.createCommentVNode)(`v-if`,!0)])],2)],8,s))}});var C=n.t(S,[[`__scopeId`,`data-v-f8cf3d20`]]);const w=[`data-contact-id`],T={class:`c-chat__contact-avatar`},E=[`src`,`alt`],D={key:1,class:`c-chat__avatar-fallback`},O={key:2,class:`c-chat__online-dot`},k={class:`c-chat__contact-info`},A={class:`c-chat__contact-name`},j={key:0,class:`c-chat__contact-time`},M={key:0,class:`c-chat__contact-last`},N={key:0,class:`c-chat__unread`},P=(0,a.defineComponent)({__name:`ChatContactItem`,props:{contact:{},active:{type:Boolean}},emits:[`select`],setup(t,{emit:n}){let{t:r}=e.t(),i=n;function o(e){let t=new Date(e),n=Date.now()-t.getTime();if(n<6e4)return r(`time.now`);if(n<36e5)return r(`time.minutes`,{count:Math.floor(n/6e4)});let i=`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`;return n<864e5?i:`${t.getMonth()+1}/${t.getDate()} ${i}`}return(e,n)=>((0,a.openBlock)(),(0,a.createElementBlock)(`button`,{type:`button`,class:(0,a.normalizeClass)([`c-chat__contact`,{"is-active":t.active}]),"data-contact-id":t.contact.id,onClick:n[0]||=e=>i(`select`,t.contact.id)},[(0,a.createElementVNode)(`div`,T,[t.contact.avatar?((0,a.openBlock)(),(0,a.createElementBlock)(`img`,{key:0,src:t.contact.avatar,alt:t.contact.name,class:`c-chat__avatar`},null,8,E)):((0,a.openBlock)(),(0,a.createElementBlock)(`div`,D,(0,a.toDisplayString)(t.contact.name.charAt(0)),1)),t.contact.online?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,O)):(0,a.createCommentVNode)(`v-if`,!0)]),(0,a.createElementVNode)(`div`,k,[(0,a.createElementVNode)(`div`,A,[(0,a.createElementVNode)(`span`,null,(0,a.toDisplayString)(t.contact.name),1),t.contact.lastTime?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,j,(0,a.toDisplayString)(o(t.contact.lastTime)),1)):(0,a.createCommentVNode)(`v-if`,!0)]),t.contact.lastMessage?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,M,(0,a.toDisplayString)(t.contact.lastMessage),1)):(0,a.createCommentVNode)(`v-if`,!0)]),t.contact.unread?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,N,(0,a.toDisplayString)(t.contact.unread>99?`99+`:t.contact.unread),1)):(0,a.createCommentVNode)(`v-if`,!0)],10,w))}});var F=n.t(P,[[`__scopeId`,`data-v-1781627b`]]);function I(e){let t=!1,n=0,r,i,o,s=!0,c=!1,l=!1,u=0,d=0,f,p=()=>e.virtualRef.value?.listElRef??e.normalRef.value,m=e=>e.scrollHeight-e.scrollTop-e.clientHeight<=64,h=e=>Array.from(e.querySelectorAll(`[data-message-id]`));function g(){r!==void 0&&cancelAnimationFrame(r),r=void 0}function _(e,i){if(g(),typeof requestAnimationFrame>`u`){i();return}r=requestAnimationFrame(()=>{r=void 0,!t&&e===n&&i()})}function v(e){let r=++n;g(),(0,a.nextTick)(()=>{!t&&r===n&&e(r)})}function y(t){let n=e.virtualRef.value;n?n.scrollTo({top:t,debounce:!1}):e.normalRef.value&&(e.normalRef.value.scrollTop=t)}function b(){let t=e.virtualRef.value;t?t.scrollTo({position:`bottom`}):e.normalRef.value&&(e.normalRef.value.scrollTop=e.normalRef.value.scrollHeight)}function x(){s=!0,l=!1,c=!0,f=void 0,v(e=>{b(),_(e,()=>{b(),c=!1})})}function S(e){let{top:t}=e.getBoundingClientRect(),n=h(e).find(e=>e.getBoundingClientRect().bottom>t);return n?.dataset.messageId?{id:n.dataset.messageId,offset:n.getBoundingClientRect().top-t}:void 0}function C(e,t){let n=p();if(!n||!f)return;let r=h(n).find(e=>e.dataset.messageId===f?.id);if(r){let e=r.getBoundingClientRect().top-n.getBoundingClientRect().top;y(Math.max(0,n.scrollTop+e-f.offset))}t>0?_(e,()=>C(e,t-1)):f=void 0}function w(t){f=t,s=!1,c=!1,v(n=>{e.virtualRef.value?.scrollTo({key:t.id,debounce:!1}),C(n,3)})}function T(e,t){s=!1,c=!1,f=void 0,v(()=>{let n=p();n&&y(Math.max(0,e+n.scrollHeight-t))})}function E(){s=!1,c=!1,n++,g()}function D(){l=!0,f=void 0,E(),i!==void 0&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>{if(i=void 0,t||!l)return;l=!1;let e=p();e&&!f&&(s=m(e))})}function O(e){return u>0&&(u!==e.scrollHeight||d!==e.clientHeight)}function k(e){let t=O(e);if(u=e.scrollHeight,d=e.clientHeight,!(c||f)){if(s&&t&&!l){x();return}l=!1,s=m(e)}}function A(){let t=p();t&&(k(t),t.scrollTop===0&&!e.loadingHistory.value&&e.onLoadMore())}function j(){if(!t)if(f){let e=n;_(e,()=>C(e,1))}else s&&x()}(0,a.watch)(()=>e.virtualRef.value?.itemsElRef??e.normalRef.value?.firstElementChild,e=>{if(o?.disconnect(),o=void 0,e&&typeof ResizeObserver<`u`){o=new ResizeObserver(j),o.observe(e);let t=p();t&&t!==e&&o.observe(t)}},{flush:`post`});let M=()=>{let t=e.messages.value;return[e.contactId.value,t.length,t[0]?.id,t[t.length-1]?.id,t[t.length-1]?.content,e.loadingHistory.value,e.virtual.value]},N=(t,n)=>t[1]>n[1]&&n[1]>0&&t[2]!==n[2]&&(t[3]===n[3]||e.messages.value.some(e=>e.id===n[2])),P=(e,t)=>e[1]>0&&t[1]>0&&e[2]!==t[2]&&e[3]!==t[3];function F(e,t,n){let r=e[6]||t[6]?S(n):void 0;r?w(r):T(n.scrollTop,n.scrollHeight)}let I=(e,t,n)=>P(e,t)||t[1]===0||!l&&(m(n)||s&&O(n));function L(e,t,n){I(e,t,n)?x():F(e,t,n)}return(0,a.watch)(M,(e,t)=>{let n=p();if(!t||e[0]!==t[0]||!n){x();return}N(e,t)||e[5]!==t[5]?F(e,t,n):e[6]===t[6]?I(e,t,n)?x():f||E():L(e,t,n)},{immediate:!0,flush:`pre`}),(0,a.onBeforeUnmount)(()=>{t=!0,n++,g(),i!==void 0&&cancelAnimationFrame(i),o?.disconnect()}),{scrollToBottom:x,handleMessagesScroll:A,handleScrollIntent:D}}const L={placeholder:`输入消息...`,showContacts:!0,showTimestamp:!0,showSendBtn:!0,loadingHistory:!1,title:`聊天`},R={key:0,class:`c-chat__sidebar`},z={class:`c-chat__sidebar-header`},B={class:`c-chat__search`},V={key:1,class:`c-chat__contact-list`},H={key:1,class:`c-chat__main`},U={class:`c-chat__header`},W={key:0,class:`c-chat__header-status`},G={key:0,class:`c-chat__load-more`},K={class:`c-chat__message-items`},q={key:0,class:`c-chat__load-more`},J={key:1,class:`c-chat__empty`},Y={class:`c-chat__input-area`},X={class:`c-chat__input-actions`},Z={class:`c-chat__input-wrap`},Q={class:`c-chat__main c-chat__no-chat`},$=(0,a.defineComponent)({__name:`index`,props:{contacts:{default:()=>[]},messages:{default:()=>[]},currentContactId:{default:``},placeholder:{},showContacts:{type:Boolean,default:L.showContacts},showTimestamp:{type:Boolean,default:L.showTimestamp},selfAvatar:{default:``},selfName:{default:``},showSendBtn:{type:Boolean,default:L.showSendBtn},loadingHistory:{type:Boolean,default:L.loadingHistory},virtualScroll:{type:Boolean,default:!0},title:{}},emits:[`send`,`select-contact`,`load-more`,`image-preview`,`file-click`,`file-upload`,`emoji-click`,`resend`],setup(n,{expose:s,emit:c}){let{t:l}=e.t(),u=t.n(),d=n,f=c,p=(0,a.computed)(()=>({...L,...d,placeholder:d.placeholder??l(`chat.placeholder`),title:d.title??l(`chat.title`)})),m=(0,a.ref)(``),h=(0,a.ref)(``),g=(0,a.ref)(null),_=(0,a.ref)(null),v=(0,a.computed)(()=>d.contacts??[]),y=(0,a.computed)(()=>d.messages??[]),b=(0,a.computed)(()=>d.currentContactId||v.value[0]?.id||``),x=new Map;(0,a.watch)(b,(e,t)=>{let n=m.value,r=x.get(e)??``;for(x.delete(e),x.delete(t),n&&(d.contacts?.some(e=>e.id===t)||!d.showContacts)&&x.set(t,n);x.size>50;)x.delete(x.keys().next().value);m.value=r},{flush:`sync`}),(0,a.watch)(()=>d.contacts?.map(e=>e.id),e=>{if(!d.showContacts)return;let t=new Set(e);t.has(b.value)||(m.value=``);for(let e of x.keys())t.has(e)||x.delete(e)});let S=(0,a.computed)(()=>v.value.find(e=>e.id===b.value)),w=(0,a.computed)(()=>{if(!h.value)return v.value;let e=h.value.toLowerCase();return v.value.filter(t=>t.name.toLowerCase().includes(e))}),T=(0,a.computed)(()=>d.virtualScroll&&y.value.length>=200),E=(0,a.computed)(()=>d.virtualScroll&&w.value.length>=100),D=e=>{f(`select-contact`,e)},O=e=>{if(e instanceof KeyboardEvent&&(e.isComposing||e.keyCode===229))return;e?.preventDefault();let t=m.value.trim();t&&(f(`send`,t),m.value=``)},{scrollToBottom:k,handleMessagesScroll:A,handleScrollIntent:j}=I({messages:y,contactId:b,virtual:T,loadingHistory:(0,a.computed)(()=>p.value.loadingHistory),normalRef:g,virtualRef:_,onLoadMore:()=>f(`load-more`)});return s({scrollToBottom:k}),(e,t)=>{let s=o.NInput,c=o.NSpin,d=o.NButton;return(0,a.openBlock)(),(0,a.createElementBlock)(`div`,{class:`c-chat`,style:(0,a.normalizeStyle)((0,a.unref)(u))},[(0,a.createCommentVNode)(` ===== 联系人侧栏 ===== `),p.value.showContacts&&v.value.length?((0,a.openBlock)(),(0,a.createElementBlock)(`aside`,R,[(0,a.createElementVNode)(`div`,z,[(0,a.createVNode)(r.t,{name:`mdi:chat-outline`,size:20}),(0,a.createTextVNode)(` `+(0,a.toDisplayString)((0,a.unref)(l)(`chat.sessions`)),1)]),(0,a.createCommentVNode)(` 搜索框 `),(0,a.createElementVNode)(`div`,B,[(0,a.createVNode)(s,{value:h.value,"onUpdate:value":t[0]||=e=>h.value=e,placeholder:(0,a.unref)(l)(`chat.search`),clearable:``,size:`small`},{prefix:(0,a.withCtx)(()=>[(0,a.createVNode)(r.t,{name:`mdi:magnify`,size:16})]),_:1},8,[`value`,`placeholder`])]),E.value?((0,a.openBlock)(),(0,a.createBlock)((0,a.unref)(i.t),{key:0,class:`c-chat__contact-list`,items:w.value,"key-field":`id`,"item-size":56,"item-resizable":``},{default:(0,a.withCtx)(({index:e})=>[(0,a.createVNode)(F,{contact:w.value[e],active:w.value[e].id===b.value,onSelect:D},null,8,[`contact`,`active`])]),_:1},8,[`items`])):((0,a.openBlock)(),(0,a.createElementBlock)(`div`,V,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(w.value,e=>((0,a.openBlock)(),(0,a.createBlock)(F,{key:e.id,contact:e,active:e.id===b.value,onSelect:D},null,8,[`contact`,`active`]))),128))]))])):(0,a.createCommentVNode)(`v-if`,!0),(0,a.createCommentVNode)(` ===== 主聊天区域 ===== `),S.value||!p.value.showContacts?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,H,[(0,a.createCommentVNode)(` 顶栏 `),(0,a.createElementVNode)(`div`,U,[(0,a.renderSlot)(e.$slots,`header`,{},()=>[(0,a.createElementVNode)(`span`,null,(0,a.toDisplayString)(S.value?.name||p.value.title),1),S.value?.online?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,W,(0,a.toDisplayString)((0,a.unref)(l)(`chat.online`)),1)):(0,a.createCommentVNode)(`v-if`,!0)],!0)]),T.value?((0,a.openBlock)(),(0,a.createBlock)((0,a.unref)(i.t),{key:b.value,ref_key:`virtualMessagesRef`,ref:_,class:`c-chat__messages c-chat__messages--virtual`,items:y.value,"key-field":`id`,"item-size":32,"item-resizable":``,"padding-top":16,"padding-bottom":16,"items-style":{paddingLeft:`20px`,paddingRight:`20px`},onScroll:(0,a.unref)(A),onWheel:(0,a.unref)(j),onPointerdown:(0,a.unref)(j),onKeydown:(0,a.unref)(j)},{default:(0,a.withCtx)(({index:e})=>[(0,a.createElementVNode)(`div`,null,[e===0&&p.value.loadingHistory?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,G,[(0,a.createVNode)(c,{size:`small`})])):(0,a.createCommentVNode)(`v-if`,!0),(0,a.createVNode)(C,{msg:y.value[e],previous:y.value[e-1],"self-avatar":n.selfAvatar,"self-name":n.selfName,"show-timestamp":p.value.showTimestamp,onImagePreview:t[1]||=e=>f(`image-preview`,e),onFileClick:t[2]||=e=>f(`file-click`,e),onResend:t[3]||=e=>f(`resend`,e)},null,8,[`msg`,`previous`,`self-avatar`,`self-name`,`show-timestamp`])])]),_:1},8,[`items`,`onScroll`,`onWheel`,`onPointerdown`,`onKeydown`])):((0,a.openBlock)(),(0,a.createElementBlock)(`div`,{key:1,ref_key:`messagesRef`,ref:g,class:`c-chat__messages`,onScroll:t[7]||=(...e)=>(0,a.unref)(A)&&(0,a.unref)(A)(...e),onWheel:t[8]||=(...e)=>(0,a.unref)(j)&&(0,a.unref)(j)(...e),onPointerdown:t[9]||=(...e)=>(0,a.unref)(j)&&(0,a.unref)(j)(...e),onKeydown:t[10]||=(...e)=>(0,a.unref)(j)&&(0,a.unref)(j)(...e)},[(0,a.createElementVNode)(`div`,K,[p.value.loadingHistory?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,q,[(0,a.createVNode)(c,{size:`small`})])):(0,a.createCommentVNode)(`v-if`,!0),!y.value.length&&!p.value.loadingHistory?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,J,(0,a.toDisplayString)((0,a.unref)(l)(`chat.empty`)),1)):(0,a.createCommentVNode)(`v-if`,!0),((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(y.value,(e,r)=>((0,a.openBlock)(),(0,a.createBlock)(C,{key:e.id,msg:e,previous:y.value[r-1],"self-avatar":n.selfAvatar,"self-name":n.selfName,"show-timestamp":p.value.showTimestamp,onImagePreview:t[4]||=e=>f(`image-preview`,e),onFileClick:t[5]||=e=>f(`file-click`,e),onResend:t[6]||=e=>f(`resend`,e)},null,8,[`msg`,`previous`,`self-avatar`,`self-name`,`show-timestamp`]))),128))])],544)),(0,a.createCommentVNode)(` 输入区域 `),(0,a.createElementVNode)(`div`,Y,[(0,a.createElementVNode)(`div`,X,[(0,a.renderSlot)(e.$slots,`input-actions`,{},()=>[(0,a.createVNode)(d,{quaternary:``,circle:``,size:`small`,"aria-label":(0,a.unref)(l)(`chat.emoji`),onClick:t[11]||=e=>f(`emoji-click`)},{icon:(0,a.withCtx)(()=>[(0,a.createVNode)(r.t,{name:`mdi:emoticon-happy-outline`,size:18})]),_:1},8,[`aria-label`]),(0,a.createVNode)(d,{quaternary:``,circle:``,size:`small`,"aria-label":(0,a.unref)(l)(`chat.attach`),onClick:t[12]||=e=>f(`file-upload`)},{icon:(0,a.withCtx)(()=>[(0,a.createVNode)(r.t,{name:`mdi:paperclip`,size:18})]),_:1},8,[`aria-label`])],!0)]),(0,a.createElementVNode)(`div`,Z,[(0,a.createVNode)(s,{value:m.value,"onUpdate:value":t[13]||=e=>m.value=e,placeholder:p.value.placeholder,type:`textarea`,autosize:{minRows:1,maxRows:4},onKeydown:(0,a.withKeys)((0,a.withModifiers)(O,[`exact`]),[`enter`])},null,8,[`value`,`placeholder`,`onKeydown`])]),p.value.showSendBtn?((0,a.openBlock)(),(0,a.createBlock)(d,{key:0,type:`primary`,disabled:!m.value.trim(),class:`c-chat__send-btn`,"aria-label":(0,a.unref)(l)(`chat.send`),onClick:O},{icon:(0,a.withCtx)(()=>[(0,a.createVNode)(r.t,{name:`mdi:send`,size:16})]),_:1},8,[`disabled`,`aria-label`])):(0,a.createCommentVNode)(`v-if`,!0)])])):((0,a.openBlock)(),(0,a.createElementBlock)(a.Fragment,{key:2},[(0,a.createCommentVNode)(` ===== 未选中联系人空态 ===== `),(0,a.createElementVNode)(`div`,Q,[(0,a.createVNode)(r.t,{name:`mdi:chat-processing-outline`,size:48,class:`c-chat__no-chat-icon`}),(0,a.createElementVNode)(`span`,null,(0,a.toDisplayString)((0,a.unref)(l)(`chat.choose`)),1)])],2112))],4)}}});var ee=n.t($,[[`__scopeId`,`data-v-86049762`]]);Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return ee}});
1
+ require(`./chunk.cjs`);const e=require(`./useComponentLocale.cjs`),t=require(`./useComponentTheme.cjs`),n=require(`./export-helper.cjs`),r=require(`./C_Icon2.cjs`),i=require(`./useScopedComponentLocale.cjs`),a=require(`./virtualList.cjs`);let o=require(`vue`),s=require(`naive-ui`);const c={"chat.activities":`执行记录({count})`,"chat.activity.pending":`等待中`,"chat.activity.running":`进行中`,"chat.activity.succeeded":`已完成`,"chat.activity.failed":`失败`,"chat.sources":`引用来源({count})`},l={"chat.activities":`Execution steps ({count})`,"chat.activity.pending":`Pending`,"chat.activity.running":`Running`,"chat.activity.succeeded":`Completed`,"chat.activity.failed":`Failed`,"chat.sources":`Sources ({count})`},u={class:`c-chat-extras`},d={key:0},f={class:`c-chat-extras__items`},p=[`data-status`],m={key:0},h={key:1},g={class:`c-chat-extras__items`},_=[`onClick`],v={key:0},y=(0,o.defineComponent)({__name:`ChatMessageExtras`,props:{activities:{},sources:{}},emits:[`source-click`],setup(e,{emit:t}){let n=t,{t:r}=i.t(c,l);return(t,i)=>((0,o.openBlock)(),(0,o.createElementBlock)(`div`,u,[e.activities?.length?((0,o.openBlock)(),(0,o.createElementBlock)(`details`,d,[(0,o.createElementVNode)(`summary`,null,(0,o.toDisplayString)((0,o.unref)(r)(`chat.activities`,{count:e.activities.length})),1),(0,o.createElementVNode)(`ol`,f,[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(e.activities,e=>((0,o.openBlock)(),(0,o.createElementBlock)(`li`,{key:e.id,class:`c-chat-extras__step`},[(0,o.createElementVNode)(`span`,null,(0,o.toDisplayString)(e.title),1),(0,o.createElementVNode)(`span`,{class:`c-chat-extras__state`,"data-status":e.status},(0,o.toDisplayString)((0,o.unref)(r)(`chat.activity.${e.status}`)),9,p),e.detail?((0,o.openBlock)(),(0,o.createElementBlock)(`small`,m,(0,o.toDisplayString)(e.detail),1)):(0,o.createCommentVNode)(`v-if`,!0)]))),128))])])):(0,o.createCommentVNode)(`v-if`,!0),e.sources?.length?((0,o.openBlock)(),(0,o.createElementBlock)(`details`,h,[(0,o.createElementVNode)(`summary`,null,(0,o.toDisplayString)((0,o.unref)(r)(`chat.sources`,{count:e.sources.length})),1),(0,o.createElementVNode)(`ul`,g,[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(e.sources,e=>((0,o.openBlock)(),(0,o.createElementBlock)(`li`,{key:e.id},[(0,o.createElementVNode)(`button`,{type:`button`,onClick:t=>n(`source-click`,e)},(0,o.toDisplayString)(e.label),9,_),e.description?((0,o.openBlock)(),(0,o.createElementBlock)(`small`,v,(0,o.toDisplayString)(e.description),1)):(0,o.createCommentVNode)(`v-if`,!0)]))),128))])])):(0,o.createCommentVNode)(`v-if`,!0)]))}});var b=n.t(y,[[`__scopeId`,`data-v-dd33065d`]]);const x=[`data-message-id`],S={key:0,class:`c-chat__time-divider`},C={key:0,class:`c-chat__msg-avatar`},w=[`src`],T={key:1,class:`c-chat__avatar-fallback`},E={class:`c-chat__msg-body`},D={key:0,class:`c-chat__msg-username`},O={key:0,class:`c-chat__bubble`},k=[`aria-label`],A=[`src`,`alt`],j={class:`c-chat__file-info`},M={class:`c-chat__file-name`},N={key:0,class:`c-chat__file-size`},P={key:2,class:`c-chat__msg-time`},F={key:4,class:`c-chat__msg-status is-sending`},I=(0,o.defineComponent)({__name:`ChatMessageItem`,props:{msg:{},previous:{},selfAvatar:{},selfName:{},showTimestamp:{type:Boolean}},emits:[`image-preview`,`file-click`,`resend`,`source-click`],setup(t,{emit:n}){let{t:i}=e.t(),a=t,s=n,c=(0,o.computed)(()=>!a.previous||new Date(a.msg.timestamp).getTime()-new Date(a.previous.timestamp).getTime()>3e5),l=e=>e.sender===`self`&&a.selfAvatar||e.avatar,u=e=>e.sender===`self`?a.selfName||e.username||i(`chat.self`):e.username||i(`common.unknown`);function d(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function f(e){let t=new Date(e),n=new Date;return t.toDateString()===n.toDateString()?d(e):`${t.getMonth()+1}/${t.getDate()} ${d(e)}`}function p(e){return e<1024?`${e}B`:e<1048576?`${(e/1024).toFixed(1)}KB`:`${(e/1048576).toFixed(1)}MB`}return(e,n)=>((0,o.openBlock)(),(0,o.createElementBlock)(`div`,{class:`c-chat__message-row`,"data-message-id":t.msg.id},[(0,o.createCommentVNode)(` 时间分割 `),c.value?((0,o.openBlock)(),(0,o.createElementBlock)(`div`,S,(0,o.toDisplayString)(f(t.msg.timestamp)),1)):(0,o.createCommentVNode)(`v-if`,!0),(0,o.createCommentVNode)(` 消息条目 `),(0,o.createElementVNode)(`div`,{class:(0,o.normalizeClass)([`c-chat__msg`,`is-${t.msg.sender}`])},[(0,o.createCommentVNode)(` 头像 `),t.msg.sender===`system`?(0,o.createCommentVNode)(`v-if`,!0):((0,o.openBlock)(),(0,o.createElementBlock)(`div`,C,[l(t.msg)?((0,o.openBlock)(),(0,o.createElementBlock)(`img`,{key:0,src:l(t.msg),class:`c-chat__avatar`},null,8,w)):((0,o.openBlock)(),(0,o.createElementBlock)(`div`,T,(0,o.toDisplayString)(u(t.msg).charAt(0)),1))])),(0,o.createCommentVNode)(` 消息体 `),(0,o.createElementVNode)(`div`,E,[t.msg.sender===`other`&&t.msg.username?((0,o.openBlock)(),(0,o.createElementBlock)(`span`,D,(0,o.toDisplayString)(t.msg.username),1)):(0,o.createCommentVNode)(`v-if`,!0),(0,o.renderSlot)(e.$slots,`message`,{message:t.msg},()=>[(0,o.createCommentVNode)(` 文本消息 `),t.msg.type===`text`||t.msg.type===`system`?((0,o.openBlock)(),(0,o.createElementBlock)(`div`,O,(0,o.toDisplayString)(t.msg.content),1)):t.msg.type===`image`?((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,{key:1},[(0,o.createCommentVNode)(` 图片消息 `),(0,o.createElementVNode)(`button`,{type:`button`,class:`c-chat__msg-image-button`,"aria-label":(0,o.unref)(i)(`chat.imagePreview`,{name:t.msg.username||(0,o.unref)(i)(`chat.title`)}),onClick:n[0]||=e=>s(`image-preview`,t.msg.content)},[(0,o.createElementVNode)(`img`,{src:t.msg.content,alt:t.msg.fileName||(0,o.unref)(i)(`chat.image`),class:`c-chat__msg-image`},null,8,A)],8,k)],2112)):t.msg.type===`file`?((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,{key:2},[(0,o.createCommentVNode)(` 文件消息 `),(0,o.createElementVNode)(`button`,{type:`button`,class:`c-chat__msg-file`,onClick:n[1]||=e=>s(`file-click`,t.msg)},[(0,o.createVNode)(r.t,{name:`mdi:file-document-outline`,size:28}),(0,o.createElementVNode)(`div`,j,[(0,o.createElementVNode)(`span`,M,(0,o.toDisplayString)(t.msg.fileName||(0,o.unref)(i)(`chat.file`)),1),t.msg.fileSize?((0,o.openBlock)(),(0,o.createElementBlock)(`span`,N,(0,o.toDisplayString)(p(t.msg.fileSize)),1)):(0,o.createCommentVNode)(`v-if`,!0)])])],2112)):(0,o.createCommentVNode)(`v-if`,!0)],!0),t.msg.activities?.length||t.msg.sources?.length?((0,o.openBlock)(),(0,o.createBlock)(b,{key:1,activities:t.msg.activities,sources:t.msg.sources,onSourceClick:n[2]||=e=>s(`source-click`,e,t.msg)},null,8,[`activities`,`sources`])):(0,o.createCommentVNode)(`v-if`,!0),(0,o.createCommentVNode)(` 时间戳 `),t.showTimestamp&&t.msg.sender!==`system`?((0,o.openBlock)(),(0,o.createElementBlock)(`span`,P,(0,o.toDisplayString)(d(t.msg.timestamp)),1)):(0,o.createCommentVNode)(`v-if`,!0),(0,o.createCommentVNode)(` 发送状态 `),t.msg.sender===`self`&&t.msg.status===`failed`?((0,o.openBlock)(),(0,o.createElementBlock)(`button`,{key:3,type:`button`,class:`c-chat__msg-status is-failed`,onClick:n[3]||=e=>s(`resend`,t.msg)},(0,o.toDisplayString)((0,o.unref)(i)(`chat.failed`)),1)):t.msg.sender===`self`&&t.msg.status===`sending`?((0,o.openBlock)(),(0,o.createElementBlock)(`span`,F,(0,o.toDisplayString)((0,o.unref)(i)(`chat.sending`)),1)):(0,o.createCommentVNode)(`v-if`,!0)])],2)],8,x))}});var L=n.t(I,[[`__scopeId`,`data-v-d502dc05`]]);const R=[`data-contact-id`],z={class:`c-chat__contact-avatar`},ee=[`src`,`alt`],B={key:1,class:`c-chat__avatar-fallback`},V={key:2,class:`c-chat__online-dot`},H={class:`c-chat__contact-info`},U={class:`c-chat__contact-name`},W={key:0,class:`c-chat__contact-time`},G={key:0,class:`c-chat__contact-last`},K={key:0,class:`c-chat__unread`},q=(0,o.defineComponent)({__name:`ChatContactItem`,props:{contact:{},active:{type:Boolean}},emits:[`select`],setup(t,{emit:n}){let{t:r}=e.t(),i=n;function a(e){let t=new Date(e),n=Date.now()-t.getTime();if(n<6e4)return r(`time.now`);if(n<36e5)return r(`time.minutes`,{count:Math.floor(n/6e4)});let i=`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`;return n<864e5?i:`${t.getMonth()+1}/${t.getDate()} ${i}`}return(e,n)=>((0,o.openBlock)(),(0,o.createElementBlock)(`button`,{type:`button`,class:(0,o.normalizeClass)([`c-chat__contact`,{"is-active":t.active}]),"data-contact-id":t.contact.id,onClick:n[0]||=e=>i(`select`,t.contact.id)},[(0,o.createElementVNode)(`div`,z,[t.contact.avatar?((0,o.openBlock)(),(0,o.createElementBlock)(`img`,{key:0,src:t.contact.avatar,alt:t.contact.name,class:`c-chat__avatar`},null,8,ee)):((0,o.openBlock)(),(0,o.createElementBlock)(`div`,B,(0,o.toDisplayString)(t.contact.name.charAt(0)),1)),t.contact.online?((0,o.openBlock)(),(0,o.createElementBlock)(`span`,V)):(0,o.createCommentVNode)(`v-if`,!0)]),(0,o.createElementVNode)(`div`,H,[(0,o.createElementVNode)(`div`,U,[(0,o.createElementVNode)(`span`,null,(0,o.toDisplayString)(t.contact.name),1),t.contact.lastTime?((0,o.openBlock)(),(0,o.createElementBlock)(`span`,W,(0,o.toDisplayString)(a(t.contact.lastTime)),1)):(0,o.createCommentVNode)(`v-if`,!0)]),t.contact.lastMessage?((0,o.openBlock)(),(0,o.createElementBlock)(`div`,G,(0,o.toDisplayString)(t.contact.lastMessage),1)):(0,o.createCommentVNode)(`v-if`,!0)]),t.contact.unread?((0,o.openBlock)(),(0,o.createElementBlock)(`span`,K,(0,o.toDisplayString)(t.contact.unread>99?`99+`:t.contact.unread),1)):(0,o.createCommentVNode)(`v-if`,!0)],10,R))}});var J=n.t(q,[[`__scopeId`,`data-v-1781627b`]]);function Y(e){let t=!1,n=0,r,i,a,s=!0,c=!1,l=!1,u=0,d=0,f,p=()=>e.virtualRef.value?.listElRef??e.normalRef.value,m=e=>e.scrollHeight-e.scrollTop-e.clientHeight<=64,h=e=>Array.from(e.querySelectorAll(`[data-message-id]`));function g(){r!==void 0&&cancelAnimationFrame(r),r=void 0}function _(e,i){if(g(),typeof requestAnimationFrame>`u`){i();return}r=requestAnimationFrame(()=>{r=void 0,!t&&e===n&&i()})}function v(e){let r=++n;g(),(0,o.nextTick)(()=>{!t&&r===n&&e(r)})}function y(t){let n=e.virtualRef.value;n?n.scrollTo({top:t,debounce:!1}):e.normalRef.value&&(e.normalRef.value.scrollTop=t)}function b(){let t=e.virtualRef.value;t?t.scrollTo({position:`bottom`}):e.normalRef.value&&(e.normalRef.value.scrollTop=e.normalRef.value.scrollHeight)}function x(){s=!0,l=!1,c=!0,f=void 0,v(e=>{b(),_(e,()=>{b(),c=!1})})}function S(e){let{top:t}=e.getBoundingClientRect(),n=h(e).find(e=>e.getBoundingClientRect().bottom>t);return n?.dataset.messageId?{id:n.dataset.messageId,offset:n.getBoundingClientRect().top-t}:void 0}function C(e,t){let n=p();if(!n||!f)return;let r=h(n).find(e=>e.dataset.messageId===f?.id);if(r){let e=r.getBoundingClientRect().top-n.getBoundingClientRect().top;y(Math.max(0,n.scrollTop+e-f.offset))}t>0?_(e,()=>C(e,t-1)):f=void 0}function w(t){f=t,s=!1,c=!1,v(n=>{e.virtualRef.value?.scrollTo({key:t.id,debounce:!1}),C(n,3)})}function T(e,t){s=!1,c=!1,f=void 0,v(()=>{let n=p();n&&y(Math.max(0,e+n.scrollHeight-t))})}function E(){s=!1,c=!1,n++,g()}function D(){l=!0,f=void 0,E(),i!==void 0&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>{if(i=void 0,t||!l)return;l=!1;let e=p();e&&!f&&(s=m(e))})}function O(e){return u>0&&(u!==e.scrollHeight||d!==e.clientHeight)}function k(e){let t=O(e);if(u=e.scrollHeight,d=e.clientHeight,!(c||f)){if(s&&t&&!l){x();return}l=!1,s=m(e)}}function A(){let t=p();t&&(k(t),t.scrollTop===0&&!e.loadingHistory.value&&e.onLoadMore())}function j(){if(!t)if(f){let e=n;_(e,()=>C(e,1))}else s&&x()}(0,o.watch)(()=>e.virtualRef.value?.itemsElRef??e.normalRef.value?.firstElementChild,e=>{if(a?.disconnect(),a=void 0,e&&typeof ResizeObserver<`u`){a=new ResizeObserver(j),a.observe(e);let t=p();t&&t!==e&&a.observe(t)}},{flush:`post`});let M=()=>{let t=e.messages.value;return[e.contactId.value,t.length,t[0]?.id,t[t.length-1]?.id,t[t.length-1]?.content,e.loadingHistory.value,e.virtual.value]},N=(t,n)=>t[1]>n[1]&&n[1]>0&&t[2]!==n[2]&&(t[3]===n[3]||e.messages.value.some(e=>e.id===n[2])),P=(e,t)=>e[1]>0&&t[1]>0&&e[2]!==t[2]&&e[3]!==t[3];function F(e,t,n){let r=e[6]||t[6]?S(n):void 0;r?w(r):T(n.scrollTop,n.scrollHeight)}let I=(e,t,n)=>P(e,t)||t[1]===0||!l&&(m(n)||s&&O(n));function L(e,t,n){I(e,t,n)?x():F(e,t,n)}return(0,o.watch)(M,(e,t)=>{let n=p();if(!t||e[0]!==t[0]||!n){x();return}N(e,t)||e[5]!==t[5]?F(e,t,n):e[6]===t[6]?I(e,t,n)?x():f||E():L(e,t,n)},{immediate:!0,flush:`pre`}),(0,o.onBeforeUnmount)(()=>{t=!0,n++,g(),i!==void 0&&cancelAnimationFrame(i),a?.disconnect()}),{scrollToBottom:x,handleMessagesScroll:A,handleScrollIntent:D}}const X={placeholder:`输入消息...`,showContacts:!0,showTimestamp:!0,showSendBtn:!0,loadingHistory:!1,title:`聊天`},Z={key:0,class:`c-chat__sidebar`},Q={class:`c-chat__sidebar-header`},te={class:`c-chat__search`},ne={key:1,class:`c-chat__contact-list`},re={key:1,class:`c-chat__main`},ie={class:`c-chat__header`},ae={key:0,class:`c-chat__header-status`},oe={key:0,class:`c-chat__load-more`},se={class:`c-chat__message-items`},ce={key:0,class:`c-chat__load-more`},le={key:1,class:`c-chat__empty`},ue={class:`c-chat__input-area`},$={class:`c-chat__input-actions`},de={class:`c-chat__input-wrap`},fe={class:`c-chat__main c-chat__no-chat`},pe=(0,o.defineComponent)({__name:`index`,props:{contacts:{default:()=>[]},messages:{default:()=>[]},currentContactId:{default:``},placeholder:{},showContacts:{type:Boolean,default:X.showContacts},showTimestamp:{type:Boolean,default:X.showTimestamp},selfAvatar:{default:``},selfName:{default:``},showSendBtn:{type:Boolean,default:X.showSendBtn},loadingHistory:{type:Boolean,default:X.loadingHistory},virtualScroll:{type:Boolean,default:!0},title:{}},emits:[`send`,`select-contact`,`load-more`,`image-preview`,`file-click`,`file-upload`,`emoji-click`,`resend`,`source-click`],setup(n,{expose:i,emit:c}){let{t:l}=e.t(),u=t.n(),d=n,f=c,p=(0,o.computed)(()=>({...X,...d,placeholder:d.placeholder??l(`chat.placeholder`),title:d.title??l(`chat.title`)})),m=(0,o.ref)(``),h=(0,o.ref)(``),g=(0,o.ref)(null),_=(0,o.ref)(null),v=(0,o.computed)(()=>d.contacts??[]),y=(0,o.computed)(()=>d.messages??[]),b=(0,o.computed)(()=>d.currentContactId||v.value[0]?.id||``),x=new Map;(0,o.watch)(b,(e,t)=>{let n=m.value,r=x.get(e)??``;for(x.delete(e),x.delete(t),n&&(d.contacts?.some(e=>e.id===t)||!d.showContacts)&&x.set(t,n);x.size>50;)x.delete(x.keys().next().value);m.value=r},{flush:`sync`}),(0,o.watch)(()=>d.contacts?.map(e=>e.id),e=>{if(!d.showContacts)return;let t=new Set(e);t.has(b.value)||(m.value=``);for(let e of x.keys())t.has(e)||x.delete(e)});let S=(0,o.computed)(()=>v.value.find(e=>e.id===b.value)),C=(0,o.computed)(()=>{if(!h.value)return v.value;let e=h.value.toLowerCase();return v.value.filter(t=>t.name.toLowerCase().includes(e))}),w=(0,o.computed)(()=>d.virtualScroll&&y.value.length>=200),T=(0,o.computed)(()=>d.virtualScroll&&C.value.length>=100),E=e=>{f(`select-contact`,e)},D=e=>{if(e instanceof KeyboardEvent&&(e.isComposing||e.keyCode===229))return;e?.preventDefault();let t=m.value.trim();t&&(f(`send`,t),m.value=``)},{scrollToBottom:O,handleMessagesScroll:k,handleScrollIntent:A}=Y({messages:y,contactId:b,virtual:w,loadingHistory:(0,o.computed)(()=>p.value.loadingHistory),normalRef:g,virtualRef:_,onLoadMore:()=>f(`load-more`)});return i({scrollToBottom:O}),(e,t)=>{let i=s.NInput,c=s.NSpin,d=s.NButton;return(0,o.openBlock)(),(0,o.createElementBlock)(`div`,{class:`c-chat`,style:(0,o.normalizeStyle)((0,o.unref)(u))},[(0,o.createCommentVNode)(` ===== 联系人侧栏 ===== `),p.value.showContacts&&v.value.length?((0,o.openBlock)(),(0,o.createElementBlock)(`aside`,Z,[(0,o.createElementVNode)(`div`,Q,[(0,o.createVNode)(r.t,{name:`mdi:chat-outline`,size:20}),(0,o.createTextVNode)(` `+(0,o.toDisplayString)((0,o.unref)(l)(`chat.sessions`)),1)]),(0,o.createCommentVNode)(` 搜索框 `),(0,o.createElementVNode)(`div`,te,[(0,o.createVNode)(i,{value:h.value,"onUpdate:value":t[0]||=e=>h.value=e,placeholder:(0,o.unref)(l)(`chat.search`),clearable:``,size:`small`},{prefix:(0,o.withCtx)(()=>[(0,o.createVNode)(r.t,{name:`mdi:magnify`,size:16})]),_:1},8,[`value`,`placeholder`])]),T.value?((0,o.openBlock)(),(0,o.createBlock)((0,o.unref)(a.t),{key:0,class:`c-chat__contact-list`,items:C.value,"key-field":`id`,"item-size":56,"item-resizable":``},{default:(0,o.withCtx)(({index:e})=>[(0,o.createVNode)(J,{contact:C.value[e],active:C.value[e].id===b.value,onSelect:E},null,8,[`contact`,`active`])]),_:1},8,[`items`])):((0,o.openBlock)(),(0,o.createElementBlock)(`div`,ne,[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(C.value,e=>((0,o.openBlock)(),(0,o.createBlock)(J,{key:e.id,contact:e,active:e.id===b.value,onSelect:E},null,8,[`contact`,`active`]))),128))]))])):(0,o.createCommentVNode)(`v-if`,!0),(0,o.createCommentVNode)(` ===== 主聊天区域 ===== `),S.value||!p.value.showContacts?((0,o.openBlock)(),(0,o.createElementBlock)(`div`,re,[(0,o.createCommentVNode)(` 顶栏 `),(0,o.createElementVNode)(`div`,ie,[(0,o.renderSlot)(e.$slots,`header`,{},()=>[(0,o.createElementVNode)(`span`,null,(0,o.toDisplayString)(S.value?.name||p.value.title),1),S.value?.online?((0,o.openBlock)(),(0,o.createElementBlock)(`span`,ae,(0,o.toDisplayString)((0,o.unref)(l)(`chat.online`)),1)):(0,o.createCommentVNode)(`v-if`,!0)],!0)]),w.value?((0,o.openBlock)(),(0,o.createBlock)((0,o.unref)(a.t),{key:b.value,ref_key:`virtualMessagesRef`,ref:_,class:`c-chat__messages c-chat__messages--virtual`,items:y.value,"key-field":`id`,"item-size":32,"item-resizable":``,"padding-top":16,"padding-bottom":16,"items-style":{paddingLeft:`20px`,paddingRight:`20px`},onScroll:(0,o.unref)(k),onWheel:(0,o.unref)(A),onPointerdown:(0,o.unref)(A),onKeydown:(0,o.unref)(A)},{default:(0,o.withCtx)(({index:r})=>[(0,o.createElementVNode)(`div`,null,[r===0&&p.value.loadingHistory?((0,o.openBlock)(),(0,o.createElementBlock)(`div`,oe,[(0,o.createVNode)(c,{size:`small`})])):(0,o.createCommentVNode)(`v-if`,!0),(0,o.createVNode)(L,{msg:y.value[r],previous:y.value[r-1],"self-avatar":n.selfAvatar,"self-name":n.selfName,"show-timestamp":p.value.showTimestamp,onImagePreview:t[1]||=e=>f(`image-preview`,e),onFileClick:t[2]||=e=>f(`file-click`,e),onResend:t[3]||=e=>f(`resend`,e),onSourceClick:t[4]||=(e,t)=>f(`source-click`,e,t)},(0,o.createSlots)({_:2},[e.$slots.message?{name:`message`,fn:(0,o.withCtx)(t=>[(0,o.renderSlot)(e.$slots,`message`,(0,o.normalizeProps)((0,o.guardReactiveProps)(t)),void 0,!0)]),key:`0`}:void 0]),1032,[`msg`,`previous`,`self-avatar`,`self-name`,`show-timestamp`])])]),_:3},8,[`items`,`onScroll`,`onWheel`,`onPointerdown`,`onKeydown`])):((0,o.openBlock)(),(0,o.createElementBlock)(`div`,{key:1,ref_key:`messagesRef`,ref:g,class:`c-chat__messages`,onScroll:t[9]||=(...e)=>(0,o.unref)(k)&&(0,o.unref)(k)(...e),onWheel:t[10]||=(...e)=>(0,o.unref)(A)&&(0,o.unref)(A)(...e),onPointerdown:t[11]||=(...e)=>(0,o.unref)(A)&&(0,o.unref)(A)(...e),onKeydown:t[12]||=(...e)=>(0,o.unref)(A)&&(0,o.unref)(A)(...e)},[(0,o.createElementVNode)(`div`,se,[p.value.loadingHistory?((0,o.openBlock)(),(0,o.createElementBlock)(`div`,ce,[(0,o.createVNode)(c,{size:`small`})])):(0,o.createCommentVNode)(`v-if`,!0),!y.value.length&&!p.value.loadingHistory?((0,o.openBlock)(),(0,o.createElementBlock)(`div`,le,(0,o.toDisplayString)((0,o.unref)(l)(`chat.empty`)),1)):(0,o.createCommentVNode)(`v-if`,!0),((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(y.value,(r,i)=>((0,o.openBlock)(),(0,o.createBlock)(L,{key:r.id,msg:r,previous:y.value[i-1],"self-avatar":n.selfAvatar,"self-name":n.selfName,"show-timestamp":p.value.showTimestamp,onImagePreview:t[5]||=e=>f(`image-preview`,e),onFileClick:t[6]||=e=>f(`file-click`,e),onResend:t[7]||=e=>f(`resend`,e),onSourceClick:t[8]||=(e,t)=>f(`source-click`,e,t)},(0,o.createSlots)({_:2},[e.$slots.message?{name:`message`,fn:(0,o.withCtx)(t=>[(0,o.renderSlot)(e.$slots,`message`,(0,o.mergeProps)({ref_for:!0},t),void 0,!0)]),key:`0`}:void 0]),1032,[`msg`,`previous`,`self-avatar`,`self-name`,`show-timestamp`]))),128))])],544)),(0,o.createCommentVNode)(` 输入区域 `),(0,o.createElementVNode)(`div`,ue,[(0,o.createElementVNode)(`div`,$,[(0,o.renderSlot)(e.$slots,`input-actions`,{},()=>[(0,o.createVNode)(d,{quaternary:``,circle:``,size:`small`,"aria-label":(0,o.unref)(l)(`chat.emoji`),onClick:t[13]||=e=>f(`emoji-click`)},{icon:(0,o.withCtx)(()=>[(0,o.createVNode)(r.t,{name:`mdi:emoticon-happy-outline`,size:18})]),_:1},8,[`aria-label`]),(0,o.createVNode)(d,{quaternary:``,circle:``,size:`small`,"aria-label":(0,o.unref)(l)(`chat.attach`),onClick:t[14]||=e=>f(`file-upload`)},{icon:(0,o.withCtx)(()=>[(0,o.createVNode)(r.t,{name:`mdi:paperclip`,size:18})]),_:1},8,[`aria-label`])],!0)]),(0,o.createElementVNode)(`div`,de,[(0,o.createVNode)(i,{value:m.value,"onUpdate:value":t[15]||=e=>m.value=e,placeholder:p.value.placeholder,type:`textarea`,autosize:{minRows:1,maxRows:4},onKeydown:(0,o.withKeys)((0,o.withModifiers)(D,[`exact`]),[`enter`])},null,8,[`value`,`placeholder`,`onKeydown`])]),p.value.showSendBtn?((0,o.openBlock)(),(0,o.createBlock)(d,{key:0,type:`primary`,disabled:!m.value.trim(),class:`c-chat__send-btn`,"aria-label":(0,o.unref)(l)(`chat.send`),onClick:D},{icon:(0,o.withCtx)(()=>[(0,o.createVNode)(r.t,{name:`mdi:send`,size:16})]),_:1},8,[`disabled`,`aria-label`])):(0,o.createCommentVNode)(`v-if`,!0)])])):((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,{key:2},[(0,o.createCommentVNode)(` ===== 未选中联系人空态 ===== `),(0,o.createElementVNode)(`div`,fe,[(0,o.createVNode)(r.t,{name:`mdi:chat-processing-outline`,size:48,class:`c-chat__no-chat-icon`}),(0,o.createElementVNode)(`span`,null,(0,o.toDisplayString)((0,o.unref)(l)(`chat.choose`)),1)])],2112))],4)}}});var me=n.t(pe,[[`__scopeId`,`data-v-27157b1a`]]);Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return me}});
package/dist/C_Chat2.js CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./useComponentLocale.js";import{n as t}from"./useComponentTheme.js";import{t as n}from"./export-helper.js";import{t as r}from"./C_Icon2.js";import{t as i}from"./virtualList.js";import{Fragment as a,computed as o,createBlock as s,createCommentVNode as c,createElementBlock as l,createElementVNode as u,createTextVNode as d,createVNode as f,defineComponent as p,nextTick as m,normalizeClass as h,normalizeStyle as g,onBeforeUnmount as _,openBlock as v,ref as y,renderList as b,renderSlot as x,resolveComponent as S,toDisplayString as C,unref as w,watch as T,withCtx as E,withKeys as D,withModifiers as O}from"vue";import{NButton as k,NInput as A,NSpin as j}from"naive-ui";const M=[`data-message-id`],N={key:0,class:`c-chat__time-divider`},P={key:0,class:`c-chat__msg-avatar`},F=[`src`],I={key:1,class:`c-chat__avatar-fallback`},L={class:`c-chat__msg-body`},R={key:0,class:`c-chat__msg-username`},z={key:1,class:`c-chat__bubble`},B=[`aria-label`],V=[`src`,`alt`],H={class:`c-chat__file-info`},U={class:`c-chat__file-name`},W={key:0,class:`c-chat__file-size`},G={key:4,class:`c-chat__msg-time`},K={key:6,class:`c-chat__msg-status is-sending`};var q=n(p({__name:`ChatMessageItem`,props:{msg:{},previous:{},selfAvatar:{},selfName:{},showTimestamp:{type:Boolean}},emits:[`image-preview`,`file-click`,`resend`],setup(t,{emit:n}){let{t:i}=e(),s=t,d=n,p=o(()=>!s.previous||new Date(s.msg.timestamp).getTime()-new Date(s.previous.timestamp).getTime()>3e5),m=e=>e.sender===`self`&&s.selfAvatar||e.avatar,g=e=>e.sender===`self`?s.selfName||e.username||i(`chat.self`):e.username||i(`common.unknown`);function _(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function y(e){let t=new Date(e),n=new Date;return t.toDateString()===n.toDateString()?_(e):`${t.getMonth()+1}/${t.getDate()} ${_(e)}`}function b(e){return e<1024?`${e}B`:e<1048576?`${(e/1024).toFixed(1)}KB`:`${(e/1048576).toFixed(1)}MB`}return(e,n)=>(v(),l(`div`,{class:`c-chat__message-row`,"data-message-id":t.msg.id},[c(` 时间分割 `),p.value?(v(),l(`div`,N,C(y(t.msg.timestamp)),1)):c(`v-if`,!0),c(` 消息条目 `),u(`div`,{class:h([`c-chat__msg`,`is-${t.msg.sender}`])},[c(` 头像 `),t.msg.sender===`system`?c(`v-if`,!0):(v(),l(`div`,P,[m(t.msg)?(v(),l(`img`,{key:0,src:m(t.msg),class:`c-chat__avatar`},null,8,F)):(v(),l(`div`,I,C(g(t.msg).charAt(0)),1))])),c(` 消息体 `),u(`div`,L,[t.msg.sender===`other`&&t.msg.username?(v(),l(`span`,R,C(t.msg.username),1)):c(`v-if`,!0),c(` 文本消息 `),t.msg.type===`text`||t.msg.type===`system`?(v(),l(`div`,z,C(t.msg.content),1)):t.msg.type===`image`?(v(),l(a,{key:2},[c(` 图片消息 `),u(`button`,{type:`button`,class:`c-chat__msg-image-button`,"aria-label":w(i)(`chat.imagePreview`,{name:t.msg.username||w(i)(`chat.title`)}),onClick:n[0]||=e=>d(`image-preview`,t.msg.content)},[u(`img`,{src:t.msg.content,alt:t.msg.fileName||w(i)(`chat.image`),class:`c-chat__msg-image`},null,8,V)],8,B)],2112)):t.msg.type===`file`?(v(),l(a,{key:3},[c(` 文件消息 `),u(`button`,{type:`button`,class:`c-chat__msg-file`,onClick:n[1]||=e=>d(`file-click`,t.msg)},[f(r,{name:`mdi:file-document-outline`,size:28}),u(`div`,H,[u(`span`,U,C(t.msg.fileName||w(i)(`chat.file`)),1),t.msg.fileSize?(v(),l(`span`,W,C(b(t.msg.fileSize)),1)):c(`v-if`,!0)])])],2112)):c(`v-if`,!0),c(` 时间戳 `),t.showTimestamp&&t.msg.sender!==`system`?(v(),l(`span`,G,C(_(t.msg.timestamp)),1)):c(`v-if`,!0),c(` 发送状态 `),t.msg.sender===`self`&&t.msg.status===`failed`?(v(),l(`button`,{key:5,type:`button`,class:`c-chat__msg-status is-failed`,onClick:n[2]||=e=>d(`resend`,t.msg)},C(w(i)(`chat.failed`)),1)):t.msg.sender===`self`&&t.msg.status===`sending`?(v(),l(`span`,K,C(w(i)(`chat.sending`)),1)):c(`v-if`,!0)])],2)],8,M))}}),[[`__scopeId`,`data-v-f8cf3d20`]]);const J=[`data-contact-id`],Y={class:`c-chat__contact-avatar`},X=[`src`,`alt`],Z={key:1,class:`c-chat__avatar-fallback`},ee={key:2,class:`c-chat__online-dot`},te={class:`c-chat__contact-info`},ne={class:`c-chat__contact-name`},re={key:0,class:`c-chat__contact-time`},ie={key:0,class:`c-chat__contact-last`},ae={key:0,class:`c-chat__unread`};var Q=n(p({__name:`ChatContactItem`,props:{contact:{},active:{type:Boolean}},emits:[`select`],setup(t,{emit:n}){let{t:r}=e(),i=n;function a(e){let t=new Date(e),n=Date.now()-t.getTime();if(n<6e4)return r(`time.now`);if(n<36e5)return r(`time.minutes`,{count:Math.floor(n/6e4)});let i=`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`;return n<864e5?i:`${t.getMonth()+1}/${t.getDate()} ${i}`}return(e,n)=>(v(),l(`button`,{type:`button`,class:h([`c-chat__contact`,{"is-active":t.active}]),"data-contact-id":t.contact.id,onClick:n[0]||=e=>i(`select`,t.contact.id)},[u(`div`,Y,[t.contact.avatar?(v(),l(`img`,{key:0,src:t.contact.avatar,alt:t.contact.name,class:`c-chat__avatar`},null,8,X)):(v(),l(`div`,Z,C(t.contact.name.charAt(0)),1)),t.contact.online?(v(),l(`span`,ee)):c(`v-if`,!0)]),u(`div`,te,[u(`div`,ne,[u(`span`,null,C(t.contact.name),1),t.contact.lastTime?(v(),l(`span`,re,C(a(t.contact.lastTime)),1)):c(`v-if`,!0)]),t.contact.lastMessage?(v(),l(`div`,ie,C(t.contact.lastMessage),1)):c(`v-if`,!0)]),t.contact.unread?(v(),l(`span`,ae,C(t.contact.unread>99?`99+`:t.contact.unread),1)):c(`v-if`,!0)],10,J))}}),[[`__scopeId`,`data-v-1781627b`]]);function oe(e){let t=!1,n=0,r,i,a,o=!0,s=!1,c=!1,l=0,u=0,d,f=()=>e.virtualRef.value?.listElRef??e.normalRef.value,p=e=>e.scrollHeight-e.scrollTop-e.clientHeight<=64,h=e=>Array.from(e.querySelectorAll(`[data-message-id]`));function g(){r!==void 0&&cancelAnimationFrame(r),r=void 0}function v(e,i){if(g(),typeof requestAnimationFrame>`u`){i();return}r=requestAnimationFrame(()=>{r=void 0,!t&&e===n&&i()})}function y(e){let r=++n;g(),m(()=>{!t&&r===n&&e(r)})}function b(t){let n=e.virtualRef.value;n?n.scrollTo({top:t,debounce:!1}):e.normalRef.value&&(e.normalRef.value.scrollTop=t)}function x(){let t=e.virtualRef.value;t?t.scrollTo({position:`bottom`}):e.normalRef.value&&(e.normalRef.value.scrollTop=e.normalRef.value.scrollHeight)}function S(){o=!0,c=!1,s=!0,d=void 0,y(e=>{x(),v(e,()=>{x(),s=!1})})}function C(e){let{top:t}=e.getBoundingClientRect(),n=h(e).find(e=>e.getBoundingClientRect().bottom>t);return n?.dataset.messageId?{id:n.dataset.messageId,offset:n.getBoundingClientRect().top-t}:void 0}function w(e,t){let n=f();if(!n||!d)return;let r=h(n).find(e=>e.dataset.messageId===d?.id);if(r){let e=r.getBoundingClientRect().top-n.getBoundingClientRect().top;b(Math.max(0,n.scrollTop+e-d.offset))}t>0?v(e,()=>w(e,t-1)):d=void 0}function E(t){d=t,o=!1,s=!1,y(n=>{e.virtualRef.value?.scrollTo({key:t.id,debounce:!1}),w(n,3)})}function D(e,t){o=!1,s=!1,d=void 0,y(()=>{let n=f();n&&b(Math.max(0,e+n.scrollHeight-t))})}function O(){o=!1,s=!1,n++,g()}function k(){c=!0,d=void 0,O(),i!==void 0&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>{if(i=void 0,t||!c)return;c=!1;let e=f();e&&!d&&(o=p(e))})}function A(e){return l>0&&(l!==e.scrollHeight||u!==e.clientHeight)}function j(e){let t=A(e);if(l=e.scrollHeight,u=e.clientHeight,!(s||d)){if(o&&t&&!c){S();return}c=!1,o=p(e)}}function M(){let t=f();t&&(j(t),t.scrollTop===0&&!e.loadingHistory.value&&e.onLoadMore())}function N(){if(!t)if(d){let e=n;v(e,()=>w(e,1))}else o&&S()}T(()=>e.virtualRef.value?.itemsElRef??e.normalRef.value?.firstElementChild,e=>{if(a?.disconnect(),a=void 0,e&&typeof ResizeObserver<`u`){a=new ResizeObserver(N),a.observe(e);let t=f();t&&t!==e&&a.observe(t)}},{flush:`post`});let P=()=>{let t=e.messages.value;return[e.contactId.value,t.length,t[0]?.id,t[t.length-1]?.id,t[t.length-1]?.content,e.loadingHistory.value,e.virtual.value]},F=(t,n)=>t[1]>n[1]&&n[1]>0&&t[2]!==n[2]&&(t[3]===n[3]||e.messages.value.some(e=>e.id===n[2])),I=(e,t)=>e[1]>0&&t[1]>0&&e[2]!==t[2]&&e[3]!==t[3];function L(e,t,n){let r=e[6]||t[6]?C(n):void 0;r?E(r):D(n.scrollTop,n.scrollHeight)}let R=(e,t,n)=>I(e,t)||t[1]===0||!c&&(p(n)||o&&A(n));function z(e,t,n){R(e,t,n)?S():L(e,t,n)}return T(P,(e,t)=>{let n=f();if(!t||e[0]!==t[0]||!n){S();return}F(e,t)||e[5]!==t[5]?L(e,t,n):e[6]===t[6]?R(e,t,n)?S():d||O():z(e,t,n)},{immediate:!0,flush:`pre`}),_(()=>{t=!0,n++,g(),i!==void 0&&cancelAnimationFrame(i),a?.disconnect()}),{scrollToBottom:S,handleMessagesScroll:M,handleScrollIntent:k}}const $={placeholder:`输入消息...`,showContacts:!0,showTimestamp:!0,showSendBtn:!0,loadingHistory:!1,title:`聊天`},se={key:0,class:`c-chat__sidebar`},ce={class:`c-chat__sidebar-header`},le={class:`c-chat__search`},ue={key:1,class:`c-chat__contact-list`},de={key:1,class:`c-chat__main`},fe={class:`c-chat__header`},pe={key:0,class:`c-chat__header-status`},me={key:0,class:`c-chat__load-more`},he={class:`c-chat__message-items`},ge={key:0,class:`c-chat__load-more`},_e={key:1,class:`c-chat__empty`},ve={class:`c-chat__input-area`},ye={class:`c-chat__input-actions`},be={class:`c-chat__input-wrap`},xe={class:`c-chat__main c-chat__no-chat`};var Se=n(p({__name:`index`,props:{contacts:{default:()=>[]},messages:{default:()=>[]},currentContactId:{default:``},placeholder:{},showContacts:{type:Boolean,default:$.showContacts},showTimestamp:{type:Boolean,default:$.showTimestamp},selfAvatar:{default:``},selfName:{default:``},showSendBtn:{type:Boolean,default:$.showSendBtn},loadingHistory:{type:Boolean,default:$.loadingHistory},virtualScroll:{type:Boolean,default:!0},title:{}},emits:[`send`,`select-contact`,`load-more`,`image-preview`,`file-click`,`file-upload`,`emoji-click`,`resend`],setup(n,{expose:p,emit:m}){let{t:h}=e(),_=t(),S=n,M=m,N=o(()=>({...$,...S,placeholder:S.placeholder??h(`chat.placeholder`),title:S.title??h(`chat.title`)})),P=y(``),F=y(``),I=y(null),L=y(null),R=o(()=>S.contacts??[]),z=o(()=>S.messages??[]),B=o(()=>S.currentContactId||R.value[0]?.id||``),V=new Map;T(B,(e,t)=>{let n=P.value,r=V.get(e)??``;for(V.delete(e),V.delete(t),n&&(S.contacts?.some(e=>e.id===t)||!S.showContacts)&&V.set(t,n);V.size>50;)V.delete(V.keys().next().value);P.value=r},{flush:`sync`}),T(()=>S.contacts?.map(e=>e.id),e=>{if(!S.showContacts)return;let t=new Set(e);t.has(B.value)||(P.value=``);for(let e of V.keys())t.has(e)||V.delete(e)});let H=o(()=>R.value.find(e=>e.id===B.value)),U=o(()=>{if(!F.value)return R.value;let e=F.value.toLowerCase();return R.value.filter(t=>t.name.toLowerCase().includes(e))}),W=o(()=>S.virtualScroll&&z.value.length>=200),G=o(()=>S.virtualScroll&&U.value.length>=100),K=e=>{M(`select-contact`,e)},J=e=>{if(e instanceof KeyboardEvent&&(e.isComposing||e.keyCode===229))return;e?.preventDefault();let t=P.value.trim();t&&(M(`send`,t),P.value=``)},{scrollToBottom:Y,handleMessagesScroll:X,handleScrollIntent:Z}=oe({messages:z,contactId:B,virtual:W,loadingHistory:o(()=>N.value.loadingHistory),normalRef:I,virtualRef:L,onLoadMore:()=>M(`load-more`)});return p({scrollToBottom:Y}),(e,t)=>{let o=A,p=j,m=k;return v(),l(`div`,{class:`c-chat`,style:g(w(_))},[c(` ===== 联系人侧栏 ===== `),N.value.showContacts&&R.value.length?(v(),l(`aside`,se,[u(`div`,ce,[f(r,{name:`mdi:chat-outline`,size:20}),d(` `+C(w(h)(`chat.sessions`)),1)]),c(` 搜索框 `),u(`div`,le,[f(o,{value:F.value,"onUpdate:value":t[0]||=e=>F.value=e,placeholder:w(h)(`chat.search`),clearable:``,size:`small`},{prefix:E(()=>[f(r,{name:`mdi:magnify`,size:16})]),_:1},8,[`value`,`placeholder`])]),G.value?(v(),s(w(i),{key:0,class:`c-chat__contact-list`,items:U.value,"key-field":`id`,"item-size":56,"item-resizable":``},{default:E(({index:e})=>[f(Q,{contact:U.value[e],active:U.value[e].id===B.value,onSelect:K},null,8,[`contact`,`active`])]),_:1},8,[`items`])):(v(),l(`div`,ue,[(v(!0),l(a,null,b(U.value,e=>(v(),s(Q,{key:e.id,contact:e,active:e.id===B.value,onSelect:K},null,8,[`contact`,`active`]))),128))]))])):c(`v-if`,!0),c(` ===== 主聊天区域 ===== `),H.value||!N.value.showContacts?(v(),l(`div`,de,[c(` 顶栏 `),u(`div`,fe,[x(e.$slots,`header`,{},()=>[u(`span`,null,C(H.value?.name||N.value.title),1),H.value?.online?(v(),l(`span`,pe,C(w(h)(`chat.online`)),1)):c(`v-if`,!0)],!0)]),W.value?(v(),s(w(i),{key:B.value,ref_key:`virtualMessagesRef`,ref:L,class:`c-chat__messages c-chat__messages--virtual`,items:z.value,"key-field":`id`,"item-size":32,"item-resizable":``,"padding-top":16,"padding-bottom":16,"items-style":{paddingLeft:`20px`,paddingRight:`20px`},onScroll:w(X),onWheel:w(Z),onPointerdown:w(Z),onKeydown:w(Z)},{default:E(({index:e})=>[u(`div`,null,[e===0&&N.value.loadingHistory?(v(),l(`div`,me,[f(p,{size:`small`})])):c(`v-if`,!0),f(q,{msg:z.value[e],previous:z.value[e-1],"self-avatar":n.selfAvatar,"self-name":n.selfName,"show-timestamp":N.value.showTimestamp,onImagePreview:t[1]||=e=>M(`image-preview`,e),onFileClick:t[2]||=e=>M(`file-click`,e),onResend:t[3]||=e=>M(`resend`,e)},null,8,[`msg`,`previous`,`self-avatar`,`self-name`,`show-timestamp`])])]),_:1},8,[`items`,`onScroll`,`onWheel`,`onPointerdown`,`onKeydown`])):(v(),l(`div`,{key:1,ref_key:`messagesRef`,ref:I,class:`c-chat__messages`,onScroll:t[7]||=(...e)=>w(X)&&w(X)(...e),onWheel:t[8]||=(...e)=>w(Z)&&w(Z)(...e),onPointerdown:t[9]||=(...e)=>w(Z)&&w(Z)(...e),onKeydown:t[10]||=(...e)=>w(Z)&&w(Z)(...e)},[u(`div`,he,[N.value.loadingHistory?(v(),l(`div`,ge,[f(p,{size:`small`})])):c(`v-if`,!0),!z.value.length&&!N.value.loadingHistory?(v(),l(`div`,_e,C(w(h)(`chat.empty`)),1)):c(`v-if`,!0),(v(!0),l(a,null,b(z.value,(e,r)=>(v(),s(q,{key:e.id,msg:e,previous:z.value[r-1],"self-avatar":n.selfAvatar,"self-name":n.selfName,"show-timestamp":N.value.showTimestamp,onImagePreview:t[4]||=e=>M(`image-preview`,e),onFileClick:t[5]||=e=>M(`file-click`,e),onResend:t[6]||=e=>M(`resend`,e)},null,8,[`msg`,`previous`,`self-avatar`,`self-name`,`show-timestamp`]))),128))])],544)),c(` 输入区域 `),u(`div`,ve,[u(`div`,ye,[x(e.$slots,`input-actions`,{},()=>[f(m,{quaternary:``,circle:``,size:`small`,"aria-label":w(h)(`chat.emoji`),onClick:t[11]||=e=>M(`emoji-click`)},{icon:E(()=>[f(r,{name:`mdi:emoticon-happy-outline`,size:18})]),_:1},8,[`aria-label`]),f(m,{quaternary:``,circle:``,size:`small`,"aria-label":w(h)(`chat.attach`),onClick:t[12]||=e=>M(`file-upload`)},{icon:E(()=>[f(r,{name:`mdi:paperclip`,size:18})]),_:1},8,[`aria-label`])],!0)]),u(`div`,be,[f(o,{value:P.value,"onUpdate:value":t[13]||=e=>P.value=e,placeholder:N.value.placeholder,type:`textarea`,autosize:{minRows:1,maxRows:4},onKeydown:D(O(J,[`exact`]),[`enter`])},null,8,[`value`,`placeholder`,`onKeydown`])]),N.value.showSendBtn?(v(),s(m,{key:0,type:`primary`,disabled:!P.value.trim(),class:`c-chat__send-btn`,"aria-label":w(h)(`chat.send`),onClick:J},{icon:E(()=>[f(r,{name:`mdi:send`,size:16})]),_:1},8,[`disabled`,`aria-label`])):c(`v-if`,!0)])])):(v(),l(a,{key:2},[c(` ===== 未选中联系人空态 ===== `),u(`div`,xe,[f(r,{name:`mdi:chat-processing-outline`,size:48,class:`c-chat__no-chat-icon`}),u(`span`,null,C(w(h)(`chat.choose`)),1)])],2112))],4)}}}),[[`__scopeId`,`data-v-86049762`]]);export{$ as n,Se as t};
1
+ import{t as e}from"./useComponentLocale.js";import{n as t}from"./useComponentTheme.js";import{t as n}from"./export-helper.js";import{t as r}from"./C_Icon2.js";import{t as i}from"./useScopedComponentLocale.js";import{t as a}from"./virtualList.js";import{Fragment as o,computed as s,createBlock as c,createCommentVNode as l,createElementBlock as u,createElementVNode as d,createSlots as f,createTextVNode as p,createVNode as m,defineComponent as h,guardReactiveProps as g,mergeProps as _,nextTick as v,normalizeClass as y,normalizeProps as b,normalizeStyle as x,onBeforeUnmount as S,openBlock as C,ref as w,renderList as T,renderSlot as E,resolveComponent as D,toDisplayString as O,unref as k,watch as A,withCtx as j,withKeys as ee,withModifiers as te}from"vue";import{NButton as M,NInput as N,NSpin as P}from"naive-ui";const F={"chat.activities":`执行记录({count})`,"chat.activity.pending":`等待中`,"chat.activity.running":`进行中`,"chat.activity.succeeded":`已完成`,"chat.activity.failed":`失败`,"chat.sources":`引用来源({count})`},I={"chat.activities":`Execution steps ({count})`,"chat.activity.pending":`Pending`,"chat.activity.running":`Running`,"chat.activity.succeeded":`Completed`,"chat.activity.failed":`Failed`,"chat.sources":`Sources ({count})`},L={class:`c-chat-extras`},R={key:0},z={class:`c-chat-extras__items`},B=[`data-status`],V={key:0},H={key:1},U={class:`c-chat-extras__items`},W=[`onClick`],G={key:0};var K=n(h({__name:`ChatMessageExtras`,props:{activities:{},sources:{}},emits:[`source-click`],setup(e,{emit:t}){let n=t,{t:r}=i(F,I);return(t,i)=>(C(),u(`div`,L,[e.activities?.length?(C(),u(`details`,R,[d(`summary`,null,O(k(r)(`chat.activities`,{count:e.activities.length})),1),d(`ol`,z,[(C(!0),u(o,null,T(e.activities,e=>(C(),u(`li`,{key:e.id,class:`c-chat-extras__step`},[d(`span`,null,O(e.title),1),d(`span`,{class:`c-chat-extras__state`,"data-status":e.status},O(k(r)(`chat.activity.${e.status}`)),9,B),e.detail?(C(),u(`small`,V,O(e.detail),1)):l(`v-if`,!0)]))),128))])])):l(`v-if`,!0),e.sources?.length?(C(),u(`details`,H,[d(`summary`,null,O(k(r)(`chat.sources`,{count:e.sources.length})),1),d(`ul`,U,[(C(!0),u(o,null,T(e.sources,e=>(C(),u(`li`,{key:e.id},[d(`button`,{type:`button`,onClick:t=>n(`source-click`,e)},O(e.label),9,W),e.description?(C(),u(`small`,G,O(e.description),1)):l(`v-if`,!0)]))),128))])])):l(`v-if`,!0)]))}}),[[`__scopeId`,`data-v-dd33065d`]]);const q=[`data-message-id`],J={key:0,class:`c-chat__time-divider`},Y={key:0,class:`c-chat__msg-avatar`},X=[`src`],Z={key:1,class:`c-chat__avatar-fallback`},Q={class:`c-chat__msg-body`},ne={key:0,class:`c-chat__msg-username`},re={key:0,class:`c-chat__bubble`},ie=[`aria-label`],ae=[`src`,`alt`],oe={class:`c-chat__file-info`},se={class:`c-chat__file-name`},ce={key:0,class:`c-chat__file-size`},le={key:2,class:`c-chat__msg-time`},ue={key:4,class:`c-chat__msg-status is-sending`};var de=n(h({__name:`ChatMessageItem`,props:{msg:{},previous:{},selfAvatar:{},selfName:{},showTimestamp:{type:Boolean}},emits:[`image-preview`,`file-click`,`resend`,`source-click`],setup(t,{emit:n}){let{t:i}=e(),a=t,f=n,p=s(()=>!a.previous||new Date(a.msg.timestamp).getTime()-new Date(a.previous.timestamp).getTime()>3e5),h=e=>e.sender===`self`&&a.selfAvatar||e.avatar,g=e=>e.sender===`self`?a.selfName||e.username||i(`chat.self`):e.username||i(`common.unknown`);function _(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function v(e){let t=new Date(e),n=new Date;return t.toDateString()===n.toDateString()?_(e):`${t.getMonth()+1}/${t.getDate()} ${_(e)}`}function b(e){return e<1024?`${e}B`:e<1048576?`${(e/1024).toFixed(1)}KB`:`${(e/1048576).toFixed(1)}MB`}return(e,n)=>(C(),u(`div`,{class:`c-chat__message-row`,"data-message-id":t.msg.id},[l(` 时间分割 `),p.value?(C(),u(`div`,J,O(v(t.msg.timestamp)),1)):l(`v-if`,!0),l(` 消息条目 `),d(`div`,{class:y([`c-chat__msg`,`is-${t.msg.sender}`])},[l(` 头像 `),t.msg.sender===`system`?l(`v-if`,!0):(C(),u(`div`,Y,[h(t.msg)?(C(),u(`img`,{key:0,src:h(t.msg),class:`c-chat__avatar`},null,8,X)):(C(),u(`div`,Z,O(g(t.msg).charAt(0)),1))])),l(` 消息体 `),d(`div`,Q,[t.msg.sender===`other`&&t.msg.username?(C(),u(`span`,ne,O(t.msg.username),1)):l(`v-if`,!0),E(e.$slots,`message`,{message:t.msg},()=>[l(` 文本消息 `),t.msg.type===`text`||t.msg.type===`system`?(C(),u(`div`,re,O(t.msg.content),1)):t.msg.type===`image`?(C(),u(o,{key:1},[l(` 图片消息 `),d(`button`,{type:`button`,class:`c-chat__msg-image-button`,"aria-label":k(i)(`chat.imagePreview`,{name:t.msg.username||k(i)(`chat.title`)}),onClick:n[0]||=e=>f(`image-preview`,t.msg.content)},[d(`img`,{src:t.msg.content,alt:t.msg.fileName||k(i)(`chat.image`),class:`c-chat__msg-image`},null,8,ae)],8,ie)],2112)):t.msg.type===`file`?(C(),u(o,{key:2},[l(` 文件消息 `),d(`button`,{type:`button`,class:`c-chat__msg-file`,onClick:n[1]||=e=>f(`file-click`,t.msg)},[m(r,{name:`mdi:file-document-outline`,size:28}),d(`div`,oe,[d(`span`,se,O(t.msg.fileName||k(i)(`chat.file`)),1),t.msg.fileSize?(C(),u(`span`,ce,O(b(t.msg.fileSize)),1)):l(`v-if`,!0)])])],2112)):l(`v-if`,!0)],!0),t.msg.activities?.length||t.msg.sources?.length?(C(),c(K,{key:1,activities:t.msg.activities,sources:t.msg.sources,onSourceClick:n[2]||=e=>f(`source-click`,e,t.msg)},null,8,[`activities`,`sources`])):l(`v-if`,!0),l(` 时间戳 `),t.showTimestamp&&t.msg.sender!==`system`?(C(),u(`span`,le,O(_(t.msg.timestamp)),1)):l(`v-if`,!0),l(` 发送状态 `),t.msg.sender===`self`&&t.msg.status===`failed`?(C(),u(`button`,{key:3,type:`button`,class:`c-chat__msg-status is-failed`,onClick:n[3]||=e=>f(`resend`,t.msg)},O(k(i)(`chat.failed`)),1)):t.msg.sender===`self`&&t.msg.status===`sending`?(C(),u(`span`,ue,O(k(i)(`chat.sending`)),1)):l(`v-if`,!0)])],2)],8,q))}}),[[`__scopeId`,`data-v-d502dc05`]]);const fe=[`data-contact-id`],pe={class:`c-chat__contact-avatar`},me=[`src`,`alt`],he={key:1,class:`c-chat__avatar-fallback`},ge={key:2,class:`c-chat__online-dot`},_e={class:`c-chat__contact-info`},ve={class:`c-chat__contact-name`},ye={key:0,class:`c-chat__contact-time`},be={key:0,class:`c-chat__contact-last`},xe={key:0,class:`c-chat__unread`};var Se=n(h({__name:`ChatContactItem`,props:{contact:{},active:{type:Boolean}},emits:[`select`],setup(t,{emit:n}){let{t:r}=e(),i=n;function a(e){let t=new Date(e),n=Date.now()-t.getTime();if(n<6e4)return r(`time.now`);if(n<36e5)return r(`time.minutes`,{count:Math.floor(n/6e4)});let i=`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`;return n<864e5?i:`${t.getMonth()+1}/${t.getDate()} ${i}`}return(e,n)=>(C(),u(`button`,{type:`button`,class:y([`c-chat__contact`,{"is-active":t.active}]),"data-contact-id":t.contact.id,onClick:n[0]||=e=>i(`select`,t.contact.id)},[d(`div`,pe,[t.contact.avatar?(C(),u(`img`,{key:0,src:t.contact.avatar,alt:t.contact.name,class:`c-chat__avatar`},null,8,me)):(C(),u(`div`,he,O(t.contact.name.charAt(0)),1)),t.contact.online?(C(),u(`span`,ge)):l(`v-if`,!0)]),d(`div`,_e,[d(`div`,ve,[d(`span`,null,O(t.contact.name),1),t.contact.lastTime?(C(),u(`span`,ye,O(a(t.contact.lastTime)),1)):l(`v-if`,!0)]),t.contact.lastMessage?(C(),u(`div`,be,O(t.contact.lastMessage),1)):l(`v-if`,!0)]),t.contact.unread?(C(),u(`span`,xe,O(t.contact.unread>99?`99+`:t.contact.unread),1)):l(`v-if`,!0)],10,fe))}}),[[`__scopeId`,`data-v-1781627b`]]);function Ce(e){let t=!1,n=0,r,i,a,o=!0,s=!1,c=!1,l=0,u=0,d,f=()=>e.virtualRef.value?.listElRef??e.normalRef.value,p=e=>e.scrollHeight-e.scrollTop-e.clientHeight<=64,m=e=>Array.from(e.querySelectorAll(`[data-message-id]`));function h(){r!==void 0&&cancelAnimationFrame(r),r=void 0}function g(e,i){if(h(),typeof requestAnimationFrame>`u`){i();return}r=requestAnimationFrame(()=>{r=void 0,!t&&e===n&&i()})}function _(e){let r=++n;h(),v(()=>{!t&&r===n&&e(r)})}function y(t){let n=e.virtualRef.value;n?n.scrollTo({top:t,debounce:!1}):e.normalRef.value&&(e.normalRef.value.scrollTop=t)}function b(){let t=e.virtualRef.value;t?t.scrollTo({position:`bottom`}):e.normalRef.value&&(e.normalRef.value.scrollTop=e.normalRef.value.scrollHeight)}function x(){o=!0,c=!1,s=!0,d=void 0,_(e=>{b(),g(e,()=>{b(),s=!1})})}function C(e){let{top:t}=e.getBoundingClientRect(),n=m(e).find(e=>e.getBoundingClientRect().bottom>t);return n?.dataset.messageId?{id:n.dataset.messageId,offset:n.getBoundingClientRect().top-t}:void 0}function w(e,t){let n=f();if(!n||!d)return;let r=m(n).find(e=>e.dataset.messageId===d?.id);if(r){let e=r.getBoundingClientRect().top-n.getBoundingClientRect().top;y(Math.max(0,n.scrollTop+e-d.offset))}t>0?g(e,()=>w(e,t-1)):d=void 0}function T(t){d=t,o=!1,s=!1,_(n=>{e.virtualRef.value?.scrollTo({key:t.id,debounce:!1}),w(n,3)})}function E(e,t){o=!1,s=!1,d=void 0,_(()=>{let n=f();n&&y(Math.max(0,e+n.scrollHeight-t))})}function D(){o=!1,s=!1,n++,h()}function O(){c=!0,d=void 0,D(),i!==void 0&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>{if(i=void 0,t||!c)return;c=!1;let e=f();e&&!d&&(o=p(e))})}function k(e){return l>0&&(l!==e.scrollHeight||u!==e.clientHeight)}function j(e){let t=k(e);if(l=e.scrollHeight,u=e.clientHeight,!(s||d)){if(o&&t&&!c){x();return}c=!1,o=p(e)}}function ee(){let t=f();t&&(j(t),t.scrollTop===0&&!e.loadingHistory.value&&e.onLoadMore())}function te(){if(!t)if(d){let e=n;g(e,()=>w(e,1))}else o&&x()}A(()=>e.virtualRef.value?.itemsElRef??e.normalRef.value?.firstElementChild,e=>{if(a?.disconnect(),a=void 0,e&&typeof ResizeObserver<`u`){a=new ResizeObserver(te),a.observe(e);let t=f();t&&t!==e&&a.observe(t)}},{flush:`post`});let M=()=>{let t=e.messages.value;return[e.contactId.value,t.length,t[0]?.id,t[t.length-1]?.id,t[t.length-1]?.content,e.loadingHistory.value,e.virtual.value]},N=(t,n)=>t[1]>n[1]&&n[1]>0&&t[2]!==n[2]&&(t[3]===n[3]||e.messages.value.some(e=>e.id===n[2])),P=(e,t)=>e[1]>0&&t[1]>0&&e[2]!==t[2]&&e[3]!==t[3];function F(e,t,n){let r=e[6]||t[6]?C(n):void 0;r?T(r):E(n.scrollTop,n.scrollHeight)}let I=(e,t,n)=>P(e,t)||t[1]===0||!c&&(p(n)||o&&k(n));function L(e,t,n){I(e,t,n)?x():F(e,t,n)}return A(M,(e,t)=>{let n=f();if(!t||e[0]!==t[0]||!n){x();return}N(e,t)||e[5]!==t[5]?F(e,t,n):e[6]===t[6]?I(e,t,n)?x():d||D():L(e,t,n)},{immediate:!0,flush:`pre`}),S(()=>{t=!0,n++,h(),i!==void 0&&cancelAnimationFrame(i),a?.disconnect()}),{scrollToBottom:x,handleMessagesScroll:ee,handleScrollIntent:O}}const $={placeholder:`输入消息...`,showContacts:!0,showTimestamp:!0,showSendBtn:!0,loadingHistory:!1,title:`聊天`},we={key:0,class:`c-chat__sidebar`},Te={class:`c-chat__sidebar-header`},Ee={class:`c-chat__search`},De={key:1,class:`c-chat__contact-list`},Oe={key:1,class:`c-chat__main`},ke={class:`c-chat__header`},Ae={key:0,class:`c-chat__header-status`},je={key:0,class:`c-chat__load-more`},Me={class:`c-chat__message-items`},Ne={key:0,class:`c-chat__load-more`},Pe={key:1,class:`c-chat__empty`},Fe={class:`c-chat__input-area`},Ie={class:`c-chat__input-actions`},Le={class:`c-chat__input-wrap`},Re={class:`c-chat__main c-chat__no-chat`};var ze=n(h({__name:`index`,props:{contacts:{default:()=>[]},messages:{default:()=>[]},currentContactId:{default:``},placeholder:{},showContacts:{type:Boolean,default:$.showContacts},showTimestamp:{type:Boolean,default:$.showTimestamp},selfAvatar:{default:``},selfName:{default:``},showSendBtn:{type:Boolean,default:$.showSendBtn},loadingHistory:{type:Boolean,default:$.loadingHistory},virtualScroll:{type:Boolean,default:!0},title:{}},emits:[`send`,`select-contact`,`load-more`,`image-preview`,`file-click`,`file-upload`,`emoji-click`,`resend`,`source-click`],setup(n,{expose:i,emit:h}){let{t:v}=e(),y=t(),S=n,D=h,F=s(()=>({...$,...S,placeholder:S.placeholder??v(`chat.placeholder`),title:S.title??v(`chat.title`)})),I=w(``),L=w(``),R=w(null),z=w(null),B=s(()=>S.contacts??[]),V=s(()=>S.messages??[]),H=s(()=>S.currentContactId||B.value[0]?.id||``),U=new Map;A(H,(e,t)=>{let n=I.value,r=U.get(e)??``;for(U.delete(e),U.delete(t),n&&(S.contacts?.some(e=>e.id===t)||!S.showContacts)&&U.set(t,n);U.size>50;)U.delete(U.keys().next().value);I.value=r},{flush:`sync`}),A(()=>S.contacts?.map(e=>e.id),e=>{if(!S.showContacts)return;let t=new Set(e);t.has(H.value)||(I.value=``);for(let e of U.keys())t.has(e)||U.delete(e)});let W=s(()=>B.value.find(e=>e.id===H.value)),G=s(()=>{if(!L.value)return B.value;let e=L.value.toLowerCase();return B.value.filter(t=>t.name.toLowerCase().includes(e))}),K=s(()=>S.virtualScroll&&V.value.length>=200),q=s(()=>S.virtualScroll&&G.value.length>=100),J=e=>{D(`select-contact`,e)},Y=e=>{if(e instanceof KeyboardEvent&&(e.isComposing||e.keyCode===229))return;e?.preventDefault();let t=I.value.trim();t&&(D(`send`,t),I.value=``)},{scrollToBottom:X,handleMessagesScroll:Z,handleScrollIntent:Q}=Ce({messages:V,contactId:H,virtual:K,loadingHistory:s(()=>F.value.loadingHistory),normalRef:R,virtualRef:z,onLoadMore:()=>D(`load-more`)});return i({scrollToBottom:X}),(e,t)=>{let i=N,s=P,h=M;return C(),u(`div`,{class:`c-chat`,style:x(k(y))},[l(` ===== 联系人侧栏 ===== `),F.value.showContacts&&B.value.length?(C(),u(`aside`,we,[d(`div`,Te,[m(r,{name:`mdi:chat-outline`,size:20}),p(` `+O(k(v)(`chat.sessions`)),1)]),l(` 搜索框 `),d(`div`,Ee,[m(i,{value:L.value,"onUpdate:value":t[0]||=e=>L.value=e,placeholder:k(v)(`chat.search`),clearable:``,size:`small`},{prefix:j(()=>[m(r,{name:`mdi:magnify`,size:16})]),_:1},8,[`value`,`placeholder`])]),q.value?(C(),c(k(a),{key:0,class:`c-chat__contact-list`,items:G.value,"key-field":`id`,"item-size":56,"item-resizable":``},{default:j(({index:e})=>[m(Se,{contact:G.value[e],active:G.value[e].id===H.value,onSelect:J},null,8,[`contact`,`active`])]),_:1},8,[`items`])):(C(),u(`div`,De,[(C(!0),u(o,null,T(G.value,e=>(C(),c(Se,{key:e.id,contact:e,active:e.id===H.value,onSelect:J},null,8,[`contact`,`active`]))),128))]))])):l(`v-if`,!0),l(` ===== 主聊天区域 ===== `),W.value||!F.value.showContacts?(C(),u(`div`,Oe,[l(` 顶栏 `),d(`div`,ke,[E(e.$slots,`header`,{},()=>[d(`span`,null,O(W.value?.name||F.value.title),1),W.value?.online?(C(),u(`span`,Ae,O(k(v)(`chat.online`)),1)):l(`v-if`,!0)],!0)]),K.value?(C(),c(k(a),{key:H.value,ref_key:`virtualMessagesRef`,ref:z,class:`c-chat__messages c-chat__messages--virtual`,items:V.value,"key-field":`id`,"item-size":32,"item-resizable":``,"padding-top":16,"padding-bottom":16,"items-style":{paddingLeft:`20px`,paddingRight:`20px`},onScroll:k(Z),onWheel:k(Q),onPointerdown:k(Q),onKeydown:k(Q)},{default:j(({index:r})=>[d(`div`,null,[r===0&&F.value.loadingHistory?(C(),u(`div`,je,[m(s,{size:`small`})])):l(`v-if`,!0),m(de,{msg:V.value[r],previous:V.value[r-1],"self-avatar":n.selfAvatar,"self-name":n.selfName,"show-timestamp":F.value.showTimestamp,onImagePreview:t[1]||=e=>D(`image-preview`,e),onFileClick:t[2]||=e=>D(`file-click`,e),onResend:t[3]||=e=>D(`resend`,e),onSourceClick:t[4]||=(e,t)=>D(`source-click`,e,t)},f({_:2},[e.$slots.message?{name:`message`,fn:j(t=>[E(e.$slots,`message`,b(g(t)),void 0,!0)]),key:`0`}:void 0]),1032,[`msg`,`previous`,`self-avatar`,`self-name`,`show-timestamp`])])]),_:3},8,[`items`,`onScroll`,`onWheel`,`onPointerdown`,`onKeydown`])):(C(),u(`div`,{key:1,ref_key:`messagesRef`,ref:R,class:`c-chat__messages`,onScroll:t[9]||=(...e)=>k(Z)&&k(Z)(...e),onWheel:t[10]||=(...e)=>k(Q)&&k(Q)(...e),onPointerdown:t[11]||=(...e)=>k(Q)&&k(Q)(...e),onKeydown:t[12]||=(...e)=>k(Q)&&k(Q)(...e)},[d(`div`,Me,[F.value.loadingHistory?(C(),u(`div`,Ne,[m(s,{size:`small`})])):l(`v-if`,!0),!V.value.length&&!F.value.loadingHistory?(C(),u(`div`,Pe,O(k(v)(`chat.empty`)),1)):l(`v-if`,!0),(C(!0),u(o,null,T(V.value,(r,i)=>(C(),c(de,{key:r.id,msg:r,previous:V.value[i-1],"self-avatar":n.selfAvatar,"self-name":n.selfName,"show-timestamp":F.value.showTimestamp,onImagePreview:t[5]||=e=>D(`image-preview`,e),onFileClick:t[6]||=e=>D(`file-click`,e),onResend:t[7]||=e=>D(`resend`,e),onSourceClick:t[8]||=(e,t)=>D(`source-click`,e,t)},f({_:2},[e.$slots.message?{name:`message`,fn:j(t=>[E(e.$slots,`message`,_({ref_for:!0},t),void 0,!0)]),key:`0`}:void 0]),1032,[`msg`,`previous`,`self-avatar`,`self-name`,`show-timestamp`]))),128))])],544)),l(` 输入区域 `),d(`div`,Fe,[d(`div`,Ie,[E(e.$slots,`input-actions`,{},()=>[m(h,{quaternary:``,circle:``,size:`small`,"aria-label":k(v)(`chat.emoji`),onClick:t[13]||=e=>D(`emoji-click`)},{icon:j(()=>[m(r,{name:`mdi:emoticon-happy-outline`,size:18})]),_:1},8,[`aria-label`]),m(h,{quaternary:``,circle:``,size:`small`,"aria-label":k(v)(`chat.attach`),onClick:t[14]||=e=>D(`file-upload`)},{icon:j(()=>[m(r,{name:`mdi:paperclip`,size:18})]),_:1},8,[`aria-label`])],!0)]),d(`div`,Le,[m(i,{value:I.value,"onUpdate:value":t[15]||=e=>I.value=e,placeholder:F.value.placeholder,type:`textarea`,autosize:{minRows:1,maxRows:4},onKeydown:ee(te(Y,[`exact`]),[`enter`])},null,8,[`value`,`placeholder`,`onKeydown`])]),F.value.showSendBtn?(C(),c(h,{key:0,type:`primary`,disabled:!I.value.trim(),class:`c-chat__send-btn`,"aria-label":k(v)(`chat.send`),onClick:Y},{icon:j(()=>[m(r,{name:`mdi:send`,size:16})]),_:1},8,[`disabled`,`aria-label`])):l(`v-if`,!0)])])):(C(),u(o,{key:2},[l(` ===== 未选中联系人空态 ===== `),d(`div`,Re,[m(r,{name:`mdi:chat-processing-outline`,size:48,class:`c-chat__no-chat-icon`}),d(`span`,null,O(k(v)(`chat.choose`)),1)])],2112))],4)}}}),[[`__scopeId`,`data-v-27157b1a`]]);export{$ as n,ze as t};
package/dist/C_City.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { t as _default } from "./index10.vue.cjs";
1
+ import { t as _default } from "./index13.vue.cjs";
2
2
  export { _default as C_City };
package/dist/C_City.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { t as _default } from "./index9.vue.js";
1
+ import { t as _default } from "./index12.vue.js";
2
2
  export { _default as C_City };