@ztocwst/rc-pro-materials 0.2.25 → 0.2.27

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 (25) 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.js +2 -2
  6. package/build/lowcode/view.js +2 -2
  7. package/dist/SCM_Comps.js +2 -2
  8. package/dist/SCM_Comps.js.map +1 -1
  9. package/es/components/z-data-table/components/custom-renderer/index.js +67 -37
  10. package/es/components/z-data-table/components/link-renderer/index.js +45 -26
  11. package/es/components/z-data-table/components/table-renderer/index.js +81 -65
  12. package/es/components/z-data-table/components/table-renderer/table-renderer.helper.d.ts +1 -14
  13. package/es/components/z-data-table/components/table-renderer/table-renderer.helper.js +26 -35
  14. package/es/components/z-data-table/data-table.d.ts +2 -1
  15. package/es/components/z-data-table/data-table.helper.d.ts +1 -0
  16. package/es/components/z-data-table/data-table.helper.js +2 -1
  17. package/lib/components/z-data-table/components/custom-renderer/index.js +67 -37
  18. package/lib/components/z-data-table/components/link-renderer/index.js +45 -26
  19. package/lib/components/z-data-table/components/table-renderer/index.js +81 -65
  20. package/lib/components/z-data-table/components/table-renderer/table-renderer.helper.d.ts +1 -14
  21. package/lib/components/z-data-table/components/table-renderer/table-renderer.helper.js +26 -34
  22. package/lib/components/z-data-table/data-table.d.ts +2 -1
  23. package/lib/components/z-data-table/data-table.helper.d.ts +1 -0
  24. package/lib/components/z-data-table/data-table.helper.js +2 -1
  25. package/package.json +5 -5
@@ -1,12 +1,12 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
2
+ import _extends from "@babel/runtime/helpers/extends";
3
3
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
4
  var _excluded = ["isFixed", "fixed", "render"];
5
5
  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, defaultSort, computeWidth, handleDecimal, handleThousand, handlePercent, handleLink, handleCondition, getDimTarget } from "../../data-table.helper";
