@ztocwst/rc-pro-materials 0.1.26 → 0.1.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 (68) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +8 -8
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +5 -5
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +8 -8
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +9 -9
  11. package/dist/SCM_Comps.css +1 -1
  12. package/dist/SCM_Comps.js +9 -9
  13. package/dist/SCM_Comps.js.map +1 -1
  14. package/es/components/z-templates-data-common/components/chart-renderer/index.d.ts +14 -0
  15. package/es/components/z-templates-data-common/components/chart-renderer/index.js +108 -0
  16. package/es/components/z-templates-data-common/components/custom-renderer/index.d.ts +13 -0
  17. package/es/components/z-templates-data-common/components/custom-renderer/index.js +161 -0
  18. package/es/components/z-templates-data-common/components/dim-target/dim-target.helper.d.ts +39 -0
  19. package/es/components/z-templates-data-common/components/dim-target/dim-target.helper.js +1 -0
  20. package/es/components/z-templates-data-common/components/dim-target/index.d.ts +16 -0
  21. package/es/components/z-templates-data-common/components/dim-target/index.js +430 -0
  22. package/es/components/z-templates-data-common/components/dim-target/index.less +49 -0
  23. package/es/components/z-templates-data-common/components/dim-target/useUpdateEffect.d.ts +8 -0
  24. package/es/components/z-templates-data-common/components/dim-target/useUpdateEffect.js +26 -0
  25. package/es/components/z-templates-data-common/components/link-renderer/index.d.ts +16 -0
  26. package/es/components/z-templates-data-common/components/link-renderer/index.js +316 -0
  27. package/es/components/z-templates-data-common/components/link-renderer/index.less +31 -0
  28. package/es/components/z-templates-data-common/components/table-renderer/index.d.ts +6 -0
  29. package/es/components/z-templates-data-common/components/table-renderer/index.js +479 -0
  30. package/es/components/z-templates-data-common/components/table-renderer/table-renderer.helper.d.ts +64 -0
  31. package/es/components/z-templates-data-common/components/table-renderer/table-renderer.helper.js +219 -0
  32. package/es/components/z-templates-data-common/data-common.d.ts +102 -0
  33. package/es/components/z-templates-data-common/data-common.helper.d.ts +61 -0
  34. package/es/components/z-templates-data-common/data-common.helper.js +330 -0
  35. package/es/components/z-templates-data-common/data-common.js +141 -0
  36. package/es/components/z-templates-data-common/index.d.ts +3 -0
  37. package/es/components/z-templates-data-common/index.js +2 -0
  38. package/es/index.d.ts +2 -0
  39. package/es/index.js +1 -0
  40. package/es/style.js +4 -0
  41. package/lib/components/z-templates-data-common/components/chart-renderer/index.d.ts +14 -0
  42. package/lib/components/z-templates-data-common/components/chart-renderer/index.js +116 -0
  43. package/lib/components/z-templates-data-common/components/custom-renderer/index.d.ts +13 -0
  44. package/lib/components/z-templates-data-common/components/custom-renderer/index.js +167 -0
  45. package/lib/components/z-templates-data-common/components/dim-target/dim-target.helper.d.ts +39 -0
  46. package/lib/components/z-templates-data-common/components/dim-target/dim-target.helper.js +3 -0
  47. package/lib/components/z-templates-data-common/components/dim-target/index.d.ts +16 -0
  48. package/lib/components/z-templates-data-common/components/dim-target/index.js +438 -0
  49. package/lib/components/z-templates-data-common/components/dim-target/index.less +49 -0
  50. package/lib/components/z-templates-data-common/components/dim-target/useUpdateEffect.d.ts +8 -0
  51. package/lib/components/z-templates-data-common/components/dim-target/useUpdateEffect.js +30 -0
  52. package/lib/components/z-templates-data-common/components/link-renderer/index.d.ts +16 -0
  53. package/lib/components/z-templates-data-common/components/link-renderer/index.js +322 -0
  54. package/lib/components/z-templates-data-common/components/link-renderer/index.less +31 -0
  55. package/lib/components/z-templates-data-common/components/table-renderer/index.d.ts +6 -0
  56. package/lib/components/z-templates-data-common/components/table-renderer/index.js +485 -0
  57. package/lib/components/z-templates-data-common/components/table-renderer/table-renderer.helper.d.ts +64 -0
  58. package/lib/components/z-templates-data-common/components/table-renderer/table-renderer.helper.js +228 -0
  59. package/lib/components/z-templates-data-common/data-common.d.ts +102 -0
  60. package/lib/components/z-templates-data-common/data-common.helper.d.ts +61 -0
  61. package/lib/components/z-templates-data-common/data-common.helper.js +349 -0
  62. package/lib/components/z-templates-data-common/data-common.js +147 -0
  63. package/lib/components/z-templates-data-common/index.d.ts +3 -0
  64. package/lib/components/z-templates-data-common/index.js +8 -0
  65. package/lib/index.d.ts +2 -0
  66. package/lib/index.js +4 -2
  67. package/lib/style.js +4 -0
  68. package/package.json +3 -3
