cnhis-design-vue 3.2.7-beta.29 → 3.2.7-beta.30

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/button-print/index.d.ts +26 -0
  3. package/es/components/button-print/src/ButtonPrint.vue.d.ts +26 -0
  4. package/es/components/button-print/src/ButtonPrint.vue2.js +1 -1
  5. package/es/components/button-print/src/components/OldPrintComponent.vue.d.ts +9 -0
  6. package/es/components/button-print/src/components/OldPrintComponent.vue2.js +1 -1
  7. package/es/components/iho-chat/index.d.ts +2 -0
  8. package/es/components/iho-chat/src/Index.vue.d.ts +2 -0
  9. package/es/components/iho-chat/src/components/ChatFooter.vue.d.ts +1 -0
  10. package/es/components/iho-chat/src/components/ChatFooter.vue2.js +1 -1
  11. package/es/components/iho-chat/src/components/ChatSet.vue2.js +1 -1
  12. package/es/components/iho-chat/src/components/SiderList.vue.d.ts +1 -0
  13. package/es/components/iho-chat/src/components/SiderList.vue2.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/select-label/src/LabelFormContent.vue2.js +1 -1
  17. package/es/components/steps-wheel/index.d.ts +1 -1
  18. package/es/components/steps-wheel/src/StepsWheel.vue.d.ts +1 -1
  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
