cnhis-design-vue 3.2.7-beta.7 → 3.2.7-beta.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. package/README.md +87 -87
  2. package/es/components/classification/src/components/table-modal/index.vue.d.ts +3 -0
  3. package/es/components/field-set/src/FieldColor.vue.d.ts +1 -1
  4. package/es/components/field-set/src/FieldFilter.vue.d.ts +1 -1
  5. package/es/components/field-set/src/FieldSet.vue.d.ts +2 -2
  6. package/es/components/field-set/src/components/Row.vue.d.ts +1 -1
  7. package/es/components/iho-chat/index.d.ts +9 -19
  8. package/es/components/iho-chat/src/Index.vue.d.ts +9 -19
  9. package/es/components/iho-chat/src/components/ChatFooter.vue2.js +1 -1
  10. package/es/components/iho-chat/src/components/ChatMain.vue.d.ts +9 -19
  11. package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
  12. package/es/components/iho-chat/src/components/ContextMenu.d.ts +5 -5
  13. package/es/components/iho-chat/src/components/ContextMenu.js +1 -1
  14. package/es/components/iho-chat/style/index.css +1 -1
  15. package/es/components/index.css +1 -1
  16. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  17. package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
  18. package/es/env.d.ts +25 -25
  19. package/es/shared/assets/img/defaultCover/10review_successful.png.js +1 -1
  20. package/es/shared/assets/img/defaultCover/11review_fail.png.js +1 -1
  21. package/es/shared/assets/img/defaultCover/12no_setting.png.js +1 -1
  22. package/es/shared/assets/img/defaultCover/13no_menu_setting.png.js +1 -1
  23. package/es/shared/assets/img/defaultCover/14no_call_setting.png.js +1 -1
  24. package/es/shared/assets/img/defaultCover/15no_use_tag.png.js +1 -1
  25. package/es/shared/assets/img/defaultCover/16no_table_data.png.js +1 -1
  26. package/es/shared/assets/img/defaultCover/1location.png.js +1 -1
  27. package/es/shared/assets/img/defaultCover/2notfound.png.js +1 -1
  28. package/es/shared/assets/img/defaultCover/3loading.png.js +1 -1
  29. package/es/shared/assets/img/defaultCover/4no_permission.png.js +1 -1
  30. package/es/shared/assets/img/defaultCover/5no_data.png.js +1 -1
  31. package/es/shared/assets/img/defaultCover/6no_network.png.js +1 -1
  32. package/es/shared/assets/img/defaultCover/7no_doctor.png.js +1 -1
  33. package/es/shared/assets/img/defaultCover/8system_error.png.js +1 -1
  34. package/es/shared/assets/img/defaultCover/9system_upgrade.png.js +1 -1
  35. package/es/shared/assets/img/failure.png.js +1 -1
  36. package/es/shared/assets/img/no-permission.png.js +1 -1
  37. package/es/shared/assets/img/nodata.png.js +1 -1
  38. package/es/shared/assets/img/notfound.png.js +1 -1
  39. package/es/shared/assets/img/qr.png.js +1 -1
  40. package/es/shared/assets/img/success.png.js +1 -1
  41. package/es/shared/assets/img/table_style_2.png.js +1 -1
  42. package/es/shared/assets/img/video.png.js +1 -1
  43. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  44. package/es/shared/assets/img/xb_big.png.js +1 -1
  45. package/es/shared/assets/img/xb_small.png.js +1 -1
  46. package/es/shared/package.json.js +1 -1
  47. package/package.json +2 -2
  48. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  49. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
  50. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
  51. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
  52. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
  53. package/es/shared/utils/fabricjs/index.d.ts +0 -6823
  54. 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
