@ztocwst/rc-pro-materials 0.2.21 → 0.2.23

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 (32) 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/meta.js +1 -1
  5. package/build/lowcode/render/default/view.css +1 -1
  6. package/build/lowcode/render/default/view.js +3 -3
  7. package/build/lowcode/view.css +1 -1
  8. package/build/lowcode/view.js +3 -3
  9. package/dist/SCM_Comps.css +1 -1
  10. package/dist/SCM_Comps.js +3 -3
  11. package/dist/SCM_Comps.js.map +1 -1
  12. package/es/components/z-templates-data-common/components/link-renderer/index.d.ts +1 -1
  13. package/es/components/z-templates-data-common/components/link-renderer/index.js +199 -102
  14. package/es/components/z-templates-data-common/components/link-renderer/index.less +4 -0
  15. package/es/components/z-templates-data-common/components/table-renderer/index.js +38 -9
  16. package/es/components/z-templates-data-common/components/table-renderer/table-renderer.helper.d.ts +1 -0
  17. package/es/components/z-templates-data-common/components/table-renderer/table-renderer.helper.js +23 -12
  18. package/es/components/z-templates-data-common/data-common.helper.d.ts +2 -0
  19. package/es/components/z-templates-data-common/data-common.helper.js +4 -1
  20. package/es/components/z-templates-data-common/data-common.js +1 -0
  21. package/es/utils/props/tpl.d.ts +2 -0
  22. package/lib/components/z-templates-data-common/components/link-renderer/index.d.ts +1 -1
  23. package/lib/components/z-templates-data-common/components/link-renderer/index.js +197 -100
  24. package/lib/components/z-templates-data-common/components/link-renderer/index.less +4 -0
  25. package/lib/components/z-templates-data-common/components/table-renderer/index.js +37 -8
  26. package/lib/components/z-templates-data-common/components/table-renderer/table-renderer.helper.d.ts +1 -0
  27. package/lib/components/z-templates-data-common/components/table-renderer/table-renderer.helper.js +22 -11
  28. package/lib/components/z-templates-data-common/data-common.helper.d.ts +2 -0
  29. package/lib/components/z-templates-data-common/data-common.helper.js +7 -3
  30. package/lib/components/z-templates-data-common/data-common.js +1 -0
  31. package/lib/utils/props/tpl.d.ts +2 -0
  32. package/package.json +4 -4
@@ -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' | 'actionJson'> {
11
+ export interface linkStateType extends linkParamsType, Pick<TypeChartSettingProps, 'chartTitle' | 'custom' | 'child' | 'title' | 'autoLoad' | 'refreshRate' | 'actionJson' | 'exporter' | 'exportConfig'> {
12
12
  }
