cnhis-design-vue 3.2.8 → 3.2.9-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) 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/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  4. package/es/components/fabric-chart/src/hooks/temperature/useOther.js +1 -1
  5. package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +1 -1
  6. package/es/components/fabric-chart/src/hooks/useCumputedPoint.d.ts +1 -1
  7. package/es/components/fabric-chart/src/hooks/useCumputedPoint.js +1 -1
  8. package/es/components/field-set/src/FieldColor.vue.d.ts +17 -0
  9. package/es/components/field-set/src/FieldFilter.vue.d.ts +17 -0
  10. package/es/components/field-set/src/FieldSet.vue.d.ts +44 -1
  11. package/es/components/field-set/src/FieldSet.vue2.js +1 -1
  12. package/es/components/field-set/src/components/edit-dialog.vue2.js +1 -1
  13. package/es/components/field-set/src/components/table-row.vue.d.ts +17 -0
  14. package/es/components/field-set/src/components/table-row.vue2.js +1 -1
  15. package/es/components/field-set/src/types/index.d.ts +1 -1
  16. package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
  17. package/es/components/iho-chat/index.d.ts +1 -0
  18. package/es/components/iho-chat/src/Index.vue.d.ts +1 -0
  19. package/es/components/iho-chat/src/api/index.d.ts +1 -0
  20. package/es/components/iho-chat/src/api/index.js +1 -1
  21. package/es/components/iho-chat/src/components/ChatFile.vue2.js +1 -1
  22. package/es/components/iho-chat/src/components/ChatFooter.vue.d.ts +13 -11
  23. package/es/components/iho-chat/src/components/ChatFooter.vue2.js +1 -1
  24. package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
  25. package/es/components/iho-chat/src/components/ContextMenu.js +1 -1
  26. package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
  27. package/es/components/iho-chat/style/index.css +1 -1
  28. package/es/components/index.css +1 -1
  29. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  30. package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
  31. package/es/env.d.ts +25 -25
  32. package/es/shared/assets/img/ai__avatar.png.js +1 -1
  33. package/es/shared/assets/img/defaultCover/10review_successful.png.js +1 -1
  34. package/es/shared/assets/img/defaultCover/11review_fail.png.js +1 -1
  35. package/es/shared/assets/img/defaultCover/12no_setting.png.js +1 -1
  36. package/es/shared/assets/img/defaultCover/13no_menu_setting.png.js +1 -1
  37. package/es/shared/assets/img/defaultCover/14no_call_setting.png.js +1 -1
  38. package/es/shared/assets/img/defaultCover/15no_use_tag.png.js +1 -1
  39. package/es/shared/assets/img/defaultCover/16no_table_data.png.js +1 -1
  40. package/es/shared/assets/img/defaultCover/1location.png.js +1 -1
  41. package/es/shared/assets/img/defaultCover/2notfound.png.js +1 -1
  42. package/es/shared/assets/img/defaultCover/3loading.png.js +1 -1
  43. package/es/shared/assets/img/defaultCover/4no_permission.png.js +1 -1
  44. package/es/shared/assets/img/defaultCover/5no_data.png.js +1 -1
  45. package/es/shared/assets/img/defaultCover/6no_network.png.js +1 -1
  46. package/es/shared/assets/img/defaultCover/7no_doctor.png.js +1 -1
  47. package/es/shared/assets/img/defaultCover/8system_error.png.js +1 -1
  48. package/es/shared/assets/img/defaultCover/9system_upgrade.png.js +1 -1
  49. package/es/shared/assets/img/failure.png.js +1 -1
  50. package/es/shared/assets/img/no-permission.png.js +1 -1
  51. package/es/shared/assets/img/nodata.png.js +1 -1
  52. package/es/shared/assets/img/notfound.png.js +1 -1
  53. package/es/shared/assets/img/qr.png.js +1 -1
  54. package/es/shared/assets/img/success.png.js +1 -1
  55. package/es/shared/assets/img/table_style_2.png.js +1 -1
  56. package/es/shared/assets/img/video.png.js +1 -1
  57. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  58. package/es/shared/assets/img/xb_big.png.js +1 -1
  59. package/es/shared/assets/img/xb_small.png.js +1 -1
  60. package/es/shared/package.json.js +1 -1
  61. package/package.json +2 -2
  62. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  63. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
  64. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
  65. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
  66. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
  67. package/es/shared/utils/fabricjs/index.d.ts +0 -6823
  68. package/es/shared/utils/tapable/index.d.ts +0 -139
