super-page-runtime 2.1.45 → 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 (32) 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 +23 -5
  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/custom/custom-runtime.vue2.js +9 -2
  25. package/dist/es/components/runtime/views/assemblys/form/input-text/inputtext-runtime.vue2.js +3 -1
  26. package/dist/es/components/runtime/views/assemblys/form/placeholder/placeholder-runtime.vue.js +1 -1
  27. package/dist/es/components/runtime/views/assemblys/form/select/select-runtime.vue2.js +4 -1
  28. package/dist/es/components/runtime/views/super-page-dialog.vue.d.ts +4 -0
  29. package/dist/es/components/runtime/views/super-page-dialog.vue.js +5 -1
  30. package/dist/es/components/runtime/views/super-page.vue.js +4 -4
  31. package/package.json +2 -2
  32. package/dist/es/components/runtime/views/assemblys/form/placeholder/placeholder-runtime.vue3.js +0 -1
@@ -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
  });
@@ -1,13 +1,14 @@
1
1
  import { defineComponent, ref, onMounted, watch, onUnmounted, resolveComponent, openBlock, createElementBlock, createVNode, unref } from "vue";
2
2
  import "agilebuilder-ui";
3
- import { setTableEvents, getEventFuncByType, canExecuteButton, doAfterClickEvent, getEventNameByType, doBeforeClickEvent, getHandleEvent, gridSelectRecord, gridSelectAllRecords, gridSelectionChange, cellClick, cellDblClick, rowClick, rowDblClick, headerClick } from "../../../../utils/events/event-util.js";
3
+ import { setTableEvents, canExecuteButton, doAfterClickEvent, getEventNameByType, doBeforeClickEvent, getHandleEvent, gridSelectRecord, gridSelectAllRecords, gridSelectionChange, cellClick, cellDblClick, rowClick, rowDblClick, headerClick } from "../../../../utils/events/event-util.js";
4
4
  import { getBaseUrl, getListCode, getRealRestApiPath } from "../../../../utils/common-util.js";
5
5
  import { getAdditionalParamMap, getSaveFormRequestWithRow, standardEvents } from "../../../../utils/events/standard-event.js";
6
6
  import { isPromise } from "agilebuilder-ui/src/utils/common-util";
7
7
  import { getDataTypeMapRequest, popupToPage } from "../../../../utils/table-utils.js";
8
8
  import eventBus from "../../../../utils/eventBus.js";
9
9
  import { getPermissionCodes, getDefaultValue } from "../../../../utils/page-init-util.js";