13
13
  declare const LinkRenderer: (props: Pick<TypeChartSettingProps, "onConfirm" | "chartRef" | "dimJson" | "linkPage" | "linkPageTitle"> & {
14
14
  onBack?: () => void;
@@ -1,15 +1,19 @@
1
1
  import _Spin from "antd/es/spin";
2
2
  import _Radio from "antd/es/radio";
3
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
4
3
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
5
5
  import _extends from "@babel/runtime/helpers/extends";
6
- var _excluded = ["pageNum", "pageSize"];
6
+ var _excluded = ["queryBind", "formatter"],
7
+ _excluded2 = ["pageNum", "pageSize", "orderBy"];
7
8
  import _regeneratorRuntime from "@babel/runtime/regenerator";
9
+ 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
+ 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
+ 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; }
8
12
  import { useEffect, useState, useRef, useContext, useImperativeHandle } from 'react';
9
- import { ProTable, RcConfigContext } from '@ztocwst/rc-pro';
13
+ import { ProTable, ProButton, RcConfigContext } from '@ztocwst/rc-pro';
10
14
  import { ArrowLeftOutlined } from '@ant-design/icons';
11
15
  import moment from 'moment';
12
- import { tableConfigDefault, dateStart, separator, timeUnit, getType, getMaxWidth, handleQueryParams, getReportData } from "../../data-common.helper";
16
+ import { tableConfigDefault, dateStart, separator, timeUnit, defaultSort, getType, getMaxWidth, handleQueryParams, getReportData } from "../../data-common.helper";
13
17
  import { handleDimTargetFormat, handleColumns } from "../table-renderer/table-renderer.helper";
14
18
  import "./index.less";
15
19
  var linkStateDefault = {
@@ -28,6 +32,7 @@ var LinkRenderer = function LinkRenderer(props) {
28
32
  onBack = props.onBack;
29
33
  var rcProContext = useContext(RcConfigContext);
30
34
  var _ref = rcProContext || {},
35
+ BASE_URL = _ref.BASE_URL,
31
36
  _ref$tableOptions = _ref.tableOptions,
32
37
  tableOptions = _ref$tableOptions === void 0 ? {} : _ref$tableOptions;
33
38
  var defaultPageSize = (tableOptions === null || tableOptions === void 0 ? void 0 : (_tableOptions$paginat = tableOptions.pagination) === null || _tableOptions$paginat === void 0 ? void 0 : _tableOptions$paginat.defaultPageSize) || 20;
@@ -102,106 +107,154 @@ var LinkRenderer = function LinkRenderer(props) {
102
107
  // 更新表头
103
108
  (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : (_tableRef$current$upd = _tableRef$current.updateColumns) === null || _tableRef$current$upd === void 0 ? void 0 : _tableRef$current$upd.call(_tableRef$current, columns);
104
109
  };
110
+ var getBigDataBody = function getBigDataBody(params) {
111
+ var _dimJson$data, _targets$indexSource;
112
+ if (params === void 0) {
113
+ params = {};
114
+ }
115
+ var dataSetName = linkState.dataSetName,
116
+ index = linkState.index,
117
+ dimension = linkState.dimension,
118
+ record = linkState.record;
119
+ var columns = handleGetColumns(_extends({}, linkState));
120
+
121
+ /** 查看queryBind是否有 当前查询条件和当前数据源参数(paraJson)建立绑定关系;有的话替换成绑定关系中的"键",没有则是默认查询配置的"键",上一级数据源的维度 "值" 或 当前查询条件的"值"入参 */
122
+ var _linkPage$index = linkPage[index],
123
+ queryBind = _linkPage$index.queryBind,
124
+ formatter = _linkPage$index.formatter,
125
+ find = _objectWithoutPropertiesLoose(_linkPage$index, _excluded);
126
+ var _ref3 = handleDimTargetFormat(find) || {},
127
+ targets = _ref3.targets;
128
+ var queryCache = queryCacheRef.current;
129
+ var query = {};
130
+ var queryKeys = Object.keys(queryCache);
131
+ if (queryKeys !== null && queryKeys !== void 0 && queryKeys.length) {
132
+ queryKeys.forEach(function (k) {
133
+ // 查看是否有绑定关联关系 有取绑定的入参"键" 没有则取默认的"键"
134
+ var queryBindFilter = queryBind === null || queryBind === void 0 ? void 0 : queryBind.filter(function (item) {
135
+ return (item === null || item === void 0 ? void 0 : item.currentQueryKey) === k;
136
+ });
137
+ // "键"(有建立绑定关系 取当前数据源参数(paraJson)的"键",没有则是默认查询配置的"键")
138
+ if (queryBindFilter !== null && queryBindFilter !== void 0 && queryBindFilter.length) {
139
+ // 参数为时间时会出现多个绑定关系
140
+ queryBindFilter.forEach(function (item) {
141
+ var key = item.sourceQueryKey;
142
+ // "值"(当前查询条件的"值")
143
+ var value = queryCache[k];
144
+ if (key) {
145
+ // 类型为时间时 处理
146
+ if (getType(value) === 'array' && value.length === 2 && value.some(function (d) {
147
+ return moment(d).isValid();
148
+ })) {
149
+ var i = key.includes(dateStart) ? 0 : 1;
150
+ query[key] = value[i];
151
+ } else {
152
+ query[key] = value;
153
+ }
154
+ }
155
+ });
156
+ } else {
157
+ // "值"(当前查询条件的"值")
158
+ query[k] = queryCache[k];
159
+ }
160
+ });
161
+ }
162
+ var recordKeys = Object.keys(record || {});
163
+ if (recordKeys.length) {
164
+ recordKeys.forEach(function (k) {
165
+ // 查看是否有绑定关联关系
166
+ var queryBindFilter = queryBind === null || queryBind === void 0 ? void 0 : queryBind.filter(function (item) {
167
+ return (item === null || item === void 0 ? void 0 : item.parentDimKey) === k;
168
+ });
169
+ // 参数为时间时会出现多个绑定关系
170
+ if (queryBindFilter !== null && queryBindFilter !== void 0 && queryBindFilter.length) {
171
+ queryBindFilter.forEach(function (item) {
172
+ var key = item.sourceQueryKey;
173
+ if (key) {
174
+ // "值"(有建立绑定关系 取上一级数据源的维度的"值")
175
+ query[key] = record[k];
176
+ }
177
+ });
178
+ }
179
+ });
180
+ }
181
+ var dim;
182
+ if (dimJson !== null && dimJson !== void 0 && (_dimJson$data = dimJson.data) !== null && _dimJson$data !== void 0 && _dimJson$data.length) {
183
+ dim = dimension === null || dimension === void 0 ? void 0 : dimension.map(function (description) {
184
+ var _dimJson$data2, _dimJson$data2$find;
185
+ return {
186
+ description: description,
187
+ name: (_dimJson$data2 = dimJson.data) === null || _dimJson$data2 === void 0 ? void 0 : (_dimJson$data2$find = _dimJson$data2.find(function (item) {
188
+ return item.description === description;
189
+ })) === null || _dimJson$data2$find === void 0 ? void 0 : _dimJson$data2$find.name
190
+ };
191
+ });
192
+ }
193
+ var orderBys = [];
194
+ if (targets !== null && targets !== void 0 && (_targets$indexSource = targets.indexSource) !== null && _targets$indexSource !== void 0 && _targets$indexSource.length) {
195
+ for (var _iterator = _createForOfIteratorHelperLoose(targets.indexSource), _step; !(_step = _iterator()).done;) {
196
+ var cur = _step.value;
197
+ if (cur !== null && cur !== void 0 && cur.sorted) {
198
+ orderBys.push({
199
+ name: cur.name,
200
+ sort: defaultSort
201
+ });
202
+ }
203
+ }
204
+ }
205
+ var queryParams = handleQueryParams(query);
206
+ var _params = params,
207
+ pageNum = _params.pageNum,
208
+ pageSize = _params.pageSize,
209
+ orderBy = _params.orderBy,
210
+ other = _objectWithoutPropertiesLoose(_params, _excluded2);
211
+ if (orderBy !== null && orderBy !== void 0 && orderBy.length) {
212
+ var _loop = function _loop() {
213
+ var item = _step2.value;
214
+ var i = orderBys.findIndex(function (e) {
215
+ return e.name === item.name;
216
+ });
217
+ if (i > -1) {
218
+ orderBys.splice(i, 1);
219
+ }
220
+ orderBys.unshift(_extends({}, item));
221
+ };
222
+ for (var _iterator2 = _createForOfIteratorHelperLoose(orderBy), _step2; !(_step2 = _iterator2()).done;) {
223
+ _loop();
224
+ }
225
+ }
226
+ var data = _extends({}, other, {
227
+ queryParams: queryParams,
228
+ dim: dim,
229
+ target: columns.map(function (item) {
230
+ return {
231
+ description: item.dataIndex
232
+ };
233
+ }),
234
+ orderBy: orderBys !== null && orderBys !== void 0 && orderBys.length ? orderBys : undefined,
235
+ pageNum: pageNum || 1,
236
+ pageSize: pageSize || defaultPageSize,
237
+ dataSetName: dataSetName
238
+ });
239
+ return formatter ? formatter === null || formatter === void 0 ? void 0 : formatter(data) : data;
240
+ };
105
241
  var getDataSource = /*#__PURE__*/function () {
106
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
107
- var _dimJson$data;
108
- var dataSetName, index, dimension, record, columns, _linkPage$index, queryBind, formatter, queryCache, query, queryKeys, recordKeys, dim, queryParams, _params, pageNum, pageSize, other, data, queryData;
242
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
243
+ var queryData;
109
244
  return _regeneratorRuntime.wrap(function _callee$(_context) {
110
245
  while (1) switch (_context.prev = _context.next) {
111
246
  case 0:
112
247
  if (params === void 0) {
113
248
  params = {};
114
249
  }
115
- dataSetName = linkState.dataSetName, index = linkState.index, dimension = linkState.dimension, record = linkState.record;
116
- columns = handleGetColumns(_extends({}, linkState));
117
- /** 查看queryBind是否有 当前查询条件和当前数据源参数(paraJson)建立绑定关系;有的话替换成绑定关系中的"键",没有则是默认查询配置的"键",上一级数据源的维度 "值" 或 当前查询条件的"值"入参 */
118
- _linkPage$index = linkPage[index], queryBind = _linkPage$index.queryBind, formatter = _linkPage$index.formatter;
119
- queryCache = queryCacheRef.current;
120
- query = {};
121
- queryKeys = Object.keys(queryCache);
122
- if (queryKeys !== null && queryKeys !== void 0 && queryKeys.length) {
123
- queryKeys.forEach(function (k) {
124
- // 查看是否有绑定关联关系 有取绑定的入参"键" 没有则取默认的"键"
125
- var queryBindFilter = queryBind === null || queryBind === void 0 ? void 0 : queryBind.filter(function (item) {
126
- return (item === null || item === void 0 ? void 0 : item.currentQueryKey) === k;
127
- });
128
- // "键"(有建立绑定关系 取当前数据源参数(paraJson)的"键",没有则是默认查询配置的"键")
129
- if (queryBindFilter !== null && queryBindFilter !== void 0 && queryBindFilter.length) {
130
- // 参数为时间时会出现多个绑定关系
131
- queryBindFilter.forEach(function (item) {
132
- var key = item.sourceQueryKey;
133
- // "值"(当前查询条件的"值")
134
- var value = queryCache[k];
135
- if (key) {
136
- // 类型为时间时 处理
137
- if (getType(value) === 'array' && value.length === 2 && value.some(function (d) {
138
- return moment(d).isValid();
139
- })) {
140
- var i = key.includes(dateStart) ? 0 : 1;
141
- query[key] = value[i];
142
- } else {
143
- query[key] = value;
144
- }
145
- }
146
- });
147
- } else {
148
- // "值"(当前查询条件的"值")
149
- query[k] = queryCache[k];
150
- }
151
- });
152
- }
153
- recordKeys = Object.keys(record || {});
154
- if (recordKeys.length) {
155
- recordKeys.forEach(function (k) {
156
- // 查看是否有绑定关联关系
157
- var queryBindFilter = queryBind === null || queryBind === void 0 ? void 0 : queryBind.filter(function (item) {
158
- return (item === null || item === void 0 ? void 0 : item.parentDimKey) === k;
159
- });
160
- // 参数为时间时会出现多个绑定关系
161
- if (queryBindFilter !== null && queryBindFilter !== void 0 && queryBindFilter.length) {
162
- queryBindFilter.forEach(function (item) {
163
- var key = item.sourceQueryKey;
164
- if (key) {
165
- // "值"(有建立绑定关系 取上一级数据源的维度的"值")
166
- query[key] = record[k];
167
- }
168
- });
169
- }
170
- });
171
- }
172
- if (dimJson !== null && dimJson !== void 0 && (_dimJson$data = dimJson.data) !== null && _dimJson$data !== void 0 && _dimJson$data.length) {
173
- dim = dimension === null || dimension === void 0 ? void 0 : dimension.map(function (description) {
174
- var _dimJson$data2, _dimJson$data2$find;
175
- return {
176
- description: description,
177
- name: (_dimJson$data2 = dimJson.data) === null || _dimJson$data2 === void 0 ? void 0 : (_dimJson$data2$find = _dimJson$data2.find(function (item) {
178
- return item.description === description;
179
- })) === null || _dimJson$data2$find === void 0 ? void 0 : _dimJson$data2$find.name
180
- };
181
- });
182
- }
183
- queryParams = handleQueryParams(query);
184
- _params = params, pageNum = _params.pageNum, pageSize = _params.pageSize, other = _objectWithoutPropertiesLoose(_params, _excluded);
185
- data = _extends({}, other, {
186
- pageNum: pageNum || 1,
187
- pageSize: pageSize || defaultPageSize,
188
- queryParams: queryParams,
189
- dim: dim,
190
- target: columns.map(function (item) {
191
- return {
192
- description: item.dataIndex
193
- };
194
- }),
195
- dataSetName: dataSetName
196
- });
197
- queryData = formatter ? formatter === null || formatter === void 0 ? void 0 : formatter(data) : data;
250
+ queryData = getBigDataBody(params);
198
251
  if (linkState.custom) {
199
252
  setLoading(true);
200
253
  }
201
- return _context.abrupt("return", getReportData(rcProContext, queryData).then(function (_ref4) {
202
- var success = _ref4.success,
203
- _ref4$result = _ref4.result,
204
- result = _ref4$result === void 0 ? {} : _ref4$result;
254
+ return _context.abrupt("return", getReportData(rcProContext, queryData).then(function (_ref5) {
255
+ var success = _ref5.success,
256
+ _ref5$result = _ref5.result,
257
+ result = _ref5$result === void 0 ? {} : _ref5$result;
205
258
  if (linkState.custom) {
206
259
  setLoading(false);
207
260
  if (success) {
@@ -218,21 +271,21 @@ var LinkRenderer = function LinkRenderer(props) {
218
271
  setResult(null);
219
272
  }
220
273
  }));
221
- case 17:
274
+ case 4:
222
275
  case "end":
223
276
  return _context.stop();
224
277
  }
225
278
  }, _callee);
226
279
  }));
227
280
  return function getDataSource(_x) {
228
- return _ref3.apply(this, arguments);
281
+ return _ref4.apply(this, arguments);
229
282
  };
230
283
  }();
231
284
 
232
285
  /** 初始linkState */
233
286
  var initial = function initial(paramsState) {
234
- var _ref5 = paramsState || {},
235
- dataSetName = _ref5.dataSetName;
287
+ var _ref6 = paramsState || {},
288
+ dataSetName = _ref6.dataSetName;
236
289
  /** 二级页未配置 或 自定义dataSetName配错 直接返回 */
237
290
  var Length = linkPage === null || linkPage === void 0 ? void 0 : linkPage.length;
238
291
  var isHave = linkPage === null || linkPage === void 0 ? void 0 : linkPage.some(function (item) {
@@ -305,9 +358,9 @@ var LinkRenderer = function LinkRenderer(props) {
305
358
  var handleLinkChange = function handleLinkChange(event) {
306
359
  var value = event.target.value;
307
360
  // dataSetName 可能会重复配置 所以使用 dataSetName + 分隔符 + index
308
- var _ref6 = (value === null || value === void 0 ? void 0 : value.split(separator)) || [],
309
- dataSetName = _ref6[0],
310
- index = _ref6[1];
361
+ var _ref7 = (value === null || value === void 0 ? void 0 : value.split(separator)) || [],
362
+ dataSetName = _ref7[0],
363
+ index = _ref7[1];
311
364
  var currentState = linkPage[index];
312
365
  var stateData = _extends({}, linkState, currentState, {
313
366
  dataSetName: dataSetName,
@@ -337,7 +390,51 @@ var LinkRenderer = function LinkRenderer(props) {
337
390
  width: linkState.width
338
391
  }
339
392
  }, field === null || field === void 0 ? void 0 : field.title)) : null;
340
- }))), linkState.custom ? /*#__PURE__*/React.createElement(_Spin, {
393
+ })), linkState.exporter ? /*#__PURE__*/React.createElement("div", {
394
+ className: "link-export"
395
+ }, /*#__PURE__*/React.createElement(ProButton, {
396
+ items: [{
397
+ action: 'btn',
398
+ name: linkState === null || linkState === void 0 ? void 0 : linkState.exportConfig.name,
399
+ fileConfig: {
400
+ type: 'export',
401
+ params: {
402
+ menuId: linkState === null || linkState === void 0 ? void 0 : linkState.exportConfig.menuId,
403
+ operateType: 'EXPORT'
404
+ },
405
+ request: {
406
+ submit: {
407
+ url: BASE_URL + "/data/forward/v1/bigdata/report/" + (linkState === null || linkState === void 0 ? void 0 : linkState.dataSetName) + "/export",
408
+ method: 'POST',
409
+ formatter: function () {
410
+ var _formatter = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(values) {
411
+ var bigDataBody, _ref8, _ref8$temp, temp;
412
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
413
+ while (1) switch (_context2.prev = _context2.next) {
414
+ case 0:
415
+ bigDataBody = getBigDataBody();
416
+ _ref8 = values || {}, _ref8$temp = _ref8.temp, temp = _ref8$temp === void 0 ? {} : _ref8$temp;
417
+ return _context2.abrupt("return", {
418
+ buttonCode: linkState === null || linkState === void 0 ? void 0 : linkState.exportConfig.code,
419
+ templateId: temp === null || temp === void 0 ? void 0 : temp.value,
420
+ bigDataBody: bigDataBody
421
+ });
422
+ case 3:
423
+ case "end":
424
+ return _context2.stop();
425
+ }
426
+ }, _callee2);
427
+ }));
428
+ function formatter(_x2) {
429
+ return _formatter.apply(this, arguments);
430
+ }
431
+ return formatter;
432
+ }()
433
+ }
434
+ }
435
+ }
436
+ }]
437
+ })) : null), linkState.custom ? /*#__PURE__*/React.createElement(_Spin, {
341
438
  spinning: loading
342
439
  }, (_linkState$child = linkState.child) === null || _linkState$child === void 0 ? void 0 : _linkState$child.call(linkState, result)) : /*#__PURE__*/React.createElement(ProTable, {
343
440
  ref: tableRef,
@@ -30,4 +30,8 @@
30
30
  transition: all 0.3s ease-in;
31
31
  color: var(--ant-primary-color, @primary-color);
32
32
  }
33
+
34
+ .link-export {
35
+ margin-left: 12px;
36
+ }
33
37
  }
