@fecp/designer 5.6.36 → 5.6.38

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 (31) hide show
  1. package/es/designer/package.json.mjs +1 -1
  2. package/es/designer/src/components/DataSourceSelect.vue.mjs +10 -4
  3. package/es/designer/src/packages/dialog/index.vue.mjs +28 -11
  4. package/es/designer/src/packages/dialog/index.vue2.mjs +28 -11
  5. package/es/designer/src/packages/dialog/useDialogDialog.mjs +1 -1
  6. package/es/designer/src/packages/dialogGlobal/index.vue.mjs +28 -11
  7. package/es/designer/src/packages/dialogGlobal/index.vue2.mjs +28 -11
  8. package/es/designer/src/packages/dialogGlobal/useDialogGlobalDialog.mjs +1 -1
  9. package/es/designer/src/packages/form/index.vue.mjs +2 -2
  10. package/es/designer/src/packages/form/property/widgets.vue.mjs +2 -2
  11. package/es/designer/src/packages/utils/common.mjs +17 -0
  12. package/es/designer.css +162 -161
  13. package/es/packages/vue/src/components/forms/formItem/FormItem.vue.mjs +1 -1
  14. package/es/packages/vue/src/components/table/Table.vue.mjs +13 -10
  15. package/es/packages/vue/src/components/table/TableColumn.vue.mjs +55 -2
  16. package/lib/designer/package.json.js +1 -1
  17. package/lib/designer/src/components/DataSourceSelect.vue.js +9 -3
  18. package/lib/designer/src/packages/dialog/index.vue.js +26 -9
  19. package/lib/designer/src/packages/dialog/index.vue2.js +351 -334
  20. package/lib/designer/src/packages/dialog/useDialogDialog.js +1 -1
  21. package/lib/designer/src/packages/dialogGlobal/index.vue.js +26 -9
  22. package/lib/designer/src/packages/dialogGlobal/index.vue2.js +321 -304
  23. package/lib/designer/src/packages/dialogGlobal/useDialogGlobalDialog.js +1 -1
  24. package/lib/designer/src/packages/form/index.vue.js +2 -2
  25. package/lib/designer/src/packages/form/property/widgets.vue.js +2 -2
  26. package/lib/designer/src/packages/utils/common.js +17 -0
  27. package/lib/designer.css +162 -161
  28. package/lib/packages/vue/src/components/forms/formItem/FormItem.vue.js +1 -1
  29. package/lib/packages/vue/src/components/table/Table.vue.js +13 -10
  30. package/lib/packages/vue/src/components/table/TableColumn.vue.js +55 -2
  31. package/package.json +23 -23
@@ -314,7 +314,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
314
314
  };
315
315
  }
316
316
  });
317
- const _FormItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4bbb491d"]]);
317
+ const _FormItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-45b25958"]]);
318
318
  export {
319
319
  _FormItem as default
320
320
  };
@@ -277,13 +277,13 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
277
277
  return total + (isNaN(value) ? 0 : value);
278
278
  }, 0);
279
279
  if (isNaN(sum)) {
280
- footerRow[fieldName] = " ";
280
+ footerRow[fieldName] = "";
281
281
  } else {
282
282
  const field = fieldsData.value.find((f) => f.fieldName == fieldName);
283
- footerRow[fieldName] = formatSummaryValue(sum, field) || " ";
283
+ footerRow[fieldName] = formatSummaryValue(sum, field) ?? "";
284
284
  }
285
285
  } else {
286
- footerRow[fieldName] = " ";
286
+ footerRow[fieldName] = "";
287
287
  }
288
288
  });
289
289
  } else if (mode === "all") {
@@ -293,12 +293,12 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
293
293
  const sum = allSummaryData.value[fieldName];
294
294
  if (sum != void 0 && sum != null) {
295
295
  const field = fieldsData.value.find((f) => f.fieldName == fieldName);
296
- footerRow[fieldName] = formatSummaryValue(sum, field) || " ";
296
+ footerRow[fieldName] = formatSummaryValue(sum, field) ?? "";
297
297
  } else {
298
- footerRow[fieldName] = " ";
298
+ footerRow[fieldName] = "";
299
299
  }
300
300
  } else {
301
- footerRow[fieldName] = " ";
301
+ footerRow[fieldName] = "";
302
302
  }
