@ztocwst/rc-pro-materials 0.2.16 → 0.2.18
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-templates-data-common/components/link-renderer/index.d.ts +1 -1
- package/es/components/z-templates-data-common/components/link-renderer/index.js +30 -13
- package/es/components/z-templates-data-common/components/table-renderer/index.js +4 -1
- package/es/components/z-templates-data-common/components/table-renderer/table-renderer.helper.d.ts +1 -1
- package/es/components/z-templates-data-common/components/table-renderer/table-renderer.helper.js +20 -1
- package/es/components/z-templates-data-common/data-common.d.ts +15 -0
- package/es/components/z-templates-data-common/data-common.helper.js +1 -1
- package/es/components/z-templates-data-common/data-common.js +65 -47
- package/lib/components/z-templates-data-common/components/link-renderer/index.d.ts +1 -1
- package/lib/components/z-templates-data-common/components/link-renderer/index.js +30 -13
- package/lib/components/z-templates-data-common/components/table-renderer/index.js +4 -1
- package/lib/components/z-templates-data-common/components/table-renderer/table-renderer.helper.d.ts +1 -1
- package/lib/components/z-templates-data-common/components/table-renderer/table-renderer.helper.js +20 -1
- package/lib/components/z-templates-data-common/data-common.d.ts +15 -0
- package/lib/components/z-templates-data-common/data-common.helper.js +1 -1
- package/lib/components/z-templates-data-common/data-common.js +65 -47
- package/package.json +3 -3
|
@@ -8,7 +8,7 @@ export interface linkParamsType extends Pick<TypeChartSettingProps, 'dataSetName
|
|
|
8
8
|
dimension?: CheckboxValueType[];
|
|
9
9
|
record?: Record<string, any>;
|
|
10
10
|
}
|
|
11
|
-
export interface linkStateType extends linkParamsType, Pick<TypeChartSettingProps, 'chartTitle' | 'custom' | 'child' | 'title' | 'autoLoad' | 'refreshRate'> {
|
|
11
|
+
export interface linkStateType extends linkParamsType, Pick<TypeChartSettingProps, 'chartTitle' | 'custom' | 'child' | 'title' | 'autoLoad' | 'refreshRate' | 'actionJson'> {
|
|
12
12
|
}
|
|
13
13
|
declare const LinkRenderer: (props: Pick<TypeChartSettingProps, "onConfirm" | "chartRef" | "dimJson" | "linkPage" | "linkPageTitle"> & {
|
|
14
14
|
onBack?: () => void;
|
|
@@ -88,7 +88,8 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
88
88
|
dimension: [],
|
|
89
89
|
dimensionSource: [],
|
|
90
90
|
index: (targets === null || targets === void 0 ? void 0 : targets.index) || [],
|
|
91
|
-
indexSource: (targets === null || targets === void 0 ? void 0 : targets.indexSource) || []
|
|
91
|
+
indexSource: (targets === null || targets === void 0 ? void 0 : targets.indexSource) || [],
|
|
92
|
+
actionJson: linkState === null || linkState === void 0 ? void 0 : linkState.actionJson
|
|
92
93
|
};
|
|
93
94
|
return handleColumns(option);
|
|
94
95
|
};
|
|
@@ -117,26 +118,42 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
117
118
|
queryKeys = Object.keys(queryCache);
|
|
118
119
|
if (queryKeys !== null && queryKeys !== void 0 && queryKeys.length) {
|
|
119
120
|
queryKeys.forEach(function (k) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
var key = (queryBind === null || queryBind === void 0 ? void 0 : (_queryBind$find = queryBind.find(function (item) {
|
|
121
|
+
// 查看是否有绑定关联关系
|
|
122
|
+
var queryBindFilter = queryBind === null || queryBind === void 0 ? void 0 : queryBind.filter(function (item) {
|
|
123
123
|
return (item === null || item === void 0 ? void 0 : item.currentQueryKey) === k;
|
|
124
|
-
})
|
|
125
|
-
// "
|
|
126
|
-
|
|
124
|
+
});
|
|
125
|
+
// "键"(有建立绑定关系 取当前数据源参数(paraJson)的"键",没有则是默认查询配置的"键")
|
|
126
|
+
if (queryBindFilter !== null && queryBindFilter !== void 0 && queryBindFilter.length) {
|
|
127
|
+
// 参数为时间时会出现多个绑定关系
|
|
128
|
+
queryBindFilter.forEach(function (item) {
|
|
129
|
+
var key = item.sourceQueryKey;
|
|
130
|
+
if (key) {
|
|
131
|
+
// "值"(当前查询条件的"值")
|
|
132
|
+
query[key] = queryCache[k];
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
} else {
|
|
136
|
+
// "值"(当前查询条件的"值")
|
|
137
|
+
query[k] = queryCache[k];
|
|
138
|
+
}
|
|
127
139
|
});
|
|
128
140
|
}
|
|
129
141
|
recordKeys = Object.keys(record || {});
|
|
130
142
|
if (recordKeys.length) {
|
|
131
143
|
recordKeys.forEach(function (k) {
|
|
132
|
-
var _queryBind$find2;
|
|
133
144
|
// 查看是否有绑定关联关系
|
|
134
|
-
var
|
|
145
|
+
var queryBindFilter = queryBind === null || queryBind === void 0 ? void 0 : queryBind.filter(function (item) {
|
|
135
146
|
return (item === null || item === void 0 ? void 0 : item.parentDimKey) === k;
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
147
|
+
});
|
|
148
|
+
// 参数为时间时会出现多个绑定关系
|
|
149
|
+
if (queryBindFilter !== null && queryBindFilter !== void 0 && queryBindFilter.length) {
|
|
150
|
+
queryBindFilter.forEach(function (item) {
|
|
151
|
+
var key = item.sourceQueryKey;
|
|
152
|
+
if (key) {
|
|
153
|
+
// "值"(有建立绑定关系 取上一级数据源的维度的"值")
|
|
154
|
+
query[key] = record[k];
|
|
155
|
+
}
|
|
156
|
+
});
|
|
140
157
|
}
|
|
141
158
|
});
|
|
142
159
|
}
|
|
@@ -22,6 +22,7 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
22
22
|
exportConfig = props.exportConfig,
|
|
23
23
|
dimJson = props.dimJson,
|
|
24
24
|
indexJson = props.indexJson,
|
|
25
|
+
actionJson = props.actionJson,
|
|
25
26
|
expressions = props.expressions,
|
|
26
27
|
linkPageTitle = props.linkPageTitle,
|
|
27
28
|
linkPage = props.linkPage,
|
|
@@ -155,7 +156,9 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
155
156
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
156
157
|
while (1) switch (_context2.prev = _context2.next) {
|
|
157
158
|
case 0:
|
|
158
|
-
columns = handleColumns(
|
|
159
|
+
columns = handleColumns(_extends({}, option, {
|
|
160
|
+
actionJson: actionJson
|
|
161
|
+
}), expressions, linkPage, onLink);
|
|
159
162
|
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.updateColumns(columns);
|
|
160
163
|
case 2:
|
|
161
164
|
case "end":
|
package/es/components/z-templates-data-common/components/table-renderer/table-renderer.helper.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export type ExpressionsType = any[] | [];
|
|
|
54
54
|
/**
|
|
55
55
|
* 根据维度指标获取表格列
|
|
56
56
|
*/
|
|
57
|
-
export declare const handleColumns: (option: DimTargetChangeOptionType, expressions?: ExpressionsType, linkPage?: TypeChartSettingProps[], onLink?: (v: linkParamsType) => void) => {
|
|
57
|
+
export declare const handleColumns: (option: DimTargetChangeOptionType & Pick<TypeChartSettingProps, 'actionJson'>, expressions?: ExpressionsType, linkPage?: TypeChartSettingProps[], onLink?: (v: linkParamsType) => void) => {
|
|
58
58
|
title: import("antd/es/checkbox/Group").CheckboxValueType;
|
|
59
59
|
dataIndex: string;
|
|
60
60
|
ellipsis: boolean;
|
package/es/components/z-templates-data-common/components/table-renderer/table-renderer.helper.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
1
3
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
|
+
var _excluded = ["isFixed", "fixed", "render"];
|
|
2
5
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
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."); }
|
|
4
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); }
|
|
@@ -172,8 +175,9 @@ export var handleValueFormat = function handleValueFormat(value, record, config,
|
|
|
172
175
|
* 根据维度指标获取表格列
|
|
173
176
|
*/
|
|
174
177
|
export var handleColumns = function handleColumns(option, expressions, linkPage, onLink) {
|
|
178
|
+
var _option$actionJson;
|
|
175
179
|
var dimTarget = [].concat(option.dimension, option.index);
|
|
176
|
-
|
|
180
|
+
var columns = dimTarget.map(function (title) {
|
|
177
181
|
var _config3, _config3$link, _config4, _config5, _config6, _title$toString, _config7, _config8, _config9;
|
|
178
182
|
var config;
|
|
179
183
|
var dataIndex;
|
|
@@ -226,4 +230,19 @@ export var handleColumns = function handleColumns(option, expressions, linkPage,
|
|
|
226
230
|
}
|
|
227
231
|
};
|
|
228
232
|
});
|
|
233
|
+
if (option !== null && option !== void 0 && (_option$actionJson = option.actionJson) !== null && _option$actionJson !== void 0 && _option$actionJson.custom) {
|
|
234
|
+
var _ref5 = (option === null || option === void 0 ? void 0 : option.actionJson) || {},
|
|
235
|
+
isFixed = _ref5.isFixed,
|
|
236
|
+
fixed = _ref5.fixed,
|
|
237
|
+
_render = _ref5.render,
|
|
238
|
+
values = _objectWithoutPropertiesLoose(_ref5, _excluded);
|
|
239
|
+
columns.push(_extends({}, values, {
|
|
240
|
+
dataIndex: 'action',
|
|
241
|
+
fixed: isFixed ? fixed || isFixed : false,
|
|
242
|
+
render: function render(_, record) {
|
|
243
|
+
return _render === null || _render === void 0 ? void 0 : _render(record);
|
|
244
|
+
}
|
|
245
|
+
}));
|
|
246
|
+
}
|
|
247
|
+
return columns;
|
|
229
248
|
};
|
|
@@ -65,6 +65,21 @@ export interface TypeChartSettingProps {
|
|
|
65
65
|
remember?: boolean;
|
|
66
66
|
/** 导出 */
|
|
67
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
|
+
};
|
|
68
83
|
/** 导出配置 */
|
|
69
84
|
exportConfig?: {
|
|
70
85
|
name: string;
|
|
@@ -157,7 +157,7 @@ export var handleCondition = function handleCondition(value, handledValue, condi
|
|
|
157
157
|
};
|
|
158
158
|
|
|
159
159
|
// mock
|
|
160
|
-
var token = 'scm:tenant:token:2:
|
|
160
|
+
var token = 'scm:tenant:token:2:9:64174758CFF5CA5921E1EC31750DDBDC';
|
|
161
161
|
|
|
162
162
|
/** 获取维度指标 */
|
|
163
163
|
export var getDimTarget = /*#__PURE__*/function () {
|
|
@@ -29,50 +29,66 @@ var ZTemplatesDataCommon = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
29
29
|
var onFinish = function onFinish(values) {
|
|
30
30
|
chartRenderRef.current.queryChart(values);
|
|
31
31
|
};
|
|
32
|
-
var
|
|
32
|
+
var onQueryValues = /*#__PURE__*/function () {
|
|
33
33
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
34
|
-
var
|
|
34
|
+
var _formRef$current$vali, _formRef$current, _formRef$current$vali2;
|
|
35
35
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
36
36
|
while (1) switch (_context.prev = _context.next) {
|
|
37
37
|
case 0:
|
|
38
|
-
_context.
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
return _context.abrupt("return", (_formRef$current$vali = (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : (_formRef$current$vali2 = _formRef$current.validateFields) === null || _formRef$current$vali2 === void 0 ? void 0 : _formRef$current$vali2.call(_formRef$current)) !== null && _formRef$current$vali !== void 0 ? _formRef$current$vali : {});
|
|
39
|
+
case 1:
|
|
40
|
+
case "end":
|
|
41
|
+
return _context.stop();
|
|
42
|
+
}
|
|
43
|
+
}, _callee);
|
|
44
|
+
}));
|
|
45
|
+
return function onQueryValues() {
|
|
46
|
+
return _ref.apply(this, arguments);
|
|
47
|
+
};
|
|
48
|
+
}();
|
|
49
|
+
var onQueryFormatValues = /*#__PURE__*/function () {
|
|
50
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
51
|
+
var _formRef$current$vali3, _formRef$current2, _formRef$current2$val;
|
|
52
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
53
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
54
|
+
case 0:
|
|
55
|
+
return _context2.abrupt("return", (_formRef$current$vali3 = (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : (_formRef$current2$val = _formRef$current2.validateFieldsReturnFormatValue) === null || _formRef$current2$val === void 0 ? void 0 : _formRef$current2$val.call(_formRef$current2)) !== null && _formRef$current$vali3 !== void 0 ? _formRef$current$vali3 : {});
|
|
56
|
+
case 1:
|
|
57
|
+
case "end":
|
|
58
|
+
return _context2.stop();
|
|
59
|
+
}
|
|
60
|
+
}, _callee2);
|
|
61
|
+
}));
|
|
62
|
+
return function onQueryFormatValues() {
|
|
63
|
+
return _ref2.apply(this, arguments);
|
|
64
|
+
};
|
|
65
|
+
}();
|
|
66
|
+
var onConfirm = /*#__PURE__*/function () {
|
|
67
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
68
|
+
var values;
|
|
69
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
70
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
71
|
+
case 0:
|
|
72
|
+
_context3.prev = 0;
|
|
73
|
+
_context3.next = 3;
|
|
74
|
+
return onQueryFormatValues();
|
|
41
75
|
case 3:
|
|
42
|
-
|
|
43
|
-
_context.t0 = _context.t1 !== null;
|
|
44
|
-
if (!_context.t0) {
|
|
45
|
-
_context.next = 7;
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
_context.t0 = _yield$formRef$curren !== void 0;
|
|
49
|
-
case 7:
|
|
50
|
-
if (!_context.t0) {
|
|
51
|
-
_context.next = 11;
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
_context.t2 = _yield$formRef$curren;
|
|
55
|
-
_context.next = 12;
|
|
56
|
-
break;
|
|
57
|
-
case 11:
|
|
58
|
-
_context.t2 = {};
|
|
59
|
-
case 12:
|
|
60
|
-
values = _context.t2;
|
|
76
|
+
values = _context3.sent;
|
|
61
77
|
chartRenderRef.current.queryChart(values);
|
|
62
|
-
|
|
78
|
+
_context3.next = 10;
|
|
63
79
|
break;
|
|
64
|
-
case
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
console.error(
|
|
68
|
-
case
|
|
80
|
+
case 7:
|
|
81
|
+
_context3.prev = 7;
|
|
82
|
+
_context3.t0 = _context3["catch"](0);
|
|
83
|
+
console.error(_context3.t0);
|
|
84
|
+
case 10:
|
|
69
85
|
case "end":
|
|
70
|
-
return
|
|
86
|
+
return _context3.stop();
|
|
71
87
|
}
|
|
72
|
-
},
|
|
88
|
+
}, _callee3, null, [[0, 7]]);
|
|
73
89
|
}));
|
|
74
90
|
return function onConfirm() {
|
|
75
|
-
return
|
|
91
|
+
return _ref3.apply(this, arguments);
|
|
76
92
|
};
|
|
77
93
|
}();
|
|
78
94
|
var onLink = function onLink(values) {
|
|
@@ -81,7 +97,9 @@ var ZTemplatesDataCommon = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
81
97
|
};
|
|
82
98
|
useImperativeHandle(ref, function () {
|
|
83
99
|
return {
|
|
84
|
-
onLink: onLink
|
|
100
|
+
onLink: onLink,
|
|
101
|
+
onQueryValues: onQueryValues,
|
|
102
|
+
onQueryFormatValues: onQueryFormatValues
|
|
85
103
|
};
|
|
86
104
|
});
|
|
87
105
|
var formProps = processFormProps(querySetting);
|
|
@@ -90,32 +108,32 @@ var ZTemplatesDataCommon = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
90
108
|
formRef: formRef,
|
|
91
109
|
onValuesChange: function onValuesChange(changeValues) {},
|
|
92
110
|
onFinish: /*#__PURE__*/function () {
|
|
93
|
-
var
|
|
111
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(formatData) {
|
|
94
112
|
var _formProps$onFinish;
|
|
95
|
-
return _regeneratorRuntime.wrap(function
|
|
96
|
-
while (1) switch (
|
|
113
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
114
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
97
115
|
case 0:
|
|
98
|
-
|
|
99
|
-
|
|
116
|
+
_context4.prev = 0;
|
|
117
|
+
_context4.next = 3;
|
|
100
118
|
return (_formProps$onFinish = formProps.onFinish) === null || _formProps$onFinish === void 0 ? void 0 : _formProps$onFinish.call(formProps, formatData);
|
|
101
119
|
case 3:
|
|
102
|
-
|
|
120
|
+
_context4.next = 5;
|
|
103
121
|
return onFinish === null || onFinish === void 0 ? void 0 : onFinish(formatData);
|
|
104
122
|
case 5:
|
|
105
|
-
|
|
123
|
+
_context4.next = 10;
|
|
106
124
|
break;
|
|
107
125
|
case 7:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
_message.error(
|
|
126
|
+
_context4.prev = 7;
|
|
127
|
+
_context4.t0 = _context4["catch"](0);
|
|
128
|
+
_message.error(_context4.t0);
|
|
111
129
|
case 10:
|
|
112
130
|
case "end":
|
|
113
|
-
return
|
|
131
|
+
return _context4.stop();
|
|
114
132
|
}
|
|
115
|
-
},
|
|
133
|
+
}, _callee4, null, [[0, 7]]);
|
|
116
134
|
}));
|
|
117
135
|
return function (_x) {
|
|
118
|
-
return
|
|
136
|
+
return _ref4.apply(this, arguments);
|
|
119
137
|
};
|
|
120
138
|
}()
|
|
121
139
|
})), /*#__PURE__*/React.createElement(ChartRenderer, {
|
|
@@ -8,7 +8,7 @@ export interface linkParamsType extends Pick<TypeChartSettingProps, 'dataSetName
|
|
|
8
8
|
dimension?: CheckboxValueType[];
|
|
9
9
|
record?: Record<string, any>;
|
|
10
10
|
}
|
|
11
|
-
export interface linkStateType extends linkParamsType, Pick<TypeChartSettingProps, 'chartTitle' | 'custom' | 'child' | 'title' | 'autoLoad' | 'refreshRate'> {
|
|
11
|
+
export interface linkStateType extends linkParamsType, Pick<TypeChartSettingProps, 'chartTitle' | 'custom' | 'child' | 'title' | 'autoLoad' | 'refreshRate' | 'actionJson'> {
|
|
12
12
|
}
|
|
13
13
|
declare const LinkRenderer: (props: Pick<TypeChartSettingProps, "onConfirm" | "chartRef" | "dimJson" | "linkPage" | "linkPageTitle"> & {
|
|
14
14
|
onBack?: () => void;
|
|
@@ -93,7 +93,8 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
93
93
|
dimension: [],
|
|
94
94
|
dimensionSource: [],
|
|
95
95
|
index: (targets === null || targets === void 0 ? void 0 : targets.index) || [],
|
|
96
|
-
indexSource: (targets === null || targets === void 0 ? void 0 : targets.indexSource) || []
|
|
96
|
+
indexSource: (targets === null || targets === void 0 ? void 0 : targets.indexSource) || [],
|
|
97
|
+
actionJson: linkState === null || linkState === void 0 ? void 0 : linkState.actionJson
|
|
97
98
|
};
|
|
98
99
|
return (0, _tableRenderer.handleColumns)(option);
|
|
99
100
|
};
|
|
@@ -122,26 +123,42 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
122
123
|
queryKeys = Object.keys(queryCache);
|
|
123
124
|
if (queryKeys !== null && queryKeys !== void 0 && queryKeys.length) {
|
|
124
125
|
queryKeys.forEach(function (k) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
var key = (queryBind === null || queryBind === void 0 ? void 0 : (_queryBind$find = queryBind.find(function (item) {
|
|
126
|
+
// 查看是否有绑定关联关系
|
|
127
|
+
var queryBindFilter = queryBind === null || queryBind === void 0 ? void 0 : queryBind.filter(function (item) {
|
|
128
128
|
return (item === null || item === void 0 ? void 0 : item.currentQueryKey) === k;
|
|
129
|
-
})
|
|
130
|
-
// "
|
|
131
|
-
|
|
129
|
+
});
|
|
130
|
+
// "键"(有建立绑定关系 取当前数据源参数(paraJson)的"键",没有则是默认查询配置的"键")
|
|
131
|
+
if (queryBindFilter !== null && queryBindFilter !== void 0 && queryBindFilter.length) {
|
|
132
|
+
// 参数为时间时会出现多个绑定关系
|
|
133
|
+
queryBindFilter.forEach(function (item) {
|
|
134
|
+
var key = item.sourceQueryKey;
|
|
135
|
+
if (key) {
|
|
136
|
+
// "值"(当前查询条件的"值")
|
|
137
|
+
query[key] = queryCache[k];
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
} else {
|
|
141
|
+
// "值"(当前查询条件的"值")
|
|
142
|
+
query[k] = queryCache[k];
|
|
143
|
+
}
|
|
132
144
|
});
|
|
133
145
|
}
|
|
134
146
|
recordKeys = Object.keys(record || {});
|
|
135
147
|
if (recordKeys.length) {
|
|
136
148
|
recordKeys.forEach(function (k) {
|
|
137
|
-
var _queryBind$find2;
|
|
138
149
|
// 查看是否有绑定关联关系
|
|
139
|
-
var
|
|
150
|
+
var queryBindFilter = queryBind === null || queryBind === void 0 ? void 0 : queryBind.filter(function (item) {
|
|
140
151
|
return (item === null || item === void 0 ? void 0 : item.parentDimKey) === k;
|
|
141
|
-
})
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
152
|
+
});
|
|
153
|
+
// 参数为时间时会出现多个绑定关系
|
|
154
|
+
if (queryBindFilter !== null && queryBindFilter !== void 0 && queryBindFilter.length) {
|
|
155
|
+
queryBindFilter.forEach(function (item) {
|
|
156
|
+
var key = item.sourceQueryKey;
|
|
157
|
+
if (key) {
|
|
158
|
+
// "值"(有建立绑定关系 取上一级数据源的维度的"值")
|
|
159
|
+
query[key] = record[k];
|
|
160
|
+
}
|
|
161
|
+
});
|
|
145
162
|
}
|
|
146
163
|
});
|
|
147
164
|
}
|
|
@@ -27,6 +27,7 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
27
27
|
exportConfig = props.exportConfig,
|
|
28
28
|
dimJson = props.dimJson,
|
|
29
29
|
indexJson = props.indexJson,
|
|
30
|
+
actionJson = props.actionJson,
|
|
30
31
|
expressions = props.expressions,
|
|
31
32
|
linkPageTitle = props.linkPageTitle,
|
|
32
33
|
linkPage = props.linkPage,
|
|
@@ -160,7 +161,9 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
160
161
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
161
162
|
while (1) switch (_context2.prev = _context2.next) {
|
|
162
163
|
case 0:
|
|
163
|
-
columns = (0, _tableRenderer.handleColumns)(
|
|
164
|
+
columns = (0, _tableRenderer.handleColumns)((0, _extends2["default"])({}, option, {
|
|
165
|
+
actionJson: actionJson
|
|
166
|
+
}), expressions, linkPage, onLink);
|
|
164
167
|
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.updateColumns(columns);
|
|
165
168
|
case 2:
|
|
166
169
|
case "end":
|
package/lib/components/z-templates-data-common/components/table-renderer/table-renderer.helper.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export type ExpressionsType = any[] | [];
|
|
|
54
54
|
/**
|
|
55
55
|
* 根据维度指标获取表格列
|
|
56
56
|
*/
|
|
57
|
-
export declare const handleColumns: (option: DimTargetChangeOptionType, expressions?: ExpressionsType, linkPage?: TypeChartSettingProps[], onLink?: (v: linkParamsType) => void) => {
|
|
57
|
+
export declare const handleColumns: (option: DimTargetChangeOptionType & Pick<TypeChartSettingProps, 'actionJson'>, expressions?: ExpressionsType, linkPage?: TypeChartSettingProps[], onLink?: (v: linkParamsType) => void) => {
|
|
58
58
|
title: import("antd/es/checkbox/Group").CheckboxValueType;
|
|
59
59
|
dataIndex: string;
|
|
60
60
|
ellipsis: boolean;
|
package/lib/components/z-templates-data-common/components/table-renderer/table-renderer.helper.js
CHANGED
|
@@ -3,9 +3,12 @@
|
|
|
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
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
6
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
7
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
8
10
|
var _dataCommon = require("../../data-common.helper");
|
|
11
|
+
var _excluded = ["isFixed", "fixed", "render"];
|
|
9
12
|
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."); }
|
|
10
13
|
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); }
|
|
11
14
|
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; }
|
|
@@ -180,8 +183,9 @@ exports.handleValueFormat = handleValueFormat;
|
|
|
180
183
|
* 根据维度指标获取表格列
|
|
181
184
|
*/
|
|
182
185
|
var handleColumns = function handleColumns(option, expressions, linkPage, onLink) {
|
|
186
|
+
var _option$actionJson;
|
|
183
187
|
var dimTarget = [].concat(option.dimension, option.index);
|
|
184
|
-
|
|
188
|
+
var columns = dimTarget.map(function (title) {
|
|
185
189
|
var _config3, _config3$link, _config4, _config5, _config6, _title$toString, _config7, _config8, _config9;
|
|
186
190
|
var config;
|
|
187
191
|
var dataIndex;
|
|
@@ -234,5 +238,20 @@ var handleColumns = function handleColumns(option, expressions, linkPage, onLink
|
|
|
234
238
|
}
|
|
235
239
|
};
|
|
236
240
|
});
|
|
241
|
+
if (option !== null && option !== void 0 && (_option$actionJson = option.actionJson) !== null && _option$actionJson !== void 0 && _option$actionJson.custom) {
|
|
242
|
+
var _ref5 = (option === null || option === void 0 ? void 0 : option.actionJson) || {},
|
|
243
|
+
isFixed = _ref5.isFixed,
|
|
244
|
+
fixed = _ref5.fixed,
|
|
245
|
+
_render = _ref5.render,
|
|
246
|
+
values = (0, _objectWithoutPropertiesLoose2["default"])(_ref5, _excluded);
|
|
247
|
+
columns.push((0, _extends2["default"])({}, values, {
|
|
248
|
+
dataIndex: 'action',
|
|
249
|
+
fixed: isFixed ? fixed || isFixed : false,
|
|
250
|
+
render: function render(_, record) {
|
|
251
|
+
return _render === null || _render === void 0 ? void 0 : _render(record);
|
|
252
|
+
}
|
|
253
|
+
}));
|
|
254
|
+
}
|
|
255
|
+
return columns;
|
|
237
256
|
};
|
|
238
257
|
exports.handleColumns = handleColumns;
|
|
@@ -65,6 +65,21 @@ export interface TypeChartSettingProps {
|
|
|
65
65
|
remember?: boolean;
|
|
66
66
|
/** 导出 */
|
|
67
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
|
+
};
|
|
68
83
|
/** 导出配置 */
|
|
69
84
|
exportConfig?: {
|
|
70
85
|
name: string;
|
|
@@ -172,7 +172,7 @@ var handleCondition = function handleCondition(value, handledValue, conditions)
|
|
|
172
172
|
|
|
173
173
|
// mock
|
|
174
174
|
exports.handleCondition = handleCondition;
|
|
175
|
-
var token = 'scm:tenant:token:2:
|
|
175
|
+
var token = 'scm:tenant:token:2:9:64174758CFF5CA5921E1EC31750DDBDC';
|
|
176
176
|
|
|
177
177
|
/** 获取维度指标 */
|
|
178
178
|
var getDimTarget = /*#__PURE__*/function () {
|