super-page-runtime 2.0.9 → 2.0.13
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.
- package/dist/es/components/runtime/utils/api/api-util.d.ts +6 -1
- package/dist/es/components/runtime/utils/api/api-util.js +140 -2
- package/dist/es/components/runtime/utils/charts/chart-columnline-util.js +279 -0
- package/dist/es/components/runtime/utils/charts/chart-gauge-util.js +74 -0
- package/dist/es/components/runtime/utils/charts/chart-pie-util.js +118 -0
- package/dist/es/components/runtime/utils/charts/chart-radar-util.js +100 -0
- package/dist/es/components/runtime/utils/charts/chart-scatter-util.js +74 -0
- package/dist/es/components/runtime/utils/charts/chart-util.d.ts +40 -0
- package/dist/es/components/runtime/utils/charts/chart-util.js +288 -14
- package/dist/es/components/runtime/utils/events/event-util.d.ts +5 -0
- package/dist/es/components/runtime/utils/events/event-util.js +42 -10
- package/dist/es/components/runtime/utils/events/standard-event.d.ts +1 -0
- package/dist/es/components/runtime/utils/events/standard-event.js +54 -5
- package/dist/es/components/runtime/utils/events/validator-util.d.ts +8 -0
- package/dist/es/components/runtime/utils/events/validator-util.js +83 -57
- package/dist/es/components/runtime/utils/interfaces/page-design-types.d.ts +0 -1
- package/dist/es/components/runtime/utils/page-helper-util.d.ts +22 -0
- package/dist/es/components/runtime/utils/page-helper-util.js +59 -50
- package/dist/es/components/runtime/utils/page-init-util.d.ts +1 -0
- package/dist/es/components/runtime/utils/page-init-util.js +29 -4
- package/dist/es/components/runtime/views/assemblys/button/dropdown/dropdown-runtime.vue2.js +8 -3
- package/dist/es/components/runtime/views/assemblys/chart/column-line/column-line-runtime.vue2.js +34 -322
- package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header.vue.js +2 -1
- package/dist/es/components/runtime/views/assemblys/chart/gauge/gauge-runtime.vue2.js +66 -12
- package/dist/es/components/runtime/views/assemblys/chart/pie/pie-runtime.vue2.js +91 -4
- package/dist/es/components/runtime/views/assemblys/chart/radar/radar-runtime.vue2.js +65 -4
- package/dist/es/components/runtime/views/assemblys/chart/scatter/scatter-runtime.vue2.js +65 -4
- package/dist/es/components/runtime/views/assemblys/container/tabs/tabs-runtime.vue2.js +36 -1
- package/dist/es/components/runtime/views/assemblys/data/table/main-table-runtime.vue.js +1 -1
- package/dist/es/components/runtime/views/assemblys/data/table/sub-table-runtime.vue.js +2 -4
- package/dist/es/components/runtime/views/assemblys/form/checkbox/checkbox-runtime.vue2.js +22 -58
- package/dist/es/components/runtime/views/assemblys/form/date-picker/datepicker-runtime.vue2.js +16 -3
- package/dist/es/components/runtime/views/assemblys/form/dept-tree/depttree-runtime.vue2.js +10 -1
- package/dist/es/components/runtime/views/assemblys/form/file-upload/fileupload-runtime.vue2.js +25 -2
- package/dist/es/components/runtime/views/assemblys/form/input-number/input-number-runtime.vue2.js +5 -1
- package/dist/es/components/runtime/views/assemblys/form/link/link-runtime.vue2.js +3 -2
- package/dist/es/components/runtime/views/assemblys/form/radio/radio-runtime.vue2.js +14 -11
- package/dist/es/components/runtime/views/assemblys/form/rich-text/richtext-runtime.vue2.js +2 -0
- package/dist/es/components/runtime/views/assemblys/form/select/select-runtime.vue2.js +14 -11
- package/dist/es/components/runtime/views/assemblys/form/switch/switch-runtime.vue2.js +3 -1
- package/dist/es/components/runtime/views/assemblys/form/tag/tag-runtime.vue2.js +4 -1
- package/dist/es/components/runtime/views/assemblys/form/textarea/textarea-runtime.vue2.js +7 -1
- package/dist/es/components/runtime/views/assemblys/object-render.vue.js +2 -1
- package/dist/es/components/runtime/views/assemblys/workflow/workflow-button/workflowbutton-runtime.vue2.js +1 -1
- package/dist/es/components/runtime/views/super-page-dialog.vue.js +3 -0
- package/dist/es/components/runtime/views/super-page.vue.js +84 -130
- package/dist/es/index.d.ts +2 -2
- package/dist/es/index.js +2 -1
- package/package.json +2 -2
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { getValueFromSource } from "../page-helper-util.js";
|
|
2
|
+
import { deepCopy } from "../common-util.js";
|
|
3
|
+
function updateChartOption(pageContext, configure, chartOption, resultData) {
|
|
4
|
+
if (!resultData || !resultData.result) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
const result = resultData && resultData.result ? resultData.result : {};
|
|
8
|
+
const dataSetField = configure.serviceDataField;
|
|
9
|
+
let datas = null;
|
|
10
|
+
if (dataSetField) {
|
|
11
|
+
datas = result[dataSetField];
|
|
12
|
+
} else {
|
|
13
|
+
if (result) {
|
|
14
|
+
if (Array.isArray(result)) {
|
|
15
|
+
datas = result;
|
|
16
|
+
} else {
|
|
17
|
+
datas = [result];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (!datas) {
|
|
22
|
+
datas = [];
|
|
23
|
+
}
|
|
24
|
+
const itemConfs = configure.items ? configure.items : [];
|
|
25
|
+
const dataConfs = [];
|
|
26
|
+
const dataValueMap = {};
|
|
27
|
+
for (let item of itemConfs) {
|
|
28
|
+
const itemProps = item.props ? item.props : {};
|
|
29
|
+
const sourceType = itemProps.yaxisSource;
|
|
30
|
+
const yaxisField = itemProps.yaxisField;
|
|
31
|
+
let dataConf = null;
|
|
32
|
+
if (yaxisField && (!sourceType || sourceType == "variable")) {
|
|
33
|
+
dataConf = {
|
|
34
|
+
uuid: item.uuid,
|
|
35
|
+
type: "variable",
|
|
36
|
+
field: yaxisField,
|
|
37
|
+
data: []
|
|
38
|
+
};
|
|
39
|
+
} else {
|
|
40
|
+
dataConf = {
|
|
41
|
+
uuid: item.uuid,
|
|
42
|
+
type: "fixed",
|
|
43
|
+
field: itemProps.yaxisFix,
|
|
44
|
+
data: []
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
if (dataConf) {
|
|
48
|
+
dataConfs.push(dataConf);
|
|
49
|
+
dataValueMap[dataConf.uuid] = dataConf;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const confProps = configure.props ? configure.props : {};
|
|
53
|
+
const nameField = confProps.nameField;
|
|
54
|
+
const maxSource = confProps.maxSource;
|
|
55
|
+
const maxField = confProps.maxField;
|
|
56
|
+
const maxFixed = confProps.maxFixed;
|
|
57
|
+
const indicators = [];
|
|
58
|
+
for (let d of datas) {
|
|
59
|
+
if (!d) {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
const name = getValueFromSource(d, nameField, void 0);
|
|
63
|
+
let maxValue = null;
|
|
64
|
+
if (!maxSource || maxSource == "variable") {
|
|
65
|
+
maxValue = getValueFromSource(d, maxField, void 0);
|
|
66
|
+
} else {
|
|
67
|
+
maxValue = maxFixed;
|
|
68
|
+
}
|
|
69
|
+
indicators.push({
|
|
70
|
+
text: name,
|
|
71
|
+
max: maxValue
|
|
72
|
+
});
|
|
73
|
+
for (let item of dataConfs) {
|
|
74
|
+
let data = item.data;
|
|
75
|
+
if (item.type == "fixed") {
|
|
76
|
+
data.push(item.field);
|
|
77
|
+
} else if (item.type == "variable") {
|
|
78
|
+
let value = getValueFromSource(d, item.field, void 0);
|
|
79
|
+
data.push(value);
|
|
80
|
+
} else {
|
|
81
|
+
data.push(void 0);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
chartOption.radar[0].indicator = indicators;
|
|
86
|
+
const defaultSeries = configure.defaultSeries;
|
|
87
|
+
console.log("defaultSeries", defaultSeries);
|
|
88
|
+
const tempSeries = deepCopy(defaultSeries);
|
|
89
|
+
const serieDatas = tempSeries[0].data;
|
|
90
|
+
for (let serieData of serieDatas) {
|
|
91
|
+
const dataValue = dataValueMap[serieData.uuid];
|
|
92
|
+
serieData.value = dataValue.data;
|
|
93
|
+
}
|
|
94
|
+
chartOption.series = tempSeries;
|
|
95
|
+
configure.cacheDatas = datas;
|
|
96
|
+
configure.rawResult = resultData;
|
|
97
|
+
}
|
|
98
|
+
export {
|
|
99
|
+
updateChartOption
|
|
100
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { getValueFromSource } from "../page-helper-util.js";
|
|
2
|
+
import { deepCopy } from "../common-util.js";
|
|
3
|
+
function updateChartOption(pageContext, configure, chartOption, resultData) {
|
|
4
|
+
if (!resultData || !resultData.result) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
const result = resultData && resultData.result ? resultData.result : {};
|
|
8
|
+
const dataSetField = configure.serviceDataField;
|
|
9
|
+
let datas = null;
|
|
10
|
+
if (dataSetField) {
|
|
11
|
+
datas = result[dataSetField];
|
|
12
|
+
} else {
|
|
13
|
+
if (result) {
|
|
14
|
+
if (Array.isArray(result)) {
|
|
15
|
+
datas = result;
|
|
16
|
+
} else {
|
|
17
|
+
datas = [result];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (!datas) {
|
|
22
|
+
datas = [];
|
|
23
|
+
}
|
|
24
|
+
const itemConfs = configure.items ? configure.items : [];
|
|
25
|
+
const dataConfs = [];
|
|
26
|
+
const dataValueMap = {};
|
|
27
|
+
for (let item of itemConfs) {
|
|
28
|
+
const itemProps = item.props ? item.props : {};
|
|
29
|
+
const itemStyle = item.props ? item.style : {};
|
|
30
|
+
const xaxisField = itemProps.yaxisField;
|
|
31
|
+
const yaxisField = itemProps.yaxisField;
|
|
32
|
+
const sizeField = itemProps.sizeField;
|
|
33
|
+
let dataConf = {
|
|
34
|
+
uuid: item.uuid,
|
|
35
|
+
xaxisField,
|
|
36
|
+
yaxisField,
|
|
37
|
+
sizeField,
|
|
38
|
+
symbolSize: itemStyle.symbolSize,
|
|
39
|
+
data: []
|
|
40
|
+
};
|
|
41
|
+
dataConfs.push(dataConf);
|
|
42
|
+
dataValueMap[dataConf.uuid] = dataConf;
|
|
43
|
+
}
|
|
44
|
+
for (let d of datas) {
|
|
45
|
+
if (!d) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
for (let item of dataConfs) {
|
|
49
|
+
let data = item.data;
|
|
50
|
+
const values = [];
|
|
51
|
+
values.push(getValueFromSource(d, item.xaxisField, void 0));
|
|
52
|
+
values.push(getValueFromSource(d, item.yaxisField, void 0));
|
|
53
|
+
if (item.sizeField) {
|
|
54
|
+
values.push(getValueFromSource(d, item.xaxisField, void 0));
|
|
55
|
+
} else {
|
|
56
|
+
values.push(item.symbolSize);
|
|
57
|
+
}
|
|
58
|
+
data.push(values);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const defaultSeries = configure.defaultSeries;
|
|
62
|
+
console.log("defaultSeries", defaultSeries);
|
|
63
|
+
const tempSeries = deepCopy(defaultSeries);
|
|
64
|
+
for (let serie of tempSeries) {
|
|
65
|
+
const dataValue = dataValueMap[serie.uuid];
|
|
66
|
+
serie.data = dataValue.data;
|
|
67
|
+
}
|
|
68
|
+
chartOption.series = tempSeries;
|
|
69
|
+
configure.cacheDatas = datas;
|
|
70
|
+
configure.rawResult = resultData;
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
updateChartOption
|
|
74
|
+
};
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import { PageContext, Component } from '../interfaces/page-design-types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 统计图通用字段名
|
|
5
|
+
*/
|
|
6
|
+
export declare enum CommonName {
|
|
7
|
+
X_FIELD_NAME = "__x"
|
|
8
|
+
}
|
|
1
9
|
/**
|
|
2
10
|
* 获取主题对象
|
|
3
11
|
* @param themeName 获取自定义的主题名称
|
|
@@ -9,3 +17,35 @@ export declare function getCustomTheme(themeName: string): any;
|
|
|
9
17
|
* @returns
|
|
10
18
|
*/
|
|
11
19
|
export declare function getCustomThemeOptions(): Array<any>;
|
|
20
|
+
/**
|
|
21
|
+
* 获取数据的格式化方法
|
|
22
|
+
* @param labelNumFormat
|
|
23
|
+
* @param labelNumPrecision
|
|
24
|
+
* @param isValueFormatter 是否值格式化,value: number | string, dataIndex: number
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
export declare function getNumFormatter(labelNumFormat: any, numPrecision: any, numPrefix: any, numAppend: any, isValueFormatter: any): (params: any) => any;
|
|
28
|
+
/**
|
|
29
|
+
* 初始化格式化方法
|
|
30
|
+
* @param pageContext
|
|
31
|
+
* @param configure
|
|
32
|
+
* @param chartOption
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
export declare function initChartOption(configure: Component, chartOption: any): void;
|
|
36
|
+
/**
|
|
37
|
+
* 统计图选中时把维度值设置到变量中
|
|
38
|
+
* @param pageContext
|
|
39
|
+
* @param configure
|
|
40
|
+
* @param chart
|
|
41
|
+
* @param variable
|
|
42
|
+
*/
|
|
43
|
+
export declare function monitorChartClickToVariable(pageContext: PageContext, configure: Component, chart: any, variable: string): void;
|
|
44
|
+
export declare function sortDatas(pageContext: PageContext, configure: Component, datas: Array<any>): void;
|
|
45
|
+
/**
|
|
46
|
+
* 限制显示数量
|
|
47
|
+
* @param datas
|
|
48
|
+
* @param groupFields
|
|
49
|
+
* @param limitNum
|
|
50
|
+
*/
|
|
51
|
+
export declare function limitDatas(pageContext: PageContext, configure: Component, datas: Array<any>, groupFields: Array<string>, numFields: Array<string>): Array<any>;
|
|
@@ -1,28 +1,302 @@
|
|
|
1
1
|
import theme1 from "../../../../assets/chart-themes/theme1.js";
|
|
2
2
|
import theme2 from "../../../../assets/chart-themes/theme2.js";
|
|
3
3
|
import theme3 from "../../../../assets/chart-themes/theme3.js";
|
|
4
|
+
import { getValueFromSource, setValueForVariableName, formatVariableValue } from "../page-helper-util.js";
|
|
5
|
+
var CommonName = /* @__PURE__ */ ((CommonName2) => {
|
|
6
|
+
CommonName2["X_FIELD_NAME"] = "__x";
|
|
7
|
+
return CommonName2;
|
|
8
|
+
})(CommonName || {});
|
|
4
9
|
const themeMap = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
10
|
+
theme1,
|
|
11
|
+
theme2,
|
|
12
|
+
theme3
|
|
8
13
|
};
|
|
9
14
|
function getCustomTheme(themeName) {
|
|
10
15
|
console.log("getdd", themeName);
|
|
11
16
|
return themeMap[themeName];
|
|
12
17
|
}
|
|
13
18
|
function getCustomThemeOptions() {
|
|
14
|
-
return [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
return [
|
|
20
|
+
{
|
|
21
|
+
value: "theme1",
|
|
22
|
+
label: "主题1"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: "theme2",
|
|
26
|
+
label: "主题2"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
value: "theme3",
|
|
30
|
+
label: "主题3"
|
|
31
|
+
}
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
function getNumFormatter(labelNumFormat, numPrecision, numPrefix, numAppend, isValueFormatter) {
|
|
35
|
+
const func = function(params) {
|
|
36
|
+
let labelValue = params.value;
|
|
37
|
+
if (isValueFormatter) {
|
|
38
|
+
labelValue = params;
|
|
39
|
+
}
|
|
40
|
+
if (labelValue == void 0 || labelValue == null) {
|
|
41
|
+
return labelValue;
|
|
42
|
+
}
|
|
43
|
+
if (Array.isArray(labelValue)) {
|
|
44
|
+
console.log("numformatter is array", labelValue);
|
|
45
|
+
return labelValue;
|
|
46
|
+
}
|
|
47
|
+
if (isNaN(labelValue) || !labelNumFormat || !labelNumFormat.indexOf) {
|
|
48
|
+
return labelValue;
|
|
49
|
+
}
|
|
50
|
+
if (labelNumFormat.indexOf("precision") > -1) {
|
|
51
|
+
let precision = parseInt(numPrecision);
|
|
52
|
+
if (precision == null || isNaN(precision)) {
|
|
53
|
+
precision = 2;
|
|
54
|
+
}
|
|
55
|
+
labelValue = parseFloat(parseFloat(labelValue).toFixed(precision));
|
|
56
|
+
}
|
|
57
|
+
let prefix = "";
|
|
58
|
+
if (labelNumFormat.indexOf("prefix") > -1 && numPrefix) {
|
|
59
|
+
prefix = numPrefix;
|
|
60
|
+
}
|
|
61
|
+
let append = "";
|
|
62
|
+
if (labelNumFormat.indexOf("append") > -1 && numAppend) {
|
|
63
|
+
append = numAppend;
|
|
64
|
+
}
|
|
65
|
+
return prefix + labelValue.toLocaleString() + append;
|
|
66
|
+
};
|
|
67
|
+
return func;
|
|
68
|
+
}
|
|
69
|
+
function initChartOption(configure, chartOption) {
|
|
70
|
+
if (!chartOption) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (chartOption.tooltipFormatterArgs) {
|
|
74
|
+
if (!chartOption.tooltip) {
|
|
75
|
+
chartOption.tooltip = {};
|
|
76
|
+
}
|
|
77
|
+
chartOption.tooltip.valueFormatter = getNumFormatter.apply(
|
|
78
|
+
chartOption,
|
|
79
|
+
chartOption.tooltipFormatterArgs
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
if (chartOption.series) {
|
|
83
|
+
const enableDrill = configure.props ? configure.props.enableDrill : null;
|
|
84
|
+
const selGroupVariable = configure.props ? configure.props.selGroupVariable : null;
|
|
85
|
+
for (let s of chartOption.series) {
|
|
86
|
+
if (!chartOption.radar) {
|
|
87
|
+
s.data = [];
|
|
88
|
+
}
|
|
89
|
+
if (s.labelFormatterArgs) {
|
|
90
|
+
if (!s.label) {
|
|
91
|
+
s.label = {};
|
|
92
|
+
}
|
|
93
|
+
s.label.formatter = getNumFormatter.apply(s, s.labelFormatterArgs);
|
|
94
|
+
}
|
|
95
|
+
if (!enableDrill && selGroupVariable) {
|
|
96
|
+
if (s.emphasis) {
|
|
97
|
+
s.emphasis.disabled = false;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (chartOption.radar) {
|
|
103
|
+
for (let r of chartOption.radar) {
|
|
104
|
+
r.indicator = [];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const defaultSeries = chartOption.series;
|
|
108
|
+
configure.defaultSeries = defaultSeries;
|
|
109
|
+
const defaultXaxis = chartOption.xAxis;
|
|
110
|
+
if (defaultXaxis && defaultXaxis.length > 0 && defaultXaxis[0].data) {
|
|
111
|
+
defaultXaxis[0].data = [];
|
|
112
|
+
}
|
|
113
|
+
configure.defaultXaxis = defaultXaxis;
|
|
114
|
+
const defaultYaxis = chartOption.yAxis;
|
|
115
|
+
if (defaultYaxis) {
|
|
116
|
+
for (let yAxis of defaultYaxis) {
|
|
117
|
+
if (yAxis.data) {
|
|
118
|
+
yAxis.data = [];
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
configure.defaultYaxis = defaultYaxis;
|
|
123
|
+
}
|
|
124
|
+
function monitorChartClickToVariable(pageContext, configure, chart, variable) {
|
|
125
|
+
if (!chart || !variable || !configure || !pageContext) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
chart.on("click", function(params) {
|
|
129
|
+
let highlightInfos = configure.highlightInfos;
|
|
130
|
+
let hasSelect = false;
|
|
131
|
+
let selGroupValue = null;
|
|
132
|
+
if (highlightInfos) {
|
|
133
|
+
for (let i = 0; i < highlightInfos.length; i++) {
|
|
134
|
+
let info = highlightInfos[i];
|
|
135
|
+
chart.dispatchAction({
|
|
136
|
+
type: "downplay",
|
|
137
|
+
seriesIndex: info.seriesIndex,
|
|
138
|
+
dataIndex: info.dataIndex
|
|
139
|
+
});
|
|
140
|
+
if (info.seriesIndex == params.seriesIndex && info.dataIndex == params.dataIndex) {
|
|
141
|
+
hasSelect = true;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
highlightInfos = [];
|
|
146
|
+
if (!hasSelect) {
|
|
147
|
+
chart.dispatchAction({
|
|
148
|
+
type: "highlight",
|
|
149
|
+
seriesIndex: params.seriesIndex,
|
|
150
|
+
dataIndex: params.dataIndex
|
|
151
|
+
});
|
|
152
|
+
highlightInfos.push({
|
|
153
|
+
seriesIndex: params.seriesIndex,
|
|
154
|
+
dataIndex: params.dataIndex
|
|
155
|
+
});
|
|
156
|
+
const caheDatas = configure.cacheDatas;
|
|
157
|
+
const groupFields = configure.groupFields;
|
|
158
|
+
console.log("selsssss", caheDatas, groupFields);
|
|
159
|
+
if (caheDatas && params.dataIndex < caheDatas.length && groupFields && configure.groupFields.length > 0) {
|
|
160
|
+
const data = caheDatas[params.dataIndex];
|
|
161
|
+
selGroupValue = getValueFromSource(data, groupFields[0], void 0);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
configure.highlightInfos = highlightInfos;
|
|
165
|
+
setValueForVariableName(pageContext.entity, variable, selGroupValue);
|
|
166
|
+
console.log("variable params", params);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
function sortDatas(pageContext, configure, datas) {
|
|
170
|
+
const itemConfs = configure.items ? configure.items : [];
|
|
171
|
+
let orderByTarget = configure.props ? configure.props.orderByTarget : "";
|
|
172
|
+
let orderField = null;
|
|
173
|
+
if (orderByTarget == "x" || orderByTarget == "X") {
|
|
174
|
+
orderField = "__x";
|
|
175
|
+
} else if (orderByTarget) {
|
|
176
|
+
for (let item of itemConfs) {
|
|
177
|
+
if (item.uuid == orderByTarget) {
|
|
178
|
+
const itemProps = item.props ? item.props : {};
|
|
179
|
+
const sourceType = itemProps.yaxisSource;
|
|
180
|
+
const yaxisField = itemProps.yaxisField;
|
|
181
|
+
if (yaxisField && (!sourceType || sourceType == "variable")) {
|
|
182
|
+
orderField = yaxisField;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (!orderField) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
let orderSource = configure.props ? configure.props.orderSource : "";
|
|
192
|
+
let orderValue = configure.props ? configure.props.orderFix : "";
|
|
193
|
+
if (orderSource == "variable") {
|
|
194
|
+
let orderVariable = configure.props ? configure.props.orderVariable : "";
|
|
195
|
+
orderValue = formatVariableValue(pageContext, orderVariable);
|
|
196
|
+
}
|
|
197
|
+
orderValue = orderValue == "desc" || orderValue == "DESC" ? "desc" : "asc";
|
|
198
|
+
let maxLen = datas.length;
|
|
199
|
+
for (let i = 0; i < maxLen - 1; i++) {
|
|
200
|
+
let vali = getValueFromSource(datas[i], orderField, void 0);
|
|
201
|
+
for (let j = i + 1; j < maxLen; j++) {
|
|
202
|
+
let valj = getValueFromSource(datas[j], orderField, void 0);
|
|
203
|
+
let isSwap = false;
|
|
204
|
+
if ("desc" == orderValue) {
|
|
205
|
+
if (vali < valj) {
|
|
206
|
+
isSwap = true;
|
|
207
|
+
}
|
|
208
|
+
} else {
|
|
209
|
+
if (vali > valj) {
|
|
210
|
+
isSwap = true;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
if (isSwap) {
|
|
214
|
+
[datas[i], datas[j]] = [datas[j], datas[i]];
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
function limitDatas(pageContext, configure, datas, groupFields, numFields) {
|
|
220
|
+
if (!datas) {
|
|
221
|
+
return datas;
|
|
222
|
+
}
|
|
223
|
+
const confProps = configure.props ? configure.props : {};
|
|
224
|
+
if (!confProps.limitQuantity) {
|
|
225
|
+
return datas;
|
|
226
|
+
}
|
|
227
|
+
let limitNum = null;
|
|
228
|
+
if (confProps.itemNumVariable) {
|
|
229
|
+
limitNum = formatVariableValue(pageContext, confProps.itemNumVariable);
|
|
230
|
+
limitNum = parseInt(limitNum);
|
|
231
|
+
} else {
|
|
232
|
+
limitNum = confProps.itemNumFix ? confProps.itemNumFix : 10;
|
|
233
|
+
}
|
|
234
|
+
if (limitNum == null || limitNum == void 0 || isNaN(limitNum)) {
|
|
235
|
+
return datas;
|
|
236
|
+
}
|
|
237
|
+
if (datas.length < limitNum) {
|
|
238
|
+
return datas;
|
|
239
|
+
}
|
|
240
|
+
const overItemAlias = confProps.overItemAlias;
|
|
241
|
+
const newDatas = [];
|
|
242
|
+
const otherData = {};
|
|
243
|
+
groupFields = groupFields ? groupFields : [];
|
|
244
|
+
numFields = numFields ? numFields : [];
|
|
245
|
+
for (let i = 0; i < datas.length; i++) {
|
|
246
|
+
const data = datas[i];
|
|
247
|
+
if (i < limitNum) {
|
|
248
|
+
newDatas.push(data);
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
if (!overItemAlias) {
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
for (let groupField of groupFields) {
|
|
255
|
+
if (!groupField) {
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
let value = getValueFromSource(data, groupField, void 0);
|
|
259
|
+
value = value == null || value == void 0 ? "" : value;
|
|
260
|
+
if (!otherData[groupField]) {
|
|
261
|
+
otherData[groupField] = [];
|
|
262
|
+
}
|
|
263
|
+
const existValues = otherData[groupField];
|
|
264
|
+
if (!existValues.includes(value)) {
|
|
265
|
+
existValues.push(value);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
for (let numField of numFields) {
|
|
269
|
+
if (!numField) {
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
let value = getValueFromSource(data, numField, void 0);
|
|
273
|
+
if (isNaN(value)) {
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
const hisValue = otherData[numField];
|
|
277
|
+
if (isNaN(hisValue)) {
|
|
278
|
+
otherData[numField] = value;
|
|
279
|
+
} else {
|
|
280
|
+
otherData[numField] = value + hisValue;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
if (overItemAlias) {
|
|
285
|
+
otherData[
|
|
286
|
+
"__x"
|
|
287
|
+
/* X_FIELD_NAME */
|
|
288
|
+
] = overItemAlias;
|
|
289
|
+
newDatas.push(otherData);
|
|
290
|
+
}
|
|
291
|
+
return newDatas;
|
|
24
292
|
}
|
|
25
293
|
export {
|
|
294
|
+
CommonName,
|
|
26
295
|
getCustomTheme,
|
|
27
|
-
getCustomThemeOptions
|
|
296
|
+
getCustomThemeOptions,
|
|
297
|
+
getNumFormatter,
|
|
298
|
+
initChartOption,
|
|
299
|
+
limitDatas,
|
|
300
|
+
monitorChartClickToVariable,
|
|
301
|
+
sortDatas
|
|
28
302
|
};
|
|
@@ -12,6 +12,7 @@ export declare function initPageEvents(pageDesign: PageDesign, pageContext: Page
|
|
|
12
12
|
export declare function removeCustomFuncFromWindow(pageDesign: PageDesign): void;
|
|
13
13
|
export declare function handleEvent($event: any, pageContext: PageContext, configure: Component, eventType: string, otherParams?: object): any;
|
|
14
14
|
export declare function getHandleEvent($event: any, pageContext: PageContext, configure: Component, eventType: string, otherParams?: object): any;
|
|
15
|
+
export declare function handleEventByEventName(pageContext: PageContext, configure: Component, eventName: string, otherParams?: object): any;
|
|
15
16
|
export declare function doBeforeClickEvent(pageContext: PageContext, configure: Component, otherParams?: object): any;
|
|
16
17
|
export declare function doAfterClickEvent(pageContext: PageContext, configure: Component, otherParams?: object): void;
|
|
17
18
|
/**
|
|
@@ -46,3 +47,7 @@ export declare function cellDblClick(pageContext: any, configureObj: any, params
|
|
|
46
47
|
export declare function rowClick(pageContext: any, configureObj: any, params: any): any;
|
|
47
48
|
export declare function rowDblClick(pageContext: any, configureObj: any, params: any): any;
|
|
48
49
|
export declare function headerClick(pageContext: any, configureObj: any, params: any): any;
|
|
50
|
+
export declare function fileUploadBeforeUpload(params: any): any;
|
|
51
|
+
export declare function fileUploadUploaded(pageContext: any, configureObj: any, params: any): any;
|
|
52
|
+
export declare function fileUploadBeforeDelete(pageContext: any, configureObj: any, params: any): any;
|
|
53
|
+
export declare function fileUploadDeleted(pageContext: any, configureObj: any, params: any): any;
|
|
@@ -6,6 +6,10 @@ import { ElMessage } from "element-plus";
|
|
|
6
6
|
import { analysisCondition } from "agilebuilder-ui/src/utils/util";
|
|
7
7
|
import { getListCode } from "../common-util.js";
|
|
8
8
|
import eventBus from "../eventBus.js";
|
|
9
|
+
import "agilebuilder-ui/src/utils/request";
|
|
10
|
+
import "dayjs";
|
|
11
|
+
import "agilebuilder-ui/src/utils/calculator/calculator-util";
|
|
12
|
+
import "vue";
|
|
9
13
|
function initPageEvents(pageDesign, pageContext) {
|
|
10
14
|
if (pageDesign && pageDesign.customEvents) {
|
|
11
15
|
pageContext.customEvents = transferToFunction(pageDesign.customEvents);
|
|
@@ -31,10 +35,10 @@ function getHandleEvent($event, pageContext, configure, eventType, otherParams)
|
|
|
31
35
|
function handleEventUtil($event, pageContext, configure, eventType, isExecute, otherParams) {
|
|
32
36
|
const pageCode = pageContext.code;
|
|
33
37
|
const pageVersion = pageContext.version;
|
|
34
|
-
const events = configure.events;
|
|
38
|
+
const events = configure.runtime && configure.runtime.events ? configure.runtime.events : [];
|
|
35
39
|
const componentType = configure.name;
|
|
36
40
|
let eventFun;
|
|
37
|
-
if (eventType && eventType === "click" && componentType === "button-detail") {
|
|
41
|
+
if (eventType && eventType === "click" && (componentType === "button-detail" || componentType === "link")) {
|
|
38
42
|
const tableUuid = configure.props.base.tableUuid ? configure.props.base.tableUuid : pageContext.tableUuids && pageContext.tableUuids.length > 0 ? pageContext.tableUuids[0] : null;
|
|
39
43
|
if (tableUuid) {
|
|
40
44
|
const gridRef = getComponentRef(pageContext, tableUuid);
|
|
@@ -65,6 +69,13 @@ function handleEventUtil($event, pageContext, configure, eventType, isExecute, o
|
|
|
65
69
|
}
|
|
66
70
|
}
|
|
67
71
|
}
|
|
72
|
+
function handleEventByEventName(pageContext, configure, eventName, otherParams) {
|
|
73
|
+
const eventFun = getEventByEventName(pageContext, eventName);
|
|
74
|
+
if (eventFun) {
|
|
75
|
+
const eventParams = packageEventParams(pageContext, configure, null, otherParams);
|
|
76
|
+
return callItemEvent(pageContext, configure, eventFun, eventParams);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
68
79
|
function packageEventParams(pageContext, configureObj, $event, otherParams) {
|
|
69
80
|
const params = {};
|
|
70
81
|
if (otherParams) {
|
|
@@ -75,8 +86,12 @@ function packageEventParams(pageContext, configureObj, $event, otherParams) {
|
|
|
75
86
|
if ($event !== void 0 && $event !== null) {
|
|
76
87
|
params["_value"] = $event;
|
|
77
88
|
}
|
|
78
|
-
|
|
79
|
-
|
|
89
|
+
if (pageContext) {
|
|
90
|
+
params["pageContext"] = pageContext;
|
|
91
|
+
}
|
|
92
|
+
if (configureObj) {
|
|
93
|
+
params["configureObj"] = configureObj;
|
|
94
|
+
}
|
|
80
95
|
return params;
|
|
81
96
|
}
|
|
82
97
|
function buttonClickEvent(pageContext, configure, eventParams) {
|
|
@@ -86,7 +101,7 @@ function buttonClickEvent(pageContext, configure, eventParams) {
|
|
|
86
101
|
}
|
|
87
102
|
canExecuteButton(eventParams).then((result) => {
|
|
88
103
|
if (result["canExecute"] === true) {
|
|
89
|
-
const events = configure.events;
|
|
104
|
+
const events = configure.runtime && configure.runtime.events ? configure.runtime.events : [];
|
|
90
105
|
const beforeValidateFormFunc = getEventFuncByType(pageContext, events, "beforeValidateForm");
|
|
91
106
|
let beforeValidateFormResult;
|
|
92
107
|
if (beforeValidateFormFunc) {
|
|
@@ -116,7 +131,7 @@ function buttonClickEvent(pageContext, configure, eventParams) {
|
|
|
116
131
|
});
|
|
117
132
|
}
|
|
118
133
|
function doValidateForm(pageContext, configure, eventParams) {
|
|
119
|
-
const events = configure.events;
|
|
134
|
+
const events = configure.runtime && configure.runtime.events ? configure.runtime.events : [];
|
|
120
135
|
let isEnableRequired;
|
|
121
136
|
const clickEventFunObj = getClickEventFuncByType(pageContext, events, "click");
|
|
122
137
|
if (clickEventFunObj) {
|
|
@@ -145,7 +160,7 @@ function doValidateForm(pageContext, configure, eventParams) {
|
|
|
145
160
|
}
|
|
146
161
|
function doBeforeClickEvent(pageContext, configure, otherParams) {
|
|
147
162
|
let result = true;
|
|
148
|
-
const events = configure.events;
|
|
163
|
+
const events = configure.runtime && configure.runtime.events ? configure.runtime.events : [];
|
|
149
164
|
const beforeClickFunc = getEventFuncByType(pageContext, events, "beforeClick");
|
|
150
165
|
let beforeClickResult;
|
|
151
166
|
if (beforeClickFunc) {
|
|
@@ -211,7 +226,7 @@ function isNotNeedValidateRequired(isStandardEvent, clickEvent) {
|
|
|
211
226
|
return isStandardEvent && (clickEvent.eventName === "downloadTemplate" || clickEvent.eventName === "back" || clickEvent.eventName === "exportForm" || clickEvent.eventName === "exportPDF" || clickEvent.eventName === "lineEditCreate");
|
|
212
227
|
}
|
|
213
228
|
function doAfterClickEvent(pageContext, configure, otherParams) {
|
|
214
|
-
const events = configure.events;
|
|
229
|
+
const events = configure.runtime && configure.runtime.events ? configure.runtime.events : [];
|
|
215
230
|
const afterClickFunc = getEventFuncByType(pageContext, events, "afterClick");
|
|
216
231
|
if (afterClickFunc) {
|
|
217
232
|
callItemEvent(pageContext, configure, afterClickFunc, null, otherParams);
|
|
@@ -229,7 +244,7 @@ function doAfterClickFunc(pageContext, configure, eventParams, isStandardEvent,
|
|
|
229
244
|
} else {
|
|
230
245
|
pageContext.result = result;
|
|
231
246
|
}
|
|
232
|
-
const events = configure.events;
|
|
247
|
+
const events = configure.runtime && configure.runtime.events ? configure.runtime.events : [];
|
|
233
248
|
const afterClickFunc = getEventFuncByType(pageContext, events, "afterClick");
|
|
234
249
|
if (afterClickFunc) {
|
|
235
250
|
callItemEvent(pageContext, configure, afterClickFunc, eventParams);
|
|
@@ -245,7 +260,7 @@ function doClickEvent(pageContext, configure, clickEventFunObj, eventParams) {
|
|
|
245
260
|
}
|
|
246
261
|
function getEventByEventName(pageContext, eventName) {
|
|
247
262
|
const eventsObj = pageContext.customEvents;
|
|
248
|
-
if (eventsObj && eventsObj[eventName]) {
|
|
263
|
+
if (eventsObj && eventName && eventsObj[eventName]) {
|
|
249
264
|
return eventsObj[eventName];
|
|
250
265
|
}
|
|
251
266
|
}
|
|
@@ -504,12 +519,28 @@ function rowDblClick(pageContext, configureObj, params) {
|
|
|
504
519
|
function headerClick(pageContext, configureObj, params) {
|
|
505
520
|
return handleEvent(null, pageContext, configureObj, "header-click", params);
|
|
506
521
|
}
|
|
522
|
+
function fileUploadBeforeUpload(params) {
|
|
523
|
+
return getHandleEvent(null, params.pageContext, params.configureObj, "before-upload", params);
|
|
524
|
+
}
|
|
525
|
+
function fileUploadUploaded(pageContext, configureObj, params) {
|
|
526
|
+
return handleEvent(null, pageContext, configureObj, "uploaded", params);
|
|
527
|
+
}
|
|
528
|
+
function fileUploadBeforeDelete(pageContext, configureObj, params) {
|
|
529
|
+
return handleEvent(null, pageContext, configureObj, "before-delete", params);
|
|
530
|
+
}
|
|
531
|
+
function fileUploadDeleted(pageContext, configureObj, params) {
|
|
532
|
+
return handleEvent(null, pageContext, configureObj, "deleted", params);
|
|
533
|
+
}
|
|
507
534
|
export {
|
|
508
535
|
canExecuteButton,
|
|
509
536
|
cellClick,
|
|
510
537
|
cellDblClick,
|
|
511
538
|
doAfterClickEvent,
|
|
512
539
|
doBeforeClickEvent,
|
|
540
|
+
fileUploadBeforeDelete,
|
|
541
|
+
fileUploadBeforeUpload,
|
|
542
|
+
fileUploadDeleted,
|
|
543
|
+
fileUploadUploaded,
|
|
513
544
|
getClickEventFuncByType,
|
|
514
545
|
getEventFuncByType,
|
|
515
546
|
getHandleEvent,
|
|
@@ -517,6 +548,7 @@ export {
|
|
|
517
548
|
gridSelectRecord,
|
|
518
549
|
gridSelectionChange,
|
|
519
550
|
handleEvent,
|
|
551
|
+
handleEventByEventName,
|
|
520
552
|
headerClick,
|
|
521
553
|
initPageEvents,
|
|
522
554
|
removeCustomFuncFromWindow,
|