@kp-ui/lowcode 1.0.41 → 1.0.43
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/designer.js +13 -22
- package/index.js +6 -2
- package/package.json +28 -28
- package/render.js +58 -6
- package/src/components/form-designer/designer.js +16 -11
- package/src/components/form-designer/form-widget/container-widget/data-table-widget.vue.js +1 -1
- package/src/components/form-designer/form-widget/container-widget/data-table-widget.vue2.js +0 -1
- package/src/components/form-designer/form-widget/field-widget/button-list-widget.vue.js +149 -0
- package/src/components/form-designer/form-widget/field-widget/index.js +1 -1
- package/src/components/form-designer/setting-panel/form-setting.vue.js +114 -152
- package/src/components/form-designer/setting-panel/property-editor/button-list-editor.vue.js +276 -11
- package/src/components/form-designer/setting-panel/property-editor/button-postion-editor.vue.js +23 -0
- package/src/components/form-designer/setting-panel/property-editor/button-postion-editor.vue2.js +16 -0
- package/src/components/form-designer/setting-panel/property-editor/container-data-table/data-table-showButtonsColumn-editor.vue.js +5 -3
- package/src/components/form-designer/setting-panel/property-editor/container-data-table/data-table-tableColumns-editor.vue.js +193 -223
- package/src/components/form-designer/setting-panel/property-editor/flex-editor.vue.js +64 -0
- package/src/components/form-designer/setting-panel/property-editor/index.js +3 -1
- package/src/components/form-designer/setting-panel/propertyRegister.js +3 -1
- package/src/components/form-designer/toolbar-panel/index.vue.js +2 -1
- package/src/components/form-designer/widget-panel/advancedFieldsEnums.js +0 -2
- package/src/components/form-designer/widget-panel/{advanced/toolbar.js → basicFields/buttonList.js} +5 -4
- package/src/components/form-designer/widget-panel/basicFieldsEnums.js +2 -0
- package/src/components/form-render/SubmitButtonRender.vue.js +108 -0
- package/src/components/form-render/SubmitButtonRender.vue2.js +4 -0
- package/src/components/form-render/container-item/data-table-item.vue.js +1 -2
- package/src/components/form-render/dynamic-dialog.vue.js +87 -33
- package/src/components/public/methoad-item.vue.js +132 -0
- package/src/components/public/methoad-item.vue2.js +4 -0
- package/src/constants/index.js +13 -0
- package/src/lang/en-US.js +1 -0
- package/src/lang/zh-CN.js +4 -0
- package/src/utils/i18n.js +2 -2
- package/src/utils/smart-vue-i18n/index.js +1 -1
- package/src/utils/util.js +6 -0
- package/styles/style.css +1 -1
- package/types/install.d.ts +3 -1
- package/types/install.d.ts.map +1 -1
- package/types/src/components/form-designer/index.d.ts +1 -3
- package/types/src/components/form-designer/index.d.ts.map +1 -1
- package/types/src/components/form-designer/setting-panel/index.d.ts +2 -0
- package/types/src/components/form-designer/widget-panel/advanced/index.d.ts +1 -1
- package/types/src/components/form-designer/widget-panel/advanced/index.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/advancedFieldsEnums.d.ts +0 -8
- package/types/src/components/form-designer/widget-panel/advancedFieldsEnums.d.ts.map +1 -1
- package/types/src/components/form-designer/widget-panel/{advanced/toolbar.d.ts → basicFields/buttonList.d.ts} +2 -2
- package/types/src/components/form-designer/widget-panel/basicFields/buttonList.d.ts.map +1 -0
- package/types/src/components/form-render/SubmitButtonRender.d.ts +58 -0
- package/types/src/components/form-render/SubmitButtonRender.d.ts.map +1 -0
- package/types/src/components/form-render/index.d.ts +15 -1
- package/types/src/components/form-render/index.d.ts.map +1 -1
- package/types/src/constants/index.d.ts +4 -0
- package/types/src/constants/index.d.ts.map +1 -1
- package/src/components/BtnListConfig/BtnListConfigDialog.vue.js +0 -80
- package/src/components/BtnListConfig/BtnListConfigDialog.vue2.js +0 -4
- package/src/components/form-designer/form-widget/field-widget/toolbar-widget.vue.js +0 -94
- package/src/utils/config.js +0 -4
- package/types/src/components/form-designer/widget-panel/advanced/toolbar.d.ts.map +0 -1
|
@@ -4,12 +4,10 @@ import { codeEditor } from "./advanced/code-editor.js";
|
|
|
4
4
|
import { richEditor } from "./advanced/rich-editor.js";
|
|
5
5
|
import { fileUpload } from "./advanced/file-upload.js";
|
|
6
6
|
import { bpmnEditor } from "./advanced/bpmn-editor.js";
|
|
7
|
-
import { toolbar } from "./advanced/toolbar.js";
|
|
8
7
|
import { diyCompontent } from "./advanced/diy-compontent.js";
|
|
9
8
|
const advancedFieldsEnums = {
|
|
10
9
|
// slot,
|
|
11
10
|
diyCompontent,
|
|
12
|
-
toolbar,
|
|
13
11
|
cascader,
|
|
14
12
|
treeSelect,
|
|
15
13
|
richEditor,
|
package/src/components/form-designer/widget-panel/{advanced/toolbar.js → basicFields/buttonList.js}
RENAMED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { getUuidKey } from "@kp-ui/tool";
|
|
2
|
-
const
|
|
2
|
+
const buttonList = (ops = {}) => {
|
|
3
3
|
return {
|
|
4
4
|
key: getUuidKey(),
|
|
5
5
|
id: ops.name,
|
|
6
|
-
type: "
|
|
6
|
+
type: "button-list",
|
|
7
7
|
icon: "text-field",
|
|
8
8
|
formItemFlag: true,
|
|
9
9
|
options: {
|
|
10
10
|
name: "",
|
|
11
|
-
|
|
11
|
+
flex: "flex-start",
|
|
12
12
|
buttonList: [],
|
|
13
13
|
customClass: [],
|
|
14
|
+
buttonPosition: 0,
|
|
14
15
|
...ops
|
|
15
16
|
}
|
|
16
17
|
};
|
|
17
18
|
};
|
|
18
19
|
export {
|
|
19
|
-
|
|
20
|
+
buttonList
|
|
20
21
|
};
|
|
@@ -17,6 +17,7 @@ import { htmlText } from "./basicFields/htmlText.js";
|
|
|
17
17
|
import { button } from "./basicFields/button.js";
|
|
18
18
|
import { divider } from "./basicFields/divider.js";
|
|
19
19
|
import { dropdown } from "./basicFields/dropdown.js";
|
|
20
|
+
import { buttonList } from "./basicFields/buttonList.js";
|
|
20
21
|
const basicFieldsEnums = {
|
|
21
22
|
input,
|
|
22
23
|
textarea,
|
|
@@ -35,6 +36,7 @@ const basicFieldsEnums = {
|
|
|
35
36
|
staticText,
|
|
36
37
|
htmlText,
|
|
37
38
|
button,
|
|
39
|
+
buttonList,
|
|
38
40
|
divider,
|
|
39
41
|
dropdown
|
|
40
42
|
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, resolveComponent, createBlock, openBlock, withCtx, createCommentVNode, createTextVNode, toDisplayString } from "vue";
|
|
2
|
+
import { useI18n } from "../../utils/i18n.js";
|
|
3
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4
|
+
__name: "SubmitButtonRender",
|
|
5
|
+
props: {
|
|
6
|
+
options: { default: () => ({
|
|
7
|
+
deleteWrapperNode: () => {
|
|
8
|
+
},
|
|
9
|
+
cancelButtonLabel: "",
|
|
10
|
+
okButtonLabel: "",
|
|
11
|
+
cancelButtonHidden: false,
|
|
12
|
+
okButtonHidden: false
|
|
13
|
+
}) },
|
|
14
|
+
ctx: {}
|
|
15
|
+
},
|
|
16
|
+
emits: ["update:dialogVisible"],
|
|
17
|
+
setup(__props, { emit: __emit }) {
|
|
18
|
+
const props = __props;
|
|
19
|
+
const emit = __emit;
|
|
20
|
+
const isSubmitting = ref(false);
|
|
21
|
+
const isClosing = ref(false);
|
|
22
|
+
const { i18nt } = useI18n();
|
|
23
|
+
const cancelBtnLabel = computed(
|
|
24
|
+
() => props.options.cancelButtonLabel || i18nt("designer.hint.cancel")
|
|
25
|
+
);
|
|
26
|
+
const okBtnLabel = computed(
|
|
27
|
+
() => props.options.okButtonLabel || i18nt("designer.hint.confirm")
|
|
28
|
+
);
|
|
29
|
+
const executeCustomFunction = async (ctx, functionBody) => {
|
|
30
|
+
if (!functionBody) return true;
|
|
31
|
+
try {
|
|
32
|
+
const customFn = new Function(functionBody);
|
|
33
|
+
return await customFn.call(ctx);
|
|
34
|
+
} catch (error) {
|
|
35
|
+
console.error("执行自定义函数失败:", error);
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const closeDialog = () => {
|
|
40
|
+
emit("update:dialogVisible", false);
|
|
41
|
+
setTimeout(props.options.deleteWrapperNode, 150);
|
|
42
|
+
};
|
|
43
|
+
const handleCancelClick = async () => {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
if (isClosing.value) return;
|
|
46
|
+
try {
|
|
47
|
+
isClosing.value = true;
|
|
48
|
+
if (!((_b = (_a = props.options).handleBeforeClose) == null ? void 0 : _b.call(_a))) return;
|
|
49
|
+
const result = await executeCustomFunction(
|
|
50
|
+
props.ctx,
|
|
51
|
+
props.options.onCancelButtonClick
|
|
52
|
+
);
|
|
53
|
+
if (result === false) return;
|
|
54
|
+
closeDialog();
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.error("取消操作失败:", error);
|
|
57
|
+
} finally {
|
|
58
|
+
isClosing.value = false;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const handleOkClick = async () => {
|
|
62
|
+
if (isSubmitting.value) return;
|
|
63
|
+
try {
|
|
64
|
+
isSubmitting.value = true;
|
|
65
|
+
const result = await executeCustomFunction(props.ctx, props.options.onOkButtonClick);
|
|
66
|
+
if (result === false) return;
|
|
67
|
+
closeDialog();
|
|
68
|
+
} catch (error) {
|
|
69
|
+
console.error("提交操作失败:", error);
|
|
70
|
+
} finally {
|
|
71
|
+
isSubmitting.value = false;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
return (_ctx, _cache) => {
|
|
75
|
+
const _component_a_button = resolveComponent("a-button");
|
|
76
|
+
const _component_a_space = resolveComponent("a-space");
|
|
77
|
+
return openBlock(), createBlock(_component_a_space, { x: 8 }, {
|
|
78
|
+
default: withCtx(() => [
|
|
79
|
+
!_ctx.options.cancelButtonHidden ? (openBlock(), createBlock(_component_a_button, {
|
|
80
|
+
key: 0,
|
|
81
|
+
loading: isClosing.value,
|
|
82
|
+
onClick: handleCancelClick
|
|
83
|
+
}, {
|
|
84
|
+
default: withCtx(() => [
|
|
85
|
+
createTextVNode(toDisplayString(cancelBtnLabel.value), 1)
|
|
86
|
+
]),
|
|
87
|
+
_: 1
|
|
88
|
+
}, 8, ["loading"])) : createCommentVNode("", true),
|
|
89
|
+
!_ctx.options.okButtonHidden ? (openBlock(), createBlock(_component_a_button, {
|
|
90
|
+
key: 1,
|
|
91
|
+
type: "primary",
|
|
92
|
+
loading: isSubmitting.value,
|
|
93
|
+
onClick: handleOkClick
|
|
94
|
+
}, {
|
|
95
|
+
default: withCtx(() => [
|
|
96
|
+
createTextVNode(toDisplayString(okBtnLabel.value), 1)
|
|
97
|
+
]),
|
|
98
|
+
_: 1
|
|
99
|
+
}, 8, ["loading"])) : createCommentVNode("", true)
|
|
100
|
+
]),
|
|
101
|
+
_: 1
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
export {
|
|
107
|
+
_sfc_main as default
|
|
108
|
+
};
|
|
@@ -15,7 +15,6 @@ const _sfc_main = {
|
|
|
15
15
|
// 必须固定为ContainerItem,用于接收父级组件的broadcast事件
|
|
16
16
|
mixins: [emitter, i18n, refMixin, containerItemMixin, useDataTableMixin],
|
|
17
17
|
components: {
|
|
18
|
-
STable,
|
|
19
18
|
ContainerItemWrapper,
|
|
20
19
|
...comps
|
|
21
20
|
},
|
|
@@ -152,7 +151,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
152
151
|
[vShow, !_ctx.handleHidden()]
|
|
153
152
|
]);
|
|
154
153
|
}
|
|
155
|
-
const dataTableItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-
|
|
154
|
+
const dataTableItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-6eb89abf"]]);
|
|
156
155
|
export {
|
|
157
156
|
dataTableItem as default
|
|
158
157
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineAsyncComponent, resolveComponent, createBlock, openBlock, withCtx, createVNode, mergeProps, createElementVNode, createCommentVNode, createTextVNode, toDisplayString } from "vue";
|
|
1
|
+
import { defineAsyncComponent, resolveComponent, resolveDirective, createBlock, openBlock, withCtx, createVNode, mergeProps, withDirectives, createElementBlock, createElementVNode, createCommentVNode, createTextVNode, toDisplayString } from "vue";
|
|
2
2
|
import i18n from "../../utils/i18n.js";
|
|
3
3
|
import zhCN from "ant-design-vue/es/locale/zh_CN";
|
|
4
4
|
/* empty css */
|
|
@@ -50,6 +50,10 @@ const _sfc_main = {
|
|
|
50
50
|
},
|
|
51
51
|
data() {
|
|
52
52
|
return {
|
|
53
|
+
isSubmitting: false,
|
|
54
|
+
// 添加提交状态标记
|
|
55
|
+
isClosing: false,
|
|
56
|
+
// 添加关闭状态标记
|
|
53
57
|
isLoading: true,
|
|
54
58
|
dialogVisible: false,
|
|
55
59
|
elLocaleMap: {
|
|
@@ -62,11 +66,15 @@ const _sfc_main = {
|
|
|
62
66
|
},
|
|
63
67
|
computed: {
|
|
64
68
|
elLocale() {
|
|
65
|
-
const curLocale = localStorage.getItem("
|
|
69
|
+
const curLocale = localStorage.getItem("lowcode_local") || "zh-CN";
|
|
66
70
|
return this.elLocaleMap[curLocale];
|
|
67
71
|
},
|
|
68
72
|
parentForm() {
|
|
69
|
-
return {
|
|
73
|
+
return {
|
|
74
|
+
...this.parentFormRef,
|
|
75
|
+
parentDom: this,
|
|
76
|
+
getParentFormRef: this.getParentFormRef
|
|
77
|
+
};
|
|
70
78
|
},
|
|
71
79
|
otherAttrs() {
|
|
72
80
|
if (this.options.cancelButtonHidden && this.options.okButtonHidden) {
|
|
@@ -89,24 +97,44 @@ const _sfc_main = {
|
|
|
89
97
|
methods: {
|
|
90
98
|
async loadFormCode() {
|
|
91
99
|
if (this.options.formCode) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
100
|
+
this.isLoading = true;
|
|
101
|
+
try {
|
|
102
|
+
const res = await this.$http.get(`/api/tmgc2-query/dataQuery/detail/FormDefinitionManagement`, {
|
|
103
|
+
params: { code: this.options.formCode }
|
|
104
|
+
}).then((res2) => res2.data.object.frontendDefinition || "{}");
|
|
105
|
+
const formJson = JSON.parse(res);
|
|
106
|
+
console.log("formJson: ", formJson);
|
|
107
|
+
this.$refs.dFormRef.setFormJson(formJson);
|
|
108
|
+
} catch (error) {
|
|
109
|
+
}
|
|
110
|
+
this.isLoading = false;
|
|
96
111
|
}
|
|
97
112
|
},
|
|
113
|
+
setLoading(status) {
|
|
114
|
+
this.isLoading = status;
|
|
115
|
+
},
|
|
116
|
+
setFormJson(formJson) {
|
|
117
|
+
this.$refs.dFormRef.setFormJson(formJson);
|
|
118
|
+
},
|
|
98
119
|
setTitle(title) {
|
|
99
120
|
this.options.title = title;
|
|
100
121
|
},
|
|
122
|
+
beforeOpen() {
|
|
123
|
+
this.isLoading = true;
|
|
124
|
+
this.dialogVisible = true;
|
|
125
|
+
},
|
|
101
126
|
show() {
|
|
102
127
|
this.dialogVisible = true;
|
|
103
128
|
this.$nextTick(() => {
|
|
129
|
+
var _a;
|
|
104
130
|
if (!!this.options.readMode) {
|
|
105
131
|
this.$refs["dFormRef"].setReadMode(true);
|
|
106
132
|
}
|
|
107
133
|
this.loadFormCode();
|
|
108
|
-
this.$refs["dFormRef"].setDialogOrDrawerRef(this);
|
|
109
|
-
this.parentFormRef
|
|
134
|
+
(_a = this.$refs["dFormRef"]) == null ? void 0 : _a.setDialogOrDrawerRef(this);
|
|
135
|
+
if (this.parentFormRef) {
|
|
136
|
+
this.parentFormRef.setChildFormRef(this.$refs["dFormRef"]);
|
|
137
|
+
}
|
|
110
138
|
this.handleOpenedEvent();
|
|
111
139
|
});
|
|
112
140
|
},
|
|
@@ -122,7 +150,9 @@ const _sfc_main = {
|
|
|
122
150
|
setTimeout(this.deleteWrapperNode, 150);
|
|
123
151
|
},
|
|
124
152
|
deleteWrapperNode() {
|
|
125
|
-
const wrapperNode = document.getElementById(
|
|
153
|
+
const wrapperNode = document.getElementById(
|
|
154
|
+
"vf-dynamic-dialog-wrapper" + this.wrapperId
|
|
155
|
+
);
|
|
126
156
|
if (!!wrapperNode) {
|
|
127
157
|
document.body.removeChild(wrapperNode);
|
|
128
158
|
}
|
|
@@ -146,19 +176,29 @@ const _sfc_main = {
|
|
|
146
176
|
}
|
|
147
177
|
},
|
|
148
178
|
handleCancelClick() {
|
|
179
|
+
if (this.isClosing) return;
|
|
149
180
|
if (!this.handleBeforeClose()) return;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
181
|
+
try {
|
|
182
|
+
this.isClosing = true;
|
|
183
|
+
if (!!this.options.onCancelButtonClick) {
|
|
184
|
+
const customFn = new Function(this.options.onCancelButtonClick);
|
|
185
|
+
const clickResult = customFn.call(this);
|
|
186
|
+
if (clickResult === false) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
155
189
|
}
|
|
190
|
+
this.dialogVisible = false;
|
|
191
|
+
setTimeout(this.deleteWrapperNode, 150);
|
|
192
|
+
} catch (error) {
|
|
193
|
+
console.log("error: ", error);
|
|
194
|
+
} finally {
|
|
195
|
+
this.isClosing = false;
|
|
156
196
|
}
|
|
157
|
-
this.dialogVisible = false;
|
|
158
|
-
setTimeout(this.deleteWrapperNode, 150);
|
|
159
197
|
},
|
|
160
198
|
async handleOkClick() {
|
|
199
|
+
if (this.isSubmitting) return;
|
|
161
200
|
try {
|
|
201
|
+
this.isSubmitting = true;
|
|
162
202
|
if (!!this.options.onOkButtonClick) {
|
|
163
203
|
const customFn = new Function(this.options.onOkButtonClick);
|
|
164
204
|
const clickResult = await customFn.call(this);
|
|
@@ -170,6 +210,8 @@ const _sfc_main = {
|
|
|
170
210
|
setTimeout(this.deleteWrapperNode, 150);
|
|
171
211
|
} catch (error) {
|
|
172
212
|
console.log("error: ", error);
|
|
213
|
+
} finally {
|
|
214
|
+
this.isClosing = false;
|
|
173
215
|
}
|
|
174
216
|
},
|
|
175
217
|
getParentFormRef() {
|
|
@@ -182,18 +224,26 @@ const _sfc_main = {
|
|
|
182
224
|
getWidgetRef(widgetName, showError = false) {
|
|
183
225
|
return this.$refs["dFormRef"].getWidgetRef(widgetName, showError);
|
|
184
226
|
},
|
|
227
|
+
updateTable() {
|
|
228
|
+
var _a, _b, _c;
|
|
229
|
+
if ((_c = (_b = (_a = this.vfCtx) == null ? void 0 : _a.parent) == null ? void 0 : _b.exposed) == null ? void 0 : _c.updateTable) {
|
|
230
|
+
this.vfCtx.parent.exposed.updateTable();
|
|
231
|
+
}
|
|
232
|
+
},
|
|
185
233
|
getExtraData() {
|
|
186
234
|
return this.extraData;
|
|
187
235
|
}
|
|
188
236
|
}
|
|
189
237
|
};
|
|
190
|
-
const _hoisted_1 =
|
|
191
|
-
const _hoisted_2 = { class: "footer-
|
|
238
|
+
const _hoisted_1 = { class: "dialog-content" };
|
|
239
|
+
const _hoisted_2 = /* @__PURE__ */ createElementVNode("div", { class: "footer-left" }, null, -1);
|
|
240
|
+
const _hoisted_3 = { class: "footer-right" };
|
|
192
241
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
193
242
|
const _component_VFormRender = resolveComponent("VFormRender");
|
|
194
243
|
const _component_a_button = resolveComponent("a-button");
|
|
195
244
|
const _component_a_modal = resolveComponent("a-modal");
|
|
196
245
|
const _component_a_config_provider = resolveComponent("a-config-provider");
|
|
246
|
+
const _directive_loading = resolveDirective("loading");
|
|
197
247
|
return openBlock(), createBlock(_component_a_config_provider, {
|
|
198
248
|
locale: $options.elLocale,
|
|
199
249
|
input: { autocomplete: "off" }
|
|
@@ -220,8 +270,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
220
270
|
onCancel: $options.handleCloseEvent
|
|
221
271
|
}, $options.otherAttrs), {
|
|
222
272
|
footer: withCtx(() => [
|
|
223
|
-
|
|
224
|
-
createElementVNode("div",
|
|
273
|
+
_hoisted_2,
|
|
274
|
+
createElementVNode("div", _hoisted_3, [
|
|
225
275
|
!$props.options.cancelButtonHidden ? (openBlock(), createBlock(_component_a_button, {
|
|
226
276
|
key: 0,
|
|
227
277
|
onClick: $options.handleCancelClick
|
|
@@ -244,18 +294,22 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
244
294
|
])
|
|
245
295
|
]),
|
|
246
296
|
default: withCtx(() => [
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
297
|
+
withDirectives((openBlock(), createElementBlock("div", _hoisted_1, [
|
|
298
|
+
createVNode(_component_VFormRender, {
|
|
299
|
+
isLoading: $data.isLoading,
|
|
300
|
+
ref: "dFormRef",
|
|
301
|
+
"form-json": $props.formJson,
|
|
302
|
+
"form-data": $props.formData,
|
|
303
|
+
vfCtx: $props.vfCtx,
|
|
304
|
+
"option-data": $props.optionData,
|
|
305
|
+
"global-dsv": $props.globalDsv,
|
|
306
|
+
"parent-form": $options.parentForm,
|
|
307
|
+
"disabled-mode": $props.options.disabledMode,
|
|
308
|
+
"dynamic-creation": true
|
|
309
|
+
}, null, 8, ["isLoading", "form-json", "form-data", "vfCtx", "option-data", "global-dsv", "parent-form", "disabled-mode"])
|
|
310
|
+
])), [
|
|
311
|
+
[_directive_loading, $data.isLoading]
|
|
312
|
+
])
|
|
259
313
|
]),
|
|
260
314
|
_: 1
|
|
261
315
|
}, 16, ["transitionName", "maskTransitionName", "title", "bodyStyle", "visible", "width", "mask", "maskClosable", "keyboard", "onCancel"])
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { defineComponent, ref, resolveComponent, createElementBlock, openBlock, Fragment, createVNode, withCtx, createTextVNode, normalizeClass, toDisplayString, unref, createElementVNode } from "vue";
|
|
2
|
+
import { useI18n } from "../../utils/i18n.js";
|
|
3
|
+
import CodeEditor from "../code-editor/index.vue.js";
|
|
4
|
+
import { message } from "ant-design-vue";
|
|
5
|
+
const _hoisted_1 = { class: "dialog-footer" };
|
|
6
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
+
__name: "methoad-item",
|
|
8
|
+
props: {
|
|
9
|
+
value: {},
|
|
10
|
+
eventName: {},
|
|
11
|
+
eventParamsMap: {},
|
|
12
|
+
formConfig: {},
|
|
13
|
+
getFormEventHandled: {}
|
|
14
|
+
},
|
|
15
|
+
emits: ["update:value"],
|
|
16
|
+
setup(__props, { emit: __emit }) {
|
|
17
|
+
const { i18nt } = useI18n();
|
|
18
|
+
const props = __props;
|
|
19
|
+
const emit = __emit;
|
|
20
|
+
const ecEditor = ref();
|
|
21
|
+
const formEventHandlerCode = ref("");
|
|
22
|
+
const showFormEventDialogFlag = ref(false);
|
|
23
|
+
const editFormEventHandler = (eventName) => {
|
|
24
|
+
formEventHandlerCode.value = props.formConfig[eventName];
|
|
25
|
+
showFormEventDialogFlag.value = true;
|
|
26
|
+
};
|
|
27
|
+
const saveFormEventHandler = () => {
|
|
28
|
+
const codeHints = ecEditor.value.getEditorAnnotations();
|
|
29
|
+
let syntaxErrorFlag = false;
|
|
30
|
+
if (!!codeHints && codeHints.length > 0) {
|
|
31
|
+
codeHints.forEach((chItem) => {
|
|
32
|
+
if (chItem.type === "error") {
|
|
33
|
+
syntaxErrorFlag = true;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
if (syntaxErrorFlag) {
|
|
37
|
+
message.error(i18nt("designer.setting.syntaxCheckWarning"));
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
emit("update:value", formEventHandlerCode.value);
|
|
42
|
+
showFormEventDialogFlag.value = false;
|
|
43
|
+
};
|
|
44
|
+
return (_ctx, _cache) => {
|
|
45
|
+
const _component_a_button = resolveComponent("a-button");
|
|
46
|
+
const _component_a_form_item = resolveComponent("a-form-item");
|
|
47
|
+
const _component_a_alert = resolveComponent("a-alert");
|
|
48
|
+
const _component_a_modal = resolveComponent("a-modal");
|
|
49
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
50
|
+
createVNode(_component_a_form_item, {
|
|
51
|
+
label: _ctx.eventName,
|
|
52
|
+
"label-width": "150px"
|
|
53
|
+
}, {
|
|
54
|
+
default: withCtx(() => [
|
|
55
|
+
createVNode(_component_a_button, {
|
|
56
|
+
type: "info",
|
|
57
|
+
plain: "",
|
|
58
|
+
shape: "round",
|
|
59
|
+
class: normalizeClass([_ctx.getFormEventHandled(_ctx.eventName) ? "button-text-highlight" : ""]),
|
|
60
|
+
onClick: _cache[0] || (_cache[0] = ($event) => editFormEventHandler(_ctx.eventName))
|
|
61
|
+
}, {
|
|
62
|
+
default: withCtx(() => [
|
|
63
|
+
createTextVNode(toDisplayString(unref(i18nt)("designer.setting.addEventHandler")), 1)
|
|
64
|
+
]),
|
|
65
|
+
_: 1
|
|
66
|
+
}, 8, ["class"]),
|
|
67
|
+
createTextVNode(" " + toDisplayString(_ctx.moduleValue), 1)
|
|
68
|
+
]),
|
|
69
|
+
_: 1
|
|
70
|
+
}, 8, ["label"]),
|
|
71
|
+
createVNode(_component_a_modal, {
|
|
72
|
+
title: unref(i18nt)("designer.setting.editFormEventHandler"),
|
|
73
|
+
visible: showFormEventDialogFlag.value,
|
|
74
|
+
"onUpdate:visible": _cache[3] || (_cache[3] = ($event) => showFormEventDialogFlag.value = $event),
|
|
75
|
+
"show-close": true,
|
|
76
|
+
"custom-class": "drag-dialog small-padding-dialog",
|
|
77
|
+
"append-to-body": "",
|
|
78
|
+
"close-on-click-modal": false,
|
|
79
|
+
"close-on-press-escape": false,
|
|
80
|
+
"destroy-on-close": true,
|
|
81
|
+
width: 800
|
|
82
|
+
}, {
|
|
83
|
+
footer: withCtx(() => [
|
|
84
|
+
createElementVNode("div", _hoisted_1, [
|
|
85
|
+
createVNode(_component_a_button, {
|
|
86
|
+
onClick: _cache[2] || (_cache[2] = ($event) => showFormEventDialogFlag.value = false)
|
|
87
|
+
}, {
|
|
88
|
+
default: withCtx(() => [
|
|
89
|
+
createTextVNode(toDisplayString(unref(i18nt)("designer.hint.cancel")), 1)
|
|
90
|
+
]),
|
|
91
|
+
_: 1
|
|
92
|
+
}),
|
|
93
|
+
createVNode(_component_a_button, {
|
|
94
|
+
type: "primary",
|
|
95
|
+
onClick: saveFormEventHandler
|
|
96
|
+
}, {
|
|
97
|
+
default: withCtx(() => [
|
|
98
|
+
createTextVNode(toDisplayString(unref(i18nt)("designer.hint.confirm")), 1)
|
|
99
|
+
]),
|
|
100
|
+
_: 1
|
|
101
|
+
})
|
|
102
|
+
])
|
|
103
|
+
]),
|
|
104
|
+
default: withCtx(() => [
|
|
105
|
+
createVNode(_component_a_alert, {
|
|
106
|
+
type: "info",
|
|
107
|
+
closable: false,
|
|
108
|
+
message: "form." + _ctx.eventParamsMap[_ctx.eventName]
|
|
109
|
+
}, null, 8, ["message"]),
|
|
110
|
+
createVNode(CodeEditor, {
|
|
111
|
+
mode: "javascript",
|
|
112
|
+
readonly: false,
|
|
113
|
+
modelValue: formEventHandlerCode.value,
|
|
114
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => formEventHandlerCode.value = $event),
|
|
115
|
+
ref_key: "ecEditor",
|
|
116
|
+
ref: ecEditor
|
|
117
|
+
}, null, 8, ["modelValue"]),
|
|
118
|
+
createVNode(_component_a_alert, {
|
|
119
|
+
type: "info",
|
|
120
|
+
closable: false,
|
|
121
|
+
message: "}"
|
|
122
|
+
})
|
|
123
|
+
]),
|
|
124
|
+
_: 1
|
|
125
|
+
}, 8, ["title", "visible"])
|
|
126
|
+
], 64);
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
export {
|
|
131
|
+
_sfc_main as default
|
|
132
|
+
};
|
package/src/lang/en-US.js
CHANGED
package/src/lang/zh-CN.js
CHANGED
|
@@ -61,6 +61,7 @@ const zhLocale = {
|
|
|
61
61
|
treeSelect: "树形选择",
|
|
62
62
|
"diy-compontent": "自定义组件",
|
|
63
63
|
toolbar: "工具栏",
|
|
64
|
+
"button-list": "按钮组",
|
|
64
65
|
slot: "插槽",
|
|
65
66
|
custom: "Custom Component"
|
|
66
67
|
},
|
|
@@ -179,6 +180,7 @@ const zhLocale = {
|
|
|
179
180
|
endPlaceholder: "截止占位内容",
|
|
180
181
|
widgetColumnWidth: "组件列宽",
|
|
181
182
|
widgetSize: "组件大小",
|
|
183
|
+
widgetFlex: "对齐方式",
|
|
182
184
|
autoFullWidth: "自动拉伸宽度",
|
|
183
185
|
displayStyle: "显示样式",
|
|
184
186
|
inlineLayout: "行内",
|
|
@@ -233,6 +235,7 @@ const zhLocale = {
|
|
|
233
235
|
fileTypes: "上传文件类型",
|
|
234
236
|
fileTypesHelp: "支持添加其他文件类型",
|
|
235
237
|
headers: "上传请求头",
|
|
238
|
+
danger: "危险按钮",
|
|
236
239
|
cellWidth: "宽度",
|
|
237
240
|
cellHeight: "高度",
|
|
238
241
|
gridColHeight: "栅格列统一高度(px)",
|
|
@@ -305,6 +308,7 @@ const zhLocale = {
|
|
|
305
308
|
leftPosition: "左边",
|
|
306
309
|
labelAlign: "字段标签对齐",
|
|
307
310
|
buttonList: "按钮组",
|
|
311
|
+
buttonPosition: "按钮组位置",
|
|
308
312
|
leftAlign: "居左",
|
|
309
313
|
centerAlign: "居中",
|
|
310
314
|
rightAlign: "居右",
|
package/src/utils/i18n.js
CHANGED
|
@@ -32,12 +32,12 @@ const langResources = {
|
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
const i18n = createI18n({
|
|
35
|
-
locale: localStorage.getItem("
|
|
35
|
+
locale: localStorage.getItem("lowcode_local") || "zh-CN",
|
|
36
36
|
messages: langResources
|
|
37
37
|
});
|
|
38
38
|
const changeLocale = function(langName) {
|
|
39
39
|
i18n.setLang(langName);
|
|
40
|
-
localStorage.setItem("
|
|
40
|
+
localStorage.setItem("lowcode_local", langName);
|
|
41
41
|
};
|
|
42
42
|
const i18n$1 = {
|
|
43
43
|
methods: {
|
package/src/utils/util.js
CHANGED
|
@@ -305,6 +305,10 @@ function getDefaultFormConfig() {
|
|
|
305
305
|
labelAlign: "right",
|
|
306
306
|
cssCode: "",
|
|
307
307
|
customClass: [],
|
|
308
|
+
okButtonLabel: "",
|
|
309
|
+
okButtonHidden: "",
|
|
310
|
+
cancelButtonHidden: "",
|
|
311
|
+
cancelButtonLabel: "",
|
|
308
312
|
functions: "",
|
|
309
313
|
//全局函数
|
|
310
314
|
layoutType: "PC",
|
|
@@ -321,6 +325,8 @@ function getDefaultFormConfig() {
|
|
|
321
325
|
})
|
|
322
326
|
`,
|
|
323
327
|
onFormDataChange: "",
|
|
328
|
+
onOkButtonClick: "",
|
|
329
|
+
onCancelButtonClick: "",
|
|
324
330
|
serveList: {
|
|
325
331
|
vformUpdate: {
|
|
326
332
|
http: {
|