super-page-runtime 2.1.48 → 2.1.50-temp1

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/dist/es/components/runtime/utils/api/api-util.d.ts +1 -18
  2. package/dist/es/components/runtime/utils/api/api-util.js +2 -306
  3. package/dist/es/components/runtime/utils/api/page-expose-util.js +8 -1
  4. package/dist/es/components/runtime/utils/charts/chart-columnline-util.js +5 -1
  5. package/dist/es/components/runtime/utils/events/standard-event.d.ts +11 -1
  6. package/dist/es/components/runtime/utils/events/standard-event.js +333 -36
  7. package/dist/es/components/runtime/utils/events/validator-util.js +5 -25
  8. package/dist/es/components/runtime/utils/page-helper-util.d.ts +3 -1
  9. package/dist/es/components/runtime/utils/page-helper-util.js +22 -4
  10. package/dist/es/components/runtime/utils/page-init-util.js +1 -2
  11. package/dist/es/components/runtime/views/assemblys/button/button/button-runtime.vue2.js +4 -1
  12. package/dist/es/components/runtime/views/assemblys/chart/column-line/column-line-runtime.vue2.js +3 -2
  13. package/dist/es/components/runtime/views/assemblys/chart/table/chart-table-util.js +491 -0
  14. package/dist/es/components/runtime/views/assemblys/chart/table/group-column-item.vue.js +44 -0
  15. package/dist/es/components/runtime/views/assemblys/chart/table/group-column-item.vue2.js +4 -0
  16. package/dist/es/components/runtime/views/assemblys/chart/table/group-column.vue.js +64 -0
  17. package/dist/es/components/runtime/views/assemblys/chart/table/group-column.vue2.js +4 -0
  18. package/dist/es/components/runtime/views/assemblys/chart/table/normal-column.vue.js +247 -0
  19. package/dist/es/components/runtime/views/assemblys/chart/table/normal-column.vue2.js +4 -0
  20. package/dist/es/components/runtime/views/assemblys/chart/table/table-runtime.vue2.js +318 -34
  21. package/dist/es/components/runtime/views/assemblys/container/tools/tools-runtime.vue2.js +1 -0
  22. package/dist/es/components/runtime/views/assemblys/data/table/main-table-runtime.vue.js +46 -14
  23. package/dist/es/components/runtime/views/assemblys/data/table/sub-table-runtime.vue.js +28 -4
  24. package/dist/es/components/runtime/views/assemblys/form/input-text/inputtext-runtime.vue2.js +3 -1
  25. package/dist/es/components/runtime/views/assemblys/form/placeholder/placeholder-runtime.vue.js +1 -1
  26. package/dist/es/components/runtime/views/assemblys/form/select/select-runtime.vue2.js +4 -1
  27. package/dist/es/components/runtime/views/super-page-dialog.vue.d.ts +4 -0
  28. package/dist/es/components/runtime/views/super-page-dialog.vue.js +5 -1
  29. package/dist/es/components/runtime/views/super-page.vue.js +4 -4
  30. package/package.json +2 -2
  31. package/dist/es/components/runtime/views/assemblys/form/placeholder/placeholder-runtime.vue3.js +0 -1