9
+ import { separator, defaultSort, computeWidth, getType, handleDecimal, handleThousand, handlePercent, handleLink, handleCondition, getDimTarget } from "../../data-table.helper";
10
10
  export var stringTrim = function stringTrim(str) {
11
11
  if (!str) return '';
12
12
  return str.replace(/`|'|"/g, '');
@@ -167,71 +167,62 @@ export var handleValueFormat = function handleValueFormat(value, record, config,
167
167
  return (_val = val) !== null && _val !== void 0 ? _val : "-";
168
168
  };
169
169
 
170
- /**
171
- * 条件格式
172
- */
173
-
174
170
  /**
175
171
  * 根据维度指标获取表格列
176
172
  */
177
- export var handleColumns = function handleColumns(option, expressions, linkPage, onLink) {
173
+ export var handleColumns = function handleColumns(option, linkPage, onLink) {
178
174
  var _option$actionJson;
179
- var isFirst = true;
175
+ // let isFirst = true
180
176
  var dimTarget = [].concat(option.dimension, option.index);
181
177
  var columns = dimTarget.map(function (title) {
182
- var _config5, _config5$link, _config6, _config7, _config8, _title$toString, _config9, _config10, _config11;
178
+ var _config3, _config3$link, _config4, _config5, _config6, _config6$otherProps, _config7, _config8, _config9, _config10, _config11, _title$toString, _config12, _config13, _config14;
183
179
  var config;
184
180
  var dataIndex;
185
- var defaultSortOrder;
186
181
  var condition;
187
182
  if (!config) {
188
- var _option$dimensionSour, _config, _config2;
183
+ var _option$dimensionSour, _config;
189
184
  /* 通过别名或名称 查找当前维度的配置 */
190
185
  config = (_option$dimensionSour = option.dimensionSource) === null || _option$dimensionSour === void 0 ? void 0 : _option$dimensionSour.find(function (item) {
191
186
  return item.alias === title || item.description === title;
192
187
  });
193
188
  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
- }
189
+ // if(config?.sorted && isFirst){
190
+ // isFirst = false
191
+ // }
198
192
  }
193
+
199
194
  if (!config) {
200
- var _option$indexSource, _config3, _config4;
195
+ var _option$indexSource, _config2;
201
196
  /* 通过别名或名称 查找当前指标的配置 */
202
197
  config = (_option$indexSource = option.indexSource) === null || _option$indexSource === void 0 ? void 0 : _option$indexSource.find(function (item) {
203
198
  return item.alias === title || item.name === title;
204
199
  });
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
+ dataIndex = (_config2 = config) === null || _config2 === void 0 ? void 0 : _config2.name;
201
+ // if(config?.sorted && isFirst){
202
+ // isFirst = false
203
+ // }
210
204
  }
211
- /* 条件格式设置 */
212
- // if (expressions?.length) {
213
- // condition = expressions?.filter((item) => item?.index?.includes(config?.name));
214
- // }
215
205
 
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)) || [],
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)) || [],
217
207
  dataSetName = _ref4[0];
218
208
  var index;
219
- if ((_config6 = config) !== null && _config6 !== void 0 && _config6.link && linkPage !== null && linkPage !== void 0 && linkPage.length) {
209
+ if ((_config4 = config) !== null && _config4 !== void 0 && _config4.link && linkPage !== null && linkPage !== void 0 && linkPage.length) {
220
210
  index = linkPage.findIndex(function (link) {
221
211
  return "" + link.dataSetName + separator + link.title === config.link;
222
212
  });
223
213
  }
224
- return {
214
+ var other = _extends({}, getType((_config5 = config) === null || _config5 === void 0 ? void 0 : _config5.otherProps) === 'function' ? (_config6 = config) === null || _config6 === void 0 ? void 0 : (_config6$otherProps = _config6.otherProps) === null || _config6$otherProps === void 0 ? void 0 : _config6$otherProps.call(_config6) : (_config7 = config) === null || _config7 === void 0 ? void 0 : _config7.otherProps);
215
+ return _extends({}, other, {
225
216
  title: title,
226
217
  dataIndex: dataIndex,
227
218
  ellipsis: true,
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,
219
+ sorter: (_config8 = config) === null || _config8 === void 0 ? void 0 : _config8.sorted,
220
+ defaultSortOrder: (_config9 = config) !== null && _config9 !== void 0 && _config9.sorted ? ((_config10 = config) === null || _config10 === void 0 ? void 0 : _config10.defaultSorted) || defaultSort + "end" : undefined,
221
+ width: ((_config11 = config) === null || _config11 === void 0 ? void 0 : _config11.width) || computeWidth(title === null || title === void 0 ? void 0 : (_title$toString = title.toString()) === null || _title$toString === void 0 ? void 0 : _title$toString.length),
222
+ fixed: (_config12 = config) !== null && _config12 !== void 0 && _config12.isFixed ? ((_config13 = config) === null || _config13 === void 0 ? void 0 : _config13.fixed) || ((_config14 = config) === null || _config14 === void 0 ? void 0 : _config14.isFixed) : false,
232
223
  render: function render(value, record) {
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
+ var _config$render, _config15;
225
+ return config.custom ? (_config$render = (_config15 = config).render) === null || _config$render === void 0 ? void 0 : _config$render.call(_config15, value, record, config, condition) : handleValueFormat(value, record, config, condition, function () {
235
226
  return onLink({
236
227
  dataSetName: dataSetName,
237
228
  index: index,
@@ -239,7 +230,7 @@ export var handleColumns = function handleColumns(option, expressions, linkPage,
239
230
  });
240
231
  });
241
232
  }
242
- };
233
+ });
243
234
  });
244
235
  if (option !== null && option !== void 0 && (_option$actionJson = option.actionJson) !== null && _option$actionJson !== void 0 && _option$actionJson.custom) {
245
236
  var _columns$fn;
@@ -20,6 +20,8 @@ export interface TypeTargetProps {
20
20
  percent: boolean;
21
21
  /** 是否允许排序 */
22
22
  sorted: boolean;
23
+ /** 默认排序 */
24
+ defaultSorted?: string;
23
25
  /** 宽度 */
24
26
  width: number;
25
27
  /** 是否合计 */
@@ -91,7 +93,6 @@ export interface TypeZDataTableProps {
91
93
  menuId: string;
92
94
  };
93
95
  /** 条件格式设置 */
94
- expressions?: any[] | [];
95
96
  linkPageTitle?: string;
96
97
  /** 下钻二级页设置 */
97
98
  linkPage?: TypeZDataTableProps[];
@@ -3,6 +3,7 @@
3
3
  export declare const tableConfigDefault: {
4
4
  manual: boolean;
5
5
  toolBars: boolean;
6
+ resizable: boolean;
6
7
  hideDefRowSelection: boolean;
7
8
  columns: any[];
8
9
  };
@@ -10,6 +10,7 @@ import rcProRequest from "../../utils/rcProRequest";
10
10
  export var tableConfigDefault = {
11
11
  manual: true,
12
12
  toolBars: false,
13
+ resizable: false,
13
14
  hideDefRowSelection: true,
14
15
  columns: []
15
16
  };
@@ -175,7 +176,7 @@ export var handleCondition = function handleCondition(value, handledValue, condi
175
176
  };
176
177
 
177
178
  // mock
178
- var token = 'scm:tenant:token:2:104:7c454641-c65c-4459-b5a3-d4be9fb16ffd';
179
+ var token = 'scm:tenant:token:2:104:9e53d7bb-7dac-4e2e-a371-060007dc9f76';
179
180
 
180
181
  /** 获取维度指标 */
181
182
  export var getDimTarget = /*#__PURE__*/function () {
@@ -45,80 +45,110 @@ var CustomRenderer = function CustomRenderer(props) {
45
45
  setIsLink(true);
46
46
  (_linkChartRef$current = linkChartRef.current) === null || _linkChartRef$current === void 0 ? void 0 : (_linkChartRef$current2 = _linkChartRef$current.initial) === null || _linkChartRef$current2 === void 0 ? void 0 : _linkChartRef$current2.call(_linkChartRef$current, (0, _extends2["default"])({}, values));
47
47
  };
48
+ var getBigDataBody = function getBigDataBody(params) {
49
+ var _indexJson$data;
50
+ if (params === void 0) {
51
+ params = {};
52
+ }
53
+ var target = [];
54
+ if (indexJson !== null && indexJson !== void 0 && (_indexJson$data = indexJson.data) !== null && _indexJson$data !== void 0 && _indexJson$data.length) {
55
+ for (var _iterator = _createForOfIteratorHelperLoose(indexJson.data), _step; !(_step = _iterator()).done;) {
56
+ var item = _step.value;
57
+ target.push({
58
+ description: item.name
59
+ });
60
+ }
61
+ }
62
+ var queryParams = (0, _dataTable.handleQueryParams)(params);
63
+ var data = {
64
+ target: target,
65
+ queryParams: queryParams,
66
+ dataSetName: dataSetName
67
+ };
68
+ return formatter ? formatter === null || formatter === void 0 ? void 0 : formatter(data) : data;
69
+ };
48
70
 
49
71
  // 获取数据源
50
72
  var getDataSource = /*#__PURE__*/function () {
51
73
  var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(query) {
52
- var _indexJson$data, target, _iterator, _step, item, queryParams, data, res;
74
+ var data, _ref3, success, _ref3$result, _result;
53
75
  return _regenerator["default"].wrap(function _callee$(_context) {
54
76
  while (1) switch (_context.prev = _context.next) {
55
77
  case 0:
56
78
  if (query === void 0) {
57
79
  query = {};
58
80
  }
59
- _context.prev = 1;
60
- target = [];
61
- if (indexJson !== null && indexJson !== void 0 && (_indexJson$data = indexJson.data) !== null && _indexJson$data !== void 0 && _indexJson$data.length) {
62
- for (_iterator = _createForOfIteratorHelperLoose(indexJson.data); !(_step = _iterator()).done;) {
63
- item = _step.value;
64
- target.push({
65
- description: item.name
66
- });
67
- }
81
+ if (!loading) {
82
+ _context.next = 3;
83
+ break;
68
84
  }
69
- queryParams = (0, _dataTable.handleQueryParams)(query);
70
- data = {
71
- target: target,
72
- queryParams: queryParams,
73
- dataSetName: dataSetName
74
- };
85
+ return _context.abrupt("return");
86
+ case 3:
87
+ _context.prev = 3;
88
+ data = getBigDataBody(query);
75
89
  setLoading(true);
76
- _context.next = 9;
77
- return (0, _dataTable.getReportData)(rcProContext, formatter ? formatter === null || formatter === void 0 ? void 0 : formatter(data) : data);
78
- case 9:
79
- res = _context.sent;
90
+ _context.next = 8;
91
+ return (0, _dataTable.getReportData)(rcProContext, data);
92
+ case 8:
93
+ _context.t0 = _context.sent;
94
+ if (_context.t0) {
95
+ _context.next = 11;
96
+ break;
97
+ }
98
+ _context.t0 = {};
99
+ case 11:
100
+ _ref3 = _context.t0;
101
+ success = _ref3.success;
102
+ _ref3$result = _ref3.result;
103
+ _result = _ref3$result === void 0 ? {} : _ref3$result;
80
104
  setLoading(false);
81
- if (res !== null && res !== void 0 && res.success) {
82
- setResult(res === null || res === void 0 ? void 0 : res.result);
105
+ if (success) {
106
+ setResult(_result);
107
+ } else {
108
+ setResult(null);
83
109
  }
84
- _context.next = 19;
110
+ _context.next = 24;
85
111
  break;
86
- case 14:
87
- _context.prev = 14;
88
- _context.t0 = _context["catch"](1);
112
+ case 19:
113
+ _context.prev = 19;
114
+ _context.t1 = _context["catch"](3);
89
115
  setLoading(false);
90
116
  setResult(null);
91
- console.error(_context.t0);
92
- case 19:
117
+ console.error(_context.t1);
118
+ case 24:
93
119
  case "end":
94
120
  return _context.stop();
95
121
  }
96
- }, _callee, null, [[1, 14]]);
122
+ }, _callee, null, [[3, 19]]);
97
123
  }));
98
124
  return function getDataSource(_x) {
99
125
  return _ref2.apply(this, arguments);
100
126
  };
101
127
  }();
102
128
  var queryChart = /*#__PURE__*/function () {
103
- var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(value) {
104
- var queryParams, _linkChartRef$current3;
129
+ var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(value) {
130
+ var _value;
131
+ var queryParams, _linkChartRef$current3, _linkChartRef$current4;
105
132
  return _regenerator["default"].wrap(function _callee2$(_context2) {
106
133
  while (1) switch (_context2.prev = _context2.next) {
107
134
  case 0:
108
- queryParams = value[dataSetName] || value;
135
+ if (value === void 0) {
136
+ value = {};
137
+ }
138
+ queryParams = ((_value = value) === null || _value === void 0 ? void 0 : _value[dataSetName]) || value;
109
139
  if (isLink) {
110
- (_linkChartRef$current3 = linkChartRef.current) === null || _linkChartRef$current3 === void 0 ? void 0 : _linkChartRef$current3.queryChart(queryParams);
140
+ (_linkChartRef$current3 = linkChartRef.current) === null || _linkChartRef$current3 === void 0 ? void 0 : (_linkChartRef$current4 = _linkChartRef$current3.queryChart) === null || _linkChartRef$current4 === void 0 ? void 0 : _linkChartRef$current4.call(_linkChartRef$current3, queryParams);
111
141
  } else {
112
142
  getDataSource(queryParams);
113
143
  }
114
- case 2:
144
+ case 3:
115
145
  case "end":
116
146
  return _context2.stop();
117
147
  }
118
148
  }, _callee2);
119
149
  }));
120
150
  return function queryChart(_x2) {
121
- return _ref3.apply(this, arguments);
151
+ return _ref4.apply(this, arguments);
122
152
  };
123
153
  }();
124
154
  var handleClearInterval = function handleClearInterval() {
@@ -143,8 +173,8 @@ var CustomRenderer = function CustomRenderer(props) {
143
173
  };
144
174
  (0, _react.useEffect)(function () {
145
175
  if (currentKey) {
146
- var _ref4 = currentKey.split(_dataTable.separator) || [],
147
- curDataSetName = _ref4[0];
176
+ var _ref5 = currentKey.split(_dataTable.separator) || [],
177
+ curDataSetName = _ref5[0];
148
178
  if (curDataSetName === dataSetName) {
149
179
  onload();
150
180
  } else {
@@ -200,9 +200,10 @@ var LinkRenderer = function LinkRenderer(props) {
200
200
  for (var _iterator = _createForOfIteratorHelperLoose(targets.indexSource), _step; !(_step = _iterator()).done;) {
201
201
  var cur = _step.value;
202
202
  if (cur !== null && cur !== void 0 && cur.sorted) {
203
+ var _cur$defaultSorted;
203
204
  orderBys.push({
204
205
  name: cur.name,
205
- sort: _dataTable.defaultSort
206
+ sort: cur.defaultSorted ? (_cur$defaultSorted = cur.defaultSorted) === null || _cur$defaultSorted === void 0 ? void 0 : _cur$defaultSorted.slice(0, -3) : _dataTable.defaultSort
206
207
  });
207
208
  }
208
209
  }
@@ -245,42 +246,57 @@ var LinkRenderer = function LinkRenderer(props) {
245
246
  };
246
247
  var getDataSource = /*#__PURE__*/function () {
247
248
  var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(params) {
248
- var queryData;
249
+ var data, _ref5, success, _ref5$result, _result;
249
250
  return _regenerator["default"].wrap(function _callee$(_context) {
250
251
  while (1) switch (_context.prev = _context.next) {
251
252
  case 0:
252
253
  if (params === void 0) {
253
254
  params = {};
254
255
  }
255
- queryData = getBigDataBody(params);
256
+ if (!loading) {
257
+ _context.next = 3;
258
+ break;
259
+ }
260
+ return _context.abrupt("return");
261
+ case 3:
262
+ _context.prev = 3;
263
+ data = getBigDataBody(params); // 自定义、非自定义都打开 loading 拦截重复请求
264
+ setLoading(true);
265
+ _context.next = 8;
266
+ return (0, _dataTable.getReportData)(rcProContext, data);
267
+ case 8:
268
+ _context.t0 = _context.sent;
269
+ if (_context.t0) {
270
+ _context.next = 11;
271
+ break;
272
+ }
273
+ _context.t0 = {};
274
+ case 11:
275
+ _ref5 = _context.t0;
276
+ success = _ref5.success;
277
+ _ref5$result = _ref5.result;
278
+ _result = _ref5$result === void 0 ? {} : _ref5$result;
279
+ setLoading(false);
256
280
  if (linkState.custom) {
257
- setLoading(true);
281
+ setResult(_result);
258
282
  }
259
- return _context.abrupt("return", (0, _dataTable.getReportData)(rcProContext, queryData).then(function (_ref5) {
260
- var success = _ref5.success,
261
- _ref5$result = _ref5.result,
262
- result = _ref5$result === void 0 ? {} : _ref5$result;
263
- if (linkState.custom) {
264
- setLoading(false);
265
- if (success) {
266
- setResult(result);
267
- }
268
- }
269
- return {
270
- success: success,
271
- result: result
272
- };
273
- })["catch"](function () {
274
- if (linkState.custom) {
275
- setLoading(false);
276
- setResult(null);
277
- }
278
- }));
279
- case 4:
283
+ return _context.abrupt("return", {
284
+ success: success,
285
+ result: _result
286
+ });
287
+ case 20:
288
+ _context.prev = 20;
289
+ _context.t1 = _context["catch"](3);
290
+ setLoading(false);
291
+ if (linkState.custom) {
292
+ setResult(null);
293
+ }
294
+ console.error(_context.t1);
295
+ case 25:
280
296
  case "end":
281
297
  return _context.stop();
282
298
  }
283
- }, _callee);
299
+ }, _callee, null, [[3, 20]]);
284
300
  }));
285
301
  return function getDataSource(_x) {
286
302
  return _ref4.apply(this, arguments);
@@ -339,6 +355,9 @@ var LinkRenderer = function LinkRenderer(props) {
339
355
  setLinkState(stateData);
340
356
  };
341
357
  var queryChart = function queryChart(value) {
358
+ if (value === void 0) {
359
+ value = {};
360
+ }
342
361
  queryCacheRef.current = value;
343
362
  if (linkState.custom) {
344
363
  getDataSource({