cnhis-design-vue 3.1.42-beta.62 → 3.1.42-beta.64

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.
@@ -0,0 +1,77 @@
1
+ export const __esModule: true;
2
+ export const LEVEL_SEARCH_CASCADER: vue_2.DefineComponent<{
3
+ options: {
4
+ type: ArrayConstructor;
5
+ default: () => never[];
6
+ };
7
+ labelField: {
8
+ type: StringConstructor;
9
+ default: string;
10
+ };
11
+ valueField: {
12
+ type: StringConstructor;
13
+ default: string;
14
+ };
15
+ autograph: {
16
+ type: StringConstructor;
17
+ required: true;
18
+ };
19
+ lazyRequest: {
20
+ type: BooleanConstructor;
21
+ default: boolean;
22
+ };
23
+ requestCache: {
24
+ type: BooleanConstructor;
25
+ default: boolean;
26
+ };
27
+ wordbook: {
28
+ type: ObjectConstructor;
29
+ required: true;
30
+ };
31
+ onChange: {};
32
+ value: {
33
+ type: (ArrayConstructor | StringConstructor)[];
34
+ };
35
+ }, () => any, any, {}, {}, vue_2.ComponentOptionsMixin, vue_2.ComponentOptionsMixin, "update:value"[], "update:value", vue_2.VNodeProps & vue_2.AllowedComponentProps & vue_2.ComponentCustomProps, Readonly<vue_2.ExtractPropTypes<{
36
+ options: {
37
+ type: ArrayConstructor;
38
+ default: () => never[];
39
+ };
40
+ labelField: {
41
+ type: StringConstructor;
42
+ default: string;
43
+ };
44
+ valueField: {
45
+ type: StringConstructor;
46
+ default: string;
47
+ };
48
+ autograph: {
49
+ type: StringConstructor;
50
+ required: true;
51
+ };
52
+ lazyRequest: {
53
+ type: BooleanConstructor;
54
+ default: boolean;
55
+ };
56
+ requestCache: {
57
+ type: BooleanConstructor;
58
+ default: boolean;
59
+ };
60
+ wordbook: {
61
+ type: ObjectConstructor;
62
+ required: true;
63
+ };
64
+ onChange: {};
65
+ value: {
66
+ type: (ArrayConstructor | StringConstructor)[];
67
+ };
68
+ }>> & {
69
+ "onUpdate:value"?: ((...args: any[]) => any) | undefined;
70
+ }, {
71
+ options: unknown[];
72
+ labelField: string;
73
+ valueField: string;
74
+ lazyRequest: boolean;
75
+ requestCache: boolean;
76
+ }>;
77
+ import vue_2 = require("vue");
@@ -0,0 +1,84 @@
1
+ export const __esModule: true;
2
+ export const SEARCH_CASCADER: vue_2.DefineComponent<{
3
+ options: {
4
+ type: ArrayConstructor;
5
+ default: () => never[];
6
+ };
7
+ depth: {
8
+ type: (NumberConstructor | StringConstructor)[];
9
+ };
10
+ urlConfig: {
11
+ type: ObjectConstructor;
12
+ };
13
+ requestCache: {
14
+ type: BooleanConstructor;
15
+ default: boolean;
16
+ };
17
+ onFocus: {
18
+ type: FunctionConstructor;
19
+ };
20
+ filterable: {
21
+ type: BooleanConstructor;
22
+ default: boolean;
23
+ };
24
+ checkStrategy: {
25
+ type: StringConstructor;
26
+ default: string;
27
+ };
28
+ labelField: {
29
+ type: StringConstructor;
30
+ default: string;
31
+ };
32
+ valueField: {
33
+ type: StringConstructor;
34
+ default: string;
35
+ };
36
+ onChange: {};
37
+ value: {};
38
+ }, () => any, any, {}, {}, vue_2.ComponentOptionsMixin, vue_2.ComponentOptionsMixin, "update:value"[], "update:value", vue_2.VNodeProps & vue_2.AllowedComponentProps & vue_2.ComponentCustomProps, Readonly<vue_2.ExtractPropTypes<{
39
+ options: {
40
+ type: ArrayConstructor;
41
+ default: () => never[];
42
+ };
43
+ depth: {
44
+ type: (NumberConstructor | StringConstructor)[];
45
+ };
46
+ urlConfig: {
47
+ type: ObjectConstructor;
48
+ };
49
+ requestCache: {
50
+ type: BooleanConstructor;
51
+ default: boolean;
52
+ };
53
+ onFocus: {
54
+ type: FunctionConstructor;
55
+ };
56
+ filterable: {
57
+ type: BooleanConstructor;
58
+ default: boolean;
59
+ };
60
+ checkStrategy: {
61
+ type: StringConstructor;
62
+ default: string;
63
+ };
64
+ labelField: {
65
+ type: StringConstructor;
66
+ default: string;
67
+ };
68
+ valueField: {
69
+ type: StringConstructor;
70
+ default: string;
71
+ };
72
+ onChange: {};
73
+ value: {};
74
+ }>> & {
75
+ "onUpdate:value"?: ((...args: any[]) => any) | undefined;
76
+ }, {
77
+ options: unknown[];
78
+ labelField: string;
79
+ valueField: string;
80
+ requestCache: boolean;
81
+ filterable: boolean;
82
+ checkStrategy: string;
83
+ }>;
84
+ import vue_2 = require("vue");
@@ -0,0 +1,3 @@
1
+ export const __esModule: true;
2
+ export function highLightSetPlugin(): iho_table_1.TablePlugin;
3
+ import iho_table_1 = require("../../../../../../es/components/iho-table");
@@ -0,0 +1,3 @@
1
+ export const __esModule: true;
2
+ export function filterRenderPlugin(): iho_table_1.TablePlugin;
3
+ import iho_table_1 = require("../../../../../../../es/components/iho-table");
@@ -0,0 +1,3 @@
1
+ export const __esModule: true;
2
+ export function defaultRendererPlugin(): iho_table_1.TablePlugin;
3
+ import iho_table_1 = require("../../../../../../../../es/components/iho-table");
@@ -0,0 +1,3 @@
1
+ export const __esModule: true;
2
+ export function seqRendererPlugin(): iho_table_1.TablePlugin;
3
+ import iho_table_1 = require("../../../../../../../../es/components/iho-table");
@@ -0,0 +1,36 @@
1
+ export const __esModule: true;
2
+ declare const _default: vue_1.DefineComponent<{
3
+ form: {
4
+ type: ObjectConstructor;
5
+ default: () => void;
6
+ };
7
+ item: {
8
+ type: ObjectConstructor;
9
+ default: () => void;
10
+ };
11
+ isLock: {
12
+ type: BooleanConstructor;
13
+ default: boolean;
14
+ };
15
+ }, () => any, any, {}, {}, vue_1.ComponentOptionsMixin, vue_1.ComponentOptionsMixin, "scaleChange"[], "scaleChange", vue_1.VNodeProps & vue_1.AllowedComponentProps & vue_1.ComponentCustomProps, Readonly<vue_1.ExtractPropTypes<{
16
+ form: {
17
+ type: ObjectConstructor;
18
+ default: () => void;
19
+ };
20
+ item: {
21
+ type: ObjectConstructor;
22
+ default: () => void;
23
+ };
24
+ isLock: {
25
+ type: BooleanConstructor;
26
+ default: boolean;
27
+ };
28
+ }>> & {
29
+ onScaleChange?: ((...args: any[]) => any) | undefined;
30
+ }, {
31
+ item: Record<string, any>;
32
+ isLock: boolean;
33
+ form: Record<string, any>;
34
+ }>;
35
+ export default _default;
36
+ import vue_1 = require("vue");
@@ -0,0 +1,36 @@
1
+ export const __esModule: true;
2
+ declare const _default: vue_1.DefineComponent<{
3
+ form: {
4
+ type: ObjectConstructor;
5
+ default: () => {};
6
+ };
7
+ item: {
8
+ type: ObjectConstructor;
9
+ default: () => {};
10
+ };
11
+ isLock: {
12
+ type: BooleanConstructor;
13
+ default: boolean;
14
+ };
15
+ }, () => any, any, {}, {}, vue_1.ComponentOptionsMixin, vue_1.ComponentOptionsMixin, "scaleChange"[], "scaleChange", vue_1.VNodeProps & vue_1.AllowedComponentProps & vue_1.ComponentCustomProps, Readonly<vue_1.ExtractPropTypes<{
16
+ form: {
17
+ type: ObjectConstructor;
18
+ default: () => {};
19
+ };
20
+ item: {
21
+ type: ObjectConstructor;
22
+ default: () => {};
23
+ };
24
+ isLock: {
25
+ type: BooleanConstructor;
26
+ default: boolean;
27
+ };
28
+ }>> & {
29
+ onScaleChange?: ((...args: any[]) => any) | undefined;
30
+ }, {
31
+ item: Record<string, any>;
32
+ isLock: boolean;
33
+ form: Record<string, any>;
34
+ }>;
35
+ export default _default;
36
+ import vue_1 = require("vue");
@@ -0,0 +1,82 @@
1
+ export const __esModule: true;
2
+ declare const _default: vue_1.DefineComponent<{
3
+ title: {
4
+ type: (StringConstructor | FunctionConstructor)[];
5
+ default: string;
6
+ };
7
+ changeSize: {
8
+ type: BooleanConstructor;
9
+ default: boolean;
10
+ };
11
+ closable: {
12
+ type: BooleanConstructor;
13
+ default: boolean;
14
+ };
15
+ modalWidth: {
16
+ type: StringConstructor;
17
+ default: string;
18
+ };
19
+ modalHeight: {
20
+ type: StringConstructor;
21
+ default: string;
22
+ };
23
+ handleOk: {
24
+ type: FunctionConstructor;
25
+ default: () => {};
26
+ };
27
+ cancel: {
28
+ type: FunctionConstructor;
29
+ default: () => {};
30
+ };
31
+ visible: {
32
+ type: BooleanConstructor;
33
+ default: boolean;
34
+ };
35
+ }, () => any, any, {}, {}, vue_1.ComponentOptionsMixin, vue_1.ComponentOptionsMixin, ("update:visible" | "onClose")[], "onClose" | "update:visible", vue_1.VNodeProps & vue_1.AllowedComponentProps & vue_1.ComponentCustomProps, Readonly<vue_1.ExtractPropTypes<{
36
+ title: {
37
+ type: (StringConstructor | FunctionConstructor)[];
38
+ default: string;
39
+ };
40
+ changeSize: {
41
+ type: BooleanConstructor;
42
+ default: boolean;
43
+ };
44
+ closable: {
45
+ type: BooleanConstructor;
46
+ default: boolean;
47
+ };
48
+ modalWidth: {
49
+ type: StringConstructor;
50
+ default: string;
51
+ };
52
+ modalHeight: {
53
+ type: StringConstructor;
54
+ default: string;
55
+ };
56
+ handleOk: {
57
+ type: FunctionConstructor;
58
+ default: () => {};
59
+ };
60
+ cancel: {
61
+ type: FunctionConstructor;
62
+ default: () => {};
63
+ };
64
+ visible: {
65
+ type: BooleanConstructor;
66
+ default: boolean;
67
+ };
68
+ }>> & {
69
+ "onUpdate:visible"?: ((...args: any[]) => any) | undefined;
70
+ onOnClose?: ((...args: any[]) => any) | undefined;
71
+ }, {
72
+ closable: boolean;
73
+ title: string | Function;
74
+ visible: boolean;
75
+ modalWidth: string;
76
+ modalHeight: string;
77
+ handleOk: Function;
78
+ changeSize: boolean;
79
+ cancel: Function;
80
+ }>;
81
+ export default _default;
82
+ import vue_1 = require("vue");
@@ -0,0 +1,57 @@
1
+ export const __esModule: true;
2
+ export const SearchMenu: vue_1.DefineComponent<{
3
+ childKey: {
4
+ type: StringConstructor;
5
+ default: string;
6
+ };
7
+ options: {
8
+ type: ArrayConstructor;
9
+ default: () => never[];
10
+ };
11
+ labelKey: {
12
+ type: StringConstructor;
13
+ default: string;
14
+ };
15
+ valueKey: {
16
+ type: StringConstructor;
17
+ default: string;
18
+ };
19
+ currentNode: {
20
+ type: ObjectConstructor;
21
+ };
22
+ cursorNode: {
23
+ type: ObjectConstructor;
24
+ };
25
+ }, () => any, any, {}, {}, vue_1.ComponentOptionsMixin, vue_1.ComponentOptionsMixin, ("nodeClick" | "changeCursor")[], "nodeClick" | "changeCursor", vue_1.VNodeProps & vue_1.AllowedComponentProps & vue_1.ComponentCustomProps, Readonly<vue_1.ExtractPropTypes<{
26
+ childKey: {
27
+ type: StringConstructor;
28
+ default: string;
29
+ };
30
+ options: {
31
+ type: ArrayConstructor;
32
+ default: () => never[];
33
+ };
34
+ labelKey: {
35
+ type: StringConstructor;
36
+ default: string;
37
+ };
38
+ valueKey: {
39
+ type: StringConstructor;
40
+ default: string;
41
+ };
42
+ currentNode: {
43
+ type: ObjectConstructor;
44
+ };
45
+ cursorNode: {
46
+ type: ObjectConstructor;
47
+ };
48
+ }>> & {
49
+ onNodeClick?: ((...args: any[]) => any) | undefined;
50
+ onChangeCursor?: ((...args: any[]) => any) | undefined;
51
+ }, {
52
+ options: unknown[];
53
+ valueKey: string;
54
+ childKey: string;
55
+ labelKey: string;
56
+ }>;
57
+ import vue_1 = require("vue");
@@ -0,0 +1,57 @@
1
+ export const __esModule: true;
2
+ export const SearchMenu: vue_1.DefineComponent<{
3
+ childKey: {
4
+ type: StringConstructor;
5
+ default: string;
6
+ };
7
+ options: {
8
+ type: ArrayConstructor;
9
+ default: () => never[];
10
+ };
11
+ labelKey: {
12
+ type: StringConstructor;
13
+ default: string;
14
+ };
15
+ valueKey: {
16
+ type: StringConstructor;
17
+ default: string;
18
+ };
19
+ currentNode: {
20
+ type: ObjectConstructor;
21
+ };
22
+ cursorNode: {
23
+ type: ObjectConstructor;
24
+ };
25
+ }, () => any, any, {}, {}, vue_1.ComponentOptionsMixin, vue_1.ComponentOptionsMixin, ("nodeClick" | "changeCursor")[], "nodeClick" | "changeCursor", vue_1.VNodeProps & vue_1.AllowedComponentProps & vue_1.ComponentCustomProps, Readonly<vue_1.ExtractPropTypes<{
26
+ childKey: {
27
+ type: StringConstructor;
28
+ default: string;
29
+ };
30
+ options: {
31
+ type: ArrayConstructor;
32
+ default: () => never[];
33
+ };
34
+ labelKey: {
35
+ type: StringConstructor;
36
+ default: string;
37
+ };
38
+ valueKey: {
39
+ type: StringConstructor;
40
+ default: string;
41
+ };
42
+ currentNode: {
43
+ type: ObjectConstructor;
44
+ };
45
+ cursorNode: {
46
+ type: ObjectConstructor;
47
+ };
48
+ }>> & {
49
+ onNodeClick?: ((...args: any[]) => any) | undefined;
50
+ onChangeCursor?: ((...args: any[]) => any) | undefined;
51
+ }, {
52
+ options: unknown[];
53
+ valueKey: string;
54
+ childKey: string;
55
+ labelKey: string;
56
+ }>;
57
+ import vue_1 = require("vue");
@@ -153,6 +153,11 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
153
153
  key: string | number;
