@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
@@ -1,4 +1,4 @@
1
- import { shallowRef, watchEffect, readonly, getCurrentScope, onScopeDispose, unref, ref, watch, computed, onMounted, nextTick, isRef, reactive, getCurrentInstance } from "vue";
1
+ import { ref, watch, shallowRef, watchEffect, readonly, getCurrentScope, onScopeDispose, unref, computed, onMounted, nextTick, isRef, reactive, getCurrentInstance } from "vue";
2
2
  function computedEager(fn, options) {
3
3
  var _a;
4
4
  const result = shallowRef();
@@ -23,7 +23,7 @@ import { getEventCode } from "../../../utils/dom/event.mjs";
23
23
  import { EVENT_CODE } from "../../../constants/aria.mjs";
24
24
  import { focusNode, getSibling } from "../../../utils/dom/aria.mjs";
25
25
  import cloneDeep from "../../../../../../../lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.mjs";
26
- import { useDebounceFn, isClient } from "../../../../../../../@vueuse_shared@10.11.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vueuse/shared/index.mjs";
26
+ import { isClient, useDebounceFn } from "../../../../../../../@vueuse_shared@10.11.1_vue@3.5.13_typescript@5.7.3_/node_modules/@vueuse/shared/index.mjs";
27
27
  const _hoisted_1 = ["placeholder"];
28
28
  const _hoisted_2 = ["onClick"];
29
29
  var _sfc_main = /* @__PURE__ */ defineComponent({
@@ -1,18 +1,18 @@
1
1
  import _sfc_main$4 from "./src/container.vue2.mjs";
2
2
  import _sfc_main$3 from "./src/aside.vue2.mjs";
3
- import _sfc_main$2 from "./src/footer.vue2.mjs";
4
- import _sfc_main$1 from "./src/header.vue2.mjs";
3
+ import _sfc_main$1 from "./src/footer.vue2.mjs";
4
+ import _sfc_main$2 from "./src/header.vue2.mjs";
5
5
  import _sfc_main from "./src/main.vue2.mjs";
6
6
  import { withInstall, withNoopInstall } from "../../utils/vue/install.mjs";
7
7
  const ElContainer = withInstall(_sfc_main$4, {
8
8
  Aside: _sfc_main$3,
9
- Footer: _sfc_main$2,
10
- Header: _sfc_main$1,
9
+ Footer: _sfc_main$1,
10
+ Header: _sfc_main$2,
11
11
  Main: _sfc_main
12
12
  });
13
13
  const ElAside = withNoopInstall(_sfc_main$3);
14
- const ElFooter = withNoopInstall(_sfc_main$2);
15
- const ElHeader = withNoopInstall(_sfc_main$1);
14
+ const ElFooter = withNoopInstall(_sfc_main$1);
15
+ const ElHeader = withNoopInstall(_sfc_main$2);
16
16
  const ElMain = withNoopInstall(_sfc_main);
17
17
  export {
18
18
  ElAside,
@@ -1,4 +1,4 @@
1
- import { inject, computed, unref, ref } from "vue";
1
+ import { ref, inject, computed, unref } from "vue";
2
2
  import { useGlobalSize } from "../../../../hooks/use-size/index.mjs";
3
3
  import { useProp } from "../../../../hooks/use-prop/index.mjs";
4
4
  import { formContextKey, formItemContextKey } from "../constants.mjs";
@@ -10,7 +10,7 @@ import { useFocusController } from "../../../hooks/use-focus-controller/index.mj
10
10
  import { useFormItem, useFormItemInputId } from "../../form/src/hooks/use-form-item.mjs";
11
11
  import { ValidateComponentsMap } from "../../../utils/vue/icon.mjs";
12
12
  import { useComposition } from "../../../hooks/use-composition/index.mjs";
13
- import { INPUT_EVENT, UPDATE_MODEL_EVENT, CHANGE_EVENT } from "../../../constants/event.mjs";
13
+ import { UPDATE_MODEL_EVENT, CHANGE_EVENT, INPUT_EVENT } from "../../../constants/event.mjs";
14
14
  import { useCursor } from "../../../hooks/use-cursor/index.mjs";
15
15
  import { useNamespace } from "../../../hooks/use-namespace/index.mjs";
16
16
  import { debugWarn } from "../../../utils/error.mjs";
@@ -6,13 +6,13 @@
6
6
  /* empty css */
7
7
  /* empty css */
8
8
  import { createBlock, openBlock, withCtx, createVNode, renderSlot } from "vue";
9
+ /* empty css */
10
+ import _export_sfc from "../../../../../../_virtual/_plugin-vue_export-helper.mjs";
9
11
  /* empty css */
10
12
  /* empty css */
11
13
  /* empty css */
12
14
  /* empty css */
13
15
  /* empty css */
14
- /* empty css */
15
- import _export_sfc from "../../../../../../_virtual/_plugin-vue_export-helper.mjs";
16
16
  import { SwipeCell } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/swipe-cell/index.mjs";
17
17
  import { showConfirmDialog } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/dialog/function-call.mjs";
18
18
  import "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/dialog/index.mjs";
@@ -4,7 +4,7 @@ import zhCn from "../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typesc
4
4
  import "../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/index.mjs";
5
5
  import * as components from "../../node_modules/.pnpm/vxe-pc-ui@4.12.28_vue@3.5.13_typescript@5.7.3_/node_modules/vxe-pc-ui/es/components.mjs";
6
6
  /* empty css */
7
- /* empty css */
7
+ /* empty css */
8
8
  import installer from "../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/defaults.mjs";
9
9
  import { Table } from "./src/components/table/index.mjs";
10
10
  import { Form } from "./src/components/forms/form/index.mjs";
@@ -15,6 +15,10 @@ const _sfc_main = {
15
15
  default: () => ({
16
16
  buttons: []
17
17
  })
18
+ },
19
+ formMode: {
20
+ type: String,
21
+ default: ""
18
22
  }
19
23
  },
20
24
  emits: ["cancel", "submit", "custom-button-click"],
@@ -33,16 +37,20 @@ const _sfc_main = {
33
37
  }, {
34
38
  default: withCtx(() => [
35
39
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.pageFooterConfig.actions, (button) => {
36
- return openBlock(), createBlock(_component_el_button, {
37
- key: button.id,
38
- type: button.btnStyle,
39
- onClick: ($event) => handleButtonClick(button)
40
- }, {
41
- default: withCtx(() => [
42
- createTextVNode(toDisplayString(button.label), 1)
43
- ]),
44
- _: 2
45
- }, 1032, ["type", "onClick"]);
40
+ return openBlock(), createElementBlock(Fragment, {
41
+ key: button.id
42
+ }, [
43
+ button.btnType == "default" || button.btnType == "primary" && __props.formMode == "edit" ? (openBlock(), createBlock(_component_el_button, {
44
+ key: 0,
45
+ type: button.btnType,
46
+ onClick: ($event) => handleButtonClick(button)
47
+ }, {
48
+ default: withCtx(() => [
49
+ createTextVNode(toDisplayString(button.label), 1)
50
+ ]),
51
+ _: 2
52
+ }, 1032, ["type", "onClick"])) : createCommentVNode("", true)
53
+ ], 64);
46
54
  }), 128))
47
55
  ]),
48
56
  _: 1
@@ -50,7 +58,7 @@ const _sfc_main = {
50
58
  };
51
59
  }