@@ -2,7 +2,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutP
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _Table from "antd/es/table";
4
4
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
5
- var _excluded = ["pageNum", "pageSize"];
5
+ var _excluded = ["pageNum", "pageSize", "orderBy"];
6
6
  function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
7
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
8
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
@@ -10,7 +10,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
  import { useRef, useState, useEffect, useImperativeHandle, useContext } from 'react';
11
11
  import { ProTable, RcConfigContext } from '@ztocwst/rc-pro';
12
12
  import moment from 'moment';
13
- import { tableConfigDefault, dateStart, separator, timeUnit, getType, handleQueryParams, getReportData } from "../../data-common.helper";
13
+ import { tableConfigDefault, dateStart, separator, timeUnit, defaultSort, getType, handleQueryParams, getReportData } from "../../data-common.helper";
14
14
  import { handleColumns, handleValueFormat, getDimTargetData } from "./table-renderer.helper";
15
15
  import DimTarget from "../dim-target";
16
16
  import LinkRenderer from "../link-renderer";
@@ -222,7 +222,7 @@ var TableRenderer = function TableRenderer(props) {
222
222
  }
223
223
  });
224
224
  }
225
-
225
+ var orderBys = [];
226
226
  /** 维度收集 */
227
227
  var dim = [];
228
228
  for (var _iterator = _createForOfIteratorHelperLoose(dimensionSource), _step; !(_step = _iterator()).done;) {
@@ -232,6 +232,12 @@ var TableRenderer = function TableRenderer(props) {
232
232
  name: cur.name,
233
233
  description: cur.description
234
234
  });