+ ```
@@ -98,6 +98,10 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
98
98
  type: ObjectConstructor;
99
99
  default: () => {};
100
100
  };
101
+ placement: {
102
+ type: StringConstructor;
103
+ default: string;
104
+ };
101
105
  newPrintSetting: {
102
106
  type: ObjectConstructor;
103
107
  default: () => {};
@@ -203,6 +207,10 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
203
207
  type: ObjectConstructor;
204
208
  default: () => {};
205
209
  };
210
+ placement: {
211
+ type: StringConstructor;
212
+ default: string;
213
+ };
206
214
  newPrintSetting: {
207
215
  type: ObjectConstructor;
208
216
  default: () => {};
@@ -929,6 +937,9 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
929
937
  type: ObjectConstructor;
930
938
  default: () => {};
931
939
  };
940
+ placement: {
941
+ type: StringConstructor;
942
+ };
932
943
  }, {
933
944
  $attrs: {
934
945
  [x: string]: unknown;
@@ -1034,6 +1045,9 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
1034
1045
  type: ObjectConstructor;
1035
1046
  default: () => {};
1036
1047
  };
1048
+ placement: {
1049
+ type: StringConstructor;
1050
+ };
1037
1051
  }>> & {}>>;
1038
1052
  emit: any;
1039
1053
  defaultFormatInfo: import("../../shared/types").AnyObject;
@@ -1367,6 +1381,9 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
1367
1381
  type: ObjectConstructor;
1368
1382
  default: () => {};
1369
1383
  };
1384
+ placement: {
1385
+ type: StringConstructor;
1386
+ };
1370
1387
  }>>, {
1371
1388
  params: import("../../shared/types").AnyObject[];
1372
1389
  btnText: string;
@@ -1490,6 +1507,10 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
1490
1507
  type: ObjectConstructor;
1491
1508
  default: () => {};
1492
1509
  };
1510
+ placement: {
1511
+ type: StringConstructor;
1512
+ default: string;
1513
+ };
1493
1514
  newPrintSetting: {
1494
1515
  type: ObjectConstructor;
1495
1516
  default: () => {};
@@ -1602,6 +1623,10 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
1602
1623
  type: ObjectConstructor;
1603
1624
  default: () => {};
1604
1625
  };
1626
+ placement: {
1627
+ type: StringConstructor;
1628
+ default: string;
1629
+ };
1605
1630
  newPrintSetting: {
1606
1631
  type: ObjectConstructor;
1607
1632
  default: () => {};
@@ -1637,6 +1662,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
1637
1662
  hideButtons: unknown[];
1638
1663
  printCopies: number;
1639
1664
  printCustomProps: Record<string, any>;
1665
+ placement: string;
1640
1666
  newPrintSetting: Record<string, any>;
1641
1667
  }>>;
1642
1668
  export default ButtonPrint;
@@ -101,6 +101,10 @@ declare const _default: import("vue").DefineComponent<{
101
101
  type: ObjectConstructor;
102
102
  default: () => {};
103
103
  };
104
+ placement: {
105
+ type: StringConstructor;
106
+ default: string;
107
+ };
104
108
  newPrintSetting: {
105
109
  type: ObjectConstructor;
106
110
  default: () => {};
@@ -209,6 +213,10 @@ declare const _default: import("vue").DefineComponent<{
209
213
  type: ObjectConstructor;
210
214
  default: () => {};
211
215
  };
216
+ placement: {
217
+ type: StringConstructor;
218
+ default: string;
219
+ };
212
220
  newPrintSetting: {
213
221
  type: ObjectConstructor;
214
222
  default: () => {};
@@ -935,6 +943,9 @@ declare const _default: import("vue").DefineComponent<{
935
943
  type: ObjectConstructor;
936
944
  default: () => {};
937
945
  };
946
+ placement: {
947
+ type: StringConstructor;
948
+ };
938
949
  }, {
939
950
  $attrs: {
940
951
  [x: string]: unknown;
@@ -1040,6 +1051,9 @@ declare const _default: import("vue").DefineComponent<{
1040
1051
  type: ObjectConstructor;
1041
1052
  default: () => {};
1042
1053
  };
1054
+ placement: {
1055
+ type: StringConstructor;
1056
+ };
1043
1057
  }>> & {}>>;
1044
1058
  emit: any;
1045
1059
  defaultFormatInfo: AnyObject;
@@ -1373,6 +1387,9 @@ declare const _default: import("vue").DefineComponent<{
1373
1387
  type: ObjectConstructor;
1374
1388
  default: () => {};
1375
1389
  };
1390
+ placement: {
1391
+ type: StringConstructor;
1392
+ };
1376
1393
  }>>, {
1377
1394
  params: AnyObject[];
1378
1395
  btnText: string;
@@ -1499,6 +1516,10 @@ declare const _default: import("vue").DefineComponent<{
1499
1516
  type: ObjectConstructor;
1500
1517
  default: () => {};
1501
1518
  };
1519
+ placement: {
1520
+ type: StringConstructor;
1521
+ default: string;
1522
+ };
1502
1523
  newPrintSetting: {
1503
1524
  type: ObjectConstructor;
1504
1525
  default: () => {};
@@ -1614,6 +1635,10 @@ declare const _default: import("vue").DefineComponent<{
1614
1635
  type: ObjectConstructor;
1615
1636
  default: () => {};
1616
1637
  };
1638
+ placement: {
1639
+ type: StringConstructor;
1640
+ default: string;
1641
+ };
1617
1642
  newPrintSetting: {
1618
1643
  type: ObjectConstructor;
1619
1644
  default: () => {};
@@ -1649,6 +1674,7 @@ declare const _default: import("vue").DefineComponent<{
1649
1674
  hideButtons: unknown[];
1650
1675
  printCopies: number;
1651
1676
  printCustomProps: Record<string, any>;
1677
+ placement: string;
1652
1678
  newPrintSetting: Record<string, any>;
1653
1679
  }>;
1654
1680
  export default _default;
@@ -1 +1 @@
1
- import{defineComponent as t,useAttrs as e,ref as r,computed as n,provide as i,openBlock as o,createBlock as a,resolveDynamicComponent as p,unref as u,mergeProps as s,withCtx as l,createCommentVNode as d,renderSlot as f,normalizeProps as y,guardReactiveProps as m}from"vue";import{InjectionButtonPrintEmits as c}from"./constants/index.js";import g from"./components/NewPrintComponent.vue.js";import P from"./components/OldPrintComponent.vue.js";var v=t({__name:"ButtonPrint",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},noDefaultFormatMsg:{default:"获取打印格式失败,请联系管理员!",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]},printCopies:{type:Number,default:1},printCustomProps:{type:Object,default:()=>({})},newPrintSetting:{type:Object,default:()=>({})}},emits:["success","error","cancel","clickoutside","saveOuterPrint"],setup(t,{expose:v,emit:S}){const b=t,x=e(),j=r(),F=n((()=>{var t;return(null==(t=Object.keys(b.newPrintSetting))?void 0:t.length)>0?g:P})),O=n((()=>Object.assign({},b,x)));i(c,(function(t,...e){S(t,...e)}));return v({directPrint:async()=>{var t;null==(t=j.value)||t.directPrint()}}),(t,e)=>(o(),a(p(u(F)),s({ref_key:"printComponentRef",ref:j},u(O)),{button:l((e=>[d(" 自定义按钮样式 "),f(t.$slots,"button",y(m(e)))])),_:3},16))}});export{v as default};
1
+ import{defineComponent as t,useAttrs as e,ref as r,computed as n,provide as o,openBlock as i,createBlock as a,resolveDynamicComponent as p,unref as u,mergeProps as l,withCtx as s,createCommentVNode as d,renderSlot as f,normalizeProps as y,guardReactiveProps as m}from"vue";import{InjectionButtonPrintEmits as c}from"./constants/index.js";import g from"./components/NewPrintComponent.vue.js";import P from"./components/OldPrintComponent.vue.js";var v=t({__name:"ButtonPrint",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},noDefaultFormatMsg:{default:"获取打印格式失败,请联系管理员!",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]},printCopies:{type:Number,default:1},printCustomProps:{type:Object,default:()=>({})},placement:{type:String,default:"bottom-start"},newPrintSetting:{type:Object,default:()=>({})}},emits:["success","error","cancel","clickoutside","saveOuterPrint"],setup(t,{expose:v,emit:S}){const b=t,x=e(),j=r(),F=n((()=>{var t;return(null==(t=Object.keys(b.newPrintSetting))?void 0:t.length)>0?g:P})),O=n((()=>Object.assign({},b,x)));o(c,(function(t,...e){S(t,...e)}));return v({directPrint:async()=>{var t;null==(t=j.value)||t.directPrint()}}),(t,e)=>(i(),a(p(u(F)),l({ref_key:"printComponentRef",ref:j},u(O)),{button:s((e=>[d(" 自定义按钮样式 "),f(t.$slots,"button",y(m(e)))])),_:3},16))}});export{v as default};
@@ -102,6 +102,9 @@ declare const _default: import("vue").DefineComponent<{
102
102
  type: ObjectConstructor;
103
103
  default: () => {};
104
104
  };
105
+ placement: {
106
+ type: StringConstructor;
107
+ };
105
108
  }, {
106
109
  $attrs: {
107
110
  [x: string]: unknown;
@@ -210,6 +213,9 @@ declare const _default: import("vue").DefineComponent<{
210
213
  type: ObjectConstructor;
211
214
  default: () => {};
212
215
  };
216
+ placement: {
217
+ type: StringConstructor;
218
+ };
213
219
  }>> & {}>>;
214
220
  emit: any;
215
221
  defaultFormatInfo: AnyObject;
@@ -546,6 +552,9 @@ declare const _default: import("vue").DefineComponent<{
546
552
  type: ObjectConstructor;
547
553
  default: () => {};
548
554
  };
555
+ placement: {
556
+ type: StringConstructor;
557
+ };
549
558
  }>>, {
550
559
  params: AnyObject[];
551
560
  btnText: string;
@@ -1 +1 @@
1
- import{defineComponent as t,useAttrs as e,inject as n,ref as i,reactive as a,computed as r,onMounted as o,watch as l,openBlock as s,createElementBlock as p,Fragment as d,createVNode as u,unref as m,withCtx as c,renderSlot as f,withModifiers as y,createTextVNode as v,toDisplayString as g,mergeProps as b}from"vue";import{isObject as h}from"@vue/shared";import{useMessage as I,NDropdown as P,NButton as w,NIcon as F}from"naive-ui";import{ChevronDown as k}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as T}from"../constants/index.js";import{Print as S}from"../utils/print.js";import{isIReport as x}from"../utils/browserPrint.js";import O from"./IdentityVerification.vue.js";import{format as j}from"date-fns";import{savePrivateFormatApi as L,getPrivateFormatApi as D}from"../api.js";var E=t({__name:"OldPrintComponent",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},noDefaultFormatMsg:{default:"获取打印格式失败,请联系管理员!",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]},printCopies:{type:Number,default:1},printCustomProps:{type:Object,default:()=>({})}},setup(t,{expose:E}){var M;const C=t,N=e(),V=I();let B;const R=n(T),z={},A=i(""),J=a({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null});let U=i([{label:C.printText,key:"printText"},{label:C.previewText,key:"previewText"},{label:C.pdfLoadText,key:"downloadPdf"},{label:C.formatEditText,key:"formatEditText"},...(null==(M=C.externalOptionConfig)?void 0:M.options)||[]]);const q=r((()=>{if(!J.currentFormatId)return{};let t=J.currentFormatId;return J.formatList.find((e=>e.id===t))})),K=r((()=>{var t;return(null==(t=q.value)?void 0:t.name)||"格式选择"})),_=r((()=>{let t=J.formatList.find((t=>t.id===J.currentFormatId));return null==t?void 0:t.templateId})),G=async t=>{if(C.directPrint){if(J.spinning)return;return"button"===t?void await ut():st()}return st()},H=t=>u("span",{class:{active:t.key===J.currentFormatId}},[t.label]),Y=(t,e)=>{J.spinning=!1;let n={type:e,formatId:J.currentFormatId,templateId:_.value};R("success",t,n)},$=t=>{J.spinning=!1,R("error",t),h(t)&&"notInstalledApp"===t.type&&V.error(t.message)},Q=t=>{J.spinning=!1,R("cancel",t)},W=t=>{R("error",{message:"前置条件执行错误",type:t,preExecution:!0})},X=(t=0)=>{var e;const n=(null==(e=C.printParams)?void 0:e.length)?C.printParams[t]:J.printParams[t];return JSON.stringify({...n||{},...C.token?{token:C.token}:{},...C.printCustomProps||{}})},Z=()=>{var t,e;let n={},i={};if(null==(t=J.templateParams.customizeDataset)?void 0:t.length){const t=(null==(e=Object.keys(J.printParams[0].datasetData||{}))?void 0:e[0])||"",n=JSON.stringify(J.printParams.map((e=>JSON.parse(e.datasetData[t]))));i={datasetData:{}},i.datasetData[t]=n}else Object.keys(J.printParams[0]).forEach((t=>{i[t]=[],J.printParams.forEach((e=>{i[t].includes(e[t])||i[t].push(e[t])})),i[t]=i[t].join(",")}));return n=Object.assign({},JSON.parse(X(0)),i),JSON.stringify(n)},tt=((t,e,n=!0)=>{let i=null;return function(...a){i&&clearTimeout(i),n&&!i&&t.apply(null,a),i=setTimeout((()=>{i=null,!n&&t.apply(null,a)}),e)}})((()=>{let t=J.printParams.length;const e=async e=>{try{--t<=0&&Y(e,"print")}catch(t){console.log("error",t)}};C.showLoading&&J.spinning||(J.spinning=!0,C.prevFn("print").then((()=>{const t={formatId:J.currentFormatId,templateId:_.value,authorizationKey:A.value,printdlgshow:C.printdlgshow,signature:C.signature,copies:C.printCopies};if("MULTI"===C.strategy)for(let n=0;n<J.printParams.length;n++)n>0&&(t.printdlgshow="0"),B.printDirect({...t,params:X(n)},e,$,Q);else B.printDirect({...t,params:Z()},(t=>{Y(t,"print")}),$,Q)})).catch((()=>{W("print"),J.spinning=!1})).finally((()=>{J.visible=!1})))}),800,!0),et=async(t,e)=>{var n,i;switch(t){case"printText":tt();break;case"previewText":(async()=>{C.showLoading&&J.spinning||(J.spinning=!0,C.prevFn("preview").then((()=>{const t="MULTI"===C.strategy?X():Z(),e={formatId:J.currentFormatId,templateId:_.value,authorizationKey:A.value,params:t,btnprint:C.btnprint,signature:C.signature};B.preview(e,(t=>{Y(t,"preview")}),$)})).catch((()=>{W("preview"),J.spinning=!1})).finally((()=>{J.visible=!1})))})();break;case"formatEditText":C.showLoading&&J.spinning||(J.spinning=!0,C.prevFn("edit").then((()=>{J.identityVerification.visible=!0})).catch((()=>{W("edit")})).finally((()=>{J.visible=!1,J.spinning=!1})));break;case"downloadPdf":(async()=>{C.showLoading&&J.spinning||(J.spinning=!0,C.prevFn("download").then((()=>{const t="MULTI"===C.strategy?X():Z(),e={formatId:J.currentFormatId,templateId:_.value,authorizationKey:A.value,print:{print:"1",type:"1"},params:t,signature:C.signature};B.downloadPDF(e,(t=>Y(t,"preview")),$)})).catch((()=>{W("download"),J.spinning=!1})).finally((()=>{J.visible=!1})))})();break;default:{J.visible=!1;const a=J.formatList.find((e=>e.id===t))||{};if(Object.keys(a).length>0){J.currentFormatId=t;const[e]=U.value;e.label=(null==a?void 0:a.name)||e.label,await L({formatForms:[{...a}],name:z.name||a.templateName,number:z.number||a.number,templateId:z.templateId||a.templateId,...z.id?{id:z.id}:{}},{token:C.token})}else null==(i=null==(n=C.externalOptionConfig)?void 0:n.onSelect)||i.call(n,t,e);break}}},nt=()=>{J.visible=!1,R("clickoutside")},it=()=>(J.isInited=!1,J.spinning=!1,setTimeout((()=>{J.visible=!1}),0),!1),at=(t,e,n)=>{const i={};return e.forEach((e=>{let a=((t,e)=>{const n={DATE:"yyyy-MM-dd",DATETIME:"yyyy-MM-dd HH:mm:ss"};let i=e;return Object.keys(n).includes(t.type)&&e&&e instanceof Date&&(i=j(e,n[t.type])),(null==t?void 0:t.defaultValue)||i})(e,t[e[n]]);t[e[n]]&&a&&(i[e[n]]=a)})),i},rt=({customizeDataset:t=[],param:e=[]},n=[])=>n.map((n=>{let i={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;i.datasetData={[t.name]:JSON.stringify(at(n,e,"fieldName"))}})),i=Object.assign({},i,at(n,e,"key")),i})),ot=async t=>{var e;if(J.formatList=t?(t=>{let e=[];return t&&t.forEach((t=>{if(!t.format)return!1;e.push(...t.format.map((e=>Object.assign({},e,{templateName:t.name}))))})),e})(t.obj):[],J.currentFormatId=await(async(t,e)=>{var n;if(!(null==t?void 0:t.length))return"";if(!N.isDoc){const{data:e}=await D({templateId:t[0].templateId},{token:C.token});if("SUCCESS"===e.result){const{formatForms:i=[]}=e.map||{};Object.assign(z,e.map||{});const a=null==(n=null==i?void 0:i[0])?void 0:n.id;if(a&&t.map((t=>t.id)).includes(a))return a}}const i=t.find((t=>1==t[e]));return(null==i?void 0:i.id)||t[0].id})(J.formatList,"defaultFlag"),!J.currentFormatId)return U.value=[],V.error(C.noDefaultFormatMsg),it();(()=>{var t;const e=J.formatList.map((t=>({label:t.name,key:t.id})));U.value.unshift({label:K.value,key:"format",children:e}),C.hideButtons.length>0&&(U.value=U.value.filter((t=>!C.hideButtons.includes(t.key))));const n=sessionStorage.getItem("portal");if(n){const e=JSON.parse(n),i=(null==(t=null==e?void 0:e.user)?void 0:t.currentRoleResourceObj)||{},a=Object.keys(i);a.includes("RY7.2.21.1.M2.G94181E")||(U.value=U.value.filter((t=>"downloadPdf"!=t.key))),a.includes("RY7.2.21.1.M2.G33633A")||(U.value=U.value.filter((t=>"formatEditText"!=t.key)))}})();let n=null==(e=await C.queryTemplateParams())?void 0:e.obj;if(!n||!_.value)return V.error("获取打印模板失败,请联系管理员!"),it();J.templateParams=n,J.printParams=rt(J.templateParams,C.params)},lt=async()=>{var t;if(J.isInited)return!0;J.isInited=!0,J.spinning=!0,(()=>{if(B)return!1;B=new S})();const e=await C.queryPrintFormatByNumber();return await ot(e),(null==(t=e.obj)?void 0:t.length)>0&&(A.value=e.obj[0].authorizationKey||""),J.spinning=!1,!0},st=async(t=!0)=>{var e,n;if(await C.clickPrevFn())if((null==(e=C.params)?void 0:e.length)||(null==(n=C.printParams)?void 0:n.length)){if(!J.visible){if(!await lt())return!1}t&&(J.visible=!J.visible)}else V.warning(C.noDataMsg)},pt=()=>{J.watchPrintParamsReformatFn&&J.watchPrintParamsReformatFn(),J.isInited?J.printParams=rt(J.templateParams,C.params):J.watchPrintParamsReformatFn=()=>l((()=>J.isInited),(t=>{if(!t)return!1;pt()}))},dt=t=>{if(J.identityVerification.visible=!1,x(J.currentFormatId))return Y(null,"edit");const e={formatId:J.currentFormatId,templateId:_.value,params:X(),token:t};B.editPrintFormat(e,(t=>{Y(t,"edit")}),$)};async function ut(){await st(!1),tt()}return o((()=>{J.isInited=!1})),l((()=>C.params),(t=>{if(!(null==t?void 0:t.length))return!1;pt()}),{deep:!0}),E({directPrint:ut}),(e,n)=>(s(),p(d,null,[u(m(P),{class:"c-dropdown",placement:"bottom-start",trigger:"click",show:J.visible,onClickoutside:nt,options:m(U),onSelect:et,"render-label":H},{default:c((()=>[f(e.$slots,"button",{handleClickPrintBtn:st,printSpinning:J.spinning,printbtnText:t.btnText,printVisible:J.visible},(()=>[u(m(w),{class:"dropdown-button",loading:t.showLoading&&J.spinning,onClick:n[1]||(n[1]=y((()=>G("button")),["stop"]))},{default:c((()=>[v(g(t.btnText)+" ",1),u(m(F),{component:m(k),size:"18",style:{"margin-left":"5px"},onClick:n[0]||(n[0]=y((()=>G("icon")),["stop"]))},null,8,["component"])])),_:1},8,["loading"])]))])),_:3},8,["show","options"]),u(O,b(m(N),{modelValue:J.identityVerification.visible,"onUpdate:modelValue":n[2]||(n[2]=t=>J.identityVerification.visible=t),formatId:J.currentFormatId,templateId:m(_),onSuccess:dt}),null,16,["modelValue","formatId","templateId"])],64))}});export{E as default};
1
+ import{defineComponent as t,useAttrs as e,inject as n,ref as i,reactive as a,computed as r,onMounted as l,watch as o,openBlock as s,createElementBlock as p,Fragment as d,createVNode as u,unref as m,withCtx as c,renderSlot as f,withModifiers as y,createTextVNode as v,toDisplayString as g,mergeProps as b}from"vue";import{isObject as h}from"@vue/shared";import{useMessage as I,NDropdown as P,NButton as w,NIcon as F}from"naive-ui";import{ChevronDown as k}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as T}from"../constants/index.js";import{Print as S}from"../utils/print.js";import{isIReport as x}from"../utils/browserPrint.js";import O from"./IdentityVerification.vue.js";import{format as j}from"date-fns";import{savePrivateFormatApi as L,getPrivateFormatApi as D}from"../api.js";var E=t({__name:"OldPrintComponent",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},noDefaultFormatMsg:{default:"获取打印格式失败,请联系管理员!",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]},printCopies:{type:Number,default:1},printCustomProps:{type:Object,default:()=>({})},placement:{type:String}},setup(t,{expose:E}){var M;const C=t,N=e(),V=I();let B;const R=n(T),z={},A=i(""),J=a({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null});let U=i([{label:C.printText,key:"printText"},{label:C.previewText,key:"previewText"},{label:C.pdfLoadText,key:"downloadPdf"},{label:C.formatEditText,key:"formatEditText"},...(null==(M=C.externalOptionConfig)?void 0:M.options)||[]]);const q=r((()=>{if(!J.currentFormatId)return{};let t=J.currentFormatId;return J.formatList.find((e=>e.id===t))})),K=r((()=>{var t;return(null==(t=q.value)?void 0:t.name)||"格式选择"})),_=r((()=>{let t=J.formatList.find((t=>t.id===J.currentFormatId));return null==t?void 0:t.templateId})),G=async t=>{if(C.directPrint){if(J.spinning)return;return"button"===t?void await ut():st()}return st()},H=t=>u("span",{class:{active:t.key===J.currentFormatId}},[t.label]),Y=(t,e)=>{J.spinning=!1;let n={type:e,formatId:J.currentFormatId,templateId:_.value};R("success",t,n)},$=t=>{J.spinning=!1,R("error",t),h(t)&&"notInstalledApp"===t.type&&V.error(t.message)},Q=t=>{J.spinning=!1,R("cancel",t)},W=t=>{R("error",{message:"前置条件执行错误",type:t,preExecution:!0})},X=(t=0)=>{var e;const n=(null==(e=C.printParams)?void 0:e.length)?C.printParams[t]:J.printParams[t];return JSON.stringify({...n||{},...C.token?{token:C.token}:{},...C.printCustomProps||{}})},Z=()=>{var t,e;let n={},i={};if(null==(t=J.templateParams.customizeDataset)?void 0:t.length){const t=(null==(e=Object.keys(J.printParams[0].datasetData||{}))?void 0:e[0])||"",n=JSON.stringify(J.printParams.map((e=>JSON.parse(e.datasetData[t]))));i={datasetData:{}},i.datasetData[t]=n}else Object.keys(J.printParams[0]).forEach((t=>{i[t]=[],J.printParams.forEach((e=>{i[t].includes(e[t])||i[t].push(e[t])})),i[t]=i[t].join(",")}));return n=Object.assign({},JSON.parse(X(0)),i),JSON.stringify(n)},tt=((t,e,n=!0)=>{let i=null;return function(...a){i&&clearTimeout(i),n&&!i&&t.apply(null,a),i=setTimeout((()=>{i=null,!n&&t.apply(null,a)}),e)}})((()=>{let t=J.printParams.length;const e=async e=>{try{--t<=0&&Y(e,"print")}catch(t){console.log("error",t)}};C.showLoading&&J.spinning||(J.spinning=!0,C.prevFn("print").then((()=>{const t={formatId:J.currentFormatId,templateId:_.value,authorizationKey:A.value,printdlgshow:C.printdlgshow,signature:C.signature,copies:C.printCopies};if("MULTI"===C.strategy)for(let n=0;n<J.printParams.length;n++)n>0&&(t.printdlgshow="0"),B.printDirect({...t,params:X(n)},e,$,Q);else B.printDirect({...t,params:Z()},(t=>{Y(t,"print")}),$,Q)})).catch((()=>{W("print"),J.spinning=!1})).finally((()=>{J.visible=!1})))}),800,!0),et=async(t,e)=>{var n,i;switch(t){case"printText":tt();break;case"previewText":(async()=>{C.showLoading&&J.spinning||(J.spinning=!0,C.prevFn("preview").then((()=>{const t="MULTI"===C.strategy?X():Z(),e={formatId:J.currentFormatId,templateId:_.value,authorizationKey:A.value,params:t,btnprint:C.btnprint,signature:C.signature};B.preview(e,(t=>{Y(t,"preview")}),$)})).catch((()=>{W("preview"),J.spinning=!1})).finally((()=>{J.visible=!1})))})();break;case"formatEditText":C.showLoading&&J.spinning||(J.spinning=!0,C.prevFn("edit").then((()=>{J.identityVerification.visible=!0})).catch((()=>{W("edit")})).finally((()=>{J.visible=!1,J.spinning=!1})));break;case"downloadPdf":(async()=>{C.showLoading&&J.spinning||(J.spinning=!0,C.prevFn("download").then((()=>{const t="MULTI"===C.strategy?X():Z(),e={formatId:J.currentFormatId,templateId:_.value,authorizationKey:A.value,print:{print:"1",type:"1"},params:t,signature:C.signature};B.downloadPDF(e,(t=>Y(t,"preview")),$)})).catch((()=>{W("download"),J.spinning=!1})).finally((()=>{J.visible=!1})))})();break;default:{J.visible=!1;const a=J.formatList.find((e=>e.id===t))||{};if(Object.keys(a).length>0){J.currentFormatId=t;const[e]=U.value;e.label=(null==a?void 0:a.name)||e.label,await L({formatForms:[{...a}],name:z.name||a.templateName,number:z.number||a.number,templateId:z.templateId||a.templateId,...z.id?{id:z.id}:{}},{token:C.token})}else null==(i=null==(n=C.externalOptionConfig)?void 0:n.onSelect)||i.call(n,t,e);break}}},nt=()=>{J.visible=!1,R("clickoutside")},it=()=>(J.isInited=!1,J.spinning=!1,setTimeout((()=>{J.visible=!1}),0),!1),at=(t,e,n)=>{const i={};return e.forEach((e=>{let a=((t,e)=>{const n={DATE:"yyyy-MM-dd",DATETIME:"yyyy-MM-dd HH:mm:ss"};let i=e;return Object.keys(n).includes(t.type)&&e&&e instanceof Date&&(i=j(e,n[t.type])),(null==t?void 0:t.defaultValue)||i})(e,t[e[n]]);t[e[n]]&&a&&(i[e[n]]=a)})),i},rt=({customizeDataset:t=[],param:e=[]},n=[])=>n.map((n=>{let i={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;i.datasetData={[t.name]:JSON.stringify(at(n,e,"fieldName"))}})),i=Object.assign({},i,at(n,e,"key")),i})),lt=async t=>{var e;if(J.formatList=t?(t=>{let e=[];return t&&t.forEach((t=>{if(!t.format)return!1;e.push(...t.format.map((e=>Object.assign({},e,{templateName:t.name}))))})),e})(t.obj):[],J.currentFormatId=await(async(t,e)=>{var n;if(!(null==t?void 0:t.length))return"";if(!N.isDoc){const{data:e}=await D({templateId:t[0].templateId},{token:C.token});if("SUCCESS"===e.result){const{formatForms:i=[]}=e.map||{};Object.assign(z,e.map||{});const a=null==(n=null==i?void 0:i[0])?void 0:n.id;if(a&&t.map((t=>t.id)).includes(a))return a}}const i=t.find((t=>1==t[e]));return(null==i?void 0:i.id)||t[0].id})(J.formatList,"defaultFlag"),!J.currentFormatId)return U.value=[],V.error(C.noDefaultFormatMsg),it();(()=>{var t;const e=J.formatList.map((t=>({label:t.name,key:t.id})));U.value.unshift({label:K.value,key:"format",children:e}),C.hideButtons.length>0&&(U.value=U.value.filter((t=>!C.hideButtons.includes(t.key))));const n=sessionStorage.getItem("portal");if(n){const e=JSON.parse(n),i=(null==(t=null==e?void 0:e.user)?void 0:t.currentRoleResourceObj)||{},a=Object.keys(i);a.includes("RY7.2.21.1.M2.G94181E")||(U.value=U.value.filter((t=>"downloadPdf"!=t.key))),a.includes("RY7.2.21.1.M2.G33633A")||(U.value=U.value.filter((t=>"formatEditText"!=t.key)))}})();let n=null==(e=await C.queryTemplateParams())?void 0:e.obj;if(!n||!_.value)return V.error("获取打印模板失败,请联系管理员!"),it();J.templateParams=n,J.printParams=rt(J.templateParams,C.params)},ot=async()=>{var t;if(J.isInited)return!0;J.isInited=!0,J.spinning=!0,(()=>{if(B)return!1;B=new S})();const e=await C.queryPrintFormatByNumber();return await lt(e),(null==(t=e.obj)?void 0:t.length)>0&&(A.value=e.obj[0].authorizationKey||""),J.spinning=!1,!0},st=async(t=!0)=>{var e,n;if(await C.clickPrevFn())if((null==(e=C.params)?void 0:e.length)||(null==(n=C.printParams)?void 0:n.length)){if(!J.visible){if(!await ot())return!1}t&&(J.visible=!J.visible)}else V.warning(C.noDataMsg)},pt=()=>{J.watchPrintParamsReformatFn&&J.watchPrintParamsReformatFn(),J.isInited?J.printParams=rt(J.templateParams,C.params):J.watchPrintParamsReformatFn=()=>o((()=>J.isInited),(t=>{if(!t)return!1;pt()}))},dt=t=>{if(J.identityVerification.visible=!1,x(J.currentFormatId))return Y(null,"edit");const e={formatId:J.currentFormatId,templateId:_.value,params:X(),token:t};B.editPrintFormat(e,(t=>{Y(t,"edit")}),$)};async function ut(){await st(!1),tt()}return l((()=>{J.isInited=!1})),o((()=>C.params),(t=>{if(!(null==t?void 0:t.length))return!1;pt()}),{deep:!0}),E({directPrint:ut}),(e,n)=>(s(),p(d,null,[u(m(P),{class:"c-dropdown",placement:t.placement,trigger:"click",show:J.visible,onClickoutside:nt,options:m(U),onSelect:et,"render-label":H},{default:c((()=>[f(e.$slots,"button",{handleClickPrintBtn:st,printSpinning:J.spinning,printbtnText:t.btnText,printVisible:J.visible},(()=>[u(m(w),{class:"dropdown-button",loading:t.showLoading&&J.spinning,onClick:n[1]||(n[1]=y((()=>G("button")),["stop"]))},{default:c((()=>[v(g(t.btnText)+" ",1),u(m(F),{component:m(k),size:"18",style:{"margin-left":"5px"},onClick:n[0]||(n[0]=y((()=>G("icon")),["stop"]))},null,8,["component"])])),_:1},8,["loading"])]))])),_:3},8,["placement","show","options"]),u(O,b(m(N),{modelValue:J.identityVerification.visible,"onUpdate:modelValue":n[2]||(n[2]=t=>J.identityVerification.visible=t),formatId:J.currentFormatId,templateId:m(_),onSuccess:dt}),null,16,["modelValue","formatId","templateId"])],64))}});export{E as default};
@@ -103,6 +103,7 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
103
103
  all: string;
104
104
  unread: string;
105
105
  };
106
+ unreadSessionKeys: string[];
106
107
  flexWidth: import("vue").Ref<number>;
107
108
  listBoxRef: import("vue").Ref<HTMLElement | undefined>;
108
109
  loading: import("vue").Ref<boolean>;
@@ -867,6 +868,7 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
867
868
  options: import("../../shared/types").AnyObject[];
868
869
  defaultValue: import("../../shared/types").AnyObject[];
869
870
  }>;
871
+ btnDisabled: import("vue").ComputedRef<boolean>;
870
872
  handleCall: (chatMessageType: string, checkedIds?: never[]) => void;
871
873
  handleKeyDown: (event: KeyboardEvent) => void;
872
874
  isWrap: (event: KeyboardEvent) => boolean;
@@ -108,6 +108,7 @@ declare const _default: import("vue").DefineComponent<{
108
108
  all: string;
109
109
  unread: string;
110
110
  };
111
+ unreadSessionKeys: string[];
111
112
  flexWidth: import("vue").Ref<number>;
112
113
  listBoxRef: import("vue").Ref<HTMLElement | undefined>;
113
114
  loading: import("vue").Ref<boolean>;
@@ -872,6 +873,7 @@ declare const _default: import("vue").DefineComponent<{
872
873
  options: AnyObject[];
873
874
  defaultValue: AnyObject[];
874
875
  }>;
876
+ btnDisabled: import("vue").ComputedRef<boolean>;
875
877
  handleCall: (chatMessageType: string, checkedIds?: never[]) => void;
876
878
  handleKeyDown: (event: KeyboardEvent) => void;
877
879
  isWrap: (event: KeyboardEvent) => boolean;
@@ -21,6 +21,7 @@ declare const _default: import("vue").DefineComponent<{}, {
21
21
  options: AnyObject[];
22
22
  defaultValue: AnyObject[];
23
23
  }>;
24
+ btnDisabled: import("vue").ComputedRef<boolean>;
24
25
  handleCall: (chatMessageType: string, checkedIds?: never[]) => void;
25
26
  handleKeyDown: (event: KeyboardEvent) => void;
26
27
  isWrap: (event: KeyboardEvent) => boolean;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,computed as n,watch as o,withDirectives as r,openBlock as i,createElementBlock as s,normalizeStyle as a,unref as c,createElementVNode as l,toDisplayString as u,createVNode as g,createCommentVNode as p,withCtx as f,Fragment as m,renderList as d,createBlock as h,createTextVNode as y,mergeProps as v,vShow as w}from"vue";import{NIcon as M,NTooltip as _,NPopover as k,NButton as C,NUpload as I,NUploadTrigger as T}from"naive-ui";import E from"./ChatAdd.vue.js";import{useState as b}from"../hooks/useState.js";import{useSession as x}from"../hooks/useSession.js";import{MESSAGE_TYPE as z,AV_STATUS as j}from"../constants/index.js";import"trtc-sdk-v5";import{simplifyMessage as L}from"../utils/index.js";import{emojis as R}from"../utils/emoji.js";import{uploadFileApi as q}from"../api/index.js";import{CloseCircleOutline as O,CallOutline as D,VideocamOutline as A}from"@vicons/ionicons5";import{xor as V,cloneDeep as K}from"lodash-es";import{uuidGenerator as F}from"../../../../shared/utils/index.js";const H={key:0,class:"reference-content-box"},U={class:"reference-content"},G=["innerHTML"],J={class:"tool-box"},N=l("i",{class:"chat--iconfont chat--icon-face"},null,-1),S=l("span",null,"默认表情",-1),X={class:"list-box"},B=["src"],$=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 发送, Ctrl + Enter 换行",-1);var Z=e({__name:"ChatFooter",setup(e){const Z=t(),{state:ee,sendMessage:te}=b(),{isGroupChat:ne}=x(ee),oe=t(!1),re=t(""),ie=n((()=>({options:ee.currentGroupUser,defaultValue:[ee.userInfo]})));function se(e,t=[]){const n=F(),o=[],r=t.length>0;ee.showVideo||ee.showMultipleVideo||(r?(o.push(...V(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:j.IN_CALL}}))}function ae(e){["Enter"].includes(e.key)&&(e.ctrlKey&&(e.preventDefault(),document.execCommand("InsertLineBreak")),function(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}(e)||(e.preventDefault(),ue()))}function ce(){var e;re.value=(null==(e=Z.value)?void 0:e.innerHTML)||""}async function le(e,t){const{file:n,name:o}=e.file,r=new FormData;r.append("sender",ee.userInfo.id),r.append("file",n);const i=await q(r);if(!i)return console.log("上传失败");ge({chatMessageType:t,msg:t===z.FILE?o:i,url:i})}function ue(){const{innerHTML:e="",innerText:t=""}=Z.value||{};if(re.value.trim().length>2e3)return void console.log("请控制在2000字以内");if(!re.value)return console.log("请输入内容");const n=e.split(t).find((e=>!!e));let o=z.TEXT,r="";if(n){if(t.replace(/\n$/,"")||(e.match(/<img[^>]*>/gi)||[]).length>1)o=z.BLEND,r=e;else if(e.includes(z.EMOJI)){o=z.EMOJI;const t=e.match(/data-msg\s*=\s*"([^"]*)"/);t&&(r=t[1])}else{o=z.IMAGE;const t=e.match(/src\s*=\s*"([^"]*)"/);t&&(r=t[1])}}else r=t.trim();r&&ge({msg:r,chatMessageType:o,origin:"btn"})}async function ge(e){const{chatMessageType:t=z.TEXT,msg:n,url:o,origin:r=""}=e,i={msg:n,chatMessageType:t};t===z.FILE&&(i.fileUrl=o),"btn"===r&&(Z.value.innerHTML="",re.value=""),ee.currentReferenceMsg&&(t===z.TEXT&&(i.referenceContent=K(ee.currentReferenceMsg)),ee.currentReferenceMsg=null),te({content:i})}return o((()=>ee.currentReferenceMsg),(e=>{var t;e&&(null==(t=Z.value)||t.focus())})),(e,t)=>r((i(),s("section",{class:"chat-footer",style:a({cursor:c(ee).id?"default":"not-allowed"})},[c(ee).currentReferenceMsg?(i(),s("div",H,[l("div",U,[l("span",null,u(c(ee).currentReferenceMsg.senderName)+":",1),l("pre",{innerHTML:c(L)(c(ee).currentReferenceMsg.content)},null,8,G)]),g(c(M),{component:c(O),onClick:t[0]||(t[0]=()=>c(ee).currentReferenceMsg=null)},null,8,["component"])])):p("v-if",!0),l("div",J,[g(c(_),{"show-arrow":!1,trigger:"hover",placement:"top"},{trigger:f((()=>[g(c(k),{"content-class":"emoji-content",class:"emoji-wrapper",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((()=>[g(c(C),{quaternary:"",size:"tiny"},{icon:f((()=>[N])),_:1})])),default:f((()=>[S,l("div",X,[(i(!0),s(m,null,d(c(R).default,(([e,t])=>(i(),h(c(_),{key:e,"show-arrow":!1,trigger:"hover"},{trigger:f((()=>[g(c(C),{quaternary:"",size:"tiny",onClick:()=>function(e){oe.value=!1,ge({chatMessageType:z.EMOJI,msg:e})}(e)},{icon:f((()=>[l("img",{src:t},null,8,B)])),_:2},1032,["onClick"])])),default:f((()=>[y(" "+u(e),1)])),_:2},1024)))),128))])])),_:1},8,["show"])])),default:f((()=>[y(" 表情 ")])),_:1}),g(c(_),{"show-arrow":!1,trigger:"hover",placement:"top"},{trigger:f((()=>[g(c(C),{quaternary:"",size:"tiny",onClick:t[2]||(t[2]=()=>ge({chatMessageType:c(z).EMOJI,msg:0}))},{icon:f((()=>[$])),_:1})])),default:f((()=>[y(" 点赞 ")])),_:1}),g(c(I),{abstract:"",multiple:"",accept:"image/*",onChange:t[3]||(t[3]=e=>le(e,c(z).IMAGE))},{default:f((()=>[g(c(T),{abstract:""},{default:f((({handleClick:e})=>[g(c(_),{"show-arrow":!1,trigger:"hover",placement:"top"},{trigger:f((()=>[g(c(C),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[P])),_:2},1032,["onClick"])])),default:f((()=>[y(" 上传图片 ")])),_:2},1024)])),_:1})])),_:1}),g(c(I),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:t[4]||(t[4]=e=>le(e,c(z).FILE))},{default:f((()=>[g(c(T),{abstract:""},{default:f((({handleClick:e})=>[g(c(_),{"show-arrow":!1,trigger:"hover",placement:"top"},{trigger:f((()=>[g(c(C),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[Q])),_:2},1032,["onClick"])])),default:f((()=>[y(" 上传文件 ")])),_:2},1024)])),_:1})])),_:1}),c(ne)?(i(),s(m,{key:0},[g(E,v(c(ie),{onComfirm:t[5]||(t[5]=e=>se(c(z).AUDIO,e))}),{trigger:f((()=>[g(c(_),{"show-arrow":!1,trigger:"hover",placement:"top"},{trigger:f((()=>[g(c(C),{quaternary:"",size:"tiny"},{icon:f((()=>[g(c(M),{size:"18",component:c(D)},null,8,["component"])])),_:1})])),default:f((()=>[y(" 语音通话 ")])),_:1})])),_:1},16),g(E,v(c(ie),{onComfirm:t[6]||(t[6]=e=>se(c(z).VIDEO,e))}),{trigger:f((()=>[g(c(_),{"show-arrow":!1,trigger:"hover",placement:"top"},{trigger:f((()=>[g(c(C),{quaternary:"",size:"tiny"},{icon:f((()=>[g(c(M),{size:"20",component:c(A)},null,8,["component"])])),_:1})])),default:f((()=>[y(" 视频会议 ")])),_:1})])),_:1},16)],64)):(i(),s(m,{key:1},[g(c(_),{"show-arrow":!1,trigger:"hover",placement:"top"},{trigger:f((()=>[g(c(C),{quaternary:"",size:"tiny",onClick:t[7]||(t[7]=()=>se(c(z).AUDIO))},{icon:f((()=>[g(c(M),{size:"18",component:c(D)},null,8,["component"])])),_:1})])),default:f((()=>[y(" 语音通话 ")])),_:1}),g(c(_),{"show-arrow":!1,trigger:"hover",placement:"top"},{trigger:f((()=>[g(c(C),{quaternary:"",size:"tiny",onClick:t[8]||(t[8]=()=>se(c(z).VIDEO))},{icon:f((()=>[g(c(M),{size:"20",component:c(A)},null,8,["component"])])),_:1})])),default:f((()=>[y(" 视频通话 ")])),_:1})],64))]),r(l("div",{ref_key:"inputRef",ref:Z,class:"input-box",contenteditable:"",onKeydown:ae,onInput:ce},null,544),[[w,c(ee).id]]),l("div",W,[Y,g(c(C),{type:"primary",round:"",disabled:!re.value,onClick:ue},{default:f((()=>[y("发送")])),_:1},8,["disabled"])])],4)),[[w,c(ee).id]])}});export{Z as default};
1
+ import{defineComponent as e,ref as t,computed as n,watch as r,withDirectives as o,openBlock as i,createElementBlock as s,normalizeStyle as a,unref as c,createElementVNode as l,toDisplayString as u,createVNode as p,createCommentVNode as g,withCtx as f,Fragment as m,renderList as d,createBlock as h,createTextVNode as y,mergeProps as v,vShow as w}from"vue";import{NIcon as M,NTooltip as _,NPopover as k,NButton as C,NUpload as I,NUploadTrigger as T}from"naive-ui";import b from"./ChatAdd.vue.js";import{useState as E}from"../hooks/useState.js";import{useSession as x}from"../hooks/useSession.js";import{MESSAGE_TYPE as z,AV_STATUS as j}from"../constants/index.js";import"trtc-sdk-v5";import{simplifyMessage as L}from"../utils/index.js";import{emojis as R}from"../utils/emoji.js";import{uploadFileApi as q}from"../api/index.js";import{CloseCircleOutline as O,CallOutline as D,VideocamOutline as A}from"@vicons/ionicons5";import{xor as V,cloneDeep as K}from"lodash-es";import{uuidGenerator as F}from"../../../../shared/utils/index.js";const H={key:0,class:"reference-content-box"},U={class:"reference-content"},G=["innerHTML"],J={class:"tool-box"},N=l("i",{class:"chat--iconfont chat--icon-face"},null,-1),S=l("span",null,"默认表情",-1),X={class:"list-box"},B=["src"],$=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 发送, Ctrl + Enter 换行",-1);var Z=e({__name:"ChatFooter",setup(e){const Z=t(),{state:ee,sendMessage:te}=E(),{isGroupChat:ne}=x(ee),re=t(!1),oe=t(""),ie=n((()=>({options:ee.currentGroupUser,defaultValue:[ee.userInfo]}))),se=n((()=>!oe.value.replace(/(&nbsp;|\s|<br>)+/g,"")));function ae(e,t=[]){const n=F(),r=[],o=t.length>0;ee.showVideo||ee.showMultipleVideo||(o?(r.push(...V(t,[ee.userInfo.id])),Object.assign(ee.currentAVMsg,{callMode:"call",checkedIds:r,strRoomId:n,chatMessageType:e}),ee.showMultipleVideo=!0):te({content:{chatMessageType:e,msg:"",avStatus:j.IN_CALL}}))}function ce(e){["Enter"].includes(e.key)&&(e.ctrlKey&&(e.preventDefault(),document.execCommand("InsertLineBreak")),function(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}(e)||(e.preventDefault(),pe()))}function le(){var e;oe.value=(null==(e=Z.value)?void 0:e.innerHTML)||""}async function ue(e,t){const{file:n,name:r}=e.file,o=new FormData;o.append("sender",ee.userInfo.id),o.append("file",n);const i=await q(o);if(!i)return console.log("上传失败");ge({chatMessageType:t,msg:t===z.FILE?r:i,url:i})}function pe(){const{innerHTML:e="",innerText:t=""}=Z.value||{};if(se.value)return console.log("请输入内容");const n=e.split(t).find((e=>!!e));let r=z.TEXT,o="";if(n){if(t.replace(/\n$/,"")||(e.match(/<img[^>]*>/gi)||[]).length>1)r=z.BLEND,o=e;else if(e.includes(z.EMOJI)){r=z.EMOJI;const t=e.match(/data-msg\s*=\s*"([^"]*)"/);t&&(o=t[1])}else{r=z.IMAGE;const t=e.match(/src\s*=\s*"([^"]*)"/);t&&(o=t[1])}}else o=t.trim();o&&ge({msg:o,chatMessageType:r,origin:"btn"})}async function ge(e){const{chatMessageType:t=z.TEXT,msg:n,url:r,origin:o=""}=e,i={msg:n,chatMessageType:t};t===z.FILE&&(i.fileUrl=r),"btn"===o&&(Z.value.innerHTML="",oe.value=""),ee.currentReferenceMsg&&(t===z.TEXT&&(i.referenceContent=K(ee.currentReferenceMsg)),ee.currentReferenceMsg=null),te({content:i})}return r((()=>ee.currentReferenceMsg),(e=>{var t;e&&(null==(t=Z.value)||t.focus())})),(e,t)=>o((i(),s("section",{class:"chat-footer",style:a({cursor:c(ee).id?"default":"not-allowed"})},[c(ee).currentReferenceMsg?(i(),s("div",H,[l("div",U,[l("span",null,u(c(ee).currentReferenceMsg.senderName)+":",1),l("pre",{innerHTML:c(L)(c(ee).currentReferenceMsg.content)},null,8,G)]),p(c(M),{component:c(O),onClick:t[0]||(t[0]=()=>c(ee).currentReferenceMsg=null)},null,8,["component"])])):g("v-if",!0),l("div",J,[p(c(_),{"show-arrow":!1,trigger:"hover",placement:"top"},{trigger:f((()=>[p(c(k),{"content-class":"emoji-content",class:"emoji-wrapper",show:re.value,"onUpdate:show":t[1]||(t[1]=e=>re.value=e),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show",delay:0},{trigger:f((()=>[p(c(C),{quaternary:"",size:"tiny"},{icon:f((()=>[N])),_:1})])),default:f((()=>[S,l("div",X,[(i(!0),s(m,null,d(c(R).default,(([e,t])=>(i(),h(c(_),{key:e,"show-arrow":!1,trigger:"hover"},{trigger:f((()=>[p(c(C),{quaternary:"",size:"tiny",onClick:()=>function(e){re.value=!1,ge({chatMessageType:z.EMOJI,msg:e})}(e)},{icon:f((()=>[l("img",{src:t},null,8,B)])),_:2},1032,["onClick"])])),default:f((()=>[y(" "+u(e),1)])),_:2},1024)))),128))])])),_:1},8,["show"])])),default:f((()=>[y(" 表情 ")])),_:1}),p(c(_),{"show-arrow":!1,trigger:"hover",placement:"top"},{trigger:f((()=>[p(c(C),{quaternary:"",size:"tiny",onClick:t[2]||(t[2]=()=>ge({chatMessageType:c(z).EMOJI,msg:0}))},{icon:f((()=>[$])),_:1})])),default:f((()=>[y(" 点赞 ")])),_:1}),p(c(I),{abstract:"",multiple:"",accept:"image/*",onChange:t[3]||(t[3]=e=>ue(e,c(z).IMAGE))},{default:f((()=>[p(c(T),{abstract:""},{default:f((({handleClick:e})=>[p(c(_),{"show-arrow":!1,trigger:"hover",placement:"top"},{trigger:f((()=>[p(c(C),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[P])),_:2},1032,["onClick"])])),default:f((()=>[y(" 上传图片 ")])),_:2},1024)])),_:1})])),_:1}),p(c(I),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:t[4]||(t[4]=e=>ue(e,c(z).FILE))},{default:f((()=>[p(c(T),{abstract:""},{default:f((({handleClick:e})=>[p(c(_),{"show-arrow":!1,trigger:"hover",placement:"top"},{trigger:f((()=>[p(c(C),{quaternary:"",size:"tiny",onClick:e},{icon:f((()=>[Q])),_:2},1032,["onClick"])])),default:f((()=>[y(" 上传文件 ")])),_:2},1024)])),_:1})])),_:1}),c(ne)?(i(),s(m,{key:0},[p(b,v(c(ie),{onComfirm:t[5]||(t[5]=e=>ae(c(z).AUDIO,e))}),{trigger:f((()=>[p(c(_),{"show-arrow":!1,trigger:"hover",placement:"top"},{trigger:f((()=>[p(c(C),{quaternary:"",size:"tiny"},{icon:f((()=>[p(c(M),{size:"18",component:c(D)},null,8,["component"])])),_:1})])),default:f((()=>[y(" 语音通话 ")])),_:1})])),_:1},16),p(b,v(c(ie),{onComfirm:t[6]||(t[6]=e=>ae(c(z).VIDEO,e))}),{trigger:f((()=>[p(c(_),{"show-arrow":!1,trigger:"hover",placement:"top"},{trigger:f((()=>[p(c(C),{quaternary:"",size:"tiny"},{icon:f((()=>[p(c(M),{size:"20",component:c(A)},null,8,["component"])])),_:1})])),default:f((()=>[y(" 视频会议 ")])),_:1})])),_:1},16)],64)):(i(),s(m,{key:1},[p(c(_),{"show-arrow":!1,trigger:"hover",placement:"top"},{trigger:f((()=>[p(c(C),{quaternary:"",size:"tiny",onClick:t[7]||(t[7]=()=>ae(c(z).AUDIO))},{icon:f((()=>[p(c(M),{size:"18",component:c(D)},null,8,["component"])])),_:1})])),default:f((()=>[y(" 语音通话 ")])),_:1}),p(c(_),{"show-arrow":!1,trigger:"hover",placement:"top"},{trigger:f((()=>[p(c(C),{quaternary:"",size:"tiny",onClick:t[8]||(t[8]=()=>ae(c(z).VIDEO))},{icon:f((()=>[p(c(M),{size:"20",component:c(A)},null,8,["component"])])),_:1})])),default:f((()=>[y(" 视频通话 ")])),_:1})],64))]),o(l("div",{ref_key:"inputRef",ref:Z,class:"input-box",contenteditable:"",onKeydown:ce,onInput:le},null,544),[[w,c(ee).id]]),l("div",W,[Y,p(c(C),{type:"primary",round:"",disabled:c(se),onClick:pe},{default:f((()=>[y("发送")])),_:1},8,["disabled"])])],4)),[[w,c(ee).id]])}});export{Z as default};
@@ -1 +1 @@
1
- import{defineComponent as e,useAttrs as s,openBlock as t,createBlock as o,unref as i,withCtx as r,createVNode as n,createElementVNode as a,toDisplayString as m}from"vue";import{NDrawer as c,NDrawerContent as l,NAvatar as u,NIcon as p,NSwitch as d}from"naive-ui";import{ChevronForwardOutline as f}from"@vicons/ionicons5";import{useState as h}from"../hooks/useState.js";import{useSession as v}from"../hooks/useSession.js";import"trtc-sdk-v5";import"date-fns";import{isFunction as S}from"lodash-es";import"../utils/emoji.js";import g from"./PersonProfile.vue.js";import{toppingSessionApi as _}from"../api/index.js";const I={class:"chat-set-wrapper"},j={class:"item user-info"},w={class:"item"},b=a("span",{class:"label"},"置顶聊天",-1);var k=e({__name:"ChatSet",setup(e){const k=s(),{state:y}=h(),{setCurrentSessionItem:C,isGroupChat:U}=v(y);async function x(e){try{await _({sessionKey:y.currentSessionItem.sessionKey,id:y.currentSessionItem.id,topping:e}),C({topping:e})}catch(e){console.log(e)}}function z(){S(k["onUpdate:show"])&&k["onUpdate:show"](!1)}return(e,s)=>(t(),o(i(c),{width:320,"trap-focus":!1,"block-scroll":!1,to:".iho-chat"},{default:r((()=>[n(i(l),{title:"聊天设置"},{default:r((()=>[a("div",I,[n(g,{"user-id":i(y).currentSessionItem.receiver,onClose:z,disabled:!!i(U)},{trigger:r((()=>[a("div",j,[n(i(u),{round:"",size:40,src:i(y).currentSessionItem.avatar},null,8,["src"]),a("span",null,m(i(y).currentSessionItem.name),1),n(i(p),{size:24,component:i(f),class:"item__right"},null,8,["component"])])])),_:1},8,["user-id","disabled"]),a("div",w,[b,n(i(d),{value:i(y).currentSessionItem.topping,"onUpdate:value":[s[0]||(s[0]=e=>i(y).currentSessionItem.topping=e),x],class:"item__right"},null,8,["value"])])])])),_:1})])),_:1}))}});export{k as default};
1
+ import{defineComponent as e,useAttrs as s,openBlock as t,createBlock as o,unref as i,withCtx as r,createVNode as n,createElementVNode as a,toDisplayString as m}from"vue";import{NDrawer as c,NDrawerContent as l,NAvatar as p,NIcon as u,NSwitch as d}from"naive-ui";import{ChevronForwardOutline as f}from"@vicons/ionicons5";import{useState as h}from"../hooks/useState.js";import{useSession as v}from"../hooks/useSession.js";import"trtc-sdk-v5";import"date-fns";import{isFunction as S}from"lodash-es";import"../utils/emoji.js";import g from"./PersonProfile.vue.js";import{toppingSessionApi as _}from"../api/index.js";const I={class:"chat-set-wrapper"},j={class:"item user-info"},w={class:"name"},b={class:"item"},k=a("span",{class:"label"},"置顶聊天",-1);var y=e({__name:"ChatSet",setup(e){const y=s(),{state:C}=h(),{setCurrentSessionItem:U,isGroupChat:x}=v(C);async function z(e){try{await _({sessionKey:C.currentSessionItem.sessionKey,id:C.currentSessionItem.id,topping:e}),U({topping:e})}catch(e){console.log(e)}}function K(){S(y["onUpdate:show"])&&y["onUpdate:show"](!1)}return(e,s)=>(t(),o(i(c),{width:320,"trap-focus":!1,"block-scroll":!1,to:".iho-chat"},{default:r((()=>[n(i(l),{title:"聊天设置"},{default:r((()=>[a("div",I,[n(g,{"user-id":i(C).currentSessionItem.receiver,onClose:K,disabled:!!i(x)},{trigger:r((()=>[a("div",j,[n(i(p),{round:"",size:40,src:i(C).currentSessionItem.avatar},null,8,["src"]),a("span",w,m(i(C).currentSessionItem.name),1),n(i(u),{size:24,component:i(f),class:"item__right"},null,8,["component"])])])),_:1},8,["user-id","disabled"]),a("div",b,[k,n(i(d),{value:i(C).currentSessionItem.topping,"onUpdate:value":[s[0]||(s[0]=e=>i(C).currentSessionItem.topping=e),z],class:"item__right"},null,8,["value"])])])])),_:1})])),_:1}))}});export{y as default};
@@ -5,6 +5,7 @@ declare const _default: import("vue").DefineComponent<{}, {
5
5
  all: string;
6
6
  unread: string;
7
7
  };
8
+ unreadSessionKeys: string[];
8
9
  flexWidth: import("vue").Ref<number>;
9
10
  listBoxRef: import("vue").Ref<HTMLElement | undefined>;
10
11
  loading: import("vue").Ref<boolean>;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as s,computed as i,watch as t,withDirectives as n,openBlock as a,createElementBlock as l,normalizeStyle as o,unref as r,createBlock as u,createCommentVNode as d,createElementVNode as m,Fragment as v,renderList as c,withCtx as p,createTextVNode as f,toDisplayString as k,normalizeClass as y,createVNode as _,vShow as h}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 L}from"../hooks/useSession.js";import"trtc-sdk-v5";import{listSort as C,formatTime as j}from"../utils/index.js";import{vFlexibleResize as N}from"../../../../shared/directive/flexibleResize.js";const T={class:"sider-list__filter box-shadow"},K=["onClick"],w={class:"avatar-right"},I={class:"name"},R={class:"msg-tip"},z={class:"msg-tip__content"},H=["innerHTML"];var U=e({__name:"SiderList",setup(e){const U="all",B="unread",E=s(300),O=s(),V=s(!1),q=s([{label:"全部",key:U},{label:"未读",key:B}]),A=s("all"),{state:D,emit:F}=M(),{openSession:G,unreadTotal:J,setSessionList:P}=L(D),Q=i((()=>Math.min(Math.max(E.value,240),360))),W=i((()=>C(D.sessionList)));function X(e){!e.id||D.sessionList.map((e=>e.id)).includes(e.id)?D.sessionList.forEach((s=>{if(s.sessionKey===e.sessionKey){let{unreadNum:i=0}=s;Object.assign(s,e),e.sessionKey!==D.currentSessionItem.sessionKey&&(s.unreadNum=++i)}})):P([...D.sessionList,e])}function Y({distance:e}){E.value=E.value+e}function Z(e,s=r(A)){var i;return s===U||(s===B?(null!=(i=e.unreadNum)?i:0)>0:void 0)}return t([()=>D.isChangeSession,()=>D.isUpdateSession],(([e,s])=>{e&&(X(D.currentSessionItem),D.isChangeSession=!1),s&&(X(D.updateSessionItem),D.isUpdateSession=!1)}),{immediate:!0}),t((()=>J.value),(e=>{const s=W.value.filter((e=>Z(e,B)));F("unread-message-update",e,s)})),(e,s)=>n((a(),l("section",{class:"sider-list",style:o({width:r(Q)+"px"})},[V.value?(a(),u(r(S),{key:0,stroke:"#5585f5"})):d("v-if",!0),d(' <n-input v-else placeholder="输入用户名模糊搜索" v-model:value="keyword" @keyup.enter="handleSearch"></n-input> '),m("div",T,[(a(!0),l(v,null,c(q.value,(e=>(a(),u(r(g),{type:A.value===e.key?"info":"default",round:"",bordered:!1,key:e.key,onClick:()=>{return s=e.key,void(A.value=s);var s}},{default:p((()=>[f(k(e.label)+"("+k(r(J))+") ",1)])),_:2},1032,["type","onClick"])))),128))]),m("div",{class:"sider-list__box",ref_key:"listBoxRef",ref:O},[(a(!0),l(v,null,c(r(W),(e=>n((a(),l("div",{key:e.id,onClick:()=>r(G)(e),class:y(["sider-list__box__item",{active:e.id===r(D).id},e.topping?"sider-list__box__item--top":""])},[_(r(b),{round:"",size:"large",src:e.avatar},null,8,["src"]),m("div",w,[m("div",I,[m("h4",null,k(e.name),1),m("span",null,k(e.lastMessage?r(j)(e.lastMessageSendTime).siderMsgTime:""),1)]),m("div",R,[m("div",z,[m("div",{innerHTML:e.lastMessageContent},null,8,H)]),_(r(x),{value:e.unreadNum>99?"99+":e.unreadNum},null,8,["value"])])])],10,K)),[[h,Z(e)]]))),128))],512)],4)),[[r(N),{mode:"VR",onMove:Y}]])}});export{U 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 o,unref as r,createBlock as u,createCommentVNode as d,createElementVNode as m,Fragment as v,renderList as c,withCtx as p,createTextVNode as f,toDisplayString as y,normalizeClass as k,createVNode as _,vShow as h}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 L}from"../hooks/useSession.js";import"trtc-sdk-v5";import{listSort as C,formatTime as K}from"../utils/index.js";import{vFlexibleResize as N}from"../../../../shared/directive/flexibleResize.js";const j={class:"sider-list__filter box-shadow"},T=["onClick"],w={class:"avatar-right"},I={class:"name"},R={class:"msg-tip"},z={class:"msg-tip__content"},H=["innerHTML"];var U=e({__name:"SiderList",setup(e){const U="all",B="unread";let E=[];const O=s(300),V=s(),q=s(!1),A=s([{label:"全部",key:U},{label:"未读",key:B}]),D=s("all"),{state:F,emit:G}=M(),{openSession:J,unreadTotal:P,setSessionList:Q}=L(F),W=i((()=>Math.min(Math.max(O.value,240),360))),X=i((()=>C(F.sessionList)));function Y(e){!e.id||F.sessionList.map((e=>e.id)).includes(e.id)?F.sessionList.forEach((s=>{if(s.sessionKey===e.sessionKey){let{unreadNum:i=0}=s;Object.assign(s,e),e.sessionKey!==F.currentSessionItem.sessionKey&&(s.unreadNum=++i)}})):Q([...F.sessionList,e])}function Z({distance:e}){O.value=O.value+e}function $(e,s=r(D)){var i;return s===U||(s===B?E.includes(e.sessionKey)||(null!=(i=e.unreadNum)?i:0)>0:void 0)}return n([()=>F.isChangeSession,()=>F.isUpdateSession],(([e,s])=>{e&&(Y(F.currentSessionItem),F.isChangeSession=!1),s&&(Y(F.updateSessionItem),F.isUpdateSession=!1)}),{immediate:!0}),n((()=>P.value),(e=>{const s=X.value.filter((e=>$(e,B)));G("unread-message-update",e,s)})),(e,s)=>t((a(),l("section",{class:"sider-list",style:o({width:r(W)+"px"})},[q.value?(a(),u(r(S),{key:0,stroke:"#5585f5"})):d("v-if",!0),d(' <n-input v-else placeholder="输入用户名模糊搜索" v-model:value="keyword" @keyup.enter="handleSearch"></n-input> '),m("div",j,[(a(!0),l(v,null,c(A.value,(e=>(a(),u(r(g),{type:D.value===e.key?"info":"default",round:"",bordered:!1,key:e.key,onClick:()=>{return s=e.key,D.value=s,void(s===B&&(E=(X.value.filter((e=>{var s;return(null!=(s=e.unreadNum)?s:0)>0}))||[]).map((e=>e.sessionKey))));var s}},{default:p((()=>[f(y(e.label)+"("+y(r(P))+") ",1)])),_:2},1032,["type","onClick"])))),128))]),m("div",{class:"sider-list__box",ref_key:"listBoxRef",ref:V},[(a(!0),l(v,null,c(r(X),(e=>t((a(),l("div",{key:e.id,onClick:()=>r(J)(e),class:k(["sider-list__box__item",{active:e.id===r(F).id},e.topping?"sider-list__box__item--top":""])},[_(r(b),{round:"",size:"large",src:e.avatar},null,8,["src"]),m("div",w,[m("div",I,[m("h4",null,y(e.name),1),m("span",null,y(e.lastMessage?r(K)(e.lastMessageSendTime).siderMsgTime:""),1)]),m("div",R,[m("div",z,[m("div",{innerHTML:e.lastMessageContent},null,8,H)]),_(r(x),{value:e.unreadNum>99?"99+":e.unreadNum},null,8,["value"])])])],10,T)),[[h,$(e)]]))),128))],512)],4)),[[r(N),{mode:"VR",onMove:Z}]])}});export{U as default};