303
303
  });
304
304
  }
@@ -777,7 +777,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
777
777
  summaryResult[fieldName] = sum;
778
778
  });
779
779
  fieldsData.value.forEach((item) => {
780
- if (!summaryResult[item.fieldName]) {
780
+ if (summaryResult[item.fieldName] === void 0) {
781
781
  summaryResult[item.fieldName] = "";
782
782
  }
783
783
  });
@@ -1108,7 +1108,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
1108
1108
  isDialog: __props.isDialog,
1109
1109
  hiddenFormData: hiddenFormData.value,
1110
1110
  btnRollbackEvent: __props.btnRollbackEvent,
1111
- formatCellValue: formatCellValue$1
1111
+ formatCellValue: formatCellValue$1,
1112
+ "summary-config": summaryConfig.value,
1113
+ "summary-all-data": allSummaryData.value,
1114
+ "format-summary-value": formatSummaryValue
1112
1115
  }, createSlots({ _: 2 }, [
1113
1116
  renderList(fieldsData.value, (field) => {
1114
1117
  return {
@@ -1118,7 +1121,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
1118
1121
  ])
1119
1122
  };
1120
1123
  })
1121
- ]), 1032, ["fields-data", "show-index", "select-mode", "is-opt-btns", "opt-btns", "mode-key", "modes", "data-source-options", "dictionary-options", "localConfig", "table-ref", "table-data", "readonly", "isDialog", "hiddenFormData", "btnRollbackEvent"])
1124
+ ]), 1032, ["fields-data", "show-index", "select-mode", "is-opt-btns", "opt-btns", "mode-key", "modes", "data-source-options", "dictionary-options", "localConfig", "table-ref", "table-data", "readonly", "isDialog", "hiddenFormData", "btnRollbackEvent", "summary-config", "summary-all-data"])
1122
1125
  ];
1123
1126
  }),
1124
1127
  _: 3
@@ -1138,7 +1141,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign({
1138
1141
  };
1139
1142
  }
1140
1143
  });
1141
- const _Table = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-cec18beb"]]);
1144
+ const _Table = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e66cf49b"]]);
1142
1145
  export {
1143
1146
  _Table as default
1144
1147
  };
@@ -115,7 +115,18 @@ const _sfc_main = {
115
115
  type: Object,
116
116
  default: {}
117
117
  },
118
- formatCellValue: Function
118
+ formatCellValue: Function,
119
+ // 合计配置:{ enabled, mode, summaryFields }
120
+ summaryConfig: {
121
+ type: Object,
122
+ default: () => ({})
123
+ },
124
+ // 全量模式的合计结果:{ [fieldName]: sum }
125
+ summaryAllData: {
126
+ type: Object,
127
+ default: () => ({})
128
+ },
129
+ formatSummaryValue: Function
119
130
  },
120
131
  setup(__props) {
121
132
  const props = __props;
@@ -132,6 +143,46 @@ const _sfc_main = {
132
143
  }
133
144
  return fields;
134
145
  });