235
+ if (cur !== null && cur !== void 0 && cur.sorted) {
236
+ orderBys.push({
237
+ name: cur.description,
238
+ sort: defaultSort
239
+ });
240
+ }
235
241
  }
236
242
  }
237
243
 
@@ -243,18 +249,41 @@ var TableRenderer = function TableRenderer(props) {
243
249
  target.push({
244
250
  description: _cur.name
245
251
  });
252
+ if (_cur !== null && _cur !== void 0 && _cur.sorted) {
253
+ orderBys.push({
254
+ name: _cur.name,
255
+ sort: defaultSort
256
+ });
257
+ }
246
258
  }
247
259
  }
248
260
  var queryParams = handleQueryParams(query);
249
261
  var _params = params,
250
262
  pageNum = _params.pageNum,
251
263
  pageSize = _params.pageSize,
264
+ orderBy = _params.orderBy,
252
265
  other = _objectWithoutPropertiesLoose(_params, _excluded);
266
+ if (orderBy !== null && orderBy !== void 0 && orderBy.length) {
267
+ var _loop = function _loop() {
268
+ var item = _step3.value;
269
+ var i = orderBys.findIndex(function (e) {
270
+ return e.name === item.name;
271
+ });
272
+ if (i > -1) {
273
+ orderBys.splice(i, 1);
274
+ }
275
+ orderBys.unshift(_extends({}, item));
276
+ };
277
+ for (var _iterator3 = _createForOfIteratorHelperLoose(orderBy), _step3; !(_step3 = _iterator3()).done;) {
278
+ _loop();
279
+ }
280
+ }
253
281
  var data = _extends({
254
- queryParams: queryParams,
255
- dim: dim,
256
- target: target
282
+ queryParams: queryParams
257
283
  }, other, {
284
+ dim: dim,
285
+ target: target,
286
+ orderBy: orderBys !== null && orderBys !== void 0 && orderBys.length ? orderBys : undefined,
258
287
  pageNum: pageNum || 1,
259
288
  pageSize: pageSize || defaultPageSize,
260
289
  dataSetName: dataSetName
@@ -413,7 +442,7 @@ var TableRenderer = function TableRenderer(props) {
413
442
  queryCacheRef.current = value[dataSetName] || value;
414
443
  setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
415
444
  var _tableRef$current2;
416
- var _getDimTargetValues4, _getDimTargetValues4$, indexSource, indexAmounted, target, _iterator3, _step3, cur, _ref9, success, _ref9$result, result, _result$data, _result$data$, data;
445
+ var _getDimTargetValues4, _getDimTargetValues4$, indexSource, indexAmounted, target, _iterator4, _step4, cur, _ref9, success, _ref9$result, result, _result$data, _result$data$, data;
417
446
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
418
447
  while (1) switch (_context5.prev = _context5.next) {
419
448
  case 0:
@@ -429,8 +458,8 @@ var TableRenderer = function TableRenderer(props) {
429
458
  break;
430
459
  }
431
460
  target = [];
432
- for (_iterator3 = _createForOfIteratorHelperLoose(indexAmounted); !(_step3 = _iterator3()).done;) {
433
- cur = _step3.value;
461
+ for (_iterator4 = _createForOfIteratorHelperLoose(indexAmounted); !(_step4 = _iterator4()).done;) {
462
+ cur = _step4.value;
434
463
  target.push({
435
464
  description: cur.name
436
465
  });
@@ -58,6 +58,7 @@ export declare const handleColumns: (option: DimTargetChangeOptionType & Pick<Ty
58
58
  title: import("antd/es/checkbox/Group").CheckboxValueType;
59
59
  dataIndex: string;
60
60
  ellipsis: boolean;
61
+ defaultSortOrder: string;
61
62
  sorter: any;
62
63
  width: any;
63
64
  fixed: any;
@@ -6,7 +6,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
6
6
  function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
7
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
8
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
- import { separator, computeWidth, handleDecimal, handleThousand, handlePercent, handleLink, handleCondition, getDimTarget } from "../../data-common.helper";
9
+ import { separator, defaultSort, computeWidth, handleDecimal, handleThousand, handlePercent, handleLink, handleCondition, getDimTarget } from "../../data-common.helper";
10
10
  export var stringTrim = function stringTrim(str) {
11
11
  if (!str) return '';
12
12
  return str.replace(/`|'|"/g, '');
@@ -176,37 +176,47 @@ export var handleValueFormat = function handleValueFormat(value, record, config,
176
176
  */
177
177
  export var handleColumns = function handleColumns(option, expressions, linkPage, onLink) {
178
178
  var _option$actionJson;
179
+ var isFirst = true;
179
180
  var dimTarget = [].concat(option.dimension, option.index);
180
181
  var columns = dimTarget.map(function (title) {
181
- var _config3, _config3$link, _config4, _config5, _config6, _title$toString, _config7, _config8, _config9;
182
+ var _config5, _config5$link, _config6, _config7, _config8, _title$toString, _config9, _config10, _config11;
182
183
  var config;
183
184
  var dataIndex;
185
+ var defaultSortOrder;
184
186
  var condition;
185
187
  if (!config) {
186
- var _option$dimensionSour, _config;
188
+ var _option$dimensionSour, _config, _config2;
187
189
  /* 通过别名或名称 查找当前维度的配置 */
188
190
  config = (_option$dimensionSour = option.dimensionSource) === null || _option$dimensionSour === void 0 ? void 0 : _option$dimensionSour.find(function (item) {
189
191
  return item.alias === title || item.description === title;
190
192
  });
191
193
  dataIndex = (_config = config) === null || _config === void 0 ? void 0 : _config.description;
194
+ if ((_config2 = config) !== null && _config2 !== void 0 && _config2.sorted && isFirst) {
195
+ isFirst = false;
196
+ defaultSortOrder = defaultSort + "end";
197
+ }
192
198
  }
193
199
  if (!config) {
194
- var _option$indexSource, _config2;
200
+ var _option$indexSource, _config3, _config4;
195
201
  /* 通过别名或名称 查找当前指标的配置 */
196
202
  config = (_option$indexSource = option.indexSource) === null || _option$indexSource === void 0 ? void 0 : _option$indexSource.find(function (item) {
197
203
  return item.alias === title || item.name === title;
198
204
  });
199
- dataIndex = (_config2 = config) === null || _config2 === void 0 ? void 0 : _config2.name;
205
+ dataIndex = (_config3 = config) === null || _config3 === void 0 ? void 0 : _config3.name;
206
+ if ((_config4 = config) !== null && _config4 !== void 0 && _config4.sorted && isFirst) {
207
+ isFirst = false;
208
+ defaultSortOrder = defaultSort + "end";
209
+ }
200
210
  }
201
211
  /* 条件格式设置 */
202
212
  // if (expressions?.length) {
203
213
  // condition = expressions?.filter((item) => item?.index?.includes(config?.name));
204
214
  // }
205
215
 
206
- var _ref4 = ((_config3 = config) === null || _config3 === void 0 ? void 0 : (_config3$link = _config3.link) === null || _config3$link === void 0 ? void 0 : _config3$link.split(separator)) || [],
216
+ var _ref4 = ((_config5 = config) === null || _config5 === void 0 ? void 0 : (_config5$link = _config5.link) === null || _config5$link === void 0 ? void 0 : _config5$link.split(separator)) || [],
207
217
  dataSetName = _ref4[0];
208
218
  var index;
209
- if ((_config4 = config) !== null && _config4 !== void 0 && _config4.link && linkPage !== null && linkPage !== void 0 && linkPage.length) {
219
+ if ((_config6 = config) !== null && _config6 !== void 0 && _config6.link && linkPage !== null && linkPage !== void 0 && linkPage.length) {
210
220
  index = linkPage.findIndex(function (link) {
211
221
  return "" + link.dataSetName + separator + link.title === config.link;
212
222
  });
@@ -215,12 +225,13 @@ export var handleColumns = function handleColumns(option, expressions, linkPage,
215
225
  title: title,
216
226
  dataIndex: dataIndex,
217
227
  ellipsis: true,
218
- sorter: (_config5 = config) === null || _config5 === void 0 ? void 0 : _config5.sorted,
219
- width: ((_config6 = config) === null || _config6 === void 0 ? void 0 : _config6.width) || computeWidth(title === null || title === void 0 ? void 0 : (_title$toString = title.toString()) === null || _title$toString === void 0 ? void 0 : _title$toString.length),
220
- fixed: (_config7 = config) !== null && _config7 !== void 0 && _config7.isFixed ? ((_config8 = config) === null || _config8 === void 0 ? void 0 : _config8.fixed) || ((_config9 = config) === null || _config9 === void 0 ? void 0 : _config9.isFixed) : false,
228
+ defaultSortOrder: defaultSortOrder,
229
+ sorter: (_config7 = config) === null || _config7 === void 0 ? void 0 : _config7.sorted,
230
+ width: ((_config8 = config) === null || _config8 === void 0 ? void 0 : _config8.width) || computeWidth(title === null || title === void 0 ? void 0 : (_title$toString = title.toString()) === null || _title$toString === void 0 ? void 0 : _title$toString.length),
231
+ fixed: (_config9 = config) !== null && _config9 !== void 0 && _config9.isFixed ? ((_config10 = config) === null || _config10 === void 0 ? void 0 : _config10.fixed) || ((_config11 = config) === null || _config11 === void 0 ? void 0 : _config11.isFixed) : false,
221
232
  render: function render(value, record) {
222
- var _config$render, _config10;
223
- return config.custom ? (_config$render = (_config10 = config).render) === null || _config$render === void 0 ? void 0 : _config$render.call(_config10, value, record, config, condition) : handleValueFormat(value, record, config, condition, function () {
233
+ var _config$render, _config12;
234
+ return config.custom ? (_config$render = (_config12 = config).render) === null || _config$render === void 0 ? void 0 : _config$render.call(_config12, value, record, config, condition) : handleValueFormat(value, record, config, condition, function () {
224
235
  return onLink({
225
236
  dataSetName: dataSetName,
226
237
  index: index,
@@ -14,6 +14,8 @@ export declare const separator = "***";
14
14
  export declare const timeUnit: number;
15
15
  /** 介于 前闭后开 */
16
16
  export declare const BETWEEN = "<=,<";
17
+ /** 默认排序 */
18
+ export declare const defaultSort = "asc";
17
19
  /** 数据类型 */
18
20
  export type valueType = number | string | null | undefined;
19
21
  /**
@@ -26,6 +26,9 @@ export var timeUnit = 60 * 1000;
26
26
  /** 介于 前闭后开 */
27
27
  export var BETWEEN = '<=,<';
28
28
 
29
+ /** 默认排序 */
30
+ export var defaultSort = 'asc';
31
+
29
32
  /** 数据类型 */
30
33
 
31
34
  /**
@@ -172,7 +175,7 @@ export var handleCondition = function handleCondition(value, handledValue, condi
172
175
  };
173
176
 
174
177
  // mock
175
- var token = 'scm:tenant:token:2:104:DB0D80CD71B76AF4A8858729478BA945';
178
+ var token = 'scm:tenant:token:2:104:4EE94781916163519F3A5744296BAD40';
176
179
 
177
180
  /** 获取维度指标 */
178
181
  export var getDimTarget = /*#__PURE__*/function () {
@@ -97,6 +97,7 @@ var ZTemplatesDataCommon = /*#__PURE__*/React.forwardRef(function (props, ref) {
97
97
  };
98
98
  useImperativeHandle(ref, function () {
99
99
  return {
100
+ formRef: formRef,
100
101
  onLink: onLink,
101
102
  onQueryValues: onQueryValues,
102
103
  onQueryFormatValues: onQueryFormatValues
@@ -148,6 +148,8 @@ export declare const processTplProps: (props: RcPageProps, extra?: {
148
148
  };
149
149
  };
150
150
  key?: string;
151
+ className?: string;
152
+ style?: React.CSSProperties;
151
153
  tab?: React.ReactNode;
152
154
  onBillSuccess?: (res: any) => void;
153
155
  onBillError?: (res: any) => void;
@@ -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' | 'actionJson'> {
11
+ export interface linkStateType extends linkParamsType, Pick<TypeChartSettingProps, 'chartTitle' | 'custom' | 'child' | 'title' | 'autoLoad' | 'refreshRate' | 'actionJson' | 'exporter' | 'exportConfig'> {
12
12
  }
13
13
  declare const LinkRenderer: (props: Pick<TypeChartSettingProps, "onConfirm" | "chartRef" | "dimJson" | "linkPage" | "linkPageTitle"> & {
14
14
  onBack?: () => void;