@ztocwst/rc-pro-materials 0.1.26 → 0.1.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 +8 -8
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/designer.html +2 -2
- package/build/lowcode/index.html +2 -2
- 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.css +1 -1
- package/build/lowcode/render/default/view.js +8 -8
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +9 -9
- package/dist/SCM_Comps.css +1 -1
- package/dist/SCM_Comps.js +9 -9
- package/dist/SCM_Comps.js.map +1 -1
- package/es/components/z-templates-data-common/components/chart-renderer/index.d.ts +14 -0
- package/es/components/z-templates-data-common/components/chart-renderer/index.js +108 -0
- package/es/components/z-templates-data-common/components/custom-renderer/index.d.ts +13 -0
- package/es/components/z-templates-data-common/components/custom-renderer/index.js +161 -0
- package/es/components/z-templates-data-common/components/dim-target/dim-target.helper.d.ts +39 -0
- package/es/components/z-templates-data-common/components/dim-target/dim-target.helper.js +1 -0
- package/es/components/z-templates-data-common/components/dim-target/index.d.ts +16 -0
- package/es/components/z-templates-data-common/components/dim-target/index.js +430 -0
- package/es/components/z-templates-data-common/components/dim-target/index.less +49 -0
- package/es/components/z-templates-data-common/components/dim-target/useUpdateEffect.d.ts +8 -0
- package/es/components/z-templates-data-common/components/dim-target/useUpdateEffect.js +26 -0
- package/es/components/z-templates-data-common/components/link-renderer/index.d.ts +16 -0
- package/es/components/z-templates-data-common/components/link-renderer/index.js +316 -0
- package/es/components/z-templates-data-common/components/link-renderer/index.less +31 -0
- package/es/components/z-templates-data-common/components/table-renderer/index.d.ts +6 -0
- package/es/components/z-templates-data-common/components/table-renderer/index.js +479 -0
- package/es/components/z-templates-data-common/components/table-renderer/table-renderer.helper.d.ts +64 -0
- package/es/components/z-templates-data-common/components/table-renderer/table-renderer.helper.js +219 -0
- package/es/components/z-templates-data-common/data-common.d.ts +102 -0
- package/es/components/z-templates-data-common/data-common.helper.d.ts +61 -0
- package/es/components/z-templates-data-common/data-common.helper.js +332 -0
- package/es/components/z-templates-data-common/data-common.js +141 -0
- package/es/components/z-templates-data-common/index.d.ts +3 -0
- package/es/components/z-templates-data-common/index.js +2 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +1 -0
- package/es/style.js +8 -0
- package/es/utils/rcProRequest.d.ts +2 -0
- package/es/utils/rcProRequest.js +30 -0
- package/lib/components/z-templates-data-common/components/chart-renderer/index.d.ts +14 -0
- package/lib/components/z-templates-data-common/components/chart-renderer/index.js +116 -0
- package/lib/components/z-templates-data-common/components/custom-renderer/index.d.ts +13 -0
- package/lib/components/z-templates-data-common/components/custom-renderer/index.js +167 -0
- package/lib/components/z-templates-data-common/components/dim-target/dim-target.helper.d.ts +39 -0
- package/lib/components/z-templates-data-common/components/dim-target/dim-target.helper.js +3 -0
- package/lib/components/z-templates-data-common/components/dim-target/index.d.ts +16 -0
- package/lib/components/z-templates-data-common/components/dim-target/index.js +438 -0
- package/lib/components/z-templates-data-common/components/dim-target/index.less +49 -0
- package/lib/components/z-templates-data-common/components/dim-target/useUpdateEffect.d.ts +8 -0
- package/lib/components/z-templates-data-common/components/dim-target/useUpdateEffect.js +30 -0
- package/lib/components/z-templates-data-common/components/link-renderer/index.d.ts +16 -0
- package/lib/components/z-templates-data-common/components/link-renderer/index.js +322 -0
- package/lib/components/z-templates-data-common/components/link-renderer/index.less +31 -0
- package/lib/components/z-templates-data-common/components/table-renderer/index.d.ts +6 -0
- package/lib/components/z-templates-data-common/components/table-renderer/index.js +485 -0
- package/lib/components/z-templates-data-common/components/table-renderer/table-renderer.helper.d.ts +64 -0
- package/lib/components/z-templates-data-common/components/table-renderer/table-renderer.helper.js +228 -0
- package/lib/components/z-templates-data-common/data-common.d.ts +102 -0
- package/lib/components/z-templates-data-common/data-common.helper.d.ts +61 -0
- package/lib/components/z-templates-data-common/data-common.helper.js +350 -0
- package/lib/components/z-templates-data-common/data-common.js +147 -0
- package/lib/components/z-templates-data-common/index.d.ts +3 -0
- package/lib/components/z-templates-data-common/index.js +8 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +4 -2
- package/lib/style.js +4 -0
- package/lib/utils/rcProRequest.d.ts +2 -0
- package/lib/utils/rcProRequest.js +36 -0
- package/package.json +3 -3
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
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
|
+
import rcProRequest from "../../utils/rcProRequest";
|
|
8
|
+
|
|
9
|
+
/** table config */
|
|
10
|
+
export var tableConfigDefault = {
|
|
11
|
+
manual: true,
|
|
12
|
+
toolBars: false,
|
|
13
|
+
hideDefRowSelection: true,
|
|
14
|
+
columns: []
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/** 字符串拼接分割符 */
|
|
18
|
+
export var separator = '***';
|
|
19
|
+
|
|
20
|
+
/** 时间单位 */
|
|
21
|
+
export var timeUnit = 60 * 1000;
|
|
22
|
+
|
|
23
|
+
/** 介于 前闭后开 */
|
|
24
|
+
export var BETWEEN = '<=,<';
|
|
25
|
+
/** 数据类型 */
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 计算宽
|
|
29
|
+
* @param length
|
|
30
|
+
* @param width
|
|
31
|
+
*/
|
|
32
|
+
export var computeWidth = function computeWidth(length, width) {
|
|
33
|
+
if (width === void 0) {
|
|
34
|
+
width = 40;
|
|
35
|
+
}
|
|
36
|
+
return length * width;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 获取最大宽
|
|
41
|
+
* @param strArr
|
|
42
|
+
*/
|
|
43
|
+
export var getMaxWidth = function getMaxWidth(strArr) {
|
|
44
|
+
if (!(strArr !== null && strArr !== void 0 && strArr.length)) return 0;
|
|
45
|
+
var arr = strArr.map(function (s) {
|
|
46
|
+
var _s$toString;
|
|
47
|
+
return s === null || s === void 0 ? void 0 : (_s$toString = s.toString()) === null || _s$toString === void 0 ? void 0 : _s$toString.length;
|
|
48
|
+
});
|
|
49
|
+
var length = Math.max.apply(null, arr);
|
|
50
|
+
return computeWidth(length, 14);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 处理 QueryParams 去除空字符串
|
|
55
|
+
*/
|
|
56
|
+
export var handleQueryParams = function handleQueryParams(query) {
|
|
57
|
+
var queryParams = _extends({}, query);
|
|
58
|
+
Object.keys(query).forEach(function (k) {
|
|
59
|
+
if (query[k] === '') {
|
|
60
|
+
queryParams[k] = undefined;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
return queryParams;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* 处理数据千分位
|
|
68
|
+
*/
|
|
69
|
+
export var handleThousand = function handleThousand(value) {
|
|
70
|
+
if (!Number.isNaN(value) && value) {
|
|
71
|
+
if (String(value).indexOf('.') !== -1) {
|
|
72
|
+
var _String$split = String(value).split('.'),
|
|
73
|
+
start = _String$split[0],
|
|
74
|
+
end = _String$split[1];
|
|
75
|
+
var begin = start.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,');
|
|
76
|
+
return [begin, end].join('.');
|
|
77
|
+
} else {
|
|
78
|
+
return value.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,');
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
return value;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 保留几位小数点
|
|
87
|
+
*/
|
|
88
|
+
export var handleDecimal = function handleDecimal(value, decimal) {
|
|
89
|
+
if (decimal === void 0) {
|
|
90
|
+
decimal = 2;
|
|
91
|
+
}
|
|
92
|
+
if (value === null || value === undefined) return;
|
|
93
|
+
return Number(value).toFixed(decimal);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* 百分比转化
|
|
98
|
+
*/
|
|
99
|
+
export var handlePercent = function handlePercent(value, decimal, unit) {
|
|
100
|
+
if (decimal === void 0) {
|
|
101
|
+
decimal = 2;
|
|
102
|
+
}
|
|
103
|
+
if (unit === void 0) {
|
|
104
|
+
unit = 100;
|
|
105
|
+
}
|
|
106
|
+
if (value === null || value === undefined) return;
|
|
107
|
+
return (Number(value) * unit).toFixed(decimal) + "%";
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* link外链处理
|
|
112
|
+
*/
|
|
113
|
+
export var handleLink = function handleLink(value, onLink) {
|
|
114
|
+
if (value === null || value === undefined) return;
|
|
115
|
+
return /*#__PURE__*/React.createElement("a", {
|
|
116
|
+
href: "javascript:void(0);",
|
|
117
|
+
onClick: onLink
|
|
118
|
+
}, value);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* 条件格式设置
|
|
123
|
+
* @param value 处理前的值
|
|
124
|
+
* @param handledValue 被处理后的值 可能会是link标签
|
|
125
|
+
*/
|
|
126
|
+
export var handleCondition = function handleCondition(value, handledValue, conditions) {
|
|
127
|
+
if (value === null || value === undefined) return;
|
|
128
|
+
var val = handledValue;
|
|
129
|
+
for (var _iterator = _createForOfIteratorHelperLoose(conditions), _step; !(_step = _iterator()).done;) {
|
|
130
|
+
var cur = _step.value;
|
|
131
|
+
var condition = cur === null || cur === void 0 ? void 0 : cur.condition;
|
|
132
|
+
if ((condition === null || condition === void 0 ? void 0 : condition.type) === BETWEEN) {
|
|
133
|
+
var _condition$type;
|
|
134
|
+
var _condition$type$split = condition === null || condition === void 0 ? void 0 : (_condition$type = condition.type) === null || _condition$type === void 0 ? void 0 : _condition$type.split(','),
|
|
135
|
+
start = _condition$type$split[0],
|
|
136
|
+
end = _condition$type$split[1];
|
|
137
|
+
if (eval("" + (condition === null || condition === void 0 ? void 0 : condition.start) + start + value) && eval("" + value + end + (condition === null || condition === void 0 ? void 0 : condition.end))) {
|
|
138
|
+
var style = {
|
|
139
|
+
color: cur === null || cur === void 0 ? void 0 : cur.fontColor,
|
|
140
|
+
background: cur === null || cur === void 0 ? void 0 : cur.backgroundColor
|
|
141
|
+
};
|
|
142
|
+
val = /*#__PURE__*/React.createElement("div", {
|
|
143
|
+
style: style
|
|
144
|
+
}, handledValue);
|
|
145
|
+
}
|
|
146
|
+
} else if (eval("" + value + (condition === null || condition === void 0 ? void 0 : condition.type) + (condition === null || condition === void 0 ? void 0 : condition.value))) {
|
|
147
|
+
var _style = {
|
|
148
|
+
color: cur === null || cur === void 0 ? void 0 : cur.fontColor,
|
|
149
|
+
background: cur === null || cur === void 0 ? void 0 : cur.backgroundColor
|
|
150
|
+
};
|
|
151
|
+
val = /*#__PURE__*/React.createElement("div", {
|
|
152
|
+
style: _style
|
|
153
|
+
}, handledValue);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return val;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
// mock
|
|
160
|
+
var token = 'scm:tenant:token:2:104:33A6E5D6F29E319C975B503D2B2E0E7B';
|
|
161
|
+
|
|
162
|
+
/** 获取维度指标 */
|
|
163
|
+
export var getDimTarget = /*#__PURE__*/function () {
|
|
164
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(rcProContext, params) {
|
|
165
|
+
var _ref2, materialsRequest, env, token, res, _res;
|
|
166
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
167
|
+
while (1) switch (_context.prev = _context.next) {
|
|
168
|
+
case 0:
|
|
169
|
+
_ref2 = rcProContext || {}, materialsRequest = _ref2.materialsRequest, env = _ref2.env, token = _ref2.token; // 供应链里由子应用透传
|
|
170
|
+
if (!materialsRequest) {
|
|
171
|
+
_context.next = 6;
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
_context.next = 4;
|
|
175
|
+
return rcProRequest(rcProContext, "/data/forward/v1/bigdata/report/view/query/" + params.dataSetName, {
|
|
176
|
+
method: 'POST',
|
|
177
|
+
data: {
|
|
178
|
+
bigDataBody: _extends({
|
|
179
|
+
env: env
|
|
180
|
+
}, params)
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
case 4:
|
|
184
|
+
res = _context.sent;
|
|
185
|
+
return _context.abrupt("return", res);
|
|
186
|
+
case 6:
|
|
187
|
+
_context.prev = 6;
|
|
188
|
+
_context.next = 9;
|
|
189
|
+
return fetch("http://scm.gateway.dev.ztyc.com/data/forward/v1/bigdata/report/view/query/" + params.dataSetName, {
|
|
190
|
+
method: 'POST',
|
|
191
|
+
body: JSON.stringify({
|
|
192
|
+
bigDataBody: _extends({
|
|
193
|
+
env: 'dev'
|
|
194
|
+
}, params)
|
|
195
|
+
}),
|
|
196
|
+
headers: {
|
|
197
|
+
'Content-Type': 'application/json',
|
|
198
|
+
token: token
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
case 9:
|
|
202
|
+
_res = _context.sent;
|
|
203
|
+
_context.next = 12;
|
|
204
|
+
return _res.json();
|
|
205
|
+
case 12:
|
|
206
|
+
return _context.abrupt("return", _context.sent);
|
|
207
|
+
case 15:
|
|
208
|
+
_context.prev = 15;
|
|
209
|
+
_context.t0 = _context["catch"](6);
|
|
210
|
+
return _context.abrupt("return", {});
|
|
211
|
+
case 18:
|
|
212
|
+
case "end":
|
|
213
|
+
return _context.stop();
|
|
214
|
+
}
|
|
215
|
+
}, _callee, null, [[6, 15]]);
|
|
216
|
+
}));
|
|
217
|
+
return function getDimTarget(_x, _x2) {
|
|
218
|
+
return _ref.apply(this, arguments);
|
|
219
|
+
};
|
|
220
|
+
}();
|
|
221
|
+
|
|
222
|
+
/** 获取报表数据 */
|
|
223
|
+
export var getReportData = /*#__PURE__*/function () {
|
|
224
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(rcProContext, params) {
|
|
225
|
+
var _ref4, materialsRequest, env, res, _res2;
|
|
226
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
227
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
228
|
+
case 0:
|
|
229
|
+
_ref4 = rcProContext || {}, materialsRequest = _ref4.materialsRequest, env = _ref4.env; // 供应链里由子应用透传
|
|
230
|
+
if (!materialsRequest) {
|
|
231
|
+
_context2.next = 6;
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
_context2.next = 4;
|
|
235
|
+
return rcProRequest(rcProContext, "/data/forward/v1/bigdata/report/" + params.dataSetName, {
|
|
236
|
+
method: 'POST',
|
|
237
|
+
data: {
|
|
238
|
+
bigDataBody: _extends({
|
|
239
|
+
env: env
|
|
240
|
+
}, params)
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
case 4:
|
|
244
|
+
res = _context2.sent;
|
|
245
|
+
return _context2.abrupt("return", res);
|
|
246
|
+
case 6:
|
|
247
|
+
_context2.prev = 6;
|
|
248
|
+
_context2.next = 9;
|
|
249
|
+
return fetch("http://scm.gateway.dev.ztyc.com/data/forward/v1/bigdata/report/" + params.dataSetName, {
|
|
250
|
+
method: 'POST',
|
|
251
|
+
body: JSON.stringify({
|
|
252
|
+
bigDataBody: _extends({
|
|
253
|
+
env: 'dev'
|
|
254
|
+
}, params)
|
|
255
|
+
}),
|
|
256
|
+
headers: {
|
|
257
|
+
'Content-Type': 'application/json',
|
|
258
|
+
token: token
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
case 9:
|
|
262
|
+
_res2 = _context2.sent;
|
|
263
|
+
_context2.next = 12;
|
|
264
|
+
return _res2.json();
|
|
265
|
+
case 12:
|
|
266
|
+
return _context2.abrupt("return", _context2.sent);
|
|
267
|
+
case 15:
|
|
268
|
+
_context2.prev = 15;
|
|
269
|
+
_context2.t0 = _context2["catch"](6);
|
|
270
|
+
return _context2.abrupt("return", {});
|
|
271
|
+
case 18:
|
|
272
|
+
case "end":
|
|
273
|
+
return _context2.stop();
|
|
274
|
+
}
|
|
275
|
+
}, _callee2, null, [[6, 15]]);
|
|
276
|
+
}));
|
|
277
|
+
return function getReportData(_x3, _x4) {
|
|
278
|
+
return _ref3.apply(this, arguments);
|
|
279
|
+
};
|
|
280
|
+
}();
|
|
281
|
+
|
|
282
|
+
/** 记住勾选 */
|
|
283
|
+
export var saveDimTarget = /*#__PURE__*/function () {
|
|
284
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(rcProContext, params) {
|
|
285
|
+
var _ref6, materialsRequest, res, _res3;
|
|
286
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
287
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
288
|
+
case 0:
|
|
289
|
+
_ref6 = rcProContext || {}, materialsRequest = _ref6.materialsRequest; // 供应链里由子应用透传
|
|
290
|
+
if (!materialsRequest) {
|
|
291
|
+
_context3.next = 6;
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
_context3.next = 4;
|
|
295
|
+
return rcProRequest(rcProContext, "/data/forward/v1/bigdata/report/view/save", {
|
|
296
|
+
method: 'POST',
|
|
297
|
+
data: params
|
|
298
|
+
});
|
|
299
|
+
case 4:
|
|
300
|
+
res = _context3.sent;
|
|
301
|
+
return _context3.abrupt("return", res);
|
|
302
|
+
case 6:
|
|
303
|
+
_context3.prev = 6;
|
|
304
|
+
_context3.next = 9;
|
|
305
|
+
return fetch("http://scm.gateway.dev.ztyc.com/data/forward/v1/bigdata/report/view/save", {
|
|
306
|
+
method: 'POST',
|
|
307
|
+
body: JSON.stringify(_extends({}, params)),
|
|
308
|
+
headers: {
|
|
309
|
+
'Content-Type': 'application/json',
|
|
310
|
+
token: token
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
case 9:
|
|
314
|
+
_res3 = _context3.sent;
|
|
315
|
+
_context3.next = 12;
|
|
316
|
+
return _res3.json();
|
|
317
|
+
case 12:
|
|
318
|
+
return _context3.abrupt("return", _context3.sent);
|
|
319
|
+
case 15:
|
|
320
|
+
_context3.prev = 15;
|
|
321
|
+
_context3.t0 = _context3["catch"](6);
|
|
322
|
+
return _context3.abrupt("return", {});
|
|
323
|
+
case 18:
|
|
324
|
+
case "end":
|
|
325
|
+
return _context3.stop();
|
|
326
|
+
}
|
|
327
|
+
}, _callee3, null, [[6, 15]]);
|
|
328
|
+
}));
|
|
329
|
+
return function saveDimTarget(_x5, _x6) {
|
|
330
|
+
return _ref5.apply(this, arguments);
|
|
331
|
+
};
|
|
332
|
+
}();
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import _message from "antd/es/message";
|
|
4
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
5
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
|
+
import React, { useRef, useImperativeHandle } from 'react';
|
|
7
|
+
import { ProFormRender } from '@ztocwst/rc-pro';
|
|
8
|
+
import ChartRenderer from "./components/chart-renderer";
|
|
9
|
+
|
|
10
|
+
/** 指标配置 */
|
|
11
|
+
|
|
12
|
+
/** 表格相关配置 */
|
|
13
|
+
|
|
14
|
+
var ZTemplatesDataCommon = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
15
|
+
var querySetting = props.querySetting,
|
|
16
|
+
_unsafe_MixedSetter_chartSetting_select = props._unsafe_MixedSetter_chartSetting_select;
|
|
17
|
+
var chartSetting = props.chartSetting;
|
|
18
|
+
var formRef = useRef();
|
|
19
|
+
var chartRenderRef = useRef();
|
|
20
|
+
// todo 不知道meta里是哪里配置有问题,出现_unsafe_MixedSetter...
|
|
21
|
+
// if (
|
|
22
|
+
// _unsafe_MixedSetter_chartSetting_select &&
|
|
23
|
+
// typeof _unsafe_MixedSetter_chartSetting_select === 'object'
|
|
24
|
+
// ) {
|
|
25
|
+
// chartSetting = _unsafe_MixedSetter_chartSetting_select;
|
|
26
|
+
// }
|
|
27
|
+
console.log(chartSetting);
|
|
28
|
+
var onFinish = function onFinish(values) {
|
|
29
|
+
chartRenderRef.current.queryChart(values);
|
|
30
|
+
};
|
|
31
|
+
var onConfirm = /*#__PURE__*/function () {
|
|
32
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
33
|
+
var _yield$formRef$curren, _formRef$current, _formRef$current$vali, values;
|
|
34
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
35
|
+
while (1) switch (_context.prev = _context.next) {
|
|
36
|
+
case 0:
|
|
37
|
+
_context.prev = 0;
|
|
38
|
+
_context.next = 3;
|
|
39
|
+
return (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : (_formRef$current$vali = _formRef$current.validateFieldsReturnFormatValue) === null || _formRef$current$vali === void 0 ? void 0 : _formRef$current$vali.call(_formRef$current);
|
|
40
|
+
case 3:
|
|
41
|
+
_context.t1 = _yield$formRef$curren = _context.sent;
|
|
42
|
+
_context.t0 = _context.t1 !== null;
|
|
43
|
+
if (!_context.t0) {
|
|
44
|
+
_context.next = 7;
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
_context.t0 = _yield$formRef$curren !== void 0;
|
|
48
|
+
case 7:
|
|
49
|
+
if (!_context.t0) {
|
|
50
|
+
_context.next = 11;
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
_context.t2 = _yield$formRef$curren;
|
|
54
|
+
_context.next = 12;
|
|
55
|
+
break;
|
|
56
|
+
case 11:
|
|
57
|
+
_context.t2 = {};
|
|
58
|
+
case 12:
|
|
59
|
+
values = _context.t2;
|
|
60
|
+
chartRenderRef.current.queryChart(values);
|
|
61
|
+
_context.next = 19;
|
|
62
|
+
break;
|
|
63
|
+
case 16:
|
|
64
|
+
_context.prev = 16;
|
|
65
|
+
_context.t3 = _context["catch"](0);
|
|
66
|
+
console.error(_context.t3);
|
|
67
|
+
case 19:
|
|
68
|
+
case "end":
|
|
69
|
+
return _context.stop();
|
|
70
|
+
}
|
|
71
|
+
}, _callee, null, [[0, 16]]);
|
|
72
|
+
}));
|
|
73
|
+
return function onConfirm() {
|
|
74
|
+
return _ref.apply(this, arguments);
|
|
75
|
+
};
|
|
76
|
+
}();
|
|
77
|
+
var onLink = function onLink(values) {
|
|
78
|
+
var _chartRenderRef$curre, _chartRenderRef$curre2;
|
|
79
|
+
return (_chartRenderRef$curre = chartRenderRef.current) === null || _chartRenderRef$curre === void 0 ? void 0 : (_chartRenderRef$curre2 = _chartRenderRef$curre.onLink) === null || _chartRenderRef$curre2 === void 0 ? void 0 : _chartRenderRef$curre2.call(_chartRenderRef$curre, values);
|
|
80
|
+
};
|
|
81
|
+
useImperativeHandle(ref, function () {
|
|
82
|
+
return {
|
|
83
|
+
onLink: onLink
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(ProFormRender, _extends({}, querySetting, {
|
|
87
|
+
formRef: formRef,
|
|
88
|
+
onValuesChange: function onValuesChange(changeValues) {},
|
|
89
|
+
onFinish: /*#__PURE__*/function () {
|
|
90
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(formatData) {
|
|
91
|
+
var _querySetting$onFinis;
|
|
92
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
93
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
94
|
+
case 0:
|
|
95
|
+
_context2.prev = 0;
|
|
96
|
+
_context2.next = 3;
|
|
97
|
+
return (_querySetting$onFinis = querySetting.onFinish) === null || _querySetting$onFinis === void 0 ? void 0 : _querySetting$onFinis.call(querySetting, formatData);
|
|
98
|
+
case 3:
|
|
99
|
+
_context2.next = 5;
|
|
100
|
+
return onFinish === null || onFinish === void 0 ? void 0 : onFinish(formatData);
|
|
101
|
+
case 5:
|
|
102
|
+
_context2.next = 10;
|
|
103
|
+
break;
|
|
104
|
+
case 7:
|
|
105
|
+
_context2.prev = 7;
|
|
106
|
+
_context2.t0 = _context2["catch"](0);
|
|
107
|
+
_message.error(_context2.t0);
|
|
108
|
+
case 10:
|
|
109
|
+
case "end":
|
|
110
|
+
return _context2.stop();
|
|
111
|
+
}
|
|
112
|
+
}, _callee2, null, [[0, 7]]);
|
|
113
|
+
}));
|
|
114
|
+
return function (_x) {
|
|
115
|
+
return _ref2.apply(this, arguments);
|
|
116
|
+
};
|
|
117
|
+
}()
|
|
118
|
+
})), /*#__PURE__*/React.createElement(ChartRenderer, {
|
|
119
|
+
chartSetting: chartSetting,
|
|
120
|
+
chartRenderRef: chartRenderRef,
|
|
121
|
+
onConfirm: onConfirm
|
|
122
|
+
}));
|
|
123
|
+
});
|
|
124
|
+
var ZTemplatesDataCommonContainer = /*#__PURE__*/function (_React$Component) {
|
|
125
|
+
_inheritsLoose(ZTemplatesDataCommonContainer, _React$Component);
|
|
126
|
+
function ZTemplatesDataCommonContainer(props) {
|
|
127
|
+
var _this;
|
|
128
|
+
_this = _React$Component.call(this, props) || this;
|
|
129
|
+
_this.chartRef = void 0;
|
|
130
|
+
_this.chartRef = /*#__PURE__*/React.createRef();
|
|
131
|
+
return _this;
|
|
132
|
+
}
|
|
133
|
+
var _proto = ZTemplatesDataCommonContainer.prototype;
|
|
134
|
+
_proto.render = function render() {
|
|
135
|
+
return /*#__PURE__*/React.createElement(ZTemplatesDataCommon, _extends({}, this.props, {
|
|
136
|
+
ref: this.chartRef
|
|
137
|
+
}));
|
|
138
|
+
};
|
|
139
|
+
return ZTemplatesDataCommonContainer;
|
|
140
|
+
}(React.Component);
|
|
141
|
+
export { ZTemplatesDataCommonContainer as default };
|
package/es/index.d.ts
CHANGED
|
@@ -33,3 +33,5 @@ export { default as ZPointerBlock } from './components/z-pointer-block';
|
|
|
33
33
|
export type { TypeZPointerBlockProps } from './components/z-pointer-block';
|
|
34
34
|
export { default as ZAggBlock } from './components/z-agg-block';
|
|
35
35
|
export type { TypeAggBlockProps } from './components/z-agg-block';
|
|
36
|
+
export { default as ZTemplatesDataCommon } from './components/z-templates-data-common';
|
|
37
|
+
export type { TypeZTemplatesDataCommonProps } from './components/z-templates-data-common';
|
package/es/index.js
CHANGED
|
@@ -20,6 +20,7 @@ export { default as ZProProvider } from "./components/z-pro-provider";
|
|
|
20
20
|
export { default as ZPointerBlock } from "./components/z-pointer-block";
|
|
21
21
|
// 聚合指标
|
|
22
22
|
export { default as ZAggBlock } from "./components/z-agg-block";
|
|
23
|
+
export { default as ZTemplatesDataCommon } from "./components/z-templates-data-common";
|
|
23
24
|
|
|
24
25
|
// const bizCssPrefix = 'bizpack';
|
|
25
26
|
|
package/es/style.js
CHANGED
|
@@ -6,10 +6,18 @@ import 'antd/lib/config-provider/style';
|
|
|
6
6
|
import 'antd/es/config-provider/style';
|
|
7
7
|
import 'antd/lib/row/style';
|
|
8
8
|
import 'antd/lib/col/style';
|
|
9
|
+
import 'antd/lib/message/style';
|
|
10
|
+
import 'antd/lib/tabs/style';
|
|
11
|
+
import 'antd/lib/checkbox/style';
|
|
12
|
+
import 'antd/lib/radio/style';
|
|
9
13
|
import 'antd/es/statistic/style';
|
|
10
14
|
import 'antd/es/progress/style';
|
|
11
15
|
import 'antd/es/table/style';
|
|
12
16
|
import 'antd/es/typography/style';
|
|
13
17
|
import 'antd/es/row/style';
|
|
14
18
|
import 'antd/es/col/style';
|
|
19
|
+
import 'antd/es/message/style';
|
|
20
|
+
import 'antd/es/tabs/style';
|
|
21
|
+
import 'antd/es/checkbox/style';
|
|
22
|
+
import 'antd/es/radio/style';
|
|
15
23
|
import './index.scss';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
export default /*#__PURE__*/(function () {
|
|
5
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(rcProContext, url, requestParams) {
|
|
6
|
+
var _ref2, materialsRequest, token;
|
|
7
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
8
|
+
while (1) switch (_context.prev = _context.next) {
|
|
9
|
+
case 0:
|
|
10
|
+
_ref2 = rcProContext || {}, materialsRequest = _ref2.materialsRequest, token = _ref2.token;
|
|
11
|
+
_context.next = 3;
|
|
12
|
+
return materialsRequest(url, _extends({
|
|
13
|
+
method: 'POST'
|
|
14
|
+
}, requestParams, {
|
|
15
|
+
headers: _extends({}, requestParams.headers, {
|
|
16
|
+
token: token
|
|
17
|
+
})
|
|
18
|
+
}));
|
|
19
|
+
case 3:
|
|
20
|
+
return _context.abrupt("return", _context.sent);
|
|
21
|
+
case 4:
|
|
22
|
+
case "end":
|
|
23
|
+
return _context.stop();
|
|
24
|
+
}
|
|
25
|
+
}, _callee);
|
|
26
|
+
}));
|
|
27
|
+
return function (_x, _x2, _x3) {
|
|
28
|
+
return _ref.apply(this, arguments);
|
|
29
|
+
};
|
|
30
|
+
})();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TypeZTemplatesDataCommonProps } from '../../data-common';
|
|
3
|
+
import type { linkParamsType } from '../link-renderer';
|
|
4
|
+
export interface ChartRendererProps {
|
|
5
|
+
chartSetting?: Pick<TypeZTemplatesDataCommonProps, 'chartSetting'>;
|
|
6
|
+
chartRenderRef?: React.Ref<{
|
|
7
|
+
onLink: (v: linkParamsType) => void;
|
|
8
|
+
queryChart: (v: Record<string, any>, d: string | undefined) => void;
|
|
9
|
+
}>;
|
|
10
|
+
/** 确认 */
|
|
11
|
+
onConfirm?: () => void;
|
|
12
|
+
}
|
|
13
|
+
declare const ChartRenderer: ({ chartRenderRef, chartSetting, onConfirm }: ChartRendererProps) => JSX.Element | Pick<TypeZTemplatesDataCommonProps, "chartSetting">;
|
|
14
|
+
export default ChartRenderer;
|