super-page-runtime 2.1.54 → 2.1.60

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 (58) hide show
  1. package/dist/es/components/runtime/utils/api/page-expose-util.js +17 -14
  2. package/dist/es/components/runtime/utils/charts/chart-columnline-util.js +0 -1
  3. package/dist/es/components/runtime/utils/charts/chart-util.d.ts +24 -0
  4. package/dist/es/components/runtime/utils/charts/chart-util.js +4 -1
  5. package/dist/es/components/runtime/utils/common-util.js +2 -5
  6. package/dist/es/components/runtime/utils/events/event-util.d.ts +1 -0
  7. package/dist/es/components/runtime/utils/events/event-util.js +7 -3
  8. package/dist/es/components/runtime/utils/events/standard-event.d.ts +1 -1
  9. package/dist/es/components/runtime/utils/events/standard-event.js +102 -38
  10. package/dist/es/components/runtime/utils/events/validator-util.d.ts +1 -1
  11. package/dist/es/components/runtime/utils/events/validator-util.js +4 -3
  12. package/dist/es/components/runtime/utils/page-helper-util.js +0 -1
  13. package/dist/es/components/runtime/utils/page-init-util.js +11 -9
  14. package/dist/es/components/runtime/utils/table-utils.d.ts +1 -0
  15. package/dist/es/components/runtime/utils/table-utils.js +39 -7
  16. package/dist/es/components/runtime/views/assemblys/button/button/button-runtime.vue2.js +12 -3
  17. package/dist/es/components/runtime/views/assemblys/button/button-group/buttongroup-runtime.vue2.js +14 -1
  18. package/dist/es/components/runtime/views/assemblys/button/dropdown/dropdown-runtime.vue2.js +14 -2
  19. package/dist/es/components/runtime/views/assemblys/button/print-label/printlabel-runtime.vue2.js +16 -2
  20. package/dist/es/components/runtime/views/assemblys/chart/table/chart-table-util.js +106 -55
  21. package/dist/es/components/runtime/views/assemblys/chart/table/normal-column.vue.js +0 -2
  22. package/dist/es/components/runtime/views/assemblys/chart/table/table-runtime.vue2.js +14 -8
  23. package/dist/es/components/runtime/views/assemblys/container/card/card-runtime.vue2.js +11 -1
  24. package/dist/es/components/runtime/views/assemblys/container/collapse/collapse-runtime.vue2.js +11 -1
  25. package/dist/es/components/runtime/views/assemblys/container/container/container-runtime.vue2.js +11 -1
  26. package/dist/es/components/runtime/views/assemblys/container/flex/flex-runtime.vue2.js +11 -1
  27. package/dist/es/components/runtime/views/assemblys/container/form/form-runtime.vue2.js +14 -2
  28. package/dist/es/components/runtime/views/assemblys/container/iframe/iframe-runtime.vue2.js +11 -1
  29. package/dist/es/components/runtime/views/assemblys/container/tabs/tabs-runtime.vue2.js +30 -10
  30. package/dist/es/components/runtime/views/assemblys/container/tools/tools-runtime.vue2.js +9 -4
  31. package/dist/es/components/runtime/views/assemblys/data/table/main-table-runtime.vue.js +34 -64
  32. package/dist/es/components/runtime/views/assemblys/data/table/sub-table-runtime.vue.js +20 -8
  33. package/dist/es/components/runtime/views/assemblys/data/table/table-runtime.vue2.js +11 -2
  34. package/dist/es/components/runtime/views/assemblys/form/checkbox/checkbox-runtime.vue2.js +30 -3
  35. package/dist/es/components/runtime/views/assemblys/form/custom/custom-runtime.vue2.js +24 -2
  36. package/dist/es/components/runtime/views/assemblys/form/date-picker/datepicker-runtime.vue2.js +31 -5
  37. package/dist/es/components/runtime/views/assemblys/form/dept-tree/depttree-runtime.vue2.js +33 -2
  38. package/dist/es/components/runtime/views/assemblys/form/divider/divider-runtime.vue2.js +21 -2
  39. package/dist/es/components/runtime/views/assemblys/form/file-upload/fileupload-runtime.vue2.js +26 -4
  40. package/dist/es/components/runtime/views/assemblys/form/input-number/input-number-runtime.vue2.js +29 -2
  41. package/dist/es/components/runtime/views/assemblys/form/input-text/inputtext-runtime.vue2.js +29 -14
  42. package/dist/es/components/runtime/views/assemblys/form/label/label-runtime.vue2.js +32 -5
  43. package/dist/es/components/runtime/views/assemblys/form/link/link-runtime.vue2.js +29 -2
  44. package/dist/es/components/runtime/views/assemblys/form/placeholder/placeholder-runtime.vue.js +1 -1
  45. package/dist/es/components/runtime/views/assemblys/form/placeholder/placeholder-runtime.vue2.js +26 -4
  46. package/dist/es/components/runtime/views/assemblys/form/radio/radio-runtime.vue2.js +29 -2
  47. package/dist/es/components/runtime/views/assemblys/form/rich-text/richtext-runtime.vue2.js +22 -3
  48. package/dist/es/components/runtime/views/assemblys/form/select/select-runtime.vue2.js +27 -8
  49. package/dist/es/components/runtime/views/assemblys/form/separatelabel/separatelabel-runtime.vue2.js +18 -1
  50. package/dist/es/components/runtime/views/assemblys/form/switch/switch-runtime.vue2.js +29 -4
  51. package/dist/es/components/runtime/views/assemblys/form/tag/tag-runtime.vue2.js +25 -2
  52. package/dist/es/components/runtime/views/assemblys/form/textarea/textarea-runtime.vue2.js +29 -2
  53. package/dist/es/components/runtime/views/assemblys/object-render.vue.js +3 -5
  54. package/dist/es/components/runtime/views/super-page.vue.js +89 -26
  55. package/dist/es/i18n/langs/cn.js +3 -1
  56. package/dist/es/i18n/langs/en.js +3 -1
  57. package/dist/es/style.css +1 -1
  58. package/package.json +2 -2
