@farris/ui-vue 1.3.3 → 1.3.5

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 (73) hide show
  1. package/components/binding-selector/index.esm.js +15 -15
  2. package/components/binding-selector/index.umd.cjs +1 -1
  3. package/components/condition/index.esm.js +108 -107
  4. package/components/condition/index.umd.cjs +1 -1
  5. package/components/data-grid/index.esm.js +4532 -4268
  6. package/components/data-grid/index.umd.cjs +1 -1
  7. package/components/data-view/index.esm.js +2709 -2690
  8. package/components/data-view/index.umd.cjs +1 -1
  9. package/components/designer-canvas/index.esm.js +4795 -4375
  10. package/components/designer-canvas/index.umd.cjs +1 -1
  11. package/components/dynamic-form/index.esm.js +601 -593
  12. package/components/dynamic-form/index.umd.cjs +1 -1
  13. package/components/event-parameter/index.css +1 -0
  14. package/components/event-parameter/index.esm.js +2685 -165
  15. package/components/event-parameter/index.umd.cjs +1 -1
  16. package/components/events-editor/index.css +1 -1
  17. package/components/events-editor/index.esm.js +594 -575
  18. package/components/events-editor/index.umd.cjs +1 -1
  19. package/components/external-container/index.esm.js +772 -772
  20. package/components/external-container/index.umd.cjs +1 -1
  21. package/components/field-selector/index.esm.js +2921 -2902
  22. package/components/field-selector/index.umd.cjs +1 -1
  23. package/components/filter-bar/index.css +1 -1
  24. package/components/filter-bar/index.esm.js +4137 -4050
  25. package/components/filter-bar/index.umd.cjs +1 -1
  26. package/components/flow-canvas/index.esm.js +4569 -4149
  27. package/components/flow-canvas/index.umd.cjs +1 -1
  28. package/components/list-view/index.esm.js +936 -936
  29. package/components/list-view/index.umd.cjs +1 -1
  30. package/components/lookup/index.esm.js +5226 -4962
  31. package/components/lookup/index.umd.cjs +1 -1
  32. package/components/mapping-editor/index.esm.js +4648 -4384
  33. package/components/mapping-editor/index.umd.cjs +1 -1
  34. package/components/property-panel/index.css +1 -1
  35. package/components/query-solution/index.css +1 -1
  36. package/components/query-solution/index.esm.js +6128 -5879
  37. package/components/query-solution/index.umd.cjs +6 -6
  38. package/components/radio-group/index.esm.js +6 -6
  39. package/components/radio-group/index.umd.cjs +1 -1
  40. package/components/schema-selector/index.esm.js +975 -973
  41. package/components/schema-selector/index.umd.cjs +2 -2
  42. package/components/section/index.esm.js +2107 -417
  43. package/components/section/index.umd.cjs +1 -1
  44. package/components/tabs/index.esm.js +577 -575
  45. package/components/tabs/index.umd.cjs +1 -1
  46. package/components/textarea/index.esm.js +84 -79
  47. package/components/textarea/index.umd.cjs +1 -1
  48. package/components/tree-grid/index.esm.js +3307 -3288
  49. package/components/tree-grid/index.umd.cjs +1 -1
  50. package/components/tree-view/index.esm.js +1537 -1533
  51. package/components/tree-view/index.umd.cjs +1 -1
  52. package/farris.all.esm.js +24890 -24173
  53. package/farris.all.umd.cjs +13 -13
  54. package/index.css +1 -1
  55. package/package.json +1 -1
  56. package/types/condition/src/composition/condition-value/input-group-value.d.ts +1 -1
  57. package/types/data-grid/src/components/data/data-grid-area.component.d.ts +8 -0
  58. package/types/data-grid/src/components/data/data-grid-area.props.d.ts +3 -0
  59. package/types/data-view/composition/types.d.ts +1 -0
  60. package/types/dynamic-form/src/designer/form-group-use-designer-rules.d.ts +1 -2
  61. package/types/entity-binding-selector/composition/use-entity-tree.d.ts +14 -3
  62. package/types/entity-binding-selector/composition/use-field-tree.d.ts +28 -0
  63. package/types/event-parameter/src/composition/use-general-editor.d.ts +26 -0
  64. package/types/event-parameter/src/event-parameter.props.d.ts +4 -4
  65. package/types/events-editor/src/composition/types.d.ts +1 -1
  66. package/types/query-solution/src/composition/types.d.ts +55 -0
  67. package/types/query-solution/src/composition/use-condition.d.ts +19 -0
  68. package/types/query-solution/src/designer/query-solution-config/composition/types.d.ts +3 -2
  69. package/types/query-solution/src/designer/query-solution-config/converter/query-solution-config-property.converter.d.ts +4 -0
  70. package/types/section/index.d.ts +15 -0
  71. package/types/section/src/designer/section-header.design.component.d.ts +4 -0
  72. package/types/section/src/designer/section-toolbar-item.props.d.ts +19 -0
  73. package/types/section/src/designer/section-toolbar.design.component.d.ts +3 -0
