@ztocwst/rc-pro-materials 0.1.31 → 0.1.33
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/designer.html +4 -4
- package/build/lowcode/index.html +4 -4
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +3 -3
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +3 -3
- package/dist/SCM_Comps.css +1 -1
- package/dist/SCM_Comps.js +6 -6
- package/dist/SCM_Comps.js.map +1 -1
- package/es/components/z-pointer-block/index.less +1 -1
- package/es/components/z-pointer-block/z-pointer-block.js +1 -1
- package/es/components/z-templates-data-common/components/custom-renderer/index.js +20 -11
- package/es/components/z-templates-data-common/components/link-renderer/index.d.ts +2 -2
- package/es/components/z-templates-data-common/components/link-renderer/index.js +7 -3
- package/es/components/z-templates-data-common/components/table-renderer/table-renderer.helper.js +7 -6
- package/es/components/z-templates-data-common/data-common.d.ts +2 -0
- package/es/components/z-templates-data-common/data-common.helper.js +42 -38
- package/es/style.js +1 -0
- package/lib/components/z-pointer-block/index.less +1 -1
- package/lib/components/z-pointer-block/z-pointer-block.js +1 -1
- package/lib/components/z-templates-data-common/components/custom-renderer/index.js +20 -11
- package/lib/components/z-templates-data-common/components/link-renderer/index.d.ts +2 -2
- package/lib/components/z-templates-data-common/components/link-renderer/index.js +7 -3
- package/lib/components/z-templates-data-common/components/table-renderer/table-renderer.helper.js +6 -5
- package/lib/components/z-templates-data-common/data-common.d.ts +2 -0
- package/lib/components/z-templates-data-common/data-common.helper.js +42 -38
- package/lib/style.js +1 -0
- package/package.json +3 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _Spin from "antd/es/spin";
|
|
1
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
3
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
4
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
@@ -26,8 +27,11 @@ var CustomRenderer = function CustomRenderer(props) {
|
|
|
26
27
|
result = _useState[0],
|
|
27
28
|
setResult = _useState[1];
|
|
28
29
|
var _useState2 = useState(false),
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
loading = _useState2[0],
|
|
31
|
+
setLoading = _useState2[1];
|
|
32
|
+
var _useState3 = useState(false),
|
|
33
|
+
isLink = _useState3[0],
|
|
34
|
+
setIsLink = _useState3[1];
|
|
31
35
|
var linkChartRef = useRef();
|
|
32
36
|
var timer = null;
|
|
33
37
|
var onLink = function onLink(values) {
|
|
@@ -62,25 +66,28 @@ var CustomRenderer = function CustomRenderer(props) {
|
|
|
62
66
|
queryParams: queryParams,
|
|
63
67
|
dataSetName: dataSetName
|
|
64
68
|
};
|
|
65
|
-
|
|
69
|
+
setLoading(true);
|
|
70
|
+
_context.next = 9;
|
|
66
71
|
return getReportData(rcProContext, formatter ? formatter === null || formatter === void 0 ? void 0 : formatter(data) : data);
|
|
67
|
-
case
|
|
72
|
+
case 9:
|
|
68
73
|
res = _context.sent;
|
|
74
|
+
setLoading(false);
|
|
69
75
|
if (res !== null && res !== void 0 && res.success) {
|
|
70
76
|
setResult(res === null || res === void 0 ? void 0 : res.result);
|
|
71
77
|
}
|
|
72
|
-
_context.next =
|
|
78
|
+
_context.next = 19;
|
|
73
79
|
break;
|
|
74
|
-
case
|
|
75
|
-
_context.prev =
|
|
80
|
+
case 14:
|
|
81
|
+
_context.prev = 14;
|
|
76
82
|
_context.t0 = _context["catch"](1);
|
|
83
|
+
setLoading(false);
|
|
77
84
|
setResult(null);
|
|
78
85
|
console.error(_context.t0);
|
|
79
|
-
case
|
|
86
|
+
case 19:
|
|
80
87
|
case "end":
|
|
81
88
|
return _context.stop();
|
|
82
89
|
}
|
|
83
|
-
}, _callee, null, [[1,
|
|
90
|
+
}, _callee, null, [[1, 14]]);
|
|
84
91
|
}));
|
|
85
92
|
return function getDataSource(_x) {
|
|
86
93
|
return _ref2.apply(this, arguments);
|
|
@@ -141,11 +148,13 @@ var CustomRenderer = function CustomRenderer(props) {
|
|
|
141
148
|
queryChart: queryChart
|
|
142
149
|
};
|
|
143
150
|
});
|
|
144
|
-
return /*#__PURE__*/React.createElement(
|
|
151
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
145
152
|
style: {
|
|
146
153
|
display: !isLink ? 'block' : 'none'
|
|
147
154
|
}
|
|
148
|
-
},
|
|
155
|
+
}, /*#__PURE__*/React.createElement(_Spin, {
|
|
156
|
+
spinning: loading
|
|
157
|
+
}, (_props$child = props.child) === null || _props$child === void 0 ? void 0 : _props$child.call(props, result))), /*#__PURE__*/React.createElement("div", {
|
|
149
158
|
style: {
|
|
150
159
|
display: isLink ? 'block' : 'none'
|
|
151
160
|
}
|
|
@@ -3,12 +3,12 @@ import type { CheckboxValueType } from 'antd/es/checkbox/Group';
|
|
|
3
3
|
import type { TypeChartSettingProps } from '../../data-common';
|
|
4
4
|
import './index.less';
|
|
5
5
|
export interface linkParamsType extends Pick<TypeChartSettingProps, 'dataSetName'> {
|
|
6
|
-
index?: number;
|
|
6
|
+
index?: number | string;
|
|
7
7
|
width?: number;
|
|
8
8
|
dimension?: CheckboxValueType[];
|
|
9
9
|
record?: Record<string, any>;
|
|
10
10
|
}
|
|
11
|
-
export interface linkStateType extends linkParamsType, Pick<TypeChartSettingProps, 'title' | 'autoLoad' | 'refreshRate'> {
|
|
11
|
+
export interface linkStateType extends linkParamsType, Pick<TypeChartSettingProps, 'chartTitle' | 'title' | 'autoLoad' | 'refreshRate'> {
|
|
12
12
|
}
|
|
13
13
|
declare const LinkRenderer: (props: Pick<TypeChartSettingProps, "onConfirm" | "chartRef" | "dimJson" | "linkPage" | "linkPageTitle"> & {
|
|
14
14
|
onBack?: () => void;
|
|
@@ -59,7 +59,7 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
59
59
|
return function () {
|
|
60
60
|
handleClearInterval();
|
|
61
61
|
};
|
|
62
|
-
}, [linkState.dataSetName, linkState.autoLoad]);
|
|
62
|
+
}, [linkState.dataSetName, linkState.index, linkState.autoLoad]);
|
|
63
63
|
|
|
64
64
|
// 获取表头
|
|
65
65
|
var handleGetColumns = function handleGetColumns(stateParams) {
|
|
@@ -208,12 +208,14 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
210
|
var _linkPage$index2 = linkPage[index],
|
|
211
|
+
chartTitle = _linkPage$index2.chartTitle,
|
|
211
212
|
title = _linkPage$index2.title,
|
|
212
213
|
autoLoad = _linkPage$index2.autoLoad,
|
|
213
214
|
refreshRate = _linkPage$index2.refreshRate;
|
|
214
215
|
var stateData = _extends({}, state, {
|
|
215
216
|
width: width,
|
|
216
217
|
index: index,
|
|
218
|
+
chartTitle: chartTitle,
|
|
217
219
|
title: title,
|
|
218
220
|
autoLoad: autoLoad,
|
|
219
221
|
refreshRate: refreshRate
|
|
@@ -250,12 +252,14 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
250
252
|
dataSetName = _ref6[0],
|
|
251
253
|
index = _ref6[1];
|
|
252
254
|
var _linkPage$index3 = linkPage[index],
|
|
255
|
+
chartTitle = _linkPage$index3.chartTitle,
|
|
253
256
|
title = _linkPage$index3.title,
|
|
254
257
|
autoLoad = _linkPage$index3.autoLoad,
|
|
255
258
|
refreshRate = _linkPage$index3.refreshRate;
|
|
256
259
|
var stateData = _extends({}, linkState, {
|
|
257
260
|
dataSetName: dataSetName,
|
|
258
261
|
index: index,
|
|
262
|
+
chartTitle: chartTitle,
|
|
259
263
|
title: title,
|
|
260
264
|
autoLoad: autoLoad,
|
|
261
265
|
refreshRate: refreshRate
|
|
@@ -270,10 +274,10 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
270
274
|
}, /*#__PURE__*/React.createElement(ArrowLeftOutlined, {
|
|
271
275
|
className: "arrow-left",
|
|
272
276
|
onClick: onBack
|
|
273
|
-
}), /*#__PURE__*/React.createElement("span", null, linkPageTitle)), (linkPage === null || linkPage === void 0 ? void 0 : (_linkPage$filter = linkPage.filter(function (field) {
|
|
277
|
+
}), /*#__PURE__*/React.createElement("span", null, linkState.chartTitle || linkPageTitle)), (linkPage === null || linkPage === void 0 ? void 0 : (_linkPage$filter = linkPage.filter(function (field) {
|
|
274
278
|
return (field === null || field === void 0 ? void 0 : field.dataSetName) === linkState.dataSetName;
|
|
275
279
|
})) === null || _linkPage$filter === void 0 ? void 0 : _linkPage$filter.length) <= 1 ? null : /*#__PURE__*/React.createElement(_Radio.Group, {
|
|
276
|
-
value: "" + (linkState === null || linkState === void 0 ? void 0 : linkState.
|
|
280
|
+
value: "" + (linkState === null || linkState === void 0 ? void 0 : linkState.dataSetName) + separator + linkState.index,
|
|
277
281
|
onChange: handleLinkChange
|
|
278
282
|
}, linkPage === null || linkPage === void 0 ? void 0 : linkPage.map(function (field, index) {
|
|
279
283
|
return (field === null || field === void 0 ? void 0 : field.dataSetName) === linkState.dataSetName ? /*#__PURE__*/React.createElement(_Radio.Button, {
|
package/es/components/z-templates-data-common/components/table-renderer/table-renderer.helper.js
CHANGED
|
@@ -3,7 +3,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
3
3
|
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
4
|
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); }
|
|
5
5
|
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; }
|
|
6
|
-
import { computeWidth, handleDecimal, handleThousand, handlePercent, handleLink, handleCondition, getDimTarget } from "../../data-common.helper";
|
|
6
|
+
import { separator, computeWidth, handleDecimal, handleThousand, handlePercent, handleLink, handleCondition, getDimTarget } from "../../data-common.helper";
|
|
7
7
|
export var stringTrim = function stringTrim(str) {
|
|
8
8
|
if (!str) return '';
|
|
9
9
|
return str.replace(/`|'|"/g, '');
|
|
@@ -174,7 +174,7 @@ export var handleValueFormat = function handleValueFormat(value, record, find, c
|
|
|
174
174
|
export var handleColumns = function handleColumns(option, expressions, onLink) {
|
|
175
175
|
var dimTarget = [].concat(option.dimension, option.index);
|
|
176
176
|
return dimTarget.map(function (title) {
|
|
177
|
-
var _find3, _find4, _title$toString;
|
|
177
|
+
var _find3, _find3$link, _find4, _find5, _title$toString;
|
|
178
178
|
var find;
|
|
179
179
|
var dataIndex;
|
|
180
180
|
var condition;
|
|
@@ -199,17 +199,18 @@ export var handleColumns = function handleColumns(option, expressions, onLink) {
|
|
|
199
199
|
// condition = expressions?.filter((item) => item?.index?.includes(find?.name));
|
|
200
200
|
// }
|
|
201
201
|
|
|
202
|
+
var _ref4 = ((_find3 = find) === null || _find3 === void 0 ? void 0 : (_find3$link = _find3.link) === null || _find3$link === void 0 ? void 0 : _find3$link.split(separator)) || [],
|
|
203
|
+
dataSetName = _ref4[0];
|
|
202
204
|
return {
|
|
203
205
|
title: title,
|
|
204
206
|
dataIndex: dataIndex,
|
|
205
207
|
ellipsis: true,
|
|
206
|
-
sorter: (
|
|
207
|
-
width: ((
|
|
208
|
+
sorter: (_find4 = find) === null || _find4 === void 0 ? void 0 : _find4.sorted,
|
|
209
|
+
width: ((_find5 = find) === null || _find5 === void 0 ? void 0 : _find5.width) || computeWidth(title === null || title === void 0 ? void 0 : (_title$toString = title.toString()) === null || _title$toString === void 0 ? void 0 : _title$toString.length),
|
|
208
210
|
render: function render(value, record) {
|
|
209
211
|
return handleValueFormat(value, record, find, condition, function () {
|
|
210
|
-
var _find5;
|
|
211
212
|
return onLink({
|
|
212
|
-
dataSetName:
|
|
213
|
+
dataSetName: dataSetName,
|
|
213
214
|
record: record
|
|
214
215
|
});
|
|
215
216
|
});
|
|
@@ -162,30 +162,32 @@ var token = 'scm:tenant:token:2:104:177217352666D386AA01E5AF6293727D';
|
|
|
162
162
|
/** 获取维度指标 */
|
|
163
163
|
export var getDimTarget = /*#__PURE__*/function () {
|
|
164
164
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(rcProContext, params) {
|
|
165
|
-
var
|
|
165
|
+
var _data_env_mapping$env;
|
|
166
|
+
var _ref2, materialsRequest, env, data_env_mapping, __env, res, _res;
|
|
166
167
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
167
168
|
while (1) switch (_context.prev = _context.next) {
|
|
168
169
|
case 0:
|
|
169
|
-
_ref2 = rcProContext || {}, materialsRequest = _ref2.materialsRequest, env = _ref2.env
|
|
170
|
+
_ref2 = rcProContext || {}, materialsRequest = _ref2.materialsRequest, env = _ref2.env, data_env_mapping = _ref2.data_env_mapping;
|
|
171
|
+
__env = (_data_env_mapping$env = data_env_mapping === null || data_env_mapping === void 0 ? void 0 : data_env_mapping[env]) !== null && _data_env_mapping$env !== void 0 ? _data_env_mapping$env : data_env_mapping === null || data_env_mapping === void 0 ? void 0 : data_env_mapping['__other']; // 供应链里由子应用透传
|
|
170
172
|
if (!materialsRequest) {
|
|
171
|
-
_context.next =
|
|
173
|
+
_context.next = 7;
|
|
172
174
|
break;
|
|
173
175
|
}
|
|
174
|
-
_context.next =
|
|
176
|
+
_context.next = 5;
|
|
175
177
|
return rcProRequest(rcProContext, "/data/forward/v1/bigdata/report/view/query/" + params.dataSetName, {
|
|
176
178
|
method: 'POST',
|
|
177
179
|
data: {
|
|
178
|
-
bigDataBody: _extends({
|
|
179
|
-
env:
|
|
180
|
-
}, params)
|
|
180
|
+
bigDataBody: _extends({}, __env ? {
|
|
181
|
+
env: __env
|
|
182
|
+
} : {}, params)
|
|
181
183
|
}
|
|
182
184
|
});
|
|
183
|
-
case
|
|
185
|
+
case 5:
|
|
184
186
|
res = _context.sent;
|
|
185
187
|
return _context.abrupt("return", res);
|
|
186
|
-
case
|
|
187
|
-
_context.prev =
|
|
188
|
-
_context.next =
|
|
188
|
+
case 7:
|
|
189
|
+
_context.prev = 7;
|
|
190
|
+
_context.next = 10;
|
|
189
191
|
return fetch("http://scm.gateway.dev.ztyc.com/data/forward/v1/bigdata/report/view/query/" + params.dataSetName, {
|
|
190
192
|
method: 'POST',
|
|
191
193
|
body: JSON.stringify({
|
|
@@ -198,21 +200,21 @@ export var getDimTarget = /*#__PURE__*/function () {
|
|
|
198
200
|
token: token
|
|
199
201
|
}
|
|
200
202
|
});
|
|
201
|
-
case
|
|
203
|
+
case 10:
|
|
202
204
|
_res = _context.sent;
|
|
203
|
-
_context.next =
|
|
205
|
+
_context.next = 13;
|
|
204
206
|
return _res.json();
|
|
205
|
-
case
|
|
207
|
+
case 13:
|
|
206
208
|
return _context.abrupt("return", _context.sent);
|
|
207
|
-
case
|
|
208
|
-
_context.prev =
|
|
209
|
-
_context.t0 = _context["catch"](
|
|
209
|
+
case 16:
|
|
210
|
+
_context.prev = 16;
|
|
211
|
+
_context.t0 = _context["catch"](7);
|
|
210
212
|
return _context.abrupt("return", {});
|
|
211
|
-
case
|
|
213
|
+
case 19:
|
|
212
214
|
case "end":
|
|
213
215
|
return _context.stop();
|
|
214
216
|
}
|
|
215
|
-
}, _callee, null, [[
|
|
217
|
+
}, _callee, null, [[7, 16]]);
|
|
216
218
|
}));
|
|
217
219
|
return function getDimTarget(_x, _x2) {
|
|
218
220
|
return _ref.apply(this, arguments);
|
|
@@ -222,30 +224,32 @@ export var getDimTarget = /*#__PURE__*/function () {
|
|
|
222
224
|
/** 获取报表数据 */
|
|
223
225
|
export var getReportData = /*#__PURE__*/function () {
|
|
224
226
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(rcProContext, params) {
|
|
225
|
-
var
|
|
227
|
+
var _data_env_mapping$env2;
|
|
228
|
+
var _ref4, materialsRequest, env, data_env_mapping, __env, res, _res2;
|
|
226
229
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
227
230
|
while (1) switch (_context2.prev = _context2.next) {
|
|
228
231
|
case 0:
|
|
229
|
-
_ref4 = rcProContext || {}, materialsRequest = _ref4.materialsRequest, env = _ref4.env
|
|
232
|
+
_ref4 = rcProContext || {}, materialsRequest = _ref4.materialsRequest, env = _ref4.env, data_env_mapping = _ref4.data_env_mapping;
|
|
233
|
+
__env = (_data_env_mapping$env2 = data_env_mapping === null || data_env_mapping === void 0 ? void 0 : data_env_mapping[env]) !== null && _data_env_mapping$env2 !== void 0 ? _data_env_mapping$env2 : data_env_mapping === null || data_env_mapping === void 0 ? void 0 : data_env_mapping['__other']; // 供应链里由子应用透传
|
|
230
234
|
if (!materialsRequest) {
|
|
231
|
-
_context2.next =
|
|
235
|
+
_context2.next = 7;
|
|
232
236
|
break;
|
|
233
237
|
}
|
|
234
|
-
_context2.next =
|
|
238
|
+
_context2.next = 5;
|
|
235
239
|
return rcProRequest(rcProContext, "/data/forward/v1/bigdata/report/" + params.dataSetName, {
|
|
236
240
|
method: 'POST',
|
|
237
241
|
data: {
|
|
238
|
-
bigDataBody: _extends({
|
|
239
|
-
env:
|
|
240
|
-
}, params)
|
|
242
|
+
bigDataBody: _extends({}, __env ? {
|
|
243
|
+
env: __env
|
|
244
|
+
} : {}, params)
|
|
241
245
|
}
|
|
242
246
|
});
|
|
243
|
-
case
|
|
247
|
+
case 5:
|
|
244
248
|
res = _context2.sent;
|
|
245
249
|
return _context2.abrupt("return", res);
|
|
246
|
-
case
|
|
247
|
-
_context2.prev =
|
|
248
|
-
_context2.next =
|
|
250
|
+
case 7:
|
|
251
|
+
_context2.prev = 7;
|
|
252
|
+
_context2.next = 10;
|
|
249
253
|
return fetch("http://scm.gateway.dev.ztyc.com/data/forward/v1/bigdata/report/" + params.dataSetName, {
|
|
250
254
|
method: 'POST',
|
|
251
255
|
body: JSON.stringify({
|
|
@@ -258,21 +262,21 @@ export var getReportData = /*#__PURE__*/function () {
|
|
|
258
262
|
token: token
|
|
259
263
|
}
|
|
260
264
|
});
|
|
261
|
-
case
|
|
265
|
+
case 10:
|
|
262
266
|
_res2 = _context2.sent;
|
|
263
|
-
_context2.next =
|
|
267
|
+
_context2.next = 13;
|
|
264
268
|
return _res2.json();
|
|
265
|
-
case
|
|
269
|
+
case 13:
|
|
266
270
|
return _context2.abrupt("return", _context2.sent);
|
|
267
|
-
case
|
|
268
|
-
_context2.prev =
|
|
269
|
-
_context2.t0 = _context2["catch"](
|
|
271
|
+
case 16:
|
|
272
|
+
_context2.prev = 16;
|
|
273
|
+
_context2.t0 = _context2["catch"](7);
|
|
270
274
|
return _context2.abrupt("return", {});
|
|
271
|
-
case
|
|
275
|
+
case 19:
|
|
272
276
|
case "end":
|
|
273
277
|
return _context2.stop();
|
|
274
278
|
}
|
|
275
|
-
}, _callee2, null, [[
|
|
279
|
+
}, _callee2, null, [[7, 16]]);
|
|
276
280
|
}));
|
|
277
281
|
return function getReportData(_x3, _x4) {
|
|
278
282
|
return _ref3.apply(this, arguments);
|
package/es/style.js
CHANGED
|
@@ -35,7 +35,7 @@ var ZPointerBlock = function ZPointerBlock(props) {
|
|
|
35
35
|
value: value,
|
|
36
36
|
groupSeparator: ""
|
|
37
37
|
})), icon ? /*#__PURE__*/React.createElement(_col["default"], {
|
|
38
|
-
className: "icon"
|
|
38
|
+
className: "z-pointer-icon"
|
|
39
39
|
}, icon) : null));
|
|
40
40
|
};
|
|
41
41
|
var _default = ZPointerBlock;
|
|
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports["default"] = void 0;
|
|
6
6
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
7
|
+
var _spin = _interopRequireDefault(require("antd/lib/spin"));
|
|
7
8
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
8
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
10
|
var _react = require("react");
|
|
@@ -31,8 +32,11 @@ var CustomRenderer = function CustomRenderer(props) {
|
|
|
31
32
|
result = _useState[0],
|
|
32
33
|
setResult = _useState[1];
|
|
33
34
|
var _useState2 = (0, _react.useState)(false),
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
loading = _useState2[0],
|
|
36
|
+
setLoading = _useState2[1];
|
|
37
|
+
var _useState3 = (0, _react.useState)(false),
|
|
38
|
+
isLink = _useState3[0],
|
|
39
|
+
setIsLink = _useState3[1];
|
|
36
40
|
var linkChartRef = (0, _react.useRef)();
|
|
37
41
|
var timer = null;
|
|
38
42
|
var onLink = function onLink(values) {
|
|
@@ -67,25 +71,28 @@ var CustomRenderer = function CustomRenderer(props) {
|
|
|
67
71
|
queryParams: queryParams,
|
|
68
72
|
dataSetName: dataSetName
|
|
69
73
|
};
|
|
70
|
-
|
|
74
|
+
setLoading(true);
|
|
75
|
+
_context.next = 9;
|
|
71
76
|
return (0, _dataCommon.getReportData)(rcProContext, formatter ? formatter === null || formatter === void 0 ? void 0 : formatter(data) : data);
|
|
72
|
-
case
|
|
77
|
+
case 9:
|
|
73
78
|
res = _context.sent;
|
|
79
|
+
setLoading(false);
|
|
74
80
|
if (res !== null && res !== void 0 && res.success) {
|
|
75
81
|
setResult(res === null || res === void 0 ? void 0 : res.result);
|
|
76
82
|
}
|
|
77
|
-
_context.next =
|
|
83
|
+
_context.next = 19;
|
|
78
84
|
break;
|
|
79
|
-
case
|
|
80
|
-
_context.prev =
|
|
85
|
+
case 14:
|
|
86
|
+
_context.prev = 14;
|
|
81
87
|
_context.t0 = _context["catch"](1);
|
|
88
|
+
setLoading(false);
|
|
82
89
|
setResult(null);
|
|
83
90
|
console.error(_context.t0);
|
|
84
|
-
case
|
|
91
|
+
case 19:
|
|
85
92
|
case "end":
|
|
86
93
|
return _context.stop();
|
|
87
94
|
}
|
|
88
|
-
}, _callee, null, [[1,
|
|
95
|
+
}, _callee, null, [[1, 14]]);
|
|
89
96
|
}));
|
|
90
97
|
return function getDataSource(_x) {
|
|
91
98
|
return _ref2.apply(this, arguments);
|
|
@@ -146,11 +153,13 @@ var CustomRenderer = function CustomRenderer(props) {
|
|
|
146
153
|
queryChart: queryChart
|
|
147
154
|
};
|
|
148
155
|
});
|
|
149
|
-
return /*#__PURE__*/React.createElement(
|
|
156
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
150
157
|
style: {
|
|
151
158
|
display: !isLink ? 'block' : 'none'
|
|
152
159
|
}
|
|
153
|
-
},
|
|
160
|
+
}, /*#__PURE__*/React.createElement(_spin["default"], {
|
|
161
|
+
spinning: loading
|
|
162
|
+
}, (_props$child = props.child) === null || _props$child === void 0 ? void 0 : _props$child.call(props, result))), /*#__PURE__*/React.createElement("div", {
|
|
154
163
|
style: {
|
|
155
164
|
display: isLink ? 'block' : 'none'
|
|
156
165
|
}
|
|
@@ -3,12 +3,12 @@ import type { CheckboxValueType } from 'antd/es/checkbox/Group';
|
|
|
3
3
|
import type { TypeChartSettingProps } from '../../data-common';
|
|
4
4
|
import './index.less';
|
|
5
5
|
export interface linkParamsType extends Pick<TypeChartSettingProps, 'dataSetName'> {
|
|
6
|
-
index?: number;
|
|
6
|
+
index?: number | string;
|
|
7
7
|
width?: number;
|
|
8
8
|
dimension?: CheckboxValueType[];
|
|
9
9
|
record?: Record<string, any>;
|
|
10
10
|
}
|
|
11
|
-
export interface linkStateType extends linkParamsType, Pick<TypeChartSettingProps, 'title' | 'autoLoad' | 'refreshRate'> {
|
|
11
|
+
export interface linkStateType extends linkParamsType, Pick<TypeChartSettingProps, 'chartTitle' | 'title' | 'autoLoad' | 'refreshRate'> {
|
|
12
12
|
}
|
|
13
13
|
declare const LinkRenderer: (props: Pick<TypeChartSettingProps, "onConfirm" | "chartRef" | "dimJson" | "linkPage" | "linkPageTitle"> & {
|
|
14
14
|
onBack?: () => void;
|
|
@@ -64,7 +64,7 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
64
64
|
return function () {
|
|
65
65
|
handleClearInterval();
|
|
66
66
|
};
|
|
67
|
-
}, [linkState.dataSetName, linkState.autoLoad]);
|
|
67
|
+
}, [linkState.dataSetName, linkState.index, linkState.autoLoad]);
|
|
68
68
|
|
|
69
69
|
// 获取表头
|
|
70
70
|
var handleGetColumns = function handleGetColumns(stateParams) {
|
|
@@ -213,12 +213,14 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
var _linkPage$index2 = linkPage[index],
|
|
216
|
+
chartTitle = _linkPage$index2.chartTitle,
|
|
216
217
|
title = _linkPage$index2.title,
|
|
217
218
|
autoLoad = _linkPage$index2.autoLoad,
|
|
218
219
|
refreshRate = _linkPage$index2.refreshRate;
|
|
219
220
|
var stateData = (0, _extends2["default"])({}, state, {
|
|
220
221
|
width: width,
|
|
221
222
|
index: index,
|
|
223
|
+
chartTitle: chartTitle,
|
|
222
224
|
title: title,
|
|
223
225
|
autoLoad: autoLoad,
|
|
224
226
|
refreshRate: refreshRate
|
|
@@ -255,12 +257,14 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
255
257
|
dataSetName = _ref6[0],
|
|
256
258
|
index = _ref6[1];
|
|
257
259
|
var _linkPage$index3 = linkPage[index],
|
|
260
|
+
chartTitle = _linkPage$index3.chartTitle,
|
|
258
261
|
title = _linkPage$index3.title,
|
|
259
262
|
autoLoad = _linkPage$index3.autoLoad,
|
|
260
263
|
refreshRate = _linkPage$index3.refreshRate;
|
|
261
264
|
var stateData = (0, _extends2["default"])({}, linkState, {
|
|
262
265
|
dataSetName: dataSetName,
|
|
263
266
|
index: index,
|
|
267
|
+
chartTitle: chartTitle,
|
|
264
268
|
title: title,
|
|
265
269
|
autoLoad: autoLoad,
|
|
266
270
|
refreshRate: refreshRate
|
|
@@ -275,10 +279,10 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
275
279
|
}, /*#__PURE__*/React.createElement(_icons.ArrowLeftOutlined, {
|
|
276
280
|
className: "arrow-left",
|
|
277
281
|
onClick: onBack
|
|
278
|
-
}), /*#__PURE__*/React.createElement("span", null, linkPageTitle)), (linkPage === null || linkPage === void 0 ? void 0 : (_linkPage$filter = linkPage.filter(function (field) {
|
|
282
|
+
}), /*#__PURE__*/React.createElement("span", null, linkState.chartTitle || linkPageTitle)), (linkPage === null || linkPage === void 0 ? void 0 : (_linkPage$filter = linkPage.filter(function (field) {
|
|
279
283
|
return (field === null || field === void 0 ? void 0 : field.dataSetName) === linkState.dataSetName;
|
|
280
284
|
})) === null || _linkPage$filter === void 0 ? void 0 : _linkPage$filter.length) <= 1 ? null : /*#__PURE__*/React.createElement(_radio["default"].Group, {
|
|
281
|
-
value: "" + (linkState === null || linkState === void 0 ? void 0 : linkState.
|
|
285
|
+
value: "" + (linkState === null || linkState === void 0 ? void 0 : linkState.dataSetName) + _dataCommon.separator + linkState.index,
|
|
282
286
|
onChange: handleLinkChange
|
|
283
287
|
}, linkPage === null || linkPage === void 0 ? void 0 : linkPage.map(function (field, index) {
|
|
284
288
|
return (field === null || field === void 0 ? void 0 : field.dataSetName) === linkState.dataSetName ? /*#__PURE__*/React.createElement(_radio["default"].Button, {
|
package/lib/components/z-templates-data-common/components/table-renderer/table-renderer.helper.js
CHANGED
|
@@ -182,7 +182,7 @@ exports.handleValueFormat = handleValueFormat;
|
|
|
182
182
|
var handleColumns = function handleColumns(option, expressions, onLink) {
|
|
183
183
|
var dimTarget = [].concat(option.dimension, option.index);
|
|
184
184
|
return dimTarget.map(function (title) {
|
|
185
|
-
var _find3, _find4, _title$toString;
|
|
185
|
+
var _find3, _find3$link, _find4, _find5, _title$toString;
|
|
186
186
|
var find;
|
|
187
187
|
var dataIndex;
|
|
188
188
|
var condition;
|
|
@@ -207,17 +207,18 @@ var handleColumns = function handleColumns(option, expressions, onLink) {
|
|
|
207
207
|
// condition = expressions?.filter((item) => item?.index?.includes(find?.name));
|
|
208
208
|
// }
|
|
209
209
|
|
|
210
|
+
var _ref4 = ((_find3 = find) === null || _find3 === void 0 ? void 0 : (_find3$link = _find3.link) === null || _find3$link === void 0 ? void 0 : _find3$link.split(_dataCommon.separator)) || [],
|
|
211
|
+
dataSetName = _ref4[0];
|
|
210
212
|
return {
|
|
211
213
|
title: title,
|
|
212
214
|
dataIndex: dataIndex,
|
|
213
215
|
ellipsis: true,
|
|
214
|
-
sorter: (
|
|
215
|
-
width: ((
|
|
216
|
+
sorter: (_find4 = find) === null || _find4 === void 0 ? void 0 : _find4.sorted,
|
|
217
|
+
width: ((_find5 = find) === null || _find5 === void 0 ? void 0 : _find5.width) || (0, _dataCommon.computeWidth)(title === null || title === void 0 ? void 0 : (_title$toString = title.toString()) === null || _title$toString === void 0 ? void 0 : _title$toString.length),
|
|
216
218
|
render: function render(value, record) {
|
|
217
219
|
return handleValueFormat(value, record, find, condition, function () {
|
|
218
|
-
var _find5;
|
|
219
220
|
return onLink({
|
|
220
|
-
dataSetName:
|
|
221
|
+
dataSetName: dataSetName,
|
|
221
222
|
record: record
|
|
222
223
|
});
|
|
223
224
|
});
|