cnhis-design-vue 3.2.3-beta.26 → 3.2.3-beta.28

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 (263) hide show
  1. package/README.md +87 -87
  2. package/es/components/biunique-chat/index.d.ts +3 -1
  3. package/es/components/biunique-chat/src/Index.vue.d.ts +3 -1
  4. package/es/components/biunique-chat/src/Index.vue2.js +1 -1
  5. package/es/components/biunique-chat/src/components/ChatFooter.vue2.js +1 -1
  6. package/es/components/biunique-chat/src/components/ChatSearch.vue.d.ts +2 -2
  7. package/es/components/biunique-chat/src/components/ChatSearch.vue2.js +1 -1
  8. package/es/components/biunique-chat/src/components/ChatSet.vue2.js +1 -1
  9. package/es/components/biunique-chat/src/components/MessageTemplate.vue2.js +1 -1
  10. package/es/components/biunique-chat/src/components/SiderList.vue.d.ts +1 -1
  11. package/es/components/biunique-chat/src/components/SiderList.vue2.js +1 -1
  12. package/es/components/biunique-chat/src/hooks/useSession.d.ts +1 -0
  13. package/es/components/biunique-chat/src/hooks/useSession.js +1 -1
  14. package/es/components/biunique-chat/src/utils/emoji.js +1 -1
  15. package/es/components/biunique-chat/style/index.css +1 -1
  16. package/es/components/button-print/index.d.ts +13 -0
  17. package/es/components/button-print/src/ButtonPrint.vue.d.ts +13 -0
  18. package/es/components/button-print/src/ButtonPrint.vue2.js +1 -1
  19. package/es/components/button-print/src/utils/print.d.ts +2 -2
  20. package/es/components/button-print/src/utils/print.js +1 -1
  21. package/es/components/classification/src/index.vue.d.ts +0 -3
  22. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +1 -1
  23. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcessChart.js +1 -1
  24. package/es/components/fabric-chart/src/hooks/electrocardiogram/hooks/useDetailEvent.js +1 -1
  25. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogram.js +1 -1
  26. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogramChart.js +1 -1
  27. package/es/components/fabric-chart/src/hooks/electrocardiogram/useMeasureInstrument.js +1 -1
  28. package/es/components/fabric-chart/src/hooks/newBirthProcess/useNewBirthProcess.js +1 -1
  29. package/es/components/fabric-chart/src/hooks/newBirthProcess/useNewBirthProcessChart.js +1 -1
  30. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
  31. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useLeft.js +1 -1
  32. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.js +1 -1
  33. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
  34. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
  35. package/es/components/fabric-chart/src/hooks/temperature/useBottom.js +1 -1
  36. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  37. package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +1 -1
  38. package/es/components/fabric-chart/src/hooks/temperature/useOther.js +1 -1
  39. package/es/components/fabric-chart/src/hooks/temperature/useTop.js +1 -1
  40. package/es/components/fabric-chart/src/utils/index.js +1 -1
  41. package/es/components/field-set/src/FieldColor.vue.d.ts +1 -1
  42. package/es/components/field-set/src/FieldSet.vue.d.ts +1 -1
  43. package/es/components/field-set/src/components/Row.vue.d.ts +1 -1
  44. package/es/components/index.css +1 -1
  45. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  46. package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
  47. package/es/components/select-person/src/SearchMultiple.vue.d.ts +6 -0
  48. package/es/shared/assets/img/emoji/emotion_001.png.js +1 -1
  49. package/es/shared/assets/img/emoji/emotion_002.png.js +1 -1
  50. package/es/shared/assets/img/emoji/emotion_003.png.js +1 -1
  51. package/es/shared/assets/img/emoji/emotion_004.png.js +1 -1
  52. package/es/shared/assets/img/emoji/emotion_005.png.js +1 -1
  53. package/es/shared/assets/img/emoji/emotion_006.png.js +1 -1
  54. package/es/shared/assets/img/emoji/emotion_007.png.js +1 -1
  55. package/es/shared/assets/img/emoji/emotion_008.png.js +1 -1
  56. package/es/shared/assets/img/emoji/emotion_009.png.js +1 -1
  57. package/es/shared/assets/img/emoji/emotion_010.png.js +1 -1
  58. package/es/shared/assets/img/emoji/emotion_011.png.js +1 -1
  59. package/es/shared/assets/img/emoji/emotion_012.png.js +1 -1
  60. package/es/shared/assets/img/emoji/emotion_013.png.js +1 -1
  61. package/es/shared/assets/img/emoji/emotion_014.png.js +1 -1
  62. package/es/shared/assets/img/emoji/emotion_015.png.js +1 -1
  63. package/es/shared/assets/img/emoji/emotion_016.png.js +1 -1
  64. package/es/shared/assets/img/emoji/emotion_017.png.js +1 -1
  65. package/es/shared/assets/img/emoji/emotion_018.png.js +1 -1
  66. package/es/shared/assets/img/emoji/emotion_019.png.js +1 -1
  67. package/es/shared/assets/img/emoji/emotion_020.png.js +1 -1
  68. package/es/shared/assets/img/emoji/emotion_021.png.js +1 -1
  69. package/es/shared/assets/img/emoji/emotion_022.png.js +1 -1
  70. package/es/shared/assets/img/emoji/emotion_023.png.js +1 -1
  71. package/es/shared/assets/img/emoji/emotion_024.png.js +1 -1
  72. package/es/shared/assets/img/emoji/emotion_025.png.js +1 -1
  73. package/es/shared/assets/img/emoji/emotion_026.png.js +1 -1
  74. package/es/shared/assets/img/emoji/emotion_027.png.js +1 -1
  75. package/es/shared/assets/img/emoji/emotion_028.png.js +1 -1
  76. package/es/shared/assets/img/emoji/emotion_029.png.js +1 -1
  77. package/es/shared/assets/img/emoji/emotion_030.png.js +1 -1
  78. package/es/shared/assets/img/emoji/emotion_031.png.js +1 -1
  79. package/es/shared/assets/img/emoji/emotion_032.png.js +1 -1
  80. package/es/shared/assets/img/emoji/emotion_033.png.js +1 -1
  81. package/es/shared/assets/img/emoji/emotion_034.png.js +1 -1
  82. package/es/shared/assets/img/emoji/emotion_035.png.js +1 -1
  83. package/es/shared/assets/img/emoji/emotion_036.png.js +1 -1
  84. package/es/shared/assets/img/emoji/emotion_037.png.js +1 -1
  85. package/es/shared/assets/img/emoji/emotion_038.png.js +1 -1
  86. package/es/shared/assets/img/emoji/emotion_039.png.js +1 -1
  87. package/es/shared/assets/img/emoji/emotion_040.png.js +1 -1
  88. package/es/shared/assets/img/emoji/emotion_041.png.js +1 -1
  89. package/es/shared/assets/img/emoji/emotion_042.png.js +1 -1
  90. package/es/shared/assets/img/emoji/emotion_043.png.js +1 -1
  91. package/es/shared/assets/img/emoji/emotion_044.png.js +1 -1
  92. package/es/shared/assets/img/emoji/emotion_045.png.js +1 -1
  93. package/es/shared/assets/img/emoji/emotion_046.png.js +1 -1
  94. package/es/shared/assets/img/emoji/emotion_047.png.js +1 -1
  95. package/es/shared/assets/img/emoji/emotion_048.png.js +1 -1
  96. package/es/shared/assets/img/emoji/emotion_049.png.js +1 -1
  97. package/es/shared/assets/img/emoji/emotion_050.png.js +1 -1
  98. package/es/shared/assets/img/emoji/emotion_051.png.js +1 -1
  99. package/es/shared/assets/img/emoji/emotion_052.png.js +1 -1
  100. package/es/shared/assets/img/emoji/emotion_053.png.js +1 -1
  101. package/es/shared/assets/img/emoji/emotion_054.png.js +1 -1
  102. package/es/shared/assets/img/emoji/emotion_055.png.js +1 -1
  103. package/es/shared/assets/img/emoji/emotion_056.png.js +1 -1
  104. package/es/shared/assets/img/emoji/emotion_057.png.js +1 -1
  105. package/es/shared/assets/img/emoji/emotion_058.png.js +1 -1
  106. package/es/shared/assets/img/emoji/emotion_059.png.js +1 -1
  107. package/es/shared/assets/img/emoji/emotion_060.png.js +1 -1
  108. package/es/shared/assets/img/emoji/emotion_061.png.js +1 -1
  109. package/es/shared/assets/img/emoji/emotion_062.png.js +1 -1
  110. package/es/shared/assets/img/emoji/emotion_063.png.js +1 -1
  111. package/es/shared/assets/img/emoji/emotion_064.png.js +1 -1
  112. package/es/shared/assets/img/emoji/emotion_065.png.js +1 -1
  113. package/es/shared/assets/img/emoji/emotion_066.png.js +1 -1
  114. package/es/shared/assets/img/emoji/emotion_067.png.js +1 -1
  115. package/es/shared/assets/img/emoji/emotion_068.png.js +1 -1
  116. package/es/shared/assets/img/emoji/emotion_069.png.js +1 -1
  117. package/es/shared/assets/img/emoji/emotion_070.png.js +1 -1
  118. package/es/shared/assets/img/emoji/emotion_071.png.js +1 -1
  119. package/es/shared/assets/img/emoji/emotion_072.png.js +1 -1
  120. package/es/shared/assets/img/emoji/emotion_073.png.js +1 -1
  121. package/es/shared/assets/img/emoji/emotion_074.png.js +1 -1
  122. package/es/shared/assets/img/emoji/emotion_075.png.js +1 -1
  123. package/es/shared/assets/img/emoji/emotion_076.png.js +1 -1
  124. package/es/shared/assets/img/emoji/emotion_077.png.js +1 -1
  125. package/es/shared/assets/img/emoji/emotion_078.png.js +1 -1
  126. package/es/shared/assets/img/emoji/emotion_079.png.js +1 -1
  127. package/es/shared/assets/img/emoji/emotion_080.png.js +1 -1
  128. package/es/shared/assets/img/emoji/emotion_081.png.js +1 -1
  129. package/es/shared/assets/img/emoji/emotion_082.png.js +1 -1
  130. package/es/shared/assets/img/emoji/emotion_083.png.js +1 -1
  131. package/es/shared/assets/img/emoji/emotion_084.png.js +1 -1
  132. package/es/shared/assets/img/emoji/emotion_085.png.js +1 -1
  133. package/es/shared/assets/img/emoji/emotion_086.png.js +1 -1
  134. package/es/shared/assets/img/emoji/emotion_087.png.js +1 -1
  135. package/es/shared/assets/img/emoji/emotion_088.png.js +1 -1
  136. package/es/shared/assets/img/emoji/emotion_089.png.js +1 -1
  137. package/es/shared/assets/img/emoji/emotion_090.png.js +1 -1
  138. package/es/shared/assets/img/emoji/emotion_091.png.js +1 -1
  139. package/es/shared/assets/img/emoji/emotion_092.png.js +1 -1
  140. package/es/shared/assets/img/emoji/emotion_093.png.js +1 -1
  141. package/es/shared/assets/img/emoji/emotion_094.png.js +1 -1
  142. package/es/shared/assets/img/emoji/emotion_095.png.js +1 -1
  143. package/es/shared/assets/img/emoji/emotion_096.png.js +1 -1
  144. package/es/shared/assets/img/emoji/emotion_097.png.js +1 -1
  145. package/es/shared/assets/img/emoji/emotion_098.png.js +1 -1
  146. package/es/shared/assets/img/emoji/emotion_099.png.js +1 -1
  147. package/es/shared/assets/img/emoji/emotion_100.png.js +1 -1
  148. package/es/shared/assets/img/emoji/emotion_101.png.js +1 -1
  149. package/es/shared/assets/img/emoji/emotion_102.png.js +1 -1
  150. package/es/shared/assets/img/emoji/emotion_103.png.js +1 -1
  151. package/es/shared/assets/img/emoji/emotion_104.png.js +1 -1
  152. package/es/shared/assets/img/emoji/emotion_105.png.js +1 -1
  153. package/es/shared/assets/img/emoji/emotion_106.png.js +1 -1
  154. package/es/shared/assets/img/emoji/emotion_107.png.js +1 -1
  155. package/es/shared/assets/img/emoji/emotion_108.png.js +1 -1
  156. package/es/shared/assets/img/emoji/emotion_109.png.js +1 -1
  157. package/es/shared/assets/img/emoji/emotion_110.png.js +1 -1
  158. package/es/shared/assets/img/emoji/emotion_111.png.js +1 -1
  159. package/es/shared/assets/img/emoji/emotion_112.png.js +1 -1
  160. package/es/shared/assets/img/emoji/emotion_113.png.js +1 -1
  161. package/es/shared/assets/img/emoji/emotion_114.png.js +1 -1
  162. package/es/shared/assets/img/emoji/emotion_115.png.js +1 -1
  163. package/es/shared/assets/img/emoji/emotion_116.png.js +1 -1
  164. package/es/shared/assets/img/emoji/emotion_117.png.js +1 -1
  165. package/es/shared/assets/img/emoji/emotion_118.png.js +1 -1
  166. package/es/shared/assets/img/emoji/emotion_119.png.js +1 -1
  167. package/es/shared/assets/img/emoji/emotion_120.png.js +1 -1
  168. package/es/shared/assets/img/emoji/emotion_121.png.js +1 -1
  169. package/es/shared/assets/img/emoji/emotion_122.png.js +1 -1
  170. package/es/shared/assets/img/emoji/emotion_123.png.js +1 -1
  171. package/es/shared/assets/img/emoji/emotion_124.png.js +1 -1
  172. package/es/shared/assets/img/emoji/emotion_125.png.js +1 -1
  173. package/es/shared/assets/img/emoji/emotion_126.png.js +1 -1
  174. package/es/shared/assets/img/emoji/emotion_127.png.js +1 -1
  175. package/es/shared/assets/img/emoji/emotion_128.png.js +1 -1
  176. package/es/shared/assets/img/emoji/emotion_129.png.js +1 -1
  177. package/es/shared/assets/img/emoji/emotion_130.png.js +1 -1
  178. package/es/shared/assets/img/emoji/emotion_131.png.js +1 -1
  179. package/es/shared/assets/img/emoji/emotion_132.png.js +1 -1
  180. package/es/shared/assets/img/emoji/emotion_133.png.js +1 -1
  181. package/es/shared/assets/img/emoji/emotion_134.png.js +1 -1
  182. package/es/shared/assets/img/emoji/emotion_135.png.js +1 -1
  183. package/es/shared/assets/img/emoji/emotion_136.png.js +1 -1
  184. package/es/shared/assets/img/emoji/emotion_137.png.js +1 -1
  185. package/es/shared/assets/img/emoji/emotion_138.png.js +1 -1
  186. package/es/shared/assets/img/emoji/emotion_139.png.js +1 -1
  187. package/es/shared/assets/img/emoji/emotion_140.png.js +1 -1
  188. package/es/shared/assets/img/emoji/emotion_141.png.js +1 -1
  189. package/es/shared/assets/img/emoji/emotion_142.png.js +1 -1
  190. package/es/shared/assets/img/emoji/emotion_143.png.js +1 -1
  191. package/es/shared/assets/img/emoji/emotion_144.png.js +1 -1
  192. package/es/shared/assets/img/emoji/emotion_145.png.js +1 -1
  193. package/es/shared/assets/img/emoji/emotion_146.png.js +1 -1
  194. package/es/shared/assets/img/emoji/emotion_147.png.js +1 -1
  195. package/es/shared/assets/img/emoji/emotion_148.png.js +1 -1
  196. package/es/shared/assets/img/emoji/emotion_149.png.js +1 -1
  197. package/es/shared/assets/img/emoji/emotion_150.png.js +1 -1
  198. package/es/shared/assets/img/emoji/emotion_151.png.js +1 -1
  199. package/es/shared/assets/img/emoji/emotion_152.png.js +1 -1
  200. package/es/shared/assets/img/emoji/emotion_153.png.js +1 -1
  201. package/es/shared/assets/img/emoji/emotion_154.png.js +1 -1
  202. package/es/shared/assets/img/emoji/emotion_155.png.js +1 -1
  203. package/es/shared/assets/img/emoji/emotion_156.png.js +1 -1
  204. package/es/shared/assets/img/emoji/emotion_157.png.js +1 -1
  205. package/es/shared/assets/img/emoji/emotion_158.png.js +1 -1
  206. package/es/shared/assets/img/emoji/emotion_159.png.js +1 -1
  207. package/es/shared/assets/img/emoji/emotion_160.png.js +1 -1
  208. package/es/shared/assets/img/emoji/emotion_161.png.js +1 -1
  209. package/es/shared/assets/img/emoji/emotion_162.png.js +1 -1
  210. package/es/shared/assets/img/emoji/emotion_163.png.js +1 -1
  211. package/es/shared/assets/img/emoji/emotion_164.png.js +1 -1
  212. package/es/shared/assets/img/emoji/emotion_165.png.js +1 -1
  213. package/es/shared/assets/img/emoji/emotion_166.png.js +1 -1
  214. package/es/shared/assets/img/emoji/emotion_167.png.js +1 -1
  215. package/es/shared/assets/img/failure.png.js +1 -1
  216. package/es/shared/assets/img/no-permission.png.js +1 -1
  217. package/es/shared/assets/img/nodata.png.js +1 -1
  218. package/es/shared/assets/img/notfound.png.js +1 -1
  219. package/es/shared/assets/img/qr.png.js +1 -1
  220. package/es/shared/assets/img/success.png.js +1 -1
  221. package/es/shared/assets/img/table_style_2.png.js +1 -1
  222. package/es/shared/assets/img/video.png.js +1 -1
  223. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  224. package/es/shared/assets/img/xb_big.png.js +1 -1
  225. package/es/shared/assets/img/xb_small.png.js +1 -1
  226. package/es/shared/package.json.js +1 -1
  227. package/package.json +2 -2
  228. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  229. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
  230. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
  231. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
  232. package/es/shared/assets/img/emoji/emotion_168.png.js +0 -1
  233. package/es/shared/assets/img/emoji/emotion_169.png.js +0 -1
  234. package/es/shared/assets/img/emoji/emotion_170.png.js +0 -1
  235. package/es/shared/assets/img/emoji/emotion_171.png.js +0 -1
  236. package/es/shared/assets/img/emoji/emotion_172.png.js +0 -1
  237. package/es/shared/assets/img/emoji/emotion_173.png.js +0 -1
  238. package/es/shared/assets/img/emoji/emotion_174.png.js +0 -1
  239. package/es/shared/assets/img/emoji/emotion_175.png.js +0 -1
  240. package/es/shared/assets/img/emoji/emotion_176.png.js +0 -1
  241. package/es/shared/assets/img/emoji/emotion_177.png.js +0 -1
  242. package/es/shared/assets/img/emoji/emotion_178.png.js +0 -1
  243. package/es/shared/assets/img/emoji/emotion_179.png.js +0 -1
  244. package/es/shared/assets/img/emoji/emotion_180.png.js +0 -1
  245. package/es/shared/assets/img/emoji/emotion_181.png.js +0 -1
  246. package/es/shared/assets/img/emoji/emotion_182.png.js +0 -1
  247. package/es/shared/assets/img/emoji/emotion_183.png.js +0 -1
  248. package/es/shared/assets/img/emoji/emotion_184.png.js +0 -1
  249. package/es/shared/assets/img/emoji/emotion_185.png.js +0 -1
  250. package/es/shared/assets/img/emoji/emotion_186.png.js +0 -1
  251. package/es/shared/assets/img/emoji/emotion_187.png.js +0 -1
  252. package/es/shared/assets/img/emoji/emotion_188.png.js +0 -1
  253. package/es/shared/assets/img/emoji/emotion_189.png.js +0 -1
  254. package/es/shared/assets/img/emoji/emotion_190.png.js +0 -1
  255. package/es/shared/assets/img/emoji/emotion_191.png.js +0 -1
  256. package/es/shared/assets/img/emoji/emotion_192.png.js +0 -1
  257. package/es/shared/assets/img/emoji/emotion_193.png.js +0 -1
  258. package/es/shared/assets/img/emoji/emotion_194.png.js +0 -1
  259. package/es/shared/assets/img/emoji/emotion_195.png.js +0 -1
  260. package/es/shared/assets/img/emoji/emotion_196.png.js +0 -1
  261. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
  262. package/es/shared/utils/fabricjs/index.d.ts +0 -6823
  263. package/es/shared/utils/tapable/index.d.ts +0 -139
