@ztocwst/rc-pro-materials 0.2.23 → 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.js +5 -5
- package/build/lowcode/view.js +5 -5
- 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 +5 -2
- 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 +29 -17
- package/es/components/{z-templates-data-common → z-data-table}/components/table-renderer/table-renderer.helper.d.ts +9 -9
- package/es/components/{z-templates-data-common → z-data-table}/components/table-renderer/table-renderer.helper.js +1 -1
- package/es/components/z-data-table/data-table.d.ts +116 -0
- package/es/components/{z-templates-data-common/data-common.helper.js → z-data-table/data-table.helper.js} +1 -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/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 +18 -15
- 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 +37 -25
- package/lib/components/{z-templates-data-common → z-data-table}/components/table-renderer/table-renderer.helper.d.ts +9 -9
- package/lib/components/{z-templates-data-common → z-data-table}/components/table-renderer/table-renderer.helper.js +12 -12
- package/lib/components/z-data-table/data-table.d.ts +116 -0
- package/lib/components/{z-templates-data-common/data-common.helper.js → z-data-table/data-table.helper.js} +1 -1
- 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/package.json +3 -3
- 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/es/components/{z-templates-data-common → z-data-table}/components/link-renderer/index.less +0 -0
- /package/es/components/{z-templates-data-common/data-common.helper.d.ts → z-data-table/data-table.helper.d.ts} +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/lib/components/{z-templates-data-common → z-data-table}/components/link-renderer/index.less +0 -0
- /package/lib/components/{z-templates-data-common/data-common.helper.d.ts → z-data-table/data-table.helper.d.ts} +0 -0
package/es/components/{z-templates-data-common → z-data-table}/components/custom-renderer/index.js
RENAMED
|
@@ -7,12 +7,12 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
7
7
|
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; }
|
|
8
8
|
import { useState, useEffect, useRef, useContext, useImperativeHandle } from 'react';
|
|
9
9
|
import { RcConfigContext } from '@ztocwst/rc-pro';
|
|
10
|
-
import { separator, timeUnit, handleQueryParams, getReportData } from "../../data-
|
|
10
|
+
import { separator, timeUnit, handleQueryParams, getReportData } from "../../data-table.helper";
|
|
11
11
|
import LinkRenderer from "../link-renderer";
|
|
12
12
|
var CustomRenderer = function CustomRenderer(props) {
|
|
13
13
|
var _props$child;
|
|
14
14
|
var _ref = props || {},
|
|
15
|
-
|
|
15
|
+
currentKey = _ref.currentKey,
|
|
16
16
|
autoLoad = _ref.autoLoad,
|
|
17
17
|
refreshRate = _ref.refreshRate,
|
|
18
18
|
dataSetName = _ref.dataSetName,
|
|
@@ -20,6 +20,7 @@ var CustomRenderer = function CustomRenderer(props) {
|
|
|
20
20
|
indexJson = _ref.indexJson,
|
|
21
21
|
linkPage = _ref.linkPage,
|
|
22
22
|
linkPageTitle = _ref.linkPageTitle,
|
|
23
|
+
chartRef = _ref.chartRef,
|
|
23
24
|
onConfirm = _ref.onConfirm,
|
|
24
25
|
formatter = _ref.formatter;
|
|
25
26
|
var rcProContext = useContext(RcConfigContext);
|
|
@@ -121,28 +122,37 @@ var CustomRenderer = function CustomRenderer(props) {
|
|
|
121
122
|
timer = null;
|
|
122
123
|
}
|
|
123
124
|
};
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}, refreshRate * timeUnit);
|
|
134
|
-
} else {
|
|
135
|
-
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm();
|
|
136
|
-
}
|
|
125
|
+
var onload = function onload() {
|
|
126
|
+
if (autoLoad) {
|
|
127
|
+
if (refreshRate) {
|
|
128
|
+
handleClearInterval();
|
|
129
|
+
timer = window.setInterval(function () {
|
|
130
|
+
return onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm();
|
|
131
|
+
}, refreshRate * timeUnit);
|
|
132
|
+
} else {
|
|
133
|
+
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm();
|
|
137
134
|
}
|
|
138
135
|
} else {
|
|
139
136
|
handleClearInterval();
|
|
140
137
|
}
|
|
138
|
+
};
|
|
139
|
+
useEffect(function () {
|
|
140
|
+
if (currentKey) {
|
|
141
|
+
var _ref4 = currentKey.split(separator) || [],
|
|
142
|
+
curDataSetName = _ref4[0];
|
|
143
|
+
if (curDataSetName === dataSetName) {
|
|
144
|
+
onload();
|
|
145
|
+
} else {
|
|
146
|
+
handleClearInterval();
|
|
147
|
+
}
|
|
148
|
+
} else {
|
|
149
|
+
onload();
|
|
150
|
+
}
|
|
141
151
|
return function () {
|
|
142
152
|
handleClearInterval();
|
|
143
153
|
};
|
|
144
|
-
}, [
|
|
145
|
-
useImperativeHandle(
|
|
154
|
+
}, [currentKey, autoLoad]);
|
|
155
|
+
useImperativeHandle(chartRef, function () {
|
|
146
156
|
return {
|
|
147
157
|
onLink: onLink,
|
|
148
158
|
queryChart: queryChart
|
|
@@ -154,7 +164,7 @@ var CustomRenderer = function CustomRenderer(props) {
|
|
|
154
164
|
}
|
|
155
165
|
}, /*#__PURE__*/React.createElement(_Spin, {
|
|
156
166
|
spinning: loading
|
|
157
|
-
}, (_props$child = props.child) === null || _props$child === void 0 ? void 0 : _props$child.call(props, result))), /*#__PURE__*/React.createElement("div", {
|
|
167
|
+
}, props === null || props === void 0 ? void 0 : (_props$child = props.child) === null || _props$child === void 0 ? void 0 : _props$child.call(props, result))), /*#__PURE__*/React.createElement("div", {
|
|
158
168
|
style: {
|
|
159
169
|
display: isLink ? 'block' : 'none'
|
|
160
170
|
}
|
package/es/components/{z-templates-data-common → z-data-table}/components/dim-target/index.js
RENAMED
|
@@ -10,7 +10,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10
10
|
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; }
|
|
11
11
|
import React, { useState, useEffect, useImperativeHandle, useContext } from 'react';
|
|
12
12
|
import { ProButton, RcConfigContext } from '@ztocwst/rc-pro';
|
|
13
|
-
import { getMaxWidth, saveDimTarget } from "../../data-
|
|
13
|
+
import { getMaxWidth, saveDimTarget } from "../../data-table.helper";
|
|
14
14
|
import useUpdateEffect from "./useUpdateEffect";
|
|
15
15
|
import "./index.less";
|
|
16
16
|
var DimsDefault = {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CheckboxValueType } from 'antd/es/checkbox/Group';
|
|
3
|
+
import type { TypeZDataTableProps } from '../../data-table';
|
|
4
|
+
import './index.less';
|
|
5
|
+
export interface linkParamsType extends Pick<TypeZDataTableProps, 'dataSetName'> {
|
|
6
|
+
index?: number | string;
|
|
7
|
+
width?: number;
|
|
8
|
+
dimension?: CheckboxValueType[];
|
|
9
|
+
record?: Record<string, any>;
|
|
10
|
+
}
|
|
11
|
+
export interface linkStateType extends linkParamsType, Pick<TypeZDataTableProps, 'chartTitle' | 'custom' | 'child' | 'title' | 'autoLoad' | 'refreshRate' | 'actionJson' | 'exporter' | 'exportConfig'> {
|
|
12
|
+
}
|
|
13
|
+
declare const LinkRenderer: (props: Pick<TypeZDataTableProps, "onConfirm" | "dimJson" | "linkPage" | "linkPageTitle" | "chartRef"> & {
|
|
14
|
+
onBack?: () => void;
|
|
15
|
+
}) => import("react").JSX.Element;
|
|
16
|
+
export default LinkRenderer;
|
package/es/components/{z-templates-data-common → z-data-table}/components/link-renderer/index.js
RENAMED
|
@@ -13,7 +13,7 @@ import { useEffect, useState, useRef, useContext, useImperativeHandle } from 're
|
|
|
13
13
|
import { ProTable, ProButton, RcConfigContext } from '@ztocwst/rc-pro';
|
|
14
14
|
import { ArrowLeftOutlined } from '@ant-design/icons';
|
|
15
15
|
import moment from 'moment';
|
|
16
|
-
import { tableConfigDefault, dateStart, separator, timeUnit, defaultSort, getType, getMaxWidth, handleQueryParams, getReportData } from "../../data-
|
|
16
|
+
import { tableConfigDefault, dateStart, separator, timeUnit, defaultSort, getType, getMaxWidth, handleQueryParams, getReportData } from "../../data-table.helper";
|
|
17
17
|
import { handleDimTargetFormat, handleColumns } from "../table-renderer/table-renderer.helper";
|
|
18
18
|
import "./index.less";
|
|
19
19
|
var linkStateDefault = {
|
|
@@ -125,7 +125,7 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
125
125
|
find = _objectWithoutPropertiesLoose(_linkPage$index, _excluded);
|
|
126
126
|
var _ref3 = handleDimTargetFormat(find) || {},
|
|
127
127
|
targets = _ref3.targets;
|
|
128
|
-
var queryCache = queryCacheRef.current;
|
|
128
|
+
var queryCache = queryCacheRef.current || {};
|
|
129
129
|
var query = {};
|
|
130
130
|
var queryKeys = Object.keys(queryCache);
|
|
131
131
|
if (queryKeys !== null && queryKeys !== void 0 && queryKeys.length) {
|
|
@@ -396,6 +396,9 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
396
396
|
items: [{
|
|
397
397
|
action: 'btn',
|
|
398
398
|
name: linkState === null || linkState === void 0 ? void 0 : linkState.exportConfig.name,
|
|
399
|
+
props: {
|
|
400
|
+
disabled: !queryCacheRef.current
|
|
401
|
+
},
|
|
399
402
|
fileConfig: {
|
|
400
403
|
type: 'export',
|
|
401
404
|
params: {
|
package/es/components/{z-templates-data-common → z-data-table}/components/table-renderer/index.js
RENAMED
|
@@ -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, defaultSort, 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) {
|
|
@@ -409,27 +412,36 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
409
412
|
timer = null;
|
|
410
413
|
}
|
|
411
414
|
};
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
}, refreshRate * timeUnit);
|
|
422
|
-
} else {
|
|
423
|
-
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm();
|
|
424
|
-
}
|
|
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();
|
|
425
424
|
}
|
|
426
425
|
} else {
|
|
427
426
|
handleClearInterval();
|
|
428
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
|
+
}
|
|
429
441
|
return function () {
|
|
430
442
|
handleClearInterval();
|
|
431
443
|
};
|
|
432
|
-
}, [
|
|
444
|
+
}, [currentKey, autoLoad]);
|
|
433
445
|
var queryChart = /*#__PURE__*/function () {
|
|
434
446
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(value) {
|
|
435
447
|
var _linkChartRef$current3;
|
|
@@ -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,7 +54,7 @@ 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;
|
|
@@ -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, defaultSort, 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, '');
|
|
@@ -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
|
+
}
|
|
@@ -175,7 +175,7 @@ export var handleCondition = function handleCondition(value, handledValue, condi
|
|
|
175
175
|
};
|
|
176
176
|
|
|
177
177
|
// mock
|
|
178
|
-
var token = 'scm:tenant:token:2:104:
|
|
178
|
+
var token = 'scm:tenant:token:2:104:CCAB6974939D70D8418CBEC342EAE22D';
|
|
179
179
|
|
|
180
180
|
/** 获取维度指标 */
|
|
181
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
|
},
|