@fecp/vue 1.1.9 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/es/node_modules/.pnpm/@vueuse_shared@10.11.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vueuse/shared/index.mjs +1 -1
  2. package/es/node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/cascader/src/cascader.vue2.mjs +1 -1
  3. package/es/node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/container/index.mjs +6 -6
  4. package/es/node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/form/src/hooks/use-form-common-props.mjs +1 -1
  5. package/es/node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/input/src/input.vue2.mjs +1 -1
  6. package/es/packages/mobile/src/components/base/card/Card.vue.mjs +2 -2
  7. package/es/packages/vue/index.mjs +1 -1
  8. package/es/packages/vue/src/components/details/footer/Footer.vue.mjs +19 -11
  9. package/es/packages/vue/src/components/dialog/DialogRenderer.vue2.mjs +403 -0
  10. package/es/packages/vue/src/components/dialog/index.mjs +68 -0
  11. package/es/packages/vue/src/components/forms/form/Form.vue.mjs +50 -19
  12. package/es/packages/vue/src/components/forms/formItem/FormItem.vue.mjs +10 -4
  13. package/es/packages/vue/src/components/forms/subForm/SubForm.vue.mjs +6 -1
  14. package/es/packages/vue/src/components/forms/subTable/SubTable.vue.mjs +2 -3
  15. package/es/packages/vue/src/components/forms/text/Text.vue.mjs +81 -8
  16. package/es/packages/vue/src/components/table/Pagination.vue.mjs +3 -2
  17. package/es/packages/vue/src/components/table/Table.vue.mjs +59 -18
  18. package/es/packages/vue/src/components/table/TableColumn.vue.mjs +32 -17
  19. package/es/packages/vue/src/components/table/TableFilter.vue.mjs +8 -5
  20. package/es/packages/vue/src/components/table/index.mjs +2 -2
  21. package/es/packages/vue/src/composables/usePageEvents.mjs +14 -6
  22. package/es/packages/vue/src/utils/common.mjs +5 -0
  23. package/es/packages/vue/src/utils/eventFlow/actionHandlers.mjs +48 -3
  24. package/es/packages/vue/src/utils/eventFlow/eventFlowHandler.mjs +58 -26
  25. package/es/packages/vue/src/utils/eventFlowParser.mjs +9 -6
  26. package/es/packages/vue/src/utils/formulajs/calculate.mjs +1 -1
  27. package/es/vue.css +293 -208
  28. package/lib/node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/cascader/src/cascader.vue2.js +29 -29
  29. package/lib/packages/mobile/src/components/base/card/Card.vue.js +2 -2
  30. package/lib/packages/vue/index.js +1 -1
  31. package/lib/packages/vue/src/components/details/footer/Footer.vue.js +19 -11
  32. package/lib/packages/vue/src/components/dialog/DialogRenderer.vue2.js +403 -0
  33. package/lib/packages/vue/src/components/dialog/index.js +68 -0
  34. package/lib/packages/vue/src/components/forms/form/Form.vue.js +50 -19
  35. package/lib/packages/vue/src/components/forms/formItem/FormItem.vue.js +10 -4
  36. package/lib/packages/vue/src/components/forms/subForm/SubForm.vue.js +6 -1
  37. package/lib/packages/vue/src/components/forms/subTable/SubTable.vue.js +0 -1
  38. package/lib/packages/vue/src/components/forms/text/Text.vue.js +80 -7
  39. package/lib/packages/vue/src/components/table/Pagination.vue.js +3 -2
  40. package/lib/packages/vue/src/components/table/Table.vue.js +59 -18
  41. package/lib/packages/vue/src/components/table/TableColumn.vue.js +31 -16
  42. package/lib/packages/vue/src/components/table/TableFilter.vue.js +8 -5
  43. package/lib/packages/vue/src/composables/usePageEvents.js +14 -6
  44. package/lib/packages/vue/src/utils/common.js +5 -0
  45. package/lib/packages/vue/src/utils/eventFlow/actionHandlers.js +56 -11
  46. package/lib/packages/vue/src/utils/eventFlow/eventFlowHandler.js +58 -26
  47. package/lib/packages/vue/src/utils/eventFlowParser.js +9 -6
  48. package/lib/packages/vue/src/utils/formulajs/calculate.js +1 -1
  49. package/lib/vue.css +293 -208
  50. package/package.json +1 -1
