@ztocwst/rc-pro-materials 0.2.14 → 0.2.16
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +5 -5
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +13 -8
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +14 -9
- package/dist/SCM_Comps.css +2 -2
- package/dist/SCM_Comps.js +14 -9
- package/dist/SCM_Comps.js.map +1 -1
- package/es/components/z-templates-data-common/components/dim-target/index.js +1 -1
- package/es/components/z-templates-data-common/components/link-renderer/index.d.ts +1 -1
- package/es/components/z-templates-data-common/components/link-renderer/index.js +59 -38
- package/es/components/z-templates-data-common/components/table-renderer/table-renderer.helper.d.ts +2 -1
- package/es/components/z-templates-data-common/components/table-renderer/table-renderer.helper.js +26 -24
- package/es/components/z-templates-data-common/data-common.d.ts +4 -0
- package/es/components/z-templates-data-common/data-common.helper.js +3 -3
- package/es/style.js +2 -2
- package/es/utils/props/form.d.ts +1 -1
- package/lib/components/z-templates-data-common/components/dim-target/index.js +1 -1
- package/lib/components/z-templates-data-common/components/link-renderer/index.d.ts +1 -1
- package/lib/components/z-templates-data-common/components/link-renderer/index.js +59 -38
- package/lib/components/z-templates-data-common/components/table-renderer/table-renderer.helper.d.ts +2 -1
- package/lib/components/z-templates-data-common/components/table-renderer/table-renderer.helper.js +26 -24
- package/lib/components/z-templates-data-common/data-common.d.ts +4 -0
- package/lib/components/z-templates-data-common/data-common.helper.js +3 -3
- package/lib/style.js +1 -1
- package/lib/utils/props/form.d.ts +1 -1
- package/package.json +4 -4
|
@@ -423,7 +423,7 @@ var DimTarget = function DimTarget(_ref) {
|
|
|
423
423
|
}, remember ? /*#__PURE__*/React.createElement(_Checkbox, {
|
|
424
424
|
checked: rememberCheck,
|
|
425
425
|
onChange: rememberCheckChange
|
|
426
|
-
}, "
|
|
426
|
+
}, ' ', "\u8BB0\u4F4F\u52FE\u9009") : null, buttons.length ? /*#__PURE__*/React.createElement(ProButton, {
|
|
427
427
|
items: buttons
|
|
428
428
|
}) : null) : null);
|
|
429
429
|
};
|
|
@@ -8,7 +8,7 @@ export interface linkParamsType extends Pick<TypeChartSettingProps, 'dataSetName
|
|
|
8
8
|
dimension?: CheckboxValueType[];
|
|
9
9
|
record?: Record<string, any>;
|
|
10
10
|
}
|
|
11
|
-
export interface linkStateType extends linkParamsType, Pick<TypeChartSettingProps, 'chartTitle' | 'title' | 'autoLoad' | 'refreshRate'> {
|
|
11
|
+
export interface linkStateType extends linkParamsType, Pick<TypeChartSettingProps, 'chartTitle' | 'custom' | 'child' | 'title' | 'autoLoad' | 'refreshRate'> {
|
|
12
12
|
}
|
|
13
13
|
declare const LinkRenderer: (props: Pick<TypeChartSettingProps, "onConfirm" | "chartRef" | "dimJson" | "linkPage" | "linkPageTitle"> & {
|
|
14
14
|
onBack?: () => void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _Spin from "antd/es/spin";
|
|
1
2
|
import _Radio from "antd/es/radio";
|
|
2
3
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
4
|
import _extends from "@babel/runtime/helpers/extends";
|
|
@@ -9,12 +10,13 @@ import { tableConfigDefault, separator, timeUnit, getMaxWidth, handleQueryParams
|
|
|
9
10
|
import { handleDimTargetFormat, handleColumns } from "../table-renderer/table-renderer.helper";
|
|
10
11
|
import "./index.less";
|
|
11
12
|
var linkStateDefault = {
|
|
13
|
+
custom: false,
|
|
12
14
|
dataSetName: '',
|
|
13
15
|
autoLoad: false,
|
|
14
16
|
refreshRate: 0
|
|
15
17
|
};
|
|
16
18
|
var LinkRenderer = function LinkRenderer(props) {
|
|
17
|
-
var _tableOptions$paginat, _linkPage$filter;
|
|
19
|
+
var _tableOptions$paginat, _linkPage$filter, _linkState$child;
|
|
18
20
|
var dimJson = props.dimJson,
|
|
19
21
|
linkPage = props.linkPage,
|
|
20
22
|
linkPageTitle = props.linkPageTitle,
|
|
@@ -29,6 +31,12 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
29
31
|
var _useState = useState(linkStateDefault),
|
|
30
32
|
linkState = _useState[0],
|
|
31
33
|
setLinkState = _useState[1];
|
|
34
|
+
var _useState2 = useState(),
|
|
35
|
+
result = _useState2[0],
|
|
36
|
+
setResult = _useState2[1];
|
|
37
|
+
var _useState3 = useState(false),
|
|
38
|
+
loading = _useState3[0],
|
|
39
|
+
setLoading = _useState3[1];
|
|
32
40
|
var tableRef = useRef(null);
|
|
33
41
|
var queryCacheRef = useRef(null);
|
|
34
42
|
var timer = null;
|
|
@@ -40,9 +48,17 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
40
48
|
};
|
|
41
49
|
useEffect(function () {
|
|
42
50
|
var dataSetName = linkState.dataSetName,
|
|
51
|
+
custom = linkState.custom,
|
|
43
52
|
autoLoad = linkState.autoLoad,
|
|
44
53
|
refreshRate = linkState.refreshRate;
|
|
45
54
|
if (dataSetName) {
|
|
55
|
+
if (custom) {
|
|
56
|
+
setResult(null);
|
|
57
|
+
} else {
|
|
58
|
+
setTimeout(function () {
|
|
59
|
+
return handleUpdateColumns(linkState);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
46
62
|
if (autoLoad) {
|
|
47
63
|
if (refreshRate) {
|
|
48
64
|
handleClearInterval();
|
|
@@ -59,7 +75,7 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
59
75
|
return function () {
|
|
60
76
|
handleClearInterval();
|
|
61
77
|
};
|
|
62
|
-
}, [linkState.dataSetName, linkState.index, linkState.autoLoad]);
|
|
78
|
+
}, [linkState.dataSetName, linkState.index, linkState.custom, linkState.autoLoad]);
|
|
63
79
|
|
|
64
80
|
// 获取表头
|
|
65
81
|
var handleGetColumns = function handleGetColumns(stateParams) {
|
|
@@ -77,10 +93,10 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
77
93
|
return handleColumns(option);
|
|
78
94
|
};
|
|
79
95
|
var handleUpdateColumns = function handleUpdateColumns(stateParams) {
|
|
80
|
-
var _tableRef$current;
|
|
96
|
+
var _tableRef$current, _tableRef$current$upd;
|
|
81
97
|
var columns = handleGetColumns(_extends({}, stateParams));
|
|
82
98
|
// 更新表头
|
|
83
|
-
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.updateColumns(columns);
|
|
99
|
+
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : (_tableRef$current$upd = _tableRef$current.updateColumns) === null || _tableRef$current$upd === void 0 ? void 0 : _tableRef$current$upd.call(_tableRef$current, columns);
|
|
84
100
|
};
|
|
85
101
|
var getDataSource = /*#__PURE__*/function () {
|
|
86
102
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
|
|
@@ -150,16 +166,30 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
150
166
|
dataSetName: dataSetName
|
|
151
167
|
});
|
|
152
168
|
queryData = formatter ? formatter === null || formatter === void 0 ? void 0 : formatter(data) : data;
|
|
169
|
+
if (linkState.custom) {
|
|
170
|
+
setLoading(true);
|
|
171
|
+
}
|
|
153
172
|
return _context.abrupt("return", getReportData(rcProContext, queryData).then(function (_ref4) {
|
|
154
173
|
var success = _ref4.success,
|
|
155
174
|
_ref4$result = _ref4.result,
|
|
156
175
|
result = _ref4$result === void 0 ? {} : _ref4$result;
|
|
176
|
+
if (linkState.custom) {
|
|
177
|
+
setLoading(false);
|
|
178
|
+
if (success) {
|
|
179
|
+
setResult(result);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
157
182
|
return {
|
|
158
183
|
success: success,
|
|
159
184
|
result: result
|
|
160
185
|
};
|
|
186
|
+
})["catch"](function () {
|
|
187
|
+
if (linkState.custom) {
|
|
188
|
+
setLoading(false);
|
|
189
|
+
setResult(null);
|
|
190
|
+
}
|
|
161
191
|
}));
|
|
162
|
-
case
|
|
192
|
+
case 16:
|
|
163
193
|
case "end":
|
|
164
194
|
return _context.stop();
|
|
165
195
|
}
|
|
@@ -171,8 +201,8 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
171
201
|
}();
|
|
172
202
|
|
|
173
203
|
/** 初始linkState */
|
|
174
|
-
var initial = function initial(
|
|
175
|
-
var _ref5 =
|
|
204
|
+
var initial = function initial(paramsState) {
|
|
205
|
+
var _ref5 = paramsState || {},
|
|
176
206
|
dataSetName = _ref5.dataSetName;
|
|
177
207
|
/** 二级页未配置 或 自定义dataSetName配错 直接返回 */
|
|
178
208
|
var Length = linkPage === null || linkPage === void 0 ? void 0 : linkPage.length;
|
|
@@ -182,7 +212,7 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
182
212
|
if (!Length || !isHave) return;
|
|
183
213
|
|
|
184
214
|
/** 可以传入二级页下标 */
|
|
185
|
-
var index =
|
|
215
|
+
var index = paramsState.index || 0;
|
|
186
216
|
/** 检查传入二级下标 是否为数字 */
|
|
187
217
|
var isNumber = typeof index === 'number';
|
|
188
218
|
|
|
@@ -207,35 +237,33 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
207
237
|
}
|
|
208
238
|
}
|
|
209
239
|
}
|
|
210
|
-
var
|
|
211
|
-
|
|
212
|
-
title = _linkPage$index2.title,
|
|
213
|
-
autoLoad = _linkPage$index2.autoLoad,
|
|
214
|
-
refreshRate = _linkPage$index2.refreshRate;
|
|
215
|
-
var stateData = _extends({}, state, {
|
|
240
|
+
var currentState = linkPage[index];
|
|
241
|
+
var stateData = _extends({}, paramsState, currentState, {
|
|
216
242
|
width: width,
|
|
217
|
-
index: index
|
|
218
|
-
chartTitle: chartTitle,
|
|
219
|
-
title: title,
|
|
220
|
-
autoLoad: autoLoad,
|
|
221
|
-
refreshRate: refreshRate
|
|
243
|
+
index: index
|
|
222
244
|
});
|
|
223
245
|
/** 当前进入与上次进入link页不同时需要清空数据 */
|
|
224
246
|
var isSource = "" + stateData.dataSetName + separator + index === "" + linkState.dataSetName + separator + (linkState === null || linkState === void 0 ? void 0 : linkState.index);
|
|
225
247
|
var isSame = JSON.stringify(stateData === null || stateData === void 0 ? void 0 : stateData.record) === JSON.stringify(linkState === null || linkState === void 0 ? void 0 : linkState.record);
|
|
226
|
-
if (!isSource || !isSame) {
|
|
248
|
+
if (!currentState.custom && (!isSource || !isSame)) {
|
|
227
249
|
var _tableRef$current2, _tableRef$current2$up;
|
|
228
250
|
(_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : (_tableRef$current2$up = _tableRef$current2.updateDataSource) === null || _tableRef$current2$up === void 0 ? void 0 : _tableRef$current2$up.call(_tableRef$current2, []);
|
|
229
251
|
}
|
|
230
|
-
handleUpdateColumns(stateData);
|
|
231
252
|
setLinkState(stateData);
|
|
232
253
|
};
|
|
233
254
|
var queryChart = function queryChart(value) {
|
|
234
|
-
var _tableRef$current3;
|
|
235
255
|
queryCacheRef.current = value;
|
|
236
|
-
(
|
|
237
|
-
|
|
238
|
-
|
|
256
|
+
if (linkState.custom) {
|
|
257
|
+
getDataSource({
|
|
258
|
+
pageNum: undefined,
|
|
259
|
+
pageSize: undefined
|
|
260
|
+
});
|
|
261
|
+
} else {
|
|
262
|
+
var _tableRef$current3;
|
|
263
|
+
(_tableRef$current3 = tableRef.current) === null || _tableRef$current3 === void 0 ? void 0 : _tableRef$current3.refreshTable({
|
|
264
|
+
current: 1
|
|
265
|
+
});
|
|
266
|
+
}
|
|
239
267
|
};
|
|
240
268
|
useImperativeHandle(chartRef, function () {
|
|
241
269
|
return {
|
|
@@ -251,20 +279,11 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
251
279
|
var _ref6 = (value === null || value === void 0 ? void 0 : value.split(separator)) || [],
|
|
252
280
|
dataSetName = _ref6[0],
|
|
253
281
|
index = _ref6[1];
|
|
254
|
-
var
|
|
255
|
-
|
|
256
|
-
title = _linkPage$index3.title,
|
|
257
|
-
autoLoad = _linkPage$index3.autoLoad,
|
|
258
|
-
refreshRate = _linkPage$index3.refreshRate;
|
|
259
|
-
var stateData = _extends({}, linkState, {
|
|
282
|
+
var currentState = linkPage[index];
|
|
283
|
+
var stateData = _extends({}, linkState, currentState, {
|
|
260
284
|
dataSetName: dataSetName,
|
|
261
|
-
index: index
|
|
262
|
-
chartTitle: chartTitle,
|
|
263
|
-
title: title,
|
|
264
|
-
autoLoad: autoLoad,
|
|
265
|
-
refreshRate: refreshRate
|
|
285
|
+
index: index
|
|
266
286
|
});
|
|
267
|
-
handleUpdateColumns(stateData);
|
|
268
287
|
setLinkState(stateData);
|
|
269
288
|
};
|
|
270
289
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
@@ -289,7 +308,9 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
289
308
|
width: linkState.width
|
|
290
309
|
}
|
|
291
310
|
}, field === null || field === void 0 ? void 0 : field.title)) : null;
|
|
292
|
-
}))), /*#__PURE__*/React.createElement(
|
|
311
|
+
}))), linkState.custom ? /*#__PURE__*/React.createElement(_Spin, {
|
|
312
|
+
spinning: loading
|
|
313
|
+
}, (_linkState$child = linkState.child) === null || _linkState$child === void 0 ? void 0 : _linkState$child.call(linkState, result)) : /*#__PURE__*/React.createElement(ProTable, {
|
|
293
314
|
ref: tableRef,
|
|
294
315
|
config: _extends({}, tableConfigDefault, {
|
|
295
316
|
pagination: {
|
package/es/components/z-templates-data-common/components/table-renderer/table-renderer.helper.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export declare const getDimTargetData: (rcProContext: any, params: Record<string
|
|
|
46
46
|
/**
|
|
47
47
|
* 数据渲染格式处理
|
|
48
48
|
*/
|
|
49
|
-
export declare const handleValueFormat: (value: valueType, record: Record<string, any>,
|
|
49
|
+
export declare const handleValueFormat: (value: valueType, record: Record<string, any>, config?: Record<string, any>, condition?: any[], onLink?: () => void) => any;
|
|
50
50
|
/**
|
|
51
51
|
* 条件格式
|
|
52
52
|
*/
|
|
@@ -60,5 +60,6 @@ export declare const handleColumns: (option: DimTargetChangeOptionType, expressi
|
|
|
60
60
|
ellipsis: boolean;
|
|
61
61
|
sorter: any;
|
|
62
62
|
width: any;
|
|
63
|
+
fixed: any;
|
|
63
64
|
render: (value: valueType, record: Record<string, any>) => any;
|
|
64
65
|
}[];
|
package/es/components/z-templates-data-common/components/table-renderer/table-renderer.helper.js
CHANGED
|
@@ -141,21 +141,21 @@ export var getDimTargetData = /*#__PURE__*/function () {
|
|
|
141
141
|
/**
|
|
142
142
|
* 数据渲染格式处理
|
|
143
143
|
*/
|
|
144
|
-
export var handleValueFormat = function handleValueFormat(value, record,
|
|
144
|
+
export var handleValueFormat = function handleValueFormat(value, record, config, condition, onLink) {
|
|
145
145
|
var _val;
|
|
146
146
|
var val = value;
|
|
147
147
|
if (typeof value === 'number') {
|
|
148
|
-
if (!(
|
|
149
|
-
val = handleDecimal(val,
|
|
148
|
+
if (!(config !== null && config !== void 0 && config.percent) && typeof (config === null || config === void 0 ? void 0 : config.precision) === 'number') {
|
|
149
|
+
val = handleDecimal(val, config.precision);
|
|
150
150
|
}
|
|
151
|
-
if (
|
|
151
|
+
if (config !== null && config !== void 0 && config.thousand) {
|
|
152
152
|
val = handleThousand(val);
|
|
153
153
|
}
|
|
154
|
-
if (
|
|
155
|
-
val = handlePercent(val,
|
|
154
|
+
if (config !== null && config !== void 0 && config.percent) {
|
|
155
|
+
val = handlePercent(val, config.precision);
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
-
if (
|
|
158
|
+
if (config !== null && config !== void 0 && config.link) {
|
|
159
159
|
val = handleLink(value, onLink);
|
|
160
160
|
}
|
|
161
161
|
if (condition !== null && condition !== void 0 && condition.length) {
|
|
@@ -174,47 +174,49 @@ export var handleValueFormat = function handleValueFormat(value, record, find, c
|
|
|
174
174
|
export var handleColumns = function handleColumns(option, expressions, linkPage, onLink) {
|
|
175
175
|
var dimTarget = [].concat(option.dimension, option.index);
|
|
176
176
|
return dimTarget.map(function (title) {
|
|
177
|
-
var
|
|
178
|
-
var
|
|
177
|
+
var _config3, _config3$link, _config4, _config5, _config6, _title$toString, _config7, _config8, _config9;
|
|
178
|
+
var config;
|
|
179
179
|
var dataIndex;
|
|
180
180
|
var condition;
|
|
181
|
-
if (!
|
|
182
|
-
var _option$dimensionSour,
|
|
181
|
+
if (!config) {
|
|
182
|
+
var _option$dimensionSour, _config;
|
|
183
183
|
/* 通过别名或名称 查找当前维度的配置 */
|
|
184
|
-
|
|
184
|
+
config = (_option$dimensionSour = option.dimensionSource) === null || _option$dimensionSour === void 0 ? void 0 : _option$dimensionSour.find(function (item) {
|
|
185
185
|
return item.alias === title || item.description === title;
|
|
186
186
|
});
|
|
187
|
-
dataIndex = (
|
|
187
|
+
dataIndex = (_config = config) === null || _config === void 0 ? void 0 : _config.description;
|
|
188
188
|
}
|
|
189
|
-
if (!
|
|
190
|
-
var _option$indexSource,
|
|
189
|
+
if (!config) {
|
|
190
|
+
var _option$indexSource, _config2;
|
|
191
191
|
/* 通过别名或名称 查找当前指标的配置 */
|
|
192
|
-
|
|
192
|
+
config = (_option$indexSource = option.indexSource) === null || _option$indexSource === void 0 ? void 0 : _option$indexSource.find(function (item) {
|
|
193
193
|
return item.alias === title || item.name === title;
|
|
194
194
|
});
|
|
195
|
-
dataIndex = (
|
|
195
|
+
dataIndex = (_config2 = config) === null || _config2 === void 0 ? void 0 : _config2.name;
|
|
196
196
|
}
|
|
197
197
|
/* 条件格式设置 */
|
|
198
198
|
// if (expressions?.length) {
|
|
199
|
-
// condition = expressions?.filter((item) => item?.index?.includes(
|
|
199
|
+
// condition = expressions?.filter((item) => item?.index?.includes(config?.name));
|
|
200
200
|
// }
|
|
201
201
|
|
|
202
|
-
var _ref4 = ((
|
|
202
|
+
var _ref4 = ((_config3 = config) === null || _config3 === void 0 ? void 0 : (_config3$link = _config3.link) === null || _config3$link === void 0 ? void 0 : _config3$link.split(separator)) || [],
|
|
203
203
|
dataSetName = _ref4[0];
|
|
204
204
|
var index;
|
|
205
|
-
if ((
|
|
205
|
+
if ((_config4 = config) !== null && _config4 !== void 0 && _config4.link && linkPage !== null && linkPage !== void 0 && linkPage.length) {
|
|
206
206
|
index = linkPage.findIndex(function (link) {
|
|
207
|
-
return "" + link.dataSetName + separator + link.title ===
|
|
207
|
+
return "" + link.dataSetName + separator + link.title === config.link;
|
|
208
208
|
});
|
|
209
209
|
}
|
|
210
210
|
return {
|
|
211
211
|
title: title,
|
|
212
212
|
dataIndex: dataIndex,
|
|
213
213
|
ellipsis: true,
|
|
214
|
-
sorter: (
|
|
215
|
-
width: ((
|
|
214
|
+
sorter: (_config5 = config) === null || _config5 === void 0 ? void 0 : _config5.sorted,
|
|
215
|
+
width: ((_config6 = config) === null || _config6 === void 0 ? void 0 : _config6.width) || computeWidth(title === null || title === void 0 ? void 0 : (_title$toString = title.toString()) === null || _title$toString === void 0 ? void 0 : _title$toString.length),
|
|
216
|
+
fixed: (_config7 = config) !== null && _config7 !== void 0 && _config7.isFixed ? ((_config8 = config) === null || _config8 === void 0 ? void 0 : _config8.fixed) || ((_config9 = config) === null || _config9 === void 0 ? void 0 : _config9.isFixed) : false,
|
|
216
217
|
render: function render(value, record) {
|
|
217
|
-
|
|
218
|
+
var _config$render, _config10;
|
|
219
|
+
return config.custom ? (_config$render = (_config10 = config).render) === null || _config$render === void 0 ? void 0 : _config$render.call(_config10, value, record, config, condition) : handleValueFormat(value, record, config, condition, function () {
|
|
218
220
|
return onLink({
|
|
219
221
|
dataSetName: dataSetName,
|
|
220
222
|
index: index,
|
|
@@ -37,6 +37,10 @@ export interface TypeTargetProps {
|
|
|
37
37
|
export interface TypeChartSettingProps {
|
|
38
38
|
/** 二级页标题 */
|
|
39
39
|
chartTitle?: string;
|
|
40
|
+
/** 自定义渲染 */
|
|
41
|
+
custom?: boolean;
|
|
42
|
+
/** 自定义渲染方法 */
|
|
43
|
+
child?: (p: any) => React.ReactNode;
|
|
40
44
|
/** 标题 */
|
|
41
45
|
title?: string;
|
|
42
46
|
/** 维度配置 */
|
|
@@ -157,7 +157,7 @@ export var handleCondition = function handleCondition(value, handledValue, condi
|
|
|
157
157
|
};
|
|
158
158
|
|
|
159
159
|
// mock
|
|
160
|
-
var token = 'scm:tenant:token:2:104:
|
|
160
|
+
var token = 'scm:tenant:token:2:104:DB0D80CD71B76AF4A8858729478BA945';
|
|
161
161
|
|
|
162
162
|
/** 获取维度指标 */
|
|
163
163
|
export var getDimTarget = /*#__PURE__*/function () {
|
|
@@ -168,7 +168,7 @@ export var getDimTarget = /*#__PURE__*/function () {
|
|
|
168
168
|
while (1) switch (_context.prev = _context.next) {
|
|
169
169
|
case 0:
|
|
170
170
|
_ref2 = rcProContext || {}, materialsRequest = _ref2.materialsRequest, env = _ref2.env, data_env_mapping = _ref2.data_env_mapping;
|
|
171
|
-
__env = (_data_env_mapping$env = data_env_mapping === null || data_env_mapping === void 0 ? void 0 : data_env_mapping[env]) !== null && _data_env_mapping$env !== void 0 ? _data_env_mapping$env : data_env_mapping === null || data_env_mapping === void 0 ? void 0 : data_env_mapping
|
|
171
|
+
__env = (_data_env_mapping$env = data_env_mapping === null || data_env_mapping === void 0 ? void 0 : data_env_mapping[env]) !== null && _data_env_mapping$env !== void 0 ? _data_env_mapping$env : data_env_mapping === null || data_env_mapping === void 0 ? void 0 : data_env_mapping.__other; // 供应链里由子应用透传
|
|
172
172
|
if (!materialsRequest) {
|
|
173
173
|
_context.next = 7;
|
|
174
174
|
break;
|
|
@@ -230,7 +230,7 @@ export var getReportData = /*#__PURE__*/function () {
|
|
|
230
230
|
while (1) switch (_context2.prev = _context2.next) {
|
|
231
231
|
case 0:
|
|
232
232
|
_ref4 = rcProContext || {}, materialsRequest = _ref4.materialsRequest, env = _ref4.env, data_env_mapping = _ref4.data_env_mapping;
|
|
233
|
-
__env = (_data_env_mapping$env2 = data_env_mapping === null || data_env_mapping === void 0 ? void 0 : data_env_mapping[env]) !== null && _data_env_mapping$env2 !== void 0 ? _data_env_mapping$env2 : data_env_mapping === null || data_env_mapping === void 0 ? void 0 : data_env_mapping
|
|
233
|
+
__env = (_data_env_mapping$env2 = data_env_mapping === null || data_env_mapping === void 0 ? void 0 : data_env_mapping[env]) !== null && _data_env_mapping$env2 !== void 0 ? _data_env_mapping$env2 : data_env_mapping === null || data_env_mapping === void 0 ? void 0 : data_env_mapping.__other; // 供应链里由子应用透传
|
|
234
234
|
if (!materialsRequest) {
|
|
235
235
|
_context2.next = 7;
|
|
236
236
|
break;
|
package/es/style.js
CHANGED
|
@@ -9,8 +9,8 @@ import 'antd/lib/col/style';
|
|
|
9
9
|
import 'antd/lib/message/style';
|
|
10
10
|
import 'antd/lib/tabs/style';
|
|
11
11
|
import 'antd/lib/checkbox/style';
|
|
12
|
-
import 'antd/lib/radio/style';
|
|
13
12
|
import 'antd/lib/spin/style';
|
|
13
|
+
import 'antd/lib/radio/style';
|
|
14
14
|
import 'antd/lib/carousel/style';
|
|
15
15
|
import 'antd/es/statistic/style';
|
|
16
16
|
import 'antd/es/progress/style';
|
|
@@ -21,7 +21,7 @@ import 'antd/es/col/style';
|
|
|
21
21
|
import 'antd/es/message/style';
|
|
22
22
|
import 'antd/es/tabs/style';
|
|
23
23
|
import 'antd/es/checkbox/style';
|
|
24
|
-
import 'antd/es/radio/style';
|
|
25
24
|
import 'antd/es/spin/style';
|
|
25
|
+
import 'antd/es/radio/style';
|
|
26
26
|
import 'antd/es/carousel/style';
|
|
27
27
|
import './index.scss';
|
package/es/utils/props/form.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 处理表单默认值
|
|
3
3
|
*/
|
|
4
4
|
import { ProFormRenderProps } from '@ztocwst/rc-pro';
|
|
5
|
-
export declare const processFormProps: (props: Omit<import("@ant-design/pro-form/lib/components/SchemaForm").FormSchema<any, "custom" | "text" | "autoComplete" | "cardList" | "upload" | "linkage" | "asyncSelect" | "inputTextArea" | "modalSelect" | "treeSelectArea" | "inputGroup">, "columns"> & {
|
|
5
|
+
export declare const processFormProps: (props: Omit<import("@ant-design/pro-form/lib/components/SchemaForm").FormSchema<any, "trim" | "custom" | "text" | "autoComplete" | "cardList" | "upload" | "linkage" | "asyncSelect" | "inputTextArea" | "modalSelect" | "treeSelectArea" | "inputGroup" | "scanInput" | "timeRangePicker">, "columns"> & {
|
|
6
6
|
onCollapse?: (collapsed: boolean) => void;
|
|
7
7
|
defaultColsNumber?: number;
|
|
8
8
|
span?: number;
|
|
@@ -430,7 +430,7 @@ var DimTarget = function DimTarget(_ref) {
|
|
|
430
430
|
}, remember ? /*#__PURE__*/_react["default"].createElement(_checkbox["default"], {
|
|
431
431
|
checked: rememberCheck,
|
|
432
432
|
onChange: rememberCheckChange
|
|
433
|
-
}, "
|
|
433
|
+
}, ' ', "\u8BB0\u4F4F\u52FE\u9009") : null, buttons.length ? /*#__PURE__*/_react["default"].createElement(_rcPro.ProButton, {
|
|
434
434
|
items: buttons
|
|
435
435
|
}) : null) : null);
|
|
436
436
|
};
|
|
@@ -8,7 +8,7 @@ export interface linkParamsType extends Pick<TypeChartSettingProps, 'dataSetName
|
|
|
8
8
|
dimension?: CheckboxValueType[];
|
|
9
9
|
record?: Record<string, any>;
|
|
10
10
|
}
|
|
11
|
-
export interface linkStateType extends linkParamsType, Pick<TypeChartSettingProps, 'chartTitle' | 'title' | 'autoLoad' | 'refreshRate'> {
|
|
11
|
+
export interface linkStateType extends linkParamsType, Pick<TypeChartSettingProps, 'chartTitle' | 'custom' | 'child' | 'title' | 'autoLoad' | 'refreshRate'> {
|
|
12
12
|
}
|
|
13
13
|
declare const LinkRenderer: (props: Pick<TypeChartSettingProps, "onConfirm" | "chartRef" | "dimJson" | "linkPage" | "linkPageTitle"> & {
|
|
14
14
|
onBack?: () => void;
|
|
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports["default"] = void 0;
|
|
6
6
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
7
|
+
var _spin = _interopRequireDefault(require("antd/lib/spin"));
|
|
7
8
|
var _radio = _interopRequireDefault(require("antd/lib/radio"));
|
|
8
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
9
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
@@ -14,12 +15,13 @@ var _dataCommon = require("../../data-common.helper");
|
|
|
14
15
|
var _tableRenderer = require("../table-renderer/table-renderer.helper");
|
|
15
16
|
require("./index.less");
|
|
16
17
|
var linkStateDefault = {
|
|
18
|
+
custom: false,
|
|
17
19
|
dataSetName: '',
|
|
18
20
|
autoLoad: false,
|
|
19
21
|
refreshRate: 0
|
|
20
22
|
};
|
|
21
23
|
var LinkRenderer = function LinkRenderer(props) {
|
|
22
|
-
var _tableOptions$paginat, _linkPage$filter;
|
|
24
|
+
var _tableOptions$paginat, _linkPage$filter, _linkState$child;
|
|
23
25
|
var dimJson = props.dimJson,
|
|
24
26
|
linkPage = props.linkPage,
|
|
25
27
|
linkPageTitle = props.linkPageTitle,
|
|
@@ -34,6 +36,12 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
34
36
|
var _useState = (0, _react.useState)(linkStateDefault),
|
|
35
37
|
linkState = _useState[0],
|
|
36
38
|
setLinkState = _useState[1];
|
|
39
|
+
var _useState2 = (0, _react.useState)(),
|
|
40
|
+
result = _useState2[0],
|
|
41
|
+
setResult = _useState2[1];
|
|
42
|
+
var _useState3 = (0, _react.useState)(false),
|
|
43
|
+
loading = _useState3[0],
|
|
44
|
+
setLoading = _useState3[1];
|
|
37
45
|
var tableRef = (0, _react.useRef)(null);
|
|
38
46
|
var queryCacheRef = (0, _react.useRef)(null);
|
|
39
47
|
var timer = null;
|
|
@@ -45,9 +53,17 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
45
53
|
};
|
|
46
54
|
(0, _react.useEffect)(function () {
|
|
47
55
|
var dataSetName = linkState.dataSetName,
|
|
56
|
+
custom = linkState.custom,
|
|
48
57
|
autoLoad = linkState.autoLoad,
|
|
49
58
|
refreshRate = linkState.refreshRate;
|
|
50
59
|
if (dataSetName) {
|
|
60
|
+
if (custom) {
|
|
61
|
+
setResult(null);
|
|
62
|
+
} else {
|
|
63
|
+
setTimeout(function () {
|
|
64
|
+
return handleUpdateColumns(linkState);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
51
67
|
if (autoLoad) {
|
|
52
68
|
if (refreshRate) {
|
|
53
69
|
handleClearInterval();
|
|
@@ -64,7 +80,7 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
64
80
|
return function () {
|
|
65
81
|
handleClearInterval();
|
|
66
82
|
};
|
|
67
|
-
}, [linkState.dataSetName, linkState.index, linkState.autoLoad]);
|
|
83
|
+
}, [linkState.dataSetName, linkState.index, linkState.custom, linkState.autoLoad]);
|
|
68
84
|
|
|
69
85
|
// 获取表头
|
|
70
86
|
var handleGetColumns = function handleGetColumns(stateParams) {
|
|
@@ -82,10 +98,10 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
82
98
|
return (0, _tableRenderer.handleColumns)(option);
|
|
83
99
|
};
|
|
84
100
|
var handleUpdateColumns = function handleUpdateColumns(stateParams) {
|
|
85
|
-
var _tableRef$current;
|
|
101
|
+
var _tableRef$current, _tableRef$current$upd;
|
|
86
102
|
var columns = handleGetColumns((0, _extends2["default"])({}, stateParams));
|
|
87
103
|
// 更新表头
|
|
88
|
-
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.updateColumns(columns);
|
|
104
|
+
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : (_tableRef$current$upd = _tableRef$current.updateColumns) === null || _tableRef$current$upd === void 0 ? void 0 : _tableRef$current$upd.call(_tableRef$current, columns);
|
|
89
105
|
};
|
|
90
106
|
var getDataSource = /*#__PURE__*/function () {
|
|
91
107
|
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(params) {
|
|
@@ -155,16 +171,30 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
155
171
|
dataSetName: dataSetName
|
|
156
172
|
});
|
|
157
173
|
queryData = formatter ? formatter === null || formatter === void 0 ? void 0 : formatter(data) : data;
|
|
174
|
+
if (linkState.custom) {
|
|
175
|
+
setLoading(true);
|
|
176
|
+
}
|
|
158
177
|
return _context.abrupt("return", (0, _dataCommon.getReportData)(rcProContext, queryData).then(function (_ref4) {
|
|
159
178
|
var success = _ref4.success,
|
|
160
179
|
_ref4$result = _ref4.result,
|
|
161
180
|
result = _ref4$result === void 0 ? {} : _ref4$result;
|
|
181
|
+
if (linkState.custom) {
|
|
182
|
+
setLoading(false);
|
|
183
|
+
if (success) {
|
|
184
|
+
setResult(result);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
162
187
|
return {
|
|
163
188
|
success: success,
|
|
164
189
|
result: result
|
|
165
190
|
};
|
|
191
|
+
})["catch"](function () {
|
|
192
|
+
if (linkState.custom) {
|
|
193
|
+
setLoading(false);
|
|
194
|
+
setResult(null);
|
|
195
|
+
}
|
|
166
196
|
}));
|
|
167
|
-
case
|
|
197
|
+
case 16:
|
|
168
198
|
case "end":
|
|
169
199
|
return _context.stop();
|
|
170
200
|
}
|
|
@@ -176,8 +206,8 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
176
206
|
}();
|
|
177
207
|
|
|
178
208
|
/** 初始linkState */
|
|
179
|
-
var initial = function initial(
|
|
180
|
-
var _ref5 =
|
|
209
|
+
var initial = function initial(paramsState) {
|
|
210
|
+
var _ref5 = paramsState || {},
|
|
181
211
|
dataSetName = _ref5.dataSetName;
|
|
182
212
|
/** 二级页未配置 或 自定义dataSetName配错 直接返回 */
|
|
183
213
|
var Length = linkPage === null || linkPage === void 0 ? void 0 : linkPage.length;
|
|
@@ -187,7 +217,7 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
187
217
|
if (!Length || !isHave) return;
|
|
188
218
|
|
|
189
219
|
/** 可以传入二级页下标 */
|
|
190
|
-
var index =
|
|
220
|
+
var index = paramsState.index || 0;
|
|
191
221
|
/** 检查传入二级下标 是否为数字 */
|
|
192
222
|
var isNumber = typeof index === 'number';
|
|
193
223
|
|
|
@@ -212,35 +242,33 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
212
242
|
}
|
|
213
243
|
}
|
|
214
244
|
}
|
|
215
|
-
var
|
|
216
|
-
|
|
217
|
-
title = _linkPage$index2.title,
|
|
218
|
-
autoLoad = _linkPage$index2.autoLoad,
|
|
219
|
-
refreshRate = _linkPage$index2.refreshRate;
|
|
220
|
-
var stateData = (0, _extends2["default"])({}, state, {
|
|
245
|
+
var currentState = linkPage[index];
|
|
246
|
+
var stateData = (0, _extends2["default"])({}, paramsState, currentState, {
|
|
221
247
|
width: width,
|
|
222
|
-
index: index
|
|
223
|
-
chartTitle: chartTitle,
|
|
224
|
-
title: title,
|
|
225
|
-
autoLoad: autoLoad,
|
|
226
|
-
refreshRate: refreshRate
|
|
248
|
+
index: index
|
|
227
249
|
});
|
|
228
250
|
/** 当前进入与上次进入link页不同时需要清空数据 */
|
|
229
251
|
var isSource = "" + stateData.dataSetName + _dataCommon.separator + index === "" + linkState.dataSetName + _dataCommon.separator + (linkState === null || linkState === void 0 ? void 0 : linkState.index);
|
|
230
252
|
var isSame = JSON.stringify(stateData === null || stateData === void 0 ? void 0 : stateData.record) === JSON.stringify(linkState === null || linkState === void 0 ? void 0 : linkState.record);
|
|
231
|
-
if (!isSource || !isSame) {
|
|
253
|
+
if (!currentState.custom && (!isSource || !isSame)) {
|
|
232
254
|
var _tableRef$current2, _tableRef$current2$up;
|
|
233
255
|
(_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : (_tableRef$current2$up = _tableRef$current2.updateDataSource) === null || _tableRef$current2$up === void 0 ? void 0 : _tableRef$current2$up.call(_tableRef$current2, []);
|
|
234
256
|
}
|
|
235
|
-
handleUpdateColumns(stateData);
|
|
236
257
|
setLinkState(stateData);
|
|
237
258
|
};
|
|
238
259
|
var queryChart = function queryChart(value) {
|
|
239
|
-
var _tableRef$current3;
|
|
240
260
|
queryCacheRef.current = value;
|
|
241
|
-
(
|
|
242
|
-
|
|
243
|
-
|
|
261
|
+
if (linkState.custom) {
|
|
262
|
+
getDataSource({
|
|
263
|
+
pageNum: undefined,
|
|
264
|
+
pageSize: undefined
|
|
265
|
+
});
|
|
266
|
+
} else {
|
|
267
|
+
var _tableRef$current3;
|
|
268
|
+
(_tableRef$current3 = tableRef.current) === null || _tableRef$current3 === void 0 ? void 0 : _tableRef$current3.refreshTable({
|
|
269
|
+
current: 1
|
|
270
|
+
});
|
|
271
|
+
}
|
|
244
272
|
};
|
|
245
273
|
(0, _react.useImperativeHandle)(chartRef, function () {
|
|
246
274
|
return {
|
|
@@ -256,20 +284,11 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
256
284
|
var _ref6 = (value === null || value === void 0 ? void 0 : value.split(_dataCommon.separator)) || [],
|
|
257
285
|
dataSetName = _ref6[0],
|
|
258
286
|
index = _ref6[1];
|
|
259
|
-
var
|
|
260
|
-
|
|
261
|
-
title = _linkPage$index3.title,
|
|
262
|
-
autoLoad = _linkPage$index3.autoLoad,
|
|
263
|
-
refreshRate = _linkPage$index3.refreshRate;
|
|
264
|
-
var stateData = (0, _extends2["default"])({}, linkState, {
|
|
287
|
+
var currentState = linkPage[index];
|
|
288
|
+
var stateData = (0, _extends2["default"])({}, linkState, currentState, {
|
|
265
289
|
dataSetName: dataSetName,
|
|
266
|
-
index: index
|
|
267
|
-
chartTitle: chartTitle,
|
|
268
|
-
title: title,
|
|
269
|
-
autoLoad: autoLoad,
|
|
270
|
-
refreshRate: refreshRate
|
|
290
|
+
index: index
|
|
271
291
|
});
|
|
272
|
-
handleUpdateColumns(stateData);
|
|
273
292
|
setLinkState(stateData);
|
|
274
293
|
};
|
|
275
294
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
@@ -294,7 +313,9 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
294
313
|
width: linkState.width
|
|
295
314
|
}
|
|
296
315
|
}, field === null || field === void 0 ? void 0 : field.title)) : null;
|
|
297
|
-
}))), /*#__PURE__*/React.createElement(
|
|
316
|
+
}))), linkState.custom ? /*#__PURE__*/React.createElement(_spin["default"], {
|
|
317
|
+
spinning: loading
|
|
318
|
+
}, (_linkState$child = linkState.child) === null || _linkState$child === void 0 ? void 0 : _linkState$child.call(linkState, result)) : /*#__PURE__*/React.createElement(_rcPro.ProTable, {
|
|
298
319
|
ref: tableRef,
|
|
299
320
|
config: (0, _extends2["default"])({}, _dataCommon.tableConfigDefault, {
|
|
300
321
|
pagination: {
|