@kp-ui/lowcode 1.0.31 → 1.0.32
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 +1 -1
- 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 +1 -0
- package/src/components/form-designer/form-widget/container-widget/data-table-widget.vue3.js +2 -3
- 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 +2 -0
- package/src/components/form-designer/form-widget/container-widget/vf-collapse-widget.vue4.js +1 -1
- 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/toolbar-panel/index.vue.js +4 -6
- package/src/components/form-designer/widget-panel/advanced/diy-compontent.js +1 -0
- 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/utils/i18n.js +1 -14
- 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/diy-compontent.d.ts.map +1 -1
- package/types/src/components/form-render/index.d.ts.map +1 -1
- package/src/components/form-render/dynamic-dialog.vue3.js +0 -5
- package/src/components/form-render/dynamic-drawer.vue2.js +0 -247
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import { defineComponent, getCurrentInstance, ref, computed, onBeforeUnmount, resolveComponent, createBlock, openBlock, withCtx, createVNode, createElementVNode, createCommentVNode, createTextVNode, toDisplayString, nextTick } from "vue";
|
|
2
|
-
import { useI18n } from "../../utils/i18n.js";
|
|
3
|
-
import VFormRender from "../../../render.js";
|
|
4
|
-
const _hoisted_1 = { style: { "float": "right" } };
|
|
5
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
|
-
__name: "dynamic-drawer",
|
|
7
|
-
props: {
|
|
8
|
-
options: { default: () => ({}) },
|
|
9
|
-
formJson: {},
|
|
10
|
-
formData: { default: () => ({}) },
|
|
11
|
-
vfCtx: { default: () => ({}) },
|
|
12
|
-
optionData: { default: () => ({}) },
|
|
13
|
-
globalDsv: { default: () => ({}) },
|
|
14
|
-
parentFormRef: { default: null },
|
|
15
|
-
extraData: { default: () => ({}) },
|
|
16
|
-
wrapperId: { default: null }
|
|
17
|
-
},
|
|
18
|
-
setup(__props, { expose: __expose }) {
|
|
19
|
-
const { i18nt } = useI18n();
|
|
20
|
-
const ctx = getCurrentInstance();
|
|
21
|
-
const isLoading = ref(false);
|
|
22
|
-
const props = __props;
|
|
23
|
-
const drawerVisible = ref(false);
|
|
24
|
-
const dFormRef = ref(null);
|
|
25
|
-
const drawerRef = ref(null);
|
|
26
|
-
const parentForm = computed(() => {
|
|
27
|
-
var _a;
|
|
28
|
-
return { ...props.parentFormRef, parentDom: (_a = getCurrentInstance()) == null ? void 0 : _a.proxy, getParentFormRef };
|
|
29
|
-
});
|
|
30
|
-
const cancelBtnLabel = computed(() => {
|
|
31
|
-
return props.options.cancelButtonLabel || i18nt("designer.hint.cancel");
|
|
32
|
-
});
|
|
33
|
-
const okBtnLabel = computed(() => {
|
|
34
|
-
return props.options.okButtonLabel || i18nt("designer.hint.confirm");
|
|
35
|
-
});
|
|
36
|
-
onBeforeUnmount(() => {
|
|
37
|
-
var _a;
|
|
38
|
-
(_a = props.parentFormRef) == null ? void 0 : _a.setChildFormRef(null);
|
|
39
|
-
});
|
|
40
|
-
const loadFormCode = async () => {
|
|
41
|
-
var _a;
|
|
42
|
-
if (props.options.formCode) {
|
|
43
|
-
const http = ctx.appContext.config.globalProperties.$http;
|
|
44
|
-
try {
|
|
45
|
-
const { data } = await http.get(
|
|
46
|
-
`/api/tmgc2-query/dataQuery/detail/FormDefinitionManagement`,
|
|
47
|
-
{
|
|
48
|
-
params: { code: props.options.formCode }
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
(_a = dFormRef.value) == null ? void 0 : _a.setFormJson(JSON.parse(data.object.frontendDefinition || "{}"));
|
|
52
|
-
} finally {
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
const setTitle = (title) => {
|
|
57
|
-
props.options.title = title;
|
|
58
|
-
};
|
|
59
|
-
const show = () => {
|
|
60
|
-
drawerVisible.value = true;
|
|
61
|
-
nextTick(async () => {
|
|
62
|
-
var _a, _b, _c, _d, _e, _f;
|
|
63
|
-
if (props.options.readMode) {
|
|
64
|
-
(_a = dFormRef.value) == null ? void 0 : _a.setReadMode(true);
|
|
65
|
-
}
|
|
66
|
-
(_b = dFormRef.value) == null ? void 0 : _b.setLoading(true);
|
|
67
|
-
await loadFormCode();
|
|
68
|
-
(_d = dFormRef.value) == null ? void 0 : _d.setDialogOrDrawerRef((_c = getCurrentInstance()) == null ? void 0 : _c.proxy);
|
|
69
|
-
(_e = props.parentFormRef) == null ? void 0 : _e.setChildFormRef(dFormRef.value);
|
|
70
|
-
(_f = dFormRef.value) == null ? void 0 : _f.setLoading(false);
|
|
71
|
-
handleOpenedEvent();
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
const close = () => {
|
|
75
|
-
var _a, _b;
|
|
76
|
-
if (props.options.onDrawerBeforeClose) {
|
|
77
|
-
try {
|
|
78
|
-
const customFn = new Function(props.options.onDrawerBeforeClose);
|
|
79
|
-
const closeResult = customFn.call((_a = getCurrentInstance()) == null ? void 0 : _a.proxy);
|
|
80
|
-
if (closeResult === false) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
} catch (error) {
|
|
84
|
-
console.error("Error executing onDrawerBeforeClose:", error);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
drawerVisible.value = false;
|
|
88
|
-
(_b = drawerRef.value) == null ? void 0 : _b.handleClose();
|
|
89
|
-
setTimeout(deleteWrapperNode, 150);
|
|
90
|
-
};
|
|
91
|
-
const deleteWrapperNode = () => {
|
|
92
|
-
const wrapperNode = document.getElementById("vf-dynamic-drawer-wrapper" + props.wrapperId);
|
|
93
|
-
if (wrapperNode) {
|
|
94
|
-
document.body.removeChild(wrapperNode);
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
const handleBeforeClose = (done) => {
|
|
98
|
-
var _a;
|
|
99
|
-
if (props.options.onDrawerBeforeClose) {
|
|
100
|
-
try {
|
|
101
|
-
const customFn = new Function(props.options.onDrawerBeforeClose);
|
|
102
|
-
const closeResult = customFn.call((_a = getCurrentInstance()) == null ? void 0 : _a.proxy);
|
|
103
|
-
return closeResult === false ? closeResult : done();
|
|
104
|
-
} catch (error) {
|
|
105
|
-
console.error("Error executing onDrawerBeforeClose:", error);
|
|
106
|
-
return done();
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return done();
|
|
110
|
-
};
|
|
111
|
-
const handleCloseEvent = () => {
|
|
112
|
-
drawerVisible.value = false;
|
|
113
|
-
setTimeout(deleteWrapperNode, 150);
|
|
114
|
-
};
|
|
115
|
-
const handleOpenedEvent = () => {
|
|
116
|
-
var _a;
|
|
117
|
-
if (props.options.onDrawerOpened) {
|
|
118
|
-
try {
|
|
119
|
-
const customFn = new Function(props.options.onDrawerOpened);
|
|
120
|
-
customFn.call((_a = getCurrentInstance()) == null ? void 0 : _a.proxy);
|
|
121
|
-
} catch (error) {
|
|
122
|
-
console.error("Error executing onDrawerOpened:", error);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
const handleCancelClick = () => {
|
|
127
|
-
var _a;
|
|
128
|
-
if (props.options.onCancelButtonClick) {
|
|
129
|
-
try {
|
|
130
|
-
const customFn = new Function(props.options.onCancelButtonClick);
|
|
131
|
-
const clickResult = customFn.call((_a = getCurrentInstance()) == null ? void 0 : _a.proxy);
|
|
132
|
-
if (clickResult === false) {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
} catch (error) {
|
|
136
|
-
console.error("Error executing onCancelButtonClick:", error);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
drawerVisible.value = false;
|
|
140
|
-
setTimeout(deleteWrapperNode, 150);
|
|
141
|
-
};
|
|
142
|
-
const handleOkClick = () => {
|
|
143
|
-
var _a;
|
|
144
|
-
if (props.options.onOkButtonClick) {
|
|
145
|
-
try {
|
|
146
|
-
const customFn = new Function(props.options.onOkButtonClick);
|
|
147
|
-
const clickResult = customFn.call((_a = getCurrentInstance()) == null ? void 0 : _a.proxy);
|
|
148
|
-
if (clickResult === false) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
} catch (error) {
|
|
152
|
-
console.error("Error executing onOkButtonClick:", error);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
drawerVisible.value = false;
|
|
156
|
-
setTimeout(deleteWrapperNode, 150);
|
|
157
|
-
};
|
|
158
|
-
const getParentFormRef = () => {
|
|
159
|
-
return props.parentFormRef;
|
|
160
|
-
};
|
|
161
|
-
const getFormRef = () => {
|
|
162
|
-
return dFormRef.value;
|
|
163
|
-
};
|
|
164
|
-
const getWidgetRef = (widgetName, showError = false) => {
|
|
165
|
-
var _a;
|
|
166
|
-
return (_a = dFormRef.value) == null ? void 0 : _a.getWidgetRef(widgetName, showError);
|
|
167
|
-
};
|
|
168
|
-
const getExtraData = () => {
|
|
169
|
-
return props.extraData;
|
|
170
|
-
};
|
|
171
|
-
__expose({
|
|
172
|
-
setTitle,
|
|
173
|
-
show,
|
|
174
|
-
close,
|
|
175
|
-
getFormRef,
|
|
176
|
-
getWidgetRef,
|
|
177
|
-
getExtraData,
|
|
178
|
-
getParentFormRef
|
|
179
|
-
});
|
|
180
|
-
return (_ctx, _cache) => {
|
|
181
|
-
const _component_a_button = resolveComponent("a-button");
|
|
182
|
-
const _component_a_drawer = resolveComponent("a-drawer");
|
|
183
|
-
return openBlock(), createBlock(_component_a_drawer, {
|
|
184
|
-
ref_key: "drawerRef",
|
|
185
|
-
ref: drawerRef,
|
|
186
|
-
title: _ctx.options.title,
|
|
187
|
-
visible: drawerVisible.value,
|
|
188
|
-
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => drawerVisible.value = $event),
|
|
189
|
-
"custom-class": "dynamic-drawer",
|
|
190
|
-
"append-to-body": "",
|
|
191
|
-
"destroy-on-close": "",
|
|
192
|
-
size: _ctx.options.size,
|
|
193
|
-
modal: _ctx.options.showModal,
|
|
194
|
-
direction: _ctx.options.direction,
|
|
195
|
-
"show-close": _ctx.options.showClose,
|
|
196
|
-
"close-on-click-modal": _ctx.options.closeOnClickModal,
|
|
197
|
-
"close-on-press-escape": _ctx.options.closeOnPressEscape,
|
|
198
|
-
"before-close": handleBeforeClose,
|
|
199
|
-
onClose: handleCloseEvent,
|
|
200
|
-
onOpened: handleOpenedEvent
|
|
201
|
-
}, {
|
|
202
|
-
footer: withCtx(() => [
|
|
203
|
-
createElementVNode("div", _hoisted_1, [
|
|
204
|
-
!_ctx.options.cancelButtonHidden ? (openBlock(), createBlock(_component_a_button, {
|
|
205
|
-
key: 0,
|
|
206
|
-
onClick: handleCancelClick
|
|
207
|
-
}, {
|
|
208
|
-
default: withCtx(() => [
|
|
209
|
-
createTextVNode(toDisplayString(cancelBtnLabel.value), 1)
|
|
210
|
-
]),
|
|
211
|
-
_: 1
|
|
212
|
-
})) : createCommentVNode("", true),
|
|
213
|
-
!_ctx.options.okButtonHidden ? (openBlock(), createBlock(_component_a_button, {
|
|
214
|
-
key: 1,
|
|
215
|
-
type: "primary",
|
|
216
|
-
onClick: handleOkClick
|
|
217
|
-
}, {
|
|
218
|
-
default: withCtx(() => [
|
|
219
|
-
createTextVNode(toDisplayString(okBtnLabel.value), 1)
|
|
220
|
-
]),
|
|
221
|
-
_: 1
|
|
222
|
-
})) : createCommentVNode("", true)
|
|
223
|
-
])
|
|
224
|
-
]),
|
|
225
|
-
default: withCtx(() => [
|
|
226
|
-
createVNode(VFormRender, {
|
|
227
|
-
isLoading: isLoading.value,
|
|
228
|
-
ref_key: "dFormRef",
|
|
229
|
-
ref: dFormRef,
|
|
230
|
-
"form-json": _ctx.formJson,
|
|
231
|
-
"form-data": _ctx.formData,
|
|
232
|
-
vfCtx: _ctx.vfCtx,
|
|
233
|
-
"option-data": _ctx.optionData,
|
|
234
|
-
"global-dsv": _ctx.globalDsv,
|
|
235
|
-
"parent-form": parentForm.value,
|
|
236
|
-
"disabled-mode": _ctx.options.disabledMode,
|
|
237
|
-
"dynamic-creation": true
|
|
238
|
-
}, null, 8, ["isLoading", "form-json", "form-data", "vfCtx", "option-data", "global-dsv", "parent-form", "disabled-mode"])
|
|
239
|
-
]),
|
|
240
|
-
_: 1
|
|
241
|
-
}, 8, ["title", "visible", "size", "modal", "direction", "show-close", "close-on-click-modal", "close-on-press-escape"]);
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
export {
|
|
246
|
-
_sfc_main as default
|
|
247
|
-
};
|