@@ -0,0 +1,403 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ ;/* empty css */
4
+ ;/* empty css */
5
+ ;/* empty css */
6
+ ;/* empty css */
7
+ const vue = require("vue");
8
+ const index$1 = require("../table/index.js");
9
+ const index$2 = require("../forms/form/index.js");
10
+ const parseRouteParams = require("../../utils/parseRouteParams.js");
11
+ const calculate = require("../../utils/formulajs/calculate.js");
12
+ const eventFlowHandler = require("../../utils/eventFlow/eventFlowHandler.js");
13
+ ;/* empty css */
14
+ ;/* empty css */
15
+ ;/* empty css */
16
+ ;/* empty css */
17
+ const _pluginVue_exportHelper = require("../../../../../_virtual/_plugin-vue_export-helper.js");
18
+ ;/* empty css */
19
+ ;/* empty css */
20
+ const index = require("../../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/dialog/index.js");
21
+ const index$3 = require("../../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/button/index.js");
22
+ const index$4 = require("../../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/message/index.js");
23
+ const _hoisted_1 = { class: "dialog-header-content" };
24
+ const _hoisted_2 = {
25
+ key: 1,
26
+ class: "component-error"
27
+ };
28
+ const _hoisted_3 = {
29
+ key: 3,
30
+ class: "empty-content"
31
+ };
32
+ const _sfc_main = {
33
+ __name: "DialogRenderer",
34
+ props: {
35
+ // 弹层配置
36
+ dialogConfig: {
37
+ type: Object,
38
+ required: true
39
+ },
40
+ // 是否显示
41
+ modelValue: {
42
+ type: Boolean,
43
+ default: false
44
+ },
45
+ fieldsList: {
46
+ type: Array,
47
+ default: []
48
+ },
49
+ formData: {
50
+ type: Object,
51
+ default: {}
52
+ },
53
+ displayField: {
54
+ type: String,
55
+ default: ""
56
+ },
57
+ componentCtx: {
58
+ type: Object,
59
+ default: {}
60
+ },
61
+ instance: {
62
+ type: Object,
63
+ default: {}
64
+ }
65
+ },
66
+ emits: [
67
+ "update:modelValue",
68
+ "confirm",
69
+ "cancel",
70
+ "selection-change",
71
+ "form-submit"
72
+ ],
73
+ setup(__props, { expose: __expose, emit: __emit }) {
74
+ const props = __props;
75
+ const emit = __emit;
76
+ const dialogVisible = vue.ref(false);
77
+ const tableSelectionRows = vue.ref([]);
78
+ vue.ref(null);
79
+ const currentDialogConfig = vue.computed(() => props.dialogConfig);
80
+ const dialogWidth = vue.computed(() => {
81
+ var _a, _b;
82
+ const size = ((_a = currentDialogConfig.value) == null ? void 0 : _a.dialogSize) || "standard";
83
+ const sizeMap = {
84
+ standard: "50%",
85
+ small: "30%",
86
+ large: "70%"
87
+ };
88
+ if (size === "custom") {
89
+ return ((_b = currentDialogConfig.value) == null ? void 0 : _b.customWidth) || "50%";
90
+ }
91
+ return sizeMap[size] || "50%";
92
+ });
93
+ const contentStyle = vue.computed(() => {
94
+ var _a, _b;
95
+ const size = (_a = currentDialogConfig.value) == null ? void 0 : _a.dialogSize;
96
+ if (size === "custom" && ((_b = currentDialogConfig.value) == null ? void 0 : _b.customMaxHeight)) {
97
+ return {
98
+ maxHeight: currentDialogConfig.value.customMaxHeight,
99
+ overflow: "auto"
100
+ };
101
+ }
102
+ return {};
103
+ });
104
+ vue.computed(() => {
105
+ var _a;
106
+ const configParams = ((_a = currentDialogConfig.value) == null ? void 0 : _a.dialogParams) || [];
107
+ const paramsObj = {};
108
+ configParams.forEach((param) => {
109
+ paramsObj[param.paramName] = param.paramValue;
110
+ });
111
+ return { ...paramsObj };
112
+ });
113
+ vue.watch(
114
+ () => {
115
+ return props.modelValue;
116
+ },
117
+ (val) => {
118
+ dialogVisible.value = val;
119
+ },
120
+ {
121
+ immediate: true
122
+ }
123
+ );
124
+ vue.watch(dialogVisible, (val) => {
125
+ emit("update:modelValue", val);
126
+ });
127
+ const loadComponent = (path) => {
128
+ if (!path) return null;
129
+ try {
130
+ const component = vue.defineAsyncComponent(
131
+ () => import(
132
+ /* @vite-ignore */
133
+ path
134
+ )
135
+ );
136
+ return component;
137
+ } catch (error) {
138
+ console.error("组件加载失败:", error);
139
+ return null;
140
+ }
141
+ };
142
+ const handleSubmit = (data) => {
143
+ emit("confirm", data);
144
+ };
145
+ const handleClose = () => {
146
+ dialogVisible.value = false;
147
+ };
148
+ const dialogTableRef = vue.ref();
149
+ const handleConfirm = () => {
150
+ var _a, _b, _c, _d, _e;
151
+ const contentSource = (_a = currentDialogConfig.value) == null ? void 0 : _a.contentSource;
152
+ if (contentSource === "table") {
153
+ if (tableSelectionRows.value.length == 0) {
154
+ index$4.ElMessage.error("数据未选择,请选择");
155
+ return;
156
+ }
157
+ const formData = {};
158
+ const displayFormat = currentDialogConfig.value.displayFormat;
159
+ const displayValues = tableSelectionRows.value.map((row) => {
160
+ const calcResult = calculate.calculate({
161
+ text: displayFormat == null ? void 0 : displayFormat.text,
162
+ marks: [],
163
+ value: row
164
+ });
165
+ return calcResult;
166
+ });
167
+ if (props.displayField) {
168
+ formData[props.displayField] = displayValues.join(",");
169
+ } else {
170
+ console.log("未配置参数字段: displayField");
171
+ }
172
+ const fieldMapping = currentDialogConfig.value.fieldMapping;
173
+ if ((fieldMapping == null ? void 0 : fieldMapping.length) > 0) {
174
+ fieldMapping.forEach((item) => {
175
+ const field = props.fieldsList.find((field2) => field2.id === item.field);
176
+ if (field) {
177
+ const values = tableSelectionRows.value.map((row) => row[item.value]);
178
+ formData[field.fieldName] = values.join("|");
179
+ }
180
+ });
181
+ }
182
+ if (Object.keys(formData).length > 0) {
183
+ (_d = (_c = (_b = props.componentCtx) == null ? void 0 : _b.$) == null ? void 0 : _c.exposed) == null ? void 0 : _d.setFormData(formData);
184
+ }
185
+ const callbackEventConfig = currentDialogConfig.value.callbackEventConfig;
186
+ if (callbackEventConfig && ((_e = callbackEventConfig == null ? void 0 : callbackEventConfig.next) == null ? void 0 : _e.id) != "end") {
187
+ const fieldsData = dialogTableRef.value.localConfig.fieldsData;
188
+ eventFlowHandler.executeEventFlow({
189
+ eventFlow: callbackEventConfig,
190
+ fields: fieldsData,
191
+ instance: props.instance,
192
+ localConfig: dialogTableRef.value.localConfig || {},
193
+ components: {
194
+ table: {
195
+ $: {
196
+ exposed: dialogTableRef.value
197
+ }
198
+ }
199
+ },
200
+ row: {},
201
+ item: {}
202
+ });
203
+ }
204
+ emit("confirm", tableSelectionRows.value);
205
+ } else {
206
+ emit("confirm");
207
+ }
208
+ dialogVisible.value = false;
209
+ };
210
+ const handleCancel = () => {
211
+ emit("cancel");
212
+ dialogVisible.value = false;
213
+ };
214
+ const initDialogParams = vue.computed(() => {
215
+ var _a;
216
+ if (((_a = currentDialogConfig.value.dialogParams) == null ? void 0 : _a.length) > 0) {
217
+ const params = parseRouteParams.parseRouteParams(
218
+ currentDialogConfig.value.dialogParams,
219
+ props.formData,
220
+ props.fieldsList
221
+ );
222
+ return params;
223
+ }
224
+ return {};
225
+ });
226
+ __expose({
227
+ // 打开弹层
228
+ open: (params = {}) => {
229
+ dialogVisible.value = true;
230
+ },
231
+ // 关闭弹层
232
+ close: () => {
233
+ dialogVisible.value = false;
234
+ }
235
+ // // 获取当前选中的数据(列表模式)
236
+ // getSelection: () => {
237
+ // return tableRendererRef.value?.getSelection?.();
238
+ // },
239
+ // // 获取表单数据(表单模式)
240
+ // getFormData: () => {
241
+ // return formRendererRef.value?.getFormData?.();
242
+ // },
243
+ // // 重置表单(表单模式)
244
+ // resetForm: () => {
245
+ // formRendererRef.value?.resetForm?.();
246
+ // },
247
+ });
248
+ function tableSelectionChange(selectionRows) {
249
+ tableSelectionRows.value = selectionRows;
250
+ }
251
+ const subFormOption = vue.ref({});
252
+ const handleEvent = vue.ref(null);
253
+ const dialogFormRef = vue.ref();
254
+ function subFormLoaded(subOption) {
255
+ subFormOption.value = subOption;
256
+ const fieldsData = subFormOption.value.fieldsData.map((item) => {
257
+ return item.component;
258
+ });
259
+ const hiddenFields = subFormOption.value.hiddenFields;
260
+ const { handleEvent: createHandleEvent } = eventFlowHandler.useEventFlow({
261
+ fields: [...fieldsData, ...hiddenFields],
262
+ instance: props.instance,
263
+ localConfig: subFormOption.value || {},
264
+ components: {
265
+ form: {
266
+ $: {
267
+ exposed: dialogFormRef.value
268
+ }
269
+ }
270
+ },
271
+ onSuccess: (result, row, item) => {
272
+ dialogVisible.value = false;
273
+ },
274
+ onError: (error, row, item) => {
275
+ }
276
+ });
277
+ handleEvent.value = createHandleEvent;
278
+ }
279
+ const subFormFooterBtns = vue.computed(() => {
280
+ const btnArr = [];
281
+ currentDialogConfig.value.subFormFooterButtons.forEach((btnId) => {
282
+ var _a, _b;
283
+ const btn = (_b = (_a = subFormOption.value) == null ? void 0 : _a.pageFooterConfig) == null ? void 0 : _b.actions.find(
284
+ (btn2) => btn2.id == btnId
285
+ );
286
+ if (btn) {
287
+ btnArr.push(btn);
288
+ }
289
+ });
290
+ return btnArr;
291
+ });
292
+ function formFooterClick(button) {
293
+ var _a;
294
+ const formData = dialogFormRef.value.getFormData();
295
+ handleEvent.value(
296
+ formData,
297
+ button,
298
+ (_a = button.eventConfig) == null ? void 0 : _a.find((item) => item.name == "Click")
299
+ );
300
+ }
301
+ return (_ctx, _cache) => {
302
+ const _component_el_button = index$3.ElButton;
303
+ const _component_el_dialog = index.ElDialog;
304
+ return vue.openBlock(), vue.createBlock(_component_el_dialog, {
305
+ modelValue: dialogVisible.value,
306
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => dialogVisible.value = $event),
307
+ width: dialogWidth.value,
308
+ draggable: true,
309
+ "close-on-click-modal": false,
310
+ "append-to-body": "",
311
+ class: "fec-dialog-renderer"
312
+ }, {
313
+ header: vue.withCtx(() => {
314
+ var _a;
315
+ return [
316
+ vue.createElementVNode("div", _hoisted_1, [
317
+ vue.createElementVNode("span", null, vue.toDisplayString(((_a = currentDialogConfig.value) == null ? void 0 : _a.dialogTitle) || "弹层"), 1)
318
+ ])
319
+ ];
320
+ }),
321
+ footer: vue.withCtx(() => {
322
+ var _a, _b, _c;
323
+ return [
324
+ vue.createVNode(_component_el_button, { onClick: handleCancel }, {
325
+ default: vue.withCtx(() => _cache[1] || (_cache[1] = [
326
+ vue.createTextVNode("取消")
327
+ ])),
328
+ _: 1
329
+ }),
330
+ ((_a = __props.dialogConfig) == null ? void 0 : _a.contentSource) === "table" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
331
+ !__props.dialogConfig.isSubTableReadOnly ? (vue.openBlock(), vue.createBlock(_component_el_button, {
332
+ key: 0,
333
+ type: "primary",
334
+ onClick: handleConfirm
335
+ }, {
336
+ default: vue.withCtx(() => _cache[2] || (_cache[2] = [
337
+ vue.createTextVNode("确定")
338
+ ])),
339
+ _: 1
340
+ })) : vue.createCommentVNode("", true)
341
+ ], 64)) : vue.createCommentVNode("", true),
342
+ ((_b = __props.dialogConfig) == null ? void 0 : _b.contentSource) === "form" && ((_c = __props.dialogConfig) == null ? void 0 : _c.subFormMode) != "query" ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(subFormFooterBtns.value, (btn) => {
343
+ return vue.openBlock(), vue.createBlock(_component_el_button, {
344
+ key: btn.id,
345
+ type: "primary",
346
+ onClick: ($event) => formFooterClick(btn)
347
+ }, {
348
+ default: vue.withCtx(() => [
349
+ vue.createTextVNode(vue.toDisplayString(btn.label), 1)
350
+ ]),
351
+ _: 2
352
+ }, 1032, ["onClick"]);
353
+ }), 128)) : vue.createCommentVNode("", true)
354
+ ];
355
+ }),
356
+ default: vue.withCtx(() => {
357
+ var _a, _b, _c, _d, _e;
358
+ return [
359
+ vue.createElementVNode("div", {
360
+ class: vue.normalizeClass(["dialog-content-wrapper", "fec-dialog-" + ((_a = __props.dialogConfig) == null ? void 0 : _a.contentSource)]),
361
+ style: vue.normalizeStyle(contentStyle.value)
362
+ }, [
363
+ ((_b = __props.dialogConfig) == null ? void 0 : _b.contentSource) === "table" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
364
+ __props.dialogConfig.tableContent === "select" ? (vue.openBlock(), vue.createBlock(vue.unref(index$1.Table), {
365
+ key: 0,
366
+ templateKey: __props.dialogConfig.subTableKey,
367
+ mode: __props.dialogConfig.subTableMode,
368
+ isDialog: "",
369
+ hasPagination: __props.dialogConfig.isSubTablePagination,
370
+ initSearchData: initDialogParams.value,
371
+ readonly: __props.dialogConfig.isSubTableReadOnly,
372
+ selectMode: __props.dialogConfig.selectionMode,
373
+ onSelectionChange: tableSelectionChange,
374
+ ref_key: "dialogTableRef",
375
+ ref: dialogTableRef
376
+ }, null, 8, ["templateKey", "mode", "hasPagination", "initSearchData", "readonly", "selectMode"])) : __props.dialogConfig.tableContent === "custom" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [], 64)) : vue.createCommentVNode("", true)
377
+ ], 64)) : ((_c = __props.dialogConfig) == null ? void 0 : _c.contentSource) === "form" ? (vue.openBlock(), vue.createBlock(vue.unref(index$2.Form), {
378
+ key: 1,
379
+ templateKey: __props.dialogConfig.subFormKey,
380
+ isDialog: "",
381
+ initSearchData: initDialogParams.value,
382
+ onLoaded: subFormLoaded,
383
+ initFormMode: __props.dialogConfig.subFormMode,
384
+ ref_key: "dialogFormRef",
385
+ ref: dialogFormRef
386
+ }, null, 8, ["templateKey", "initSearchData", "initFormMode"])) : ((_d = __props.dialogConfig) == null ? void 0 : _d.contentSource) === "component" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
387
+ loadComponent(__props.dialogConfig.componentPath) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(loadComponent(__props.dialogConfig.componentPath)), {
388
+ key: 0,
389
+ "dialog-params": __props.dialogConfig.dialogParams,
390
+ onClose: handleClose,
391
+ onSubmit: handleSubmit
392
+ }, null, 40, ["dialog-params"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, " 组件加载失败,请检查组件路径: " + vue.toDisplayString((_e = __props.dialogConfig) == null ? void 0 : _e.componentPath), 1))
393
+ ], 64)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_3, "请配置弹层内容"))
394
+ ], 6)
395
+ ];
396
+ }),
397
+ _: 1
398
+ }, 8, ["modelValue", "width"]);
399
+ };
400
+ }
401
+ };
402
+ const DialogRenderer = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-7a29ddee"]]);
403
+ exports.default = DialogRenderer;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const vue = require("vue");
4
+ const DialogRenderer = require("./DialogRenderer.vue2.js");
5
+ let currentDialogInstance = null;
6
+ let isCleaningUp = false;
7
+ const cleanupDialog = () => {
8
+ if (isCleaningUp) return;
9
+ isCleaningUp = true;
10
+ setTimeout(() => {
11
+ var _a;
12
+ try {
13
+ if ((_a = currentDialogInstance == null ? void 0 : currentDialogInstance.container) == null ? void 0 : _a.parentNode) {
14
+ currentDialogInstance.container.parentNode.removeChild(currentDialogInstance.container);
15
+ }
16
+ if (currentDialogInstance == null ? void 0 : currentDialogInstance.vnode) {
17
+ vue.render(null, currentDialogInstance.container);
18
+ }
19
+ currentDialogInstance = null;
20
+ } catch (error) {
21
+ console.error("Dialog cleanup error:", error);
22
+ } finally {
23
+ isCleaningUp = false;
24
+ }
25
+ }, 300);
26
+ };
27
+ function openDialog(displayField, dialogConfig, instance, componentCtx, fieldsList, formData) {
28
+ return new Promise((resolve, reject) => {
29
+ if (currentDialogInstance) {
30
+ closeDialog();
31
+ }
32
+ const container = document.createElement("div");
33
+ document.body.appendChild(container);
34
+ const vnode = vue.createVNode(DialogRenderer.default, {
35
+ dialogConfig,
36
+ modelValue: true,
37
+ fieldsList,
38
+ formData,
39
+ displayField,
40
+ componentCtx,
41
+ instance,
42
+ "onUpdate:modelValue": (val) => {
43
+ if (!val) {
44
+ cleanupDialog();
45
+ }
46
+ },
47
+ onConfirm: (data) => {
48
+ resolve(data);
49
+ cleanupDialog();
50
+ },
51
+ onCancel: () => {
52
+ reject(new Error("用户取消"));
53
+ cleanupDialog();
54
+ }
55
+ });
56
+ vnode.appContext = instance.appContext;
57
+ vue.render(vnode, container);
58
+ currentDialogInstance = { vnode, container };
59
+ });
60
+ }
61
+ function closeDialog() {
62
+ var _a, _b, _c;
63
+ if ((_c = (_b = (_a = currentDialogInstance == null ? void 0 : currentDialogInstance.vnode) == null ? void 0 : _a.component) == null ? void 0 : _b.ctx) == null ? void 0 : _c.dialogVisible) {
64
+ currentDialogInstance.vnode.component.ctx.dialogVisible.value = false;
65
+ }
66
+ }
67
+ exports.closeDialog = closeDialog;
68
+ exports.openDialog = openDialog;
@@ -15,22 +15,26 @@ const FormItem = require("../formItem/FormItem.vue.js");
15
15
  const datasource = require("../../../utils/datasource.js");