@@ -0,0 +1,247 @@
1
+ import { defineComponent, ref, resolveComponent, openBlock, createBlock, withCtx, createElementBlock, Fragment, createTextVNode, toDisplayString, resolveDynamicComponent, createVNode, normalizeClass, createCommentVNode, createElementVNode } from "vue";
2
+ import { getCustomFunc } from "../../../../utils/events/event-util.js";
3
+ import eventBus from "../../../../utils/eventBus.js";
4
+ import { ExpressionEvaluator } from "./chart-table-util.js";
5
+ const _hoisted_1 = { key: 0 };
6
+ const _hoisted_2 = { key: 1 };
7
+ const _hoisted_3 = { key: 3 };
8
+ const _hoisted_4 = { key: 2 };
9
+ const _sfc_main = /* @__PURE__ */ defineComponent({
10
+ __name: "normal-column",
11
+ props: {
12
+ configure: {
13
+ type: Object,
14
+ default: () => {
15
+ return {};
16
+ }
17
+ },
18
+ pageContext: {
19
+ type: Object,
20
+ default: () => {
21
+ return {};
22
+ }
23
+ },
24
+ column: {
25
+ type: Object,
26
+ default: () => {
27
+ return {};
28
+ }
29
+ }
30
+ },
31
+ setup(__props) {
32
+ const props = __props;
33
+ const resloveLinkText = ref(false);
34
+ let toPage = null;
35
+ if (props.column.linkPage && props.column.linkPage.length > 0) {
36
+ resloveLinkText.value = true;
37
+ }
38
+ function formatter(row, column, cellValue, index) {
39
+ console.log("formatter", row);
40
+ }
41
+ function showLink(row) {
42
+ var _a;
43
+ const show = (_a = props.column.linkPage) == null ? void 0 : _a.some((item) => {
44
+ let canShow = false;
45
+ if (item.scopeFunc) {
46
+ const func = getCustomFunc(props.pageContext, item.scopeFunc);
47
+ if (func) {
48
+ const result = func.apply(func, [
49
+ {
50
+ pageContext: props.pageContext,
51
+ configureObj: props.configure,
52
+ row
53
+ }
54
+ ]);
55
+ if (result) {
56
+ canShow = true;
57
+ }
58
+ }
59
+ } else if (item.showCondition && item.showCondition.length > 0) {
60
+ const result = ExpressionEvaluator.evaluate(props.pageContext, item.showCondition, row);
61
+ if (result) {
62
+ canShow = true;
63
+ }
64
+ } else {
65
+ canShow = true;
66
+ }
67
+ if (canShow) {
68
+ toPage = item;
69
+ return true;
70
+ }
71
+ });
72
+ return show;
73
+ }
74
+ function clickLink(row) {
75
+ if (toPage) {
76
+ const myPageCode = props.pageContext.code;
77
+ const eventPageInfo = myPageCode + "_";
78
+ const linkPage = JSON.parse(JSON.stringify(toPage));
79
+ linkPage.base = {
80
+ successOperation: "closeWindow"
81
+ };
82
+ const eventParams = {
83
+ id: row.id ? row["id"] : row["ID"],
84
+ selections: [row]
85
+ };
86
+ eventBus.$emit(eventPageInfo + "open-dialog", {
87
+ pageContext: props.pageContext,
88
+ configureObj: { props: linkPage },
89
+ eventParams
90
+ });
91
+ }
92
+ }
93
+ function formatContent(row, format) {
94
+ console.log("formatContent", row, format);
95
+ const value = row[props.column.props.base.prop];
96
+ switch (format.type) {
97
+ case "number":
98
+ return formatNumber(value, format);
99
+ case "currency":
100
+ return formatCurrency(value, format);
101
+ case "percent":
102
+ return formatPercent(value, format);
103
+ case "custom":
104
+ return formatCustomFunc(row, format);
105
+ default:
106
+ return value;
107
+ }
108
+ }
109
+ function formatNumber(value, format) {
110
+ let formattedValue = value;
111
+ if (!formattedValue) {
112
+ formattedValue = 0;
113
+ }
114
+ if (format.scientific) {
115
+ formattedValue = Number(value).toExponential(format.scientificNum);
116
+ }
117
+ if (format.decimalDigit) {
118
+ formattedValue = Number(value).toFixed(format.decimalDigit);
119
+ }
120
+ if (format.thousandsSeparator) {
121
+ formattedValue = formattedValue.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
122
+ }
123
+ if (format.symbol) {
124
+ formattedValue = `${format.symbol} ${formattedValue}`;
125
+ }
126
+ return formattedValue;
127
+ }
128
+ function formatCurrency(value, format) {
129
+ let formattedValue = value;
130
+ if (!formattedValue) {
131
+ formattedValue = 0;
132
+ }
133
+ if (format.decimalDigit) {
134
+ formattedValue = Number(value).toFixed(format.decimalDigit);
135
+ }
136
+ if (format.symbol) {
137
+ formattedValue = `${format.symbol} ${formattedValue}`;
138
+ }
139
+ return formattedValue;
140
+ }
141
+ function formatPercent(value, format) {
142
+ let formattedValue = value;
143
+ if (!formattedValue) {
144
+ formattedValue = 0;
145
+ }
146
+ if (format.decimalDigit) {
147
+ formattedValue = Number(value).toFixed(format.decimalDigit);
148
+ }
149
+ return formattedValue + " %";
150
+ }
151
+ function formatCustomFunc(row, format) {
152
+ const func = getCustomFunc(props.pageContext, format.customFunc);
153
+ if (func) {
154
+ const resultValue = func.apply(func, [
155
+ {
156
+ pageContext: props.pageContext,
157
+ configureObj: props.configure,
158
+ row,
159
+ prop: props.column.props.base.prop
160
+ }
161
+ ]);
162
+ return resultValue;
163
+ }
164
+ }
165
+ return (_ctx, _cache) => {
166
+ const _component_el_table_column = resolveComponent("el-table-column");
167
+ const _component_el_progress = resolveComponent("el-progress");
168
+ const _component_el_tag = resolveComponent("el-tag");
169
+ const _component_el_link = resolveComponent("el-link");
170
+ return __props.column.props.base.prop === "$index" ? (openBlock(), createBlock(_component_el_table_column, {
171
+ key: 0,
172
+ label: __props.column.props.base.name,
173
+ type: "index",
174
+ align: "center",
175
+ "header-align": "center",
176
+ width: "80"
177
+ }, null, 8, ["label"])) : (openBlock(), createBlock(_component_el_table_column, {
178
+ key: 1,
179
+ prop: __props.column.props.base.prop,
180
+ width: __props.column.props.base.width ? __props.column.props.base.width : "",
181
+ label: __props.column.props.base.name,
182
+ "header-align": __props.column.props.base.headerAlign,
183
+ align: __props.column.props.base.align,
184
+ fixed: __props.column.props.base.fixed ? __props.column.props.base.fixed : false,
185
+ formatter
186
+ }, {
187
+ default: withCtx((scope) => [
188
+ __props.column.props.format && __props.column.props.format.type ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
189
+ createTextVNode(toDisplayString(__props.column.props.format.status) + " ", 1),
190
+ __props.column.props.format.type === "customControl" ? (openBlock(), createBlock(resolveDynamicComponent(__props.column.props.format.customControl), {
191
+ key: 0,
192
+ scope,
193
+ column: __props.column,
194
+ configure: __props.configure,
195
+ pageContext: __props.pageContext
196
+ }, null, 8, ["scope", "column", "configure", "pageContext"])) : __props.column.props.format.type === "progress" ? (openBlock(), createBlock(_component_el_progress, {
197
+ key: 1,
198
+ type: __props.column.props.format.progressType,
199
+ percentage: scope.row[__props.column.props.base.prop],
200
+ status: __props.column.props.format.status,
201
+ "text-inside": __props.column.props.format.showText,
202
+ "stroke-width": __props.column.props.format.strokeWidth,
203
+ color: __props.column.props.format.colorType === "custom" ? __props.column.props.format.color : ""
204
+ }, null, 8, ["type", "percentage", "status", "text-inside", "stroke-width", "color"])) : __props.column.props.format.type === "icon" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
205
+ __props.column.props.format.isTag ? (openBlock(), createElementBlock("span", _hoisted_1, [
206
+ createVNode(_component_el_tag, {
207
+ type: __props.column.props.format.tagType,
208
+ effect: __props.column.props.format.tagEffect,
209
+ hit: __props.column.props.format.hit,
210
+ size: __props.column.props.format.size
211
+ }, {
212
+ default: withCtx(() => [
213
+ createTextVNode(toDisplayString(scope.row[__props.column.props.base.prop]), 1)
214
+ ]),
215
+ _: 2
216
+ }, 1032, ["type", "effect", "hit", "size"])
217
+ ])) : (openBlock(), createElementBlock("span", _hoisted_2, [
218
+ __props.column.props.format.position === "pre" ? (openBlock(), createElementBlock("i", {
219
+ key: 0,
220
+ class: normalizeClass(__props.column.props.format.icon)
221
+ }, null, 2)) : createCommentVNode("", true),
222
+ createElementVNode("span", null, toDisplayString(scope.row[__props.column.props.base.prop]), 1),
223
+ __props.column.props.format.position === "suf" ? (openBlock(), createElementBlock("i", {
224
+ key: 1,
225
+ class: normalizeClass(__props.column.props.format.icon)
226
+ }, null, 2)) : createCommentVNode("", true)
227
+ ]))
228
+ ], 64)) : (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(formatContent(scope.row, __props.column.props.format)), 1))
229
+ ], 64)) : resloveLinkText.value && showLink(scope.row) ? (openBlock(), createBlock(_component_el_link, {
230
+ key: 1,
231
+ type: "primary",
232
+ onClick: ($event) => clickLink(scope.row)
233
+ }, {
234
+ default: withCtx(() => [
235
+ createTextVNode(toDisplayString(scope.row[__props.column.props.base.prop]), 1)
236
+ ]),
237
+ _: 2
238
+ }, 1032, ["onClick"])) : (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(scope.row[__props.column.props.base.prop]), 1))
239
+ ]),
240
+ _: 1
241
+ }, 8, ["prop", "width", "label", "header-align", "align", "fixed"]));
242
+ };
243
+ }
244
+ });
245
+ export {
246
+ _sfc_main as default
247
+ };
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./normal-column.vue.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
@@ -1,7 +1,10 @@
1
- import { defineComponent, ref, onMounted, resolveComponent, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass, withDirectives, createVNode, vShow, withCtx, Fragment, renderList, createBlock } from "vue";
1
+ import { defineComponent, ref, onMounted, resolveComponent, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass, withDirectives, createVNode, vShow, withCtx, Fragment, renderList, createBlock, watch, h } from "vue";
2
2
  import _sfc_main$1 from "../common/common-chart-header.vue.js";