10
- import { getSizeConfig } from "../../../../utils/page-helper-util.js";
10
+ import { decomposeVariable, getSizeConfig } from "../../../../utils/page-helper-util.js";
11
+ import { getRowStyleUtil, getCellStyleUtil, getHeaderCellStyleUtil } from "../../chart/table/chart-table-util.js";
11
12
  const _sfc_main = /* @__PURE__ */ defineComponent({
12
13
  __name: "main-table-runtime",
13
14
  props: {
@@ -88,12 +89,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
88
89
  searchGridData(props.pageContext.entity.data);
89
90
  }
90
91
  );
91
- watch(
92
- () => props.pageContext.entity.page,
93
- (searchFormData) => {
94
- searchGridData(props.pageContext.entity.page);
92
+ const linkageVariable = [];
93
+ if (configure.props.linkages && configure.props.linkages.length > 0) {
94
+ configure.props.linkages.forEach((linkage) => {
95
+ const variablePath = decomposeVariable(linkage.fieldName);
96
+ if (variablePath && variablePath.length > 1) {
97
+ linkageVariable.push(variablePath[1]);
98
+ }
99
+ });
100
+ if (linkageVariable.length > 0) {
101
+ linkageVariable.forEach((variable) => {
102
+ watch(
103
+ () => props.pageContext.entity.page[variable],
104
+ () => {
105
+ const values = getLinkageVariableValues();
106
+ searchGridData(values);
107
+ }
108
+ );
109
+ });
95
110
  }
96
- );
111
+ }
97
112
  onUnmounted(() => {
98
113
  eventBus.$off(eventPageInfo + "-close-component-page-dialog");
99
114
  eventBus.$off(eventPageInfo + "_close-dialog-get-entity");
@@ -151,7 +166,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
151
166
  tableClass: runtimeClass,
152
167
  tableStyle: runtimeStyle,
153
168
  pageContext,
154
- configureObj: configure
169
+ configureObj: configure,
170
+ backendUrl: baseURL,
171
+ cellStyleRender: getCellStyle,
172
+ rowStyleRender: getRowStyle,
173
+ titleStyleRender: getTitleStyle
155
174
  };
156
175
  setOperationButtons(options);
157
176
  setSortInfo(options);
@@ -251,10 +270,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
251
270
  const customEvents = pageContext.customEvents;
252
271
  if (customEvents) {
253
272
  options.eventCallBack = customEvents;
254
- const rowStyleEvent = getEventFuncByType(pageContext, tableEvents, "rowStyle");
255
- if (rowStyleEvent) {
256
- options.rowStyleRender = rowStyleEvent;
257
- }
258
273
  }
259
274
  }
260
275
  function enterSave({ rowIndex, column, row, orgRow }) {
@@ -568,8 +583,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
568
583
  if (!thisRefDom) {
569
584
  thisRefDom = gridRef.value;
570
585
  }
571
- const parentNode = thisRefDom.parentNode;
572
- if (!thisRefDom || !parentNode) {
586
+ if (!thisRefDom) {
573
587
  return;
574
588
  }
575
589
  const rect = thisRefDom.getBoundingClientRect();
@@ -698,6 +712,24 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
698
712
  function canShowMobileSearch(listCode2) {
699
713
  isCanShowMobileSearch.value = true;
700
714
  }
715
+ function getLinkageVariableValues() {
716
+ const values = {};
717
+ linkageVariable.forEach((variable) => {
718
+ values[variable] = props.pageContext.entity.page[variable];
719
+ });
720
+ return values;
721
+ }
722
+ function getRowStyle(data) {
723
+ return getRowStyleUtil(data, null, props);
724
+ }
725
+ function getCellStyle(data) {
726
+ return getCellStyleUtil(data, data.cellStyle, props);
727
+ }
728
+ function getTitleStyle(data) {
729
+ const cellTitleStyle = data.titleStyle;
730
+ const rowTitleStyle = props.configure.style.titleStyle;
731
+ return getHeaderCellStyleUtil(data, { cellTitleStyle, titleStyle: rowTitleStyle }, props);
732
+ }
701
733
  __expose({
702
734
  refresh,
703
735
  createRow,
@@ -4,8 +4,9 @@ import { getSizeConfig, getVariableValue, setVariableValue } from "../../../../u
4
4
  import { getModelFields, getDefaultValue } from "../../../../utils/page-init-util.js";
5
5
  import eventBus from "../../../../utils/eventBus.js";
6
6
  import { popupToPage } from "../../../../utils/table-utils.js";
7
- import { getListCode } from "../../../../utils/common-util.js";
7
+ import { getListCode, getBaseUrl } from "../../../../utils/common-util.js";
8
8
  import { getAdditionalParamMap } from "../../../../utils/events/standard-event.js";
9
+ import { getRowStyleUtil, getCellStyleUtil, getHeaderCellStyleUtil } from "../../chart/table/chart-table-util.js";
9
10
  const _sfc_main = /* @__PURE__ */ defineComponent({
10
11
  __name: "sub-table-runtime",
11
12
  props: {
@@ -30,9 +31,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
30
31
  const runtimeClass = runtimeInfo.class;
31
32
  const entity = props.pageContext.entity ? props.pageContext.entity : {};
32
33
  let dynamicFields = getModelFields(props.configure, prop);
34
+ let baseURL = getBaseUrl(pageContext.backendUrl, pageContext.isTest);
35
+ if (!baseURL) {
36
+ baseURL = window["$vueApp"].config.globalProperties.baseURL;
37
+ }
33
38
  const listViewShowFlag = ref(false);
34
39
  let componentKey = ref(0);
35
- const baseURL = window["$vueApp"].config.globalProperties.baseURL;
36
40
  const listViewOptions = ref({
37
41
  isSql: true,
38
42
  subTableData: null,
@@ -44,8 +48,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
44
48
  pageContext,
45
49
  configureObj: configure,
46
50
  showPageArea: false,
47
- showOverflowTooltip: !!(configure.props && configure.props.otherSettings && (configure.props.otherSettings.isBreakLine === void 0 || configure.props.otherSettings.isBreakLine === false))
51
+ showRowForm: false,
52
+ showOverflowTooltip: !!(configure.props && configure.props.otherSettings && (configure.props.otherSettings.isBreakLine === void 0 || configure.props.otherSettings.isBreakLine === false)),
48
53
  // 单元格内容是否换行显示
54
+ backendUrl: baseURL,
55
+ cellStyleRender: getCellStyle,
56
+ rowStyleRender: getRowStyle,
57
+ titleStyleRender: getTitleStyle
49
58
  });
50
59
  if (runtimeStyle) {
51
60
  listViewOptions.value["tableStyle"] = runtimeStyle;
@@ -58,6 +67,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
58
67
  } else {
59
68
  listViewOptions.value.showPageArea = false;
60
69
  }
70
+ if (configure.props.base.showRowForm) {
71
+ listViewOptions.value.showRowForm = configure.props.base.showRowForm;
72
+ }
61
73
  const gridRef = ref(null);
62
74
  onMounted(() => {
63
75
  const tableUuid = configure.uuid;
@@ -112,6 +124,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
112
124
  listViewOptions.value["getFormData"] = getParentFormData;
113
125
  listViewOptions.value["getGridData"] = getGridData;
114
126
  listViewOptions.value.extraParam["subTableListViewCode"] = listCode;
127
+ listViewOptions.value.extraParam["beanName"] = pageContext.beanName;
115
128
  listViewOptions.value.extraParam["subtableSetting"] = configure.props && configure.props.otherSettings ? JSON.stringify(configure.props.otherSettings) : null;
116
129
  listViewOptions.value.extraParam["additionalParamMap"] = additionalParamMap;
117
130
  listViewOptions.value.extraParam["entityMap"] = pageContext.entity.data;
@@ -483,6 +496,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
483
496
  }
484
497
  }, 10);
485
498
  }
499
+ function getRowStyle(data) {
500
+ return getRowStyleUtil(data, null, props);
501
+ }
502
+ function getCellStyle(data) {
503
+ return getCellStyleUtil(data, data.cellStyle, props);
504
+ }
505
+ function getTitleStyle(data) {
506
+ const cellTitleStyle = data.titleStyle;
507
+ const rowTitleStyle = props.configure.style.titleStyle;
508
+ return getHeaderCellStyleUtil(data, { cellTitleStyle, titleStyle: rowTitleStyle }, props);
509
+ }
486
510
  __expose({
487
511
  createRow,
488
512
  getSelections,
@@ -500,7 +524,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
500
524
  key: 0,
501
525
  ref_key: "gridRef",
502
526
  ref: gridRef,
503
- url: unref(baseURL) + "/common/super-forms/sub-table",
527
+ url: unref(baseURL) + "/dsc/commons/sub-table",
504
528
  options: listViewOptions.value,
505
529
  code: unref(listCode),
506
530
  settings: unref(superGridSetting),
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, computed, ref, onMounted, onUnmounted, resolveComponent, openBlock, createBlock, normalizeClass, unref, normalizeStyle, withCtx, createElementBlock, toDisplayString, createCommentVNode, resolveDynamicComponent } from "vue";
2
2
  import { getFormModelFields } from "../../../../utils/page-init-util.js";
3
- import { getVariableValue, setVariableValue, getFormPropName, setVariableValueWithProp } from "../../../../utils/page-helper-util.js";
3
+ import { getVariableValue, setVariableValue, formatVariableValue, getFormPropName, setVariableValueWithProp } from "../../../../utils/page-helper-util.js";
4
4
  import { handleEvent } from "../../../../utils/events/event-util.js";
5
5
  import { updateFormItemEditState } from "../../../../utils/events/validator-util.js";
6
6
  import { getListCode } from "../../../../utils/common-util.js";
@@ -40,7 +40,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
40
40
  const runtimeClass = runtimeInfo.class;
41
41
  const headerStyle = runtimeInfo.headerStyle;
42
42
  const designProperty = ref(runtimeInfo.props ? runtimeInfo.props : {});
43
- const customParams = runtimeInfo.customParams ? runtimeInfo.customParams : {};
43
+ const customParams = getCustomParams(runtimeInfo.customParams ? runtimeInfo.customParams : {});
44
44
  const additionalParamMap = getAdditionalParamMap(props.pageContext);
45
45
  const componentName = ref(
46
46
  props.configure.props && props.configure.props.base ? props.configure.props.base.name : null
@@ -52,6 +52,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
52
52
  }
53
53
  props.pageContext.customValidatorUuids.push(props.configure.uuid);
54
54
  }
55
+ function getCustomParams(customParams2) {
56
+ if (customParams2) {
57
+ for (let key in customParams2) {
58
+ customParams2.value[key] = formatVariableValue(props.pageContext, key);
59
+ }
60
+ }
61
+ }
55
62
  function customControlSetValue(prop, value) {
56
63
  setVariableValueWithProp(entity, prop, value);
57
64
  }
@@ -66,7 +66,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
66
66
  userAgent = "browser";
67
67
  }
68
68
  console.log("window.location.protocol---", window.location.protocol);
69
- const isShowScanIcon = ref(isMobile.value && scanEnable.value && window.location.protocol === "https:" ? true : false);
69
+ const isShowScanIcon = ref(
70
+ isMobile.value && scanEnable.value && window.location.protocol === "https:" ? true : false
71
+ );
70
72
  const isApk = isMobile.value && userAgent && userAgent === "app" ? true : false;
71
73
  let scanRuleSets = {};
72
74
  if (((_b = designProperty.value.scan) == null ? void 0 : _b.enable) && ((_c = designProperty.value.scan.ruleList) == null ? void 0 : _c.length) > 0) {
@@ -1,5 +1,5 @@
1
1
  import _sfc_main from "./placeholder-runtime.vue2.js";
2
- import "./placeholder-runtime.vue3.js";
2
+ /* empty css */
3
3
  import _export_sfc from "../../../../../../_virtual/_plugin-vue_export-helper.js";
4
4
  const placeholderRuntime = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-a0860ff0"]]);
5
5
  export {