16
16
  const validation = require("./validation.js");
17
17
  const common = require("../../../utils/common.js");
18
- ;/* empty css */
19
18
  ;/* empty css */
20
- ;/* empty css */
21
19
  ;/* empty css */
20
+ ;/* empty css */
21
+ require("../../table/index.js");
22
+ require("./index.js");
23
+ const calculate = require("../../../utils/formulajs/calculate.js");
22
24
  const eventFlowHandler = require("../../../utils/eventFlow/eventFlowHandler.js");
25
+ ;/* empty css */
26
+ ;/* empty css */
27
+ ;/* empty css */
28
+ const _pluginVue_exportHelper = require("../../../../../../_virtual/_plugin-vue_export-helper.js");
29
+ ;/* empty css */
30
+ ;/* empty css */
23
31
  const usePageEvents = require("../../../composables/usePageEvents.js");
24
32
  const index$1 = require("../../details/header/index.js");
25
33
  const index$2 = require("../../details/main/index.js");
26
34
  const index$4 = require("../../details/footer/index.js");
27
35
  const parseFilterConfig = require("../../../utils/parseFilterConfig.js");
28
- const calculate = require("../../../utils/formulajs/calculate.js");
29
36
  const moment = require("../../../../../../node_modules/.pnpm/moment@2.30.1/node_modules/moment/dist/moment.js");
