@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.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +3 -3
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +3 -3
- package/dist/SCM_Comps.css +1 -1
- package/dist/SCM_Comps.js +3 -3
- package/dist/SCM_Comps.js.map +1 -1
- package/es/components/z-templates-data-common/components/link-renderer/index.d.ts +1 -1
- package/es/components/z-templates-data-common/components/link-renderer/index.js +199 -102
- package/es/components/z-templates-data-common/components/link-renderer/index.less +4 -0
- package/es/components/z-templates-data-common/components/table-renderer/index.js +38 -9
- package/es/components/z-templates-data-common/components/table-renderer/table-renderer.helper.d.ts +1 -0
- package/es/components/z-templates-data-common/components/table-renderer/table-renderer.helper.js +23 -12
- package/es/components/z-templates-data-common/data-common.helper.d.ts +2 -0
- package/es/components/z-templates-data-common/data-common.helper.js +4 -1
- package/es/components/z-templates-data-common/data-common.js +1 -0
- package/es/utils/props/tpl.d.ts +2 -0
- package/lib/components/z-templates-data-common/components/link-renderer/index.d.ts +1 -1
- package/lib/components/z-templates-data-common/components/link-renderer/index.js +197 -100
- package/lib/components/z-templates-data-common/components/link-renderer/index.less +4 -0
- package/lib/components/z-templates-data-common/components/table-renderer/index.js +37 -8
- package/lib/components/z-templates-data-common/components/table-renderer/table-renderer.helper.d.ts +1 -0
- package/lib/components/z-templates-data-common/components/table-renderer/table-renderer.helper.js +22 -11
- package/lib/components/z-templates-data-common/data-common.helper.d.ts +2 -0
- package/lib/components/z-templates-data-common/data-common.helper.js +7 -3
- package/lib/components/z-templates-data-common/data-common.js +1 -0
- package/lib/utils/props/tpl.d.ts +2 -0
- package/package.json +4 -4
|
@@ -6,8 +6,8 @@ exports["default"] = void 0;
|
|
|
6
6
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
7
7
|
var _spin = _interopRequireDefault(require("antd/lib/spin"));
|
|
8
8
|
var _radio = _interopRequireDefault(require("antd/lib/radio"));
|
|
9
|
-
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
11
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
12
|
var _react = require("react");
|
|
13
13
|
var _rcPro = require("@ztocwst/rc-pro");
|
|
@@ -16,7 +16,11 @@ var _moment = _interopRequireDefault(require("moment"));
|
|
|
16
16
|
var _dataCommon = require("../../data-common.helper");
|
|
17
17
|
var _tableRenderer = require("../table-renderer/table-renderer.helper");
|
|
18
18
|
require("./index.less");
|
|
19
|
-
var _excluded = ["
|
|
19
|
+
var _excluded = ["queryBind", "formatter"],
|
|
20
|
+
_excluded2 = ["pageNum", "pageSize", "orderBy"];
|
|
21
|
+
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."); }
|
|
22
|
+
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); }
|
|
23
|
+
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; }
|
|
20
24
|
var linkStateDefault = {
|
|
21
25
|
custom: false,
|
|
22
26
|
dataSetName: '',
|
|
@@ -33,6 +37,7 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
33
37
|
onBack = props.onBack;
|
|
34
38
|
var rcProContext = (0, _react.useContext)(_rcPro.RcConfigContext);
|
|
35
39
|
var _ref = rcProContext || {},
|
|
40
|
+
BASE_URL = _ref.BASE_URL,
|
|
36
41
|
_ref$tableOptions = _ref.tableOptions,
|
|
37
42
|
tableOptions = _ref$tableOptions === void 0 ? {} : _ref$tableOptions;
|
|
38
43
|
var defaultPageSize = (tableOptions === null || tableOptions === void 0 ? void 0 : (_tableOptions$paginat = tableOptions.pagination) === null || _tableOptions$paginat === void 0 ? void 0 : _tableOptions$paginat.defaultPageSize) || 20;
|
|
@@ -107,106 +112,154 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
107
112
|
// 更新表头
|
|
108
113
|
(_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);
|
|
109
114
|
};
|
|
115
|
+
var getBigDataBody = function getBigDataBody(params) {
|
|
116
|
+
var _dimJson$data, _targets$indexSource;
|
|
117
|
+
if (params === void 0) {
|
|
118
|
+
params = {};
|
|
119
|
+
}
|
|
120
|
+
var dataSetName = linkState.dataSetName,
|
|
121
|
+
index = linkState.index,
|
|
122
|
+
dimension = linkState.dimension,
|
|
123
|
+
record = linkState.record;
|
|
124
|
+
var columns = handleGetColumns((0, _extends2["default"])({}, linkState));
|
|
125
|
+
|
|
126
|
+
/** 查看queryBind是否有 当前查询条件和当前数据源参数(paraJson)建立绑定关系;有的话替换成绑定关系中的"键",没有则是默认查询配置的"键",上一级数据源的维度 "值" 或 当前查询条件的"值"入参 */
|
|
127
|
+
var _linkPage$index = linkPage[index],
|
|
128
|
+
queryBind = _linkPage$index.queryBind,
|
|
129
|
+
formatter = _linkPage$index.formatter,
|
|
130
|
+
find = (0, _objectWithoutPropertiesLoose2["default"])(_linkPage$index, _excluded);
|
|
131
|
+
var _ref3 = (0, _tableRenderer.handleDimTargetFormat)(find) || {},
|
|
132
|
+
targets = _ref3.targets;
|
|
133
|
+
var queryCache = queryCacheRef.current;
|
|
134
|
+
var query = {};
|
|
135
|
+
var queryKeys = Object.keys(queryCache);
|
|
136
|
+
if (queryKeys !== null && queryKeys !== void 0 && queryKeys.length) {
|
|
137
|
+
queryKeys.forEach(function (k) {
|
|
138
|
+
// 查看是否有绑定关联关系 有取绑定的入参"键" 没有则取默认的"键"
|
|
139
|
+
var queryBindFilter = queryBind === null || queryBind === void 0 ? void 0 : queryBind.filter(function (item) {
|
|
140
|
+
return (item === null || item === void 0 ? void 0 : item.currentQueryKey) === k;
|
|
141
|
+
});
|
|
142
|
+
// "键"(有建立绑定关系 取当前数据源参数(paraJson)的"键",没有则是默认查询配置的"键")
|
|
143
|
+
if (queryBindFilter !== null && queryBindFilter !== void 0 && queryBindFilter.length) {
|
|
144
|
+
// 参数为时间时会出现多个绑定关系
|
|
145
|
+
queryBindFilter.forEach(function (item) {
|
|
146
|
+
var key = item.sourceQueryKey;
|
|
147
|
+
// "值"(当前查询条件的"值")
|
|
148
|
+
var value = queryCache[k];
|
|
149
|
+
if (key) {
|
|
150
|
+
// 类型为时间时 处理
|
|
151
|
+
if ((0, _dataCommon.getType)(value) === 'array' && value.length === 2 && value.some(function (d) {
|
|
152
|
+
return (0, _moment["default"])(d).isValid();
|
|
153
|
+
})) {
|
|
154
|
+
var i = key.includes(_dataCommon.dateStart) ? 0 : 1;
|
|
155
|
+
query[key] = value[i];
|
|
156
|
+
} else {
|
|
157
|
+
query[key] = value;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
} else {
|
|
162
|
+
// "值"(当前查询条件的"值")
|
|
163
|
+
query[k] = queryCache[k];
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
var recordKeys = Object.keys(record || {});
|
|
168
|
+
if (recordKeys.length) {
|
|
169
|
+
recordKeys.forEach(function (k) {
|
|
170
|
+
// 查看是否有绑定关联关系
|
|
171
|
+
var queryBindFilter = queryBind === null || queryBind === void 0 ? void 0 : queryBind.filter(function (item) {
|
|
172
|
+
return (item === null || item === void 0 ? void 0 : item.parentDimKey) === k;
|
|
173
|
+
});
|
|
174
|
+
// 参数为时间时会出现多个绑定关系
|
|
175
|
+
if (queryBindFilter !== null && queryBindFilter !== void 0 && queryBindFilter.length) {
|
|
176
|
+
queryBindFilter.forEach(function (item) {
|
|
177
|
+
var key = item.sourceQueryKey;
|
|
178
|
+
if (key) {
|
|
179
|
+
// "值"(有建立绑定关系 取上一级数据源的维度的"值")
|
|
180
|
+
query[key] = record[k];
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
var dim;
|
|
187
|
+
if (dimJson !== null && dimJson !== void 0 && (_dimJson$data = dimJson.data) !== null && _dimJson$data !== void 0 && _dimJson$data.length) {
|
|
188
|
+
dim = dimension === null || dimension === void 0 ? void 0 : dimension.map(function (description) {
|
|
189
|
+
var _dimJson$data2, _dimJson$data2$find;
|
|
190
|
+
return {
|
|
191
|
+
description: description,
|
|
192
|
+
name: (_dimJson$data2 = dimJson.data) === null || _dimJson$data2 === void 0 ? void 0 : (_dimJson$data2$find = _dimJson$data2.find(function (item) {
|
|
193
|
+
return item.description === description;
|
|
194
|
+
})) === null || _dimJson$data2$find === void 0 ? void 0 : _dimJson$data2$find.name
|
|
195
|
+
};
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
var orderBys = [];
|
|
199
|
+
if (targets !== null && targets !== void 0 && (_targets$indexSource = targets.indexSource) !== null && _targets$indexSource !== void 0 && _targets$indexSource.length) {
|
|
200
|
+
for (var _iterator = _createForOfIteratorHelperLoose(targets.indexSource), _step; !(_step = _iterator()).done;) {
|
|
201
|
+
var cur = _step.value;
|
|
202
|
+
if (cur !== null && cur !== void 0 && cur.sorted) {
|
|
203
|
+
orderBys.push({
|
|
204
|
+
name: cur.name,
|
|
205
|
+
sort: _dataCommon.defaultSort
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
var queryParams = (0, _dataCommon.handleQueryParams)(query);
|
|
211
|
+
var _params = params,
|
|
212
|
+
pageNum = _params.pageNum,
|
|
213
|
+
pageSize = _params.pageSize,
|
|
214
|
+
orderBy = _params.orderBy,
|
|
215
|
+
other = (0, _objectWithoutPropertiesLoose2["default"])(_params, _excluded2);
|
|
216
|
+
if (orderBy !== null && orderBy !== void 0 && orderBy.length) {
|
|
217
|
+
var _loop = function _loop() {
|
|
218
|
+
var item = _step2.value;
|
|
219
|
+
var i = orderBys.findIndex(function (e) {
|
|
220
|
+
return e.name === item.name;
|
|
221
|
+
});
|
|
222
|
+
if (i > -1) {
|
|
223
|
+
orderBys.splice(i, 1);
|
|
224
|
+
}
|
|
225
|
+
orderBys.unshift((0, _extends2["default"])({}, item));
|
|
226
|
+
};
|
|
227
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose(orderBy), _step2; !(_step2 = _iterator2()).done;) {
|
|
228
|
+
_loop();
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
var data = (0, _extends2["default"])({}, other, {
|
|
232
|
+
queryParams: queryParams,
|
|
233
|
+
dim: dim,
|
|
234
|
+
target: columns.map(function (item) {
|
|
235
|
+
return {
|
|
236
|
+
description: item.dataIndex
|
|
237
|
+
};
|
|
238
|
+
}),
|
|
239
|
+
orderBy: orderBys !== null && orderBys !== void 0 && orderBys.length ? orderBys : undefined,
|
|
240
|
+
pageNum: pageNum || 1,
|
|
241
|
+
pageSize: pageSize || defaultPageSize,
|
|
242
|
+
dataSetName: dataSetName
|
|
243
|
+
});
|
|
244
|
+
return formatter ? formatter === null || formatter === void 0 ? void 0 : formatter(data) : data;
|
|
245
|
+
};
|
|
110
246
|
var getDataSource = /*#__PURE__*/function () {
|
|
111
|
-
var
|
|
112
|
-
var
|
|
113
|
-
var dataSetName, index, dimension, record, columns, _linkPage$index, queryBind, formatter, queryCache, query, queryKeys, recordKeys, dim, queryParams, _params, pageNum, pageSize, other, data, queryData;
|
|
247
|
+
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(params) {
|
|
248
|
+
var queryData;
|
|
114
249
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
115
250
|
while (1) switch (_context.prev = _context.next) {
|
|
116
251
|
case 0:
|
|
117
252
|
if (params === void 0) {
|
|
118
253
|
params = {};
|
|
119
254
|
}
|
|
120
|
-
|
|
121
|
-
columns = handleGetColumns((0, _extends2["default"])({}, linkState));
|
|
122
|
-
/** 查看queryBind是否有 当前查询条件和当前数据源参数(paraJson)建立绑定关系;有的话替换成绑定关系中的"键",没有则是默认查询配置的"键",上一级数据源的维度 "值" 或 当前查询条件的"值"入参 */
|
|
123
|
-
_linkPage$index = linkPage[index], queryBind = _linkPage$index.queryBind, formatter = _linkPage$index.formatter;
|
|
124
|
-
queryCache = queryCacheRef.current;
|
|
125
|
-
query = {};
|
|
126
|
-
queryKeys = Object.keys(queryCache);
|
|
127
|
-
if (queryKeys !== null && queryKeys !== void 0 && queryKeys.length) {
|
|
128
|
-
queryKeys.forEach(function (k) {
|
|
129
|
-
// 查看是否有绑定关联关系 有取绑定的入参"键" 没有则取默认的"键"
|
|
130
|
-
var queryBindFilter = queryBind === null || queryBind === void 0 ? void 0 : queryBind.filter(function (item) {
|
|
131
|
-
return (item === null || item === void 0 ? void 0 : item.currentQueryKey) === k;
|
|
132
|
-
});
|
|
133
|
-
// "键"(有建立绑定关系 取当前数据源参数(paraJson)的"键",没有则是默认查询配置的"键")
|
|
134
|
-
if (queryBindFilter !== null && queryBindFilter !== void 0 && queryBindFilter.length) {
|
|
135
|
-
// 参数为时间时会出现多个绑定关系
|
|
136
|
-
queryBindFilter.forEach(function (item) {
|
|
137
|
-
var key = item.sourceQueryKey;
|
|
138
|
-
// "值"(当前查询条件的"值")
|
|
139
|
-
var value = queryCache[k];
|
|
140
|
-
if (key) {
|
|
141
|
-
// 类型为时间时 处理
|
|
142
|
-
if ((0, _dataCommon.getType)(value) === 'array' && value.length === 2 && value.some(function (d) {
|
|
143
|
-
return (0, _moment["default"])(d).isValid();
|
|
144
|
-
})) {
|
|
145
|
-
var i = key.includes(_dataCommon.dateStart) ? 0 : 1;
|
|
146
|
-
query[key] = value[i];
|
|
147
|
-
} else {
|
|
148
|
-
query[key] = value;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
} else {
|
|
153
|
-
// "值"(当前查询条件的"值")
|
|
154
|
-
query[k] = queryCache[k];
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
recordKeys = Object.keys(record || {});
|
|
159
|
-
if (recordKeys.length) {
|
|
160
|
-
recordKeys.forEach(function (k) {
|
|
161
|
-
// 查看是否有绑定关联关系
|
|
162
|
-
var queryBindFilter = queryBind === null || queryBind === void 0 ? void 0 : queryBind.filter(function (item) {
|
|
163
|
-
return (item === null || item === void 0 ? void 0 : item.parentDimKey) === k;
|
|
164
|
-
});
|
|
165
|
-
// 参数为时间时会出现多个绑定关系
|
|
166
|
-
if (queryBindFilter !== null && queryBindFilter !== void 0 && queryBindFilter.length) {
|
|
167
|
-
queryBindFilter.forEach(function (item) {
|
|
168
|
-
var key = item.sourceQueryKey;
|
|
169
|
-
if (key) {
|
|
170
|
-
// "值"(有建立绑定关系 取上一级数据源的维度的"值")
|
|
171
|
-
query[key] = record[k];
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
if (dimJson !== null && dimJson !== void 0 && (_dimJson$data = dimJson.data) !== null && _dimJson$data !== void 0 && _dimJson$data.length) {
|
|
178
|
-
dim = dimension === null || dimension === void 0 ? void 0 : dimension.map(function (description) {
|
|
179
|
-
var _dimJson$data2, _dimJson$data2$find;
|
|
180
|
-
return {
|
|
181
|
-
description: description,
|
|
182
|
-
name: (_dimJson$data2 = dimJson.data) === null || _dimJson$data2 === void 0 ? void 0 : (_dimJson$data2$find = _dimJson$data2.find(function (item) {
|
|
183
|
-
return item.description === description;
|
|
184
|
-
})) === null || _dimJson$data2$find === void 0 ? void 0 : _dimJson$data2$find.name
|
|
185
|
-
};
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
queryParams = (0, _dataCommon.handleQueryParams)(query);
|
|
189
|
-
_params = params, pageNum = _params.pageNum, pageSize = _params.pageSize, other = (0, _objectWithoutPropertiesLoose2["default"])(_params, _excluded);
|
|
190
|
-
data = (0, _extends2["default"])({}, other, {
|
|
191
|
-
pageNum: pageNum || 1,
|
|
192
|
-
pageSize: pageSize || defaultPageSize,
|
|
193
|
-
queryParams: queryParams,
|
|
194
|
-
dim: dim,
|
|
195
|
-
target: columns.map(function (item) {
|
|
196
|
-
return {
|
|
197
|
-
description: item.dataIndex
|
|
198
|
-
};
|
|
199
|
-
}),
|
|
200
|
-
dataSetName: dataSetName
|
|
201
|
-
});
|
|
202
|
-
queryData = formatter ? formatter === null || formatter === void 0 ? void 0 : formatter(data) : data;
|
|
255
|
+
queryData = getBigDataBody(params);
|
|
203
256
|
if (linkState.custom) {
|
|
204
257
|
setLoading(true);
|
|
205
258
|
}
|
|
206
|
-
return _context.abrupt("return", (0, _dataCommon.getReportData)(rcProContext, queryData).then(function (
|
|
207
|
-
var success =
|
|
208
|
-
|
|
209
|
-
result =
|
|
259
|
+
return _context.abrupt("return", (0, _dataCommon.getReportData)(rcProContext, queryData).then(function (_ref5) {
|
|
260
|
+
var success = _ref5.success,
|
|
261
|
+
_ref5$result = _ref5.result,
|
|
262
|
+
result = _ref5$result === void 0 ? {} : _ref5$result;
|
|
210
263
|
if (linkState.custom) {
|
|
211
264
|
setLoading(false);
|
|
212
265
|
if (success) {
|
|
@@ -223,21 +276,21 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
223
276
|
setResult(null);
|
|
224
277
|
}
|
|
225
278
|
}));
|
|
226
|
-
case
|
|
279
|
+
case 4:
|
|
227
280
|
case "end":
|
|
228
281
|
return _context.stop();
|
|
229
282
|
}
|
|
230
283
|
}, _callee);
|
|
231
284
|
}));
|
|
232
285
|
return function getDataSource(_x) {
|
|
233
|
-
return
|
|
286
|
+
return _ref4.apply(this, arguments);
|
|
234
287
|
};
|
|
235
288
|
}();
|
|
236
289
|
|
|
237
290
|
/** 初始linkState */
|
|
238
291
|
var initial = function initial(paramsState) {
|
|
239
|
-
var
|
|
240
|
-
dataSetName =
|
|
292
|
+
var _ref6 = paramsState || {},
|
|
293
|
+
dataSetName = _ref6.dataSetName;
|
|
241
294
|
/** 二级页未配置 或 自定义dataSetName配错 直接返回 */
|
|
242
295
|
var Length = linkPage === null || linkPage === void 0 ? void 0 : linkPage.length;
|
|
243
296
|
var isHave = linkPage === null || linkPage === void 0 ? void 0 : linkPage.some(function (item) {
|
|
@@ -310,9 +363,9 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
310
363
|
var handleLinkChange = function handleLinkChange(event) {
|
|
311
364
|
var value = event.target.value;
|
|
312
365
|
// dataSetName 可能会重复配置 所以使用 dataSetName + 分隔符 + index
|
|
313
|
-
var
|
|
314
|
-
dataSetName =
|
|
315
|
-
index =
|
|
366
|
+
var _ref7 = (value === null || value === void 0 ? void 0 : value.split(_dataCommon.separator)) || [],
|
|
367
|
+
dataSetName = _ref7[0],
|
|
368
|
+
index = _ref7[1];
|
|
316
369
|
var currentState = linkPage[index];
|
|
317
370
|
var stateData = (0, _extends2["default"])({}, linkState, currentState, {
|
|
318
371
|
dataSetName: dataSetName,
|
|
@@ -342,7 +395,51 @@ var LinkRenderer = function LinkRenderer(props) {
|
|
|
342
395
|
width: linkState.width
|
|
343
396
|
}
|
|
344
397
|
}, field === null || field === void 0 ? void 0 : field.title)) : null;
|
|
345
|
-
}))
|
|
398
|
+
})), linkState.exporter ? /*#__PURE__*/React.createElement("div", {
|
|
399
|
+
className: "link-export"
|
|
400
|
+
}, /*#__PURE__*/React.createElement(_rcPro.ProButton, {
|
|
401
|
+
items: [{
|
|
402
|
+
action: 'btn',
|
|
403
|
+
name: linkState === null || linkState === void 0 ? void 0 : linkState.exportConfig.name,
|
|
404
|
+
fileConfig: {
|
|
405
|
+
type: 'export',
|
|
406
|
+
params: {
|
|
407
|
+
menuId: linkState === null || linkState === void 0 ? void 0 : linkState.exportConfig.menuId,
|
|
408
|
+
operateType: 'EXPORT'
|
|
409
|
+
},
|
|
410
|
+
request: {
|
|
411
|
+
submit: {
|
|
412
|
+
url: BASE_URL + "/data/forward/v1/bigdata/report/" + (linkState === null || linkState === void 0 ? void 0 : linkState.dataSetName) + "/export",
|
|
413
|
+
method: 'POST',
|
|
414
|
+
formatter: function () {
|
|
415
|
+
var _formatter = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(values) {
|
|
416
|
+
var bigDataBody, _ref8, _ref8$temp, temp;
|
|
417
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
418
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
419
|
+
case 0:
|
|
420
|
+
bigDataBody = getBigDataBody();
|
|
421
|
+
_ref8 = values || {}, _ref8$temp = _ref8.temp, temp = _ref8$temp === void 0 ? {} : _ref8$temp;
|
|
422
|
+
return _context2.abrupt("return", {
|
|
423
|
+
buttonCode: linkState === null || linkState === void 0 ? void 0 : linkState.exportConfig.code,
|
|
424
|
+
templateId: temp === null || temp === void 0 ? void 0 : temp.value,
|
|
425
|
+
bigDataBody: bigDataBody
|
|
426
|
+
});
|
|
427
|
+
case 3:
|
|
428
|
+
case "end":
|
|
429
|
+
return _context2.stop();
|
|
430
|
+
}
|
|
431
|
+
}, _callee2);
|
|
432
|
+
}));
|
|
433
|
+
function formatter(_x2) {
|
|
434
|
+
return _formatter.apply(this, arguments);
|
|
435
|
+
}
|
|
436
|
+
return formatter;
|
|
437
|
+
}()
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}]
|
|
442
|
+
})) : null), linkState.custom ? /*#__PURE__*/React.createElement(_spin["default"], {
|
|
346
443
|
spinning: loading
|
|
347
444
|
}, (_linkState$child = linkState.child) === null || _linkState$child === void 0 ? void 0 : _linkState$child.call(linkState, result)) : /*#__PURE__*/React.createElement(_rcPro.ProTable, {
|
|
348
445
|
ref: tableRef,
|
|
@@ -15,7 +15,7 @@ var _dataCommon = require("../../data-common.helper");
|
|
|
15
15
|
var _tableRenderer = require("./table-renderer.helper");
|
|
16
16
|
var _dimTarget = _interopRequireDefault(require("../dim-target"));
|
|
17
17
|
var _linkRenderer = _interopRequireDefault(require("../link-renderer"));
|
|
18
|
-
var _excluded = ["pageNum", "pageSize"];
|
|
18
|
+
var _excluded = ["pageNum", "pageSize", "orderBy"];
|
|
19
19
|
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."); }
|
|
20
20
|
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); }
|
|
21
21
|
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; }
|
|
@@ -227,7 +227,7 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
227
227
|
}
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
|
-
|
|
230
|
+
var orderBys = [];
|
|
231
231
|
/** 维度收集 */
|
|
232
232
|
var dim = [];
|
|
233
233
|
for (var _iterator = _createForOfIteratorHelperLoose(dimensionSource), _step; !(_step = _iterator()).done;) {
|
|
@@ -237,6 +237,12 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
237
237
|
name: cur.name,
|
|
238
238
|
description: cur.description
|
|
239
239
|
});
|
|
240
|
+
if (cur !== null && cur !== void 0 && cur.sorted) {
|
|
241
|
+
orderBys.push({
|
|
242
|
+
name: cur.description,
|
|
243
|
+
sort: _dataCommon.defaultSort
|
|
244
|
+
});
|
|
245
|
+
}
|
|
240
246
|
}
|
|
241
247
|
}
|
|
242
248
|
|
|
@@ -248,18 +254,41 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
248
254
|
target.push({
|
|
249
255
|
description: _cur.name
|
|
250
256
|
});
|
|
257
|
+
if (_cur !== null && _cur !== void 0 && _cur.sorted) {
|
|
258
|
+
orderBys.push({
|
|
259
|
+
name: _cur.name,
|
|
260
|
+
sort: _dataCommon.defaultSort
|
|
261
|
+
});
|
|
262
|
+
}
|
|
251
263
|
}
|
|
252
264
|
}
|
|
253
265
|
var queryParams = (0, _dataCommon.handleQueryParams)(query);
|
|
254
266
|
var _params = params,
|
|
255
267
|
pageNum = _params.pageNum,
|
|
256
268
|
pageSize = _params.pageSize,
|
|
269
|
+
orderBy = _params.orderBy,
|
|
257
270
|
other = (0, _objectWithoutPropertiesLoose2["default"])(_params, _excluded);
|
|
271
|
+
if (orderBy !== null && orderBy !== void 0 && orderBy.length) {
|
|
272
|
+
var _loop = function _loop() {
|
|
273
|
+
var item = _step3.value;
|
|
274
|
+
var i = orderBys.findIndex(function (e) {
|
|
275
|
+
return e.name === item.name;
|
|
276
|
+
});
|
|
277
|
+
if (i > -1) {
|
|
278
|
+
orderBys.splice(i, 1);
|
|
279
|
+
}
|
|
280
|
+
orderBys.unshift((0, _extends2["default"])({}, item));
|
|
281
|
+
};
|
|
282
|
+
for (var _iterator3 = _createForOfIteratorHelperLoose(orderBy), _step3; !(_step3 = _iterator3()).done;) {
|
|
283
|
+
_loop();
|
|
284
|
+
}
|
|
285
|
+
}
|
|
258
286
|
var data = (0, _extends2["default"])({
|
|
259
|
-
queryParams: queryParams
|
|
260
|
-
dim: dim,
|
|
261
|
-
target: target
|
|
287
|
+
queryParams: queryParams
|
|
262
288
|
}, other, {
|
|
289
|
+
dim: dim,
|
|
290
|
+
target: target,
|
|
291
|
+
orderBy: orderBys !== null && orderBys !== void 0 && orderBys.length ? orderBys : undefined,
|
|
263
292
|
pageNum: pageNum || 1,
|
|
264
293
|
pageSize: pageSize || defaultPageSize,
|
|
265
294
|
dataSetName: dataSetName
|
|
@@ -418,7 +447,7 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
418
447
|
queryCacheRef.current = value[dataSetName] || value;
|
|
419
448
|
setTimeout( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
420
449
|
var _tableRef$current2;
|
|
421
|
-
var _getDimTargetValues4, _getDimTargetValues4$, indexSource, indexAmounted, target,
|
|
450
|
+
var _getDimTargetValues4, _getDimTargetValues4$, indexSource, indexAmounted, target, _iterator4, _step4, cur, _ref9, success, _ref9$result, result, _result$data, _result$data$, data;
|
|
422
451
|
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
423
452
|
while (1) switch (_context5.prev = _context5.next) {
|
|
424
453
|
case 0:
|
|
@@ -434,8 +463,8 @@ var TableRenderer = function TableRenderer(props) {
|
|
|
434
463
|
break;
|
|
435
464
|
}
|
|
436
465
|
target = [];
|
|
437
|
-
for (
|
|
438
|
-
cur =
|
|
466
|
+
for (_iterator4 = _createForOfIteratorHelperLoose(indexAmounted); !(_step4 = _iterator4()).done;) {
|
|
467
|
+
cur = _step4.value;
|
|
439
468
|
target.push({
|
|
440
469
|
description: cur.name
|
|
441
470
|
});
|
package/lib/components/z-templates-data-common/components/table-renderer/table-renderer.helper.js
CHANGED
|
@@ -184,37 +184,47 @@ exports.handleValueFormat = handleValueFormat;
|
|
|
184
184
|
*/
|
|
185
185
|
var handleColumns = function handleColumns(option, expressions, linkPage, onLink) {
|
|
186
186
|
var _option$actionJson;
|
|
187
|
+
var isFirst = true;
|
|
187
188
|
var dimTarget = [].concat(option.dimension, option.index);
|
|
188
189
|
var columns = dimTarget.map(function (title) {
|
|
189
|
-
var
|
|
190
|
+
var _config5, _config5$link, _config6, _config7, _config8, _title$toString, _config9, _config10, _config11;
|
|
190
191
|
var config;
|
|
191
192
|
var dataIndex;
|
|
193
|
+
var defaultSortOrder;
|
|
192
194
|
var condition;
|
|
193
195
|
if (!config) {
|
|
194
|
-
var _option$dimensionSour, _config;
|
|
196
|
+
var _option$dimensionSour, _config, _config2;
|
|
195
197
|
/* 通过别名或名称 查找当前维度的配置 */
|
|
196
198
|
config = (_option$dimensionSour = option.dimensionSource) === null || _option$dimensionSour === void 0 ? void 0 : _option$dimensionSour.find(function (item) {
|
|
197
199
|
return item.alias === title || item.description === title;
|
|
198
200
|
});
|
|
199
201
|
dataIndex = (_config = config) === null || _config === void 0 ? void 0 : _config.description;
|
|
202
|
+
if ((_config2 = config) !== null && _config2 !== void 0 && _config2.sorted && isFirst) {
|
|
203
|
+
isFirst = false;
|
|
204
|
+
defaultSortOrder = _dataCommon.defaultSort + "end";
|
|
205
|
+
}
|
|
200
206
|
}
|
|
201
207
|
if (!config) {
|
|
202
|
-
var _option$indexSource,
|
|
208
|
+
var _option$indexSource, _config3, _config4;
|
|
203
209
|
/* 通过别名或名称 查找当前指标的配置 */
|
|
204
210
|
config = (_option$indexSource = option.indexSource) === null || _option$indexSource === void 0 ? void 0 : _option$indexSource.find(function (item) {
|
|
205
211
|
return item.alias === title || item.name === title;
|
|
206
212
|
});
|
|
207
|
-
dataIndex = (
|
|
213
|
+
dataIndex = (_config3 = config) === null || _config3 === void 0 ? void 0 : _config3.name;
|
|
214
|
+
if ((_config4 = config) !== null && _config4 !== void 0 && _config4.sorted && isFirst) {
|
|
215
|
+
isFirst = false;
|
|
216
|
+
defaultSortOrder = _dataCommon.defaultSort + "end";
|
|
217
|
+
}
|
|
208
218
|
}
|
|
209
219
|
/* 条件格式设置 */
|
|
210
220
|
// if (expressions?.length) {
|
|
211
221
|
// condition = expressions?.filter((item) => item?.index?.includes(config?.name));
|
|
212
222
|
// }
|
|
213
223
|
|
|
214
|
-
var _ref4 = ((
|
|
224
|
+
var _ref4 = ((_config5 = config) === null || _config5 === void 0 ? void 0 : (_config5$link = _config5.link) === null || _config5$link === void 0 ? void 0 : _config5$link.split(_dataCommon.separator)) || [],
|
|
215
225
|
dataSetName = _ref4[0];
|
|
216
226
|
var index;
|
|
217
|
-
if ((
|
|
227
|
+
if ((_config6 = config) !== null && _config6 !== void 0 && _config6.link && linkPage !== null && linkPage !== void 0 && linkPage.length) {
|
|
218
228
|
index = linkPage.findIndex(function (link) {
|
|
219
229
|
return "" + link.dataSetName + _dataCommon.separator + link.title === config.link;
|
|
220
230
|
});
|
|
@@ -223,12 +233,13 @@ var handleColumns = function handleColumns(option, expressions, linkPage, onLink
|
|
|
223
233
|
title: title,
|
|
224
234
|
dataIndex: dataIndex,
|
|
225
235
|
ellipsis: true,
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
236
|
+
defaultSortOrder: defaultSortOrder,
|
|
237
|
+
sorter: (_config7 = config) === null || _config7 === void 0 ? void 0 : _config7.sorted,
|
|
238
|
+
width: ((_config8 = config) === null || _config8 === void 0 ? void 0 : _config8.width) || (0, _dataCommon.computeWidth)(title === null || title === void 0 ? void 0 : (_title$toString = title.toString()) === null || _title$toString === void 0 ? void 0 : _title$toString.length),
|
|
239
|
+
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,
|
|
229
240
|
render: function render(value, record) {
|
|
230
|
-
var _config$render,
|
|
231
|
-
return config.custom ? (_config$render = (
|
|
241
|
+
var _config$render, _config12;
|
|
242
|
+
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 () {
|
|
232
243
|
return onLink({
|
|
233
244
|
dataSetName: dataSetName,
|
|
234
245
|
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
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.__esModule = true;
|
|
5
|
-
exports.timeUnit = exports.tableConfigDefault = exports.separator = exports.saveDimTarget = exports.handleThousand = exports.handleQueryParams = exports.handlePercent = exports.handleLink = exports.handleDecimal = exports.handleCondition = exports.getType = exports.getReportData = exports.getMaxWidth = exports.getDimTarget = exports.dateStart = exports.computeWidth = exports.BETWEEN = void 0;
|
|
5
|
+
exports.timeUnit = exports.tableConfigDefault = exports.separator = exports.saveDimTarget = exports.handleThousand = exports.handleQueryParams = exports.handlePercent = exports.handleLink = exports.handleDecimal = exports.handleCondition = exports.getType = exports.getReportData = exports.getMaxWidth = exports.getDimTarget = exports.defaultSort = exports.dateStart = exports.computeWidth = exports.BETWEEN = void 0;
|
|
6
6
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
7
7
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
@@ -34,8 +34,12 @@ var timeUnit = 60 * 1000;
|
|
|
34
34
|
exports.timeUnit = timeUnit;
|
|
35
35
|
var BETWEEN = '<=,<';
|
|
36
36
|
|
|
37
|
-
/**
|
|
37
|
+
/** 默认排序 */
|
|
38
38
|
exports.BETWEEN = BETWEEN;
|
|
39
|
+
var defaultSort = 'asc';
|
|
40
|
+
|
|
41
|
+
/** 数据类型 */
|
|
42
|
+
exports.defaultSort = defaultSort;
|
|
39
43
|
/**
|
|
40
44
|
* 获取数据类型
|
|
41
45
|
* @param {any} value
|
|
@@ -189,7 +193,7 @@ var handleCondition = function handleCondition(value, handledValue, conditions)
|
|
|
189
193
|
|
|
190
194
|
// mock
|
|
191
195
|
exports.handleCondition = handleCondition;
|
|
192
|
-
var token = 'scm:tenant:token:2:104:
|
|
196
|
+
var token = 'scm:tenant:token:2:104:4EE94781916163519F3A5744296BAD40';
|
|
193
197
|
|
|
194
198
|
/** 获取维度指标 */
|
|
195
199
|
var getDimTarget = /*#__PURE__*/function () {
|
|
@@ -103,6 +103,7 @@ var ZTemplatesDataCommon = /*#__PURE__*/_react["default"].forwardRef(function (p
|
|
|
103
103
|
};
|
|
104
104
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
105
105
|
return {
|
|
106
|
+
formRef: formRef,
|
|
106
107
|
onLink: onLink,
|
|
107
108
|
onQueryValues: onQueryValues,
|
|
108
109
|
onQueryFormatValues: onQueryFormatValues
|
package/lib/utils/props/tpl.d.ts
CHANGED
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ztocwst/rc-pro-materials",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.23",
|
|
4
4
|
"description": "@ztocwst/rc-pro-materials",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@alifd/next": "^1.25.27",
|
|
72
72
|
"@alilc/build-plugin-alt": "^1.3.3",
|
|
73
73
|
"@types/antd": "^1.0.0",
|
|
74
|
-
"@ztocwst/rc-pro": "^0.4.
|
|
74
|
+
"@ztocwst/rc-pro": "^0.4.66",
|
|
75
75
|
"antd": "4.22.3",
|
|
76
76
|
"moment": "latest",
|
|
77
77
|
"prop-types": "^15.5.8",
|
|
@@ -86,9 +86,9 @@
|
|
|
86
86
|
},
|
|
87
87
|
"componentConfig": {
|
|
88
88
|
"isComponentLibrary": true,
|
|
89
|
-
"materialSchema": "https://npm.ztocwst.com/@ztocwst/rc-pro-materials@0.2.
|
|
89
|
+
"materialSchema": "https://npm.ztocwst.com/@ztocwst/rc-pro-materials@0.2.23/build/lowcode/assets-prod.json"
|
|
90
90
|
},
|
|
91
|
-
"homepage": "https://unpkg.com/@ztocwst/rc-pro-materials@0.2.
|
|
91
|
+
"homepage": "https://unpkg.com/@ztocwst/rc-pro-materials@0.2.23/build/index.html",
|
|
92
92
|
"publishConfig": {
|
|
93
93
|
"registry": "https://registry.npmjs.org/",
|
|
94
94
|
"access": "public"
|