@ztocwst/rc-pro-materials 0.2.53 → 0.2.55

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.
Files changed (85) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +4 -4
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +7 -7
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +7 -7
  11. package/dist/SCM_Comps.css +1 -1
  12. package/dist/SCM_Comps.js +8 -8
  13. package/dist/SCM_Comps.js.map +1 -1
  14. package/es/components/z-data-stat-description/z-data-stat-description.js +1 -1
  15. package/es/components/z-singleFactory/zSingerFactory.js +6 -2
  16. package/es/components/z-target-block/index.d.ts +3 -0
  17. package/es/components/z-target-block/index.js +2 -0
  18. package/es/components/z-target-block/z-target-block.d.ts +6 -0
  19. package/es/components/z-target-block/z-target-block.js +8 -0
  20. package/es/components/z-templates-data-common/components/chart-renderer/index.js +31 -28
  21. package/es/components/z-templates-data-common/data-common.helper.d.ts +11 -0
  22. package/es/components/z-templates-data-common/data-common.helper.js +75 -1
  23. package/es/components/z-warehouse/zWarehouse.js +6 -2
  24. package/es/index.d.ts +2 -2
  25. package/es/index.js +2 -1
  26. package/es/style.js +0 -8
  27. package/lib/components/z-data-stat-description/z-data-stat-description.js +2 -2
  28. package/lib/components/z-singleFactory/zSingerFactory.js +7 -2
  29. package/lib/components/z-target-block/index.d.ts +3 -0
  30. package/lib/components/{z-data-stat → z-target-block}/index.js +2 -2
  31. package/lib/components/z-target-block/z-target-block.d.ts +6 -0
  32. package/lib/components/z-target-block/z-target-block.js +11 -0
  33. package/lib/components/z-templates-data-common/components/chart-renderer/index.js +30 -27
  34. package/lib/components/z-templates-data-common/data-common.helper.d.ts +11 -0
  35. package/lib/components/z-templates-data-common/data-common.helper.js +77 -1
  36. package/lib/components/z-warehouse/zWarehouse.js +7 -2
  37. package/lib/index.d.ts +2 -2
  38. package/lib/index.js +3 -3
  39. package/lib/style.js +0 -4
  40. package/package.json +4 -4
  41. package/es/components/z-data-stat/components/CardDetail/index.d.ts +0 -6
  42. package/es/components/z-data-stat/components/CardDetail/index.js +0 -328
  43. package/es/components/z-data-stat/components/CardDetail/index.less +0 -164
  44. package/es/components/z-data-stat/components/CardDetail/interface.d.ts +0 -30
  45. package/es/components/z-data-stat/components/CardDetail/interface.js +0 -1
  46. package/es/components/z-data-stat/components/StepBlock/index.d.ts +0 -5
  47. package/es/components/z-data-stat/components/StepBlock/index.js +0 -104
  48. package/es/components/z-data-stat/components/StepBlock/index.less +0 -40
  49. package/es/components/z-data-stat/components/StepBlock/interface.d.ts +0 -11
  50. package/es/components/z-data-stat/components/StepBlock/interface.js +0 -1
  51. package/es/components/z-data-stat/components/TargetBlock/index.d.ts +0 -5
  52. package/es/components/z-data-stat/components/TargetBlock/index.js +0 -106
  53. package/es/components/z-data-stat/components/TargetBlock/index.less +0 -65
  54. package/es/components/z-data-stat/components/TargetBlock/interface.d.ts +0 -31
  55. package/es/components/z-data-stat/components/TargetBlock/interface.js +0 -1
  56. package/es/components/z-data-stat/components/index.d.ts +0 -7
  57. package/es/components/z-data-stat/components/index.js +0 -4
  58. package/es/components/z-data-stat/data-stat.d.ts +0 -19
  59. package/es/components/z-data-stat/data-stat.js +0 -326
  60. package/es/components/z-data-stat/index.d.ts +0 -3
  61. package/es/components/z-data-stat/index.js +0 -2
  62. package/es/components/z-data-stat/util.d.ts +0 -25
  63. package/es/components/z-data-stat/util.js +0 -178
  64. package/lib/components/z-data-stat/components/CardDetail/index.d.ts +0 -6
  65. package/lib/components/z-data-stat/components/CardDetail/index.js +0 -335
  66. package/lib/components/z-data-stat/components/CardDetail/index.less +0 -164
  67. package/lib/components/z-data-stat/components/CardDetail/interface.d.ts +0 -30
  68. package/lib/components/z-data-stat/components/CardDetail/interface.js +0 -3
  69. package/lib/components/z-data-stat/components/StepBlock/index.d.ts +0 -5
  70. package/lib/components/z-data-stat/components/StepBlock/index.js +0 -109
  71. package/lib/components/z-data-stat/components/StepBlock/index.less +0 -40
  72. package/lib/components/z-data-stat/components/StepBlock/interface.d.ts +0 -11
  73. package/lib/components/z-data-stat/components/StepBlock/interface.js +0 -3
  74. package/lib/components/z-data-stat/components/TargetBlock/index.d.ts +0 -5
  75. package/lib/components/z-data-stat/components/TargetBlock/index.js +0 -111
  76. package/lib/components/z-data-stat/components/TargetBlock/index.less +0 -65
  77. package/lib/components/z-data-stat/components/TargetBlock/interface.d.ts +0 -31
  78. package/lib/components/z-data-stat/components/TargetBlock/interface.js +0 -3
  79. package/lib/components/z-data-stat/components/index.d.ts +0 -7
  80. package/lib/components/z-data-stat/components/index.js +0 -13
  81. package/lib/components/z-data-stat/data-stat.d.ts +0 -19
  82. package/lib/components/z-data-stat/data-stat.js +0 -331
  83. package/lib/components/z-data-stat/index.d.ts +0 -3
  84. package/lib/components/z-data-stat/util.d.ts +0 -25
  85. package/lib/components/z-data-stat/util.js +0 -187
