cnhis-design-vue 3.1.53 → 3.1.54-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/README.md +87 -87
  2. package/es/components/button-print/src/ButtonPrint.vue.d.ts +3 -1
  3. package/es/components/callback/src/components/render/popupMaps.d.ts +2 -0
  4. package/es/components/expand-field/src/components/form.vue2.js +1 -1
  5. package/es/components/fabric-chart/index.d.ts +8 -9
  6. package/es/components/fabric-chart/src/FabricChart.vue.d.ts +8 -9
  7. package/es/components/fabric-chart/src/FabricChart.vue2.js +1 -1
  8. package/es/components/fabric-chart/src/hooks/electrocardiogram/constants/index.d.ts +2 -0
  9. package/es/components/fabric-chart/src/hooks/electrocardiogram/constants/index.js +1 -0
  10. package/es/components/fabric-chart/src/hooks/electrocardiogram/hooks/index.d.ts +1 -0
  11. package/es/components/fabric-chart/src/hooks/electrocardiogram/hooks/index.js +1 -0
  12. package/es/components/fabric-chart/src/hooks/electrocardiogram/hooks/useDetailEvent.d.ts +11 -0
  13. package/es/components/fabric-chart/src/hooks/electrocardiogram/hooks/useDetailEvent.js +1 -0
  14. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogram.d.ts +6 -0
  15. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogram.js +1 -0
  16. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogramChart.d.ts +11 -0
  17. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogramChart.js +1 -0
  18. package/es/components/fabric-chart/src/hooks/electrocardiogram/useMeasureInstrument.d.ts +9 -0
  19. package/es/components/fabric-chart/src/hooks/electrocardiogram/useMeasureInstrument.js +1 -0
  20. package/es/components/fabric-chart/src/hooks/index.d.ts +1 -0
  21. package/es/components/fabric-chart/src/hooks/index.js +1 -1
  22. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
  23. package/es/components/fabric-chart/src/interface.d.ts +1 -1
  24. package/es/components/field-set/index.d.ts +12 -2
  25. package/es/components/field-set/src/FieldSet.vue.d.ts +13 -3
  26. package/es/components/field-set/src/FieldSet.vue2.js +1 -1
  27. package/es/components/field-set/src/components/Row.vue.d.ts +2 -3
  28. package/es/components/field-set/src/components/Row.vue2.js +1 -1
  29. package/es/components/field-set/src/types/index.d.ts +1 -0
  30. package/es/components/field-set/style/index.css +1 -1
  31. package/es/components/form-config/index.d.ts +3 -0
  32. package/es/components/form-config/src/FormConfig.vue.d.ts +4 -0
  33. package/es/components/form-config/src/FormConfig.vue2.js +1 -1
  34. package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +1 -0
  35. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +1 -0
  36. package/es/components/form-render/index.d.ts +1 -0
  37. package/es/components/form-render/src/FormRender.vue.d.ts +2 -1
  38. package/es/components/form-render/src/FormRender.vue2.js +1 -1
  39. package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +1 -0
  40. package/es/components/form-render/src/components/renderer/inputNumber.js +1 -1
  41. package/es/components/form-render/src/components/renderer/remoteSearch.js +1 -1
  42. package/es/components/form-render/src/components/renderer/select.d.ts +7 -0
  43. package/es/components/form-render/src/components/renderer/select.js +1 -1
  44. package/es/components/form-render/src/hooks/useFormRenderOptions.d.ts +4 -3
  45. package/es/components/form-render/src/hooks/useFormRenderOptions.js +1 -1
  46. package/es/components/form-render/src/utils/business.js +1 -1
  47. package/es/components/iho-table/index.d.ts +1 -0
  48. package/es/components/iho-table/src/IhoTable.vue.d.ts +2 -1
  49. package/es/components/iho-table/src/IhoTable.vue2.js +1 -1
  50. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.d.ts +13 -8
  51. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +1 -1
  52. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/editTime.vue.d.ts +15 -2
  53. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/editTime.vue2.js +1 -1
  54. package/es/components/index.css +1 -1
  55. package/es/components/index.js +1 -1
  56. package/es/components/info-header/index.d.ts +3 -0
  57. package/es/components/info-header/src/InfoHeader.vue.d.ts +17 -13
  58. package/es/components/info-header/src/InfoHeader.vue2.js +1 -1
  59. package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +1 -0
  60. package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +1 -0
  61. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  62. package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
  63. package/es/components/select-person/src/SearchMultiple.vue.d.ts +6 -0
  64. package/es/components/shortcut-provider/index.d.ts +1 -0
  65. package/es/components/shortcut-provider/src/ShortcutProvider.vue.d.ts +2 -0
  66. package/es/components/shortcut-provider/src/ShortcutProvider.vue2.js +1 -1
  67. package/es/components/shortcut-setter/index.d.ts +2 -0
  68. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +8 -5
  69. package/es/components/shortcut-setter/src/ShortcutSetter.vue2.js +1 -1
  70. package/es/components/table-export-field/src/components/ExportModal.vue.d.ts +0 -3
  71. package/es/env.d.ts +25 -25
  72. package/es/shared/assets/img/failure.png.js +1 -1
  73. package/es/shared/assets/img/no-permission.png.js +1 -1
  74. package/es/shared/assets/img/nodata.png.js +1 -1
  75. package/es/shared/assets/img/notfound.png.js +1 -1
  76. package/es/shared/assets/img/qr.png.js +1 -1
  77. package/es/shared/assets/img/success.png.js +1 -1
  78. package/es/shared/assets/img/video.png.js +1 -1
  79. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  80. package/es/shared/assets/img/xb_big.png.js +1 -1
  81. package/es/shared/assets/img/xb_small.png.js +1 -1
  82. package/es/shared/hooks/index.d.ts +1 -0
  83. package/es/shared/hooks/index.js +1 -1
  84. package/es/shared/hooks/selectHooks/useOptionFiltered.d.ts +8 -3
  85. package/es/shared/hooks/selectHooks/useOptionFiltered.js +1 -1
  86. package/es/shared/hooks/useVersion.d.ts +3 -0
  87. package/es/shared/hooks/useVersion.js +1 -0
  88. package/es/shared/package.json.js +1 -1
  89. package/es/shared/types/index.d.ts +1 -0
  90. package/package.json +2 -2
  91. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  92. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
  93. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
  94. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
  95. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
  96. package/es/shared/utils/fabricjs/index.d.ts +0 -6823
  97. package/es/shared/utils/tapable/index.d.ts +0 -139
@@ -1,6 +1,6 @@
1
1
  /// <reference types="lodash" />
2
2
  import { PropType } from 'vue';
3
- import { setStyle, isDisable, isDraggableItem } from './utils';
3
+ import { setStyle, isDraggableItem } from './utils';
4
4
  import { FieldSetItem, FieldSetColumnName, FieldSetColumnItem } from '../../../../es/components/field-set/src/types';
5
5
  import { AnyObject } from '../../../../es/shared/types';