package/README.md CHANGED
@@ -1,87 +1,87 @@
1
- # 安装
2
-
3
- ```shell
4
- npm i cnhis-design-vue@[版本号]
5
- # or
6
- yarn add cnhis-design-vue@[版本号] #推荐
7
- ```
8
-
9
- ## 1.全局引入
10
-
11
- ```typescript
12
- // main.ts
13
- import { createApp } from 'vue';
14
- import App from './App.vue';
15
- import 'cnhis-design-vue/es/packages/index.css';
16
- import cui from 'cnhis-design-vue';
17
-
18
- const app = createApp(App);
19
- app.use(cui).mount('#app');
20
- ```
21
-
22
- ## 2. 按需引入
23
-
24
- 组件现在支持了自动按需引入, 但是样式文件需要额外的处理
25
-
26
- ### 2.1 样式处理方式1 (按需引入样式)
27
-
28
- ```shell
29
- # 安装自动导入样式的插件
30
- npm i -d vite-plugin-style-import
31
- ```
32
-
33
- ```typescript
34
- // vite.config.ts
35
- import { defineConfig } from 'vite';
36
- import { createStyleImportPlugin } from 'vite-plugin-style-import';
37
-
38
- export default defineConfig({
39
- plugins: [
40
- // ...otherPlugins
41
- createStyleImportPlugin({
42
- libs: [
43
- {
44
- libraryName: 'cnhis-design-vue',
45
- esModule: true,
46
- ensureStyleFile: true,
47
- resolveStyle: name => {
48
- return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
49
- }
50
- }
51
- ]
52
- })
53
- ]
54
- });
55
- ```
56
-
57
- ### 2.2 样式处理方式2 (全局引入样式)
58
-
59
- ```typescript
60
- // main.ts
61
- import 'cnhis-design-vue/es/components/index.css';
62
- ```
63
-
64
- ## 3.FAQ
65
-
66
- ### 3.1 项目打包后样式丢失
67
-
68
- 处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
69
-
70
- ```typescript
71
- // vite.config.ts
72
- import { defineConfig } from 'vite';
73
-
74
- export default defineConfig({
75
- build: {
76
- rollupOptions: {
77
- // ..otherOptions
78
- output: {
79
- dir: './dist',
80
- manualChunks: {
81
- 'cnhis-vendor': ['cnhis-design-vue']
82
- }
83
- }
84
- }
85
- }
86
- });
87
- ```
1
+ # 安装
2
+
3
+ ```shell
4
+ npm i cnhis-design-vue@[版本号]
5
+ # or
6
+ yarn add cnhis-design-vue@[版本号] #推荐
7
+ ```
8
+
9
+ ## 1.全局引入
10
+
11
+ ```typescript
12
+ // main.ts
13
+ import { createApp } from 'vue';
14
+ import App from './App.vue';
15
+ import 'cnhis-design-vue/es/packages/index.css';
16
+ import cui from 'cnhis-design-vue';
17
+
18
+ const app = createApp(App);
19
+ app.use(cui).mount('#app');
20
+ ```
21
+
22
+ ## 2. 按需引入
23
+
24
+ 组件现在支持了自动按需引入, 但是样式文件需要额外的处理
25
+
26
+ ### 2.1 样式处理方式1 (按需引入样式)
27
+
28
+ ```shell
29
+ # 安装自动导入样式的插件
30
+ npm i -d vite-plugin-style-import
31
+ ```
32
+
33
+ ```typescript
34
+ // vite.config.ts
35
+ import { defineConfig } from 'vite';
36
+ import { createStyleImportPlugin } from 'vite-plugin-style-import';
37
+
38
+ export default defineConfig({
39
+ plugins: [
40
+ // ...otherPlugins
41
+ createStyleImportPlugin({
42
+ libs: [
43
+ {
44
+ libraryName: 'cnhis-design-vue',
45
+ esModule: true,
46
+ ensureStyleFile: true,
47
+ resolveStyle: name => {
48
+ return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
49
+ }
50
+ }
51
+ ]
52
+ })
53
+ ]
54
+ });
55
+ ```
56
+
57
+ ### 2.2 样式处理方式2 (全局引入样式)
58
+
59
+ ```typescript
60
+ // main.ts
61
+ import 'cnhis-design-vue/es/components/index.css';
62
+ ```
63
+
64
+ ## 3.FAQ
65
+
66
+ ### 3.1 项目打包后样式丢失
67
+
68
+ 处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
69
+
70
+ ```typescript
71
+ // vite.config.ts
72
+ import { defineConfig } from 'vite';
73
+
74
+ export default defineConfig({
75
+ build: {
76
+ rollupOptions: {
77
+ // ..otherOptions
78
+ output: {
79
+ dir: './dist',
80
+ manualChunks: {
81
+ 'cnhis-vendor': ['cnhis-design-vue']
82
+ }
83
+ }
84
+ }
85
+ }
86
+ });
87
+ ```
@@ -58,6 +58,7 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
58
58
  reConnention: number;