146
+ const fieldMap = computed(() => {
147
+ const map = {};
148
+ (props.fieldsData || []).forEach((field) => {
149
+ map[field.fieldName] = field;
150
+ });
151
+ return map;
152
+ });
153
+ const exportCellLabel = ({ row, column }) => {
154
+ const field = fieldMap.value[column.field];
155
+ if (!field) return "";
156
+ let label = props.formatCellValue ? props.formatCellValue(row, field) : row[field.fieldName];
157
+ if (label === null || label === void 0) label = "";
158
+ if (typeof label === "string" && label.trim() === "") return "";
159
+ if (field.prefix) label = `${field.prefix}${label}`;
160
+ if (field.suffix) label = `${label}${field.suffix}`;
161
+ return label;
162
+ };
163
+ const footerExportCell = ({ options, column }) => {
164
+ var _a;
165
+ const config = props.summaryConfig || {};
166
+ if (!config.enabled) return "";
167
+ const field = fieldMap.value[column.field];
168
+ if (!field) return "";
169
+ const firstVisible = (props.fieldsData || []).find((item) => item.isShow);
170
+ if (firstVisible && firstVisible.fieldName === field.fieldName) return "合计";
171
+ const summaryFields = config.summaryFields || [];
172
+ if (!summaryFields.includes(field.fieldName)) return "";
173
+ const format = (value) => props.formatSummaryValue ? props.formatSummaryValue(value, field) ?? "" : value;
174
+ if ((options == null ? void 0 : options.mode) !== "all" && config.mode === "all") {
175
+ const sum2 = (_a = props.summaryAllData) == null ? void 0 : _a[field.fieldName];
176
+ if (sum2 === void 0 || sum2 === null) return "";
177
+ return format(sum2);
178
+ }
179
+ const list = (options == null ? void 0 : options.data) || [];
180
+ const sum = list.reduce((total, row) => {
181
+ const value = parseFloat(row == null ? void 0 : row[field.fieldName]);
182
+ return total + (isNaN(value) ? 0 : value);
183
+ }, 0);
184
+ return format(sum);
185
+ };
135
186
  const getColumnWidth = (field) => {
136
187
  if (field.widthMode === "auto") {
137
188
  return void 0;
@@ -270,6 +321,8 @@ const _sfc_main = {
270
321
  "header-align": field.headerAlign,
271
322
  sortable: field.sortRule && field.sortRule != "none",
272
323
  resizable: false,
324
+ "export-method": exportCellLabel,
325
+ "footer-export-method": footerExportCell,
273
326
  "show-header-overflow": "",
274
327
  "show-footer-overflow": "",
275
328
  "show-overflow": field.isOverflowWrap ? false : "tooltip",
@@ -340,7 +393,7 @@ const _sfc_main = {
340
393
  };
341
394
  }
342
395
  };
343
- const TableColumn = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-fac941fe"]]);
396
+ const TableColumn = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b4612c25"]]);
344
397
  export {
345
398
  TableColumn as default
346
399
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const version = "5.6.36";
3
+ const version = "5.6.38";
4
4
  const packageJson = {
5
5
  version
6
6
  };
@@ -25,6 +25,12 @@ const _sfc_main = {
25
25
  teleported: {
26
26
  type: Boolean,
27
27
  default: false
28
+ },
29
+ // 可选的局部数据源(如弹层自定义列表自己的 dataSources)。
30
+ // 传入后与页面头部数据源合并展示,避免 dataSourceId 找不到选项时回显原始值。
31
+ dataSources: {
32
+ type: Array,
33
+ default: null
28
34
  }
29
35
  },
30
36
  emits: ["update:modelValue"],
@@ -36,8 +42,8 @@ const _sfc_main = {
36
42
  set: (val) => emit("update:modelValue", val)
37
43
  });
38
44
  const { dataSourceDialogVisible, openDataSourceDialog, DataSourceDialog } = useDataSourceDialog.useDataSourceDialog();
39
- const dataSources = vue.computed(() => {
40
- return common.getEditConfigDataSources();
45
+ const dataSourceOptions = vue.computed(() => {
46
+ return common.mergeDataSources(common.getEditConfigDataSources(), props.dataSources);
41
47
  });
42
48
  const selectRef = vue.ref(null);
43
49
  const handleAddDataSource = () => {
@@ -75,7 +81,7 @@ const _sfc_main = {
75
81
  }, 8, ["icon"])
76
82
  ]),
77
83
  default: vue.withCtx(() => [
78
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(dataSources), (dataSource) => {
84
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(dataSourceOptions), (dataSource) => {
79
85
  return vue.openBlock(), vue.createBlock(_component_el_option, {
80
86
  key: dataSource.id,
81
87
  label: dataSource.name,
@@ -96,17 +96,31 @@ const _sfc_main = {
96
96
  setup(__props) {
97
97
  const currentInstance = vue.getCurrentInstance();
98
98
  const ctx = currentInstance.proxy;
99
- const editConfigData = vue.computed(() => {
100
- return common.getEditConfigData();
101
- });
102
99
  const dialogVisible = vue.useModel(__props, "modelValue");
103
100
  const selectedDialogs = vue.ref([]);
104
101
  const activeDialogIndex = vue.ref(-1);
102
+ function normalizeDataSourceConfigs(dialogs) {
103
+ const globalDataSources = common.getEditConfigDataSources() || [];
104
+ (dialogs || []).forEach((dialog) => {
105
+ if (dialog.contentSource !== "table" || dialog.tableContent !== "custom") {
106
+ return;
107
+ }
108
+ if (!dialog.customTableConfig) {
109
+ dialog.customTableConfig = common.cloneDeep(_default.defaultTableConfig);
110
+ dialog.customTableConfig.fieldsData = [];
111
+ }
112
+ dialog.customTableConfig.dataSources = common.mergeDataSources(
113
+ globalDataSources,
114
+ dialog.customTableConfig.dataSources
115
+ );
116
+ });
117
+ }
105
118
  vue.watch(dialogVisible, (val) => {
106
119
  if (val) {
107
120
  isEditingNew.value = false;
108
121
  editingDialogIndex.value = -1;
109
122
  selectedDialogs.value = common.cloneDeep(common.getEditConfigDialogs());
123
+ normalizeDataSourceConfigs(selectedDialogs.value);
110
124
  if (selectedDialogs.value.length > 0 && activeDialogIndex.value === -1) {
111
125
  activeDialogIndex.value = 0;
112
126
  }
@@ -178,6 +192,7 @@ const _sfc_main = {
178
192
  }
179
193
  };
180
194
  const onConfirm = () => {
195
+ normalizeDataSourceConfigs(selectedDialogs.value);
181
196
  common.setEditConfigDialogs(selectedDialogs.value);
182
197
  dialogVisible.value = false;
183
198
  };
@@ -191,10 +206,11 @@ const _sfc_main = {
191
206
  if (!data.customTableConfig) {
192
207
  data.customTableConfig = common.cloneDeep(_default.defaultTableConfig);
193
208
  data.customTableConfig.fieldsData = [];
194
- data.customTableConfig.dataSources = editConfigData.value.dataSources;
195
- } else {
196
- data.customTableConfig.dataSources = editConfigData.value.dataSources;
209
+ }
210
+ if (data.customTableConfig.queryConfig) {
197
211
  data.customTableConfig.queryConfig.enabled = false;
212
+ } else {
213
+ data.customTableConfig.queryConfig = { enabled: false };
198
214
  }
199
215
  if ((data == null ? void 0 : data.contentSource) == "table") {
200
216
  const pkId = data == null ? void 0 : data.subTableId;
@@ -761,8 +777,9 @@ const _sfc_main = {
761
777
  default: vue.withCtx(() => [
762
778
  vue.createVNode(DataSourceSelect.default, {
763
779
  modelValue: vue.unref(currentDialog).customTableConfig.dataSourceId,
764
- "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => vue.unref(currentDialog).customTableConfig.dataSourceId = $event)
765
- }, null, 8, ["modelValue"])
780
+ "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => vue.unref(currentDialog).customTableConfig.dataSourceId = $event),
781
+ "data-sources": vue.unref(currentDialog).customTableConfig.dataSources
782
+ }, null, 8, ["modelValue", "data-sources"])
766
783
  ]),
767
784
  _: 1
768
785
  })
@@ -986,5 +1003,5 @@ const _sfc_main = {
986
1003
  };
987
1004
  }
988
1005
  };
989
- const DialogDialog = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-7b357db6"]]);
1006
+ const DialogDialog = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-1c16c4fd"]]);
990
1007
  exports.default = DialogDialog;