cnhis-design-vue 3.1.49-beta.6 → 3.1.49-beta.8
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.
- 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/expand-field/index.d.ts +1630 -0
- package/es/components/expand-field/index.js +1 -0
- package/es/components/expand-field/src/components/FormBatchOptionsModal.vue.d.ts +54 -0
- package/es/components/expand-field/src/components/FormBatchOptionsModal.vue.js +1 -0
- package/es/components/expand-field/src/components/FormBatchOptionsModal.vue2.js +1 -0
- package/es/components/expand-field/src/components/FormItemPerson.vue.d.ts +841 -0
- package/es/components/expand-field/src/components/FormItemPerson.vue.js +1 -0
- package/es/components/expand-field/src/components/FormItemPerson.vue2.js +1 -0
- package/es/components/expand-field/src/components/PersonModal.vue.d.ts +777 -0
- package/es/components/expand-field/src/components/PersonModal.vue.js +1 -0
- package/es/components/expand-field/src/components/PersonModal.vue2.js +1 -0
- package/es/components/expand-field/src/components/form.vue.d.ts +1502 -0
- package/es/components/expand-field/src/components/form.vue.js +1 -0
- package/es/components/expand-field/src/components/form.vue2.js +1 -0
- package/es/components/expand-field/src/constants/index.d.ts +3 -0
- package/es/components/expand-field/src/constants/index.js +1 -0
- package/es/components/expand-field/src/hooks/useAsyncData.d.ts +6 -0
- package/es/components/expand-field/src/hooks/useAsyncData.js +1 -0
- package/es/components/expand-field/src/index.vue.d.ts +1632 -0
- package/es/components/expand-field/src/index.vue.js +1 -0
- package/es/components/expand-field/src/index.vue2.js +1 -0
- package/es/components/expand-field/src/types/index.d.ts +1 -0
- package/es/components/expand-field/src/types/index.js +1 -0
- package/es/components/expand-field/src/utils/constant.d.ts +17 -0
- package/es/components/expand-field/src/utils/constant.js +1 -0
- package/es/components/expand-field/src/utils/index.d.ts +6 -0
- package/es/components/expand-field/src/utils/index.js +1 -0
- package/es/components/expand-field/src/utils/tool.d.ts +2 -0
- package/es/components/expand-field/src/utils/tool.js +1 -0
- package/es/components/expand-field/style/expand-field-iconfont.ttf +0 -0
- package/es/components/expand-field/style/index.css +1 -0
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
- package/es/components/fabric-chart/src/interface.d.ts +1 -1
- package/es/components/field-set/index.d.ts +114 -20
- package/es/components/field-set/src/FieldSet.vue.d.ts +114 -20
- package/es/components/field-set/src/FieldSet.vue2.js +1 -1
- package/es/components/field-set/src/components/Row.vue.d.ts +110 -19
- package/es/components/field-set/src/components/Row.vue2.js +1 -1
- package/es/components/field-set/src/types/index.d.ts +1 -1
- package/es/components/field-set/src/utils/index.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.d.ts +6 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +1 -1
- package/es/components/index.css +1 -1
- package/es/components/index.d.ts +2 -1
- package/es/components/index.js +1 -1
- package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
- package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
- package/es/components/select-person/src/SearchMultiple.vue.d.ts +0 -6
- package/es/components/select-person/src/SelectPerson.vue2.js +1 -1
- package/es/components/select-person/style/index.css +1 -1
- package/es/components/table-export-field/src/components/ExportModal.vue.d.ts +3 -0
- package/es/components/table-filter/src/hooks/useAdvanced.js +1 -1
- package/es/env.d.ts +25 -25
- 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/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/hooks/useDateTime.js +1 -1
- 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
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
2
|
import { AnyObject } from '../../../../../es/shared/types';
|
|
3
|
+
import { FieldSetColumnItem } from '../../../../../es/components/field-set';
|
|
3
4
|
import { setStyle, isDisable } from '../utils';
|
|
4
5
|
declare const _default: import("vue").DefineComponent<{
|
|
5
6
|
element: {
|
|
6
|
-
type: PropType<AnyObject>;
|
|
7
|
-
default: () => {};
|
|
8
|
-
};
|
|
9
|
-
columns: {
|
|
10
7
|
type: PropType<Partial<{
|
|
11
8
|
[key: string]: any;
|
|
12
9
|
id: string;
|
|
@@ -24,13 +21,38 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
24
21
|
required: boolean;
|
|
25
22
|
requiredDisable: boolean;
|
|
26
23
|
hide: boolean;
|
|
27
|
-
}
|
|
24
|
+
}>>;
|
|
25
|
+
default: () => {};
|
|
26
|
+
};
|
|
27
|
+
columns: {
|
|
28
|
+
type: PropType<FieldSetColumnItem[]>;
|
|
28
29
|
default: () => never[];
|
|
29
30
|
};
|
|
30
31
|
idx: {
|
|
31
32
|
type: NumberConstructor;
|
|
32
33
|
default: number;
|
|
33
34
|
};
|
|
35
|
+
fieldList: {
|
|
36
|
+
type: PropType<Partial<{
|
|
37
|
+
[key: string]: any;
|
|
38
|
+
id: string;
|
|
39
|
+
name: string;
|
|
40
|
+
show: boolean;
|
|
41
|
+
sort: boolean;
|
|
42
|
+
sortDirection: "NONE" | "ASC" | "DESC";
|
|
43
|
+
title: string;
|
|
44
|
+
alias: string;
|
|
45
|
+
fixedShow: boolean;
|
|
46
|
+
fixedWay: "NONE" | "LEFT" | "RIGHT";
|
|
47
|
+
columnWidth: number | null;
|
|
48
|
+
editable: boolean;
|
|
49
|
+
editableDisable: boolean;
|
|
50
|
+
required: boolean;
|
|
51
|
+
requiredDisable: boolean;
|
|
52
|
+
hide: boolean;
|
|
53
|
+
}>[]>;
|
|
54
|
+
default: () => never[];
|
|
55
|
+
};
|
|
34
56
|
}, {
|
|
35
57
|
fixedWayOptions: {
|
|
36
58
|
label: string;
|
|
@@ -42,10 +64,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
42
64
|
}[];
|
|
43
65
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
44
66
|
element: {
|
|
45
|
-
type: PropType<AnyObject>;
|
|
46
|
-
default: () => {};
|
|
47
|
-
};
|
|
48
|
-
columns: {
|
|
49
67
|
type: PropType<Partial<{
|
|
50
68
|
[key: string]: any;
|
|
51
69
|
id: string;
|
|
@@ -63,22 +81,56 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
63
81
|
required: boolean;
|
|
64
82
|
requiredDisable: boolean;
|
|
65
83
|
hide: boolean;
|
|
66
|
-
}
|
|
84
|
+
}>>;
|
|
85
|
+
default: () => {};
|
|
86
|
+
};
|
|
87
|
+
columns: {
|
|
88
|
+
type: PropType<FieldSetColumnItem[]>;
|
|
67
89
|
default: () => never[];
|
|
68
90
|
};
|
|
69
91
|
idx: {
|
|
70
92
|
type: NumberConstructor;
|
|
71
93
|
default: number;
|
|
72
94
|
};
|
|
95
|
+
fieldList: {
|
|
96
|
+
type: PropType<Partial<{
|
|
97
|
+
[key: string]: any;
|
|
98
|
+
id: string;
|
|
99
|
+
name: string;
|
|
100
|
+
show: boolean;
|
|
101
|
+
sort: boolean;
|
|
102
|
+
sortDirection: "NONE" | "ASC" | "DESC";
|
|
103
|
+
title: string;
|
|
104
|
+
alias: string;
|
|
105
|
+
fixedShow: boolean;
|
|
106
|
+
fixedWay: "NONE" | "LEFT" | "RIGHT";
|
|
107
|
+
columnWidth: number | null;
|
|
108
|
+
editable: boolean;
|
|
109
|
+
editableDisable: boolean;
|
|
110
|
+
required: boolean;
|
|
111
|
+
requiredDisable: boolean;
|
|
112
|
+
hide: boolean;
|
|
113
|
+
}>[]>;
|
|
114
|
+
default: () => never[];
|
|
115
|
+
};
|
|
73
116
|
}>> & {
|
|
74
117
|
onUpdateChecked?: ((...args: any[]) => any) | undefined;
|
|
75
118
|
}>>;
|
|
76
119
|
emit: (event: "updateChecked", ...args: any[]) => void;
|
|
77
|
-
|
|
120
|
+
getSortPriorityOptions: () => {
|
|
121
|
+
label: string;
|
|
122
|
+
value: number;
|
|
123
|
+
}[];
|
|
124
|
+
getOptions: (column: AnyObject) => {
|
|
78
125
|
label: string;
|
|
79
126
|
value: string;
|
|
127
|
+
}[] | {
|
|
128
|
+
label: string;
|
|
129
|
+
value: number;
|
|
80
130
|
}[];
|
|
131
|
+
setDisabled: (column: AnyObject) => boolean;
|
|
81
132
|
onUpdateChecked: (checked: boolean, column: AnyObject) => void;
|
|
133
|
+
handleUpdateSelect: (value: string, column: AnyObject) => void;
|
|
82
134
|
NCheckbox: any;
|
|
83
135
|
NSelect: any;
|
|
84
136
|
NInput: any;
|
|
@@ -90,10 +142,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
90
142
|
ReorderTwoOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
91
143
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "updateChecked"[], "updateChecked", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
92
144
|
element: {
|
|
93
|
-
type: PropType<AnyObject>;
|
|
94
|
-
default: () => {};
|
|
95
|
-
};
|
|
96
|
-
columns: {
|
|
97
145
|
type: PropType<Partial<{
|
|
98
146
|
[key: string]: any;
|
|
99
147
|
id: string;
|
|
@@ -111,17 +159,43 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
111
159
|
required: boolean;
|
|
112
160
|
requiredDisable: boolean;
|
|
113
161
|
hide: boolean;
|
|
114
|
-
}
|
|
162
|
+
}>>;
|
|
163
|
+
default: () => {};
|
|
164
|
+
};
|
|
165
|
+
columns: {
|
|
166
|
+
type: PropType<FieldSetColumnItem[]>;
|
|
115
167
|
default: () => never[];
|
|
116
168
|
};
|
|
117
169
|
idx: {
|
|
118
170
|
type: NumberConstructor;
|
|
119
171
|
default: number;
|
|
120
172
|
};
|
|
173
|
+
fieldList: {
|
|
174
|
+
type: PropType<Partial<{
|
|
175
|
+
[key: string]: any;
|
|
176
|
+
id: string;
|
|
177
|
+
name: string;
|
|
178
|
+
show: boolean;
|
|
179
|
+
sort: boolean;
|
|
180
|
+
sortDirection: "NONE" | "ASC" | "DESC";
|
|
181
|
+
title: string;
|
|
182
|
+
alias: string;
|
|
183
|
+
fixedShow: boolean;
|
|
184
|
+
fixedWay: "NONE" | "LEFT" | "RIGHT";
|
|
185
|
+
columnWidth: number | null;
|
|
186
|
+
editable: boolean;
|
|
187
|
+
editableDisable: boolean;
|
|
188
|
+
required: boolean;
|
|
189
|
+
requiredDisable: boolean;
|
|
190
|
+
hide: boolean;
|
|
191
|
+
}>[]>;
|
|
192
|
+
default: () => never[];
|
|
193
|
+
};
|
|
121
194
|
}>> & {
|
|
122
195
|
onUpdateChecked?: ((...args: any[]) => any) | undefined;
|
|
123
196
|
}, {
|
|
124
|
-
columns:
|
|
197
|
+
columns: FieldSetColumnItem[];
|
|
198
|
+
element: Partial<{
|
|
125
199
|
[key: string]: any;
|
|
126
200
|
id: string;
|
|
127
201
|
name: string;
|
|
@@ -138,8 +212,25 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
138
212
|
required: boolean;
|
|
139
213
|
requiredDisable: boolean;
|
|
140
214
|
hide: boolean;
|
|
141
|
-
}
|
|
142
|
-
element: AnyObject;
|
|
215
|
+
}>;
|
|
143
216
|
idx: number;
|
|
217
|
+
fieldList: Partial<{
|
|
218
|
+
[key: string]: any;
|
|
219
|
+
id: string;
|
|
220
|
+
name: string;
|
|
221
|
+
show: boolean;
|
|
222
|
+
sort: boolean;
|
|
223
|
+
sortDirection: "NONE" | "ASC" | "DESC";
|
|
224
|
+
title: string;
|
|
225
|
+
alias: string;
|
|
226
|
+
fixedShow: boolean;
|
|
227
|
+
fixedWay: "NONE" | "LEFT" | "RIGHT";
|
|
228
|
+
columnWidth: number | null;
|
|
229
|
+
editable: boolean;
|
|
230
|
+
editableDisable: boolean;
|
|
231
|
+
required: boolean;
|
|
232
|
+
requiredDisable: boolean;
|
|
233
|
+
hide: boolean;
|
|
234
|
+
}>[];
|
|
144
235
|
}>;
|
|
145
236
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,openBlock as l,createElementBlock as t,Fragment as
|
|
1
|
+
import{defineComponent as e,openBlock as l,createElementBlock as t,Fragment as i,renderList as n,normalizeStyle as a,unref as r,createBlock as o,withCtx as u,createVNode as d,createCommentVNode as s,createTextVNode as f,toDisplayString as c,withDirectives as m,vShow as p,createElementVNode as v}from"vue";import{NTooltip as y,NIcon as b,NCheckbox as k,NSelect as h,NInput as x,NInputNumber as N}from"naive-ui";import{setStyle as g,isDisable as U}from"../utils/index.js";import{ReorderTwoOutline as E}from"@vicons/ionicons5";import{range as O}from"lodash-es";const P={class:"row"},w=["title"],C=v("span",null,"拖拽调整顺序",-1);var D=e({__name:"Row",props:{element:{type:Object,default:()=>({})},columns:{type:Array,default:()=>[]},idx:{type:Number,default:1},fieldList:{type:Array,default:()=>[]}},emits:["updateChecked"],setup(e,{emit:v}){const D=e,L=[{label:"不固定",value:"NONE"},{label:"左固定",value:"LEFT"},{label:"右固定",value:"RIGHT"}],S=[{label:"不排序",value:"NONE"},{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}];function A(e){switch(e.field){case"fixedWay":return L;case"sortDirection":return S;case"sortPriority":return function(){const e=O(1,D.fieldList.length+1).map((e=>({label:e.toString(),value:e}))),l=D.fieldList.filter((e=>!!e.sortPriority&&e.uuid!==D.element.uuid)).map((e=>e.sortPriority));return e.filter((e=>!l.includes(e.value)))}();default:return[]}}function _(e){if("sortPriority"!==e.field)return!1;const{sortDirection:l}=D.element;return!l||"NONE"===l}return(O,L)=>(l(),t("div",P,[(l(!0),t(i,null,n(e.columns,((n,O)=>(l(),t(i,{key:O},[n.isShow?(l(),t("span",{key:0,class:"table-cell",title:e.element[n.field],style:a(r(g)(n))},["text"===n.type?(l(),t(i,{key:0},[0===O?(l(),o(r(y),{key:0,trigger:"hover"},{trigger:u((()=>[d(r(b),{style:{"margin-right":"5px",top:"2px"},component:r(E)},null,8,["component"])])),default:u((()=>[C])),_:1})):s("v-if",!0),f(" "+c("seq"===n.field?e.idx:e.element[n.field]),1)],64)):s("v-if",!0),"checkbox"===n.type?m((l(),o(r(k),{key:1,disabled:r(U)(e.element,n.field),checked:e.element[n.field],"onUpdate:checked":[l=>e.element[n.field]=l,e=>function(e,l){v("updateChecked",{checked:e,column:l})}(e,n)]},null,8,["disabled","checked","onUpdate:checked"])),[[p,"0001"!=e.element.id]]):s("v-if",!0),"select"===n.type?m((l(),o(r(h),{key:2,clearable:"",disabled:_(n),value:e.element[n.field],"onUpdate:value":[l=>e.element[n.field]=l,e=>function(e,l){"sortDirection"===l.field&&"NONE"===e&&(D.element.sortPriority=null)}(e,n)],options:A(n)},null,8,["disabled","value","onUpdate:value","options"])),[[p,"fixedWay"===n.field||"0001"!=e.element.id]]):s("v-if",!0),"input"===n.type?m((l(),o(r(x),{key:3,value:e.element[n.field],"onUpdate:value":l=>e.element[n.field]=l,clearable:""},null,8,["value","onUpdate:value"])),[[p,"0001"!=e.element.id]]):s("v-if",!0),"inputNumber"===n.type?(l(),o(r(N),{key:4,value:e.element[n.field],"onUpdate:value":l=>e.element[n.field]=l},null,8,["value","onUpdate:value"])):s("v-if",!0)],12,w)):s("v-if",!0)],64)))),128))]))}});export{D as default};
|
|
@@ -16,7 +16,7 @@ export declare type FieldSetItem = Partial<{
|
|
|
16
16
|
hide: boolean;
|
|
17
17
|
[key: string]: any;
|
|
18
18
|
}>;
|
|
19
|
-
export declare type FieldSetColumnName = 'show' | 'editable' | 'required' | 'sort' | 'bold' | 'sortDirection' | 'fixedWay' | 'alias' | 'columnWidth';
|
|
19
|
+
export declare type FieldSetColumnName = 'show' | 'editable' | 'required' | 'sort' | 'bold' | 'sortDirection' | 'sortPriority' | 'fixedWay' | 'alias' | 'columnWidth';
|
|
20
20
|
export declare type FieldSetColumnItem = {
|
|
21
21
|
title: string;
|
|
22
22
|
type: 'text' | 'checkbox' | 'select' | 'input' | 'inputNumber';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isArray as e,isObject as t}from"lodash-es";import{IhoTableRowGroupSequence as i}from"../../../iho-table/src/constants/index.js";function n(e){const t={flex:"1 1 90px"};switch(e.type){case"text":"title"===e.field&&Object.assign(t,{flex:"0 0 120px",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"});break;case"checkbox":t.flex="1 1 60px";break;case"select":t.flex="1 1 80px";break;case"input":t.flex="1 1 100px"}return t}function s(e,t){return["editable","required"].includes(t)&&e[`${t}Disable`]||["sort"].includes(t)&&1==e.notParticipatingSort}function
|
|
1
|
+
import{isArray as e,isObject as t}from"lodash-es";import{IhoTableRowGroupSequence as i}from"../../../iho-table/src/constants/index.js";function n(e){const t={flex:"1 1 90px"};switch(e.type){case"text":"title"===e.field&&Object.assign(t,{flex:"0 0 120px",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"}),"seq"===e.field&&(t.flex="1 1 40px");break;case"checkbox":t.flex="1 1 60px";break;case"select":t.flex="1 1 80px";break;case"input":t.flex="1 1 100px"}return t}function s(e,t){return["editable","required"].includes(t)&&e[`${t}Disable`]||["sort"].includes(t)&&1==e.notParticipatingSort}function l(n,s,l=(e=>e.name)){const r=s.map((e=>l(e)));return i.some((i=>{const s=n[i];if(!e(s))return!0;s.forEach((i=>{if(!e(i.list)||!i.list.length)return;const n=[];let s=null;i.list.forEach(((e,l)=>{const c=function(e,i,n){return i.findIndex((i=>i!==n&&(t(i)?i.fieldName:i)===e))}(e,r,s);~c&&(n.push(r[c]),0===l?r.splice(c,1,s={fieldName:i.title,children:n}):r.splice(c,1))}))}))})),r}export{l as getGroupTree,s as isDisable,n as setStyle};
|
|
@@ -44,6 +44,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
44
44
|
aliasField: {
|
|
45
45
|
type: StringConstructor;
|
|
46
46
|
};
|
|
47
|
+
menuProps: {
|
|
48
|
+
type: PropType<AnyObject>;
|
|
49
|
+
};
|
|
47
50
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:value"[], "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
48
51
|
value: {
|
|
49
52
|
type: PropType<string | number | (string | number)[]>;
|
|
@@ -86,6 +89,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
86
89
|
aliasField: {
|
|
87
90
|
type: StringConstructor;
|
|
88
91
|
};
|
|
92
|
+
menuProps: {
|
|
93
|
+
type: PropType<AnyObject>;
|
|
94
|
+
};
|
|
89
95
|
}>> & {
|
|
90
96
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
91
97
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,inject as l,ref as o,computed as t,createVNode as
|
|
1
|
+
import{defineComponent as e,inject as l,ref as o,computed as t,createVNode as n,toRaw as a,Fragment as u}from"vue";import{keywordMatcher as r,arrayed as i}from"../../../../../../../shared/utils/index.js";import{NSelect as s,NTooltip as d,NIcon as p,NTag as c}from"naive-ui";import{HelpCircleSharp as v}from"@vicons/ionicons5";import{InjectionIhoTableUUID as m}from"../../../../constants/index.js";import{selectOptionsMap as f}from"../hooks/useSelectOption.js";import{useIhoTableFormEvent as h}from"../../../../utils/index.js";import{useDebounceFn as y}from"@vueuse/core";import{isEmpty as b,isFunction as w,isArray as S,isObject as g,omit as O}from"lodash-es";var x=e({name:"EditSelect",props:{value:{type:[Array,String,Number]},column:{type:Object,required:!0},row:{type:Object,required:!0},rowIndex:{type:Number,required:!0},options:{type:Array,default:()=>[]},queryOptions:{type:Function},placeholder:{type:String,default:"请选择"},allowCreate:{type:Boolean,default:!1},shouldSave:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},aliasField:{type:String},menuProps:{type:Object}},emits:["update:value"],setup(e,{emit:x}){const j=l("$xetable"),P=o(null);function q(e){P.value=e}const _=o(!1),{emitFormChangeWithParams:k}=h({...e,$table:j}),C=o("");function F(){return B()}const W=o([]),M=t((()=>{let l=b(W.value)?e.options:W.value;return C.value?(l=l.filter((e=>e.label&&e.label.includes(C.value)||r(C.value,e.keyword))),!e.allowCreate||l.some((e=>e.label===C.value))?l:[...l,{label:C.value,value:C.value,created:!0,shouldSave:e.shouldSave}]):l})),$=o(!1),B=y((async function(l=""){C.value=l;try{if($.value=!0,!w(e.queryOptions)||!b(e.options))return;W.value=await e.queryOptions({keyword:l,row:e.row,column:e.column,rowIndex:e.rowIndex})}catch(l){console.log(`获取${e.column.field}options错误`)}finally{$.value=!1}}),400),E=l(m);function I(l,o){const t=e.value;x("update:value",l);const n=f.get(E);n&&S(n[e.column.field])&&i(o).forEach((l=>{if(!g(l))return;const o=l;o.created&&o.shouldSave&&n[e.column.field].push(O(a(o),["created","shouldSave"]))})),k({oldValue:t,option:o})}function U(e){var l,o;"Tab"===e.key&&P.value&&(null==(o=(l=P.value).handleKeydown)||o.call(l,{...e,key:"Enter",preventDefault:e.preventDefault.bind(e)}))}function A({node:e,option:l}){return l.desc?n("div",{class:"iho-table__selectOptionWrapper"},[[e,n(d,null,{trigger:()=>n(p,{component:v},null),default:()=>l.desc})]]):e}function D({option:l,handleClose:o}){var t;const a=null!=(t=e.aliasField&&l[e.aliasField])?t:l.label;return S(e.value)?n(c,{closable:!0,onClose:e=>{e.stopPropagation(),o()}},{default:()=>a}):n(u,null,[a])}const K=()=>({class:"iho-table__selectOption"}),N=t((()=>{var l,o;return{...e.menuProps,class:`iho-table__selectMenu ${null!=(o=null==(l=e.menuProps)?void 0:l.class)?o:""}`}}));return()=>n(s,{ref:q,show:_.value,"onUpdate:show":e=>_.value=e,consistentMenuWidth:e.consistentMenuWidth,placeholder:e.placeholder,loading:$.value,options:M.value,value:e.value,remote:!0,onSearch:B,clearable:!0,filterable:!0,nodeProps:K,menuProps:N.value,renderTag:D,renderOption:A,onUpdateShow:F,onUpdateValue:I,onKeydown:U},null)}});export{x as default};
|