@@ -1,331 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- exports.__esModule = true;
5
- exports["default"] = void 0;
6
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
7
- var _spin = _interopRequireDefault(require("antd/lib/spin"));
8
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
- var _components = require("./components");
11
- var _react = require("react");
12
- var _util = require("./util");
13
- var _rcPro = require("@ztocwst/rc-pro");
14
- var generateQueryParams = /*#__PURE__*/function () {
15
- var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(queryParams) {
16
- var q;
17
- return _regenerator["default"].wrap(function _callee$(_context) {
18
- while (1) switch (_context.prev = _context.next) {
19
- case 0:
20
- if (!(typeof queryParams === 'function')) {
21
- _context.next = 5;
22
- break;
23
- }
24
- _context.next = 3;
25
- return queryParams();
26
- case 3:
27
- q = _context.sent;
28
- return _context.abrupt("return", (0, _util.getQueryParams)(q));
29
- case 5:
30
- return _context.abrupt("return", (0, _util.getQueryParams)(queryParams));
31
- case 6:
32
- case "end":
33
- return _context.stop();
34
- }
35
- }, _callee);
36
- }));
37
- return function generateQueryParams(_x) {
38
- return _ref.apply(this, arguments);
39
- };
40
- }();
41
-
42
- // @ts-ignore
43
- var ZDataStat = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
44
- var dataStatColumns = props.dataStatColumns,
45
- stepList = props.stepList,
46
- filter = props.filter,
47
- datasetName = props.datasetName,
48
- autoLoad = props.autoLoad;
49
-
50
- // @ts-ignore
51
- var rcConfigContextValue = (0, _react.useContext)(_rcPro.RcConfigContext);
52
- var cardDetailRef = (0, _components.useCardDetailRef)();
53
- var _useState = (0, _react.useState)(false),
54
- stepDataLoading = _useState[0],
55
- setStepDataLoading = _useState[1];
56
- var _useState2 = (0, _react.useState)({}),
57
- stepData = _useState2[0],
58
- setStepData = _useState2[1];
59
- function getStepData(_x2, _x3) {
60
- return _getStepData.apply(this, arguments);
61
- }
62
- function _getStepData() {
63
- _getStepData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(data, params) {
64
- var otherParams, dim, _filter, record, _yield$getReportData3, success, result, _result$data2, _data;
65
- return _regenerator["default"].wrap(function _callee6$(_context6) {
66
- while (1) switch (_context6.prev = _context6.next) {
67
- case 0:
68
- if (datasetName) {
69
- _context6.next = 2;
70
- break;
71
- }
72
- return _context6.abrupt("return");
73
- case 2:
74
- _context6.prev = 2;
75
- otherParams = {};
76
- dim = [];
77
- if (data) {
78
- _filter = data.filter, record = data.record;
79
- dim = _filter.dim;
80
- otherParams[_filter.key] = record.name ? [record.name] : undefined;
81
- }
82
- setStepDataLoading(true);
83
- _context6.next = 9;
84
- return (0, _util.getReportData)({
85
- dataSetName: datasetName,
86
- target: [].concat(stepList.map(function (e) {
87
- return (0, _util.getStepBlockTarget)(e);
88
- }).flat()),
89
- dim: dim,
90
- queryParams: (0, _extends2["default"])({}, otherParams, params)
91
- }, {
92
- request: rcConfigContextValue.materialsRequest,
93
- env: rcConfigContextValue.env
94
- });
95
- case 9:
96
- _yield$getReportData3 = _context6.sent;
97
- success = _yield$getReportData3.success;
98
- result = _yield$getReportData3.result;
99
- if (success) {
100
- if (result !== null && result !== void 0 && (_result$data2 = result.data) !== null && _result$data2 !== void 0 && _result$data2.length) {
101
- _data = result.data[0];
102
- Object.keys(_data).forEach(function (key) {
103
- _data[key] = _data[key];
104
- });
105
- setStepData(_data);
106
- }
107
- }
108
- case 13:
109
- _context6.prev = 13;
110
- setStepDataLoading(false);
111
- return _context6.finish(13);
112
- case 16:
113
- case "end":
114
- return _context6.stop();
115
- }
116
- }, _callee6, null, [[2,, 13, 16]]);
117
- }));
118
- return _getStepData.apply(this, arguments);
119
- }
120
- function getData(params) {
121
- var _cardDetailRef$curren;
122
- cardDetailRef === null || cardDetailRef === void 0 ? void 0 : (_cardDetailRef$curren = cardDetailRef.current) === null || _cardDetailRef$curren === void 0 ? void 0 : _cardDetailRef$curren.refresh({
123
- params: params
124
- });
125
- getStepData(null, params);
126
- }
127
- (0, _react.useEffect)(function () {
128
- if (autoLoad) {
129
- // 延迟执行,queryParams里异步获取表单时可能获取不到
130
- setTimeout( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
131
- var queryParams;
132
- return _regenerator["default"].wrap(function _callee2$(_context2) {
133
- while (1) switch (_context2.prev = _context2.next) {
134
- case 0:
135
- _context2.next = 2;
136
- return generateQueryParams(props.queryParams);
137
- case 2:
138
- queryParams = _context2.sent;
139
- getData(queryParams);
140
- case 4:
141
- case "end":
142
- return _context2.stop();
143
- }
144
- }, _callee2);
145
- })), 200);
146
- }
147
- }, []);
148
- (0, _react.useImperativeHandle)(ref, function () {
149
- return {
150
- query: function () {
151
- var _query = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(params) {
152
- var queryParams;
153
- return _regenerator["default"].wrap(function _callee3$(_context3) {
154
- while (1) switch (_context3.prev = _context3.next) {
155
- case 0:
156
- _context3.next = 2;
157
- return generateQueryParams(props.queryParams);
158
- case 2:
159
- queryParams = _context3.sent;
160
- getData((0, _extends2["default"])({}, queryParams, params));
161
- case 4:
162
- case "end":
163
- return _context3.stop();
164
- }
165
- }, _callee3);
166
- }));
167
- function query(_x4) {
168
- return _query.apply(this, arguments);
169
- }
170
- return query;
171
- }()
172
- };
173
- }, []);
174
- var cProps = {
175
- loading: false,
176
- columns: dataStatColumns,
177
- // todo CardDetailProps
178
- request: function () {
179
- var _request = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(options) {
180
- var _yield$getReportData, success, result, _result$data, _data;
181
- return _regenerator["default"].wrap(function _callee4$(_context4) {
182
- while (1) switch (_context4.prev = _context4.next) {
183
- case 0:
184
- if (datasetName) {
185
- _context4.next = 2;
186
- break;
187
- }
188
- return _context4.abrupt("return", []);
189
- case 2:
190
- _context4.next = 4;
191
- return (0, _util.getReportData)({
192
- dataSetName: datasetName,
193
- target: (0, _util.getTargets)(dataStatColumns),
194
- queryParams: (0, _extends2["default"])({}, options.params)
195
- }, {
196
- request: rcConfigContextValue.materialsRequest,
197
- env: rcConfigContextValue.env
198
- });
199
- case 4:
200
- _yield$getReportData = _context4.sent;
201
- success = _yield$getReportData.success;
202
- result = _yield$getReportData.result;
203
- if (!success) {
204
- _context4.next = 16;
205
- break;
206
- }
207
- if (!(result !== null && result !== void 0 && (_result$data = result.data) !== null && _result$data !== void 0 && _result$data.length)) {
208
- _context4.next = 13;
209
- break;
210
- }
211
- _data = result.data[0];
212
- return _context4.abrupt("return", _data);
213
- case 13:
214
- return _context4.abrupt("return", []);
215
- case 14:
216
- _context4.next = 17;
217
- break;
218
- case 16:
219
- return _context4.abrupt("return", []);
220
- case 17:
221
- case "end":
222
- return _context4.stop();
223
- }
224
- }, _callee4);
225
- }));
226
- function request(_x5) {
227
- return _request.apply(this, arguments);
228
- }
229
- return request;
230
- }(),
231
- filter: filter,
232
- list: {
233
- columns: [].concat(dataStatColumns),
234
- formatter: function formatter(data) {
235
- return (0, _extends2["default"])({}, data);
236
- },
237
- request: function () {
238
- var _request2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(options) {
239
- var _filter$dim;
240
- var pageNum, pageSize, filter, params, _yield$getReportData2, success, result;
241
- return _regenerator["default"].wrap(function _callee5$(_context5) {
242
- while (1) switch (_context5.prev = _context5.next) {
243
- case 0:
244
- pageNum = options.pageNum, pageSize = options.pageSize, filter = options.filter, params = options.params;
245
- if (datasetName) {
246
- _context5.next = 3;
247
- break;
248
- }
249
- return _context5.abrupt("return", []);
250
- case 3:
251
- _context5.next = 5;
252
- return (0, _util.getReportData)({
253
- dataSetName: datasetName,
254
- pageNum: pageNum,
255
- pageSize: pageSize,
256
- target: (0, _util.getTargets)(dataStatColumns),
257
- dim: filter === null || filter === void 0 ? void 0 : filter.dim,
258
- queryParams: (0, _extends2["default"])({}, params),
259
- // alias 目前写死name
260
- columns: filter === null || filter === void 0 ? void 0 : (_filter$dim = filter.dim) === null || _filter$dim === void 0 ? void 0 : _filter$dim.filter(function (e) {
261
- return e.alias;
262
- }).map(function (e) {
263
- return {
264
- alias: e.alias,
265
- description: e.description
266
- };
267
- })
268
- // [
269
- // { alias: 'name', description: },
270
- // // { alias: 'name', description: '大区名称' },
271
- // // { alias: 'name', description: '仓库名称' },
272
- // ],
273
- }, {
274
- request: rcConfigContextValue.materialsRequest,
275
- env: rcConfigContextValue.env
276
- });
277
- case 5:
278
- _yield$getReportData2 = _context5.sent;
279
- success = _yield$getReportData2.success;
280
- result = _yield$getReportData2.result;
281
- if (!success) {
282
- _context5.next = 11;
283
- break;
284
- }
285
- if (!result.data) {
286
- _context5.next = 11;
287
- break;
288
- }
289
- return _context5.abrupt("return", result.data.map(function (_data) {
290
- return (0, _extends2["default"])({}, _data);
291
- }));
292
- case 11:
293
- return _context5.abrupt("return", []);
294
- case 12:
295
- case "end":
296
- return _context5.stop();
297
- }
298
- }, _callee5);
299
- }));
300
- function request(_x6) {
301
- return _request2.apply(this, arguments);
302
- }
303
- return request;
304
- }(),
305
- handleClick: function handleClick(data) {
306
- getStepData(data);
307
- }
308
- }
309
- };
310
- return /*#__PURE__*/React.createElement("div", {
311
- ref: ref
312
- }, /*#__PURE__*/React.createElement(_components.CardDetail, (0, _extends2["default"])({
313
- ref: cardDetailRef
314
- }, cProps, {
315
- handleClick: getStepData
316
- })), /*#__PURE__*/React.createElement(_spin["default"], {
317
- spinning: stepDataLoading
318
- }, /*#__PURE__*/React.createElement("div", {
319
- style: {
320
- display: 'flex',
321
- gap: '16px'
322
- }
323
- }, stepList.map(function (_step, index) {
324
- return /*#__PURE__*/React.createElement(_components.StepBlock, (0, _extends2["default"])({
325
- key: index
326
- }, _step, {
327
- data: stepData
328
- }));
329
- }))));
330
- });
331
- var _default = exports["default"] = ZDataStat;
@@ -1,3 +0,0 @@
1
- import ZDataStat from './data-stat';
2
- export type { TypeZDataStatProps } from './data-stat';
3
- export default ZDataStat;
@@ -1,25 +0,0 @@
1
- export declare function reportQuery(path: string, data: Record<string, any>, other?: any): Promise<any>;
2
- /**
3
- * 海藻报表查询
4
- * @param data
5
- * @param other 请求方法\环境
6
- * @returns
7
- */
8
- export declare function getReportData(data: Record<string, any>, other: {
9
- request: any;
10
- env: string;
11
- }): Promise<any>;
12
- export declare function getStepBlockTarget(config: any): any[];
13
- export declare function getQueryParams(queryParams?: Record<string, any>): Record<string, any>;
14
- export declare function getTargets(columns?: any[]): any[];
15
- type IValue = number | string | null | undefined;
16
- export declare const handleDecimal: (value: IValue, decimal?: number) => string;
17
- export declare const handleThousand: (value: IValue) => IValue;
18
- export declare const handleValueFormat: (value: IValue, decimal?: number) => any;
19
- /** 数据类型 */
20
- export type valueType = number | string | null | undefined;
21
- /**
22
- * 百分比转化
23
- */
24
- export declare const handlePercent: (value: valueType, decimal?: number, unit?: number) => string;
25
- export {};
@@ -1,187 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- exports.__esModule = true;
5
- exports.getQueryParams = getQueryParams;
6
- exports.getReportData = getReportData;
7
- exports.getStepBlockTarget = getStepBlockTarget;
8
- exports.getTargets = getTargets;
9
- exports.handleValueFormat = exports.handleThousand = exports.handlePercent = exports.handleDecimal = void 0;
10
- exports.reportQuery = reportQuery;
11
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
12
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
14
- var token = 'scm:tenant:token:195002:100246:31773680-07c3-448e-99bb-70eea80907aa';
15
- function reportQuery(_x, _x2, _x3) {
16
- return _reportQuery.apply(this, arguments);
17
- }
18
- /**
19
- * 海藻报表查询
20
- * @param data
21
- * @param other 请求方法\环境
22
- * @returns
23
- */
24
- function _reportQuery() {
25
- _reportQuery = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(path, data, other) {
26
- var res;
27
- return _regenerator["default"].wrap(function _callee$(_context) {
28
- while (1) switch (_context.prev = _context.next) {
29
- case 0:
30
- if (!(other && other.request)) {
31
- _context.next = 2;
32
- break;
33
- }
34
- return _context.abrupt("return", other.request(path, {
35
- method: 'post',
36
- data: {
37
- bigDataBody: (0, _extends2["default"])({
38
- // 数据部环境只有 dev test prod(生产不传)
39
- env: other.env === 'prod' ? undefined : other.env === 'dev' ? 'dev' : 'test'
40
- }, data)
41
- }
42
- }));
43
- case 2:
44
- _context.next = 4;
45
- return fetch("https://scm-gateway.ztocwst.com/data/forward/v1/bigdata/report/" + data.dataSetName, {
46
- method: 'post',
47
- body: JSON.stringify({
48
- bigDataBody: (0, _extends2["default"])({}, data)
49
- }),
50
- headers: {
51
- // ...headers,
52
- 'Content-Type': 'application/json',
53
- token: token
54
- }
55
- });
56
- case 4:
57
- res = _context.sent;
58
- return _context.abrupt("return", res.json());
59
- case 6:
60
- case "end":
61
- return _context.stop();
62
- }
63
- }, _callee);
64
- }));
65
- return _reportQuery.apply(this, arguments);
66
- }
67
- function getReportData(_x4, _x5) {
68
- return _getReportData.apply(this, arguments);
69
- }
70
- function _getReportData() {
71
- _getReportData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(data, other) {
72
- return _regenerator["default"].wrap(function _callee2$(_context2) {
73
- while (1) switch (_context2.prev = _context2.next) {
74
- case 0:
75
- return _context2.abrupt("return", reportQuery("/data/forward/v1/bigdata/report/" + ((data === null || data === void 0 ? void 0 : data.dataSetName) || ''), data, other));
76
- case 1:
77
- case "end":
78
- return _context2.stop();
79
- }
80
- }, _callee2);
81
- }));
82
- return _getReportData.apply(this, arguments);
83
- }
84
- function getStepBlockTarget(config) {
85
- var target = [];
86
- config.columns.forEach(function (item) {
87
- item.forEach(function (item1) {
88
- target.push({
89
- name: item1.dataIndex,
90
- description: item1.dataIndex
91
- });
92
- if (item1.cTargets) {
93
- item1.cTargets.forEach(function (cItem) {
94
- target.push({
95
- name: cItem.dataIndex,
96
- description: cItem.dataIndex
97
- });
98
- });
99
- }
100
- });
101
- });
102
- return target;
103
- }
104
- function getQueryParams(queryParams) {
105
- if (queryParams === void 0) {
106
- queryParams = {};
107
- }
108
- var values = queryParams; // formRef?.current?.getFieldsFormatValue?.();
109
- Object.keys(values).forEach(function (k) {
110
- var _values$k;
111
- if (values[k] === '') {
112
- values[k] = undefined;
113
- }
114
- if (Array.isArray(values[k]) && ((_values$k = values[k]) === null || _values$k === void 0 ? void 0 : _values$k.length) === 0) {
115
- values[k] = undefined;
116
- }
117
- });
118
- return values;
119
- }
120
- function getTargets(columns) {
121
- if (columns === void 0) {
122
- columns = [];
123
- }
124
- var target = [];
125
- columns.filter(function (v) {
126
- return v.target !== false;
127
- }).forEach(function (item) {
128
- target.push({
129
- name: item.dataIndex,
130
- description: item.dataIndex
131
- });
132
- if (item.cTargets) {
133
- item.cTargets.forEach(function (cItem) {
134
- target.push({
135
- name: cItem.dataIndex,
136
- description: cItem.dataIndex
137
- });
138
- });
139
- }
140
- });
141
- return target;
142
- }
143
- var handleDecimal = exports.handleDecimal = function handleDecimal(value, decimal) {
144
- if (decimal === void 0) {
145
- decimal = 0;
146
- }
147
- if (value === null || value === undefined) return;
148
- return Number(value).toFixed(decimal);
149
- };
150
- var handleThousand = exports.handleThousand = function handleThousand(value) {
151
- if (!Number.isNaN(value) && value) {
152
- if (String(value).indexOf('.') !== -1) {
153
- var _String$split = String(value).split('.'),
154
- start = _String$split[0],
155
- end = _String$split[1];
156
- var begin = start.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,');
157
- return [begin, end].join('.');
158
- } else {
159
- return value.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,');
160
- }
161
- } else {
162
- return value;
163
- }
164
- };
165
- var handleValueFormat = exports.handleValueFormat = function handleValueFormat(value, decimal) {
166
- if (decimal === void 0) {
167
- decimal = 0;
168
- }
169
- var values = handleDecimal(value, decimal);
170
- return handleThousand(values);
171
- };
172
-
173
- /** 数据类型 */
174
-
175
- /**
176
- * 百分比转化
177
- */
178
- var handlePercent = exports.handlePercent = function handlePercent(value, decimal, unit) {
179
- if (decimal === void 0) {
180
- decimal = 2;
181
- }
182
- if (unit === void 0) {
183
- unit = 100;
184
- }
185
- if (value === null || value === undefined) return;
186
- return (Number(value) * unit).toFixed(decimal) + '%';
187
- };