@ztocwst/rc-pro-materials 0.2.22 → 0.2.24
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/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +5 -5
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +5 -5
- package/dist/SCM_Comps.css +1 -1
- package/dist/SCM_Comps.js +3 -3
- package/dist/SCM_Comps.js.map +1 -1
- package/es/components/z-data-table/components/custom-renderer/index.d.ts +4 -0
- package/es/components/{z-templates-data-common → z-data-table}/components/custom-renderer/index.js +28 -18
- package/{lib/components/z-templates-data-common → es/components/z-data-table}/components/dim-target/dim-target.helper.d.ts +1 -1
- package/es/components/{z-templates-data-common → z-data-table}/components/dim-target/index.js +1 -1
- package/es/components/z-data-table/components/link-renderer/index.d.ts +16 -0
- package/es/components/{z-templates-data-common → z-data-table}/components/link-renderer/index.js +202 -102
- package/es/components/{z-templates-data-common → z-data-table}/components/link-renderer/index.less +4 -0
- package/es/components/z-data-table/components/table-renderer/index.d.ts +4 -0
- package/es/components/{z-templates-data-common → z-data-table}/components/table-renderer/index.js +66 -25
- package/es/components/{z-templates-data-common → z-data-table}/components/table-renderer/table-renderer.helper.d.ts +10 -9
- package/es/components/{z-templates-data-common → z-data-table}/components/table-renderer/table-renderer.helper.js +23 -12
- package/es/components/z-data-table/data-table.d.ts +116 -0
- package/es/components/{z-templates-data-common/data-common.helper.d.ts → z-data-table/data-table.helper.d.ts} +2 -0
- package/es/components/{z-templates-data-common/data-common.helper.js → z-data-table/data-table.helper.js} +4 -1
- package/es/components/z-data-table/data-table.js +52 -0
- package/es/components/z-data-table/index.d.ts +7 -0
- package/es/components/z-data-table/index.js +5 -0
- package/es/components/z-templates-data-common/components/chart-renderer/index.d.ts +1 -1
- package/es/components/z-templates-data-common/components/chart-renderer/index.js +13 -8
- package/es/components/z-templates-data-common/data-common.d.ts +2 -111
- package/es/components/z-templates-data-common/data-common.js +1 -7
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -0
- package/es/style.js +2 -2
- package/es/utils/props/form.js +5 -2
- package/es/utils/props/tpl.d.ts +2 -0
- package/lib/components/z-data-table/components/custom-renderer/index.d.ts +4 -0
- package/lib/components/{z-templates-data-common → z-data-table}/components/custom-renderer/index.js +30 -20
- package/{es/components/z-templates-data-common → lib/components/z-data-table}/components/dim-target/dim-target.helper.d.ts +1 -1
- package/lib/components/{z-templates-data-common → z-data-table}/components/dim-target/index.js +3 -3
- package/lib/components/z-data-table/components/link-renderer/index.d.ts +16 -0
- package/lib/components/{z-templates-data-common → z-data-table}/components/link-renderer/index.js +208 -108
- package/lib/components/{z-templates-data-common → z-data-table}/components/link-renderer/index.less +4 -0
- package/lib/components/z-data-table/components/table-renderer/index.d.ts +4 -0
- package/lib/components/{z-templates-data-common → z-data-table}/components/table-renderer/index.js +72 -31
- package/lib/components/{z-templates-data-common → z-data-table}/components/table-renderer/table-renderer.helper.d.ts +10 -9
- package/lib/components/{z-templates-data-common → z-data-table}/components/table-renderer/table-renderer.helper.js +30 -19
- package/lib/components/z-data-table/data-table.d.ts +116 -0
- package/lib/components/{z-templates-data-common/data-common.helper.d.ts → z-data-table/data-table.helper.d.ts} +2 -0
- package/lib/components/{z-templates-data-common/data-common.helper.js → z-data-table/data-table.helper.js} +7 -3
- package/lib/components/z-data-table/data-table.js +58 -0
- package/lib/components/z-data-table/index.d.ts +7 -0
- package/lib/components/z-data-table/index.js +14 -0
- package/lib/components/z-templates-data-common/components/chart-renderer/index.d.ts +1 -1
- package/lib/components/z-templates-data-common/components/chart-renderer/index.js +19 -14
- package/lib/components/z-templates-data-common/data-common.d.ts +2 -111
- package/lib/components/z-templates-data-common/data-common.js +1 -6
- package/lib/index.d.ts +2 -0
- package/lib/index.js +3 -1
- package/lib/style.js +2 -2
- package/lib/utils/props/form.js +5 -2
- package/lib/utils/props/tpl.d.ts +2 -0
- package/package.json +4 -4
- package/es/components/z-templates-data-common/components/custom-renderer/index.d.ts +0 -13
- package/es/components/z-templates-data-common/components/link-renderer/index.d.ts +0 -16
- package/es/components/z-templates-data-common/components/table-renderer/index.d.ts +0 -6
- package/lib/components/z-templates-data-common/components/custom-renderer/index.d.ts +0 -13
- package/lib/components/z-templates-data-common/components/link-renderer/index.d.ts +0 -16
- package/lib/components/z-templates-data-common/components/table-renderer/index.d.ts +0 -6
- /package/es/components/{z-templates-data-common → z-data-table}/components/dim-target/dim-target.helper.js +0 -0
- /package/es/components/{z-templates-data-common → z-data-table}/components/dim-target/index.d.ts +0 -0
- /package/es/components/{z-templates-data-common → z-data-table}/components/dim-target/index.less +0 -0
- /package/es/components/{z-templates-data-common → z-data-table}/components/dim-target/useUpdateEffect.d.ts +0 -0
- /package/es/components/{z-templates-data-common → z-data-table}/components/dim-target/useUpdateEffect.js +0 -0
- /package/lib/components/{z-templates-data-common → z-data-table}/components/dim-target/dim-target.helper.js +0 -0
- /package/lib/components/{z-templates-data-common → z-data-table}/components/dim-target/index.d.ts +0 -0
- /package/lib/components/{z-templates-data-common → z-data-table}/components/dim-target/index.less +0 -0
- /package/lib/components/{z-templates-data-common → z-data-table}/components/dim-target/useUpdateEffect.d.ts +0 -0
- /package/lib/components/{z-templates-data-common → z-data-table}/components/dim-target/useUpdateEffect.js +0 -0
package/es/components/{z-templates-data-common → z-data-table}/components/table-renderer/index.js
RENAMED
|
@@ -2,7 +2,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutP
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import _Table from "antd/es/table";
|
|
4
4
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
5
|
-
var _excluded = ["pageNum", "pageSize"];
|
|
5
|
+
var _excluded = ["pageNum", "pageSize", "orderBy"];
|
|
6
6
|
function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
7
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
8
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
@@ -10,13 +10,13 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
10
10
|
import { useRef, useState, useEffect, useImperativeHandle, useContext } from 'react';
|
|
11
11
|
import { ProTable, RcConfigContext } from '@ztocwst/rc-pro';
|
|
12
12
|
import moment from 'moment';
|
|
13
|
-
import { tableConfigDefault, dateStart, separator, timeUnit, getType, handleQueryParams, getReportData } from "../../data-
|
|
13
|
+
import { tableConfigDefault, dateStart, separator, timeUnit, defaultSort, getType, handleQueryParams, getReportData } from "../../data-table.helper";
|
|
14
14
|
import { handleColumns, handleValueFormat, getDimTargetData } from "./table-renderer.helper";
|
|
15
15
|
import DimTarget from "../dim-target";
|
|
16
16
|
import LinkRenderer from "../link-renderer";
|
|
17
17
|
var TableRenderer = function TableRenderer(props) {
|
|
18
18
|
var _tableOptions$paginat;
|
|
19
|
-
var
|
|
19
|
+
var currentKey = props.currentKey,
|
|
20
20
|
autoLoad = props.autoLoad,
|
|
21
21
|
refreshRate = props.refreshRate,
|
|
22
22
|
dataSetName = props.dataSetName,
|
|
@@ -78,6 +78,9 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
78
78
|
}, exporter ? {
|
|
79
79
|
action: 'btn',
|
|
80
80
|
name: exportConfig === null || exportConfig === void 0 ? void 0 : exportConfig.name,
|
|
81
|
+
props: {
|
|
82
|
+
disabled: !queryCacheRef.current
|
|
83
|
+
},
|
|
81
84
|
fileConfig: {
|
|
82
85
|
type: 'export',
|
|
83
86
|
params: {
|
|
@@ -188,7 +191,7 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
188
191
|
indexSource = _getDimTargetValues3$4 === void 0 ? [] : _getDimTargetValues3$4;
|
|
189
192
|
|
|
190
193
|
/** 通过 queryBind查看是否有绑定关系 有的话替换成绑定关系中的key 没有则是默认配置的key */
|
|
191
|
-
var queryCache = queryCacheRef.current;
|
|
194
|
+
var queryCache = queryCacheRef.current || {};
|
|
192
195
|
var query = {};
|
|
193
196
|
var queryKeys = Object.keys(queryCache);
|
|
194
197
|
if (queryKeys !== null && queryKeys !== void 0 && queryKeys.length) {
|
|
@@ -222,7 +225,7 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
222
225
|
}
|
|
223
226
|
});
|
|
224
227
|
}
|
|
225
|
-
|
|
228
|
+
var orderBys = [];
|
|
226
229
|
/** 维度收集 */
|
|
227
230
|
var dim = [];
|
|
228
231
|
for (var _iterator = _createForOfIteratorHelperLoose(dimensionSource), _step; !(_step = _iterator()).done;) {
|
|
@@ -232,6 +235,12 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
232
235
|
name: cur.name,
|
|
233
236
|
description: cur.description
|
|
234
237
|
});
|
|
238
|
+
if (cur !== null && cur !== void 0 && cur.sorted) {
|
|
239
|
+
orderBys.push({
|
|
240
|
+
name: cur.description,
|
|
241
|
+
sort: defaultSort
|
|
242
|
+
});
|
|
243
|
+
}
|
|
235
244
|
}
|
|
236
245
|
}
|
|
237
246
|
|
|
@@ -243,18 +252,41 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
243
252
|
target.push({
|
|
244
253
|
description: _cur.name
|
|
245
254
|
});
|
|
255
|
+
if (_cur !== null && _cur !== void 0 && _cur.sorted) {
|
|
256
|
+
orderBys.push({
|
|
257
|
+
name: _cur.name,
|
|
258
|
+
sort: defaultSort
|
|
259
|
+
});
|
|
260
|
+
}
|
|
246
261
|
}
|
|
247
262
|
}
|
|
248
263
|
var queryParams = handleQueryParams(query);
|
|
249
264
|
var _params = params,
|
|
250
265
|
pageNum = _params.pageNum,
|
|
251
266
|
pageSize = _params.pageSize,
|
|
267
|
+
orderBy = _params.orderBy,
|
|
252
268
|
other = _objectWithoutPropertiesLoose(_params, _excluded);
|
|
269
|
+
if (orderBy !== null && orderBy !== void 0 && orderBy.length) {
|
|
270
|
+
var _loop = function _loop() {
|
|
271
|
+
var item = _step3.value;
|
|
272
|
+
var i = orderBys.findIndex(function (e) {
|
|
273
|
+
return e.name === item.name;
|
|
274
|
+
});
|
|
275
|
+
if (i > -1) {
|
|
276
|
+
orderBys.splice(i, 1);
|
|
277
|
+
}
|
|
278
|
+
orderBys.unshift(_extends({}, item));
|
|
279
|
+
};
|
|
280
|
+
for (var _iterator3 = _createForOfIteratorHelperLoose(orderBy), _step3; !(_step3 = _iterator3()).done;) {
|
|
281
|
+
_loop();
|
|
282
|
+
}
|
|
283
|
+
}
|
|
253
284
|
var data = _extends({
|
|
254
|
-
queryParams: queryParams
|
|
255
|
-
dim: dim,
|
|
256
|
-
target: target
|
|
285
|
+
queryParams: queryParams
|
|
257
286
|
}, other, {
|
|
287
|
+
dim: dim,
|
|
288
|
+
target: target,
|
|
289
|
+
orderBy: orderBys !== null && orderBys !== void 0 && orderBys.length ? orderBys : undefined,
|
|
258
290
|
pageNum: pageNum || 1,
|
|
259
291
|
pageSize: pageSize || defaultPageSize,
|
|
260
292
|
dataSetName: dataSetName
|
|
@@ -380,27 +412,36 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
380
412
|
timer = null;
|
|
381
413
|
}
|
|
382
414
|
};
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
}, refreshRate * timeUnit);
|
|
393
|
-
} else {
|
|
394
|
-
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm();
|
|
395
|
-
}
|
|
415
|
+
var onload = function onload() {
|
|
416
|
+
if (autoLoad) {
|
|
417
|
+
if (refreshRate) {
|
|
418
|
+
handleClearInterval();
|
|
419
|
+
timer = window.setInterval(function () {
|
|
420
|
+
return onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm();
|
|
421
|
+
}, refreshRate * timeUnit);
|
|
422
|
+
} else {
|
|
423
|
+
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm();
|
|
396
424
|
}
|
|
397
425
|
} else {
|
|
398
426
|
handleClearInterval();
|
|
399
427
|
}
|
|
428
|
+
};
|
|
429
|
+
useEffect(function () {
|
|
430
|
+
if (currentKey) {
|
|
431
|
+
var _ref6 = currentKey.split(separator) || [],
|
|
432
|
+
curDataSetName = _ref6[0];
|
|
433
|
+
if (curDataSetName === dataSetName) {
|
|
434
|
+
onload();
|
|
435
|
+
} else {
|
|
436
|
+
handleClearInterval();
|
|
437
|
+
}
|
|
438
|
+
} else {
|
|
439
|
+
onload();
|
|
440
|
+
}
|
|
400
441
|
return function () {
|
|
401
442
|
handleClearInterval();
|
|
402
443
|
};
|
|
403
|
-
}, [
|
|
444
|
+
}, [currentKey, autoLoad]);
|
|
404
445
|
var queryChart = /*#__PURE__*/function () {
|
|
405
446
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(value) {
|
|
406
447
|
var _linkChartRef$current3;
|
|
@@ -413,7 +454,7 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
413
454
|
queryCacheRef.current = value[dataSetName] || value;
|
|
414
455
|
setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
415
456
|
var _tableRef$current2;
|
|
416
|
-
var _getDimTargetValues4, _getDimTargetValues4$, indexSource, indexAmounted, target,
|
|
457
|
+
var _getDimTargetValues4, _getDimTargetValues4$, indexSource, indexAmounted, target, _iterator4, _step4, cur, _ref9, success, _ref9$result, result, _result$data, _result$data$, data;
|
|
417
458
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
418
459
|
while (1) switch (_context5.prev = _context5.next) {
|
|
419
460
|
case 0:
|
|
@@ -429,8 +470,8 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
429
470
|
break;
|
|
430
471
|
}
|
|
431
472
|
target = [];
|
|
432
|
-
for (
|
|
433
|
-
cur =
|
|
473
|
+
for (_iterator4 = _createForOfIteratorHelperLoose(indexAmounted); !(_step4 = _iterator4()).done;) {
|
|
474
|
+
cur = _step4.value;
|
|
434
475
|
target.push({
|
|
435
476
|
description: cur.name
|
|
436
477
|
});
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TypeZDataTableProps } from '../../data-table';
|
|
2
|
+
import type { valueType } from '../../data-table.helper';
|
|
2
3
|
import type { linkParamsType } from '../link-renderer';
|
|
3
4
|
import type { DimTargetChangeOptionType } from '../dim-target/dim-target.helper';
|
|
4
|
-
import type { valueType } from '../../data-common.helper';
|
|
5
5
|
export declare const stringTrim: (str: string) => string;
|
|
6
6
|
/**
|
|
7
7
|
* 维度指标数据源处理
|
|
8
8
|
*/
|
|
9
|
-
export declare const handleDimTargetFormat: (dimTargetSource: Pick<
|
|
9
|
+
export declare const handleDimTargetFormat: (dimTargetSource: Pick<TypeZDataTableProps, 'dimJson' | 'indexJson'>, result?: Record<string, any>) => {
|
|
10
10
|
rememberCheck: boolean;
|
|
11
11
|
dims: {
|
|
12
12
|
all: boolean;
|
|
13
13
|
title: string;
|
|
14
14
|
indeterminate: boolean;
|
|
15
15
|
dimension: any[];
|
|
16
|
-
dimensionSource: Omit<import("../../data-
|
|
16
|
+
dimensionSource: Omit<import("../../data-table").TypeTargetProps, "amounted" | "enName" | "isFilter">[];
|
|
17
17
|
};
|
|
18
18
|
targets: {
|
|
19
19
|
all: boolean;
|
|
20
20
|
title: string;
|
|
21
21
|
indeterminate: boolean;
|
|
22
22
|
index: any[];
|
|
23
|
-
indexSource: import("../../data-
|
|
23
|
+
indexSource: import("../../data-table").TypeTargetProps[];
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
26
|
/**
|
|
27
27
|
* 获取维度指标数据源
|
|
28
28
|
*/
|
|
29
|
-
export declare const getDimTargetData: (rcProContext: any, params: Record<string, any>, dimTargetSource: Pick<
|
|
29
|
+
export declare const getDimTargetData: (rcProContext: any, params: Record<string, any>, dimTargetSource: Pick<TypeZDataTableProps, 'dimJson' | 'indexJson'>) => Promise<{
|
|
30
30
|
rememberCheck: boolean;
|
|
31
31
|
dims: {
|
|
32
32
|
all: boolean;
|
|
33
33
|
title: string;
|
|
34
34
|
indeterminate: boolean;
|
|
35
35
|
dimension: any[];
|
|
36
|
-
dimensionSource: Omit<import("../../data-
|
|
36
|
+
dimensionSource: Omit<import("../../data-table").TypeTargetProps, "amounted" | "enName" | "isFilter">[];
|
|
37
37
|
};
|
|
38
38
|
targets: {
|
|
39
39
|
all: boolean;
|
|
40
40
|
title: string;
|
|
41
41
|
indeterminate: boolean;
|
|
42
42
|
index: any[];
|
|
43
|
-
indexSource: import("../../data-
|
|
43
|
+
indexSource: import("../../data-table").TypeTargetProps[];
|
|
44
44
|
};
|
|
45
45
|
}>;
|
|
46
46
|
/**
|
|
@@ -54,10 +54,11 @@ export type ExpressionsType = any[] | [];
|
|
|
54
54
|
/**
|
|
55
55
|
* 根据维度指标获取表格列
|
|
56
56
|
*/
|
|
57
|
-
export declare const handleColumns: (option: DimTargetChangeOptionType & Pick<
|
|
57
|
+
export declare const handleColumns: (option: DimTargetChangeOptionType & Pick<TypeZDataTableProps, 'actionJson'>, expressions?: ExpressionsType, linkPage?: TypeZDataTableProps[], onLink?: (v: linkParamsType) => void) => {
|
|
58
58
|
title: import("antd/es/checkbox/Group").CheckboxValueType;
|
|
59
59
|
dataIndex: string;
|
|
60
60
|
ellipsis: boolean;
|
|
61
|
+
defaultSortOrder: string;
|
|
61
62
|
sorter: any;
|
|
62
63
|
width: any;
|
|
63
64
|
fixed: any;
|
|
@@ -6,7 +6,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
6
6
|
function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
7
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
8
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
-
import { separator, computeWidth, handleDecimal, handleThousand, handlePercent, handleLink, handleCondition, getDimTarget } from "../../data-
|
|
9
|
+
import { separator, defaultSort, computeWidth, handleDecimal, handleThousand, handlePercent, handleLink, handleCondition, getDimTarget } from "../../data-table.helper";
|
|
10
10
|
export var stringTrim = function stringTrim(str) {
|
|
11
11
|
if (!str) return '';
|
|
12
12
|
return str.replace(/`|'|"/g, '');
|
|
@@ -176,37 +176,47 @@ export var handleValueFormat = function handleValueFormat(value, record, config,
|
|
|
176
176
|
*/
|
|
177
177
|
export var handleColumns = function handleColumns(option, expressions, linkPage, onLink) {
|
|
178
178
|
var _option$actionJson;
|
|
179
|
+
var isFirst = true;
|
|
179
180
|
var dimTarget = [].concat(option.dimension, option.index);
|
|
180
181
|
var columns = dimTarget.map(function (title) {
|
|
181
|
-
var
|
|
182
|
+
var _config5, _config5$link, _config6, _config7, _config8, _title$toString, _config9, _config10, _config11;
|
|
182
183
|
var config;
|
|
183
184
|
var dataIndex;
|
|
185
|
+
var defaultSortOrder;
|
|
184
186
|
var condition;
|
|
185
187
|
if (!config) {
|
|
186
|
-
var _option$dimensionSour, _config;
|
|
188
|
+
var _option$dimensionSour, _config, _config2;
|
|
187
189
|
/* 通过别名或名称 查找当前维度的配置 */
|
|
188
190
|
config = (_option$dimensionSour = option.dimensionSource) === null || _option$dimensionSour === void 0 ? void 0 : _option$dimensionSour.find(function (item) {
|
|
189
191
|
return item.alias === title || item.description === title;
|
|
190
192
|
});
|
|
191
193
|
dataIndex = (_config = config) === null || _config === void 0 ? void 0 : _config.description;
|
|
194
|
+
if ((_config2 = config) !== null && _config2 !== void 0 && _config2.sorted && isFirst) {
|
|
195
|
+
isFirst = false;
|
|
196
|
+
defaultSortOrder = defaultSort + "end";
|
|
197
|
+
}
|
|
192
198
|
}
|
|
193
199
|
if (!config) {
|
|
194
|
-
var _option$indexSource,
|
|
200
|
+
var _option$indexSource, _config3, _config4;
|
|
195
201
|
/* 通过别名或名称 查找当前指标的配置 */
|
|
196
202
|
config = (_option$indexSource = option.indexSource) === null || _option$indexSource === void 0 ? void 0 : _option$indexSource.find(function (item) {
|
|
197
203
|
return item.alias === title || item.name === title;
|
|
198
204
|
});
|
|
199
|
-
dataIndex = (
|
|
205
|
+
dataIndex = (_config3 = config) === null || _config3 === void 0 ? void 0 : _config3.name;
|
|
206
|
+
if ((_config4 = config) !== null && _config4 !== void 0 && _config4.sorted && isFirst) {
|
|
207
|
+
isFirst = false;
|
|
208
|
+
defaultSortOrder = defaultSort + "end";
|
|
209
|
+
}
|
|
200
210
|
}
|
|
201
211
|
/* 条件格式设置 */
|
|
202
212
|
// if (expressions?.length) {
|
|
203
213
|
// condition = expressions?.filter((item) => item?.index?.includes(config?.name));
|
|
204
214
|
// }
|
|
205
215
|
|
|
206
|
-
var _ref4 = ((
|
|
216
|
+
var _ref4 = ((_config5 = config) === null || _config5 === void 0 ? void 0 : (_config5$link = _config5.link) === null || _config5$link === void 0 ? void 0 : _config5$link.split(separator)) || [],
|
|
207
217
|
dataSetName = _ref4[0];
|
|
208
218
|
var index;
|
|
209
|
-
if ((
|
|
219
|
+
if ((_config6 = config) !== null && _config6 !== void 0 && _config6.link && linkPage !== null && linkPage !== void 0 && linkPage.length) {
|
|
210
220
|
index = linkPage.findIndex(function (link) {
|
|
211
221
|
return "" + link.dataSetName + separator + link.title === config.link;
|
|
212
222
|
});
|
|
@@ -215,12 +225,13 @@ export var handleColumns = function handleColumns(option, expressions, linkPage,
|
|
|
215
225
|
title: title,
|
|
216
226
|
dataIndex: dataIndex,
|
|
217
227
|
ellipsis: true,
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
228
|
+
defaultSortOrder: defaultSortOrder,
|
|
229
|
+
sorter: (_config7 = config) === null || _config7 === void 0 ? void 0 : _config7.sorted,
|
|
230
|
+
width: ((_config8 = config) === null || _config8 === void 0 ? void 0 : _config8.width) || computeWidth(title === null || title === void 0 ? void 0 : (_title$toString = title.toString()) === null || _title$toString === void 0 ? void 0 : _title$toString.length),
|
|
231
|
+
fixed: (_config9 = config) !== null && _config9 !== void 0 && _config9.isFixed ? ((_config10 = config) === null || _config10 === void 0 ? void 0 : _config10.fixed) || ((_config11 = config) === null || _config11 === void 0 ? void 0 : _config11.isFixed) : false,
|
|
221
232
|
render: function render(value, record) {
|
|
222
|
-
var _config$render,
|
|
223
|
-
return config.custom ? (_config$render = (
|
|
233
|
+
var _config$render, _config12;
|
|
234
|
+
return config.custom ? (_config$render = (_config12 = config).render) === null || _config$render === void 0 ? void 0 : _config$render.call(_config12, value, record, config, condition) : handleValueFormat(value, record, config, condition, function () {
|
|
224
235
|
return onLink({
|
|
225
236
|
dataSetName: dataSetName,
|
|
226
237
|
index: index,
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { linkParamsType } from './components/link-renderer';
|
|
3
|
+
/** 指标配置 */
|
|
4
|
+
export interface TypeTargetProps {
|
|
5
|
+
/** 指标名称 */
|
|
6
|
+
name: string;
|
|
7
|
+
/** 是否默认选中 */
|
|
8
|
+
checked: boolean;
|
|
9
|
+
/** 别名 */
|
|
10
|
+
alias: string;
|
|
11
|
+
/** 英文名 */
|
|
12
|
+
enName: string;
|
|
13
|
+
/** 是否过滤 */
|
|
14
|
+
isFilter: boolean;
|
|
15
|
+
/** 是否可选 */
|
|
16
|
+
optional: boolean;
|
|
17
|
+
/** 小数位 精确度 */
|
|
18
|
+
precision: number;
|
|
19
|
+
/** 是否展示百分号 */
|
|
20
|
+
percent: boolean;
|
|
21
|
+
/** 是否允许排序 */
|
|
22
|
+
sorted: boolean;
|
|
23
|
+
/** 宽度 */
|
|
24
|
+
width: number;
|
|
25
|
+
/** 是否合计 */
|
|
26
|
+
amounted: boolean;
|
|
27
|
+
/** 指标描述 */
|
|
28
|
+
description?: string;
|
|
29
|
+
/** 下转二级页 */
|
|
30
|
+
link?: string;
|
|
31
|
+
/** 查询绑定关系 */
|
|
32
|
+
queryBind?: string;
|
|
33
|
+
/** 依赖 */
|
|
34
|
+
dependencies?: string[];
|
|
35
|
+
}
|
|
36
|
+
/** 表格相关配置 */
|
|
37
|
+
export interface TypeZDataTableProps {
|
|
38
|
+
/** 标题 */
|
|
39
|
+
title?: string;
|
|
40
|
+
/** 二级页标题 */
|
|
41
|
+
chartTitle?: string;
|
|
42
|
+
/** 自定义渲染 */
|
|
43
|
+
custom?: boolean;
|
|
44
|
+
/** 自定义渲染方法 */
|
|
45
|
+
child?: (p: any) => React.ReactNode;
|
|
46
|
+
/** 维度配置 */
|
|
47
|
+
dimJson?: {
|
|
48
|
+
/** 维度标题 */
|
|
49
|
+
title: string;
|
|
50
|
+
/** 维度项配置 */
|
|
51
|
+
data: Array<Omit<TypeTargetProps, 'amounted' | 'enName' | 'isFilter'>>;
|
|
52
|
+
};
|
|
53
|
+
/** 指标配置 */
|
|
54
|
+
indexJson: {
|
|
55
|
+
title: string;
|
|
56
|
+
/** 指标项配置 */
|
|
57
|
+
data: TypeTargetProps[];
|
|
58
|
+
};
|
|
59
|
+
dataSetName: string;
|
|
60
|
+
/** 自动请求 */
|
|
61
|
+
autoLoad: boolean;
|
|
62
|
+
/** 刷新时间 */
|
|
63
|
+
refreshRate?: number;
|
|
64
|
+
/** 记住勾选 */
|
|
65
|
+
remember?: boolean;
|
|
66
|
+
/** 导出 */
|
|
67
|
+
exporter?: boolean;
|
|
68
|
+
/** 操作列(表头)配置 */
|
|
69
|
+
actionJson?: {
|
|
70
|
+
/** 表头名称 */
|
|
71
|
+
title: string;
|
|
72
|
+
/** 宽度 */
|
|
73
|
+
width?: number;
|
|
74
|
+
/** 固定列 */
|
|
75
|
+
isFixed: boolean;
|
|
76
|
+
/** 固定到 */
|
|
77
|
+
fixed?: string;
|
|
78
|
+
/** 自定义渲染 */
|
|
79
|
+
custom: boolean;
|
|
80
|
+
/** 自定义渲染方法 */
|
|
81
|
+
render?: (p: any) => React.ReactNode;
|
|
82
|
+
};
|
|
83
|
+
/** 导出配置 */
|
|
84
|
+
exportConfig?: {
|
|
85
|
+
name: string;
|
|
86
|
+
code: string;
|
|
87
|
+
menuId: string;
|
|
88
|
+
};
|
|
89
|
+
/** 条件格式设置 */
|
|
90
|
+
expressions?: any[] | [];
|
|
91
|
+
linkPageTitle?: string;
|
|
92
|
+
/** 下钻二级页设置 */
|
|
93
|
+
linkPage?: TypeZDataTableProps[];
|
|
94
|
+
/** 数据源参数"键"" 和 查询参数"值" 和 上一级维度(dim)"值" 关系绑定 */
|
|
95
|
+
queryBind?: Array<{
|
|
96
|
+
sourceQueryKey: string;
|
|
97
|
+
currentQueryKey: string;
|
|
98
|
+
parentDimKey: string;
|
|
99
|
+
}>;
|
|
100
|
+
/** chartRef */
|
|
101
|
+
chartRef?: React.Ref<{
|
|
102
|
+
onLink?: (v: linkParamsType) => void;
|
|
103
|
+
queryChart: (v: Record<string, any>, d: string | undefined) => void;
|
|
104
|
+
}>;
|
|
105
|
+
/** 确认 */
|
|
106
|
+
onConfirm?: () => void;
|
|
107
|
+
/** 查询参数转换 */
|
|
108
|
+
formatter?: (v: Record<string, any>) => Record<string, any>;
|
|
109
|
+
/** 当前展示报表唯一标识 */
|
|
110
|
+
currentKey?: string;
|
|
111
|
+
}
|
|
112
|
+
export default class ZDataTableContainer extends React.Component<TypeZDataTableProps, any> {
|
|
113
|
+
chartRef: any;
|
|
114
|
+
constructor(props: TypeZDataTableProps);
|
|
115
|
+
render(): JSX.Element;
|
|
116
|
+
}
|
|
@@ -14,6 +14,8 @@ export declare const separator = "***";
|
|
|
14
14
|
export declare const timeUnit: number;
|
|
15
15
|
/** 介于 前闭后开 */
|
|
16
16
|
export declare const BETWEEN = "<=,<";
|
|
17
|
+
/** 默认排序 */
|
|
18
|
+
export declare const defaultSort = "asc";
|
|
17
19
|
/** 数据类型 */
|
|
18
20
|
export type valueType = number | string | null | undefined;
|
|
19
21
|
/**
|
|
@@ -26,6 +26,9 @@ export var timeUnit = 60 * 1000;
|
|
|
26
26
|
/** 介于 前闭后开 */
|
|
27
27
|
export var BETWEEN = '<=,<';
|
|
28
28
|
|
|
29
|
+
/** 默认排序 */
|
|
30
|
+
export var defaultSort = 'asc';
|
|
31
|
+
|
|
29
32
|
/** 数据类型 */
|
|
30
33
|
|
|
31
34
|
/**
|
|
@@ -172,7 +175,7 @@ export var handleCondition = function handleCondition(value, handledValue, condi
|
|
|
172
175
|
};
|
|
173
176
|
|
|
174
177
|
// mock
|
|
175
|
-
var token = 'scm:tenant:token:2:104:
|
|
178
|
+
var token = 'scm:tenant:token:2:104:CCAB6974939D70D8418CBEC342EAE22D';
|
|
176
179
|
|
|
177
180
|
/** 获取维度指标 */
|
|
178
181
|
export var getDimTarget = /*#__PURE__*/function () {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import React, { useRef, useImperativeHandle } from 'react';
|
|
4
|
+
import TableRenderer from "./components/table-renderer";
|
|
5
|
+
import CustomRenderer from "./components/custom-renderer";
|
|
6
|
+
|
|
7
|
+
/** 指标配置 */
|
|
8
|
+
|
|
9
|
+
/** 表格相关配置 */
|
|
10
|
+
|
|
11
|
+
var ZDataTable = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
12
|
+
// console.log(props)
|
|
13
|
+
|
|
14
|
+
var chartRef = useRef();
|
|
15
|
+
var onLink = function onLink(values) {
|
|
16
|
+
var _chartRef$current, _chartRef$current$onL;
|
|
17
|
+
return (_chartRef$current = chartRef.current) === null || _chartRef$current === void 0 ? void 0 : (_chartRef$current$onL = _chartRef$current.onLink) === null || _chartRef$current$onL === void 0 ? void 0 : _chartRef$current$onL.call(_chartRef$current, values);
|
|
18
|
+
};
|
|
19
|
+
var queryChart = function queryChart(values) {
|
|
20
|
+
var _chartRef$current2, _chartRef$current2$qu;
|
|
21
|
+
return (_chartRef$current2 = chartRef.current) === null || _chartRef$current2 === void 0 ? void 0 : (_chartRef$current2$qu = _chartRef$current2.queryChart) === null || _chartRef$current2$qu === void 0 ? void 0 : _chartRef$current2$qu.call(_chartRef$current2, values);
|
|
22
|
+
};
|
|
23
|
+
useImperativeHandle(ref, function () {
|
|
24
|
+
return {
|
|
25
|
+
onLink: onLink,
|
|
26
|
+
queryChart: queryChart
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
return props !== null && props !== void 0 && props.custom ? /*#__PURE__*/React.createElement(CustomRenderer, _extends({
|
|
30
|
+
chartRef: chartRef
|
|
31
|
+
}, props)) : /*#__PURE__*/React.createElement(TableRenderer, _extends({
|
|
32
|
+
chartRef: chartRef
|
|
33
|
+
}, props));
|
|
34
|
+
});
|
|
35
|
+
var ZDataTableContainer = /*#__PURE__*/function (_React$Component) {
|
|
36
|
+
_inheritsLoose(ZDataTableContainer, _React$Component);
|
|
37
|
+
function ZDataTableContainer(props) {
|
|
38
|
+
var _this;
|
|
39
|
+
_this = _React$Component.call(this, props) || this;
|
|
40
|
+
_this.chartRef = void 0;
|
|
41
|
+
_this.chartRef = /*#__PURE__*/React.createRef();
|
|
42
|
+
return _this;
|
|
43
|
+
}
|
|
44
|
+
var _proto = ZDataTableContainer.prototype;
|
|
45
|
+
_proto.render = function render() {
|
|
46
|
+
return /*#__PURE__*/React.createElement(ZDataTable, _extends({}, this.props, {
|
|
47
|
+
ref: this.chartRef
|
|
48
|
+
}));
|
|
49
|
+
};
|
|
50
|
+
return ZDataTableContainer;
|
|
51
|
+
}(React.Component);
|
|
52
|
+
export { ZDataTableContainer as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import ZDataTable from './data-table';
|
|
2
|
+
export type { TypeZDataTableProps } from './data-table';
|
|
3
|
+
export type { linkParamsType } from './components/link-renderer';
|
|
4
|
+
export { default as TableRenderer } from './components/table-renderer';
|
|
5
|
+
export { default as CustomRenderer } from './components/custom-renderer';
|
|
6
|
+
export { default as LinkRenderer } from './components/link-renderer';
|
|
7
|
+
export default ZDataTable;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import ZDataTable from "./data-table";
|
|
2
|
+
export { default as TableRenderer } from "./components/table-renderer";
|
|
3
|
+
export { default as CustomRenderer } from "./components/custom-renderer";
|
|
4
|
+
export { default as LinkRenderer } from "./components/link-renderer";
|
|
5
|
+
export default ZDataTable;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { TypeZTemplatesDataCommonProps } from '../../data-common';
|
|
3
|
-
import type { linkParamsType } from '
|
|
3
|
+
import type { linkParamsType } from '../../../z-data-table';
|
|
4
4
|
export interface ChartRendererProps {
|
|
5
5
|
chartSetting?: Pick<TypeZTemplatesDataCommonProps, 'chartSetting'>;
|
|
6
6
|
chartRenderRef?: React.Ref<{
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _Tabs from "antd/es/tabs";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
|
|
4
|
-
import { separator } from "
|
|
5
|
-
import TableRenderer from "
|
|
6
|
-
import CustomRenderer from "../custom-renderer";
|
|
4
|
+
import { separator } from "../../../z-data-table/data-table.helper";
|
|
5
|
+
import { TableRenderer, CustomRenderer } from "../../../z-data-table";
|
|
7
6
|
var ChartRenderer = function ChartRenderer(_ref) {
|
|
8
7
|
var chartRenderRef = _ref.chartRenderRef,
|
|
9
8
|
chartSetting = _ref.chartSetting,
|
|
@@ -68,8 +67,14 @@ var ChartRenderer = function ChartRenderer(_ref) {
|
|
|
68
67
|
|
|
69
68
|
// 普通列表json对象
|
|
70
69
|
if (isObject) {
|
|
71
|
-
return /*#__PURE__*/React.createElement(
|
|
72
|
-
|
|
70
|
+
return chartSetting !== null && chartSetting !== void 0 && chartSetting.custom ? /*#__PURE__*/React.createElement(CustomRenderer, _extends({}, chartSetting, {
|
|
71
|
+
currentKey: activeKey,
|
|
72
|
+
chartRef: function chartRef(ref) {
|
|
73
|
+
_chartRef.current[chartSetting === null || chartSetting === void 0 ? void 0 : chartSetting.dataSetName] = ref;
|
|
74
|
+
},
|
|
75
|
+
onConfirm: onConfirm
|
|
76
|
+
})) : /*#__PURE__*/React.createElement(TableRenderer, _extends({}, chartSetting, {
|
|
77
|
+
currentKey: activeKey,
|
|
73
78
|
chartRef: function chartRef(ref) {
|
|
74
79
|
_chartRef.current[chartSetting === null || chartSetting === void 0 ? void 0 : chartSetting.dataSetName] = ref;
|
|
75
80
|
},
|
|
@@ -84,18 +89,18 @@ var ChartRenderer = function ChartRenderer(_ref) {
|
|
|
84
89
|
return /*#__PURE__*/React.createElement(_Tabs, {
|
|
85
90
|
activeKey: activeKey,
|
|
86
91
|
onChange: handleTabsChange
|
|
87
|
-
}, chartSetting.map(function (e, i) {
|
|
92
|
+
}, chartSetting === null || chartSetting === void 0 ? void 0 : chartSetting.map(function (e, i) {
|
|
88
93
|
return /*#__PURE__*/React.createElement(_Tabs.TabPane, {
|
|
89
94
|
tab: "" + ((e === null || e === void 0 ? void 0 : e.title) || ''),
|
|
90
95
|
key: "" + (e === null || e === void 0 ? void 0 : e.dataSetName) + separator + i.toString()
|
|
91
96
|
}, e !== null && e !== void 0 && e.custom ? /*#__PURE__*/React.createElement(CustomRenderer, _extends({}, e, {
|
|
92
|
-
|
|
97
|
+
currentKey: activeKey,
|
|
93
98
|
chartRef: function chartRef(ref) {
|
|
94
99
|
_chartRef.current["" + (e === null || e === void 0 ? void 0 : e.dataSetName) + separator + i] = ref;
|
|
95
100
|
},
|
|
96
101
|
onConfirm: onConfirm
|
|
97
102
|
})) : /*#__PURE__*/React.createElement(TableRenderer, _extends({}, e, {
|
|
98
|
-
|
|
103
|
+
currentKey: activeKey,
|
|
99
104
|
chartRef: function chartRef(ref) {
|
|
100
105
|
_chartRef.current["" + (e === null || e === void 0 ? void 0 : e.dataSetName) + separator + i] = ref;
|
|
101
106
|
},
|