cnhis-design-vue 3.2.9-beta.12 → 3.2.9-beta.14

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.
@@ -46,9 +46,7 @@ declare const _default: import("vue").DefineComponent<{
46
46
  disabledAll?: boolean | undefined;
47
47
  isHeadCheckHide?: boolean | undefined;
48
48
  isShow?: boolean | undefined;
49
- contentRender?: ((column: AnyObject, row: AnyObject) => String | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
50
- [key: string]: any;
51
- }>) | undefined;
49
+ contentRender?: ((column: AnyObject, row: AnyObject) => import("vue").VNodeChild) | undefined;
52
50
  }[]>;
53
51
  rowProps: {
54
52
  columns: {
@@ -60,9 +58,7 @@ declare const _default: import("vue").DefineComponent<{
60
58
  disabledAll?: boolean | undefined;
61
59
  isHeadCheckHide?: boolean | undefined;
62
60
  isShow?: boolean | undefined;
63
- contentRender?: ((column: AnyObject, row: AnyObject) => String | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
64
- [key: string]: any;
65
- }>) | undefined;
61
+ contentRender?: ((column: AnyObject, row: AnyObject) => import("vue").VNodeChild) | undefined;
66
62
  }[];
67
63
  data: AnyObject[];
68
64
  onEdit: (row: AnyObject) => void;
@@ -239,6 +235,9 @@ declare const _default: import("vue").DefineComponent<{
239
235
  type: StringConstructor;
240
236
  default: string;
241
237
  };
238
+ titleRender: {
239
+ type: PropType<(row: AnyObject) => import("vue").VNodeChild>;
240
+ };
242
241
  }, {
243
242
  fixedWayOptions: {
244
243
  label: string;
@@ -341,6 +340,9 @@ declare const _default: import("vue").DefineComponent<{
341
340
  type: StringConstructor;
342
341
  default: string;
343
342
  };
343
+ titleRender: {
344
+ type: PropType<(row: AnyObject) => import("vue").VNodeChild>;
345
+ };
344
346
  }>> & {
345
347
  onUpdateChecked?: ((...args: any[]) => any) | undefined;
346
348
  onEdit?: ((...args: any[]) => any) | undefined;
@@ -471,6 +473,9 @@ declare const _default: import("vue").DefineComponent<{
471
473
  type: StringConstructor;
472
474
  default: string;
473
475
  };
476
+ titleRender: {
477
+ type: PropType<(row: AnyObject) => import("vue").VNodeChild>;
478
+ };
474
479
  }>> & {
475
480
  onUpdateChecked?: ((...args: any[]) => any) | undefined;
476
481
  onEdit?: ((...args: any[]) => any) | undefined;
@@ -37,9 +37,7 @@ declare const _default: import("vue").DefineComponent<{
37
37
  disabledAll?: boolean | undefined;
38
38
  isHeadCheckHide?: boolean | undefined;
39
39
  isShow?: boolean | undefined;
40
- contentRender?: ((column: AnyObject, row: AnyObject) => String | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
41
- [key: string]: any;
42
- }>) | undefined;
40
+ contentRender?: ((column: AnyObject, row: AnyObject) => import("vue").VNodeChild) | undefined;
43
41
  }[]>;
44
42
  data: import("vue").Ref<{
45
43
  [x: string]: any;
@@ -64,9 +62,7 @@ declare const _default: import("vue").DefineComponent<{
64
62
  disabledAll?: boolean | undefined;
65
63
  isHeadCheckHide?: boolean | undefined;
66
64
  isShow?: boolean | undefined;
67
- contentRender?: ((column: AnyObject, row: AnyObject) => String | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
68
- [key: string]: any;
69
- }>) | undefined;
65
+ contentRender?: ((column: AnyObject, row: AnyObject) => import("vue").VNodeChild) | undefined;
70
66
  }[];
71
67
  data: {
72
68
  [x: string]: any;
@@ -261,6 +257,9 @@ declare const _default: import("vue").DefineComponent<{
261
257
  type: StringConstructor;
262
258
  default: string;
263
259
  };
260
+ titleRender: {
261
+ type: PropType<(row: AnyObject) => import("vue").VNodeChild>;
262
+ };
264
263
  }, {
265
264
  fixedWayOptions: {
266
265
  label: string;
@@ -363,6 +362,9 @@ declare const _default: import("vue").DefineComponent<{
363
362
  type: StringConstructor;
364
363
  default: string;
365
364
  };
365
+ titleRender: {
366
+ type: PropType<(row: AnyObject) => import("vue").VNodeChild>;
367
+ };
366
368
  }>> & {
367
369
  onUpdateChecked?: ((...args: any[]) => any) | undefined;
368
370
  onEdit?: ((...args: any[]) => any) | undefined;
@@ -493,6 +495,9 @@ declare const _default: import("vue").DefineComponent<{
493
495
  type: StringConstructor;
494
496
  default: string;
495
497
  };
498
+ titleRender: {
499
+ type: PropType<(row: AnyObject) => import("vue").VNodeChild>;
500
+ };
496
501
  }>> & {
497
502
  onUpdateChecked?: ((...args: any[]) => any) | undefined;
498
503
  onEdit?: ((...args: any[]) => any) | undefined;
@@ -1,4 +1,4 @@
1
- import { PropType } from 'vue';
1
+ import { PropType, VNodeChild } from 'vue';
2
2
  import { setStyle, isDraggableItem } from './utils';
3
3
  import { FieldSetItem, FieldSetColumnName, FieldSetColumnItem } from '../../../components/field-set/src/types';
4
4
  import { AnyObject } from '../../../shared/types';
@@ -89,11 +89,11 @@ declare const _default: import("vue").DefineComponent<{
89
89
  type: StringConstructor;
90
90
  default: string;
91
91
  };
92
+ titleRender: {
93
+ type: PropType<(row: FieldSetItem) => VNodeChild>;
94
+ };
92
95
  }, {
93
96
  fieldsMapping: Record<string, string>;
94
- attrs: {
95
- [x: string]: unknown;
96
- };
97
97
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
98
98
  fields: {
99
99
  type: PropType<Partial<{
@@ -181,6 +181,9 @@ declare const _default: import("vue").DefineComponent<{
181
181
  type: StringConstructor;
182
182
  default: string;
183
183
  };
184
+ titleRender: {
185
+ type: PropType<(row: FieldSetItem) => VNodeChild>;
186
+ };
184
187
  }>> & {
185
188
  onSave?: ((...args: any[]) => any) | undefined;
186
189
  onClose?: ((...args: any[]) => any) | undefined;
@@ -192,6 +195,7 @@ declare const _default: import("vue").DefineComponent<{
192
195
  tableBodyRef: import("vue").Ref<HTMLDivElement | undefined>;
193
196
  newFields: import("vue").Ref<AnyObject[]>;
194
197
  defaultColumns: FieldSetColumnItem[];
198
+ otherColumns: FieldSetColumnItem[];
195
199
  columns: import("vue").Ref<{
196
200
  [x: string]: any;
197
201
  title: string;
@@ -201,9 +205,7 @@ declare const _default: import("vue").DefineComponent<{
201
205
  disabledAll?: boolean | undefined;
202
206
  isHeadCheckHide?: boolean | undefined;
203
207
  isShow?: boolean | undefined;
204
- contentRender?: ((column: AnyObject, row: AnyObject) => String | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
205
- [key: string]: any;
206
- }>) | undefined;
208
+ contentRender?: ((column: AnyObject, row: AnyObject) => VNodeChild) | undefined;
207
209
  }[]>;
208
210
  fieldList: import("vue").ComputedRef<AnyObject[]>;
209
211
  hasFieldDescribe: import("vue").ComputedRef<boolean>;
@@ -217,9 +219,7 @@ declare const _default: import("vue").DefineComponent<{
217
219
  disabledAll?: boolean | undefined;
218
220
  isHeadCheckHide?: boolean | undefined;
219
221
  isShow?: boolean | undefined;
220
- contentRender?: ((column: AnyObject, row: AnyObject) => String | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
221
- [key: string]: any;
222
- }>) | undefined;
222
+ contentRender?: ((column: AnyObject, row: AnyObject) => VNodeChild) | undefined;
223
223
  }[];
224
224
  data: AnyObject[];
225
225
  onUpdateChecked: ({ checked, column }: {
@@ -233,6 +233,7 @@ declare const _default: import("vue").DefineComponent<{
233
233
  columnWidthProps: Record<string, any> | undefined;
234
234
  hideExpressionOption: AnyObject[] | never[];
235
235
  primaryKey: string;
236
+ titleRender: ((row: FieldSetItem) => VNodeChild) | undefined;
236
237
  };
237
238
  searchData: {
238
239
  keyword: string;
@@ -423,6 +424,9 @@ declare const _default: import("vue").DefineComponent<{
423
424
  type: StringConstructor;
424
425
  default: string;
425
426
  };
427
+ titleRender: {
428
+ type: PropType<(row: AnyObject) => VNodeChild>;
429
+ };
426
430
  }, {
427
431
  fixedWayOptions: {
428
432
  label: string;
@@ -525,6 +529,9 @@ declare const _default: import("vue").DefineComponent<{
525
529
  type: StringConstructor;
526
530
  default: string;
527
531
  };
532
+ titleRender: {
533
+ type: PropType<(row: AnyObject) => VNodeChild>;
534
+ };
528
535
  }>> & {
529
536
  onUpdateChecked?: ((...args: any[]) => any) | undefined;
530
537
  onEdit?: ((...args: any[]) => any) | undefined;
@@ -655,6 +662,9 @@ declare const _default: import("vue").DefineComponent<{
655
662
  type: StringConstructor;
656
663
  default: string;
657
664
  };
665
+ titleRender: {
666
+ type: PropType<(row: AnyObject) => VNodeChild>;
667
+ };
658
668
  }>> & {
659
669
  onUpdateChecked?: ((...args: any[]) => any) | undefined;
660
670
  onEdit?: ((...args: any[]) => any) | undefined;
@@ -801,6 +811,9 @@ declare const _default: import("vue").DefineComponent<{
801
811
  type: StringConstructor;
802
812
  default: string;
803
813
  };
814
+ titleRender: {
815
+ type: PropType<(row: FieldSetItem) => VNodeChild>;
816
+ };
804
817
  }>> & {
805
818
  onSave?: ((...args: any[]) => any) | undefined;
806
819
  onClose?: ((...args: any[]) => any) | undefined;
@@ -1 +1 @@
1
- import{defineComponent as e,useAttrs as l,ref as t,computed as i,reactive as o,toRef as d,watch as a,openBlock as r,createElementBlock as s,createBlock as n,unref as u,withKeys as c,withModifiers as f,createCommentVNode as p,createElementVNode as h,Fragment as m,renderList as y,normalizeStyle as v,withCtx as b,createTextVNode as g,toDisplayString as x,createVNode as k,normalizeClass as w,mergeProps as S,renderSlot as A}from"vue";import{NInput as _,NCheckbox as C,NTooltip as W,NIcon as E,NPopconfirm as D,NButton as F}from"naive-ui";import M from"../../../shared/components/VueDraggable/src/vuedraggable.js";import P from"./components/table-row.vue.js";import{isArray as j,cloneDeep as B,isString as H,omit as N}from"lodash-es";import{isDisable as V,setStyle as O,isDraggableItem as R,isDraggable as q,getGroupTree as I}from"./utils/index.js";import{uuidGenerator as K}from"../../../shared/utils/index.js";import{HelpCircleSharp as U}from"@vicons/ionicons5";const T={class:"main-wrapper"},G={class:"main-wrapper__table-header"},L=h("span",null,"数值越小,优先级越高",-1),$=["tabindex"],z={key:1,class:"main-wrapper__table-footer"};var J=e({__name:"FieldSet",props:{fields:{type:Array,default:()=>[]},footerFlag:{type:Boolean,default:!0},type:{type:String,default:"old"},isEdit:{type:Boolean,default:!1},showColumnNames:{type:Array},groupSetting:{type:Object},customColumns:{type:Array,default:()=>[]},showSeq:{type:Boolean,default:!1},showSearch:{type:Boolean,default:!1},showSortPriority:{type:Boolean,default:!1},showHeadFilter:{type:Boolean,default:!1},fieldShowMaxValue:{type:Number},rowDraggable:{type:Boolean,default:!0},fieldDescribeMode:{type:String,default:"tooltip"},developMode:{type:Boolean},columnWidthProps:{type:Object},hideExpressionConfig:{type:Object},primaryKey:{type:String,default:"id"}},emits:["save","close","reset"],setup(e,{expose:J,emit:Q}){const X=e,Y={sid:"id",columnName:"name",isShow:"show",isSort:"sort",isFixed:"fixedWay",colWidth:"columnWidth"};l();const Z=t(Date.now()),ee=t(""),le=t(),te=t([]),ie=[{title:"所有字段",type:"text",field:"title"},{title:"显示",type:"checkbox",checkedAll:!1,disabledAll:!!X.fieldShowMaxValue,field:"show",fieldShowMaxValue:X.fieldShowMaxValue},{title:"编辑",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"editable"},{title:"必填",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"required"},{title:"排序",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"sort"},{title:"加粗",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"bold"},{title:"默认排序",type:"select",field:"sortDirection"},{title:"排序优先级",type:"select",field:"sortPriority"},{title:"固定",type:"select",field:"fixedWay"},{title:"自定义标题",type:"input",field:"alias"},{title:"列宽",type:"inputNumber",field:"columnWidth"},{title:"表头筛选",type:"checkbox",isHeadCheckHide:!0,field:"isShowHeaderFilter"},{title:"脱敏配置",type:"select",field:"hideExpression"}],oe=t([]),de=i((()=>te.value.flat())),ae=i((()=>de.value.some((e=>e.feildDescribe)))),re=o({columns:oe,data:de,onUpdateChecked:function({checked:e,column:l}){const t=!e||ye(l.field);l.checkedAll=!t},draggable:X.rowDraggable,isFieldSet:!0,fieldDescribeMode:X.fieldDescribeMode,developMode:X.developMode,columnWidthProps:X.columnWidthProps,hideExpressionOption:d(X.hideExpressionConfig||{option:[]},"option"),primaryKey:d(X,"primaryKey")}),se={keyword:ee.value,idx:0,startIdx:0},ne=()=>{Q("save")},ue=()=>{Q("close")};function ce(){te.value=fe(),me(),Z.value=Date.now(),Q("reset")}function fe(){const e=B(X.fields).map((e=>({...e,uuid:K()})));return Object.keys(Y).forEach((l=>{e.forEach((e=>{"old"==X.type&&Reflect.has(e,l)&&("isFixed"==l?e.fixedWay=1==e[l]?"LEFT":2==e[l]?"RIGHT":"NONE":["isShow","isSort"].includes(l)&&"boolean"!=typeof l?e[Y[l]]=1==e[l]:e[Y[l]]=e[l],Reflect.deleteProperty(e,l)),e.columnWidth=+e.columnWidth||null,Reflect.has(e,"alias")||(e.alias=""),Reflect.has(e,"bold")||(e.bold=!1),e.draggable=!!q(e)}))})),function(e){if(X.groupSetting){return I(X.groupSetting,e).reduce(((t,i)=>{const o=H(i)?e.find((e=>e.name===i)):l(i.children);return o&&t.push(o),t}),[])}return e;function l(t){const i=[];return t.forEach((t=>{if(t.children)i.push(...l(t.children));else{const l=e.find((e=>e.name===t));l&&i.push(l)}})),i}}(e)}function pe(){const e=se.keyword!==ee.value;let l=ee.value?de.value.findIndex(((l,t)=>{var i;if(null==(i=l.title)?void 0:i.includes(ee.value))return!!e||t>se.idx})):0;-1!==l||e||(l=se.startIdx),le.value.scrollTop=52*l,Object.assign(se,{keyword:ee.value,idx:l},e?{startIdx:l}:{})}function he(e){var l;return!!ee.value&&(null==(l=e.title)?void 0:l.includes(ee.value))}function me(){var e,l;oe.value=B(ie),(null==(e=X.showColumnNames)?void 0:e.length)&&(oe.value=ie.filter((e=>{var l,t;return"title"===e.field||(null==(t=null==(l=X.showColumnNames)?void 0:l.includes)?void 0:t.call(l,e.field))}))),(null==(l=X.customColumns)?void 0:l.length)&&oe.value.push(...X.customColumns),"column"===X.fieldDescribeMode&&ae.value&&oe.value.push({title:"字段描述",type:"text",field:"feildDescribe"}),X.showSeq&&oe.value.splice(1,0,{title:"排序",type:"text",field:"seq"}),oe.value.forEach((e=>{if(e.isShow=function(e){var l;return!(["editable","required"].includes(e.field)&&!X.isEdit||"sortPriority"===e.field&&!X.showSortPriority||"isShowHeaderFilter"===e.field&&!X.showHeadFilter||"hideExpression"===e.field&&!(null==(l=X.hideExpressionConfig)?void 0:l.show))}(e),"checkbox"===e.type){const l=te.value.flat().every((l=>!Reflect.has(l,e.field)));e.checkedAll=!ye(e.field)&&!l}}))}function ye(e){return te.value.flat().some((l=>!V(l,e)&&!l[e]&&"0001"!=l.id))}function ve(e){return!!R(e.relatedContext.element)}return a([()=>X.fields,()=>{var e;return null==(e=X.showColumnNames)?void 0:e.length}],(([e,l])=>{e.length>0&&(te.value=fe(),me())}),{immediate:!0,deep:!0}),J({getTableFields:function(){let e=[];return e="old"==X.type?de.value.map(((e,l)=>N({...e,field:e.name,visible:e.show,sequence:l,sortable:e.sort,title:e.alias,fixed:e.fixedWay,minWidth:e.columnWidth},["name","show","sort","alias","fixedWay","columnWidth"]))):de.value,e.map((e=>N(e,["uuid"])))}}),(l,t)=>(r(),s("div",T,[e.showSearch?(r(),n(u(_),{key:0,class:"main-wrapper__search-wrapper",value:ee.value,"onUpdate:value":t[0]||(t[0]=e=>ee.value=e),valueModifiers:{trim:!0},placeholder:"请输入字段标题",onKeydown:c(f(pe,["prevent"]),["enter"])},null,8,["value","onKeydown"])):p("v-if",!0),h("div",G,[(r(!0),s(m,null,y(oe.value,((l,t)=>(r(),s(m,{key:t},[l.isShow?(r(),s("span",{key:0,class:"table-cell",style:v(u(O)(l,t,e.columnWidthProps))},["checkbox"!==l.type||l.isHeadCheckHide?(r(),s(m,{key:1},[g(x(l.title),1)],64)):(r(),n(u(C),{key:0,checked:l.checkedAll,"onUpdate:checked":[e=>l.checkedAll=e,e=>{return t=e,i=l.field,void de.value.forEach((e=>{V(e,i)||(e[i]=t)}));var t,i}],disabled:l.disabledAll},{default:b((()=>[g(x(l.title),1)])),_:2},1032,["checked","onUpdate:checked","disabled"])),"sortPriority"===l.field?(r(),n(u(W),{key:2,trigger:"hover"},{trigger:b((()=>[k(u(E),{component:u(U),style:{top:"2px"}},null,8,["component"])])),default:b((()=>[L])),_:1})):p("v-if",!0)],4)):p("v-if",!0)],64)))),128))]),h("div",{class:"main-wrapper__table-body",ref_key:"tableBodyRef",ref:le},[(r(),n(u(M),{modelValue:te.value,"onUpdate:modelValue":t[1]||(t[1]=e=>te.value=e),animation:"150","item-key":"id",filter:".disabled",draggable:".item",move:ve,disabled:!e.rowDraggable,key:Z.value},{item:b((({element:e,index:l})=>[e.hide?p("v-if",!0):(r(),s("div",{key:0,class:w(["item",u(R)(e)?"":"disabled"]),tabindex:l},[u(j)(e)?(r(!0),s(m,{key:0},y(e,((e,t)=>(r(),n(P,S(re,{key:t,element:e,idx:l+1,"is-highlight":he(e)}),null,16,["element","idx","is-highlight"])))),128)):(r(),n(P,S({key:1},re,{element:e,idx:l+1,"is-highlight":he(e)}),null,16,["element","idx","is-highlight"]))],10,$))])),_:1},8,["modelValue","disabled"]))],512),e.footerFlag?(r(),s("div",z,[p(" 底部按钮插槽 "),A(l.$slots,"footer",{},(()=>[k(u(D),{onPositiveClick:ce},{trigger:b((()=>[k(u(F),{style:{"margin-right":"8px"}},{default:b((()=>[g("恢复默认设置")])),_:1})])),default:b((()=>[g(" 确认要恢复系统默认设置吗? ")])),_:1}),k(u(F),{style:{"margin-right":"8px"},onClick:ue},{default:b((()=>[g("取消")])),_:1}),k(u(F),{type:"primary",onClick:ne},{default:b((()=>[g("保存")])),_:1})]))])):p("v-if",!0)]))}});export{J as default};
1
+ import{defineComponent as e,ref as l,computed as t,reactive as i,toRef as o,watch as d,openBlock as a,createElementBlock as r,createBlock as s,unref as n,withKeys as u,withModifiers as c,createCommentVNode as f,createElementVNode as p,Fragment as h,renderList as m,normalizeStyle as y,withCtx as v,createTextVNode as b,toDisplayString as g,createVNode as x,normalizeClass as k,mergeProps as w,renderSlot as S}from"vue";import{NInput as C,NCheckbox as A,NTooltip as _,NIcon as W,NPopconfirm as E,NButton as H}from"naive-ui";import D from"../../../shared/components/VueDraggable/src/vuedraggable.js";import F from"./components/table-row.vue.js";import{isArray as M,cloneDeep as P,isString as R,omit as j}from"lodash-es";import{isDisable as B,setStyle as N,isDraggableItem as V,isDraggable as O,getGroupTree as q}from"./utils/index.js";import{uuidGenerator as I}from"../../../shared/utils/index.js";import{HelpCircleSharp as K}from"@vicons/ionicons5";const U={class:"main-wrapper"},T={class:"main-wrapper__table-header"},G=p("span",null,"数值越小,优先级越高",-1),L=["tabindex"],$={key:1,class:"main-wrapper__table-footer"};var z=e({__name:"FieldSet",props:{fields:{type:Array,default:()=>[]},footerFlag:{type:Boolean,default:!0},type:{type:String,default:"old"},isEdit:{type:Boolean,default:!1},showColumnNames:{type:Array},groupSetting:{type:Object},customColumns:{type:Array,default:()=>[]},showSeq:{type:Boolean,default:!1},showSearch:{type:Boolean,default:!1},showSortPriority:{type:Boolean,default:!1},showHeadFilter:{type:Boolean,default:!1},fieldShowMaxValue:{type:Number},rowDraggable:{type:Boolean,default:!0},fieldDescribeMode:{type:String,default:"tooltip"},developMode:{type:Boolean},columnWidthProps:{type:Object},hideExpressionConfig:{type:Object},primaryKey:{type:String,default:"id"},titleRender:{type:Function}},emits:["save","close","reset"],setup(e,{expose:z,emit:J}){const Q=e,X={sid:"id",columnName:"name",isShow:"show",isSort:"sort",isFixed:"fixedWay",colWidth:"columnWidth"},Y=l(Date.now()),Z=l(""),ee=l(),le=l([]),te=[{title:"所有字段",type:"text",field:"title"},{title:"显示",type:"checkbox",checkedAll:!1,disabledAll:!!Q.fieldShowMaxValue,field:"show",fieldShowMaxValue:Q.fieldShowMaxValue},{title:"编辑",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"editable"},{title:"必填",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"required"},{title:"排序",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"sort"},{title:"加粗",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"bold"},{title:"默认排序",type:"select",field:"sortDirection"},{title:"排序优先级",type:"select",field:"sortPriority"},{title:"固定",type:"select",field:"fixedWay"},{title:"自定义标题",type:"input",field:"alias"},{title:"列宽",type:"inputNumber",field:"columnWidth"},{title:"表头筛选",type:"checkbox",isHeadCheckHide:!0,field:"isShowHeaderFilter"},{title:"脱敏配置",type:"select",field:"hideExpression"}],ie=[{title:"搜素",type:"checkbox",isHeadCheckHide:!0,field:"isSearch"},{title:"求和",type:"checkbox",isHeadCheckHide:!0,field:"isSum"},{title:"平均值",type:"checkbox",isHeadCheckHide:!0,field:"isAvg"}],oe=l([]),de=t((()=>le.value.flat())),ae=t((()=>de.value.some((e=>e.feildDescribe)))),re=i({columns:oe,data:de,onUpdateChecked:function({checked:e,column:l}){const t=!e||ye(l.field);l.checkedAll=!t},draggable:Q.rowDraggable,isFieldSet:!0,fieldDescribeMode:Q.fieldDescribeMode,developMode:Q.developMode,columnWidthProps:Q.columnWidthProps,hideExpressionOption:o(Q.hideExpressionConfig||{option:[]},"option"),primaryKey:o(Q,"primaryKey"),titleRender:Q.titleRender}),se={keyword:Z.value,idx:0,startIdx:0},ne=()=>{J("save")},ue=()=>{J("close")};function ce(){le.value=fe(),me(),Y.value=Date.now(),J("reset")}function fe(){const e=P(Q.fields).map((e=>({...e,uuid:I()})));return Object.keys(X).forEach((l=>{e.forEach((e=>{"old"==Q.type&&Reflect.has(e,l)&&("isFixed"==l?e.fixedWay=1==e[l]?"LEFT":2==e[l]?"RIGHT":"NONE":["isShow","isSort"].includes(l)&&"boolean"!=typeof l?e[X[l]]=1==e[l]:e[X[l]]=e[l],Reflect.deleteProperty(e,l)),e.columnWidth=+e.columnWidth||null,Reflect.has(e,"alias")||(e.alias=""),Reflect.has(e,"bold")||(e.bold=!1),e.draggable=!!O(e)}))})),function(e){if(Q.groupSetting){return q(Q.groupSetting,e).reduce(((t,i)=>{const o=R(i)?e.find((e=>e.name===i)):l(i.children);return o&&t.push(o),t}),[])}return e;function l(t){const i=[];return t.forEach((t=>{if(t.children)i.push(...l(t.children));else{const l=e.find((e=>e.name===t));l&&i.push(l)}})),i}}(e)}function pe(){const e=se.keyword!==Z.value;let l=Z.value?de.value.findIndex(((l,t)=>{var i;if(null==(i=l.title)?void 0:i.includes(Z.value))return!!e||t>se.idx})):0;-1!==l||e||(l=se.startIdx),ee.value.scrollTop=52*l,Object.assign(se,{keyword:Z.value,idx:l},e?{startIdx:l}:{})}function he(e){var l;return!!Z.value&&(null==(l=e.title)?void 0:l.includes(Z.value))}function me(){var e,l;oe.value=P(te),(null==(e=Q.showColumnNames)?void 0:e.length)&&(oe.value=te.concat(ie).filter((e=>{var l,t;return"title"===e.field||(null==(t=null==(l=Q.showColumnNames)?void 0:l.includes)?void 0:t.call(l,e.field))}))),(null==(l=Q.customColumns)?void 0:l.length)&&oe.value.push(...Q.customColumns),"column"===Q.fieldDescribeMode&&ae.value&&oe.value.push({title:"字段描述",type:"text",field:"feildDescribe"}),Q.showSeq&&oe.value.splice(1,0,{title:"排序",type:"text",field:"seq"}),oe.value.forEach((e=>{if(e.isShow=function(e){var l;return!(["editable","required"].includes(e.field)&&!Q.isEdit||"sortPriority"===e.field&&!Q.showSortPriority||"isShowHeaderFilter"===e.field&&!Q.showHeadFilter||"hideExpression"===e.field&&!(null==(l=Q.hideExpressionConfig)?void 0:l.show))}(e),"checkbox"===e.type){const l=le.value.flat().every((l=>!Reflect.has(l,e.field)));e.checkedAll=!ye(e.field)&&!l}}))}function ye(e){return le.value.flat().some((l=>!B(l,e)&&!l[e]&&"0001"!=l.id))}function ve(e){return!!V(e.relatedContext.element)}return d([()=>Q.fields,()=>{var e;return null==(e=Q.showColumnNames)?void 0:e.length}],(([e,l])=>{e.length>0&&(le.value=fe(),me())}),{immediate:!0,deep:!0}),z({getTableFields:function(){let e=[];return e="old"==Q.type?de.value.map(((e,l)=>j({...e,field:e.name,visible:e.show,sequence:l,sortable:e.sort,title:e.alias,fixed:e.fixedWay,minWidth:e.columnWidth},["name","show","sort","alias","fixedWay","columnWidth"]))):de.value,e.map((e=>j(e,["uuid"])))}}),(l,t)=>(a(),r("div",U,[e.showSearch?(a(),s(n(C),{key:0,class:"main-wrapper__search-wrapper",value:Z.value,"onUpdate:value":t[0]||(t[0]=e=>Z.value=e),valueModifiers:{trim:!0},placeholder:"请输入字段标题",onKeydown:u(c(pe,["prevent"]),["enter"])},null,8,["value","onKeydown"])):f("v-if",!0),p("div",T,[(a(!0),r(h,null,m(oe.value,((l,t)=>(a(),r(h,{key:t},[l.isShow?(a(),r("span",{key:0,class:"table-cell",style:y(n(N)(l,t,e.columnWidthProps))},["checkbox"!==l.type||l.isHeadCheckHide?(a(),r(h,{key:1},[b(g(l.title),1)],64)):(a(),s(n(A),{key:0,checked:l.checkedAll,"onUpdate:checked":[e=>l.checkedAll=e,e=>{return t=e,i=l.field,void de.value.forEach((e=>{B(e,i)||(e[i]=t)}));var t,i}],disabled:l.disabledAll},{default:v((()=>[b(g(l.title),1)])),_:2},1032,["checked","onUpdate:checked","disabled"])),"sortPriority"===l.field?(a(),s(n(_),{key:2,trigger:"hover"},{trigger:v((()=>[x(n(W),{component:n(K),style:{top:"2px"}},null,8,["component"])])),default:v((()=>[G])),_:1})):f("v-if",!0)],4)):f("v-if",!0)],64)))),128))]),p("div",{class:"main-wrapper__table-body",ref_key:"tableBodyRef",ref:ee},[(a(),s(n(D),{modelValue:le.value,"onUpdate:modelValue":t[1]||(t[1]=e=>le.value=e),animation:"150","item-key":"id",filter:".disabled",draggable:".item",move:ve,disabled:!e.rowDraggable,key:Y.value},{item:v((({element:e,index:l})=>[e.hide?f("v-if",!0):(a(),r("div",{key:0,class:k(["item",n(V)(e)?"":"disabled"]),tabindex:l},[n(M)(e)?(a(!0),r(h,{key:0},m(e,((e,t)=>(a(),s(F,w(re,{key:t,element:e,idx:l+1,"is-highlight":he(e)}),null,16,["element","idx","is-highlight"])))),128)):(a(),s(F,w({key:1},re,{element:e,idx:l+1,"is-highlight":he(e)}),null,16,["element","idx","is-highlight"]))],10,L))])),_:1},8,["modelValue","disabled"]))],512),e.footerFlag?(a(),r("div",$,[f(" 底部按钮插槽 "),S(l.$slots,"footer",{},(()=>[x(n(E),{onPositiveClick:ce},{trigger:v((()=>[x(n(H),{style:{"margin-right":"8px"}},{default:v((()=>[b("恢复默认设置")])),_:1})])),default:v((()=>[b(" 确认要恢复系统默认设置吗? ")])),_:1}),x(n(H),{style:{"margin-right":"8px"},onClick:ue},{default:v((()=>[b("取消")])),_:1}),x(n(H),{type:"primary",onClick:ne},{default:v((()=>[b("保存")])),_:1})]))])):f("v-if",!0)]))}});export{z as default};
@@ -1,4 +1,4 @@
1
- import { PropType, CSSProperties } from 'vue';
1
+ import { PropType, CSSProperties, VNodeChild } from 'vue';
2
2
  import { AnyObject } from '../../../../shared/types';
3
3
  import { FieldSetColumnItem } from '../../../../components/field-set';
4
4
  import { setStyle, setColorInfo } from '../utils';
@@ -90,6 +90,9 @@ declare const _default: import("vue").DefineComponent<{
90
90
  type: StringConstructor;
91
91
  default: string;
92
92
  };
93
+ titleRender: {
94
+ type: PropType<(row: AnyObject) => VNodeChild>;
95
+ };
93
96
  }, {
94
97
  fixedWayOptions: {
95
98
  label: string;
@@ -192,6 +195,9 @@ declare const _default: import("vue").DefineComponent<{
192
195
  type: StringConstructor;
193
196
  default: string;
194
197
  };
198
+ titleRender: {
199
+ type: PropType<(row: AnyObject) => VNodeChild>;
200
+ };
195
201
  }>> & {
196
202
  onUpdateChecked?: ((...args: any[]) => any) | undefined;
197
203
  onEdit?: ((...args: any[]) => any) | undefined;
@@ -322,6 +328,9 @@ declare const _default: import("vue").DefineComponent<{
322
328
  type: StringConstructor;
323
329
  default: string;
324
330
  };
331
+ titleRender: {
332
+ type: PropType<(row: AnyObject) => VNodeChild>;
333
+ };
325
334
  }>> & {
326
335
  onUpdateChecked?: ((...args: any[]) => any) | undefined;
327
336
  onEdit?: ((...args: any[]) => any) | undefined;
@@ -1 +1 @@
1
- import{defineComponent as e,openBlock as l,createElementBlock as t,Fragment as i,renderList as n,normalizeStyle as r,unref as a,createBlock as o,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 O}from"naive-ui";import{setStyle as w,setColorInfo as N,isShowExplicitRequired as j,isDisable as C}from"../utils/index.js";import{ReorderTwoOutline as M,HelpCircleOutline as U,CreateOutline as F,TrashOutline as P}from"@vicons/ionicons5";import{isFunction as _,isArray as A,range as I}from"lodash-es";import{COLOR_MAP as R}from"../constants/index.js";import{WIDGET_TYPE as H,SELECT_MAP as L,WIDGET_MAP as V,SELECT_TYPE as B,SELECT_DEFAULT_MAP as W,DATE_MAP as q,DATETIME_MAP as K}from"../constants/filter.js";const $={class:"row"},G=["title"],z=c("span",null,"拖拽调整顺序",-1),J={key:0};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:()=>[]},primaryKey:{type:String,default:"id"}},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"}],ee=[{label:"字体",value:"font"},{label:"背景",value:"background"}],le=Object.entries(R).map((([e])=>e));function te(){X.data.splice(X.index,1)}function ie(){Q("edit",X.element)}function ne(){var e;return X.element.feildDescribe||(null==(e=X.element.settingObj)?void 0:e.fieldDescDev)}function re(e){return"seq"===e?X.idx:"optionType"===e?X.element[e]&&X.element.type===H.SELECT?L[X.element[e]]:"":"type"===e?V[X.element[e]]:X.element[e]}function ae(e){if("defaultValue"===e){const{optionType:e}=X.element;return e===B.SELECT_MULTIPLE}return!1}function oe(e){if("0001"==X.element.id&&"fixedWay"!=e)return!1;const{isConfiguredHeaderFilter:l}=X.element;return"isShowHeaderFilter"===e?!!l:!(["explicitRequired","defaultValue"].includes(e)&&![H.DATE,H.DATETIME,H.SELECT].includes(X.element.type))}function de(e){return!["explicitRequired","defaultValue"].includes(e)||j(X.element)}function ue(e){if("hideExpression"===e)return"PASSWORD"===X.element.attrType?"密码无需设置":X.element.name===X.primaryKey||X.element.columnName===X.primaryKey?"主键不可设置":X.element[`${e}Disable`]||X.element[`${e}Disabled`]?"不支持脱敏设置":void 0}function se(e){const l={valueField:"value",labelField:"label"};return"hideExpression"===e&&(l.valueField="ruleId",l.labelField="name"),l}function ce(e){var l;switch(e.field){case"fixedWay":return Y;case"sortDirection":return Z;case"sortPriority":return function(){const e=I(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 ee;case"hideExpression":return null==(l=X.hideExpressionOption)?void 0:l.map((e=>({...e,ruleId:`ruleId#${e.code}`})));case"defaultValue":{const{type:e,optionInfo:l}=X.element;return e===H.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===H.DATE?Object.entries(q).map((([e,l])=>({value:e,label:l}))):e===H.DATETIME?Object.entries(K).map((([e,l])=>({value:e,label:l}))):[]}default:return[]}}function fe(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:C(X.element,e.field);if("sortPriority"!==e.field)return!1;const{sortDirection:t}=X.element;return!t||"NONE"===t}function pe(e){return["title","result"].includes(e.field)&&X.element.style||{}}return(j,C)=>(l(),t("div",$,[(l(!0),t(i,null,n(e.columns,((n,j)=>{return l(),t(i,{key:j},[n.isShow?(l(),t("span",{key:0,class:"table-cell",title:e.element[n.field],style:r(a(w)(n,j,e.columnWidthProps))},["text"===n.type?(l(),t(i,{key:0},[0===j?(l(),t(i,{key:0},[!e.isFieldSet||e.draggable&&e.isFieldSet?(l(),o(a(g),{key:0,trigger:"hover"},{trigger:d((()=>[u(a(k),{style:{"margin-right":"5px",top:"2px"},component:a(M)},null,8,["component"])])),default:d((()=>[z])),_:1})):s("v-if",!0),(A=n.field,"title"===A&&("tooltip"===X.fieldDescribeMode&&X.element.feildDescribe||X.developMode&&(null==(I=X.element.settingObj)?void 0:I.fieldDescDev))?(l(),o(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(ne()),1)])),_:1})):s("v-if",!0))],64)):s("v-if",!0),c("span",{class:p([e.isHighlight&&"title"===n.field?"highlight":""]),style:r(pe(n))},f(re(n.field)),7)],64)):s("v-if",!0),"checkbox"===n.type&&oe(n.field)?m((l(),o(a(x),{key:1,disabled:fe(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,de(n.field)]]):s("v-if",!0),"select"===n.type&&oe(n.field)?(l(),t(i,{key:2},[ue(n.field)?(l(),t("span",J,f(ue(n.field)),1)):m((l(),o(a(E),y({key:1},se(n.field),{clearable:"",multiple:ae(n.field),disabled:fe(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&&N(X.element)}(e,n)],options:ce(n)}),null,16,["multiple","disabled","value","onUpdate:value","options"])),[[v,de(n.field)]])],64)):s("v-if",!0),"color"===n.type?(l(),o(a(S),{key:3,class:"c-field-set__color-picker",clearable:"",disabled:fe(n),value:e.element[n.field],"onUpdate:value":[l=>e.element[n.field]=l,C[0]||(C[0]=l=>a(N)(e.element))],"show-preview":"",modes:["hex"],swatches:a(le)},null,8,["disabled","value","onUpdate:value","swatches"])):s("v-if",!0),"input"===n.type?m((l(),o(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(),o(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(_)(n.contentRender)?(l(),o(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:ie},null,8,["component"])])),default:d((()=>[h(" 编辑 ")])),_:1}),u(a(O),{onPositiveClick:te},{trigger:d((()=>[u(a(g),{trigger:"hover"},{trigger:d((()=>[u(a(k),{component:a(P)},null,8,["component"])])),default:d((()=>[h(" 删除 ")])),_:1})])),default:d((()=>[h(" 是否确认删除? ")])),_:1})],64)):s("v-if",!0)],12,G)):s("v-if",!0)],64);var A,I})),128))]))}});export{Q as default};
1
+ import{defineComponent as e,openBlock as t,createElementBlock as l,Fragment as i,renderList as n,normalizeStyle as r,unref as a,createBlock as o,withCtx as d,createVNode as u,createCommentVNode as s,createElementVNode as c,toDisplayString as f,resolveDynamicComponent as p,normalizeClass as m,withDirectives as v,vShow as y,mergeProps as h,createTextVNode as g}from"vue";import{NTooltip as b,NIcon as k,NCheckbox as E,NSelect as x,NColorPicker as S,NInput as D,NInputNumber as T,NPopconfirm as O}from"naive-ui";import{setStyle as R,setColorInfo as w,isShowExplicitRequired as M,isDisable as N}from"../utils/index.js";import{ReorderTwoOutline as P,HelpCircleOutline as U,CreateOutline as j,TrashOutline as A}from"@vicons/ionicons5";import{isFunction as C,isArray as F,range as _}from"lodash-es";import{COLOR_MAP as I}from"../constants/index.js";import{WIDGET_TYPE as H,SELECT_MAP as L,WIDGET_MAP as B,SELECT_TYPE as V,SELECT_DEFAULT_MAP as W,DATE_MAP as q,DATETIME_MAP as K}from"../constants/filter.js";const $={class:"row"},G=["title"],z=c("span",null,"拖拽调整顺序",-1),J={key:0};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:()=>[]},primaryKey:{type:String,default:"id"},titleRender:{type:Function}},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"}],ee=[{label:"字体",value:"font"},{label:"背景",value:"background"}],te=Object.entries(I).map((([e])=>e));function le(){X.data.splice(X.index,1)}function ie(){Q("edit",X.element)}function ne(){var e;return X.element.feildDescribe||(null==(e=X.element.settingObj)?void 0:e.fieldDescDev)}function re(e){return"seq"===e?X.idx:"optionType"===e?X.element[e]&&X.element.type===H.SELECT?L[X.element[e]]:"":"type"===e?B[X.element[e]]:X.element[e]}function ae(e){if("defaultValue"===e){const{optionType:e}=X.element;return e===V.SELECT_MULTIPLE}return!1}function oe(e){if("0001"==X.element.id&&"fixedWay"!=e)return!1;const{isConfiguredHeaderFilter:t}=X.element;return"isShowHeaderFilter"===e?!!t:!(["explicitRequired","defaultValue"].includes(e)&&![H.DATE,H.DATETIME,H.SELECT].includes(X.element.type))}function de(e){return["explicitRequired","defaultValue"].includes(e)?M(X.element):!["isSum","isAvg"].includes(e)||"NUMBER"===X.element.fieldType}function ue(e){if("hideExpression"===e)return"PASSWORD"===X.element.attrType?"密码无需设置":X.element.name===X.primaryKey||X.element.columnName===X.primaryKey?"主键不可设置":X.element[`${e}Disable`]||X.element[`${e}Disabled`]?"不支持脱敏设置":void 0}function se(e){const t={valueField:"value",labelField:"label"};return"hideExpression"===e&&(t.valueField="ruleId",t.labelField="name"),t}function ce(e){var t;switch(e.field){case"fixedWay":return Y;case"sortDirection":return Z;case"sortPriority":return function(){const e=_(1,X.data.length+1).map((e=>({label:e.toString(),value:e}))),t=X.data.filter((e=>!!e.sortPriority&&e.uuid!==X.element.uuid)).map((e=>e.sortPriority));return e.filter((e=>!t.includes(e.value)))}();case"colorScope":return ee;case"hideExpression":return null==(t=X.hideExpressionOption)?void 0:t.map((e=>({...e,ruleId:`ruleId#${e.code}`})));case"defaultValue":{const{type:e,optionInfo:t}=X.element;return e===H.SELECT?F(null==t?void 0:t.list)&&t.list.length>0?t.list.map((e=>({...e,label:e.name}))):Object.entries(W).map((([e,t])=>({value:e,label:t}))):e===H.DATE?Object.entries(q).map((([e,t])=>({value:e,label:t}))):e===H.DATETIME?Object.entries(K).map((([e,t])=>({value:e,label:t}))):[]}default:return[]}}function fe(e){var t;if(1==X.element.defaultMark||"color"===e.type&&X.isHighlightRow)return!0;if("checkbox"===e.type){if("show"===e.field&&e.fieldShowMaxValue)return!X.element[e.field]&&(null==(t=X.data.filter((t=>t[e.field])))?void 0:t.length)===e.fieldShowMaxValue;if(["isSearch","isSum","isAvg"].includes(e.field)){if(Reflect.has(X.element,"isMerge"))return 1==X.element.isMerge;if("isSearch"===e.field&&Reflect.has(X.element,"notParticipatingSearch"))return 1==X.element.notParticipatingSearch}return N(X.element,e.field)}if("sortPriority"===e.field){const{sortDirection:e}=X.element;return!e||"NONE"===e}return N(X.element,e.field)}function pe(e){return["title","result"].includes(e.field)&&X.element.style||{}}return(M,N)=>(t(),l("div",$,[(t(!0),l(i,null,n(e.columns,((n,M)=>{return t(),l(i,{key:M},[n.isShow?(t(),l("span",{key:0,class:"table-cell",title:e.element[n.field],style:r(a(R)(n,M,e.columnWidthProps))},["text"===n.type?(t(),l(i,{key:0},[0===M?(t(),l(i,{key:0},[!e.isFieldSet||e.draggable&&e.isFieldSet?(t(),o(a(b),{key:0,trigger:"hover"},{trigger:d((()=>[u(a(k),{style:{"margin-right":"5px",top:"2px"},component:a(P)},null,8,["component"])])),default:d((()=>[z])),_:1})):s("v-if",!0),(F=n.field,"title"===F&&("tooltip"===X.fieldDescribeMode&&X.element.feildDescribe||X.developMode&&(null==(_=X.element.settingObj)?void 0:_.fieldDescDev))?(t(),o(a(b),{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(ne()),1)])),_:1})):s("v-if",!0)),a(C)(e.titleRender)?(t(),o(p((()=>e.titleRender(e.element))),{key:2})):s("v-if",!0)],64)):s("v-if",!0),0===M&&a(C)(e.titleRender)?s("v-if",!0):(t(),l("span",{key:1,class:m([e.isHighlight&&"title"===n.field?"highlight":""]),style:r(pe(n))},f(re(n.field)),7))],64)):s("v-if",!0),"checkbox"===n.type&&oe(n.field)?v((t(),o(a(E),{key:1,disabled:fe(n),checked:e.element[n.field],"onUpdate:checked":[t=>e.element[n.field]=t,e=>function(e,t){Q("updateChecked",{checked:e,column:t})}(e,n)]},null,8,["disabled","checked","onUpdate:checked"])),[[y,de(n.field)]]):s("v-if",!0),"select"===n.type&&oe(n.field)?(t(),l(i,{key:2},[ue(n.field)?(t(),l("span",J,f(ue(n.field)),1)):v((t(),o(a(x),h({key:1},se(n.field),{clearable:"",multiple:ae(n.field),disabled:fe(n),value:e.element[n.field],"onUpdate:value":[t=>e.element[n.field]=t,e=>function(e,t){"sortDirection"!==t.field||"NONE"!==e&&e||(X.element.sortPriority=null),"colorScope"===t.field&&w(X.element)}(e,n)],options:ce(n)}),null,16,["multiple","disabled","value","onUpdate:value","options"])),[[y,de(n.field)]])],64)):s("v-if",!0),"color"===n.type?(t(),o(a(S),{key:3,class:"c-field-set__color-picker",clearable:"",disabled:fe(n),value:e.element[n.field],"onUpdate:value":[t=>e.element[n.field]=t,N[0]||(N[0]=t=>a(w)(e.element))],"show-preview":"",modes:["hex"],swatches:a(te)},null,8,["disabled","value","onUpdate:value","swatches"])):s("v-if",!0),"input"===n.type?v((t(),o(a(D),{key:4,value:e.element[n.field],"onUpdate:value":t=>e.element[n.field]=t,clearable:""},null,8,["value","onUpdate:value"])),[[y,"0001"!=e.element.id]]):s("v-if",!0),"inputNumber"===n.type?(t(),o(a(T),{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(C)(n.contentRender)?(t(),o(p((()=>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(k),{component:a(j),onClick:ie},null,8,["component"])])),default:d((()=>[g(" 编辑 ")])),_:1}),u(a(O),{onPositiveClick:le},{trigger:d((()=>[u(a(b),{trigger:"hover"},{trigger:d((()=>[u(a(k),{component:a(A)},null,8,["component"])])),default:d((()=>[g(" 删除 ")])),_:1})])),default:d((()=>[g(" 是否确认删除? ")])),_:1})],64)):s("v-if",!0)],12,G)):s("v-if",!0)],64);var F,_})),128))]))}});export{Q as default};
@@ -1,5 +1,5 @@
1
1
  import { AnyObject } from '../../../../shared/types';
2
- import { VNode } from 'vue';
2
+ import { VNodeChild } from 'vue';
3
3
  export type FieldSetItem = Partial<{
4
4
  id: string;
5
5
  name: string;
@@ -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' | 'hideExpression';
21
+ export type FieldSetColumnName = 'show' | 'editable' | 'required' | 'sort' | 'bold' | 'sortDirection' | 'sortPriority' | 'fixedWay' | 'alias' | 'columnWidth' | 'hideExpression' | 'isSearch' | 'isSum' | 'isAvg';
22
22
  export type FieldSetColumnItem = {
23
23
  title: string;
24
24
  type: 'text' | 'checkbox' | 'select' | 'input' | 'inputNumber' | 'color' | 'custom';
@@ -27,7 +27,7 @@ export type FieldSetColumnItem = {
27
27
  disabledAll?: boolean;
28
28
  isHeadCheckHide?: boolean;
29
29
  isShow?: boolean;
30
- contentRender?: (column: AnyObject, row: AnyObject) => VNode | String;
30
+ contentRender?: (column: AnyObject, row: AnyObject) => VNodeChild;
31
31
  [key: string]: any;
32
32
  };
33
33
  export type FieldSetTab = 'field' | 'fieldColor' | 'highlightRow' | 'tableStyle' | 'fieldFilter';
@@ -1 +1 @@
1
- import{isArray as e,isObject as t}from"lodash-es";import{IhoTableRowGroupSequence as n}from"../../../iho-table/src/constants/index.js";import{COLOR_MAP as o}from"../constants/index.js";import{WIDGET_TYPE as i}from"../constants/filter.js";function l(e,t,n){const o={flex:"1 1 90px"};switch(e.type){case"text":0===t&&["title","name"].includes(e.field)&&Object.assign(o,{flex:"1 1 120px",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"}),"seq"===e.field&&(o.flex="1 1 40px");break;case"checkbox":o.flex="1 1 60px";break;case"select":o.flex="1 1 80px";break;case"input":o.flex="1 1 100px"}if(n){const t=Object.keys(n);t.length>0&&t.includes(e.field)&&n[e.field]&&(o.flex=`1 1 ${n[e.field]}px`)}return o}function r(e,t){return["editable","required","show"].includes(t)&&(e[`${t}Disable`]||e[`${t}Disabled`])||["sort"].includes(t)&&(1==e.notParticipatingSort||e.sortDisabled)}function s(o,i,l=(e=>e.name)){const r=i.map((e=>l(e)));return n.some((n=>{const i=o[n];if(!e(i))return!0;i.forEach((n=>{if(!e(n.list)||!n.list.length)return;const o=[];let i=null;n.list.forEach(((e,l)=>{const s=function(e,n,o){return n.findIndex((n=>n!==o&&(t(n)?n.fieldName:n)===e))}(e,r,i);~s&&(o.push(r[s]),0===l?r.splice(s,1,i={fieldName:n.title,children:o}):r.splice(s,1))}))}))})),r}function c(e){return void 0===e.draggable||e.draggable}function f(t){return e(t)?!t.some((e=>!e.draggable)):t.draggable}function a(e){e.style="font"===e.colorScope?{color:e.color}:{background:e.color,color:"#fff"},e.result=o[e.color]}function d(e){const{isShowSearch:t,filterExplicit:n,type:o}=e;return t&&n&&[i.DATE,i.DATETIME,i.SELECT].includes(o)}export{s as getGroupTree,r as isDisable,c as isDraggable,f as isDraggableItem,d as isShowExplicitRequired,a as setColorInfo,l as setStyle};
1
+ import{isArray as e,isObject as t}from"lodash-es";import{IhoTableRowGroupSequence as i}from"../../../iho-table/src/constants/index.js";import{COLOR_MAP as o}from"../constants/index.js";import{WIDGET_TYPE as n}from"../constants/filter.js";function r(e,t,i){const o={flex:"1 1 90px"};switch(e.type){case"text":0===t&&["title","name"].includes(e.field)&&Object.assign(o,{flex:"1 1 120px",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"}),"seq"===e.field&&(o.flex="1 1 40px");break;case"checkbox":o.flex="1 1 60px";break;case"select":o.flex="1 1 80px";break;case"input":o.flex="1 1 100px"}if(i){const t=Object.keys(i);t.length>0&&t.includes(e.field)&&i[e.field]&&(o.flex=`1 1 ${i[e.field]}px`)}return o}function l(e,t){return["editable","required","show","sortDirection","fixedWay","isSearch","isSum","isAvg"].includes(t)&&(e[`${t}Disable`]||e[`${t}Disabled`])||["sort"].includes(t)&&(1==e.notParticipatingSort||e.sortDisabled)}function s(o,n,r=(e=>e.name)){const l=n.map((e=>r(e)));return i.some((i=>{const n=o[i];if(!e(n))return!0;n.forEach((i=>{if(!e(i.list)||!i.list.length)return;const o=[];let n=null;i.list.forEach(((e,r)=>{const s=function(e,i,o){return i.findIndex((i=>i!==o&&(t(i)?i.fieldName:i)===e))}(e,l,n);~s&&(o.push(l[s]),0===r?l.splice(s,1,n={fieldName:i.title,children:o}):l.splice(s,1))}))}))})),l}function c(e){return void 0===e.draggable||e.draggable}function f(t){return e(t)?!t.some((e=>!e.draggable)):t.draggable}function a(e){e.style="font"===e.colorScope?{color:e.color}:{background:e.color,color:"#fff"},e.result=o[e.color]}function d(e){const{isShowSearch:t,filterExplicit:i,type:o}=e;return t&&i&&[n.DATE,n.DATETIME,n.SELECT].includes(o)}export{s as getGroupTree,l as isDisable,c as isDraggable,f as isDraggableItem,d as isShowExplicitRequired,a as setColorInfo,r as setStyle};