154
154
  name: string;
155
155
  }[]>;
156
+ initTagData: import("vue").Ref<{
157
+ [x: string]: any;
158
+ key: string | number;
159
+ name: string;
160
+ }[]>;
156
161
  isSearch: import("vue").Ref<boolean>;
157
162
  temp: import("naive-ui").TreeOption[];
158
163
  allCheckedKeys: (string | number)[];
@@ -141,6 +141,11 @@ declare const _default: import("vue").DefineComponent<{
141
141
  key: IKey;
142
142
  name: string;
143
143
  }[]>;
144
+ initTagData: import("vue").Ref<{
145
+ [x: string]: any;
146
+ key: IKey;
147
+ name: string;
148
+ }[]>;
144
149
  isSearch: import("vue").Ref<boolean>;
145
150
  temp: TreeOption[];
146
151
  allCheckedKeys: IKey[];
@@ -1 +1 @@
1
- import{defineComponent as e,ref as l,computed as t,watch as a,openBlock as n,createBlock as u,unref as o,withCtx as i,createVNode as r,withKeys as c,createTextVNode as d,toDisplayString as s,withDirectives as h,vShow as v,createCommentVNode as p,mergeProps as f,createElementBlock as y,createElementVNode as k,Fragment as m,renderList as g}from"vue";import{NGrid as b,NGi as _,NSpace as w,NInputGroup as C,NInput as x,NButton as L,NCheckbox as j,NTree as T,NIcon as $,NTooltip as S}from"naive-ui";import{CloseCircleSharp as q}from"@vicons/ionicons5";import{filterTree as B,getExpandedKeys as D}from"./utils/index.js";import{cloneDeep as P}from"lodash-es";const U={key:0},N={class:"c-select-person__scroll",style:{height:"342px"}};var K=e({__name:"SelectPerson",props:{defaultList:{type:Array,default:()=>[]},data:{type:Array,default:()=>[]},searchPlaceholder:{type:String,default:"输入关键字搜索"},searchButtonText:{type:String,default:"搜索"},wordbook:{type:Object,default:()=>({})},wordbookChild:{type:Object,default:()=>({})},showCount:{type:Boolean,default:!0},showClear:{type:Boolean,default:!0},multiple:{type:Boolean,default:!0},treeSetting:{type:Object,default:()=>({})},queryLoadChildData:{type:Function,default:void 0},queryTreeSearch:{type:Function,default:()=>Promise.resolve([])}},emits:["check","checkWithLevel"],setup(e,{emit:K}){const O=e,A=l(""),E=l(!1),F=l([]),I=l([]),W=l([]),R=l([]),z=l(!0),G=P(function e(l,t){return l&&0!==l.length?l.map((l=>{var a;const n=X(l),u=t?`${n}/${t}`:n;return{...l,tempTitle:t,children:(null==(a=l.children)?void 0:a.length)?e(null==l?void 0:l.children,u):[]}})):[]}(O.data,""));let H=[];const J=t((()=>!!O.queryLoadChildData));async function M(e){if(O.queryLoadChildData){const l=await O.queryLoadChildData(e);return l.children&&(l.children=l.children.map((e=>({...e,tempTitle:l.tempTitle?`${l.title}/${l.tempTitle}`:l.title})))),l}return e}function Q(e){var l;(null==(l=e.children)?void 0:l.every((e=>e.disabled)))&&(e.disabled=!0)}function V({option:e}){var l;if((null==(l=e.children)?void 0:l.length)||J.value&&!(null==e?void 0:e.isLeaf)){const l=O.wordbook.user_count_obj&&e[O.wordbook.user_count_obj]||"",t=l?`(${l})`:"";return r("span",null,[`${e.title}${t}`])}return r(S,{trigger:"hover"},{default:()=>r("span",null,[e.title]),trigger:()=>r("span",null,[e.title])})}function X(e){return e[O.wordbookChild.user_name_obj]||e[O.wordbook.parent_name_obj]||e.orgName||e.title||""}function Y(e){var l;for(let t=0,a=e.length;t<a;t++){const a=e[t];(null==(l=a.children)?void 0:l.length)&&Y(a.children),a.disabled||a.children||H.push(a.key)}}async function Z(){z.value=!A.value.trim(),J.value?W.value=await O.queryTreeSearch(A.value):(W.value=B(G,A.value),H=[],Y(W.value),ue()),I.value=W.value.length&&A.value?D(W.value):[]}function ee(){setTimeout((()=>{Z()}))}function le(e,l){for(let t=0,a=e.length;t<a;t++){const a=e[t];if(!a.disabled&&(!a.children||a.isLeaf)&&(l&&!F.value.includes(a.key)&&F.value.push(a.key),!l)){const e=F.value.findIndex((e=>e===a.key));F.value.splice(e,1)}a.children&&le(a.children,l)}}function te(e){le(W.value,e)}function ae(e){var l;for(let t=0,a=e.length;t<a;t++){const a=e[t];F.value.includes(a.key)&&R.value.push({key:a.key,name:a.title,parentName:a.tempTitle}),(null==(l=a.children)?void 0:l.length)&&ae(a.children)}}function ne(e){F.value=e}function ue(){E.value=H.every((e=>R.value.findIndex((l=>l.key===e))>-1))}function oe(){F.value=[]}return function e(l){var t,a;for(let n=0,u=l.length;n<u;n++){const u=l[n];u.title=X(u),u.key||(u.key=u[O.wordbookChild.user_id_obj]||u[O.wordbook.parent_id_obj]||Date.now()),(null==(t=u.children)?void 0:t.length)?(e(u.children),Q(u)):0===(null==(a=u.children)?void 0:a.length)&&Reflect.deleteProperty(u,"children"),u.disabled||u.children||H.push(u.key)}}(G),W.value=G,O.defaultList.length>0&&(J.value?(O.defaultList.forEach((e=>F.value.push(e.key))),R.value=P(O.defaultList)):(O.defaultList.forEach((e=>F.value.push(e))),ae(G))),a((()=>F),(e=>{R.value=[],e.value.length&&ae(J.value?W.value:G),ue();const l=R.value.filter((l=>e.value.includes(l.key)));K("check",e.value),K("checkWithLevel",l)}),{deep:!0}),(l,t)=>(n(),u(o(b),{cols:2,class:"c-select-person"},{default:i((()=>[r(o(_),null,{default:i((()=>[r(o(w),{vertical:"",style:{"padding-right":"12px","border-right":"1px solid #e8e8e8"}},{default:i((()=>[r(o(C),{style:{"margin-bottom":"12px"}},{default:i((()=>[r(o(x),{clearable:"",value:A.value,"onUpdate:value":t[0]||(t[0]=e=>A.value=e),placeholder:e.searchPlaceholder,onClear:ee,onKeyup:c(Z,["enter"])},null,8,["value","placeholder","onKeyup"]),r(o(L),{type:"primary",onClick:Z},{default:i((()=>[d(s(e.searchButtonText),1)])),_:1})])),_:1}),e.multiple&&z.value?h((n(),u(o(j),{key:0,checked:E.value,"onUpdate:checked":[t[1]||(t[1]=e=>E.value=e),te]},{default:i((()=>[d(" 全选 ")])),_:1},8,["checked"])),[[v,o(H).length<1e3]]):p("v-if",!0),r(o(T),f({"virtual-scroll":"",class:"c-select-person__scroll","checked-keys":F.value,"expanded-keys":I.value,"onUpdate:expanded-keys":t[2]||(t[2]=e=>I.value=e),checkable:e.multiple,cascade:"","allow-checking-not-loaded":"",selectable:!e.multiple,"selected-keys":F.value,"onUpdate:selected-keys":t[3]||(t[3]=e=>F.value=e),data:W.value,"check-strategy":"child","render-label":V},e.treeSetting,{"onUpdate:checkedKeys":ne,onLoad:M}),null,16,["checked-keys","expanded-keys","checkable","selectable","selected-keys","data"])])),_:1})])),_:1}),r(o(_),null,{default:i((()=>[r(o(w),{vertical:"",style:{"padding-left":"12px"}},{default:i((()=>[r(o(w),{justify:"space-between",style:{"margin-bottom":"20px"}},{default:i((()=>[e.showCount?(n(),y("span",U,"已选择:"+s(R.value.length),1)):p("v-if",!0),e.showClear?(n(),y("span",{key:1,class:"c-select-person__clear-btn",onClick:oe},"清空")):p("v-if",!0)])),_:1}),k("div",N,[(n(!0),y(m,null,g(R.value,(e=>(n(),y("span",{class:"c-select-person__tag-item",key:e.key},[d(s(e.name)+" "+s(e.parentName?`(${e.parentName})`:"")+" ",1),r(o($),{class:"tag-close",component:o(q),onClick:l=>function(e){F.value=F.value.filter((l=>l!==e.key))}(e)},null,8,["component","onClick"])])))),128))])])),_:1})])),_:1})])),_:1}))}});export{K as default};
1
+ import{defineComponent as e,ref as l,computed as t,watch as a,openBlock as n,createBlock as u,unref as o,withCtx as i,createVNode as r,withKeys as c,createTextVNode as d,toDisplayString as s,withDirectives as v,vShow as h,createCommentVNode as p,mergeProps as f,createElementBlock as y,createElementVNode as k,Fragment as m,renderList as g}from"vue";import{NGrid as b,NGi as _,NSpace as w,NInputGroup as C,NInput as x,NButton as L,NCheckbox as j,NTree as T,NIcon as $,NTooltip as S}from"naive-ui";import{CloseCircleSharp as q}from"@vicons/ionicons5";import{filterTree as B,getExpandedKeys as D}from"./utils/index.js";import{cloneDeep as P}from"lodash-es";const U={key:0},N={class:"c-select-person__scroll",style:{height:"342px"}};var K=e({__name:"SelectPerson",props:{defaultList:{type:Array,default:()=>[]},data:{type:Array,default:()=>[]},searchPlaceholder:{type:String,default:"输入关键字搜索"},searchButtonText:{type:String,default:"搜索"},wordbook:{type:Object,default:()=>({})},wordbookChild:{type:Object,default:()=>({})},showCount:{type:Boolean,default:!0},showClear:{type:Boolean,default:!0},multiple:{type:Boolean,default:!0},treeSetting:{type:Object,default:()=>({})},queryLoadChildData:{type:Function,default:void 0},queryTreeSearch:{type:Function,default:()=>Promise.resolve([])}},emits:["check","checkWithLevel"],setup(e,{emit:K}){const O=e,A=l(""),E=l(!1),F=l([]),I=l([]),W=l([]),R=l([]),z=l([]),G=l(!0),H=P(function e(l,t){return l&&0!==l.length?l.map((l=>{var a;const n=Y(l),u=t?`${n}/${t}`:n;return{...l,tempTitle:t,children:(null==(a=l.children)?void 0:a.length)?e(null==l?void 0:l.children,u):[]}})):[]}(O.data,""));let J=[];const M=t((()=>!!O.queryLoadChildData));async function Q(e){if(O.queryLoadChildData){const l=await O.queryLoadChildData(e);return l.children&&(l.children=l.children.map((e=>({...e,tempTitle:l.tempTitle?`${l.title}/${l.tempTitle}`:l.title})))),l}return e}function V(e){var l;(null==(l=e.children)?void 0:l.every((e=>e.disabled)))&&(e.disabled=!0)}function X({option:e}){var l;if((null==(l=e.children)?void 0:l.length)||M.value&&!(null==e?void 0:e.isLeaf)){const l=O.wordbook.user_count_obj&&e[O.wordbook.user_count_obj]||"",t=l?`(${l})`:"";return r("span",null,[`${e.title}${t}`])}return r(S,{trigger:"hover"},{default:()=>r("span",null,[e.title]),trigger:()=>r("span",null,[e.title])})}function Y(e){return e[O.wordbookChild.user_name_obj]||e[O.wordbook.parent_name_obj]||e.orgName||e.title||""}function Z(e){var l;for(let t=0,a=e.length;t<a;t++){const a=e[t];(null==(l=a.children)?void 0:l.length)&&Z(a.children),a.disabled||a.children||J.push(a.key)}}async function ee(){G.value=!A.value.trim(),M.value?W.value=await O.queryTreeSearch(A.value):(W.value=B(H,A.value),J=[],Z(W.value),oe()),I.value=W.value.length&&A.value?D(W.value):[]}function le(){setTimeout((()=>{ee()}))}function te(e,l){for(let t=0,a=e.length;t<a;t++){const a=e[t];if(!a.disabled&&(!a.children||a.isLeaf)&&(l&&!F.value.includes(a.key)&&F.value.push(a.key),!l)){const e=F.value.findIndex((e=>e===a.key));F.value.splice(e,1)}a.children&&te(a.children,l)}}function ae(e){te(W.value,e)}function ne(e){var l;for(let t=0,a=e.length;t<a;t++){const a=e[t],n=z.value.map((e=>e.key));F.value.includes(a.key)&&!n.includes(a.key)&&R.value.push({key:a.key,name:a.title,parentName:a.tempTitle}),(null==(l=a.children)?void 0:l.length)&&ne(a.children)}}function ue(e){F.value=e}function oe(){E.value=J.every((e=>R.value.findIndex((l=>l.key===e))>-1))}function ie(){F.value=[]}return function e(l){var t,a;for(let n=0,u=l.length;n<u;n++){const u=l[n];u.title=Y(u),u.key||(u.key=u[O.wordbookChild.user_id_obj]||u[O.wordbook.parent_id_obj]||Date.now()),(null==(t=u.children)?void 0:t.length)?(e(u.children),V(u)):0===(null==(a=u.children)?void 0:a.length)&&Reflect.deleteProperty(u,"children"),u.disabled||u.children||J.push(u.key)}}(H),W.value=H,O.defaultList.length>0&&(M.value?(O.defaultList.forEach((e=>F.value.push(e.key))),R.value=P(O.defaultList),z.value=P(O.defaultList)):(O.defaultList.forEach((e=>F.value.push(e))),ne(H))),a((()=>F),(e=>{R.value=z.value.filter((l=>e.value.includes(l.key))),e.value.length&&ne(M.value?W.value:H),oe();const l=R.value.filter((l=>e.value.includes(l.key)));K("check",e.value),K("checkWithLevel",l)}),{deep:!0}),(l,t)=>(n(),u(o(b),{cols:2,class:"c-select-person"},{default:i((()=>[r(o(_),null,{default:i((()=>[r(o(w),{vertical:"",style:{"padding-right":"12px","border-right":"1px solid #e8e8e8"}},{default:i((()=>[r(o(C),{style:{"margin-bottom":"12px"}},{default:i((()=>[r(o(x),{clearable:"",value:A.value,"onUpdate:value":t[0]||(t[0]=e=>A.value=e),placeholder:e.searchPlaceholder,onClear:le,onKeyup:c(ee,["enter"])},null,8,["value","placeholder","onKeyup"]),r(o(L),{type:"primary",onClick:ee},{default:i((()=>[d(s(e.searchButtonText),1)])),_:1})])),_:1}),e.multiple&&G.value?v((n(),u(o(j),{key:0,checked:E.value,"onUpdate:checked":[t[1]||(t[1]=e=>E.value=e),ae]},{default:i((()=>[d(" 全选 ")])),_:1},8,["checked"])),[[h,o(J).length<1e3]]):p("v-if",!0),r(o(T),f({"virtual-scroll":"",class:"c-select-person__scroll","checked-keys":F.value,"expanded-keys":I.value,"onUpdate:expanded-keys":t[2]||(t[2]=e=>I.value=e),checkable:e.multiple,cascade:"","allow-checking-not-loaded":"",selectable:!e.multiple,"selected-keys":F.value,"onUpdate:selected-keys":t[3]||(t[3]=e=>F.value=e),data:W.value,"check-strategy":"child","render-label":X},e.treeSetting,{"onUpdate:checkedKeys":ue,onLoad:Q}),null,16,["checked-keys","expanded-keys","checkable","selectable","selected-keys","data"])])),_:1})])),_:1}),r(o(_),null,{default:i((()=>[r(o(w),{vertical:"",style:{"padding-left":"12px"}},{default:i((()=>[r(o(w),{justify:"space-between",style:{"margin-bottom":"20px"}},{default:i((()=>[e.showCount?(n(),y("span",U,"已选择:"+s(R.value.length),1)):p("v-if",!0),e.showClear?(n(),y("span",{key:1,class:"c-select-person__clear-btn",onClick:ie},"清空")):p("v-if",!0)])),_:1}),k("div",N,[(n(!0),y(m,null,g(R.value,(e=>(n(),y("span",{class:"c-select-person__tag-item",key:e.key},[d(s(e.name)+" "+s(e.parentName?`(${e.parentName})`:"")+" ",1),r(o($),{class:"tag-close",component:o(q),onClick:l=>function(e){F.value=F.value.filter((l=>l!==e.key))}(e)},null,8,["component","onClick"])])))),128))])])),_:1})])),_:1})])),_:1}))}});export{K as default};
@@ -1 +1 @@
1
- var e="@cnhis-design-vue/shared",i="3.1.42-beta.62",s="index.ts",n={"naive-ui":"^2.30.0",vue:"^3.2.0"},a={"@vicons/ionicons5":"^0.12.0","lodash-es":"^4.17.21",moment:"^2.29.1","video.js":"^7.19.2","videojs-contrib-hls":"^5.15.0",viewerjs:"^1.10.5","xe-utils":"^3.5.4"},d={name:e,version:"3.1.42-beta.62",private:!0,main:"index.ts",peerDependencies:n,dependencies:a};export{d as default,a as dependencies,s as main,e as name,n as peerDependencies,i as version};
1
+ var e="@cnhis-design-vue/shared",i="3.1.42-beta.64",s="index.ts",n={"naive-ui":"^2.30.0",vue:"^3.2.0"},a={"@vicons/ionicons5":"^0.12.0","lodash-es":"^4.17.21",moment:"^2.29.1","video.js":"^7.19.2","videojs-contrib-hls":"^5.15.0",viewerjs:"^1.10.5","xe-utils":"^3.5.4"},d={name:e,version:"3.1.42-beta.64",private:!0,main:"index.ts",peerDependencies:n,dependencies:a};export{d as default,a as dependencies,s as main,e as name,n as peerDependencies,i as version};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.1.42-beta.62",
3
+ "version": "3.1.42-beta.64",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -61,5 +61,5 @@
61
61
  "iOS 7",
62
62
  "last 3 iOS versions"
63
63
  ],
64
- "gitHead": "2055890bfc68dfc6dd8790031b76a499eaced755"
64
+ "gitHead": "80da2ef0015b53ee0cee20ae3f1339b70d1cd5c0"
65
65
  }