cnhis-design-vue 3.1.42-release.2 → 3.1.42-release.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -87
- package/es/components/base-search/index.d.ts +2 -2
- package/es/components/base-search/src/index.vue.d.ts +2 -2
- package/es/components/bpmn-workflow/index.d.ts +12 -0
- package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
- package/es/components/bpmn-workflow/src/BpmnWorkflow.vue.d.ts +12 -0
- package/es/components/bpmn-workflow/src/BpmnWorkflow.vue.js +1 -1
- package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +1 -0
- package/es/components/bpmn-workflow/types/ModelingModule.d.ts +1 -0
- package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +1 -0
- package/es/components/button-print/src/ButtonPrint.vue2.js +1 -1
- package/es/components/date-picker/index.d.ts +4 -0
- package/es/components/date-picker/src/DatePicker.vue.d.ts +4 -0
- package/es/components/date-picker/src/DatePicker.vue.js +1 -1
- package/es/components/fabric-chart/src/hooks/useBirthProcess.d.ts +1 -0
- package/es/components/fabric-chart/src/hooks/useBirthProcess.js +1 -1
- package/es/components/fabric-chart/src/hooks/useBirthProcessChart.js +1 -1
- package/es/components/fabric-chart/src/hooks/useCenter.js +1 -1
- package/es/components/fabric-chart/src/hooks/useLeft.js +1 -1
- package/es/components/fabric-chart/src/hooks/useScaleColumn.d.ts +16 -0
- package/es/components/fabric-chart/src/hooks/useScaleColumn.js +1 -0
- package/es/components/fabric-chart/src/utils/index.d.ts +6823 -0
- package/es/components/form-config/index.d.ts +6 -1
- package/es/components/form-config/src/FormConfig.vue.d.ts +6 -1
- package/es/components/form-config/src/FormConfig.vue.js +1 -1
- package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +1 -0
- package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +3 -1
- package/es/components/form-config/src/components/FormConfigEdit.vue.js +1 -1
- package/es/components/form-config/src/components/renderer/DefaultNode.vue.js +1 -1
- package/es/components/form-config/src/constants/index.d.ts +12 -1
- package/es/components/form-config/src/constants/index.js +1 -1
- package/es/components/form-config/src/hooks/useConfigurationField.js +1 -1
- package/es/components/form-config/src/types/index.d.ts +1 -0
- package/es/components/form-render/index.d.ts +1 -0
- package/es/components/form-render/src/FormRender.vue.d.ts +1 -0
- package/es/components/form-render/src/FormRender.vue.js +1 -1
- package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +1 -0
- package/es/components/form-render/src/components/renderer/combination.js +1 -1
- package/es/components/form-render/src/components/renderer/jsonCombination/index.js +1 -1
- package/es/components/iho-table/index.d.ts +4 -1522
- package/es/components/iho-table/src/IhoTable.vue.d.ts +4 -1522
- package/es/components/iho-table/src/IhoTable.vue.js +1 -1
- package/es/components/iho-table/src/hooks/tapHooks/index.d.ts +4 -4
- package/es/components/iho-table/src/hooks/tapHooks/index.js +1 -1
- package/es/components/iho-table/src/hooks/tapHooks/useConfigHooks.d.ts +22 -21
- package/es/components/iho-table/src/hooks/tapHooks/useConfigHooks.js +1 -1
- package/es/components/iho-table/src/plugins/filterRenderPlugin/index.js +1 -1
- package/es/components/iho-table/src/plugins/highLightSetPlugin.d.ts +1 -0
- package/es/components/iho-table/src/plugins/highLightSetPlugin.js +1 -0
- package/es/components/iho-table/src/plugins/index.js +1 -1
- package/es/components/iho-table/src/plugins/lowCodeFieldAdaptorPlugin/index.js +1 -1
- package/es/components/iho-table/src/plugins/maxCheckSizePlugin.d.ts +1 -0
- package/es/components/iho-table/src/plugins/maxCheckSizePlugin.js +1 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/editDate.vue.d.ts +4 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/index.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/widgets/defaultRendererPlugin.js +1 -1
- package/es/components/iho-table/src/plugins/varialbleHeightPlugin/index.js +1 -1
- package/es/components/iho-table/src/types/index.d.ts +2 -1
- package/es/components/iho-table/src/types/pluginType.d.ts +6 -3
- package/es/components/iho-table/src/utils/index.d.ts +2 -0
- package/es/components/iho-table/src/utils/index.js +1 -1
- package/es/components/iho-table/style/index.css +1 -1
- package/es/components/index.css +1 -1
- package/es/components/info-header/index.d.ts +2 -0
- package/es/components/info-header/src/InfoHeader.vue.d.ts +2 -0
- package/es/components/info-header/src/components/infoDescription/HiddenContent.vue.js +1 -1
- package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +1 -0
- package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +1 -0
- package/es/components/scale-view/index.d.ts +25 -66
- package/es/components/scale-view/src/ScaleView.vue.d.ts +25 -66
- package/es/components/scale-view/src/ScaleView.vue.js +1 -1
- package/es/components/scale-view/style/index.css +1 -1
- package/es/components/select-label/src/LabelFormContent.vue.js +1 -1
- package/es/components/shortcut-setter/index.d.ts +1 -0
- package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +1 -0
- package/es/components/table-filter/src/types/index.d.ts +2 -2
- package/es/env.d.ts +24 -24
- package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +86 -0
- package/es/shared/hooks/useDateTime.d.ts +2 -2
- package/es/shared/hooks/useDateTime.js +1 -1
- package/es/shared/utils/tapable/index.d.ts +139 -0
- package/package.json +2 -2
- package/es/components/scale-view/src/hooks/scaleview-props.d.ts +0 -115
- package/es/components/scale-view/src/hooks/scaleview-props.js +0 -1
|
@@ -1733,6 +1733,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
1733
1733
|
}[] | undefined;
|
|
1734
1734
|
} | undefined;
|
|
1735
1735
|
__new?: boolean | undefined;
|
|
1736
|
+
__isCombinationChild?: boolean | undefined;
|
|
1736
1737
|
}[]>;
|
|
1737
1738
|
materialListRef: import("vue").Ref<{
|
|
1738
1739
|
key: string;
|
|
@@ -3426,6 +3427,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
3426
3427
|
}[] | undefined;
|
|
3427
3428
|
} | undefined;
|
|
3428
3429
|
__new?: boolean | undefined;
|
|
3430
|
+
__isCombinationChild?: boolean | undefined;
|
|
3429
3431
|
}[]>;
|
|
3430
3432
|
addItem: (formConfigItem: import("./src/types").FormConfigItem) => void;
|
|
3431
3433
|
parsedTextFormatter: import("./src/types").FormConfigTextFormatter;
|
|
@@ -3789,6 +3791,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
3789
3791
|
onAnnotationChange?: ((...args: any[]) => any) | undefined;
|
|
3790
3792
|
}>>;
|
|
3791
3793
|
emit: (event: "formChange" | "scroll" | "annotationChange", ...args: any[]) => void;
|
|
3794
|
+
cssVars: import("vue").ComputedRef<import("vue").CSSProperties>;
|
|
3792
3795
|
nuiThemeOverrides: import("naive-ui").GlobalThemeOverrides;
|
|
3793
3796
|
formRenderRef: import("vue").Ref<HTMLElement | undefined>;
|
|
3794
3797
|
formHeight: import("vue").ComputedRef<string>;
|
|
@@ -4371,7 +4374,6 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
4371
4374
|
};
|
|
4372
4375
|
}>> & {}>>;
|
|
4373
4376
|
wrapperSelector: import("vue").ComputedRef<string>;
|
|
4374
|
-
key: import("vue").Ref<number>;
|
|
4375
4377
|
formRenderRef: import("vue").Ref<import("..").FormRenderExpose | undefined>;
|
|
4376
4378
|
currentActiveField: import("vue").Ref<import("../../../es/shared/types").UndefinedAble<import("./src/types").FormConfigItem>>;
|
|
4377
4379
|
fieldList: import("vue").Ref<{
|
|
@@ -7756,6 +7758,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
7756
7758
|
}[] | undefined;
|
|
7757
7759
|
} | undefined;
|
|
7758
7760
|
__new?: boolean | undefined;
|
|
7761
|
+
__isCombinationChild?: boolean | undefined;
|
|
7759
7762
|
}[] | undefined;
|
|
7760
7763
|
originalSetting?: {
|
|
7761
7764
|
[x: string]: any;
|
|
@@ -9433,6 +9436,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
9433
9436
|
}[] | undefined;
|
|
9434
9437
|
} | undefined;
|
|
9435
9438
|
__new?: boolean | undefined;
|
|
9439
|
+
__isCombinationChild?: boolean | undefined;
|
|
9436
9440
|
}>;
|
|
9437
9441
|
generateFieldListByFormConfigItem: (formConfigItem: import("./src/types").FormConfigItem, fieldItem?: import("..").FieldItem | undefined) => import("..").FieldItem[];
|
|
9438
9442
|
showModal: import("vue").Ref<boolean>;
|
|
@@ -9707,6 +9711,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
9707
9711
|
onAnnotationChange?: ((...args: any[]) => any) | undefined;
|
|
9708
9712
|
}>>;
|
|
9709
9713
|
emit: (event: "formChange" | "scroll" | "annotationChange", ...args: any[]) => void;
|
|
9714
|
+
cssVars: import("vue").ComputedRef<import("vue").CSSProperties>;
|
|
9710
9715
|
nuiThemeOverrides: import("naive-ui").GlobalThemeOverrides;
|
|
9711
9716
|
formRenderRef: import("vue").Ref<HTMLElement | undefined>;
|
|
9712
9717
|
formHeight: import("vue").ComputedRef<string>;
|
|
@@ -1735,6 +1735,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1735
1735
|
}[] | undefined;
|
|
1736
1736
|
} | undefined;
|
|
1737
1737
|
__new?: boolean | undefined;
|
|
1738
|
+
__isCombinationChild?: boolean | undefined;
|
|
1738
1739
|
}[]>;
|
|
1739
1740
|
materialListRef: import("vue").Ref<{
|
|
1740
1741
|
key: string;
|
|
@@ -3428,6 +3429,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
3428
3429
|
}[] | undefined;
|
|
3429
3430
|
} | undefined;
|
|
3430
3431
|
__new?: boolean | undefined;
|
|
3432
|
+
__isCombinationChild?: boolean | undefined;
|
|
3431
3433
|
}[]>;
|
|
3432
3434
|
addItem: (formConfigItem: FormConfigItem) => void;
|
|
3433
3435
|
parsedTextFormatter: FormConfigTextFormatter;
|
|
@@ -3791,6 +3793,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
3791
3793
|
onAnnotationChange?: ((...args: any[]) => any) | undefined;
|
|
3792
3794
|
}>>;
|
|
3793
3795
|
emit: (event: "formChange" | "scroll" | "annotationChange", ...args: any[]) => void;
|
|
3796
|
+
cssVars: import("vue").ComputedRef<import("vue").CSSProperties>;
|
|
3794
3797
|
nuiThemeOverrides: import("naive-ui").GlobalThemeOverrides;
|
|
3795
3798
|
formRenderRef: import("vue").Ref<HTMLElement | undefined>;
|
|
3796
3799
|
formHeight: import("vue").ComputedRef<string>;
|
|
@@ -4373,7 +4376,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
4373
4376
|
};
|
|
4374
4377
|
}>> & {}>>;
|
|
4375
4378
|
wrapperSelector: import("vue").ComputedRef<string>;
|
|
4376
|
-
key: import("vue").Ref<number>;
|
|
4377
4379
|
formRenderRef: import("vue").Ref<FormRenderExpose | undefined>;
|
|
4378
4380
|
currentActiveField: import("vue").Ref<import("../../../../es/shared/types").UndefinedAble<FormConfigItem>>;
|
|
4379
4381
|
fieldList: import("vue").Ref<{
|
|
@@ -7758,6 +7760,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
7758
7760
|
}[] | undefined;
|
|
7759
7761
|
} | undefined;
|
|
7760
7762
|
__new?: boolean | undefined;
|
|
7763
|
+
__isCombinationChild?: boolean | undefined;
|
|
7761
7764
|
}[] | undefined;
|
|
7762
7765
|
originalSetting?: {
|
|
7763
7766
|
[x: string]: any;
|
|
@@ -9435,6 +9438,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
9435
9438
|
}[] | undefined;
|
|
9436
9439
|
} | undefined;
|
|
9437
9440
|
__new?: boolean | undefined;
|
|
9441
|
+
__isCombinationChild?: boolean | undefined;
|
|
9438
9442
|
}>;
|
|
9439
9443
|
generateFieldListByFormConfigItem: (formConfigItem: FormConfigItem, fieldItem?: import("../../../../es/components/form-render").FieldItem | undefined) => import("../../../../es/components/form-render").FieldItem[];
|
|
9440
9444
|
showModal: import("vue").Ref<boolean>;
|
|
@@ -9709,6 +9713,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
9709
9713
|
onAnnotationChange?: ((...args: any[]) => any) | undefined;
|
|
9710
9714
|
}>>;
|
|
9711
9715
|
emit: (event: "formChange" | "scroll" | "annotationChange", ...args: any[]) => void;
|
|
9716
|
+
cssVars: import("vue").ComputedRef<import("vue").CSSProperties>;
|
|
9712
9717
|
nuiThemeOverrides: import("naive-ui").GlobalThemeOverrides;
|
|
9713
9718
|
formRenderRef: import("vue").Ref<HTMLElement | undefined>;
|
|
9714
9719
|
formHeight: import("vue").ComputedRef<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,ref as o,provide as r,toRaw as t,openBlock as i,createElementBlock as a,normalizeStyle as
|
|
1
|
+
import{defineComponent as e,ref as o,provide as r,toRaw as t,openBlock as i,createElementBlock as a,normalizeStyle as n,unref as m,createElementVNode as s,createVNode as l,mergeProps as f,withCtx as u,createTextVNode as c}from"vue";import{useTheme as d}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import{cloneDeep as p,isArray as g,isFunction as v}from"lodash-es";import{uuidGenerator as h}from"../../../shared/utils/index.js";import _ from"../../../shared/components/VueDraggable/src/vuedraggable.js";import C from"./components/FormConfigCreator.vue.js";import j from"./components/FormConfigDragDisplay.vue.js";import x from"./components/FormConfigEdit.vue.js";import y from"./components/FormConfigMaterialItem.js";import{useDataNormalize as F}from"./hooks/useDataNormalize.js";import{InjectionFieldList as V,InjectionMaterialList as b,InjectionActiveFieldItem as k,FORM_CONFIG_GROUP as D}from"./constants/index.js";import"@vicons/ionicons5";import"naive-ui";import R from"../../../_virtual/plugin-vue_export-helper.js";import"./utils/index.js";import{useSortableConfig as E}from"./hooks/useSortalbeConfig.js";import"./hooks/useConfigurationField.js";const H=["id"],I={class:"form-config__material"},L=s("header",{class:"form-config__materialHeader"},"物料区",-1),N={class:"form-config__displayWrapper"},O={class:"form-config__displayHeader"},S={class:"form-config__config"},T=s("header",{class:"form-config__configHeader"},"配置区",-1),A={class:"form-config__configContent"};var B=R(e({__name:"FormConfig",props:{maxHeight:{type:String},fieldVisitor:{type:Object},textFormatter:{type:Function},formRenderRef:{type:Object}},setup(e,{expose:R}){const B=e,M=h(),U=d(),{getCommonConfig:w}=E(),z=o([]);r(V,z);const W=o([]);function q(e){z.value.some((o=>o.key===e.key))||z.value.push(e)}r(b,W);const G=(e,o)=>v(B.textFormatter)?B.textFormatter(e,o):o,J=o();r(k,J);const K=o(),{transform:P,inverseTransform:Q}=F(B);return R({loadData({fieldList:e}){let o=[],r=[];e.forEach((e=>function(e){"LINE_BAR"===e.type&&(e.children=[]);!1===e.show?r.push(e):o.push(e),"COMBINATION"===e.type&&g(e.children)&&e.children.length&&e.children.forEach((e=>{e.__isCombinationChild=!0}))}(p(t(e))))),z.value=P(o),W.value=r,J.value=void 0},validate(){var e;return null==(e=K.value)?void 0:e.validate()},getData:()=>({fieldList:Q(p(t(z.value))),materialList:Q(p(t(W.value)))})}),(o,r)=>(i(),a("section",{class:"form-config",style:n({"--max-height":e.maxHeight,...m(U)}),id:m(M)},[s("section",I,[L,l(m(_),f(m(w)(),{class:"form-config__materialContent",modelValue:W.value,"onUpdate:modelValue":r[0]||(r[0]=e=>W.value=e)}),{item:u((({element:e})=>[l(m(y),{"form-config-item":e,"text-formatter":G},null,8,["form-config-item"])])),_:1},16,["modelValue"])]),s("section",N,[s("header",O,[c(" 布局区 "),l(C,{onSubmit:q})]),l(j,{class:"form-config__displayContent",group:m(D),"text-formatter":G,modelValue:z.value,"onUpdate:modelValue":r[1]||(r[1]=e=>z.value=e)},null,8,["group","modelValue"])]),s("section",S,[T,s("section",A,[l(x,{ref_key:"formConfigEditRef",ref:K,uuid:m(M),"form-render-ref":e.formRenderRef},null,8,["uuid","form-render-ref"])])])],12,H))}}),[["__file","FormConfig.vue"]]);export{B as default};
|
|
@@ -282,6 +282,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
282
282
|
onAnnotationChange?: ((...args: any[]) => any) | undefined;
|
|
283
283
|
}>>;
|
|
284
284
|
emit: (event: "formChange" | "scroll" | "annotationChange", ...args: any[]) => void;
|
|
285
|
+
cssVars: import("vue").ComputedRef<import("vue").CSSProperties>;
|
|
285
286
|
nuiThemeOverrides: import("naive-ui").GlobalThemeOverrides;
|
|
286
287
|
formRenderRef: import("vue").Ref<HTMLElement | undefined>;
|
|
287
288
|
formHeight: import("vue").ComputedRef<string>;
|
|
@@ -20,7 +20,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
20
20
|
};
|
|
21
21
|
}>> & {}>>;
|
|
22
22
|
wrapperSelector: import("vue").ComputedRef<string>;
|
|
23
|
-
key: import("vue").Ref<number>;
|
|
24
23
|
formRenderRef: import("vue").Ref<FormRenderExpose | undefined>;
|
|
25
24
|
currentActiveField: import("vue").Ref<import("../../../../../es/shared/types").UndefinedAble<FormConfigItem>>;
|
|
26
25
|
fieldList: import("vue").Ref<{
|
|
@@ -3405,6 +3404,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
3405
3404
|
}[] | undefined;
|
|
3406
3405
|
} | undefined;
|
|
3407
3406
|
__new?: boolean | undefined;
|
|
3407
|
+
__isCombinationChild?: boolean | undefined;
|
|
3408
3408
|
}[] | undefined;
|
|
3409
3409
|
originalSetting?: {
|
|
3410
3410
|
[x: string]: any;
|
|
@@ -5082,6 +5082,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
5082
5082
|
}[] | undefined;
|
|
5083
5083
|
} | undefined;
|
|
5084
5084
|
__new?: boolean | undefined;
|
|
5085
|
+
__isCombinationChild?: boolean | undefined;
|
|
5085
5086
|
}>;
|
|
5086
5087
|
generateFieldListByFormConfigItem: (formConfigItem: FormConfigItem, fieldItem?: FieldItem | undefined) => FieldItem[];
|
|
5087
5088
|
showModal: import("vue").Ref<boolean>;
|
|
@@ -5356,6 +5357,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
5356
5357
|
onAnnotationChange?: ((...args: any[]) => any) | undefined;
|
|
5357
5358
|
}>>;
|
|
5358
5359
|
emit: (event: "formChange" | "scroll" | "annotationChange", ...args: any[]) => void;
|
|
5360
|
+
cssVars: import("vue").ComputedRef<import("vue").CSSProperties>;
|
|
5359
5361
|
nuiThemeOverrides: import("naive-ui").GlobalThemeOverrides;
|
|
5360
5362
|
formRenderRef: import("vue").Ref<HTMLElement | undefined>;
|
|
5361
5363
|
formHeight: import("vue").ComputedRef<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,computed as
|
|
1
|
+
import{defineComponent as e,computed as o,ref as i,inject as l,watch as t,toRaw as a,openBlock as r,createElementBlock as n,Fragment as u,createVNode as s,unref as m,nextTick as d}from"vue";import{cloneDeep as v}from"lodash-es";import{InjectionActiveFieldItem as f}from"../constants/index.js";import"../../../../shared/components/VueDraggable/src/vuedraggable.js";import{findFieldItemByKey as p}from"../utils/index.js";import c from"../../../../_virtual/plugin-vue_export-helper.js";import"@vicons/ionicons5";import{NModal as g}from"naive-ui";import"../../../../shared/utils/index.js";import{useConfigurationField as h}from"../hooks/useConfigurationField.js";import"../../../index.js";import j from"../../../form-render/index.js";var x=c(e({__name:"FormConfigEdit",props:{uuid:{type:String,required:!0},formRenderRef:{type:Object}},setup(e,{expose:c}){const x=e,y=o((()=>`#${x.uuid} .form-config__config`)),_=i(),F=l(f),b=i([]),w=i({}),{generateFieldListByFormConfigItem:C}=h(),R=i(!1);async function k(){var e;F.value=P,await d(),null==(e=_.value)||e.validate()}let P=null;function E({fieldKey:e,value:o}){F.value&&(F.value[e]=o)}return t(F,(async(e,o)=>{var i,l,t;if(!e)return b.value=[];if(o&&e!==P)try{await(null==(i=_.value)?void 0:i.validate())}catch(e){return R.value=!0}P=e,w.value={editable:!0,show:!0,...v(a(e))};const r=null==(l=x.formRenderRef)?void 0:l.getFieldList();b.value=C(e,p(r,e.key)).map((e=>({...e,componentProps:{...e.componentProps,to:y.value}}))),null==(t=_.value)||t.reload()}),{immediate:!0}),c({validate(){var e;return null==(e=_.value)?void 0:e.validate()}}),(e,o)=>(r(),n(u,null,[s(m(j),{column:12,ref_key:"formRenderRef",ref:_,size:"small",onFormChange:E,"field-list":b.value,"initial-data":w.value},null,8,["field-list","initial-data"]),s(m(g),{show:R.value,"onUpdate:show":o[0]||(o[0]=e=>R.value=e),preset:"dialog",to:m(y),"close-on-esc":!1,"mask-closable":!1,closable:!1,title:"存在填写错误的字段","positive-text":"继续编辑",onPositiveClick:k},null,8,["show","to"])],64))}}),[["__file","FormConfigEdit.vue"]]);export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,inject as o,computed as t,openBlock as r,createElementBlock as i,mergeProps as f,unref as m,withModifiers as n,createVNode as l,normalizeClass as a,withCtx as u,createTextVNode as s,toDisplayString as d,createBlock as p,createCommentVNode as
|
|
1
|
+
import{defineComponent as e,inject as o,computed as t,openBlock as r,createElementBlock as i,mergeProps as f,unref as m,withModifiers as n,createVNode as l,normalizeClass as a,withCtx as u,createTextVNode as s,toDisplayString as d,createBlock as p,createCommentVNode as C}from"vue";import{NEllipsis as c}from"naive-ui";import g from"./CloseButton.vue.js";import{InjectionActiveFieldItem as _,WidgetTextMap as v}from"../../constants/index.js";import{bindHover as I}from"../../utils/index.js";import y from"../../../../../_virtual/plugin-vue_export-helper.js";const x=["onClick","data-type"];var j=y(e({__name:"DefaultNode",props:{formConfigItem:{type:Object,required:!0},textFormatter:{type:Function,required:!0},showCloseButton:{type:Boolean,default:!0},allowClick:{type:Boolean,default:!0}},setup(e){const y=e,j=o(_);function k(){y.allowClick&&(j.value=y.formConfigItem)}const q=t((()=>["form-config__renderer--default",{"is-required":y.formConfigItem.required}])),B=t((()=>[{"is-active":j.value===y.formConfigItem,"is-disabled":b.value},"form-config__renderer","form-config__renderer--defaultWrapper"])),b=t((()=>!1===y.formConfigItem.editable)),h=t((()=>{const e=v.get(y.formConfigItem.type);return y.textFormatter(y.formConfigItem,`${y.formConfigItem.name}${e?`(${e})`:""}`)}));return(o,t)=>(r(),i("div",f(m(I)(e.formConfigItem),{onClick:n(k,["stop"]),class:m(B),"data-type":e.formConfigItem.type}),[l(m(c),{class:a(m(q))},{default:u((()=>[s(d(m(h)),1)])),_:1},8,["class"]),!e.showCloseButton||e.formConfigItem.required||e.formConfigItem.__isCombinationChild?C("v-if",!0):(r(),p(g,{key:0,"form-config-item":e.formConfigItem},null,8,["form-config-item"]))],16,x))}}),[["__file","DefaultNode.vue"]]);export{j as default};
|
|
@@ -11,7 +11,8 @@ export declare enum EditAbleField {
|
|
|
11
11
|
DEFAULT_EXPAND = "defaultExpand",
|
|
12
12
|
FOLD = "fold",
|
|
13
13
|
REQUIRED = "required",
|
|
14
|
-
EDITABLE = "editable"
|
|
14
|
+
EDITABLE = "editable",
|
|
15
|
+
SHOW = "show"
|
|
15
16
|
}
|
|
16
17
|
export declare function widgetWidthOptionConfig(): {
|
|
17
18
|
option: {
|
|
@@ -59,6 +60,16 @@ export declare function isNullOptionConfig(): {
|
|
|
59
60
|
value: boolean;
|
|
60
61
|
};
|
|
61
62
|
};
|
|
63
|
+
export declare function isVisibleOptionConfig(): {
|
|
64
|
+
open: {
|
|
65
|
+
describe: string;
|
|
66
|
+
value: boolean;
|
|
67
|
+
};
|
|
68
|
+
close: {
|
|
69
|
+
describe: string;
|
|
70
|
+
value: boolean;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
62
73
|
export declare const FORM_CONFIG_GROUP = "__display";
|
|
63
74
|
export declare const InjectionFieldList: InjectionKey<Ref<FormConfigItem[]>>;
|
|
64
75
|
export declare const InjectionMaterialList: InjectionKey<Ref<FormConfigItem[]>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=new Map([["LINE_BAR","分线栏"],["NEWLINE","分行符"]]);var t=(e=>(e.NAME="name",e.NOTES="notes",e.DEFAULT_VALUE="defaultValue",e.LAYOUT_WIDTH_ENUM="layoutWidthEnum",e.DESC="desc",e.DEFAULT_EXPAND="defaultExpand",e.FOLD="fold",e.REQUIRED="required",e.EDITABLE="editable",e))(t||{});function l(){return{option:[{text:"整行",value:"ALL_LINE"},{text:"半行",value:"HALF_LINE"},{text:"5/6",value:"FIVE_SIX"},{text:"2/3",value:"TWO_THREE"},{text:"1/3",value:"ONE_THREE"},{text:"3/4",value:"THREE_FOUR"},{text:"1/4",value:"ONE_FOUR"},{text:"1/6",value:"ONE_SIX"},{text:"1/8",value:"ONE_EIGHT"}]}}function n(){return{open:{describe:"默认展开",value:!0},close:{describe:"默认收起",value:!1}}}function u(){return{open:{describe:"可折叠",value:!0},close:{describe:"不可折叠",value:!1}}}function
|
|
1
|
+
const e=new Map([["LINE_BAR","分线栏"],["NEWLINE","分行符"]]);var t=(e=>(e.NAME="name",e.NOTES="notes",e.DEFAULT_VALUE="defaultValue",e.LAYOUT_WIDTH_ENUM="layoutWidthEnum",e.DESC="desc",e.DEFAULT_EXPAND="defaultExpand",e.FOLD="fold",e.REQUIRED="required",e.EDITABLE="editable",e.SHOW="show",e))(t||{});function l(){return{option:[{text:"整行",value:"ALL_LINE"},{text:"半行",value:"HALF_LINE"},{text:"5/6",value:"FIVE_SIX"},{text:"2/3",value:"TWO_THREE"},{text:"1/3",value:"ONE_THREE"},{text:"3/4",value:"THREE_FOUR"},{text:"1/4",value:"ONE_FOUR"},{text:"1/6",value:"ONE_SIX"},{text:"1/8",value:"ONE_EIGHT"}]}}function n(){return{open:{describe:"默认展开",value:!0},close:{describe:"默认收起",value:!1}}}function u(){return{open:{describe:"可折叠",value:!0},close:{describe:"不可折叠",value:!1}}}function a(){return{open:{describe:"可编辑",value:!0},close:{describe:"不可编辑",value:!1}}}function o(){return{open:{describe:"必填",value:!0},close:{describe:"不必填",value:!1}}}function E(){return{open:{describe:"显示",value:!0},close:{describe:"隐藏",value:!1}}}const i="__display",c=Symbol("InjectionFieldList"),r=Symbol("InjectionMaterialList"),s=Symbol("InjectionActiveFieldItem");export{t as EditAbleField,i as FORM_CONFIG_GROUP,s as InjectionActiveFieldItem,c as InjectionFieldList,r as InjectionMaterialList,e as WidgetTextMap,a as isEditOptionConfig,u as isNotFoldOptionConfig,o as isNullOptionConfig,n as isShowOptionConfig,E as isVisibleOptionConfig,l as widgetWidthOptionConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{omit as e,pick as t}from"lodash-es";import{EditAbleField as l,widgetWidthOptionConfig as i,isShowOptionConfig as a,isNotFoldOptionConfig as o,isEditOptionConfig as
|
|
1
|
+
import{omit as e,pick as t}from"lodash-es";import{EditAbleField as l,widgetWidthOptionConfig as i,isShowOptionConfig as a,isNotFoldOptionConfig as o,isEditOptionConfig as _,isNullOptionConfig as s,isVisibleOptionConfig as n}from"../constants/index.js";import"../../../form-render/index.js";import{useFieldNormalize as m}from"../../../form-render/src/hooks/useFieldNormalize.js";const{FieldNormalizeWaterfallHook:r}=m();function d(){const m=new Map([[l.NAME,()=>({alias:"名称",elem_width:6,is_null:"0",html_type:"INPUT"})],[l.NOTES,()=>({alias:"问号提示",elem_width:6,html_type:"INPUT",is_empty:"0"})],[l.DEFAULT_VALUE,(l,i)=>{const a=r.call(Object.assign({},null==l?void 0:l.originalSetting,i));return{alias:"默认值",elem_width:6,html_type:"INPUT",is_empty:"0",componentProps:e(a.componentProps,["class","style","disabled"]),...t(a,["html_type","validate","option","multi_select","multi_select_value","wordbook","open","close","date_format","step_length","urlConfig","autograph","defined_error_msg","free_entry","validator"])}}],[l.LAYOUT_WIDTH_ENUM,()=>({alias:"宽度",fieldType:"number",html_type:"SELECT",elem_width:6,...i()})],[l.DESC,()=>({alias:"说明文本",elem_width:6,html_type:"INPUT",is_empty:"0",validate:{max_length:30}})],[l.DEFAULT_EXPAND,()=>({alias:"是否默认展开",html_type:"SWITCH",elem_width:6,...a()})],[l.FOLD,()=>({alias:"是否可折叠",html_type:"SWITCH",elem_width:6,...o()})],[l.EDITABLE,e=>({alias:"是否可编辑",html_type:"SWITCH",elem_width:6,is_edit:(null==e?void 0:e.editableDisabled)?"0":"1",..._()})],[l.REQUIRED,e=>({alias:"是否必填",html_type:"SWITCH",elem_width:6,is_edit:(null==e?void 0:e.requiredDisabled)?"0":"1",...s()})],[l.SHOW,e=>({alias:"是否显示",html_type:"SWITCH",elem_width:6,is_show:(null==e?void 0:e.__isCombinationChild)?"1":"0",...n()})]]);function d(e,t,l){return e.map((e=>{var i,a;return{...null!=(a=null==(i=m.get(e))?void 0:i(t,l))?a:{},val_key:e}}))}const E=new Map([["LINE_BAR",[l.NAME,l.LAYOUT_WIDTH_ENUM,l.NOTES,l.DEFAULT_EXPAND,l.FOLD]],...["NEWLINE","COMPLEX","COMBINATION"].map((e=>[e,[l.NAME,l.LAYOUT_WIDTH_ENUM]]))]),p=[l.NAME,l.DEFAULT_VALUE,l.LAYOUT_WIDTH_ENUM,l.DESC,l.NOTES,l.EDITABLE,l.REQUIRED,l.SHOW];return{generateFieldListByKeys:d,generateFieldListByFormConfigItem:function(e,t){return d(E.get(e.type)||p,e,t)}}}export{d as useConfigurationField};
|
|
@@ -29,6 +29,7 @@ export declare type FormConfigItem = {
|
|
|
29
29
|
children: FormConfigItem[];
|
|
30
30
|
originalSetting: FieldItem;
|
|
31
31
|
__new: boolean;
|
|
32
|
+
__isCombinationChild: boolean;
|
|
32
33
|
}>;
|
|
33
34
|
export interface FormConfigTextFormatter {
|
|
34
35
|
(formConfigItem: FormConfigItem, parsedText: string): string;
|
|
@@ -269,6 +269,7 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{}, {
|
|
|
269
269
|
onAnnotationChange?: ((...args: any[]) => any) | undefined;
|
|
270
270
|
}>>;
|
|
271
271
|
emit: (event: "formChange" | "scroll" | "annotationChange", ...args: any[]) => void;
|
|
272
|
+
cssVars: import("vue").ComputedRef<import("vue").CSSProperties>;
|
|
272
273
|
nuiThemeOverrides: import("naive-ui").GlobalThemeOverrides;
|
|
273
274
|
formRenderRef: import("vue").Ref<HTMLElement | undefined>;
|
|
274
275
|
formHeight: import("vue").ComputedRef<string>;
|
|
@@ -263,6 +263,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
263
263
|
onAnnotationChange?: ((...args: any[]) => any) | undefined;
|
|
264
264
|
}>>;
|
|
265
265
|
emit: (event: "formChange" | "scroll" | "annotationChange", ...args: any[]) => void;
|
|
266
|
+
cssVars: import("vue").ComputedRef<import("vue").CSSProperties>;
|
|
266
267
|
nuiThemeOverrides: import("naive-ui").GlobalThemeOverrides;
|
|
267
268
|
formRenderRef: import("vue").Ref<HTMLElement | undefined>;
|
|
268
269
|
formHeight: import("vue").ComputedRef<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,ref as o,computed as t,provide as r,onMounted as s,onUnmounted as a,openBlock as i,createBlock as l,unref as n,
|
|
1
|
+
import{defineComponent as e,ref as o,computed as t,provide as r,onMounted as s,onUnmounted as a,openBlock as i,createBlock as l,unref as n,normalizeStyle as m,withCtx as p,createElementBlock as u,createVNode as d,isRef as c,Fragment as f,renderList as h,createCommentVNode as y,createElementVNode as j,withKeys as g,withModifiers as v,toDisplayString as b,renderSlot as k}from"vue";import{useTheme as F}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import{isNumber as x,cloneDeep as C}from"lodash-es";import{createForm as H,onFieldValueChange as S,onFieldMount as A,onFieldUnmount as R,onFieldReact as L,onFormMount as _}from"@formily/core";import{FormProvider as O,FormConsumer as w}from"@formily/vue";import{NForm as B,NTabs as V,NTabPane as I,NConfigProvider as N}from"naive-ui";import{InjectionFormGraph as D}from"./constants/index.js";import{useAutoHidden as q}from"./hooks/useAutoHidden.js";import{useComplexOptionsSpan as U}from"./hooks/useComplexOptions.js";import{useFormDomEvent as W,useFormExposeEvent as G}from"./hooks/useFormEvent.js";import{useFormGraph as T}from"./hooks/useFormGraph.js";import{useFormRenderLifeCycle as K}from"./hooks/useFormRenderLifeCycle.js";import{useLowCodeReactions as M}from"./hooks/useLowCodeReactions.js";import{useNuiThemeOverrides as E}from"./hooks/useNuiThemeOverrides.js";import"./utils/index.js";import{useFieldListAdaptor as P}from"./hooks/useFieldListAdaptor.js";import"../../../shared/utils/index.js";import"../index.js";import{useFieldVisitor as J}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 $}from"./hooks/useFormValidator.js";import"date-fns";import{useAnchor as z}from"./hooks/useAnchor.js";import{useFormContext as Q}from"./hooks/useFormContext.js";import"./hooks/useFormRenderOptions.js";import X from"../../../_virtual/plugin-vue_export-helper.js";import{createObjSchema as Y}from"./utils/schema.js";const Z={key:0,style:{height:"54px"}},ee={style:{"white-space":"pre"}};var oe=X(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},linebarAutoHidden:{type:Boolean}},emits:["formChange","annotationChange","scroll"],setup(e,{expose:X,emit:oe}){const te=e,re=F(),{nuiThemeOverrides:se}=E();$();const ae=o(),ie=t((()=>x(te.maxHeight)?te.maxHeight+"px":te.maxHeight)),{SchemaField:le,businessCollector:ne,formItemDepsCollector:me,changeContextCollector:pe,formUUID:ue}=Q(te,oe),{anchorBarRef:de,currentAnchor:ce,generateAnchorList:fe,updateAnchorList:he,anchorIdList:ye,onScroll:je}=z(te,oe,ae,me);K(te).callLifeCycle("onSetup");const{trigger:ge}=q(),{observeFormGraph:ve,setGraph:be,removeGraph:ke}=T();r(D,ve);const Fe=H({initialValues:te.initialData,effects(e){S("*",(o=>{const t=o.props.name.toString();ne.trigger(e,t),me.trigger(t),oe("formChange",{fieldInstance:o,fieldKey:t,fieldName:o.title,value:o.value,context:pe.getContext(t,o.value)}),xe(t,o.value)})),A("*",be),R("*",ke),te.linebarAutoHidden&&(L("*",ge),_((e=>e.query("*").forEach(ge)))),te.anchor&&(L("*",he),_(fe))}}),{lowCodeReactionsHandler:xe,triggerAllReactionsHandler:Ce}=M(t((()=>te.lowCodeReactions)),Fe);s(Ce);const{schemaAdaptor:He}=P(ne);let Se=te.fieldList||[];const Ae=t((()=>te.schema?te.schema:te.fieldList?(Se=J().traverse(C(te.fieldList),te.fieldVisitor),Y(He(Se))):Y({}))),{onKeydown:Re}=W({formModel:Fe,formRenderRef:ae,props:te}),{clearSpan:Le}=U();a((()=>Le(ue)));const _e=G({formModel:Fe,formRenderRef:ae,formItemDepsCollector:me,getFieldList:()=>Se,formUUID:ue});return X({formModel:Fe,validate:(e="*")=>_e.validate(e),getFormValues:(e=!0)=>_e.getFormValues(e),setFormValues:(e,o=!0)=>_e.setFormValues(e,o),setFieldState(e,o){_e.setFieldState(e,o)},resetFields(e="*"){_e.resetFields(e)},queryWidget:async e=>_e.queryWidget(e),getFieldList:()=>Se,async reload(){console.error("reload function is abstract,it should be overwrite!")}}),(o,t)=>(i(),l(n(B),{class:"form-render","require-mark-placement":"left",style:m(n(re))},{default:p((()=>[e.anchor?(i(),u("section",Z,[d(n(V),{value:n(ce),"onUpdate:value":t[0]||(t[0]=e=>c(ce)?ce.value=e:null),type:"line",ref_key:"anchorBarRef",ref:de},{default:p((()=>[(i(!0),u(f,null,h(n(ye),(e=>(i(),l(n(I),{name:e.name,tab:e.title,key:e.name},null,8,["name","tab"])))),128))])),_:1},8,["value"])])):y("v-if",!0),d(n(N),{"theme-overrides":n(se)},{default:p((()=>[j("section",{class:"form-render__wrapper",style:m({"--column":e.column,"--form-height":n(ie)}),ref_key:"formRenderRef",ref:ae,onScroll:t[1]||(t[1]=(...e)=>n(je)&&n(je)(...e)),onKeydownCapture:t[2]||(t[2]=g(v(((...e)=>n(Re)&&n(Re)(...e)),["prevent"]),["enter"]))},[d(n(O),{form:n(Fe)},{default:p((()=>[d(n(le),{schema:n(Ae)},null,8,["schema"]),e.consumer?(i(),l(n(w),{key:0},{default:p((({form:e})=>[j("div",ee,b(JSON.stringify(e.values,null,2)),1)])),_:1})):y("v-if",!0),k(o.$slots,"default")])),_:3},8,["form"])],36)])),_:3},8,["theme-overrides"])])),_:3},8,["style"]))}}),[["__file","FormRender.vue"]]);export{oe as default};
|
|
@@ -267,6 +267,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
267
267
|
onAnnotationChange?: ((...args: any[]) => any) | undefined;
|
|
268
268
|
}>>;
|
|
269
269
|
emit: (event: "formChange" | "scroll" | "annotationChange", ...args: any[]) => void;
|
|
270
|
+
cssVars: import("vue").ComputedRef<import("vue").CSSProperties>;
|
|
270
271
|
nuiThemeOverrides: import("naive-ui").GlobalThemeOverrides;
|
|
271
272
|
formRenderRef: import("vue").Ref<HTMLElement | undefined>;
|
|
272
273
|
formHeight: import("vue").ComputedRef<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,ref as o,computed as t,watch as r,inject as i,createVNode as n}from"vue";import{isObjectField as a}from"@formily/core";import{RecursionField as m,connect as
|
|
1
|
+
import{defineComponent as e,ref as o,computed as t,watch as r,inject as i,createVNode as n}from"vue";import{isObjectField as a}from"@formily/core";import{RecursionField as m,connect as l}from"@formily/vue";import{AddCircleOutline as s,RemoveCircle as u}from"@vicons/ionicons5";import{isNumber as c,isArray as p,range as d}from"lodash-es";import{NButton as f,NIcon as v}from"naive-ui";import"../../../index.js";import{InjectionBusinessCollector as y}from"../../constants/index.js";import"../../utils/index.js";import{useFormField as x}from"../../hooks/useFormField.js";import{useFieldListAdaptor as h}from"../../hooks/useFieldListAdaptor.js";import{createObjSchema as b}from"../../utils/schema.js";const _=l(e({name:"FormCombination",props:{title:{type:String,default:""},value:{type:Array},maxGroupNum:{type:Number},disabled:{type:Boolean},getProperties:{type:Function,default:()=>[]},onInput:{},onBlur:{},onChange:{}},emits:["update:value"],setup(e){const{field:l,fieldKey:_}=x(),j=o(1),C=t((()=>c(e.maxGroupNum)?e.maxGroupNum<1?0:~~e.maxGroupNum:1/0));function g(){j.value++}r((()=>e.value),(e=>{p(e)&&(j.value=Math.min(Math.max(e.length,1),C.value))}),{immediate:!0});const k=i(y),{schemaAdaptor:F}=h(k);return()=>n("section",{class:"form-render__combination"},[n("header",{class:"form-render__combinationHeader"},[n("div",{class:"form-render__combinationHeaderText"},[e.title]),n(f,{onClick:g,text:!0,style:{"--n-text-color":"var(--c-primary-color)"},disabled:j.value>=C.value||e.disabled},{icon:()=>n(v,{component:s},null),default:()=>"新增"})]),d(j.value).map(((o,t)=>n("section",{class:"form-render__combinationContent"},[n(m,{schema:b(F(e.getProperties())),name:t},null),n(f,{text:!0,type:"error",class:"form-render__combinationClose",onClick:()=>async function(e){if(j.value>1)j.value--,await l.value.remove(e);else{const o=l.value.query(`${_.value}.${e}`).take();if(!o||!a(o))return;await o.reset()}}(t)},{icon:()=>n(v,{component:u},null)})])))])}}));export{_ as COMBINATION};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,ref as o,computed as t,watch as
|
|
1
|
+
import{defineComponent as e,ref as o,computed as t,watch as r,onMounted as n,createVNode as i}from"vue";import{isField as l}from"@formily/core";import{Path as a}from"@formily/path";import{AddCircleOutline as u,RemoveCircle as s}from"@vicons/ionicons5";import{isNumber as m,range as c,isArray as p,isEqual as f}from"lodash-es";import{useDeepValidate as v}from"./hooks/useDeepValidate.js";import{formRenderLog as d,mergeDeepProperties as h}from"../../../utils/index.js";import{connect as y,mapProps as g}from"@formily/vue";import{useDebounceFn as b,isObject as x}from"@vueuse/core";import{NButton as N,NIcon as _}from"naive-ui";import C from"../../../FormRender.vue.js";import{assignUpdateValue as j}from"../../../utils/schema.js";const F=y(e({name:"FormJsonCombination",props:{title:{type:String,default:""},value:{type:[String,Array]},maxGroupNum:{type:Number},getProperties:{type:Function,default:()=>[]},onInput:{},onBlur:{},onChange:{}},emits:["update:value"],setup(e,{emit:y}){d("当前COMBINATION控件为json模式,推荐使用非json模式,FieldItem.jsonCombination=false");const g=b((function(){y("update:value",JSON.stringify(j.value))}),300),j=o([]),F=t((()=>j.value.length));function I(o,t=!1){p(o)&&(o.length||o.push({}),o=JSON.stringify(o));const r=function(e){try{if(!e)return null;const o=JSON.parse(e);return Array.isArray(o)?o:null}catch(e){return null}}(o);var n;(n=r)&&!f(n,j.value)&&(r.splice(A.value),r.forEach((function(o,r){if(!x(o))return;j.value[r]=o,t&&h(o,e.getProperties())})),j.value.splice(r.length),j.value.forEach(J))}r((()=>e.value),(e=>I(e))),n((()=>{I(e.value||"[{}]",!0),g()}));const S=o([]);function J(e,o){var t;null==(t=S.value[o])||t.setFieldState("*",(o=>{l(o)&&(o.value=a.getIn(e,o.path))}))}function O(){j.value.push(h({},e.getProperties())),g()}v().bindDeepValidate(S);const A=t((()=>m(e.maxGroupNum)?e.maxGroupNum<1?0:~~e.maxGroupNum:1/0));r(A,(e=>{F.value<=e||(j.value.splice(e),g(),S.value.splice(e))}),{immediate:!0});const G=C;return()=>i("section",{class:"form-render__combination"},[i("header",{class:"form-render__combinationHeader"},[i("div",{class:"form-render__combinationHeaderText"},[e.title]),i(N,{onClick:O,style:{"--n-text-color":"var(--c-primary-color)"},text:!0,disabled:F.value>=A.value},{icon:()=>i(_,{component:u},null),default:()=>"新增"})]),c(F.value).map(((o,t)=>i("section",{class:"form-render__combinationContentJson"},[i(G,{ref:e=>function(e,o){S.value[e]=o,J(j.value[e]||{},e)}(t,e),fieldList:e.getProperties(),onFormChange:e=>function(e,{fieldKey:o,value:t}){!j.value[e]&&(j.value[e]={}),a.setIn(j.value[e],o,t),g()}(t,e)},null),i(N,{text:!0,class:"form-render__combinationClose",type:"error",onClick:()=>function(e){j.value.length>1?(j.value.splice(e,1),S.value.splice(e,1)):j.value.splice(e,1,{}),g()}(t)},{icon:()=>i(_,{component:s},null)})])))])}}),g(j));export{F as JSON_COMBINATION};
|