@kp-ui/lowcode 1.0.31 → 1.0.33
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/_virtual/virtual_svg-icons-register.js +2 -2
- package/package.json +27 -26
- package/render.js +13 -14
- package/src/components/CustomRender/components/AttachmentRender.vue.js +1 -1
- package/src/components/CustomRender/components/AttachmentRender.vue2.js +25 -12
- package/src/components/form-designer/form-widget/container-widget/data-table-widget.vue.js +103 -233
- package/src/components/form-designer/form-widget/container-widget/data-table-widget.vue2.js +236 -0
- package/src/components/form-designer/form-widget/container-widget/{grid-widget.vue2.js → grid-widget.vue.js} +1 -1
- package/src/components/form-designer/form-widget/container-widget/index.js +4 -4
- package/src/components/form-designer/form-widget/container-widget/{table-widget.vue2.js → table-widget.vue.js} +1 -1
- package/src/components/form-designer/form-widget/container-widget/vf-box-item.vue.js +4 -3
- package/src/components/form-designer/form-widget/container-widget/vf-box-widget.vue.js +4 -3
- package/src/components/form-designer/form-widget/container-widget/vf-collapse-widget.vue.js +156 -124
- package/src/components/form-designer/form-widget/container-widget/vf-collapse-widget.vue2.js +128 -0
- package/src/components/form-designer/form-widget/field-widget/diy-compontent-widget.vue.js +5 -3
- package/src/components/form-designer/form-widget/field-widget/fieldMixin.js +87 -122
- package/src/components/form-designer/form-widget/field-widget/file-upload-widget.vue.js +1 -1
- package/src/components/form-designer/form-widget/field-widget/file-upload-widget.vue2.js +25 -19
- package/src/components/form-designer/form-widget/index.vue.js +4 -4
- package/src/components/form-designer/toolbar-panel/index.vue.js +6 -7
- package/src/components/form-designer/widget-panel/advanced/attachment-render.js +1 -1
- package/src/components/form-designer/widget-panel/advanced/bpmn-editor.js +1 -1
- package/src/components/form-designer/widget-panel/advanced/cascader.js +1 -1
- package/src/components/form-designer/widget-panel/advanced/code-editor.js +1 -1
- package/src/components/form-designer/widget-panel/advanced/diy-compontent.js +2 -1
- package/src/components/form-designer/widget-panel/advanced/slot.js +1 -1
- package/src/components/form-designer/widget-panel/advanced/tree-select.js +1 -1
- package/src/components/form-designer/widget-panel/basicFields/button.js +1 -1
- package/src/components/form-designer/widget-panel/basicFields/checkbox.js +1 -1
- package/src/components/form-designer/widget-panel/basicFields/color.js +1 -1
- package/src/components/form-designer/widget-panel/basicFields/date.js +1 -1
- package/src/components/form-designer/widget-panel/basicFields/dateRange.js +1 -1
- package/src/components/form-designer/widget-panel/basicFields/divider.js +1 -1
- package/src/components/form-designer/widget-panel/basicFields/dropdown.js +1 -1
- package/src/components/form-designer/widget-panel/basicFields/htmlText.js +1 -1
- package/src/components/form-designer/widget-panel/basicFields/input.js +1 -1
- package/src/components/form-designer/widget-panel/basicFields/number.js +1 -1
- package/src/components/form-designer/widget-panel/basicFields/radio.js +1 -1
- package/src/components/form-designer/widget-panel/basicFields/rate.js +1 -1
- package/src/components/form-designer/widget-panel/basicFields/select.js +1 -1
- package/src/components/form-designer/widget-panel/basicFields/slider.js +1 -1
- package/src/components/form-designer/widget-panel/basicFields/staticText.js +1 -1
- package/src/components/form-designer/widget-panel/basicFields/switch.js +1 -1
- package/src/components/form-designer/widget-panel/basicFields/textarea.js +1 -1
- package/src/components/form-designer/widget-panel/basicFields/time.js +1 -1
- package/src/components/form-designer/widget-panel/basicFields/timeRange.js +1 -1
- package/src/components/form-designer/widget-panel/business/department-select.js +1 -1
- package/src/components/form-designer/widget-panel/business/material-select.js +1 -1
- package/src/components/form-designer/widget-panel/business/operation-select.js +1 -1
- package/src/components/form-designer/widget-panel/business/post-select.js +1 -1
- package/src/components/form-designer/widget-panel/business/project-group-select.js +1 -1
- package/src/components/form-designer/widget-panel/business/project-select.js +1 -1
- package/src/components/form-designer/widget-panel/business/user-select.js +1 -1
- package/src/components/form-designer/widget-panel/containers/data-table.js +1 -1
- package/src/components/form-designer/widget-panel/containers/grid-col.js +1 -1
- package/src/components/form-designer/widget-panel/containers/grid-sub-form.js +1 -1
- package/src/components/form-designer/widget-panel/containers/grid.js +1 -1
- package/src/components/form-designer/widget-panel/containers/tab-pane.js +1 -1
- package/src/components/form-designer/widget-panel/containers/tab.js +1 -1
- package/src/components/form-designer/widget-panel/containers/vf-box.js +1 -1
- package/src/components/form-designer/widget-panel/containers/vf-collapse.js +1 -1
- package/src/components/form-designer/widget-panel/containers/vf-dialog.js +1 -1
- package/src/components/form-render/container-item/vf-collapse-item.vue.js +4 -3
- package/src/components/form-render/dynamic-dialog.vue.js +236 -241
- package/src/components/form-render/dynamic-drawer.vue.js +206 -2
- package/src/components/http-editor/index.vue.js +1 -1
- package/src/components/http-editor/index.vue2.js +1 -1
- package/src/hooks/useFilePreview.js +1 -1
- package/src/utils/i18n.js +1 -14
- package/src/utils/request/fmtHttpParams.js +1 -1
- package/src/utils/request/http.js +1 -1
- package/src/utils/sfc-generator.js +1 -0
- package/src/utils/util.js +1 -21
- package/styles/style.css +1 -1
- package/types/src/components/CustomRender/components/AttachmentRender.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/advanced/attachment-render.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/advanced/bpmn-editor.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/advanced/cascader.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/advanced/code-editor.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/advanced/diy-compontent.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/advanced/file-upload.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/advanced/rich-editor.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/advanced/slot.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/advanced/tree-select.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/basicFields/button.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/basicFields/checkbox.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/basicFields/color.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/basicFields/date.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/basicFields/dateRange.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/basicFields/divider.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/basicFields/dropdown.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/basicFields/htmlText.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/basicFields/input.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/basicFields/number.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/basicFields/radio.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/basicFields/rate.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/basicFields/select.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/basicFields/slider.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/basicFields/staticText.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/basicFields/switch.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/basicFields/textarea.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/basicFields/time.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/basicFields/timeRange.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/business/department-select.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/business/material-select.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/business/operation-select.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/business/post-select.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/business/project-group-select.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/business/project-select.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/business/user-select.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/containers/data-table.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/containers/grid-col.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/containers/grid-sub-form.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/containers/grid.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/containers/tab.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/containers/vf-box.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/containers/vf-collapse.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/containers/vf-dialog.d.ts.map +1 -1
- package/types/src/components/form-render/index.d.ts +2 -2
- package/types/src/components/form-render/index.d.ts.map +1 -1
- package/src/components/form-designer/form-widget/container-widget/data-table-widget.vue3.js +0 -106
- package/src/components/form-designer/form-widget/container-widget/vf-collapse-widget.vue4.js +0 -158
- package/src/components/form-render/dynamic-dialog.vue3.js +0 -5
- package/src/components/form-render/dynamic-drawer.vue2.js +0 -247
- package/src/utils/request/useGetUseInfo.js +0 -9
- package/types/src/utils/request/useGetUseInfo.d.ts +0 -23
- package/types/src/utils/request/useGetUseInfo.d.ts.map +0 -1
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { defineAsyncComponent } from "vue";
|
|
2
|
+
import ContainerWrapper from "./container-wrapper.vue.js";
|
|
3
|
+
import emitter from "../../../../utils/emitter.js";
|
|
4
|
+
import i18n from "../../../../utils/i18n.js";
|
|
5
|
+
import comps from "../field-widget/index.js";
|
|
6
|
+
import containerMixin from "./containerMixin.js";
|
|
7
|
+
import refMixinDesign from "../../refMixinDesign.js";
|
|
8
|
+
import TpfCollapseTitle from "../../../TpfCollapse/TpfCollapseTitle.vue.js";
|
|
9
|
+
import SvgIcon from "../../../svg-icon/index.vue.js";
|
|
10
|
+
import gridWidget from "./grid-widget.vue.js";
|
|
11
|
+
import draggableComponent from "../../../../lib/vuedraggable/src/vuedraggable.js";
|
|
12
|
+
const _sfc_main = {
|
|
13
|
+
name: "VfCollapseWidget",
|
|
14
|
+
mixins: [i18n, containerMixin, refMixinDesign, emitter],
|
|
15
|
+
inject: ["refList"],
|
|
16
|
+
components: {
|
|
17
|
+
Draggable: draggableComponent,
|
|
18
|
+
ContainerWrapper,
|
|
19
|
+
TpfCollapseTitle,
|
|
20
|
+
SvgIcon,
|
|
21
|
+
gridWidget,
|
|
22
|
+
VFormRender: defineAsyncComponent(() => import("../../../../../render.js")),
|
|
23
|
+
...comps
|
|
24
|
+
},
|
|
25
|
+
data() {
|
|
26
|
+
return {};
|
|
27
|
+
},
|
|
28
|
+
props: {
|
|
29
|
+
widget: Object,
|
|
30
|
+
parentWidget: Object,
|
|
31
|
+
parentList: Array,
|
|
32
|
+
indexOfParentList: Number,
|
|
33
|
+
designer: Object,
|
|
34
|
+
subFormRowIndex: {
|
|
35
|
+
/* 子表单组件行索引,从0开始计数 */
|
|
36
|
+
type: Number,
|
|
37
|
+
default: -1
|
|
38
|
+
},
|
|
39
|
+
subFormColIndex: {
|
|
40
|
+
/* 子表单组件列索引,从0开始计数 */
|
|
41
|
+
type: Number,
|
|
42
|
+
default: -1
|
|
43
|
+
},
|
|
44
|
+
subFormRowId: {
|
|
45
|
+
/* 子表单组件行Id,唯一id且不可变 */
|
|
46
|
+
type: String,
|
|
47
|
+
default: ""
|
|
48
|
+
},
|
|
49
|
+
options: {
|
|
50
|
+
type: Object,
|
|
51
|
+
default: () => ({})
|
|
52
|
+
},
|
|
53
|
+
formJson: {
|
|
54
|
+
type: Object
|
|
55
|
+
},
|
|
56
|
+
formData: {
|
|
57
|
+
type: Object,
|
|
58
|
+
default: () => ({})
|
|
59
|
+
},
|
|
60
|
+
optionData: {
|
|
61
|
+
//prop传入的选项数据
|
|
62
|
+
type: Object,
|
|
63
|
+
default: () => ({})
|
|
64
|
+
},
|
|
65
|
+
globalDsv: {
|
|
66
|
+
// 全局数据源变量
|
|
67
|
+
type: Object,
|
|
68
|
+
default: () => ({})
|
|
69
|
+
},
|
|
70
|
+
parentFormRef: {
|
|
71
|
+
type: Object,
|
|
72
|
+
default: null
|
|
73
|
+
},
|
|
74
|
+
extraData: {
|
|
75
|
+
type: Object,
|
|
76
|
+
default: () => ({})
|
|
77
|
+
},
|
|
78
|
+
wrapperId: {
|
|
79
|
+
type: String,
|
|
80
|
+
default: null
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
created() {
|
|
84
|
+
this.initRefList();
|
|
85
|
+
},
|
|
86
|
+
mounted() {
|
|
87
|
+
this.loadFormCode(this.widget.options.formCode);
|
|
88
|
+
},
|
|
89
|
+
beforeUnmount() {
|
|
90
|
+
},
|
|
91
|
+
computed: {
|
|
92
|
+
rightSlotCss() {
|
|
93
|
+
return this.widget.options.rightSlotCss || "";
|
|
94
|
+
},
|
|
95
|
+
selected() {
|
|
96
|
+
return this.widget.id === this.designer.selectedId;
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
watch: {
|
|
100
|
+
"widget.options.formCode"(val) {
|
|
101
|
+
this.loadFormCode(val);
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
methods: {
|
|
105
|
+
selectWidget(widget) {
|
|
106
|
+
this.designer.setSelected(widget);
|
|
107
|
+
},
|
|
108
|
+
toggleCollapse() {
|
|
109
|
+
this.widget.options.isCollapse = !this.widget.options.isCollapse;
|
|
110
|
+
},
|
|
111
|
+
async loadFormCode(formCode) {
|
|
112
|
+
if (formCode) {
|
|
113
|
+
const res = await this.$http.get(`/api/tmgc2-query/dataQuery/detail/FormDefinitionManagement`, {
|
|
114
|
+
params: {
|
|
115
|
+
code: formCode
|
|
116
|
+
}
|
|
117
|
+
}).then((res2) => res2.data.object.frontendDefinition || "{}");
|
|
118
|
+
this.$refs.dFormRef.setFormJson(JSON.parse(res));
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
getFormRef() {
|
|
122
|
+
return this.$refs.dFormRef;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
export {
|
|
127
|
+
_sfc_main as default
|
|
128
|
+
};
|
|
@@ -39,7 +39,9 @@ const _sfc_main = {
|
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
data() {
|
|
42
|
-
return {
|
|
42
|
+
return {
|
|
43
|
+
fieldModel: null
|
|
44
|
+
};
|
|
43
45
|
},
|
|
44
46
|
components: {
|
|
45
47
|
StaticContentWrapper
|
|
@@ -86,7 +88,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
86
88
|
}, [
|
|
87
89
|
!!$props.designState ? (openBlock(), createElementBlock("div", _hoisted_1, toDisplayString(_ctx.i18nt("designer.widgetLabel.diy-compontent")) + " " + toDisplayString($props.field.options.diyCompontent), 1)) : (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
88
90
|
(openBlock(), createBlock(resolveDynamicComponent($options.renderComponent($props.field.options.diyCompontent)), normalizeProps(guardReactiveProps({
|
|
89
|
-
data:
|
|
91
|
+
data: $data.fieldModel,
|
|
90
92
|
...$props.field.options.props
|
|
91
93
|
})), null, 16))
|
|
92
94
|
]))
|
|
@@ -95,7 +97,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
95
97
|
_: 1
|
|
96
98
|
}, 8, ["designer", "field", "design-state", "parent-widget", "parent-list", "index-of-parent-list", "sub-form-row-index", "sub-form-col-index", "sub-form-row-id"]);
|
|
97
99
|
}
|
|
98
|
-
const diyCompontentWidget = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-
|
|
100
|
+
const diyCompontentWidget = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-e35ce93b"]]);
|
|
99
101
|
export {
|
|
100
102
|
diyCompontentWidget as default
|
|
101
103
|
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { translateOptionItems, deepClone } from
|
|
2
|
-
import FormValidators from
|
|
3
|
-
import { fmtHttpParams } from
|
|
4
|
-
import { eq, isArray } from
|
|
1
|
+
import { translateOptionItems, deepClone } from "../../../../utils/util.js";
|
|
2
|
+
import FormValidators from "../../../../utils/validators.js";
|
|
3
|
+
import { fmtHttpParams } from "../../../../utils/request/fmtHttpParams.js";
|
|
4
|
+
import { eq, isArray } from "lodash-es";
|
|
5
5
|
const fieldMixin = {
|
|
6
6
|
inject: [
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
"refList",
|
|
8
|
+
"getFormConfig",
|
|
9
|
+
"globalOptionData",
|
|
10
|
+
"globalModel",
|
|
11
|
+
"getOptionData",
|
|
12
|
+
"getGlobalDsv",
|
|
13
|
+
"getReadMode",
|
|
14
|
+
"getSubFormFieldFlag",
|
|
15
|
+
"getSubFormName",
|
|
16
|
+
"getDSResultCache"
|
|
17
17
|
],
|
|
18
18
|
data() {
|
|
19
19
|
return {
|
|
@@ -22,14 +22,11 @@ const fieldMixin = {
|
|
|
22
22
|
};
|
|
23
23
|
},
|
|
24
24
|
computed: {
|
|
25
|
-
isFileMode() {
|
|
26
|
-
return this.field.type === 'file-upload' || this.field.type === 'picture-upload';
|
|
27
|
-
},
|
|
28
25
|
formConfig() {
|
|
29
26
|
return this.getFormConfig();
|
|
30
27
|
},
|
|
31
28
|
subFormName() {
|
|
32
|
-
return !!this.getSubFormName ? this.getSubFormName() :
|
|
29
|
+
return !!this.getSubFormName ? this.getSubFormName() : "";
|
|
33
30
|
},
|
|
34
31
|
subFormItemFlag() {
|
|
35
32
|
return !!this.getSubFormFieldFlag ? this.getSubFormFieldFlag() : false;
|
|
@@ -45,17 +42,13 @@ const fieldMixin = {
|
|
|
45
42
|
},
|
|
46
43
|
optionLabel() {
|
|
47
44
|
if (this.fieldModel === null) {
|
|
48
|
-
return
|
|
45
|
+
return "";
|
|
49
46
|
} else {
|
|
50
|
-
let resultContent =
|
|
47
|
+
let resultContent = "";
|
|
51
48
|
const { valueKey, labelKey } = this.field.options;
|
|
52
|
-
this.field.options.optionItems.forEach(oItem => {
|
|
53
|
-
if (
|
|
54
|
-
oItem[
|
|
55
|
-
this.findInArray(this.fieldModel, oItem[valueKey]) !== -1
|
|
56
|
-
) {
|
|
57
|
-
resultContent =
|
|
58
|
-
resultContent === '' ? oItem[labelKey] : resultContent + ' ' + oItem[labelKey];
|
|
49
|
+
this.field.options.optionItems.forEach((oItem) => {
|
|
50
|
+
if (oItem[valueKey] === this.fieldModel || this.findInArray(this.fieldModel, oItem[valueKey]) !== -1) {
|
|
51
|
+
resultContent = resultContent === "" ? oItem[labelKey] : resultContent + " " + oItem[labelKey];
|
|
59
52
|
}
|
|
60
53
|
});
|
|
61
54
|
return resultContent;
|
|
@@ -102,7 +95,7 @@ const fieldMixin = {
|
|
|
102
95
|
//--------------------- 组件内部方法 begin ------------------//
|
|
103
96
|
getPropName() {
|
|
104
97
|
if (this.subFormItemFlag && !this.designState) {
|
|
105
|
-
return this.subFormName +
|
|
98
|
+
return this.subFormName + "." + this.subFormRowIndex + "." + this.field.options.name;
|
|
106
99
|
} else {
|
|
107
100
|
return this.field.options.name;
|
|
108
101
|
}
|
|
@@ -113,15 +106,9 @@ const fieldMixin = {
|
|
|
113
106
|
}
|
|
114
107
|
if (!!this.subFormItemFlag && !this.designState) {
|
|
115
108
|
const subFormData = this.formModel[this.subFormName];
|
|
116
|
-
if (
|
|
117
|
-
(subFormData === void 0 ||
|
|
118
|
-
subFormData[this.subFormRowIndex] === void 0 ||
|
|
119
|
-
subFormData[this.subFormRowIndex][this.field.options.name] === void 0) &&
|
|
120
|
-
this.field.options.defaultValue !== void 0
|
|
121
|
-
) {
|
|
109
|
+
if ((subFormData === void 0 || subFormData[this.subFormRowIndex] === void 0 || subFormData[this.subFormRowIndex][this.field.options.name] === void 0) && this.field.options.defaultValue !== void 0) {
|
|
122
110
|
this.fieldModel = this.field.options.defaultValue;
|
|
123
|
-
subFormData[this.subFormRowIndex][this.field.options.name] =
|
|
124
|
-
this.field.options.defaultValue;
|
|
111
|
+
subFormData[this.subFormRowIndex][this.field.options.name] = this.field.options.defaultValue;
|
|
125
112
|
} else if (subFormData[this.subFormRowIndex][this.field.options.name] === void 0) {
|
|
126
113
|
this.fieldModel = null;
|
|
127
114
|
subFormData[this.subFormRowIndex][this.field.options.name] = null;
|
|
@@ -141,10 +128,7 @@ const fieldMixin = {
|
|
|
141
128
|
this.initFileList();
|
|
142
129
|
return;
|
|
143
130
|
}
|
|
144
|
-
if (
|
|
145
|
-
this.formModel[this.field.options.name] === void 0 &&
|
|
146
|
-
this.field.options.defaultValue !== void 0
|
|
147
|
-
) {
|
|
131
|
+
if (this.formModel[this.field.options.name] === void 0 && this.field.options.defaultValue !== void 0) {
|
|
148
132
|
this.fieldModel = this.field.options.defaultValue;
|
|
149
133
|
} else if (this.formModel[this.field.options.name] === void 0) {
|
|
150
134
|
this.formModel[this.field.options.name] = null;
|
|
@@ -155,7 +139,7 @@ const fieldMixin = {
|
|
|
155
139
|
this.initFileList();
|
|
156
140
|
},
|
|
157
141
|
initFileList() {
|
|
158
|
-
if (
|
|
142
|
+
if (this.field.type !== "picture-upload" && this.field.type !== "file-upload" || this.designState === true) {
|
|
159
143
|
return;
|
|
160
144
|
}
|
|
161
145
|
if (!!this.fieldModel) {
|
|
@@ -167,16 +151,12 @@ const fieldMixin = {
|
|
|
167
151
|
}
|
|
168
152
|
},
|
|
169
153
|
initEventHandler() {
|
|
170
|
-
this.on$(
|
|
154
|
+
this.on$("setFormData", (newFormData) => {
|
|
171
155
|
if (!this.subFormItemFlag) {
|
|
172
|
-
|
|
173
|
-
if (this.isFileMode) {
|
|
174
|
-
if (typeof data === 'string' && data !== '') data = JSON.parse(data);
|
|
175
|
-
}
|
|
176
|
-
this.setValue(data);
|
|
156
|
+
this.setValue(newFormData[this.field.options.name]);
|
|
177
157
|
}
|
|
178
158
|
});
|
|
179
|
-
this.on$(
|
|
159
|
+
this.on$("field-value-changed", (values) => {
|
|
180
160
|
if (!!this.subFormItemFlag) {
|
|
181
161
|
const subFormData = this.formModel[this.subFormName];
|
|
182
162
|
this.handleOnChangeForSubForm(values[0], values[1], subFormData, this.subFormRowId);
|
|
@@ -184,10 +164,10 @@ const fieldMixin = {
|
|
|
184
164
|
this.handleOnChange(values[0], values[1]);
|
|
185
165
|
}
|
|
186
166
|
});
|
|
187
|
-
this.on$(
|
|
167
|
+
this.on$("loadOptionItemsFromDataSet", (dsName) => {
|
|
188
168
|
this.loadOptionItemsFromDataSet(dsName);
|
|
189
169
|
});
|
|
190
|
-
this.on$(
|
|
170
|
+
this.on$("reloadOptionItems", (widgetNames) => {
|
|
191
171
|
if (widgetNames.length === 0 || widgetNames.indexOf(this.field.options.name) > -1) {
|
|
192
172
|
this.initOptionItems(true);
|
|
193
173
|
}
|
|
@@ -215,9 +195,9 @@ const fieldMixin = {
|
|
|
215
195
|
if (this.refList !== null && !!this.field.options.name) {
|
|
216
196
|
if (this.subFormItemFlag && !this.designState) {
|
|
217
197
|
if (!!oldRefName) {
|
|
218
|
-
delete this.refList[oldRefName +
|
|
198
|
+
delete this.refList[oldRefName + "@row" + this.subFormRowId];
|
|
219
199
|
}
|
|
220
|
-
this.refList[this.field.options.name +
|
|
200
|
+
this.refList[this.field.options.name + "@row" + this.subFormRowId] = this;
|
|
221
201
|
} else {
|
|
222
202
|
if (!!oldRefName) {
|
|
223
203
|
delete this.refList[oldRefName];
|
|
@@ -230,7 +210,7 @@ const fieldMixin = {
|
|
|
230
210
|
if (this.refList !== null && !!this.field.options.name) {
|
|
231
211
|
const oldRefName = this.field.options.name;
|
|
232
212
|
if (this.subFormItemFlag && !this.designState) {
|
|
233
|
-
delete this.refList[oldRefName +
|
|
213
|
+
delete this.refList[oldRefName + "@row" + this.subFormRowId];
|
|
234
214
|
} else {
|
|
235
215
|
delete this.refList[oldRefName];
|
|
236
216
|
}
|
|
@@ -248,11 +228,8 @@ const fieldMixin = {
|
|
|
248
228
|
}
|
|
249
229
|
if (this.loading) return;
|
|
250
230
|
this.loading = true;
|
|
251
|
-
if ([
|
|
252
|
-
if (
|
|
253
|
-
!!this.field.options.dsEnabled &&
|
|
254
|
-
((_a = this.field.options.http) == null ? void 0 : _a.url)
|
|
255
|
-
) {
|
|
231
|
+
if (["radio", "checkbox", "select", "cascader", "treeSelect"].includes(this.field.type)) {
|
|
232
|
+
if (!!this.field.options.dsEnabled && ((_a = this.field.options.http) == null ? void 0 : _a.url)) {
|
|
256
233
|
try {
|
|
257
234
|
const dsResult = await fmtHttpParams.call(this, this.field.options, {
|
|
258
235
|
fieldCode: this.field.options.name
|
|
@@ -270,7 +247,7 @@ const fieldMixin = {
|
|
|
270
247
|
}
|
|
271
248
|
}
|
|
272
249
|
} catch (err) {
|
|
273
|
-
console.error(
|
|
250
|
+
console.error("err: ", err);
|
|
274
251
|
}
|
|
275
252
|
}
|
|
276
253
|
const newOptionItems = this.getOptionData();
|
|
@@ -288,20 +265,10 @@ const fieldMixin = {
|
|
|
288
265
|
if (this.designState) {
|
|
289
266
|
return;
|
|
290
267
|
}
|
|
291
|
-
if (
|
|
292
|
-
this.field.type !== 'radio' &&
|
|
293
|
-
this.field.type !== 'checkbox' &&
|
|
294
|
-
this.field.type !== 'select' &&
|
|
295
|
-
this.field.type !== 'cascader'
|
|
296
|
-
) {
|
|
268
|
+
if (this.field.type !== "radio" && this.field.type !== "checkbox" && this.field.type !== "select" && this.field.type !== "cascader") {
|
|
297
269
|
return;
|
|
298
270
|
}
|
|
299
|
-
if (
|
|
300
|
-
!this.field.options.dsEnabled ||
|
|
301
|
-
!this.field.options.dsName ||
|
|
302
|
-
!this.field.options.dataSetName ||
|
|
303
|
-
this.field.options.dsName !== dsName
|
|
304
|
-
) {
|
|
271
|
+
if (!this.field.options.dsEnabled || !this.field.options.dsName || !this.field.options.dataSetName || this.field.options.dsName !== dsName) {
|
|
305
272
|
return;
|
|
306
273
|
}
|
|
307
274
|
const dataCache = this.getDSResultCache();
|
|
@@ -331,8 +298,10 @@ const fieldMixin = {
|
|
|
331
298
|
this.rules.push({
|
|
332
299
|
required: true,
|
|
333
300
|
//trigger: ['blur', 'change'],
|
|
334
|
-
trigger: [
|
|
335
|
-
|
|
301
|
+
trigger: [
|
|
302
|
+
"blur"
|
|
303
|
+
],
|
|
304
|
+
message: this.field.options.requiredHint || this.i18nt("render.hint.fieldRequired")
|
|
336
305
|
});
|
|
337
306
|
}
|
|
338
307
|
if (!!this.field.options.validation) {
|
|
@@ -340,14 +309,14 @@ const fieldMixin = {
|
|
|
340
309
|
if (!!FormValidators[vldName]) {
|
|
341
310
|
this.rules.push({
|
|
342
311
|
validator: FormValidators[vldName],
|
|
343
|
-
trigger: [
|
|
312
|
+
trigger: ["blur", "change"],
|
|
344
313
|
label: this.field.options.label,
|
|
345
314
|
errorMsg: this.field.options.validationHint
|
|
346
315
|
});
|
|
347
316
|
} else {
|
|
348
317
|
this.rules.push({
|
|
349
|
-
validator: FormValidators[
|
|
350
|
-
trigger: [
|
|
318
|
+
validator: FormValidators["regExp"],
|
|
319
|
+
trigger: ["blur", "change"],
|
|
351
320
|
regExp: vldName,
|
|
352
321
|
label: this.field.options.label,
|
|
353
322
|
errorMsg: this.field.options.validationHint
|
|
@@ -356,12 +325,12 @@ const fieldMixin = {
|
|
|
356
325
|
}
|
|
357
326
|
if (!!this.field.options.onValidate) {
|
|
358
327
|
const customFn = (rule, value) => {
|
|
359
|
-
const tmpFunc = new Function(
|
|
328
|
+
const tmpFunc = new Function("rule", "value", this.field.options.onValidate);
|
|
360
329
|
return tmpFunc.call(this, rule, value);
|
|
361
330
|
};
|
|
362
331
|
this.rules.push({
|
|
363
332
|
validator: customFn,
|
|
364
|
-
trigger: [
|
|
333
|
+
trigger: ["blur"],
|
|
365
334
|
label: this.field.options.label
|
|
366
335
|
});
|
|
367
336
|
}
|
|
@@ -373,7 +342,7 @@ const fieldMixin = {
|
|
|
373
342
|
if (!this.rules) {
|
|
374
343
|
return;
|
|
375
344
|
}
|
|
376
|
-
this.rules.forEach(rule => {
|
|
345
|
+
this.rules.forEach((rule) => {
|
|
377
346
|
if (!!rule.trigger) {
|
|
378
347
|
rule.trigger.splice(0, rule.trigger.length);
|
|
379
348
|
}
|
|
@@ -386,16 +355,16 @@ const fieldMixin = {
|
|
|
386
355
|
if (!this.rules) {
|
|
387
356
|
return;
|
|
388
357
|
}
|
|
389
|
-
this.rules.forEach(rule => {
|
|
358
|
+
this.rules.forEach((rule) => {
|
|
390
359
|
if (!!rule.trigger) {
|
|
391
|
-
rule.trigger.push(
|
|
392
|
-
rule.trigger.push(
|
|
360
|
+
rule.trigger.push("blur");
|
|
361
|
+
rule.trigger.push("change");
|
|
393
362
|
}
|
|
394
363
|
});
|
|
395
364
|
},
|
|
396
365
|
disableOptionOfList(optionList, optionValue) {
|
|
397
366
|
if (!!optionList && optionList.length > 0) {
|
|
398
|
-
optionList.forEach(opt => {
|
|
367
|
+
optionList.forEach((opt) => {
|
|
399
368
|
if (opt.value === optionValue) {
|
|
400
369
|
opt.disabled = true;
|
|
401
370
|
}
|
|
@@ -404,7 +373,7 @@ const fieldMixin = {
|
|
|
404
373
|
},
|
|
405
374
|
enableOptionOfList(optionList, optionValue) {
|
|
406
375
|
if (!!optionList && optionList.length > 0) {
|
|
407
|
-
optionList.forEach(opt => {
|
|
376
|
+
optionList.forEach((opt) => {
|
|
408
377
|
if (opt.value === optionValue) {
|
|
409
378
|
opt.disabled = false;
|
|
410
379
|
}
|
|
@@ -417,8 +386,8 @@ const fieldMixin = {
|
|
|
417
386
|
if (newValue) {
|
|
418
387
|
newValue = newValue.target ? newValue.target.value : newValue;
|
|
419
388
|
}
|
|
420
|
-
this.emit$(
|
|
421
|
-
this.dispatch(
|
|
389
|
+
this.emit$("field-value-changed", [newValue, oldValue]);
|
|
390
|
+
this.dispatch("VFormRender", "fieldChange", [
|
|
422
391
|
this.field.options.name,
|
|
423
392
|
newValue,
|
|
424
393
|
oldValue,
|
|
@@ -450,7 +419,7 @@ const fieldMixin = {
|
|
|
450
419
|
this.syncUpdateFormModel(value);
|
|
451
420
|
this.emitFieldDataChange(value, this.oldFieldValue);
|
|
452
421
|
this.oldFieldValue = deepClone(value);
|
|
453
|
-
this.dispatch(
|
|
422
|
+
this.dispatch("VFormRender", "fieldValidation", [this.getPropName()]);
|
|
454
423
|
},
|
|
455
424
|
handleFocusCustomEvent(event) {
|
|
456
425
|
if (!!this.designState) {
|
|
@@ -458,7 +427,7 @@ const fieldMixin = {
|
|
|
458
427
|
}
|
|
459
428
|
this.oldFieldValue = deepClone(this.fieldModel);
|
|
460
429
|
if (!!this.field.options.onFocus) {
|
|
461
|
-
const customFn = new Function(
|
|
430
|
+
const customFn = new Function("event", this.field.options.onFocus);
|
|
462
431
|
customFn.call(this, event);
|
|
463
432
|
}
|
|
464
433
|
if (this.field.options.loadingPage) {
|
|
@@ -471,7 +440,7 @@ const fieldMixin = {
|
|
|
471
440
|
return;
|
|
472
441
|
}
|
|
473
442
|
if (!!this.field.options.onBlur) {
|
|
474
|
-
const customFn = new Function(
|
|
443
|
+
const customFn = new Function("event", this.field.options.onBlur);
|
|
475
444
|
customFn.call(this, event);
|
|
476
445
|
}
|
|
477
446
|
},
|
|
@@ -483,9 +452,9 @@ const fieldMixin = {
|
|
|
483
452
|
return;
|
|
484
453
|
}
|
|
485
454
|
this.syncUpdateFormModel(value);
|
|
486
|
-
this.dispatch(
|
|
455
|
+
this.dispatch("VFormRender", "fieldValidation", [this.getPropName()]);
|
|
487
456
|
if (!!this.field.options.onInput) {
|
|
488
|
-
const customFn = new Function(
|
|
457
|
+
const customFn = new Function("value", this.field.options.onInput);
|
|
489
458
|
customFn.call(this, value);
|
|
490
459
|
}
|
|
491
460
|
},
|
|
@@ -497,7 +466,7 @@ const fieldMixin = {
|
|
|
497
466
|
const customFn = new Function(this.field.options.onAppendButtonClick);
|
|
498
467
|
customFn.call(this);
|
|
499
468
|
} else {
|
|
500
|
-
this.dispatch(
|
|
469
|
+
this.dispatch("VFormRender", "appendButtonClick", [this]);
|
|
501
470
|
}
|
|
502
471
|
},
|
|
503
472
|
handleOnChange(val, oldVal, ops = []) {
|
|
@@ -505,7 +474,7 @@ const fieldMixin = {
|
|
|
505
474
|
return;
|
|
506
475
|
}
|
|
507
476
|
if (!!this.field.options.onChange) {
|
|
508
|
-
const changeFn = new Function(
|
|
477
|
+
const changeFn = new Function("value", "oldValue", "ops", this.field.options.onChange);
|
|
509
478
|
changeFn.call(this, val, oldVal, ops[0]);
|
|
510
479
|
}
|
|
511
480
|
},
|
|
@@ -515,11 +484,11 @@ const fieldMixin = {
|
|
|
515
484
|
}
|
|
516
485
|
if (!!this.field.options.onChange) {
|
|
517
486
|
const changeFn = new Function(
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
487
|
+
"value",
|
|
488
|
+
"oldValue",
|
|
489
|
+
"ops",
|
|
490
|
+
"subFormData",
|
|
491
|
+
"rowId",
|
|
523
492
|
this.field.options.onChange
|
|
524
493
|
);
|
|
525
494
|
changeFn.call(this, val, oldVal, ops[0], subFormData, rowId);
|
|
@@ -533,7 +502,7 @@ const fieldMixin = {
|
|
|
533
502
|
const customFn = new Function(this.field.options.onClick);
|
|
534
503
|
return customFn.call(this);
|
|
535
504
|
} else {
|
|
536
|
-
this.dispatch(
|
|
505
|
+
this.dispatch("VFormRender", "buttonClick", [this]);
|
|
537
506
|
}
|
|
538
507
|
},
|
|
539
508
|
handleButtonWidgetClick() {
|
|
@@ -544,7 +513,7 @@ const fieldMixin = {
|
|
|
544
513
|
const customFn = new Function(this.field.options.onClick);
|
|
545
514
|
return customFn.call(this);
|
|
546
515
|
} else {
|
|
547
|
-
this.dispatch(
|
|
516
|
+
this.dispatch("VFormRender", "buttonClick", [this]);
|
|
548
517
|
}
|
|
549
518
|
},
|
|
550
519
|
/**
|
|
@@ -576,17 +545,17 @@ const fieldMixin = {
|
|
|
576
545
|
//--------------------- 以下为组件支持外部调用的API方法 begin ------------------//
|
|
577
546
|
/* 提示:用户可自行扩充这些方法!!! */
|
|
578
547
|
getFormRef() {
|
|
579
|
-
return this.refList[
|
|
548
|
+
return this.refList["v_form_ref"];
|
|
580
549
|
},
|
|
581
550
|
getWidgetRef(widgetName, showError) {
|
|
582
551
|
const foundRef = this.refList[widgetName];
|
|
583
552
|
if (!foundRef && !!showError) {
|
|
584
|
-
this.$message.error(this.i18nt(
|
|
553
|
+
this.$message.error(this.i18nt("render.hint.refNotFound") + widgetName);
|
|
585
554
|
}
|
|
586
555
|
return foundRef;
|
|
587
556
|
},
|
|
588
557
|
getFieldEditor() {
|
|
589
|
-
return this.$refs[
|
|
558
|
+
return this.$refs["fieldEditor"];
|
|
590
559
|
},
|
|
591
560
|
showFileList(list) {
|
|
592
561
|
if (!isArray(list)) return [];
|
|
@@ -608,9 +577,9 @@ const fieldMixin = {
|
|
|
608
577
|
if (eq(this.fieldModel, newValue)) return;
|
|
609
578
|
if (!!this.field.formItemFlag) {
|
|
610
579
|
const oldValue = deepClone(this.fieldModel);
|
|
611
|
-
if (this.field.type ===
|
|
580
|
+
if (this.field.type === "file-upload") {
|
|
612
581
|
newValue = this.showFileList(newValue || []);
|
|
613
|
-
} else if (this.field.type ===
|
|
582
|
+
} else if (this.field.type === "code-editor") {
|
|
614
583
|
this.$refs.fieldEditor.setValue(newValue);
|
|
615
584
|
}
|
|
616
585
|
this.fieldModel = newValue;
|
|
@@ -629,8 +598,9 @@ const fieldMixin = {
|
|
|
629
598
|
resetField() {
|
|
630
599
|
const defaultValue = this.field.options.defaultValue;
|
|
631
600
|
this.setValue(defaultValue);
|
|
632
|
-
this.$nextTick(() => {
|
|
633
|
-
|
|
601
|
+
this.$nextTick(() => {
|
|
602
|
+
});
|
|
603
|
+
if (this.field.type === "picture-upload" || this.field.type === "file-upload") {
|
|
634
604
|
this.fileList.splice(0, this.fileList.length);
|
|
635
605
|
this.handleChangeEvent(this.fileList);
|
|
636
606
|
}
|
|
@@ -688,20 +658,13 @@ const fieldMixin = {
|
|
|
688
658
|
}
|
|
689
659
|
},
|
|
690
660
|
clearSelectedOptions() {
|
|
691
|
-
if (
|
|
692
|
-
this.field.type !== 'checkbox' &&
|
|
693
|
-
this.field.type !== 'radio' &&
|
|
694
|
-
this.field.type !== 'select'
|
|
695
|
-
) {
|
|
661
|
+
if (this.field.type !== "checkbox" && this.field.type !== "radio" && this.field.type !== "select") {
|
|
696
662
|
return;
|
|
697
663
|
}
|
|
698
|
-
if (
|
|
699
|
-
this.field.type === 'checkbox' ||
|
|
700
|
-
(this.field.type === 'select' && this.field.options.multiple)
|
|
701
|
-
) {
|
|
664
|
+
if (this.field.type === "checkbox" || this.field.type === "select" && this.field.options.multiple) {
|
|
702
665
|
this.fieldModel = [];
|
|
703
666
|
} else {
|
|
704
|
-
this.fieldModel =
|
|
667
|
+
this.fieldModel = "";
|
|
705
668
|
}
|
|
706
669
|
},
|
|
707
670
|
/**
|
|
@@ -712,8 +675,8 @@ const fieldMixin = {
|
|
|
712
675
|
this.field.options.optionItems = translateOptionItems(
|
|
713
676
|
options,
|
|
714
677
|
this.field.type,
|
|
715
|
-
this.field.options.labelKey ||
|
|
716
|
-
this.field.options.valueKey ||
|
|
678
|
+
this.field.options.labelKey || "label",
|
|
679
|
+
this.field.options.valueKey || "value"
|
|
717
680
|
);
|
|
718
681
|
},
|
|
719
682
|
/**
|
|
@@ -724,8 +687,8 @@ const fieldMixin = {
|
|
|
724
687
|
this.field.options.optionItems = translateOptionItems(
|
|
725
688
|
options,
|
|
726
689
|
this.field.type,
|
|
727
|
-
this.field.options.labelKey ||
|
|
728
|
-
this.field.options.valueKey ||
|
|
690
|
+
this.field.options.labelKey || "label",
|
|
691
|
+
this.field.options.valueKey || "value"
|
|
729
692
|
);
|
|
730
693
|
},
|
|
731
694
|
disableOption(optionValue) {
|
|
@@ -803,4 +766,6 @@ const fieldMixin = {
|
|
|
803
766
|
//--------------------- 以上为组件支持外部调用的API方法 end ------------------//
|
|
804
767
|
}
|
|
805
768
|
};
|
|
806
|
-
export {
|
|
769
|
+
export {
|
|
770
|
+
fieldMixin as default
|
|
771
|
+
};
|
|
@@ -92,7 +92,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
92
92
|
_: 1
|
|
93
93
|
}, 8, ["designer", "field", "rules", "design-state", "parent-widget", "parent-list", "index-of-parent-list", "sub-form-row-index", "sub-form-col-index", "sub-form-row-id"])) : createCommentVNode("", true);
|
|
94
94
|
}
|
|
95
|
-
const fileUploadWidget = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-
|
|
95
|
+
const fileUploadWidget = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-a39df179"]]);
|
|
96
96
|
export {
|
|
97
97
|
fileUploadWidget as default
|
|
98
98
|
};
|