@@ -1 +1 @@
1
- import{defineComponent as e,inject as l,ref as o,computed as a,reactive as t,openBlock as i,createBlock as s,unref as r,withCtx as n,createVNode as u,normalizeStyle as c,createElementVNode as d,createCommentVNode as m}from"vue";import{useMessage as p,NModal as f,NForm as v,NFormItem as b,NInput as h,NColorPicker as g,NSelect as k,NCheckbox as _,NRadioGroup as w,NSpace as y,NRadio as C}from"naive-ui";import{useTheme as j}from"../../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import"lodash-es";import"@vue/shared";import"../../../../shared/utils/index.js";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import"../../../../shared/hooks/useScrollLoading.js";import x from"./condition.vue.js";import F from"./edit-filter.vue.js";import{COLOR_MAP as N,InjectionFieldList as U}from"../constants/index.js";var O=e({__name:"edit-dialog",props:{visible:{type:Boolean,default:!1},isFieldColor:{type:Boolean,default:!0},row:{type:Object,default:null}},emits:["update:visible","confirm"],setup(e,{emit:O}){const S=e,q=j(),B=p(),E=Object.entries(N).map((([e,l])=>({label:l,value:e}))),R=Object.entries(N).map((([e])=>e)),D=l(U),H=o(),L=o(),P=o(!1),T=a((()=>S.row?S.isFieldColor?"修改":"过滤条件":"新增")),W=t({name:"",color:"",status:!0,columnName:"",colorScope:S.isFieldColor?"font":"background",condition:[],sqlExpression:""}),z=t({name:[{required:!0,message:"请输入名称",trigger:["blur"]}],color:[{required:!0,message:"请选择颜色",trigger:["blur"]}],columnName:[{required:!0,validator:(e,l)=>!(!l&&S.isFieldColor)||new Error("请选择字段"),trigger:["blur"]}]});function A(e){return u("span",{style:{"--color":e.value},class:"c-field-set__color-block"},[e.label])}function G(){var e;console.log(W),null==(e=H.value)||e.validate((async e=>{var l,o;if(e){const l=await e;B.warning(l[0][0].message)}else{if(S.isFieldColor||Object.assign(W,L.value.getData()),!(null==(l=W.condition)?void 0:l.length))return void B.warning("请配置过滤条件");const e=S.isFieldColor?{title:null==(o=D.find((e=>e.columnName===W.columnName)))?void 0:o.title}:{};O("confirm",{...W,...e}),I()}}))}function I(){O("update:visible",!1)}function J(e){Object.assign(W,e)}return function(){if(!S.row)return;Object.assign(W,S.row)}(),(l,o)=>(i(),s(r(f),{preset:"dialog",style:{width:"860px"},title:r(T),"close-on-esc":!1,"show-icon":!1,"mask-closable":!1,"positive-text":"确定","negative-text":"取消","trap-focus":!1,show:e.visible,onPositiveClick:G,onNegativeClick:I,onClose:I},{default:n((()=>[u(r(v),{ref_key:"formRef",ref:H,model:W,rules:z,"label-placement":"left","label-width":"auto","show-feedback":!1,"show-require-mark":!1,style:c({maxWidth:"500px",...r(q)})},{default:n((()=>[u(r(b),{label:"名称:",path:"name",style:{"margin-bottom":"10px"}},{default:n((()=>[u(r(h),{value:W.name,"onUpdate:value":o[0]||(o[0]=e=>W.name=e),placeholder:"请填写名称",clearable:""},null,8,["value"])])),_:1}),e.isFieldColor?(i(),s(r(b),{key:0,label:"颜色:",path:"color"},{default:n((()=>[u(r(g),{clearable:"",placeholder:"请选择颜色",value:W.color,"onUpdate:value":o[1]||(o[1]=e=>W.color=e),swatches:r(R),modes:["hex"],class:"c-field-set__color-picker"},null,8,["value","swatches"])])),_:1})):(i(),s(r(b),{key:1,label:"颜色:",path:"color"},{default:n((()=>[u(r(k),{value:W.color,"onUpdate:value":o[2]||(o[2]=e=>W.color=e),placeholder:"请选择颜色","render-label":A,options:r(E)},null,8,["value","options"])])),_:1})),u(r(b),{label:"显示:",path:"status"},{default:n((()=>[u(r(_),{checked:W.status,"onUpdate:checked":o[3]||(o[3]=e=>W.status=e)},null,8,["checked"])])),_:1}),u(r(b),{label:"颜色应用于:",path:"colorScope"},{default:n((()=>[u(r(w),{value:W.colorScope,"onUpdate:value":o[4]||(o[4]=e=>W.colorScope=e)},{default:n((()=>[u(r(y),null,{default:n((()=>[u(r(C),{label:"字体",value:"font"}),u(r(C),{label:"背景",value:"background"})])),_:1})])),_:1},8,["value"])])),_:1}),e.isFieldColor?(i(),s(r(b),{key:2,label:"字段:",path:"columnName",style:{"margin-bottom":"10px"}},{default:n((()=>[u(r(y),{class:"c-field-set__space",align:"center"},{default:n((()=>[u(r(k),{value:W.columnName,"onUpdate:value":o[5]||(o[5]=e=>W.columnName=e),placeholder:"请选择字段名","label-field":"title","value-field":"columnName",options:r(D)},null,8,["value","options"]),d("span",{class:"filter-btn",onClick:o[6]||(o[6]=()=>P.value=!0)},"筛选")])),_:1})])),_:1})):m("v-if",!0)])),_:1},8,["model","rules","style"]),e.isFieldColor?(i(),s(F,{key:1,visible:P.value,"onUpdate:visible":o[7]||(o[7]=e=>P.value=e),model:W,onConfirm:J},null,8,["visible","model"])):(i(),s(x,{key:0,ref_key:"conditionRef",ref:L,data:W},null,8,["data"]))])),_:1},8,["title","show"]))}});export{O as default};
1
+ import{defineComponent as e,inject as l,ref as o,computed as a,reactive as t,openBlock as i,createBlock as r,unref as s,withCtx as n,createVNode as u,normalizeStyle as c,createElementVNode as d,createCommentVNode as m}from"vue";import{useMessage as p,NModal as f,NForm as v,NFormItem as b,NInput as h,NColorPicker as g,NSelect as k,NCheckbox as _,NRadioGroup as w,NSpace as y,NRadio as C}from"naive-ui";import{useTheme as j}from"../../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import"lodash-es";import"@vue/shared";import"../../../../shared/utils/index.js";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import"../../../../shared/hooks/useScrollLoading.js";import x from"./condition.vue.js";import F from"./edit-filter.vue.js";import{COLOR_MAP as N,InjectionFieldList as U}from"../constants/index.js";var O=e({__name:"edit-dialog",props:{visible:{type:Boolean,default:!1},isFieldColor:{type:Boolean,default:!0},row:{type:Object,default:null}},emits:["update:visible","confirm"],setup(e,{emit:O}){const S=e,q=j(),B=p(),E=Object.entries(N).map((([e,l])=>({label:l,value:e}))),R=Object.entries(N).map((([e])=>e)),D=l(U),H=o(),L=o(),P=o(!1),T=a((()=>S.row?S.isFieldColor?"修改":"过滤条件":"新增")),W=t({name:"",color:"",status:!0,columnName:"",colorScope:S.isFieldColor?"font":"background",condition:[],sqlExpression:""}),z=t({name:[{required:!0,message:"请输入名称",trigger:["blur"]}],color:[{required:!0,message:"请选择颜色",trigger:["blur"]}],columnName:[{required:!0,validator:(e,l)=>!(!l&&S.isFieldColor)||new Error("请选择字段"),trigger:["blur"]}]});function A(e){return u("span",{style:{"--color":e.value},class:"c-field-set__color-block"},[e.label])}function G(){var e;null==(e=H.value)||e.validate((async e=>{var l,o;if(e){const l=await e;B.warning(l[0][0].message)}else{if(S.isFieldColor||Object.assign(W,L.value.getData()),!(null==(l=W.condition)?void 0:l.length))return void B.warning("请配置过滤条件");const e=S.isFieldColor?{title:null==(o=D.find((e=>e.columnName===W.columnName)))?void 0:o.title}:{};O("confirm",{...W,...e}),I()}}))}function I(){O("update:visible",!1)}function J(e){Object.assign(W,e)}return function(){if(!S.row)return;Object.assign(W,S.row)}(),(l,o)=>(i(),r(s(f),{preset:"dialog",style:{width:"860px"},title:s(T),"close-on-esc":!1,"show-icon":!1,"mask-closable":!1,"positive-text":"确定","negative-text":"取消","trap-focus":!1,show:e.visible,onPositiveClick:G,onNegativeClick:I,onClose:I},{default:n((()=>[u(s(v),{ref_key:"formRef",ref:H,model:W,rules:z,"label-placement":"left","label-width":"auto","show-feedback":!1,"show-require-mark":!1,style:c({maxWidth:"500px",...s(q)})},{default:n((()=>[u(s(b),{label:"名称:",path:"name",style:{"margin-bottom":"10px"}},{default:n((()=>[u(s(h),{value:W.name,"onUpdate:value":o[0]||(o[0]=e=>W.name=e),placeholder:"请填写名称",clearable:""},null,8,["value"])])),_:1}),e.isFieldColor?(i(),r(s(b),{key:0,label:"颜色:",path:"color"},{default:n((()=>[u(s(g),{clearable:"",placeholder:"请选择颜色",value:W.color,"onUpdate:value":o[1]||(o[1]=e=>W.color=e),swatches:s(R),modes:["hex"],class:"c-field-set__color-picker"},null,8,["value","swatches"])])),_:1})):(i(),r(s(b),{key:1,label:"颜色:",path:"color"},{default:n((()=>[u(s(k),{value:W.color,"onUpdate:value":o[2]||(o[2]=e=>W.color=e),placeholder:"请选择颜色","render-label":A,options:s(E)},null,8,["value","options"])])),_:1})),u(s(b),{label:"显示:",path:"status"},{default:n((()=>[u(s(_),{checked:W.status,"onUpdate:checked":o[3]||(o[3]=e=>W.status=e)},null,8,["checked"])])),_:1}),u(s(b),{label:"颜色应用于:",path:"colorScope"},{default:n((()=>[u(s(w),{value:W.colorScope,"onUpdate:value":o[4]||(o[4]=e=>W.colorScope=e)},{default:n((()=>[u(s(y),null,{default:n((()=>[u(s(C),{label:"字体",value:"font"}),u(s(C),{label:"背景",value:"background"})])),_:1})])),_:1},8,["value"])])),_:1}),e.isFieldColor?(i(),r(s(b),{key:2,label:"字段:",path:"columnName",style:{"margin-bottom":"10px"}},{default:n((()=>[u(s(y),{class:"c-field-set__space",align:"center"},{default:n((()=>[u(s(k),{value:W.columnName,"onUpdate:value":o[5]||(o[5]=e=>W.columnName=e),placeholder:"请选择字段名","label-field":"title","value-field":"columnName",options:s(D)},null,8,["value","options"]),d("span",{class:"filter-btn",onClick:o[6]||(o[6]=()=>P.value=!0)},"筛选")])),_:1})])),_:1})):m("v-if",!0)])),_:1},8,["model","rules","style"]),e.isFieldColor?(i(),r(F,{key:1,visible:P.value,"onUpdate:visible":o[7]||(o[7]=e=>P.value=e),model:W,onConfirm:J},null,8,["visible","model"])):(i(),r(x,{key:0,ref_key:"conditionRef",ref:L,data:W},null,8,["data"]))])),_:1},8,["title","show"]))}});export{O as default};
@@ -82,6 +82,10 @@ declare const _default: import("vue").DefineComponent<{
82
82
  columnWidthProps: {
83
83
  type: ObjectConstructor;
84
84
  };
85
+ hideExpressionOption: {
86
+ type: PropType<AnyObject[]>;
87
+ default: () => never[];
88
+ };
85
89
  }, {
86
90
  fixedWayOptions: {
87
91
  label: string;
@@ -176,6 +180,10 @@ declare const _default: import("vue").DefineComponent<{
176
180
  columnWidthProps: {
177
181
  type: ObjectConstructor;
178
182
  };
183
+ hideExpressionOption: {
184
+ type: PropType<AnyObject[]>;
185
+ default: () => never[];
186
+ };
179
187
  }>> & {
180
188
  onUpdateChecked?: ((...args: any[]) => any) | undefined;
181
189
  onEdit?: ((...args: any[]) => any) | undefined;
@@ -193,6 +201,10 @@ declare const _default: import("vue").DefineComponent<{
193
201
  label: string;
194
202
  value: number;
195
203
  }[];
204
+ selectProps: (field: string) => {
205
+ valueField: string;
206
+ labelField: string;
207
+ };
196
208
  getOptions: (column: AnyObject) => any;
197
209
  setDisabled: (column: AnyObject) => any;
198
210
  getStyle: (column: AnyObject) => CSSProperties;
@@ -293,6 +305,10 @@ declare const _default: import("vue").DefineComponent<{
293
305
  columnWidthProps: {
294
306
  type: ObjectConstructor;
295
307
  };
308
+ hideExpressionOption: {
309
+ type: PropType<AnyObject[]>;
310
+ default: () => never[];
311
+ };
296
312
  }>> & {
297
313
  onUpdateChecked?: ((...args: any[]) => any) | undefined;
298
314
  onEdit?: ((...args: any[]) => any) | undefined;
@@ -342,5 +358,6 @@ declare const _default: import("vue").DefineComponent<{
342
358
  isHighlight: boolean;
343
359
  isFieldSet: boolean;
344
360
  fieldDescribeMode: "column" | "tooltip";
361
+ hideExpressionOption: AnyObject[];
345
362
  }>;
346
363
  export default _default;
@@ -1 +1 @@
1
- import{defineComponent as e,openBlock as t,createElementBlock as l,Fragment as i,renderList as n,normalizeStyle as o,unref as a,createBlock as r,withCtx as d,createVNode as u,createCommentVNode as s,createElementVNode as c,toDisplayString as f,normalizeClass as p,withDirectives as m,vShow as v,resolveDynamicComponent as y,createTextVNode as g}from"vue";import{NTooltip as b,NIcon as h,NCheckbox as k,NSelect as x,NColorPicker as E,NInput as S,NInputNumber as D,NPopconfirm as T}from"naive-ui";import{setStyle as w,setColorInfo as O,isShowExplicitRequired as j,isDisable as C}from"../utils/index.js";import{ReorderTwoOutline as M,HelpCircleOutline as N,CreateOutline as U,TrashOutline as _}from"@vicons/ionicons5";import{isFunction as P,isArray as A,range as H}from"lodash-es";import{COLOR_MAP as L}from"../constants/index.js";import{WIDGET_TYPE as R,SELECT_MAP as F,WIDGET_MAP as V,SELECT_TYPE as B,SELECT_DEFAULT_MAP as I,DATE_MAP as W,DATETIME_MAP as q}from"../constants/filter.js";const G={class:"row"},z=["title"],J=c("span",null,"拖拽调整顺序",-1);var K=e({__name:"table-row",props:{element:{type:Object,default:()=>({})},columns:{type:Array,default:()=>[]},idx:{type:Number,default:1},data:{type:Array,default:()=>[]},isHighlight:{type:Boolean},index:{type:Number,default:0},isHighlightRow:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},isFieldSet:{type:Boolean,default:!1},fieldDescribeMode:{type:String,default:"tooltip"},developMode:{type:Boolean},columnWidthProps:{type:Object}},emits:["updateChecked","edit"],setup(e,{emit:K}){const Q=e,X=[{label:"不固定",value:"NONE"},{label:"左固定",value:"LEFT"},{label:"右固定",value:"RIGHT"}],Y=[{label:"不排序",value:"NONE"},{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],Z=[{label:"字体",value:"font"},{label:"背景",value:"background"}],$=Object.entries(L).map((([e])=>e));function ee(){Q.data.splice(Q.index,1)}function te(){K("edit",Q.element)}function le(){var e;return Q.element.feildDescribe||(null==(e=Q.element.settingObj)?void 0:e.fieldDescDev)}function ie(e){return"seq"===e?Q.idx:"optionType"===e?Q.element[e]&&Q.element.type===R.SELECT?F[Q.element[e]]:"":"type"===e?V[Q.element[e]]:Q.element[e]}function ne(e){if("defaultValue"===e){const{optionType:e}=Q.element;return e===B.SELECT_MULTIPLE}return!1}function oe(e){if("0001"==Q.element.id&&"fixedWay"!=e)return!1;const{isConfiguredHeaderFilter:t}=Q.element;return"isShowHeaderFilter"===e?!!t:!(["explicitRequired","defaultValue"].includes(e)&&![R.DATE,R.DATETIME,R.SELECT].includes(Q.element.type))}function ae(e){return!["explicitRequired","defaultValue"].includes(e)||j(Q.element)}function re(e){switch(e.field){case"fixedWay":return X;case"sortDirection":return Y;case"sortPriority":return function(){const e=H(1,Q.data.length+1).map((e=>({label:e.toString(),value:e}))),t=Q.data.filter((e=>!!e.sortPriority&&e.uuid!==Q.element.uuid)).map((e=>e.sortPriority));return e.filter((e=>!t.includes(e.value)))}();case"colorScope":return Z;case"defaultValue":{const{type:e,optionInfo:t}=Q.element;return e===R.SELECT?A(null==t?void 0:t.list)&&t.list.length>0?t.list.map((e=>({...e,label:e.name}))):Object.entries(I).map((([e,t])=>({value:e,label:t}))):e===R.DATE?Object.entries(W).map((([e,t])=>({value:e,label:t}))):e===R.DATETIME?Object.entries(q).map((([e,t])=>({value:e,label:t}))):[]}default:return[]}}function de(e){var t;if(1==Q.element.defaultMark||"color"===e.type&&Q.isHighlightRow)return!0;if("checkbox"===e.type)return"show"===e.field&&e.fieldShowMaxValue?!Q.element[e.field]&&(null==(t=Q.data.filter((t=>t[e.field])))?void 0:t.length)===e.fieldShowMaxValue:C(Q.element,e.field);if("sortPriority"!==e.field)return!1;const{sortDirection:l}=Q.element;return!l||"NONE"===l}function ue(e){return["title","result"].includes(e.field)&&Q.element.style||{}}return(j,C)=>(t(),l("div",G,[(t(!0),l(i,null,n(e.columns,((n,j)=>{return t(),l(i,{key:j},[n.isShow?(t(),l("span",{key:0,class:"table-cell",title:e.element[n.field],style:o(a(w)(n,j,e.columnWidthProps))},["text"===n.type?(t(),l(i,{key:0},[0===j?(t(),l(i,{key:0},[!e.isFieldSet||e.draggable&&e.isFieldSet?(t(),r(a(b),{key:0,trigger:"hover"},{trigger:d((()=>[u(a(h),{style:{"margin-right":"5px",top:"2px"},component:a(M)},null,8,["component"])])),default:d((()=>[J])),_:1})):s("v-if",!0),(A=n.field,"title"===A&&("tooltip"===Q.fieldDescribeMode&&Q.element.feildDescribe||Q.developMode&&(null==(H=Q.element.settingObj)?void 0:H.fieldDescDev))?(t(),r(a(b),{key:1,trigger:"hover"},{trigger:d((()=>[u(a(h),{style:{"margin-right":"5px",top:"2px"},component:a(N)},null,8,["component"])])),default:d((()=>[c("span",null,f(le()),1)])),_:1})):s("v-if",!0))],64)):s("v-if",!0),c("span",{class:p([e.isHighlight&&"title"===n.field?"highlight":""]),style:o(ue(n))},f(ie(n.field)),7)],64)):s("v-if",!0),"checkbox"===n.type&&oe(n.field)?m((t(),r(a(k),{key:1,disabled:de(n),checked:e.element[n.field],"onUpdate:checked":[t=>e.element[n.field]=t,e=>function(e,t){K("updateChecked",{checked:e,column:t})}(e,n)]},null,8,["disabled","checked","onUpdate:checked"])),[[v,ae(n.field)]]):s("v-if",!0),"select"===n.type&&oe(n.field)?m((t(),r(a(x),{key:2,clearable:"",multiple:ne(n.field),disabled:de(n),value:e.element[n.field],"onUpdate:value":[t=>e.element[n.field]=t,e=>function(e,t){"sortDirection"===t.field&&"NONE"===e&&(Q.element.sortPriority=null),"colorScope"===t.field&&O(Q.element)}(e,n)],options:re(n)},null,8,["multiple","disabled","value","onUpdate:value","options"])),[[v,ae(n.field)]]):s("v-if",!0),"color"===n.type?(t(),r(a(E),{key:3,class:"c-field-set__color-picker",clearable:"",disabled:de(n),value:e.element[n.field],"onUpdate:value":[t=>e.element[n.field]=t,C[0]||(C[0]=t=>a(O)(e.element))],"show-preview":"",modes:["hex"],swatches:a($)},null,8,["disabled","value","onUpdate:value","swatches"])):s("v-if",!0),"input"===n.type?m((t(),r(a(S),{key:4,value:e.element[n.field],"onUpdate:value":t=>e.element[n.field]=t,clearable:""},null,8,["value","onUpdate:value"])),[[v,"0001"!=e.element.id]]):s("v-if",!0),"inputNumber"===n.type?(t(),r(a(D),{key:5,value:e.element[n.field],"onUpdate:value":t=>e.element[n.field]=t},null,8,["value","onUpdate:value"])):s("v-if",!0),"custom"===n.type&&a(P)(n.contentRender)?(t(),r(y((()=>n.contentRender(n,e.element))),{key:6})):s("v-if",!0),"custom"===n.type&&"opt"===n.field&&1!=e.element.defaultMark?(t(),l(i,{key:7},[u(a(b),{trigger:"hover"},{trigger:d((()=>[u(a(h),{component:a(U),onClick:te},null,8,["component"])])),default:d((()=>[g(" 编辑 ")])),_:1}),u(a(T),{onPositiveClick:ee},{trigger:d((()=>[u(a(b),{trigger:"hover"},{trigger:d((()=>[u(a(h),{component:a(_)},null,8,["component"])])),default:d((()=>[g(" 删除 ")])),_:1})])),default:d((()=>[g(" 是否确认删除? ")])),_:1})],64)):s("v-if",!0)],12,z)):s("v-if",!0)],64);var A,H})),128))]))}});export{K as default};
1
+ import{defineComponent as e,openBlock as l,createElementBlock as t,Fragment as i,renderList as n,normalizeStyle as o,unref as a,createBlock as r,withCtx as d,createVNode as u,createCommentVNode as s,createElementVNode as c,toDisplayString as f,normalizeClass as p,withDirectives as m,vShow as v,mergeProps as y,resolveDynamicComponent as b,createTextVNode as h}from"vue";import{NTooltip as g,NIcon as k,NCheckbox as x,NSelect as E,NColorPicker as S,NInput as D,NInputNumber as T,NPopconfirm as w}from"naive-ui";import{setStyle as O,setColorInfo as j,isShowExplicitRequired as C,isDisable as M}from"../utils/index.js";import{ReorderTwoOutline as N,HelpCircleOutline as U,CreateOutline as F,TrashOutline as _}from"@vicons/ionicons5";import{isFunction as P,isArray as A,range as H}from"lodash-es";import{COLOR_MAP as L}from"../constants/index.js";import{WIDGET_TYPE as R,SELECT_MAP as V,WIDGET_MAP as B,SELECT_TYPE as I,SELECT_DEFAULT_MAP as W,DATE_MAP as q,DATETIME_MAP as G}from"../constants/filter.js";const z={class:"row"},J=["title"],K=c("span",null,"拖拽调整顺序",-1);var Q=e({__name:"table-row",props:{element:{type:Object,default:()=>({})},columns:{type:Array,default:()=>[]},idx:{type:Number,default:1},data:{type:Array,default:()=>[]},isHighlight:{type:Boolean},index:{type:Number,default:0},isHighlightRow:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},isFieldSet:{type:Boolean,default:!1},fieldDescribeMode:{type:String,default:"tooltip"},developMode:{type:Boolean},columnWidthProps:{type:Object},hideExpressionOption:{type:Array,default:()=>[]}},emits:["updateChecked","edit"],setup(e,{emit:Q}){const X=e,Y=[{label:"不固定",value:"NONE"},{label:"左固定",value:"LEFT"},{label:"右固定",value:"RIGHT"}],Z=[{label:"不排序",value:"NONE"},{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],$=[{label:"字体",value:"font"},{label:"背景",value:"background"}],ee=Object.entries(L).map((([e])=>e));function le(){X.data.splice(X.index,1)}function te(){Q("edit",X.element)}function ie(){var e;return X.element.feildDescribe||(null==(e=X.element.settingObj)?void 0:e.fieldDescDev)}function ne(e){return"seq"===e?X.idx:"optionType"===e?X.element[e]&&X.element.type===R.SELECT?V[X.element[e]]:"":"type"===e?B[X.element[e]]:X.element[e]}function oe(e){if("defaultValue"===e){const{optionType:e}=X.element;return e===I.SELECT_MULTIPLE}return!1}function ae(e){if("0001"==X.element.id&&"fixedWay"!=e)return!1;const{isConfiguredHeaderFilter:l}=X.element;return"isShowHeaderFilter"===e?!!l:!(["explicitRequired","defaultValue"].includes(e)&&![R.DATE,R.DATETIME,R.SELECT].includes(X.element.type))}function re(e){return!["explicitRequired","defaultValue"].includes(e)||C(X.element)}function de(e){const l={valueField:"value",labelField:"label"};return"hideExpression"===e&&(l.valueField="id",l.labelField="name"),l}function ue(e){switch(e.field){case"fixedWay":return Y;case"sortDirection":return Z;case"sortPriority":return function(){const e=H(1,X.data.length+1).map((e=>({label:e.toString(),value:e}))),l=X.data.filter((e=>!!e.sortPriority&&e.uuid!==X.element.uuid)).map((e=>e.sortPriority));return e.filter((e=>!l.includes(e.value)))}();case"colorScope":return $;case"hideExpression":return X.hideExpressionOption;case"defaultValue":{const{type:e,optionInfo:l}=X.element;return e===R.SELECT?A(null==l?void 0:l.list)&&l.list.length>0?l.list.map((e=>({...e,label:e.name}))):Object.entries(W).map((([e,l])=>({value:e,label:l}))):e===R.DATE?Object.entries(q).map((([e,l])=>({value:e,label:l}))):e===R.DATETIME?Object.entries(G).map((([e,l])=>({value:e,label:l}))):[]}default:return[]}}function se(e){var l;if(1==X.element.defaultMark||"color"===e.type&&X.isHighlightRow)return!0;if("checkbox"===e.type)return"show"===e.field&&e.fieldShowMaxValue?!X.element[e.field]&&(null==(l=X.data.filter((l=>l[e.field])))?void 0:l.length)===e.fieldShowMaxValue:M(X.element,e.field);if("sortPriority"!==e.field)return!1;const{sortDirection:t}=X.element;return!t||"NONE"===t}function ce(e){return["title","result"].includes(e.field)&&X.element.style||{}}return(C,M)=>(l(),t("div",z,[(l(!0),t(i,null,n(e.columns,((n,C)=>{return l(),t(i,{key:C},[n.isShow?(l(),t("span",{key:0,class:"table-cell",title:e.element[n.field],style:o(a(O)(n,C,e.columnWidthProps))},["text"===n.type?(l(),t(i,{key:0},[0===C?(l(),t(i,{key:0},[!e.isFieldSet||e.draggable&&e.isFieldSet?(l(),r(a(g),{key:0,trigger:"hover"},{trigger:d((()=>[u(a(k),{style:{"margin-right":"5px",top:"2px"},component:a(N)},null,8,["component"])])),default:d((()=>[K])),_:1})):s("v-if",!0),(A=n.field,"title"===A&&("tooltip"===X.fieldDescribeMode&&X.element.feildDescribe||X.developMode&&(null==(H=X.element.settingObj)?void 0:H.fieldDescDev))?(l(),r(a(g),{key:1,trigger:"hover"},{trigger:d((()=>[u(a(k),{style:{"margin-right":"5px",top:"2px"},component:a(U)},null,8,["component"])])),default:d((()=>[c("span",null,f(ie()),1)])),_:1})):s("v-if",!0))],64)):s("v-if",!0),c("span",{class:p([e.isHighlight&&"title"===n.field?"highlight":""]),style:o(ce(n))},f(ne(n.field)),7)],64)):s("v-if",!0),"checkbox"===n.type&&ae(n.field)?m((l(),r(a(x),{key:1,disabled:se(n),checked:e.element[n.field],"onUpdate:checked":[l=>e.element[n.field]=l,e=>function(e,l){Q("updateChecked",{checked:e,column:l})}(e,n)]},null,8,["disabled","checked","onUpdate:checked"])),[[v,re(n.field)]]):s("v-if",!0),"select"===n.type&&ae(n.field)?m((l(),r(a(E),y({key:2},de(n.field),{clearable:"",multiple:oe(n.field),disabled:se(n),value:e.element[n.field],"onUpdate:value":[l=>e.element[n.field]=l,e=>function(e,l){"sortDirection"===l.field&&"NONE"===e&&(X.element.sortPriority=null),"colorScope"===l.field&&j(X.element)}(e,n)],options:ue(n)}),null,16,["multiple","disabled","value","onUpdate:value","options"])),[[v,re(n.field)]]):s("v-if",!0),"color"===n.type?(l(),r(a(S),{key:3,class:"c-field-set__color-picker",clearable:"",disabled:se(n),value:e.element[n.field],"onUpdate:value":[l=>e.element[n.field]=l,M[0]||(M[0]=l=>a(j)(e.element))],"show-preview":"",modes:["hex"],swatches:a(ee)},null,8,["disabled","value","onUpdate:value","swatches"])):s("v-if",!0),"input"===n.type?m((l(),r(a(D),{key:4,value:e.element[n.field],"onUpdate:value":l=>e.element[n.field]=l,clearable:""},null,8,["value","onUpdate:value"])),[[v,"0001"!=e.element.id]]):s("v-if",!0),"inputNumber"===n.type?(l(),r(a(T),{key:5,value:e.element[n.field],"onUpdate:value":l=>e.element[n.field]=l},null,8,["value","onUpdate:value"])):s("v-if",!0),"custom"===n.type&&a(P)(n.contentRender)?(l(),r(b((()=>n.contentRender(n,e.element))),{key:6})):s("v-if",!0),"custom"===n.type&&"opt"===n.field&&1!=e.element.defaultMark?(l(),t(i,{key:7},[u(a(g),{trigger:"hover"},{trigger:d((()=>[u(a(k),{component:a(F),onClick:te},null,8,["component"])])),default:d((()=>[h(" 编辑 ")])),_:1}),u(a(w),{onPositiveClick:le},{trigger:d((()=>[u(a(g),{trigger:"hover"},{trigger:d((()=>[u(a(k),{component:a(_)},null,8,["component"])])),default:d((()=>[h(" 删除 ")])),_:1})])),default:d((()=>[h(" 是否确认删除? ")])),_:1})],64)):s("v-if",!0)],12,J)):s("v-if",!0)],64);var A,H})),128))]))}});export{Q as default};
@@ -18,7 +18,7 @@ export type FieldSetItem = Partial<{
18
18
  hide: boolean;
19
19
  [key: string]: any;
20
20
  }>;
21
- export type FieldSetColumnName = 'show' | 'editable' | 'required' | 'sort' | 'bold' | 'sortDirection' | 'sortPriority' | 'fixedWay' | 'alias' | 'columnWidth';
21
+ export type FieldSetColumnName = 'show' | 'editable' | 'required' | 'sort' | 'bold' | 'sortDirection' | 'sortPriority' | 'fixedWay' | 'alias' | 'columnWidth' | 'hideExpression';
22
22
  export type FieldSetColumnItem = {
23
23
  title: string;
24
24
  type: 'text' | 'checkbox' | 'select' | 'input' | 'inputNumber' | 'color' | 'custom';
@@ -1 +1 @@
1
- import{arrayed as e,deepOmit as o}from"../../../../shared/utils/index.js";import{cloneDeep as t,castArray as n,pick as i}from"lodash-es";import"../../index.js";import{parseNumberFromMaybeString as r,formRenderLog as l}from"../utils/index.js";import{useFieldNormalize as s}from"./useFieldNormalize.js";import{traverseSchema as a,fieldKeyEscape as p,createLinebarId as c}from"../utils/schema.js";import{useFormValidator as d}from"./useFormValidator.js";import{transformDateFormat as m}from"../utils/business.js";function u(e,o){Object.assign(e["x-component-props"],{...i(o,["wordbook","autograph"])})}function x(e,o){Object.assign(e["x-component-props"],{...i(o,["urlConfig","wordbook"])})}function f(e){return"1"===e||!0===e}function _(n,_){const{createValidatorSchema:b}=d(),v=e=>{var o;const t={name:e.val_key,type:null!=(o=e.fieldType)?o:"string",title:e.alias||e.name,"x-component":e.html_type,default:e.default_val,"x-component-props":{placeholder:e.placeholder,clearable:"0"===e.is_empty,...e.componentProps||{}},"x-content":e.slots,"x-display":"0"===e.is_show?"hidden":"visible","x-pattern":"0"===e.is_edit?"disabled":"editable","x-compile-omitted":["title","x-component-props","x-decorator-props"]};e.reactions&&(t["x-reactions"]=e.reactions),e.noDecorator||Object.assign(t,{"x-decorator":"FORM_ITEM","x-decorator-props":{fieldItem:e,beforeSetValue:null==_?void 0:_.beforeSetValue,span:2*(e.elem_width||3),showLabel:"1"!==e.hide_title,remark:e.remark,propertyKey:e.val_key,annotation:e.annotation,...e.decoratorProps||{}}});const n=b(e);return n&&(t["x-validator"]=n),"0"===e.is_null&&(t.required=!0),t},g=e=>{var o,t,n,l,s,a,p,c,d,m,_,h,b,g;const y=v(e);e.urlConfig?x(y,e):e.autograph&&u(y,e);const w=!!e.__multiple,C=f(null!=(t=null==(o=e.componentProps)?void 0:o.allowModify)?t:e.allowModify),O=f(null!=(l=null==(n=e.componentProps)?void 0:n.selectAll)?l:e.selectAll),A=f(null!=(a=null==(s=e.componentProps)?void 0:s.shouldSave)?a:e.save_free_entry),E=f(null!=(c=null==(p=e.componentProps)?void 0:p.allowCreate)?c:e.free_entry),j=null!=(m=null==(d=e.componentProps)?void 0:d.showField)?m:e.show_key,k=null!=(h=null==(_=e.componentProps)?void 0:_.options)?h:e.option,N=null!=(g=r(e.multi_select_value))?g:null==(b=e.componentProps)?void 0:b.maxTagCount;return Object.assign(y["x-component-props"],{multiple:w,options:k,allowModify:C,allowCreate:E||C,shouldSave:A,showField:j,maxTagCount:N,selectAll:O,...i(e,["lazyRequest","requestCache"])}),w&&(y.type="array"),y},y=e=>{var o,t;const n=v(e),i=null!=(t=null==(o=e.componentProps)?void 0:o.selectAll)?t:e.selectAll;return Object.assign(n["x-component-props"],{options:e.option,childFieldStrategy:e.childFieldStrategy,childWidthMode:e.childWidthMode,vertical:e.__vertical,selectAll:"1"===i||!0===i}),e.urlConfig?x(n,e):e.autograph&&u(n,e),n},w=e=>{const t=v(e);return Object.assign(t["x-component-props"],{fieldItem:o(e,["reactions"])}),t},C=e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINEBAR","x-display":"visible","x-component-props":{linebarTextDirection:e.linebarTextDirection,linebarDirection:e.linebarDirection,linebarWidth:e.linebarWidth,disabled:"1"===e.is_not_fold,id:c(e.val_key),show:"0"!==e.is_show,remark:e.remark},"x-content":e.slots}),O=new Map([["LINEBAR",C],["LINE_BREAKS",e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINE_BREAKS","x-component-props":{border:e.lineBreaksBorder},"x-display":"0"===e.is_show?"hidden":"visible"})],["INPUT",e=>{const o=v(e);return Object.assign(o["x-component-props"],{...i(e,["prefix","suffix"])}),o}],["TEXTAREA",e=>{const o=v(e);return Object.assign(o["x-component-props"],{rows:e.initialize_high||3}),o}],["INPUT_NUMBER",e=>{const o=v(e),{decimal_length:t,validate:n,allowSlash:i}=e;return!0!==i&&"1"!==i||(o["x-component"]="INPUT_NUMBER_SLASH",o.type="string"),Object.assign(o["x-component-props"],{precision:r(null!=t?t:null==n?void 0:n.decimal_length),whiteList:e.whiteList,prefix:e.prefix,suffix:e.suffix}),o}],["SELECT",g],["REMOTE_SEARCH",g],["DATE",e=>{const o=v(e);return Object.assign(o["x-component-props"],{valueFormat:e.date_format,type:m(e.date_format),validate:e.validate}),o}],["TIME",e=>{const o=v(e);return Object.assign(o["x-component-props"],{format:e.date_format,type:m(e.date_format),validate:e.validate}),o}],["LEVEL_SEARCH_CASCADER",e=>{const o=v(e);return Object.assign(o["x-component-props"],{...i(e,["wordbook","lazyRequest","autograph"])}),"1"===e.is_allow_check_mid&&e.allow_check_mid_level&&(o["x-component-props"].checkAbleLevel=+e.allow_check_mid_level),o}],["SEARCH_CASCADER",e=>{var o;const t=v(e);return Object.assign(t["x-component-props"],{urlConfig:e.urlConfig,depth:null==(o=e.wordbook)?void 0:o.level_num,options:e.option}),t}],["COMBINATION",e=>{const o=v(e);return o.type="array","table"===e.displayMode?o["x-component"]="TABLE_COMBINATION":!1!==e.jsonCombination&&(o["x-component"]="JSON_COMBINATION"),Object.assign(o["x-decorator-props"],{showLabel:!1,showFeedback:!1}),Object.assign(o["x-component-props"],{title:e.alias||e.name,maxGroupNum:e.maxGroupNum,minGroupNum:e.minGroupNum,showLabel:"1"!==e.hide_title,properties:e.children||[],combinationItemDeletable:e.combinationItemDeletable}),o}],["RADIO",y],["CHECKBOX",y],["SWITCH",e=>{const o=v(e);return Object.assign(o["x-component-props"],{openDescription:e.open,closeDescription:e.close,showMode:e.show_mode}),o}],["SLIDER",e=>{const o=v(e);return Object.assign(o["x-component-props"],{step:r(e.step_length),max:r(e.max_length),min:r(e.min_length),option:e.option}),o}],["COMPLEX",e=>{const o=v(e);Array.isArray(e.properties)&&l("COMPLEX控件的properties属性已经废弃, 请使用children作为替代, 在之后的版本中properties属性将不再支持");const t=Array.isArray(e.properties||e.children)?N(e.properties||e.children):{};return o.type=e.fieldType||"void",o.properties=t,Object.assign(o["x-decorator-props"],{showFeedback:!1}),Object.assign(o["x-component-props"],i(e,["wrapperStyle","display"])),o}]]),A=e=>{if(e.suffixConfig)return E(e);return(O.get(e.html_type)||w)(e)},E=o=>{if(!o.suffixConfig&&!o.prefixConfig)return A(o);const t=v(o),n=o.suffixConfig?e(o.suffixConfig):[],i=[...(o.prefixConfig?e(o.prefixConfig):[]).map((e=>({elem_width:o.elem_width,...e,hide_title:"1",is_show:o.is_show}))),{...o,hide_title:"1",suffixConfig:void 0,prefixConfig:void 0},...n.map((e=>({elem_width:o.elem_width,...e,hide_title:"1",is_show:o.is_show})))],r=i.reduce(((e,o)=>e+2*(o.elem_width||3)),0);return Object.assign(t,{type:"void",name:p(i),title:o.alias||o.name,"x-component":"INPUT_GROUP","x-component-props":{span:r},"x-decorator-props":{...t["x-decorator-props"],showFeedback:!1,suffixFields:i.map((e=>e.val_key))},properties:N(i)}),t},{FieldNormalizeWaterfallHook:j,FieldListNormalizeWaterfallHook:k}=s();function N(o,i={column:9999}){let r=null;const l=k.call(t(o),i).reduce(((e,o,l)=>{var a;const p=null==(a=(o=j.call(o,i)).validate)?void 0:a.obj_type;return p&&n&&n.collect(p,t(o)),"LINEBAR"===o.html_type?(e[c(o)]=s(C(o),l),r=e[c(o)].properties={}):r?r[c(o)]=s(A(o),l):(r=null,e[c(o)]=s(A(o),l)),e}),{});return i.linebarAutoHidden&&Object.values(l).forEach((e=>{"LINEBAR"===e["x-component"]&&h(e)})),a({properties:l,"x-root":!0},((e,o)=>{"INPUT_GROUP"===e["x-component"]&&h(e,!!o&&!o["x-root"])})),l;function s(e,o){return e["x-index"]=o,e["x-decorator-props"]={_index:o,...e["x-decorator-props"]},e}function c(o){return o.suffixConfig?p([o,...e(o.suffixConfig)]):o.val_key}}return{schemaAdaptor:N}}function h(e,o=!1){e["x-reactions"]?e["x-reactions"]=n(e["x-reactions"]):e["x-reactions"]=[];const t=Object.keys(e.properties||{}).map((t=>`${o?"*.":""}${e.name}.${t}#selfDisplay`));e["x-reactions"].push({dependencies:t,fulfill:{state:{visible:"{{hasVisible($deps)}}"}}})}export{_ as useFieldListAdaptor};
1
+ import{arrayed as e,deepOmit as o}from"../../../../shared/utils/index.js";import{cloneDeep as t,castArray as n,pick as i}from"lodash-es";import"../../index.js";import{parseNumberFromMaybeString as r,formRenderLog as l}from"../utils/index.js";import{useFieldNormalize as s}from"./useFieldNormalize.js";import{traverseSchema as a,fieldKeyEscape as p,createLinebarId as c}from"../utils/schema.js";import{useFormValidator as d}from"./useFormValidator.js";import{transformDateFormat as m}from"../utils/business.js";function u(e,o){Object.assign(e["x-component-props"],{...i(o,["wordbook","autograph"])})}function f(e,o){Object.assign(e["x-component-props"],{...i(o,["urlConfig","wordbook"])})}function x(e){return"1"===e||!0===e}function _(n,_){const{createValidatorSchema:b}=d(),g=e=>{var o;const t={name:e.val_key,type:null!=(o=e.fieldType)?o:"string",title:e.alias||e.name,"x-component":e.html_type,default:e.default_val,"x-component-props":{placeholder:e.placeholder,clearable:"0"===e.is_empty,...e.componentProps||{}},"x-content":e.slots,"x-display":"0"===e.is_show?"hidden":"visible","x-pattern":"0"===e.is_edit?"disabled":"editable","x-compile-omitted":["title","x-component-props","x-decorator-props"]};e.reactions&&(t["x-reactions"]=e.reactions),e.noDecorator||Object.assign(t,{"x-decorator":"FORM_ITEM","x-decorator-props":{fieldItem:e,beforeSetValue:null==_?void 0:_.beforeSetValue,span:2*(e.elem_width||3),showLabel:"1"!==e.hide_title,remark:e.remark,propertyKey:e.val_key,annotation:e.annotation,...e.decoratorProps||{}}});const n=b(e);return n&&(t["x-validator"]=n),"0"===e.is_null&&(t.required=!0),t},v=e=>{var o,t,n,l,s,a,p,c,d,m,_,h,b,v;const y=g(e);e.urlConfig?f(y,e):e.autograph&&u(y,e);const w=!!e.__multiple,C=x(null!=(t=null==(o=e.componentProps)?void 0:o.allowModify)?t:e.allowModify),O=x(null!=(l=null==(n=e.componentProps)?void 0:n.selectAll)?l:e.selectAll),A=x(null!=(a=null==(s=e.componentProps)?void 0:s.shouldSave)?a:e.save_free_entry),E=x(null!=(c=null==(p=e.componentProps)?void 0:p.allowCreate)?c:e.free_entry),j=null!=(m=null==(d=e.componentProps)?void 0:d.showField)?m:e.show_key,k=null!=(h=null==(_=e.componentProps)?void 0:_.options)?h:e.option,N=null!=(v=r(e.multi_select_value))?v:null==(b=e.componentProps)?void 0:b.maxTagCount;return Object.assign(y["x-component-props"],{multiple:w,options:k,allowModify:C,allowCreate:E||C,shouldSave:A,showField:j,maxTagCount:N,selectAll:O,...i(e,["lazyRequest","requestCache"])}),w&&(y.type="array"),y},y=e=>{var o,t;const n=g(e),i=null!=(t=null==(o=e.componentProps)?void 0:o.selectAll)?t:e.selectAll;return Object.assign(n["x-component-props"],{options:e.option,childFieldStrategy:e.childFieldStrategy,childWidthMode:e.childWidthMode,vertical:e.__vertical,selectAll:"1"===i||!0===i}),e.urlConfig?f(n,e):e.autograph&&u(n,e),n},w=e=>{const t=g(e);return Object.assign(t["x-component-props"],{fieldItem:o(e,["reactions"])}),t},C=e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINEBAR","x-display":"visible","x-component-props":{linebarTextDirection:e.linebarTextDirection,linebarDirection:e.linebarDirection,linebarWidth:e.linebarWidth,disabled:"1"===e.is_not_fold,id:c(e.val_key),show:"0"!==e.is_show,remark:e.remark},"x-content":e.slots}),O=new Map([["LINEBAR",C],["LINE_BREAKS",e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINE_BREAKS","x-component-props":{border:e.lineBreaksBorder},"x-display":"0"===e.is_show?"hidden":"visible"})],["INPUT",e=>{const o=g(e);return Object.assign(o["x-component-props"],{...i(e,["prefix","suffix"])}),o}],["TEXTAREA",e=>{const o=g(e);return Object.assign(o["x-component-props"],{rows:e.initialize_high||3}),o}],["INPUT_NUMBER",e=>{const o=g(e),{decimal_length:t,validate:n,allowSlash:i}=e;return!0!==i&&"1"!==i||(o["x-component"]="INPUT_NUMBER_SLASH",o.type="string"),Object.assign(o["x-component-props"],{precision:r(null!=t?t:null==n?void 0:n.decimal_length),whiteList:e.whiteList,prefix:e.prefix,suffix:e.suffix}),o}],["SELECT",v],["REMOTE_SEARCH",v],["DATE",e=>{const o=g(e);return Object.assign(o["x-component-props"],{valueFormat:e.date_format,type:m(e.date_format),validate:e.validate}),o}],["TIME",e=>{const o=g(e);return Object.assign(o["x-component-props"],{format:e.date_format,type:m(e.date_format),validate:e.validate}),o}],["LEVEL_SEARCH_CASCADER",e=>{const o=g(e);return Object.assign(o["x-component-props"],{...i(e,["wordbook","lazyRequest","autograph"])}),"1"===e.is_allow_check_mid&&e.allow_check_mid_level&&(o["x-component-props"].checkAbleLevel=+e.allow_check_mid_level),o}],["SEARCH_CASCADER",e=>{var o;const t=g(e);return Object.assign(t["x-component-props"],{urlConfig:e.urlConfig,depth:null==(o=e.wordbook)?void 0:o.level_num,options:e.option}),t}],["COMBINATION",e=>{const o=g(e);return o.type="array","table"===e.displayMode?o["x-component"]="TABLE_COMBINATION":!1!==e.jsonCombination&&(o["x-component"]="JSON_COMBINATION"),Object.assign(o["x-decorator-props"],{showLabel:!1,showFeedback:!1}),Object.assign(o["x-component-props"],{title:e.alias||e.name,maxGroupNum:e.maxGroupNum,minGroupNum:e.minGroupNum,showLabel:"1"!==e.hide_title,properties:e.children||[],combinationItemDeletable:e.combinationItemDeletable}),o}],["RADIO",y],["CHECKBOX",y],["SWITCH",e=>{const o=g(e);return Object.assign(o["x-component-props"],{openDescription:e.open,closeDescription:e.close,showMode:e.show_mode}),o}],["SLIDER",e=>{const o=g(e);return Object.assign(o["x-component-props"],{step:r(e.step_length),max:r(e.max_length),min:r(e.min_length),option:e.option}),o}],["COMPLEX",e=>{const o=g(e);Array.isArray(e.properties)&&l("COMPLEX控件的properties属性已经废弃, 请使用children作为替代, 在之后的版本中properties属性将不再支持");const t=Array.isArray(e.properties||e.children)?N(e.properties||e.children):{};return o.type=e.fieldType||"void",o.properties=t,Object.assign(o["x-decorator-props"],{showFeedback:!1}),Object.assign(o["x-component-props"],i(e,["wrapperStyle","display"])),o}]]),A=e=>{if(e.suffixConfig||e.prefixConfig)return E(e);return(O.get(e.html_type)||w)(e)},E=o=>{if(!o.suffixConfig&&!o.prefixConfig)return A(o);const t=g(o),n=o.suffixConfig?e(o.suffixConfig):[],i=[...(o.prefixConfig?e(o.prefixConfig):[]).map((e=>({elem_width:o.elem_width,...e,hide_title:"1",is_show:o.is_show}))),{...o,hide_title:"1",suffixConfig:void 0,prefixConfig:void 0},...n.map((e=>({elem_width:o.elem_width,...e,hide_title:"1",is_show:o.is_show})))],r=i.reduce(((e,o)=>e+2*(o.elem_width||3)),0);return Object.assign(t,{type:"void",name:p(i),title:o.alias||o.name,"x-component":"INPUT_GROUP","x-component-props":{span:r},"x-decorator-props":{...t["x-decorator-props"],showFeedback:!1,suffixFields:i.map((e=>e.val_key))},properties:N(i)}),t},{FieldNormalizeWaterfallHook:j,FieldListNormalizeWaterfallHook:k}=s();function N(o,i={column:9999}){let r=null;const l=k.call(t(o),i).reduce(((e,o,l)=>{var a;const p=null==(a=(o=j.call(o,i)).validate)?void 0:a.obj_type;return p&&n&&n.collect(p,t(o)),"LINEBAR"===o.html_type?(e[c(o)]=s(C(o),l),r=e[c(o)].properties={}):r?r[c(o)]=s(A(o),l):(r=null,e[c(o)]=s(A(o),l)),e}),{});return i.linebarAutoHidden&&Object.values(l).forEach((e=>{"LINEBAR"===e["x-component"]&&h(e)})),a({properties:l,"x-root":!0},((e,o)=>{"INPUT_GROUP"===e["x-component"]&&h(e,!!o&&!o["x-root"])})),l;function s(e,o){return e["x-index"]=o,e["x-decorator-props"]={_index:o,...e["x-decorator-props"]},e}function c(o){if(o.suffixConfig||o.prefixConfig){const t=[...e(o.prefixConfig),o,...e(o.suffixConfig)].filter(Boolean);return p(t)}return o.val_key}}return{schemaAdaptor:N}}function h(e,o=!1){e["x-reactions"]?e["x-reactions"]=n(e["x-reactions"]):e["x-reactions"]=[];const t=Object.keys(e.properties||{}).map((t=>`${o?"*.":""}${e.name}.${t}#selfDisplay`));e["x-reactions"].push({dependencies:t,fulfill:{state:{visible:"{{hasVisible($deps)}}"}}})}export{_ as useFieldListAdaptor};
@@ -990,6 +990,7 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
990
990
  isGroupChat: import("vue").ComputedRef<boolean>;