@@ -0,0 +1,228 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ exports.__esModule = true;
5
+ exports.stringTrim = exports.handleValueFormat = exports.handleDimTargetFormat = exports.handleColumns = exports.getDimTargetData = void 0;
6
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
7
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
8
+ var _dataCommon = require("../../data-common.helper");
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; }
12
+ var stringTrim = function stringTrim(str) {
13
+ if (!str) return '';
14
+ return str.replace(/`|'|"/g, '');
15
+ };
16
+
17
+ /**
18
+ * 维度指标数据源处理
19
+ */
20
+ exports.stringTrim = stringTrim;
21
+ var handleDimTargetFormat = function handleDimTargetFormat(dimTargetSource, result) {
22
+ var _dimJson$data, _indexJson$data;
23
+ var _ref = dimTargetSource || {},
24
+ dimJson = _ref.dimJson,
25
+ indexJson = _ref.indexJson;
26
+ /** chartSetting 传入维度数据源 */
27
+ var dimensionSource = dimJson !== null && dimJson !== void 0 && (_dimJson$data = dimJson.data) !== null && _dimJson$data !== void 0 && _dimJson$data.length ? dimJson === null || dimJson === void 0 ? void 0 : dimJson.data : [];
28
+ /** chartSetting 传入指标数据源 */
29
+ var indexSource = indexJson !== null && indexJson !== void 0 && (_indexJson$data = indexJson.data) !== null && _indexJson$data !== void 0 && _indexJson$data.length ? indexJson === null || indexJson === void 0 ? void 0 : indexJson.data : [];
30
+ var _ref2 = result || {},
31
+ customIndexJson = _ref2.customIndexJson,
32
+ customDimJson = _ref2.customDimJson;
33
+ var rememberCheck = !!customDimJson || !!customIndexJson;
34
+ /** 记住勾选保存的维度;别名容易被修改,保存的是 description 属性 */
35
+ var customDim = customDimJson ? JSON.parse(customDimJson) : [];
36
+ /** 记住勾选保存的指标;别名容易被修改,保存的是 name 属性 */
37
+ var customIndex = customIndexJson ? JSON.parse(customIndexJson) : [];
38
+ /** 维度 */
39
+ var dimension = [];
40
+ /** 指标 */
41
+ var index = [];
42
+ if (dimensionSource.length) {
43
+ for (var _iterator = _createForOfIteratorHelperLoose(dimensionSource), _step; !(_step = _iterator()).done;) {
44
+ var item = _step.value;
45
+ var selected = item === null || item === void 0 ? void 0 : item.checked;
46
+ var alias = item === null || item === void 0 ? void 0 : item.alias;
47
+ var description = stringTrim(item.description);
48
+ if (customDim !== null && customDim !== void 0 && customDim.length) {
49
+ selected = customDim.includes(description);
50
+ }
51
+ if (selected) {
52
+ dimension.push(alias || description);
53
+ }
54
+ item.description = description;
55
+ }
56
+ }
57
+ if (indexSource.length) {
58
+ for (var _iterator2 = _createForOfIteratorHelperLoose(indexSource), _step2; !(_step2 = _iterator2()).done;) {
59
+ var _item = _step2.value;
60
+ var _selected = _item === null || _item === void 0 ? void 0 : _item.checked;
61
+ var _alias = _item === null || _item === void 0 ? void 0 : _item.alias;
62
+ var name = stringTrim(_item.name);
63
+ if (customIndex !== null && customIndex !== void 0 && customIndex.length) {
64
+ _selected = customIndex.includes(name);
65
+ }
66
+ if (_selected) {
67
+ index.push(_alias || name);
68
+ }
69
+ _item.name = name;
70
+ }
71
+ }
72
+
73
+ /* 维度全选 */
74
+ var dimAll = !!dimensionSource.length && dimensionSource.length === dimension.length;
75
+ /* 维度不确定选中 */
76
+ var dimIndeterminate = dimAll ? false : !!dimension.length;
77
+
78
+ /* 指标全选 */
79
+ var targetAll = !!indexSource.length && indexSource.length === index.length;
80
+ /* 指标不确定选中 */
81
+ var targetsIndeterminate = targetAll ? false : !!index.length;
82
+ return {
83
+ rememberCheck: rememberCheck,
84
+ dims: {
85
+ all: dimAll,
86
+ title: dimJson === null || dimJson === void 0 ? void 0 : dimJson.title,
87
+ indeterminate: dimIndeterminate,
88
+ dimension: dimension,
89
+ dimensionSource: dimensionSource
90
+ },
91
+ targets: {
92
+ all: targetAll,
93
+ title: indexJson === null || indexJson === void 0 ? void 0 : indexJson.title,
94
+ indeterminate: targetsIndeterminate,
95
+ index: index,
96
+ indexSource: indexSource
97
+ }
98
+ };
99
+ };
100
+
101
+ /**
102
+ * 获取维度指标数据源
103
+ */
104
+ exports.handleDimTargetFormat = handleDimTargetFormat;
105
+ var getDimTargetData = /*#__PURE__*/function () {
106
+ var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(rcProContext, params, dimTargetSource) {
107
+ var _yield$getDimTarget, success, _yield$getDimTarget$r, result;
108
+ return _regenerator["default"].wrap(function _callee$(_context) {
109
+ while (1) switch (_context.prev = _context.next) {
110
+ case 0:
111
+ if (params !== null && params !== void 0 && params.dataSetName) {
112
+ _context.next = 2;
113
+ break;
114
+ }
115
+ return _context.abrupt("return", handleDimTargetFormat(dimTargetSource));
116
+ case 2:
117
+ _context.prev = 2;
118
+ _context.next = 5;
119
+ return (0, _dataCommon.getDimTarget)(rcProContext, params);
120
+ case 5:
121
+ _yield$getDimTarget = _context.sent;
122
+ success = _yield$getDimTarget.success;
123
+ _yield$getDimTarget$r = _yield$getDimTarget.result;
124
+ result = _yield$getDimTarget$r === void 0 ? {} : _yield$getDimTarget$r;
125
+ if (!success) {
126
+ _context.next = 11;
127
+ break;
128
+ }
129
+ return _context.abrupt("return", handleDimTargetFormat(dimTargetSource, result));
130
+ case 11:
131
+ _context.next = 16;
132
+ break;
133
+ case 13:
134
+ _context.prev = 13;
135
+ _context.t0 = _context["catch"](2);
136
+ return _context.abrupt("return", Promise.reject(_context.t0));
137
+ case 16:
138
+ case "end":
139
+ return _context.stop();
140
+ }
141
+ }, _callee, null, [[2, 13]]);
142
+ }));
143
+ return function getDimTargetData(_x, _x2, _x3) {
144
+ return _ref3.apply(this, arguments);
145
+ };
146
+ }();
147
+
148
+ /**
149
+ * 数据渲染格式处理
150
+ */
151
+ exports.getDimTargetData = getDimTargetData;
152
+ var handleValueFormat = function handleValueFormat(value, record, find, condition, onLink) {
153
+ var _val;
154
+ var val = value;
155
+ if (typeof value === 'number') {
156
+ if (!(find !== null && find !== void 0 && find.percent) && typeof (find === null || find === void 0 ? void 0 : find.precision) === 'number') {
157
+ val = (0, _dataCommon.handleDecimal)(val, find.precision);
158
+ }
159
+ if (find !== null && find !== void 0 && find.thousand) {
160
+ val = (0, _dataCommon.handleThousand)(val);
161
+ }
162
+ if (find !== null && find !== void 0 && find.percent) {
163
+ val = (0, _dataCommon.handlePercent)(val, find.precision);
164
+ }
165
+ }
166
+ if (find !== null && find !== void 0 && find.link) {
167
+ val = (0, _dataCommon.handleLink)(value, onLink);
168
+ }
169
+ if (condition !== null && condition !== void 0 && condition.length) {
170
+ val = (0, _dataCommon.handleCondition)(value, val, condition);
171
+ }
172
+ return (_val = val) !== null && _val !== void 0 ? _val : "-";
173
+ };
174
+
175
+ /**
176
+ * 条件格式
177
+ */
178
+ exports.handleValueFormat = handleValueFormat;
179
+ /**
180
+ * 根据维度指标获取表格列
181
+ */
182
+ var handleColumns = function handleColumns(option, expressions, onLink) {
183
+ var dimTarget = [].concat(option.dimension, option.index);
184
+ return dimTarget.map(function (title) {
185
+ var _find3, _find4, _title$toString;
186
+ var find;
187
+ var dataIndex;
188
+ var condition;
189
+ if (!find) {
190
+ var _option$dimensionSour, _find;
191
+ /* 通过别名或名称 查找当前维度的配置 */
192
+ find = (_option$dimensionSour = option.dimensionSource) === null || _option$dimensionSour === void 0 ? void 0 : _option$dimensionSour.find(function (item) {
193
+ return item.alias === title || item.description === title;
194
+ });
195
+ dataIndex = (_find = find) === null || _find === void 0 ? void 0 : _find.description;
196
+ }
197
+ if (!find) {
198
+ var _option$indexSource, _find2;
199
+ /* 通过别名或名称 查找当前指标的配置 */
200
+ find = (_option$indexSource = option.indexSource) === null || _option$indexSource === void 0 ? void 0 : _option$indexSource.find(function (item) {
201
+ return item.alias === title || item.name === title;
202
+ });
203
+ dataIndex = (_find2 = find) === null || _find2 === void 0 ? void 0 : _find2.name;
204
+ }
205
+ /* 条件格式设置 */
206
+ // if (expressions?.length) {
207
+ // condition = expressions?.filter((item) => item?.index?.includes(find?.name));
208
+ // }
209
+
210
+ return {
211
+ title: title,
212
+ dataIndex: dataIndex,
213
+ ellipsis: true,
214
+ sorter: (_find3 = find) === null || _find3 === void 0 ? void 0 : _find3.sorted,
215
+ width: ((_find4 = find) === null || _find4 === void 0 ? void 0 : _find4.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),
216
+ render: function render(value, record) {
217
+ return handleValueFormat(value, record, find, condition, function () {
218
+ var _find5;
219
+ return onLink({
220
+ dataSetName: (_find5 = find) === null || _find5 === void 0 ? void 0 : _find5.link,
221
+ record: record
222
+ });
223
+ });
224
+ }
225
+ };
226
+ });
227
+ };
228
+ exports.handleColumns = handleColumns;
@@ -0,0 +1,102 @@
1
+ import React from 'react';
2
+ import type { ProFormRenderProps } from '@ztocwst/rc-pro';
3
+ /** 指标配置 */
4
+ export interface TypeTargetProps {
5
+ /** 指标名称 */
6
+ name: string;
7
+ /** 是否默认选中 */
8
+ checked: boolean;
9
+ /** 别名 */
10
+ alias: string;
11
+ /** 英文名 */
12
+ enName: string;
13
+ /** 是否过滤 */
14
+ isFilter: boolean;
15
+ /** 是否可选 */
16
+ optional: boolean;
17
+ /** 小数位 精确度 */
18
+ precision: number;
19
+ /** 是否展示百分号 */
20
+ percent: boolean;
21
+ /** 是否允许排序 */
22
+ sorted: boolean;
23
+ /** 宽度 */
24
+ width: number;
25
+ /** 是否合计 */
26
+ amounted: boolean;
27
+ /** 指标描述 */
28
+ description?: string;
29
+ /** 下转二级页 */
30
+ link?: string;
31
+ /** 查询绑定关系 */
32
+ queryBind?: string;
33
+ /** 依赖 */
34
+ dependencies?: string[];
35
+ }
36
+ /** 表格相关配置 */
37
+ export interface TypeChartSettingProps {
38
+ /** 标题 */
39
+ title?: string;
40
+ /** 维度配置 */
41
+ dimJson?: {
42
+ /** 维度标题 */
43
+ title: string;
44
+ /** 维度项配置 */
45
+ data: Array<Omit<TypeTargetProps, 'amounted' | 'enName' | 'isFilter'>>;
46
+ };
47
+ /** 指标配置 */
48
+ indexJson: {
49
+ title: string;
50
+ /** 指标项配置 */
51
+ data: TypeTargetProps[];
52
+ };
53
+ dataSetName: string;
54
+ /** 自动请求 */
55
+ autoLoad: boolean;
56
+ /** 刷新时间 */
57
+ refreshRate?: number;
58
+ /** 记住勾选 */
59
+ remember?: boolean;
60
+ /** 导出 */
61
+ exporter?: boolean;
62
+ /** 导出配置 */
63
+ exportConfig?: {
64
+ name: string;
65
+ code: string;
66
+ menuId: string;
67
+ };
68
+ /** 条件格式设置 */
69
+ expressions?: any[] | [];
70
+ /** 下钻二级页设置 */
71
+ linkPage?: TypeChartSettingProps[];
72
+ /** 数据源参数"键"" 和 查询参数"值" 和 上一级维度(dim)"值" 关系绑定 */
73
+ queryBind?: Array<{
74
+ sourceQueryKey: string;
75
+ currentQueryKey: string;
76
+ parentDimKey: string;
77
+ }>;
78
+ /** chartRef */
79
+ chartRef?: React.Ref<{
80
+ queryChart: (v: Record<string, any>, d: string | undefined) => void;
81
+ }>;
82
+ /** 确认 */
83
+ onConfirm?: () => void;
84
+ /** 查询参数转换 */
85
+ formatter?: (v: Record<string, any>) => Record<string, any>;
86
+ }
87
+ export interface TypeZTemplatesDataCommonProps {
88
+ /** 查询表单配置 */
89
+ querySetting: ProFormRenderProps;
90
+ /** 内容区配置 */
91
+ chartSetting: TypeChartSettingProps | Array<TypeChartSettingProps & {
92
+ custom: boolean;
93
+ child: (p: any) => React.ReactNode;
94
+ title: string;
95
+ }> | React.ReactNode;
96
+ _unsafe_MixedSetter_chartSetting_select?: any;
97
+ }
98
+ export default class ZTemplatesDataCommonContainer extends React.Component<TypeZTemplatesDataCommonProps, any> {
99
+ chartRef: any;
100
+ constructor(props: any);
101
+ render(): JSX.Element;
102
+ }
@@ -0,0 +1,61 @@
1
+ /// <reference types="react" />
2
+ /** table config */
3
+ export declare const tableConfigDefault: {
4
+ manual: boolean;
5
+ toolBars: boolean;
6
+ hideDefRowSelection: boolean;
7
+ columns: any[];
8
+ };
9
+ /** 字符串拼接分割符 */
10
+ export declare const separator = "***";
11
+ /** 时间单位 */
12
+ export declare const timeUnit: number;
13
+ /** 介于 前闭后开 */
14
+ export declare const BETWEEN = "<=,<";
15
+ /** 数据类型 */
16
+ export type valueType = number | string | null | undefined;
17
+ /**
18
+ * 计算宽
19
+ * @param length
20
+ * @param width
21
+ */
22
+ export declare const computeWidth: (length: number, width?: number) => number;
23
+ /**
24
+ * 获取最大宽
25
+ * @param strArr
26
+ */
27
+ export declare const getMaxWidth: (strArr: any[]) => number;
28
+ /**
29
+ * 处理 QueryParams 去除空字符串
30
+ */
31
+ export declare const handleQueryParams: (query: Record<string, any>) => {
32
+ [x: string]: any;
33
+ };
34
+ /**
35
+ * 处理数据千分位
36
+ */
37
+ export declare const handleThousand: (value: valueType) => valueType;
38
+ /**
39
+ * 保留几位小数点
40
+ */
41
+ export declare const handleDecimal: (value: valueType, decimal?: number) => string;
42
+ /**
43
+ * 百分比转化
44
+ */
45
+ export declare const handlePercent: (value: valueType, decimal?: number, unit?: number) => string;
46
+ /**
47
+ * link外链处理
48
+ */
49
+ export declare const handleLink: (value: valueType, onLink?: () => void) => import("react").JSX.Element;
50
+ /**
51
+ * 条件格式设置
52
+ * @param value 处理前的值
53
+ * @param handledValue 被处理后的值 可能会是link标签
54
+ */
55
+ export declare const handleCondition: (value: valueType, handledValue: any, conditions: any[]) => any;
56
+ /** 获取维度指标 */
57
+ export declare const getDimTarget: (rcProContext: any, params: any) => Promise<any>;
58
+ /** 获取报表数据 */
59
+ export declare const getReportData: (rcProContext: any, params: any) => Promise<any>;
60
+ /** 记住勾选 */
61
+ export declare const saveDimTarget: (rcProContext: any, params: any) => Promise<any>;