@ztocwst/rc-pro-materials 0.2.26 → 0.2.28
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.js +9 -9
- package/build/lowcode/view.js +10 -10
- package/dist/SCM_Comps.js +10 -10
- package/dist/SCM_Comps.js.map +1 -1
- package/es/components/z-data-table/components/link-renderer/index.js +2 -1
- package/es/components/z-data-table/components/table-renderer/index.js +5 -4
- package/es/components/z-data-table/components/table-renderer/table-renderer.helper.d.ts +2 -15
- package/es/components/z-data-table/components/table-renderer/table-renderer.helper.js +27 -40
- package/es/components/z-data-table/data-table.d.ts +2 -1
- package/es/components/z-data-table/data-table.helper.d.ts +1 -7
- package/es/components/z-data-table/data-table.helper.js +35 -45
- package/lib/components/z-data-table/components/link-renderer/index.js +2 -1
- package/lib/components/z-data-table/components/table-renderer/index.js +5 -4
- package/lib/components/z-data-table/components/table-renderer/table-renderer.helper.d.ts +2 -15
- package/lib/components/z-data-table/components/table-renderer/table-renderer.helper.js +27 -39
- package/lib/components/z-data-table/data-table.d.ts +2 -1
- package/lib/components/z-data-table/data-table.helper.d.ts +1 -7
- package/lib/components/z-data-table/data-table.helper.js +38 -50
- package/package.json +5 -4
|
@@ -195,9 +195,10 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
195
195
|
for (var _iterator = _createForOfIteratorHelperLoose(targets.indexSource), _step; !(_step = _iterator()).done;) {
|
|
196
196
|
var cur = _step.value;
|
|
197
197
|
if (cur !== null && cur !== void 0 && cur.sorted) {
|
|
198
|
+
var _cur$defaultSorted;
|
|
198
199
|
orderBys.push({
|
|
199
200
|
name: cur.name,
|
|
200
|
-
sort: defaultSort
|
|
201
|
+
sort: cur.defaultSorted ? (_cur$defaultSorted = cur.defaultSorted) === null || _cur$defaultSorted === void 0 ? void 0 : _cur$defaultSorted.slice(0, -3) : defaultSort
|
|
201
202
|
});
|
|
202
203
|
}
|
|
203
204
|
}
|
|
@@ -27,7 +27,6 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
27
27
|
dimJson = props.dimJson,
|
|
28
28
|
indexJson = props.indexJson,
|
|
29
29
|
actionJson = props.actionJson,
|
|
30
|
-
expressions = props.expressions,
|
|
31
30
|
linkPageTitle = props.linkPageTitle,
|
|
32
31
|
linkPage = props.linkPage,
|
|
33
32
|
queryBind = props.queryBind,
|
|
@@ -160,7 +159,7 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
160
159
|
var _tableRef$current;
|
|
161
160
|
var columns = handleColumns(_extends({}, option, {
|
|
162
161
|
actionJson: actionJson
|
|
163
|
-
}),
|
|
162
|
+
}), linkPage, onLink);
|
|
164
163
|
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.updateColumns(columns);
|
|
165
164
|
};
|
|
166
165
|
var getBigDataBody = function getBigDataBody(params) {
|
|
@@ -223,9 +222,10 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
223
222
|
description: cur.description
|
|
224
223
|
});
|
|
225
224
|
if (cur !== null && cur !== void 0 && cur.sorted) {
|
|
225
|
+
var _cur$defaultSorted;
|
|
226
226
|
orderBys.push({
|
|
227
227
|
name: cur.description,
|
|
228
|
-
sort: defaultSort
|
|
228
|
+
sort: cur.defaultSorted ? (_cur$defaultSorted = cur.defaultSorted) === null || _cur$defaultSorted === void 0 ? void 0 : _cur$defaultSorted.slice(0, -3) : defaultSort
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
231
|
}
|
|
@@ -240,9 +240,10 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
240
240
|
description: _cur.name
|
|
241
241
|
});
|
|
242
242
|
if (_cur !== null && _cur !== void 0 && _cur.sorted) {
|
|
243
|
+
var _cur$defaultSorted2;
|
|
243
244
|
orderBys.push({
|
|
244
245
|
name: _cur.name,
|
|
245
|
-
sort: defaultSort
|
|
246
|
+
sort: _cur.defaultSorted ? (_cur$defaultSorted2 = _cur.defaultSorted) === null || _cur$defaultSorted2 === void 0 ? void 0 : _cur$defaultSorted2.slice(0, -3) : defaultSort
|
|
246
247
|
});
|
|
247
248
|
}
|
|
248
249
|
}
|
|
@@ -46,21 +46,8 @@ 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>, config?: Record<string, any>,
|
|
50
|
-
/**
|
|
51
|
-
* 条件格式
|
|
52
|
-
*/
|
|
53
|
-
export type ExpressionsType = any[] | [];
|
|
49
|
+
export declare const handleValueFormat: (value: valueType, record: Record<string, any>, config?: Record<string, any>, onLink?: () => void) => any;
|
|
54
50
|
/**
|
|
55
51
|
* 根据维度指标获取表格列
|
|
56
52
|
*/
|
|
57
|
-
export declare const handleColumns: (option: DimTargetChangeOptionType & Pick<TypeZDataTableProps, 'actionJson'>,
|
|
58
|
-
title: import("antd/es/checkbox/Group").CheckboxValueType;
|
|
59
|
-
dataIndex: string;
|
|
60
|
-
ellipsis: boolean;
|
|
61
|
-
defaultSortOrder: string;
|
|
62
|
-
sorter: any;
|
|
63
|
-
width: any;
|
|
64
|
-
fixed: any;
|
|
65
|
-
render: (value: valueType, record: Record<string, any>) => any;
|
|
66
|
-
}[];
|
|
53
|
+
export declare const handleColumns: (option: DimTargetChangeOptionType & Pick<TypeZDataTableProps, 'actionJson'>, linkPage?: TypeZDataTableProps[], onLink?: (v: linkParamsType) => void) => any[];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
4
|
var _excluded = ["isFixed", "fixed", "render"];
|
|
5
5
|
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,
|
|
9
|
+
import { separator, defaultSort, computeWidth, getType, handleDecimal, handleThousand, handlePercent, handleLink, getDimTarget } from "../../data-table.helper";
|
|
10
10
|
export var stringTrim = function stringTrim(str) {
|
|
11
11
|
if (!str) return '';
|
|
12
12
|
return str.replace(/`|'|"/g, '');
|
|
@@ -144,7 +144,7 @@ export var getDimTargetData = /*#__PURE__*/function () {
|
|
|
144
144
|
/**
|
|
145
145
|
* 数据渲染格式处理
|
|
146
146
|
*/
|
|
147
|
-
export var handleValueFormat = function handleValueFormat(value, record, config,
|
|
147
|
+
export var handleValueFormat = function handleValueFormat(value, record, config, onLink) {
|
|
148
148
|
var _val;
|
|
149
149
|
var val = value;
|
|
150
150
|
if (typeof value === 'number') {
|
|
@@ -161,77 +161,64 @@ export var handleValueFormat = function handleValueFormat(value, record, config,
|
|
|
161
161
|
if (config !== null && config !== void 0 && config.link) {
|
|
162
162
|
val = handleLink(value, onLink);
|
|
163
163
|
}
|
|
164
|
-
if (condition !== null && condition !== void 0 && condition.length) {
|
|
165
|
-
val = handleCondition(value, val, condition);
|
|
166
|
-
}
|
|
167
164
|
return (_val = val) !== null && _val !== void 0 ? _val : "-";
|
|
168
165
|
};
|
|
169
166
|
|
|
170
|
-
/**
|
|
171
|
-
* 条件格式
|
|
172
|
-
*/
|
|
173
|
-
|
|
174
167
|
/**
|
|
175
168
|
* 根据维度指标获取表格列
|
|
176
169
|
*/
|
|
177
|
-
export var handleColumns = function handleColumns(option,
|
|
170
|
+
export var handleColumns = function handleColumns(option, linkPage, onLink) {
|
|
178
171
|
var _option$actionJson;
|
|
179
|
-
|
|
172
|
+
// let isFirst = true
|
|
180
173
|
var dimTarget = [].concat(option.dimension, option.index);
|
|
181
174
|
var columns = dimTarget.map(function (title) {
|
|
182
|
-
var
|
|
175
|
+
var _config3, _config3$link, _config4, _config5, _config6, _config6$otherProps, _config7, _config8, _config9, _config10, _config11, _title$toString, _config12, _config13, _config14;
|
|
183
176
|
var config;
|
|
184
177
|
var dataIndex;
|
|
185
|
-
var defaultSortOrder;
|
|
186
|
-
var condition;
|
|
187
178
|
if (!config) {
|
|
188
|
-
var _option$dimensionSour, _config
|
|
179
|
+
var _option$dimensionSour, _config;
|
|
189
180
|
/* 通过别名或名称 查找当前维度的配置 */
|
|
190
181
|
config = (_option$dimensionSour = option.dimensionSource) === null || _option$dimensionSour === void 0 ? void 0 : _option$dimensionSour.find(function (item) {
|
|
191
182
|
return item.alias === title || item.description === title;
|
|
192
183
|
});
|
|
193
184
|
dataIndex = (_config = config) === null || _config === void 0 ? void 0 : _config.description;
|
|
194
|
-
if
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
185
|
+
// if(config?.sorted && isFirst){
|
|
186
|
+
// isFirst = false
|
|
187
|
+
// }
|
|
198
188
|
}
|
|
189
|
+
|
|
199
190
|
if (!config) {
|
|
200
|
-
var _option$indexSource,
|
|
191
|
+
var _option$indexSource, _config2;
|
|
201
192
|
/* 通过别名或名称 查找当前指标的配置 */
|
|
202
193
|
config = (_option$indexSource = option.indexSource) === null || _option$indexSource === void 0 ? void 0 : _option$indexSource.find(function (item) {
|
|
203
194
|
return item.alias === title || item.name === title;
|
|
204
195
|
});
|
|
205
|
-
dataIndex = (
|
|
206
|
-
if
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
196
|
+
dataIndex = (_config2 = config) === null || _config2 === void 0 ? void 0 : _config2.name;
|
|
197
|
+
// if(config?.sorted && isFirst){
|
|
198
|
+
// isFirst = false
|
|
199
|
+
// }
|
|
210
200
|
}
|
|
211
|
-
/* 条件格式设置 */
|
|
212
|
-
// if (expressions?.length) {
|
|
213
|
-
// condition = expressions?.filter((item) => item?.index?.includes(config?.name));
|
|
214
|
-
// }
|
|
215
201
|
|
|
216
|
-
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)) || [],
|
|
217
203
|
dataSetName = _ref4[0];
|
|
218
204
|
var index;
|
|
219
|
-
if ((
|
|
205
|
+
if ((_config4 = config) !== null && _config4 !== void 0 && _config4.link && linkPage !== null && linkPage !== void 0 && linkPage.length) {
|
|
220
206
|
index = linkPage.findIndex(function (link) {
|
|
221
207
|
return "" + link.dataSetName + separator + link.title === config.link;
|
|
222
208
|
});
|
|
223
209
|
}
|
|
224
|
-
|
|
210
|
+
var other = _extends({}, getType((_config5 = config) === null || _config5 === void 0 ? void 0 : _config5.otherProps) === 'function' ? (_config6 = config) === null || _config6 === void 0 ? void 0 : (_config6$otherProps = _config6.otherProps) === null || _config6$otherProps === void 0 ? void 0 : _config6$otherProps.call(_config6) : (_config7 = config) === null || _config7 === void 0 ? void 0 : _config7.otherProps);
|
|
211
|
+
return _extends({}, other, {
|
|
225
212
|
title: title,
|
|
226
213
|
dataIndex: dataIndex,
|
|
227
214
|
ellipsis: true,
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
width: ((
|
|
231
|
-
fixed: (
|
|
215
|
+
sorter: (_config8 = config) === null || _config8 === void 0 ? void 0 : _config8.sorted,
|
|
216
|
+
defaultSortOrder: (_config9 = config) !== null && _config9 !== void 0 && _config9.sorted ? ((_config10 = config) === null || _config10 === void 0 ? void 0 : _config10.defaultSorted) || defaultSort + "end" : undefined,
|
|
217
|
+
width: ((_config11 = config) === null || _config11 === void 0 ? void 0 : _config11.width) || computeWidth(title === null || title === void 0 ? void 0 : (_title$toString = title.toString()) === null || _title$toString === void 0 ? void 0 : _title$toString.length),
|
|
218
|
+
fixed: (_config12 = config) !== null && _config12 !== void 0 && _config12.isFixed ? ((_config13 = config) === null || _config13 === void 0 ? void 0 : _config13.fixed) || ((_config14 = config) === null || _config14 === void 0 ? void 0 : _config14.isFixed) : false,
|
|
232
219
|
render: function render(value, record) {
|
|
233
|
-
var _config$render,
|
|
234
|
-
return config.custom ? (_config$render = (
|
|
220
|
+
var _config$render, _config15;
|
|
221
|
+
return config.custom ? (_config$render = (_config15 = config).render) === null || _config$render === void 0 ? void 0 : _config$render.call(_config15, value, record, config) : handleValueFormat(value, record, config, function () {
|
|
235
222
|
return onLink({
|
|
236
223
|
dataSetName: dataSetName,
|
|
237
224
|
index: index,
|
|
@@ -239,7 +226,7 @@ export var handleColumns = function handleColumns(option, expressions, linkPage,
|
|
|
239
226
|
});
|
|
240
227
|
});
|
|
241
228
|
}
|
|
242
|
-
};
|
|
229
|
+
});
|
|
243
230
|
});
|
|
244
231
|
if (option !== null && option !== void 0 && (_option$actionJson = option.actionJson) !== null && _option$actionJson !== void 0 && _option$actionJson.custom) {
|
|
245
232
|
var _columns$fn;
|
|
@@ -20,6 +20,8 @@ export interface TypeTargetProps {
|
|
|
20
20
|
percent: boolean;
|
|
21
21
|
/** 是否允许排序 */
|
|
22
22
|
sorted: boolean;
|
|
23
|
+
/** 默认排序 */
|
|
24
|
+
defaultSorted?: string;
|
|
23
25
|
/** 宽度 */
|
|
24
26
|
width: number;
|
|
25
27
|
/** 是否合计 */
|
|
@@ -91,7 +93,6 @@ export interface TypeZDataTableProps {
|
|
|
91
93
|
menuId: string;
|
|
92
94
|
};
|
|
93
95
|
/** 条件格式设置 */
|
|
94
|
-
expressions?: any[] | [];
|
|
95
96
|
linkPageTitle?: string;
|
|
96
97
|
/** 下钻二级页设置 */
|
|
97
98
|
linkPage?: TypeZDataTableProps[];
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
export declare const tableConfigDefault: {
|
|
4
4
|
manual: boolean;
|
|
5
5
|
toolBars: boolean;
|
|
6
|
+
resizable: boolean;
|
|
6
7
|
hideDefRowSelection: boolean;
|
|
7
8
|
columns: any[];
|
|
8
9
|
};
|
|
@@ -13,7 +14,6 @@ export declare const separator = "***";
|
|
|
13
14
|
/** 时间单位 */
|
|
14
15
|
export declare const timeUnit: number;
|
|
15
16
|
/** 介于 前闭后开 */
|
|
16
|
-
export declare const BETWEEN = "<=,<";
|
|
17
17
|
/** 默认排序 */
|
|
18
18
|
export declare const defaultSort = "asc";
|
|
19
19
|
/** 数据类型 */
|
|
@@ -56,12 +56,6 @@ export declare const handlePercent: (value: valueType, decimal?: number, unit?:
|
|
|
56
56
|
* link外链处理
|
|
57
57
|
*/
|
|
58
58
|
export declare const handleLink: (value: valueType, onLink?: () => void) => import("react").JSX.Element;
|
|
59
|
-
/**
|
|
60
|
-
* 条件格式设置
|
|
61
|
-
* @param value 处理前的值
|
|
62
|
-
* @param handledValue 被处理后的值 可能会是link标签
|
|
63
|
-
*/
|
|
64
|
-
export declare const handleCondition: (value: valueType, handledValue: any, conditions: any[]) => any;
|
|
65
59
|
/** 获取维度指标 */
|
|
66
60
|
export declare const getDimTarget: (rcProContext: any, params: any) => Promise<any>;
|
|
67
61
|
/** 获取报表数据 */
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
-
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."); }
|
|
5
|
-
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); }
|
|
6
|
-
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; }
|
|
7
4
|
import rcProRequest from "../../utils/rcProRequest";
|
|
8
5
|
|
|
9
6
|
/** table config */
|
|
10
7
|
export var tableConfigDefault = {
|
|
11
8
|
manual: true,
|
|
12
9
|
toolBars: false,
|
|
10
|
+
resizable: true,
|
|
13
11
|
hideDefRowSelection: true,
|
|
14
12
|
columns: []
|
|
15
13
|
};
|
|
@@ -24,7 +22,7 @@ export var separator = '***';
|
|
|
24
22
|
export var timeUnit = 60 * 1000;
|
|
25
23
|
|
|
26
24
|
/** 介于 前闭后开 */
|
|
27
|
-
export
|
|
25
|
+
// export const BETWEEN = '<=,<';
|
|
28
26
|
|
|
29
27
|
/** 默认排序 */
|
|
30
28
|
export var defaultSort = 'asc';
|
|
@@ -107,7 +105,7 @@ export var handleDecimal = function handleDecimal(value, decimal) {
|
|
|
107
105
|
if (decimal === void 0) {
|
|
108
106
|
decimal = 2;
|
|
109
107
|
}
|
|
110
|
-
if (value === null || value === undefined) return;
|
|
108
|
+
if (value === null || value === undefined) return null;
|
|
111
109
|
return Number(value).toFixed(decimal);
|
|
112
110
|
};
|
|
113
111
|
|
|
@@ -121,7 +119,7 @@ export var handlePercent = function handlePercent(value, decimal, unit) {
|
|
|
121
119
|
if (unit === void 0) {
|
|
122
120
|
unit = 100;
|
|
123
121
|
}
|
|
124
|
-
if (value === null || value === undefined) return;
|
|
122
|
+
if (value === null || value === undefined) return null;
|
|
125
123
|
return (Number(value) * unit).toFixed(decimal) + "%";
|
|
126
124
|
};
|
|
127
125
|
|
|
@@ -129,53 +127,45 @@ export var handlePercent = function handlePercent(value, decimal, unit) {
|
|
|
129
127
|
* link外链处理
|
|
130
128
|
*/
|
|
131
129
|
export var handleLink = function handleLink(value, onLink) {
|
|
132
|
-
if (value === null || value === undefined) return;
|
|
130
|
+
if (value === null || value === undefined) return null;
|
|
133
131
|
return /*#__PURE__*/React.createElement("a", {
|
|
134
132
|
href: "javascript:void(0);",
|
|
135
133
|
onClick: onLink
|
|
136
134
|
}, value);
|
|
137
135
|
};
|
|
138
136
|
|
|
139
|
-
/**
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
export
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
};
|
|
169
|
-
val = /*#__PURE__*/React.createElement("div", {
|
|
170
|
-
style: _style
|
|
171
|
-
}, handledValue);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
return val;
|
|
175
|
-
};
|
|
137
|
+
// /**
|
|
138
|
+
// * 条件格式设置
|
|
139
|
+
// * @param value 处理前的值
|
|
140
|
+
// * @param handledValue 被处理后的值 可能会是link标签
|
|
141
|
+
// */
|
|
142
|
+
// export const handleCondition = (value: valueType, handledValue: any, conditions: any[]) => {
|
|
143
|
+
// if (value === null || value === undefined) return;
|
|
144
|
+
// let val: any = handledValue;
|
|
145
|
+
// for (const cur of conditions) {
|
|
146
|
+
// const condition = cur?.condition;
|
|
147
|
+
// if (condition?.type === BETWEEN) {
|
|
148
|
+
// const [start, end] = condition?.type?.split(',');
|
|
149
|
+
// if (eval(`${condition?.start}${start}${value}`) && eval(`${value}${end}${condition?.end}`)) {
|
|
150
|
+
// const style = {
|
|
151
|
+
// color: cur?.fontColor,
|
|
152
|
+
// background: cur?.backgroundColor,
|
|
153
|
+
// };
|
|
154
|
+
// val = <div style={style}>{handledValue}</div>;
|
|
155
|
+
// }
|
|
156
|
+
// } else if (eval(`${value}${condition?.type}${condition?.value}`)) {
|
|
157
|
+
// const style = {
|
|
158
|
+
// color: cur?.fontColor,
|
|
159
|
+
// background: cur?.backgroundColor,
|
|
160
|
+
// };
|
|
161
|
+
// val = <div style={style}>{handledValue}</div>;
|
|
162
|
+
// }
|
|
163
|
+
// }
|
|
164
|
+
// return val;
|
|
165
|
+
// };
|
|
176
166
|
|
|
177
167
|
// mock
|
|
178
|
-
var token = 'scm:tenant:token:2:104:
|
|
168
|
+
var token = 'scm:tenant:token:2:104:9e53d7bb-7dac-4e2e-a371-060007dc9f76';
|
|
179
169
|
|
|
180
170
|
/** 获取维度指标 */
|
|
181
171
|
export var getDimTarget = /*#__PURE__*/function () {
|
|
@@ -200,9 +200,10 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
200
200
|
for (var _iterator = _createForOfIteratorHelperLoose(targets.indexSource), _step; !(_step = _iterator()).done;) {
|
|
201
201
|
var cur = _step.value;
|
|
202
202
|
if (cur !== null && cur !== void 0 && cur.sorted) {
|
|
203
|
+
var _cur$defaultSorted;
|
|
203
204
|
orderBys.push({
|
|
204
205
|
name: cur.name,
|
|
205
|
-
sort: _dataTable.defaultSort
|
|
206
|
+
sort: cur.defaultSorted ? (_cur$defaultSorted = cur.defaultSorted) === null || _cur$defaultSorted === void 0 ? void 0 : _cur$defaultSorted.slice(0, -3) : _dataTable.defaultSort
|
|
206
207
|
});
|
|
207
208
|
}
|
|
208
209
|
}
|
|
@@ -32,7 +32,6 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
32
32
|
dimJson = props.dimJson,
|
|
33
33
|
indexJson = props.indexJson,
|
|
34
34
|
actionJson = props.actionJson,
|
|
35
|
-
expressions = props.expressions,
|
|
36
35
|
linkPageTitle = props.linkPageTitle,
|
|
37
36
|
linkPage = props.linkPage,
|
|
38
37
|
queryBind = props.queryBind,
|
|
@@ -165,7 +164,7 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
165
164
|
var _tableRef$current;
|
|
166
165
|
var columns = (0, _tableRenderer.handleColumns)((0, _extends2["default"])({}, option, {
|
|
167
166
|
actionJson: actionJson
|
|
168
|
-
}),
|
|
167
|
+
}), linkPage, onLink);
|
|
169
168
|
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.updateColumns(columns);
|
|
170
169
|
};
|
|
171
170
|
var getBigDataBody = function getBigDataBody(params) {
|
|
@@ -228,9 +227,10 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
228
227
|
description: cur.description
|
|
229
228
|
});
|
|
230
229
|
if (cur !== null && cur !== void 0 && cur.sorted) {
|
|
230
|
+
var _cur$defaultSorted;
|
|
231
231
|
orderBys.push({
|
|
232
232
|
name: cur.description,
|
|
233
|
-
sort: _dataTable.defaultSort
|
|
233
|
+
sort: cur.defaultSorted ? (_cur$defaultSorted = cur.defaultSorted) === null || _cur$defaultSorted === void 0 ? void 0 : _cur$defaultSorted.slice(0, -3) : _dataTable.defaultSort
|
|
234
234
|
});
|
|
235
235
|
}
|
|
236
236
|
}
|
|
@@ -245,9 +245,10 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
245
245
|
description: _cur.name
|
|
246
246
|
});
|
|
247
247
|
if (_cur !== null && _cur !== void 0 && _cur.sorted) {
|
|
248
|
+
var _cur$defaultSorted2;
|
|
248
249
|
orderBys.push({
|
|
249
250
|
name: _cur.name,
|
|
250
|
-
sort: _dataTable.defaultSort
|
|
251
|
+
sort: _cur.defaultSorted ? (_cur$defaultSorted2 = _cur.defaultSorted) === null || _cur$defaultSorted2 === void 0 ? void 0 : _cur$defaultSorted2.slice(0, -3) : _dataTable.defaultSort
|
|
251
252
|
});
|
|
252
253
|
}
|
|
253
254
|
}
|
|
@@ -46,21 +46,8 @@ 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>, config?: Record<string, any>,
|
|
50
|
-
/**
|
|
51
|
-
* 条件格式
|
|
52
|
-
*/
|
|
53
|
-
export type ExpressionsType = any[] | [];
|
|
49
|
+
export declare const handleValueFormat: (value: valueType, record: Record<string, any>, config?: Record<string, any>, onLink?: () => void) => any;
|
|
54
50
|
/**
|
|
55
51
|
* 根据维度指标获取表格列
|
|
56
52
|
*/
|
|
57
|
-
export declare const handleColumns: (option: DimTargetChangeOptionType & Pick<TypeZDataTableProps, 'actionJson'>,
|
|
58
|
-
title: import("antd/es/checkbox/Group").CheckboxValueType;
|
|
59
|
-
dataIndex: string;
|
|
60
|
-
ellipsis: boolean;
|
|
61
|
-
defaultSortOrder: string;
|
|
62
|
-
sorter: any;
|
|
63
|
-
width: any;
|
|
64
|
-
fixed: any;
|
|
65
|
-
render: (value: valueType, record: Record<string, any>) => any;
|
|
66
|
-
}[];
|
|
53
|
+
export declare const handleColumns: (option: DimTargetChangeOptionType & Pick<TypeZDataTableProps, 'actionJson'>, linkPage?: TypeZDataTableProps[], onLink?: (v: linkParamsType) => void) => any[];
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.stringTrim = exports.handleValueFormat = exports.handleDimTargetFormat = exports.handleColumns = exports.getDimTargetData = void 0;
|
|
6
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
7
6
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
8
7
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _dataTable = require("../../data-table.helper");
|
|
11
11
|
var _excluded = ["isFixed", "fixed", "render"];
|
|
@@ -152,7 +152,7 @@ var getDimTargetData = /*#__PURE__*/function () {
|
|
|
152
152
|
* 数据渲染格式处理
|
|
153
153
|
*/
|
|
154
154
|
exports.getDimTargetData = getDimTargetData;
|
|
155
|
-
var handleValueFormat = function handleValueFormat(value, record, config,
|
|
155
|
+
var handleValueFormat = function handleValueFormat(value, record, config, onLink) {
|
|
156
156
|
var _val;
|
|
157
157
|
var val = value;
|
|
158
158
|
if (typeof value === 'number') {
|
|
@@ -169,77 +169,65 @@ var handleValueFormat = function handleValueFormat(value, record, config, condit
|
|
|
169
169
|
if (config !== null && config !== void 0 && config.link) {
|
|
170
170
|
val = (0, _dataTable.handleLink)(value, onLink);
|
|
171
171
|
}
|
|
172
|
-
if (condition !== null && condition !== void 0 && condition.length) {
|
|
173
|
-
val = (0, _dataTable.handleCondition)(value, val, condition);
|
|
174
|
-
}
|
|
175
172
|
return (_val = val) !== null && _val !== void 0 ? _val : "-";
|
|
176
173
|
};
|
|
177
174
|
|
|
178
|
-
/**
|
|
179
|
-
* 条件格式
|
|
180
|
-
*/
|
|
181
|
-
exports.handleValueFormat = handleValueFormat;
|
|
182
175
|
/**
|
|
183
176
|
* 根据维度指标获取表格列
|
|
184
177
|
*/
|
|
185
|
-
|
|
178
|
+
exports.handleValueFormat = handleValueFormat;
|
|
179
|
+
var handleColumns = function handleColumns(option, linkPage, onLink) {
|
|
186
180
|
var _option$actionJson;
|
|
187
|
-
|
|
181
|
+
// let isFirst = true
|
|
188
182
|
var dimTarget = [].concat(option.dimension, option.index);
|
|
189
183
|
var columns = dimTarget.map(function (title) {
|
|
190
|
-
var
|
|
184
|
+
var _config3, _config3$link, _config4, _config5, _config6, _config6$otherProps, _config7, _config8, _config9, _config10, _config11, _title$toString, _config12, _config13, _config14;
|
|
191
185
|
var config;
|
|
192
186
|
var dataIndex;
|
|
193
|
-
var defaultSortOrder;
|
|
194
|
-
var condition;
|
|
195
187
|
if (!config) {
|
|
196
|
-
var _option$dimensionSour, _config
|
|
188
|
+
var _option$dimensionSour, _config;
|
|
197
189
|
/* 通过别名或名称 查找当前维度的配置 */
|
|
198
190
|
config = (_option$dimensionSour = option.dimensionSource) === null || _option$dimensionSour === void 0 ? void 0 : _option$dimensionSour.find(function (item) {
|
|
199
191
|
return item.alias === title || item.description === title;
|
|
200
192
|
});
|
|
201
193
|
dataIndex = (_config = config) === null || _config === void 0 ? void 0 : _config.description;
|
|
202
|
-
if
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}
|
|
194
|
+
// if(config?.sorted && isFirst){
|
|
195
|
+
// isFirst = false
|
|
196
|
+
// }
|
|
206
197
|
}
|
|
198
|
+
|
|
207
199
|
if (!config) {
|
|
208
|
-
var _option$indexSource,
|
|
200
|
+
var _option$indexSource, _config2;
|
|
209
201
|
/* 通过别名或名称 查找当前指标的配置 */
|
|
210
202
|
config = (_option$indexSource = option.indexSource) === null || _option$indexSource === void 0 ? void 0 : _option$indexSource.find(function (item) {
|
|
211
203
|
return item.alias === title || item.name === title;
|
|
212
204
|
});
|
|
213
|
-
dataIndex = (
|
|
214
|
-
if
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
205
|
+
dataIndex = (_config2 = config) === null || _config2 === void 0 ? void 0 : _config2.name;
|
|
206
|
+
// if(config?.sorted && isFirst){
|
|
207
|
+
// isFirst = false
|
|
208
|
+
// }
|
|
218
209
|
}
|
|
219
|
-
/* 条件格式设置 */
|
|
220
|
-
// if (expressions?.length) {
|
|
221
|
-
// condition = expressions?.filter((item) => item?.index?.includes(config?.name));
|
|
222
|
-
// }
|
|
223
210
|
|
|
224
|
-
var _ref4 = ((
|
|
211
|
+
var _ref4 = ((_config3 = config) === null || _config3 === void 0 ? void 0 : (_config3$link = _config3.link) === null || _config3$link === void 0 ? void 0 : _config3$link.split(_dataTable.separator)) || [],
|
|
225
212
|
dataSetName = _ref4[0];
|
|
226
213
|
var index;
|
|
227
|
-
if ((
|
|
214
|
+
if ((_config4 = config) !== null && _config4 !== void 0 && _config4.link && linkPage !== null && linkPage !== void 0 && linkPage.length) {
|
|
228
215
|
index = linkPage.findIndex(function (link) {
|
|
229
216
|
return "" + link.dataSetName + _dataTable.separator + link.title === config.link;
|
|
230
217
|
});
|
|
231
218
|
}
|
|
232
|
-
|
|
219
|
+
var other = (0, _extends2["default"])({}, (0, _dataTable.getType)((_config5 = config) === null || _config5 === void 0 ? void 0 : _config5.otherProps) === 'function' ? (_config6 = config) === null || _config6 === void 0 ? void 0 : (_config6$otherProps = _config6.otherProps) === null || _config6$otherProps === void 0 ? void 0 : _config6$otherProps.call(_config6) : (_config7 = config) === null || _config7 === void 0 ? void 0 : _config7.otherProps);
|
|
220
|
+
return (0, _extends2["default"])({}, other, {
|
|
233
221
|
title: title,
|
|
234
222
|
dataIndex: dataIndex,
|
|
235
223
|
ellipsis: true,
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
width: ((
|
|
239
|
-
fixed: (
|
|
224
|
+
sorter: (_config8 = config) === null || _config8 === void 0 ? void 0 : _config8.sorted,
|
|
225
|
+
defaultSortOrder: (_config9 = config) !== null && _config9 !== void 0 && _config9.sorted ? ((_config10 = config) === null || _config10 === void 0 ? void 0 : _config10.defaultSorted) || _dataTable.defaultSort + "end" : undefined,
|
|
226
|
+
width: ((_config11 = config) === null || _config11 === void 0 ? void 0 : _config11.width) || (0, _dataTable.computeWidth)(title === null || title === void 0 ? void 0 : (_title$toString = title.toString()) === null || _title$toString === void 0 ? void 0 : _title$toString.length),
|
|
227
|
+
fixed: (_config12 = config) !== null && _config12 !== void 0 && _config12.isFixed ? ((_config13 = config) === null || _config13 === void 0 ? void 0 : _config13.fixed) || ((_config14 = config) === null || _config14 === void 0 ? void 0 : _config14.isFixed) : false,
|
|
240
228
|
render: function render(value, record) {
|
|
241
|
-
var _config$render,
|
|
242
|
-
return config.custom ? (_config$render = (
|
|
229
|
+
var _config$render, _config15;
|
|
230
|
+
return config.custom ? (_config$render = (_config15 = config).render) === null || _config$render === void 0 ? void 0 : _config$render.call(_config15, value, record, config) : handleValueFormat(value, record, config, function () {
|
|
243
231
|
return onLink({
|
|
244
232
|
dataSetName: dataSetName,
|
|
245
233
|
index: index,
|
|
@@ -247,7 +235,7 @@ var handleColumns = function handleColumns(option, expressions, linkPage, onLink
|
|
|
247
235
|
});
|
|
248
236
|
});
|
|
249
237
|
}
|
|
250
|
-
};
|
|
238
|
+
});
|
|
251
239
|
});
|
|
252
240
|
if (option !== null && option !== void 0 && (_option$actionJson = option.actionJson) !== null && _option$actionJson !== void 0 && _option$actionJson.custom) {
|
|
253
241
|
var _columns$fn;
|
|
@@ -20,6 +20,8 @@ export interface TypeTargetProps {
|
|
|
20
20
|
percent: boolean;
|
|
21
21
|
/** 是否允许排序 */
|
|
22
22
|
sorted: boolean;
|
|
23
|
+
/** 默认排序 */
|
|
24
|
+
defaultSorted?: string;
|
|
23
25
|
/** 宽度 */
|
|
24
26
|
width: number;
|
|
25
27
|
/** 是否合计 */
|
|
@@ -91,7 +93,6 @@ export interface TypeZDataTableProps {
|
|
|
91
93
|
menuId: string;
|
|
92
94
|
};
|
|
93
95
|
/** 条件格式设置 */
|
|
94
|
-
expressions?: any[] | [];
|
|
95
96
|
linkPageTitle?: string;
|
|
96
97
|
/** 下钻二级页设置 */
|
|
97
98
|
linkPage?: TypeZDataTableProps[];
|