@@ -1,4 +1,4 @@
1
- import { defineComponent as A, ref as p, onBeforeMount as G, onMounted as W, createVNode as y, createTextVNode as j } from "vue";
1
+ import { defineComponent as A, ref as p, onBeforeMount as G, onMounted as W, createVNode as y, createTextVNode as O } from "vue";
2
2
  import z from "../button-edit/index.esm.js";
3
3
  import { FNotifyService as D } from "../notify/index.esm.js";
4
4
  import q from "../tree-grid/index.esm.js";
@@ -82,7 +82,7 @@ const Y = "https://json-schema.org/draft/2020-12/schema", Z = "https://farris-de
82
82
  { value: "Form", text: "绑定字段" },
83
83
  { value: "LocaleVariable", text: "绑定组件变量" },
84
84
  { value: "RemoteVariable", text: "绑定表单变量" }
85
- ], k = {
85
+ ], R = {
86
86
  disabled: { type: Boolean, default: !1 },
87
87
  readonly: { type: Boolean, default: !1 },
88
88
  modelValue: { type: Object, default: null },
@@ -113,7 +113,7 @@ const Y = "https://json-schema.org/draft/2020-12/schema", Z = "https://farris-de
113
113
  onFieldSelected: { type: Function, default: null },
114
114
  /** 是否显示自定义的底部按钮区域 */
115
115
  showCustomFooter: { type: Boolean, default: !1 }
116
- }, ae = Q(k, ie);
116
+ }, ae = Q(R, ie);
117
117
  function U(e) {
118
118
  const { designViewModelUtils: g } = e.editorParams.designerHostService, { formSchemaUtils: d } = e.editorParams.designerHostService, { viewModelId: o } = e.editorParams;
119
119
  let h = [], f = [], S = [];
@@ -231,9 +231,9 @@ function U(e) {
231
231
  resolveFieldTypesByEditorType: V
232
232
  };
233
233
  }