3
- import { getChartDatasFromPage } from "../../../../utils/page-helper-util.js";
3
+ import { getChartDatasFromPage, isPromise, getValueFromVariable } from "../../../../utils/page-helper-util.js";
4
4
  import { getCustomFunc } from "../../../../utils/events/event-util.js";
5
+ import _sfc_main$2 from "./group-column.vue.js";
6
+ import _sfc_main$3 from "./normal-column.vue.js";
7
+ import { getSummaryTitleColumn, getSummaryDataColumn, rowDataToColumn, getColumnToRowTableConfig, colDataToRow, computeFormula, summaryStatistics, replacePlaceholders, getHeaderCellStyleUtil, getRowStyleUtil, getCellStyleUtil, getIndexColumn } from "./chart-table-util.js";
5
8
  const _sfc_main = /* @__PURE__ */ defineComponent({
6
9
  __name: "table-runtime",
7
10
  props: {
@@ -19,21 +22,54 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
19
22
  }
20
23
  },
21
24
  setup(__props, { expose: __expose }) {
25
+ var _a;
22
26
  const props = __props;
23
27
  const runtimeInfo = props.configure.runtime ? props.configure.runtime : {};
24
- debugger;
25
28
  const runtimeStyle = runtimeInfo.style;
26
29
  const runtimeClass = runtimeInfo.class;
27
30
  const dataConfig = runtimeInfo.dataConfig;
28
31
  const headerInfo = runtimeInfo.headerInfo ? runtimeInfo.headerInfo : {};
29
32
  const headerRef = ref(null);
33
+ const isEnableGroupHeader = ref(runtimeInfo.props.isEnableGroupHeader);
30
34
  const tableData = ref([]);
31
- const tableColumns = ref([]);
32
- const customColumnModels = ref(false);
33
- if (props.configure.props.modelCustom) {
34
- customColumnModels.value = true;
35
- } else {
36
- tableColumns.value = props.configure.items;
35
+ const tableColumnsConfig = ref([]);
36
+ const groupColumnsConfig = ref([]);
37
+ const columnsConfigKeyValues = ref({});
38
+ const showSummary = ref(false);
39
+ const tableSummaryTitle = ref({});
40
+ const tableSummaryColumns = ref({});
41
+ const groupSummaryColumns = ref({});
42
+ const groupSummaryDataRowIndex = [];
43
+ const columnStyleSourceConfig = ref({});
44
+ const dataFormulaMapping = ref({});
45
+ if (!props.configure.props.modelCustom) {
46
+ if (!isEnableGroupHeader.value) {
47
+ tableColumnsConfig.value = props.configure.items;
48
+ } else {
49
+ groupColumnsConfig.value = props.configure.props.groupHeaders;
50
+ }
51
+ (_a = props.configure.items) == null ? void 0 : _a.forEach((item) => {
52
+ columnsConfigKeyValues.value[item.uuid] = item;
53
+ if (Object.keys(item.style).length > 0) {
54
+ columnStyleSourceConfig.value[item.props.base.prop] = {
55
+ cellStyle: item.style,
56
+ titleStyle: item.titleStyle
57
+ };
58
+ }
59
+ if (item.formula && item.formula.trim() !== "") {
60
+ dataFormulaMapping.value[item.props.base.prop] = item.formula;
61
+ }
62
+ });
63
+ }
64
+ showSummary.value = props.configure.props.base.showSummary;
65
+ if (showSummary.value || props.configure.props.highOrder.groupField && props.configure.props.highOrder.groupField.length > 0) {
66
+ tableSummaryTitle.value = getSummaryTitleColumn(props.configure);
67
+ if (showSummary.value) {
68
+ tableSummaryColumns.value = getSummaryDataColumn(props.configure, "table");
69
+ }
70
+ if (props.configure.props.highOrder.groupField && props.configure.props.highOrder.groupField.length > 0) {
71
+ groupSummaryColumns.value = getSummaryDataColumn(props.configure, "group");
72
+ }
37
73
  }
38
74
  onMounted(() => {
39
75
  const resultData = getChartDatasFromPage(props.pageContext, props.configure);
@@ -41,6 +77,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
41
77
  updateChartDatas(resultData);
42
78
  }
43
79
  });
80
+ function watchVariableDataChange() {
81
+ const match = props.configure.props.dataOrigin.variable.match(/\${(.*?)}/);
82
+ const path = match ? match[1].split(".") : [];
83
+ watch(
84
+ () => path.reduce((obj, key) => obj[key], props.pageContext.entity),
85
+ (newVal) => {
86
+ loadTable(JSON.parse(JSON.stringify(newVal)));
87
+ }
88
+ );
89
+ }
44
90
  function updateChartDatas(resultData) {
45
91
  if (!resultData) {
46
92
  resultData = [];
@@ -54,25 +100,256 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
54
100
  console.log("重复更新!", resultData);
55
101
  return;
56
102
  }
57
- if (customColumnModels.value) {
103
+ updateTable(resultData);
104
+ resultData.hasRender = true;
105
+ dataConfig.autoRefresh = false;
106
+ }
107
+ function updateTable(resultData) {
108
+ if (props.configure.props.modelCustom) {
58
109
  const func = getCustomFunc(props.pageContext, props.configure.props.modelCustom);
59
110
  if (func) {
60
- func.apply(func, [
111
+ const resultValue = func.apply(func, [
61
112
  {
62
113
  pageContext: props.pageContext,
63
114
  configureObj: props.configure,
64
115
  value: resultData
65
116
  }
66
117
  ]);
118
+ if (isPromise(resultValue)) {
119
+ resultValue.then((res) => {
120
+ tableColumnsConfig.value = res.columns;
121
+ });
122
+ } else {
123
+ tableColumnsConfig.value = resultValue.columns;
124
+ }
67
125
  }
68
126
  }
69
- if (props.configure.serviceDataField && resultData.result) {
70
- tableData.value = resultData.result[props.configure.serviceDataField];
127
+ let tmpTableData = [];
128
+ if (props.configure.props.dataOrigin.dataSource === "service" && resultData.result) {
129
+ tmpTableData = resultData.result[props.configure.props.dataOrigin.service.serviceDataField];
130
+ } else if (props.configure.props.dataOrigin.dataSource === "variable") {
131
+ watchVariableDataChange();
132
+ tmpTableData = getValueFromVariable(
133
+ props.pageContext.entity,
134
+ props.configure.props.dataOrigin.variable
135
+ );
136
+ }
137
+ if (tmpTableData) {
138
+ loadTable(tmpTableData);
139
+ }
140
+ }
141
+ function loadTable(tmpTableData) {
142
+ if (enableTransition("rowToColumn")) {
143
+ tmpTableData = rowDataToColumn(tmpTableData, props.configure);
144
+ if (!isEnableGroupHeader.value) {
145
+ const updatedColumnConfig = updateColumnConfig(
146
+ tableColumnsConfig.value,
147
+ tmpTableData,
148
+ props.configure.props.dataOrigin.rowToColumn.titleColumns,
149
+ props.configure.props.dataOrigin.rowToColumn.dataColumns
150
+ );
151
+ tableColumnsConfig.value = updatedColumnConfig;
152
+ }
153
+ } else if (enableTransition("columnToRow")) {
154
+ if (!isEnableGroupHeader.value) {
155
+ tableColumnsConfig.value = getColumnToRowTableConfig(props.configure);
156
+ }
157
+ tmpTableData = colDataToRow(tmpTableData, props.configure);
158
+ }
159
+ if (props.configure.props.dataOrigin.dataFormatting) {
160
+ const func = getCustomFunc(props.pageContext, props.configure.props.dataOrigin.dataFormatting);
161
+ if (func) {
162
+ const resultValue = func.apply(func, [{ tableData: tmpTableData }]);
163
+ if (resultValue) {
164
+ tmpTableData = resultValue;
165
+ }
166
+ }
167
+ }
168
+ if (Object.keys(dataFormulaMapping.value).length > 0 && tmpTableData && tmpTableData.length > 0) {
169
+ tmpTableData.forEach((item) => {
170
+ Object.keys(dataFormulaMapping.value).forEach((key) => {
171
+ const formula = dataFormulaMapping.value[key];
172
+ item[key] = computeFormula(item, formula);
173
+ });
174
+ });
175
+ }
176
+ tableData.value = tmpTableData;
177
+ if (props.configure.props.highOrder.groupField && props.configure.props.highOrder.groupField.length > 0) {
178
+ const groupField = props.configure.props.highOrder.groupField;
179
+ tableData.value = groupAndAddTotals(tableData.value, groupField);
180
+ }
181
+ pushTableIndexColumn(tableColumnsConfig.value);
182
+ }
183
+ function enableTransition(type) {
184
+ return props.configure.props.dataOrigin.transition === type && props.configure.props.dataOrigin.groupField && props.configure.props.dataOrigin.groupField.length > 0 && props.configure.props.dataOrigin[type].titleColumns && props.configure.props.dataOrigin[type].titleColumns.length > 0 && props.configure.props.dataOrigin[type].dataColumns && props.configure.props.dataOrigin[type].dataColumns.length > 0;
185
+ }
186
+ function getHeaderCellStyle(data) {
187
+ const cellTitleStyle = columnStyleSourceConfig.value[data.column.property] ? columnStyleSourceConfig.value[data.column.property].titleStyle : null;
188
+ const rowTitleStyle = runtimeStyle == null ? void 0 : runtimeStyle.titleStyle;
189
+ return getHeaderCellStyleUtil(
190
+ data,
191
+ { cellTitleStyle, titleStyle: rowTitleStyle },
192
+ props
193
+ );
194
+ }
195
+ function getRowStyle(data) {
196
+ return getRowStyleUtil(data, groupSummaryDataRowIndex, props);
197
+ }
198
+ function getCellStyle(data) {
199
+ const cellStyles = columnStyleSourceConfig.value[data.column.property] ? columnStyleSourceConfig.value[data.column.property].cellStyle : null;
200
+ return getCellStyleUtil(data, cellStyles, props);
201
+ }
202
+ const getSummaries = (param) => {
203
+ const { columns, data } = param;
204
+ const sums = [];
205
+ columns.forEach((column, index) => {
206
+ if (tableSummaryTitle.value[column.property]) {
207
+ const label = tableSummaryTitle.value[column.property].label;
208
+ sums[index] = h("div", {}, [replacePlaceholders(label, data)]);
209
+ return;
210
+ }
211
+ if (tableSummaryColumns.value[column.property]) {
212
+ const scientificData = data.filter((item, index2) => !groupSummaryDataRowIndex.includes(index2));
213
+ sums[index] = summaryStatistics(
214
+ tableSummaryColumns.value[column.property],
215
+ scientificData,
216
+ column.property,
217
+ props.pageContext
218
+ );
219
+ }
220
+ });
221
+ return sums;
222
+ };
223
+ function spanMethod({ row, column, rowIndex, columnIndex }) {
224
+ const property = column.property;
225
+ const highOrder = props.configure.props.highOrder;
226
+ if (highOrder.scopeFunc) {
227
+ const func = getCustomFunc(props.pageContext, highOrder.scopeFunc);
228
+ if (func) {
229
+ const resultValue = func.apply(func, [
230
+ { tableData: tableData.value, row, column, rowIndex, columnIndex }
231
+ ]);
232
+ if (resultValue) {
233
+ return resultValue;
234
+ }
235
+ }
71
236
  } else {
72
- tableData.value = [];
237
+ if (highOrder && highOrder.mergeColumn) ;
238
+ if (highOrder && highOrder.mergeRow && highOrder.mergeRow.includes(property)) {
239
+ if (rowIndex === 0) {
240
+ return {
241
+ rowspan: tableData.value.length,
242
+ colspan: 1
243
+ };
244
+ }
245
+ }
246
+ }
247
+ }
248
+ function updateColumnConfig(columnConfig, pivotedData, columnFields, valueFields) {
249
+ const updatedConfig = [...columnConfig].filter(
250
+ (item) => !columnFields.includes(item.props.base.prop) && !valueFields.includes(item.props.base.prop)
251
+ );
252
+ const valueFieldsRegex = new RegExp(`(${valueFields.join("|")})$`);
253
+ const columnCombinations = /* @__PURE__ */ new Set();
254
+ pivotedData.forEach((record) => {
255
+ Object.keys(record).forEach((key) => {
256
+ if (valueFields.some((valueField) => key.includes(valueField))) {
257
+ const parts = key.split(valueFieldsRegex);
258
+ const combination = parts[0];
259
+ columnCombinations.add(combination);
260
+ }
261
+ });
262
+ });
263
+ columnCombinations.forEach((combination) => {
264
+ valueFields.forEach((valueField) => {
265
+ var _a2;
266
+ const name = (_a2 = tableColumnsConfig.value.find((item) => item.props.base.prop === valueField)) == null ? void 0 : _a2.props.base.name;
267
+ const newConfigItem = {
268
+ uuid: (/* @__PURE__ */ new Date()).getTime(),
269
+ // 生成新的UUID
270
+ name: "",
271
+ props: {
272
+ base: {
273
+ prop: `${combination}${valueField}`,
274
+ name: `${combination}${name}`,
275
+ displayOrder: updatedConfig.length + 1,
276
+ // 更新显示顺序
277
+ sortable: true,
278
+ headerAlign: "center",
279
+ align: "center",
280
+ fixed: false,
281
+ visible: true,
282
+ dataType: typeof pivotedData[0][`${combination}${valueField}`] === "number" ? "number" : "string"
283
+ },
284
+ format: {},
285
+ size: {
286
+ pc: {}
287
+ }
288
+ },
289
+ style: {},
290
+ componentIndex: 0,
291
+ // 根据实际情况设置
292
+ runtime: {
293
+ common: {
294
+ class: "",
295
+ style: {
296
+ pc_style: {},
297
+ pc_class: ""
298
+ }
299
+ }
300
+ }
301
+ };
302
+ updatedConfig.push(newConfigItem);
303
+ });
304
+ });
305
+ return updatedConfig;
306
+ }
307
+ function groupAndAddTotals(data, groupFields) {
308
+ var _a2, _b;
309
+ if (groupSummaryColumns.value.length === 0) {
310
+ return data;
311
+ }
312
+ const result = [];
313
+ const groupColumns = (_a2 = props.configure.items) == null ? void 0 : _a2.filter(
314
+ (item) => groupFields.includes(item.props.base.prop)
315
+ );
316
+ const summaryColumns = (_b = props.configure.items) == null ? void 0 : _b.filter(
317
+ (item) => item.props.base.groupSummary === true
318
+ );
319
+ const groupedData = {};
320
+ data.forEach((item) => {
321
+ const key = groupFields.map((field) => item[field]).join("|");
322
+ if (!groupedData[key]) {
323
+ groupedData[key] = [];
324
+ }
325
+ groupedData[key].push(item);
326
+ });
327
+ const groupResult = Object.values(groupedData);
328
+ for (let i = 0; i < groupResult.length; i++) {
329
+ const group = groupResult[i];
330
+ const total = {};
331
+ summaryColumns == null ? void 0 : summaryColumns.forEach((column) => {
332
+ const prop = column.props.base.prop;
333
+ const res = summaryStatistics(groupSummaryColumns.value[prop], group, prop, props.pageContext);
334
+ total[prop] = res;
335
+ });
336
+ result.push(...group);
337
+ groupColumns == null ? void 0 : groupColumns.forEach((column) => {
338
+ const prop = column.props.base.prop;
339
+ total[prop] = replacePlaceholders(column.props.base.summaryTitle, group[0]);
340
+ });
341
+ result.push(total);
342
+ groupSummaryDataRowIndex.push(result.length - 1);
343
+ }
344
+ return result;
345
+ }
346
+ function pushTableIndexColumn(tableColumnsConfig2) {
347
+ if (props.configure.props.base.showIndex && tableColumnsConfig2.findIndex((item) => item.props.base.prop === "$index") === -1) {
348
+ const indexColumn = getIndexColumn();
349
+ if (indexColumn) {
350
+ tableColumnsConfig2.unshift(indexColumn);
351
+ }
73
352
  }
74
- resultData.hasRender = true;
75
- dataConfig.autoRefresh = false;
76
353
  }
77
354
  function exportChart() {
78
355
  }
@@ -81,7 +358,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
81
358
  exportChart
82
359
  });
83
360
  return (_ctx, _cache) => {
84
- const _component_el_table_column = resolveComponent("el-table-column");
85
361
  const _component_el_table = resolveComponent("el-table");
86
362
  return openBlock(), createElementBlock("div", {
87
363
  style: normalizeStyle(unref(runtimeStyle)),
@@ -99,32 +375,40 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
99
375
  ]),
100
376
  createVNode(_component_el_table, {
101
377
  data: tableData.value,
102
- style: { "width": "100%" }
378
+ style: { "width": "100%" },
379
+ "header-cell-style": getHeaderCellStyle,
380
+ "row-style": getRowStyle,
381
+ "cell-style": getCellStyle,
382
+ "show-summary": showSummary.value,
383
+ stripe: __props.configure.props.base.stripe,
384
+ "summary-method": getSummaries,
385
+ "span-method": spanMethod
103
386
  }, {
104
387
  default: withCtx(() => [
105
- (openBlock(true), createElementBlock(Fragment, null, renderList(tableColumns.value, (column, index) => {
388
+ isEnableGroupHeader.value ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(groupColumnsConfig.value, (item, index) => {
106
389
  return openBlock(), createElementBlock(Fragment, { key: index }, [
107
- column.props.base.prop === "$index" ? (openBlock(), createBlock(_component_el_table_column, {
390
+ !item.isLeaf ? (openBlock(), createBlock(_sfc_main$2, {
108
391
  key: 0,
109
- label: column.props.base.name,
110
- type: "index",
111
- align: "center",
112
- "header-align": "center",
113
- width: "80"
114
- }, null, 8, ["label"])) : (openBlock(), createBlock(_component_el_table_column, {
392
+ configure: __props.configure,
393
+ pageContext: __props.pageContext,
394
+ groupColumn: item,
395
+ columnsConfigKeyValues: columnsConfigKeyValues.value
396
+ }, null, 8, ["configure", "pageContext", "groupColumn", "columnsConfigKeyValues"])) : (openBlock(), createBlock(_sfc_main$3, {
115
397
  key: 1,
116
- prop: column.props.base.prop,
117
- width: column.props.base.width ? column.props.base.width : "200",
118
- label: column.props.base.name,
119
- "header-align": column.props.base.headerAlign,
120
- align: column.props.base.align,
121
- fixed: column.props.base.fixed ? column.props.base.fixed : false
122
- }, null, 8, ["prop", "width", "label", "header-align", "align", "fixed"]))
398
+ configure: __props.configure,
399
+ pageContext: __props.pageContext,
400
+ column: columnsConfigKeyValues.value[item.columnUuid]
401
+ }, null, 8, ["configure", "pageContext", "column"]))
123
402
  ], 64);
403
+ }), 128)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(tableColumnsConfig.value, (column, index) => {
404
+ return openBlock(), createBlock(_sfc_main$3, {
405
+ key: index,
406
+ column
407
+ }, null, 8, ["column"]);
124
408
  }), 128))
125
409
  ]),
126
410
  _: 1
127
- }, 8, ["data"])
411
+ }, 8, ["data", "show-summary", "stripe"])
128
412
  ], 6);
129
413
  };
130
414
  }
@@ -23,6 +23,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
23
23
  });
24
24
  resizeObserver2.observe(thisRef.value.parentNode);
25
25
  }
26
+ console.log("tools-runtime onMounted");
26
27
  });
27
28
  onUnmounted(() => {
28
29
  });