30
- ;/* empty css */
31
- ;/* empty css */
32
37
  ;/* empty css */
33
- const _pluginVue_exportHelper = require("../../../../../../_virtual/_plugin-vue_export-helper.js");
34
38
  const index = require("../../../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/container/index.js");
35
39
  const index$3 = require("../../../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/form/index.js");
36
40
  const gridLayout_vue = require("../../../../../../node_modules/.pnpm/grid-layout-plus@1.1.1_vue@3.5.13_typescript@5.7.3_/node_modules/grid-layout-plus/es/components/grid-layout.vue.js");
@@ -59,9 +63,21 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
59
63
  type: Boolean,
60
64
  default: false
61
65
  },
66
+ isDialog: {
67
+ type: Boolean,
68
+ default: false
69
+ },
62
70
  canPageEvent: {
63
71
  type: Boolean,
64
72
  default: true
73
+ },
74
+ initSearchData: {
75
+ type: Object,
76
+ default: {}
77
+ },
78
+ initFormMode: {
79
+ type: String,
80
+ default: ""
65
81
  }
66
82
  },
67
83
  emits: [
@@ -91,17 +107,19 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
91
107
  const pageEvents = props.canPageEvent ? usePageEvents.usePageEvents(() => ({
92
108
  pageEventConfig: localConfig.value.pageEventConfig,
93
109
  fields: [...fieldsData.value, ...hiddenFields.value],
94
- ctx,
110
+ instance,
95
111
  formData: formData.value,
96
112
  localConfig: localConfig.value,
113
+ initSearchData: props.initSearchData,
97
114
  components: {
98
- form: instance == null ? void 0 : instance.proxy
115
+ form: ctx
99
116
  }
100
117
  })) : null;
101
118
  if (pageEvents) {
102
119
  pageEvents.handleBeforeUnmount();
103
120
  pageEvents.handleUnmounted();
104
121
  }
122
+ const formMode = vue.ref("");
105
123
  const loadConfig = async () => {
106
124
  if (!props.templateKey) {
107
125
  return;
@@ -117,8 +135,13 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
117
135
  emit("loaded", option);
118
136
  rowHeight.value = option.labelPosition == "top" ? 1.5 : 1;
119
137
  localConfig.value = option;
138
+ if (props.initFormMode) {
139
+ formMode.value = props.initFormMode;
140
+ } else {
141
+ formMode.value = option.formMode;
142
+ }
120
143
  fieldsData.value = option.fieldsData.map((item) => {
121
- if (option.formMode == "query") {
144
+ if (formMode.value == "query") {
122
145
  item.component.disabled = true;
123
146
  }
124
147
  return item.component;
@@ -279,10 +302,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
279
302
  handleEvent: createHandleEvent
280
303
  } = eventFlowHandler.useEventFlow({
281
304
  fields: [...fieldsData.value, ...hiddenFields.value],
282
- ctx,
283
- dataSources: localConfig.value.dataSources,
305
+ instance,
306
+ localConfig: localConfig.value,
284
307
  components: {
285
- form: instance == null ? void 0 : instance.proxy
308
+ form: ctx
286
309
  }
287
310
  });
288
311
  handleEvent.value = createHandleEvent;
@@ -327,6 +350,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
327
350
  if (field && formulaText) {
328
351
  const calcResult = calculate.calculate({
329
352
  text: formulaText,
353
+ marks: [],
330
354
  value: formData.value
331
355
  });
332
356
  formData.value[field.fieldName] = calcResult;
@@ -542,15 +566,20 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
542
566
  { deep: true }
543
567
  );
544
568
  vue.provide("formData", formData);
569
+ vue.provide("localConfig", localConfig);
570
+ vue.provide("fieldsData", fieldsData);
571
+ vue.provide("hiddenFields", hiddenFields);
545
572
  vue.provide("rowHeight", rowHeight);
546
573
  vue.provide("gridLayout", gridLayout);
547
574
  vue.provide("gridLayoutFieldsData", gridLayoutFieldsData);
575
+ vue.provide("formCtx", ctx);
548
576
  __expose({
549
577
  validate,
550
578
  resetFields,
551
579
  getFormData,
552
580
  setFormData,
553
- formRef
581
+ formRef,
582
+ localConfig
554
583
  });
555
584
  return (_ctx, _cache) => {
556
585
  const _component_el_form = index$3.ElForm;
@@ -564,7 +593,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
564
593
  "data-version": "v5"
565
594
  }, {
566
595
  default: vue.withCtx(() => [
567
- !configLoading.value && !__props.isSubForm ? (vue.openBlock(), vue.createBlock(vue.unref(index$1.header), {
596
+ !configLoading.value && !__props.isSubForm && !__props.isDialog ? (vue.openBlock(), vue.createBlock(vue.unref(index$1.header), {
568
597
  key: 0,
569
598
  pageHeaderConfig: localConfig.value.pageHeaderConfig
570
599
  }, null, 8, ["pageHeaderConfig"])) : vue.createCommentVNode("", true),
@@ -576,7 +605,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
576
605
  model: formData.value,
577
606
  rules: formRules.value,
578
607
  "label-position": localConfig.value.labelPosition,
579
- style: vue.normalizeStyle({ padding: __props.isSubForm ? "0" : "18px" }),
608
+ style: vue.normalizeStyle({ padding: __props.isSubForm || __props.isDialog ? "0" : "18px" }),
580
609
  "validate-on-rule-change": false
581
610
  }, {
582
611
  default: vue.withCtx(() => [
@@ -600,8 +629,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
600
629
  localConfig: localConfig.value,
601
630
  error: getFieldError(component.fieldName),
602
631
  formRef: formRef.value,
632
+ formMode: formMode.value,
603
633
  onChange: handleFieldChange
604
- }, null, 8, ["modelValue", "onUpdate:modelValue", "config", "localConfig", "error", "formRef"])
634
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "config", "localConfig", "error", "formRef", "formMode"])
605
635
  ]),
606
636
  _: 1
607
637
  }, 8, ["layout", "row-height", "col-num"])) : vue.createCommentVNode("", true),
@@ -619,16 +649,17 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
619
649
  ]),
620
650
  _: 1
621
651
  }),
622
- !__props.isSubForm ? (vue.openBlock(), vue.createBlock(vue.unref(index$4.footer), {
652
+ !__props.isSubForm && !__props.isDialog ? (vue.openBlock(), vue.createBlock(vue.unref(index$4.footer), {
623
653
  key: 1,
654
+ formMode: formMode.value,
624
655
  pageFooterConfig: localConfig.value.pageFooterConfig,
625
656
  onCustomButtonClick: handleCustomButtonClick
626
- }, null, 8, ["pageFooterConfig"])) : vue.createCommentVNode("", true)
657
+ }, null, 8, ["formMode", "pageFooterConfig"])) : vue.createCommentVNode("", true)
627
658
  ]),
628
659
  _: 1
629
660
  }, 8, ["data-id", "data-name", "data-pkId"]);
630
661
  };
631
662
  }
632
663
  });
633
- const _Form = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-caaa182c"]]);
664
+ const _Form = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-5877fafa"]]);
634
665
  exports.default = _Form;