52
60
  };
53
- const component = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-342df1dc"]]);
61
+ const component = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-7ee68be0"]]);
54
62
  export {
55
63
  component as default
56
64
  };
@@ -0,0 +1,403 @@
1
+ /* empty css */
2
+ /* empty css */
3
+ /* empty css */
4
+ /* empty css */
5
+ import { ref, computed, watch, createBlock, openBlock, withCtx, createElementVNode, normalizeStyle, normalizeClass, createElementBlock, Fragment, createCommentVNode, unref, resolveDynamicComponent, toDisplayString, createVNode, createTextVNode, renderList, defineAsyncComponent } from "vue";
6
+ import { Table } from "../table/index.mjs";
7
+ import { Form } from "../forms/form/index.mjs";
8
+ import { parseRouteParams } from "../../utils/parseRouteParams.mjs";
9
+ import { calculate } from "../../utils/formulajs/calculate.mjs";
10
+ import { useEventFlow, executeEventFlow } from "../../utils/eventFlow/eventFlowHandler.mjs";
11
+ /* empty css */
12
+ /* empty css */
13
+ /* empty css */
14
+ /* empty css */
15
+ import _export_sfc from "../../../../../_virtual/_plugin-vue_export-helper.mjs";
16
+ /* empty css */
17
+ /* empty css */
18
+ import { ElDialog } from "../../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/dialog/index.mjs";
19
+ import { ElButton } from "../../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/button/index.mjs";
20
+ import { ElMessage } from "../../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.13_typescript@5.7.3_/node_modules/element-plus/es/components/message/index.mjs";
21
+ const _hoisted_1 = { class: "dialog-header-content" };
22
+ const _hoisted_2 = {
23
+ key: 1,
24
+ class: "component-error"
25
+ };
26
+ const _hoisted_3 = {
27
+ key: 3,
28
+ class: "empty-content"
29
+ };
30
+ const _sfc_main = {
31
+ __name: "DialogRenderer",
32
+ props: {
33
+ // 弹层配置
34
+ dialogConfig: {
35
+ type: Object,
36
+ required: true
37
+ },
38
+ // 是否显示
39
+ modelValue: {
40
+ type: Boolean,
41
+ default: false
42
+ },
43
+ fieldsList: {
44
+ type: Array,
45
+ default: []
46
+ },
47
+ formData: {
48
+ type: Object,
49
+ default: {}
50
+ },
51
+ displayField: {
52
+ type: String,
53
+ default: ""
54
+ },
55
+ componentCtx: {
56
+ type: Object,
57
+ default: {}
58
+ },
59
+ instance: {
60
+ type: Object,
61
+ default: {}
62
+ }
63
+ },
64
+ emits: [
65
+ "update:modelValue",
66
+ "confirm",
67
+ "cancel",
68
+ "selection-change",
69
+ "form-submit"
70
+ ],
71
+ setup(__props, { expose: __expose, emit: __emit }) {
72
+ const props = __props;
73
+ const emit = __emit;
74
+ const dialogVisible = ref(false);
75
+ const tableSelectionRows = ref([]);
76
+ ref(null);
77
+ const currentDialogConfig = computed(() => props.dialogConfig);
78
+ const dialogWidth = computed(() => {
79
+ var _a, _b;
80
+ const size = ((_a = currentDialogConfig.value) == null ? void 0 : _a.dialogSize) || "standard";
81
+ const sizeMap = {
82
+ standard: "50%",
83
+ small: "30%",
84
+ large: "70%"
85
+ };
86
+ if (size === "custom") {
87
+ return ((_b = currentDialogConfig.value) == null ? void 0 : _b.customWidth) || "50%";
88
+ }
89
+ return sizeMap[size] || "50%";
90
+ });
91
+ const contentStyle = computed(() => {
92
+ var _a, _b;
93
+ const size = (_a = currentDialogConfig.value) == null ? void 0 : _a.dialogSize;
94
+ if (size === "custom" && ((_b = currentDialogConfig.value) == null ? void 0 : _b.customMaxHeight)) {
95
+ return {
96
+ maxHeight: currentDialogConfig.value.customMaxHeight,
97
+ overflow: "auto"
98
+ };
99
+ }
100
+ return {};
101
+ });
102
+ computed(() => {
103
+ var _a;
104
+ const configParams = ((_a = currentDialogConfig.value) == null ? void 0 : _a.dialogParams) || [];
105
+ const paramsObj = {};
106
+ configParams.forEach((param) => {
107
+ paramsObj[param.paramName] = param.paramValue;
108
+ });
109
+ return { ...paramsObj };
110
+ });
111
+ watch(
112
+ () => {
113
+ return props.modelValue;
114
+ },
115
+ (val) => {
116
+ dialogVisible.value = val;
117
+ },
118
+ {
119
+ immediate: true
120
+ }
121
+ );
122
+ watch(dialogVisible, (val) => {
123
+ emit("update:modelValue", val);
124
+ });
125
+ const loadComponent = (path) => {
126
+ if (!path) return null;
127
+ try {
128
+ const component = defineAsyncComponent(
129
+ () => import(
130
+ /* @vite-ignore */
131
+ path
132
+ )
133
+ );
134
+ return component;
135
+ } catch (error) {
136
+ console.error("组件加载失败:", error);
137
+ return null;
138
+ }
139
+ };
140
+ const handleSubmit = (data) => {
141
+ emit("confirm", data);
142
+ };
143
+ const handleClose = () => {
144
+ dialogVisible.value = false;
145
+ };
146
+ const dialogTableRef = ref();
147
+ const handleConfirm = () => {
148
+ var _a, _b, _c, _d, _e;
149
+ const contentSource = (_a = currentDialogConfig.value) == null ? void 0 : _a.contentSource;
150
+ if (contentSource === "table") {
151
+ if (tableSelectionRows.value.length == 0) {
152
+ ElMessage.error("数据未选择,请选择");
153
+ return;
154
+ }
155
+ const formData = {};
156
+ const displayFormat = currentDialogConfig.value.displayFormat;
157
+ const displayValues = tableSelectionRows.value.map((row) => {
158
+ const calcResult = calculate({
159
+ text: displayFormat == null ? void 0 : displayFormat.text,
160
+ marks: [],
161
+ value: row
162
+ });
163
+ return calcResult;
164
+ });
165
+ if (props.displayField) {
166
+ formData[props.displayField] = displayValues.join(",");
167
+ } else {
168
+ console.log("未配置参数字段: displayField");
169
+ }
170
+ const fieldMapping = currentDialogConfig.value.fieldMapping;
171
+ if ((fieldMapping == null ? void 0 : fieldMapping.length) > 0) {
172
+ fieldMapping.forEach((item) => {
173
+ const field = props.fieldsList.find((field2) => field2.id === item.field);
174
+ if (field) {
175
+ const values = tableSelectionRows.value.map((row) => row[item.value]);
176
+ formData[field.fieldName] = values.join("|");
177
+ }
178
+ });
179
+ }
180
+ if (Object.keys(formData).length > 0) {
181
+ (_d = (_c = (_b = props.componentCtx) == null ? void 0 : _b.$) == null ? void 0 : _c.exposed) == null ? void 0 : _d.setFormData(formData);
182
+ }
183
+ const callbackEventConfig = currentDialogConfig.value.callbackEventConfig;
184
+ if (callbackEventConfig && ((_e = callbackEventConfig == null ? void 0 : callbackEventConfig.next) == null ? void 0 : _e.id) != "end") {
185
+ const fieldsData = dialogTableRef.value.localConfig.fieldsData;
186
+ executeEventFlow({
187
+ eventFlow: callbackEventConfig,
188
+ fields: fieldsData,
189
+ instance: props.instance,
190
+ localConfig: dialogTableRef.value.localConfig || {},
191
+ components: {
192
+ table: {
193
+ $: {
194
+ exposed: dialogTableRef.value
195
+ }
196
+ }
197
+ },
198
+ row: {},
199
+ item: {}
200
+ });
201
+ }
202
+ emit("confirm", tableSelectionRows.value);
203
+ } else {
204
+ emit("confirm");
205
+ }
206
+ dialogVisible.value = false;
207
+ };
208
+ const handleCancel = () => {
209
+ emit("cancel");
210
+ dialogVisible.value = false;
211
+ };
212
+ const initDialogParams = computed(() => {
213
+ var _a;
214
+ if (((_a = currentDialogConfig.value.dialogParams) == null ? void 0 : _a.length) > 0) {
215
+ const params = parseRouteParams(
216
+ currentDialogConfig.value.dialogParams,
217
+ props.formData,
218
+ props.fieldsList
219
+ );
220
+ return params;
221
+ }
222
+ return {};
223
+ });
224
+ __expose({
225
+ // 打开弹层
226
+ open: (params = {}) => {
227
+ dialogVisible.value = true;
228
+ },
229
+ // 关闭弹层
230
+ close: () => {
231
+ dialogVisible.value = false;
232
+ }
233
+ // // 获取当前选中的数据(列表模式)
234
+ // getSelection: () => {
235
+ // return tableRendererRef.value?.getSelection?.();
236
+ // },
237
+ // // 获取表单数据(表单模式)
238
+ // getFormData: () => {
239
+ // return formRendererRef.value?.getFormData?.();
240
+ // },
241
+ // // 重置表单(表单模式)
242
+ // resetForm: () => {
243
+ // formRendererRef.value?.resetForm?.();
244
+ // },
245
+ });
246
+ function tableSelectionChange(selectionRows) {
247
+ tableSelectionRows.value = selectionRows;
248
+ }
249
+ const subFormOption = ref({});
250
+ const handleEvent = ref(null);
251
+ const dialogFormRef = ref();
252
+ function subFormLoaded(subOption) {
253
+ subFormOption.value = subOption;
254
+ const fieldsData = subFormOption.value.fieldsData.map((item) => {
255
+ return item.component;
256
+ });
257
+ const hiddenFields = subFormOption.value.hiddenFields;
258
+ const { handleEvent: createHandleEvent } = useEventFlow({
259
+ fields: [...fieldsData, ...hiddenFields],
260
+ instance: props.instance,
261
+ localConfig: subFormOption.value || {},
262
+ components: {
263
+ form: {
264
+ $: {
265
+ exposed: dialogFormRef.value
266
+ }
267
+ }
268
+ },
269
+ onSuccess: (result, row, item) => {
270
+ dialogVisible.value = false;
271
+ },
272
+ onError: (error, row, item) => {
273
+ }
274
+ });
275
+ handleEvent.value = createHandleEvent;
276
+ }
277
+ const subFormFooterBtns = computed(() => {
278
+ const btnArr = [];
279
+ currentDialogConfig.value.subFormFooterButtons.forEach((btnId) => {
280
+ var _a, _b;
281
+ const btn = (_b = (_a = subFormOption.value) == null ? void 0 : _a.pageFooterConfig) == null ? void 0 : _b.actions.find(
282
+ (btn2) => btn2.id == btnId
283
+ );
284
+ if (btn) {
285
+ btnArr.push(btn);
286
+ }
287
+ });
288
+ return btnArr;
289
+ });
290
+ function formFooterClick(button) {
291
+ var _a;
292
+ const formData = dialogFormRef.value.getFormData();
293
+ handleEvent.value(
294
+ formData,
295
+ button,
296
+ (_a = button.eventConfig) == null ? void 0 : _a.find((item) => item.name == "Click")
297
+ );
298
+ }
299
+ return (_ctx, _cache) => {
300
+ const _component_el_button = ElButton;
301
+ const _component_el_dialog = ElDialog;
302
+ return openBlock(), createBlock(_component_el_dialog, {
303
+ modelValue: dialogVisible.value,
304
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => dialogVisible.value = $event),
305
+ width: dialogWidth.value,
306
+ draggable: true,
307
+ "close-on-click-modal": false,
308
+ "append-to-body": "",
309
+ class: "fec-dialog-renderer"
310
+ }, {
311
+ header: withCtx(() => {
312
+ var _a;
313
+ return [
314
+ createElementVNode("div", _hoisted_1, [
315
+ createElementVNode("span", null, toDisplayString(((_a = currentDialogConfig.value) == null ? void 0 : _a.dialogTitle) || "弹层"), 1)
316
+ ])
317
+ ];
318
+ }),
319
+ footer: withCtx(() => {
320
+ var _a, _b, _c;
321
+ return [
322
+ createVNode(_component_el_button, { onClick: handleCancel }, {
323
+ default: withCtx(() => _cache[1] || (_cache[1] = [
324
+ createTextVNode("取消")
325
+ ])),
326
+ _: 1
327
+ }),
328
+ ((_a = __props.dialogConfig) == null ? void 0 : _a.contentSource) === "table" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
329
+ !__props.dialogConfig.isSubTableReadOnly ? (openBlock(), createBlock(_component_el_button, {
330
+ key: 0,
331
+ type: "primary",
332
+ onClick: handleConfirm
333
+ }, {
334
+ default: withCtx(() => _cache[2] || (_cache[2] = [
335
+ createTextVNode("确定")
336
+ ])),
337
+ _: 1
338
+ })) : createCommentVNode("", true)
339
+ ], 64)) : createCommentVNode("", true),
340
+ ((_b = __props.dialogConfig) == null ? void 0 : _b.contentSource) === "form" && ((_c = __props.dialogConfig) == null ? void 0 : _c.subFormMode) != "query" ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(subFormFooterBtns.value, (btn) => {
341
+ return openBlock(), createBlock(_component_el_button, {
342
+ key: btn.id,
343
+ type: "primary",
344
+ onClick: ($event) => formFooterClick(btn)
345
+ }, {
346
+ default: withCtx(() => [
347
+ createTextVNode(toDisplayString(btn.label), 1)
348
+ ]),
349
+ _: 2
350
+ }, 1032, ["onClick"]);
351
+ }), 128)) : createCommentVNode("", true)
352
+ ];
353
+ }),
354
+ default: withCtx(() => {
355
+ var _a, _b, _c, _d, _e;
356
+ return [
357
+ createElementVNode("div", {
358
+ class: normalizeClass(["dialog-content-wrapper", "fec-dialog-" + ((_a = __props.dialogConfig) == null ? void 0 : _a.contentSource)]),
359
+ style: normalizeStyle(contentStyle.value)
360
+ }, [
361
+ ((_b = __props.dialogConfig) == null ? void 0 : _b.contentSource) === "table" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
362
+ __props.dialogConfig.tableContent === "select" ? (openBlock(), createBlock(unref(Table), {
363
+ key: 0,
364
+ templateKey: __props.dialogConfig.subTableKey,
365
+ mode: __props.dialogConfig.subTableMode,
366
+ isDialog: "",
367
+ hasPagination: __props.dialogConfig.isSubTablePagination,
368
+ initSearchData: initDialogParams.value,
369
+ readonly: __props.dialogConfig.isSubTableReadOnly,
370
+ selectMode: __props.dialogConfig.selectionMode,
371
+ onSelectionChange: tableSelectionChange,
372
+ ref_key: "dialogTableRef",
373
+ ref: dialogTableRef
374
+ }, null, 8, ["templateKey", "mode", "hasPagination", "initSearchData", "readonly", "selectMode"])) : __props.dialogConfig.tableContent === "custom" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [], 64)) : createCommentVNode("", true)
375
+ ], 64)) : ((_c = __props.dialogConfig) == null ? void 0 : _c.contentSource) === "form" ? (openBlock(), createBlock(unref(Form), {
376
+ key: 1,
377
+ templateKey: __props.dialogConfig.subFormKey,
378
+ isDialog: "",
379
+ initSearchData: initDialogParams.value,
380
+ onLoaded: subFormLoaded,
381
+ initFormMode: __props.dialogConfig.subFormMode,
382
+ ref_key: "dialogFormRef",
383
+ ref: dialogFormRef
384
+ }, null, 8, ["templateKey", "initSearchData", "initFormMode"])) : ((_d = __props.dialogConfig) == null ? void 0 : _d.contentSource) === "component" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
385
+ loadComponent(__props.dialogConfig.componentPath) ? (openBlock(), createBlock(resolveDynamicComponent(loadComponent(__props.dialogConfig.componentPath)), {
386
+ key: 0,
387
+ "dialog-params": __props.dialogConfig.dialogParams,
388
+ onClose: handleClose,
389
+ onSubmit: handleSubmit
390
+ }, null, 40, ["dialog-params"])) : (openBlock(), createElementBlock("div", _hoisted_2, " 组件加载失败,请检查组件路径: " + toDisplayString((_e = __props.dialogConfig) == null ? void 0 : _e.componentPath), 1))
391
+ ], 64)) : (openBlock(), createElementBlock("div", _hoisted_3, "请配置弹层内容"))
392
+ ], 6)
393
+ ];
394
+ }),
395
+ _: 1
396
+ }, 8, ["modelValue", "width"]);
397
+ };
398
+ }
399
+ };
400
+ const DialogRenderer = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-7a29ddee"]]);
401
+ export {
402
+ DialogRenderer as default
403
+ };
@@ -0,0 +1,68 @@
1
+ import { createVNode, render } from "vue";
2
+ import DialogRenderer from "./DialogRenderer.vue2.mjs";
3
+ let currentDialogInstance = null;
4
+ let isCleaningUp = false;
5
+ const cleanupDialog = () => {
6
+ if (isCleaningUp) return;
7
+ isCleaningUp = true;
8
+ setTimeout(() => {
9
+ var _a;
10
+ try {
11
+ if ((_a = currentDialogInstance == null ? void 0 : currentDialogInstance.container) == null ? void 0 : _a.parentNode) {
12
+ currentDialogInstance.container.parentNode.removeChild(currentDialogInstance.container);
13
+ }
14
+ if (currentDialogInstance == null ? void 0 : currentDialogInstance.vnode) {
15
+ render(null, currentDialogInstance.container);
16
+ }
17
+ currentDialogInstance = null;
18
+ } catch (error) {
19
+ console.error("Dialog cleanup error:", error);
20
+ } finally {
21
+ isCleaningUp = false;
22
+ }
23
+ }, 300);
24
+ };
25
+ function openDialog(displayField, dialogConfig, instance, componentCtx, fieldsList, formData) {
26
+ return new Promise((resolve, reject) => {
27
+ if (currentDialogInstance) {
28
+ closeDialog();
29
+ }
30
+ const container = document.createElement("div");
31
+ document.body.appendChild(container);
32
+ const vnode = createVNode(DialogRenderer, {
33
+ dialogConfig,
34
+ modelValue: true,
35
+ fieldsList,
36
+ formData,
37
+ displayField,
38
+ componentCtx,
39
+ instance,
40
+ "onUpdate:modelValue": (val) => {
41
+ if (!val) {
42
+ cleanupDialog();
43
+ }
44
+ },
45
+ onConfirm: (data) => {
46
+ resolve(data);
47
+ cleanupDialog();
48
+ },
49
+ onCancel: () => {
50
+ reject(new Error("用户取消"));
51
+ cleanupDialog();
52
+ }
53
+ });
54
+ vnode.appContext = instance.appContext;
55
+ render(vnode, container);
56
+ currentDialogInstance = { vnode, container };
57
+ });
58
+ }
59
+ function closeDialog() {
60
+ var _a, _b, _c;
61
+ 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) {
62
+ currentDialogInstance.vnode.component.ctx.dialogVisible.value = false;
63
+ }
64
+ }
65
+ export {
66
+ closeDialog,
67
+ openDialog
68
+ };