991
991
  showEmoji: import("vue").Ref<boolean>;
992
992
  content: import("vue").Ref<string>;
993
+ commonEmoticons: import("vue").Ref<string[]>;
993
994
  chatAddProps: import("vue").ComputedRef<{
994
995
  options: import("../../shared/types").AnyObject[];
995
996
  defaultValue: import("../../shared/types").AnyObject[];
@@ -995,6 +995,7 @@ declare const _default: import("vue").DefineComponent<{
995
995
  isGroupChat: import("vue").ComputedRef<boolean>;
996
996
  showEmoji: import("vue").Ref<boolean>;
997
997
  content: import("vue").Ref<string>;
998
+ commonEmoticons: import("vue").Ref<string[]>;
998
999
  chatAddProps: import("vue").ComputedRef<{
999
1000
  options: AnyObject[];
1000
1001
  defaultValue: AnyObject[];
@@ -7,6 +7,7 @@ export declare function uploadFileApi(params: FormData): import("axios").AxiosPr
7
7
  export declare function listUserApi(params: AnyObject): import("axios").AxiosPromise<any>;
8
8
  export declare function getUserDetailApi(params: AnyObject): import("axios").AxiosPromise<any>;
9
9
  export declare function readMessageApi(params: AnyObject): import("axios").AxiosPromise<any>;
10
+ export declare function recallMessageApi(params: AnyObject): import("axios").AxiosPromise<any>;
10
11
  export declare function searchChatRecordApi(params: AnyObject): import("axios").AxiosPromise<any>;
11
12
  export declare function groupCreateApi(params: AnyObject): import("axios").AxiosPromise<any>;
12
13
  export declare function groupUserApi(params: AnyObject): import("axios").AxiosPromise<any>;
@@ -1 +1 @@
1
- import t from"axios";import{createDiscreteApi as e}from"naive-ui";const{message:o}=e(["message"]);function r(t){const e=[];for(const o in t){const r=t[o];Array.isArray(r)?r.forEach((t=>{e.push(`${encodeURIComponent(o)}=${encodeURIComponent(t)}`)})):e.push(`${encodeURIComponent(o)}=${encodeURIComponent(r)}`)}return e.join("&")}const n=t.create({withCredentials:!0,timeout:5e3});function a(t){return n({headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"post",url:"/session/openSession",data:r(t)})}function u(t){return n({method:"get",url:"/chat/recordList",params:t})}function s(t){return n({headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"post",url:"/session/toppingSession",data:r(t)})}function d(t){return n({headers:{"Content-Type":"multipart/form-data"},method:"post",url:"/chat/uploadFile",data:t})}function i(t){return n({method:"get",url:"/user/listUser",params:t})}function p(t){return n({method:"get",url:"/user/getUserDetail",params:t})}function c(t){return n({method:"post",url:"/chat/readMessage",data:t})}function m(t){return n({method:"post",url:"/chat/searchChatRecord",data:t})}function l(t){return n({method:"post",url:"/group/create",data:t})}function h(t){return n({method:"get",url:"/group/user",params:t})}function f(t){return n({method:"post",url:"/group/join",data:t})}function g(t){return n({method:"post",url:"/group/leave",data:t})}function C(t){return n({method:"post",url:"/av/finish",data:t})}function v(t){return n({headers:{"Content-Type":"multipart/form-data"},method:"post",url:"/group/update",data:t})}n.interceptors.response.use((t=>{var e,r,n;if(null==(e=t.data)?void 0:e.result)return null==(r=t.data)?void 0:r.data;500==(null==(n=t.data)?void 0:n.code)&&t.data.msg?o.error(t.data.msg):console.log("请求错误")}));export{C as avFinishApi,u as getHistoryRecordApi,p as getUserDetailApi,l as groupCreateApi,f as groupJoinApi,g as groupLeaveApi,v as groupUpdateApi,h as groupUserApi,n as instanceAxios,i as listUserApi,a as openSessionApi,c as readMessageApi,m as searchChatRecordApi,s as toppingSessionApi,d as uploadFileApi};
1
+ import t from"axios";import{createDiscreteApi as e}from"naive-ui";const{message:o}=e(["message"]);function r(t){const e=[];for(const o in t){const r=t[o];Array.isArray(r)?r.forEach((t=>{e.push(`${encodeURIComponent(o)}=${encodeURIComponent(t)}`)})):e.push(`${encodeURIComponent(o)}=${encodeURIComponent(r)}`)}return e.join("&")}const n=t.create({withCredentials:!0,timeout:5e3});function a(t){return n({headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"post",url:"/session/openSession",data:r(t)})}function u(t){return n({method:"get",url:"/chat/recordList",params:t})}function s(t){return n({headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"post",url:"/session/toppingSession",data:r(t)})}function d(t){return n({headers:{"Content-Type":"multipart/form-data"},method:"post",url:"/chat/uploadFile",data:t})}function i(t){return n({method:"get",url:"/user/listUser",params:t})}function p(t){return n({method:"get",url:"/user/getUserDetail",params:t})}function c(t){return n({method:"post",url:"/chat/readMessage",data:t})}function l(t){return n({method:"post",url:"/chat/recallMessage",data:t})}function m(t){return n({method:"post",url:"/chat/searchChatRecord",data:t})}function h(t){return n({method:"post",url:"/group/create",data:t})}function f(t){return n({method:"get",url:"/group/user",params:t})}function g(t){return n({method:"post",url:"/group/join",data:t})}function C(t){return n({method:"post",url:"/group/leave",data:t})}function v(t){return n({method:"post",url:"/av/finish",data:t})}function w(t){return n({headers:{"Content-Type":"multipart/form-data"},method:"post",url:"/group/update",data:t})}n.interceptors.response.use((t=>{var e,r,n;if(null==(e=t.data)?void 0:e.result)return null==(r=t.data)?void 0:r.data;500==(null==(n=t.data)?void 0:n.code)&&t.data.msg?o.error(t.data.msg):console.log("请求错误")}));export{v as avFinishApi,u as getHistoryRecordApi,p as getUserDetailApi,h as groupCreateApi,g as groupJoinApi,C as groupLeaveApi,w as groupUpdateApi,f as groupUserApi,n as instanceAxios,i as listUserApi,a as openSessionApi,c as readMessageApi,l as recallMessageApi,m as searchChatRecordApi,s as toppingSessionApi,d as uploadFileApi};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,computed as o,watch as a,openBlock as s,createBlock as i,unref as n,withCtx as r,withDirectives as l,createElementVNode as c,createVNode as m,createElementBlock as p,Fragment as d,renderList as u,toDisplayString as f,vShow as h,normalizeStyle as y,createCommentVNode as g,createTextVNode as v}from"vue";import{NModal as w,NImageGroup as b,NImage as k,NInput as M,NIcon as T,NTooltip as _}from"naive-ui";import{SearchOutline as I,DownloadOutline as S}from"@vicons/ionicons5";import{searchChatRecordApi as x}from"../api/index.js";import{useTheme as j}from"../../../../shared/hooks/useTheme.js";import{useDebounceFn as A}from"@vueuse/core";import{format as H,isSameWeek as D,isSameMonth as C}from"date-fns";import{last as O}from"lodash-es";import"@vue/shared";import"../../../../shared/utils/index.js";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import{useScrollLoading as z}from"../../../../shared/hooks/useScrollLoading.js";import{useState as L}from"../hooks/useState.js";import{getFileSize as U,downloadFile as E}from"../utils/index.js";import"trtc-sdk-v5";const $={class:"label"},F={class:"image-box"},P={class:"file-type"},R={class:"text"},B={class:"name"},G={class:"detail"},N={class:"opt-box"};var q=e({__name:"ChatFile",props:{type:{type:String,default:"image"},visible:{type:Boolean}},setup(e){const q=e,J=j(),{state:K}=L(),Q=t([]),V=t([]),W=t(),X=t(),Y=t(),Z=A(oe,500),ee={page:0,hasMore:!0,lastSendTime:H(new Date,"yyyy-MM-dd HH:mm:ss")};async function te(){var e;try{if(!ee.hasMore)return;ee.page++;const t=await x({orgId:K.orgId,keyword:Y.value,endTime:"",startTime:"",lastSendTime:ee.lastSendTime,memberIdSet:[],page:ee.page,recordType:"image"===q.type?"IMAGE":"FILE",receiver:K.currentSessionItem.receiver,userId:K.userInfo.id});Array.isArray(t)&&0!==t.length&&Array.isArray(t[0].recordList)||(ee.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了"));let o=t||[];if(Array.isArray(t)&&t.length>0&&(o=t[0].recordList),ee.lastSendTime=null==(e=O(o))?void 0:e.sendTime,"image"===q.type){const e=function(e){const t={};e.forEach((e=>{const o=new Date(e.sendTime);let a=H(o,"yyyy年MM月");D(o,new Date)?a="本周":C(o,new Date)&&(a="本月"),t[a]||(t[a]=[]),t[a].push(e.content.msg)}));return Object.entries(t).map((([e,t])=>({label:e,list:t})))}(o);Q.value=ee.page>1?Q.value.concat(e):e}else{const e=o.map((e=>new Promise((async t=>{const o=await U(e.content.fileUrl);t({...e,size:o})})))),t=await Promise.all(e);V.value=ee.page>1?V.value.concat(t):t}}catch(e){console.log(e)}}function oe(){Object.assign(ee,{page:0,hasMore:!0,lastSendTime:H(new Date,"yyyy-MM-dd HH:mm:ss")}),te()}z(W,(()=>{te()})),z(X,(()=>{te()}));const ae=o((()=>"image"===q.type?"聊天图片":"聊天文件"));function se(e){const{size:t,sendTime:o,senderName:a}=e;return`${t} · ${H(new Date(o),"yyyy/MM/dd HH:mm")} ${a}`}function ie(e){var t;const o=(null==(t=e.content)?void 0:t.msg)||"",a=o.lastIndexOf(".");if(-1!==a){return o.charAt(a+1).toUpperCase()}return"?"}return a((()=>q.visible),(e=>{e?oe():Y.value=""})),(t,o)=>(s(),i(n(w),{preset:"dialog",title:n(ae),"show-icon":!1,"auto-focus":!1,class:"iho-chat-dialog"},{default:r((()=>[l(c("div",{class:"iho-chat-dialog__content iho-chat-image-wrapper",ref_key:"imageRef",ref:W},[m(n(b),{"show-toolbar-tooltip":""},{default:r((()=>[(s(!0),p(d,null,u(Q.value,(e=>(s(),p("div",{class:"image-item",key:e.label},[c("span",$,f(e.label),1),c("div",F,[(s(!0),p(d,null,u(e.list,(e=>(s(),i(n(k),{key:e,width:"80",height:"80",src:e},null,8,["src"])))),128))])])))),128))])),_:1})],512),[[h,"image"===e.type]]),l(c("div",{class:"iho-chat-dialog__content iho-chat-file-wrapper",style:y(n(J))},[m(n(M),{clearable:"",placeholder:"搜索文件",value:Y.value,"onUpdate:value":o[0]||(o[0]=e=>Y.value=e),valueModifiers:{trim:!0},onInput:n(Z)},{prefix:r((()=>[m(n(T),{component:n(I)},null,8,["component"])])),_:1},8,["value","onInput"]),c("div",{class:"file-list-box",ref_key:"fileRef",ref:X},[(s(!0),p(d,null,u(V.value,((e,t)=>(s(),p("div",{class:"file-item",key:t},[c("span",P,f(ie(e)),1),c("div",R,[c("span",B,f(e.content.msg),1),c("span",G,f(se(e)),1)]),c("div",N,[g(' <n-tooltip :show-arrow="false">\n\t\t\t\t\t\t\t<template #trigger>\n\t\t\t\t\t\t\t\t<n-icon :size="16" :component="OpenOutline" />\n\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t转发\n\t\t\t\t\t\t</n-tooltip> '),m(n(_),{"show-arrow":!1},{trigger:r((()=>[m(n(T),{size:16,component:n(S),onClick:()=>n(E)(e.content.fileUr,e.content.msg)},null,8,["component","onClick"])])),default:r((()=>[v(" 下载 ")])),_:2},1024)])])))),128))],512)],4),[[h,"image"!==e.type]])])),_:1},8,["title"]))}});export{q as default};
1
+ import{defineComponent as e,ref as t,computed as o,watch as a,openBlock as s,createBlock as i,unref as n,withCtx as r,withDirectives as l,createElementVNode as c,createVNode as m,createElementBlock as p,Fragment as d,renderList as u,toDisplayString as f,vShow as h,normalizeStyle as y,createCommentVNode as g,createTextVNode as v}from"vue";import{NModal as w,NImageGroup as b,NImage as k,NInput as M,NIcon as T,NTooltip as _}from"naive-ui";import{SearchOutline as I,DownloadOutline as S}from"@vicons/ionicons5";import{searchChatRecordApi as x}from"../api/index.js";import{useTheme as j}from"../../../../shared/hooks/useTheme.js";import{useDebounceFn as A}from"@vueuse/core";import{format as H,isSameWeek as D,isSameMonth as C}from"date-fns";import{last as O}from"lodash-es";import"@vue/shared";import"../../../../shared/utils/index.js";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import{useScrollLoading as z}from"../../../../shared/hooks/useScrollLoading.js";import{useState as L}from"../hooks/useState.js";import{getFileSize as U,downloadFile as E}from"../utils/index.js";import"trtc-sdk-v5";const $={class:"label"},F={class:"image-box"},P={class:"file-type"},R={class:"text"},B={class:"name"},G={class:"detail"},N={class:"opt-box"};var q=e({__name:"ChatFile",props:{type:{type:String,default:"image"},visible:{type:Boolean}},setup(e){const q=e,J=j(),{state:K}=L(),Q=t([]),V=t([]),W=t(),X=t(),Y=t(),Z=A(oe,500),ee={page:0,hasMore:!0,lastSendTime:H(new Date,"yyyy-MM-dd HH:mm:ss")};async function te(){var e;try{if(!ee.hasMore)return;ee.page++;const t=await x({orgId:K.orgId,keyword:Y.value,endTime:"",startTime:"",lastSendTime:ee.lastSendTime,memberIdSet:[],page:ee.page,recordType:"image"===q.type?"IMAGE":"FILE",receiver:K.currentSessionItem.receiver,userId:K.userInfo.id});Array.isArray(t)&&0!==t.length&&Array.isArray(t[0].recordList)||(ee.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了"));let o=t||[];if(Array.isArray(t)&&t.length>0&&(o=t[0].recordList),ee.lastSendTime=null==(e=O(o))?void 0:e.sendTime,"image"===q.type){const e=function(e){const t={};e.forEach((e=>{const o=new Date(e.sendTime);let a=H(o,"yyyy年MM月");D(o,new Date)?a="本周":C(o,new Date)&&(a="本月"),t[a]||(t[a]=[]),t[a].push(e.content.msg)}));return Object.entries(t).map((([e,t])=>({label:e,list:t})))}(o);Q.value=ee.page>1?Q.value.concat(e):e}else{const e=o.map((e=>new Promise((async t=>{const o=await U(e.content.fileUrl);t({...e,size:o})})))),t=await Promise.all(e);V.value=ee.page>1?V.value.concat(t):t}}catch(e){console.log(e)}}function oe(){Object.assign(ee,{page:0,hasMore:!0,lastSendTime:H(new Date,"yyyy-MM-dd HH:mm:ss")}),te()}z(W,(()=>{te()})),z(X,(()=>{te()}));const ae=o((()=>"image"===q.type?"聊天图片":"聊天文件"));function se(e){const{size:t,sendTime:o,senderName:a}=e;return`${t} · ${H(new Date(o),"yyyy/MM/dd HH:mm")} ${a}`}function ie(e){var t;const o=(null==(t=e.content)?void 0:t.msg)||"",a=o.lastIndexOf(".");if(-1!==a){return o.charAt(a+1).toUpperCase()}return"?"}return a((()=>q.visible),(e=>{e?oe():Y.value=""})),(t,o)=>(s(),i(n(w),{preset:"dialog",title:n(ae),"show-icon":!1,"auto-focus":!1,class:"iho-chat-dialog"},{default:r((()=>[l(c("div",{class:"iho-chat-dialog__content iho-chat-image-wrapper",ref_key:"imageRef",ref:W},[m(n(b),{"show-toolbar-tooltip":""},{default:r((()=>[(s(!0),p(d,null,u(Q.value,(e=>(s(),p("div",{class:"image-item",key:e.label},[c("span",$,f(e.label),1),c("div",F,[(s(!0),p(d,null,u(e.list,(e=>(s(),i(n(k),{key:e,width:"80",height:"80",src:e},null,8,["src"])))),128))])])))),128))])),_:1})],512),[[h,"image"===e.type]]),l(c("div",{class:"iho-chat-dialog__content iho-chat-file-wrapper",style:y(n(J))},[m(n(M),{clearable:"",placeholder:"搜索文件",value:Y.value,"onUpdate:value":o[0]||(o[0]=e=>Y.value=e),valueModifiers:{trim:!0},onInput:n(Z)},{prefix:r((()=>[m(n(T),{component:n(I)},null,8,["component"])])),_:1},8,["value","onInput"]),c("div",{class:"file-list-box",ref_key:"fileRef",ref:X},[(s(!0),p(d,null,u(V.value,((e,t)=>(s(),p("div",{class:"file-item",key:t},[c("span",P,f(ie(e)),1),c("div",R,[c("span",B,f(e.content.msg),1),c("span",G,f(se(e)),1)]),c("div",N,[g(' <n-tooltip :show-arrow="false">\r\n\t\t\t\t\t\t\t<template #trigger>\r\n\t\t\t\t\t\t\t\t<n-icon :size="16" :component="OpenOutline" />\r\n\t\t\t\t\t\t\t</template>\r\n\t\t\t\t\t\t\t转发\r\n\t\t\t\t\t\t</n-tooltip> '),m(n(_),{"show-arrow":!1},{trigger:r((()=>[m(n(T),{size:16,component:n(S),onClick:()=>n(E)(e.content.fileUr,e.content.msg)},null,8,["component","onClick"])])),default:r((()=>[v(" 下载 ")])),_:2},1024)])])))),128))],512)],4),[[h,"image"!==e.type]])])),_:1},8,["title"]))}});export{q as default};
@@ -1,9 +1,10 @@
1
+ import { Ref } from 'vue';
1
2
  import { AnyObject } from '../../../../shared/types';
2
3
  import { MESSAGE_TYPE } from '../constants';
3
4
  import { simplifyMessage } from '../utils';
4
5
  import { FileOptions } from '../types';
5
6
  declare const _default: import("vue").DefineComponent<{}, {
6
- inputRef: import("vue").Ref<HTMLDivElement | undefined>;
7
+ inputRef: Ref<HTMLDivElement | undefined>;
7
8
  state: import("../types").IState;
8
9
  sendMessage: (message: {
9
10
  chatType?: string | undefined;
@@ -11,8 +12,9 @@ declare const _default: import("vue").DefineComponent<{}, {
11
12
  receiver?: string | undefined;
12
13
  }) => Promise<void>;
13
14
  isGroupChat: import("vue").ComputedRef<boolean>;
14
- showEmoji: import("vue").Ref<boolean>;
15
- content: import("vue").Ref<string>;
15
+ showEmoji: Ref<boolean>;
16
+ content: Ref<string>;
17
+ commonEmoticons: Ref<string[]>;
16
18
  chatAddProps: import("vue").ComputedRef<{
17
19
  options: AnyObject[];
18
20
  defaultValue: AnyObject[];
@@ -78,14 +80,14 @@ declare const _default: import("vue").DefineComponent<{}, {
78
80
  emit: (event: "comfirm", ...args: any[]) => void;
79
81
  state: import("../types").IState;
80
82
  setCurrentSessionItem: (item: AnyObject) => void;
81
- listRef: import("vue").Ref<any>;
82
- keyword: import("vue").Ref<string>;
83
- showModal: import("vue").Ref<boolean>;
84
- checkedOptions: import("vue").Ref<AnyObject[]>;
85
- options: import("vue").Ref<AnyObject[]>;
86
- groupName: import("vue").Ref<string>;
87
- checkedSourceIds: import("vue").Ref<(string | number)[]>;
88
- userList: import("vue").Ref<AnyObject[]>;
83
+ listRef: Ref<any>;
84
+ keyword: Ref<string>;
85
+ showModal: Ref<boolean>;
86
+ checkedOptions: Ref<AnyObject[]>;
87
+ options: Ref<AnyObject[]>;
88
+ groupName: Ref<string>;
89
+ checkedSourceIds: Ref<(string | number)[]>;
90
+ userList: Ref<AnyObject[]>;
89
91
  handleInput: () => void;
90
92
  _disabledIds: import("vue").ComputedRef<any[]>;
91
93
  defaultOptions: import("vue").ComputedRef<{
@@ -1 +1 @@
1
- import{defineComponent as e,ref as n,computed as t,watch as o,withDirectives as r,openBlock as s,createElementBlock as i,normalizeStyle as a,unref as c,createElementVNode as l,toDisplayString as u,createVNode as f,createCommentVNode as d,withCtx as m,Fragment as p,renderList as g,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 E}from"naive-ui";import T from"./ChatAdd.vue.js";import{useState as b}from"../hooks/useState.js";import{useSession as x}from"../hooks/useSession.js";import{MESSAGE_TYPE as j,AV_STATUS as z}from"../constants/index.js";import"trtc-sdk-v5";import{simplifyMessage as L,base64ToFile as O}from"../utils/index.js";import{emojis as R}from"../utils/emoji.js";import{uploadFileApi as q}from"../api/index.js";import{CloseCircleOutline as D,CallOutline as A,VideocamOutline as V}from"@vicons/ionicons5";import{xor as H,trim as J,cloneDeep as K}from"lodash-es";import{uuidGenerator as F}from"../../../../shared/utils/index.js";const U={key:0,class:"reference-content-box"},$={class:"reference-content"},G=["innerHTML"],N={class:"tool-box"},B=l("i",{class:"chat--iconfont chat--icon-face"},null,-1),S=l("span",null,"默认表情",-1),X={class:"list-box"},P=["src"],Q=l("i",{class:"chat--iconfont chat--icon-good"},null,-1),W=l("i",{class:"chat--iconfont chat--icon-image"},null,-1),Y=l("i",{class:"chat--iconfont chat--icon-folder"},null,-1),Z={class:"btn-box"},ee=l("span",{class:"tip"},"Enter 发送, Ctrl + Enter 换行",-1);var ne=e({__name:"ChatFooter",setup(e){const ne=n(),{state:te,sendMessage:oe}=b(),{isGroupChat:re}=x(te),se=n(!1),ie=n(""),ae=t((()=>({options:te.currentGroupUser,defaultValue:[te.userInfo]}))),ce=t((()=>!ie.value.replace(/(&nbsp;|\s|<br>)+/g,"")));function le(e,n=[]){const t=F(),o=[],r=n.length>0;te.showVideo||te.showMultipleVideo||(r?(o.push(...H(n,[te.userInfo.id])),Object.assign(te.currentAVMsg,{callMode:"call",checkedIds:o,strRoomId:t,chatMessageType:e}),te.showMultipleVideo=!0):oe({content:{chatMessageType:e,msg:"",avStatus:z.IN_CALL}}))}function ue(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 fe(){var e;ie.value=(null==(e=ne.value)?void 0:e.innerHTML)||""}async function de(e){const n=new FormData;return n.append("sender",te.userInfo.id),n.append("file",e),await q(n)}async function me(e,n){const{file:t,name:o}=e.file,r=await de(t);if(!r)return console.log("上传失败");ge({chatMessageType:n,msg:n===j.FILE?o:r,url:r})}async function pe(){const{innerHTML:e="",innerText:n="",outerText:t=""}=ne.value||{};if(ce.value)return console.log("请输入内容");let o=j.TEXT,r="";if(e){const t=e.match(/<img[^>]*>/gi),s=(t||[]).length;if(n&&0===s)r=n;else if(n||1!==s){if(o=j.BLEND,r=e,null==t?void 0:t.length)for(let e=0;e<s;e++)if(t[e].includes(`data-type="${j.EMOJI}"`)){const n=t[e].match(/data-msg="(.*?)"/);n&&n.length>1&&(r=r.replace(t[e],`[${n[1]}]`))}else{const n=t[e].match(/src\s*=\s*"([^"]*)"/);if(n&&n.length>1){const e=O(n[1]);if(e){const t=await de(e);r=r.replace(n[1],t||"")}}}}else if(e.includes(j.EMOJI)){o=j.EMOJI;const n=e.match(/data-msg\s*=\s*"([^"]*)"/);n&&(r=n[1])}else{o=j.IMAGE;const n=e.match(/src\s*=\s*"([^"]*)"/);if(n){const e=O(n[1]);if(e){const n=await de(e);n&&(r=n)}}}}else r=J(n);r&&ge({msg:r,chatMessageType:o,origin:"btn"})}async function ge(e){const{chatMessageType:n=j.TEXT,msg:t,url:o,origin:r=""}=e,s={msg:t,chatMessageType:n};n===j.FILE&&(s.fileUrl=o),"btn"===r&&(ne.value.innerHTML="",ie.value=""),te.currentReferenceMsg&&([j.TEXT,j.EMOJI,j.BLEND].includes(n)&&(s.referenceContent=K(te.currentReferenceMsg)),te.currentReferenceMsg=null),oe({content:s})}return o((()=>te.currentReferenceMsg),(e=>{var n;e&&(null==(n=ne.value)||n.focus())})),(e,n)=>r((s(),i("section",{class:"chat-footer",style:a({cursor:c(te).id?"default":"not-allowed"})},[c(te).currentReferenceMsg?(s(),i("div",U,[l("div",$,[l("span",null,u(c(te).currentReferenceMsg.senderName)+":",1),l("pre",{innerHTML:c(L)(c(te).currentReferenceMsg.content)},null,8,G)]),f(c(M),{component:c(D),onClick:n[0]||(n[0]=()=>c(te).currentReferenceMsg=null)},null,8,["component"])])):d("v-if",!0),l("div",N,[f(c(_),{"show-arrow":!1},{trigger:m((()=>[f(c(k),{"content-class":"emoji-content",class:"emoji-wrapper",show:se.value,"onUpdate:show":n[1]||(n[1]=e=>se.value=e),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show",delay:0},{trigger:m((()=>[f(c(C),{quaternary:"",size:"tiny"},{icon:m((()=>[B])),_:1})])),default:m((()=>[S,l("div",X,[(s(!0),i(p,null,g(c(R).default,(([e,n])=>(s(),h(c(_),{key:e,"show-arrow":!1},{trigger:m((()=>[f(c(C),{quaternary:"",size:"tiny",onClick:()=>function(e){var n;se.value=!1,null==(n=ne.value)||n.focus(),document.execCommand("insertHTML",!1,`<img data-msg=${e} data-type=${j.EMOJI} class="emoji--min" src=${R.findEmoji(e)} />`)}(e)},{icon:m((()=>[l("img",{src:n},null,8,P)])),_:2},1032,["onClick"])])),default:m((()=>[y(" "+u(e),1)])),_:2},1024)))),128))])])),_:1},8,["show"])])),default:m((()=>[y(" 表情 ")])),_:1}),f(c(_),{"show-arrow":!1},{trigger:m((()=>[f(c(C),{quaternary:"",size:"tiny",onClick:n[2]||(n[2]=()=>ge({chatMessageType:c(j).EMOJI,msg:0}))},{icon:m((()=>[Q])),_:1})])),default:m((()=>[y(" 点赞 ")])),_:1}),f(c(I),{abstract:"",multiple:"",accept:"image/*",onChange:n[3]||(n[3]=e=>me(e,c(j).IMAGE))},{default:m((()=>[f(c(E),{abstract:""},{default:m((({handleClick:e})=>[f(c(_),{"show-arrow":!1},{trigger:m((()=>[f(c(C),{quaternary:"",size:"tiny",onClick:e},{icon:m((()=>[W])),_:2},1032,["onClick"])])),default:m((()=>[y(" 上传图片 ")])),_:2},1024)])),_:1})])),_:1}),f(c(I),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:n[4]||(n[4]=e=>me(e,c(j).FILE))},{default:m((()=>[f(c(E),{abstract:""},{default:m((({handleClick:e})=>[f(c(_),{"show-arrow":!1},{trigger:m((()=>[f(c(C),{quaternary:"",size:"tiny",onClick:e},{icon:m((()=>[Y])),_:2},1032,["onClick"])])),default:m((()=>[y(" 上传文件 ")])),_:2},1024)])),_:1})])),_:1}),c(re)?(s(),i(p,{key:0},[f(T,v(c(ae),{onComfirm:n[5]||(n[5]=e=>le(c(j).AUDIO,e))}),{trigger:m((()=>[f(c(_),{"show-arrow":!1},{trigger:m((()=>[f(c(C),{quaternary:"",size:"tiny"},{icon:m((()=>[f(c(M),{size:"18",component:c(A)},null,8,["component"])])),_:1})])),default:m((()=>[y(" 语音通话 ")])),_:1})])),_:1},16),f(T,v(c(ae),{onComfirm:n[6]||(n[6]=e=>le(c(j).VIDEO,e))}),{trigger:m((()=>[f(c(_),{"show-arrow":!1},{trigger:m((()=>[f(c(C),{quaternary:"",size:"tiny"},{icon:m((()=>[f(c(M),{size:"20",component:c(V)},null,8,["component"])])),_:1})])),default:m((()=>[y(" 视频会议 ")])),_:1})])),_:1},16)],64)):(s(),i(p,{key:1},[f(c(_),{"show-arrow":!1},{trigger:m((()=>[f(c(C),{quaternary:"",size:"tiny",onClick:n[7]||(n[7]=()=>le(c(j).AUDIO))},{icon:m((()=>[f(c(M),{size:"18",component:c(A)},null,8,["component"])])),_:1})])),default:m((()=>[y(" 语音通话 ")])),_:1}),f(c(_),{"show-arrow":!1},{trigger:m((()=>[f(c(C),{quaternary:"",size:"tiny",onClick:n[8]||(n[8]=()=>le(c(j).VIDEO))},{icon:m((()=>[f(c(M),{size:"20",component:c(V)},null,8,["component"])])),_:1})])),default:m((()=>[y(" 视频通话 ")])),_:1})],64))]),r(l("div",{ref_key:"inputRef",ref:ne,class:"input-box",contenteditable:"",onKeydown:ue,onInput:fe},null,544),[[w,c(te).id]]),l("div",Z,[ee,f(c(C),{type:"primary",round:"",disabled:c(ce),onClick:pe},{default:m((()=>[y("发送")])),_:1},8,["disabled"])])],4)),[[w,c(te).id]])}});export{ne as default};
1
+ import{defineComponent as e,ref as n,computed as t,watch as o,withDirectives as r,openBlock as s,createElementBlock as i,normalizeStyle as a,unref as c,createElementVNode as l,toDisplayString as u,createVNode as f,createCommentVNode as d,withCtx as m,Fragment as g,renderList as p,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 E,NUploadTrigger as I}from"naive-ui";import T from"./ChatAdd.vue.js";import{useState as b}from"../hooks/useState.js";import{useSession as x}from"../hooks/useSession.js";import{MESSAGE_TYPE as j,AV_STATUS as z}from"../constants/index.js";import"trtc-sdk-v5";import{simplifyMessage as L,base64ToFile as O}from"../utils/index.js";import{emojis as q}from"../utils/emoji.js";import{uploadFileApi as R}from"../api/index.js";import{CloseCircleOutline as D,CallOutline as A,VideocamOutline as V}from"@vicons/ionicons5";import{xor as H,uniq as J,trim as K,cloneDeep as F}from"lodash-es";import{uuidGenerator as U}from"../../../../shared/utils/index.js";import{useStorage as $}from"@vueuse/core";const G={key:0,class:"reference-content-box"},N={class:"reference-content"},B=["innerHTML"],S={class:"tool-box"},X=l("i",{class:"chat--iconfont chat--icon-face"},null,-1),P=l("span",null,"最近使用",-1),Q={class:"list-box",style:{"margin-bottom":"8px"}},W=["src"],Y=l("span",null,"默认表情",-1),Z={class:"list-box"},ee=["src"],ne=l("i",{class:"chat--iconfont chat--icon-good"},null,-1),te=l("i",{class:"chat--iconfont chat--icon-image"},null,-1),oe=l("i",{class:"chat--iconfont chat--icon-folder"},null,-1),re={class:"btn-box"},se=l("span",{class:"tip"},"Enter 发送, Ctrl + Enter 换行",-1);var ie=e({__name:"ChatFooter",setup(e){const ie=n(),{state:ae,sendMessage:ce}=b(),{isGroupChat:le}=x(ae),ue=n(!1),fe=n(""),de=$("commonEmoticons",[]),me=t((()=>({options:ae.currentGroupUser,defaultValue:[ae.userInfo]}))),ge=t((()=>!fe.value.replace(/(&nbsp;|\s|<br>)+/g,"")));function pe(e,n=[]){const t=U(),o=[],r=n.length>0;ae.showVideo||ae.showMultipleVideo||(r?(o.push(...H(n,[ae.userInfo.id])),Object.assign(ae.currentAVMsg,{callMode:"call",checkedIds:o,strRoomId:t,chatMessageType:e}),ae.showMultipleVideo=!0):ce({content:{chatMessageType:e,msg:"",avStatus:z.IN_CALL}}))}function he(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(),Me()))}function ye(){var e;fe.value=(null==(e=ie.value)?void 0:e.innerHTML)||""}async function ve(e){const n=new FormData;return n.append("sender",ae.userInfo.id),n.append("file",e),await R(n)}async function we(e,n){const{file:t,name:o}=e.file,r=await ve(t);if(!r)return console.log("上传失败");_e({chatMessageType:n,msg:n===j.FILE?o:r,url:r})}async function Me(){const{innerHTML:e="",innerText:n="",outerText:t=""}=ie.value||{};if(ge.value)return console.log("请输入内容");let o=j.TEXT,r="";if(e){const t=e.match(/<img[^>]*>/gi),s=(t||[]).length;if(n&&0===s)r=n;else if(n||1!==s){if(o=j.BLEND,r=e,null==t?void 0:t.length)for(let e=0;e<s;e++)if(t[e].includes(`data-type="${j.EMOJI}"`)){const n=t[e].match(/data-msg="(.*?)"/);n&&n.length>1&&(r=r.replace(t[e],`[${n[1]}]`))}else{const n=t[e].match(/src\s*=\s*"([^"]*)"/);if(n&&n.length>1){const e=O(n[1]);if(e){const t=await ve(e);r=r.replace(n[1],t||"")}}}}else if(e.includes(j.EMOJI)){o=j.EMOJI;const n=e.match(/data-msg\s*=\s*"([^"]*)"/);n&&(r=n[1])}else{o=j.IMAGE;const n=e.match(/src\s*=\s*"([^"]*)"/);if(n){const e=O(n[1]);if(e){const n=await ve(e);n&&(r=n)}}}}else r=K(n);r&&_e({msg:r,chatMessageType:o,origin:"btn"})}async function _e(e){const{chatMessageType:n=j.TEXT,msg:t,url:o,origin:r=""}=e,s={msg:t,chatMessageType:n};n===j.FILE&&(s.fileUrl=o),"btn"===r&&(ie.value.innerHTML="",fe.value=""),ae.currentReferenceMsg&&([j.TEXT,j.EMOJI,j.BLEND].includes(n)&&(s.referenceContent=F(ae.currentReferenceMsg)),ae.currentReferenceMsg=null),ce({content:s})}return o((()=>ae.currentReferenceMsg),(e=>{var n;e&&(null==(n=ie.value)||n.focus())})),(e,n)=>r((s(),i("section",{class:"chat-footer",style:a({cursor:c(ae).id?"default":"not-allowed"})},[c(ae).currentReferenceMsg?(s(),i("div",G,[l("div",N,[l("span",null,u(c(ae).currentReferenceMsg.senderName)+":",1),l("pre",{innerHTML:c(L)(c(ae).currentReferenceMsg.content)},null,8,B)]),f(c(M),{component:c(D),onClick:n[0]||(n[0]=()=>c(ae).currentReferenceMsg=null)},null,8,["component"])])):d("v-if",!0),l("div",S,[f(c(_),{"show-arrow":!1},{trigger:m((()=>[f(c(k),{"content-class":"emoji-content",class:"emoji-wrapper",show:ue.value,"onUpdate:show":n[1]||(n[1]=e=>ue.value=e),placement:"top",trigger:"click","show-arrow":!1,"display-directive":"show",delay:0},{trigger:m((()=>[f(c(C),{quaternary:"",size:"tiny"},{icon:m((()=>[X])),_:1})])),default:m((()=>[c(de).length>0?(s(),i(g,{key:0},[P,l("div",Q,[(s(!0),i(g,null,p(c(de),(e=>(s(),h(c(_),{key:e,"show-arrow":!1},{trigger:m((()=>[f(c(C),{quaternary:"",size:"tiny"},{icon:m((()=>[l("img",{src:c(q).findEmoji(e)},null,8,W)])),_:2},1024)])),default:m((()=>[y(" "+u(e),1)])),_:2},1024)))),128))])],64)):d("v-if",!0),Y,l("div",Z,[(s(!0),i(g,null,p(c(q).default,(([e,n])=>(s(),h(c(_),{key:e,"show-arrow":!1},{trigger:m((()=>[f(c(C),{quaternary:"",size:"tiny",onClick:()=>function(e){var n;de.value.unshift(e),de.value=J(de.value).slice(0,26),null==(n=ie.value)||n.focus(),document.execCommand("insertHTML",!1,`<img data-msg=${e} data-type=${j.EMOJI} class="emoji--min" src=${q.findEmoji(e)} />`)}(e)},{icon:m((()=>[l("img",{src:n},null,8,ee)])),_:2},1032,["onClick"])])),default:m((()=>[y(" "+u(e),1)])),_:2},1024)))),128))])])),_:1},8,["show"])])),default:m((()=>[y(" 表情 ")])),_:1}),f(c(_),{"show-arrow":!1},{trigger:m((()=>[f(c(C),{quaternary:"",size:"tiny",onClick:n[2]||(n[2]=()=>_e({chatMessageType:c(j).EMOJI,msg:0}))},{icon:m((()=>[ne])),_:1})])),default:m((()=>[y(" 点赞 ")])),_:1}),f(c(E),{abstract:"",multiple:"",accept:"image/*",onChange:n[3]||(n[3]=e=>we(e,c(j).IMAGE))},{default:m((()=>[f(c(I),{abstract:""},{default:m((({handleClick:e})=>[f(c(_),{"show-arrow":!1},{trigger:m((()=>[f(c(C),{quaternary:"",size:"tiny",onClick:e},{icon:m((()=>[te])),_:2},1032,["onClick"])])),default:m((()=>[y(" 上传图片 ")])),_:2},1024)])),_:1})])),_:1}),f(c(E),{abstract:"",multiple:"",accept:"video/*,.pdf,.doc.docx,,.zip,.xlsx,.txt",onChange:n[4]||(n[4]=e=>we(e,c(j).FILE))},{default:m((()=>[f(c(I),{abstract:""},{default:m((({handleClick:e})=>[f(c(_),{"show-arrow":!1},{trigger:m((()=>[f(c(C),{quaternary:"",size:"tiny",onClick:e},{icon:m((()=>[oe])),_:2},1032,["onClick"])])),default:m((()=>[y(" 上传文件 ")])),_:2},1024)])),_:1})])),_:1}),c(le)?(s(),i(g,{key:0},[f(T,v(c(me),{onComfirm:n[5]||(n[5]=e=>pe(c(j).AUDIO,e))}),{trigger:m((()=>[f(c(_),{"show-arrow":!1},{trigger:m((()=>[f(c(C),{quaternary:"",size:"tiny"},{icon:m((()=>[f(c(M),{size:"18",component:c(A)},null,8,["component"])])),_:1})])),default:m((()=>[y(" 语音通话 ")])),_:1})])),_:1},16),f(T,v(c(me),{onComfirm:n[6]||(n[6]=e=>pe(c(j).VIDEO,e))}),{trigger:m((()=>[f(c(_),{"show-arrow":!1},{trigger:m((()=>[f(c(C),{quaternary:"",size:"tiny"},{icon:m((()=>[f(c(M),{size:"20",component:c(V)},null,8,["component"])])),_:1})])),default:m((()=>[y(" 视频会议 ")])),_:1})])),_:1},16)],64)):(s(),i(g,{key:1},[f(c(_),{"show-arrow":!1},{trigger:m((()=>[f(c(C),{quaternary:"",size:"tiny",onClick:n[7]||(n[7]=()=>pe(c(j).AUDIO))},{icon:m((()=>[f(c(M),{size:"18",component:c(A)},null,8,["component"])])),_:1})])),default:m((()=>[y(" 语音通话 ")])),_:1}),f(c(_),{"show-arrow":!1},{trigger:m((()=>[f(c(C),{quaternary:"",size:"tiny",onClick:n[8]||(n[8]=()=>pe(c(j).VIDEO))},{icon:m((()=>[f(c(M),{size:"20",component:c(V)},null,8,["component"])])),_:1})])),default:m((()=>[y(" 视频通话 ")])),_:1})],64))]),r(l("div",{ref_key:"inputRef",ref:ie,class:"input-box",contenteditable:"",onKeydown:he,onInput:ye},null,544),[[w,c(ae).id]]),l("div",re,[se,f(c(C),{type:"primary",round:"",disabled:c(ge),onClick:Me},{default:m((()=>[y("发送")])),_:1},8,["disabled"])])],4)),[[w,c(ae).id]])}});export{ie as default};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,computed as n,watch as s,openBlock as o,createElementBlock as i,normalizeClass as r,unref as a,normalizeStyle as c,createVNode as l,withCtx as u,Fragment as m,renderList as p,toDisplayString as d,createCommentVNode as g,createBlock as f,createElementVNode as v,withModifiers as y,nextTick as h}from"vue";import{NImageGroup as T,NAvatar as M,NImage as k,NIcon as _,NSpace as x,NButtonGroup as w,NButton as I,NTooltip as S}from"naive-ui";import{format as C}from"date-fns";import{getHistoryRecordApi as j,readMessageApi as L}from"../api/index.js";import{useState as E}from"../hooks/useState.js";import{useSession as b}from"../hooks/useSession.js";import{MESSAGE_TYPE as z}from"../constants/index.js";import"trtc-sdk-v5";import{isAudioOrVideoMessage as A,simplifyMessage as H,getAVTime as O,downloadFile as D}from"../utils/index.js";import{first as R,last as N}from"lodash-es";import P from"./PersonProfile.vue.js";import q from"./MessageTemplate.vue.js";import{emojis as B}from"../utils/emoji.js";import J from"./ContextMenu.js";import"../../../../shared/utils/index.js";import"@vueuse/core";import"@vue/shared";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import{CallOutline as U,VideocamOutline as F,DocumentSharp as G,ChatbubbleEllipsesOutline as K,EllipsisHorizontal as X,ArrowDownSharp as Y}from"@vicons/ionicons5";import{useScrollLoading as $}from"../../../../shared/hooks/useScrollLoading.js";const Q={key:0,class:"time"},V={key:2,class:"message-box"},W={key:0,class:"content-box"},Z={class:"name-box"},ee=["data-time"],te=["onContextmenu"],ne={key:0,class:"reference-content"},se=["innerHTML"],oe=["src"],ie=["innerHTML"],re=["innerHTML"],ae={style:{"margin-left":"8px"}},ce={class:"size"};var le=e({__name:"ChatMain",setup(e){const le=t(),{state:ue,setMsgList:me}=E(),{setCurrentSessionItem:pe,isGroupChat:de}=b(ue),ge=t(),fe=t(!1),ve=t({left:0,top:0}),ye=t(),he={page:0,hasMore:!0,lastSendTime:C(new Date,"yyyy-MM-dd HH:mm:ss")},Te=n((()=>({"--c-tip-top":de.value?"1px":"-20px","--c-tip-gap":de.value?"10px":"0px"})));function Me({nodes:e}){var t,n;const{_ctx:s}=null==(t=e.download)?void 0:t.children,o=s?null==(n=null==s?void 0:s.proxy)?void 0:n.previewSrc:"";return[e.prev,e.next,e.rotateCounterclockwise,e.rotateClockwise,e.resizeToOriginalSize,e.zoomOut,e.zoomIn,l(S,null,{trigger:()=>l(_,{style:"cursor: pointer",color:"rgba(255, 255, 255, 0.75",size:24,component:Y,onClick:()=>o&&D(o,"img")},null),default:()=>"下载"}),e.close]}async function ke(){try{if(!he.hasMore)return;he.page++;const e=await j({sessionKey:ue.currentSessionItem.sessionKey,page:he.page,lastSendTime:he.lastSendTime});if(!Array.isArray(e)||0===e.length)return he.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=R(e).id;he.lastSendTime=N(e).sendTime,me(he.page>1?[...e,...ue.msgList]:e),1===he.page&&ue.currentSessionItem.unreadNum&&(await L({chatType:ue.currentSessionItem.chatType,messageIdSet:[t],receiver:ue.userInfo.id,sender:ue.currentSessionItem.receiver}),pe({unreadNum:0}))}catch(e){console.log(e)}}async function _e(e,t){ye.value=t,async function(e){var t,n,s,o,i,r;fe.value=!0,await h();const{clientX:a,clientY:c}=e,{width:l=0,height:u=0,left:m=0,top:p=0}=(null==(t=le.value)?void 0:t.getBoundingClientRect())||{},d=null!=(o=null==(s=null==(n=ge.value)?void 0:n.$el)?void 0:s.getBoundingClientRect().height)?o:220,g=null!=(r=null==(i=le.value)?void 0:i.scrollTop)?r:0,f=5,v={};a<=m+l/2?v.left=a-m+f+"px":v.right=m+l-a-f+"px";c-p<d/2?v.top=g+f+"px":p+u-c<=d/2?v.bottom=Math.abs(g)+f+"px":v.top=g+c-p-d/2+"px";ve.value=v}(e)}function xe(e){const{chatMessageType:t,messageTemplate:n}=e.content;return t!==z.TEMPLATE||!!n}function we(e){const{chatMessageType:t,msg:n=""}=e.content;if(t===z.BLEND){const e=n.match(/<img[^>]*>/gi);return!e||!e.length}return t&&[z.TEXT,z.EMOJI].includes(t)}function Ie(e){const{chatMessageType:t,msg:n=""}=e.content,s=n.match(/<img[^>]*>/gi);return t===z.BLEND&&s&&s.length}function Se(e,t){var n,s;const{chatMessageType:o,messageTemplate:i}=e.content;if(o===z.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 Ce(e){var t,n;const{chatMessageType:s,messageTemplate:o}=e;return s===z.TEMPLATE&&3==(null==(n=null==(t=null==o?void 0:o.setting)?void 0:t.style)?void 0:n.id)}function je(e,t){var n;const s=new Date(e.sendTime).getTime(),o=null==(n=ue.msgList[t+1])?void 0:n.sendTime;if(o){return s-new Date(o).getTime()>3e5}return!0}function Le(e){ue.currentReferenceMsg=e,ue.currentReferenceMsg.content.referenceContent=null,Object.assign(ue.currentReferenceMsg,{chatType:ue.currentSessionItem.chatType,receiver:ue.currentSessionItem.receiver,receiverAvatar:ue.currentSessionItem.avatar,receiverName:ue.currentSessionItem.name})}function Ee(e,t){"reply"===e&&Le(t)}return $(le,(()=>{ke()}),"top",(()=>{fe.value=!1})),s((()=>ue.id),(e=>{e&&(ue.currentReferenceMsg=null,Object.assign(he,{page:0,hasMore:!0,lastSendTime:C(new Date,"yyyy-MM-dd HH:mm:ss")}),ke())}),{immediate:!0}),s((()=>ue.isAppendMsg),(e=>{e&&(me([...ue.msgList,ue.currentMsg]),async function(){var e,t,n;await h();const s=null!=(t=null==(e=le.value)?void 0:e.scrollHeight)?t:0;null==(n=le.value)||n.scrollTo({top:s,behavior:"auto"})}(),ue.isAppendMsg=!1)}),{immediate:!0}),(e,t)=>(o(),i("div",{class:r(["chat-main",{"home-bg":!a(ue).id}]),ref_key:"chatMainRef",ref:le,style:c(a(Te))},[l(a(T),{"show-toolbar-tooltip":"","render-toolbar":Me},{default:u((()=>[(o(!0),i(m,null,p(a(ue).msgList,((e,t)=>(o(),i(m,{key:e.id},[xe(e)?(o(),i("div",{key:0,class:r(["message-item",{"message-item--mine":e.sender==a(ue).userInfo.id}])},[je(e,t)?(o(),i("p",Q,d(e.__sendTime),1)):g("v-if",!0),Se(e,"system")?(o(),f(q,{key:1,data:e},null,8,["data"])):(o(),i("div",V,[l(P,{"user-id":e.sender,placement:e.sender==a(ue).userInfo.id?"left":"right"},{trigger:u((()=>[l(a(M),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id","placement"]),e.content?(o(),i("div",W,[v("div",Z,[v("span",{class:"name","data-time":e.__time},d(a(de)?e.senderName:""),9,ee)]),v("div",{class:r(["content",{emoji:e.content.chatMessageType===a(z).EMOJI,template:e.content.chatMessageType===a(z).TEMPLATE,"template--3":Ce(e.content),"audio-video":a(A)(e.content),file:e.content.chatMessageType===a(z).FILE}]),onContextmenu:y((t=>_e(t,e.id)),["prevent"])},[we(e)?(o(),i(m,{key:0},[e.content.referenceContent?(o(),i("div",ne,[v("span",null,d(e.content.referenceContent.senderName)+":",1),v("pre",{innerHTML:a(H)(e.content.referenceContent.content)},null,8,se)])):g("v-if",!0),e.content.chatMessageType===a(z).EMOJI?(o(),i("img",{key:1,class:r([e.content.referenceContent?"emoji--min":"emoji--big"]),src:a(B).findEmoji(e.__content)},null,10,oe)):(o(),i("pre",{key:2,innerHTML:e.__content},null,8,ie))],64)):g("v-if",!0),Ie(e)?(o(),i("pre",{key:1,innerHTML:e.__content},null,8,re)):g("v-if",!0),Se(e,"template")?(o(),f(q,{key:2,data:e},null,8,["data"])):g("v-if",!0),e.content.chatMessageType===a(z).IMAGE?(o(),f(a(k),{key:3,width:"240",src:e.__content},null,8,["src"])):g("v-if",!0),a(A)(e.content)?(o(),i(m,{key:4},[l(a(_),{class:r({"is-audio":e.content.chatMessageType===a(z).AUDIO}),component:e.content.chatMessageType===a(z).AUDIO?a(U):a(F)},null,8,["class","component"]),v("span",ae,d(a(O)(e.__content)),1)],64)):g("v-if",!0),e.content.chatMessageType===a(z).FILE?(o(),f(a(x),{key:5,"wrap-item":!1},{default:u((()=>[l(a(_),{class:"icon-file",size:"40",component:a(G)},null,8,["component"]),l(a(x),{"wrap-item":!1,vertical:"",justify:"space-between",style:{"row-gap":"0"}},{default:u((()=>[v("span",null,d(e.__content),1),v("span",ce,d(e.__size),1)])),_:2},1024)])),_:2},1024)):g("v-if",!0),l(a(w),{class:"quick-menu"},{default:u((()=>[a(A)(e.content)?g("v-if",!0):(o(),i(m,{key:0},[g(' <n-button quaternary size="tiny">\n\t\t\t\t\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<i class="chat--iconfont chat--icon-face" />\n\t\t\t\t\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t\t\t\t</n-button> '),l(a(I),{quaternary:"",size:"tiny",onClick:()=>Le(e)},{icon:u((()=>[l(a(_),{size:"17",component:a(K)},null,8,["component"])])),_:2},1032,["onClick"])],64)),l(a(I),{quaternary:"",size:"tiny",onClick:t=>_e(t,e.id)},{icon:u((()=>[l(a(_),{size:"14",component:a(X)},null,8,["component"])])),_:2},1032,["onClick"])])),_:2},1024)],42,te)])):g("v-if",!0)]))],2)):g("v-if",!0)],64)))),128))])),_:1}),l(a(J),{ref_key:"contextmenuRef",ref:ge,show:fe.value,"onUpdate:show":t[0]||(t[0]=e=>fe.value=e),position:ve.value,"msg-id":ye.value,onSelect:Ee},null,8,["show","position","msg-id"])],6))}});export{le as default};
1
+ import{defineComponent as e,ref as t,computed as n,watch as s,openBlock as o,createElementBlock as i,normalizeClass as r,unref as a,normalizeStyle as c,createVNode as l,withCtx as u,Fragment as m,renderList as p,toDisplayString as d,createCommentVNode as g,createBlock as f,createElementVNode as v,withModifiers as y,nextTick as h}from"vue";import{NImageGroup as T,NAvatar as M,NImage as k,NIcon as _,NSpace as x,NButtonGroup as w,NButton as I,NTooltip as S}from"naive-ui";import{format as C}from"date-fns";import{getHistoryRecordApi as j,readMessageApi as L}from"../api/index.js";import{useState as E}from"../hooks/useState.js";import{useSession as b}from"../hooks/useSession.js";import{MESSAGE_TYPE as z}from"../constants/index.js";import"trtc-sdk-v5";import{isAudioOrVideoMessage as A,simplifyMessage as H,getAVTime as O,downloadFile as D}from"../utils/index.js";import{first as R,last as N}from"lodash-es";import P from"./PersonProfile.vue.js";import q from"./MessageTemplate.vue.js";import{emojis as B}from"../utils/emoji.js";import J from"./ContextMenu.js";import"../../../../shared/utils/index.js";import"@vueuse/core";import"@vue/shared";import"@vueuse/shared";import"../../../../shared/hooks/selectHooks/useSearchContent.js";import{CallOutline as U,VideocamOutline as F,DocumentSharp as G,ChatbubbleEllipsesOutline as K,EllipsisHorizontal as X,ArrowDownSharp as Y}from"@vicons/ionicons5";import{useScrollLoading as $}from"../../../../shared/hooks/useScrollLoading.js";const Q={key:0,class:"time"},V={key:2,class:"message-box"},W={key:0,class:"content-box"},Z={class:"name-box"},ee=["data-time"],te=["onContextmenu"],ne={key:0,class:"reference-content"},se=["innerHTML"],oe=["src"],ie=["innerHTML"],re=["innerHTML"],ae={style:{"margin-left":"8px"}},ce={class:"size"};var le=e({__name:"ChatMain",setup(e){const le=t(),{state:ue,setMsgList:me}=E(),{setCurrentSessionItem:pe,isGroupChat:de}=b(ue),ge=t(),fe=t(!1),ve=t({left:0,top:0}),ye=t(),he={page:0,hasMore:!0,lastSendTime:C(new Date,"yyyy-MM-dd HH:mm:ss")},Te=n((()=>({"--c-tip-top":de.value?"1px":"-20px","--c-tip-gap":de.value?"10px":"0px"})));function Me({nodes:e}){var t,n;const{_ctx:s}=null==(t=e.download)?void 0:t.children,o=s?null==(n=null==s?void 0:s.proxy)?void 0:n.previewSrc:"";return[e.prev,e.next,e.rotateCounterclockwise,e.rotateClockwise,e.resizeToOriginalSize,e.zoomOut,e.zoomIn,l(S,null,{trigger:()=>l(_,{style:"cursor: pointer",color:"rgba(255, 255, 255, 0.75",size:24,component:Y,onClick:()=>o&&D(o,"img")},null),default:()=>"下载"}),e.close]}async function ke(){try{if(!he.hasMore)return;he.page++;const e=await j({sessionKey:ue.currentSessionItem.sessionKey,page:he.page,lastSendTime:he.lastSendTime});if(!Array.isArray(e)||0===e.length)return he.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=R(e).id;he.lastSendTime=N(e).sendTime,me(he.page>1?[...e,...ue.msgList]:e),1===he.page&&ue.currentSessionItem.unreadNum&&(await L({chatType:ue.currentSessionItem.chatType,messageIdSet:[t],receiver:ue.userInfo.id,sender:ue.currentSessionItem.receiver}),pe({unreadNum:0}))}catch(e){console.log(e)}}async function _e(e,t){ye.value=t,async function(e){var t,n,s,o,i,r;fe.value=!0,await h();const{clientX:a,clientY:c}=e,{width:l=0,height:u=0,left:m=0,top:p=0}=(null==(t=le.value)?void 0:t.getBoundingClientRect())||{},d=null!=(o=null==(s=null==(n=ge.value)?void 0:n.$el)?void 0:s.getBoundingClientRect().height)?o:220,g=null!=(r=null==(i=le.value)?void 0:i.scrollTop)?r:0,f=5,v={};a<=m+l/2?v.left=a-m+f+"px":v.right=m+l-a-f+"px";c-p<d/2?v.top=g+f+"px":p+u-c<=d/2?v.bottom=Math.abs(g)+f+"px":v.top=g+c-p-d/2+"px";ve.value=v}(e)}function xe(e){const{chatMessageType:t,messageTemplate:n}=e.content;return t!==z.TEMPLATE||!!n}function we(e){const{chatMessageType:t,msg:n=""}=e.content;if(t===z.BLEND){const e=n.match(/<img[^>]*>/gi);return!e||!e.length}return t&&[z.TEXT,z.EMOJI].includes(t)}function Ie(e){const{chatMessageType:t,msg:n=""}=e.content,s=n.match(/<img[^>]*>/gi);return t===z.BLEND&&s&&s.length}function Se(e,t){var n,s;const{chatMessageType:o,messageTemplate:i}=e.content;if(o===z.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 Ce(e){var t,n;const{chatMessageType:s,messageTemplate:o}=e;return s===z.TEMPLATE&&3==(null==(n=null==(t=null==o?void 0:o.setting)?void 0:t.style)?void 0:n.id)}function je(e,t){var n;const s=new Date(e.sendTime).getTime(),o=null==(n=ue.msgList[t+1])?void 0:n.sendTime;if(o){return s-new Date(o).getTime()>3e5}return!0}function Le(e){ue.currentReferenceMsg=e,ue.currentReferenceMsg.content.referenceContent=null,Object.assign(ue.currentReferenceMsg,{chatType:ue.currentSessionItem.chatType,receiver:ue.currentSessionItem.receiver,receiverAvatar:ue.currentSessionItem.avatar,receiverName:ue.currentSessionItem.name})}function Ee(e,t){"reply"===e&&Le(t)}return $(le,(()=>{ke()}),"top",(()=>{fe.value=!1})),s((()=>ue.id),(e=>{e&&(ue.currentReferenceMsg=null,Object.assign(he,{page:0,hasMore:!0,lastSendTime:C(new Date,"yyyy-MM-dd HH:mm:ss")}),ke())}),{immediate:!0}),s((()=>ue.isAppendMsg),(e=>{e&&(me([...ue.msgList,ue.currentMsg]),async function(){var e,t,n;await h();const s=null!=(t=null==(e=le.value)?void 0:e.scrollHeight)?t:0;null==(n=le.value)||n.scrollTo({top:s,behavior:"auto"})}(),ue.isAppendMsg=!1)}),{immediate:!0}),(e,t)=>(o(),i("div",{class:r(["chat-main",{"home-bg":!a(ue).id}]),ref_key:"chatMainRef",ref:le,style:c(a(Te))},[l(a(T),{"show-toolbar-tooltip":"","render-toolbar":Me},{default:u((()=>[(o(!0),i(m,null,p(a(ue).msgList,((e,t)=>(o(),i(m,{key:e.id},[xe(e)?(o(),i("div",{key:0,class:r(["message-item",{"message-item--mine":e.sender==a(ue).userInfo.id}])},[je(e,t)?(o(),i("p",Q,d(e.__sendTime),1)):g("v-if",!0),Se(e,"system")?(o(),f(q,{key:1,data:e},null,8,["data"])):(o(),i("div",V,[l(P,{"user-id":e.sender,placement:e.sender==a(ue).userInfo.id?"left":"right"},{trigger:u((()=>[l(a(M),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id","placement"]),e.content?(o(),i("div",W,[v("div",Z,[v("span",{class:"name","data-time":e.__time},d(a(de)?e.senderName:""),9,ee)]),v("div",{class:r(["content",{emoji:e.content.chatMessageType===a(z).EMOJI,template:e.content.chatMessageType===a(z).TEMPLATE,"template--3":Ce(e.content),"audio-video":a(A)(e.content),file:e.content.chatMessageType===a(z).FILE}]),onContextmenu:y((t=>_e(t,e.id)),["prevent"])},[we(e)?(o(),i(m,{key:0},[e.content.referenceContent?(o(),i("div",ne,[v("span",null,d(e.content.referenceContent.senderName)+":",1),v("pre",{innerHTML:a(H)(e.content.referenceContent.content)},null,8,se)])):g("v-if",!0),e.content.chatMessageType===a(z).EMOJI?(o(),i("img",{key:1,class:r([e.content.referenceContent?"emoji--min":"emoji--big"]),src:a(B).findEmoji(e.__content)},null,10,oe)):(o(),i("pre",{key:2,innerHTML:e.__content},null,8,ie))],64)):g("v-if",!0),Ie(e)?(o(),i("pre",{key:1,innerHTML:e.__content},null,8,re)):g("v-if",!0),Se(e,"template")?(o(),f(q,{key:2,data:e},null,8,["data"])):g("v-if",!0),e.content.chatMessageType===a(z).IMAGE?(o(),f(a(k),{key:3,width:"240",src:e.__content},null,8,["src"])):g("v-if",!0),a(A)(e.content)?(o(),i(m,{key:4},[l(a(_),{class:r({"is-audio":e.content.chatMessageType===a(z).AUDIO}),component:e.content.chatMessageType===a(z).AUDIO?a(U):a(F)},null,8,["class","component"]),v("span",ae,d(a(O)(e.__content)),1)],64)):g("v-if",!0),e.content.chatMessageType===a(z).FILE?(o(),f(a(x),{key:5,"wrap-item":!1},{default:u((()=>[l(a(_),{class:"icon-file",size:"40",component:a(G)},null,8,["component"]),l(a(x),{"wrap-item":!1,vertical:"",justify:"space-between",style:{"row-gap":"0"}},{default:u((()=>[v("span",null,d(e.__content),1),v("span",ce,d(e.__size),1)])),_:2},1024)])),_:2},1024)):g("v-if",!0),l(a(w),{class:"quick-menu"},{default:u((()=>[a(A)(e.content)?g("v-if",!0):(o(),i(m,{key:0},[g(' <n-button quaternary size="tiny">\r\n\t\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\t<i class="chat--iconfont chat--icon-face" />\r\n\t\t\t\t\t\t\t\t\t\t\t\t</template>\r\n\t\t\t\t\t\t\t\t\t\t\t</n-button> '),l(a(I),{quaternary:"",size:"tiny",onClick:()=>Le(e)},{icon:u((()=>[l(a(_),{size:"17",component:a(K)},null,8,["component"])])),_:2},1032,["onClick"])],64)),l(a(I),{quaternary:"",size:"tiny",onClick:t=>_e(t,e.id)},{icon:u((()=>[l(a(_),{size:"14",component:a(X)},null,8,["component"])])),_:2},1032,["onClick"])])),_:2},1024)],42,te)])):g("v-if",!0)]))],2)):g("v-if",!0)],64)))),128))])),_:1}),l(a(J),{ref_key:"contextmenuRef",ref:ge,show:fe.value,"onUpdate:show":t[0]||(t[0]=e=>fe.value=e),position:ve.value,"msg-id":ye.value,onSelect:Ee},null,8,["show","position","msg-id"])],6))}});export{le as default};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,computed as o,withDirectives as s,createVNode as i,vShow as n,isVNode as r}from"vue";import{NButtonGroup as a,NButton as l,NIcon as c}from"naive-ui";import{CopyOutline as p,ChatbubbleEllipsesOutline as d,DownloadOutline as m}from"@vicons/ionicons5";import{onClickOutside as u}from"@vueuse/core";import{useState as f}from"../hooks/useState.js";import{isAudioOrVideoMessage as g,downloadFile as y}from"../utils/index.js";import"lodash-es";import{MESSAGE_TYPE as w}from"../constants/index.js";import"../api/index.js";import"trtc-sdk-v5";import{isSameMonth as h}from"date-fns";import{emojis as v}from"../utils/emoji.js";var E=e({name:"PopupMenu",inheritAttrs:!1,props:{show:{type:Boolean,default:!1},position:{type:Object},msgId:{type:String}},emits:["update:show","select"],setup(e,{attrs:E,slots:b,emit:T}){const{state:j,setMsgList:I}=f(),M=[{icon:p,label:"复制",key:"copy"},{icon:d,label:"回复",key:"reply"},{icon:m,label:"下载",key:"download"}],k=t(null),x=o((()=>j.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:s}=x.value,{chatMessageType:i}=t,n=[];return(s!==j.userInfo.id&&h(new Date(o),new Date)||i===w.TEMPLATE)&&n.push("withdraw"),[w.TEXT,w.EMOJI,w.BLEND].includes(i)?n.push("download"):g(t)?n.push("copy","relay","reply","download"):i===w.FILE?n.push("copy"):[w.FORWARD,w.TEMPLATE].includes(i)&&n.push("copy","download"),n.length?M.filter((e=>!n.includes(e.key))):M}));return u(k,(e=>{T("update:show",!1)})),()=>{let t;return e.msgId&&O.value?s(i("div",{class:"contextmenu-wrapper",ref:k,style:e.position},[i(a,{vertical:!0},(o=t=O.value.map((e=>i(l,{onClick:()=>async function(e){T("update:show",!1);const{content:t={},sendTime:o,sender:s}=x.value||{},{chatMessageType:i}=t;switch(e){case"copy":if(!t.msg)return console.log("复制内容为空!");if(!navigator||!("clipboard"in navigator))return console.log("当前浏览器版本不支持复制!");try{if(i===w.TEXT)await navigator.clipboard.writeText(t.msg);else{let e;if([w.EMOJI,w.IMAGE].includes(i)){const o=i===w.EMOJI?v.findEmoji(t.msg):t.msg;e=`<img data-msg=${t.msg} data-type=${i} class=${i===w.EMOJI?"emoji--min":""} src=${o} />`}else e=t.msg;await navigator.clipboard.write([new window.ClipboardItem({"text/html":new Blob([e],{type:"text/html"})})])}}catch(e){console.log("复制失败!")}return;case"download":return void y(t.fileUrl,t.msg)}T("select",e,x.value)}(e.key),quaternary:!0},{default:()=>e.label,icon:()=>i(c,{component:e.icon},null)}))),"function"==typeof o||"[object Object]"===Object.prototype.toString.call(o)&&!r(o)?t:{default:()=>[t]}))]),[[n,e.show]]):null;var o}}});export{E as default};
1
+ import{defineComponent as e,ref as t,computed as o,withDirectives as s,createVNode as i,vShow as n,isVNode as r}from"vue";import{NButtonGroup as a,NButton as l,NIcon as c}from"naive-ui";import{CopyOutline as d,ChatbubbleEllipsesOutline as p,ReturnDownBack as u,DownloadOutline as m}from"@vicons/ionicons5";import{onClickOutside as f}from"@vueuse/core";import{useState as g}from"../hooks/useState.js";import{isAudioOrVideoMessage as y,downloadFile as w}from"../utils/index.js";import"lodash-es";import{MESSAGE_TYPE as h}from"../constants/index.js";import{recallMessageApi as v}from"../api/index.js";import"trtc-sdk-v5";import{emojis as I}from"../utils/emoji.js";var T=e({name:"PopupMenu",inheritAttrs:!1,props:{show:{type:Boolean,default:!1},position:{type:Object},msgId:{type:String}},emits:["update:show","select"],setup(e,{attrs:T,slots:b,emit:E}){const{state:j,setMsgList:M}=g(),k=[{icon:d,label:"复制",key:"copy"},{icon:p,label:"回复",key:"reply"},{icon:u,label:"撤回",key:"withdraw"},{icon:m,label:"下载",key:"download"}],x=t(null),O=o((()=>j.msgList.find((({id:t})=>t===e.msgId)))),L=o((()=>{if(!e.msgId)return[];if(!(null==O?void 0:O.value))return[];const{content:t={},sendTime:o,sender:s}=O.value,{chatMessageType:i}=t,n=[];return(s!==j.userInfo.id||i===h.TEMPLATE||s===j.userInfo.id&&Date.now()-new Date(o).getTime()>2592e5)&&n.push("withdraw"),[h.TEXT,h.EMOJI,h.BLEND].includes(i)?n.push("download"):y(t)?n.push("copy","relay","reply","download"):i===h.FILE?n.push("copy"):[h.FORWARD,h.TEMPLATE].includes(i)&&n.push("copy","download"),n.length?k.filter((e=>!n.includes(e.key))):k}));return f(x,(e=>{E("update:show",!1)})),()=>{let t;return e.msgId&&L.value?s(i("div",{class:"contextmenu-wrapper",ref:x,style:e.position},[i(a,{vertical:!0},(o=t=L.value.map((t=>i(l,{onClick:()=>async function(t){E("update:show",!1);const{content:o={},sendTime:s,sender:i}=O.value||{},{chatMessageType:n}=o;switch(t){case"copy":if(!o.msg)return console.log("复制内容为空!");if(!navigator||!("clipboard"in navigator))return console.log("当前浏览器版本不支持复制!");try{if(n===h.TEXT)await navigator.clipboard.writeText(o.msg);else{let e;if([h.EMOJI,h.IMAGE].includes(n)){const t=n===h.EMOJI?I.findEmoji(o.msg):o.msg;e=`<img data-msg=${o.msg} data-type=${n} class=${n===h.EMOJI?"emoji--min":""} src=${t} />`}else e=o.msg;await navigator.clipboard.write([new window.ClipboardItem({"text/html":new Blob([e],{type:"text/html"})})])}}catch(e){console.log("复制失败!")}return;case"download":return void w(o.fileUrl,o.msg);case"withdraw":v({chatType:j.currentSessionItem.chatType,messageIdSet:e.msgId,receiver:j.userInfo.id,sender:j.userInfo.id})}E("select",t,O.value)}(t.key),quaternary:!0},{default:()=>t.label,icon:()=>i(c,{component:t.icon},null)}))),"function"==typeof o||"[object Object]"===Object.prototype.toString.call(o)&&!r(o)?t:{default:()=>[t]}))]),[[n,e.show]]):null;var o}}});export{T as default};
@@ -1 +1 @@
1
- import{defineComponent as t,ref as e,reactive as a,computed as l,openBlock as n,createBlock as o,unref as s,withCtx as r,renderSlot as i,createElementBlock as c,Fragment as u,withDirectives as d,createElementVNode as p,createVNode as m,createCommentVNode as v,toDisplayString as f,createTextVNode as g,renderList as k,vShow as y}from"vue";import{NPopover as h,NAvatar as b,NButton as w,NIcon as C}from"naive-ui";import{ChatbubbleEllipses as _,EyeOffOutline as j,EyeOutline as I,Close as z}from"@vicons/ionicons5";import{useState as x}from"../hooks/useState.js";import{useSession as N}from"../hooks/useSession.js";import"trtc-sdk-v5";import"date-fns";import"lodash-es";import"../utils/emoji.js";import"../../../../shared/utils/index.js";import{openSessionApi as S,getUserDetailApi as $}from"../api/index.js";const D={class:"person-profile-main"},P={class:"left"},T={class:"profile"},q={class:"profile__text"},B={class:"right"},E={class:"right__content"},O={class:"label"},U={class:"content"};var A=t({__name:"PersonProfile",props:{userId:{type:String,required:!0},disabled:{type:Boolean,default:!1}},emits:["close"],setup(t,{emit:A}){const F=t,{state:G}=x(),{openSession:H}=N(G),J=e(!1),K=e(!1),L=e(!1),M=a({}),Q=[{label:"机构",value:"",key:"orgName"},{label:"姓名",value:"",key:"name"},{label:"归属科室",value:"",key:"deptName"},{label:"业务科室",value:"",key:"businessDeptNames"},{label:"手机号",value:"",key:"phone"},{label:"岗位",value:"",key:"post"},{label:"工号",value:"",key:"jobId"},{label:"性别",value:"",key:"orgName"}],R=l((()=>(M.id&&Q.forEach((t=>{const{key:e}=t;t.value=M[e]})),Q)));async function V(){J.value=!1;const t=await S({chatType:G.currentSessionItem.chatType,receiver:F.userId,sender:G.userInfo.id});H(t),A("close")}async function W(t){if(!t)return;const e=await $({userId:F.userId});(null==e?void 0:e.id)?Object.assign(M,e):M.id=""}function X(t){const{key:e,value:a}=t;return"phone"!==e||L.value?a:(a||"").replace(/(\d{3})\d{4}(\d{4})/,"$1****$2")}return(e,a)=>(n(),o(s(h),{raw:"",class:"person-profile-wrapper",show:J.value,"onUpdate:show":[a[3]||(a[3]=t=>J.value=t),W],trigger:t.disabled?"manual":"click","show-arrow":!1,shift:""},{trigger:r((()=>[i(e.$slots,"trigger")])),default:r((()=>[M.id?(n(),c(u,{key:0},[d(p("div",D,[p("div",P,[p("div",T,[m(s(b),{src:M.avatar,bordered:"",round:"",size:100,onClickCapture:a[0]||(a[0]=t=>K.value=!0)},null,8,["src"]),v(' <n-upload abstract accept="image/*" @change="onChange">\n\t\t\t\t\t\t\t<n-upload-trigger #="{ handleClick }" abstract>\n\t\t\t\t\t\t\t\t<n-button\n\t\t\t\t\t\t\t\t\tcircle\n\t\t\t\t\t\t\t\t\tsecondary\n\t\t\t\t\t\t\t\t\tclass="edit-avatar"\n\t\t\t\t\t\t\t\t\tv-show="userDetail.id === state.userInfo.id"\n\t\t\t\t\t\t\t\t\t@click="handleClick"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t\t<n-icon size="16" color="#666666" :component="Camera" />\n\t\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t</n-button>\n\t\t\t\t\t\t\t</n-upload-trigger>\n\t\t\t\t\t\t</n-upload> '),p("div",q,[p("h4",null,f(M.name),1),p("p",null,f(M.orgName),1)]),m(s(w),{strong:"",secondary:"",onClick:V},{default:r((()=>[m(s(C),{size:"13",color:"#666666",component:s(_),style:{"margin-right":"6px"}},null,8,["component"]),g(" 发消息 ")])),_:1})])]),p("div",B,[p("div",E,[(n(!0),c(u,null,k(s(R),((t,e)=>(n(),c("div",{class:"info-item",key:e},[p("span",O,f(t.label),1),p("div",U,[p("span",null,f(X(t)),1),"phone"===t.key&&X(t)?(n(),o(s(C),{key:0,size:"16",color:"#666666",component:L.value?s(j):s(I),style:{"margin-left":"10px"},onClick:a[1]||(a[1]=t=>L.value=!L.value)},null,8,["component"])):v("v-if",!0)])])))),128))])])],512),[[y,!K.value]]),d(p("div",{class:"large-avatar",onClick:a[2]||(a[2]=t=>K.value=!1)},[m(s(w),{circle:"",size:"small",secondary:""},{icon:r((()=>[m(s(C),{size:24,component:s(z),color:"#fff"},null,8,["component"])])),_:1}),m(s(b),{size:310,round:"",src:M.avatar},null,8,["src"])],512),[[y,K.value]])],64)):v("v-if",!0)])),_:3},8,["show","trigger"]))}});export{A as default};
1
+ import{defineComponent as t,ref as e,reactive as a,computed as l,openBlock as n,createBlock as o,unref as r,withCtx as s,renderSlot as i,createElementBlock as c,Fragment as u,withDirectives as d,createElementVNode as p,createVNode as m,createCommentVNode as v,toDisplayString as f,createTextVNode as g,renderList as k,vShow as y}from"vue";import{NPopover as h,NAvatar as b,NButton as w,NIcon as C}from"naive-ui";import{ChatbubbleEllipses as _,EyeOffOutline as j,EyeOutline as I,Close as z}from"@vicons/ionicons5";import{useState as x}from"../hooks/useState.js";import{useSession as N}from"../hooks/useSession.js";import"trtc-sdk-v5";import"date-fns";import"lodash-es";import"../utils/emoji.js";import"../../../../shared/utils/index.js";import{openSessionApi as S,getUserDetailApi as $}from"../api/index.js";const D={class:"person-profile-main"},P={class:"left"},T={class:"profile"},q={class:"profile__text"},B={class:"right"},E={class:"right__content"},O={class:"label"},U={class:"content"};var A=t({__name:"PersonProfile",props:{userId:{type:String,required:!0},disabled:{type:Boolean,default:!1}},emits:["close"],setup(t,{emit:A}){const F=t,{state:G}=x(),{openSession:H}=N(G),J=e(!1),K=e(!1),L=e(!1),M=a({}),Q=[{label:"机构",value:"",key:"orgName"},{label:"姓名",value:"",key:"name"},{label:"归属科室",value:"",key:"deptName"},{label:"业务科室",value:"",key:"businessDeptNames"},{label:"手机号",value:"",key:"phone"},{label:"岗位",value:"",key:"post"},{label:"工号",value:"",key:"jobId"},{label:"性别",value:"",key:"orgName"}],R=l((()=>(M.id&&Q.forEach((t=>{const{key:e}=t;t.value=M[e]})),Q)));async function V(){J.value=!1;const t=await S({chatType:G.currentSessionItem.chatType,receiver:F.userId,sender:G.userInfo.id});H(t),A("close")}async function W(t){if(!t)return;const e=await $({userId:F.userId});(null==e?void 0:e.id)?Object.assign(M,e):M.id=""}function X(t){const{key:e,value:a}=t;return"phone"!==e||L.value?a:(a||"").replace(/(\d{3})\d{4}(\d{4})/,"$1****$2")}return(e,a)=>(n(),o(r(h),{raw:"",class:"person-profile-wrapper",show:J.value,"onUpdate:show":[a[3]||(a[3]=t=>J.value=t),W],trigger:t.disabled?"manual":"click","show-arrow":!1,shift:""},{trigger:s((()=>[i(e.$slots,"trigger")])),default:s((()=>[M.id?(n(),c(u,{key:0},[d(p("div",D,[p("div",P,[p("div",T,[m(r(b),{src:M.avatar,bordered:"",round:"",size:100,onClickCapture:a[0]||(a[0]=t=>K.value=!0)},null,8,["src"]),v(' <n-upload abstract accept="image/*" @change="onChange">\r\n\t\t\t\t\t\t\t<n-upload-trigger #="{ handleClick }" abstract>\r\n\t\t\t\t\t\t\t\t<n-button\r\n\t\t\t\t\t\t\t\t\tcircle\r\n\t\t\t\t\t\t\t\t\tsecondary\r\n\t\t\t\t\t\t\t\t\tclass="edit-avatar"\r\n\t\t\t\t\t\t\t\t\tv-show="userDetail.id === state.userInfo.id"\r\n\t\t\t\t\t\t\t\t\t@click="handleClick"\r\n\t\t\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t\t\t<template #icon>\r\n\t\t\t\t\t\t\t\t\t\t<n-icon size="16" color="#666666" :component="Camera" />\r\n\t\t\t\t\t\t\t\t\t</template>\r\n\t\t\t\t\t\t\t\t</n-button>\r\n\t\t\t\t\t\t\t</n-upload-trigger>\r\n\t\t\t\t\t\t</n-upload> '),p("div",q,[p("h4",null,f(M.name),1),p("p",null,f(M.orgName),1)]),m(r(w),{strong:"",secondary:"",onClick:V},{default:s((()=>[m(r(C),{size:"13",color:"#666666",component:r(_),style:{"margin-right":"6px"}},null,8,["component"]),g(" 发消息 ")])),_:1})])]),p("div",B,[p("div",E,[(n(!0),c(u,null,k(r(R),((t,e)=>(n(),c("div",{class:"info-item",key:e},[p("span",O,f(t.label),1),p("div",U,[p("span",null,f(X(t)),1),"phone"===t.key&&X(t)?(n(),o(r(C),{key:0,size:"16",color:"#666666",component:L.value?r(j):r(I),style:{"margin-left":"10px"},onClick:a[1]||(a[1]=t=>L.value=!L.value)},null,8,["component"])):v("v-if",!0)])])))),128))])])],512),[[y,!K.value]]),d(p("div",{class:"large-avatar",onClick:a[2]||(a[2]=t=>K.value=!1)},[m(r(w),{circle:"",size:"small",secondary:""},{icon:s((()=>[m(r(C),{size:24,component:r(z),color:"#fff"},null,8,["component"])])),_:1}),m(r(b),{size:310,round:"",src:M.avatar},null,8,["src"])],512),[[y,K.value]])],64)):v("v-if",!0)])),_:3},8,["show","trigger"]))}});export{A as default};