234
- const O = /* @__PURE__ */ A({
234
+ const k = /* @__PURE__ */ A({
235
235
  name: "FBindingSelectorContainer",
236
- props: k,
236
+ props: R,
237
237
  emits: ["selected", "bindingTypeChange", "cancel", "submit"],
238
238
  setup(e, g) {
239
239
  var c, u, m;
@@ -244,8 +244,8 @@ const O = /* @__PURE__ */ A({
244
244
  resolveFieldTypesByEditorType: M
245
245
  } = U(e), F = p([]);
246
246
  G(() => {
247
- var n, s, r, b, R, $;
248
- w(), d.value = T(o.value), (n = e.editorParams) != null && n.disableOccupiedFields && (S.value = C((r = (s = e.editorParams) == null ? void 0 : s.componentSchema) == null ? void 0 : r.binding)), v.value = M(($ = (R = (b = e.editorParams) == null ? void 0 : b.componentSchema) == null ? void 0 : R.editor) == null ? void 0 : $.type), F.value = o.value === "Form" ? L : H;
247
+ var n, s, r, b, $, j;
248
+ w(), d.value = T(o.value), (n = e.editorParams) != null && n.disableOccupiedFields && (S.value = C((r = (s = e.editorParams) == null ? void 0 : s.componentSchema) == null ? void 0 : r.binding)), v.value = M((j = ($ = (b = e.editorParams) == null ? void 0 : b.componentSchema) == null ? void 0 : $.editor) == null ? void 0 : j.type), F.value = o.value === "Form" ? L : H;
249
249
  }), W(() => {
250
250
  var s, r, b;
251
251
  const n = (b = (r = (s = e.editorParams) == null ? void 0 : s.componentSchema) == null ? void 0 : r.binding) == null ? void 0 : b.field;
@@ -327,21 +327,21 @@ const O = /* @__PURE__ */ A({
327
327
  }, [e.bindingType.enable && V(), y("div", {
328
328
  class: B,
329
329
  style: "position:relative;border-radius:10px;"
330
- }, [t()]), e.showCustomFooter ? y("div", {
330
+ }, [O(" "), t()]), e.showCustomFooter ? y("div", {
331
331
  class: "modal-footer"
332
332
  }, [y("button", {
333
333
  type: "button",
334
334
  class: "btn btn-secondary",
335
335
  onClick: i
336
- }, [j("取消")]), y("button", {
336
+ }, [O("取消")]), y("button", {
337
337
  type: "button",
338
338
  class: "btn btn-primary",
339
339
  onClick: l
340
- }, [j("确定")])]) : ""]);
340
+ }, [O("确定")])]) : ""]);
341
341
  }
342
342
  }), N = /* @__PURE__ */ A({
343
343
  name: "FBindingSelector",
344
- props: k,
344
+ props: R,
345
345
  emits: ["selected", "bindingTypeChanged"],
346
346
  setup(e, g) {
347
347
  var V, P;
@@ -359,7 +359,7 @@ const O = /* @__PURE__ */ A({
359
359
  v.value = t.path;
360
360
  }
361
361
  function B() {
362
- return y(O, {
362
+ return y(k, {
363
363
  ref: f,
364
364
  data: h.value,
365
365
  onSelected: C,
@@ -427,15 +427,15 @@ const O = /* @__PURE__ */ A({
427
427
  }
428
428
  });
429
429
  N.install = (e) => {
430
- e.component(N.name, N), e.component(O.name, O);
430
+ e.component(N.name, N), e.component(k.name, k);
431
431
  };
432
432
  N.register = (e, g, d, o) => {
433
433
  e["binding-selector"] = N, g["binding-selector"] = ae;
434
434
  };
435
435
  export {
436
436
  N as BindingSelector,
437
- O as FBindingSelectorContainer,
438
- k as bindingSelectorProps,
437
+ k as FBindingSelectorContainer,
438
+ R as bindingSelectorProps,
439
439
  oe as bindingTypes,
440
440
  N as default,
441
441
  L as fieldColumns,
@@ -1 +1 @@
1
- (function(l,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue"),require("../button-edit/index.umd.js"),require("../notify/index.umd.js"),require("../tree-grid/index.umd.js"),require("../radio-group/index.umd.js"),require("../common/index.umd.js"),require("../dynamic-resolver/index.umd.js"),require("../property-panel/index.umd.js"),require("lodash-es")):typeof define=="function"&&define.amd?define(["exports","vue","../button-edit/index.umd.js","../notify/index.umd.js","../tree-grid/index.umd.js","../radio-group/index.umd.js","../common/index.umd.js","../dynamic-resolver/index.umd.js","../property-panel/index.umd.js","lodash-es"],i):(l=typeof globalThis<"u"?globalThis:l||self,i(l["binding-selector"]={},l.Vue,l.FButtonEdit,l.notify,l.FTreeGrid,l.FRadioGroup,l.common,l.dynamicResolver,l.propertyPanel,l.LodashES))})(this,function(l,i,U,$,G,W,_,z,J,q){"use strict";const K={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/binding-selector.schema.json",title:"binding-selector",description:"字段绑定选择器",type:"object",properties:{disabled:{description:"",type:"boolean",default:!1},readonly:{description:"",type:"boolean",default:!1},bindingType:{description:"",type:"object",default:{}},idField:{description:"",type:"string",default:"id"},title:{description:"",type:"string",default:"字段选择器"},modalWidth:{description:"",type:"number",default:800},modalHeight:{description:"",type:"number",default:600},separator:{description:"",type:"string",default:","},bindingData:{description:"",type:"array",default:[]},textField:{description:"",type:"string",default:"code"},editorParams:{description:"",type:"object",default:{}}}},R=[{field:"name",title:"名称"},{field:"bindingField",title:"绑定字段"},{field:"fieldType",title:"字段类型"}],k=[{field:"name",title:"名称"},{field:"code",title:"编号"},{field:"displayTypeName",title:"变量类型"}],E=[{value:"Form",text:"绑定字段"},{value:"LocaleVariable",text:"绑定组件变量"},{value:"RemoteVariable",text:"绑定表单变量"}],I={disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},modelValue:{type:Object,default:null},bindingType:{type:Object,default:{enable:!0,value:"Form",textField:"text",valueField:"value"}},data:{type:Array,default:[]},idField:{type:String,default:"id"},title:{type:String,default:"字段选择器"},modalWidth:{type:Number,default:800},modalHeight:{type:Number,default:600},multiSelect:{type:Boolean,default:!1},separator:{type:String,default:","},bindingData:{type:Array,default:[]},textField:{type:String,default:"code"},beforeOpenDialog:{type:Function,default:null},editorParams:{type:Object,default:null},onFieldSelected:{type:Function,default:null},showCustomFooter:{type:Boolean,default:!1}},L=z.createPropsResolver(I,K);function H(e){const{designViewModelUtils:p}=e.editorParams.designerHostService,{formSchemaUtils:c}=e.editorParams.designerHostService,{viewModelId:d}=e.editorParams;let h=[],g=[],S=[];function F(t){switch(t){case"LocaleVariable":return g;case"RemoteVariable":return S;default:return h}}function v(){h=p.getAllFields2TreeByVMId(d)}function C(){const t=c.getViewModelById(d);if(t.parent){const a=c.getLocaleVariablesByViewModelId(t.parent);a&&a.length&&(a[0].data.name="根组件",g=g.concat(a))}const o=c.getLocaleVariablesByViewModelId(d);g=g.concat(o)}function M(){S=c.getRemoteVariables()}function N(t){var s,m,f;const o=q.merge({},t.rawData,{groupId:null,groupName:null}),a=(s=e.editorParams.componentSchema)==null?void 0:s.binding,r=p.getDgViewModel(d);if(a!=null&&a.field){const n=r.fields.find(y=>y.id===a.field);if(r.removeField([a.field]),n){const{groupId:y,groupName:u,editor:b}=n;q.merge(o,{editor:b,groupId:y,groupName:u})}}r.addField(o),(f=(m=e.editorParams.componentSchema)==null?void 0:m.editor)!=null&&f.type&&r.changeField(o.id,{editor:e.editorParams.componentSchema.editor.type})}function V(t){var s;const o=(s=e.editorParams.componentSchema)==null?void 0:s.binding,a=p.getDgViewModel(d),r={type:"Variable",id:t.id,fieldName:t.code,groupId:"",groupName:""};if(o!=null&&o.field){const m=c.getViewModelById(d),f=m==null?void 0:m.fields.find(n=>n.id===(o==null?void 0:o.field));f&&(r.groupName=f.groupName,r.groupId=f.groupId),a.removeField([o==null?void 0:o.field])}c.addViewModelField(d,r)}function x(t,o){if(!e.editorParams.needSyncToViewModel||!e.editorParams.viewModelId||!e.editorParams.designerHostService)return;const a=e.editorParams.componentSchema.binding;a&&a.field===t.id||(o==="Form"?N(t):V(t))}function j(t,o){if(e.editorParams.componentSchema){switch(e.editorParams.componentSchema.binding||(e.editorParams.componentSchema.binding={}),o){case"Form":{e.editorParams.componentSchema.binding.path=t.bindingField,e.editorParams.componentSchema.binding.field=t.id,e.editorParams.componentSchema.binding.fullPath=t.path;break}case"LocaleVariable":{e.editorParams.componentSchema.binding.path=t.viewModelId===d?t.code:"root-component."+t.code,e.editorParams.componentSchema.binding.field=t.id,e.editorParams.componentSchema.binding.fullPath=t.code;break}case"RemoteVariable":{e.editorParams.componentSchema.binding.path="root-component."+t.code,e.editorParams.componentSchema.binding.field=t.id,e.editorParams.componentSchema.binding.fullPath=t.code;break}}return e.editorParams.componentSchema.binding.type=o,e.editorParams.componentSchema.path=t.bindingPath,e.editorParams.componentSchema.binding}}function B(t){const o=t==null?void 0:t.field,a=new Set,r=c.getFormSchema().module,s=c.getViewModelById(d);let f=r.components.find(n=>n.viewModel===d).componentType;return(f==="frame"||f==="table")&&(f="form"),r.viewmodels.forEach(n=>{if(!n.fields||n.fields.length===0)return;const y=r.components.find(b=>b.viewModel===n.id);let{componentType:u}=y;(u==="frame"||u==="table")&&(u="form"),!(u!==f||n.bindTo!==s.bindTo)&&n.fields.forEach(b=>{b.id!==o&&a.add(b.id)})}),a}function P(t){if(!t)return[];const o={},{fieldControlTypeMapping:a}=J.SchemaDOMMapping;for(const r in a){const s=a[r];!s||!s.length||s.forEach(m=>{o[m.key]=o[m.key]||[],o[m.key].push(r)})}return o[t]}function w(){v(),C(),M()}return{initTreeData:w,getTreeDataSource:F,updateViewModel:x,updateComponentSchema:j,resolveOccupiedFields:B,resolveFieldTypesByEditorType:P}}const O=i.defineComponent({name:"FBindingSelectorContainer",props:I,emits:["selected","bindingTypeChange","cancel","submit"],setup(e,p){var s,m,f;const c=i.ref(e.data),d=i.ref(((s=e.modelValue)==null?void 0:s.type)||"Form"),h=i.ref(e.bindingData),g=i.ref(),S=i.ref(),F=i.ref(),{getTreeDataSource:v,initTreeData:C,resolveOccupiedFields:M,resolveFieldTypesByEditorType:N}=H(e),V=i.ref([]);i.onBeforeMount(()=>{var n,y,u,b,A,D;C(),c.value=v(d.value),(n=e.editorParams)!=null&&n.disableOccupiedFields&&(S.value=M((u=(y=e.editorParams)==null?void 0:y.componentSchema)==null?void 0:u.binding)),F.value=N((D=(A=(b=e.editorParams)==null?void 0:b.componentSchema)==null?void 0:A.editor)==null?void 0:D.type),V.value=d.value==="Form"?R:k}),i.onMounted(()=>{var y,u,b;const n=(b=(u=(y=e.editorParams)==null?void 0:y.componentSchema)==null?void 0:u.binding)==null?void 0:b.field;n&&g.value.selectItemById(n)});const x={"f-utils-fill":!0,"m-2":(m=e.bindingType)==null?void 0:m.enable,"mx-2":!((f=e.bindingType)!=null&&f.enable),border:!0};function j(n){V.value=n==="Form"?R:k,g.value.updateColumns(V.value),c.value=v(n),g.value.updateDataSource(c.value),g.value.clearSelection(),h.value=[],p.emit("selected",[]),p.emit("bindingTypeChange",n)}function B(n){h.value=n,p.emit("selected",n)}function P(){return i.createVNode("div",{class:"px-3"},[i.createVNode(W,{name:"bindingType",textField:e.bindingType.textField,valueField:e.bindingType.valueField,enumData:E,modelValue:d.value,"onUpdate:modelValue":n=>d.value=n,onChangeValue:j},null)])}const w={customRowStatus:n=>{var u;if(n.raw.$type&&n.raw.$type!==_.FormSchemaEntityField$Type.SimpleField||S.value&&S.value.has(n.raw.id))return n.disabled=!0,n;const y=d.value==="Form"?(u=n.raw.type)==null?void 0:u.name:n.raw.type;return y&&F.value&&!F.value.includes(y)?(n.disabled=!0,n):(n.disabled=!1,n)}};function t(){return i.createVNode(G,{ref:g,fit:!0,data:c.value,idField:e.idField,columns:V.value,rowNumber:{enable:!1},columnOption:{fitColumns:!0},onSelectionChange:B,"row-option":w},null)}function o(){p.emit("cancel")}function a(){if(!h.value||!h.value.length){const n=new $.FNotifyService;return n.globalConfig={position:"top-center"},n.warning({message:"请先选择数据"}),!1}return!0}function r(){a()&&p.emit("submit",{selectedData:h.value[0],bindingType:d.value})}return()=>i.createVNode("div",{class:"h-100 d-flex flex-column"},[e.bindingType.enable&&P(),i.createVNode("div",{class:x,style:"position:relative;border-radius:10px;"},[t()]),e.showCustomFooter?i.createVNode("div",{class:"modal-footer"},[i.createVNode("button",{type:"button",class:"btn btn-secondary",onClick:o},[i.createTextVNode("取消")]),i.createVNode("button",{type:"button",class:"btn btn-primary",onClick:r},[i.createTextVNode("确定")])]):""])}}),T=i.defineComponent({name:"FBindingSelector",props:I,emits:["selected","bindingTypeChanged"],setup(e,p){var P,w;const c='<i class="f-icon f-icon-lookup"></i>',d=i.ref(e.bindingData),h=i.ref(e.data),g=i.ref(),S=i.ref(((P=e.modelValue)==null?void 0:P.type)||"Form"),F=i.ref((w=e.modelValue)==null?void 0:w.path),{updateViewModel:v,updateComponentSchema:C}=H(e);function M(t){d.value=t}function N(t){S.value=t}function V(t){F.value=t.path}function x(){return i.createVNode(O,{ref:g,data:h.value,onSelected:M,modelValue:e.modelValue,idField:e.idField,bindingData:d.value,onBindingTypeChange:N,editorParams:e.editorParams,bindingType:e.bindingType,showCustomFooter:!1},null)}function j(){if(!d.value||!d.value.length){const t=new $.FNotifyService;return t.globalConfig={position:"top-center"},t.warning({message:"请先选择数据"}),!1}return!0}const B={title:e.title,fitContent:!1,height:e.modalHeight,width:e.modalWidth,buttons:[{name:"cancel",text:"取消",class:"btn btn-secondary",handle:t=>(d.value=[],!0)},{name:"accept",text:"确定",class:"btn btn-primary",handle:t=>{if(!j())return!1;v(d.value[0],S.value);const o=C(d.value[0],S.value);return V(o),e.onFieldSelected&&typeof e.onFieldSelected=="function"&&e.onFieldSelected(o),!0}}],reiszeable:!0,draggable:!0};return()=>i.createVNode(U,{modelValue:F.value,"onUpdate:modelValue":t=>F.value=t,editable:!1,disabled:e.disabled,readonly:e.readonly,inputType:"text",enableClear:!1,buttonContent:c,buttonBehavior:"Modal",modalOptions:B},{default:()=>[i.createVNode("div",{class:"h-100 d-flex flex-column"},[x()])]})}});T.install=e=>{e.component(T.name,T),e.component(O.name,O)},T.register=(e,p,c,d)=>{e["binding-selector"]=T,p["binding-selector"]=L},l.BindingSelector=T,l.FBindingSelectorContainer=O,l.bindingSelectorProps=I,l.bindingTypes=E,l.default=T,l.fieldColumns=R,l.propsResolver=L,l.variableColumns=k,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(l,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue"),require("../button-edit/index.umd.js"),require("../notify/index.umd.js"),require("../tree-grid/index.umd.js"),require("../radio-group/index.umd.js"),require("../common/index.umd.js"),require("../dynamic-resolver/index.umd.js"),require("../property-panel/index.umd.js"),require("lodash-es")):typeof define=="function"&&define.amd?define(["exports","vue","../button-edit/index.umd.js","../notify/index.umd.js","../tree-grid/index.umd.js","../radio-group/index.umd.js","../common/index.umd.js","../dynamic-resolver/index.umd.js","../property-panel/index.umd.js","lodash-es"],i):(l=typeof globalThis<"u"?globalThis:l||self,i(l["binding-selector"]={},l.Vue,l.FButtonEdit,l.notify,l.FTreeGrid,l.FRadioGroup,l.common,l.dynamicResolver,l.propertyPanel,l.LodashES))})(this,function(l,i,U,$,G,W,_,z,J,q){"use strict";const K={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/binding-selector.schema.json",title:"binding-selector",description:"字段绑定选择器",type:"object",properties:{disabled:{description:"",type:"boolean",default:!1},readonly:{description:"",type:"boolean",default:!1},bindingType:{description:"",type:"object",default:{}},idField:{description:"",type:"string",default:"id"},title:{description:"",type:"string",default:"字段选择器"},modalWidth:{description:"",type:"number",default:800},modalHeight:{description:"",type:"number",default:600},separator:{description:"",type:"string",default:","},bindingData:{description:"",type:"array",default:[]},textField:{description:"",type:"string",default:"code"},editorParams:{description:"",type:"object",default:{}}}},R=[{field:"name",title:"名称"},{field:"bindingField",title:"绑定字段"},{field:"fieldType",title:"字段类型"}],k=[{field:"name",title:"名称"},{field:"code",title:"编号"},{field:"displayTypeName",title:"变量类型"}],E=[{value:"Form",text:"绑定字段"},{value:"LocaleVariable",text:"绑定组件变量"},{value:"RemoteVariable",text:"绑定表单变量"}],I={disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},modelValue:{type:Object,default:null},bindingType:{type:Object,default:{enable:!0,value:"Form",textField:"text",valueField:"value"}},data:{type:Array,default:[]},idField:{type:String,default:"id"},title:{type:String,default:"字段选择器"},modalWidth:{type:Number,default:800},modalHeight:{type:Number,default:600},multiSelect:{type:Boolean,default:!1},separator:{type:String,default:","},bindingData:{type:Array,default:[]},textField:{type:String,default:"code"},beforeOpenDialog:{type:Function,default:null},editorParams:{type:Object,default:null},onFieldSelected:{type:Function,default:null},showCustomFooter:{type:Boolean,default:!1}},L=z.createPropsResolver(I,K);function H(e){const{designViewModelUtils:p}=e.editorParams.designerHostService,{formSchemaUtils:c}=e.editorParams.designerHostService,{viewModelId:d}=e.editorParams;let h=[],g=[],S=[];function F(t){switch(t){case"LocaleVariable":return g;case"RemoteVariable":return S;default:return h}}function v(){h=p.getAllFields2TreeByVMId(d)}function C(){const t=c.getViewModelById(d);if(t.parent){const a=c.getLocaleVariablesByViewModelId(t.parent);a&&a.length&&(a[0].data.name="根组件",g=g.concat(a))}const o=c.getLocaleVariablesByViewModelId(d);g=g.concat(o)}function N(){S=c.getRemoteVariables()}function x(t){var s,m,f;const o=q.merge({},t.rawData,{groupId:null,groupName:null}),a=(s=e.editorParams.componentSchema)==null?void 0:s.binding,r=p.getDgViewModel(d);if(a!=null&&a.field){const n=r.fields.find(y=>y.id===a.field);if(r.removeField([a.field]),n){const{groupId:y,groupName:u,editor:b}=n;q.merge(o,{editor:b,groupId:y,groupName:u})}}r.addField(o),(f=(m=e.editorParams.componentSchema)==null?void 0:m.editor)!=null&&f.type&&r.changeField(o.id,{editor:e.editorParams.componentSchema.editor.type})}function V(t){var s;const o=(s=e.editorParams.componentSchema)==null?void 0:s.binding,a=p.getDgViewModel(d),r={type:"Variable",id:t.id,fieldName:t.code,groupId:"",groupName:""};if(o!=null&&o.field){const m=c.getViewModelById(d),f=m==null?void 0:m.fields.find(n=>n.id===(o==null?void 0:o.field));f&&(r.groupName=f.groupName,r.groupId=f.groupId),a.removeField([o==null?void 0:o.field])}c.addViewModelField(d,r)}function M(t,o){if(!e.editorParams.needSyncToViewModel||!e.editorParams.viewModelId||!e.editorParams.designerHostService)return;const a=e.editorParams.componentSchema.binding;a&&a.field===t.id||(o==="Form"?x(t):V(t))}function j(t,o){if(e.editorParams.componentSchema){switch(e.editorParams.componentSchema.binding||(e.editorParams.componentSchema.binding={}),o){case"Form":{e.editorParams.componentSchema.binding.path=t.bindingField,e.editorParams.componentSchema.binding.field=t.id,e.editorParams.componentSchema.binding.fullPath=t.path;break}case"LocaleVariable":{e.editorParams.componentSchema.binding.path=t.viewModelId===d?t.code:"root-component."+t.code,e.editorParams.componentSchema.binding.field=t.id,e.editorParams.componentSchema.binding.fullPath=t.code;break}case"RemoteVariable":{e.editorParams.componentSchema.binding.path="root-component."+t.code,e.editorParams.componentSchema.binding.field=t.id,e.editorParams.componentSchema.binding.fullPath=t.code;break}}return e.editorParams.componentSchema.binding.type=o,e.editorParams.componentSchema.path=t.bindingPath,e.editorParams.componentSchema.binding}}function B(t){const o=t==null?void 0:t.field,a=new Set,r=c.getFormSchema().module,s=c.getViewModelById(d);let f=r.components.find(n=>n.viewModel===d).componentType;return(f==="frame"||f==="table")&&(f="form"),r.viewmodels.forEach(n=>{if(!n.fields||n.fields.length===0)return;const y=r.components.find(b=>b.viewModel===n.id);let{componentType:u}=y;(u==="frame"||u==="table")&&(u="form"),!(u!==f||n.bindTo!==s.bindTo)&&n.fields.forEach(b=>{b.id!==o&&a.add(b.id)})}),a}function P(t){if(!t)return[];const o={},{fieldControlTypeMapping:a}=J.SchemaDOMMapping;for(const r in a){const s=a[r];!s||!s.length||s.forEach(m=>{o[m.key]=o[m.key]||[],o[m.key].push(r)})}return o[t]}function w(){v(),C(),N()}return{initTreeData:w,getTreeDataSource:F,updateViewModel:M,updateComponentSchema:j,resolveOccupiedFields:B,resolveFieldTypesByEditorType:P}}const O=i.defineComponent({name:"FBindingSelectorContainer",props:I,emits:["selected","bindingTypeChange","cancel","submit"],setup(e,p){var s,m,f;const c=i.ref(e.data),d=i.ref(((s=e.modelValue)==null?void 0:s.type)||"Form"),h=i.ref(e.bindingData),g=i.ref(),S=i.ref(),F=i.ref(),{getTreeDataSource:v,initTreeData:C,resolveOccupiedFields:N,resolveFieldTypesByEditorType:x}=H(e),V=i.ref([]);i.onBeforeMount(()=>{var n,y,u,b,A,D;C(),c.value=v(d.value),(n=e.editorParams)!=null&&n.disableOccupiedFields&&(S.value=N((u=(y=e.editorParams)==null?void 0:y.componentSchema)==null?void 0:u.binding)),F.value=x((D=(A=(b=e.editorParams)==null?void 0:b.componentSchema)==null?void 0:A.editor)==null?void 0:D.type),V.value=d.value==="Form"?R:k}),i.onMounted(()=>{var y,u,b;const n=(b=(u=(y=e.editorParams)==null?void 0:y.componentSchema)==null?void 0:u.binding)==null?void 0:b.field;n&&g.value.selectItemById(n)});const M={"f-utils-fill":!0,"m-2":(m=e.bindingType)==null?void 0:m.enable,"mx-2":!((f=e.bindingType)!=null&&f.enable),border:!0};function j(n){V.value=n==="Form"?R:k,g.value.updateColumns(V.value),c.value=v(n),g.value.updateDataSource(c.value),g.value.clearSelection(),h.value=[],p.emit("selected",[]),p.emit("bindingTypeChange",n)}function B(n){h.value=n,p.emit("selected",n)}function P(){return i.createVNode("div",{class:"px-3"},[i.createVNode(W,{name:"bindingType",textField:e.bindingType.textField,valueField:e.bindingType.valueField,enumData:E,modelValue:d.value,"onUpdate:modelValue":n=>d.value=n,onChangeValue:j},null)])}const w={customRowStatus:n=>{var u;if(n.raw.$type&&n.raw.$type!==_.FormSchemaEntityField$Type.SimpleField||S.value&&S.value.has(n.raw.id))return n.disabled=!0,n;const y=d.value==="Form"?(u=n.raw.type)==null?void 0:u.name:n.raw.type;return y&&F.value&&!F.value.includes(y)?(n.disabled=!0,n):(n.disabled=!1,n)}};function t(){return i.createVNode(G,{ref:g,fit:!0,data:c.value,idField:e.idField,columns:V.value,rowNumber:{enable:!1},columnOption:{fitColumns:!0},onSelectionChange:B,"row-option":w},null)}function o(){p.emit("cancel")}function a(){if(!h.value||!h.value.length){const n=new $.FNotifyService;return n.globalConfig={position:"top-center"},n.warning({message:"请先选择数据"}),!1}return!0}function r(){a()&&p.emit("submit",{selectedData:h.value[0],bindingType:d.value})}return()=>i.createVNode("div",{class:"h-100 d-flex flex-column"},[e.bindingType.enable&&P(),i.createVNode("div",{class:M,style:"position:relative;border-radius:10px;"},[i.createTextVNode(" "),t()]),e.showCustomFooter?i.createVNode("div",{class:"modal-footer"},[i.createVNode("button",{type:"button",class:"btn btn-secondary",onClick:o},[i.createTextVNode("取消")]),i.createVNode("button",{type:"button",class:"btn btn-primary",onClick:r},[i.createTextVNode("确定")])]):""])}}),T=i.defineComponent({name:"FBindingSelector",props:I,emits:["selected","bindingTypeChanged"],setup(e,p){var P,w;const c='<i class="f-icon f-icon-lookup"></i>',d=i.ref(e.bindingData),h=i.ref(e.data),g=i.ref(),S=i.ref(((P=e.modelValue)==null?void 0:P.type)||"Form"),F=i.ref((w=e.modelValue)==null?void 0:w.path),{updateViewModel:v,updateComponentSchema:C}=H(e);function N(t){d.value=t}function x(t){S.value=t}function V(t){F.value=t.path}function M(){return i.createVNode(O,{ref:g,data:h.value,onSelected:N,modelValue:e.modelValue,idField:e.idField,bindingData:d.value,onBindingTypeChange:x,editorParams:e.editorParams,bindingType:e.bindingType,showCustomFooter:!1},null)}function j(){if(!d.value||!d.value.length){const t=new $.FNotifyService;return t.globalConfig={position:"top-center"},t.warning({message:"请先选择数据"}),!1}return!0}const B={title:e.title,fitContent:!1,height:e.modalHeight,width:e.modalWidth,buttons:[{name:"cancel",text:"取消",class:"btn btn-secondary",handle:t=>(d.value=[],!0)},{name:"accept",text:"确定",class:"btn btn-primary",handle:t=>{if(!j())return!1;v(d.value[0],S.value);const o=C(d.value[0],S.value);return V(o),e.onFieldSelected&&typeof e.onFieldSelected=="function"&&e.onFieldSelected(o),!0}}],reiszeable:!0,draggable:!0};return()=>i.createVNode(U,{modelValue:F.value,"onUpdate:modelValue":t=>F.value=t,editable:!1,disabled:e.disabled,readonly:e.readonly,inputType:"text",enableClear:!1,buttonContent:c,buttonBehavior:"Modal",modalOptions:B},{default:()=>[i.createVNode("div",{class:"h-100 d-flex flex-column"},[M()])]})}});T.install=e=>{e.component(T.name,T),e.component(O.name,O)},T.register=(e,p,c,d)=>{e["binding-selector"]=T,p["binding-selector"]=L},l.BindingSelector=T,l.FBindingSelectorContainer=O,l.bindingSelectorProps=I,l.bindingTypes=E,l.default=T,l.fieldColumns=R,l.propsResolver=L,l.variableColumns=k,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});