cnhis-design-vue 3.2.7-beta.30 → 3.2.7-beta.32
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +87 -87
- package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
- package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +1 -0
- package/es/components/bpmn-workflow/types/ModelingModule.d.ts +1 -0
- package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +1 -0
- package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
- package/es/components/iho-chat/index.d.ts +2 -3
- package/es/components/iho-chat/src/Index.vue.d.ts +2 -3
- package/es/components/iho-chat/src/components/ChatHeader.vue2.js +1 -1
- package/es/components/iho-chat/src/components/ChatSet.vue2.js +1 -1
- package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
- package/es/components/iho-chat/src/components/SiderList.vue.d.ts +2 -3
- package/es/components/iho-chat/src/components/SiderList.vue2.js +1 -1
- package/es/components/iho-chat/src/hooks/useSession.d.ts +1 -1
- package/es/components/iho-chat/src/hooks/useSession.js +1 -1
- package/es/components/index.css +1 -1
- package/es/components/scale-view/index.d.ts +23 -1
- package/es/components/scale-view/src/ScaleView.vue.d.ts +23 -1
- package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
- package/es/components/scale-view/src/components/EvaluateCountdown.vue.d.ts +21 -1
- package/es/components/scale-view/src/components/EvaluateCountdown.vue2.js +1 -1
- package/es/components/scale-view/src/components/formitem/r-select.js +1 -1
- package/es/components/scale-view/src/directive/drag-move.d.ts +3 -0
- package/es/components/scale-view/src/directive/drag-move.js +1 -0
- package/es/components/scale-view/src/hooks/scaleview-computed.d.ts +1 -0
- package/es/components/scale-view/src/hooks/scaleview-computed.js +1 -1
- package/es/components/scale-view/style/index.css +1 -1
- package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
- package/es/shared/assets/img/defaultCover/10review_successful.png.js +1 -1
- package/es/shared/assets/img/defaultCover/11review_fail.png.js +1 -1
- package/es/shared/assets/img/defaultCover/12no_setting.png.js +1 -1
- package/es/shared/assets/img/defaultCover/13no_menu_setting.png.js +1 -1
- package/es/shared/assets/img/defaultCover/14no_call_setting.png.js +1 -1
- package/es/shared/assets/img/defaultCover/15no_use_tag.png.js +1 -1
- package/es/shared/assets/img/defaultCover/16no_table_data.png.js +1 -1
- package/es/shared/assets/img/defaultCover/1location.png.js +1 -1
- package/es/shared/assets/img/defaultCover/2notfound.png.js +1 -1
- package/es/shared/assets/img/defaultCover/3loading.png.js +1 -1
- package/es/shared/assets/img/defaultCover/4no_permission.png.js +1 -1
- package/es/shared/assets/img/defaultCover/5no_data.png.js +1 -1
- package/es/shared/assets/img/defaultCover/6no_network.png.js +1 -1
- package/es/shared/assets/img/defaultCover/7no_doctor.png.js +1 -1
- package/es/shared/assets/img/defaultCover/8system_error.png.js +1 -1
- package/es/shared/assets/img/defaultCover/9system_upgrade.png.js +1 -1
- package/es/shared/assets/img/failure.png.js +1 -1
- package/es/shared/assets/img/no-permission.png.js +1 -1
- package/es/shared/assets/img/nodata.png.js +1 -1
- package/es/shared/assets/img/notfound.png.js +1 -1
- package/es/shared/assets/img/qr.png.js +1 -1
- package/es/shared/assets/img/success.png.js +1 -1
- package/es/shared/assets/img/table_style_2.png.js +1 -1
- package/es/shared/assets/img/video.png.js +1 -1
- package/es/shared/assets/img/video_default_cover.png.js +1 -1
- package/es/shared/assets/img/xb_big.png.js +1 -1
- package/es/shared/assets/img/xb_small.png.js +1 -1
- package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +86 -0
- package/es/shared/package.json.js +1 -1
- package/es/shared/utils/fabricjs/index.d.ts +6823 -0
- package/es/shared/utils/tapable/index.d.ts +139 -0
- package/package.json +2 -2
package/README.md
CHANGED
@@ -1,87 +1,87 @@
|
|
1
|
-
# 安装
|
2
|
-
|
3
|
-
```shell
|
4
|
-
npm i cnhis-design-vue@[版本号]
|
5
|
-
# or
|
6
|
-
yarn add cnhis-design-vue@[版本号] #推荐
|
7
|
-
```
|
8
|
-
|
9
|
-
## 1.全局引入
|
10
|
-
|
11
|
-
```typescript
|
12
|
-
// main.ts
|
13
|
-
import { createApp } from 'vue';
|
14
|
-
import App from './App.vue';
|
15
|
-
import 'cnhis-design-vue/es/packages/index.css';
|
16
|
-
import cui from 'cnhis-design-vue';
|
17
|
-
|
18
|
-
const app = createApp(App);
|
19
|
-
app.use(cui).mount('#app');
|
20
|
-
```
|
21
|
-
|
22
|
-
## 2. 按需引入
|
23
|
-
|
24
|
-
组件现在支持了自动按需引入, 但是样式文件需要额外的处理
|
25
|
-
|
26
|
-
### 2.1 样式处理方式1 (按需引入样式)
|
27
|
-
|
28
|
-
```shell
|
29
|
-
# 安装自动导入样式的插件
|
30
|
-
npm i -d vite-plugin-style-import
|
31
|
-
```
|
32
|
-
|
33
|
-
```typescript
|
34
|
-
// vite.config.ts
|
35
|
-
import { defineConfig } from 'vite';
|
36
|
-
import { createStyleImportPlugin } from 'vite-plugin-style-import';
|
37
|
-
|
38
|
-
export default defineConfig({
|
39
|
-
plugins: [
|
40
|
-
// ...otherPlugins
|
41
|
-
createStyleImportPlugin({
|
42
|
-
libs: [
|
43
|
-
{
|
44
|
-
libraryName: 'cnhis-design-vue',
|
45
|
-
esModule: true,
|
46
|
-
ensureStyleFile: true,
|
47
|
-
resolveStyle: name => {
|
48
|
-
return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
|
49
|
-
}
|
50
|
-
}
|
51
|
-
]
|
52
|
-
})
|
53
|
-
]
|
54
|
-
});
|
55
|
-
```
|
56
|
-
|
57
|
-
### 2.2 样式处理方式2 (全局引入样式)
|
58
|
-
|
59
|
-
```typescript
|
60
|
-
// main.ts
|
61
|
-
import 'cnhis-design-vue/es/components/index.css';
|
62
|
-
```
|
63
|
-
|
64
|
-
## 3.FAQ
|
65
|
-
|
66
|
-
### 3.1 项目打包后样式丢失
|
67
|
-
|
68
|
-
处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
|
69
|
-
|
70
|
-
```typescript
|
71
|
-
// vite.config.ts
|
72
|
-
import { defineConfig } from 'vite';
|
73
|
-
|
74
|
-
export default defineConfig({
|
75
|
-
build: {
|
76
|
-
rollupOptions: {
|
77
|
-
// ..otherOptions
|
78
|
-
output: {
|
79
|
-
dir: './dist',
|
80
|
-
manualChunks: {
|
81
|
-
'cnhis-vendor': ['cnhis-design-vue']
|
82
|
-
}
|
83
|
-
}
|
84
|
-
}
|
85
|
-
}
|
86
|
-
});
|
87
|
-
```
|
1
|
+
# 安装
|
2
|
+
|
3
|
+
```shell
|
4
|
+
npm i cnhis-design-vue@[版本号]
|
5
|
+
# or
|
6
|
+
yarn add cnhis-design-vue@[版本号] #推荐
|
7
|
+
```
|
8
|
+
|
9
|
+
## 1.全局引入
|
10
|
+
|
11
|
+
```typescript
|
12
|
+
// main.ts
|
13
|
+
import { createApp } from 'vue';
|
14
|
+
import App from './App.vue';
|
15
|
+
import 'cnhis-design-vue/es/packages/index.css';
|
16
|
+
import cui from 'cnhis-design-vue';
|
17
|
+
|
18
|
+
const app = createApp(App);
|
19
|
+
app.use(cui).mount('#app');
|
20
|
+
```
|
21
|
+
|
22
|
+
## 2. 按需引入
|
23
|
+
|
24
|
+
组件现在支持了自动按需引入, 但是样式文件需要额外的处理
|
25
|
+
|
26
|
+
### 2.1 样式处理方式1 (按需引入样式)
|
27
|
+
|
28
|
+
```shell
|
29
|
+
# 安装自动导入样式的插件
|
30
|
+
npm i -d vite-plugin-style-import
|
31
|
+
```
|
32
|
+
|
33
|
+
```typescript
|
34
|
+
// vite.config.ts
|
35
|
+
import { defineConfig } from 'vite';
|
36
|
+
import { createStyleImportPlugin } from 'vite-plugin-style-import';
|
37
|
+
|
38
|
+
export default defineConfig({
|
39
|
+
plugins: [
|
40
|
+
// ...otherPlugins
|
41
|
+
createStyleImportPlugin({
|
42
|
+
libs: [
|
43
|
+
{
|
44
|
+
libraryName: 'cnhis-design-vue',
|
45
|
+
esModule: true,
|
46
|
+
ensureStyleFile: true,
|
47
|
+
resolveStyle: name => {
|
48
|
+
return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
]
|
52
|
+
})
|
53
|
+
]
|
54
|
+
});
|
55
|
+
```
|
56
|
+
|
57
|
+
### 2.2 样式处理方式2 (全局引入样式)
|
58
|
+
|
59
|
+
```typescript
|
60
|
+
// main.ts
|
61
|
+
import 'cnhis-design-vue/es/components/index.css';
|
62
|
+
```
|
63
|
+
|
64
|
+
## 3.FAQ
|
65
|
+
|
66
|
+
### 3.1 项目打包后样式丢失
|
67
|
+
|
68
|
+
处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
|
69
|
+
|
70
|
+
```typescript
|
71
|
+
// vite.config.ts
|
72
|
+
import { defineConfig } from 'vite';
|
73
|
+
|
74
|
+
export default defineConfig({
|
75
|
+
build: {
|
76
|
+
rollupOptions: {
|
77
|
+
// ..otherOptions
|
78
|
+
output: {
|
79
|
+
dir: './dist',
|
80
|
+
manualChunks: {
|
81
|
+
'cnhis-vendor': ['cnhis-design-vue']
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
});
|
87
|
+
```
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
declare module 'bpmn-js/lib/Viewer';
|
@@ -0,0 +1 @@
|
|
1
|
+
declare module 'bpmn-js/lib/features/modeling';
|
@@ -0,0 +1 @@
|
|
1
|
+
declare module 'diagram-js/lib/navigation/movecanvas';
|
@@ -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
|
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};
|
@@ -115,11 +115,10 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
|
|
115
115
|
state: import("./src/types").IState;
|
116
116
|
emit: (event: string, ...args: any[]) => void;
|
117
117
|
openSession: (item: import("../../shared/types").AnyObject) => Promise<void>;
|
118
|
-
|
119
|
-
setSessionList: (list: import("../../shared/types").AnyObject[]) => void;
|
118
|
+
updateSessionList: (sessionItem: import("../../shared/types").AnyObject) => void;
|
120
119
|
currentWidth: import("vue").ComputedRef<number>;
|
121
120
|
sessionList: import("vue").ComputedRef<import("../../shared/types").AnyObject[]>;
|
122
|
-
|
121
|
+
unreadTotal: import("vue").ComputedRef<number>;
|
123
122
|
changeWidth: ({ distance }: import("../../shared/types").AnyObject) => void;
|
124
123
|
handleFilter: (key: string) => void;
|
125
124
|
showSession: (item: import("../../shared/types").AnyObject, currentKey?: string) => boolean | undefined;
|
@@ -120,11 +120,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
120
120
|
state: IState;
|
121
121
|
emit: (event: string, ...args: any[]) => void;
|
122
122
|
openSession: (item: AnyObject) => Promise<void>;
|
123
|
-
|
124
|
-
setSessionList: (list: AnyObject[]) => void;
|
123
|
+
updateSessionList: (sessionItem: AnyObject) => void;
|
125
124
|
currentWidth: import("vue").ComputedRef<number>;
|
126
125
|
sessionList: import("vue").ComputedRef<AnyObject[]>;
|
127
|
-
|
126
|
+
unreadTotal: import("vue").ComputedRef<number>;
|
128
127
|
changeWidth: ({ distance }: AnyObject) => void;
|
129
128
|
handleFilter: (key: string) => void;
|
130
129
|
showSession: (item: AnyObject, currentKey?: string) => boolean | undefined;
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as
|
1
|
+
import{defineComponent as e,ref as t,computed as o,openBlock as r,createElementBlock as i,Fragment as a,unref as s,createElementVNode as n,createVNode as l,withCtx as c,toDisplayString as u,createTextVNode as m,normalizeProps as h,guardReactiveProps as d,createCommentVNode as v}from"vue";import{NAvatar as p,NTooltip as f,NButton as g,NIcon as w}from"naive-ui";import{useState as _}from"../hooks/useState.js";import{useSession as b}from"../hooks/useSession.js";import"trtc-sdk-v5";import"date-fns";import"lodash-es";import"../utils/emoji.js";import y from"./PersonProfile.vue.js";import j from"./ChatSet.vue.js";import C from"./ChatFile.vue.js";import k from"./ChatRecord.vue.js";import z from"./ChatAdd.vue.js";import{PersonAddOutline as S}from"@vicons/ionicons5";const q={key:0,class:"chat-header box-shadow"},U={class:"chat-header__left"},I={class:"name"},G={class:"chat-header__right"},x=n("i",{class:"chat--iconfont chat--icon-image"},null,-1),P=n("i",{class:"chat--iconfont chat--icon-folder"},null,-1),A=n("i",{class:"chat--iconfont chat--icon-list-search"},null,-1),F=n("i",{class:"chat--iconfont chat--icon-set"},null,-1);var H=e({__name:"ChatHeader",setup(e){const{state:H}=_(),{isGroupChat:R}=b(H),V=t(!1),B=t(!1),D=t("image"),E=t(!1),J=o((()=>{const e=H.currentGroupUser.map((e=>e.id));return R.value?{mode:"join",disabledIds:e}:{mode:"create",defaultValue:H.currentGroupUser}}));function K(e){D.value=e,B.value=!0}return(e,t)=>(r(),i(a,null,[s(H).id?(r(),i("section",q,[n("div",U,[l(y,{"user-id":s(H).currentSessionItem.receiver,disabled:s(R),placement:"bottom"},{trigger:c((()=>[l(s(p),{round:"",size:30,src:s(H).currentSessionItem.avatar},null,8,["src"])])),_:1},8,["user-id","disabled"]),n("span",I,u(s(H).currentSessionItem.name),1)]),n("div",G,[l(s(f),{"show-arrow":!1,trigger:"hover",placement:"bottom"},{trigger:c((()=>[l(s(g),{quaternary:"",size:"tiny",onClick:t[0]||(t[0]=()=>K("image"))},{icon:c((()=>[x])),_:1})])),default:c((()=>[m(" 图片 ")])),_:1}),l(s(f),{"show-arrow":!1,trigger:"hover",placement:"bottom"},{trigger:c((()=>[l(s(g),{quaternary:"",size:"tiny",onClick:t[1]||(t[1]=()=>K("file"))},{icon:c((()=>[P])),_:1})])),default:c((()=>[m(" 文件 ")])),_:1}),l(z,h(d(s(J))),{trigger:c((()=>[l(s(f),{"show-arrow":!1,trigger:"hover",placement:"bottom"},{trigger:c((()=>[l(s(g),{quaternary:"",size:"tiny"},{icon:c((()=>[l(s(w),{size:"18",component:s(S)},null,8,["component"])])),_:1})])),default:c((()=>[m(" 添加成员 ")])),_:1})])),_:1},16),l(s(f),{"show-arrow":!1,trigger:"hover",placement:"bottom"},{trigger:c((()=>[l(s(g),{quaternary:"",size:"tiny",onClick:t[2]||(t[2]=()=>E.value=!0)},{icon:c((()=>[A])),_:1})])),default:c((()=>[m(" 聊天记录 ")])),_:1}),l(s(f),{"show-arrow":!1,trigger:"hover",placement:"bottom"},{trigger:c((()=>[l(s(g),{quaternary:"",size:"tiny",onClick:t[3]||(t[3]=()=>V.value=!0)},{icon:c((()=>[F])),_:1})])),default:c((()=>[m(" 聊天设置 ")])),_:1})])])):v("v-if",!0),l(j,{show:V.value,"onUpdate:show":t[4]||(t[4]=e=>V.value=e)},null,8,["show"]),l(C,{show:B.value,"onUpdate:show":t[5]||(t[5]=e=>B.value=e),type:D.value,visible:B.value},null,8,["show","type","visible"]),l(k,{show:E.value,"onUpdate:show":t[6]||(t[6]=e=>E.value=e),visible:E.value},null,8,["show","visible"])],64))}});export{H as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,useAttrs as s,openBlock as t,createBlock as o,unref as i,withCtx as r,createVNode as n,createElementVNode as a,toDisplayString as m}from"vue";import{NDrawer as c,NDrawerContent as l,NAvatar as p,NIcon as u,NSwitch as d}from"naive-ui";import{ChevronForwardOutline as f}from"@vicons/ionicons5";import{useState as h}from"../hooks/useState.js";import{useSession as v}from"../hooks/useSession.js";import"trtc-sdk-v5";import"date-fns";import{isFunction as S}from"lodash-es";import"../utils/emoji.js";import g from"./PersonProfile.vue.js";import{toppingSessionApi as _}from"../api/index.js";const I={class:"chat-set-wrapper"},j={class:"item user-info"},
|
1
|
+
import{defineComponent as e,useAttrs as s,openBlock as t,createBlock as o,unref as i,withCtx as r,createVNode as n,createElementVNode as a,toDisplayString as m}from"vue";import{NDrawer as c,NDrawerContent as l,NAvatar as p,NIcon as u,NSwitch as d}from"naive-ui";import{ChevronForwardOutline as f}from"@vicons/ionicons5";import{useState as h}from"../hooks/useState.js";import{useSession as v}from"../hooks/useSession.js";import"trtc-sdk-v5";import"date-fns";import{isFunction as S}from"lodash-es";import"../utils/emoji.js";import g from"./PersonProfile.vue.js";import{toppingSessionApi as _}from"../api/index.js";const I={class:"chat-set-wrapper"},j={class:"item user-info"},b={class:"name"},w={class:"item"},k=a("span",{class:"label"},"置顶聊天",-1);var y=e({__name:"ChatSet",setup(e){const y=s(),{state:C}=h(),{setCurrentSessionItem:U,isGroupChat:x}=v(C);async function z(e){try{await _({sessionKey:C.currentSessionItem.sessionKey,id:C.currentSessionItem.id,topping:e}),U({topping:e})}catch(e){console.log(e)}}function K(){S(y["onUpdate:show"])&&y["onUpdate:show"](!1)}return(e,s)=>(t(),o(i(c),{width:320,"trap-focus":!1,"block-scroll":!1,to:".iho-chat"},{default:r((()=>[n(i(l),{title:"聊天设置"},{default:r((()=>[a("div",I,[n(g,{"user-id":i(C).currentSessionItem.receiver,onClose:K,disabled:!!i(x),placement:"bottom-end"},{trigger:r((()=>[a("div",j,[n(i(p),{round:"",size:40,src:i(C).currentSessionItem.avatar},null,8,["src"]),a("span",b,m(i(C).currentSessionItem.name),1),n(i(u),{size:24,component:i(f),class:"item__right"},null,8,["component"])])])),_:1},8,["user-id","disabled"]),a("div",w,[k,n(i(d),{value:i(C).currentSessionItem.topping,"onUpdate:value":[s[0]||(s[0]=e=>i(C).currentSessionItem.topping=e),z],class:"item__right"},null,8,["value"])])])])),_:1})])),_:1}))}});export{y as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as a,reactive as l,computed as o,openBlock as
|
1
|
+
import{defineComponent as e,ref as a,reactive as l,computed as o,openBlock as s,createBlock as n,unref as i,createSlots as t,withCtx as r,createElementBlock as c,Fragment as u,withDirectives as d,createElementVNode as p,createVNode as m,vShow as v,toDisplayString as f,createTextVNode as y,renderList as k,createCommentVNode as h,renderSlot as g}from"vue";import{NPopover as b,NAvatar as _,NUpload as w,NUploadTrigger as C,NButton as I,NIcon as j}from"naive-ui";import{Camera as z,ChatbubbleEllipses as x,EyeOffOutline as N,EyeOutline as S,Close as $}from"@vicons/ionicons5";import{useState as D}from"../hooks/useState.js";import{useSession as P}from"../hooks/useSession.js";import"trtc-sdk-v5";import"date-fns";import"lodash-es";import"../utils/emoji.js";import{openSessionApi as T,getUserDetailApi as q,uploadFileApi as B}from"../api/index.js";const E={class:"person-profile-main"},F={class:"left"},O={class:"profile"},U={class:"profile__text"},A={class:"right"},G={class:"right__content"},H={class:"label"},J={class:"content"};var K=e({__name:"PersonProfile",props:{userId:{type:String,required:!0},disabled:{type:Boolean,default:!1}},emits:["close"],setup(e,{emit:K}){const L=e,{state:M}=D(),{openSession:Q}=P(M),R=a(!1),V=a(!1),W=a(!1),X=l({}),Y=[{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"}],Z=o((()=>(X.id&&Y.forEach((e=>{const{key:a}=e;e.value=X[a]})),Y)));async function ee(){R.value=!1;const e=await T({chatType:M.currentSessionItem.chatType,receiver:L.userId,sender:M.userInfo.id});Q(e),K("close")}async function ae(e){if(!e)return;const a=await q({userId:L.userId});(null==a?void 0:a.id)?Object.assign(X,a):X.id=""}function le(e){const{key:a,value:l}=e;return"phone"!==a||W.value?l:(l||"").replace(/(\d{3})\d{4}(\d{4})/,"$1****$2")}async function oe(e){const{file:a,name:l}=e.file,o=new FormData;o.append("sender",M.userInfo.id),o.append("file",a);const s=await B(o);if(X.avatar=s,!s)return console.log("上传失败")}return(a,l)=>(s(),n(i(b),{raw:"",class:"person-profile-wrapper",show:R.value,"onUpdate:show":[l[3]||(l[3]=e=>R.value=e),ae],trigger:e.disabled?"manual":"click","show-arrow":!1,shift:""},t({default:r((()=>[X.id?(s(),c(u,{key:0},[d(p("div",E,[p("div",F,[p("div",O,[m(i(_),{src:X.avatar,bordered:"",round:"",size:100,onClickCapture:l[0]||(l[0]=e=>V.value=!0)},null,8,["src"]),m(i(w),{abstract:"",accept:"image/*",onChange:oe},{default:r((()=>[m(i(C),{abstract:""},{default:r((({handleClick:e})=>[d(m(i(I),{circle:"",secondary:"",class:"edit-avatar",onClick:e},{icon:r((()=>[m(i(j),{size:"16",color:"#666666",component:i(z)},null,8,["component"])])),_:2},1032,["onClick"]),[[v,X.id===i(M).userInfo.id]])])),_:1})])),_:1}),p("div",U,[p("h4",null,f(X.name),1),p("p",null,f(X.orgName),1)]),m(i(I),{strong:"",secondary:"",onClick:ee},{default:r((()=>[m(i(j),{size:"13",color:"#666666",component:i(x),style:{"margin-right":"6px"}},null,8,["component"]),y(" 发消息 ")])),_:1})])]),p("div",A,[p("div",G,[(s(!0),c(u,null,k(i(Z),((e,a)=>(s(),c("div",{class:"info-item",key:a},[p("span",H,f(e.label),1),p("div",J,[p("span",null,f(le(e)),1),"phone"===e.key&&le(e)?(s(),n(i(j),{key:0,size:"16",color:"#666666",component:W.value?i(N):i(S),style:{"margin-left":"10px"},onClick:l[1]||(l[1]=e=>W.value=!W.value)},null,8,["component"])):h("v-if",!0)])])))),128))])])],512),[[v,!V.value]]),d(p("div",{class:"large-avatar",onClick:l[2]||(l[2]=e=>V.value=!1)},[m(i(I),{circle:"",size:"small",secondary:""},{icon:r((()=>[m(i(j),{size:24,component:i($),color:"#fff"},null,8,["component"])])),_:1}),m(i(_),{size:310,round:"",src:X.avatar},null,8,["src"])],512),[[v,V.value]])],64)):h("v-if",!0)])),_:2},[k(a.$slots,((e,l)=>({name:l,fn:r((()=>[g(a.$slots,l)]))})))]),1032,["show","trigger"]))}});export{K as default};
|
@@ -17,11 +17,10 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
17
17
|
state: import("../types").IState;
|
18
18
|
emit: (event: string, ...args: any[]) => void;
|
19
19
|
openSession: (item: AnyObject) => Promise<void>;
|
20
|
-
|
21
|
-
setSessionList: (list: AnyObject[]) => void;
|
20
|
+
updateSessionList: (sessionItem: AnyObject) => void;
|
22
21
|
currentWidth: import("vue").ComputedRef<number>;
|
23
22
|
sessionList: import("vue").ComputedRef<AnyObject[]>;
|
24
|
-
|
23
|
+
unreadTotal: import("vue").ComputedRef<number>;
|
25
24
|
changeWidth: ({ distance }: AnyObject) => void;
|
26
25
|
handleFilter: (key: string) => void;
|
27
26
|
showSession: (item: AnyObject, currentKey?: string) => boolean | undefined;
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as s,computed as i,watch as
|
1
|
+
import{defineComponent as e,ref as s,computed as i,watch as t,withDirectives as a,openBlock as l,createElementBlock as n,normalizeStyle as r,unref as o,createBlock as u,createCommentVNode as d,createElementVNode as m,Fragment as v,renderList as c,withCtx as p,createTextVNode as f,toDisplayString as k,normalizeClass as _,createVNode as y,vShow as h}from"vue";import{NSpin as S,NTag as g,NAvatar as x,NBadge as b}from"naive-ui";import{useState as M}from"../hooks/useState.js";import{useSession as C}from"../hooks/useSession.js";import"trtc-sdk-v5";import{listSort as L,formatTime as N}from"../utils/index.js";import{vFlexibleResize as j}from"../../../../shared/directive/flexibleResize.js";const T={class:"sider-list__filter box-shadow"},w=["onClick"],R={class:"avatar-right"},z={class:"name"},H={class:"msg-tip"},I={class:"msg-tip__content"},K=["innerHTML"];var U=e({__name:"SiderList",setup(e){const U="all",B="unread";let V=[];const q=s(300),A=s(),D=s(!1),E=s([{label:"全部",key:U},{label:"未读",key:B}]),F=s("all"),{state:G,emit:J}=M(),{openSession:O,updateSessionList:P}=C(G),Q=i((()=>Math.min(Math.max(q.value,240),360))),W=i((()=>L(G.sessionList))),X=i((()=>G.sessionList.reduce(((e,s)=>e+ +s.unreadNum),0)));function Y({distance:e}){q.value=q.value+e}function Z(e,s=o(F)){var i;return s===U||(s===B?V.includes(e.sessionKey)||(null!=(i=e.unreadNum)?i:0)>0:void 0)}return t([()=>G.isChangeSession,()=>G.isUpdateSession],(([e,s])=>{e&&(P(G.currentSessionItem),G.isChangeSession=!1),s&&(P(G.updateSessionItem),G.isUpdateSession=!1)}),{immediate:!0}),t((()=>X.value),(e=>{const s=W.value.filter((e=>{var s;return+(null!=(s=e.unreadNum)?s:0)>0}));J("unread-message-update",e,s)})),(e,s)=>a((l(),n("section",{class:"sider-list",style:r({width:o(Q)+"px"})},[D.value?(l(),u(o(S),{key:0,stroke:"#5585f5"})):d("v-if",!0),d(' <n-input v-else placeholder="输入用户名模糊搜索" v-model:value="keyword" @keyup.enter="handleSearch"></n-input> '),m("div",T,[(l(!0),n(v,null,c(E.value,(e=>(l(),u(o(g),{type:F.value===e.key?"info":"default",round:"",bordered:!1,key:e.key,onClick:()=>{return s=e.key,F.value=s,void(s===B&&(V=(W.value.filter((e=>{var s;return(null!=(s=e.unreadNum)?s:0)>0}))||[]).map((e=>e.sessionKey))));var s}},{default:p((()=>[f(k(e.label)+"("+k(o(X))+") ",1)])),_:2},1032,["type","onClick"])))),128))]),m("div",{class:"sider-list__box",ref_key:"listBoxRef",ref:A},[(l(!0),n(v,null,c(o(W),(e=>a((l(),n("div",{key:e.id,onClick:()=>o(O)(e),class:_(["sider-list__box__item",{active:e.id===o(G).id},e.topping?"sider-list__box__item--top":""])},[y(o(x),{round:"",size:"large",src:e.avatar},null,8,["src"]),m("div",R,[m("div",z,[m("h4",null,k(e.name),1),m("span",null,k(e.lastMessage?o(N)(e.lastMessageSendTime).siderMsgTime:""),1)]),m("div",H,[m("div",I,[m("div",{innerHTML:e.lastMessageContent},null,8,K)]),y(o(b),{value:e.unreadNum>99?"99+":e.unreadNum},null,8,["value"])])])],10,w)),[[h,Z(e)]]))),128))],512)],4)),[[o(j),{mode:"VR",onMove:Y}]])}});export{U as default};
|
@@ -6,7 +6,7 @@ export declare function useSession(state: IState): {
|
|
6
6
|
getCurrentSession: () => AnyObject | null;
|
7
7
|
setCurrentSessionItem: (item: AnyObject) => void;
|
8
8
|
setUpdateSessionItem: (item: AnyObject) => void;
|
9
|
-
unreadTotal: import("vue").ComputedRef<number>;
|
10
9
|
setSessionList: (list: AnyObject[]) => void;
|
11
10
|
isGroupChat: import("vue").ComputedRef<boolean>;
|
11
|
+
updateSessionList: (sessionItem: AnyObject) => void;
|
12
12
|
};
|
@@ -1 +1 @@
|
|
1
|
-
import{computed as e}from"vue";import{simplifyMessage as s}from"../utils/index.js";import{cloneDeep as
|
1
|
+
import{computed as e}from"vue";import{simplifyMessage as s}from"../utils/index.js";import{cloneDeep as n,isArray as t,uniqBy as i}from"lodash-es";import{CHAT_TYPE as o}from"../constants/index.js";import{groupUserApi as r}from"../api/index.js";function a(e){return e.chatType===o.GROUP}function c(e){const{lastMessage:n,lastSenderName:t=""}=e,i=s(n)||"";return a(e)&&t?t+": "+i:i}function u(s){const u=e((()=>a(s.currentSessionItem)));function m(e){Object.assign(s.currentSessionItem,e,{lastMessageContent:Reflect.has(e,"lastMessageContent")?e.lastMessageContent:Reflect.has(e,"lastMessage")?c({...e,chatType:e.chatType||s.currentSessionItem.chatType}):s.currentSessionItem.lastMessageContent}),s.isChangeSession=!0,s.id!==s.currentSessionItem.id&&(s.msgList=[],s.id=s.currentSessionItem.id)}function d(e){s.sessionList=n(i(e,"id")),s.sessionList.forEach((e=>{Object.assign(e,{lastMessageContent:Reflect.has(e,"lastMessageContent")?e.lastMessageContent:c(e)}),e.receiver===s.userInfo.id&&(e.unreadNum=0),e.chatType!==o.GROUP||e.name||r({id:e.receiver}).then((s=>{t(s)&&(e.name=s.map((e=>e.name)).join(","))}))}))}return{openSession:async function(e){const i=s.currentSessionItem.sessionKey;if(m(e),i!==s.currentSessionItem.sessionKey)if(u.value){const n=await r({id:e.receiver});s.currentGroupUser=t(n)?n:[]}else s.currentGroupUser=[s.userInfo,{...n(e),id:e.receiver}]},closeSession:function(){if(!s.id)return null;const{currentSessionItem:e}=s;return s.currentSessionItem={},s.msgList=[],s.id="",e},getCurrentSession:function(){return s.id?s.currentSessionItem:null},setCurrentSessionItem:m,setUpdateSessionItem:function(e){const t=s.sessionList.find((s=>s.sessionKey===e.sessionKey)),i={...e,lastMessageContent:c({...e,chatType:e.chatType||(null==t?void 0:t.chatType)})};s.updateSessionItem=t?{...n(t),...i}:i,s.isUpdateSession=!0},setSessionList:d,isGroupChat:u,updateSessionList:function(e){!e.id||s.sessionList.map((e=>e.id)).includes(e.id)?s.sessionList.some((n=>{if(n.sessionKey===e.sessionKey){let{unreadNum:t=0}=n;return Object.assign(n,e),e.sessionKey!==s.currentSessionItem.sessionKey&&(n.unreadNum=++t),!0}})):d([...s.sessionList,e])}}}export{u as useSession};
|