@@ -1,5 +1,6 @@
1
- import { defineComponent, resolveComponent, openBlock, createBlock, normalizeClass, unref, normalizeStyle, withCtx, createElementBlock, Fragment, renderList } from "vue";
1
+ import { defineComponent, ref, onMounted, nextTick, resolveComponent, openBlock, createBlock, normalizeClass, unref, normalizeStyle, withCtx, createElementBlock, Fragment, renderList } from "vue";
2
2
  import _sfc_main$1 from "../../object-render.vue.js";
3
+ import { handleAfterInitEvent } from "../../../../utils/events/event-util.js";
3
4
  const _sfc_main = /* @__PURE__ */ defineComponent({
4
5
  __name: "buttongroup-runtime",
5
6
  props: {
@@ -11,9 +12,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
11
12
  const runtimeInfo = props.configure.runtime ? props.configure.runtime : {};
12
13
  const runtimeStyle = runtimeInfo.style;
13
14
  const runtimeClass = runtimeInfo.class;
15
+ const componentRef = ref(null);
16
+ onMounted(() => {
17
+ nextTick(() => {
18
+ handleAfterInitEvent(null, props.pageContext, props.configure, {
19
+ componentRef: componentRef.value,
20
+ entity: props.pageContext.entity.data,
21
+ pageData: props.pageContext.entity.page
22
+ });
23
+ });
24
+ });
14
25
  return (_ctx, _cache) => {
15
26
  const _component_el_button_group = resolveComponent("el-button-group");
16
27
  return openBlock(), createBlock(_component_el_button_group, {
28
+ ref_key: "componentRef",
29
+ ref: componentRef,
17
30
  class: normalizeClass(unref(runtimeClass)),
18
31
  style: normalizeStyle(unref(runtimeStyle))
19
32
  }, {
@@ -1,7 +1,7 @@
1
- import { defineComponent, ref, computed, resolveComponent, openBlock, createBlock, normalizeClass, unref, normalizeStyle, withCtx, createVNode, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString } from "vue";
1
+ import { defineComponent, ref, computed, onMounted, nextTick, resolveComponent, openBlock, createBlock, normalizeClass, unref, normalizeStyle, withCtx, createVNode, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString } from "vue";
2
2
  import { ArrowDown } from "@element-plus/icons-vue";
3
3
  import { formatVariableValue } from "../../../../utils/page-helper-util.js";
4
- import { handleEvent, handleFormEvent } from "../../../../utils/events/event-util.js";
4
+ import { handleAfterInitEvent, handleEvent, handleFormEvent } from "../../../../utils/events/event-util.js";
5
5
  import { $t } from "../../../../utils/i18n-util.js";
6
6
  const _hoisted_1 = { key: 1 };
7
7
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -53,6 +53,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
53
53
  handleFormEvent(isVisible, props.pageContext, props.configure, "menuHidden");
54
54
  }
55
55
  }
56
+ const componentRef = ref(null);
57
+ onMounted(() => {
58
+ nextTick(() => {
59
+ handleAfterInitEvent(null, props.pageContext, props.configure, {
60
+ componentRef: componentRef.value,
61
+ entity: props.pageContext.entity.data,
62
+ pageData: props.pageContext.entity.page
63
+ });
64
+ });
65
+ });
56
66
  return (_ctx, _cache) => {
57
67
  const _component_el_button = resolveComponent("el-button");
58
68
  const _component_el_icon = resolveComponent("el-icon");
@@ -61,6 +71,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
61
71
  const _component_el_dropdown_menu = resolveComponent("el-dropdown-menu");
62
72
  const _component_el_dropdown = resolveComponent("el-dropdown");
63
73
  return openBlock(), createBlock(_component_el_dropdown, {
74
+ ref_key: "componentRef",
75
+ ref: componentRef,
64
76
  class: normalizeClass(unref(runtimeClass)),
65
77
  style: normalizeStyle(unref(runtimeStyle)),
66
78
  placement: designProperty.value.placement,
@@ -1,6 +1,6 @@
1
- import { defineComponent, ref, resolveComponent, openBlock, createBlock, normalizeClass, unref, normalizeStyle, withCtx, createVNode, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString } from "vue";
1
+ import { defineComponent, ref, onMounted, nextTick, resolveComponent, openBlock, createBlock, normalizeClass, unref, normalizeStyle, withCtx, createVNode, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString } from "vue";
2
2
  import "agilebuilder-ui";
3
- import { handleEvent } from "../../../../utils/events/event-util.js";
3
+ import { handleAfterInitEvent, handleEvent } from "../../../../utils/events/event-util.js";
4
4
  import _sfc_main$1 from "../button/button-runtime.vue2.js";
5
5
  import { $t } from "../../../../utils/i18n-util.js";
6
6
  const _hoisted_1 = { key: 1 };
@@ -20,6 +20,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
20
20
  }
21
21
  const runtimeStyle = runtimeInfo.style;
22
22
  const runtimeClass = runtimeInfo.class;
23
+ const componentRef = ref(null);
24
+ onMounted(() => {
25
+ nextTick(() => {
26
+ if (showDropdown.value) {
27
+ handleAfterInitEvent(null, props.pageContext, props.configure, {
28
+ componentRef: componentRef.value,
29
+ entity: props.pageContext.entity.data,
30
+ pageData: props.pageContext.entity.page
31
+ });
32
+ }
33
+ });
34
+ });
23
35
  return (_ctx, _cache) => {
24
36
  const _component_el_button = resolveComponent("el-button");
25
37
  const _component_ArrowDown = resolveComponent("ArrowDown");
@@ -34,6 +46,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
34
46
  pageContext: _ctx.pageContext
35
47
  }, null, 8, ["configure", "pageContext"])) : (openBlock(), createBlock(_component_el_dropdown, {
36
48
  key: 1,
49
+ ref_key: "componentRef",
50
+ ref: componentRef,
37
51
  class: normalizeClass(unref(runtimeClass)),
38
52
  style: normalizeStyle(unref(runtimeStyle)),
39
53
  placement: designProperty.value.placement,
@@ -1,20 +1,22 @@
1
- import { getValueFromVariable } from "../../../../utils/page-helper-util.js";
1
+ import { getParamNames, getValueFromVariable } from "../../../../utils/page-helper-util.js";
2
2
  import { getCustomFunc } from "../../../../utils/events/event-util.js";
3
+ import { getMinValue, getMaxValue, getSumValue, getAvgValue } from "../../../../utils/charts/chart-util.js";
4
+ import "element-plus/es/locale/index.mjs";
3
5
  class ExpressionEvaluator {
4
- static evaluate(pageContext, conditions, data) {
6
+ static evaluate(pageContext, conditions, data2) {
5
7
  const expressions = conditions.map(
6
- (condition) => this.createExpression(pageContext, condition, data)
8
+ (condition) => this.createExpression(pageContext, condition, data2)
7
9
  );
8
10
  const joinedExpression = expressions.join(" ");
9
11
  return this.evaluateExpression(joinedExpression);
10
12
  }
11
- static createExpression(pageContext, condition, data) {
13
+ static createExpression(pageContext, condition, data2) {
12
14
  const { propName, operator, propValue, leftBracket, rightBracket, joinSign, dataType } = condition;
13
15
  if (!propName || propName === "") {
14
16
  return "";
15
17
  }
16
- const value = getValueFromVariable(pageContext.entity, propName, data);
17
- let expression2 = `${leftBracket} ${this.getComparisonExpression(value, operator, getValueFromVariable(pageContext.entity, propValue, data), dataType)} ${rightBracket}`;
18
+ const value = getValueFromVariable(pageContext.entity, propName, data2);
19
+ let expression2 = `${leftBracket} ${this.getComparisonExpression(value, operator, getValueFromVariable(pageContext.entity, propValue, data2), dataType)} ${rightBracket}`;
18
20
  if (joinSign) {
19
21
  if (joinSign === "and" || joinSign === "AND") {
20
22
  expression2 += "&&";
@@ -91,8 +93,9 @@ class ExpressionEvaluator {
91
93
  }
92
94
  }
93
95
  function getSummaryTitleColumn(configure) {
96
+ var _a;
94
97
  const result = {};
95
- if (configure.props.summaries.titleColumn && configure.props.summaries.titleColumn.length > 0) {
98
+ if (((_a = configure.props.summaries) == null ? void 0 : _a.titleColumn) && configure.props.summaries.titleColumn.length > 0) {
96
99
  configure.props.summaries.titleColumn.forEach((item) => {
97
100
  result[item.prop] = item;
98
101
  });
@@ -100,11 +103,12 @@ function getSummaryTitleColumn(configure) {
100
103
  return result;
101
104
  }
102
105
  function getSummaryDataColumn(configure, type) {
106
+ var _a;
103
107
  const result = {};
104
- if (configure.props.summaries.dataColumn && configure.props.summaries.dataColumn.length > 0) {
108
+ if (((_a = configure.props.summaries) == null ? void 0 : _a.dataColumn) && configure.props.summaries.dataColumn.length > 0) {
105
109
  configure.props.summaries.dataColumn.forEach((item) => {
106
- var _a;
107
- const columnConfigs = (_a = configure.items) == null ? void 0 : _a.find(
110
+ var _a2;
111
+ const columnConfigs = (_a2 = configure.items) == null ? void 0 : _a2.find(
108
112
  (columnItem) => item.prop === columnItem.props.base.prop
109
113
  );
110
114
  if (columnConfigs) {
@@ -118,15 +122,15 @@ function getSummaryDataColumn(configure, type) {
118
122
  }
119
123
  return result;
120
124
  }
121
- function summaryStatistics(summaryColumn, data, prop, pageContext) {
125
+ function summaryStatistics(summaryColumn, data2, prop, pageContext) {
122
126
  let sumsIndex = "";
123
127
  const summaryMode = summaryColumn.summaryMode;
124
- const values = data.map((item) => Number(item[prop])).filter((value) => !Number.isNaN(value));
128
+ const values = data2.map((item) => Number(item[prop])).filter((value) => !Number.isNaN(value));
125
129
  if (values.length > 0) {
126
130
  if (summaryMode === "custom") {
127
131
  const func = getCustomFunc(pageContext, summaryColumn.customFunc);
128
132
  if (func) {
129
- const resultValue = func.apply(func, [{ data, prop }]);
133
+ const resultValue = func.apply(func, [{ data: data2, prop }]);
130
134
  if (resultValue) {
131
135
  sumsIndex = ` ${resultValue}`;
132
136
  } else {
@@ -158,23 +162,23 @@ function summaryStatistics(summaryColumn, data, prop, pageContext) {
158
162
  }
159
163
  return sumsIndex;
160
164
  }
161
- function replacePlaceholders(template, data) {
165
+ function replacePlaceholders(template, data2) {
162
166
  if (template) {
163
167
  return template.replace(/\$\{row\.(\w+)\}/g, (match, p1) => {
164
- return Object.prototype.hasOwnProperty.call(data, p1) ? data[p1] : "";
168
+ return Object.prototype.hasOwnProperty.call(data2, p1) ? data2[p1] : "";
165
169
  });
166
170
  }
167
171
  }
168
- function getHeaderCellStyleUtil(data, runtimeStyle, props) {
172
+ function getHeaderCellStyleUtil(data2, runtimeStyle, props) {
169
173
  var _a;
170
174
  const headerStyle = {};
171
- if (data.column.property) {
175
+ if (data2.column.property) {
172
176
  (_a = runtimeStyle.titleStyle) == null ? void 0 : _a.forEach((item) => {
173
- if (item.field && item.field.includes(data.column.property)) {
177
+ if (item.field && item.field.includes(data2.column.property)) {
174
178
  if (item.scopeFunc) {
175
179
  const func = getCustomFunc(props.pageContext, item.scopeFunc);
176
180
  if (func) {
177
- const funcResult = func.apply(func, [{ item, data }]);
181
+ const funcResult = func.apply(func, [{ item, data: data2 }]);
178
182
  if (funcResult !== false) {
179
183
  copyStyle(headerStyle, item);
180
184
  }
@@ -185,21 +189,22 @@ function getHeaderCellStyleUtil(data, runtimeStyle, props) {
185
189
  }
186
190
  });
187
191
  }
188
- const cellTitleStytle = getCellStyleUtil(data, runtimeStyle.cellTitleStyle, props);
192
+ const cellTitleStytle = getCellStyleUtil(data2, runtimeStyle.cellTitleStyle, props);
189
193
  if (cellTitleStytle) {
190
194
  Object.assign(headerStyle, cellTitleStytle);
191
195
  }
192
196
  return headerStyle;
193
197
  }
194
- function getRowStyleUtil(data, groupSummaryDataRowIndex, props) {
198
+ function getRowStyleUtil(data2, groupSummaryDataRowIndex, props) {
195
199
  const returnStyle = {};
200
+ console.log("getRowStyleUtil---props.configure---", props.configure);
196
201
  if (props.configure.style.rowStyle) {
197
202
  for (let i = 0; i < props.configure.style.rowStyle.length; i++) {
198
203
  const rowStyle = props.configure.style.rowStyle[i];
199
204
  if (rowStyle.scopeFunc) {
200
205
  const func = getCustomFunc(props.pageContext, rowStyle.scopeFunc);
201
206
  if (func) {
202
- const funcResult = func.apply(func, [{ data }]);
207
+ const funcResult = func.apply(func, [{ data: data2 }]);
203
208
  if (funcResult !== void 0 && funcResult !== null && funcResult !== false) {
204
209
  copyStyle(returnStyle, rowStyle);
205
210
  }
@@ -208,17 +213,19 @@ function getRowStyleUtil(data, groupSummaryDataRowIndex, props) {
208
213
  const result = ExpressionEvaluator.evaluate(
209
214
  props.pageContext,
210
215
  rowStyle.matchingCondition,
211
- data.row
216
+ data2.row
212
217
  );
213
218
  if (result || result === void 0) {
214
219
  copyStyle(returnStyle, rowStyle);
215
220
  }
216
221
  } else {
222
+ console.log("getRowStyleUtil---rowStyle---", rowStyle);
217
223
  copyStyle(returnStyle, rowStyle);
218
224
  }
219
225
  }
220
226
  }
221
- if (groupSummaryDataRowIndex && groupSummaryDataRowIndex.length > 0 && groupSummaryDataRowIndex.indexOf(data.rowIndex) !== -1) {
227
+ if (groupSummaryDataRowIndex && groupSummaryDataRowIndex.length > 0 && groupSummaryDataRowIndex.indexOf(data2.rowIndex) !== -1) {
228
+ console.log("getRowStyleUtil---groupSummaryDataRowIndex---", groupSummaryDataRowIndex);
222
229
  const result = {};
223
230
  if (props.configure.style.collectStyle && props.configure.style.collectStyle.length > 0) {
224
231
  for (let i = 0; i < props.configure.style.collectStyle.length; i++) {
@@ -231,9 +238,10 @@ function getRowStyleUtil(data, groupSummaryDataRowIndex, props) {
231
238
  }
232
239
  return result;
233
240
  }
241
+ console.log("getRowStyleUtil---returnStyle---", returnStyle);
234
242
  return returnStyle;
235
243
  }
236
- function getCellStyleUtil(data, cellStyles, props) {
244
+ function getCellStyleUtil(data2, cellStyles, props) {
237
245
  const cellStyle = {};
238
246
  if (cellStyles) {
239
247
  for (let i = 0; i < cellStyles.length; i++) {
@@ -241,7 +249,7 @@ function getCellStyleUtil(data, cellStyles, props) {
241
249
  if (columnsStyleSetting.scopeFunc) {
242
250
  const func = getCustomFunc(props.pageContext, columnsStyleSetting.scopeFunc);
243
251
  if (func) {
244
- const funcResult = func.apply(func, [{ data }]);
252
+ const funcResult = func.apply(func, [{ data: data2 }]);
245
253
  if (funcResult !== false) {
246
254
  copyStyle(cellStyle, columnsStyleSetting);
247
255
  }
@@ -250,7 +258,7 @@ function getCellStyleUtil(data, cellStyles, props) {
250
258
  const result = ExpressionEvaluator.evaluate(
251
259
  props.pageContext,
252
260
  columnsStyleSetting.matchingCondition,
253
- data.row
261
+ data2.row
254
262
  );
255
263
  if (result || result === void 0) {
256
264
  copyStyle(cellStyle, columnsStyleSetting);
@@ -268,39 +276,39 @@ function copyStyle(target, source) {
268
276
  Object.assign(target, JSON.parse(source.customStyle));
269
277
  }
270
278
  }
271
- function rowDataToColumn(data, configure) {
279
+ function rowDataToColumn(data2, configure) {
272
280
  const groupByFields = configure.props.dataOrigin.groupField;
273
281
  const titleColumns = configure.props.dataOrigin.rowToColumn.titleColumns;
274
282
  const dataColumns = configure.props.dataOrigin.rowToColumn.dataColumns;
275
283
  const result = [];
276
284
  const groupedData = {};
277
- data.forEach((item) => {
278
- const key = groupByFields.map((field) => item[field]).join("|");
279
- if (!groupedData[key]) {
285
+ data2.forEach((item) => {
286
+ const key2 = groupByFields.map((field) => item[field]).join("|");
287
+ if (!groupedData[key2]) {
280
288
  const group = {};
281
289
  groupByFields.forEach((field) => group[field] = item[field]);
282
- groupedData[key] = group;
290
+ groupedData[key2] = group;
283
291
  result.push(group);
284
292
  }
285
293
  dataColumns.forEach((valueField) => {
286
294
  const columnNameParts = titleColumns.map((field) => item[field]);
287
295
  const columnName = `${columnNameParts.join("")}${valueField}`;
288
- groupedData[key][columnName] = item[valueField];
296
+ groupedData[key2][columnName] = item[valueField];
289
297
  });
290
298
  });
291
299
  return result;
292
300
  }
293
- function colDataToRow(data, configure) {
301
+ function colDataToRow(data2, configure) {
294
302
  const groupByFields = configure.props.dataOrigin.groupField;
295
303
  const titleColumns = configure.props.dataOrigin.columnToRow.titleColumns;
296
304
  const dataColumns = configure.props.dataOrigin.columnToRow.dataColumns;
297
305
  const transColumns = configure.props.dataOrigin.columnToRow.transColumns;
298
306
  const dataColumnsMapping = configure.props.dataOrigin.columnToRow.dataColumnsMapping;
299
- if (data.length === 0) {
300
- return data;
307
+ if (data2.length === 0) {
308
+ return data2;
301
309
  }
302
310
  const result = [];
303
- const newData = groupBy(data, groupByFields);
311
+ const newData = groupBy(data2, groupByFields);
304
312
  const dataColumnsConfig = dataColumns.reduce((max, current) => {
305
313
  return current.columns.length > max.columns.length ? current : max;
306
314
  }, dataColumns[0]);
@@ -410,22 +418,22 @@ function getColumnToRowTableConfig(configure) {
410
418
  });
411
419
  return newTableColumns;
412
420
  }
413
- function groupBy(data, groupFields) {
421
+ function groupBy(data2, groupFields) {
414
422
  const grouped = {};
415
- data.forEach((item) => {
416
- const key = groupFields.map((field) => item[field]).join("|");
417
- if (!grouped[key]) {
418
- grouped[key] = {
423
+ data2.forEach((item) => {
424
+ const key2 = groupFields.map((field) => item[field]).join("|");
425
+ if (!grouped[key2]) {
426
+ grouped[key2] = {
419
427
  ...item,
420
428
  // 复制所有字段
421
429
  records: []
422
430
  // 初始化记录数组
423
431
  };
424
- groupFields.forEach((field, index) => {
425
- grouped[key][field] = item[field];
432
+ groupFields.forEach((field, index2) => {
433
+ grouped[key2][field] = item[field];
426
434
  });
427
435
  }
428
- grouped[key].records.push(item);
436
+ grouped[key2].records.push(item);
429
437
  });
430
438
  return Object.values(grouped).map((group) => ({
431
439
  ...group,
@@ -463,16 +471,59 @@ function getIndexColumn() {
463
471
  }
464
472
  };
465
473
  }
466
- function computeFormula(row, formula) {
467
- try {
468
- return new Function(
469
- "row",
470
- `return ${formula.replace(/\$\{row\.(\w+)\}/g, (_, key) => `row.${key}`)}`
471
- )(row);
472
- } catch (error) {
473
- console.error("数据公式解析错误:", error);
474
- return 0;
475
- }
474
+ function computeFormula(itemConfs, datas) {
475
+ Object.keys(itemConfs).forEach((key) => {
476
+ const paramNames = getParamNames(itemConfs[key]);
477
+ datas.forEach((data, index) => {
478
+ const totalValueMap = {};
479
+ for (const paramName of paramNames) {
480
+ if (paramName.startsWith("${min.")) {
481
+ totalValueMap[paramName] = getMinValue(datas, getFieldName(paramName));
482
+ } else if (paramName.startsWith("${max.")) {
483
+ totalValueMap[paramName] = getMaxValue(datas, getFieldName(paramName));
484
+ } else if (paramName.startsWith("${sum.")) {
485
+ totalValueMap[paramName] = getSumValue(datas, getFieldName(paramName));
486
+ } else if (paramName.startsWith("${avg.")) {
487
+ totalValueMap[paramName] = getAvgValue(datas, getFieldName(paramName));
488
+ } else if (paramName.startsWith("${add.")) {
489
+ const fieldName = getFieldName(paramName);
490
+ let currentRowValue = 0;
491
+ try {
492
+ currentRowValue = Number(data[fieldName]);
493
+ datas.slice(0, index).forEach((item) => {
494
+ currentRowValue += Number(item[fieldName]);
495
+ });
496
+ } catch (e) {
497
+ console.error("计算错误:", e);
498
+ currentRowValue = 0;
499
+ }
500
+ totalValueMap[paramName] = currentRowValue;
501
+ } else if (paramName.startsWith("${row.")) {
502
+ totalValueMap[paramName] = data[getFieldName(paramName)];
503
+ }
504
+ }
505
+ let expr = itemConfs[key];
506
+ Object.keys(totalValueMap).forEach((exprParam) => {
507
+ if (expr.indexOf(exprParam) > -1) {
508
+ expr = expr.replaceAll(exprParam, totalValueMap[exprParam]);
509
+ }
510
+ });
511
+ for (const paramName of paramNames) {
512
+ if (expr.indexOf(paramName) > -1) {
513
+ expr = expr.replaceAll(paramName, 0);
514
+ }
515
+ }
516
+ try {
517
+ data[key] = eval(expr);
518
+ } catch (e) {
519
+ console.error(itemConfs[key] + " 计算错误, 替换后表达式为:" + expr, e);
520
+ data[key] = 0;
521
+ }
522
+ });
523
+ });
524
+ }
525
+ function getFieldName(paramName) {
526
+ return paramName.substring(6, paramName.length - 1);
476
527
  }
477
528
  export {
478
529
  ExpressionEvaluator,
@@ -36,7 +36,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
36
36
  resloveLinkText.value = true;
37
37
  }
38
38
  function formatter(row, column, cellValue, index) {
39
- console.log("formatter", row);
40
39
  }
41
40
  function showLink(row) {
42
41
  var _a;
@@ -91,7 +90,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
91
90
  }
92
91
  }
93
92
  function formatContent(row, format) {
94
- console.log("formatContent", row, format);
95
93
  const value = row[props.column.props.base.prop];
96
94
  switch (format.type) {
97
95
  case "number":
@@ -1,6 +1,6 @@
1
- import { defineComponent, ref, onMounted, resolveComponent, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass, withDirectives, createVNode, vShow, withCtx, Fragment, renderList, createBlock, createCommentVNode, watch, h } from "vue";
1
+ import { defineComponent, ref, onMounted, watch, resolveComponent, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass, withDirectives, createVNode, vShow, withCtx, Fragment, renderList, createBlock, createCommentVNode, h } from "vue";
2
2
  import _sfc_main$1 from "../common/common-chart-header.vue.js";
3
- import { getChartDatasFromPage, isPromise, getValueFromVariable, setValueForVariableName, updateChartDatasourcesByComponent } from "../../../../utils/page-helper-util.js";
3
+ import { getChartDatasFromPage, getValueFromVariable, isPromise, setValueForVariableName, updateChartDatasourcesByComponent } from "../../../../utils/page-helper-util.js";
4
4
  import { getCustomFunc } from "../../../../utils/events/event-util.js";
5
5
  import _sfc_main$2 from "./group-column.vue.js";
6
6
  import _sfc_main$3 from "./normal-column.vue.js";
@@ -78,6 +78,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
78
78
  const resultData = getChartDatasFromPage(props.pageContext, props.configure);
79
79
  if (resultData) {
80
80
  updateChartDatas(resultData);
81
+ } else {
82
+ if (props.configure.props.dataOrigin.dataSource === "variable") {
83
+ watchVariableDataChange();
84
+ const tmpTableData2 = getValueFromVariable(
85
+ props.pageContext.entity,
86
+ props.configure.props.dataOrigin.variable
87
+ );
88
+ if (tmpTableData2) {
89
+ loadTable(tmpTableData2, resultData);
90
+ }
91
+ }
81
92
  }
82
93
  });
83
94
  function watchVariableDataChange() {
@@ -169,12 +180,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
169
180
  }
170
181
  }
171
182
  if (Object.keys(dataFormulaMapping.value).length > 0 && tmpTableData2 && tmpTableData2.length > 0) {
172
- tmpTableData2.forEach((item) => {
173
- Object.keys(dataFormulaMapping.value).forEach((key) => {
174
- const formula = dataFormulaMapping.value[key];
175
- item[key] = computeFormula(item, formula);
176
- });
177
- });
183
+ computeFormula(dataFormulaMapping.value, tmpTableData2);
178
184
  }
179
185
  if ((_a2 = props.configure.pageination) == null ? void 0 : _a2.enable) {
180
186
  tableDataPageination(resultData);
@@ -1,8 +1,9 @@
1
- import { defineComponent, ref, openBlock, createBlock, unref, normalizeStyle, normalizeClass, createSlots, withCtx, createElementVNode, createElementBlock, Fragment, renderList, createCommentVNode, createTextVNode, toDisplayString } from "vue";
1
+ import { defineComponent, ref, onMounted, nextTick, openBlock, createBlock, unref, normalizeStyle, normalizeClass, createSlots, withCtx, createElementVNode, createElementBlock, Fragment, renderList, createCommentVNode, createTextVNode, toDisplayString } from "vue";
2
2
  import { ElCard } from "element-plus";
3
3
  import { SuperIcon } from "agilebuilder-ui";
4
4
  import _sfc_main$1 from "../../object-render.vue.js";
5
5
  import { $t } from "../../../../utils/i18n-util.js";
6
+ import { handleAfterInitEvent } from "../../../../utils/events/event-util.js";
6
7
  const _sfc_main = /* @__PURE__ */ defineComponent({
7
8
  __name: "card-runtime",
8
9
  props: {
@@ -23,6 +24,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
23
24
  function test() {
24
25
  props.configure.props.title = "teee";
25
26
  }
27
+ onMounted(() => {
28
+ nextTick(() => {
29
+ handleAfterInitEvent(null, props.pageContext, props.configure, {
30
+ componentRef: thisRef.value,
31
+ entity: props.pageContext.entity.data,
32
+ pageData: props.pageContext.entity.page
33
+ });
34
+ });
35
+ });
26
36
  __expose({
27
37
  test
28
38
  });
@@ -1,7 +1,8 @@
1
- import { defineComponent, ref, resolveComponent, openBlock, createBlock, unref, isRef, normalizeStyle, normalizeClass, withCtx, createElementBlock, Fragment, renderList, createElementVNode, createCommentVNode, createTextVNode, toDisplayString } from "vue";
1
+ import { defineComponent, ref, onMounted, nextTick, resolveComponent, openBlock, createBlock, unref, isRef, normalizeStyle, normalizeClass, withCtx, createElementBlock, Fragment, renderList, createElementVNode, createCommentVNode, createTextVNode, toDisplayString } from "vue";
2
2
  import _sfc_main$1 from "../../object-render.vue.js";
3
3
  import "../../../../utils/global-refs.js";
4
4
  import { $t } from "../../../../utils/i18n-util.js";
5
+ import { handleAfterInitEvent } from "../../../../utils/events/event-util.js";
5
6
  const _sfc_main = /* @__PURE__ */ defineComponent({
6
7
  __name: "collapse-runtime",
7
8
  props: {
@@ -20,6 +21,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
20
21
  const runtimeStyle = runtimeInfo.style;
21
22
  const runtimeClass = runtimeInfo.class;
22
23
  const headerStyle = runtimeInfo.headerStyle;
24
+ onMounted(() => {
25
+ nextTick(() => {
26
+ handleAfterInitEvent(null, props.pageContext, props.configure, {
27
+ componentRef: thisRef.value,
28
+ entity: props.pageContext.entity.data,
29
+ pageData: props.pageContext.entity.page
30
+ });
31
+ });
32
+ });
23
33
  return (_ctx, _cache) => {
24
34
  const _component_SuperIcon = resolveComponent("SuperIcon");
25
35
  const _component_el_collapse_item = resolveComponent("el-collapse-item");
@@ -1,6 +1,7 @@
1
- import { defineComponent, ref, resolveComponent, openBlock, createBlock, withCtx, normalizeStyle, unref, createElementBlock, Fragment, renderList, createCommentVNode, createVNode, normalizeClass } from "vue";
1
+ import { defineComponent, ref, onMounted, nextTick, resolveComponent, openBlock, createBlock, withCtx, normalizeStyle, unref, createElementBlock, Fragment, renderList, createCommentVNode, createVNode, normalizeClass } from "vue";
2
2
  import _sfc_main$1 from "../../object-render.vue.js";
3
3
  import "../../../../utils/global-refs.js";
4
+ import { handleAfterInitEvent } from "../../../../utils/events/event-util.js";
4
5
  const _sfc_main = /* @__PURE__ */ defineComponent({
5
6
  __name: "container-runtime",
6
7
  props: {
@@ -15,6 +16,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15
16
  const rightStyle = runtimeInfo.rightStyle;
16
17
  const mainStyle = runtimeInfo.style;
17
18
  const mainClass = runtimeInfo.class;
19
+ onMounted(() => {
20
+ nextTick(() => {
21
+ handleAfterInitEvent(null, props.pageContext, props.configure, {
22
+ componentRef: thisRef.value,
23
+ entity: props.pageContext.entity.data,
24
+ pageData: props.pageContext.entity.page
25
+ });
26
+ });
27
+ });
18
28
  return (_ctx, _cache) => {
19
29
  const _component_el_aside = resolveComponent("el-aside");
20
30
  const _component_el_main = resolveComponent("el-main");
@@ -1,6 +1,7 @@
1
- import { defineComponent, ref, resolveComponent, openBlock, createBlock, normalizeStyle, unref, normalizeClass, withCtx, createElementBlock, Fragment, renderList, withDirectives, createVNode, vShow } from "vue";
1
+ import { defineComponent, ref, onMounted, nextTick, resolveComponent, openBlock, createBlock, normalizeStyle, unref, normalizeClass, withCtx, createElementBlock, Fragment, renderList, withDirectives, createVNode, vShow } from "vue";
2
2
  import _sfc_main$1 from "../../object-render.vue.js";
3
3
  import { PageDimensions } from "../../../../utils/interfaces/page-design-types.js";
4
+ import { handleAfterInitEvent } from "../../../../utils/events/event-util.js";
4
5
  const _sfc_main = /* @__PURE__ */ defineComponent({
5
6
  __name: "flex-runtime",
6
7
  props: {
@@ -32,6 +33,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
32
33
  }
33
34
  }
34
35
  }
36
+ onMounted(() => {
37
+ nextTick(() => {
38
+ handleAfterInitEvent(null, props.pageContext, props.configure, {
39
+ componentRef: thisRef.value,
40
+ entity: props.pageContext.entity.data,
41
+ pageData: props.pageContext.entity.page
42
+ });
43
+ });
44
+ });
35
45
  return (_ctx, _cache) => {
36
46
  const _component_el_col = resolveComponent("el-col");
37
47
  const _component_el_row = resolveComponent("el-row");
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, resolveComponent, openBlock, createElementBlock, createVNode, unref, normalizeStyle, normalizeClass, withCtx, toDisplayString, createCommentVNode, Fragment, renderList, createBlock } from "vue";
1
+ import { defineComponent, ref, onMounted, nextTick, resolveComponent, openBlock, createElementBlock, createVNode, unref, normalizeStyle, normalizeClass, withCtx, toDisplayString, createCommentVNode, Fragment, renderList, createBlock } from "vue";
2
2
  import _sfc_main$1 from "../../object-render.vue.js";
3
3
  import "../../../../utils/global-refs.js";
4
4
  import "agilebuilder-ui/src/utils/common-util";
@@ -6,6 +6,7 @@ import "agilebuilder-ui/src/utils/util";
6
6
  import "agilebuilder-ui/src/utils/request";
7
7
  import "dayjs";
8
8
  import "agilebuilder-ui/src/utils/calculator/calculator-util";
9
+ import { handleAfterInitEvent } from "../../../../utils/events/event-util.js";
9
10
  const _sfc_main = /* @__PURE__ */ defineComponent({
10
11
  __name: "form-runtime",
11
12
  props: {
@@ -22,11 +23,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
22
23
  const runtimeStyle = ref(runtimeInfo.style ? runtimeInfo.style : {});
23
24
  const runtimeClass = runtimeInfo.class;
24
25
  const titleStyle = ref(runtimeInfo.titleStyle ? runtimeInfo.titleStyle : {});
26
+ const thisRef = ref(null);
27
+ onMounted(() => {
28
+ nextTick(() => {
29
+ handleAfterInitEvent(null, props.pageContext, props.configure, {
30
+ componentRef: thisRef.value,
31
+ entity: props.pageContext.entity.data,
32
+ pageData: props.pageContext.entity.page
33
+ });
34
+ });
35
+ });
25
36
  return (_ctx, _cache) => {
26
37
  const _component_el_form = resolveComponent("el-form");
27
38
  return openBlock(), createElementBlock("div", null, [
28
39
  createVNode(_component_el_form, {
29
- ref: "thisRef",
40
+ ref_key: "thisRef",
41
+ ref: thisRef,
30
42
  "label-width": unref(runtimeProps).labelWidth,
31
43
  "label-position": unref(runtimeProps).labelPosition,
32
44
  size: unref(runtimeProps).componentSize,