59
59
  entrySession: (item: import("../../shared/types").AnyObject) => void;
60
60
  setSessionList: (list: import("../../shared/types").AnyObject[]) => void;
61
+ setUpdateSessionItem: (item: import("../../shared/types").AnyObject) => void;
61
62
  init: () => Promise<void>;
62
63
  initWebSocket: () => void;
63
64
  subscribeSessionList: () => void;
@@ -473,7 +474,6 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
473
474
  };
474
475
  flexWidth: import("vue").Ref<number>;
475
476
  listBoxRef: import("vue").Ref<HTMLElement | undefined>;
476
- keyword: import("vue").Ref<string>;
477
477
  loading: import("vue").Ref<boolean>;
478
478
  filterList: import("vue").Ref<{
479
479
  label: string;
@@ -484,6 +484,7 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
484
484
  emit: (event: string, ...args: any[]) => void;
485
485
  entrySession: (item: import("../../shared/types").AnyObject) => void;
486
486
  unreadTotal: import("vue").ComputedRef<number>;
487
+ setSessionList: (list: import("../../shared/types").AnyObject[]) => void;
487
488
  currentWidth: import("vue").ComputedRef<number>;
488
489
  sessionList: import("vue").ComputedRef<import("../../shared/types").AnyObject[]>;
489
490
  sessionChange: (sessionItem: import("../../shared/types").AnyObject) => void;
@@ -1531,6 +1532,7 @@ declare const BiuniqueChat: SFCWithInstall<import("vue").DefineComponent<{
1531
1532
  MESSAGE_TYPE: typeof import("./src/constants").MESSAGE_TYPE;
1532
1533
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
1533
1534
  ChatSearch: import("vue").DefineComponent<{}, {
1535
+ inputRef: import("vue").Ref<any>;
1534
1536
  showSearch: import("vue").Ref<boolean>;
1535
1537
  keyword: import("vue").Ref<any>;
1536
1538
  userList: import("vue").Ref<any>;
@@ -61,6 +61,7 @@ declare const _default: import("vue").DefineComponent<{
61
61
  reConnention: number;
62
62
  entrySession: (item: AnyObject) => void;
63
63
  setSessionList: (list: AnyObject[]) => void;
64
+ setUpdateSessionItem: (item: AnyObject) => void;
64
65
  init: () => Promise<void>;
65
66
  initWebSocket: () => void;
66
67
  subscribeSessionList: () => void;
@@ -476,7 +477,6 @@ declare const _default: import("vue").DefineComponent<{
476
477
  };
477
478
  flexWidth: import("vue").Ref<number>;
478
479
  listBoxRef: import("vue").Ref<HTMLElement | undefined>;
479
- keyword: import("vue").Ref<string>;
480
480
  loading: import("vue").Ref<boolean>;
481
481
  filterList: import("vue").Ref<{
482
482
  label: string;
@@ -487,6 +487,7 @@ declare const _default: import("vue").DefineComponent<{
487
487
  emit: (event: string, ...args: any[]) => void;
488
488
  entrySession: (item: AnyObject) => void;
489
489
  unreadTotal: import("vue").ComputedRef<number>;
490
+ setSessionList: (list: AnyObject[]) => void;
490
491
  currentWidth: import("vue").ComputedRef<number>;
491
492
  sessionList: import("vue").ComputedRef<AnyObject[]>;
492
493
  sessionChange: (sessionItem: AnyObject) => void;
@@ -1534,6 +1535,7 @@ declare const _default: import("vue").DefineComponent<{
1534
1535
  MESSAGE_TYPE: typeof import("./constants").MESSAGE_TYPE;
1535
1536
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
1536
1537
  ChatSearch: import("vue").DefineComponent<{}, {
1538
+ inputRef: import("vue").Ref<any>;
1537
1539
  showSearch: import("vue").Ref<boolean>;
1538
1540
  keyword: import("vue").Ref<any>;
1539
1541
  userList: import("vue").Ref<any>;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as s,reactive as t,provide as o,onBeforeUnmount as r,openBlock as n,createElementBlock as i,normalizeStyle as a,unref as c,createVNode as u,withCtx as d,createBlock as m,Fragment as p,createElementVNode as l,renderSlot as h}from"vue";import{NConfigProvider as f,NSpin as S,NLayout as v,NLayoutContent as g}from"naive-ui";import b from"./components/SiderList.vue.js";import y from"./components/ChatHeader.vue.js";import I from"./components/ChatMain.vue.js";import j from"./components/ChatFooter.vue.js";import k from"./components/ChatSearch.vue.js";import{ChatSock as _}from"./utils/chatSock.js";import{instanceAxios as L}from"./api/index.js";import{useTheme as U}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{isNumber as x}from"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{SUBSCRIBE_MESSAGE_TYPE as C}from"./constants/index.js";import{InjectionIChatState as M,InjectionIChatStompClient as N,InjectionIChatEmits as q}from"./types/index.js";import"./utils/emoji.js";import{useSession as T}from"./hooks/useSession.js";const A={class:"c-biunique-chat__header"},E={class:"toolbar"};var O=e({__name:"Index",props:{token:{type:String,required:!0},orgId:{type:[String,Number],required:!0},userId:{type:String,required:!0},baseURL:{type:String,default:"/fdp-chat"}},emits:["template-click","unread-message-update"],setup(e,{expose:O,emit:V}){const w=e;L.defaults.baseURL=w.baseURL,L.defaults.headers.Authorization="bearer "+w.token;const J=U(),R=s(!1),F=s(),H=t({orgId:w.orgId,currentSessionItem:{},id:"",userInfo:{},msgList:[],currentMsg:{},isAppendMsg:!1,sessionList:[],isChangeSession:!1,updateSessionItem:{},isUpdateSession:!1});o(M,H),o(N,F),o(q,V);const{entrySession:$,setSessionList:z}=T(H);function D(){const e={headers:{AccessToken:w.token,UserId:w.userId},heartbeatFn:()=>{try{F.value.send("test")}catch(e){F.value.disconnect(),D()}},connectCb:()=>{console.log("连接成功"),F.value.subscribe("/user/topic/single",(({body:e})=>{try{console.log(JSON.parse(e),"订阅新增消息");const s=JSON.parse(e),{messageVo:t,sessionVo:o}=s;switch(s.event){case C.MESSAGE:if(s.messageVo.sender===H.userInfo.id)return;t.sender===H.currentSessionItem.receiver&&(H.currentMsg=t,H.isAppendMsg=!0),H.updateSessionItem={receiver:t.sender,lastMessageSendTime:t.sendTime,sortTime:t.sendTime,lastMessage:t.content},H.isUpdateSession=!0;break;case C.NEW_SESSION:H.updateSessionItem=o,H.isUpdateSession=!0}}catch(e){console.log(e)}})),F.value.subscribe("/app/sessionList",(({body:e})=>{try{const s=JSON.parse(e),{currentUser:t,sessionVos:o}=s;if(H.userInfo=t,!(null==o?void 0:o.length))return;z(o)}catch(e){console.log(e)}}))},errorCb:(e,s)=>{console.log("断线了,正在重连...")}};F.value=new _("/fdp-chat/websocket",e)}return async function(){D()}(),r((()=>{var e;null==(e=F.value)||e.disconnect()})),O({getUnreadData:function(){return H.sessionList.filter((e=>x(e.unreadNum)&&e.unreadNum>0))},entrySession:$}),(e,s)=>(n(),i("div",{class:"c-biunique-chat",style:a(c(J))},[u(c(f),{abstract:"",namespace:"c-biunique-chat__popover"},{default:d((()=>[R.value?(n(),m(c(S),{key:0,stroke:"#5585f5"})):(n(),i(p,{key:1},[l("div",A,[u(k),l("div",E,[h(e.$slots,"toolbar")])]),u(c(v),{class:"c-biunique-chat__body","has-sider":""},{default:d((()=>[u(b),u(c(g),{class:"chat-content"},{default:d((()=>[u(y),u(I),u(j)])),_:1}),h(e.$slots,"external")])),_:3})],64))])),_:3})],4))}});export{O as default};
1
+ import{defineComponent as e,ref as s,reactive as t,provide as o,onBeforeUnmount as r,openBlock as n,createElementBlock as i,normalizeStyle as a,unref as c,createVNode as u,withCtx as d,createBlock as m,Fragment as p,createElementVNode as l,renderSlot as h}from"vue";import{NConfigProvider as f,NSpin as g,NLayout as v,NLayoutContent as S}from"naive-ui";import b from"./components/SiderList.vue.js";import y from"./components/ChatHeader.vue.js";import j from"./components/ChatMain.vue.js";import I from"./components/ChatFooter.vue.js";import k from"./components/ChatSearch.vue.js";import{ChatSock as _}from"./utils/chatSock.js";import{instanceAxios as L}from"./api/index.js";import{useTheme as x}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{isNumber as C}from"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{SUBSCRIBE_MESSAGE_TYPE as M}from"./constants/index.js";import{InjectionIChatState as N,InjectionIChatStompClient as U,InjectionIChatEmits as q}from"./types/index.js";import"./utils/emoji.js";import{useSession as T}from"./hooks/useSession.js";const A={class:"c-biunique-chat__header"},O={class:"toolbar"};var E=e({__name:"Index",props:{token:{type:String,required:!0},orgId:{type:[String,Number],required:!0},userId:{type:String,required:!0},baseURL:{type:String,default:"/fdp-chat"}},emits:["template-click","unread-message-update"],setup(e,{expose:E,emit:V}){const w=e;L.defaults.baseURL=w.baseURL,L.defaults.headers.Authorization="bearer "+w.token;const J=x(),R=s(!1),F=s(),H=t({orgId:w.orgId,currentSessionItem:{},id:"",userInfo:{id:w.userId},msgList:[],currentMsg:{},isAppendMsg:!1,sessionList:[],isChangeSession:!1,updateSessionItem:{},isUpdateSession:!1});o(N,H),o(U,F),o(q,V);const{entrySession:$,setSessionList:z,setUpdateSessionItem:D}=T(H);function G(){const e={headers:{AccessToken:w.token,UserId:w.userId},heartbeatFn(){try{F.value.send("test")}catch(e){F.value.disconnect(),G()}},connectCb(){console.log("连接成功"),F.value.subscribe("/user/topic/single",(({body:e})=>{try{console.log(JSON.parse(e),"订阅新增消息");const s=JSON.parse(e),{messageVo:t,sessionVo:o}=s;switch(s.event){case M.MESSAGE:if(s.messageVo.sender===H.userInfo.id)return;t.sender===H.currentSessionItem.receiver&&(H.currentMsg=t,H.isAppendMsg=!0),D({receiver:t.sender,lastMessageSendTime:t.sendTime,sortTime:t.sendTime,lastMessage:t.content});break;case M.NEW_SESSION:D(o)}}catch(e){console.log(e)}})),F.value.subscribe("/app/sessionList",(({body:e})=>{try{const s=JSON.parse(e),{currentUser:t,sessionVos:o}=s;if(console.log("body",s),Object.assign(H.userInfo,t),!(null==o?void 0:o.length))return;z(o)}catch(e){console.log(e)}}))},errorCb(e,s){console.log("断线了,正在重连...")}};F.value=new _("/fdp-chat/websocket",e)}return async function(){G()}(),r((()=>{var e;null==(e=F.value)||e.disconnect()})),E({getUnreadData:function(){return H.sessionList.filter((e=>C(e.unreadNum)&&e.unreadNum>0))},entrySession:$}),(e,s)=>(n(),i("div",{class:"c-biunique-chat",style:a(c(J))},[u(c(f),{abstract:"",namespace:"c-biunique-chat__popover"},{default:d((()=>[R.value?(n(),m(c(g),{key:0,stroke:"#5585f5"})):(n(),i(p,{key:1},[l("div",A,[u(k),l("div",O,[h(e.$slots,"toolbar")])]),u(c(v),{class:"c-biunique-chat__body","has-sider":""},{default:d((()=>[u(b),u(c(S),{class:"chat-content"},{default:d((()=>[u(y),u(j),u(I)])),_:1}),h(e.$slots,"external")])),_:3})],64))])),_:3})],4))}});export{E as default};
@@ -1 +1 @@
1
- import{defineComponent as t,ref as e,withDirectives as n,openBlock as s,createElementBlock as i,normalizeStyle as a,unref as o,createElementVNode as l,createVNode as c,withCtx as r,createCommentVNode as u,Fragment as d,renderList as f,createBlock as p,createTextVNode as m,toDisplayString as g,vShow as h}from"vue";import{NPopover as v,NTooltip as y,NUpload as M,NUploadTrigger as k,NButton as x}from"naive-ui";import{format as C}from"date-fns";import{useState as T}from"../hooks/useState.js";import{useSession as b}from"../hooks/useSession.js";import{images as w,alt as E}from"../utils/emoji.js";import{MESSAGE_TYPE as I}from"../constants/index.js";import{uploadFileApi as _}from"../api/index.js";const S={class:"tool-box"},j=l("span",null,[l("i",{class:"chat--iconfont chat--icon-face"})],-1),L={class:"emoji-box"},F=l("span",null,"默认表情",-1),K={class:"list-box"},D=["onClick"],H=["src"],J=[l("i",{class:"chat--iconfont chat--icon-good"},null,-1)],N=["onClick"],O=[l("i",{class:"chat--iconfont chat--icon-image"},null,-1)],A=["onClick"],G=[l("i",{class:"chat--iconfont chat--icon-folder"},null,-1)],U={class:"btn-box"},X=l("span",{class:"tip"},"Enter 发送, Shift + Enter 换行",-1);var z=t({__name:"ChatFooter",setup(t){const z=e(),B=e(""),{state:R,stompClient:q}=T(),{setCurrentSessionItem:P}=b(R),Q=e(!1);function V(t){["Enter"].includes(t.key)&&(function(t){return t.altKey||t.ctrlKey||t.metaKey||t.shiftKey}(t)||(t.preventDefault(),Z()))}function W(){var t,e;B.value=(null==(e=null==(t=z.value)?void 0:t.innerText)?void 0:e.trim())||""}async function Y(t,e){console.log(Y,t);const{file:n,name:s}=t.file,i=new FormData;i.append("sender",R.userInfo.id),i.append("file",n);const a=await _(i);if(!a)return console.log("上传失败");$({chatMessageType:e,msg:e===I.FILE?s:a,url:a})}function Z(){if(!(B.value.length>2e3))return B.value?void $({msg:B.value}):console.log("请输入内容");console.log("请控制在2000字以内")}async function $(t){const{chatMessageType:e=I.TEXT,msg:n,url:s}=t,i={msg:n,chatMessageType:e};e===I.FILE&&(i.fileUrl=s),[I.TEXT,I.BLEND].includes(e)&&(z.value.innerHTML="",B.value="");const a=C(new Date,"yyyy-MM-dd HH:mm:ss");R.currentMsg={content:i,sender:R.userInfo.id,id:"",sendTime:a,sending:!0,fail:!1},R.isAppendMsg=!0,P({lastMessageSendTime:a,lastMessage:i,sortTime:a}),R.isChangeSession=!0;try{q.value.send("/app/chat/send",{},JSON.stringify({chatType:"SINGLE",content:i,receiver:R.currentSessionItem.receiver})),R.currentMsg={...R.currentMsg,fail:!1}}catch(t){R.currentMsg={...R.currentMsg,fail:!0}}finally{R.currentMsg={...R.currentMsg,sending:!1}}}return(t,e)=>n((s(),i("section",{class:"chat-footer",style:a({cursor:o(R).id?"default":"not-allowed"})},[l("div",S,[c(o(v),{show:Q.value,"onUpdate:show":e[0]||(e[0]=t=>Q.value=t),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show"},{trigger:r((()=>[j])),default:r((()=>[l("div",L,[u(' <span>最近使用</span>\n\t\t\t\t\t<div class="list-box">\n\t\t\t\t\t\t<template v-for="(img, index) in images" :key="index">\n\t\t\t\t\t\t\t<i>\n\t\t\t\t\t\t\t\t<img :src="img" />\n\t\t\t\t\t\t\t</i>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</div> '),F,l("div",K,[(s(!0),i(d,null,f(o(w),((t,e)=>(s(),i(d,{key:e},[e>0?(s(),p(o(y),{key:0,"show-arrow":!1,trigger:"hover"},{trigger:r((()=>[l("i",{onClick:()=>function(t){Q.value=!1,$({chatMessageType:I.EMOJI,msg:t})}(e)},[l("img",{src:t},null,8,H)],8,D)])),default:r((()=>[m(" "+g(o(E)[e-1]||"微笑"),1)])),_:2},1024)):u("v-if",!0)],64)))),128))])])])),_:1},8,["show"]),l("span",{onClick:e[1]||(e[1]=()=>$({chatMessageType:o(I).EMOJI,msg:0}))},J),c(o(M),{abstract:"",multiple:"",accept:"image/*",onChange:e[2]||(e[2]=t=>Y(t,o(I).IMAGE))},{default:r((()=>[c(o(k),{abstract:""},{default:r((({handleClick:t})=>[l("span",{onClick:t},O,8,N)])),_:1})])),_:1}),c(o(M),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:e[3]||(e[3]=t=>Y(t,o(I).FILE))},{default:r((()=>[c(o(k),{abstract:""},{default:r((({handleClick:t})=>[l("span",{onClick:t},G,8,A)])),_:1})])),_:1})]),n(l("div",{ref_key:"inputRef",ref:z,class:"input-box",contenteditable:"",onKeydown:V,onInput:W},null,544),[[h,o(R).id]]),l("div",U,[X,c(o(x),{type:"primary",round:"",disabled:!B.value,onClick:Z},{default:r((()=>[m("发送")])),_:1},8,["disabled"])])],4)),[[h,o(R).id]])}});export{z as default};
1
+ import{defineComponent as t,ref as e,withDirectives as n,openBlock as s,createElementBlock as i,normalizeStyle as a,unref as o,createElementVNode as l,createVNode as c,withCtx as r,createCommentVNode as u,Fragment as d,renderList as f,createBlock as p,createTextVNode as m,toDisplayString as g,vShow as h}from"vue";import{NPopover as v,NTooltip as y,NUpload as M,NUploadTrigger as k,NButton as x}from"naive-ui";import{format as C}from"date-fns";import{useState as T}from"../hooks/useState.js";import{useSession as b}from"../hooks/useSession.js";import{images as w,alt as E}from"../utils/emoji.js";import{MESSAGE_TYPE as I}from"../constants/index.js";import{uploadFileApi as _}from"../api/index.js";const S={class:"tool-box"},j=l("span",null,[l("i",{class:"chat--iconfont chat--icon-face"})],-1),L={class:"emoji-box"},F=l("span",null,"默认表情",-1),K={class:"list-box"},D=["onClick"],H=["src"],J=[l("i",{class:"chat--iconfont chat--icon-good"},null,-1)],N=["onClick"],O=[l("i",{class:"chat--iconfont chat--icon-image"},null,-1)],A=["onClick"],G=[l("i",{class:"chat--iconfont chat--icon-folder"},null,-1)],U={class:"btn-box"},X=l("span",{class:"tip"},"Enter 发送, Shift + Enter 换行",-1);var z=t({__name:"ChatFooter",setup(t){const z=e(),B=e(""),{state:R,stompClient:q}=T(),{setCurrentSessionItem:P}=b(R),Q=e(!1);function V(t){["Enter"].includes(t.key)&&(function(t){return t.altKey||t.ctrlKey||t.metaKey||t.shiftKey}(t)||(t.preventDefault(),Z()))}function W(){var t,e;B.value=(null==(e=null==(t=z.value)?void 0:t.innerText)?void 0:e.trim())||""}async function Y(t,e){console.log(Y,t);const{file:n,name:s}=t.file,i=new FormData;i.append("sender",R.userInfo.id),i.append("file",n);const a=await _(i);if(!a)return console.log("上传失败");$({chatMessageType:e,msg:e===I.FILE?s:a,url:a})}function Z(){if(!(B.value.length>2e3))return B.value?void $({msg:B.value}):console.log("请输入内容");console.log("请控制在2000字以内")}async function $(t){const{chatMessageType:e=I.TEXT,msg:n,url:s}=t,i={msg:n,chatMessageType:e};e===I.FILE&&(i.fileUrl=s),[I.TEXT,I.BLEND].includes(e)&&(z.value.innerHTML="",B.value="");const a=C(new Date,"yyyy-MM-dd HH:mm:ss");R.currentMsg={content:i,sender:R.userInfo.id,id:"",sendTime:a,sending:!0,fail:!1},R.isAppendMsg=!0,P({lastMessageSendTime:a,lastMessage:i,sortTime:a});try{q.value.send("/app/chat/send",{},JSON.stringify({chatType:"SINGLE",content:i,receiver:R.currentSessionItem.receiver})),R.currentMsg={...R.currentMsg,fail:!1}}catch(t){R.currentMsg={...R.currentMsg,fail:!0}}finally{R.currentMsg={...R.currentMsg,sending:!1}}}return(t,e)=>n((s(),i("section",{class:"chat-footer",style:a({cursor:o(R).id?"default":"not-allowed"})},[l("div",S,[c(o(v),{show:Q.value,"onUpdate:show":e[0]||(e[0]=t=>Q.value=t),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show",delay:0},{trigger:r((()=>[j])),default:r((()=>[l("div",L,[u(' <span>最近使用</span>\n\t\t\t\t\t<div class="list-box">\n\t\t\t\t\t\t<template v-for="(img, index) in images" :key="index">\n\t\t\t\t\t\t\t<i>\n\t\t\t\t\t\t\t\t<img :src="img" />\n\t\t\t\t\t\t\t</i>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</div> '),F,l("div",K,[(s(!0),i(d,null,f(o(w),((t,e)=>(s(),i(d,{key:e},[e>0?(s(),p(o(y),{key:0,"show-arrow":!1,trigger:"hover"},{trigger:r((()=>[l("i",{onClick:()=>function(t){Q.value=!1,$({chatMessageType:I.EMOJI,msg:t})}(e)},[l("img",{src:t},null,8,H)],8,D)])),default:r((()=>[m(" "+g(o(E)[e-1]||"微笑"),1)])),_:2},1024)):u("v-if",!0)],64)))),128))])])])),_:1},8,["show"]),l("span",{onClick:e[1]||(e[1]=()=>$({chatMessageType:o(I).EMOJI,msg:0}))},J),c(o(M),{abstract:"",multiple:"",accept:"image/*",onChange:e[2]||(e[2]=t=>Y(t,o(I).IMAGE))},{default:r((()=>[c(o(k),{abstract:""},{default:r((({handleClick:t})=>[l("span",{onClick:t},O,8,N)])),_:1})])),_:1}),c(o(M),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:e[3]||(e[3]=t=>Y(t,o(I).FILE))},{default:r((()=>[c(o(k),{abstract:""},{default:r((({handleClick:t})=>[l("span",{onClick:t},G,8,A)])),_:1})])),_:1})]),n(l("div",{ref_key:"inputRef",ref:z,class:"input-box",contenteditable:"",onKeydown:V,onInput:W},null,544),[[h,o(R).id]]),l("div",U,[X,c(o(x),{type:"primary",round:"",disabled:!B.value,onClick:Z},{default:r((()=>[m("发送")])),_:1},8,["disabled"])])],4)),[[h,o(R).id]])}});export{z as default};
@@ -1,10 +1,10 @@
1
- import { AnyObject } from '../../../../shared/types';
2
1
  declare const _default: import("vue").DefineComponent<{}, {
2
+ inputRef: import("vue").Ref<any>;
3
3
  showSearch: import("vue").Ref<boolean>;
4
4
  keyword: import("vue").Ref<any>;
5
5
  userList: import("vue").Ref<any>;
6
6
  state: import("../types").IState;
7
- entrySession: (item: AnyObject) => void;
7
+ entrySession: (item: import("../../..").AnyObject) => void;
8
8
  handleSearch: () => Promise<void>;
9
9
  openSession: (userId: string) => Promise<void>;
10
10
  NPopover: any;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as o,openBlock as a,createBlock as s,unref as n,withCtx as r,createVNode as l,createTextVNode as t,createElementVNode as i,withKeys as c,withModifiers as u,createElementBlock as p,Fragment as d,renderList as v,toDisplayString as f}from"vue";import{NPopover as m,NButton as h,NIcon as w,NInput as y,NAvatar as g}from"naive-ui";import{SearchOutline as k}from"@vicons/ionicons5";import{useState as S}from"../hooks/useState.js";import{useSession as _}from"../hooks/useSession.js";import{listUserApi as I,openSessionApi as j}from"../api/index.js";import{isArray as x}from"lodash-es";const C={class:"popover-search"},b={class:"user-list-wrapper"},z=["onClick"],K={class:"user-info"},U=i("span",null,"职务",-1),E=i("span",null,"部门",-1);var G=e({__name:"ChatSearch",setup(e){const G=o(!1),L=o(),N=o(),{state:T}=S(),{entrySession:q}=_(T);async function A(){const e=await I({orgId:T.orgId,keyword:L.value});x(e)&&(N.value=e)}return(e,o)=>(a(),s(n(m),{show:G.value,"onUpdate:show":o[1]||(o[1]=e=>G.value=e),placement:"top",trigger:"click","show-arrow":!1,overlap:""},{trigger:r((()=>[l(n(h),{color:"#d8dce34f",class:"search-trigger-btn"},{icon:r((()=>[l(n(w),{component:n(k),color:"#ffffff80"},null,8,["component"])])),default:r((()=>[t(" 搜索联系人 ")])),_:1})])),default:r((()=>[i("div",C,[l(n(y),{placeholder:"",size:"small",clearable:"",autofocus:"","passively-activated":"",delay:0,onKeydown:c(u(A,["prevent"]),["enter"]),value:L.value,"onUpdate:value":o[0]||(o[0]=e=>L.value=e)},{prefix:r((()=>[l(n(w),{component:n(k)},null,8,["component"])])),_:1},8,["onKeydown","value"]),i("div",b,[(a(!0),p(d,null,v(N.value,(e=>(a(),p("div",{class:"user-item",key:e.id,onClick:()=>async function(e){G.value=!1;const o=await j({chatType:"SINGLE",receiver:e,sender:T.userInfo.id});q(o)}(e.id)},[l(n(g),{round:"",size:32,src:e.avatar},null,8,["src"]),i("div",K,[i("span",null,f(e.name),1),U,E])],8,z)))),128))])])])),_:1},8,["show"]))}});export{G as default};
1
+ import{defineComponent as e,ref as o,watch as a,nextTick as n,openBlock as r,createBlock as s,unref as l,withCtx as t,createVNode as i,createTextVNode as u,createElementVNode as c,withKeys as p,withModifiers as d,createElementBlock as v,Fragment as f,renderList as m,toDisplayString as h}from"vue";import{NPopover as w,NButton as y,NIcon as g,NInput as k,NAvatar as _}from"naive-ui";import{SearchOutline as S}from"@vicons/ionicons5";import{useState as I}from"../hooks/useState.js";import{useSession as j}from"../hooks/useSession.js";import{listUserApi as x,openSessionApi as C}from"../api/index.js";import{isArray as b}from"lodash-es";const z={class:"popover-search"},K={class:"user-list-wrapper"},U=["onClick"],E={class:"user-info"},G=c("span",null,"职务",-1),L=c("span",null,"部门",-1);var N=e({__name:"ChatSearch",setup(e){const N=o(),R=o(!1),T=o(),q=o(),{state:A}=I(),{entrySession:B}=j(A);async function D(){const e=await x({orgId:A.orgId,keyword:T.value});b(e)&&(q.value=e)}return a((()=>R.value),(async e=>{var o;e&&(await n(),null==(o=N.value)||o.focus())})),(e,o)=>(r(),s(l(w),{show:R.value,"onUpdate:show":o[1]||(o[1]=e=>R.value=e),placement:"top",trigger:"click","display-directive":"show","show-arrow":!1,delay:0,overlap:""},{trigger:t((()=>[i(l(y),{color:"#d8dce34f",class:"search-trigger-btn"},{icon:t((()=>[i(l(g),{component:l(S),color:"#ffffff80"},null,8,["component"])])),default:t((()=>[u(" 搜索联系人 ")])),_:1})])),default:t((()=>[c("div",z,[i(l(k),{ref_key:"inputRef",ref:N,placeholder:"",size:"small",clearable:"",autofocus:"",round:"",onKeydown:p(d(D,["prevent"]),["enter"]),value:T.value,"onUpdate:value":o[0]||(o[0]=e=>T.value=e)},{prefix:t((()=>[i(l(g),{component:l(S)},null,8,["component"])])),_:1},8,["onKeydown","value"]),c("div",K,[(r(!0),v(f,null,m(q.value,(e=>(r(),v("div",{class:"user-item",key:e.id,onClick:()=>async function(e){R.value=!1;const o=await C({chatType:"SINGLE",receiver:e,sender:A.userInfo.id});B(o)}(e.id)},[i(l(_),{round:"",size:32,src:e.avatar},null,8,["src"]),c("div",E,[c("span",null,h(e.name),1),G,L])],8,U)))),128))])])])),_:1},8,["show"]))}});export{N as default};
@@ -1 +1 @@
1
- import{defineComponent as s,openBlock as e,createBlock as o,unref as t,withCtx as n,createVNode as i,createElementVNode as r,toDisplayString as a}from"vue";import{NDrawer as u,NDrawerContent as l,NAvatar as c,NIcon as m,NSwitch as p}from"naive-ui";import{ChevronForwardOutline as f}from"@vicons/ionicons5";import{useState as d}from"../hooks/useState.js";import{useSession as v}from"../hooks/useSession.js";import g from"./PersonProfile.vue.js";import{toppingSessionApi as h}from"../api/index.js";const _={class:"chat-set-wrapper"},I={class:"item user-info"},S={class:"item"},j=r("span",{class:"label"},"置顶聊天",-1);var y=s({__name:"ChatSet",setup(s){const{state:y}=d(),{setCurrentSessionItem:b}=v(y);async function k(s){try{await h({sessionKey:y.currentSessionItem.sessionKey,id:y.currentSessionItem.id,topping:s}),b({topping:s}),y.isChangeSession=!0}catch(s){console.log(s)}}return(s,d)=>(e(),o(t(u),{width:320,"trap-focus":!1,"block-scroll":!1,to:".c-biunique-chat"},{default:n((()=>[i(t(l),{title:"聊天设置"},{default:n((()=>[r("div",_,[i(g,{"user-info":t(y).userInfo},{trigger:n((()=>[r("div",I,[i(t(c),{round:"",size:40,src:t(y).currentSessionItem.avatar},null,8,["src"]),r("span",null,a(t(y).userInfo.name),1),i(t(m),{size:24,component:t(f),class:"item__right"},null,8,["component"])])])),_:1},8,["user-info"]),r("div",S,[j,i(t(p),{value:t(y).userInfo.topping,"onUpdate:value":[d[0]||(d[0]=s=>t(y).userInfo.topping=s),k],class:"item__right"},null,8,["value"])])])])),_:1})])),_:1}))}});export{y as default};
1
+ import{defineComponent as e,openBlock as s,createBlock as t,unref as o,withCtx as n,createVNode as i,createElementVNode as r,toDisplayString as a}from"vue";import{NDrawer as u,NDrawerContent as c,NAvatar as l,NIcon as m,NSwitch as p}from"naive-ui";import{ChevronForwardOutline as f}from"@vicons/ionicons5";import{useState as d}from"../hooks/useState.js";import{useSession as v}from"../hooks/useSession.js";import g from"./PersonProfile.vue.js";import{toppingSessionApi as h}from"../api/index.js";const _={class:"chat-set-wrapper"},I={class:"item user-info"},S={class:"item"},j=r("span",{class:"label"},"置顶聊天",-1);var y=e({__name:"ChatSet",setup(e){const{state:y}=d(),{setCurrentSessionItem:b}=v(y);async function k(e){try{await h({sessionKey:y.currentSessionItem.sessionKey,id:y.currentSessionItem.id,topping:e}),b({topping:e})}catch(e){console.log(e)}}return(e,d)=>(s(),t(o(u),{width:320,"trap-focus":!1,"block-scroll":!1,to:".c-biunique-chat"},{default:n((()=>[i(o(c),{title:"聊天设置"},{default:n((()=>[r("div",_,[i(g,{"user-info":o(y).userInfo},{trigger:n((()=>[r("div",I,[i(o(l),{round:"",size:40,src:o(y).currentSessionItem.avatar},null,8,["src"]),r("span",null,a(o(y).currentSessionItem.name),1),i(o(m),{size:24,component:o(f),class:"item__right"},null,8,["component"])])])),_:1},8,["user-info"]),r("div",S,[j,i(o(p),{value:o(y).userInfo.topping,"onUpdate:value":[d[0]||(d[0]=e=>o(y).userInfo.topping=e),k],class:"item__right"},null,8,["value"])])])])),_:1})])),_:1}))}});export{y as default};
@@ -1 +1 @@
1
- import{defineComponent as e,computed as t,openBlock as s,createElementBlock as l,Fragment as a,unref as o,createElementVNode as i,toDisplayString as n,withModifiers as c,createBlock as m,createCommentVNode as r,renderList as d,withCtx as p,createTextVNode as u,createVNode as v}from"vue";import{NIcon as f,NButton as y}from"naive-ui";import{ChevronForwardOutline as g,AlertCircleSharp as k}from"@vicons/ionicons5";import _ from"../../../../shared/components/SvgIcon/SvgIcon.vue.js";import{useState as b}from"../hooks/useState.js";const h={class:"default-msg-template__header"},C={class:"title"},T={class:"default-msg-template__body"},j=["src"],S={class:"template-content"},L={key:0,class:"default-msg-template__btn-group"},M=i("i",{class:"chat--iconfont chat--icon-more"},null,-1),x={key:1,class:"describe-msg-template"},B={class:"describe-msg-template__header"},H={class:"describe-msg-template__body"},I={class:"title"},q={class:"txt"},z=i("div",{class:"describe-msg-template__footer"},[u(" 展开全部 "),i("i",{class:"chat--iconfont chat--icon-more"})],-1),D={key:2,class:"system-msg-template"},O=["innerHTML"],P=["onClick"];var R=e({__name:"MessageTemplate",props:{data:{type:Object,required:!0}},setup(e){const R=e,{emit:w}=b(),A=t((()=>R.data.content.messageTemplate.setting)),E=t((()=>A.value.serverSetting)),F=t((()=>(E.value.topRightButton||[])[0])),G=t((()=>(A.value.content||"").split("##").filter((e=>e)))),J=t((()=>E.value.toolbar_button)),K=t((()=>(E.value.bottomButton||[])[0])),N=t((()=>A.value.dbParamsList)),Q=t((()=>R.data.content.messageTemplateData));function U(e){w("template-click",e,R.data)}return(e,t)=>(s(),l(a,null,[1==o(A).style.id?(s(),l("div",{key:0,class:"default-msg-template",onClick:t[2]||(t[2]=()=>U(o(E)))},[i("div",h,[i("span",C,n(o(A).title),1),o(F)?(s(),l("span",{key:0,class:"btn",onClick:t[0]||(t[0]=c((()=>U(o(F))),["stop"]))},n(o(F).title),1)):o(E).address?(s(),m(o(f),{key:1,component:o(g),color:"#969696"},null,8,["component"])):r("v-if",!0)]),i("div",T,[o(A).style.icon?(s(),m(o(_),{key:0,class:"logo","icon-class":o(A).style.icon},null,8,["icon-class"])):o(A).style.image?(s(),l("img",{key:1,class:"logo",src:o(A).style.image},null,8,j)):r("v-if",!0),i("div",S,[(s(!0),l(a,null,d(o(G),(e=>(s(),l("div",{key:e},n(e),1)))),128))])]),o(J)?(s(),l("div",L,[(s(!0),l(a,null,d(o(J),((e,t)=>(s(),m(o(y),{type:"primary",round:"",ghost:"",onClick:c((()=>U(e)),["stop"]),key:t},{default:p((()=>[u(n(e.title),1)])),_:2},1032,["onClick"])))),128))])):r("v-if",!0),o(K)?(s(),l("div",{key:1,class:"default-msg-template__footer",onClick:t[1]||(t[1]=c((()=>U(o(K))),["stop"]))},[u(n(o(K).title)+" ",1),M])):r("v-if",!0)])):r("v-if",!0),3==o(A).style.id?(s(),l("div",x,[i("div",B,n(o(A).title),1),i("div",H,[(s(!0),l(a,null,d(o(N),((e,t)=>(s(),l(a,{key:t},[i("div",I,n(e.desc),1),i("div",q,n(o(Q)[e.p_name]),1)],64)))),128))]),z])):r("v-if",!0),2==o(A).style.id?(s(),l("div",D,[v(o(f),{component:o(k),color:"#ffc200",size:18},null,8,["component"]),i("span",{innerHTML:G.value.join("<br>")},null,8,O),(s(!0),l(a,null,d(o(J),((e,t)=>(s(),l("span",{class:"btn",onClick:()=>U(e),key:t},n(e.title),9,P)))),128))])):r("v-if",!0)],64))}});export{R as default};
1
+ import{defineComponent as e,computed as t,openBlock as l,createElementBlock as s,Fragment as a,unref as n,createElementVNode as o,toDisplayString as i,withModifiers as c,createBlock as r,createCommentVNode as m,renderList as p,withCtx as d,createTextVNode as u,createVNode as v}from"vue";import{NIcon as f,NButton as g}from"naive-ui";import{ChevronForwardOutline as y,AlertCircleSharp as k}from"@vicons/ionicons5";import _ from"../../../../shared/components/SvgIcon/SvgIcon.vue.js";import{useState as b}from"../hooks/useState.js";const h={class:"default-msg-template__header"},C={class:"title"},T={class:"default-msg-template__body"},L=["src"],M={class:"template-content"},j=["innerHTML"],H={key:0,class:"default-msg-template__btn-group"},S=o("i",{class:"chat--iconfont chat--icon-more"},null,-1),x={key:1,class:"describe-msg-template"},B={class:"describe-msg-template__header"},I={class:"describe-msg-template__body"},q={class:"title"},z={class:"txt"},D=o("div",{class:"describe-msg-template__footer"},[u(" 展开全部 "),o("i",{class:"chat--iconfont chat--icon-more"})],-1),O={key:2,class:"system-msg-template"},P=["innerHTML"],R=["onClick"];var w=e({__name:"MessageTemplate",props:{data:{type:Object,required:!0}},setup(e){const w=e,{emit:A}=b(),E=t((()=>w.data.content.messageTemplate.setting)),F=t((()=>E.value.serverSetting)),G=t((()=>(F.value.topRightButton||[])[0])),J=t((()=>{const e=(E.value.content||"").split("##").filter((e=>e));return e?e.map((e=>{const t=/\\n|\n|\r/g;return t.test(e)?e.replace(t,"<br>"):e})):[]})),K=t((()=>{var e;return(null==(e=F.value)?void 0:e.toolbar_button)||[]})),N=t((()=>(F.value.bottomButton||[])[0])),Q=t((()=>E.value.dbParamsList)),U=t((()=>w.data.content.messageTemplateData));function V(e){A("template-click",e,w.data)}return(e,t)=>(l(),s(a,null,[1==n(E).style.id?(l(),s("div",{key:0,class:"default-msg-template",onClick:t[2]||(t[2]=()=>V(n(F)))},[o("div",h,[o("span",C,i(n(E).title),1),n(G)?(l(),s("span",{key:0,class:"btn",onClick:t[0]||(t[0]=c((()=>V(n(G))),["stop"]))},i(n(G).title),1)):n(F).address?(l(),r(n(f),{key:1,component:n(y),color:"#969696"},null,8,["component"])):m("v-if",!0)]),o("div",T,[n(E).style.icon?(l(),r(n(_),{key:0,class:"logo","icon-class":n(E).style.icon},null,8,["icon-class"])):n(E).style.image?(l(),s("img",{key:1,class:"logo",src:n(E).style.image},null,8,L)):m("v-if",!0),o("div",M,[(l(!0),s(a,null,p(n(J),(e=>(l(),s("div",{key:e,innerHTML:e},null,8,j)))),128))])]),n(K)?(l(),s("div",H,[(l(!0),s(a,null,p(n(K),((e,t)=>(l(),r(n(g),{type:"primary",round:"",ghost:"",onClick:c((()=>V(e)),["stop"]),key:t},{default:d((()=>[u(i(e.title),1)])),_:2},1032,["onClick"])))),128))])):m("v-if",!0),n(N)?(l(),s("div",{key:1,class:"default-msg-template__footer",onClick:t[1]||(t[1]=c((()=>V(n(N))),["stop"]))},[u(i(n(N).title)+" ",1),S])):m("v-if",!0)])):m("v-if",!0),3==n(E).style.id?(l(),s("div",x,[o("div",B,i(n(E).title),1),o("div",I,[(l(!0),s(a,null,p(n(Q),((e,t)=>(l(),s(a,{key:t},[o("div",q,i(e.desc),1),o("div",z,i(n(U)[e.p_name]),1)],64)))),128))]),D])):m("v-if",!0),2==n(E).style.id?(l(),s("div",O,[v(n(f),{component:n(k),color:"#ffc200",size:18},null,8,["component"]),o("span",{innerHTML:J.value.join("<br>")},null,8,P),(l(!0),s(a,null,p(n(K),((e,t)=>(l(),s("span",{class:"btn",onClick:()=>V(e),key:t},i(e.title),9,R)))),128))])):m("v-if",!0)],64))}});export{w as default};
@@ -7,7 +7,6 @@ declare const _default: import("vue").DefineComponent<{}, {
7
7
  };
8
8
  flexWidth: import("vue").Ref<number>;
9
9
  listBoxRef: import("vue").Ref<HTMLElement | undefined>;
10
- keyword: import("vue").Ref<string>;
11
10
  loading: import("vue").Ref<boolean>;
12
11
  filterList: import("vue").Ref<{
13
12
  label: string;
@@ -18,6 +17,7 @@ declare const _default: import("vue").DefineComponent<{}, {
18
17
  emit: (event: string, ...args: any[]) => void;
19
18
  entrySession: (item: AnyObject) => void;
20
19
  unreadTotal: import("vue").ComputedRef<number>;
20
+ setSessionList: (list: AnyObject[]) => void;
21
21
  currentWidth: import("vue").ComputedRef<number>;
22
22
  sessionList: import("vue").ComputedRef<AnyObject[]>;
23
23
  sessionChange: (sessionItem: AnyObject) => void;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as s,computed as i,watch as n,withDirectives as a,openBlock as t,createElementBlock as l,normalizeStyle as r,unref as o,createBlock as u,createCommentVNode as d,createElementVNode as v,Fragment as c,renderList as m,withCtx as p,createTextVNode as f,toDisplayString as k,normalizeClass as h,createVNode as y,vShow as _}from"vue";import{NSpin as S,NTag as g,NAvatar as b,NBadge as x}from"naive-ui";import{useState as M}from"../hooks/useState.js";import{useSession as C}from"../hooks/useSession.js";import{vFlexibleResize as L}from"../../../../shared/directive/flexibleResize.js";import{listSort as j,formatTime as T}from"../utils/index.js";const w={class:"sider-list__filter box-shadow"},I=["onClick"],N={class:"avatar-right"},R={class:"name"},z={class:"msg-tip"},H={class:"msg-tip__content"},U=["innerHTML"];var B=e({__name:"SiderList",setup(e){const B="all",E="unread",O=s(300),V=s();s("");const q=s(!1),A=s([{label:"全部",key:B},{label:"未读",key:E}]),D=s("all"),{state:F,emit:G}=M(),{entrySession:J,unreadTotal:K}=C(F),P=i((()=>Math.min(Math.max(O.value,240),360))),Q=i((()=>j(F.sessionList)));function W(e){!e.id||F.sessionList.map((e=>e.id)).includes(e.id)?F.sessionList.forEach((s=>{s.receiver===e.receiver&&(Object.assign(s,e),e.receiver!==F.currentSessionItem.receiver&&s.unreadNum++)})):F.sessionList.push(e)}function X({distance:e}){O.value=O.value+e}function Y(e,s=o(D)){var i;return s===B||(s===E?(null!=(i=e.unreadNum)?i:0)>0:void 0)}return n([()=>F.isChangeSession,()=>F.isUpdateSession],(([e,s])=>{e&&(W(F.currentSessionItem),F.isChangeSession=!1),s&&(W(F.updateSessionItem),F.isUpdateSession=!1)}),{immediate:!0}),n((()=>K.value),(e=>{const s=Q.value.filter((e=>Y(e,E)));G("unread-message-update",e,s)})),(e,s)=>a((t(),l("section",{class:"sider-list",style:r({width:o(P)+"px"})},[q.value?(t(),u(o(S),{key:0,stroke:"#5585f5"})):d("v-if",!0),d(' <n-input v-else placeholder="输入用户名模糊搜索" v-model:value="keyword" @keyup.enter="handleSearch"></n-input> '),v("div",w,[(t(!0),l(c,null,m(A.value,(e=>(t(),u(o(g),{type:D.value===e.key?"info":"default",round:"",bordered:!1,key:e.key,onClick:()=>{return s=e.key,void(D.value=s);var s}},{default:p((()=>[f(k(e.label)+"("+k(o(K))+") ",1)])),_:2},1032,["type","onClick"])))),128))]),v("div",{class:"sider-list__box",ref_key:"listBoxRef",ref:V},[(t(!0),l(c,null,m(o(Q),((e,s)=>a((t(),l("div",{key:s,onClick:()=>o(J)(e),class:h(["sider-list__box__item",{active:e.id===o(F).id}])},[y(o(b),{round:"",size:"large",src:e.avatar},null,8,["src"]),v("div",N,[v("div",R,[v("h4",null,k(e.name),1),v("span",null,k(o(T)(e.lastMessageSendTime).siderMsgTime),1)]),v("div",z,[v("div",H,[v("div",{innerHTML:e.lastMessageContent},null,8,U)]),y(o(x),{value:e.unreadNum},null,8,["value"])])])],10,I)),[[_,Y(e)]]))),128))],512)],4)),[[o(L),{mode:"VR",onMove:X}]])}});export{B as default};
1
+ import{defineComponent as e,ref as s,computed as i,watch as n,withDirectives as t,openBlock as a,createElementBlock as l,normalizeStyle as r,unref as o,createBlock as u,createCommentVNode as d,createElementVNode as v,Fragment as c,renderList as m,withCtx as p,createTextVNode as f,toDisplayString as k,normalizeClass as h,createVNode as y,vShow as S}from"vue";import{NSpin as _,NTag as g,NAvatar as b,NBadge as x}from"naive-ui";import{useState as L}from"../hooks/useState.js";import{useSession as M}from"../hooks/useSession.js";import{vFlexibleResize as C}from"../../../../shared/directive/flexibleResize.js";import{listSort as j,formatTime as T}from"../utils/index.js";const w={class:"sider-list__filter box-shadow"},I=["onClick"],N={class:"avatar-right"},R={class:"name"},z={class:"msg-tip"},H={class:"msg-tip__content"},U=["innerHTML"];var B=e({__name:"SiderList",setup(e){const B="all",E="unread",O=s(300),V=s(),q=s(!1),A=s([{label:"全部",key:B},{label:"未读",key:E}]),D=s("all"),{state:F,emit:G}=L(),{entrySession:J,unreadTotal:K,setSessionList:P}=M(F),Q=i((()=>Math.min(Math.max(O.value,240),360))),W=i((()=>j(F.sessionList)));function X(e){!e.id||F.sessionList.map((e=>e.id)).includes(e.id)?F.sessionList.forEach((s=>{s.receiver===e.receiver&&(Object.assign(s,e),e.receiver!==F.currentSessionItem.receiver&&s.unreadNum++)})):P([...F.sessionList,e])}function Y({distance:e}){O.value=O.value+e}function Z(e,s=o(D)){var i;return s===B||(s===E?(null!=(i=e.unreadNum)?i:0)>0:void 0)}return n([()=>F.isChangeSession,()=>F.isUpdateSession],(([e,s])=>{e&&(X(F.currentSessionItem),F.isChangeSession=!1),s&&(X(F.updateSessionItem),F.isUpdateSession=!1)}),{immediate:!0}),n((()=>K.value),(e=>{const s=W.value.filter((e=>Z(e,E)));G("unread-message-update",e,s)})),(e,s)=>t((a(),l("section",{class:"sider-list",style:r({width:o(Q)+"px"})},[q.value?(a(),u(o(_),{key:0,stroke:"#5585f5"})):d("v-if",!0),d(' <n-input v-else placeholder="输入用户名模糊搜索" v-model:value="keyword" @keyup.enter="handleSearch"></n-input> '),v("div",w,[(a(!0),l(c,null,m(A.value,(e=>(a(),u(o(g),{type:D.value===e.key?"info":"default",round:"",bordered:!1,key:e.key,onClick:()=>{return s=e.key,void(D.value=s);var s}},{default:p((()=>[f(k(e.label)+"("+k(o(K))+") ",1)])),_:2},1032,["type","onClick"])))),128))]),v("div",{class:"sider-list__box",ref_key:"listBoxRef",ref:V},[(a(!0),l(c,null,m(o(W),(e=>t((a(),l("div",{key:e.id,onClick:()=>o(J)(e),class:h(["sider-list__box__item",{active:e.id===o(F).id}])},[y(o(b),{round:"",size:"large",src:e.avatar},null,8,["src"]),v("div",N,[v("div",R,[v("h4",null,k(e.name),1),v("span",null,k(o(T)(e.lastMessageSendTime).siderMsgTime),1)]),v("div",z,[v("div",H,[v("div",{innerHTML:e.lastMessageContent},null,8,U)]),y(o(x),{value:e.unreadNum},null,8,["value"])])])],10,I)),[[S,Z(e)]]))),128))],512)],4)),[[o(C),{mode:"VR",onMove:Y}]])}});export{B as default};
@@ -3,6 +3,7 @@ import { IState } from '../types';
3
3
  export declare function useSession(state: IState): {
4
4
  entrySession: (item: AnyObject) => void;
5
5
  setCurrentSessionItem: (item: AnyObject) => void;
6
+ setUpdateSessionItem: (item: AnyObject) => void;
6
7
  unreadTotal: import("vue").ComputedRef<number>;
7
8
  setSessionList: (list: AnyObject[]) => void;
8
9
  };
@@ -1 +1 @@
1
- import{computed as s}from"vue";import{transformLastMessage as e}from"../utils/index.js";function t(t){function n(s){Object.assign(t.currentSessionItem,s,{lastMessageContent:s.lastMessage?e(s.lastMessage):""}),t.id!==t.currentSessionItem.id&&(t.msgList=[],t.id=t.currentSessionItem.id)}return{entrySession:function(s){s.unreadNum=0,n(s),t.isChangeSession=!0},setCurrentSessionItem:n,unreadTotal:s((()=>t.sessionList.reduce(((s,e)=>s+ +e.unreadNum),0))),setSessionList:function(s){t.sessionList=s.map((s=>{const{lastMessage:t}=s;return{...s,lastMessageContent:t?e(t):""}}))}}}export{t as useSession};
1
+ import{computed as s}from"vue";import{transformLastMessage as e}from"../utils/index.js";function t(t){function n(s){Object.assign(t.currentSessionItem,s,{lastMessageContent:s.lastMessage?e(s.lastMessage):""}),t.isChangeSession=!0,t.id!==t.currentSessionItem.id&&(t.msgList=[],t.id=t.currentSessionItem.id)}return{entrySession:function(s){s.unreadNum=0,n(s)},setCurrentSessionItem:n,setUpdateSessionItem:function(s){Object.assign(t.updateSessionItem,s,{lastMessageContent:s.lastMessage?e(s.lastMessage):""}),t.isUpdateSession=!0},unreadTotal:s((()=>t.sessionList.reduce(((s,e)=>s+ +e.unreadNum),0))),setSessionList:function(s){t.sessionList=s.map((s=>{const{lastMessage:t}=s;return{...s,lastMessageContent:Reflect.has(s,"lastMessageContent")?s.lastMessageContent:t?e(t):""}}))}}}export{t as useSession};