+ ```
@@ -175,6 +175,9 @@ declare const _default: import("vue").DefineComponent<{
175
175
  modelValue: unknown[];
176
176
  componentData: Record<string, any>;
177
177
  } & {
178
+ /**
179
+ * 改变弹窗大小
180
+ */
178
181
  itemKey?: string | Function | undefined;
179
182
  }>, {
180
183
  move: Function;
@@ -466,9 +466,9 @@ declare const _default: import("vue").DefineComponent<{
466
466
  hide: boolean;
467
467
  }>;
468
468
  draggable: boolean;
469
+ isHighlightRow: boolean;
469
470
  idx: number;
470
471
  isHighlight: boolean;
471
- isHighlightRow: boolean;
472
472
  isFieldSet: boolean;
473
473
  fieldDescribeMode: "column" | "tooltip";
474
474
  }>;
@@ -488,9 +488,9 @@ declare const _default: import("vue").DefineComponent<{
488
488
  hide: boolean;
489
489
  }>;
490
490
  draggable: boolean;
491
+ isHighlightRow: boolean;
491
492
  idx: number;
492
493
  isHighlight: boolean;
493
- isHighlightRow: boolean;
494
494
  isFieldSet: boolean;
495
495
  fieldDescribeMode: "column" | "tooltip";
496
496
  }>;
@@ -612,9 +612,9 @@ declare const _default: import("vue").DefineComponent<{
612
612
  hide: boolean;
613
613
  }>;
614
614
  draggable: boolean;
615
+ isHighlightRow: boolean;
615
616
  idx: number;
616
617
  isHighlight: boolean;
617
- isHighlightRow: boolean;
618
618
  isFieldSet: boolean;
619
619
  fieldDescribeMode: "column" | "tooltip";
620
620
  }>;
@@ -725,8 +725,8 @@ declare const _default: import("vue").DefineComponent<{
725
725
  showSeq: boolean;
726
726
  footerFlag: boolean;
727
727
  fieldDescribeMode: "column" | "tooltip";
728
- showSearch: boolean;
729
728
  customColumns: FieldSetColumnItem[];
729
+ showSearch: boolean;
730
730
  showSortPriority: boolean;
731
731
  showHeadFilter: boolean;
732
732
  }>;
@@ -317,9 +317,9 @@ declare const _default: import("vue").DefineComponent<{
317
317
  hide: boolean;
318
318
  }>;
319
319
  draggable: boolean;
320
+ isHighlightRow: boolean;
320
321
  idx: number;
321
322
  isHighlight: boolean;
322
- isHighlightRow: boolean;
323
323
  isFieldSet: boolean;
324
324
  fieldDescribeMode: "column" | "tooltip";
325
325
  }>;
@@ -599,7 +599,8 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
599
599
  isGroupChat: import("vue").ComputedRef<boolean>;
600
600
  contextmenuRef: import("vue").Ref<any>;
601
601
  showMenu: import("vue").Ref<boolean>;
602
- contextmenuPosition: any;
602
+ menuPosition: any;
603
+ menuMsgId: import("vue").Ref<any>;
603
604
  pageInfo: {
604
605
  page: number;
605
606
  hasMore: boolean;
@@ -609,19 +610,9 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
609
610
  '--c-tip-top': string;
610
611
  '--c-tip-gap': string;
611
612
  }>;
612
- chatMainBounding: import("vue").ComputedRef<{
613
- height: import("vue").Ref<number>;
614
- bottom: import("vue").Ref<number>;
615
- left: import("vue").Ref<number>;
616
- right: import("vue").Ref<number>;
617
- top: import("vue").Ref<number>;
618
- width: import("vue").Ref<number>;
619
- x: import("vue").Ref<number>;
620
- y: import("vue").Ref<number>;
621
- update: () => void;
622
- }>;
623
613
  getHistoryRecord: () => Promise<void>;
624
- handleContextmenu: (event: MouseEvent) => Promise<void>;
614
+ handleContextmenu: (event: MouseEvent, msgId: string) => Promise<void>;
615
+ setMenuPosition: (event: MouseEvent) => Promise<void>;
625
616
  showMessage: (item: import("../../shared/types").AnyObject) => boolean;
626
617
  showTemplateMsg: (item: import("../../shared/types").AnyObject, type: "template" | "system") => boolean | undefined;
627
618
  isTemplate3: (content: import("../../shared/types").AnyObject) => boolean;
@@ -795,10 +786,10 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
795
786
  position: {
796
787
  type: import("vue").PropType<import("vue").CSSProperties>;
797
788
  };
798
- exclude: {
799
- type: import("vue").PropType<string[]>;
789
+ msgId: {
790
+ type: StringConstructor;
800
791
  };
801
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:show")[], "select" | "update:show", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
792
+ }, () => JSX.Element | null, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:show")[], "select" | "update:show", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
802
793
  show: {
803
794
  type: BooleanConstructor;
804
795
  default: boolean;
@@ -806,8 +797,8 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
806
797
  position: {
807
798
  type: import("vue").PropType<import("vue").CSSProperties>;
808
799
  };
809
- exclude: {
810
- type: import("vue").PropType<string[]>;
800
+ msgId: {
801
+ type: StringConstructor;
811
802
  };
812
803
  }>> & {
813
804
  onSelect?: ((...args: any[]) => any) | undefined;
@@ -821,7 +812,6 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
821
812
  getAVTime: typeof import("./src/utils").getAVTime;
822
813
  MESSAGE_TYPE: typeof import("./src/constants").MESSAGE_TYPE;
823
814
  ChatbubbleEllipsesOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
824
- EllipsisHorizontal: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
825
815
  CallOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
826
816
  VideocamOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
827
817
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
@@ -604,7 +604,8 @@ declare const _default: import("vue").DefineComponent<{
604
604
  isGroupChat: import("vue").ComputedRef<boolean>;
605
605
  contextmenuRef: import("vue").Ref<any>;
606
606
  showMenu: import("vue").Ref<boolean>;
607
- contextmenuPosition: any;
607
+ menuPosition: any;
608
+ menuMsgId: import("vue").Ref<any>;
608
609
  pageInfo: {
609
610
  page: number;
610
611
  hasMore: boolean;
@@ -614,19 +615,9 @@ declare const _default: import("vue").DefineComponent<{
614
615
  '--c-tip-top': string;
615
616
  '--c-tip-gap': string;
616
617
  }>;
617
- chatMainBounding: import("vue").ComputedRef<{
618
- height: import("vue").Ref<number>;
619
- bottom: import("vue").Ref<number>;
620
- left: import("vue").Ref<number>;
621
- right: import("vue").Ref<number>;
622
- top: import("vue").Ref<number>;
623
- width: import("vue").Ref<number>;
624
- x: import("vue").Ref<number>;
625
- y: import("vue").Ref<number>;
626
- update: () => void;
627
- }>;
628
618
  getHistoryRecord: () => Promise<void>;
629
- handleContextmenu: (event: MouseEvent) => Promise<void>;
619
+ handleContextmenu: (event: MouseEvent, msgId: string) => Promise<void>;
620
+ setMenuPosition: (event: MouseEvent) => Promise<void>;
630
621
  showMessage: (item: AnyObject) => boolean;
631
622
  showTemplateMsg: (item: AnyObject, type: "template" | "system") => boolean | undefined;
632
623
  isTemplate3: (content: AnyObject) => boolean;
@@ -800,10 +791,10 @@ declare const _default: import("vue").DefineComponent<{
800
791
  position: {
801
792
  type: PropType<import("vue").CSSProperties>;
802
793
  };
803
- exclude: {
804
- type: PropType<string[]>;
794
+ msgId: {
795
+ type: StringConstructor;
805
796
  };
806
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:show")[], "select" | "update:show", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
797
+ }, () => JSX.Element | null, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:show")[], "select" | "update:show", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
807
798
  show: {
808
799
  type: BooleanConstructor;
809
800
  default: boolean;
@@ -811,8 +802,8 @@ declare const _default: import("vue").DefineComponent<{
811
802
  position: {
812
803
  type: PropType<import("vue").CSSProperties>;
813
804
  };
814
- exclude: {
815
- type: PropType<string[]>;
805
+ msgId: {
806
+ type: StringConstructor;
816
807
  };
817
808
  }>> & {
818
809
  onSelect?: ((...args: any[]) => any) | undefined;
@@ -826,7 +817,6 @@ declare const _default: import("vue").DefineComponent<{
826
817
  getAVTime: typeof import("./utils").getAVTime;
827
818
  MESSAGE_TYPE: typeof import("./constants").MESSAGE_TYPE;
828
819
  ChatbubbleEllipsesOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
829
- EllipsisHorizontal: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
830
820
  CallOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
831
821
  VideocamOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
832
822
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,watch as n,withDirectives as o,openBlock as i,createElementBlock as s,normalizeStyle as r,unref as a,createElementVNode as l,toDisplayString as c,createVNode as u,createCommentVNode as d,withCtx as f,Fragment as p,renderList as m,createBlock as g,createTextVNode as y,vShow as h}from"vue";import{NIcon as v,NPopover as M,NButton as k,NTooltip as C,NUpload as _,NUploadTrigger as x}from"naive-ui";import I from"./ChatAdd.vue.js";import{useState as b}from"../hooks/useState.js";import{useSession as w}from"../hooks/useSession.js";import{MESSAGE_TYPE as T,AV_STATUS as z}from"../constants/index.js";import"trtc-sdk-v5";import{simplifyMessage as E}from"../utils/index.js";import{emojis as j}from"../utils/emoji.js";import{uploadFileApi as R}from"../api/index.js";import{CloseCircleOutline as q,CallOutline as L,VideocamOutline as D}from"@vicons/ionicons5";import{xor as O,cloneDeep as A}from"lodash-es";import{uuidGenerator as U}from"../../../../shared/utils/index.js";const V={key:0,class:"reference-content-box"},F={class:"reference-content"},K=["innerHTML"],G={class:"tool-box"},S=l("i",{class:"chat--iconfont chat--icon-face"},null,-1),H={class:"emoji-box"},N=l("span",null,"默认表情",-1),J={class:"list-box"},X=["src"],B=l("i",{class:"chat--iconfont chat--icon-good"},null,-1),P=l("i",{class:"chat--iconfont chat--icon-image"},null,-1),Q=l("i",{class:"chat--iconfont chat--icon-folder"},null,-1),W={class:"btn-box"},Y=l("span",{class:"tip"},"Enter 发送, Shift + Enter 换行",-1);var Z=e({__name:"ChatFooter",setup(e){const Z=t(),$=t(""),{state:ee,sendMessage:te}=b(),{isGroupChat:ne}=w(ee),oe=t(!1);function ie(e,t=[]){const n=U(),o=[],i=t.length>0;ee.showVideo||ee.showMultipleVideo||(i?(o.push(...O(t,[ee.userInfo.id])),Object.assign(ee.currentAVMsg,{callMode:"call",checkedIds:o,strRoomId:n,chatMessageType:e}),ee.showMultipleVideo=!0):te({content:{chatMessageType:e,msg:"",avStatus:z.IN_CALL}}))}function se(e){["Enter"].includes(e.key)&&(function(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}(e)||(e.preventDefault(),le()))}function re(){var e,t;$.value=(null==(t=null==(e=Z.value)?void 0:e.innerText)?void 0:t.trim())||""}async function ae(e,t){const{file:n,name:o}=e.file,i=new FormData;i.append("sender",ee.userInfo.id),i.append("file",n);const s=await R(i);if(!s)return console.log("上传失败");ce({chatMessageType:t,msg:t===T.FILE?o:s,url:s})}function le(){if(!($.value.length>2e3))return $.value?void ce({msg:$.value}):console.log("请输入内容");console.log("请控制在2000字以内")}async function ce(e){const{chatMessageType:t=T.TEXT,msg:n,url:o}=e,i={msg:n,chatMessageType:t};t===T.FILE&&(i.fileUrl=o),[T.TEXT,T.BLEND].includes(t)&&(Z.value.innerHTML="",$.value=""),ee.currentReferenceMsg&&(i.referenceContent=A(ee.currentReferenceMsg),ee.currentReferenceMsg=null),te({content:i})}return n((()=>ee.currentReferenceMsg),(e=>{var t;e&&(null==(t=Z.value)||t.focus())})),(e,t)=>o((i(),s("section",{class:"chat-footer",style:r({cursor:a(ee).id?"default":"not-allowed"})},[a(ee).currentReferenceMsg?(i(),s("div",V,[l("div",F,[l("span",null,c(a(ee).currentReferenceMsg.senderName)+":",1),l("pre",{innerHTML:a(E)(a(ee).currentReferenceMsg.content)},null,8,K)]),u(a(v),{component:a(q),onClick:t[0]||(t[0]=()=>a(ee).currentReferenceMsg=null)},null,8,["component"])])):d("v-if",!0),l("div",G,[u(a(M),{show:oe.value,"onUpdate:show":t[1]||(t[1]=e=>oe.value=e),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show",delay:0},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[S])),_:1})])),default:f((()=>[l("div",H,[d(' <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> '),N,l("div",J,[(i(!0),s(p,null,m(a(j).default,(([e,t])=>(i(),g(a(C),{key:e,"show-arrow":!1,trigger:"hover"},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny",onClick:()=>function(e){oe.value=!1,ce({chatMessageType:T.EMOJI,msg:e})}(e)},{icon:f((()=>[l("img",{src:t},null,8,X)])),_:2},1032,["onClick"])])),default:f((()=>[y(" "+c(e),1)])),_:2},1024)))),128))])])])),_:1},8,["show"]),u(a(k),{quaternary:"",size:"tiny",onClick:t[2]||(t[2]=()=>ce({chatMessageType:a(T).EMOJI,msg:0}))},{icon:f((()=>[B])),_:1}),u(a(_),{abstract:"",multiple:"",accept:"image/*",onChange:t[3]||(t[3]=e=>ae(e,a(T).IMAGE))},{default:f((()=>[u(a(x),{abstract:""},{default:f((({handleClick:e})=>[u(a(k),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[P])),_:2},1032,["onClick"])])),_:1})])),_:1}),u(a(_),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:t[4]||(t[4]=e=>ae(e,a(T).FILE))},{default:f((()=>[u(a(x),{abstract:""},{default:f((({handleClick:e})=>[u(a(k),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[Q])),_:2},1032,["onClick"])])),_:1})])),_:1}),a(ne)?(i(),s(p,{key:0},[u(I,{options:a(ee).currentGroupUser,"default-value":[a(ee).userInfo.id],onComfirm:t[5]||(t[5]=e=>ie(a(T).AUDIO,e))},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[u(a(v),{size:"18",component:a(L)},null,8,["component"])])),_:1})])),_:1},8,["options","default-value"]),u(I,{options:a(ee).currentGroupUser,"default-value":[a(ee).userInfo.id],onComfirm:t[6]||(t[6]=e=>ie(a(T).VIDEO,e))},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[u(a(v),{size:"20",component:a(D)},null,8,["component"])])),_:1})])),_:1},8,["options","default-value"])],64)):(i(),s(p,{key:1},[u(a(k),{quaternary:"",size:"tiny",onClick:t[7]||(t[7]=()=>ie(a(T).AUDIO))},{icon:f((()=>[u(a(v),{size:"18",component:a(L)},null,8,["component"])])),_:1}),u(a(k),{quaternary:"",size:"tiny",onClick:t[8]||(t[8]=()=>ie(a(T).VIDEO))},{icon:f((()=>[u(a(v),{size:"20",component:a(D)},null,8,["component"])])),_:1})],64))]),o(l("div",{ref_key:"inputRef",ref:Z,class:"input-box",contenteditable:"",onKeydown:se,onInput:re},null,544),[[h,a(ee).id]]),l("div",W,[Y,u(a(k),{type:"primary",round:"",disabled:!$.value,onClick:le},{default:f((()=>[y("发送")])),_:1},8,["disabled"])])],4)),[[h,a(ee).id]])}});export{Z as default};
1
+ import{defineComponent as e,ref as t,watch as n,withDirectives as o,openBlock as i,createElementBlock as s,normalizeStyle as r,unref as a,createElementVNode as l,toDisplayString as c,createVNode as u,createCommentVNode as d,withCtx as f,Fragment as p,renderList as m,createBlock as g,createTextVNode as y,vShow as h}from"vue";import{NIcon as v,NPopover as M,NButton as k,NTooltip as C,NUpload as _,NUploadTrigger as x}from"naive-ui";import I from"./ChatAdd.vue.js";import{useState as b}from"../hooks/useState.js";import{useSession as w}from"../hooks/useSession.js";import{MESSAGE_TYPE as T,AV_STATUS as z}from"../constants/index.js";import"trtc-sdk-v5";import{simplifyMessage as E}from"../utils/index.js";import{emojis as j}from"../utils/emoji.js";import{uploadFileApi as R}from"../api/index.js";import{CloseCircleOutline as q,CallOutline as L,VideocamOutline as D}from"@vicons/ionicons5";import{xor as O,cloneDeep as A}from"lodash-es";import{uuidGenerator as U}from"../../../../shared/utils/index.js";const V={key:0,class:"reference-content-box"},F={class:"reference-content"},K=["innerHTML"],G={class:"tool-box"},S=l("i",{class:"chat--iconfont chat--icon-face"},null,-1),H={class:"emoji-box"},N=l("span",null,"默认表情",-1),J={class:"list-box"},X=["src"],B=l("i",{class:"chat--iconfont chat--icon-good"},null,-1),P=l("i",{class:"chat--iconfont chat--icon-image"},null,-1),Q=l("i",{class:"chat--iconfont chat--icon-folder"},null,-1),W={class:"btn-box"},Y=l("span",{class:"tip"},"Enter 发送, Shift + Enter 换行",-1);var Z=e({__name:"ChatFooter",setup(e){const Z=t(),$=t(""),{state:ee,sendMessage:te}=b(),{isGroupChat:ne}=w(ee),oe=t(!1);function ie(e,t=[]){const n=U(),o=[],i=t.length>0;ee.showVideo||ee.showMultipleVideo||(i?(o.push(...O(t,[ee.userInfo.id])),Object.assign(ee.currentAVMsg,{callMode:"call",checkedIds:o,strRoomId:n,chatMessageType:e}),ee.showMultipleVideo=!0):te({content:{chatMessageType:e,msg:"",avStatus:z.IN_CALL}}))}function se(e){["Enter"].includes(e.key)&&(function(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}(e)||(e.preventDefault(),le()))}function re(){var e,t;$.value=(null==(t=null==(e=Z.value)?void 0:e.innerText)?void 0:t.trim())||""}async function ae(e,t){const{file:n,name:o}=e.file,i=new FormData;i.append("sender",ee.userInfo.id),i.append("file",n);const s=await R(i);if(!s)return console.log("上传失败");ce({chatMessageType:t,msg:t===T.FILE?o:s,url:s})}function le(){if(!($.value.length>2e3))return $.value?void ce({msg:$.value}):console.log("请输入内容");console.log("请控制在2000字以内")}async function ce(e){const{chatMessageType:t=T.TEXT,msg:n,url:o}=e,i={msg:n,chatMessageType:t};t===T.FILE&&(i.fileUrl=o),[T.TEXT,T.BLEND].includes(t)&&(Z.value.innerHTML="",$.value=""),ee.currentReferenceMsg&&(i.referenceContent=A(ee.currentReferenceMsg),ee.currentReferenceMsg=null),te({content:i})}return n((()=>ee.currentReferenceMsg),(e=>{var t;e&&(null==(t=Z.value)||t.focus())})),(e,t)=>o((i(),s("section",{class:"chat-footer",style:r({cursor:a(ee).id?"default":"not-allowed"})},[a(ee).currentReferenceMsg?(i(),s("div",V,[l("div",F,[l("span",null,c(a(ee).currentReferenceMsg.senderName)+":",1),l("pre",{innerHTML:a(E)(a(ee).currentReferenceMsg.content)},null,8,K)]),u(a(v),{component:a(q),onClick:t[0]||(t[0]=()=>a(ee).currentReferenceMsg=null)},null,8,["component"])])):d("v-if",!0),l("div",G,[u(a(M),{show:oe.value,"onUpdate:show":t[1]||(t[1]=e=>oe.value=e),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show",delay:0},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[S])),_:1})])),default:f((()=>[l("div",H,[d(' <span>最近使用</span>\r\n\t\t\t\t\t<div class="list-box">\r\n\t\t\t\t\t\t<template v-for="(img, index) in images" :key="index">\r\n\t\t\t\t\t\t\t<i>\r\n\t\t\t\t\t\t\t\t<img :src="img" />\r\n\t\t\t\t\t\t\t</i>\r\n\t\t\t\t\t\t</template>\r\n\t\t\t\t\t</div> '),N,l("div",J,[(i(!0),s(p,null,m(a(j).default,(([e,t])=>(i(),g(a(C),{key:e,"show-arrow":!1,trigger:"hover"},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny",onClick:()=>function(e){oe.value=!1,ce({chatMessageType:T.EMOJI,msg:e})}(e)},{icon:f((()=>[l("img",{src:t},null,8,X)])),_:2},1032,["onClick"])])),default:f((()=>[y(" "+c(e),1)])),_:2},1024)))),128))])])])),_:1},8,["show"]),u(a(k),{quaternary:"",size:"tiny",onClick:t[2]||(t[2]=()=>ce({chatMessageType:a(T).EMOJI,msg:0}))},{icon:f((()=>[B])),_:1}),u(a(_),{abstract:"",multiple:"",accept:"image/*",onChange:t[3]||(t[3]=e=>ae(e,a(T).IMAGE))},{default:f((()=>[u(a(x),{abstract:""},{default:f((({handleClick:e})=>[u(a(k),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[P])),_:2},1032,["onClick"])])),_:1})])),_:1}),u(a(_),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:t[4]||(t[4]=e=>ae(e,a(T).FILE))},{default:f((()=>[u(a(x),{abstract:""},{default:f((({handleClick:e})=>[u(a(k),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[Q])),_:2},1032,["onClick"])])),_:1})])),_:1}),a(ne)?(i(),s(p,{key:0},[u(I,{options:a(ee).currentGroupUser,"default-value":[a(ee).userInfo.id],onComfirm:t[5]||(t[5]=e=>ie(a(T).AUDIO,e))},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[u(a(v),{size:"18",component:a(L)},null,8,["component"])])),_:1})])),_:1},8,["options","default-value"]),u(I,{options:a(ee).currentGroupUser,"default-value":[a(ee).userInfo.id],onComfirm:t[6]||(t[6]=e=>ie(a(T).VIDEO,e))},{trigger:f((()=>[u(a(k),{quaternary:"",size:"tiny"},{icon:f((()=>[u(a(v),{size:"20",component:a(D)},null,8,["component"])])),_:1})])),_:1},8,["options","default-value"])],64)):(i(),s(p,{key:1},[u(a(k),{quaternary:"",size:"tiny",onClick:t[7]||(t[7]=()=>ie(a(T).AUDIO))},{icon:f((()=>[u(a(v),{size:"18",component:a(L)},null,8,["component"])])),_:1}),u(a(k),{quaternary:"",size:"tiny",onClick:t[8]||(t[8]=()=>ie(a(T).VIDEO))},{icon:f((()=>[u(a(v),{size:"20",component:a(D)},null,8,["component"])])),_:1})],64))]),o(l("div",{ref_key:"inputRef",ref:Z,class:"input-box",contenteditable:"",onKeydown:se,onInput:re},null,544),[[h,a(ee).id]]),l("div",W,[Y,u(a(k),{type:"primary",round:"",disabled:!$.value,onClick:le},{default:f((()=>[y("发送")])),_:1},8,["disabled"])])],4)),[[h,a(ee).id]])}});export{Z as default};
@@ -10,7 +10,8 @@ declare const _default: import("vue").DefineComponent<{}, {
10
10
  isGroupChat: import("vue").ComputedRef<boolean>;
11
11
  contextmenuRef: import("vue").Ref<any>;
12
12
  showMenu: import("vue").Ref<boolean>;
13
- contextmenuPosition: any;
13
+ menuPosition: any;
14
+ menuMsgId: import("vue").Ref<any>;
14
15
  pageInfo: {
15
16
  page: number;
16
17
  hasMore: boolean;
@@ -20,19 +21,9 @@ declare const _default: import("vue").DefineComponent<{}, {
20
21
  '--c-tip-top': string;
21
22
  '--c-tip-gap': string;
22
23
  }>;
23
- chatMainBounding: import("vue").ComputedRef<{
24
- height: import("vue").Ref<number>;
25
- bottom: import("vue").Ref<number>;
26
- left: import("vue").Ref<number>;
27
- right: import("vue").Ref<number>;
28
- top: import("vue").Ref<number>;
29
- width: import("vue").Ref<number>;
30
- x: import("vue").Ref<number>;
31
- y: import("vue").Ref<number>;
32
- update: () => void;
33
- }>;
34
24
  getHistoryRecord: () => Promise<void>;
35
- handleContextmenu: (event: MouseEvent) => Promise<void>;
25
+ handleContextmenu: (event: MouseEvent, msgId: string) => Promise<void>;
26
+ setMenuPosition: (event: MouseEvent) => Promise<void>;
36
27
  showMessage: (item: AnyObject) => boolean;
37
28
  showTemplateMsg: (item: AnyObject, type: 'system' | 'template') => boolean | undefined;
38
29
  isTemplate3: (content: AnyObject) => boolean;
@@ -206,10 +197,10 @@ declare const _default: import("vue").DefineComponent<{}, {
206
197
  position: {
207
198
  type: import("vue").PropType<CSSProperties>;
208
199
  };
209
- exclude: {
210
- type: import("vue").PropType<string[]>;
200
+ msgId: {
201
+ type: StringConstructor;
211
202
  };
212
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:show")[], "select" | "update:show", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
203
+ }, () => JSX.Element | null, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:show")[], "select" | "update:show", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
213
204
  show: {
214
205
  type: BooleanConstructor;
215
206
  default: boolean;
@@ -217,8 +208,8 @@ declare const _default: import("vue").DefineComponent<{}, {
217
208
  position: {
218
209
  type: import("vue").PropType<CSSProperties>;
219
210
  };
220
- exclude: {
221
- type: import("vue").PropType<string[]>;
211
+ msgId: {
212
+ type: StringConstructor;
222
213
  };
223
214
  }>> & {
224
215
  onSelect?: ((...args: any[]) => any) | undefined;
@@ -232,7 +223,6 @@ declare const _default: import("vue").DefineComponent<{}, {
232
223
  getAVTime: typeof getAVTime;
233
224
  MESSAGE_TYPE: typeof MESSAGE_TYPE;
234
225
  ChatbubbleEllipsesOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
235
- EllipsisHorizontal: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
236
226
  CallOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
237
227
  VideocamOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
238
228
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,computed as n,watch as s,openBlock as o,createElementBlock as i,normalizeClass as a,unref as r,normalizeStyle as l,createVNode as c,withCtx as u,Fragment as m,renderList as p,toDisplayString as d,createCommentVNode as v,createBlock as f,createElementVNode as g,withModifiers as y,nextTick as h}from"vue";import{NImageGroup as T,NAvatar as M,NImage as _,NIcon as k,NButtonGroup as x,NButton as I}from"naive-ui";import{useElementBounding as S}from"@vueuse/core";import{format as j}from"date-fns";import{getHistoryRecordApi as L,readMessageApi as C}from"../api/index.js";import{useState as E}from"../hooks/useState.js";import{useSession as w}from"../hooks/useSession.js";import{MESSAGE_TYPE as A}from"../constants/index.js";import"trtc-sdk-v5";import{isAudioOrVideoMessage as b,simplifyMessage as H,getAVTime as D,downloadFile as O}from"../utils/index.js";import{first as P,last as z}from"lodash-es";import N from"./PersonProfile.vue.js";import R from"./MessageTemplate.vue.js";import{emojis as U}from"../utils/emoji.js";import q from"./ContextMenu.js";import{useScrollLoading as G}from"../hooks/useScrollLoading.js";import{CallOutline as J,VideocamOutline as K,ChatbubbleEllipsesOutline as X,EllipsisHorizontal as B}from"@vicons/ionicons5";const F={key:0,class:"time"},Y={key:2,class:"message-box"},$={key:0,class:"content-box"},Q={class:"name-box"},V=["data-time"],W=["onContextmenu"],Z={key:0,class:"reference-content"},ee=["innerHTML"],te=["innerHTML"],ne=["src"],se={style:{"margin-left":"8px"}},oe=["href","onClick"],ie=g("i",{class:"chat--iconfont chat--icon-face"},null,-1);var ae=e({__name:"ChatMain",setup(e){const ae=t(),{state:re,setMsgList:le}=E(),{setCurrentSessionItem:ce,isGroupChat:ue}=w(re),me=t(),pe=t(!1),de=t({left:0,top:0}),ve={page:0,hasMore:!0,lastSendTime:j(new Date,"yyyy-MM-dd HH:mm:ss")},fe=n((()=>({"--c-tip-top":ue.value?"1px":"-20px","--c-tip-gap":ue.value?"10px":"0px"}))),ge=n((()=>S(ae.value)));async function ye(){try{if(!ve.hasMore)return;ve.page++;const e=await L({sessionKey:re.currentSessionItem.sessionKey,page:ve.page,lastSendTime:ve.lastSendTime});if(!Array.isArray(e)||0===e.length)return ve.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=P(e).id;ve.lastSendTime=z(e).sendTime,le(ve.page>1?[...e,...re.msgList]:e),1===ve.page&&re.currentSessionItem.unreadNum&&(await C({chatType:re.currentSessionItem.chatType,messageIdSet:[t],receiver:re.userInfo.id,sender:re.currentSessionItem.receiver}),ce({unreadNum:0}))}catch(e){console.log(e)}}async function he(e){var t,n,s,o,i;pe.value=!0,await h();const{clientX:a,clientY:r}=e,{width:l,height:c,left:u,top:m}=ge.value,p=null!=(s=null==(n=null==(t=me.value)?void 0:t.$el)?void 0:n.getBoundingClientRect().height)?s:220,d=null!=(i=null==(o=ae.value)?void 0:o.scrollTop)?i:0,v={};a<=u.value+l.value/2?v.left=a-u.value+5+"px":v.right=u.value+l.value-a-5+"px",r-m.value<p/2?v.top=d+5+"px":m.value+c.value-r<=p/2?v.bottom=Math.abs(d)+5+"px":v.top=d+r-m.value-p/2+"px",de.value=v}function Te(e){const{chatMessageType:t,messageTemplate:n}=e.content;return t!==A.TEMPLATE||!!n}function Me(e,t){var n,s;const{chatMessageType:o,messageTemplate:i}=e.content;if(o===A.TEMPLATE)return"system"===t?2==(null==(n=null==i?void 0:i.setting)?void 0:n.style.id):2!=(null==(s=null==i?void 0:i.setting)?void 0:s.style.id)}function _e(e){var t,n;const{chatMessageType:s,messageTemplate:o}=e;return s===A.TEMPLATE&&3==(null==(n=null==(t=null==o?void 0:o.setting)?void 0:t.style)?void 0:n.id)}function ke(e,t){var n;const s=new Date(e.sendTime).getTime(),o=null==(n=re.msgList[t+1])?void 0:n.sendTime;if(o){return s-new Date(o).getTime()>3e5}return!0}return G(ae,(()=>{ye()}),"top",(()=>{pe.value=!1})),s((()=>re.id),(e=>{e&&(Object.assign(ve,{page:0,hasMore:!0,lastSendTime:j(new Date,"yyyy-MM-dd HH:mm:ss")}),ye())}),{immediate:!0}),s((()=>re.isAppendMsg),(e=>{e&&(le([...re.msgList,re.currentMsg]),re.isAppendMsg=!1,async function(){var e,t,n;const s=null!=(t=null==(e=ae.value)?void 0:e.scrollHeight)?t:0;null==(n=ae.value)||n.scrollTo({top:s,behavior:"auto"})}())}),{immediate:!0}),(e,t)=>(o(),i("div",{class:a(["chat-main",{"home-bg":!r(re).id}]),ref_key:"chatMainRef",ref:ae,style:l(r(fe))},[c(r(T),{"show-toolbar-tooltip":""},{default:u((()=>[(o(!0),i(m,null,p(r(re).msgList,((e,t)=>(o(),i(m,{key:e.id},[Te(e)?(o(),i("div",{key:0,class:a(["message-item",{"message-item--mine":e.sender==r(re).userInfo.id}])},[ke(e,t)?(o(),i("p",F,d(e.__sendTime),1)):v("v-if",!0),Me(e,"system")?(o(),f(R,{key:1,data:e},null,8,["data"])):(o(),i("div",Y,[c(N,{"user-id":e.sender},{trigger:u((()=>[c(r(M),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id"]),e.content?(o(),i("div",$,[g("div",Q,[g("span",{class:"name","data-time":e.__time},d(r(ue)?e.senderName:""),9,V)]),g("div",{class:a(["content",{emoji:e.content.chatMessageType===r(A).EMOJI,template:e.content.chatMessageType===r(A).TEMPLATE,"template--3":_e(e.content),"audio-video":r(b)(e.content)}]),onContextmenu:y(he,["prevent"])},[e.content.chatMessageType===r(A).TEXT?(o(),i(m,{key:0},[e.content.referenceContent?(o(),i("div",Z,[g("span",null,d(e.content.referenceContent.senderName)+":",1),g("pre",{innerHTML:r(H)(e.content.referenceContent.content)},null,8,ee)])):v("v-if",!0),g("pre",{innerHTML:e.__content},null,8,te)],64)):v("v-if",!0),e.content.chatMessageType===r(A).EMOJI?(o(),i("img",{key:1,src:r(U).findEmoji(e.__content)},null,8,ne)):v("v-if",!0),Me(e,"template")?(o(),f(R,{key:2,data:e},null,8,["data"])):v("v-if",!0),e.content.chatMessageType===r(A).IMAGE?(o(),f(r(_),{key:3,width:"240",src:e.__content},null,8,["src"])):v("v-if",!0),r(b)(e.content)?(o(),i(m,{key:4},[c(r(k),{class:a({"is-audio":e.content.chatMessageType===r(A).AUDIO}),component:e.content.chatMessageType===r(A).AUDIO?r(J):r(K)},null,8,["class","component"]),g("span",se,d(r(D)(e.__content)),1)],64)):v("v-if",!0),e.content.chatMessageType===r(A).FILE?(o(),i("a",{key:5,href:e.content.fileUrl,onClick:y((()=>r(O)(e.content.fileUrl,e.__content)),["prevent"])},d(e.__content),9,oe)):v("v-if",!0),c(r(x),{class:"quick-menu"},{default:u((()=>[c(r(I),{quaternary:"",size:"tiny"},{icon:u((()=>[ie])),_:1}),c(r(I),{quaternary:"",size:"tiny",onClick:()=>{return t=e,re.currentReferenceMsg=t,void Object.assign(re.currentReferenceMsg,{chatType:re.currentSessionItem.chatType,receiver:re.currentSessionItem.receiver,receiverAvatar:re.currentSessionItem.avatar,receiverName:re.currentSessionItem.name});var t}},{icon:u((()=>[c(r(k),{size:"17",component:r(X)},null,8,["component"])])),_:2},1032,["onClick"]),c(r(I),{quaternary:"",size:"tiny"},{icon:u((()=>[c(r(k),{component:r(B)},null,8,["component"])])),_:1})])),_:2},1024)],42,W)])):v("v-if",!0)]))],2)):v("v-if",!0)],64)))),128))])),_:1}),c(r(q),{ref_key:"contextmenuRef",ref:me,show:pe.value,"onUpdate:show":t[0]||(t[0]=e=>pe.value=e),position:de.value},null,8,["show","position"])],6))}});export{ae as default};
1
+ import{defineComponent as e,ref as t,computed as n,watch as s,openBlock as o,createElementBlock as i,normalizeClass as a,unref as r,normalizeStyle as c,createVNode as l,withCtx as m,Fragment as u,renderList as p,toDisplayString as d,createCommentVNode as f,createBlock as v,createElementVNode as y,withModifiers as g}from"vue";import{NImageGroup as T,NAvatar as h,NImage as M,NIcon as k,NButtonGroup as _,NButton as I}from"naive-ui";import{format as S}from"date-fns";import{getHistoryRecordApi as x,readMessageApi as j}from"../api/index.js";import{useState as E}from"../hooks/useState.js";import{useSession as L}from"../hooks/useSession.js";import{MESSAGE_TYPE as A}from"../constants/index.js";import"trtc-sdk-v5";import{isAudioOrVideoMessage as C,simplifyMessage as b,getAVTime as w,downloadFile as H}from"../utils/index.js";import{first as z,last as D}from"lodash-es";import O from"./PersonProfile.vue.js";import P from"./MessageTemplate.vue.js";import{emojis as N}from"../utils/emoji.js";import U from"./ContextMenu.js";import{useScrollLoading as q}from"../hooks/useScrollLoading.js";import{CallOutline as R,VideocamOutline as G,ChatbubbleEllipsesOutline as J}from"@vicons/ionicons5";const K={key:0,class:"time"},F={key:2,class:"message-box"},X={key:0,class:"content-box"},B={class:"name-box"},Q=["data-time"],V=["onContextmenu"],W={key:0,class:"reference-content"},Y=["innerHTML"],Z=["innerHTML"],$=["src"],ee={style:{"margin-left":"8px"}},te=["href","onClick"];var ne=e({__name:"ChatMain",setup(e){const ne=t(),{state:se,setMsgList:oe}=E(),{setCurrentSessionItem:ie,isGroupChat:ae}=L(se),re=t(),ce=t(!1),le=t({left:0,top:0}),me=t(),ue={page:0,hasMore:!0,lastSendTime:S(new Date,"yyyy-MM-dd HH:mm:ss")},pe=n((()=>({"--c-tip-top":ae.value?"1px":"-20px","--c-tip-gap":ae.value?"10px":"0px"})));async function de(){try{if(!ue.hasMore)return;ue.page++;const e=await x({sessionKey:se.currentSessionItem.sessionKey,page:ue.page,lastSendTime:ue.lastSendTime});if(!Array.isArray(e)||0===e.length)return ue.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=z(e).id;ue.lastSendTime=D(e).sendTime,oe(ue.page>1?[...e,...se.msgList]:e),1===ue.page&&se.currentSessionItem.unreadNum&&(await j({chatType:se.currentSessionItem.chatType,messageIdSet:[t],receiver:se.userInfo.id,sender:se.currentSessionItem.receiver}),ie({unreadNum:0}))}catch(e){console.log(e)}}function fe(e){const{chatMessageType:t,messageTemplate:n}=e.content;return t!==A.TEMPLATE||!!n}function ve(e,t){var n,s;const{chatMessageType:o,messageTemplate:i}=e.content;if(o===A.TEMPLATE)return"system"===t?2==(null==(n=null==i?void 0:i.setting)?void 0:n.style.id):2!=(null==(s=null==i?void 0:i.setting)?void 0:s.style.id)}function ye(e){var t,n;const{chatMessageType:s,messageTemplate:o}=e;return s===A.TEMPLATE&&3==(null==(n=null==(t=null==o?void 0:o.setting)?void 0:t.style)?void 0:n.id)}function ge(e,t){var n;const s=new Date(e.sendTime).getTime(),o=null==(n=se.msgList[t+1])?void 0:n.sendTime;if(o){return s-new Date(o).getTime()>3e5}return!0}return q(ne,(()=>{de()}),"top",(()=>{ce.value=!1})),s((()=>se.id),(e=>{e&&(Object.assign(ue,{page:0,hasMore:!0,lastSendTime:S(new Date,"yyyy-MM-dd HH:mm:ss")}),de())}),{immediate:!0}),s((()=>se.isAppendMsg),(e=>{e&&(oe([...se.msgList,se.currentMsg]),se.isAppendMsg=!1,async function(){var e,t,n;const s=null!=(t=null==(e=ne.value)?void 0:e.scrollHeight)?t:0;null==(n=ne.value)||n.scrollTo({top:s,behavior:"auto"})}())}),{immediate:!0}),(e,t)=>(o(),i("div",{class:a(["chat-main",{"home-bg":!r(se).id}]),ref_key:"chatMainRef",ref:ne,style:c(r(pe))},[l(r(T),{"show-toolbar-tooltip":""},{default:m((()=>[(o(!0),i(u,null,p(r(se).msgList,((e,t)=>(o(),i(u,{key:e.id},[fe(e)?(o(),i("div",{key:0,class:a(["message-item",{"message-item--mine":e.sender==r(se).userInfo.id}])},[ge(e,t)?(o(),i("p",K,d(e.__sendTime),1)):f("v-if",!0),ve(e,"system")?(o(),v(P,{key:1,data:e},null,8,["data"])):(o(),i("div",F,[l(O,{"user-id":e.sender},{trigger:m((()=>[l(r(h),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id"]),e.content?(o(),i("div",X,[y("div",B,[y("span",{class:"name","data-time":e.__time},d(r(ae)?e.senderName:""),9,Q)]),y("div",{class:a(["content",{emoji:e.content.chatMessageType===r(A).EMOJI,template:e.content.chatMessageType===r(A).TEMPLATE,"template--3":ye(e.content),"audio-video":r(C)(e.content)}]),onContextmenu:g((t=>async function(e,t){}(0,e.id)),["prevent"])},[e.content.chatMessageType===r(A).TEXT?(o(),i(u,{key:0},[e.content.referenceContent?(o(),i("div",W,[y("span",null,d(e.content.referenceContent.senderName)+":",1),y("pre",{innerHTML:r(b)(e.content.referenceContent.content)},null,8,Y)])):f("v-if",!0),y("pre",{innerHTML:e.__content},null,8,Z)],64)):f("v-if",!0),e.content.chatMessageType===r(A).EMOJI?(o(),i("img",{key:1,src:r(N).findEmoji(e.__content)},null,8,$)):f("v-if",!0),ve(e,"template")?(o(),v(P,{key:2,data:e},null,8,["data"])):f("v-if",!0),e.content.chatMessageType===r(A).IMAGE?(o(),v(r(M),{key:3,width:"240",src:e.__content},null,8,["src"])):f("v-if",!0),r(C)(e.content)?(o(),i(u,{key:4},[l(r(k),{class:a({"is-audio":e.content.chatMessageType===r(A).AUDIO}),component:e.content.chatMessageType===r(A).AUDIO?r(R):r(G)},null,8,["class","component"]),y("span",ee,d(r(w)(e.__content)),1)],64)):f("v-if",!0),e.content.chatMessageType===r(A).FILE?(o(),i("a",{key:5,href:e.content.fileUrl,onClick:g((()=>r(H)(e.content.fileUrl,e.__content)),["prevent"])},d(e.__content),9,te)):f("v-if",!0),l(r(_),{class:"quick-menu"},{default:m((()=>[f(' <n-button quaternary size="tiny">\r\n\t\t\t\t\t\t\t\t\t\t\t<template #icon>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<i class="chat--iconfont chat--icon-face" />\r\n\t\t\t\t\t\t\t\t\t\t\t</template>\r\n\t\t\t\t\t\t\t\t\t\t</n-button> '),l(r(I),{quaternary:"",size:"tiny",onClick:()=>{return t=e,se.currentReferenceMsg=t,void Object.assign(se.currentReferenceMsg,{chatType:se.currentSessionItem.chatType,receiver:se.currentSessionItem.receiver,receiverAvatar:se.currentSessionItem.avatar,receiverName:se.currentSessionItem.name});var t}},{icon:m((()=>[l(r(k),{size:"17",component:r(J)},null,8,["component"])])),_:2},1032,["onClick"]),f(' <n-button quaternary size="tiny">\r\n\t\t\t\t\t\t\t\t\t\t\t<template #icon>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<n-icon :component="EllipsisHorizontal" />\r\n\t\t\t\t\t\t\t\t\t\t\t</template>\r\n\t\t\t\t\t\t\t\t\t\t</n-button> ')])),_:2},1024)],42,V)])):f("v-if",!0)]))],2)):f("v-if",!0)],64)))),128))])),_:1}),l(r(U),{ref_key:"contextmenuRef",ref:re,show:ce.value,"onUpdate:show":t[0]||(t[0]=e=>ce.value=e),position:le.value,"msg-id":me.value},null,8,["show","position","msg-id"])],6))}});export{ne as default};
@@ -7,10 +7,10 @@ declare const _default: import("vue").DefineComponent<{
7
7
  position: {
8
8
  type: PropType<CSSProperties>;
9
9
  };
10
- exclude: {
11
- type: PropType<string[]>;
10
+ msgId: {
11
+ type: StringConstructor;
12
12
  };
13
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:show")[], "select" | "update:show", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
13
+ }, () => JSX.Element | null, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:show")[], "select" | "update:show", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
14
14
  show: {
15
15
  type: BooleanConstructor;
16
16
  default: boolean;
@@ -18,8 +18,8 @@ declare const _default: import("vue").DefineComponent<{
18
18
  position: {
19
19
  type: PropType<CSSProperties>;
20
20
  };
21
- exclude: {
22
- type: PropType<string[]>;
21
+ msgId: {
22
+ type: StringConstructor;
23
23
  };
24
24
  }>> & {
25
25
  onSelect?: ((...args: any[]) => any) | undefined;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,computed as o,withDirectives as l,createVNode as r,vShow as n,isVNode as i}from"vue";import{NButtonGroup as a,NButton as c,NIcon as u}from"naive-ui";import{CopyOutline as p,OpenOutline as s,ChatbubbleEllipsesOutline as y,ReorderFourOutline as d,ReturnDownBack as m,DownloadOutline as v}from"@vicons/ionicons5";import{onClickOutside as f}from"@vueuse/core";var b=e({name:"PopupMenu",inheritAttrs:!1,props:{show:{type:Boolean,default:!1},position:{type:Object},exclude:{type:Array}},emits:["update:show","select"],setup(e,{attrs:b,slots:k,emit:w}){const h=[{icon:p,label:"复制",key:"copy"},{icon:s,label:"转发",key:"relay"},{icon:y,label:"回复",key:"reply"},{icon:d,label:"多选",key:"multiSelect"},{icon:m,label:"撤回",key:"withdraw"},{icon:v,label:"下载",key:"download"}],x=t(null),j=o((()=>{var t;return(null==(t=e.exclude)?void 0:t.length)?h.filter((t=>{var o;return!(null==(o=e.exclude)?void 0:o.includes(t.key))})):h}));return f(x,(e=>{w("update:show",!1)})),()=>{let t;return l(r("div",{class:"contextmenu-wrapper",ref:x,style:e.position},[r(a,{vertical:!0},(o=t=j.value.map((e=>{return r(c,{onClick:(t=e.key,void w("select",t)),quaternary:!0},{default:()=>e.label,icon:()=>r(u,{component:e.icon},null)});var t})),"function"==typeof o||"[object Object]"===Object.prototype.toString.call(o)&&!i(o)?t:{default:()=>[t]}))]),[[n,e.show]]);var o}}});export{b as default};
1
+ import{defineComponent as e,ref as t,computed as o,withDirectives as n,createVNode as s,vShow as i,isVNode as l}from"vue";import{NButtonGroup as r,NButton as a,NIcon as p}from"naive-ui";import{CopyOutline as u,OpenOutline as c,ChatbubbleEllipsesOutline as d,ReorderFourOutline as m,ReturnDownBack as y,DownloadOutline as f}from"@vicons/ionicons5";import{onClickOutside as h}from"@vueuse/core";import{useState as v}from"../hooks/useState.js";import{isAudioOrVideoMessage as w}from"../utils/index.js";import"lodash-es";import{MESSAGE_TYPE as b}from"../constants/index.js";import"../api/index.js";import"trtc-sdk-v5";import{isSameMonth as k}from"date-fns";var g=e({name:"PopupMenu",inheritAttrs:!1,props:{show:{type:Boolean,default:!1},position:{type:Object},msgId:{type:String}},emits:["update:show","select"],setup(e,{attrs:g,slots:j,emit:E}){const{state:T,setMsgList:I}=v(),L=[{icon:u,label:"复制",key:"copy"},{icon:c,label:"转发",key:"relay"},{icon:d,label:"回复",key:"reply"},{icon:m,label:"多选",key:"multiSelect"},{icon:y,label:"撤回",key:"withdraw"},{icon:f,label:"下载",key:"download"}],M=t(null),x=o((()=>T.msgList.find((({id:t})=>t===e.msgId)))),O=o((()=>{if(!e.msgId)return[];if(!(null==x?void 0:x.value))return[];const{content:t={},sendTime:o,sender:n}=x.value,{chatMessageType:s}=t,i=[];return(n!==T.userInfo.id&&k(new Date(o),new Date)||s===b.TEMPLATE)&&i.push("withdraw"),[b.TEXT,b.EMOJI,b.BLEND].includes(s)?i.push("download"):w(t)?i.push("copy","relay","download"):s===b.FILE?i.push("copy"):[b.FORWARD,b.TEMPLATE].includes(s)&&i.push("copy","download"),i.length?L.filter((e=>!i.includes(e.key))):L}));return h(M,(e=>{E("update:show",!1)})),()=>{let t;return e.msgId&&O.value?n(s("div",{class:"contextmenu-wrapper",ref:M,style:e.position},[s(r,{vertical:!0},(o=t=O.value.map((e=>s(a,{onClick:()=>{return t=e.key,E("update:show",!1),x.value,void E("select",t);var t},quaternary:!0},{default:()=>e.label,icon:()=>s(p,{component:e.icon},null)}))),"function"==typeof o||"[object Object]"===Object.prototype.toString.call(o)&&!l(o)?t:{default:()=>[t]}))]),[[i,e.show]]):null;var o}}});export{g as default};