6
6
  declare const _default: import("vue").DefineComponent<{
@@ -63,6 +63,9 @@ declare const _default: import("vue").DefineComponent<{
63
63
  type: BooleanConstructor;
64
64
  default: boolean;
65
65
  };
66
+ fieldShowMaxValue: {
67
+ type: NumberConstructor;
68
+ };
66
69
  }, {
67
70
  fieldsMapping: Record<string, string>;
68
71
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -125,6 +128,9 @@ declare const _default: import("vue").DefineComponent<{
125
128
  type: BooleanConstructor;
126
129
  default: boolean;
127
130
  };
131
+ fieldShowMaxValue: {
132
+ type: NumberConstructor;
133
+ };
128
134
  }>> & {
129
135
  onReset?: ((...args: any[]) => any) | undefined;
130
136
  onClose?: ((...args: any[]) => any) | undefined;
@@ -137,6 +143,7 @@ declare const _default: import("vue").DefineComponent<{
137
143
  tableBodyRef: import("vue").Ref<HTMLDivElement | undefined>;
138
144
  newFields: import("vue").Ref<AnyObject[]>;
139
145
  columns: import("vue").Ref<{
146
+ [x: string]: any;
140
147
  title: string;
141
148
  type: "custom" | "text" | "checkbox" | "select" | "input" | "inputNumber";
142
149
  field: string;
@@ -151,6 +158,7 @@ declare const _default: import("vue").DefineComponent<{
151
158
  fieldList: import("vue").ComputedRef<AnyObject[]>;
152
159
  rowProps: {
153
160
  columns: {
161
+ [x: string]: any;
154
162
  title: string;
155
163
  type: "custom" | "text" | "checkbox" | "select" | "input" | "inputNumber";
156
164
  field: string;
@@ -419,7 +427,7 @@ declare const _default: import("vue").DefineComponent<{
419
427
  label: string;
420
428
  value: number;
421
429
  }[];
422
- setDisabled: (column: AnyObject) => boolean;
430
+ setDisabled: (column: AnyObject) => any;
423
431
  onUpdateChecked: (checked: boolean, column: AnyObject) => void;
424
432
  handleUpdateSelect: (value: string, column: AnyObject) => void;
425
433
  NCheckbox: any;
@@ -429,7 +437,6 @@ declare const _default: import("vue").DefineComponent<{
429
437
  NTooltip: any;
430
438
  NIcon: any;
431
439
  setStyle: typeof setStyle;
432
- isDisable: typeof isDisable;
433
440
  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<{}>>, {}>;
434
441
  isFunction: (value: any) => value is (...args: any[]) => any;
435
442
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "updateChecked"[], "updateChecked", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
@@ -596,6 +603,9 @@ declare const _default: import("vue").DefineComponent<{
596
603
  type: BooleanConstructor;
597
604
  default: boolean;
598
605
  };
606
+ fieldShowMaxValue: {
607
+ type: NumberConstructor;
608
+ };
599
609
  }>> & {
600
610
  onReset?: ((...args: any[]) => any) | undefined;
601
611
  onClose?: ((...args: any[]) => any) | undefined;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as l,computed as t,reactive as i,watch as o,openBlock as d,createElementBlock as a,normalizeStyle as r,createBlock as s,unref as n,withKeys as u,withModifiers as c,createCommentVNode as f,createElementVNode as h,Fragment as p,renderList as m,withCtx as y,createTextVNode as v,toDisplayString as b,createVNode as k,normalizeClass as g,mergeProps as x,renderSlot as w}from"vue";import{useThemeVars as S,NInput as A,NCheckbox as _,NTooltip as C,NIcon as F,NPopconfirm as W,NButton as E}from"naive-ui";import H from"../../../shared/components/VueDraggable/src/vuedraggable.js";import P from"./components/Row.vue.js";import{isArray as q,cloneDeep as N,isString as R,omit as j}from"lodash-es";import{isDisable as B,setStyle as I,isDraggableItem as U,isDraggable as D,getGroupTree as O}from"./utils/index.js";import{uuidGenerator as T}from"../../../shared/utils/index.js";import{HelpCircleSharp as V}from"@vicons/ionicons5";const K={class:"c-field-set__table-header"},L=h("span",null,"数值越小,优先级越高",-1),G=["tabindex"],M={key:1,class:"c-field-set__table-footer"};var $=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}},emits:["save","close","reset"],setup(e,{expose:$,emit:z}){const J=e,Q={sid:"id",columnName:"name",isShow:"show",isSort:"sort",isFixed:"fixedWay",colWidth:"columnWidth"},X=l(S().value.primaryColor),Y=l(""),Z=l(),ee=l([]),le=l([{title:"所有字段",type:"text",field:"title"},{title:"显示",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"show"},{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"}]),te=t((()=>ee.value.flat())),ie=i({columns:le,fieldList:te,onUpdateChecked:function({checked:e,column:l}){const t=!e||he(l.field);l.checkedAll=!t}}),oe={keyword:Y.value,idx:0,startIdx:0},de=()=>{z("save",{tableFields:ne()})},ae=()=>{z("close")};function re(){ee.value=se(),fe(),z("reset")}function se(){const e=N(J.fields).map((e=>({...e,uuid:T()})));return Object.keys(Q).forEach((l=>{e.forEach((e=>{"old"==J.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[Q[l]]=1==e[l]:e[Q[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=!!D(e)}))})),function(e){if(J.groupSetting){return O(J.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 ne(){let e=[];return e="old"==J.type?te.value.map(((e,l)=>({id:e.id,field:e.name,visible:e.show,sequence:l,sortable:e.sort,title:e.alias,fixed:e.fixedWay,minWidth:e.columnWidth,bold:e.bold,sortDirection:e.sortDirection,sortPriority:e.sortPriority,...J.isEdit?{required:e.required,editable:e.editable}:{}}))):te.value,e.map((e=>j(e,["uuid"])))}function ue(){const e=oe.keyword!==Y.value;let l=Y.value?te.value.findIndex(((l,t)=>{var i;if(null==(i=l.title)?void 0:i.includes(Y.value))return!!e||t>oe.idx})):0;-1!==l||e||(l=oe.startIdx),Z.value.scrollTop=52*l,Object.assign(oe,{keyword:Y.value,idx:l},e?{startIdx:l}:{})}function ce(e){var l;return!!Y.value&&(null==(l=e.title)?void 0:l.includes(Y.value))}function fe(){var e,l;(null==(e=J.showColumnNames)?void 0:e.length)&&(le.value=le.value.filter((e=>{var l,t;return"title"===e.field||(null==(t=null==(l=J.showColumnNames)?void 0:l.includes)?void 0:t.call(l,e.field))}))),(null==(l=J.customColumns)?void 0:l.length)&&le.value.push(...J.customColumns),J.showSeq&&le.value.splice(1,0,{title:"排序",type:"text",field:"seq"}),le.value.forEach((e=>{if(e.isShow=function(e){return!(["editable","required"].includes(e.field)&&!J.isEdit||"sortPriority"===e.field&&!J.showSortPriority||"isShowHeaderFilter"===e.field&&!J.showHeadFilter)}(e),"checkbox"===e.type){const l=ee.value.flat().every((l=>!Reflect.has(l,e.field)));e.checkedAll=!he(e.field)&&!l}}))}function he(e){return ee.value.flat().some((l=>!B(l,e)&&!l[e]&&"0001"!=l.id))}function pe(e){return!!U(e.relatedContext.element)}return o([()=>J.fields,()=>{var e;return null==(e=J.showColumnNames)?void 0:e.length}],(([e,l])=>{e.length>0&&(ee.value=se(),fe())}),{immediate:!0,deep:!0}),$({getTableFields:ne}),(l,t)=>(d(),a("div",{class:"c-field-set",style:r({"--row-height":"52px","--primary-color":X.value})},[e.showSearch?(d(),s(n(A),{key:0,class:"c-field-set__search-wrapper",value:Y.value,"onUpdate:value":t[0]||(t[0]=e=>Y.value=e),valueModifiers:{trim:!0},placeholder:"请输入字段标题",onKeydown:u(c(ue,["prevent"]),["enter"])},null,8,["value","onKeydown"])):f("v-if",!0),h("div",K,[(d(!0),a(p,null,m(le.value,((e,l)=>(d(),a(p,{key:l},[e.isShow?(d(),a("span",{key:0,class:"table-cell",style:r(n(I)(e))},["checkbox"!==e.type||e.isHeadCheckHide?(d(),a(p,{key:1},[v(b(e.title),1)],64)):(d(),s(n(_),{key:0,checked:e.checkedAll,"onUpdate:checked":[l=>e.checkedAll=l,l=>{return t=l,i=e.field,void te.value.forEach((e=>{B(e,i)||(e[i]=t)}));var t,i}],disabled:e.disabledAll},{default:y((()=>[v(b(e.title),1)])),_:2},1032,["checked","onUpdate:checked","disabled"])),"sortPriority"===e.field?(d(),s(n(C),{key:2,trigger:"hover"},{trigger:y((()=>[k(n(F),{component:n(V),style:{top:"2px"}},null,8,["component"])])),default:y((()=>[L])),_:1})):f("v-if",!0)],4)):f("v-if",!0)],64)))),128))]),h("div",{class:"c-field-set__table-body",ref_key:"tableBodyRef",ref:Z},[k(n(H),{modelValue:ee.value,"onUpdate:modelValue":t[1]||(t[1]=e=>ee.value=e),animation:"150","item-key":"id",filter:".disabled",draggable:".item",move:pe},{item:y((({element:e,index:l})=>[e.hide?f("v-if",!0):(d(),a("div",{key:0,class:g(["item",n(U)(e)?"":"disabled"]),tabindex:l},[n(q)(e)?(d(!0),a(p,{key:0},m(e,((e,t)=>(d(),s(P,x(ie,{key:t,element:e,idx:l+1,"is-highlight":ce(e)}),null,16,["element","idx","is-highlight"])))),128)):(d(),s(P,x({key:1},ie,{element:e,idx:l+1,"is-highlight":ce(e)}),null,16,["element","idx","is-highlight"]))],10,G))])),_:1},8,["modelValue"])],512),e.footerFlag?(d(),a("div",M,[f(" 底部按钮插槽 "),w(l.$slots,"footer",{},(()=>[k(n(W),{onPositiveClick:re},{trigger:y((()=>[k(n(E),{style:{"margin-right":"8px"}},{default:y((()=>[v("恢复默认设置")])),_:1})])),default:y((()=>[v(" 确认要恢复系统默认设置吗? ")])),_:1}),k(n(E),{style:{"margin-right":"8px"},onClick:ae},{default:y((()=>[v("取消")])),_:1}),k(n(E),{type:"primary",onClick:de},{default:y((()=>[v("保存")])),_:1})]))])):f("v-if",!0)],4))}});export{$ as default};
1
+ import{defineComponent as e,ref as l,computed as t,reactive as i,watch as o,openBlock as d,createElementBlock as a,normalizeStyle as r,createBlock as s,unref as n,withKeys as u,withModifiers as c,createCommentVNode as f,createElementVNode as h,Fragment as p,renderList as m,withCtx as y,createTextVNode as v,toDisplayString as b,createVNode as k,normalizeClass as x,mergeProps as g,renderSlot as w}from"vue";import{useThemeVars as S,NInput as A,NCheckbox as _,NTooltip as C,NIcon as F,NPopconfirm as W,NButton as E}from"naive-ui";import H from"../../../shared/components/VueDraggable/src/vuedraggable.js";import N from"./components/Row.vue.js";import{isArray as P,cloneDeep as q,isString as R,omit as V}from"lodash-es";import{isDisable as j,setStyle as B,isDraggableItem as I,isDraggable as M,getGroupTree as U}from"./utils/index.js";import{uuidGenerator as D}from"../../../shared/utils/index.js";import{HelpCircleSharp as O}from"@vicons/ionicons5";const T={class:"c-field-set__table-header"},K=h("span",null,"数值越小,优先级越高",-1),L=["tabindex"],G={key:1,class:"c-field-set__table-footer"};var $=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}},emits:["save","close","reset"],setup(e,{expose:$,emit:z}){const J=e,Q={sid:"id",columnName:"name",isShow:"show",isSort:"sort",isFixed:"fixedWay",colWidth:"columnWidth"},X=l(S().value.primaryColor),Y=l(""),Z=l(),ee=l([]),le=l([{title:"所有字段",type:"text",field:"title"},{title:"显示",type:"checkbox",checkedAll:!1,disabledAll:!!J.fieldShowMaxValue,field:"show",fieldShowMaxValue:J.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"}]),te=t((()=>ee.value.flat())),ie=i({columns:le,fieldList:te,onUpdateChecked:function({checked:e,column:l}){const t=!e||he(l.field);l.checkedAll=!t}}),oe={keyword:Y.value,idx:0,startIdx:0},de=()=>{z("save",{tableFields:ne()})},ae=()=>{z("close")};function re(){ee.value=se(),fe(),z("reset")}function se(){const e=q(J.fields).map((e=>({...e,uuid:D()})));return Object.keys(Q).forEach((l=>{e.forEach((e=>{"old"==J.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[Q[l]]=1==e[l]:e[Q[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=!!M(e)}))})),function(e){if(J.groupSetting){return U(J.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 ne(){let e=[];return e="old"==J.type?te.value.map(((e,l)=>({id:e.id,field:e.name,visible:e.show,sequence:l,sortable:e.sort,title:e.alias,fixed:e.fixedWay,minWidth:e.columnWidth,bold:e.bold,sortDirection:e.sortDirection,sortPriority:e.sortPriority,...J.isEdit?{required:e.required,editable:e.editable}:{}}))):te.value,e.map((e=>V(e,["uuid"])))}function ue(){const e=oe.keyword!==Y.value;let l=Y.value?te.value.findIndex(((l,t)=>{var i;if(null==(i=l.title)?void 0:i.includes(Y.value))return!!e||t>oe.idx})):0;-1!==l||e||(l=oe.startIdx),Z.value.scrollTop=52*l,Object.assign(oe,{keyword:Y.value,idx:l},e?{startIdx:l}:{})}function ce(e){var l;return!!Y.value&&(null==(l=e.title)?void 0:l.includes(Y.value))}function fe(){var e,l;(null==(e=J.showColumnNames)?void 0:e.length)&&(le.value=le.value.filter((e=>{var l,t;return"title"===e.field||(null==(t=null==(l=J.showColumnNames)?void 0:l.includes)?void 0:t.call(l,e.field))}))),(null==(l=J.customColumns)?void 0:l.length)&&le.value.push(...J.customColumns),J.showSeq&&le.value.splice(1,0,{title:"排序",type:"text",field:"seq"}),le.value.forEach((e=>{if(e.isShow=function(e){return!(["editable","required"].includes(e.field)&&!J.isEdit||"sortPriority"===e.field&&!J.showSortPriority||"isShowHeaderFilter"===e.field&&!J.showHeadFilter)}(e),"checkbox"===e.type){const l=ee.value.flat().every((l=>!Reflect.has(l,e.field)));e.checkedAll=!he(e.field)&&!l}}))}function he(e){return ee.value.flat().some((l=>!j(l,e)&&!l[e]&&"0001"!=l.id))}function pe(e){return!!I(e.relatedContext.element)}return o([()=>J.fields,()=>{var e;return null==(e=J.showColumnNames)?void 0:e.length}],(([e,l])=>{e.length>0&&(ee.value=se(),fe())}),{immediate:!0,deep:!0}),$({getTableFields:ne}),(l,t)=>(d(),a("div",{class:"c-field-set",style:r({"--row-height":"52px","--primary-color":X.value})},[e.showSearch?(d(),s(n(A),{key:0,class:"c-field-set__search-wrapper",value:Y.value,"onUpdate:value":t[0]||(t[0]=e=>Y.value=e),valueModifiers:{trim:!0},placeholder:"请输入字段标题",onKeydown:u(c(ue,["prevent"]),["enter"])},null,8,["value","onKeydown"])):f("v-if",!0),h("div",T,[(d(!0),a(p,null,m(le.value,((e,l)=>(d(),a(p,{key:l},[e.isShow?(d(),a("span",{key:0,class:"table-cell",style:r(n(B)(e))},["checkbox"!==e.type||e.isHeadCheckHide?(d(),a(p,{key:1},[v(b(e.title),1)],64)):(d(),s(n(_),{key:0,checked:e.checkedAll,"onUpdate:checked":[l=>e.checkedAll=l,l=>{return t=l,i=e.field,void te.value.forEach((e=>{j(e,i)||(e[i]=t)}));var t,i}],disabled:e.disabledAll},{default:y((()=>[v(b(e.title),1)])),_:2},1032,["checked","onUpdate:checked","disabled"])),"sortPriority"===e.field?(d(),s(n(C),{key:2,trigger:"hover"},{trigger:y((()=>[k(n(F),{component:n(O),style:{top:"2px"}},null,8,["component"])])),default:y((()=>[K])),_:1})):f("v-if",!0)],4)):f("v-if",!0)],64)))),128))]),h("div",{class:"c-field-set__table-body",ref_key:"tableBodyRef",ref:Z},[k(n(H),{modelValue:ee.value,"onUpdate:modelValue":t[1]||(t[1]=e=>ee.value=e),animation:"150","item-key":"id",filter:".disabled",draggable:".item",move:pe},{item:y((({element:e,index:l})=>[e.hide?f("v-if",!0):(d(),a("div",{key:0,class:x(["item",n(I)(e)?"":"disabled"]),tabindex:l},[n(P)(e)?(d(!0),a(p,{key:0},m(e,((e,t)=>(d(),s(N,g(ie,{key:t,element:e,idx:l+1,"is-highlight":ce(e)}),null,16,["element","idx","is-highlight"])))),128)):(d(),s(N,g({key:1},ie,{element:e,idx:l+1,"is-highlight":ce(e)}),null,16,["element","idx","is-highlight"]))],10,L))])),_:1},8,["modelValue"])],512),e.footerFlag?(d(),a("div",G,[f(" 底部按钮插槽 "),w(l.$slots,"footer",{},(()=>[k(n(W),{onPositiveClick:re},{trigger:y((()=>[k(n(E),{style:{"margin-right":"8px"}},{default:y((()=>[v("恢复默认设置")])),_:1})])),default:y((()=>[v(" 确认要恢复系统默认设置吗? ")])),_:1}),k(n(E),{style:{"margin-right":"8px"},onClick:ae},{default:y((()=>[v("取消")])),_:1}),k(n(E),{type:"primary",onClick:de},{default:y((()=>[v("保存")])),_:1})]))])):f("v-if",!0)],4))}});export{$ as default};
@@ -1,7 +1,7 @@
1
1
  import { PropType } from 'vue';
2
2
  import { AnyObject } from '../../../../../es/shared/types';
3
3
  import { FieldSetItem, FieldSetColumnItem } from '../../../../../es/components/field-set';
4
- import { setStyle, isDisable } from '../utils';
4
+ import { setStyle } from '../utils';
5
5
  declare const _default: import("vue").DefineComponent<{
6
6
  element: {
7
7
  type: PropType<Partial<{
@@ -135,7 +135,7 @@ declare const _default: import("vue").DefineComponent<{
135
135
  label: string;
136
136
  value: number;
137
137
  }[];
138
- setDisabled: (column: AnyObject) => boolean;
138
+ setDisabled: (column: AnyObject) => any;
139
139
  onUpdateChecked: (checked: boolean, column: AnyObject) => void;
140
140
  handleUpdateSelect: (value: string, column: AnyObject) => void;
141
141
  NCheckbox: any;
@@ -145,7 +145,6 @@ declare const _default: import("vue").DefineComponent<{
145
145
  NTooltip: any;
146
146
  NIcon: any;
147
147
  setStyle: typeof setStyle;
148
- isDisable: typeof isDisable;
149
148
  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<{}>>, {}>;
150
149
  isFunction: (value: any) => value is (...args: any[]) => any;
151
150
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "updateChecked"[], "updateChecked", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
@@ -1 +1 @@
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 f,normalizeClass as c,toDisplayString as m,withDirectives as p,vShow as v,resolveDynamicComponent as y}from"vue";import{NTooltip as h,NIcon as b,NCheckbox as k,NSelect as g,NInput as x,NInputNumber as N}from"naive-ui";import{setStyle as U,isDisable as E}from"../utils/index.js";import{ReorderTwoOutline as w}from"@vicons/ionicons5";import{isFunction as C,range as H}from"lodash-es";const O={class:"row"},P=["title"],S=f("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:()=>[]},isHighlight:{type:Boolean}},emits:["updateChecked"],setup(e,{emit:D}){const L=e,R=[{label:"不固定",value:"NONE"},{label:"左固定",value:"LEFT"},{label:"右固定",value:"RIGHT"}],A=[{label:"不排序",value:"NONE"},{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}];function F(e){switch(e.field){case"fixedWay":return R;case"sortDirection":return A;case"sortPriority":return function(){const e=H(1,L.fieldList.length+1).map((e=>({label:e.toString(),value:e}))),t=L.fieldList.filter((e=>!!e.sortPriority&&e.uuid!==L.element.uuid)).map((e=>e.sortPriority));return e.filter((e=>!t.includes(e.value)))}();default:return[]}}function _(e){if("sortPriority"!==e.field)return!1;const{sortDirection:t}=L.element;return!t||"NONE"===t}return(H,R)=>(t(),l("div",O,[(t(!0),l(i,null,n(e.columns,((n,H)=>{return t(),l(i,{key:H},[n.isShow?(t(),l("span",{key:0,class:"table-cell",title:e.element[n.field],style:r(a(U)(n))},["text"===n.type?(t(),l(i,{key:0},[0===H?(t(),o(a(h),{key:0,trigger:"hover"},{trigger:d((()=>[u(a(b),{style:{"margin-right":"5px",top:"2px"},component:a(w)},null,8,["component"])])),default:d((()=>[S])),_:1})):s("v-if",!0),f("span",{class:c([e.isHighlight&&"title"===n.field?"highlight":""])},m("seq"===n.field?e.idx:e.element[n.field]),3)],64)):s("v-if",!0),"checkbox"===n.type?p((t(),o(a(k),{key:1,disabled:a(E)(e.element,n.field),checked:e.element[n.field],"onUpdate:checked":[t=>e.element[n.field]=t,e=>function(e,t){D("updateChecked",{checked:e,column:t})}(e,n)]},null,8,["disabled","checked","onUpdate:checked"])),[[v,(O=e.element,R=n.field,"isShowHeaderFilter"===R?O.isConfiguredHeaderFilter&&"0001"!=L.element.id:"0001"!=L.element.id)]]):s("v-if",!0),"select"===n.type?p((t(),o(a(g),{key:2,clearable:"",disabled:_(n),value:e.element[n.field],"onUpdate:value":[t=>e.element[n.field]=t,e=>function(e,t){"sortDirection"===t.field&&"NONE"===e&&(L.element.sortPriority=null)}(e,n)],options:F(n)},null,8,["disabled","value","onUpdate:value","options"])),[[v,"fixedWay"===n.field||"0001"!=e.element.id]]):s("v-if",!0),"input"===n.type?p((t(),o(a(x),{key:3,value:e.element[n.field],"onUpdate:value":t=>e.element[n.field]=t,clearable:""},null,8,["value","onUpdate:value"])),[[v,"0001"!=e.element.id]]):s("v-if",!0),"inputNumber"===n.type?(t(),o(a(N),{key:4,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(y((()=>n.contentRender(n,e.element))),{key:5})):s("v-if",!0)],12,P)):s("v-if",!0)],64);var O,R})),128))]))}});export{D as default};
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 d,withCtx as o,createVNode as u,createCommentVNode as f,createElementVNode as s,normalizeClass as c,toDisplayString as m,withDirectives as p,vShow as v,resolveDynamicComponent as y}from"vue";import{NTooltip as h,NIcon as b,NCheckbox as k,NSelect as g,NInput as x,NInputNumber as N}from"naive-ui";import{setStyle as w,isDisable as U}from"../utils/index.js";import{ReorderTwoOutline as S}from"@vicons/ionicons5";import{isFunction as E,range as C}from"lodash-es";const H={class:"row"},L=["title"],O=s("span",null,"拖拽调整顺序",-1);var P=e({__name:"Row",props:{element:{type:Object,default:()=>({})},columns:{type:Array,default:()=>[]},idx:{type:Number,default:1},fieldList:{type:Array,default:()=>[]},isHighlight:{type:Boolean}},emits:["updateChecked"],setup(e,{emit:P}){const D=e,R=[{label:"不固定",value:"NONE"},{label:"左固定",value:"LEFT"},{label:"右固定",value:"RIGHT"}],A=[{label:"不排序",value:"NONE"},{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}];function F(e){switch(e.field){case"fixedWay":return R;case"sortDirection":return A;case"sortPriority":return function(){const e=C(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){var l;if("checkbox"===e.type)return"show"===e.field&&e.fieldShowMaxValue?!D.element[e.field]&&(null==(l=D.fieldList.filter((l=>l[e.field])))?void 0:l.length)===e.fieldShowMaxValue:U(D.element,e.field);if("sortPriority"!==e.field)return!1;const{sortDirection:t}=D.element;return!t||"NONE"===t}return(U,C)=>(l(),t("div",H,[(l(!0),t(i,null,n(e.columns,((n,U)=>{return l(),t(i,{key:U},[n.isShow?(l(),t("span",{key:0,class:"table-cell",title:e.element[n.field],style:a(r(w)(n))},["text"===n.type?(l(),t(i,{key:0},[0===U?(l(),d(r(h),{key:0,trigger:"hover"},{trigger:o((()=>[u(r(b),{style:{"margin-right":"5px",top:"2px"},component:r(S)},null,8,["component"])])),default:o((()=>[O])),_:1})):f("v-if",!0),s("span",{class:c([e.isHighlight&&"title"===n.field?"highlight":""])},m("seq"===n.field?e.idx:e.element[n.field]),3)],64)):f("v-if",!0),"checkbox"===n.type?p((l(),d(r(k),{key:1,disabled:_(n),checked:e.element[n.field],"onUpdate:checked":[l=>e.element[n.field]=l,e=>function(e,l){P("updateChecked",{checked:e,column:l})}(e,n)]},null,8,["disabled","checked","onUpdate:checked"])),[[v,(C=e.element,H=n.field,"isShowHeaderFilter"===H?C.isConfiguredHeaderFilter&&"0001"!=D.element.id:"0001"!=D.element.id)]]):f("v-if",!0),"select"===n.type?p((l(),d(r(g),{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:F(n)},null,8,["disabled","value","onUpdate:value","options"])),[[v,"fixedWay"===n.field||"0001"!=e.element.id]]):f("v-if",!0),"input"===n.type?p((l(),d(r(x),{key:3,value:e.element[n.field],"onUpdate:value":l=>e.element[n.field]=l,clearable:""},null,8,["value","onUpdate:value"])),[[v,"0001"!=e.element.id]]):f("v-if",!0),"inputNumber"===n.type?(l(),d(r(N),{key:4,value:e.element[n.field],"onUpdate:value":l=>e.element[n.field]=l},null,8,["value","onUpdate:value"])):f("v-if",!0),"custom"===n.type&&r(E)(n.contentRender)?(l(),d(y((()=>n.contentRender(n,e.element))),{key:5})):f("v-if",!0)],12,L)):f("v-if",!0)],64);var C,H})),128))]))}});export{P as default};
@@ -28,4 +28,5 @@ export declare type FieldSetColumnItem = {
28
28
  isHeadCheckHide?: boolean;
29
29
  isShow?: boolean;
30
30
  contentRender?: (column: AnyObject, row: AnyObject) => VNode | String;
31
+ [key: string]: any;
31
32
  };
@@ -1 +1 @@
1
- .c-field-set{display:flex;flex-flow:column nowrap;height:100%;width:100%}.c-field-set__search-wrapper.n-input{margin-bottom:12px;width:50%}.c-field-set .item{background:#fff}.c-field-set .item:active{background:#f2f2f2;box-shadow:0 0 10px 0 #d5d5d5}.c-field-set .item:focus{background-color:#f2f2f2}.c-field-set .item.disabled{cursor:not-allowed}.c-field-set .item .row{align-items:center;border-bottom:1px solid #e8e8e8;display:flex;height:var(--row-height);padding:5px 0}.c-field-set .table-cell{box-sizing:border-box;color:inherit;display:inline-block;padding:0 5px}.c-field-set .table-cell .highlight{background-color:var(--primary-color);color:#fff}.c-field-set__table-header{align-items:center;background:#f2f2f4;border:1px solid #f2f2f2;display:flex;height:52px}.c-field-set__table-body{flex:1;overflow-y:scroll}.c-field-set__table-footer{border-top:1px solid #d5d5d5;padding:12px 0}
1
+ .c-field-set{display:flex;flex-flow:column nowrap;height:100%;width:100%}.c-field-set__search-wrapper.n-input{margin-bottom:12px;width:50%}.c-field-set .item{background:#fff}.c-field-set .item:active{background:#f2f2f2;box-shadow:0 0 10px 0 #d5d5d5}.c-field-set .item:focus{background-color:#f2f2f2}.c-field-set .item.disabled{cursor:not-allowed}.c-field-set .item .row{align-items:center;border-bottom:1px solid #e8e8e8;display:flex;height:var(--row-height);padding:5px 0}.c-field-set .table-cell{box-sizing:border-box;color:inherit;display:inline-block;padding:0 5px}.c-field-set .table-cell .highlight{background-color:var(--primary-color);color:#fff}.c-field-set__table-header{align-items:center;background:#f2f2f4;border:1px solid #f2f2f2;display:flex;height:52px}.c-field-set__table-header .n-checkbox.n-checkbox--disabled .n-checkbox__label{color:var(--n-text-color)}.c-field-set__table-body{flex:1;overflow-y:scroll}.c-field-set__table-footer{border-top:1px solid #d5d5d5;padding:12px 0}
@@ -7270,6 +7270,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
7270
7270
  __extra?: boolean | undefined;
7271
7271
  }[]>;
7272
7272
  onFocus: () => Promise<void>;
7273
+ useVersion: typeof import("..").useVersion;
7273
7274
  Draggable: import("vue").DefineComponent<{
7274
7275
  list: {
7275
7276
  type: ArrayConstructor;
@@ -8045,6 +8046,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
8045
8046
  decoratorElement: HTMLElement | null | undefined;
8046
8047
  } | null>;
8047
8048
  };
8049
+ useVersion: typeof import("..").useVersion;
8048
8050
  FormConsumer: import("vue").DefineComponent<{}, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
8049
8051
  FormProvider: import("vue").DefineComponent<Record<"form", any>, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<Record<"form", any>>>, {
8050
8052
  form: any;
@@ -14506,6 +14508,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
14506
14508
  decoratorElement: HTMLElement | null | undefined;
14507
14509
  } | null>;
14508
14510
  };
14511
+ useVersion: typeof import("..").useVersion;
14509
14512
  FormConsumer: import("vue").DefineComponent<{}, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
14510
14513
  FormProvider: import("vue").DefineComponent<Record<"form", any>, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<Record<"form", any>>>, {
14511
14514
  form: any;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="lodash" />
2
+ import { useVersion } from '../../../../es/shared/hooks';
2
3
  import { FormLowCodeReactions, AnyFn } from '../../../../es/shared/types';
3
4
  import { PropType } from 'vue';
4
5
  import { FormConfigItem, FormConfigTextFormatter, FormConfigVisitor } from '../../../../es/components/form-config/src/types';
@@ -7272,6 +7273,7 @@ declare const _default: import("vue").DefineComponent<{
7272
7273
  __extra?: boolean | undefined;
7273
7274
  }[]>;
7274
7275
  onFocus: () => Promise<void>;
7276
+ useVersion: typeof useVersion;
7275
7277
  Draggable: import("vue").DefineComponent<{
7276
7278
  list: {
7277
7279
  type: ArrayConstructor;
@@ -8047,6 +8049,7 @@ declare const _default: import("vue").DefineComponent<{
8047
8049
  decoratorElement: HTMLElement | null | undefined;
8048
8050
  } | null>;
8049
8051
  };
8052
+ useVersion: typeof useVersion;
8050
8053
  FormConsumer: import("vue").DefineComponent<{}, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
8051
8054
  FormProvider: import("vue").DefineComponent<Record<"form", any>, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<Record<"form", any>>>, {
8052
8055
  form: any;
@@ -14508,6 +14511,7 @@ declare const _default: import("vue").DefineComponent<{
14508
14511
  decoratorElement: HTMLElement | null | undefined;
14509
14512
  } | null>;
14510
14513
  };
14514
+ useVersion: typeof useVersion;
14511
14515
  FormConsumer: import("vue").DefineComponent<{}, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
14512
14516
  FormProvider: import("vue").DefineComponent<Record<"form", any>, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<Record<"form", any>>>, {
14513
14517
  form: any;
@@ -1 +1 @@
1
- import{defineComponent as e,provide as o,ref as t,computed as a,toRaw as r,openBlock as i,createElementBlock as l,normalizeStyle as s,unref as n,createElementVNode as m,createVNode as u,mergeProps as f,withCtx as c,createBlock as d,isRef as p,createCommentVNode as v,createTextVNode as g}from"vue";import{useTheme as h}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{isArray as _,cloneDeep as y,isFunction as C}from"lodash-es";import"@vue/shared";import{uuidGenerator as x,traverse as j}from"../../../shared/utils/index.js";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{NSelect as F,NSpace as L}from"naive-ui";import k from"../../../shared/components/VueDraggable/src/vuedraggable.js";import V from"./components/FormConfigCreator.vue.js";import b from"./components/FormConfigDragDisplay.vue.js";import w from"./components/FormConfigEdit.vue.js";import R from"./components/FormConfigEventSetting.vue.js";import E from"./components/FormConfigMaterialItem.js";import{useDataNormalize as M}from"./hooks/useDataNormalize.js";import{InjectionFormConfigEmit as I,InjectionFieldList as D,InjectionMaterialList as H,InjectionLowCodeReactions as O,InjectionActiveFieldItem as S,FORM_CONFIG_GROUP as N}from"./constants/index.js";import"./utils/index.js";import{useSortableConfig as U}from"./hooks/useSortalbeConfig.js";import"./hooks/useConfigurationField.js";const A=["id"],B={class:"form-config__material"},T=m("header",{class:"form-config__materialHeader"},"物料区",-1),P={class:"form-config__displayWrapper"},z={class:"form-config__displayHeader"},W={class:"form-config__config"},q=m("header",{class:"form-config__configHeader"},"配置区",-1),G={class:"form-config__configContent"};var J=e({__name:"FormConfig",props:{maxHeight:{type:String},fieldVisitor:{type:Object},textFormatter:{type:Function},formRenderRef:{type:Object},extraMaterialList:{type:[Array,Function]},showLowCodeReactions:Boolean,formProps:{type:Object}},emits:["addItem","removeItem","reactionsValidateFailure"],setup(e,{expose:J,emit:K}){const Q=e;o(I,K);const X=x(),Y=h(),{getCommonConfig:Z}=U(),$=t([]);o(D,$);const ee=t([]);o(H,ee);const oe=t([]);function te(e){$.value.some((o=>o.key===e.key))||$.value.push(e)}o(O,oe);const ae=(e,o)=>C(Q.textFormatter)?Q.textFormatter(e,o):o,re=t();o(S,re);const ie=t(),{transform:le,inverseTransform:se}=M(Q),ne=a({get:()=>null,set(e){if(!e)return;const o=ue.value.find((o=>o.key===e));o&&(o.__extra=!0,ee.value.push(o),K("addItem",o))}}),me=t([]),ue=a((()=>{if(!_(me.value))return[];const e=[];return j([...ee.value,...$.value],(o=>e.push(o.key))),me.value.filter((o=>!e.find((e=>e===o.key))))}));async function fe(){Q.extraMaterialList&&!me.value.length&&(me.value=C(Q.extraMaterialList)?await Q.extraMaterialList():Q.extraMaterialList)}return J({loadData({fieldList:e,lowCodeReactions:o=[]}){let t=[],a=[];e.forEach((e=>function(e){"LINE_BAR"===e.type&&(e.children=[]);!1===e.show?a.push(e):t.push(e),"COMBINATION"===e.type&&_(e.children)&&e.children.length&&e.children.forEach((e=>{e.__isCombinationChild=!0}))}(y(r(e))))),$.value=le(t),ee.value=a,oe.value=o,re.value=void 0},validate(){var e;return null==(e=ie.value)?void 0:e.validate()},getData:(e=!1)=>({fieldList:se(y(r($.value)),e,{show:!0}),materialList:se(y(r(ee.value)),e,{show:!1}),lowCodeReactions:y(r(oe.value))}),clearExtraList(){me.value=[]}}),(o,t)=>(i(),l("section",{class:"form-config",style:s({"--max-height":e.maxHeight,...n(Y)}),id:n(X)},[m("section",B,[T,u(n(k),f(n(Z)(),{class:"form-config__materialContent",modelValue:ee.value,"onUpdate:modelValue":t[0]||(t[0]=e=>ee.value=e)}),{item:c((({element:e})=>[u(n(E),{"form-config-item":e,"text-formatter":ae,"material-List":ee.value},null,8,["form-config-item","material-List"])])),_:1},16,["modelValue"]),e.extraMaterialList?(i(),d(n(F),{key:0,class:"form-config__materialExtraList",filterable:"",value:n(ne),"onUpdate:value":t[1]||(t[1]=e=>p(ne)?ne.value=e:null),placeholder:"请选择额外物料",options:n(ue),"label-field":"name","value-field":"key",onFocus:fe},null,8,["value","options"])):v("v-if",!0)]),m("section",P,[m("header",z,[g(" 布局区 "),u(n(L),null,{default:c((()=>[e.showLowCodeReactions?(i(),d(R,{key:0,modelValue:oe.value,"onUpdate:modelValue":t[2]||(t[2]=e=>oe.value=e),onValidateFailure:t[3]||(t[3]=e=>K("reactionsValidateFailure",e))},null,8,["modelValue"])):v("v-if",!0),u(V,{onSubmit:te})])),_:1})]),u(b,{class:"form-config__displayContent",group:n(N),"text-formatter":ae,modelValue:$.value,"onUpdate:modelValue":t[4]||(t[4]=e=>$.value=e)},null,8,["group","modelValue"])]),m("section",W,[q,m("section",G,[u(w,{ref_key:"formConfigEditRef",ref:ie,uuid:n(X),"bind-form-render-ref":e.formRenderRef,"form-props":e.formProps},null,8,["uuid","bind-form-render-ref","form-props"])])])],12,A))}});export{J as default};
1
+ import{defineComponent as e,provide as o,ref as t,computed as a,toRaw as r,openBlock as i,createElementBlock as s,mergeProps as l,unref as n,createElementVNode as m,createVNode as u,withCtx as f,createBlock as d,isRef as c,createCommentVNode as p,createTextVNode as v}from"vue";import{useTheme as g}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{isArray as h,cloneDeep as _,isFunction as y}from"lodash-es";import"@vue/shared";import{uuidGenerator as C,traverse as x}from"../../../shared/utils/index.js";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{NSelect as j,NSpace as k}from"naive-ui";import{useVersion as F}from"../../../shared/hooks/useVersion.js";import L from"../../../shared/components/VueDraggable/src/vuedraggable.js";import V from"./components/FormConfigCreator.vue.js";import b from"./components/FormConfigDragDisplay.vue.js";import w from"./components/FormConfigEdit.vue.js";import R from"./components/FormConfigEventSetting.vue.js";import E from"./components/FormConfigMaterialItem.js";import{useDataNormalize as M}from"./hooks/useDataNormalize.js";import{InjectionFormConfigEmit as I,InjectionFieldList as D,InjectionMaterialList as H,InjectionLowCodeReactions as O,InjectionActiveFieldItem as S,FORM_CONFIG_GROUP as N}from"./constants/index.js";import"./utils/index.js";import{useSortableConfig as U}from"./hooks/useSortalbeConfig.js";import"./hooks/useConfigurationField.js";const A=["id"],B={class:"form-config__material"},T=m("header",{class:"form-config__materialHeader"},"物料区",-1),P={class:"form-config__displayWrapper"},z={class:"form-config__displayHeader"},W={class:"form-config__config"},q=m("header",{class:"form-config__configHeader"},"配置区",-1),G={class:"form-config__configContent"};var J=e({__name:"FormConfig",props:{maxHeight:{type:String},fieldVisitor:{type:Object},textFormatter:{type:Function},formRenderRef:{type:Object},extraMaterialList:{type:[Array,Function]},showLowCodeReactions:Boolean,formProps:{type:Object}},emits:["addItem","removeItem","reactionsValidateFailure"],setup(e,{expose:J,emit:K}){const Q=e;o(I,K);const X=C(),Y=g(),{getCommonConfig:Z}=U(),$=t([]);o(D,$);const ee=t([]);o(H,ee);const oe=t([]);function te(e){$.value.some((o=>o.key===e.key))||$.value.push(e)}o(O,oe);const ae=(e,o)=>y(Q.textFormatter)?Q.textFormatter(e,o):o,re=t();o(S,re);const ie=t(),{transform:se,inverseTransform:le}=M(Q),ne=a({get:()=>null,set(e){if(!e)return;const o=ue.value.find((o=>o.key===e));o&&(o.__extra=!0,ee.value.push(o),K("addItem",o))}}),me=t([]),ue=a((()=>{if(!h(me.value))return[];const e=[];return x([...ee.value,...$.value],(o=>e.push(o.key))),me.value.filter((o=>!e.find((e=>e===o.key))))}));async function fe(){Q.extraMaterialList&&!me.value.length&&(me.value=y(Q.extraMaterialList)?await Q.extraMaterialList():Q.extraMaterialList)}return J({loadData({fieldList:e,lowCodeReactions:o=[]}){let t=[],a=[];e.forEach((e=>function(e){"LINE_BAR"===e.type&&(e.children=[]);!1===e.show?a.push(e):t.push(e),"COMBINATION"===e.type&&h(e.children)&&e.children.length&&e.children.forEach((e=>{e.__isCombinationChild=!0}))}(_(r(e))))),$.value=se(t),ee.value=a,oe.value=o,re.value=void 0},validate(){var e;return null==(e=ie.value)?void 0:e.validate()},getData:(e=!1)=>({fieldList:le(_(r($.value)),e,{show:!0}),materialList:le(_(r(ee.value)),e,{show:!1}),lowCodeReactions:_(r(oe.value))}),clearExtraList(){me.value=[]}}),(o,t)=>(i(),s("section",l({class:"form-config",style:{"--max-height":e.maxHeight,...n(Y)},id:n(X)},n(F)()),[m("section",B,[T,u(n(L),l(n(Z)(),{class:"form-config__materialContent",modelValue:ee.value,"onUpdate:modelValue":t[0]||(t[0]=e=>ee.value=e)}),{item:f((({element:e})=>[u(n(E),{"form-config-item":e,"text-formatter":ae,"material-List":ee.value},null,8,["form-config-item","material-List"])])),_:1},16,["modelValue"]),e.extraMaterialList?(i(),d(n(j),{key:0,class:"form-config__materialExtraList",filterable:"",value:n(ne),"onUpdate:value":t[1]||(t[1]=e=>c(ne)?ne.value=e:null),placeholder:"请选择额外物料",options:n(ue),"label-field":"name","value-field":"key",onFocus:fe},null,8,["value","options"])):p("v-if",!0)]),m("section",P,[m("header",z,[v(" 布局区 "),u(n(k),null,{default:f((()=>[e.showLowCodeReactions?(i(),d(R,{key:0,modelValue:oe.value,"onUpdate:modelValue":t[2]||(t[2]=e=>oe.value=e),onValidateFailure:t[3]||(t[3]=e=>K("reactionsValidateFailure",e))},null,8,["modelValue"])):p("v-if",!0),u(V,{onSubmit:te})])),_:1})]),u(b,{class:"form-config__displayContent",group:n(N),"text-formatter":ae,modelValue:$.value,"onUpdate:modelValue":t[4]||(t[4]=e=>$.value=e)},null,8,["group","modelValue"])]),m("section",W,[q,m("section",G,[u(w,{ref_key:"formConfigEditRef",ref:ie,uuid:n(X),"bind-form-render-ref":e.formRenderRef,"form-props":e.formProps},null,8,["uuid","bind-form-render-ref","form-props"])])])],16,A))}});export{J as default};
@@ -703,6 +703,7 @@ declare const _default: import("vue").DefineComponent<{}, {
703
703
  decoratorElement: HTMLElement | null | undefined;
704
704
  } | null>;
705
705
  };
706
+ useVersion: typeof import("../../..").useVersion;
706
707
  FormConsumer: import("vue").DefineComponent<{}, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
707
708
  FormProvider: import("vue").DefineComponent<Record<"form", any>, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<Record<"form", any>>>, {
708
709
  form: any;
@@ -6125,6 +6125,7 @@ declare const _default: import("vue").DefineComponent<{
6125
6125
  decoratorElement: HTMLElement | null | undefined;
6126
6126
  } | null>;
6127
6127
  };
6128
+ useVersion: typeof import("../../../../../es/components/index").useVersion;
6128
6129
  FormConsumer: import("vue").DefineComponent<{}, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
6129
6130
  FormProvider: import("vue").DefineComponent<Record<"form", any>, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<Record<"form", any>>>, {
6130
6131
  form: any;
@@ -690,6 +690,7 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{}, {
690
690
  decoratorElement: HTMLElement | null | undefined;
691
691
  } | null>;
692
692
  };
693
+ useVersion: typeof import("..").useVersion;
693
694
  FormConsumer: import("vue").DefineComponent<{}, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
694
695
  FormProvider: import("vue").DefineComponent<Record<"form", any>, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<Record<"form", any>>>, {
695
696
  form: any;
@@ -1,4 +1,4 @@
1
- import { FormRequestDefine } from '../../../../es/shared/hooks';
1
+ import { FormRequestDefine, useVersion } from '../../../../es/shared/hooks';
2
2
  import { AnyObject, FormLowCodeReactions, FormOperationalConfig } from '../../../../es/shared/types';
3
3
  import { Field } from '@formily/core';
4
4
  import { Component, FunctionalComponent, PropType } from 'vue';
@@ -685,6 +685,7 @@ declare const _default: import("vue").DefineComponent<{
685
685
  decoratorElement: HTMLElement | null | undefined;
686
686
  } | null>;
687
687
  };
688
+ useVersion: typeof useVersion;
688
689
  FormConsumer: import("vue").DefineComponent<{}, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
689
690
  FormProvider: import("vue").DefineComponent<Record<"form", any>, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<Record<"form", any>>>, {
690
691
  form: any;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as o,computed as t,provide as r,onMounted as s,onUnmounted as a,nextTick as i,openBlock as l,createBlock as n,unref as m,normalizeClass as d,normalizeStyle as p,withCtx as u,createElementBlock as c,createVNode as f,isRef as h,Fragment as y,renderList as g,createCommentVNode as b,createElementVNode as j,withKeys as v,toDisplayString as k,renderSlot as C}from"vue";import{useTheme as F}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{isNumber as S,cloneDeep as H,isObject as x,isBoolean as A}from"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{NForm as L,NTabs as B,NTabPane as O,NConfigProvider as R}from"naive-ui";import{createForm as w,onFormMount as D,onFieldValueChange as _,onFieldMount as V,onFieldUnmount as I,onFieldReact as N}from"@formily/core";import{Path as W}from"@formily/path";import{FormProvider as q,FormConsumer as E}from"@formily/vue";import{InjectionFormLifeCycleCaller as K,InjectionFormGraph as T}from"./constants/index.js";import{useAutoHidden as U}from"./hooks/useAutoHidden.js";import{useComplexOptionsSpan as G}from"./hooks/useComplexOptions.js";import{useFormDomEvent as M,useFormExposeEvent as P}from"./hooks/useFormEvent.js";import{useFormGraph as J}from"./hooks/useFormGraph.js";import{useFormRenderLifeCycle as $}from"./hooks/useFormRenderLifeCycle.js";import{useLowCodeEvent as z}from"./hooks/useLowCodeEvent.js";import{useLowCodeReactions as Q}from"./hooks/useLowCodeReactions.js";import{useNuiThemeOverrides as X}from"./hooks/useNuiThemeOverrides.js";import{useOperationalForm as Y}from"./hooks/useOperationalForm.js";import{useWordbookSetting as Z}from"./hooks/useWordbookSetting.js";import"../index.js";import{createObjSchema as ee}from"./utils/schema.js";import{useFieldListAdaptor as oe}from"./hooks/useFieldListAdaptor.js";import{useFieldVisitor as te}from"./hooks/useFieldVisitor.js";import"../../../shared/utils/tapable/SyncHook.js";import"../../../shared/utils/tapable/SyncBailHook.js";import"../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../shared/utils/tapable/SyncLoopHook.js";import"../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import{validateMessageLocale as re}from"./hooks/useFormValidator.js";import{useAnchor as se}from"./hooks/useAnchor.js";import{useFormContext as ae}from"./hooks/useFormContext.js";const ie={key:0,style:{height:"54px"}},le={style:{"white-space":"pre"}};var ne=e({__name:"FormRender",props:{fieldList:{type:Array},initialData:{type:Object,default:()=>({})},fieldVisitor:{type:Object},column:{type:Number,default:24},maxHeight:{type:[Number,String],default:""},anchor:{type:Boolean,default:!1},parallelism:{type:Number,default:3},businessFormatter:{type:Function},schema:{type:Object},components:{type:Object,default:()=>({})},scope:{type:Object,default:()=>({})},annotation:{type:Object},consumer:{type:Boolean,default:!1},uuid:{type:String},lifeCycle:{type:Object},requestInstance:{type:Object},enterToNextWidget:{type:[Boolean,Function],default:!0},lowCodeReactions:{type:Array},operationalForm:{type:Object},linebarAutoHidden:{type:Boolean},bordered:{type:[Boolean,String],default:!0},outBordered:{type:Boolean,default:!1},uniqueCacheData:{type:Boolean,default:!1},forceClearable:Boolean},emits:["formChange","annotationChange","scroll"],setup(e,{expose:ne,emit:me}){const de=e,pe=F(),{nuiThemeOverrides:ue}=X();re();const ce=o(),fe=t((()=>S(de.maxHeight)?de.maxHeight+"px":de.maxHeight)),{SchemaField:he,businessCollector:ye,formItemDepsCollector:ge,changeContextCollector:be,formUUID:je}=ae(de,me),{anchorBarRef:ve,currentAnchor:ke,updateAnchorList:Ce,anchorIdList:Fe,onScroll:Se}=se(de,me,ce,ge),{callLifeCycle:He}=$(de);r(K,He),He("onSetup");const{trigger:xe}=U(),{observeFormGraph:Ae,setGraph:Le,removeGraph:Be}=J();r(T,Ae);const{lowCodeEventTrigger:Oe}=z(),Re=w({initialValues:de.initialData,effects(e){const o={};D((()=>{Object.assign(o,H(e.values))})),_("*",(t=>{const r=W.getIn(o,t.path);W.setIn(o,t.path,t.value);const s=t.props.name.toString();ye.trigger(e,s),ge.trigger(s),me("formChange",{fieldInstance:t,fieldKey:s,oldValue:r,fieldName:t.title,value:t.value,context:be.getContext(s,t.value)}),Oe(t),we(s),_e(s),Ie.trigger(s,t.value)})),V("*",Le),I("*",Be),de.linebarAutoHidden&&(N("*",xe),D((e=>e.query("*").forEach(xe)))),de.anchor&&N("*",Ce)}}),{lowCodeReactionsHandler:we,triggerAllReactionsHandler:De}=Q(t((()=>de.lowCodeReactions)),Re),{operationalFormHandler:_e,triggerAllOperationalFormHandler:Ve}=Y(t((()=>de.operationalForm)),Re),Ie=Z(Re,be);s(De),s(Ve);const{schemaAdaptor:Ne}=oe(ye,de.lifeCycle);let We=de.fieldList||[];const qe=t((()=>de.schema?de.schema:de.fieldList?(We=te().traverse(H(de.fieldList),de.fieldVisitor),ee(Ne(We,de))):ee({}))),{onKeydown:Ee}=M({formModel:Re,formRenderRef:ce,props:de}),{clearSpan:Ke}=G();a((()=>Ke(je)));const Te=P({formModel:Re,formRenderRef:ce,formItemDepsCollector:ge,getFieldList:()=>We,formUUID:je});return ne({formModel:Re,validate:(e="*",o={})=>Te.validate(e,o),getFormValues:(e=!0)=>Te.getFormValues(e),async setFormValues(e,o={},t=!1,r=!0){var s,a,l,n,m;let d=!0,p=!0,u=!0;x(o)?(p=null==(s=o.needSplitExtendKey)||s,d=null==(a=o.avoidDependKeyConnection)||a,t=null!=(l=o.avoidBusinessConnection)&&l,u=null==(n=o.avoidWordbookSettingConnection)||n,r=null==(m=o.overwrite)||m):A(o)&&(p=o),t&&(ye.triggerLock=!0),d&&(ge.triggerDisabled=!0),u&&Ie.setDisabled(!0),Te.setFormValues(e,p,r),await i(),ye.triggerLock=!1,ge.triggerDisabled=!1,Ie.setDisabled(!1)},setFieldState(e,o){Te.setFieldState(e,o)},resetFields(e="*"){Te.resetFields(e)},queryWidget:async e=>Te.queryWidget(e),getFieldList:()=>We,async reload(){console.error("reload function is abstract,it should be overwrite!")}}),(o,t)=>(l(),n(m(L),{class:d(["form-render",{"form-render--out-border":e.outBordered}]),"require-mark-placement":"left",style:p(m(pe))},{default:u((()=>[e.anchor?(l(),c("section",ie,[f(m(B),{value:m(ke),"onUpdate:value":t[0]||(t[0]=e=>h(ke)?ke.value=e:null),type:"line",ref_key:"anchorBarRef",ref:ve},{default:u((()=>[(l(!0),c(y,null,g(m(Fe),(e=>(l(),n(m(O),{name:e.name,tab:e.title,key:e.name},null,8,["name","tab"])))),128))])),_:1},8,["value"])])):b("v-if",!0),f(m(R),{"theme-overrides":m(ue)},{default:u((()=>[j("section",{class:"form-render__wrapper",style:p({"--column":e.column,"--form-height":m(fe)}),ref_key:"formRenderRef",ref:ce,onScroll:t[1]||(t[1]=(...e)=>m(Se)&&m(Se)(...e)),onKeydownCapture:t[2]||(t[2]=v(((...e)=>m(Ee)&&m(Ee)(...e)),["enter"]))},[f(m(q),{form:m(Re)},{default:u((()=>[f(m(he),{schema:m(qe)},null,8,["schema"]),e.consumer?(l(),n(m(E),{key:0},{default:u((({form:e})=>[j("div",le,k(JSON.stringify(e.values,null,2)),1)])),_:1})):b("v-if",!0),C(o.$slots,"default")])),_:3},8,["form"])],36)])),_:3},8,["theme-overrides"])])),_:3},8,["class","style"]))}});export{ne as default};
1
+ import{defineComponent as e,ref as o,computed as t,provide as r,onMounted as s,onUnmounted as a,nextTick as i,openBlock as l,createBlock as n,unref as m,mergeProps as d,withCtx as p,createElementBlock as u,createVNode as c,isRef as f,Fragment as h,renderList as y,createCommentVNode as g,createElementVNode as j,normalizeStyle as b,withKeys as v,toDisplayString as k,renderSlot as C}from"vue";import{useTheme as F}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{isNumber as S,cloneDeep as H,isObject as x,isBoolean as A}from"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{NForm as L,NTabs as B,NTabPane as O,NConfigProvider as R}from"naive-ui";import{useVersion as w}from"../../../shared/hooks/useVersion.js";import{createForm as D,onFormMount as V,onFieldValueChange as _,onFieldMount as I,onFieldUnmount as N,onFieldReact as W}from"@formily/core";import{Path as q}from"@formily/path";import{FormProvider as E,FormConsumer as K}from"@formily/vue";import{InjectionFormLifeCycleCaller as T,InjectionFormGraph as U}from"./constants/index.js";import{useAutoHidden as G}from"./hooks/useAutoHidden.js";import{useComplexOptionsSpan as M}from"./hooks/useComplexOptions.js";import{useFormDomEvent as P,useFormExposeEvent as J}from"./hooks/useFormEvent.js";import{useFormGraph as $}from"./hooks/useFormGraph.js";import{useFormRenderLifeCycle as z}from"./hooks/useFormRenderLifeCycle.js";import{useLowCodeEvent as Q}from"./hooks/useLowCodeEvent.js";import{useLowCodeReactions as X}from"./hooks/useLowCodeReactions.js";import{useNuiThemeOverrides as Y}from"./hooks/useNuiThemeOverrides.js";import{useOperationalForm as Z}from"./hooks/useOperationalForm.js";import{useWordbookSetting as ee}from"./hooks/useWordbookSetting.js";import"../index.js";import{createObjSchema as oe}from"./utils/schema.js";import{useFieldListAdaptor as te}from"./hooks/useFieldListAdaptor.js";import{useFieldVisitor as re}from"./hooks/useFieldVisitor.js";import"../../../shared/utils/tapable/SyncHook.js";import"../../../shared/utils/tapable/SyncBailHook.js";import"../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../shared/utils/tapable/SyncLoopHook.js";import"../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import{validateMessageLocale as se}from"./hooks/useFormValidator.js";import{useAnchor as ae}from"./hooks/useAnchor.js";import{useFormContext as ie}from"./hooks/useFormContext.js";const le={key:0,style:{height:"54px"}},ne={style:{"white-space":"pre"}};var me=e({__name:"FormRender",props:{fieldList:{type:Array},initialData:{type:Object,default:()=>({})},fieldVisitor:{type:Object},column:{type:Number,default:24},maxHeight:{type:[Number,String],default:""},anchor:{type:Boolean,default:!1},parallelism:{type:Number,default:3},businessFormatter:{type:Function},schema:{type:Object},components:{type:Object,default:()=>({})},scope:{type:Object,default:()=>({})},annotation:{type:Object},consumer:{type:Boolean,default:!1},uuid:{type:String},lifeCycle:{type:Object},requestInstance:{type:Object},enterToNextWidget:{type:[Boolean,Function],default:!0},lowCodeReactions:{type:Array},operationalForm:{type:Object},linebarAutoHidden:{type:Boolean},bordered:{type:[Boolean,String],default:!0},outBordered:{type:Boolean,default:!1},uniqueCacheData:{type:Boolean,default:!1},forceClearable:Boolean},emits:["formChange","annotationChange","scroll"],setup(e,{expose:me,emit:de}){const pe=e,ue=F(),{nuiThemeOverrides:ce}=Y();se();const fe=o(),he=t((()=>S(pe.maxHeight)?pe.maxHeight+"px":pe.maxHeight)),{SchemaField:ye,businessCollector:ge,formItemDepsCollector:je,changeContextCollector:be,formUUID:ve}=ie(pe,de),{anchorBarRef:ke,currentAnchor:Ce,updateAnchorList:Fe,anchorIdList:Se,onScroll:He}=ae(pe,de,fe,je),{callLifeCycle:xe}=z(pe);r(T,xe),xe("onSetup");const{trigger:Ae}=G(),{observeFormGraph:Le,setGraph:Be,removeGraph:Oe}=$();r(U,Le);const{lowCodeEventTrigger:Re}=Q(),we=D({initialValues:pe.initialData,effects(e){const o={};V((()=>{Object.assign(o,H(e.values))})),_("*",(t=>{const r=q.getIn(o,t.path);q.setIn(o,t.path,t.value);const s=t.props.name.toString();ge.trigger(e,s),je.trigger(s),de("formChange",{fieldInstance:t,fieldKey:s,oldValue:r,fieldName:t.title,value:t.value,context:be.getContext(s,t.value)}),Re(t),De(s),_e(s),Ne.trigger(s,t.value)})),I("*",Be),N("*",Oe),pe.linebarAutoHidden&&(W("*",Ae),V((e=>e.query("*").forEach(Ae)))),pe.anchor&&W("*",Fe)}}),{lowCodeReactionsHandler:De,triggerAllReactionsHandler:Ve}=X(t((()=>pe.lowCodeReactions)),we),{operationalFormHandler:_e,triggerAllOperationalFormHandler:Ie}=Z(t((()=>pe.operationalForm)),we),Ne=ee(we,be);s(Ve),s(Ie);const{schemaAdaptor:We}=te(ge,pe.lifeCycle);let qe=pe.fieldList||[];const Ee=t((()=>pe.schema?pe.schema:pe.fieldList?(qe=re().traverse(H(pe.fieldList),pe.fieldVisitor),oe(We(qe,pe))):oe({}))),{onKeydown:Ke}=P({formModel:we,formRenderRef:fe,props:pe}),{clearSpan:Te}=M();a((()=>Te(ve)));const Ue=J({formModel:we,formRenderRef:fe,formItemDepsCollector:je,getFieldList:()=>qe,formUUID:ve});return me({formModel:we,validate:(e="*",o={})=>Ue.validate(e,o),getFormValues:(e=!0)=>Ue.getFormValues(e),async setFormValues(e,o={},t=!1,r=!0){var s,a,l,n,m;let d=!0,p=!0,u=!0;x(o)?(p=null==(s=o.needSplitExtendKey)||s,d=null==(a=o.avoidDependKeyConnection)||a,t=null!=(l=o.avoidBusinessConnection)&&l,u=null==(n=o.avoidWordbookSettingConnection)||n,r=null==(m=o.overwrite)||m):A(o)&&(p=o),t&&(ge.triggerLock=!0),d&&(je.triggerDisabled=!0),u&&Ne.setDisabled(!0),Ue.setFormValues(e,p,r),await i(),ge.triggerLock=!1,je.triggerDisabled=!1,Ne.setDisabled(!1)},setFieldState(e,o){Ue.setFieldState(e,o)},resetFields(e="*"){Ue.resetFields(e)},queryWidget:async e=>Ue.queryWidget(e),getFieldList:()=>qe,async reload(){console.error("reload function is abstract,it should be overwrite!")}}),(o,t)=>(l(),n(m(L),d({class:["form-render",{"form-render--out-border":e.outBordered}],"require-mark-placement":"left",style:m(ue)},m(w)()),{default:p((()=>[e.anchor?(l(),u("section",le,[c(m(B),{value:m(Ce),"onUpdate:value":t[0]||(t[0]=e=>f(Ce)?Ce.value=e:null),type:"line",ref_key:"anchorBarRef",ref:ke},{default:p((()=>[(l(!0),u(h,null,y(m(Se),(e=>(l(),n(m(O),{name:e.name,tab:e.title,key:e.name},null,8,["name","tab"])))),128))])),_:1},8,["value"])])):g("v-if",!0),c(m(R),{"theme-overrides":m(ce)},{default:p((()=>[j("section",{class:"form-render__wrapper",style:b({"--column":e.column,"--form-height":m(he)}),ref_key:"formRenderRef",ref:fe,onScroll:t[1]||(t[1]=(...e)=>m(He)&&m(He)(...e)),onKeydownCapture:t[2]||(t[2]=v(((...e)=>m(Ke)&&m(Ke)(...e)),["enter"]))},[c(m(E),{form:m(we)},{default:p((()=>[c(m(ye),{schema:m(Ee)},null,8,["schema"]),e.consumer?(l(),n(m(K),{key:0},{default:p((({form:e})=>[j("div",ne,k(JSON.stringify(e.values,null,2)),1)])),_:1})):g("v-if",!0),C(o.$slots,"default")])),_:3},8,["form"])],36)])),_:3},8,["theme-overrides"])])),_:3},16,["class","style"]))}});export{me as default};
@@ -688,6 +688,7 @@ declare const _default: import("vue").DefineComponent<{}, {
688
688
  decoratorElement: HTMLElement | null | undefined;
689
689
  } | null>;
690
690
  };
691
+ useVersion: typeof import("../..").useVersion;
691
692
  FormConsumer: import("vue").DefineComponent<{}, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
692
693
  FormProvider: import("vue").DefineComponent<Record<"form", any>, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<Record<"form", any>>>, {
693
694
  form: any;
@@ -1 +1 @@
1
- import{defineComponent as e,watch as t,computed as n,createVNode as u,mergeProps as o}from"vue";import r from"../../../../../shared/components/InputNumberSlash/InputNumberSlash.js";import{connect as i,mapProps as a}from"@formily/vue";import{isString as l,isNumber as p}from"lodash-es";import{NInputNumber as s}from"naive-ui";import{useCommonInjection as m}from"../../hooks/useCommonInjection.js";import{createInputSlot as c,parseNumberFromMaybeString as v}from"../../utils/index.js";import{assignUpdateValue as f,assignClearBindVisited as y}from"../../utils/schema.js";const g=i(e({props:{value:{type:[Number,String]},onChange:{type:Function,required:!0},prefix:{type:[String,Function,Object]},suffix:{type:[String,Function,Object]}},setup(e){const o=c(e);m().injectValueValidate((()=>e.value)),t((()=>e.value),(t=>{if(null!=t)return!l(t)&&!p(t)||Number.isNaN(+t)?e.onChange(null):void e.onChange(+t)}));const r=n({get:()=>v(e.value),set:t=>{var n;return null==(n=e.onChange)?void 0:n.call(e,t)}}),i=m().injectValueBindKey(r);return()=>u(s,{key:i.value,value:r.value,"onUpdate:value":e=>r.value=e,"show-button":!1},o.value)}}),a(f,y)),h=i(e({props:{value:{type:[Number,String]},onChange:{type:Function,required:!0},prefix:{type:[String,Function,Object]},suffix:{type:[String,Function,Object]},precision:{type:Number}},setup(e){const t=m().injectValueBindKey((()=>e.value));return()=>u(r,o(e,{key:t.value}),null)}}),a(f,y));export{g as INPUT_NUMBER,h as INPUT_NUMBER_SLASH};
1
+ import{defineComponent as e,watch as t,computed as n,createVNode as u,mergeProps as o}from"vue";import r from"../../../../../shared/components/InputNumberSlash/InputNumberSlash.js";import{connect as i,mapProps as a}from"@formily/vue";import{isString as l,isNumber as p}from"lodash-es";import{NInputNumber as s}from"naive-ui";import{useCommonInjection as m}from"../../hooks/useCommonInjection.js";import{createInputSlot as c,parseNumberFromMaybeString as v}from"../../utils/index.js";import{assignUpdateValue as f,assignClearBindVisited as y}from"../../utils/schema.js";const g=i(e({props:{value:{type:[Number,String]},onChange:{type:Function,required:!0},prefix:{type:[String,Function,Object]},suffix:{type:[String,Function,Object]}},setup(e){const o=c(e);m().injectValueValidate((()=>e.value)),t((()=>e.value),(t=>{if(null!=t)return!l(t)&&!p(t)||Number.isNaN(+t)?e.onChange(null):void e.onChange(+t)}));const r=n({get:()=>v(e.value),set:t=>{var n;return null==(n=e.onChange)?void 0:n.call(e,t)}}),i=m().injectValueBindKey(r);return()=>u(s,{key:i.value,value:r.value,"onUpdate:value":e=>r.value=e,"show-button":!1},o.value)}}),a(f,y)),h=i(e({props:{value:{type:[Number,String]},onChange:{type:Function,required:!0},prefix:{type:[String,Function,Object]},suffix:{type:[String,Function,Object]},precision:{type:Number}},setup(e){const t=m().injectValueBindKey((()=>e.value)),n=c(e);return()=>u(r,o(e,{key:t.value}),n.value)}}),a(f,y));export{g as INPUT_NUMBER,h as INPUT_NUMBER_SLASH};
@@ -1 +1 @@
1
- import{defineComponent as e,watch as l,inject as o,computed as a,ref as t,createVNode as n}from"vue";import{connect as u,mapProps as r}from"@formily/vue";import{HelpCircleSharp as i}from"@vicons/ionicons5";import{useVModel as s,useDebounceFn as p}from"@vueuse/core";import{cloneDeep as v,isString as d}from"lodash-es";import{NSelect as m,NSpin as c,NEmpty as f,NTooltip as y,NIcon as g,NTag as h}from"naive-ui";import"../../../index.js";import{InjectionChangeContextCollector as C}from"../../constants/index.js";import{useCommonInjection as b,useSelectOptionProps as j}from"../../hooks/useCommonInjection.js";import{assignUpdateValue as F,assignClearBindVisited as w,createVisitedSetter as x}from"../../utils/schema.js";import{useFormField as B}from"../../hooks/useFormField.js";import{useUrlConfigOptions as K,useAutographOptions as S}from"../../hooks/useFormRenderOptions.js";const k=u(e({name:"FormRemoteSearch",props:{value:{type:String},requestCache:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},allowCreate:Boolean,labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},showField:{type:String},urlConfig:{type:Object},autograph:{type:String},wordbook:{type:Object},onChange:{},useLoading:{type:Boolean,default:!0},lazyRequest:{type:Boolean,default:!0},multiple:Boolean,deletable:Boolean},emits:["update:value"],setup(e,{slots:u,emit:r}){const F=s(e,"value",r),{field:w,fieldKey:k}=B(),{injectValueValidate:O,injectValueBindKey:D}=b();O(F);const R=D(F),q={onRequestConfigChange:({fetchData:e,valueKey:l})=>e(F.value,{[l]:F.value}),onDepsChange:({fetchData:e,valueKey:l})=>e(F.value,{[l]:F.value})},{labelKey:L,valueKey:P,showKey:V,fetchData:I,searchContent:U,fullOptions:z,loading:A}=e.urlConfig?K(e,F,q):S(e,F,q),T=p(((e="",l="label")=>I(e,{["value"===l?P.value:"keyword"]:e})),300);l(F,(e=>{if(e&&!z.value.find((l=>l[P.value]===e)))return T(e,"value")}));o(C).setContext(k.value,(e=>{return{currentOption:v((l=e,z.value.find((e=>e[P.value]===l))))};var l}));const{menuProps:$,nodeProps:E}=j(),G=a((()=>z.value.length||!e.allowCreate?z.value:U.value?[{[L.value]:U.value,[P.value]:U.value},...z.value]:z.value));async function H(e){A.value=e,e&&T()}function J(e){const l=e.alias||e[L.value];if(!l||!d(l))return"";const o=l;return e.desc?n("section",{style:{display:"flex",alignItems:"center",gap:"4px"}},[o,e.desc?n(y,null,{trigger:()=>n(g,{component:i},null),default:()=>e.desc}):null]):o}function M({option:l,handleClose:o}){var a;const t=null!=(a=V.value&&l[V.value])?a:l[L.value];if(!e.multiple)return N.value=t,t;return N.value="",e.deletable?n(h,{closable:!0,onClose:function(e){e.stopPropagation(),o()}},{default:()=>t}):`${t};`}const N=t("");return()=>n(m,{title:N.value,remote:!0,filterable:!0,key:R.value,value:F.value,"onUpdate:value":e=>F.value=e,labelField:L.value,valueField:P.value,"menu-props":$,"node-props":E,onSearch:T,"onUpdate:show":H,options:G.value,onFocus:x(w),renderLabel:J,renderTag:M},{empty:()=>e.useLoading&&A.value?n(c,null,null):n(f,{description:"无数据"},null),...u})}}),r(F,w));export{k as REMOTE_SEARCH};
1
+ import{defineComponent as e,watch as l,inject as o,computed as a,ref as t,createVNode as n}from"vue";import{connect as u,mapProps as r}from"@formily/vue";import{HelpCircleSharp as i}from"@vicons/ionicons5";import{useVModel as s,useDebounceFn as p}from"@vueuse/core";import{cloneDeep as v,isString as d}from"lodash-es";import{NSelect as m,NSpin as c,NEmpty as f,NTooltip as y,NIcon as g,NTag as h}from"naive-ui";import"../../../index.js";import{InjectionChangeContextCollector as C}from"../../constants/index.js";import{useCommonInjection as b,useSelectOptionProps as j}from"../../hooks/useCommonInjection.js";import{assignUpdateValue as F,assignClearBindVisited as w,createVisitedSetter as x}from"../../utils/schema.js";import{useFormField as B}from"../../hooks/useFormField.js";import{useUrlConfigOptions as K,useAutographOptions as S}from"../../hooks/useFormRenderOptions.js";const k=u(e({name:"FormRemoteSearch",props:{value:{type:String},requestCache:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},allowCreate:Boolean,labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},showField:{type:String},urlConfig:{type:Object},autograph:{type:String},wordbook:{type:Object},onChange:{},useLoading:{type:Boolean,default:!0},lazyRequest:{type:Boolean,default:!0},multiple:Boolean,deletable:Boolean},emits:["update:value"],setup(e,{slots:u,emit:r}){const F=s(e,"value",r),{field:w,fieldKey:k}=B(),{injectValueValidate:O,injectValueBindKey:D}=b();O(F);const R=D(F),q={onRequestConfigChange:({fetchData:e,valueKey:l})=>e(F.value,{[l]:F.value}),onDepsChange:({fetchData:e,valueKey:l})=>e(F.value,{[l]:F.value})},{labelKey:L,valueKey:P,showKey:V,fetchData:I,searchContent:U,fullOptions:z,loading:A}=e.urlConfig?K(e,F,q):S(e,F,q),T=p(((e,l="label")=>I(e,{["value"===l?P.value:"keyword"]:e})),300);l(F,(e=>{if(e&&!z.value.find((l=>l[P.value]===e)))return T(e,"value")}));o(C).setContext(k.value,(e=>{return{currentOption:v((l=e,z.value.find((e=>e[P.value]===l))))};var l}));const{menuProps:$,nodeProps:E}=j(),G=a((()=>z.value.length||!e.allowCreate?z.value:U.value?[{[L.value]:U.value,[P.value]:U.value},...z.value]:z.value));async function H(e){A.value=e,e&&T()}function J(e){const l=e.alias||e[L.value];if(!l||!d(l))return"";const o=l;return e.desc?n("section",{style:{display:"flex",alignItems:"center",gap:"4px"}},[o,e.desc?n(y,null,{trigger:()=>n(g,{component:i},null),default:()=>e.desc}):null]):o}function M({option:l,handleClose:o}){var a;const t=null!=(a=V.value&&l[V.value])?a:l[L.value];if(!e.multiple)return N.value=t,t;return N.value="",e.deletable?n(h,{closable:!0,onClose:function(e){e.stopPropagation(),o()}},{default:()=>t}):`${t};`}const N=t("");return()=>n(m,{title:N.value,remote:!0,filterable:!0,key:R.value,value:F.value,"onUpdate:value":e=>F.value=e,labelField:L.value,valueField:P.value,"menu-props":$,"node-props":E,onSearch:T,"onUpdate:show":H,options:G.value,onFocus:x(w),renderLabel:J,renderTag:M},{empty:()=>e.useLoading&&A.value?n(c,null,null):n(f,{description:"无数据"},null),...u})}}),r(F,w));export{k as REMOTE_SEARCH};
@@ -109,6 +109,9 @@ export declare const SELECT: import("vue").DefineComponent<{
109
109
  selectAll: {
110
110
  type: BooleanConstructor;
111
111
  };
112
+ searchByValue: {
113
+ type: BooleanConstructor;
114
+ };
112
115
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:value" | "postRecommend")[], "update:value" | "postRecommend", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
113
116
  value: {
114
117
  type: PropType<ArrayAble<string | number> | null>;
@@ -215,6 +218,9 @@ export declare const SELECT: import("vue").DefineComponent<{
215
218
  selectAll: {
216
219
  type: BooleanConstructor;
217
220
  };
221
+ searchByValue: {
222
+ type: BooleanConstructor;
223
+ };
218
224
  }>> & {
219
225
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
220
226
  onPostRecommend?: ((...args: any[]) => any) | undefined;
@@ -234,6 +240,7 @@ export declare const SELECT: import("vue").DefineComponent<{
234
240
  recommendCache: boolean;
235
241
  commonNum: number;
236
242
  recentNum: number;
243
+ searchByValue: boolean;
237
244
  useLoading: boolean;
238
245
  showCustomValue: boolean;
239
246
  cursorPlacement: "end" | "start";
@@ -1 +1 @@
1
- import{defineComponent as e,computed as o,inject as t,useAttrs as l,ref as a,createVNode as r,mergeProps as s,toRaw as n}from"vue";import{arrayed as u}from"../../../../../shared/utils/index.js";import{cloneDeep as i,isArray as p,isObject as m,omit as d,xor as c}from"lodash-es";import{NSelect as f}from"naive-ui";import"@vueuse/core";import"date-fns";import"@vue/shared";import{useSelectAllowModify as v}from"../../../../../shared/hooks/selectHooks/useSelectAllowModify.js";import"../../../../../shared/hooks/selectHooks/useSearchContent.js";import{useSelectRenders as y}from"../../../../../shared/hooks/selectHooks/useSelectRenders.js";import{connect as h,mapProps as b}from"@formily/vue";import{useCommonInjection as j,useSelectOptionProps as S}from"../../hooks/useCommonInjection.js";import{useComplexOptions as k,useComplexOptionsSpan as g}from"../../hooks/useComplexOptions.js";import{InjectionChangeContextCollector as C,InjectionFormUUID as B}from"../../constants/index.js";import"../../../index.js";import"@formily/core";import"@formily/path";import"@vicons/ionicons5";import{assignUpdateValue as F,assignClearBindVisited as A,createVisitedSetter as w}from"../../utils/schema.js";import{useFormField as H}from"../../hooks/useFormField.js";import"../../../../../shared/utils/tapable/SyncHook.js";import"../../../../../shared/utils/tapable/SyncBailHook.js";import"../../../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../../../shared/utils/tapable/SyncLoopHook.js";import"../../../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import"../../hooks/useFormValidator.js";import"./index.js";import{useUrlConfigOptions as O,useAutographOptions as K,useRecommendOptions as R}from"../../hooks/useFormRenderOptions.js";const x=h(e({name:"FormSelect",props:{value:{type:[String,Array,Number]},lazyRequest:{type:Boolean,default:!0},requestCache:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},onChange:{},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},showField:{type:String},allowCreate:Boolean,shouldSave:Boolean,allowModify:Boolean,showCustomValue:Boolean,cursorPlacement:{type:String,default:"end"},urlConfig:{type:Object},autograph:{type:String},wordbook:{type:Object},recommend:{type:Boolean,default:!1},commonList:{type:Array},recentList:{type:Array},getRecommendInfo:{type:Function},commonNum:{type:Number,default:10},recentNum:{type:Number,default:10},recommendCache:{type:Boolean,default:!1},useLoading:{type:Boolean,default:!0},multiple:{type:Boolean},deletable:{type:Boolean,default:!0},selectAll:{type:Boolean}},emits:["update:value","postRecommend"],setup(e,{slots:h,emit:b}){const F=o({get:()=>e.value,async set(e){b("update:value",e),D(e)}}),{labelKey:A,valueKey:x,showKey:V,fetchData:L,searchContent:P,fullOptions:_,filterOptions:N,remoteOptions:I,loading:W}=e.urlConfig?O(e,F):K(e,F),{modifyEvent:E,modifyAbleRef:q,getOptionsWithCreated:M}=v(e,{searchContent:P,labelKey:A,valueKey:x,valueRef:F,fullOptions:_}),{renderComplexOption:T,hasComplexOption:U}=k(e,F),{getRecommend:z,postRecommend:D,sortedOptions:G}=R(e,N,b,A,x),{field:J,fieldKey:Q}=H();t(C).setContext(Q.value,(e=>({currentOption:i(function(e){const o=M(_.value);return p(e)?function(e){const t=o.reduce(((e,o)=>(e[o[x.value]]=o,e)),{});return e.map((e=>t[e]))}(e):(t=e,o.find((e=>e[x.value]===t)));var t}(e))})));const X=async(e="")=>(P.value=e,Promise.allSettled([L(e),z(e)])),{injectValueValidate:Y,injectValueWatchFromEmpty:Z,injectValueBindKey:$}=j();Z(F,X),Y(F);const ee=$(F),{menuProps:oe,nodeProps:te}=S(),{renderTag:le,renderLabel:ae,renderSelectAll:re,titleRef:se}=y(e,{labelKey:A,valueKey:x,valueRef:F,showKey:V,searchContent:P}),ne=o((()=>M(q.value?_.value:G.value))),ue=l(),ie=o((()=>{if(e.allowCreate||e.showCustomValue)return F.value;const o=e.multiple&&p(F.value);return _.value.find((e=>o?F.value.includes(e[x.value]):e[x.value]===F.value))?F.value:null})),pe=a(!1);async function me(e){e&&await X(),pe.value=e}async function de(e,o){await E.updateValue(e,o),I.value&&o&&u(o).forEach((e=>{if(!m(e))return;const o=e;o.created&&o.shouldSave&&I.value.push(d(n(o),["created","shouldSave"]))}))}const ce=t(B),{getSpan:fe}=g(),ve=w(J,E.focus);function ye(o){if(!e.multiple)return;const t=o?ne.value.map((e=>e[x.value])):[];c(t,e.value).length&&(F.value=t)}function he(o){let t=h;return e.multiple&&e.selectAll&&(t={action:()=>re(ye),...h}),r(f,s({title:se.value,key:ee.value,multiple:e.multiple,remote:!0,filterable:!0,loading:W.value,value:ie.value,onUpdateValue:de,"menu-props":oe,"node-props":te,labelField:A.value,valueField:x.value,options:ne.value,onSearch:X,show:pe.value,"onUpdate:show":me,onFocus:ve,onBlur:E.blur,renderLabel:ae,renderTag:le},o,ue),t)}return()=>{var e,o;if(!U.value)return he();const t=null!=(o=null==(e=J.value.decoratorProps)?void 0:e.span)?o:6,l=fe(ce,J.value.address);return r("section",{class:"form-render__selectChildField",style:{"--column":l+t}},[he({class:"form-render__selectChildFieldItem",style:{"--form-item-column":t}}),_.value.map((e=>T({option:e,value:F.value,valueKey:x.value,labelKey:A.value,childFieldStrategy:"checked",renderLabel:!1,attrs:{class:"form-render__selectChildFieldItem",style:{"--form-item-column":l}}})))])}}}),b({dataSource:"options"},F,A));export{x as SELECT};
1
+ import{defineComponent as e,computed as o,inject as t,useAttrs as l,ref as a,createVNode as r,mergeProps as s,toRaw as n}from"vue";import{arrayed as u}from"../../../../../shared/utils/index.js";import{cloneDeep as i,isArray as p,isObject as m,omit as d,xor as c}from"lodash-es";import{NSelect as f}from"naive-ui";import"@vueuse/core";import"date-fns";import"@vue/shared";import{useSelectAllowModify as y}from"../../../../../shared/hooks/selectHooks/useSelectAllowModify.js";import"../../../../../shared/hooks/selectHooks/useSearchContent.js";import{useSelectRenders as v}from"../../../../../shared/hooks/selectHooks/useSelectRenders.js";import{connect as h,mapProps as b}from"@formily/vue";import{useCommonInjection as j,useSelectOptionProps as S}from"../../hooks/useCommonInjection.js";import{useComplexOptions as k,useComplexOptionsSpan as g}from"../../hooks/useComplexOptions.js";import{InjectionChangeContextCollector as C,InjectionFormUUID as B}from"../../constants/index.js";import"../../../index.js";import"@formily/core";import"@formily/path";import"@vicons/ionicons5";import{assignUpdateValue as F,assignClearBindVisited as A,createVisitedSetter as w}from"../../utils/schema.js";import{useFormField as H}from"../../hooks/useFormField.js";import"../../../../../shared/utils/tapable/SyncHook.js";import"../../../../../shared/utils/tapable/SyncBailHook.js";import"../../../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../../../shared/utils/tapable/SyncLoopHook.js";import"../../../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import"../../hooks/useFormValidator.js";import"./index.js";import{useUrlConfigOptions as O,useAutographOptions as K,useRecommendOptions as R}from"../../hooks/useFormRenderOptions.js";const x=h(e({name:"FormSelect",props:{value:{type:[String,Array,Number]},lazyRequest:{type:Boolean,default:!0},requestCache:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},onChange:{},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},showField:{type:String},allowCreate:Boolean,shouldSave:Boolean,allowModify:Boolean,showCustomValue:Boolean,cursorPlacement:{type:String,default:"end"},urlConfig:{type:Object},autograph:{type:String},wordbook:{type:Object},recommend:{type:Boolean,default:!1},commonList:{type:Array},recentList:{type:Array},getRecommendInfo:{type:Function},commonNum:{type:Number,default:10},recentNum:{type:Number,default:10},recommendCache:{type:Boolean,default:!1},useLoading:{type:Boolean,default:!0},multiple:{type:Boolean},deletable:{type:Boolean,default:!0},selectAll:{type:Boolean},searchByValue:{type:Boolean}},emits:["update:value","postRecommend"],setup(e,{slots:h,emit:b}){const F=o({get:()=>e.value,async set(e){b("update:value",e),D(e)}}),{labelKey:A,valueKey:x,showKey:V,fetchData:L,searchContent:P,fullOptions:_,filterOptions:N,remoteOptions:I,loading:W}=e.urlConfig?O(e,F):K(e,F),{modifyEvent:E,modifyAbleRef:q,getOptionsWithCreated:M}=y(e,{searchContent:P,labelKey:A,valueKey:x,valueRef:F,fullOptions:_}),{renderComplexOption:T,hasComplexOption:U}=k(e,F),{getRecommend:z,postRecommend:D,sortedOptions:G}=R(e,N,b,A,x),{field:J,fieldKey:Q}=H();t(C).setContext(Q.value,(e=>({currentOption:i(function(e){const o=M(_.value);return p(e)?function(e){const t=o.reduce(((e,o)=>(e[o[x.value]]=o,e)),{});return e.map((e=>t[e]))}(e):(t=e,o.find((e=>e[x.value]===t)));var t}(e))})));const X=async e=>(P.value=e,Promise.allSettled([L(e),z(e)])),{injectValueValidate:Y,injectValueWatchFromEmpty:Z,injectValueBindKey:$}=j();Z(F,X),Y(F);const ee=$(F),{menuProps:oe,nodeProps:te}=S(),{renderTag:le,renderLabel:ae,renderSelectAll:re,titleRef:se}=v(e,{labelKey:A,valueKey:x,valueRef:F,showKey:V,searchContent:P}),ne=o((()=>M(q.value?_.value:G.value))),ue=l(),ie=o((()=>{if(e.allowCreate||e.showCustomValue)return F.value;const o=e.multiple&&p(F.value);return _.value.find((e=>o?F.value.includes(e[x.value]):e[x.value]===F.value))?F.value:null})),pe=a(!1);async function me(e){e&&await X(),pe.value=e}async function de(e,o){await E.updateValue(e,o),I.value&&o&&u(o).forEach((e=>{if(!m(e))return;const o=e;o.created&&o.shouldSave&&I.value.push(d(n(o),["created","shouldSave"]))}))}const ce=t(B),{getSpan:fe}=g(),ye=w(J,E.focus);function ve(o){if(!e.multiple)return;const t=o?ne.value.map((e=>e[x.value])):[];c(t,e.value).length&&(F.value=t)}function he(o){let t=h;return e.multiple&&e.selectAll&&(t={action:()=>re(ve),...h}),r(f,s({title:se.value,key:ee.value,multiple:e.multiple,remote:!0,filterable:!0,loading:W.value,value:ie.value,onUpdateValue:de,"menu-props":oe,"node-props":te,labelField:A.value,valueField:x.value,options:ne.value,onSearch:X,show:pe.value,"onUpdate:show":me,onFocus:ye,onBlur:E.blur,renderLabel:ae,renderTag:le},o,ue),t)}return()=>{var e,o;if(!U.value)return he();const t=null!=(o=null==(e=J.value.decoratorProps)?void 0:e.span)?o:6,l=fe(ce,J.value.address);return r("section",{class:"form-render__selectChildField",style:{"--column":l+t}},[he({class:"form-render__selectChildFieldItem",style:{"--form-item-column":t}}),_.value.map((e=>T({option:e,value:F.value,valueKey:x.value,labelKey:A.value,childFieldStrategy:"checked",renderLabel:!1,attrs:{class:"form-render__selectChildFieldItem",style:{"--form-item-column":l}}})))])}}}),b({dataSource:"options"},F,A));export{x as SELECT};
@@ -4,7 +4,7 @@ import { Ref } from 'vue';
4
4
  import { UrlConfig } from '../../../../../es/components/form-render';
5
5
  import { RecommendItem } from '../../../../../es/components/recommend-search/src/types';
6
6
  declare type UseOptionHooks = Partial<Record<'onRequestConfigChange' | 'onDepsChange', (payload: {
7
- fetchData: (content?: string | null, otherParams?: AnyObject) => any;
7
+ fetchData: (content?: string, otherParams?: AnyObject) => any;
8
8
  labelKey: string;
9
9
  valueKey: string;
10
10
  }) => any>>;
@@ -29,6 +29,7 @@ export declare function useUrlConfigOptions(props: Partial<{
29
29
  options: AnyObject[];
30
30
  requestCache: boolean;
31
31
  lazyRequest: boolean;
32
+ searchByValue: boolean;
32
33
  }>, valueRef: Ref, hooks?: UseOptionHooks): {
33
34
  labelKey: import("vue").ComputedRef<string>;
34
35
  loading: Ref<boolean>;
@@ -37,7 +38,7 @@ export declare function useUrlConfigOptions(props: Partial<{
37
38
  remoteOptions: Ref<AnyObject[] | null>;
38
39
  filterOptions: import("vue").ComputedRef<AnyObject[]>;
39
40
  fullOptions: import("vue").ComputedRef<AnyObject[]>;
40
- fetchData: (content?: string | null, otherParams?: AnyObject) => Promise<null | undefined>;
41
+ fetchData: (content?: string, otherParams?: AnyObject) => Promise<null | undefined>;
41
42
  searchContent: Ref<string | undefined>;
42
43
  };
43
44
  export declare function useAutographOptions(props: Partial<{
@@ -57,7 +58,7 @@ export declare function useAutographOptions(props: Partial<{
57
58
  valueKey: import("vue").ComputedRef<string>;
58
59
  filterOptions: import("vue").ComputedRef<AnyObject[]>;
59
60
  fullOptions: import("vue").ComputedRef<AnyObject[]>;
60
- fetchData: (content?: string | null, otherParams?: AnyObject) => Promise<null | undefined>;
61
+ fetchData: (content?: string, otherParams?: AnyObject) => Promise<null | undefined>;
61
62
  searchContent: Ref<string | undefined>;
62
63
  };
63
64
  export {};
@@ -1 +1 @@
1
- import{checkInSetupEnv as e,arrayed as l,jsonParse as n}from"../../../../shared/utils/index.js";import{uniqBy as o,isEqual as t,isString as u,omit as a,isFunction as r}from"lodash-es";import"naive-ui";import{computed as i,inject as s,ref as v,watch as c,toRaw as m}from"vue";import"@vueuse/core";import"date-fns";import{useFormRequest as d}from"../../../../shared/hooks/useFormRequest/index.js";import"@vueuse/shared";import{useOptionFiltered as f}from"../../../../shared/hooks/selectHooks/useOptionFiltered.js";import{useSearchContent as y}from"../../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{useForm as p}from"@formily/vue";import"../../index.js";import{InjectionAsyncQueue as h,InjectionFormLifeCycleCaller as g,InjectionFormItemDepsCollector as k}from"../constants/index.js";import{createUrlConfigParams as K,formRenderLog as w}from"../utils/index.js";import{useFormField as C}from"./useFormField.js";function b(e,l){const n=v();return i({get:()=>n.value?n.value:e[l],set(e){n.value=e}})}function O(e,l,t,u,v){const c=b(e,"commonList"),m=b(e,"recentList"),{searchContent:f,optionSearchFilter:p}=y();function g(e){return n(e.itemObj)}const k=i((()=>{var e,l;return null!=(l=null==(e=c.value)?void 0:e.map(g))?l:[]})),K=i((()=>{var e,l;return null!=(l=null==(e=m.value)?void 0:e.map(g))?l:[]})),w=i((()=>{if(!e.recommend||!k.value.length&&!K.value.length)return l.value;const n=o(k.value.concat(K.value),(e=>e[v.value])),t=l.value.filter((e=>n.every((function(l){return l[v.value]!==e[v.value]}))));return[...p(n,u.value),...t]})),{getRecommendRequestInfo:O,getHttpInstance:R}=d();function q(l){const{url:n,getRecommendIds:o}=O(),t=r(o)?o():{},u=r(e.getRecommendInfo)?e.getRecommendInfo():{};return{url:n[l],info:Object.assign({},t,u)}}const{fieldKey:F,field:j}=C(),I=s(h);return{postRecommend:async function(l){if(!e.recommend)return;const n=R();if(!n)return;const{url:o,info:u}=q("post"),a=w.value.find((e=>e[v.value]===l));a&&t("postRecommend",await n.post(o,{...u,keyword:"",itemId:v.value,itemObj:JSON.stringify(a)}))},getRecommend:async function(l){if(!e.recommend)return;if(f.value=l,c.value&&m.value&&e.recommendCache)return;const n=await I.addAsync(function(l,n){const{url:o,info:t}=q("get");return{url:o,method:"get",key:l,cache:n,params:{...t,recNum:Math.max(e.commonNum,e.recentNum),keyword:""},payload:{field:j.value,labelKey:u.value,valueKey:v.value}}}(F.value,e.recommendCache)),{commonly:o,recently:t}=n.reduce(((e,l)=>("commonly"===l.type?e.commonly.push(a(l,["type"])):"recently"===l.type&&e.recently.push(a(l,["type"])),e)),{commonly:[],recently:[]});c.value=o.slice(0,e.commonNum),m.value=t.slice(0,e.recentNum)},sortedOptions:w}}function R(l,n,o){e();const a=s(h),r=s(g),d=i((()=>{var e,n,o;return null!=(o=null!=(n=null==(e=l.urlConfig)?void 0:e.nameKey)?n:l.labelField)?o:"text"})),y=i((()=>{var e,n,o;return null!=(o=null!=(n=null==(e=l.urlConfig)?void 0:e.valueKey)?n:l.valueField)?o:"value"})),p=i((()=>{var e,n;return null!=(n=null==(e=l.urlConfig)?void 0:e.showKey)?n:l.showField})),{remoteOptions:b,filterOptions:O,fullOptions:R,searchContent:q}=f(l,d),{field:F,fieldKey:j}=C(),I=v(!1),x=async function(e,n){if(q.value=e||"",!l.urlConfig)return b.value=null;try{I.value=!0;const e={field:F.value,labelKey:d.value,valueKey:y.value},o=await a.addAsync(await K({config:{...l.urlConfig,payload:e,params:{...l.urlConfig.params,...n}},cache:l.requestCache,field:F.value}));m(b.value)!==o&&(b.value=o,r("afterOptionInit",[j.value,b.value,e]))}catch(e){u(e)&&w(e)}finally{I.value=!1}},D=s(k);return c((()=>l.urlConfig),((e,u)=>{if(t(e,u))return;if(b.value=null,!e)return b.value=null;const a={fetchData:x,labelKey:d.value,valueKey:y.value},{onRequestConfigChange:r,onDepsChange:i}=o||{};D.setDeps(j.value,e.dependKey||[],(async()=>{b.value=null,n.value=null,l.lazyRequest||(i?i(a):x())})),!n.value&&l.lazyRequest||(r?r(a):x())}),{immediate:!0}),{labelKey:d,loading:I,showKey:p,valueKey:y,remoteOptions:b,filterOptions:O,fullOptions:R,fetchData:x,searchContent:q}}function q(n,o,a){e();const r=s(h),y=s(g),K=p(),b=i((()=>{var e;const o=l(null==(e=n.wordbook)?void 0:e.show_key)[0];return u(o)?o:null})),O=i((()=>{var e,l,o,t;const a=null==(l=null==(e=n.wordbook)?void 0:e.render_key)?void 0:l[0];return u(a)?a:null!=(t=null!=(o=b.value)?o:n.labelField)?t:"text"})),R=i((()=>{var e,l,o;return null!=(o=null!=(l=null==(e=n.wordbook)?void 0:e.value_key)?l:n.valueField)?o:"value"})),q=i((()=>{var e;return(null==(e=n.wordbook)?void 0:e.search_key)||[]})),F=i((()=>{var e;return null!=(e=b.value)?e:n.showField})),{fieldKey:j,field:I}=C(),{getSearchRequestInfo:x}=d(),{searchContent:D,remoteOptions:N,filterOptions:S,fullOptions:_}=f(n,O,q),z=v(!1),A=async function(e,l){if(D.value=e||"",!n.autograph||!n.wordbook)return N.value=null;try{z.value=!0;const e={field:I.value,labelKey:O.value,valueKey:R.value},o=await r.addAsync(function(e,l,o,t,u){var a,r,i;const s={autograph:l,wordbookId:e.id,wordbookType:e.type,fieldKeys:e.search_key,keyword:"",page:1,...u};if(null==(a=e.queryParams)?void 0:a.length){const l=null!=(i=null==(r=K.value)?void 0:r.getFormState().values)?i:{};e.queryParams.forEach((e=>{s[e]=l[e]}))}return{...x(),params:s,key:o,cache:n.requestCache,payload:t}}(n.wordbook,n.autograph,j.value,e,l));m(N.value)!==o&&(N.value=o,y("afterOptionInit",[j.value,N.value,e]))}catch(e){u(e)&&w(e)}finally{z.value=!1}},H=s(k);return c((()=>n.wordbook),((e,l)=>{if(t(e,l))return;if(N.value=null,!e)return N.value=null;const u={fetchData:A,labelKey:O.value,valueKey:R.value},{onRequestConfigChange:r,onDepsChange:i}=a||{};H.setDeps(j.value,e.queryParams||[],(async()=>{N.value=null,i?i(u):A()})),!o.value&&n.lazyRequest||(r?r(u):A())}),{immediate:!0}),{labelKey:O,showKey:F,loading:z,remoteOptions:N,valueKey:R,filterOptions:S,fullOptions:_,fetchData:A,searchContent:D}}export{q as useAutographOptions,O as useRecommendOptions,R as useUrlConfigOptions};
1
+ import{checkInSetupEnv as e,arrayed as l,jsonParse as n}from"../../../../shared/utils/index.js";import{uniqBy as u,isEqual as o,isString as a,omit as t,isFunction as r}from"lodash-es";import"naive-ui";import{computed as i,inject as s,ref as v,watch as c,toRaw as m}from"vue";import"@vueuse/core";import"date-fns";import{useFormRequest as d}from"../../../../shared/hooks/useFormRequest/index.js";import"@vueuse/shared";import{useOptionFiltered as f}from"../../../../shared/hooks/selectHooks/useOptionFiltered.js";import{useSearchContent as y}from"../../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{useForm as p}from"@formily/vue";import"../../index.js";import{InjectionAsyncQueue as h,InjectionFormLifeCycleCaller as g,InjectionFormItemDepsCollector as K}from"../constants/index.js";import{createUrlConfigParams as k,formRenderLog as b}from"../utils/index.js";import{useFormField as w}from"./useFormField.js";function C(e,l){const n=v();return i({get:()=>n.value?n.value:e[l],set(e){n.value=e}})}function O(e,l,o,a,v){const c=C(e,"commonList"),m=C(e,"recentList"),{searchContent:f,optionSearchFilter:p}=y();function g(e){return n(e.itemObj)}const K=i((()=>{var e,l;return null!=(l=null==(e=c.value)?void 0:e.map(g))?l:[]})),k=i((()=>{var e,l;return null!=(l=null==(e=m.value)?void 0:e.map(g))?l:[]})),b=i((()=>{if(!e.recommend||!K.value.length&&!k.value.length)return l.value;const n=u(K.value.concat(k.value),(e=>e[v.value])),o=l.value.filter((e=>n.every((function(l){return l[v.value]!==e[v.value]}))));return[...p(n,a.value),...o]})),{getRecommendRequestInfo:O,getHttpInstance:R}=d();function q(l){const{url:n,getRecommendIds:u}=O(),o=r(u)?u():{},a=r(e.getRecommendInfo)?e.getRecommendInfo():{};return{url:n[l],info:Object.assign({},o,a)}}const{fieldKey:F,field:j}=w(),I=s(h);return{postRecommend:async function(l){if(!e.recommend)return;const n=R();if(!n)return;const{url:u,info:a}=q("post"),t=b.value.find((e=>e[v.value]===l));t&&o("postRecommend",await n.post(u,{...a,keyword:"",itemId:v.value,itemObj:JSON.stringify(t)}))},getRecommend:async function(l){if(!e.recommend)return;if(f.value=l,c.value&&m.value&&e.recommendCache)return;const n=await I.addAsync(function(l,n){const{url:u,info:o}=q("get");return{url:u,method:"get",key:l,cache:n,params:{...o,recNum:Math.max(e.commonNum,e.recentNum),keyword:""},payload:{field:j.value,labelKey:a.value,valueKey:v.value}}}(F.value,e.recommendCache)),{commonly:u,recently:o}=n.reduce(((e,l)=>("commonly"===l.type?e.commonly.push(t(l,["type"])):"recently"===l.type&&e.recently.push(t(l,["type"])),e)),{commonly:[],recently:[]});c.value=u.slice(0,e.commonNum),m.value=o.slice(0,e.recentNum)},sortedOptions:b}}function R(l,n,u){e();const t=s(h),r=s(g),d=i((()=>{var e,n,u;return null!=(u=null!=(n=null==(e=l.urlConfig)?void 0:e.nameKey)?n:l.labelField)?u:"text"})),y=i((()=>{var e,n,u;return null!=(u=null!=(n=null==(e=l.urlConfig)?void 0:e.valueKey)?n:l.valueField)?u:"value"})),p=i((()=>{var e,n;return null!=(n=null==(e=l.urlConfig)?void 0:e.showKey)?n:l.showField})),{remoteOptions:C,filterOptions:O,fullOptions:R,searchContent:q}=f(l,{labelKey:d,valueKey:y}),{field:F,fieldKey:j}=w(),I=v(!1),x=async function(e,n){if(q.value=e,!l.urlConfig)return C.value=null;if(null==q.value)try{I.value=!0;const e={field:F.value,labelKey:d.value,valueKey:y.value},u=await t.addAsync(await k({config:{...l.urlConfig,payload:e,params:{...l.urlConfig.params,...n}},cache:l.requestCache,field:F.value}));m(C.value)!==u&&(C.value=u,r("afterOptionInit",[j.value,C.value,e]))}catch(e){a(e)&&b(e)}finally{I.value=!1}},D=s(K);return c((()=>l.urlConfig),((e,a)=>{if(o(e,a))return;if(C.value=null,!e)return C.value=null;const t={fetchData:x,labelKey:d.value,valueKey:y.value},{onRequestConfigChange:r,onDepsChange:i}=u||{};D.setDeps(j.value,e.dependKey||[],(async()=>{C.value=null,n.value=null,l.lazyRequest||(i?i(t):x())})),!n.value&&l.lazyRequest||(r?r(t):x())}),{immediate:!0}),{labelKey:d,loading:I,showKey:p,valueKey:y,remoteOptions:C,filterOptions:O,fullOptions:R,fetchData:x,searchContent:q}}function q(n,u,t){e();const r=s(h),y=s(g),k=p(),C=i((()=>{var e;const u=l(null==(e=n.wordbook)?void 0:e.show_key)[0];return a(u)?u:null})),O=i((()=>{var e,l,u,o;const t=null==(l=null==(e=n.wordbook)?void 0:e.render_key)?void 0:l[0];return a(t)?t:null!=(o=null!=(u=C.value)?u:n.labelField)?o:"text"})),R=i((()=>{var e,l,u;return null!=(u=null!=(l=null==(e=n.wordbook)?void 0:e.value_key)?l:n.valueField)?u:"value"})),q=i((()=>{var e;return(null==(e=n.wordbook)?void 0:e.search_key)||[]})),F=i((()=>{var e;return null!=(e=C.value)?e:n.showField})),{fieldKey:j,field:I}=w(),{getSearchRequestInfo:x}=d(),{searchContent:D,remoteOptions:N,filterOptions:S,fullOptions:_}=f(n,{labelKey:O,valueKey:R,searchKey:q}),z=v(!1),A=async function(e,l){if(D.value=e,!n.autograph||!n.wordbook)return N.value=null;if(null==D.value)try{z.value=!0;const e={field:I.value,labelKey:O.value,valueKey:R.value},u=await r.addAsync(function(e,l,u,o,a){var t,r,i;const s={autograph:l,wordbookId:e.id,wordbookType:e.type,fieldKeys:e.search_key,keyword:"",page:1,...a};if(null==(t=e.queryParams)?void 0:t.length){const l=null!=(i=null==(r=k.value)?void 0:r.getFormState().values)?i:{};e.queryParams.forEach((e=>{s[e]=l[e]}))}return{...x(),params:s,key:u,cache:n.requestCache,payload:o}}(n.wordbook,n.autograph,j.value,e,l));m(N.value)!==u&&(N.value=u,y("afterOptionInit",[j.value,N.value,e]))}catch(e){a(e)&&b(e)}finally{z.value=!1}},H=s(K);return c((()=>n.wordbook),((e,l)=>{if(o(e,l))return;if(N.value=null,!e)return N.value=null;const a={fetchData:A,labelKey:O.value,valueKey:R.value},{onRequestConfigChange:r,onDepsChange:i}=t||{};H.setDeps(j.value,e.queryParams||[],(async()=>{N.value=null,i?i(a):A()})),!u.value&&n.lazyRequest||(r?r(a):A())}),{immediate:!0}),{labelKey:O,showKey:F,loading:z,remoteOptions:N,valueKey:R,filterOptions:S,fullOptions:_,fetchData:A,searchContent:D}}export{q as useAutographOptions,O as useRecommendOptions,R as useUrlConfigOptions};
@@ -1 +1 @@
1
- import{differenceInDays as t,differenceInMonths as e,differenceInYears as n,differenceInHours as a,format as r}from"date-fns";import{isString as s}from"lodash-es";import{FIELD_AGE_UNIT as o,FIELD_SEX_VALUE as u}from"../constants/index.js";function c(t){return((t,e,n)=>{const a={},r=1-t.substr(e,1)%2;a.sex=1===r?u.FEMALE:u.MALE;const s=(2==n?"19":"")+t.substr(6,n),o=t.substr(6+n,2),c=t.substr(8+n,2);a.birthday=s+"-"+o+"-"+c+" 00:00";const d=new Date,i=d.getMonth()+1<parseInt(o,10)||d.getMonth()+1==parseInt(o,10)&&d.getDate()<parseInt(c,10)?1:0;return Object.assign(a,g(a.birthday)),a.age=a.year=d.getFullYear()-parseInt(s,10)-i,a})(t,15==t.length?14:16,15==t.length?2:4)}function d(t=""){return function(t){return t&&"YYYY-MM"===t.toUpperCase()}(t)?"month":t.includes("HH")?"datetime":"date"}const i=/^\d{6}(((19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}(\d|x|X))|(\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}))$/;function h(t){return i.test(t)&&function(t){if(!t||18!==t.length)return!1;const e=[7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2];let n=0;for(let a=0;a<17;a++)n+=+t[a]*e[a];return t.charAt(17).toUpperCase()===["1","0","X","9","8","7","6","5","4","3","2"][n%11]}(t)}function f(t){return/^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(t)}function g(r){const s={},o=new Date,u=new Date(r);return s.day=t(o,u),s.month=e(o,u),s.age=s.year=n(o,u),s.hours=a(o,u),s}function M(t,e,n="yyyy-MM-dd HH:mm"){var a;const s=new Date,u={[o.MINUTE]:()=>c(s,"Minutes",t),[o.HOUR]:()=>c(s,"Hours",t),[o.DAY]:()=>c(s,"Date",t),[o.WEEK]:()=>c(s,"Date",7*t),[o.MONTH]:()=>c(s,"Month",t),[o.YEAR]:()=>c(s,"FullYear",t)};return null==(a=u[e])||a.call(u),r(function(t,e){const n=[{[o.DAY]:"Date",[o.WEEK]:"Date",[o.MONTH]:"Date",[o.YEAR]:"Date"},{[o.HOUR]:"Hours"},{[o.MINUTE]:"Minutes"}],a=n.findIndex((t=>Reflect.has(t,e)));~a&&n.slice(a+1).forEach((e=>{Object.values(e).forEach((e=>{t[`set${e}`]("Date"===e?1:0)}))}));return t.setSeconds(0),t}(s,e),n);function c(t,e,n){t[`set${e}`](t[`get${e}`]()-n)}}function l(t){const e=t.hours<24?{ageUnit:o.HOUR,age:Math.max(t.hours,1)}:t.day<30?{ageUnit:o.DAY,age:Math.max(t.day,1)}:t.day<365?{ageUnit:o.MONTH,age:Math.max(t.month,1)}:{ageUnit:o.YEAR,age:Math.max(t.year,1)};return e.age=Math.max(e.age,1),e}const m=/^(\d{4})-?(\d{2})-?(\d{2})?\s?(\d{2})?:?(\d{2})?:?(\d{2})?$/;function D(t){if(!s(t))return;const e=t.match(m);if(!e)return;const[,n,a,r,o,u,c]=e;return new Date(`${n}-${a}-${r||"01"} ${o||"00"}:${u||"00"}:${c||"00"}`)}export{D as businessDateParser,h as isIdCard,f as isMobile,M as parseAge2Birthday,l as parseAgeFromContext,g as parseBirthday,c as parseIdCard,d as transformDateFormat};
1
+ import{differenceInDays as t,differenceInMonths as e,differenceInYears as n,differenceInHours as a,format as r}from"date-fns";import{isString as s}from"lodash-es";import{FIELD_AGE_UNIT as o,FIELD_SEX_VALUE as u}from"../constants/index.js";function d(t){return((t,e,n)=>{const a={},r=1-t.substr(e,1)%2;a.sex=1===r?u.FEMALE:u.MALE;const s=(2==n?"19":"")+t.substr(6,n),o=t.substr(6+n,2),d=t.substr(8+n,2);a.birthday=s+"-"+o+"-"+d+" 00:00";const c=new Date,i=c.getMonth()+1<parseInt(o,10)||c.getMonth()+1==parseInt(o,10)&&c.getDate()<parseInt(d,10)?1:0;return Object.assign(a,M(a.birthday)),a.age=a.year=c.getFullYear()-parseInt(s,10)-i,a})(t,15==t.length?14:16,15==t.length?2:4)}function c(t=""){return function(t){return t&&"YYYY-MM"===t.toUpperCase()}(t)?"month":t.includes("HH")?"datetime":"date"}const i=/^\d{6}(((19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}(\d|x|X))|(\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}))$/,h=/^[1-9]\d{5}\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}$/;function f(t){return i.test(t)&&function(t){if(!t||18!==t.length)return!1;const e=[7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2];let n=0;for(let a=0;a<17;a++)n+=+t[a]*e[a];return t.charAt(17).toUpperCase()===["1","0","X","9","8","7","6","5","4","3","2"][n%11]}(t)||h.test(t)}function g(t){return/^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(t)}function M(r){const s={},o=new Date,u=new Date(r);return s.day=t(o,u),s.month=e(o,u),s.age=s.year=n(o,u),s.hours=a(o,u),s}function l(t,e,n="yyyy-MM-dd HH:mm"){var a;const s=new Date,u={[o.MINUTE]:()=>d(s,"Minutes",t),[o.HOUR]:()=>d(s,"Hours",t),[o.DAY]:()=>d(s,"Date",t),[o.WEEK]:()=>d(s,"Date",7*t),[o.MONTH]:()=>d(s,"Month",t),[o.YEAR]:()=>d(s,"FullYear",t)};return null==(a=u[e])||a.call(u),r(function(t,e){const n=[{[o.DAY]:"Date",[o.WEEK]:"Date",[o.MONTH]:"Date",[o.YEAR]:"Date"},{[o.HOUR]:"Hours"},{[o.MINUTE]:"Minutes"}],a=n.findIndex((t=>Reflect.has(t,e)));~a&&n.slice(a+1).forEach((e=>{Object.values(e).forEach((e=>{t[`set${e}`]("Date"===e?1:0)}))}));return t.setSeconds(0),t}(s,e),n);function d(t,e,n){t[`set${e}`](t[`get${e}`]()-n)}}function m(t){const e=t.hours<24?{ageUnit:o.HOUR,age:Math.max(t.hours,1)}:t.day<30?{ageUnit:o.DAY,age:Math.max(t.day,1)}:t.day<365?{ageUnit:o.MONTH,age:Math.max(t.month,1)}:{ageUnit:o.YEAR,age:Math.max(t.year,1)};return e.age=Math.max(e.age,1),e}const D=/^(\d{4})-?(\d{2})-?(\d{2})?\s?(\d{2})?:?(\d{2})?:?(\d{2})?$/;function E(t){if(!s(t))return;const e=t.match(D);if(!e)return;const[,n,a,r,o,u,d]=e;return new Date(`${n}-${a}-${r||"01"} ${o||"00"}:${u||"00"}:${d||"00"}`)}export{E as businessDateParser,f as isIdCard,g as isMobile,l as parseAge2Birthday,m as parseAgeFromContext,M as parseBirthday,d as parseIdCard,c as transformDateFormat};